//~ Revision: 118, Copyright (C) 2014-2021: Willem Vree
//~ This program is free software; you can redistribute it and/or modify it under the terms of the
//~ Lesser GNU General Public License as published by the Free Software Foundation;
//~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
//~ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//~ See the Lesser GNU General Public License for more details. <http://www.gnu.org/licenses/lgpl.html>.
var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.arrayIteratorImpl = function (h) {
    var u = 0;
    return function () {
        return u < h.length ? { done: !1, value: h[u++] } : { done: !0 };
    };
};
$jscomp.arrayIterator = function (h) {
    return { next: $jscomp.arrayIteratorImpl(h) };
};
$jscomp.makeIterator = function (h) {
    var u = "undefined" != typeof Symbol && Symbol.iterator && h[Symbol.iterator];
    return u ? u.call(h) : $jscomp.arrayIterator(h);
};
$jscomp.ASSUME_ES5 = !1;
$jscomp.ASSUME_NO_NATIVE_MAP = !1;
$jscomp.ASSUME_NO_NATIVE_SET = !1;
$jscomp.SIMPLE_FROUND_POLYFILL = !1;
$jscomp.defineProperty =
    $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties
        ? Object.defineProperty
        : function (h, u, n) {
            h != Array.prototype && h != Object.prototype && (h[u] = n.value);
        };
$jscomp.getGlobal = function (h) {
    h = [
        "object" == typeof window && window,
        "object" == typeof self && self,
        "object" == typeof global && global,
        h,
    ];
    for (var u = 0; u < h.length; ++u) {
        var n = h[u];
        if (n && n.Math == Math) return n;
    }
    return globalThis;
};
$jscomp.global = $jscomp.getGlobal(this);
$jscomp.SYMBOL_PREFIX = "jscomp_symbol_";
$jscomp.initSymbol = function () {
    $jscomp.initSymbol = function () { };
    $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol);
};
$jscomp.SymbolClass = function (h, u) {
    this.$jscomp$symbol$id_ = h;
    $jscomp.defineProperty(this, "description", { configurable: !0, writable: !0, value: u });
};
$jscomp.SymbolClass.prototype.toString = function () {
    return this.$jscomp$symbol$id_;
};
$jscomp.Symbol = (function () {
    function h(n) {
        if (this instanceof h) throw new TypeError("Symbol is not a constructor");
        return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX + (n || "") + "_" + u++, n);
    }
    var u = 0;
    return h;
})();
$jscomp.initSymbolIterator = function () {
    $jscomp.initSymbol();
    var h = $jscomp.global.Symbol.iterator;
    h || (h = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("Symbol.iterator"));
    "function" != typeof Array.prototype[h] &&
        $jscomp.defineProperty(Array.prototype, h, {
            configurable: !0,
            writable: !0,
            value: function () {
                return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this));
            },
        });
    $jscomp.initSymbolIterator = function () { };
};
$jscomp.initSymbolAsyncIterator = function () {
    $jscomp.initSymbol();
    var h = $jscomp.global.Symbol.asyncIterator;
    h || (h = $jscomp.global.Symbol.asyncIterator = $jscomp.global.Symbol("Symbol.asyncIterator"));
    $jscomp.initSymbolAsyncIterator = function () { };
};
$jscomp.iteratorPrototype = function (h) {
    $jscomp.initSymbolIterator();
    h = { next: h };
    h[$jscomp.global.Symbol.iterator] = function () {
        return this;
    };
    return h;
};
$jscomp.iteratorFromArray = function (h, u) {
    $jscomp.initSymbolIterator();
    h instanceof String && (h += "");
    var n = 0,
        q = {
            next: function () {
                if (n < h.length) {
                    var p = n++;
                    return { value: u(p, h[p]), done: !1 };
                }
                q.next = function () {
                    return { done: !0, value: void 0 };
                };
                return q.next();
            },
        };
    q[Symbol.iterator] = function () {
        return q;
    };
    return q;
};
$jscomp.polyfill = function (h, u, n, q) {
    if (u) {
        n = $jscomp.global;
        h = h.split(".");
        for (q = 0; q < h.length - 1; q++) {
            var p = h[q];
            p in n || (n[p] = {});
            n = n[p];
        }
        h = h[h.length - 1];
        q = n[h];
        u = u(q);
        u != q && null != u && $jscomp.defineProperty(n, h, { configurable: !0, writable: !0, value: u });
    }
};
$jscomp.polyfill(
    "Array.prototype.keys",
    function (h) {
        return h
            ? h
            : function () {
                return $jscomp.iteratorFromArray(this, function (h) {
                    return h;
                });
            };
    },
    "es6",
    "es3"
);
$jscomp.findInternal = function (h, u, n) {
    h instanceof String && (h = String(h));
    for (var q = h.length, p = 0; p < q; p++) {
        var D = h[p];
        if (u.call(n, D, p, h)) return { i: p, v: D };
    }
    return { i: -1, v: void 0 };
};
$jscomp.polyfill(
    "Array.prototype.find",
    function (h) {
        return h
            ? h
            : function (h, n) {
                return $jscomp.findInternal(this, h, n).v;
            };
    },
    "es6",
    "es3"
);
var xml2abc_VERSION = 118,
    vertaal;
(function () {
    function h(a, b) {
        return Array(a + 1).join(b);
    }
    function u(a, b) {
        for (var c = []; a;) c.push(b), --a;
        return c;
    }
    function n(a, b) {
        for (var c = 0, d = {}; c < a.length; ++c) d[a[c]] = b[c];
        return d;
    }
    function q(a, b) {
        var c = a.split(/%[ds]/);
        c.length > b.length && b.push("");
        return b
            .map(function (a, b) {
                return c[b] + a;
            })
            .join("");
    }
    function p(a, b) {
        v.info(q(a, b));
    }
    function D(a, b) {
        return -1 !== a.indexOf(b, a.length - b.length);
    }
    function H(a) {
        return Object.keys(a).map(function (a) {
            return parseInt(a);
        });
    }
    function M(a, b) {
        var c = [],
            d;
        if (Array.isArray(a)) for (d = 0; d < a.length; ++d) d in a && c.push([d, a[d]]);
        else for (d in a) c.push([d, a[d]]);
        c.sort(
            b
                ? function (a, b) {
                    return a[0] - b[0];
                }
                : function (a, b) {
                    return a[1] - b[1] || b[0] - a[0];
                }
        );
        return c;
    }
    function N(a) {
        this.reset();
        this.ixp = a;
        this.divs = this.mdur = this.ixm = 0;
        this.mtr = [4, 4];
    }
    function C(a, b) {
        this.tijd = 0;
        this.dur = a;
        this.fact = null;
        this.tup = [""];
        this.tupabc = "";
        this.grace = this.beam = 0;
        this.before = [];
        this.after = "";
        this.ns = b ? [b] : [];
        this.lyrs = {};
        this.pos = 0;
        this.tab = null;
        this.ntdec = "";
    }
    function E(a) {
        this.tijd = 0;
        this.str = a;
        this.pos = 0;
    }
    function F() { }
    function z(a) {
        this.maxtime = this.tijd = 0;
        this.gMaten = [];
        this.gLyrics = [];
        this.vnums = {};
        this.cnt = new F();
        this.vceCnt = 1;
        this.lastnote = null;
        this.bpl = a.b;
        this.cpl = a.n;
        this.repbra = 0;
        this.nvlt = a.v;
    }
    function G(a, b, c, d) {
        this.fnmext = a;
        this.outlist = [];
        this.infolist = [];
        this.title = "T:Title";
        this.key = "none";
        this.clefs = {};
        this.mtr = "none";
        this.tempo = 0;
        this.tempo_units = [1, 4];
        this.pad = b;
        this.X = c + 1;
        this.denL = d.d;
        this.volpan = d.m;
        this.cmpL = [];
        this.scale = "";
        this.tstep = d.t;
        this.stemless = 0;
        this.rightmargin = this.leftmargin = this.pagewidth = "";
        this.shiftStem = d.s;
        this.mnum = d.mnum;
        4 == d.p.length &&
            ((this.scale = "" != d.p[0] ? parseFloat(d.p[0]) : ""),
                (this.pagewidth = "" != d.p[1] ? parseFloat(d.p[1]) : ""),
                (this.leftmargin = "" != d.p[2] ? parseFloat(d.p[2]) : ""),
                (this.rightmargin = "" != d.p[3] ? parseFloat(d.p[3]) : ""));
    }
    function W(a, b) {
        if (!a.join("")) return ["", 0];
        for (var c = [], d = 0; d < a.length; ++d) {
            var e = a[d];
            "" == e
                ? (e = b ? "_" : "*")
                : D(e, "_") && !D(e, "\\_")
                    ? ((e = e.replace("_", "")), (b = 1))
                    : (b = 0);
            c.push(e);
        }
        return [c.join(" "), b];
    }
    function I(a, b) {
        for (var c = a, d = b, e; b;) (e = a % b), (a = b), (b = e);
        return [c / a, d / a];
    }
    function O(a, b, c) {
        if (0 == a.dur) return "";
        var d = I(c * a.dur, 4 * b);
        b = d[0];
        c = d[1];
        a.fact && ((d = a.fact[0]), (a = a.fact[1]), (d = I(b * d, c * a)), (b = d[0]), (c = d[1]));
        64 < c &&
            ((a = b / c),
                (d = Math.floor(a)),
                a - d < 0.1 * a && ((b = d), (c = 1)),
                (d = I(Math.round((64 * b) / c) || 1, 64)),
                p("denominator too small: %d/%d rounded to %d/%d", [b, c, d[0], d[1]]),
                (b = d[0]),
                (c = d[1]));
        return 1 == b ? (1 == c ? "" : 2 == c ? "/" : "/" + c) : 1 == c ? "" + b : b + "/" + c;
    }
    function P(a) {
        var b = a.match(/([_^]*)([A-Ga-g])([',]*)/);
        if (!b) return -1;
        a = b[1];
        var c = b[2];
        b = b[3];
        var d = c.toUpperCase();
        c = 60 + [0, 2, 4, 5, 7, 9, 11]["CDEFGAB".indexOf(d)] + (d != c ? 12 : 0);
        a && (c += ("^" == a[0] ? 1 : -1) * a.length);
        b && (c += ("'" == b[0] ? 12 : -12) * b.length);
        return c;
    }
    function X(a, b, c, d) {
        var e = 0;
        0 <= c.indexOf("stafflines=1") && (e += 4);
        !d && 0 <= c.indexOf("bass") && (e += 12);
        e && ((c = "CDEFGAB".split("")), (e = c.indexOf(a) + e), (a = c[e % 7]), (b += Math.floor(e / 7)));
        4 < b && (a = a.toLowerCase());
        5 < b && (a += h(b - 5, "'"));
        4 > b && (a += h(4 - b, ","));
        return a;
    }
    function Y(a, b) {
        var c = {
            maj: 8,
            ion: 8,
            m: 11,
            min: 11,
            aeo: 11,
            mix: 9,
            dor: 10,
            phr: 12,
            lyd: 7,
            loc: 13,
            non: 8,
        };
        b = b.slice(0, 3).toLowerCase();
        b =
            "Fb Cb Gb Db Ab Eb Bb F C G D A E B F# C# G# D# A# E# B#".split(" ")[c[b] + a] +
            (8 != c[b] ? b : "");
        c = "FCGDAEB".split("");
        a = 0 <= a ? n(c.slice(0, a), u(a, 1)) : n(c.slice(a), u(-a, -1));
        return [b, a];
    }
    function Q(a, b, c) {
        var d = 0,
            e = b[a];
        var g = e.tup.indexOf("start");
        -1 < g && e.tup.splice(g, 1);
        var f = a;
        for (c = [e.fact[0] / c[0], e.fact[1] / c[1]]; a < b.length;) {
            e = b[a];
            if (!(e instanceof E || e.grace)) {
                -1 < e.tup.indexOf("start")
                    ? ((g = Q(a, b, c)), (a = g[0]), (g = g[1]), (d += g))
                    : e.fact && (d += 1);
                g = e.tup.indexOf("stop");
                if (-1 < g) {
                    e.tup.splice(g, 1);
                    break;
                }
                if (!e.fact) {
                    a = l;
                    break;
                }
                var l = a;
            }
            a += 1;
        }
        l = [c[0], c[1], d];
        l = "3,2,3" == l.toString() ? "(3" : q("(%d:%d:%d", l);
        b[f].tupabc = l + b[f].tupabc;
        return [a, d];
    }
    function Z(a) {
        a = a.filter(function (a) {
            return a instanceof C;
        });
        for (var b = 0; b < a.length - 1;) {
            var c = a[b],
                d = a[b + 1];
            !c.fact &&
                !d.fact &&
                0 < c.dur &&
                d.beam &&
                (3 * c.dur == d.dur
                    ? ((d.dur = (2 * d.dur) / 3), (c.dur *= 2), (c.after = "<" + c.after), (b += 1))
                    : 3 * d.dur == c.dur &&
                    ((c.dur = (2 * c.dur) / 3), (d.dur *= 2), (c.after = ">" + c.after), (b += 1)));
            b += 1;
        }
    }
    function aa(a, b, c, d, e) {
        for (d = 0; d < a.length;)
            (c = a[d]), c instanceof C && c.fact && !c.grace && ((c = Q(d, a, [1, 1])), (d = c[0])), (d += 1);
        d = [];
        for (var g, f = 0; f < a.length; ++f) {
            c = a[f];
            if (c instanceof C) {
                var l = O(c, b, e),
                    k = 1 < c.ns.length;
                g = c.ns.filter(function (a) {
                    return D(a, "-");
                });
                g = g.map(function (a) {
                    return a.slice(0, -1);
                });
                var m = "";
                k && g.length == c.ns.length && ((c.ns = g), (m = "-"));
                g = c.tupabc + c.before.join("");
                k && (g += "[");
                g += c.ns.join("");
                k && (g += "]" + m);
                D(g, "-") && ((g = g.slice(0, -1)), (m = "-"));
                g += l + m;
                g += c.after;
                c = c.beam;
            } else c.str instanceof Array && (c.str = c.str[0]), (g = c.str), (c = 1);
            c ? d.push(g) : d.push(" " + g);
        }
        for (d = d.join(""); 0 <= d.indexOf("!ped!!ped!");) d = d.replace(/!ped!!ped!/g, "!ped!");
        for (; 0 <= d.indexOf("!ped-up!!ped-up!");) d = d.replace(/!ped-up!!ped-up!/g, "!ped-up!");
        for (; 0 <= d.indexOf("!8va(!!8va)!");) d = d.replace(/!8va\(!!8va\)!/g, "");
        return d;
    }
    function ba(a, b) {
        a.map(function (a, b) {
            a.pos = b;
        });
        a.sort(function (a, b) {
            return a.tijd - b.tijd || a.pos - b.pos;
        });
        for (var c = 0, d = [], e = [], g = 0; g < a.length; ++g) {
            var f = a[g];
            f.tijd > c && K(f.tijd - c, b) && (d.push(new C(f.tijd - c, "x")), e.push(d.length - 1));
            if (f instanceof E) f.tijd < c && (f.tijd = c), d.push(f), (c = f.tijd);
            else {
                if (f.tijd < c) {
                    if ("z" == f.ns[0]) continue;
                    var l = d[d.length - 1];
                    if (l.tijd <= f.tijd)
                        if ("z" == l.ns[0])
                            (l.dur = f.tijd - l.tijd),
                                0 == l.dur && d.pop(),
                                p("overlap in part %d, measure %d: rest shortened", [b.ixp + 1, b.ixm + 1]);
                        else {
                            l.ns = l.ns.concat(f.ns);
                            p("overlap in part %d, measure %d: added chord", [b.ixp + 1, b.ixm + 1]);
                            f.dur = f.tijd + f.dur - c;
                            if (0 >= f.dur) continue;
                            f.tijd = c;
                        }
                    else {
                        p("overlapping notes in one voice! part %d, measure %d, note %s discarded", [
                            b.ixp + 1,
                            b.ixm + 1,
                            f instanceof C ? f.ns : f.str,
                        ]);
                        continue;
                    }
                }
                d.push(f);
                if (f instanceof C)
                    if (((c = f.ns[0]), "x" == c || "z" == c)) e.push(d.length - 1);
                    else if (e.length) {
                        if (f.beam && !f.grace) for (c = 0; c < e.length; ++c) d[e[c]].beam = f.beam;
                        e = [];
                    }
                c = f.tijd + f.dur;
            }
        }
        0 == c &&
            p("empty measure in part %d, measure %d, it should contain at least a rest to advance the time!", [
                b.ixp + 1,
                b.ixm + 1,
            ]);
        return d;
    }
    function ca(a) {
        function b(a) {
            a = q('<part-group number="%d" type="%s"></part-group>', [a, "stop"]);
            return $(a, d);
        }
        var c,
            d = a[0];
        var e = [];
        var g = [];
        var f = a.children();
        for (c = 0; c < f.length; c++)
            if (((a = $(f[c])), "part-group" == a[0].tagName)) {
                var l = a.attr("number");
                var k = a.attr("type");
                var m = g.indexOf(l);
                "start" == k
                    ? -1 < m
                        ? (e.push(b(l)), e.push(a))
                        : (e.push(a), g.push(l))
                    : -1 < m && (g.splice(m, 1), e.push(a));
            } else e.push(a);
        for (c = g.length - 1; 0 <= c; --c) (l = g[c]), e.push(b(l));
        return e;
    }
    function J(a, b, c) {
        if (0 == a.length) return [[], []];
        var d = a.shift();
        if ("part-group" == d[0].tagName) {
            var e = d.attr("number");
            var g = d.attr("type");
            if ("start" == g) {
                g = [];
                for (f in { "group-symbol": 0, "group-barline": 0, "group-name": 0, "group-abbreviation": 0 })
                    g.push(d.find(f).text() || "");
                b[e] = g;
                c.push(e);
                var f = J(a, b, c);
                a = f[0];
                d = f[1];
                f = J(d, b, c);
                b = f[0];
                c = f[1];
                return [[a].concat(b), c];
            }
            c = c.pop();
            a.length && "stop" == a[0].attr("type") && e != c && ((f = b[c]), (b[c] = b[e]), (b[e] = f));
            b = b[e];
            return [[b], a];
        }
        f = J(a, b, c);
        b = f[0];
        a = f[1];
        return [
            [
                ["name_tuple", d.find("part-name").text() || "", d.find("part-abbreviation").text() || ""],
            ].concat(b),
            a,
        ];
    }
    function R(a) {
        var b, c;
        if (0 == a.length) return [];
        var d = [];
        for (b = 0; b < a.length; ++b) {
            var e = a[b];
            if (1 == e.length) d.push("" + e[0]);
            else {
                d.push("(");
                for (c = 0; c < e.length; ++c) d.push("" + e[c]);
                d.push(")");
            }
            d.push("|");
        }
        d.splice(-1, 1);
        1 < a.length && (d = ["{"].concat(d).concat(["}"]));
        return d;
    }
    function S(a, b, c, d, e, g) {
        if ("name_tuple" == a[0])
            (d = d.shift()),
                b[0] && ((a[1] = b[0] + ":" + a[1]), (a[2] = b[1] + ":" + a[2])),
                e.push(a),
                g.push.apply(g, R(d));
        else if (2 == a.length && "name_tuple" == a[0][0])
            (d = d.shift()),
                (c = ["name_tuple", "", ""]),
                (c[1] = a[0][1] + ":" + a[1][2]),
                (c[2] = a[0][2] + ":" + a[1][3]),
                e.push(c),
                g.push.apply(g, R(d));
        else {
            var f = a[a.length - 1];
            b = f[0];
            var l = f[1];
            var k = f[2];
            f = f[3];
            l = "yes" == l || c;
            g.push("brace" == b ? "{" : "[");
            for (c = 0; c < a.length - 1; ++c) S(a[c], [k, f], l, d, e, g), l && g.push("|");
            l && g.splice(-1, 1);
            g.push("brace" == b ? "}" : "]");
        }
    }
    function da(a) {
        for (var b = "", c = a.children(), d = 0; d < c.length; ++d) {
            var e = c[d];
            switch (e.tagName) {
                case "elision":
                    b += "~";
                    break;
                case "text":
                    b += $(e).text().replace(/_/g, "\\_").replace(/-/g, "\\-").replace(/ /g, "~");
            }
        }
        if (!b) return b;
        c = a.find("syllabic").text();
        if ("begin" == c || "middle" == c) b += "-";
        a.find("extend").length && (b += "_");
        return b;
    }
    function ea(a) {
        var b = { diamond: 1, triangle: 1, square: 1, normal: 1 },
            c = fa,
            d,
            e = "default",
            g = { default: [] },
            f = { default: [] };
        a = a.split("\n");
        for (d = 0; d < a.length; ++d) {
            var l = a[d];
            if (0 <= l.indexOf("I:percmap")) {
                l = l.split(" ").map(function (a) {
                    return a.trim();
                });
                var k = l[4];
                k in b && (k = k + "+," + k);
                l = "%%map perc" + e + " " + l[1] + " print=" + l[2] + " midi=" + l[3] + " heads=" + k;
                g[e].push(l);
            }
            0 <= l.indexOf("%%MIDI") && f[e].push(l);
            0 <= l.indexOf("V:") &&
                (k = l.match(/V:\s*(\S+)/)) &&
                ((e = k[1]), e in g || ((g[e] = []), (f[e] = [])));
        }
        b = Object.keys(g).sort();
        for (d = 0; d < b.length; ++d) c = c.concat(g[b[d]]);
        e = "default";
        for (d = 0; d < a.length; ++d)
            (l = a[d]),
                0 <= l.indexOf("I:percmap") ||
                0 <= l.indexOf("%%MIDI") ||
                (0 <= l.indexOf("V:") || 0 <= l.indexOf("K:")
                    ? ((k = l.match(/V:\s*(\S+)/)) && (e = k[1]),
                        c.push(l),
                        e in f && f[e].length && ((c = c.concat(f[e])), delete f[e]),
                        0 <= l.indexOf("perc") && -1 == l.indexOf("map=") && (l += " map=perc"),
                        0 <= l.indexOf("map=perc") && 0 < g[e].length && c.push("%%voicemap perc" + e),
                        0 <= l.indexOf("map=off") && c.push("%%voicemap"))
                    : c.push(l));
        return c.join("\n");
    }
    function L(a, b) {
        var c = a;
        4 < b && (c = a.toLowerCase());
        5 < b && (c += h(b - 5, "'"));
        4 > b && (c += h(4 - b, ","));
        return c;
    }
    function K(a, b) {
        if (a > b.divs / 16) return 1;
        p("MuseScore bug: incorrect duration, smaller then 1/64! in measure %d, part %d", [b.ixm, b.ixp]);
        return 0;
    }
    function w(a) {
        this.slurBuf = {};
        this.dirStk = {};
        this.ingrace = 0;
        this.msc = new z(a);
        this.unfold = a.u;
        this.ctf = a.c;
        this.gStfMap = [];
        this.midiMap = [];
        this.drumInst = {};
        this.drumNotes = {};
        this.instMid = [];
        this.midDflt = [-1, -1, -1, -91];
        this.msralts = {};
        this.curalts = {};
        this.stfMap = {};
        this.vce2stf = {};
        this.clefMap = {};
        this.curClef = {};
        this.stemDir = {};
        this.clefOct = {};
        this.curStf = {};
        this.nolbrk = a.x;
        this.doPageFmt = 1 == a.p.length;
        this.tstep = a.t;
        this.dirtov1 = a.v1;
        this.ped = !a.noped;
        this.wstems = a.stm;
        this.pedVce = null;
        this.repeat_str = {};
        this.tabVceMap = {};
        this.koppen = {};
        this.note_alts = [
            "=C ^C =D ^D =E =F ^F =G ^G =A ^A =B".split(" "),
            "^B _D ^^C _E _F ^E _G ^^F _A ^^G _B _C".split(" "),
            "__D ^^B __E __F ^^D __G ^^E __A _/A __B __C ^^A".split(" "),
        ];
        this.step_map = { C: 0, D: 2, E: 4, F: 5, G: 7, A: 9, B: 11 };
    }
    var ha = Math.pow(2, 53),
        T = {
            "ornaments>trill-mark": "T",
            "ornaments>mordent": "M",
            "ornaments>inverted-mordent": "P",
            "ornaments>turn": "!turn!",
            "ornaments>inverted-turn": "!invertedturn!",
            "technical>up-bow": "u",
            "technical>down-bow": "v",
            "technical>harmonic": "!open!",
            "technical>open-string": "!open!",
            "technical>stopped": "!plus!",
            "technical>snap-pizzicato": "!snap!",
            "technical>thumb-position": "!thumb!",
            "articulations>accent": "!>!",
            "articulations>strong-accent": "!^!",
            "articulations>staccato": ".",
            "articulations>staccatissimo": "!wedge!",
            "articulations>scoop": "!slide!",
            fermata: "!fermata!",
            arpeggiate: "!arpeggio!",
            "articulations>tenuto": "!tenuto!",
            "articulations>spiccato": "!wedge!",
            "articulations>breath-mark": "!breath!",
            "articulations>detached-legato": "!tenuto!.",
        },
        U = {
            p: "!p!",
            pp: "!pp!",
            ppp: "!ppp!",
            pppp: "!pppp!",
            f: "!f!",
            ff: "!ff!",
            fff: "!fff!",
            ffff: "!ffff!",
            mp: "!mp!",
            mf: "!mf!",
            sfz: "!sfz!",
        },
        fa =
            '%%beginsvg\n<defs>,<text id="x" x="-3" y="0">&#xe263;</text>,<text id="x-" x="-3" y="0">&#xe263;</text>,<text id="x+" x="-3" y="0">&#xe263;</text>,<text id="normal" x="-3.7" y="0">&#xe0a3;</text>,<text id="normal-" x="-3.7" y="0">&#xe0a3;</text>,<text id="normal+" x="-3.7" y="0">&#xe0a4;</text>,<g id="circle-x"><text x="-3" y="0">&#xe263;</text><circle r="4" class="stroke"></circle></g>,<g id="circle-x-"><text x="-3" y="0">&#xe263;</text><circle r="4" class="stroke"></circle></g>,<path id="triangle" d="m-4 -3.2l4 6.4 4 -6.4z" class="stroke" style="stroke-width:1.4"></path>,<path id="triangle-" d="m-4 -3.2l4 6.4 4 -6.4z" class="stroke" style="stroke-width:1.4"></path>,<path id="triangle+" d="m-4 -3.2l4 6.4 4 -6.4z" class="stroke" style="fill:#000"></path>,<path id="square" d="m-3.5 3l0 -6.2 7.2 0 0 6.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="square-" d="m-3.5 3l0 -6.2 7.2 0 0 6.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="square+" d="m-3.5 3l0 -6.2 7.2 0 0 6.2z" class="stroke" style="fill:#000"></path>,<path id="diamond" d="m0 -3l4.2 3.2 -4.2 3.2 -4.2 -3.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="diamond-" d="m0 -3l4.2 3.2 -4.2 3.2 -4.2 -3.2z" class="stroke" style="stroke-width:1.4"></path>,<path id="diamond+" d="m0 -3l4.2 3.2 -4.2 3.2 -4.2 -3.2z" class="stroke" style="fill:#000"></path>,</defs>\n%%endsvg'.split(
                ","
            ),
        V =
            '%%beginsvg\n,<style type="text/css">\n,.bf {font-family:sans-serif; font-size:7px}\n,</style>\n,<defs>\n,<rect id="clr" x="-3" y="-1" width="6" height="5" fill="white"></rect>\n,<rect id="clr2" x="-3" y="-1" width="11" height="5" fill="white"></rect>\n'.split(
                ","
            ),
        v;
    N.prototype.reset = function () {
        this.lline = this.attr = "";
        this.rline = "|";
        this.lnum = "";
    };
    F.prototype.inc = function (a, b) {
        this.counters[a][b] = (this.counters[a][b] || 0) + 1;
    };
    F.prototype.clear = function (a) {
        a = Object.keys(a);
        var b = u(a.length, 0);
        this.counters = { note: n(a, b), nopr: n(a, b), nopt: n(a, b) };
    };
    F.prototype.getv = function (a, b) {
        return this.counters[a][b];
    };
    F.prototype.prcnt = function (a) {
        for (var b in this.counters.note)
            0 != this.getv("nopr", b) &&
                p("part %d, voice %d has %d skipped non printable notes", [a, b, this.getv("nopr", b)]),
                0 != this.getv("nopt", b) &&
                p("part %d, voice %d has %d notes without pitch", [a, b, this.getv("nopt", b)]),
                0 == this.getv("note", b) && p("part %d, skipped empty voice %d", [a, b]);
    };
    z.prototype.initVoices = function (a) {
        this.vtimes = {};
        this.voices = {};
        this.lyrics = {};
        for (var b in this.vnums) (this.vtimes[b] = 0), (this.voices[b] = []), (this.lyrics[b] = []);
        a && this.cnt.clear(this.vnums);
    };
    z.prototype.incTime = function (a) {
        this.tijd += a;
        0 > this.tijd && (this.tijd = 0);
        this.tijd > this.maxtime && (this.maxtime = this.tijd);
    };
    z.prototype.appendElemCv = function (a, b) {
        for (var c in a) this.appendElem(c, b);
    };
    z.prototype.insertElem = function (a, b) {
        b = new E(b);
        b.tijd = 0;
        this.voices[a].unshift(b);
    };
    z.prototype.appendObj = function (a, b, c) {
        b.tijd = this.tijd;
        this.voices[a].push(b);
        this.incTime(c);
        this.tijd > this.vtimes[a] && (this.vtimes[a] = this.tijd);
    };
    z.prototype.appendElemT = function (a, b, c) {
        b = new E(b);
        b.tijd = c;
        this.voices[a].push(b);
    };
    z.prototype.appendElem = function (a, b, c) {
        this.appendObj(a, new E(b), 0);
        c && this.cnt.inc("note", a);
    };
    z.prototype.appendNote = function (a, b, c) {
        b.ns.push(b.ntdec + c);
        this.appendObj(a, b, parseInt(b.dur));
        this.lastnote = b;
        "z" != c && "x" != c && (this.cnt.inc("note", a), b.grace || this.lyrics[a].push(b.lyrs));
    };
    z.prototype.getLastRec = function (a) {
        return this.gMaten.length ? ((a = this.gMaten[this.gMaten.length - 1][a]), a[a.length - 1]) : null;
    };
    z.prototype.getLastMelis = function (a, b) {
        return this.gLyrics.length && ((a = this.gLyrics[this.gLyrics.length - 1][a]), b in a) ? a[b][1] : 0;
    };
    z.prototype.addChord = function (a, b) {
        for (var c = 0; c < a.before.length; c++) {
            var d = a.before[c];
            0 > this.lastnote.before.indexOf(d) && this.lastnote.before.push(d);
        }
        this.lastnote.ns.push(a.ntdec + b);
    };
    z.prototype.addBar = function (a, b) {
        b.mdur &&
            this.maxtime > b.mdur &&
            p("measure %d in part %d longer than metre", [b.ixm + 1, b.ixp + 1]);
        this.tijd = this.maxtime;
        for (var c in this.vnums) {
            if (b.lline || b.lnum) {
                var d = this.getLastRec(c);
                if (d) {
                    var e = d.str;
                    b.lline && (e = (e + b.lline).replace(/:\|:/g, "::").replace(/\|\|/g, "|"));
                    3 == this.nvlt
                        ? b.ixp + parseInt(c) == Math.min.apply(null, H(this.vnums)) && (e += b.lnum)
                        : 4 == this.nvlt
                            ? parseInt(c) == Math.min.apply(null, H(this.vnums)) && (e += b.lnum)
                            : b.lnum && ((e += b.lnum), (this.repbra = 1));
                    d.str = e;
                } else b.lline && this.insertElem(c, "|:");
            }
            a && (d = this.getLastRec(c)) && (d.str += a);
            b.attr && this.insertElem(c, "" + b.attr);
            this.appendElem(c, " " + b.rline);
            this.voices[c] = ba(this.voices[c], b);
            d = this.lyrics[c];
            e = {};
            for (
                var g = d.reduce(function (a, b) {
                    return a.concat(H(b));
                }, []),
                f = Math.max.apply(null, g.concat([0]));
                0 < f;
                --f
            ) {
                g = d.map(function (a) {
                    return a[f] || "";
                });
                var l = this.getLastMelis(c, f);
                e[f] = W(g, l);
            }
            this.lyrics[c] = e;
            Z(this.voices[c]);
        }
        this.gMaten.push(this.voices);
        this.gLyrics.push(this.lyrics);
        this.tijd = this.maxtime = 0;
        this.initVoices();
    };
    z.prototype.outVoices = function (a, b) {
        var c;
        var d = {};
        var e = Math.min.apply(null, H(this.vnums) || [1]);
        for (c in this.vnums)
            if (0 != this.cnt.getv("note", c)) {
                if (v.denL) var g = v.denL;
                else {
                    var f, l;
                    g = c;
                    var k = this.gMaten;
                    var m = a;
                    var B = 0;
                    var h = ha;
                    for (var r = [4, 8, 16]; r.length;) {
                        var t = r.shift(),
                            q = 0;
                        for (l = 0; l < k.length; ++l) {
                            var y = k[l][g];
                            for (f = 0; f < y.length; ++f) {
                                var p = y[f];
                                p instanceof E || 0 == p.dur || (q += O(p, m[l], t).length);
                            }
                        }
                        q < h && ((B = t), (h = q));
                    }
                    g = B;
                }
                v.cmpL.push(g);
                f = [];
                l = {};
                for (k = 0; k < this.gMaten.length; ++k) {
                    m = this.gMaten[k][c];
                    f.push(aa(m, a[k], k, b, g));
                    m = void 0;
                    r = this.gLyrics;
                    if (0 != k)
                        for (m in ((B = this.gMaten[k][c]), (h = r[k][c]), (r = r[k - 1][c]), r))
                            if (((t = r[m][1]), !(m in h) && t)) {
                                t = B;
                                q = [];
                                for (y = 0; y < t.length; ++y)
                                    if (((p = t[y]), p instanceof C && !p.grace)) {
                                        if ("z" == p.ns[0] || "x" == p.ns[0]) break;
                                        q.push("_");
                                    }
                                (t = q.join(" ")) && (h[m] = [t, 0]);
                            }
                    B = this.gLyrics[k][c];
                    for (n in B)
                        if (((m = B[n]), (m = m[0]), n in l)) {
                            for (; l[n].length < k;) l[n].push("");
                            l[n].push(m);
                        } else l[n] = u(k, "").concat([m]);
                }
                for (n in l) (m = l[n]), (g = f.length - m.length), (l[n] = m.concat(u(g, "")));
                v.add("V:" + this.vceCnt);
                this.repbra &&
                    (1 == this.nvlt && 1 < this.vceCnt && v.add("I:repbra 0"),
                        2 == this.nvlt && parseInt(c) > e && v.add("I:repbra 0"));
                0 < this.cpl ? (this.bpl = 0) : 0 == this.bpl && (this.cpl = 100);
                for (g = 0; f.length;) {
                    k = 1;
                    for (
                        m = f[0];
                        k < f.length &&
                        !(0 < this.cpl && m.length + f[k].length >= this.cpl) &&
                        !(0 < this.bpl && k >= this.bpl);

                    )
                        (m += f[k]), (k += 1);
                    g += k;
                    v.add(m + " %" + g);
                    f.splice(0, k);
                    B = M(l, 1);
                    for (h = 0; h < B.length; ++h) {
                        m = B[h];
                        var n = m[0];
                        m = m[1];
                        v.add("w: " + m.slice(0, k).join("|") + "|");
                        m.splice(0, k);
                    }
                }
                d[c] = this.vceCnt;
                this.vceCnt += 1;
            }
        this.gMaten = [];
        this.gLyrics = [];
        this.cnt.prcnt(b + 1);
        return d;
    };
    G.prototype.add = function (a) {
        this.outlist.push(a + "\n");
    };
    G.prototype.info = function (a, b) {
        this.infolist.push(("undefined" == typeof b || b ? "-- " : "") + a);
    };
    G.prototype.mkHeader = function (a, b, c, d, e) {
        var g = [],
            f = [],
            l,
            k;
        var m = a.slice();
        for (k = 0; k < b.length; ++k) {
            var h = b[k];
            try {
                S(h, ["", ""], "", a, g, f);
            } catch (ia) {
                p("lousy musicxml: error in part-list", []);
            }
        }
        b = f.join(" ");
        a = {};
        for (k = 0; k < m.length && k < g.length; ++k) {
            var x = m[k];
            h = g[k];
            var r = h[1];
            h = h[2];
            0 != x.length &&
                ((x = x[0][0]),
                    (r = r.replace(/\n/g, "\\n").replace(/\.:/g, ".").replace(/^:|:$/g, "")),
                    (h = h.replace(/\n/g, "\\n").replace(/\.:/g, ".").replace(/^:|:$/g, "")),
                    (a[x] = (r ? 'nm="' + r + '"' : "") + (h ? ' snm="' + h + '"' : "")));
        }
        g = [
            q("X:%d\n%s\n%s", [this.X, this.title, -1 < this.mnum ? "%%measurenb " + this.mnum + "\n" : ""]),
        ];
        "" !== this.scale && g.push("%%scale " + this.scale + "\n");
        "" !== this.pagewidth && g.push("%%pagewidth " + this.pagewidth + "cm\n");
        "" !== this.leftmargin && g.push("%%leftmargin " + this.leftmargin + "cm\n");
        "" !== this.rightmargin && g.push("%%rightmargin " + this.rightmargin + "cm\n");
        b && 1 < f.length && g.push("%%score " + b + "\n");
        m = this.tempo ? q("Q:%d/%d=%s\n", [this.tempo_units[0], this.tempo_units[1], this.tempo]) : "";
        f = [];
        for (k = 0; k < this.cmpL.length; ++k) (h = this.cmpL[k]), (f[h] = (f[h] || 0) + 1);
        f = M(f);
        f = f[f.length - 1][0];
        f = this.denL ? this.denL : f;
        g.push(q("L:1/%d\n%sM:%s\n", [f, m, this.mtr]));
        g.push(q("I:linebreak $\nK:%s\n", [this.key]));
        this.stemless && g.push("U:s=!stemless!\n");
        m = Object.keys(d).sort();
        for (k = 0; k < m.length; ++k) g = g.concat(d[m[k]]);
        this.dojef = 0;
        for (l in this.clefs) {
            h = c[l - 1];
            k = h[0];
            b = h[1];
            r = h[2];
            x = h[3];
            m = h.slice(4);
            h = this.clefs[l];
            m.length && 0 > h.indexOf("perc") && (h = (h + " map=perc").trim());
            g.push(q("V:%d %s %s\n", [l, h, a[l] || ""]));
            l in d &&
                (g.push(q("%%voicemap tab%d\n", [l])),
                    g.push("K:none\nM:none\n%%clef none\n%%staffscale 1.6\n%%flatbeams true\n%%stemdir down\n"));
            -1 < h.indexOf("perc") && g.push("K:none\n");
            1 < this.volpan
                ? (0 < k && k != l && g.push("%%MIDI channel " + k + "\n"),
                    0 < b && g.push("%%MIDI program " + (b - 1) + "\n"),
                    0 <= r && g.push("%%MIDI control 7 " + r + "\n"),
                    0 <= x && g.push("%%MIDI control 10 " + x + "\n"))
                : 0 < this.volpan &&
                (m.length && 0 < k && g.push("%%MIDI channel " + k + "\n"),
                    0 < b && g.push("%%MIDI program " + (b - 1) + "\n"));
            for (k = 0; k < m.length; ++k)
                if (
                    ((h = m[k].nt),
                        (r = m[k].step),
                        (b = m[k].midi),
                        (x = m[k].nhd) || (x = "normal"),
                        P(h) != b || h != r)
                )
                    0 < this.volpan && g.push("%%MIDI drummap " + h + " " + b + "\n"),
                        g.push("I:percmap " + h + " " + r + " " + b + " " + x + "\n"),
                        (this.dojef = this.tstep);
            f != this.cmpL[l - 1] && g.push("L:1/" + this.cmpL[l - 1] + "\n");
        }
        this.outlist = g.concat(this.outlist);
        c = Object.keys(e).sort();
        if (c.length) {
            var t = [];
            var n = this.shiftStem
                ? '<g id="kop%s" class="bf"><use xlink:href="#clr"></use><text x="-2" y="3">%s</text></g>\n'.replace(
                    "-2",
                    "-5"
                )
                : '<g id="kop%s" class="bf"><use xlink:href="#clr"></use><text x="-2" y="3">%s</text></g>\n',
                y = this.shiftStem
                    ? '<g id="kop%s" class="bf"><use xlink:href="#clr2"></use><text x="-2" y="3">%s</text></g>\n'.replace(
                        "-2",
                        "-5"
                    )
                    : '<g id="kop%s" class="bf"><use xlink:href="#clr2"></use><text x="-2" y="3">%s</text></g>\n';
            d = this.shiftStem
                ? V.map(function (a) {
                    return a.replace("-3", "-6");
                })
                : V;
            c.forEach(function (a) {
                t.push(1 < a.length ? q(y, [a, a]) : q(n, [a, a]));
            });
            this.outlist = d.concat(t, "</defs>\n%%endsvg\n", this.outlist);
        }
    };
    G.prototype.writeall = function () {
        var a = v.outlist.join("");
        this.dojef && (a = ea(a));
        return [a, this.infolist.join("\n")];
    };
    w.prototype.matchSlur = function (a, b, c, d, e, g) {
        if (-1 != ["start", "stop"].indexOf(a))
            if ((b || (b = "1"), b in this.slurBuf)) {
                var f = this.slurBuf[b],
                    l = f[0],
                    k = f[1],
                    m = f[2];
                f = f[3];
                a != l
                    ? (c != k || "start" != l || (f && g) || (m.before.unshift("("), (d.after += ")")),
                        delete this.slurBuf[b])
                    : (p("double slur numbers %s-%s in part %d, measure %d, voice %d note %s, first discarded", [
                        a,
                        b,
                        this.msr.ixp + 1,
                        this.msr.ixm + 1,
                        c,
                        d.ns,
                    ]),
                        (this.slurBuf[b] = [a, c, d, e]));
            } else this.slurBuf[b] = [a, c, d, e];
    };
    w.prototype.doNotations = function (a, b, c) {
        for (var d = Object.keys(T).sort(), e = 0; e < d.length; ++e) {
            var g = d[e],
                f = T[g];
            b.find(g).length && a.before.push(f);
        }
        e = b.find("ornaments>tremolo");
        e.length &&
            ((g = e.attr("type")),
                (d = h(parseInt(e.text()), "/")),
                "single" == g
                    ? a.before.unshift("!" + d + "!")
                    : ((a.fact = null),
                        this.tstep
                            ? "stop" == g && a.before.unshift("!trem" + e.text() + "!")
                            : "start" == g && a.before.unshift("!" + d + "-!")));
        d = b.find("technical>fingering");
        c ||
            d.each(function () {
                a.before.push("!" + $(this).text() + "!");
            });
        d = b.find("technical>string");
        d.length &&
            c &&
            (this.tstep
                ? ((c = b.find("technical>fret")), c.length && (a.tab = [d.eq(0).text(), c.eq(0).text()]))
                : d.each(function () {
                    var b = "!" + $(this).text() + "!";
                    0 > a.ntdec.indexOf(b) && (a.ntdec += b);
                }));
        c = b.find("ornaments>wavy-line");
        c = $jscomp.makeIterator(c.toArray());
        for (d = c.next(); !d.done; d = c.next())
            switch (((d = d.value), $(d).attr("type"))) {
                case "start":
                    a.before.unshift("!trill(!");
                    break;
                case "stop":
                    a.after += "!trill)!";
            }
        c = b.find("glissando");
        0 == c.length && (c = b.find("slide"));
        c.length &&
            ((b = "wavy" == c.attr("line-type") ? "~" : "-"),
                "start" == c.attr("type")
                    ? a.before.unshift(q("!%s(!", [b]))
                    : "stop" == c.attr("type") && a.before.unshift(q("!%s)!", [b])));
    };
    w.prototype.tabnote = function (a, b, c, d, e) {
        var g;
        var f = this.step_map[b] + parseInt(a || "0");
        11 < f && ((c += 1), (f -= 12));
        0 > f && (--c, (f += 12));
        a = e.tab[0];
        b = e.tab[1];
        for (g = 0; 4 > g; ++g) {
            var l = this.note_alts[g % 3][f];
            var k = c;
            -1 < ["^B", "^^B"].indexOf(l) && --k;
            -1 < ["_C", "__C"].indexOf(l) && (k += 1);
            if (-1 < l.indexOf("/") || 3 == g) k = 9;
            l = L(l, k);
            var m = this.tabmap[[d, l]] || ["", ""];
            k = m[0];
            m = m[1];
            if (!k) break;
            if (a == k) return l;
            3 == g &&
                (p("rejected: voice %d note %s string %s fret %s remains: string %s fret %s", [
                    d,
                    l,
                    a,
                    b,
                    k,
                    m,
                ]),
                    (e.tab = [k, m]));
        }
        this.tabmap[[d, l]] = e.tab;
        return l;
    };
    w.prototype.ntAbc = function (a, b, c, d, e, g) {
        var f = {
            "double-flat": -2,
            "flat-flat": -2,
            flat: -1,
            natural: 0,
            sharp: 1,
            "sharp-sharp": 2,
            "double-sharp": 2,
        };
        b += this.clefOct[this.curStf[d]] || 0;
        var l = c.find("accidental").text(),
            k = c.find("pitch>alter").text();
        if (e.tab) return this.tabnote(k, a, b, d, e);
        g &&
            this.tstep &&
            ((e = ["__", "_", "", "^", "^^"][parseInt(k || "0") + 2] + L(a, b)),
                p("no string notation found for note %s in voice %d", [e, d]));
        b = L(a, b);
        !k && this.msralts[a] && (k = 0);
        e = b + "#" + d;
        !k && e in this.curalts && (k = 0);
        if ("" === l && "" === k) return b;
        if ("" != l) k = f[l];
        else {
            k = parseFloat(k);
            if (e in this.curalts) {
                if (k == this.curalts[e]) return b;
            } else if (k == (this.msralts[a] || 0)) return b;
            if (
                c
                    .find("tie")
                    .add(c.find("notations>tied"))
                    .get()
                    .some(function (a) {
                        return "stop" == $(a).attr("type");
                    })
            )
                return b;
            p("accidental %d added in part %d, measure %d, voice %d note %s", [
                k,
                this.msr.ixp + 1,
                this.msr.ixm + 1,
                d + 1,
                b,
            ]);
        }
        this.curalts[e] = k;
        return (b = ["__", "_", "=", "^", "^^"][k + 2] + b);
    };
    w.prototype.doNote = function (a) {
        var b = new C(0, null),
            c = parseInt(a.find("voice").text() || "1");
        this.isSib && (c += 100 * (a.find("staff").text() || 1));
        var d = 0 < a.find("chord").length,
            e = a.find("pitch>step").text() || a.find("unpitched>display-step").text(),
            g = a.find("pitch>octave").text() || a.find("unpitched>display-octave").text(),
            f = 0 < a.find("rest").length,
            l = a.find("time-modification>actual-notes").text();
        if (l) {
            var k = a.find("time-modification>normal-notes").text();
            b.fact = [parseInt(l), parseInt(k)];
        }
        b.tup = a
            .find("notations>tuplet")
            .map(function () {
                return $(this).attr("type");
            })
            .get();
        k = a.find("duration").text();
        l = a.find("grace");
        b.grace = 0 < l.length;
        b.before = [""];
        b.after = "";
        b.grace &&
            !this.ingrace &&
            ((this.ingrace = 1), (b.before = ["{"]), "yes" == l.attr("slash") && b.before.push("/"));
        if ((l = !b.grace && this.ingrace)) (this.ingrace = 0), (this.msc.lastnote.after += "}");
        if (!k || b.grace) k = 0;
        if (!f && "no" == a.attr("print-object")) {
            if (d) return;
            f = 1;
        }
        b.dur = parseInt(k);
        f || (e && g) || (this.msc.cnt.inc("nopt", c), (g = 5), (e = "E"));
        k = 0 == ((this.curClef && this.curClef[this.curStf[c]]) || "").indexOf("tab");
        var m = a.find("notations");
        m.length && this.doNotations(b, m, k);
        m = a.find("stem");
        !f &&
            m.length &&
            "none" == m.text() &&
            (!k || c in this.hasStems || this.tstep) &&
            (b.before.push("s"), (v.stemless = 1));
        m = a.find("accidental");
        m.length && "yes" == m.attr("parentheses") && (b.ntdec += "!courtesy!");
        f = f ? ("no" == a.attr("print-object") || k ? "x" : "z") : this.ntAbc(e, parseInt(g), a, c, b, k);
        if (a.find("unpitched").length) {
            k = this.curClef[this.curStf[c]];
            e = X(e, parseInt(g), k, this.tstep);
            g = a.find("instrument");
            g = g.length ? g.attr("id") : "dummyId";
            g = this.drumInst[g] || P(f);
            k = a.find("notehead");
            m = k.text().replace(" ", "-");
            "x" == m && (f = "^" + f.replace(/\^/g, "").replace(/_/g, ""));
            if ("circle-x" == m || "diamond" == m || "triangle" == m)
                f = "_" + f.replace(/\^/g, "").replace(/_/g, "");
            "yes" == k.attr("filled") && (m += "+");
            "no" == k.attr("filled") && (m += "-");
            this.drumNotes[c + ";" + f] = [e, g, m];
        }
        e = a.find("tie").add(a.find("notations>tied")).get();
        e.some(function (a) {
            return "start" == $(a).attr("type");
        }) && (f += "-");
        e = a
            .find("beam")
            .map(function () {
                return $(this).text();
            })
            .get();
        b.beam = -1 < e.indexOf("continue") || -1 < e.indexOf("end") || b.grace;
        e = a.find("lyric");
        for (g = k = 0; g < e.length; ++g) {
            m = $(e[g]);
            var h = parseInt((m.attr("number") || "1").replace(/^.*verse/, ""));
            0 == h ? (h = k + 1) : (k = h);
            b.lyrs[h] = da(m);
        }
        e = a.find("stem").text();
        !this.wstems ||
            ("up" != e && "down" != e) ||
            e == this.stemDir[c] ||
            ((this.stemDir[c] = e), this.msc.appendElem(c, q("[I:stemdir %s]", [e])));
        d
            ? this.msc.addChord(b, f)
            : ((d = parseInt(a.find("staff").text() || "1")),
                this.curStf[c] != d &&
                ((e = d - this.curStf[c]),
                    (this.curStf[c] = d),
                    this.msc.appendElem(c, "[I:staff " + (0 < e ? "+" : "") + e + "]")),
                this.msc.appendNote(c, b, f));
        e = a.find("notations>slur");
        for (g = 0; g < e.length; ++g)
            (a = $(e[g])), this.matchSlur(a.attr("type"), a.attr("number"), c, this.msc.lastnote, b.grace, l);
    };
    w.prototype.doAttr = function (a) {
        var b, c;
        var d = {
            C1: "alto1",
            C2: "alto2",
            C3: "alto",
            C4: "tenor",
            F4: "bass",
            F3: "bass3",
            G2: "treble",
            TAB: "tab",
            percussion: "perc",
        };
        if ((b = a.find("divisions").text())) this.msr.divs = parseInt(b);
        b = parseInt(a.find("transpose>chromatic").text() || "0");
        var e = a.find("key>fifths").first().text();
        var g = 0 == this.msc.tijd && 0 == this.msr.ixm;
        if (e) {
            var f = Y(parseInt(e), a.find("key>mode").first().text() || "major");
            e = f[0];
            this.msralts = f[1];
            g && !b && "none" == v.key ? (v.key = e) : (e == v.key && g) || (this.msr.attr += "[K:" + e + "]");
        }
        if ((e = a.find("time>beats").text())) {
            f = a.find("time>beat-type").text();
            var l = e + "/" + f;
            g ? (v.mtr = l) : (this.msr.attr += "[M:" + l + "]");
            this.msr.mtr = [parseInt(e), parseInt(f)];
        }
        this.msr.mdur = (this.msr.divs * this.msr.mtr[0] * 4) / this.msr.mtr[1];
        var k = this;
        a.find("measure-style").each(function () {
            var a, b, c, d, e;
            var f = parseInt($(this).attr("number") || "1");
            var g = k.stfMap[f];
            $(this)
                .find("measure-repeat")
                .each(function () {
                    a = $(this).attr("type");
                    "start" == a
                        ? ((k.repeat_str[f] = [k.msr.ixm, $(this).text()]),
                            g.forEach(function (a) {
                                k.msc.insertElem(a, k.repeat_str[f]);
                            }))
                        : "stop" == a &&
                        ((b = k.repeat_str[f][0]),
                            (d = k.repeat_str[f][1]),
                            (c = k.msr.ixm - b),
                            d ? ((e = d + " "), (c /= parseInt(d))) : (e = ""),
                            (k.repeat_str[f][0] = q("[I:repeat %s%d]", [e, c])),
                            delete k.repeat_str[f]);
                });
        });
        (e = a.find("transpose>octave-change").text() || "") && (b += 12 * parseInt(e));
        l = a.find("clef");
        for (f = 0; f < l.length; f++) {
            var m = $(l[f]);
            e = parseInt(m.attr("number") || "1");
            var h = m.find("sign").text();
            var x = "percussion" != h && "TAB" != h ? m.find("line").text() || "" : "";
            x = d[h + x] || "";
            m = m.find("clef-octave-change").text() || "0";
            x += { "-2": "-15", "-1": "-8", 1: "+8", 2: "+15" }[m] || "";
            this.clefOct[e] = -parseInt(m);
            b && (x += " transpose=" + b);
            var r = a.find("staff-details");
            if (r.length && (r.attr("number") || 1) == e) {
                if ((m = r.find("staff-lines").text()))
                    (h = "3" == m && "TAB" == h ? "|||" : m),
                        (x += " stafflines=" + h),
                        (this.stafflines = parseInt(m));
                var t = [];
                r.find("staff-tuning").each(function () {
                    t.push($(this).find("tuning-step").text() + $(this).find("tuning-octave").text());
                });
                t.length && (x += q(" strings=%s", [t.join(",")]));
                (h = r.find("capo").text()) && (x += q(" capo=%s", [h]));
            }
            this.curClef[e] = x;
            if (g) this.clefMap[e] = x;
            else
                for (m = this.stfMap[e], c = 0; c < m.length; ++c) {
                    r = m[c];
                    if (e != this.curStf[r]) {
                        var n = e - this.curStf[r];
                        this.curStf[r] = e;
                        h = 0 < n ? "+" : "";
                        this.msc.appendElem(r, "[I:staff " + h + n + "]");
                    }
                    this.msc.appendElem(r, "[K:" + x + "]");
                }
        }
    };
    w.prototype.findVoice = function (a, b) {
        var c = b.eq(a);
        var d = parseInt(c.find("staff").text() || "1");
        var e = this.stfMap[d];
        e = e.length ? e[0] : 1;
        if (this.dirtov1) return { sn: d, v: e, v1: e };
        for (a += 1; a < b.length; ++a) {
            c = b.eq(a);
            if ("note" == c[0].tagName)
                return (
                    (b = parseInt(c.find("staff").text() || "1")),
                    (d = parseInt(c.find("voice").text() || "1")),
                    this.isSib && (d += 100 * b),
                    (b = this.vce2stf[d]),
                    { sn: b, v: d, v1: e }
                );
            if ("backup" == c[0].tagName) break;
        }
        return { sn: d, v: e, v1: e };
    };
    w.prototype.doDirection = function (a, b, c) {
        function d(a, b, c, d, e) {
            b &&
                ((c = 0 <= b.indexOf("!8v") ? a.stfMap[e] : [c]),
                    c.forEach(function (c) {
                        null != d
                            ? a.msc.appendElemT(c, b.replace("(", ")").replace("ped", "ped-up"), d)
                            : a.msc.appendElem(c, b);
                    }));
        }
        function e(a, b, c, e) {
            var f = { down: "!8va(!", up: "!8vb(!", crescendo: "!<(!", diminuendo: "!>(!", start: "!ped!" };
            g = t.attr("type") || "";
            var k = b + (t.attr("number") || "1");
            if (g in f)
                if (((f = f[g]), k in a.dirStk)) {
                    var l = a.dirStk[k];
                    delete a.dirStk[k];
                    "stop" == l.type
                        ? d(a, f, c, l.tijd, e)
                        : (p("%s direction %s has no stop in part %d, measure %d, voice %d", [
                            b,
                            l.type,
                            a.msr.ixp + 1,
                            a.msr.ixm + 1,
                            c + 1,
                        ]),
                            (a.dirStk[k] = { type: g, vs: c }));
                } else a.dirStk[k] = { type: g, vs: c };
            else if ("stop" == g)
                k in a.dirStk
                    ? ((l = a.dirStk[k]),
                        delete a.dirStk[k],
                        (g = l.type),
                        (c = l.vs),
                        "stop" == g
                            ? (p("%s direction %s has double stop in part %d, measure %d, voice %d", [
                                b,
                                g,
                                a.msr.ixp + 1,
                                a.msr.ixm + 1,
                                c + 1,
                            ]),
                                (f = ""))
                            : (f = f[l.type].replace("(", ")").replace("ped", "ped-up")))
                    : ((a.dirStk[k] = { type: "stop", tijd: a.msc.tijd }), (f = ""));
            else throw "wrong direction type";
            d(a, f, c, null, e);
        }
        var g,
            f,
            l,
            k = "";
        var m = a.attr("placement");
        var h = this.findVoice(b, c);
        c = h.sn;
        b = h.v;
        h = h.v1;
        var x = "",
            r = { dacapo: "D.C.", dalsegno: "D.S.", tocoda: "dacoda", fine: "fine", coda: "O", segno: "S" };
        var t = a.find("sound");
        if (t.length) {
            var n = t.find("midi-instrument");
            if (n.length) {
                var y = t.find("midi-instrument>midi-program").text();
                var u = t.find("midi-instrument>midi-channel").text();
                for (l in this.vceInst) this.vceInst[l] == n.attr("id") && (b = l);
                (l = (y ? y - 1 : u) + "") &&
                    0 < v.volpan &&
                    this.msc.appendElem(b, "[I:MIDI= " + (y ? "program" : "channel") + " " + l + "]");
            }
            if ((y = t.attr("tempo"))) {
                y = parseFloat(y).toFixed(0);
                var w = [1, 4];
            }
            for (A in r)
                if (t.attr(A)) {
                    x = r[A];
                    break;
                }
        }
        l = a.children("direction-type");
        for (r = 0; r < l.length; ++r) {
            a = $(l[r]);
            var A = { whole: [1, 1], half: [1, 2], quarter: [1, 4], eighth: [1, 8] };
            n = a.find("metronome");
            n.length &&
                ((t = n.find("beat-unit").text() || ""),
                    (w = t in A ? A[t] : A.quarter),
                    n.find("beat-unit-dot").length && (w = I(3 * w[0], 2 * w[1])),
                    (A = n
                        .find("per-minute")
                        .text()
                        .match(/[.\d]+/)) && (y = A[0]));
            t = a.find("wedge");
            t.length && e(this, "wedge", b);
            A = a.find("words");
            0 == A.length && (A = a.find("rehearsal"));
            for (n = 0; n < A.length; ++n) {
                if (x) {
                    this.msc.appendElem(b, q("!%s!", [x]), 1);
                    break;
                }
                var z = "below" == m ? "_" : "^";
                u = $(A[n]);
                0 > parseFloat(u.attr("default-y") || "0") && (z = "_");
                k += u.text().replace(/"/g, '\\"').replace(/\n/g, "\\n");
            }
            k = k.trim();
            for (f in U) (A = U[f]), a.find("dynamics>" + f).length && this.msc.appendElem(b, A, 1);
            a.find("coda").length && this.msc.appendElem(b, "O", 1);
            a.find("segno").length && this.msc.appendElem(b, "S", 1);
            t = a.find("octave-shift");
            t.length && e(this, "octave-shift", b, c);
            t = a.find("pedal");
            t.length && this.ped && (this.pedVce || (this.pedVce = b), e(this, "pedal", this.pedVce));
            "diatonic fretting" == a.find("other-direction").text() && (this.diafret = 1);
        }
        y &&
            ((y = parseFloat(y).toFixed(0)),
                0 == this.msc.tijd && 0 == this.msr.ixm
                    ? ((v.tempo = y), (v.tempo_units = w))
                    : this.msc.appendElem(h, q("[Q:%d/%d=%s]", [w[0], w[1], y])));
        k && this.msc.appendElem(b, '"' + z + k + '"', 1);
    };
    w.prototype.doHarmony = function (a, b, c) {
        c = this.findVoice(b, c).v;
        var d = {
            major: "",
            minor: "m",
            augmented: "+",
            diminished: "dim",
            dominant: "7",
            "half-diminished": "m7b5",
        };
        b = { major: "maj", dominant: "", minor: "m", diminished: "dim", augmented: "+", suspended: "sus" };
        var e = {
            second: "2",
            fourth: "4",
            seventh: "7",
            sixth: "6",
            ninth: "9",
            "11th": "11",
            "13th": "13",
        };
        var g = { 1: "#", 0: "", "-1": "b" };
        var f = a.find("root>root-step", "").text();
        var l = g[a.find("root>root-alter").text()] || "";
        var k = "";
        var m = a.find("kind").text();
        m in d
            ? (m = d[m])
            : -1 < m.indexOf("-")
                ? ((d = m.split("-")),
                    (m = d[0]),
                    (d = d[1]),
                    (m = (b[m] || "") + (e[d] || "")),
                    0 == m.indexOf("sus") && ((k = m), (m = "")))
                : "none" == m && (m = a.find("kind").attr("text"));
        e = a.find("degree");
        for (b = 0; b < e.length; ++b)
            (d = $(e[b])), (m += (g[d.find("degree-alter").text()] || "") + d.find("degree-value").text());
        m = m.replace("79", "9").replace("713", "13").replace("maj6", "6");
        a = a.find("bass>bass-step").text() + (g[a.find("bass>bass-alter").text()] || "");
        this.msc.appendElem(c, '"' + f + l + m + k + (a && "/" + a) + '"', 1);
    };
    w.prototype.doBarline = function (a) {
        var b = a.find("repeat"),
            c = 0;
        b.length && (c = b.attr("direction"));
        if (this.unfold) return c ? ("forward" == c ? 1 : 2) : 0;
        "right" == (a.attr("location") || "right") &&
            ((b = a.find("bar-style").text()),
                "light-light" == b ? (this.msr.rline = "||") : "light-heavy" == b && (this.msr.rline = "|]"));
        c && ("forward" == c ? (this.msr.lline = ":") : (this.msr.rline = ":|"));
        a = a.find("ending");
        a.length &&
            ("start" == a.attr("type")
                ? ((a = (a.attr("number") || "1").replace(/\./g, "").replace(/ /g, "")),
                    /^[\d,]+$/.test(a) || (a = '"' + a.trim() + '"'),
                    (this.msr.lnum = a))
                : "|" == this.msr.rline && (this.msr.rline = "||"));
        return 0;
    };
    w.prototype.doPrint = function (a) {
        if ("yes" == a.attr("new-system") || "yes" == a.attr("new-page")) return this.nolbrk ? "" : "$";
    };
    w.prototype.doPartList = function (a) {
        var b, c;
        var d = a.find("part-list>score-part");
        for (b = 0; b < d.length; ++b) {
            var e = d[b];
            var g = {};
            var f = $(e).find("midi-instrument");
            for (e = 0; e < f.length; ++e) {
                var l = $(f[e]);
                var k = ["midi-channel", "midi-program", "volume", "pan"];
                var m = [];
                for (c = 0; c < k.length; ++c) {
                    var h = k[c];
                    m.push(l.find(h).text() || this.midDflt[c]);
                }
                c = 1 * m[3];
                -90 <= c && 90 >= c && (c = ((c + 90) / 180) * 127);
                g[l.attr("id")] = [parseInt(m[0]), parseInt(m[1]), 1.27 * parseFloat(m[2]), c];
                (m = l.find("midi-unpitched").text()) && (this.drumInst[l.attr("id")] = m - 1);
            }
            this.instMid.push(g);
        }
        a = a.find("part-list");
        m = ca(a);
        return J(m, {}, [])[0];
    };
    w.prototype.mkTitle = function (a) {
        var b = [],
            c = [],
            d = [],
            e,
            g;
        var f = a.find("work>work-title").text().trim();
        var l = a.find("movement-title").text().trim();
        var k = a.find("identification>creator");
        for (e = 0; e < k.length; ++e) {
            var m = $(k[e]);
            var h = m.text();
            m = m.attr("type");
            h &&
                ((h = h.split("\n").map(function (a) {
                    return a.trim();
                })),
                    "composer" == m
                        ? b.push.apply(b, h)
                        : ("lyricist" == m || "transcriber" == m) && c.push.apply(c, h));
        }
        k = a.find("identification>rights");
        for (e = 0; e < k.length; ++e)
            if ((h = $(k[e]).text()))
                (h = h.split("\n").map(function (a) {
                    return a.trim();
                })),
                    c.push.apply(c, h);
        k = a.find("credit");
        for (e = 0; e < k.length; ++e) {
            h = "";
            m = $(k[e]).find("credit-words");
            for (g = 0; g < m.length; ++g) h += $(m[g]).text();
            d.push(h.replace(/\s*[\r\n]\s*/g, " "));
        }
        d = (function (a) {
            function e(a) {
                return a && -1 < h.indexOf(a);
            }
            var g = [],
                k;
            for (k = 0; k < d.length; ++k) {
                var h = d[k];
                (6 > a && ((h && -1 < f.indexOf(h)) || (h && -1 < l.indexOf(h)))) ||
                    (5 > a && ((h && -1 < b.indexOf(h)) || (h && -1 < c.indexOf(h)))) ||
                    (4 > a && ((f && -1 < h.indexOf(f)) || (l && -1 < h.indexOf(l)))) ||
                    (3 > a && (b.some(e) || c.some(e))) ||
                    (2 > a && /^[\d\W]*$/.test(h)) ||
                    g.push(h);
            }
            0 == a && f + l && (g = "");
            return g;
        })(this.ctf);
        f && (f = "T:" + f.replace(/\n/g, "\nT:") + "\n");
        l && (f += "T:" + l.replace(/\n/g, "\nT:") + "\n");
        d.length &&
            (f +=
                d
                    .map(function (a) {
                        return "T:" + a;
                    })
                    .join("\n") + "\n");
        b.length &&
            (f +=
                b
                    .map(function (a) {
                        return "C:" + a;
                    })
                    .join("\n") + "\n");
        c.length &&
            (f +=
                c
                    .map(function (a) {
                        return "Z:" + a;
                    })
                    .join("\n") + "\n");
        f && (v.title = f.substr(0, f.length - 1));
        (this.isSib = 0 <= a.find("identification>encoding>software").text().indexOf("Sibelius")) &&
            p("Sibelius MusicXMl is unreliable", []);
    };
    w.prototype.doDefaults = function (a) {
        if (this.doPageFmt) {
            var b = a.find("defaults");
            if (b.length) {
                a = b.find("scaling>millimeters").text();
                var c = b.find("scaling>tenths").text();
                c = a / c / 10;
                a = b.find("page-layout>page-width").text() * c;
                var d = b.find("page-layout>page-margins").first();
                b = d.find("left-margin").text();
                d = d.find("right-margin").text();
                var e = (10 * c) / 0.2117;
                !v.scale && e && (v.scale = e.toFixed(2));
                !v.pagewidth && a && (v.pagewidth = a.toFixed(2));
                v.leftmargin || "" == b || (v.leftmargin = (b * c).toFixed(2));
                v.rightmargin || "" == d || (v.rightmargin = (d * c).toFixed(2));
            }
        }
    };
    w.prototype.locStaffMap = function (a) {
        var b = {};
        this.vceInst = {};
        this.msc.vnums = {};
        this.hasStems = {};
        this.stfMap = {};
        this.clefMap = {};
        a = a.find("measure>note");
        for (var c = 0; c < a.length; c++) {
            var d = $(a[c]),
                e = parseInt(d.find("voice").text() || "1");
            this.isSib && (e += 100 * (d.find("staff").text() || 1));
            this.msc.vnums[e] = 1;
            var g = parseInt(d.find("staff").text() || "1");
            this.stfMap[g] = [];
            if (e in b) {
                var f = b[e];
                f[g] = (f[g] || 0) + 1;
            } else (f = {}), (f[g] = 1), (b[e] = f);
            f = d.find("instrument");
            f.length && (this.vceInst[e] = $(f).attr("id"));
            f = d.find("stem");
            0 != d.find("rest").length || (0 != f.length && "none" == f.text()) || (this.hasStems[e] = 1);
        }
        for (e in b) {
            a = [];
            c = b[e];
            for (g in c) a.push([c[g], g]);
            a.sort(function (a, b) {
                return a[0] - b[0];
            });
            a = a[a.length - 1][1];
            this.stfMap[a].push(e);
            this.vce2stf[e] = a;
            this.curStf[e] = a;
        }
    };
    w.prototype.addStaffMap = function (a) {
        var b,
            c,
            d = [],
            e = Object.keys(this.stfMap).sort();
        for (c = 0; c < e.length; ++c) {
            var g = e[c];
            var f = this.stfMap[g];
            var l = [];
            var k = [];
            for (b = 0; b < f.length; ++b) {
                var h = f[b];
                h in a && (l.push(a[h]), k.push(void 0 == this.hasStems[h]));
            }
            if (l.length)
                for (d.push(l), f = (g in this.clefMap) ? this.clefMap[g] : "treble", b = 0; b < l.length; ++b)
                    (h = l[b]),
                        (g = ""),
                        0 == f.indexOf("tab") &&
                        (k[b] && 0 > f.indexOf("nostems") && (g = " nostems"),
                            this.diafret && 0 > f.indexOf("diafret") && (g += " diafret")),
                        (v.clefs[h] = f + g);
        }
        this.gStfMap.push(d);
    };
    w.prototype.addMidiMap = function (a, b) {
        var c = this.instMid[a],
            d = Object.keys(c);
        var e = d.length ? c[d[0]] : this.midDflt;
        a = [];
        var g = this;
        for (m in b) {
            d = Object.keys(this.drumNotes)
                .sort()
                .filter(function (a) {
                    return a.split(";")[0] == m;
                });
            var f = d.map(function (a) {
                return {
                    nt: a.split(";")[1],
                    step: g.drumNotes[a][0],
                    midi: g.drumNotes[a][1],
                    nhd: g.drumNotes[a][2],
                };
            });
            var h = b[m];
            d = this.vceInst[m] || "";
            d in c ? a.push([h, c[d].concat(f)]) : a.push([h, e.concat(f)]);
        }
        a.sort(function (a, b) {
            return a[0] - b[0];
        });
        a.forEach(function (a) {
            g.midiMap.push(a[1]);
        });
        e = "E G B d f a c' e'".split(" ");
        var k = "0 1- 1 1+ 2 3 3 4 4 5 6 6+ 7 8- 8 8+ 9 10 10 11 11 12 13 13+ 14".split(" ");
        d = Object.keys(this.tabmap).sort();
        for (c = 0; c < d.length; ++c) {
            h = d[c];
            a = h.match(/(\d+),(.*)/);
            var m = a[1];
            var n = a[2];
            f = this.tabmap[h][0];
            var p = this.tabmap[h][1];
            this.diafret && (p = k[parseInt(p)]);
            h = b[m];
            f = this.stafflines - parseInt(f);
            a = this.tabVceMap[h] || [];
            a.push(q("%%map tab%d %s print=%s heads=kop%s\n", [h, n, e[f], p]));
            this.tabVceMap[h] = a;
            this.koppen[p] = 1;
        }
    };
    w.prototype.parse = function (a) {
        var b = {},
            c = $(a);
        this.mkTitle(c);
        this.doDefaults(c);
        a = this.doPartList(c);
        for (var d = c.find("part"), e = 0; e < d.length; ++e) {
            var g = d.eq(e),
                f = g.find("measure");
            this.locStaffMap(g);
            this.drumNotes = {};
            this.clefOct = {};
            this.curClef = {};
            this.stemDir = {};
            this.tabmap = {};
            this.diafret = 0;
            this.stafflines = 5;
            this.msc.initVoices(1);
            var h = 0,
                k = 0;
            g = [];
            for (this.msr = new N(e); this.msr.ixm < f.length;) {
                var m = f.eq(this.msr.ixm),
                    n = 0,
                    u = "";
                this.msr.reset();
                this.curalts = {};
                for (var r = m.children(), t = 0; t < r.length; t++)
                    switch (((c = r.eq(t)), c[0].tagName)) {
                        case "note":
                            this.doNote(c);
                            break;
                        case "attributes":
                            this.doAttr(c);
                            break;
                        case "direction":
                            this.doDirection(c, t, r);
                            break;
                        case "sound":
                            this.doDirection(m, t, r);
                            break;
                        case "harmony":
                            this.doHarmony(c, t, r);
                            break;
                        case "barline":
                            n = this.doBarline(c);
                            break;
                        case "backup":
                            c = parseInt(c.find("duration").text());
                            K(c, this.msr) && this.msc.incTime(-c);
                            break;
                        case "forward":
                            c = parseInt(c.find("duration").text());
                            K(c, this.msr) && this.msc.incTime(c);
                            break;
                        case "print":
                            u = this.doPrint(c);
                    }
                this.msc.addBar(u, this.msr);
                g.push(this.msr.divs);
                1 == n
                    ? ((k = this.msr.ixm), (this.msr.ixm += 1))
                    : 2 == n
                        ? 1 > h
                            ? ((this.msr.ixm = k), (h += 1))
                            : ((h = 0), (this.msr.ixm += 1))
                        : (this.msr.ixm += 1);
            }
            for (var w in this.repeat_str) (f = this.repeat_str[w]), (f[0] = q("[I:repeat %s %d]", [f[1], 1]));
            f = this.msc.outVoices(g, e);
            this.addStaffMap(f);
            this.addMidiMap(e, f);
            for (w in f) b[w] = f[w];
        }
        Object.keys(b).length
            ? v.mkHeader(this.gStfMap, a, this.midiMap, this.tabVceMap, this.koppen)
            : p("nothing written, %s has no notes ...", [v.fnmext]);
    };
    vertaal = function (a, b) {
        var c = {
            u: 0,
            b: 0,
            n: 0,
            c: 0,
            v: 0,
            d: 0,
            m: 0,
            x: 0,
            t: 0,
            v1: 0,
            noped: 0,
            stm: 0,
            mnum: -1,
            p: "f",
            s: 0,
        },
            d;
        for (d in b) c[d] = b[d];
        c.p = c.p ? c.p.split(",") : [];
        v = new G(".abc", "", 0, c);
        b = new w(c);
        try {
            b.parse(a);
        } catch (e) {
            p("** exception occurred: %s", [e]);
        }
        return v.writeall();
    };
})();
"undefined" != typeof exports &&
    ((exports.vertaal = vertaal), (exports.xml2abc_VERSION = xml2abc_VERSION));
