84 lines
1.2 MiB
Plaintext
84 lines
1.2 MiB
Plaintext
import{a as ai,b as li,i as hi}from"./lit-element-BUNo9pnf.js";import{t as ui}from"./custom-element-BhZVzxrc.js";import{n as Zt}from"./property-MreHcJY-.js";import{e as ci}from"./query-BApjzB0v.js";import{c as di}from"./_commonjsHelpers-Cpj98o6Y.js";var Qt={exports:{}};/*! For license information please see opensheetmusicdisplay.min.js.LICENSE.txt */(function(rt,gt){(function(bt,pt){rt.exports=pt()})(di,()=>(()=>{var bt={1710(de,g,c){de.exports=function l(s,u,r){function i(h,t){if(!u[h]){if(!s[h]){if(o)return o(h,!0);var f=new Error("Cannot find module '"+h+"'");throw f.code="MODULE_NOT_FOUND",f}var p=u[h]={exports:{}};s[h][0].call(p.exports,function(m){return i(s[h][1][m]||m)},p,p.exports,l,s,u,r)}return u[h].exports}for(var o=void 0,n=0;n<r.length;n++)i(r[n]);return i}({1:[function(l,s,u){var r=l("./utils"),i=l("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";u.encode=function(n){for(var h,t,f,p,m,x,y,d=[],S=0,M=n.length,E=M,L=r.getTypeOf(n)!=="string";S<n.length;)E=M-S,f=L?(h=n[S++],t=S<M?n[S++]:0,S<M?n[S++]:0):(h=n.charCodeAt(S++),t=S<M?n.charCodeAt(S++):0,S<M?n.charCodeAt(S++):0),p=h>>2,m=(3&h)<<4|t>>4,x=1<E?(15&t)<<2|f>>6:64,y=2<E?63&f:64,d.push(o.charAt(p)+o.charAt(m)+o.charAt(x)+o.charAt(y));return d.join("")},u.decode=function(n){var h,t,f,p,m,x,y=0,d=0,S="data:";if(n.substr(0,5)===S)throw new Error("Invalid base64 input, it looks like a data url.");var M,E=3*(n=n.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(n.charAt(n.length-1)===o.charAt(64)&&E--,n.charAt(n.length-2)===o.charAt(64)&&E--,E%1!=0)throw new Error("Invalid base64 input, bad content length.");for(M=i.uint8array?new Uint8Array(0|E):new Array(0|E);y<n.length;)h=o.indexOf(n.charAt(y++))<<2|(p=o.indexOf(n.charAt(y++)))>>4,t=(15&p)<<4|(m=o.indexOf(n.charAt(y++)))>>2,f=(3&m)<<6|(x=o.indexOf(n.charAt(y++))),M[d++]=h,m!==64&&(M[d++]=t),x!==64&&(M[d++]=f);return M}},{"./support":30,"./utils":32}],2:[function(l,s,u){var r=l("./external"),i=l("./stream/DataWorker"),o=l("./stream/Crc32Probe"),n=l("./stream/DataLengthProbe");function h(t,f,p,m,x){this.compressedSize=t,this.uncompressedSize=f,this.crc32=p,this.compression=m,this.compressedContent=x}h.prototype={getContentWorker:function(){var t=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new n("data_length")),f=this;return t.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),t},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},h.createWorkerFrom=function(t,f,p){return t.pipe(new o).pipe(new n("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new n("compressedSize")).withStreamInfo("compression",f)},s.exports=h},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(l,s,u){var r=l("./stream/GenericWorker");u.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},u.DEFLATE=l("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(l,s,u){var r=l("./utils"),i=function(){for(var o,n=[],h=0;h<256;h++){o=h;for(var t=0;t<8;t++)o=1&o?3988292384^o>>>1:o>>>1;n[h]=o}return n}();s.exports=function(o,n){return o!==void 0&&o.length?r.getTypeOf(o)!=="string"?function(h,t,f){var p=i,m=0+f;h^=-1;for(var x=0;x<m;x++)h=h>>>8^p[255&(h^t[x])];return-1^h}(0|n,o,o.length):function(h,t,f){var p=i,m=0+f;h^=-1;for(var x=0;x<m;x++)h=h>>>8^p[255&(h^t.charCodeAt(x))];return-1^h}(0|n,o,o.length):0}},{"./utils":32}],5:[function(l,s,u){u.base64=!1,u.binary=!1,u.dir=!1,u.createFolders=!0,u.date=null,u.compression=null,u.compressionOptions=null,u.comment=null,u.unixPermissions=null,u.dosPermissions=null},{}],6:[function(l,s,u){var r;r=typeof Promise<"u"?Promise:l("lie"),s.exports={Promise:r}},{lie:37}],7:[function(l,s,u){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=l("pako"),o=l("./utils"),n=l("./stream/GenericWorker"),h=r?"uint8array":"array";function t(f,p){n.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}u.magic="\b\0",o.inherits(t,n),t.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(h,f.data),!1)},t.prototype.flush=function(){n.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},t.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this._pako=null},t.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},u.compressWorker=function(f){return new t("Deflate",f)},u.uncompressWorker=function(){return new t("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(l,s,u){function r(m,x){var y,d="";for(y=0;y<x;y++)d+=String.fromCharCode(255&m),m>>>=8;return d}function i(m,x,y,d,S,M){var E,L,I=m.file,T=m.compression,A=M!==h.utf8encode,v=o.transformTo("string",M(I.name)),B=o.transformTo("string",h.utf8encode(I.name)),D=I.comment,_=o.transformTo("string",M(D)),F=o.transformTo("string",h.utf8encode(D)),k=B.length!==I.name.length,j=F.length!==D.length,P="",G="",Y="",X=I.dir,ie=I.date,oe={crc32:0,compressedSize:0,uncompressedSize:0};x&&!y||(oe.crc32=m.crc32,oe.compressedSize=m.compressedSize,oe.uncompressedSize=m.uncompressedSize);var $=0;x&&($|=8),A||!k&&!j||($|=2048);var Q=0,ne=0;X&&(Q|=16),S==="UNIX"?(ne=798,Q|=function(N,R){var O=N;return N||(O=R?16893:33204),(65535&O)<<16}(I.unixPermissions,X)):(ne=20,Q|=function(N){return 63&(N||0)}(I.dosPermissions)),E=ie.getUTCHours(),E<<=6,E|=ie.getUTCMinutes(),E<<=5,E|=ie.getUTCSeconds()/2,L=ie.getUTCFullYear()-1980,L<<=4,L|=ie.getUTCMonth()+1,L<<=5,L|=ie.getUTCDate(),k&&(G=r(1,1)+r(t(v),4)+B,P+="up"+r(G.length,2)+G),j&&(Y=r(1,1)+r(t(_),4)+F,P+="uc"+r(Y.length,2)+Y);var ee="";return ee+=`
|
|
\0`,ee+=r($,2),ee+=T.magic,ee+=r(E,2),ee+=r(L,2),ee+=r(oe.crc32,4),ee+=r(oe.compressedSize,4),ee+=r(oe.uncompressedSize,4),ee+=r(v.length,2),ee+=r(P.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ee+v+P,dirRecord:f.CENTRAL_FILE_HEADER+r(ne,2)+ee+r(_.length,2)+"\0\0\0\0"+r(Q,4)+r(d,4)+v+P+_}}var o=l("../utils"),n=l("../stream/GenericWorker"),h=l("../utf8"),t=l("../crc32"),f=l("../signature");function p(m,x,y,d){n.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=y,this.encodeFileName=d,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(p,n),p.prototype.push=function(m){var x=m.meta.percent||0,y=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,n.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:y?(x+100*(y-d-1))/y:100}}))},p.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var x=this.streamFiles&&!m.file.dir;if(x){var y=i(m,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(m){this.accumulate=!1;var x=this.streamFiles&&!m.file.dir,y=i(m,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),x)this.push({data:function(d){return f.DATA_DESCRIPTOR+r(d.crc32,4)+r(d.compressedSize,4)+r(d.uncompressedSize,4)}(m),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var m=this.bytesWritten,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var y=this.bytesWritten-m,d=function(S,M,E,L,I){var T=o.transformTo("string",I(L));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(S,2)+r(S,2)+r(M,4)+r(E,4)+r(T.length,2)+T}(this.dirRecords.length,y,m,this.zipComment,this.encodeFileName);this.push({data:d,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(m){this._sources.push(m);var x=this;return m.on("data",function(y){x.processChunk(y)}),m.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),m.on("error",function(y){x.error(y)}),this},p.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(m){var x=this._sources;if(!n.prototype.error.call(this,m))return!1;for(var y=0;y<x.length;y++)try{x[y].error(m)}catch{}return!0},p.prototype.lock=function(){n.prototype.lock.call(this);for(var m=this._sources,x=0;x<m.length;x++)m[x].lock()},s.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(l,s,u){var r=l("../compressions"),i=l("./ZipFileWorker");u.generateWorker=function(o,n,h){var t=new i(n.streamFiles,h,n.platform,n.encodeFileName),f=0;try{o.forEach(function(p,m){f++;var x=function(M,E){var L=M||E,I=r[L];if(!I)throw new Error(L+" is not a valid compression method !");return I}(m.options.compression,n.compression),y=m.options.compressionOptions||n.compressionOptions||{},d=m.dir,S=m.date;m._compressWorker(x,y).withStreamInfo("file",{name:p,dir:d,date:S,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(t)}),t.entriesCount=f}catch(p){t.error(p)}return t}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(l,s,u){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new r;for(var o in this)typeof this[o]!="function"&&(i[o]=this[o]);return i}}(r.prototype=l("./object")).loadAsync=l("./load"),r.support=l("./support"),r.defaults=l("./defaults"),r.version="3.10.1",r.loadAsync=function(i,o){return new r().loadAsync(i,o)},r.external=l("./external"),s.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(l,s,u){var r=l("./utils"),i=l("./external"),o=l("./utf8"),n=l("./zipEntries"),h=l("./stream/Crc32Probe"),t=l("./nodejsUtils");function f(p){return new i.Promise(function(m,x){var y=p.decompressed.getContentWorker().pipe(new h);y.on("error",function(d){x(d)}).on("end",function(){y.streamInfo.crc32!==p.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}s.exports=function(p,m){var x=this;return m=r.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),t.isNode&&t.isStream(p)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",p,!0,m.optimizedBinaryString,m.base64).then(function(y){var d=new n(m);return d.load(y),d}).then(function(y){var d=[i.Promise.resolve(y)],S=y.files;if(m.checkCRC32)for(var M=0;M<S.length;M++)d.push(f(S[M]));return i.Promise.all(d)}).then(function(y){for(var d=y.shift(),S=d.files,M=0;M<S.length;M++){var E=S[M],L=E.fileNameStr,I=r.resolve(E.fileNameStr);x.file(I,E.decompressed,{binary:!0,optimizedBinaryString:!0,date:E.date,dir:E.dir,comment:E.fileCommentStr.length?E.fileCommentStr:null,unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions,createFolders:m.createFolders}),E.dir||(x.file(I).unsafeOriginalName=L)}return d.zipComment.length&&(x.comment=d.zipComment),x})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(l,s,u){var r=l("../utils"),i=l("../stream/GenericWorker");function o(n,h){i.call(this,"Nodejs stream input adapter for "+n),this._upstreamEnded=!1,this._bindStream(h)}r.inherits(o,i),o.prototype._bindStream=function(n){var h=this;(this._stream=n).pause(),n.on("data",function(t){h.push({data:t,meta:{percent:0}})}).on("error",function(t){h.isPaused?this.generatedError=t:h.error(t)}).on("end",function(){h.isPaused?h._upstreamEnded=!0:h.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},s.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(l,s,u){var r=l("readable-stream").Readable;function i(o,n,h){r.call(this,n),this._helper=o;var t=this;o.on("data",function(f,p){t.push(f)||t._helper.pause(),h&&h(p)}).on("error",function(f){t.emit("error",f)}).on("end",function(){t.push(null)})}l("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},s.exports=i},{"../utils":32,"readable-stream":16}],14:[function(l,s,u){s.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,i);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,i)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var i=new Buffer(r);return i.fill(0),i},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(l,s,u){function r(I,T,A){var v,B=o.getTypeOf(T),D=o.extend(A||{},t);D.date=D.date||new Date,D.compression!==null&&(D.compression=D.compression.toUpperCase()),typeof D.unixPermissions=="string"&&(D.unixPermissions=parseInt(D.unixPermissions,8)),D.unixPermissions&&16384&D.unixPermissions&&(D.dir=!0),D.dosPermissions&&16&D.dosPermissions&&(D.dir=!0),D.dir&&(I=S(I)),D.createFolders&&(v=d(I))&&M.call(this,v,!0);var _=B==="string"&&D.binary===!1&&D.base64===!1;A&&A.binary!==void 0||(D.binary=!_),(T instanceof f&&T.uncompressedSize===0||D.dir||!T||T.length===0)&&(D.base64=!1,D.binary=!0,T="",D.compression="STORE",B="string");var F;F=T instanceof f||T instanceof n?T:x.isNode&&x.isStream(T)?new y(I,T):o.prepareContent(I,T,D.binary,D.optimizedBinaryString,D.base64);var k=new p(I,F,D);this.files[I]=k}var i=l("./utf8"),o=l("./utils"),n=l("./stream/GenericWorker"),h=l("./stream/StreamHelper"),t=l("./defaults"),f=l("./compressedObject"),p=l("./zipObject"),m=l("./generate"),x=l("./nodejsUtils"),y=l("./nodejs/NodejsStreamInputAdapter"),d=function(I){I.slice(-1)==="/"&&(I=I.substring(0,I.length-1));var T=I.lastIndexOf("/");return 0<T?I.substring(0,T):""},S=function(I){return I.slice(-1)!=="/"&&(I+="/"),I},M=function(I,T){return T=T!==void 0?T:t.createFolders,I=S(I),this.files[I]||r.call(this,I,null,{dir:!0,createFolders:T}),this.files[I]};function E(I){return Object.prototype.toString.call(I)==="[object RegExp]"}var L={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(I){var T,A,v;for(T in this.files)v=this.files[T],(A=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&I(A,v)},filter:function(I){var T=[];return this.forEach(function(A,v){I(A,v)&&T.push(v)}),T},file:function(I,T,A){if(arguments.length!==1)return I=this.root+I,r.call(this,I,T,A),this;if(E(I)){var v=I;return this.filter(function(D,_){return!_.dir&&v.test(D)})}var B=this.files[this.root+I];return B&&!B.dir?B:null},folder:function(I){if(!I)return this;if(E(I))return this.filter(function(B,D){return D.dir&&I.test(B)});var T=this.root+I,A=M.call(this,T),v=this.clone();return v.root=A.name,v},remove:function(I){I=this.root+I;var T=this.files[I];if(T||(I.slice(-1)!=="/"&&(I+="/"),T=this.files[I]),T&&!T.dir)delete this.files[I];else for(var A=this.filter(function(B,D){return D.name.slice(0,I.length)===I}),v=0;v<A.length;v++)delete this.files[A[v].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(I){var T,A={};try{if((A=o.extend(I||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=A.type.toLowerCase(),A.compression=A.compression.toUpperCase(),A.type==="binarystring"&&(A.type="string"),!A.type)throw new Error("No output type specified.");o.checkSupport(A.type),A.platform!=="darwin"&&A.platform!=="freebsd"&&A.platform!=="linux"&&A.platform!=="sunos"||(A.platform="UNIX"),A.platform==="win32"&&(A.platform="DOS");var v=A.comment||this.comment||"";T=m.generateWorker(this,A,v)}catch(B){(T=new n("error")).error(B)}return new h(T,A.type||"string",A.mimeType)},generateAsync:function(I,T){return this.generateInternalStream(I).accumulate(T)},generateNodeStream:function(I,T){return(I=I||{}).type||(I.type="nodebuffer"),this.generateInternalStream(I).toNodejsStream(T)}};s.exports=L},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(l,s,u){s.exports=l("stream")},{stream:void 0}],17:[function(l,s,u){var r=l("./DataReader");function i(o){r.call(this,o);for(var n=0;n<this.data.length;n++)o[n]=255&o[n]}l("../utils").inherits(i,r),i.prototype.byteAt=function(o){return this.data[this.zero+o]},i.prototype.lastIndexOfSignature=function(o){for(var n=o.charCodeAt(0),h=o.charCodeAt(1),t=o.charCodeAt(2),f=o.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===n&&this.data[p+1]===h&&this.data[p+2]===t&&this.data[p+3]===f)return p-this.zero;return-1},i.prototype.readAndCheckSignature=function(o){var n=o.charCodeAt(0),h=o.charCodeAt(1),t=o.charCodeAt(2),f=o.charCodeAt(3),p=this.readData(4);return n===p[0]&&h===p[1]&&t===p[2]&&f===p[3]},i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var n=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},s.exports=i},{"../utils":32,"./DataReader":18}],18:[function(l,s,u){var r=l("../utils");function i(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var n,h=0;for(this.checkOffset(o),n=this.index+o-1;n>=this.index;n--)h=(h<<8)+this.byteAt(n);return this.index+=o,h},readString:function(o){return r.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},s.exports=i},{"../utils":32}],19:[function(l,s,u){var r=l("./Uint8ArrayReader");function i(o){r.call(this,o)}l("../utils").inherits(i,r),i.prototype.readData=function(o){this.checkOffset(o);var n=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},s.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(l,s,u){var r=l("./DataReader");function i(o){r.call(this,o)}l("../utils").inherits(i,r),i.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},i.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},i.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},i.prototype.readData=function(o){this.checkOffset(o);var n=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},s.exports=i},{"../utils":32,"./DataReader":18}],21:[function(l,s,u){var r=l("./ArrayReader");function i(o){r.call(this,o)}l("../utils").inherits(i,r),i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var n=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,n},s.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(l,s,u){var r=l("../utils"),i=l("../support"),o=l("./ArrayReader"),n=l("./StringReader"),h=l("./NodeBufferReader"),t=l("./Uint8ArrayReader");s.exports=function(f){var p=r.getTypeOf(f);return r.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new h(f):i.uint8array?new t(r.transformTo("uint8array",f)):new o(r.transformTo("array",f)):new n(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(l,s,u){u.LOCAL_FILE_HEADER="PK",u.CENTRAL_FILE_HEADER="PK",u.CENTRAL_DIRECTORY_END="PK",u.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",u.ZIP64_CENTRAL_DIRECTORY_END="PK",u.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(l,s,u){var r=l("./GenericWorker"),i=l("../utils");function o(n){r.call(this,"ConvertWorker to "+n),this.destType=n}i.inherits(o,r),o.prototype.processChunk=function(n){this.push({data:i.transformTo(this.destType,n.data),meta:n.meta})},s.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(l,s,u){var r=l("./GenericWorker"),i=l("../crc32");function o(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}l("../utils").inherits(o,r),o.prototype.processChunk=function(n){this.streamInfo.crc32=i(n.data,this.streamInfo.crc32||0),this.push(n)},s.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(l,s,u){var r=l("../utils"),i=l("./GenericWorker");function o(n){i.call(this,"DataLengthProbe for "+n),this.propName=n,this.withStreamInfo(n,0)}r.inherits(o,i),o.prototype.processChunk=function(n){if(n){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+n.data.length}i.prototype.processChunk.call(this,n)},s.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(l,s,u){var r=l("../utils"),i=l("./GenericWorker");function o(n){i.call(this,"DataWorker");var h=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,n.then(function(t){h.dataIsReady=!0,h.data=t,h.max=t&&t.length||0,h.type=r.getTypeOf(t),h.isPaused||h._tickAndRepeat()},function(t){h.error(t)})}r.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var n=null,h=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":n=this.data.substring(this.index,h);break;case"uint8array":n=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":n=this.data.slice(this.index,h)}return this.index=h,this.push({data:n,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(l,s,u){function r(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,o){return this._listeners[i].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,o){if(this._listeners[i])for(var n=0;n<this._listeners[i].length;n++)this._listeners[i][n].call(this,o)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var o=this;return i.on("data",function(n){o.processChunk(n)}),i.on("end",function(){o.end()}),i.on("error",function(n){o.error(n)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,o){return this.extraStreamInfo[i]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},s.exports=r},{}],29:[function(l,s,u){var r=l("../utils"),i=l("./ConvertWorker"),o=l("./GenericWorker"),n=l("../base64"),h=l("../support"),t=l("../external"),f=null;if(h.nodestream)try{f=l("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,x,y){var d=x;switch(x){case"blob":case"arraybuffer":d="uint8array";break;case"base64":d="string"}try{this._internalType=d,this._outputType=x,this._mimeType=y,r.checkSupport(d),this._worker=m.pipe(new i(d)),m.lock()}catch(S){this._worker=new o("error"),this._worker.error(S)}}p.prototype={accumulate:function(m){return function(x,y){return new t.Promise(function(d,S){var M=[],E=x._internalType,L=x._outputType,I=x._mimeType;x.on("data",function(T,A){M.push(T),y&&y(A)}).on("error",function(T){M=[],S(T)}).on("end",function(){try{var T=function(A,v,B){switch(A){case"blob":return r.newBlob(r.transformTo("arraybuffer",v),B);case"base64":return n.encode(v);default:return r.transformTo(A,v)}}(L,function(A,v){var B,D=0,_=null,F=0;for(B=0;B<v.length;B++)F+=v[B].length;switch(A){case"string":return v.join("");case"array":return Array.prototype.concat.apply([],v);case"uint8array":for(_=new Uint8Array(F),B=0;B<v.length;B++)_.set(v[B],D),D+=v[B].length;return _;case"nodebuffer":return Buffer.concat(v);default:throw new Error("concat : unsupported type '"+A+"'")}}(E,M),I);d(T)}catch(A){S(A)}M=[]}).resume()})}(this,m)},on:function(m,x){var y=this;return m==="data"?this._worker.on(m,function(d){x.call(y,d.data,d.meta)}):this._worker.on(m,function(){r.delay(x,arguments,y)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},s.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(l,s,u){if(u.base64=!0,u.array=!0,u.string=!0,u.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",u.nodebuffer=typeof Buffer<"u",u.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")u.blob=!1;else{var r=new ArrayBuffer(0);try{u.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),u.blob=i.getBlob("application/zip").size===0}catch{u.blob=!1}}}try{u.nodestream=!!l("readable-stream").Readable}catch{u.nodestream=!1}},{"readable-stream":16}],31:[function(l,s,u){for(var r=l("./utils"),i=l("./support"),o=l("./nodejsUtils"),n=l("./stream/GenericWorker"),h=new Array(256),t=0;t<256;t++)h[t]=252<=t?6:248<=t?5:240<=t?4:224<=t?3:192<=t?2:1;function f(){n.call(this,"utf-8 decode"),this.leftOver=null}function p(){n.call(this,"utf-8 encode")}h[254]=h[254]=1,u.utf8encode=function(m){return i.nodebuffer?o.newBufferFrom(m,"utf-8"):function(x){var y,d,S,M,E,L=x.length,I=0;for(M=0;M<L;M++)(64512&(d=x.charCodeAt(M)))==55296&&M+1<L&&(64512&(S=x.charCodeAt(M+1)))==56320&&(d=65536+(d-55296<<10)+(S-56320),M++),I+=d<128?1:d<2048?2:d<65536?3:4;for(y=i.uint8array?new Uint8Array(I):new Array(I),M=E=0;E<I;M++)(64512&(d=x.charCodeAt(M)))==55296&&M+1<L&&(64512&(S=x.charCodeAt(M+1)))==56320&&(d=65536+(d-55296<<10)+(S-56320),M++),d<128?y[E++]=d:(d<2048?y[E++]=192|d>>>6:(d<65536?y[E++]=224|d>>>12:(y[E++]=240|d>>>18,y[E++]=128|d>>>12&63),y[E++]=128|d>>>6&63),y[E++]=128|63&d);return y}(m)},u.utf8decode=function(m){return i.nodebuffer?r.transformTo("nodebuffer",m).toString("utf-8"):function(x){var y,d,S,M,E=x.length,L=new Array(2*E);for(y=d=0;y<E;)if((S=x[y++])<128)L[d++]=S;else if(4<(M=h[S]))L[d++]=65533,y+=M-1;else{for(S&=M===2?31:M===3?15:7;1<M&&y<E;)S=S<<6|63&x[y++],M--;1<M?L[d++]=65533:S<65536?L[d++]=S:(S-=65536,L[d++]=55296|S>>10&1023,L[d++]=56320|1023&S)}return L.length!==d&&(L.subarray?L=L.subarray(0,d):L.length=d),r.applyFromCharCode(L)}(m=r.transformTo(i.uint8array?"uint8array":"array",m))},r.inherits(f,n),f.prototype.processChunk=function(m){var x=r.transformTo(i.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var y=x;(x=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),x.set(y,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var d=function(M,E){var L;for((E=E||M.length)>M.length&&(E=M.length),L=E-1;0<=L&&(192&M[L])==128;)L--;return L<0||L===0?E:L+h[M[L]]>E?L:E}(x),S=x;d!==x.length&&(i.uint8array?(S=x.subarray(0,d),this.leftOver=x.subarray(d,x.length)):(S=x.slice(0,d),this.leftOver=x.slice(d,x.length))),this.push({data:u.utf8decode(S),meta:m.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=f,r.inherits(p,n),p.prototype.processChunk=function(m){this.push({data:u.utf8encode(m.data),meta:m.meta})},u.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(l,s,u){var r=l("./support"),i=l("./base64"),o=l("./nodejsUtils"),n=l("./external");function h(y){return y}function t(y,d){for(var S=0;S<y.length;++S)d[S]=255&y.charCodeAt(S);return d}l("setimmediate"),u.newBlob=function(y,d){u.checkSupport("blob");try{return new Blob([y],{type:d})}catch{try{var S=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return S.append(y),S.getBlob(d)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(y,d,S){var M=[],E=0,L=y.length;if(L<=S)return String.fromCharCode.apply(null,y);for(;E<L;)d==="array"||d==="nodebuffer"?M.push(String.fromCharCode.apply(null,y.slice(E,Math.min(E+S,L)))):M.push(String.fromCharCode.apply(null,y.subarray(E,Math.min(E+S,L)))),E+=S;return M.join("")},stringifyByChar:function(y){for(var d="",S=0;S<y.length;S++)d+=String.fromCharCode(y[S]);return d},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function p(y){var d=65536,S=u.getTypeOf(y),M=!0;if(S==="uint8array"?M=f.applyCanBeUsed.uint8array:S==="nodebuffer"&&(M=f.applyCanBeUsed.nodebuffer),M)for(;1<d;)try{return f.stringifyByChunk(y,S,d)}catch{d=Math.floor(d/2)}return f.stringifyByChar(y)}function m(y,d){for(var S=0;S<y.length;S++)d[S]=y[S];return d}u.applyFromCharCode=p;var x={};x.string={string:h,array:function(y){return t(y,new Array(y.length))},arraybuffer:function(y){return x.string.uint8array(y).buffer},uint8array:function(y){return t(y,new Uint8Array(y.length))},nodebuffer:function(y){return t(y,o.allocBuffer(y.length))}},x.array={string:p,array:h,arraybuffer:function(y){return new Uint8Array(y).buffer},uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return o.newBufferFrom(y)}},x.arraybuffer={string:function(y){return p(new Uint8Array(y))},array:function(y){return m(new Uint8Array(y),new Array(y.byteLength))},arraybuffer:h,uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return o.newBufferFrom(new Uint8Array(y))}},x.uint8array={string:p,array:function(y){return m(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:h,nodebuffer:function(y){return o.newBufferFrom(y)}},x.nodebuffer={string:p,array:function(y){return m(y,new Array(y.length))},arraybuffer:function(y){return x.nodebuffer.uint8array(y).buffer},uint8array:function(y){return m(y,new Uint8Array(y.length))},nodebuffer:h},u.transformTo=function(y,d){if(d=d||"",!y)return d;u.checkSupport(y);var S=u.getTypeOf(d);return x[S][y](d)},u.resolve=function(y){for(var d=y.split("/"),S=[],M=0;M<d.length;M++){var E=d[M];E==="."||E===""&&M!==0&&M!==d.length-1||(E===".."?S.pop():S.push(E))}return S.join("/")},u.getTypeOf=function(y){return typeof y=="string"?"string":Object.prototype.toString.call(y)==="[object Array]"?"array":r.nodebuffer&&o.isBuffer(y)?"nodebuffer":r.uint8array&&y instanceof Uint8Array?"uint8array":r.arraybuffer&&y instanceof ArrayBuffer?"arraybuffer":void 0},u.checkSupport=function(y){if(!r[y.toLowerCase()])throw new Error(y+" is not supported by this platform")},u.MAX_VALUE_16BITS=65535,u.MAX_VALUE_32BITS=-1,u.pretty=function(y){var d,S,M="";for(S=0;S<(y||"").length;S++)M+="\\x"+((d=y.charCodeAt(S))<16?"0":"")+d.toString(16).toUpperCase();return M},u.delay=function(y,d,S){setImmediate(function(){y.apply(S||null,d||[])})},u.inherits=function(y,d){function S(){}S.prototype=d.prototype,y.prototype=new S},u.extend=function(){var y,d,S={};for(y=0;y<arguments.length;y++)for(d in arguments[y])Object.prototype.hasOwnProperty.call(arguments[y],d)&&S[d]===void 0&&(S[d]=arguments[y][d]);return S},u.prepareContent=function(y,d,S,M,E){return n.Promise.resolve(d).then(function(L){return r.blob&&(L instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(L))!==-1)&&typeof FileReader<"u"?new n.Promise(function(I,T){var A=new FileReader;A.onload=function(v){I(v.target.result)},A.onerror=function(v){T(v.target.error)},A.readAsArrayBuffer(L)}):L}).then(function(L){var I=u.getTypeOf(L);return I?(I==="arraybuffer"?L=u.transformTo("uint8array",L):I==="string"&&(E?L=i.decode(L):S&&M!==!0&&(L=function(T){return t(T,r.uint8array?new Uint8Array(T.length):new Array(T.length))}(L))),L):n.Promise.reject(new Error("Can't read the data of '"+y+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(l,s,u){var r=l("./reader/readerFor"),i=l("./utils"),o=l("./signature"),n=l("./zipEntry"),h=l("./support");function t(f){this.files=[],this.loadOptions=f}t.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(p)+", expected "+i.pretty(f)+")")}},isSignature:function(f,p){var m=this.reader.index;this.reader.setIndex(f);var x=this.reader.readString(4)===p;return this.reader.setIndex(m),x},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=h.uint8array?"uint8array":"array",m=i.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,m,x=this.zip64EndOfCentralSize-44;0<x;)f=this.reader.readInt(2),p=this.reader.readInt(4),m=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(f=new n({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var x=p-m;if(0<x)this.isSignature(p,o.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" bytes.")},prepareReader:function(f){this.reader=r(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},s.exports=t},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(l,s,u){var r=l("./reader/readerFor"),i=l("./utils"),o=l("./compressedObject"),n=l("./crc32"),h=l("./utf8"),t=l("./compressions"),f=l("./support");function p(m,x){this.options=m,this.loadOptions=x}p.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(m){var x,y;if(m.skip(22),this.fileNameLength=m.readInt(2),y=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(y),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((x=function(d){for(var S in t)if(Object.prototype.hasOwnProperty.call(t,S)&&t[S].magic===d)return t[S];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,x,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var x=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(x),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var x,y,d,S=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<S;)x=m.readInt(2),y=m.readInt(2),d=m.readData(y),this.extraFields[x]={id:x,length:y,value:d};m.setIndex(S)},handleUTF8:function(){var m=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=h.utf8decode(this.fileName),this.fileCommentStr=h.utf8decode(this.fileComment);else{var x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;else{var y=i.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var d=this.findExtraFieldUnicodeComment();if(d!==null)this.fileCommentStr=d;else{var S=i.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(S)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var x=r(m.value);return x.readInt(1)!==1||n(this.fileName)!==x.readInt(4)?null:h.utf8decode(x.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var x=r(m.value);return x.readInt(1)!==1||n(this.fileComment)!==x.readInt(4)?null:h.utf8decode(x.readData(m.length-5))}return null}},s.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(l,s,u){function r(x,y,d){this.name=x,this.dir=d.dir,this.date=d.date,this.comment=d.comment,this.unixPermissions=d.unixPermissions,this.dosPermissions=d.dosPermissions,this._data=y,this._dataBinary=d.binary,this.options={compression:d.compression,compressionOptions:d.compressionOptions}}var i=l("./stream/StreamHelper"),o=l("./stream/DataWorker"),n=l("./utf8"),h=l("./compressedObject"),t=l("./stream/GenericWorker");r.prototype={internalStream:function(x){var y=null,d="string";try{if(!x)throw new Error("No output type specified.");var S=(d=x.toLowerCase())==="string"||d==="text";d!=="binarystring"&&d!=="text"||(d="string"),y=this._decompressWorker();var M=!this._dataBinary;M&&!S&&(y=y.pipe(new n.Utf8EncodeWorker)),!M&&S&&(y=y.pipe(new n.Utf8DecodeWorker))}catch(E){(y=new t("error")).error(E)}return new i(y,d,"")},async:function(x,y){return this.internalStream(x).accumulate(y)},nodeStream:function(x,y){return this.internalStream(x||"nodebuffer").toNodejsStream(y)},_compressWorker:function(x,y){if(this._data instanceof h&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var d=this._decompressWorker();return this._dataBinary||(d=d.pipe(new n.Utf8EncodeWorker)),h.createWorkerFrom(d,x,y)},_decompressWorker:function(){return this._data instanceof h?this._data.getContentWorker():this._data instanceof t?this._data:new o(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<f.length;m++)r.prototype[f[m]]=p;s.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(l,s,u){(function(r){var i,o,n=r.MutationObserver||r.WebKitMutationObserver;if(n){var h=0,t=new n(x),f=r.document.createTextNode("");t.observe(f,{characterData:!0}),i=function(){f.data=h=++h%2}}else if(r.setImmediate||r.MessageChannel===void 0)i="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var y=r.document.createElement("script");y.onreadystatechange=function(){x(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},r.document.documentElement.appendChild(y)}:function(){setTimeout(x,0)};else{var p=new r.MessageChannel;p.port1.onmessage=x,i=function(){p.port2.postMessage(0)}}var m=[];function x(){var y,d;o=!0;for(var S=m.length;S;){for(d=m,m=[],y=-1;++y<S;)d[y]();S=m.length}o=!1}s.exports=function(y){m.push(y)!==1||o||i()}}).call(this,c.g!==void 0?c.g:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(l,s,u){var r=l("immediate");function i(){}var o={},n=["REJECTED"],h=["FULFILLED"],t=["PENDING"];function f(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=t,this.queue=[],this.outcome=void 0,S!==i&&y(this,S)}function p(S,M,E){this.promise=S,typeof M=="function"&&(this.onFulfilled=M,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}function m(S,M,E){r(function(){var L;try{L=M(E)}catch(I){return o.reject(S,I)}L===S?o.reject(S,new TypeError("Cannot resolve promise with itself")):o.resolve(S,L)})}function x(S){var M=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof M=="function")return function(){M.apply(S,arguments)}}function y(S,M){var E=!1;function L(A){E||(E=!0,o.reject(S,A))}function I(A){E||(E=!0,o.resolve(S,A))}var T=d(function(){M(I,L)});T.status==="error"&&L(T.value)}function d(S,M){var E={};try{E.value=S(M),E.status="success"}catch(L){E.status="error",E.value=L}return E}(s.exports=f).prototype.finally=function(S){if(typeof S!="function")return this;var M=this.constructor;return this.then(function(E){return M.resolve(S()).then(function(){return E})},function(E){return M.resolve(S()).then(function(){throw E})})},f.prototype.catch=function(S){return this.then(null,S)},f.prototype.then=function(S,M){if(typeof S!="function"&&this.state===h||typeof M!="function"&&this.state===n)return this;var E=new this.constructor(i);return this.state!==t?m(E,this.state===h?S:M,this.outcome):this.queue.push(new p(E,S,M)),E},p.prototype.callFulfilled=function(S){o.resolve(this.promise,S)},p.prototype.otherCallFulfilled=function(S){m(this.promise,this.onFulfilled,S)},p.prototype.callRejected=function(S){o.reject(this.promise,S)},p.prototype.otherCallRejected=function(S){m(this.promise,this.onRejected,S)},o.resolve=function(S,M){var E=d(x,M);if(E.status==="error")return o.reject(S,E.value);var L=E.value;if(L)y(S,L);else{S.state=h,S.outcome=M;for(var I=-1,T=S.queue.length;++I<T;)S.queue[I].callFulfilled(M)}return S},o.reject=function(S,M){S.state=n,S.outcome=M;for(var E=-1,L=S.queue.length;++E<L;)S.queue[E].callRejected(M);return S},f.resolve=function(S){return S instanceof this?S:o.resolve(new this(i),S)},f.reject=function(S){var M=new this(i);return o.reject(M,S)},f.all=function(S){var M=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=S.length,L=!1;if(!E)return this.resolve([]);for(var I=new Array(E),T=0,A=-1,v=new this(i);++A<E;)B(S[A],A);return v;function B(D,_){M.resolve(D).then(function(F){I[_]=F,++T!==E||L||(L=!0,o.resolve(v,I))},function(F){L||(L=!0,o.reject(v,F))})}},f.race=function(S){if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var M=S.length,E=!1;if(!M)return this.resolve([]);for(var L,I=-1,T=new this(i);++I<M;)L=S[I],this.resolve(L).then(function(A){E||(E=!0,o.resolve(T,A))},function(A){E||(E=!0,o.reject(T,A))});return T}},{immediate:36}],38:[function(l,s,u){var r={};(0,l("./lib/utils/common").assign)(r,l("./lib/deflate"),l("./lib/inflate"),l("./lib/zlib/constants")),s.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(l,s,u){var r=l("./zlib/deflate"),i=l("./utils/common"),o=l("./utils/strings"),n=l("./zlib/messages"),h=l("./zlib/zstream"),t=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},m||{});var x=this.options;x.raw&&0<x.windowBits?x.windowBits=-x.windowBits:x.gzip&&0<x.windowBits&&x.windowBits<16&&(x.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var y=r.deflateInit2(this.strm,x.level,x.method,x.windowBits,x.memLevel,x.strategy);if(y!==0)throw new Error(n[y]);if(x.header&&r.deflateSetHeader(this.strm,x.header),x.dictionary){var d;if(d=typeof x.dictionary=="string"?o.string2buf(x.dictionary):t.call(x.dictionary)==="[object ArrayBuffer]"?new Uint8Array(x.dictionary):x.dictionary,(y=r.deflateSetDictionary(this.strm,d))!==0)throw new Error(n[y]);this._dict_set=!0}}function p(m,x){var y=new f(x);if(y.push(m,!0),y.err)throw y.msg||n[y.err];return y.result}f.prototype.push=function(m,x){var y,d,S=this.strm,M=this.options.chunkSize;if(this.ended)return!1;d=x===~~x?x:x===!0?4:0,typeof m=="string"?S.input=o.string2buf(m):t.call(m)==="[object ArrayBuffer]"?S.input=new Uint8Array(m):S.input=m,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new i.Buf8(M),S.next_out=0,S.avail_out=M),(y=r.deflate(S,d))!==1&&y!==0)return this.onEnd(y),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||d!==4&&d!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(i.shrinkBuf(S.output,S.next_out))):this.onData(i.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&y!==1);return d===4?(y=r.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===0):d!==2||(this.onEnd(0),!(S.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},u.Deflate=f,u.deflate=p,u.deflateRaw=function(m,x){return(x=x||{}).raw=!0,p(m,x)},u.gzip=function(m,x){return(x=x||{}).gzip=!0,p(m,x)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(l,s,u){var r=l("./zlib/inflate"),i=l("./utils/common"),o=l("./utils/strings"),n=l("./zlib/constants"),h=l("./zlib/messages"),t=l("./zlib/zstream"),f=l("./zlib/gzheader"),p=Object.prototype.toString;function m(y){if(!(this instanceof m))return new m(y);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},y||{});var d=this.options;d.raw&&0<=d.windowBits&&d.windowBits<16&&(d.windowBits=-d.windowBits,d.windowBits===0&&(d.windowBits=-15)),!(0<=d.windowBits&&d.windowBits<16)||y&&y.windowBits||(d.windowBits+=32),15<d.windowBits&&d.windowBits<48&&!(15&d.windowBits)&&(d.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new t,this.strm.avail_out=0;var S=r.inflateInit2(this.strm,d.windowBits);if(S!==n.Z_OK)throw new Error(h[S]);this.header=new f,r.inflateGetHeader(this.strm,this.header)}function x(y,d){var S=new m(d);if(S.push(y,!0),S.err)throw S.msg||h[S.err];return S.result}m.prototype.push=function(y,d){var S,M,E,L,I,T,A=this.strm,v=this.options.chunkSize,B=this.options.dictionary,D=!1;if(this.ended)return!1;M=d===~~d?d:d===!0?n.Z_FINISH:n.Z_NO_FLUSH,typeof y=="string"?A.input=o.binstring2buf(y):p.call(y)==="[object ArrayBuffer]"?A.input=new Uint8Array(y):A.input=y,A.next_in=0,A.avail_in=A.input.length;do{if(A.avail_out===0&&(A.output=new i.Buf8(v),A.next_out=0,A.avail_out=v),(S=r.inflate(A,n.Z_NO_FLUSH))===n.Z_NEED_DICT&&B&&(T=typeof B=="string"?o.string2buf(B):p.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,S=r.inflateSetDictionary(this.strm,T)),S===n.Z_BUF_ERROR&&D===!0&&(S=n.Z_OK,D=!1),S!==n.Z_STREAM_END&&S!==n.Z_OK)return this.onEnd(S),!(this.ended=!0);A.next_out&&(A.avail_out!==0&&S!==n.Z_STREAM_END&&(A.avail_in!==0||M!==n.Z_FINISH&&M!==n.Z_SYNC_FLUSH)||(this.options.to==="string"?(E=o.utf8border(A.output,A.next_out),L=A.next_out-E,I=o.buf2string(A.output,E),A.next_out=L,A.avail_out=v-L,L&&i.arraySet(A.output,A.output,E,L,0),this.onData(I)):this.onData(i.shrinkBuf(A.output,A.next_out)))),A.avail_in===0&&A.avail_out===0&&(D=!0)}while((0<A.avail_in||A.avail_out===0)&&S!==n.Z_STREAM_END);return S===n.Z_STREAM_END&&(M=n.Z_FINISH),M===n.Z_FINISH?(S=r.inflateEnd(this.strm),this.onEnd(S),this.ended=!0,S===n.Z_OK):M!==n.Z_SYNC_FLUSH||(this.onEnd(n.Z_OK),!(A.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===n.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},u.Inflate=m,u.inflate=x,u.inflateRaw=function(y,d){return(d=d||{}).raw=!0,x(y,d)},u.ungzip=x},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(l,s,u){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";u.assign=function(n){for(var h=Array.prototype.slice.call(arguments,1);h.length;){var t=h.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(var f in t)t.hasOwnProperty(f)&&(n[f]=t[f])}}return n},u.shrinkBuf=function(n,h){return n.length===h?n:n.subarray?n.subarray(0,h):(n.length=h,n)};var i={arraySet:function(n,h,t,f,p){if(h.subarray&&n.subarray)n.set(h.subarray(t,t+f),p);else for(var m=0;m<f;m++)n[p+m]=h[t+m]},flattenChunks:function(n){var h,t,f,p,m,x;for(h=f=0,t=n.length;h<t;h++)f+=n[h].length;for(x=new Uint8Array(f),h=p=0,t=n.length;h<t;h++)m=n[h],x.set(m,p),p+=m.length;return x}},o={arraySet:function(n,h,t,f,p){for(var m=0;m<f;m++)n[p+m]=h[t+m]},flattenChunks:function(n){return[].concat.apply([],n)}};u.setTyped=function(n){n?(u.Buf8=Uint8Array,u.Buf16=Uint16Array,u.Buf32=Int32Array,u.assign(u,i)):(u.Buf8=Array,u.Buf16=Array,u.Buf32=Array,u.assign(u,o))},u.setTyped(r)},{}],42:[function(l,s,u){var r=l("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var n=new r.Buf8(256),h=0;h<256;h++)n[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;function t(f,p){if(p<65537&&(f.subarray&&o||!f.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(f,p));for(var m="",x=0;x<p;x++)m+=String.fromCharCode(f[x]);return m}n[254]=n[254]=1,u.string2buf=function(f){var p,m,x,y,d,S=f.length,M=0;for(y=0;y<S;y++)(64512&(m=f.charCodeAt(y)))==55296&&y+1<S&&(64512&(x=f.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),y++),M+=m<128?1:m<2048?2:m<65536?3:4;for(p=new r.Buf8(M),y=d=0;d<M;y++)(64512&(m=f.charCodeAt(y)))==55296&&y+1<S&&(64512&(x=f.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(x-56320),y++),m<128?p[d++]=m:(m<2048?p[d++]=192|m>>>6:(m<65536?p[d++]=224|m>>>12:(p[d++]=240|m>>>18,p[d++]=128|m>>>12&63),p[d++]=128|m>>>6&63),p[d++]=128|63&m);return p},u.buf2binstring=function(f){return t(f,f.length)},u.binstring2buf=function(f){for(var p=new r.Buf8(f.length),m=0,x=p.length;m<x;m++)p[m]=f.charCodeAt(m);return p},u.buf2string=function(f,p){var m,x,y,d,S=p||f.length,M=new Array(2*S);for(m=x=0;m<S;)if((y=f[m++])<128)M[x++]=y;else if(4<(d=n[y]))M[x++]=65533,m+=d-1;else{for(y&=d===2?31:d===3?15:7;1<d&&m<S;)y=y<<6|63&f[m++],d--;1<d?M[x++]=65533:y<65536?M[x++]=y:(y-=65536,M[x++]=55296|y>>10&1023,M[x++]=56320|1023&y)}return t(M,x)},u.utf8border=function(f,p){var m;for((p=p||f.length)>f.length&&(p=f.length),m=p-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?p:m+n[f[m]]>p?m:p}},{"./common":41}],43:[function(l,s,u){s.exports=function(r,i,o,n){for(var h=65535&r,t=r>>>16&65535,f=0;o!==0;){for(o-=f=2e3<o?2e3:o;t=t+(h=h+i[n++]|0)|0,--f;);h%=65521,t%=65521}return h|t<<16}},{}],44:[function(l,s,u){s.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(l,s,u){var r=function(){for(var i,o=[],n=0;n<256;n++){i=n;for(var h=0;h<8;h++)i=1&i?3988292384^i>>>1:i>>>1;o[n]=i}return o}();s.exports=function(i,o,n,h){var t=r,f=h+n;i^=-1;for(var p=h;p<f;p++)i=i>>>8^t[255&(i^o[p])];return-1^i}},{}],46:[function(l,s,u){var r,i=l("../utils/common"),o=l("./trees"),n=l("./adler32"),h=l("./crc32"),t=l("./messages"),f=-2,p=258,m=262,x=113;function y(P,G){return P.msg=t[G],G}function d(P){return(P<<1)-(4<P?9:0)}function S(P){for(var G=P.length;0<=--G;)P[G]=0}function M(P){var G=P.state,Y=G.pending;Y>P.avail_out&&(Y=P.avail_out),Y!==0&&(i.arraySet(P.output,G.pending_buf,G.pending_out,Y,P.next_out),P.next_out+=Y,G.pending_out+=Y,P.total_out+=Y,P.avail_out-=Y,G.pending-=Y,G.pending===0&&(G.pending_out=0))}function E(P,G){o._tr_flush_block(P,0<=P.block_start?P.block_start:-1,P.strstart-P.block_start,G),P.block_start=P.strstart,M(P.strm)}function L(P,G){P.pending_buf[P.pending++]=G}function I(P,G){P.pending_buf[P.pending++]=G>>>8&255,P.pending_buf[P.pending++]=255&G}function T(P,G){var Y,X,ie=P.max_chain_length,oe=P.strstart,$=P.prev_length,Q=P.nice_match,ne=P.strstart>P.w_size-m?P.strstart-(P.w_size-m):0,ee=P.window,N=P.w_mask,R=P.prev,O=P.strstart+p,U=ee[oe+$-1],H=ee[oe+$];P.prev_length>=P.good_match&&(ie>>=2),Q>P.lookahead&&(Q=P.lookahead);do if(ee[(Y=G)+$]===H&&ee[Y+$-1]===U&&ee[Y]===ee[oe]&&ee[++Y]===ee[oe+1]){oe+=2,Y++;do;while(ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&ee[++oe]===ee[++Y]&&oe<O);if(X=p-(O-oe),oe=O-p,$<X){if(P.match_start=G,Q<=($=X))break;U=ee[oe+$-1],H=ee[oe+$]}}while((G=R[G&N])>ne&&--ie!=0);return $<=P.lookahead?$:P.lookahead}function A(P){var G,Y,X,ie,oe,$,Q,ne,ee,N,R=P.w_size;do{if(ie=P.window_size-P.lookahead-P.strstart,P.strstart>=R+(R-m)){for(i.arraySet(P.window,P.window,R,R,0),P.match_start-=R,P.strstart-=R,P.block_start-=R,G=Y=P.hash_size;X=P.head[--G],P.head[G]=R<=X?X-R:0,--Y;);for(G=Y=R;X=P.prev[--G],P.prev[G]=R<=X?X-R:0,--Y;);ie+=R}if(P.strm.avail_in===0)break;if($=P.strm,Q=P.window,ne=P.strstart+P.lookahead,N=void 0,(ee=ie)<(N=$.avail_in)&&(N=ee),Y=N===0?0:($.avail_in-=N,i.arraySet(Q,$.input,$.next_in,N,ne),$.state.wrap===1?$.adler=n($.adler,Q,N,ne):$.state.wrap===2&&($.adler=h($.adler,Q,N,ne)),$.next_in+=N,$.total_in+=N,N),P.lookahead+=Y,P.lookahead+P.insert>=3)for(oe=P.strstart-P.insert,P.ins_h=P.window[oe],P.ins_h=(P.ins_h<<P.hash_shift^P.window[oe+1])&P.hash_mask;P.insert&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[oe+3-1])&P.hash_mask,P.prev[oe&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=oe,oe++,P.insert--,!(P.lookahead+P.insert<3)););}while(P.lookahead<m&&P.strm.avail_in!==0)}function v(P,G){for(var Y,X;;){if(P.lookahead<m){if(A(P),P.lookahead<m&&G===0)return 1;if(P.lookahead===0)break}if(Y=0,P.lookahead>=3&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+3-1])&P.hash_mask,Y=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),Y!==0&&P.strstart-Y<=P.w_size-m&&(P.match_length=T(P,Y)),P.match_length>=3)if(X=o._tr_tally(P,P.strstart-P.match_start,P.match_length-3),P.lookahead-=P.match_length,P.match_length<=P.max_lazy_match&&P.lookahead>=3){for(P.match_length--;P.strstart++,P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+3-1])&P.hash_mask,Y=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart,--P.match_length!=0;);P.strstart++}else P.strstart+=P.match_length,P.match_length=0,P.ins_h=P.window[P.strstart],P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+1])&P.hash_mask;else X=o._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++;if(X&&(E(P,!1),P.strm.avail_out===0))return 1}return P.insert=P.strstart<2?P.strstart:2,G===4?(E(P,!0),P.strm.avail_out===0?3:4):P.last_lit&&(E(P,!1),P.strm.avail_out===0)?1:2}function B(P,G){for(var Y,X,ie;;){if(P.lookahead<m){if(A(P),P.lookahead<m&&G===0)return 1;if(P.lookahead===0)break}if(Y=0,P.lookahead>=3&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+3-1])&P.hash_mask,Y=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),P.prev_length=P.match_length,P.prev_match=P.match_start,P.match_length=2,Y!==0&&P.prev_length<P.max_lazy_match&&P.strstart-Y<=P.w_size-m&&(P.match_length=T(P,Y),P.match_length<=5&&(P.strategy===1||P.match_length===3&&4096<P.strstart-P.match_start)&&(P.match_length=2)),P.prev_length>=3&&P.match_length<=P.prev_length){for(ie=P.strstart+P.lookahead-3,X=o._tr_tally(P,P.strstart-1-P.prev_match,P.prev_length-3),P.lookahead-=P.prev_length-1,P.prev_length-=2;++P.strstart<=ie&&(P.ins_h=(P.ins_h<<P.hash_shift^P.window[P.strstart+3-1])&P.hash_mask,Y=P.prev[P.strstart&P.w_mask]=P.head[P.ins_h],P.head[P.ins_h]=P.strstart),--P.prev_length!=0;);if(P.match_available=0,P.match_length=2,P.strstart++,X&&(E(P,!1),P.strm.avail_out===0))return 1}else if(P.match_available){if((X=o._tr_tally(P,0,P.window[P.strstart-1]))&&E(P,!1),P.strstart++,P.lookahead--,P.strm.avail_out===0)return 1}else P.match_available=1,P.strstart++,P.lookahead--}return P.match_available&&(X=o._tr_tally(P,0,P.window[P.strstart-1]),P.match_available=0),P.insert=P.strstart<2?P.strstart:2,G===4?(E(P,!0),P.strm.avail_out===0?3:4):P.last_lit&&(E(P,!1),P.strm.avail_out===0)?1:2}function D(P,G,Y,X,ie){this.good_length=P,this.max_lazy=G,this.nice_length=Y,this.max_chain=X,this.func=ie}function _(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),S(this.dyn_ltree),S(this.dyn_dtree),S(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),S(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),S(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function F(P){var G;return P&&P.state?(P.total_in=P.total_out=0,P.data_type=2,(G=P.state).pending=0,G.pending_out=0,G.wrap<0&&(G.wrap=-G.wrap),G.status=G.wrap?42:x,P.adler=G.wrap===2?0:1,G.last_flush=0,o._tr_init(G),0):y(P,f)}function k(P){var G=F(P);return G===0&&function(Y){Y.window_size=2*Y.w_size,S(Y.head),Y.max_lazy_match=r[Y.level].max_lazy,Y.good_match=r[Y.level].good_length,Y.nice_match=r[Y.level].nice_length,Y.max_chain_length=r[Y.level].max_chain,Y.strstart=0,Y.block_start=0,Y.lookahead=0,Y.insert=0,Y.match_length=Y.prev_length=2,Y.match_available=0,Y.ins_h=0}(P.state),G}function j(P,G,Y,X,ie,oe){if(!P)return f;var $=1;if(G===-1&&(G=6),X<0?($=0,X=-X):15<X&&($=2,X-=16),ie<1||9<ie||Y!==8||X<8||15<X||G<0||9<G||oe<0||4<oe)return y(P,f);X===8&&(X=9);var Q=new _;return(P.state=Q).strm=P,Q.wrap=$,Q.gzhead=null,Q.w_bits=X,Q.w_size=1<<Q.w_bits,Q.w_mask=Q.w_size-1,Q.hash_bits=ie+7,Q.hash_size=1<<Q.hash_bits,Q.hash_mask=Q.hash_size-1,Q.hash_shift=~~((Q.hash_bits+3-1)/3),Q.window=new i.Buf8(2*Q.w_size),Q.head=new i.Buf16(Q.hash_size),Q.prev=new i.Buf16(Q.w_size),Q.lit_bufsize=1<<ie+6,Q.pending_buf_size=4*Q.lit_bufsize,Q.pending_buf=new i.Buf8(Q.pending_buf_size),Q.d_buf=1*Q.lit_bufsize,Q.l_buf=3*Q.lit_bufsize,Q.level=G,Q.strategy=oe,Q.method=Y,k(P)}r=[new D(0,0,0,0,function(P,G){var Y=65535;for(Y>P.pending_buf_size-5&&(Y=P.pending_buf_size-5);;){if(P.lookahead<=1){if(A(P),P.lookahead===0&&G===0)return 1;if(P.lookahead===0)break}P.strstart+=P.lookahead,P.lookahead=0;var X=P.block_start+Y;if((P.strstart===0||P.strstart>=X)&&(P.lookahead=P.strstart-X,P.strstart=X,E(P,!1),P.strm.avail_out===0)||P.strstart-P.block_start>=P.w_size-m&&(E(P,!1),P.strm.avail_out===0))return 1}return P.insert=0,G===4?(E(P,!0),P.strm.avail_out===0?3:4):(P.strstart>P.block_start&&(E(P,!1),P.strm.avail_out),1)}),new D(4,4,8,4,v),new D(4,5,16,8,v),new D(4,6,32,32,v),new D(4,4,16,16,B),new D(8,16,32,32,B),new D(8,16,128,128,B),new D(8,32,128,256,B),new D(32,128,258,1024,B),new D(32,258,258,4096,B)],u.deflateInit=function(P,G){return j(P,G,8,15,8,0)},u.deflateInit2=j,u.deflateReset=k,u.deflateResetKeep=F,u.deflateSetHeader=function(P,G){return P&&P.state?P.state.wrap!==2?f:(P.state.gzhead=G,0):f},u.deflate=function(P,G){var Y,X,ie,oe;if(!P||!P.state||5<G||G<0)return P?y(P,f):f;if(X=P.state,!P.output||!P.input&&P.avail_in!==0||X.status===666&&G!==4)return y(P,P.avail_out===0?-5:f);if(X.strm=P,Y=X.last_flush,X.last_flush=G,X.status===42)if(X.wrap===2)P.adler=0,L(X,31),L(X,139),L(X,8),X.gzhead?(L(X,(X.gzhead.text?1:0)+(X.gzhead.hcrc?2:0)+(X.gzhead.extra?4:0)+(X.gzhead.name?8:0)+(X.gzhead.comment?16:0)),L(X,255&X.gzhead.time),L(X,X.gzhead.time>>8&255),L(X,X.gzhead.time>>16&255),L(X,X.gzhead.time>>24&255),L(X,X.level===9?2:2<=X.strategy||X.level<2?4:0),L(X,255&X.gzhead.os),X.gzhead.extra&&X.gzhead.extra.length&&(L(X,255&X.gzhead.extra.length),L(X,X.gzhead.extra.length>>8&255)),X.gzhead.hcrc&&(P.adler=h(P.adler,X.pending_buf,X.pending,0)),X.gzindex=0,X.status=69):(L(X,0),L(X,0),L(X,0),L(X,0),L(X,0),L(X,X.level===9?2:2<=X.strategy||X.level<2?4:0),L(X,3),X.status=x);else{var $=8+(X.w_bits-8<<4)<<8;$|=(2<=X.strategy||X.level<2?0:X.level<6?1:X.level===6?2:3)<<6,X.strstart!==0&&($|=32),$+=31-$%31,X.status=x,I(X,$),X.strstart!==0&&(I(X,P.adler>>>16),I(X,65535&P.adler)),P.adler=1}if(X.status===69)if(X.gzhead.extra){for(ie=X.pending;X.gzindex<(65535&X.gzhead.extra.length)&&(X.pending!==X.pending_buf_size||(X.gzhead.hcrc&&X.pending>ie&&(P.adler=h(P.adler,X.pending_buf,X.pending-ie,ie)),M(P),ie=X.pending,X.pending!==X.pending_buf_size));)L(X,255&X.gzhead.extra[X.gzindex]),X.gzindex++;X.gzhead.hcrc&&X.pending>ie&&(P.adler=h(P.adler,X.pending_buf,X.pending-ie,ie)),X.gzindex===X.gzhead.extra.length&&(X.gzindex=0,X.status=73)}else X.status=73;if(X.status===73)if(X.gzhead.name){ie=X.pending;do{if(X.pending===X.pending_buf_size&&(X.gzhead.hcrc&&X.pending>ie&&(P.adler=h(P.adler,X.pending_buf,X.pending-ie,ie)),M(P),ie=X.pending,X.pending===X.pending_buf_size)){oe=1;break}oe=X.gzindex<X.gzhead.name.length?255&X.gzhead.name.charCodeAt(X.gzindex++):0,L(X,oe)}while(oe!==0);X.gzhead.hcrc&&X.pending>ie&&(P.adler=h(P.adler,X.pending_buf,X.pending-ie,ie)),oe===0&&(X.gzindex=0,X.status=91)}else X.status=91;if(X.status===91)if(X.gzhead.comment){ie=X.pending;do{if(X.pending===X.pending_buf_size&&(X.gzhead.hcrc&&X.pending>ie&&(P.adler=h(P.adler,X.pending_buf,X.pending-ie,ie)),M(P),ie=X.pending,X.pending===X.pending_buf_size)){oe=1;break}oe=X.gzindex<X.gzhead.comment.length?255&X.gzhead.comment.charCodeAt(X.gzindex++):0,L(X,oe)}while(oe!==0);X.gzhead.hcrc&&X.pending>ie&&(P.adler=h(P.adler,X.pending_buf,X.pending-ie,ie)),oe===0&&(X.status=103)}else X.status=103;if(X.status===103&&(X.gzhead.hcrc?(X.pending+2>X.pending_buf_size&&M(P),X.pending+2<=X.pending_buf_size&&(L(X,255&P.adler),L(X,P.adler>>8&255),P.adler=0,X.status=x)):X.status=x),X.pending!==0){if(M(P),P.avail_out===0)return X.last_flush=-1,0}else if(P.avail_in===0&&d(G)<=d(Y)&&G!==4)return y(P,-5);if(X.status===666&&P.avail_in!==0)return y(P,-5);if(P.avail_in!==0||X.lookahead!==0||G!==0&&X.status!==666){var Q=X.strategy===2?function(ne,ee){for(var N;;){if(ne.lookahead===0&&(A(ne),ne.lookahead===0)){if(ee===0)return 1;break}if(ne.match_length=0,N=o._tr_tally(ne,0,ne.window[ne.strstart]),ne.lookahead--,ne.strstart++,N&&(E(ne,!1),ne.strm.avail_out===0))return 1}return ne.insert=0,ee===4?(E(ne,!0),ne.strm.avail_out===0?3:4):ne.last_lit&&(E(ne,!1),ne.strm.avail_out===0)?1:2}(X,G):X.strategy===3?function(ne,ee){for(var N,R,O,U,H=ne.window;;){if(ne.lookahead<=p){if(A(ne),ne.lookahead<=p&&ee===0)return 1;if(ne.lookahead===0)break}if(ne.match_length=0,ne.lookahead>=3&&0<ne.strstart&&(R=H[O=ne.strstart-1])===H[++O]&&R===H[++O]&&R===H[++O]){U=ne.strstart+p;do;while(R===H[++O]&&R===H[++O]&&R===H[++O]&&R===H[++O]&&R===H[++O]&&R===H[++O]&&R===H[++O]&&R===H[++O]&&O<U);ne.match_length=p-(U-O),ne.match_length>ne.lookahead&&(ne.match_length=ne.lookahead)}if(ne.match_length>=3?(N=o._tr_tally(ne,1,ne.match_length-3),ne.lookahead-=ne.match_length,ne.strstart+=ne.match_length,ne.match_length=0):(N=o._tr_tally(ne,0,ne.window[ne.strstart]),ne.lookahead--,ne.strstart++),N&&(E(ne,!1),ne.strm.avail_out===0))return 1}return ne.insert=0,ee===4?(E(ne,!0),ne.strm.avail_out===0?3:4):ne.last_lit&&(E(ne,!1),ne.strm.avail_out===0)?1:2}(X,G):r[X.level].func(X,G);if(Q!==3&&Q!==4||(X.status=666),Q===1||Q===3)return P.avail_out===0&&(X.last_flush=-1),0;if(Q===2&&(G===1?o._tr_align(X):G!==5&&(o._tr_stored_block(X,0,0,!1),G===3&&(S(X.head),X.lookahead===0&&(X.strstart=0,X.block_start=0,X.insert=0))),M(P),P.avail_out===0))return X.last_flush=-1,0}return G!==4?0:X.wrap<=0?1:(X.wrap===2?(L(X,255&P.adler),L(X,P.adler>>8&255),L(X,P.adler>>16&255),L(X,P.adler>>24&255),L(X,255&P.total_in),L(X,P.total_in>>8&255),L(X,P.total_in>>16&255),L(X,P.total_in>>24&255)):(I(X,P.adler>>>16),I(X,65535&P.adler)),M(P),0<X.wrap&&(X.wrap=-X.wrap),X.pending!==0?0:1)},u.deflateEnd=function(P){var G;return P&&P.state?(G=P.state.status)!==42&&G!==69&&G!==73&&G!==91&&G!==103&&G!==x&&G!==666?y(P,f):(P.state=null,G===x?y(P,-3):0):f},u.deflateSetDictionary=function(P,G){var Y,X,ie,oe,$,Q,ne,ee,N=G.length;if(!P||!P.state||(oe=(Y=P.state).wrap)===2||oe===1&&Y.status!==42||Y.lookahead)return f;for(oe===1&&(P.adler=n(P.adler,G,N,0)),Y.wrap=0,N>=Y.w_size&&(oe===0&&(S(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0),ee=new i.Buf8(Y.w_size),i.arraySet(ee,G,N-Y.w_size,Y.w_size,0),G=ee,N=Y.w_size),$=P.avail_in,Q=P.next_in,ne=P.input,P.avail_in=N,P.next_in=0,P.input=G,A(Y);Y.lookahead>=3;){for(X=Y.strstart,ie=Y.lookahead-2;Y.ins_h=(Y.ins_h<<Y.hash_shift^Y.window[X+3-1])&Y.hash_mask,Y.prev[X&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=X,X++,--ie;);Y.strstart=X,Y.lookahead=2,A(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=2,Y.match_available=0,P.next_in=Q,P.input=ne,P.avail_in=$,Y.wrap=oe,0},u.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(l,s,u){s.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(l,s,u){s.exports=function(r,i){var o,n,h,t,f,p,m,x,y,d,S,M,E,L,I,T,A,v,B,D,_,F,k,j,P;o=r.state,n=r.next_in,j=r.input,h=n+(r.avail_in-5),t=r.next_out,P=r.output,f=t-(i-r.avail_out),p=t+(r.avail_out-257),m=o.dmax,x=o.wsize,y=o.whave,d=o.wnext,S=o.window,M=o.hold,E=o.bits,L=o.lencode,I=o.distcode,T=(1<<o.lenbits)-1,A=(1<<o.distbits)-1;e:do{E<15&&(M+=j[n++]<<E,E+=8,M+=j[n++]<<E,E+=8),v=L[M&T];t:for(;;){if(M>>>=B=v>>>24,E-=B,(B=v>>>16&255)==0)P[t++]=65535&v;else{if(!(16&B)){if(!(64&B)){v=L[(65535&v)+(M&(1<<B)-1)];continue t}if(32&B){o.mode=12;break e}r.msg="invalid literal/length code",o.mode=30;break e}D=65535&v,(B&=15)&&(E<B&&(M+=j[n++]<<E,E+=8),D+=M&(1<<B)-1,M>>>=B,E-=B),E<15&&(M+=j[n++]<<E,E+=8,M+=j[n++]<<E,E+=8),v=I[M&A];i:for(;;){if(M>>>=B=v>>>24,E-=B,!(16&(B=v>>>16&255))){if(!(64&B)){v=I[(65535&v)+(M&(1<<B)-1)];continue i}r.msg="invalid distance code",o.mode=30;break e}if(_=65535&v,E<(B&=15)&&(M+=j[n++]<<E,(E+=8)<B&&(M+=j[n++]<<E,E+=8)),m<(_+=M&(1<<B)-1)){r.msg="invalid distance too far back",o.mode=30;break e}if(M>>>=B,E-=B,(B=t-f)<_){if(y<(B=_-B)&&o.sane){r.msg="invalid distance too far back",o.mode=30;break e}if(k=S,(F=0)===d){if(F+=x-B,B<D){for(D-=B;P[t++]=S[F++],--B;);F=t-_,k=P}}else if(d<B){if(F+=x+d-B,(B-=d)<D){for(D-=B;P[t++]=S[F++],--B;);if(F=0,d<D){for(D-=B=d;P[t++]=S[F++],--B;);F=t-_,k=P}}}else if(F+=d-B,B<D){for(D-=B;P[t++]=S[F++],--B;);F=t-_,k=P}for(;2<D;)P[t++]=k[F++],P[t++]=k[F++],P[t++]=k[F++],D-=3;D&&(P[t++]=k[F++],1<D&&(P[t++]=k[F++]))}else{for(F=t-_;P[t++]=P[F++],P[t++]=P[F++],P[t++]=P[F++],2<(D-=3););D&&(P[t++]=P[F++],1<D&&(P[t++]=P[F++]))}break}}break}}while(n<h&&t<p);n-=D=E>>3,M&=(1<<(E-=D<<3))-1,r.next_in=n,r.next_out=t,r.avail_in=n<h?h-n+5:5-(n-h),r.avail_out=t<p?p-t+257:257-(t-p),o.hold=M,o.bits=E}},{}],49:[function(l,s,u){var r=l("../utils/common"),i=l("./adler32"),o=l("./crc32"),n=l("./inffast"),h=l("./inftrees"),t=-2;function f(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(T){var A;return T&&T.state?(A=T.state,T.total_in=T.total_out=A.total=0,T.msg="",A.wrap&&(T.adler=1&A.wrap),A.mode=1,A.last=0,A.havedict=0,A.dmax=32768,A.head=null,A.hold=0,A.bits=0,A.lencode=A.lendyn=new r.Buf32(852),A.distcode=A.distdyn=new r.Buf32(592),A.sane=1,A.back=-1,0):t}function x(T){var A;return T&&T.state?((A=T.state).wsize=0,A.whave=0,A.wnext=0,m(T)):t}function y(T,A){var v,B;return T&&T.state?(B=T.state,A<0?(v=0,A=-A):(v=1+(A>>4),A<48&&(A&=15)),A&&(A<8||15<A)?t:(B.window!==null&&B.wbits!==A&&(B.window=null),B.wrap=v,B.wbits=A,x(T))):t}function d(T,A){var v,B;return T?(B=new p,(T.state=B).window=null,(v=y(T,A))!==0&&(T.state=null),v):t}var S,M,E=!0;function L(T){if(E){var A;for(S=new r.Buf32(512),M=new r.Buf32(32),A=0;A<144;)T.lens[A++]=8;for(;A<256;)T.lens[A++]=9;for(;A<280;)T.lens[A++]=7;for(;A<288;)T.lens[A++]=8;for(h(1,T.lens,0,288,S,0,T.work,{bits:9}),A=0;A<32;)T.lens[A++]=5;h(2,T.lens,0,32,M,0,T.work,{bits:5}),E=!1}T.lencode=S,T.lenbits=9,T.distcode=M,T.distbits=5}function I(T,A,v,B){var D,_=T.state;return _.window===null&&(_.wsize=1<<_.wbits,_.wnext=0,_.whave=0,_.window=new r.Buf8(_.wsize)),B>=_.wsize?(r.arraySet(_.window,A,v-_.wsize,_.wsize,0),_.wnext=0,_.whave=_.wsize):(B<(D=_.wsize-_.wnext)&&(D=B),r.arraySet(_.window,A,v-B,D,_.wnext),(B-=D)?(r.arraySet(_.window,A,v-B,B,0),_.wnext=B,_.whave=_.wsize):(_.wnext+=D,_.wnext===_.wsize&&(_.wnext=0),_.whave<_.wsize&&(_.whave+=D))),0}u.inflateReset=x,u.inflateReset2=y,u.inflateResetKeep=m,u.inflateInit=function(T){return d(T,15)},u.inflateInit2=d,u.inflate=function(T,A){var v,B,D,_,F,k,j,P,G,Y,X,ie,oe,$,Q,ne,ee,N,R,O,U,H,W,K,q=0,te=new r.Buf8(4),se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return t;(v=T.state).mode===12&&(v.mode=13),F=T.next_out,D=T.output,j=T.avail_out,_=T.next_in,B=T.input,k=T.avail_in,P=v.hold,G=v.bits,Y=k,X=j,H=0;e:for(;;)switch(v.mode){case 1:if(v.wrap===0){v.mode=13;break}for(;G<16;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(2&v.wrap&&P===35615){te[v.check=0]=255&P,te[1]=P>>>8&255,v.check=o(v.check,te,2,0),G=P=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&P)<<8)+(P>>8))%31){T.msg="incorrect header check",v.mode=30;break}if((15&P)!=8){T.msg="unknown compression method",v.mode=30;break}if(G-=4,U=8+(15&(P>>>=4)),v.wbits===0)v.wbits=U;else if(U>v.wbits){T.msg="invalid window size",v.mode=30;break}v.dmax=1<<U,T.adler=v.check=1,v.mode=512&P?10:12,G=P=0;break;case 2:for(;G<16;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(v.flags=P,(255&v.flags)!=8){T.msg="unknown compression method",v.mode=30;break}if(57344&v.flags){T.msg="unknown header flags set",v.mode=30;break}v.head&&(v.head.text=P>>8&1),512&v.flags&&(te[0]=255&P,te[1]=P>>>8&255,v.check=o(v.check,te,2,0)),G=P=0,v.mode=3;case 3:for(;G<32;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}v.head&&(v.head.time=P),512&v.flags&&(te[0]=255&P,te[1]=P>>>8&255,te[2]=P>>>16&255,te[3]=P>>>24&255,v.check=o(v.check,te,4,0)),G=P=0,v.mode=4;case 4:for(;G<16;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}v.head&&(v.head.xflags=255&P,v.head.os=P>>8),512&v.flags&&(te[0]=255&P,te[1]=P>>>8&255,v.check=o(v.check,te,2,0)),G=P=0,v.mode=5;case 5:if(1024&v.flags){for(;G<16;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}v.length=P,v.head&&(v.head.extra_len=P),512&v.flags&&(te[0]=255&P,te[1]=P>>>8&255,v.check=o(v.check,te,2,0)),G=P=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(k<(ie=v.length)&&(ie=k),ie&&(v.head&&(U=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),r.arraySet(v.head.extra,B,_,ie,U)),512&v.flags&&(v.check=o(v.check,B,ie,_)),k-=ie,_+=ie,v.length-=ie),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(k===0)break e;for(ie=0;U=B[_+ie++],v.head&&U&&v.length<65536&&(v.head.name+=String.fromCharCode(U)),U&&ie<k;);if(512&v.flags&&(v.check=o(v.check,B,ie,_)),k-=ie,_+=ie,U)break e}else v.head&&(v.head.name=null);v.length=0,v.mode=8;case 8:if(4096&v.flags){if(k===0)break e;for(ie=0;U=B[_+ie++],v.head&&U&&v.length<65536&&(v.head.comment+=String.fromCharCode(U)),U&&ie<k;);if(512&v.flags&&(v.check=o(v.check,B,ie,_)),k-=ie,_+=ie,U)break e}else v.head&&(v.head.comment=null);v.mode=9;case 9:if(512&v.flags){for(;G<16;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(P!==(65535&v.check)){T.msg="header crc mismatch",v.mode=30;break}G=P=0}v.head&&(v.head.hcrc=v.flags>>9&1,v.head.done=!0),T.adler=v.check=0,v.mode=12;break;case 10:for(;G<32;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}T.adler=v.check=f(P),G=P=0,v.mode=11;case 11:if(v.havedict===0)return T.next_out=F,T.avail_out=j,T.next_in=_,T.avail_in=k,v.hold=P,v.bits=G,2;T.adler=v.check=1,v.mode=12;case 12:if(A===5||A===6)break e;case 13:if(v.last){P>>>=7&G,G-=7&G,v.mode=27;break}for(;G<3;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}switch(v.last=1&P,G-=1,3&(P>>>=1)){case 0:v.mode=14;break;case 1:if(L(v),v.mode=20,A!==6)break;P>>>=2,G-=2;break e;case 2:v.mode=17;break;case 3:T.msg="invalid block type",v.mode=30}P>>>=2,G-=2;break;case 14:for(P>>>=7&G,G-=7&G;G<32;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if((65535&P)!=(P>>>16^65535)){T.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&P,G=P=0,v.mode=15,A===6)break e;case 15:v.mode=16;case 16:if(ie=v.length){if(k<ie&&(ie=k),j<ie&&(ie=j),ie===0)break e;r.arraySet(D,B,_,ie,F),k-=ie,_+=ie,j-=ie,F+=ie,v.length-=ie;break}v.mode=12;break;case 17:for(;G<14;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(v.nlen=257+(31&P),P>>>=5,G-=5,v.ndist=1+(31&P),P>>>=5,G-=5,v.ncode=4+(15&P),P>>>=4,G-=4,286<v.nlen||30<v.ndist){T.msg="too many length or distance symbols",v.mode=30;break}v.have=0,v.mode=18;case 18:for(;v.have<v.ncode;){for(;G<3;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}v.lens[se[v.have++]]=7&P,P>>>=3,G-=3}for(;v.have<19;)v.lens[se[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,W={bits:v.lenbits},H=h(0,v.lens,0,19,v.lencode,0,v.work,W),v.lenbits=W.bits,H){T.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have<v.nlen+v.ndist;){for(;ne=(q=v.lencode[P&(1<<v.lenbits)-1])>>>16&255,ee=65535&q,!((Q=q>>>24)<=G);){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(ee<16)P>>>=Q,G-=Q,v.lens[v.have++]=ee;else{if(ee===16){for(K=Q+2;G<K;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(P>>>=Q,G-=Q,v.have===0){T.msg="invalid bit length repeat",v.mode=30;break}U=v.lens[v.have-1],ie=3+(3&P),P>>>=2,G-=2}else if(ee===17){for(K=Q+3;G<K;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}G-=Q,U=0,ie=3+(7&(P>>>=Q)),P>>>=3,G-=3}else{for(K=Q+7;G<K;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}G-=Q,U=0,ie=11+(127&(P>>>=Q)),P>>>=7,G-=7}if(v.have+ie>v.nlen+v.ndist){T.msg="invalid bit length repeat",v.mode=30;break}for(;ie--;)v.lens[v.have++]=U}}if(v.mode===30)break;if(v.lens[256]===0){T.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,W={bits:v.lenbits},H=h(1,v.lens,0,v.nlen,v.lencode,0,v.work,W),v.lenbits=W.bits,H){T.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,W={bits:v.distbits},H=h(2,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,W),v.distbits=W.bits,H){T.msg="invalid distances set",v.mode=30;break}if(v.mode=20,A===6)break e;case 20:v.mode=21;case 21:if(6<=k&&258<=j){T.next_out=F,T.avail_out=j,T.next_in=_,T.avail_in=k,v.hold=P,v.bits=G,n(T,X),F=T.next_out,D=T.output,j=T.avail_out,_=T.next_in,B=T.input,k=T.avail_in,P=v.hold,G=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;ne=(q=v.lencode[P&(1<<v.lenbits)-1])>>>16&255,ee=65535&q,!((Q=q>>>24)<=G);){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(ne&&!(240&ne)){for(N=Q,R=ne,O=ee;ne=(q=v.lencode[O+((P&(1<<N+R)-1)>>N)])>>>16&255,ee=65535&q,!(N+(Q=q>>>24)<=G);){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}P>>>=N,G-=N,v.back+=N}if(P>>>=Q,G-=Q,v.back+=Q,v.length=ee,ne===0){v.mode=26;break}if(32&ne){v.back=-1,v.mode=12;break}if(64&ne){T.msg="invalid literal/length code",v.mode=30;break}v.extra=15&ne,v.mode=22;case 22:if(v.extra){for(K=v.extra;G<K;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}v.length+=P&(1<<v.extra)-1,P>>>=v.extra,G-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;ne=(q=v.distcode[P&(1<<v.distbits)-1])>>>16&255,ee=65535&q,!((Q=q>>>24)<=G);){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(!(240&ne)){for(N=Q,R=ne,O=ee;ne=(q=v.distcode[O+((P&(1<<N+R)-1)>>N)])>>>16&255,ee=65535&q,!(N+(Q=q>>>24)<=G);){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}P>>>=N,G-=N,v.back+=N}if(P>>>=Q,G-=Q,v.back+=Q,64&ne){T.msg="invalid distance code",v.mode=30;break}v.offset=ee,v.extra=15&ne,v.mode=24;case 24:if(v.extra){for(K=v.extra;G<K;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}v.offset+=P&(1<<v.extra)-1,P>>>=v.extra,G-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){T.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(j===0)break e;if(ie=X-j,v.offset>ie){if((ie=v.offset-ie)>v.whave&&v.sane){T.msg="invalid distance too far back",v.mode=30;break}oe=ie>v.wnext?(ie-=v.wnext,v.wsize-ie):v.wnext-ie,ie>v.length&&(ie=v.length),$=v.window}else $=D,oe=F-v.offset,ie=v.length;for(j<ie&&(ie=j),j-=ie,v.length-=ie;D[F++]=$[oe++],--ie;);v.length===0&&(v.mode=21);break;case 26:if(j===0)break e;D[F++]=v.length,j--,v.mode=21;break;case 27:if(v.wrap){for(;G<32;){if(k===0)break e;k--,P|=B[_++]<<G,G+=8}if(X-=j,T.total_out+=X,v.total+=X,X&&(T.adler=v.check=v.flags?o(v.check,D,X,F-X):i(v.check,D,X,F-X)),X=j,(v.flags?P:f(P))!==v.check){T.msg="incorrect data check",v.mode=30;break}G=P=0}v.mode=28;case 28:if(v.wrap&&v.flags){for(;G<32;){if(k===0)break e;k--,P+=B[_++]<<G,G+=8}if(P!==(4294967295&v.total)){T.msg="incorrect length check",v.mode=30;break}G=P=0}v.mode=29;case 29:H=1;break e;case 30:H=-3;break e;case 31:return-4;default:return t}return T.next_out=F,T.avail_out=j,T.next_in=_,T.avail_in=k,v.hold=P,v.bits=G,(v.wsize||X!==T.avail_out&&v.mode<30&&(v.mode<27||A!==4))&&I(T,T.output,T.next_out,X-T.avail_out)?(v.mode=31,-4):(Y-=T.avail_in,X-=T.avail_out,T.total_in+=Y,T.total_out+=X,v.total+=X,v.wrap&&X&&(T.adler=v.check=v.flags?o(v.check,D,X,T.next_out-X):i(v.check,D,X,T.next_out-X)),T.data_type=v.bits+(v.last?64:0)+(v.mode===12?128:0)+(v.mode===20||v.mode===15?256:0),(Y==0&&X===0||A===4)&&H===0&&(H=-5),H)},u.inflateEnd=function(T){if(!T||!T.state)return t;var A=T.state;return A.window&&(A.window=null),T.state=null,0},u.inflateGetHeader=function(T,A){var v;return T&&T.state&&2&(v=T.state).wrap?((v.head=A).done=!1,0):t},u.inflateSetDictionary=function(T,A){var v,B=A.length;return T&&T.state?(v=T.state).wrap!==0&&v.mode!==11?t:v.mode===11&&i(1,A,B,0)!==v.check?-3:I(T,A,B,B)?(v.mode=31,-4):(v.havedict=1,0):t},u.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(l,s,u){var r=l("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],n=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];s.exports=function(t,f,p,m,x,y,d,S){var M,E,L,I,T,A,v,B,D,_=S.bits,F=0,k=0,j=0,P=0,G=0,Y=0,X=0,ie=0,oe=0,$=0,Q=null,ne=0,ee=new r.Buf16(16),N=new r.Buf16(16),R=null,O=0;for(F=0;F<=15;F++)ee[F]=0;for(k=0;k<m;k++)ee[f[p+k]]++;for(G=_,P=15;1<=P&&ee[P]===0;P--);if(P<G&&(G=P),P===0)return x[y++]=20971520,x[y++]=20971520,S.bits=1,0;for(j=1;j<P&&ee[j]===0;j++);for(G<j&&(G=j),F=ie=1;F<=15;F++)if(ie<<=1,(ie-=ee[F])<0)return-1;if(0<ie&&(t===0||P!==1))return-1;for(N[1]=0,F=1;F<15;F++)N[F+1]=N[F]+ee[F];for(k=0;k<m;k++)f[p+k]!==0&&(d[N[f[p+k]]++]=k);if(A=t===0?(Q=R=d,19):t===1?(Q=i,ne-=257,R=o,O-=257,256):(Q=n,R=h,-1),F=j,T=y,X=k=$=0,L=-1,I=(oe=1<<(Y=G))-1,t===1&&852<oe||t===2&&592<oe)return 1;for(;;){for(v=F-X,D=d[k]<A?(B=0,d[k]):d[k]>A?(B=R[O+d[k]],Q[ne+d[k]]):(B=96,0),M=1<<F-X,j=E=1<<Y;x[T+($>>X)+(E-=M)]=v<<24|B<<16|D,E!==0;);for(M=1<<F-1;$&M;)M>>=1;if(M!==0?($&=M-1,$+=M):$=0,k++,--ee[F]==0){if(F===P)break;F=f[p+d[k]]}if(G<F&&($&I)!==L){for(X===0&&(X=G),T+=j,ie=1<<(Y=F-X);Y+X<P&&!((ie-=ee[Y+X])<=0);)Y++,ie<<=1;if(oe+=1<<Y,t===1&&852<oe||t===2&&592<oe)return 1;x[L=$&I]=G<<24|Y<<16|T-y}}return $!==0&&(x[T+$]=F-X<<24|4194304),S.bits=G,0}},{"../utils/common":41}],51:[function(l,s,u){s.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(l,s,u){var r=l("../utils/common");function i(R){for(var O=R.length;0<=--O;)R[O]=0}var o=256,n=286,h=30,t=15,f=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],p=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],y=new Array(576);i(y);var d=new Array(60);i(d);var S=new Array(512);i(S);var M=new Array(256);i(M);var E=new Array(29);i(E);var L,I,T,A=new Array(h);function v(R,O,U,H,W){this.static_tree=R,this.extra_bits=O,this.extra_base=U,this.elems=H,this.max_length=W,this.has_stree=R&&R.length}function B(R,O){this.dyn_tree=R,this.max_code=0,this.stat_desc=O}function D(R){return R<256?S[R]:S[256+(R>>>7)]}function _(R,O){R.pending_buf[R.pending++]=255&O,R.pending_buf[R.pending++]=O>>>8&255}function F(R,O,U){R.bi_valid>16-U?(R.bi_buf|=O<<R.bi_valid&65535,_(R,R.bi_buf),R.bi_buf=O>>16-R.bi_valid,R.bi_valid+=U-16):(R.bi_buf|=O<<R.bi_valid&65535,R.bi_valid+=U)}function k(R,O,U){F(R,U[2*O],U[2*O+1])}function j(R,O){for(var U=0;U|=1&R,R>>>=1,U<<=1,0<--O;);return U>>>1}function P(R,O,U){var H,W,K=new Array(16),q=0;for(H=1;H<=t;H++)K[H]=q=q+U[H-1]<<1;for(W=0;W<=O;W++){var te=R[2*W+1];te!==0&&(R[2*W]=j(K[te]++,te))}}function G(R){var O;for(O=0;O<n;O++)R.dyn_ltree[2*O]=0;for(O=0;O<h;O++)R.dyn_dtree[2*O]=0;for(O=0;O<19;O++)R.bl_tree[2*O]=0;R.dyn_ltree[512]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function Y(R){8<R.bi_valid?_(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function X(R,O,U,H){var W=2*O,K=2*U;return R[W]<R[K]||R[W]===R[K]&&H[O]<=H[U]}function ie(R,O,U){for(var H=R.heap[U],W=U<<1;W<=R.heap_len&&(W<R.heap_len&&X(O,R.heap[W+1],R.heap[W],R.depth)&&W++,!X(O,H,R.heap[W],R.depth));)R.heap[U]=R.heap[W],U=W,W<<=1;R.heap[U]=H}function oe(R,O,U){var H,W,K,q,te=0;if(R.last_lit!==0)for(;H=R.pending_buf[R.d_buf+2*te]<<8|R.pending_buf[R.d_buf+2*te+1],W=R.pending_buf[R.l_buf+te],te++,H===0?k(R,W,O):(k(R,(K=M[W])+o+1,O),(q=f[K])!==0&&F(R,W-=E[K],q),k(R,K=D(--H),U),(q=p[K])!==0&&F(R,H-=A[K],q)),te<R.last_lit;);k(R,256,O)}function $(R,O){var U,H,W,K=O.dyn_tree,q=O.stat_desc.static_tree,te=O.stat_desc.has_stree,se=O.stat_desc.elems,ue=-1;for(R.heap_len=0,R.heap_max=573,U=0;U<se;U++)K[2*U]!==0?(R.heap[++R.heap_len]=ue=U,R.depth[U]=0):K[2*U+1]=0;for(;R.heap_len<2;)K[2*(W=R.heap[++R.heap_len]=ue<2?++ue:0)]=1,R.depth[W]=0,R.opt_len--,te&&(R.static_len-=q[2*W+1]);for(O.max_code=ue,U=R.heap_len>>1;1<=U;U--)ie(R,K,U);for(W=se;U=R.heap[1],R.heap[1]=R.heap[R.heap_len--],ie(R,K,1),H=R.heap[1],R.heap[--R.heap_max]=U,R.heap[--R.heap_max]=H,K[2*W]=K[2*U]+K[2*H],R.depth[W]=(R.depth[U]>=R.depth[H]?R.depth[U]:R.depth[H])+1,K[2*U+1]=K[2*H+1]=W,R.heap[1]=W++,ie(R,K,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(fe,xe){var ve,Se,ye,be,Me,_e,Te=xe.dyn_tree,Le=xe.max_code,Pe=xe.stat_desc.static_tree,Ae=xe.stat_desc.has_stree,Ce=xe.stat_desc.extra_bits,Be=xe.stat_desc.extra_base,Ie=xe.stat_desc.max_length,Fe=0;for(be=0;be<=t;be++)fe.bl_count[be]=0;for(Te[2*fe.heap[fe.heap_max]+1]=0,ve=fe.heap_max+1;ve<573;ve++)Ie<(be=Te[2*Te[2*(Se=fe.heap[ve])+1]+1]+1)&&(be=Ie,Fe++),Te[2*Se+1]=be,Le<Se||(fe.bl_count[be]++,Me=0,Be<=Se&&(Me=Ce[Se-Be]),_e=Te[2*Se],fe.opt_len+=_e*(be+Me),Ae&&(fe.static_len+=_e*(Pe[2*Se+1]+Me)));if(Fe!==0){do{for(be=Ie-1;fe.bl_count[be]===0;)be--;fe.bl_count[be]--,fe.bl_count[be+1]+=2,fe.bl_count[Ie]--,Fe-=2}while(0<Fe);for(be=Ie;be!==0;be--)for(Se=fe.bl_count[be];Se!==0;)Le<(ye=fe.heap[--ve])||(Te[2*ye+1]!==be&&(fe.opt_len+=(be-Te[2*ye+1])*Te[2*ye],Te[2*ye+1]=be),Se--)}}(R,O),P(K,ue,R.bl_count)}function Q(R,O,U){var H,W,K=-1,q=O[1],te=0,se=7,ue=4;for(q===0&&(se=138,ue=3),O[2*(U+1)+1]=65535,H=0;H<=U;H++)W=q,q=O[2*(H+1)+1],++te<se&&W===q||(te<ue?R.bl_tree[2*W]+=te:W!==0?(W!==K&&R.bl_tree[2*W]++,R.bl_tree[32]++):te<=10?R.bl_tree[34]++:R.bl_tree[36]++,K=W,ue=(te=0)===q?(se=138,3):W===q?(se=6,3):(se=7,4))}function ne(R,O,U){var H,W,K=-1,q=O[1],te=0,se=7,ue=4;for(q===0&&(se=138,ue=3),H=0;H<=U;H++)if(W=q,q=O[2*(H+1)+1],!(++te<se&&W===q)){if(te<ue)for(;k(R,W,R.bl_tree),--te!=0;);else W!==0?(W!==K&&(k(R,W,R.bl_tree),te--),k(R,16,R.bl_tree),F(R,te-3,2)):te<=10?(k(R,17,R.bl_tree),F(R,te-3,3)):(k(R,18,R.bl_tree),F(R,te-11,7));K=W,ue=(te=0)===q?(se=138,3):W===q?(se=6,3):(se=7,4)}}i(A);var ee=!1;function N(R,O,U,H){F(R,0+(H?1:0),3),function(W,K,q){Y(W),_(W,q),_(W,~q),r.arraySet(W.pending_buf,W.window,K,q,W.pending),W.pending+=q}(R,O,U)}u._tr_init=function(R){ee||(function(){var O,U,H,W,K,q=new Array(16);for(W=H=0;W<28;W++)for(E[W]=H,O=0;O<1<<f[W];O++)M[H++]=W;for(M[H-1]=W,W=K=0;W<16;W++)for(A[W]=K,O=0;O<1<<p[W];O++)S[K++]=W;for(K>>=7;W<h;W++)for(A[W]=K<<7,O=0;O<1<<p[W]-7;O++)S[256+K++]=W;for(U=0;U<=t;U++)q[U]=0;for(O=0;O<=143;)y[2*O+1]=8,O++,q[8]++;for(;O<=255;)y[2*O+1]=9,O++,q[9]++;for(;O<=279;)y[2*O+1]=7,O++,q[7]++;for(;O<=287;)y[2*O+1]=8,O++,q[8]++;for(P(y,287,q),O=0;O<h;O++)d[2*O+1]=5,d[2*O]=j(O,5);L=new v(y,f,257,n,t),I=new v(d,p,0,h,t),T=new v(new Array(0),m,0,19,7)}(),ee=!0),R.l_desc=new B(R.dyn_ltree,L),R.d_desc=new B(R.dyn_dtree,I),R.bl_desc=new B(R.bl_tree,T),R.bi_buf=0,R.bi_valid=0,G(R)},u._tr_stored_block=N,u._tr_flush_block=function(R,O,U,H){var W,K,q=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=function(te){var se,ue=4093624447;for(se=0;se<=31;se++,ue>>>=1)if(1&ue&&te.dyn_ltree[2*se]!==0)return 0;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return 1;for(se=32;se<o;se++)if(te.dyn_ltree[2*se]!==0)return 1;return 0}(R)),$(R,R.l_desc),$(R,R.d_desc),q=function(te){var se;for(Q(te,te.dyn_ltree,te.l_desc.max_code),Q(te,te.dyn_dtree,te.d_desc.max_code),$(te,te.bl_desc),se=18;3<=se&&te.bl_tree[2*x[se]+1]===0;se--);return te.opt_len+=3*(se+1)+5+5+4,se}(R),W=R.opt_len+3+7>>>3,(K=R.static_len+3+7>>>3)<=W&&(W=K)):W=K=U+5,U+4<=W&&O!==-1?N(R,O,U,H):R.strategy===4||K===W?(F(R,2+(H?1:0),3),oe(R,y,d)):(F(R,4+(H?1:0),3),function(te,se,ue,fe){var xe;for(F(te,se-257,5),F(te,ue-1,5),F(te,fe-4,4),xe=0;xe<fe;xe++)F(te,te.bl_tree[2*x[xe]+1],3);ne(te,te.dyn_ltree,se-1),ne(te,te.dyn_dtree,ue-1)}(R,R.l_desc.max_code+1,R.d_desc.max_code+1,q+1),oe(R,R.dyn_ltree,R.dyn_dtree)),G(R),H&&Y(R)},u._tr_tally=function(R,O,U){return R.pending_buf[R.d_buf+2*R.last_lit]=O>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&O,R.pending_buf[R.l_buf+R.last_lit]=255&U,R.last_lit++,O===0?R.dyn_ltree[2*U]++:(R.matches++,O--,R.dyn_ltree[2*(M[U]+o+1)]++,R.dyn_dtree[2*D(O)]++),R.last_lit===R.lit_bufsize-1},u._tr_align=function(R){F(R,2,3),k(R,256,y),function(O){O.bi_valid===16?(_(O,O.bi_buf),O.bi_buf=0,O.bi_valid=0):8<=O.bi_valid&&(O.pending_buf[O.pending++]=255&O.bi_buf,O.bi_buf>>=8,O.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(l,s,u){s.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(l,s,u){(function(r){(function(i){if(!i.setImmediate){var o,n,h,t,f=1,p={},m=!1,x=i.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(i);y=y&&y.setTimeout?y:i,o={}.toString.call(i.process)==="[object process]"?function(E){process.nextTick(function(){S(E)})}:function(){if(i.postMessage&&!i.importScripts){var E=!0,L=i.onmessage;return i.onmessage=function(){E=!1},i.postMessage("","*"),i.onmessage=L,E}}()?(t="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",M,!1):i.attachEvent("onmessage",M),function(E){i.postMessage(t+E,"*")}):i.MessageChannel?((h=new MessageChannel).port1.onmessage=function(E){S(E.data)},function(E){h.port2.postMessage(E)}):x&&"onreadystatechange"in x.createElement("script")?(n=x.documentElement,function(E){var L=x.createElement("script");L.onreadystatechange=function(){S(E),L.onreadystatechange=null,n.removeChild(L),L=null},n.appendChild(L)}):function(E){setTimeout(S,0,E)},y.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var L=new Array(arguments.length-1),I=0;I<L.length;I++)L[I]=arguments[I+1];var T={callback:E,args:L};return p[f]=T,o(f),f++},y.clearImmediate=d}function d(E){delete p[E]}function S(E){if(m)setTimeout(S,0,E);else{var L=p[E];if(L){m=!0;try{(function(I){var T=I.callback,A=I.args;switch(A.length){case 0:T();break;case 1:T(A[0]);break;case 2:T(A[0],A[1]);break;case 3:T(A[0],A[1],A[2]);break;default:T.apply(void 0,A)}})(L)}finally{d(E),m=!1}}}}function M(E){E.source===i&&typeof E.data=="string"&&E.data.indexOf(t)===0&&S(+E.data.slice(t.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,c.g!==void 0?c.g:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)},3065(de,g,c){var l,s;(function(){l=function(){var u=function(){},r="undefined",i=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],n={},h=null;function t(S,M){var E=S[M];if(typeof E.bind=="function")return E.bind(S);try{return Function.prototype.bind.call(E,S)}catch{return function(){return Function.prototype.apply.apply(E,[S,arguments])}}}function f(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function p(){for(var S=this.getLevel(),M=0;M<o.length;M++){var E=o[M];this[E]=M<S?u:this.methodFactory(E,S,this.name)}if(this.log=this.debug,typeof console===r&&S<this.levels.SILENT)return"No console available for logging"}function m(S){return function(){typeof console!==r&&(p.call(this),this[S].apply(this,arguments))}}function x(S,M,E){return function(L){return L==="debug"&&(L="log"),typeof console!==r&&(L==="trace"&&i?f:console[L]!==void 0?t(console,L):console.log!==void 0?t(console,"log"):u)}(S)||m.apply(this,arguments)}function y(S,M){var E,L,I,T=this,A="loglevel";function v(){var _;if(typeof window!==r&&A){try{_=window.localStorage[A]}catch{}if(typeof _===r)try{var F=window.document.cookie,k=encodeURIComponent(A),j=F.indexOf(k+"=");j!==-1&&(_=/^([^;]+)/.exec(F.slice(j+k.length+1))[1])}catch{}return T.levels[_]===void 0&&(_=void 0),_}}function B(_){var F=_;if(typeof F=="string"&&T.levels[F.toUpperCase()]!==void 0&&(F=T.levels[F.toUpperCase()]),typeof F=="number"&&F>=0&&F<=T.levels.SILENT)return F;throw new TypeError("log.setLevel() called with invalid level: "+_)}typeof S=="string"?A+=":"+S:typeof S=="symbol"&&(A=void 0),T.name=S,T.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},T.methodFactory=M||x,T.getLevel=function(){return I??L??E},T.setLevel=function(_,F){return I=B(_),F!==!1&&function(k){var j=(o[k]||"silent").toUpperCase();if(typeof window!==r&&A){try{return void(window.localStorage[A]=j)}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+j+";"}catch{}}}(I),p.call(T)},T.setDefaultLevel=function(_){L=B(_),v()||T.setLevel(_,!1)},T.resetLevel=function(){I=null,function(){if(typeof window!==r&&A){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}(),p.call(T)},T.enableAll=function(_){T.setLevel(T.levels.TRACE,_)},T.disableAll=function(_){T.setLevel(T.levels.SILENT,_)},T.rebuild=function(){if(h!==T&&(E=B(h.getLevel())),p.call(T),h===T)for(var _ in n)n[_].rebuild()},E=B(h?h.getLevel():"WARN");var D=v();D!=null&&(I=B(D)),p.call(T)}(h=new y).getLogger=function(S){if(typeof S!="symbol"&&typeof S!="string"||S==="")throw new TypeError("You must supply a name when creating a logger.");var M=n[S];return M||(M=n[S]=new y(S,h.methodFactory)),M};var d=typeof window!==r?window.log:void 0;return h.noConflict=function(){return typeof window!==r&&window.log===h&&(window.log=d),h},h.getLoggers=function(){return n},h.default=h,h},(s=l.call(g,c,g,de))===void 0||(de.exports=s)})()},2561(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.Fraction=void 0;class c{static max(s,u){return s.RealValue>u.RealValue?s:u}static Equal(s,u){return s.wholeValue===u.wholeValue&&s.Denominator===u.Denominator&&s.Numerator===u.Numerator}static createFromFraction(s){return new c(s.numerator,s.denominator,s.wholeValue,!1)}static plus(s,u){const r=s.clone();return r.Add(u),r}static minus(s,u){const r=s.clone();return r.Sub(u),r}static multiply(s,u){return new c((s.wholeValue*s.denominator+s.numerator)*(u.wholeValue*u.denominator+u.numerator),s.denominator*u.denominator)}static greatestCommonDenominator(s,u){if(s===0)return u;if(u===1)return 1;for(;Math.abs(u)>=1&&Math.abs(s)>=1;)s>u?s-=u:u-=s;const r=Math.round(s);return Math.max(r,1)}constructor(s=0,u=1,r=0,i=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=s,this.denominator=u,this.wholeValue=r,i&&this.simplify(),this.setRealValue()}toString(){let s=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(s=this.wholeValue+" "+s),s}clone(){return new c(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(s){this.numerator!==s&&(this.numerator=s,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(s){this.denominator!==s&&(this.denominator=s,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(s){this.wholeValue!==s&&(this.wholeValue=s,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let s=1,u=2;const r=this.GetExpandedNumerator();for(;u<r;)s++,u=Math.pow(2,s);return Math.min(3,s-1)}IsNegative(){return this.realValue<0}get RealValue(){return this.realValue}expand(s){this.numerator*=s,this.denominator*=s,this.wholeValue!==0&&(this.numerator+=this.wholeValue*this.denominator,this.wholeValue=0)}Add(s){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*s.denominator+(s.wholeValue*s.denominator+s.numerator)*this.denominator,this.denominator=this.denominator*s.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Sub(s){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*s.denominator-(s.wholeValue*s.denominator+s.numerator)*this.denominator,this.denominator=this.denominator*s.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Quantize(s){if(this.denominator<=s)return this;const u=new c(this.numerator+1,this.denominator,this.wholeValue);for(;u.Denominator>s;)u.Numerator++;if(this.numerator>this.denominator){const r=new c(this.numerator-1,this.denominator,this.wholeValue);for(;r.Denominator>s;)r.Numerator--;if(r.Denominator<u.Denominator)return r}return u}Equals(s){return this.realValue===(s==null?void 0:s.realValue)}CompareTo(s){const u=this.realValue-s.realValue;return u?u<0?-1:1:0}lt(s){return this.realValue<s.realValue}lte(s){return this.realValue<=s.realValue}gt(s){return!this.lte(s)}gte(s){return!this.lt(s)}setRealValue(){this.realValue=this.wholeValue+this.numerator/this.denominator}simplify(){if(this.numerator===0)return void(this.denominator=1);const s=c.greatestCommonDenominator(Math.abs(this.numerator),Math.abs(this.denominator));this.numerator/=s,this.denominator/=s;const u=Math.floor(this.numerator/this.denominator);if(u!==0&&(this.wholeValue+=u,this.numerator-=u*this.denominator,this.numerator===0&&(this.denominator=1)),this.denominator>c.maximumAllowedNumber){const r=this.denominator/c.maximumAllowedNumber;this.numerator=Math.round(this.numerator/r),this.denominator=Math.round(this.denominator/r)}if(this.numerator>c.maximumAllowedNumber){const r=this.numerator/c.maximumAllowedNumber;this.numerator=Math.round(this.numerator/r),this.denominator=Math.round(this.denominator/r)}}isOnBeat(s){const u=this.distanceFromBeat(s);return Math.abs(u)<c.FloatInaccuracyTolerance}distanceFromBeat(s){const u=new c(1,s.Denominator);return this.RealValue%u.RealValue}}g.Fraction=c,c.maximumAllowedNumber=46340,c.FloatInaccuracyTolerance=1e-4},6904(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Matrix2D=void 0;const l=c(9409);class s{constructor(){this.matrix=[];for(let r=0;r<2;r++){this.matrix[r]=[];for(let i=0;i<2;i++)this.matrix[r][i]=0}}static getRotationMatrix(r){const i=new s,o=Math.cos(r),n=Math.sin(r);return i.matrix[0][0]=o,i.matrix[0][1]=-n,i.matrix[1][0]=n,i.matrix[1][1]=o,i}scalarMultiplication(r){for(let i=0;i<2;i++)for(let o=0;o<2;o++)this.matrix[i][o]*=r}getTransposeMatrix(){const r=new s;for(let i=0;i<2;i++)for(let o=0;o<2;o++)r.matrix[i][o]=this.matrix[o][i];return r}vectorMultiplication(r){const i=new l.PointF2D;return i.x=r.x*this.matrix[0][0]+r.y*this.matrix[0][1],i.y=r.x*this.matrix[1][0]+r.y*this.matrix[1][1],i}}g.Matrix2D=s},8786(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSheetErrors=void 0,g.MusicSheetErrors=class{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(c){let l=this.measureErrors[c];l||(l=[]),this.measureErrors[c]=l.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(c){this.tempErrors.push(c)}push(c){this.errors.push(c)}}},8705(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.OSMDColor=void 0;class c{constructor(s,u,r){this.alpha=255,this.red=s,this.green=u,this.blue=r}static get Black(){return new c(0,0,0)}static get DeepSkyBlue(){return new c(0,191,255)}static get Green(){return new c(20,160,20)}static get Magenta(){return new c(255,0,255)}static get Orange(){return new c(255,128,0)}static get Red(){return new c(240,20,20)}static get Disabled(){return new c(225,225,225)}static get DarkBlue(){return new c(0,0,140)}static get Debug1(){return new c(200,0,140)}static get Debug2(){return new c(100,100,200)}static get Debug3(){return new c(0,50,140)}toString(){return"rgb("+this.red+","+this.green+","+this.blue+","+this.alpha+")"}}g.OSMDColor=c},8233(de,g){var c,l;Object.defineProperty(g,"__esModule",{value:!0}),g.Pitch=g.AccidentalEnum=g.NoteEnum=void 0,function(u){u[u.C=0]="C",u[u.D=2]="D",u[u.E=4]="E",u[u.F=5]="F",u[u.G=7]="G",u[u.A=9]="A",u[u.B=11]="B"}(c||(g.NoteEnum=c={})),function(u){u[u.SHARP=0]="SHARP",u[u.FLAT=1]="FLAT",u[u.NONE=2]="NONE",u[u.NATURAL=3]="NATURAL",u[u.DOUBLESHARP=4]="DOUBLESHARP",u[u.DOUBLEFLAT=5]="DOUBLEFLAT",u[u.TRIPLESHARP=6]="TRIPLESHARP",u[u.TRIPLEFLAT=7]="TRIPLEFLAT",u[u.QUARTERTONESHARP=8]="QUARTERTONESHARP",u[u.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",u[u.SLASHFLAT=10]="SLASHFLAT",u[u.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",u[u.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",u[u.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",u[u.SLASHSHARP=14]="SLASHSHARP",u[u.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",u[u.SORI=16]="SORI",u[u.KORON=17]="KORON"}(l||(g.AccidentalEnum=l={}));class s{static getNoteEnumString(r){switch(r){case c.C:return"C";case c.D:return"D";case c.E:return"E";case c.F:return"F";case c.G:return"G";case c.A:return"A";case c.B:return"B";default:return""}}static lineShiftFromNoteEnum(r,i){if(i===0)return[r,0];const o=s.pitchEnumValues,n=o.indexOf(r);let h=0,t=(n+i)%o.length;return n+i>o.length-1&&(h=1),t<0&&(t=o.length+t,h=-1),[o[t],h]}static CalculateTransposedHalfTone(r,i){const o=r.fundamentalNote+r.AccidentalHalfTones+i;return s.WrapAroundCheck(o,12)}static WrapAroundCheck(r,i){let o=0;for(;r<0;)r+=i,o--;for(;r>=i;)r-=i,o++;return{overflow:o,halftone:r}}static calcFrequency(r){let i,o=0;if(r instanceof s){const n=r;o=n.octave-1,i=n.fundamentalNote-c.A+n.AccidentalHalfTones}else typeof r=="number"&&(i=r-57);return 440*Math.pow(2,o)*Math.pow(2,i/12)}static calcFractionalKey(r){return Math.log(r/440)/Math.LN10*s.halftoneFactor+57}static fromFrequency(r){const i=s.calcFractionalKey(r)+.5,o=Math.floor(i/12)-s.octXmlDiff,n=Math.floor(i)%12;let h=n,t=l.NONE;return this.pitchEnumValues.indexOf(h)===-1&&(h=n-1,t=l.SHARP),new s(h,o,t)}static fromHalftone(r){const i=Math.floor(r/12)-s.octXmlDiff,o=r%12;let n=o,h=l.NONE;return this.pitchEnumValues.indexOf(n)===-1&&(n=o-1,h=l.SHARP),new s(n,i,h)}static ceiling(r){let i=r%=12;return this.pitchEnumValues.indexOf(i)===-1&&(i=r+1),i}static floor(r){let i=r%=12;return this.pitchEnumValues.indexOf(i)===-1&&(i=r-1),i}constructor(r,i,o,n=void 0,h=!1,t=void 0){this.accidental=l.NONE,this.fundamentalNote=r,this.octave=i,this.accidental=o,this.accidentalXml=n,this.halfTone=r+12*(i+s.octXmlDiff)+s.HalfTonesFromAccidental(o),h||(this.frequency=s.calcFrequency(this)),this.OctaveShiftApplied=t}static HalfTonesFromAccidental(r){switch(r){case l.NONE:return 0;case l.SHARP:return 1;case l.FLAT:return-1;case l.NATURAL:return 0;case l.DOUBLESHARP:return 2;case l.DOUBLEFLAT:return-2;case l.TRIPLESHARP:return 3;case l.TRIPLEFLAT:return-3;case l.QUARTERTONESHARP:return .5;case l.QUARTERTONEFLAT:return-.5;case l.SLASHFLAT:return-.51;case l.THREEQUARTERSSHARP:return 1.5;case l.THREEQUARTERSFLAT:return-1.5;case l.SLASHQUARTERSHARP:return .0013;case l.SLASHSHARP:return .0014;case l.DOUBLESLASHFLAT:return-.0015;case l.SORI:return .0016;case l.KORON:return .0017;default:throw new Error("Unhandled AccidentalEnum value")}}static AccidentalFromHalfTones(r){switch(r){case 0:return l.NONE;case 1:return l.SHARP;case-1:return l.FLAT;case 2:return l.DOUBLESHARP;case-2:return l.DOUBLEFLAT;case 3:return l.TRIPLESHARP;case-3:return l.TRIPLEFLAT;case .5:return l.QUARTERTONESHARP;case-.5:return l.QUARTERTONEFLAT;case 1.5:return l.THREEQUARTERSSHARP;case-1.5:return l.THREEQUARTERSFLAT;default:return r>0&&r<1?l.QUARTERTONESHARP:r<0&&r>-1?l.QUARTERTONEFLAT:l.QUARTERTONESHARP}}static accidentalVexflow(r){let i;switch(r){case l.NATURAL:i="n";break;case l.FLAT:i="b";break;case l.SHARP:i="#";break;case l.DOUBLESHARP:i="##";break;case l.TRIPLESHARP:i="###";break;case l.DOUBLEFLAT:i="bb";break;case l.TRIPLEFLAT:i="bbs";break;case l.QUARTERTONESHARP:i="+";break;case l.QUARTERTONEFLAT:i="d";break;case l.SLASHFLAT:i="bs";break;case l.THREEQUARTERSSHARP:i="++";break;case l.THREEQUARTERSFLAT:i="db";break;case l.SLASHQUARTERSHARP:i="+-";break;case l.SLASHSHARP:i="++-";break;case l.DOUBLESLASHFLAT:i="bss";break;case l.SORI:i="o";break;case l.KORON:i="k"}return i}get AccidentalHalfTones(){return s.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get AccidentalXml(){return this.accidentalXml}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return s.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(r){if(r>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return r>0?this.getHigherPitchByTransposeFactor(r):r<0?this.getLowerPitchByTransposeFactor(-r):this}DoEnharmonicChange(){switch(this.accidental){case l.FLAT:case l.DOUBLEFLAT:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=s.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+s.octXmlDiff)));break;case l.SHARP:case l.DOUBLESHARP:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=s.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+s.octXmlDiff)));break;default:return}}ToString(){let r=s.accidentalVexflow(this.accidental);return r||(r=""),"Key: "+s.getNoteEnumString(this.fundamentalNote)+r+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}ToStringShort(r=0){let i=s.accidentalVexflow(this.accidental);i||(i="");const o=this.octave+r;return s.getNoteEnumString(this.fundamentalNote)+i+o}get ToStringShortGet(){return this.ToStringShort(0)}OperatorEquals(r){const i=this;return!(!i||!r)&&i.FundamentalNote===r.FundamentalNote&&i.Octave===r.Octave&&i.Accidental===r.Accidental}OperatorNotEqual(r){return this!==r}OperatorFundamentalGreaterThan(r){const i=this;return i.Octave===r.Octave?i.FundamentalNote>r.FundamentalNote:i.Octave>r.Octave}OperatorFundamentalLessThan(r){const i=this;return i.Octave===r.Octave?i.FundamentalNote<r.FundamentalNote:i.Octave<r.Octave}getHigherPitchByTransposeFactor(r){const i=s.pitchEnumValues.indexOf(this.fundamentalNote);let o,n=this.octave;return i+r>s.pitchEnumValues.length-1?(o=s.pitchEnumValues[i+r-s.pitchEnumValues.length],n++):o=s.pitchEnumValues[i+r],new s(o,n,l.NONE)}getLowerPitchByTransposeFactor(r){const i=s.pitchEnumValues.indexOf(this.fundamentalNote);let o,n=this.octave;return i-r<0?(o=s.pitchEnumValues[s.pitchEnumValues.length+i-r],n--):o=s.pitchEnumValues[i-r],new s(o,n,l.NONE)}getNextFundamentalNote(r){let i=s.pitchEnumValues.indexOf(r);return i=(i+1)%s.pitchEnumValues.length,s.pitchEnumValues[i]}getPreviousFundamentalNote(r){const i=s.pitchEnumValues.indexOf(r);return i>0?s.pitchEnumValues[i-1]:s.pitchEnumValues[s.pitchEnumValues.length-1]}}g.Pitch=s,s.pitchEnumValues=[c.C,c.D,c.E,c.F,c.G,c.A,c.B],s.halftoneFactor=12/(Math.LN2/Math.LN10),s.octXmlDiff=3},283(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.PlaybackSettings=void 0;const l=c(2561);class s{constructor(r=new l.Fraction,i=100){this.rhythm=r,this.beatsPerMinute=i,this.beatLengthInMilliseconds=6e4/i,this.beatRealValue=.25}static createFrom(r){return new s(r.Rhythm,r.BeatsPerMinute)}get BeatsPerMinute(){return this.beatsPerMinute}set BeatsPerMinute(r){this.beatsPerMinute=r,this.beatLengthInMilliseconds=6e4/this.beatsPerMinute}get Rhythm(){return this.rhythm}set Rhythm(r){this.rhythm=r}get BeatRealValue(){return this.beatRealValue}get BeatLengthInMilliseconds(){return this.beatLengthInMilliseconds}getDurationInMilliseconds(r){return(typeof r=="number"?r:r.RealValue)*this.BeatLengthInMilliseconds/this.beatRealValue}getDurationAsNoteDuration(r,i=1024){const o=r/this.BeatLengthInMilliseconds;let n=Math.floor(o);const h=new l.Fraction(n,4),t=o-n;return n=Math.round(t/(1/i)/4),t!==0&&n===0&&r>0&&(n=1),h.Add(new l.Fraction(n,i)),h}}g.PlaybackSettings=s},9409(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.PointF2D=void 0;class c{constructor(s=0,u=0){this.x=0,this.y=0,this.x=s,this.y=u}static get Empty(){return new c}static pointsAreEqual(s,u){return s.x===u.x&&s.y===u.y}ToString(){return"["+this.x+", "+this.y+"]"}}g.PointF2D=c},200(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.RectangleF2D=void 0;const l=c(6864),s=c(9409);class u{constructor(i,o,n,h){this.x=0,this.y=0,this.width=0,this.height=0,this.x=i,this.y=o,this.width=n,this.height=h}static createFromLocationAndSize(i,o){return new u(i.x,i.y,o.width,o.height)}get Location(){return new s.PointF2D(this.x,this.y)}get Size(){return new l.SizeF2D(this.width,this.height)}}g.RectangleF2D=u},6864(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.SizeF2D=void 0,g.SizeF2D=class{constructor(c=0,l=0){this.width=c,this.height=l}}},9735(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(2561),g),s(c(6904),g),s(c(8786),g),s(c(8705),g),s(c(8233),g),s(c(9409),g),s(c(200),g),s(c(6864),g)},4434(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.ColoringModes=void 0,function(l){l[l.XML=0]="XML",l[l.AutoColoring=1]="AutoColoring",l[l.CustomColorSet=2]="CustomColorSet"}(c||(g.ColoringModes=c={}))},4146(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.DrawingParametersEnum=void 0,function(l){l.allon="allon",l.compact="compact",l.compacttight="compacttight",l.default="default",l.leadsheet="leadsheet",l.preview="preview",l.thumbnail="thumbnail"}(c||(g.DrawingParametersEnum=c={}))},2570(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.FontStyles=void 0,function(l){l[l.Regular=0]="Regular",l[l.Bold=1]="Bold",l[l.Italic=2]="Italic",l[l.BoldItalic=3]="BoldItalic",l[l.Underlined=4]="Underlined"}(c||(g.FontStyles=c={}))},5951(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.Fonts=void 0,function(l){l[l.TimesNewRoman=0]="TimesNewRoman",l[l.Kokila=1]="Kokila"}(c||(g.Fonts=c={}))},7533(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.TextAlignment=g.TextAlignmentEnum=void 0,function(l){l[l.LeftTop=0]="LeftTop",l[l.LeftCenter=1]="LeftCenter",l[l.LeftBottom=2]="LeftBottom",l[l.CenterTop=3]="CenterTop",l[l.CenterCenter=4]="CenterCenter",l[l.CenterBottom=5]="CenterBottom",l[l.RightTop=6]="RightTop",l[l.RightCenter=7]="RightCenter",l[l.RightBottom=8]="RightBottom"}(c||(g.TextAlignmentEnum=c={})),g.TextAlignment=class{static IsLeft(l){return l===c.LeftTop||l===c.LeftCenter||l===c.LeftBottom}static IsCenterAligned(l){return l===c.CenterTop||l===c.CenterCenter||l===c.CenterBottom}static IsRight(l){return l===c.RightTop||l===c.RightCenter||l===c.RightBottom}}},2514(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.TieTypes=void 0,function(l){l.SIMPLE="",l.HAMMERON="H",l.PULLOFF="P",l.SLIDE="S",l.TAPPING="T"}(c||(g.TieTypes=c={}))},2257(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(4434),g),s(c(4146),g),s(c(2570),g),s(c(5951),g),s(c(7533),g),s(c(2514),g)},6888(de,g,c){var l=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(g,"__esModule",{value:!0}),g.MXLHelper=g.MXLFile=void 0;const s=c(3902),u=l(c(1710)),r=l(c(3065));g.MXLFile=class{constructor(o){this.unzipSuccessful=!1,this.blob=o}async tryUnzip(){this.zipFile=new u.default;try{return this.unzipSuccessful=!0,await this.zipFile.loadAsync(this.blob),!0}catch{return this.unzipSuccessful=!1,!1}}getXmlString(){return i.jszipToXMLstring(this.zipFile)}};class i{static MXLtoIXmlElement(n){return this.MXLtoXMLstring(n).then(h=>{const t=new DOMParser().parseFromString(h,"text/xml"),f=new s.IXmlElement(t.documentElement);return Promise.resolve(f)},h=>{throw new Error("extractSheetFromMxl: "+h.message)})}static async jszipToXMLstring(n){let h=await n.file("META-INF/container.xml").async("text");if(!h.startsWith("<")){const p=await n.file("META-INF/container.xml").async("uint8array");h=new TextDecoder("utf-8").decode(p)}if(!h.startsWith("<")){const p=await n.file("META-INF/container.xml").async("uint8array");h=new TextDecoder("utf-16").decode(p)}const t=new DOMParser().parseFromString(h,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path"),f=await n.file(t).async("text");if(!f.substring(0,1).startsWith("<")){const p=await n.file(t).async("uint8array");return new TextDecoder("utf-16").decode(p)}return f}static MXLtoXMLstring(n){const h=new u.default;return h.loadAsync(n).then(async t=>this.jszipToXMLstring(h),t=>{throw r.default.error(t),t})}}g.MXLHelper=i},3902(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.IXmlElement=void 0;class c{constructor(s){if(this.hasAttributes=!1,!s)throw new Error("IXmlElement: expected Element, got undefined");this.elem=s,this.name=s.nodeName.toLowerCase(),s.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=s.attributes[0]),this.hasElements=s.hasChildNodes(),s.childNodes.length===1&&s.childNodes[0].nodeType===Node.TEXT_NODE?this.value=s.childNodes[0].nodeValue:this.value=""}attribute(s){return this.elem.attributes.getNamedItem(s)}attributes(){if(!this.attrs){const s=this.elem.attributes,u=[];for(let r=0;r<s.length;r+=1)u.push(s[r]);this.attrs=u}return this.attrs}element(s){const u=this.elem.childNodes;for(let r=0,i=u.length;r<i;r+=1){const o=u[r];if(o.nodeType===Node.ELEMENT_NODE&&o.nodeName.toLowerCase()===s)return new c(o)}}elements(s){const u=this.elem.childNodes,r=[],i=!s;i||(s=s.toLowerCase());for(let o=0;o<u.length;o+=1){const n=u[o];n.nodeType!==Node.ELEMENT_NODE||!i&&n.nodeName.toLowerCase()!==s||r.push(new c(n))}return r}combinedElement(s){const u=this.elem.childNodes;if(u.length>0){let r;for(let i=0,o=u.length;i<o;i+=1){const n=u[i];if(n.nodeType===Node.ELEMENT_NODE&&n.nodeName.toLowerCase()===s)if(r){const h=n.childNodes;for(let t=0,f=h.length;t<f;t+=1){const p=h[t];r.appendChild(p.cloneNode(!0))}}else r=n}if(r)return new c(r)}}}g.IXmlElement=c},599(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(6888),g),s(c(3902),g)},4356(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.StringUtil=void 0,g.StringUtil=class{static StringContainsSeparatedWord(c,l,s=!1){return new RegExp("( |^)"+l+"([ .]|$)",s?"i":void 0).test(c)}}},2552(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(9735),g),s(c(2257),g),s(c(599),g)},7307(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.InvalidEnumArgumentException=g.ArgumentOutOfRangeException=g.MusicSheetReadingException=void 0,g.MusicSheetReadingException=class{constructor(c,l){this.message=c,l&&(this.message+=" "+l.toString())}},g.ArgumentOutOfRangeException=class{constructor(c){this.message=c}},g.InvalidEnumArgumentException=class{constructor(c){this.message=c}}},9490(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.AbstractGraphicalExpression=void 0;const l=c(7741),s=c(6438);class u extends l.GraphicalObject{constructor(i,o,n){super(),this.expression=o,this.parentMeasure=n,this.boundingBox=new s.BoundingBox(this,i.PositionAndShape),this.parentStaffLine=i,this.parentStaffLine.AbstractExpressions.push(this),this.rules=i.ParentMusicSystem.rules}get Label(){return this.label}get ParentStaffLine(){return this.parentStaffLine}get SourceExpression(){return this.expression}get Placement(){return this.expression.Placement}}g.AbstractGraphicalExpression=u},1974(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.AbstractGraphicalInstruction=void 0;const l=c(7741);class s extends l.GraphicalObject{constructor(r){super(),this.parent=r}get Parent(){return this.parent}set Parent(r){this.parent=r}}g.AbstractGraphicalInstruction=s},8927(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.AccidentalCalculator=void 0;const l=c(8233),s=c(8233),u=c(3263),r=c(7921);g.AccidentalCalculator=class{constructor(){this.keySignatureNoteAlterationsDict=new u.Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new u.Dictionary}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(i){this.activeKeyInstruction=i,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(const i of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(i,this.keySignatureNoteAlterationsDict.getValue(i))}checkAccidental(i,o){if(!o)return;const n=o.FundamentalNote+12*o.Octave,h=i.sourceNote.NoteTie;if(h&&i.sourceNote!==h.StartNote)return;const t=this.currentAlterationsComparedToKeyInstructionList.indexOf(n)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(n))if(t&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(n),1),this.currentInMeasureNoteAlterationsDict.getValue(n)!==o.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(n)&&this.keySignatureNoteAlterationsDict.getValue(n)!==o.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(n),this.currentInMeasureNoteAlterationsDict.setValue(n,o.AccidentalHalfTones)):o.Accidental!==l.AccidentalEnum.NONE?this.keySignatureNoteAlterationsDict.containsKey(n)?this.currentInMeasureNoteAlterationsDict.setValue(n,this.keySignatureNoteAlterationsDict.getValue(n)):this.currentInMeasureNoteAlterationsDict.remove(n):this.currentInMeasureNoteAlterationsDict.setValue(n,o.AccidentalHalfTones);const f=this.currentInMeasureNoteAlterationsDict.getValue(n);if(o.Accidental===l.AccidentalEnum.NONE&&(o=Math.abs(f)===.5?new s.Pitch(o.FundamentalNote,o.Octave,l.AccidentalEnum.NONE,void 0,!1,o.OctaveShiftApplied):new s.Pitch(o.FundamentalNote,o.Octave,l.AccidentalEnum.NATURAL,void 0,!1,o.OctaveShiftApplied)),this.isAlterAmbiguousAccidental(o.Accidental)&&!o.AccidentalXml)return;r.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(i,o)}else o.AccidentalXml&&this.Transpose===0&&!t&&r.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(i,o);else if(o.Accidental!==l.AccidentalEnum.NONE){if(t||this.currentAlterationsComparedToKeyInstructionList.push(n),this.currentInMeasureNoteAlterationsDict.setValue(n,o.AccidentalHalfTones),this.isAlterAmbiguousAccidental(o.Accidental)&&!o.AccidentalXml)return;r.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(i,o)}else t&&(o=new s.Pitch(o.FundamentalNote,o.Octave,l.AccidentalEnum.NATURAL,void 0,!1,o.OctaveShiftApplied),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(n),1),r.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(i,o))}isAlterAmbiguousAccidental(i){return i===l.AccidentalEnum.SLASHFLAT||i===l.AccidentalEnum.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const i=this.activeKeyInstruction.AlteratedNotes;let o;o=this.activeKeyInstruction.Key>0?l.AccidentalEnum.SHARP:l.AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let n=-9;n<9;n++)for(let h=0;h<i.length;h++)this.keySignatureNoteAlterationsDict.setValue(i[h]+12*n,s.Pitch.HalfTonesFromAccidental(o));this.doCalculationsAtEndOfMeasure()}}},6438(de,g,c){var l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(g,"__esModule",{value:!0}),g.ColDirEnum=g.BoundingBox=void 0;const s=l(c(3065)),u=c(7307),r=c(9409),i=c(6864),o=c(200),n=c(7741);var h;g.BoundingBox=class{constructor(t=void 0,f=void 0,p=!1){this.isSymbol=!1,this.relativePositionHasBeenSet=!1,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,this.absolutePosition=new r.PointF2D,this.relativePosition=new r.PointF2D,this.size=new i.SizeF2D,this.marginSize=new i.SizeF2D,this.upperLeftCorner=new r.PointF2D,this.upperLeftMarginCorner=new r.PointF2D,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.borderMarginLeft=0,this.borderMarginRight=0,this.borderMarginTop=0,this.borderMarginBottom=0,this.childElements=[],this.parent=f,this.dataObject=t,this.isSymbol=p,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,f&&(this.Parent=f)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(t){this.xBordersHaveBeenSet=t}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(t){this.yBordersHaveBeenSet=t}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(t){this.absolutePosition=t}get RelativePosition(){return this.relativePosition}set RelativePosition(t){this.relativePosition=t,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(t){this.size=t}get MarginSize(){return this.marginSize}get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(t){this.borderLeft=t,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(t){this.borderRight=t,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(t){this.borderTop=t,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(t){this.borderBottom=t,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(t){this.borderMarginLeft=t,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRight<this.borderRight?this.borderRight:this.borderMarginRight}set BorderMarginRight(t){this.borderMarginRight=t,this.calculateMarginRectangle()}get BorderMarginTop(){return this.borderMarginTop>this.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(t){this.borderMarginTop=t,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom<this.borderBottom?this.borderBottom:this.borderMarginBottom}set BorderMarginBottom(t){this.borderMarginBottom=t,this.calculateMarginRectangle()}get BoundingRectangle(){return this.boundingRectangle}get BoundingMarginRectangle(){return this.boundingMarginRectangle}get ChildElements(){return this.childElements}set ChildElements(t){this.childElements=t}get Parent(){return this.parent}set Parent(t){if(this.parent){const f=this.parent.ChildElements.indexOf(this,0);f>-1&&this.parent.ChildElements.splice(f,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 r.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,f=this.ChildElements.length;t<f;++t)this.ChildElements[t].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateAbsolutePositionsRecursive(t,f){this.absolutePosition.x=this.relativePosition.x+t,this.absolutePosition.y=this.relativePosition.y+f;for(let p=0,m=this.ChildElements.length;p<m;++p)this.ChildElements[p].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateAbsolutePositionsOfChildren(){for(let t=0,f=this.ChildElements.length;t<f;++t)this.ChildElements[t].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateBoundingBox(t=[]){if(this.childElements.length===0)return;for(let E=0,L=this.ChildElements.length;E<L;++E){const I=this.ChildElements[E];let T=!0;for(const A of t){const v=I.DataObject;if(v.isInstanceOfClass&&v.isInstanceOfClass(A)){T=!1;break}}T&&I.calculateBoundingBox(t)}let f=Number.MAX_VALUE,p=Number.MIN_VALUE,m=Number.MAX_VALUE,x=Number.MIN_VALUE,y=Number.MAX_VALUE,d=Number.MIN_VALUE,S=Number.MAX_VALUE,M=Number.MIN_VALUE;this.isSymbol&&(f=this.borderLeft,p=this.borderRight,m=this.borderTop,x=this.borderBottom,y=this.borderMarginLeft,d=this.borderMarginRight,S=this.borderMarginTop,M=this.borderMarginBottom);for(let E=0,L=this.ChildElements.length;E<L;++E){const I=this.ChildElements[E];f=Math.min(f,I.relativePosition.x+I.borderLeft),p=Math.max(p,I.relativePosition.x+I.borderRight),m=Math.min(m,I.relativePosition.y+I.borderTop),x=Math.max(x,I.relativePosition.y+I.borderBottom),y=Math.min(y,I.relativePosition.x+I.borderMarginLeft),d=Math.max(d,I.relativePosition.x+I.borderMarginRight),S=Math.min(S,I.relativePosition.y+I.borderMarginTop),M=Math.max(M,I.relativePosition.y+I.borderMarginBottom)}this.borderLeft=f,this.borderRight=p,this.borderTop=m,this.borderBottom=x,this.borderMarginLeft=y,this.borderMarginRight=d,this.borderMarginTop=S,this.borderMarginBottom=M,this.calculateRectangle(),this.calculateMarginRectangle(),this.xBordersHaveBeenSet=!0,this.yBordersHaveBeenSet=!0}calculateTopBottomBorders(){if(this.childElements.length===0)return;for(let x=0,y=this.ChildElements.length;x<y;++x)this.ChildElements[x].calculateTopBottomBorders();let t=Number.MAX_VALUE,f=Number.MIN_VALUE,p=Number.MAX_VALUE,m=Number.MIN_VALUE;this.yBordersHaveBeenSet&&(t=this.borderTop,f=this.borderBottom,p=this.borderMarginTop,m=this.borderMarginBottom);for(let x=0,y=this.ChildElements.length;x<y;++x){const d=this.ChildElements[x];t=Math.min(t,d.relativePosition.y+d.borderTop),f=Math.max(f,d.relativePosition.y+d.borderBottom),p=Math.min(p,d.relativePosition.y+d.borderMarginTop),m=Math.max(m,d.relativePosition.y+d.borderMarginBottom)}this.borderTop=t,this.borderBottom=f,this.borderMarginTop=p,this.borderMarginBottom=m,this.calculateRectangle(),this.calculateMarginRectangle()}computeNonOverlappingPositionWithMargin(t,f,p){this.RelativePosition=new r.PointF2D(p.x,p.y),this.setAbsolutePositionFromParent();let m=0,x=!1;do switch(f){case h.Left:case h.Right:m=this.relativePosition.x,t.calculateMarginPositionAlongDirection(this,f),x=Math.abs(m-this.relativePosition.x)>.001;break;case h.Up:case h.Down:m=this.relativePosition.y,t.calculateMarginPositionAlongDirection(this,f),x=Math.abs(m-this.relativePosition.y)>.001;break;default:throw new u.ArgumentOutOfRangeException("direction")}while(x)}collisionDetection(t){const f=Math.min(this.AbsolutePosition.x+this.borderRight,t.absolutePosition.x+t.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,t.absolutePosition.x+t.borderLeft),p=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 f>=0&&p>=0}liesInsideBorders(t){const f=this.AbsolutePosition.x+this.borderLeft<=t.absolutePosition.x+t.borderLeft&&t.absolutePosition.x+t.borderLeft<=this.AbsolutePosition.x+this.borderRight,p=this.AbsolutePosition.x+this.borderLeft<=t.absolutePosition.x+t.borderRight&&t.absolutePosition.x+t.borderRight<=this.AbsolutePosition.x+this.borderRight;if(f&&p){const m=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderTop&&t.absolutePosition.y+t.borderTop<=this.AbsolutePosition.y+this.borderBottom,x=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderBottom&&t.absolutePosition.y+t.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(m&&x)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 f=Math.min(this.AbsolutePosition.x+this.borderMarginRight,t.absolutePosition.x+t.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,t.absolutePosition.x+t.borderMarginLeft),p=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 f>0&&p>0}liesInsideMargins(t){const f=this.AbsolutePosition.x+this.borderMarginLeft<=t.absolutePosition.x+t.borderMarginLeft&&t.absolutePosition.x+t.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,p=this.AbsolutePosition.x+this.borderMarginLeft<=t.absolutePosition.x+t.borderMarginRight&&t.absolutePosition.x+t.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(f&&p){const m=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginTop&&t.absolutePosition.y+t.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,x=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginBottom&&t.absolutePosition.y+t.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(m&&x)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,f,p){this.RelativePosition=new r.PointF2D(p.x,p.y),this.setAbsolutePositionFromParent();let m=0,x=!1;do switch(f){case h.Left:case h.Right:m=this.relativePosition.x,t.calculatePositionAlongDirection(this,f),x=Math.abs(m-this.relativePosition.x)>1e-4;break;case h.Up:case h.Down:m=this.relativePosition.y,t.calculatePositionAlongDirection(this,f),x=Math.abs(m-this.relativePosition.y)>1e-4;break;default:throw new u.ArgumentOutOfRangeException("direction")}while(x)}getClickedObjectOfType(t){const f=this.dataObject;if(this.pointLiesInsideBorders(t)&&f)return f;for(let p=0,m=this.childElements.length;p<m;++p){const x=this.childElements[p].getClickedObjectOfType(t);if(x)return x}}getObjectsInRegion(t,f=!0,p=n.GraphicalObject.name){let m=[];for(const x of this.childElements)m=m.concat(x.getObjectsInRegion(t,f,p));return this.dataObject&&this.dataObject.isInstanceOfClass(p)&&(f?t.liesInsideBorders(this)&&m.push(this.dataObject):t.collisionDetection(this)&&m.push(this.dataObject)),m}calculateRectangle(){this.upperLeftCorner=new r.PointF2D(this.BorderLeft,this.BorderTop),this.size=new i.SizeF2D(this.BorderRight-this.BorderLeft,this.BorderBottom-this.BorderTop),this.boundingRectangle=o.RectangleF2D.createFromLocationAndSize(this.upperLeftCorner,this.size)}calculateMarginRectangle(){this.upperLeftMarginCorner=new r.PointF2D(this.BorderMarginLeft,this.BorderMarginTop),this.marginSize=new i.SizeF2D(this.BorderMarginRight-this.BorderMarginLeft,this.BorderMarginBottom-this.BorderMarginTop),this.boundingMarginRectangle=o.RectangleF2D.createFromLocationAndSize(this.upperLeftMarginCorner,this.marginSize)}calculateMarginPositionAlongDirection(t,f){if(this!==t){if(this.isSymbol&&this.marginCollisionDetection(t)){let p=0;switch(f){case h.Left:return p=this.absolutePosition.x+this.borderMarginLeft-(t.absolutePosition.x+t.borderMarginRight),t.relativePosition.x+=p,void(t.absolutePosition.x+=p);case h.Right:return p=this.absolutePosition.x+this.borderMarginRight-(t.absolutePosition.x+t.borderMarginLeft),t.relativePosition.x+=p,void(t.absolutePosition.x+=p);case h.Up:return p=this.absolutePosition.y+this.borderMarginTop-(t.absolutePosition.y+t.borderMarginBottom),t.relativePosition.y+=p,void(t.absolutePosition.y+=p);case h.Down:return p=this.absolutePosition.y+this.borderMarginBottom-(t.absolutePosition.y+t.borderMarginTop),t.relativePosition.y+=p,void(t.absolutePosition.y+=p);default:throw new u.ArgumentOutOfRangeException("direction")}}for(let p=0,m=this.ChildElements.length;p<m;++p)this.ChildElements[p].calculateMarginPositionAlongDirection(t,f)}}calculatePositionAlongDirection(t,f){if(this!==t){if(this.isSymbol&&this.collisionDetection(t)){let p;switch(f){case h.Left:return p=this.absolutePosition.x+this.borderLeft-(t.absolutePosition.x+t.borderRight),t.relativePosition.x+=p,void(t.absolutePosition.x+=p);case h.Right:return p=this.absolutePosition.x+this.borderRight-(t.absolutePosition.x+t.borderLeft),t.relativePosition.x+=p,void(t.absolutePosition.x+=p);case h.Up:return p=this.absolutePosition.y+this.borderTop-(t.absolutePosition.y+t.borderBottom),t.relativePosition.y+=p,void(t.absolutePosition.y+=p);case h.Down:return p=this.absolutePosition.y+this.borderBottom-(t.absolutePosition.y+t.borderTop),t.relativePosition.y+=p,void(t.absolutePosition.y+=p);default:throw new u.ArgumentOutOfRangeException("direction")}}for(let p=0,m=this.ChildElements.length;p<m;++p)this.ChildElements[p].calculatePositionAlongDirection(t,f)}}},function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Up=2]="Up",t[t.Down=3]="Down",t[t.NotYetDefined=4]="NotYetDefined"}(h||(g.ColDirEnum=h={}))},995(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Clickable=void 0;const l=c(7741);class s extends l.GraphicalObject{}g.Clickable=s},2683(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.AutoColorSet=g.NoteState=g.GraphicalLayers=g.StyleSets=g.OUTLINE_AND_FILL_STYLE_DICT=g.OutlineAndFillStyleEnum=void 0;const l=c(3263);var s,u,r,i,o;(function(n){n[n.BaseWritingColor=0]="BaseWritingColor",n[n.FollowingCursor=1]="FollowingCursor",n[n.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",n[n.PlaybackCursor=3]="PlaybackCursor",n[n.Highlighted=4]="Highlighted",n[n.ErrorUnderlay=5]="ErrorUnderlay",n[n.Selected=6]="Selected",n[n.SelectionSymbol=7]="SelectionSymbol",n[n.DebugColor1=8]="DebugColor1",n[n.DebugColor2=9]="DebugColor2",n[n.DebugColor3=10]="DebugColor3",n[n.SplitScreenDivision=11]="SplitScreenDivision",n[n.GreyTransparentOverlay=12]="GreyTransparentOverlay",n[n.MarkedArea1=13]="MarkedArea1",n[n.MarkedArea2=14]="MarkedArea2",n[n.MarkedArea3=15]="MarkedArea3",n[n.MarkedArea4=16]="MarkedArea4",n[n.MarkedArea5=17]="MarkedArea5",n[n.MarkedArea6=18]="MarkedArea6",n[n.MarkedArea7=19]="MarkedArea7",n[n.MarkedArea8=20]="MarkedArea8",n[n.MarkedArea9=21]="MarkedArea9",n[n.MarkedArea10=22]="MarkedArea10",n[n.Comment1=23]="Comment1",n[n.Comment2=24]="Comment2",n[n.Comment3=25]="Comment3",n[n.Comment4=26]="Comment4",n[n.Comment5=27]="Comment5",n[n.Comment6=28]="Comment6",n[n.Comment7=29]="Comment7",n[n.Comment8=30]="Comment8",n[n.Comment9=31]="Comment9",n[n.Comment10=32]="Comment10"})(s||(g.OutlineAndFillStyleEnum=s={})),g.OUTLINE_AND_FILL_STYLE_DICT=new l.Dictionary,g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.BaseWritingColor,"Thistle"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.FollowingCursor,"Aqua"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.AlternativeFollowingCursor,"Azure"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.PlaybackCursor,"Bisque"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Highlighted,"CadetBlue"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.ErrorUnderlay,"DarkBlue"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Selected,"DarkGoldenRod"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.SelectionSymbol,"BlanchedAlmond"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.DebugColor1,"Chartreuse"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.DebugColor2,"DarkGreen"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.DebugColor3,"DarkOrange"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.SplitScreenDivision,"FireBrick"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.GreyTransparentOverlay,"DarkSalmon"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea1,"DarkSeaGreen"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea2,"DarkOrchid"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea3,"Aquamarine"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea4,"DarkKhaki"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea5,"ForestGreen"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea6,"AliceBlue"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea7,"DeepPink"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea8,"Coral"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea9,"DarkOliveGreen"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea10,"Chocolate"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment1,"DodgerBlue"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment2,"Blue"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment3,"Beige"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment4,"Crimson"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment5,"Fuchsia"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment6,"Brown"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment7,"BlanchedAlmond"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment8,"CornflowerBlue"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment9,"Cornsilk"),g.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment10,"DarkGrey"),function(n){n[n.MarkedArea=0]="MarkedArea",n[n.Comment=1]="Comment"}(u||(g.StyleSets=u={})),function(n){n[n.Background=0]="Background",n[n.Highlight=1]="Highlight",n[n.MeasureError=2]="MeasureError",n[n.SelectionSymbol=3]="SelectionSymbol",n[n.Cursor=4]="Cursor",n[n.PSI_Debug=5]="PSI_Debug",n[n.Notes=6]="Notes",n[n.Comment=7]="Comment",n[n.Debug_above=8]="Debug_above"}(r||(g.GraphicalLayers=r={})),function(n){n[n.Normal=0]="Normal",n[n.Selected=1]="Selected",n[n.Follow_Confirmed=2]="Follow_Confirmed",n[n.QFeedback_NotFound=3]="QFeedback_NotFound",n[n.QFeedback_OK=4]="QFeedback_OK",n[n.QFeedback_Perfect=5]="QFeedback_Perfect",n[n.Debug1=6]="Debug1",n[n.Debug2=7]="Debug2",n[n.Debug3=8]="Debug3"}(i||(g.NoteState=i={})),function(n){n.C="#d82c6b",n.D="#F89D15",n.E="#FFE21A",n.F="#4dbd5c",n.G="#009D96",n.A="#43469d",n.B="#76429c",n.Rest="#000000"}(o||(g.AutoColorSet=o={}))},242(de,g){var c,l,s;Object.defineProperty(g,"__esModule",{value:!0}),g.PhonicScoreModes=g.MusicSymbolDrawingStyle=g.DrawingMode=void 0,function(u){u[u.All=0]="All",u[u.NoOverlays=1]="NoOverlays",u[u.Leadsheet=2]="Leadsheet"}(c||(g.DrawingMode=c={})),function(u){u[u.Normal=0]="Normal",u[u.Disabled=1]="Disabled",u[u.Selected=2]="Selected",u[u.Clickable=3]="Clickable",u[u.PlaybackSymbols=4]="PlaybackSymbols",u[u.FollowSymbols=5]="FollowSymbols",u[u.QFeedbackNotFound=6]="QFeedbackNotFound",u[u.QFeedbackOk=7]="QFeedbackOk",u[u.QFeedbackPerfect=8]="QFeedbackPerfect",u[u.Debug1=9]="Debug1",u[u.Debug2=10]="Debug2",u[u.Debug3=11]="Debug3"}(l||(g.MusicSymbolDrawingStyle=l={})),function(u){u[u.Following=0]="Following",u[u.Midi=1]="Midi",u[u.Manual=2]="Manual"}(s||(g.PhonicScoreModes=s={}))},3661(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.DrawingParameters=void 0;const l=c(9713),s=c(6362),u=c(4146);g.DrawingParameters=class{constructor(r=u.DrawingParametersEnum.default,i){this.drawCursors=!0,this.drawTitle=!0,this.drawSubtitle=!0,this.drawLyricist=!0,this.drawComposer=!0,this.drawCopyright=!1,this.drawCredits=!0,this.drawPartNames=!0,this.fingeringPosition=s.PlacementEnum.Left,this.drawHiddenNotes=!1,this.rules=i,this.rules||(this.rules=new l.EngravingRules),this.DrawingParametersEnum=r}set DrawingParametersEnum(r){switch(this.drawingParametersEnum=r,r){case u.DrawingParametersEnum.allon:this.setForAllOn();break;case u.DrawingParametersEnum.thumbnail:this.setForThumbnail();break;case u.DrawingParametersEnum.leadsheet:this.setForLeadsheet();break;case u.DrawingParametersEnum.compact:this.setForCompactMode();break;case u.DrawingParametersEnum.compacttight:this.setForCompactTightMode();break;case u.DrawingParametersEnum.default:default:this.setForDefault()}}get DrawingParametersEnum(){return this.drawingParametersEnum}setForAllOn(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.DrawTitle=!0,this.DrawSubtitle=!0,this.DrawComposer=!0,this.DrawLyricist=!0,this.drawCredits=!0,this.DrawPartNames=!0,this.drawHiddenNotes=!0,this.rules.CompactMode=!1}setForDefault(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}setForThumbnail(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}setForCompactMode(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}setForCompactTightMode(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}setForLeadsheet(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawComments=!0,this.drawMarkedAreas=!0}get DrawCredits(){return this.drawCredits}set DrawCredits(r){this.drawCredits=r,this.DrawComposer=r,this.DrawTitle=r,this.DrawSubtitle=r,this.DrawLyricist=r,this.DrawCopyright=r}get DrawTitle(){return this.drawTitle}set DrawTitle(r){this.drawTitle=r,this.rules.RenderTitle=r,r||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(r){this.drawSubtitle=r,this.rules.RenderSubtitle=r,r&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(r){this.drawComposer=r,this.rules.RenderComposer=r}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(r){this.drawLyricist=r,this.rules.RenderLyricist=r}get DrawCopyright(){return this.drawCopyright}set DrawCopyright(r){this.drawCopyright=r,this.rules.RenderCopyright=r}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(r){this.drawPartNames=r,this.rules.RenderPartNames=r,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(r){this.fingeringPosition=r,this.rules.FingeringPosition=r}get Rules(){return this.rules}set Rules(r){this.rules=r}}},9713(de,g,c){var l=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(g,"__esModule",{value:!0}),g.PageFormat=g.EngravingRules=void 0;const s=c(1888),u=l(c(3065)),r=c(7533),i=c(6362),o=c(624),n=c(4434),h=c(3263),t=c(2257),f=c(8233),p=c(9719),m=c(3430);class x{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.RenderCount=0,this.loadDefaultValues()}loadDefaultValues(){this.SamplingUnit=3*x.unit,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.SheetCopyrightHeight=1.5,this.SheetCopyrightMargin=2,this.SheetComposerSubtitleUseLegacyParsing=!1,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.TabStaffInterlineHeightForBboxes=1.3,this.BetweenStaffLinesDistance=x.unit,this.SystemLeftMargin=0,this.SystemRightMargin=0,this.SystemLabelsRightMargin=2,this.SystemComposerDistance=2,this.SystemLyricistDistance=2,this.InstrumentLabelTextHeight=2,this.MinimumDistanceBetweenSystems=7,this.MinSkyBottomDistBetweenSystems=5,this.LastSystemMaxScalingFactor=1.4,this.AutoBeamNotes=!1,this.AutoBeamOptions={beam_middle_rests_only:!1,beam_rests:!1,maintain_stem_directions:!1},this.AutoBeamTabs=!1,this.BeamWidth=x.unit/2,this.BeamSpaceWidth=x.unit/3,this.BeamForwardLength=1.25*x.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionUseXMLDisplayStep=!0,this.PercussionXMLDisplayStepNoteValueShift=0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.PercussionUseCajon2NoteSystem=!1,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.GraceNoteGroupXMargin=0,this.WedgeOpeningLength=1.2,this.WedgeMeasureEndOpeningLength=.75,this.WedgeMeasureBeginOpeningLength=.75,this.WedgePlacementAboveY=-1.5,this.WedgePlacementBelowY=1.5,this.WedgeHorizontalMargin=.6,this.WedgeVerticalMargin=.5,this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges=.3,this.WedgeMinLength=2,this.WedgeEndDistanceBetweenTimestampsFactor=1.75,this.ArticulationAboveNoteForStemUp=!1,this.SoftAccentWedgePadding=.4,this.SoftAccentSizeFactor=.6,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignmentTop=r.TextAlignmentEnum.LeftBottom,this.ChordSymbolTextAlignmentBottom=r.TextAlignmentEnum.LeftTop,this.ChordSymbolBottomMargin=.6,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolExtraXShiftForShortChordSymbols=.3,this.ChordSymbolExtraXShiftWidthThreshold=2,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=.1,this.ChordSymbolYPadding=0,this.ChordSymbolYAlignment=!0,this.ChordSymbolYAlignmentScope="staffline",this.ChordSymbolWholeMeasureRestXOffset=0,this.ChordSymbolWholeMeasureRestXOffsetMeasure1=-2,this.ChordAccidentalTexts=new h.Dictionary,this.resetChordAccidentalTexts(this.ChordAccidentalTexts,!1),this.ChordSymbolLabelTexts=new h.Dictionary,this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts),this.CustomChords=[],this.resetChordNames(),this.RepetitionSymbolsYOffset=0,this.RepetitionEndInstructionXShiftAsPercentOfStaveWidth=.4,this.RehearsalMarkXOffsetDefault=10,this.RehearsalMarkXOffset=0,this.RehearsalMarkXOffsetSystemStartMeasure=-20,this.RehearsalMarkYOffsetDefault=-15,this.RehearsalMarkYOffsetAddedForRehearsalMarks=-12,this.RehearsalMarkYOffset=0,this.RehearsalMarkFontSize=10,this.MeasureNumberLabelHeight=1.5*x.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsRatioedUseXMLValue=!0,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletsBracketedUseXMLValue=!0,this.TupletNumberLabelHeight=1.5*x.unit,this.TupletNumberYOffset=.5,this.TupletNumberLimitConsecutiveRepetitions=!0,this.TupletNumberMaxConsecutiveRepetitions=2,this.TupletNumberAlwaysDisableAfterFirstMax=!0,this.TupletNumberUseShowNoneXMLValue=!0,this.LabelMarginBorderFactor=.1,this.TupletVerticalLineLength=.5,this.TupletNumbersInTabs=!0,this.TabTupletYOffsetBottom=1,this.TabTupletYOffsetTop=-3.5,this.TabTupletYOffsetEffects=1.5,this.TabTupletsBracketed=!0,this.TabBeamsRendered=!0,this.TabKeySignatureRendered=!1,this.TabKeySignatureSpacingAdded=!0,this.TabTimeSignatureRendered=!1,this.TabTimeSignatureSpacingAdded=!0,this.TabFingeringsRendered=!1,this.TabUseXNoteheadShapeForTabNote=!0,this.TabUseXNoteheadAlternativeGlyph=!0,this.TabXNoteheadScale=.9,this.SlurPlacementFromXML=!0,this.SlurPlacementAtStems=!1,this.SlurPlacementUseSkyBottomLine=!1,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.SlurEndArticulationYOffset=.8,this.SlurStartArticulationYOffsetOfArticulation=.5,this.SlurStemXOffset=.3,this.SlurSlopeMaxAngle=15,this.SlurTangentMinAngle=30,this.SlurTangentMaxAngle=80,this.SlurHeightFactor=1,this.SlurHeightFlattenLongSlursFactorByWidth=.24,this.SlurHeightFlattenLongSlursFactorByAngle=.36,this.SlurHeightFlattenLongSlursCutoffAngle=47,this.SlurHeightFlattenLongSlursCutoffWidth=16,this.SlursStartingAtSameStaffEntryYOffset=.8,this.SlurMaximumYControlPointDistance=void 0,this.GlissandoNoteOffset=.5,this.GlissandoStafflineStartMinimumWidth=1,this.GlissandoStafflineStartYDistanceToNote=.8,this.GlissandoStafflineEndOffset=1,this.GlissandoDefaultWidth=.1,this.RepetitionAllowFirstMeasureBeginningRepeatBarline=!0,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.CursorIgnoreRepetitions=!1,this.VoltaOffset=2.5,this.LabelXOffsetForStafflineLeftOverflowCheck=-1.2,this.TempoExpressionTextAlignment=r.TextAlignmentEnum.CenterBottom,this.UnknownExpressionTextAlignment=r.TextAlignmentEnum.CenterBottom,this.LyricsAlignmentStandard=r.TextAlignmentEnum.LeftBottom,this.LyricsHeight=2,this.LyricsYOffsetToStaffHeight=0,this.LyricsYMarginToBottomLine=.2,this.LyricsExtraXShiftForShortLyrics=.5,this.LyricsExtraXShiftForShortLyricsWidthThreshold=1.4,this.LyricsUseXPaddingForLongLyrics=!0,this.LyricsXPaddingFactorForLongLyrics=1,this.LyricsXPaddingWidthThreshold=1.7,this.LyricsXPaddingReductionForLongNotes=.7,this.LyricsXPaddingReductionForLastNoteInMeasure=1.2,this.LyricsXPaddingForLastNoteInMeasure=!0,this.LyricsXPaddingReductionForLastNoteInMeasureCrossMeasureMidWord=1,this.VerticalBetweenLyricsDistance=.5,this.HorizontalBetweenLyricsDistance=.2,this.BetweenSyllableMaximumDistance=10,this.BetweenSyllableMinimumDistance=.5,this.LyricOverlapAllowedIntoNextMeasure=3.4,this.MinimumDistanceBetweenDashes=10,this.MaximumLyricsElongationFactor=2.5,this.TempoYSpacing=.5,this.InstantaneousTempoTextHeight=2.3,this.ContinuousDynamicTextHeight=2.3,this.UseEndOffsetForExpressions=!0,this.MoodTextHeight=2.3,this.UnknownTextHeight=2,this.ContinuousTempoTextHeight=2.3,this.DynamicExpressionMaxDistance=2,this.DynamicExpressionSpacer=.5,this.IgnoreRepeatedDynamics=!1,this.ExpressionsUseXMLColor=!0,this.VexFlowDefaultNotationFontScale=39,this.VexFlowDefaultTabFontScale=39,this.TremoloStrokeScale=1,this.TremoloYSpacingScale=1,this.TremoloBuzzRollThickness=.25,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=x.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=x.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=x.unit,this.OctaveShiftOnWholeMeasureNoteUntilEndOfMeasure=!1,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MultipleRestMeasureAddKeySignature=!0,this.FixedMeasureWidth=!1,this.FixedMeasureWidthFixedValue=void 0,this.FixedMeasureWidthUseForPickupMeasures=!1,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.SheetMaximumWidth=32767,this.VoiceSpacingMultiplierVexflow=.85,this.VoiceSpacingAddendVexflow=3,this.PickupMeasureWidthMultiplier=1,this.PickupMeasureRepetitionSpacing=.8,this.PickupMeasureSpacingSingleNoteAddend=1.6,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=-1,this.SoftmaxFactorVexFlow=15,this.StaggerSameWholeNotes=!0,this.AlignRests=o.AlignRestOption.Never,this.RestCollisionYPadding=0,this.FillEmptyMeasuresWithWholeRest=o.FillEmptyMeasuresWithWholeRests.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.RenderGlissandi=!0,this.ColoringMode=n.ColoringModes.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.applyDefaultColorMusic("#000000"),this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=t.FontStyles.Regular,this.DefaultVexFlowNoteFont="gonville",this.MaxMeasureToDrawIndex=Number.MAX_VALUE,this.MaxMeasureToDrawNumber=Number.MAX_VALUE,this.MinMeasureToDrawIndex=0,this.MinMeasureToDrawNumber=0,this.MaxSystemToDrawNumber=Number.MAX_VALUE,this.MaxPageToDrawNumber=Number.MAX_VALUE,this.RenderComposer=!0,this.RenderTitle=!0,this.RenderSubtitle=!0,this.RenderLyricist=!0,this.RenderCopyright=!1,this.RenderPartNames=!0,this.RenderPartAbbreviations=!0,this.RenderSystemLabelsAfterFirstPage=!0,this.RenderFingerings=!0,this.RenderMeasureNumbers=!0,this.RenderMeasureNumbersOnlyAtSystemStart=!1,this.UseXMLMeasureNumbers=!0,this.RenderLyrics=!0,this.RenderChordSymbols=!0,this.RenderMultipleRestMeasures=!0,this.AutoGenerateMultipleRestMeasuresFromRestMeasures=!0,this.RenderRehearsalMarks=!0,this.RenderClefsAtBeginningOfStaffline=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.RenderFirstTempoExpression=!0,this.RenderPedals=!0,this.RenderWavyLines=!0,this.ArticulationPlacementFromXML=!0,this.BreathMarkDistance=.8,this.FingeringPosition=i.PlacementEnum.AboveOrBelow,this.FingeringPositionFromXML=!0,this.FingeringPositionGrace=i.PlacementEnum.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.FingeringOffsetY=0,this.FingeringPaddingY=-.2,this.FingeringTextSize=1.5,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.NewSystemAtXMLNewPageAttribute=!1,this.RenderXMeasuresPerLineAkaSystem=0,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,this.IgnoreBracketsWords=!0,this.PlaceWordsInsideStafflineFromXml=!1,this.PlaceWordsInsideStafflineYOffset=.9,this.PageFormat=y.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.DarkModeEnabled=!1,this.UsePageBackgroundColorForTabNotes=!0,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new h.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0,this.SkyBottomLineBatchMinMeasures=5,this.SkyBottomLineWebGLMinMeasures=80,this.AlwaysSetPreferredSkyBottomLineBackendAutomatically=!0,this.DisableWebGLInFirefox=!0,this.DisableWebGLInSafariAndIOS=!0,this.setPreferredSkyBottomLineBackendAutomatically(),this.UseInterpolatedTempoForAccelerandoEtc=!1;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(S){u.default.info("EngravingRules()",S)}}setPreferredSkyBottomLineBackendAutomatically(S=-1){var I,T;let M="",E="";typeof globalThis=="object"&&(M=((I=globalThis.navigator)==null?void 0:I.vendor)??"",E=((T=globalThis.navigator)==null?void 0:T.userAgent)??"");let L=!1;(this.DisableWebGLInSafariAndIOS&&/apple/i.test(M)||this.DisableWebGLInFirefox&&E.includes("Firefox"))&&(L=!0),this.PreferredSkyBottomLineBatchCalculatorBackend=o.SkyBottomLineBatchCalculatorBackendType.Plain,L||S>=this.SkyBottomLineWebGLMinMeasures&&(this.PreferredSkyBottomLineBatchCalculatorBackend=o.SkyBottomLineBatchCalculatorBackendType.WebGL)}applyDefaultColorMusic(S){this.DefaultColorMusic=S,this.DefaultColorNotehead=S,this.DefaultColorRest=S,this.DefaultColorStem=S,this.DefaultColorLabel=S,this.DefaultColorLyrics=S,this.DefaultColorTitle=S,this.LedgerLineColorDefault=S}addGraphicalNoteToNoteMap(S,M){S.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(S.NoteToGraphicalNoteObjectId,M),this.NoteToGraphicalNoteMapObjectCount++}GNote(S){return m.GraphicalNote.FromNote(S,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new h.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}resetChordAccidentalTexts(S,M){S.setValue(f.AccidentalEnum.SHARP,M?"♯":"#"),S.setValue(f.AccidentalEnum.FLAT,M?"♭":"b"),S.setValue(f.AccidentalEnum.DOUBLEFLAT,M?"𝄫":"bb"),S.setValue(f.AccidentalEnum.DOUBLESHARP,M?"𝄪":"x")}setChordSymbolLabelText(S,M){this.ChordSymbolLabelTexts.setValue(S,M)}resetChordSymbolLabelTexts(S){return S.setValue(p.ChordSymbolEnum.minor,"m"),S.setValue(p.ChordSymbolEnum.augmented,"aug"),S.setValue(p.ChordSymbolEnum.diminished,"dim"),S.setValue(p.ChordSymbolEnum.dominant,"7"),S.setValue(p.ChordSymbolEnum.majorseventh,"maj7"),S.setValue(p.ChordSymbolEnum.minorseventh,"m7"),S.setValue(p.ChordSymbolEnum.diminishedseventh,"dim7"),S.setValue(p.ChordSymbolEnum.augmentedseventh,"aug7"),S.setValue(p.ChordSymbolEnum.halfdiminished,`m7${this.ChordAccidentalTexts.getValue(f.AccidentalEnum.FLAT)}5`),S.setValue(p.ChordSymbolEnum.majorminor,"m(maj7)"),S.setValue(p.ChordSymbolEnum.majorsixth,"maj6"),S.setValue(p.ChordSymbolEnum.minorsixth,"m6"),S.setValue(p.ChordSymbolEnum.dominantninth,"9"),S.setValue(p.ChordSymbolEnum.majorninth,"maj9"),S.setValue(p.ChordSymbolEnum.minorninth,"m9"),S.setValue(p.ChordSymbolEnum.dominant11th,"11"),S.setValue(p.ChordSymbolEnum.major11th,"maj11"),S.setValue(p.ChordSymbolEnum.minor11th,"m11"),S.setValue(p.ChordSymbolEnum.dominant13th,"13"),S.setValue(p.ChordSymbolEnum.major13th,"maj13"),S.setValue(p.ChordSymbolEnum.minor13th,"m13"),S.setValue(p.ChordSymbolEnum.suspendedsecond,"sus2"),S.setValue(p.ChordSymbolEnum.suspendedfourth,"sus4"),S.setValue(p.ChordSymbolEnum.power,"5"),S.setValue(p.ChordSymbolEnum.none,"N.C."),S}addChordName(S,M,E,L,I){if(p.ChordSymbolEnum[M]!==void 0){const T={adds:E,alts:L,subs:I};this.CustomChords.push(p.CustomChord.createCustomChord(S,p.ChordSymbolEnum[M],T))}}renameChord(S,M){p.CustomChord.renameCustomChord(S,M,this.CustomChords)}resetChordNames(){const S=this.ChordAccidentalTexts.getValue(f.AccidentalEnum.SHARP),M=this.ChordAccidentalTexts.getValue(f.AccidentalEnum.FLAT);this.addChordName("alt","major",[`${S}5`,`${M}9`,`${S}9`],[`${M}5`],[]),this.addChordName("7alt","dominant",[`${S}5`,`${M}9`,`${S}9`],[`${M}5`],[]),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(`m7${M}5`,"minorseventh",[],[`${M}5`],[]),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 S=0;S<this.BezierCurveStepSize;S++){const M=S/this.BezierCurveStepSize;this.TPower3[S]=Math.pow(M,3),this.OneMinusTPower3[S]=Math.pow(1-M,3),this.FactorOne[S]=3*Math.pow(1-M,2)*M,this.FactorTwo[S]=3*(1-M)*Math.pow(M,2)}}}g.EngravingRules=x,x.unit=1;class y{constructor(S,M,E="noIdStringGiven"){this.width=S,this.height=M,this.idString=E}get aspectRatio(){return this.IsUndefined?0:this.width/this.height}get IsUndefined(){return this.width===void 0||this.height===void 0||this.height===0||this.width===0}static get UndefinedPageFormat(){return new y(0,0)}Equals(S){return!!S&&S.width===this.width&&S.height===this.height}}g.PageFormat=y},6659(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalChordSymbolContainer=void 0;const l=c(7435),s=c(8254),u=c(9719),r=c(6438),i=c(7741),o=c(9409),n=c(4980);class h extends i.GraphicalObject{constructor(f,p,m,x,y,d){super(),this.chordSymbolContainer=f,this.boundingBox=new r.BoundingBox(this,p),this.rules=d,this.calculateLabel(m,y,x)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(f,p,m){const x=u.ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,p,m),y=this.GetChordSymbolContainer.Placement===n.PlacementEnum.Above?this.rules.ChordSymbolTextAlignmentTop:this.rules.ChordSymbolTextAlignmentBottom;this.graphicalLabel=new s.GraphicalLabel(new l.Label(x),f,y,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new o.PointF2D(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}}g.GraphicalChordSymbolContainer=h},953(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalComment=void 0,g.GraphicalComment=class{constructor(c,l){this.label=c,this.settings=l}}},1066(de,g,c){var l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalContinuousDynamicExpression=void 0;const s=c(6452),u=c(5875),r=c(9409),i=c(9490),o=c(6362),n=l(c(3065));class h extends i.AbstractGraphicalExpression{constructor(f,p,m){super(p,f,m),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(f){this.startMeasure=f}get EndMeasure(){return this.endMeasure}set EndMeasure(f){this.endMeasure=f}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(f){this.isSplittedPart=f}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(f){this.notToBeRemoved=f}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){var x;const f=this.parentStaffLine.SkyBottomLineCalculator,p=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,m=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsSoftAccent&&!this.IsVerbal&&this.lines.length<2&&n.default.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==u.ContDynamicEnum.crescendo&&this.ContinuousDynamic.DynamicType!==u.ContDynamicEnum.diminuendo&&n.default.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+((x=this.startMeasure)==null?void 0:x.MeasureNumber)),this.Placement){case o.PlacementEnum.Above:if(this.IsSoftAccent)f.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End),f.updateSkyLineWithWedge(this.lines[2].End,this.lines[2].Start),f.updateSkyLineWithLine(this.lines[0].End,this.lines[2].End,this.lines[0].End.y);else if(this.IsVerbal){const y=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;f.updateSkyLineInRange(p,m,y)}else this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.crescendo?f.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.diminuendo&&f.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);break;case o.PlacementEnum.Below:if(this.IsVerbal){const y=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;f.updateBottomLineInRange(p,m,y)}else this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.crescendo?f.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.diminuendo&&f.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);break;default:n.default.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(f,p,m,x=this.rules.WedgeOpeningLength,y=this.rules.WedgeLineWidth){const d=new r.PointF2D(f,m),S=new r.PointF2D(p,m-x/2),M=new r.PointF2D(p,m+x/2);this.addWedgeLines(d,S,M,y)}createFirstHalfCrescendoLines(f,p,m,x=this.rules.WedgeMeasureEndOpeningLength,y=this.rules.WedgeLineWidth){const d=new r.PointF2D(f,m),S=new r.PointF2D(p,m-x/2),M=new r.PointF2D(p,m+x/2);this.addWedgeLines(d,S,M,y)}createSecondHalfCrescendoLines(f,p,m,x=this.rules.WedgeMeasureBeginOpeningLength,y=this.rules.WedgeOpeningLength,d=this.rules.WedgeLineWidth){const S=new r.PointF2D(f,m-x/2),M=new r.PointF2D(f,m+x/2),E=new r.PointF2D(p,m-y/2),L=new r.PointF2D(p,m+y/2);this.addDoubleLines(S,E,M,L,d)}recalculateCrescendoLines(f,p,m){const x=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),x?this.createSecondHalfCrescendoLines(f,p,m):this.isSplittedPart?this.createFirstHalfCrescendoLines(f,p,m):this.createCrescendoLines(f,p,m)}createDiminuendoLines(f,p,m,x=this.rules.WedgeOpeningLength,y=this.rules.WedgeLineWidth){const d=new r.PointF2D(f,m-x/2),S=new r.PointF2D(f,m+x/2),M=new r.PointF2D(p,m);this.addWedgeLines(M,d,S,y)}createFirstHalfDiminuendoLines(f,p,m,x=this.rules.WedgeOpeningLength,y=this.rules.WedgeMeasureEndOpeningLength,d=this.rules.WedgeLineWidth){const S=new r.PointF2D(f,m-x/2),M=new r.PointF2D(f,m+x/2),E=new r.PointF2D(p,m-y/2),L=new r.PointF2D(p,m+y/2);this.addDoubleLines(S,E,M,L,d)}createSecondHalfDiminuendoLines(f,p,m,x=this.rules.WedgeMeasureBeginOpeningLength,y=this.rules.WedgeLineWidth){const d=new r.PointF2D(f,m-x/2),S=new r.PointF2D(f,m+x/2),M=new r.PointF2D(p,m);this.addWedgeLines(M,d,S,y)}recalculateDiminuendoLines(f,p,m){const x=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),x?this.createFirstHalfDiminuendoLines(f,p,m):this.isSplittedPart?this.createSecondHalfDiminuendoLines(f,p,m):this.createDiminuendoLines(f,p,m)}createFirstHalfLines(f,p,m,x=this.rules.WedgeOpeningLength,y=this.rules.WedgeMeasureEndOpeningLength,d=this.rules.WedgeLineWidth){this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.crescendo?this.createFirstHalfCrescendoLines(f,p,m,y,d):this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.diminuendo&&this.createFirstHalfDiminuendoLines(f,p,m,x,y,d)}createSecondHalfLines(f,p,m,x=this.rules.WedgeMeasureBeginOpeningLength,y=this.rules.WedgeOpeningLength,d=this.rules.WedgeLineWidth){this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.crescendo?this.createSecondHalfCrescendoLines(f,p,m,x,y,d):this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.diminuendo&&this.createSecondHalfDiminuendoLines(f,p,m,x,d)}createLines(f,p,m,x=this.rules.WedgeOpeningLength,y=this.rules.WedgeLineWidth){this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.crescendo?this.createCrescendoLines(f,p,m,x,y):this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.diminuendo&&this.createDiminuendoLines(f,p,m,x,y)}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.IsSoftAccent?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[3].Start.x-this.lines[0].Start.x):this.ContinuousDynamic.DynamicType===u.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(f){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=f,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=f,this.lines[0].End.y+=f,this.lines[1].End.y+=f)}squeeze(f){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)<Math.abs(f)||(this.ContinuousDynamic.DynamicType===u.ContDynamicEnum.crescendo?f>0?this.lines[0].Start.x+=f:(this.lines[0].End.x+=f,this.lines[1].End.x+=f):f<0?this.lines[0].Start.x+=f:(this.lines[0].End.x+=f,this.lines[1].End.x+=f),this.calcPsi())}addWedgeLines(f,p,m,x){const y=new s.GraphicalLine(f,p,x),d=new s.GraphicalLine(f,m,x);this.rules.DefaultColorMusic&&(y.colorHex=this.rules.DefaultColorMusic,d.colorHex=this.rules.DefaultColorMusic),this.lines.push(y),this.lines.push(d)}addDoubleLines(f,p,m,x,y){const d=new s.GraphicalLine(f,p,y),S=new s.GraphicalLine(m,x,y);this.rules.DefaultColorMusic&&(d.colorHex=this.rules.DefaultColorMusic,S.colorHex=this.rules.DefaultColorMusic),this.lines.push(d),this.lines.push(S)}}g.GraphicalContinuousDynamicExpression=h},6711(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalCurve=void 0;const l=c(9409);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 r=0;r<s.bezierCurveStepSize;r++){const i=r/s.bezierCurveStepSize;s.tPow3[r]=Math.pow(i,3),s.oneMinusTPow3[r]=Math.pow(1-i,3),s.bezierFactorOne[r]=3*Math.pow(1-i,2)*i,s.bezierFactorTwo[r]=3*(1-i)*Math.pow(i,2)}}calculateCurvePointAtIndex(r){const i=Math.round(r*s.bezierCurveStepSize);return i<0||i>=s.bezierCurveStepSize?new l.PointF2D:new l.PointF2D(s.oneMinusTPow3[i]*this.bezierStartPt.x+s.bezierFactorOne[i]*this.bezierStartControlPt.x+s.bezierFactorTwo[i]*this.bezierEndControlPt.x+s.tPow3[i]*this.bezierEndPt.x,s.oneMinusTPow3[i]*this.bezierStartPt.y+s.bezierFactorOne[i]*this.bezierStartControlPt.y+s.bezierFactorTwo[i]*this.bezierEndControlPt.y+s.tPow3[i]*this.bezierEndPt.y)}}g.GraphicalCurve=s,s.bezierCurveStepSize=1e3},98(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalGlissando=void 0;const l=c(9409),s=c(6438),u=c(6452);g.GraphicalGlissando=class{constructor(r){this.Glissando=r,this.staffEntries=[]}calculateLine(r){const i=this.staffEntries[0],o=this.staffEntries[this.staffEntries.length-1],n=i.findGraphicalNoteFromNote(this.Glissando.StartNote),h=o.findGraphicalNoteFromNote(this.Glissando.EndNote);if(!n&&!h)return;const t=i.parentMeasure.ParentStaffLine;let f,p,m,x;if(n&&i.parentMeasure.ParentStaffLine===this.StaffLine)f=n.PositionAndShape.RelativePosition.x+n.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+n.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x+r.GlissandoNoteOffset,m=n.PositionAndShape.AbsolutePosition.y;else{f=o.parentMeasure.beginInstructionsWidth-.4;const S=this.Glissando.Direction===s.ColDirEnum.Down?-1:1;m=h.PositionAndShape.AbsolutePosition.y+S*r.GlissandoStafflineStartYDistanceToNote}if(h&&o.parentMeasure.ParentStaffLine===this.StaffLine)p=h.PositionAndShape.RelativePosition.x+h.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+h.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x-.5-r.GlissandoNoteOffset,f>p&&(f=p-r.GlissandoStafflineStartMinimumWidth),x=h.PositionAndShape.AbsolutePosition.y;else{if(t.Measures.last().parentSourceMeasure.HasEndLine)return;p=t.PositionAndShape.Size.width,p-f>r.GlissandoStafflineEndOffset&&(f=p-r.GlissandoStafflineEndOffset);const S=this.Glissando.Direction===s.ColDirEnum.Down?1:-1;x=n.PositionAndShape.AbsolutePosition.y+S*r.GlissandoStafflineStartYDistanceToNote}const y=new l.PointF2D(f,m),d=new l.PointF2D(p,x);this.Width===void 0&&(this.Width=r.GlissandoDefaultWidth),this.Line=new u.GraphicalLine(y,d,this.Width)}}},5023(de,g,c){var l=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalInstantaneousDynamicExpression=void 0;const s=c(9490),u=c(6362),r=l(c(3065));class i extends s.AbstractGraphicalExpression{constructor(n,h,t){super(h,n,t.parentSourceMeasure),this.mInstantaneousDynamicExpression=n,this.mMeasure=t}updateSkyBottomLine(){const n=this.parentStaffLine.SkyBottomLineCalculator,h=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,t=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let f=0;switch(this.Placement){case u.PlacementEnum.Above:f=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,n.updateSkyLineInRange(h,t,f);break;case u.PlacementEnum.Below:f=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,n.updateBottomLineInRange(h,t,f);break;default:r.default.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}g.GraphicalInstantaneousDynamicExpression=i},3361(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalInstantaneousTempoExpression=void 0;const l=c(9490);class s extends l.AbstractGraphicalExpression{constructor(r,i){super(i.PositionAndShape.Parent.DataObject,r,r.parentMeasure),this.label=i}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}g.GraphicalInstantaneousTempoExpression=s},8254(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalLabel=void 0;const l=c(7533),s=c(6438),u=c(995),r=c(7921);class i extends u.Clickable{constructor(n,h,t,f,p=void 0){super(),this.CenteringXShift=0,this.label=n,this.boundingBox=new s.BoundingBox(this,p),this.label.fontHeight=h,this.label.textAlignment=t,this.rules=f}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){var x;if(this.Label.text.trim()==="")return;this.TextLines=[];const n=((x=this.rules)==null?void 0:x.LabelMarginBorderFactor)??.1,h=this.Label.text.split(/[\n\r]+/g),t=h.length;let f=0;for(let y=0;y<t;y++){const d=h[y].trim(),S=r.MusicSheetCalculator.TextMeasurer.computeTextWidthToHeightRatio(d,this.Label.font,this.Label.fontStyle,this.label.fontFamily),M=this.Label.fontHeight*S;f=Math.max(f,M),this.TextLines.push({text:d,xOffset:0,width:M})}for(const y of this.TextLines){let d=0;switch(this.Label.textAlignment){case l.TextAlignmentEnum.RightBottom:case l.TextAlignmentEnum.RightCenter:case l.TextAlignmentEnum.RightTop:d=f-y.width;break;case l.TextAlignmentEnum.CenterBottom:case l.TextAlignmentEnum.CenterCenter:case l.TextAlignmentEnum.CenterTop:d=(f-y.width)/2}y.xOffset=d}let p=this.Label.fontHeight*t;this.rules.SpacingBetweenTextLines>0&&this.TextLines.length>1&&(p+=this.rules.SpacingBetweenTextLines*t/10);const m=this.PositionAndShape;switch(this.Label.textAlignment){case l.TextAlignmentEnum.CenterBottom:m.BorderTop=-p,m.BorderLeft=-f/2,m.BorderBottom=0,m.BorderRight=f/2;break;case l.TextAlignmentEnum.CenterCenter:m.BorderTop=-p/2,m.BorderLeft=-f/2,m.BorderBottom=p/2,m.BorderRight=f/2;break;case l.TextAlignmentEnum.CenterTop:m.BorderTop=0,m.BorderLeft=-f/2,m.BorderBottom=p,m.BorderRight=f/2;break;case l.TextAlignmentEnum.LeftBottom:m.BorderTop=-p,m.BorderLeft=0,m.BorderBottom=0,m.BorderRight=f;break;case l.TextAlignmentEnum.LeftCenter:m.BorderTop=-p/2,m.BorderLeft=0,m.BorderBottom=p/2,m.BorderRight=f;break;case l.TextAlignmentEnum.LeftTop:m.BorderTop=0,m.BorderLeft=0,m.BorderBottom=p,m.BorderRight=f;break;case l.TextAlignmentEnum.RightBottom:m.BorderTop=-p,m.BorderLeft=-f,m.BorderBottom=0,m.BorderRight=0;break;case l.TextAlignmentEnum.RightCenter:m.BorderTop=-p/2,m.BorderLeft=-f,m.BorderBottom=p/2,m.BorderRight=0;break;case l.TextAlignmentEnum.RightTop:m.BorderTop=0,m.BorderLeft=-f,m.BorderBottom=p,m.BorderRight=0}m.BorderMarginTop=m.BorderTop-p*n,m.BorderMarginLeft=m.BorderLeft-p*n,m.BorderMarginBottom=m.BorderBottom+p*n,m.BorderMarginRight=m.BorderRight+p*n}}g.GraphicalLabel=i},6452(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalLine=void 0;const l=c(2683);g.GraphicalLine=class{constructor(s,u,r=0,i=l.OutlineAndFillStyleEnum.BaseWritingColor,o=void 0){this.start=s,this.end=u,this.width=r,this.styleId=i,this.colorHex=o}get Start(){return this.start}set Start(s){this.start=s}get End(){return this.end}set End(s){this.end=s}get Width(){return this.width}set Width(s){this.width=s}}},2395(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalLyricEntry=void 0;const l=c(8254),s=c(7435),u=c(9409),r=c(7533);g.GraphicalLyricEntry=class{constructor(i,o,n,h){this.lyricsEntry=i,this.graphicalStaffEntry=o;const t=o.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;i.Text.length>=4&&i.Parent.Notes[0].Length.Denominator>4&&r.TextAlignmentEnum.LeftBottom;const f=new s.Label(i.Text),p=this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules;this.graphicalLabel=new l.GraphicalLabel(f,n,t,p,o.PositionAndShape),this.graphicalLabel.Label.colorDefault=p.DefaultColorLyrics,this.graphicalLabel.PositionAndShape.RelativePosition=new u.PointF2D(0,h),this.graphicalLabel.setLabelPositionAndShapeBorders(),this.graphicalLabel.PositionAndShape.Size.width<p.LyricsExtraXShiftForShortLyricsWidthThreshold&&(this.graphicalLabel.PositionAndShape.RelativePosition.x+=p.LyricsExtraXShiftForShortLyrics,this.graphicalLabel.CenteringXShift=p.LyricsExtraXShiftForShortLyrics),t===r.TextAlignmentEnum.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}hasDashFromLyricWord(){if(!this.ParentLyricWord)return!1;const i=this.ParentLyricWord.GraphicalLyricsEntries.indexOf(this);return this.ParentLyricWord.GraphicalLyricsEntries.length>1&&i<this.ParentLyricWord.GraphicalLyricsEntries.length-1}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(i){this.graphicalLyricWord=i}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(i){this.graphicalLabel=i}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(i){this.graphicalStaffEntry=i}}},7751(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalLyricWord=void 0,g.GraphicalLyricWord=class{constructor(c){this.graphicalLyricsEntries=[],this.lyricWord=c,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(c){this.graphicalLyricsEntries=c}isFilled(){for(let c=0;c<this.graphicalLyricsEntries.length;c++)if(!this.graphicalLyricsEntries[c])return!1;return!0}initialize(){for(let c=0;c<this.lyricWord.Syllables.length;c++)this.graphicalLyricsEntries.push(void 0)}}},1519(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalMarkedArea=void 0,g.GraphicalMarkedArea=class{constructor(c,l=void 0,s=void 0,u=void 0){this.systemRectangle=c,this.labelRectangle=l,this.label=s,this.settings=u}}},5748(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalMeasure=void 0;const l=c(7741),s=c(2561),u=c(6438),r=c(9409);class i extends l.GraphicalObject{constructor(n=void 0,h=void 0,t=void 0){super(),this.hasOnlyRests=!1,this.measureNumber=-1,this.ShowTimeSignature=!0,this.ShowKeySignature=!0,this.isTabMeasure=!1,this.parentStaff=n,this.parentSourceMeasure=h,this.parentStaffLine=t,t?(this.parentStaff=t.ParentStaff,this.PositionAndShape=new u.BoundingBox(this,t.PositionAndShape)):this.PositionAndShape=new u.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(n){this.parentMusicSystem=n}get MeasureNumber(){return this.measureNumber}get FirstInstructionStaffEntry(){return this.firstInstructionStaffEntry}set FirstInstructionStaffEntry(n){this.firstInstructionStaffEntry=n}get LastInstructionStaffEntry(){return this.lastInstructionStaffEntry}set LastInstructionStaffEntry(n){this.lastInstructionStaffEntry=n}get ParentStaffLine(){return this.parentStaffLine}set ParentStaffLine(n){this.parentStaffLine=n,this.parentStaffLine&&(this.PositionAndShape.Parent=this.parentStaffLine.PositionAndShape)}resetLayout(){throw new Error("not implemented")}getLineWidth(n){throw new Error("not implemented")}addClefAtBegin(n){throw new Error("not implemented")}addKeyAtBegin(n,h,t){throw new Error("not implemented")}addRhythmAtBegin(n){throw new Error("not implemented")}addClefAtEnd(n,h=!0){throw new Error("not implemented")}setPositionInStaffline(n){this.PositionAndShape.RelativePosition=new r.PointF2D(n,0)}setWidth(n){this.PositionAndShape.BorderRight=n}layoutSymbols(){throw new Error("not implemented")}findGraphicalStaffEntryFromTimestamp(n){var h;for(let t=0,f=this.staffEntries.length;t<f;++t){const p=this.staffEntries[t];if((h=p.relInMeasureTimestamp)!=null&&h.Equals(n))return p}}findGraphicalStaffEntryFromVerticalContainerTimestamp(n){for(let h=0,t=this.staffEntries.length;h<t;++h){const f=this.staffEntries[h];if(f.sourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp().Equals(n))return f}}hasSameDurationWithSourceMeasureParent(){const n=new s.Fraction(0,1);for(let h=0,t=this.staffEntries.length;h<t;++h){const f=this.staffEntries[h];n.Add(f.findStaffEntryMinNoteLength())}return n.Equals(this.parentSourceMeasure.Duration)}hasMultipleVoices(){if(this.staffEntries.length===0)return!1;const n=[];for(let h=0,t=this.staffEntries.length;h<t;++h){const f=this.staffEntries[h];for(let p=0,m=f.sourceStaffEntry.VoiceEntries.length;p<m;++p){const x=f.sourceStaffEntry.VoiceEntries[p];n.indexOf(x.ParentVoice)<0&&n.push(x.ParentVoice)}}return n.length>1}isVisible(){return this.ParentStaff.isVisible()}isMultiRestMeasure(){return this.multiRestElement!==void 0}getGraphicalMeasureDurationFromStaffEntries(){let n=new s.Fraction(0,1);const h=[];for(let t=0,f=this.staffEntries.length;t<f;++t){const p=this.staffEntries[t];for(let m=0,x=p.sourceStaffEntry.VoiceEntries.length;m<x;++m){const y=p.sourceStaffEntry.VoiceEntries[m];h.indexOf(y.ParentVoice)<0&&h.push(y.ParentVoice)}}for(let t=0,f=h.length;t<f;++t){const p=h[t],m=new s.Fraction(0,1);for(const x of this.staffEntries)for(const y of x.graphicalVoiceEntries)y.parentVoiceEntry.ParentVoice===p&&y.notes.length>0&&m.Add(y.notes[0].graphicalNoteLength);n.lt(m)&&(n=s.Fraction.createFromFraction(m))}return n}addGraphicalStaffEntry(n){this.staffEntries.push(n)}addGraphicalStaffEntryAtTimestamp(n){if(n)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(n.relInMeasureTimestamp))this.staffEntries.push(n);else for(let h=this.staffEntries.length-1;h>=0;h--){if(this.staffEntries[h].relInMeasureTimestamp.lt(n.relInMeasureTimestamp)){this.staffEntries.splice(h+1,0,n);break}h===0&&this.staffEntries.splice(h,0,n)}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1||this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length!==1&&this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}beginsWithLineRepetition(){const n=this.parentSourceMeasure;return!!n&&n.beginsWithLineRepetition()}endsWithLineRepetition(){const n=this.parentSourceMeasure;return!!n&&n.endsWithLineRepetition()}beginsWithWordRepetition(){const n=this.parentSourceMeasure;return!!n&&n.beginsWithWordRepetition()}endsWithWordRepetition(){const n=this.parentSourceMeasure;return!!n&&n.endsWithWordRepetition()}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}g.GraphicalMeasure=i},1888(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.PagePlacementEnum=g.GraphicalMusicPage=void 0;const l=c(6438),s=c(7741),u=c(9409);class r extends s.GraphicalObject{constructor(n){super(),this.musicSystems=[],this.labels=[],this.parent=n,this.boundingBox=new l.BoundingBox(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(n){this.musicSystems=n}get Labels(){return this.labels}set Labels(n){this.labels=n}get Parent(){return this.parent}set Parent(n){this.parent=n}get PageNumber(){return this.pageNumber}set PageNumber(n){this.pageNumber=n}setMusicPageAbsolutePosition(n,h){return new u.PointF2D(0,0)}}var i;g.GraphicalMusicPage=r,function(o){o[o.Down=0]="Down",o[o.Right=1]="Right",o[o.RightDown=2]="RightDown"}(i||(g.PagePlacementEnum=i={}))},8724(de,g,c){var l=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(g,"__esModule",{value:!0}),g.SystemImageProperties=g.GraphicalMusicSheet=void 0;const s=c(6723),u=c(6452),r=c(348),i=c(9409),o=c(164),n=c(4543),h=c(2561),t=c(6438),f=l(c(3065)),p=c(813),m=c(4548),x=c(7741);g.GraphicalMusicSheet=class{constructor(y,d){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=y,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=d,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get MusicPages(){return this.musicPages}set MusicPages(y){this.musicPages=y}get MeasureList(){return this.measureList}set MeasureList(y){this.measureList=y}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(y){this.verticalGraphicalStaffEntryContainers=y}get Title(){return this.title}set Title(y){this.title=y}get Subtitle(){return this.subtitle}set Subtitle(y){this.subtitle=y}get Composer(){return this.composer}set Composer(y){this.composer=y}get Lyricist(){return this.lyricist}set Lyricist(y){this.lyricist=y}get Copyright(){return this.copyright}set Copyright(y){this.copyright=y}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(y){this.minAllowedSystemWidth=y}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(y){this.leadSheet=y}static transformRelativeToAbsolutePosition(y){for(let d=0;d<y.MusicPages.length;d++){const S=y.MusicPages[d].setMusicPageAbsolutePosition(d,y.ParentMusicSheet.Rules);y.MusicPages[d].PositionAndShape.calculateAbsolutePositionsRecursive(S.x,S.y)}}Initialize(){this.verticalGraphicalStaffEntryContainers=[],this.musicPages=[],this.measureList=[]}reCalculate(){this.calculator.calculate()}EnforceRedrawOfMusicSystems(){for(let y=0,d=this.musicPages.length;y<d;++y){const S=this.musicPages[y];for(let M=0,E=S.MusicSystems.length;M<E;++M)S.MusicSystems[M].needsToBeRedrawn=!0}}getClickedObject(y){for(let d=0,S=this.MusicPages.length;d<S;++d)return this.MusicPages[d].PositionAndShape.getClickedObjectOfType(y)}findGraphicalMeasure(y,d){var S;for(let M=y;M>=0;M--){const E=(S=this.measureList[M])==null?void 0:S[d];if(E)return E}}findGraphicalMeasureByMeasureNumber(y,d){for(let S=y;S>=0;S--)if(this.MeasureList[S]){const M=this.MeasureList[S][d];if((M==null?void 0:M.MeasureNumber)===y)return M}}findGraphicalStaffEntryFromMeasureList(y,d,S){for(let M=d;M<this.measureList.length;M++){const E=this.measureList[M][y];if(E)for(let L=0,I=E.staffEntries.length;L<I;++L){const T=E.staffEntries[L];if(T.sourceStaffEntry===S)return T}}}findNextGraphicalStaffEntry(y,d,S){const M=S.parentMeasure,E=M.staffEntries.indexOf(S);if(E<M.staffEntries.length-1)return M.staffEntries[E+1];if(d<this.measureList.length-1){const L=this.measureList[d+1][y];if(L.staffEntries.length>0)return L.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(y,d){const S=[],M=this.measureList[0].length;for(let E=y;E<=d;E++)for(let L=0;L<M;L++)if(this.measureList[E][L].isVisible()){S.push(this.measureList[E][L]);break}return S}orderMeasuresByStaffLine(y){const d=[];let S=[];d.push(S);for(let M=0;M<y.length;M++)M===0?S.push(y[0]):(y[M].ParentStaffLine===y[M-1].ParentStaffLine||(d.indexOf(S)===-1&&d.push(S),S=[],d.push(S)),S.push(y[M]));return d}initializeActiveClefs(){const y=[],d=this.musicSheet.getFirstSourceMeasure();if(d)for(let S=0;S<d.CompleteNumberOfStaves;S++){let M=new o.ClefInstruction;if(d.FirstInstructionsStaffEntries[S])for(let E=0,L=d.FirstInstructionsStaffEntries[S].Instructions.length;E<L;++E){const I=d.FirstInstructionsStaffEntries[S].Instructions[E];I instanceof o.ClefInstruction&&(M=I)}y.push(M)}return y}GetMainKey(){const y=this.musicSheet.getFirstSourceMeasure();if(y)for(let d=0;d<y.CompleteNumberOfStaves;d++)for(let S=0,M=y.FirstInstructionsStaffEntries[d].Instructions.length;S<M;++S){const E=y.FirstInstructionsStaffEntries[d].Instructions[S];if(E instanceof n.KeyInstruction)return E}}getOrCreateVerticalContainer(y){if(this.verticalGraphicalStaffEntryContainers.length===0||p.CollectionUtil.getLastElement(this.verticalGraphicalStaffEntryContainers).AbsoluteTimestamp.lt(y)){const d=new s.VerticalGraphicalStaffEntryContainer(this.numberOfStaves,y);return this.verticalGraphicalStaffEntryContainers.push(d),d}for(let d=this.verticalGraphicalStaffEntryContainers.length-1;d>=0;d--){if(this.verticalGraphicalStaffEntryContainers[d].AbsoluteTimestamp.lt(y)){const S=new s.VerticalGraphicalStaffEntryContainer(this.numberOfStaves,y);return this.verticalGraphicalStaffEntryContainers.splice(d+1,0,S),S}if(this.verticalGraphicalStaffEntryContainers[d].AbsoluteTimestamp.Equals(y))return this.verticalGraphicalStaffEntryContainers[d]}}GetVerticalContainerFromTimestamp(y,d=0){const S=p.CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new s.VerticalGraphicalStaffEntryContainer(0,y),s.VerticalGraphicalStaffEntryContainer.compareByTimestamp,d);if(S>=0)return this.verticalGraphicalStaffEntryContainers[S]}GetInterpolatedIndexInVerticalContainers(y){const d=this.verticalGraphicalStaffEntryContainers;if(d.length===1)return 0;let S,M,E=0,L=d.length-1;if(y.lte(d[d.length-1].AbsoluteTimestamp)){for(;L-E>1;){const A=Math.floor((L+E)/2);if(d[E].AbsoluteTimestamp.Equals(y)){L=E;break}if(d[L].AbsoluteTimestamp.Equals(y)){E=L;break}if(d[A].AbsoluteTimestamp.Equals(y))return this.verticalGraphicalStaffEntryContainers.indexOf(d[A]);y.lt(d[A].AbsoluteTimestamp)?L=A:E=A}if(E===L)return this.verticalGraphicalStaffEntryContainers.indexOf(d[E]);S=d[E].AbsoluteTimestamp,M=d[L].AbsoluteTimestamp}else S=d[d.length-1].AbsoluteTimestamp,M=h.Fraction.plus(this.getLongestStaffEntryDuration(d.length-1),S),L=d.length;const I=M.RealValue-S.RealValue,T=L-(M.RealValue-y.RealValue)/I;return Math.min(T,this.verticalGraphicalStaffEntryContainers.length-1)}getVisibleStavesIndicesFromSourceMeasure(y){const d=[],S=[];for(let M=0,E=y.length;M<E;++M){const L=y[M].ParentStaff.ParentInstrument;d.indexOf(L)===-1&&d.push(L)}for(let M=0,E=d.length;M<E;++M){const L=d[M],I=this.musicSheet.getGlobalStaffIndexOfFirstStaff(L);for(let T=0;T<L.Staves.length;T++)S.push(I+T)}return S}getGraphicalMeasureFromSourceMeasureAndIndex(y,d){var S;for(let M=0;M<this.measureList.length;M++)if(((S=this.measureList[M][0])==null?void 0:S.parentSourceMeasure)===y)return this.measureList[M][d]}getLastGraphicalMeasureFromIndex(y,d=!0){let S=this.measureList.length-1;d&&(S=Math.min(S,this.musicSheet.Rules.MaxMeasureToDrawIndex));let M=this.measureList[S][y];for(;!M&&S>=0;)M=this.measureList[--S][y];return this.measureList[S][y]}getMeasureIndex(y,d,S){for(d=0;d<this.measureList.length;d++)for(let M=0,E=this.measureList[d].length;M<E;++M)if(this.measureList[d][M]===y)return!0;return!1}GetNearestGraphicalObject(y,d=x.GraphicalObject.name,S=5,M=20,E=5,L=void 0){const I=[];for(;I.length===0&&S<=M;){const A=new t.BoundingBox(void 0);A.BorderLeft=y.x-S,A.BorderTop=y.y-S,A.BorderRight=y.x+S,A.BorderBottom=y.y+S,A.AbsolutePosition=new i.PointF2D(y.x,y.y),A.calculateAbsolutePosition();for(let v=0,B=this.MusicPages.length;v<B;++v){const D=this.MusicPages[v].PositionAndShape.getObjectsInRegion(A,!1,d);if(D&&D.length!==0)for(let _=0,F=D.length;_<F;++_)L?L(D[_])&&I.push(D[_]):I.push(D[_])}S+=E}let T;for(let A=0,v=I.length;A<v;++A){const B=I[A];(T===void 0||this.CalculateDistance(B.PositionAndShape.AbsolutePosition,y)<this.CalculateDistance(T.PositionAndShape.AbsolutePosition,y))&&(T=B)}if(T)return T}GetNearestVoiceEntry(y){return this.GetNearestGraphicalObject(y,m.GraphicalVoiceEntry.name,5,20,5,d=>{var S;return((S=d.parentStaffEntry)==null?void 0:S.relInMeasureTimestamp)!==void 0})}GetNearestNote(y,d){const S=this.GetNearestVoiceEntry(y);if(!S)return;let M,E=Number.MAX_SAFE_INTEGER;for(const L of S.notes){const I=L.PositionAndShape.AbsolutePosition.y,T=Math.abs(L.PositionAndShape.AbsolutePosition.x-y.x),A=Math.abs(I-y.y);T+A<E&&(M=L,E=T+A)}return M}domToSvg(y){return this.domToSvgTransform(y,!0)}svgToDom(y){return this.domToSvgTransform(y,!1)}svgToOsmd(y){const d=new i.PointF2D(y.x,y.y);return d.x/=10,d.y/=10,d}domToSvgTransform(y,d){const S=this.drawer.Backends[0].getSvgElement(),M=S.createSVGPoint();M.x=y.x,M.y=y.y;let E=S.getScreenCTM();d&&(E=E.inverse());const L=M.matrixTransform(E);return new i.PointF2D(L.x,L.y)}GetClickableLabel(y){const d=new t.BoundingBox;d.BorderLeft=y.x-4,d.BorderTop=y.y-4,d.BorderRight=y.x+4,d.BorderBottom=y.y+4,d.AbsolutePosition=new i.PointF2D(0,0);for(let S=0,M=this.MusicPages.length;S<M;++S){const E=this.MusicPages[S].PositionAndShape.getObjectsInRegion(d);if(E.length===1)for(let L=0,I=E.length;L<I;++L)return E[L]}}GetNearestStaffEntry(y){const d=[],S=new t.BoundingBox(void 0);S.BorderLeft=y.x-10,S.BorderTop=y.y-10,S.BorderRight=y.x+10,S.BorderBottom=y.y+10,S.AbsolutePosition=new i.PointF2D(0,0);for(let E=0,L=this.MusicPages.length;E<L;++E){const I=this.MusicPages[E].PositionAndShape.getObjectsInRegion(S,!1,r.GraphicalStaffEntry.name);if(I&&I.length!==0)for(let T=0,A=I.length;T<A;++T){const v=I[T];d.push(v)}}let M;for(let E=0,L=d.length;E<L;++E){const I=d[E];if(M===void 0)M=I;else{if(!I.relInMeasureTimestamp)continue;this.CalculateDistance(I.PositionAndShape.AbsolutePosition,y)<this.CalculateDistance(M.PositionAndShape.AbsolutePosition,y)&&(M=I)}}if(M)return M}GetNearestObject(y,d){const S=[],M=new t.BoundingBox(void 0);M.BorderLeft=y.x-10,M.BorderTop=y.y-10,M.BorderRight=y.x+10,M.BorderBottom=y.y+10,M.AbsolutePosition=new i.PointF2D(0,0);for(let L=0,I=this.MusicPages.length;L<I;++L){const T=this.MusicPages[L].PositionAndShape.getObjectsInRegion(M,!1,d);if(T&&T.length!==0)for(let A=0,v=T.length;A<v;++A){const B=T[A];S.push(B)}}let E;for(let L=0,I=S.length;L<I;++L){const T=S[L];(E===void 0||this.CalculateDistance(T.PositionAndShape.AbsolutePosition,y)<this.CalculateDistance(E.PositionAndShape.AbsolutePosition,y))&&(E=T)}if(E)return E}GetPossibleCommentAnchor(y){const d=this.GetNearestStaffEntry(y);if(d)return d.sourceStaffEntry}getClickedObjectOfType(y){for(let d=0,S=this.musicPages.length;d<S;++d){const M=this.musicPages[d].PositionAndShape.getClickedObjectOfType(y);if(M)return M}}tryGetTimestampFromPosition(y){const d=this.getClickedObjectOfType(y);if(d)return d.getAbsoluteTimestamp()}tryGetClickableLabel(y){try{return this.GetClickableLabel(y)}catch(d){f.default.info("GraphicalMusicSheet.tryGetClickableObject","positionOnMusicSheet: "+y,d)}}tryGetTimeStampFromPosition(y){try{const d=this.GetNearestStaffEntry(y);return d?d.getAbsoluteTimestamp():void 0}catch(d){f.default.info("GraphicalMusicSheet.tryGetTimeStampFromPosition","positionOnMusicSheet: "+y,d)}}getStaffEntry(y){const d=this.VerticalGraphicalStaffEntryContainers[y];let S;try{for(let M=0,E=d.StaffEntries.length;M<E;++M){const L=d.StaffEntries[M];L&&L.sourceStaffEntry.ParentStaff.isVisible()&&(S?L.PositionAndShape&&S.PositionAndShape&&S.PositionAndShape.RelativePosition.x>L.PositionAndShape.RelativePosition.x&&(S=L):S=L)}}catch(M){f.default.info("GraphicalMusicSheet.getStaffEntry",M)}return S}GetPreviousVisibleContainerIndex(y){for(let d=y-1;d>=0;d--){const S=this.verticalGraphicalStaffEntryContainers[d].StaffEntries;for(let M=0,E=S.length;M<E;++M){const L=S[M];if(L&&L.sourceStaffEntry.ParentStaff.isVisible())return d}}return-1}GetNextVisibleContainerIndex(y){for(let d=y+1;d<this.verticalGraphicalStaffEntryContainers.length;++d){const S=this.verticalGraphicalStaffEntryContainers[d].StaffEntries;for(let M=0,E=S.length;M<E;++M){const L=S[M];if(L&&L.sourceStaffEntry.ParentStaff.isVisible())return d}}return-1}findClosestLeftStaffEntry(y,d){let S,M=Math.floor(y);M=Math.min(this.VerticalGraphicalStaffEntryContainers.length-1,M);for(let E=M;E>=0;E--)if(S=this.getStaffEntry(E),S&&(!d||S.sourceStaffEntry.ParentStaff.isVisible()))return S}findClosestRightStaffEntry(y,d){let S;for(let M=Math.max(0,Math.ceil(y));M<this.VerticalGraphicalStaffEntryContainers.length;M++)if(S=this.getStaffEntry(M),S&&(!d||S.sourceStaffEntry.ParentStaff.isVisible()))return S}calculateCursorLineAtTimestamp(y,d){const S=this.calculateXPositionFromTimestamp(y),M=S[0],E=S[1];if(!E||E.StaffLines.length===0)return;const L=E.PositionAndShape.AbsolutePosition.y,I=p.CollectionUtil.last(E.StaffLines).PositionAndShape.RelativePosition.y+4;return new u.GraphicalLine(new i.PointF2D(M,L),new i.PointF2D(M,L+I),3,d)}calculateXPositionFromTimestamp(y){var A,v,B,D;let d;const S=this.GetInterpolatedIndexInVerticalContainers(y),M=this.findClosestLeftStaffEntry(S,!0),E=this.findClosestRightStaffEntry(S,!0),L=y.RealValue;if(!M&&!E)return[0,void 0];let I,T;if(I=M?(A=M.parentMeasure.ParentStaffLine)==null?void 0:A.ParentMusicSystem:(v=E.parentMeasure.ParentStaffLine)==null?void 0:v.ParentMusicSystem,T=E?(B=E.parentMeasure.ParentStaffLine)==null?void 0:B.ParentMusicSystem:(D=M.parentMeasure.ParentStaffLine)==null?void 0:D.ParentMusicSystem,I===T){let _,F,k;if(d=I,M)if(E)F=M.PositionAndShape.AbsolutePosition.x,k=E.PositionAndShape.AbsolutePosition.x,_=M===E?0:(L-M.getAbsoluteTimestamp().RealValue)/(E.getAbsoluteTimestamp().RealValue-M.getAbsoluteTimestamp().RealValue);else{F=M.PositionAndShape.AbsolutePosition.x,k=d.GetRightBorderAbsoluteXPosition();const j=M.parentMeasure.parentSourceMeasure;_=(L-M.getAbsoluteTimestamp().RealValue)/(h.Fraction.plus(j.AbsoluteTimestamp,j.Duration).RealValue-M.getAbsoluteTimestamp().RealValue)}else F=k=E.PositionAndShape.AbsolutePosition.x,_=0;return _=Math.min(1,Math.max(0,_)),[F+_*(k-F),d]}{const _=E.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.RealValue;let F,k;if(L<_&&I.StaffLines[0]){d=I;const j=M.PositionAndShape.AbsolutePosition.x,P=d.GetRightBorderAbsoluteXPosition();F=(L-M.getAbsoluteTimestamp().RealValue)/(_-M.getAbsoluteTimestamp().RealValue),F=Math.min(1,Math.max(0,F)),k=j+F*(P-j)}else{d=T;const j=E.PositionAndShape.AbsolutePosition.x,P=d.GetLeftBorderAbsoluteXPosition();F=(L-_)/(E.getAbsoluteTimestamp().RealValue-_),F=Math.min(1,Math.max(0,F)),k=P+F*(j-P)}return[k,d]}}GetNumberOfVisibleInstruments(){let y=0;for(let d=0,S=this.musicSheet.Instruments.length;d<S;++d)this.musicSheet.Instruments[d].isVisible()&&y++;return y}GetNumberOfFollowedInstruments(){let y=0;for(let d=0,S=this.musicSheet.Instruments.length;d<S;++d)this.musicSheet.Instruments[d].Following===!0&&y++;return y}GetGraphicalFromSourceStaffEntry(y){var S;if(!((S=y.VerticalContainerParent.ParentMeasure)!=null&&S.VerticalMeasureList))return;const d=y.VerticalContainerParent.ParentMeasure.VerticalMeasureList[y.ParentStaff.idInMusicSheet];return d==null?void 0:d.findGraphicalStaffEntryFromTimestamp(y.Timestamp)}CalculateDistance(y,d){const S=y.x-d.x,M=y.y-d.y;return S*S+M*M}getLongestStaffEntryDuration(y){let d=new h.Fraction(0,1);for(const S of this.verticalGraphicalStaffEntryContainers[y].StaffEntries){if(!S)continue;const M=S.findStaffEntryMaxNoteLength();d.lt(M)&&(d=M)}return d}},g.SystemImageProperties=class{}},3430(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalNote=void 0;const l=c(8233),s=c(7741),u=c(7921),r=c(6438);class i extends s.GraphicalObject{constructor(n,h,t,f=void 0){super(),this.DrawnAccidental=l.AccidentalEnum.NONE,this.lineShift=0,this.sourceNote=n,this.parentVoiceEntry=h,this.PositionAndShape=new r.BoundingBox(this,h.PositionAndShape),this.graphicalNoteLength=f||n.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=t,this.rules.addGraphicalNoteToNoteMap(n,this)}Transpose(n,h,t,f){let p=this.sourceNote.Pitch;return u.MusicSheetCalculator.transposeCalculator&&(p=u.MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,n,t)),p}calculateNumberOfNeededDots(n){return this.sourceNote&&this.sourceNote.NoteTuplet?0:n.calculateNumberOfNeededDots()}get ParentMusicPage(){var n;return(n=this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem)==null?void 0:n.Parent}static FromNote(n,h){return h.NoteToGraphicalNoteMap.getValue(n.NoteToGraphicalNoteObjectId)}ToStringShort(n=0){var h;return(h=this.sourceNote)==null?void 0:h.ToStringShort(n)}get ToStringShortGet(){return this.ToStringShort(0)}getLyricsSVGs(){var h;const n=[];if(!this.parentVoiceEntry)return n;for(const t of this.parentVoiceEntry.parentStaffEntry.LyricsEntries)n.push((h=t.GraphicalLabel)==null?void 0:h.SVGNode);return n}setColor(n,h){}setVisible(n,h={}){}}g.GraphicalNote=i},7741(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalObject=void 0;const l=c(7791);class s extends l.AClassHierarchyTrackable{get PositionAndShape(){return this.boundingBox}set PositionAndShape(r){this.boundingBox=r}}g.GraphicalObject=s},2768(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalOctaveShift=void 0;const l=c(7741),s=c(437),u=c(6438),r=c(512),i=c(7307);class o extends l.GraphicalObject{constructor(h,t){super(),this.getOctaveShift=h,this.setSymbol(),this.PositionAndShape=new u.BoundingBox(this,t)}setSymbol(){switch(this.getOctaveShift.Type){case s.OctaveEnum.VA8:this.octaveSymbol=r.MusicSymbol.VA8;break;case s.OctaveEnum.VB8:this.octaveSymbol=r.MusicSymbol.VB8;break;case s.OctaveEnum.MA15:this.octaveSymbol=r.MusicSymbol.MA15;break;case s.OctaveEnum.MB15:this.octaveSymbol=r.MusicSymbol.MB15;break;default:throw new i.ArgumentOutOfRangeException("")}}}g.GraphicalOctaveShift=o},7824(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalPedal=void 0;const l=c(7741),s=c(6438),u=c(512);class r extends l.GraphicalObject{constructor(o,n){super(),this.getPedal=o,this.setSymbol(),this.PositionAndShape=new s.BoundingBox(this,n)}setSymbol(){!this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=u.MusicSymbol.PEDAL_SYMBOL:this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=u.MusicSymbol.PEDAL_MIXED:this.pedalSymbol=u.MusicSymbol.PEDAL_BRACKET}}g.GraphicalPedal=r},973(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalRectangle=void 0;const l=c(6438),s=c(7741);class u extends s.GraphicalObject{constructor(i,o,n,h){super(),this.boundingBox=new l.BoundingBox(this,n),this.boundingBox.RelativePosition=i,this.boundingBox.BorderRight=o.x-i.x,this.boundingBox.BorderBottom=o.y-i.y,this.style=h}}g.GraphicalRectangle=u},4022(de,g,c){var l=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalSlur=void 0;const s=c(9409),u=c(6711),r=c(6362),i=c(6904),o=c(4249),n=c(2561),h=c(1336);var t=l(c(3206)).default.Flow;class f extends u.GraphicalCurve{constructor(m,x){super(),this.staffEntries=[],this.slur=m,this.rules=x}static Compare(m,x){if(m.staffEntries.length<1)return-1;if(x.staffEntries.length<1)return 1;const y=n.Fraction.minus(m.staffEntries[m.staffEntries.length-1].getAbsoluteTimestamp(),m.staffEntries[0].getAbsoluteTimestamp()),d=n.Fraction.minus(x.staffEntries[x.staffEntries.length-1].getAbsoluteTimestamp(),x.staffEntries[0].getAbsoluteTimestamp());return y.RealValue>d.RealValue?1:d.RealValue>y.RealValue?-1:0}calculateCurve(m){const x=this.staffEntries[0],y=this.staffEntries[this.staffEntries.length-1];let d=x.findGraphicalNoteFromNote(this.slur.StartNote);!d&&this.graceStart&&(d=x.findGraphicalNoteFromGraceNote(this.slur.StartNote)),d||(d=x.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let S=y.findGraphicalNoteFromNote(this.slur.EndNote);!S&&this.graceEnd&&(S=y.findGraphicalNoteFromGraceNote(this.slur.EndNote));const M=x.parentMeasure.ParentStaffLine,E=M.SkyBottomLineCalculator;this.calculatePlacement(E,M);const L=this.calculateStartAndEnd(d,S,M,m,E),I=L.startX,T=L.endX;let A=L.startY,v=L.endY;const B=m.SlurTangentMinAngle,D=m.SlurTangentMaxAngle;let _;if(this.placement===r.PlacementEnum.Above){A-=m.SlurNoteHeadYOffset,v-=m.SlurNoteHeadYOffset;const F=new s.PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,A);d?F.x+=this.staffEntries[0].PositionAndShape.BorderRight:F.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(F.x+=y.PositionAndShape.RelativePosition.x);const k=new s.PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,v);if(S?k.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:k.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(k.x+=y.staffEntryParent.PositionAndShape.RelativePosition.x),_=this.calculateTopPoints(F,k,M,E),_.length===0){const Se=new s.PointF2D((k.x-F.x)/2+F.x,(k.y-F.y)/2+F.y);_.push(Se)}const j=Math.atan((v-A)/(T-I)),P=new s.PointF2D(0,0);let G=new s.PointF2D(T-I,-(v-A));const Y=i.Matrix2D.getRotationMatrix(j),X=Y.getTransposeMatrix();G=Y.vectorMultiplication(G);const ie=this.calculateTranslatedAndRotatedPointListAbove(_,I,A,Y),oe=this.calculateMaxLeftSlope(ie,P,G),$=this.calculateMaxRightSlope(ie,P,G),Q=P.y-P.x*oe,ne=G.y-G.x*$,ee=new s.PointF2D;let N=!1;Math.abs(Math.abs(oe)-Math.abs($))<1e-4?(ee.x=G.x/2,ee.y=0,N=!0):(ee.x=(ne-Q)/(oe-$),ee.y=oe*ee.x+Q);const R=this.calculateHeightWidthRatio(G.x,ie),O=0,U=0;let H=B,W=-B;if(!N){const Se=this.calculateAngles(B,oe,$,D);H=Se.startAngle,W=Se.endAngle}const K=this.calculateControlPoints(G.x,H,W,ie,R,A,v);let q=K.startControlPoint,te=K.endControlPoint;q=X.vectorMultiplication(q),q.x+=I,q.y=-q.y+A,te=X.vectorMultiplication(te),te.x+=I,te.y=-te.y+A,this.bezierStartPt=new s.PointF2D(I,A-O),this.bezierStartControlPt=new s.PointF2D(q.x,q.y-O),this.bezierEndControlPt=new s.PointF2D(te.x,te.y-U),this.bezierEndPt=new s.PointF2D(T,v-U);const se=M.SkyLine.length,ue=E.getLeftIndexForPointX(this.bezierStartPt.x,se),fe=E.getLeftIndexForPointX(this.bezierEndPt.x,se),xe=this.bezierEndPt.x-this.bezierStartPt.x,ve=E.SamplingUnit;for(let Se=ue;Se<fe;Se++){const ye=Se/ve-this.bezierStartPt.x,be=this.calculateCurvePointAtIndex(Math.abs(ye)/xe);let Me=E.getLeftIndexForPointX(be.x,se);Me>=ue&&(M.SkyLine[Me]=Math.min(M.SkyLine[Me],be.y)),Me++,Me<se&&(M.SkyLine[Me]=Math.min(M.SkyLine[Me],be.y))}}else{A+=m.SlurNoteHeadYOffset,v+=m.SlurNoteHeadYOffset;const F=new s.PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,A);d?F.x+=this.staffEntries[0].PositionAndShape.BorderRight:F.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(F.x+=y.PositionAndShape.RelativePosition.x);const k=new s.PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,v);if(S?k.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:k.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(k.x+=y.staffEntryParent.PositionAndShape.RelativePosition.x),_=this.calculateBottomPoints(F,k,M,E),_.length===0){const Se=new s.PointF2D((k.x-F.x)/2+F.x,(k.y-F.y)/2+F.y);_.push(Se)}const j=Math.atan((v-A)/(T-I)),P=new s.PointF2D(0,0);let G=new s.PointF2D(T-I,v-A);const Y=i.Matrix2D.getRotationMatrix(-j),X=Y.getTransposeMatrix();G=Y.vectorMultiplication(G);const ie=this.calculateTranslatedAndRotatedPointListBelow(_,I,A,Y),oe=this.calculateMaxLeftSlope(ie,P,G),$=this.calculateMaxRightSlope(ie,P,G),Q=P.y-P.x*oe,ne=G.y-G.x*$,ee=new s.PointF2D;let N=!1;Math.abs(Math.abs(oe)-Math.abs($))<1e-4?(ee.x=G.x/2,ee.y=0,N=!0):(ee.x=(ne-Q)/(oe-$),ee.y=oe*ee.x+Q);const R=this.calculateHeightWidthRatio(G.x,ie),O=0,U=0;let H=B,W=-B;if(!N){const Se=this.calculateAngles(B,oe,$,D);H=Se.startAngle,W=Se.endAngle}const K=this.calculateControlPoints(G.x,H,W,ie,R,A,v);let q=K.startControlPoint,te=K.endControlPoint;q=X.vectorMultiplication(q),q.x+=I,q.y+=A,te=X.vectorMultiplication(te),te.x+=I,te.y+=A,this.bezierStartPt=new s.PointF2D(I,A+O),this.bezierStartControlPt=new s.PointF2D(q.x,q.y+O),this.bezierEndControlPt=new s.PointF2D(te.x,te.y+U),this.bezierEndPt=new s.PointF2D(T,v+U);const se=M.BottomLine.length,ue=E.getLeftIndexForPointX(this.bezierStartPt.x,se),fe=E.getLeftIndexForPointX(this.bezierEndPt.x,se),xe=this.bezierEndPt.x-this.bezierStartPt.x,ve=E.SamplingUnit;for(let Se=ue;Se<fe;Se++){const ye=Se/ve-this.bezierStartPt.x,be=this.calculateCurvePointAtIndex(Math.abs(ye)/xe);let Me=E.getLeftIndexForPointX(be.x,se);Me>=ue&&(M.BottomLine[Me]=Math.max(M.BottomLine[Me],be.y)),Me++,Me<se&&(M.BottomLine[Me]=Math.max(M.BottomLine[Me],be.y))}}}calculateStartAndEnd(m,x,y,d,S){let M=0,E=0,L=0,I=0;if(m){M=m.PositionAndShape.RelativePosition.x+m.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+m.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceStart&&(M+=m.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);const T=m.parentVoiceEntry;this.placement===r.PlacementEnum.Above?(E=T.PositionAndShape.RelativePosition.y+T.PositionAndShape.BorderTop,this.rules.SlurPlacementUseSkyBottomLine&&(E=Math.min(I,T.parentStaffEntry.getSkylineMin()))):(E=T.PositionAndShape.RelativePosition.y+T.PositionAndShape.BorderBottom,this.rules.SlurPlacementUseSkyBottomLine&&(E=Math.max(I,T.parentStaffEntry.getBottomlineMax()))),T.parentVoiceEntry.StemDirection===h.StemDirectionType.Down&&this.placement===r.PlacementEnum.Below&&(M-=.5),T.parentVoiceEntry.StemDirection===h.StemDirectionType.Up&&this.placement===r.PlacementEnum.Above&&(M+=.5)}else M=0;if(x){L=x.PositionAndShape.RelativePosition.x+x.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+x.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceEnd&&(L+=x.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);const T=x.parentVoiceEntry;let A;for(const v of T.parentVoiceEntry.Articulations)if(A=v.placement,v.placement===r.PlacementEnum.NotYetDefined){for(const B of x.vfnote[0].modifiers)if(B.getCategory()===t.Articulation.CATEGORY){B.position===t.Modifier.Position.ABOVE?(v.placement=r.PlacementEnum.Above,A=r.PlacementEnum.Above):B.position===t.Modifier.Position.BELOW&&(v.placement=r.PlacementEnum.Below,A=r.PlacementEnum.Below);break}}this.placement===r.PlacementEnum.Above?(I=T.PositionAndShape.RelativePosition.y+T.PositionAndShape.BorderTop,this.rules.SlurPlacementUseSkyBottomLine&&(I=Math.min(I,T.parentStaffEntry.getSkylineMin())),A===r.PlacementEnum.Above&&(I-=this.rules.SlurEndArticulationYOffset)):(I=T.PositionAndShape.RelativePosition.y+T.PositionAndShape.BorderBottom,this.rules.SlurPlacementUseSkyBottomLine&&(I=Math.max(I,T.parentStaffEntry.getBottomlineMax())),A===r.PlacementEnum.Below&&(I+=this.rules.SlurEndArticulationYOffset)),T.parentVoiceEntry.StemDirection===h.StemDirectionType.Down&&this.placement===r.PlacementEnum.Below&&(L-=.5),T.parentVoiceEntry.StemDirection===h.StemDirectionType.Up&&this.placement===r.PlacementEnum.Above&&(L+=.5)}else L=y.PositionAndShape.Size.width;return m||x||(E=-1.5,I=-1.5),m||(E=this.placement===r.PlacementEnum.Above?I-1:I+1),x||(I=this.placement===r.PlacementEnum.Above?E-1:E+1),this.slur.startNoteHasMoreStartingSlurs()&&this.slur.isSlurLonger()&&(this.placement===r.PlacementEnum.Above?E-=d.SlursStartingAtSameStaffEntryYOffset:E+=d.SlursStartingAtSameStaffEntryYOffset),this.slur.endNoteHasMoreEndingSlurs()&&this.slur.isSlurLonger()&&(this.placement===r.PlacementEnum.Above?I-=d.SlursStartingAtSameStaffEntryYOffset:I+=d.SlursStartingAtSameStaffEntryYOffset),this.placement===r.PlacementEnum.Above?(E=Math.min(E,1.5),I=Math.min(I,1.5)):(E=Math.max(E,y.StaffHeight-1.5),I=Math.max(I,y.StaffHeight-1.5)),{startX:M,startY:E,endX:L,endY:I}}calculatePlacement(m,x){if(this.rules.SlurPlacementFromXML&&this.slur.PlacementXml!==r.PlacementEnum.NotYetDefined)return void(this.placement=this.slur.PlacementXml);for(let M=0,E=this.staffEntries.length;M<E;++M)if(this.staffEntries[M].parentMeasure.hasMultipleVoices())return void(this.slur.StartNote.ParentVoiceEntry.ParentVoice instanceof o.LinkedVoice||this.slur.EndNote.ParentVoiceEntry.ParentVoice instanceof o.LinkedVoice?this.placement=r.PlacementEnum.Below:this.placement=r.PlacementEnum.Above);for(let M=0,E=this.staffEntries.length;M<E;++M)if(this.staffEntries[M].LyricsEntries.length>0)return void(this.placement=r.PlacementEnum.Above);const y=this.staffEntries[0],d=this.staffEntries[this.staffEntries.length-1],S=y.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(S===d.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection)this.placement=S===h.StemDirectionType.Up?r.PlacementEnum.Below:r.PlacementEnum.Above,this.rules.SlurPlacementAtStems&&(this.placement=S===h.StemDirectionType.Up?r.PlacementEnum.Above:r.PlacementEnum.Below);else{let M=y.PositionAndShape.BorderLeft+y.PositionAndShape.RelativePosition.x+y.parentMeasure.PositionAndShape.RelativePosition.x,E=d.PositionAndShape.BorderRight+d.PositionAndShape.RelativePosition.x+d.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(M+=d.PositionAndShape.RelativePosition.x),this.graceEnd&&(E+=d.staffEntryParent.PositionAndShape.RelativePosition.x);const L=-1*m.getSkyLineMinInRange(M,E),I=m.getBottomLineMaxInRange(M,E)-x.StaffHeight;this.placement=I>L?r.PlacementEnum.Above:r.PlacementEnum.Below}}calculateTopPoints(m,x,y,d){const S=[];let M=d.getRightIndexForPointX(m.x,y.SkyLine.length),E=d.getLeftIndexForPointX(x.x,y.SkyLine.length);M<0&&(M=0),E>=y.SkyLine.length&&(E=y.SkyLine.length-1);for(let L=M;L<E;L++){const I=y.SkyLine[L];if(I!==0){const T=new s.PointF2D((.5+L)/d.SamplingUnit,I);S.push(T)}}return S}calculateBottomPoints(m,x,y,d){const S=[];let M=d.getRightIndexForPointX(m.x,y.BottomLine.length),E=d.getLeftIndexForPointX(x.x,y.BottomLine.length);M<0&&(M=0),E>=y.BottomLine.length&&(E=y.BottomLine.length-1);for(let L=M;L<E;L++){const I=y.BottomLine[L];if(I!==0){const T=new s.PointF2D((.5+L)/d.SamplingUnit,I);S.push(T)}}return S}calculateMaxLeftSlope(m,x,y){let d=-Number.MAX_VALUE;const S=x.x,M=x.y;for(let E=0;E<m.length;E++)Math.abs(m[E].y-Number.MAX_VALUE)<1e-4||Math.abs(m[E].y- -Number.MAX_VALUE)<1e-4||(d=Math.max(d,(m[E].y-M)/(m[E].x-S)));return d=Math.max(d,Math.abs(y.y-M)/(y.x-S)),d=Math.min(d,5.6713),d}calculateMaxRightSlope(m,x,y){let d=Number.MAX_VALUE;const S=y.x,M=y.y;for(let E=0;E<m.length;E++)Math.abs(m[E].y-Number.MAX_VALUE)<1e-4||Math.abs(m[E].y- -Number.MAX_VALUE)<1e-4||(d=Math.min(d,(M-m[E].y)/(S-m[E].x)));return d=Math.min(d,(M-x.y)/(S-x.x)),d=Math.max(d,-5.6713),d}getPointListMaxY(m){let x=-Number.MAX_VALUE;for(let y=0,d=m.length;y<d;++y){const S=m[y];Math.abs(S.y- -Number.MAX_VALUE)<1e-4||Math.abs(S.y-Number.MAX_VALUE)<1e-4||(x=Math.max(x,S.y))}return x}calculateTranslatedAndRotatedPointListAbove(m,x,y,d){const S=[];for(let M=0;M<m.length;M++){if(Math.abs(m[M].y-Number.MAX_VALUE)<1e-4||Math.abs(m[M].y- -Number.MAX_VALUE)<1e-4)continue;let E=new s.PointF2D(m[M].x-x,-(m[M].y-y));E=d.vectorMultiplication(E),S.push(E)}return S}calculateTranslatedAndRotatedPointListBelow(m,x,y,d){const S=[];for(let M=0;M<m.length;M++){if(Math.abs(m[M].y-Number.MAX_VALUE)<1e-4||Math.abs(m[M].y- -Number.MAX_VALUE)<1e-4)continue;let E=new s.PointF2D(m[M].x-x,m[M].y-y);E=d.vectorMultiplication(E),S.push(E)}return S}calculateHeightWidthRatio(m,x){return x.length===0?0:Math.max(0,this.getPointListMaxY(x))/m}calculateControlPoints(m,x,y,d,S,M,E){let L=this.rules.SlurHeightFactor,I=1;const T=this.rules.SlurHeightFlattenLongSlursCutoffAngle,A=this.rules.SlurHeightFlattenLongSlursCutoffWidth;x>T&&m>A&&(I+=m/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,I*=1+x/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,L/=I);const v=Math.min(.5,Math.max(.1,1.7*x/80*L*Math.pow(Math.max(S,.05),.4))),B=Math.min(.5,Math.max(.1,1.7*-y/80*L*Math.pow(Math.max(S,.05),.4))),D=new s.PointF2D;D.x=m*v*Math.cos(x*f.degreesToRadiansFactor),D.y=m*v*Math.sin(x*f.degreesToRadiansFactor);const _=new s.PointF2D;_.x=m-m*B*Math.cos(y*f.degreesToRadiansFactor),_.y=-m*B*Math.sin(y*f.degreesToRadiansFactor);let F=D.y-_.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(F)>this.rules.SlurMaximumYControlPointDistance;)F<0?(D.y+=1,_.y-=1):(D.y-=1,_.y+=1),F=D.y-_.y;return{startControlPoint:D,endControlPoint:_}}calculateAngles(m,x,y,d){let S=Math.atan(x)/f.degreesToRadiansFactor;x>0?S+=20:S-=20;let M=Math.atan(y)/f.degreesToRadiansFactor;return y<0?M-=20:M+=20,{startAngle:Math.min(Math.max(m,S),d),endAngle:Math.max(Math.min(-m,M),-d)}}}g.GraphicalSlur=f,f.degreesToRadiansFactor=Math.PI/180},348(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalStaffEntry=void 0;const l=c(6438),s=c(2561),u=c(7741),r=c(813),i=c(7921);class o extends u.GraphicalObject{constructor(h,t=void 0,f=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=h,this.graphicalVoiceEntries=[],this.sourceStaffEntry=t,f?(this.staffEntryParent=f,this.parentVerticalContainer=f.parentVerticalContainer,this.PositionAndShape=new l.BoundingBox(this,f.PositionAndShape)):this.PositionAndShape=new l.BoundingBox(this,h.PositionAndShape),t&&(this.relInMeasureTimestamp=t.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(h){this.lyricsEntries=h}getAbsoluteTimestamp(){const h=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&h.Add(this.relInMeasureTimestamp),h}findTieGraphicalNoteFromNote(h){for(const t of this.graphicalVoiceEntries)for(const f of t.notes){const p=f.sourceNote;if(!p.isRest()&&p.Pitch.FundamentalNote===h.Pitch.FundamentalNote&&p.Pitch.Octave===h.Pitch.Octave&&p.getAbsoluteTimestamp().Equals(h.getAbsoluteTimestamp()))return f}}findEndTieGraphicalNoteFromNoteWithStartingSlur(h,t){if(h){for(const f of this.graphicalVoiceEntries)if(f.parentVoiceEntry===h.ParentVoiceEntry)for(const p of f.notes){const m=p.sourceNote;if(m.NoteTie&&m.NoteSlurs.indexOf(t)!==-1)return p}}}findGraphicalNoteFromGraceNote(h){if(h){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===h.ParentVoiceEntry){for(const f of t.notes)if(f.sourceNote===h)return f}}}findGraphicalNoteFromNote(h){if(h){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===h.ParentVoiceEntry){for(const f of t.notes)if(f.sourceNote===h&&this.getAbsoluteTimestamp().Equals(h.getAbsoluteTimestamp()))return f}}}getGraphicalNoteDurationFromVoice(h){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry.ParentVoice===h)return t.notes[0].graphicalNoteLength;return new s.Fraction(0,1)}findVoiceEntryGraphicalNotes(h){for(const t of this.graphicalVoiceEntries)if(t.parentVoiceEntry===h)return t.notes}isVoiceEntryPartOfLinkedVoiceEntry(h){if(this.sourceStaffEntry.Link)for(let t=0,f=this.sourceStaffEntry.Link.LinkStaffEntries.length;t<f;++t){const p=this.sourceStaffEntry.Link.LinkStaffEntries[t];if(p.VoiceEntries.indexOf(h)!==-1&&p!==this.sourceStaffEntry)return!0}return!1}findStaffEntryMinNoteLength(){let h=new s.Fraction(Number.MAX_VALUE,1);for(const t of this.graphicalVoiceEntries)for(const f of t.notes){const p=f.graphicalNoteLength;p.lt(h)&&p.GetExpandedNumerator()>0&&(h=p)}return h}findStaffEntryMaxNoteLength(){let h=new s.Fraction(0,1);for(const t of this.graphicalVoiceEntries)for(const f of t.notes){const p=f.graphicalNoteLength;h.lt(p)&&p.GetExpandedNumerator()>0&&(h=p)}return h}findOrCreateGraphicalVoiceEntry(h){for(const f of this.graphicalVoiceEntries)if(f.parentVoiceEntry===h)return f;const t=i.MusicSheetCalculator.symbolFactory.createVoiceEntry(h,this);return this.graphicalVoiceEntries.push(t),t}findOrCreateGraphicalVoiceEntryFromGraphicalNote(h){for(const f of this.graphicalVoiceEntries)if(f===h.parentVoiceEntry)return f;const t=i.MusicSheetCalculator.symbolFactory.createVoiceEntry(h.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(t),t}addGraphicalNoteToListAtCorrectYPosition(h,t){const f=h.notes;if(f.length===0||t.PositionAndShape.RelativePosition.y<r.CollectionUtil.last(f).PositionAndShape.RelativePosition.y)f.push(t);else for(let p=f.length-1;p>=0;p--){if(f[p].PositionAndShape.RelativePosition.y>t.PositionAndShape.RelativePosition.y){f.splice(p+1,0,t);break}if(p===0){f.splice(0,0,t);break}}}hasOnlyRests(){return this.sourceStaffEntry.hasOnlyRests}getSkylineMin(){var p;const h=(p=this.parentMeasure)==null?void 0:p.ParentStaffLine.SkyBottomLineCalculator;if(!h)return;const[t,f]=this.getAbsoluteStartAndEnd();return h.getSkyLineMinInRange(t,f)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var p;const h=(p=this.parentMeasure)==null?void 0:p.ParentStaffLine.SkyBottomLineCalculator;if(!h)return;const[t,f]=this.getAbsoluteStartAndEnd();return h.getBottomLineMaxInRange(t,f)}getAbsoluteStartAndEnd(){let h=this.PositionAndShape.AbsolutePosition.x;return h-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x,[h,h+this.PositionAndShape.Size.width]}}g.GraphicalStaffEntry=o},9760(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalStaffEntryLink=void 0,g.GraphicalStaffEntryLink=class{constructor(c){this.graphicalLinkedStaffEntries=[],this.staffEntryLink=c,this.initialize()}get GetStaffEntryLink(){return this.staffEntryLink}get GraphicalLinkedStaffEntries(){return this.graphicalLinkedStaffEntries}set GraphicalLinkedStaffEntries(c){this.graphicalLinkedStaffEntries=c}isFilled(){for(let c=0;c<this.graphicalLinkedStaffEntries.length;c++)if(!this.graphicalLinkedStaffEntries[c])return!1;return!0}getLinkedStaffEntriesGraphicalNotes(c){if(this.graphicalLinkedStaffEntries.indexOf(c)!==-1){const l=[];for(let s=0,u=this.graphicalLinkedStaffEntries.length;s<u;++s){const r=this.graphicalLinkedStaffEntries[s];for(const i of r.graphicalVoiceEntries)for(const o of i.notes)o.sourceNote.ParentStaffEntry.Link&&o.sourceNote.ParentVoiceEntry===this.staffEntryLink.GetVoiceEntry&&l.push(o)}return l}}initialize(){for(let c=0,l=this.staffEntryLink.LinkStaffEntries.length;c<l;++c)this.graphicalLinkedStaffEntries.push(void 0)}}},5054(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalTie=void 0,g.GraphicalTie=class{constructor(c,l=void 0,s=void 0){this.tie=c,this.startNote=l,this.endNote=s}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(c){this.startNote=c}get EndNote(){return this.endNote}set EndNote(c){this.endNote=c}}},5824(de,g,c){var l=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalUnknownExpression=void 0;const s=c(9490),u=c(6362),r=l(c(3065));class i extends s.AbstractGraphicalExpression{constructor(n,h,t,f,p=void 0){super(n,new u.AbstractExpression(t),f),this.label=h,this.sourceMultiExpression=p}updateSkyBottomLine(){const n=this.parentStaffLine.SkyBottomLineCalculator,h=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,t=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case u.PlacementEnum.Above:const f=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;n.updateSkyLineInRange(h,t,f);break;case u.PlacementEnum.Below:const p=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;n.updateBottomLineInRange(h,t,p);break;default:r.default.error("Placement for GraphicalUnknownExpression is unknown")}}}g.GraphicalUnknownExpression=i},4548(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalVoiceEntry=void 0;const l=c(7741),s=c(6438),u=c(9713);class r extends l.GraphicalObject{constructor(o,n,h){super(),this.parentVoiceEntry=o,this.parentStaffEntry=n,this.PositionAndShape=new s.BoundingBox(this,n?n.PositionAndShape:void 0,!0),this.notes=[],this.rules=h||(n?n.parentMeasure.parentSourceMeasure.Rules:new u.EngravingRules)}sort(){return this.notes.sort((o,n)=>{var h,t;return(((h=n.sourceNote.Pitch)==null?void 0:h.getHalfTone())??0)-(((t=o.sourceNote.Pitch)==null?void 0:t.getHalfTone())??0)}),this.notes}sortForVexflow(){return this.notes.sort((o,n)=>{var h;return(((h=o.sourceNote.Pitch)==null?void 0:h.getHalfTone())??0)-(n.sourceNote.Pitch.getHalfTone()??0)}),this.notes}applyCustomNoteheads(){}color(){}}g.GraphicalVoiceEntry=r},7753(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.GraphicalWavyLine=void 0;const l=c(6438),s=c(7741);class u extends s.GraphicalObject{constructor(i,o){super(),this.getWavyLine=i,this.PositionAndShape=new l.BoundingBox(this,o)}}g.GraphicalWavyLine=u},7225(de,g){Object.defineProperty(g,"__esModule",{value:!0})},7921(de,g,c){var l=this&&this.__importDefault||function(ee){return ee&&ee.__esModule?ee:{default:ee}};Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSheetCalculator=void 0;const s=c(8724),u=c(2561),r=c(1850),i=c(5748),o=c(164),n=c(437),h=c(1336),t=c(1645),f=c(7066),p=c(9409),m=c(2369),x=c(8254),y=c(7533),d=c(4543),S=c(3123),M=c(4249),E=c(6438),L=c(8033),I=c(8927),T=c(164),A=c(4064),v=l(c(3065)),B=c(3263),D=c(6452),_=c(7435),F=c(3236),k=c(6362),j=c(3361),P=c(9161),G=c(2221),Y=c(5875),X=c(1066),ie=c(624),oe=c(5824),$=c(5534),Q=c(9647);class ne{constructor(){this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalLyricWords=[],this.abstractNotImplementedErrorMessage="abstract, not implemented",this.dynamicExpressionMap=new Map}static get TextMeasurer(){return ne.textMeasurer}static set TextMeasurer(N){ne.textMeasurer=N}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}static setMeasuresMinStaffEntriesWidth(N,R){for(let O=0,U=N.length;O<U;++O){const H=N[O];H&&(H.minimumStaffEntriesWidth=R)}}initialize(N){this.graphicalMusicSheet=N,this.rules=N.ParentMusicSheet.Rules,this.rules.clearMusicSheetObjects(),this.prepareGraphicalMusicSheet()}prepareGraphicalMusicSheet(){const N=this.graphicalMusicSheet.ParentMusicSheet;this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalMusicSheet.Initialize();const R=this.graphicalMusicSheet.MeasureList,O=this.createAccidentalCalculators(),U=this.graphicalMusicSheet.initializeActiveClefs(),H=[],W=N.getCompleteNumberOfStaves(),K=[];for(let te=0;te<W;te++)K.push(void 0);for(let te=0,se=N.SourceMeasures.length;te<se;++te){const ue=N.SourceMeasures[te],fe=this.createGraphicalMeasuresForSourceMeasure(ue,O,H,K,U);if(R.push(fe),ue.multipleRestMeasures>0&&this.rules.RenderMultipleRestMeasures){ue.isReducedToMultiRest=!0,ue.multipleRestMeasureNumber=1;const xe=ue.multipleRestMeasures-1;te+=xe;for(let ve=1;ve<=xe;ve++){const Se=N.SourceMeasures.indexOf(ue)+ve;if(Se>=N.SourceMeasures.length)break;const ye=N.SourceMeasures[Se];ye.multipleRestMeasureNumber=ve+1,ye.isReducedToMultiRest=!0,R.push([void 0])}}}if(this.rules.AutoGenerateMultipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let te,se=0;for(let ue=0,fe=N.SourceMeasures.length;ue<fe;++ue){const xe=N.SourceMeasures[ue];if(!xe.isReducedToMultiRest&&xe.canBeReducedToMultiRest())if(se>0){te.isReducedToMultiRest=!0,te.multipleRestMeasureNumber=1,se++,xe.multipleRestMeasureNumber=se,xe.isReducedToMultiRest=!0;for(let ve=0;ve<R[ue].length;ve++)R[ue][ve]=void 0}else te=xe,se=1;else if(se>1){te.multipleRestMeasures=se;const ve=this.createGraphicalMeasuresForSourceMeasure(te,O,H,K,U);R[te.measureListIndex]=ve,se=0,te=void 0}else se=0,te=void 0}if(se>1){te.multipleRestMeasures=se,te.isReducedToMultiRest=!0;const ue=this.createGraphicalMeasuresForSourceMeasure(te,O,H,K,U);R[te.measureListIndex]=ue,se=0,te=void 0}}const q=U.map(te=>te.ClefType===o.ClefEnum.percussion);this.handleStaffEntries(q),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(N,R){var O;if(this.graphicalMusicSheet.MeasureList.length>0){let U,H=0,W=1;for(let K=0;K<this.graphicalMusicSheet.MeasureList.length;K++){U=this.graphicalMusicSheet.MeasureList[K];let q=this.calculateMeasureXLayout(U);q=this.calculateMeasureWidthFromStaffEntries(U,q),q>H&&(H=q);const te=this.graphicalMusicSheet.ParentMusicSheet.MeasureWidthFactor;for(const se of U)if(se!=null&&se.parentSourceMeasure.WidthFactor){W=se.parentSourceMeasure.WidthFactor;break}q*=te*W,ne.setMeasuresMinStaffEntriesWidth(U,q)}if(this.rules.FixedMeasureWidth){let K=H;this.rules.FixedMeasureWidthFixedValue&&(K=this.rules.FixedMeasureWidthFixedValue);for(let q=0;q<this.graphicalMusicSheet.MeasureList.length;q++)U=this.graphicalMusicSheet.MeasureList[q],!this.rules.FixedMeasureWidthUseForPickupMeasures&&((O=U[0])!=null&&O.parentSourceMeasure.ImplicitMeasure)||ne.setMeasuresMinStaffEntriesWidth(U,K)}}}calculateMeasureWidthFromStaffEntries(N,R){throw new Error(this.abstractNotImplementedErrorMessage)}formatMeasures(){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMeasureXLayout(N){throw new Error(this.abstractNotImplementedErrorMessage)}initGraphicalMeasuresCreation(){throw new Error(this.abstractNotImplementedErrorMessage)}handleBeam(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}handleTiedGraphicalNote(N,R,O,U,H,W,K,q){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryLyrics(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryOrnaments(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryArticulations(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryTechnicalInstructions(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}handleTuplet(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}layoutVoiceEntry(N,R,O,U){throw new Error(this.abstractNotImplementedErrorMessage)}layoutStaffEntry(N){throw new Error(this.abstractNotImplementedErrorMessage)}createGraphicalTie(N,R,O,U,H){throw new Error(this.abstractNotImplementedErrorMessage)}updateStaffLineBorders(N){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMeasureNumberPlacement(N){const R=N.StaffLines[0];if(!R||!R.Measures[0])return void v.default.warn("calculateMeasureNumberPlacement: measure undefined for system.Id "+N.Id);let O=R.Measures[0].MeasureNumber,U=0;for(let H=0;H<R.Measures.length;H++){const W=R.Measures[H];let K=this.rules.RenderMeasureNumbersOnlyAtSystemStart&&H>1;if(H===1&&R.Measures[0].parentSourceMeasure.ImplicitMeasure&&(K=!1),K)return;W.MeasureNumber!==0&&W.MeasureNumber!==1||(O=W.MeasureNumber),U=W!==R.Measures[0]&&this.rules.MeasureNumberLabelXOffset?this.rules.MeasureNumberLabelXOffset:0;const q=this.rules.UseXMLMeasureNumbers&&W.MeasureNumber===1&&W.parentSourceMeasure.getPrintedMeasureNumber()!==1;((W.MeasureNumber===O||W.MeasureNumber>=O+this.rules.MeasureNumberLabelOffset)&&!W.parentSourceMeasure.ImplicitMeasure||q)&&((W.MeasureNumber!==1||W.MeasureNumber===1&&W!==R.Measures[0]||q)&&this.calculateSingleMeasureNumberPlacement(W,R,N,U),O=W.MeasureNumber)}}calculateSingleMeasureNumberPlacement(N,R,O,U=0){const H=N.parentSourceMeasure.getPrintedMeasureNumber().toString(),W=new _.Label(H),K=new x.GraphicalLabel(W,this.rules.MeasureNumberLabelHeight,y.TextAlignmentEnum.LeftBottom,this.rules),q=R.SkyBottomLineCalculator;K.setLabelPositionAndShapeBorders(),K.PositionAndShape.Parent=O.PositionAndShape;const te=R.PositionAndShape.RelativePosition.x+N.PositionAndShape.RelativePosition.x-K.PositionAndShape.BorderMarginLeft+U;let se,ue=te,fe=te-K.PositionAndShape.BorderLeft+K.PositionAndShape.BorderRight;ue-=R.PositionAndShape.RelativePosition.x,fe-=R.PositionAndShape.RelativePosition.x;const xe=ue+.5,ve=fe-.5,Se=q.getSkyLineMinInRange(xe,ve);if(N===R.Measures[0]){let ye=0;if(O.GroupBrackets.length>0)for(const be of O.GroupBrackets)ye=Math.min(ye,be.PositionAndShape.BorderTop);else N.ParentStaff.ParentInstrument.Parent&&(ye=-1);se=Math.min(Se,ye)}else se=Se;se=Math.min(0,se),K.PositionAndShape.RelativePosition=new p.PointF2D(te,se),O.MeasureNumberLabels.push(K)}calculateMeasureNumberSkyline(N){const R=N.StaffLines[0];for(const O of N.MeasureNumberLabels){let U=O.PositionAndShape.RelativePosition.x,H=U-O.PositionAndShape.BorderLeft+O.PositionAndShape.BorderRight;U-=R.PositionAndShape.RelativePosition.x,H-=R.PositionAndShape.RelativePosition.x,R.SkyBottomLineCalculator.updateSkyLineInRange(U,H,O.PositionAndShape.RelativePosition.y+O.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(N,R,O){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(N,R){let O=0,U=this.rules.StaffHeight;const H=new Map,W=[],K=N.SkyBottomLineCalculator;let q=N.Measures.length;for(let se=0;se<q;++se){const ue=N.Measures[se],fe=ue.PositionAndShape.RelativePosition,xe=ue.staffEntries.length;for(let ve=0;ve<xe;++ve){const Se=ue.staffEntries[ve],ye=Se.LyricsEntries.length;for(let be=0;be<ye;++be){const Me=Se.LyricsEntries[be].LyricsEntry;H[Me.VerseNumber]=Me.IsChorus}if(ye>0){W.push(Se),O=Math.max(O,Se.LyricsEntries.length);const be=Se.PositionAndShape.RelativePosition.x+fe.x;let Me=Number.MAX_VALUE,_e=Number.MIN_VALUE;for(let Le=0;Le<Se.LyricsEntries.length;Le++){const Pe=Se.LyricsEntries[Le].GraphicalLabel;Me=Math.min(Me,be+Pe.PositionAndShape.BorderMarginLeft),_e=Math.max(_e,be+Pe.PositionAndShape.BorderMarginRight)}const Te=K.getBottomLineMaxInRange(Me,_e);U=Math.max(U,Te+this.rules.LyricsYMarginToBottomLine)}}}let te=0;q=W.length;for(const se of W){const ue=[];let fe=!0;for(let xe=0;xe<se.LyricsEntries.length;xe++)fe&&(fe=se.LyricsEntries[xe].LyricsEntry.IsChorus);for(const xe of R)H[xe]===fe&&ue.push(xe);for(let xe=0;xe<se.LyricsEntries.length;xe++){const ve=se.LyricsEntries[xe],Se=ve.GraphicalLabel,ye=ve.LyricsEntry.VerseNumber,be=ue.indexOf(ye),Me=U+this.rules.LyricsHeight+this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsYOffsetToStaffHeight+(this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsHeight)*be,_e=Se.PositionAndShape.RelativePosition.x;Se.PositionAndShape.RelativePosition=new p.PointF2D(_e,Me),Se.Label.fontStyle=ve.LyricsEntry.FontStyle,te=Math.max(te,Me)}}if(W.length>0){const se=N.PositionAndShape.Size.width;let ue=W[0].PositionAndShape.RelativePosition.x+W[0].PositionAndShape.BorderMarginLeft+W[0].parentMeasure.PositionAndShape.RelativePosition.x;ue=ue>se?se:ue,K.updateBottomLineInRange(ue,se,te)}return W}calculateLyricsExtendsAndDashes(N){for(let R=0,O=N.length;R<O;++R){const U=N[R];for(let H=0;H<U.LyricsEntries.length;H++){const W=U.LyricsEntries[H];W.ParentLyricWord&&W.ParentLyricWord.GraphicalLyricsEntries[W.ParentLyricWord.GraphicalLyricsEntries.length-1]!==W&&this.calculateSingleLyricWord(W),W.LyricsEntry.extend&&this.calculateLyricExtend(W)}}}calculateSingleOctaveShift(N,R,O,U){throw new Error(this.abstractNotImplementedErrorMessage)}calculateWordRepetitionInstruction(N,R){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMoodAndUnknownExpression(N,R,O){var q,te;const U=N.AbsoluteTimestamp,H=this.graphicalMusicSheet.MeasureList[R];let W=new p.PointF2D;const K=(q=N.UnknownList[0])==null?void 0:q.defaultYXml;if(N.MoodList.length>0||N.UnknownList.length>0){let se="";for(let be=0,Me=N.EntriesList.length;be<Me;++be){const _e=N.EntriesList[be];_e.prefix!==""&&(se+=se===""?_e.prefix:" "+_e.prefix),se+=se===""?_e.label:" "+_e.label}const ue=H[O].ParentStaffLine;if(!ue)return void v.default.debug("MusicSheetCalculator.calculateMoodAndUnknownExpression: staffLine undefined. Returning.");W=this.getRelativePositionInStaffLineFromTimestamp(U,O,ue,ue==null?void 0:ue.isPartOfMultiStaffInstrument()),Math.abs(W.x-0)<1e-4&&(W.x=H[O].beginInstructionsWidth+this.rules.RhythmRightMargin);const fe=this.rules.UnknownTextHeight,xe=N.getPlacementOfFirstEntry(),ve=this.calculateLabel(ue,W,se,N.getFontstyleOfFirstEntry(),xe,fe),Se=N.getColorXMLOfFirstEntry();if(this.rules.ExpressionsUseXMLColor&&Se&&(ve.ColorXML=Se),this.rules.PlaceWordsInsideStafflineFromXml&&K<0&&K>-50){let be=K/10;be+=this.rules.PlaceWordsInsideStafflineYOffset,ve.PositionAndShape.RelativePosition.y=be}const ye=new oe.GraphicalUnknownExpression(ue,ve,xe,(te=H[O])==null?void 0:te.parentSourceMeasure,N);ue.AbstractExpressions.push(ye)}}clearRecreatedObjects(){for(let N=0,R=this.staffEntriesWithGraphicalTies.length;N<R;++N)this.staffEntriesWithGraphicalTies[N].GraphicalTies.length=0;this.staffEntriesWithGraphicalTies.length=0}handleStaffEntryLink(N,R){v.default.debug("handleStaffEntryLink not implemented")}calculateMusicSystems(){if(!this.graphicalMusicSheet.MeasureList)return;const N=this.graphicalMusicSheet.MeasureList;if(!N)return;this.rules.MinMeasureToDrawIndex>N.length-1&&(v.default.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=N.length-1);const R=[];for(let H=this.rules.MinMeasureToDrawIndex,W=N.length;H<W&&H<=this.rules.MaxMeasureToDrawIndex;++H){const K=[];for(let q=0,te=N[H].length;q<te;++q){const se=N[H][q];if(se!=null&&se.isVisible()&&(K.push(se),this.rules.ColoringEnabled))for(const ue of se.staffEntries)for(const fe of ue.graphicalVoiceEntries)fe.applyCustomNoteheads(),fe.color()}R.push(K)}let O=0;for(let H=0,W=R.length;H<W;++H){const K=R[H];O=Math.max(K.length,O);break}if(O===0)return;const U=new f.MusicSystemBuilder;if(U.initialize(this.graphicalMusicSheet,R,O),this.musicSystems=U.buildMusicSystems(),this.formatMeasures(),this.leadSheet||(this.optimizeRestPlacement(),this.calculateStaffEntryArticulationMarks(),this.rules.RenderSlurs&&this.calculateTieCurves()),this.calculateSkyBottomLines(),this.calculateTupletNumbers(),this.rules.RenderMeasureNumbers)for(let H=0,W=this.musicSystems.length;H<W;++H){const K=this.musicSystems[H];this.calculateMeasureNumberPlacement(K)}if(this.rules.RenderFingerings&&this.calculateFingerings(),!this.leadSheet&&this.rules.RenderSlurs&&this.calculateSlurs(),this.calculateGlissandi(),this.rules.RenderMeasureNumbers)for(let H=0,W=this.musicSystems.length;H<W;++H){const K=this.musicSystems[H];this.calculateMeasureNumberSkyline(K)}this.leadSheet||this.calculateOrnaments(),this.calculateChordSymbols(),this.leadSheet||(this.calculateDynamicExpressions(),this.calculateMoodAndUnknownExpressions(),this.calculateExpressionAlignements(),this.calculateOctaveShifts(),this.rules.RenderPedals&&this.calculatePedals(),this.rules.RenderWavyLines&&this.calculateWavyLines(),this.calculateWordRepetitionInstructions()),this.calculateRepetitionEndings(),this.leadSheet||this.calculateTempoExpressions(),this.calculateRehearsalMarks(),this.calculateLyricsPosition();for(let H=0,W=this.musicSystems.length;H<W;++H){const K=this.musicSystems[H];for(let q=0,te=K.StaffLines.length;q<te;++q){const se=K.StaffLines[q];this.updateStaffLineBorders(se)}}U.calculateSystemYLayout(),this.calculateComments(),this.calculateMarkedAreas();for(let H=0,W=this.graphicalMusicSheet.MusicPages.length;H<W;++H){const K=this.graphicalMusicSheet.MusicPages[H];for(let te=0,se=K.MusicSystems.length;te<se;++te){const ue=H===0&&te===0,fe=K.MusicSystems[te];fe.setMusicSystemLabelsYPosition(),this.leadSheet?fe===fe.Parent.MusicSystems[0]&&fe.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,ue):(fe.setYPositionsToVerticalLineObjectsAndCreateLines(this.rules),fe.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,ue),fe.createInstrumentBrackets(this.graphicalMusicSheet.ParentMusicSheet.Instruments,this.rules.StaffHeight),fe.createGroupBrackets(this.graphicalMusicSheet.ParentMusicSheet.InstrumentalGroups,this.rules.StaffHeight,0),fe.alignBeginInstructions()),fe.calculateBorders(this.rules)}const q=K.MusicSystems[0].PositionAndShape.BorderTop;for(let te=0,se=K.MusicSystems.length;te<se;++te){const ue=K.MusicSystems[te];ue.PositionAndShape.RelativePosition=new p.PointF2D(ue.PositionAndShape.RelativePosition.x,ue.PositionAndShape.RelativePosition.y-q)}K.PositionAndShape.calculateTopBottomBorders(),K===this.graphicalMusicSheet.MusicPages[0]&&this.calculatePageLabels(K),K.PositionAndShape.calculateTopBottomBorders()}}calculateMarkedAreas(){}calculateComments(){}calculateChordSymbols(){for(const N of this.musicSystems)for(const R of N.StaffLines){const O=R.SkyBottomLineCalculator;let U=Number.MAX_SAFE_INTEGER,H=Number.MIN_SAFE_INTEGER;if(this.rules.ChordSymbolYAlignment&&this.rules.ChordSymbolYAlignmentScope==="staffline"){const W=[];for(const te of R.Measures)W.push(...te.staffEntries);const{minOffset:K,maxOffset:q}=this.calculateAlignedChordSymbolsOffset(W,O);U=K,H=q}for(let W=0;W<R.Measures.length;W++){const K=R.Measures[W];if(this.rules.ChordSymbolYAlignment&&this.rules.ChordSymbolYAlignmentScope==="measure"){const{minOffset:te,maxOffset:se}=this.calculateAlignedChordSymbolsOffset(K.staffEntries,O);U=te,H=se}let q;for(const te of K.staffEntries)if(te.graphicalChordContainers&&te.graphicalChordContainers.length!==0)for(let se=0;se<te.graphicalChordContainers.length;se++){const ue=te.graphicalChordContainers[se];if(te.graphicalVoiceEntries.length===0&&te.relInMeasureTimestamp.RealValue>0){let _e=0;K.staffEntries[0].relInMeasureTimestamp.RealValue===0&&(_e=K.staffEntries[0].PositionAndShape.RelativePosition.x,K.MeasureNumber===1&&(_e+=this.rules.ChordSymbolWholeMeasureRestXOffsetMeasure1));let Te=_e+(K.PositionAndShape.Size.width-K.endInstructionsWidth-_e)*(te.relInMeasureTimestamp.RealValue/K.parentSourceMeasure.Duration.RealValue)+ue.PositionAndShape.BorderMarginLeft;q&&(Te=Math.max(Te,q.PositionAndShape.RelativePosition.x+q.GraphicalLabel.PositionAndShape.Size.width+this.rules.ChordSymbolXSpacing)),ue.PositionAndShape.RelativePosition.x=Te,ue.PositionAndShape.Parent=K.staffEntries[0].PositionAndShape.Parent}const fe=ue.PositionAndShape,xe=fe.Parent;if(xe.DataObject instanceof i.GraphicalMeasure&&te.relInMeasureTimestamp.RealValue===0&&(fe.RelativePosition.x=Math.max(K.beginInstructionsWidth,fe.RelativePosition.x),K.MeasureNumber===1&&fe.RelativePosition.x>3&&(fe.RelativePosition.x+=this.rules.ChordSymbolWholeMeasureRestXOffsetMeasure1)),te.PositionAndShape.RelativePosition.x===0){const _e=N.GraphicalMeasures[W];for(const Te of _e){let Le=!1;for(const Pe of Te.staffEntries)if(Pe.relInMeasureTimestamp===te.relInMeasureTimestamp&&Pe.PositionAndShape.RelativePosition.x!==0){fe.RelativePosition.x=Pe.PositionAndShape.RelativePosition.x,Le=!0;break}if(Le)break}}const ve=fe.BorderMarginLeft+xe.AbsolutePosition.x+fe.RelativePosition.x,Se=fe.BorderMarginRight+xe.AbsolutePosition.x+fe.RelativePosition.x,ye=ue.GetChordSymbolContainer.Placement;ye===k.PlacementEnum.Below?(!this.rules.ChordSymbolYAlignment||H<0)&&(H=O.getBottomLineMaxInRange(ve,Se)):ye===k.PlacementEnum.Above&&(!this.rules.ChordSymbolYAlignment||U>0)&&(U=O.getSkyLineMinInRange(ve,Se));let be=0;se===0?(be+=this.rules.ChordSymbolYOffset,be+=.1):be+=this.rules.ChordSymbolYPadding,ye!==k.PlacementEnum.Below&&(be*=-1);const Me=ue.GraphicalLabel;ye===k.PlacementEnum.Below?(Me.PositionAndShape.RelativePosition.y=H+be,Me.setLabelPositionAndShapeBorders(),Me.PositionAndShape.calculateBoundingBox(),O.updateBottomLineInRange(ve,Se,H+Me.PositionAndShape.BorderMarginBottom+this.rules.ChordSymbolBottomMargin)):(Me.PositionAndShape.RelativePosition.y=U+be,Me.setLabelPositionAndShapeBorders(),Me.PositionAndShape.calculateBoundingBox(),O.updateSkyLineInRange(ve,Se,U+Me.PositionAndShape.BorderMarginTop)),q=ue}}}}calculateAlignedChordSymbolsOffset(N,R){let O=Number.MAX_SAFE_INTEGER,U=Number.MIN_SAFE_INTEGER;for(const H of N)for(const W of H.graphicalChordContainers){const K=W.PositionAndShape,q=K.Parent;let te=K.BorderMarginLeft+q.AbsolutePosition.x,se=K.BorderMarginRight+q.AbsolutePosition.x;q.DataObject instanceof i.GraphicalMeasure&&(te+=q.DataObject.beginInstructionsWidth,se+=q.DataObject.beginInstructionsWidth);const ue=W.GetChordSymbolContainer.Placement;ue===k.PlacementEnum.Above?O=Math.min(O,R.getSkyLineMinInRange(te,se)):ue===k.PlacementEnum.Below&&(U=Math.max(U,R.getBottomLineMaxInRange(te,se)))}return{minOffset:O,maxOffset:U}}layoutMeasureWithWholeRest(N,R,O){}layoutBeams(N){}layoutArticulationMarks(N,R,O){}layoutOrnament(N,R,O){}calculateRestNotePlacementWithinGraphicalBeam(N,R,O,U,H){}calculateTupletNumbers(){if(!this.rules.TupletNumberLimitConsecutiveRepetitions)return;let N,R,O,U=-1,H=0;const W={};for(const K of this.graphicalMusicSheet.ParentMusicSheet.Instruments)for(const q of K.Voices){H=0,W[q.VoiceId]={};for(const te of q.VoiceEntries)if(te.Notes.length>0){const se=te.Notes[0];if(!se.NoteTuplet||se.NoteTuplet.shouldBeBracketed(this.rules.TupletsBracketedUseXMLValue,this.rules.TupletsBracketed,this.rules.TripletsBracketed)){U=-1,H=0,R=void 0,N=void 0;continue}if(se.NoteTuplet===O)continue;let ue=se.TypeLength;if(ue||(v.default.warn("note missing TypeLength"),ue=se.NoteTuplet.Fractions[0]),se.NoteTuplet!==R&&W[q.VoiceId][se.NoteTuplet.TupletLabelNumber]&&W[q.VoiceId][se.NoteTuplet.TupletLabelNumber][ue.RealValue]){se.NoteTuplet.RenderTupletNumber=!1,O=se.NoteTuplet;continue}se.NoteTuplet.TupletLabelNumber===U&&ue.Equals(N)&&!se.NoteTuplet.Bracket||(U=se.NoteTuplet.TupletLabelNumber,N=ue,H=0),R=se.NoteTuplet,H++,H<=this.rules.TupletNumberMaxConsecutiveRepetitions&&(se.NoteTuplet.RenderTupletNumber=!0),H>this.rules.TupletNumberMaxConsecutiveRepetitions&&(se.NoteTuplet.RenderTupletNumber=!1,this.rules.TupletNumberAlwaysDisableAfterFirstMax&&(W[q.VoiceId][U]||(W[q.VoiceId][U]={}),W[q.VoiceId][U][ue.RealValue]=!0)),O=R}}}calculateSlurs(){}calculateGlissandi(){}calculateDynamicExpressionsForMultiExpression(N,R,O){}calculateGraphicalVerbalContinuousDynamic(N,R){const O=N.Label,U=R.x+O.PositionAndShape.BorderMarginLeft,H=R.x+O.PositionAndShape.BorderMarginRight,W=N.ContinuousDynamic.Placement,K=N.ParentStaffLine.SkyBottomLineCalculator;let q;W===k.PlacementEnum.Below?(q=K.getBottomLineMaxInRange(U,H),O.PositionAndShape.RelativePosition=new p.PointF2D(R.x,q-O.PositionAndShape.BorderMarginTop)):(q=K.getSkyLineMinInRange(U,H),O.PositionAndShape.RelativePosition=new p.PointF2D(R.x,q-O.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(N,R){var ot;const O=N.IsSoftAccent,U=N.ParentStaffLine.ParentStaff.idInMusicSheet,H=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,U);if(!H)return void v.default.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");N.EndMeasure=H;const W=N.ParentStaffLine,K=H.ParentStaffLine,q=K&&W===K;let te=!1;K?te=K==null?void 0:K.isPartOfMultiStaffInstrument():W&&(te=W==null?void 0:W.isPartOfMultiStaffInstrument());const se=u.Fraction.createFromFraction(N.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),ue=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(se),fe=ue.getFirstNonNullStaffEntry().parentMeasure,xe=fe.PositionAndShape.AbsolutePosition.x+fe.PositionAndShape.BorderRight;let ve=new u.Fraction(0,0,0);for(const ze of ue.StaffEntries){if((ze==null?void 0:ze.sourceStaffEntry.ParentStaff)!==W.ParentStaff)continue;const He=(ot=ze==null?void 0:ze.sourceStaffEntry)==null?void 0:ot.calculateMaxNoteLength(!1);He!=null&&He.gt(ve)&&(ve=He)}const Se=!O&&N.ContinuousDynamic.DynamicType===Y.ContDynamicEnum.diminuendo,ye=this.getRelativePositionInStaffLineFromTimestamp(se,U,K,te,0,Se),be=u.Fraction.plus(se,ve).clone();N.ContinuousDynamic.EndMultiExpression.EndOffsetFraction&&this.rules.UseEndOffsetForExpressions&&be.Add(N.ContinuousDynamic.EndMultiExpression.EndOffsetFraction);const Me=this.getRelativePositionInStaffLineFromTimestamp(be,U,K,te,0,N.ContinuousDynamic.DynamicType===Y.ContDynamicEnum.diminuendo),_e=this.rules.SoftAccentWedgePadding,Te=ue.getFirstNonNullStaffEntry().PositionAndShape.Size.width,Le=this.rules.SoftAccentSizeFactor;O?(R.x-=Te/2*Le+_e,ye.x=R.x+Te/2*Le):Me.x>ye.x&&Me.x<xe?ye.x+=(Me.x-ye.x)/this.rules.WedgeEndDistanceBetweenTimestampsFactor:ye.x=xe-this.rules.WedgeHorizontalMargin;const Pe=this.dynamicExpressionMap.get(N.ContinuousDynamic.StartMultiExpression.AbsoluteTimestamp.RealValue);Pe&&Pe.DataObject.ParentStaffLine===W&&(R.x=Pe.RelativePosition.x+this.rules.WedgeHorizontalMargin,R.x+=Pe.BorderMarginRight);const Ae=W.ParentMusicSystem,Ce=Ae.StaffLines.indexOf(W),Be=W.SkyBottomLineCalculator,Ie=N.ContinuousDynamic.Placement;let Fe;q&&ye.x-R.x<this.rules.WedgeMinLength&&!O&&(ye.x=R.x+this.rules.WedgeMinLength);const Ke=R.x;let st=K.Measures[0].beginInstructionsWidth-this.rules.WedgeHorizontalMargin-2,je=0,at=0;const et=[];if(q)je=ye.x;else{je=W.PositionAndShape.Size.width,at=ye.x;const ze=[W,K],He=N.StartMeasure;let Je=He,qe=0,tt=He.parentSourceMeasure.measureListIndex;for(;Je!==H&&qe<1e3;){const Gt=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[tt],Pt=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(Gt,U);if(Pt){Je=Pt;const mt=Je.ParentStaffLine;if(!ze.includes(mt)){ze.push(mt);const _t=new X.GraphicalContinuousDynamicExpression(N.ContinuousDynamic,mt,mt.Measures[0].parentSourceMeasure);_t.IsSplittedPart=!0,et.push(_t)}}tt++,qe++}Fe=new X.GraphicalContinuousDynamicExpression(N.ContinuousDynamic,K,H.parentSourceMeasure),Fe.IsSplittedPart=!0,N.IsSplittedPart=!0}O&&(st=ye.x+_e,at=st+Te/2*Le);let We=0,Xe=0;if(Ie===k.PlacementEnum.Below){let ze=0;if(Ce<Ae.StaffLines.length-1&&(ze=Ce+1),ze>Ce){const qe=Ae.StaffLines[ze].PositionAndShape.RelativePosition.y-W.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;We=this.rules.StaffHeight+qe/2}else We=this.rules.WedgePlacementBelowY;We-=this.rules.WedgeOpeningLength/2,q||(Xe=We);let He=Be.getBottomLineMaxInRange(Ke,je);He>We&&(We=He);const Je=!1;if(Ce<Ae.StaffLines.length-1){const qe=W.findClosestStaffEntry(je),tt=W.findClosestStaffEntry(Ke);tt&&qe&&tt.parentVerticalContainer}q||(He=K.SkyBottomLineCalculator.getBottomLineMaxInRange(st,at),He>Xe&&(Xe=He),Xe+=this.rules.WedgeOpeningLength/2,Xe+=this.rules.WedgeVerticalMargin),We+=this.rules.WedgeOpeningLength/2,We+=this.rules.WedgeVerticalMargin}else if(Ie===k.PlacementEnum.Above){if(W.ParentStaff.ParentInstrument.Staves.length===1)We=this.rules.WedgePlacementAboveY;else{let He=0;Ce>0&&(He=Ce-1);const Je=Ae.StaffLines[He];We=-(W.PositionAndShape.RelativePosition.y-Je.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}We+=this.rules.WedgeOpeningLength/2,q||(Xe=We);let ze=Be.getSkyLineMinInRange(Ke,je);if(ze<We&&(We=ze),W.ParentStaff.ParentInstrument.Staves.length>1&&Ce>0){const He=W.findClosestStaffEntry(Ke),Je=W.findClosestStaffEntry(je);He&&Je&&He.parentVerticalContainer}q||(ze=K.SkyBottomLineCalculator.getSkyLineMinInRange(st,at),ze<Xe&&(Xe=ze),Xe-=this.rules.WedgeOpeningLength/2),We-=this.rules.WedgeOpeningLength/2,We-=this.rules.WedgeVerticalMargin,q||(Xe-=this.rules.WedgeVerticalMargin)}if(N.Lines.clear(),O)N.createFirstHalfCrescendoLines(Ke,je,We),N.createSecondHalfDiminuendoLines(st,at,We),N.calcPsi();else if(q&&!O)N.createLines(Ke,je,We),N.calcPsi();else{N.createFirstHalfLines(Ke,je,We),N.calcPsi();for(let ze=0;ze<et.length;ze++){const He=et[ze],Je=He.ParentStaffLine;let qe=Xe;if(Ie===k.PlacementEnum.Below){const tt=K.SkyBottomLineCalculator.getBottomLineMaxInRange(st,je);tt>qe&&(qe=tt),qe+=this.rules.WedgeOpeningLength/2,qe+=this.rules.WedgeVerticalMargin}else if(Ie===k.PlacementEnum.Above){const tt=Je.SkyBottomLineCalculator.getSkyLineMinInRange(st,at);tt<Xe&&(qe=tt),qe-=this.rules.WedgeOpeningLength/2}N.ContinuousDynamic.DynamicType===Y.ContDynamicEnum.crescendo?He.createSecondHalfCrescendoLines(0,Je.PositionAndShape.Size.width,qe):He.createFirstHalfDiminuendoLines(0,Je.PositionAndShape.Size.width,qe),He.calcPsi()}Fe.createSecondHalfLines(st,at,Xe),Fe.calcPsi()}this.dynamicExpressionMap.set(se.RealValue,N.PositionAndShape)}calculateGraphicalInstantaneousDynamicExpression(N,R,O){const U=N.ParentStaffLine;if(!U)return;const H=R.x+N.PositionAndShape.BorderMarginLeft,W=R.x+N.PositionAndShape.BorderMarginRight,K=U.SkyBottomLineCalculator;let q=0;if(N.Placement===k.PlacementEnum.Above){const te=K.getSkyLineMinInRange(H,W);if(U.isPartOfMultiStaffInstrument()&&U.ParentStaff!==U.ParentStaff.ParentInstrument.Staves[0]){const se=U.ParentMusicSystem.StaffLines[U.ParentMusicSystem.StaffLines.indexOf(U)-1];if(se){const ue=(U==null?void 0:U.PositionAndShape.RelativePosition.y)-se.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;q=te>-ue/2?-ue/2:te-N.PositionAndShape.BorderMarginBottom}}else q=te-N.PositionAndShape.BorderMarginBottom;N.PositionAndShape.RelativePosition=new p.PointF2D(R.x,q)}else if(N.Placement===k.PlacementEnum.Below){const te=K.getBottomLineMaxInRange(H,W),se=U.ParentStaff.ParentInstrument.Staves[U.ParentStaff.ParentInstrument.Staves.length-1];if(U.isPartOfMultiStaffInstrument()&&U.ParentStaff!==se){const ue=U.ParentMusicSystem.StaffLines[U.ParentMusicSystem.StaffLines.indexOf(U)+1];if(ue){const fe=ue.PositionAndShape.RelativePosition.y-U.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;q=te+N.PositionAndShape.BorderMarginBottom<this.rules.StaffHeight+fe/2?this.rules.StaffHeight+fe/2:te-N.PositionAndShape.BorderMarginTop}}else q=te-N.PositionAndShape.BorderMarginTop;N.PositionAndShape.RelativePosition=new p.PointF2D(R.x,q)}N.updateSkyBottomLine()}calcGraphicalRepetitionEndingsRecursively(N){}layoutSingleRepetitionEnding(N,R,O,U,H,W){}calculateLabel(N,R,O,U,H,W,K=y.TextAlignmentEnum.CenterBottom,q=0){const te=new _.Label(O,K);te.fontStyle=U,te.fontHeight=W;const se=new x.GraphicalLabel(te,W,te.textAlignment,this.rules,N.PositionAndShape),ue=1.1;H===k.PlacementEnum.Below&&(se.Label.textAlignment=y.TextAlignmentEnum.LeftTop),se.setLabelPositionAndShapeBorders(),se.PositionAndShape.BorderMarginBottom*=ue,se.PositionAndShape.BorderMarginTop*=ue,se.PositionAndShape.BorderMarginLeft*=ue,se.PositionAndShape.BorderMarginRight*=ue;let fe,xe=R.x+se.PositionAndShape.BorderMarginLeft,ve=R.x+se.PositionAndShape.BorderMarginRight;if(ve>N.PositionAndShape.Size.width&&(ve=N.PositionAndShape.Size.width-this.rules.MeasureRightMargin,xe=ve-se.PositionAndShape.MarginSize.width,R.x=xe-se.PositionAndShape.BorderMarginLeft),xe<N.PositionAndShape.BorderMarginLeft){const ye=N.PositionAndShape.BorderMarginLeft-xe+this.rules.LabelXOffsetForStafflineLeftOverflowCheck;xe+=ye,ve+=ye,R.x+=ye}const Se=N.SkyBottomLineCalculator;return fe=H===k.PlacementEnum.Below?Se.getBottomLineMaxInRange(xe,ve)+q:Se.getSkyLineMinInRange(xe,ve)-q,se.PositionAndShape.RelativePosition=new p.PointF2D(R.x,fe),H===k.PlacementEnum.Below?Se.updateBottomLineInRange(xe,ve,se.PositionAndShape.BorderMarginBottom+fe):Se.updateSkyLineInRange(xe,ve,se.PositionAndShape.BorderMarginTop+fe),se}calculateTempoExpressionsForMultiTempoExpression(N,R,O){const U=u.Fraction.plus(N.AbsoluteTimestamp,R.Timestamp),H=this.graphicalMusicSheet.MeasureList[O];let W=new p.PointF2D;if(R.ContinuousTempo||R.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!H[0])return;let K=H[0].ParentStaffLine,q=H[0].PositionAndShape.RelativePosition.x,te=0;for(let se=0;se<H.length;se++)if(H[se].ParentStaffLine&&H[se].ParentStaffLine.Measures.length!==0&&H[se].ParentStaffLine.Measures.length>0){K=H[se].ParentStaffLine,q=H[se].PositionAndShape.RelativePosition.x,te=se;break}if(W=this.getRelativePositionInStaffLineFromTimestamp(U,te,K,K.isPartOfMultiStaffInstrument(),q),R.EntriesList.length>0&&R.EntriesList[0].Expression instanceof P.InstantaneousTempoExpression&&(R.EntriesList[0].Expression.Placement=k.PlacementEnum.Above,K.Measures[0].staffEntries.length>0&&Math.abs(W.x-K.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&K.ParentMusicSystem===this.musicSystems[0])){const se=K.Measures[0].FirstInstructionStaffEntry;if(se){const ue=se.GraphicalInstructions.last();W.x=ue.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(W.x=K.PositionAndShape.RelativePosition.x+K.Measures[0].PositionAndShape.RelativePosition.x)}for(const se of R.EntriesList){let ue=this.rules.TempoExpressionTextAlignment;this.rules.CompactMode&&(ue=y.TextAlignmentEnum.LeftBottom);const fe=this.calculateLabel(K,W,se.label,R.getFontstyleOfFirstEntry(),se.Expression.Placement,this.rules.UnknownTextHeight,ue,this.rules.TempoYSpacing);if(se.Expression.ColorXML&&this.rules.ExpressionsUseXMLColor&&(fe.ColorXML=se.Expression.ColorXML),se.Expression instanceof P.InstantaneousTempoExpression){for(const xe of K.AbstractExpressions)xe instanceof j.GraphicalInstantaneousTempoExpression&&(xe.SourceExpression.Label,se.Expression.Label);if(new j.GraphicalInstantaneousTempoExpression(se.Expression,fe).ParentStaffLine||v.default.warn("Adding staffline didn't work"),this.rules.MetronomeMarksDrawn&&se.Expression.TempoType===P.TempoType.metronomeMark){this.createMetronomeMark(se.Expression);continue}}else if(se.Expression instanceof G.ContinuousTempoExpression){for(const xe of K.AbstractExpressions)xe instanceof j.GraphicalInstantaneousTempoExpression&&(xe.SourceExpression.Label,se.Expression.Label);K.AbstractExpressions.push(new j.GraphicalInstantaneousTempoExpression(se.Expression,fe))}}}}createMetronomeMark(N){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(N){}clearSystemsAndMeasures(){for(let N=0,R=this.graphicalMusicSheet.MusicPages.length;N<R;++N){const O=this.graphicalMusicSheet.MusicPages[N];for(let U=0,H=O.MusicSystems.length;U<H;++U){const W=O.MusicSystems[U];for(let K=0,q=W.StaffLines.length;K<q;++K){const te=W.StaffLines[K];te.ParentStaff.Visible||te.Measures.clear();for(let se=0,ue=te.Measures.length;se<ue;++se){const fe=te.Measures[se];if(fe.FirstInstructionStaffEntry){const xe=fe.PositionAndShape.ChildElements.indexOf(fe.FirstInstructionStaffEntry.PositionAndShape);xe>-1&&fe.PositionAndShape.ChildElements.splice(xe,1),fe.FirstInstructionStaffEntry=void 0,fe.beginInstructionsWidth=0}if(fe.LastInstructionStaffEntry){const xe=fe.PositionAndShape.ChildElements.indexOf(fe.LastInstructionStaffEntry.PositionAndShape);xe>-1&&fe.PositionAndShape.ChildElements.splice(xe,1),fe.LastInstructionStaffEntry=void 0,fe.endInstructionsWidth=0}}te.Measures=[],te.PositionAndShape.ChildElements=[]}W.StaffLines.length=0,W.PositionAndShape.ChildElements=[]}O.MusicSystems=[],O.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(N,R,O,U,H,W,K,q,te,se=void 0,ue=void 0){N.StemDirectionXml!==h.StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&N.StemDirectionXml!==void 0?N.WantedStemDirection=N.StemDirectionXml:this.calculateStemDirectionFromVoices(N);const fe=R.findOrCreateGraphicalVoiceEntry(N);fe.octaveShiftValue=q;const xe=R.tabStaffEntry;let ve;xe&&(ve=xe.findOrCreateGraphicalVoiceEntry(N));for(let Se=0,ye=N.Notes.length;Se<ye;++Se){const be=N.Notes[Se];if(!be||ue!==void 0&&ue.Link!==void 0&&se!==void 0&&se.indexOf(be)>-1)continue;let Me;if(N.IsGrace?Me=ne.symbolFactory.createGraceNote(be,fe,H,this.rules,q):(Me=ne.symbolFactory.createNote(be,fe,H,q,this.rules,void 0),ne.stafflineNoteCalculator.trackNote(Me)),be.Pitch&&this.checkNoteForAccidental(Me,O,H,q),this.resetYPositionForLeadSheet(Me.PositionAndShape),R.addGraphicalNoteToListAtCorrectYPosition(fe,Me),Me.PositionAndShape.calculateBoundingBox(),this.leadSheet||(be.NoteBeam!==void 0&&be.PrintObject&&(be instanceof Q.TabNote&&!this.rules.TabBeamsRendered||this.handleBeam(Me,be.NoteBeam,K)),be.NoteTuplet!==void 0&&be.PrintObject&&this.handleTuplet(Me,be.NoteTuplet,W)),ve){const _e=ne.symbolFactory.createNote(be,ve,H,q,this.rules,void 0);xe.addGraphicalNoteToListAtCorrectYPosition(ve,_e),_e.PositionAndShape.calculateBoundingBox(),this.leadSheet||be.NoteTuplet&&this.handleTuplet(_e,be.NoteTuplet,W)}}return N.Articulations.length>0&&this.handleVoiceEntryArticulations(N.Articulations,N,R),N.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(N.TechnicalInstructions,N,R),N.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(N,R,U),N.OrnamentContainer&&this.handleVoiceEntryOrnaments(N.OrnamentContainer,N,R),q}resetYPositionForLeadSheet(N){this.leadSheet&&(N.RelativePosition=new p.PointF2D(N.RelativePosition.x,0))}layoutVoiceEntries(N,R){if(N.PositionAndShape.RelativePosition=new p.PointF2D(0,0),!this.leadSheet)for(const O of N.graphicalVoiceEntries){const U=O.notes;if(U.length===0)continue;const H=U[0].sourceNote.ParentVoiceEntry,W=U[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(H,U,N,W)}}maxInstrNameLabelLength(){var R;let N=0;for(const O of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if((R=O.NameLabel)!=null&&R.print&&O.Voices.length>0&&O.Voices[0].Visible){let U=O.NameLabel;this.rules.RenderPartNames||(U=new _.Label("",U.textAlignment,U.font));const H=new x.GraphicalLabel(U,this.rules.InstrumentLabelTextHeight,y.TextAlignmentEnum.LeftCenter,this.rules);H.setLabelPositionAndShapeBorders(),N=Math.max(N,H.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?N:0}calculateSheetLabelBoundingBoxes(){const N=this.graphicalMusicSheet.ParentMusicSheet,R=this.rules.DefaultColorTitle;if(N.Title!==void 0&&this.rules.RenderTitle){const O=new x.GraphicalLabel(N.Title,this.rules.SheetTitleHeight,y.TextAlignmentEnum.CenterBottom,this.rules);O.Label.IsCreditLabel=!0,O.Label.colorDefault=R,this.graphicalMusicSheet.Title=O,O.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(N.Subtitle!==void 0&&this.rules.RenderSubtitle){const O=new x.GraphicalLabel(N.Subtitle,this.rules.SheetSubtitleHeight,y.TextAlignmentEnum.CenterCenter,this.rules);O.Label.IsCreditLabel=!0,O.Label.colorDefault=R,this.graphicalMusicSheet.Subtitle=O,O.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(N.Composer!==void 0&&this.rules.RenderComposer){const O=new x.GraphicalLabel(N.Composer,this.rules.SheetComposerHeight,y.TextAlignmentEnum.RightCenter,this.rules);O.Label.IsCreditLabel=!0,O.Label.colorDefault=R,this.graphicalMusicSheet.Composer=O,O.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(N.Lyricist!==void 0&&this.rules.RenderLyricist){const O=new x.GraphicalLabel(N.Lyricist,this.rules.SheetAuthorHeight,y.TextAlignmentEnum.LeftCenter,this.rules);O.Label.IsCreditLabel=!0,O.Label.colorDefault=R,this.graphicalMusicSheet.Lyricist=O,O.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);if(N.Copyright!==void 0&&this.rules.RenderCopyright){const O=new x.GraphicalLabel(N.Copyright,this.rules.SheetCopyrightHeight,y.TextAlignmentEnum.CenterBottom,this.rules);O.Label.IsCreditLabel=!0,O.Label.colorDefault=R,this.graphicalMusicSheet.Copyright=O,O.setLabelPositionAndShapeBorders()}else this.rules.RenderCopyright||(this.graphicalMusicSheet.Copyright=void 0)}checkMeasuresForWholeRestNotes(){for(let N=0,R=this.musicSystems.length;N<R;++N){const O=this.musicSystems[N];for(let U=0,H=O.StaffLines.length;U<H;++U){const W=O.StaffLines[U];for(let K=0,q=W.Measures.length;K<q;++K){const te=W.Measures[K];if(te.staffEntries.length===1){const se=te.staffEntries[0];if(se.graphicalVoiceEntries.length>0&&se.graphicalVoiceEntries[0].notes.length===1){const ue=se.graphicalVoiceEntries[0].notes[0];!ue.sourceNote.Pitch&&new u.Fraction(1,2).lt(ue.sourceNote.Length)&&this.layoutMeasureWithWholeRest(ue,se,te)}}}}}}optimizeRestNotePlacement(N,R){if(N.graphicalVoiceEntries.length===0)return;const O=N.graphicalVoiceEntries[0].notes;if(O.length===0)return;const U=O[0],H=U.sourceNote.isRest();if(N.graphicalVoiceEntries.length===2){let W=!1;const K=N.graphicalVoiceEntries[1].notes;K.length>0&&(W=K[0].sourceNote.isRest()),H&&W?this.calculateTwoRestNotesPlacementWithCollisionDetection(N):(H||W)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(N)}else if(H&&N!==R.staffEntries[0]&&N!==R.staffEntries[R.staffEntries.length-1]){const W=R.staffEntries.indexOf(N),K=R.staffEntries[W-1],q=R.staffEntries[W+1];if(K.graphicalVoiceEntries.length===1){const te=K.graphicalVoiceEntries[0].notes[0];if(te.sourceNote.NoteBeam!==void 0&&q.graphicalVoiceEntries.length===1){const se=q.graphicalVoiceEntries[0].notes[0];se.sourceNote.NoteBeam!==void 0&&te.sourceNote.NoteBeam===se.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(N,U,te,q,se),N.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(N,R,O,U,H=0,W=!1){let K,q,te=new p.PointF2D;const se=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,ue=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(N),fe=Math.min(Math.floor(ue),se-1),xe=Math.min(Math.ceil(ue),se-1);if(fe<0||R<0)return te;if(K=this.getFirstLeftNotNullStaffEntryFromContainer(fe,R,U),q=this.getFirstRightNotNullStaffEntryFromContainer(xe,R,U),K&&q){let ve=K.parentMeasure.PositionAndShape.RelativePosition.x;H>0&&(ve=H);let Se=K.PositionAndShape.RelativePosition.x+ve,ye=q.PositionAndShape.RelativePosition.x+q.parentMeasure.PositionAndShape.RelativePosition.x;const be=N.RealValue>q.getAbsoluteTimestamp().RealValue;H>0?ye=q.PositionAndShape.RelativePosition.x+ve:W&&(K.getAbsoluteTimestamp().RealValue===N.RealValue||be)&&(Se=K.PositionAndShape.RelativePosition.x+K.PositionAndShape.BorderLeft+ve,ye=Se);let Me=0;if(K!==q){const _e=K.getAbsoluteTimestamp(),Te=q.getAbsoluteTimestamp();Me=u.Fraction.minus(N,_e).RealValue/u.Fraction.minus(Te,_e).RealValue}K.parentMeasure.ParentStaffLine!==q.parentMeasure.ParentStaffLine&&(K.parentMeasure.ParentStaffLine===O?ye=O.PositionAndShape.Size.width:Se=O.PositionAndShape.RelativePosition.x),te=new p.PointF2D(Se+(ye-Se)*Me,0)}return te}getRelativeXPositionFromTimestamp(N){const R=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,O=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(N),U=Math.max(0,Math.min(Math.round(O),R-1)),H=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U].getFirstNonNullStaffEntry();return H.PositionAndShape.RelativePosition.x+H.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(N){var te,se;this.rules.RenderSingleHorizontalStaffline&&(N.PositionAndShape.calculateBoundingBox([i.GraphicalMeasure.name]),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=N.PositionAndShape.Size.width);let R=10,O=-1;if(N.MusicSystems.length>0){const ue=N.MusicSystems[0];R=ue.PositionAndShape.RelativePosition.y+ue.PositionAndShape.BorderTop;const fe=N.MusicSystems[N.MusicSystems.length-1];O=fe.PositionAndShape.RelativePosition.y+fe.PositionAndShape.BorderBottom}const U=this.graphicalMusicSheet.Title;if(U&&this.rules.RenderTitle){U.PositionAndShape.Parent=N.PositionAndShape;const ue=new p.PointF2D;ue.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,this.rules.RenderSingleHorizontalStaffline&&(ue.x=Math.max(ue.x,U.PositionAndShape.Size.width)),ue.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,U.PositionAndShape.RelativePosition=ue,N.Labels.push(U)}if(this.graphicalMusicSheet.Subtitle&&this.rules.RenderTitle&&this.rules.RenderSubtitle){const ue=this.graphicalMusicSheet.Subtitle;ue.PositionAndShape.Parent=N.PositionAndShape;const fe=new p.PointF2D;fe.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,this.rules.RenderSingleHorizontalStaffline&&(fe.x=U.PositionAndShape.RelativePosition.x),fe.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle;const xe=(te=ue.TextLines)==null?void 0:te.length;xe>1&&(fe.y+=ue.PositionAndShape.BorderBottom*(xe-1)/xe),ue.PositionAndShape.RelativePosition=fe,N.Labels.push(ue)}const H=this.graphicalMusicSheet.Composer;let W;if(H&&this.rules.RenderComposer){H.PositionAndShape.Parent=N.PositionAndShape,H.setLabelPositionAndShapeBorders();const ue=new p.PointF2D;ue.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,ue.y=R,ue.y-=this.rules.SystemComposerDistance;const fe=(se=H.TextLines)==null?void 0:se.length;fe>1&&(ue.y-=H.PositionAndShape.BorderBottom*(fe-1)/fe),W=ue.y,H.PositionAndShape.RelativePosition=ue,N.Labels.push(H)}const K=this.graphicalMusicSheet.Lyricist;if(K&&this.rules.RenderLyricist){K.PositionAndShape.Parent=N.PositionAndShape,K.setLabelPositionAndShapeBorders();const ue=new p.PointF2D;ue.x=this.rules.PageLeftMargin,ue.y=R,ue.y-=this.rules.SystemLyricistDistance,ue.y+=K.PositionAndShape.BorderBottom,ue.y=Math.min(ue.y,W??Number.MAX_SAFE_INTEGER),K.PositionAndShape.RelativePosition=ue,N.Labels.push(K)}const q=this.graphicalMusicSheet.Copyright;if(q&&this.rules.RenderCopyright){q.PositionAndShape.Parent=N.PositionAndShape,q.setLabelPositionAndShapeBorders();const ue=new p.PointF2D;ue.x=N.PositionAndShape.Size.width/2,ue.y=O+this.rules.SheetCopyrightMargin,ue.y-=q.PositionAndShape.BorderTop,q.PositionAndShape.RelativePosition=ue,N.Labels.push(q)}this.rules.RenderSingleHorizontalStaffline&&(N.PositionAndShape.calculateBoundingBox([i.GraphicalMeasure.name]),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=N.PositionAndShape.Size.width)}createGraphicalTies(){for(let N=0;N<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;N++){const R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[N];for(let O=0;O<R.CompleteNumberOfStaves;O++)for(let U=0;U<R.VerticalSourceStaffEntryContainers.length;U++){const H=R.VerticalSourceStaffEntryContainers[U].StaffEntries[O];if(H){const W=this.graphicalMusicSheet.findGraphicalStaffEntryFromMeasureList(O,N,H);W&&(W.GraphicalTies.clear(),W.ties.clear());for(let K=0,q=H.VoiceEntries.length;K<q;++K){const te=H.VoiceEntries[K];for(let se=0,ue=te.Notes.length;se<ue;++se){const fe=te.Notes[se];if(fe.NoteTie){const xe=fe.NoteTie;if(fe===fe.NoteTie.Notes.last())continue;if(W)for(const ve of W.GraphicalTies)ve.Tie;this.handleTie(xe,W,O,N)}}}this.setTieDirections(W)}}}}handleTie(N,R,O,U){if(!R)return;R.ties.push(N);let H,W,K,q=R;for(let te=1;te<N.Notes.length;te++)if(H=q.findTieGraphicalNoteFromNote(N.Notes[te-1]),W=this.graphicalMusicSheet.GetGraphicalFromSourceStaffEntry(N.Notes[te].ParentStaffEntry),W){if(K=W.findTieGraphicalNoteFromNote(N.Notes[te]),H!==void 0&&K!==void 0&&W){if(!H.sourceNote.PrintObject||!K.sourceNote.PrintObject)continue;const se=this.createGraphicalTie(N,q,W,H,K);q.GraphicalTies.push(se),this.staffEntriesWithGraphicalTies.indexOf(q)>=0&&this.staffEntriesWithGraphicalTies.push(q)}q=W}}setTieDirections(N){if(!N)return;const R=N.ties;if(R.length===1){const O=R[0];if(O.TieDirection===k.PlacementEnum.NotYetDefined){const U=O.Notes[0].ParentVoiceEntry.ParentVoice.VoiceId;U!==2&&U!==6||(O.TieDirection=k.PlacementEnum.Below)}}if(R.length>1){let O;for(const U of R){const H=U.Notes[0];(!O||H.Pitch.getHalfTone()>O.Pitch.getHalfTone())&&(O=H)}for(const U of R)U.TieDirection===k.PlacementEnum.NotYetDefined&&(U.Notes[0]===O?U.TieDirection=k.PlacementEnum.Above:U.TieDirection=k.PlacementEnum.Below)}}createAccidentalCalculators(){var O;const N=[],R=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(R){const U=this.graphicalMusicSheet.ParentMusicSheet.Transpose;for(let H=0;H<R.CompleteNumberOfStaves;H++){const W=new I.AccidentalCalculator;if(N.push(W),W.Transpose=U,R.FirstInstructionsStaffEntries[H])for(let K=0,q=R.FirstInstructionsStaffEntries[H].Instructions.length;K<q;++K){const te=R.FirstInstructionsStaffEntries[H].Instructions[K];if(te instanceof d.KeyInstruction){const se=te,ue=new d.KeyInstruction(se.Parent,se.keyTypeOriginal,se.Mode),fe=this.graphicalMusicSheet.ParentMusicSheet.Staves[H];U!==0&&((O=fe==null?void 0:fe.ParentInstrument)==null?void 0:O.MidiInstrumentId)!==T.MidiInstrument.Percussion&&ne.transposeCalculator&&ne.transposeCalculator.transposeKey(ue,U),W.ActiveKeyInstruction=ue}}}}return N}calculateVerticalContainersList(){const N=this.graphicalMusicSheet.MeasureList[0].length;for(let R=0;R<this.graphicalMusicSheet.MeasureList.length;R++)for(let O=0;O<N;O++){const U=this.graphicalMusicSheet.MeasureList[R][O];if(U)for(let H=0,W=U.staffEntries.length;H<W;++H){const K=U.staffEntries[H],q=this.graphicalMusicSheet.getOrCreateVerticalContainer(K.getAbsoluteTimestamp());q&&(q.StaffEntries[O]=K,K.parentVerticalContainer=q)}}}setIndicesToVerticalGraphicalContainers(){for(let N=0;N<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;N++)this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[N].Index=N}createGraphicalMeasuresForSourceMeasure(N,R,O,U,H){this.initGraphicalMeasuresCreation();const W=[],K=[],q=[],te=[];let se=!0;for(let ue=0;ue<N.CompleteNumberOfStaves;ue++){const fe=this.createGraphicalMeasure(N,q,K,R[ue],H,U,O,ue,te);se=se&&fe.hasOnlyRests,W.push(fe)}return N.allRests=se,N.VerticalMeasureList=W,W}createGraphicalMeasure(N,R,O,U,H,W,K,q,te){var xe,ve,Se,ye,be,Me,_e;const se=this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(q);let ue;if(H[q].ClefType===o.ClefEnum.TAB||se.isTab)se.isTab=!0,ue=ne.symbolFactory.createTabStaffMeasure(N,se);else if(N.multipleRestMeasures&&this.rules.RenderMultipleRestMeasures)ue=ne.symbolFactory.createMultiRestMeasure(N,se);else{if(N.multipleRestMeasureNumber>1)return;ue=ne.symbolFactory.createGraphicalMeasure(N,se)}if(ue.hasError=N.getErrorInMeasure(q),N.FirstInstructionsStaffEntries[q])for(let Te=0,Le=N.FirstInstructionsStaffEntries[q].Instructions.length;Te<Le;++Te){const Pe=N.FirstInstructionsStaffEntries[q].Instructions[Te];if(Pe instanceof d.KeyInstruction){const Ae=new d.KeyInstruction(Pe.Parent,Pe.keyTypeOriginal,Pe.Mode),Ce=ue.getTransposedHalftones();Ce!==0&&ne.transposeCalculator===void 0&&v.default.info("[OSMD] transpose requested, but TransposeCalculator undefined. Use osmd.TransposeCalculator = new TransposeCalculator()"),Ce!==0&&ue.ParentStaff.ParentInstrument.MidiInstrumentId!==T.MidiInstrument.Percussion&&ne.transposeCalculator&&ne.transposeCalculator.transposeKey(Ae,Ce),U.ActiveKeyInstruction=Ae}}const fe=[];for(let Te=0,Le=N.StaffLinkedExpressions[q].length;Te<Le;++Te){const Pe=N.StaffLinkedExpressions[q][Te];let Ae;if(Pe.OctaveShiftStart?Ae=Pe.OctaveShiftStart:Pe.OctaveShiftEnd&&(Ae=Pe.OctaveShiftEnd),Ae){fe.push(Pe);const Ce=Ae;let Be=(xe=Ce==null?void 0:Ce.ParentEndMultiExpression)==null?void 0:xe.AbsoluteTimestamp;Ce!=null&&Ce.ParentEndMultiExpression||(Be=u.Fraction.plus(N.AbsoluteTimestamp,N.Duration)),W[q]=new L.OctaveShiftParams(Ce,Ce.ParentStartMultiExpression.AbsoluteTimestamp,Be)}}for(let Te=0;Te<N.VerticalSourceStaffEntryContainers.length;Te++){const Le=N.VerticalSourceStaffEntryContainers[Te].StaffEntries[q];if(Le){for(let Ie=0,Fe=Le.Instructions.length;Ie<Fe;++Ie){const Ke=Le.Instructions[Ie];Ke instanceof o.ClefInstruction&&((ve=H[q])==null?void 0:ve.ClefType)!==o.ClefEnum.TAB&&(H[q]=Ke)}const Pe=ne.symbolFactory.createStaffEntry(Le,ue);Te<ue.staffEntries.length?ue.addGraphicalStaffEntryAtTimestamp(Pe):ue.addGraphicalStaffEntry(Pe);const Ae=[];Le.Link&&(Le.findLinkedNotes(Ae),this.handleStaffEntryLink(Pe,te));let Ce,Be=n.OctaveEnum.NONE;if(W[q]&&W[q].getAbsoluteStartTimestamp.lte(Le.AbsoluteTimestamp)&&Le.AbsoluteTimestamp.lte(W[q].getAbsoluteEndTimestamp)&&(Be=W[q].getOpenOctaveShift.Type,Ce=W[q].getOpenOctaveShift),Be===n.OctaveEnum.NONE)for(const Ie of fe){let Fe;if(Ie.OctaveShiftStart?Fe=Ie.OctaveShiftStart:Ie.OctaveShiftEnd&&(Fe=Ie.OctaveShiftEnd),((Se=Fe==null?void 0:Fe.ParentStartMultiExpression)==null?void 0:Se.AbsoluteTimestamp.lte(Le.AbsoluteTimestamp))&&!((ye=Fe.ParentEndMultiExpression)!=null&&ye.AbsoluteTimestamp.lt(Le.AbsoluteTimestamp))){Be=Fe.Type,Ce=Fe;break}}for(let Ie=0,Fe=Le.VoiceEntries.length;Ie<Fe;++Ie){const Ke=Le.VoiceEntries[Ie];Be!==n.OctaveEnum.NONE&&Ce&&Ce.endVoiceEntryIndex>0&&((be=Ce.ParentEndMultiExpression)!=null&&be.AbsoluteTimestamp.Equals(Le.AbsoluteTimestamp))&&Ie>=Ce.endVoiceEntryIndex&&(Be=n.OctaveEnum.NONE,Ce=void 0),Be=this.handleVoiceEntry(Ke,Pe,U,K,H[q],R,O,Be,q,Ae,Le)}for(const Ie of Le.Instructions)if(Ie instanceof o.ClefInstruction){ne.symbolFactory.createInStaffClef(Pe,Ie);break}this.rules.RenderChordSymbols&&((Me=Le.ChordContainers)==null?void 0:Me.length)>0&&(Le.ParentStaff.ParentInstrument.HasChordSymbols=!0,ne.symbolFactory.createChordSymbols(Le,Pe,U.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(U.doCalculationsAtEndOfMeasure(),N.LastInstructionsStaffEntries[q]){const Te=N.LastInstructionsStaffEntries[q];for(let Le=0,Pe=Te.Instructions.length;Le<Pe;++Le){const Ae=Te.Instructions[Le];Ae instanceof o.ClefInstruction&&((_e=H[q])==null?void 0:_e.ClefType)!==o.ClefEnum.TAB&&(H[q]=Ae)}}for(let Te=0,Le=N.StaffLinkedExpressions[q].length;Te<Le;++Te){const Pe=N.StaffLinkedExpressions[q][Te];Pe.OctaveShiftEnd!==void 0&&W[q]!==void 0&&Pe.OctaveShiftEnd===W[q].getOpenOctaveShift&&(W[q]=void 0)}for(const Te of ue.staffEntries)for(const Le of Te.graphicalVoiceEntries)this.setBeamNotesWantedStemDirections(Le.parentVoiceEntry);if(this.rules.FillEmptyMeasuresWithWholeRest>=1&&ue.staffEntries.length===0){const Te=new m.SourceStaffEntry(new F.VerticalSourceStaffEntryContainer(ue.parentSourceMeasure,ue.parentSourceMeasure.AbsoluteTimestamp,ue.parentSourceMeasure.CompleteNumberOfStaves),se);if(se.Voices.length===0){const Fe=new $.Voice(ue.ParentStaff.ParentInstrument,-1);se.Voices.push(Fe)}const Le=new h.VoiceEntry(new u.Fraction(0,1),se.Voices[0],Te);let Pe=N.Duration;Pe.RealValue===0&&(Pe=N.ActiveTimeSignature.clone());const Ae=new r.Note(Le,Te,Pe,void 0,N,!0);Ae.IsWholeMeasureRest=!0,Ae.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===ie.FillEmptyMeasuresWithWholeRests.YesVisible,Le.Notes.push(Ae);const Ce=ne.symbolFactory.createStaffEntry(Te,ue);ue.addGraphicalStaffEntry(Ce),Ce.relInMeasureTimestamp=Le.Timestamp;const Be=ne.symbolFactory.createVoiceEntry(Le,Ce);Ce.graphicalVoiceEntries.push(Be);const Ie=ne.symbolFactory.createNote(Ae,Be,new o.ClefInstruction,n.OctaveEnum.NONE,this.rules);ne.stafflineNoteCalculator.trackNote(Ie),Be.notes.push(Ie)}ue.hasOnlyRests=!0;for(const Te of ue.staffEntries)if(ue.hasOnlyRests=Te.hasOnlyRests(),!ue.hasOnlyRests)break;return ue}checkNoteForAccidental(N,R,O,U){let H=N.sourceNote.Pitch;const W=N.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();W!==0&&N.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==T.MidiInstrument.Percussion?(H=N.Transpose(R.ActiveKeyInstruction,O,W,U),N.sourceNote.TransposedPitch=H):N.sourceNote.TransposedPitch=void 0,N.sourceNote.halfTone=H.getHalfTone(),R.checkAccidental(N,H)}handleStaffEntries(N){for(let R=0,O=this.graphicalMusicSheet.MeasureList.length;R<O;++R){const U=this.graphicalMusicSheet.MeasureList[R];for(let H=0,W=U.length;H<W;++H){const K=U[H];if(K){this.rules.PercussionOneLineCutoff>0&&!this.rules.PercussionUseCajon2NoteSystem&&N[H]&&(this.rules.PercussionOneLineCutoff===-1||ne.stafflineNoteCalculator.getStafflineUniquePositionCount(H)<this.rules.PercussionOneLineCutoff)&&(K.ParentStaff.StafflineCount=1);for(const q of K.staffEntries)q.parentMeasure!==void 0&&q.graphicalVoiceEntries.length>0&&q.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(q,H),this.layoutStaffEntry(q));this.graphicalMeasureCreatedCalculations(K)}}}}calculateSkyBottomLines(){}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let N=0,R=this.musicSystems.length;N<R;++N){const O=this.musicSystems[N];for(let U=0,H=O.StaffLines.length;U<H;++U){const W=O.StaffLines[U];for(let K=0,q=W.Measures.length;K<q;++K){const te=W.Measures[K];for(let se=0,ue=te.staffEntries.length;se<ue;++se){const fe=te.staffEntries[se];for(let xe=0,ve=fe.sourceStaffEntry.VoiceEntries.length;xe<ve;++xe){const Se=fe.sourceStaffEntry.VoiceEntries[xe];Se.Articulations.length>0&&this.layoutArticulationMarks(Se.Articulations,Se,fe)}}}}}}calculateOrnaments(){for(let N=0,R=this.musicSystems.length;N<R;++N){const O=this.musicSystems[N];for(let U=0,H=O.StaffLines.length;U<H;++U){const W=O.StaffLines[U];for(let K=0,q=W.Measures.length;K<q;++K){const te=W.Measures[K];for(let se=0,ue=te.staffEntries.length;se<ue;++se){const fe=te.staffEntries[se];for(let xe=0,ve=fe.sourceStaffEntry.VoiceEntries.length;xe<ve;++xe){const Se=fe.sourceStaffEntry.VoiceEntries[xe];if(Se.OrnamentContainer){if(Se.hasTie()&&!fe.relInMeasureTimestamp.Equals(Se.Timestamp))continue;this.layoutOrnament(Se.OrnamentContainer,Se,fe),this.staffEntriesWithOrnaments.indexOf(fe)===-1&&this.staffEntriesWithOrnaments.push(fe)}}}}}}}getFingeringPlacement(N){let R=this.rules.FingeringPosition;return R!==k.PlacementEnum.NotYetDefined&&R!==k.PlacementEnum.AboveOrBelow||(R=N.isUpperStaffOfInstrument()?k.PlacementEnum.Above:k.PlacementEnum.Below),R}calculateFingerings(){var N,R;if(this.rules.FingeringPosition!==k.PlacementEnum.Left&&this.rules.FingeringPosition!==k.PlacementEnum.Right)for(const O of this.musicSystems)for(const U of O.StaffLines)for(const H of U.Measures){if(H.isTabMeasure&&!this.rules.TabFingeringsRendered)continue;const W=this.getFingeringPlacement(H);for(const K of H.staffEntries){K.FingeringEntries=[];const q=U.SkyBottomLineCalculator,te=K.PositionAndShape.RelativePosition.x+H.PositionAndShape.RelativePosition.x,se=[];for(const ue of K.graphicalVoiceEntries)if(!ue.parentVoiceEntry.IsGrace)for(const fe of ue.parentVoiceEntry.TechnicalInstructions)fe.type===S.TechnicalInstructionType.Fingering&&se.push(fe);if(se.length>0){let ue;W===k.PlacementEnum.Below&&se.reverse();for(const fe of K.graphicalVoiceEntries)for(const xe of fe.notes)(!ue||((N=xe.sourceNote.Pitch)==null?void 0:N.getHalfTone())>((R=ue.Pitch)==null?void 0:R.getHalfTone()))&&(ue=xe.sourceNote);se[0].sourceNote===ue&&W===k.PlacementEnum.Above&&se.reverse()}for(let ue=0;ue<se.length;ue++){const fe=se[ue],xe=W===k.PlacementEnum.Above?y.TextAlignmentEnum.CenterBottom:y.TextAlignmentEnum.CenterTop,ve=new _.Label(fe.value,xe),Se=new x.GraphicalLabel(ve,this.rules.FingeringTextSize,ve.textAlignment,this.rules,U.PositionAndShape);fe.fontFamily&&(ve.fontFamily=fe.fontFamily);const ye=te+Se.PositionAndShape.BorderMarginLeft,be=te+Se.PositionAndShape.BorderMarginRight;let Me;Me=W===k.PlacementEnum.Above?q.getSkyLineMinInRange(ye,be):q.getBottomLineMaxInRange(ye,be);let _e=0;ue===0?(_e+=this.rules.FingeringOffsetY,W===k.PlacementEnum.Above&&(_e+=.1)):_e+=this.rules.FingeringPaddingY,W===k.PlacementEnum.Above&&(_e*=-1),Se.PositionAndShape.RelativePosition.y+=Me+_e,Se.PositionAndShape.RelativePosition.x=te,Se.setLabelPositionAndShapeBorders(),Se.PositionAndShape.calculateBoundingBox(),K.FingeringEntries.push(Se);const Te=Se.PositionAndShape.RelativePosition.x+Se.PositionAndShape.BorderLeft,Le=Te-Se.PositionAndShape.BorderLeft+Se.PositionAndShape.BorderRight;W===k.PlacementEnum.Above?q.updateSkyLineInRange(Te,Le,Se.PositionAndShape.RelativePosition.y+Se.PositionAndShape.BorderTop):W===k.PlacementEnum.Below&&q.updateBottomLineInRange(Te,Le,Se.PositionAndShape.RelativePosition.y+Se.PositionAndShape.BorderBottom)}}}}optimizeRestPlacement(){for(let N=0,R=this.musicSystems.length;N<R;++N){const O=this.musicSystems[N];for(let U=0,H=O.StaffLines.length;U<H;++U){const W=O.StaffLines[U];for(let K=0,q=W.Measures.length;K<q;++K){const te=W.Measures[K];for(let se=0,ue=te.staffEntries.length;se<ue;++se){const fe=te.staffEntries[se];this.optimizeRestNotePlacement(fe,te)}}}}}calculateTwoRestNotesPlacementWithCollisionDetection(N){const R=N.graphicalVoiceEntries[0].notes[0],O=N.graphicalVoiceEntries[1].notes[0];O.PositionAndShape.RelativePosition=new p.PointF2D(0,2.5),N.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement(),R.PositionAndShape.computeNonOverlappingPositionWithMargin(N.PositionAndShape,E.ColDirEnum.Up,new p.PointF2D(0,O.PositionAndShape.RelativePosition.y));const U=R.PositionAndShape.RelativePosition;U.y-=1,R.PositionAndShape.RelativePosition=U,N.PositionAndShape.calculateBoundingBox()}calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(N){let R,O;N.graphicalVoiceEntries[0].notes[0].sourceNote.isRest()?(R=N.graphicalVoiceEntries[0].notes[0],O=N.graphicalVoiceEntries[1].notes):(O=N.graphicalVoiceEntries[0].notes,R=N.graphicalVoiceEntries[1].notes[0]);let U=!1;N.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement();for(let H=0,W=O.length;H<W;++H){const K=O[H];if(R.PositionAndShape.marginCollisionDetection(K.PositionAndShape)){U=!0;break}}if(U)if(R.sourceNote.ParentVoiceEntry.ParentVoice instanceof M.LinkedVoice){const H=O[0].PositionAndShape.BorderMarginBottom+O[0].PositionAndShape.RelativePosition.y;R.PositionAndShape.RelativePosition=new p.PointF2D(0,H-R.PositionAndShape.BorderMarginTop+.5)}else{const H=O[O.length-1],W=H.PositionAndShape.BorderMarginTop+H.PositionAndShape.RelativePosition.y;if(O[0].sourceNote.ParentVoiceEntry.ParentVoice instanceof M.LinkedVoice)R.PositionAndShape.RelativePosition=new p.PointF2D(0,W-R.PositionAndShape.BorderMarginBottom-.5);else{const K=O[0].PositionAndShape.BorderMarginBottom+O[0].PositionAndShape.RelativePosition.y;R.PositionAndShape.RelativePosition=K<2?new p.PointF2D(0,K-R.PositionAndShape.BorderMarginTop+.5):new p.PointF2D(0,W-R.PositionAndShape.BorderMarginBottom-0)}}N.PositionAndShape.calculateBoundingBox()}calculateTieCurves(){for(const N of this.musicSystems)for(const R of N.StaffLines)for(const O of R.Measures)for(const U of O.staffEntries)for(const H of U.GraphicalTies)if(H.StartNote!==void 0&&H.StartNote.parentVoiceEntry.parentStaffEntry===U){const W=H.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine!==H.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine;this.layoutGraphicalTie(H,W,O.ParentStaff.isTab)}}calculateLyricsPosition(){const N=new B.Dictionary;for(let R=0,O=this.graphicalMusicSheet.ParentMusicSheet.Instruments.length;R<O;++R){const U=this.graphicalMusicSheet.ParentMusicSheet.Instruments[R];U.HasLyrics&&U.LyricVersesNumbers.length>0&&U.LyricVersesNumbers.sort()}for(let R=0,O=this.musicSystems.length;R<O;++R){const U=this.musicSystems[R];for(let H=0,W=U.StaffLines.length;H<W;++H){const K=U.StaffLines[H],q=this.calculateSingleStaffLineLyricsPosition(K,K.ParentStaff.ParentInstrument.LyricVersesNumbers);N.setValue(K,q),this.calculateLyricsExtendsAndDashes(N.getValue(K))}}for(let R=0,O=this.musicSystems.length;R<O;++R){const U=this.musicSystems[R];for(let H=0,W=U.StaffLines.length;H<W;++H){const K=U.StaffLines[H];this.calculateLyricsExtendsAndDashes(N.getValue(K))}}}calculateSingleLyricWord(N){const R=N.ParentLyricWord,O=R.GraphicalLyricsEntries.indexOf(N);let U;if(O>=0&&(U=R.GraphicalLyricsEntries[O+1]),!U)return;const H=N.StaffEntryParent.parentMeasure.ParentStaffLine,W=U.StaffEntryParent.parentMeasure.ParentStaffLine,K=N.StaffEntryParent,q=U.StaffEntryParent;if(N.StaffEntryParent.parentMeasure.ParentStaffLine===U.StaffEntryParent.parentMeasure.ParentStaffLine){const te=K.parentMeasure.PositionAndShape.RelativePosition.x+K.PositionAndShape.RelativePosition.x+N.GraphicalLabel.PositionAndShape.RelativePosition.x+N.GraphicalLabel.PositionAndShape.BorderMarginRight-N.GraphicalLabel.CenteringXShift,se=q.parentMeasure.PositionAndShape.RelativePosition.x+q.PositionAndShape.RelativePosition.x+N.GraphicalLabel.PositionAndShape.RelativePosition.x+U.GraphicalLabel.PositionAndShape.BorderMarginLeft,ue=N.GraphicalLabel.PositionAndShape.RelativePosition.y;let fe=1;se-te>3*this.rules.MinimumDistanceBetweenDashes&&(fe=Math.floor((se-te)/this.rules.MinimumDistanceBetweenDashes)-1),fe===1?this.calculateSingleDashForLyricWord(H,te,se,ue):this.calculateDashes(H,te,se,ue)}else{const te=K.parentMeasure.PositionAndShape.RelativePosition.x+K.PositionAndShape.RelativePosition.x+N.GraphicalLabel.PositionAndShape.BorderMarginRight,se=H.Measures[H.Measures.length-1],ue=se.PositionAndShape.RelativePosition.x+se.PositionAndShape.Size.width;let fe=N.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(H,te,ue,fe),W&&W.Measures[0]&&q.parentMeasure.ParentStaffLine&&(q!==q.parentMeasure.staffEntries[0]||q.parentMeasure!==q.parentMeasure.ParentStaffLine.Measures[0])){const xe=W.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,ve=q.parentMeasure.PositionAndShape.RelativePosition.x+q.PositionAndShape.RelativePosition.x+U.GraphicalLabel.PositionAndShape.BorderMarginLeft;fe=U.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(W,xe,ve,fe)}}}calculateDashes(N,R,O,U){let H=O-R;if(H<3*this.rules.MinimumDistanceBetweenDashes)this.calculateSingleDashForLyricWord(N,R,O,U);else{const W=Math.floor(H/this.rules.MinimumDistanceBetweenDashes)-1,K=H/(W+1);let q=0;for(R+=K,O-=K;q<=Math.floor(W/2)&&O>R;)H=this.calculateRightAndLeftDashesForLyricWord(N,R,O,U),R+=K,O-=K,q++;H>2*K&&this.calculateSingleDashForLyricWord(N,R,O,U)}}calculateSingleDashForLyricWord(N,R,O,U){const H=new _.Label("-");H.colorDefault=this.rules.DefaultColorLyrics;let W=this.rules.LyricsHeight;O-R<.8&&(W*=.8,U-=.1*W);const K=new x.GraphicalLabel(H,W,y.TextAlignmentEnum.CenterBottom,this.rules);K.setLabelPositionAndShapeBorders(),N.LyricsDashes.push(K),this.staffLinesWithLyricWords.indexOf(N)===-1&&this.staffLinesWithLyricWords.push(N),K.PositionAndShape.Parent=N.PositionAndShape;const q=new p.PointF2D(R+(O-R)/2,U);K.PositionAndShape.RelativePosition=q}calculateLyricExtend(N){let R=N.GraphicalLabel.PositionAndShape.RelativePosition.y;const O=N.StaffEntryParent,U=O.parentMeasure.ParentStaffLine;let H,W;const K=O.parentMeasure.ParentStaff.idInMusicSheet;if(O.parentVerticalContainer){for(let q=O.parentVerticalContainer.Index+1;q<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;++q){const te=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[q].StaffEntries[K];if(te){if(te.hasOnlyRests()||te.LyricsEntries.length>0)break;H=te,W=H.parentMeasure.ParentStaffLine,W||(W=O.parentMeasure.ParentStaffLine)}}if(H&&W)if(U===W&&H.parentMeasure.ParentStaffLine){const q=O.parentMeasure.PositionAndShape.RelativePosition.x+O.PositionAndShape.RelativePosition.x+N.GraphicalLabel.PositionAndShape.BorderMarginRight,te=H.parentMeasure.PositionAndShape.RelativePosition.x+H.PositionAndShape.RelativePosition.x+H.PositionAndShape.BorderMarginRight;R-=N.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(U,q,te,R)}else{const q=U.Measures[U.Measures.length-1].PositionAndShape,te=O.parentMeasure.PositionAndShape.RelativePosition.x+O.PositionAndShape.RelativePosition.x+N.GraphicalLabel.PositionAndShape.BorderMarginRight,se=q.RelativePosition.x+q.Size.width;if(R-=N.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(U,te,se,R),!H)return;if(H.parentMeasure.ParentStaffLine&&H.parentMeasure.staffEntries&&(H!==H.parentMeasure.staffEntries[0]||H.parentMeasure!==H.parentMeasure.ParentStaffLine.Measures[0])){const ue=W.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,fe=H.parentMeasure.PositionAndShape.RelativePosition.x+H.PositionAndShape.RelativePosition.x+H.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(W,ue,fe,R)}}}}calculateSingleLyricWordWithUnderscore(N,R,O,U){const H=new p.PointF2D(R,U),W=new p.PointF2D(O,U),K=new D.GraphicalLine(H,W,this.rules.LyricUnderscoreLineWidth);K.colorHex=this.rules.DefaultColorLyrics,N.LyricLines.push(K),this.staffLinesWithLyricWords.indexOf(N)===-1&&this.staffLinesWithLyricWords.push(N)}calculateRightAndLeftDashesForLyricWord(N,R,O,U){const H=new _.Label("-");H.colorDefault=this.rules.DefaultColorLyrics;const W=new x.GraphicalLabel(H,this.rules.LyricsHeight,y.TextAlignmentEnum.CenterBottom,this.rules);W.setLabelPositionAndShapeBorders(),N.LyricsDashes.push(W),this.staffLinesWithLyricWords.indexOf(N)===-1&&this.staffLinesWithLyricWords.push(N),W.PositionAndShape.Parent=N.PositionAndShape;const K=new p.PointF2D(R,U);W.PositionAndShape.RelativePosition=K;const q=new _.Label("-"),te=new x.GraphicalLabel(q,this.rules.LyricsHeight,y.TextAlignmentEnum.CenterBottom,this.rules);te.setLabelPositionAndShapeBorders(),N.LyricsDashes.push(te),te.PositionAndShape.Parent=N.PositionAndShape;const se=new p.PointF2D(O,U);return te.PositionAndShape.RelativePosition=se,te.PositionAndShape.RelativePosition.x-W.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const N=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex);for(let R=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);R<=N;R++){const O=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[R];this.dynamicExpressionMap.clear();for(let U=0;U<O.StaffLinkedExpressions.length;U++)if(this.graphicalMusicSheet.MeasureList[R]&&this.graphicalMusicSheet.MeasureList[R][U]&&this.graphicalMusicSheet.MeasureList[R][U].ParentStaff.isVisible())for(let H=0;H<O.StaffLinkedExpressions[U].length;H++)(O.StaffLinkedExpressions[U][H].InstantaneousDynamic!==void 0||O.StaffLinkedExpressions[U][H].StartingContinuousDynamic!==void 0&&O.StaffLinkedExpressions[U][H].StartingContinuousDynamic.StartMultiExpression===O.StaffLinkedExpressions[U][H]&&O.StaffLinkedExpressions[U][H].UnknownList.length===0)&&this.calculateDynamicExpressionsForMultiExpression(O.StaffLinkedExpressions[U][H],R,U)}this.dynamicExpressionMap.clear()}calculateOctaveShifts(){for(let N=0;N<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;N++){const R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[N];for(let O=0;O<R.StaffLinkedExpressions.length;O++)if(this.graphicalMusicSheet.MeasureList[N]&&this.graphicalMusicSheet.MeasureList[N][O]&&this.graphicalMusicSheet.MeasureList[N][O].ParentStaff.isVisible())for(let U=0;U<R.StaffLinkedExpressions[O].length;U++)R.StaffLinkedExpressions[O][U].OctaveShiftStart&&this.calculateSingleOctaveShift(R,R.StaffLinkedExpressions[O][U],N,O)}}calculatePedals(){for(let N=0;N<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;N++){const R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[N];for(let O=0;O<R.StaffLinkedExpressions.length;O++)if(this.graphicalMusicSheet.MeasureList[N]&&this.graphicalMusicSheet.MeasureList[N][O]&&this.graphicalMusicSheet.MeasureList[N][O].ParentStaff.isVisible())for(let U=0;U<R.StaffLinkedExpressions[O].length;U++)R.StaffLinkedExpressions[O][U].PedalStart&&this.calculateSinglePedal(R,R.StaffLinkedExpressions[O][U],N,O)}}calculateWavyLines(){for(let N=0;N<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;N++){const R=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[N];for(let O=0;O<R.StaffLinkedExpressions.length;O++)if(this.graphicalMusicSheet.MeasureList[N]&&this.graphicalMusicSheet.MeasureList[N][O]&&this.graphicalMusicSheet.MeasureList[N][O].ParentStaff.isVisible())for(let U=0;U<R.StaffLinkedExpressions[O].length;U++)R.StaffLinkedExpressions[O][U].WavyLineStart&&this.calculateSingleWavyLine(R,R.StaffLinkedExpressions[O][U],N,O)}}getFirstLeftNotNullStaffEntryFromContainer(N,R,O){if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[N].StaffEntries[R])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[N].StaffEntries[R];for(let U=N-1;U>=0;U--)if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U].StaffEntries[R])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U].StaffEntries[R]}getFirstRightNotNullStaffEntryFromContainer(N,R,O){if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[N].StaffEntries[R])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[N].StaffEntries[R];for(let U=N+1;U<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;U++)if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U].StaffEntries[R])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[U].StaffEntries[R]}calculateWordRepetitionInstructions(){const N=[];for(let R=0;R<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;R++){const O=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[R];let U,H=!1,W=!1;for(const K of O.FirstRepetitionInstructions)K.type===t.RepetitionInstructionEnum.Ending&&K.alignment===t.AlignmentType.Begin&&(H=!0,U=K.endingIndices);for(const K of O.LastRepetitionInstructions)K.type!==t.RepetitionInstructionEnum.Ending||K.alignment!==t.AlignmentType.End&&K.alignment!==t.AlignmentType.Discontinue||(W=!0);H&&N.push({startMeasure:R,endingIndices:U});for(let K=0,q=O.FirstRepetitionInstructions.length;K<q;++K){const te=O.FirstRepetitionInstructions[K];this.calculateWordRepetitionInstruction(te,R)}for(let K=0,q=O.LastRepetitionInstructions.length;K<q;++K){const te=O.LastRepetitionInstructions[K];this.calculateWordRepetitionInstruction(te,R)}if(!H&&!W&&N.length>0){const K=N[N.length-1];if(R>K.startMeasure){const q=new t.RepetitionInstruction(R,t.RepetitionInstructionEnum.Ending,t.AlignmentType.Mid,void 0,K.endingIndices);this.calculateWordRepetitionInstruction(q,R)}}W&&N.length>0&&N.pop()}}calculateRepetitionEndings(){const N=this.graphicalMusicSheet.ParentMusicSheet;for(let R=0,O=N.Repetitions.length;R<O;++R){const U=N.Repetitions[R];this.calcGraphicalRepetitionEndingsRecursively(U)}}calculateTempoExpressions(){const N=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex);for(let R=this.rules.MinMeasureToDrawIndex;R<=N;R++){const O=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[R];for(let U=0;U<O.TempoExpressions.length;U++)this.calculateTempoExpressionsForMultiTempoExpression(O,O.TempoExpressions[U],R)}}calculateRehearsalMarks(){if(this.rules.RenderRehearsalMarks)for(const N of this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures)this.calculateRehearsalMark(N)}calculateRehearsalMark(N){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMoodAndUnknownExpressions(){var N;for(let R=0;R<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;R++){const O=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[R];for(let U=0;U<O.StaffLinkedExpressions.length;U++){if(!this.graphicalMusicSheet.MeasureList[R]||!this.graphicalMusicSheet.MeasureList[R][U])continue;let H=U;if(!this.graphicalMusicSheet.MeasureList[R][U].ParentStaff.isVisible()){if(U!==0)continue;{let W=!1;for(let K=0;K<this.graphicalMusicSheet.MeasureList[R].length;K++)if((N=this.graphicalMusicSheet.MeasureList[R][K])!=null&&N.ParentStaff.isVisible()){H=K,W=!0;break}if(!W)continue}}for(let W=0;W<O.StaffLinkedExpressions[U].length;W++)(O.StaffLinkedExpressions[U][W].MoodList.length>0||O.StaffLinkedExpressions[U][W].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(O.StaffLinkedExpressions[U][W],R,H)}}}calculateStemDirectionFromVoices(N){if(N.ParentSourceStaffEntry.Link!==void 0)return N===N.ParentSourceStaffEntry.VoiceEntries[0]?void(N.WantedStemDirection=h.StemDirectionType.Up):void(N.WantedStemDirection=h.StemDirectionType.Down);N.ParentVoice instanceof M.LinkedVoice?N.WantedStemDirection=h.StemDirectionType.Down:N.ParentSourceStaffEntry.VoiceEntries.length>1&&(N.WantedStemDirection=h.StemDirectionType.Up)}setBeamNotesWantedStemDirections(N){var O;if(!(N.Notes.length>0))return;const R=N.Notes[0].NoteBeam;if(R){for(const U of R.Notes)if(((O=U.Notehead)==null?void 0:O.Shape)!==A.NoteHeadShape.NONE&&U.ParentVoiceEntry.WantedStemDirection!==h.StemDirectionType.Undefined&&U.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===N.ParentSourceStaffEntry.ParentStaff.Id){N.WantedStemDirection=U.ParentVoiceEntry.WantedStemDirection;break}}}}g.MusicSheetCalculator=ne},1932(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSheetDrawer=void 0;const l=c(6438),s=c(2683),u=c(6452),r=c(200),i=c(9409),o=c(8254),n=c(7435),h=c(7533),t=c(7307),f=c(4284),p=c(512),m=c(242),x=c(7499),y=c(298);g.MusicSheetDrawer=class{constructor(d,S){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=m.PhonicScoreModes.Manual,this.textMeasurer=d,this.splitScreenLineColor=-1,this.drawingParameters=S,this.rules=S.Rules}set Mode(d){this.phonicScoreMode=d}drawSheet(d){if(this.graphicalMusicSheet=d,this.rules=d.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(const M of d.Cursors){if(!M)continue;const E=new l.BoundingBox(M);E.AbsolutePosition=M.Start,E.BorderBottom=M.End.y-M.Start.y,E.BorderRight=M.Width/2,E.BorderLeft=-M.Width/2,this.isVisible(E)&&this.drawLineAsVerticalRectangle(M,s.GraphicalLayers.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const S=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let M=0;M<S;M++){const E=this.graphicalMusicSheet.MusicPages[M];this.drawPage(E)}}drawLineAsHorizontalRectangle(d,S){let M=new r.RectangleF2D(d.Start.x,d.End.y-d.Width/2,d.End.x-d.Start.x,d.Width);M=this.applyScreenTransformationForRect(M),this.renderRectangle(M,S,d.styleId,d.colorHex)}drawLineAsVerticalRectangle(d,S){const M=d.Start,E=d.Width;let L=new r.RectangleF2D(M.x-E/2,M.y,E,d.End.y-M.y);L=this.applyScreenTransformationForRect(L),this.renderRectangle(L,S,d.styleId)}drawLineAsHorizontalRectangleWithOffset(d,S,M){const E=new i.PointF2D(d.Start.x+S.x,d.Start.y+S.y),L=new i.PointF2D(d.End.x+S.x,d.End.y+S.y),I=d.Width;let T=new r.RectangleF2D(E.x,L.y-I/2,L.x-E.x,I);T=this.applyScreenTransformationForRect(T),this.renderRectangle(T,M,d.styleId)}drawLineAsVerticalRectangleWithOffset(d,S,M){const E=new i.PointF2D(d.Start.x+S.x,d.Start.y+S.y),L=new i.PointF2D(d.End.x+S.x,d.End.y+S.y),I=d.Width;let T=new r.RectangleF2D(E.x,E.y,I,L.y-E.y);T=this.applyScreenTransformationForRect(T),this.renderRectangle(T,M,d.styleId)}drawRectangle(d,S){const M=d.PositionAndShape;let E=new r.RectangleF2D(M.AbsolutePosition.x,M.AbsolutePosition.y,M.BorderRight,M.BorderBottom);E=this.applyScreenTransformationForRect(E),this.renderRectangle(E,S,d.style)}calculatePixelDistance(d){throw new Error("not implemented")}drawLabel(d,S){if(!this.isVisible(d.PositionAndShape))return;const M=d.Label;if(M.text.trim()==="")return;const E=this.applyScreenTransformation(d.PositionAndShape.AbsolutePosition),L=this.calculatePixelDistance(M.fontHeight),I=this.calculatePixelDistance(d.PositionAndShape.Size.width),T=Math.ceil(I),A=Math.ceil(L*(.2+d.TextLines.length));switch(M.textAlignment){case h.TextAlignmentEnum.LeftTop:break;case h.TextAlignmentEnum.LeftCenter:E.y-=A/2;break;case h.TextAlignmentEnum.LeftBottom:E.y-=A;break;case h.TextAlignmentEnum.CenterTop:E.x-=T/2;break;case h.TextAlignmentEnum.CenterCenter:E.x-=T/2,E.y-=A/2;break;case h.TextAlignmentEnum.CenterBottom:E.x-=T/2,E.y-=A;break;case h.TextAlignmentEnum.RightTop:E.x-=T;break;case h.TextAlignmentEnum.RightCenter:E.x-=T,E.y-=A/2;break;case h.TextAlignmentEnum.RightBottom:E.x-=T,E.y-=A;break;default:throw new t.ArgumentOutOfRangeException("")}return this.renderLabel(d,S,T,A,L,E)}applyScreenTransformation(d){throw new Error("not implemented")}applyScreenTransformations(d){const S=[];for(const M of d)S.push(this.applyScreenTransformation(M));return S}applyScreenTransformationForRect(d){throw new Error("not implemented")}drawSplitScreenLine(){}renderRectangle(d,S,M,E=void 0,L=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(d){}drawSelectionEndSymbol(d){}renderLabel(d,S,M,E,L,I){throw new Error("not implemented")}renderSystemToScreen(d,S,M){}drawMeasure(d){throw new Error("not implemented")}drawSkyLine(d){}drawBottomLine(d){}drawInstrumentBrace(d,S){}drawGroupBracket(d,S){}isVisible(d){return!0}drawMusicSystem(d){const S=this.getSystemAbsBoundingRect(d),M=this.getSytemBoundingBoxInPixels(S);this.drawMusicSystemComponents(d,M,S)}getSytemBoundingBoxInPixels(d){const S=this.applyScreenTransformationForRect(d);return S.x=Math.round(S.x),S.y=Math.round(S.y),S}getSystemAbsBoundingRect(d){const S=d.PositionAndShape.BoundingRectangle;return new r.RectangleF2D(d.PositionAndShape.AbsolutePosition.x+d.PositionAndShape.BorderLeft-1,d.PositionAndShape.AbsolutePosition.y+d.PositionAndShape.BorderTop-1,S.width+6,S.height+2)}drawMusicSystemComponents(d,S,M){var A,v;const E=this.graphicalMusicSheet.SelectionStartSymbol,L=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&E!==void 0&&this.isVisible(E.PositionAndShape)&&this.drawSelectionStartSymbol(E),this.drawingParameters.drawSelectionEndSymbol&&L!==void 0&&this.isVisible(L.PositionAndShape)&&this.drawSelectionEndSymbol(L);for(const B of d.StaffLines)this.drawStaffLine(B),this.rules.RenderLyrics&&(B.LyricsDashes.length>0&&this.drawDashes(B.LyricsDashes),B.LyricLines.length>0&&this.drawLyricLines(B.LyricLines,B));for(const B of d.SystemLines)this.drawSystemLineObject(B);if(this.rules.RenderSystemLabelsAfterFirstPage||d.Parent===d.Parent.Parent.MusicPages[0])for(const B of d.Labels)B.SVGNode=this.drawLabel(B,s.GraphicalLayers.Notes);const I=this.graphicalMusicSheet.ParentMusicSheet.Instruments,T=I.filter(B=>B.isVisible()).length;for(const B of d.InstrumentBrackets)this.drawInstrumentBrace(B,d);if(I.length>0)if(T>1)for(const B of d.GroupBrackets)this.drawGroupBracket(B,d);else for(const B of d.GroupBrackets)B.Visible=!1;if(!this.leadSheet)for(const B of d.MeasureNumberLabels)B.SVGNode=this.drawLabel(B,s.GraphicalLayers.Notes),(v=(A=B.SVGNode)==null?void 0:A.classList)==null||v.add("measure-number");for(const B of d.StaffLines)this.drawStaffLineSymbols(B);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(d),this.drawingParameters.drawComments&&this.drawComment(d)}activateSystemRendering(d,S,M,E){return!0}drawSystemLineObject(d){}drawStaffLine(d){for(const S of d.Measures)this.drawMeasure(S);this.rules.RenderLyrics&&d.LyricsDashes.length>0&&this.drawDashes(d.LyricsDashes),this.drawOctaveShifts(d),this.drawPedals(d),this.drawWavyLines(d),this.drawExpressions(d),this.skyLineVisible&&this.drawSkyLine(d),this.bottomLineVisible&&this.drawBottomLine(d)}drawLyricLines(d,S){S.LyricLines.forEach(M=>{M.Start.y+=S.PositionAndShape.AbsolutePosition.y,M.End.y+=S.PositionAndShape.AbsolutePosition.y,M.Start.x+=S.PositionAndShape.AbsolutePosition.x,M.End.x+=S.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(M,this.rules.LyricUnderscoreLineWidth,M.colorHex)})}drawExpressions(d){}drawGraphicalLine(d,S,M="black"){return this.drawLine(d.Start,d.End,M,S)}drawLine(d,S,M="#FF0000FF",E){}drawDashes(d){d.forEach(S=>{var M;S.SVGNode=this.drawLabel(S,s.GraphicalLayers.Notes),(M=S.SVGNode)==null||M.classList.add("dash")})}drawOctaveShifts(d){}drawStaffLines(d){if(d.StaffLines){const S=d.PositionAndShape.AbsolutePosition;for(let M=0;M<5;M++)this.drawLineAsHorizontalRectangleWithOffset(d.StaffLines[M],S,s.GraphicalLayers.Notes)}}drawInstantaneousDynamic(d){throw new Error("not implemented")}drawContinuousDynamic(d){throw new Error("not implemented")}drawSymbol(d,S,M,E=1,L=s.GraphicalLayers.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(d){this.graphicalMusicSheet.LeadSheet=d}drawPage(d){if(this.isVisible(d.PositionAndShape)){for(const S of d.MusicSystems)this.isVisible(S.PositionAndShape)&&this.drawMusicSystem(S);if(d===d.Parent.MusicPages[0])for(const S of d.Labels)S.SVGNode=this.drawLabel(S,s.GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(d.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(d,S=0,M="all",E=!1){const L=d.DataObject.constructor.name;let I=!1;if(M==="all"?I=!0:M==="VexFlowStaffEntry"?I=d.DataObject instanceof x.VexFlowStaffEntry:M==="VexFlowMeasure"?I=d.DataObject instanceof x.VexFlowMeasure:M==="VexFlowGraphicalNote"?I=d.DataObject instanceof x.VexFlowGraphicalNote:M==="VexFlowVoiceEntry"?I=d.DataObject instanceof x.VexFlowVoiceEntry:M==="GraphicalLabel"?I=d.DataObject instanceof o.GraphicalLabel:M==="VexFlowStaffLine"?I=d.DataObject instanceof x.VexFlowStaffLine:M==="SystemLine"?I=d.DataObject instanceof f.SystemLine:M==="StaffLineActivitySymbol"?I=d.DataObject instanceof y.StaffLineActivitySymbol:M==="VexFlowContinuousDynamicExpression"&&(I=d.DataObject instanceof x.VexFlowContinuousDynamicExpression),I||L===M){let T;E&&(T=L),this.drawBoundingBox(d,void 0,!0,T,S)}S++,d.ChildElements.forEach(T=>this.drawBoundingBoxes(T,S,M))}drawBoundingBox(d,S=void 0,M=!1,E=void 0,L=0){let I=new r.RectangleF2D(d.AbsolutePosition.x+d.BorderMarginLeft,d.AbsolutePosition.y+d.BorderMarginTop,d.BorderMarginRight-d.BorderMarginLeft,d.BorderMarginBottom-d.BorderMarginTop);M&&(this.drawLineAsHorizontalRectangle(new u.GraphicalLine(new i.PointF2D(d.AbsolutePosition.x-1,d.AbsolutePosition.y),new i.PointF2D(d.AbsolutePosition.x+1,d.AbsolutePosition.y),.1,s.OutlineAndFillStyleEnum.BaseWritingColor,S),L-1),this.drawLineAsVerticalRectangle(new u.GraphicalLine(new i.PointF2D(d.AbsolutePosition.x,d.AbsolutePosition.y-1),new i.PointF2D(d.AbsolutePosition.x,d.AbsolutePosition.y+1),.1,s.OutlineAndFillStyleEnum.BaseWritingColor,S),L-1)),I=this.applyScreenTransformationForRect(I);const T=this.renderRectangle(I,s.GraphicalLayers.Background,L,S,.5);if(E){const A=new n.Label(E),v=new o.GraphicalLabel(A,.8,h.TextAlignmentEnum.CenterCenter,this.rules);v.setLabelPositionAndShapeBorders(),this.renderLabel(v,L,I.width,I.height,I.height,new i.PointF2D(I.x,I.y+12))}return T}drawMarkedAreas(d){for(const S of d.GraphicalMarkedAreas)S&&(S.systemRectangle&&this.drawRectangle(S.systemRectangle,s.GraphicalLayers.Background),S.settings&&(S.settings.SVGNode=this.drawLabel(S.settings,s.GraphicalLayers.Comment)),S.labelRectangle&&this.drawRectangle(S.labelRectangle,s.GraphicalLayers.Background),S.label&&(S.label.SVGNode=this.drawLabel(S.label,s.GraphicalLayers.Comment)))}drawComment(d){for(const S of d.GraphicalComments)S&&(S.settings&&(S.settings.SVGNode=this.drawLabel(S.settings,s.GraphicalLayers.Comment)),S.label&&(S.label.SVGNode=this.drawLabel(S.label,s.GraphicalLayers.Comment)))}drawStaffLineSymbols(d){const S=d.ParentStaff.ParentInstrument,M=d.PositionAndShape.AbsolutePosition.x,E=d.PositionAndShape.AbsolutePosition.y+2,L=d.PositionAndShape.BorderRight;S.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new u.GraphicalLine(new i.PointF2D(M,E),new i.PointF2D(M+L,E),4,s.OutlineAndFillStyleEnum.Highlighted),s.GraphicalLayers.Highlight);let I=m.MusicSymbolDrawingStyle.Disabled,T=p.MusicSymbol.PLAY,A=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case m.PhonicScoreModes.Midi:T=p.MusicSymbol.PLAY,this.midiPlaybackAvailable&&d.ParentStaff.audible&&(I=m.MusicSymbolDrawingStyle.PlaybackSymbols);break;case m.PhonicScoreModes.Following:T=p.MusicSymbol.MIC,d.ParentStaff.following&&(I=m.MusicSymbolDrawingStyle.FollowSymbols);break;default:A=!1}if(A){const v=new i.PointF2D(M+L+2,E);this.drawSymbol(T,I,v)}if(this.drawingParameters.drawErrors)for(const v of d.Measures){const B=v.PositionAndShape,D=B.AbsolutePosition.x,_=B.AbsolutePosition.y+2;v.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new u.GraphicalLine(new i.PointF2D(D,_),new i.PointF2D(D+B.BorderRight,_),4,s.OutlineAndFillStyleEnum.ErrorUnderlay),s.GraphicalLayers.MeasureError)}}}},512(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSymbol=void 0,function(l){l[l.Unused_first_Symbol=0]="Unused_first_Symbol",l[l.BLACK_HEAD=1]="BLACK_HEAD",l[l.UPWARDS_TAIL=2]="UPWARDS_TAIL",l[l.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",l[l.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",l[l.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",l[l.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",l[l.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",l[l.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",l[l.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",l[l.ROUND_HEAD=10]="ROUND_HEAD",l[l.WHITE_HEAD=11]="WHITE_HEAD",l[l.G_CLEF=12]="G_CLEF",l[l.F_CLEF=13]="F_CLEF",l[l.C_CLEF=14]="C_CLEF",l[l.BREVE=15]="BREVE",l[l.BREVE_REST=16]="BREVE_REST",l[l.COMMON_TIME=17]="COMMON_TIME",l[l.CUT_TIME=18]="CUT_TIME",l[l.WHOLE_REST=19]="WHOLE_REST",l[l.HALF_REST=20]="HALF_REST",l[l.QUARTER_REST=21]="QUARTER_REST",l[l.EIGHTH_REST=22]="EIGHTH_REST",l[l.SIXTEENTH_REST=23]="SIXTEENTH_REST",l[l.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",l[l.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",l[l.FLAT=26]="FLAT",l[l.SHARP=27]="SHARP",l[l.NATURAL=28]="NATURAL",l[l.DOUBLE_FLAT=29]="DOUBLE_FLAT",l[l.DOUBLE_SHARP=30]="DOUBLE_SHARP",l[l.ZERO=31]="ZERO",l[l.ONE=32]="ONE",l[l.TWO=33]="TWO",l[l.THREE=34]="THREE",l[l.FOUR=35]="FOUR",l[l.FIVE=36]="FIVE",l[l.SIX=37]="SIX",l[l.SEVEN=38]="SEVEN",l[l.EIGHT=39]="EIGHT",l[l.NINE=40]="NINE",l[l.DOT=41]="DOT",l[l.FERMATA=42]="FERMATA",l[l.INVERTED_FERMATA=43]="INVERTED_FERMATA",l[l.SPICCATO=44]="SPICCATO",l[l.TENUTO=45]="TENUTO",l[l.MARCATO=46]="MARCATO",l[l.MARCATISSIMO=47]="MARCATISSIMO",l[l.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",l[l.P=49]="P",l[l.F=50]="F",l[l.S=51]="S",l[l.Z=52]="Z",l[l.M=53]="M",l[l.R=54]="R",l[l.SEGNO=55]="SEGNO",l[l.CODA=56]="CODA",l[l.DRUM_CLEF=57]="DRUM_CLEF",l[l.G_CLEF_SUB8=58]="G_CLEF_SUB8",l[l.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",l[l.G_CLEF_SUB15=60]="G_CLEF_SUB15",l[l.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",l[l.F_CLEF_SUB8=62]="F_CLEF_SUB8",l[l.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",l[l.F_CLEF_SUB15=64]="F_CLEF_SUB15",l[l.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",l[l.DOWN_BOW=66]="DOWN_BOW",l[l.MORDENT=67]="MORDENT",l[l.INVERTED_MORDENT=68]="INVERTED_MORDENT",l[l.TURN=69]="TURN",l[l.INVERTED_TURN=70]="INVERTED_TURN",l[l.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",l[l.RELEASE_PED=72]="RELEASE_PED",l[l.ENGAGE_PED=73]="ENGAGE_PED",l[l.VA8=74]="VA8",l[l.VB8=75]="VB8",l[l.TRILL=76]="TRILL",l[l.MA15=77]="MA15",l[l.MB15=78]="MB15",l[l.HIGH=79]="HIGH",l[l.PLAY=80]="PLAY",l[l.MIC=81]="MIC",l[l.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",l[l.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",l[l.EditPen=84]="EditPen",l[l.PEDAL_BRACKET=85]="PEDAL_BRACKET",l[l.PEDAL_MIXED=86]="PEDAL_MIXED",l[l.PEDAL_SYMBOL=87]="PEDAL_SYMBOL"}(c||(g.MusicSymbol=c={}))},5221(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSystem=void 0;const l=c(9252),s=c(6438),u=c(2561),r=c(7533),i=c(8254),o=c(7741),n=c(9409),h=c(6954),t=c(3263),f=c(67),p=c(7435);class m extends o.GraphicalObject{constructor(y){super(),this.needsToBeRedrawn=!0,this.staffLines=[],this.graphicalMeasures=[],this.labels=new t.Dictionary,this.measureNumberLabels=[],this.objectsToRedraw=[],this.instrumentBrackets=[],this.groupBrackets=[],this.graphicalMarkedAreas=[],this.graphicalComments=[],this.systemLines=[],this.breaksPage=!1,this.id=y,this.boundingBox=new s.BoundingBox(this),this.maxLabelLength=0}get Parent(){return this.parent}set Parent(y){if(this.parent){const d=this.parent.MusicSystems.indexOf(this,0);d>-1&&this.parent.MusicSystems.splice(d,1)}this.parent=y,this.boundingBox.Parent=y.PositionAndShape}get NextSystem(){const y=this.Parent.MusicSystems.indexOf(this);return y!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[y+1]:void 0}get StaffLines(){return this.staffLines}set StaffLines(y){this.staffLines=y}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}get MaxLabelLength(){return this.maxLabelLength}createSystemLeftLine(y,d,S){let M=-y/2;S&&(M=this.maxLabelLength+d-y/2);const E=this.staffLines[0].Measures[0];let L;this.staffLines.length>1&&(L=this.staffLines[this.staffLines.length-1].Measures[0]);const I=this.createSystemLine(M,y,h.SystemLinesEnum.SingleThin,f.SystemLinePosition.MeasureBegin,this,E,L);this.SystemLines.push(I),I.PositionAndShape.RelativePosition=new n.PointF2D(M,0),I.PositionAndShape.BorderLeft=0,I.PositionAndShape.BorderRight=y,I.PositionAndShape.BorderTop=I.PositionAndShape.Parent.BorderTop,I.PositionAndShape.BorderBottom=I.PositionAndShape.Parent.BorderBottom,this.createLinesForSystemLine(I)}createVerticalLineForMeasure(y,d,S,M,E,L){const I=L.ParentStaffLine,T=new n.PointF2D(I.PositionAndShape.RelativePosition.x,I.PositionAndShape.RelativePosition.y),A=I.ParentStaff.ParentInstrument.Staves;if(I.ParentStaff===A[0]){let v;A.length>1&&(v=this.getBottomStaffLine(I).Measures[E]);const B=this.createSystemLine(y,d,S,M,this,L,v),D=T.x+y;B.PositionAndShape.RelativePosition=new n.PointF2D(D,0),B.PositionAndShape.BorderLeft=0,B.PositionAndShape.BorderRight=d,this.SystemLines.push(B)}}setYPositionsToVerticalLineObjectsAndCreateLines(y){}calculateBorders(y){}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(y){for(let d=0,S=y.length;d<S;++d)y[d].ParentMusicSystem=this;this.graphicalMeasures.push(y)}GetSystemsFirstTimeStamp(){return this.graphicalMeasures[0][0].parentSourceMeasure.AbsoluteTimestamp}GetSystemsLastTimeStamp(){const y=this.graphicalMeasures[this.graphicalMeasures.length-1][0].parentSourceMeasure;return u.Fraction.plus(y.AbsoluteTimestamp,y.Duration)}createInstrumentBrackets(y,d){for(let S=0,M=y.length;S<M;++S){const E=y[S];if(E.Staves.length>1){let L,I;for(let T=0,A=this.staffLines.length;T<A;++T){const v=this.staffLines[T];v.ParentStaff===E.Staves[0]&&v.ParentStaff.Visible&&(L=v),v.ParentStaff===E.Staves[E.Staves.length-1]&&v.ParentStaff.Visible&&(I=v)}L&&I&&this.createInstrumentBracket(L,I)}}}createGroupBrackets(y,d,S){for(let M=0,E=y.length;M<E;++M){const L=y[M];if(L.InstrumentalGroups.length<1)continue;const I=this.findFirstVisibleInstrumentInInstrumentalGroup(L),T=this.findLastVisibleInstrumentInInstrumentalGroup(L);if(!I||!T)continue;let A,v;for(let B=0,D=this.staffLines.length;B<D;++B){const _=this.staffLines[B];_.ParentStaff===I.Staves[0]&&(A=_),_.ParentStaff===T.Staves[0]&&(v=_)}A&&v&&this.createGroupBracket(A,v,S),L.InstrumentalGroups.length<1||this.createGroupBrackets(L.InstrumentalGroups,d,S+1)}}createMusicSystemLabel(y,d,S,M=!1){var I;const E=d;for(let T=0,A=this.staffLines.length;T<A;++T){const v=this.staffLines[T].ParentStaff.ParentInstrument;let B;if(M)B=v.NameLabel,this.rules.RenderPartNames&&(B!=null&&B.print)||(B=new p.Label("",v.NameLabel.textAlignment,v.NameLabel.font),d=0);else{if(!this.rules.RenderPartAbbreviations||!this.rules.RenderPartNames||this.staffLines.length===1||!v.PartAbbreviation||v.PartAbbreviation==="")return;const D=v.PartAbbreviation;B=new p.Label(D,v.NameLabel.textAlignment,v.NameLabel.font)}if((I=v==null?void 0:v.NameLabel)!=null&&I.print){const D=new i.GraphicalLabel(B,y,r.TextAlignmentEnum.LeftCenter,this.rules,this.boundingBox);D.setLabelPositionAndShapeBorders(),this.labels.setValue(v,D)}else d=0}this.maxLabelLength=0;const L=this.labels.values();for(let T=0,A=L.length;T<A;++T){const v=L[T];v.Label.print&&v.PositionAndShape.Size.width>this.maxLabelLength&&(this.maxLabelLength=v.PositionAndShape.Size.width,d=E)}this.updateMusicSystemStaffLineXPosition(d)}setMusicSystemLabelsYPosition(){this.labels.forEach((y,d)=>{let S=0,M=0;for(let E=0;E<this.staffLines.length;E++)if(this.staffLines[E].ParentStaff.ParentInstrument===y){for(let L=E;L<this.staffLines.length;L++){const I=this.staffLines[L];if(I.ParentStaff.ParentInstrument!==y)break;S+=I.PositionAndShape.RelativePosition.y,M++}break}M>0&&(d.PositionAndShape.RelativePosition=new n.PointF2D(0,S/M+2))})}checkStaffEntriesForStaffEntryLink(){let y=!1,d=!1;for(let S=0;S<this.staffLines.length-1;S++){for(let M=0,E=this.staffLines[S].Measures.length;M<E;++M){const L=this.staffLines[S].Measures[M];for(let I=0,T=L.staffEntries.length;I<T;++I)L.staffEntries[I].sourceStaffEntry.Link&&(y=!0)}for(let M=0,E=this.staffLines[S+1].Measures.length;M<E;++M){const L=this.staffLines[S+1].Measures[M];for(let I=0,T=L.staffEntries.length;I<T;++I)L.staffEntries[I].sourceStaffEntry.Link&&(d=!0)}}return!(!y||!d)}getBottomStaffLine(y){var M;const d=y.ParentStaff.ParentInstrument.Staves;let S;for(let E=d.length-1;E>=0;E--)if((M=d[E])!=null&&M.Visible){S=d[E];break}for(const E of y.ParentMusicSystem.staffLines)if(E.ParentStaff===S)return E}createSystemLine(y,d,S,M,E,L,I=void 0){throw new Error("not implemented")}createLinesForSystemLine(y){}calcBracketsWidth(){let y=0;for(let d=0,S=this.GroupBrackets.length;d<S;++d){const M=this.GroupBrackets[d];y=Math.max(y,M.PositionAndShape.Size.width)}for(let d=0,S=this.InstrumentBrackets.length;d<S;++d){const M=this.InstrumentBrackets[d];y=Math.max(y,M.PositionAndShape.Size.width)}return y}createInstrumentBracket(y,d){}createGroupBracket(y,d,S){}findFirstVisibleInstrumentInInstrumentalGroup(y){for(let d=0,S=y.InstrumentalGroups.length;d<S;++d){const M=y.InstrumentalGroups[d];if(!(M instanceof l.Instrument))return this.findFirstVisibleInstrumentInInstrumentalGroup(M);if(M.isVisible())return M}}findLastVisibleInstrumentInInstrumentalGroup(y){let d;for(let S=y.InstrumentalGroups.length-1;S>=0;S--){if(d=y.InstrumentalGroups[S],!(d instanceof l.Instrument))return this.findLastVisibleInstrumentInInstrumentalGroup(d);if(d.isVisible())return d}}updateMusicSystemStaffLineXPosition(y){for(let d=0,S=this.StaffLines.length;d<S;++d){const M=this.StaffLines[d],E=M.PositionAndShape.RelativePosition;E.x=this.maxLabelLength+y,M.PositionAndShape.RelativePosition=E,M.PositionAndShape.BorderRight=this.boundingBox.Size.width-this.maxLabelLength-y;for(let L=0;L<M.StaffLines.length;L++){const I=new n.PointF2D(M.PositionAndShape.Size.width,M.StaffLines[L].End.y);M.StaffLines[L].End=I}}}}g.MusicSystem=m},7066(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MeasureBuildParameters=g.SystemBuildParameters=g.MusicSystemBuilder=void 0;const l=c(1888),s=c(9288),u=c(4543),r=c(164),i=c(9409),o=c(6452),n=c(6954),h=c(7921),t=c(164),f=c(813),p=c(67);g.MusicSystemBuilder=class{constructor(){this.musicSystems=[],this.globalSystemIndex=0,this.leadSheet=!1}initialize(x,y,d){this.leadSheet=x.LeadSheet,this.graphicalMusicSheet=x,this.rules=this.graphicalMusicSheet.ParentMusicSheet.Rules,this.measureList=y,this.numberOfVisibleStaffLines=d,this.activeRhythm=new Array(this.numberOfVisibleStaffLines),this.activeKeys=new Array(this.numberOfVisibleStaffLines),this.activeClefs=new Array(this.numberOfVisibleStaffLines),this.initializeActiveInstructions(this.measureList[0])}buildMusicSystems(){var d,S,M;const x=this.getFullPageSystemWidth();let y=!1;for(this.measureListIndex=0,this.currentSystemParams=new m,this.currentSystemParams.currentSystem=this.initMusicSystem(),this.currentSystemParams.maxLabelLength=this.currentSystemParams.currentSystem.MaxLabelLength;this.measureListIndex<this.measureList.length;){const E=this.measureList[this.measureListIndex];if(!E||!E[0]){this.measureListIndex++;continue}for(let Q=0,ne=E.length;Q<ne;++Q)E[Q].resetLayout();const L=E[0].parentSourceMeasure,I=L.HasEndLine,T=I&&this.rules.NewPartAndSystemAfterFinalBarline,A=this.currentSystemParams.IsSystemStartMeasure();L.IsSystemStartMeasure=A;const v=L===this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();let B=this.rules.MeasureLeftMargin,D=0;const _=this.getMeasureStartLine();if(B+=this.getLineWidth(E[0],_,A),!this.leadSheet){let Q=!1;y&&this.rules.ShowRhythmAgainAfterPartEndOrFinalBarline&&(Q=!0),B+=this.addBeginInstructions(E,A,v||Q),D+=this.addEndInstructions(E)}let F=0;for(let Q=0;Q<this.numberOfVisibleStaffLines;Q++)F=Math.max(F,E[Q].minimumStaffEntriesWidth);const k=this.getMeasureEndLine();D+=this.getLineWidth(E[0],k,A);let j,P=this.rules.MeasureLeftMargin;if(this.measureListIndex+1<this.measureList.length){const Q=this.measureList[this.measureListIndex+1];j=(d=Q[0])==null?void 0:d.parentSourceMeasure,j!=null&&j.hasBeginInstructions()&&(P+=this.addBeginInstructions(Q,!1,!1))}let G=B+D+F;if((M=(S=E[0])==null?void 0:S.parentSourceMeasure)!=null&&M.multipleRestMeasures){F=this.rules.MultipleRestMeasureDefaultWidth,G=B+D+F;for(let Q=0;Q<this.numberOfVisibleStaffLines;Q++)E[Q]&&(E[Q].minimumStaffEntriesWidth=F)}const Y=this.currentSystemParams.systemMeasures.length,X=this.currentSystemParams.maxLabelLength>0?this.currentSystemParams.maxLabelLength+this.rules.SystemLabelsRightMargin:0,ie=this.currentSystemParams.currentWidth+G+P+X<x,oe=this.rules.NewPageAtXMLNewPageAttribute&&L.printNewPageXml,$=oe||this.rules.NewSystemAtXMLNewPageAttribute&&L.printNewPageXml||this.rules.NewSystemAtXMLNewSystemAttribute&&L.printNewSystemXml||Y===this.rules.RenderXMeasuresPerLineAkaSystem&&Y>0;if(A||ie&&!$){if(this.addMeasureToSystem(E,_,k,G,B,F,D),this.updateActiveClefs(L,E),this.measureListIndex++,T){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(E,!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(E,!this.rules.StretchLastSystemLine,!1)}y=I}else{if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(E,!1,!0,oe),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(E,!1,!0,oe)}}if(this.currentSystemParams.systemMeasures.length>0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return this.musicSystems}calculateSystemYLayout(){for(const x of this.musicSystems)this.optimizeDistanceBetweenStaffLines(x);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(x,y,d,S){for(let M=0,E=x.length;M<E;++M){const L=x[M];L.setWidth(y),d>0&&(L.beginInstructionsWidth=d),S>0&&(L.endInstructionsWidth=S)}}finalizeCurrentAndCreateNewSystem(x,y=!1,d=!0,S=!1){this.finalizeCurrentSystem(x,y,d,S),this.currentSystemParams=new m,x!==void 0&&this.measureListIndex<this.measureList.length&&(this.currentSystemParams.currentSystem=this.initMusicSystem(),this.currentSystemParams.maxLabelLength=this.currentSystemParams.currentSystem.MaxLabelLength)}finalizeCurrentSystem(x,y=!1,d=!0,S=!1){this.currentSystemParams.currentSystem.breaksPage=S,this.adaptRepetitionLineWithIfNeeded(),x!==void 0&&d&&this.checkAndCreateExtraInstructionMeasure(x),this.stretchMusicSystem(y)}adaptRepetitionLineWithIfNeeded(){const x=this.currentSystemParams.systemMeasures;if(x.length>=1){const y=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let d=0;const S=x[x.length-1];S.endLine===n.SystemLinesEnum.DotsBoldBoldDots&&(S.endLine=n.SystemLinesEnum.DotsThinBold,d=y[0].getLineWidth(n.SystemLinesEnum.DotsBoldBoldDots)/2-y[0].getLineWidth(n.SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=d;for(let M=0,E=y.length;M<E;++M)y[M].endInstructionsWidth-=d}}addMeasureToSystem(x,y,d,S,M,E,L){this.currentSystemParams.systemMeasures.push({beginLine:y,endLine:d}),this.setMeasureWidth(x,S,M,L),this.addStaveMeasuresToSystem(x),this.currentSystemParams.currentWidth+=S,this.currentSystemParams.currentSystemFixWidth+=M+L,this.currentSystemParams.currentSystemVarWidth+=E,this.currentSystemParams.systemMeasureIndex++}initMusicSystem(){const x=h.MusicSheetCalculator.symbolFactory.createMusicSystem(this.globalSystemIndex++,this.rules);return this.musicSystems.push(x),this.layoutSystemStaves(x),x.createMusicSystemLabel(this.rules.InstrumentLabelTextHeight,this.rules.SystemLabelsRightMargin,this.rules.LabelMarginBorderFactor,this.musicSystems.length===1),x}getFullPageSystemWidth(){return this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageLeftMargin-this.rules.PageRightMargin-this.rules.SystemLeftMargin-this.rules.SystemRightMargin}layoutSystemStaves(x){const y=this.getFullPageSystemWidth(),d=x.PositionAndShape;d.BorderLeft=0,d.BorderRight=y,d.BorderTop=0;const S=[],M=this.graphicalMusicSheet.ParentMusicSheet.Instruments;for(let I=0,T=M.length;I<T;++I){const A=M[I];if(A.isVisible()&&A.Voices.length!==0)for(let v=0,B=A.Staves.length;v<B;++v){const D=A.Staves[v];D!=null&&D.Visible&&S.push(D)}}let E=!1;if(this.leadSheet){for(let I=0,T=S.length;I<T;++I)if(S[I].ParentInstrument.LyricVersesNumbers.length>1){E=!0;break}}let L=0;for(let I=0;I<S.length;I++)if(this.addStaffLineToMusicSystem(x,L,S[I]),L+=this.rules.StaffHeight,I+1<S.length){let T=0;T=this.leadSheet&&!E?2.5:S[I].ParentInstrument===S[I+1].ParentInstrument?this.rules.BetweenStaffDistance:this.rules.StaffDistance,L+=T}d.BorderBottom=L}addStaffLineToMusicSystem(x,y,d){if(x){const S=h.MusicSheetCalculator.symbolFactory.createStaffLine(x,d);x.StaffLines.push(S);const M=S.PositionAndShape,E=new i.PointF2D;E.x=0,M.BorderRight=x.PositionAndShape.Size.width,E.y=y,M.RelativePosition=E,M.BorderLeft=0,M.BorderTop=0,M.BorderBottom=this.rules.StaffHeight;for(let L=0;L<5;L++){const I=new i.PointF2D;I.x=0,I.y=L*this.rules.StaffHeight/4;const T=new i.PointF2D;T.x=S.PositionAndShape.Size.width,T.y=L*this.rules.StaffHeight/4,this.leadSheet&&(I.y=T.y=0),S.StaffLines[L]=new o.GraphicalLine(I,T,this.rules.StaffLineWidth)}}}initializeActiveInstructions(x){const y=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(y){this.visibleStaffIndices=this.graphicalMusicSheet.getVisibleStavesIndicesFromSourceMeasure(x);for(let S=0,M=this.visibleStaffIndices.length;S<M;S++){const E=this.visibleStaffIndices[S],L=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(y,E);this.activeClefs[S]=y.FirstInstructionsStaffEntries[E].Instructions[0],L.InitiallyActiveClef=this.activeClefs[S];const I=y.FirstInstructionsStaffEntries[E].Instructions[1];if(I){let A=u.KeyInstruction.copy(I);A=this.transposeKeyInstruction(A,L),this.activeKeys[S]=A}const T=y.FirstInstructionsStaffEntries[E].Instructions[2];this.activeRhythm[S]=T}const d=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures;for(let S=0;S<this.rules.MinMeasureToDrawIndex;S++){const M=d[S];if(M)for(let E=0,L=this.visibleStaffIndices.length;E<L;E++){const I=this.visibleStaffIndices[E],T=M.FirstInstructionsStaffEntries[I];if(T)for(let B=0,D=T.Instructions.length;B<D;++B){const _=T.Instructions[B];_ instanceof r.ClefInstruction?this.activeClefs[E]=_:_ instanceof u.KeyInstruction?this.activeKeys[E]=_:_ instanceof s.RhythmInstruction&&(this.activeRhythm[E]=_)}const A=M.getEntriesPerStaff(I);for(let B=0,D=A.length;B<D;++B){const _=A[B];if(_.Instructions)for(let F=0,k=_.Instructions.length;F<k;++F){const j=_.Instructions[F];j instanceof r.ClefInstruction&&(this.activeClefs[E]=j)}}const v=M.LastInstructionsStaffEntries[I];if(v)for(let B=0,D=v.Instructions.length;B<D;++B){const _=v.Instructions[B];_ instanceof r.ClefInstruction&&(this.activeClefs[E]=_)}}}}}transposeKeyInstruction(x,y){const d=y.getTransposedHalftones();return d!==x.isTransposedBy&&y.ParentStaff.ParentInstrument.MidiInstrumentId!==t.MidiInstrument.Percussion&&h.MusicSheetCalculator.transposeCalculator!==void 0&&h.MusicSheetCalculator.transposeCalculator.transposeKey(x,d),x}addBeginInstructions(x,y,d){const S=x.length;if(S===0)return 0;let M=0;const E=x[0].parentSourceMeasure,L=[];for(let I=0;I<S;++I){const T=x[I];T&&L.push(T.getVFStave());const A=this.visibleStaffIndices[I],v=E.FirstInstructionsStaffEntries[A],B=this.AddInstructionsAtMeasureBegin(v,T,I,d,y);M=Math.max(M,B)}return L[0].formatBegModifiers(L),M}addEndInstructions(x){const y=x.length;if(y===0)return 0;let d=.5;const S=x[0].parentSourceMeasure;for(let M=0;M<y;M++){const E=x[M],L=this.visibleStaffIndices[M],I=S.LastInstructionsStaffEntries[L],T=this.addInstructionsAtMeasureEnd(I,E,x);d=Math.max(d,T)}return d}AddInstructionsAtMeasureBegin(x,y,d,S,M){var D;let E,L,I,T=0;if(x)for(let _=0,F=x.Instructions.length;_<F;++_){const k=x.Instructions[_];k instanceof r.ClefInstruction?E=k:k instanceof u.KeyInstruction?L=k:k instanceof s.RhythmInstruction&&(I=k)}y.InitiallyActiveClef=E??this.activeClefs[d],M&&(E||(E=this.activeClefs[d]),L||(L=u.KeyInstruction.copy(this.activeKeys[d])),S&&!I&&(I=this.activeRhythm[d]));let A=!1,v=!1,B=!1;if(E?(y.addClefAtBegin(E),A=!0):E=this.activeClefs[d],L){L=this.transposeKeyInstruction(L,y);const _=M?void 0:this.activeKeys[d];y.addKeyAtBegin(L,_,E),v=!0}if(I!==void 0&&I.PrintObject&&this.rules.RenderTimeSignatures){let _=!0;const F=y.MeasureNumber-1-this.rules.MinMeasureToDrawIndex;if(y.MeasureNumber-1>=0&&this.measureList[F]){const k=this.measureList[F],j=(D=k[0])==null?void 0:D.parentSourceMeasure;j!=null&&j.ImplicitMeasure&&(j!=null&&j.RhythmPrinted)&&(_=!1)}_&&(y.addRhythmAtBegin(I),y.parentSourceMeasure.RhythmPrinted=I,B=!0)}return(A||v||B)&&(T+=y.beginInstructionsWidth,B&&(T+=this.rules.RhythmRightMargin)),T}addInstructionsAtMeasureEnd(x,y,d){if(!x||!x.Instructions||x.Instructions.length===0)return 0;for(let S=0,M=x.Instructions.length;S<M;++S){const E=x.Instructions[S];if(E instanceof r.ClefInstruction){const L=E;y.addClefAtEnd(L);for(const I of d)I!==y&&I.addClefAtEnd(L,!1)}}return this.rules.MeasureRightMargin+y.endInstructionsWidth}updateActiveClefs(x,y){for(let d=0,S=y.length;d<S;d++){const M=this.visibleStaffIndices[d],E=x.FirstInstructionsStaffEntries[M];if(E)for(let T=0,A=E.Instructions.length;T<A;++T){const v=E.Instructions[T];v instanceof r.ClefInstruction?this.activeClefs[d]=v:v instanceof u.KeyInstruction?this.activeKeys[d]=v:v instanceof s.RhythmInstruction&&(this.activeRhythm[d]=v)}const L=x.getEntriesPerStaff(M);for(let T=0,A=L.length;T<A;++T){const v=L[T];if(v.Instructions)for(let B=0,D=v.Instructions.length;B<D;++B){const _=v.Instructions[B];_ instanceof r.ClefInstruction&&(this.activeClefs[d]=_)}}const I=x.LastInstructionsStaffEntries[M];if(I){const T=I.Instructions;for(let A=0,v=T.length;A<v;++A){const B=T[A];B instanceof r.ClefInstruction&&(this.activeClefs[d]=B)}}}}checkAndCreateExtraInstructionMeasure(x){const y=x[0].parentSourceMeasure.FirstInstructionsStaffEntries,d=[];for(let M=0,E=x.length;M<E;++M){const L=x[M];d.push(y[L.ParentStaff.idInMusicSheet])}let S=0;for(let M=0,E=d.length;M<E;++M){const L=d[M];if(!L)continue;const I=L.Instructions;let T,A;for(let v=0,B=I.length;v<B;++v){const D=I[v];D instanceof u.KeyInstruction&&D.Key!==this.activeKeys[M].Key&&(T=D),D instanceof s.RhythmInstruction&&D!==this.activeRhythm[M]&&(A=D)}if(T!==void 0||A){const v=this.addExtraInstructionMeasure(M,T,A);S=Math.max(S,v)}}S>0&&(this.currentSystemParams.systemMeasures.push({beginLine:n.SystemLinesEnum.None,endLine:n.SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=S,this.currentSystemParams.currentSystemFixWidth+=S)}addExtraInstructionMeasure(x,y,d){const S=this.currentSystemParams.currentSystem,M=h.MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(S.StaffLines[x]);y&&M.addKeyAtBegin(y,this.activeKeys[x],this.activeClefs[x]),d!==void 0&&d.PrintObject&&M.addRhythmAtBegin(d),M.PositionAndShape.BorderLeft=0,M.PositionAndShape.BorderTop=0,M.PositionAndShape.BorderBottom=this.rules.StaffHeight;const E=this.rules.MeasureLeftMargin+M.beginInstructionsWidth+this.rules.MeasureRightMargin;return M.PositionAndShape.BorderRight=E,S.StaffLines[x].Measures.push(M),E}addStaveMeasuresToSystem(x){if(x[0]){const y=[];for(let S=0;S<x.length;S++)y.push(x[S]);const d=this.currentSystemParams.currentSystem;for(let S=0;S<this.numberOfVisibleStaffLines;S++){const M=y[S];d.StaffLines[S].Measures.push(M),M.ParentStaffLine=d.StaffLines[S]}d.AddGraphicalMeasures(y)}}getMeasureStartLine(){if(this.thisMeasureBeginsLineRepetition()){const x=this.measureListIndex===0;if(x&&this.rules.RepetitionAllowFirstMeasureBeginningRepeatBarline)return n.SystemLinesEnum.BoldThinDots;const y=this.currentSystemParams.IsSystemStartMeasure();if(this.previousMeasureEndsLineRepetition()&&!y)return n.SystemLinesEnum.DotsBoldBoldDots;if(!x)return n.SystemLinesEnum.BoldThinDots}return n.SystemLinesEnum.None}getMeasureEndLine(){let x;try{if(x=this.measureList[this.measureListIndex][0].parentSourceMeasure,this.rules.RenderMultipleRestMeasures&&x.multipleRestMeasures>1){const y=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,x.measureListIndex+x.multipleRestMeasures-1);x=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[y]}}finally{}return this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?n.SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()?n.SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()?n.SystemLinesEnum.DoubleThin:x&&x.endingBarStyleEnum!==void 0?x.endingBarStyleEnum:n.SystemLinesEnum.SingleThin}getLineWidth(x,y,d){let S=x.getLineWidth(y);return y===n.SystemLinesEnum.DotsBoldBoldDots&&(S/=2),d&&y===n.SystemLinesEnum.BoldThinDots&&(S+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),S}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let x=0,y=this.measureList[this.measureListIndex-1].length;x<y;++x)if(this.measureList[this.measureListIndex-1][x].endsWithLineRepetition())return!0;return!1}thisMeasureBeginsLineRepetition(){for(let x=0,y=this.measureList[this.measureListIndex].length;x<y;++x)if(this.measureList[this.measureListIndex][x].beginsWithLineRepetition())return!0;return!1}nextMeasureBeginsLineRepetition(){const x=this.measureListIndex+1;if(x>=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[x])return!1;for(let y=0,d=this.measureList[x].length;y<d;++y)if(this.measureList[x][y].beginsWithLineRepetition())return!0;return!1}thisMeasureEndsLineRepetition(){var x;for(let y=0,d=this.measureList[this.measureListIndex].length;y<d;++y){const S=this.measureList[this.measureListIndex][y];if(S.endsWithLineRepetition())return!0;if((x=S.parentSourceMeasure)!=null&&x.isReducedToMultiRest){const M=this.graphicalMusicSheet.ParentMusicSheet;let E=S.parentSourceMeasure;const L=M.SourceMeasures.indexOf(E);let I=E.multipleRestMeasureNumber;for(let T=L+1;T<M.SourceMeasures.length;T++){const A=M.SourceMeasures[T];if(!(A.multipleRestMeasureNumber>=I))break;E=A,I=A.multipleRestMeasureNumber}return E.endsWithLineRepetition()}}return!1}nextMeasureBeginsWordRepetition(){const x=this.measureListIndex+1;if(x>=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||x>this.measureList.length-1)return!1;for(let y=0,d=this.measureList[x].length;y<d;++y)if(this.measureList[x][y].beginsWithWordRepetition())return!0;return!1}thisMeasureEndsWordRepetition(){for(let x=0,y=this.measureList[this.measureListIndex].length;x<y;++x)if(this.measureList[this.measureListIndex][x].endsWithWordRepetition())return!0;return!1}nextMeasureHasKeyInstructionChange(){return this.getNextMeasureKeyInstruction()!==void 0}getNextMeasureKeyInstruction(){var x;if(this.measureListIndex<this.measureList.length-1)for(let y=0;y<this.measureList[this.measureListIndex].length;y++){const d=(x=this.measureList[this.measureListIndex+1][y])==null?void 0:x.parentSourceMeasure;return d?d.getKeyInstruction(this.visibleStaffIndices[y]):void 0}}calculateXScalingFactor(x,y){return Math.abs(y-0)<1e-5||Math.abs(x-0)<1e-5?1:(this.currentSystemParams.currentSystem.StaffLines[0].PositionAndShape.Size.width-x)/y}stretchMusicSystem(x){let y=this.calculateXScalingFactor(this.currentSystemParams.currentSystemFixWidth,this.currentSystemParams.currentSystemVarWidth);x&&(y=Math.min(y,this.rules.LastSystemMaxScalingFactor));const d=this.currentSystemParams.currentSystem;for(let S=0,M=d.StaffLines.length;S<M;++S){const E=d.StaffLines[S];let L=0;for(let I=0;I<E.Measures.length;I++){const T=E.Measures[I];T.setPositionInStaffline(L);const A=T.beginInstructionsWidth;if(T.setWidth(A+T.minimumStaffEntriesWidth*y+T.endInstructionsWidth),I<this.currentSystemParams.systemMeasures.length){const v=this.currentSystemParams.systemMeasures[I].beginLine,B=T.getLineWidth(n.SystemLinesEnum.BoldThinDots);if(v===n.SystemLinesEnum.BoldThinDots){let D=L;I===0&&(D=L+T.beginInstructionsWidth-B),d.createVerticalLineForMeasure(D,B,v,p.SystemLinePosition.MeasureBegin,I,T)}}if(T.staffEntriesScaleFactor=y,T.layoutSymbols(),!(I+1<this.currentSystemParams.systemMeasures.length&&this.currentSystemParams.systemMeasures[I+1].beginLine===n.SystemLinesEnum.BoldThinDots)){let v=n.SystemLinesEnum.SingleThin;I<this.currentSystemParams.systemMeasures.length&&(v=this.currentSystemParams.systemMeasures[I].endLine);const B=T.getLineWidth(v);let D=T.PositionAndShape.RelativePosition.x+T.PositionAndShape.BorderRight-B;v===n.SystemLinesEnum.DotsBoldBoldDots&&(D-=B/2),d.createVerticalLineForMeasure(D,B,v,p.SystemLinePosition.MeasureEnd,I,T)}L=T.PositionAndShape.RelativePosition.x+T.PositionAndShape.BorderRight}}x&&this.decreaseMusicSystemBorders()}decreaseMusicSystemBorders(){const x=this.currentSystemParams.currentSystem,y=f.CollectionUtil.last(x.StaffLines[0].Measures).PositionAndShape,d=y.RelativePosition.x+y.Size.width;for(let S=0,M=x.StaffLines.length;S<M;++S){const E=x.StaffLines[S];E.PositionAndShape.BorderRight=d;for(let L=0,I=E.StaffLines.length;L<I;++L){const T=E.StaffLines[L];T.End=new i.PointF2D(d,T.End.y)}}x.PositionAndShape.BorderRight=d+this.currentSystemParams.maxLabelLength+this.rules.SystemLabelsRightMargin}updateStaffLinesRelativePosition(x,y,d){for(let S=y;S<x.StaffLines.length;S++)x.StaffLines[S].PositionAndShape.RelativePosition.y=d;x.PositionAndShape.BorderBottom+=d}createMusicPage(){const x=new l.GraphicalMusicPage(this.graphicalMusicSheet);return this.graphicalMusicSheet.MusicPages.push(x),x.PageNumber=this.graphicalMusicSheet.MusicPages.length,x.PositionAndShape.BorderLeft=0,x.PositionAndShape.BorderRight=this.graphicalMusicSheet.ParentMusicSheet.pageWidth,x.PositionAndShape.BorderTop=0,x.PositionAndShape.BorderBottom=this.rules.PageHeight,x.PositionAndShape.RelativePosition=new i.PointF2D(0,0),x}addSystemToPage(x,y){x.MusicSystems.push(y),y.Parent=x}optimizeDistanceBetweenStaffLines(x){if(!x.checkStaffEntriesForStaffEntryLink())for(let S=0;S<x.StaffLines.length-1;S++){const M=x.StaffLines[S].BottomLine,E=x.StaffLines[S+1].SkyLine;let L=0;for(let T=0;T<M.length;T++){const A=M[T],v=Math.max(0,T-6),B=Math.min(E.length-1,T+6);let D=0;for(let F=v;F<=B;F++)D=Math.min(D,E[F]);const _=A-D;L=Math.max(_,L)}L+=this.rules.MinSkyBottomDistBetweenStaves,L=Math.max(L,this.rules.StaffHeight+this.rules.MinimumStaffLineDistance);const I=L+x.StaffLines[S].PositionAndShape.RelativePosition.y;this.updateStaffLinesRelativePosition(x,S+1,I)}const y=x.StaffLines[0];x.PositionAndShape.BorderTop=y.PositionAndShape.RelativePosition.y+y.PositionAndShape.BorderTop;const d=x.StaffLines[x.StaffLines.length-1];x.PositionAndShape.BorderBottom=d.PositionAndShape.RelativePosition.y+d.PositionAndShape.BorderBottom}calculateMusicSystemsRelativePositions(){let x=this.createMusicPage(),y=0,d=this.musicSystems[0],S=0;for(let M=0;M<this.musicSystems.length;M++)if(d=this.musicSystems[M],x.MusicSystems.length===0){this.addSystemToPage(x,d),y=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.graphicalMusicSheet.MusicPages.length===1&&this.rules.RenderTitle&&(y+=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.TitleBottomDistance);const E=new i.PointF2D(this.rules.PageLeftMargin+this.rules.SystemLeftMargin,y);d.PositionAndShape.RelativePosition=E,y+d.PositionAndShape.BorderBottom>this.rules.PageHeight-this.rules.PageBottomMargin&&(S++,S<=4&&console.log(`warning: could not fit a single system on page ${x.PageNumber} and measure number ${d.GraphicalMeasures[0][0].MeasureNumber}.
|
|
The PageFormat may be too small for this sheet."
|
|
Will not give further warnings for all pages, only total.`))}else{const E=this.musicSystems[M-1],L=E.StaffLines[E.StaffLines.length-1],I=L.PositionAndShape;let T=this.findRequiredDistanceWithSkyBottomLine(E,d);T+=this.rules.MinSkyBottomDistBetweenSystems,T=Math.max(T,this.rules.MinimumDistanceBetweenSystems+L.StaffHeight);const A=y+I.RelativePosition.y+T,v=A+d.PositionAndShape.BorderMarginBottom;if(this.rules.NewPageAtXMLNewPageAttribute&&E.breaksPage||!(v<this.rules.PageHeight-this.rules.PageBottomMargin)){x=this.createMusicPage(),M-=1;continue}{this.addSystemToPage(x,d),y=A;const B=new i.PointF2D(this.rules.PageLeftMargin+this.rules.SystemLeftMargin,y);d.PositionAndShape.RelativePosition=B}}S>0&&console.log(`total amount of pages that couldn't fit a single music system: ${S} of ${x.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(x,y){const d=x.StaffLines[x.StaffLines.length-1],S=y.StaffLines[0],M=d.BottomLine,E=S.SkyLine,L=d.PositionAndShape,I=S.PositionAndShape,T=1/this.rules.SamplingUnit;let A=0;for(let v=0;v<M.length;v++){const B=M[v],D=v+Math.round((L.RelativePosition.x-I.RelativePosition.x)*T);if(D<0)continue;if(D>=E.length)break;const _=Math.max(0,D-6),F=Math.min(E.length-1,D+6);let k=0;for(let P=_;P<=F;P++)k=Math.min(k,E[P]);const j=B-k;A=Math.max(j,A)}return A===0&&(A=L.BorderBottom-I.BorderTop),A}};class m{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return this.systemMeasureIndex===0}}g.SystemBuildParameters=m,g.MeasureBuildParameters=class{}},8033(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.OctaveShiftParams=void 0,g.OctaveShiftParams=class{constructor(c,l,s){this.getOpenOctaveShift=c,this.getAbsoluteStartTimestamp=l,this.getAbsoluteEndTimestamp=s}}},735(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.PlainSkyBottomLineBatchCalculatorBackend=void 0;const l=c(5479),s=c(3667);class u extends s.SkyBottomLineBatchCalculatorBackend{constructor(i,o){super(i,o)}getPreferredRenderingConfiguration(i,o){return{elementWidth:Math.ceil(i),numColumns:6,numRows:6}}onInitialize(i){}calculateFromCanvas(i,o,n,h,t){const f=i.width,p=o.getImageData(0,0,i.width,i.height),{elementWidth:m,elementHeight:x,numColumns:y}=t,d=[];for(let S=0;S<n.length;++S){const M=n[S],E=Math.floor(M.getVFStave().getWidth()),L=Math.max(Math.ceil(M.PositionAndShape.Size.width*h),1),I=S%y*m,T=I+E,A=Math.floor(S/y)*x,v=A+x,B=new Array(Math.max(L,E)).fill(0),D=new Array(Math.max(L,E)).fill(0);for(let k=I;k<T;++k){B[k-I]=0;for(let j=A;j<v;++j){const P=j*f*4+4*k;if(p.data[P+3]>0){B[k-I]=j-A;break}}D[k-I]=x;for(let j=v-1;j>=A;j--){const P=j*f*4+4*k;if(p.data[P+3]>0){D[k-I]=j-A;break}}}const _=Math.max(...B),F=Math.min(...D);for(let k=0;k<E;++k)B[k]=B[k]===0?_:B[k],D[k]=D[k]===x?F:D[k];d.push(new l.SkyBottomLineCalculationResult(B,D))}return d}}g.PlainSkyBottomLineBatchCalculatorBackend=u},7624(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.SelectionEndSymbol=void 0;const l=c(7741),s=c(2683),u=c(9409),r=c(6438),i=c(6452),o=c(813);class n extends l.GraphicalObject{constructor(t,f){super();const p=f,m=t.PositionAndShape.AbsolutePosition.y,x=o.CollectionUtil.last(t.StaffLines).PositionAndShape.RelativePosition.y+4;this.verticalLine=new i.GraphicalLine(new u.PointF2D(p,m),new u.PointF2D(p,m+x),.4,s.OutlineAndFillStyleEnum.SelectionSymbol);for(let y=0,d=t.StaffLines.length;y<d;++y){const S=t.StaffLines[y],M=new u.PointF2D(p,m+S.PositionAndShape.RelativePosition.y),E=new Array(3);M.y-=.2,E[0].x=M.x-3,E[0].y=M.y+1.2,E[1].x=M.x-2,E[1].y=M.y+.4,E[2].x=M.x-2,E[2].y=M.y+2,this.arrows.push(E);const L=new Array(8),I=.8;M.x-=.1,M.y+=.3;const T=.2;L[0].x=M.x-2,L[0].y=M.y+1.5-T,L[1].x=M.x-1,L[1].y=M.y+1.5-T,L[2].x=M.x-1,L[2].y=M.y+2.5,L[3].x=M.x-2,L[3].y=M.y+2.5,L[4].x=L[0].x,L[4].y=L[0].y-I,L[5].x=L[4].x+I+1,L[5].y=L[4].y,L[6].x=L[5].x,L[6].y=L[3].y+I,L[7].x=L[3].x,L[7].y=L[6].y,this.arrowlines.push(L)}this.boundingBox=new r.BoundingBox(this),this.boundingBox.AbsolutePosition=new u.PointF2D(p,m),this.boundingBox.BorderLeft=-.4,this.boundingBox.BorderRight=4,this.boundingBox.BorderBottom=x}}g.SelectionEndSymbol=n},8713(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.SelectionStartSymbol=void 0;const l=c(9409),s=c(2683),u=c(6452),r=c(7741),i=c(6438),o=c(813);class n extends r.GraphicalObject{constructor(t,f){super();const p=f,m=t.PositionAndShape.AbsolutePosition.y,x=o.CollectionUtil.last(t.StaffLines).PositionAndShape.RelativePosition.y+4;this.verticalLine=new u.GraphicalLine(new l.PointF2D(p,m),new l.PointF2D(p,m+x),.4,s.OutlineAndFillStyleEnum.SelectionSymbol);for(let y=0,d=t.StaffLines.length;y<d;++y){const S=t.StaffLines[y],M=new l.PointF2D(p,m+S.PositionAndShape.RelativePosition.y),E=new Array(7);E[0].x=M.x+4,E[0].y=M.y+2,E[1].x=M.x+2.5,E[1].y=M.y+.5,E[2].x=M.x+2.5,E[2].y=M.y+1.3,E[3].x=M.x+1,E[3].y=M.y+1.3,E[4].x=M.x+1,E[4].y=M.y+2.7,E[5].x=M.x+2.5,E[5].y=M.y+2.7,E[6].x=M.x+2.5,E[6].y=M.y+3.5,this.arrows.push(E)}this.boundingBox=new i.BoundingBox(this),this.boundingBox.AbsolutePosition=new l.PointF2D(p,m),this.boundingBox.BorderLeft=-.4,this.boundingBox.BorderRight=4,this.boundingBox.BorderBottom=x}}g.SelectionStartSymbol=n},1327(de,g,c){var l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(g,"__esModule",{value:!0}),g.SkyBottomLineBatchCalculator=void 0;const s=c(5955),u=c(735),r=c(3508),i=l(c(3065)),o=c(813);g.SkyBottomLineBatchCalculator=class{constructor(n,h){const t=new Map;for(const f of n){const p=f.ParentMusicSystem.rules;(()=>{if(t.has(p))return t.get(p);{const m=[];return t.set(p,m),m}})().push({skyBottomLineCalculator:f.SkyBottomLineCalculator,measures:f.Measures})}this.batches=new Map;for(const[f,p]of t.entries()){const m=o.CollectionUtil.flat(p.map(y=>y.measures)),x=(()=>{if(h===s.SkyBottomLineBatchCalculatorBackendType.Plain)return new u.PlainSkyBottomLineBatchCalculatorBackend(f,m).initialize();try{return new r.WebGLSkyBottomLineBatchCalculatorBackend(f,m).initialize()}catch{return i.default.info("Couldn't create WebGLBackend for Skyline. Using fallback."),new u.PlainSkyBottomLineBatchCalculatorBackend(f,m).initialize()}})();x.initialize(),this.batches.set(f,{backend:x,entries:p})}}calculateLines(){for(const[,{backend:n,entries:h}]of this.batches){const t=n.calculateLines();let f=0;for(const{skyBottomLineCalculator:p,measures:m}of h){const x=f+m.length;p.updateLines(t.slice(f,x)),f=x}}}}},3667(de,g,c){var l=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(g,"__esModule",{value:!0}),g.SkyBottomLineBatchCalculatorBackend=void 0;const s=c(9834),u=l(c(3065));g.SkyBottomLineBatchCalculatorBackend=class{constructor(r,i){this.elementHeight=300,this.canvas=new s.CanvasVexFlowBackend(r),this.measures=i,this.maxWidth=Math.max(...this.measures.map(o=>{let n=o.getVFStave().getWidth();return n>0||o.IsExtraGraphicalMeasure||(u.default.warn("SkyBottomLineBatchCalculatorBackend: width not > 0 in measure "+o.MeasureNumber),n=50),n})),this.samplingUnit=r.SamplingUnit}initialize(){if(this.tableConfiguration={...this.getPreferredRenderingConfiguration(this.maxWidth,this.elementHeight),elementHeight:this.elementHeight},this.tableConfiguration.numRows<1||this.tableConfiguration.numColumns<1)throw u.default.warn("SkyBottomLineBatchCalculatorBackend: numRows or numColumns in tableConfiguration is 0"),new Error("numRows or numColumns in tableConfiguration is 0");this.tableConfiguration.elementWidth<this.maxWidth&&u.default.warn("SkyBottomLineBatchCalculatorBackend: elementWidth in tableConfiguration is less than the width of widest measure");const r=this.tableConfiguration.elementWidth*this.tableConfiguration.numColumns,i=this.elementHeight*this.tableConfiguration.numRows;return this.canvas.initializeHeadless(r,i),this.onInitialize(this.tableConfiguration),this}calculateLines(){const{numColumns:r,numRows:i,elementWidth:o}=this.tableConfiguration,n=this.elementHeight,h=r*i,t=this.canvas.getContext(),f=t,p=this.canvas.getCanvas(),m=[];for(let x=0;x<this.measures.length;x+=h){t.clear();const y=this.measures.slice(x,x+h);for(let S=0;S<y.length;++S){const M=y[S],E=M.getVFStave(),L=S%r,I=Math.floor(S/r);let T=E.getWidth();T>0||M.IsExtraGraphicalMeasure||(T=50),T=Math.floor(T),M.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),E.setX(0);const v=E.y+100;E.setY(v);const B=E.getWidth();E.setWidth(T),M.format(),E.setWidth(B);try{f.translate(L*o,I*n),M.draw(t),f.translate(-L*o,-I*n)}catch(D){u.default.warn("SkyBottomLineBatchCalculatorBackend.calculateLines.draw",D)}}const d=this.calculateFromCanvas(p,t,y,this.samplingUnit,this.tableConfiguration);m.push(...d)}return m}}},5479(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.SkyBottomLineCalculationResult=void 0,g.SkyBottomLineCalculationResult=class{constructor(c,l){this.skyLine=c,this.bottomLine=l}}},2779(de,g,c){var l=this&&this.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(g,"__esModule",{value:!0}),g.SkyBottomLineCalculator=void 0,c(9409);const s=c(9479),u=l(c(3065)),r=c(5479),i=c(9834);g.SkyBottomLineCalculator=class{constructor(o){this.mStaffLineParent=o,this.mRules=o.ParentMusicSystem.rules}updateLines(o){const n=this.StaffLineParent.Measures;if(o.length!==n.length)if(u.default.warn("SkyBottomLineCalculator: lengths of calculation result array and measure array do not match"),o.length<n.length)for(;o.length<n.length;)o.push(new r.SkyBottomLineCalculationResult([],[]));else o=o.slice(0,n.length);const h=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];for(const{skyLine:y,bottomLine:d}of o)this.mSkyLine.push(...y),this.mBottomLine.push(...d);const t=this.mSkyLine.length/h,f=[],p=[];for(let y=0;y<this.mSkyLine.length&&f.length!==h;y+=t){const d=Math.min(this.mSkyLine.length,y+t);let S=this.mSkyLine.slice(y,d+1);f.push(Math.min(...S)),S=this.mBottomLine.slice(y,d+1),p.push(Math.max(...S))}this.mSkyLine=f,this.mBottomLine=p,this.mSkyLine.length!==h&&u.default.debug(`SkyLine calculation was not correct (${this.mSkyLine.length} instead of ${h})`);const m=Math.max(...this.mSkyLine);this.mSkyLine=this.mSkyLine.map(y=>(y-m)/s.unitInPixels+this.StaffLineParent.TopLineOffset);const x=Math.min(...this.mBottomLine);this.mBottomLine=this.mBottomLine.map(y=>(y-x)/s.unitInPixels+this.StaffLineParent.BottomLineOffset)}calculateLines(){const o=this.mRules.SamplingUnit,n=[],h=new i.CanvasVexFlowBackend(this.mRules);for(const t of this.StaffLineParent.Measures){t.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);const f=t.getVFStave();let p=f.getWidth();p>0||t.IsExtraGraphicalMeasure||(u.default.warn("SkyBottomLineCalculator: width not > 0 in measure "+t.MeasureNumber),p=50),h.initializeHeadless(p);const m=h.getContext(),x=h.getCanvas();p=x.width;const y=x.height;f.setY(f.y+100);const d=f.getWidth();f.setWidth(p),t.format(),f.setWidth(d);try{t.draw(m)}catch(T){u.default.warn("SkyBottomLineCalculator.calculateLines.draw",T)}const S=m.getImageData(0,0,p,y),M=4,E=Math.max(Math.ceil(t.PositionAndShape.Size.width*o),1),L=new Array(E),I=new Array(E);for(let T=0;T<p;T++){for(let A=0;A<y;A++){const v=A*p*M+T*M;if(S.data[v+3]>0){L[T]=A;break}}for(let A=y;A>0;A--){const v=A*p*M+T*M;if(S.data[v+3]>0){I[T]=A;break}}}for(let T=0;T<L.length;T++)L[T]===void 0&&(L[T]=Math.max(this.findPreviousValidNumber(T,L),this.findNextValidNumber(T,L)));for(let T=0;T<I.length;T++)I[T]===void 0&&(I[T]=Math.max(this.findPreviousValidNumber(T,I),this.findNextValidNumber(T,I)));n.push(new r.SkyBottomLineCalculationResult(L,I)),h.clear()}this.updateLines(n)}updateSkyLineWithLine(o,n,h){const t=Math.floor(o.x*this.SamplingUnit),f=Math.ceil(n.x*this.SamplingUnit);for(let p=t+1;p<Math.min(f,this.SkyLine.length);p++)this.SkyLine[p]=h}updateSkyLineWithWedge(o,n){let h=Math.floor(o.x*this.SamplingUnit),t=Math.ceil(n.x*this.SamplingUnit),f=(n.y-o.y)/(n.x-o.x);t-h<=1&&(t++,f=0),h<0&&(h=0),h>=this.BottomLine.length&&(h=this.BottomLine.length-1),t<0&&(t=0),t>=this.BottomLine.length&&(t=this.BottomLine.length),this.SkyLine[h]=o.y;for(let p=h+1;p<Math.min(t,this.SkyLine.length);p++)this.SkyLine[p]=this.SkyLine[p-1]+f/this.SamplingUnit}updateBottomLineWithWedge(o,n){let h=Math.floor(o.x*this.SamplingUnit),t=Math.ceil(n.x*this.SamplingUnit),f=(n.y-o.y)/(n.x-o.x);t-h<=1&&(t++,f=0),h<0&&(h=0),h>=this.BottomLine.length&&(h=this.BottomLine.length-1),t<0&&(t=0),t>=this.BottomLine.length&&(t=this.BottomLine.length),this.BottomLine[h]=o.y;for(let p=h+1;p<t;p++)this.BottomLine[p]=this.BottomLine[p-1]+f/this.SamplingUnit}updateSkyLineInRange(o,n,h){this.updateInRange(this.mSkyLine,o,n,h)}updateBottomLineInRange(o,n,h){this.updateInRange(this.BottomLine,o,n,h)}resetSkyLineInRange(o,n){this.updateInRange(this.SkyLine,o,n)}resetBottomLineInRange(o,n){this.setInRange(this.BottomLine,o,n)}setSkyLineWithValue(o){this.SkyLine.forEach(n=>o)}setBottomLineWithValue(o){this.BottomLine.forEach(n=>o)}getLeftIndexForPointX(o,n){const h=Math.floor(o*this.SamplingUnit);return h<0?0:h>=n?n-1:h}getRightIndexForPointX(o,n){const h=Math.ceil(o*this.SamplingUnit);return h<0?0:h>=n?n-1:h}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(o=>!isNaN(o)))}getSkyLineMinAtPoint(o){const n=Math.round(o*this.SamplingUnit);return this.mSkyLine[n]}getSkyLineMinInRange(o,n){return this.getMinInRange(this.SkyLine,o,n)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(o=>!isNaN(o)))}getBottomLineMaxAtPoint(o){const n=Math.round(o*this.SamplingUnit);return this.mBottomLine[n]}getBottomLineMaxInRange(o,n){return this.getMaxInRange(this.BottomLine,o,n)}getBottomLineMaxInBoundingBox(o){const n=Math.floor(o.AbsolutePosition.x+o.BorderLeft),h=Math.ceil(o.AbsolutePosition.x+o.BorderRight);return this.getMaxInRange(this.mBottomLine,n,h)}updateWithBoundingBoxRecursively(o){if(o.ChildElements&&o.ChildElements.length>0)this.updateWithBoundingBoxRecursively(o);else{const n=o.BorderTop+o.AbsolutePosition.y,h=o.BorderBottom+o.AbsolutePosition.y;if(n<0){const t=Math.floor(o.AbsolutePosition.x+o.BorderLeft),f=Math.ceil(o.AbsolutePosition.x+o.BorderRight);this.updateInRange(this.mSkyLine,t,f,n)}else if(h>this.StaffLineParent.StaffHeight){const t=Math.floor(o.AbsolutePosition.x+o.BorderLeft),f=Math.ceil(o.AbsolutePosition.x+o.BorderRight);this.updateInRange(this.mBottomLine,t,f,h)}}}findPreviousValidNumber(o,n){for(let h=o;h>=0;h--)if(!isNaN(n[h]))return n[h];return 0}findNextValidNumber(o,n){if(o>=n.length)return n[o-1];for(let h=o;h<n.length;h++)if(!isNaN(n[h]))return n[h];return 0}drawPixel(o,n,h="#FF0000FF"){const t=n.getContext(),f=t.fillStyle;t.fillStyle=h,t.fillRect(o.x,o.y,2,2),t.fillStyle=f}updateInRange(o,n=0,h=o.length,t=0){if(n=Math.floor(n*this.SamplingUnit),(h=Math.ceil(h*this.SamplingUnit))<n)throw new Error("start index of line is greater than the end index");n<0&&(n=0),h>o.length&&(h=o.length);for(let f=n;f<h;f++)o[f]=Math.abs(t)>Math.abs(o[f])?t:o[f]}setInRange(o,n=0,h=o.length,t=0){if(n=Math.floor(n*this.SamplingUnit),(h=Math.ceil(h*this.SamplingUnit))<n)throw new Error("start index of line is greater then the end index");n<0&&(n=0),h>o.length&&(h=o.length);for(let f=n;f<h;f++)o[f]=t}getMinInRange(o,n,h){return n=Math.floor(n*this.SamplingUnit),h=Math.ceil(h*this.SamplingUnit),o?(n<0&&(n=0),n>=o.length&&(n=o.length-1),h<0&&(h=0),h>=o.length&&(h=o.length),n>=0&&h<=o.length?Math.min(...o.slice(n,h+1)):void 0):Number.MAX_VALUE}getMaxInRange(o,n,h){return n=Math.floor(n*this.SamplingUnit),h=Math.ceil(h*this.SamplingUnit),o?(n<0&&(n=0),n>=o.length&&(n=o.length-1),h<0&&(h=0),h>=o.length&&(h=o.length),n>=0&&h<=o.length?Math.max(...o.slice(n,h+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}}},2919(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.StaffLine=void 0;const l=c(6438),s=c(7741),u=c(298),r=c(9409),i=c(2779);class o extends s.GraphicalObject{constructor(h,t){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.graphicalGlissandi=[],this.Pedals=[],this.WavyLines=[],this.parentMusicSystem=h,this.parentStaff=t,this.boundingBox=new l.BoundingBox(this,h.PositionAndShape),this.skyBottomLine=new i.SkyBottomLineCalculator(this),this.staffHeight=this.parentMusicSystem.rules.StaffHeight,this.topLineOffset=0,this.bottomLineOffset=4,this.calculateStaffLineOffsets()}calculateStaffLineOffsets(){if(this.ParentStaff.isTab)this.ParentStaff.StafflineCount===5?this.staffHeight=this.bottomLineOffset=6*this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight: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(h){this.measures=h}get StaffLines(){return this.staffLines}set StaffLines(h){this.staffLines=h}get NextStaffLine(){const h=this.parentMusicSystem.StaffLines.indexOf(this);return h!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[h+1]:void 0}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(h){this.abstractExpressions=h}set LyricLines(h){this.lyricLines=h}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(h){this.lyricsDashes=h}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(h){this.parentMusicSystem=h}get ParentStaff(){return this.parentStaff}set ParentStaff(h){this.parentStaff=h}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(h){this.octaveShifts=h}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}get GraphicalGlissandi(){return this.graphicalGlissandi}addSlurToStaffline(h){this.graphicalSlurs.push(h)}addGlissandoToStaffline(h){this.graphicalGlissandi.push(h),h.StaffLine=this}addActivitySymbolClickArea(){const h=new u.StaffLineActivitySymbol(this),t=this.PositionAndShape;h.PositionAndShape.RelativePosition=new r.PointF2D(t.RelativePosition.x+t.BorderRight+.5,t.RelativePosition.y+.5),h.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(h){let t;for(let f=0,p=this.Measures.length;f<p;++f){const m=this.Measures[f];for(let x=0,y=m.staffEntries.length;x<y;++x){const d=m.staffEntries[x];Math.abs(d.PositionAndShape.RelativePosition.x-h+m.PositionAndShape.RelativePosition.x)<5&&(t=d)}}return t}}g.StaffLine=o},298(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.StaffLineActivitySymbol=void 0;const l=c(7741),s=c(6438);class u extends l.GraphicalObject{constructor(i){super(),this.parentStaffLine=i;const o=i.PositionAndShape;this.boundingBox=new s.BoundingBox(this,o),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}g.StaffLineActivitySymbol=u},4284(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.SystemLine=void 0;const l=c(6954),s=c(6438),u=c(7741);class r extends u.GraphicalObject{constructor(o,n,h,t,f=void 0){super(),this.lineType=o,this.linePosition=n,this.parentMusicSystem=h,this.topMeasure=t,this.bottomMeasure=f,this.parentTopStaffLine=t==null?void 0:t.ParentStaffLine,this.boundingBox=new s.BoundingBox(this,h.PositionAndShape)}static getObjectWidthForLineType(o,n){switch(n){case l.SystemLinesEnum.SingleThin:return o.SystemThinLineWidth;case l.SystemLinesEnum.DoubleThin:return 2*o.SystemThinLineWidth+o.DistanceBetweenVerticalSystemLines;case l.SystemLinesEnum.ThinBold:return o.SystemThinLineWidth+o.SystemBoldLineWidth+o.DistanceBetweenVerticalSystemLines;case l.SystemLinesEnum.BoldThinDots:case l.SystemLinesEnum.DotsThinBold:return o.SystemThinLineWidth+o.SystemBoldLineWidth+o.DistanceBetweenVerticalSystemLines+o.SystemDotWidth+o.DistanceBetweenDotAndLine;case l.SystemLinesEnum.DotsBoldBoldDots:return 2*o.SystemBoldLineWidth+2*o.SystemDotWidth+2*o.DistanceBetweenDotAndLine+o.DistanceBetweenVerticalSystemLines;default:return 0}}}g.SystemLine=r},67(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.SystemLinePosition=void 0,function(l){l[l.MeasureBegin=0]="MeasureBegin",l[l.MeasureEnd=1]="MeasureEnd"}(c||(g.SystemLinePosition=c={}))},6954(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.SystemLinesEnumHelper=g.SystemLinesEnum=void 0,function(l){l[l.SingleThin=0]="SingleThin",l[l.DoubleThin=1]="DoubleThin",l[l.ThinBold=2]="ThinBold",l[l.BoldThinDots=3]="BoldThinDots",l[l.DotsThinBold=4]="DotsThinBold",l[l.DotsBoldBoldDots=5]="DotsBoldBoldDots",l[l.None=6]="None",l[l.Dotted=7]="Dotted",l[l.Dashed=8]="Dashed",l[l.Bold=9]="Bold",l[l.BoldThin=10]="BoldThin",l[l.DoubleBold=11]="DoubleBold",l[l.Tick=12]="Tick",l[l.Short=13]="Short"}(c||(g.SystemLinesEnum=c={})),g.SystemLinesEnumHelper=class{static xmlBarlineStyleToSystemLinesEnum(l){return l==="regular"?c.SingleThin:l==="dotted"?c.Dotted:l==="dashed"?c.Dashed:l==="heavy"?c.Bold:l==="light-light"?c.DoubleThin:l==="light-heavy"?c.ThinBold:l==="heavy-light"?c.BoldThin:l==="heavy-heavy"?c.DoubleBold:l==="tick"?c.Tick:l==="short"?c.Short:l==="none"?c.None:c.SingleThin}}},6723(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.VerticalGraphicalStaffEntryContainer=void 0,g.VerticalGraphicalStaffEntryContainer=class{constructor(c,l){this.staffEntries=[],this.absoluteTimestamp=l,this.staffEntries=new Array(c)}get Index(){return this.index}set Index(c){this.index=c}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(c){this.staffEntries=c}static compareByTimestamp(c,l){const s=c.absoluteTimestamp.RealValue,u=l.absoluteTimestamp.RealValue;return s<u?-1:s>u?1:0}getFirstNonNullStaffEntry(){for(let c=0,l=this.staffEntries.length;c<l;++c){const s=this.staffEntries[c];if(s)return s}}}},1083(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.AlignmentManager=void 0;const l=c(2400),s=c(9409);g.AlignmentManager=class{constructor(u){this.parentStaffline=u,this.rules=this.parentStaffline.ParentMusicSystem.rules}alignDynamicExpressions(){var i,o;const u=[];let r=new Array;for(let n=0;n<this.parentStaffline.AbstractExpressions.length-1;n++){const h=this.parentStaffline.AbstractExpressions[n],t=this.parentStaffline.AbstractExpressions[n+1],f=(i=h==null?void 0:h.SourceExpression)==null?void 0:i.Placement,p=(o=t==null?void 0:t.SourceExpression)==null?void 0:o.Placement;if(f===p){const m=this.getDistance(h.PositionAndShape,t.PositionAndShape);Math.abs(m.x)<this.rules.DynamicExpressionMaxDistance?(r.indexOf(h)===-1&&r.push(h),r.push(t)):(u.push(r),r=new Array)}}u.push(r);for(const n of u)if(n.length>0){const h=n.map(f=>f.PositionAndShape.Center.y),t=Math.max(...h);for(let f=0;f<n.length;f++){const p=n[f],m=h[f]-t;if(p instanceof l.VexFlowContinuousDynamicExpression?(p.shiftYPosition(-m),p.calcPsi()):(p.PositionAndShape.RelativePosition.y-=.8*m,p.PositionAndShape.calculateBoundingBox()),p.squeeze){const x=f<n.length-1?n[f+1]:void 0,y=f>0?n[f-1]:void 0;if(x){const d=this.getOverlap(p.PositionAndShape,x.PositionAndShape);p.squeeze(-(d.x+this.rules.DynamicExpressionSpacer))}if(y){const d=this.getOverlap(y.PositionAndShape,p.PositionAndShape);p.squeeze(d.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(u,r){const i=u.RelativePosition.x+u.BorderMarginRight,o=r.RelativePosition.x+r.BorderMarginLeft,n=u.RelativePosition.y+u.BorderMarginBottom,h=r.RelativePosition.y+r.BorderMarginTop;return new s.PointF2D(o-i,h-n)}getOverlap(u,r){return new s.PointF2D(u.RelativePosition.x+u.BorderMarginRight-(r.RelativePosition.x+r.BorderMarginLeft),u.RelativePosition.y+u.BorderMarginBottom-(r.RelativePosition.y+r.BorderMarginTop))}}},9834(de,g,c){var l=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(g,"__esModule",{value:!0}),g.CanvasVexFlowBackend=void 0;var s=l(c(3206)).default.Flow;const u=c(1902),r=c(6014),i=c(624),o=c(1888);class n extends u.VexFlowBackend{constructor(t){super(),this.rules=t}getVexflowBackendType(){return s.Renderer.Backends.CANVAS}getOSMDBackendType(){return i.BackendType.Canvas}getCanvasSize(){var t;return(t=document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber))==null?void 0:t.offsetHeight}initialize(t,f){this.zoom=f,this.canvas=document.createElement("canvas"),this.graphicalMusicPage||(this.graphicalMusicPage=new o.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.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}initializeHeadless(t=300,f=300){this.graphicalMusicPage||(this.graphicalMusicPage=new o.GraphicalMusicPage(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=f,this.renderer=new s.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}getContext(){return this.ctx}free(){this.canvas&&(this.canvas.width=0,this.canvas.height=0,this.canvas.remove(),delete this.canvas,this.canvas=null)}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,f){this.CanvasRenderingCtx.translate(t,f)}renderText(t,f,p,m,x,y,d=void 0,S=void 0){const M=this.CanvasRenderingCtx.font;this.CanvasRenderingCtx.save(),this.CanvasRenderingCtx.font=r.VexFlowConverter.font(t,f,p,this.rules,S),this.CanvasRenderingCtx.fillStyle=d,this.CanvasRenderingCtx.strokeStyle=d,this.CanvasRenderingCtx.fillText(m,y.x,y.y+x),this.CanvasRenderingCtx.restore(),this.CanvasRenderingCtx.font=M}renderRectangle(t,f,p,m=1){const x=this.CanvasRenderingCtx.fillStyle;this.CanvasRenderingCtx.fillStyle=p||r.VexFlowConverter.style(f),this.CanvasRenderingCtx.globalAlpha=m,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.CanvasRenderingCtx.fillStyle=x,this.CanvasRenderingCtx.globalAlpha=1}renderLine(t,f,p="#FF0000FF",m=2,x){const y=this.CanvasRenderingCtx.strokeStyle;this.CanvasRenderingCtx.strokeStyle=p,this.CanvasRenderingCtx.beginPath(),this.CanvasRenderingCtx.moveTo(t.x,t.y),this.CanvasRenderingCtx.lineTo(f.x,f.y),this.CanvasRenderingCtx.stroke(),this.CanvasRenderingCtx.strokeStyle=y}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()}renderPath(t,f=!0,p){let m;this.ctx.beginPath();for(const x of t)m?this.ctx.lineTo(x.x,x.y):(this.ctx.moveTo(x.x,x.y),m=x);this.ctx.closePath(),f?this.ctx.fill():this.ctx.stroke()}get CanvasRenderingCtx(){return this.ctx.vexFlowCanvasContext}}g.CanvasVexFlowBackend=n},9436(de,g,c){var l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(g,"__esModule",{value:!0}),g.SvgVexFlowBackend=void 0;var s=l(c(3206)).default.Flow;const u=c(1902),r=c(6014),i=c(2570),o=c(624),n=l(c(3065));class h extends u.VexFlowBackend{constructor(f){super(),this.rules=f}getVexflowBackendType(){return s.Renderer.Backends.SVG}getOSMDBackendType(){return o.BackendType.SVG}getCanvasSize(){var f;return(f=document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber))==null?void 0:f.offsetHeight}initialize(f,p){this.zoom=p,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",f.appendChild(this.inner),this.renderer=new s.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(f){var m;const p=(m=this.ctx)==null?void 0:m.svg;if(!p)return!1;try{p.removeChild(f)}catch(x){return n.default.error(x),!1}return!0}free(){const f=this.ctx.svg;for(;f.lastChild;)f.removeChild(f.lastChild)}clear(){this.ctx&&(this.free(),this.rules.PageBackgroundColor&&(this.ctx.svg.style["background-color"]=this.rules.PageBackgroundColor))}scale(f){this.ctx.scale(f,f)}translate(f,p){}renderText(f,p,m,x,y,d,S=void 0,M=void 0){this.ctx.save();const E=this.ctx.openGroup("text");S&&(this.ctx.attributes.fill=S,this.ctx.attributes.stroke=S);let L=M;M&&M!=="default"||(L=this.rules.DefaultFontFamily),this.ctx.setFont(L,f,r.VexFlowConverter.fontStyle(p)),this.ctx.attributes["font-size"]=`${f}px`,this.ctx.state["font-size"]=`${f}px`;let I="normal",T="normal";switch(p){case i.FontStyles.Bold:I="bold";break;case i.FontStyles.Italic:T="italic";break;case i.FontStyles.BoldItalic:I="bold",T="italic";break;default:I="normal"}return this.ctx.attributes["font-weight"]=I,this.ctx.state["font-weight"]=I,this.ctx.attributes["font-style"]=T,this.ctx.state["font-style"]=T,this.ctx.fillText(x,d.x,d.y+y),this.ctx.closeGroup(),this.ctx.restore(),E}renderRectangle(f,p,m,x=1){this.ctx.save();const y=this.ctx.openGroup("rect");return this.ctx.attributes.fill=m||r.VexFlowConverter.style(p),this.ctx.attributes["fill-opacity"]=x,this.ctx.fillRect(f.x,f.y,f.width,f.height),this.ctx.restore(),this.ctx.attributes["fill-opacity"]=1,this.ctx.closeGroup(),y}renderLine(f,p,m="#FF0000FF",x=2,y){this.ctx.save();const d=this.ctx.openGroup("line",y);return this.ctx.beginPath(),this.ctx.moveTo(f.x,f.y),this.ctx.lineTo(p.x,p.y),this.ctx.attributes.stroke=m,this.ctx.lineWidth=x,this.ctx.stroke(),this.ctx.closeGroup(),this.ctx.restore(),d}renderCurve(f,p,m){let x;p&&m&&(x=`${m.getSVGId()}-slur`);const y=this.ctx.openGroup("curve",x);return this.ctx.beginPath(),this.ctx.moveTo(f[0].x,f[0].y),this.ctx.bezierCurveTo(f[1].x,f[1].y,f[2].x,f[2].y,f[3].x,f[3].y),this.ctx.lineTo(f[7].x,f[7].y),this.ctx.bezierCurveTo(f[6].x,f[6].y,f[5].x,f[5].y,f[4].x,f[4].y),this.ctx.lineTo(f[0].x,f[0].y),this.ctx.closePath(),this.ctx.fill(),this.ctx.closeGroup(),y}renderPath(f,p=!0,m){const x=this.ctx.openGroup("path",m);let y;this.ctx.beginPath();for(const d of f)y?this.ctx.lineTo(d.x,d.y):(this.ctx.moveTo(d.x,d.y),y=d);return this.ctx.closePath(),p?this.ctx.fill():this.ctx.stroke(),this.ctx.stroke(),this.ctx.closeGroup(),x}export(){const f=this.ctx.svg.cloneNode(!0),p=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),m=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",p);m.replaceChild(f,m.documentElement);const x=new XMLSerializer().serializeToString(m),y=document.createElement("a");y.href="data:image/svg+xml; charset=utf8, "+encodeURIComponent(x.replace(/></g,`>
|
|
\r<`)),y.download="opensheetmusicdisplay_download.svg",y.innerHTML=window.location.href+"/download",document.body.appendChild(y)}}g.SvgVexFlowBackend=h},1902(de,g,c){var l=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowBackend=g.VexFlowBackends=void 0;var s=l(c(3206)).default.Flow;g.VexFlowBackends=class{},g.VexFlowBackend=class{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let u=this.canvas;return this.getVexflowBackendType()===s.Renderer.Backends.CANVAS&&(u=this.inner),u}getRenderer(){return this.renderer}removeAllChildrenFromContainer(u){for(;u.children.length!==0;)u.removeChild(u.children.item(0))}removeFromContainer(u){const r=this.getRenderElement();for(let i=0;i<u.children.length;i++)if(u.children.item(i)===r){u.removeChild(r);break}}resize(u,r){this.renderer.resize(u,r),this.width=u,this.height=r}}},2400(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowContinuousDynamicExpression=void 0;const l=c(1066),s=c(8254),u=c(7435),r=c(7533),i=c(2570);class o extends l.GraphicalContinuousDynamicExpression{constructor(h,t,f,p){if(super(h,t,f),this.IsVerbal){const m=new u.Label(h.Label);this.label=new s.GraphicalLabel(m,p||this.rules.ContinuousDynamicTextHeight,r.TextAlignmentEnum.LeftCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=i.FontStyles.Italic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox(),h.ColorXML&&this.rules.ExpressionsUseXMLColor&&(this.label.ColorXML=h.ColorXML)}}}g.VexFlowContinuousDynamicExpression=o},6014(de,g,c){var l=this&&this.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowConverter=void 0;var s=l(c(3206)).default.Flow;const u=c(164),r=c(8233),i=c(2561),o=c(9288),n=c(4543),h=c(8233),t=c(8233),f=c(6954),p=c(2570),m=c(5951),x=c(2683),y=l(c(3065)),d=c(1336),S=c(67),M=c(8215),E=c(4064),L=c(9479),I=c(4236),T=c(9647),A=c(6362);class v{static durations(D,_){const F=[],k=D.clone();for(;k.RealValue>1e-4;){const j=k.RealValue;if(j>=2)F.push("1/2"),k.Sub(new i.Fraction(2,1));else if(j>=1)F.push("w"),k.Sub(new i.Fraction(1,1));else if(j<1&&j>=.5){if(_&&j>.5)return["w"];F.push("h"),k.Sub(new i.Fraction(1,2))}else if(j<.5&&j>=.25){if(_&&j>.25)return["h"];F.push("q"),k.Sub(new i.Fraction(1,4))}else if(j<.25&&j>=.125){if(_&&j>.125)return["q"];F.push("8"),k.Sub(new i.Fraction(1,8))}else if(j<.125&&j>=.0625){if(_&&j>.0625)return["8"];F.push("16"),k.Sub(new i.Fraction(1,16))}else if(j<.0625&&j>=.03125){if(_&&j>.03125)return["16"];F.push("32"),k.Sub(new i.Fraction(1,32))}else if(j<.03125&&j>=.015625){if(_&&j>.015625)return["32"];F.push("64"),k.Sub(new i.Fraction(1,64))}else{if(_)return["64"];F.push("128"),k.Sub(new i.Fraction(1,128))}}return F}static pitch(D,_,F,k=void 0,j=void 0){let P=j;j===void 0&&(P=3),_&&j===void 0&&(P=0,F.ClefType===u.ClefEnum.F&&(P=2),F.ClefType===u.ClefEnum.C&&(P=2));const G=t.NoteEnum[D.FundamentalNote].toLowerCase(),Y=r.Pitch.accidentalVexflow(D.Accidental),X=D.Octave-F.OctaveOffset+P;let ie="";return k&&(ie=this.NoteHeadCode(k)),[G+"n/"+X+ie,Y,F]}static restToNotePitch(D,_){let F=D.Octave;switch(_){case u.ClefEnum.C:case u.ClefEnum.F:F+=2;case u.ClefEnum.G:}return new r.Pitch(D.FundamentalNote,F,h.AccidentalEnum.NONE)}static NoteHeadCode(D){const _=D.Filled?"2":"1";switch(D.Shape){case E.NoteHeadShape.NORMAL:case E.NoteHeadShape.NONE:return"";case E.NoteHeadShape.DIAMOND:return"/D"+_;case E.NoteHeadShape.TRIANGLE:return"/T"+_;case E.NoteHeadShape.TRIANGLE_INVERTED:return"/TI";case E.NoteHeadShape.X:return"/X"+_;case E.NoteHeadShape.CIRCLEX:return"/X3";case E.NoteHeadShape.RECTANGLE:return"/R"+_;case E.NoteHeadShape.SQUARE:return"/S"+_;case E.NoteHeadShape.SLASH:default:return""}}static GhostNotes(D){const _=[],F=v.durations(D,!1);for(const k of F)_.push(new s.GhostNote({duration:k}));return _}static StaveNote(D){var H,W,K,q,te,se,ue,fe,xe,ve,Se;D.sortForVexflow();const _=D.notes,F=D.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,k=_[0];let j=[];const P=[],G=k.graphicalNoteLength,Y=k.sourceNote.NoteTuplet!==void 0;let X,ie=v.durations(G,Y)[0];k.sourceNote.TypeLength!==void 0&&k.sourceNote.TypeLength!==G&&k.sourceNote.TypeLength.RealValue!==0&&(ie=v.durations(k.sourceNote.TypeLength,Y)[0],k.numberOfDots=k.sourceNote.DotsXml);let oe,$,Q=k.numberOfDots,ne=!1,ee=0,N=!1;for(const ye of _){if(Q<ye.numberOfDots&&(Q=ye.numberOfDots),ye.sourceNote.isRest()){if(N=!0,ye.sourceNote.Pitch){j=[ye.vfpitch[0]];break}{j=["b/4"];const Me=(H=ye.parentVoiceEntry)==null?void 0:H.parentVoiceEntry;if(Me){const _e=(W=ye.parentVoiceEntry)==null?void 0:W.parentStaffEntry.parentMeasure.staffEntries;let Te,Le,Pe=-1;for(let Ae=0;Ae<_e.length;Ae++)if(((q=(K=_e[Ae])==null?void 0:K.graphicalVoiceEntries[0])==null?void 0:q.parentVoiceEntry)===Me){Pe=Ae;break}if(Pe>=1&&_e.length-1>=Pe+1&&(Te=(se=(te=_e[Pe-1])==null?void 0:te.graphicalVoiceEntries[0])==null?void 0:se.parentVoiceEntry,Le=(fe=(ue=_e[Pe+1])==null?void 0:ue.graphicalVoiceEntries[0])==null?void 0:fe.parentVoiceEntry,Te&&Le)){const Ae=Te.Notes[0],Ce=Le.Notes[0];if((xe=Ae.NoteBeam)!=null&&xe.Notes.includes(Ce)){const Be=Te.Notes.last().Pitch,Ie=ye.Clef();j=[v.pitch(v.restToNotePitch(Be.getTransposedPitch(-2),Ie.ClefType),!1,Ie)[0]]}}}}if((ye.sourceNote.IsWholeMeasureRest||G.RealValue===ye.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue)&&(j=["d/5"],D.parentStaffEntry.parentMeasure.ParentStaff.StafflineCount===1&&(j=["b/4"]),ie="w",Q=0,ne=!0,ee=F.WholeRestXShiftVexflow*L.unitInPixels),ye.sourceNote.ParentStaff.Voices.length>1){const Me=ye.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,_e=ye.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let Te,Le;for(const Pe of Me)for(const Ae of Pe.notes){if(Ae===ye||Ae.sourceNote.isRest()||!Ae.sourceNote.PrintObject)continue;const Ce=Ae.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,Be=_e===1||_e===5,Ie=Be?1:-1,Fe=Ae.sourceNote.Pitch.getHalfTone();(!Te||Ie===1&&Fe>Te||Ie===-1&&Fe<Te)&&(Te=Fe,Le=0,Be&&Ce===d.StemDirectionType.Up?Le+=7:Be||Ce!==d.StemDirectionType.Down?Le+=Be?1:2:Le+=7,ie.includes("8")||Ce===d.StemDirectionType.Up&&Ie===-1&&(Le+=1),Ae.sourceNote.NoteBeam&&(Le+=1),ie.includes("w")&&(Le/=2),Le+=.5*Math.ceil(F.RestCollisionYPadding),Le*=Ie,ye.lineShift=Le)}if(Te>0){let Pe=3;const Ae=ye.Clef();switch(Ae.ClefType){case u.ClefEnum.F:Pe=5;break;case u.ClefEnum.C:Pe=4}oe=r.Pitch.fromHalftone(Te),j=[v.pitch(oe,!0,Ae,void 0,Pe)[0]]}}break}const be=ye.vfpitch;j.push(be[0]),P.push(be[1]),X||(X=v.Clef(be[2]).type)}for(let ye=0,be=Q;ye<be;++ye)ie+="d";_.length===1&&((ve=_[0].sourceNote.Notehead)==null?void 0:ve.Shape)===E.NoteHeadShape.SLASH&&(ie+="s"),N&&(ie+="r");const R={align_center:ne,auto_stem:!0,clef:X,duration:ie,keys:j,slash:D.GraceSlash},O=D.notes[0].sourceNote;if(O.IsCueNote&&(R.glyph_font_scale=s.DEFAULT_NOTATION_FONT_SCALE*s.GraceNote.SCALE,R.stroke_px=s.GraceNote.LEDGER_LINE_OFFSET),D.parentVoiceEntry.IsGrace||D.notes[0].sourceNote.IsCueNote)$=new s.GraceNote(R);else{$=new s.StaveNote(R),$.stagger_same_whole_notes=F.StaggerSameWholeNotes;const ye=D.parentStaffEntry.LyricsEntries;let be=!0,Me=0;if(ye.length>0&&F.RenderLyrics&&F.LyricsUseXPaddingForLongLyrics){const _e=D.parentStaffEntry.parentMeasure,Te=[];for(let Ae=_e.staffEntries.indexOf(D.parentStaffEntry)+1;Ae<_e.staffEntries.length;Ae++){const Ce=_e.staffEntries[Ae];Ce.graphicalVoiceEntries[0]&&Te.push(Ce)}let Le,Pe=D.parentStaffEntry.relInMeasureTimestamp.clone();for(const Ae of Te){const Ce=Ae.relInMeasureTimestamp.clone();if(Le=i.Fraction.minus(Ce,D.parentVoiceEntry.Timestamp),Le.RealValue>.25){be=!1;break}if(Ae.LyricsEntries.length>0)break;Me+=32*i.Fraction.minus(Ce,Pe).RealValue,Pe=Ce}}if(F.RenderLyrics&&F.LyricsUseXPaddingForLongLyrics&&ye.length>0&&be){let _e=!1,Te=0;for(const Pe of _)if(Pe.sourceNote.Length.RealValue<=.125){_e=!0;break}let Le=!1;for(const Pe of ye){const Ae=F.LyricsXPaddingWidthThreshold;let Ce=Pe.GraphicalLabel.PositionAndShape.Size.width;if(Pe.hasDashFromLyricWord()&&(Ce+=.5),Ce>Ae){Te+=Ce-Ae;const Be=D.parentStaffEntry,Ie=Be.parentMeasure.staffEntries,Fe=Ie.indexOf(Be)===Ie.length-1,Ke=Fe&&Pe.hasDashFromLyricWord();Fe&&(Me+=Ke?F.LyricsXPaddingReductionForLastNoteInMeasureCrossMeasureMidWord:F.LyricsXPaddingReductionForLastNoteInMeasure),_e||(Me+=F.LyricsXPaddingReductionForLongNotes),!F.LyricsXPaddingForLastNoteInMeasure&&Fe||Ce>Ae+Me&&(Le=!0,Te-=Me);break}}Le&&($.paddingRight=10*F.LyricsXPaddingFactorForLongLyrics*Te)}}const U=D.notes[0].lineShift;if(U!==0&&($.getKeyProps()[0].line+=U),_.length>1)for(let ye=0;ye<_.length;ye++)((Se=_[ye].sourceNote.Notehead)==null?void 0:Se.Shape)===E.NoteHeadShape.SLASH&&($.note_heads[ye].note_type="s");if($.getKeyProps().forEach(({line:ye},be)=>D.notes[be].staffLine=ye),(F.LedgerLineWidth||F.LedgerLineStrokeStyle)&&($.ledgerLineStyle||($.ledgerLineStyle={}),F.LedgerLineWidth&&($.ledgerLineStyle.lineWidth=F.LedgerLineWidth),F.LedgerLineStrokeStyle&&($.ledgerLineStyle.strokeStyle=F.LedgerLineStrokeStyle)),F.ColoringEnabled){const ye=F.DefaultColorStem;let be=D.parentVoiceEntry.StemColor;!be&&ye&&(be=ye);const Me={fillStyle:be,strokeStyle:be};be&&($.setStemStyle(Me),$.flag&&F.ColorFlags&&$.setFlagStyle(Me))}if($.x_shift=ee,D.parentVoiceEntry.IsGrace&&D.notes[0].sourceNote.NoteBeam&&(D.parentVoiceEntry.WantedStemDirection=D.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),D.parentVoiceEntry)switch(D.parentVoiceEntry.WantedStemDirection){case d.StemDirectionType.Up:$.setStemDirection(s.Stem.UP),D.parentVoiceEntry.StemDirection=d.StemDirectionType.Up;break;case d.StemDirectionType.Down:$.setStemDirection(s.Stem.DOWN),D.parentVoiceEntry.StemDirection=d.StemDirectionType.Down}for(let ye=0,be=_.length;ye<be;ye+=1){if(_[ye].setIndex($,ye),P[ye]){if(P[ye]==="###"){$.addAccidental(ye,new s.Accidental("##")),$.addAccidental(ye,new s.Accidental("#"));continue}if(P[ye]==="bbs"){$.addAccidental(ye,new s.Accidental("bb")),$.addAccidental(ye,new s.Accidental("b"));continue}$.addAccidental(ye,new s.Accidental(P[ye]))}const Me=_[ye].sourceNote.TremoloStrokes;if(Me>0){const _e=new s.Tremolo(Me);_e.extra_stroke_scale=F.TremoloStrokeScale,_e.y_spacing_scale=F.TremoloYSpacingScale,$.addModifier(ye,_e)}}if(O.Length.RealValue===.25&&O.Notehead&&O.Notehead.Filled===!1){const ye=$.getKeyProps();for(let be=0;be<ye.length;be++)ye[be].code="v81"}for(let ye=0,be=Q;ye<be;++ye)$.addDotToAll();return $}static generateArticulations(D,_,F){if(D&&D.getAttribute("type")!=="GhostNote")for(const k of _.sourceNote.ParentVoiceEntry.Articulations){let j,P=s.Modifier.Position.ABOVE;if(D.getStemDirection()===s.Stem.UP&&(P=s.Modifier.Position.BELOW,F.ArticulationAboveNoteForStemUp)){const Y=_.parentVoiceEntry.parentStaffEntry.parentMeasure,X=Y==null?void 0:Y.ParentStaff,ie=X==null?void 0:X.ParentInstrument.Staves;(ie.length===1||ie.length===2&&X!==ie[1])&&(P=s.Modifier.Position.ABOVE)}const G=k.articulationEnum;switch(F.ArticulationPlacementFromXML&&(k.placement===A.PlacementEnum.Above?P=s.Modifier.Position.ABOVE:k.placement===A.PlacementEnum.Below&&(P=s.Modifier.Position.BELOW)),G){case d.ArticulationEnum.accent:{j=new s.Articulation("a>");const Y=_.sourceNote.NoteSlurs;for(const X of Y)X.StartNote===_.sourceNote&&(X.PlacementXml===A.PlacementEnum.Above?j.setYShift(10*-F.SlurStartArticulationYOffsetOfArticulation):X.PlacementXml===A.PlacementEnum.Below&&j.setYShift(10*F.SlurStartArticulationYOffsetOfArticulation));j.render_options={...j.render_options,extra_left_px:0,extra_right_px:0},j.getWidth&&(j.getWidth=function(){return 0});break}case d.ArticulationEnum.breathmark:j=new s.Articulation("abr"),k.placement===A.PlacementEnum.Above&&(P=s.Modifier.Position.ABOVE),j.breathMarkDistance=F.BreathMarkDistance;break;case d.ArticulationEnum.downbow:j=new s.Articulation("am"),k.placement===void 0&&(P=s.Modifier.Position.ABOVE,k.placement=A.PlacementEnum.Above);break;case d.ArticulationEnum.fermata:j=new s.Articulation("a@a"),P=s.Modifier.Position.ABOVE,k.placement=A.PlacementEnum.Above;break;case d.ArticulationEnum.marcatodown:j=new s.Articulation("a|");break;case d.ArticulationEnum.marcatoup:j=new s.Articulation("a^"),P=s.Modifier.Position.ABOVE;break;case d.ArticulationEnum.invertedfermata:{const Y=_.sourceNote.ParentVoiceEntry;if(Y!==_.sourceNote.ParentVoiceEntry.ParentSourceStaffEntry.VoiceEntries.last()){Y.Articulations=Y.Articulations.slice(Y.Articulations.indexOf(k)),Y.ParentSourceStaffEntry.VoiceEntries.last().Articulations.push(k);continue}j=new s.Articulation("a@u"),P=s.Modifier.Position.BELOW,k.placement=A.PlacementEnum.Below;break}case d.ArticulationEnum.lefthandpizzicato:j=new s.Articulation("a+");break;case d.ArticulationEnum.naturalharmonic:j=new s.Articulation("ah");break;case d.ArticulationEnum.snappizzicato:j=new s.Articulation("ao");break;case d.ArticulationEnum.staccatissimo:j=new s.Articulation("av");break;case d.ArticulationEnum.staccato:j=new s.Articulation("a.");break;case d.ArticulationEnum.tenuto:j=new s.Articulation("a-");break;case d.ArticulationEnum.upbow:j=new s.Articulation("a|"),k.placement===void 0&&(P=s.Modifier.Position.ABOVE,k.placement=A.PlacementEnum.Above);break;case d.ArticulationEnum.strongaccent:j=new s.Articulation("a^")}j&&(j.setPosition(P),D.addModifier(0,j))}}static generateOrnaments(D,_){let F,k=s.Modifier.Position.ABOVE;switch(_.placement===A.PlacementEnum.Below&&(k=s.Modifier.Position.BELOW),_.GetOrnament){case M.OrnamentEnum.DelayedInvertedTurn:F=new s.Ornament("turn_inverted"),F.setDelayed(!0);break;case M.OrnamentEnum.DelayedTurn:F=new s.Ornament("turn"),F.setDelayed(!0);break;case M.OrnamentEnum.InvertedMordent:F=new s.Ornament("mordent"),F.setDelayed(!1);break;case M.OrnamentEnum.InvertedTurn:F=new s.Ornament("turn_inverted"),F.setDelayed(!1);break;case M.OrnamentEnum.Mordent:F=new s.Ornament("mordent_inverted"),F.setDelayed(!1);break;case M.OrnamentEnum.Trill:F=new s.Ornament("tr"),F.setDelayed(!1);break;case M.OrnamentEnum.Turn:F=new s.Ornament("turn"),F.setDelayed(!1);break;default:return void y.default.warn("unhandled OrnamentEnum type: "+_.GetOrnament)}F&&(_.AccidentalBelow!==h.AccidentalEnum.NONE&&F.setLowerAccidental(r.Pitch.accidentalVexflow(_.AccidentalBelow)),_.AccidentalAbove!==h.AccidentalEnum.NONE&&F.setUpperAccidental(r.Pitch.accidentalVexflow(_.AccidentalAbove)),F.setPosition(k),D.addModifier(0,F))}static StrokeTypeFromArpeggioType(D){switch(D){case I.ArpeggioType.ARPEGGIO_DIRECTIONLESS:return s.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case I.ArpeggioType.BRUSH_DOWN:return s.Stroke.Type.BRUSH_UP;case I.ArpeggioType.BRUSH_UP:return s.Stroke.Type.BRUSH_DOWN;case I.ArpeggioType.RASQUEDO_DOWN:return s.Stroke.Type.RASQUEDO_UP;case I.ArpeggioType.RASQUEDO_UP:return s.Stroke.Type.RASQUEDO_DOWN;case I.ArpeggioType.ROLL_DOWN:return s.Stroke.Type.ROLL_UP;case I.ArpeggioType.ROLL_UP:return s.Stroke.Type.ROLL_DOWN;default:return s.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}static CreateTabNote(D){var $;const _=[],F=D.notes.reverse(),k=[],j=D.notes[0].graphicalNoteLength,P=D.notes[0].sourceNote.NoteTuplet!==void 0;let G=v.durations(j,P)[0],Y=0;const X=D.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules;let ie=!1;for(const Q of D.notes){const ne=Q.sourceNote;let ee={str:ne.StringNumberTab,fret:ne.FretNumber};Q.sourceNote instanceof T.TabNote||(y.default.info(`invalid tab note: ${Q.sourceNote.Pitch.ToString()} in measure ${D.parentStaffEntry.parentMeasure.MeasureNumber}, likely missing XML string+fret number.`),ee={str:1,fret:0}),X.TabUseXNoteheadShapeForTabNote&&(($=Q.sourceNote.Notehead)==null?void 0:$.Shape)===E.NoteHeadShape.X&&(ee.fret="x",ie=!0),_.push(ee),ne.BendArray&&ne.BendArray.forEach(function(N){let R;const O=N.bendalter-ee.fret;R=O>1?"Full":O===1?"1/2":"1/4",N.direction==="up"?k.push({type:s.Bend.UP,text:R,width:10}):k.push({type:s.Bend.DOWN,text:R,width:10})}),Y<Q.numberOfDots&&(Y=Q.numberOfDots)}for(let Q=0,ne=Y;Q<ne;++Q)G+="d";const oe=new s.TabNote({duration:G,positions:_});ie&&(oe.render_options.scale=X.TabXNoteheadScale,oe.render_options.TabUseXNoteheadAlternativeGlyph=X.TabUseXNoteheadAlternativeGlyph,oe.updateWidth()),X.UsePageBackgroundColorForTabNotes&&(oe.BackgroundColor=X.PageBackgroundColor);for(let Q=0,ne=F.length;Q<ne;Q+=1)F[Q].setIndex(oe,Q);return k.forEach(function(Q){Q.type===s.Bend.UP?oe.addModifier(new s.Bend(Q.text,!1)):oe.addModifier(new s.Bend(Q.text,!0))}),oe}static Clef(D,_="default"){let F,k;switch(_!=="default"&&_!=="small"&&(y.default.warn(`Invalid VexFlow clef size "${_}" specified. Using "default".`),_="default"),D.ClefType){case u.ClefEnum.G:switch(D.Line){case 1:F="french";break;case 2:F="treble";break;default:F="treble",y.default.error(`Clef ${u.ClefEnum[D.ClefType]} on line ${D.Line} not supported by VexFlow. Using default value "${F}".`)}break;case u.ClefEnum.F:switch(D.Line){case 4:F="bass";break;case 3:F="baritone-f";break;case 5:F="subbass";break;default:F="bass",y.default.error(`Clef ${u.ClefEnum[D.ClefType]} on line ${D.Line} not supported by VexFlow. Using default value "${F}".`)}break;case u.ClefEnum.C:switch(D.Line){case 3:F="alto";break;case 4:F="tenor";break;case 1:F="soprano";break;case 2:F="mezzo-soprano";break;default:F="alto",y.default.error(`Clef ${u.ClefEnum[D.ClefType]} on line ${D.Line} not supported by VexFlow. Using default value "${F}".`)}break;case u.ClefEnum.percussion:F="percussion";break;case u.ClefEnum.TAB:F="treble";break;default:y.default.info("bad clef type: "+D.ClefType),F="treble"}return D.OctaveOffset===1&&F!=="bass"?k="8va":D.OctaveOffset===-1&&(k="8vb"),{type:F,size:_,annotation:k}}static TimeSignature(D){let _;switch(D.SymbolEnum){case o.RhythmSymbolEnum.NONE:_=D.Rhythm.Numerator+"/"+D.Rhythm.Denominator;break;case o.RhythmSymbolEnum.COMMON:_="C";break;case o.RhythmSymbolEnum.CUT:_="C|"}return new s.TimeSignature(_)}static keySignature(D){if(!D)return;let _;switch(D.Mode){case n.KeyEnum.minor:_=v.minorMap[D.Key]+"m";break;case n.KeyEnum.major:case n.KeyEnum.none:_=v.majorMap[D.Key];break;default:_="C"}return _}static line(D,_){switch(D){case f.SystemLinesEnum.SingleThin:return _===S.SystemLinePosition.MeasureBegin?s.StaveConnector.type.SINGLE:s.StaveConnector.type.SINGLE_RIGHT;case f.SystemLinesEnum.DoubleThin:return s.StaveConnector.type.THIN_DOUBLE;case f.SystemLinesEnum.ThinBold:return s.StaveConnector.type.BOLD_DOUBLE_RIGHT;case f.SystemLinesEnum.BoldThinDots:return s.StaveConnector.type.BOLD_DOUBLE_LEFT;case f.SystemLinesEnum.DotsThinBold:case f.SystemLinesEnum.DotsBoldBoldDots:return s.StaveConnector.type.BOLD_DOUBLE_RIGHT;case f.SystemLinesEnum.None:return s.StaveConnector.type.NONE}}static font(D,_=p.FontStyles.Regular,F=m.Fonts.TimesNewRoman,k,j=void 0){let P="normal",G="normal",Y=`'${k.DefaultFontFamily}'`;switch(_){case p.FontStyles.Bold:G="bold";break;case p.FontStyles.Italic:P="italic";break;case p.FontStyles.BoldItalic:P="italic",G="bold";case p.FontStyles.Underlined:}return m.Fonts.Kokila,j&&j!=="default"&&(Y=`'${j}'`),P+" "+G+" "+Math.floor(D)+"px "+Y}static fontStyle(D){switch(D){case p.FontStyles.Bold:return"bold";case p.FontStyles.Italic:return"italic";case p.FontStyles.BoldItalic:return"italic bold";default:return"normal"}}static style(D){return x.OUTLINE_AND_FILL_STYLE_DICT.getValue(D)}}g.VexFlowConverter=v,v.majorMap={"-1":"F","-2":"Bb","-3":"Eb","-4":"Ab","-5":"Db","-6":"Gb","-7":"Cb","-8":"Fb",0:"C",1:"G",2:"D",3:"A",4:"E",5:"B",6:"F#",7:"C#",8:"G#"},v.minorMap={"-1":"D","-2":"G","-3":"C","-4":"F","-5":"Bb","-6":"Eb","-7":"Ab","-8":"Db",0:"A",1:"E",2:"B",3:"F#",4:"C#",5:"G#",6:"D#",7:"A#",8:"E#"}},1216(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowGlissando=void 0;const l=c(98);class s extends l.GraphicalGlissando{}g.VexFlowGlissando=s},9635(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowGraphicalNote=void 0;const l=c(3430),s=c(6014),u=c(437),r=c(3849);class i extends l.GraphicalNote{constructor(n,h,t,f=u.OctaveEnum.NONE,p,m=void 0){if(super(n,h,p,m),this.clef=t,this.octaveShift=f,n.Pitch){const x=n.isRest()?n.Pitch:u.OctaveShift.getPitchFromOctaveShift(n.Pitch,f);this.vfpitch=s.VexFlowConverter.pitch(x,n.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(n){const h=this.drawPitch(n);this.vfpitch=s.VexFlowConverter.pitch(h,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=h.Accidental}drawPitch(n){return u.OctaveShift.getPitchFromOctaveShift(n,this.octaveShift)}Transpose(n,h,t,f){const p=super.Transpose(n,h,t,f),m=u.OctaveShift.getPitchFromOctaveShift(p,this.octaveShift);return this.vfpitch=s.VexFlowConverter.pitch(m,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,m}setIndex(n,h){this.vfnote=[n,h],this.vfnoteIndex=h}notehead(n=void 0){let h=n;h||(h=this.vfnote[0]);const t=h.note_heads;return t&&t.length>this.vfnoteIndex&&t[this.vfnoteIndex]?h.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){if(this.vfnote)return this.vfnote[0].getAttribute("id")}setVisible(n,h={}){var M,E;const t=h.applyToBeams??!0,f=h.applyToLedgerLines??!0,p=h.applyToNotehead??!0,m=h.applyToSlurs??!0,x=h.applyToStem??!0,y=h.applyToTies??!0,d="visibility",S=n?"visible":"hidden";if(p&&((M=this.getSVGGElement())==null||M.setAttribute(d,S)),x&&((E=this.getStemSVG())==null||E.setAttribute(d,S)),t)for(const L of this.getBeamSVGs())L==null||L.setAttribute(d,S);if(f)for(const L of this.getLedgerLineSVGs())L==null||L.setAttribute(d,S);if(y)for(const L of this.getTieSVGs())L==null||L.setAttribute(d,S);if(m)for(const L of this.getSlurSVGs())L==null||L.setAttribute(d,S)}getSVGGElement(){if(this.vfnote)return this.vfnote[0].getAttribute("el")}getStemSVG(){const n=document.getElementById("vf-"+this.getSVGId()+"-stem");return(n==null?void 0:n.children.length)>0?n.children[0]:n}getBeamSVGs(){const n=[];for(let h=0;;h++){const t=document.getElementById(`vf-${this.getSVGId()}-beam${h}`);if(!t)break;n.push(t)}return n}getLedgerLineSVGs(){const n=[],h=`vf-${this.getSVGId()}ledgers`,t=document.getElementById(h);if(!t)return[];for(const f of t.childNodes)n.push(f);return n}getTieSVGs(){const n=[],h=document.querySelectorAll(`[id='vf-${this.getSVGId()}-tie']`);for(const t of h)n.push(t);return n}getSlurSVGs(){const n=[],h=document.querySelectorAll(`[id='vf-${this.getSVGId()}-slur']`);for(const t of h)n.push(t);return n}getNoteheadSVGs(){var t;const n=this.getVFNoteSVG(),h=[];if((t=n==null?void 0:n.children)!=null&&t.length)for(const f of n.children)f.classList.contains("vf-notehead")&&h.push(f);return h}getFlagSVG(){var h;const n=this.getVFNoteSVG();if((h=n==null?void 0:n.children)!=null&&h.length){for(const t of n.children)if(t.classList.contains("vf-flag"))return t}}getVFNoteSVG(){if(this.parentVoiceEntry.parentStaffEntry.parentMeasure.isMultiRestMeasure())return this.parentVoiceEntry.parentStaffEntry.parentMeasure.multiRestElement;const n=this.getSVGGElement();if(n){for(const h of n.children)if(h.classList.contains("vf-note"))return h}}getModifierSVGs(){const n=this.getSVGGElement(),h=[];if(!(n!=null&&n.children))return h;if(n.children.length)for(const t of n.children)t.classList.contains("vf-modifiers")&&h.push(t);return h}setColor(n,h={}){var T,A;const t=h.applyToBeams??!1,f=h.applyToFlag??!0,p=h.applyToLedgerLines??!1,m=h.applyToLyrics??!1,x=h.applyToModifiers??!0,y=h.applyToNoteheads??!0,d=h.applyToSlurs??!1,S=h.applyToStem??!0,M=h.applyToTies??!1,E=h.applyToMultiRestMeasure??!0,L=h.applyToMultiRestMeasureNumber??!0,I=h.applyToMultiRestMeasureRestBar??!0;if(t){const v=this.getBeamSVGs();for(const B of v)for(const D of B.children)D.setAttribute("fill",n)}if(f){const v=this.getFlagSVG();if(v)for(const B of v.children)B.setAttribute("fill",n)}if(p){const v=this.getLedgerLineSVGs();for(const B of v)B.setAttribute("stroke",n)}if(m){const v=this.getLyricsSVGs();for(const B of v)for(const D of B.children)D.setAttribute("stroke",n),D.setAttribute("fill",n)}if(E&&this.parentVoiceEntry.parentStaffEntry.parentMeasure instanceof r.VexFlowMultiRestMeasure){const v=this.parentVoiceEntry.parentStaffEntry.parentMeasure.multiRestElementSVG;if((T=v==null?void 0:v.children)!=null&&T.length)for(const B of v.children)if((A=B.children)!=null&&A.length){if(L)for(const D of B.children)D.setAttribute("fill",n)}else I&&B.setAttribute("fill",n)}if(x){const v=this.getModifierSVGs();for(const B of v)for(const D of B.children)D.setAttribute("fill",n)}if(y){const v=this.getNoteheadSVGs();for(const B of v)for(const D of B.children)D.setAttribute("fill",n)}if(d){const v=this.getSlurSVGs();for(const B of v)for(const D of B.children)D.setAttribute("fill",n)}if(S){const v=this.getStemSVG();v&&v.setAttribute("stroke",n)}if(M){const v=this.getTieSVGs();for(const B of v)for(const D of B.children)D.setAttribute("fill",n)}}}g.VexFlowGraphicalNote=i},3753(de,g,c){var l=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowGraphicalSymbolFactory=void 0;var s=l(c(3206)).default.Flow;const u=c(4332),r=c(5246),i=c(6670),o=c(437),n=c(9635),h=c(6659),t=c(4134),f=c(6014),p=c(6173),m=c(5866),x=c(3849),y=c(6362);g.VexFlowGraphicalSymbolFactory=class{createMusicSystem(d,S){return new u.VexFlowMusicSystem(d,S)}createStaffLine(d,S){return new m.VexFlowStaffLine(d,S)}createGraphicalMeasure(d,S,M=!1){return new r.VexFlowMeasure(S,d,void 0)}createMultiRestMeasure(d,S,M){return new x.VexFlowMultiRestMeasure(S,d,M)}createTabStaffMeasure(d,S){return new p.VexFlowTabMeasure(S,d)}createExtraGraphicalMeasure(d){const S=new r.VexFlowMeasure(d.ParentStaff,void 0,d);return S.IsExtraGraphicalMeasure=!0,S.ExtraGraphicalMeasurePreviousMeasure=d.Measures.last(),S}createStaffEntry(d,S){return new i.VexFlowStaffEntry(S,d,void 0)}createVoiceEntry(d,S){return new t.VexFlowVoiceEntry(d,S)}createNote(d,S,M,E=o.OctaveEnum.NONE,L,I=void 0){return new n.VexFlowGraphicalNote(d,S,M,E,L,I)}createGraceNote(d,S,M,E,L=o.OctaveEnum.NONE){return new n.VexFlowGraphicalNote(d,S,M,L,E)}addGraphicalAccidental(d,S){d.setAccidental(S)}addFermataAtTiedEndNote(d,S){}createInStaffClef(d,S){const M=d,E=f.VexFlowConverter.Clef(S,"small");M.vfClefBefore=new s.ClefNote(E.type,E.size,E.annotation)}createChordSymbols(d,S,M,E){const L=S.parentMeasure.parentSourceMeasure.Rules;let I=0;const T=L.ChordSymbolXSpacing;for(const A of d.ChordContainers){if(!A)continue;let v=S.PositionAndShape;S.graphicalVoiceEntries.length===1&&S.graphicalVoiceEntries[0].notes.length===1&&S.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeRest()&&(v=S.parentMeasure.PositionAndShape,I+=S.parentMeasure.beginInstructionsWidth,I+=L.ChordSymbolWholeMeasureRestXOffset);const B=new h.GraphicalChordSymbolContainer(A,v,L.ChordSymbolTextHeight,M,E,L),D=B.GetChordSymbolContainer.Placement,_=B.GraphicalLabel;D===y.PlacementEnum.Below?_.PositionAndShape.RelativePosition.y=L.StaffHeight+L.ChordSymbolYOffset:_.PositionAndShape.RelativePosition.y-=L.ChordSymbolYOffset,_.setLabelPositionAndShapeBorders();let F=0;_.PositionAndShape.Size.width<L.ChordSymbolExtraXShiftWidthThreshold&&(F=L.ChordSymbolExtraXShiftForShortChordSymbols),_.PositionAndShape.RelativePosition.x+=I+F,_.setLabelPositionAndShapeBorders(),B.PositionAndShape.calculateBoundingBox(),S.graphicalChordContainers.push(B),I+=_.PositionAndShape.Size.width+T}}createGraphicalTechnicalInstruction(d,S){}}},7809(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowInstantaneousDynamicExpression=void 0;const l=c(5023),s=c(2148),u=c(8254),r=c(7435),i=c(7533),o=c(2570);class n extends l.GraphicalInstantaneousDynamicExpression{constructor(t,f,p){super(t,f,p);const m=new r.Label(this.Expression);this.label=new u.GraphicalLabel(m,this.rules.ContinuousDynamicTextHeight,i.TextAlignmentEnum.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=o.FontStyles.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return s.DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}g.VexFlowInstantaneousDynamicExpression=n},7098(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowInstrumentBrace=void 0;var s=l(c(3206)).default.Flow;const u=c(3109);class r extends u.VexFlowInstrumentBracket{constructor(o,n,h=0){super(o,n,h),this.vexflowConnector.setType(s.StaveConnector.type.BRACE)}}g.VexFlowInstrumentBrace=r},3109(de,g,c){var l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowInstrumentBracket=void 0;var s=l(c(3206)).default.Flow;const u=c(7741),r=c(6438),i=c(9479);class o extends u.GraphicalObject{constructor(h,t,f=0){super(),this.Visible=!0,this.PositionAndShape=new r.BoundingBox(this,h.ParentMusicSystem.PositionAndShape);const p=h.Measures[0],m=t.Measures[0];this.addConnector(p.getVFStave(),m.getVFStave(),s.StaveConnector.type.BRACKET,f)}draw(h){this.Visible&&this.vexflowConnector.setContext(h).draw();const t=this.vexflowConnector,f=t.top_stave.getYForLine(0),p=t.bottom_stave.getYForLine(t.bottom_stave.getNumLines()-1)+t.thickness;this.PositionAndShape.AbsolutePosition.x=(t.top_stave.getX()-2+t.x_shift)/i.unitInPixels,this.PositionAndShape.AbsolutePosition.y=f/i.unitInPixels,this.PositionAndShape.Size.height=(p-f)/i.unitInPixels,this.PositionAndShape.Size.width=12/i.unitInPixels}addConnector(h,t,f,p){this.vexflowConnector=new s.StaveConnector(h,t).setType(f).setXShift(-5*p)}}g.VexFlowInstrumentBracket=o},5246(de,g,c){var l=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(g,"__esModule",{value:!0}),g.StavePositionEnum=g.VexFlowMeasure=void 0;var s=l(c(3206)).default.Flow;const u=c(5748),r=c(6954),i=c(164),o=c(6014),n=c(8365);var h=s.NoteSubGroup;const t=l(c(3065)),f=c(9479),p=c(1645),m=c(67),x=c(1336),y=c(4134),d=c(2561),S=c(9713),M=c(3123),E=c(6362),L=c(5282);class I extends u.GraphicalMeasure{constructor(v,B,D){super(v,B,D),this.octaveOffset=3,this.vfVoices={},this.vfTies=[],this.vfRepetitionWords=[],this.hasMetronomeMark=!1,this.connectors=[],this.beams={},this.autoVfBeams=[],this.autoTupletVfBeams=[],this.vfbeams={},this.tuplets={},this.vftuplets={},this.minimumStaffEntriesWidth=-1,this.rules=D?D.ParentMusicSystem.rules:B?B.Rules:new S.EngravingRules,this.resetLayout()}setAbsoluteCoordinates(v,B){this.stave.setX(v).setY(B)}resetLayout(){this.stave=new s.Stave(0,0,0,{fill_style:this.rules.StaffLineColor,space_above_staff_ln:0,space_below_staff_ln:0}),this.InitiallyActiveClef&&(this.stave.clef=o.VexFlowConverter.Clef(this.InitiallyActiveClef).type),this.stave.MeasureNumber=this.MeasureNumber,this.hasMetronomeMark=!1,this.ParentStaff&&this.setLineNumber(this.ParentStaff.StafflineCount),this.stave.setBegBarType(s.Barline.type.NONE),this.parentSourceMeasure&&this.parentSourceMeasure.endingBarStyleEnum===r.SystemLinesEnum.None&&this.stave.setEndBarType(s.Barline.type.NONE),this.updateInstructionWidth()}clean(){this.vfTies.length=0,this.connectors=[],this.resetLayout()}getLineWidth(v){switch(v){case r.SystemLinesEnum.BoldThinDots:case r.SystemLinesEnum.DotsThinBold:return 10/f.unitInPixels;case r.SystemLinesEnum.DotsBoldBoldDots:return 10/f.unitInPixels+this.rules.RepeatEndStartPadding;default:return 0}}addClefAtBegin(v){if(this.rules.RenderClefsAtBeginningOfStaffline){if(this.octaveOffset=v.OctaveOffset,v.ClefType===i.ClefEnum.TAB)this.stave.addClef("tab",void 0,void 0,void 0);else{const B=o.VexFlowConverter.Clef(v,"default");this.stave.addClef(B.type,B.size,B.annotation,s.StaveModifier.Position.BEGIN)}this.updateInstructionWidth()}}setLineNumber(v){v!==5&&(v===0?(this.stave.setNumLines(0),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}):v===1?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!1},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):v===2?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(3)}):v===3?(this.stave.options.line_config=[{visible:!1},{visible:!0},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):(this.stave.setNumLines(v),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}))}addKeyAtBegin(v,B,D){var _;if(this.rules.RenderKeySignatures&&this.ShowKeySignature&&(!this.isTabMeasure||this.rules.TabKeySignatureRendered||this.rules.TabKeySignatureSpacingAdded)&&(!((_=this.parentSourceMeasure)!=null&&_.isReducedToMultiRest)||this.rules.MultipleRestMeasureAddKeySignature)){if(this.stave.setKeySignature(o.VexFlowConverter.keySignature(v),o.VexFlowConverter.keySignature(B),void 0),this.isTabMeasure&&!this.rules.TabKeySignatureRendered){const F=this.stave.getModifiers();for(const k of F)if(k instanceof s.KeySignature){k.setStyle({fillStyle:"#00000000"}),k.hidden=!0;break}}this.updateInstructionWidth()}}addRhythmAtBegin(v){if(this.isTabMeasure&&!this.rules.TabTimeSignatureRendered&&!this.rules.TabTimeSignatureSpacingAdded)return;const B=o.VexFlowConverter.TimeSignature(v);this.stave.addModifier(B,s.StaveModifier.Position.BEGIN),(!this.ShowTimeSignature||this.isTabMeasure&&!this.rules.TabTimeSignatureRendered)&&(B.setStyle({fillStyle:"#00000000"}),B.hidden=!0),this.updateInstructionWidth()}addClefAtEnd(v,B=!0){if(this.isTabMeasure)return;const D=o.VexFlowConverter.Clef(v,"small");if(B||!this.stave.endClef){this.stave.setEndClef(D.type,D.size,D.annotation);for(const _ of this.stave.getModifiers())if(B){const F=_.originalStrokeStyle,k=_.originalFillStyle;_.getStyle()&&(F&&k?(_.getStyle().strokeStyle=F,_.getStyle().fillStyle=k):(_.getStyle().strokeStyle=null,_.getStyle().fillStyle=null))}else if(_.getCategory()==="clefs"&&_.getPosition()===s.StaveModifier.Position.END&&_.type===D.type){const F="#12345600",k=_.getStyle();k&&(_.originalStrokeStyle=k.strokeStyle,_.originalFillStyle=k.fillStyle),_.setStyle({strokeStyle:F,fillStyle:F})}return this.parentSourceMeasure.hasEndClef=!0,this.updateInstructionWidth()}}addMeasureLine(v,B,D=!0){switch(B){case m.SystemLinePosition.MeasureBegin:v===r.SystemLinesEnum.BoldThinDots&&(D||(this.stave.modifiers[0].draw=function(_){switch(_.checkContext(),this.setRendered(),this.type){case s.Barline.type.SINGLE:this.drawVerticalBar(_,this.x,!1);break;case s.Barline.type.DOUBLE:this.drawVerticalBar(_,this.x,!0);break;case s.Barline.type.END:this.drawVerticalEndBar(_,this.x);break;case s.Barline.type.REPEAT_BEGIN:this.drawRepeatBar(_,this.x,!0);break;case s.Barline.type.REPEAT_END:this.drawRepeatBar(_,this.x,!1);break;case s.Barline.type.REPEAT_BOTH:this.drawRepeatBar(_,this.x,!1),this.drawRepeatBar(_,this.x,!0)}}),this.stave.setBegBarType(s.Barline.type.REPEAT_BEGIN));break;case m.SystemLinePosition.MeasureEnd:switch(v){case r.SystemLinesEnum.DotsBoldBoldDots:this.stave.setEndBarType(s.Barline.type.REPEAT_BOTH);break;case r.SystemLinesEnum.DotsThinBold:this.stave.setEndBarType(s.Barline.type.REPEAT_END);break;case r.SystemLinesEnum.DoubleThin:this.stave.setEndBarType(s.Barline.type.DOUBLE);break;case r.SystemLinesEnum.ThinBold:this.stave.setEndBarType(s.Barline.type.END);break;case r.SystemLinesEnum.DoubleBold:this.stave.setEndBarType(8);break;case r.SystemLinesEnum.None:this.stave.setEndBarType(s.Barline.type.NONE)}}}addMeasureNumber(){const v=this.MeasureNumber.toString(),B=T.ABOVE;this.stave.setText(v,B,{justification:1,shift_x:0,shift_y:0})}addWordRepetition(v){let B,D=s.StaveModifier.Position.END;const _=this.beginInstructionsWidth;switch(v.type){case p.RepetitionInstructionEnum.Segno:B=s.Repetition.type.SEGNO_LEFT,D=s.StaveModifier.Position.LEFT;break;case p.RepetitionInstructionEnum.Coda:B=s.Repetition.type.CODA_LEFT,D=s.StaveModifier.Position.LEFT;break;case p.RepetitionInstructionEnum.DaCapo:B=s.Repetition.type.DC;break;case p.RepetitionInstructionEnum.DalSegno:B=s.Repetition.type.DS;break;case p.RepetitionInstructionEnum.Fine:B=s.Repetition.type.FINE;break;case p.RepetitionInstructionEnum.ToCoda:B=s.Repetition.type.TO_CODA;break;case p.RepetitionInstructionEnum.DaCapoAlFine:B=s.Repetition.type.DC_AL_FINE;break;case p.RepetitionInstructionEnum.DaCapoAlCoda:B=s.Repetition.type.DC_AL_CODA;break;case p.RepetitionInstructionEnum.DalSegnoAlFine:B=s.Repetition.type.DS_AL_FINE;break;case p.RepetitionInstructionEnum.DalSegnoAlCoda:B=s.Repetition.type.DS_AL_CODA}if(B){const F=new s.Repetition(B,_,-this.rules.RepetitionSymbolsYOffset);return F.xShiftAsPercentOfStaveWidth=this.rules.RepetitionEndInstructionXShiftAsPercentOfStaveWidth,void this.stave.addModifier(F,D)}this.addVolta(v)}addVolta(v){var D;let B=s.Volta.type.BEGIN;if(v.type===p.RepetitionInstructionEnum.Ending){switch(v.alignment){case p.AlignmentType.Begin:B=this.parentSourceMeasure.endsRepetitionEnding()?s.Volta.type.BEGIN_END:s.Volta.type.BEGIN;break;case p.AlignmentType.Discontinue:if(this.parentSourceMeasure.beginsRepetitionEnding())return;B=s.Volta.type.MID;break;case p.AlignmentType.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;B=s.Volta.type.END;break;case p.AlignmentType.Mid:B=s.Volta.type.MID}const _=this.ParentStaffLine.SkyBottomLineCalculator,F=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,k=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,F+.4),j=_.getSkyLineMinInRange(F,k)-2;let P,G=-6.1+this.rules.VoltaOffset,Y=this.rules.VoltaOffset;j<G&&(Y+=j-G,G=j);const X=this.parentSourceMeasure.MeasureNumber;for(let ie=0;ie<this.ParentStaffLine.Measures.length;ie++){const oe=this.ParentStaffLine.Measures[ie];oe instanceof I&&(oe.MeasureNumber!==X-1&&oe.MeasureNumber+((D=oe.parentSourceMeasure)==null?void 0:D.multipleRestMeasures)!==X||(P=oe))}if(P){const ie=P.stave.getModifiers();for(let oe=0;oe<ie.length;oe++){const $=ie[oe];if($.hasOwnProperty("volta")){const Q=P.ParentStaffLine.SkyBottomLineCalculator,ne=P.PositionAndShape.AbsolutePosition.x+P.PositionAndShape.BorderMarginLeft+.4,ee=Math.max(P.PositionAndShape.AbsolutePosition.x+P.PositionAndShape.BorderMarginRight,ne+.4),N=Q.getSkyLineMinInRange(ne,ee);N<=G?(Y+=N-G,G=N):($.y_shift=Y*f.unitInPixels,P.ParentStaffLine.SkyBottomLineCalculator.updateSkyLineInRange(ne,ee,G))}}}Y*=10,this.stave.setVoltaType(B,v.endingIndices[0],Y),_.updateSkyLineInRange(F,k,G)}}setWidth(v){super.setWidth(v),this.stave.setWidth(v*f.unitInPixels)}layoutSymbols(){}draw(v){var D;const B=v.openGroup();B&&((D=B.classList)==null||D.add("vf-measure"),B.id=`${this.MeasureNumber}`),this.stave.setContext(v).draw();for(const _ in this.vfVoices)this.vfVoices.hasOwnProperty(_)&&(v.save(),this.vfVoices[_].draw(v,this.stave),v.restore());for(const _ in this.vfbeams)if(this.vfbeams.hasOwnProperty(_))for(const F of this.vfbeams[_])F.setContext(v).draw();if(this.autoVfBeams)for(const _ of this.autoVfBeams)_.setContext(v).draw();if(!this.isTabMeasure||this.rules.TupletNumbersInTabs){if(this.autoTupletVfBeams)for(const _ of this.autoTupletVfBeams)_.setContext(v).draw();for(const _ in this.vftuplets)if(this.vftuplets.hasOwnProperty(_))for(let F=0;F<this.tuplets[_].length;F++){const k=this.tuplets[_][F][0],j=this.vftuplets[_][F];j&&(!k.RenderTupletNumber||k.ShowNumberNoneGivenInXml&&this.rules.TupletNumberUseShowNoneXMLValue?j.RenderTupletNumber=!1:j.RenderTupletNumber=!0,j.setContext(v).draw())}}for(const _ of this.vfTies)_ instanceof s.TabSlide||(_.setContext(v),_.draw());v.closeGroup();for(const _ of this.connectors)v.openGroup("connector"),_.setContext(v).draw(),v.closeGroup();this.correctNotePositions()}format(){this.formatVoices&&this.formatVoices((this.PositionAndShape.Size.width-this.beginInstructionsWidth-this.endInstructionsWidth)*f.unitInPixels,this)}correctNotePositions(){if(this.isTabMeasure)for(const v of this.getVoicesWithinMeasure())for(const B of v.VoiceEntries)for(const D of B.Notes){const _=D,F=this.rules.GNote(D);_.StringNumberTab>=0&&(F.parentVoiceEntry.PositionAndShape.RelativePosition.y=(_.StringNumberTab-1)*this.rules.TabStaffInterlineHeightForBboxes)}else for(const v of this.getVoicesWithinMeasure())for(const B of v.VoiceEntries)for(const D of B.Notes){if(D.isRest())continue;const _=this.rules.GNote(D);if(!(_!=null&&_.vfnote))return;const F=_.vfnote[0];let k=0;_.parentVoiceEntry.parentVoiceEntry.StemDirection===x.StemDirectionType.Up&&_.vfnote[0].getDuration()!=="w"?k+=3.5:k+=.5,k+=-_.notehead(F).line+_.parentVoiceEntry.notes.last().notehead().line,_.PositionAndShape.RelativePosition.y=k}}getVoicesWithinMeasure(){const v=[];for(const B of this.staffEntries)for(const D of B.graphicalVoiceEntries)v.indexOf(D.parentVoiceEntry.ParentVoice)===-1&&v.push(D.parentVoiceEntry.ParentVoice);return v}getGraphicalVoiceEntriesPerVoice(v){const B=[];for(const D of this.staffEntries)for(const _ of D.graphicalVoiceEntries)_.parentVoiceEntry.ParentVoice===v&&B.push(_);return B}getRestFilledVexFlowStaveNotesPerVoice(v){let B,D=this.getGraphicalVoiceEntriesPerVoice(v);for(let k=0;k<D.length;k++){const j=D[k],P=j.notes[0].sourceNote.getAbsoluteTimestamp();let G=new d.Fraction;for(const Y of j.notes){const X=d.Fraction.plus(Y.sourceNote.getAbsoluteTimestamp(),Y.sourceNote.Length);G.lt(X)&&(G=X)}if(B){const Y=d.Fraction.minus(P,B);if(Y.RealValue>0){t.default.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const X=this.createGhostGves(Y);D.splice(k,0,...X),k+=X.length}}else{const Y=d.Fraction.minus(P,this.parentSourceMeasure.AbsoluteTimestamp);if(Y.RealValue>0){t.default.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);const X=this.createGhostGves(Y);D.splice(0,0,...X),k+=X.length}}B=G}const _=d.Fraction.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),F=d.Fraction.minus(_,B);if(F.RealValue>0){t.default.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const k=this.createGhostGves(F);D=D.concat(k)}return D}createGhostGves(v){const B=o.VexFlowConverter.GhostNotes(v),D=[];for(const _ of B){const F=new y.VexFlowVoiceEntry(void 0,void 0,this.rules);F.vfStaveNote=_,D.push(F)}return D}handleBeam(v,B){const D=v.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let _,F=this.beams[D];F||(F=this.beams[D]=[]);for(const j of F)j[0]===B&&(_=j);_||(_=[B,[]],F.push(_));const k=v.parentVoiceEntry;_[1].indexOf(k)<0&&_[1].push(k)}handleTuplet(v,B){const D=v.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;B=v.sourceNote.NoteTuplet;let _,F=this.tuplets[D];F||(F=this.tuplets[D]=[]);for(const j of F)j[0]===B&&(_=j);_||(_=[B,[]],F.push(_));const k=v.parentVoiceEntry;_[1].indexOf(k)<0&&_[1].push(k)}finalizeBeams(){var B;if(this.vfbeams={},this.isTabMeasure&&!this.rules.TabBeamsRendered)return;const v=[];for(const D in this.beams)if(this.beams.hasOwnProperty(D)){let _=this.vfbeams[D];_||(_=this.vfbeams[D]=[]);for(const F of this.beams[D]){let k=!1;for(const $ of F[0].Notes)if($.Length.RealValue>=new d.Fraction(1,4).RealValue&&(!$.TypeLength||$.TypeLength.RealValue>.125)){k=!0;break}if(k){t.default.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const j=[],P=F[0],G=F[1];let Y=!0;for(const $ of G)$.parentVoiceEntry.ParentVoice===P.Notes[0].ParentVoiceEntry.ParentVoice&&(Y=$.parentVoiceEntry.WantedStemDirection===x.StemDirectionType.Undefined);let X,ie=!1;const oe=[];for(const $ of G){const Q=$.vfStaveNote;Q&&(j.push(Q),v.push(Q)),$.parentVoiceEntry.IsGrace&&(ie=!0),$.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&oe.push($.parentVoiceEntry.StemColor)}if(j.length>1){const $=new s.Beam(j,Y);if(((B=P.SecondaryBreakIndices)==null?void 0:B.length)>0&&$.breakSecondaryAt(P.SecondaryBreakIndices),ie&&($.render_options.beam_width=3,$.render_options.partial_beam_length=4),oe.length>=2&&this.rules.ColorBeams){X=oe[0];for(const Q of oe)if(Q!==X){X=void 0;break}$.setStyle({fillStyle:X,strokeStyle:X})}this.rules.FlatBeams&&($.render_options.flat_beams=!0,$.render_options.flat_beam_offset=this.rules.FlatBeamOffset,$.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),_.push($)}else t.default.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(v)}autoBeamNotes(v){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let B,D=60,_=[],F=[],k=[];this.autoTupletVfBeams=[];const j=[];this.autoVfBeams=[];let P=this.parentSourceMeasure.ActiveTimeSignature;P||(P=this.parentSourceMeasure.Duration);for(const X of this.staffEntries)for(const ie of X.graphicalVoiceEntries){const oe=ie.vfStaveNote,$=ie.notes[0],Q={vfStaveNote:oe,sourceNote:$.sourceNote},ne=X.relInMeasureTimestamp.isOnBeat(P),ee=F.length>=2,N=$.sourceNote.Length.RealValue-new d.Fraction(1,4).RealValue>-d.Fraction.FloatInaccuracyTolerance,R=ie.parentVoiceEntry.IsGrace||N||v.contains(oe);if(R||ne){if(ee){for(const U of F)_.push(U);j.push(_.slice()),_=[]}if(F=[],R)continue}const O=ie.notes[0].sourceNote.NoteTuplet;if(O){let U=!1;for(const H of O.Notes){for(const W of H)if(W.NoteTypeXml>=L.NoteType.QUARTER||W.ParentVoiceEntry.IsGrace||W.isRest()&&!this.rules.AutoBeamOptions.beam_rests){U=!0;break}if(U)break}if(B){if(B!==O){if(k.length>1){const H=[];for(const q of k)H.push(q.vfStaveNote);const W=new s.Beam(H,!0);this.rules.FlatBeams&&(W.render_options.flat_beams=!0,W.render_options.flat_beam_offset=this.rules.FlatBeamOffset,W.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(W);const K=new n.Beam(D++);K.AutoGenerated=!0;for(const q of k)K.addNoteToBeam(q.sourceNote)}k=[],B=O}}else B=O;U||k.push(Q);continue}B=void 0,F.push(Q)}if(k.length>=2){const X=[];for(const $ of k)X.push($.vfStaveNote);const ie=new s.Beam(X,!0);this.rules.FlatBeams&&(ie.render_options.flat_beams=!0,ie.render_options.flat_beam_offset=this.rules.FlatBeamOffset,ie.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(ie);const oe=new n.Beam(D++);oe.AutoGenerated=!0;for(const $ of k)oe.addNoteToBeam($.sourceNote)}if(F.length>=2){for(const X of F)_.push(X);j.push(_)}const G=this.rules.AutoBeamOptions,Y={beam_middle_only:G.beam_middle_rests_only,beam_rests:G.beam_rests,maintain_stem_directions:G.maintain_stem_directions};if(G.groups&&G.groups.length){const X=[];for(const ie of G.groups)X.push(new s.Fraction(ie[0],ie[1]));Y.groups=X}for(const X of j){const ie=[];for(const $ of X)ie.push($.vfStaveNote);const oe=s.Beam.generateBeams(ie,Y);for(const $ of oe)this.rules.FlatBeams&&($.render_options.flat_beams=!0,$.render_options.flat_beam_offset=this.rules.FlatBeamOffset,$.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push($)}}finalizeTuplets(){this.vftuplets={};for(const v in this.tuplets)if(this.tuplets.hasOwnProperty(v)){let B=this.vftuplets[v];B||(B=this.vftuplets[v]=[]);for(const D of this.tuplets[v]){const _=[],F=D[1];for(const k of F)_.push(k.vfStaveNote);if(_.length>1){const k=D[0],j=k.Notes[0][0].NormalNotes,P=k.shouldBeBracketed(this.rules.TupletsBracketedUseXMLValue,this.rules.TupletsBracketed,this.rules.TripletsBracketed,this.isTabMeasure,this.rules.TabTupletsBracketed);let G=s.Tuplet.LOCATION_TOP;k.tupletLabelNumberPlacement===E.PlacementEnum.Below&&(G=s.Tuplet.LOCATION_BOTTOM);let Y=0;if(this.isTabMeasure&&(Y=10*this.rules.TabTupletYOffsetBottom,G===s.Tuplet.LOCATION_TOP)){Y=-10*this.rules.TabTupletYOffsetTop;const ie=k.Notes[0][0];ie!=null&&ie.hasTabEffects()&&(Y-=10*this.rules.TabTupletYOffsetEffects)}const X=new s.Tuplet(_,{bracketed:P,location:G,notes_occupied:j,num_notes:k.TupletLabelNumber,ratioed:k.Ratioed,y_offset:Y});B.push(X)}else t.default.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(v){}graphicalMeasureCreatedCalculations(){let v,B=[];const D=[];for(const F of this.staffEntries){v=!1,B=[];for(const k of F.graphicalVoiceEntries)if(k.parentVoiceEntry.IsGrace)B.push(k),D.push(k),v||(v=k.parentVoiceEntry.GraceSlur);else if(k.vfStaveNote=o.VexFlowConverter.StaveNote(k),B.length>0){const j=[];for(let Y=0;Y<B.length;Y++){const X=B[Y];X.GraceSlash=X.parentVoiceEntry.GraceNoteSlash,Y>0&&(X.GraceSlash=!1);const ie=o.VexFlowConverter.StaveNote(X);X.vfStaveNote=ie,j.push(ie)}const P=new s.GraceNoteGroup(j,v);let G=this.rules.GraceNoteGroupXMargin;j.length>1&&(G/=3),P.spacing=10*G,k.vfStaveNote.addModifier(0,P),B=[]}}if(B.length>0)for(const F of B)F.vfStaveNote=o.VexFlowConverter.StaveNote(F),F.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const _=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const F of this.staffEntries)F.setModifierXOffsets();for(const F of _){if(!F)continue;this.vfVoices[F.VoiceId]=new s.Voice({beat_value:this.parentSourceMeasure.ActiveTimeSignature.Denominator,num_beats:this.parentSourceMeasure.ActiveTimeSignature.Numerator,resolution:s.RESOLUTION}).setMode(s.Voice.Mode.SOFT);const k=this.getRestFilledVexFlowStaveNotesPerVoice(F);for(const j of k){if(j.parentVoiceEntry&&j.parentVoiceEntry.IsGrace&&!j.parentVoiceEntry.GraceAfterMainNote)continue;const P=j;if(P.vfStaveNote.getTicks().denominator===0&&(P.vfStaveNote.getTicks().denominator=1),j.notes.length>0&&j.notes[0].sourceNote&&j.notes[0].sourceNote.NoteTuplet){const Y=j.notes[0].graphicalNoteLength,X=P.vfStaveNote.getTicks();X.numerator=Y.Numerator*s.RESOLUTION,X.denominator=Y.Denominator,X.simplify()}const G=P.parentStaffEntry;if(G&&G.vfClefBefore){if(j.notes[0]&&!j.notes[0].sourceNote.PrintObject){const ie=this.rules.DefaultColorMusic||"#000000";G.vfClefBefore.setStyle({fillStyle:ie,strokeStyle:ie})}const Y=new h([G.vfClefBefore]),X=P.vfStaveNote;X&&typeof X.addModifier=="function"&&X.addModifier(0,Y)}j.notes.length!==0&&j.notes[0]&&j.notes[0].sourceNote.PrintObject?(j.parentVoiceEntry&&this.rules.RenderFingerings&&(this.rules.FingeringPosition!==E.PlacementEnum.Left&&this.rules.FingeringPosition!==E.PlacementEnum.Right||this.createFingerings(j),this.createStringNumber(j)),this.createArpeggio(j),this.vfVoices[F.VoiceId].addTickable(P.vfStaveNote)):this.vfVoices[F.VoiceId].addTickable(P.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(const F of D)this.createFingerings(F),this.createStringNumber(F),this.createArpeggio(F);this.createArticulations(),this.createOrnaments()}createArpeggio(v){if(v.parentVoiceEntry&&v.parentVoiceEntry.Arpeggio){const B=v.parentVoiceEntry.Arpeggio;if(v.notes&&v.notes.length>1){const D=o.VexFlowConverter.StrokeTypeFromArpeggioType(B.type),_=new s.Stroke(D,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&v.vfStaveNote.addStroke(0,_)}else t.default.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.
|
|
voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}}setStemDirectionFromVexFlow(){for(const v of this.staffEntries)for(const B of v.graphicalVoiceEntries)for(const D of B.notes){const _=D.vfnote;if(_&&_[0])switch(_[0].getStemDirection()){case s.Stem.UP:B.parentVoiceEntry.StemDirection=x.StemDirectionType.Up;break;case s.Stem.DOWN:B.parentVoiceEntry.StemDirection=x.StemDirectionType.Down}}}createArticulations(){for(let v=0,B=this.staffEntries.length;v<B;++v){const D=this.staffEntries[v].graphicalVoiceEntries;for(const _ of D){const F=_.vfStaveNote;o.VexFlowConverter.generateArticulations(F,_.notes[0],this.rules)}}}createOrnaments(){for(let v=0,B=this.staffEntries.length;v<B;++v){const D=this.staffEntries[v].graphicalVoiceEntries;for(const _ in D)if(D.hasOwnProperty(_)){const F=D[_].vfStaveNote,k=D[_].notes[0].sourceNote.ParentVoiceEntry.OrnamentContainer;k&&o.VexFlowConverter.generateOrnaments(F,k)}}}createFingerings(v){const B=v;let D=0;for(const k of v.notes)k.sourceNote.Fingering&&D++;const _=[];for(const k of v.parentVoiceEntry.TechnicalInstructions)k.type===M.TechnicalInstructionType.Fingering&&_.push(k);if(_.length>D){let k=0;for(const j of v.notes)if(j.sourceNote.Fingering)k++;else{if(k>_.length-1)break;j.sourceNote.Fingering=_[k],k++}}let F=-1;for(const k of v.notes){const j=k.sourceNote.Fingering;if(!j){F++;continue}F++;let P=this.rules.FingeringPosition;this.rules.FingeringPositionGrace===E.PlacementEnum.AboveOrBelow&&(this.isUpperStaffOfInstrument()?P=E.PlacementEnum.Above:this.isLowerStaffOfInstrument()&&(P=E.PlacementEnum.Below)),j.placement!==E.PlacementEnum.NotYetDefined&&(P=j.placement);let G,Y=this.rules.FingeringOffsetX;switch(P){default:case E.PlacementEnum.Left:G=s.StaveModifier.Position.LEFT,Y-=k.baseFingeringXOffset*f.unitInPixels;break;case E.PlacementEnum.Right:G=s.StaveModifier.Position.RIGHT,Y+=k.baseFingeringXOffset*f.unitInPixels;break;case E.PlacementEnum.Above:G=s.StaveModifier.Position.ABOVE;break;case E.PlacementEnum.Below:G=s.StaveModifier.Position.BELOW;break;case E.PlacementEnum.NotYetDefined:const ie=v.parentStaffEntry.sourceStaffEntry.ParentStaff;v.notes.length>1||v.parentStaffEntry.graphicalVoiceEntries.length>1?G=s.StaveModifier.Position.LEFT:ie.idInMusicSheet===0?(G=s.StaveModifier.Position.ABOVE,P=E.PlacementEnum.Above):(G=s.StaveModifier.Position.BELOW,P=E.PlacementEnum.Below)}const X=new s.FretHandFinger(j.value);if(X.setPosition(G),X.setOffsetX(Y),P===E.PlacementEnum.Above||P===E.PlacementEnum.Below){const ie=P===E.PlacementEnum.Above?-1:1,oe=P===E.PlacementEnum.Above?F:D-1-F;if(this.rules.FingeringInsideStafflines&&D>1){const $=X.getWidth()/2,Q=2.5*D;X.setOffsetY(ie*(oe+Q)*$)}else if(!this.rules.FingeringInsideStafflines){const $=new s.StringNumber(j.value);$.radius=0,$.setPosition(G),$.setOffsetY(ie*oe*$.getWidth()*2/3),B.vfStaveNote.addModifier(F,$);continue}}B.vfStaveNote.addModifier(F,X)}}createStringNumber(v){if(!this.rules.RenderStringNumbersClassical)return;const B=v;v.notes.forEach((D,_)=>{const F=D.sourceNote.StringInstruction;if(F){let k=F.value;switch(k){case"1":k="I";break;case"2":k="II";break;case"3":k="III";break;case"4":k="IV";break;case"5":k="V";break;case"6":k="VI"}const j=new s.StringNumber(k);j.radius=0;const P=-this.rules.StringNumberOffsetY;v.notes.length>1||v.parentStaffEntry.graphicalVoiceEntries.length>1?(j.setOffsetX(13*D.baseStringNumberXOffset),j.setPosition(s.Modifier.Position.RIGHT)):j.setPosition(s.Modifier.Position.ABOVE),j.setOffsetY(P),B.vfStaveNote.addModifier(_,j)}})}lineTo(v,B,D=0){const _=new s.StaveConnector(v.getVFStave(),this.stave);_.setType(B),D!==0&&_.setXShift(D),this.connectors.push(_)}getVFStave(){return this.stave}updateInstructionWidth(){let v=0,B=0;const D=this.stave.getModifiers();for(const _ of D)_.getPosition()===T.BEGIN?v+=_.getWidth()+_.getPadding(void 0):_.getPosition()===T.END&&(B+=_.getWidth()+_.getPadding(void 0));this.beginInstructionsWidth=(v??0)/f.unitInPixels,this.endInstructionsWidth=(B??0)/f.unitInPixels}addStaveTie(v,B){this.vfTies.push(v),B.vfTie=v,B.Tie.TieDirection===E.PlacementEnum.Below&&v.setDirection(1)}}var T;g.VexFlowMeasure=I,function(A){A[A.LEFT=1]="LEFT",A[A.RIGHT=2]="RIGHT",A[A.ABOVE=3]="ABOVE",A[A.BELOW=4]="BELOW",A[A.BEGIN=5]="BEGIN",A[A.END=6]="END"}(T||(g.StavePositionEnum=T={}))},3849(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowMultiRestMeasure=void 0;var s=l(c(3206)).default.Flow;const u=c(5246);class r extends u.VexFlowMeasure{constructor(o,n=void 0,h=void 0){super(o,n,h),this.minimumStaffEntriesWidth=-1,h?this.rules=h.ParentMusicSystem.rules:n&&(this.rules=n.Rules),this.resetLayout(),this.multiRestElement=new s.MultiMeasureRest(n.multipleRestMeasures,{})}draw(o){var h,t;const n=o.openGroup();n&&((h=n.classList)==null||h.add("vf-measure"),(t=n.classList)==null||t.add("multi"),n.id=`${this.MeasureNumber}`),this.stave.setContext(o).draw(),this.multiRestElementSVG=o.openGroup("multirest"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(o),this.multiRestElement.draw(),this.multiRestElement.id=`vf-multi${this.MeasureNumber}`,o.closeGroup(),o.closeGroup();for(const f of this.connectors)f.setContext(o).draw()}format(){var o,n;for(const h of this.staffEntries){const t=this.PositionAndShape.Size.width-this.beginInstructionsWidth;h.PositionAndShape.RelativePosition.x=this.PositionAndShape.Size.width/2+this.beginInstructionsWidth/3,h.PositionAndShape.RelativePosition.y=0;const f=(n=(o=h.graphicalVoiceEntries[0])==null?void 0:o.notes[0])==null?void 0:n.PositionAndShape;f.BorderLeft=-t/3,f.BorderRight=t/3,f.BorderTop=1,f.BorderBottom=3,h.PositionAndShape.calculateBoundingBox()}}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(o){return[]}getRestFilledVexFlowStaveNotesPerVoice(o){return[]}handleBeam(o,n){}handleTuplet(o,n){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(o){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(o){}getVFStave(){return this.stave}}g.VexFlowMultiRestMeasure=r},806(de,g,c){var l=this&&this.__importDefault||function(oe){return oe&&oe.__esModule?oe:{default:oe}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowMusicSheetCalculator=void 0;const s=c(7921),u=c(3753),r=c(5748),i=c(1327),o=c(5054),n=c(2561),h=c(8215),t=c(7785),f=l(c(3206));var p=f.default.Flow;const m=l(c(3065)),x=c(9479),y=c(2395),d=c(7751),S=c(9310),M=c(7809),E=c(7533),L=c(4022),I=c(2400),T=c(9161),A=c(624),v=c(7506),B=c(5282),D=c(6014),_=c(4980),F=c(6659),k=c(6954),j=c(7109),P=c(512),G=c(813),Y=c(1216),X=c(2907);class ie extends s.MusicSheetCalculator{constructor($){var Q,ne,ee,N,R,O,U,H;super(),this.beamsNeedUpdate=!1,this.previousLyricOverflowsByStaff=new Map,this.previousChordOverflowsByStaff=new Map,this.rules=$,s.MusicSheetCalculator.symbolFactory=new u.VexFlowGraphicalSymbolFactory,s.MusicSheetCalculator.TextMeasurer=new t.VexFlowTextMeasurer(this.rules),s.MusicSheetCalculator.stafflineNoteCalculator=new v.VexflowStafflineNoteCalculator(this.rules),((Q=this.rules.DefaultVexFlowNoteFont)==null?void 0:Q.toLowerCase())==="gonville"?f.default.Flow.DEFAULT_FONT_STACK=[(ne=f.default.Flow.Fonts)==null?void 0:ne.Gonville,(ee=f.default.Flow.Fonts)==null?void 0:ee.Bravura,(N=f.default.Flow.Fonts)==null?void 0:N.Custom]:((R=this.rules.DefaultVexFlowNoteFont)==null?void 0:R.toLowerCase())==="petaluma"&&(f.default.Flow.DEFAULT_FONT_STACK=[(O=f.default.Flow.Fonts)==null?void 0:O.Petaluma,(U=f.default.Flow.Fonts)==null?void 0:U.Gonville,(H=f.default.Flow.Fonts)==null?void 0:H.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),s.MusicSheetCalculator.stafflineNoteCalculator=new v.VexflowStafflineNoteCalculator(this.rules);for(const $ of this.graphicalMusicSheet.MeasureList)for(const Q of $)Q==null||Q.clean()}formatMeasures(){for(const $ of this.graphicalMusicSheet.MeasureList)if($&&$[0]){$.find(Q=>Q==null?void 0:Q.isVisible()).format();for(const Q of $){for(const ne of Q.staffEntries)ne.calculateXPosition();Q.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout($){const Q=[];for(const H of $)H!=null&&H.isVisible()&&Q.push(H);if(Q.length===0)return 0;$=Q;const ne=[],ee=new p.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let N=$[0].staffEntries.length,R=1;for(const H of $){if(!H)continue;let W=0;for(const te of H.staffEntries)W+=te.setMaxAccidentals();H.parentSourceMeasure.ImplicitMeasure&&(N=Math.max(H.staffEntries.length,N),R=Math.max(H.staffEntries.length+W,R));const K=H.vfVoices,q=[];for(const te in K)if(K.hasOwnProperty(te)){const se=K[te];H.hasOnlyRests&&!se.ticksUsed.equals(se.totalTicks)&&(se.ticksUsed=se.totalTicks),q.push(se),ne.push(se)}q.length!==0?ee.joinVoices(q):m.default.debug("Found a measure with no voices. Continuing anyway.",K)}let O=12;const U=$[0].parentSourceMeasure;if(ne.length>0){if(O=ee.preCalculateMinTotalWidth(ne)/x.unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+.3*N,U==null?void 0:U.ImplicitMeasure){O=U.Duration.RealValue/U.ActiveTimeSignature.RealValue*O;let K=0;const q=U.measureListIndex;if(q>1)for(const te of this.graphicalMusicSheet.MeasureList[q-1]){const se=te==null?void 0:te.parentSourceMeasure.endingBarStyleEnum;if(se===k.SystemLinesEnum.ThinBold||se===k.SystemLinesEnum.DotsThinBold){K=this.rules.PickupMeasureRepetitionSpacing;break}}O+=K,N>1?O+=.3*R*1.5:q>1&&N===1&&(O+=this.rules.PickupMeasureSpacingSingleNoteAddend),O*=this.rules.PickupMeasureWidthMultiplier}s.MusicSheetCalculator.setMeasuresMinStaffEntriesWidth($,O);const H=(K,q)=>{ee.formatToStave(ne,q.getVFStave())},W=(K,q)=>{ee.formatToStave(ne,q.getVFStave(),{align_rests:!0,context:void 0})};for(const K of $){if(this.rules.AlignRests===A.AlignRestOption.Never)K.formatVoices=H;else if(this.rules.AlignRests===A.AlignRestOption.Always)K.formatVoices=W;else if(this.rules.AlignRests===A.AlignRestOption.Auto){let q=!1;for(const te of K.staffEntries){let se=0,ue=0;for(const fe of te.graphicalVoiceEntries)if(fe.parentVoiceEntry.IsGrace||fe&&fe.notes&&fe.notes[0]&&fe.notes[0].sourceNote&&fe.notes[0].sourceNote.PrintObject&&se++,fe&&fe.notes&&fe.notes[0]&&fe.notes[0].sourceNote&&fe.notes[0].sourceNote.isRest()&&fe.notes[0].sourceNote.PrintObject&&ue++,se>1&&ue>=1){q=!0;break}if(q)break}K.formatVoices=q?W:H}if(K===$[0]){const q=K;q.formatVoices(O*x.unitInPixels,q)}}}for(const H of $)if(H)for(const W of H.staffEntries)W.calculateXPosition();for(const H of $){if(!H)continue;const W=H.vfVoices,K=[];for(const q in W)W.hasOwnProperty(q)&&K.push(W[q]);K.length!==0?ee.joinVoices(K):m.default.debug("Found a measure with no voices. Continuing anyway.",W)}return O}calculateElongationFactor($,Q,ne,ee,N,R,O,U){let H=N,W=0,K=!1;for(const q of $){const te=q.GraphicalLabel.Label.textAlignment;let se=O,ue=U;if(K=!1,q instanceof y.GraphicalLyricEntry&&q.ParentLyricWord){q.LyricsEntry.SyllableIndex>0&&(se=this.rules.BetweenSyllableMinimumDistance,E.TextAlignment.IsCenterAligned(te)&&(se+=1));const Ce=q.ParentLyricWord.GetLyricWord.Syllables;Ce.length>1&&q.LyricsEntry.SyllableIndex<Ce.length-1&&(K=!0,this.dashSpace===void 0&&(this.dashSpace=1.5),ue-=this.dashSpace)}const fe=q instanceof y.GraphicalLyricEntry?q.GraphicalLabel.PositionAndShape:q.PositionAndShape,xe=fe.Size.width;let ve,Se,ye,be,Me=Q.PositionAndShape.RelativePosition.x+fe.BorderLeft;q instanceof F.GraphicalChordSymbolContainer&&q.PositionAndShape.Parent.DataObject instanceof r.GraphicalMeasure&&(Me=this.rules.ChordSymbolWholeMeasureRestXOffset+fe.BorderMarginLeft+q.PositionAndShape.Parent.DataObject.beginInstructionsWidth),ne[W]!==void 0&&ne[W].extend,ne[W]&&(Se=Me-ne[W].xPosition);const _e=ee*N;E.TextAlignment.IsCenterAligned(te)?(ue/=4,ye=_e-Me,be=xe/2-ue,ne[W]&&(ve=ne[W].labelWidth/2+xe/2+se)):E.TextAlignment.IsLeft(te)&&(ye=_e-Me,be=xe-ue,ne[W]&&(ve=ne[W].labelWidth+se));let Te,Le=1;Te=ye>0?be/ye:(Me+be)/ee;let Pe=1;q instanceof y.GraphicalLyricEntry&&q.LyricsEntry?ne[W]&&(Pe=ve/Se,ne[W].sourceNoteDuration.Denominator>4&&(Pe*=1.1)):ne[W]&&(Pe=ve/Se),Le=Math.max(Te,Pe),H=Math.max(H,Le);let Ae=Math.max(ve-Se||0,0);ne[W]&&(Ae+=ne[W].cumulativeOverlap),ne[W]={cumulativeOverlap:Ae,extend:q instanceof y.GraphicalLyricEntry&&q.LyricsEntry.extend,labelWidth:xe,measureNumber:R,needsDashSpaceAtEnd:K,sourceNoteDuration:q instanceof y.GraphicalLyricEntry&&q.LyricsEntry&&q.LyricsEntry.Parent.Notes[0].Length,text:q instanceof y.GraphicalLyricEntry?q.LyricsEntry.Text:q.GraphicalLabel.Label.text,xPosition:Me},W++}return H}calculateElongationFactorFromStaffEntries($,Q,ne,ee,N,R){let O=ne;const U={},H={};if(N)for(let W=0;W<N.length;W++){const K=N[W];K>0&&(U[W]={cumulativeOverlap:0,extend:!1,labelWidth:K,measureNumber:ee-1,sourceNoteDuration:new n.Fraction(1,4),text:"",xPosition:0})}if(R)for(let W=0;W<R.length;W++){const K=R[W];K>0&&(H[W]={cumulativeOverlap:0,extend:!1,labelWidth:K,measureNumber:ee-1,sourceNoteDuration:new n.Fraction(1,4),text:"",xPosition:0})}for(const W of $)W.LyricsEntries.length>0&&this.rules.RenderLyrics&&(O=this.calculateElongationFactor(W.LyricsEntries,W,U,Q,O,ee,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),W.graphicalChordContainers.length>0&&this.rules.RenderChordSymbols&&(O=this.calculateElongationFactor(W.graphicalChordContainers,W,H,Q,O,ee,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return{factor:O,lastLyricEntryDict:U,lastChordEntryDict:H}}calculateMeasureWidthFromStaffEntries($,Q){let ne=1;const ee=[],N=new Set;for(const O of $){if(!O||O.staffEntries.length===0||!O.isVisible())continue;const U=O.ParentStaff;N.add(U);const H=this.previousLyricOverflowsByStaff.get(U),W=this.previousChordOverflowsByStaff.get(U),K=this.calculateElongationFactorFromStaffEntries(O.staffEntries,Q,ne,O.MeasureNumber,H,W);ne=K.factor,ee.push({staff:U,lastLyricEntryDict:K.lastLyricEntryDict,lastChordEntryDict:K.lastChordEntryDict})}ne=Math.min(ne,this.rules.MaximumLyricsElongationFactor);const R=Q*ne;for(const O of ee){const U=this.computeContainerOverflows(O.lastLyricEntryDict,R),H=this.computeContainerOverflows(O.lastChordEntryDict,R);this.previousLyricOverflowsByStaff.set(O.staff,U),this.previousChordOverflowsByStaff.set(O.staff,H)}for(const O of Array.from(this.previousLyricOverflowsByStaff.keys()))N.has(O)||this.previousLyricOverflowsByStaff.delete(O);for(const O of Array.from(this.previousChordOverflowsByStaff.keys()))N.has(O)||this.previousChordOverflowsByStaff.delete(O);return R}computeContainerOverflows($,Q){const ne=[];for(const ee of Object.keys($)){const N=Number(ee),R=$[N];if(!R)continue;const O=R.xPosition+R.labelWidth;let U=Math.max(0,O-Q);R.needsDashSpaceAtEnd&&this.dashSpace!==void 0&&(U+=this.dashSpace),ne[N]=U}return ne}createGraphicalTie($,Q,ne,ee,N){return new o.GraphicalTie($,ee,N)}updateStaffLineBorders($){$.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations($){$.rules=this.rules,$.graphicalMeasureCreatedCalculations()}layoutVoiceEntry($,Q,ne,ee){for(let N=0;N<Q.length;N++)Q[N]=s.MusicSheetCalculator.stafflineNoteCalculator.positionNote(Q[N])}layoutStaffEntry($){$.parentMeasure.layoutStaffEntry($)}initGraphicalMeasuresCreation(){}layoutArticulationMarks($,Q,ne){}layoutGraphicalTie($,Q,ne){const ee=$.StartNote,N=$.EndNote;let R,O,U=0;ee&&ee.vfnote&&ee.vfnote.length>=2&&(R=ee.vfnote[0],U=ee.vfnote[1]);let H=0;if(N&&N.vfnote&&N.vfnote.length>=2&&(O=N.vfnote[0],H=N.vfnote[1]),Q){if(R){const W=new p.StaveTie({first_indices:[U],first_note:R});ee.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(W,$)}if(O){const W=new p.StaveTie({last_indices:[H],last_note:O});N.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(W,$)}}else if(R||O){let W;if(ne)if($.Tie.Type==="S"){const K=$.StartNote.sourceNote,q=$.EndNote.sourceNote;let te=1;K.FretNumber>q.FretNumber&&(te=-1),W=new p.TabSlide({first_indices:[U],first_note:R,last_indices:[H],last_note:O},te)}else W=new p.TabTie({first_indices:[U],first_note:R,last_indices:[H],last_note:O},$.Tie.Type);else{W=new p.StaveTie({first_indices:[U],first_note:R,last_indices:[H],last_note:O});const K=$.Tie.getTieDirection(ee.sourceNote);K===_.PlacementEnum.Below?W.setDirection(1):K===_.PlacementEnum.Above&&W.setDirection(-1)}N.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(W,$)}}calculateDynamicExpressionsForMultiExpression($,Q,ne){if(Q<this.rules.MinMeasureToDrawIndex||Q>this.rules.MaxMeasureToDrawIndex)return;const ee=$.AbsoluteTimestamp,N=this.graphicalMusicSheet.MeasureList[Q],R=N[ne].ParentStaffLine,O=N[ne],U=$.StartingContinuousDynamic,H=U!==void 0&&!U.IsStartOfSoftAccent,W=this.getRelativePositionInStaffLineFromTimestamp(ee,ne,R,R==null?void 0:R.isPartOfMultiStaffInstrument(),void 0,H);if(W.x<=0&&(W.x=O.beginInstructionsWidth+this.rules.RhythmRightMargin),$.InstantaneousDynamic){const K=new M.VexFlowInstantaneousDynamicExpression($.InstantaneousDynamic,R,O);this.calculateGraphicalInstantaneousDynamicExpression(K,W,ee),this.dynamicExpressionMap.set(ee.RealValue,K.PositionAndShape)}if(U){const K=new I.VexFlowContinuousDynamicExpression(U,R,O.parentSourceMeasure);if(K.StartMeasure=O,K.IsSoftAccent=$.StartingContinuousDynamic.IsStartOfSoftAccent,!K.IsVerbal&&U.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(K,W),K.updateSkyBottomLine()}catch{}else K.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(K,W):m.default.warn("This continuous dynamic is not covered. measure"+$.SourceMeasureParent.MeasureNumber)}}createMetronomeMark($){var K,q;const Q=$.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber,ne=Math.max($.StaffNumber-1,0),ee=this.graphicalMusicSheet.findGraphicalMeasureByMeasureNumber(Q,ne),N=ee===this.graphicalMusicSheet.MeasureList[0][0];if(ee.hasMetronomeMark)return;const R=ee.getVFStave();let O=this.rules.MetronomeMarkYShift,U=!1;for(const te of $.parentMeasure.TempoExpressions){const se=((K=te.InstantaneousTempo)==null?void 0:K.TempoType)===T.TempoType.metronomeMark;if(te.getPlacementOfFirstEntry()===_.PlacementEnum.Above&&!se){U=!0;break}}U&&(O-=1.4);const H=(q=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:q.SkyLine;if($.metronomeNoteGroupLeft&&$.metronomeNoteGroupRight){const te=this.buildNoteEquationForVexFlow($.metronomeNoteGroupLeft,$.metronomeNoteGroupRight);R.setTempo({noteEquation:te},O*x.unitInPixels)}else{let te="q";if($.beatUnit){const se=B.NoteTypeHandler.getNoteDurationFromType($.beatUnit);te=D.VexFlowConverter.durations(se,!1)[0]}R.setTempo({bpm:$.TempoInBpm,dots:$.dotted,duration:te},O*x.unitInPixels)}const W=N?this.rules.MetronomeMarkXShift*x.unitInPixels:0;R.getModifiers()[R.getModifiers().length-1].setShiftX(W),ee.hasMetronomeMark=!0,H&&(H[0]=Math.min(H[0],-4.5+O))}buildNoteEquationForVexFlow($,Q){const ne=ee=>{const N={notes:ee.notes.map(R=>{const O=B.NoteTypeHandler.getNoteDurationFromType(R.type);return{duration:D.VexFlowConverter.durations(O,!1)[0],dots:R.dots,beam:R.beam}})};return ee.tuplet&&(N.tuplet={actualNotes:ee.tuplet.actualNotes,normalNotes:ee.tuplet.normalNotes,bracket:ee.tuplet.bracket,showNumber:ee.tuplet.showNumber}),N};return{left:ne($),right:ne(Q)}}calculateRehearsalMark($){const Q=$.rehearsalExpression;if(!Q)return;const ne=this.graphicalMusicSheet.MeasureList[0][0].MeasureNumber,ee=Math.max($.MeasureNumber-ne,0);for(const N of this.graphicalMusicSheet.MeasureList[ee]){const R=N==null?void 0:N.getVFStave();if(!R||!N.isVisible())continue;let O=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;N.parentSourceMeasure.isReducedToMultiRest&&(O+=this.rules.RehearsalMarkYOffsetAddedForRehearsalMarks);let U=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;$.IsSystemStartMeasure&&(U+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const H=this.rules.RehearsalMarkFontSize;return void R.setSection(Q.label,O,U,H)}}calculateSingleOctaveShift($,Q,ne,ee){var se,ue;const N=Q.OctaveShiftStart,R=N.ParentStartMultiExpression.Timestamp,O=(se=N.ParentEndMultiExpression)==null?void 0:se.Timestamp,U=this.rules.MinMeasureToDrawIndex,H=this.rules.MaxMeasureToDrawIndex;let W,K,q=this.graphicalMusicSheet.MeasureList[ne][ee].ParentStaffLine;if(q||(q=this.graphicalMusicSheet.MeasureList[U][ee].ParentStaffLine),W=N.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentEndMultiExpression.SourceMeasureParent,ee):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(ee,!0),W.MeasureNumber>H+1&&(W=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(ee,!0)),K=N.ParentStartMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentStartMultiExpression.SourceMeasureParent,ee):this.graphicalMusicSheet.MeasureList[U][ee],K.MeasureNumber<U+1&&(K=this.graphicalMusicSheet.MeasureList[U][ee]),K.parentSourceMeasure.measureListIndex<U||K.parentSourceMeasure.measureListIndex>H||W.parentSourceMeasure.measureListIndex<U||W.parentSourceMeasure.measureListIndex>H)return;let te=W.ParentStaffLine;if(te||(te=q),W&&q&&te){const fe=new S.VexFlowOctaveShift(N,q.PositionAndShape);if(!fe.startNote){let Se;for(const ye of K.staffEntries)if(ye){Se=ye;break}if(!Se||(fe.setStartNote(Se),!fe.startNote))return}if(!fe.endNote){let Se;for(let ye=W.staffEntries.length-1;ye>=0;ye++)if(W.staffEntries[ye]){Se=W.staffEntries[ye];break}if(!Se)return void(fe.graphicalEndAtMeasureEnd=!0);if(fe.setEndNote(Se),!fe.endNote)return}let xe=K.findGraphicalStaffEntryFromTimestamp(R);xe||(xe=K.staffEntries[0]);let ve=W.findGraphicalStaffEntryFromTimestamp(O);if(!ve)for(let Se=W.staffEntries.length-1;Se>=0;Se--){const ye=W.staffEntries[Se];if((ue=ye.relInMeasureTimestamp)!=null&&ue.lte(O)){ve=ye;break}}if(ve||(ve=W.staffEntries[W.staffEntries.length-1]),fe.setStartNote(xe),te!==q){fe.endsOnDifferentStaffLine=!0;let Se=this.findLastStafflineMeasure(q);Se===void 0&&(Se=W);const ye=Se.staffEntries[Se.staffEntries.length-1];if(fe.setEndNote(ye),fe.graphicalEndAtMeasureEnd=!0,fe.endMeasure=Se,te.ParentMusicSystem.Id-q.ParentMusicSystem.Id>0)for(let be=q.ParentMusicSystem.Id;be<te.ParentMusicSystem.Id;be++){const Me=be+1,_e=this.musicSystems[Me];let Te;for(const Ke of _e.StaffLines)if(Ke.ParentStaff.idInMusicSheet===ee){Te=Ke;break}if(!Te)continue;const Le=Te.Measures[0],Pe=new S.VexFlowOctaveShift(N,Le.PositionAndShape);let Ae=this.findLastStafflineMeasure(Te);be<te.ParentMusicSystem.Id-1&&(Pe.endsOnDifferentStaffLine=!0,Pe.graphicalEndAtMeasureEnd=!0,Pe.endMeasure=Ae);const Ce=Le.staffEntries[0];let Be=Ae.staffEntries[Ae.staffEntries.length-1];W.ParentStaffLine===Te&&(Ae=W,Be=ve),Be.graphicalVoiceEntries.length===1&&Be.graphicalVoiceEntries[0].notes.length===1&&Be.graphicalVoiceEntries[0].notes[0].sourceNote.isWholeMeasureNote()&&(Pe.graphicalEndAtMeasureEnd=!0,Pe.endMeasure=Ae);const Ie="VexFlowMusicSheetCalculator.calculateSingleOctaveShift: ";Ce||m.default.warn(Ie+"no firstNote found"),Be||m.default.warn(Ie+"no lastNote found"),Pe.setStartNote(Ce);const Fe=W.ParentStaffLine===Te&&N.endVoiceEntryIndex>0?N.endVoiceEntryIndex:-1;Pe.setEndNote(Be,Fe),Te.OctaveShifts.push(Pe),this.calculateOctaveShiftSkyBottomLine(Ce,Be,Pe,Te)}this.calculateOctaveShiftSkyBottomLine(xe,ye,fe,q)}else fe.setEndNote(ve,N.endVoiceEntryIndex>0?N.endVoiceEntryIndex:-1),this.calculateOctaveShiftSkyBottomLine(xe,ve,fe,q);q.OctaveShifts.push(fe)}else m.default.warn("End measure or staffLines for octave shift are undefined! This should not happen!")}findLastStafflineMeasure($){for(let Q=$.Measures.length-1;Q>=0;Q--){const ne=$.Measures[Q];if(ne.staffEntries.length>0)return ne}}calculateSinglePedal($,Q,ne,ee){var se;const N=Q.PedalStart,R=N.ParentStartMultiExpression.Timestamp,O=(se=N.ParentEndMultiExpression)==null?void 0:se.Timestamp,U=this.rules.MinMeasureToDrawIndex,H=this.rules.MaxMeasureToDrawIndex;let W,K,q=this.graphicalMusicSheet.MeasureList[ne][ee].ParentStaffLine;if(q||(q=this.graphicalMusicSheet.MeasureList[U][ee].ParentStaffLine),W=N.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentEndMultiExpression.SourceMeasureParent,ee):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(ee,!0),W.MeasureNumber>H+1&&(W=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(ee,!0)),N.ParentEndMultiExpression?K=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentStartMultiExpression.SourceMeasureParent,ee):(K=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentStartMultiExpression.SourceMeasureParent,ee),K||(K=this.graphicalMusicSheet.MeasureList[U][ee])),K.MeasureNumber<U+1&&(K=this.graphicalMusicSheet.MeasureList[U][ee]),K.parentSourceMeasure.measureListIndex<U||K.parentSourceMeasure.measureListIndex>H||W.parentSourceMeasure.measureListIndex<U||W.parentSourceMeasure.measureListIndex>H)return;let te=W.ParentStaffLine;if(te||(te=q),W&&q&&te){let ue=!1;q!==te&&(ue=!0);const fe=new j.VexFlowPedal(N,q.PositionAndShape,!1,ue);fe.setEndsStave(W,O);let xe=K.findGraphicalStaffEntryFromTimestamp(R);xe||(xe=K.staffEntries[0]);let ve=W.findGraphicalStaffEntryFromTimestamp(O);if(ve||(ve=W.staffEntries[W.staffEntries.length-1]),!fe.setStartNote(xe))return;if(fe.setBeginsStave(fe.startNote.isRest(),R),te!==q)if(fe.pedalSymbol===P.MusicSymbol.PEDAL_SYMBOL){fe.setEndNote(ve),fe.setEndMeasure(W),fe.ReleaseText=" ",fe.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(fe.startVfVoiceEntry,fe.endVfVoiceEntry,fe,q);const Se=te.Measures[0],ye=new j.VexFlowPedal(N,Se.PositionAndShape);fe.setEndsStave(W,O);const be=Se.staffEntries[0];if(!ye.setStartNote(be))return;ye.setEndNote(ve),ye.setEndMeasure(W),fe.setEndMeasure(W),te.Pedals.push(ye),ye.CalculateBoundingBox(),ye.DepressText=" ",this.calculatePedalSkyBottomLine(ye.startVfVoiceEntry,ye.endVfVoiceEntry,ye,te)}else{let Se=this.findLastStafflineMeasure(q);Se===void 0&&(Se=W);const ye=Se.staffEntries[Se.staffEntries.length-1];fe.setEndNote(ye),fe.setEndMeasure(W),fe.ChangeEnd=!1;const be=te.ParentMusicSystem.Id-q.ParentMusicSystem.Id;if(be>0){let Me=1;for(let _e=q.ParentMusicSystem.Id;_e<te.ParentMusicSystem.Id;_e++){const Te=this.musicSystems[_e+1].StaffLines[ee],Le=Te.Measures[0];let Pe=!1,Ae=!1;Me<be?Pe=!0:Ae=!0,Me++;const Ce=new j.VexFlowPedal(N,Le.PositionAndShape,!0,Pe);fe.setEndsStave(W,O),Ce.ChangeBegin=!1,Ce.ChangeEnd=!!Ae&&N.ChangeEnd;let Be=this.findLastStafflineMeasure(Te);const Ie=Le.staffEntries[0];let Fe=Be.staffEntries[Be.staffEntries.length-1];if(W.ParentStaffLine===Te?(Be=W,Ce.setEndMeasure(W),Fe=ve):Ce.setEndMeasure(Te.Measures.last()),!Ce.setStartNote(Ie))break;Ce.setEndNote(Fe),fe.setEndMeasure(W),Te.Pedals.push(Ce),Ce.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(Ce.startVfVoiceEntry,Ce.endVfVoiceEntry,Ce,Te)}}fe.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(fe.startVfVoiceEntry,fe.endVfVoiceEntry,fe,q)}else fe.setEndNote(ve),fe.setEndMeasure(W),fe.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(fe.startVfVoiceEntry,fe.endVfVoiceEntry,fe,q);q.Pedals.push(fe)}else m.default.warn("End measure or staffLines for pedal are undefined! This should not happen!")}calculateSingleWavyLine($,Q,ne,ee){var se;const N=Q.WavyLineStart,R=N.ParentStartMultiExpression.Timestamp,O=(se=N.ParentEndMultiExpression)==null?void 0:se.Timestamp,U=this.rules.MinMeasureToDrawIndex,H=this.rules.MaxMeasureToDrawIndex;let W,K,q=this.graphicalMusicSheet.MeasureList[ne][ee].ParentStaffLine;if(q||(q=this.graphicalMusicSheet.MeasureList[U][ee].ParentStaffLine),W=N.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentEndMultiExpression.SourceMeasureParent,ee):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(ee,!0),W.MeasureNumber>H+1&&(W=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(ee,!0)),K=N.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(N.ParentStartMultiExpression.SourceMeasureParent,ee):this.graphicalMusicSheet.MeasureList[U][ee],K.MeasureNumber<U+1&&(K=this.graphicalMusicSheet.MeasureList[U][ee]),K.parentSourceMeasure.measureListIndex<U||K.parentSourceMeasure.measureListIndex>H||W.parentSourceMeasure.measureListIndex<U||W.parentSourceMeasure.measureListIndex>H)return;let te=W.ParentStaffLine;if(te||(te=q),W&&q&&te){const ue=new X.VexFlowVibratoBracket(N,q.PositionAndShape,K.ParentStaff.isTab);let fe=K.findGraphicalStaffEntryFromTimestamp(R);fe||(fe=K.staffEntries[0]);let xe=W.findGraphicalStaffEntryFromTimestamp(O);if(xe||(xe=W.staffEntries[W.staffEntries.length-1]),ue.setStartNote(fe),te!==q){let ve=q.Measures[q.Measures.length-1];ve===void 0&&(ve=W);const Se=ve.staffEntries[ve.staffEntries.length-1];if(Se&&ue.setEndNote(Se),te.ParentMusicSystem.Id-q.ParentMusicSystem.Id>0)for(let ye=q.ParentMusicSystem.Id;ye<te.ParentMusicSystem.Id;ye++){const be=this.musicSystems[ye+1].StaffLines[ee],Me=be.Measures[0],_e=new X.VexFlowVibratoBracket(N,Me.PositionAndShape,be.ParentStaff.isTab);let Te=be.Measures[be.Measures.length-1];const Le=Me.staffEntries[0];let Pe=Te.staffEntries[Te.staffEntries.length-1];W.ParentStaffLine===be&&(Te=W,Pe=xe),_e.setStartNote(Le),_e.setEndNote(Pe),be.WavyLines.push(_e),_e.CalculateBoundingBox(),this.calculateWavyLineSkyBottomLine(_e.startVfVoiceEntry,_e.endVfVoiceEntry,_e,be)}ue.CalculateBoundingBox(),this.calculateWavyLineSkyBottomLine(ue.startVfVoiceEntry,ue.endVfVoiceEntry,ue,q)}else ue.setEndNote(xe),ue.CalculateBoundingBox(),this.calculateWavyLineSkyBottomLine(ue.startVfVoiceEntry,ue.endVfVoiceEntry,ue,q);q.WavyLines.push(ue)}else m.default.warn("End measure or staffLines for wavy line are undefined! This should not happen!")}calculateWavyLineSkyBottomLine($,Q,ne,ee){var ue,fe,xe;const N=ne.startNote.getStave();let R=(ue=ne.endNote)==null?void 0:ue.getStave();R||(R=N,Q=$);const O=Math.max(N.options.top_text_position,R.options.top_text_position);N.options.top_text_position=O,R.options.top_text_position=O;let U,H=-O,W=0,K=0,q=1/0,te=1/0,se=$.PositionAndShape.AbsolutePosition.x+$.PositionAndShape.BorderLeft;if(((xe=(fe=$.parentVoiceEntry)==null?void 0:fe.OrnamentContainer)==null?void 0:xe.GetOrnament)===h.OrnamentEnum.Trill&&(W=se,se+=2,K=se,q=ee.SkyBottomLineCalculator.getSkyLineMinInRange(W,K),te=q+1.85),ne.ToEndOfStopStave)U=Q.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x+Q.parentStaffEntry.parentMeasure.PositionAndShape.BorderRight-1;else{U=Q.PositionAndShape.AbsolutePosition.x+Q.PositionAndShape.BorderRight;const ve=Q.parentStaffEntry.vfClefBefore;ve&&(U+=ve.getWidth()/10)}H=ee.SkyBottomLineCalculator.getSkyLineMinInRange(se,U),H!==1/0&&(H<q?(N.options.top_text_position=-H,R.options.top_text_position=-H,ee.SkyBottomLineCalculator.updateSkyLineInRange(W,K,H-1.85)):(ne.line=-te,H=te),H-=ne.PositionAndShape.Size.height,ee.SkyBottomLineCalculator.updateSkyLineInRange(se,U,H))}calculatePedalSkyBottomLine($,Q,ne,ee){var te,se,ue,fe;let N=Q==null?void 0:Q.PositionAndShape;N||(N=ne.endMeasure.PositionAndShape);const R=f.default.Flow.PedalMarking.Styles,O=ne.getPedalMarking(),U=O.line+3+(ee.StaffLines.length-1),H=O.render_options.text_margin_right/10;let W,K=$.PositionAndShape.AbsolutePosition.x-H;O.style!==R.MIXED&&O.style!==R.MIXED_OPEN_END&&O.style!==R.TEXT||(K-=1);let q=ee.StaffLines.length-1;for(const xe of ee.Pedals){const ve=xe.getPedalMarking().line+3+(ee.StaffLines.length-1);q=Math.max(ve,q)}if(ne.EndSymbolPositionAndShape){const xe=O.render_options.glyph_point_size/20;W=K+3.4;const ve=N.AbsolutePosition.x-H,Se=ve+1.5;q=Math.max(ee.SkyBottomLineCalculator.getBottomLineMaxInRange(K,W),q),q=Math.max(U+2*xe,q);const ye=ee.SkyBottomLineCalculator.getBottomLineMaxInRange(ve,Se);ne.DepressText||(q=Math.max(q,ye)),ne.setLine(q-3-(ee.StaffLines.length-1)),ee.SkyBottomLineCalculator.updateBottomLineInRange(K,W,q+xe),ee.SkyBottomLineCalculator.updateBottomLineInRange(ve,Se,q+xe)}else{const xe=O.render_options.bracket_height/10;if(O.EndsStave)W=Q?Q.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x+Q.parentStaffEntry.parentMeasure.PositionAndShape.Size.width-H:N.AbsolutePosition.x+N.Size.width;else switch(O.style){case R.BRACKET_OPEN_END:case R.BRACKET_OPEN_BOTH:case R.MIXED_OPEN_END:W=N.AbsolutePosition.x+N.BorderRight-H;break;default:W=N.AbsolutePosition.x+N.BorderLeft-H}const ve=(te=Q==null?void 0:Q.parentStaffEntry)==null?void 0:te.vfClefBefore;if(ve&&(W+=ve.getWidth()/10),q=Math.max(ee.SkyBottomLineCalculator.getBottomLineMaxInRange(K,W),q),q===1/0)return;if(q=Math.max(q,U+xe),ne.setLine(q-3-(ee.StaffLines.length-1)),K>W){const Se=W;W=K,K=Se}ee.SkyBottomLineCalculator.updateBottomLineInRange(K,W,q+xe)}for(const xe of ee.Pedals){const ve=xe,Se=ve.getPedalMarking();if(q>Se.line+3+(ee.StaffLines.length-1)){const ye=Se.render_options.text_margin_right/10;let be,Me=ve.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-ye;ve.setLine(q-3-(ee.StaffLines.length-1));let _e=(se=ve.endVfVoiceEntry)==null?void 0:se.PositionAndShape;if(_e||(_e=ve.endMeasure.PositionAndShape),ve.EndSymbolPositionAndShape){const Te=O.render_options.glyph_point_size/20;be=Me+3.4;const Le=_e.AbsolutePosition.x-ye,Pe=Le+1.5;ee.SkyBottomLineCalculator.updateBottomLineInRange(Me,be,q+Te),ee.SkyBottomLineCalculator.updateBottomLineInRange(Le,Pe,q+Te)}else{const Te=Se.render_options.bracket_height/10;if(Se.EndsStave)be=_e.AbsolutePosition.x+_e.Size.width-ye;else switch(O.style){case R.BRACKET_OPEN_END:case R.BRACKET_OPEN_BOTH:case R.MIXED_OPEN_END:be=_e.AbsolutePosition.x+_e.BorderRight-ye;break;default:be=_e.AbsolutePosition.x+_e.BorderLeft-ye}const Le=(fe=(ue=ve.endVfVoiceEntry)==null?void 0:ue.parentStaffEntry)==null?void 0:fe.vfClefBefore;if(Le&&(be+=Le.getWidth()/10),Me>be){const Pe=Me;Me=be,be=Pe}ee.SkyBottomLineCalculator.updateBottomLineInRange(Me,be,q+Te)}}}}calculateOctaveShiftSkyBottomLine($,Q,ne,ee){if(!Q)return void m.default.warn("octaveshift: no endStaffEntry");let N=Q.PositionAndShape;ne.graphicalEndAtMeasureEnd&&(N=Q.parentMeasure.PositionAndShape);let R=$.PositionAndShape.Size.width,O=N.Size.width;$.hasOnlyRests()?R=-R:R/=2,ne.graphicalEndAtMeasureEnd||(Q.hasOnlyRests()?O*=2:O/=2,$===Q&&(O*=2));let U=$.PositionAndShape.AbsolutePosition.x-R,H=N.AbsolutePosition.x+O;if(U>H){const q=U;U=H,H=q}ne.PositionAndShape.Size.width=H-U;const W=ne.getTextBracket(),K=W.font.size/10;if(W.position===p.TextBracket.Positions.TOP){const q=Math.ceil(ee.SkyBottomLineCalculator.getSkyLineMinInRange(U,H));if(q===1/0)return;W.start.getStave().options.top_text_position=Math.abs(q),ee.SkyBottomLineCalculator.updateSkyLineInRange(U,H,q-2*K)}else{const q=ee.SkyBottomLineCalculator.getBottomLineMaxInRange(U,H);if(q===1/0)return;W.start.getStave().options.bottom_text_position=q,ee.SkyBottomLineCalculator.updateBottomLineInRange(U,H,q+1.5*K)}}calculateWordRepetitionInstruction($,Q){let ne;const ee=this.graphicalMusicSheet.MeasureList[Q];for(let N=0,R=ee.length;N<R;++N){const O=ee[N];if(O&&O.ParentStaffLine&&O.ParentStaff.isVisible()){ne=O;break}}ne&&ne.addWordRepetition($)}calculateSkyBottomLines(){const $=G.CollectionUtil.flat(this.musicSystems.map(ne=>ne.StaffLines));let Q=0;for(const ne of $)for(const ee of ne.Measures)ee&&Q++;if(this.rules.AlwaysSetPreferredSkyBottomLineBackendAutomatically&&this.rules.setPreferredSkyBottomLineBackendAutomatically(Q),Q>=this.rules.SkyBottomLineBatchMinMeasures)new i.SkyBottomLineBatchCalculator($,this.rules.PreferredSkyBottomLineBatchCalculatorBackend).calculateLines();else for(const ne of $)ne.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){for(const $ of this.musicSystems)for(const Q of $.StaffLines)try{Q.AlignmentManager.alignDynamicExpressions(),Q.AbstractExpressions.forEach(ne=>{ne.updateSkyBottomLine()})}catch{}}handleTiedGraphicalNote($,Q,ne,ee,N,R,O,U){}handleBeam($,Q,ne){$.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam($,Q)}handleVoiceEntryLyrics($,Q,ne){$.LyricsEntries.forEach((ee,N)=>{const R=new y.GraphicalLyricEntry(N,Q,this.rules.LyricsHeight,this.rules.StaffHeight);if(Q.LyricsEntries.push(R),R.GraphicalLabel.setLabelPositionAndShapeBorders(),N.Word){const O=N.Word.Syllables.indexOf(N);let U=ne.indexOf(N.Word);if(U===-1&&(ne.push(N.Word),U=ne.indexOf(N.Word)),this.graphicalLyricWords.length===0||U>this.graphicalLyricWords.length-1){const H=new d.GraphicalLyricWord(N.Word);R.ParentLyricWord=H,H.GraphicalLyricsEntries[O]=R,this.graphicalLyricWords.push(H)}else{const H=this.graphicalLyricWords[U];R.ParentLyricWord=H,H.GraphicalLyricsEntries[O]=R,H.isFilled()&&(ne.splice(U,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(H),1))}}})}handleVoiceEntryOrnaments($,Q,ne){}handleVoiceEntryArticulations($,Q,ne){}handleVoiceEntryTechnicalInstructions($,Q,ne){}handleTuplet($,Q,ne){$.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet($,Q)}findIndexGraphicalSlurFromSlur($,Q){for(let ne=0;ne<$.length;ne++)if($[ne].slur===Q)return ne;return-1}indexOfGraphicalGlissFromGliss($,Q){for(let ne=0;ne<$.length;ne++)if($[ne].Glissando===Q)return ne;return-1}calculateSlurs(){const $={};for(const Q of this.graphicalMusicSheet.MeasureList[0])$[Q.ParentStaff.idInMusicSheet]=[];for(const Q of this.musicSystems)for(const ne of Q.StaffLines){const ee=$[ne.ParentStaff.idInMusicSheet];for(let N=0;N<ee.length;N++){const R=ee[N],O=new L.GraphicalSlur(R.slur,this.rules);ne.addSlurToStaffline(O),ee[N]=O}for(const N of ne.Measures)for(const R of N.staffEntries){for(const O of R.graphicalVoiceEntries)for(const U of O.notes)for(const H of U.sourceNote.NoteSlurs)if(H.EndNote&&H.StartNote){if(H.StartNote===U.sourceNote){const W=new L.GraphicalSlur(H,this.rules);ee.push(W),ne.addSlurToStaffline(W)}if(H.EndNote===U.sourceNote){const W=this.findIndexGraphicalSlurFromSlur(ee,H);if(W>=0){const K=ee[W];K.staffEntries.indexOf(R)===-1&&K.staffEntries.push(R),ee.splice(W,1)}}}for(const O of ee)O.staffEntries.indexOf(R)===-1&&O.staffEntries.push(R)}}for(const Q of this.musicSystems)for(const ne of Q.StaffLines){const ee=ne.GraphicalSlurs.sort(L.GraphicalSlur.Compare);for(const N of ee)N.slur.isCrossed()||N.calculateCurve(this.rules)}}calculateGlissandi(){const $={};for(const Q of this.graphicalMusicSheet.MeasureList[0])$[Q.ParentStaff.idInMusicSheet]=[];for(const Q of this.musicSystems)for(const ne of Q.StaffLines){const ee=$[ne.ParentStaff.idInMusicSheet];for(let N=0;N<ee.length;N++){const R=ee[N],O=new Y.VexFlowGlissando(R.Glissando);ne.addGlissandoToStaffline(O),ee[N]=O}for(const N of ne.Measures)for(const R of N.staffEntries){for(const O of R.graphicalVoiceEntries)for(const U of O.notes){const H=U.sourceNote.NoteGlissando;if(H!=null&&H.EndNote&&(H!=null&&H.StartNote)){if(H.StartNote===U.sourceNote){const W=new Y.VexFlowGlissando(H);ee.push(W),ne.addGlissandoToStaffline(W)}if(H.EndNote===U.sourceNote){const W=this.indexOfGraphicalGlissFromGliss(ee,H);if(W>=0){const K=ee[W];K.staffEntries.indexOf(R)===-1&&K.staffEntries.push(R),ee.splice(W,1)}}}}for(const O of ee)O.staffEntries.indexOf(R)===-1&&O.staffEntries.push(R)}}for(const Q of this.musicSystems)for(const ne of Q.StaffLines)for(const ee of ne.GraphicalGlissandi)if(ne.ParentStaff.isTab){const N=ee.Glissando.StartNote,R=ee.Glissando.EndNote,O=ee.staffEntries[0].findGraphicalNoteFromNote(N),U=ee.staffEntries.last().findGraphicalNoteFromNote(R);if(!O&&!U)return;let H,W,K,q,te=1;N.FretNumber>R.FretNumber&&(te=-1),O&&O.vfnote&&O.vfnote.length>=2&&(K=O.vfnote[0],H=[0]),U&&U.vfnote&&U.vfnote.length>=2&&(q=U.vfnote[0],W=[0]);const se=new p.TabSlide({first_indices:H,first_note:K,last_indices:W,last_note:q},te),ue=O==null?void 0:O.parentVoiceEntry.parentStaffEntry.parentMeasure;ue&&(ue.vfTies.push(se),ee.vfTie=se);const fe=U==null?void 0:U.parentVoiceEntry.parentStaffEntry.parentMeasure;fe&&(fe.vfTies.push(se),ee.vfTie=se)}}}g.VexFlowMusicSheetCalculator=ie},9479(de,g,c){var l=this&&this.__importDefault||function(M){return M&&M.__esModule?M:{default:M}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowMusicSheetDrawer=g.unitInPixels=void 0;const s=l(c(3206)),u=c(1932),r=c(200),i=c(9409),o=c(7785),n=c(2683),h=c(6362),t=c(3361),f=c(5023),p=l(c(3065)),m=c(1066),x=c(3661),y=c(5824),d=c(9436);g.unitInPixels=10;class S extends u.MusicSheetDrawer{constructor(E=new x.DrawingParameters){super(new o.VexFlowTextMeasurer(E.Rules),E),this.backends=[],this.zoom=1,this.pageIdx=0}get Backends(){return this.backends}drawSheet(E){var L,I,T;this.rules.DefaultVexFlowNoteFont==="gonville"&&(s.default.Flow.DEFAULT_FONT_STACK=[(L=s.default.Flow.Fonts)==null?void 0:L.Gonville,(I=s.default.Flow.Fonts)==null?void 0:I.Bravura,(T=s.default.Flow.Fonts)==null?void 0:T.Custom]),s.default.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*g.unitInPixels,s.default.Flow.STEM_WIDTH=this.rules.StemWidth*g.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 A of E.MusicPages){if(A.PageNumber>this.rules.MaxPageToDrawNumber)break;const v=this.backends[this.pageIdx];v.graphicalMusicPage=A,v.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(E)}drawPage(E){E&&(this.backend=this.backends[E.PageNumber-1],super.drawPage(E),this.pageIdx+=1)}clear(){for(const E of this.backends)E.clear()}setZoom(E){this.zoom=E}calculatePixelDistance(E){return E*g.unitInPixels}drawStaffLine(E){var A,v,B;const L=this.backend.getContext(),I=L.openGroup();I&&(I.classList.add("staffline"),E.ParentStaff&&(I.id=`${(A=E.ParentStaff.ParentInstrument)==null?void 0:A.Name}${(v=E.ParentStaff.ParentInstrument)==null?void 0:v.Id}-${(B=E.ParentStaff)==null?void 0:B.Id}`)),super.drawStaffLine(E);const T=E.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(E,T),this.rules.RenderGlissandi&&this.drawGlissandi(E,T),L.closeGroup()}drawSlurs(E,L){for(const I of E.GraphicalSlurs)I.slur.isCrossed()||this.drawSlur(I,L)}drawGlissandi(E,L){for(const I of E.GraphicalGlissandi)this.drawGlissando(I,L)}drawGlissando(E,L){if(E.StaffLine.ParentStaff.isTab||E.calculateLine(this.rules),E.Line){const I=new i.PointF2D(E.Line.Start.x+L.x,E.Line.Start.y),T=new i.PointF2D(E.Line.End.x+L.x,E.Line.End.y);E.Line.SVGElement=this.drawLine(I,T,E.Color,E.Width)}else{const I=E.vfTie;if(I){const T=this.backend.getContext();I.setContext(T),I.draw()}}}drawSlur(E,L){const I=[],T=new i.PointF2D(E.bezierStartPt.x+L.x,E.bezierStartPt.y+L.y),A=new i.PointF2D(E.bezierStartControlPt.x+L.x,E.bezierStartControlPt.y+L.y),v=new i.PointF2D(E.bezierEndControlPt.x+L.x,E.bezierEndControlPt.y+L.y),B=new i.PointF2D(E.bezierEndPt.x+L.x,E.bezierEndPt.y+L.y);I.push(this.applyScreenTransformation(T)),I.push(this.applyScreenTransformation(A)),I.push(this.applyScreenTransformation(v)),I.push(this.applyScreenTransformation(B)),E.placement===h.PlacementEnum.Above?(T.y-=.05,A.y-=.3,v.y-=.3,B.y-=.05):(T.y+=.05,A.y+=.3,v.y+=.3,B.y+=.05),I.push(this.applyScreenTransformation(T)),I.push(this.applyScreenTransformation(A)),I.push(this.applyScreenTransformation(v)),I.push(this.applyScreenTransformation(B));const D=this.rules.GNote(E.slur.StartNote);E.SVGElement=this.backend.renderCurve(I,!0,D)}drawMeasure(E){E.setAbsoluteCoordinates(E.PositionAndShape.AbsolutePosition.x*g.unitInPixels,E.PositionAndShape.AbsolutePosition.y*g.unitInPixels);try{E.draw(this.backend.getContext())}catch(I){p.default.warn("VexFlowMusicSheetDrawer.drawMeasure",I)}let L=0;for(const I of E.staffEntries)this.drawStaffEntry(I),L=this.drawBuzzRolls(I,L)}drawBuzzRolls(E,L){var I;for(const T of E.graphicalVoiceEntries)for(const A of T.notes)if((I=A.sourceNote.TremoloInfo)!=null&&I.tremoloUnmeasured){const v=this.rules.TremoloBuzzRollThickness,B=.9,D=.5,_=A;let F,k;const j=_.vfnote[0].getStemDirection();let P;if(this.backend instanceof d.SvgVexFlowBackend&&(P=_.getStemSVG()),(P==null?void 0:P.getBbox)!==void 0){const Q=P.getBBox();F=new i.PointF2D(Q.x/10,Q.y/10),k=Q.height/10}else k=_.vfnote[0].getStemLength()/10,F=new i.PointF2D(_.vfnote[0].getStem().x_begin/10,_.vfnote[0].getStem().y_top/10),j===1&&(F.y-=k);let G=F.y+k/3;_.vfnote[0].getBeamCount()>1&&(G=F.y+k/2,j===-1&&(G-=D+.2));const Y=F.x-.5,X=G,ie=[],oe=[new i.PointF2D(0,-v),new i.PointF2D(B-v,0),new i.PointF2D(-B+v,-D),new i.PointF2D(0,-v),new i.PointF2D(B,0),new i.PointF2D(0,v),new i.PointF2D(-B+v,0),new i.PointF2D(B-v,D),new i.PointF2D(0,v),new i.PointF2D(-B,0)];let $=new i.PointF2D(Y,X);ie.push($);for(const Q of oe)$=ie.last(),ie.push(new i.PointF2D($.x+Q.x,$.y-Q.y));this.DrawPath(ie,_.ParentMusicPage,!0,`buzzRoll${L}`),L++}return L}drawLine(E,L,I="#000000FF",T=.2){return E=this.applyScreenTransformation(E),L=this.applyScreenTransformation(L),this.backend.renderLine(E,L,I,T*g.unitInPixels)}DrawOverlayLine(E,L,I,T="#FF0000FF",A=.2,v){if(!I.PageNumber||I.PageNumber>this.backends.length||I.PageNumber<1)return void console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");const B=I.PageNumber-1,D=this.backends[B];return E=this.applyScreenTransformation(E),L=this.applyScreenTransformation(L),v||(v=`overlayLine ${E.x}/${E.y}`),D.renderLine(E,L,T,A*g.unitInPixels,v)}DrawPath(E,L,I=!0,T){const A=L.PageNumber-1,v=this.backends[A],B=[];for(const D of E)B.push(this.applyScreenTransformation(D));return v.renderPath(B,I,T)}drawSkyLine(E){const L=E.PositionAndShape.AbsolutePosition,I=E.PositionAndShape.Size.width;this.drawSampledLine(E.SkyLine,L,I)}drawBottomLine(E){const L=new i.PointF2D(E.PositionAndShape.AbsolutePosition.x,E.PositionAndShape.AbsolutePosition.y),I=E.PositionAndShape.Size.width;this.drawSampledLine(E.BottomLine,L,I,"#0000FFFF")}drawSampledLine(E,L,I,T="#FF0000FF"){const A=[];let v=0;for(let D=0;D<E.length;D++)E[D]!==v&&(A.push(D),v=E[D]);const B=L;if(A.length>0){const D=this.rules.SamplingUnit;let _,F,k=new i.PointF2D(B.x,B.y),j=new i.PointF2D(A[0]/D+B.x,B.y);this.drawLine(k,j,T),E[0]>=0&&(_=new i.PointF2D(A[0]/D+B.x,B.y),F=new i.PointF2D(A[0]/D+B.x,B.y+E[A[0]]),this.drawLine(_,F,T));for(let P=1;P<A.length;P++)k=new i.PointF2D(A[P-1]/D+B.x,B.y+E[A[P-1]]),j=new i.PointF2D(A[P]/D+B.x,B.y+E[A[P-1]]),this.drawLine(k,j,T),_=new i.PointF2D(A[P]/D+B.x,B.y+E[A[P-1]]),F=new i.PointF2D(A[P]/D+B.x,B.y+E[A[P]]),this.drawLine(_,F,T);A[A.length-1]<E.length?(k=new i.PointF2D(A[A.length-1]/D+B.x,B.y+E[A[A.length-1]]),j=new i.PointF2D(B.x+I,B.y+E[A[A.length-1]]),this.drawLine(k,j,T)):(k=new i.PointF2D(A[A.length-1]/D+B.x,B.y),j=new i.PointF2D(B.x+I,B.y),this.drawLine(k,j,T))}else{const D=new i.PointF2D(B.x,B.y),_=new i.PointF2D(B.x+I,B.y);this.drawLine(D,_,T)}}drawStaffEntry(E){if(E.FingeringEntries.length>0)for(const L of E.FingeringEntries)L.SVGNode=this.drawLabel(L,n.GraphicalLayers.Notes);if(E.graphicalChordContainers!==void 0&&E.graphicalChordContainers.length>0)for(const L of E.graphicalChordContainers){const I=L.GraphicalLabel;I.SVGNode=this.drawLabel(I,n.GraphicalLayers.Notes)}this.rules.RenderLyrics&&E.LyricsEntries.length>0&&this.drawLyrics(E.LyricsEntries,n.GraphicalLayers.Notes)}drawLyrics(E,L){E.forEach(I=>{var A;const T=I.GraphicalLabel;T.Label.colorDefault=this.rules.DefaultColorLyrics,T.SVGNode=this.drawLabel(T,L),(A=T.SVGNode)==null||A.classList.add("lyrics")})}drawInstrumentBrace(E,L){const I=this.backend.getContext();I.openGroup("brace"),E.draw(I),I.closeGroup()}drawGroupBracket(E,L){const I=this.backend.getContext();I.openGroup("bracket"),E.draw(I),I.closeGroup()}drawOctaveShifts(E){for(const L of E.OctaveShifts)if(L){const I=L,T=this.backend.getContext(),A=I.getTextBracket();this.rules.DefaultColorMusic&&(A.render_options.color=this.rules.DefaultColorMusic),A.setContext(T);try{A.draw()}catch(v){p.default.warn(v)}}}drawPedals(E){for(const L of E.Pedals)if(L){const I=L,T=this.backend.getContext(),A=I.getPedalMarking();A.render_options.color=this.rules.DefaultColorMusic,A.setContext(T),A.draw()}}drawWavyLines(E){for(const L of E.WavyLines)if(L){const I=L,T=this.backend.getContext(),A=I.getVibratoBracket();A.setContext(T),A.draw()}}drawExpressions(E){var L;for(const I of E.AbstractExpressions)if(I instanceof f.GraphicalInstantaneousDynamicExpression)this.drawInstantaneousDynamic(I);else if(I instanceof t.GraphicalInstantaneousTempoExpression){if(((L=I.SourceExpression.parentMeasure)==null?void 0:L.MeasureNumber)<=1&&!this.rules.RenderFirstTempoExpression)continue;const T=I.GraphicalLabel;T.SVGNode=this.drawLabel(T,n.GraphicalLayers.Notes)}else if(I instanceof m.GraphicalContinuousDynamicExpression)this.drawContinuousDynamic(I);else if(I instanceof y.GraphicalUnknownExpression){const T=I.Label;T.SVGNode=this.drawLabel(T,n.GraphicalLayers.Notes)}else p.default.warn("Unkown type of expression!")}drawInstantaneousDynamic(E){const L=E.Label;L.SVGNode=this.drawLabel(L,n.GraphicalLayers.Notes)}drawContinuousDynamic(E){if(E.IsVerbal){const L=E.Label;L.SVGNode=this.drawLabel(L,n.GraphicalLayers.Notes)}else for(const L of E.Lines){const I=new i.PointF2D(E.ParentStaffLine.PositionAndShape.AbsolutePosition.x+L.Start.x,E.ParentStaffLine.PositionAndShape.AbsolutePosition.y+L.Start.y),T=new i.PointF2D(E.ParentStaffLine.PositionAndShape.AbsolutePosition.x+L.End.x,E.ParentStaffLine.PositionAndShape.AbsolutePosition.y+L.End.y);L.SVGElement=this.drawLine(I,T,L.colorHex??"#000000",L.Width)}}renderLabel(E,L,I,T,A,v){var P;if(!E.Label.print)return;const B=E.Label.fontHeight*g.unitInPixels,{font:D}=E.Label;let _;this.rules.ColoringEnabled&&(_=E.Label.colorDefault,E.ColorXML&&(_=E.ColorXML),_||(_=this.rules.DefaultColorLabel));let F,{fontStyle:k,fontFamily:j}=E.Label;k||(k=this.rules.DefaultFontStyle),j||(j=this.rules.DefaultFontFamily);for(let G=0;G<((P=E.TextLines)==null?void 0:P.length);G++){const Y=E.TextLines[G],X=this.calculatePixelDistance(Y.xOffset),ie=new i.PointF2D(v.x+X,v.y),oe=this.backend.renderText(B,k,D,Y.text,A,ie,_,E.Label.fontFamily);F?F.appendChild(oe):F=oe,v.y=v.y+A,E.TextLines.length>1&&(v.y+=this.rules.SpacingBetweenTextLines)}return F}renderRectangle(E,L,I,T,A){return this.backend.renderRectangle(E,I,T,A)}applyScreenTransformation(E){return new i.PointF2D(E.x*g.unitInPixels,E.y*g.unitInPixels)}applyScreenTransformationForRect(E){return new r.RectangleF2D(E.x*g.unitInPixels,E.y*g.unitInPixels,E.width*g.unitInPixels,E.height*g.unitInPixels)}}g.VexFlowMusicSheetDrawer=S},4332(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowMusicSystem=void 0;const l=c(5221),s=c(6954),u=c(67),r=c(4284),i=c(6014),o=c(3109),n=c(7098);class h extends l.MusicSystem{constructor(f,p){super(f),this.rules=p}calculateBorders(f){if(this.staffLines.length===0)return;const p=this.calcBracketsWidth();this.boundingBox.BorderLeft=-p,this.boundingBox.BorderMarginLeft=-p,this.boundingBox.XBordersHaveBeenSet=!0;const m=this.staffLines[0].SkyBottomLineCalculator.getSkyLineMin();this.boundingBox.BorderTop=m,this.boundingBox.BorderMarginTop=m;const x=this.staffLines[this.staffLines.length-1],y=x.SkyBottomLineCalculator.getBottomLineMax()+x.PositionAndShape.RelativePosition.y;this.boundingBox.BorderBottom=y,this.boundingBox.BorderMarginBottom=y,this.boundingBox.XBordersHaveBeenSet=!0,this.boundingBox.YBordersHaveBeenSet=!0}createSystemLine(f,p,m,x,y,d,S=void 0){const M=d;let E=!1;if(S){E=!0,S.addMeasureLine(m,x),M&&M.addMeasureLine(m,x,E);let L=0;if(m===s.SystemLinesEnum.BoldThinDots&&x===u.SystemLinePosition.MeasureBegin&&d.beginInstructionsWidth>0&&(L=M.getVFStave().getModifierXShift(0)),S.lineTo(d,i.VexFlowConverter.line(m,x),L),m===s.SystemLinesEnum.DotsBoldBoldDots){const I=S.ParentStaffLine.Measures.indexOf(S)+1,T=S.ParentStaffLine.Measures[I],A=d.ParentStaffLine.Measures[I];T&&A&&(T.lineTo(A,i.VexFlowConverter.line(s.SystemLinesEnum.BoldThinDots,x)),T.addMeasureLine(s.SystemLinesEnum.BoldThinDots,x))}}else M&&M.addMeasureLine(m,x,E);return new r.SystemLine(m,x,this,d,S)}createInstrumentBracket(f,p){const m=f,x=p,y=new n.VexFlowInstrumentBrace(m,x);this.InstrumentBrackets.push(y)}createGroupBracket(f,p,m){const x=f,y=p;if(m===0){const d=new o.VexFlowInstrumentBracket(x,y,m);this.GroupBrackets.push(d)}else{const d=new n.VexFlowInstrumentBrace(x,y,m);this.GroupBrackets.push(d)}}}g.VexFlowMusicSystem=h},9310(de,g,c){var l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowOctaveShift=void 0;var s=l(c(3206)).default.Flow;const u=c(2768),r=c(437),i=l(c(3065));class o extends u.GraphicalOctaveShift{constructor(h,t){switch(super(h,t),h.Type){case r.OctaveEnum.VA8:this.position=s.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case r.OctaveEnum.MA15:this.position=s.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case r.OctaveEnum.VB8:this.position=s.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case r.OctaveEnum.MB15:this.position=s.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:i.default.error("Unknown or NONE octaveshift. This should not be called!")}}setStartNote(h){for(const t of h.graphicalVoiceEntries){const f=t;if(f!=null&&f.vfStaveNote)return this.startNote=f.vfStaveNote,!0}return!1}setEndNote(h,t=-1){var p;const f=h.graphicalVoiceEntries;for(let m=(t>=0?Math.min(t,f.length):f.length)-1;m>=0;m--){const x=f[m];if(x!=null&&x.vfStaveNote)return this.endNote=x.vfStaveNote,this.endMeasure=h.parentMeasure,(p=this.endMeasure)!=null&&p.parentSourceMeasure.Rules.OctaveShiftOnWholeMeasureNoteUntilEndOfMeasure&&x.notes[0].sourceNote.isWholeMeasureNote()&&(this.graphicalEndAtMeasureEnd=!0),!0}return!1}getTextBracket(){let h,t=this.endNote;const f=this;this.graphicalEndAtMeasureEnd&&(h={getAbsoluteX:()=>10*(f.endMeasure.PositionAndShape.AbsolutePosition.x+f.endMeasure.PositionAndShape.Size.width),getGlyph:()=>({getWidth:()=>0})}),h&&(t=h);const p=new s.TextBracket({position:this.position,start:this.startNote,stop:t,superscript:this.supscript,text:this.text});return this.endsOnDifferentStaffLine&&(p.render_options.show_bracket=!1),p}}g.VexFlowOctaveShift=o},7109(de,g,c){var l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowPedal=void 0;const s=l(c(3206)),u=c(6438),r=c(7824),i=c(512);class o extends r.GraphicalPedal{constructor(h,t,f=!1,p=!1){switch(super(h,t),this.vfStyle=s.default.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=h.ChangeBegin,this.ChangeEnd=h.ChangeEnd,this.pedalSymbol){case i.MusicSymbol.PEDAL_SYMBOL:this.vfStyle=s.default.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new u.BoundingBox(this,t);break;case i.MusicSymbol.PEDAL_MIXED:this.vfStyle=f&&p?s.default.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:f?s.default.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:p?s.default.Flow.PedalMarking.Styles.MIXED_OPEN_END:s.default.Flow.PedalMarking.Styles.MIXED;break;case i.MusicSymbol.PEDAL_BRACKET:default:this.vfStyle=f&&p?s.default.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:f?s.default.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:p?s.default.Flow.PedalMarking.Styles.BRACKET_OPEN_END:s.default.Flow.PedalMarking.Styles.BRACKET}}setStartNote(h){if(!h)return!1;for(const t of h.graphicalVoiceEntries){const f=t;if(f!=null&&f.vfStaveNote)return this.startNote=f.vfStaveNote,this.startVfVoiceEntry=f,!0}return!1}setEndNote(h){if(!h)return!1;for(const t of h.graphicalVoiceEntries){const f=t;if(f!=null&&f.vfStaveNote)return this.endNote=f.vfStaveNote,this.endVfVoiceEntry=f,!0}return!1}setEndMeasure(h){this.endMeasure=h}CalculateBoundingBox(){}setLine(h){this.line=h}getPedalMarking(){const h=new s.default.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&h.setEndStave(this.endMeasure.getVFStave()),h.setStyle(this.vfStyle),h.setLine(this.line),h.setCustomText(this.DepressText,this.ReleaseText),this.endVfVoiceEntry&&!this.getPedal.EndsStave||(h.EndsStave=!0),this.getPedal.BeginsStave&&(h.BeginsStave=!0),h.ChangeBegin=this.ChangeBegin,h.ChangeEnd=this.ChangeEnd,h}setEndsStave(h,t){t!=null&&t.gte(h.parentSourceMeasure.Duration)&&(this.getPedal.EndsStave=!0)}setBeginsStave(h,t){h&&t.RealValue===0&&(this.getPedal.BeginsStave=!0)}}g.VexFlowPedal=o},5468(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowSlur=g.CurvePositionEnum=void 0;var s,u=l(c(3206)).default.Flow;(function(i){i[i.NEAR_HEAD=1]="NEAR_HEAD",i[i.NEAR_TOP=2]="NEAR_TOP"})(s||(g.CurvePositionEnum=s={}));class r{constructor(o){this.vfStartNote=void 0,this.vfEndNote=void 0,this.parentSlur=o}static createFromVexflowSlur(o){return new r(o.parentSlur)}get vfSlur(){return this.parentSlur}curve_Options(){return{cps:[{x:0,y:10},{x:0,y:10}],invert:!1,position:s.NEAR_TOP,position_end:s.NEAR_TOP,spacing:2,thickness:2,x_shift:0,y_shift:10}}createVexFlowCurve(){this.vfCurve=new u.Curve(this.vfStartNote,this.vfEndNote,void 0)}}g.VexFlowSlur=r},6670(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowStaffEntry=void 0;const l=c(348),s=c(9479),u=c(8233);class r extends l.GraphicalStaffEntry{constructor(o,n,h){super(o,n,h)}calculateXPosition(){const o=this.parentMeasure.getVFStave();let n=0;for(const h of this.graphicalVoiceEntries)if(h.vfStaveNote){if(h.vfStaveNote.setStave(o),!h.vfStaveNote.preFormatted)continue;h.applyBordersFromVexflow();let t=!1,f=this.PositionAndShape;h.notes[0].sourceNote.isWholeRest()&&!this.hasOnlyRests()&&(t=!0,f=h.PositionAndShape),this.parentMeasure.ParentStaff.isTab?f.RelativePosition.x=(h.vfStaveNote.getAbsoluteX()+h.vfStaveNote.glyph.getWidth())/s.unitInPixels:(f.RelativePosition.x=h.vfStaveNote.getBoundingBox().getX()/s.unitInPixels,t&&(f.RelativePosition.x-=o.getNoteStartX()/s.unitInPixels,f.RelativePosition.x-=1.3));const p=h.notes[0].sourceNote;p.isRest()&&p.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(f.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,h.PositionAndShape.BorderLeft=-.7,h.PositionAndShape.BorderRight=.7),h.PositionAndShape.BorderLeft<n&&(n=h.PositionAndShape.BorderLeft)}this.PositionAndShape.RelativePosition.x-=n,this.PositionAndShape.calculateBoundingBox()}setMaxAccidentals(){for(const o of this.graphicalVoiceEntries)for(const n of o.notes)if(n.DrawnAccidental!==u.AccidentalEnum.NONE)return this.MaxAccidentals=1;return this.MaxAccidentals=0}setModifierXOffsets(){var n;const o=[];for(const h of this.graphicalVoiceEntries)(n=h.parentVoiceEntry)!=null&&n.IsGrace?this.applyModifierOffsets(h.notes):o.push(...h.notes);this.applyModifierOffsets(o)}applyModifierOffsets(o){if(o.length===0)return;const n=o.map(f=>f.staffLine),h=this.calculateModifierXOffsets(n,.5),t=this.calculateModifierXOffsets(n,1);o.forEach((f,p)=>{f.baseFingeringXOffset=h[p],f.baseStringNumberXOffset=t[p]})}calculateModifierXOffsets(o,n){const h=[];for(let t=0;t<o.length;t++){let f=0,p=!0;for(;p;)for(let m=t;m>=0;m--){if(Math.abs(o[t]-o[m])<=n&&f===h[m]){f++,p=!0;break}p=!1}h.push(f)}return h}}g.VexFlowStaffEntry=r},5866(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowStaffLine=void 0;const l=c(2919),s=c(1083);class u extends l.StaffLine{constructor(i,o){super(i,o),this.slursInVFStaffLine=[],this.alignmentManager=new s.AlignmentManager(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(i){this.slursInVFStaffLine.push(i)}get AlignmentManager(){return this.alignmentManager}}g.VexFlowStaffLine=u},6173(de,g,c){var l=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowTabMeasure=void 0;var s=l(c(3206)).default.Flow;const u=c(5246),r=c(6014),i=l(c(3065)),o=c(164);class n extends u.VexFlowMeasure{constructor(t,f=void 0,p=void 0){super(t,f,p),this.isTabMeasure=!0}resetLayout(){const t=this.ParentStaff.StafflineCount??6;this.stave=new s.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:t}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let f=0,p=this.staffEntries.length;f<p;++f){const m=this.staffEntries[f];for(const x of m.graphicalVoiceEntries)if(x.notes[0].sourceNote.isRest()){const y=r.VexFlowConverter.GhostNotes(x.notes[0].sourceNote.Length);x.vfStaveNote=y[0],x.vfGhostNotes=y}else x.vfStaveNote=r.VexFlowConverter.CreateTabNote(x)}this.finalizeTuplets();const t=this.getVoicesWithinMeasure();for(const f of t){if(!f)continue;this.vfVoices[f.VoiceId]=new s.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:s.RESOLUTION}).setMode(s.Voice.Mode.SOFT);const p=this.getRestFilledVexFlowStaveNotesPerVoice(f);for(const m of p){if(m.parentVoiceEntry&&m.parentVoiceEntry.IsGrace&&!m.parentVoiceEntry.GraceAfterMainNote)continue;const x=m;if(m.notes.length!==0&&m.notes[0]&&m.notes[0].sourceNote.PrintObject){if(m.parentVoiceEntry&&m.parentVoiceEntry.Arpeggio){const y=m.parentVoiceEntry.Arpeggio;if(m.notes&&m.notes.length>1){const d=r.VexFlowConverter.StrokeTypeFromArpeggioType(y.type),S=new s.Stroke(d,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&x.vfStaveNote.addStroke(0,S)}else i.default.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.
|
|
voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}if(x.vfGhostNotes)for(const y of x.vfGhostNotes)this.vfVoices[f.VoiceId].addTickable(y);else this.vfVoices[f.VoiceId].addTickable(x.vfStaveNote)}else if(x.vfGhostNotes)for(const y of x.vfGhostNotes)this.vfVoices[f.VoiceId].addTickable(y);else this.vfVoices[f.VoiceId].addTickable(x.vfStaveNote)}}}addClefAtBegin(t){t.ClefType===o.ClefEnum.TAB&&super.addClefAtBegin(t)}draw(t){super.draw(t);const f=this.parentSourceMeasure;f.multipleRestMeasures&&this.rules.RenderMultipleRestMeasures&&(this.multiRestElement=new s.MultiMeasureRest(f.multipleRestMeasures,{}),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(t),this.multiRestElement.draw())}}g.VexFlowTabMeasure=n},7785(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowTextMeasurer=void 0;const l=c(6014);g.VexFlowTextMeasurer=class{constructor(s){this.fontSize=20,this.fontSizeStandard=this.fontSize;const u=document.createElement("canvas");this.context=u.getContext("2d"),this.rules=s}computeTextWidthToHeightRatio(s,u,r,i=void 0,o=this.fontSize){return this.context.font=l.VexFlowConverter.font(o,r,u,this.rules,i),this.context.measureText(s).width/o}setFontSize(s=this.fontSizeStandard){return this.fontSize=s,s}}},2907(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowVibratoBracket=void 0;const s=c(7753),u=l(c(3206));class r extends s.GraphicalWavyLine{get ToEndOfStopStave(){return this.toEndOfStopStave}constructor(o,n,h=!1){super(o,n),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=h}setStartNote(o){for(const n of o.graphicalVoiceEntries){const h=n;if(h!=null&&h.vfStaveNote)return this.startNote=h.vfStaveNote,this.startVfVoiceEntry=h,!0}return!1}setEndNote(o){for(const n of o.graphicalVoiceEntries){const h=n;if(h!=null&&h.vfStaveNote){this.endNote=h.vfStaveNote,this.endVfVoiceEntry=h;const t=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,f=t[t.length-1];return this.toEndOfStopStave=f===this.endVfVoiceEntry.parentStaffEntry,!0}}return!1}CalculateBoundingBox(){const o=this.getVibratoBracket();this.boundingBox.Size.height=.2*o.render_options.wave_height}getVibratoBracket(){const o=new u.default.Flow.VibratoBracket({start:this.startNote,stop:this.endNote,toEndOfStopStave:this.toEndOfStopStave});return o.setLine(this.line),this.isVibrato?o.render_options.vibrato_width=20:o.render_options.wave_girth=4,o}}g.VexFlowVibratoBracket=r},4134(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexFlowVoiceEntry=void 0;const l=c(4548),s=c(9479),u=c(4434),r=c(4064);class i extends l.GraphicalVoiceEntry{constructor(n,h,t){super(n,h,t)}applyBordersFromVexflow(){const n=this.vfStaveNote;if(!n.getNoteHeadBeginX)return;const h=n.getBoundingBox(),t=n.getNoteHeadBeginX()-h.x;this.PositionAndShape.RelativePosition.y=h.y/s.unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=h.h/s.unitInPixels;const f=(n.width-(n.paddingRight??0))/2;this.PositionAndShape.BorderLeft=-(t+f)/s.unitInPixels,this.PositionAndShape.BorderRight=(h.w-t)/s.unitInPixels}set vfStaveNote(n){this.mVexFlowStaveNote=n}get vfStaveNote(){return this.mVexFlowStaveNote}applyCustomNoteheads(){const n=this.vfStaveNote;if(n)for(let h=0;h<this.notes.length;h++){const t=this.notes[h].sourceNote;n.note_heads&&t.CustomNoteheadVFCode&&(n.note_heads[h].glyph_code=t.CustomNoteheadVFCode)}}color(){var E,L,I,T,A;const n=this.rules.DefaultColorNotehead,h=this.rules.DefaultColorRest,t=this.rules.DefaultColorStem,f="#00000000";let p,m;const x=this.vfStaveNote;for(let v=0;v<this.notes.length;v++){const B=this.notes[v];if(m=B.sourceNote.NoteheadColor,p=m,this.rules.ColoringMode===u.ColoringModes.AutoColoring||this.rules.ColoringMode===u.ColoringModes.CustomColorSet)if(B.sourceNote.isRest())p=this.rules.ColoringSetCurrent.getValue(-1);else{const D=B.sourceNote.Pitch.FundamentalNote;p=this.rules.ColoringSetCurrent.getValue(D)}if(B.sourceNote.PrintObject&&((E=B.sourceNote.Notehead)==null?void 0:E.Shape)!==r.NoteHeadShape.NONE?p&&p!=="#000000"||(p=this.rules.DefaultColorNotehead):p=f,!m&&this.rules.ColoringMode===u.ColoringModes.XML&&B.sourceNote.PrintObject&&((L=B.sourceNote.Notehead)==null?void 0:L.Shape)!==r.NoteHeadShape.NONE&&(!B.sourceNote.isRest()&&n?p=n:B.sourceNote.isRest()&&h&&(p=h)),p&&B.sourceNote.PrintObject&&((I=B.sourceNote.Notehead)==null?void 0:I.Shape)!==r.NoteHeadShape.NONE)B.sourceNote.NoteheadColorCurrentlyRendered=p;else if(!p)continue;if(this.rules.ColoringEnabled&&B.sourceNote.NoteBeam&&this.rules.ColorBeams){const D=B.sourceNote.NoteBeam.Notes;let _=!0;for(let F=0;F<D.length;F++)D[F].NoteheadColorCurrentlyRendered!==p&&(_=!1);_&&((T=x==null?void 0:x.beam)!=null&&T.setStyle)&&x.beam.setStyle({fillStyle:p,strokeStyle:p})}if(x){if(x.note_heads){const D=x.note_heads[v];D&&D.setStyle({fillStyle:p,strokeStyle:p})}x.setLedgerLineStyle&&(p===f?x.setLedgerLineStyle({fillStyle:p,strokeStyle:p,lineWidth:this.rules.LedgerLineWidth}):x.setLedgerLineStyle({fillStyle:this.rules.LedgerLineColorDefault,lineWidth:this.rules.LedgerLineWidth,strokeStyle:this.rules.LedgerLineColorDefault}))}}let y=t,d=!1;this.rules.ColoringEnabled&&(y=this.parentVoiceEntry.StemColor,y&&y!=="#000000"||(y=t),this.rules.ColorStemsLikeNoteheads&&p&&(y=p,d=!0));let S=!0;for(const v of this.parentVoiceEntry.Notes)if(v.PrintObject&&((A=v.Notehead)==null?void 0:A.Shape)!==r.NoteHeadShape.NONE){S=!1;break}S&&(y=f);const M={fillStyle:y,strokeStyle:y};x&&x.setStemStyle&&(!S&&d&&(this.parentVoiceEntry.StemColor=y),x.setStemStyle(M),x.flag&&x.setFlagStyle&&this.rules.ColorFlags&&x.setFlagStyle(M))}}g.VexFlowVoiceEntry=i},7506(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VexflowStafflineNoteCalculator=void 0;const l=c(8233),s=c(9635),u=c(3263),r=c(164),i=c(1336);class o{constructor(h){this.staffPitchListMapping=new u.Dictionary,this.baseLineNote=l.NoteEnum.B,this.baseLineOctave=1,this.rules=h}trackNote(h){if(!(h instanceof s.VexFlowGraphicalNote)||h.Clef().ClefType!==r.ClefEnum.percussion||h.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;const t=h.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let f;this.staffPitchListMapping.containsKey(t)||this.staffPitchListMapping.setValue(t,new Array),f=this.staffPitchListMapping.getValue(t);const p=h.sourceNote.Pitch;o.findOrInsert(f,p)}static PitchIndexOf(h,t,f=0){if(f>h.length-1)return-1;for(let p=f;p<h.length;p++){const m=h[p];if(t.OperatorEquals(m))return p}return-1}static findOrInsert(h,t){for(let f=0;f<h.length;f++){const p=h[f];if(t.OperatorEquals(p))return f;if(t.OperatorFundamentalLessThan(p))return h.splice(f,0,t),f}return h.push(t),h.length-1}positionNote(h){const t=h.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;if(!(h instanceof s.VexFlowGraphicalNote)||h.sourceNote.isRest()||!this.staffPitchListMapping.containsKey(t))return h;const f=this.staffPitchListMapping.getValue(t),p=this.rules.PercussionUseXMLDisplayStep&&h.sourceNote.displayStepUnpitched!==void 0;if(f.length>this.rules.PercussionOneLineCutoff&&!p&&!this.rules.PercussionUseCajon2NoteSystem)return h;const m=h,x=h.sourceNote.Pitch;let y=this.baseLineNote,d=this.baseLineOctave;if(this.rules.PercussionUseCajon2NoteSystem?x.FundamentalNote===l.NoteEnum.C&&(y=l.NoteEnum.G,d=1):this.rules.PercussionUseXMLDisplayStep&&h.sourceNote.displayStepUnpitched!==void 0&&(y=h.sourceNote.displayStepUnpitched,d=h.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),f.length<=this.rules.PercussionForceVoicesOneLineCutoff)m.setAccidental(new l.Pitch(y,d,x.Accidental));else{const S=o.PitchIndexOf(f,x);if(S>-1){const M=Math.ceil(f.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(S>=M)switch(d=2,(S-M)%5){case 1:y=l.NoteEnum.E;break;case 2:y=l.NoteEnum.G;break;case 3:y=l.NoteEnum.B;break;case 4:y=l.NoteEnum.D,d=3;break;default:y=l.NoteEnum.C}else switch(S%5){case 1:y=l.NoteEnum.F;break;case 2:y=l.NoteEnum.D;break;case 3:y=l.NoteEnum.B,d=0;break;case 4:y=l.NoteEnum.G,d=0;break;default:y=l.NoteEnum.A}const E=new l.Pitch(y,d,x.Accidental);m.setAccidental(E);const L=m.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&L.Notes.length<2&&(E.Octave>this.baseLineOctave||E.FundamentalNote===this.baseLineNote&&E.Octave===this.baseLineOctave?m.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=i.StemDirectionType.Up:m.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=i.StemDirectionType.Down)}}return m}getStafflineUniquePositionCount(h){return this.staffPitchListMapping.containsKey(h)?this.staffPitchListMapping.getValue(h).length:0}}g.VexflowStafflineNoteCalculator=o},7499(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(1083),g),s(c(9834),g),s(c(9436),g),s(c(1902),g),s(c(2400),g),s(c(6014),g),s(c(1216),g),s(c(9635),g),s(c(3753),g),s(c(7809),g),s(c(7098),g),s(c(3109),g),s(c(5246),g),s(c(3849),g),s(c(806),g),s(c(9479),g),s(c(4332),g),s(c(9310),g),s(c(5468),g),s(c(6670),g),s(c(5866),g),s(c(7506),g),s(c(6173),g),s(c(7785),g),s(c(4134),g)},3508(de,g,c){var l=this&&this.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(g,"__esModule",{value:!0}),g.WebGLSkyBottomLineBatchCalculatorBackend=void 0;const s=c(5479),u=c(3667),r=l(c(5340)),i=l(c(5166)),o=l(c(3065)),n=c(813);function h(f,p,m){const x=f.createShader(p);if(!x)throw o.default.warn("WebGLSkyBottomLineCalculatorBackend: Could not create a WebGL shader"),new Error("Could not create a WebGL shader");if(f.shaderSource(x,m),f.compileShader(x),!f.getShaderParameter(x,f.COMPILE_STATUS))throw o.default.warn(`Shader compilation failed
|
|
`+f.getShaderInfoLog(x)),f.deleteShader(x),new Error("WebGL shader compilation failed");return x}class t extends u.SkyBottomLineBatchCalculatorBackend{constructor(p,m){super(p,m)}getPreferredRenderingConfiguration(p,m){const x=Math.min(4096,function(){const d=document.createElement("canvas").getContext("webgl");return d.getParameter(d.MAX_TEXTURE_SIZE)}()),y=Math.ceil(p);return{elementWidth:y,numColumns:Math.min(5,Math.floor(x/y)),numRows:Math.min(5,Math.floor(x/m))}}onInitialize(p){const{elementWidth:m,elementHeight:x,numColumns:y,numRows:d}=p,S=document.createElement("canvas");S.width=m*y,S.height=d;const M=S.getContext("webgl");if(!M)throw o.default.warn("WebGLSkyBottomLineCalculatorBackend: No WebGL support"),new Error("No WebGL support");this.gl=M;const E=function(L,I,T){const A=L.createProgram();if(!A)throw o.default.warn("WebGLSkyBottomLineCalculatorBackend: Could not create a WebGL program"),new Error("Could not create a WebGL program");if(L.attachShader(A,I),L.attachShader(A,T),L.linkProgram(A),!L.getProgramParameter(A,L.LINK_STATUS))throw o.default.warn(`WebGLSkyBottomLineCalculatorBackend: WebGL program link failed
|
|
`+L.getProgramInfoLog(A)),L.deleteProgram(A),new Error("WebGL program link failed");return A}(M,h(M,M.VERTEX_SHADER,r.default),h(M,M.FRAGMENT_SHADER,function(L,I){let T=L;for(const[A,v]of Object.entries(I)){const B=new RegExp(`#define ${A} .*`);T=T.replace(B,`#define ${A} ${v}`)}return T}(i.default,{NUM_ROWS:d,ELEMENT_HEIGHT:x})));(function(L,I){const T=L.createBuffer();if(!T)throw o.default.warn("WebGLSkyBottomLineCalculatorBackend: WebGL buffer creation failed"),new Error("WebGL buffer creation failed");L.bindBuffer(L.ARRAY_BUFFER,T),L.bufferData(L.ARRAY_BUFFER,new Float32Array(n.CollectionUtil.flat([[-1,-1],[1,-1],[1,1],[-1,-1],[1,1],[-1,1]])),L.STATIC_DRAW),L.useProgram(I);const A=L.getAttribLocation(I,"a_position");L.enableVertexAttribArray(A),L.vertexAttribPointer(A,2,L.FLOAT,!1,0,0)})(M,E),this.texture=function(L,I){const T=L.createTexture();if(!T)throw o.default.warn("WebGLSkyBottomLineCalculatorBackend: WebGL texture creation failed"),new Error("WebGL texture creation failed");L.activeTexture(L.TEXTURE0+0),L.bindTexture(L.TEXTURE_2D,T),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.NEAREST),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.NEAREST);const A=L.getUniformLocation(I,"u_image");if(!A)throw o.default.warn("WebGLSkyBottomLineCalculatorBackend: WebGL invalid uniform name"),new Error("WebGL invalid uniform name");return L.uniform1i(A,0),T}(M,E)}calculateFromCanvas(p,m,x,y,d){const S=this.gl,{elementWidth:M,elementHeight:E,numColumns:L}=d;S.viewport(0,0,S.canvas.width,S.canvas.height),S.bindTexture(S.TEXTURE_2D,this.texture),S.texImage2D(S.TEXTURE_2D,0,S.RGBA,S.RGBA,S.UNSIGNED_BYTE,p),S.drawArrays(S.TRIANGLES,0,6);const I=new Uint8Array(S.canvas.width*S.canvas.height*4);S.readPixels(0,0,S.canvas.width,S.canvas.height,S.RGBA,S.UNSIGNED_BYTE,I);const T=[];for(let A=0;A<x.length;++A){const v=x[A],B=Math.floor(v.getVFStave().getWidth()),D=Math.max(Math.ceil(v.PositionAndShape.Size.width*y),1),_=A%L*M*4,F=Math.floor(A/L)*M*L*4,k=new Array(Math.max(D,B)).fill(0),j=new Array(Math.max(D,B)).fill(0);for(let Y=0;Y<B;++Y){const X=I[4*Y+_+F],ie=I[4*Y+_+F+1],oe=I[4*Y+_+F+2],$=X+256*Math.floor(oe/16),Q=ie+oe%16*256;k[Y]=$,j[Y]=Q}const P=Math.max(...k),G=Math.min(...j);for(let Y=0;Y<B;++Y)k[Y]=k[Y]===0?P:k[Y],j[Y]=j[Y]===E?G:j[Y];T.push(new s.SkyBottomLineCalculationResult(k,j))}return T}}g.WebGLSkyBottomLineBatchCalculatorBackend=t},899(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(9490),g),s(c(1974),g),s(c(8927),g),s(c(1083),g),s(c(6438),g),s(c(995),g),s(c(2683),g),s(c(242),g),s(c(3661),g),s(c(9713),g),s(c(6659),g),s(c(953),g),s(c(1066),g),s(c(6711),g),s(c(98),g),s(c(5023),g),s(c(3361),g),s(c(8254),g),s(c(6452),g),s(c(2395),g),s(c(7751),g),s(c(1519),g),s(c(5748),g),s(c(1888),g),s(c(8724),g),s(c(3430),g),s(c(7741),g),s(c(2768),g),s(c(973),g),s(c(4022),g),s(c(348),g),s(c(9760),g),s(c(5054),g),s(c(4548),g),s(c(7225),g),s(c(7921),g),s(c(1932),g),s(c(512),g),s(c(5221),g),s(c(7066),g),s(c(8033),g),s(c(7624),g),s(c(8713),g),s(c(2779),g),s(c(2919),g),s(c(298),g),s(c(4284),g),s(c(67),g),s(c(6954),g),s(c(6723),g),s(c(7499),g)},9252(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Instrument=void 0;const l=c(7586),s=c(7435),u=c(1910);class r extends l.InstrumentalGroup{constructor(o,n,h,t){super(void 0,h,t),this.Transpose=0,this.voices=[],this.staves=[],this.hasLyrics=!1,this.hasChordSymbols=!1,this.lyricVersesNumbers=[],this.subInstruments=[],this.id=o,this.idString=n,this.nameLabel=new s.Label(n)}get Voices(){return this.voices}get Staves(){return this.staves}get NameLabel(){return this.nameLabel}get HasLyrics(){return this.hasLyrics}set HasLyrics(o){this.hasLyrics=o}get HasChordSymbols(){return this.hasChordSymbols}set HasChordSymbols(o){this.hasChordSymbols=o}get LyricVersesNumbers(){return this.lyricVersesNumbers}set LyricVersesNumbers(o){this.lyricVersesNumbers=o}get Name(){return this.nameLabel.text}set Name(o){this.nameLabel.text=o}get IdString(){return this.idString}get Id(){return this.id}get MidiInstrumentId(){return this.subInstruments[0].midiInstrumentID}set MidiInstrumentId(o){this.subInstruments[0].midiInstrumentID=o}get Volume(){return this.subInstruments[0].volume}set Volume(o){for(let n=0,h=this.subInstruments.length;n<h;++n)this.subInstruments[n].volume=o}get PlaybackTranspose(){return this.playbackTranspose}set PlaybackTranspose(o){this.playbackTranspose=o}get SubInstruments(){return this.subInstruments}getSubInstrument(o){for(let n=0,h=this.subInstruments.length;n<h;++n){const t=this.subInstruments[n];if(t.idString===o)return t}}get PartAbbreviation(){return this.partAbbreviation}set PartAbbreviation(o){this.partAbbreviation=o}get Visible(){return this.voices.length>0&&this.Voices[0].Visible}isVisible(){if(!this.Visible)return!1;for(const o of this.Staves)if(o.Visible)return!0;return!1}set Visible(o){for(let n=0,h=this.Voices.length;n<h;++n)this.Voices[n].Visible=o}get Audible(){let o=!1;for(let n=0,h=this.Voices.length;n<h;++n){const t=this.Voices[n];o=o||t.Audible}return o}set Audible(o){for(let n=0,h=this.Voices.length;n<h;++n)this.Voices[n].Audible=o;for(let n=0,h=this.staves.length;n<h;++n)this.staves[n].audible=o}get Following(){let o=!1;for(let n=0,h=this.Voices.length;n<h;++n){const t=this.Voices[n];o=o||t.Following}return o}set Following(o){for(let n=0,h=this.Voices.length;n<h;++n)this.Voices[n].Following=o;for(let n=0,h=this.staves.length;n<h;++n)this.staves[n].following=o}SetVoiceAudible(o,n){for(let h=0,t=this.Voices.length;h<t;++h){const f=this.Voices[h];if(f.VoiceId===o){f.Audible=n;break}}}SetVoiceFollowing(o,n){for(let h=0,t=this.Voices.length;h<t;++h){const f=this.Voices[h];if(f.VoiceId===o){f.Following=n;break}}}SetStaffAudible(o,n){const h=this.staves[o-1];if(h.audible=n,n)for(let t=0,f=h.Voices.length;t<f;++t)h.Voices[t].Audible=!0;else for(let t=0,f=h.Voices.length;t<f;++t){const p=h.Voices[t];let m=!1;for(let x=0,y=this.Staves.length;x<y;++x){const d=this.Staves[x];if(d.Id!==o&&d.audible)for(let S=0,M=d.Voices.length;S<M;++S)d.Voices[S]===p&&(m=!0)}m||(p.Audible=!1)}}SetStaffFollow(o,n){const h=this.staves[o-1];if(h.following=n,n)for(let t=0,f=h.Voices.length;t<f;++t)h.Voices[t].Following=!0;else for(let t=0,f=h.Voices.length;t<f;++t){const p=h.Voices[t];let m=!1;for(let x=0,y=this.Staves.length;x<y;++x){const d=this.Staves[x];if(d.Id!==o&&d.following)for(let S=0,M=d.Voices.length;S<M;++S)d.Voices[S]===p&&(m=!0)}m||(p.Following=!1)}}areAllVoiceVisible(){for(const o of this.Voices)if(!o.Visible)return!1;return!0}createStaves(o){for(let n=0;n<o;n++)this.staves.push(new u.Staff(this,n+1))}toString(){return`${this.Name} , id: ${this.id}, idstring: ${this.idString}`}}g.Instrument=r},7586(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.InstrumentalGroup=void 0,g.InstrumentalGroup=class{constructor(c,l,s){this.instrumentalGroups=[],this.name=c,this.musicSheet=l,this.parent=s}get InstrumentalGroups(){return this.instrumentalGroups}get Parent(){return this.parent}get Name(){return this.name}set Name(c){this.name=c}get GetMusicSheet(){return this.musicSheet}}},7791(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.AClassHierarchyTrackable=void 0,g.AClassHierarchyTrackable=class{isInstanceOfClass(c){let l=this.constructor.prototype;for(;l;){if(c===l.constructor.name)return!0;l=l.__proto__}return!1}}},5678(de,g){Object.defineProperty(g,"__esModule",{value:!0})},8900(de,g){Object.defineProperty(g,"__esModule",{value:!0})},6703(de,g){Object.defineProperty(g,"__esModule",{value:!0})},5377(de,g){Object.defineProperty(g,"__esModule",{value:!0})},6332(de,g){Object.defineProperty(g,"__esModule",{value:!0})},9767(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.ITextTranslation=void 0,g.ITextTranslation=class{static translateText(c,l){if(!this.defaultTextTranslation)return l}}},9990(de,g){Object.defineProperty(g,"__esModule",{value:!0})},4864(de,g){Object.defineProperty(g,"__esModule",{value:!0})},2870(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(5678),g),s(c(8900),g),s(c(6703),g),s(c(6332),g),s(c(9767),g),s(c(9990),g),s(c(4864),g),s(c(7791),g),s(c(5377),g)},7435(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Label=void 0;const l=c(7533);g.Label=class{constructor(s="",u=l.TextAlignmentEnum.CenterBottom,r=void 0,i=!0){this.IsCreditLabel=!1,this.text=s,this.print=i,this.textAlignment=u,this.font=r,this.fontFamily=void 0}ToString(){return this.text}}},9024(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.TimestampTransform=g.MusicPartManager=void 0;const l=c(2561),s=c(474);g.MusicPartManager=class{constructor(r){this.musicSheet=r}reInit(){this.init()}init(){this.parts=this.musicSheet.Repetitions.slice(),this.sheetStart=this.musicSheet.SelectionStart=new l.Fraction(0,1),this.sheetEnd=this.musicSheet.SelectionEnd=this.musicSheet.SheetEndTimestamp,this.calcMapping()}getCurrentRepetitionTimestampTransform(r){let i;for(let o=this.timestamps.length-1;o>=0;o--)if(i=this.timestamps[o],r.gte(i.$from))return i;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(r){if(this.timestamps.length===0)return r;const i=this.getCurrentRepetitionTimestampTransform(r);return l.Fraction.plus(r,l.Fraction.minus(i.to,i.$from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(r){return r?new s.MusicPartManagerIterator(this.musicSheet,r,void 0):new s.MusicPartManagerIterator(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(r){this.musicSheet.SelectionStart=r,this.musicSheet.SelectionEnd=void 0}setSelectionRange(r,i){this.musicSheet.SelectionStart=r??this.sheetStart,this.musicSheet.SelectionEnd=i??this.sheetEnd}calcMapping(){const r=[],i=this.getIterator();let o=i.CurrentRepetition,n=new u(i.CurrentEnrolledTimestamp.clone(),i.CurrentSourceTimestamp.clone(),void 0,0);for(r.push(n);!i.EndReached;){if(i.JumpOccurred||o!==i.CurrentRepetition){if(o=i.CurrentRepetition,i.backJumpOccurred){const h=i.JumpResponsibleRepetition;n.nextBackJump=i.CurrentEnrolledTimestamp,n.curRepetition=h,n.curRepetitionIteration=i.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let t=this.timestamps.length-2;t>=0&&!r[t].to.lt(h.AbsoluteTimestamp)&&!r[t].curRepetition;t--)r[t].nextBackJump=n.nextBackJump,r[t].curRepetition=h,r[t].curRepetitionIteration=n.curRepetitionIteration}n=new u(i.CurrentEnrolledTimestamp.clone(),i.CurrentSourceTimestamp.clone(),void 0,0),r.push(n)}i.moveToNext()}this.timestamps=r}};class u{constructor(i,o,n,h){this.$from=i,this.to=o,this.curRepetition=n,this.curRepetitionIteration=h,this.nextBackJump=void 0,this.nextForwardJump=void 0}}g.TimestampTransform=u},474(de,g,c){var l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(g,"__esModule",{value:!0}),g.MusicPartManagerIterator=void 0;const s=c(2561),u=c(1110),r=c(9288),i=c(5875),o=l(c(3065)),n=c(4064);class h{constructor(f,p,m){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.repetitionIterationCountDictKeys=[],this.repetitionIterationCountDictValues=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new 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=[],this.SkipInvisibleNotes=!0;try{this.frontReached=!0,this.musicSheet=f,this.currentBpm=f.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const x of this.musicSheet.Repetitions)this.setRepetitionIterationCount(x,1);for(let x=0;x<f.getCompleteNumberOfStaves();x++)this.ActiveDynamicExpressions.push(void 0);this.currentMeasure=this.musicSheet.SourceMeasures[0],p||(p=new s.Fraction);do this.moveToNext();while((!this.currentVoiceEntries||this.currentTimeStamp.lt(p))&&!this.endReached);for(let x=0;x<this.activeDynamicExpressions.length;x++)if(this.activeDynamicExpressions[x])if(this.activeDynamicExpressions[x]instanceof i.ContinuousDynamicExpression){const y=this.activeDynamicExpressions[x];this.currentDynamicChangingExpressions.push(new u.DynamicsContainer(y,x))}else{const y=this.activeDynamicExpressions[x];this.currentDynamicChangingExpressions.push(new u.DynamicsContainer(y,x))}this.currentTempoChangingExpression=this.activeTempoExpression}catch(x){o.default.info("MusicPartManagerIterator: "+x)}}get EndReached(){return this.endReached}get FrontReached(){return this.frontReached}get CurrentMeasure(){return this.currentMeasure}get CurrentRepetition(){return this.currentRepetition}get CurrentRepetitionIteration(){return this.CurrentRepetition?this.getRepetitionIterationCount(this.CurrentRepetition):0}get CurrentJumpResponsibleRepetitionIterationBeforeJump(){return this.jumpResponsibleRepetition?this.getRepetitionIterationCount(this.jumpResponsibleRepetition)-1:0}get CurrentBpm(){return this.currentBpm}set CurrentBpm(f){this.currentBpm=f}get CurrentVoiceEntries(){return this.currentVoiceEntries}get CurrentMeasureIndex(){return this.currentMeasureIndex}get CurrentEnrolledTimestamp(){return s.Fraction.plus(this.currentEnrolledMeasureTimestamp,this.currentVerticalContainerInMeasureTimestamp)}get CurrentSourceTimestamp(){return this.currentTimeStamp}get CurrentRelativeInMeasureTimestamp(){return this.currentRelativeInMeasureTimestamp}get JumpOccurred(){return this.backJumpOccurred||this.forwardJumpOccurred}get ActiveTempoExpression(){return this.activeTempoExpression}get ActiveDynamicExpressions(){return this.activeDynamicExpressions}get CurrentTempoChangingExpression(){return this.currentTempoChangingExpression}get JumpResponsibleRepetition(){return this.jumpResponsibleRepetition}clone(f=void 0,p=void 0){const m=new h(this.musicSheet,f??this.currentTimeStamp,p);return m.currentVoiceEntryIndex=this.currentVoiceEntryIndex,m.currentMappingPart=this.currentMappingPart,m.currentPartIndex=this.currentPartIndex,m.currentVoiceEntries=this.currentVoiceEntries,m.endReached=this.endReached,m.frontReached=this.frontReached,m}CurrentVisibleVoiceEntries(f){const p=[];if(!this.currentVoiceEntries)return p;if(f){for(const m of this.currentVoiceEntries)m.ParentVoice.Parent.IdString===f.IdString&&this.getVisibleEntries(m,p);return p}for(const m of this.currentVoiceEntries)this.getVisibleEntries(m,p);return p}CurrentAudibleVoiceEntries(f){const p=[];if(this.currentVoiceEntries)if(f){for(const m of this.currentVoiceEntries)if(m.ParentVoice.Parent.IdString===f.IdString)return this.getAudibleEntries(m,p),p}else for(const m of this.currentVoiceEntries)this.getAudibleEntries(m,p);return p}getCurrentDynamicChangingExpressions(){return this.currentDynamicChangingExpressions}CurrentScoreFollowingVoiceEntries(f){const p=[];if(!this.currentVoiceEntries)return p;if(f){for(const m of this.currentVoiceEntries)if(m.ParentVoice.Parent.IdString===f.IdString)return this.getScoreFollowingEntries(m,p),p}else for(const m of this.currentVoiceEntries)this.getScoreFollowingEntries(m,p);return p}currentPlaybackSettings(){return this.musicSheet.SheetPlaybackSetting}moveToPrevious(){this.frontReached||(this.currentVoiceEntries&&(this.currentVoiceEntries=[]),this.recursiveMoveBack())}moveToPreviousVisibleVoiceEntry(f){for(;!this.frontReached;)if(this.moveToPrevious(),this.checkEntries(f))return}moveToNext(){var f;if(this.forwardJumpOccurred=this.backJumpOccurred=!1,!this.endReached&&(this.frontReached&&(this.frontReached=!1,this.currentVoiceEntryIndex=-1),this.currentVoiceEntries&&(this.currentVoiceEntries.length=0),this.recursiveMove(),this.currentMeasure||(this.currentTimeStamp=new s.Fraction(99999,1),this.currentMeasure=this.musicSheet.SourceMeasures.last()),this.CurrentTempoChangingExpression!==void 0&&!this.musicSheet.IgnoreTempoInstructions))if(this.CurrentTempoChangingExpression.ContinuousTempo!==void 0&&this.currentMeasure.Rules.UseInterpolatedTempoForAccelerandoEtc){const p=this.CurrentTempoChangingExpression.ContinuousTempo.getInterpolatedTempo(this.CurrentSourceTimestamp);p>0&&(this.currentBpm=p)}else this.musicSheet.IgnoreTempoInstructions||(f=this.CurrentTempoChangingExpression.InstantaneousTempo)!=null&&f.TempoInBpm&&(this.currentBpm=this.CurrentTempoChangingExpression.InstantaneousTempo.TempoInBpm)}moveToNextVisibleVoiceEntry(f){for(;!this.endReached;)if(this.moveToNext(),this.checkEntries(f))return}resetRepetitionIterationCount(f){return this.setRepetitionIterationCount(f,1),1}incrementRepetitionIterationCount(f){return this.repetitionIterationCountDictKeys.indexOf(f)===-1?this.setRepetitionIterationCount(f,1):this.setRepetitionIterationCount(f,this.getRepetitionIterationCount(f)+1)}setRepetitionIterationCount(f,p){const m=this.repetitionIterationCountDictKeys.indexOf(f);return m===-1?(this.repetitionIterationCountDictKeys.push(f),this.repetitionIterationCountDictValues.push(p)):this.repetitionIterationCountDictValues[m]=p,p}getRepetitionIterationCount(f){const p=this.repetitionIterationCountDictKeys.indexOf(f);if(p!==-1)return this.repetitionIterationCountDictValues[p]}handleRepetitionsAtMeasureBegin(){for(let f=0,p=this.currentMeasure.FirstRepetitionInstructions.length;f<p;++f){const m=this.currentMeasure.FirstRepetitionInstructions[f];if(!m.parentRepetition)continue;const x=m.parentRepetition;this.currentRepetition=x,x.StartIndex===this.currentMeasureIndex&&this.JumpResponsibleRepetition!==void 0&&x!==this.JumpResponsibleRepetition&&x.StartIndex>=this.JumpResponsibleRepetition.StartIndex&&x.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(x)}}handleRepetitionsAtMeasureEnd(){for(let f=0,p=this.currentMeasure.LastRepetitionInstructions.length;f<p;++f){const m=this.currentMeasure.LastRepetitionInstructions[f],x=m.parentRepetition;if(x){if(x.BackwardJumpInstructions.indexOf(m)>-1&&this.getRepetitionIterationCount(x)<x.UserNumberOfRepetitions&&!x.SkipRepetition&&!this.musicSheet.Rules.CursorIgnoreRepetitions)return void this.doBackJump(x);if(m===x.forwardJumpInstruction&&(this.JumpResponsibleRepetition!==void 0&&x!==this.JumpResponsibleRepetition&&x.StartIndex>=this.JumpResponsibleRepetition.StartIndex&&x.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(x),this.repetitionIterationCountDictKeys.contains(x))){const y=x.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(x));if(y>=0)return this.currentMeasureIndex=y,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=x,void(this.forwardJumpOccurred=!0);y===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(f){f.SkipRepetition||this.musicSheet.Rules.CursorIgnoreRepetitions||(this.currentMeasureIndex=f.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(f),this.jumpResponsibleRepetition=f,this.backJumpOccurred=!0)}activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){const f=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let p=0,m=f.length;p<m;++p){const x=f[p];x instanceof r.RhythmInstruction&&(this.musicSheet.SheetPlaybackSetting.rhythm=x.Rhythm)}}}activateCurrentDynamicOrTempoInstructions(){const f=this.musicSheet.TimestampSortedDynamicExpressionsList;for(;this.currentDynamicEntryIndex>0&&(this.currentDynamicEntryIndex>=f.length||f[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex<f.length&&f[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.lt(this.CurrentSourceTimestamp);)this.currentDynamicEntryIndex++;for(;this.currentDynamicEntryIndex<f.length&&f[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp);){const m=f[this.currentDynamicEntryIndex],x=m.staffNumber;this.CurrentSourceTimestamp.Equals(m.parMultiExpression().AbsoluteTimestamp)&&(m.continuousDynamicExpression?this.activeDynamicExpressions[x]=m.continuousDynamicExpression:m.instantaneousDynamicExpression&&(this.activeDynamicExpressions[x]=m.instantaneousDynamicExpression)),this.currentDynamicEntryIndex++}this.currentDynamicChangingExpressions.length=0;for(let m=0;m<this.activeDynamicExpressions.length;m++)if(this.activeDynamicExpressions[m]){let x,y;if(this.activeDynamicExpressions[m]instanceof i.ContinuousDynamicExpression){const d=this.activeDynamicExpressions[m];x=d.StartMultiExpression.AbsoluteTimestamp,y=d.EndMultiExpression.AbsoluteTimestamp,this.CurrentSourceTimestamp.gte(x)&&this.CurrentSourceTimestamp.lte(y)&&this.currentDynamicChangingExpressions.push(new u.DynamicsContainer(d,m))}else{const d=this.activeDynamicExpressions[m];this.CurrentSourceTimestamp.Equals(d.ParentMultiExpression.AbsoluteTimestamp)&&this.currentDynamicChangingExpressions.push(new u.DynamicsContainer(d,m))}}const p=this.musicSheet.TimestampSortedTempoExpressionsList;for(;this.currentTempoEntryIndex>0&&(this.currentTempoEntryIndex>=p.length||p[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex<p.length&&p[this.currentTempoEntryIndex].AbsoluteTimestamp.lt(this.CurrentSourceTimestamp);)this.currentTempoEntryIndex++;for(;this.currentTempoEntryIndex<p.length&&p[this.currentTempoEntryIndex].AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp);)this.activeTempoExpression=p[this.currentTempoEntryIndex],this.currentTempoEntryIndex++;if(this.currentTempoChangingExpression=void 0,this.activeTempoExpression){let m=this.activeTempoExpression.AbsoluteTimestamp;this.activeTempoExpression.ContinuousTempo&&(m=this.activeTempoExpression.ContinuousTempo.AbsoluteEndTimestamp),(this.CurrentSourceTimestamp.gte(this.activeTempoExpression.AbsoluteTimestamp)||this.CurrentSourceTimestamp.lte(m))&&(this.currentTempoChangingExpression=this.activeTempoExpression)}}recursiveMoveBack(){if(this.currentVoiceEntryIndex>0){this.currentVoiceEntryIndex--;const f=this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];this.currentVoiceEntries=this.getVoiceEntries(f),this.currentVerticalContainerInMeasureTimestamp=f.Timestamp,this.currentRelativeInMeasureTimestamp=this.currentVerticalContainerInMeasureTimestamp,this.currentTimeStamp=s.Fraction.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp),this.activateCurrentDynamicOrTempoInstructions();const p=this.musicSheet.SelectionEnd;return p&&this.currentTimeStamp.lt(p)&&(this.endReached=!1),void(this.currentMeasureIndex=this.musicSheet.SourceMeasures.indexOf(this.CurrentMeasure))}if(this.currentVoiceEntryIndex===0&&this.currentMeasureIndex!==0){const f=this.musicSheet.SourceMeasures[this.currentMeasureIndex-1];this.currentMeasureIndex--,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex];const p=f.VerticalSourceStaffEntryContainers[f.VerticalSourceStaffEntryContainers.length-1];this.currentVoiceEntries=this.getVoiceEntries(p),this.currentVerticalContainerInMeasureTimestamp=p.Timestamp,this.currentVoiceEntryIndex=f.VerticalSourceStaffEntryContainers.length-1,this.currentRelativeInMeasureTimestamp=this.currentVerticalContainerInMeasureTimestamp,this.currentTimeStamp=s.Fraction.plus(this.currentMeasure.AbsoluteTimestamp,p.Timestamp),this.activateCurrentDynamicOrTempoInstructions();const m=this.musicSheet.SelectionEnd;return void(m&&this.currentTimeStamp.lt(m)&&(this.endReached=!1))}this.frontReached=!0,this.currentTimeStamp=new s.Fraction(-1,1)}recursiveMove(){if(this.currentVoiceEntryIndex++,this.currentVoiceEntryIndex===0&&(this.handleRepetitionsAtMeasureBegin(),this.activateCurrentRhythmInstructions()),this.currentVoiceEntryIndex>=0&&this.currentVoiceEntryIndex<this.currentMeasure.VerticalSourceStaffEntryContainers.length){const f=this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];this.currentVoiceEntries=this.getVoiceEntries(f),this.currentVerticalContainerInMeasureTimestamp=f.Timestamp,this.currentRelativeInMeasureTimestamp=this.currentVerticalContainerInMeasureTimestamp,this.currentTimeStamp=s.Fraction.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp);const p=this.musicSheet.SelectionEnd;return p&&this.currentTimeStamp.gte(p)&&(this.endReached=!0),void this.activateCurrentDynamicOrTempoInstructions()}if(this.currentEnrolledMeasureTimestamp.Add(this.currentMeasure.Duration),this.handleRepetitionsAtMeasureEnd(),this.currentMeasureIndex>=0&&this.currentMeasureIndex<this.musicSheet.SourceMeasures.length)return this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentTimeStamp=s.Fraction.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp),this.currentVoiceEntryIndex=-1,void this.recursiveMove();this.currentVerticalContainerInMeasureTimestamp=new s.Fraction,this.currentMeasure=void 0,this.currentVoiceEntries=void 0,this.endReached=!0}checkEntries(f){const p=this.CurrentVisibleVoiceEntries();if(p.length>0){if(!f)return!0;for(let m=0,x=p.length;m<x;++m)if(p[m].Notes[0].Pitch)return!0}return!1}getVisibleEntries(f,p){var m;if(f.ParentVoice.Visible){let x=!1;for(const y of f.Notes)if(y.PrintObject&&((m=y.Notehead)==null?void 0:m.Shape)!==n.NoteHeadShape.NONE){x=!0;break}if(!x&&this.SkipInvisibleNotes)return;p.push(f)}}getAudibleEntries(f,p){if(f.hasTie()){const m=f.Notes[0];if(m.NoteTie!==void 0&&m.NoteTie.StartNote!==m)return}f.ParentVoice.Audible&&f.ParentSourceStaffEntry.ParentStaff.audible&&p.push(f)}getScoreFollowingEntries(f,p){f.ParentVoice.Following&&f.ParentVoice.Parent.Following&&p.push(f)}getVoiceEntries(f){const p=[];for(const m of f.StaffEntries)if(m)for(const x of m.VoiceEntries)p.push(x);return p}}g.MusicPartManagerIterator=h},1121(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(9024),g),s(c(474),g)},427(de,g,c){var l=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSheet=void 0;const s=c(2561),u=c(9024),r=c(6001),i=c(7435),o=c(5534),n=c(8786),h=c(9713),t=c(2683),f=l(c(3065)),p=c(7533),m=c(283);class x{constructor(){this.idString="uninitialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new n.MusicSheetErrors,this.staves=[],this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new s.Fraction(0,1),this.MeasureWidthFactor=1,this.IgnoreTempoInstructions=!1,this.playbackSettings=new m.PlaybackSettings,this.playbackSettings.rhythm=new s.Fraction(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new u.MusicPartManager(this),this.hasBPMInfo=!1}static getIndexFromStaff(d){return d.idInMusicSheet}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(d){this.sourceMeasures=d}get Repetitions(){return this.repetitions}set Repetitions(d){this.repetitions=d}get DynListStaves(){return this.dynListStaves}set TimestampSortedTempoExpressionsList(d){this.timestampSortedTempoExpressionsList=d}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(d){this.playbackSettings=d}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(d){this.drawErroneousMeasures=d}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(d){this.hasBeenOpenedForTheFirstTime=d}InitializeStartTempoInBPM(d){this.userStartTempoInBPM=d}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(d){this.defaultStartTempoInBpm=d,this.InitializeStartTempoInBPM(d)}get Path(){return this.path}set Path(d){this.path=d}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(d){this.Title=new i.Label(d)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(d){this.Subtitle=new i.Label(d)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(d){this.Composer=new i.Label(d)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(d){this.Lyricist=new i.Label(d)}get CopyrightString(){return this.copyright?this.copyright.text:""}set CopyrightString(d){this.Copyright=new i.Label(d,p.TextAlignmentEnum.CenterBottom,void 0,!0)}get Title(){return this.title}set Title(d){this.title=d}get Subtitle(){return this.subtitle}set Subtitle(d){this.subtitle=d}get Composer(){return this.composer}set Composer(d){this.composer=d}get Lyricist(){return this.lyricist}set Lyricist(d){this.lyricist=d}get Copyright(){return this.copyright}set Copyright(d){this.copyright=d}get Rules(){return this.rules||(f.default.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new h.EngravingRules),this.rules}set Rules(d){this.rules=d}get SheetErrors(){return this.musicSheetErrors}get SelectionStart(){return this.selectionStart}set SelectionStart(d){this.selectionStart=d.clone(),this.currentEnrolledPosition=d.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(d){this.selectionEnd=d}set HasBPMInfo(d){this.hasBPMInfo=d}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(d){this.sourceMeasures.push(d),d.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let d=0,S=this.instruments.length;d<S;++d){const M=this.instruments[d];if(M.Voices.length===0){const E=new o.Voice(M,1);M.Voices.push(E)}}}getStaffFromIndex(d){return this.staves[d]}fillStaffList(){let d=0;for(let S=0,M=this.instruments.length;S<M;++S){const E=this.instruments[S];for(let L=0,I=E.Staves.length;L<I;++L){const T=E.Staves[L];T.idInMusicSheet=d,this.staves.push(T),d++}}}get MusicPartManager(){return this.musicPartManager}set MusicPartManager(d){this.musicPartManager=d}getCompleteNumberOfStaves(){let d=0;for(let S=0,M=this.instruments.length;S<M;++S)d+=this.instruments[S].Staves.length;return d}getListOfMeasuresFromIndeces(d,S){const M=[];for(let E=d;E<=S;E++)M.push(this.sourceMeasures[E]);return M}getNextSourceMeasure(d){const S=this.sourceMeasures.indexOf(d);return S===this.sourceMeasures.length-1?d:this.sourceMeasures[S+1]}getFirstSourceMeasure(){return this.sourceMeasures[0]}getLastSourceMeasure(){return this.sourceMeasures[this.sourceMeasures.length-1]}resetAllNoteStates(){const d=this.MusicPartManager.getIterator();for(;!d.EndReached&&d.CurrentVoiceEntries;){for(let S=0,M=d.CurrentVoiceEntries.length;S<M;++S){const E=d.CurrentVoiceEntries[S];for(let L=0,I=E.Notes.length;L<I;++L)E.Notes[L].state=t.NoteState.Normal}d.moveToNext()}}getMusicSheetInstrumentIndex(d){return this.Instruments.indexOf(d)}getGlobalStaffIndexOfFirstStaff(d){const S=this.getMusicSheetInstrumentIndex(d);let M=0;for(let E=0;E<S;E++)M+=this.Instruments[E].Staves.length;return M}setRepetitionNewUserNumberOfRepetitions(d,S){let M=0;for(let E=0;E<this.repetitions.length;E++)if(this.repetitions[E]instanceof r.Repetition){if(d===M){this.repetitions[E].UserNumberOfRepetitions=S;break}M++}}getRepetitionByIndex(d){let S=0;for(let M=0;M<this.repetitions.length;M++)if(this.repetitions[M]instanceof r.Repetition){if(d===S)return this.repetitions[M];S++}}CompareTo(d){return this.Title.text.localeCompare(d.Title.text)}getExpressionsStartTempoInBPM(){if(this.TimestampSortedTempoExpressionsList.length>0){const d=this.TimestampSortedTempoExpressionsList[0];if(d.InstantaneousTempo)return d.InstantaneousTempo.TempoInBpm;if(d.ContinuousTempo)return d.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(d){return f.default.info("MusicSheet.FirstMeasureNumber: ",d),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(d){return f.default.info("MusicSheet.LastMeasureNumber: ",d),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(d){this.currentEnrolledPosition=d.clone()}get Transpose(){return this.transpose}set Transpose(d){this.transpose=d}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(d){this.idString=d}getEnrolledSelectionStartTimeStampWorkaround(){const d=this.MusicPartManager.getIterator(this.SelectionStart);return s.Fraction.createFromFraction(d.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const d=this.getLastSourceMeasure();return s.Fraction.plus(d.AbsoluteTimestamp,d.Duration)}getSourceMeasureFromTimeStamp(d){for(let S=0,M=this.sourceMeasures.length;S<M;++S){const E=this.sourceMeasures[S];for(let L=0,I=E.VerticalSourceStaffEntryContainers.length;L<I;++L){const T=E.VerticalSourceStaffEntryContainers[L];if(d.Equals(T.getAbsoluteTimestamp()))return E}}return this.findSourceMeasureFromTimeStamp(d)}findSourceMeasureFromTimeStamp(d){for(const S of this.sourceMeasures)if(S.AbsoluteTimestamp.lte(d)&&d.lt(s.Fraction.plus(S.AbsoluteTimestamp,S.Duration)))return S}getVisibleInstruments(){const d=[];for(let S=0,M=this.Instruments.length;S<M;++S){const E=this.Instruments[S];E.Voices.length>0&&E.Voices[0].Visible&&d.push(E)}return d}}g.MusicSheet=x,x.defaultTitle="defaultTitle"},1325(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.MappingSourceMusicPart=void 0,g.MappingSourceMusicPart=class{constructor(c,l,s,u=-1,r=!1){this.repetitionRun=-1,this.sourceMusicPart=c,this.parentPartListEntry=s,this.startTimestamp=l.clone(),this.repetitionRun=u,this.parentRepetition=s,this.isEnding=r}get IsRepetition(){return this.parentRepetition!==void 0}get IsEnding(){return this.isEnding}get IsLastRepetitionRun(){return this.IsRepetition&&this.repetitionRun+1===this.parentRepetition.UserNumberOfRepetitions}get RepetitionRun(){return this.repetitionRun}get ParentPartListEntry(){return this.parentPartListEntry}get SourceMusicPart(){return this.sourceMusicPart}get StartTimestamp(){return this.startTimestamp}CompareTo(c){return c?this.startTimestamp.CompareTo(c.startTimestamp):1}}},7551(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.PartListEntry=void 0,g.PartListEntry=class{constructor(c){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=c}get Visible(){return this.visible}set Visible(c){this.visible=c}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}}},6001(de,g,c){var l=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(g,"__esModule",{value:!0}),g.RepetitionEndingPart=g.Repetition=void 0;const s=c(3457),u=c(2561),r=c(7551),i=l(c(3065));class o extends r.PartListEntry{constructor(t,f=!1){super(t),this.SkipRepetition=!1,this.userNumberOfRepetitions=0,this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=t,this.virtualOverallRepetition=f}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 f=this.userNumberOfRepetitions-this.NumberOfEndings;for(let p=1;p<=this.userNumberOfRepetitions;p++)p<=f?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(p-f)}getForwardJumpTargetForIteration(t){const f=this.repetitonIterationOrder[t-1];return this.endingIndexDict[f]?this.endingIndexDict[f].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(t,f){const p=new n(new s.SourceMusicPart(this.musicSheet2,f,f));this.endingParts.push(p);for(const m of t)try{this.endingIndexDict[m]=p,p.endingIndices.push(m),this.numberOfEndings<m&&(this.numberOfEndings=m)}catch(x){i.default.error("Repetition: Exception.",x)}}setEndingStartIndex(t,f){const p=new n(new s.SourceMusicPart(this.musicSheet2,f,f));this.EndingIndexDict[t]=p,this.endingParts.push(p),p.endingIndices.push(t),this.numberOfEndings<t&&(this.numberOfEndings=t)}setEndingEndIndex(t,f){this.endingIndexDict[t]&&this.endingIndexDict[t].part.setEndIndex(f)}get NumberOfEndings(){return this.numberOfEndings}get FromWords(){return this.fromWords}set FromWords(t){this.fromWords=t}get AbsoluteTimestamp(){return u.Fraction.createFromFraction(this.musicSheet2.SourceMeasures[this.startMarker.measureIndex].AbsoluteTimestamp)}get StartIndex(){return this.startMarker.measureIndex}get EndIndex(){if(this.BackwardJumpInstructions.length===0)return this.StartIndex;let t=this.backwardJumpInstructions[this.backwardJumpInstructions.length-1].measureIndex;return this.endingIndexDict[this.NumberOfEndings]&&(t=Math.max(this.endingIndexDict[this.NumberOfEndings].part.EndIndex,t)),t}checkRepetitionForMultipleLyricVerses(){let t=0;const f=this.StartIndex,p=this.EndIndex;for(let m=f;m<=p;m++){const x=this.musicSheet2.SourceMeasures[m];for(let y=0;y<x.CompleteNumberOfStaves;y++)if(x.VerticalSourceStaffEntryContainers[y]){for(const d of x.VerticalSourceStaffEntryContainers[y].StaffEntries)if(d){let S=0;for(const M of d.VoiceEntries)S+=M.LyricsEntries.keys.length;t=Math.max(t,S)}}}return t}get FirstSourceMeasureNumber(){return this.getFirstSourceMeasure().MeasureNumber}get LastSourceMeasureNumber(){return this.getLastSourceMeasure().MeasureNumber}coversIdenticalMeasures(t){return this.StartIndex===t.StartIndex&&this.EndIndex===t.EndIndex}removeFromRepetitionInstructions(){this.startMarker!==void 0&&(this.startMarker.parentRepetition=void 0),this.endMarker!==void 0&&(this.endMarker.parentRepetition=void 0);for(const t of this.BackwardJumpInstructions)t.parentRepetition=void 0}}g.Repetition=o;class n{constructor(t){this.endingIndices=[],this.part=t}ToString(){return this.endingIndices.join(", ")}}g.RepetitionEndingPart=n},3457(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.SourceMusicPart=void 0;const l=c(7551),s=c(2561);class u extends l.PartListEntry{constructor(i,o,n){super(i),this.musicSheet=i,this.startIndex=o,this.endIndex=n}get MeasuresCount(){return this.endIndex-this.startIndex+1}get StartIndex(){return this.startIndex}get EndIndex(){return this.endIndex}get ParentRepetition(){return this.parentRepetition}set ParentRepetition(i){this.parentRepetition=i}get AbsoluteTimestamp(){return s.Fraction.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(i){this.startIndex=i}setEndIndex(i){this.endIndex=i}}g.SourceMusicPart=u},4076(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(1325),g),s(c(7551),g),s(c(6001),g),s(c(3457),g)},1272(de,g,c){var l=this&&this.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(g,"__esModule",{value:!0}),g.InstrumentReader=void 0;const s=c(469),u=c(2369),r=c(164),i=c(4543),o=c(9288),n=c(2561),h=c(9767),t=c(7307),f=c(164),p=c(9288),m=c(4543),x=l(c(3065)),y=c(164),d=c(9536),S=c(5984),M=c(3186),E=c(1336),L=c(5282),I=c(6954);g.InstrumentReader=class{constructor(T,A,v,B){this.voiceGeneratorsDict={},this.staffMainVoiceGeneratorDict={},this.divisions=0,this.currentClefNumber=1,this.currentXmlMeasureIndex=0,this.activeKeyHasBeenInitialized=!1,this.abstractInstructions=[],this.repetitionInstructionReader=A,this.xmlMeasureList=v,this.musicSheet=B.GetMusicSheet,this.instrument=B,this.activeClefs=new Array(B.Staves.length),this.activeClefsHaveBeenInitialized=new Array(B.Staves.length);for(let D=0;D<B.Staves.length;D++)this.activeClefsHaveBeenInitialized[D]=!1;this.createExpressionGenerators(B.Staves.length),this.slurReader=new M.SlurReader(this.musicSheet),this.pluginManager=T}get ActiveKey(){return this.activeKey}get MaxTieNoteFraction(){return this.maxTieNoteFraction}get ActiveRhythm(){return this.activeRhythm}set ActiveRhythm(T){this.activeRhythm=T}readNextXmlMeasure(T,A,v){var k,j,P,G,Y,X;if(this.currentXmlMeasureIndex>=this.xmlMeasureList.length)return!1;this.currentMeasure=T,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(T,this.currentXmlMeasureIndex);let B=new n.Fraction(0,1),D=new n.Fraction(0,1),_=!1;this.maxTieNoteFraction=new n.Fraction(0,1);let F=!1;try{const ie=this.xmlMeasureList[this.currentXmlMeasureIndex],oe=ie.elements();let $;T.Rules.UseXMLMeasureNumbers&&!Number.isInteger(T.MeasureNumberXML)&&($=parseInt((k=ie.attribute("number"))==null?void 0:k.value,10),Number.isInteger($)&&(T.MeasureNumberXML=$));const Q=ie.attribute("osmdWidthFactor");if(Q){const ee=Number.parseFloat(Q.value);typeof ee!="number"||isNaN(ee)?x.default.info(`xml parse: osmdWidthFactor invalid for measure ${$}`):T.WidthFactor=ee}let ne;for(let ee=0;ee<oe.length;ee++){const N=oe[ee];if(ee>0&&(ne=oe[ee-1]),N.name==="print"){const R=N.attribute("new-system");(R==null?void 0:R.value)==="yes"&&(T.printNewSystemXml=!0);const O=N.attribute("new-page");(O==null?void 0:O.value)==="yes"&&(T.printNewPageXml=!0)}else if(N.name==="attributes"){const R=N.element("divisions");if(R&&(this.divisions=parseInt(R.value,10),isNaN(this.divisions))){const H=h.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(x.default.debug("InstrumentReader.readNextXmlMeasure",H),this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw _=!0,new t.MusicSheetReadingException(H+this.instrument.Name);this.musicSheet.SheetErrors.push(H+this.instrument.Name)}if(!N.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const H=h.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw _=!0,new t.MusicSheetReadingException(H+this.instrument.Name);this.musicSheet.SheetErrors.push(H+this.instrument.Name)}this.addAbstractInstruction(N,v,ne,B.clone()),B.Equals(new n.Fraction(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],N)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],N,B)&&this.saveClefInstructionAtEndOfMeasure();const O=N.elements("staff-details");for(const H of O){const W=H.element("staff-lines");if(W){let K=1;const q=H.attribute("number");q&&(K=parseInt(q.value,10)),this.instrument.Staves[K-1].StafflineCount=parseInt(W.value,10)}}const U=N.element("measure-style");if(U){const H=U.element("multiple-rest");if(H){const W=H.value;let K=0;try{K=Number.parseInt(W,10),T.multipleRestMeasures!==void 0&&K!==T.multipleRestMeasures?T.multipleRestMeasures=0:(T.multipleRestMeasures=K,this.currentMultirestStartMeasure=T,this.followingMultirestMeasures=K+1)}catch(q){console.log("multirest parse error: "+q)}}}}else if(N.name==="note"){let R=!0;((j=N.attribute("print-object"))==null?void 0:j.value)==="no"&&(R=!1);const O=this.getNoteStaff(N);this.currentStaff=this.instrument.Staves[O-1];const U=N.element("chord")!==void 0;if(N.element("voice")){const Ae=parseInt(N.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(Ae,O-1)}else U&&this.currentVoiceGenerator||(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,O-1));let H,W=0,K=new n.Fraction(0,1),q=2;const te=N.element("rest")!==void 0;if(N.element("duration")){if(this.divisions===0&&this.currentXmlMeasureIndex===0){if(this.divisions=this.readDivisionsFromNotes(),this.divisions===0){const Ae=h.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");throw _=!0,new t.MusicSheetReadingException(Ae+this.instrument.Name)}this.musicSheet.SheetErrors.push(h.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ")+this.instrument.Name)}if(W=parseInt(N.element("duration").value,10),isNaN(W)){const Ae=h.ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(Ae),x.default.debug("InstrumentReader.readNextXmlMeasure",Ae);continue}if(K=new n.Fraction(W,4*this.divisions),te&&K.RealValue>((P=this.ActiveRhythm)==null?void 0:P.Rhythm.RealValue)&&(K=this.ActiveRhythm.Rhythm.clone()),W===0?K=this.getNoteDurationFromTypeNode(N):H=this.getNoteDurationFromTypeNode(N),N.element("time-modification")){K=this.getNoteDurationForTuplet(N);const Ae=N.element("time-modification");Ae!=null&&Ae.element("normal-notes")&&(q=parseInt(Ae.element("normal-notes").value,10))}}const se=N.combinedElement("notations"),ue=N.element("grace")!==void 0||W===0||U&&F;let fe=!1,xe=!1;if(ue){const Ae=N.element("grace");Ae&&Ae.attributes()&&Ae.attribute("slash")&&Ae.attribute("slash").value==="yes"&&(fe=!0),K=this.getNoteDurationFromTypeNode(N),se&&se.element("slur")&&(xe=!0)}const[ve,Se]=this.getCueNoteAndNoteTypeXml(N),[ye,be,Me]=this.getStemDirectionAndColors(N);let _e;if(se){const Ae=se.element("ornaments");Ae&&(_e=this.getTremoloInfo(Ae),this.getWavyLines(Ae,N,B,D))}const Te=U?D.clone():B.clone();this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(Te,this.inSourceMeasureInstrumentIndex+O-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!U&&!ue&&!F||ue&&!F||ue&&!U||!ue&&F)&&this.currentVoiceGenerator.createVoiceEntry(Te,this.currentStaffEntry,!ue,ue,fe,xe),ue||U||(D=B.clone(),B.Add(K)),U&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+O-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const Le=this.currentStaffEntry!==void 0&&this.currentStaffEntry.Timestamp!==void 0&&this.currentStaffEntry.Timestamp.Equals(new n.Fraction(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,Le),this.activeRhythm;const Pe=N.elements("dot").length;if(this.currentVoiceGenerator.read(N,K,H,Se,q,te,this.currentStaffEntry,this.currentMeasure,A,this.maxTieNoteFraction,U,v,R,ve,ue,ye,_e,be,Me,Pe),se!==void 0&&se.element("dynamics")){const Ae=this.expressionReaders[this.readExpressionStaffNumber(N)-1];Ae&&(Ae.readExpressionParameters(N,this.instrument,this.divisions,B,D,this.currentMeasure.MeasureNumber,!1),Ae.read(N,this.currentMeasure,D))}F=ue}else if(N.name==="forward"){const R=parseInt(N.element("duration").value,10);B.Add(new n.Fraction(R,4*this.divisions))}else if(N.name==="backup"){const R=parseInt(N.element("duration").value,10);B.Sub(new n.Fraction(R,4*this.divisions)),B.IsNegative()&&(B=new n.Fraction(0,1)),D.Sub(new n.Fraction(R,4*this.divisions)),D.IsNegative()&&(D=new n.Fraction(0,1))}else if(N.name==="direction"){const R=N.elements("direction-type"),O=R[0];let U=Math.min(1,B.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(U/=this.activeRhythm.Rhythm.RealValue);let H=!1;if(this.repetitionInstructionReader&&(H=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(O,U)),!H){let W=this.expressionReaders[0];const K=this.readExpressionStaffNumber(N)-1;if(K<this.expressionReaders.length&&(W=this.expressionReaders[K]),W){if(R.some(q=>q.element("octave-shift"))){W.readExpressionParameters(N,this.instrument,this.divisions,B,D,this.currentMeasure.MeasureNumber,!0);let q,te=0;(Y=(G=this.currentStaffEntry)==null?void 0:G.Timestamp)!=null&&Y.Equals(B)?(te=this.currentStaffEntry.VoiceEntries.length,q=B.clone()):q=D.clone(),W.addOctaveShift(N,this.currentMeasure,q,te)}R.some(q=>q.element("pedal"))&&(W.readExpressionParameters(N,this.instrument,this.divisions,B,D,this.currentMeasure.MeasureNumber,!0),W.addPedalMarking(N,this.currentMeasure,B.clone())),W.readExpressionParameters(N,this.instrument,this.divisions,B,D,this.currentMeasure.MeasureNumber,!1),W.read(N,this.currentMeasure,B,D.clone())}}}else if(N.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(N)&&(this.currentMeasure.HasEndLine=!0);const R=N.attribute("location"),O=(R==null?void 0:R.value)??"right";if(ee===oe.length-1||O==="right"){const U=(X=N.element("bar-style"))==null?void 0:X.value;U&&(this.currentMeasure.endingBarStyleXml=U,this.currentMeasure.endingBarStyleEnum=I.SystemLinesEnumHelper.xmlBarlineStyleToSystemLinesEnum(U))}}else if(N.name==="sound")try{if(N.attribute("tempo")){const R=parseFloat(N.attribute("tempo").value);this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=R,this.musicSheet.HasBPMInfo=!0)}}catch(R){x.default.debug("InstrumentReader.readTempoInstruction",R)}else if(N.name==="harmony"){const R=this.getNoteStaff(N);this.currentStaff=this.instrument.Staves[R-1];const O=B.clone();this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(O,this.inSourceMeasureInstrumentIndex+R-1,this.currentStaff).staffEntry,this.currentStaffEntry.ChordContainers.push(d.ChordSymbolReader.readChordSymbol(N,this.musicSheet,this.activeKey))}}for(const ee in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(ee)&&this.voiceGeneratorsDict[ee].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let ee=0;ee<this.instrument.Staves.length;ee++)this.activeClefsHaveBeenInitialized[ee]||this.createDefaultClefInstruction(this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument)+ee);this.activeKeyHasBeenInitialized||this.createDefaultKeyInstruction();for(let ee=0;ee<this.expressionReaders.length;ee++){const N=this.expressionReaders[ee];N&&N.closeOpenExpressions(this.currentMeasure,B)}}this.musicSheet.HasBPMInfo?T.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120}catch(ie){if(_)throw new t.MusicSheetReadingException(ie.Message);const oe=h.ITextTranslation.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(oe),x.default.debug("InstrumentReader.readNextXmlMeasure",oe,ie)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}getStemDirectionAndColors(T){let A,v=E.StemDirectionType.Undefined;const B=T.element("stem");if(B){v=this.getStemDirectionType(B);const F=B.attribute("color");F&&(A=this.parseXmlColor(F.value))}let D=this.getNoteHeadColorXml(T);const _=this.getNoteColorXml(T);return _&&!D&&(D=_),_&&!A&&(A=_),[v,A,D]}parseXmlColor(T){return T}doCalculationsAfterDurationHasBeenSet(){for(const T in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(T)&&this.voiceGeneratorsDict[T].checkOpenTies()}getOrCreateVoiceGenerator(T,A){const v=this.instrument.Staves[A];let B=this.voiceGeneratorsDict[T];if(B)v.Voices.indexOf(B.GetVoice)===-1&&v.Voices.push(B.GetVoice);else{const D=this.staffMainVoiceGeneratorDict[A];D?(B=new s.VoiceGenerator(this.pluginManager,v,T,this.slurReader,D.GetVoice),v.Voices.push(B.GetVoice),this.voiceGeneratorsDict[T]=B):(B=new s.VoiceGenerator(this.pluginManager,v,T,this.slurReader),v.Voices.push(B.GetVoice),this.voiceGeneratorsDict[T]=B,this.staffMainVoiceGeneratorDict[A]=B)}return B}createExpressionGenerators(T){this.expressionReaders=new Array(T);for(let A=0;A<T;A++)this.expressionReaders[A]=new S.ExpressionReader(this.musicSheet,this.instrument,A+1)}createDefaultClefInstruction(T){let A;A=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;const v=new r.ClefInstruction(f.ClefEnum.G,0,2);let B;A.FirstInstructionsStaffEntries[T]?(B=A.FirstInstructionsStaffEntries[T],B.removeFirstInstructionOfTypeClefInstruction()):(B=new u.SourceStaffEntry(void 0,void 0),A.FirstInstructionsStaffEntries[T]=B),v.Parent=B,B.Instructions.splice(0,0,v)}createDefaultKeyInstruction(){let T;T=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;const A=new i.KeyInstruction(void 0,0,m.KeyEnum.major);for(let v=this.inSourceMeasureInstrumentIndex;v<this.inSourceMeasureInstrumentIndex+this.instrument.Staves.length;v++)if(T.FirstInstructionsStaffEntries[v]){const B=T.FirstInstructionsStaffEntries[v];A.Parent=B,B.removeFirstInstructionOfTypeKeyInstruction(),B.Instructions[0]instanceof r.ClefInstruction?B.Instructions.splice(1,0,A):B.Instructions.splice(0,0,A)}else{const B=new u.SourceStaffEntry(void 0,void 0);T.FirstInstructionsStaffEntries[v]=B,A.Parent=B,B.Instructions.push(A)}}isAttributesNodeAtBeginOfMeasure(T,A){const v=T.elements(),B=v.indexOf(A);if(B>0&&v[B-1].name==="backup")return!0;let D=-1;for(let _=0;_<v.length;_++)if(v[_].name==="note"){D=_;break}return B<D&&D>0||D<0}isAttributesNodeAtEndOfMeasure(T,A,v){var F;if(v.Equals((F=this.ActiveRhythm)==null?void 0:F.Rhythm))return!0;const B=T.elements().slice();let D=0;for(let k=0;k<B.length;k++)if(B[k]===A){D=k;break}let _=0;for(let k=D;k<B.length;k++)if(B[k].name==="note"){_=k;break}return D>_}getNoteDurationFromTypeNode(T){const A=T.element("type");if(A){const v=A.value;return L.NoteTypeHandler.getNoteDurationFromType(v)}return new n.Fraction(0,4*this.divisions)}addAbstractInstruction(T,A,v,B){if(T.element("divisions")&&T.elements().length===1)return;const D=T.element("transpose");if(D){const k=D.element("chromatic");k&&(this.instrument.PlaybackTranspose=parseInt(k.value,10))}const _=T.elements("clef");let F;if(_.length>0)for(let k=0,j=_.length;k<j;++k){const P=_[k];let G=f.ClefEnum.G,Y=2,X=1,ie=0;const oe=P.element("line");if(oe)try{Y=parseInt(oe.value,10)}catch(ee){F=h.ITextTranslation.translateText("ReaderErrorMessages/ClefLineError","Invalid clef line. Using default."),this.musicSheet.SheetErrors.pushMeasureError(F),Y=2,x.default.debug("InstrumentReader.addAbstractInstruction",F,ee)}const $=P.element("sign");if($)try{G=f.ClefEnum[$.value],r.ClefInstruction.isSupportedClef(G)||(F=h.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef. Using default."),this.musicSheet.SheetErrors.pushMeasureError(F),G=f.ClefEnum.G,Y=2),G===f.ClefEnum.TAB&&(ie=-1)}catch(ee){F=h.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef. Using default."),this.musicSheet.SheetErrors.pushMeasureError(F),G=f.ClefEnum.G,Y=2,x.default.debug("InstrumentReader.addAbstractInstruction",F,ee)}const Q=P.element("clef-octave-change");if(Q)try{ie=parseInt(Q.value,10)}catch{F=h.ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave. Using default."),this.musicSheet.SheetErrors.pushMeasureError(F),ie=0}if(P.hasAttributes&&P.attribute("number"))try{X=parseInt(P.attribute("number").value,10),X>this.currentClefNumber&&(X=this.currentClefNumber),this.currentClefNumber=X+1}catch{F=h.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef. Using default."),this.musicSheet.SheetErrors.pushMeasureError(F),X=1,this.currentClefNumber=X+1}const ne=new r.ClefInstruction(G,ie,Y);this.abstractInstructions.push([X,ne,B])}if(T.element("key")!==void 0&&this.instrument.MidiInstrumentId!==y.MidiInstrument.Percussion){let k=0;const j=T.element("key").element("fifths");if(j)try{k=parseInt(j.value,10)}catch(X){F=h.ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key. Set to default."),this.musicSheet.SheetErrors.pushMeasureError(F),k=0,x.default.debug("InstrumentReader.addAbstractInstruction",F,X)}let P=m.KeyEnum.none,G=T.element("key");if(G&&(G=G.element("mode")),G)try{P=m.KeyEnum[G.value]}catch(X){F=h.ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key/mode. Set to default."),this.musicSheet.SheetErrors.pushMeasureError(F),P=m.KeyEnum.major,x.default.debug("InstrumentReader.addAbstractInstruction",F,X)}const Y=new i.KeyInstruction(void 0,k,P);this.abstractInstructions.push([1,Y,B])}if(T.element("time")){const k=T.element("time");let j=p.RhythmSymbolEnum.NONE,P=!0;if(k!==void 0&&k.hasAttributes){const Q=k.attribute("symbol");Q&&(Q.value==="common"?j=p.RhythmSymbolEnum.COMMON:Q.value==="cut"&&(j=p.RhythmSymbolEnum.CUT));const ne=k.attribute("print-object");ne&&ne.value==="no"&&(P=!1)}let G=0,Y=0;const X=k&&k.element("senza-misura")!==void 0,ie=T.elements("time"),oe=[],$=[];for(let Q=0,ne=ie.length;Q<ne;++Q){const ee=ie[Q];oe.push(...ee.elements("beats")),$.push(...ee.elements("beat-type"))}if(X)this.abstractInstructions.push([1,new o.RhythmInstruction(new n.Fraction(4,4,0,!1),p.RhythmSymbolEnum.NONE),B]);else{try{if(oe!==void 0&&oe.length>0&&$!==void 0&&oe.length===$.length){const ne=oe.length,ee=new Array(ne);let N=0;for(let R=0;R<ne;R++){const O=oe[R].value;let U=0,H=0;if(O.indexOf("+")!==-1){const W=O.split("+");for(let K=0,q=W.length;K<q;++K)U+=parseInt(W[K],10)}else U=parseInt(O,10);H=parseInt($[R].value,10),N=Math.max(N,H),ee[R]=new n.Fraction(U,H,0,!1)}for(let R=0;R<ne;R++)ee[R].Denominator===N?G+=ee[R].Numerator:G+=N/ee[R].Denominator*ee[R].Numerator;Y=N}else G=parseInt(T.element("time").element("beats").value,10),Y=parseInt(T.element("time").element("beat-type").value,10)}catch(ne){F=h.ITextTranslation.translateText("ReaderErrorMessages/RhythmError","Invalid rhythm. Set to default."),this.musicSheet.SheetErrors.pushMeasureError(F),G=4,Y=4,x.default.debug("InstrumentReader.addAbstractInstruction",F,ne)}const Q=new o.RhythmInstruction(new n.Fraction(G,Y,0,!1),j);Q.PrintObject=P,this.abstractInstructions.push([1,Q,B])}}}saveAbstractInstructionList(T,A){for(let v=this.abstractInstructions.length-1;v>=0;v--){const B=this.abstractInstructions[v],D=B[0],_=B[1],F=B[2];if(_ instanceof r.ClefInstruction){const k=_;if(this.currentXmlMeasureIndex===0||D<=this.activeClefs.length&&k!==this.activeClefs[D-1])if(A||this.currentStaffEntry===void 0||this.currentStaffEntry.hasNotes()||D-1!==this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff))if(A){if(F.RealValue!==0)continue;let j;if(this.currentMeasure){const P=k,G=this.inSourceMeasureInstrumentIndex+D-1,Y=this.currentMeasure.FirstInstructionsStaffEntries[G];if(this.currentXmlMeasureIndex===0)if(Y)if(this.currentMeasure.FirstInstructionsStaffEntries[G]===void 0||Y.Instructions[0]instanceof r.ClefInstruction){const X=new u.SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[G]=X,P.Parent=X,X.Instructions.push(P)}else j=Y,P.Parent=j,j.removeFirstInstructionOfTypeClefInstruction(),j.Instructions.splice(0,0,P),this.activeClefsHaveBeenInitialized[D-1]=!0;else j=new u.SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[G]=j,P.Parent=j,j.Instructions.push(P),this.activeClefsHaveBeenInitialized[D-1]=!0;else if(this.activeClefsHaveBeenInitialized[D-1]){let X=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(X=this.currentMultirestStartMeasure);const ie=new u.SourceStaffEntry(void 0,void 0);X.LastInstructionsStaffEntries[G]=ie,P.Parent=ie,ie.Instructions.push(P)}else{const X=this.musicSheet.SourceMeasures[0];X.FirstInstructionsStaffEntries[G]?(j=X.FirstInstructionsStaffEntries[G],j.removeFirstInstructionOfTypeClefInstruction()):j=new u.SourceStaffEntry(void 0,void 0),P.Parent=j,j.Instructions.splice(0,0,P),this.activeClefsHaveBeenInitialized[D-1]=!0}this.activeClefs[D-1]=k,this.abstractInstructions.splice(v,1)}}else{let j;const P=this.activeRhythm.Rhythm;P.RealValue>0&&F.RealValue/P.RealValue>.9&&P.RealValue!==F.RealValue&&(this.currentMeasure.LastInstructionsStaffEntries[D-1]||(this.currentMeasure.LastInstructionsStaffEntries[D-1]=new u.SourceStaffEntry(void 0,this.instrument.Staves[D-1])),j=this.currentMeasure.LastInstructionsStaffEntries[D-1]),j&&(k.Parent=j,j.Instructions.push(k),this.activeClefs[D-1]=k,this.abstractInstructions.splice(v,1))}else{const j=k,P=this.currentStaffEntry;if(F&&Math.abs(F.RealValue-P.Timestamp.RealValue)>.01)continue;j.Parent=P,P.removeFirstInstructionOfTypeClefInstruction(),P.Instructions.push(j),this.activeClefs[D-1]=k,this.abstractInstructions.splice(v,1)}else D<=this.activeClefs.length&&k===this.activeClefs[D-1]&&this.abstractInstructions.splice(v,1)}if(_ instanceof i.KeyInstruction){const k=_;if(this.activeKey&&this.activeKey.Key===k.Key)this.abstractInstructions.splice(v,1);else{let j;if(this.activeKey=k,this.abstractInstructions.splice(v,1),this.activeKeyHasBeenInitialized?j=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,j=this.currentXmlMeasureIndex>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure),j)for(let P=this.inSourceMeasureInstrumentIndex;P<this.inSourceMeasureInstrumentIndex+T;P++){const G=k;if(j.FirstInstructionsStaffEntries[P]){const Y=j.FirstInstructionsStaffEntries[P];G.Parent=Y,Y.removeFirstInstructionOfTypeKeyInstruction(),Y.Instructions.length===0?Y.Instructions.push(G):Y.Instructions[0]instanceof r.ClefInstruction?Y.Instructions.splice(1,0,G):Y.Instructions.splice(0,0,G)}else{const Y=new u.SourceStaffEntry(void 0,void 0);j.FirstInstructionsStaffEntries[P]=Y,G.Parent=Y,Y.Instructions.push(G)}}}}if(_ instanceof o.RhythmInstruction){const k=_;if(this.activeRhythm&&this.activeRhythm===k)this.abstractInstructions.splice(v,1);else if(this.activeRhythm=k,this.abstractInstructions.splice(v,1),this.currentMeasure)for(let j=this.inSourceMeasureInstrumentIndex;j<this.inSourceMeasureInstrumentIndex+T;j++){const P=k;let G;this.currentMeasure.FirstInstructionsStaffEntries[j]?(G=this.currentMeasure.FirstInstructionsStaffEntries[j],G.removeFirstInstructionOfTypeRhythmInstruction()):(G=new u.SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[j]=G),P.Parent=G,G.Instructions.push(P)}}}}saveClefInstructionAtEndOfMeasure(){for(let T=this.abstractInstructions.length-1;T>=0;T--){const A=this.abstractInstructions[T][0],v=this.abstractInstructions[T][1];if(v instanceof r.ClefInstruction){const B=v;if(!this.activeClefs[A-1]||B.ClefType!==this.activeClefs[A-1].ClefType||B.ClefType===this.activeClefs[A-1].ClefType&&B.Line!==this.activeClefs[A-1].Line){const D=new u.SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+A-1]=D;const _=B;_.Parent=D,D.Instructions.push(_),this.activeClefs[A-1]=B,this.abstractInstructions.splice(T,1)}}}}getNoteDurationForTuplet(T){const A=T.element("duration"),v=Number.parseInt(A.value,10);return new n.Fraction(v,4*this.divisions)}readExpressionStaffNumber(T){let A=1;if(T.element("staff")){const v=T.element("staff");if(v)try{A=parseInt(v.value,10)}catch(B){const D=h.ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number. Set to default.");this.musicSheet.SheetErrors.pushMeasureError(D),A=1,x.default.debug("InstrumentReader.readExpressionStaffNumber",D,B)}}return A}readDivisionsFromNotes(){let T=0,A=this.currentXmlMeasureIndex,v=!1;for(;!v;){const B=this.xmlMeasureList[A].elements();for(let D=0,_=B.length;D<_;++D){const F=B[D];if(F.name==="note"&&!F.element("time-modification")){const k=F.element("duration"),j=F.element("type");if(k!==void 0&&j){const P=j.value;let G=0;try{G=parseInt(k.value,10)}catch(Y){x.default.debug("InstrumentReader.readDivisionsFromNotes",Y);continue}switch(P){case"1024th":T=G/4*1024;break;case"512th":T=G/4*512;break;case"256th":T=G/4*256;break;case"128th":T=G/4*128;break;case"64th":T=G/4*64;break;case"32nd":T=G/4*32;break;case"16th":T=G/4*16;break;case"eighth":T=G/4*8;break;case"quarter":T=G/4*4;break;case"half":T=G/4*2;break;case"whole":T=G/4;break;case"breve":T=G/4/2;break;case"long":T=G/4/4;break;case"maxima":T=G/4/8}}}if(T>0){v=!0;break}}if(T===0&&(A++,A===this.xmlMeasureList.length)){const D=h.ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new t.MusicSheetReadingException(D+this.instrument.Name)}}return T}getCueNoteAndNoteTypeXml(T){let A=!1;T.element("cue")&&(A=!0);const v=T.element("type");let B=L.NoteType.UNDEFINED;if(v){const D=v.attribute("size");(D==null?void 0:D.value)==="cue"&&(A=!0),B=L.NoteTypeHandler.StringToNoteType(v.value)}return[A,B]}getStemDirectionType(T){switch(T.value){case"down":return E.StemDirectionType.Down;case"up":return E.StemDirectionType.Up;case"double":return E.StemDirectionType.Double;case"none":return E.StemDirectionType.None;default:return E.StemDirectionType.Undefined}}getNoteHeadColorXml(T){const A=T.element("notehead");if(A){const v=A.attribute("color");if(v)return this.parseXmlColor(v.value)}return null}getNoteColorXml(T){const A=T.attribute("color");return A?this.parseXmlColor(A.value):null}getTremoloInfo(T){let A,v;const B=T.element("tremolo");if(B){const D=B.attribute("type");if(D){if(D.value==="single"){const _=parseInt(B.value,10);_>0&&(A=_)}else A=0;D.value==="unmeasured"&&(v=!0)}}return{tremoloStrokes:A,tremoloUnmeasured:v}}getWavyLines(T,A,v,B){const D=T.elements("wavy-line");if(D)for(const _ of D){const F=this.expressionReaders[this.readExpressionStaffNumber(A)-1];F&&(F.readExpressionParameters(_,this.instrument,this.divisions,v,B,this.currentMeasure.MeasureNumber,!1),F.addWavyLine(_,this.currentMeasure,v,B))}}getNoteStaff(T){let A=1;return this.instrument.Staves.length>1&&T.element("staff")&&(A=parseInt(T.element("staff").value,10),isNaN(A)&&(x.default.debug("InstrumentReader.readNextXmlMeasure.get staff number"),A=1)),A}}},9099(de,g,c){var l=this&&this.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSheetReader=void 0;const s=c(427),u=c(4387),r=c(2561),i=c(1272),o=c(9252),n=c(9767),h=c(7307),t=l(c(3065)),f=c(9288),p=c(9288),m=c(2369),x=c(7586),y=c(5294),d=c(164),S=c(7435),M=c(5749),E=c(9713),L=c(7503),I=c(7533);g.MusicSheetReader=class{constructor(T=void 0,A=new E.EngravingRules){this.completeNumberOfStaves=0,this.pluginManager=new L.ReaderPluginManager,this.afterSheetReadingModules=T||[],this.repetitionInstructionReader=M.MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=M.MusicSymbolModuleFactory.createRepetitionCalculator(),this.rules=A}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(T){for(const A of T)A.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(T,A){try{return this._createMusicSheet(T,A)}catch(v){return void t.default.error("MusicSheetReader.CreateMusicSheet",v)}}_removeFromArray(T,A){const v=T.indexOf(A);v!==-1&&T.splice(v,1)}trimString(T){return T.replace(/^\s+|\s+$/g,"")}_lastElement(T){return T[T.length-1]}_createMusicSheet(T,A){const v=[];let B=0;this.musicSheet=new s.MusicSheet,this.musicSheet.Path=A,this.musicSheet.Rules=this.rules;const D=T.attribute("osmdMeasureWidthFactor");if(D){const Y=Number.parseFloat(D.value);typeof Y!="number"||isNaN(Y)?t.default.info("xml parse: osmdMeasureWidthFactor invalid"):this.musicSheet.MeasureWidthFactor=Y}if(!T)throw new h.MusicSheetReadingException("Undefined root element");this.pushSheetLabels(T,A);const _=T.element("part-list");if(!_)throw new h.MusicSheetReadingException("Undefined partListNode");const F=T.elements("part"),k=_.elements();this.initializeReading(k,F,v);let j=!0;this.currentFraction=new r.Fraction(0,1);let P=!1,G=T.element("identification");for(G&&(G=G.element("encoding")),G&&(G=G.element("software")),G!==void 0&&G.value==="Guitar Pro 5"&&(P=!0);j;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(B=0),this.currentMeasure=new u.SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const Y of v)try{j=j&&Y.readNextXmlMeasure(this.currentMeasure,this.currentFraction,P)}catch(X){const ie=n.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new h.MusicSheetReadingException(ie,X)}j&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(v),this.checkSourceMeasureForNullEntries(),B=this.setSourceMeasureDuration(v,B),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 Y=0,X=this.afterSheetReadingModules.length;Y<X;++Y)this.afterSheetReadingModules[Y].calculate(this.musicSheet);return this.musicSheet.userStartTempoInBPM=this.musicSheet.userStartTempoInBPM||this.musicSheet.DefaultStartTempoInBpm,this.musicSheet}initializeReading(T,A,v){const B=this.createInstrumentGroups(T);this.completeNumberOfStaves=this.getCompleteNumberOfStavesFromXml(A),A.length!==0&&(this.repetitionInstructionReader.MusicSheet=this.musicSheet,this.currentFraction=new r.Fraction(0,1),this.currentMeasure=void 0,this.previousMeasure=void 0);let D=0;for(const _ of A){const F=_.attribute("id");if(F){const k=B[F.value],j=_.elements("measure");let P=1;try{P=this.getInstrumentNumberOfStavesFromXml(_)}catch{const Y=n.ITextTranslation.translateText("ReaderErrorMessages/InstrumentStavesNumberError","Invalid number of staves at instrument: ");this.musicSheet.SheetErrors.push(Y+k.Name);continue}k.createStaves(P),v.push(new i.InstrumentReader(this.pluginManager,this.repetitionInstructionReader,j,k)),this.repetitionInstructionReader&&(this.repetitionInstructionReader.xmlMeasureList[D]=j),D++}}}checkIfRhythmInstructionsAreSetAndEqual(T){const A=[];for(let D=0;D<this.completeNumberOfStaves;D++)if(this.currentMeasure.FirstInstructionsStaffEntries[D]){const _=this.currentMeasure.FirstInstructionsStaffEntries[D].Instructions[this.currentMeasure.FirstInstructionsStaffEntries[D].Instructions.length-1];_ instanceof f.RhythmInstruction&&A.push(_)}let v=0,B=-1;for(let D=0,_=A.length;D<_;++D){const F=A[D];if(F.Rhythm.RealValue>v){if(this.areRhythmInstructionsMixed(A)&&F.SymbolEnum!==p.RhythmSymbolEnum.NONE)continue;v=F.Rhythm.RealValue,B=A.indexOf(F)}}if(A.length>0&&A.length<this.completeNumberOfStaves){const D=A[B].clone();for(let _=0;_<this.completeNumberOfStaves;_++)this.currentMeasure.FirstInstructionsStaffEntries[_]===void 0||this._lastElement(this.currentMeasure.FirstInstructionsStaffEntries[_].Instructions)instanceof f.RhythmInstruction||(this.currentMeasure.FirstInstructionsStaffEntries[_].removeAllInstructionsOfTypeRhythmInstruction(),this.currentMeasure.FirstInstructionsStaffEntries[_].Instructions.push(D.clone())),this.currentMeasure.FirstInstructionsStaffEntries[_]||(this.currentMeasure.FirstInstructionsStaffEntries[_]=new m.SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[_].Instructions.push(D.clone()));for(let _=0,F=T.length;_<F;++_)T[_].ActiveRhythm=D}if(A.length===0&&this.currentMeasure===this.musicSheet.SourceMeasures[0]){const D=new f.RhythmInstruction(new r.Fraction(4,4,0,!1),p.RhythmSymbolEnum.NONE);for(let _=0;_<this.completeNumberOfStaves;_++)this.currentMeasure.FirstInstructionsStaffEntries[_]?this.currentMeasure.FirstInstructionsStaffEntries[_].removeAllInstructionsOfTypeRhythmInstruction():this.currentMeasure.FirstInstructionsStaffEntries[_]=new m.SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[_].Instructions.push(D);for(let _=0,F=T.length;_<F;++_)T[_].ActiveRhythm=D}for(let D=0,_=A.length;D<_;++D){const F=A[D];if(F.Rhythm.RealValue<v&&this._lastElement(this.currentMeasure.FirstInstructionsStaffEntries[A.indexOf(F)].Instructions)instanceof f.RhythmInstruction){const k=this.currentMeasure.FirstInstructionsStaffEntries[A.indexOf(F)].Instructions;k[k.length-1]=A[B].clone()}Math.abs(F.Rhythm.RealValue-v)<1e-6&&F.SymbolEnum!==p.RhythmSymbolEnum.NONE&&this.areRhythmInstructionsMixed(A)&&(F.SymbolEnum=p.RhythmSymbolEnum.NONE)}}areRhythmInstructionsMixed(T){for(let A=1;A<T.length;A++)if(Math.abs(T[A].Rhythm.RealValue-T[0].Rhythm.RealValue)<1e-6&&T[A].SymbolEnum!==T[0].SymbolEnum)return!0;return!1}setSourceMeasureDuration(T,A){let v=new r.Fraction(0,1);const B=[];for(const F of T){B.push(F.MaxTieNoteFraction);const k=F.ActiveRhythm.Rhythm;v.lt(k)&&(v=new r.Fraction(k.Numerator,k.Denominator,0,!1))}const D=this.currentMeasure.calculateInstrumentsDuration(this.musicSheet,B);let _=new r.Fraction(0,1);for(const F of D)_.lt(F)&&(_=F);r.Fraction.Equal(_,v)?this.checkFractionsForEquivalence(_,v):_.lt(v)&&(_=this.currentMeasure.reverseCheck(this.musicSheet,_),this.checkFractionsForEquivalence(_,v)),this.currentMeasure.ImplicitMeasure=this.checkIfMeasureIsImplicit(_,v),(!this.currentMeasure.ImplicitMeasure||A>0)&&A++,this.currentMeasure.Duration=_,this.currentMeasure.ActiveTimeSignature=v,this.currentMeasure.MeasureNumber=A;for(let F=0;F<D.length;F++){const k=D[F];if(this.currentMeasure.ImplicitMeasure&&k!==_||!r.Fraction.Equal(k,v)&&!this.allInstrumentsHaveSameDuration(D,_)){const j=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.musicSheet.Instruments[F]);for(let P=0;P<this.musicSheet.Instruments[F].Staves.length;P++)if(!this.graphicalMeasureIsEmpty(j+P)){this.currentMeasure.setErrorInGraphicalMeasure(j+P,!0);const G=n.ITextTranslation.translateText("ReaderErrorMessages/MissingNotesError","Given Notes don't correspond to measure duration.");this.musicSheet.SheetErrors.pushMeasureError(G)}}}return A}checkFractionsForEquivalence(T,A){if(A.Denominator>T.Denominator){const v=A.Denominator/T.Denominator;T.expand(v)}}checkIfMeasureIsImplicit(T,A){return!(this.previousMeasure||!T.lt(A))||!!this.previousMeasure&&r.Fraction.plus(this.previousMeasure.Duration,T).Equals(A)}allInstrumentsHaveSameDuration(T,A){let v=0;for(let B=0,D=T.length;B<D;++B)T[B].Equals(A)&&v++;return v===T.length&&A!==new r.Fraction(0,1)}graphicalMeasureIsEmpty(T){let A=0;for(let v=0;v<this.currentMeasure.VerticalSourceStaffEntryContainers.length;v++)this.currentMeasure.VerticalSourceStaffEntryContainers[v].StaffEntries[T]||A++;return A===this.currentMeasure.VerticalSourceStaffEntryContainers.length}checkSourceMeasureForNullEntries(){for(let T=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;T>=0;T--)for(let A=this.currentMeasure.VerticalSourceStaffEntryContainers[T].StaffEntries.length-1;A>=0;A--){const v=this.currentMeasure.VerticalSourceStaffEntryContainers[T].StaffEntries[A];if(v)for(let B=v.VoiceEntries.length-1;B>=0;B--){const D=v.VoiceEntries[B];D.Notes.length===0&&(this._removeFromArray(D.ParentVoice.VoiceEntries,D),this._removeFromArray(v.VoiceEntries,D))}v!==void 0&&v.VoiceEntries.length===0&&v.ChordContainers.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[T].StaffEntries[A]=void 0)}for(let T=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;T>=0;T--){let A=0;for(let v=0,B=this.currentMeasure.VerticalSourceStaffEntryContainers[T].StaffEntries.length;v<B;++v)this.currentMeasure.VerticalSourceStaffEntryContainers[T].StaffEntries[v]||A++;A===this.currentMeasure.VerticalSourceStaffEntryContainers[T].StaffEntries.length&&this._removeFromArray(this.currentMeasure.VerticalSourceStaffEntryContainers,this.currentMeasure.VerticalSourceStaffEntryContainers[T])}}pushSheetLabels(T,A){this.readComposer(T),this.readTitle(T),this.readCopyright(T);try{this.musicSheet.Title&&this.musicSheet.Composer&&this.musicSheet.Subtitle||this.readTitleAndComposerFromCredits(T)}catch(v){t.default.info("MusicSheetReader.pushSheetLabels","readTitleAndComposerFromCredits",v)}try{if(!this.musicSheet.Title){const v=Math.max(0,A.lastIndexOf("/"),A.lastIndexOf("\\")),B=A.substr(v).split(".",1);this.musicSheet.Title=new S.Label(B[0])}}catch(v){t.default.info("MusicSheetReader.pushSheetLabels","read title from file name",v)}}presentAttrsWithValue(T,A){for(const v of T.attributes())if(v.value===A)return!0;return!1}readComposer(T){const A=T.element("identification");if(A){const v=A.elements("creator");for(let B=0,D=v.length;B<D;++B){const _=v[B];if(_.hasAttributes){if(this.presentAttrsWithValue(_,"composer")){this.musicSheet.Composer=new S.Label(this.trimString(_.value));continue}(this.presentAttrsWithValue(_,"lyricist")||this.presentAttrsWithValue(_,"poet"))&&(this.musicSheet.Lyricist=new S.Label(this.trimString(_.value)))}}}}readCopyright(T){const A=T.elements("identification");if(A.length>0){const v=A[0].elements("rights");if(v.length>0)for(let B=0,D=v.length;B<D;++B){const _=v[B];if(_.value){this.musicSheet.Copyright=new S.Label(_.value,I.TextAlignmentEnum.CenterBottom,void 0,!0);break}}}}readTitleAndComposerFromCredits(T){var F,k,j;if(this.rules.SheetComposerSubtitleUseLegacyParsing)return void this.readTitleAndComposerFromCreditsLegacy(T);const A=this.computeSystemYCoordinates(T);if(A===0)return;let v,B,D;const _=T.elements("credit");for(let P=0,G=_.length;P<G;++P){const Y=_[P];if(!Y.attribute("page"))return;if(Y.attribute("page").value==="1"){let X;if(Y){let ie=!1,oe=!1;const $=Y.element("credit-type");($==null?void 0:$.value)==="subtitle"?ie=!0:($==null?void 0:$.value)==="composer"&&(oe=!0);let Q=ie||oe;X=Y.elements("credit-words");for(const ne of X){const ee=(F=ne.value)==null?void 0:F.trim();if(ee==="Copyright ©")continue;const N=(k=ne.attribute("justify"))==null?void 0:k.value;N==="right"?(oe=!0,Q=!0):N==="center"&&v&&(ie=!0,Q=!0);const R=(j=ne.attribute("default-y"))==null?void 0:j.value,O=R!=null,U=O?parseFloat(R):Number.MIN_VALUE;if(O&&U>A||Q)if(v||Q){if(oe||N==="right")D?D+=`
|
|
`+ee:D=ee;else if(ie||N!=="right"&&N!=="left")B?B+=`
|
|
`+ee:B=ee;else if(N==="left"){this.musicSheet.Lyricist||(this.musicSheet.Lyricist=new S.Label(ee));break}}else v=ee}}}}if(!this.musicSheet.Title&&v&&(this.musicSheet.Title=new S.Label(this.trimString(v))),!this.musicSheet.Subtitle&&B&&(this.musicSheet.Subtitle=new S.Label(this.trimString(B))),D){let P=!1;this.musicSheet.Composer?(D.match(`
|
|
`)??[]).length+1>=(this.musicSheet.Composer.text.match(`
|
|
`)??[]).length+1&&(P=!0):P=!0,P&&(this.musicSheet.Composer=new S.Label(this.trimString(D)))}}readTitleAndComposerFromCreditsLegacy(T){var j,P,G;const A=this.computeSystemYCoordinates(T);if(A===0)return;let v,B,D,_=1,F=0;const k=T.elements("credit");for(let Y=0,X=k.length;Y<X;++Y){const ie=k[Y];if(!ie.attribute("page"))return;if(ie.attribute("page").value==="1"){let oe;if(ie){if(oe=ie.element("credit-words"),!oe.attribute("justify"))break;const $=(j=oe.attribute("justify"))==null?void 0:j.value,Q=(P=oe.attribute("default-y"))==null?void 0:P.value,ne=Q!=null,ee=ne?parseFloat(Q):Number.MIN_VALUE;let N=!1;const R=ie.element("credit-type");if((R==null?void 0:R.value)==="subtitle"&&(N=!0),ne&&ee>A||N){if(!this.musicSheet.Title&&!N){const O=(G=oe.attribute("font-size"))==null?void 0:G.value;if(O){const U=parseFloat(O);_<U&&(_=U,v=oe.value)}}switch(this.musicSheet.Subtitle||($!=="right"&&$!=="left"||N)&&(F<ee?(F=ee,D&&(B=D),D=oe.value):B?B+=`
|
|
`+oe.value:B=oe.value),$){case"right":this.musicSheet.Composer||(this.musicSheet.Composer=new S.Label(this.trimString(oe.value)));break;case"left":this.musicSheet.Lyricist||(this.musicSheet.Lyricist=new S.Label(this.trimString(oe.value)))}}}}}!this.musicSheet.Title&&v&&(this.musicSheet.Title=new S.Label(this.trimString(v))),!this.musicSheet.Subtitle&&B&&(this.musicSheet.Subtitle=new S.Label(this.trimString(B)))}computeSystemYCoordinates(T){var _,F;if(!T.element("defaults"))return 0;let A=0,v=0;try{const k=((F=(_=T.element("defaults"))==null?void 0:_.element("page-layout"))==null?void 0:F.element("page-height").value)??"0";A=parseFloat(k)}catch{return t.default.info("MusicSheetReader.computeSystemYCoordinates(): couldn't find page height, not reading title/composer."),0}let B=!1;const D=T.elements("part");for(let k=0,j=D.length;k<j;++k){const P=D[k].elements("measure");for(let G=0,Y=P.length;G<Y;++G){const X=P[G];if(X.element("print")){const ie=X.element("print").elements("system-layout");for(let oe=0,$=ie.length;oe<$;++oe){const Q=ie[oe];if(Q.element("top-system-distance")){const ne=Q.element("top-system-distance").value;v=parseFloat(ne),B=!0;break}}break}}if(B)break}if(T.element("defaults").element("system-layout")&&T.element("defaults").element("system-layout").element("top-system-distance")){const k=T.element("defaults").element("system-layout").element("top-system-distance").value;v=parseFloat(k)}return v===0?0:A-v}readTitle(T){const A=T.element("work");let v;A&&(v=A.element("work-title"),v&&v.value&&(this.musicSheet.Title=new S.Label(this.trimString(v.value))));const B=T.element("movement-title");let D="";if(B&&(this.musicSheet.Title?D=this.trimString(B.value):this.musicSheet.Title=new S.Label(this.trimString(B.value))),A){const _=A.element("work-number");if(_){const F=_.value;F&&(D=D===""?F:D+", "+F)}}D&&(this.musicSheet.Subtitle=new S.Label(D))}createInstrumentGroups(T){let A=0;const v={};let B;try{const D=T;for(let _=0,F=D.length;_<F;++_){const k=D[_];if(k.name==="score-part"){const j=k.attribute("id").value,P=new o.Instrument(A,j,this.musicSheet,B);A++;const G=k.elements();for(let Y=0,X=G.length;Y<X;++Y){const ie=G[Y];try{if(ie.name==="part-name")P.Name=ie.value,ie.attribute("print-object")&&ie.attribute("print-object").value==="no"&&(P.NameLabel.print=!1);else if(ie.name==="part-abbreviation")P.PartAbbreviation=ie.value;else if(ie.name==="score-instrument"){const oe=new y.SubInstrument(P);oe.idString=ie.firstAttribute.value,P.SubInstruments.push(oe);const $=ie.element("instrument-name");$&&(oe.name=$.value,oe.setMidiInstrument($.value))}else if(ie.name==="midi-instrument"){let oe=P.getSubInstrument(ie.firstAttribute.value);for(let Q=0,ne=P.SubInstruments.length;Q<ne;++Q){const ee=P.SubInstruments[Q];if(ee.idString===ie.value){oe=ee;break}}const $=ie.elements();for(let Q=0,ne=$.length;Q<ne;++Q){const ee=$[Q];try{if(ee.name==="midi-channel")parseInt(ee.value,10)===10&&(P.MidiInstrumentId=d.MidiInstrument.Percussion);else if(ee.name==="midi-program")P.SubInstruments.length>0&&P.MidiInstrumentId!==d.MidiInstrument.Percussion&&(oe.midiInstrumentID=Math.max(0,parseInt(ee.value,10)-1));else if(ee.name==="midi-unpitched")oe.fixedKey=Math.max(0,parseInt(ee.value,10));else if(ee.name==="volume")try{const N=parseFloat(ee.value);oe.volume=N/127}catch(N){t.default.debug("ExpressionReader.readExpressionParameters","read volume",N)}else if(ee.name==="pan")try{const N=parseFloat(ee.value);oe.pan=N/64}catch(N){t.default.debug("ExpressionReader.readExpressionParameters","read pan",N)}}catch(N){t.default.info("MusicSheetReader.createInstrumentGroups midi settings: ",N)}}}}catch(oe){t.default.info("MusicSheetReader.createInstrumentGroups: ",oe)}}if(P.SubInstruments.length===0){const Y=new y.SubInstrument(P);P.SubInstruments.push(Y)}v[j]=P,B?(B.InstrumentalGroups.push(P),this.musicSheet.Instruments.push(P)):(this.musicSheet.InstrumentalGroups.push(P),this.musicSheet.Instruments.push(P))}else if(k.name==="part-group"&&k.attribute("type").value==="start"){const j=new x.InstrumentalGroup("group",this.musicSheet,B);B?B.InstrumentalGroups.push(j):this.musicSheet.InstrumentalGroups.push(j),B=j}else if(k.name==="part-group"&&k.attribute("type").value==="stop"&&B){if(B.InstrumentalGroups.length===1){const j=B.InstrumentalGroups[0];B.Parent?(B.Parent.InstrumentalGroups.push(j),this._removeFromArray(B.Parent.InstrumentalGroups,B)):(this.musicSheet.InstrumentalGroups.push(j),this._removeFromArray(this.musicSheet.InstrumentalGroups,B))}B=B.Parent}}}catch(D){const _=n.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new h.MusicSheetReadingException(_,D)}for(let D=0,_=this.musicSheet.Instruments.length;D<_;++D){const F=this.musicSheet.Instruments[D];F.Name||(F.Name="Instr. "+F.IdString)}return v}getCompleteNumberOfStavesFromXml(T){let A=0;for(const v of T){const B=v.elements("measure");if(B.length>0){const D=B[0];if(D){let _=D.element("attributes");_&&(_=_.element("staves")),_?A+=parseInt(_.value,10):A++}}}if(isNaN(A)||A<=0){const v=n.ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new h.MusicSheetReadingException(v)}return A}getInstrumentNumberOfStavesFromXml(T){let A=0;const v=T.element("measure");if(v){const B=v.element("attributes");let D;B&&(D=B.element("staves")),A=B&&D?parseInt(D.value,10):1}if(isNaN(A)||A<=0){const B=n.ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new h.MusicSheetReadingException(B)}return A}}},5749(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MusicSymbolModuleFactory=void 0;const l=c(7631),s=c(6302);g.MusicSymbolModuleFactory=class{static createRepetitionInstructionReader(){return new l.RepetitionInstructionReader}static createRepetitionCalculator(){return new s.RepetitionCalculator}}},4127(de,g,c){var l=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(g,"__esModule",{value:!0}),g.ArticulationReader=void 0;const s=c(1336),u=l(c(3065)),r=c(3123),i=c(8215),o=c(6362),n=c(8233),h=c(9003),t=c(9019),f=c(8045);g.ArticulationReader=class{constructor(p){this.rules=p}getAccEnumFromString(p){switch(p){case"sharp":return n.AccidentalEnum.SHARP;case"flat":return n.AccidentalEnum.FLAT;case"natural":return n.AccidentalEnum.NATURAL;case"double-sharp":case"sharp-sharp":return n.AccidentalEnum.DOUBLESHARP;case"double-flat":case"flat-flat":return n.AccidentalEnum.DOUBLEFLAT;case"triple-sharp":return n.AccidentalEnum.TRIPLESHARP;case"triple-flat":return n.AccidentalEnum.TRIPLEFLAT;case"quarter-sharp":return n.AccidentalEnum.QUARTERTONESHARP;case"quarter-flat":return n.AccidentalEnum.QUARTERTONEFLAT;case"three-quarters-sharp":return n.AccidentalEnum.THREEQUARTERSSHARP;case"three-quarters-flat":return n.AccidentalEnum.THREEQUARTERSFLAT;case"slash-quarter-sharp":return n.AccidentalEnum.SLASHQUARTERSHARP;case"slash-sharp":return n.AccidentalEnum.SLASHSHARP;case"double-slash-flat":return n.AccidentalEnum.DOUBLESLASHFLAT;case"sori":return n.AccidentalEnum.SORI;case"koron":return n.AccidentalEnum.KORON;default:return n.AccidentalEnum.NONE}}addArticulationExpression(p,m){var x,y;if(p!==void 0&&p.elements().length>0){const d=p.elements();for(let S=0,M=d.length;S<M;++S){const E=d[S];let L=E.name;try{L=L.replace("-","");const I=s.ArticulationEnum[L];if(s.VoiceEntry.isSupportedArticulation(I)){let T=o.PlacementEnum.NotYetDefined;const A=(x=E.attribute("placement"))==null?void 0:x.value;A==="above"?T=o.PlacementEnum.Above:A==="below"&&(T=o.PlacementEnum.Below);const v=new h.Articulation(I,T);if(L==="staccato")m.Articulations.length>0&&m.Articulations[0].articulationEnum!==s.ArticulationEnum.staccato&&m.Articulations.splice(0,0,v);else if(L==="breathmark")T===o.PlacementEnum.NotYetDefined&&(v.placement=o.PlacementEnum.Above);else if(L==="strongaccent"){const B=(y=E==null?void 0:E.attribute("type"))==null?void 0:y.value;B==="up"?v.articulationEnum=s.ArticulationEnum.marcatoup:B==="down"&&(v.articulationEnum=s.ArticulationEnum.marcatodown)}else if(I===s.ArticulationEnum.softaccent){const B=m.ParentSourceStaffEntry.ParentStaff.Id-1;T===o.PlacementEnum.NotYetDefined&&(T=o.PlacementEnum.Above,B>0&&(T=o.PlacementEnum.Below));const D=m.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure,_=new t.MultiExpression(D,m.Timestamp);_.StartingContinuousDynamic=new f.ContinuousDynamicExpression(f.ContDynamicEnum.crescendo,T,B,D,-1),_.StartingContinuousDynamic.IsStartOfSoftAccent=!0,_.StartingContinuousDynamic.StartMultiExpression=_,_.StartingContinuousDynamic.EndMultiExpression=_,_.EndingContinuousDynamic=new f.ContinuousDynamicExpression(f.ContDynamicEnum.diminuendo,T,B,D,-1),_.EndingContinuousDynamic.StartMultiExpression=_,_.EndingContinuousDynamic.EndMultiExpression=_,D.StaffLinkedExpressions[B].push(_)}m.hasArticulation(v)||m.Articulations.push(v)}}catch(I){return void u.default.debug("addArticulationExpression","Invalid note articulation.",I)}}}}addFermata(p,m){var d;let x=s.ArticulationEnum.fermata;p.attributes().length>0&&p.attribute("type")&&p.attribute("type").value==="inverted"&&(x=s.ArticulationEnum.invertedfermata);let y=o.PlacementEnum.Above;((d=p.attribute("placement"))==null?void 0:d.value)==="below"&&(y=o.PlacementEnum.Below),m.Articulations.push(new h.Articulation(x,y))}addTechnicalArticulations(p,m,x){var M,E;const y={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,harmonic:s.ArticulationEnum.naturalharmonic};for(const L in y){if(!y.hasOwnProperty(L))continue;const I=y[L],T=p.element(L);if(T){let A;((M=T.attribute("placement"))==null?void 0:M.value)==="above"&&(A=o.PlacementEnum.Above),((E=T.attribute("placement"))==null?void 0:E.value)==="below"&&(A=o.PlacementEnum.Below);const v=new h.Articulation(I,A);m.hasArticulation(v)||m.Articulations.push(v)}}const d=p.elements("fingering");for(const L of d){const I=this.createTechnicalInstruction(L,x);I.type=r.TechnicalInstructionType.Fingering,x.Fingering||(x.Fingering=I),m.TechnicalInstructions.push(I)}const S=p.element("string");if(S){const L=this.createTechnicalInstruction(S,x);L.type=r.TechnicalInstructionType.String,x.StringInstruction=L,m.TechnicalInstructions.push(L)}}createTechnicalInstruction(p,m){const x=new r.TechnicalInstruction;x.sourceNote=m,x.value=p.value;const y=p.attribute("placement");return this.rules.FingeringPositionFromXML&&(x.placement=this.getPlacement(y)),x}getPlacement(p,m=o.PlacementEnum.NotYetDefined){if(m!==o.PlacementEnum.NotYetDefined)return m;if(!p)return o.PlacementEnum.NotYetDefined;switch(p.value){case"above":return o.PlacementEnum.Above;case"below":return o.PlacementEnum.Below;case"left":return o.PlacementEnum.Left;case"right":return o.PlacementEnum.Right;default:return o.PlacementEnum.NotYetDefined}}addOrnament(p,m){if(p){let x;const y={"delayed-inverted-turn":i.OrnamentEnum.DelayedInvertedTurn,"delayed-turn":i.OrnamentEnum.DelayedTurn,"inverted-mordent":i.OrnamentEnum.InvertedMordent,"inverted-turn":i.OrnamentEnum.InvertedTurn,mordent:i.OrnamentEnum.Mordent,"trill-mark":i.OrnamentEnum.Trill,turn:i.OrnamentEnum.Turn};for(const d in y){if(!y.hasOwnProperty(d))continue;const S=p.element(d);if(S){x=new i.OrnamentContainer(y[d]);const M=S.attribute("placement");M&&M.value==="below"&&(x.placement=o.PlacementEnum.Below)}}if(x){const d=p.elements("accidental-mark");if(d){let S=o.PlacementEnum.Below,M=n.AccidentalEnum.NONE;const E=d;for(let L=0,I=E.length;L<I;++L){const T=E[L];let A=T.value;M=this.getAccEnumFromString(A);const v=T.attribute("placement");T.hasAttributes&&v&&(A=v.value,A==="above"?S=o.PlacementEnum.Above:A==="below"&&(S=o.PlacementEnum.Below)),S===o.PlacementEnum.Above?x.AccidentalAbove=M:S===o.PlacementEnum.Below&&(x.AccidentalBelow=M)}}m.OrnamentContainer=x}}}}},9536(de,g,c){var l=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(g,"__esModule",{value:!0}),g.ChordSymbolReader=void 0;const s=c(9719),u=c(8233),r=c(9767),i=l(c(3065)),o=c(6362);class n{static readChordSymbol(t,f,p){var k;const m=t.element("root"),x=t.element("kind"),y=t.element("numeral"),d=x.attribute("text");if(!m&&!y)return;let S;const M=t.element("bass");if(M){const j=M.element("bass-step"),P=M.element("bass-alter");let G=u.NoteEnum.C;if(j)try{G=u.NoteEnum[j.value.trim()]}catch(X){const ie=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");return f.SheetErrors.pushMeasureError(ie),void i.default.debug("InstrumentReader.readChordSymbol",ie,X)}let Y=u.AccidentalEnum.NONE;if(P)try{Y=u.Pitch.AccidentalFromHalfTones(parseInt(P.value,10))}catch(X){const ie=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");f.SheetErrors.pushMeasureError(ie),i.default.debug("InstrumentReader.readChordSymbol",ie,X)}S=new u.Pitch(G,1,Y)}const E=[],L=t.elements("degree");for(const j of L)if(j){const P=j.element("degree-value"),G=j.element("degree-alter"),Y=j.element("degree-type");if(!P||!G||!Y)return;let X,ie,oe;try{X=parseInt(P.value.trim(),10)}catch($){const Q=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");return f.SheetErrors.pushMeasureError(Q),void i.default.debug("InstrumentReader.readChordSymbol",Q,$)}try{ie=u.Pitch.AccidentalFromHalfTones(parseInt(G.value,10))}catch($){const Q=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");return f.SheetErrors.pushMeasureError(Q),void i.default.debug("InstrumentReader.readChordSymbol",Q,$)}try{oe=s.ChordDegreeText[Y.value.trim().toLowerCase()]}catch($){const Q=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");return f.SheetErrors.pushMeasureError(Q),void i.default.debug("InstrumentReader.readChordSymbol",Q,$)}E.push(new s.Degree(X,ie,oe))}let I=n.readPlacement(t);if(I!==o.PlacementEnum.Below&&(I=o.PlacementEnum.Above),y){const j=y.element("numeral-root"),P=(k=j==null?void 0:j.attribute("text"))==null?void 0:k.value,G=P??(j==null?void 0:j.value),Y=new s.ChordSymbolContainer(void 0,s.ChordSymbolEnum.none,S,E,f.Rules,I);return Y.NumeralText=G,Y}const T=m.element("root-step"),A=m.element("root-alter");if(m&&!T)return;let v;try{v=u.NoteEnum[T.value.trim()]}catch(j){const P=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");return f.SheetErrors.pushMeasureError(P),void i.default.debug("InstrumentReader.readChordSymbol",P,j)}let B=u.AccidentalEnum.NONE;if(A)try{B=u.Pitch.AccidentalFromHalfTones(parseInt(A.value,10))}catch(j){const P=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");f.SheetErrors.pushMeasureError(P),i.default.debug("InstrumentReader.readChordSymbol",P,j)}const D=new u.Pitch(v,1,B);let _,F=x.value.trim().replace("-","");if(d)switch(d.value){case"aug":F="augmented";break;case"dim":F="diminished"}try{_=s.ChordSymbolEnum[F]}catch(j){const P=r.ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");return f.SheetErrors.pushMeasureError(P),void i.default.debug("InstrumentReader.readChordSymbol",P,j)}return new s.ChordSymbolContainer(D,_,S,E,f.Rules,I)}static readPlacement(t){var p;const f=(p=t.attribute("placement"))==null?void 0:p.value;return f==="above"?o.PlacementEnum.Above:f==="below"?o.PlacementEnum.Below:o.PlacementEnum.NotYetDefined}}g.ChordSymbolReader=n},5984(de,g,c){var l=this&&this.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(g,"__esModule",{value:!0}),g.ExpressionReader=void 0;const s=c(2561),u=c(5332),r=c(5875),i=c(2221),o=c(2148),n=c(437),h=c(9019),t=c(9161),f=c(9803),p=c(1112),m=c(6362),x=c(7533),y=c(9767),d=l(c(3065)),S=c(2570),M=c(9157),E=c(3253),L=c(6206);g.ExpressionReader=class{constructor(I,T,A){this.openContinuousDynamicExpressions=[],this.openOctaveShifts=new Map,this.pendingOctaveShiftStops=new Map,this.musicSheet=I,this.staffNumber=A,this.globalStaffIndex=I.getGlobalStaffIndexOfFirstStaff(T)+(A-1),this.initialize()}readExpressionParameters(I,T,A,v,B,D,_){this.initialize(),this.divisions=A;const F=I.element("offset");if(F!==void 0&&!_)try{this.offsetDivisions=parseInt(F.value,10)}catch(G){const Y="ReaderErrorMessages/ExpressionOffsetError, Invalid expression offset -> set to default.";d.default.debug("ExpressionReader.readExpressionParameters",Y,G),this.musicSheet.SheetErrors.pushMeasureError(Y),this.offsetDivisions=0}this.directionTimestamp=s.Fraction.createFromFraction(v);let k=new s.Fraction(Math.abs(this.offsetDivisions),4*A);this.offsetDivisions>0?v.RealValue>0?(k=s.Fraction.multiply(s.Fraction.minus(v,B),k),this.directionTimestamp=s.Fraction.plus(k,v)):this.directionTimestamp=s.Fraction.createFromFraction(k):this.offsetDivisions<0&&(v.RealValue>0?(k=s.Fraction.multiply(s.Fraction.minus(v,B),k),this.directionTimestamp=s.Fraction.minus(v,k)):this.directionTimestamp=s.Fraction.createFromFraction(k));const j=I.elements("direction-type"),P=I.attribute("placement");if(P)try{const G=P.value;G==="below"?this.placement=m.PlacementEnum.Below:G==="above"&&(this.placement=m.PlacementEnum.Above)}catch(G){const Y=y.ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");d.default.debug("ExpressionReader.readExpressionParameters",Y,G),this.musicSheet.SheetErrors.pushMeasureError(Y),this.placement=m.PlacementEnum.Below}try{for(const G of j){const Y=G.element("wedge");if(Y){const X=Y.attribute("default-y");X&&(this.WedgeYPosXml=parseInt(X.value,10),this.placement===m.PlacementEnum.NotYetDefined&&this.readExpressionPlacement(X,"read wedge y pos"))}if(this.placement===m.PlacementEnum.NotYetDefined){const X=G.element("dynamics");if(X){const $=X.attribute("default-y");$&&this.readExpressionPlacement($,"read dynamics y pos")}const ie=G.element("words");if(ie){const $=ie.attribute("default-y");$&&this.readExpressionPlacement($,"read words y pos")}const oe=G.element("rehearsal");if(oe){const $=oe.attribute("default-y");$&&this.readExpressionPlacement($,"read rehearsal pos")}}}}catch(G){const Y=y.ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement. Set to default.");d.default.debug("ExpressionReader.readExpressionParameters",Y,G),this.musicSheet.SheetErrors.pushMeasureError(Y),this.placement=m.PlacementEnum.Below}this.placement===m.PlacementEnum.NotYetDefined&&(T.Staves.length>1?this.placement=m.PlacementEnum.Below:T.HasLyrics?this.placement=m.PlacementEnum.Above:this.placement=m.PlacementEnum.Below)}read(I,T,A,v=void 0){let B=!1,D=!1;const _=A.clone(),F=I.element("offset");if(F!=null&&F.value){const P=Number.parseInt(F.value,10);_.Add(new s.Fraction(P,4*this.divisions))}const k=I.element("sound");if(k){const P=k.attribute("tempo"),G=k.attribute("dynamics");if(P){const Y=P.value.match(/^(\d+)(\.\d+)?$/);(Y==null?void 0:Y.length)>0?this.soundTempo=Math.round(Number.parseFloat(P.value)):(d.default.info("invalid xml tempo: "+P.value),this.soundTempo=100),T.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,B=!0}if(G){const Y=G.value.match(/\d+/);this.soundDynamic=Y!==void 0?parseInt(Y[0],10):100,D=!0}}const j=I.elements("direction-type");for(const P of j){let G=P.element("metronome");if(G){const Y=G.elements("metronome-note"),X=G.element("metronome-relation");if(Y.length>0&&X)this.parseComplexMetronomeMark(G,Y,X,T,_);else{const ie=G.element("beat-unit"),oe=G.element("beat-unit-dot")!==void 0,$=G.element("per-minute");if(ie!==void 0&&$){G.hasAttributes&&G.attribute("default-x")!==void 0&&(this.directionTimestamp=s.Fraction.createFromFraction(_));const Q=$.value.match(/(\d+\.?\d*)/),ne=Q?parseFloat(Q[1]):NaN;this.createNewTempoExpressionIfNeeded(T);const ee=new t.InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,ne,this.currentMultiTempoExpression,!0);ee.parentMeasure=T,this.soundTempo=ne,T.TempoInBPM=this.soundTempo*(oe?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,ee.dotted=oe,ee.beatUnit=ie.value,this.currentMultiTempoExpression.addExpression(ee,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}}continue}if(G=P.element("dynamics"),G){const Y=I.element("notations")!==void 0;this.interpretInstantaneousDynamics(G,T,_,Y);continue}if(G=P.element("words"),G)if(B){this.createNewTempoExpressionIfNeeded(T),this.currentMultiTempoExpression.CombinedExpressionsText=G.value;const Y=new t.InstantaneousTempoExpression(G.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(Y,"")}else D||this.interpretWords(G,T,_);else G=P.element("wedge"),G?this.interpretWedge(I,G,T,v,T.MeasureNumber):(G=P.element("rehearsal"),G&&this.interpretRehearsalMark(G,T,A,T.MeasureNumber))}}closeOpenExpressions(I,T){for(const A of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(I,A.NumberXml,T),this.closeOpenContinuousDynamic(A,I,T);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(s.Fraction.plus(I.AbsoluteTimestamp,T))}addOctaveShift(I,T,A,v=0){var k;let B=1;const D=I.element("staff");if(D)try{B=parseInt(D.value,10)}catch(j){const P=y.ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number. Set to default");this.musicSheet.SheetErrors.pushMeasureError(P),B=1,d.default.debug("ExpressionReader.addOctaveShift",P,j)}const _=I.elements("direction-type"),F=this.readPlacement(I);for(const j of _){const P=j.element("octave-shift");if(P!==void 0&&P.hasAttributes)try{const G=this.readNumber(P);if(P.attribute("size")){const Y=parseInt(P.attribute("size").value,10);let X=0;Y===8?X=1:Y===15&&(X=2);let ie=(k=P.attribute("type"))==null?void 0:k.value;if(ie||(F===m.PlacementEnum.Above?ie="down":F===m.PlacementEnum.Below&&(ie="up")),ie==="up"||ie==="down"){const oe=new n.OctaveShift(ie,X);oe.StaffNumber=B,oe.numberXml=G,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(T,G),this.getMultiExpression.OctaveShiftStart=oe,oe.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShifts.set(G,oe);const $=this.pendingOctaveShiftStops.get(G);$&&(this.pendingOctaveShiftStops.delete(G),this.getMultiExpression=this.createNewMultiExpressionIfNeeded($.measure,G,$.endTimestamp),this.getMultiExpression.OctaveShiftEnd=oe,oe.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShifts.delete(G))}else if(ie==="stop"){const oe=this.openOctaveShifts.get(G);if(oe)oe.endVoiceEntryIndex=v,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(T,oe.numberXml,A),this.getMultiExpression.OctaveShiftEnd=oe,oe.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShifts.delete(G);else{const $=s.Fraction.minus(this.directionTimestamp,new s.Fraction(1,4*this.divisions));this.pendingOctaveShiftStops.set(G,{measure:T,endTimestamp:$})}}else ie||d.default.debug("octave-shift missing type in xml")}}catch(G){const Y=y.ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(Y),d.default.debug("ExpressionReader.addOctaveShift",Y,G)}}}addPedalMarking(I,T,A){var B,D,_;const v=I.elements("direction-type");for(const F of v){const k=F.element("pedal");if(k&&k.hasAttributes){let j=!1,P=!1;try{switch(((B=k.attribute("line"))==null?void 0:B.value)==="yes"?P=!0:((D=k.attribute("line"))==null?void 0:D.value)==="no"?(P=!1,j=!0):((_=k.attribute("sign"))==null?void 0:_.value)==="yes"?j=!0:(j=!1,P=!0),k.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(T),this.createNewMultiExpressionIfNeeded(T,-1),this.openPedal=new E.Pedal(P,j),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(T,A);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(T,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(T,-1),this.openPedal=new E.Pedal(P,j),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression)}}catch(G){const Y=y.ITextTranslation.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(Y),d.default.debug("ExpressionReader.addPedalMarking",Y,G)}}}}endOpenPedal(I,T){this.createNewMultiExpressionIfNeeded(I,-1,T),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(I,T,A,v){if(I&&I.hasAttributes)try{switch(I.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(T,-1),this.openWavyLine=new L.WavyLine(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(T,-1,A),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0)}}catch(B){const D=y.ITextTranslation.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(D),d.default.debug("ExpressionReader.addWavyLine",D,B)}}initialize(){this.placement=m.PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(I){var A;const T=(A=I.attribute("placement"))==null?void 0:A.value;return T==="above"?m.PlacementEnum.Above:T==="below"?m.PlacementEnum.Below:m.PlacementEnum.NotYetDefined}readExpressionPlacement(I,T){try{const A=this.readPosition(I);A<0?this.placement=m.PlacementEnum.Below:A>0&&(this.placement=m.PlacementEnum.Above)}catch(A){d.default.debug("ExpressionReader.readExpressionParameters",T,A)}}readPosition(I){try{const T=parseInt(I.value,10);return T<0?this.placement=m.PlacementEnum.Below:T>0&&(this.placement=m.PlacementEnum.Above),T}catch(T){d.default.debug("ExpressionReader.readExpressionParameters",T)}}parseComplexMetronomeMark(I,T,A,v,B){var X;I.hasAttributes&&I.attribute("default-x")!==void 0&&(this.directionTimestamp=s.Fraction.createFromFraction(B));const D=I.elements(),_=[],F=[];let k,j=!1;for(const ie of D){if(ie.name==="metronome-relation"){j=!0;continue}if(ie.name!=="metronome-note")continue;const oe=ie.element("metronome-type");if(!oe)continue;const $={type:oe.value,dots:ie.elements("metronome-dot").length},Q=ie.element("metronome-beam");Q&&($.beam=Q.value);const ne=ie.element("metronome-tuplet");if(ne&&(ne.hasAttributes?(X=ne.attribute("type"))==null?void 0:X.value:void 0)==="start"){const ee=ne.element("actual-notes"),N=ne.element("normal-notes"),R=ne.attribute("bracket"),O=ne.attribute("show-number");k={actualNotes:ee?parseInt(ee.value,10):3,normalNotes:N?parseInt(N.value,10):2,bracket:!R||R.value==="yes",showNumber:O?O.value:"actual"}}j?F.push($):_.push($)}const P={notes:_},G={notes:F,tuplet:k};this.createNewTempoExpressionIfNeeded(v);const Y=new t.InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression,!0);Y.parentMeasure=v,Y.metronomeNoteGroupLeft=P,Y.metronomeNoteGroupRight=G,Y.metronomeRelation=A.value,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,this.currentMultiTempoExpression.addExpression(Y,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}interpretInstantaneousDynamics(I,T,A,v){var B,D,_;if(I.hasElements){I.hasAttributes&&I.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(A));const F=this.readNumber(I);let k=(B=I.elements()[0])==null?void 0:B.name;if(k==="other-dynamics"&&(k=I.elements()[0].value),k){if((D=T.Rules)!=null&&D.IgnoreRepeatedDynamics){let P;try{P=o.DynamicEnum[k]}catch{const Y=y.ITextTranslation.translateText("ReaderErrorMessages/DynamicError","Error while reading dynamic.");return void this.musicSheet.SheetErrors.pushMeasureError(Y)}if(((_=this.activeInstantaneousDynamic)==null?void 0:_.DynEnum)===P)return}v?this.createNewMultiExpressionIfNeeded(T,F,s.Fraction.createFromFraction(A)):this.createNewMultiExpressionIfNeeded(T,F);const j=new o.InstantaneousDynamicExpression(k,this.soundDynamic,this.placement,this.staffNumber,T);j.InMeasureTimestamp=A.clone(),this.getMultiExpression.addExpression(j,""),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=j.DynEnum:this.activeInstantaneousDynamic=new o.InstantaneousDynamicExpression(k,0,m.PlacementEnum.NotYetDefined,1,T)}}}interpretWords(I,T,A){var Y;const v=I.value;if(T.Rules.IgnoreBracketsWords&&(/^\(\s*\)$/.test(v)||/^\[\s*\]$/.test(v)))return;let B;const D=I.attribute("font-style");let _,F,k;D&&(_=D.value,_==="italic"&&(B=S.FontStyles.Italic));const j=I.attribute("font-weight");j&&(F=j.value,F==="bold"&&(B=S.FontStyles.Bold,_==="italic"&&(B=S.FontStyles.BoldItalic)));const P=I.attribute("color");let G;if(P&&(k=P.value),T.Rules.PlaceWordsInsideStafflineFromXml){const X=(Y=I.attribute("default-y"))==null?void 0:Y.value;(X==null?void 0:X.length)>0&&(G=Number.parseInt(X,10))}if(v.length>0){if(I.hasAttributes&&I.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(A)),this.checkIfWordsNodeIsRepetitionInstruction(v))return;this.fillMultiOrTempoExpression(v,T,A,B,k,G),this.initialize()}}readNumber(I){var v;let T=1;const A=(v=I.attribute("number"))==null?void 0:v.value;return A&&(T=Number.parseInt(A,10)),T}interpretWedge(I,T,A,v,B){var F,k;T!==void 0&&T.hasAttributes&&T.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(v));const D=this.readNumber(T),_=(k=(F=T.attribute("type"))==null?void 0:F.value)==null?void 0:k.toLowerCase();this.lastWedge&&this.lastWedge.parentMeasure.MeasureNumberXML===A.MeasureNumberXML&&this.lastWedge.StaffNumber===this.staffNumber&&this.placement===this.lastWedge.Placement&&this.WedgeYPosXml!==void 0&&this.lastWedge.YPosXml===this.WedgeYPosXml&&this.lastWedge.StartMultiExpression.Timestamp.Equals(this.directionTimestamp)&&this.lastWedge.DynamicType===r.ContDynamicEnum[_]||(_==="stop"?(this.createNewMultiExpressionIfNeeded(A,D,v),this.getMultiExpression.EndOffsetFraction=new s.Fraction(this.offsetDivisions,4*this.divisions)):this.createNewMultiExpressionIfNeeded(A,D),this.addWedge(T,A,v),this.initialize())}interpretRehearsalMark(I,T,A,v){T.rehearsalExpression=new M.RehearsalExpression(I.value,this.placement)}createNewMultiExpressionIfNeeded(I,T,A=void 0){A||(A=this.directionTimestamp);let v=this.getMultiExpression;return(!v||v&&(v.SourceMeasureParent!==I||v.numberXml!==T||v.SourceMeasureParent===I&&!v.Timestamp.Equals(A)))&&(this.getMultiExpression=v=new h.MultiExpression(I,s.Fraction.createFromFraction(A)),this.getMultiExpression.numberXml=T,I.StaffLinkedExpressions[this.globalStaffIndex].push(v)),v}createNewTempoExpressionIfNeeded(I){this.currentMultiTempoExpression&&this.currentMultiTempoExpression.SourceMeasureParent===I&&this.currentMultiTempoExpression.Timestamp===this.directionTimestamp||(this.currentMultiTempoExpression=new u.MultiTempoExpression(I,s.Fraction.createFromFraction(this.directionTimestamp)),I.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(I,T,A){if(I!==void 0&&I.hasAttributes){const v=this.readNumber(I),B=I.attribute("type").value.toLowerCase();try{if(B==="crescendo"||B==="diminuendo"){const D=new r.ContinuousDynamicExpression(r.ContDynamicEnum[B],this.placement,this.staffNumber,T,v);this.lastWedge=D,this.lastWedge.YPosXml=this.WedgeYPosXml,this.openContinuousDynamicExpressions.push(D);let _=this.getMultiExpression;_||(_=this.createNewMultiExpressionIfNeeded(T,v)),_.StartingContinuousDynamic=D,D.StartMultiExpression=_,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===D.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(B==="stop")for(const D of this.openContinuousDynamicExpressions)D.NumberXml===v&&this.closeOpenContinuousDynamic(D,T,A)}catch(D){const _="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(_),d.default.debug("ExpressionReader.addWedge",_,D)}}}fillMultiOrTempoExpression(I,T,A,v,B,D=void 0){if(!I)return;const _=I.trim();this.createExpressionFromString("",_,T,A,I,v,B,D)}createExpressionFromString(I,T,A,v,B,D,_,F=void 0){const k=t.InstantaneousTempoExpression.isInputStringInstantaneousTempo(T),j=i.ContinuousTempoExpression.isInputStringContinuousTempo(T);if(k||j){if(A.TempoExpressions.length>0)for(let X=0,ie=A.TempoExpressions.length;X<ie;++X){const oe=A.TempoExpressions[X];if(oe.Timestamp===this.directionTimestamp&&oe.InstantaneousTempo!==void 0&&oe.InstantaneousTempo.Label.indexOf(T)!==-1)return!1}if(this.createNewTempoExpressionIfNeeded(A),this.currentMultiTempoExpression.CombinedExpressionsText=B,k){const X=new t.InstantaneousTempoExpression(T,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);return X.ColorXML=_,this.currentMultiTempoExpression.addExpression(X,I),!0}if(j){const X=new i.ContinuousTempoExpression(T,this.placement,this.staffNumber,this.currentMultiTempoExpression);return X.ColorXML=_,this.currentMultiTempoExpression.addExpression(X,I),!0}}if(r.ContinuousDynamicExpression.isInputStringContinuousDynamic(T)){const X=new r.ContinuousDynamicExpression(void 0,this.placement,this.staffNumber,A,-1,T);X.ColorXML=_;const ie=this.getMultiExpression;return ie&&this.closeOpenContinuousDynamic(ie.StartingContinuousDynamic,A,v),this.createNewMultiExpressionIfNeeded(A,-1),this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===X.StaffNumber&&(this.activeInstantaneousDynamic=void 0),this.openContinuousDynamicExpressions.push(X),X.StartMultiExpression=this.getMultiExpression,this.getMultiExpression.addExpression(X,I),!0}if(f.MoodExpression.isInputStringMood(T)){const X=this.createNewMultiExpressionIfNeeded(A,-1);A.hasMoodExpressions=!0;const ie=new f.MoodExpression(T,this.placement,this.staffNumber);return ie.fontStyle=D,ie.ColorXML=_,X.addExpression(ie,I),!0}const P=this.createNewMultiExpressionIfNeeded(A,-1,v);if(A.TempoExpressions.length>0)for(let X=0,ie=A.TempoExpressions.length;X<ie;++X){const oe=A.TempoExpressions[X];if(oe.Timestamp===this.directionTimestamp&&oe.InstantaneousTempo!==void 0&&oe.EntriesList.length>0&&!this.hasDigit(T)&&this.globalStaffIndex>0){if(oe.EntriesList[0].label.indexOf(T)>=0)return!1;break}}let G=this.musicSheet.Rules.UnknownExpressionTextAlignment;this.musicSheet.Rules.CompactMode&&(G=x.TextAlignmentEnum.LeftBottom);const Y=new p.UnknownExpression(T,this.placement,G,this.staffNumber);return Y.fontStyle=D,Y.ColorXML=_,Y.defaultYXml=F,Y.parentMeasure=A,P.addExpression(Y,I),!1}closeOpenContinuousDynamic(I,T,A){if(!I)return;const v=I.NumberXml;I.EndMultiExpression=this.createNewMultiExpressionIfNeeded(T,v,A),I.StartMultiExpression.EndingContinuousDynamic=I,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(B=>B!==I)}closeOpenContinuousTempo(I){this.openContinuousTempoExpression.AbsoluteEndTimestamp=I,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(I){return(I=I.trim().toLowerCase())==="coda"||I==="tocoda"||I==="to coda"||I==="fine"||I==="d.c."||I==="dacapo"||I==="da capo"||I==="d.s."||I==="dalsegno"||I==="dal segno"||I==="d.c. al fine"||I==="d.s. al fine"||I==="d.c. al coda"||I==="d.s. al coda"}hasDigit(I){return/\d/.test(I)}}},6030(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.LyricsReader=void 0;const l=c(649),s=c(2317),u=c(9767);g.LyricsReader=class{constructor(r){this.openLyricWords={},this.musicSheet=r}addLyricEntry(r,i){var o,n;if(r){const h=r;for(let t=0,f=h.length;t<f;++t){const p=h[t];try{let m="single";if(p.element("text")){let x=p.element("text");if(p.element("syllabic")&&(m=p.element("syllabic").value),x){let y="";const d=p.elements();for(const E of d)E.name!=="text"&&E.name!=="elision"||(y+=E.value);if(y=y.replace(" "," "),p.element("elision")!==void 0&&y==="-"){const E=p.elements();let L,I,T=0;for(let A=0;A<E.length;A++)if(E[A].name==="elision"){T=A;break}if(T>0)for(let A=T;A<E.length;A++){const v=E[A];v.name==="text"&&(L=v),v.name==="syllabic"&&(I=v)}L!==void 0&&I&&(x=L,m="middle")}let S,M="1";if(p.attributes()!==void 0&&p.attribute("number")&&(M=p.attribute("number").value),m==="single"||m==="end"){if(this.openLyricWords[M]){this.currentLyricWord=this.openLyricWords[M];const E=this.currentLyricWord.Syllables.length;S=new s.LyricsEntry(y,M,this.currentLyricWord,i,E),this.currentLyricWord.Syllables.push(S),delete this.openLyricWords[M],this.currentLyricWord=void 0}else S=new s.LyricsEntry(y,M,void 0,i);S.extend=p.element("extend")!==void 0}else if(m==="begin")this.openLyricWords[M]&&(delete this.openLyricWords[M],this.currentLyricWord=void 0),this.currentLyricWord=new l.LyricWord,this.openLyricWords[M]=this.currentLyricWord,S=new s.LyricsEntry(y,M,this.currentLyricWord,i,0),this.currentLyricWord.Syllables.push(S);else if(m==="middle")if(this.openLyricWords[M]){this.currentLyricWord=this.openLyricWords[M];const E=this.currentLyricWord.Syllables.length;S=new s.LyricsEntry(y,M,this.currentLyricWord,i,E),this.currentLyricWord.Syllables.push(S)}else S=new s.LyricsEntry(y,M,void 0,i);S&&(i.LyricsEntries[M]||(i.LyricsEntries.setValue(M,S),(n=(o=i.ParentSourceStaffEntry)==null?void 0:o.VerticalContainerParent)!=null&&n.ParentMeasure&&(i.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),i.ParentVoice.Parent.LyricVersesNumbers.includes(M)||i.ParentVoice.Parent.LyricVersesNumbers.push(M))}}}catch{const x=u.ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(x);continue}}}}}},6302(de,g,c){var l=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(g,"__esModule",{value:!0}),g.RepetitionBuildingContainer=g.RepetitionCalculator=void 0;const s=c(1645),u=c(1645),r=c(7307),i=c(4076),o=l(c(3065));g.RepetitionCalculator=class{constructor(){this.repetitionInstructions=[],this.openRepetitions=[],this.lastRepetitionCommonPartStartIndex=0}calculateRepetitions(h,t){this.musicSheet=h,this.repetitionInstructions=t,this.openRepetitions.length=0,this.lastRepetitionCommonPartStartIndex=0;const f=this.musicSheet.SourceMeasures,p=new Set;for(let d=1;d<f.length;d++){const S=f[d].MeasureNumberXML??f[d].MeasureNumber,M=f[d-1].MeasureNumberXML??f[d-1].MeasureNumber;S<=1&&M>1&&p.add(d)}let m=0;for(const d of this.repetitionInstructions){if(this.currentMeasureIndex=d.measureIndex,this.currentMeasureIndex>m){for(const S of p)if(S>m&&S<=this.currentMeasureIndex){for(;this.openRepetitions.length>0;)this.finalizeRepetition(this.openRepetitions.last());this.lastRepetitionCommonPartStartIndex=S;break}}m=this.currentMeasureIndex;try{this.currentMeasure=f[this.currentMeasureIndex],this.handleRepetitionInstructions(d)}catch(S){o.default.error("RepetitionCalculator: calculateRepetitions",S)}}for(;this.openRepetitions.length>0;)try{const d=this.openRepetitions.last();if(d.RepetitonUnderConstruction.FromWords){if(d.WaitingForCoda){let S=d.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;S>=this.musicSheet.SourceMeasures.length&&(S=-1),d.RepetitonUnderConstruction.setEndingStartIndex(2,S)}else if(d.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(d.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){const S=f.length-1,M=new s.RepetitionInstruction(S,s.RepetitionInstructionEnum.BackJumpLine,s.AlignmentType.End,d.RepetitonUnderConstruction);d.RepetitonUnderConstruction.BackwardJumpInstructions.push(M),f[S].LastRepetitionInstructions.push(M)}this.finalizeRepetition(this.openRepetitions.last())}catch{try{const S=this.openRepetitions.last().RepetitonUnderConstruction;for(const M of this.repetitionInstructions)M.parentRepetition===S&&(M.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(S){o.default.error("RepetitionCalculator: calculateRepetitions2",S)}}let x=!1;const y=this.musicSheet.SourceMeasures.length-1;for(const d of this.musicSheet.Repetitions)if(d.StartIndex===0&&d.EndIndex===y){x=!0;break}if(!x){const d=new i.Repetition(this.musicSheet,!0);d.FromWords=!0,d.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.StartLine),d.startMarker.parentRepetition=d,this.musicSheet.SourceMeasures[0].FirstRepetitionInstructions.push(d.startMarker),d.endMarker=new s.RepetitionInstruction(y,s.RepetitionInstructionEnum.BackJumpLine),d.endMarker.parentRepetition=d,d.BackwardJumpInstructions.push(d.endMarker),d.UserNumberOfRepetitions=d.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(d)}for(let d=0,S=this.musicSheet.SourceMeasures.length;d<S;++d){const M=this.musicSheet.SourceMeasures[d];M.FirstRepetitionInstructions.length>1&&M.FirstRepetitionInstructions.sort(u.RepetitionInstructionComparer.Compare),M.LastRepetitionInstructions.length>1&&M.LastRepetitionInstructions.sort(u.RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(h){let t;switch(h.type){case s.RepetitionInstructionEnum.StartLine:t=this.createNewRepetition(this.currentMeasureIndex),h.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!1,t.RepetitonUnderConstruction.startMarker=h,this.currentMeasure.FirstRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.BackJumpLine:t=this.getOrCreateCurrentRepetition2(!1),h.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case s.RepetitionInstructionEnum.Ending:if(t=this.getOrCreateCurrentRepetition(),h.parentRepetition=t.RepetitonUnderConstruction,h.endingIndices.contains(1)&&h.alignment===s.AlignmentType.Begin){if(t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){t=void 0;for(let f=this.openRepetitions.length-1;f>=0;f--){const p=this.openRepetitions[f];if(p.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(t=p;this.openRepetitions.length-1>f;){const m=this.openRepetitions.last();this.finalizeRepetition(m)}}t===void 0&&(t=this.createNewRepetition(0),t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.None))}t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(this.currentMeasureIndex-1,s.RepetitionInstructionEnum.ForwardJump,s.AlignmentType.End,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction))}if(h.alignment===s.AlignmentType.Begin)t.RepetitonUnderConstruction.setEndingsStartIndex(h.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(h);else for(let f=0,p=h.endingIndices.length;f<p;++f){const m=h.endingIndices[f];t.RepetitonUnderConstruction.setEndingEndIndex(m,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(h)}break;case s.RepetitionInstructionEnum.Segno:if(t=this.getCurrentRepetition(!0),t!==void 0&&t.SegnoFound&&t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&Math.abs(t.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1)break;t=this.createNewRepetition(this.currentMeasureIndex),h.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=h,this.currentMeasure.FirstRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.Fine:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;h.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=h,t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(h)):this.currentMeasure.LastRepetitionInstructions.push(new s.RepetitionInstruction(this.currentMeasureIndex,s.RepetitionInstructionEnum.Fine,s.AlignmentType.End,void 0));break;case s.RepetitionInstructionEnum.ToCoda:if(this.openRepetitions.length===0||(t=this.getCurrentRepetition(!0),t===void 0))break;t.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(h.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=h,this.currentMeasure.LastRepetitionInstructions.push(h));break;case s.RepetitionInstructionEnum.Coda:if(this.openRepetitions.length===0)break;t=this.getOrCreateCurrentRepetition2(!0),h.parentRepetition=t.RepetitonUnderConstruction,t.WaitingForCoda?(t.CodaFound=!0,t.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(h),this.finalizeRepetition(t),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):t.ToCodaFound||(t.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(t.ToCodaFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(this.currentMeasureIndex,s.RepetitionInstructionEnum.ToCoda,s.AlignmentType.End,t.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(t.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new s.RepetitionInstruction(this.currentMeasureIndex,s.RepetitionInstructionEnum.Coda,s.AlignmentType.Begin,void 0)));break;case s.RepetitionInstructionEnum.DaCapo:t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(t),t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),h.parentRepetition=t.RepetitonUnderConstruction,t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.None,s.AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h),t.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(t);break;case s.RepetitionInstructionEnum.DalSegno:if(t=this.getOrCreateCurrentRepetition2(!0),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0),t.RepetitonUnderConstruction.FromWords=!0,t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.None,s.AlignmentType.Begin,t.RepetitonUnderConstruction)),h.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Segno,h.measureIndex);f>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.Segno,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[f].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),h.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Segno,h.measureIndex);f>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.Segno,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[f].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.FineFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Fine,h.measureIndex);f>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.Fine,s.AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[f].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.DaCapoAlFine:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(t),t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.None,s.AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,h.parentRepetition=t.RepetitonUnderConstruction,!t.FineFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Fine,h.measureIndex);f>=0&&(t.FineFound=!0,t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.Fine,s.AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[f].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction))}t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(t=this.getOrCreateCurrentRepetition2(!0),h.parentRepetition=t.RepetitonUnderConstruction,!t.SegnoFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Segno,h.measureIndex);f>=0&&(t.SegnoFound=!0,t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.Segno,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[f].FirstRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.startMarker))}if(!t.ToCodaFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.ToCoda,h.measureIndex);if(f>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.ToCoda,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[f].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{const p=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Coda,h.measureIndex);p>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(p,s.RepetitionInstructionEnum.ToCoda,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[p].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.DaCapoAlCoda:if(t=this.getOrCreateCurrentRepetition(),t.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(t),t=this.createNewRepetition(0)):t.RepetitonUnderConstruction.EndingParts.length===0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker!==void 0&&t.RepetitonUnderConstruction.StartIndex!==0&&(t=this.createNewRepetition(0)),t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.None,s.AlignmentType.Begin,t.RepetitonUnderConstruction),t.RepetitonUnderConstruction.FromWords=!0,h.parentRepetition=t.RepetitonUnderConstruction,!t.ToCodaFound){const f=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.ToCoda,h.measureIndex);if(f>=0)t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(f,s.RepetitionInstructionEnum.ToCoda,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[f].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0;else{const p=this.findInstructionInMainListBackwards(s.RepetitionInstructionEnum.Coda,h.measureIndex);p>=0&&(t.RepetitonUnderConstruction.forwardJumpInstruction=new s.RepetitionInstruction(p,s.RepetitionInstructionEnum.ToCoda,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[p].LastRepetitionInstructions.splice(0,0,t.RepetitonUnderConstruction.forwardJumpInstruction),t.ToCodaFound=!0)}}t.ToCodaFound&&(t.WaitingForCoda=!0),t.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||t.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),t.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),this.currentMeasure.LastRepetitionInstructions.push(h);break;case s.RepetitionInstructionEnum.None:break;default:throw new r.ArgumentOutOfRangeException("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(h,t){for(let f=this.repetitionInstructions.length-1;f>=0;f--){const p=this.repetitionInstructions[f];if(p.measureIndex<=t&&p.type===h)return p.measureIndex}return-1}finalizeRepetition(h){const t=h.RepetitonUnderConstruction;if(t.BackwardJumpInstructions.length>0){let f=!0;const p=this.getLastFinalizedRepetition();if(p!==void 0&&t.coversIdenticalMeasures(p)){if(t.NumberOfEndings>p.NumberOfEndings){const m=this.musicSheet.Repetitions.indexOf(p,0);m>-1&&this.musicSheet.Repetitions.splice(m,1),p.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(t)}f=!1,t.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(t);if(f){t.startMarker.type===s.RepetitionInstructionEnum.None&&this.musicSheet.SourceMeasures[t.StartIndex].FirstRepetitionInstructions.push(t.startMarker);let m=t.DefaultNumberOfRepetitions;t.BackwardJumpInstructions.length===1&&t.BackwardJumpInstructions[0].Times>0&&(m=t.BackwardJumpInstructions[0].Times),t.UserNumberOfRepetitions=m}}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(h){let t;for(let f=this.openRepetitions.length-1;f>=0;f--)if(this.openRepetitions[f].RepetitonUnderConstruction.FromWords===h){for(t=this.openRepetitions[f];f<this.openRepetitions.length-1;)this.finalizeRepetition(this.openRepetitions.last());return t}return t}getOrCreateCurrentRepetition(){if(this.openRepetitions.length>0)return this.openRepetitions.last();const h=this.createNewRepetition(0);return h.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(0,s.RepetitionInstructionEnum.None,s.AlignmentType.Begin,h.RepetitonUnderConstruction),h}getOrCreateCurrentRepetition2(h){let t;for(let f=this.openRepetitions.length-1;f>=0;f--)if(t=this.openRepetitions[f],t.RepetitonUnderConstruction.FromWords===h){for(;f<this.openRepetitions.length-1;)this.finalizeRepetition(this.openRepetitions.last());return t}return t=this.createNewRepetition(this.lastRepetitionCommonPartStartIndex),t.RepetitonUnderConstruction.startMarker=new s.RepetitionInstruction(this.lastRepetitionCommonPartStartIndex,s.RepetitionInstructionEnum.None,s.AlignmentType.Begin,t.RepetitonUnderConstruction),this.lastRepetitionCommonPartStartIndex=this.currentMeasureIndex+1,t.RepetitonUnderConstruction.FromWords=h,t}createNewRepetition(h){if(this.openRepetitions.length>0){const f=this.openRepetitions.last(),p=f.RepetitonUnderConstruction;if(p.BackwardJumpInstructions.length>0){const m=Object.keys(p.EndingIndexDict);(m.length===0||p.EndingIndexDict[m[m.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(f)}}const t=new n(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=h,this.openRepetitions.push(t),t}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}};class n{constructor(t){this.RepetitonUnderConstruction=new i.Repetition(t)}}g.RepetitionBuildingContainer=n},7631(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.RepetitionInstructionReader=void 0;const l=c(1645),s=c(1645),u=c(4356);g.RepetitionInstructionReader=class{set MusicSheet(r){this.musicSheet=r,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(r,i){this.currentMeasureIndex=i}handleLineRepetitionInstructions(r){var o;let i=!1;if(r.elements().length>0){let n="",h=!1,t="",f="",p="";const m=[],x=r.element("bar-style");x&&(p=x.value),n=r.attributes().length>0&&r.attribute("location")?r.attribute("location").value:"right";const y=r.elements();for(let d=0,S=y.length;d<S;++d){const M=y[d];if(M.name==="repeat"&&M.hasAttributes)h=!0,t=M.attribute("direction").value;else if(M.name==="ending"&&M.hasAttributes&&M.attribute("type")!==void 0&&M.attribute("number")){if(((o=M.attribute("print-object"))==null?void 0:o.value)==="no")continue;f=M.attribute("type").value;let E=M.attribute("number").value;M.value&&(E=M.value);const L=E.split("[,+]");for(let I=0,T=L.length;I<T;++I){const A=L[I],v=A.match("[0-9]");if(A.search("-")!==-1&&v.length===2){const B=parseInt(v[0],10),D=parseInt(v[1],10);for(let _=B;_<=D;_++)m.push(_)}else for(let B=0,D=v.length;B<D;++B){const _=v[B];m.push(parseInt(_,10))}}}}if(p!=="light-heavy"||m.length!==0||h||(i=!0),h||m.length>0)if(n==="left"){if(f==="start"){const d=new l.RepetitionInstruction(this.currentMeasureIndex,l.RepetitionInstructionEnum.Ending,l.AlignmentType.Begin,void 0,m);this.addInstruction(this.repetitionInstructions,d)}if(t==="forward"){const d=new l.RepetitionInstruction(this.currentMeasureIndex,l.RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,d)}}else{if(f==="stop"){const d=new l.RepetitionInstruction(this.currentMeasureIndex,l.RepetitionInstructionEnum.Ending,l.AlignmentType.End,void 0,m);this.addInstruction(this.repetitionInstructions,d)}else if(f==="discontinue"){const d=new l.RepetitionInstruction(this.currentMeasureIndex,l.RepetitionInstructionEnum.Ending,l.AlignmentType.Discontinue,void 0,m);this.addInstruction(this.repetitionInstructions,d)}if(t==="backward"){const d=new l.RepetitionInstruction(this.currentMeasureIndex,l.RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,d)}}}return i}handleRepetitionInstructionsFromWordsOrSymbols(r,i){const o=r.element("words"),n=this.currentMeasureIndex;if(o){const h="d\\s?\\.s\\.",t=o.value.trim().toLowerCase();if(u.StringUtil.StringContainsSeparatedWord(t,h+" al fine",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,p),!0}const f="d\\.\\s?c\\.";if(u.StringUtil.StringContainsSeparatedWord(t,f+" al coda",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,f+" al fine",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,f+" al coda",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,f)||u.StringUtil.StringContainsSeparatedWord(t,"da\\s?capo",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,h,!0)||u.StringUtil.StringContainsSeparatedWord(t,"dal\\s?segno",!0)){let p;return p=u.StringUtil.StringContainsSeparatedWord(t,"al\\s?coda",!0)?new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DalSegnoAlCoda):new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,"to\\s?coda",!0)||u.StringUtil.StringContainsSeparatedWord(t,"a (la )?coda",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,"fine",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,"coda",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,p),!0}if(u.StringUtil.StringContainsSeparatedWord(t,"segno",!0)){const p=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,p),!0}}else{if(r.element("segno")){const h=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,h),!0}if(r.element("coda")){const h=new l.RepetitionInstruction(n,l.RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,h),!0}}return!1}removeRedundantInstructions(){let r=0,i=0,o=0,n=0;for(let h=0;h<this.repetitionInstructions.length;h++){const t=this.repetitionInstructions[h];switch(t.type){case l.RepetitionInstructionEnum.Coda:o>0&&this.findInstructionInPreviousMeasure(h,t.measureIndex,l.RepetitionInstructionEnum.ToCoda)&&(t.type=l.RepetitionInstructionEnum.None);break;case l.RepetitionInstructionEnum.Segno:if(r-n>0){let f=!1;for(let p=0,m=this.repetitionInstructions.length;p<m;++p){const x=this.repetitionInstructions[p];if(t.measureIndex-x.measureIndex===1)switch(x.type){case l.RepetitionInstructionEnum.BackJumpLine:x.type=o-i>0?l.RepetitionInstructionEnum.DalSegnoAlCoda:l.RepetitionInstructionEnum.DalSegno,t.type=l.RepetitionInstructionEnum.None,f=!0;break;case l.RepetitionInstructionEnum.DalSegno:case l.RepetitionInstructionEnum.DalSegnoAlFine:case l.RepetitionInstructionEnum.DalSegnoAlCoda:t.type=l.RepetitionInstructionEnum.None,f=!0}if(f)break}if(f)break;t.type=o-i>0?l.RepetitionInstructionEnum.DalSegnoAlCoda:l.RepetitionInstructionEnum.DalSegno,t.alignment=l.AlignmentType.End,t.measureIndex--}}if(this.backwardSearchForPreviousIdenticalInstruction(h,t)||t.type===l.RepetitionInstructionEnum.None)this.repetitionInstructions.splice(h,1),h--;else switch(t.type){case l.RepetitionInstructionEnum.Fine:break;case l.RepetitionInstructionEnum.ToCoda:o++;break;case l.RepetitionInstructionEnum.Coda:i++;break;case l.RepetitionInstructionEnum.Segno:r++;break;case l.RepetitionInstructionEnum.DalSegnoAlFine:case l.RepetitionInstructionEnum.DalSegnoAlCoda:n++}}this.repetitionInstructions.sort(s.RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(r,i,o){for(let n=r-1;n>=0;n--){const h=this.repetitionInstructions[n];if(i-h.measureIndex===1&&h.type===o)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(r,i){for(let o=r-1;o>=0;o--)if(this.repetitionInstructions[o].equals(i))return!0;return!1}addInstruction(r,i){let o=!0;for(let n=0,h=r.length;n<h;++n){const t=r[n];if(i.equals(t)){o=!1;break}}o&&r.push(i)}}},3186(de,g,c){var l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(g,"__esModule",{value:!0}),g.SlurReader=void 0;const s=c(6229),u=l(c(3065)),r=c(9767),i=c(4980),o=c(7718);g.SlurReader=class{constructor(n){this.openSlurDict={},this.musicSheet=n}addSlur(n,h){try{if(n){for(const t of n)if(t.attributes().length>0){const f=t.attribute("type").value;let p=1;try{t.attribute("number")&&(p=parseInt(t.attribute("number").value,10))}catch(d){u.default.debug("VoiceGenerator.addSlur number: ",d)}let m=i.PlacementEnum.NotYetDefined;const x=t.attribute("placement");x&&x.value&&(x.value==="above"?m=i.PlacementEnum.Above:x.value==="below"&&(m=i.PlacementEnum.Below));const y=t.attribute("orientation");if(y&&y.value&&(y.value==="over"?m=i.PlacementEnum.Above:y.value==="under"&&(m=i.PlacementEnum.Below)),f==="start"){let d=this.openSlurDict[p];d||(d=new s.Slur,this.openSlurDict[p]=d),d.StartNote=h,d.PlacementXml=m}else if(f==="stop"){const d=this.openSlurDict[p];if(d){const S=t.name;if(S==="slide"||S==="glissando"){const M=d.StartNote,E=new o.Glissando(M);E.AddNote(h),E.EndNote=h,h.NoteGlissando=E,delete this.openSlurDict[p]}else d.EndNote=h,h.isDuplicateSlur(d)||(h.NoteSlurs.push(d),d.StartNote.NoteSlurs.push(d)),delete this.openSlurDict[p]}}}}}catch{const f=r.ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(f)}}}},1538(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.TempoSorter=g.TemposCalculator=void 0;const l=c(2561),s=c(899),u=c(6362),r=c(9161),i=c(5332);class o{calculate(t){o.processTempoExpressions(t)}static processTempoExpressions(t){var d;const f=[];for(let S=0,M=t.SourceMeasures;S<M.length;S++){const E=M[S];E.TempoExpressions.sort(n.Compare);for(let L=0,I=E.TempoExpressions;L<I.length;L++){const T=I[L];T.InstantaneousTempo!=null&&T.InstantaneousTempo.TempoType===r.TempoType.none&&(T.InstantaneousTempo.TempoType=r.TempoType.inst),f.push(T)}}f.sort(n.Compare);const p=o.cleanExpListStartingEntry(t,f),m=[];let x=null,y=p;for(let S=0,M=f;S<M.length;S++){const E=M[S];if(x===null||E.AbsoluteTimestamp!==x.AbsoluteTimestamp){if(E.InstantaneousTempo!=null&&E.InstantaneousTempo.TempoInBpm===0){const L=E.InstantaneousTempo;if(L.isMetronomeMark&&(L.TempoInBpm=y),L instanceof r.InstantaneousTempoExpression&&L.TempoType!==r.TempoType.change&&(L.TempoInBpm=r.InstantaneousTempoExpression.getDefaultValueForInstTempo(L.InstTempo)),L.TempoType===r.TempoType.change)switch(L.ChangeSubType){case r.ChangeSubType.atempo:L.TempoInBpm=y;break;case r.ChangeSubType.doppioMovimento:L.TempoInBpm=2*y;break;case r.ChangeSubType.tempoprimo:L.TempoInBpm=p}y=L.TempoInBpm}}else x==null&&E.AbsoluteTimestamp!==x.AbsoluteTimestamp||(x.InstantaneousTempo!=null&&E.InstantaneousTempo!=null&&E.clearInstantaneousTempo(),E.ContinuousTempo!=null&&(x.ContinuousTempo===null&&x.addExpression(E.ContinuousTempo,""),E.clearContinuousTempo()));if(E.InstantaneousTempo===null&&E.ContinuousTempo===null){const L=E.SourceMeasureParent.TempoExpressions.indexOf(E);L>=0&&E.SourceMeasureParent.TempoExpressions.splice(L,1)}else m.push(E),x=E}y=p;for(let S=0;S<m.length;S++){const M=m[S];if(M.InstantaneousTempo!=null&&(y=M.InstantaneousTempo.TempoInBpm),M.ContinuousTempo!=null){const E=M.ContinuousTempo;E.StartTempo=y;const L=M.SourceMeasureParent.measureListIndex;let I=L;const T=Math.min(L+t.Rules.TempoChangeMeasureValidity,t.SourceMeasures.length-1);for(;I<=T;){const _=t.SourceMeasures[I],F=_.endingBarStyleEnum===s.SystemLinesEnum.ThinBold;if(_.endsWithLineRepetition()||F||I===t.SourceMeasures.length-1)break;if(I>L&&_.beginsWithRepetition()){I--;break}I++}const A=t.SourceMeasures[I];let v,B=l.Fraction.plus(A.AbsoluteTimestamp,l.Fraction.minus(A.Duration,new l.Fraction(1,64)));S<m.length-1&&(v=m[S+1].AbsoluteTimestamp,v.RealValue<B.RealValue&&(B=v)),E.AbsoluteEndTimestamp=B;let D=E.StartTempo*(1-t.Rules.TempoContinousFactor)*E.getTempoFactor();D*=Math.pow(Math.max(.6,Math.min(E.AbsoluteTimeSpan,2)/2),.25),E.EndTempo=E.StartTempo+D}}t.TimestampSortedTempoExpressionsList=m,(d=m[0])!=null&&d.InstantaneousTempo&&(t.DefaultStartTempoInBpm=m[0].InstantaneousTempo.TempoInBpm)}static cleanExpListStartingEntry(t,f){if(f.length!==0&&f[0].AbsoluteTimestamp.Equals(new l.Fraction(0,1))||(f=[new i.MultiTempoExpression(t.SourceMeasures[0],new l.Fraction(0,1))].concat(f)),!f[0].InstantaneousTempo){const m=new r.InstantaneousTempoExpression("*generated",u.PlacementEnum.Above,1,0,f[0],!0);f[0].addExpression(m,"")}const p=f[0].InstantaneousTempo;return p.TempoInBpm!==0||(p.TempoInBpm===0&&t.DefaultStartTempoInBpm>0&&(p.TempoInBpm=t.DefaultStartTempoInBpm),p.TempoInBpm===0&&(p.TempoInBpm=r.InstantaneousTempoExpression.getDefaultValueForInstTempo[r.InstTempo.moderato])),p.TempoInBpm}}g.TemposCalculator=o;class n{static Compare(t,f){let p=0;if(p=n.CompareNumber(t.AbsoluteTimestamp.RealValue,f.AbsoluteTimestamp.RealValue),p!==0)return p;const m=n.calcSortPriority(t),x=n.calcSortPriority(f);return p=n.CompareNumber(m,x),p}static calcSortPriority(t){if(t.InstantaneousTempo!=null){switch(t.InstantaneousTempo.TempoType){case r.TempoType.metronomeMark:return 1;case r.TempoType.inst:return 2;case r.TempoType.change:switch(t.InstantaneousTempo.ChangeSubType){case r.ChangeSubType.atempo:case r.ChangeSubType.doppioMovimento:return 3;case r.ChangeSubType.tempoprimo:return 4}}return 5}return 9}static CompareNumber(t,f){return t<f?-1:t===f?0:1}}g.TempoSorter=n},302(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(4127),g),s(c(9536),g),s(c(5984),g),s(c(6030),g),s(c(6302),g),s(c(7631),g),s(c(3186),g),s(c(1538),g)},7503(de,g,c){var l=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(g,"__esModule",{value:!0}),g.ReaderPluginManager=void 0;const s=l(c(3065));g.ReaderPluginManager=class{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(u){this.voiceMeasureReadPlugins.push(u)}processVoiceMeasureReadPlugins(u,r,i){for(const o of this.voiceMeasureReadPlugins)try{o.measureReadCalculations(u,r,i)}catch(n){s.default.info("VoiceGenerator.addSingleNote: ",n)}}}},469(de,g,c){var l=this&&this.__importDefault||function(F){return F&&F.__esModule?F:{default:F}};Object.defineProperty(g,"__esModule",{value:!0}),g.VoiceGenerator=void 0;const s=c(4249),u=c(5534),r=c(1336),i=c(1850),o=c(2369),n=c(8365),h=c(5274),t=c(2257),f=c(4268),p=c(2561),m=c(9767),x=c(6030),y=c(7307),d=c(8233),S=c(8233),M=c(6644),E=l(c(3065)),L=c(8233),I=c(813),T=c(4127),A=c(4064),v=c(4236),B=c(5282),D=c(9647),_=c(6362);g.VoiceGenerator=class{constructor(F,k,j,P,G=void 0){this.openBeams=[],this.beamNumberOffset=0,this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.staff=k,this.instrument=k.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=P,this.pluginManager=F,this.voice=G?new s.LinkedVoice(this.instrument,j,G):new u.Voice(this.instrument,j),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new x.LyricsReader(this.musicSheet),this.articulationReader=new T.ArticulationReader(this.musicSheet.Rules)}get openTieDict(){return this.staff.openTieDict}get GetVoice(){return this.voice}get OctaveShift(){return this.currentOctaveShift}set OctaveShift(F){this.currentOctaveShift=F}createVoiceEntry(F,k,j,P=!1,G=!1,Y=!1){this.currentVoiceEntry=new r.VoiceEntry(F.clone(),this.voice,k,P,G,Y),j&&this.voice.VoiceEntries.push(this.currentVoiceEntry)}read(F,k,j,P,G,Y,X,ie,oe,$,Q,ne,ee,N,R,O,U,H,W,K){this.currentStaffEntry=X,this.currentMeasure=ie;try{this.currentNote=Y?this.addRestNote(F.element("rest"),k,P,j,G,ee,N,W):this.addSingleNote(F,k,P,j,G,Q,ne,ee,N,R,O,U,H,W),this.currentNote.DotsXml=K;const q=F.elements("lyric");this.lyricsReader!==void 0&&q&&(this.lyricsReader.addLyricEntry(q,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let te=!1;const se=F.element("notations");if(se){this.articulationReader&&this.readArticulations(se,this.currentVoiceEntry,this.currentNote);const ue=se.elements("slur"),fe=se.elements("slide"),xe=se.elements("glissando");this.slurReader!==void 0&&(ue.length>0||fe.length>0)&&!this.currentNote.ParentVoiceEntry.IsGrace&&(this.slurReader.addSlur(ue,this.currentNote),fe.length>0&&this.slurReader.addSlur(fe,this.currentNote),xe.length>0&&this.slurReader.addSlur(xe,this.currentNote));const ve=se.elements("tuplet");ve.length>0&&(this.openTupletNumber=this.addTuplet(F,ve),te=!0);const Se=se.element("arpeggiate");if(Se!==void 0){let Me;if(this.currentVoiceEntry.Arpeggio)Me=this.currentVoiceEntry.Arpeggio;else{let _e=!1;for(const Te of this.currentStaffEntry.VoiceEntries)if(Te.Arpeggio){_e=!0,Me=Te.Arpeggio;break}if(!_e){let Te=v.ArpeggioType.ARPEGGIO_DIRECTIONLESS;const Le=Se.attribute("direction");if(Le)switch(Le.value){case"up":Te=v.ArpeggioType.ROLL_UP;break;case"down":Te=v.ArpeggioType.ROLL_DOWN;break;default:Te=v.ArpeggioType.ARPEGGIO_DIRECTIONLESS}Me=new v.Arpeggio(this.currentVoiceEntry,Te),this.currentVoiceEntry.Arpeggio=Me}}Me.addNote(this.currentNote)}const ye=se.elements("tied");ye.length>0&&this.addTie(ye,oe,$,t.TieTypes.SIMPLE);const be=se.element("technical");if(be){const Me=be.elements("hammer-on");Me.length>0&&this.addTie(Me,oe,$,t.TieTypes.HAMMERON);const _e=be.elements("pull-off");_e.length>0&&this.addTie(_e,oe,$,t.TieTypes.PULLOFF)}}F.element("time-modification")===void 0||te||this.handleTimeModificationNode(F)}catch(q){E.default.warn(q);const te=m.ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(te),this.musicSheet.SheetErrors.pushMeasureError(q)}return this.currentNote}checkForStaffEntryLink(F,k,j,P){const G=new M.StaffEntryLink(this.currentVoiceEntry);G.LinkStaffEntries.push(j),j.Link=G;const Y=this.currentVoiceEntry.Timestamp.clone(),X=P.getVerticalContainerByTimestamp(Y);return(j=X.StaffEntries[F])||(j=new o.SourceStaffEntry(X,k),X.StaffEntries[F]=j),j.VoiceEntries.push(this.currentVoiceEntry),G.LinkStaffEntries.push(j),j.Link=G,j}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const F=this.openTieDict;for(const k in F)if(F.hasOwnProperty(k)){const j=F[k];p.Fraction.plus(j.StartNote.ParentStaffEntry.Timestamp,j.Duration).lt(j.StartNote.SourceMeasure.Duration)&&delete F[k]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(F,k,j){const P=F.element("articulations");P&&this.articulationReader.addArticulationExpression(P,k);const G=F.element("fermata");G&&this.articulationReader.addFermata(G,k);const Y=F.element("technical");Y&&this.articulationReader.addTechnicalArticulations(Y,k,j);const X=F.element("ornaments");X&&this.articulationReader.addOrnament(X,k)}addSingleNote(F,k,j,P,G,Y,X,ie,oe,$,Q,ne,ee,N){let R,O,U,H,W=0,K=d.AccidentalEnum.NONE,q=S.NoteEnum.C,te=S.NoteEnum.C,se=0,ue=0;const fe=F.elements();for(let Te=0,Le=fe.length;Te<Le;++Te){const Pe=fe[Te];try{if(Pe.name==="pitch"){const Ae=Pe.elements();for(let Ce=0,Be=Ae.length;Ce<Be;++Ce){const Ie=Ae[Ce];U=void 0,H=void 0;try{if(Ie.name==="step"){if(q=S.NoteEnum[Ie.value],q===void 0){const Fe=m.ITextTranslation.translateText("ReaderErrorMessages/NotePitchError","Invalid pitch while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(Fe),new y.MusicSheetReadingException(Fe,void 0)}}else if(Ie.name==="alter"){if(W=parseFloat(Ie.value),isNaN(W)){const Fe=m.ITextTranslation.translateText("ReaderErrorMessages/NoteAlterationError","Invalid alteration while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(Fe),new y.MusicSheetReadingException(Fe,void 0)}K=L.Pitch.AccidentalFromHalfTones(W)}else if(Ie.name==="octave"&&(se=parseInt(Ie.value,10),isNaN(se))){const Fe=m.ITextTranslation.translateText("ReaderErrorMessages/NoteOctaveError","Invalid octave value while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(Fe),new y.MusicSheetReadingException(Fe,void 0)}}catch(Fe){E.default.info("VoiceGenerator.addSingleNote read Step: ",Fe.message)}}}else if(Pe.name==="accidental")R=Pe.value,R==="natural"?K=d.AccidentalEnum.NATURAL:R==="slash-flat"?K=d.AccidentalEnum.SLASHFLAT:R==="slash-quarter-sharp"?K=d.AccidentalEnum.SLASHQUARTERSHARP:R==="slash-sharp"?K=d.AccidentalEnum.SLASHSHARP:R==="double-slash-flat"?K=d.AccidentalEnum.DOUBLESLASHFLAT:R==="sori"?K=d.AccidentalEnum.SORI:R==="koron"&&(K=d.AccidentalEnum.KORON);else if(Pe.name==="unpitched"){const Ae=Pe.element("display-step"),Ce=Pe.element("display-octave");if(Ce&&(se=parseInt(Ce.value,10),ue=se-3,X&&(se+=1),this.instrument.Staves[0].StafflineCount===1&&(ue+=1)),Ae){q=S.NoteEnum[Ae.value.toUpperCase()];let Be=0,Ie=this.musicSheet.Rules.PercussionXMLDisplayStepNoteValueShift;this.instrument.Staves[0].StafflineCount===1&&(Ie-=3),[te,Be]=L.Pitch.lineShiftFromNoteEnum(q,Ie),ue+=Be}}else Pe.name==="instrument"?Pe.firstAttribute&&(O=Pe.firstAttribute.value):Pe.name==="notehead"&&(U=Pe.value,Pe.attribute("filled")&&(H=Pe.attribute("filled").value==="yes"))}catch(Ae){E.default.info("VoiceGenerator.addSingleNote: ",Ae)}}se-=L.Pitch.OctaveXmlDifference;const xe=new L.Pitch(q,se,K,R),ve=p.Fraction.createFromFraction(k);let Se,ye=-1,be=-1;const Me=[],_e=F.element("notations");if(_e){const Te=_e.element("technical");if(Te){const Le=Te.element("string");Le&&(ye=parseInt(Le.value,10));const Pe=Te.element("fret");Pe&&(be=parseInt(Pe.value,10)),Te.elements("bend").forEach(function(Ae){const Ce=Ae.element("bend-alter");Ae.element("release")!==void 0?Me.push({bendalter:parseInt(Ce.value,10),direction:"down"}):Me.push({bendalter:parseInt(Ce.value,10),direction:"up"})})}}return Se=ye<0||be<0?new i.Note(this.currentVoiceEntry,this.currentStaffEntry,ve,xe,this.currentMeasure):new D.TabNote(this.currentVoiceEntry,this.currentStaffEntry,ve,xe,this.currentMeasure,ye,be,Me),this.addNoteInfo(Se,j,ie,oe,G,te,ue,N,N),Se.TypeLength=P,Se.IsGraceNote=$,Se.StemDirectionXml=Q,Se.TremoloInfo=ne,Se.PlaybackInstrumentId=O,(U!==void 0&&U!=="normal"||H!==void 0)&&(Se.Notehead=new A.Notehead(Se,U,H)),Q===r.StemDirectionType.None&&(ee="#00000000"),this.currentVoiceEntry.Notes.push(Se),this.currentVoiceEntry.StemDirectionXml=Q,ee&&(this.currentVoiceEntry.StemColorXml=ee,this.currentVoiceEntry.StemColor=ee,Se.StemColorXml=ee),F.elements("beam")&&!Y&&this.createBeam(F,Se),Se}addRestNote(F,k,j,P,G,Y,X,ie){const oe=p.Fraction.createFromFraction(k),$=F.element("display-step"),Q=F.element("display-octave");let ne,ee,N;$&&Q&&(ne=S.NoteEnum[$.value.toUpperCase()],ee=parseInt(Q.value,10),N=new L.Pitch(ne,ee,d.AccidentalEnum.NONE,void 0,!0));const R=new i.Note(this.currentVoiceEntry,this.currentStaffEntry,oe,N,this.currentMeasure,!0);return this.addNoteInfo(R,j,Y,X,G,ne,ee,ie,ie),R.TypeLength=P,this.currentVoiceEntry.Notes.push(R),this.openBeams.length>0&&this.openBeams.last().ExtendedNoteList.push(R),R}addNoteInfo(F,k,j,P,G,Y,X,ie,oe){F.NoteTypeXml=k,F.PrintObject=j,F.IsCueNote=P,F.NormalNotes=G,F.displayStepUnpitched=Y,F.displayOctaveUnpitched=X,F.NoteheadColorXml=ie,F.NoteheadColor=ie}createBeam(F,k){var j;try{const P=F.element("beam");let G;if(P!==void 0&&P.hasAttributes&&(G=P.attribute("number")),G){let Y=parseInt(G.value,10);const X=F.elements("beam"),ie=X[0].value;X&&(ie==="begin"?(Y===((j=this.openBeams.last())==null?void 0:j.BeamNumber)?(this.beamNumberOffset++,Y+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new n.Beam(Y,this.beamNumberOffset))):Y+=this.beamNumberOffset);let oe=!1;if(!(Y>0&&Y<=this.openBeams.length&&this.openBeams[Y-1]))return void E.default.debug("[OSMD] invalid beamnumber");for(let $=0,Q=this.openBeams[Y-1].Notes.length;$<Q;++$){const ne=this.openBeams[Y-1].Notes[$];this.currentVoiceEntry===ne.ParentVoiceEntry&&(oe=!0)}if(!oe){const $=this.openBeams[Y-1];if($.addNoteToBeam(k),ie==="continue"&&X.length>1){for(let Q=1;Q<X.length;Q++)if(X[Q].value==="end"){const ne=$.Notes.length-1;ne>0&&$.SecondaryBreakIndices.push(ne);break}}ie==="end"&&this.endBeam()}}}catch(P){const G=m.ITextTranslation.translateText("ReaderErrorMessages/BeamError","Error while reading beam.");throw this.musicSheet.SheetErrors.pushMeasureError(G),new y.MusicSheetReadingException("",P)}}endBeam(){this.openBeams.pop(),this.beamNumberOffset=Math.max(0,this.beamNumberOffset-1)}handleOpenBeam(){const F=this.openBeams.last();if(F.Notes.length!==0){if(F.Notes.length===1)return F.Notes[0].NoteBeam=void 0,void this.endBeam();if(this.currentNote===I.CollectionUtil.last(F.Notes))this.endBeam();else{const k=I.CollectionUtil.last(F.Notes).ParentStaffEntry,j=this.currentMeasure.getVerticalContainerIndexByTimestamp(k.Timestamp),P=k.VerticalContainerParent.StaffEntries.indexOf(k);if(j<this.currentMeasure.VerticalSourceStaffEntryContainers.length-1){const G=this.currentMeasure.VerticalSourceStaffEntryContainers[j+1].StaffEntries[P];if(G)for(let Y=0,X=G.VoiceEntries.length;Y<X;++Y){const ie=G.VoiceEntries[Y];if(ie.ParentVoice===this.voice){const oe=ie.Notes[0];oe.Length.lte(new p.Fraction(1,8))?(this.openBeams.last().addNoteToBeam(oe),this.endBeam()):this.endBeam()}}}else this.endBeam()}}else this.endBeam()}addTuplet(F,k){let j,P=!1;if(k!==void 0&&k.length>1){let G=F.element("time-modification");G&&(G=G.element("actual-notes"));const Y=k;for(let X=0,ie=Y.length;X<ie;++X){const oe=Y[X];if(oe!==void 0&&oe.attributes()){const $=oe.attribute("bracket");$&&$.value==="yes"?(P=!0,j=!0):$&&$.value==="no"&&(j=!1);let Q=this.musicSheet.Rules.TupletsRatioed;const ne=oe.attribute("show-number");ne&&ne.value==="both"&&this.musicSheet.Rules.TupletsRatioedUseXMLValue&&(Q=!0);const ee=this.readShowNumberNoneGiven(oe),N=oe.attribute("type");if(N&&N.value==="start"){let R=1;oe.attribute("number")&&(R=parseInt(oe.attribute("number").value,10));let O=0;if(G&&(O=parseInt(G.value,10),isNaN(O))){const K=m.ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(K),new y.MusicSheetReadingException(K,void 0)}const U=new f.Tuplet(O,P);U.Ratioed=Q,U.BracketedXmlValue=j,U.ShowNumberNoneGivenInXml=ee,U.tupletLabelNumberPlacement=_.PlacementEnum.Above;const H=oe.attribute("placement");H&&(H.value==="below"&&(U.tupletLabelNumberPlacement=_.PlacementEnum.Below),U.PlacementFromXml=!0),this.tupletDict[R]&&(delete this.tupletDict[R],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--),this.tupletDict[R]=U;const W=[];W.push(this.currentNote),U.Notes.push(W),U.Fractions.push(this.getTupletNoteDurationFromType(F)),this.currentNote.NoteTuplet=U,this.openTupletNumber=R}else if(N.value==="stop"){let R=1;oe.attribute("number")&&(R=parseInt(oe.attribute("number").value,10));const O=this.tupletDict[R];if(O){const U=oe.attribute("placement");U&&(U.value==="below"?O.tupletLabelNumberPlacement=_.PlacementEnum.Below:O.tupletLabelNumberPlacement=_.PlacementEnum.Above,O.PlacementFromXml=!0);const H=[];if(H.push(this.currentNote),O.Notes.push(H),!O.PlacementFromXml){let W=!1;for(const K of O.Notes){for(const q of K)if(!q.isRest()){q.StemDirectionXml===r.StemDirectionType.Down?O.tupletLabelNumberPlacement=_.PlacementEnum.Below:O.tupletLabelNumberPlacement=_.PlacementEnum.Above,W=!0;break}if(W)break}}O.Fractions.push(this.getTupletNoteDurationFromType(F)),this.currentNote.NoteTuplet=O,delete this.tupletDict[R],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(k[0]){const G=k[0];if(G.hasAttributes){const Y=G.attribute("type").value;let X=1;G.attribute("number")&&(X=parseInt(G.attribute("number").value,10));const ie=isNaN(X),oe=this.readShowNumberNoneGiven(G),$=G.attribute("bracket");$&&$.value==="yes"?(P=!0,j=!0):$&&$.value==="no"&&(j=!1);let Q=this.musicSheet.Rules.TupletsRatioed;const ne=G.attribute("show-number");if(ne&&ne.value==="both"&&this.musicSheet.Rules.TupletsRatioedUseXMLValue&&(Q=!0),Y==="start"){let ee=0,N=F.element("time-modification");if(N&&(N=N.element("actual-notes")),N&&(ee=parseInt(N.value,10),isNaN(ee))){const H=m.ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(H),new y.MusicSheetReadingException(H)}ie&&(this.openTupletNumber++,X=this.openTupletNumber);let R=this.tupletDict[X];R||(R=this.tupletDict[X]=new f.Tuplet(ee,P),R.Ratioed=Q,R.BracketedXmlValue=j,R.ShowNumberNoneGivenInXml=oe,R.tupletLabelNumberPlacement=_.PlacementEnum.Above);const O=G.attribute("placement");O&&(O.value==="below"?R.tupletLabelNumberPlacement=_.PlacementEnum.Below:R.tupletLabelNumberPlacement=_.PlacementEnum.Above,R.PlacementFromXml=!0);const U=[];U.push(this.currentNote),R.Notes.push(U),R.Fractions.push(this.getTupletNoteDurationFromType(F)),this.currentNote.NoteTuplet=R,this.openTupletNumber=X}else if(Y==="stop"){ie&&(X=this.openTupletNumber);const ee=this.tupletDict[this.openTupletNumber];if(ee){const N=G.attribute("placement");N&&(N.value==="below"?ee.tupletLabelNumberPlacement=_.PlacementEnum.Below:ee.tupletLabelNumberPlacement=_.PlacementEnum.Above,ee.PlacementFromXml=!0);const R=[];if(R.push(this.currentNote),ee.Notes.push(R),!ee.PlacementFromXml){let O=!1;for(const U of ee.Notes){for(const H of U)if(!H.isRest()){H.StemDirectionXml===r.StemDirectionType.Down?ee.tupletLabelNumberPlacement=_.PlacementEnum.Below:ee.tupletLabelNumberPlacement=_.PlacementEnum.Above,O=!0;break}if(O)break}}ee.Fractions.push(this.getTupletNoteDurationFromType(F)),this.currentNote.NoteTuplet=ee,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[X]}}}}return this.openTupletNumber}readShowNumberNoneGiven(F){const k=F.attribute("show-number");return!(!(k!=null&&k.value)||k.value!=="none")}handleTimeModificationNode(F){if(this.tupletDict[this.openTupletNumber])try{const k=this.tupletDict[this.openTupletNumber],j=I.CollectionUtil.last(k.Notes);let P;j[0].ParentVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?P=j:(P=[],k.Notes.push(P),k.Fractions.push(this.getTupletNoteDurationFromType(F))),P.push(this.currentNote),this.currentNote.NoteTuplet=k}catch(k){const j=m.ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(j),k}else if(this.currentVoiceEntry.Notes.length>0){const k=this.currentVoiceEntry.Notes[0];if(k.NoteTuplet){const j=k.NoteTuplet;I.CollectionUtil.last(j.Notes).push(this.currentNote),this.currentNote.NoteTuplet=j}}}addTie(F,k,j,P){if(F){if(F.length===1){const G=F[0];if(G!==void 0&&G.attributes()){const Y=this.getTieDirection(G),X=G.attribute("type").value;try{if(X==="start"){const ie=this.findCurrentNoteInTieDict(this.currentNote);ie<0&&delete this.openTieDict[ie];const oe=this.getNextAvailableNumberForTie(),$=new h.Tie(this.currentNote,P);this.openTieDict[oe]=$,$.TieNumber=oe,$.TieDirection=Y}else if(X==="stop"){const ie=this.findCurrentNoteInTieDict(this.currentNote),oe=this.openTieDict[ie];oe&&(oe.AddNote(this.currentNote),delete this.openTieDict[ie])}}catch{const oe=m.ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(oe)}}}else if(F.length===2){const G=this.findCurrentNoteInTieDict(this.currentNote);if(G>=0){const Y=this.openTieDict[G];Y.AddNote(this.currentNote);for(const X of F)if(X.attribute("type").value==="start"){const ie=this.getTieDirection(X);Y.NoteIndexToTieDirection[Y.Notes.length-1]=ie}}}}}getTieDirection(F){let k=_.PlacementEnum.NotYetDefined;const j=F.attribute("placement");j&&(j.value==="above"?k=_.PlacementEnum.Above:j.value==="below"&&(k=_.PlacementEnum.Below));const P=F.attribute("orientation");return P&&(P.value==="over"?k=_.PlacementEnum.Above:P.value==="under"&&(k=_.PlacementEnum.Below)),k}getNextAvailableNumberForTie(){const F=Object.keys(this.openTieDict);if(F.length===0)return 1;F.sort((k,j)=>+k-+j);for(let k=0;k<F.length;k++)if(""+(k+1)!==F[k])return k+1;return+F[F.length-1]+1}findCurrentNoteInTieDict(F){const k=this.openTieDict;for(const j in k)if(k.hasOwnProperty(j)){const P=k[j],G=P.Notes[0],Y=F;if(P.Pitch.FundamentalNote===F.Pitch.FundamentalNote&&P.Pitch.Octave===F.Pitch.Octave||G.StringNumberTab!==void 0&&G.StringNumberTab===Y.StringNumberTab)return parseInt(j,10)}return-1}getTupletNoteDurationFromType(F){if(F.element("type")){const k=F.element("type");if(k){const j=k.value;try{return B.NoteTypeHandler.getNoteDurationFromType(j)}catch(P){const G=m.ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(G),new y.MusicSheetReadingException("",P)}}}}}},6352(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(1272),g),s(c(9099),g),s(c(5749),g),s(c(469),g),s(c(302),g),s(c(7503),g)},5294(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.SubInstrument=void 0;const s=c(164),u=l(c(3065));class r{constructor(o){this.parentInstrument=o,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=r.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(o){return o===s.MidiInstrument.Acoustic_Grand_Piano||o===s.MidiInstrument.Bright_Acoustic_Piano||o===s.MidiInstrument.Electric_Grand_Piano||o===s.MidiInstrument.Electric_Piano_1||o===s.MidiInstrument.Electric_Piano_2}setMidiInstrument(o){this.midiInstrumentID=r.midiInstrument[this.parseMidiInstrument(o)]}parseMidiInstrument(o){try{if(o){const n=o.toLowerCase().trim();for(const h in r.midiInstrument)if(n.indexOf(h)!==-1)return h}if(this.parentInstrument.Name){const n=this.parentInstrument.Name.toLowerCase().trim();for(const h in r.midiInstrument)if(n.indexOf(h)!==-1)return h}}catch{u.default.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}}g.SubInstrument=r,r.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,blockfloete: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,floete: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}},4236(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.ArpeggioType=g.Arpeggio=void 0,g.Arpeggio=class{constructor(l,s=c.ARPEGGIO_DIRECTIONLESS){this.parentVoiceEntry=l,this.type=s,this.notes=[]}addNote(l){this.notes.push(l),l.Arpeggio=this}},function(l){l[l.BRUSH_DOWN=1]="BRUSH_DOWN",l[l.BRUSH_UP=2]="BRUSH_UP",l[l.ROLL_DOWN=3]="ROLL_DOWN",l[l.ROLL_UP=4]="ROLL_UP",l[l.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",l[l.RASQUEDO_UP=6]="RASQUEDO_UP",l[l.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS"}(c||(g.ArpeggioType=c={}))},9003(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.Articulation=void 0,g.Articulation=class{constructor(c,l){this.articulationEnum=c,this.placement=l}Equals(c){return c.articulationEnum===this.articulationEnum&&c.placement===this.placement}}},8365(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.BeamEnum=g.Beam=void 0,g.Beam=class{constructor(l=1,s=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.AutoGenerated=!1,this.SecondaryBreakIndices=[],this.BeamNumber=l,this.BeamNumberOffsetToXML=s}get Notes(){return this.notes}set Notes(l){this.notes=l}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(l){this.extendedNoteList=l}addNoteToBeam(l){l&&(l.NoteBeam=this,this.notes.push(l),this.extendedNoteList.push(l))}},function(l){l[l.BeamNone=-1]="BeamNone",l[l.BeamBegin=0]="BeamBegin",l[l.BeamContinue=1]="BeamContinue",l[l.BeamEnd=2]="BeamEnd",l[l.BeamForward=3]="BeamForward",l[l.BeamBackward=4]="BeamBackward"}(c||(g.BeamEnum=c={}))},9719(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.ChordSymbolEnum=g.ChordDegreeText=g.CustomChord=g.Degree=g.ChordSymbolContainer=void 0;const l=c(8233),s=c(7921),u=c(8233),r=c(6362);g.ChordSymbolContainer=class{constructor(h,t,f,p,m,x=r.PlacementEnum.Above){this.rootPitch=h,this.chordKind=t,this.bassPitch=f,this.degrees=p,this.rules=m,this.Placement=x}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(h,t,f){if(h.NumeralText!==void 0)return h.NumeralText;let p=h.RootPitch;if(s.MusicSheetCalculator.transposeCalculator&&(p=s.MusicSheetCalculator.transposeCalculator.transposePitch(h.RootPitch,f,t)),h.ChordKind===n.none)return h.getTextFromChordKindEnum(h.ChordKind);let m=l.Pitch.getNoteEnumString(p.FundamentalNote);p.Accidental!==u.AccidentalEnum.NONE&&(m+=h.getTextForAccidental(p.Accidental));const x={adds:[],alts:[],subs:[]};for(const M of h.ChordDegrees)if(M){let E="";switch(M.alteration!==u.AccidentalEnum.NONE&&(E+=h.getTextForAccidental(M.alteration)),E+=M.value,M.text){case o.add:x.adds.push(E);break;case o.alter:x.alts.push(E);break;case o.subtract:x.subs.push(E)}}let y=h.getTextFromChordKindEnum(h.ChordKind);const d=["adds","alts","subs"],S=h.rules.CustomChords;for(const M of S){if(M.chordKind!==h.chordKind)continue;let E=!0;for(const L of d){for(const I of M.degrees[L]||[])if(x[L].indexOf(I)<0){E=!1;break}if(!E)break}if(E){for(const L of d)for(const I of M.degrees[L]||[])x[L].splice(x[L].indexOf(I),1);y=M.alternateName}}if(m+=y,x.adds.length>0&&(m+="("+x.adds.join(",")+")"),x.alts.length>0&&(m+="(alt "+x.alts.join(",")+")"),x.subs.length>0&&(m+="(omit "+x.subs.join(",")+")"),h.BassPitch){let M=h.BassPitch;s.MusicSheetCalculator.transposeCalculator&&(M=s.MusicSheetCalculator.transposeCalculator.transposePitch(h.BassPitch,f,t)),m+="/",m+=l.Pitch.getNoteEnumString(M.FundamentalNote),m+=h.getTextForAccidental(M.Accidental)}return m}getTextForAccidental(h){const t=this.rules.ChordAccidentalTexts.getValue(h);return t!==void 0?t:""}getTextFromChordKindEnum(h){return this.rules.ChordSymbolLabelTexts.getValue(h)??""}},g.Degree=class{constructor(h,t,f){this.value=h,this.alteration=t,this.text=f}};class i{constructor(t,f,p){this.alternateName=t,this.chordKind=f,this.degrees=p}static createCustomChord(t,f,p){return new i(t,f,p)}static renameCustomChord(t,f,p){for(const m of p)m.alternateName===t&&(m.alternateName=f)}}var o,n;g.CustomChord=i,function(h){h[h.add=0]="add",h[h.alter=1]="alter",h[h.subtract=2]="subtract"}(o||(g.ChordDegreeText=o={})),function(h){h[h.major=0]="major",h[h.minor=1]="minor",h[h.augmented=2]="augmented",h[h.diminished=3]="diminished",h[h.dominant=4]="dominant",h[h.majorseventh=5]="majorseventh",h[h.minorseventh=6]="minorseventh",h[h.diminishedseventh=7]="diminishedseventh",h[h.augmentedseventh=8]="augmentedseventh",h[h.halfdiminished=9]="halfdiminished",h[h.majorminor=10]="majorminor",h[h.majorsixth=11]="majorsixth",h[h.minorsixth=12]="minorsixth",h[h.dominantninth=13]="dominantninth",h[h.majorninth=14]="majorninth",h[h.minorninth=15]="minorninth",h[h.dominant11th=16]="dominant11th",h[h.major11th=17]="major11th",h[h.minor11th=18]="minor11th",h[h.dominant13th=19]="dominant13th",h[h.major13th=20]="major13th",h[h.minor13th=21]="minor13th",h[h.suspendedsecond=22]="suspendedsecond",h[h.suspendedfourth=23]="suspendedfourth",h[h.Neapolitan=24]="Neapolitan",h[h.Italian=25]="Italian",h[h.French=26]="French",h[h.German=27]="German",h[h.pedal=28]="pedal",h[h.power=29]="power",h[h.Tristan=30]="Tristan",h[h.none=31]="none"}(n||(g.ChordSymbolEnum=n={}))},6362(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.PlacementEnum=g.AbstractExpression=void 0,g.AbstractExpression=class{constructor(l){this.placement=l}static isStringInStringList(l,s){for(let u=0,r=l.length;u<r;++u){const i=l[u];if(s.toLowerCase()===i.toLowerCase().trim())return!0}return!1}get Placement(){return this.placement}static PlacementEnumFromString(l){switch(l.toLowerCase()){case"above":return c.Above;case"below":return c.Below;case"aboveorbelow":case"abovebelow":return c.AboveOrBelow;case"left":return c.Left;case"right":return c.Right;default:return c.NotYetDefined}}},function(l){l[l.Above=0]="Above",l[l.Below=1]="Below",l[l.Left=2]="Left",l[l.Right=3]="Right",l[l.NotYetDefined=4]="NotYetDefined",l[l.AboveOrBelow=5]="AboveOrBelow"}(c||(g.PlacementEnum=c={}))},9147(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.AbstractTempoExpression=void 0;const l=c(6362);class s extends l.AbstractExpression{constructor(r,i,o,n){super(i),this.label=r,this.staffNumber=o,this.parentMultiTempoExpression=n}get Label(){return this.label}set Label(r){this.label=r}get Placement(){return this.placement}set Placement(r){this.placement=r}get StaffNumber(){return this.staffNumber}set StaffNumber(r){this.staffNumber=r}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}static isStringInStringList(r,i){for(const o of r)if(s.stringContainsSeparatedWord(i.toLowerCase().trim(),o.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(r,i){return r===i||r.indexOf(" "+i)!==-1||r.indexOf(i+" ")!==-1}}g.AbstractTempoExpression=s},5875(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.ContDynamicEnum=g.ContinuousDynamicExpression=void 0;const l=c(6362),s=c(2561);class u extends l.AbstractExpression{constructor(o,n,h,t,f,p=""){super(n),this.parentMeasure=t,this.NumberXml=f,this.dynamicType=o,this.label=p,this.staffNumber=h,this.startVolume=-1,this.endVolume=-1,p!==""&&this.setType()}get DynamicType(){return this.dynamicType}set DynamicType(o){this.dynamicType=o}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(o){this.startMultiExpression=o}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(o){this.endMultiExpression=o}get Placement(){return this.placement}set Placement(o){this.placement=o}get StartVolume(){return this.startVolume}set StartVolume(o){this.startVolume=o}get EndVolume(){return this.endVolume}set EndVolume(o){this.endVolume=o}get StaffNumber(){return this.staffNumber}set StaffNumber(o){this.staffNumber=o}get Label(){return this.label}set Label(o){this.label=o,this.setType()}static isInputStringContinuousDynamic(o){return!!o&&(u.isStringInStringList(u.listContinuousDynamicIncreasing,o)||u.isStringInStringList(u.listContinuousDynamicDecreasing,o))}getInterpolatedDynamic(o){const n=this.StartMultiExpression.AbsoluteTimestamp;let h;if(h=this.EndMultiExpression?this.EndMultiExpression.AbsoluteTimestamp:s.Fraction.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),o.lt(n))return-1;if(h.lt(o))return-2;const t=s.Fraction.minus(o,n).RealValue/s.Fraction.minus(h,n).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*t))}isWedge(){return!this.label}setType(){u.isStringInStringList(u.listContinuousDynamicIncreasing,this.label)?this.dynamicType=r.crescendo:u.isStringInStringList(u.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=r.diminuendo)}}var r;g.ContinuousDynamicExpression=u,u.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."],u.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"],function(i){i[i.crescendo=0]="crescendo",i[i.diminuendo=1]="diminuendo"}(r||(g.ContDynamicEnum=r={}))},2221(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.ContinuousTempoType=g.ContinuousTempoExpression=void 0;const l=c(2561),s=c(9147);class u extends s.AbstractTempoExpression{constructor(o,n,h,t){super(o,n,h,t),this.setTempoType()}static isInputStringContinuousTempo(o){return!!o&&(o.endsWith(".")&&(o=o.substring(0,o.length-1)),u.isStringInStringList(u.listContinuousTempoFaster,o)||u.isStringInStringList(u.listContinuousTempoSlower,o))}static isIncreasingTempo(o){return o<=r.piuMosso}static isDecreasingTempo(o){return o>=r.allargando&&o<=r.ritenuto}get TempoType(){return this.tempoType}set TempoType(o){this.tempoType=o}get StartTempo(){return this.startTempo}set StartTempo(o){this.startTempo=o}get EndTempo(){return this.endTempo}set EndTempo(o){this.endTempo=o}get AbsoluteStartTimestamp(){return l.Fraction.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp)}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(o){this.absoluteEndTimestamp=o,this.AbsoluteTimeSpan=l.Fraction.minus(this.AbsoluteEndTimestamp,this.AbsoluteStartTimestamp).RealValue}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(o){const n=l.Fraction.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(o.lt(n))return-1;if(this.absoluteEndTimestamp.lt(o))return-2;const h=l.Fraction.minus(o,n).RealValue/l.Fraction.minus(this.absoluteEndTimestamp,n).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*h))}setTempoType(){u.isStringInStringList(u.listContinuousTempoFaster,this.label)?this.tempoType=r.accelerando:u.isStringInStringList(u.listContinuousTempoSlower,this.label)&&(this.tempoType=r.ritardando)}getTempoFactor(o=this.Label){return 1}}var r;g.ContinuousTempoExpression=u,u.listContinuousTempoFaster=["accelerando","accel","piu mosso","poco piu","stretto"],u.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","calando","allargando","rallentando","ritardando","ritenuto","ritard.","ritard","rit.","rit","riten.","riten"],function(i){i[i.accelerando=0]="accelerando",i[i.stretto=1]="stretto",i[i.stringendo=2]="stringendo",i[i.mosso=3]="mosso",i[i.piuMosso=4]="piuMosso",i[i.allargando=5]="allargando",i[i.calando=6]="calando",i[i.menoMosso=7]="menoMosso",i[i.rallentando=8]="rallentando",i[i.ritardando=9]="ritardando",i[i.ritard=10]="ritard",i[i.rit=11]="rit",i[i.ritenuto=12]="ritenuto",i[i.rubato=13]="rubato",i[i.precipitando=14]="precipitando"}(r||(g.ContinuousTempoType=r={}))},437(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.OctaveEnum=g.OctaveShift=void 0;const l=c(8233);var s;g.OctaveShift=class{constructor(u,r){this.numberXml=1,this.endVoiceEntryIndex=0,this.setOctaveShiftValue(u,r)}get Type(){return this.octaveValue}set Type(u){this.octaveValue=u}get StaffNumber(){return this.staffNumber}set StaffNumber(u){this.staffNumber=u}get ParentStartMultiExpression(){return this.startMultiExpression}set ParentStartMultiExpression(u){this.startMultiExpression=u}get ParentEndMultiExpression(){return this.endMultiExpression}set ParentEndMultiExpression(u){this.endMultiExpression=u}setOctaveShiftValue(u,r){this.octaveValue=r===1&&u==="down"?s.VA8:r===1&&u==="up"?s.VB8:r===2&&u==="down"?s.MA15:r===2&&u==="up"?s.MB15:s.NONE}static getPitchFromOctaveShift(u,r){if(!u)return;if(u.OctaveShiftApplied)return u;let i=u.Octave;switch(r){case s.VA8:i-=1;break;case s.VB8:i+=1;break;case s.MA15:i-=2;break;case s.MB15:i+=2;break;case s.NONE:default:i+=0}const o=new l.Pitch(u.FundamentalNote,i,u.Accidental);return o.OctaveShiftApplied=!0,o}},function(u){u[u.VA8=0]="VA8",u[u.VB8=1]="VB8",u[u.MA15=2]="MA15",u[u.MB15=3]="MB15",u[u.NONE=4]="NONE"}(s||(g.OctaveEnum=s={}))},3253(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.Pedal=void 0,g.Pedal=class{constructor(c=!1,l=!0){this.ChangeEnd=!1,this.ChangeBegin=!1,this.EndsStave=!1,this.BeginsStave=!1,this.line=c,this.sign=l}get IsLine(){return this.line}get IsSign(){return this.sign}}},6229(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Slur=void 0;const l=c(2561);g.Slur=class{constructor(){}get StartNote(){return this.startNote}set StartNote(s){this.startNote=s}get EndNote(){return this.endNote}set EndNote(s){this.endNote=s}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let s=0,u=this.startNote.NoteSlurs.length;s<u;++s){const r=this.startNote.NoteSlurs[s];if(r!==this&&r.StartNote===this.startNote)return!0}return!1}endNoteHasMoreEndingSlurs(){if(!this.endNote)return!1;for(let s=0,u=this.endNote.NoteSlurs.length;s<u;++s){const r=this.endNote.NoteSlurs[s];if(r!==this&&r.EndNote===this.endNote)return!0}return!1}isCrossed(){return this.startNote.ParentStaffEntry.ParentStaff!==this.endNote.ParentStaffEntry.ParentStaff}isSlurLonger(){if(!this.endNote||!this.startNote)return!1;const s=l.Fraction.minus(this.endNote.getAbsoluteTimestamp(),this.startNote.getAbsoluteTimestamp());for(let u=0,r=this.startNote.NoteSlurs.length;u<r;++u){const i=this.startNote.NoteSlurs[u];if(i!==this&&i.EndNote!==void 0&&i.StartNote!==void 0&&l.Fraction.minus(i.EndNote.getAbsoluteTimestamp(),i.StartNote.getAbsoluteTimestamp()).CompareTo(s)===-1)return!0}for(let u=0,r=this.endNote.NoteSlurs.length;u<r;++u){const i=this.endNote.NoteSlurs[u];if(i!==this&&i.EndNote!==void 0&&i.StartNote!==void 0&&l.Fraction.minus(i.EndNote.getAbsoluteTimestamp(),i.StartNote.getAbsoluteTimestamp()).CompareTo(s))return!0}return!1}}},6206(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.WavyLine=void 0;const l=c(6362);class s extends l.AbstractExpression{constructor(r){super(r)}}g.WavyLine=s},8045(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(5875),g),s(c(2221),g),s(c(437),g),s(c(6229),g)},6990(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.DynamicExpressionSymbolEnum=void 0,function(l){l[l.p=0]="p",l[l.f=1]="f",l[l.s=2]="s",l[l.z=3]="z",l[l.m=4]="m",l[l.r=5]="r"}(c||(g.DynamicExpressionSymbolEnum=c={}))},2148(de,g,c){var l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(g,"__esModule",{value:!0}),g.DynamicEnum=g.InstantaneousDynamicExpression=void 0;const s=c(6362),u=c(6990),r=c(7307),i=l(c(3065)),o=c(3263);class n extends s.AbstractExpression{static staticConstructor(){n.dynamicToRelativeVolumeDict.setValue(h.ffffff,1),n.dynamicToRelativeVolumeDict.setValue(h.fffff,.9921259842519685),n.dynamicToRelativeVolumeDict.setValue(h.ffff,.984251968503937),n.dynamicToRelativeVolumeDict.setValue(h.fff,.9763779527559056),n.dynamicToRelativeVolumeDict.setValue(h.ff,.9606299212598425),n.dynamicToRelativeVolumeDict.setValue(h.f,.8503937007874016),n.dynamicToRelativeVolumeDict.setValue(h.mf,.5984251968503937),n.dynamicToRelativeVolumeDict.setValue(h.sf,.5),n.dynamicToRelativeVolumeDict.setValue(h.sfp,.5),n.dynamicToRelativeVolumeDict.setValue(h.sfpp,.5),n.dynamicToRelativeVolumeDict.setValue(h.fp,.5),n.dynamicToRelativeVolumeDict.setValue(h.rf,.5),n.dynamicToRelativeVolumeDict.setValue(h.rfz,.5),n.dynamicToRelativeVolumeDict.setValue(h.sfz,.5),n.dynamicToRelativeVolumeDict.setValue(h.sffz,.5),n.dynamicToRelativeVolumeDict.setValue(h.fz,.5),n.dynamicToRelativeVolumeDict.setValue(h.mp,.47244094488188976),n.dynamicToRelativeVolumeDict.setValue(h.p,.2204724409448819),n.dynamicToRelativeVolumeDict.setValue(h.pp,.09448818897637795),n.dynamicToRelativeVolumeDict.setValue(h.ppp,.07874015748031496),n.dynamicToRelativeVolumeDict.setValue(h.pppp,.05511811023622047),n.dynamicToRelativeVolumeDict.setValue(h.ppppp,.03937007874015748),n.dynamicToRelativeVolumeDict.setValue(h.pppppp,.031496062992125984)}constructor(f,p,m,x,y){super(m),this.parentMeasure=y,this.dynamicEnum=h[f.toLowerCase()],this.soundDynamic=p,this.staffNumber=x}get ParentMultiExpression(){return this.multiExpression}set ParentMultiExpression(f){this.multiExpression=f}get DynEnum(){return this.dynamicEnum}set DynEnum(f){this.dynamicEnum=f}get SoundDynamic(){return this.soundDynamic}set SoundDynamic(f){this.soundDynamic=f}get Placement(){return this.placement}set Placement(f){this.placement=f}get StaffNumber(){return this.staffNumber}set StaffNumber(f){this.staffNumber=f}get Length(){return Math.abs(this.length)<1e-4&&(this.length=this.calculateLength()),this.length}get MidiVolume(){return 127*this.Volume}get Volume(){return n.dynamicToRelativeVolumeDict.getValue(this.dynamicEnum)}static isInputStringInstantaneousDynamic(f){return!!f&&n.isStringInStringList(n.listInstantaneousDynamics,f)}getDynamicExpressionSymbol(f){switch(f){case"p":return u.DynamicExpressionSymbolEnum.p;case"f":return u.DynamicExpressionSymbolEnum.f;case"s":return u.DynamicExpressionSymbolEnum.s;case"z":return u.DynamicExpressionSymbolEnum.z;case"m":return u.DynamicExpressionSymbolEnum.m;case"r":return u.DynamicExpressionSymbolEnum.r;default:throw new r.InvalidEnumArgumentException("unknown DynamicExpressionSymbolEnum: "+f)}}calculateLength(){return i.default.debug("[Andrea] instantaneousDynamicExpression: not implemented: calculateLength!"),0}}var h;g.InstantaneousDynamicExpression=n,n.dynamicToRelativeVolumeDict=new o.Dictionary,n.listInstantaneousDynamics=["pppppp","ppppp","pppp","ppp","pp","p","ffffff","fffff","ffff","fff","ff","f","mf","mp","sf","sff","sp","spp","fp","rf","rfz","sfz","sffz","fz"],function(t){t[t.pppppp=0]="pppppp",t[t.ppppp=1]="ppppp",t[t.pppp=2]="pppp",t[t.ppp=3]="ppp",t[t.pp=4]="pp",t[t.p=5]="p",t[t.mp=6]="mp",t[t.mf=7]="mf",t[t.f=8]="f",t[t.ff=9]="ff",t[t.fff=10]="fff",t[t.ffff=11]="ffff",t[t.fffff=12]="fffff",t[t.ffffff=13]="ffffff",t[t.sf=14]="sf",t[t.sff=15]="sff",t[t.sfp=16]="sfp",t[t.sfpp=17]="sfpp",t[t.fp=18]="fp",t[t.rf=19]="rf",t[t.rfz=20]="rfz",t[t.sfz=21]="sfz",t[t.sffz=22]="sffz",t[t.fz=23]="fz",t[t.other=24]="other"}(h||(g.DynamicEnum=h={})),n.staticConstructor()},9161(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.ChangeSubType=g.InstTempo=g.TempoType=g.InstantaneousTempoExpression=void 0;const l=c(9147),s=c(2561);class u extends l.AbstractTempoExpression{constructor(h,t,f,p,m,x=!1){super(h,t,f,m),this.parentMeasure=m.SourceMeasureParent,this.isMetronomeMark=x,this.setTempoAndTempoType(p)}static getDefaultValueForInstTempo(h){switch(h){case i.larghissimo:return 20;case i.grave:return 30;case i.lento:return 48;case i.largo:return 52;case i.larghetto:return 63;case i.adagio:return 70;case i.adagietto:return 75;case i.andanteModerato:return 88;case i.andante:return 92;case i.andantino:return 96;case i.moderato:return 106;case i.allegretto:return 112;case i.allegroModerato:return 118;case i.allegro:return 130;case i.vivace:return 140;case i.vivacissimo:return 155;case i.allegrissimo:return 170;case i.presto:return 184;case i.prestissimo:return 200;default:return 60}}static isInputStringInstantaneousTempo(h){return!!h&&(u.isStringInStringList(u.listInstantaneousTempoLarghissimo,h)||u.isStringInStringList(u.listInstantaneousTempoGrave,h)||u.isStringInStringList(u.listInstantaneousTempoLento,h)||u.isStringInStringList(u.listInstantaneousTempoLargo,h)||u.isStringInStringList(u.listInstantaneousTempoLarghetto,h)||u.isStringInStringList(u.listInstantaneousTempoAdagio,h)||u.isStringInStringList(u.listInstantaneousTempoAdagietto,h)||u.isStringInStringList(u.listInstantaneousTempoAndanteModerato,h)||u.isStringInStringList(u.listInstantaneousTempoAndante,h)||u.isStringInStringList(u.listInstantaneousTempoAndantino,h)||u.isStringInStringList(u.listInstantaneousTempoModerato,h)||u.isStringInStringList(u.listInstantaneousTempoAllegretto,h)||u.isStringInStringList(u.listInstantaneousTempoAllegroModerato,h)||u.isStringInStringList(u.listInstantaneousTempoAllegro,h)||u.isStringInStringList(u.listInstantaneousTempoVivace,h)||u.isStringInStringList(u.listInstantaneousTempoVivacissimo,h)||u.isStringInStringList(u.listInstantaneousTempoAllegrissimo,h)||u.isStringInStringList(u.listInstantaneousTempoPresto,h)||u.isStringInStringList(u.listInstantaneousTempoPrestissimo,h)||u.isStringInStringList(u.listInstantaneousTempoChangesGeneral,h))}get Label(){return this.label}set Label(h){this.label=h}get Placement(){return this.placement}set Placement(h){this.placement=h}get StaffNumber(){return this.staffNumber}set StaffNumber(h){this.staffNumber=h}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(h){this.tempoInBpm=h}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}getAbsoluteTimestamp(){return s.Fraction.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}getAbsoluteFloatTimestamp(){return s.Fraction.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}setTempoAndTempoType(h){if(!this.label)return this.tempoInBpm=h,void(this.TempoType=r.metronomeMark);u.isStringInStringList(u.listInstantaneousTempoLarghissimo,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.larghissimo)),this.tempoInBpm=h,this.InstTempo=i.larghissimo,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoGrave,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.grave)),this.tempoInBpm=h,this.InstTempo=i.grave,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoLento,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.lento)),this.tempoInBpm=h,this.InstTempo=i.lento,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoLargo,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.largo)),this.tempoInBpm=h,this.InstTempo=i.largo,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoLarghetto,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.larghetto)),this.tempoInBpm=h,this.InstTempo=i.larghetto,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAdagio,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.adagio)),this.tempoInBpm=h,this.InstTempo=i.adagio,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAdagietto,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.adagietto)),this.tempoInBpm=h,this.InstTempo=i.adagietto,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAndanteModerato,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.andanteModerato)),this.tempoInBpm=h,this.InstTempo=i.andanteModerato,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAndante,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.andante)),this.tempoInBpm=h,this.InstTempo=i.andante,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAndantino,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.andantino)),this.tempoInBpm=h,this.InstTempo=i.andantino,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoModerato,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.moderato)),this.tempoInBpm=h,this.InstTempo=i.moderato,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAllegretto,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.allegretto)),this.tempoInBpm=h,this.InstTempo=i.allegretto,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAllegroModerato,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.allegroModerato)),this.tempoInBpm=h,this.InstTempo=i.allegroModerato,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAllegro,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.allegro)),this.tempoInBpm=h,this.InstTempo=i.allegro,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoVivace,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.vivace)),this.tempoInBpm=h,this.InstTempo=i.vivace,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoVivacissimo,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.vivacissimo)),this.tempoInBpm=h,this.InstTempo=i.vivacissimo,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAllegrissimo,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.allegrissimo)),this.tempoInBpm=h,this.InstTempo=i.allegrissimo,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoPresto,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.presto)),this.tempoInBpm=h,this.InstTempo=i.presto,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoPrestissimo,this.label)?(h===0&&(h=u.getDefaultValueForInstTempo(i.prestissimo)),this.tempoInBpm=h,this.InstTempo=i.prestissimo,this.TempoType=r.inst):u.isStringInStringList(u.listInstantaneousTempoAddons,this.label)?(this.tempoInBpm=0,this.TempoType=r.addon):u.isStringInStringList(u.listInstantaneousTempoChangesGeneral,this.label)&&(this.tempoInBpm=0,this.TempoType=r.change)}}var r,i,o;g.InstantaneousTempoExpression=u,u.listInstantaneousTempoLarghissimo=["Larghissimo","Sehr breit","very, very slow"],u.listInstantaneousTempoGrave=["Grave","Schwer","slow and solemn"],u.listInstantaneousTempoLento=["Lento","Lent","Langsam","slowly"],u.listInstantaneousTempoLargo=["Largo","Breit","broadly"],u.listInstantaneousTempoLarghetto=["Larghetto","Etwas breit","rather broadly"],u.listInstantaneousTempoAdagio=["Adagio","Langsam","Ruhig","slow and stately"],u.listInstantaneousTempoAdagietto=["Adagietto","Ziemlich ruhig","Ziemlich langsam","rather slow"],u.listInstantaneousTempoAndanteModerato=["Andante moderato"],u.listInstantaneousTempoAndante=["Andante","Gehend","Schreitend","at a walking pace"],u.listInstantaneousTempoAndantino=["Andantino","Maestoso"],u.listInstantaneousTempoModerato=["Moderato","Mäßig","Modéré","moderately"],u.listInstantaneousTempoAllegretto=["Allegretto","Animato","fast"],u.listInstantaneousTempoAllegroModerato=["Allegro moderato"],u.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fröhlich"],u.listInstantaneousTempoVivace=["Vivace","Allegro Assai","Lebhaft","Lebendig","lively and fast"],u.listInstantaneousTempoVivacissimo=["Vivacissimo","Sehr lebhaft","Sehr lebendig"],u.listInstantaneousTempoAllegrissimo=["Allegrissimo","very fast"],u.listInstantaneousTempoPresto=["Presto","Sehr schnell","Geschwind"],u.listInstantaneousTempoPrestissimo=["Prestissimo","äußerst schnell"],u.listInstantaneousTempoChangesGeneral=["tempo primo","a tempo","tempo i","rubato","doppio movimento","rallentando","ritardando","ritard.","rit.","ritard","rall...","accelerando","accel"],u.listInstantaneousTempoAddons=["assai","amoroso","cantabile","con brio","con dolore","con espressione","con fuoco","con moto","con spirito","spiritoso","espressivo","giocoso","giusto","grazioso","lesto","lugubre","maestoso","ma non troppo","marcato","molto","morendo","mosso","non tanto","piu","un poco","poco","quasi","risoluto","scherzando","sostenuto","teneramente","tempo giusto","tranquillo","sehr","lieblich","liebevoll","mit Leidenschaft","mit Liebe","amourös","gesanglich","mit Schwung","mit Feuer","mit Schmerz","mit Ausdruck","mit Bewegung","geistvoll","ausdrucksvoll","freudig","verspielt","angemessen","graziös","mit Grazie","flink","behände","traurig","klagend","majestätisch","aber nicht zu sehr","markant","gemäßigt","viel","sehr","ersterbend","bewegt","nicht zu sehr","mehr","ein wenig","gleichsam","entschlossen","zupackend","heiter","nachdrücklich","getragen","gewichtig","zart","zärtlich","im angemessenen Zeitmaß","ruhig","ein wenig","alla marcia","ad libitum","alla breve"],function(n){n[n.none=0]="none",n[n.metronomeMark=1]="metronomeMark",n[n.inst=2]="inst",n[n.change=3]="change",n[n.addon=4]="addon"}(r||(g.TempoType=r={})),function(n){n[n.larghissimo=0]="larghissimo",n[n.grave=1]="grave",n[n.lento=2]="lento",n[n.largo=3]="largo",n[n.larghetto=4]="larghetto",n[n.adagio=5]="adagio",n[n.adagietto=6]="adagietto",n[n.andanteModerato=7]="andanteModerato",n[n.andante=8]="andante",n[n.andantino=9]="andantino",n[n.moderato=10]="moderato",n[n.allegretto=11]="allegretto",n[n.allegroModerato=12]="allegroModerato",n[n.allegro=13]="allegro",n[n.vivace=14]="vivace",n[n.vivacissimo=15]="vivacissimo",n[n.allegrissimo=16]="allegrissimo",n[n.presto=17]="presto",n[n.prestissimo=18]="prestissimo",n[n.lastRealTempo=19]="lastRealTempo"}(i||(g.InstTempo=i={})),function(n){n[n.none=0]="none",n[n.atempo=1]="atempo",n[n.doppioMovimento=2]="doppioMovimento",n[n.tempoprimo=3]="tempoprimo"}(o||(g.ChangeSubType=o={}))},9803(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MoodEnum=g.MoodExpression=void 0;const l=c(6362);class s extends l.AbstractExpression{constructor(i,o,n){super(o),this.label=i,this.staffNumber=n,this.setMoodType()}static isInputStringMood(i){return!!i&&(s.isStringInStringList(s.listMoodAffettuoso,i)||s.isStringInStringList(s.listMoodAgitato,i)||s.isStringInStringList(s.listMoodAnimato,i)||s.isStringInStringList(s.listMoodAppassionato,i)||s.isStringInStringList(s.listMoodBrillante,i)||s.isStringInStringList(s.listMoodCantabile,i)||s.isStringInStringList(s.listMoodDolce,i)||s.isStringInStringList(s.listMoodEnergico,i)||s.isStringInStringList(s.listMoodEroico,i)||s.isStringInStringList(s.listMoodEspressivo,i)||s.isStringInStringList(s.listMoodFurioso,i)||s.isStringInStringList(s.listMoodGiocoso,i)||s.isStringInStringList(s.listMoodGioioso,i)||s.isStringInStringList(s.listMoodGrandioso,i)||s.isStringInStringList(s.listMoodGrazioso,i)||s.isStringInStringList(s.listMoodLacrimoso,i)||s.isStringInStringList(s.listMoodLeggiero,i)||s.isStringInStringList(s.listMoodMaestoso,i)||s.isStringInStringList(s.listMoodMalinconico,i)||s.isStringInStringList(s.listMoodMarcato,i)||s.isStringInStringList(s.listMoodMarziale,i)||s.isStringInStringList(s.listMoodMesto,i)||s.isStringInStringList(s.listMoodMorendo,i)||s.isStringInStringList(s.listMoodNobilmente,i)||s.isStringInStringList(s.listMoodPatetico,i)||s.isStringInStringList(s.listMoodPesante,i)||s.isStringInStringList(s.listMoodSaltando,i)||s.isStringInStringList(s.listMoodSautille,i)||s.isStringInStringList(s.listMoodScherzando,i)||s.isStringInStringList(s.listMoodSostenuto,i)||s.isStringInStringList(s.listMoodSpiccato,i)||s.isStringInStringList(s.listMoodTenerezza,i)||s.isStringInStringList(s.listMoodTranquillamente,i)||s.isStringInStringList(s.listMoodTrionfante,i))}get Label(){return this.label}set Label(i){this.label=i}get Mood(){return this.moodType}set Mood(i){this.moodType=i}get StaffNumber(){return this.staffNumber}set StaffNumber(i){this.staffNumber=i}get Placement(){return this.placement}set Placement(i){this.placement=i}setMoodType(){s.isStringInStringList(s.listMoodAffettuoso,this.label)?this.moodType=u.Affettuoso:s.isStringInStringList(s.listMoodAgitato,this.label)?this.moodType=u.Agitato:s.isStringInStringList(s.listMoodAnimato,this.label)?this.moodType=u.Animato:s.isStringInStringList(s.listMoodAppassionato,this.label)?this.moodType=u.Appassionato:s.isStringInStringList(s.listMoodBrillante,this.label)?this.moodType=u.Brillante:s.isStringInStringList(s.listMoodCantabile,this.label)?this.moodType=u.Cantabile:s.isStringInStringList(s.listMoodDolce,this.label)?this.moodType=u.Dolce:s.isStringInStringList(s.listMoodEnergico,this.label)?this.moodType=u.Energico:s.isStringInStringList(s.listMoodEroico,this.label)?this.moodType=u.Eroico:s.isStringInStringList(s.listMoodEspressivo,this.label)?this.moodType=u.Espressivo:s.isStringInStringList(s.listMoodFurioso,this.label)?this.moodType=u.Furioso:s.isStringInStringList(s.listMoodGiocoso,this.label)?this.moodType=u.Giocoso:s.isStringInStringList(s.listMoodGioioso,this.label)?this.moodType=u.Gioioso:s.isStringInStringList(s.listMoodGrandioso,this.label)?this.moodType=u.Grandioso:s.isStringInStringList(s.listMoodGrazioso,this.label)?this.moodType=u.Grazioso:s.isStringInStringList(s.listMoodLacrimoso,this.label)?this.moodType=u.Lacrimoso:s.isStringInStringList(s.listMoodLeggiero,this.label)?this.moodType=u.Leggiero:s.isStringInStringList(s.listMoodMaestoso,this.label)?this.moodType=u.Maestoso:s.isStringInStringList(s.listMoodMalinconico,this.label)?this.moodType=u.Malinconico:s.isStringInStringList(s.listMoodMarcato,this.label)?this.moodType=u.Marcato:s.isStringInStringList(s.listMoodMarziale,this.label)?this.moodType=u.Marziale:s.isStringInStringList(s.listMoodMesto,this.label)?this.moodType=u.Mesto:s.isStringInStringList(s.listMoodMorendo,this.label)?this.moodType=u.Morendo:s.isStringInStringList(s.listMoodNobilmente,this.label)?this.moodType=u.Nobilmente:s.isStringInStringList(s.listMoodPatetico,this.label)?this.moodType=u.Patetico:s.isStringInStringList(s.listMoodPesante,this.label)?this.moodType=u.Pesante:s.isStringInStringList(s.listMoodSaltando,this.label)?this.moodType=u.Saltando:s.isStringInStringList(s.listMoodSautille,this.label)?this.moodType=u.Sautille:s.isStringInStringList(s.listMoodScherzando,this.label)?this.moodType=u.Scherzando:s.isStringInStringList(s.listMoodSostenuto,this.label)?this.moodType=u.Sostenuto:s.isStringInStringList(s.listMoodSpiccato,this.label)?this.moodType=u.Spiccato:s.isStringInStringList(s.listMoodTenerezza,this.label)?this.moodType=u.Tenerezza:s.isStringInStringList(s.listMoodTranquillamente,this.label)?this.moodType=u.Tranquillamente:s.isStringInStringList(s.listMoodTrionfante,this.label)&&(this.moodType=u.Trionfante)}}var u;g.MoodExpression=s,s.listMoodAffettuoso=["affettuoso"],s.listMoodAgitato=["agitato"],s.listMoodAppassionato=["appassionato"],s.listMoodAnimato=["animato","lively"],s.listMoodBrillante=["brillante"],s.listMoodCantabile=["cantabile"],s.listMoodDolce=["dolce"],s.listMoodEnergico=["energico"],s.listMoodEroico=["eroico"],s.listMoodEspressivo=["espressivo"],s.listMoodFurioso=["furioso"],s.listMoodGiocoso=["giocoso"],s.listMoodGioioso=["gioioso"],s.listMoodLacrimoso=["lacrimoso"],s.listMoodGrandioso=["grandioso"],s.listMoodGrazioso=["grazioso"],s.listMoodLeggiero=["leggiero"],s.listMoodMaestoso=["maestoso"],s.listMoodMalinconico=["malinconico"],s.listMoodMarcato=["marcato"],s.listMoodMarziale=["marziale"],s.listMoodMesto=["mesto"],s.listMoodMorendo=["morendo"],s.listMoodNobilmente=["nobilmente"],s.listMoodPatetico=["patetico"],s.listMoodPesante=["pesante"],s.listMoodSautille=["sautille"],s.listMoodSaltando=["saltando"],s.listMoodScherzando=["scherzando"],s.listMoodSostenuto=["sostenuto"],s.listMoodSpiccato=["spiccato"],s.listMoodTenerezza=["tenerezza"],s.listMoodTranquillamente=["tranquillamente"],s.listMoodTrionfante=["trionfante"],function(r){r[r.Affettuoso=0]="Affettuoso",r[r.Agitato=1]="Agitato",r[r.Appassionato=2]="Appassionato",r[r.Animato=3]="Animato",r[r.Brillante=4]="Brillante",r[r.Cantabile=5]="Cantabile",r[r.Dolce=6]="Dolce",r[r.Energico=7]="Energico",r[r.Eroico=8]="Eroico",r[r.Espressivo=9]="Espressivo",r[r.Furioso=10]="Furioso",r[r.Giocoso=11]="Giocoso",r[r.Gioioso=12]="Gioioso",r[r.Lacrimoso=13]="Lacrimoso",r[r.Grandioso=14]="Grandioso",r[r.Grazioso=15]="Grazioso",r[r.Leggiero=16]="Leggiero",r[r.Maestoso=17]="Maestoso",r[r.Malinconico=18]="Malinconico",r[r.Marcato=19]="Marcato",r[r.Marziale=20]="Marziale",r[r.Mesto=21]="Mesto",r[r.Morendo=22]="Morendo",r[r.Nobilmente=23]="Nobilmente",r[r.Patetico=24]="Patetico",r[r.Pesante=25]="Pesante",r[r.Sautille=26]="Sautille",r[r.Saltando=27]="Saltando",r[r.Scherzando=28]="Scherzando",r[r.Sostenuto=29]="Sostenuto",r[r.Spiccato=30]="Spiccato",r[r.Tenerezza=31]="Tenerezza",r[r.Tranquillamente=32]="Tranquillamente",r[r.Trionfante=33]="Trionfante",r[r.Vivace=34]="Vivace"}(u||(g.MoodEnum=u={}))},9019(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MultiExpressionEntry=g.MultiExpression=void 0;const l=c(2561),s=c(2148),u=c(5875),r=c(9803),i=c(1112),o=c(6362),n=c(2570);g.MultiExpression=class{constructor(t,f){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=t,this.timestamp=f}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 l.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=o.PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof s.InstantaneousDynamicExpression||this.expressions[0].expression instanceof u.ContinuousDynamicExpression||this.expressions[0].expression instanceof r.MoodExpression||this.expressions[0].expression instanceof i.UnknownExpression)&&(t=this.expressions[0].expression.Placement),t}getFontstyleOfFirstEntry(){let t=n.FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof u.ContinuousDynamicExpression||this.expressions[0].expression instanceof r.MoodExpression?t=n.FontStyles.Italic:this.expressions[0].expression instanceof i.UnknownExpression&&(t=this.expressions[0].expression.fontStyle??n.FontStyles.Regular)),t}getColorXMLOfFirstEntry(){let t;return this.expressions.length>=1&&(t=this.expressions[0].expression.ColorXML),t}addExpression(t,f){t instanceof s.InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=t,this.instantaneousDynamic.ParentMultiExpression=this):t instanceof u.ContinuousDynamicExpression?this.startingContinuousDynamic=t:t instanceof r.MoodExpression?this.moodList.push(t):t instanceof i.UnknownExpression&&this.unknownList.push(t),this.addExpressionToEntryList(t,f)}CompareTo(t){return this.Timestamp.RealValue>t.Timestamp.RealValue?1:this.Timestamp.RealValue<t.Timestamp.RealValue?-1:0}addExpressionToEntryList(t,f){const p=new h;p.prefix=f,p.expression=t,t instanceof u.ContinuousDynamicExpression||t instanceof r.MoodExpression||t instanceof i.UnknownExpression?p.label=t.Label:p.label="",this.expressions.push(p)}removeExpressionFromEntryList(t){for(let f=0,p=this.expressions.length;f<p;++f)if(this.expressions[f].expression===t){this.expressions.splice(f,1);break}}};class h{}g.MultiExpressionEntry=h},5332(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.TempoExpressionEntry=g.MultiTempoExpression=void 0;const l=c(2561),s=c(9161),u=c(6362),r=c(2570),i=c(2221);g.MultiTempoExpression=class{constructor(n,h){this.expressions=[],this.sourceMeasure=n,this.timestamp=h}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return l.Fraction.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(n){this.sourceMeasure=n}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(n){this.combinedExpressionsText=n}getPlacementOfFirstEntry(){let n=u.PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof s.InstantaneousTempoExpression||this.expressions[0].Expression instanceof i.ContinuousTempoExpression)&&(n=this.expressions[0].Expression.Placement),n}getFontstyleOfFirstEntry(){let n=r.FontStyles.Regular;return this.expressions[0].Expression instanceof s.InstantaneousTempoExpression?n=r.FontStyles.Bold:this.expressions[0].Expression instanceof i.ContinuousTempoExpression&&(n=r.FontStyles.Italic),n}addExpression(n,h){if(this.checkIfAlreadyExists(n))return;n instanceof s.InstantaneousTempoExpression?this.instantaneousTempo=n:n instanceof i.ContinuousTempoExpression&&(this.continuousTempo=n);const t=new o;t.prefix=h,t.Expression=n,t.label=n.Label,this.expressions.push(t)}CompareTo(n){return this.Timestamp.RealValue>n.Timestamp.RealValue?1:this.Timestamp.RealValue<n.Timestamp.RealValue?-1:0}checkIfAlreadyExists(n){for(const h of this.expressions)if(h.label===n.Label)return!0;return!1}clearInstantaneousTempo(){this.instantaneousTempo=void 0}clearContinuousTempo(){this.continuousTempo=void 0}};class o{get Expression(){return this.expression}set Expression(h){this.expression=h}}g.TempoExpressionEntry=o},9157(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.RehearsalExpression=void 0;const l=c(6362);class s extends l.AbstractExpression{constructor(r,i){super(i),this.label=r}}g.RehearsalExpression=s},1112(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.UnknownExpression=void 0;const l=c(6362),s=c(7533);class u extends l.AbstractExpression{constructor(i,o,n,h){super(o),this.label=i,this.staffNumber=h,n===void 0&&(n=s.TextAlignmentEnum.LeftBottom),this.textAlignment=n}get Label(){return this.label}get Placement(){return this.placement}set Placement(i){this.placement=i}get StaffNumber(){return this.staffNumber}set StaffNumber(i){this.staffNumber=i}get TextAlignment(){return this.textAlignment}}g.UnknownExpression=u},4980(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(6362),g),s(c(9147),g),s(c(6990),g),s(c(2148),g),s(c(9161),g),s(c(9803),g),s(c(9019),g),s(c(5332),g),s(c(9157),g),s(c(1112),g)},7718(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Glissando=void 0;const l=c(2561),s=c(6438);g.Glissando=class{constructor(u){this.notes=[],this.XMLNumber=1,this.AddNote(u),this.StartNote=u,this.Direction=s.ColDirEnum.NotYetDefined}get Notes(){return this.notes}get Duration(){const u=new l.Fraction;for(const r of this.notes)u.Add(r.Length);return u}get Pitch(){return this.StartNote.Pitch}AddNote(u){this.notes.push(u),u.NoteGlissando=this,this.notes.length===2&&(this.notes[0].Pitch.getHalfTone()<this.notes[1].Pitch.getHalfTone()?this.Direction=s.ColDirEnum.Up:this.Direction=s.ColDirEnum.Down)}}},1110(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.DynamicsContainer=void 0;const l=c(5875),s=c(2148);g.DynamicsContainer=class{constructor(u,r){u instanceof l.ContinuousDynamicExpression?this.continuousDynamicExpression=u:u instanceof s.InstantaneousDynamicExpression&&(this.instantaneousDynamicExpression=u),this.staffNumber=r}static Compare(u,r){return u.parMultiExpression().AbsoluteTimestamp.CompareTo(r.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){return this.continuousDynamicExpression?this.continuousDynamicExpression.StartMultiExpression:this.instantaneousDynamicExpression?this.instantaneousDynamicExpression.ParentMultiExpression:void 0}}},5364(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.AbstractNotationInstruction=void 0,g.AbstractNotationInstruction=class{constructor(c){this.printObject=!0,this.parent=c}get Parent(){return this.parent}set Parent(c){this.parent=c}get PrintObject(){return this.printObject}set PrintObject(c){this.printObject=c}}},164(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.MidiInstrument=g.ClefEnum=g.ClefInstruction=void 0;const l=c(8233),s=c(5364),u=c(8233),r=c(8233),i=c(7307);class o extends s.AbstractNotationInstruction{constructor(f=n.G,p=0,m=2){super(void 0),this.clefType=n.G,this.line=2,this.octaveOffset=0,this.line=m,this.clefType=f,this.octaveOffset=p,this.calcParameters()}static getDefaultClefFromMidiInstrument(f){switch(f){case h.Acoustic_Grand_Piano:case h.Electric_Bass_finger:case h.Electric_Bass_pick:case h.Fretless_Bass:case h.Slap_Bass_1:case h.Slap_Bass_2:case h.Synth_Bass_1:case h.Synth_Bass_2:case h.Contrabass:return new o(n.F,0,4);default:return new o(n.G,0,2)}}static getAllPossibleClefs(){const f=[];for(let p=0;p<=2;p++){const m=new o(n.G,p,2);f.push(m)}for(let p=-2;p<=0;p++){const m=new o(n.F,p,4);f.push(m)}return f}static isSupportedClef(f){switch(f){case n.G:case n.F:case n.C:case n.percussion:case n.TAB:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(f){this.clefType=f}get Line(){return this.line}set Line(f){this.line=f}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(f){this.octaveOffset=f}get ClefPitch(){return this.clefPitch}set ClefPitch(f){this.clefPitch=f}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(f){this.referenceCyPosition=f}Equals(f){return this===f||!(!this||!f)&&this.clefPitch===f.clefPitch&&this.Line===f.Line}NotEqual(f){return!this.Equals(f)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case n.G:this.clefPitch=new l.Pitch(u.NoteEnum.G,1+this.octaveOffset,r.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+2;break;case n.F:this.clefPitch=new l.Pitch(u.NoteEnum.F,0+this.octaveOffset,r.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line+1.5;break;case n.C:this.clefPitch=new l.Pitch(u.NoteEnum.C,1+this.octaveOffset,r.AccidentalEnum.NONE),this.referenceCyPosition=5-this.line;break;case n.percussion:this.clefPitch=new l.Pitch(u.NoteEnum.C,2,r.AccidentalEnum.NONE),this.referenceCyPosition=2;break;case n.TAB:this.clefPitch=new l.Pitch(u.NoteEnum.G,0,r.AccidentalEnum.NONE),this.referenceCyPosition=0;break;default:throw new i.ArgumentOutOfRangeException("clefType")}}}var n,h;g.ClefInstruction=o,function(t){t[t.G=0]="G",t[t.F=1]="F",t[t.C=2]="C",t[t.percussion=3]="percussion",t[t.TAB=4]="TAB"}(n||(g.ClefEnum=n={})),function(t){t[t.None=-1]="None",t[t.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",t[t.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",t[t.Electric_Grand_Piano=2]="Electric_Grand_Piano",t[t.Honky_tonk_Piano=3]="Honky_tonk_Piano",t[t.Electric_Piano_1=4]="Electric_Piano_1",t[t.Electric_Piano_2=5]="Electric_Piano_2",t[t.Harpsichord=6]="Harpsichord",t[t.Clavinet=7]="Clavinet",t[t.Celesta=8]="Celesta",t[t.Glockenspiel=9]="Glockenspiel",t[t.Music_Box=10]="Music_Box",t[t.Vibraphone=11]="Vibraphone",t[t.Marimba=12]="Marimba",t[t.Xylophone=13]="Xylophone",t[t.Tubular_Bells=14]="Tubular_Bells",t[t.Dulcimer=15]="Dulcimer",t[t.Drawbar_Organ=16]="Drawbar_Organ",t[t.Percussive_Organ=17]="Percussive_Organ",t[t.Rock_Organ=18]="Rock_Organ",t[t.Church_Organ=19]="Church_Organ",t[t.Reed_Organ=20]="Reed_Organ",t[t.Accordion=21]="Accordion",t[t.Harmonica=22]="Harmonica",t[t.Tango_Accordion=23]="Tango_Accordion",t[t.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",t[t.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",t[t.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",t[t.Electric_Guitar_clean=27]="Electric_Guitar_clean",t[t.Electric_Guitar_muted=28]="Electric_Guitar_muted",t[t.Overdriven_Guitar=29]="Overdriven_Guitar",t[t.Distortion_Guitar=30]="Distortion_Guitar",t[t.Guitar_harmonics=31]="Guitar_harmonics",t[t.Acoustic_Bass=32]="Acoustic_Bass",t[t.Electric_Bass_finger=33]="Electric_Bass_finger",t[t.Electric_Bass_pick=34]="Electric_Bass_pick",t[t.Fretless_Bass=35]="Fretless_Bass",t[t.Slap_Bass_1=36]="Slap_Bass_1",t[t.Slap_Bass_2=37]="Slap_Bass_2",t[t.Synth_Bass_1=38]="Synth_Bass_1",t[t.Synth_Bass_2=39]="Synth_Bass_2",t[t.Violin=40]="Violin",t[t.Viola=41]="Viola",t[t.Cello=42]="Cello",t[t.Contrabass=43]="Contrabass",t[t.Tremolo_Strings=44]="Tremolo_Strings",t[t.Pizzicato_Strings=45]="Pizzicato_Strings",t[t.Orchestral_Harp=46]="Orchestral_Harp",t[t.Timpani=47]="Timpani",t[t.String_Ensemble_1=48]="String_Ensemble_1",t[t.String_Ensemble_2=49]="String_Ensemble_2",t[t.Synth_Strings_1=50]="Synth_Strings_1",t[t.Synth_Strings_2=51]="Synth_Strings_2",t[t.Choir_Aahs=52]="Choir_Aahs",t[t.Voice_Oohs=53]="Voice_Oohs",t[t.Synth_Voice=54]="Synth_Voice",t[t.Orchestra_Hit=55]="Orchestra_Hit",t[t.Trumpet=56]="Trumpet",t[t.Trombone=57]="Trombone",t[t.Tuba=58]="Tuba",t[t.Muted_Trumpet=59]="Muted_Trumpet",t[t.French_Horn=60]="French_Horn",t[t.Brass_Section=61]="Brass_Section",t[t.Synth_Brass_1=62]="Synth_Brass_1",t[t.Synth_Brass_2=63]="Synth_Brass_2",t[t.Soprano_Sax=64]="Soprano_Sax",t[t.Alto_Sax=65]="Alto_Sax",t[t.Tenor_Sax=66]="Tenor_Sax",t[t.Baritone_Sax=67]="Baritone_Sax",t[t.Oboe=68]="Oboe",t[t.English_Horn=69]="English_Horn",t[t.Bassoon=70]="Bassoon",t[t.Clarinet=71]="Clarinet",t[t.Piccolo=72]="Piccolo",t[t.Flute=73]="Flute",t[t.Recorder=74]="Recorder",t[t.Pan_Flute=75]="Pan_Flute",t[t.Blown_Bottle=76]="Blown_Bottle",t[t.Shakuhachi=77]="Shakuhachi",t[t.Whistle=78]="Whistle",t[t.Ocarina=79]="Ocarina",t[t.Lead_1_square=80]="Lead_1_square",t[t.Lead_2_sawtooth=81]="Lead_2_sawtooth",t[t.Lead_3_calliope=82]="Lead_3_calliope",t[t.Lead_4_chiff=83]="Lead_4_chiff",t[t.Lead_5_charang=84]="Lead_5_charang",t[t.Lead_6_voice=85]="Lead_6_voice",t[t.Lead_7_fifths=86]="Lead_7_fifths",t[t.Lead_8_bass_lead=87]="Lead_8_bass_lead",t[t.Pad_1_new_age=88]="Pad_1_new_age",t[t.Pad_2_warm=89]="Pad_2_warm",t[t.Pad_3_polysynth=90]="Pad_3_polysynth",t[t.Pad_4_choir=91]="Pad_4_choir",t[t.Pad_5_bowed=92]="Pad_5_bowed",t[t.Pad_6_metallic=93]="Pad_6_metallic",t[t.Pad_7_halo=94]="Pad_7_halo",t[t.Pad_8_sweep=95]="Pad_8_sweep",t[t.FX_1_rain=96]="FX_1_rain",t[t.FX_2_soundtrack=97]="FX_2_soundtrack",t[t.FX_3_crystal=98]="FX_3_crystal",t[t.FX_4_atmosphere=99]="FX_4_atmosphere",t[t.FX_5_brightness=100]="FX_5_brightness",t[t.FX_6_goblins=101]="FX_6_goblins",t[t.FX_7_echoes=102]="FX_7_echoes",t[t.FX_8_scifi=103]="FX_8_scifi",t[t.Sitar=104]="Sitar",t[t.Banjo=105]="Banjo",t[t.Shamisen=106]="Shamisen",t[t.Koto=107]="Koto",t[t.Kalimba=108]="Kalimba",t[t.Bag_pipe=109]="Bag_pipe",t[t.Fiddle=110]="Fiddle",t[t.Shanai=111]="Shanai",t[t.Tinkle_Bell=112]="Tinkle_Bell",t[t.Agogo=113]="Agogo",t[t.Steel_Drums=114]="Steel_Drums",t[t.Woodblock=115]="Woodblock",t[t.Taiko_Drum=116]="Taiko_Drum",t[t.Melodic_Tom=117]="Melodic_Tom",t[t.Synth_Drum=118]="Synth_Drum",t[t.Reverse_Cymbal=119]="Reverse_Cymbal",t[t.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",t[t.Breath_Noise=121]="Breath_Noise",t[t.Seashore=122]="Seashore",t[t.Bird_Tweet=123]="Bird_Tweet",t[t.Telephone_Ring=124]="Telephone_Ring",t[t.Helicopter=125]="Helicopter",t[t.Applause=126]="Applause",t[t.Gunshot=127]="Gunshot",t[t.Percussion=128]="Percussion"}(h||(g.MidiInstrument=h={}))},4543(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.KeyEnum=g.NoteEnumToHalfToneLink=g.KeyInstruction=void 0;const l=c(5364),s=c(8233),u=c(8233);class r extends l.AbstractNotationInstruction{constructor(n=void 0,h=0,t=i.major){super(n),this.isTransposedBy=0,this.Key=h,this.keyTypeOriginal=h,this.mode=t,this.alteratedNotes=this.calcAlteratedNotes()}static copy(n){const h=new r(n.parent,n.Key,n.Mode);return h.keyTypeOriginal=n.keyTypeOriginal,h}static getAllPossibleMajorKeyInstructions(){const n=[];for(let h=-7;h<7;h++){const t=new r(void 0,h,i.major);n.push(t)}return n}get Key(){return this.keyType}set Key(n){this.keyType=n,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(n){this.mode=n}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const n=[];if(this.keyType>0)for(let h=0;h<this.keyType;h++)n.push(r.sharpPositionList[h]);else if(this.keyType<0)for(let h=0;h<-this.keyType;h++)n.push(r.flatPositionList[h]);return n}willAlterateNote(n){return this.alteratedNotes.indexOf(n)>=0}getAlterationForPitch(n){return this.keyType>0&&this.alteratedNotes.indexOf(n.FundamentalNote)<=this.keyType?u.AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(n.FundamentalNote)<=Math.abs(this.keyType)?u.AccidentalEnum.FLAT:u.AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(n){const h=this;return h===n||!(!h||!n)&&h.Key===n.Key&&h.Mode===n.Mode}OperatorNotEqual(n){return!this.OperatorEquals(n)}}var i;g.KeyInstruction=r,r.sharpPositionList=[s.NoteEnum.F,s.NoteEnum.C,s.NoteEnum.G,s.NoteEnum.D,s.NoteEnum.A,s.NoteEnum.E,s.NoteEnum.B],r.flatPositionList=[s.NoteEnum.B,s.NoteEnum.E,s.NoteEnum.A,s.NoteEnum.D,s.NoteEnum.G,s.NoteEnum.C,s.NoteEnum.F],g.NoteEnumToHalfToneLink=class{constructor(o,n){this.note=o,this.halfTone=n}},function(o){o[o.major=0]="major",o[o.minor=1]="minor",o[o.none=2]="none",o[o.dorian=3]="dorian",o[o.phrygian=4]="phrygian",o[o.lydian=5]="lydian",o[o.mixolydian=6]="mixolydian",o[o.aeolian=7]="aeolian",o[o.ionian=8]="ionian",o[o.locrian=9]="locrian"}(i||(g.KeyEnum=i={}))},1645(de,g){var c,l;Object.defineProperty(g,"__esModule",{value:!0}),g.AlignmentType=g.RepetitionInstructionEnum=g.RepetitionInstruction=g.RepetitionInstructionComparer=void 0,g.RepetitionInstructionComparer=class{static Compare(s,u){if(s.parentRepetition!==void 0&&u.parentRepetition){if(s.alignment===l.End&&u.alignment===l.End){if(s.parentRepetition.StartIndex<u.parentRepetition.StartIndex)return 1;if(s.parentRepetition.StartIndex>u.parentRepetition.StartIndex)return-1}if(s.alignment===l.Begin&&u.alignment===l.Begin){if(s.parentRepetition.EndIndex<u.parentRepetition.EndIndex)return 1;if(s.parentRepetition.EndIndex>u.parentRepetition.EndIndex)return-1}}return 0}},g.RepetitionInstruction=class{constructor(s,u,r=l.End,i=void 0,o=void 0){this.endingIndices=void 0,this.measureIndex=s,o&&(this.endingIndices=o.slice()),this.type=u,this.alignment=r,this.parentRepetition=i}CompareTo(s){const u=s;if(this.measureIndex>u.measureIndex)return 1;if(this.measureIndex<u.measureIndex)return-1;if(this.alignment===l.Begin){if(u.alignment===l.End)return-1;switch(this.type){case c.Ending:return 1;case c.StartLine:return u.type===c.Ending?-1:1;case c.Coda:case c.Segno:return u.type===c.Coda?1:-1}}else{if(u.alignment===l.Begin)return 1;switch(this.type){case c.Ending:return-1;case c.Fine:case c.ToCoda:return u.type===c.Ending?1:-1;case c.ForwardJump:switch(u.type){case c.Ending:case c.Fine:case c.ToCoda:return 1}return-1;case c.DalSegnoAlFine:case c.DaCapoAlFine:case c.DalSegnoAlCoda:case c.DaCapoAlCoda:case c.DaCapo:case c.DalSegno:case c.BackJumpLine:return 1}}return 0}equals(s){if(this.measureIndex!==s.measureIndex||this.type!==s.type||this.alignment!==s.alignment)return!1;if(this.endingIndices===s.endingIndices)return!0;if(!this.endingIndices||!s.endingIndices||this.endingIndices.length!==s.endingIndices.length)return!1;for(let u=0;u<this.endingIndices.length;u++)if(this.endingIndices[u]!==s.endingIndices[u])return!1;return!0}},function(s){s[s.StartLine=0]="StartLine",s[s.ForwardJump=1]="ForwardJump",s[s.BackJumpLine=2]="BackJumpLine",s[s.Ending=3]="Ending",s[s.DaCapo=4]="DaCapo",s[s.DalSegno=5]="DalSegno",s[s.Fine=6]="Fine",s[s.ToCoda=7]="ToCoda",s[s.DalSegnoAlFine=8]="DalSegnoAlFine",s[s.DaCapoAlFine=9]="DaCapoAlFine",s[s.DalSegnoAlCoda=10]="DalSegnoAlCoda",s[s.DaCapoAlCoda=11]="DaCapoAlCoda",s[s.Coda=12]="Coda",s[s.Segno=13]="Segno",s[s.None=14]="None"}(c||(g.RepetitionInstructionEnum=c={})),function(s){s[s.Begin=0]="Begin",s[s.End=1]="End",s[s.Mid=2]="Mid",s[s.Discontinue=3]="Discontinue"}(l||(g.AlignmentType=l={}))},9288(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.RhythmSymbolEnum=g.RhythmInstruction=void 0;const l=c(5364);class s extends l.AbstractNotationInstruction{constructor(i,o){super(void 0),this.rhythm=i,this.numerator=i.Numerator,this.denominator=i.Denominator,this.symbolEnum=o}get Rhythm(){return this.rhythm}set Rhythm(i){this.rhythm=i}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(i){this.symbolEnum=i}clone(){return new s(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(i){const o=this;return o===i||!(!o||!i)&&o.numerator===i.numerator&&o.denominator===i.denominator}OperatorNotEqual(i){return this!==i}ToString(){return"Rhythm: "+this.rhythm.toString()}}var u;g.RhythmInstruction=s,function(r){r[r.NONE=0]="NONE",r[r.COMMON=1]="COMMON",r[r.CUT=2]="CUT"}(u||(g.RhythmSymbolEnum=u={}))},3123(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),g.TechnicalInstruction=g.TechnicalInstructionType=void 0,function(l){l[l.Fingering=0]="Fingering",l[l.String=1]="String"}(c||(g.TechnicalInstructionType=c={})),g.TechnicalInstruction=class{}},9184(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(5364),g),s(c(164),g),s(c(4543),g),s(c(1645),g),s(c(9288),g),s(c(3123),g)},4249(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.LinkedVoice=void 0;const l=c(5534);class s extends l.Voice{constructor(r,i,o){super(r,i),this.master=o}get Master(){return this.master}}g.LinkedVoice=s},2317(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.LyricsEntry=void 0;const l=c(2570);g.LyricsEntry=class{constructor(s,u,r,i,o=-1){this.text=s,this.word=r,this.parent=i,this.verseNumber=u,o>=0&&(this.syllableIndex=o)}get Text(){return this.text}set Text(s){this.text=s}get Word(){return this.word}get Parent(){return this.parent}set Parent(s){this.parent=s}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}get IsTranslation(){return this.VerseNumber.endsWith("translation")}get IsChorus(){return this.VerseNumber.startsWith("chorus")}get FontStyle(){return this.IsChorus||this.IsTranslation?l.FontStyles.Italic:l.FontStyles.Regular}}},649(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.LyricWord=void 0,g.LyricWord=class{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(c){for(let l=0,s=this.Syllables.length;l<s;++l)if(this.Syllables[l].Parent===c)return!0;return!1}findLyricEntryInVoiceEntry(c){for(let l=0,s=this.Syllables.length;l<s;++l){const u=this.Syllables[l];if(u.Parent===c)return u}}}},1850(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Appearance=g.Note=void 0;const l=c(2561);var s;g.Note=class{constructor(u,r,i,o,n,h){this.slurs=[],this.playbackInstrumentId=void 0,this.notehead=void 0,this.printObject=!0,this.voiceEntry=u,this.parentStaffEntry=r,this.length=i,this.pitch=o,this.sourceMeasure=n,this.isRestFlag=h??!1,this.halfTone=o?o.getHalfTone():0}get NoteAsString(){return this.pitch.toString()}ToStringShort(u=0){var r;return!this.Pitch||this.isRest()?"rest":(r=this.Pitch)==null?void 0:r.ToStringShort(u)}get ToStringShortGet(){return this.ToStringShort(0)}get ParentVoiceEntry(){return this.voiceEntry}set ParentVoiceEntry(u){this.voiceEntry=u}get ParentStaffEntry(){return this.parentStaffEntry}get ParentStaff(){return this.parentStaffEntry.ParentStaff}get Length(){return this.length}set Length(u){this.length=u}get SourceMeasure(){return this.sourceMeasure}get TypeLength(){return this.typeLength}set TypeLength(u){this.typeLength=u}get NoteTypeXml(){return this.noteTypeXml}set NoteTypeXml(u){this.noteTypeXml=u}get NormalNotes(){return this.normalNotes}set NormalNotes(u){this.normalNotes=u}get Pitch(){return this.pitch}get NoteBeam(){return this.beam}set NoteBeam(u){this.beam=u}set Notehead(u){this.notehead=u}get Notehead(){return this.notehead}get NoteTuplet(){return this.tuplet}set NoteTuplet(u){this.tuplet=u}get NoteGlissando(){return this.glissando}set NoteGlissando(u){this.glissando=u}get NoteTie(){return this.tie}set NoteTie(u){this.tie=u}get NoteSlurs(){return this.slurs}set NoteSlurs(u){this.slurs=u}get PlaybackInstrumentId(){return this.playbackInstrumentId}set PlaybackInstrumentId(u){this.playbackInstrumentId=u}get PrintObject(){return this.printObject}set PrintObject(u){this.printObject=u}get Arpeggio(){return this.arpeggio}set Arpeggio(u){this.arpeggio=u}get IsCueNote(){return this.isCueNote}set IsCueNote(u){this.isCueNote=u}get StemDirectionXml(){return this.stemDirectionXml}set StemDirectionXml(u){this.stemDirectionXml=u}get TremoloStrokes(){var u;return(u=this.TremoloInfo)==null?void 0:u.tremoloStrokes}get StemColorXml(){return this.stemColorXml}set StemColorXml(u){this.stemColorXml=u}get NoteheadColorXml(){return this.noteheadColorXml}set NoteheadColorXml(u){this.noteheadColorXml=u}get NoteheadColor(){return this.noteheadColor}set NoteheadColor(u){this.noteheadColor=u}get NoteheadColorCurrentlyRendered(){return this.noteheadColorCurrentlyRendered}set NoteheadColorCurrentlyRendered(u){this.noteheadColorCurrentlyRendered=u}isRest(){return this.isRestFlag}isWholeRest(){return this.isRest()&&this.Length.RealValue===this.sourceMeasure.ActiveTimeSignature.RealValue}isWholeMeasureNote(){return this.Length.RealValue===this.sourceMeasure.ActiveTimeSignature.RealValue}ToString(){return this.pitch?this.Pitch.ToString()+", length: "+this.length.toString():"rest note, length: "+this.length.toString()}getAbsoluteTimestamp(){return l.Fraction.plus(this.voiceEntry.Timestamp,this.sourceMeasure.AbsoluteTimestamp)}isDuplicateSlur(u){for(let r=0,i=this.slurs.length;r<i;++r){const o=this.slurs[r];if(o.StartNote!==void 0&&o.EndNote!==void 0&&u.StartNote!==void 0&&u.StartNote===o.StartNote&&o.EndNote===this&&u.PlacementXml===o.PlacementXml)return!0}return!1}hasTabEffects(){return!1}},function(u){u[u.Normal=0]="Normal",u[u.Grace=1]="Grace",u[u.Cue=2]="Cue"}(s||(g.Appearance=s={}))},5282(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.NoteTypeHandler=g.NoteType=void 0;const l=c(2561),s=c(9767),u=c(7307);var r;(function(o){o[o.UNDEFINED=0]="UNDEFINED",o[o._1024th=1]="_1024th",o[o._512th=2]="_512th",o[o._256th=3]="_256th",o[o._128th=4]="_128th",o[o._64th=5]="_64th",o[o._32nd=6]="_32nd",o[o._16th=7]="_16th",o[o.EIGTH=8]="EIGTH",o[o.QUARTER=9]="QUARTER",o[o.HALF=10]="HALF",o[o.WHOLE=11]="WHOLE",o[o.BREVE=12]="BREVE",o[o.LONG=13]="LONG",o[o.MAXIMA=14]="MAXIMA"})(r||(g.NoteType=r={}));class i{static NoteTypeToString(n){return this.NoteTypeXmlValues[n]}static StringToNoteType(n){const h=this.NoteTypeXmlValues.indexOf(n);return h!==-1?h:r.UNDEFINED}static getNoteDurationFromType(n){switch(n){case"1024th":return new l.Fraction(1,1024);case"512th":return new l.Fraction(1,512);case"256th":return new l.Fraction(1,256);case"128th":return new l.Fraction(1,128);case"64th":return new l.Fraction(1,64);case"32th":case"32nd":return new l.Fraction(1,32);case"16th":return new l.Fraction(1,16);case"eighth":return new l.Fraction(1,8);case"quarter":return new l.Fraction(1,4);case"half":return new l.Fraction(1,2);case"whole":return new l.Fraction(1,1);case"breve":return new l.Fraction(2,1);case"long":return new l.Fraction(4,1);case"maxima":return new l.Fraction(8,1);default:{const h=s.ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new u.MusicSheetReadingException(h)}}}}g.NoteTypeHandler=i,i.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"]},4064(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.NoteHeadShape=g.Notehead=void 0;const s=l(c(3065));class u{constructor(o,n,h=void 0){this.sourceNote=o,this.setShapeFromXml(n,h)}setShapeFromXml(o,n=void 0){this.shape=u.ShapeTypeXmlToShape(o);let h=n;h===void 0&&(this.sourceNote?h=this.sourceNote.Length.Denominator>2:(s.default.warn("notehead: sourceNote and filledXmlAttribute undefined."),h=!0)),this.filled=h}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(o){switch(o.toLowerCase()){case"normal":return r.NORMAL;case"none":return r.NONE;case"x":return r.X;case"slash":return r.SLASH;case"diamond":return r.DIAMOND;case"square":case"la":return r.SQUARE;case"do":case"triangle":return r.TRIANGLE;case"inverted triangle":return r.TRIANGLE_INVERTED;case"rectangle":return r.RECTANGLE;case"circle-x":return r.CIRCLEX;default:return s.default.info("unsupported/unhandled xml notehead '"+o+"'. Using normal notehead."),r.NORMAL}}}var r;g.Notehead=u,function(i){i[i.CIRCLEX=0]="CIRCLEX",i[i.DIAMOND=1]="DIAMOND",i[i.NORMAL=2]="NORMAL",i[i.NONE=3]="NONE",i[i.RECTANGLE=4]="RECTANGLE",i[i.SLASH=5]="SLASH",i[i.SQUARE=6]="SQUARE",i[i.TRIANGLE=7]="TRIANGLE",i[i.TRIANGLE_INVERTED=8]="TRIANGLE_INVERTED",i[i.X=9]="X"}(r||(g.NoteHeadShape=r={}))},8215(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.OrnamentEnum=g.OrnamentContainer=void 0;const l=c(8233),s=c(6362);var u;g.OrnamentContainer=class{constructor(r){this.placement=s.PlacementEnum.Above,this.accidentalAbove=l.AccidentalEnum.NONE,this.accidentalBelow=l.AccidentalEnum.NONE,this.ornament=r}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(r){this.accidentalAbove=r}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(r){this.accidentalBelow=r}},function(r){r[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"}(u||(g.OrnamentEnum=u={}))},4387(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.SourceMeasure=void 0;const l=c(2561),s=c(3236),u=c(2369),r=c(1645),i=c(1336),o=c(164),n=c(4543),h=c(6954);g.SourceMeasure=class{constructor(t,f){this.printNewSystemXml=!1,this.printNewPageXml=!1,this.IsSystemStartMeasure=!1,this.WidthFactor=1,this.hasLyrics=!1,this.hasMoodExpressions=!1,this.allRests=!1,this.isReducedToMultiRest=!1,this.multipleRestMeasureNumber=0,this.staffLinkedExpressions=[],this.tempoExpressions=[],this.verticalSourceStaffEntryContainers=[],this.graphicalMeasureErrors=[],this.firstRepetitionInstructions=[],this.lastRepetitionInstructions=[],this.completeNumberOfStaves=t,this.implicitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=h.SystemLinesEnum.SingleThin,this.firstInstructionsStaffEntries=new Array(t),this.lastInstructionsStaffEntries=new Array(t),this.rules=f,this.TempoInBPM=0;for(let p=0;p<t;p++)this.graphicalMeasureErrors.push(!1),this.staffLinkedExpressions.push([])}get MeasureNumber(){return this.measureNumber}set MeasureNumber(t){this.measureNumber=t}getPrintedMeasureNumber(){return this.rules.UseXMLMeasureNumbers&&Number.isInteger(this.MeasureNumberXML)?(this.MeasureNumberPrinted=this.MeasureNumberXML,this.MeasureNumberPrinted):(this.MeasureNumberPrinted=this.MeasureNumber,this.MeasureNumberPrinted)}get AbsoluteTimestamp(){return this.absoluteTimestamp}set AbsoluteTimestamp(t){this.absoluteTimestamp=t}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}get Duration(){return this.duration}set Duration(t){this.duration=t}get ActiveTimeSignature(){return this.activeTimeSignature}set ActiveTimeSignature(t){this.activeTimeSignature=t}get ImplicitMeasure(){return this.implicitMeasure}set ImplicitMeasure(t){this.implicitMeasure=t}get HasEndLine(){return this.hasEndLine}set HasEndLine(t){this.hasEndLine=t}get StaffLinkedExpressions(){return this.staffLinkedExpressions}get TempoExpressions(){return this.tempoExpressions}get VerticalSourceStaffEntryContainers(){return this.verticalSourceStaffEntryContainers}get FirstInstructionsStaffEntries(){return this.firstInstructionsStaffEntries}get LastInstructionsStaffEntries(){return this.lastInstructionsStaffEntries}get FirstRepetitionInstructions(){return this.firstRepetitionInstructions}get LastRepetitionInstructions(){return this.lastRepetitionInstructions}getErrorInMeasure(t){return this.graphicalMeasureErrors[t]}setErrorInGraphicalMeasure(t,f){this.graphicalMeasureErrors[t]=f}getNextMeasure(t){return t[this.measureListIndex+1]}getPreviousMeasure(t){if(this.measureListIndex>1)return t[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(t){this.verticalMeasureList=t}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(t){this.tempoInBPM=t}findOrCreateStaffEntry(t,f,p){let m,x;for(const d of this.verticalSourceStaffEntryContainers)if(d.Timestamp.Equals(t)){x=d;break}if(x)return x.StaffEntries[f]?m=x.StaffEntries[f]:(m=new u.SourceStaffEntry(x,p),x.StaffEntries[f]=m),{createdNewContainer:!1,staffEntry:m};const y=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||y.Timestamp.lt(t)){const d=new s.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(d),m=new u.SourceStaffEntry(d,p),d.StaffEntries[f]=m}else for(let d=this.verticalSourceStaffEntryContainers.length-1;d>=0;d--){if(this.verticalSourceStaffEntryContainers[d].Timestamp.lt(t)){const S=new s.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(d+1,0,S),m=new u.SourceStaffEntry(S,p),S.StaffEntries[f]=m;break}if(d===0){const S=new s.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(d,0,S),m=new u.SourceStaffEntry(S,p),S.StaffEntries[f]=m;break}}return{createdNewContainer:!0,staffEntry:m}}findOrCreateVoiceEntry(t,f){let p,m=!1;for(const x of t.VoiceEntries)if(x.ParentVoice===f){p=x;break}return p||(p=new i.VoiceEntry(t.Timestamp,f,t),m=!0),{createdVoiceEntry:m,voiceEntry:p}}getPreviousSourceStaffEntryFromIndex(t,f){for(let p=f-1;p>=0;p--)if(this.verticalSourceStaffEntryContainers[p][t])return this.verticalSourceStaffEntryContainers[p][t]}getVerticalContainerIndexByTimestamp(t){for(let f=0,p=this.VerticalSourceStaffEntryContainers.length;f<p;++f)if(this.VerticalSourceStaffEntryContainers[f].Timestamp.Equals(t))return f;return-1}getVerticalContainerByTimestamp(t){for(let f=0,p=this.VerticalSourceStaffEntryContainers.length;f<p;++f){const m=this.VerticalSourceStaffEntryContainers[f];if(m.Timestamp.Equals(t))return m}}checkForEmptyVerticalContainer(t){let f=0;for(let p=0;p<this.completeNumberOfStaves;p++)this.verticalSourceStaffEntryContainers[t][p]||f++;f===this.completeNumberOfStaves&&this.verticalSourceStaffEntryContainers.splice(t,1)}reverseCheck(t,f){let p=new l.Fraction(0,1);const m=[];for(let x=0;x<t.Instruments.length;x++){let y=new l.Fraction(0,1);const d=t.getGlobalStaffIndexOfFirstStaff(t.Instruments[x]);for(let S=0;S<t.Instruments[x].Staves.length;S++){const M=this.getLastSourceStaffEntryForInstrument(d+S);if(M!==void 0&&!M.hasTie())for(let E=this.verticalSourceStaffEntryContainers.indexOf(M.VerticalContainerParent)-1;E>=0;E--){const L=this.verticalSourceStaffEntryContainers[E][d+S];if(L!==void 0&&L.hasTie()&&y.lt(l.Fraction.plus(L.Timestamp,L.calculateMaxNoteLength()))){y=l.Fraction.plus(L.Timestamp,L.calculateMaxNoteLength());break}}}m.push(y)}for(let x=0,y=m.length;x<y;++x){const d=m[x];p.lt(d)&&(p=d)}return l.Fraction.max(p,f)}calculateInstrumentsDuration(t,f){const p=[];for(let m=0;m<t.Instruments.length;m++){let x=new l.Fraction(0,1);const y=t.getGlobalStaffIndexOfFirstStaff(t.Instruments[m]);for(let d=0;d<t.Instruments[m].Staves.length;d++){const S=this.getLastSourceStaffEntryForInstrument(y+d);if(S!==void 0&&S.Timestamp){const M=S.calculateMaxNoteLength(!1);x.lt(l.Fraction.plus(S.Timestamp,M))&&(x=l.Fraction.plus(S.Timestamp,M))}}x.lt(f[m])&&(x=f[m]),p.push(x)}return p}getEntriesPerStaff(t){const f=[];for(const p of this.VerticalSourceStaffEntryContainers){const m=p.StaffEntries[t];m&&f.push(m)}return f}hasBeginInstructions(){for(let t=0,f=this.FirstInstructionsStaffEntries.length;t<f;t++){const p=this.FirstInstructionsStaffEntries[t];if(p!==void 0&&p.Instructions.length>0)return!0}return!1}beginsWithRepetition(){return this.beginsWithLineRepetition()||this.beginsWithWordRepetition()}beginsWithLineRepetition(){for(let t=0,f=this.FirstRepetitionInstructions.length;t<f;++t){const p=this.FirstRepetitionInstructions[t];if(p.type===r.RepetitionInstructionEnum.StartLine){if(p.parentRepetition!==void 0&&p.parentRepetition.FromWords)continue;return!0}if(p.parentRepetition!==void 0&&p===p.parentRepetition.startMarker&&!p.parentRepetition.FromWords&&p.type!==r.RepetitionInstructionEnum.None)return!0}return!1}endsWithLineRepetition(){for(let t=0,f=this.LastRepetitionInstructions.length;t<f;++t){const p=this.LastRepetitionInstructions[t];if(p.type===r.RepetitionInstructionEnum.BackJumpLine)return!0;const m=p.parentRepetition;if(m&&!m.FromWords){for(let x=0,y=m.BackwardJumpInstructions.length;x<y;++x)if(p===m.BackwardJumpInstructions[x])return!0}}return!1}beginsWithWordRepetition(){for(let t=0,f=this.FirstRepetitionInstructions.length;t<f;++t){const p=this.FirstRepetitionInstructions[t];if(p.parentRepetition!==void 0&&p===p.parentRepetition.startMarker&&p.parentRepetition.FromWords)return!0}return!1}endsWithWordRepetition(){for(let t=0,f=this.LastRepetitionInstructions.length;t<f;++t){const p=this.LastRepetitionInstructions[t],m=p.parentRepetition;if(m&&m.FromWords){for(let x=0,y=m.BackwardJumpInstructions.length;x<y;++x)if(p===m.BackwardJumpInstructions[x])return!0;if(p===m.forwardJumpInstruction)return!0}}return!1}beginsRepetitionEnding(){for(const t of this.FirstRepetitionInstructions)if(t.type===r.RepetitionInstructionEnum.Ending&&t.alignment===r.AlignmentType.Begin)return!0;return!1}endsRepetitionEnding(){for(const t of this.LastRepetitionInstructions)if(t.type===r.RepetitionInstructionEnum.Ending&&t.alignment===r.AlignmentType.End)return!0;return!1}getKeyInstruction(t){if(this.FirstInstructionsStaffEntries[t]){const f=this.FirstInstructionsStaffEntries[t];for(let p=0,m=f.Instructions.length;p<m;++p){const x=f.Instructions[p];if(x instanceof n.KeyInstruction)return x}}}getLastSourceStaffEntryForInstrument(t,f=!0){let p;for(let m=this.verticalSourceStaffEntryContainers.length-1;m>=0;m--)if(p=this.verticalSourceStaffEntryContainers[m].StaffEntries[t],p&&(!f||p.VoiceEntries.length>0))return p}canBeReducedToMultiRest(){var p,m;if(this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0)return!1;let t=!0,f=!1;for(const x of this.verticalSourceStaffEntryContainers)if(x){for(const y of x.StaffEntries)if(y&&y.ParentStaff.isVisible()){if(y.ChordContainers.length>0)return!1;y.ParentStaff.hasLyrics&&(f=!0);for(const d of y.VoiceEntries){for(const S of d.Notes)if(!S.isRest()){t=!1;break}if(!t)break}}}if(!t||f||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const x of this.staffLinkedExpressions)if(x.length>0)return!1;for(const x of this.lastInstructionsStaffEntries)for(let y=0,d=x==null?void 0:x.Instructions.length;y<d;++y)if(x.Instructions[y]instanceof o.ClefInstruction)return!1;return((p=this.Duration)==null?void 0:p.RealValue)===((m=this.ActiveTimeSignature)==null?void 0:m.RealValue)}}},2369(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.SourceStaffEntry=void 0;const l=c(2561),s=c(164),u=c(4543),r=c(9288);g.SourceStaffEntry=class{constructor(i,o){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=i,this.parentStaff=o}get ParentStaff(){return this.parentStaff}get VerticalContainerParent(){return this.verticalContainerParent}get Timestamp(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}get AbsoluteTimestamp(){if(this.VerticalContainerParent)return l.Fraction.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}get VoiceEntries(){return this.voiceEntries}set VoiceEntries(i){this.voiceEntries=i}get Link(){return this.staffEntryLink}set Link(i){this.staffEntryLink=i}get Instructions(){return this.instructions}set Instructions(i){this.instructions=i}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(i){this.chordSymbolContainers=i}removeAllInstructionsOfTypeClefInstruction(){let i=0,o=0;for(;i<this.instructions.length;)this.instructions[i]instanceof s.ClefInstruction?(this.instructions.splice(i,1),o++):i++;return o}removeFirstInstructionOfTypeClefInstruction(){for(let i=0;i<this.instructions.length;i++)if(this.instructions[i]instanceof s.ClefInstruction)return this.instructions.splice(i,1),!0;return!1}removeAllInstructionsOfTypeKeyInstruction(){let i=0,o=0;for(;i<this.instructions.length;)this.instructions[i]instanceof u.KeyInstruction?(this.instructions.splice(i,1),o++):i++;return o}removeFirstInstructionOfTypeKeyInstruction(){for(let i=0;i<this.instructions.length;i++)if(this.instructions[i]instanceof u.KeyInstruction)return this.instructions.splice(i,1),!0;return!1}removeAllInstructionsOfTypeRhythmInstruction(){let i=0,o=0;for(;i<this.instructions.length;)this.instructions[i]instanceof r.RhythmInstruction?(this.instructions.splice(i,1),o++):i++;return o}removeFirstInstructionOfTypeRhythmInstruction(){for(let i=0;i<this.instructions.length;i++)if(this.instructions[i]instanceof r.RhythmInstruction)return this.instructions.splice(i,1),!0;return!1}calculateMinNoteLength(){let i=new l.Fraction(Number.MAX_VALUE,1);for(let o=0,n=this.VoiceEntries.length;o<n;++o){const h=this.VoiceEntries[o];for(let t=0,f=h.Notes.length;t<f;++t){const p=h.Notes[t];p.Length.lt(i)&&(i=p.Length)}}return i}calculateMaxNoteLength(i=!0){let o=new l.Fraction(0,1);for(let n=0,h=this.VoiceEntries.length;n<h;++n){const t=this.VoiceEntries[n];for(let f=0,p=t.Notes.length;f<p;++f){const m=t.Notes[f];if(i&&m.NoteTie){const x=l.Fraction.createFromFraction(m.Length);let y=!1;for(const d of m.NoteTie.Notes)d!==m?y&&x.Add(d.Length):y=!0;o.lt(x)&&(o=x)}else o.lt(m.Length)&&(o=m.Length)}}return o}hasNotes(){for(let i=0,o=this.VoiceEntries.length;i<o;++i)if(this.VoiceEntries[i].Notes.length>0)return!0;return!1}hasTie(){for(let i=0,o=this.VoiceEntries.length;i<o;++i)if(this.VoiceEntries[i].hasTie())return!0;return!1}findLinkedNotes(i){for(let o=0,n=this.voiceEntries.length;o<n;++o){const h=this.voiceEntries[o];for(let t=0,f=h.Notes.length;t<f;++t){const p=h.Notes[t];p.ParentStaffEntry===this&&i.push(p)}}}get hasOnlyRests(){for(const i of this.voiceEntries)for(const o of i.Notes)if(!o.isRest())return!1;return!0}}},1910(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.Staff=void 0,g.Staff=class{constructor(c,l){this.isTab=!1,this.voices=[],this.volume=1,this.stafflineCount=5,this.hasLyrics=!1,this.openTieDict={},this.parentInstrument=c,this.id=l,this.audible=!0,this.Visible=!0,this.following=!0}get ParentInstrument(){return this.parentInstrument}set ParentInstrument(c){this.parentInstrument=c}get Voices(){return this.voices}get Id(){return this.id}get Volume(){return this.volume}set Volume(c){this.volume=c}get StafflineCount(){return this.stafflineCount}set StafflineCount(c){this.stafflineCount=c}isVisible(){return this.Visible&&this.ParentInstrument.Visible}}},6644(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.StaffEntryLink=void 0,g.StaffEntryLink=class{constructor(c){this.linkStaffEntries=[],this.voiceEntry=c}get GetVoiceEntry(){return this.voiceEntry}get LinkStaffEntries(){return this.linkStaffEntries}set LinkStaffEntries(c){this.linkStaffEntries=c}}},9647(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.TabNote=void 0;const l=c(1850);class s extends l.Note{constructor(r,i,o,n,h,t,f,p){super(r,i,o,n,h),this.stringNumberTab=t,this.fretNumber=f,this.bendArray=p}get StringNumberTab(){return this.stringNumberTab}get FretNumber(){return this.fretNumber}get BendArray(){return this.bendArray}hasTabEffects(){var r;return((r=this.bendArray)==null?void 0:r.length)>0}}g.TabNote=s},5274(de,g,c){var l=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(g,"__esModule",{value:!0}),g.Tie=void 0;const s=c(2561),u=c(6362),r=l(c(3065));g.Tie=class{constructor(i,o){this.notes=[],this.TieNumber=1,this.TieDirection=u.PlacementEnum.NotYetDefined,this.NoteIndexToTieDirection={},this.AddNote(i),this.type=o}getTieDirection(i){if(!i)return this.TieDirection;for(let o=0;o<this.Notes.length;o++)if(this.Notes[o]===i)return this.NoteIndexToTieDirection[o]||this.TieDirection;return r.default.debug("tie.getTieDuration note not in tie.Notes"),this.TieDirection}get Notes(){return this.notes}get Type(){return this.type}get StartNote(){return this.notes[0]}get Duration(){const i=new s.Fraction;for(const o of this.notes)i.Add(o.Length);return i}get Pitch(){return this.StartNote.Pitch}AddNote(i){this.notes.push(i),i.NoteTie=this}}},4268(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.Tuplet=void 0,g.Tuplet=class{constructor(c,l=!1){this.PlacementFromXml=!1,this.RenderTupletNumber=!0,this.notes=[],this.fractions=[],this.tupletLabelNumber=c,this.bracket=l}shouldBeBracketed(c,l,s,u=!1,r=!1){if(u)return r;if(c&&this.BracketedXmlValue!==void 0)return this.BracketedXmlValue;const i=this.Notes[0][0].NoteBeam;if(!i)return!0;for(const o of this.Notes)if(o[0].NoteBeam!==i)return!0;return this.Bracket||this.TupletLabelNumber===3&&s||this.TupletLabelNumber!==3&&l}get TupletLabelNumber(){return this.tupletLabelNumber}set TupletLabelNumber(c){this.tupletLabelNumber=c}get Notes(){return this.notes}set Notes(c){this.notes=c}get Fractions(){return this.fractions}set Fractions(c){this.fractions=c}get Bracket(){return this.bracket}set Bracket(c){this.bracket=c}getNoteIndex(c){for(let l=this.notes.length-1;l>=0;l--)for(let s=0;s<this.notes[l].length;s++)if(c===this.notes[l][s])return l;return 0}}},3236(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.VerticalSourceStaffEntryContainer=void 0;const l=c(2561);g.VerticalSourceStaffEntryContainer=class{constructor(s,u,r){this.staffEntries=[],this.comments=[],this.timestamp=u,this.staffEntries=new Array(r),this.parentMeasure=s}$get$(s){return this.staffEntries[s]}$set$(s,u){this.staffEntries[s]=u}get Timestamp(){return this.timestamp}set Timestamp(s){this.timestamp=s}get StaffEntries(){return this.staffEntries}set StaffEntries(s){this.staffEntries=s}get Comments(){return this.comments}set Comments(s){this.comments=s}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(s){this.parentMeasure=s}getAbsoluteTimestamp(){return l.Fraction.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}},5534(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.Voice=void 0,g.Voice=class{constructor(c,l){this.voiceEntries=[],this.volume=1,this.parent=c,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=l}get VoiceEntries(){return this.voiceEntries}get Parent(){return this.parent}get Visible(){return this.visible}set Visible(c){this.visible=c}get Audible(){return this.audible}set Audible(c){this.audible=c}get Following(){return this.following}set Following(c){this.following=c}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(c){this.volume=c}}},1336(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.StemDirectionType=g.ArticulationEnum=g.VoiceEntry=void 0;const l=c(2561),s=c(1850),u=c(8233),r=c(8215),i=c(8233),o=c(3263);class n{constructor(p,m,x,y=!1,d=!1,S=!1){if(this.notes=[],this.articulations=[],this.technicalInstructions=[],this.lyricsEntries=new o.Dictionary,this.wantedStemDirection=t.Undefined,this.stemDirectionXml=t.Undefined,this.stemDirection=t.Undefined,this.timestamp=p,this.parentVoice=m,this.parentSourceStaffEntry=x,this.isGrace=y,this.graceAfterMainNote=!1,this.graceNoteSlash=d,this.graceSlur=S,x!==void 0){const M=x.VoiceEntries;M.indexOf(this)===-1&&M.push(this)}}get ParentSourceStaffEntry(){return this.parentSourceStaffEntry}get ParentVoice(){return this.parentVoice}get Timestamp(){return this.timestamp}set Timestamp(p){this.timestamp=p}get Notes(){return this.notes}get IsGrace(){return this.isGrace}set IsGrace(p){this.isGrace=p}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(p){this.graceAfterMainNote=p}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(p){this.graceNoteSlash=p}get GraceSlur(){return this.graceSlur}set GraceSlur(p){this.graceSlur=p}get Articulations(){return this.articulations}set Articulations(p){this.articulations=p}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(p){this.arpeggio=p}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(p){this.ornamentContainer=p}set WantedStemDirection(p){this.wantedStemDirection=p}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(p){this.stemDirectionXml=p}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(p){this.stemDirection=p}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(p){this.stemColorXml=p}get StemColor(){return this.stemColor}set StemColor(p){this.stemColor=p}hasArticulation(p){for(const m of this.articulations)if(m.Equals(p))return!0;return!1}static isSupportedArticulation(p){switch(p){case h.accent:case h.strongaccent:case h.softaccent:case h.invertedstrongaccent:case h.staccato:case h.staccatissimo:case h.spiccato:case h.tenuto:case h.fermata:case h.invertedfermata:case h.breathmark:case h.caesura:case h.lefthandpizzicato:case h.naturalharmonic:case h.snappizzicato:case h.upbow:case h.downbow:case h.bend:return!0;default:return!1}}hasTie(){for(let p=0,m=this.Notes.length;p<m;++p)if(this.Notes[p].NoteTie)return!0;return!1}hasSlur(){for(let p=0,m=this.Notes.length;p<m;++p)if(this.Notes[p].NoteSlurs.length>0)return!0;return!1}isStaccato(){for(const p of this.Articulations)if(p.articulationEnum===h.staccato)return!0;return!1}isAccent(){for(const p of this.Articulations)if(p.articulationEnum===h.accent||p.articulationEnum===h.strongaccent)return!0;return!1}getVerseNumberForLyricEntry(p){let m="1";return this.lyricsEntries.forEach((x,y)=>{p===y&&(m=x)}),m}createVoiceEntriesForOrnament(p,m){p||(p=this);const x=[];if(!p.ornamentContainer)return;const y=this.notes[0],d=y.Length,S=p.ParentVoice,M=p.Timestamp;let E=l.Fraction.createFromFraction(M);switch(p.ornamentContainer.GetOrnament){case r.OrnamentEnum.Trill:{const L=new l.Fraction(d.Numerator,8*d.Denominator),I=y.Pitch.getTransposedPitch(1);let T=m.getAlterationForPitch(I);p.OrnamentContainer.AccidentalAbove!==i.AccidentalEnum.NONE&&(T=p.ornamentContainer.AccidentalAbove);for(let A=0;A<8;A++)E=l.Fraction.plus(M,new l.Fraction(A*L.Numerator,L.Denominator)),A%2==0?this.createBaseVoiceEntry(E,L,S,y,x):this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x);break}case r.OrnamentEnum.Turn:{const L=new l.Fraction(d.Numerator,4*d.Denominator),I=y.Pitch.getTransposedPitch(-1),T=m.getAlterationForPitch(I),A=y.Pitch.getTransposedPitch(1),v=m.getAlterationForPitch(A);this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,A,v,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x),E.Add(L),this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x);break}case r.OrnamentEnum.InvertedTurn:{const L=new l.Fraction(d.Numerator,4*d.Denominator),I=y.Pitch.getTransposedPitch(-1),T=m.getAlterationForPitch(I),A=y.Pitch.getTransposedPitch(1),v=m.getAlterationForPitch(A);this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x),E.Add(L),this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,A,v,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x);break}case r.OrnamentEnum.DelayedTurn:{const L=new l.Fraction(d.Numerator,2*d.Denominator),I=y.Pitch.getTransposedPitch(-1),T=m.getAlterationForPitch(I),A=y.Pitch.getTransposedPitch(1),v=m.getAlterationForPitch(A);this.createBaseVoiceEntry(E,L,S,y,x),E=l.Fraction.plus(M,L),L.Denominator=8*d.Denominator,this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,A,v,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x),E.Add(L),this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x);break}case r.OrnamentEnum.DelayedInvertedTurn:{const L=new l.Fraction(d.Numerator,2*d.Denominator),I=y.Pitch.getTransposedPitch(-1),T=m.getAlterationForPitch(I),A=y.Pitch.getTransposedPitch(1),v=m.getAlterationForPitch(A);this.createBaseVoiceEntry(E,L,S,y,x),E=l.Fraction.plus(M,L),L.Denominator=8*d.Denominator,this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x),E.Add(L),this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,A,v,x),E.Add(L),this.createBaseVoiceEntry(E,L,S,y,x);break}case r.OrnamentEnum.Mordent:{const L=new l.Fraction(d.Numerator,4*d.Denominator),I=y.Pitch.getTransposedPitch(1),T=m.getAlterationForPitch(I);this.createBaseVoiceEntry(E,L,S,y,x),E.Add(L),this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x),L.Denominator=2*d.Denominator,E=l.Fraction.plus(M,L),this.createBaseVoiceEntry(E,L,S,y,x);break}case r.OrnamentEnum.InvertedMordent:{const L=new l.Fraction(d.Numerator,4*d.Denominator),I=y.Pitch.getTransposedPitch(-1),T=m.getAlterationForPitch(I);this.createBaseVoiceEntry(E,L,S,y,x),E.Add(L),this.createAlteratedVoiceEntry(E,L,S,y.SourceMeasure,I,T,x),L.Denominator=2*d.Denominator,E=l.Fraction.plus(M,L),this.createBaseVoiceEntry(E,L,S,y,x);break}default:throw new RangeError}return x}createBaseVoiceEntry(p,m,x,y,d){const S=new n(p,x,y.ParentStaffEntry),M=new u.Pitch(y.Pitch.FundamentalNote,y.Pitch.Octave,y.Pitch.Accidental),E=new s.Note(S,void 0,m,M,y.SourceMeasure);S.Notes.push(E),d.push(S)}createAlteratedVoiceEntry(p,m,x,y,d,S,M){const E=new n(p,x,void 0),L=new u.Pitch(d.FundamentalNote,d.Octave,S),I=new s.Note(E,void 0,m,L,y);E.Notes.push(I),M.push(E)}}var h,t;g.VoiceEntry=n,function(f){f[f.accent=0]="accent",f[f.strongaccent=1]="strongaccent",f[f.softaccent=2]="softaccent",f[f.marcatoup=3]="marcatoup",f[f.marcatodown=4]="marcatodown",f[f.invertedstrongaccent=5]="invertedstrongaccent",f[f.staccato=6]="staccato",f[f.staccatissimo=7]="staccatissimo",f[f.spiccato=8]="spiccato",f[f.tenuto=9]="tenuto",f[f.fermata=10]="fermata",f[f.invertedfermata=11]="invertedfermata",f[f.breathmark=12]="breathmark",f[f.caesura=13]="caesura",f[f.lefthandpizzicato=14]="lefthandpizzicato",f[f.naturalharmonic=15]="naturalharmonic",f[f.snappizzicato=16]="snappizzicato",f[f.upbow=17]="upbow",f[f.downbow=18]="downbow",f[f.scoop=19]="scoop",f[f.plop=20]="plop",f[f.doit=21]="doit",f[f.falloff=22]="falloff",f[f.stress=23]="stress",f[f.unstress=24]="unstress",f[f.detachedlegato=25]="detachedlegato",f[f.otherarticulation=26]="otherarticulation",f[f.bend=27]="bend"}(h||(g.ArticulationEnum=h={})),function(f){f[f.Undefined=-1]="Undefined",f[f.Up=0]="Up",f[f.Down=1]="Down",f[f.None=2]="None",f[f.Double=3]="Double"}(t||(g.StemDirectionType=t={}))},7456(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(4236),g),s(c(8365),g),s(c(9719),g),s(c(7718),g),s(c(4249),g),s(c(1850),g),s(c(4064),g),s(c(5282),g),s(c(8215),g),s(c(4387),g),s(c(2369),g),s(c(1910),g),s(c(6644),g),s(c(5274),g),s(c(4268),g),s(c(3236),g),s(c(5534),g),s(c(1336),g),s(c(9184),g),s(c(1850),g),s(c(5282),g),s(c(4387),g),s(c(2369),g),s(c(3236),g),s(c(5274),g)},1745(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(7307),g),s(c(9252),g),s(c(7586),g),s(c(7435),g),s(c(427),g),s(c(5294),g),s(c(7456),g),s(c(4076),g),s(c(1121),g),s(c(6352),g),s(c(899),g),s(c(2870),g)},3173(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.AJAX=void 0,g.AJAX=class{static ajax(c,l=9e3){let s;const u=c.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)s=new XMLHttpRequest;else{if(!ActiveXObject)return Promise.reject(new Error("XMLHttp not supported."));s=new ActiveXObject("Microsoft.XMLHTTP")}return s.timeout=l,new Promise((r,i)=>{s.onreadystatechange=()=>{s.readyState===XMLHttpRequest.DONE&&(s.status===200||s.status===0&&s.responseText?r(s.responseText):i(new Error("Could not retrieve requested URL "+s.status)))},s.ontimeout=o=>{i(new Error("Server request Timeout"))},s.overrideMimeType(u),s.open("GET",c,!0),s.send()})}}},6597(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.Cursor=void 0;const l=c(2561),s=c(624);g.Cursor=class{constructor(u,r,i){this.hidden=!0,this.currentPageNumber=1,this.skipInvisibleNotes=!0,this.container=u,this.openSheetMusicDisplay=r,this.rules=this.openSheetMusicDisplay.EngravingRules,this.cursorOptions=i;let o=0;for(this.cursorElementId="cursorImg-0";document.getElementById(this.cursorElementId);)o++,this.cursorElementId=`cursorImg-${o}`;const n=document.createElement("img");n.id=this.cursorElementId,n.style.position="absolute",this.cursorOptions.follow===!0?(this.wantedZIndex="-1",n.style.zIndex=this.wantedZIndex):(this.wantedZIndex="-2",n.style.zIndex=this.wantedZIndex),this.cursorElement=n,this.container.appendChild(n)}adjustToBackgroundColor(){let u;u=this.rules.PageBackgroundColor?"1":this.wantedZIndex,this.cursorElement.style.zIndex=u}init(u,r){this.manager=u,this.graphic=r,this.reset(),this.hidden=!0,this.hide()}show(){this.hidden=!1,this.update(),this.adjustToBackgroundColor()}resetIterator(){if(!this.openSheetMusicDisplay.Sheet||!this.openSheetMusicDisplay.Sheet.SourceMeasures)return void console.log("OSMD.Cursor.resetIterator(): sheet or measures were null/undefined.");const u=this.openSheetMusicDisplay.Sheet.SourceMeasures.length-1;let r=this.rules.MinMeasureToDrawIndex;r=Math.min(r,u);let i=this.rules.MaxMeasureToDrawIndex;if(i=Math.min(i,u),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>r&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[r].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>i){const o=this.openSheetMusicDisplay.Sheet.SourceMeasures[i];this.openSheetMusicDisplay.Sheet.SelectionEnd=l.Fraction.plus(o.AbsoluteTimestamp,o.Duration)}this.iterator=this.manager.getIterator(),this.iterator.SkipInvisibleNotes=this.skipInvisibleNotes}getStaffEntryFromVoiceEntry(u){const r=u.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,i=u.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(i,r,u.ParentSourceStaffEntry)}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();const u=this.iterator;let r,i=u.CurrentVisibleVoiceEntries(),o=u.CurrentMeasureIndex,n=0,h=0,t=0;if(i.length!==0||u.FrontReached||u.EndReached||(u.moveToPrevious(),i=u.CurrentVisibleVoiceEntries(),u.moveToNext()),u.FrontReached&&i.length===0){u.moveToNext(),i=u.CurrentVisibleVoiceEntries();const y=this.findVisibleGraphicalMeasure(u.CurrentMeasureIndex);n=y.PositionAndShape.AbsolutePosition.x,r=y.ParentMusicSystem,u.moveToPrevious()}else if(u.EndReached||!u.CurrentVoiceEntries||i.length===0){u.moveToPrevious(),i=u.CurrentVisibleVoiceEntries(),o=u.CurrentMeasureIndex;const y=this.findVisibleGraphicalMeasure(u.CurrentMeasureIndex);n=y.PositionAndShape.AbsolutePosition.x+y.PositionAndShape.Size.width,r=y.ParentMusicSystem,u.moveToNext()}else if(u.CurrentMeasure.isReducedToMultiRest){const y=this.findVisibleGraphicalMeasure(u.CurrentMeasureIndex),d=y.parentSourceMeasure.multipleRestMeasures,S=u.CurrentMeasure.multipleRestMeasureNumber/(d+1),M=y.PositionAndShape.Size.width-y.beginInstructionsWidth;n=y.PositionAndShape.AbsolutePosition.x+y.beginInstructionsWidth+S*M,r=y.ParentMusicSystem}else{const y=i.map(d=>this.getStaffEntryFromVoiceEntry(d)).sort((d,S)=>{var M,E,L,I;return((E=(M=d==null?void 0:d.PositionAndShape)==null?void 0:M.AbsolutePosition)==null?void 0:E.x)<=((I=(L=S==null?void 0:S.PositionAndShape)==null?void 0:L.AbsolutePosition)==null?void 0:I.x)?-1:1})[0];y&&(n=y.PositionAndShape.AbsolutePosition.x,r=y.parentMeasure.ParentMusicSystem)}if(!(r!=null&&r.StaffLines[0]))return;h=r.PositionAndShape.AbsolutePosition.y+r.StaffLines[0].PositionAndShape.RelativePosition.y;let f=r.PositionAndShape.AbsolutePosition.y;const p=r.StaffLines[r.StaffLines.length-1];p&&(f+=p.PositionAndShape.RelativePosition.y+p.StaffHeight),t=f-h;const m=this.findVisibleGraphicalMeasure(o);if(!m)return;const x=m.PositionAndShape;if(this.updateWidthAndStyle(x,n,h,t),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{const y=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:y<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}findVisibleGraphicalMeasure(u){for(let r=0;r<this.graphic.NumberOfStaves;r++){const i=this.graphic.findGraphicalMeasure(this.iterator.CurrentMeasureIndex,r);if(i!=null&&i.ParentStaff.isVisible())return i}}updateWidthAndStyle(u,r,i,o){const n=this.cursorElement;let h=0;switch(this.cursorOptions.type){case s.CursorType.ThinLeft:n.style.top=10*i*this.openSheetMusicDisplay.zoom+"px",n.style.left=10*(r-1.5)*this.openSheetMusicDisplay.zoom+"px",n.height=10*o*this.openSheetMusicDisplay.zoom,h=5*this.openSheetMusicDisplay.zoom;break;case s.CursorType.ShortThinTopLeft:n.style.top=10*(i-2.5)*this.openSheetMusicDisplay.zoom+"px",n.style.left=10*r*this.openSheetMusicDisplay.zoom+"px",n.height=15*this.openSheetMusicDisplay.zoom,h=5*this.openSheetMusicDisplay.zoom;break;case s.CursorType.CurrentArea:n.style.top=10*u.AbsolutePosition.y*this.openSheetMusicDisplay.zoom+"px",n.style.left=10*u.AbsolutePosition.x*this.openSheetMusicDisplay.zoom+"px",n.height=10*o*this.openSheetMusicDisplay.zoom,h=10*u.Size.width*this.openSheetMusicDisplay.zoom;break;case s.CursorType.CurrentAreaLeft:n.style.top=10*u.AbsolutePosition.y*this.openSheetMusicDisplay.zoom+"px",n.style.left=10*u.AbsolutePosition.x*this.openSheetMusicDisplay.zoom+"px",n.height=10*o*this.openSheetMusicDisplay.zoom,h=10*(r-u.AbsolutePosition.x)*this.openSheetMusicDisplay.zoom;break;default:n.style.top=10*i*this.openSheetMusicDisplay.zoom+"px",n.style.left=10*(r-1.5)*this.openSheetMusicDisplay.zoom+"px",n.height=10*o*this.openSheetMusicDisplay.zoom,h=30*this.openSheetMusicDisplay.zoom}n.width=h,this.cursorOptionsRendered!==this.cursorOptions&&this.updateStyle(h,this.cursorOptions)}hide(){this.cursorElement.style.display="none",this.hidden=!0}previous(){this.iterator.moveToPreviousVisibleVoiceEntry(!1),this.update()}next(){this.iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator(),this.update()}updateStyle(u,r=void 0){r!==void 0&&(this.cursorOptions=r);const i=document.createElement("canvas");i.width=this.cursorElement.width,i.height=1;const o=i.getContext("2d");o.globalAlpha=this.cursorOptions.alpha;const n=o.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case s.CursorType.ThinLeft:case s.CursorType.ShortThinTopLeft:case s.CursorType.CurrentArea:case s.CursorType.CurrentAreaLeft:n.addColorStop(1,this.cursorOptions.color);break;default:n.addColorStop(0,"white"),n.addColorStop(.2,this.cursorOptions.color),n.addColorStop(.8,this.cursorOptions.color),n.addColorStop(1,"white")}o.fillStyle=n,o.fillRect(0,0,u,1),this.cursorOptionsRendered={...this.cursorOptions},this.cursorElement.src=i.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(u){return this.iterator.CurrentVisibleVoiceEntries(u)}NotesUnderCursor(u){const r=this.VoicesUnderCursor(u),i=[];return r.forEach(o=>{i.push(...o.Notes)}),i}GNotesUnderCursor(u){const r=this.VoicesUnderCursor(u),i=[];return r.forEach(o=>{i.push(...o.Notes.map(n=>this.rules.GNote(n)))}),i}updateCurrentPage(){let u=this.iterator.currentTimeStamp;u.RealValue<0&&(u=new l.Fraction(0,0));for(const r of this.graphic.MusicPages)if(r.MusicSystems.last().GetSystemsLastTimeStamp().gt(u)){const i=r.PageNumber;return i!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById("osmdCanvasPage"+i),this.container.appendChild(this.cursorElement)),this.currentPageNumber=i}return 1}get SkipInvisibleNotes(){return this.skipInvisibleNotes}set SkipInvisibleNotes(u){this.skipInvisibleNotes=u,this.iterator.SkipInvisibleNotes=u}get CursorOptions(){return this.cursorOptions}set CursorOptions(u){this.cursorOptions=u}Dispose(){this.hide(),this.container.removeChild(this.cursorElement),this.rules=void 0,this.openSheetMusicDisplay=void 0,this.cursorOptions=void 0}nextMeasure(){const u=this.Iterator.CurrentMeasure;let r=this.Iterator.currentTimeStamp.RealValue;this.next();let i=0;for(;this.Iterator.CurrentMeasure===u&&this.Iterator.currentTimeStamp.RealValue!==r&&i<999;)r=this.Iterator.currentTimeStamp.RealValue,this.next(),i++}previousMeasure(){const u=this.Iterator.CurrentMeasure;let r=this.Iterator.currentTimeStamp.RealValue;this.previous();let i=0;for(;this.Iterator.CurrentMeasure===u&&this.Iterator.currentTimeStamp.RealValue!==r&&i<999;)r=this.Iterator.currentTimeStamp.RealValue,this.previous(),i++;for(i=0;this.Iterator.CurrentRelativeInMeasureTimestamp.RealValue!==0&&i<999;)this.previous(),i++}}},624(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.OSMDOptions=g.SkyBottomLineBatchCalculatorBackendType=g.BackendType=g.FillEmptyMeasuresWithWholeRests=g.AlignRestOption=g.CursorType=void 0;const l=c(4146);var s,u,r,i,o;(function(n){n[n.Standard=0]="Standard",n[n.ThinLeft=1]="ThinLeft",n[n.ShortThinTopLeft=2]="ShortThinTopLeft",n[n.CurrentArea=3]="CurrentArea",n[n.CurrentAreaLeft=4]="CurrentAreaLeft"})(s||(g.CursorType=s={})),function(n){n[n.Never=0]="Never",n[n.Always=1]="Always",n[n.Auto=2]="Auto"}(u||(g.AlignRestOption=u={})),function(n){n[n.No=0]="No",n[n.YesVisible=1]="YesVisible",n[n.YesInvisible=2]="YesInvisible"}(r||(g.FillEmptyMeasuresWithWholeRests=r={})),function(n){n[n.SVG=0]="SVG",n[n.Canvas=1]="Canvas"}(i||(g.BackendType=i={})),function(n){n[n.Plain=0]="Plain",n[n.WebGL=1]="WebGL"}(o||(g.SkyBottomLineBatchCalculatorBackendType=o={})),g.OSMDOptions=class{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:l.DrawingParametersEnum.default}}static BackendTypeFromString(n){return n&&n.toLowerCase()==="canvas"?i.Canvas:i.SVG}}},7103(de,g,c){var l=this&&this.__importDefault||function(D){return D&&D.__esModule?D:{default:D}};Object.defineProperty(g,"__esModule",{value:!0}),g.OpenSheetMusicDisplay=void 0;const s=c(3902),u=c(806),r=c(9099),i=c(8724),o=c(7921),n=c(9479),h=c(9436),t=c(9834),f=c(6597),p=c(6888),m=c(3173),x=l(c(3065)),y=c(3661),d=c(4146),S=c(4434),M=c(624),E=c(9713),L=c(6362),I=c(3263),T=c(2683),A=c(8233),v=c(1538);class B{constructor(_,F=M.OSMDOptions.OSMDOptionsStandard()){if(this.version="1.9.9-release",this.cursorsOptions=[],this.cursors=[],this.zoom=1,this.zoomUpdated=!1,this.loadUrlTimeout=5e3,typeof _=="string"?this.container=document.getElementById(_):_&&"appendChild"in _&&(this.container=_),!this.container)throw new Error("Please pass a valid div container to OpenSheetMusicDisplay");F.autoResize===void 0&&(F.autoResize=!0),this.backendType=M.BackendType.SVG,this.setOptions(F)}get cursor(){return this.cursors[0]}get Cursor(){return this.cursor}load(_,F="Untitled Score"){this.reset();const k=this;if(_ instanceof Blob){const oe=new p.MXLFile(_);return oe.tryUnzip().then(()=>oe.unzipSuccessful?oe.getXmlString().then($=>k.load($)):_ instanceof Blob?_.text().then($=>k.load($)):void 0)}if(typeof _=="string"){const oe=_;if(oe.startsWith("PK"))return x.default.debug("[OSMD] This is a zip file, unpack it first: "+oe),p.MXLHelper.MXLtoXMLstring(oe).then(Q=>k.load(Q),Q=>{throw x.default.debug(Q),new Error("OpenSheetMusicDisplay: Invalid MXL file")});if(oe.startsWith(""))return x.default.debug("[OSMD] UTF with BOM detected, truncate first 3 bytes and pass along: "+oe),k.load(oe.substring(3));let $=oe;if(/^\s/.test($)&&($=$.trim()),$.startsWith("<?xml")){const Q=this.OnXMLRead($);x.default.debug("[OSMD] Finally parsing XML content, length: "+Q.length),_=new DOMParser().parseFromString(Q,"application/xml")}else{if($.length<2083)return x.default.debug("[OSMD] Retrieve the file at the given URL: "+$),m.AJAX.ajax($,this.loadUrlTimeout).then(Q=>k.load(Q),Q=>{throw Q});console.error("[OSMD] osmd.load(string): Could not process string. Did not find <?xml at beginning.")}}if(!_||!_.nodeName)return Promise.reject(new Error("OpenSheetMusicDisplay: The document which was provided is invalid"));const j=_,P=j.childNodes;let G;x.default.debug("[OSMD] load(), Document url: "+j.URL);for(let oe=0,$=P.length;oe<$;oe+=1){const Q=P[oe];if(Q.nodeType===Node.ELEMENT_NODE&&Q.nodeName.toLowerCase()==="score-partwise"){G=Q;break}}if(!G)return console.error("Could not parse MusicXML, no valid partwise element found"),Promise.reject(new Error("OpenSheetMusicDisplay: Document is not a valid 'partwise' MusicXML"));const Y=new s.IXmlElement(G),X=new v.TemposCalculator,ie=new r.MusicSheetReader([X],this.rules);return this.sheet=ie.createMusicSheet(Y,F),this.sheet===void 0?Promise.reject(new Error("given music sheet was incomplete or could not be loaded.")):(x.default.info(`[OSMD] Loaded sheet ${this.sheet.TitleString} successfully.`),this.needBackendUpdate=!0,this.updateGraphic(),Promise.resolve({}))}updateGraphic(){const _=new u.VexFlowMusicSheetCalculator(this.rules);this.graphic=new i.GraphicalMusicSheet(this.sheet,_),this.drawingParameters.drawCursors&&this.cursors.forEach(F=>{F.init(this.sheet.MusicPartManager,this.graphic)}),this.drawingParameters.DrawingParametersEnum===d.DrawingParametersEnum.leadsheet&&(this.graphic.LeadSheet=!0)}render(){var F;if(!this.graphic)throw new Error("OSMD: load() needs to be called before render()");(F=this.drawer)==null||F.clear(),this.Sheet.SourceMeasures[0].ImplicitMeasure&&(this.rules.MinMeasureToDrawNumber>1&&(this.rules.MinMeasureToDrawIndex=this.rules.MinMeasureToDrawNumber),this.rules.MaxMeasureToDrawNumber>0&&(this.rules.MaxMeasureToDrawIndex=this.rules.MaxMeasureToDrawNumber));let _=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(_=this.rules.SheetMaximumWidth),this.sheet.pageWidth=_/this.zoom/10,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?(this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio,x.default.debug("[OSMD] PageHeight: "+this.rules.PageHeight)):(x.default.debug("[OSMD] endless/undefined pageformat, id: "+this.rules.PageFormat.idString),this.rules.PageHeight=100001),this.graphic.reCalculate(),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(k=>{k.update()}),this.zoomUpdated=!1,this.rules.RenderCount++}createOrRefreshRenderBackend(){if(this.drawer&&this.drawer.Backends){this.drawer.Backends[0]&&this.drawer.Backends[0].removeAllChildrenFromContainer(this.container);for(const j of this.drawer.Backends)j.free();this.drawer.Backends.clear()}this.drawingParameters.Rules=this.rules,this.drawer=new n.VexFlowMusicSheetDrawer(this.drawingParameters),this.drawer.drawableBoundingBoxElement=this.DrawBoundingBox,this.drawer.bottomLineVisible=this.drawBottomLine,this.drawer.skyLineVisible=this.drawSkyLine;let _,F=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(F=10*(this.EngravingRules.PageLeftMargin+this.graphic.MusicPages[0].PositionAndShape.Size.width+this.EngravingRules.PageRightMargin)*this.zoom);const k=32767;for(const j of this.graphic.MusicPages){if(j.PageNumber>this.rules.MaxPageToDrawNumber)break;const P=this.createBackend(this.backendType,j),G=" exceeds CanvasBackend limit of 32767. Cutting off score.";P.getOSMDBackendType()===M.BackendType.Canvas&&F>k&&(x.default.warn("[OSMD] Warning: width of "+F+G),F=k),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?_=F/this.rules.PageFormat.aspectRatio:(_=j.PositionAndShape.Size.height,_+=this.rules.PageBottomMargin,P.getOSMDBackendType()===M.BackendType.Canvas&&(_+=.1),_+=j.PositionAndShape.BorderTop,this.rules.RenderTitle&&(_+=this.rules.TitleTopDistance),_*=10*this.zoom),P.getOSMDBackendType()===M.BackendType.Canvas&&_>k&&(x.default.warn("[OSMD] Warning: height of "+_+G),_=Math.min(_,k)),P.resize(F,_),P.clear(),P.getContext().setFillStyle(this.rules.DefaultColorMusic),P.getContext().setStrokeStyle(this.rules.DefaultColorMusic),this.drawer.Backends.push(P),this.graphic.drawer=this.drawer}}exportSVG(){if(this.drawer)for(const _ of this.drawer.Backends)_ instanceof h.SvgVexFlowBackend&&_.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var _;(_=this.drawer)==null||_.clear(),this.reset()}setOptions(_){if(this.rules||(this.rules=new E.EngravingRules),this.drawingParameters||_.drawingParameters?_.drawingParameters&&(this.drawingParameters?this.drawingParameters.DrawingParametersEnum=d.DrawingParametersEnum[_.drawingParameters.toLowerCase()]:this.drawingParameters=new y.DrawingParameters(d.DrawingParametersEnum[_.drawingParameters],this.rules)):this.drawingParameters=new y.DrawingParameters(d.DrawingParametersEnum.default,this.rules),_==null)return void x.default.warn(`warning: osmd.setOptions() called without an options parameter, has no effect.
|
|
example usage: osmd.setOptions({drawCredits: false, drawPartNames: false})`);this.OnXMLRead=function(j){return j},_.onXMLRead&&(this.OnXMLRead=_.onXMLRead);let F=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(_.backend!==void 0){const j=M.OSMDOptions.BackendTypeFromString(_.backend);F=F||this.backendType!==j,this.backendType=j}this.needBackendUpdate=F,_.autoBeam!==void 0&&(this.rules.AutoBeamNotes=_.autoBeam);const k=_.autoBeamOptions;if(k&&(k.maintain_stem_directions===void 0&&(k.maintain_stem_directions=!1),this.rules.AutoBeamOptions=k,k.groups&&k.groups.length)){for(const j of k.groups)if(j.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}_.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=_.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&_.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=_.percussionForceVoicesOneLineCutoff),_.alignRests!==void 0&&(this.rules.AlignRests=_.alignRests),_.coloringMode!==void 0&&this.setColoringMode(_),_.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=_.coloringEnabled),_.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=_.colorStemsLikeNoteheads),_.disableCursor&&(this.drawingParameters.drawCursors=!1),_.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),_.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=_.drawCredits),_.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=_.drawComposer),_.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=_.drawTitle),_.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=_.drawSubtitle),_.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=_.drawLyricist),_.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=_.drawMetronomeMarks),_.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=_.drawPartNames,_.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=_.drawPartNames)),_.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=_.drawPartAbbreviations),_.drawFingerings===!1&&(this.rules.RenderFingerings=!1),_.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=_.drawMeasureNumbers),_.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=_.drawMeasureNumbersOnlyAtSystemStart),_.drawLyrics!==void 0&&(this.rules.RenderLyrics=_.drawLyrics),_.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=_.drawTimeSignatures),_.drawSlurs!==void 0&&(this.rules.RenderSlurs=_.drawSlurs),_.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=_.measureNumberInterval),_.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=_.useXMLMeasureNumbers),_.fingeringPosition!==void 0&&(this.rules.FingeringPosition=L.AbstractExpression.PlacementEnumFromString(_.fingeringPosition)),_.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=_.fingeringInsideStafflines),_.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=_.newSystemFromXML),_.newSystemFromNewPageInXML!==void 0&&(this.rules.NewSystemAtXMLNewPageAttribute=_.newSystemFromNewPageInXML),_.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=_.newPageFromXML),_.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=_.fillEmptyMeasuresWithWholeRest),_.followCursor!==void 0&&(this.FollowCursor=_.followCursor),_.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=_.setWantedStemDirectionByXml),_.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000",this.rules.DarkModeEnabled=!0):_.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0,this.rules.DarkModeEnabled=!1),_.defaultColorMusic&&this.rules.applyDefaultColorMusic(_.defaultColorMusic),_.defaultColorNotehead&&(this.rules.DefaultColorNotehead=_.defaultColorNotehead),_.defaultColorRest&&(this.rules.DefaultColorRest=_.defaultColorRest),_.defaultColorStem&&(this.rules.DefaultColorStem=_.defaultColorStem),_.defaultColorLabel&&(this.rules.DefaultColorLabel=_.defaultColorLabel),_.defaultColorTitle&&(this.rules.DefaultColorTitle=_.defaultColorTitle),_.defaultFontFamily&&(this.rules.DefaultFontFamily=_.defaultFontFamily),_.defaultFontStyle&&(this.rules.DefaultFontStyle=_.defaultFontStyle),_.drawUpToMeasureNumber>=0&&(this.rules.MaxMeasureToDrawIndex=Math.max(_.drawUpToMeasureNumber-1,0),this.rules.MaxMeasureToDrawNumber=_.drawUpToMeasureNumber),_.drawFromMeasureNumber>=0&&(this.rules.MinMeasureToDrawIndex=Math.max(_.drawFromMeasureNumber-1,0),this.rules.MinMeasureToDrawNumber=_.drawFromMeasureNumber),_.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=_.drawUpToPageNumber),_.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=_.drawUpToSystemNumber),_.tupletsRatioed&&(this.rules.TupletsRatioed=!0),_.tupletsBracketed&&(this.rules.TupletsBracketed=!0),_.tripletsBracketed&&(this.rules.TripletsBracketed=!0),_.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):_.autoResize===!1&&(this.autoResizeEnabled=!1),_.pageFormat!==void 0&&this.setPageFormat(_.pageFormat),_.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=_.pageBackgroundColor),_.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=_.renderSingleHorizontalStaffline),_.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=_.spacingFactorSoftmax),_.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=_.spacingBetweenTextLines),_.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=_.stretchLastSystemLine),_.autoGenerateMultipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMultipleRestMeasuresFromRestMeasures=_.autoGenerateMultipleRestMeasuresFromRestMeasures),_.cursorsOptions!==void 0?this.cursorsOptions=_.cursorsOptions:this.cursorsOptions=[{type:M.CursorType.Standard,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}],_.preferredSkyBottomLineBatchCalculatorBackend!==void 0&&(this.rules.PreferredSkyBottomLineBatchCalculatorBackend=_.preferredSkyBottomLineBatchCalculatorBackend),_.skyBottomLineBatchMinMeasures!==void 0&&(this.rules.SkyBottomLineBatchMinMeasures=_.skyBottomLineBatchMinMeasures)}setColoringMode(_){if(_.coloringMode===S.ColoringModes.XML)return void(this.rules.ColoringMode=S.ColoringModes.XML);const F=[A.NoteEnum.C,A.NoteEnum.D,A.NoteEnum.E,A.NoteEnum.F,A.NoteEnum.G,A.NoteEnum.A,A.NoteEnum.B];let k;if(_.coloringMode===S.ColoringModes.CustomColorSet){if(!_.coloringSetCustom||_.coloringSetCustom.length!==8)throw new Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter (array) with 8 strings (C to B, rest note).");for(const P of _.coloringSetCustom)if(!/^#[0-9a-fA-F]{6}$/.test(P))throw new Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:
|
|
`+P);k=_.coloringSetCustom}else if(_.coloringMode===S.ColoringModes.AutoColoring){k=[];const P=Object.keys(T.AutoColorSet);for(let G=0;G<P.length;G++)k.push(T.AutoColorSet[P[G]])}const j=new I.Dictionary;for(let P=0;P<F.length;P++)j.setValue(F[P],k[P]);j.setValue(-1,k.last()),this.rules.ColoringSetCurrent=j,this.rules.ColoringMode=_.coloringMode}setLogLevel(_){switch(_){case"trace":x.default.setLevel(x.default.levels.TRACE);break;case"debug":x.default.setLevel(x.default.levels.DEBUG);break;case"info":x.default.setLevel(x.default.levels.INFO);break;case"warn":x.default.setLevel(x.default.levels.WARN);break;case"error":x.default.setLevel(x.default.levels.ERROR);break;case"silent":x.default.setLevel(x.default.levels.SILENT);break;default:x.default.warn(`Could not set log level to ${_}. Using warn instead.`),x.default.setLevel(x.default.levels.WARN)}}getLogLevel(){return x.default.getLevel()}reset(){this.drawingParameters.drawCursors&&this.cursors.forEach(_=>{_.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1,this.rules.RenderCount=0}autoResize(){const _=this;this.handleResize(()=>{},()=>{var F;((F=this.graphic)==null?void 0:F.GetCalculator)instanceof u.VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),_.IsReadyToRender()&&_.renderAndScrollBack()})}renderAndScrollBack(){const _=window.scrollY/document.body.scrollHeight;this.render();const F=document.body.scrollHeight*_;window.scrollTo({top:F,behavior:"instant"})}handleResize(_,F){let k,j;const P=this;function G(){P.AutoResizeEnabled&&(k=new Date().getTime(),j||(_(),k=new Date().getTime(),j=window.setTimeout(Y,200)))}function Y(){j=void 0,window.clearTimeout(j),new Date().getTime()-k<200?j=window.setTimeout(Y,200):F()}window.attachEvent?window.attachEvent("onresize",G):window.addEventListener("resize",G),this.resizeHandlerAttached=!0,window.setTimeout(_,0),window.setTimeout(F,1)}enableOrDisableCursors(_){var F,k,j,P;if(this.drawingParameters.drawCursors=_,_)for(let G=0;G<this.cursorsOptions.length;G++){const Y=((F=this.cursors[G])==null?void 0:F.Hidden)??!0,X=(k=this.cursors[G])==null?void 0:k.Iterator;(j=this.cursors[G])==null||j.hide();let ie=(P=this.drawer)==null?void 0:P.Backends[0];if(ie&&this.rules.RestoreCursorAfterRerender&&this.cursors[G]){const oe=this.cursors[G].updateCurrentPage();ie=this.drawer.Backends[oe-1]}ie&&ie.getRenderElement()&&(this.cursors[G]=new f.Cursor(ie.getRenderElement(),this,this.cursorsOptions[G])),this.sheet&&this.graphic&&this.cursors[G]&&this.cursors[G].init(this.sheet.MusicPartManager,this.graphic),this.rules.RestoreCursorAfterRerender&&(this.cursors[G].hidden=Y,X&&(this.cursors[G].iterator=X,this.cursors[G].update()))}else this.cursors.forEach(G=>{G.hide()})}createBackend(_,F){let k;return k=_===void 0||_===M.BackendType.SVG?new h.SvgVexFlowBackend(this.rules):new t.CanvasVexFlowBackend(this.rules),k.graphicalMusicPage=F,k.initialize(this.container,this.zoom),k}static StringToPageFormat(_){let F=E.PageFormat.UndefinedPageFormat;if(_.match("^[0-9]+x[0-9]+$")){const k=_.split("x"),j=Number.parseInt(k[0],10),P=Number.parseInt(k[1],10);j>0&&j<32768&&P>0&&P<32768&&(F=new E.PageFormat(j,P,`customPageFormat${_}`))}return _=(_=(_=_.replace(" ","_")).replace("Landscape","L")).replace("Portrait","P"),B.PageFormatStandards.hasOwnProperty(_)&&(F=B.PageFormatStandards[_]),F}setPageFormat(_){const F=B.StringToPageFormat(_);this.needBackendUpdate=!F.Equals(this.rules.PageFormat),this.rules.PageFormat=F}setCustomPageFormat(_,F){if(_>0&&F>0){const k=new E.PageFormat(_,F);this.rules.PageFormat=k}}set DrawSkyLine(_){this.drawSkyLine=_,this.drawer&&(this.drawer.skyLineVisible=_)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(_){this.drawBottomLine=_,this.drawer&&(this.drawer.bottomLineVisible=_)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(_){this.setDrawBoundingBox(_,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(_,F=!1){this.drawBoundingBox=_,this.drawer&&(this.drawer.drawableBoundingBoxElement=_),F&&this.renderAndScrollBack()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(_){this.autoResizeEnabled=_}get Zoom(){return this.zoom}set Zoom(_){var F;this.zoom=_,this.zoomUpdated=!0,((F=this.graphic)==null?void 0:F.GetCalculator)instanceof u.VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(_){this.followCursor=_}get FollowCursor(){return this.followCursor}set TransposeCalculator(_){o.MusicSheetCalculator.transposeCalculator=_}get TransposeCalculator(){return o.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}}g.OpenSheetMusicDisplay=B,B.PageFormatStandards={A3_L:new E.PageFormat(420,297,"A3_L"),A3_P:new E.PageFormat(297,420,"A3_P"),A4_L:new E.PageFormat(297,210,"A4_L"),A4_P:new E.PageFormat(210,297,"A4_P"),A5_L:new E.PageFormat(210,148,"A5_L"),A5_P:new E.PageFormat(148,210,"A5_P"),A6_L:new E.PageFormat(148,105,"A6_L"),A6_P:new E.PageFormat(105,148,"A6_P"),Endless:E.PageFormat.UndefinedPageFormat,Letter_L:new E.PageFormat(279.4,215.9,"Letter_L"),Letter_P:new E.PageFormat(215.9,279.4,"Letter_P")}},5955(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(3173),g),s(c(6597),g),s(c(624),g),s(c(7103),g)},8628(de,g,c){Object.defineProperty(g,"__esModule",{value:!0}),g.TransposeCalculator=void 0;const l=c(9735);class s{transposePitch(r,i,o){if(o===0)return r;let n=l.NoteEnum.C,h=0,t=l.AccidentalEnum.NONE;const f=l.Pitch.CalculateTransposedHalfTone(r,o);let p=f.halftone,m=f.overflow;for(let x=0;x<s.noteEnums.length;x++){const y=s.noteEnums[x];if(y===p){const d=x;return n=s.noteEnums[d],h=r.Octave+m,t=l.AccidentalEnum.NONE,new l.Pitch(n,h,t)}if(y>p)break}for(let x=0;x<s.noteEnums.length;x++)if(s.noteEnums[x]>p){let y=x;const d=l.Pitch.HalfTonesFromAccidental(r.Accidental),S=d>0,M=d<0,E=i.Key>0,L=i.Key<0;let I=!0;for(E?I=!0:L?I=!1:(S||M)&&(I=S),I&&y--;y<0;)y+=7,p+=12,m--;for(;y>=7;)y-=7,p-=12,m++;n=s.noteEnums[y],t=l.Pitch.AccidentalFromHalfTones(p-n),h=r.Octave+m;break}return new l.Pitch(n,h,t)}transposeKey(r,i){let o=0,n=0,h=r.keyTypeOriginal;if(i%12==0)return r.Key=r.keyTypeOriginal,void(r.isTransposedBy=i);for(h>6?h-=12:h<-6&&(h+=12);o<s.keyMapping.length&&(n=s.keyMapping[o],n!==h);o++);let t=o+i;for(;t>=12;)t-=12;for(;t<0;)t+=12;r.Key=s.keyMapping[t],r.isTransposedBy=i}}g.TransposeCalculator=s,s.keyMapping=[0,-5,2,-3,4,-1,6,1,-4,3,-2,5],s.noteEnums=[l.NoteEnum.C,l.NoteEnum.D,l.NoteEnum.E,l.NoteEnum.F,l.NoteEnum.G,l.NoteEnum.A,l.NoteEnum.B]},8659(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(8628),g)},363(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(8659),g)},813(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.CollectionUtil=void 0,Array.prototype.last||Object.defineProperty(Array.prototype,"last",{enumerable:!1,writable:!0,value:function(){return this[this.length-1]}}),Array.prototype.clear||Object.defineProperty(Array.prototype,"clear",{enumerable:!1,writable:!0,value:function(){this.length=0}}),Array.prototype.contains||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,writable:!0,value:function(c){return this.indexOf(c)!==-1}}),g.CollectionUtil=class{static contains2(c,l){for(let s=0;s<c.length;s++)if(c[s]===l)return!0;return!1}static last(c){return c[c.length-1]}static flat(c){return[].concat(...c)}static removeDictElementIfTrue(c,l,s){const u=[];l.forEach(function(r,i){s(c,r,i)&&u.push(r)});for(let r=0;r<u.length;r++)l.remove(u[r])}static getLastElement(c){return c[c.length-1]}static binarySearch(c,l,s,u=0,r=c.length-1){let i=1,o=-1;for(;u<=r&&(i=Math.floor((u+r)/2),i!==o);){const n=s(c[i],l);if(n===0)return i;n<0&&(u=i+1),0<n&&(r=i),o=i}return-i}}},2774(de,g){Object.defineProperty(g,"__esModule",{value:!0}),g.PSMath=void 0;class c{static log(s,u){return Math.log(u)/Math.log(s)}static log10(s){return c.log(10,s)}static meanSimple(s){let u=0;for(let r=0;r<s.length;r++)u+=s[r];return u/s.length}static meanWeighted(s,u){if(s.length!==u.length||s.length===0)return 0;let r=0,i=0;for(let o=0;o<s.length;o++){const n=u[o];r+=s[o]*n,i+=n}return r/i}}g.PSMath=c},6873(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(813),g),s(c(2774),g)},8156(de,g,c){var l=this&&this.__createBinding||(Object.create?function(u,r,i,o){o===void 0&&(o=i);var n=Object.getOwnPropertyDescriptor(r,i);n&&!("get"in n?!r.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(u,o,n)}:function(u,r,i,o){o===void 0&&(o=i),u[o]=r[i]}),s=this&&this.__exportStar||function(u,r){for(var i in u)i==="default"||Object.prototype.hasOwnProperty.call(r,i)||l(r,u,i)};Object.defineProperty(g,"__esModule",{value:!0}),s(c(5955),g),s(c(1745),g),s(c(6873),g),s(c(2552),g),s(c(363),g)},9924(de,g,c){var l,s=this&&this.__extends||(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},function(r,i){function o(){this.constructor=r}l(r,i),r.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)});Object.defineProperty(g,"__esModule",{value:!0});var u=function(r){function i(){return r!==null&&r.apply(this,arguments)||this}return s(i,r),i}(c(4041).default);g.default=u},4041(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(3288),u=function(){function r(i){this.root=null,this.compare=i||l.defaultCompare,this.nElements=0}return r.prototype.add=function(i){return!l.isUndefined(i)&&this.insertNode(this.createNode(i))!==null&&(this.nElements++,!0)},r.prototype.clear=function(){this.root=null,this.nElements=0},r.prototype.isEmpty=function(){return this.nElements===0},r.prototype.size=function(){return this.nElements},r.prototype.contains=function(i){return!l.isUndefined(i)&&this.searchNode(this.root,i)!==null},r.prototype.search=function(i){var o=this.searchNode(this.root,i);if(o!==null)return o.element},r.prototype.remove=function(i){var o=this.searchNode(this.root,i);return o!==null&&(this.removeNode(o),this.nElements--,!0)},r.prototype.inorderTraversal=function(i){this.inorderTraversalAux(this.root,i,{stop:!1})},r.prototype.preorderTraversal=function(i){this.preorderTraversalAux(this.root,i,{stop:!1})},r.prototype.postorderTraversal=function(i){this.postorderTraversalAux(this.root,i,{stop:!1})},r.prototype.levelTraversal=function(i){this.levelTraversalAux(this.root,i)},r.prototype.minimum=function(){if(!this.isEmpty()&&this.root!==null)return this.minimumAux(this.root).element},r.prototype.maximum=function(){if(!this.isEmpty()&&this.root!==null)return this.maximumAux(this.root).element},r.prototype.forEach=function(i){this.inorderTraversal(i)},r.prototype.toArray=function(){var i=[];return this.inorderTraversal(function(o){return i.push(o),!0}),i},r.prototype.height=function(){return this.heightAux(this.root)},r.prototype.searchNode=function(i,o){for(var n=1;i!==null&&n!==0;)(n=this.compare(o,i.element))<0?i=i.leftCh:n>0&&(i=i.rightCh);return i},r.prototype.transplant=function(i,o){i.parent===null?this.root=o:i===i.parent.leftCh?i.parent.leftCh=o:i.parent.rightCh=o,o!==null&&(o.parent=i.parent)},r.prototype.removeNode=function(i){if(i.leftCh===null)this.transplant(i,i.rightCh);else if(i.rightCh===null)this.transplant(i,i.leftCh);else{var o=this.minimumAux(i.rightCh);o.parent!==i&&(this.transplant(o,o.rightCh),o.rightCh=i.rightCh,o.rightCh.parent=o),this.transplant(i,o),o.leftCh=i.leftCh,o.leftCh.parent=o}},r.prototype.inorderTraversalAux=function(i,o,n){i===null||n.stop||(this.inorderTraversalAux(i.leftCh,o,n),n.stop||(n.stop=o(i.element)===!1,n.stop||this.inorderTraversalAux(i.rightCh,o,n)))},r.prototype.levelTraversalAux=function(i,o){var n=new s.default;for(i!==null&&n.enqueue(i),i=n.dequeue()||null;i!=null;){if(o(i.element)===!1)return;i.leftCh!==null&&n.enqueue(i.leftCh),i.rightCh!==null&&n.enqueue(i.rightCh),i=n.dequeue()||null}},r.prototype.preorderTraversalAux=function(i,o,n){i===null||n.stop||(n.stop=o(i.element)===!1,n.stop||(this.preorderTraversalAux(i.leftCh,o,n),n.stop||this.preorderTraversalAux(i.rightCh,o,n)))},r.prototype.postorderTraversalAux=function(i,o,n){i===null||n.stop||(this.postorderTraversalAux(i.leftCh,o,n),n.stop||(this.postorderTraversalAux(i.rightCh,o,n),n.stop||(n.stop=o(i.element)===!1)))},r.prototype.minimumAux=function(i){for(;i!=null&&i.leftCh!==null;)i=i.leftCh;return i},r.prototype.maximumAux=function(i){for(;i!=null&&i.rightCh!==null;)i=i.rightCh;return i},r.prototype.heightAux=function(i){return i===null?-1:Math.max(this.heightAux(i.leftCh),this.heightAux(i.rightCh))+1},r.prototype.insertNode=function(i){for(var o=null,n=this.root;n!==null;){var h=this.compare(i.element,n.element);if(h===0)return null;h<0?(o=n,n=n.leftCh):(o=n,n=n.rightCh)}return i.parent=o,o===null?this.root=i:this.compare(i.element,o.element)<0?o.leftCh=i:o.rightCh=i,i},r.prototype.createNode=function(i){return{element:i,leftCh:null,rightCh:null,parent:null}},r}();g.default=u},2909(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(6119),u=c(2091),r=function(){function i(o){this.toStrF=o||l.defaultToString,this.dictionary=new s.default(this.toStrF),this.nElements=0}return i.prototype.add=function(o,n){if(n===void 0&&(n=1),l.isUndefined(o)||n<=0)return!1;if(this.contains(o))this.dictionary.getValue(o).copies+=n;else{var h={value:o,copies:n};this.dictionary.setValue(o,h)}return this.nElements+=n,!0},i.prototype.count=function(o){return this.contains(o)?this.dictionary.getValue(o).copies:0},i.prototype.contains=function(o){return this.dictionary.containsKey(o)},i.prototype.remove=function(o,n){if(n===void 0&&(n=1),l.isUndefined(o)||n<=0)return!1;if(this.contains(o)){var h=this.dictionary.getValue(o);return n>h.copies?this.nElements-=h.copies:this.nElements-=n,h.copies-=n,h.copies<=0&&this.dictionary.remove(o),!0}return!1},i.prototype.toArray=function(){for(var o=[],n=0,h=this.dictionary.values();n<h.length;n++)for(var t=h[n],f=t.value,p=t.copies,m=0;m<p;m++)o.push(f);return o},i.prototype.toSet=function(){for(var o=new u.default(this.toStrF),n=0,h=this.dictionary.values();n<h.length;n++){var t=h[n].value;o.add(t)}return o},i.prototype.forEach=function(o){this.dictionary.forEach(function(n,h){for(var t=h.value,f=h.copies,p=0;p<f;p++)if(o(t)===!1)return!1;return!0})},i.prototype.size=function(){return this.nElements},i.prototype.isEmpty=function(){return this.nElements===0},i.prototype.clear=function(){this.nElements=0,this.dictionary.clear()},i}();g.default=r},6119(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=function(){function u(r){this.table={},this.nElements=0,this.toStr=r||l.defaultToString}return u.prototype.getValue=function(r){var i=this.table["$"+this.toStr(r)];if(!l.isUndefined(i))return i.value},u.prototype.setValue=function(r,i){if(!l.isUndefined(r)&&!l.isUndefined(i)){var o,n="$"+this.toStr(r),h=this.table[n];return l.isUndefined(h)?(this.nElements++,o=void 0):o=h.value,this.table[n]={key:r,value:i},o}},u.prototype.remove=function(r){var i="$"+this.toStr(r),o=this.table[i];if(!l.isUndefined(o))return delete this.table[i],this.nElements--,o.value},u.prototype.keys=function(){var r=[];for(var i in this.table)if(l.has(this.table,i)){var o=this.table[i];r.push(o.key)}return r},u.prototype.values=function(){var r=[];for(var i in this.table)if(l.has(this.table,i)){var o=this.table[i];r.push(o.value)}return r},u.prototype.forEach=function(r){for(var i in this.table)if(l.has(this.table,i)){var o=this.table[i];if(r(o.key,o.value)===!1)return}},u.prototype.containsKey=function(r){return!l.isUndefined(this.getValue(r))},u.prototype.clear=function(){this.table={},this.nElements=0},u.prototype.size=function(){return this.nElements},u.prototype.isEmpty=function(){return this.nElements<=0},u.prototype.toString=function(){var r="{";return this.forEach(function(i,o){r+=`
|
|
`+i+" : "+o}),r+`
|
|
}`},u}();g.default=s},9281(de,g,c){var l,s=this&&this.__extends||(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,n){o.__proto__=n}||function(o,n){for(var h in n)n.hasOwnProperty(h)&&(o[h]=n[h])},function(o,n){function h(){this.constructor=o}l(o,n),o.prototype=n===null?Object.create(n):(h.prototype=n.prototype,new h)});Object.defineProperty(g,"__esModule",{value:!0});var u=c(6119),r=c(4831),i=function(o){function n(h,t){var f=o.call(this,t)||this;return f.defaultFactoryFunction=h,f}return s(n,o),n.prototype.setDefault=function(h,t){var f=o.prototype.getValue.call(this,h);return r.isUndefined(f)?(this.setValue(h,t),t):f},n.prototype.getValue=function(h){return this.setDefault(h,this.defaultFactoryFunction())},n}(u.default);g.default=i},4589(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(4713),u=function(){function r(i){this.data=[],this.compare=i||l.defaultCompare}return r.prototype.leftChildIndex=function(i){return 2*i+1},r.prototype.rightChildIndex=function(i){return 2*i+2},r.prototype.parentIndex=function(i){return Math.floor((i-1)/2)},r.prototype.minIndex=function(i,o){return o>=this.data.length?i>=this.data.length?-1:i:this.compare(this.data[i],this.data[o])<=0?i:o},r.prototype.siftUp=function(i){for(var o=this.parentIndex(i);i>0&&this.compare(this.data[o],this.data[i])>0;)s.swap(this.data,o,i),i=o,o=this.parentIndex(i)},r.prototype.siftDown=function(i){for(var o=this.minIndex(this.leftChildIndex(i),this.rightChildIndex(i));o>=0&&this.compare(this.data[i],this.data[o])>0;)s.swap(this.data,o,i),i=o,o=this.minIndex(this.leftChildIndex(i),this.rightChildIndex(i))},r.prototype.peek=function(){return this.data.length>0?this.data[0]:void 0},r.prototype.add=function(i){return!l.isUndefined(i)&&(this.data.push(i),this.siftUp(this.data.length-1),!0)},r.prototype.removeRoot=function(){if(this.data.length>0){var i=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),i}},r.prototype.contains=function(i){var o=l.compareToEquals(this.compare);return s.contains(this.data,i,o)},r.prototype.size=function(){return this.data.length},r.prototype.isEmpty=function(){return this.data.length<=0},r.prototype.clear=function(){this.data.length=0},r.prototype.forEach=function(i){s.forEach(this.data,i)},r}();g.default=u},1846(de,g,c){var l,s=this&&this.__extends||(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,f){t.__proto__=f}||function(t,f){for(var p in f)f.hasOwnProperty(p)&&(t[p]=f[p])},function(t,f){function p(){this.constructor=t}l(t,f),t.prototype=f===null?Object.create(f):(p.prototype=f.prototype,new p)});Object.defineProperty(g,"__esModule",{value:!0});var u=c(6119),r=c(4831),i=function(){function t(f,p){this.key=f,this.value=p}return t.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},t}(),o=function(){function t(){this.key=null,this.value=null}return t.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},t}();function n(t){return!t.next}var h=function(t){function f(p){var m=t.call(this,p)||this;return m.head=new o,m.tail=new o,m.head.next=m.tail,m.tail.prev=m.head,m}return s(f,t),f.prototype.appendToTail=function(p){var m=this.tail.prev;m.next=p,p.prev=m,p.next=this.tail,this.tail.prev=p},f.prototype.getLinkedDictionaryPair=function(p){if(!r.isUndefined(p)){var m="$"+this.toStr(p);return this.table[m]}},f.prototype.getValue=function(p){var m=this.getLinkedDictionaryPair(p);if(!r.isUndefined(m))return m.value},f.prototype.remove=function(p){var m=this.getLinkedDictionaryPair(p);if(!r.isUndefined(m))return t.prototype.remove.call(this,p),m.unlink(),m.value},f.prototype.clear=function(){t.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},f.prototype.replace=function(p,m){var x="$"+this.toStr(m.key);m.next=p.next,m.prev=p.prev,this.remove(p.key),m.prev.next=m,m.next.prev=m,this.table[x]=m,++this.nElements},f.prototype.setValue=function(p,m){if(!r.isUndefined(p)&&!r.isUndefined(m)){var x=this.getLinkedDictionaryPair(p),y=new i(p,m),d="$"+this.toStr(p);return r.isUndefined(x)?(this.appendToTail(y),this.table[d]=y,void++this.nElements):(this.replace(x,y),x.value)}},f.prototype.keys=function(){var p=[];return this.forEach(function(m,x){p.push(m)}),p},f.prototype.values=function(){var p=[];return this.forEach(function(m,x){p.push(x)}),p},f.prototype.forEach=function(p){for(var m=this.head.next;!n(m);){if(p(m.key,m.value)===!1)return;m=m.next}},f}(u.default);g.default=h},4538(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(4713),u=function(){function r(){this.firstNode=null,this.lastNode=null,this.nElements=0}return r.prototype.add=function(i,o){if(l.isUndefined(o)&&(o=this.nElements),o<0||o>this.nElements||l.isUndefined(i))return!1;var n=this.createNode(i);if(this.nElements===0||this.lastNode===null)this.firstNode=n,this.lastNode=n;else if(o===this.nElements)this.lastNode.next=n,this.lastNode=n;else if(o===0)n.next=this.firstNode,this.firstNode=n;else{var h=this.nodeAtIndex(o-1);if(h===null)return!1;n.next=h.next,h.next=n}return this.nElements++,!0},r.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},r.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},r.prototype.elementAtIndex=function(i){var o=this.nodeAtIndex(i);if(o!==null)return o.element},r.prototype.indexOf=function(i,o){var n=o||l.defaultEquals;if(l.isUndefined(i))return-1;for(var h=this.firstNode,t=0;h!==null;){if(n(h.element,i))return t;t++,h=h.next}return-1},r.prototype.contains=function(i,o){return this.indexOf(i,o)>=0},r.prototype.remove=function(i,o){var n=o||l.defaultEquals;if(this.nElements<1||l.isUndefined(i))return!1;for(var h=null,t=this.firstNode;t!==null;){if(n(t.element,i))return h===null?(this.firstNode=t.next,t===this.lastNode&&(this.lastNode=null)):t===this.lastNode?(this.lastNode=h,h.next=t.next,t.next=null):(h.next=t.next,t.next=null),this.nElements--,!0;h=t,t=t.next}return!1},r.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},r.prototype.equals=function(i,o){var n=o||l.defaultEquals;return i instanceof r&&this.size()===i.size()&&this.equalsAux(this.firstNode,i.firstNode,n)},r.prototype.equalsAux=function(i,o,n){for(;i!==null&&o!==null;){if(!n(i.element,o.element))return!1;i=i.next,o=o.next}return!0},r.prototype.removeElementAtIndex=function(i){if(!(i<0||i>=this.nElements||this.firstNode===null||this.lastNode===null)){var o;if(this.nElements===1)o=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var n=this.nodeAtIndex(i-1);n===null?(o=this.firstNode.element,this.firstNode=this.firstNode.next):n.next===this.lastNode&&(o=this.lastNode.element,this.lastNode=n),n!==null&&n.next!==null&&(o=n.next.element,n.next=n.next.next)}return this.nElements--,o}},r.prototype.forEach=function(i){for(var o=this.firstNode;o!==null&&i(o.element)!==!1;)o=o.next},r.prototype.reverse=function(){for(var i=null,o=this.firstNode,n=null;o!==null;)n=o.next,o.next=i,i=o,o=n;n=this.firstNode,this.firstNode=this.lastNode,this.lastNode=n},r.prototype.toArray=function(){for(var i=[],o=this.firstNode;o!==null;)i.push(o.element),o=o.next;return i},r.prototype.size=function(){return this.nElements},r.prototype.isEmpty=function(){return this.nElements<=0},r.prototype.toString=function(){return s.toString(this.toArray())},r.prototype.nodeAtIndex=function(i){if(i<0||i>=this.nElements)return null;if(i===this.nElements-1)return this.lastNode;for(var o=this.firstNode,n=0;n<i&&o!==null;n++)o=o.next;return o},r.prototype.createNode=function(i){return{element:i,next:null}},r}();g.default=u},2338(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(6119),u=c(4713),r=function(){function i(o,n,h){h===void 0&&(h=!1),this.dict=new s.default(o),this.equalsF=n||l.defaultEquals,this.allowDuplicate=h}return i.prototype.getValue=function(o){var n=this.dict.getValue(o);return l.isUndefined(n)?[]:u.copy(n)},i.prototype.setValue=function(o,n){if(l.isUndefined(o)||l.isUndefined(n))return!1;var h=this.dict.getValue(o);return l.isUndefined(h)?(this.dict.setValue(o,[n]),!0):!(!this.allowDuplicate&&u.contains(h,n,this.equalsF)||(h.push(n),0))},i.prototype.remove=function(o,n){if(l.isUndefined(n)){var h=this.dict.remove(o);return!l.isUndefined(h)}var t=this.dict.getValue(o);return!(l.isUndefined(t)||!u.remove(t,n,this.equalsF)||(t.length===0&&this.dict.remove(o),0))},i.prototype.keys=function(){return this.dict.keys()},i.prototype.values=function(){for(var o=[],n=0,h=this.dict.values();n<h.length;n++)for(var t=0,f=h[n];t<f.length;t++){var p=f[t];o.push(p)}return o},i.prototype.containsKey=function(o){return this.dict.containsKey(o)},i.prototype.clear=function(){this.dict.clear()},i.prototype.size=function(){return this.dict.size()},i.prototype.isEmpty=function(){return this.dict.isEmpty()},i}();g.default=r},2002(de,g){var c;Object.defineProperty(g,"__esModule",{value:!0}),function(s){s[s.BEFORE=0]="BEFORE",s[s.AFTER=1]="AFTER",s[s.INSIDE_AT_END=2]="INSIDE_AT_END",s[s.INSIDE_AT_START=3]="INSIDE_AT_START"}(c||(c={}));var l=function(){function s(u,r){u===void 0&&(u=[]),r===void 0&&(r={}),this.rootIds=u,this.nodes=r,this.initRootIds(),this.initNodes()}return s.prototype.initRootIds=function(){for(var u=0,r=this.rootIds;u<r.length;u++){var i=r[u];this.createEmptyNodeIfNotExist(i)}},s.prototype.initNodes=function(){for(var u in this.nodes)if(this.nodes.hasOwnProperty(u))for(var r=0,i=this.nodes[u];r<i.length;r++){var o=i[r];this.createEmptyNodeIfNotExist(o)}},s.prototype.createEmptyNodeIfNotExist=function(u){this.nodes[u]||(this.nodes[u]=[])},s.prototype.getRootIds=function(){return this.rootIds.slice()},s.prototype.getNodes=function(){var u={};for(var r in this.nodes)this.nodes.hasOwnProperty(r)&&(u[r]=this.nodes[r].slice());return u},s.prototype.getObject=function(){return{rootIds:this.getRootIds(),nodes:this.getNodes()}},s.prototype.toObject=function(){return this.getObject()},s.prototype.flatten=function(){for(var u=this,r=[],i=0;i<this.rootIds.length;i++){var o=this.rootIds[i];r.push({id:o,level:0,hasParent:!1,childrenCount:0}),p(o,this.nodes,r,0)}for(var n=0,h=r;n<h.length;n++){var t=h[n];t.childrenCount=f(t.id)}return r;function f(m){return u.nodes[m]?u.nodes[m].length:0}function p(m,x,y,d){if(d===void 0&&(d=0),m&&x&&y&&x[m]){d++;for(var S=x[m],M=0;M<S.length;M++){var E=S[M];y.push({id:E,level:d,hasParent:!0}),p(E,x,y,d)}d--}}},s.prototype.moveIdBeforeId=function(u,r){return this.moveId(u,r,c.BEFORE)},s.prototype.moveIdAfterId=function(u,r){return this.moveId(u,r,c.AFTER)},s.prototype.moveIdIntoId=function(u,r,i){return i===void 0&&(i=!0),i?this.moveId(u,r,c.INSIDE_AT_START):this.moveId(u,r,c.INSIDE_AT_END)},s.prototype.swapRootIdWithRootId=function(u,r){var i=this.findRootId(u),o=this.findRootId(r);this.swapRootPositionWithRootPosition(i,o)},s.prototype.swapRootPositionWithRootPosition=function(u,r){var i=this.rootIds[r];this.rootIds[r]=this.rootIds[u],this.rootIds[u]=i},s.prototype.deleteId=function(u){this.rootDeleteId(u),this.nodeAndSubNodesDelete(u),this.nodeRefrencesDelete(u)},s.prototype.insertIdBeforeId=function(u,r){var i=this.findRootId(u);for(var o in i>-1&&this.insertIdIntoRoot(r,i),this.nodes)if(this.nodes.hasOwnProperty(o)){var n=this.findNodeId(o,u);n>-1&&this.insertIdIntoNode(o,r,n)}},s.prototype.insertIdAfterId=function(u,r){var i=this.findRootId(u);for(var o in i>-1&&this.insertIdIntoRoot(r,i+1),this.nodes)if(this.nodes.hasOwnProperty(o)){var n=this.findNodeId(o,u);n>-1&&this.insertIdIntoNode(o,r,n+1)}},s.prototype.insertIdIntoId=function(u,r){this.nodeInsertAtEnd(u,r),this.nodes[r]=[]},s.prototype.insertIdIntoRoot=function(u,r){if(r===void 0)this.rootInsertAtEnd(u);else if(r<0){var i=this.rootIds.length;this.rootIds.splice(r+i+1,0,u)}else this.rootIds.splice(r,0,u);this.nodes[u]=this.nodes[u]||[]},s.prototype.insertIdIntoNode=function(u,r,i){if(this.nodes[u]=this.nodes[u]||[],this.nodes[r]=this.nodes[r]||[],i===void 0)this.nodeInsertAtEnd(u,r);else if(i<0){var o=this.nodes[u].length;this.nodes[u].splice(i+o+1,0,r)}else this.nodes[u].splice(i,0,r)},s.prototype.moveId=function(u,r,i){var o=u,n=this.findRootId(o);for(var h in this.nodes[r],this.nodes)if(this.nodes.hasOwnProperty(h)){this.findNodeId(h,r);break}var t=r,f=this.findRootId(t);for(var h in this.nodes[r],this.nodes)if(this.nodes.hasOwnProperty(h)){this.findNodeId(h,r);break}if(n>-1){if(f>-1)switch(this.rootDelete(n),f>n&&f--,i){case c.BEFORE:this.insertIdIntoRoot(o,f);break;case c.AFTER:this.insertIdIntoRoot(o,f+1);break;case c.INSIDE_AT_START:this.nodeInsertAtStart(t,o);break;case c.INSIDE_AT_END:this.nodeInsertAtEnd(t,o)}else for(var h in this.rootDelete(n),this.nodes)if(this.nodes.hasOwnProperty(h)&&(p=this.findNodeId(h,t))>-1){switch(i){case c.BEFORE:this.insertIdIntoNode(h,o,p);break;case c.AFTER:this.insertIdIntoNode(h,o,p+1);break;case c.INSIDE_AT_START:this.nodeInsertAtStart(t,o);break;case c.INSIDE_AT_END:this.nodeInsertAtEnd(t,o)}break}}else if(f>-1){for(var h in this.nodes)if(this.nodes.hasOwnProperty(h)&&(p=this.findNodeId(h,o))>-1){this.nodeDeleteAtIndex(h,p);break}switch(i){case c.BEFORE:this.insertIdIntoRoot(o,f);break;case c.AFTER:this.insertIdIntoRoot(o,f+1);break;case c.INSIDE_AT_START:this.nodeInsertAtStart(t,o);break;case c.INSIDE_AT_END:this.nodeInsertAtEnd(t,o)}}else{for(var h in this.nodes)if(this.nodes.hasOwnProperty(h)&&(p=this.findNodeId(h,o))>-1){this.nodeDeleteAtIndex(h,p);break}for(var h in this.nodes){var p;if(this.nodes.hasOwnProperty(h)&&(p=this.findNodeId(h,t))>-1){switch(i){case c.BEFORE:this.insertIdIntoNode(h,o,p);break;case c.AFTER:this.insertIdIntoNode(h,o,p+1);break;case c.INSIDE_AT_START:this.nodeInsertAtStart(t,o);break;case c.INSIDE_AT_END:this.nodeInsertAtEnd(t,o)}break}}}},s.prototype.swapArrayElements=function(u,r,i){var o=u[r];return u[r]=u[i],u[i]=o,u},s.prototype.rootDeleteId=function(u){var r=this.findRootId(u);r>-1&&this.rootDelete(r)},s.prototype.nodeAndSubNodesDelete=function(u){for(var r=[],i=0;i<this.nodes[u].length;i++){var o=this.nodes[u][i];this.nodeAndSubNodesDelete(o),r.push(u)}for(this.nodeDelete(u),i=0;i<r.length;i++)this.nodeDelete(r[i])},s.prototype.nodeRefrencesDelete=function(u){for(var r in this.nodes)if(this.nodes.hasOwnProperty(r))for(var i=0;i<this.nodes[r].length;i++)this.nodes[r][i]===u&&this.nodeDeleteAtIndex(r,i)},s.prototype.nodeDelete=function(u){delete this.nodes[u]},s.prototype.findRootId=function(u){return this.rootIds.indexOf(u)},s.prototype.findNodeId=function(u,r){return this.nodes[u].indexOf(r)},s.prototype.findNode=function(u){return this.nodes[u]},s.prototype.nodeInsertAtStart=function(u,r){this.nodes[u].unshift(r)},s.prototype.nodeInsertAtEnd=function(u,r){this.nodes[u].push(r)},s.prototype.rootDelete=function(u){this.rootIds.splice(u,1)},s.prototype.nodeDeleteAtIndex=function(u,r){this.nodes[u].splice(r,1)},s.prototype.rootInsertAtStart=function(u){this.rootIds.unshift(u)},s.prototype.rootInsertAtEnd=function(u){this.rootIds.push(u)},s}();g.default=l},8464(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(4589),u=function(){function r(i){this.heap=new s.default(l.reverseCompareFunction(i))}return r.prototype.enqueue=function(i){return this.heap.add(i)},r.prototype.add=function(i){return this.heap.add(i)},r.prototype.dequeue=function(){if(this.heap.size()!==0){var i=this.heap.peek();return this.heap.removeRoot(),i}},r.prototype.peek=function(){return this.heap.peek()},r.prototype.contains=function(i){return this.heap.contains(i)},r.prototype.isEmpty=function(){return this.heap.isEmpty()},r.prototype.size=function(){return this.heap.size()},r.prototype.clear=function(){this.heap.clear()},r.prototype.forEach=function(i){this.heap.forEach(i)},r}();g.default=u},3288(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4538),s=function(){function u(){this.list=new l.default}return u.prototype.enqueue=function(r){return this.list.add(r)},u.prototype.add=function(r){return this.list.add(r)},u.prototype.dequeue=function(){if(this.list.size()!==0){var r=this.list.first();return this.list.removeElementAtIndex(0),r}},u.prototype.peek=function(){if(this.list.size()!==0)return this.list.first()},u.prototype.size=function(){return this.list.size()},u.prototype.contains=function(r,i){return this.list.contains(r,i)},u.prototype.isEmpty=function(){return this.list.size()<=0},u.prototype.clear=function(){this.list.clear()},u.prototype.forEach=function(r){this.list.forEach(r)},u}();g.default=s},2091(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831),s=c(4713),u=c(6119),r=function(){function i(o){this.dictionary=new u.default(o)}return i.prototype.contains=function(o){return this.dictionary.containsKey(o)},i.prototype.add=function(o){return!this.contains(o)&&!l.isUndefined(o)&&(this.dictionary.setValue(o,o),!0)},i.prototype.intersection=function(o){var n=this;this.forEach(function(h){return o.contains(h)||n.remove(h),!0})},i.prototype.union=function(o){var n=this;o.forEach(function(h){return n.add(h),!0})},i.prototype.difference=function(o){var n=this;o.forEach(function(h){return n.remove(h),!0})},i.prototype.isSubsetOf=function(o){if(this.size()>o.size())return!1;var n=!0;return this.forEach(function(h){return!!o.contains(h)||(n=!1,!1)}),n},i.prototype.remove=function(o){return!!this.contains(o)&&(this.dictionary.remove(o),!0)},i.prototype.forEach=function(o){this.dictionary.forEach(function(n,h){return o(h)})},i.prototype.toArray=function(){return this.dictionary.values()},i.prototype.isEmpty=function(){return this.dictionary.isEmpty()},i.prototype.size=function(){return this.dictionary.size()},i.prototype.clear=function(){this.dictionary.clear()},i.prototype.toString=function(){return s.toString(this.toArray())},i}();g.default=r},2083(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4538),s=function(){function u(){this.list=new l.default}return u.prototype.push=function(r){return this.list.add(r,0)},u.prototype.add=function(r){return this.list.add(r,0)},u.prototype.pop=function(){return this.list.removeElementAtIndex(0)},u.prototype.peek=function(){return this.list.first()},u.prototype.size=function(){return this.list.size()},u.prototype.contains=function(r,i){return this.list.contains(r,i)},u.prototype.isEmpty=function(){return this.list.isEmpty()},u.prototype.clear=function(){this.list.clear()},u.prototype.forEach=function(r){this.list.forEach(r)},u}();g.default=s},4713(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4831);function s(u,r,i){for(var o=i||l.defaultEquals,n=u.length,h=0;h<n;h++)if(o(u[h],r))return h;return-1}g.indexOf=s,g.lastIndexOf=function(u,r,i){for(var o=i||l.defaultEquals,n=u.length-1;n>=0;n--)if(o(u[n],r))return n;return-1},g.contains=function(u,r,i){return s(u,r,i)>=0},g.remove=function(u,r,i){var o=s(u,r,i);return!(o<0||(u.splice(o,1),0))},g.frequency=function(u,r,i){for(var o=i||l.defaultEquals,n=u.length,h=0,t=0;t<n;t++)o(u[t],r)&&h++;return h},g.equals=function(u,r,i){var o=i||l.defaultEquals;if(u.length!==r.length)return!1;for(var n=u.length,h=0;h<n;h++)if(!o(u[h],r[h]))return!1;return!0},g.copy=function(u){return u.concat()},g.swap=function(u,r,i){if(r<0||r>=u.length||i<0||i>=u.length)return!1;var o=u[r];return u[r]=u[i],u[i]=o,!0},g.toString=function(u){return"["+u.toString()+"]"},g.forEach=function(u,r){for(var i=0,o=u;i<o.length;i++)if(r(o[i])===!1)return}},3263(de,g,c){Object.defineProperty(g,"__esModule",{value:!0});var l=c(4713);g.arrays=l;var s=c(2909);g.Bag=s.default;var u=c(9924);g.BSTree=u.default;var r=c(4041);g.BSTreeKV=r.default;var i=c(6119);g.Dictionary=i.default;var o=c(4589);g.Heap=o.default;var n=c(1846);g.LinkedDictionary=n.default;var h=c(4538);g.LinkedList=h.default;var t=c(2338);g.MultiDictionary=t.default;var f=c(9281);g.FactoryDictionary=f.default;var p=c(9281);g.DefaultDictionary=p.default;var m=c(3288);g.Queue=m.default;var x=c(8464);g.PriorityQueue=x.default;var y=c(2091);g.Set=y.default;var d=c(2083);g.Stack=d.default;var S=c(2002);g.MultiRootTree=S.default;var M=c(4831);g.util=M},4831(de,g){Object.defineProperty(g,"__esModule",{value:!0});var c=Object.prototype.hasOwnProperty;function l(r){return typeof r=="function"}function s(r){return r===void 0}function u(r){return Object.prototype.toString.call(r)==="[object String]"}g.has=function(r,i){return c.call(r,i)},g.defaultCompare=function(r,i){return r<i?-1:r===i?0:1},g.defaultEquals=function(r,i){return r===i},g.defaultToString=function(r){return r===null?"COLLECTION_NULL":s(r)?"COLLECTION_UNDEFINED":u(r)?"$s"+r:"$o"+r.toString()},g.makeString=function(r,i){if(i===void 0&&(i=","),r===null)return"COLLECTION_NULL";if(s(r))return"COLLECTION_UNDEFINED";if(u(r))return r.toString();var o="{",n=!0;for(var h in r)g.has(r,h)&&(n?n=!1:o+=i,o=o+h+":"+r[h]);return o+"}"},g.isFunction=l,g.isUndefined=s,g.isString=u,g.reverseCompareFunction=function(r){return s(r)||!l(r)?function(i,o){return i<o?1:i===o?0:-1}:function(i,o){return-1*r(i,o)}},g.compareToEquals=function(r){return function(i,o){return r(i,o)===0}}},3206(de,g,c){c.r(g),c.d(g,{default:()=>oi});const l=()=>{};l.L=(ce,e)=>{if(!e)return;const a=Array.prototype.slice.call(e).join(" ");window.console.log(ce+": "+a)},l.MakeException=ce=>class extends Error{constructor(e,a){super(e),this.name=ce,this.message=e,this.data=a}},l.RERR=l.RuntimeError=class{constructor(ce,e){this.code=ce,this.message=e}toString(){return"[RuntimeError] "+this.code+":"+this.message}},l.Merge=(ce,e)=>{for(const a in e)ce[a]=e[a];return ce},l.Min=Math.min,l.Max=Math.max,l.forEach=(ce,e)=>{for(let a=0;a<ce.length;a++)e(ce[a],a)},l.RoundN=(ce,e)=>ce%e>=e/2?parseInt(ce/e,10)*e+e:parseInt(ce/e,10)*e,l.MidLine=(ce,e)=>{let a=e+(ce-e)/2;return a%2>0&&(a=l.RoundN(10*a,5)/10),a},l.SortAndUnique=(ce,e,a)=>{if(ce.length>1){const b=[];let w;ce.sort(e);for(let C=0;C<ce.length;++C)C!==0&&a(ce[C],w)||b.push(ce[C]),w=ce[C];return b}return ce},l.Contains=(ce,e)=>{let a=ce.length;for(;a--;)if(ce[a]===e)return!0;return!1},l.getCanvasContext=ce=>{if(!ce)throw new l.RERR("BadArgument","Invalid canvas selector: "+ce);const e=document.getElementById(ce);if(!e||!e.getContext)throw new l.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return e.getContext("2d")},l.drawDot=(ce,e,a,b="#55")=>{ce.save(),ce.setFillStyle(b),ce.beginPath(),ce.arc(e,a,3,0,2*Math.PI,!0),ce.closePath(),ce.fill(),ce.restore()},l.BM=(ce,e)=>{const a=new Date().getTime();e();const b=new Date().getTime()-a;l.L(ce+b+"ms")},l.StackTrace=()=>new Error().stack,l.W=(...ce)=>{const e=ce.join(" ");window.console.log("Warning: ",e,l.StackTrace())},(l.Prefix=ce=>l.Prefix.prefix+ce).prefix="vf-";class s{static GCD(e,a){if(typeof e!="number"||typeof a!="number")throw new l.RERR("BadArgument",`Invalid numbers: ${e}, ${a}`);let b;for(;a!==0;)b=a,a=e%a,e=b;return e}static LCM(e,a){return e*a/s.GCD(e,a)}static LCMM(e){if(e.length===0)return 0;if(e.length===1)return e[0];if(e.length===2)return s.LCM(e[0],e[1]);{const a=e[0];return e.shift(),s.LCM(a,s.LCMM(e))}}constructor(e,a){this.set(e,a)}set(e,a){return this.numerator=e===void 0?1:e,this.denominator=a===void 0?1:a,this}value(){return this.numerator/this.denominator}simplify(){let e=this.numerator,a=this.denominator;const b=s.GCD(e,a);return e/=b,a/=b,a<0&&(a=-a,e=-e),this.set(e,a)}add(e,a){let b,w;e instanceof s?(b=e.numerator,w=e.denominator):(b=e!==void 0?e:0,w=a!==void 0?a:1);const C=s.LCM(this.denominator,w),V=C/this.denominator,z=C/w,J=this.numerator*V+b*z;return this.set(J,C)}subtract(e,a){let b,w;e instanceof s?(b=e.numerator,w=e.denominator):(b=e!==void 0?e:0,w=a!==void 0?a:1);const C=s.LCM(this.denominator,w),V=C/this.denominator,z=C/w,J=this.numerator*V-b*z;return this.set(J,C)}multiply(e,a){let b,w;return e instanceof s?(b=e.numerator,w=e.denominator):(b=e!==void 0?e:1,w=a!==void 0?a:1),this.set(this.numerator*b,this.denominator*w)}divide(e,a){let b,w;return e instanceof s?(b=e.numerator,w=e.denominator):(b=e!==void 0?e:1,w=a!==void 0?a:1),this.set(this.numerator*w,this.denominator*b)}equals(e){const a=s.__compareA.copy(e).simplify(),b=s.__compareB.copy(this).simplify();return a.numerator===b.numerator&&a.denominator===b.denominator}greaterThan(e){const a=s.__compareB.copy(this);return a.subtract(e),a.numerator>0}greaterThanEquals(e){const a=s.__compareB.copy(this);return a.subtract(e),a.numerator>=0}lessThan(e){return!this.greaterThanEquals(e)}lessThanEquals(e){return!this.greaterThan(e)}clone(){return new s(this.numerator,this.denominator)}copy(e){return typeof e=="number"?this.set(e||0,1):this.set(e.numerator,e.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 s.__tmp.copy(this).simplify().toString()}toMixedString(){let e="";const a=this.quotient(),b=s.__tmp.copy(this);return a<0?b.abs().fraction():b.fraction(),a!==0?(e+=a,b.numerator!==0&&(e+=" "+b.toSimplifiedString())):e=b.numerator===0?"0":b.toSimplifiedString(),e}parse(e){const a=e.split("/"),b=parseInt(a[0],10),w=a[1]?parseInt(a[1],10):1;return this.set(b,w)}}s.__compareA=new s,s.__compareB=new s,s.__tmp=new s;const u=l.MakeException("RegistryError");function r(ce,e,a,b,w){ce[e][a]||(ce[e][a]={}),ce[e][a][b]=w}class i{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(e){i.defaultRegistry=e}static getDefaultRegistry(){return i.defaultRegistry}static disableDefaultRegistry(){i.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:e,name:a,value:b,oldValue:w}){const C=this.getElementById(e);w!==null&&this.index[a][w]&&delete this.index[a][w][e],b!==null&&r(this.index,a,b,C.getAttribute("id"),C)}register(e,a){if(!(a=a||e.getAttribute("id")))throw new u("Can't add element without `id` attribute to registry",e);return e.setAttribute("id",a),r(this.index,"id",a,a,e),i.INDEXES.forEach(b=>{this.updateIndex({id:a,name:b,value:e.getAttribute(b),oldValue:null})}),e.onRegister(this),this}getElementById(e){return this.index.id[e]?this.index.id[e][e]:null}getElementsByAttribute(e,a){const b=this.index[e];return b&&b[a]?Object.keys(b[a]).map(w=>b[a][w]):[]}getElementsByType(e){return this.getElementsByAttribute("type",e)}getElementsByClass(e){return this.getElementsByAttribute("class",e)}onUpdate({id:e,name:a,value:b,oldValue:w}){return function(C,V){return C.filter(z=>z===V).length>0}(i.INDEXES.concat(["id","class"]),a)?(this.updateIndex({id:e,name:a,value:b,oldValue:w}),this):this}}i.defaultRegistry=null;class o{static newID(){return"auto"+o.ID++}constructor({type:e}={}){this.attrs={id:o.newID(),el:null,type:e||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,i.getDefaultRegistry()&&i.getDefaultRegistry().register(this)}setStyle(e){return this.style=e,this}getStyle(){return this.style}applyStyle(e=this.context,a=this.getStyle()){return a?(e.save(),a.shadowColor&&e.setShadowColor(a.shadowColor),a.shadowBlur&&e.setShadowBlur(a.shadowBlur),a.fillStyle&&e.setFillStyle(a.fillStyle),a.strokeStyle&&e.setStrokeStyle(a.strokeStyle),a.lineWidth&&e.setLineWidth(a.lineWidth),this):this}restoreStyle(e=this.context,a=this.getStyle()){return a?(e.restore(),this):this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(e){return this.attrs.classes[e]===!0}addClass(e){return this.attrs.classes[e]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:e,oldValue:null}),this}removeClass(e){return delete this.attrs.classes[e],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:e}),this}onRegister(e){return this.registry=e,this}isRendered(){return this.rendered}setRendered(e=!0){return this.rendered=e,this}getAttributes(){return this.attrs}getAttribute(e){return this.attrs[e]}setAttribute(e,a){const b=this.attrs.id,w=this.attrs[e];return this.attrs[e]=a,this.registry&&this.registry.onUpdate({id:b,name:e,value:a,oldValue:w}),this}getContext(){return this.context}setContext(e){return this.context=e,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new l.RERR("NoContext","No rendering context attached to instance");return this.context}}o.ID=1e3;class n{constructor(e,a,b,w){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(e,a),this.addPoint(b,w)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(e,a){e!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),a!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=a,this.y2=a),a<this.y1&&(this.y1=a),a>this.y2&&(this.y2=a))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addQuadraticCurve(e,a,b,w,C,V){const z=e+.6666666666666666*(b-e),J=a+2/3*(w-a),Z=z+1/3*(C-e),re=J+1/3*(V-a);this.addBezierCurve(e,a,z,J,Z,re,C,V)}addBezierCurve(e,a,b,w,C,V,z,J){const Z=[e,a],re=[b,w],ae=[C,V],le=[z,J];let he;this.addPoint(Z[0],Z[1]),this.addPoint(le[0],le[1]);const pe=(ge,me)=>Math.pow(1-ge,3)*Z[me]+3*Math.pow(1-ge,2)*ge*re[me]+3*(1-ge)*Math.pow(ge,2)*ae[me]+Math.pow(ge,3)*le[me];for(he=0;he<=1;he++){const ge=6*Z[he]-12*re[he]+6*ae[he],me=-3*Z[he]+9*re[he]-9*ae[he]+3*le[he],Ee=3*re[he]-3*Z[he];if(me===0){if(ge===0)continue;const De=-Ee/ge;0<De&&De<1&&(he===0&&this.addX(pe(De,he)),he===1&&this.addY(pe(De,he)));continue}const Re=Math.pow(ge,2)-4*Ee*me;if(Re<0)continue;const we=(-ge+Math.sqrt(Re))/(2*me);0<we&&we<1&&(he===0&&this.addX(pe(we,he)),he===1&&this.addY(pe(we,he)));const Ne=(-ge-Math.sqrt(Re))/(2*me);0<Ne&&Ne<1&&(he===0&&this.addX(pe(Ne,he)),he===1&&this.addY(pe(Ne,he)))}}}class h{static copy(e){return new h(e.x,e.y,e.w,e.h)}constructor(e,a,b,w){this.x=e,this.y=a,this.w=b,this.h=w}getX(){return this.x}getY(){return this.y}getW(){return this.w}getH(){return this.h}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setW(e){return this.w=e,this}setH(e){return this.h=e,this}move(e,a){this.x+=e,this.y+=a}clone(){return h.copy(this)}mergeWith(e,a){const b=e,w=this.x<b.x?this.x:b.x,C=this.y<b.y?this.y:b.y,V=Math.max(this.x+this.w,b.x+b.w)-w,z=Math.max(this.y+this.h,b.y+b.h)-C;return this.x=w,this.y=C,this.w=V,this.h=z,a&&this.draw(a),this}draw(e,a,b){a||(a=0),b||(b=0),e.rect(this.x+a,this.y+b,this.w,this.h),e.stroke()}}const t={glyphs:{v0:{x_min:0,x_max:514.5,ha:525,o:"m 236 648 b 246 648 238 648 242 648 b 288 646 261 648 283 648 b 472 513 364 634 428 587 b 514 347 502 464 514 413 b 462 163 514 272 499 217 b 257 44 409 83 333 44 b 50 163 181 44 103 83 b 0 347 14 217 0 272 b 40 513 0 413 12 464 b 236 648 87 591 155 638 m 277 614 b 253 616 273 616 261 616 b 242 616 247 616 243 616 b 170 499 193 609 181 589 b 159 348 163 446 159 398 b 166 222 159 308 161 266 b 201 91 174 138 183 106 b 257 76 215 81 235 76 b 311 91 277 76 299 81 b 347 222 330 106 338 138 b 353 348 352 266 353 308 b 344 499 353 398 351 446 b 277 614 333 587 322 606 m 257 -1 l 258 -1 l 255 -1 l 257 -1 m 257 673 l 258 673 l 255 673 l 257 673 "},v1:{x_min:-1.359375,x_max:344.359375,ha:351,o:"m 126 637 l 129 638 l 198 638 l 266 638 l 269 635 b 274 631 272 634 273 632 l 277 627 l 277 395 b 279 156 277 230 277 161 b 329 88 281 123 295 106 b 344 69 341 81 344 79 b 337 55 344 62 343 59 l 333 54 l 197 54 l 61 54 l 58 55 b 50 69 53 59 50 62 b 65 88 50 79 53 81 b 80 97 72 91 74 93 b 117 156 103 113 112 129 b 117 345 117 161 117 222 l 117 528 l 100 503 l 38 406 b 14 383 24 384 23 383 b -1 398 5 383 -1 390 b 4 415 -1 403 1 409 b 16 437 5 416 10 426 l 72 539 l 100 596 b 121 632 119 631 119 631 b 126 637 122 634 125 635 m 171 -1 l 172 -1 l 170 -1 l 171 -1 m 171 673 l 172 673 l 170 673 l 171 673 "},v2:{x_min:-1.359375,x_max:458.6875,ha:468,o:"m 197 648 b 216 648 201 648 208 648 b 258 646 232 648 253 648 b 419 546 333 637 393 599 b 432 489 428 528 432 509 b 356 342 432 440 405 384 b 235 278 322 313 288 295 b 69 170 166 256 107 217 b 69 169 69 170 69 169 b 69 169 69 169 69 169 b 74 173 69 169 72 170 b 209 222 112 204 163 222 b 310 195 247 222 274 215 b 371 179 332 184 352 179 b 396 181 379 179 387 179 b 428 202 409 184 423 194 b 442 212 431 209 436 212 b 458 197 450 212 458 206 b 441 148 458 190 449 165 b 299 44 409 84 353 44 b 288 45 295 44 292 44 b 250 61 274 45 268 49 b 122 99 212 86 164 99 b 73 91 104 99 88 97 b 28 63 53 84 34 72 b 14 54 25 56 20 54 b 1 62 9 54 4 56 l -1 65 l -1 79 b 0 99 -1 91 0 95 b 2 113 1 102 2 108 b 164 309 20 197 81 272 b 285 470 232 341 277 398 b 287 487 287 476 287 481 b 171 595 287 551 239 595 b 155 595 166 595 160 595 b 142 592 145 594 142 594 b 145 589 142 592 142 591 b 179 527 168 576 179 551 b 132 455 179 496 163 467 b 104 451 122 452 112 451 b 27 530 62 451 27 487 b 29 555 27 538 27 546 b 197 648 44 601 115 639 m 228 -1 l 230 -1 l 227 -1 l 228 -1 m 228 673 l 230 673 l 227 673 l 228 673 "},v3:{x_min:-1.359375,x_max:409.6875,ha:418,o:"m 174 648 b 191 648 176 648 183 648 b 225 648 204 648 220 648 b 402 523 317 638 389 588 b 404 503 404 517 404 510 b 402 484 404 495 404 488 b 264 373 389 437 334 394 b 257 370 259 371 257 371 b 257 370 257 370 257 370 b 264 369 258 370 261 369 b 409 202 359 334 409 267 b 318 72 409 152 381 104 b 200 43 281 52 240 43 b 23 113 134 43 69 68 b 0 169 6 129 0 149 b 77 249 0 210 29 249 l 77 249 b 152 174 125 249 152 212 b 103 102 152 145 137 116 b 103 102 103 102 103 102 b 147 94 103 101 132 95 b 153 94 149 94 151 94 b 265 206 219 94 265 141 b 264 226 265 213 265 219 b 147 355 253 299 204 353 b 126 371 133 356 126 362 b 147 388 126 383 132 388 b 254 474 196 391 238 424 b 259 502 258 484 259 494 b 182 592 259 544 228 582 b 156 595 175 595 166 595 b 115 592 142 595 129 594 l 111 591 l 115 588 b 152 524 141 574 152 549 b 92 449 152 491 130 458 b 76 448 87 448 81 448 b -1 530 32 448 -1 488 b 20 581 -1 548 5 566 b 174 648 55 619 108 641 m 204 -1 l 205 -1 l 202 -1 l 204 -1 m 204 673 l 205 673 l 202 673 l 204 673 "},v4:{x_min:0,x_max:468.21875,ha:478,o:"m 174 637 b 232 638 175 638 189 638 b 277 638 245 638 259 638 l 378 638 l 381 635 b 389 623 386 632 389 627 b 382 609 389 617 386 613 b 366 589 381 606 372 598 l 313 528 l 245 451 l 209 410 l 155 348 l 84 267 b 59 240 72 252 59 240 b 59 240 59 240 59 240 b 151 238 59 238 68 238 l 242 238 l 242 303 b 243 371 242 369 242 370 b 289 426 245 374 254 385 l 303 441 l 317 456 l 338 483 l 360 506 l 371 520 b 386 527 375 526 381 527 b 400 519 392 527 397 524 b 401 440 401 516 401 514 b 401 377 401 423 401 402 l 401 238 l 426 238 b 453 237 449 238 450 238 b 465 217 461 234 465 226 b 460 202 465 212 464 206 b 426 197 454 197 453 197 l 401 197 l 401 180 b 451 88 402 129 412 109 b 468 69 465 81 468 79 b 461 55 468 62 466 59 l 458 54 l 321 54 l 185 54 l 182 55 b 175 69 176 59 175 62 b 191 88 175 79 176 81 b 240 180 230 109 240 129 l 240 197 l 125 197 b 73 195 104 195 87 195 b 8 197 10 195 9 197 b 0 212 2 199 0 205 b 0 212 0 212 0 212 b 20 242 0 219 0 219 b 163 610 104 344 163 492 b 174 637 163 628 166 634 m 234 -1 l 235 -1 l 232 -1 l 234 -1 m 234 673 l 235 673 l 232 673 l 234 673 "},v5:{x_min:0,x_max:409.6875,ha:418,o:"m 47 637 b 53 638 49 638 50 638 b 69 634 55 638 61 637 b 210 610 114 619 161 610 b 363 634 259 610 311 619 b 382 638 372 637 378 638 b 392 634 386 638 389 637 b 397 623 396 630 397 627 b 393 610 397 620 396 616 b 298 505 368 552 338 520 b 212 494 277 498 246 494 b 65 517 163 494 106 502 b 61 517 62 517 61 517 b 61 517 61 517 61 517 b 51 408 61 517 51 412 b 51 408 51 408 51 408 b 51 408 51 408 51 408 b 61 412 53 408 55 409 b 125 434 80 421 103 430 b 185 441 145 440 166 441 b 409 244 310 441 409 353 b 401 191 409 227 406 209 b 197 43 375 105 287 43 b 159 47 183 43 171 44 b 23 123 112 56 61 86 b 0 180 6 140 0 159 b 76 260 0 220 31 260 b 92 259 81 260 87 259 b 152 183 132 251 152 216 b 100 112 152 152 134 122 b 95 111 98 112 95 111 b 95 111 95 111 95 111 b 129 98 95 109 119 101 b 148 97 136 97 141 97 b 264 235 206 97 261 158 b 265 248 265 240 265 244 b 210 398 265 312 243 373 b 179 408 201 406 194 408 b 174 408 178 408 176 408 b 53 369 130 408 88 394 b 34 359 39 359 38 359 b 17 374 24 359 17 365 b 39 628 17 384 38 625 b 47 637 40 631 43 635 m 204 -1 l 205 -1 l 202 -1 l 204 -1 m 204 673 l 205 673 l 202 673 l 204 673 "},v6:{x_min:0,x_max:475.03125,ha:485,o:"m 255 648 b 274 648 259 648 266 648 b 314 646 288 648 307 648 b 450 555 374 637 438 594 b 454 530 453 546 454 538 b 375 451 454 485 416 451 b 328 467 359 451 343 455 b 300 526 310 483 300 503 b 352 598 300 557 319 589 b 356 599 355 598 356 599 b 352 602 356 599 355 601 b 288 616 330 612 308 616 b 210 584 257 616 230 605 b 164 433 189 559 174 508 b 160 374 163 415 160 381 b 160 374 160 374 160 374 b 160 374 160 374 160 374 b 168 377 160 374 164 376 b 258 395 200 390 228 395 b 366 367 294 395 328 387 b 475 223 436 333 475 283 b 472 197 475 215 473 206 b 349 65 462 141 419 95 b 259 43 317 51 288 43 b 167 69 230 43 200 52 b 4 290 80 113 20 195 b 0 349 1 309 0 328 b 20 467 0 391 6 433 b 255 648 58 563 155 637 m 269 363 b 257 363 265 363 261 363 b 210 345 236 363 220 356 b 186 226 196 324 186 272 b 187 198 186 216 186 206 b 213 95 191 151 202 112 b 257 76 221 83 238 76 b 270 77 261 76 266 76 b 321 156 299 81 310 99 b 329 229 326 183 329 206 b 321 301 329 252 326 274 b 269 363 311 342 298 359 m 236 -1 l 238 -1 l 235 -1 l 236 -1 m 236 673 l 238 673 l 235 673 l 236 673 "},v7:{x_min:0,x_max:442.359375,ha:451,o:"m 147 648 b 166 649 153 649 160 649 b 313 598 217 649 273 630 b 340 587 323 588 328 587 l 341 587 b 412 628 367 587 390 601 b 427 638 416 635 421 638 b 439 632 431 638 435 637 b 442 623 441 630 442 628 b 430 569 442 616 439 603 b 352 369 408 492 377 410 b 300 259 325 324 313 298 b 273 84 283 205 273 140 b 265 55 273 65 272 59 l 261 54 l 181 54 l 99 54 l 96 55 b 91 61 95 56 92 59 l 89 63 l 89 77 b 147 263 89 133 111 202 b 261 401 176 313 212 355 b 378 541 315 449 349 489 l 382 548 l 375 544 b 240 495 333 512 285 495 b 129 535 198 495 160 509 b 84 560 108 552 95 560 b 76 559 81 560 78 560 b 31 487 59 555 43 530 b 14 470 27 473 24 470 b 1 477 8 470 4 471 l 0 480 l 0 553 l 0 627 l 1 630 b 16 638 4 635 9 638 b 23 635 17 638 20 637 b 49 626 36 626 39 626 b 96 638 59 626 80 630 b 104 639 99 638 102 639 b 117 644 107 641 112 642 b 147 648 125 645 137 648 m 220 -1 l 221 -1 l 219 -1 l 220 -1 m 220 673 l 221 673 l 219 673 l 220 673 "},v8:{x_min:0,x_max:488.640625,ha:499,o:"m 217 648 b 245 649 225 648 235 649 b 453 516 343 649 430 595 b 458 478 455 503 458 491 b 412 370 458 440 441 398 b 411 369 412 369 411 369 b 415 365 411 367 412 367 b 488 231 462 331 488 281 b 472 165 488 208 483 186 b 243 43 434 86 338 43 b 63 104 178 43 112 62 b 0 233 20 140 0 186 b 73 365 0 283 24 331 l 77 369 l 72 374 b 29 476 42 406 29 441 b 217 648 29 557 103 635 m 258 605 b 242 606 253 605 247 606 b 157 552 198 606 157 580 b 160 541 157 548 159 544 b 319 413 176 503 242 452 l 337 403 l 338 406 b 359 476 352 428 359 452 b 258 605 359 537 318 595 m 138 326 b 130 330 134 328 130 330 b 130 330 130 330 130 330 b 107 305 127 330 112 313 b 84 231 91 281 84 256 b 243 86 84 156 151 86 b 249 87 245 86 246 87 b 347 156 303 88 347 120 b 344 172 347 162 345 167 b 156 319 325 227 257 281 b 138 326 151 322 144 324 m 243 -1 l 245 -1 l 242 -1 l 243 -1 m 243 673 l 245 673 l 242 673 l 243 673 "},v9:{x_min:0,x_max:475.03125,ha:485,o:"m 191 646 b 212 649 198 648 205 649 b 255 644 227 649 243 646 b 458 448 348 616 428 539 b 475 342 469 415 475 378 b 460 244 475 308 469 274 b 193 44 421 124 303 44 b 91 69 157 44 122 51 b 19 161 43 97 19 126 b 21 181 19 167 20 174 b 98 241 32 220 65 241 b 170 186 129 241 160 223 b 172 166 171 179 172 173 b 121 94 172 134 152 102 b 117 93 118 94 117 93 b 121 90 117 93 118 91 b 185 76 142 80 164 76 b 270 119 220 76 251 91 b 308 259 287 145 300 194 b 313 317 310 277 313 310 b 313 317 313 317 313 317 b 313 317 313 317 313 317 b 304 315 313 317 308 316 b 216 295 273 302 245 295 b 145 308 193 295 170 299 b 19 398 88 327 42 360 b 0 469 5 420 0 444 b 24 551 0 496 8 526 b 191 646 54 596 125 637 m 227 614 b 215 616 224 616 220 616 b 202 614 210 616 206 616 b 152 535 174 610 163 592 b 144 463 147 509 144 485 b 152 391 144 440 147 417 b 216 328 163 344 179 328 b 280 391 253 328 269 344 b 288 463 285 417 288 440 b 280 535 288 485 285 509 b 227 614 269 594 258 610 m 236 -1 l 238 -1 l 235 -1 l 236 -1 m 236 673 l 238 673 l 235 673 l 236 673 "},va:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -8 -1 b -1 0 -5 -1 -4 0 b 16 -11 5 0 13 -4 b 83 -186 17 -12 47 -90 l 148 -358 l 148 -363 b 127 -385 148 -376 138 -385 b 112 -378 122 -385 118 -383 b 54 -226 110 -374 114 -385 b 0 -81 24 -147 0 -81 b -55 -226 -1 -81 -25 -147 b -114 -378 -115 -385 -111 -374 b -129 -385 -119 -383 -123 -385 b -149 -363 -140 -385 -149 -376 l -149 -358 l -84 -186 b -19 -11 -49 -90 -19 -12 b -8 -1 -17 -8 -12 -4 "},vb:{x_min:0,x_max:428.75,ha:438,o:"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 "},vc:{x_min:0,x_max:447.8125,ha:457,o:"m 0 86 l 0 173 l 223 173 l 447 173 l 447 86 l 447 0 l 223 0 l 0 0 l 0 86 "},vf:{x_min:0,x_max:370.21875,ha:378,o:"m 0 0 l 0 277 l 61 277 l 122 277 l 122 0 l 122 -278 l 61 -278 l 0 -278 l 0 0 m 246 -1 l 246 277 l 308 277 l 370 277 l 370 -1 l 370 -278 l 308 -278 l 246 -278 l 246 -1 "},v10:{x_min:0,x_max:559.421875,ha:571,o:"m 5 127 b 14 127 6 127 9 127 b 51 126 25 127 43 127 b 175 98 93 122 138 112 l 186 94 b 279 51 210 86 255 65 b 285 47 280 51 283 48 b 319 27 291 44 311 31 l 326 22 b 359 0 332 19 352 4 l 367 -6 b 371 -9 368 -6 370 -8 l 379 -15 b 387 -22 383 -18 386 -20 l 398 -30 l 411 -40 l 417 -47 l 427 -55 l 434 -61 b 441 -66 436 -62 439 -65 l 446 -72 l 453 -77 l 462 -87 b 558 -188 490 -113 549 -176 b 559 -195 559 -191 559 -194 b 548 -205 559 -201 555 -205 b 541 -204 547 -205 544 -205 b 534 -198 539 -201 536 -199 l 525 -191 b 481 -162 518 -187 490 -167 b 472 -155 477 -159 472 -156 b 468 -152 470 -155 469 -154 b 461 -149 466 -152 464 -151 b 428 -130 454 -145 441 -137 b 371 -99 413 -122 372 -99 b 363 -95 371 -99 367 -98 b 353 -91 357 -94 353 -91 b 348 -90 353 -91 352 -91 b 332 -81 343 -87 341 -86 b 27 -12 230 -37 127 -13 b 0 -5 4 -11 2 -11 b 0 58 0 -2 0 27 b 0 122 0 88 0 120 b 5 127 1 124 4 126 "},v11:{x_min:-155.171875,x_max:153.8125,ha:157,o:"m -137 353 b -130 353 -136 353 -133 353 b -112 349 -125 353 -119 352 b -100 342 -110 347 -104 344 b 0 317 -69 326 -35 317 b 111 349 38 317 76 328 b 129 353 117 352 123 353 b 153 327 142 353 153 344 b 144 302 153 320 153 317 b 27 6 93 226 50 113 b 21 -13 24 -11 24 -11 b 0 -26 17 -22 8 -26 b -24 -12 -9 -26 -19 -22 b -28 5 -24 -9 -27 -2 b -145 302 -53 117 -95 224 b -155 327 -155 317 -155 320 b -137 353 -155 340 -148 349 "},v18:{x_min:0,x_max:323.9375,ha:331,o:"m 217 535 b 225 537 220 537 221 537 b 245 524 235 537 242 533 l 246 521 l 247 390 l 247 258 l 273 265 b 306 270 288 269 299 270 b 322 259 315 270 319 267 b 323 208 323 256 323 233 b 322 158 323 184 323 159 b 288 140 318 148 315 147 b 247 130 254 131 247 130 b 247 65 247 130 247 104 b 247 20 247 51 247 36 l 247 -88 l 273 -81 b 306 -76 289 -77 299 -76 b 318 -81 311 -76 315 -77 b 323 -123 323 -87 323 -86 l 323 -138 l 323 -154 b 318 -195 323 -191 323 -190 b 269 -210 314 -199 315 -199 b 249 -216 259 -213 250 -216 l 247 -216 l 247 -349 l 246 -483 l 245 -487 b 225 -499 242 -495 234 -499 b 206 -487 219 -499 210 -495 l 205 -483 l 205 -355 l 205 -227 l 204 -227 l 181 -233 l 138 -244 b 117 -249 127 -247 117 -249 b 115 -385 115 -249 115 -256 l 115 -523 l 114 -526 b 95 -538 110 -534 102 -538 b 74 -526 87 -538 78 -534 l 73 -523 l 73 -391 b 72 -260 73 -269 73 -260 b 72 -260 72 -260 72 -260 b 19 -273 61 -263 23 -273 b 0 -260 10 -273 4 -267 b 0 -209 0 -256 0 -256 l 0 -162 l 1 -158 b 61 -134 5 -148 5 -148 l 73 -131 l 73 -22 b 72 86 73 79 73 86 b 72 86 72 86 72 86 b 19 74 61 83 23 74 b 0 86 10 74 4 79 b 0 137 0 90 0 90 l 0 184 l 1 188 b 61 212 5 198 5 198 l 73 215 l 73 348 l 73 481 l 74 485 b 95 498 78 492 87 498 b 103 495 98 498 100 496 b 114 485 107 494 111 489 l 115 481 l 115 353 l 115 226 l 121 226 b 159 235 123 227 141 231 l 198 247 l 205 248 l 205 384 l 205 521 l 206 524 b 217 535 209 528 212 533 m 205 9 b 205 119 205 70 205 119 l 205 119 b 182 113 204 119 194 116 l 138 102 b 117 97 127 99 117 97 b 115 -12 115 97 115 91 l 115 -122 l 121 -120 b 159 -111 123 -119 141 -115 l 198 -101 l 205 -98 l 205 9 "},v1b:{x_min:0,x_max:559.421875,ha:571,o:"m 544 204 b 548 204 545 204 547 204 b 559 194 555 204 559 199 b 559 190 559 192 559 191 b 530 156 559 188 556 184 b 462 86 510 134 481 104 b 453 76 458 81 454 77 l 446 70 l 441 65 b 434 59 439 63 436 61 l 427 54 b 409 37 426 51 416 44 b 392 23 398 29 394 26 b 387 19 389 22 387 20 b 379 13 386 19 383 16 l 371 8 l 367 5 l 359 -1 l 337 -16 b 285 -48 319 -29 298 -41 l 279 -52 b 186 -95 255 -66 210 -87 l 175 -99 b 23 -129 127 -117 68 -129 b 17 -129 20 -129 19 -129 b 1 -123 2 -129 2 -129 b 0 -49 0 -122 0 -83 b 0 4 0 -22 0 1 b 27 11 2 9 4 9 b 185 31 78 12 145 20 b 198 34 186 31 193 33 b 314 73 234 44 277 58 b 349 88 328 79 340 84 b 353 90 352 90 353 90 b 363 94 353 90 357 93 b 371 98 367 97 371 98 b 428 129 372 98 413 120 b 461 148 441 136 454 144 b 468 151 464 149 466 151 b 472 154 469 152 470 154 b 481 161 473 155 477 158 b 525 190 490 166 518 186 l 534 197 b 540 201 536 198 539 199 b 544 204 541 202 544 204 "},v1d:{x_min:0,x_max:619.3125,ha:632,o:"m 274 184 b 307 186 285 186 296 186 b 616 22 465 186 597 116 b 619 -1 617 13 619 5 b 308 -187 619 -104 483 -187 b 0 -1 133 -187 0 -102 b 5 36 0 11 1 23 b 274 184 29 115 141 176 m 289 161 b 272 162 284 162 277 162 b 171 41 209 162 171 108 b 205 -73 171 5 182 -34 b 345 -163 243 -133 298 -163 b 436 -98 385 -163 420 -142 b 446 -43 443 -80 446 -62 b 289 161 446 47 377 147 "},v1e:{x_min:-402.890625,x_max:401.53125,ha:410,o:"m -219 173 b -213 174 -217 174 -215 174 b -202 173 -209 174 -205 173 b -114 86 -200 172 -179 151 b -28 0 -66 37 -28 0 b 40 84 -28 0 2 37 b 117 174 111 173 110 172 b 122 174 118 174 119 174 b 132 173 125 174 129 173 b 295 11 134 172 171 134 l 307 -1 l 336 34 b 374 76 366 72 368 74 b 381 77 375 77 378 77 b 401 56 392 77 401 68 b 400 48 401 54 401 51 b 223 -172 397 41 230 -166 b 210 -176 220 -174 215 -176 b 201 -174 206 -176 204 -176 b 112 -87 198 -173 178 -152 b 27 0 65 -38 27 0 b -42 -86 27 0 -4 -38 b -118 -174 -112 -174 -111 -173 b -123 -176 -119 -176 -121 -176 b -133 -174 -126 -176 -130 -174 b -296 -12 -136 -173 -172 -137 l -308 0 l -337 -34 b -375 -77 -367 -73 -370 -76 b -382 -79 -377 -79 -379 -79 b -402 -58 -393 -79 -402 -69 b -401 -49 -402 -55 -402 -52 b -224 172 -398 -43 -228 167 b -219 173 -223 172 -220 173 "},v1f:{x_min:-340.28125,x_max:338.921875,ha:346,o:"m -32 520 b -29 521 -31 520 -31 521 b -23 519 -27 521 -24 520 b -20 513 -21 517 -20 516 b -21 506 -20 512 -20 509 b -31 474 -23 502 -27 488 l -53 402 l -66 352 l -68 349 l -57 349 b -32 351 -51 349 -40 351 b 123 370 19 352 74 359 b 137 371 127 370 133 371 b 170 356 152 371 164 366 b 171 355 170 355 170 355 b 216 366 174 355 183 358 b 280 378 268 377 266 377 b 287 378 283 378 284 378 b 332 349 307 378 322 369 b 338 319 336 341 338 330 b 332 301 338 310 336 302 b 242 280 329 299 246 280 b 242 280 242 280 242 280 b 235 288 236 280 235 283 b 235 292 235 290 235 291 b 236 302 236 297 236 299 b 220 337 236 316 230 330 l 216 340 l 210 335 b 159 276 189 322 172 301 b 118 149 152 265 156 274 b 81 34 84 36 85 36 b -8 13 78 33 -4 13 b -8 13 -8 13 -8 13 b -14 20 -12 15 -14 15 b -8 44 -14 24 -12 31 b -2 66 -5 55 -2 65 b -2 66 -2 66 -2 66 l -2 66 b -43 41 -2 66 -21 55 b -114 4 -98 8 -98 8 b -144 0 -123 0 -134 0 b -242 99 -197 0 -242 43 b -242 109 -242 102 -242 105 b -212 219 -240 122 -242 116 b -185 312 -197 270 -185 312 l -185 312 b -189 312 -185 312 -186 312 b -259 312 -200 312 -227 312 b -321 310 -291 312 -310 310 b -334 312 -330 310 -334 312 b -340 319 -338 313 -340 316 b -336 326 -340 322 -338 324 b -291 337 -334 326 -314 331 l -247 347 l -210 348 b -172 348 -190 348 -172 348 b -168 363 -172 348 -171 355 b -145 442 -151 424 -145 441 b -133 452 -144 444 -140 446 l -77 489 b -32 520 -53 506 -32 520 m 57 334 b 53 335 55 335 54 335 b 44 334 50 335 49 335 b -70 316 8 326 -28 320 b -78 309 -78 316 -78 316 b -108 202 -80 305 -88 274 b -141 81 -136 112 -141 93 b -140 74 -141 79 -141 77 b -117 49 -137 59 -127 49 b -107 52 -114 49 -110 51 b 16 127 -106 54 14 126 b 42 217 16 127 42 215 b 49 241 42 222 44 229 b 73 320 53 251 73 317 b 57 334 73 327 65 333 "},v20:{x_min:-571.671875,x_max:570.3125,ha:582,o:"m -559 351 b -551 352 -556 352 -553 352 b -530 338 -543 352 -533 348 b -529 169 -530 337 -529 291 l -529 1 l -507 27 l -441 112 b -382 174 -394 169 -390 174 b -378 174 -381 174 -379 174 b -281 86 -370 174 -375 179 b -196 0 -234 37 -196 0 b -126 84 -196 0 -164 37 b -50 174 -55 173 -57 172 b -44 174 -49 174 -47 174 b -35 173 -42 174 -38 173 b 53 86 -32 172 -12 151 b 138 0 100 37 138 0 b 208 84 140 0 170 37 b 284 174 279 173 279 172 b 289 174 285 174 288 174 b 300 173 294 174 298 173 b 462 11 303 172 340 134 l 475 -1 l 503 34 b 541 76 534 72 536 74 b 548 77 544 77 545 77 b 570 56 560 77 570 68 b 567 48 570 54 568 51 b 392 -172 564 41 397 -166 b 378 -176 387 -174 382 -176 b 368 -174 375 -176 371 -176 b 280 -87 367 -173 347 -152 b 194 0 234 -38 194 0 b 126 -86 194 0 163 -38 b 49 -174 54 -174 55 -173 b 44 -176 47 -176 46 -176 b 34 -174 40 -176 36 -174 b -54 -87 31 -173 10 -152 b -140 0 -102 -38 -140 0 b -209 -86 -140 0 -171 -38 b -285 -174 -280 -174 -279 -173 b -291 -176 -287 -176 -288 -176 b -300 -174 -294 -176 -298 -174 b -464 -11 -303 -173 -374 -102 l -476 0 l -506 -37 b -539 -76 -528 -65 -537 -74 b -551 -80 -543 -79 -547 -80 b -570 -68 -558 -80 -566 -76 l -571 -65 l -571 136 b -570 340 -571 331 -571 337 b -559 351 -568 344 -564 348 "},v22:{x_min:0,x_max:432.828125,ha:442,o:"m 209 186 b 213 187 210 187 212 187 b 216 187 215 187 216 187 b 224 174 216 186 220 180 b 420 -1 269 105 338 43 b 432 -12 431 -8 432 -9 b 421 -23 432 -15 432 -16 b 228 -180 345 -70 264 -137 b 219 -188 221 -188 221 -188 l 219 -188 b 208 -177 215 -188 215 -188 b 10 1 163 -106 93 -44 b 0 11 0 6 0 8 b 10 22 0 13 0 15 b 202 179 87 69 167 136 b 209 186 206 183 209 186 "},v23:{x_min:0,x_max:133.390625,ha:136,o:"m 54 66 b 65 68 58 68 61 68 b 122 37 88 68 110 56 b 133 -1 130 26 133 12 b 104 -58 133 -23 123 -44 b 66 -69 92 -65 78 -69 b 10 -38 44 -69 23 -58 b 0 -1 2 -27 0 -13 b 54 66 0 30 20 61 "},v25:{x_min:0,x_max:318.5,ha:325,o:"m 20 376 b 167 377 23 377 96 377 b 296 376 231 377 294 377 b 318 347 311 371 318 359 b 296 316 318 333 311 320 b 159 315 294 315 227 315 b 21 316 91 315 24 315 b 0 345 6 320 0 333 b 20 376 0 359 6 371 "},v26:{x_min:-21.78125,x_max:483.1875,ha:493,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 383 20 616 20 616 l 20 148 l 21 151 b 140 199 59 183 102 199 b 206 179 164 199 187 192 l 210 176 l 210 396 l 210 617 l 212 621 b 231 632 216 628 223 632 b 250 620 239 632 247 628 b 251 383 251 616 251 616 l 251 148 l 254 151 b 370 199 291 183 332 199 b 415 191 385 199 400 197 b 483 84 458 176 483 134 b 461 0 483 58 476 29 b 332 -142 439 -40 411 -72 l 255 -215 b 231 -229 240 -229 239 -229 b 216 -223 224 -229 220 -227 b 210 -158 210 -217 210 -223 b 210 -120 210 -148 210 -136 l 210 -29 l 205 -34 b 100 -142 182 -65 159 -88 l 23 -215 b -1 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 201 l -21 616 l -20 620 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 m 341 131 b 328 133 337 133 332 133 b 322 133 326 133 323 133 b 257 87 296 129 273 113 l 251 80 l 251 -37 l 251 -156 l 255 -152 b 375 81 328 -72 375 20 l 375 83 b 341 131 375 113 367 126 "},v27:{x_min:0,x_max:432.828125,ha:442,o:"m 208 184 b 213 187 209 186 212 187 b 224 176 217 187 221 183 b 245 147 225 172 235 159 b 419 -1 288 90 347 38 b 431 -8 424 -4 431 -8 b 432 -12 432 -9 432 -11 b 430 -18 432 -13 432 -16 b 364 -61 424 -20 383 -47 b 225 -183 307 -102 250 -152 b 223 -187 224 -184 223 -187 b 220 -188 221 -188 220 -188 b 208 -176 216 -188 210 -184 b 187 -148 205 -173 197 -159 b 12 0 144 -90 84 -38 b 0 11 4 5 0 8 b 16 24 0 13 4 18 b 183 158 83 69 141 115 b 208 184 194 169 198 173 m 183 105 b 176 113 181 109 176 113 b 172 109 176 113 175 112 b 92 45 149 90 117 62 l 88 41 l 102 31 b 247 -105 160 -6 210 -55 l 254 -115 l 257 -112 l 269 -102 b 340 -45 287 -87 319 -61 l 344 -43 l 330 -33 b 183 105 272 6 221 54 "},v28:{x_min:-73.5,x_max:72.140625,ha:74,o:"m -72 252 l -73 254 l 0 254 l 72 254 l 70 252 b 0 -1 70 248 0 -1 b -72 252 -1 -1 -72 248 "},v29:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m 175 273 b 182 274 178 273 181 274 b 202 262 190 274 198 269 b 204 158 204 259 204 259 l 204 56 l 250 112 b 303 174 296 172 298 172 b 308 174 304 174 307 174 b 318 173 313 174 317 173 b 481 11 322 172 357 134 l 494 -1 l 522 34 b 560 76 553 72 555 74 b 567 77 563 77 564 77 b 589 56 579 77 589 68 b 586 48 589 54 588 51 b 411 -172 583 41 416 -166 b 397 -176 406 -174 401 -176 b 387 -174 393 -176 390 -176 b 299 -87 386 -173 366 -152 b 213 0 253 -38 213 0 b 208 -6 213 0 210 -2 l 204 -12 l 204 -147 b 204 -210 204 -173 204 -194 b 198 -292 204 -297 204 -287 b 183 -299 194 -297 189 -299 b 164 -287 175 -299 167 -295 b 163 -174 163 -284 163 -284 l 161 -63 l 119 -117 b 65 -176 76 -170 73 -176 b 61 -176 63 -176 62 -176 b -35 -87 51 -174 57 -180 b -121 0 -83 -38 -121 0 b -190 -86 -122 0 -152 -38 b -266 -174 -261 -174 -259 -173 b -272 -176 -268 -176 -270 -176 b -281 -174 -276 -176 -280 -174 b -371 -86 -284 -173 -304 -152 b -457 0 -417 -38 -457 0 l -457 0 b -477 -26 -457 0 -470 -16 b -548 -227 -524 -88 -548 -161 b -536 -303 -548 -254 -544 -280 b -533 -317 -534 -309 -533 -313 b -553 -338 -533 -330 -541 -338 b -577 -315 -566 -338 -571 -333 b -590 -227 -586 -287 -590 -258 b -518 -9 -590 -154 -564 -77 b -465 56 -509 2 -504 8 l -402 134 b -363 174 -374 170 -371 174 b -359 174 -362 174 -360 174 b -262 86 -351 174 -356 179 b -176 0 -216 37 -176 0 b -107 84 -176 0 -145 37 b -31 174 -36 173 -38 172 b -25 174 -29 174 -28 174 b -16 173 -23 174 -19 173 b 147 11 -13 172 35 123 l 157 -1 l 160 1 l 163 4 l 163 130 b 164 260 163 256 163 258 b 175 273 166 266 170 270 "},v2a:{x_min:-21.78125,x_max:366.140625,ha:374,o:"m 276 1378 b 284 1379 279 1379 281 1379 b 306 1360 292 1379 298 1374 b 352 1247 326 1326 343 1286 b 366 1139 362 1213 366 1175 b 347 1009 366 1093 359 1049 l 344 1002 l 347 992 b 352 971 348 986 351 977 b 366 863 362 936 366 899 b 347 732 366 818 359 773 l 344 725 l 347 716 b 352 695 348 710 351 700 b 366 588 362 659 366 623 b 223 262 366 464 314 345 b 189 233 212 252 212 252 b 35 76 126 183 73 129 b -1 16 20 56 2 27 b -19 4 -4 9 -12 4 l -21 4 l -21 137 l -21 270 l -17 270 b 186 344 59 281 134 308 b 319 606 270 399 319 499 b 317 650 319 620 319 635 l 315 659 l 314 655 b 223 537 288 607 258 570 b 189 509 212 528 212 528 b 35 352 126 459 73 405 b -1 292 20 333 2 303 b -19 280 -4 285 -12 280 l -21 280 l -21 413 l -21 546 l -17 546 b 186 620 59 557 134 584 b 319 882 270 675 319 775 b 317 925 319 896 319 911 l 315 935 l 314 931 b 223 813 288 884 258 846 b 189 785 212 805 212 805 b 35 628 126 735 73 681 b -1 569 20 609 2 580 b -19 556 -4 562 -12 556 l -21 556 l -21 689 l -21 823 l -17 823 b 202 907 68 835 152 867 b 319 1157 280 968 319 1061 b 270 1338 319 1218 303 1281 b 262 1358 264 1349 262 1353 b 262 1364 262 1360 262 1363 b 276 1378 265 1371 269 1376 "},v2c:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -413 173 b -408 174 -412 174 -409 174 b -397 173 -404 174 -400 173 b -308 86 -394 172 -374 151 b -223 0 -261 37 -223 0 b -153 84 -223 0 -191 37 b -77 174 -83 173 -84 172 b -72 174 -76 174 -74 174 b -62 173 -68 174 -63 173 b 25 86 -59 172 -39 151 b 112 0 73 37 111 0 b 181 84 112 0 144 37 b 257 174 251 173 251 172 b 262 174 258 174 261 174 b 273 173 266 174 270 173 b 436 9 276 172 347 101 l 447 -1 l 477 36 b 522 79 511 79 513 79 l 522 79 b 552 51 533 79 539 73 b 596 -112 582 6 596 -51 b 567 -262 596 -161 586 -213 b 539 -322 558 -287 544 -316 b 524 -327 534 -326 529 -327 b 504 -315 515 -327 507 -323 b 503 -308 503 -312 503 -309 b 511 -285 503 -302 504 -297 b 555 -113 540 -227 555 -169 b 544 -34 555 -86 551 -59 b 522 19 540 -16 530 8 l 521 22 l 481 -26 l 405 -122 b 353 -176 366 -172 362 -176 b 349 -176 352 -176 351 -176 b 253 -87 341 -176 347 -180 b 167 0 206 -38 167 0 b 99 -86 167 0 136 -38 b 21 -174 27 -174 28 -173 b 17 -176 20 -176 19 -176 b 6 -174 13 -176 9 -174 b -81 -87 4 -173 -14 -152 b -167 0 -129 -38 -167 0 b -236 -86 -167 0 -198 -38 b -313 -174 -307 -174 -306 -173 b -318 -176 -314 -176 -315 -176 b -328 -174 -321 -176 -325 -174 b -491 -12 -330 -173 -367 -137 l -503 0 l -530 -34 b -570 -77 -562 -73 -564 -76 b -577 -79 -571 -79 -574 -79 b -597 -58 -588 -79 -597 -69 b -596 -49 -597 -55 -597 -52 b -417 172 -593 -43 -423 167 b -413 173 -417 172 -415 173 "},v2d:{x_min:0,x_max:438.28125,ha:447,o:"m 212 190 b 219 191 213 191 216 191 b 236 176 225 191 228 190 b 419 18 277 105 341 49 b 436 5 431 13 434 11 b 438 -1 438 4 438 1 b 424 -16 438 -8 432 -13 b 356 -49 409 -20 379 -36 b 234 -180 306 -83 258 -133 b 219 -192 230 -188 224 -192 b 200 -176 213 -192 206 -187 b 9 -15 157 -102 89 -45 b 0 0 2 -12 0 -6 b 16 18 0 9 2 12 b 200 176 93 48 159 104 b 212 190 205 186 208 188 m 239 113 b 236 117 238 116 238 117 b 230 108 235 117 234 115 b 92 -15 196 58 140 8 b 88 -18 91 -16 88 -18 b 92 -20 88 -18 91 -19 b 198 -116 130 -43 166 -74 b 200 -117 200 -117 200 -117 b 201 -117 200 -117 201 -117 b 264 -43 212 -98 242 -62 b 345 15 288 -19 321 4 b 348 18 347 16 348 16 b 344 20 348 18 347 19 b 239 113 307 41 266 79 "},v2f:{x_min:-1.359375,x_max:680.5625,ha:694,o:"m 597 1042 b 604 1042 600 1042 602 1042 b 642 1002 627 1042 642 1022 b 619 966 642 988 635 974 b 439 927 574 942 503 927 l 426 927 l 426 921 b 430 838 428 893 430 866 b 345 480 430 696 398 560 b 179 391 307 423 249 391 b 156 392 171 391 164 392 b 138 394 149 394 142 394 b 103 434 115 396 103 416 b 129 471 103 451 111 466 b 141 474 133 473 137 474 b 172 459 153 474 164 469 b 181 455 175 456 176 455 b 187 456 182 455 185 455 b 253 520 212 460 234 483 b 315 836 294 605 315 714 b 311 928 315 867 314 898 b 302 945 310 943 311 942 b 245 953 283 950 262 953 b 130 891 193 953 149 931 b 84 860 119 870 102 860 b 36 905 61 860 39 877 b 36 910 36 907 36 909 b 80 970 36 931 50 949 b 249 1017 125 1000 187 1017 b 322 1009 273 1017 299 1014 l 341 1003 b 436 991 372 995 406 991 b 577 1031 495 991 545 1004 b 597 1042 583 1038 590 1041 m 416 360 b 424 360 419 360 421 360 b 481 309 454 360 479 338 b 503 145 484 280 495 199 b 585 -185 525 16 555 -106 b 630 -245 596 -213 613 -237 l 634 -247 l 638 -245 b 647 -244 641 -245 645 -244 b 680 -278 666 -244 680 -262 b 664 -308 680 -290 675 -301 b 638 -312 658 -310 650 -312 b 613 -309 631 -312 623 -310 b 477 -201 555 -303 502 -260 b 417 -2 460 -159 434 -72 b 416 5 417 1 416 5 b 416 5 416 5 416 5 b 411 -5 415 5 413 0 b 359 -97 397 -33 377 -70 b 353 -106 355 -102 353 -105 b 359 -112 353 -108 355 -109 b 409 -130 375 -123 390 -129 b 426 -134 420 -130 421 -131 b 431 -147 428 -137 431 -141 b 420 -162 431 -152 427 -159 b 382 -169 409 -166 396 -169 b 323 -155 363 -169 341 -165 l 317 -152 l 314 -155 b 62 -303 240 -240 148 -295 b 36 -305 55 -305 44 -305 b 23 -303 29 -305 24 -305 b -1 -273 6 -299 -1 -287 b 31 -240 -1 -256 10 -240 b 36 -240 32 -240 34 -240 b 42 -241 38 -241 39 -241 b 134 -204 63 -241 99 -226 b 367 288 265 -115 357 81 b 375 330 368 313 370 320 b 416 360 383 347 400 358 m 360 -359 b 379 -359 363 -359 371 -359 b 424 -360 396 -359 416 -359 b 646 -502 536 -373 624 -430 b 649 -527 649 -510 649 -519 b 530 -673 649 -578 604 -635 l 521 -677 l 529 -681 b 653 -811 592 -714 637 -762 b 660 -853 658 -827 660 -839 b 645 -911 660 -873 656 -892 b 426 -1021 608 -981 519 -1021 b 283 -989 377 -1021 328 -1011 b 235 -949 249 -972 239 -964 b 234 -936 234 -946 234 -941 b 234 -928 234 -934 234 -931 l 235 -925 l 234 -927 l 225 -934 b 87 -982 186 -966 138 -982 b 80 -982 85 -982 83 -982 b 55 -981 70 -981 58 -981 b 17 -943 32 -981 17 -964 b 54 -904 17 -921 35 -904 b 78 -914 62 -904 72 -909 l 83 -918 l 88 -918 b 190 -831 122 -918 166 -881 b 269 -506 242 -727 269 -612 b 268 -462 269 -492 269 -477 b 266 -449 266 -458 266 -452 b 265 -444 266 -445 266 -444 b 257 -446 264 -444 261 -445 b 132 -545 196 -470 152 -505 b 88 -573 122 -563 104 -573 b 39 -523 63 -573 39 -553 b 63 -476 39 -505 44 -494 b 360 -359 136 -408 235 -369 m 419 -424 b 393 -423 411 -423 406 -423 l 375 -423 l 377 -426 b 379 -439 377 -427 378 -434 b 383 -510 382 -463 383 -487 b 314 -811 383 -609 360 -710 b 266 -893 296 -850 285 -870 b 264 -898 265 -896 264 -898 l 264 -898 b 264 -898 264 -898 264 -898 b 268 -898 264 -898 266 -898 b 273 -898 270 -898 272 -898 b 300 -909 283 -898 291 -900 b 426 -957 340 -941 385 -957 b 476 -949 443 -957 460 -954 b 547 -853 522 -931 547 -893 b 485 -745 547 -816 526 -775 b 397 -707 460 -727 432 -714 b 366 -675 375 -703 366 -692 b 396 -642 366 -657 377 -645 b 530 -557 455 -637 511 -601 b 536 -527 534 -548 536 -537 b 419 -424 536 -480 490 -437 "},v30:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 276 1900 b 284 1901 279 1900 281 1901 b 306 1883 291 1901 298 1896 b 367 1686 347 1825 367 1757 b 343 1558 367 1643 359 1600 l 338 1549 l 343 1537 b 367 1411 359 1497 367 1454 b 343 1282 367 1367 359 1324 l 338 1272 l 343 1261 b 367 1135 359 1221 367 1178 b 343 1007 367 1090 359 1047 l 338 996 l 343 985 b 367 859 359 945 367 902 b 343 731 367 814 359 771 l 338 720 l 343 709 b 367 582 359 667 367 626 b 289 362 367 503 340 426 b 239 312 276 345 259 330 b 29 77 152 237 76 152 b -1 18 14 54 2 30 b -19 4 -4 11 -12 4 l -21 4 l -21 133 l -20 260 l -13 262 b 98 299 17 269 62 284 b 111 305 103 302 110 305 b 167 334 123 310 156 327 b 319 595 264 391 319 491 b 313 659 319 616 318 638 b 310 667 311 664 311 667 b 307 663 310 667 308 666 b 240 588 289 637 269 614 b 16 331 141 505 62 413 b -1 294 8 316 1 302 b -19 280 -4 287 -12 280 l -21 280 l -21 408 l -20 537 l -13 538 b 98 576 17 545 62 560 b 111 581 103 578 110 581 b 167 610 123 587 156 603 b 319 871 264 667 319 767 b 313 935 319 892 318 913 b 310 942 311 941 311 942 b 307 939 310 942 308 941 b 240 864 289 913 269 889 b 16 607 141 781 62 689 b -1 570 8 592 1 578 b -19 556 -4 563 -12 556 l -21 556 l -21 684 l -20 813 l -13 814 b 98 852 17 821 62 836 b 111 857 103 855 110 857 b 167 886 123 863 156 880 b 319 1147 264 943 319 1043 b 313 1211 319 1168 318 1189 b 310 1218 311 1217 311 1218 b 307 1215 310 1218 308 1217 b 240 1140 289 1188 269 1165 b 16 884 141 1057 62 966 b -1 846 8 868 1 855 b -19 832 -4 839 -12 832 l -21 832 l -21 960 l -20 1089 l -13 1090 b 98 1128 17 1097 62 1111 b 111 1134 103 1131 110 1134 b 167 1163 123 1139 156 1156 b 319 1424 264 1220 319 1320 b 313 1486 319 1444 318 1465 b 310 1494 311 1493 311 1494 b 307 1492 310 1494 308 1493 b 240 1417 289 1464 269 1442 b 16 1160 141 1333 62 1242 b -1 1121 8 1145 1 1131 b -19 1109 -4 1115 -12 1109 l -21 1109 l -21 1236 l -20 1365 l -13 1367 b 98 1404 17 1374 62 1388 b 111 1410 103 1407 110 1410 b 250 1508 172 1437 215 1467 b 319 1701 296 1564 319 1633 b 270 1859 319 1757 303 1814 b 262 1882 265 1868 262 1875 b 276 1900 262 1890 266 1896 "},v31:{x_min:0,x_max:386.5625,ha:394,o:"m 0 173 l 0 347 l 193 347 l 386 347 l 386 173 l 386 0 l 193 0 l 0 0 l 0 173 "},v33:{x_min:-423.3125,x_max:421.9375,ha:431,o:"m -10 276 b -2 277 -8 277 -5 277 b 17 265 5 277 13 273 b 19 163 19 260 19 260 l 19 68 l 39 45 b 277 -95 122 -34 200 -81 b 289 -97 281 -97 285 -97 b 378 0 332 -97 371 -54 b 378 11 378 4 378 6 b 302 83 378 55 345 83 b 242 66 283 83 262 77 b 208 56 231 59 219 56 b 148 120 175 56 148 81 b 200 186 148 151 164 172 b 261 198 220 194 240 198 b 420 45 341 198 411 137 b 421 22 421 37 421 29 b 257 -198 421 -86 347 -188 b 242 -198 251 -198 247 -198 b 20 -105 181 -198 95 -163 l 19 -104 l 19 -183 b 19 -216 19 -195 19 -206 b 12 -273 19 -272 17 -267 b -2 -278 8 -277 2 -278 b -21 -266 -10 -278 -19 -274 b -23 -165 -23 -263 -23 -262 l -23 -69 l -44 -47 b -250 86 -117 23 -183 66 b -295 94 -270 93 -284 94 b -315 91 -302 94 -308 94 b -381 5 -356 81 -381 43 b -355 -56 -381 -16 -372 -40 b -299 -81 -338 -73 -319 -81 b -246 -68 -283 -81 -265 -77 b -212 -58 -234 -61 -223 -58 b -168 -77 -196 -58 -179 -65 b -151 -122 -156 -90 -151 -105 b -179 -174 -151 -141 -160 -162 b -239 -195 -194 -184 -217 -192 b -257 -197 -245 -195 -250 -197 b -423 -5 -349 -197 -423 -113 b -423 0 -423 -4 -423 -1 b -277 194 -420 97 -362 173 b -247 197 -268 197 -258 197 b -24 104 -185 197 -100 162 l -23 102 l -23 181 b -21 265 -23 260 -23 260 b -10 276 -20 269 -14 274 "},v34:{x_min:0,x_max:622.03125,ha:635,o:"m 398 417 b 406 419 401 419 404 419 b 427 398 417 419 427 409 b 427 391 427 395 427 392 b 34 -274 424 385 38 -272 b 20 -280 29 -278 25 -280 b 0 -259 9 -280 0 -270 b 0 -252 0 -256 0 -254 b 393 413 2 -247 389 410 b 398 417 394 415 397 416 m 592 417 b 600 419 594 419 597 419 b 622 398 611 419 622 409 b 620 391 622 395 620 392 b 227 -274 617 385 231 -272 b 213 -280 223 -278 219 -280 b 193 -259 202 -280 193 -270 b 194 -252 193 -256 193 -254 b 586 413 196 -247 582 410 b 592 417 588 415 590 416 "},v36:{x_min:-1.359375,x_max:1064.390625,ha:1086,o:"m 296 692 b 314 694 302 694 307 694 b 386 685 337 694 366 689 b 548 498 480 660 548 580 b 548 481 548 492 548 487 b 455 395 541 426 499 395 b 370 462 420 395 383 417 b 362 496 364 477 362 488 b 377 514 362 509 367 514 b 393 501 386 514 390 510 b 432 474 397 484 413 474 b 470 487 445 474 458 478 b 491 530 484 496 491 510 b 490 544 491 534 491 539 b 333 660 479 606 411 657 l 323 662 l 315 646 b 269 524 285 591 269 556 b 321 431 269 492 287 466 b 349 395 338 413 343 408 b 363 342 359 378 363 362 b 359 312 363 333 362 322 b 285 158 348 266 318 206 b 281 152 283 155 281 152 b 281 152 281 152 281 152 b 287 154 283 152 284 152 b 318 155 298 154 308 155 b 461 98 371 155 419 136 l 464 97 l 483 112 b 503 129 494 120 503 127 b 504 130 503 129 504 129 b 503 138 504 131 503 134 b 500 180 500 152 500 166 b 553 326 500 238 518 288 b 604 366 560 331 592 358 b 649 381 617 376 632 381 b 696 362 665 381 681 374 b 724 302 714 347 724 324 b 695 238 724 278 714 255 b 660 210 691 234 662 212 b 579 148 658 209 582 151 b 579 148 579 148 579 148 b 596 106 579 144 589 119 b 622 77 604 88 609 83 b 657 69 632 72 645 69 b 748 112 688 69 721 84 b 755 123 754 117 755 120 b 755 127 755 124 755 126 b 751 165 752 137 751 151 b 758 219 751 183 754 202 b 894 387 774 290 820 347 b 896 390 896 388 896 388 b 891 398 896 391 895 392 b 622 560 827 477 730 535 b 600 580 605 564 600 569 b 617 596 600 591 607 596 b 628 595 622 596 624 596 b 1057 248 846 552 1020 412 b 1064 191 1061 229 1064 209 b 922 0 1064 94 1005 9 b 902 -1 916 -1 909 -1 b 774 76 847 -1 800 26 b 769 83 770 81 770 83 b 769 81 769 83 769 83 b 627 -1 733 29 677 -1 b 548 27 597 -1 570 8 b 515 88 537 37 525 61 l 513 95 l 510 93 l 453 45 b 390 0 396 0 396 0 b 390 0 390 0 390 0 b 374 15 381 0 377 4 b 268 105 359 69 314 105 b 250 104 262 105 257 105 l 243 102 l 234 90 b 155 1 201 49 159 2 b 147 -1 152 0 149 -1 b 130 15 138 -1 130 6 b 132 20 130 18 132 19 b 136 31 133 22 134 27 b 220 131 149 74 178 109 b 231 137 225 134 230 136 b 302 278 280 202 302 244 b 265 335 302 299 295 309 b 209 442 234 363 213 402 b 209 455 209 446 209 451 b 279 648 209 502 232 564 l 285 659 l 283 659 b 176 627 238 653 210 645 b 57 477 111 594 66 538 b 55 459 55 471 55 464 b 72 409 55 437 61 415 b 93 403 78 405 87 403 b 152 467 123 403 151 431 b 168 488 153 483 157 488 b 185 462 181 488 185 483 l 185 460 b 137 344 183 409 168 369 b 78 322 119 328 98 322 b 13 360 50 322 25 335 b -1 426 4 380 -1 402 b 89 610 -1 488 32 559 b 296 692 147 659 210 685 m 926 348 b 921 353 924 351 922 353 b 914 348 920 353 918 351 b 823 167 857 306 823 237 b 828 124 823 154 826 138 b 890 31 837 79 862 40 b 896 31 892 31 894 31 b 956 104 916 31 940 59 b 970 191 965 129 970 159 b 966 241 970 208 969 224 b 926 348 959 277 945 313 m 627 326 b 619 326 624 326 622 326 b 598 316 611 326 604 323 b 568 215 579 288 568 255 b 568 208 568 213 568 210 b 571 183 570 195 570 184 l 571 183 b 594 201 571 183 582 191 l 634 231 b 660 259 653 247 656 248 b 664 278 662 266 664 272 b 627 326 664 299 649 320 "},v38:{x_min:-1.359375,x_max:651.96875,ha:665,o:"m 389 644 b 405 645 394 645 400 645 b 504 566 450 645 492 613 b 507 541 506 557 507 549 b 480 471 507 514 498 489 l 477 467 l 483 470 b 609 591 539 485 586 531 b 613 601 611 595 613 599 b 631 609 619 607 624 609 b 651 588 641 609 651 602 b 200 -946 651 584 204 -941 b 182 -957 197 -953 190 -957 b 163 -945 174 -957 166 -953 b 161 -939 161 -942 161 -942 b 217 -743 161 -931 170 -904 b 272 -555 247 -639 272 -555 b 272 -555 272 -555 272 -555 b 264 -560 272 -555 268 -557 b 140 -603 227 -589 182 -603 b 36 -567 102 -603 65 -592 b -1 -487 12 -548 -1 -517 b 17 -427 -1 -466 5 -445 b 103 -380 38 -395 70 -380 b 191 -433 137 -380 172 -398 b 205 -484 201 -448 205 -466 b 178 -553 205 -509 196 -535 l 175 -557 l 182 -555 b 307 -435 236 -539 284 -494 b 372 -213 308 -430 372 -215 b 372 -213 372 -213 372 -213 b 364 -219 372 -213 368 -216 b 240 -262 328 -247 283 -262 b 137 -226 202 -262 166 -249 b 99 -145 112 -206 99 -176 b 118 -84 99 -124 106 -104 b 204 -38 138 -54 171 -38 b 292 -91 238 -38 273 -56 b 306 -141 302 -106 306 -124 b 279 -212 306 -167 296 -194 l 276 -215 l 281 -213 b 408 -93 336 -198 385 -151 b 473 129 409 -88 473 127 b 473 129 473 129 473 129 b 465 122 473 129 469 126 b 341 80 428 94 383 80 b 236 115 303 80 266 91 b 200 195 213 136 200 165 b 217 256 200 217 206 238 b 304 303 239 287 272 303 b 393 249 338 303 374 285 b 406 199 402 234 406 217 b 379 129 406 173 397 148 l 377 126 l 382 127 b 509 248 436 142 485 190 b 574 470 510 254 574 469 b 574 470 574 470 574 470 b 566 464 574 470 570 467 b 442 421 529 435 484 421 b 337 458 404 421 367 433 b 300 537 313 478 300 508 b 389 644 300 585 334 635 "},v39:{x_min:-171.5,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 553 20 616 20 614 b 20 491 20 503 20 491 l 20 491 b 153 535 47 501 149 535 b 174 514 167 535 174 524 b 164 496 174 508 171 501 b 92 470 164 495 132 484 l 20 445 l 20 390 b 20 363 20 378 20 370 b 20 333 20 340 20 333 l 20 333 b 153 377 47 344 149 377 b 174 356 167 377 174 367 b 164 338 174 349 171 342 b 92 312 164 338 132 326 l 20 288 l 20 219 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b -1 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 b -21 30 -21 -212 -21 -212 b -21 273 -21 163 -21 273 b -84 252 -21 273 -50 263 b -152 230 -133 234 -145 230 b -157 231 -155 230 -156 231 b -171 252 -166 234 -171 244 b -160 270 -171 259 -167 266 b -27 316 -159 270 -93 294 l -21 319 l -21 374 b -21 431 -21 406 -21 431 b -84 409 -21 431 -50 421 b -152 388 -133 392 -145 388 b -157 390 -155 388 -156 388 b -171 409 -166 392 -171 401 b -160 428 -171 417 -167 424 b -27 474 -159 428 -93 451 l -21 476 l -21 546 b -20 620 -21 614 -21 616 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},v3b:{x_min:0,x_max:484.5625,ha:494,o:"m 228 245 b 239 247 234 247 239 247 b 243 247 240 247 242 247 b 303 238 257 247 287 242 b 484 -2 417 208 484 104 b 412 -177 484 -65 461 -127 b 243 -248 363 -226 303 -248 b 6 -63 138 -248 36 -180 b 0 -1 1 -41 0 -20 b 228 245 0 127 98 240 m 255 181 b 240 183 247 183 245 183 b 232 181 238 183 235 183 b 142 152 200 180 168 170 l 138 149 l 190 97 l 242 44 l 294 97 l 345 149 l 340 152 b 255 181 315 169 284 180 m 147 -54 l 197 -1 l 147 51 l 95 104 l 91 99 b 62 -1 72 70 62 34 b 66 -43 62 -15 63 -29 b 91 -101 72 -63 80 -84 l 95 -106 l 147 -54 m 393 99 b 389 104 390 102 389 104 b 337 51 389 104 366 80 l 285 -1 l 337 -54 l 389 -106 l 393 -101 b 421 -1 412 -72 421 -36 b 393 99 421 34 412 69 m 294 -98 b 242 -45 265 -69 242 -45 b 190 -98 242 -45 219 -69 l 138 -151 l 142 -154 b 242 -184 172 -174 206 -184 b 340 -154 276 -184 311 -174 l 345 -151 l 294 -98 "},v3c:{x_min:0,x_max:450.53125,ha:460,o:"m 189 302 b 204 303 193 302 198 303 b 303 224 250 303 292 270 b 306 199 304 216 306 208 b 279 129 306 173 296 147 l 276 126 l 281 127 b 408 249 337 142 385 190 b 412 259 409 254 412 258 b 430 267 417 265 423 267 b 450 247 441 267 450 259 b 200 -605 450 242 204 -599 b 182 -616 197 -612 190 -616 b 163 -602 174 -616 166 -610 b 161 -598 161 -601 161 -601 b 217 -402 161 -589 170 -562 b 272 -213 247 -298 272 -213 b 272 -213 272 -213 272 -213 b 264 -219 272 -213 268 -216 b 140 -262 227 -247 182 -262 b 36 -226 102 -262 65 -249 b 0 -145 12 -206 0 -176 b 17 -84 0 -124 5 -104 b 103 -38 38 -54 70 -38 b 191 -91 137 -38 172 -56 b 205 -141 201 -106 205 -124 b 178 -212 205 -167 196 -194 l 175 -215 l 182 -213 b 307 -93 236 -198 284 -151 b 372 129 308 -88 372 127 b 372 129 372 129 372 129 b 364 122 372 129 368 126 b 240 80 328 94 283 80 b 137 115 202 80 166 91 b 99 194 111 136 99 165 b 189 302 99 244 133 292 "},v3e:{x_min:0,x_max:406.96875,ha:415,o:"m 21 183 b 28 183 24 183 25 183 b 42 181 34 183 39 183 b 127 108 47 179 47 179 b 202 41 168 72 202 41 b 279 108 204 41 238 72 b 357 177 321 145 356 176 b 375 183 363 181 370 183 b 406 151 392 183 406 169 b 404 137 406 147 405 141 b 322 62 401 131 398 129 b 251 0 284 27 251 0 b 322 -63 251 -1 284 -29 b 404 -138 398 -130 401 -133 b 406 -152 405 -142 406 -148 b 375 -184 406 -170 392 -184 b 357 -179 370 -184 363 -183 b 279 -109 356 -177 321 -147 b 202 -43 238 -73 204 -43 b 127 -109 202 -43 168 -73 b 49 -179 85 -147 50 -177 b 31 -184 43 -183 36 -184 b 0 -152 13 -184 0 -170 b 2 -138 0 -148 0 -142 b 83 -63 5 -133 8 -130 b 155 0 122 -29 155 -1 b 83 62 155 0 122 27 b 8 129 43 97 10 127 b 0 151 2 136 0 144 b 21 183 0 165 8 177 "},v3f:{x_min:-24.5,x_max:317.140625,ha:324,o:"m -24 -147 l -24 -5 l -20 -5 b -1 -19 -12 -5 -4 -11 b 58 -123 6 -43 31 -86 b 196 -278 93 -173 134 -219 b 317 -570 274 -356 317 -460 b 294 -713 317 -617 308 -666 l 289 -724 l 294 -735 b 317 -873 308 -780 317 -827 b 235 -1132 317 -963 288 -1054 b 209 -1165 228 -1140 224 -1146 b 189 -1177 204 -1172 196 -1177 b 171 -1164 182 -1177 175 -1172 b 168 -1154 170 -1161 168 -1159 b 181 -1132 168 -1149 172 -1142 b 269 -891 238 -1064 269 -975 b 269 -881 269 -886 269 -884 b 262 -814 269 -857 265 -827 b 258 -800 261 -811 259 -806 b 142 -628 240 -731 198 -667 b -8 -589 112 -606 47 -589 b -20 -589 -13 -589 -19 -589 l -24 -589 l -24 -449 l -24 -308 l -20 -308 b -1 -322 -12 -308 -4 -313 b 58 -424 6 -345 31 -388 b 194 -580 93 -476 136 -523 b 259 -660 221 -606 245 -635 b 261 -663 259 -662 261 -663 b 264 -656 262 -663 262 -660 b 269 -587 268 -632 269 -610 b 264 -521 269 -566 268 -544 b 262 -512 264 -517 262 -513 b 258 -498 261 -509 259 -503 b 142 -326 240 -428 198 -365 b -8 -287 112 -303 47 -288 b -20 -287 -13 -287 -19 -287 l -24 -287 l -24 -147 "},v40:{x_min:-1.359375,x_max:436.921875,ha:446,o:"m 213 205 b 217 205 215 205 216 205 b 234 194 224 205 234 199 b 236 187 234 194 235 190 l 245 167 l 261 129 l 270 106 b 355 -61 294 54 329 -13 b 420 -163 381 -105 402 -138 b 436 -188 435 -184 436 -184 b 436 -191 436 -190 436 -190 b 421 -206 436 -201 431 -206 l 421 -206 l 416 -206 l 405 -201 b 217 -158 347 -172 283 -158 b 31 -201 153 -158 88 -172 l 20 -206 l 14 -206 l 14 -206 b 0 -191 5 -206 0 -201 b -1 -188 0 -190 -1 -190 b 14 -163 -1 -186 0 -184 b 95 -34 36 -136 72 -77 b 166 106 119 8 148 68 l 175 129 l 183 148 l 200 188 b 213 205 205 199 208 202 "},v41:{x_min:-1.359375,x_max:556.6875,ha:568,o:"m 294 322 b 318 323 299 322 308 323 b 360 320 334 323 352 322 b 526 217 430 310 490 273 b 543 166 537 202 543 184 b 447 70 543 117 503 70 b 445 70 447 70 446 70 b 359 159 394 72 359 113 b 368 201 359 173 362 187 b 442 245 382 229 412 245 b 455 244 446 245 451 245 b 460 244 458 244 460 244 b 460 244 460 244 460 244 b 454 248 460 244 458 245 b 325 291 417 276 372 291 b 285 287 313 291 299 290 b 144 -2 183 269 144 190 b 281 -290 144 -208 179 -280 b 304 -291 289 -291 298 -291 b 524 -105 412 -291 506 -212 b 541 -84 526 -88 530 -84 b 556 -101 551 -84 556 -90 b 549 -138 556 -111 553 -122 b 334 -322 521 -237 435 -310 b 302 -324 323 -323 313 -324 b 13 -101 172 -324 54 -234 b -1 -1 4 -68 -1 -34 b 294 322 -1 161 121 303 "},v42:{x_min:-348.4375,x_max:24.5,ha:25,o:"m -330 155 b -322 156 -329 156 -326 156 b -315 156 -319 156 -317 156 b -298 147 -311 155 -308 154 b -19 30 -224 98 -122 55 l 2 26 b 24 -1 17 22 24 13 b 2 -27 24 -15 17 -23 l -19 -31 b -298 -148 -122 -56 -224 -99 b -322 -158 -313 -158 -315 -158 b -348 -131 -338 -158 -348 -145 b -344 -117 -348 -127 -347 -122 b -328 -104 -341 -112 -338 -111 b -127 -8 -269 -65 -202 -33 b -106 0 -115 -4 -106 -1 b -127 6 -106 0 -115 2 b -328 102 -202 31 -269 63 b -344 116 -338 109 -341 111 b -348 130 -347 120 -348 124 b -330 155 -348 141 -341 152 "},v43:{x_min:-442.359375,x_max:441,ha:450,o:"m -31 487 b -1 488 -21 488 -10 488 b 434 104 216 488 397 330 b 441 27 438 79 441 47 b 439 12 441 20 439 15 b 419 0 435 4 427 0 b 404 5 413 0 408 1 b 398 30 400 11 398 13 b 0 351 390 213 213 351 b -59 348 -20 351 -39 349 b -400 30 -251 324 -393 191 b -405 5 -400 13 -401 11 b -420 0 -409 1 -415 0 b -441 12 -428 0 -436 4 b -442 27 -441 15 -442 20 b -435 104 -442 47 -439 79 b -31 487 -401 316 -235 474 m -13 131 b -1 133 -9 133 -5 133 b 51 105 19 133 39 123 b 61 70 58 95 61 83 b 51 34 61 58 58 45 b -1 6 39 16 19 6 b -46 27 -17 6 -34 13 b -62 69 -57 38 -62 54 b -13 131 -62 98 -44 124 "},v44:{x_min:-21.78125,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 383 20 616 20 616 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b 0 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 201 l -21 616 l -20 620 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},v45:{x_min:-402.890625,x_max:401.53125,ha:410,o:"m -10 273 b -4 274 -9 273 -6 274 b 16 262 4 274 12 269 b 17 158 17 259 17 259 l 17 56 l 62 112 b 117 174 110 172 110 172 b 122 174 118 174 119 174 b 132 173 125 174 129 173 b 295 11 134 172 171 134 l 307 -1 l 336 34 b 374 76 366 72 368 74 b 381 77 375 77 378 77 b 401 56 392 77 401 68 b 400 48 401 54 401 51 b 223 -172 397 41 230 -166 b 210 -176 220 -174 215 -176 b 201 -174 206 -176 204 -176 b 112 -87 198 -173 178 -152 b 27 0 65 -38 27 0 b 21 -6 27 0 24 -2 l 17 -12 l 17 -147 b 17 -210 17 -173 17 -194 b 10 -292 17 -297 16 -287 b -2 -299 6 -297 2 -299 b -21 -287 -10 -299 -19 -295 b -24 -174 -23 -284 -23 -284 l -24 -63 l -66 -117 b -121 -176 -110 -170 -114 -176 b -125 -176 -122 -176 -123 -176 b -296 -12 -134 -174 -125 -184 l -308 0 l -337 -34 b -375 -77 -367 -73 -370 -76 b -382 -79 -377 -79 -379 -79 b -402 -58 -393 -79 -402 -69 b -401 -49 -402 -55 -402 -52 b -224 170 -398 -43 -231 165 b -212 174 -221 173 -216 174 b -202 173 -208 174 -205 174 b -39 11 -200 172 -151 122 l -28 -1 l -25 1 l -24 4 l -24 130 b -23 260 -24 256 -24 258 b -10 273 -20 266 -16 270 "},v46:{x_min:0,x_max:627.46875,ha:640,o:"m 306 190 b 314 191 308 191 311 191 b 326 184 318 191 322 190 l 336 173 b 510 52 377 127 442 80 b 515 49 513 51 515 49 b 611 16 537 40 579 24 b 627 0 624 13 627 9 b 607 -18 627 -11 624 -13 b 330 -181 490 -49 389 -109 b 314 -192 323 -190 319 -192 b 306 -191 311 -192 308 -192 b 294 -177 302 -188 302 -188 b 257 -140 287 -170 265 -148 b 19 -18 193 -84 114 -44 b 0 0 2 -13 0 -11 b 16 16 0 9 2 13 b 110 49 47 24 89 40 b 117 52 111 49 114 51 b 145 65 126 56 130 58 b 281 163 200 93 245 124 b 300 186 288 170 291 174 b 306 190 300 187 303 188 m 317 137 b 313 142 315 141 314 142 b 308 137 313 142 311 141 b 161 4 276 84 220 33 b 155 0 159 1 155 0 b 163 -4 155 0 159 -2 b 308 -138 220 -34 276 -84 b 313 -142 311 -141 313 -142 b 317 -138 314 -142 315 -141 b 464 -4 351 -84 406 -34 b 470 0 468 -2 470 0 b 464 4 470 0 468 1 b 317 137 406 33 351 84 "},v47:{x_min:-24.5,x_max:315.78125,ha:322,o:"m -24 -145 l -24 -5 l -20 -5 b 1 -26 -10 -5 -6 -9 b 175 -241 31 -86 96 -166 b 314 -548 259 -323 304 -420 b 315 -589 315 -555 315 -571 b 314 -630 315 -606 315 -623 b 298 -730 311 -664 306 -699 l 295 -742 l 296 -748 b 314 -850 304 -778 311 -813 b 315 -892 315 -857 315 -874 b 314 -932 315 -909 315 -925 b 298 -1032 311 -967 306 -1002 l 295 -1045 l 296 -1050 b 314 -1153 304 -1081 311 -1115 b 315 -1193 315 -1160 315 -1177 b 314 -1235 315 -1211 315 -1228 b 217 -1526 306 -1338 270 -1444 b 201 -1533 213 -1532 208 -1533 b 182 -1522 193 -1533 185 -1529 b 179 -1514 181 -1518 179 -1517 b 189 -1489 179 -1508 182 -1501 b 266 -1217 240 -1403 266 -1308 b 262 -1156 266 -1196 265 -1177 b 110 -907 247 -1043 190 -950 b 0 -889 87 -895 50 -889 l -1 -889 l -24 -889 l -24 -749 l -24 -610 l -20 -610 b 1 -631 -10 -610 -6 -614 b 175 -846 31 -691 96 -771 b 259 -956 213 -884 236 -914 b 265 -966 262 -961 264 -966 b 265 -966 265 -966 265 -966 b 265 -953 265 -964 265 -959 b 266 -920 266 -943 266 -932 b 262 -853 266 -898 265 -873 b 110 -605 247 -741 190 -648 b 0 -587 87 -592 50 -587 l -1 -587 l -24 -587 l -24 -448 l -24 -308 l -20 -308 b 1 -328 -10 -308 -6 -312 b 175 -544 31 -388 96 -469 b 259 -655 213 -581 236 -612 b 265 -663 262 -659 264 -663 b 265 -663 265 -663 265 -663 b 265 -650 265 -663 265 -657 b 266 -617 266 -641 266 -630 b 262 -551 266 -595 265 -570 b 110 -303 247 -438 190 -345 b 0 -284 87 -290 50 -284 l -1 -284 l -24 -284 l -24 -145 "},v49:{x_min:0,x_max:630.203125,ha:643,o:"m 308 204 b 314 205 310 205 313 205 b 326 201 319 205 323 204 b 355 154 328 199 338 180 b 401 83 362 142 392 95 l 409 72 b 431 41 412 66 424 49 b 619 -174 498 -51 570 -134 b 630 -192 626 -180 630 -186 b 626 -202 630 -195 628 -199 b 616 -206 623 -205 620 -206 b 552 -188 608 -206 592 -202 b 310 -155 488 -169 392 -155 b 268 -156 295 -155 281 -155 b 77 -188 197 -161 126 -173 b 13 -206 35 -202 20 -206 b 9 -206 12 -206 10 -206 b 0 -191 2 -202 0 -197 b 8 -176 0 -186 2 -180 b 204 49 58 -136 138 -43 l 220 72 l 227 83 b 295 188 245 108 281 166 b 308 204 299 197 304 202 m 315 147 b 314 147 315 147 314 147 b 314 147 314 147 314 147 b 306 129 314 145 310 138 l 296 105 b 281 72 292 97 284 77 l 274 56 b 181 -123 247 -4 212 -72 l 174 -134 l 176 -133 b 314 -123 215 -127 272 -123 b 451 -133 356 -123 413 -127 l 454 -134 l 449 -123 b 353 56 417 -72 381 -4 l 347 72 b 332 105 344 77 336 97 l 322 129 b 315 147 318 138 315 145 "},v4a:{x_min:70.78125,x_max:378.390625,ha:315,o:"m 246 373 b 254 373 249 373 251 373 b 372 324 303 373 360 351 b 378 302 377 317 378 309 b 338 251 378 278 362 255 b 328 249 334 249 332 249 b 283 294 303 249 283 270 b 288 315 283 301 284 308 b 289 319 289 317 289 319 b 289 319 289 319 289 319 b 283 320 289 320 287 320 b 270 322 279 322 274 322 b 206 288 242 322 215 308 b 206 283 206 287 206 285 b 257 223 206 267 230 238 b 284 206 272 213 277 210 b 351 90 328 173 351 130 b 340 47 351 74 348 59 b 205 -30 314 -2 264 -30 b 182 -29 198 -30 190 -30 b 84 15 147 -24 103 -5 b 70 48 74 24 70 36 b 108 99 70 70 85 94 b 121 102 112 101 117 102 b 167 56 147 102 167 80 b 159 31 167 48 164 40 l 156 26 l 157 26 b 190 20 167 22 178 20 b 220 26 201 20 212 22 b 258 65 243 34 258 51 b 257 70 258 66 258 69 b 204 126 249 94 234 109 b 114 258 148 158 114 209 b 125 302 114 273 118 288 b 246 373 147 342 193 370 "},v4b:{x_min:0,x_max:503.609375,ha:514,o:"m 274 430 b 277 430 276 430 277 430 b 310 394 296 430 310 415 b 308 383 310 391 308 387 b 306 367 307 381 307 374 b 236 120 298 305 272 210 b 40 -273 189 -5 125 -134 b 20 -287 35 -283 27 -287 b 5 -281 14 -287 9 -285 b 0 -267 1 -277 0 -273 b 9 -242 0 -262 2 -255 b 246 395 137 -12 232 242 b 274 430 249 416 257 427 m 468 430 b 472 430 469 430 470 430 b 503 394 490 430 503 415 b 502 383 503 391 503 387 b 499 367 502 381 500 374 b 431 120 491 305 465 210 b 234 -273 382 -5 318 -134 b 213 -287 228 -283 220 -287 b 198 -281 208 -287 202 -285 b 193 -267 194 -277 193 -273 b 202 -242 193 -262 196 -255 b 439 395 330 -12 426 242 b 468 430 442 416 451 427 "},v4d:{x_min:-311.6875,x_max:310.328125,ha:317,o:"m -9 388 b -2 390 -8 390 -5 390 b 5 388 1 390 4 390 b 19 378 10 387 16 383 b 23 333 23 371 23 371 b 24 298 23 299 24 298 b 81 276 34 298 65 285 b 213 91 145 240 190 177 b 224 24 217 76 224 36 b 257 24 224 24 235 24 b 299 19 292 24 292 24 b 310 -1 306 15 310 6 b 299 -23 310 -11 306 -19 b 257 -27 292 -27 292 -27 b 224 -29 235 -27 224 -29 b 213 -95 224 -40 217 -80 b 81 -280 190 -181 145 -244 b 24 -301 65 -290 34 -301 b 23 -335 24 -301 23 -303 l 23 -340 b 17 -381 23 -374 23 -374 b -1 -391 13 -388 5 -391 b -21 -381 -9 -391 -17 -388 b -27 -340 -27 -374 -27 -374 l -27 -335 b -28 -301 -27 -303 -27 -301 b -85 -280 -38 -301 -69 -290 b -217 -95 -149 -244 -194 -181 b -228 -29 -221 -80 -228 -40 b -259 -27 -228 -29 -238 -27 b -300 -23 -294 -27 -294 -27 b -311 -2 -307 -19 -311 -11 b -294 23 -311 8 -304 19 b -259 24 -291 23 -284 24 b -228 24 -239 24 -228 24 b -217 91 -228 36 -221 76 b -85 276 -194 177 -149 240 b -28 298 -69 285 -38 298 b -27 333 -27 298 -27 299 b -27 371 -27 362 -27 369 b -9 388 -24 378 -17 385 m -27 136 b -28 247 -27 197 -28 247 b -61 216 -31 247 -53 226 b -123 33 -95 172 -121 98 l -125 24 l -76 24 l -27 24 l -27 136 m 29 242 b 24 247 27 245 24 247 b 23 136 24 247 23 197 l 23 24 l 72 24 l 121 24 l 119 33 b 29 242 115 116 77 206 m -27 -140 l -27 -27 l -76 -27 l -125 -27 l -123 -36 b -61 -220 -121 -102 -95 -176 b -28 -251 -53 -230 -31 -251 b -27 -140 -28 -251 -27 -201 m 119 -36 l 121 -27 l 72 -27 l 23 -27 l 23 -140 b 24 -251 23 -201 24 -251 b 57 -220 27 -251 49 -230 b 119 -36 91 -176 117 -102 "},v4e:{x_min:0,x_max:239.5625,ha:244,o:"m 10 460 b 20 462 13 462 14 462 b 39 449 28 462 35 458 l 40 446 l 40 326 b 40 205 40 259 40 205 b 127 227 40 205 80 215 b 220 249 196 244 213 249 b 227 247 224 249 225 248 b 238 237 231 245 235 241 l 239 233 l 239 -106 l 239 -448 l 238 -451 b 219 -463 234 -459 225 -463 b 198 -451 210 -463 202 -459 l 197 -448 l 197 -324 b 197 -201 197 -248 197 -201 b 110 -223 196 -201 157 -210 b 17 -245 42 -240 24 -245 b 10 -242 13 -245 13 -244 b 0 -233 6 -241 2 -237 l 0 -230 l 0 108 l 0 446 l 0 449 b 10 460 2 453 6 458 m 197 22 b 197 70 197 41 197 58 b 196 116 197 113 197 116 l 196 116 b 118 97 196 116 160 106 l 40 77 l 40 -18 b 40 -112 40 -69 40 -112 l 119 -93 l 197 -73 l 197 22 "},v51:{x_min:-1.359375,x_max:455.96875,ha:465,o:"m 352 541 b 357 542 353 542 355 542 b 377 530 364 542 372 537 l 378 526 l 378 394 l 379 262 l 404 266 b 436 270 420 269 430 270 b 450 265 443 270 446 269 b 455 220 455 259 455 260 l 455 208 l 455 161 l 454 156 b 411 140 449 147 447 147 b 378 133 393 137 379 134 b 378 68 378 133 378 106 b 378 22 378 54 378 38 l 379 -87 l 404 -83 b 436 -79 420 -80 430 -79 b 450 -84 443 -79 446 -80 b 455 -129 455 -90 455 -88 l 455 -141 l 455 -188 l 454 -192 b 413 -209 449 -202 447 -202 b 382 -215 398 -212 383 -215 l 378 -215 l 378 -345 l 378 -380 b 375 -485 378 -484 378 -480 b 357 -494 371 -491 364 -494 b 340 -485 351 -494 344 -491 b 336 -383 337 -480 336 -484 l 336 -349 l 336 -223 l 334 -223 b 291 -231 334 -223 314 -227 l 247 -240 l 247 -371 l 246 -503 l 245 -506 b 225 -519 242 -514 234 -519 b 206 -506 219 -519 210 -514 l 205 -503 l 205 -376 l 205 -248 l 160 -256 l 115 -265 l 115 -396 l 115 -527 l 114 -531 b 95 -544 110 -539 102 -544 b 76 -531 87 -544 78 -539 l 73 -527 l 73 -399 b 73 -273 73 -330 73 -273 b 49 -277 73 -273 61 -274 b 17 -281 32 -280 24 -281 b 4 -276 10 -281 8 -280 b -1 -234 0 -269 -1 -272 b 0 -219 -1 -229 0 -224 l 0 -170 l 1 -167 b 10 -158 2 -163 6 -159 b 49 -149 13 -156 16 -155 l 73 -145 l 73 -34 b 73 76 73 26 73 76 b 49 72 73 76 61 74 b 17 68 32 69 24 68 b 4 73 10 68 8 69 b -1 115 0 80 -1 77 b 0 130 -1 120 0 124 l 0 179 l 1 181 b 10 191 2 186 6 190 b 49 199 13 192 16 194 l 73 204 l 73 338 b 73 374 73 352 73 365 b 77 483 73 484 73 477 b 95 492 81 489 88 492 b 111 483 100 492 107 489 b 115 378 115 477 115 483 l 115 342 b 117 212 115 223 115 212 b 204 229 117 212 200 227 l 205 229 l 205 365 l 205 502 l 206 505 b 225 517 210 513 219 517 b 245 505 234 517 242 513 l 246 502 l 247 369 l 247 237 l 249 237 b 336 254 253 238 336 254 b 337 390 336 254 337 302 l 337 526 l 338 530 b 352 541 341 535 347 539 m 336 15 b 336 126 336 102 336 126 l 336 126 b 291 117 336 126 315 122 l 247 109 l 247 -1 l 247 -112 l 249 -112 b 336 -95 253 -111 336 -95 b 336 15 336 -95 336 -56 m 205 -120 b 205 -55 205 -120 205 -93 b 205 -9 205 -41 205 -24 l 205 101 l 160 93 l 115 84 l 115 -26 b 115 -83 115 -49 115 -69 b 117 -137 115 -133 115 -137 b 205 -120 118 -137 204 -120 "},v52:{x_min:-10.890625,x_max:298.078125,ha:294,o:"m 138 473 b 142 474 140 473 141 474 b 164 459 148 474 153 470 b 191 402 183 442 191 423 b 181 353 191 388 187 371 b 178 349 179 352 178 349 b 179 348 178 348 179 348 b 185 349 181 348 182 348 b 255 376 210 355 234 363 b 272 381 264 381 266 381 b 298 355 287 381 298 370 b 288 330 298 348 298 345 b 171 34 238 254 194 141 b 166 13 168 16 168 16 b 144 1 161 5 152 1 b 121 15 134 1 125 5 b 115 33 119 18 117 24 b 0 330 91 145 49 252 b -10 355 -9 345 -10 348 b 13 381 -10 371 0 381 b 31 376 19 381 25 380 b 132 345 61 358 103 345 l 136 345 l 137 355 b 145 378 138 359 142 370 b 152 415 149 394 152 405 b 137 452 152 427 148 438 b 133 464 134 458 133 460 b 138 473 133 467 134 470 "},v53:{x_min:0,x_max:902.421875,ha:921,o:"m 17 240 b 24 241 19 241 21 241 b 32 240 28 241 31 241 b 46 229 38 238 43 234 b 50 88 50 223 50 237 b 50 -1 50 63 50 34 b 50 -90 50 -36 50 -65 b 46 -231 50 -238 50 -224 b 25 -242 42 -238 34 -242 b 0 -224 14 -242 4 -235 b 0 2 0 -222 0 -108 b 0 223 0 112 0 220 b 17 240 2 230 9 237 m 110 240 b 118 241 111 241 114 241 b 126 240 121 241 123 241 b 142 223 133 237 140 230 b 144 123 144 220 144 205 b 144 29 144 45 144 29 b 144 29 144 29 144 29 b 393 183 166 106 264 167 b 450 186 412 184 431 186 b 756 29 600 186 732 120 b 756 29 756 29 756 29 b 758 123 758 29 758 45 b 760 227 758 226 758 223 b 784 241 766 237 774 241 b 804 229 792 241 800 237 b 809 88 808 223 809 237 l 809 -1 l 809 -90 b 804 -231 809 -238 808 -224 b 784 -242 800 -238 792 -242 b 762 -231 775 -242 766 -238 b 758 -124 756 -224 758 -231 b 756 -30 758 -47 758 -30 b 756 -30 756 -30 756 -30 b 509 -184 736 -108 637 -169 b 450 -187 488 -187 469 -187 b 144 -30 300 -187 168 -122 b 144 -30 144 -30 144 -30 b 144 -124 144 -30 144 -47 b 140 -231 144 -231 144 -224 b 118 -242 134 -238 126 -242 b 92 -224 107 -242 96 -235 b 92 2 92 -222 92 -108 b 92 223 92 112 92 220 b 110 240 95 230 102 237 m 432 161 b 413 162 426 162 420 162 b 313 41 351 162 313 109 b 347 -73 313 5 323 -34 b 487 -163 385 -133 439 -163 b 578 -97 526 -163 562 -142 b 588 -43 585 -80 588 -62 b 432 161 588 47 518 147 m 868 240 b 876 241 869 241 872 241 b 884 240 879 241 882 241 b 898 229 890 238 894 234 b 902 88 902 223 902 237 l 902 -1 l 902 -90 b 898 -231 902 -238 902 -224 b 876 -242 892 -238 884 -242 b 852 -224 865 -242 854 -235 b 850 2 850 -222 850 -108 b 852 223 850 112 850 220 b 868 240 853 230 860 237 "},v54:{x_min:-24.5,x_max:317.140625,ha:324,o:"m -24 -161 l -24 -5 l -20 -5 b 0 -24 -9 -5 -2 -12 b 171 -315 21 -124 84 -233 b 317 -660 268 -406 317 -531 b 187 -1014 317 -782 274 -909 b 161 -1034 172 -1034 171 -1034 b 141 -1013 149 -1034 141 -1025 b 152 -991 141 -1004 142 -1002 b 266 -682 228 -899 266 -788 b 174 -430 266 -588 236 -498 b -23 -317 136 -388 66 -348 b -24 -161 -23 -316 -24 -285 "},v55:{x_min:0,x_max:551.25,ha:563,o:"m 289 644 b 304 645 294 645 299 645 b 404 566 349 645 392 613 b 406 541 405 557 406 549 b 379 471 406 514 397 489 l 377 467 l 382 470 b 509 591 438 485 485 531 b 513 601 510 595 513 599 b 530 609 518 607 524 609 b 551 588 540 609 551 602 b 200 -605 551 584 204 -599 b 182 -616 197 -612 190 -616 b 163 -602 174 -616 166 -610 b 161 -598 161 -601 161 -601 b 217 -402 161 -589 170 -562 b 272 -213 247 -298 272 -213 b 272 -213 272 -213 272 -213 b 264 -219 272 -213 268 -216 b 140 -262 227 -247 182 -262 b 36 -226 102 -262 65 -249 b 0 -145 12 -206 0 -176 b 17 -84 0 -124 5 -104 b 103 -38 38 -54 70 -38 b 191 -91 137 -38 172 -56 b 205 -141 201 -106 205 -124 b 178 -212 205 -167 196 -194 l 175 -215 l 182 -213 b 307 -93 236 -198 284 -151 b 372 129 308 -88 372 127 b 372 129 372 129 372 129 b 364 122 372 129 368 126 b 240 80 328 94 283 80 b 137 115 202 80 166 91 b 99 195 112 136 99 165 b 118 256 99 217 106 238 b 204 303 138 287 171 303 b 292 249 238 303 273 285 b 306 199 302 234 306 217 b 279 129 306 173 296 148 l 276 126 l 281 127 b 408 248 336 142 385 190 b 473 470 409 254 473 469 b 473 470 473 470 473 470 b 465 464 473 470 469 467 b 341 421 428 435 383 421 b 236 458 303 421 266 433 b 200 537 212 478 200 508 b 289 644 200 585 234 635 "},v58:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 259 1553 b 265 1553 261 1553 264 1553 b 288 1540 272 1553 277 1550 b 367 1351 340 1493 367 1424 b 336 1221 367 1308 357 1263 l 332 1211 l 333 1208 b 367 1077 356 1170 367 1124 b 336 945 367 1032 357 986 l 332 935 l 333 932 b 367 800 356 893 367 848 b 336 669 367 756 357 710 l 332 659 l 333 656 b 367 523 356 617 367 571 b 345 412 367 485 360 446 b 231 273 322 356 284 310 b -1 19 121 195 27 93 b -17 4 -4 11 -10 5 l -21 4 l -21 134 l -21 265 l -17 265 b 133 291 20 265 96 278 b 318 537 245 328 318 433 b 307 603 318 559 315 582 b 303 614 304 612 304 614 b 298 609 302 614 300 613 b 231 549 281 589 258 567 b -1 295 121 471 27 369 b -17 280 -4 287 -10 281 l -21 280 l -21 410 l -21 541 l -17 541 b 133 567 20 541 96 555 b 318 813 245 605 318 709 b 307 880 318 835 315 859 b 303 891 304 888 304 891 b 298 885 302 891 300 888 b 231 825 281 866 258 843 b -1 571 121 748 27 645 b -17 556 -4 563 -10 557 l -21 556 l -21 687 l -21 817 l -17 817 b 133 843 20 817 96 830 b 318 1089 245 881 318 985 b 307 1156 318 1111 315 1134 b 303 1167 304 1164 304 1167 b 298 1161 302 1167 300 1164 b 231 1102 281 1140 258 1120 b -1 848 121 1024 27 921 b -17 832 -4 839 -10 834 l -21 832 l -21 963 l -21 1093 l -17 1093 b 114 1113 12 1093 78 1103 b 313 1314 215 1142 289 1218 b 318 1364 317 1331 318 1347 b 255 1511 318 1422 295 1478 b 243 1532 247 1519 243 1525 b 259 1553 243 1540 250 1550 "},v59:{x_min:0,x_max:464.140625,ha:474,o:"m 0 0 l 0 347 l 76 347 l 153 347 l 153 0 l 153 -348 l 76 -348 l 0 -348 l 0 0 m 308 -1 l 308 347 l 386 347 l 464 347 l 464 -1 l 464 -348 l 386 -348 l 308 -348 l 308 -1 "},v5a:{x_min:-171.5,x_max:170.140625,ha:174,o:"m -6 566 b 0 567 -5 567 -2 567 b 14 556 6 567 12 563 b 92 285 14 555 50 433 b 170 13 166 33 170 19 b 168 13 170 13 170 13 b 161 1 168 8 167 4 l 159 0 l 122 0 l 84 0 l 81 1 b 21 195 76 5 78 -5 b -32 381 -8 297 -32 381 b -87 197 -32 381 -57 298 b -141 8 -115 94 -140 9 b -155 0 -142 2 -149 0 b -171 15 -163 0 -171 5 b -14 556 -171 18 -24 528 b -6 566 -14 560 -10 564 "},v5b:{x_min:-441,x_max:439.640625,ha:449,o:"m -428 -2 b -421 0 -427 -1 -424 0 b -406 -6 -416 0 -409 -2 b -400 -31 -401 -12 -400 -15 b -1 -352 -392 -215 -215 -352 b 58 -349 19 -352 38 -351 b 398 -31 250 -326 392 -192 b 404 -6 398 -15 400 -12 b 419 -1 408 -2 413 -1 b 439 -13 427 -1 435 -5 b 439 -29 439 -16 439 -22 b 434 -105 439 -48 438 -80 b 0 -489 397 -333 213 -489 b -68 -484 -23 -489 -44 -488 b -441 -36 -280 -452 -436 -263 b -441 -30 -441 -34 -441 -31 b -428 -2 -441 -11 -439 -5 m -13 -9 b -1 -8 -9 -8 -5 -8 b 50 -36 19 -8 39 -19 b 61 -72 57 -47 61 -59 b 50 -106 61 -84 57 -97 b -1 -134 39 -124 19 -134 b -46 -115 -17 -134 -34 -129 b -62 -72 -57 -102 -62 -87 b -13 -9 -62 -44 -44 -16 "},v5c:{x_min:0,x_max:447.8125,ha:457,o:"m 0 -87 l 0 0 l 223 0 l 447 0 l 447 -87 l 447 -174 l 223 -174 l 0 -174 l 0 -87 "},v5d:{x_min:-1.359375,x_max:592.078125,ha:604,o:"m 280 692 b 295 694 283 692 289 694 b 310 692 300 694 307 692 b 357 630 340 684 357 657 b 336 580 357 612 351 594 b 311 538 321 566 311 549 b 352 492 311 512 330 492 b 366 495 357 492 362 492 b 397 553 390 503 397 517 b 415 603 397 576 402 591 b 460 623 427 617 443 623 b 509 599 479 623 498 614 b 522 559 518 587 522 573 b 494 506 522 538 513 519 b 451 495 481 498 473 496 b 415 488 432 495 426 494 b 394 449 404 483 394 464 b 394 448 394 448 394 448 l 394 440 l 397 433 b 428 409 404 420 413 413 b 438 408 431 408 435 408 b 479 431 450 408 462 415 b 528 455 495 448 510 455 b 548 452 534 455 541 453 b 592 391 577 442 592 416 b 549 331 592 365 577 340 b 528 327 541 328 534 327 b 479 351 510 327 495 335 b 438 374 464 367 450 374 b 417 369 431 374 424 373 b 394 333 402 360 394 348 b 400 312 394 326 396 319 b 451 287 408 294 420 288 b 513 258 484 285 499 278 b 522 223 519 247 522 234 b 461 159 522 190 496 159 b 449 161 457 159 453 159 b 397 229 416 167 397 191 b 366 288 397 265 390 278 b 352 290 362 290 357 290 b 315 262 336 290 321 280 b 311 245 313 256 311 251 b 334 204 311 233 318 220 b 355 170 348 190 351 184 b 357 152 356 166 357 159 b 355 136 357 147 356 140 b 295 88 345 104 321 88 b 232 152 264 88 232 112 b 255 204 232 174 238 186 b 279 244 273 222 279 231 l 279 245 b 238 290 279 270 259 290 b 224 288 234 290 228 290 b 193 229 200 278 193 265 b 141 161 193 191 174 167 b 129 159 137 159 133 159 b 68 223 93 159 68 190 b 77 258 68 234 70 247 b 138 287 91 278 106 285 b 185 302 166 287 175 291 b 196 333 193 312 196 323 b 174 369 196 347 187 360 b 152 374 166 373 159 374 b 111 351 140 374 126 367 b 62 327 95 335 80 327 b 51 328 58 327 54 327 b -1 391 16 334 -1 363 b 53 455 -1 420 17 449 b 62 455 57 455 59 455 b 111 431 80 455 95 448 b 152 408 127 415 140 408 b 161 409 155 408 159 408 b 193 433 176 413 186 420 l 196 440 l 196 448 b 196 451 196 449 196 449 b 190 471 196 459 194 463 b 137 495 182 489 167 495 l 134 495 l 134 495 b 68 560 95 495 68 521 b 129 623 68 596 95 623 b 144 621 134 623 138 623 b 193 553 175 614 193 589 b 224 495 193 517 200 503 b 238 492 228 492 234 492 b 279 538 259 492 279 512 b 254 580 279 549 269 566 b 232 630 239 594 232 612 b 280 692 232 657 250 684 m 307 456 b 295 458 303 458 299 458 b 230 391 258 458 230 426 b 236 360 230 381 231 371 b 295 324 249 337 272 324 b 353 360 318 324 341 337 b 360 391 357 370 360 381 b 307 456 360 421 340 451 "},v60:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m -367 173 b -362 174 -366 174 -364 174 b -351 173 -357 174 -353 173 b -262 86 -348 172 -328 151 b -176 0 -216 37 -176 0 b -107 84 -176 0 -145 37 b -31 174 -36 173 -38 172 b -25 174 -29 174 -28 174 b -16 173 -23 174 -19 173 b 72 86 -13 172 6 151 b 157 0 119 37 157 0 b 227 84 159 0 189 37 b 303 174 298 173 296 172 b 308 174 304 174 307 174 b 318 173 313 174 317 173 b 481 11 322 172 357 134 l 494 -1 l 522 34 b 560 76 553 72 555 74 b 567 77 563 77 564 77 b 589 56 579 77 589 68 b 586 48 589 54 588 51 b 411 -172 583 41 416 -166 b 397 -176 406 -174 401 -176 b 387 -174 393 -176 390 -176 b 299 -87 386 -173 366 -152 b 213 0 253 -38 213 0 b 144 -86 213 0 182 -38 b 68 -174 73 -174 74 -173 b 62 -176 66 -176 65 -176 b 53 -174 59 -176 55 -174 b -35 -87 50 -173 29 -152 b -121 0 -83 -38 -121 0 b -190 -86 -122 0 -152 -38 b -266 -174 -261 -174 -259 -173 b -272 -176 -268 -176 -270 -176 b -281 -174 -276 -176 -280 -174 b -371 -86 -284 -173 -304 -152 b -457 0 -417 -38 -457 0 l -457 0 b -477 -26 -457 0 -470 -16 b -548 -227 -524 -88 -548 -161 b -536 -303 -548 -254 -544 -280 b -533 -317 -534 -309 -533 -313 b -553 -338 -533 -330 -541 -338 b -577 -315 -566 -338 -571 -333 b -590 -227 -586 -287 -590 -258 b -518 -9 -590 -154 -564 -77 b -465 56 -509 2 -504 8 l -402 134 b -367 173 -375 169 -372 172 "},v62:{x_min:46.28125,x_max:669.671875,ha:563,o:"m 183 376 b 189 376 185 376 187 376 b 212 374 197 376 208 376 b 265 337 234 369 253 355 b 274 317 268 331 273 320 b 274 316 274 317 274 316 b 280 323 276 316 276 319 b 311 358 288 337 299 348 b 319 366 315 360 318 365 b 356 376 326 373 340 376 b 382 371 364 376 374 374 b 428 337 400 366 417 352 b 436 317 431 331 436 320 b 438 316 436 317 436 316 b 442 323 438 316 439 319 b 475 358 451 337 462 348 b 483 366 477 360 481 365 b 518 376 488 373 503 376 b 544 373 528 376 536 376 b 604 285 579 360 604 326 b 597 249 604 273 601 258 b 543 63 596 247 544 70 b 541 54 543 61 541 55 b 540 44 540 51 540 47 b 552 23 540 33 545 23 b 552 23 552 23 552 23 b 647 126 586 29 627 72 b 658 138 651 136 653 138 b 660 138 660 138 660 138 b 669 129 666 137 669 136 b 654 88 669 122 665 109 b 562 -12 631 43 602 9 l 549 -19 b 521 -27 540 -24 530 -27 b 447 30 490 -27 458 -4 b 443 58 445 38 443 48 b 450 93 443 72 446 84 b 504 278 453 97 504 272 b 507 288 506 283 506 287 b 509 298 507 292 509 295 b 491 326 509 310 502 320 b 487 327 490 327 488 327 b 479 324 484 327 483 326 b 441 270 462 316 443 288 b 435 249 441 265 436 254 b 398 127 434 248 419 195 b 362 4 379 61 362 5 b 328 -1 359 -1 362 -1 b 314 -1 323 -1 319 -1 b 302 -1 310 -1 306 -1 b 266 4 266 -1 269 -1 b 265 6 265 5 265 5 b 303 144 265 13 272 34 b 343 278 325 216 343 276 b 344 288 343 281 344 285 b 345 298 345 291 345 295 b 330 326 345 310 340 320 b 323 327 328 327 325 327 b 317 324 322 327 321 326 b 279 270 300 316 281 288 b 273 249 279 265 274 254 b 236 127 272 248 255 195 b 200 4 216 61 200 5 b 164 -1 197 -1 198 -1 b 151 -1 161 -1 156 -1 b 140 -1 147 -1 142 -1 b 103 4 104 -1 106 -1 b 103 6 103 5 103 5 b 141 144 103 13 108 34 b 181 278 161 216 179 276 b 182 288 181 281 181 285 b 183 298 182 291 183 295 b 168 324 183 310 178 320 b 160 327 166 326 163 327 b 141 320 156 327 151 324 b 69 230 112 305 85 272 b 57 215 65 217 62 215 b 55 215 57 215 55 215 b 46 224 49 215 46 217 b 59 260 46 231 50 242 b 151 363 81 306 112 341 b 161 369 155 365 160 367 b 183 376 166 371 174 374 "},v68:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -533 324 b -525 327 -530 326 -528 327 b -504 305 -514 327 -504 317 b -504 305 -504 305 -504 305 b -513 284 -504 299 -504 299 b -556 112 -541 226 -556 167 b -545 33 -556 84 -552 58 b -524 -20 -541 15 -532 -9 l -522 -23 l -491 15 l -413 111 b -355 174 -367 169 -363 174 b -351 174 -353 174 -352 174 b -254 86 -343 174 -348 179 b -168 -1 -208 37 -168 -1 b -100 84 -168 -1 -137 37 b -23 173 -28 173 -29 172 b -19 174 -21 174 -20 174 b -8 173 -14 174 -10 173 b 155 11 -5 172 43 123 l 166 -1 l 168 1 l 170 4 l 170 130 b 171 260 170 256 170 258 b 191 274 175 269 183 274 b 205 267 196 274 201 272 b 212 158 212 262 210 273 l 212 56 l 257 112 b 311 173 304 172 304 172 b 317 174 313 174 314 174 b 326 173 319 174 323 173 b 490 11 329 172 366 134 l 502 -1 l 530 34 b 568 76 560 72 563 74 b 575 77 570 77 573 77 b 596 56 586 77 596 68 b 594 48 596 54 596 51 b 417 -172 592 41 424 -166 b 405 -176 415 -174 409 -176 b 396 -174 401 -176 398 -176 b 307 -87 393 -173 372 -152 b 221 -1 259 -38 221 -1 b 216 -6 221 -1 219 -2 l 212 -12 l 212 -147 b 212 -210 212 -173 212 -194 b 205 -292 212 -297 210 -287 b 191 -299 201 -297 196 -299 b 172 -287 183 -299 175 -295 b 170 -174 171 -284 171 -284 l 170 -63 l 127 -117 b 73 -176 84 -170 80 -176 b 68 -176 72 -176 70 -176 b -27 -87 59 -174 65 -180 b -114 0 -74 -38 -112 0 b -182 -86 -114 0 -145 -38 b -258 -174 -253 -174 -253 -173 b -264 -176 -259 -176 -262 -176 b -274 -174 -268 -176 -272 -174 b -438 -11 -277 -173 -348 -102 l -449 0 l -479 -37 b -524 -80 -513 -80 -514 -80 l -524 -80 b -553 -52 -534 -80 -540 -74 b -597 109 -583 -8 -597 48 b -560 280 -597 165 -585 224 b -533 324 -548 310 -540 322 "},v6c:{x_min:-1.359375,x_max:193.28125,ha:197,o:"m 78 233 b 87 233 81 233 84 233 b 187 140 132 233 174 195 b 193 102 190 127 193 115 b 43 -113 193 22 136 -62 b 27 -119 36 -116 31 -119 b 19 -108 21 -119 19 -115 b 29 -97 19 -102 20 -101 b 102 13 73 -72 102 -27 b 92 51 102 26 98 40 l 91 54 l 84 54 b 8 104 53 54 21 74 b -1 142 1 116 -1 130 b 78 233 -1 187 31 227 "},v6d:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m 544 335 b 553 337 548 337 551 337 b 575 313 563 337 570 330 b 589 226 583 285 589 256 b 517 8 589 152 563 76 b 464 -58 507 -4 503 -9 l 401 -136 b 362 -176 372 -172 370 -176 b 357 -176 360 -176 359 -176 b 261 -87 349 -174 355 -180 b 175 0 215 -38 175 0 b 106 -86 175 0 144 -38 b 29 -174 35 -174 36 -173 b 24 -176 28 -176 27 -176 b 14 -174 21 -176 17 -174 b -73 -87 12 -173 -8 -152 b -159 0 -121 -38 -159 0 b -228 -86 -160 0 -190 -38 b -304 -174 -299 -174 -298 -173 b -310 -176 -306 -176 -308 -176 b -319 -174 -314 -176 -318 -174 b -483 -12 -323 -173 -359 -137 l -495 0 l -524 -34 b -562 -77 -553 -73 -556 -76 b -568 -79 -564 -79 -566 -79 b -590 -58 -581 -79 -590 -69 b -588 -49 -590 -55 -589 -52 b -412 170 -585 -43 -417 165 b -398 174 -408 173 -402 174 b -389 173 -394 174 -392 174 b -300 86 -387 172 -366 151 b -215 -1 -254 37 -215 -1 b -145 84 -215 -1 -183 37 b -69 173 -74 173 -76 172 b -63 174 -68 174 -66 174 b -54 173 -61 174 -57 173 b 34 86 -51 172 -31 151 b 119 -1 81 37 119 -1 b 189 84 121 -1 151 37 b 265 173 259 173 258 172 b 270 174 266 174 269 174 b 280 173 274 174 279 173 b 370 84 283 172 303 151 b 455 -1 416 37 455 -1 l 455 -1 b 476 24 455 -1 469 15 b 547 226 522 87 547 159 b 534 302 547 252 543 278 b 532 317 533 308 532 313 b 544 335 532 326 536 333 "},v6f:{x_min:-80.3125,x_max:78.9375,ha:81,o:"m 63 191 b 69 192 65 192 66 192 b 77 188 72 192 76 191 b 78 183 78 187 78 186 b 74 158 78 179 77 172 l 66 115 b 9 -161 49 30 10 -158 b -10 -187 6 -172 -1 -181 b -34 -194 -17 -191 -25 -194 b -80 -147 -58 -194 -80 -174 b -80 -141 -80 -144 -80 -142 b 9 70 -80 -134 -73 -117 l 49 163 b 63 191 59 188 61 190 "},v70:{x_min:0,x_max:436.921875,ha:446,o:"m 213 190 b 217 191 215 191 216 191 b 231 184 223 191 228 188 b 249 154 240 167 246 159 b 419 18 292 91 348 45 b 436 -1 435 11 436 8 b 424 -16 436 -9 434 -13 b 308 -87 394 -26 340 -59 b 231 -186 276 -117 257 -142 b 219 -192 228 -191 225 -192 b 198 -174 209 -192 208 -191 b 47 -33 161 -113 110 -63 b 10 -16 34 -26 17 -19 b 0 -1 2 -13 0 -9 b 17 18 0 8 1 11 b 198 173 95 48 156 101 b 213 190 206 187 208 188 "},v72:{x_min:-423.3125,x_max:421.9375,ha:431,o:"m -262 197 b -247 197 -257 197 -253 197 b -118 162 -210 197 -163 184 b 40 45 -61 134 -13 98 b 277 -95 119 -33 200 -81 b 289 -97 281 -97 285 -97 b 378 0 332 -97 371 -55 b 378 11 378 4 378 6 b 302 83 378 55 345 83 b 242 66 283 83 262 77 b 208 56 231 59 219 56 b 148 120 175 56 148 81 b 201 186 148 151 164 172 b 261 198 220 194 240 198 b 420 45 341 198 411 136 b 421 22 421 37 421 29 b 245 -199 421 -93 338 -199 b 238 -198 243 -199 240 -199 b -44 -47 148 -194 50 -141 b -250 86 -114 22 -183 66 b -295 94 -270 91 -283 94 b -315 91 -302 94 -307 94 b -381 4 -356 81 -381 43 b -355 -56 -381 -18 -372 -40 b -298 -81 -338 -73 -319 -81 b -246 -68 -283 -81 -265 -77 b -212 -58 -234 -61 -223 -58 b -178 -69 -200 -58 -189 -62 b -151 -122 -160 -81 -151 -101 b -171 -167 -151 -138 -157 -155 b -239 -195 -185 -181 -213 -192 b -257 -197 -245 -197 -250 -197 b -423 -5 -352 -197 -423 -109 b -412 65 -423 16 -419 40 b -262 197 -389 137 -329 188 "},v74:{x_min:-206.890625,x_max:428.75,ha:438,o:"m 389 -351 b 394 -351 390 -351 393 -351 b 428 -385 413 -351 428 -367 b 428 -394 428 -388 428 -391 b 394 -428 426 -406 421 -410 l 332 -473 l 269 -516 l 205 -560 l 141 -603 l 77 -648 l 13 -692 l -50 -737 l -114 -780 l -145 -802 b -171 -813 -157 -810 -163 -813 b -175 -813 -172 -813 -174 -813 b -206 -777 -194 -811 -206 -795 b -202 -760 -206 -771 -205 -766 b -87 -675 -197 -752 -206 -757 l -34 -639 l 83 -557 l 145 -514 l 209 -470 l 272 -427 b 389 -351 375 -356 381 -352 "},v75:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -137 381 b -130 383 -134 383 -133 383 b -111 371 -122 383 -114 378 b -55 224 -110 370 -85 305 b 0 80 -25 145 -1 80 b 54 224 0 80 24 145 b 112 377 114 384 110 373 b 127 384 118 381 122 384 b 148 362 138 384 148 374 l 148 356 l 83 183 b 16 9 47 88 17 11 b -1 0 12 2 5 0 b -14 5 -5 0 -10 1 b -84 183 -19 9 -13 -6 l -149 356 l -149 362 b -137 381 -149 371 -145 378 "},v78:{x_min:0,x_max:193.28125,ha:197,o:"m 85 514 b 95 517 88 517 89 517 b 114 505 103 517 110 513 l 115 502 l 115 376 b 115 249 115 306 115 249 b 141 258 117 249 127 252 l 167 266 l 172 266 b 190 254 181 265 187 262 l 193 251 l 193 202 l 193 188 b 187 147 193 149 191 152 b 147 130 183 142 182 141 l 115 119 l 115 9 b 115 -99 115 -51 115 -99 b 141 -91 115 -99 127 -95 b 171 -81 166 -81 167 -81 l 171 -81 b 191 -94 181 -81 189 -87 b 193 -142 191 -97 193 -120 b 191 -195 193 -167 191 -194 b 125 -227 187 -205 187 -204 l 115 -230 l 115 -366 l 115 -503 l 114 -506 b 95 -519 110 -514 102 -519 b 74 -506 87 -519 78 -514 l 73 -503 l 73 -374 b 73 -245 73 -260 73 -245 b 73 -245 73 -245 73 -245 b 55 -252 72 -245 63 -249 l 32 -260 b 19 -263 27 -262 23 -263 b 4 -256 13 -263 8 -260 b 0 -215 0 -251 0 -254 b 0 -199 0 -210 0 -206 l 0 -152 l 1 -149 b 8 -140 2 -145 5 -141 b 42 -127 9 -140 24 -133 l 73 -116 l 73 -5 b 73 23 73 4 73 15 b 73 105 73 70 73 105 b 49 97 73 105 61 101 b 17 88 32 91 23 88 b 4 95 10 88 8 91 b 0 137 0 101 0 98 b 0 151 0 141 0 145 l 0 199 l 1 202 b 43 224 5 212 5 212 l 73 234 l 73 367 l 73 502 l 74 505 b 85 514 77 509 81 513 "},v79:{x_min:-1.359375,x_max:899.703125,ha:918,o:"m 307 349 b 332 351 315 351 323 351 b 443 340 367 351 408 347 b 741 47 607 306 720 195 b 744 0 743 31 744 16 b 660 -303 744 -90 713 -206 b 28 -755 534 -531 304 -695 b 14 -756 23 -755 19 -756 b -1 -741 4 -756 -1 -750 b 21 -720 -1 -731 1 -728 b 567 -56 337 -601 548 -344 b 568 -11 568 -41 568 -24 b 442 285 568 129 525 233 b 325 319 406 308 367 319 b 93 177 232 319 137 266 b 84 154 91 170 84 155 b 84 154 84 154 84 154 b 88 156 84 154 85 155 b 159 177 110 170 134 177 b 257 134 194 177 231 162 b 294 41 281 108 294 73 b 171 -97 294 -24 246 -90 b 156 -98 166 -97 161 -98 b 6 74 73 -98 6 -22 b 6 80 6 76 6 79 b 307 349 10 223 141 340 m 839 215 b 845 216 841 216 842 216 b 862 213 852 216 860 215 b 899 163 887 206 899 184 b 872 117 899 145 890 127 b 847 111 865 112 856 111 b 808 130 833 111 818 117 b 796 162 800 140 796 151 b 839 215 796 187 812 212 m 839 -112 b 845 -112 841 -112 842 -112 b 862 -115 852 -112 860 -113 b 899 -165 887 -122 899 -144 b 872 -210 899 -183 890 -201 b 847 -217 865 -215 856 -217 b 808 -198 833 -217 818 -210 b 796 -165 800 -188 796 -177 b 839 -112 796 -140 812 -116 "},v7a:{x_min:-1.359375,x_max:386.5625,ha:394,o:"m 249 535 b 257 537 251 537 253 537 b 276 524 266 537 273 533 l 277 521 l 279 419 l 279 316 l 304 323 b 337 328 319 326 330 328 b 353 316 347 328 349 324 b 355 266 355 315 355 290 b 353 215 355 241 355 217 b 319 198 349 206 347 205 b 279 187 284 190 279 188 b 279 156 279 187 279 174 b 279 136 279 151 279 144 l 279 84 l 289 87 l 330 98 b 367 105 352 102 362 105 b 378 101 372 105 375 104 b 386 61 385 95 386 94 b 386 40 386 55 386 48 l 386 -5 l 385 -8 b 374 -19 383 -12 378 -18 b 291 -40 372 -19 347 -26 b 279 -43 284 -41 279 -43 b 279 -83 279 -43 279 -59 b 279 -95 279 -87 279 -91 l 279 -145 l 304 -140 b 337 -133 321 -136 330 -133 b 349 -140 343 -133 347 -136 b 355 -181 355 -145 355 -142 l 355 -197 l 355 -210 b 349 -252 355 -249 355 -247 b 300 -269 345 -258 347 -258 b 280 -274 291 -272 281 -273 l 279 -274 l 277 -378 l 277 -483 l 276 -487 b 257 -499 273 -495 265 -499 b 238 -487 249 -499 242 -495 l 236 -483 l 236 -384 l 236 -285 l 235 -285 l 212 -291 l 170 -301 b 148 -308 159 -305 148 -306 b 147 -415 147 -308 147 -313 l 147 -523 l 145 -526 b 126 -538 141 -534 133 -538 b 106 -526 118 -538 110 -534 l 104 -523 l 104 -420 b 103 -317 104 -326 104 -317 b 103 -317 103 -317 103 -317 b 50 -330 92 -322 54 -330 b 31 -317 42 -330 35 -326 b 29 -267 29 -315 29 -315 l 29 -219 l 32 -216 b 92 -192 36 -206 36 -206 l 104 -190 l 104 -138 b 103 -87 104 -91 104 -87 b 103 -87 103 -87 103 -87 b 88 -91 103 -87 96 -88 l 49 -101 b 17 -106 32 -105 23 -106 b 6 -102 13 -106 10 -105 b -1 -62 0 -97 -1 -95 b 0 -41 -1 -56 0 -49 l 0 4 l 1 6 b 10 16 2 11 6 15 b 91 37 12 18 38 24 l 104 41 l 104 93 b 103 144 104 140 104 144 b 103 144 103 144 103 144 b 50 131 92 141 54 131 b 31 144 42 131 35 137 b 29 195 29 147 29 148 l 29 242 l 32 245 b 92 269 36 255 36 255 l 104 273 l 104 377 l 104 481 l 106 485 b 126 498 110 492 118 498 b 134 495 129 498 132 496 b 145 485 138 494 142 489 l 147 481 l 147 383 l 147 283 l 152 284 b 190 294 155 285 171 290 l 230 303 l 236 305 l 236 413 l 236 521 l 238 524 b 249 535 240 528 243 533 m 236 126 b 235 177 236 154 236 177 l 235 177 b 213 172 235 177 225 174 l 170 161 b 147 155 157 158 147 155 b 147 124 147 155 147 142 b 147 102 147 117 147 111 l 147 52 l 153 54 l 228 72 l 236 74 l 236 126 m 236 -105 b 235 -54 236 -65 236 -54 l 235 -54 b 231 -55 235 -54 234 -54 b 172 -69 227 -55 204 -62 l 149 -76 l 147 -76 l 147 -127 l 147 -179 l 152 -177 b 190 -167 155 -177 171 -173 l 230 -158 l 236 -156 l 236 -105 "},v7c:{x_min:0,x_max:300.8125,ha:307,o:"m 49 505 b 53 506 50 505 51 506 b 70 496 58 506 62 503 b 81 485 73 492 78 488 l 96 473 l 111 459 l 122 449 l 134 438 l 182 396 l 255 330 b 292 291 292 298 292 298 l 292 290 l 292 284 l 283 270 b 209 36 234 197 209 113 b 288 -170 209 -44 235 -119 b 299 -184 295 -179 299 -181 b 300 -191 300 -187 300 -188 b 285 -206 300 -199 294 -206 b 280 -206 283 -206 281 -206 b 247 -201 270 -202 259 -201 b 176 -222 223 -201 197 -208 b 114 -340 136 -249 114 -292 b 172 -471 114 -384 134 -433 b 185 -492 182 -481 185 -487 b 181 -502 185 -496 183 -499 b 171 -508 176 -505 174 -508 b 152 -498 166 -508 160 -503 b 0 -284 65 -428 12 -352 b 0 -260 0 -278 0 -270 b 1 -238 0 -252 0 -242 b 148 -140 16 -177 73 -140 b 209 -148 167 -140 189 -142 b 215 -149 212 -148 215 -149 b 215 -149 215 -149 215 -149 l 215 -149 b 201 -136 215 -148 209 -142 l 157 -97 l 96 -41 b 17 34 21 24 17 29 b 17 37 17 36 17 36 b 17 38 17 37 17 38 b 25 56 17 44 17 44 b 110 298 81 131 110 219 b 46 474 110 367 88 431 b 38 491 40 480 38 487 b 49 505 38 498 42 502 "},v7d:{x_min:-1.359375,x_max:436.921875,ha:446,o:"m 213 205 b 217 205 215 205 216 205 b 234 194 224 205 234 199 b 236 187 234 194 235 190 l 245 167 l 261 129 l 270 106 b 355 -61 294 54 329 -13 b 420 -163 381 -105 402 -138 b 436 -188 435 -184 436 -184 b 436 -191 436 -190 436 -190 b 421 -206 436 -201 431 -206 l 421 -206 l 416 -206 l 405 -201 b 217 -158 347 -172 283 -158 b 31 -201 153 -158 88 -172 l 20 -206 l 14 -206 l 14 -206 b 0 -191 5 -206 0 -201 b -1 -188 0 -190 -1 -190 b 14 -163 -1 -186 0 -184 b 95 -34 36 -136 72 -77 b 166 106 119 8 148 68 l 175 129 l 183 148 l 200 188 b 213 205 205 199 208 202 "},v7f:{x_min:0,x_max:367.5,ha:375,o:"m 0 124 l 0 187 l 61 187 l 122 187 l 122 138 l 122 91 l 153 61 l 183 30 l 213 61 l 243 91 l 243 138 l 243 187 l 306 187 l 367 187 l 367 124 l 367 61 l 321 61 l 274 61 l 243 30 l 213 0 l 243 -31 l 274 -62 l 321 -62 l 367 -62 l 367 -124 l 367 -188 l 306 -188 l 243 -188 l 243 -140 l 243 -93 l 213 -62 l 183 -31 l 153 -62 l 122 -93 l 122 -140 l 122 -188 l 61 -188 l 0 -188 l 0 -124 l 0 -62 l 46 -62 l 92 -62 l 123 -31 l 153 0 l 123 30 l 92 61 l 46 61 l 0 61 l 0 124 "},v80:{x_min:29.9375,x_max:420.578125,ha:371,o:"m 115 345 b 221 347 117 345 166 347 b 411 345 306 347 409 345 b 420 330 416 342 420 335 b 415 319 420 326 419 321 b 178 118 397 303 179 118 b 178 117 178 118 178 117 b 181 117 178 117 178 117 b 189 117 182 117 185 117 b 193 117 190 117 191 117 b 247 98 215 117 232 111 b 296 75 266 83 280 76 b 302 75 299 75 300 75 b 322 91 311 75 315 79 b 322 91 322 91 322 91 b 322 91 322 91 322 91 b 319 91 322 91 321 91 b 313 90 318 90 315 90 b 283 107 300 90 288 97 b 277 126 279 114 277 121 b 319 167 277 149 295 167 b 319 167 319 167 319 167 b 362 118 347 167 362 147 b 355 82 362 108 359 96 b 311 33 349 65 340 55 b 224 1 284 12 253 1 b 194 5 213 1 204 2 b 168 18 183 8 178 11 b 110 36 151 30 130 36 b 57 15 88 36 68 29 b 47 11 54 12 51 11 b 31 20 40 11 34 13 b 29 26 31 22 29 25 b 68 66 29 36 39 45 b 285 250 73 71 281 248 b 285 250 285 250 285 250 b 231 252 285 252 261 252 b 137 250 190 252 141 250 b 93 227 122 248 110 241 b 78 220 88 222 83 220 b 66 227 74 220 70 222 b 63 234 65 229 63 231 b 85 291 63 241 69 252 b 115 345 108 342 108 344 "},v81:{x_min:0,x_max:428.75,ha:438,o:"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 m 366 131 b 352 134 362 133 357 134 b 219 81 321 134 269 115 b 47 -111 126 23 50 -62 b 47 -112 47 -111 47 -112 b 77 -136 47 -129 58 -136 b 264 -45 118 -136 194 -101 b 382 109 336 12 382 76 b 366 131 382 120 377 129 "},v83:{x_min:-1.359375,x_max:847.96875,ha:865,o:"m 488 1499 b 495 1500 490 1500 492 1500 b 541 1465 507 1500 521 1490 b 679 1078 622 1372 679 1210 b 677 1050 679 1068 677 1060 b 477 642 668 893 604 764 l 443 609 l 431 596 l 431 592 l 438 562 l 449 508 l 460 458 b 481 355 475 390 481 355 b 481 355 481 355 481 355 b 490 356 481 355 485 355 b 528 358 495 356 511 358 b 558 356 540 358 552 356 b 839 95 699 338 808 237 b 847 22 845 72 847 47 b 631 -303 847 -113 766 -242 b 620 -309 623 -308 620 -309 l 620 -310 b 631 -359 620 -310 626 -333 l 646 -435 l 660 -496 b 672 -588 668 -535 672 -563 b 664 -653 672 -610 669 -630 b 383 -875 630 -792 509 -875 b 201 -810 321 -875 257 -855 b 129 -680 151 -768 129 -730 b 274 -530 129 -592 200 -530 b 351 -553 300 -530 326 -538 b 412 -669 393 -582 412 -626 b 287 -805 412 -735 366 -800 l 279 -805 l 285 -809 b 383 -830 318 -823 351 -830 b 586 -718 464 -830 540 -789 b 626 -584 612 -678 626 -631 b 619 -528 626 -566 623 -548 b 612 -495 619 -526 616 -510 b 577 -324 590 -387 577 -324 b 577 -324 577 -324 577 -324 b 568 -326 575 -324 571 -324 b 528 -334 558 -328 537 -333 b 465 -338 506 -337 485 -338 b 24 -11 269 -338 87 -206 b -1 145 8 41 -1 93 b 96 442 -1 249 32 351 b 322 714 166 541 236 626 l 352 745 l 345 782 l 332 843 l 315 921 b 303 984 310 950 304 978 b 295 1082 298 1017 295 1049 b 413 1426 295 1208 336 1329 b 488 1499 436 1456 477 1496 m 549 1301 b 541 1301 547 1301 544 1301 b 411 1207 500 1301 447 1263 b 355 1004 374 1152 355 1079 b 359 942 355 984 356 963 b 371 881 362 927 363 917 l 385 818 b 392 782 389 799 392 784 l 392 782 b 434 828 393 782 424 816 b 607 1165 534 941 594 1060 b 608 1193 608 1175 608 1183 b 597 1270 608 1224 604 1254 b 549 1301 589 1286 571 1299 m 398 528 b 393 555 396 542 393 553 b 392 555 393 555 393 555 b 317 470 390 555 347 505 b 190 298 266 408 212 334 b 127 70 148 227 127 148 b 155 -77 127 19 137 -30 b 468 -303 209 -216 333 -303 b 519 -299 484 -303 502 -302 b 568 -284 541 -295 568 -287 l 568 -284 b 563 -263 568 -284 566 -274 l 534 -120 l 511 -13 l 496 61 l 480 133 b 469 187 472 176 469 187 b 468 188 469 187 469 188 b 416 162 462 188 430 172 b 337 13 364 126 337 69 b 413 -124 337 -40 363 -93 b 428 -144 424 -131 428 -137 b 428 -149 428 -145 428 -148 b 409 -166 426 -161 419 -166 b 394 -162 405 -166 400 -165 b 240 77 302 -122 240 -27 l 240 77 b 430 342 240 197 315 301 l 436 344 l 426 394 l 398 528 m 548 194 b 526 195 540 195 532 195 b 519 195 524 195 521 195 l 514 195 l 518 177 l 539 79 l 552 15 l 566 -48 l 594 -187 l 605 -240 b 612 -266 609 -254 611 -266 b 612 -266 612 -266 612 -266 b 641 -248 613 -266 630 -256 b 744 -98 692 -212 730 -156 b 751 -40 749 -79 751 -59 b 548 194 751 76 665 181 "},v84:{x_min:25.859375,x_max:164.6875,ha:168,o:"m 34 369 b 40 370 35 370 38 370 b 59 353 49 370 50 367 b 164 40 122 254 155 158 b 164 0 164 33 164 16 b 164 -40 164 -16 164 -34 b 59 -353 155 -158 122 -254 b 40 -371 53 -366 47 -371 b 34 -370 38 -371 36 -370 b 25 -358 28 -367 25 -363 b 31 -337 25 -352 27 -347 b 92 0 72 -234 92 -117 b 31 335 92 116 72 233 b 25 356 27 345 25 352 b 34 369 25 363 28 366 "},v86:{x_min:-571.671875,x_max:570.3125,ha:582,o:"m -386 173 b -381 174 -385 174 -383 174 b -370 173 -377 174 -372 173 b -281 86 -367 172 -347 151 b -196 0 -235 37 -196 0 b -126 84 -196 0 -164 37 b -50 174 -55 173 -57 172 b -44 174 -49 174 -47 174 b -35 173 -42 174 -38 173 b 53 86 -32 172 -12 151 b 138 0 100 37 138 0 b 208 84 140 0 170 37 b 284 174 279 173 277 172 b 289 174 285 174 288 174 b 299 173 294 174 298 173 b 462 11 303 172 338 134 l 475 -1 l 503 34 b 541 76 534 72 536 74 b 548 77 544 77 545 77 b 570 56 560 77 570 68 b 567 48 570 54 568 51 b 392 -172 564 41 397 -166 b 378 -176 387 -174 382 -176 b 368 -174 374 -176 371 -176 b 280 -87 367 -173 345 -152 b 194 0 234 -38 194 0 b 125 -86 194 0 163 -38 b 49 -174 54 -174 55 -173 b 43 -176 47 -176 46 -176 b 34 -174 40 -176 36 -174 b -54 -87 31 -173 10 -152 b -140 0 -102 -38 -140 0 b -209 -86 -141 0 -171 -38 b -285 -174 -280 -174 -279 -173 b -291 -176 -287 -176 -289 -176 b -300 -174 -295 -176 -299 -174 b -464 -12 -304 -173 -340 -137 l -476 0 l -504 -34 b -543 -77 -534 -73 -537 -76 b -549 -79 -545 -79 -547 -79 b -571 -58 -562 -79 -571 -69 b -568 -49 -571 -55 -570 -52 b -392 172 -566 -43 -396 167 b -386 173 -390 172 -387 173 "},v8a:{x_min:-170.140625,x_max:168.78125,ha:172,o:"m -160 567 b -122 567 -159 567 -149 567 l -87 567 l -84 566 b -74 553 -78 563 -77 560 b -20 366 -73 551 -49 466 b 31 186 8 267 31 186 b 85 371 31 186 55 269 b 140 559 114 473 138 557 b 153 567 141 564 148 567 b 168 559 159 567 166 564 b 168 555 168 557 168 557 b 92 281 168 548 159 513 b 14 13 50 134 14 13 b 0 0 14 6 6 0 b -17 15 -8 0 -17 8 b -93 283 -17 15 -51 136 b -170 552 -166 533 -170 548 b -170 553 -170 552 -170 552 b -160 567 -170 560 -167 564 "},v8b:{x_min:0,x_max:319.859375,ha:326,o:"m 149 508 b 159 509 152 509 155 509 b 186 494 170 509 181 503 b 190 440 190 487 190 488 l 190 430 l 190 377 l 242 377 l 251 377 b 303 373 298 377 296 377 b 319 345 314 367 319 356 b 304 319 319 335 314 324 b 250 315 296 315 299 315 l 242 315 l 190 315 l 190 262 l 190 252 b 186 198 190 204 190 205 b 159 183 179 188 170 183 b 132 198 148 183 138 188 b 127 252 127 205 127 204 l 127 262 l 127 315 l 76 315 l 68 315 b 14 319 20 315 21 315 b 0 347 4 324 0 335 b 14 373 0 356 4 367 b 68 377 21 377 20 377 l 76 377 l 127 377 l 127 430 l 127 440 b 132 494 127 488 127 487 b 149 508 136 501 142 505 "},v8c:{x_min:-330.75,x_max:329.390625,ha:336,o:"m -133 483 b -117 484 -127 484 -122 484 b 31 373 -51 484 9 440 b 35 348 34 365 35 356 b -25 285 35 313 10 285 b -87 331 -55 285 -76 302 b -167 402 -100 376 -133 402 b -191 398 -175 402 -183 401 b -227 341 -215 388 -227 369 b -225 320 -227 334 -227 327 b -13 74 -209 230 -125 133 b 6 65 -4 70 5 66 l 9 63 l 10 65 b 117 231 12 68 40 112 l 189 341 l 242 424 b 268 460 262 456 264 458 b 283 464 273 463 277 464 b 308 438 296 464 308 453 l 308 437 b 287 396 308 430 308 428 l 95 98 l 59 43 l 58 41 l 65 37 b 253 -156 151 -8 217 -77 b 281 -285 272 -199 281 -244 b 148 -481 281 -381 231 -463 b 115 -485 137 -484 126 -485 b -32 -376 51 -485 -9 -442 b -36 -349 -35 -366 -36 -358 b 25 -287 -36 -315 -12 -287 b 85 -333 54 -287 74 -302 b 166 -403 99 -377 133 -403 b 190 -399 174 -403 182 -402 b 225 -342 215 -390 225 -370 b 224 -322 225 -335 225 -328 b 12 -76 208 -231 125 -134 b -8 -66 2 -72 -6 -68 l -10 -65 l -12 -66 b -118 -231 -13 -68 -42 -113 l -190 -342 l -243 -426 b -269 -462 -264 -458 -265 -458 b -284 -466 -274 -464 -279 -466 b -310 -440 -298 -466 -310 -455 l -310 -438 b -288 -398 -310 -430 -308 -430 l -96 -99 l -59 -44 l -59 -43 l -66 -38 b -281 284 -198 33 -281 158 l -281 284 b -133 483 -281 392 -220 474 m 254 177 b 266 179 258 177 262 179 b 319 149 287 179 307 167 b 329 115 326 140 329 127 b 319 79 329 102 326 90 b 268 51 307 61 287 51 b 221 72 250 51 234 58 b 205 115 210 84 205 99 b 254 177 205 142 223 170 m -281 -54 b -269 -52 -277 -52 -273 -52 b -223 -73 -253 -52 -235 -59 b -206 -116 -212 -84 -206 -101 b -216 -151 -206 -129 -209 -141 b -269 -179 -228 -170 -249 -179 b -314 -159 -285 -179 -302 -173 b -330 -116 -325 -147 -330 -131 b -281 -54 -330 -88 -313 -61 "},v8d:{x_min:-1.359375,x_max:255.890625,ha:261,o:"m 118 514 b 127 517 121 517 122 517 b 147 505 136 517 142 513 l 148 502 l 148 403 b 148 306 148 351 148 306 b 174 315 149 306 160 310 l 200 324 l 205 323 b 223 312 213 323 220 319 l 225 308 l 225 260 b 225 245 225 255 225 249 b 220 204 225 208 224 209 b 179 188 216 199 215 199 l 148 177 l 148 124 l 148 70 l 189 84 b 236 98 219 94 230 98 b 247 94 240 98 243 97 b 255 52 254 88 255 87 b 255 33 255 47 255 40 l 254 -12 l 253 -15 b 249 -22 253 -18 250 -20 l 245 -24 l 196 -41 l 148 -58 l 148 -108 b 148 -158 148 -136 148 -158 b 174 -148 148 -158 160 -154 b 204 -140 198 -140 200 -140 l 204 -140 b 224 -152 213 -140 221 -145 b 225 -201 224 -155 225 -177 b 224 -254 225 -226 224 -251 b 157 -284 220 -262 220 -262 l 148 -288 l 148 -395 l 148 -503 l 147 -506 b 127 -519 142 -514 134 -519 b 107 -506 119 -519 111 -514 l 106 -503 l 106 -403 b 106 -303 106 -316 106 -303 b 104 -303 104 -303 104 -303 b 88 -310 104 -303 96 -306 l 63 -319 b 51 -322 59 -320 55 -322 b 36 -315 46 -322 40 -319 b 31 -273 32 -309 31 -312 b 31 -258 31 -269 31 -263 l 31 -210 l 34 -206 b 40 -198 35 -204 38 -199 b 74 -186 42 -197 57 -191 l 106 -173 l 106 -123 b 106 -97 106 -112 106 -104 b 106 -72 106 -76 106 -72 b 104 -72 106 -72 106 -72 b 20 -99 89 -79 23 -99 b 0 -84 10 -99 2 -93 b -1 -37 0 -81 -1 -59 b 0 11 -1 -15 0 9 b 58 40 4 22 2 22 l 106 56 l 106 109 b 106 123 106 115 106 119 b 106 162 106 147 106 162 b 81 155 106 162 93 159 b 50 147 65 149 55 147 b 36 152 43 147 40 148 b 31 194 32 158 31 156 b 31 209 31 198 31 204 l 31 256 l 34 260 b 76 281 38 269 38 269 l 106 292 l 106 396 l 106 502 l 107 505 b 118 514 110 509 114 513 "},v8f:{x_min:-21.78125,x_max:362.0625,ha:369,o:"m 302 1031 b 308 1032 304 1032 307 1032 b 330 1016 318 1032 325 1027 b 362 867 351 970 362 920 b 340 738 362 824 353 780 l 336 727 l 340 717 b 362 591 355 677 362 634 b 257 323 362 496 325 401 b 204 272 243 306 227 290 b 20 56 129 206 66 133 b -1 18 12 44 0 22 b -19 4 -4 9 -12 4 l -21 4 l -21 140 l -21 276 l -12 277 b 167 333 61 288 127 309 b 319 598 262 388 319 491 b 311 664 319 620 317 642 l 310 673 l 304 664 b 204 548 279 620 250 587 b 20 333 129 483 66 409 b -1 292 12 320 0 298 b -19 280 -4 285 -12 280 l -21 280 l -21 416 l -21 552 l -12 553 b 167 609 61 564 127 585 b 319 874 264 666 319 770 b 294 992 319 914 311 954 b 288 1011 288 1004 288 1007 b 302 1031 288 1021 294 1028 "},v90:{x_min:-171.5,x_max:483.1875,ha:493,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 495 20 616 20 616 b 20 373 20 427 20 373 b 115 410 20 373 63 390 l 210 448 l 210 531 b 212 620 210 614 210 616 b 231 632 215 628 223 632 b 246 627 236 632 242 631 b 251 541 251 620 251 628 l 251 463 l 315 489 b 387 514 368 509 381 514 b 393 513 390 514 392 514 b 406 494 402 510 406 502 b 397 476 406 487 404 480 b 323 446 396 474 363 462 l 251 417 l 251 283 l 251 148 l 254 151 b 370 199 291 183 332 199 b 415 191 385 199 400 197 b 483 84 458 176 483 134 b 461 0 483 58 476 29 b 332 -142 439 -40 411 -72 l 255 -215 b 231 -229 240 -229 239 -229 b 216 -223 224 -229 220 -227 b 210 -158 210 -217 210 -223 b 210 -120 210 -148 210 -136 l 210 -29 l 205 -34 b 100 -142 182 -65 159 -88 l 23 -215 b -1 -229 9 -229 6 -229 b -19 -217 -9 -229 -16 -224 l -20 -215 l -21 48 l -21 310 l -83 287 b -152 262 -133 266 -145 262 b -157 263 -153 262 -155 262 b -171 283 -166 266 -171 274 b -161 301 -171 290 -167 297 b -91 328 -160 302 -129 315 l -21 356 l -21 487 l -20 617 l -19 621 b -8 631 -17 626 -12 630 m 210 288 b 210 401 210 351 210 401 b 114 365 209 401 167 384 l 20 327 l 20 238 l 20 148 l 21 151 b 140 199 59 183 102 199 b 206 180 164 199 187 192 l 209 177 b 209 177 209 177 209 177 b 210 288 210 177 210 199 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 m 341 131 b 328 133 337 133 332 133 b 322 133 326 133 323 133 b 257 87 296 129 273 113 l 251 80 l 251 -37 l 251 -156 l 255 -152 b 375 81 328 -72 375 20 l 375 83 b 341 131 375 113 367 126 "},v92:{x_min:0,x_max:598.890625,ha:611,o:"m 62 181 b 77 183 66 183 72 183 b 91 181 83 183 88 183 b 202 131 100 180 106 177 l 299 87 l 394 131 b 517 183 499 181 502 183 b 519 183 517 183 518 183 b 598 104 567 183 598 144 b 577 49 598 84 592 65 b 518 15 567 38 563 37 b 484 0 499 6 484 0 b 518 -16 484 -1 499 -8 b 577 -51 563 -38 567 -40 b 598 -105 592 -66 598 -86 b 519 -184 598 -145 567 -184 b 517 -184 518 -184 517 -184 b 394 -133 502 -184 499 -183 l 299 -88 l 202 -133 b 81 -184 99 -183 95 -184 b 77 -184 80 -184 78 -184 b 0 -105 29 -184 0 -145 b 20 -51 0 -86 5 -66 b 80 -16 29 -40 34 -38 b 114 -1 98 -8 114 -1 b 80 15 114 0 98 6 b 20 49 34 37 29 38 b 0 104 6 65 0 84 b 62 181 0 140 23 174 m 88 134 b 74 136 85 134 80 136 b 68 134 72 136 69 136 b 46 104 54 130 46 117 b 55 81 46 95 49 88 b 149 34 59 76 53 80 b 224 -1 190 15 224 0 b 144 -38 224 -1 187 -18 b 54 -84 59 -79 58 -79 b 46 -105 49 -90 46 -98 b 76 -137 46 -122 58 -137 b 78 -137 77 -137 77 -137 b 194 -86 87 -137 76 -141 b 298 -36 250 -58 298 -36 b 298 -36 298 -36 298 -36 b 402 -84 299 -36 345 -58 b 518 -137 522 -141 510 -137 b 521 -137 519 -137 519 -137 b 551 -105 539 -137 551 -122 b 541 -83 551 -98 548 -90 b 447 -36 537 -77 544 -81 b 374 -1 406 -16 374 -1 b 447 34 374 0 406 15 b 541 81 544 80 537 76 b 551 104 548 88 551 97 b 521 136 551 120 539 136 b 518 136 519 136 519 136 b 517 136 518 136 517 136 l 517 136 b 402 83 511 136 511 136 b 298 34 345 56 299 34 b 298 34 298 34 298 34 b 194 84 298 34 250 56 b 88 134 137 111 89 133 "},v93:{x_min:0,x_max:438.28125,ha:447,o:"m 212 205 b 219 205 213 205 216 205 b 239 183 228 205 231 204 b 421 -163 298 40 363 -83 b 438 -191 434 -180 438 -186 b 436 -197 438 -192 438 -195 b 424 -206 434 -204 431 -206 b 406 -201 420 -206 415 -205 b 216 -156 347 -172 281 -156 b 23 -205 148 -156 80 -173 b 14 -206 20 -206 17 -206 b 0 -191 6 -206 0 -201 b 6 -176 0 -187 1 -183 b 202 192 63 -104 142 45 b 212 205 205 199 208 202 m 264 48 l 249 81 l 243 94 l 242 91 b 89 -126 208 36 137 -66 b 81 -138 85 -133 81 -138 b 81 -138 81 -138 81 -138 b 81 -138 81 -138 81 -138 b 95 -133 81 -138 87 -136 b 280 -94 156 -108 221 -94 b 334 -98 299 -94 317 -95 b 343 -99 338 -99 343 -99 b 343 -99 343 -99 343 -99 b 338 -94 343 -99 341 -97 b 264 48 318 -58 287 1 "},v94:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -9 215 b 0 217 -6 217 -4 217 b 19 205 8 217 14 213 b 20 142 20 202 20 201 l 20 84 l 23 84 b 144 -27 81 74 129 30 b 148 -66 147 -40 148 -54 b 36 -213 148 -134 103 -197 b 0 -219 24 -217 12 -219 b -145 -104 -68 -219 -129 -173 b -149 -68 -148 -91 -149 -79 b -24 84 -149 6 -98 74 l -21 84 l -21 142 b -19 205 -20 201 -20 202 b -9 215 -17 209 -13 213 m -21 -15 b -23 41 -21 37 -21 41 b -23 41 -23 41 -23 41 b -76 11 -35 40 -62 26 b -108 -65 -98 -11 -108 -38 b -1 -176 -108 -122 -65 -176 b 107 -65 63 -176 107 -122 b 74 11 107 -38 96 -11 b 20 41 61 26 32 41 b 20 -15 20 41 20 15 b 19 -74 20 -72 20 -72 b 0 -87 14 -83 6 -87 b -19 -74 -8 -87 -16 -83 b -21 -15 -20 -72 -20 -72 "},v95:{x_min:0,x_max:406.96875,ha:415,o:"m 55 181 b 70 183 61 183 66 183 b 111 170 85 183 99 179 b 160 130 115 167 137 149 l 202 95 l 245 130 b 319 181 299 176 302 179 b 334 183 325 183 330 183 b 406 109 375 183 406 148 b 401 81 406 99 405 91 b 348 24 394 65 390 59 b 318 -1 332 11 318 0 b 348 -26 318 -1 332 -12 b 401 -83 390 -61 394 -66 b 406 -111 405 -93 406 -101 b 334 -184 406 -149 375 -184 b 319 -183 330 -184 325 -184 b 245 -131 302 -180 299 -177 l 202 -97 l 160 -131 b 85 -183 107 -177 103 -180 b 70 -184 80 -184 76 -184 b 0 -111 31 -184 0 -149 b 4 -83 0 -101 1 -93 b 58 -26 10 -66 16 -61 b 88 -1 74 -12 88 -1 b 58 24 88 0 74 11 b 10 69 23 54 17 59 b 0 109 2 81 0 95 b 55 181 0 142 21 173 m 83 133 b 72 136 78 136 76 136 b 57 131 66 136 61 134 b 46 109 49 126 46 117 b 50 93 46 104 47 98 b 107 45 51 91 77 70 b 160 0 137 20 160 0 b 107 -47 160 -1 137 -22 b 50 -94 77 -72 51 -93 b 46 -111 47 -99 46 -105 b 59 -134 46 -120 50 -130 b 72 -137 62 -136 68 -137 b 83 -136 76 -137 80 -136 b 144 -84 84 -134 107 -116 b 202 -36 176 -58 202 -36 b 261 -84 202 -36 230 -58 b 323 -136 299 -116 321 -134 b 334 -137 326 -136 330 -137 b 345 -134 338 -137 343 -136 b 360 -111 355 -130 360 -120 b 355 -94 360 -105 359 -99 b 299 -47 353 -93 329 -72 b 245 0 269 -22 245 -1 b 299 45 245 0 269 20 b 355 93 329 70 353 91 b 360 109 359 98 360 104 b 345 133 360 119 355 129 b 334 136 343 134 338 136 b 323 134 330 136 326 134 b 261 83 321 133 299 115 b 202 34 230 56 202 34 b 144 83 202 34 176 56 b 83 133 106 115 84 133 "},v97:{x_min:-228.671875,x_max:227.3125,ha:232,o:"m -217 487 l -213 488 l 0 488 l 212 488 l 216 487 b 225 476 220 484 224 480 l 227 473 l 227 244 l 227 15 l 225 12 b 206 0 223 4 215 0 b 197 1 204 0 200 0 b 187 12 193 4 189 6 l 186 15 l 186 138 l 186 262 l -1 262 l -187 262 l -187 138 l -187 15 l -189 12 b -208 0 -193 4 -200 0 b -227 12 -216 0 -223 4 l -228 15 l -228 244 l -228 473 l -227 476 b -217 487 -225 480 -221 484 "},v9a:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 230 1031 b 238 1032 232 1032 235 1032 b 259 1014 245 1032 251 1027 b 367 662 330 906 367 782 b 364 602 367 641 367 621 b 232 317 352 488 304 384 b 57 120 155 245 103 187 b -1 18 31 84 6 40 b -19 4 -4 11 -12 4 l -21 4 l -21 159 l -21 315 l -16 315 b 96 335 10 315 62 324 b 315 695 227 380 315 527 b 313 738 315 709 314 724 b 224 991 304 825 273 916 b 216 1013 219 999 216 1007 b 230 1031 216 1021 220 1028 "},v9b:{x_min:-24.5,x_max:313.0625,ha:319,o:"m -24 -133 l -24 -5 l -20 -5 b -1 -19 -12 -5 -4 -11 b 142 -213 13 -61 74 -144 b 258 -376 196 -269 230 -315 b 313 -605 295 -449 313 -528 b 292 -742 313 -652 306 -699 b 288 -752 289 -748 288 -752 b 288 -752 288 -752 288 -752 b 292 -764 289 -753 291 -757 b 313 -907 306 -811 313 -860 b 292 -1045 313 -954 306 -1002 b 288 -1054 289 -1050 288 -1054 b 288 -1054 288 -1054 288 -1054 b 292 -1067 289 -1054 291 -1060 b 313 -1210 306 -1113 313 -1161 b 292 -1346 313 -1257 306 -1304 b 288 -1357 289 -1353 288 -1357 b 288 -1357 288 -1357 288 -1357 b 292 -1368 289 -1357 291 -1363 b 313 -1512 306 -1415 313 -1464 b 292 -1648 313 -1560 306 -1605 b 288 -1660 289 -1654 288 -1660 b 288 -1660 288 -1660 288 -1660 b 292 -1671 289 -1660 291 -1665 b 313 -1814 306 -1719 313 -1766 b 250 -2040 313 -1897 291 -1977 b 232 -2062 238 -2057 236 -2059 b 221 -2065 230 -2063 225 -2065 b 200 -2045 210 -2065 201 -2057 b 200 -2043 200 -2044 200 -2044 b 208 -2026 200 -2037 202 -2034 b 269 -1826 249 -1966 269 -1897 b 153 -1544 269 -1726 230 -1625 b -9 -1472 115 -1506 58 -1481 b -21 -1471 -14 -1471 -19 -1471 l -24 -1471 l -24 -1343 l -24 -1215 l -20 -1215 b -1 -1229 -12 -1215 -4 -1221 b 142 -1424 13 -1270 74 -1353 b 257 -1582 196 -1478 228 -1524 b 264 -1594 261 -1589 264 -1594 l 264 -1594 b 265 -1582 264 -1594 264 -1589 b 270 -1525 268 -1562 270 -1544 b 153 -1243 270 -1424 228 -1321 b -9 -1170 115 -1203 58 -1178 b -21 -1168 -14 -1170 -19 -1168 l -24 -1168 l -24 -1041 l -24 -913 l -20 -913 b -1 -927 -12 -913 -4 -918 b 142 -1121 13 -967 74 -1050 b 257 -1281 196 -1175 228 -1221 b 264 -1292 261 -1286 264 -1292 l 264 -1292 b 265 -1279 264 -1292 264 -1286 b 270 -1222 268 -1261 270 -1242 b 153 -941 270 -1121 228 -1018 b -9 -867 115 -900 58 -875 b -21 -866 -14 -867 -19 -866 l -24 -866 l -24 -738 l -24 -610 l -20 -610 b -1 -624 -12 -610 -4 -616 b 142 -818 13 -664 74 -749 b 257 -978 196 -873 228 -918 b 264 -989 261 -984 264 -989 l 264 -989 b 265 -977 264 -989 264 -984 b 270 -920 268 -959 270 -939 b 153 -638 270 -818 228 -716 b -9 -564 115 -598 58 -573 b -21 -563 -14 -564 -19 -563 l -24 -563 l -24 -435 l -24 -308 l -20 -308 b -1 -322 -12 -308 -4 -313 b 142 -516 13 -363 74 -446 b 257 -675 196 -571 228 -616 b 264 -687 261 -681 264 -687 l 264 -687 b 265 -674 264 -687 264 -681 b 270 -617 268 -656 270 -637 b 153 -335 270 -516 228 -413 b -9 -262 115 -295 58 -270 b -21 -260 -14 -262 -19 -260 l -24 -260 l -24 -133 "},v9c:{x_min:-166.0625,x_max:-25.859375,ha:0,o:"m -49 369 b -42 370 -46 369 -44 370 b -27 360 -36 370 -29 366 b -25 355 -27 359 -25 358 b -32 335 -25 351 -28 347 b -92 52 -66 248 -87 159 b -93 -1 -93 43 -93 20 b -92 -54 -93 -23 -93 -45 b -32 -337 -85 -162 -66 -251 b -25 -355 -27 -349 -25 -352 b -42 -371 -25 -365 -32 -371 b -61 -353 -50 -371 -51 -369 b -163 -63 -119 -262 -153 -165 b -166 -1 -166 -37 -166 -31 b -163 62 -166 30 -166 36 b -61 352 -153 163 -119 260 b -49 369 -54 365 -51 366 "},v9e:{x_min:0,x_max:607.0625,ha:619,o:"m 243 631 b 250 632 246 632 249 632 b 270 620 259 632 268 628 l 272 616 l 272 201 l 272 -212 l 270 -216 b 251 -229 268 -224 259 -229 b 227 -215 243 -229 240 -229 l 151 -142 b 32 -16 81 -80 53 -49 b 0 84 9 18 0 52 b 111 199 0 149 42 199 b 137 197 119 199 127 198 b 228 151 168 191 197 177 l 231 148 l 231 383 b 232 620 231 616 231 616 b 243 631 234 624 238 630 m 168 131 b 152 133 163 133 157 133 b 107 102 130 133 111 120 b 106 86 107 97 106 91 b 111 41 106 73 108 56 b 227 -152 125 -13 171 -90 l 231 -156 l 231 -37 l 231 80 l 225 87 b 168 131 210 111 190 126 m 347 631 b 353 632 348 632 351 632 b 374 620 363 632 371 628 b 375 383 375 616 375 616 l 375 148 l 377 151 b 492 199 415 183 454 199 b 537 191 507 199 522 197 b 607 84 582 176 607 134 b 583 0 607 58 598 29 b 455 -142 562 -40 533 -72 l 378 -215 b 355 -229 364 -229 362 -229 b 334 -216 345 -229 337 -224 l 333 -212 l 333 201 l 333 616 l 334 620 b 347 631 337 624 341 630 m 465 131 b 451 133 461 133 455 133 b 445 133 449 133 446 133 b 379 87 419 129 396 113 l 375 80 l 375 -37 l 375 -156 l 378 -152 b 499 81 451 -72 499 20 l 499 83 b 465 131 499 113 490 126 "},va3:{x_min:58.53125,x_max:228.671875,ha:294,o:"m 138 371 b 142 373 140 371 141 373 b 178 342 149 373 156 366 b 228 251 217 297 228 278 b 228 244 228 248 228 247 b 176 147 227 212 212 184 b 123 73 152 122 132 93 b 121 62 122 70 121 66 b 145 13 121 48 129 31 b 153 -2 151 6 153 1 b 149 -9 153 -5 152 -6 b 144 -11 148 -11 145 -11 b 129 -1 140 -11 136 -8 b 61 87 89 37 68 68 b 58 113 59 95 58 105 b 110 215 58 144 74 177 b 163 287 134 240 155 269 b 166 299 166 291 166 295 b 141 348 166 313 157 330 b 133 360 134 356 133 358 b 133 363 133 362 133 362 b 138 371 133 367 136 370 "},va5:{x_min:0,x_max:349.8125,ha:357,o:"m 88 302 b 103 303 93 302 98 303 b 202 224 149 303 191 270 b 205 199 204 216 205 208 b 178 129 205 173 196 147 l 175 126 l 182 127 b 307 249 236 142 284 190 b 313 259 308 254 311 258 b 329 267 317 265 323 267 b 349 247 340 267 349 259 b 201 -263 349 242 204 -258 b 182 -273 197 -270 190 -273 b 163 -260 174 -273 166 -269 b 161 -256 161 -259 161 -258 b 217 -59 161 -248 170 -220 b 272 129 247 43 272 127 b 272 129 272 129 272 129 b 264 122 272 129 268 126 b 140 80 227 94 183 80 b 36 115 102 80 65 91 b 0 194 10 136 0 165 b 88 302 0 244 32 292 "},va9:{x_min:-24.5,x_max:314.421875,ha:321,o:"m -24 -145 l -24 -5 l -20 -5 b 0 -23 -9 -5 -2 -12 b 27 -87 4 -38 14 -66 b 138 -220 53 -136 88 -177 b 235 -328 179 -255 208 -288 b 314 -592 287 -409 314 -501 b 292 -732 314 -639 307 -687 l 289 -742 l 294 -756 b 314 -896 307 -802 314 -849 b 292 -1035 314 -943 307 -991 l 289 -1045 l 294 -1057 b 314 -1197 307 -1104 314 -1152 b 292 -1338 314 -1246 307 -1292 l 289 -1347 l 294 -1360 b 314 -1500 307 -1407 314 -1454 b 273 -1689 314 -1565 300 -1628 b 250 -1712 265 -1710 261 -1712 b 228 -1691 236 -1712 228 -1704 l 228 -1685 l 234 -1675 b 270 -1507 258 -1621 270 -1564 b 98 -1193 270 -1381 209 -1261 b 40 -1174 76 -1179 58 -1174 b -10 -1189 24 -1174 8 -1178 b -20 -1192 -14 -1192 -16 -1192 l -24 -1192 l -24 -1052 l -24 -913 l -20 -913 b 0 -931 -9 -913 -2 -920 b 27 -995 4 -946 14 -974 b 138 -1128 53 -1043 88 -1085 b 257 -1275 190 -1172 228 -1220 b 262 -1283 259 -1279 262 -1283 l 262 -1283 b 269 -1249 264 -1282 268 -1260 b 270 -1206 270 -1233 270 -1220 b 98 -891 270 -1075 206 -957 b 40 -871 76 -877 58 -871 b -10 -886 24 -871 8 -875 b -20 -889 -14 -889 -16 -889 l -24 -889 l -24 -749 l -24 -610 l -20 -610 b 0 -628 -9 -610 -2 -617 b 27 -692 4 -644 14 -671 b 138 -825 53 -741 88 -782 b 257 -973 190 -870 228 -917 b 262 -981 259 -977 262 -981 l 262 -981 b 269 -946 264 -979 268 -957 b 270 -903 270 -931 270 -917 b 98 -588 270 -774 206 -655 b 40 -569 76 -574 58 -569 b -10 -584 24 -569 8 -574 b -20 -587 -14 -587 -16 -587 l -24 -587 l -24 -448 l -24 -308 l -20 -308 b 0 -326 -9 -308 -2 -315 b 27 -390 4 -341 14 -369 b 138 -523 53 -438 88 -480 b 257 -670 190 -567 228 -614 b 262 -678 259 -674 262 -678 b 262 -678 262 -678 262 -678 b 269 -644 264 -677 268 -656 b 270 -601 270 -628 270 -614 b 98 -285 270 -471 206 -352 b 40 -266 76 -273 58 -266 b -10 -281 24 -266 8 -272 b -20 -284 -14 -284 -16 -284 l -24 -284 l -24 -145 "},vaa:{x_min:-1.359375,x_max:752.703125,ha:768,o:"m 490 985 b 504 986 495 986 500 986 b 604 907 551 986 593 954 b 607 884 607 900 607 892 b 581 813 607 857 597 831 l 578 810 l 583 811 b 710 932 638 827 687 873 b 714 943 711 936 713 942 b 730 952 720 949 725 952 b 752 931 741 952 752 943 b 200 -946 752 927 204 -941 b 182 -957 197 -953 190 -957 b 163 -945 174 -957 166 -953 b 161 -939 161 -942 161 -942 b 217 -743 161 -931 170 -904 b 272 -555 247 -639 272 -555 b 272 -555 272 -555 272 -555 b 264 -560 272 -555 268 -557 b 140 -603 227 -589 182 -603 b 36 -567 102 -603 65 -592 b -1 -487 12 -548 -1 -517 b 17 -427 -1 -466 5 -445 b 103 -380 38 -395 70 -380 b 191 -433 137 -380 172 -398 b 205 -484 201 -448 205 -466 b 178 -553 205 -509 196 -535 l 175 -557 l 182 -555 b 307 -435 236 -539 284 -494 b 372 -213 308 -430 372 -215 b 372 -213 372 -213 372 -213 b 364 -219 372 -213 368 -216 b 240 -262 328 -247 283 -262 b 137 -226 202 -262 166 -249 b 99 -145 112 -206 99 -176 b 118 -84 99 -124 106 -104 b 204 -38 138 -54 171 -38 b 292 -91 238 -38 273 -56 b 306 -141 302 -106 306 -124 b 279 -212 306 -167 296 -194 l 276 -215 l 281 -213 b 408 -93 336 -198 385 -151 b 473 129 409 -88 473 127 b 473 129 473 129 473 129 b 465 122 473 129 469 126 b 341 80 428 94 383 80 b 236 115 303 80 266 91 b 200 195 213 136 200 165 b 217 256 200 217 206 238 b 304 303 239 287 272 303 b 393 249 338 303 374 285 b 406 199 402 234 406 217 b 379 129 406 173 397 148 l 377 126 l 382 127 b 509 248 436 142 485 190 b 574 470 510 254 574 469 b 574 470 574 470 574 470 b 566 464 574 470 570 467 b 442 421 529 435 484 421 b 337 458 404 421 367 433 b 300 538 314 477 300 508 b 318 598 300 559 306 580 b 404 645 340 630 372 645 b 494 592 439 645 475 627 b 507 541 502 577 507 559 b 480 471 507 516 498 489 l 477 467 l 483 470 b 608 589 537 485 586 531 b 675 811 611 595 675 810 b 675 811 675 811 675 811 b 666 806 675 811 671 809 b 543 763 628 777 585 763 b 438 799 504 763 468 775 b 401 878 412 820 401 849 b 490 985 401 928 434 977 "},vab:{x_min:0,x_max:272.21875,ha:278,o:"m 243 631 b 250 632 246 632 249 632 b 270 620 259 632 268 628 l 272 616 l 272 201 l 272 -212 l 270 -216 b 251 -229 268 -224 259 -229 b 227 -215 243 -229 240 -229 l 151 -142 b 32 -16 81 -80 53 -49 b 0 84 9 18 0 52 b 111 199 0 149 42 199 b 137 197 119 199 127 198 b 228 151 168 191 197 177 l 231 148 l 231 383 b 232 620 231 616 231 616 b 243 631 234 624 238 630 m 168 131 b 152 133 163 133 157 133 b 107 102 130 133 111 120 b 106 86 107 97 106 91 b 111 41 106 73 108 56 b 227 -152 125 -13 171 -90 l 231 -156 l 231 -37 l 231 80 l 225 87 b 168 131 210 111 190 126 "},vad:{x_min:0,x_max:873.828125,ha:892,o:"m 0 0 l 0 703 l 81 703 l 164 703 l 164 0 l 164 -705 l 81 -705 l 0 -705 l 0 0 m 225 0 l 225 703 l 246 703 l 268 703 l 268 366 l 268 30 l 274 36 b 314 79 284 44 302 63 b 413 302 357 137 392 213 b 432 327 419 324 421 327 b 449 306 443 327 447 322 b 611 115 457 195 529 115 b 651 122 624 115 638 117 b 728 316 705 140 724 188 b 729 388 728 342 729 366 b 671 635 729 533 711 602 b 581 662 649 652 616 662 b 477 637 545 662 510 653 l 475 635 l 477 634 b 503 627 488 632 495 631 b 545 556 532 612 545 584 b 491 480 545 524 526 491 b 465 474 481 476 473 474 b 379 563 417 474 379 516 b 389 602 379 576 382 588 b 541 691 409 641 479 681 b 582 694 555 692 568 694 b 865 462 714 694 834 598 b 873 392 871 440 873 416 b 865 317 873 367 871 341 b 639 84 839 194 748 101 b 612 83 630 83 620 83 b 511 116 577 83 543 94 b 504 120 509 119 506 120 b 504 120 504 120 504 120 b 469 59 504 120 488 93 l 432 -1 l 469 -61 b 504 -122 488 -94 504 -122 b 504 -122 504 -122 504 -122 b 511 -117 506 -122 509 -120 b 612 -84 543 -95 577 -84 b 665 -91 630 -84 647 -87 b 869 -338 771 -122 850 -216 b 873 -392 872 -356 873 -374 b 798 -595 873 -469 847 -539 b 581 -695 741 -662 660 -695 b 406 -626 517 -695 454 -671 b 381 -563 389 -607 381 -585 b 465 -477 381 -519 413 -477 b 545 -559 514 -477 545 -519 b 503 -628 545 -587 532 -613 b 477 -635 495 -632 488 -634 l 475 -637 l 477 -638 b 581 -663 510 -655 545 -663 b 671 -637 616 -663 649 -653 b 729 -391 711 -603 729 -534 b 728 -317 729 -367 728 -344 b 623 -117 722 -173 698 -124 b 611 -116 619 -116 615 -116 b 449 -308 528 -116 457 -198 b 432 -328 447 -323 443 -328 b 413 -303 421 -328 419 -326 b 314 -80 392 -215 357 -138 b 274 -37 302 -65 284 -45 l 268 -31 l 268 -367 l 268 -705 l 246 -705 l 225 -705 l 225 0 "},vb1:{x_min:78.9375,x_max:485.921875,ha:417,o:"m 362 378 b 378 380 367 380 372 380 b 472 348 415 380 453 367 b 485 315 481 338 485 327 b 462 273 485 298 477 281 b 439 267 454 269 446 267 b 398 290 424 267 409 274 b 344 319 385 309 364 319 b 281 269 315 319 289 301 b 279 262 280 266 279 262 b 276 256 279 260 277 258 b 274 249 276 254 274 251 b 238 127 273 248 257 192 b 201 4 217 61 201 5 b 166 -1 198 -1 200 -1 b 153 -1 163 -1 157 -1 b 141 -1 148 -1 144 -1 b 104 4 106 -1 107 -1 b 104 6 104 5 104 5 b 142 144 104 13 110 34 b 182 278 164 219 181 276 b 183 288 182 281 182 285 b 185 302 185 292 185 298 b 164 330 185 317 176 328 b 159 330 163 330 161 330 b 102 302 140 330 119 320 b 91 294 95 295 93 294 b 88 294 91 294 89 294 b 78 303 83 294 78 298 b 81 312 78 306 78 309 b 200 373 106 347 160 373 b 215 371 205 373 209 371 b 266 335 235 367 254 353 b 269 331 268 333 269 331 b 269 331 269 331 269 331 b 273 335 269 331 270 334 b 362 378 298 359 330 376 "},vb3:{x_min:0,x_max:227.3125,ha:232,o:"m 91 213 b 100 215 93 215 96 215 b 227 58 167 215 224 144 b 227 52 227 56 227 54 b 61 -201 227 -43 164 -138 b 29 -216 44 -212 36 -216 b 23 -210 27 -216 24 -213 b 21 -205 21 -208 21 -206 b 34 -192 21 -201 25 -197 b 122 -55 89 -161 122 -106 b 104 6 122 -33 117 -12 l 103 9 l 96 9 b 4 79 57 9 17 38 b 0 112 1 90 0 101 b 91 213 0 163 36 209 "},vb4:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -533 324 b -525 327 -530 326 -528 327 b -504 305 -514 327 -504 317 b -504 305 -504 305 -504 305 b -513 284 -504 299 -504 299 b -556 112 -541 226 -556 167 b -545 33 -556 84 -552 58 b -524 -20 -541 15 -532 -9 l -522 -23 l -491 15 l -413 111 b -355 174 -367 169 -363 174 b -351 174 -353 174 -352 174 b -254 86 -343 174 -348 179 b -168 -1 -208 37 -168 -1 b -100 84 -168 -1 -137 37 b -23 173 -28 173 -29 172 b -19 174 -21 174 -20 174 b -8 173 -14 174 -10 173 b 80 86 -5 172 13 151 b 166 -1 127 37 166 -1 b 235 84 166 -1 197 37 b 311 173 306 173 304 172 b 317 174 313 174 314 174 b 326 173 319 174 323 173 b 490 11 329 172 366 134 l 502 -1 l 530 34 b 568 76 560 72 563 74 b 575 77 570 77 573 77 b 596 56 586 77 596 68 b 594 48 596 54 596 51 b 417 -172 592 41 424 -166 b 405 -176 415 -174 409 -176 b 396 -174 401 -176 398 -176 b 307 -87 393 -173 372 -152 b 221 -1 259 -38 221 -1 b 152 -86 221 -1 190 -38 b 76 -176 81 -174 83 -173 b 70 -176 74 -176 73 -176 b 61 -174 66 -176 62 -174 b -27 -87 58 -173 38 -152 b -114 -1 -74 -38 -112 -1 b -182 -86 -114 -1 -145 -38 b -258 -176 -253 -174 -253 -173 b -264 -176 -259 -176 -262 -176 b -274 -174 -268 -176 -272 -174 b -438 -11 -277 -173 -348 -102 l -449 0 l -479 -37 b -524 -80 -513 -80 -514 -80 l -524 -80 b -553 -52 -534 -80 -540 -74 b -597 109 -583 -8 -597 48 b -560 280 -597 165 -585 224 b -533 324 -548 310 -540 322 "},vb6:{x_min:0,x_max:556.6875,ha:568,o:"m 289 545 b 298 546 292 545 295 546 b 318 533 306 546 315 541 b 319 428 319 530 319 528 l 319 327 l 334 327 b 526 223 412 326 485 285 b 543 172 537 206 543 190 b 447 76 543 122 503 76 b 445 76 446 76 446 76 b 359 165 394 77 359 119 b 368 205 359 179 362 192 b 441 251 382 233 412 251 b 455 249 446 251 451 251 b 460 248 458 249 460 248 b 460 248 460 248 460 248 b 454 254 460 249 458 251 b 334 295 419 280 378 294 l 319 295 l 319 4 l 319 -287 l 321 -285 b 328 -285 322 -285 325 -285 b 524 -99 424 -277 507 -198 b 541 -79 526 -84 530 -79 b 556 -97 551 -79 556 -84 b 548 -133 556 -105 553 -117 b 334 -317 521 -233 434 -306 b 322 -319 329 -317 323 -317 l 319 -319 l 319 -424 b 319 -471 319 -444 319 -459 b 313 -541 319 -544 318 -535 b 298 -548 308 -545 303 -548 b 279 -534 289 -548 281 -542 b 277 -424 277 -531 277 -530 l 277 -317 l 273 -317 b 13 -95 153 -305 51 -217 b 0 2 4 -62 0 -29 b 182 295 0 126 66 238 b 274 324 210 309 249 320 l 277 324 l 277 427 b 279 533 277 528 277 530 b 289 545 281 538 285 542 m 277 2 b 277 291 277 161 277 291 b 268 288 277 291 273 290 b 144 1 179 265 144 184 b 276 -284 144 -199 175 -267 l 277 -285 l 277 2 "},vb7:{x_min:-176.9375,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 503 20 616 20 614 b 20 391 20 442 20 391 b 84 424 20 391 49 406 l 147 456 l 152 456 b 153 456 153 456 153 456 b 175 435 166 456 175 446 b 172 427 175 433 174 430 b 92 380 170 420 172 421 l 20 342 l 20 245 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b 0 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 b -21 54 -21 -212 -21 -212 b -21 322 -21 201 -21 322 b -85 290 -21 322 -50 308 l -148 256 l -153 256 b -155 256 -155 256 -155 256 b -176 277 -167 256 -176 266 b -174 285 -176 280 -175 283 b -93 333 -171 294 -174 292 l -21 370 l -21 494 b -20 620 -21 616 -21 616 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},vb9:{x_min:-122.5,x_max:121.140625,ha:124,o:"m -16 145 b 0 147 -10 147 -5 147 b 121 -1 66 147 121 77 b 114 -49 121 -16 118 -33 b -1 -148 95 -112 47 -148 b -85 -106 -31 -148 -61 -134 b -122 -1 -110 -76 -122 -38 b -16 145 -122 68 -81 134 m 12 111 b 0 113 8 113 4 113 b -68 22 -29 113 -61 73 b -70 0 -69 15 -70 6 b -13 -113 -70 -49 -47 -98 b -1 -115 -9 -115 -5 -115 b 63 -40 24 -115 53 -83 b 68 -1 66 -27 68 -15 b 12 111 68 48 46 97 "},vba:{x_min:-118.421875,x_max:597.53125,ha:381,o:"m 460 574 b 464 574 461 574 462 574 b 488 574 470 574 481 574 b 500 573 491 574 498 574 b 594 503 543 570 588 538 b 597 488 596 498 597 494 b 528 417 597 449 564 417 b 502 423 519 417 510 419 b 465 481 477 434 465 458 b 488 528 465 499 472 516 b 490 530 490 530 490 530 b 490 530 490 530 490 530 b 468 517 488 530 475 523 b 349 340 419 485 377 420 b 347 330 348 334 347 330 b 383 328 347 328 363 328 b 428 326 423 328 424 328 b 442 302 438 320 442 312 b 430 281 442 294 438 285 b 385 276 424 277 426 276 l 377 276 l 332 276 l 330 269 b 178 -117 303 126 250 -9 b 1 -249 129 -194 69 -237 b -20 -251 -6 -251 -13 -251 b -114 -187 -65 -251 -100 -227 b -118 -156 -117 -177 -118 -166 b -51 -84 -118 -116 -91 -84 b -31 -87 -46 -84 -39 -86 b 16 -152 0 -95 16 -124 b -12 -205 16 -173 8 -194 b -16 -208 -14 -206 -16 -208 b -14 -208 -16 -208 -14 -208 b -9 -206 -14 -208 -12 -208 b 74 -124 23 -197 54 -166 b 172 224 98 -79 125 22 b 185 276 178 252 183 274 b 185 276 185 276 185 276 b 141 276 185 276 181 276 b 91 280 96 276 96 276 b 77 302 83 285 77 294 b 91 326 77 312 83 320 b 148 328 95 328 96 328 l 198 330 l 202 341 b 460 574 249 473 351 566 "},vbf:{x_min:-53.078125,x_max:513.140625,ha:485,o:"m 185 383 b 196 384 187 383 191 384 b 277 334 230 384 259 365 b 288 301 281 324 288 306 b 288 297 288 298 288 297 b 294 302 289 297 291 299 b 394 370 323 338 367 367 b 404 371 398 370 401 371 b 510 272 453 371 498 328 b 513 237 513 262 513 251 b 507 172 513 217 511 192 b 326 -34 487 59 412 -26 b 314 -36 322 -36 318 -36 b 274 -24 298 -36 283 -31 l 265 -16 b 224 44 246 -1 232 20 b 223 49 224 47 223 49 b 223 49 223 49 223 49 b 149 -197 221 48 149 -194 b 149 -198 149 -197 149 -198 b 170 -210 149 -202 155 -205 b 187 -215 174 -210 175 -212 b 204 -231 201 -219 204 -222 b 197 -245 204 -240 202 -242 l 194 -248 l 76 -248 l -42 -248 l -46 -245 b -53 -231 -51 -242 -53 -240 b -35 -215 -53 -222 -49 -217 b -13 -210 -21 -212 -20 -212 b -6 -208 -10 -209 -8 -208 b 0 -206 -6 -208 -2 -206 b 25 -188 13 -201 21 -195 b 163 280 28 -183 163 276 b 166 291 163 283 164 287 b 167 302 167 295 167 299 b 155 324 167 315 161 324 b 155 324 155 324 155 324 b 65 230 125 322 85 280 b 53 215 61 217 58 215 b 51 215 53 215 51 215 b 42 224 46 215 42 217 b 57 263 42 231 47 244 b 140 360 77 305 104 337 b 152 370 144 365 149 369 b 185 383 157 376 172 381 m 374 306 b 366 308 371 308 368 308 b 300 273 348 308 321 294 b 284 254 288 262 287 259 b 280 242 283 249 281 245 b 257 169 279 240 270 213 l 236 98 l 236 93 b 251 48 238 77 243 61 b 279 27 258 37 272 27 b 281 27 279 27 280 27 b 291 31 281 27 287 30 b 396 170 334 52 378 109 b 406 247 402 197 406 224 b 401 277 406 259 405 270 b 374 306 397 290 383 303 "},vc3:{x_min:-10.890625,x_max:299.4375,ha:294,o:"m 136 460 b 142 462 137 462 140 462 b 166 449 152 462 161 456 b 171 428 168 446 168 445 b 288 131 194 322 238 209 b 298 115 295 120 296 117 b 299 106 298 112 299 109 b 273 81 299 91 287 81 b 255 86 268 81 261 83 b 155 116 225 104 183 116 l 152 116 l 149 108 b 141 83 148 102 144 91 b 134 48 137 69 134 58 b 149 9 134 34 140 24 b 153 -1 152 5 153 1 b 149 -9 153 -5 152 -6 b 144 -11 148 -11 147 -11 b 122 2 138 -11 133 -6 b 95 61 104 20 95 38 b 107 108 95 74 99 90 b 108 113 107 111 108 112 b 107 113 108 113 108 113 b 102 113 106 113 104 113 b 31 86 76 108 53 98 b 14 80 24 81 20 80 b -10 106 0 80 -10 91 b 0 131 -10 115 -9 116 b 115 430 49 209 91 317 b 136 460 119 451 123 456 "},vd0:{x_min:-10.890625,x_max:299.4375,ha:294,o:"m 44 174 b 51 174 47 174 49 174 b 68 173 55 174 61 174 l 287 112 l 551 40 b 615 20 617 22 609 23 b 626 0 622 16 626 8 b 615 -22 626 -9 622 -18 b 613 -23 613 -23 613 -23 b 613 -23 613 -23 613 -23 b 287 -113 613 -24 597 -29 l 68 -174 b 53 -176 61 -176 57 -176 b 39 -172 47 -176 43 -174 b 27 -151 31 -167 27 -159 b 39 -129 27 -141 31 -133 b 230 -74 43 -124 20 -131 l 370 -36 l 468 -9 b 498 0 484 -4 498 -1 b 468 8 498 0 484 2 l 370 34 l 230 73 b 40 126 28 129 43 124 b 27 149 31 131 27 140 b 44 174 27 161 34 170 m 205 110 l 205 300 b 205 330 245 330 245 300 l 245 300 l 245 -300 b 245 -330 205 -330 205 -300 l 205 -300 l 205 110 l 345 90 m 345 90 l 345 330 b 345 360 385 360 385 330 l 385 330 l 385 -270 b 385 -300 345 -300 345 -270 l 345 -270 l 345 90 "},vd1:{x_min:-20,x_max:320,ha:257,o:"m -8 200 b -8 210 8 200 16 200 l 20 148 -199 l 23 -615 b 0 -629 9 -629 6 -629 l -21 -612 l -21 -201 l -21 216 l -20 200 m 16 200 l 310 0 l 240 0 l 16 140 l 16 -120 l 240 0 l 310 0 l 16 -200 "},vd2:{x_min:0,x_max:430.75,ha:386,o:"m 0 200 l 0 -200 l 430 -200 l 430 200 l 0 200 "},vd3:{x_min:0,x_max:430.75,ha:386,o:"m 0 200 l 0 -200 l 430 -200 l 430 200 l 0 200 l 50 150 l 380 150 l 380 -150 l 50 -150 l 50 150 "},vd4:{x_min:0,x_max:430.75,ha:360,o:"m 0 150 l 0 -150 l 430 -150 l 430 150 l 0 150 "},vd5:{x_min:0,x_max:430.75,ha:360,o:"m 0 150 l 0 -150 l 430 -150 l 430 150 l 0 150 l 50 100 l 380 100 l 380 -100 l 50 -100 l 50 100"},vd6:{x_min:0,x_max:430.75,ha:360,o:"m -146 537 b -138 538 -143 538 -141 538 b -118 525 -129 538 -121 533 b -117 390 -117 522 -117 521 b -115 259 -117 268 -117 259 b -115 259 -115 259 -115 259 b -59 272 -104 263 -62 272 b -39 259 -50 272 -42 267 b -37 209 -38 257 -37 233 b -39 159 -37 185 -38 162 b -85 138 -43 149 -44 149 l -117 131 l -117 21 b -115 -88 -117 -80 -117 -88 b -115 -88 -115 -88 -115 -88 b -59 -75 -104 -84 -62 -75 b -44 -81 -52 -75 -48 -77 b -38 -124 -38 -87 -38 -85 b -38 -138 -38 -124 -38 -138 b -38 -152 -38 -138 -38 -152 b -44 -195 -38 -191 -38 -190 b -85 -209 -48 -200 -48 -200 l -117 -217 l -117 -349 b -118 -486 -117 -481 -117 -482 b -138 -499 -121 -494 -129 -499 b -153 -493 -143 -499 -149 -497 b -159 -415 -158 -487 -159 -496 b -159 -355 -159 -398 -159 -379 b -159 -227 -159 -284 -159 -227 b -205 -238 -159 -227 -180 -232 b -250 -249 -230 -244 -250 -249 b -251 -386 -251 -249 -251 -311 b -252 -525 -251 -521 -251 -522 b -272 -538 -255 -534 -264 -538 b -287 -532 -277 -538 -283 -536 b -293 -452 -292 -527 -293 -536 b -293 -391 -293 -436 -293 -415 b -294 -260 -293 -269 -293 -260 b -294 -260 -294 -260 -294 -260 b -348 -272 -306 -264 -345 -272 b -368 -259 -357 -272 -365 -267 b -369 -209 -369 -257 -369 -233 b -368 -159 -369 -185 -369 -162 b -323 -139 -364 -149 -362 -148 l -293 -131 l -293 -22 b -294 87 -293 80 -293 87 b -294 87 -294 87 -294 87 b -348 75 -306 84 -345 75 b -368 88 -357 75 -365 80 b -369 138 -369 91 -369 114 b -368 188 -369 162 -369 186 b -323 209 -364 198 -362 199 l -293 216 l -293 349 b -292 486 -293 481 -293 482 b -272 499 -288 494 -280 499 b -257 493 -266 499 -261 497 b -251 414 -251 487 -251 496 b -251 354 -251 398 -251 378 b -251 226 -251 284 -251 226 b -205 238 -250 226 -230 231 b -159 249 -180 244 -159 249 b -159 385 -159 249 -159 310 b -157 525 -159 521 -159 522 b -146 537 -156 530 -151 535 z m -159 11 b -159 120 -159 98 -159 120 l -159 120 b -175 116 -160 120 -167 119 b -221 105 -184 114 -204 109 l -251 98 l -251 -12 b -251 -121 -251 -72 -251 -121 b -205 -110 -250 -121 -230 -116 b -159 -99 -180 -104 -159 -99 b -159 11 -159 -99 -159 -49 z m 89 517 b 97 519 92 518 94 519 b 117 505 106 519 114 513 b 119 376 119 502 119 501 l 119 249 l 145 258 b 176 267 169 266 172 267 b 177 267 176 267 177 267 b 196 255 186 267 192 263 l 197 252 l 197 205 b 197 181 197 195 197 187 b 193 149 197 153 197 153 b 152 131 190 144 187 143 l 119 120 l 119 10 b 119 -100 119 -62 119 -100 b 145 -91 120 -100 131 -96 b 173 -82 159 -86 171 -82 b 176 -81 174 -81 175 -81 b 196 -94 185 -81 193 -87 b 198 -151 197 -97 198 -125 b 197 -194 198 -172 197 -192 b 153 -218 193 -203 192 -204 l 119 -230 l 119 -367 l 118 -504 l 117 -507 b 97 -519 113 -514 105 -519 b 82 -512 92 -519 87 -517 b 76 -434 77 -507 76 -516 b 76 -374 76 -418 76 -398 b 76 -245 76 -303 76 -245 b 52 -254 76 -245 65 -249 b 19 -263 34 -260 25 -263 b 6 -257 13 -263 10 -261 b 0 -214 0 -251 0 -253 b 0 -200 0 -210 0 -205 b 0 -188 0 -196 0 -192 b 6 -143 0 -147 0 -149 b 46 -126 10 -139 10 -139 l 76 -115 l 76 -5 b 76 106 76 56 76 106 b 51 98 76 106 64 102 b 18 89 34 92 25 89 b 6 95 13 89 10 91 b 0 139 0 101 0 99 b 0 153 0 143 0 148 b 0 179 0 163 0 172 b 44 225 0 215 3 211 l 76 236 l 76 369 b 78 505 76 501 76 502 b 89 517 80 510 85 515 z "},vd7:{x_min:0,x_max:430.75,ha:360,o:"m 283 633 b 291 634 286 634 289 634 b 311 621 300 634 308 629 b 313 505 313 618 313 617 b 313 393 313 443 313 393 b 378 425 313 393 343 407 l 443 458 l 448 458 b 449 458 449 458 449 458 b 471 437 462 458 471 448 b 469 429 471 434 470 432 b 387 382 466 421 469 423 l 313 344 l 313 247 l 313 150 l 315 152 b 433 201 353 184 394 201 b 479 193 448 201 464 198 b 549 86 524 177 549 135 b 526 1 549 59 541 29 b 395 -143 504 -39 475 -71 b 316 -214 351 -182 341 -191 b 292 -229 302 -228 300 -229 b 272 -216 283 -229 275 -224 b 271 55 271 -212 271 -212 b 270 323 271 203 270 323 b 205 291 270 323 241 308 l 140 258 l 135 258 b 134 258 135 258 134 258 b 112 279 121 258 112 267 b 114 287 112 281 113 284 b 196 334 117 295 114 293 l 271 371 l 271 495 b 272 621 271 617 271 618 b 283 633 274 626 279 631 z m 404 133 b 391 134 400 134 395 134 b 384 134 388 134 386 134 b 318 88 358 130 335 114 l 313 81 l 313 -37 l 313 -156 l 316 -152 b 439 83 391 -71 439 22 l 439 84 b 404 133 439 115 430 128 z m -8 633 l -8 633 b 0 634 -6 634 -3 634 b 20 621 8 634 17 629 b 21 384 21 618 21 617 l 21 150 l 24 152 b 141 201 62 184 102 201 b 187 193 157 201 172 198 b 257 86 232 177 257 135 b 234 1 257 59 250 29 b 103 -143 212 -39 183 -71 b 24 -214 60 -182 49 -191 b 0 -229 10 -228 8 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 203 l -21 618 l -20 621 b -8 633 -18 626 -13 631 z m 113 133 l 113 133 b 99 134 109 134 103 134 b 93 134 97 134 94 134 b 26 88 66 130 43 114 l 21 81 l 21 -37 l 21 -156 l 25 -152 b 148 83 99 -71 148 22 l 148 84 b 113 133 148 115 138 128 z "},rwl:{x_min:0,x_max:737.71875,ha:753,o:"m 9 13 b 208 15 10 15 51 15 b 368 15 251 15 304 15 l 726 15 l 729 12 b 737 -1 735 9 737 4 b 729 -15 737 -6 735 -11 l 726 -16 l 660 -16 l 592 -16 l 592 -95 l 592 -174 l 368 -174 l 144 -174 l 144 -95 l 144 -16 l 77 -16 l 9 -16 l 6 -15 b 0 -1 1 -11 0 -6 b 9 13 0 5 2 11 "},rhl:{x_min:0,x_max:737.71875,ha:753,o:"m 144 94 l 144 173 l 368 173 l 592 173 l 592 94 l 592 15 l 660 15 l 726 15 l 729 12 b 737 -1 735 9 737 4 b 729 -15 737 -6 735 -11 l 726 -16 l 368 -16 l 9 -16 l 6 -15 b 0 -1 1 -11 0 -6 b 6 12 0 4 1 9 l 9 15 l 77 15 l 144 15 l 144 94 "}},cssFontWeight:"normal",ascender:1903,underlinePosition:-125,cssFontStyle:"normal",boundingBox:{yMin:-2065.375,xMin:-695.53125,yMax:1901.578125,xMax:1159.671875},resolution:1e3,descender:-2066,familyName:"VexFlow-18",lineHeight:4093,underlineThickness:50};function f(ce,e,a,b,w,C){let V,z,J,Z=0;function re(){return e+ce[Z++]*b}function ae(){return a+ce[Z++]*w}for(;Z<ce.length;)switch(V=ce[Z++],V){case"m":case"l":C[V](re(),ae());break;case"q":z=re(),J=ae(),C.q(re(),ae(),z,J);break;case"b":z=re(),J=ae(),C.b(re(),ae(),re(),ae(),z,J)}}class p extends o{static loadMetrics(e,a,b){const w=e.glyphs[a];if(!w)throw new l.RERR("BadGlyph",`Glyph ${a} does not exist in font.`);const C=w.x_min,V=w.x_max,z=w.ha;let J;if(w.o)return b?w.cached_outline?J=w.cached_outline:(J=w.o.split(" "),w.cached_outline=J):(w.cached_outline&&delete w.cached_outline,J=w.o.split(" ")),{x_min:C,x_max:V,ha:z,outline:J};throw new l.RERR("BadGlyph",`Glyph ${a} has no outline defined.`)}static renderGlyph(e,a,b,w,C,V){const z=72*w/(100*t.resolution),J=p.loadMetrics(t,C,!V);p.renderOutline(e,J.outline,z,a,b)}static renderOutline(e,a,b,w,C){e.beginPath(),e.moveTo(w,C),f(a,w,C,b,-b,{m:e.moveTo.bind(e),l:e.lineTo.bind(e),q:e.quadraticCurveTo.bind(e),b:e.bezierCurveTo.bind(e)}),e.fill()}static getOutlineBoundingBox(e,a,b,w){const C=new n;return f(e,b,w,a,-a,{m:C.addPoint.bind(C),l:C.addPoint.bind(C),q:C.addQuadraticCurve.bind(C),b:C.addBezierCurve.bind(C)}),new h(C.x1,C.y1,C.width(),C.height())}constructor(e,a,b){super(),this.setAttribute("type","Glyph"),this.code=e,this.point=a,this.options={cache:!0,font:t},this.metrics=null,this.x_shift=0,this.y_shift=0,this.originShift={x:0,y:0},b?this.setOptions(b):this.reset()}setOptions(e){l.Merge(this.options,e),this.reset()}setPoint(e){return this.point=e,this}setStave(e){return this.stave=e,this}setXShift(e){return this.x_shift=e,this}setYShift(e){return this.y_shift=e,this}reset(){this.scale=72*this.point/(100*this.options.font.resolution),this.metrics=p.loadMetrics(this.options.font,this.code,this.options.cache),this.bbox=p.getOutlineBoundingBox(this.metrics.outline,this.scale,0,0)}getMetrics(){if(!this.metrics)throw new l.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);return{x_min:this.metrics.x_min*this.scale,x_max:this.metrics.x_max*this.scale,width:this.bbox.getW(),height:this.bbox.getH()}}setOriginX(e){const{bbox:a}=this,b=(e-Math.abs(a.getX()/a.getW()))*a.getW();this.originShift.x=-b}setOriginY(e){const{bbox:a}=this,b=(e-Math.abs(a.getY()/a.getH()))*a.getH();this.originShift.y=-b}setOrigin(e,a){this.setOriginX(e),this.setOriginY(a)}render(e,a,b){if(!this.metrics)throw new l.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);const w=this.metrics.outline,C=this.scale;this.setRendered(),this.applyStyle(e),p.renderOutline(e,w,C,a+this.originShift.x,b+this.originShift.y),this.restoreStyle(e)}renderToStave(e){if(this.checkContext(),!this.metrics)throw new l.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);if(!this.stave)throw new l.RuntimeError("GlyphError","No valid stave");const a=this.metrics.outline,b=this.scale;this.setRendered(),this.applyStyle(),p.renderOutline(this.context,a,b,e+this.x_shift,this.stave.getYForGlyphs()+this.y_shift),this.restoreStyle()}}const m={STEM_WIDTH:1.5,STEM_HEIGHT:35,STAVE_LINE_THICKNESS:1,RESOLUTION:16384,DEFAULT_NOTATION_FONT_SCALE:39,DEFAULT_TABLATURE_FONT_SCALE:39,SLASH_NOTEHEAD_WIDTH:15,TEXT_HEIGHT_OFFSET_HACK:1,IsKerned:!0,clefProperties:ce=>{if(!ce)throw new l.RERR("BadArgument","Invalid clef: "+ce);const e=m.clefProperties.values[ce];if(!e)throw new l.RERR("BadArgument","Invalid clef: "+ce);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=(ce,e,a)=>{e===void 0&&(e="treble");const b={octave_shift:0};typeof a=="object"&&l.Merge(b,a);const w=ce.split("/");if(w.length<2)throw new l.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${ce}`);const C=w[0].toUpperCase(),V=m.keyProperties.note_values[C];if(!V)throw new l.RERR("BadArguments","Invalid key name: "+C);V.octave&&(w[1]=V.octave);let z=parseInt(w[1],10);z-=b.octave_shift;let J=(7*z-28+V.index)/2;J+=m.clefProperties(e).line_shift;let Z=0;J<=0&&2*J%2==0&&(Z=1),J>=6&&2*J%2==0&&(Z=-1);const re=V.int_val!==void 0?12*z+V.int_val:null,ae=V.code,le=V.shift_right;let he={};if(w.length>2&&w[2]){const pe=w[2].toUpperCase();he=m.keyProperties.customNoteHeads[pe]||{}}return{key:C,octave:z,line:J,int_value:re,accidental:V.accidental,code:ae,stroke:Z,shift_right:le,displaced:!1,...he}},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},TI:{code:"v11",shift_right:0,stem_up_y_shift:5,stem_down_y_shift:5,stem_up_x_offset:6,stem_down_x_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},rwl:{code:"rwl",shift_right:0},rhl:{code:"rhl",shift_right:0}},m.integerToNote=ce=>{if(ce===void 0)throw new l.RERR("BadArguments","Undefined integer for integerToNote");if(ce<-2)throw new l.RERR("BadArguments",`integerToNote requires integer > -2: ${ce}`);const e=m.integerToNote.table[ce];if(!e)throw new l.RERR("BadArguments",`Unknown note value for integer: ${ce}`);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=(ce,e=1,a=!1)=>{let b=null,w=0,C=0;if(ce.toString().toUpperCase()==="X"){b="v7f",a&&(b="v3e");const V=new p(b,m.DEFAULT_TABLATURE_FONT_SCALE*e).getMetrics();w=V.width,C=-V.height/2}else w=m.textWidth(ce.toString());return{text:ce,code:b,getWidth:()=>w*e,shift_y:C}},m.textWidth=ce=>7*ce.toString().length,m.articulationCodes=ce=>m.articulationCodes.articulations[ce],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=ce=>m.accidentalCodes.accidentals[ce],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=ce=>m.ornamentCodes.ornaments[ce],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=ce=>{const e=m.keySignature.keySpecs[ce];if(!e)throw new l.RERR("BadKeySignature",`Bad key signature spec: '${ce}'`);if(!e.acc)return[];const a=m.keySignature.accidentalList(e.acc),b=[];for(let w=0;w<e.num;++w){const C=a[w];b.push({type:e.acc,line:C})}return b},m.keySignature.keySpecs={C:{acc:null,num:0},Am:{acc:null,num:0},F:{acc:"b",num:1},Dm:{acc:"b",num:1},Bb:{acc:"b",num:2},Gm:{acc:"b",num:2},Eb:{acc:"b",num:3},Cm:{acc:"b",num:3},Ab:{acc:"b",num:4},Fm:{acc:"b",num:4},Db:{acc:"b",num:5},Bbm:{acc:"b",num:5},Gb:{acc:"b",num:6},Ebm:{acc:"b",num:6},Cb:{acc:"b",num:7},Abm:{acc:"b",num:7},G:{acc:"#",num:1},Em:{acc:"#",num:1},D:{acc:"#",num:2},Bm:{acc:"#",num:2},A:{acc:"#",num:3},"F#m":{acc:"#",num:3},E:{acc:"#",num:4},"C#m":{acc:"#",num:4},B:{acc:"#",num:5},"G#m":{acc:"#",num:5},"F#":{acc:"#",num:6},"D#m":{acc:"#",num:6},"C#":{acc:"#",num:7},"A#m":{acc:"#",num:7}},m.unicode={sharp:String.fromCharCode(parseInt("266F",16)),flat:String.fromCharCode(parseInt("266D",16)),natural:String.fromCharCode(parseInt("266E",16)),triangle:String.fromCharCode(parseInt("25B3",16)),"o-with-slash":String.fromCharCode(parseInt("00F8",16)),degrees:String.fromCharCode(parseInt("00B0",16)),circle:String.fromCharCode(parseInt("25CB",16))},m.keySignature.accidentalList=ce=>({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[ce],m.parseNoteDurationString=ce=>{if(typeof ce!="string")return null;const e=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(ce);if(!e)return null;const a=e[1],b=e[2].length;let w=e[3];return w.length===0&&(w="n"),{duration:a,dots:b,type:w}},m.parseNoteStruct=ce=>{const e=ce.duration,a=m.parseNoteDurationString(e);if(!a)return null;let b=m.durationToTicks(a.duration);if(b==null)return null;let w=ce.type;const C=[];if(w){if(!m.getGlyphProps.validTypes[w])return null}else w=a.type||"n",ce.keys!==void 0&&ce.keys.forEach((J,Z)=>{const re=J.split("/");re&&re.length===3&&(C[Z]=re[2])});const V=ce.dots?ce.dots:a.dots;if(typeof V!="number")return null;let z=b;for(let J=0;J<V;J++){if(z<=1)return null;z/=2,b+=z}return{duration:a.duration,type:w,customTypes:C,dots:V,ticks:b}},m.sanitizeDuration=ce=>{const e=m.durationAliases[ce];if(e!==void 0&&(ce=e),m.durationToTicks.durations[ce]===void 0)throw new l.RERR("BadArguments",`The provided duration is not valid: ${ce}`);return ce},m.durationToFraction=ce=>new s().parse(m.sanitizeDuration(ce)),m.durationToNumber=ce=>m.durationToFraction(ce).value(),m.durationToTicks=ce=>{ce=m.sanitizeDuration(ce);const e=m.durationToTicks.durations[ce];return e===void 0?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=(ce,e)=>{ce=m.sanitizeDuration(ce);const a=m.getGlyphProps.duration_codes[ce];if(a===void 0)return null;e||(e="n");let b=a.type[e];if(b===void 0){const w=m.keyProperties.customNoteHeads[e.toUpperCase()];if(w===void 0)return null;b={code_head:w.code,...w}}return{...a.common,...b}},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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"v53",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"v1d",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"v81",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",ce).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(ce=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",ce).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 x{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static SanitizeCanvasDims(e,a){return Math.max(e,a)>this.CANVAS_BROWSER_SIZE_LIMIT&&(l.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT),a>this.CANVAS_BROWSER_SIZE_LIMIT&&(a=this.CANVAS_BROWSER_SIZE_LIMIT)),[e,a]}constructor(e){this.vexFlowCanvasContext=e,e.canvas?this.canvas=e.canvas:this.canvas={width:x.WIDTH,height:x.HEIGHT}}clear(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(){}closeGroup(){}add(){}setFont(e,a,b){return this.vexFlowCanvasContext.font=(b||"")+" "+a+"pt "+e,this}setRawFont(e){return this.vexFlowCanvasContext.font=e,this}setFillStyle(e){return this.vexFlowCanvasContext.fillStyle=e,this}setBackgroundFillStyle(e){return this.background_fillStyle=e,this}setStrokeStyle(e){return this.vexFlowCanvasContext.strokeStyle=e,this}setShadowColor(e){return this.vexFlowCanvasContext.shadowColor=e,this}setShadowBlur(e){return this.vexFlowCanvasContext.shadowBlur=e,this}setLineWidth(e){return this.vexFlowCanvasContext.lineWidth=e,this}setLineCap(e){return this.vexFlowCanvasContext.lineCap=e,this}setLineDash(e){return this.vexFlowCanvasContext.lineDash=e,this}scale(e,a){return this.vexFlowCanvasContext.scale(parseFloat(e),parseFloat(a))}resize(e,a){return[e,a]=this.SanitizeCanvasDims(parseInt(e,10),parseInt(a,10)),this.vexFlowCanvasContext.resize(e,a)}rect(e,a,b,w){return this.vexFlowCanvasContext.rect(e,a,b,w)}fillRect(e,a,b,w){return this.vexFlowCanvasContext.fillRect(e,a,b,w)}clearRect(e,a,b,w){return this.vexFlowCanvasContext.clearRect(e,a,b,w)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(e,a){return this.vexFlowCanvasContext.moveTo(e,a)}lineTo(e,a){return this.vexFlowCanvasContext.lineTo(e,a)}bezierCurveTo(e,a,b,w,C,V){return this.vexFlowCanvasContext.bezierCurveTo(e,a,b,w,C,V)}quadraticCurveTo(e,a,b,w){return this.vexFlowCanvasContext.quadraticCurveTo(e,a,b,w)}arc(e,a,b,w,C,V){return this.vexFlowCanvasContext.arc(e,a,b,w,C,V)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(e){return this.vexFlowCanvasContext.measureText(e)}fillText(e,a,b){return this.vexFlowCanvasContext.fillText(e,a,b)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}}class y{constructor(e){this.element=e,this.paper=Raphael(e),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(e,a,b){return this.state.font_family=e,this.state.font_size=a,this.state.font_weight=b,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(e){return this.attributes.font=e,this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(){return this}setLineCap(){return this}scale(e,a){return this.state.scale={x:e,y:a},this.attributes.transform="S"+e+","+a+",0,0",this.attributes.scale=e+","+a+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+e+","+a+",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(e,a){return this.element.style.width=e,this.paper.setSize(e,a),this}setViewBox(e){this.paper.canvas.setAttribute("viewBox",e)}rect(e,a,b,w){return w<0&&(a+=w,w=-w),this.paper.rect(e,a,b-.5,w-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(e,a,b,w){return w<0&&(a+=w,w=-w),this.paper.rect(e,a,b-.5,w-.5).attr(this.attributes),this}clearRect(e,a,b,w){return w<0&&(a+=w,w=-w),this.paper.rect(e,a,b-.5,w-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(e,a){return this.path+="M"+e+","+a,this.pen.x=e,this.pen.y=a,this}lineTo(e,a){return this.path+="L"+e+","+a,this.pen.x=e,this.pen.y=a,this}bezierCurveTo(e,a,b,w,C,V){return this.path+="C"+e+","+a+","+b+","+w+","+C+","+V,this.pen.x=C,this.pen.y=V,this}quadraticCurveTo(e,a,b,w){return this.path+="Q"+e+","+a+","+b+","+w,this.pen.x=b,this.pen.y=w,this}arc(e,a,b,w,C,V){function z(Z){for(;Z<0;)Z+=2*Math.PI;for(;Z>2*Math.PI;)Z-=2*Math.PI;return Z}if((w=z(w))>(C=z(C))){const Z=w;w=C,C=Z,V=!V}const J=C-w;return J>Math.PI?(this.arcHelper(e,a,b,w,w+J/2,V),this.arcHelper(e,a,b,w+J/2,C,V)):this.arcHelper(e,a,b,w,C,V),this}arcHelper(e,a,b,w,C,V){const z=e+b*Math.cos(w),J=a+b*Math.sin(w),Z=e+b*Math.cos(C),re=a+b*Math.sin(C);let ae=0,le=0;V?(le=1,C-w<Math.PI&&(ae=1)):C-w>Math.PI&&(ae=1),this.path+="M"+z+","+J+",A"+b+","+b+",0,"+ae+","+le+","+Z+","+re+"M"+this.pen.x+","+this.pen.y}glow(){const e=this.paper.set();if(this.shadow_attributes.width>0){const a=this.shadow_attributes,b=a.width/2;for(let w=1;w<=b;w++)e.push(this.paper.path(this.path).attr({stroke:a.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(a.width/b*w).toFixed(3),opacity:+((a.opacity||.3)/b).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return e}fill(){const e=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(e),this}stroke(){const e=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,a=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",e);return this.glow(a),this}closePath(){return this.path+="Z",this}measureText(e){const a=this.paper.text(0,0,e).attr(this.attributes).attr("fill","none").attr("stroke","none"),b=a.getBBox();return a.remove(),{width:b.width,height:b.height}}fillText(e,a,b){return this.paper.text(a+this.measureText(e).width/2,b-this.state.font_size/(2.25*this.state.scale.y),e).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 e=this.state_stack.pop();return this.state.font_family=e.state.font_family,this.attributes.font=e.attributes.font,this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this}}const d={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const ce={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};l.Merge(d.rect,ce),l.Merge(d.path,ce)}class S{constructor(e){this.element=e,this.svgNS="http://www.w3.org/2000/svg";const a=this.create("svg");this.element.appendChild(a),this.svg=a,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(e){return document.createElementNS(this.svgNS,e)}openGroup(e,a,b){const w=this.create("g");return this.groups.push(w),this.parent.appendChild(w),this.parent=w,e&&w.setAttribute("class",l.Prefix(e)),a&&w.setAttribute("id",l.Prefix(a)),b&&b.pointerBBox&&w.setAttribute("pointer-events","bounding-box"),w}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(e){this.parent.appendChild(e)}iePolyfill(){typeof navigator<"u"&&(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(e,a,b){let w=!1,C=!1,V="normal";typeof b=="string"&&(b.indexOf("italic")!==-1&&(b=b.replace(/italic/g,""),C=!0),b.indexOf("bold")!==-1&&(b=b.replace(/bold/g,""),w=!0),b=b.replace(/ /g,"")),V=C?"italic":V;const z={"font-family":e,"font-size":a+"pt","font-weight":b=(b=w?"bold":b)===void 0||b===""?"normal":b,"font-style":V};return this.fontSize=Number(a),l.Merge(this.attributes,z),l.Merge(this.state,z),this}setRawFont(e){const a=(e=e.trim()).split(" ");return this.attributes["font-family"]=a[1],this.state["font-family"]=a[1],this.attributes["font-size"]=a[0],this.state["font-size"]=a[0],this.fontSize=Number(a[0].match(/\d+/)),this}setFillStyle(e){return this.attributes.fill=e,this}setBackgroundFillStyle(e){return this.background_attributes.fill=e,this.background_attributes.stroke=e,this}setStrokeStyle(e){return this.attributes.stroke=e,this}setShadowColor(e){return this.shadow_attributes.color=e,this}setShadowBlur(e){return this.shadow_attributes.width=e,this}setLineWidth(e){this.attributes["stroke-width"]=e,this.lineWidth=e}setLineDash(e){if(Object.prototype.toString.call(e)==="[object Array]")return e=e.join(", "),this.attributes["stroke-dasharray"]=e,this;throw new l.RERR("ArgumentError","lineDash must be an array of integers.")}setLineCap(e){return this.attributes["stroke-linecap"]=e,this}resize(e,a){this.width=e,this.height=a,this.element.style.width=e;const b={width:e,height:a};return this.applyAttributes(this.svg,b),this.scale(this.state.scale.x,this.state.scale.y),this}scale(e,a){this.state.scale={x:e,y:a};const b=this.width/e,w=this.height/a;return this.setViewBox(0,0,b,w),this}setViewBox(...e){if(e.length===1){const[a]=e;this.svg.setAttribute("viewBox",a)}else{const[a,b,w,C]=e,V=a+" "+b+" "+w+" "+C;this.svg.setAttribute("viewBox",V)}}applyAttributes(e,a){const b=d[e.nodeName];return Object.keys(a).forEach(w=>{b&&b[w]||e.setAttributeNS(null,w,a[w])}),e}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(e,a,b,w,C){w<0&&(a+=w,w*=-1);const V=this.create("rect");return C===void 0&&(C={fill:"none","stroke-width":this.lineWidth,stroke:this.attributes.stroke}),l.Merge(C,{x:e,y:a,width:b,height:w}),this.applyAttributes(V,C),this.add(V),this}fillRect(e,a,b,w){return w<0&&(a+=w,w*=-1),this.rect(e,a,b,w,this.attributes),this}clearRect(e,a,b,w){return this.rect(e,a,b,w,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(e,a){return this.path+="M"+e+" "+a,this.pen.x=e,this.pen.y=a,this}lineTo(e,a){return this.path+="L"+e+" "+a,this.pen.x=e,this.pen.y=a,this}bezierCurveTo(e,a,b,w,C,V){return this.path+="C"+e+" "+a+","+b+" "+w+","+C+" "+V,this.pen.x=C,this.pen.y=V,this}quadraticCurveTo(e,a,b,w){return this.path+="Q"+e+" "+a+","+b+" "+w,this.pen.x=b,this.pen.y=w,this}arc(e,a,b,w,C,V){function z(Z){for(;Z<0;)Z+=2*Math.PI;for(;Z>2*Math.PI;)Z-=2*Math.PI;return Z}if((w=z(w))>(C=z(C))){const Z=w;w=C,C=Z,V=!V}const J=C-w;return J>Math.PI?(this.arcHelper(e,a,b,w,w+J/2,V),this.arcHelper(e,a,b,w+J/2,C,V)):this.arcHelper(e,a,b,w,C,V),this}arcHelper(e,a,b,w,C,V){const z=e+b*Math.cos(w),J=a+b*Math.sin(w),Z=e+b*Math.cos(C),re=a+b*Math.sin(C);let ae=0,le=0;V?(le=1,C-w<Math.PI&&(ae=1)):C-w>Math.PI&&(ae=1),this.path+="M"+z+" "+J+" A"+b+" "+b+" 0 "+ae+" "+le+" "+Z+" "+re,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 e=this.shadow_attributes,a=e.width/2;for(let b=1;b<=a;b++){const w={stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(.4*e.width/a*b).toFixed(3),opacity:+((e.opacity||.3)/a).toFixed(3)},C=this.create("path");w.d=this.path,this.applyAttributes(C,w),this.add(C)}}return this}fill(e){this.glow();const a=this.create("path");let b=e;return e===void 0?(l.Merge(e={},this.attributes),e.stroke="none",b=e):(b=e,l.Merge(b,this.attributes),e.class&&(b.class=e.class),e.id&&(b.id=e.id)),e.d=this.path,this.applyAttributes(a,e),this.add(a),this}stroke(e=void 0){this.glow();const a=this.create("path"),b={};return l.Merge(b,this.attributes),e&&l.Merge(b,e),b.fill="none",b["stroke-width"]=this.lineWidth,b.d=this.path,this.applyAttributes(a,b),this.add(a),this}measureText(e){const a=this.create("text");if(typeof a.getBBox!="function")return{x:0,y:0,width:0,height:0};a.textContent=e,this.applyAttributes(a,this.attributes),this.svg.appendChild(a);let b=a.getBBox();return this.ie&&e!==""&&this.attributes["font-style"]==="italic"&&(b=this.ieMeasureTextFix(b,e)),this.svg.removeChild(a),b}ieMeasureTextFix(e){const a=1.196*Number(this.fontSize)+1.9598,b=e.width-a,w=e.height-1.5;return{x:e.x,y:e.y,width:b,height:w}}fillText(e,a,b){if(!e||e.length<=0)return;const w={};l.Merge(w,this.attributes),w.stroke="none",w.x=a,w.y=b;const C=this.create("text");C.textContent=e,this.applyAttributes(C,w),this.add(C)}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 e=this.state_stack.pop();return this.state["font-family"]=e.state["font-family"],this.state["font-weight"]=e.state["font-weight"],this.state["font-style"]=e.state["font-style"],this.state["font-size"]=e.state["font-size"],this.state.scale=e.state.scale,this.attributes["font-family"]=e.attributes["font-family"],this.attributes["font-weight"]=e.attributes["font-weight"],this.attributes["font-style"]=e.attributes["font-style"],this.attributes["font-size"]=e.attributes["font-size"],this.attributes.fill=e.attributes.fill,this.attributes.stroke=e.attributes.stroke,this.attributes["stroke-width"]=e.attributes["stroke-width"],this.attributes["stroke-dasharray"]=e.attributes["stroke-dasharray"],this.shadow_attributes.width=e.shadow_attributes.width,this.shadow_attributes.color=e.shadow_attributes.color,this.lineWidth=e.lineWidth,this}}let M=null;class E{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 M}static set lastContext(e){M=e}static buildContext(e,a,b,w,C){const V=new E(e,a);b&&w&&V.resize(b,w),C||(C="#FFF");const z=V.getContext();return z.setBackgroundFillStyle(C),E.lastContext=z,z}static getCanvasContext(e,a,b,w){return E.buildContext(e,E.Backends.CANVAS,a,b,w)}static getRaphaelContext(e,a,b,w){return E.buildContext(e,E.Backends.RAPHAEL,a,b,w)}static getSVGContext(e,a,b,w){return E.buildContext(e,E.Backends.SVG,a,b,w)}static bolsterCanvasContext(e){return E.USE_CANVAS_PROXY?new x(e):(e.vexFlowCanvasContext=e,["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"].forEach(a=>{e[a]=e[a]||x.prototype[a]}),e)}static drawDashedLine(e,a,b,w,C,V){e.beginPath();const z=w-a,J=C-b,Z=Math.atan2(J,z);let re=a,ae=b;e.moveTo(a,b);let le=0,he=!0;for(;!(z<0?re<=w:re>=w)||!(J<0?ae<=C:ae>=C);){const pe=V[le++%V.length],ge=re+Math.cos(Z)*pe;re=z<0?Math.max(w,ge):Math.min(w,ge);const me=ae+Math.sin(Z)*pe;ae=J<0?Math.max(C,me):Math.min(C,me),he?e.lineTo(re,ae):e.moveTo(re,ae),he=!he}e.closePath(),e.stroke()}constructor(e,a){if(this.elementId=e,!this.elementId)throw new l.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(e),this.element||(this.element=e),this.ctx=null,this.paper=null,this.backend=a,this.backend===E.Backends.CANVAS){if(!this.element.getContext)throw new l.RERR("BadElement",`Can't get canvas context from element: ${e}`);this.ctx=E.bolsterCanvasContext(this.element.getContext("2d",{willReadFrequently:!0}))}else if(this.backend===E.Backends.RAPHAEL)this.ctx=new y(this.element);else{if(this.backend!==E.Backends.SVG)throw new l.RERR("InvalidBackend",`No support for backend: ${this.backend}`);this.ctx=new S(this.element)}}resize(e,a){if(this.backend===E.Backends.CANVAS){if(!this.element.getContext)throw new l.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[e,a]=x.SanitizeCanvasDims(e,a);const b=window.devicePixelRatio||1;this.element.width=e*b,this.element.height=a*b,this.element.style.width=e+"px",this.element.style.height=a+"px",this.ctx=E.bolsterCanvasContext(this.element.getContext("2d",{willReadFrequently:!0})),this.ctx.scale(b,b)}else this.ctx.resize(e,a);return this}getContext(){return this.ctx}}class L extends o{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(e={}){super(),this.setAttribute("type","Stem"),this.x_begin=e.x_begin||0,this.x_end=e.x_end||0,this.y_top=e.y_top||0,this.y_bottom=e.y_bottom||0,this.stem_extension=e.stem_extension||0,this.stem_direction=e.stem_direction||0,this.hide=e.hide||!1,this.isStemlet=e.isStemlet||!1,this.stemletHeight=e.stemletHeight||0,this.renderHeightAdjustment=0,this.setOptions(e)}setOptions(e){this.stem_up_y_offset=e.stem_up_y_offset||0,this.stem_down_y_offset=e.stem_down_y_offset||0}setNoteHeadXBounds(e,a){return this.x_begin=e,this.x_end=a,this}setDirection(e){this.stem_direction=e}setExtension(e){this.stem_extension=e}getExtension(){return this.stem_extension}setYBounds(e,a){this.y_top=e,this.y_bottom=a}getCategory(){return L.CATEGORY}getHeight(){const e=this.stem_direction===L.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(L.HEIGHT-e+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new l.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const e=this.stem_direction===L.UP,a=[this.y_top,this.y_bottom],b=L.HEIGHT+this.stem_extension,w=(e?Math.min:Math.max)(...a),C=(e?Math.max:Math.min)(...a);return{topY:w+b*-this.stem_direction,baseY:C}}setVisibility(e){return this.hide=!e,this}setStemlet(e,a){return this.isStemlet=e,this.stemletHeight=a,this}draw(){if(this.setRendered(),this.hide)return;const e=this.checkContext();let a,b;const w=this.stem_direction;w===L.DOWN?(a=this.x_begin,b=this.y_top+this.stem_down_y_offset):(a=this.x_end,b=this.y_bottom-this.stem_up_y_offset);const C=this.getHeight();(function(...z){L.DEBUG&&l.L("Vex.Flow.Stem",z)})("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const V=this.isStemlet?C-this.stemletHeight*this.stem_direction:0;if(e.save(),this.applyStyle(e),e.beginPath(),e.setLineWidth(L.WIDTH),e.moveTo(a,b-V),e.lineTo(a,b-C-this.renderHeightAdjustment*w),e.svg){const z={class:l.Prefix("stem")};this.id&&(z.id=this.id),e.stroke(z)}else e.stroke();this.restoreStyle(e),e.restore()}}class I extends o{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(e,a){if(super(),this.setAttribute("type","Tuplet"),!e||!e.length)throw new l.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=l.Merge({},a),this.notes=e,this.num_notes="num_notes"in this.options?this.options.num_notes:e.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=e.some(b=>b.beam===null),this.ratioed="ratioed"in this.options?this.options.ratioed:Math.abs(this.notes_occupied-this.num_notes)>1,this.point=28,this.y_pos=16,this.x_pos=100,this.width=200,this.location=this.options.location||I.LOCATION_TOP,Ce.AlignRestsToNotes(e,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let e=0;e<this.notes.length;e++)this.notes[e].setTuplet(this)}detach(){for(let e=0;e<this.notes.length;e++)this.notes[e].resetTuplet(this)}setBracketed(e){return this.bracketed=!!e,this}setRatioed(e){return this.ratioed=!!e,this}setTupletLocation(e){if(e){if(e!==I.LOCATION_TOP&&e!==I.LOCATION_BOTTOM)throw new l.RERR("BadArgument","Invalid tuplet location: "+e)}else e=I.LOCATION_TOP;return this.location=e,this}getNotes(){return this.notes}getNoteCount(){return this.num_notes}beatsOccupiedDeprecationWarning(){const e=["beats_occupied has been deprecated as an ","option for tuplets. Please use notes_occupied ","instead. Calls to getBeatsOccupied and ","setBeatsOccupied should now be routed to ","getNotesOccupied and setNotesOccupied instead"].join("");console&&console.warn?console.warn(e):console&&console.log(e)}getBeatsOccupied(){return this.beatsOccupiedDeprecationWarning(),this.getNotesOccupied()}setBeatsOccupied(e){return this.beatsOccupiedDeprecationWarning(),this.setNotesOccupied(e)}getNotesOccupied(){return this.notes_occupied}setNotesOccupied(e){this.detach(),this.notes_occupied=e,this.resolveGlyphs(),this.attach()}resolveGlyphs(){this.numerator_glyphs=[];let e=this.num_notes;for(;e>=1;)this.numerator_glyphs.unshift(new p("v"+e%10,this.point)),e=parseInt(e/10,10);for(this.denom_glyphs=[],e=this.notes_occupied;e>=1;)this.denom_glyphs.unshift(new p("v"+e%10,this.point)),e=parseInt(e/10,10)}getNestedTupletCount(){const e=this.location,a=this.notes[0];let b=C(a,e),w=C(a,e);function C(V,z){return V.tupletStack.filter(J=>J.location===z).length}return this.notes.forEach(V=>{const z=C(V,e);b=z>b?z:b,w=z<w?z:w}),b-w}getYPosition(){const e=this.getNestedTupletCount()*I.NESTING_OFFSET*-this.location,a=this.options.y_offset||0,b=this.notes[0];let w;if(this.location===I.LOCATION_TOP){w=b.getStave().getYForLine(0)-15;for(let C=0;C<this.notes.length;++C){const V=this.notes[C].getStemDirection()===L.UP?this.notes[C].getStemExtents().topY-10:this.notes[C].getStemExtents().baseY-20;V<w&&(w=V)}}else{w=b.getStave().getYForLine(4)+20;for(let C=0;C<this.notes.length;++C){const V=this.notes[C].getStemDirection()===L.UP?this.notes[C].getStemExtents().baseY+20:this.notes[C].getStemExtents().topY+10;V>w&&(w=V)}}return w+e+a}draw(){this.checkContext(),this.setRendered();const e=this.notes[0],a=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=e.getTieLeftX()-5,this.width=a.getTieRightX()-this.x_pos+5):(this.x_pos=e.getStemX(),this.width=a.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const b=(z,J)=>z+J.getMetrics().width;let w=this.numerator_glyphs.reduce(b,0);this.ratioed&&(w=this.denom_glyphs.reduce(b,w),w+=.32*this.point);const C=this.x_pos+this.width/2-w/2;if(this.bracketed){const z=this.width/2-w/2-5;z>0&&(this.context.fillRect(this.x_pos,this.y_pos,z,1),this.context.fillRect(this.x_pos+this.width/2+w/2+5,this.y_pos,z,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===I.LOCATION_BOTTOM),1,10*this.location),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===I.LOCATION_BOTTOM),1,10*this.location))}let V=0;if(this.RenderTupletNumber!==!1&&this.numerator_glyphs.forEach(z=>{z.render(this.context,C+V,this.y_pos+this.point/3-2),V+=z.getMetrics().width}),this.ratioed){const z=C+V+.16*this.point,J=.06*this.point;this.context.beginPath(),this.context.arc(z,this.y_pos-.08*this.point,J,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(z,this.y_pos+.12*this.point,J,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),V+=.32*this.point,this.denom_glyphs.forEach(Z=>{Z.render(this.context,C+V,this.y_pos+this.point/3-2),V+=Z.getMetrics().width})}}}function T(ce){let e=0;return ce.forEach(a=>{a.keyProps&&a.keyProps.forEach(b=>{e+=b.line-3})}),e>=0?L.DOWN:L.UP}const A="L",v="B";class B extends o{static getDefaultBeamGroups(e){e&&e!=="c"||(e="4/4");const a={"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"]}[e];if(a!==void 0)return a.map(b=>new s().parse(b));{const b=parseInt(e.split("/")[0],10),w=parseInt(e.split("/")[1],10);if(b%3==0)return[new s(3,w)];if(w>4)return[new s(2,w)];if(w<=4)return[new s(1,w)]}return[new s(1,4)]}static applyAndGetBeams(e,a,b){return B.generateBeams(e.getTickables(),{groups:b,stem_direction:a})}static generateBeams(e,a){a||(a={}),a.groups&&a.groups.length||(a.groups=[new s(2,8)]);const b=a.groups.map(le=>{if(!le.multiply)throw new l.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return le.clone().multiply(m.RESOLUTION,1)}),w=e;let C=0,V=[],z=[];function J(){b.length-1>C?C+=1:C=0}(function(){let le=[];w.forEach(he=>{if(le=[],he.shouldIgnoreTicks())return V.push(z),void(z=le);z.push(he);const pe=b[C].clone(),ge=z.reduce((Ee,Re)=>Re.getTicks().clone().add(Ee),new s(0,1)),me=m.durationToNumber(he.duration)<8;me&&he.tuplet&&(pe.numerator*=2),ge.greaterThan(pe)?(me||le.push(z.pop()),V.push(z),z=le,J()):ge.equals(pe)&&(V.push(z),z=le,J())}),z.length>0&&V.push(z)})(),function(){const le=[];V.forEach(he=>{let pe=[];he.forEach((ge,me,Ee)=>{const Re=me===0||me===Ee.length-1,we=Ee[me-1],Ne=!a.beam_rests&&ge.isRest(),De=a.beam_rests&&a.beam_middle_only&&ge.isRest()&ℜlet Oe=!1;if(a.maintain_stem_directions&&we&&!ge.isRest()&&!we.isRest()){const Ue=we.getStemDirection();Oe=ge.getStemDirection()!==Ue}const ke=parseInt(ge.duration,10)<8;Ne||De||Oe||ke?(pe.length>0&&le.push(pe),pe=Oe?[ge]:[]):pe.push(ge)}),pe.length>0&&le.push(pe)}),V=le}(),V.forEach(le=>{let he;if(a.maintain_stem_directions){const pe=function(ge){for(let me=0;me<ge.length;me++){const Ee=ge[me];if(!Ee.isRest())return Ee}return!1}(le);he=pe?pe.getStemDirection():L.UP}else he=a.stem_direction?a.stem_direction:T(le);(function(pe,ge){pe.forEach(me=>{me.setStemDirection(ge)})})(le,he)});const Z=V.filter(le=>{if(le.length>1){let he=!0;return le.forEach(pe=>{pe.getIntrinsicTicks()>=m.durationToTicks("4")&&(he=!1)}),he}return!1}),re=function(){const le=[];return V.forEach(he=>{let pe=null;he.forEach(ge=>{ge.tuplet&&pe!==ge.tuplet&&(pe=ge.tuplet,le.push(pe))})}),le}(),ae=[];return Z.forEach(le=>{const he=new B(le);a.show_stemlets&&(he.render_options.show_stemlets=!0),a.secondary_breaks&&(he.render_options.secondary_break_ticks=m.durationToTicks(a.secondary_breaks)),a.flat_beams===!0&&(he.render_options.flat_beams=!0,he.render_options.flat_beam_offset=a.flat_beam_offset),ae.push(he)}),re.forEach(le=>{const he=le.notes[0].stem_direction===L.DOWN?I.LOCATION_BOTTOM:I.LOCATION_TOP;le.setTupletLocation(he);let pe=!1;for(let ge=0;ge<le.notes.length;ge++)if(le.notes[ge].beam===null){pe=!0;break}le.setBracketed(pe)}),ae}constructor(e,a){if(super(),this.setAttribute("type","Beam"),!e||e==[])throw new l.RuntimeError("BadArguments","No notes provided for beam.");if(e.length===1)throw new l.RuntimeError("BadArguments","Too few notes for beam.");if(this.ticks=e[0].getIntrinsicTicks(),this.ticks>=m.durationToTicks("4"))throw new l.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let b,w;for(this.stem_direction=L.UP,b=0;b<e.length;++b)if(w=e[b],w.hasStem()){this.stem_direction=w.getStemDirection();break}let C=this.stem_direction;for(a&&e[0].getCategory()==="stavenotes"?C=T(e):a&&e[0].getCategory()==="tabnotes"&&(C=e.reduce((z,J)=>z+J.stem_direction,0)>-1?L.UP:L.DOWN),b=0;b<e.length;++b)w=e[b],a&&(w.setStemDirection(C),this.stem_direction=C),w.setBeam(this);this.postFormatted=!1,this.notes=e,this.beam_count=this.getBeamCount(),this.break_on_indices=[],this.render_options={beam_width:5,max_slope:.25,min_slope:-.25,slope_iterations:20,slope_cost:100,show_stemlets:!1,stemlet_extension:7,partial_beam_length:10,flat_beams:!1,min_flat_beam_offset:15}}getNotes(){return this.notes}getBeamCount(){return this.notes.map(e=>e.getGlyph().beam_count).reduce((e,a)=>a>e?a:e)}breakSecondaryAt(e){return this.break_on_indices=e,this}getSlopeY(e,a,b,w){return b+(e-a)*w}calculateSlope(){const{notes:e,stem_direction:a,render_options:{max_slope:b,min_slope:w,slope_iterations:C,slope_cost:V}}=this,z=e[0],J=((he,pe)=>{const ge=he.getStemExtents().topY,me=he.getStemX();return(pe.getStemExtents().topY-ge)/(pe.getStemX()-me)})(z,e[e.length-1]),Z=(b-w)/C;let re=Number.MAX_VALUE,ae=0,le=0;for(let he=w;he<=b;he+=Z){let pe=0,ge=0;for(let Re=1;Re<e.length;++Re){const we=e[Re],Ne=this.getSlopeY(we.getStemX(),z.getStemX(),z.getStemExtents().topY,he)+ge,De=we.getStemExtents().topY;if(De*a<Ne*a){const Oe=Math.abs(De-Ne);ge+=Oe*-a,pe+=Oe*Re}else pe+=(De-Ne)*a}const me=J/2,Ee=V*Math.abs(me-he)+Math.abs(pe);Ee<re&&(re=Ee,ae=he,le=ge)}this.slope=ae,this.y_shift=le}calculateFlatSlope(){const{notes:e,stem_direction:a,render_options:{beam_width:b,min_flat_beam_offset:w,flat_beam_offset:C}}=this;let V=0,z=0,J=0,Z=0;for(let he=0;he<e.length;he++){const pe=e[he],ge=pe.getStemExtents().topY;V+=ge,a===L.DOWN&&Z<ge?(Z=ge,z=Math.max(...pe.getYs()),J=pe.getBeamCount()):a===L.UP&&(Z===0||Z>ge)&&(Z=ge,z=Math.min(...pe.getYs()),J=pe.getBeamCount())}let re=V/e.length;const ae=w+J*(1.5*b),le=z+ae*-a;a===L.DOWN&&re<le?re=z+ae:a===L.UP&&re>le&&(re=z-ae),C+this.render_options.flat_beam_offset_per_beam>0?(a===L.DOWN&&re>C&&!this.render_options.flat_beams||a===L.UP&&re<C&&!this.render_options.flat_beams)&&(this.render_options.flat_beam_offset=re):this.render_options.flat_beam_offset=re,this.slope=0,this.y_shift=0}getBeamYToDraw(){let e=this.notes[0].getStemExtents().topY;if(this.render_options.flat_beams&&this.render_options.flat_beam_offset+this.render_options.flat_beam_offset_per_beam>0){let a=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(a+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let b=this.notes[0].note_heads[0].y;const w=this.stem_direction>0?Math.min:Math.max;for(const C of this.notes)for(const V of C.note_heads)b=w(b,V.y);e=b+a*-this.stem_direction}return e}applyStemExtensions(){const{notes:e,slope:a,y_shift:b,stem_direction:w,beam_count:C,render_options:{show_stemlets:V,stemlet_extension:z,beam_width:J}}=this,Z=e[0],re=this.getBeamYToDraw(),ae=Z.getStemX();for(let le=0;le<e.length;++le){const he=e[le],pe=he.getStemX(),{topY:ge}=he.getStemExtents(),me=this.getSlopeY(pe,ae,re,a)+b,Ee=he.getStem().getExtension(),Re=w===L.UP?ge-me:me-ge;if(he.stem.setExtension(Ee+Re),he.stem.renderHeightAdjustment=-L.WIDTH/2,he.isRest()&&V){const we=(C-1)*J*1.5+J;he.stem.setVisibility(!0).setStemlet(!0,we+z)}}}lookupBeamDirection(e,a,b,w){if(e==="4")return A;const C=""+m.durationToNumber(e)/2,V=a<m.durationToTicks(C),z=w<m.durationToTicks(C),J=b<m.durationToTicks(C);return V&&z&&J?v:V&&!z&&J?A:!V&&z&&J?"R":this.lookupBeamDirection(C,a,b,w)}getBeamLines(e){const a=m.durationToTicks(e),b=[];let w=!1,C=null;const V=this.render_options.partial_beam_length;let z=!1,J=0;for(let re=0;re<this.notes.length;++re){const ae=this.notes[re];J+=ae.ticks.value();let le=!1;parseInt(e,10)>=8&&(le=this.break_on_indices.indexOf(re)!==-1,this.render_options.secondary_break_ticks&&J>=this.render_options.secondary_break_ticks&&(J=0,le=!0));const he=ae.getIntrinsicTicks()<a,pe=ae.getStemX()-L.WIDTH/2,ge=this.notes[re-1],me=this.notes[re+1],Ee=me&&me.getIntrinsicTicks()<a,Re=ge&&ge.getIntrinsicTicks()<a,we=ge&&me&&he&&!Re&&!Ee;if(he)if(w)C=b[b.length-1],C.end=pe,le&&(w=!1,me&&!Ee&&C.end===null&&(C.end=C.start-V));else{if(C={start:pe,end:null,start_note:ae},w=!0,we){const Ne=ge.getIntrinsicTicks(),De=me.getIntrinsicTicks(),Oe=ae.getIntrinsicTicks(),ke=this.lookupBeamDirection(e,Ne,Oe,De);[A,v].includes(ke)?C.end=C.start-V:C.end=C.start+V}else Ee?le&&(C.end=C.start-V,w=!1):C.end=(z||re===0)&&me?C.start+V:C.start-V;b.push(C)}else w=!1;z=le}const Z=b[b.length-1];return Z&&Z.end===null&&(Z.end=Z.start-V),b}drawStems(){this.notes.forEach(e=>{e.getStem()&&(this.context.openGroup("stem",e.getAttribute("id")+"-stem"),e.getStem().setContext(this.context).draw(),this.context.closeGroup())},this)}drawBeamLines(){this.checkContext();const e=["4","8","16","32","64"],a=this.notes[0];let b=this.getBeamYToDraw();const w=a.getStemX(),C=this.render_options.beam_width*this.stem_direction,V={};for(const z of this.notes)V[z.getAttribute("id")]=0;for(let z=0;z<e.length;++z){const J=e[z],Z=this.getBeamLines(J);for(let re=0;re<Z.length;++re){const ae=Z[re],le=ae.start,he=ae.start_note.getAttribute("id"),pe=V[he];V[he]++;const ge=this.getSlopeY(le,w,b,this.slope),me=ae.end,Ee=this.getSlopeY(me,w,b,this.slope),Re=he;this.context.openGroup("beam",`${Re}-beam${pe}`),this.context.beginPath(),this.context.moveTo(le,ge),this.context.lineTo(le,ge+C),this.context.lineTo(me+L.WIDTH,Ee+C),this.context.lineTo(me+L.WIDTH,Ee),this.context.closePath(),this.context.fill(),this.context.closeGroup()}b+=1.5*C}}preFormat(){return this}postFormat(){if(!this.postFormatted){for(const e of this.notes)e.stem&&e.getStemExtension&&e.stem.setExtension(e.getStemExtension());this.notes[0].getCategory()==="tabnotes"||this.render_options.flat_beams?this.calculateFlatSlope():this.calculateSlope(),this.applyStemExtensions(),this.postFormatted=!0}}draw(){this.checkContext(),this.setRendered(),this.unbeamable||(this.postFormatted||this.postFormat(),this.drawStems(),this.applyStyle(),this.drawBeamLines(),this.restoreStyle())}}class D extends o{static get Mode(){return{STRICT:1,SOFT:2,FULL:3}}constructor(e){if(super(),this.setAttribute("type","Voice"),typeof e=="string"){const a=e.match(/(\d+)\/(\d+)/);a&&(e={num_beats:a[1],beat_value:a[2],resolution:m.RESOLUTION})}this.time=l.Merge({num_beats:4,beat_value:4,resolution:m.RESOLUTION},e),this.totalTicks=new s(this.time.num_beats*(this.time.resolution/this.time.beat_value),1),this.resolutionMultiplier=1,this.tickables=[],this.ticksUsed=new s(0,1),this.smallestTickCount=this.totalTicks.clone(),this.largestTickWidth=0,this.stave=null,this.mode=D.Mode.STRICT,this.voiceGroup=null}getTotalTicks(){return this.totalTicks}getTicksUsed(){return this.ticksUsed}getLargestTickWidth(){return this.largestTickWidth}getSmallestTickCount(){return this.smallestTickCount}getTickables(){return this.tickables}getMode(){return this.mode}setMode(e){return this.mode=e,this}getResolutionMultiplier(){return this.resolutionMultiplier}getActualResolution(){return this.resolutionMultiplier*this.time.resolution}setStave(e){return this.stave=e,this.boundingBox=null,this}getBoundingBox(){let e,a,b,w;if(!this.boundingBox){if(!this.stave)throw new l.RERR("NoStave","Can't get bounding box without stave.");for(e=this.stave,a=null,w=0;w<this.tickables.length;++w)this.tickables[w].setStave(e),b=this.tickables[w].getBoundingBox(),b&&(a=a?a.mergeWith(b):b);this.boundingBox=a}return this.boundingBox}getVoiceGroup(){if(!this.voiceGroup)throw new l.RERR("NoVoiceGroup","No voice group for voice.");return this.voiceGroup}setVoiceGroup(e){return this.voiceGroup=e,this}setStrict(e){return this.mode=e?D.Mode.STRICT:D.Mode.SOFT,this}isComplete(){return this.mode!==D.Mode.STRICT&&this.mode!==D.Mode.FULL||this.ticksUsed.equals(this.totalTicks)}addTickable(e){if(!e.shouldIgnoreTicks()){const a=e.getTicks();if(this.ticksUsed.add(a),(this.mode===D.Mode.STRICT||this.mode===D.Mode.FULL)&&this.ticksUsed.greaterThan(this.totalTicks))throw this.ticksUsed.subtract(a),new l.RERR("BadArgument","Too many ticks.");a.lessThan(this.smallestTickCount)&&(this.smallestTickCount=a.clone()),this.resolutionMultiplier=this.ticksUsed.denominator,this.totalTicks.add(0,this.ticksUsed.denominator)}return this.tickables.push(e),e.setVoice(this),this}addTickables(e){for(let a=0;a<e.length;++a)this.addTickable(e[a]);return this}preFormat(){return this.preFormatted||(this.tickables.forEach(e=>{e.getStave()||e.setStave(this.stave)}),this.preFormatted=!0),this}draw(e=this.context,a=this.stave){this.setRendered();let b=null;for(let w=0;w<this.tickables.length;++w){const C=this.tickables[w];if(a&&C.setStave(a),!C.getStave())throw new l.RuntimeError("MissingStave","The voice cannot draw tickables without staves.");if(w===0&&(b=C.getBoundingBox()),w>0&&b){const V=C.getBoundingBox();V&&b.mergeWith(V)}C.setContext(e),C.drawWithStyle()}this.boundingBox=b}}function _(ce,e,a,b,w){if(e!==F.type.BOLD_DOUBLE_LEFT&&e!==F.type.BOLD_DOUBLE_RIGHT)throw new l.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let C=3,V=3.5;e===F.type.BOLD_DOUBLE_RIGHT&&(C=-5,V=3),ce.fillRect(a+C,b,1,w-b),ce.fillRect(a-2,b,V,w-b)}class F extends o{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:F.type.SINGLE_RIGHT,singleLeft:F.type.SINGLE_LEFT,single:F.type.SINGLE,double:F.type.DOUBLE,brace:F.type.BRACE,bracket:F.type.BRACKET,boldDoubleLeft:F.type.BOLD_DOUBLE_LEFT,boldDoubleRight:F.type.BOLD_DOUBLE_RIGHT,thinDouble:F.type.THIN_DOUBLE,none:F.type.NONE}}constructor(e,a){super(),this.setAttribute("type","StaveConnector"),this.thickness=m.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=e,this.bottom_stave=a,this.type=F.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(e){return(e=typeof e=="string"?F.typeString[e]:e)>=F.type.SINGLE_RIGHT&&e<=F.type.NONE&&(this.type=e),this}setText(e,a){return this.texts.push({content:e,options:l.Merge({shift_x:0,shift_y:0},a)}),this}setFont(e){l.Merge(this.font,e)}setXShift(e){if(typeof e!="number")throw l.RERR("InvalidType","x_shift must be a Number");return this.x_shift=e,this}draw(){const e=this.checkContext();this.setRendered();let a=this.top_stave.getYForLine(0),b=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,w=this.width,C=this.top_stave.getX();(this.type===F.type.SINGLE_RIGHT||this.type===F.type.BOLD_DOUBLE_RIGHT||this.type===F.type.THIN_DOUBLE)&&(C=this.top_stave.getX()+this.top_stave.width);let V=b-a;switch(this.type){case F.type.SINGLE:case F.type.SINGLE_LEFT:case F.type.SINGLE_RIGHT:w=1;break;case F.type.DOUBLE:C-=this.width+2;break;case F.type.BRACE:{w=12;const z=this.top_stave.getX()-2+this.x_shift,J=a,Z=z,re=b,ae=z-w,le=J+V/2,he=ae-.9*w,pe=J+.2*V,ge=z+1.1*w,me=le-.135*V,Ee=ge,Re=le+.135*V,we=he,Ne=re-.2*V,De=ae-w,Oe=Ne,ke=z+.4*w,Ue=le+.135*V,Ge=ke,nt=le-.135*V,Qe=De,$e=pe;e.beginPath(),e.moveTo(z,J),e.bezierCurveTo(he,pe,ge,me,ae,le),e.bezierCurveTo(Ee,Re,we,Ne,Z,re),e.bezierCurveTo(De,Oe,ke,Ue,ae,le),e.bezierCurveTo(Ge,nt,Qe,$e,z,J),e.fill(),e.stroke();break}case F.type.BRACKET:a-=4,b+=4,V=b-a,p.renderGlyph(e,C-5,a-3,40,"v1b",!0),p.renderGlyph(e,C-5,b+3,40,"v10",!0),C-=this.width+2;break;case F.type.BOLD_DOUBLE_LEFT:_(e,this.type,C+this.x_shift,a,b);break;case F.type.BOLD_DOUBLE_RIGHT:_(e,this.type,C,a,b);break;case F.type.THIN_DOUBLE:w=1;break;case F.type.NONE:break;default:throw new l.RERR("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid`)}this.type!==F.type.BRACE&&this.type!==F.type.BOLD_DOUBLE_LEFT&&this.type!==F.type.BOLD_DOUBLE_RIGHT&&this.type!==F.type.NONE&&e.fillRect(C,a,w,V),this.type===F.type.THIN_DOUBLE&&e.fillRect(C-3,a,w,V),e.save(),e.lineWidth=2,e.setFont(this.font.family,this.font.size,this.font.weight);for(let z=0;z<this.texts.length;z++){const J=this.texts[z],Z=e.measureText(""+J.content).width,re=this.top_stave.getX()-Z-24+J.options.shift_x,ae=(this.top_stave.getYForLine(0)+this.bottom_stave.getBottomLineY())/2+J.options.shift_y;e.fillText(""+J.content,re,ae+4)}e.restore()}}class k extends o{constructor(){super(),this.setAttribute("type","Tickable"),this.ticks=new s(0,1),this.intrinsicTicks=0,this.tickMultiplier=new s(1,1),this.width=0,this.x_shift=0,this.voice=null,this.tickContext=null,this.modifierContext=null,this.modifiers=[],this.preFormatted=!1,this.postFormatted=!1,this.tuplet=null,this.tupletStack=[],this.align_center=!1,this.center_x_shift=0,this.ignore_ticks=!1,this.formatterMetrics={freedom:{left:0,right:0},duration:"",iterations:0,space:{used:0,mean:0,deviation:0}}}reset(){return this}getTicks(){return this.ticks}shouldIgnoreTicks(){return this.ignore_ticks}getWidth(){return this.width}getFormatterMetrics(){return this.formatterMetrics}setXShift(e){this.x_shift=e}getCenterXShift(){return this.isCenterAligned()?this.center_x_shift:0}isCenterAligned(){return this.align_center}setCenterAlignment(e){return this.align_center=e,this}getVoice(){if(!this.voice)throw new l.RERR("NoVoice","Tickable has no voice.");return this.voice}setVoice(e){this.voice=e}getTuplet(){return this.tuplet}resetTuplet(e){let a,b;if(e){const w=this.tupletStack.indexOf(e);return w!==-1&&(this.tupletStack.splice(w,1),a=e.getNoteCount(),b=e.getNotesOccupied(),this.applyTickMultiplier(a,b)),this}for(;this.tupletStack.length;)a=(e=this.tupletStack.pop()).getNoteCount(),b=e.getNotesOccupied(),this.applyTickMultiplier(a,b);return this}setTuplet(e){if(e){this.tupletStack.push(e);const a=e.getNoteCount(),b=e.getNotesOccupied();this.applyTickMultiplier(b,a)}return this.tuplet=e,this}addToModifierContext(e){this.modifierContext=e,this.preFormatted=!1}addModifier(e){return this.modifiers.push(e),this.preFormatted=!1,this}getModifiers(){return this.modifiers}setTickContext(e){this.tickContext=e,this.preFormatted=!1}preFormat(){this.preFormatted||(this.width=0,this.modifierContext&&(this.modifierContext.preFormat(),this.width+=this.modifierContext.getWidth()))}postFormat(){return this.postFormatted||(this.postFormatted=!0),this}getIntrinsicTicks(){return this.intrinsicTicks}setIntrinsicTicks(e){this.intrinsicTicks=e,this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks)}getTickMultiplier(){return this.tickMultiplier}applyTickMultiplier(e,a){this.tickMultiplier.multiply(e,a),this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks)}setDuration(e){const a=e.numerator*(m.RESOLUTION/e.denominator);this.ticks=this.tickMultiplier.clone().multiply(a),this.intrinsicTicks=this.ticks.value()}}class j extends k{static get CATEGORY(){return"note"}static get STAVEPADDING(){return 12}static plotMetrics(e,a,b){const w=a.getMetrics(),C=a.getAbsoluteX()-w.modLeftPx-w.extraLeftPx,V=a.getAbsoluteX()-w.extraLeftPx,z=a.getAbsoluteX(),J=a.getAbsoluteX()+w.noteWidth,Z=a.getAbsoluteX()+w.noteWidth+w.extraRightPx,re=a.getAbsoluteX()+w.noteWidth+w.extraRightPx+w.modRightPx,ae=re+a.getFormatterMetrics().freedom.right,le=re-C;e.save(),e.setFont("Arial",8,""),e.fillText(Math.round(le)+"px",C+a.getXShift(),b);const he=b+7;function pe(me,Ee,Re,we=he){e.beginPath(),e.setStrokeStyle(Re),e.setFillStyle(Re),e.setLineWidth(3),e.moveTo(me+a.getXShift(),we),e.lineTo(Ee+a.getXShift(),we),e.stroke()}pe(C,V,"red"),pe(V,z,"#999"),pe(z,J,"green"),pe(J,Z,"#999"),pe(Z,re,"red"),pe(re,ae,"#DD0"),pe(C-a.getXShift(),C,"#BBB"),l.drawDot(e,z+a.getXShift(),he,"blue");const ge=a.getFormatterMetrics();if(ge.iterations>0){const me=ge.space.deviation,Ee=me>=0?"+":"";e.setFillStyle("red"),e.fillText(Ee+Math.round(me),z+a.getXShift(),b-10)}e.restore()}constructor(e){if(super(),this.setAttribute("type","Note"),!e)throw new l.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const a=m.parseNoteStruct(e);if(!a)throw new l.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(e)}`);if(this.duration=a.duration,this.dots=a.dots,this.noteType=a.type,this.customTypes=a.customTypes,e.duration_override?this.setDuration(e.duration_override):this.setIntrinsicTicks(a.ticks),this.modifiers=[],this.glyph=m.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(b=>m.getGlyphProps(this.duration,b)),this.positions&&(typeof this.positions!="object"||!this.positions.length))throw new l.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=[],e.align_center&&this.setCenterAlignment(e.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:j.STAVEPADDING}}getPlayNote(){return this.playNote}setPlayNote(e){return this.playNote=e,this}isRest(){return!1}addStroke(e,a){return a.setNote(this),a.setIndex(e),this.modifiers.push(a),this.setPreFormatted(!1),this}getStave(){return this.stave}setStave(e){return this.stave=e,this.setYs([e.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return j.CATEGORY}setContext(e){return this.context=e,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(e){return this.extraLeftPx=e,this}setExtraRightPx(e){return this.extraRightPx=e,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(e){return this.ys=e,this}getYs(){if(this.ys.length===0)throw new l.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(e){if(!this.stave)throw new l.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(e)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new l.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(e){return this.voice=e,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(e){return this.tickContext=e,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(e){return this.modifierContext=e,this}addModifier(e,a=0){return e.setNote(this),e.setIndex(a),this.modifiers.push(e),this.setPreFormatted(!1),this}getModifierStartXY(){if(!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let e=0,a=0;this.modifierContext!=null&&(e=this.modifierContext.state.left_shift,a=this.modifierContext.state.right_shift);const b=this.getWidth();return{width:b,noteWidth:b-e-a-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:e,modRightPx:a,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(e){this.width=e}getWidth(){if(!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}setXShift(e){return this.x_shift=e,this}getXShift(){return this.x_shift}getX(){if(!this.tickContext)throw new l.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}getAbsoluteX(){if(!this.tickContext)throw new l.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");let e=this.tickContext.getX();return this.stave&&(e+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(e+=this.getCenterXShift()),e}setPreFormatted(e){if(this.preFormatted=e,this.preFormatted){const a=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,a.left),this.right_modPx=Math.max(this.right_modPx,a.right)}}}class P extends j{static get CATEGORY(){return"notehead"}constructor(e){if(super(e),this.setAttribute("type","NoteHead"),this.index=e.index,this.x_shift=e.x_shift||0,this.x=(e.x||0)+this.x_shift,this.y=e.y||0,this.note_type=e.note_type,this.duration=e.duration,this.displaced=e.displaced||!1,this.stem_direction=e.stem_direction||oe.STEM_UP,this.line=e.line,this.glyph=m.getGlyphProps(this.duration,this.note_type),!this.glyph)throw new l.RuntimeError("BadArguments",`No glyph found for duration '${this.duration}' and type '${this.note_type}'`);this.glyph_code=this.glyph.code_head,this.x_shift_ledger_rest=0,this.y_shift_ledger_rest=0,this.x_shift=e.x_shift||0,this.glyph.rest&&(this.line>5||this.line<0)&&(this.isLedgerLinedRest=!0,this.duration==="h"?(e.custom_glyph_code="rhl",this.x_shift_ledger_rest-=4):this.duration==="w"&&(e.custom_glyph_code="rwl",this.x_shift_ledger_rest-=4,this.y_shift_ledger_rest=-5)),e.custom_glyph_code&&(this.custom_glyph=!0,this.glyph_code=e.custom_glyph_code,this.stem_up_x_offset=e.stem_up_x_offset||0,this.stem_down_x_offset=e.stem_down_x_offset||0,this.stem_up_y_shift=e.stem_up_y_shift||0,this.stem_down_y_shift=e.stem_down_y_shift||0),this.style=e.style,this.slashed=e.slashed,l.Merge(this.render_options,{glyph_font_scale:e.glyph_font_scale||m.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),this.setWidth(this.glyph.getWidth(this.render_options.glyph_font_scale))}getCategory(){return P.CATEGORY}getWidth(){return this.width}isDisplaced(){return this.displaced===!0}getGlyph(){return this.glyph}setX(e){return this.x=e,this}getY(){return this.y}setY(e){return this.y=e,this}getLine(){return this.line}setLine(e){return this.line=e,this}getAbsoluteX(){const e=this.preFormatted?super.getAbsoluteX():this.x,a=L.WIDTH/2;return e+(this.displaced?(this.width-a)*this.stem_direction:0)}getBoundingBox(){if(!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const e=this.stave.getSpacingBetweenLines(),a=e/2,b=this.y-a;return new m.BoundingBox(this.getAbsoluteX(),b,this.width,e)}setStave(e){const a=this.getLine();return this.stave=e,this.setY(e.getYForNote(a)),this.context=this.stave.context,this}preFormat(){if(this.preFormatted)return this;const e=this.getWidth()+this.extraLeftPx+this.extraRightPx;return this.setWidth(e),this.setPreFormatted(!0),this}draw(){this.checkContext(),this.setRendered();const e=this.context;let a=this.getAbsoluteX(),b=this.y;this.custom_glyph&&(a+=this.x_shift_ledger_rest,this.stem_direction===L.UP?(a+=this.stem_up_x_offset,b+=this.stem_up_y_shift||0):this.stem_direction===L.DOWN&&(a+=this.stem_down_x_offset,b+=this.stem_down_y_shift||0),b+=this.y_shift_ledger_rest),function(...V){P.DEBUG&&l.L("Vex.Flow.NoteHead",V)}("Drawing note head '",this.note_type,this.duration,"' at",a,b);const w=this.stem_direction,C=this.render_options.glyph_font_scale;if(this.style&&this.applyStyle(e),this.note_type==="s"){const V=this.stave.getSpacingBetweenLines();(function(z,J,Z,re,ae,le){const he=m.SLASH_NOTEHEAD_WIDTH;z.save(),z.setLineWidth(m.STEM_WIDTH);let pe=!1;if(m.durationToNumber(J)>2&&(pe=!0),pe||(Z-=m.STEM_WIDTH/2*ae),z.beginPath(),z.moveTo(Z,re+le),z.lineTo(Z,re+1),z.lineTo(Z+he,re-le),z.lineTo(Z+he,re),z.lineTo(Z,re+le),z.closePath(),pe?z.fill():z.stroke(),m.durationToFraction(J).equals(.5)){const ge=[-3,-1,he+1,he+3];for(let me=0;me<ge.length;me++)z.beginPath(),z.moveTo(Z+ge[me],re-10),z.lineTo(Z+ge[me],re+11),z.stroke()}z.restore()})(e,this.duration,a,b,w,V)}else p.renderGlyph(e,a,b,C,this.glyph_code,this.id);this.style&&this.restoreStyle(e)}}class G extends j{constructor(e){super(e),this.setAttribute("type","StemmableNote"),this.stem=null,this.stemExtensionOverride=null,this.beam=null,this.renderFlag=!0}getStem(){return this.stem}setStem(e){return this.stem=e,this}buildStem(){const e=new L;return this.setStem(e),this}buildFlag(){const{glyph:e,beam:a}=this,b=a===null&&this.renderFlag;if(e&&e.flag&&b){const w=this.getStemDirection()===L.DOWN?e.code_flag_downstem:e.code_flag_upstem;this.flag=new p(w,this.render_options.glyph_font_scale)}}getTopGlyph(){return this.getStemDirection()===L.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}getStemLength(){return L.HEIGHT+this.getStemExtension()}getBeamCount(){const e=this.getGlyph();return e?e.beam_count:0}getStemMinumumLength(){let e=m.durationToFraction(this.duration).value()<=1?0:20;switch(this.duration){case"8":this.beam==null&&(e=35);break;case"16":e=this.beam==null?35:25;break;case"32":e=this.beam==null?45:35;break;case"64":e=this.beam==null?50:40;break;case"128":e=this.beam==null?55:45}return e}getStemDirection(){return this.stem_direction}setStemDirection(e){if(e||(e=L.UP),e!==L.UP&&e!==L.DOWN)throw new l.RERR("BadArgument",`Invalid stem direction: ${e}`);if(this.stem_direction=e,this.stem){this.stem.setDirection(e),this.stem.setExtension(this.getStemExtension());const a=this.getTopGlyph()||this.getGlyph();this.stem.setOptions({stem_up_y_offset:a.stem_up_y_offset,stem_down_y_offset:a.stem_down_y_offset})}return this.reset(),this.flag&&this.renderFlag&&this.buildFlag(),this.beam=null,this.preFormatted&&this.preFormat(),this}getStemX(){const e=this.getAbsoluteX()+this.x_shift,a=this.getAbsoluteX()+this.x_shift+this.getGlyphWidth();return this.stem_direction===L.DOWN?e:a}getCenterGlyphX(){return this.getAbsoluteX()+this.x_shift+this.getGlyphWidth()/2}getStemExtension(){const e=this.getGlyph();return this.stemExtensionOverride!=null?this.stemExtensionOverride:e?this.getStemDirection()===1?e.stem_up_extension:e.stem_down_extension:0}setStemLength(e){return this.stemExtensionOverride=e-L.HEIGHT,this}getStemExtents(){return this.stem.getExtents()}setBeam(e){return this.beam=e,this}getYForTopText(e){const a=this.getStemExtents();return this.hasStem()?Math.min(this.stave.getYForTopText(e),a.topY-this.render_options.annotation_spacing*(e+1)):this.stave.getYForTopText(e)}getYForBottomText(e){const a=this.getStemExtents();return this.hasStem()?Math.max(this.stave.getYForTopText(e),a.baseY+this.render_options.annotation_spacing*e):this.stave.getYForBottomText(e)}hasFlag(){return this.renderFlag&&m.getGlyphProps(this.duration).flag&&!this.beam}postFormat(){return this.beam&&this.beam.postFormat(),this.postFormatted=!0,this}drawStem(e){this.checkContext(),this.setRendered(),this.setStem(new L(e)),this.stem.setContext(this.context).draw()}}class Y extends o{static get CATEGORY(){return"none"}static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4}}static get PositionString(){return{above:Y.Position.ABOVE,below:Y.Position.BELOW,left:Y.Position.LEFT,right:Y.Position.RIGHT}}constructor(){super(),this.setAttribute("type","Modifier"),this.width=0,this.note=null,this.index=null,this.text_line=0,this.position=Y.Position.LEFT,this.modifier_context=null,this.x_shift=0,this.y_shift=0,this.spacingFromNextModifier=0}getCategory(){return Y.CATEGORY}getWidth(){return this.width}setWidth(e){return this.width=e,this}getNote(){return this.note}setNote(e){return this.note=e,this}getIndex(){return this.index}setIndex(e){return this.index=e,this}getModifierContext(){return this.modifier_context}setModifierContext(e){return this.modifier_context=e,this}getPosition(){return this.position}setPosition(e){return this.position=typeof e=="string"?Y.PositionString[e]:e,this}setTextLine(e){return this.text_line=e,this}setYShift(e){return this.y_shift=e,this}setSpacingFromNextModifier(e){this.spacingFromNextModifier=e}getSpacingFromNextModifier(){return this.spacingFromNextModifier}setXShift(e){this.x_shift=0,this.position===Y.Position.LEFT?this.x_shift-=e:this.x_shift+=e}getXShift(){return this.x_shift}draw(){throw this.checkContext(),new l.RERR("MethodNotImplemented","draw() not implemented for this modifier.")}alignSubNotesWithNote(e,a){const b=a.getTickContext(),w=b.getExtraPx(),C=b.getX()-w.left-w.extraLeft+this.getSpacingFromNextModifier();e.forEach(V=>{const z=V.getTickContext();V.setStave(a.stave),z.setXOffset(C)})}}class X extends Y{static get CATEGORY(){return"dots"}static format(e,a){const b=a.right_shift;if(!e||e.length===0)return!1;const w=[],C={};for(let le=0;le<e.length;++le){const he=e[le],pe=he.getNote();let ge,me;typeof pe.getKeyProps=="function"?(ge=pe.getKeyProps()[he.getIndex()],me=ge.displaced?pe.getExtraRightPx():0):(ge={line:.5},me=0);const Ee=pe.getAttribute("id");w.push({line:ge.line,note:pe,note_id:Ee,dot:he}),C[Ee]=Math.max(C[Ee]||me,me)}w.sort((le,he)=>he.line-le.line);let V=b,z=0,J=null,Z=null,re=null,ae=0;for(let le=0;le<w.length;++le){const{dot:he,note:pe,note_id:ge,line:me}=w[le];me===J&&pe===Z||(V=C[ge]),pe.isRest()||me===J||(Math.abs(me%1)===.5?ae=0:(ae=.5,Z==null||Z.isRest()||J-me!==.5?me+ae===re&&(ae=-.5):ae=-.5)),pe.isRest()?he.dot_shiftY+=-ae:he.dot_shiftY=-ae,re=me+ae,he.setXShift(V),V+=he.getWidth()+1,z=V>z?V:z,J=me,Z=pe}return a.right_shift+=z,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=Y.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return X.CATEGORY}setNote(e){this.note=e,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(e){return this.dot_shiftY=e,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index===null)throw new l.RERR("NoAttachedNote","Can't draw dot without a note and index.");const e=this.note.stave.options.spacing_between_lines_px,a=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(a.y=this.note.getStemExtents().baseY);const b=a.x+this.x_shift+this.width-this.radius,w=a.y+this.y_shift+this.dot_shiftY*e,C=this.context;C.beginPath(),C.arc(b,w,this.radius,0,2*Math.PI,!1),C.fill()}}function ie(ce,e,a){if(ce.note.shiftRestVerticalDisabled)return;const b=(e.isrest?0:1)*a;ce.line+=b,ce.maxLine+=b,ce.minLine+=b,ce.note.setKeyLine(0,ce.note.getKeyLine(0)+b)}class oe extends G{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return L.UP}static get STEM_DOWN(){return L.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static format(e,a){if(!e||e.length<2)return!1;const b=[],w=e[0].stagger_same_whole_notes;for(let le=0;le<e.length;le++){const he=e[le].getKeyProps(),pe=he[0].line;let ge=he[he.length-1].line;const me=e[le].getStemDirection(),Ee=e[le].getStemLength()/10,Re=e[le].getStemMinumumLength()/10;let we;e[le].isRest()?(we=pe+e[le].glyph.line_above,ge=pe-e[le].glyph.line_below):(we=me===1?he[he.length-1].line+Ee:he[he.length-1].line,ge=me===1?he[0].line:he[0].line-Ee),b.push({line:he[0].line,maxLine:we,minLine:ge,isrest:e[le].isRest(),stemDirection:me,stemMax:Ee,stemMin:Re,voice_shift:e[le].getVoiceShiftWidth(),is_displaced:e[le].isDisplaced(),note:e[le]})}const C=b.length;let V=b[0];const z=C>2?b[1]:null;let J=C>2?b[2]:b[1];C!==2||V.stemDirection!==-1||J.stemDirection!==1||V.isrest||J.isRest||(V=b[1],J=b[0]);const Z=Math.max(V.voice_shift,J.voice_shift);let re,ae=0;if(C===2){const le=V.stemDirection===J.stemDirection?0:.5;if(V.stemDirection===J.stemDirection&&V.minLine<=J.maxLine&&(V.isrest||(re=Math.abs(V.line-(J.maxLine+.5)),re=Math.max(re,V.stemMin),V.minLine=V.line-re,V.note.setStemLength(10*re))),V.minLine<=J.maxLine+le)if(V.isrest)ie(V,J,1),V.note.hasLedgerLinedRest&&(V.note.shiftRestVerticalDisabled=!0);else if(J.isrest)ie(J,V,-1),J.note.hasLedgerLinedRest&&(J.note.shiftRestVerticalDisabled=!0);else{ae=Z;const he=Math.abs(V.line-J.line);let pe=0,ge=0;V.note.duration==="h"?pe++:V.note.duration==="w"&&ge++,J.note.duration==="h"?pe++:J.note.duration==="w"&&ge++;let me=pe===1||ge===1||V.note.dots!==J.note.dots;if(w&&(me||(me=ge===2)),he===0&&me){if(J.note.setXShift(ae),V.note.dots>0){let Ee=0;for(const Re of V.note.modifiers)if(Re instanceof X&&(Ee++,Re.setYShift(-10*(J.maxLine-V.line+1)),Ee===V.note.dots))break}}else he<1&&he>0?J.note.setXShift(ae):V.note.voice!==J.note.voice&&V.stemDirection===J.stemDirection&&(V.line>J.line?V.stemDirection===1?J.note.renderFlag=!1:V.note.renderFlag=!1:J.line>V.line?J.stemDirection===1?V.note.renderFlag=!1:J.note.renderFlag=!1:J.stemDirection===1&&(J.stemDirection=-1,J.note.setStemDirection(-1)))}return!0}return z!==null&&z.minLine<J.maxLine+.5&&(z.isrest||(re=Math.abs(z.line-(J.maxLine+.5)),re=Math.max(re,z.stemMin),z.minLine=z.line-re,z.note.setStemLength(10*re))),z.isrest&&!V.isrest&&!J.isrest&&(V.minLine<=z.maxLine||z.minLine<=J.maxLine)?(z.maxLine-z.minLine<V.minLine-J.maxLine?function(le,he,pe){const ge=le.line-l.MidLine(he.minLine,pe.maxLine);le.note.setKeyLine(0,le.note.getKeyLine(0)-ge),le.line-=ge,le.maxLine-=ge,le.minLine-=ge}(z,V,J):(ae=Z+3,z.note.setXShift(ae)),!0):V.isrest&&z.isrest&&J.isrest?(ie(V,z,1),ie(J,z,-1),!0):(z.isrest&&V.isrest&&z.minLine<=J.maxLine&&ie(z,J,1),z.isrest&&J.isrest&&V.minLine<=z.maxLine&&ie(z,V,-1),V.isrest&&V.minLine<=z.maxLine&&ie(V,z,1),J.isrest&&z.minLine<=J.maxLine&&ie(J,z,-1),(!V.isrest&&!z.isrest&&V.minLine<=z.maxLine+.5||!z.isrest&&!J.isrest&&z.minLine<=J.maxLine)&&(ae=Z+3,z.note.setXShift(ae)),!0)}static formatByY(e,a){let b=!0;for(let C=0;C<e.length;C++)b=b&&e[C].getStave()!=null;if(!b)throw new l.RERR("Stave Missing","All notes must have a stave - Vex.Flow.ModifierContext.formatMultiVoice!");let w=0;for(let C=0;C<e.length-1;C++){let V=e[C],z=e[C+1];V.maxLine<z.maxLine&&(V=e[C+1],z=e[C]);const J=V.getKeyProps(),Z=z.getKeyProps(),re=.5,ae=V.getStave().getYForLine(5-J[0].line+re);z.getStave().getYForLine(5-Z[Z.length-1].line-re)-ae<0&&V.voice===z.voice&&(w=V.getVoiceShiftWidth()+2,z.setXShift(w))}a.right_shift+=w}static postFormat(e){return!!e&&(e.forEach(a=>a.postFormat()),!0)}constructor(e){if(super(e),this.setAttribute("type","StaveNote"),this.keys=e.keys,this.clef=e.clef,this.octave_shift=e.octave_shift,this.beam=null,this.glyph=m.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new l.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(e)}`);this.displaced=!1,this.dot_shiftY=0,this.addDotsCount=0,this.keyProps=[],this.use_default_head_x=!1,this.paddingRight=0,this.note_heads=[],this.modifiers=[],l.Merge(this.render_options,{glyph_font_scale:e.glyph_font_scale||m.DEFAULT_NOTATION_FONT_SCALE,stroke_px:e.stroke_px||oe.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),e.auto_stem?this.autoStem():this.setStemDirection(e.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();const e=this.note_heads.map(b=>b.getStyle()),a=[];this.note_heads.forEach(b=>a.push(b.note_type)),this.buildNoteHeads(),this.note_heads.forEach((b,w)=>{b.setStyle(e[w]),a[w]&&(b.note_type=a[w])}),this.stave&&this.note_heads.forEach(b=>b.setStave(this.stave)),this.calcExtraPx()}setBeam(e){return this.beam=e,this.calcExtraPx(),this}getCategory(){return oe.CATEGORY}buildStem(){this.setStem(new L({hide:!!this.isRest()})),this.stem.id=l.Prefix(`${this.getAttribute("id")}-stem`)}buildNoteHeads(){this.note_heads=[];const e=this.getStemDirection(),a=this.getKeys();let b,w,C,V=null,z=null,J=!1;e===L.UP?(b=0,w=a.length,C=1):e===L.DOWN&&(b=a.length-1,w=-1,C=-1);for(let Z=b;Z!==w;Z+=C){const re=this.keyProps[Z],ae=re.line;V===null?V=ae:(z=Math.abs(V-ae),z===0||z===.5?J=!J:(J=!1,this.use_default_head_x=!0)),V=ae;const le=new P({duration:this.duration,note_type:this.noteType,displaced:J,stem_direction:e,custom_glyph_code:re.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:re.shift_right,stem_up_x_offset:re.stem_up_x_offset,stem_down_x_offset:re.stem_down_x_offset,stem_up_y_shift:re.stem_up_y_shift,stem_down_y_shift:re.stem_down_y_shift,line:re.line});le.isLedgerLinedRest&&(this.hasLedgerLinedRest=!0),le.id=this.stem.id=l.Prefix(`${this.getAttribute("id")}-stem${Z}`),this.note_heads[Z]=le}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const e=(this.minLine+this.maxLine)/2<3?L.UP:L.DOWN;this.setStemDirection(e)}calculateKeyProps(){let e=null;for(let a=0;a<this.keys.length;++a){const b=this.keys[a];this.glyph.rest&&(this.glyph.position=b);const w={octave_shift:this.octave_shift||0},C=m.keyProperties(b,this.clef,w);if(!C)throw new l.RuntimeError("BadArguments",`Invalid key for note properties: ${b}`);C.key==="R"&&(this.duration==="1"||this.duration==="w"?C.line=4:C.line=3);const V=C.line;e===null?e=V:Math.abs(e-V)<1&&(this.displaced=!0,C.displaced=!0,this.keyProps.length>0&&(this.keyProps[a-1].displaced=!0)),e=V,this.keyProps.push(C)}e=-1/0,this.keyProps.forEach(a=>{a.line<e&&l.W("Unsorted keys in note will be sorted. See https://github.com/0xfe/vexflow/issues/104 for details."),e=a.line}),this.keyProps.sort((a,b)=>a.line-b.line)}getBoundingBox(){if(!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:e,modLeftPx:a,extraLeftPx:b}=this.getMetrics(),w=this.getAbsoluteX()-a-b-this.paddingRight;let C=0,V=0;const z=this.getStave().getSpacingBetweenLines()/2,J=2*z;if(this.isRest()){const Z=this.ys[0],re=m.durationToFraction(this.duration);re.equals(1)||re.equals(2)?(C=Z-z,V=Z+z):(C=Z-this.glyph.line_above*J,V=Z+this.glyph.line_below*J)}else if(this.glyph.stem){const Z=this.getStemExtents();Z.baseY+=z*this.stem_direction,C=Math.min(Z.topY,Z.baseY),V=Math.max(Z.topY,Z.baseY)}else{C=null,V=null;for(let Z=0;Z<this.ys.length;++Z){const re=this.ys[Z];Z===0?(C=re,V=re):(C=Math.min(re,C),V=Math.max(re,V))}C-=z,V+=z}return new h(w,C,e,V-C)}getLineNumber(e){if(!this.keyProps.length)throw new l.RERR("NoKeyProps","Can't get bottom note line, because note is not initialized properly.");let a=this.keyProps[0].line;for(let b=0;b<this.keyProps.length;b++){const w=this.keyProps[b].line;e?w>a&&(a=w):w<a&&(a=w)}return a}isRest(){return this.glyph.rest}isChord(){return!this.isRest()&&this.keys.length>1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()&&this.renderFlag}getStemX(){return this.noteType==="r"?this.getCenterGlyphX():super.getStemX()+L.WIDTH/(2*-this.getStemDirection())}getYForTopText(e){const a=this.getStemExtents();return Math.min(this.stave.getYForTopText(e),a.topY-this.render_options.annotation_spacing*(e+1))}getYForBottomText(e){const a=this.getStemExtents();return Math.max(this.stave.getYForTopText(e),a.baseY+this.render_options.annotation_spacing*e)}setStave(e){super.setStave(e);const a=this.note_heads.map(b=>(b.setStave(e),b.getY()));if(this.setYs(a),this.stem){const{y_top:b,y_bottom:w}=this.getNoteHeadBounds();this.stem.setYBounds(b,w)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(e){return this.displaced=e,this}getTieRightX(){let e=this.getAbsoluteX();return e+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(e+=this.modifierContext.getExtraRightPx()),e}getTieLeftX(){let e=this.getAbsoluteX();return e+=this.x_shift-this.extraLeftPx,e}getLineForRest(){let e=this.keyProps[0].line;if(this.keyProps.length>1){const a=this.keyProps[this.keyProps.length-1].line,b=Math.max(e,a),w=Math.min(e,a);e=l.MidLine(b,w)}return e}getModifierStartXY(e,a,b){if(b=b||{},!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new l.RERR("NoYValues","No Y-Values calculated for this note.");const{ABOVE:w,BELOW:C,LEFT:V,RIGHT:z}=Y.Position;let J=0;return e===V?J=-2:e===z?(J=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===L.UP&&this.hasFlag()&&(b.forceFlagRight||((Z,re)=>re===(Z.getStemDirection()===L.UP?Z.keyProps.length-1:0))(this,a))&&(J+=this.flag.getMetrics().width)):e!==C&&e!==w||(J=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+J,y:this.ys[a]}}setStyle(e){super.setStyle(e),this.note_heads.forEach(a=>a.setStyle(e)),this.stem&&this.stem.setStyle(e)}setStemStyle(e){this.stem&&this.getStem().setStyle(e)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(e){this.ledgerLineStyle=e}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(e){this.flagStyle=e}getFlagStyle(){return this.flagStyle}setKeyStyle(e,a){return this.note_heads[e].setStyle(a),this}setKeyLine(e,a){return this.keyProps[e].line=a,this.reset(),this}getKeyLine(e){return this.keyProps[e].line}addToModifierContext(e){this.setModifierContext(e);for(let a=0;a<this.modifiers.length;++a)this.modifierContext.addModifier(this.modifiers[a]);return this.modifierContext.addModifier(this),this.setPreFormatted(!1),this}addModifier(e,a){return a.setNote(this),a.setIndex(e),this.modifiers.push(a),this.setPreFormatted(!1),this}addAccidental(e,a){return this.addModifier(e,a)}addArticulation(e,a){return this.addModifier(e,a)}addAnnotation(e,a){return this.addModifier(e,a)}addDot(e){const a=new X;return a.setDotShiftY(this.glyph.dot_shiftY),this.addDotsCount++,this.addModifier(e,a)}addDotToAll(){for(let e=0;e<this.keys.length;++e)this.addDot(e);return this}getAccidentals(){return this.modifierContext.getModifiers("accidentals")}getDots(){return this.modifierContext.getModifiers("dots")}getVoiceShiftWidth(){return this.getGlyphWidth()*(this.displaced?2:1)}calcExtraPx(){this.setExtraLeftPx(this.displaced&&this.stem_direction===L.DOWN?this.getGlyphWidth():0),this.setExtraRightPx(!this.hasFlag()&&this.displaced&&this.stem_direction===L.UP?this.getGlyphWidth():0)}preFormat(){if(this.preFormatted)return;this.modifierContext&&this.modifierContext.preFormat();let e=this.getGlyphWidth()+this.extraLeftPx+this.extraRightPx+this.paddingRight;this.renderFlag&&this.glyph.flag&&this.beam===null&&this.stem_direction===L.UP&&(e+=this.getGlyphWidth()),this.setWidth(e),this.setPreFormatted(!0)}getNoteHeadBounds(){let e=null,a=null,b=null,w=null,C=this.stave.getNumLines(),V=1,z=!1,J=!1,Z=C,re=V;return this.note_heads.forEach(ae=>{const le=ae.getLine(),he=ae.getY();(e===null||he<e)&&(e=he),(a===null||he>a)&&(a=he),w===null&&ae.isDisplaced()&&(w=ae.getAbsoluteX()),b!==null||ae.isDisplaced()||(b=ae.getAbsoluteX()),C=le>C?le:C,V=le<V?le:V,ae.isDisplaced()?(z=z===!1?le:Math.max(le,z),J=J===!1?le:Math.min(le,J)):(Z=Math.max(le,Z),re=Math.min(le,re))},this),{y_top:e,y_bottom:a,displaced_x:w,non_displaced_x:b,highest_line:C,lowest_line:V,highest_displaced_line:z,lowest_displaced_line:J,highest_non_displaced_line:Z,lowest_non_displaced_line:re}}getNoteHeadBeginX(){return this.getAbsoluteX()+this.x_shift}getNoteHeadEndX(){return this.getNoteHeadBeginX()+this.getGlyphWidth()}drawLedgerLines(){const{stave:e,glyph:a,render_options:{stroke_px:b},context:w}=this,C=a.getWidth()+2*b,V=2*(a.getWidth()+b)-L.WIDTH/2;if(this.isRest())return;if(!w)throw new l.RERR("NoCanvasContext","Can't draw without a canvas context.");const{highest_line:z,lowest_line:J,highest_displaced_line:Z,highest_non_displaced_line:re,lowest_displaced_line:ae,lowest_non_displaced_line:le,displaced_x:he,non_displaced_x:pe}=this.getNoteHeadBounds(),ge=Math.min(he,pe),me=(we,Ne,De)=>{let Oe;Oe=De&&Ne?ge-b:Ne?pe-b:he-b;const ke=Ne&&De?V:C;w.beginPath(),w.moveTo(Oe,we),w.lineTo(Oe+ke,we),w.stroke()},Ee={...e.getStyle()||{},...this.getLedgerLineStyle()||{}};this.applyStyle(w,Ee);const Re=z>=6||J<=0;Re&&w.openGroup("ledgers",this.getAttribute("id")+"ledgers");for(let we=6;we<=z;++we){const Ne=pe!==null&&we<=re,De=he!==null&&we<=Z;me(e.getYForNote(we),Ne,De)}for(let we=0;we>=J;--we){const Ne=pe!==null&&we>=le,De=he!==null&&we>=ae;me(e.getYForNote(we),Ne,De)}Re&&w.closeGroup(),this.restoreStyle(w,Ee)}drawModifiers(){if(!this.context)throw new l.RERR("NoCanvasContext","Can't draw without a canvas context.");const e=this.context;e.openGroup("modifiers");for(let a=0;a<this.modifiers.length;a++){const b=this.modifiers[a],w=this.note_heads[b.getIndex()],C=w.getStyle();w.applyStyle(e,C),b.setContext(e),b.drawWithStyle(),w.restoreStyle(e,C)}e.closeGroup()}drawFlag(){const{stem:e,beam:a,context:b}=this;if(!b)throw new l.RERR("NoCanvasContext","Can't draw without a canvas context.");const w=a===null&&this.renderFlag;if(this.getGlyph().flag&&w){const{y_top:C,y_bottom:V}=this.getNoteHeadBounds(),z=e.getHeight(),J=this.getStemX(),Z=this.getStemDirection()===L.DOWN?C-z+2:V-z-2;b.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(b,this.getFlagStyle()||!1),this.flag.render(b,J,Z),this.restoreStyle(b,this.getFlagStyle()||!1),b.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(e=>{this.context.openGroup("notehead",null,{pointerBBox:!0}),e.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(e){if(!this.context)throw new l.RERR("NoCanvasContext","Can't draw without a canvas context.");e&&this.setStem(new L(e)),this.stem.id=l.Prefix(`${this.getAttribute("id")}-stem`),this.stem&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup())}draw(){if(!this.context)throw new l.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new l.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new l.RERR("NoYValues","Can't draw note without Y values.");const e=this.getNoteHeadBeginX(),a=this.hasStem()&&!this.beam;if(this.note_heads.forEach(b=>b.setX(e)),this.stem){const b=this.getStemX();this.stem.setNoteHeadXBounds(b,b)}(function(...b){oe.DEBUG&&l.L("Vex.Flow.StaveNote",b)})("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}),a&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}class $ extends Y{static get CATEGORY(){return"frethandfinger"}static format(e,a){const{left_shift:b,right_shift:w}=a;if(!e||e.length===0)return!1;const C=[];let V=null,z=0,J=0;for(let ge=0;ge<e.length;++ge){const me=e[ge],Ee=me.getNote(),Re=me.getPosition(),we=Ee.getKeyProps()[me.getIndex()];if(Ee!==V){for(let Ne=0;Ne<Ee.keys.length;++Ne){const De=Ee.getKeyProps()[Ne];b===0&&(z=De.displaced?Ee.getExtraLeftPx():z),w===0&&(J=De.displaced?Ee.getExtraRightPx():J)}V=Ee}C.push({note:Ee,num:me,pos:Re,line:we.line,shiftL:z,shiftR:J})}C.sort((ge,me)=>me.line-ge.line);let Z=0,re=0,ae=0,le=0,he=null,pe=null;for(let ge=0;ge<C.length;++ge){let me=0;const{note:Ee,pos:Re,num:we,line:Ne,shiftL:De,shiftR:Oe}=C[ge];Ne===he&&Ee===pe||(Z=b+De,re=w+Oe);const ke=we.getWidth()+1;Re===Y.Position.LEFT?(we.setXShift(b+Z),me=b+ke,ae=me>ae?me:ae):Re===Y.Position.RIGHT&&(we.setXShift(re),me=J+ke,le=me>le?me:le),he=Ne,pe=Ee}return a.left_shift+=ae,a.right_shift+=le,!0}constructor(e){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=e,this.width=7,this.position=Y.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 $.CATEGORY}setFretHandFinger(e){return this.finger=e,this}setOffsetX(e){return this.x_offset=e,this}setOffsetY(e){return this.y_offset=e,this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new l.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const e=this.context,a=this.note.getModifierStartXY(this.position,this.index);let b=a.x+this.x_shift+this.x_offset,w=a.y+this.y_shift+this.y_offset+5;switch(this.position){case Y.Position.ABOVE:b-=4,w-=12;break;case Y.Position.BELOW:b-=2,w+=10;break;case Y.Position.LEFT:b-=this.width;break;case Y.Position.RIGHT:b+=1;break;default:throw new l.RERR("InvalidPostion",`The position ${this.position} does not exist`)}e.save(),e.setFont(this.font.family,this.font.size,this.font.weight),e.fillText(""+this.finger,b,w),e.restore()}}class Q{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:Q.scales.major,m:Q.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(e){return!(e==null||e<0||e>=Q.NUM_TONES)}isValidIntervalValue(e){return this.isValidNoteValue(e)}getNoteParts(e){if(!e||e.length<1)throw new l.RERR("BadArguments","Invalid note name: "+e);if(e.length>3)throw new l.RERR("BadArguments","Invalid note name: "+e);const a=e.toLowerCase(),b=/^([cdefgab])(b|bb|n|#|##)?$/.exec(a);if(b!=null)return{root:b[1],accidental:b[2]};throw new l.RERR("BadArguments","Invalid note name: "+e)}getKeyParts(e){if(!e||e.length<1)throw new l.RERR("BadArguments","Invalid key: "+e);const a=e.toLowerCase(),b=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(a);if(b!=null){const w=b[1],C=b[2];let V=b[3];return V||(V="M"),{root:w,accidental:C,type:V}}throw new l.RERR("BadArguments",`Invalid key: ${e}`)}getNoteValue(e){const a=Q.noteValues[e];if(a==null)throw new l.RERR("BadArguments",`Invalid note name: ${e}`);return a.int_val}getIntervalValue(e){const a=Q.intervals[e];if(a==null)throw new l.RERR("BadArguments",`Invalid interval name: ${e}`);return a}getCanonicalNoteName(e){if(!this.isValidNoteValue(e))throw new l.RERR("BadArguments",`Invalid note value: ${e}`);return Q.canonical_notes[e]}getCanonicalIntervalName(e){if(!this.isValidIntervalValue(e))throw new l.RERR("BadArguments",`Invalid interval value: ${e}`);return Q.diatonic_intervals[e]}getRelativeNoteValue(e,a,b){if(b==null&&(b=1),b!==1&&b!==-1)throw new l.RERR("BadArguments",`Invalid direction: ${b}`);let w=(e+b*a)%Q.NUM_TONES;return w<0&&(w+=Q.NUM_TONES),w}getRelativeNoteName(e,a){const b=this.getNoteParts(e),w=this.getNoteValue(b.root);let C=a-w;if(Math.abs(C)>Q.NUM_TONES-3){let z=1;C>0&&(z=-1);const J=(a+1+(w+1))%Q.NUM_TONES*z;if(Math.abs(J)>2)throw new l.RERR("BadArguments",`Notes not related: ${e}, ${a})`);C=J}if(Math.abs(C)>2)throw new l.RERR("BadArguments",`Notes not related: ${e}, ${a})`);let V=b.root;if(C>0)for(let z=1;z<=C;++z)V+="#";else if(C<0)for(let z=-1;z>=C;--z)V+="b";return V}getScaleTones(e,a){const b=[e];let w=e;for(let C=0;C<a.length;C+=1)w=this.getRelativeNoteValue(w,a[C]),w!==e&&b.push(w);return b}getIntervalBetween(e,a,b){if(b==null&&(b=1),b!==1&&b!==-1)throw new l.RERR("BadArguments",`Invalid direction: ${b}`);if(!this.isValidNoteValue(e)||!this.isValidNoteValue(a))throw new l.RERR("BadArguments",`Invalid notes: ${e}, ${a}`);let w=b===1?a-e:e-a;return w<0&&(w+=Q.NUM_TONES),w}createScaleMap(e){const a=this.getKeyParts(e),b=Q.scaleTypes[a.type];let w=a.root;if(a.accidental&&(w+=a.accidental),!b)throw new l.RERR("BadArguments","Unsupported key type: "+e);const C=this.getScaleTones(this.getNoteValue(w),b),V=Q.root_indices[a.root],z={};for(let J=0;J<Q.roots.length;++J){const Z=(V+J)%Q.roots.length,re=Q.roots[Z];let ae=this.getRelativeNoteName(re,C[J]);ae.length===1&&(ae+="n"),z[re]=ae}return z}}function ne(...ce){N.DEBUG&&l.L("Vex.Flow.Accidental",ce)}const ee=ce=>ce.getMetrics().width;class N extends Y{static get CATEGORY(){return"accidentals"}static format(e,a){const b=a.left_shift+1;if(!e||e.length===0)return;const w=[];let C,V=null,z=0;for(let me=0;me<e.length;++me){const Ee=e[me],Re=Ee.getNote(),we=Re.getStave(),Ne=Re.getKeyProps()[Ee.getIndex()];if(Re!==V){for(let De=0;De<Re.keys.length;++De)C=Re.getKeyProps()[De],z=C.displaced?Re.getExtraLeftPx():z;V=Re}if(we!==null){const De=we.options.spacing_between_lines_px,Oe=we.getYForLine(Ne.line),ke=Math.round(Oe/De*2)/2;w.push({y:Oe,line:ke,shift:z,acc:Ee,lineSpace:De})}else w.push({line:Ne.line,shift:z,acc:Ee})}w.sort((me,Ee)=>Ee.line-me.line);const J=[];let Z=0,re=null;for(let me=0;me<w.length;me++){const Ee=w[me];re!==null&&re===Ee.line||J.push({line:Ee.line,flatLine:!0,dblSharpLine:!0,numAcc:0,width:0}),Ee.acc.type!=="b"&&Ee.acc.type!=="bb"&&(J[J.length-1].flatLine=!1),Ee.acc.type!=="##"&&(J[J.length-1].dblSharpLine=!1),J[J.length-1].numAcc++,J[J.length-1].width+=Ee.acc.getWidth()+3,Z=Ee.shift>Z?Ee.shift:Z,re=Ee.line}let ae=0;for(let me=0;me<J.length;me++){let Ee=!1;const Re=me;let we=me;for(;we+1<J.length&&!Ee;)this.checkCollision(J[we],J[we+1])?we++:Ee=!0;const Ne=$e=>J[Re+$e],De=$e=>$e.map(Ne),Oe=($e,ht)=>{const[ft,Rt]=De([$e,ht]).map(vt=>vt.line);return ft-Rt},ke=(...$e)=>$e.map(De).every(ht=>!this.checkCollision(...ht)),Ue=we-Re+1;let Ge,nt,Qe=this.checkCollision(J[Re],J[we])?"a":"b";switch(Ue){case 3:Qe==="a"&&Oe(1,2)===.5&&Oe(0,1)!==.5&&(Qe="second_on_bottom");break;case 4:ke([0,2],[1,3])&&(Qe="spaced_out_tetrachord");break;case 5:Qe==="b"&&ke([1,3])&&(Qe="spaced_out_pentachord",ke([0,2],[2,4])&&(Qe="very_spaced_out_pentachord"));break;case 6:ke([0,3],[1,4],[2,5])&&(Qe="spaced_out_hexachord"),ke([0,2],[2,4],[1,3],[3,5])&&(Qe="very_spaced_out_hexachord")}if(Ue>=7){let $e=2,ht=!0;for(;ht===!0;){ht=!1;for(let ft=0;ft+$e<J.length;ft++)if(this.checkCollision(J[ft],J[ft+$e])){ht=!0,$e++;break}}for(Ge=me;Ge<=we;Ge++)nt=(Ge-me)%$e+1,J[Ge].column=nt,ae=ae>nt?ae:nt}else for(Ge=me;Ge<=we;Ge++)nt=m.accidentalColumnsTable[Ue][Qe][Ge-me],J[Ge].column=nt,ae=ae>nt?ae:nt;me=we}const le=[],he=[];for(let me=0;me<=ae;me++)le[me]=0,he[me]=0;le[0]=Z+b,he[0]=Z+b,J.forEach(me=>{me.width>le[me.column]&&(le[me.column]=me.width)});for(let me=1;me<le.length;me++)he[me]=le[me]+he[me-1];const pe=he[he.length-1];let ge=0;J.forEach(me=>{let Ee=0;const Re=ge+me.numAcc;for(;ge<Re;ge++){const we=he[me.column-1]+Ee;w[ge].acc.setXShift(we),Ee+=w[ge].acc.getWidth()+3,ne("Line, accCount, shift: ",me.line,ge,we)}}),a.left_shift+=pe}static checkCollision(e,a){let b=a.line-e.line,w=3;b>0?(w=a.flatLine||a.dblSharpLine?2.5:3,e.dblSharpLine&&(b-=.5)):(w=e.flatLine||e.dblSharpLine?2.5:3,a.dblSharpLine&&(b-=.5));const C=Math.abs(b)<w;return ne("Line_1, Line_2, Collision: ",e.line,a.line,C),C}static applyAccidentals(e,a){const b=[],w={};e.forEach(z=>{const J=new s(0,1);z.getTickables().forEach(Z=>{if(Z.shouldIgnoreTicks())return;const re=w[J.value()];re?re.push(Z):(b.push(J.value()),w[J.value()]=[Z]),J.add(Z.getTicks())})});const C=new Q;a||(a="C");const V=C.createScaleMap(a);b.forEach(z=>{const J=w[z],Z=[],re=ae=>{ae.isRest()||ae.shouldIgnoreTicks()||(ae.keys.forEach((le,he)=>{const pe=C.getNoteParts(le.split("/")[0]),ge=pe.accidental||"n",me=pe.root+ge,Ee=V[pe.root]===me,Re=Z.indexOf(me)>-1;if(!Ee||Ee&&Re){V[pe.root]=me;const we=new N(ge);ae.addAccidental(he,we),Z.push(me)}}),ae.getModifiers().forEach(le=>{le.getCategory()==="gracenotegroups"&&le.getGraceNotes().forEach(re)}))};J.forEach(re)})}constructor(e=null){if(super(),this.setAttribute("type","Accidental"),ne("New accidental: ",e),this.note=null,this.index=null,this.type=e,this.position=Y.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 l.RERR("ArgumentError",`Unknown accidental type: ${e}`);this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){const e=this.render_options.font_scale;this.glyph=new p(this.accidental.code,e),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new p(m.accidentalCodes("{").code,e),this.parenRight=new p(m.accidentalCodes("}").code,e),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return N.CATEGORY}getWidth(){const e=this.cautionary?ee(this.parenLeft)+ee(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return ee(this.glyph)+e}setNote(e){if(!e)throw new l.RERR("ArgumentError",`Bad note value: ${e}`);this.note=e,this.note.getCategory()==="gracenotes"&&(this.render_options.font_scale=25,this.reset())}setAsCautionary(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}draw(){const{context:e,type:a,position:b,note:w,index:C,cautionary:V,x_shift:z,y_shift:J,glyph:Z,parenLeft:re,parenRight:ae,render_options:{parenLeftPadding:le,parenRightPadding:he}}=this;if(this.checkContext(),!w||C==null)throw new l.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const pe=w.getModifierStartXY(b,C);let ge=pe.x+z;const me=pe.y+J;ne("Rendering: ",a,ge,me),V?(ae.render(e,ge,me),ge-=ee(ae),ge-=he,ge-=this.accidental.parenRightPaddingAdjustment,Z.render(e,ge,me),ge-=ee(Z),ge-=le,re.render(e,ge,me)):Z.render(e,ge,me),this.setRendered()}}class R extends Y{static get CATEGORY(){return"notesubgroup"}static format(e,a){if(!e||e.length===0)return!1;let b=0;for(let w=0;w<e.length;++w){const C=e[w];C.preFormat(),b+=C.getWidth()}return a.left_shift+=b,!0}constructor(e){return super(),this.setAttribute("type","NoteSubGroup"),this.note=null,this.index=null,this.position=Y.Position.LEFT,this.subNotes=e,this.subNotes.forEach(a=>{a.ignore_ticks=!1}),this.width=0,this.preFormatted=!1,this.formatter=new Ce,this.voice=new D({num_beats:4,beat_value:4,resolution:m.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return R.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(e){this.note=e}setWidth(e){this.width=e}getWidth(){return this.width}draw(){this.checkContext();const e=this.getNote();if(!e||this.index===null)throw new l.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,e),this.subNotes.forEach(a=>a.setContext(this.context).drawWithStyle())}}class O extends o{constructor(e,a){super(),this.setAttribute("type","StaveTie"),this.notes=e,this.context=null,this.text=a,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(e)}setFont(e){return this.font=e,this}setDirection(e){return this.direction=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new l.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new l.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(e){var J;if(e.first_ys.length===0||e.last_ys.length===0)throw new l.RERR("BadArguments","No Y-values to render");const a=this.context;let b=this.render_options.cp1,w=this.render_options.cp2;Math.abs(e.last_x_px-e.first_x_px)<10&&(b=2,w=8);const C=this.render_options.first_x_shift,V=this.render_options.last_x_shift,z=this.render_options.y_shift*e.direction;for(let Z=0;Z<this.first_indices.length;++Z){const re=(e.last_x_px+V+(e.first_x_px+C))/2,ae=e.first_ys[this.first_indices[Z]]+z,le=e.last_ys[this.last_indices[Z]]+z;if(isNaN(ae)||isNaN(le))throw new l.RERR("BadArguments","Bad indices for tie rendering.");const he=(ae+le)/2+b*e.direction,pe=(ae+le)/2+w*e.direction;let ge;ge=((J=this.first_note)==null?void 0:J.getAttribute("id"))+"-tie",this.setAttribute("el",a.openGroup("stavetie",ge)),a.beginPath(),a.moveTo(e.first_x_px+C,ae),a.quadraticCurveTo(re,he,e.last_x_px+V,le),a.quadraticCurveTo(re,pe,e.first_x_px+C,ae),a.closePath(),a.fill(),a.closeGroup()}}renderText(e,a){if(!this.text)return;let b=(e+a)/2;b-=this.context.measureText(this.text).width/2,this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.style),this.context.fillText(this.text,b+this.render_options.text_shift_x,(this.first_note||this.last_note).getStave().getYForTopText()-1),this.context.restore()}draw(){this.checkContext(),this.setRendered();const e=this.first_note,a=this.last_note;let b,w,C,V,z;return e?(b=e.getTieRightX()+this.render_options.tie_spacing,z=e.getStemDirection(),C=e.getYs()):(b=a.getStave().getTieStartX(),C=a.getYs(),this.first_indices=this.last_indices),a?(w=a.getTieLeftX()+this.render_options.tie_spacing,z=a.getStemDirection(),V=a.getYs()):(w=e.getStave().getTieEndX(),V=e.getYs(),this.last_indices=this.first_indices),this.direction&&(z=this.direction),this.renderTie({first_x_px:b,last_x_px:w,first_ys:C,last_ys:V,direction:z}),this.renderText(b,w),!0}}class U extends O{static createHammeron(e){return new U(e,"H")}static createPulloff(e){return new U(e,"P")}constructor(e,a){super(e,a),this.setAttribute("type","TabTie"),this.render_options.cp1=9,this.render_options.cp2=11,this.render_options.y_shift=3,this.setNotes(e)}draw(){this.checkContext(),this.setRendered();const e=this.first_note,a=this.last_note;let b,w,C,V;return e?(b=e.getTieRightX()+this.render_options.tie_spacing,C=e.getYs()):(b=a.getStave().getTieStartX(),C=a.getYs(),this.first_indices=this.last_indices),a?(w=a.getTieLeftX()+this.render_options.tie_spacing,V=a.getYs()):(w=e.getStave().getTieEndX(),V=e.getYs(),this.last_indices=this.first_indices),this.renderTie({first_x_px:b,last_x_px:w,first_ys:C,last_ys:V,direction:-1}),this.renderText(b,w),!0}}class H extends Y{static get CATEGORY(){return"gracenotegroups"}static format(e,a){if(!e||e.length===0)return!1;const b=[];let w=null,C=0;for(let J=0;J<e.length;++J){const Z=e[J],re=Z.getNote(),ae=re.getCategory()===oe.CATEGORY;let le=0;if(ae&&Z.spacing!==null&&Z.spacing!==void 0&&(le=Z.spacing),ae&&re!==w){for(let he=0;he<re.keys.length;++he)C=re.getKeyProps()[he].displaced?re.getExtraLeftPx():C;w=re}b.push({shift:C,gracenote_group:Z,spacing:le})}let V,z=b[0].shift;for(let J=0;J<b.length;++J){const Z=b[J].gracenote_group;Z.preFormat(),V=Z.getWidth()+b[J].spacing,z=Math.max(V,z)}for(let J=0;J<b.length;++J){const Z=b[J].gracenote_group;V=Z.getWidth()+b[J].spacing,Z.setSpacingFromNextModifier(z-Math.min(V,z))}return a.left_shift+=z,!0}constructor(e,a){return super(),this.setAttribute("type","GraceNoteGroup"),this.note=null,this.index=null,this.position=Y.Position.LEFT,this.grace_notes=e,this.width=0,this.preFormatted=!1,this.show_slur=a,this.slur=null,this.formatter=new Ce,this.voice=new D({num_beats:4,beat_value:4,resolution:m.RESOLUTION}).setStrict(!1),this.render_options={slur_y_shift:0},this.beams=[],this.voice.addTickables(this.grace_notes),this}getCategory(){return H.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}beamNotes(e){if((e=e||this.grace_notes).length>1){const a=new B(e);a.render_options.beam_width=3,a.render_options.partial_beam_length=4,this.beams.push(a)}return this}setNote(e){this.note=e}setWidth(e){this.width=e}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();const e=this.getNote();if(function(...a){H.DEBUG&&l.L("Vex.Flow.GraceNoteGroup",a)}("Drawing grace note group for:",e),!e||this.index===null)throw new l.RuntimeError("NoAttachedNote","Can't draw grace note without a parent note and parent note index.");if(this.setRendered(),this.alignSubNotesWithNote(this.getGraceNotes(),e),this.grace_notes.forEach(a=>{a.setContext(this.context).draw()}),this.beams.forEach(a=>{a.setContext(this.context).draw()}),this.show_slur){const a=this.getNote().getCategory()===oe.CATEGORY,b=a?O:U;this.slur=new b({last_note:this.grace_notes[0],first_note:e,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(a?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}}class W extends Y{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(e,a){const b=a.left_shift;if(!e||e.length===0)return this;const w=e.map(z=>{const J=z.getNote();if(J instanceof oe){const{line:Z,displaced:re}=J.getKeyProps()[z.getIndex()];return{line:Z,shift:re?J.getExtraLeftPx():0,stroke:z}}{const{str:Z}=J.getPositions()[z.getIndex()];return{line:Z,shift:0,stroke:z}}}),C=b,V=w.reduce((z,{stroke:J,shift:Z})=>(J.setXShift(C+Z),Math.max(J.getWidth()+0,z)),0);return a.left_shift+=V,!0}constructor(e,a){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=l.Merge({},a),this.all_voices=!("all_voices"in this.options)||this.options.all_voices,this.note_end=null,this.index=null,this.type=e,this.position=Y.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 W.CATEGORY}getPosition(){return this.position}addEndNote(e){return this.note_end=e,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index==null)throw new l.RERR("NoAttachedNote","Can't draw stroke without a note and index.");const e=this.note.getModifierStartXY(this.position,this.index);let a=this.note.getYs(),b=e.y,w=e.y;const C=e.x-5,V=this.note.stave.options.spacing_between_lines_px,z=this.getModifierContext().getModifiers(this.note.getCategory());for(let he=0;he<z.length;he++){a=z[he].getYs();for(let pe=0;pe<a.length;pe++)(this.note===z[he]||this.all_voices)&&(b=l.Min(b,a[pe]),w=l.Max(w,a[pe]))}let J,Z,re,ae,le;switch(this.type){case W.Type.BRUSH_DOWN:J="vc3",Z=-3,re=b-V/2+10,w+=V/2;break;case W.Type.BRUSH_UP:J="v11",Z=.5,re=w+V/2,b-=V/2;break;case W.Type.ROLL_DOWN:case W.Type.RASQUEDO_DOWN:J="vc3",Z=-3,ae=this.x_shift+Z-2,this.note instanceof oe?(b+=1.5*V,w+=(w-b)%2!=0?.5*V:V,re=b-V,le=w+V+2):(b+=1.5*V,w+=V,re=b-.75*V,le=w+.25*V);break;case W.Type.ROLL_UP:case W.Type.RASQUEDO_UP:J="v52",Z=-4,ae=this.x_shift+Z-1,this.note instanceof oe?(re=V/2,b+=.5*V,(w-b)%2==0&&(w+=V/2),re=w+.5*V,le=b-1.25*V):(b+=.25*V,w+=.5*V,re=w+.25*V,le=b-V);break;case W.Type.ARPEGGIO_DIRECTIONLESS:b+=.5*V,w+=V;break;default:throw new l.RERR("InvalidType",`The stroke type ${this.type} does not exist`)}if(this.type===W.Type.BRUSH_DOWN||this.type===W.Type.BRUSH_UP)this.context.fillRect(C+this.x_shift,b,1,w-b);else if(this.note instanceof oe)for(let he=b;he<=w;he+=V)p.renderGlyph(this.context,C+this.x_shift-4,he,this.render_options.font_scale,"va3");else{let he;for(he=b;he<=w;he+=10)p.renderGlyph(this.context,C+this.x_shift-4,he,this.render_options.font_scale,"va3");this.type===W.Type.RASQUEDO_DOWN&&(le=he+.25*V)}this.type!==W.Type.ARPEGGIO_DIRECTIONLESS&&(p.renderGlyph(this.context,C+this.x_shift+Z,re,this.render_options.font_scale,J),this.type!==W.Type.RASQUEDO_DOWN&&this.type!==W.Type.RASQUEDO_UP||(this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight),this.context.fillText("R",C+ae,le),this.context.restore()))}}class K extends Y{static get CATEGORY(){return"stringnumber"}static format(e,a){const b=a.left_shift,w=a.right_shift;if(!e||e.length===0)return this;const C=[];let V,z,J,Z,re,ae=null,le=0,he=0;for(V=0;V<e.length;++V)for(z=e[V],J=z.getNote(),V=0;V<e.length;++V){z=e[V],J=z.getNote(),Z=z.getPosition();const we=J.getKeyProps()[z.getIndex()];if(J!==ae){for(let Ne=0;Ne<J.keys.length;++Ne)re=J.getKeyProps()[Ne],b===0&&(le=re.displaced?J.getExtraLeftPx():le),w===0&&(he=re.displaced?J.getExtraRightPx():he);ae=J}C.push({pos:Z,note:J,num:z,line:we.line,shiftL:le,shiftR:he})}C.sort((we,Ne)=>Ne.line-we.line);let pe=0,ge=0,me=0,Ee=null,Re=null;for(V=0;V<C.length;++V){let we=0;J=C[V].note,Z=C[V].pos,z=C[V].num;const Ne=C[V].line;C[V].shiftL;const De=C[V].shiftR;Ne===Ee&&J===Re||(pe=w+De);const Oe=z.getWidth()+1;Z===Y.Position.LEFT?(z.setXShift(b),we=le+Oe,ge=we>ge?we:ge):Z===Y.Position.RIGHT&&(z.setXShift(pe),we+=Oe,me=we>me?we:me),Ee=Ne,Re=J}return a.left_shift+=ge,a.right_shift+=me,!0}constructor(e){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=e,this.setWidth(20),this.position=Y.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=E.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return K.CATEGORY}getNote(){return this.note}setNote(e){return this.note=e,this}getIndex(){return this.index}setIndex(e){return this.index=e,this}setLineEndType(e){return e>=E.LineEndType.NONE&&e<=E.LineEndType.DOWN&&(this.leg=e),this}setStringNumber(e){return this.string_number=e,this}setOffsetX(e){return this.x_offset=e,this}setOffsetY(e){return this.y_offset=e,this}setLastNote(e){return this.last_note=e,this}setDashed(e){return this.dashed=e,this}draw(){const e=this.checkContext();if(!this.note||this.index==null)throw new l.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const a=this.note.stave.options.spacing_between_lines_px,b=this.note.getModifierStartXY(this.position,this.index);let w=b.x+this.x_shift+this.x_offset,C=b.y+this.y_shift+this.y_offset;switch(this.position){case Y.Position.ABOVE:case Y.Position.BELOW:{const z=this.note.getStemExtents();let J=z.topY,Z=z.baseY+2;this.note.stem_direction===oe.STEM_DOWN&&(J=z.baseY,Z=z.topY-2),C=this.position===Y.Position.ABOVE?this.note.hasStem()?J-1.75*a:b.y-1.75*a:this.note.hasStem()?Z+1.5*a:b.y+1.75*a,C+=this.y_shift+this.y_offset;break}case Y.Position.LEFT:w-=this.radius/2+5;break;case Y.Position.RIGHT:w+=this.radius/2+6;break;default:throw new l.RERR("InvalidPosition",`The position ${this.position} is invalid`)}e.save(),e.beginPath(),e.arc(w,C,this.radius,0,2*Math.PI,!1),e.lineWidth=1.5,e.stroke(),e.setFont(this.font.family,this.font.size,this.font.weight);const V=w-e.measureText(this.string_number).width/2;if(e.fillText(""+this.string_number,V,C+4.5),this.last_note!=null){const z=this.last_note.getStemX()-this.note.getX()+5;let J,Z;switch(e.strokeStyle="#000000",e.lineCap="round",e.lineWidth=.6,this.dashed?E.drawDashedLine(e,w+10,C,w+z,C,[3,3]):E.drawDashedLine(e,w+10,C,w+z,C,[3,0]),this.leg){case E.LineEndType.UP:J=-10,Z=this.dashed?[3,3]:[3,0],E.drawDashedLine(e,w+z,C,w+z,C+J,Z);break;case E.LineEndType.DOWN:J=10,Z=this.dashed?[3,3]:[3,0],E.drawDashedLine(e,w+z,C,w+z,C+J,Z)}}e.restore()}}class q extends k{static getNextContext(e){const a=e.tContexts,b=a.indexOf(e);return a[b+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new s(0,1),this.maxTicks=new s(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(e){return this.x=e,this.xBase=e,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(e){this.xBase=e,this.x=e+this.xOffset}getXOffset(){return this.xOffset}setXOffset(e){this.xOffset=e,this.x=this.xBase+e}getWidth(){return this.width+2*this.padding}setPadding(e){return this.padding=e,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(e=>e.isCenterAligned())}getMetrics(){const{width:e,notePx:a,extraLeftPx:b,extraRightPx:w}=this;return{width:e,notePx:a,extraLeftPx:b,extraRightPx:w}}getCurrentTick(){return this.currentTick}setCurrentTick(e){this.currentTick=e,this.preFormatted=!1}getExtraPx(){let e=0,a=0,b=0,w=0;for(let C=0;C<this.tickables.length;C++){b=Math.max(this.tickables[C].extraLeftPx||0,b),w=Math.max(this.tickables[C].extraRightPx||0,w);const V=this.tickables[C].modifierContext;V&&V!=null&&(e=Math.max(e,V.state.left_shift),a=Math.max(a,V.state.right_shift))}return{left:e,right:a,extraLeft:b,extraRight:w}}addTickable(e){if(!e)throw new l.RERR("BadArgument","Invalid tickable added.");if(!e.shouldIgnoreTicks()){this.ignore_ticks=!1;const a=e.getTicks();a.greaterThan(this.maxTicks)&&(this.maxTicks=a.clone()),(this.minTicks==null||a.lessThan(this.minTicks))&&(this.minTicks=a.clone())}return e.setTickContext(this),this.tickables.push(e),this.preFormatted=!1,this}preFormat(){if(this.preFormatted)return this;for(let e=0;e<this.tickables.length;++e){const a=this.tickables[e];a.preFormat();const b=a.getMetrics();this.extraLeftPx=Math.max(this.extraLeftPx,b.extraLeftPx+b.modLeftPx),this.extraRightPx=Math.max(this.extraRightPx,b.extraRightPx+b.modRightPx),this.notePx=Math.max(this.notePx,b.noteWidth),this.width=this.notePx+this.extraLeftPx+this.extraRightPx}return this}postFormat(){return this.postFormatted||(this.postFormatted=!0),this}}const{ABOVE:te,BELOW:se}=Y.Position,ue=(ce,e)=>.5*ce(e/.5),fe=(ce,e)=>e===te?ce<=5:ce>=1,xe=(ce,e)=>fe(ce,e)?e===te?Math.ceil:Math.floor:Math.round,ve=ce=>{const e=ce.getCategory();return e==="stavenotes"||e==="gracenotes"};class Se extends Y{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(e,a){if(!e||e.length===0)return!1;const b=(C,V,z)=>ue(xe(V,z),C.glyph.getMetrics().height/10+.5);e.filter(C=>C.getPosition()===te).forEach(C=>{C.setTextLine(a.top_text_line),a.top_text_line+=b(C,a.top_text_line,te)}),e.filter(C=>C.getPosition()===se).forEach(C=>{C.setTextLine(a.text_line),a.text_line+=b(C,a.text_line,se)});const w=e.map(C=>C.getWidth()).reduce((C,V)=>Math.max(V,C));return a.left_shift+=w/2,a.right_shift+=w/2,!0}static easyScoreHook({articulations:e},a,b){if(!e)return;const w={staccato:"a.",tenuto:"a-"};e.split(",").map(C=>C.trim().split(".")).map(([C,V])=>{const z={type:w[C]};return V&&(z.position=Y.PositionString[V]),b.getFactory().Articulation(z)}).map(C=>a.addModifier(0,C))}constructor(e){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=e,this.position=se,this.render_options={font_scale:38},this.breathMarkDistance=.8,this.articulation=m.articulationCodes(this.type),this.type==="abr"&&(this.articulation={code:"v6c",between_lines:!1}),!this.articulation)throw new l.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 Se.CATEGORY}draw(){const{note:e,index:a,position:b,glyph:w,articulation:{between_lines:C},text_line:V,context:z}=this;if(this.checkContext(),!e||a==null)throw new l.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const J=e.getStave(),Z=J.getSpacingBetweenLines(),re=e.getCategory()==="tabnotes";let{x:ae}=e.getModifierStartXY(b,a);if(this.type==="abr"){let me=0;const Ee=e.getTickContext(),Re=q.getNextContext(Ee),we=Ee.getX();if(Re&&Re.x>Ee.x)me=(Re.getX()-we)*this.breathMarkDistance;else{const Ne=e.getStave();me=(Ne.getX()+Ne.getWidth()-we+Ne.start_x)*this.breathMarkDistance}if(ae+=me,ae>J.end_x){const Ne=J.start_x+we;ae=Ne+(J.end_x-Ne)*this.breathMarkDistance}}const le=this.getXShift();le&&(ae+=le);const he=!C||re,pe=((me,Ee)=>{const Re=Ee===te&&me.getStemDirection()===L.UP||Ee===se&&me.getStemDirection()===L.DOWN;return ve(me)?me.hasStem()&&Re?.5:1:me.hasStem()&&Re?1:0})(e,b);let ge={[te]:()=>{w.setOrigin(.5,1);const me=((Ee,Re)=>{const we=Ee.getStave(),Ne=Ee.getStemDirection(),{topY:De,baseY:Oe}=Ee.getStemExtents();if(ve(Ee))return Ee.hasStem()?Ne===L.UP?De:Oe:Math.min(...Ee.getYs());if(Ee.getCategory()==="tabnotes")return Ee.hasStem()&&Ne===L.UP?De:we.getYForTopText(Re);throw new l.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")})(e,V)-(V+pe)*Z;return he?Math.min(J.getYForTopText(Se.INITIAL_OFFSET),me):me},[se]:()=>{w.setOrigin(.5,0);const me=((Ee,Re)=>{const we=Ee.getStave(),Ne=Ee.getStemDirection(),{topY:De,baseY:Oe}=Ee.getStemExtents();if(ve(Ee))return Ee.hasStem()?Ne===L.UP?Oe:De:Math.max(...Ee.getYs());if(Ee.getCategory()==="tabnotes")return Ee.hasStem()?Ne===L.UP?we.getYForBottomText(Re):De:we.getYForBottomText(Re);throw new l.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")})(e,V)+(V+pe)*Z;return he?Math.max(J.getYForBottomText(Se.INITIAL_OFFSET),me):me}}[b]();if(this.y_shift&&(ge+=this.y_shift),!re){const me=b===te?-1:1,Ee=re?e.positions[a].str:e.getKeyProps()[a].line,Re=(e.getYs()[a]-ge)/Z+Ee,we=((Ne,De,Oe,ke)=>{const Ue=ue(xe(De,Oe),De);return Ne&&fe(Ue,Oe)&&Ue%1==0?Ue+.5*-ke:Ue})(C,Re,b,me);fe(we,b)&&w.setOrigin(.5,.5),ge+=Math.abs(we-Re)*Z*me}(function(...me){Se.DEBUG&&l.L("Vex.Flow.Articulation",me)})(`Rendering articulation at (x: ${ae}, y: ${ge})`),w.render(z,ae,ge)}}class ye extends Y{static get CATEGORY(){return"ornaments"}static format(e,a){if(!e||e.length===0)return!1;let b=0;for(let w=0;w<e.length;++w){const C=e[w],V=2;b=Math.max(C.getWidth(),b),C.getPosition()===Y.Position.ABOVE?(C.setTextLine(a.top_text_line),a.top_text_line+=V):(C.setTextLine(a.text_line),a.text_line+=V)}return a.left_shift+=b/2,a.right_shift+=b/2,!0}constructor(e){if(super(),this.setAttribute("type","Ornament"),this.note=null,this.index=null,this.type=e,this.position=Y.Position.ABOVE,this.delayed=!1,this.accidentalUpper=null,this.accidentalLower=null,this.render_options={font_scale:38,accidentalLowerPadding:3,accidentalUpperPadding:3},this.ornament=m.ornamentCodes(this.type),!this.ornament)throw new l.RERR("ArgumentError",`Ornament not found: '${this.type}'`);this.glyph=new p(this.ornament.code,this.render_options.font_scale),this.glyph.setOrigin(.5,1)}getCategory(){return ye.CATEGORY}setDelayed(e){return this.delayed=e,this}setUpperAccidental(e){const a=this.render_options.font_scale/1.3;return this.accidentalUpper=new p(m.accidentalCodes(e).code,a),this.accidentalUpper.setOrigin(.5,1),this}setLowerAccidental(e){const a=this.render_options.font_scale/1.3;return this.accidentalLower=new p(m.accidentalCodes(e).code,a),this.accidentalLower.setOrigin(.5,1),this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new l.RERR("NoAttachedNote","Can't draw Ornament without a note and index.");this.setRendered();const e=this.context,a=this.note.getStemDirection(),b=this.note.getStave(),w=this.note.getStem().getExtents();let C=a===oe.STEM_DOWN?w.baseY:w.topY;this.note.getCategory()==="tabnotes"&&(this.note.hasStem()?a===oe.STEM_DOWN&&(C=b.getYForTopText(this.text_line)):C=b.getYForTopText(this.text_line));const V=a===oe.STEM_DOWN,z=b.getSpacingBetweenLines();let J=1;!V&&this.note.beam&&(J+=.5);const Z=C-z*(this.text_line+J);let re=this.note.getModifierStartXY(this.position,this.index).x,ae=Math.min(b.getYForTopText(this.text_line),Z);if(ae+=this.y_shift,this.delayed){let le=0;if(this.delayXShift!==void 0)le=this.delayXShift;else{le+=this.glyph.getMetrics().width/2;const he=q.getNextContext(this.note.getTickContext());le+=he?.5*(he.getX()-re):.5*(b.x+b.width-re),this.delayXShift=le}re+=le}(function(...le){ye.DEBUG&&l.L("Vex.Flow.Ornament",le)})("Rendering ornament: ",this.ornament,re,ae),this.accidentalLower&&(this.accidentalLower.render(e,re,ae),ae-=this.accidentalLower.getMetrics().height,ae-=this.render_options.accidentalLowerPadding),this.glyph.render(e,re,ae),ae-=this.glyph.getMetrics().height,this.accidentalUpper&&(ae-=this.render_options.accidentalUpperPadding,this.accidentalUpper.render(e,re,ae))}}class be extends Y{static get CATEGORY(){return"annotations"}static get Justify(){return{LEFT:1,CENTER:2,RIGHT:3,CENTER_STEM:4}}static get JustifyString(){return{left:be.Justify.LEFT,right:be.Justify.RIGHT,center:be.Justify.CENTER,centerStem:be.Justify.CENTER_STEM}}static get VerticalJustify(){return{TOP:1,CENTER:2,BOTTOM:3,CENTER_STEM:4}}static get VerticalJustifyString(){return{above:be.VerticalJustify.TOP,top:be.VerticalJustify.TOP,below:be.VerticalJustify.BOTTOM,bottom:be.VerticalJustify.BOTTOM,center:be.VerticalJustify.CENTER,centerStem:be.VerticalJustify.CENTER_STEM}}static format(e,a){if(!e||e.length===0)return!1;let b=0;for(let w=0;w<e.length;++w){const C=e[w];b=Math.max(C.getWidth(),b),C.getPosition()===Y.Position.ABOVE?(C.setTextLine(a.top_text_line),a.top_text_line++):(C.setTextLine(a.text_line),a.text_line++)}return a.left_shift+=b/2,a.right_shift+=b/2,!0}constructor(e){super(),this.setAttribute("type","Annotation"),this.note=null,this.index=null,this.text=e,this.justification=be.Justify.CENTER,this.vert_justification=be.VerticalJustify.TOP,this.font={family:"Arial",size:10,weight:""},this.setWidth(m.textWidth(e))}getCategory(){return be.CATEGORY}setFont(e,a,b){return this.font={family:e,size:a,weight:b},this}setVerticalJustification(e){return this.vert_justification=typeof e=="string"?be.VerticalJustifyString[e]:e,this}getJustification(){return this.justification}setJustification(e){return this.justification=typeof e=="string"?be.JustifyString[e]:e,this}draw(){if(this.checkContext(),!this.note)throw new l.RERR("NoNoteForAnnotation","Can't draw text annotation without an attached note.");this.setRendered();const e=this.note.getModifierStartXY(Y.Position.ABOVE,this.index);this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const a=this.context.measureText(this.text).width,b=this.context.measureText("m").width;let w,C,V,z;w=this.justification===be.Justify.LEFT?e.x:this.justification===be.Justify.RIGHT?e.x-a:this.justification===be.Justify.CENTER?e.x-a/2:this.note.getStemX()-a/2;const J=this.note.hasStem(),Z=this.note.getStave();if(J&&(V=this.note.getStem().getExtents(),z=Z.getSpacingBetweenLines()),this.vert_justification===be.VerticalJustify.BOTTOM){if(C=Z.getYForBottomText(this.text_line+m.TEXT_HEIGHT_OFFSET_HACK),J){const re=this.note.getStemDirection()===1?V.baseY:V.topY;C=Math.max(C,re+z*(this.text_line+2))}}else if(this.vert_justification===be.VerticalJustify.CENTER){const re=this.note.getYForTopText(this.text_line)-1;C=re+(Z.getYForBottomText(this.text_line)-re)/2+b/2}else if(this.vert_justification===be.VerticalJustify.TOP)C=Math.min(Z.getYForTopText(this.text_line),this.note.getYs()[0]-10),J&&(C=Math.min(C,V.topY-5-z*this.text_line));else{const re=this.note.getStemExtents();C=re.topY+(re.baseY-re.topY)/2+b/2}(function(...re){be.DEBUG&&l.L("Vex.Flow.Annotation",re)})("Rendering annotation: ",this.text,w,C),this.context.fillText(this.text,w,C),this.context.restore()}}class Me extends Y{static get CATEGORY(){return"bends"}static get UP(){return 0}static get DOWN(){return 1}static format(e,a){if(!e||e.length===0)return!1;let b=0;const w=a.top_text_line;for(let C=0;C<e.length;++C){const V=e[C];V.setXShift(b),b=V.getWidth(),V.setTextLine(w)}return a.right_shift+=b,a.top_text_line+=1,!0}constructor(e,a,b){super(),this.setAttribute("type","Bend"),this.text=e,this.x_shift=0,this.release=a||!1,this.font="10pt Arial",this.render_options={line_width:1.5,line_style:"#777777",bend_width:8,release_width:8},b?this.phrase=b:(this.phrase=[{type:Me.UP,text:this.text}],this.release&&this.phrase.push({type:Me.DOWN,text:""})),this.updateWidth()}getCategory(){return Me.CATEGORY}setXShift(e){this.x_shift=e,this.updateWidth()}setFont(e){return this.font=e,this}getText(){return this.text}updateWidth(){const e=this;function a(w){let C;return C=e.context?e.context.measureText(w).width:m.textWidth(w),C}let b=0;for(let w=0;w<this.phrase.length;++w){const C=this.phrase[w];if("width"in C)b+=C.width;else{const V=C.type===Me.UP?this.render_options.bend_width:this.render_options.release_width;C.width=l.Max(V,a(C.text))+3,C.draw_width=C.width/2,b+=C.width}}return this.setWidth(b+this.x_shift),this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new l.RERR("NoNoteForBend","Can't draw bend without a note or index.");this.setRendered();const e=this.note.getModifierStartXY(Y.Position.RIGHT,this.index);e.x+=3,e.y+=.5;const a=this.x_shift,b=this.context,w=this.note.getStave().getYForTopText(this.text_line)+3,C=this.note.getStave().getYForTopText(this.text_line)-1,V=this;function z(he,pe,ge,me){const Ee=he+ge,Re=pe;b.save(),b.beginPath(),b.setLineWidth(V.render_options.line_width),b.setStrokeStyle(V.render_options.line_style),b.setFillStyle(V.render_options.line_style),b.moveTo(he,pe),b.quadraticCurveTo(Ee,Re,he+ge,me),b.stroke(),b.restore()}function J(he,pe,ge,me){b.save(),b.beginPath(),b.setLineWidth(V.render_options.line_width),b.setStrokeStyle(V.render_options.line_style),b.setFillStyle(V.render_options.line_style),b.moveTo(he,me),b.quadraticCurveTo(he+ge,me,he+ge,pe),b.stroke(),b.restore()}function Z(he,pe,ge){const me=ge||1;b.beginPath(),b.moveTo(he,pe),b.lineTo(he-4,pe+4*me),b.lineTo(he+4,pe+4*me),b.closePath(),b.fill()}function re(he,pe){b.save(),b.setRawFont(V.font);const ge=he-b.measureText(pe).width/2;b.fillText(pe,ge,C),b.restore()}let ae=null,le=0;for(let he=0;he<this.phrase.length;++he){const pe=this.phrase[he];he===0&&(pe.draw_width_unmodified=pe.draw_width,pe.draw_width+=a),le=pe.draw_width+(ae?ae.draw_width:0)-(he===1?a:0),pe.type===Me.UP&&(ae&&ae.type===Me.UP&&Z(e.x,w),z(e.x,e.y,le,w)),pe.type===Me.DOWN&&(ae&&ae.type===Me.UP&&J(e.x,e.y,le,w),ae&&ae.type===Me.DOWN&&(Z(e.x,e.y,-1),J(e.x,e.y,le,w)),ae===null&&(le=pe.draw_width,J(e.x,e.y,le,w))),re(e.x+le,pe.text),ae=pe,ae.x=e.x,e.x+=le}ae.type===Me.UP?Z(ae.x+le,w):ae.type===Me.DOWN&&Z(ae.x+le,e.y,-1);for(let he=0;he<this.phrase.length;++he){const pe=this.phrase[he];pe.draw_width_unmodified&&(pe.draw_width=pe.draw_width_unmodified)}}}class _e extends Y{static get CATEGORY(){return"vibratos"}static format(e,a,b){if(!e||e.length===0)return!1;let w=a.top_text_line,C=0,V=a.right_shift-7;const z=b.getModifiers(Me.CATEGORY);z&&z.length>0&&w--;for(let J=0;J<e.length;++J){const Z=e[J];Z.setXShift(V),Z.setTextLine(w),C+=Z.getWidth(),V+=C}return a.right_shift+=C,a.top_text_line+=1,!0}constructor(){super(),this.setAttribute("type","Vibrato"),this.position=Y.Position.RIGHT,this.render_options={harsh:!1,vibrato_width:20,wave_height:6,wave_width:4,wave_girth:2},this.setVibratoWidth(this.render_options.vibrato_width)}getCategory(){return _e.CATEGORY}setHarsh(e){return this.render_options.harsh=e,this}setVibratoWidth(e){return this.render_options.vibrato_width=e,this.setWidth(e),this}draw(){const e=this.checkContext();if(!this.note)throw new l.RERR("NoNoteForVibrato","Can't draw vibrato without an attached note.");this.setRendered();const a=this.note.getModifierStartXY(Y.Position.RIGHT,this.index).x+this.x_shift,b=this.note.getYForTopText(this.text_line)+2;_e.renderVibrato(e,a,b,this.render_options)}static renderVibrato(e,a,b,w){const{harsh:C,vibrato_width:V,wave_width:z,wave_girth:J,wave_height:Z}=w,re=V/z;let ae;if(e.beginPath(),C){for(e.moveTo(a,b+J+1),ae=0;ae<re/2;++ae)e.lineTo(a+z,b-Z/2),a+=z,e.lineTo(a+z,b+Z/2),a+=z;for(ae=0;ae<re/2;++ae)e.lineTo(a-z,b-Z/2+J+1),a-=z,e.lineTo(a-z,b+Z/2+J+1),a-=z;e.fill()}else{for(e.moveTo(a,b+J),ae=0;ae<re/2;++ae)e.quadraticCurveTo(a+z/2,b-Z/2,a+z,b),a+=z,e.quadraticCurveTo(a+z/2,b+Z/2,a+z,b),a+=z;for(ae=0;ae<re/2;++ae)e.quadraticCurveTo(a-z/2,b+Z/2+J,a-z,b+J),a-=z,e.quadraticCurveTo(a-z/2,b-Z/2+J,a-z,b+J),a-=z;e.fill()}}}function Te(...ce){Le.DEBUG&&l.L("Vex.Flow.ModifierContext",ce)}class Le{constructor(){this.modifiers={},this.preFormatted=!1,this.postFormatted=!1,this.width=0,this.spacing=0,this.state={left_shift:0,right_shift:0,text_line:0,top_text_line:0},this.PREFORMAT=[oe,X,$,N,W,H,R,K,Se,ye,be,Me,_e],this.POSTFORMAT=[oe]}addModifier(e){const a=e.getCategory();return this.modifiers[a]||(this.modifiers[a]=[]),this.modifiers[a].push(e),e.setModifierContext(this),this.preFormatted=!1,this}getModifiers(e){return this.modifiers[e]}getWidth(){return this.width}getExtraLeftPx(){return this.state.left_shift}getExtraRightPx(){return this.state.right_shift}getState(){return this.state}getMetrics(){if(!this.formatted)throw new l.RERR("UnformattedModifier","Unformatted modifier has no metrics.");return{width:this.state.left_shift+this.state.right_shift+this.spacing,spacing:this.spacing,extra_left_px:this.state.left_shift,extra_right_px:this.state.right_shift}}preFormat(){this.preFormatted||(this.PREFORMAT.forEach(e=>{Te("Preformatting ModifierContext: ",e.CATEGORY),e.format(this.getModifiers(e.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(e=>{Te("Postformatting ModifierContext: ",e.CATEGORY),e.postFormat(this.getModifiers(e.CATEGORY),this)})}}function Pe(ce,e,a,b){let w=e;for(a+=1;a<ce.length;a+=1){const C=ce[a];if(!C.isRest()&&!C.shouldIgnoreTicks()){w=C.getLineForRest();break}}if(b&&e!==w){const C=Math.max(e,w),V=Math.min(e,w);w=l.MidLine(C,V)}return w}function Ae(ce,e,a){if(!ce||!ce.length)throw new l.RERR("BadArgument","No voices to format");ce[0].getTotalTicks();const b=ce.reduce((z,J)=>{if(J.getMode()===D.Mode.STRICT&&!J.isComplete())throw new l.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(z,s.LCM(z,J.getResolutionMultiplier()))},1),w={},C=[],V=[];return ce.forEach(z=>{const J=new s(0,b);z.getTickables().forEach(Z=>{const re=J.numerator;if(!w[re]){const ae=new e;V.push(ae),w[re]=ae}a(Z,w[re]),C.push(re),J.add(Z.getTicks())})}),{map:w,array:V,list:l.SortAndUnique(C,(z,J)=>z-J,(z,J)=>z===J),resolutionMultiplier:b}}class Ce{static SimpleFormat(e,a=0,{paddingBetween:b=10}={}){e.reduce((w,C)=>{C.addToModifierContext(new Le);const V=new q().addTickable(C).preFormat(),z=V.getExtraPx();return V.setX(w+z.left),w+V.getWidth()+z.right+b},a)}static plotDebugging(e,a,b,w,C){const V=b+j.STAVEPADDING,z=a.contextGaps;e.save(),e.setFont("Arial",8,""),z.gaps.forEach(J=>{var Z,re,ae;Z=V+J.x1,re=V+J.x2,ae="#aaa",e.beginPath(),e.setStrokeStyle(ae),e.setFillStyle(ae),e.setLineWidth(1),e.fillRect(Z,w,re-Z,C-w),e.fillText(Math.round(J.x2-J.x1),V+J.x1,C+12)}),e.fillText(Math.round(z.total)+"px",V-20,C+12),e.setFillStyle("red"),e.fillText("Loss: "+a.lossHistory.map(J=>Math.round(J)),V-20,C+22),e.restore()}static FormatAndDraw(e,a,b,w){const C={auto_beam:!1,align_rests:!1};typeof w=="object"?l.Merge(C,w):typeof w=="boolean"&&(C.auto_beam=w);const V=new D(m.TIME4_4).setMode(D.Mode.SOFT).addTickables(b),z=C.auto_beam?B.applyAndGetBeams(V):[];return new Ce().joinVoices([V],{align_rests:C.align_rests}).formatToStave([V],a,{align_rests:C.align_rests,stave:a}),V.setStave(a).draw(e,a),z.forEach(J=>J.setContext(e).draw()),V.getBoundingBox()}static FormatAndDrawTab(e,a,b,w,C,V,z){const J={auto_beam:V,align_rests:!1};typeof z=="object"?l.Merge(J,z):typeof z=="boolean"&&(J.auto_beam=z);const Z=new D(m.TIME4_4).setMode(D.Mode.SOFT).addTickables(C),re=new D(m.TIME4_4).setMode(D.Mode.SOFT).addTickables(w),ae=J.auto_beam?B.applyAndGetBeams(Z):[];new Ce().joinVoices([Z],{align_rests:J.align_rests}).joinVoices([re]).formatToStave([Z,re],b,{align_rests:J.align_rests}),Z.draw(e,b),re.draw(e,a),ae.forEach(le=>le.setContext(e).draw()),new F(b,a).setContext(e).draw()}static AlignRestsToNotes(e,a,b){return e.forEach((w,C)=>{if(w instanceof oe&&w.isRest()){if(w.tuplet&&!b)return;const V=w.getGlyph().position.toUpperCase();if(V!=="R/4"&&V!=="B/4")return;if(a||w.beam!=null){const z=w.getKeyProps()[0];if(C===0)z.line=Pe(e,z.line,C,!1),w.setKeyLine(0,z.line);else if(C>0&&C<e.length){let J;const Z=e[C-1];Z.isRest()&&Z.getKeyProps?(J=Z.getKeyProps()[0].line,z.line=J):(J=Z.getLineForRest(),z.line=Pe(e,J,C,!0)),w.setKeyLine(0,z.line)}}}}),this}constructor(){this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.totalTicks=new s(0,1),this.tickContexts=null,this.modiferContexts=null,this.contextGaps={total:0,gaps:[]},this.voices=[]}alignRests(e,a){if(!e||!e.length)throw new l.RERR("BadArgument","No voices to format rests");e.forEach(b=>Ce.AlignRestsToNotes(b.getTickables(),a))}preCalculateMinTotalWidth(e){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!e)throw new l.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(e)}const{list:a,map:b}=this.tickContexts;return this.minTotalWidth=a.map(w=>{const C=b[w];return C.preFormat(),C.getWidth()}).reduce((w,C)=>w+C,0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new l.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(e){const a=Ae(e,Le,(b,w)=>b.addToModifierContext(w));return this.modiferContexts=a,a}createTickContexts(e){const a=Ae(e,q,(b,w)=>w.addTickable(b));return a.array.forEach(b=>{b.tContexts=a.array}),this.totalTicks=e[0].getTicksUsed().clone(),this.tickContexts=a,a}preFormat(e=0,a,b,w){const C=this.tickContexts,{list:V,map:z,resolutionMultiplier:J}=C;b&&w&&b.forEach(me=>me.setStave(w).preFormat());let Z=0,re=0;const ae=e/2;if(this.minTotalWidth=0,V.forEach(me=>{const Ee=z[me];a&&Ee.setContext(a),Ee.preFormat();const Re=Ee.getWidth();this.minTotalWidth+=Re;const we=Ee.getMetrics();Z=Z+re+we.extraLeftPx,Ee.setX(Z),re=Re-we.extraLeftPx}),this.minTotalWidth=Z+re,this.hasMinTotalWidth=!0,e<=0)return;const le=e-this.minTotalWidth;let he=this.totalTicks.value();he===0&&(he=1);const pe=le/(he*J);let ge=0;V.forEach((me,Ee)=>{const Re=V[Ee-1]||0,we=z[me];ge+=(me-Re)*pe,we.setX(we.getX()+ge),we.getCenterAlignedTickables().forEach(Ne=>{Ne.center_x_shift=ae-we.getX()})}),V.length!==1&&(this.justifyWidth=e,this.lossHistory=[],this.evaluate())}evaluate(){const e=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((w,C)=>{if(C===0)return;const V=this.tickContexts.list[C-1],z=this.tickContexts.map[V],J=this.tickContexts.map[w],Z=z.getMetrics(),re=z.getX()+Z.width,ae=J.getX(),le=ae-re;this.contextGaps.total+=le,this.contextGaps.gaps.push({x1:re,x2:ae}),J.getFormatterMetrics().freedom.left=le,z.getFormatterMetrics().freedom.right=le});const a=this.durationStats={};this.voices.forEach(w=>{w.getTickables().forEach((C,V,z)=>{const J=C.getTicks().clone().simplify().toString(),Z=C.getMetrics(),re=C.getFormatterMetrics(),ae=C.getX()+Z.noteWidth+Z.modRightPx+Z.extraRightPx;let le=0;if(V<z.length-1){const he=z[V+1],pe=he.getMetrics();le=he.getX()-pe.modLeftPx-pe.extraLeftPx-ae,re.space.used=he.getX()-C.getX(),he.getFormatterMetrics().freedom.left=le}else le=e-ae,re.space.used=e-C.getX();re.freedom.right=le,function(he,pe){const ge=a[he];ge===void 0?a[he]={mean:pe,count:1}:(ge.count+=1,ge.mean=(ge.mean+pe)/2)}(J,re.space.used)})});let b=0;return this.voices.forEach(w=>{w.getTickables().forEach(C=>{const V=C.getTicks().clone().simplify().toString(),z=C.getFormatterMetrics();z.iterations+=1,z.space.deviation=z.space.used-a[V].mean,z.duration=V,z.space.mean=a[V].mean,b+=Math.pow(a[V].mean,2)})}),this.totalCost=Math.sqrt(b),this.lossHistory.push(this.totalCost),this}tune(){let e=0;return this.tickContexts.list.forEach((a,b,w)=>{const C=this.tickContexts.map[a],V=b>0?this.tickContexts.map[w[b-1]]:null,z=b<w.length-1?this.tickContexts.map[w[b+1]]:null;(function(re,ae,le,he){re.setX(re.getX()+he),re.getFormatterMetrics().freedom.left+=he,re.getFormatterMetrics().freedom.right-=he,ae&&(ae.getFormatterMetrics().freedom.right+=he),le&&(le.getFormatterMetrics().freedom.left-=he)})(C,V,z,e);const J=-C.getTickables().map(re=>re.getFormatterMetrics().space.deviation).reduce((re,ae)=>re+ae);J>0?e=-Math.min(C.getFormatterMetrics().freedom.right,Math.abs(J)):J<0&&(e=z?Math.min(z.getFormatterMetrics().freedom.right,Math.abs(J)):0);const Z=Math.min(5,Math.abs(e));e=e>0?Z:-Z}),this.evaluate()}postFormat(){const e=a=>a.list.forEach(b=>a.map[b].postFormat());return e(this.modiferContexts),e(this.tickContexts),this}joinVoices(e){return this.createModifierContexts(e),this.hasMinTotalWidth=!1,this}format(e,a,b){const w={align_rests:!1,context:null,stave:null};return l.Merge(w,b),this.voices=e,this.alignRests(e,w.align_rests),this.createTickContexts(e),this.preFormat(a,w.context,e,w.stave),w.stave&&this.postFormat(),this}formatToStave(e,a,b){const w=a.getNoteEndX()-a.getNoteStartX()-10;(function(...V){Ce.DEBUG&&l.L("Vex.Flow.Formatter",V)})("Formatting voices to width: ",w);const C={context:a.getContext()};return l.Merge(C,b),this.format(e,w,C)}}class Be extends o{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=Be.Position.ABOVE,this.layoutMetrics=null}getPosition(){return this.position}setPosition(e){return this.position=e,this}getStave(){return this.stave}setStave(e){return this.stave=e,this}getWidth(){return this.width}setWidth(e){return this.width=e,this}getX(){return this.x}setX(e){return this.x=e,this}getCategory(){return""}makeSpacer(e){return{getContext:()=>!0,setStave(){},renderToStave(){},getMetrics:()=>({width:e})}}placeGlyphOnLine(e,a,b){e.setYShift(a.getYForLine(b)-a.getYForGlyphs())}getPadding(e){return e!==void 0&&e<2?0:this.padding}setPadding(e){return this.padding=e,this}setLayoutMetrics(e){return this.layoutMetrics=e,this}getLayoutMetrics(){return this.layoutMetrics}}class Ie extends Be{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,DOUBLE_HEAVY:8}}static get typeString(){return{single:Ie.type.SINGLE,double:Ie.type.DOUBLE,doubleheavy:Ie.type.DOUBLE_HEAVY,end:Ie.type.END,repeatBegin:Ie.type.REPEAT_BEGIN,repeatEnd:Ie.type.REPEAT_END,repeatBoth:Ie.type.REPEAT_BOTH,none:Ie.type.NONE}}constructor(e){super(),this.setAttribute("type","Barline"),this.thickness=m.STAVE_LINE_THICKNESS;const a=Ie.type;this.widths={},this.widths[a.SINGLE]=5,this.widths[a.DOUBLE]=5,this.widths[a.DOUBLE_HEAVY]=5,this.widths[a.END]=5,this.widths[a.REPEAT_BEGIN]=5,this.widths[a.REPEAT_END]=5,this.widths[a.REPEAT_BOTH]=5,this.widths[a.NONE]=5,this.paddings={},this.paddings[a.SINGLE]=0,this.paddings[a.DOUBLE]=0,this.paddings[a.DOUBLE_HEAVY]=0,this.paddings[a.END]=5,this.paddings[a.REPEAT_BEGIN]=10,this.paddings[a.REPEAT_END]=10,this.paddings[a.REPEAT_BOTH]=15,this.paddings[a.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[a.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.DOUBLE_HEAVY]={xMin:-5,xMax:4,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[a.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(Be.Position.BEGIN),this.setType(e)}getCategory(){return Ie.CATEGORY}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Ie.typeString[e]:e,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(e){switch(e.checkContext(),this.setRendered(),this.type){case Ie.type.SINGLE:this.drawVerticalBar(e,this.x,!1);break;case Ie.type.DOUBLE:this.drawVerticalBar(e,this.x,!0);break;case Ie.type.DOUBLE_HEAVY:this.drawVerticalBar(e,this.x,!0,!0);break;case Ie.type.END:this.drawVerticalEndBar(e,this.x);break;case Ie.type.REPEAT_BEGIN:this.drawRepeatBar(e,this.x,!0),e.getX()!==this.x&&this.drawVerticalBar(e,e.getX());break;case Ie.type.REPEAT_END:this.drawRepeatBar(e,this.x,!1);break;case Ie.type.REPEAT_BOTH:this.drawRepeatBar(e,this.x,!1),this.drawRepeatBar(e,this.x,!0)}}drawVerticalBar(e,a,b,w){e.checkContext();const C=e.getTopLineTopY(),V=e.getBottomLineBottomY();let z=1,J=1,Z=a-3,re=a;w&&(z=3,J=3,Z=a-5,re=a),b&&e.context.fillRect(Z,C,z,V-C),e.context.fillRect(re,C,J,V-C)}drawVerticalEndBar(e,a){e.checkContext();const b=e.getTopLineTopY(),w=e.getBottomLineBottomY();e.context.fillRect(a-5,b,1,w-b),e.context.fillRect(a-2,b,3,w-b)}drawRepeatBar(e,a,b){e.checkContext();const w=e.getTopLineTopY(),C=e.getBottomLineBottomY();let V=3;b||(V=-5),e.context.fillRect(a+V,w,1,C-w),e.context.fillRect(a-2,w,3,C-w),b?V+=4:V-=4;const z=a+V+1;let J=(e.getNumLines()-1)*e.getSpacingBetweenLines();J=J/2-e.getSpacingBetweenLines()/2;let Z=w+J+1;e.context.beginPath(),e.context.arc(z,Z,2,0,2*Math.PI,!1),e.context.fill(),Z+=e.getSpacingBetweenLines(),e.context.beginPath(),e.context.arc(z,Z,2,0,2*Math.PI,!1),e.context.fill()}}class Fe extends Be{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(e,a,b){super(),this.setAttribute("type","Repetition"),this.symbol_type=e,this.x=a,this.x_shift=0,this.y_shift=b,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return Fe.CATEGORY}setShiftX(e){return this.x_shift=e,this}setShiftY(e){return this.y_shift=e,this}setX(e){return this.x=e,this}draw(e,a){switch(this.setRendered(),this.symbol_type){case Fe.type.CODA_RIGHT:this.drawCodaFixed(e,a+e.width);break;case Fe.type.CODA_LEFT:this.drawSymbolText(e,a,"Coda",!0);break;case Fe.type.SEGNO_LEFT:this.drawSignoFixed(e,a);break;case Fe.type.SEGNO_RIGHT:this.drawSignoFixed(e,a+e.width);break;case Fe.type.DC:this.drawSymbolText(e,a,"D.C.",!1);break;case Fe.type.DC_AL_CODA:this.drawSymbolText(e,a,"D.C. al",!0);break;case Fe.type.DC_AL_FINE:this.drawSymbolText(e,a,"D.C. al Fine",!1);break;case Fe.type.DS:this.drawSymbolText(e,a,"D.S.",!1);break;case Fe.type.DS_AL_CODA:this.drawSymbolText(e,a,"D.S. al",!0);break;case Fe.type.DS_AL_FINE:this.drawSymbolText(e,a,"D.S. al Fine",!1);break;case Fe.type.FINE:this.drawSymbolText(e,a,"Fine",!1);break;case Fe.type.TO_CODA:this.drawSymbolText(e,a,"To",!0)}return this}drawCodaFixed(e,a){const b=e.getYForTopText(e.options.num_lines)+this.y_shift;return p.renderGlyph(e.context,this.x+a+this.x_shift,b+25,40,"v4d",!0),this}drawSignoFixed(e,a){const b=e.getYForTopText(e.options.num_lines)+this.y_shift;return p.renderGlyph(e.context,this.x+a+this.x_shift,b+25,30,"v8c",!0),this}drawSymbolText(e,a,b,w){const C=e.checkContext();C.save(),C.setFont(this.font.family,this.font.size,this.font.weight);let V=0+this.x_shift,z=a+this.x_shift;if(this.symbol_type===Fe.type.CODA_LEFT?(V=this.x+this.x_shift,z=V+C.measureText(b).width+12):(this.x_shift=-(V+C.measureText(b).width+12+e.options.vertical_bar_width+12),V=this.x+this.x_shift+e.options.vertical_bar_width,z=V+C.measureText(b).width+12),this.xShiftAsPercentOfStaveWidth){const Z=e.width*this.xShiftAsPercentOfStaveWidth;this.symbol_type!==Fe.type.DC_AL_FINE&&this.symbol_type!==Fe.type.FINE&&this.symbol_type!==Fe.type.DC&&this.symbol_type!==Fe.type.DS_AL_FINE&&this.symbol_type!==Fe.type.DS&&this.symbol_type!==Fe.type.FINE||(V+=Z)}const J=e.getYForTopText(e.options.num_lines)+this.y_shift+25;return w&&p.renderGlyph(C,z,J,40,"v4d",!0),C.fillText(b,V,J+5),C.restore(),this}}class Ke extends Be{static get CATEGORY(){return"stavesection"}constructor(e,a,b){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=e,this.x=a,this.shift_x=0,this.shift_y=b,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return Ke.CATEGORY}setStaveSection(e){return this.section=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}draw(e,a){const b=e.checkContext();this.setRendered(),b.save(),b.lineWidth=2,b.setFont(this.font.family,this.font.size,this.font.weight);const w=b.measureText(""+this.section),C=w.width;let V=w.height;!V&&w.emHeightAscent>=0&&(V=w.emHeightAscent+2),V||(V=w.fontBoundingBoxAscent+3);let z=C+6;z<18&&(z=18);const J=V+this.font.size/10,Z=e.getYForTopText(3)+19-1.15*J+this.shift_y;let re=this.x+a;return b.beginPath(),b.lineWidth=2,b.rect(re,Z+V/4,z,J),b.stroke(),re+=(z-C)/2,b.fillText(""+this.section,re,Z+J),b.restore(),this}}class st extends Be{static get CATEGORY(){return"stavetempo"}constructor(e,a,b){super(),this.setAttribute("type","StaveTempo"),this.tempo=e,this.position=Y.Position.ABOVE,this.x=a,this.shift_x=10,this.shift_y=b,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return st.CATEGORY}setTempo(e){return this.tempo=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}draw(e,a){const b=e.checkContext();this.setRendered(),b.openGroup("stavetempo");const w=this.render_options,C=w.glyph_font_scale/38,V=this.tempo.name,z=this.tempo.duration,J=this.tempo.dots,Z=this.tempo.bpm,re=this.tempo.noteEquation,ae=this.font;let le=this.x+this.shift_x+a;const he=e.getYForTopText(1)+this.shift_y;if(b.save(),V&&(b.setFont(ae.family,ae.size,ae.weight),b.fillText(V,le,he),le+=b.measureText(V).width),re)le=this.drawNoteEquation(b,le,he,C,re);else if(z&&Z){b.setFont(ae.family,ae.size,"normal"),V&&(le+=b.measureText(" ").width,b.fillText("(",le,he),le+=b.measureText("(").width);const pe=m.getGlyphProps(z);if(le+=3*C,p.renderGlyph(b,le,he,w.glyph_font_scale,pe.code_head),le+=pe.getWidth()*C,pe.stem){let ge=30;pe.beam_count&&(ge+=3*(pe.beam_count-1)),ge*=C;const me=he-ge;b.fillRect(le-C,me,C,ge),pe.flag&&(p.renderGlyph(b,le,me,w.glyph_font_scale,pe.code_flag_upstem),J||(le+=6*C))}for(let ge=0;ge<J;ge++)le+=6*C,b.beginPath(),b.arc(le,he+2*C,2*C,0,2*Math.PI,!1),b.fill();b.openGroup("bpm"),b.fillText(" = "+Z+(V?")":""),le+3*C,he),b.closeGroup()}return b.closeGroup(),b.restore(),this}drawNoteEquation(e,a,b,w,C){const V=this.font,z=4*w;return a=this.drawNoteGroup(e,a,b,w,z,C.left),e.setFont(V.family,V.size,"bold"),a+=1.5*z,e.fillText("=",a,b),a+=e.measureText("=").width+1.5*z,this.drawNoteGroup(e,a,b,w,z,C.right)}drawNoteGroup(e,a,b,w,C,V){const z=this.render_options,J=V.notes,Z=V.tuplet,re=[],ae=[];let le=[];for(let pe=0;pe<J.length;pe++){const ge=J[pe],me=m.getGlyphProps(ge.duration);if(!me)continue;const Ee=a+=3*w;p.renderGlyph(e,a,b,z.glyph_font_scale,me.code_head);let Re=b;const we=a+=me.getWidth()*w;if(me.stem){let De=30;De*=w,Re=b-De,e.fillRect(a-w,Re,w,De),me.flag&&!ge.beam&&(p.renderGlyph(e,a,Re,z.glyph_font_scale,me.code_flag_upstem),ge.dots||(a+=6*w))}for(let De=0;De<(ge.dots||0);De++)a+=6*w,e.beginPath(),e.arc(a,b+2*w,2*w,0,2*Math.PI,!1),e.fill();const Ne={x:Ee,y_top:Re,stemX:we,code:me};re.push(Ne),ge.beam==="begin"?le=[Ne]:ge.beam==="continue"?le.push(Ne):ge.beam==="end"&&(le.push(Ne),ae.push(le),le=[]),pe<J.length-1&&(a+=Z?2*C:C)}const he=3*w;for(const pe of ae){if(pe.length<2)continue;const ge=pe[0],me=pe[pe.length-1];let Ee=0;for(const Re of pe)Re.code.beam_count&&(Ee=Math.max(Ee,Re.code.beam_count));for(let Re=0;Re<Ee;Re++){const we=ge.y_top+Re*(he+1*w);e.fillRect(ge.stemX-w,we,me.stemX-ge.stemX+w,he)}}if(Z&&re.length>0){const pe=re[0],ge=re[re.length-1];let me=pe.y_top;for(const De of re)me=Math.min(me,De.y_top);const Ee=1.25*C,Re=me-1.5*C,we=pe.x-.5*C,Ne=ge.stemX+Ee;if(Z.bracket){const De=C;e.beginPath(),e.moveTo(we,Re+De),e.lineTo(we,Re);const Oe=(we+Ne)/2,ke=Z.showNumber==="both"?`${Z.actualNotes}:${Z.normalNotes}`:`${Z.actualNotes}`;e.setFont(this.font.family,this.font.size-3,"bold");const Ue=e.measureText(ke).width,Ge=Ue/2+2*w;e.lineTo(Oe-Ge,Re),e.stroke(),e.beginPath(),e.moveTo(Oe+Ge,Re),e.lineTo(Ne,Re),e.lineTo(Ne,Re+De),e.stroke(),e.fillText(ke,Oe-Ue/2,Re-1*w)}else if(Z.showNumber!=="none"){const De=(we+Ne)/2,Oe=Z.showNumber==="both"?`${Z.actualNotes}:${Z.normalNotes}`:`${Z.actualNotes}`;e.setFont(this.font.family,this.font.size-3,"bold");const ke=e.measureText(Oe).width;e.fillText(Oe,De-ke/2,Re-1*w)}}return a}}class je extends j{static get Justification(){return{LEFT:1,CENTER:2,RIGHT:3}}static get GLYPHS(){return{segno:{code:"v8c",point:40,x_shift:0,y_shift:-10},tr:{code:"v1f",point:40,x_shift:0,y_shift:0},mordent_upper:{code:"v1e",point:40,x_shift:0,y_shift:0},mordent_lower:{code:"v45",point:40,x_shift:0,y_shift:0},f:{code:"vba",point:40,x_shift:0,y_shift:0},p:{code:"vbf",point:40,x_shift:0,y_shift:0},m:{code:"v62",point:40,x_shift:0,y_shift:0},s:{code:"v4a",point:40,x_shift:0,y_shift:0},z:{code:"v80",point:40,x_shift:0,y_shift:0},coda:{code:"v4d",point:40,x_shift:0,y_shift:-8},pedal_open:{code:"v36",point:40,x_shift:0,y_shift:0},pedal_close:{code:"v5d",point:40,x_shift:0,y_shift:3},caesura_straight:{code:"v34",point:40,x_shift:0,y_shift:2},caesura_curved:{code:"v4b",point:40,x_shift:0,y_shift:2},breath:{code:"v6c",point:40,x_shift:0,y_shift:0},tick:{code:"v6f",point:50,x_shift:0,y_shift:0},turn:{code:"v72",point:40,x_shift:0,y_shift:0},turn_inverted:{code:"v33",point:40,x_shift:0,y_shift:0},mordent:{code:"v1e",point:40,x_shift:0,y_shift:0}}}constructor(e){if(super(e),this.setAttribute("type","TextNote"),this.text=e.text,this.superscript=e.superscript,this.subscript=e.subscript,this.glyph_type=e.glyph,this.glyph=null,this.font={family:"Arial",size:12,weight:""},e.font&&(this.font=e.font),this.glyph_type){const a=je.GLYPHS[this.glyph_type];if(!a)throw new l.RERR("Invalid glyph type: "+this.glyph_type);this.glyph=new p(a.code,a.point,{cache:!1}),a.width?this.setWidth(a.width):this.setWidth(this.glyph.getMetrics().width),this.glyph_struct=a}else this.setWidth(m.textWidth(this.text));this.line=e.line||0,this.smooth=e.smooth||!1,this.ignore_ticks=e.ignore_ticks||!1,this.justification=je.Justification.LEFT}setJustification(e){return this.justification=e,this}setLine(e){return this.line=e,this}preFormat(){this.checkContext(),this.preFormatted||(this.smooth?this.setWidth(0):this.glyph||this.setWidth(this.context.measureText(this.text).width),this.justification===je.Justification.CENTER?this.extraLeftPx=this.width/2:this.justification===je.Justification.RIGHT&&(this.extraLeftPx=this.width),this.setPreFormatted(!0))}draw(){if(this.checkContext(),!this.stave)throw new l.RERR("NoStave","Can't draw without a stave.");this.setRendered();const e=this.context;let a,b=this.getAbsoluteX();if(this.justification===je.Justification.CENTER?b-=this.getWidth()/2:this.justification===je.Justification.RIGHT&&(b-=this.getWidth()),this.glyph)a=this.stave.getYForLine(this.line+-3),this.glyph.render(this.context,b+this.glyph_struct.x_shift,a+this.glyph_struct.y_shift);else{a=this.stave.getYForLine(this.line+-3),this.applyStyle(e),e.setFont(this.font.family,this.font.size,this.font.weight),e.fillText(this.text,b,a);const w=e.measureText("M").width,C=e.measureText(this.text).width;this.superscript&&(e.setFont(this.font.family,this.font.size/1.3,this.font.weight),e.fillText(this.superscript,b+C+2,a-w/2.2)),this.subscript&&(e.setFont(this.font.family,this.font.size/1.3,this.font.weight),e.fillText(this.subscript,b+C+2,a+w/2.2-1)),this.restoreStyle(e)}}}class at extends Be{static get CATEGORY(){return"stavetext"}constructor(e,a,b){super(),this.setAttribute("type","StaveText"),this.setWidth(16),this.text=e,this.position=a,this.options={shift_x:0,shift_y:0,justification:je.Justification.CENTER},l.Merge(this.options,b),this.font={family:"times",size:16,weight:"normal"}}getCategory(){return at.CATEGORY}setStaveText(e){return this.text=e,this}setShiftX(e){return this.shift_x=e,this}setShiftY(e){return this.shift_y=e,this}setFont(e){l.Merge(this.font,e)}setText(e){this.text=e}draw(e){const a=e.checkContext();this.setRendered(),a.save(),a.lineWidth=2,a.setFont(this.font.family,this.font.size,this.font.weight);const b=a.measureText(""+this.text).width;let w,C;const V=Be.Position,z=je.Justification;switch(this.position){case V.LEFT:case V.RIGHT:C=(e.getYForLine(0)+e.getBottomLineY())/2+this.options.shift_y,w=this.position===V.LEFT?e.getX()-b-24+this.options.shift_x:e.getX()+e.getWidth()+24+this.options.shift_x;break;case V.ABOVE:case V.BELOW:w=e.getX()+this.options.shift_x,this.options.justification===z.CENTER?w+=e.getWidth()/2-b/2:this.options.justification===z.RIGHT&&(w+=e.getWidth()-b),C=this.position===V.ABOVE?e.getYForTopText(2)+this.options.shift_y:e.getYForBottomText(2)+this.options.shift_y;break;default:throw new l.RERR("InvalidPosition","Value Must be in Modifier.Position.")}return a.fillText(""+this.text,w,C+4),a.restore(),this}}class et extends Be{static get CATEGORY(){return"clefs"}static get types(){return{treble:{code:"v83",line:3},bass:{code:"v79",line:1},alto:{code:"vad",line:2},tenor:{code:"vad",line:1},percussion:{code:"v59",line:2},soprano:{code:"vad",line:4},"mezzo-soprano":{code:"vad",line:3},"baritone-c":{code:"vad",line:0},"baritone-f":{code:"v79",line:2},subbass:{code:"v79",line:0},french:{code:"v83",line:4},tab:{code:"v2f"}}}static get sizes(){return{default:{point:40,width:26},small:{point:32,width:20}}}static get annotations(){return{"8va":{code:"v8",sizes:{default:{point:20,attachments:{treble:{line:-1.2,x_shift:11}}},small:{point:18,attachments:{treble:{line:-.4,x_shift:8}}}}},"8vb":{code:"v8",sizes:{default:{point:20,attachments:{treble:{line:6.3,x_shift:10},bass:{line:4,x_shift:1}}},small:{point:18,attachments:{treble:{line:5.8,x_shift:6},bass:{line:3.5,x_shift:.5}}}}}}}constructor(e,a,b){super(),this.setAttribute("type","Clef"),this.setPosition(Be.Position.BEGIN),this.setType(e,a,b),this.setWidth(et.sizes[this.size].width),function(...w){et.DEBUG&&l.L("Vex.Flow.Clef",w)}("Creating clef:",e)}getCategory(){return et.CATEGORY}setType(e,a,b){if(this.type=e,this.clef=et.types[e],this.size=a===void 0?"default":a,this.clef.point=et.sizes[this.size].point,this.glyph=new p(this.clef.code,this.clef.point),b!==void 0){const w=et.annotations[b];this.annotation={code:w.code,point:w.sizes[this.size].point,line:w.sizes[this.size].attachments[this.type].line,x_shift:w.sizes[this.size].attachments[this.type].x_shift},this.attachment=new p(this.annotation.code,this.annotation.point),this.attachment.metrics.x_max=0,this.attachment.setXShift(this.annotation.x_shift)}else this.annotation=void 0;return this}getWidth(){if(this.type==="tab"&&!this.stave)throw new l.RERR("ClefError","Can't get width without stave.");return this.width}setStave(e){if(this.stave=e,this.type!=="tab")return this;let a,b;const w=this.stave.getOptions().num_lines;switch(w){case 8:a=55,b=14;break;case 7:a=47,b=8;break;case 6:a=40,b=1;break;case 5:a=30,b=-6;break;case 4:a=23,b=-12;break;case 3:a=16,b=-18;break;default:throw new l.RERR("ClefError",`Invalid number of lines: ${w}`)}return this.glyph.setPoint(a),this.glyph.setYShift(b),this}draw(){if(!this.x)throw new l.RERR("ClefError","Can't draw clef without x.");if(!this.stave)throw new l.RERR("ClefError","Can't draw clef without stave.");this.setRendered(),this.glyph.setStave(this.stave),this.glyph.setContext(this.stave.context),this.clef.line!==void 0&&this.placeGlyphOnLine(this.glyph,this.stave,this.clef.line),this.stave.context.openGroup("clef"),this.glyph.renderToStave(this.x),this.annotation!==void 0&&(this.placeGlyphOnLine(this.attachment,this.stave,this.annotation.line),this.attachment.setStave(this.stave),this.attachment.setContext(this.stave.context),this.attachment.renderToStave(this.x)),this.stave.context.closeGroup()}}class We extends Be{static get CATEGORY(){return"keysignatures"}static get accidentalSpacing(){return{"#":{above:6,below:4},b:{above:4,below:7},n:{above:4,below:1},"##":{above:6,below:4},bb:{above:4,below:7},db:{above:4,below:7},d:{above:4,below:7},bbs:{above:4,below:7},"++":{above:6,below:4},"+":{above:6,below:4},"+-":{above:6,below:4},"++-":{above:6,below:4},bs:{above:4,below:10},bss:{above:4,below:10}}}constructor(e,a,b){super(),this.setAttribute("type","KeySignature"),this.setKeySig(e,a,b),this.setPosition(Be.Position.BEGIN),this.glyphFontScale=38,this.glyphs=[],this.xPositions=[],this.paddingForced=!1}getCategory(){return We.CATEGORY}convertToGlyph(e,a){const b=m.accidentalCodes(e.type),w=new p(b.code,this.glyphFontScale);let C=1;if(e.type==="n"&&a){const J=We.accidentalSpacing[a.type];J&&(C=a.line>=e.line?J.above:J.below)}this.placeGlyphOnLine(w,this.stave,e.line),this.glyphs.push(w);const V=this.xPositions[this.xPositions.length-1],z=w.getMetrics().width+C;this.xPositions.push(V+z),this.width+=z}cancelKey(e){return this.formatted=!1,this.cancelKeySpec=e,this}convertToCancelAccList(e){const a=m.keySignature(e),b=this.accList.length>0&&a.length>0&&a[0].type!==this.accList[0].type,w=b?a.length:a.length-this.accList.length;if(w<1)return;const C=[];for(let V=0;V<w;V++){let z=V;b||(z=a.length-w+V);const J=a[z];C.push({type:"n",line:J.line})}return this.accList=C.concat(this.accList),{accList:C,type:a[0].type}}addToStave(e){return this.paddingForced=!0,e.addModifier(this),this}convertAccLines(e,a,b=this.accList){let w,C,V=0;switch(e){case"soprano":a==="#"?w=[2.5,.5,2,0,1.5,-.5,1]:V=-1;break;case"mezzo-soprano":a==="b"?w=[0,2,.5,2.5,1,3,1.5]:V=1.5;break;case"alto":V=.5;break;case"tenor":a==="#"?w=[3,1,2.5,.5,2,0,1.5]:V=-.5;break;case"baritone-f":case"baritone-c":a==="b"?w=[.5,2.5,1,3,1.5,3.5,2]:V=2;break;case"bass":case"french":V=1}if(w!==void 0)for(C=0;C<b.length;++C)b[C].line=w[C];else if(V!==0)for(C=0;C<b.length;++C)b[C].line+=V}getPadding(e){return this.formatted||this.format(),this.glyphs.length===0||!this.paddingForced&&e<2?0:this.padding}getWidth(){return this.formatted||this.format(),this.width}setKeySig(e,a,b){return this.formatted=!1,this.keySpec=e,this.cancelKeySpec=a,this.alterKeySpec=b,this}alterKey(e){return this.formatted=!1,this.alterKeySpec=e,this}convertToAlterAccList(e){const a=Math.min(e.length,this.accList.length);for(let b=0;b<a;++b)e[b]&&(this.accList[b].type=e[b])}format(){if(!this.stave)throw new l.RERR("KeySignatureError","Can't draw key signature without stave.");this.width=0,this.glyphs=[],this.xPositions=[0],this.accList=m.keySignature(this.keySpec);const e=this.accList,a=e.length>0?e[0].type:null;let b;if(this.cancelKeySpec&&(b=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const w=(this.position===Be.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;b&&this.convertAccLines(w,b.type,b.accList),this.convertAccLines(w,a,e);for(let C=0;C<this.accList.length;++C)this.convertToGlyph(this.accList[C],this.accList[C+1])}this.formatted=!0}draw(){if(!this.x)throw new l.RERR("KeySignatureError","Can't draw key signature without x.");if(!this.stave)throw new l.RERR("KeySignatureError","Can't draw key signature without stave.");if(this.formatted||this.format(),this.setRendered(),this.glyphs.length>0){const e=this.stave.context.openGroup("keysignature");for(let a=0;a<this.glyphs.length;a++){const b=this.glyphs[a],w=this.x+this.xPositions[a];b.setStave(this.stave),b.setContext(this.stave.context),b.renderToStave(w)}this.hidden&&e&&e.setAttribute("visibility","hidden"),this.stave.context.closeGroup()}}}class Xe extends Be{static get CATEGORY(){return"timesignatures"}static get glyphs(){return{C:{code:"v41",point:40,line:2},"C|":{code:"vb6",point:40,line:2}}}constructor(e=null,a=15,b=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=b,e===null)return;const w=a;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(Be.Position.BEGIN),this.setTimeSig(e),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(w)}getCategory(){return Xe.CATEGORY}parseTimeSpec(e){if(e==="C"||e==="C|"){const{line:w,code:C,point:V}=Xe.glyphs[e];return{line:w,num:!1,glyph:new p(C,V)}}this.validate_args&&(w=>{const C=w.split("/").filter(V=>V!=="");if(C.length!==2)throw new l.RERR("BadTimeSignature",`Invalid time spec: ${w}. Must be in the form "<numerator>/<denominator>"`);C.forEach(V=>{if(isNaN(Number(V)))throw new l.RERR("BadTimeSignature",`Invalid time spec: ${w}. Must contain two valid numbers.`)})})(e);const[a,b]=e.split("/").map(w=>w.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(a,b)}}makeTimeSignatureGlyph(e,a){const b=new p("v0",this.point);b.topGlyphs=[],b.botGlyphs=[];let w=0;for(let ae=0;ae<e.length;++ae){const le=e[ae],he=new p("v"+le,this.point);b.topGlyphs.push(he),w+=he.getMetrics().width}let C=0;for(let ae=0;ae<a.length;++ae){const le=a[ae],he=new p("v"+le,this.point);b.botGlyphs.push(he),C+=he.getMetrics().width}const V=w>C?w:C,z=b.getMetrics().x_min;b.getMetrics=()=>({x_min:z,x_max:z+V,width:V});const J=(V-w)/2,Z=(V-C)/2,re=this;return b.renderToStave=function(ae){let le=ae+J;for(let he=0;he<this.topGlyphs.length;++he){const pe=this.topGlyphs[he];p.renderOutline(this.context,pe.metrics.outline,pe.scale,le+pe.x_shift,this.stave.getYForLine(re.topLine)),le+=pe.getMetrics().width}le=ae+Z;for(let he=0;he<this.botGlyphs.length;++he){const pe=this.botGlyphs[he];re.placeGlyphOnLine(pe,this.stave,pe.line),p.renderOutline(this.context,pe.metrics.outline,pe.scale,le+pe.x_shift,this.stave.getYForLine(re.bottomLine)),le+=pe.getMetrics().width}},b}getTimeSig(){return this.timeSig}setTimeSig(e){return this.timeSig=this.parseTimeSpec(e),this}draw(){if(!this.x)throw new l.RERR("TimeSignatureError","Can't draw time signature without x.");if(!this.stave)throw new l.RERR("TimeSignatureError","Can't draw time signature without stave.");this.setRendered(),this.timeSig.glyph.setStave(this.stave),this.timeSig.glyph.setContext(this.stave.context),this.placeGlyphOnLine(this.timeSig.glyph,this.stave,this.timeSig.line);const e=this.stave.context.openGroup("timesignature");this.timeSig.glyph.renderToStave(this.x),this.hidden&&e&&e.setAttribute("visibility","hidden"),this.stave.context.closeGroup("timesignature")}}class ot extends Be{static get CATEGORY(){return"voltas"}static get type(){return{NONE:1,BEGIN:2,MID:3,END:4,BEGIN_END:5}}constructor(e,a,b,w){super(),this.setAttribute("type","Volta"),this.volta=e,this.x=b,this.y_shift=w,this.number=a,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return ot.CATEGORY}setShiftY(e){return this.y_shift=e,this}draw(e,a){const b=e.checkContext();this.setRendered();let w=e.width-a;const C=e.getYForTopText(e.options.num_lines)+this.y_shift,V=1.5*e.options.spacing_between_lines_px;switch(this.volta){case ot.type.BEGIN:b.fillRect(this.x+a,C,1,V);break;case ot.type.END:w-=5,b.fillRect(this.x+a+w,C,1,V);break;case ot.type.BEGIN_END:w-=3,b.fillRect(this.x+a,C,1,V),b.fillRect(this.x+a+w,C,1,V)}return this.volta!==ot.type.BEGIN&&this.volta!==ot.type.BEGIN_END||(b.save(),b.setFont(this.font.family,this.font.size,this.font.weight),b.fillText(this.number,this.x+a+5,C+15),b.restore()),b.fillRect(this.x+a,C,w,1),this}}class ze extends o{constructor(e,a,b,w){super(),this.setAttribute("type","Stave"),this.x=e,this.y=a,this.width=b,this.formatted=!1,this.setStartX(e+5),this.end_x=e+b,this.modifiers=[],this.measure=0,this.clef="treble",this.endClef=void 0,this.font={family:"sans-serif",size:8,weight:""},this.options={vertical_bar_width:10,glyph_spacing_px:10,num_lines:5,fill_style:"#999999",left_bar:!0,right_bar:!0,spacing_between_lines_px:10,space_above_staff_ln:4,space_below_staff_ln:4,top_text_position:1},this.bounds={x:this.x,y:this.y,w:this.width,h:0},l.Merge(this.options,w),this.resetLines();const C=Ie.type;this.addModifier(new Ie(this.options.left_bar?C.SINGLE:C.NONE)),this.addEndModifier(new Ie(this.options.right_bar?C.SINGLE:C.NONE))}space(e){return this.options.spacing_between_lines_px*e}resetLines(){this.options.line_config=[];for(let e=0;e<this.options.num_lines;e++)this.options.line_config.push({visible:!0});this.height=(this.options.num_lines+this.options.space_above_staff_ln)*this.options.spacing_between_lines_px,this.options.bottom_text_position=this.options.num_lines}formatBegModifiers(e){let a=0;e.forEach(b=>{b.getNoteStartX()>a&&(a=b.getNoteStartX())}),e.forEach(b=>{b.setNoteStartX(a)}),a=0,e.forEach(b=>{b.getModifiers(Be.Position.BEGIN,Ie.CATEGORY).forEach(w=>{w.getType()==Ie.type.REPEAT_BEGIN&&w.getX()>a&&(a=w.getX())})}),e.forEach(b=>{b.getModifiers(Be.Position.BEGIN,Ie.CATEGORY).forEach(w=>{w.getType()==Ie.type.REPEAT_BEGIN&&w.setX(a)})}),a=0,e.forEach(b=>{b.getModifiers(Be.Position.BEGIN,Xe.CATEGORY).forEach(w=>{w.getX()>a&&(a=w.getX())})}),e.forEach(b=>{b.getModifiers(Be.Position.BEGIN,Xe.CATEGORY).forEach(w=>{w.setX(a)})})}getOptions(){return this.options}setNoteStartX(e){return this.formatted||this.format(),this.setStartX(e),this}setStartX(e){this.start_x=e}getNoteStartX(){return this.formatted||this.format(),this.start_x}getNoteEndX(){return this.formatted||this.format(),this.end_x}getTieStartX(){return this.start_x}getTieEndX(){return this.x+this.width}getX(){return this.x}getNumLines(){return this.options.num_lines}setNumLines(e){return this.options.num_lines=parseInt(e,10),this.resetLines(),this}setY(e){return this.y=e,this}getTopLineTopY(){return this.getYForLine(0)-m.STAVE_LINE_THICKNESS/2}getBottomLineBottomY(){return this.getYForLine(this.getNumLines()-1)+m.STAVE_LINE_THICKNESS/2}setX(e){const a=e-this.x;this.formatted=!1,this.x=e,this.start_x+=a,this.end_x+=a;for(let b=0;b<this.modifiers.length;b++){const w=this.modifiers[b];w.x!==void 0&&(w.x+=a)}return this}setWidth(e){return this.formatted=!1,this.width=e,this.end_x=this.x+e,this}getWidth(){return this.width}getStyle(){return{fillStyle:this.options.fill_style,strokeStyle:this.options.fill_style,lineWidth:m.STAVE_LINE_THICKNESS,...this.style||{}}}setMeasure(e){return this.measure=e,this}getModifierXShift(e=0){if(typeof e!="number")throw new l.RERR("InvalidIndex","Must be of number type");if(this.formatted||this.format(),this.getModifiers(Be.Position.BEGIN).length===1)return 0;let a=this.start_x-this.x;const b=this.modifiers[0];return b.getType()===Ie.type.REPEAT_BEGIN&&a>b.getWidth()&&(a-=b.getWidth()),a}setRepetitionTypeLeft(e,a){return this.modifiers.push(new Fe(e,this.x,a)),this}setRepetitionTypeRight(e,a){return this.modifiers.push(new Fe(e,this.x,a)),this}setVoltaType(e,a,b){return this.modifiers.push(new ot(e,a,this.x,b)),this}setSection(e,a,b=0,w=12){const C=new Ke(e,this.x+b,a);return C.font.size=w,this.modifiers.push(C),this}setTempo(e,a){return this.modifiers.push(new st(e,this.x,a)),this}setText(e,a,b){return this.modifiers.push(new at(e,a,b)),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new h(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const e=this.options,a=e.spacing_between_lines_px;return this.getYForLine(e.num_lines)+e.space_below_staff_ln*a}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(e){const a=this.options,b=a.spacing_between_lines_px,w=a.space_above_staff_ln;return this.y+e*b+w*b}getLineForY(e){const a=this.options,b=a.spacing_between_lines_px,w=a.space_above_staff_ln;return(e-this.y)/b-w}getYForTopText(e){const a=e||0;return this.getYForLine(-a-this.options.top_text_position)}getYForBottomText(e){const a=e||0;return this.getYForLine(this.options.bottom_text_position+a)}getYForNote(e){const a=this.options,b=a.spacing_between_lines_px,w=a.space_above_staff_ln;return this.y+w*b+5*b-e*b}getYForGlyphs(){return this.getYForLine(3)}addModifier(e,a){return a!==void 0&&e.setPosition(a),e.setStave(this),this.formatted=!1,this.modifiers.push(e),this}addEndModifier(e){return this.addModifier(e,Be.Position.END),this}setBegBarType(e){const{SINGLE:a,REPEAT_BEGIN:b,NONE:w}=Ie.type;return e!==a&&e!==b&&e!==w||(this.modifiers[0].setType(e),this.formatted=!1),this}setEndBarType(e){return e!==Ie.type.REPEAT_BEGIN&&(this.modifiers[1].setType(e),this.formatted=!1),this}setClef(e,a,b,w){w===void 0&&(w=Be.Position.BEGIN),w===Be.Position.END?this.endClef=e:this.clef=e;const C=this.getModifiers(w,et.CATEGORY);return C.length===0?this.addClef(e,a,b,w):C[0].setType(e,a,b),this}setEndClef(e,a,b){return this.setClef(e,a,b,Be.Position.END),this}setKeySignature(e,a,b){b===void 0&&(b=Be.Position.BEGIN);const w=this.getModifiers(b,We.CATEGORY);return w.length===0?this.addKeySignature(e,a,b):w[0].setKeySig(e,a),this}setEndKeySignature(e,a){return this.setKeySignature(e,a,Be.Position.END),this}setTimeSignature(e,a,b){b===void 0&&(b=Be.Position.BEGIN);const w=this.getModifiers(b,Xe.CATEGORY);return w.length===0?this.addTimeSignature(e,a,b):w[0].setTimeSig(e),this}setEndTimeSignature(e,a){return this.setTimeSignature(e,a,Be.Position.END),this}addKeySignature(e,a,b){return b===void 0&&(b=Be.Position.BEGIN),this.addModifier(new We(e,a).setPosition(b),b),this}addClef(e,a,b,w){return w===void 0||w===Be.Position.BEGIN?this.clef=e:w===Be.Position.END&&(this.endClef=e),this.addModifier(new et(e,a,b),w),this}addEndClef(e,a,b){return this.addClef(e,a,b,Be.Position.END),this}addTimeSignature(e,a,b){return this.addModifier(new Xe(e,a),b),this}addEndTimeSignature(e,a){return this.addTimeSignature(e,a,Be.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(e,a){return e===void 0&&a===void 0?this.modifiers:this.modifiers.filter(b=>!(e!==void 0&&e!==b.getPosition()||a!==void 0&&a!==b.getCategory()))}sortByCategory(e,a){for(let b=e.length-1;b>=0;b--)for(let w=0;w<b;w++)if(a[e[w].getCategory()]>a[e[w+1].getCategory()]){const C=e[w];e[w]=e[w+1],e[w+1]=C}}format(){const e=this.modifiers[0],a=this.modifiers[1],b=this.getModifiers(Be.Position.BEGIN),w=this.getModifiers(Be.Position.END);let C,V,z;this.sortByCategory(b,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(w,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),b.length>1&&e.getType()===Ie.type.REPEAT_BEGIN&&(b.push(b.splice(0,1)[0]),b.splice(0,0,new Ie(Ie.type.SINGLE))),w.indexOf(a)>0&&w.splice(0,0,new Ie(Ie.type.NONE));let J=0,Z=this.x;for(let le=0;le<b.length;le++){z=b[le],V=z.getPadding(le+J),C=z.getWidth(),isNaN(C)&&(z.setWidth(10),C=10),Z+=V;const he=z.getX();he>Z?Z=he:z.setX(Z),Z+=C,V+C===0&&J--}Z>this.start_x&&this.setStartX(Z),Z=this.x+this.width;const re={left:0,right:0,paddingRight:0,paddingLeft:0};let ae=0;for(let le=0;le<w.length;le++){z=w[le],ae=z.getCategory()==="barlines"?le:ae,re.right=0,re.left=0,re.paddingRight=0,re.paddingLeft=0;const he=z.getLayoutMetrics();he?(le!==0&&(re.right=he.xMax||0,re.paddingRight=he.paddingRight||0),re.left=-he.xMin||0,re.paddingLeft=he.paddingLeft||0,le===w.length-1&&(re.paddingLeft=0)):(re.paddingRight=z.getPadding(le-ae)||0,le!==0&&(re.right=z.getWidth()||0),le===0&&(re.left=z.getWidth()||0)),Z-=re.paddingRight,Z-=re.right,z.setX(Z),Z-=re.left,Z-=re.paddingLeft}this.end_x=w.length===1?this.x+this.width:Z,this.formatted=!0}draw(){this.checkContext(),this.setRendered(),this.formatted||this.format();const e=this.options.num_lines,a=this.width,b=this.x;let w;for(let C=0;C<e;C++)w=this.getYForLine(C),this.applyStyle(),this.options.line_config[C].visible&&(this.context.beginPath(),this.context.moveTo(b,w),this.context.lineTo(b+a,w),this.context.stroke()),this.restoreStyle();for(let C=0;C<this.modifiers.length;C++)typeof this.modifiers[C].draw=="function"&&(this.modifiers[C].applyStyle(this.context),this.modifiers[C].draw(this,this.getModifierXShift(C)),this.modifiers[C].restoreStyle(this.context));if(this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const C=this.context.measureText(""+this.measure).width;w=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-C/2,w),this.context.restore()}return this}drawVertical(e,a){this.drawVerticalFixed(this.x+e,a)}drawVerticalFixed(e,a){this.checkContext();const b=this.getYForLine(0),w=this.getYForLine(this.options.num_lines-1);a&&this.context.fillRect(e-3,b,1,w-b+1),this.context.fillRect(e,b,1,w-b+1)}drawVerticalBar(e){this.drawVerticalBarFixed(this.x+e,!1)}drawVerticalBarFixed(e){this.checkContext();const a=this.getYForLine(0),b=this.getYForLine(this.options.num_lines-1);this.context.fillRect(e,a,1,b-a+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(e,a){if(e>=this.options.num_lines||e<0)throw new l.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(a.visible===void 0)throw new l.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof a.visible!="boolean")throw new l.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[e]=a,this}setConfigForLines(e){if(e.length!==this.options.num_lines)throw new l.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(const a in e)e[a]||(e[a]=this.options.line_config[a]),l.Merge(this.options.line_config[a],e[a]);return this.options.line_config=e,this}}class He extends ze{constructor(e,a,b,w){const C={spacing_between_lines_px:13,num_lines:6,top_text_position:1};l.Merge(C,w),super(e,a,b,C),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}class Je extends G{static get CATEGORY(){return"tabnotes"}constructor(e,a){if(super(e),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=e.positions,l.Merge(this.render_options,{glyph_font_scale:m.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:a,draw_dots:a,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 l.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(e)}`);this.buildStem(),e.stem_direction?this.setStemDirection(e.stem_direction):this.setStemDirection(L.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return Je.CATEGORY}setGhost(e){return this.ghost=e,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const e=this.getGlyph();return this.stem_extension_override!=null?this.stem_extension_override:e?this.getStemDirection()===1?e.tabnote_stem_up_extension:e.tabnote_stem_down_extension:0}addDot(){const e=new X;return this.dots+=1,this.addModifier(e,0)}updateWidth(){this.glyphs=[],this.width=0;for(let e=0;e<this.positions.length;++e){let a=this.positions[e].fret;this.ghost&&(a="("+a+")");const b=this.render_options.fretScale??this.render_options.scale,w=m.tabToGlyph(a,b,this.render_options.TabUseXNoteheadAlternativeGlyph);a==="x"&&(w.isXGlyph=!0),this.glyphs.push(w),this.width=Math.max(w.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}setStave(e){let a;if(super.setStave(e),this.context=e.context,this.context){const w=this.context;for(this.width=0,a=0;a<this.glyphs.length;++a){const C=this.glyphs[a],V=""+C.text;V.toUpperCase()!=="X"&&(w.save(),w.setRawFont(this.render_options.font),C.width=w.measureText(V).width,w.restore(),C.getWidth=()=>C.width),this.width=Math.max(C.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const b=this.positions.map(({str:w})=>e.getYForLine(w-1));return this.setYs(b),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(e){this.setModifierContext(e);for(let a=0;a<this.modifiers.length;++a)this.modifierContext.addModifier(this.modifiers[a]);return this.modifierContext.addModifier(this),this.preFormatted=!1,this}getTieRightX(){let e=this.getAbsoluteX();return e+=this.glyph.getWidth()/2,e+=-this.width/2+this.width+2,e}getTieLeftX(){let e=this.getAbsoluteX();return e+=this.glyph.getWidth()/2,e-=this.width/2+2,e}getModifierStartXY(e,a){if(!this.preFormatted)throw new l.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new l.RERR("NoYValues","No Y-Values calculated for this note.");let b=0;return e===Y.Position.LEFT?b=-2:e===Y.Position.RIGHT?b=this.width+2:e!==Y.Position.BELOW&&e!==Y.Position.ABOVE||(b=this.glyph.getWidth()/2),{x:this.getAbsoluteX()+b,y:this.ys[a]}}getLineForRest(){return this.positions[0].str}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setPreFormatted(!0))}getStemX(){return this.getCenterGlyphX()}getStemY(){const e=this.stave.getNumLines()-.5,a=L.UP===this.stem_direction?-.5:e;return this.stave.getYForLine(a)}getStemExtents(){return this.stem.getExtents()}drawFlag(){const{beam:e,glyph:a,context:b,stem:w,stem_direction:C,render_options:{draw_stem:V,glyph_font_scale:z}}=this,J=e==null&&V;if(a.flag&&J){const Z=this.getStemX()+1,re=this.getStemY()-w.getHeight(),ae=C===L.DOWN?a.code_flag_downstem:a.code_flag_upstem;p.renderGlyph(b,Z,re,z,ae)}}drawModifiers(){this.modifiers.forEach(e=>{(e.getCategory()!=="dots"||this.render_options.draw_dots)&&(e.setContext(this.context),e.drawWithStyle())})}drawStemThrough(){const e=this.getStemX(),a=this.getStemY(),b=this.context,w=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&w){const C=function(z,J){const Z=[];let re=[];for(let ae=1;ae<=z;ae++)J.indexOf(ae)>-1?(Z.push(re),re=[]):re.push(ae);return re.length>0&&Z.push(re),Z}(this.stave.getNumLines(),this.positions.map(z=>z.str)),V=function(z,J,Z,re){const ae=re!==1,le=re!==-1,he=Z.getSpacingBetweenLines(),pe=Z.getNumLines(),ge=[];return J.forEach(me=>{const Ee=me.indexOf(pe)>-1,Re=me.indexOf(1)>-1;if(ae&&Re||le&&Ee)return;me.length===1&&me.push(me[0]);const we=[];me.forEach((Ne,De,Oe)=>{const ke=Ne===1,Ue=Ne===pe;let Ge=Z.getYForLine(Ne-1);De!==0||ke?De!==Oe.length-1||Ue||(Ge+=he/2-1):Ge-=he/2-1,we.push(Ge),re===1&&ke?we.push(z-2):re===-1&&Ue&&we.push(z+2)}),ge.push(we.sort((Ne,De)=>Ne-De))}),ge}(a,C,this.getStave(),this.getStemDirection());b.save(),b.setLineWidth(L.WIDTH),V.forEach(z=>{z.length!==0&&(b.beginPath(),b.moveTo(e,z[0]),b.lineTo(e,z[z.length-1]),b.stroke(),b.closePath())}),b.restore()}}drawPositions(){var w,C;const e=this.context,a=this.getAbsoluteX(),b=this.ys;for(let V=0;V<this.positions.length;++V){const z=b[V]+this.render_options.y_shift,J=this.glyphs[V];let Z=J.getWidth();Z===0&&((C=(w=J.text)==null?void 0:w.toString())!=null&&C.length)&&(Z=7*J.text.toString().length);let re=this.glyph.getWidth();re===0&&(re=Z);const ae=a+re/2-Z/2;if(this.BackgroundColor?(e.save(),e.setFillStyle(this.BackgroundColor),e.setLineWidth(0),e.fillRect(ae-2,z-3,Z+4,6),e.restore()):e.clearRect(ae-2,z-3,Z+4,6),J.code)p.renderGlyph(e,ae,z,this.render_options.glyph_font_scale*this.render_options.scale,J.code);else{e.save(),e.setRawFont(this.render_options.font);const le=J.text.toString();e.fillText(le,ae,z+5*this.render_options.scale),e.restore()}}}draw(){if(this.checkContext(),!this.stave)throw new l.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new l.RERR("NoYValues","Can't draw note without Y values.");this.setRendered();const e=this.beam==null&&this.render_options.draw_stem;this.context.openGroup("tabnote",this.getAttribute("id"),{pointerBBox:!0}),this.drawPositions(),this.drawStemThrough();const a=this.getStemX();this.stem.setNoteHeadXBounds(a,a),e&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup()),this.drawFlag(),this.drawModifiers(),this.context.closeGroup()}}class qe extends o{constructor(e){super(),this.setAttribute("type","VibratoBracket"),this.start=e.start,this.stop=e.stop,this.toEndOfStopStave=e.toEndOfStopStave,this.line=1,this.render_options={harsh:!1,wave_height:6,wave_width:4,wave_girth:2}}setLine(e){return this.line=e,this}setHarsh(e){return this.render_options.harsh=e,this}draw(){const e=this.context;this.setRendered();const a=this.start?this.start.getStave().getYForTopText(this.line):this.stop.getStave().getYForTopText(this.line);let b=0;if(this.start){let C=0;for(const V of this.start.modifiers)if(V&&V.type==="tr"){C=V.glyph.bbox.w;break}b=this.start.getNoteHeadBeginX?this.start.getNoteHeadBeginX():this.start.getAbsoluteX(),b+=C}else b=this.stop.getStave().getTieStartX();let w=0;w=this.stop?this.toEndOfStopStave?this.stop.getStave().getTieEndX()-10:this.stop.getAbsoluteX()+this.stop.getWidth():this.start.getStave().getTieEndX()-10,this.render_options.vibrato_width=w-b,function(...C){qe.DEBUG&&l.L("Vex.Flow.VibratoBracket",C)}("Rendering VibratoBracket: start_x:",b,"stop_x:",w,"y:",a),_e.renderVibrato(e,b,a,this.render_options)}}let tt;function Gt(){if(!tt){const ce=new P({duration:"w",note_type:"r"});tt={glyph_font_scale:ce.render_options.glyph_font_scale,glyph_code:ce.glyph_code,width:ce.getWidth()}}return tt}class Pt extends o{constructor(e,a){super(),this.setAttribute("type","MultiMeasureRest"),this.render_options={show_number:!0,number_line:-.5,number_glyph_point:40,padding_left:void 0,padding_right:void 0,line:2,spacing_between_lines_px:10,line_thickness:void 0,serif_thickness:2,use_symbols:!1,symbol_spacing:void 0,semibrave_rest_glyph_scale:m.DEFAULT_NOTATION_FONT_SCALE},l.Merge(this.render_options,a),this.number_of_measures=e,this.xs={left:NaN,right:NaN}}getXs(){return this.xs}setStave(e){return this.stave=e,this}getStave(){return this.stave}drawLine(e,a,b,w){const C=this.stave.getYForLine(this.render_options.line),V=.1*(b-a);a+=V,b-=V;const z=this.render_options.serif_thickness;let J=.25*w;isNaN(this.render_options.line_thickness)||(J=.5*this.render_options.line_thickness),e.save(),e.beginPath(),e.moveTo(a,C-w),e.lineTo(a+z,C-w),e.lineTo(a+z,C-J),e.lineTo(b-z,C-J),e.lineTo(b-z,C-w),e.lineTo(b,C-w),e.lineTo(b,C+w),e.lineTo(b-z,C+w),e.lineTo(b-z,C+J),e.lineTo(a+z,C+J),e.lineTo(a+z,C+w),e.lineTo(a,C+w),e.closePath(),e.fill()}drawSymbols(e,a,b,w){const C=Math.floor(this.number_of_measures/4),V=this.number_of_measures%4,z=Math.floor(V/2),J=V%2,Z=Gt(),re=Z.width*(this.render_options.semibrave_rest_glyph_scale/Z.glyph_font_scale),ae={2:{width:.5*re,height:w},1:{width:re}};let le=1.35*re;isNaN(this.render_options.symbol_spacing)||(le=this.render_options.symbol_spacing);let he=a+.5*(b-a)-.5*(C*ae[2].width+z*ae[2].width+J*ae[1].width+(C+z+J-1)*le);const pe=this.stave.getYForLine(this.render_options.line-1),ge=this.stave.getYForLine(this.render_options.line),me=this.stave.getYForLine(this.render_options.line+1);e.save(),e.setStrokeStyle("none"),e.setLineWidth(0);for(let Ee=0;Ee<C;++Ee)e.fillRect(he,ge-ae[2].height,ae[2].width,ae[2].height),e.fillRect(he,me-ae[2].height,ae[2].width,ae[2].height),he+=ae[2].width+le;for(let Ee=0;Ee<z;++Ee)e.fillRect(he,ge-ae[2].height,ae[2].width,ae[2].height),he+=ae[2].width+le;for(let Ee=0;Ee<J;++Ee)p.renderGlyph(e,he,pe,this.render_options.semibrave_rest_glyph_scale,Z.glyph_code),he+=ae[1].width+le;e.restore()}draw(){this.checkContext(),this.setRendered();const e=this.context,a=this.stave,b=this.render_options.spacing_between_lines_px;let w=a.getNoteStartX(),C=a.getNoteEndX();const V=a.getModifiers(Be.Position.BEGIN);V.length===1&&V[0].getCategory()==="barlines"&&(w-=V[0].getWidth());const z=a.getModifiers(Be.Position.END);if(z.length>=1&&z[0].getCategory()==="barlines"&&(C-=z[0].getPadding()),isNaN(this.render_options.padding_left)||(w=a.getX()+this.render_options.padding_left),isNaN(this.render_options.padding_right)||(C=a.getX()+a.getWidth()-this.render_options.padding_right),this.xs.left=w,this.xs.right=C,this.render_options.use_symbols?this.drawSymbols(e,w,C,b):this.drawLine(e,w,C,b),this.render_options.show_number){const J="/"+this.number_of_measures,Z=new Xe(null,void 0,!1);Z.point=this.render_options.number_glyph_point,Z.setTimeSig(J),Z.setStave(a),Z.x=w+.5*(C-w)-.5*Z.timeSig.glyph.getMetrics().width,Z.bottomLine=this.render_options.number_line,Z.setContext(e).draw()}}}class mt extends j{static get CATEGORY(){return"clefnote"}constructor(e,a,b){super({duration:"b"}),this.setAttribute("type","ClefNote"),this.setType(e,a,b),this.ignore_ticks=!0}setType(e,a,b){return this.type=e,this.clef_obj=new et(e,a,b),this.clef=this.clef_obj.clef,this.glyph=new p(this.clef.code,this.clef.point),this.setWidth(this.glyph.getMetrics().width),this}getClef(){return this.clef}setContext(e){return this.context=e,this.glyph.setContext(this.context),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}getCategory(){return mt.CATEGORY}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new l.RERR("NoStave","Can't draw without a stave.");this.glyph.getContext()||this.glyph.setContext(this.context),this.setRendered();const e=this.getAbsoluteX();if(this.glyph.setStave(this.stave),this.glyph.setYShift(this.stave.getYForLine(this.clef.line)-this.stave.getYForGlyphs()),this.glyph.renderToStave(e),this.clef_obj.annotation!==void 0){const a=new p(this.clef_obj.annotation.code,this.clef_obj.annotation.point);a.getContext()||a.setContext(this.context),a.setStave(this.stave),a.setYShift(this.stave.getYForLine(this.clef_obj.annotation.line)-this.stave.getYForGlyphs()),a.setXShift(this.clef_obj.annotation.x_shift),a.renderToStave(e)}}}class _t extends j{constructor(e,a,b){super({duration:"b"}),this.setAttribute("type","KeySigNote"),this.keySignature=new We(e,a,b),this.ignore_ticks=!0}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this.keySignature.setStave(this.stave),this.keySignature.format(),this.setWidth(this.keySignature.width),this}draw(){this.stave.checkContext(),this.setRendered(),this.keySignature.x=this.getAbsoluteX(),this.keySignature.setContext(this.context),this.keySignature.draw()}}class Xt extends j{constructor(e,a){super({duration:"b"}),this.setAttribute("type","TimeSigNote");const b=new Xe(e,a);this.timeSig=b.getTimeSig(),this.setWidth(this.timeSig.glyph.getMetrics().width),this.ignore_ticks=!0}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){this.stave.checkContext(),this.setRendered(),this.timeSig.glyph.getContext()||this.timeSig.glyph.setContext(this.context),this.timeSig.glyph.setStave(this.stave),this.timeSig.glyph.setYShift(this.stave.getYForLine(this.timeSig.line)-this.stave.getYForGlyphs()),this.timeSig.glyph.renderToStave(this.getAbsoluteX())}}class ut extends U{static get SLIDE_UP(){return 1}static get SLIDE_DOWN(){return-1}static createSlideUp(e){return new ut(e,ut.SLIDE_UP)}static createSlideDown(e){return new ut(e,ut.SLIDE_DOWN)}constructor(e,a){if(super(e,"sl."),this.setAttribute("type","TabSlide"),!a){const b=e.first_note.getPositions()[0].fret,w=e.last_note.getPositions()[0].fret;a=parseInt(b,10)>parseInt(w,10)?ut.SLIDE_DOWN:ut.SLIDE_UP}this.slide_direction=a,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(e)}renderTie(e){if(e.first_ys.length===0||e.last_ys.length===0)throw new l.RERR("BadArguments","No Y-values to render");const a=this.context,b=e.first_x_px,w=e.first_ys,C=e.last_x_px,V=this.slide_direction;if(V!==ut.SLIDE_UP&&V!==ut.SLIDE_DOWN)throw new l.RERR("BadSlide","Invalid slide direction");for(let z=0;z<this.first_indices.length;++z){const J=w[this.first_indices[z]]+this.render_options.y_shift;if(isNaN(J))throw new l.RERR("BadArguments","Bad indices for slide rendering.");a.beginPath(),a.moveTo(b,J+3*V),a.lineTo(C,J-3*V),a.closePath(),a.stroke()}this.setRendered()}}class yt extends oe{static get CATEGORY(){return"gracenotes"}static get LEDGER_LINE_OFFSET(){return 2}static get SCALE(){return .66}constructor(e){super(Object.assign(e,{glyph_font_scale:m.DEFAULT_NOTATION_FONT_SCALE*yt.SCALE,stroke_px:yt.LEDGER_LINE_OFFSET})),this.setAttribute("type","GraceNote"),this.slash=e.slash,this.slur=!0,this.buildNoteHeads(),this.width=3}getStemExtension(){if(this.stem_extension_override!=null)return this.stem_extension_override;const e=this.getGlyph();if(e){let a=super.getStemExtension();if(e.stem){const b=this.getStaveNoteScale();a=(L.HEIGHT+a)*b-L.HEIGHT}return a}return 0}getCategory(){return yt.CATEGORY}getStaveNoteScale(){return this.render_options.glyph_font_scale/m.DEFAULT_NOTATION_FONT_SCALE}draw(){super.draw(),this.setRendered();const e=this.stem;if(this.slash&&e){const a=this.getStaveNoteScale(),b=a/.66;let w;const C=this.beam;if(C)C.postFormatted||C.postFormat(),w=this.calcBeamedNotesSlashBBox(8*b,8*b,{stem:6*b,beam:5*b});else{const z=this.getStemDirection(),J=this.getNoteHeadBounds(),Z=e.getHeight();let re=this.getAbsoluteX(),ae=z===m.Stem.DOWN?J.y_top-Z:J.y_bottom-Z;const le=z===m.Stem.DOWN?this.glyph.stem_down_extension:this.glyph.stem_up_extension;let he=m.STEM_HEIGHT;he-=he/2.8,he+=le,ae+=he*a*z;const pe=z===m.Stem.UP?{x1:1,y1:0,x2:13,y2:-9}:{x1:-4,y1:1,x2:13,y2:9};re+=pe.x1*b,ae+=pe.y1*b,w={x1:re,y1:ae,x2:re+pe.x2*b,y2:ae+pe.y2*b}}const V=this.context;V.save(),V.setLineWidth(1*b),V.beginPath(),V.moveTo(w.x1,w.y1),V.lineTo(w.x2,w.y2),V.closePath(),V.stroke(),V.restore()}}calcBeamedNotesSlashBBox(e,a,b){const w=this.beam,C=w.slope,V=w.notes[w.notes.length-1]===this?-1:1,z=Math.atan(C*V),J=Math.cos(z)*a,Z=Math.sin(z)*a;e*=this.getStemDirection();const re=Math.atan((Z-e)/J),ae=Math.cos(re)*b.stem*V,le=Math.sin(re)*b.stem,he=Math.cos(re)*b.beam*V,pe=Math.sin(re)*b.beam,ge=this.getStemX(),me=w.notes[0].getStemX(),Ee=this.beam.getBeamYToDraw()+(ge-me)*C;return{x1:ge-ae,y1:Ee+e-le,x2:ge+J*V+he,y2:Ee+Z+pe}}}class Wt extends Je{static get CATEGORY(){return"gracetabnotes"}constructor(e){super(e,!1),this.setAttribute("type","GraceTabNote"),l.Merge(this.render_options,{y_shift:.3,scale:.6,font:"7.5pt Arial"}),this.updateWidth()}getCategory(){return Wt.CATEGORY}draw(){super.draw(),this.setRendered()}}class It{static get names(){return{standard:"E/5,B/4,G/4,D/4,A/3,E/3",dagdad:"D/5,A/4,G/4,D/4,A/3,D/3",dropd:"E/5,B/4,G/4,D/4,A/3,D/3",eb:"Eb/5,Bb/4,Gb/4,Db/4,Ab/3,Db/3",standardBanjo:"D/5,B/4,G/4,D/4,G/5"}}constructor(e="E/5,B/4,G/4,D/4,A/3,E/3,B/2,E/2"){this.setTuning(e)}noteToInteger(e){return m.keyProperties(e).int_value}setTuning(e){It.names[e]&&(e=It.names[e]),this.tuningString=e,this.tuningValues=[],this.numStrings=0;const a=e.split(/\s*,\s*/);if(a.length===0)throw new l.RERR("BadArguments","Invalid tuning string: "+e);this.numStrings=a.length;for(let b=0;b<this.numStrings;++b)this.tuningValues[b]=this.noteToInteger(a[b])}getValueForString(e){const a=parseInt(e,10);if(a<1||a>this.numStrings)throw new l.RERR("BadArguments",`String number must be between 1 and ${this.numStrings}:${e}`);return this.tuningValues[a-1]}getValueForFret(e,a){const b=this.getValueForString(a),w=parseInt(e,10);if(w<0)throw new l.RERR("BadArguments","Fret number must be 0 or higher: "+e);return b+w}getNoteForFret(e,a){const b=this.getValueForFret(e,a),w=Math.floor(b/12),C=b%12;return m.integerToNote(C)+"/"+w}}class Lt extends o{static get type(){return{CRESC:1,DECRESC:2}}static FormatByTicksAndDraw(e,a,b,w,C,V){const z=a.pixelsPerTick;if(z==null)throw new l.RuntimeError("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");const J=z*V.left_shift_ticks,Z=z*V.right_shift_ticks,re={height:V.height,y_shift:V.y_shift,left_shift_px:J,right_shift_px:Z};new Lt({first_note:b.first_note,last_note:b.last_note},w).setContext(e).setRenderOptions(re).setPosition(C).draw()}constructor(e,a){super(),this.setAttribute("type","StaveHairpin"),this.notes=e,this.hairpin=a,this.position=Y.Position.BELOW,this.render_options={height:10,y_shift:0,left_shift_px:0,right_shift_px:0},this.setNotes(e)}setPosition(e){return e!==Y.Position.ABOVE&&e!==Y.Position.BELOW||(this.position=e),this}setRenderOptions(e){return e.height!=null&&e.y_shift!=null&&e.left_shift_px!=null&&e.right_shift_px!=null&&(this.render_options=e),this}setNotes(e){if(!e.first_note&&!e.last_note)throw new l.RuntimeError("BadArguments","Hairpin needs to have either first_note or last_note set.");return this.first_note=e.first_note,this.last_note=e.last_note,this}renderHairpin(e){const a=this.checkContext();let b=this.render_options.y_shift+20,w=e.first_y;this.position===Y.Position.ABOVE&&(b=30-b,w=e.first_y-e.staff_height);const C=this.render_options.left_shift_px,V=this.render_options.right_shift_px;switch(a.beginPath(),this.hairpin){case Lt.type.CRESC:a.moveTo(e.last_x+V,w+b),a.lineTo(e.first_x+C,w+this.render_options.height/2+b),a.lineTo(e.last_x+V,w+this.render_options.height+b);break;case Lt.type.DECRESC:a.moveTo(e.first_x+C,w+b),a.lineTo(e.last_x+V,w+this.render_options.height/2+b),a.lineTo(e.first_x+C,w+this.render_options.height+b)}a.stroke(),a.closePath()}draw(){this.checkContext(),this.setRendered();const e=this.first_note,a=this.last_note,b=e.getModifierStartXY(this.position,0),w=a.getModifierStartXY(this.position,0);return this.renderHairpin({first_x:b.x,last_x:w.x,first_y:e.getStave().y+e.getStave().height,last_y:a.getStave().y+a.getStave().height,staff_height:e.getStave().height}),!0}}class lt extends o{static get Position(){return{NEAR_HEAD:1,NEAR_TOP:2}}static get PositionString(){return{nearHead:lt.Position.NEAR_HEAD,nearTop:lt.Position.NEAR_TOP}}constructor(e,a,b){super(),this.setAttribute("type","Curve"),this.render_options={spacing:2,thickness:2,x_shift:0,y_shift:10,position:lt.Position.NEAR_HEAD,position_end:lt.Position.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}]},l.Merge(this.render_options,b),this.setNotes(e,a)}setNotes(e,a){if(!e&&!a)throw new l.RuntimeError("BadArguments","Curve needs to have either first_note or last_note set.");return this.from=e,this.to=a,this}isPartial(){return!this.from||!this.to}renderCurve(e){const a=this.context,b=this.render_options.cps,w=this.render_options.x_shift,C=this.render_options.y_shift*e.direction,V=e.first_x+w,z=e.first_y+C,J=e.last_x-w,Z=e.last_y+C,re=this.render_options.thickness,ae=(J-V)/(b.length+2);a.beginPath(),a.moveTo(V,z),a.bezierCurveTo(V+ae+b[0].x,z+b[0].y*e.direction,J-ae+b[1].x,Z+b[1].y*e.direction,J,Z),a.bezierCurveTo(J-ae+b[1].x,Z+(b[1].y+re)*e.direction,V+ae+b[0].x,z+(b[0].y+re)*e.direction,V,z),a.stroke(),a.closePath(),a.fill()}draw(){this.checkContext(),this.setRendered();const e=this.from,a=this.to;let b,w,C,V,z,J="baseY",Z="baseY";function re(he){return typeof he=="string"?lt.PositionString[he]:he}const ae=re(this.render_options.position),le=re(this.render_options.position_end);return ae===lt.Position.NEAR_TOP&&(J="topY",Z="topY"),le===lt.Position.NEAR_HEAD?Z="baseY":le===lt.Position.NEAR_TOP&&(Z="topY"),e?(b=e.getTieRightX(),z=e.getStemDirection(),C=e.getStemExtents()[J]):(b=a.getStave().getTieStartX(),C=a.getStemExtents()[J]),a?(w=a.getTieLeftX(),z=a.getStemDirection(),V=a.getStemExtents()[Z]):(w=e.getStave().getTieEndX(),V=e.getStemExtents()[Z]),this.renderCurve({first_x:b,last_x:w,first_y:C,last_y:V,direction:z*(this.render_options.invert===!0?-1:1)}),!0}}function jt(...ce){xt.DEBUG&&l.L("Vex.Flow.TextDynamics",ce)}class xt extends j{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(e){super(e),this.setAttribute("type","TextDynamics"),this.sequence=e.text.toLowerCase(),this.line=e.line||0,this.glyphs=[],l.Merge(this.render_options,{glyph_font_size:40}),jt("New Dynamics Text: ",this.sequence)}setLine(e){return this.line=e,this}preFormat(){let e=0;return this.sequence.split("").forEach(a=>{const b=xt.GLYPHS[a];if(!b)throw new l.RERR("Invalid dynamics character: "+a);const w=this.render_options.glyph_font_size,C=new p(b.code,w);this.glyphs.push(C),e+=b.width}),this.setWidth(e),this.preFormatted=!0,this}draw(){this.setRendered();const e=this.getAbsoluteX(),a=this.stave.getYForLine(this.line+-3);jt("Rendering Dynamics: ",this.sequence);let b=e;this.glyphs.forEach((w,C)=>{const V=this.sequence[C];w.render(this.context,b,a),b+=xt.GLYPHS[V].width})}}function Yt(ce,e,a,b,w,C,V){ce.beginPath(),ce.moveTo(e,a),ce.lineTo(b,w),ce.lineTo(C,V),ce.lineTo(e,a),ce.closePath(),ce.fill()}class ct extends o{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(e){super(),this.setAttribute("type","StaveLine"),this.notes=e,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:ct.TextVerticalPosition.TOP,text_justification:ct.TextJustification.CENTER},this.setNotes(e)}setFont(e){return this.font=e,this}setText(e){return this.text=e,this}setNotes(e){if(!e.first_note&&!e.last_note)throw new l.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(e.first_indices||(e.first_indices=[0]),e.last_indices||(e.last_indices=[0]),e.first_indices.length!==e.last_indices.length)throw new l.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=e.first_note,this.first_indices=e.first_indices,this.last_note=e.last_note,this.last_indices=e.last_indices,this}applyLineStyle(){const e=this.checkContext(),a=this.render_options;a.line_dash&&e.setLineDash(a.line_dash),a.line_width&&e.setLineWidth(a.line_width),a.rounded_end?e.setLineCap("round"):e.setLineCap("square")}applyFontStyle(){const e=this.checkContext();this.font&&e.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color))}draw(){const e=this.checkContext();this.setRendered();const a=this.first_note,b=this.last_note,w=this.render_options;let C,V;e.save(),this.applyLineStyle(),this.first_indices.forEach((le,he)=>{const pe=this.last_indices[he];C=a.getModifierStartXY(2,le),V=b.getModifierStartXY(1,pe);const ge=C.y>V.y;C.x+=a.getMetrics().modRightPx+w.padding_left,V.x-=b.getMetrics().modLeftPx+w.padding_right;const me=a.getGlyph().getWidth();a.getKeyProps()[le].displaced&&a.getStemDirection()===1&&(C.x+=me+w.padding_left),b.getKeyProps()[pe].displaced&&b.getStemDirection()===-1&&(V.x-=me+w.padding_right),C.y+=ge?-3:1,V.y+=ge?2:0,function(Ee,Re,we,Ne){const De=Ne.draw_start_arrow&&Ne.draw_end_arrow,Oe=Re.x,ke=Re.y,Ue=we.x,Ge=we.y,nt=Math.sqrt((Ue-Oe)*(Ue-Oe)+(Ge-ke)*(Ge-ke)),Qe=(nt-Ne.arrowhead_length/3)/nt;let $e,ht,ft,Rt;Ne.draw_end_arrow||De?($e=Math.round(Oe+(Ue-Oe)*Qe),ht=Math.round(ke+(Ge-ke)*Qe)):($e=Ue,ht=Ge),Ne.draw_start_arrow||De?(ft=Oe+(Ue-Oe)*(1-Qe),Rt=ke+(Ge-ke)*(1-Qe)):(ft=Oe,Rt=ke),Ne.color&&(Ee.setStrokeStyle(Ne.color),Ee.setFillStyle(Ne.color)),Ee.beginPath(),Ee.moveTo(ft,Rt),Ee.lineTo($e,ht),Ee.stroke(),Ee.closePath();const vt=Math.atan2(Ge-ke,Ue-Oe),St=Math.abs(Ne.arrowhead_length/Math.cos(Ne.arrowhead_angle));let Mt,Tt,Ft,Dt,Ot,kt;(Ne.draw_end_arrow||De)&&(Mt=vt+Math.PI+Ne.arrowhead_angle,Ft=Ue+Math.cos(Mt)*St,Dt=Ge+Math.sin(Mt)*St,Tt=vt+Math.PI-Ne.arrowhead_angle,Ot=Ue+Math.cos(Tt)*St,kt=Ge+Math.sin(Tt)*St,Yt(Ee,Ft,Dt,Ue,Ge,Ot,kt)),(Ne.draw_start_arrow||De)&&(Mt=vt+Ne.arrowhead_angle,Ft=Oe+Math.cos(Mt)*St,Dt=ke+Math.sin(Mt)*St,Tt=vt-Ne.arrowhead_angle,Ot=Oe+Math.cos(Tt)*St,kt=ke+Math.sin(Tt)*St,Yt(Ee,Ft,Dt,Oe,ke,Ot,kt))}(e,C,V,this.render_options)}),e.restore();const z=e.measureText(this.text).width,J=w.text_justification;let Z,re=0;J===ct.TextJustification.LEFT?re=C.x:J===ct.TextJustification.CENTER?re=(V.x-C.x)/2+C.x-z/2:J===ct.TextJustification.RIGHT&&(re=V.x-z);const ae=w.text_position_vertical;return ae===ct.TextVerticalPosition.TOP?Z=a.getStave().getYForTopText():ae===ct.TextVerticalPosition.BOTTOM&&(Z=a.getStave().getYForBottomText(m.TEXT_HEIGHT_OFFSET_HACK)),e.save(),this.applyFontStyle(),e.fillText(this.text,re,Z),e.restore(),this}}function Ut(ce,e,a,b,w){const C=Ve.GLYPHS[ce];new p(C.code,w).render(e,a+C.x_shift,b+C.y_shift)}class Ve extends o{static get GLYPHS(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}static get Styles(){return{TEXT:1,BRACKET:2,MIXED:3,MIXED_OPEN_END:4,BRACKET_OPEN_BEGIN:5,BRACKET_OPEN_END:6,BRACKET_OPEN_BOTH:7}}static get StylesString(){return{text:Ve.Styles.TEXT,bracket:Ve.Styles.BRACKET,mixed:Ve.Styles.MIXED,mixed_open_end:Ve.Styles.MIXED_OPEN_END,bracket_open_begin:Ve.Styles.BRACKET_OPEN_BEGIN,bracket_open_end:Ve.Styles.BRACKET_OPEN_END,bracket_open_both:Ve.Styles.BRACKET_OPEN_BOTH}}static createSustain(e){return new Ve(e)}static createSostenuto(e){const a=new Ve(e);return a.setStyle(Ve.Styles.MIXED),a.setCustomText("Sost. Ped."),a}static createUnaCorda(e){const a=new Ve(e);return a.setStyle(Ve.Styles.TEXT),a.setCustomText("una corda","tre corda"),a}constructor(e){super(),this.setAttribute("type","PedalMarking"),this.EndsStave=!1,this.ChangeBegin=!1,this.ChangeEnd=!1,this.notes=e,this.style=Ve.TEXT,this.line=0,this.custom_depress_text="",this.custom_release_text="",this.font={family:"Times New Roman",size:12,weight:"italic bold"},this.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"}}setEndStave(e){if(this.endStave=e,this.endStaveAddedWidth=0,this.startMargin=0,this.endMargin=0,Array.isArray(this.endStave.modifiers))for(let a=0;a<this.endStave.modifiers.length;a++){let b=this.endStave.modifiers[a];b&&b.position===Be.Position.END&&b.width&&(this.endStaveAddedWidth+=b.width)}}setCustomText(e,a){return this.custom_depress_text=e||"",this.custom_release_text=a||"",this}setStyle(e){if(e<1&&e>3)throw new l.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=e,this}setLine(e){return this.line=e,this}drawBracketed(){const e=this.context;let a,b,w=!1;const C=this;this.notes.forEach((V,z,J)=>{w=!w;let Z=0;if(V?(Z=V.getNoteHeadBeginX(),this.BeginsStave&&(Z=V.getStave().getNoteStartX())):Z=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)w?this.ChangeBegin&&(Z=V.getAbsoluteX()):(Z=V?this.ChangeEnd?V.getAbsoluteX():V.getStave().end_x+this.endStaveAddedWidth-C.render_options.text_margin_right:this.endStave.end_x+this.endStaveAddedWidth-C.render_options.text_margin_right,this.endMargin=-C.render_options.text_margin_right);else if(V)if(w)this.ChangeBegin&&(Z=V.getAbsoluteX());else switch(C.style){case Ve.Styles.BRACKET_OPEN_END:case Ve.Styles.BRACKET_OPEN_BOTH:case Ve.Styles.MIXED_OPEN_END:Z=V.getNoteHeadEndX();break;default:this.ChangeEnd?Z=V.getAbsoluteX():(Z=V.getNoteHeadBeginX()-C.render_options.text_margin_right,this.startMargin=-C.render_options.text_margin_right)}let re=this.endStave;V&&(re=V.getStave());let ae=re.getYForBottomText(C.line+3);b&&b>ae&&(ae=b);const le=J[z+1]===V,he=J[z-1]===V;let pe=0;if(w)if(pe=he?5:0,C.style!==Ve.Styles.MIXED&&C.style!==Ve.Styles.MIXED_OPEN_END||he)e.beginPath(),C.style===Ve.Styles.BRACKET_OPEN_BEGIN||C.style===Ve.Styles.BRACKET_OPEN_BOTH?e.moveTo(Z+pe,ae):(this.ChangeBegin&&(Z+=5),e.moveTo(Z,ae-C.render_options.bracket_height),this.ChangeBegin&&(Z+=5),e.lineTo(Z+pe,ae)),e.stroke(),e.closePath();else if(C.custom_depress_text){const ge=e.measureText(C.custom_depress_text).width;e.fillText(C.custom_depress_text,Z-ge/2,ae),pe=ge/2+C.render_options.text_margin_right}else Ut("pedal_depress",e,Z,ae,C.render_options.glyph_point_size),pe=20+C.render_options.text_margin_right;else pe=le&&!this.EndsStave?-5:0,e.beginPath(),e.moveTo(a,b),e.lineTo(Z+pe,ae),C.style!==Ve.Styles.BRACKET_OPEN_END&&C.style!==Ve.Styles.MIXED_OPEN_END&&C.style!==Ve.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(Z+=5),e.lineTo(Z,ae-C.render_options.bracket_height)),e.stroke(),e.closePath();a=Z+pe,b=ae})}drawText(){const e=this.context;let a=!1;const b=this,w=b.render_options.glyph_point_size;this.notes.forEach(C=>{if(!C)return;a=!a;const V=C.getStave(),z=C.getAbsoluteX(),J=V.getYForBottomText(b.line+3);let Z=0;a?b.custom_depress_text?(Z=e.measureText(b.custom_depress_text).width,e.fillText(b.custom_depress_text,z-Z/2,J)):Ut("pedal_depress",e,z,J,w):b.custom_release_text?(Z=e.measureText(b.custom_release_text).width,e.fillText(b.custom_release_text,z-Z/2,J)):Ut("pedal_release",e,z,J,w)})}draw(){const e=this.checkContext();this.setRendered(),e.save(),e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color),e.setFont(this.font.family,this.font.size,this.font.weight),Ve.DEBUG&&l.L("Vex.Flow.PedalMarking",["Rendering Pedal Marking"]),this.style===Ve.Styles.BRACKET||this.style===Ve.Styles.MIXED||this.style===Ve.Styles.MIXED_OPEN_END||this.style===Ve.Styles.BRACKET_OPEN_BEGIN||this.style===Ve.Styles.BRACKET_OPEN_END||this.style===Ve.Styles.BRACKET_OPEN_BOTH?(e.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===Ve.Styles.TEXT&&this.drawText(),e.restore()}}class it extends o{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:it.Positions.TOP,bottom:it.Positions.BOTTOM}}constructor({start:e,stop:a,text:b="",superscript:w="",position:C=it.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=e,this.stop=a,this.text=b,this.superscript=w,this.position=typeof C=="string"?it.PositionString[C]:C,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(e){return e.setFont(this.font.family,this.font.size,this.font.weight),e.setStrokeStyle(this.render_options.color),e.setFillStyle(this.render_options.color),e.setLineWidth(this.render_options.line_width),this}setDashed(e,a){return this.render_options.dashed=e,a&&(this.render_options.dash=a),this}setFont(e){return this.font={...this.font,...e},this}setLine(e){return this.line=e,this}draw(){const e=this.context;this.setRendered();let a=0;switch(this.position){case it.Positions.TOP:a=this.start.getStave().getYForTopText(this.line);break;case it.Positions.BOTTOM:a=this.start.getStave().getYForBottomText(this.line+m.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new l.RERR("InvalidPosition",`The position ${this.position} is invalid`)}const b={x:this.start.getAbsoluteX(),y:a},w={x:this.stop.getAbsoluteX(),y:a};(function(...pe){it.DEBUG&&l.L("Vex.Flow.TextBracket",pe)})("Rendering TextBracket: start:",b,"stop:",w,"y:",a);const C=this.render_options.bracket_height*this.position;e.save(),this.applyStyle(e),e.fillText(this.text,b.x,b.y);let V=e.measureText(this.text).width;V>0||(V=10*this.text.length);let z=e.measureText("M").width;z>0||(z=20);const J=b.y-z/2.5;e.setFont(this.font.family,this.font.size/1.4,this.font.weight),e.fillText(this.superscript,b.x+V+1,J);let Z=e.measureText(this.superscript).width;Z>0||(Z=12,this.superscript.includes("m")&&(Z+=5));let re=e.measureText("M").width;re>0||(re=10);let ae=b.x,le=J,he=w.x+this.stop.getGlyph().getWidth();this.position===it.Positions.TOP?(ae+=V+Z+5,le-=re/2.7):this.position===it.Positions.BOTTOM&&(le+=re/2.7,ae+=V+2,this.render_options.underline_superscript||(ae+=Z)),this.render_options.dashed?(he<ae+5&&this.position===it.Positions.TOP?he=ae+5:he<ae+Z&&this.position===it.Positions.BOTTOM&&(he=ae+Z),E.drawDashedLine(e,ae,le,he,le,this.render_options.dash),this.render_options.show_bracket&&E.drawDashedLine(e,he,le+1*this.position,he,le+C,this.render_options.dash)):(e.beginPath(),e.moveTo(ae,le),e.lineTo(he,le),this.render_options.show_bracket&&e.lineTo(he,le+C),e.stroke(),e.closePath()),e.restore()}}class Ct extends j{constructor(e=Ie.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const a=Ie.type;this.metrics.widths={[a.SINGLE]:8,[a.DOUBLE]:12,[a.END]:15,[a.REPEAT_BEGIN]:14,[a.REPEAT_END]:14,[a.REPEAT_BOTH]:18,[a.NONE]:0},this.ignore_ticks=!0,this.setType(e)}getType(){return this.type}setType(e){return this.type=typeof e=="string"?Ie.typeString[e]:e,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 l.RERR("NoStave","Can't draw without a stave.");(function(...a){Ct.DEBUG&&l.L("Vex.Flow.BarNote",a)})("Rendering bar line at: ",this.getAbsoluteX());const e=new Ie(this.type);e.setX(this.getAbsoluteX()),e.draw(this.stave),this.setRendered()}}class Kt extends G{constructor(e){if(!e)throw new l.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let a;if(typeof e=="string")a={duration:e};else{if(typeof e!="object")throw new l.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");a=e}super(a),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(e){super.setStave(e)}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new l.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let e=0;e<this.modifiers.length;++e){const a=this.modifiers[e];a.setContext(this.context),a.drawWithStyle()}}}class Et extends Y{static get CATEGORY(){return"tremolo"}static get YOFFSETSTEMUP(){return-9}static get YOFFSETSTEMDOWN(){return-21}static get XOFFSETSTEMUP(){return 6}static get XOFFSETSTEMDOWN(){return-2}constructor(e){super(),this.setAttribute("type","Tremolo"),this.num=e,this.note=null,this.index=null,this.position=Y.Position.CENTER,this.code="v74",this.y_spacing_scale=1,this.extra_stroke_scale=1,this.y_offset_for_beam=5}getCategory(){return Et.CATEGORY}draw(){if(this.checkContext(),!this.note||this.index==null)throw new l.RERR("NoAttachedNote","Can't draw Tremolo without a note and index.");this.setRendered();const e=this.note.getStemDirection();this.y_spacing=4*e*this.y_spacing_scale;let a=this.note.getModifierStartXY(this.position,this.index).x,b=this.note.stem.getExtents().topY,w=this.note.getCategory()==="gracenotes"?yt.SCALE:1;w*=this.extra_stroke_scale,b+=e<0?Et.YOFFSETSTEMDOWN*w:Et.YOFFSETSTEMUP*w,this.note.beam&&(b+=this.y_offset_for_beam*e),this.font={family:"Arial",size:16*w,weight:""},this.render_options={font_scale:35*w,stroke_px:3,stroke_spacing:10*w},a+=e<0?Et.XOFFSETSTEMDOWN:Et.XOFFSETSTEMUP;for(let C=0;C<this.num;++C)p.renderGlyph(this.context,a,b,this.render_options.font_scale,this.code),b+=this.y_spacing}}class zt extends j{constructor(e){super(e),this.setAttribute("type","Crescendo"),this.decrescendo=!1,this.line=e.line||0,this.height=15,l.Merge(this.render_options,{extend_left:0,extend_right:0,y_shift:0})}setLine(e){return this.line=e,this}setHeight(e){return this.height=e,this}setDecrescendo(e){return this.decrescendo=e,this}preFormat(){return this.preFormatted=!0,this}draw(){this.checkContext(),this.setRendered();const e=this.getTickContext(),a=q.getNextContext(e),b=this.getAbsoluteX(),w=a?a.getX():this.stave.x+this.stave.width,C=this.stave.getYForLine(this.line+-3)+1;(function(...V){zt.DEBUG&&l.L("Vex.Flow.Crescendo",V)})("Drawing ",this.decrescendo?"decrescendo ":"crescendo ",this.height,"x",b-w),function(V,z){const J=z.begin_x,Z=z.end_x,re=z.y,ae=z.height/2;V.beginPath(),z.reverse?(V.moveTo(J,re-ae),V.lineTo(Z,re),V.lineTo(J,re+ae)):(V.moveTo(Z,re-ae),V.lineTo(J,re),V.lineTo(Z,re+ae)),V.stroke(),V.closePath()}(this.context,{begin_x:b-this.render_options.extend_left,end_x:w+this.render_options.extend_right,y:C+this.render_options.y_shift,height:this.height,reverse:this.decrescendo})}}const qt=l.MakeException("ParserError");function Nt(ce){return ce.matchedString!==void 0?ce.matchedString:ce.results?Nt(ce.results):ce.length===1?Nt(ce[0]):ce.length===0?null:ce.map(Nt)}class Bt{constructor(e){this.grammar=e}parse(e){this.line=e,this.pos=0,this.errorPos=-1;const a=this.expect(this.grammar.begin());return a.errorPos=this.errorPos,a}matchFail(e){this.errorPos===-1&&(this.errorPos=this.pos),this.pos=e}matchSuccess(){this.errorPos=-1}matchToken(e,a=!1){const b=a?new RegExp("^(("+e+"))"):new RegExp("^(("+e+")\\s*)"),w=this.line.slice(this.pos).match(b);return w!==null?{success:!0,matchedString:w[2],incrementPos:w[1].length,pos:this.pos}:{success:!1,pos:this.pos}}expectOne(e,a=!1){const b=[],w=this.pos;let C=!0,V=!1;a=a===!0||e.maybe===!0;for(let Z=0;Z<e.expect.length;Z++){const re=e.expect[Z],ae=this.pos,le=this.expect(re);if(le.success){if(b.push(le),V=!0,e.or)break}else if(C=!1,!e.or){this.pos=ae;break}}const z=e.or&&V||C,J=z||a===!0;return a&&!z&&(this.pos=w),J?this.matchSuccess():this.matchFail(w),{success:J,results:b,numMatches:z?1:0}}expectOneOrMore(e,a=!1){const b=[],w=this.pos;let C=0,V=!0;do{const J=this.expectOne(e);J.success?(C++,b.push(J.results)):V=!1}while(V);const z=C>0||a===!0;return!a||C>0||(this.pos=w),z?this.matchSuccess():this.matchFail(w),{success:z,results:b,numMatches:C}}expectZeroOrMore(e){return this.expectOneOrMore(e,!0)}expect(e){let a;if(function(...w){Bt.DEBUG&&l.L("Vex.Flow.Parser",w)}("Evaluating rules:",e),!e)throw new qt("Invalid Rule: "+e,e);const b=e.bind(this.grammar)();if(b.token)a=this.matchToken(b.token,b.noSpace===!0),a.success&&(this.pos+=a.incrementPos);else{if(!b.expect)throw new qt("Bad grammar! No `token` or `expect` property",b);a=b.oneOrMore?this.expectOneOrMore(b):b.zeroOrMore?this.expectZeroOrMore(b):this.expectOne(b)}return a.matches=[],a.results&&a.results.forEach(w=>a.matches.push(Nt(w))),b.run&&a.success&&b.run(a),a}}function dt(...ce){Ht.DEBUG&&l.L("Vex.Flow.EasyScore",ce)}const ei=l.MakeException("EasyScoreError");class ti{constructor(e){this.builder=e}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:e=>this.builder.addChord(e.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:e=>this.builder.addSingleNote(e.matches[0],e.matches[1],e.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:e=>this.builder.setNoteDots(e.matches[0])}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:e=>this.builder.setNoteType(e.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:e=>this.builder.setNoteDuration(e.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:e=>this.builder.addNoteOption(e.matches[0],e.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 ii{constructor(e){this.factory=e,this.commitHooks=[],this.reset()}reset(e={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,e)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(e){this.commitHooks.push(e)}resetPiece(){dt("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(e){dt("setNoteDots:",e),e&&(this.piece.dots=e.length)}setNoteDuration(e){dt("setNoteDuration:",e),this.rollingDuration=this.piece.duration=e||this.rollingDuration}setNoteType(e){dt("setNoteType:",e),e&&(this.piece.type=e)}addNoteOption(e,a){dt("addNoteOption: key:",e,"value:",a),this.piece.options[e]=a}addNote(e,a,b){dt("addNote:",e,a,b),this.piece.chord.push({key:e,accid:a,octave:b})}addSingleNote(e,a,b){dt("addSingleNote:",e,a,b),this.addNote(e,a,b)}addChord(e){dt("startChord"),typeof e[0]!="object"?this.addSingleNote(e[0]):e.forEach(a=>{a&&this.addNote(...a)}),dt("endChord")}commitPiece(){dt("commitPiece");const{factory:e}=this;if(!e)return;const a={...this.options,...this.piece.options},{stem:b,clef:w}=a,C=b.toLowerCase()==="auto",V=C||b.toLowerCase()!=="up"?oe.STEM_DOWN:oe.STEM_UP,{chord:z,duration:J,dots:Z,type:re}=this.piece,ae=z.map(pe=>pe.key+"/"+pe.octave),le=e.StaveNote({keys:ae,duration:J,dots:Z,type:re,clef:w,auto_stem:C});C||le.setStemDirection(V);const he=z.map(pe=>pe.accid||null);he.forEach((pe,ge)=>{pe&&le.addAccidental(ge,e.Accidental({type:pe}))});for(let pe=0;pe<Z;pe++)le.addDotToAll();this.commitHooks.forEach(pe=>pe(a,le,this)),this.elements.notes.push(le),this.elements.accidentals.concat(he),this.resetPiece()}}function si({id:ce},e){ce!==void 0&&e.setAttribute("id",ce)}function ni(ce,e){ce.class&&ce.class.split(/\s*,\s*/).forEach(a=>e.addClass(a))}class Ht{constructor(e={}){this.setOptions(e),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(e){return Object.assign(this.defaults,e),this}setOptions(e){return this.options={factory:null,builder:null,commitHooks:[si,ni,Se.easyScoreHook],throwOnError:!1,...e},this.factory=this.options.factory,this.builder=this.options.builder||new ii(this.factory),this.grammar=new ti(this.builder),this.parser=new Bt(this.grammar),this.options.commitHooks.forEach(a=>this.addCommitHook(a)),this}setContext(e){return this.factory&&this.factory.setContext(e),this}parse(e,a={}){this.builder.reset(a);const b=this.parser.parse(e);if(!b.success&&this.options.throwOnError)throw new ei("Error parsing line: "+e,b);return b}beam(e,a={}){return this.factory.Beam({notes:e,options:a}),e}tuplet(e,a={}){return this.factory.Tuplet({notes:e,options:a}),e}notes(e,a={}){return a={clef:this.defaults.clef,stem:this.defaults.stem,...a},this.parse(e,a),this.builder.getElements().notes}voice(e,a){return a={time:this.defaults.time,...a},this.factory.Voice(a).addTickables(e)}addCommitHook(e){return this.builder.addCommitHook(e)}}const ri=l.MakeException("FactoryError");function Ye(ce={},e){const a=e.options;return(ce=Object.assign(e,ce)).options=Object.assign(a,ce.options),ce}class At{constructor(e){(function(...b){At.DEBUG&&l.L("Vex.Flow.Factory",b)})("New factory: ",e);const a={stave:{space:10},renderer:{context:null,elementId:"",backend:E.Backends.SVG,width:500,height:200,background:"#FFF"},font:{face:"Arial",point:10,style:""}};this.options=a,this.setOptions(e)}static newFromElementId(e,a=500,b=200){return new At({renderer:{elementId:e,width:a,height:b}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(e){for(const a of["stave","renderer","font"])Object.assign(this.options[a],e[a]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:e,backend:a,width:b,height:w,background:C}=this.options.renderer;if(e==="")throw new ri("HTML DOM element not set in Factory");this.context=E.buildContext(e,a,b,w,C)}getContext(){return this.context}setContext(e){return this.context=e,this}getStave(){return this.stave}getVoices(){return this.voices}space(e){return this.options.stave.space*e}Stave(e){e=Ye(e,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});const a=new ze(e.x,e.y,e.width,e.options);return this.staves.push(a),a.setContext(this.context),this.stave=a,a}TabStave(e){e=Ye(e,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:1.3*this.options.stave.space}});const a=new He(e.x,e.y,e.width,e.options);return this.staves.push(a),a.setContext(this.context),this.stave=a,a}StaveNote(e){const a=new oe(e);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}GhostNote(e){const a=new Kt(e);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}TextNote(e){const a=new je(e);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}BarNote(e){e=Ye(e,{type:"single",options:{}});const a=new Ct(e.type);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}ClefNote(e){e=Ye(e,{type:"treble",options:{size:"default"}});const a=new mt(e.type,e.options.size,e.options.annotation);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}TimeSigNote(e){e=Ye(e,{time:"4/4",options:{}});const a=new Xt(e.time);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}KeySigNote(e){const a=new _t(e.key,e.cancelKey,e.alterKey);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}TabNote(e){const a=new Je(e);return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}GraceNote(e){const a=new yt(e);return this.stave&&a.setStave(this.stave),a.setContext(this.context),a}GraceNoteGroup(e){const a=new H(e.notes,e.slur);return a.setContext(this.context),a}Accidental(e){e=Ye(e,{type:null,options:{}});const a=new N(e.type);return a.setContext(this.context),a}Annotation(e){e=Ye(e,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const a=new be(e.text);return a.setJustification(e.hJustify),a.setVerticalJustification(e.vJustify),a.setFont(e.fontFamily,e.fontSize,e.fontWeight),a.setContext(this.context),a}Articulation(e){e=Ye(e,{type:"a.",position:"above",options:{}});const a=new Se(e.type);return a.setPosition(e.position),a.setContext(this.context),a}TextDynamics(e){e=Ye(e,{text:"p",duration:"q",dots:0,line:0,options:{}});const a=new xt({text:e.text,line:e.line,duration:e.duration,dots:e.dots});return this.stave&&a.setStave(this.stave),a.setContext(this.context),this.renderQ.push(a),a}Fingering(e){e=Ye(e,{number:"0",position:"left",options:{}});const a=new $(e.number);return a.setPosition(e.position),a.setContext(this.context),a}StringNumber(e){e=Ye(e,{number:"0",position:"left",options:{}});const a=new K(e.number);return a.setPosition(e.position),a.setContext(this.context),a}TickContext(){return new q().setContext(this.context)}ModifierContext(){return new Le}MultiMeasureRest(e){const a=new Pt(e.number_of_measures,e);return a.setContext(this.context),this.renderQ.push(a),a}Voice(e){e=Ye(e,{time:"4/4",options:{}});const a=new D(e.time);return this.voices.push(a),a}StaveConnector(e){e=Ye(e,{top_stave:null,bottom_stave:null,type:"double",options:{}});const a=new F(e.top_stave,e.bottom_stave);return a.setType(e.type).setContext(this.context),this.renderQ.push(a),a}Formatter(){return new Ce}Tuplet(e){e=Ye(e,{notes:[],options:{}});const a=new I(e.notes,e.options).setContext(this.context);return this.renderQ.push(a),a}Beam(e){e=Ye(e,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const a=new B(e.notes,e.options.autoStem).setContext(this.context);return a.breakSecondaryAt(e.options.secondaryBeamBreaks),this.renderQ.push(a),a}Curve(e){e=Ye(e,{from:null,to:null,options:{}});const a=new lt(e.from,e.to,e.options).setContext(this.context);return this.renderQ.push(a),a}StaveTie(e){e=Ye(e,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const a=new O({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices},e.text);return e.options.direction&&a.setDirection(e.options.direction),a.setContext(this.context),this.renderQ.push(a),a}StaveLine(e){e=Ye(e,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const a=new ct({first_note:e.from,last_note:e.to,first_indices:e.first_indices,last_indices:e.last_indices});return e.options.text&&a.setText(e.options.text),e.options.font&&a.setFont(e.options.font),a.setContext(this.context),this.renderQ.push(a),a}VibratoBracket(e){e=Ye(e,{from:null,to:null,options:{harsh:!1}});const a=new qe({start:e.from,stop:e.to});return e.options.line&&a.setLine(e.options.line),e.options.harsh&&a.setHarsh(e.options.harsh),a.setContext(this.context),this.renderQ.push(a),a}TextBracket(e){e=Ye(e,{from:null,to:null,text:"",options:{superscript:"",position:1}});const a=new it({start:e.from,stop:e.to,text:e.text,superscript:e.options.superscript,position:e.options.position});return e.options.line&&a.setLine(e.options.line),e.options.font&&a.setFont(e.options.font),a.setContext(this.context),this.renderQ.push(a),a}System(e={}){e.factory=this;const a=new $t(e).setContext(this.context);return this.systems.push(a),a}EasyScore(e={}){return e.factory=this,new Ht(e)}PedalMarking(e={}){e=Ye(e,{notes:[],options:{style:"mixed"}});const a=new Ve(e.notes);return a.setStyle(Ve.StylesString[e.options.style]),a.setContext(this.context),this.renderQ.push(a),a}NoteSubGroup(e={}){e=Ye(e,{notes:[],options:{}});const a=new R(e.notes);return a.setContext(this.context),a}draw(){this.systems.forEach(e=>e.setContext(this.context).format()),this.staves.forEach(e=>e.setContext(this.context).draw()),this.voices.forEach(e=>e.setContext(this.context).draw()),this.renderQ.forEach(e=>{e.isRendered()||e.setContext(this.context).draw()}),this.systems.forEach(e=>e.setContext(this.context).draw()),this.reset()}}function Jt(ce,e){const a=e.options;return(ce=Object.assign(e,ce)).options=Object.assign(a,ce.options),ce}class $t extends o{constructor(e={}){super(),this.setAttribute("type","System"),this.setOptions(e),this.parts=[]}setOptions(e={}){this.options=Jt(e,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new At({renderer:{el:null}})}setContext(e){return super.setContext(e),this.factory.setContext(e),this}addConnector(e="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:e}),this.connector}addStave(e){return(e=Jt(e,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}})).stave||(e.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:e.options})),e.voices.forEach(a=>a.setContext(this.context).setStave(e.stave).getTickables().forEach(b=>b.setStave(e.stave))),this.parts.push(e),e.stave}format(){const e=new Ce;this.formatter=e;let a=this.options.y,b=0,w=[];const C=[];this.parts.forEach(z=>{a+=z.stave.space(z.spaceAbove),z.stave.setY(a),e.joinVoices(z.voices),a+=z.stave.space(z.spaceBelow),a+=z.stave.space(this.options.spaceBetweenStaves),z.debugNoteMetrics&&(C.push({y:a,voice:z.voices[0]}),a+=15),w=w.concat(z.voices),b=Math.max(b,z.stave.getNoteStartX())}),this.parts.forEach(z=>z.stave.setNoteStartX(b));const V=this.options.width-(b-this.options.x)-j.STAVEPADDING;e.format(w,V);for(let z=0;z<this.options.formatIterations;z++)e.tune();this.startX=b,this.debugNoteMetricsYs=C,this.lastY=a}draw(){const e=this.checkContext();this.setRendered(),this.options.debugFormatter&&Ce.plotDebugging(e,this.formatter,this.startX,this.options.y,this.lastY),this.debugNoteMetricsYs.forEach(a=>{a.voice.getTickables().forEach(b=>j.plotMetrics(e,b,a.y))})}}(l.Flow=m).Element=o,l.Flow.Fraction=s,l.Flow.Renderer=E,l.Flow.Formatter=Ce,l.Flow.Music=Q,l.Flow.Glyph=p,l.Flow.Stave=ze,l.Flow.StaveNote=oe,l.Flow.StaveModifier=Be,l.Flow.StaveTempo=st,l.Flow.Voice=D,l.Flow.Accidental=N,l.Flow.Beam=B,l.Flow.StaveTie=O,l.Flow.TabStave=He,l.Flow.TabNote=Je,l.Flow.Bend=Me,l.Flow.Vibrato=_e,l.Flow.VibratoBracket=qe,l.Flow.Note=j,l.Flow.ModifierContext=Le,l.Flow.MultiMeasureRest=Pt,l.Flow.TickContext=q,l.Flow.Articulation=Se,l.Flow.Annotation=be,l.Flow.Barline=Ie,l.Flow.NoteHead=P,l.Flow.StaveConnector=F,l.Flow.ClefNote=mt,l.Flow.KeySignature=We,l.Flow.KeySigNote=_t,l.Flow.TimeSignature=Xe,l.Flow.TimeSigNote=Xt,l.Flow.Stem=L,l.Flow.TabTie=U,l.Flow.Clef=et,l.Flow.Dot=X,l.Flow.Modifier=Y,l.Flow.TabSlide=ut,l.Flow.Tuplet=I,l.Flow.GraceNote=yt,l.Flow.GraceTabNote=Wt,l.Flow.Tuning=It,l.Flow.KeyManager=class{constructor(ce){this.music=new Q,this.setKey(ce)}setKey(ce){return this.key=ce,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),!Q.scaleTypes[this.keyParts.type])throw new l.RERR("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),Q.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const ce=Q.root_indices[this.keyParts.root];for(let e=0;e<Q.roots.length;++e){const a=(ce+e)%Q.roots.length,b=Q.roots[a],w=this.music.getRelativeNoteName(b,this.scale[e]);this.scaleMap[b]=w,this.scaleMapByValue[this.scale[e]]=w,this.originalScaleMapByValue[this.scale[e]]=w}return this}getAccidental(ce){const e=this.music.getKeyParts(ce).root,a=this.music.getNoteParts(this.scaleMap[e]);return{note:this.scaleMap[e],accidental:a.accidental}}selectNote(ce){ce=ce.toLowerCase();const e=this.music.getNoteParts(ce),a=this.scaleMap[e.root],b=this.music.getNoteParts(a);if(a===ce)return{note:a,accidental:e.accidental,change:!1};const w=this.scaleMapByValue[this.music.getNoteValue(ce)];if(w!=null)return{note:w,accidental:this.music.getNoteParts(w).accidental,change:!1};const C=this.originalScaleMapByValue[this.music.getNoteValue(ce)];return C!=null?(this.scaleMap[b.root]=C,delete this.scaleMapByValue[this.music.getNoteValue(a)],this.scaleMapByValue[this.music.getNoteValue(ce)]=C,{note:C,accidental:this.music.getNoteParts(C).accidental,change:!0}):b.root===ce?(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[e.root])],this.scaleMapByValue[this.music.getNoteValue(b.root)]=b.root,this.scaleMap[b.root]=b.root,{note:b.root,accidental:null,change:!0}):(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[e.root])],this.scaleMapByValue[this.music.getNoteValue(ce)]=ce,delete this.scaleMap[b.root],this.scaleMap[b.root]=ce,{note:ce,accidental:e.accidental,change:!0})}},l.Flow.StaveHairpin=Lt,l.Flow.BoundingBox=h,l.Flow.Stroke=W,l.Flow.TextNote=je,l.Flow.Curve=lt,l.Flow.TextDynamics=xt,l.Flow.StaveLine=ct,l.Flow.Ornament=ye,l.Flow.PedalMarking=Ve,l.Flow.TextBracket=it,l.Flow.FretHandFinger=$,l.Flow.Repetition=Fe,l.Flow.BarNote=Ct,l.Flow.GhostNote=Kt,l.Flow.NoteSubGroup=R,l.Flow.GraceNoteGroup=H,l.Flow.Tremolo=Et,l.Flow.StringNumber=K,l.Flow.Crescendo=zt,l.Flow.Volta=ot,l.Flow.Font=t,l.Flow.System=$t,l.Flow.Factory=At,l.Flow.Parser=Bt,l.Flow.EasyScore=Ht,l.Flow.Registry=i;const oi=l},5166(de){de.exports=`precision mediump float;
|
|
uniform sampler2D u_image;
|
|
varying vec4 v_position;
|
|
|
|
#define NUM_ROWS 5
|
|
#define ELEMENT_HEIGHT 300
|
|
|
|
void main() {
|
|
const float halfPixel = 1.0 / float(ELEMENT_HEIGHT * 2);
|
|
|
|
vec2 absolutePosition = (v_position.xy + vec2(1.0)) / vec2(2.0);
|
|
float absX = absolutePosition.x;
|
|
float absY = absolutePosition.y;
|
|
|
|
int skyLine = 0;
|
|
for (int i = 0; i < ELEMENT_HEIGHT; ++i) {
|
|
float ratioY = float(i) / float(ELEMENT_HEIGHT);
|
|
float relY = (ratioY - 0.5 + halfPixel) / float(NUM_ROWS);
|
|
float x = absX;
|
|
float y = absY + relY;
|
|
|
|
float currentAlpha = texture2D(u_image, vec2(x, y)).a;
|
|
if (currentAlpha > 0.0) {
|
|
skyLine = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
int bottomLine = ELEMENT_HEIGHT;
|
|
for (int i = ELEMENT_HEIGHT - 1; i >= 0; --i) {
|
|
float ratioY = float(i) / float(ELEMENT_HEIGHT);
|
|
float relY = (ratioY - 0.5 + halfPixel) / float(NUM_ROWS);
|
|
float x = absX;
|
|
float y = absY + relY;
|
|
|
|
float currentAlpha = texture2D(u_image, vec2(x, y)).a;
|
|
if (currentAlpha > 0.0) {
|
|
bottomLine = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
int r = skyLine;
|
|
if (r > 256) {
|
|
r -= 256;
|
|
}
|
|
int g = bottomLine;
|
|
if (g > 256) {
|
|
g -= 256;
|
|
}
|
|
int b = (skyLine / 256 * 16) + (bottomLine / 256);
|
|
|
|
gl_FragColor = vec4(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0, 1.0);
|
|
}
|
|
`},5340(de){de.exports=`attribute vec4 a_position;
|
|
varying vec4 v_position;
|
|
|
|
void main() {
|
|
gl_Position = a_position;
|
|
v_position = a_position;
|
|
}
|
|
`}},pt={};function Ze(de){var g=pt[de];if(g!==void 0)return g.exports;var c=pt[de]={exports:{}};return bt[de].call(c.exports,c,c.exports,Ze),c.exports}return Ze.d=(de,g)=>{for(var c in g)Ze.o(g,c)&&!Ze.o(de,c)&&Object.defineProperty(de,c,{enumerable:!0,get:g[c]})},Ze.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),Ze.o=(de,g)=>Object.prototype.hasOwnProperty.call(de,g),Ze.r=de=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(de,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(de,"__esModule",{value:!0})},Ze(8156)})())})(Qt);var fi=Qt.exports,pi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,Vt=(rt,gt,bt,pt)=>{for(var Ze=pt>1?void 0:pt?mi(gt,bt):gt,de=rt.length-1,g;de>=0;de--)(g=rt[de])&&(Ze=(pt?g(gt,bt,Ze):g(Ze))||Ze);return pt&&Ze&&pi(gt,bt,Ze),Ze};let wt=class extends ai{constructor(){super(...arguments),this._zoom=1,this.allowDrop=!1,this.src="",this.options={autoResize:!0,backend:"canvas",drawingParameters:"default"}}render(){return li`<main></main>`}async renderMusic(rt){this.controller&&(await this.controller.load(rt),this.controller.zoom=this._zoom,this.controller.render(),this.requestUpdate())}async getMusic(){var gt;if(this.src.length>0)return fetch(this.src).then(bt=>bt.text());const rt=(gt=this.parentElement)==null?void 0:gt.querySelector('script[type="text/xml"]');return rt?rt.innerHTML:""}async firstUpdated(){this.controller=new fi.OpenSheetMusicDisplay(this.canvas,this.options),this.requestUpdate();const rt=await this.getMusic();rt&&this.renderMusic(rt)}};wt.styles=hi`
|
|
main {
|
|
overflow-x: auto;
|
|
}
|
|
`;Vt([Zt({type:Boolean})],wt.prototype,"allowDrop",2);Vt([Zt()],wt.prototype,"src",2);Vt([ci("main")],wt.prototype,"canvas",2);wt=Vt([ui("sheet-music")],wt);export{wt as SheetMusic};
|