This plugin will generate MEI 3.0.0-compliant markup

function ProcessScore () {
    //$module(ExportProcessors.mss)
    // processors are a bit like a workflow manager -- they orchestrate the
    // generators, which in turn use the converters to convert specific values from sibelius
    // to MEI.
    score = Self._property:ActiveScore;

    mei = libmei.Mei();
    libmei.setDocumentRoot(mei);

    libmei.AddAttribute(mei, 'xmlns:xlink', 'http://www.w3.org/1999/xlink');
    libmei.AddAttribute(mei, 'xmlns', 'http://www.music-encoding.org/ns/mei');
    libmei.AddAttribute(mei, 'meiversion', '3.0.0');

    header = sibmei2.GenerateMEIHeader();
    libmei.AddChild(mei, header);

    music = sibmei2.GenerateMEIMusic();
    libmei.AddChild(mei, music);

}  //$end

function ProcessBeam (bobj, layer) {
    //$module(ExportProcessors.mss)
    next_obj = bobj.NextItem(bobj.VoiceNumber, 'NoteRest');
    ret = null;

    if (bobj.Duration < 256)
    {
        // if this object is an eighth note but is not beamed, and if the
        // active beam is set, null out the active beam and return null.
        if (bobj.Beam = NoBeam and layer._property:ActiveBeamId != null)
        {
            layer._property:ActiveBeamId = null;
            return ret;
        }

        /*
            It's possible that Sibelius records a 'continue beam' at the start
            of a beamed group. Visually, this doesn't look out of place if the previous
            note was a quarter note or higher.

            The first check we do is if the note has a 'continue beam' attribute and
            the previous note has a duration higher than 256 (quarter) then we probably have
            a false negative (i.e., there is the start of a beam, but it isn't necessarily
            encoded correctly).
        */
        falseNegative = False;

        if (bobj.Beam = ContinueBeam and layer._property:ActiveBeamId = null)
        {
            // by all accounts this should be a beamed note, but we'll need to double-check.
            prev_obj = bobj.PreviousItem(bobj.VoiceNumber, 'NoteRest');

            if (prev_obj != null and (prev_obj.Duration >= 256))
            {
                falseNegative = True;
            }
        }

        if (next_obj != null and (bobj.Beam = StartBeam or falseNegative = True) and next_obj.Beam = ContinueBeam)
        {
            // if:
            //  - we're not at the end of the bar
            //  - we have a start beam
            //  - the next note is a continue beam
            beam = libmei.Beam();
            layer._property:ActiveBeamId = beam._id;

            // return the beam so that we can add it to the tree.
            ret = beam;
        }

        if (layer._property:ActiveBeamId != null and bobj.Beam = ContinueBeam)
        {
            // add the note to the beam, but return null
            // so that we don't add it again to the tree.
            beamid = layer._property:ActiveBeamId;
            beam = libmei.getElementById(beamid);

            ret = beam;
        }
    }
    else
    {
        if (layer._property:ActiveBeamId != null)
        {
            // this is a break in any active beam, so register it as such.
            layer._property:ActiveBeamId = null;
        }
    }

    return ret;
}  //$end

function ProcessTuplet (bobj, meielement, layer) {
    //$module(ExportProcessors.mss)
    if (bobj.ParentTupletIfAny = null)
    {
        return null;
    }

    if (layer._property:ActiveTupletId = null)
    {
        tupletObject = bobj.ParentTupletIfAny;

        tuplet = libmei.Tuplet();

        layer._property:ActiveTupletObject = tupletObject;
        layer._property:ActiveTupletId = tuplet._id;

        if (libmei.GetName(meielement) = 'beam')
        {
            // get the first child
            startid = meielement.children[0];
        }
        else
        {
            startid = meielement._id;
        }

        libmei.AddAttribute(tuplet, 'startid', '#' & startid);
        libmei.AddAttribute(tuplet, 'num', tupletObject.Left);
        libmei.AddAttribute(tuplet, 'numbase', tupletObject.Right);

        tupletStyle = tupletObject.Style;

        switch (tupletStyle)
        {
            case(TupletNoNumber)
            {
                libmei.AddAttribute(tuplet, 'dur.visible', 'false');
            }
            case(TupletLeft)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'count');
            }
            case(TupletLeftRight)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'ratio');
            }
        }

        tupletBracket = tupletObject.Bracket;

        switch(tupletBracket)
        {
            case(TupletBracketOff)
            {
                libmei.AddAttribute(tuplet, 'bracket.visible', 'false');
            }
        }

        return tuplet;

        // used for tuplet spans...
        // mlines = Self._property:MeasureLines;
        // mlines.Push(tuplet._id);
    }
    else
    {
        tid = layer._property:ActiveTupletId;
        t = libmei.getElementById(tid);

        if (IsLastNoteInTuplet(bobj))
        {
            libmei.AddAttribute(t, 'endid', '#' & meielement._id);
            layer._property:ActiveTupletObject = null;
            layer._property:ActiveTupletId = null;
        }

        return t;
    }
}  //$end

function ProcessLyric (lyricobj, objectPositions) {
    //$module(ExportProcessors.mss)
    /*
        We need to track initial, medial, and terminal lyrics. Sibelius
        only allows us to know the medial and terminal, so we store all the
        syllables in an array until we reach the end of the word, and then
        attach them to the notes.
    */
    styleparts = MSplitString(lyricobj.StyleId, '.');
    verse_id = styleparts[5];
    verse_id_arr = MSplitString(verse_id, false);
    verse_num = verse_id_arr[5];
    bar_num = lyricobj.ParentBar.BarNumber;
    staff_num = lyricobj.ParentBar.ParentStaff.StaffNum;
    voicenum = lyricobj.VoiceNumber;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice 0.
        voicenum = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar_num, voicenum, 'Lyric object'));
    }

    lyricwords = Self._property:LyricWords;

    if (lyricwords.PropertyExists(staff_num) = False)
    {
        lyricwords[staff_num] = CreateDictionary();
    }

    lyricstaff = lyricwords[staff_num];

    if (lyricstaff.PropertyExists(voicenum) = False)
    {
        lyricstaff[voicenum] = CreateDictionary();
    }

    lyricvoice = lyricstaff[voicenum];

    if (lyricvoice.PropertyExists(verse_num) = False)
    {
        lyricvoice[verse_num] = CreateSparseArray();
    }

    if (lyricobj.SyllableType = MiddleOfWord)
    {
        lyricvoice[verse_num].Push(lyricobj);
        // we haven't reached the end of the word yet, so just return
        // and keep going.
        return null;
    }

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // anything past here is in the EndOfWord condition.
    // this should return a sparse array containing the syllables of the word.
    lyricvoice[verse_num].Push(lyricobj);
    lyric_word = lyricvoice[verse_num];
    objects = objectPositions[voicenum];

    obj_id = null;
    obj = null;

    for j = 0 to lyric_word.Length
    {
        syl = lyric_word[j];

        verse = libmei.Verse();
        libmei.AddAttribute(verse, 'n', verse_num);
        sylel = libmei.Syl();
        libmei.SetText(sylel, syl.Text);
        libmei.AddChild(verse, sylel);

        if (j = 0)
        {
            libmei.AddAttribute(sylel, 'wordpos', 'i'); // 'initial'
        }
        else
        {
            if (syl.SyllableType = EndOfWord)
            {
                libmei.AddAttribute(sylel, 'wordpos', 't'); // 'terminal'

                if (syl.NumNotes > 1)
                {
                    libmei.AddAttribute(sylel, 'con', 'u'); // 'underscore'
                }

            }
            else
            {
                libmei.AddAttribute(sylel, 'wordpos', 'm'); // medial
            }
        }

        obj = GetNoteObjectAtPosition(syl);

        if (obj != null)
        {
            name = libmei.GetName(obj);

            if (name = 'rest')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'rest'));
            }

            if (name = 'chord')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'chord'));
            }

            libmei.AddChild(obj, verse);
        }
    }

    // now reset the syllable array for this voice
    lyricvoice[verse_num] = CreateSparseArray();
}  //$end

function ProcessSystemStaff (score) {
    //$module(ExportProcessors.mss)
    systf = score.SystemStaff;

    for each bar in systf
    {
        for each bobj in bar
        {
            switch (bobj.Type)
            {
                case ('SpecialBarline')
                {
                    spclbarlines = Self._property:SpecialBarlines;
                    spclbarlines[bar.BarNumber] = ConvertBarline(bobj.BarlineInternalType);
                }
                case ('SystemText')
                {
                    systemtext = Self._property:SystemText;

                    if (systemtext.PropertyExists(bar.BarNumber) = False)
                    {
                        systemtext[bar.BarNumber] = CreateSparseArray();
                    }

                    systemtext[bar.BarNumber].Push(bobj);
                }
                case ('RepeatTimeLine')
                {
                    RegisterVolta(bobj);
                }
            }
        }
    }
}  //$end

function RegisterVolta (bobj) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;
    style = MSplitString(bobj.StyleId, '.');

    if (style[2] = 'repeat')
    {
        voltabars[bobj.ParentBar.BarNumber] = bobj;
    }
}  //$end

function ProcessVolta (mnum) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;

    if (voltabars.PropertyExists(mnum))
    {
        voltaElement = libmei.Ending();

        // swap out the section as the parent for the ending
        Self._property:VoltaElement = voltaElement;

        voltaObject = voltabars[mnum];
        voltainfo = ConvertEndingValues(voltaObject.StyleId);

        libmei.AddAttribute(voltaElement, 'n', voltainfo[0]);
        libmei.AddAttribute(voltaElement, 'label', voltainfo[1]);
        libmei.AddAttribute(voltaElement, 'type', voltainfo[2]);

        if (voltaObject.EndBarNumber != mnum)
        {
            Self._property:ActiveVolta = voltaObject;
        }

        return voltaElement;
    }
    else
    {
        if (Self._property:ActiveVolta != null)
        {
            // we have an unresolved volta, so
            // we'll keep the previous parentElement
            // active.
            activeVolta = Self._property:ActiveVolta;
            voltaElement = Self._property:VoltaElement;

            // if the end bar is the current bar OR if the end
            // bar is the next bar, but the end position is 0, we're escaping the
            // volta the next time around.
            if ((activeVolta.EndBarNumber = mnum) or
                (activeVolta.EndBarNumber = (mnum + 1) and activeVolta.EndPosition = 0))
            {
                Self._property:ActiveVolta = null;
                Self._property:VoltaElement = null;
            }
            return null;
        }
    }

    return null;
}  //$end

function ProcessSymbol (sobj, objectPositions) {
    //$module(ExportProcessors.mss)
    Log('symbol index: ' & sobj.Index & ' name: ' & sobj.Name);
    Log(sobj.VoiceNumber);

    switch (sobj.Index)
    {
        case ('32')
        {
            // trill
            trill = GenerateTrill(sobj);
            mlines = Self._property:MeasureLines;
            mlines.Push(trill._id);
        }

        case ('36')
        {
            // inverted mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'inv');
            mlines = Self._property:MeasureLines;
            mlines.Push(mordent._id);
        }

        case ('37')
        {
            // mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'norm');
            mlines = Self._property:MeasureLines;
            mlines.Push(mordent._id);
        }

        case ('38')
        {
            // turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'norm');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureLines;
            mlines.Push(turn._id);
        }

        case ('39')
        {
            // inverted turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'inv');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureLines;
            mlines.Push(turn._id);
        }

        case ('242')
        {
            // triple staccato
            return null;
        }
    }
}  //$end

function ProcessScore () {
    //$module(ExportProcessors.mss)
    // processors are a bit like a workflow manager -- they orchestrate the
    // generators, which in turn use the converters to convert specific values from sibelius
    // to MEI.
    score = Self._property:ActiveScore;

    mei = libmei.Mei();
    libmei.setDocumentRoot(mei);

    libmei.AddAttribute(mei, 'xmlns:xlink', 'http://www.w3.org/1999/xlink');
    libmei.AddAttribute(mei, 'xmlns', 'http://www.music-encoding.org/ns/mei');
    libmei.AddAttribute(mei, 'meiversion', '2013');

    header = sibmei2.GenerateMEIHeader();
    libmei.AddChild(mei, header);

    music = sibmei2.GenerateMEIMusic();
    libmei.AddChild(mei, music);

}  //$end

function ProcessBeam (bobj, layer) {
    //$module(ExportProcessors.mss)
    next_obj = bobj.NextItem(bobj.VoiceNumber, 'NoteRest');
    ret = null;

    if (bobj.Duration < 256)
    {
        // if this object is an eighth note but is not beamed, and if the
        // active beam is set, null out the active beam and return null.
        if (bobj.Beam = NoBeam and layer._property:ActiveBeamId != null)
        {
            layer._property:ActiveBeamId = null;
            return ret;
        }

        /*
            It's possible that Sibelius records a 'continue beam' at the start
            of a beamed group. Visually, this doesn't look out of place if the previous
            note was a quarter note or higher.

            The first check we do is if the note has a 'continue beam' attribute and
            the previous note has a duration higher than 256 (quarter) then we probably have
            a false negative (i.e., there is the start of a beam, but it isn't necessarily
            encoded correctly).
        */
        falseNegative = False;

        if (bobj.Beam = ContinueBeam and layer._property:ActiveBeamId = null)
        {
            // by all accounts this should be a beamed note, but we'll need to double-check.
            prev_obj = bobj.PreviousItem(bobj.VoiceNumber, 'NoteRest');

            if (prev_obj != null and (prev_obj.Duration >= 256))
            {
                falseNegative = True;
            }
        }

        if (next_obj != null and (bobj.Beam = StartBeam or falseNegative = True) and next_obj.Beam = ContinueBeam)
        {
            // if:
            //  - we're not at the end of the bar
            //  - we have a start beam
            //  - the next note is a continue beam
            beam = libmei.Beam();
            layer._property:ActiveBeamId = beam._id;

            // return the beam so that we can add it to the tree.
            ret = beam;
        }

        if (layer._property:ActiveBeamId != null and bobj.Beam = ContinueBeam)
        {
            // add the note to the beam, but return null
            // so that we don't add it again to the tree.
            beamid = layer._property:ActiveBeamId;
            beam = libmei.getElementById(beamid);

            ret = beam;
        }
    }
    else
    {
        if (layer._property:ActiveBeamId != null)
        {
            // this is a break in any active beam, so register it as such.
            layer._property:ActiveBeamId = null;
        }
    }

    return ret;
}  //$end

function ProcessTuplet (bobj, meielement, layer) {
    //$module(ExportProcessors.mss)
    if (bobj.ParentTupletIfAny = null)
    {
        return null;
    }

    if (layer._property:ActiveTupletId = null)
    {
        tupletObject = bobj.ParentTupletIfAny;

        tuplet = libmei.Tuplet();

        layer._property:ActiveTupletObject = tupletObject;
        layer._property:ActiveTupletId = tuplet._id;

        if (libmei.GetName(meielement) = 'beam')
        {
            // get the first child
            startid = meielement.children[0];
        }
        else
        {
            startid = meielement._id;
        }

        libmei.AddAttribute(tuplet, 'startid', '#' & startid);
        libmei.AddAttribute(tuplet, 'num', tupletObject.Left);
        libmei.AddAttribute(tuplet, 'numbase', tupletObject.Right);

        tupletStyle = tupletObject.Style;

        switch (tupletStyle)
        {
            case(TupletNoNumber)
            {
                libmei.AddAttribute(tuplet, 'dur.visible', 'false');
            }
            case(TupletLeft)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'count');
            }
            case(TupletLeftRight)
            {
                libmei.AddAttribute(tuplet, 'num.format', 'ratio');
            }
        }

        tupletBracket = tupletObject.Bracket;

        switch(tupletBracket)
        {
            case(TupletBracketOff)
            {
                libmei.AddAttribute(tuplet, 'bracket.visible', 'false');
            }
        }

        return tuplet;

        // used for tuplet spans...
        // mlines = Self._property:MeasureLines;
        // mlines.Push(tuplet._id);
    }
    else
    {
        tid = layer._property:ActiveTupletId;
        t = libmei.getElementById(tid);

        if (IsLastNoteInTuplet(bobj))
        {
            libmei.AddAttribute(t, 'endid', '#' & meielement._id);
            layer._property:ActiveTupletObject = null;
            layer._property:ActiveTupletId = null;
        }

        return t;
    }
}  //$end

function ProcessLyric (lyricobj, objectPositions) {
    //$module(ExportProcessors.mss)
    /*
        We need to track initial, medial, and terminal lyrics. Sibelius
        only allows us to know the medial and terminal, so we store all the
        syllables in an array until we reach the end of the word, and then
        attach them to the notes.
    */
    styleparts = MSplitString(lyricobj.StyleId, '.');
    verse_id = styleparts[5];
    verse_id_arr = MSplitString(verse_id, false);
    verse_num = verse_id_arr[5];
    bar_num = lyricobj.ParentBar.BarNumber;
    staff_num = lyricobj.ParentBar.ParentStaff.StaffNum;
    voicenum = lyricobj.VoiceNumber;

    if (voicenum = 0)
    {
        // assign it to the first voice, since we don't have any notes in voice 0.
        voicenum = 1;
        warnings = Self._property:warnings;
        warnings.Push(utils.Format(_ObjectAssignedToAllVoicesWarning, bar_num, voicenum, 'Lyric object'));
    }

    lyricwords = Self._property:LyricWords;

    if (lyricwords.PropertyExists(staff_num) = False)
    {
        lyricwords[staff_num] = CreateDictionary();
    }

    lyricstaff = lyricwords[staff_num];

    if (lyricstaff.PropertyExists(voicenum) = False)
    {
        lyricstaff[voicenum] = CreateDictionary();
    }

    lyricvoice = lyricstaff[voicenum];

    if (lyricvoice.PropertyExists(verse_num) = False)
    {
        lyricvoice[verse_num] = CreateSparseArray();
    }

    if (lyricobj.SyllableType = MiddleOfWord)
    {
        lyricvoice[verse_num].Push(lyricobj);
        // we haven't reached the end of the word yet, so just return
        // and keep going.
        return null;
    }

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // anything past here is in the EndOfWord condition.
    // this should return a sparse array containing the syllables of the word.
    lyricvoice[verse_num].Push(lyricobj);
    lyric_word = lyricvoice[verse_num];
    objects = objectPositions[voicenum];

    obj_id = null;
    obj = null;

    for j = 0 to lyric_word.Length
    {
        syl = lyric_word[j];

        verse = libmei.Verse();
        libmei.AddAttribute(verse, 'n', verse_num);
        sylel = libmei.Syl();
        libmei.SetText(sylel, syl.Text);
        libmei.AddChild(verse, sylel);

        if (j = 0)
        {
            libmei.AddAttribute(sylel, 'wordpos', 'i'); // 'initial'
        }
        else
        {
            if (syl.SyllableType = EndOfWord)
            {
                libmei.AddAttribute(sylel, 'wordpos', 't'); // 'terminal'

                if (syl.NumNotes > 1)
                {
                    libmei.AddAttribute(sylel, 'con', 'u'); // 'underscore'
                }

            }
            else
            {
                libmei.AddAttribute(sylel, 'wordpos', 'm'); // medial
            }
        }

        obj = GetNoteObjectAtPosition(syl);

        if (obj != null)
        {
            name = libmei.GetName(obj);

            if (name = 'rest')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'rest'));
            }

            if (name = 'chord')
            {
                warnings = Self._property:warnings;
                warnings.Push(utils.Format(_ObjectIsOnAnIllogicalObject, bar_num, voicenum, 'Lyric', 'chord'));
            }

            libmei.AddChild(obj, verse);
        }
    }

    // now reset the syllable array for this voice
    lyricvoice[verse_num] = CreateSparseArray();
}  //$end

function ProcessSystemStaff (score) {
    //$module(ExportProcessors.mss)
    systf = score.SystemStaff;

    for each bar in systf
    {
        for each bobj in bar
        {
            switch (bobj.Type)
            {
                case ('SpecialBarline')
                {
                    spclbarlines = Self._property:SpecialBarlines;
                    spclbarlines[bar.BarNumber] = ConvertBarline(bobj.BarlineInternalType);
                }
                case ('SystemText')
                {
                    systemtext = Self._property:SystemText;

                    if (systemtext.PropertyExists(bar.BarNumber) = False)
                    {
                        systemtext[bar.BarNumber] = CreateSparseArray();
                    }

                    systemtext[bar.BarNumber].Push(bobj);
                }
                case ('RepeatTimeLine')
                {
                    RegisterVolta(bobj);
                }
            }
        }
    }
}  //$end

function RegisterVolta (bobj) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;
    style = MSplitString(bobj.StyleId, '.');

    if (style[2] = 'repeat')
    {
        voltabars[bobj.ParentBar.BarNumber] = bobj;
    }
}  //$end

function ProcessVolta (mnum) {
    //$module(ExportProcessors.mss)
    voltabars = Self._property:VoltaBars;

    if (voltabars.PropertyExists(mnum))
    {
        voltaElement = libmei.Ending();

        // swap out the section as the parent for the ending
        Self._property:VoltaElement = voltaElement;

        voltaObject = voltabars[mnum];
        voltainfo = ConvertEndingValues(voltaObject.StyleId);

        libmei.AddAttribute(voltaElement, 'n', voltainfo[0]);
        libmei.AddAttribute(voltaElement, 'label', voltainfo[1]);
        libmei.AddAttribute(voltaElement, 'type', voltainfo[2]);

        if (voltaObject.EndBarNumber != mnum)
        {
            Self._property:ActiveVolta = voltaObject;
        }

        return voltaElement;
    }
    else
    {
        if (Self._property:ActiveVolta != null)
        {
            // we have an unresolved volta, so
            // we'll keep the previous parentElement
            // active.
            activeVolta = Self._property:ActiveVolta;
            voltaElement = Self._property:VoltaElement;

            // if the end bar is the current bar OR if the end
            // bar is the next bar, but the end position is 0, we're escaping the
            // volta the next time around.
            if ((activeVolta.EndBarNumber = mnum) or
                (activeVolta.EndBarNumber = (mnum + 1) and activeVolta.EndPosition = 0))
            {
                Self._property:ActiveVolta = null;
                Self._property:VoltaElement = null;
            }
            return null;
        }
    }

    return null;
}  //$end

function ProcessSymbol (sobj, objectPositions) {
    //$module(ExportProcessors.mss)
    Log('symbol index: ' & sobj.Index & ' name: ' & sobj.Name);
    Log(sobj.VoiceNumber);

    switch (sobj.Index)
    {
        case ('32')
        {
            // trill
            trill = GenerateTrill(sobj);
            mlines = Self._property:MeasureLines;
            mlines.Push(trill._id);
        }

        case ('36')
        {
            // inverted mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'inv');
            mlines = Self._property:MeasureLines;
            mlines.Push(mordent._id);
        }

        case ('37')
        {
            // mordent
            mordent = libmei.Mordent();
            libmei.AddAttribute(mordent, 'form', 'norm');
            mlines = Self._property:MeasureLines;
            mlines.Push(mordent._id);
        }

        case ('38')
        {
            // turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'norm');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureLines;
            mlines.Push(turn._id);
        }

        case ('39')
        {
            // inverted turn
            turn = libmei.Turn();
            libmei.AddAttribute(turn, 'form', 'inv');
            turn = AddBarObjectInfoToElement(sobj, turn);
            mlines = Self._property:MeasureLines;
            mlines.Push(turn._id);
        }

        case ('242')
        {
            // triple staccato
            return null;
        }
    }
}  //$end


Updated colors in tilemill project.

Updated colors in tilemill project.

#invasive[COM_NAME = "Thistle, Canada"][zoom > 0] { marker-fill: #CCB3C4 }
#invasive[COMMON_NAM = "Thistle, Canada"][zoom > 0] { marker-fill: #CCB3C4 }

#invasive[COM_NAME = "Queen Ann\'s Lace"][zoom > 0] { marker-fill: #EEEDDB }
#invasive[COMMON_NAM = "Queen Ann\'s Lace"][zoom > 0] { marker-fill: #EEEDDB }

#invasive[COM_NAME = "Common carp"][zoom > 0] { marker-fill: #876C38 }
#invasive[COMMON_NAM = "Common carp"][zoom > 0] { marker-fill: #876C38 }

#invasive[COM_NAME = "Thistle, Plumeless"][zoom > 0] { marker-fill: #B27B8A }
#invasive[COMMON_NAM = "Thistle, Plumeless"][zoom > 0] { marker-fill: #B27B8A }

#invasive[COM_NAME = "Olive, Russian"][zoom > 0] { marker-fill: #ADAD5C }
#invasive[COMMON_NAM = "Olive, Russian"][zoom > 0] { marker-fill: #ADAD5C }

#invasive[COM_NAME = "Locust, Black"][zoom > 0] { marker-fill: #EBEDE3 }
#invasive[COMMON_NAM = "Locust, Black"][zoom > 0] { marker-fill: #EBEDE3 }

#invasive[COM_NAME = "Knotweed, Giant"][zoom > 0] { marker-fill: #78C516 }
#invasive[COMMON_NAM = "Knotweed, Giant"][zoom > 0] { marker-fill: #78C516 }

#invasive[COM_NAME = "Largemouth Bass Virus (LMBV)"][zoom > 0] { marker-fill: #38604B }
#invasive[COMMON_NAM = "Largemouth Bass Virus (LMBV)"][zoom > 0] { marker-fill: #38604B }

#invasive[COM_NAME = "Sweetclover, White"][zoom > 0] { marker-fill: #A2981B }
#invasive[COMMON_NAM = "Sweetclover, White"][zoom > 0] { marker-fill: #A2981B }

#invasive[COM_NAME = "Alyssum, Hoary"][zoom > 0] { marker-fill: #E6E9ED }
#invasive[COMMON_NAM = "Alyssum, Hoary"][zoom > 0] { marker-fill: #E6E9ED }

#invasive[COM_NAME = "Knapweed, Spotted"][zoom > 0] { marker-fill: #CF63CB }
#invasive[COMMON_NAM = "Knapweed, Spotted"][zoom > 0] { marker-fill: #CF63CB }

#invasive[COM_NAME = "Thistle spp."][zoom > 0] { marker-fill: #C54DA1 }
#invasive[COMMON_NAM = "Thistle spp."][zoom > 0] { marker-fill: #C54DA1 }

#invasive[COM_NAME = "Butter and Eggs"][zoom > 0] { marker-fill: #B6AD4A }
#invasive[COMMON_NAM = "Butter and Eggs"][zoom > 0] { marker-fill: #B6AD4A }

#invasive[COM_NAME = "Chinese and Banded Mystery Snails"][zoom > 0] { marker-fill: #D2B04D }
#invasive[COMMON_NAM = "Chinese and Banded Mystery Snails"][zoom > 0] { marker-fill: #D2B04D }

#invasive[COM_NAME = "St. John\'s-Wort, Common"][zoom > 0] { marker-fill: #499F07 }
#invasive[COMMON_NAM = "St. John\'s-Wort, Common"][zoom > 0] { marker-fill: #499F07 }

#invasive[COM_NAME = "Vetch, Crown"][zoom > 0] { marker-fill: #A05BCF }
#invasive[COMMON_NAM = "Vetch, Crown"][zoom > 0] { marker-fill: #A05BCF }

#invasive[COM_NAME = "alewife"][zoom > 0] { marker-fill: #748ACE }
#invasive[COMMON_NAM = "alewife"][zoom > 0] { marker-fill: #748ACE }

#invasive[COM_NAME = "Creeping Charlie"][zoom > 0] { marker-fill: #AD95A9 }
#invasive[COMMON_NAM = "Creeping Charlie"][zoom > 0] { marker-fill: #AD95A9 }

#invasive[COM_NAME = "Parsnip, Wild"][zoom > 0] { marker-fill: #D79F28 }
#invasive[COMMON_NAM = "Parsnip, Wild"][zoom > 0] { marker-fill: #D79F28 }

#invasive[COM_NAME = "Burdock"][zoom > 0] { marker-fill: #8F6880 }
#invasive[COMMON_NAM = "Burdock"][zoom > 0] { marker-fill: #8F6880 }

#invasive[COM_NAME = "Bittercress, Narrowleaf"][zoom > 0] { marker-fill: #8A9E2C }
#invasive[COMMON_NAM = "Bittercress, Narrowleaf"][zoom > 0] { marker-fill: #8A9E2C }

#invasive[COM_NAME = "Maple, Amur"][zoom > 0] { marker-fill: #586F4C }
#invasive[COMMON_NAM = "Maple, Amur"][zoom > 0] { marker-fill: #586F4C }

#invasive[COM_NAME = "grass carp"][zoom > 0] { marker-fill: #528B96 }
#invasive[COMMON_NAM = "grass carp"][zoom > 0] { marker-fill: #528B96 }

#invasive[COM_NAME = "Leafy Spurge"][zoom > 0] { marker-fill: #B2BD42 }
#invasive[COMMON_NAM = "Leafy Spurge"][zoom > 0] { marker-fill: #B2BD42 }

#invasive[COM_NAME = "Olive, Autumn"][zoom > 0] { marker-fill: #59A23E }
#invasive[COMMON_NAM = "Olive, Autumn"][zoom > 0] { marker-fill: #59A23E }

#invasive[COM_NAME = "zebra mussel"][zoom > 0] { marker-fill: #906533 }
#invasive[COMMON_NAM = "zebra mussel"][zoom > 0] { marker-fill: #906533 }

#invasive[COM_NAME = "Gypsy moth"][zoom > 0] { marker-fill: #A39467 }
#invasive[COMMON_NAM = "Gypsy moth"][zoom > 0] { marker-fill: #A39467 }

#invasive[COM_NAME = "Sweetclover, Yellow"][zoom > 0] { marker-fill: #A2981B }
#invasive[COMMON_NAM = "Sweetclover, Yellow"][zoom > 0] { marker-fill: #A2981B }

#invasive[COM_NAME = "bighead carp"][zoom > 0] { marker-fill: #874837 }
#invasive[COMMON_NAM = "bighead carp"][zoom > 0] { marker-fill: #874837 }

#invasive[COM_NAME = "Siberian Elm"][zoom > 0] { marker-fill: #6B9153 }
#invasive[COMMON_NAM = "Siberian Elm"][zoom > 0] { marker-fill: #6B9153 }

#invasive[COM_NAME = "Earthworms"][zoom > 0] { marker-fill: #8A6F64 }
#invasive[COMMON_NAM = "Earthworms"][zoom > 0] { marker-fill: #8A6F64 }

#invasive[COM_NAME = "Brazilian elodea"][zoom > 0] { marker-fill: #708A12 }
#invasive[COMMON_NAM = "Brazilian elodea"][zoom > 0] { marker-fill: #708A12 }

#invasive[COM_NAME = "Mute swan"][zoom > 0] { marker-fill: #D9DDCC }
#invasive[COMMON_NAM = "Mute swan"][zoom > 0] { marker-fill: #D9DDCC }

#invasive[COM_NAME = "Brittle naiad"][zoom > 0] { marker-fill: #4C5033 }
#invasive[COMMON_NAM = "Brittle naiad"][zoom > 0] { marker-fill: #4C5033 }

#invasive[COM_NAME = "Hogweed, Giant"][zoom > 0] { marker-fill: #91B13D }
#invasive[COMMON_NAM = "Hogweed, Giant"][zoom > 0] { marker-fill: #91B13D }

#invasive[COM_NAME = "sea lamprey"][zoom > 0] { marker-fill: #76874E }
#invasive[COMMON_NAM = "sea lamprey"][zoom > 0] { marker-fill: #76874E }

#invasive[COM_NAME = "curly-leaf pondweed"][zoom > 0] { marker-fill: #9C906E }
#invasive[COMMON_NAM = "curly-leaf pondweed"][zoom > 0] { marker-fill: #9C906E }

#invasive[COM_NAME = "Rose, Multi-Flora"][zoom > 0] { marker-fill: #E0DFE6 }
#invasive[COMMON_NAM = "Rose, Multi-Flora"][zoom > 0] { marker-fill: #E0DFE6 }

#invasive[COM_NAME = "flowering rush"][zoom > 0] { marker-fill: #DE7687 }
#invasive[COMMON_NAM = "flowering rush"][zoom > 0] { marker-fill: #DE7687 }

#invasive[COM_NAME = "Thistle, Musk/Nodding"][zoom > 0] { marker-fill: #A8619B }
#invasive[COMMON_NAM = "Thistle, Musk/Nodding"][zoom > 0] { marker-fill: #A8619B }

#invasive[COM_NAME = "Bittersweet, Asian"][zoom > 0] { marker-fill: #984A22 }
#invasive[COMMON_NAM = "Bittersweet, Asian"][zoom > 0] { marker-fill: #984A22 }

#invasive[COM_NAME = "Mullein, Common"][zoom > 0] { marker-fill: #C7CA44 }
#invasive[COMMON_NAM = "Mullein, Common"][zoom > 0] { marker-fill: #C7CA44 }

#invasive[COM_NAME = "purple loosestrife"][zoom > 0] { marker-fill: #9E24A0 }
#invasive[COMMON_NAM = "purple loosestrife"][zoom > 0] { marker-fill: #9E24A0 }

#invasive[COM_NAME = "Reed Canary Grass"][zoom > 0] { marker-fill: #B7CF6A }
#invasive[COMMON_NAM = "Reed Canary Grass"][zoom > 0] { marker-fill: #B7CF6A }

#invasive[COM_NAME = "New Zealand Mud Snail"][zoom > 0] { marker-fill: #F48F34 }
#invasive[COMMON_NAM = "New Zealand Mud Snail"][zoom > 0] { marker-fill: #F48F34 }

#invasive[COM_NAME = "Teasel, Cut-Leaved"][zoom > 0] { marker-fill: #8A3609 }
#invasive[COMMON_NAM = "Teasel, Cut-Leaved"][zoom > 0] { marker-fill: #8A3609 }

#invasive[COM_NAME = "Knapweed, Diffuse"][zoom > 0] { marker-fill: #7A8456 }
#invasive[COMMON_NAM = "Knapweed, Diffuse"][zoom > 0] { marker-fill: #7A8456 }

#invasive[COM_NAME = "Non-native waterlilies"][zoom > 0] { marker-fill: #AC63B7 }
#invasive[COMMON_NAM = "Non-native waterlilies"][zoom > 0] { marker-fill: #AC63B7 }

#invasive[COM_NAME = "Siberian Pea Shrub"][zoom > 0] { marker-fill: #788535 }
#invasive[COMMON_NAM = "Siberian Pea Shrub"][zoom > 0] { marker-fill: #788535 }

#invasive[COM_NAME = "Elm, Siberian"][zoom > 0] { marker-fill: #6B9153 }
#invasive[COMMON_NAM = "Elm, Siberian"][zoom > 0] { marker-fill: #6B9153 }

#invasive[COM_NAME = "Grass, Cheat"][zoom > 0] { marker-fill: #659219 }
#invasive[COMMON_NAM = "Grass, Cheat"][zoom > 0] { marker-fill: #659219 }

#invasive[COM_NAME = "Rusty crayfish"][zoom > 0] { marker-fill: #936D45 }
#invasive[COMMON_NAM = "Rusty crayfish"][zoom > 0] { marker-fill: #936D45 }

#invasive[COM_NAME = "goldfish"][zoom > 0] { marker-fill: #E7500E }
#invasive[COMMON_NAM = "goldfish"][zoom > 0] { marker-fill: #E7500E }

#invasive[COM_NAME = "European Starling"][zoom > 0] { marker-fill: #887666 }
#invasive[COMMON_NAM = "European Starling"][zoom > 0] { marker-fill: #887666 }

#invasive[COM_NAME = "Garlic Mustard"][zoom > 0] { marker-fill: #9DB64D }
#invasive[COMMON_NAM = "Garlic Mustard"][zoom > 0] { marker-fill: #9DB64D }

#invasive[COM_NAME = "Purple Loosestrife"][zoom > 0] { marker-fill: #9E24A0 }
#invasive[COMMON_NAM = "Purple Loosestrife"][zoom > 0] { marker-fill: #9E24A0 }

#invasive[COM_NAME = "Eurasian watermilfoil"][zoom > 0] { marker-fill: #739150 }
#invasive[COMMON_NAM = "Eurasian watermilfoil"][zoom > 0] { marker-fill: #739150 }

#invasive[COM_NAME = "Trefoil, Birdsfoot"][zoom > 0] { marker-fill: #C3BF35 }
#invasive[COMMON_NAM = "Trefoil, Birdsfoot"][zoom > 0] { marker-fill: #C3BF35 }

#invasive[COM_NAME = "Maple, Norway"][zoom > 0] { marker-fill: #579323 }
#invasive[COMMON_NAM = "Maple, Norway"][zoom > 0] { marker-fill: #579323 }

#invasive[COM_NAME = "Daisy, Oxeye"][zoom > 0] { marker-fill: #CDA21A }
#invasive[COMMON_NAM = "Daisy, Oxeye"][zoom > 0] { marker-fill: #CDA21A }

#invasive[COM_NAME = "threespine stickleback"][zoom > 0] { marker-fill: #AD6116 }
#invasive[COMMON_NAM = "threespine stickleback"][zoom > 0] { marker-fill: #AD6116 }

#invasive[COM_NAME = "white perch"][zoom > 0] { marker-fill: #C6B9A0 }
#invasive[COMMON_NAM = "white perch"][zoom > 0] { marker-fill: #C6B9A0 }

#invasive[COM_NAME = "Vetch"][zoom > 0] { marker-fill: #4B9636 }
#invasive[COMMON_NAM = "Vetch"][zoom > 0] { marker-fill: #4B9636 }

#invasive[COM_NAME = "Thistle, Sow"][zoom > 0] { marker-fill: #F2E30F }
#invasive[COMMON_NAM = "Thistle, Sow"][zoom > 0] { marker-fill: #F2E30F }

#invasive[COM_NAME = "Russian Olive"][zoom > 0] { marker-fill: #ADAD5C }
#invasive[COMMON_NAM = "Russian Olive"][zoom > 0] { marker-fill: #ADAD5C }

#invasive[COM_NAME = "Vetch, Cow"][zoom > 0] { marker-fill: #A05BCF }
#invasive[COMMON_NAM = "Vetch, Cow"][zoom > 0] { marker-fill: #A05BCF }

#invasive[COM_NAME = "Iris, Yellow"][zoom > 0] { marker-fill: #EACE16 }
#invasive[COMMON_NAM = "Iris, Yellow"][zoom > 0] { marker-fill: #EACE16 }

#invasive[COM_NAME = "Grass, Amur silver"][zoom > 0] { marker-fill: #8BCD37 }
#invasive[COMMON_NAM = "Grass, Amur silver"][zoom > 0] { marker-fill: #8BCD37 }

#invasive[COM_NAME = "Loosestrife, Purple"][zoom > 0] { marker-fill: #9E24A0 }
#invasive[COMMON_NAM = "Loosestrife, Purple"][zoom > 0] { marker-fill: #9E24A0 }

#invasive[COM_NAME = "Grass, Smooth brome"][zoom > 0] { marker-fill: #7A8552 }
#invasive[COMMON_NAM = "Grass, Smooth brome"][zoom > 0] { marker-fill: #7A8552 }

#invasive[COM_NAME = "Tansy, Common"][zoom > 0] { marker-fill: #F3EC22 }
#invasive[COMMON_NAM = "Tansy, Common"][zoom > 0] { marker-fill: #F3EC22 }

#invasive[COM_NAME = "Heterosporis"][zoom > 0] { marker-fill: #A45732 }
#invasive[COMMON_NAM = "Heterosporis"][zoom > 0] { marker-fill: #A45732 }

#invasive[COM_NAME = "Spurge, Cypress"][zoom > 0] { marker-fill: #E0E62B }
#invasive[COMMON_NAM = "Spurge, Cypress"][zoom > 0] { marker-fill: #E0E62B }

#invasive[COM_NAME = "Knotweed, Japanese"][zoom > 0] { marker-fill: #6C9D54 }
#invasive[COMMON_NAM = "Knotweed, Japanese"][zoom > 0] { marker-fill: #6C9D54 }

#invasive[COM_NAME = "spiny waterflea"][zoom > 0] { marker-fill: #55A897 }
#invasive[COMMON_NAM = "spiny waterflea"][zoom > 0] { marker-fill: #55A897 }

#invasive[COM_NAME = "Barberry, Japanese"][zoom > 0] { marker-fill: #B34134 }
#invasive[COMMON_NAM = "Barberry, Japanese"][zoom > 0] { marker-fill: #B34134 }

#invasive[COM_NAME = "Vetch, Hairy"][zoom > 0] { marker-fill: #A05BCF }
#invasive[COMMON_NAM = "Vetch, Hairy"][zoom > 0] { marker-fill: #A05BCF }

#invasive[COM_NAME = "Spurge, Leafy"][zoom > 0] { marker-fill: #B2BD42 }
#invasive[COMMON_NAM = "Spurge, Leafy"][zoom > 0] { marker-fill: #B2BD42 }

#invasive[COM_NAME = "Poison ivy"][zoom > 0] { marker-fill: #5E9D23 }
#invasive[COMMON_NAM = "Poison ivy"][zoom > 0] { marker-fill: #5E9D23 }

#invasive[COM_NAME = "Phragmites (Haplotype M)"][zoom > 0] { marker-fill: #8D654B }
#invasive[COMMON_NAM = "Phragmites (Haplotype M)"][zoom > 0] { marker-fill: #8D654B }

#invasive[COM_NAME = "Elecampane, British"][zoom > 0] { marker-fill: #9D9D1F }
#invasive[COMMON_NAM = "Elecampane, British"][zoom > 0] { marker-fill: #9D9D1F }

#invasive[COM_NAME = "Grass, Kentucky bluegrass"][zoom > 0] { marker-fill: #70884F }
#invasive[COMMON_NAM = "Grass, Kentucky bluegrass"][zoom > 0] { marker-fill: #70884F }

#invasive[COM_NAME = "Peashrub, Siberian"][zoom > 0] { marker-fill: #788535 }
#invasive[COMMON_NAM = "Peashrub, Siberian"][zoom > 0] { marker-fill: #788535 }

#invasive[COM_NAME = "round goby"][zoom > 0] { marker-fill: #7C8394 }
#invasive[COMMON_NAM = "round goby"][zoom > 0] { marker-fill: #7C8394 }

#invasive[COM_NAME = "False spiraea"][zoom > 0] { marker-fill: #739988 }
#invasive[COMMON_NAM = "False spiraea"][zoom > 0] { marker-fill: #739988 }

#invasive[COM_NAME = "Dame\'s rocket"][zoom > 0] { marker-fill: #9E5EBB }
#invasive[COMMON_NAM = "Dame\'s rocket"][zoom > 0] { marker-fill: #9E5EBB }

#invasive[COM_NAME = "Buckthorn, Glossy"][zoom > 0] { marker-fill: #4E5E30 }
#invasive[COMMON_NAM = "Buckthorn, Glossy"][zoom > 0] { marker-fill: #4E5E30 }

#invasive[COM_NAME = "Foxglove, Grecian"][zoom > 0] { marker-fill: #8F685A }
#invasive[COMMON_NAM = "Foxglove, Grecian"][zoom > 0] { marker-fill: #8F685A }

#invasive[COM_NAME = "Thistle, Bull"][zoom > 0] { marker-fill: #8747AA }
#invasive[COMMON_NAM = "Thistle, Bull"][zoom > 0] { marker-fill: #8747AA }

#invasive[COM_NAME = "Honeysuckle, Exotic"][zoom > 0] { marker-fill: #DA738C }
#invasive[COMMON_NAM = "Honeysuckle, Exotic"][zoom > 0] { marker-fill: #DA738C }

#invasive[COM_NAME = "ruffe"][zoom > 0] { marker-fill: #847239 }
#invasive[COMMON_NAM = "ruffe"][zoom > 0] { marker-fill: #847239 }

#invasive[COM_NAME = "Hawkweed, Orange"][zoom > 0] { marker-fill: #D8650A }
#invasive[COMMON_NAM = "Hawkweed, Orange"][zoom > 0] { marker-fill: #D8650A }

#invasive[COM_NAME = "Japanese Barberry"][zoom > 0] { marker-fill: #B34134 }
#invasive[COMMON_NAM = "Japanese Barberry"][zoom > 0] { marker-fill: #B34134 }

#invasive[COM_NAME = "Buckthorn, Common"][zoom > 0] { marker-fill: #4E5E30 }
#invasive[COMMON_NAM = "Buckthorn, Common"][zoom > 0] { marker-fill: #4E5E30 }

#invasive[COM_NAME = "rainbow smelt"][zoom > 0] { marker-fill: #8D6136 }
#invasive[COMMON_NAM = "rainbow smelt"][zoom > 0] { marker-fill: #8D6136 }

#invasive[COM_NAME = "Grass, Reed canary"][zoom > 0] { marker-fill: #B7CF6A }
#invasive[COMMON_NAM = "Grass, Reed canary"][zoom > 0] { marker-fill: #B7CF6A }

#invasive[COM_NAME = "Black Locust"][zoom > 0] { marker-fill: #EBEDE3 }
#invasive[COMMON_NAM = "Black Locust"][zoom > 0] { marker-fill: #EBEDE3 }

#invasive[COM_NAME = "Faucet Snail"][zoom > 0] { marker-fill: #91932F }
#invasive[COMMON_NAM = "Faucet Snail"][zoom > 0] { marker-fill: #91932F }

#invasive[COM_NAME = "Absinthe wormwood"][zoom > 0] { marker-fill: #7D8F76 }
#invasive[COMMON_NAM = "Absinthe wormwood"][zoom > 0] { marker-fill: #7D8F76 }

#invasive[COM_NAME = "Emerald ash borer"][zoom > 0] { marker-fill: #378751 }
#invasive[COMMON_NAM = "Emerald ash borer"][zoom > 0] { marker-fill: #378751 }

#invasive[COM_NAME = "Tansy"][zoom > 0] { marker-fill: #F3EC22 }
#invasive[COMMON_NAM = "Tansy"][zoom > 0] { marker-fill: #F3EC22 }

#invasive[COM_NAME = "tubenose goby"][zoom > 0] { marker-fill: #94632E }
#invasive[COMMON_NAM = "tubenose goby"][zoom > 0] { marker-fill: #94632E }

#invasive[COM_NAME = "Mustard, Garlic"][zoom > 0] { marker-fill: #9DB64D }
#invasive[COMMON_NAM = "Mustard, Garlic"][zoom > 0] { marker-fill: #9DB64D }

#invasive[COM_NAME = "Thistle, Canada"][zoom > 0] { marker-fill: #9E9BA5 }
#invasive[COMMON_NAM = "Thistle, Canada"][zoom > 0] { marker-fill: #9E9BA5 }

#invasive[COM_NAME = "Queen Ann\'s Lace"][zoom > 0] { marker-fill: #9E9C6D }
#invasive[COMMON_NAM = "Queen Ann\'s Lace"][zoom > 0] { marker-fill: #9E9C6D }

#invasive[COM_NAME = "Common carp"][zoom > 0] { marker-fill: #C6AE71 }
#invasive[COMMON_NAM = "Common carp"][zoom > 0] { marker-fill: #C6AE71 }

#invasive[COM_NAME = "Thistle, Plumeless"][zoom > 0] { marker-fill: #929B66 }
#invasive[COMMON_NAM = "Thistle, Plumeless"][zoom > 0] { marker-fill: #929B66 }

#invasive[COM_NAME = "Olive, Russian"][zoom > 0] { marker-fill: #91AE9E }
#invasive[COMMON_NAM = "Olive, Russian"][zoom > 0] { marker-fill: #91AE9E }

#invasive[COM_NAME = "Locust, Black"][zoom > 0] { marker-fill: #9BBB6D }
#invasive[COMMON_NAM = "Locust, Black"][zoom > 0] { marker-fill: #9BBB6D }

#invasive[COM_NAME = "Knotweed, Giant"][zoom > 0] { marker-fill: #98C245 }
#invasive[COMMON_NAM = "Knotweed, Giant"][zoom > 0] { marker-fill: #98C245 }

#invasive[COM_NAME = "Largemouth Bass Virus (LMBV)"][zoom > 0] { marker-fill: #738536 }
#invasive[COMMON_NAM = "Largemouth Bass Virus (LMBV)"][zoom > 0] { marker-fill: #738536 }

#invasive[COM_NAME = "Sweetclover, White"][zoom > 0] { marker-fill: #DAD5A5 }
#invasive[COMMON_NAM = "Sweetclover, White"][zoom > 0] { marker-fill: #DAD5A5 }

#invasive[COM_NAME = "Alyssum, Hoary"][zoom > 0] { marker-fill: #9FA4A4 }
#invasive[COMMON_NAM = "Alyssum, Hoary"][zoom > 0] { marker-fill: #9FA4A4 }

#invasive[COM_NAME = "Knapweed, Spotted"][zoom > 0] { marker-fill: #968D6A }
#invasive[COMMON_NAM = "Knapweed, Spotted"][zoom > 0] { marker-fill: #968D6A }

#invasive[COM_NAME = "Thistle spp."][zoom > 0] { marker-fill: #8F9C57 }
#invasive[COMMON_NAM = "Thistle spp."][zoom > 0] { marker-fill: #8F9C57 }

#invasive[COM_NAME = "Butter and Eggs"][zoom > 0] { marker-fill: #8A7757 }
#invasive[COMMON_NAM = "Butter and Eggs"][zoom > 0] { marker-fill: #8A7757 }

#invasive[COM_NAME = "Chinese and Banded Mystery Snails"][zoom > 0] { marker-fill: #CED2B2 }
#invasive[COMMON_NAM = "Chinese and Banded Mystery Snails"][zoom > 0] { marker-fill: #CED2B2 }

#invasive[COM_NAME = "St. John\'s-Wort, Common"][zoom > 0] { marker-fill: #CFAC0C }
#invasive[COMMON_NAM = "St. John\'s-Wort, Common"][zoom > 0] { marker-fill: #CFAC0C }

#invasive[COM_NAME = "Vetch, Crown"][zoom > 0] { marker-fill: #9A8C68 }
#invasive[COMMON_NAM = "Vetch, Crown"][zoom > 0] { marker-fill: #9A8C68 }

#invasive[COM_NAME = "alewife"][zoom > 0] { marker-fill: #979FA2 }
#invasive[COMMON_NAM = "alewife"][zoom > 0] { marker-fill: #979FA2 }

#invasive[COM_NAME = "Creeping Charlie"][zoom > 0] { marker-fill: #9EC945 }
#invasive[COMMON_NAM = "Creeping Charlie"][zoom > 0] { marker-fill: #9EC945 }

#invasive[COM_NAME = "Parsnip, Wild"][zoom > 0] { marker-fill: #D79F28 }
#invasive[COMMON_NAM = "Parsnip, Wild"][zoom > 0] { marker-fill: #D79F28 }

#invasive[COM_NAME = "Burdock"][zoom > 0] { marker-fill: #8F6881 }
#invasive[COMMON_NAM = "Burdock"][zoom > 0] { marker-fill: #8F6881 }

#invasive[COM_NAME = "Bittercress, Narrowleaf"][zoom > 0] { marker-fill: #8A9F2C }
#invasive[COMMON_NAM = "Bittercress, Narrowleaf"][zoom > 0] { marker-fill: #8A9F2C }

#invasive[COM_NAME = "Maple, Amur"][zoom > 0] { marker-fill: #8CAB6F }
#invasive[COMMON_NAM = "Maple, Amur"][zoom > 0] { marker-fill: #8CAB6F }

#invasive[COM_NAME = "grass carp"][zoom > 0] { marker-fill: #6B837B }
#invasive[COMMON_NAM = "grass carp"][zoom > 0] { marker-fill: #6B837B }

#invasive[COM_NAME = "Leafy Spurge"][zoom > 0] { marker-fill: #63A290 }
#invasive[COMMON_NAM = "Leafy Spurge"][zoom > 0] { marker-fill: #63A290 }

#invasive[COM_NAME = "Olive, Autumn"][zoom > 0] { marker-fill: #847961 }
#invasive[COMMON_NAM = "Olive, Autumn"][zoom > 0] { marker-fill: #847961 }

#invasive[COM_NAME = "zebra mussel"][zoom > 0] { marker-fill: #968D6F }
#invasive[COMMON_NAM = "zebra mussel"][zoom > 0] { marker-fill: #968D6F }

#invasive[COM_NAME = "Gypsy moth"][zoom > 0] { marker-fill: #A39467 }
#invasive[COMMON_NAM = "Gypsy moth"][zoom > 0] { marker-fill: #A39467 }

#invasive[COM_NAME = "Sweetclover, Yellow"][zoom > 0] { marker-fill: #A2981B }
#invasive[COMMON_NAM = "Sweetclover, Yellow"][zoom > 0] { marker-fill: #A2981B }

#invasive[COM_NAME = "bighead carp"][zoom > 0] { marker-fill: #F7F7F7 }
#invasive[COMMON_NAM = "bighead carp"][zoom > 0] { marker-fill: #F7F7F7 }

#invasive[COM_NAME = "Siberian Elm"][zoom > 0] { marker-fill: #8EA36B }
#invasive[COMMON_NAM = "Siberian Elm"][zoom > 0] { marker-fill: #8EA36B }

#invasive[COM_NAME = "Earthworms"][zoom > 0] { marker-fill: #8D7C85 }
#invasive[COMMON_NAM = "Earthworms"][zoom > 0] { marker-fill: #8D7C85 }

#invasive[COM_NAME = "Brazilian elodea"][zoom > 0] { marker-fill: #96941F }
#invasive[COMMON_NAM = "Brazilian elodea"][zoom > 0] { marker-fill: #96941F }

#invasive[COM_NAME = "Mute swan"][zoom > 0] { marker-fill: #9FA8A5 }
#invasive[COMMON_NAM = "Mute swan"][zoom > 0] { marker-fill: #9FA8A5 }

#invasive[COM_NAME = "Brittle naiad"][zoom > 0] { marker-fill: #BABBC8 }
#invasive[COMMON_NAM = "Brittle naiad"][zoom > 0] { marker-fill: #BABBC8 }

#invasive[COM_NAME = "Hogweed, Giant"][zoom > 0] { marker-fill: #8EA45F }
#invasive[COMMON_NAM = "Hogweed, Giant"][zoom > 0] { marker-fill: #8EA45F }

#invasive[COM_NAME = "sea lamprey"][zoom > 0] { marker-fill: #A5703C }
#invasive[COMMON_NAM = "sea lamprey"][zoom > 0] { marker-fill: #A5703C }

#invasive[COM_NAME = "curly-leaf pondweed"][zoom > 0] { marker-fill: #9C8F6E }
#invasive[COMMON_NAM = "curly-leaf pondweed"][zoom > 0] { marker-fill: #9C8F6E }

#invasive[COM_NAME = "Rose, Multi-Flora"][zoom > 0] { marker-fill: #A1A8A0 }
#invasive[COMMON_NAM = "Rose, Multi-Flora"][zoom > 0] { marker-fill: #A1A8A0 }

#invasive[COM_NAME = "flowering rush"][zoom > 0] { marker-fill: #91A738 }
#invasive[COMMON_NAM = "flowering rush"][zoom > 0] { marker-fill: #91A738 }

#invasive[COM_NAME = "Thistle, Musk/Nodding"][zoom > 0] { marker-fill: #8B6952 }
#invasive[COMMON_NAM = "Thistle, Musk/Nodding"][zoom > 0] { marker-fill: #8B6952 }

#invasive[COM_NAME = "Bittersweet, Asian"][zoom > 0] { marker-fill: #983224 }
#invasive[COMMON_NAM = "Bittersweet, Asian"][zoom > 0] { marker-fill: #983224 }

#invasive[COM_NAME = "Mullein, Common"][zoom > 0] { marker-fill: #A8A292 }
#invasive[COMMON_NAM = "Mullein, Common"][zoom > 0] { marker-fill: #A8A292 }

#invasive[COM_NAME = "purple loosestrife"][zoom > 0] { marker-fill: #9AA694 }
#invasive[COMMON_NAM = "purple loosestrife"][zoom > 0] { marker-fill: #9AA694 }

#invasive[COM_NAME = "Reed Canary Grass"][zoom > 0] { marker-fill: #91A467 }
#invasive[COMMON_NAM = "Reed Canary Grass"][zoom > 0] { marker-fill: #91A467 }

#invasive[COM_NAME = "New Zealand Mud Snail"][zoom > 0] { marker-fill: #F2A156 }
#invasive[COMMON_NAM = "New Zealand Mud Snail"][zoom > 0] { marker-fill: #F2A156 }

#invasive[COM_NAME = "Teasel, Cut-Leaved"][zoom > 0] { marker-fill: #929B6B }
#invasive[COMMON_NAM = "Teasel, Cut-Leaved"][zoom > 0] { marker-fill: #929B6B }

#invasive[COM_NAME = "Knapweed, Diffuse"][zoom > 0] { marker-fill: #A9A98F }
#invasive[COMMON_NAM = "Knapweed, Diffuse"][zoom > 0] { marker-fill: #A9A98F }

#invasive[COM_NAME = "Non-native waterlilies"][zoom > 0] { marker-fill: #CDD06E }
#invasive[COMMON_NAM = "Non-native waterlilies"][zoom > 0] { marker-fill: #CDD06E }

#invasive[COM_NAME = "Siberian Pea Shrub"][zoom > 0] { marker-fill: #939858 }
#invasive[COMMON_NAM = "Siberian Pea Shrub"][zoom > 0] { marker-fill: #939858 }

#invasive[COM_NAME = "Elm, Siberian"][zoom > 0] { marker-fill: #728A5E }
#invasive[COMMON_NAM = "Elm, Siberian"][zoom > 0] { marker-fill: #728A5E }

#invasive[COM_NAME = "Grass, Cheat"][zoom > 0] { marker-fill: #B6BF88 }
#invasive[COMMON_NAM = "Grass, Cheat"][zoom > 0] { marker-fill: #B6BF88 }

#invasive[COM_NAME = "Rusty crayfish"][zoom > 0] { marker-fill: #A09B5B }
#invasive[COMMON_NAM = "Rusty crayfish"][zoom > 0] { marker-fill: #A09B5B }

#invasive[COM_NAME = "goldfish"][zoom > 0] { marker-fill: #C34D1F }
#invasive[COMMON_NAM = "goldfish"][zoom > 0] { marker-fill: #C34D1F }

#invasive[COM_NAME = "European Starling"][zoom > 0] { marker-fill: #8B5239 }
#invasive[COMMON_NAM = "European Starling"][zoom > 0] { marker-fill: #8B5239 }

#invasive[COM_NAME = "Garlic Mustard"][zoom > 0] { marker-fill: #9DB64D }
#invasive[COMMON_NAM = "Garlic Mustard"][zoom > 0] { marker-fill: #9DB64D }

#invasive[COM_NAME = "Purple Loosestrife"][zoom > 0] { marker-fill: #91AE6E }
#invasive[COMMON_NAM = "Purple Loosestrife"][zoom > 0] { marker-fill: #91AE6E }

#invasive[COM_NAME = "Eurasian watermilfoil"][zoom > 0] { marker-fill: #B5CB92 }
#invasive[COMMON_NAM = "Eurasian watermilfoil"][zoom > 0] { marker-fill: #B5CB92 }

#invasive[COM_NAME = "Trefoil, Birdsfoot"][zoom > 0] { marker-fill: #A29860 }
#invasive[COMMON_NAM = "Trefoil, Birdsfoot"][zoom > 0] { marker-fill: #A29860 }

#invasive[COM_NAME = "Maple, Norway"][zoom > 0] { marker-fill: #579323 }
#invasive[COMMON_NAM = "Maple, Norway"][zoom > 0] { marker-fill: #579323 }

#invasive[COM_NAME = "Daisy, Oxeye"][zoom > 0] { marker-fill: #CDA21A }
#invasive[COMMON_NAM = "Daisy, Oxeye"][zoom > 0] { marker-fill: #CDA21A }

#invasive[COM_NAME = "threespine stickleback"][zoom > 0] { marker-fill: #73A2C3 }
#invasive[COMMON_NAM = "threespine stickleback"][zoom > 0] { marker-fill: #73A2C3 }

#invasive[COM_NAME = "white perch"][zoom > 0] { marker-fill: #C6B9A0 }
#invasive[COMMON_NAM = "white perch"][zoom > 0] { marker-fill: #C6B9A0 }

#invasive[COM_NAME = "Vetch"][zoom > 0] { marker-fill: #87A775 }
#invasive[COMMON_NAM = "Vetch"][zoom > 0] { marker-fill: #87A775 }

#invasive[COM_NAME = "Thistle, Sow"][zoom > 0] { marker-fill: #A29918 }
#invasive[COMMON_NAM = "Thistle, Sow"][zoom > 0] { marker-fill: #A29918 }

#invasive[COM_NAME = "Russian Olive"][zoom > 0] { marker-fill: #827A31 }
#invasive[COMMON_NAM = "Russian Olive"][zoom > 0] { marker-fill: #827A31 }

#invasive[COM_NAME = "Vetch, Cow"][zoom > 0] { marker-fill: #93B638 }
#invasive[COMMON_NAM = "Vetch, Cow"][zoom > 0] { marker-fill: #93B638 }

#invasive[COM_NAME = "Iris, Yellow"][zoom > 0] { marker-fill: #B3B354 }
#invasive[COMMON_NAM = "Iris, Yellow"][zoom > 0] { marker-fill: #B3B354 }

#invasive[COM_NAME = "Grass, Amur silver"][zoom > 0] { marker-fill: #95BA45 }
#invasive[COMMON_NAM = "Grass, Amur silver"][zoom > 0] { marker-fill: #95BA45 }

#invasive[COM_NAME = "Loosestrife, Purple"][zoom > 0] { marker-fill: #8A7E88 }
#invasive[COMMON_NAM = "Loosestrife, Purple"][zoom > 0] { marker-fill: #8A7E88 }

#invasive[COM_NAME = "Grass, Smooth brome"][zoom > 0] { marker-fill: #C4A179 }
#invasive[COMMON_NAM = "Grass, Smooth brome"][zoom > 0] { marker-fill: #C4A179 }

#invasive[COM_NAME = "Tansy, Common"][zoom > 0] { marker-fill: #CBB130 }
#invasive[COMMON_NAM = "Tansy, Common"][zoom > 0] { marker-fill: #CBB130 }

#invasive[COM_NAME = "Heterosporis"][zoom > 0] { marker-fill: #98886E }
#invasive[COMMON_NAM = "Heterosporis"][zoom > 0] { marker-fill: #98886E }

#invasive[COM_NAME = "Spurge, Cypress"][zoom > 0] { marker-fill: #AACB47 }
#invasive[COMMON_NAM = "Spurge, Cypress"][zoom > 0] { marker-fill: #AACB47 }

#invasive[COM_NAME = "Knotweed, Japanese"][zoom > 0] { marker-fill: #ABB7BC }
#invasive[COMMON_NAM = "Knotweed, Japanese"][zoom > 0] { marker-fill: #ABB7BC }

#invasive[COM_NAME = "spiny waterflea"][zoom > 0] { marker-fill: #EAEAEA }
#invasive[COMMON_NAM = "spiny waterflea"][zoom > 0] { marker-fill: #EAEAEA }

#invasive[COM_NAME = "Barberry, Japanese"][zoom > 0] { marker-fill: #BBBFC2 }
#invasive[COMMON_NAM = "Barberry, Japanese"][zoom > 0] { marker-fill: #BBBFC2 }

#invasive[COM_NAME = "Vetch, Hairy"][zoom > 0] { marker-fill: #8CAA69 }
#invasive[COMMON_NAM = "Vetch, Hairy"][zoom > 0] { marker-fill: #8CAA69 }

#invasive[COM_NAME = "Spurge, Leafy"][zoom > 0] { marker-fill: #57926A }
#invasive[COMMON_NAM = "Spurge, Leafy"][zoom > 0] { marker-fill: #57926A }

#invasive[COM_NAME = "Poison ivy"][zoom > 0] { marker-fill: #77CA91 }
#invasive[COMMON_NAM = "Poison ivy"][zoom > 0] { marker-fill: #77CA91 }

#invasive[COM_NAME = "Phragmites (Haplotype M)"][zoom > 0] { marker-fill: #8C654C }
#invasive[COMMON_NAM = "Phragmites (Haplotype M)"][zoom > 0] { marker-fill: #8C654C }

#invasive[COM_NAME = "Elecampane, British"][zoom > 0] { marker-fill: #9D9D1F }
#invasive[COMMON_NAM = "Elecampane, British"][zoom > 0] { marker-fill: #9D9D1F }

#invasive[COM_NAME = "Grass, Kentucky bluegrass"][zoom > 0] { marker-fill: #AA7984 }
#invasive[COMMON_NAM = "Grass, Kentucky bluegrass"][zoom > 0] { marker-fill: #AA7984 }

#invasive[COM_NAME = "Peashrub, Siberian"][zoom > 0] { marker-fill: #8F9233 }
#invasive[COMMON_NAM = "Peashrub, Siberian"][zoom > 0] { marker-fill: #8F9233 }

#invasive[COM_NAME = "round goby"][zoom > 0] { marker-fill: #9F876E }
#invasive[COMMON_NAM = "round goby"][zoom > 0] { marker-fill: #9F876E }

#invasive[COM_NAME = "False spiraea"][zoom > 0] { marker-fill: #8DA772 }
#invasive[COMMON_NAM = "False spiraea"][zoom > 0] { marker-fill: #8DA772 }

#invasive[COM_NAME = "Dame\'s rocket"][zoom > 0] { marker-fill: #9E5EBB }
#invasive[COMMON_NAM = "Dame\'s rocket"][zoom > 0] { marker-fill: #9E5EBB }

#invasive[COM_NAME = "Buckthorn, Glossy"][zoom > 0] { marker-fill: #A7AD9C }
#invasive[COMMON_NAM = "Buckthorn, Glossy"][zoom > 0] { marker-fill: #A7AD9C }

#invasive[COM_NAME = "Foxglove, Grecian"][zoom > 0] { marker-fill: #95976B }
#invasive[COMMON_NAM = "Foxglove, Grecian"][zoom > 0] { marker-fill: #95976B }

#invasive[COM_NAME = "Thistle, Bull"][zoom > 0] { marker-fill: #8D6D36 }
#invasive[COMMON_NAM = "Thistle, Bull"][zoom > 0] { marker-fill: #8D6D36 }

#invasive[COM_NAME = "Honeysuckle, Exotic"][zoom > 0] { marker-fill: #ACB36E }
#invasive[COMMON_NAM = "Honeysuckle, Exotic"][zoom > 0] { marker-fill: #ACB36E }

#invasive[COM_NAME = "ruffe"][zoom > 0] { marker-fill: #8E6D56 }
#invasive[COMMON_NAM = "ruffe"][zoom > 0] { marker-fill: #8E6D56 }

#invasive[COM_NAME = "Hawkweed, Orange"][zoom > 0] { marker-fill: #AC4724 }
#invasive[COMMON_NAM = "Hawkweed, Orange"][zoom > 0] { marker-fill: #AC4724 }

#invasive[COM_NAME = "Japanese Barberry"][zoom > 0] { marker-fill: #B34134 }
#invasive[COMMON_NAM = "Japanese Barberry"][zoom > 0] { marker-fill: #B34134 }

#invasive[COM_NAME = "Buckthorn, Common"][zoom > 0] { marker-fill: #949A5E }
#invasive[COMMON_NAM = "Buckthorn, Common"][zoom > 0] { marker-fill: #949A5E }

#invasive[COM_NAME = "rainbow smelt"][zoom > 0] { marker-fill: #C89D73 }
#invasive[COMMON_NAM = "rainbow smelt"][zoom > 0] { marker-fill: #C89D73 }

#invasive[COM_NAME = "Grass, Reed canary"][zoom > 0] { marker-fill: #7E8273 }
#invasive[COMMON_NAM = "Grass, Reed canary"][zoom > 0] { marker-fill: #7E8273 }

#invasive[COM_NAME = "Black Locust"][zoom > 0] { marker-fill: #899F72 }
#invasive[COMMON_NAM = "Black Locust"][zoom > 0] { marker-fill: #899F72 }

#invasive[COM_NAME = "Faucet Snail"][zoom > 0] { marker-fill: #8D8E34 }
#invasive[COMMON_NAM = "Faucet Snail"][zoom > 0] { marker-fill: #8D8E34 }

#invasive[COM_NAME = "Absinthe wormwood"][zoom > 0] { marker-fill: #8CA269 }
#invasive[COMMON_NAM = "Absinthe wormwood"][zoom > 0] { marker-fill: #8CA269 }

#invasive[COM_NAME = "Emerald ash borer"][zoom > 0] { marker-fill: #70AA89 }
#invasive[COMMON_NAM = "Emerald ash borer"][zoom > 0] { marker-fill: #70AA89 }

#invasive[COM_NAME = "Tansy"][zoom > 0] { marker-fill: #A49418 }
#invasive[COMMON_NAM = "Tansy"][zoom > 0] { marker-fill: #A49418 }

#invasive[COM_NAME = "tubenose goby"][zoom > 0] { marker-fill: #938B6D }
#invasive[COMMON_NAM = "tubenose goby"][zoom > 0] { marker-fill: #938B6D }

#invasive[COM_NAME = "Mustard, Garlic"][zoom > 0] { marker-fill: #92A362 }
#invasive[COMMON_NAM = "Mustard, Garlic"][zoom > 0] { marker-fill: #92A362 }


Update version to 2.3.0 in GLOBALS.mss

Update version to 2.3.0 in GLOBALS.mss

Version     "2.3.0"
PluginName  "Sibelius to MEI Exporter"
Author      "Andrew Hankinson"

_InitialProgressTitle "Exporting %s to MEI"
_ExportFileIsNull "You must specify a file to save."
_ScoreError "Please open a score and try again."
_ExportSuccess "The file was exported successfully."
_ExportFailure "The file was not exported because of an error."
_VersionNotSupported "Versions earlier than Sibelius 7 are not supported."
_ExportingBars "Exporting to MEI: Bar %s of %s"

_ObjectAssignedToAllVoicesWarning "Bar %s, voice %s. %s assigned to all voices will be encoded on voice 1. If this is incorrect, you should explicitly assign this object to a voice."
_ObjectHasNoMEISupport "%s is not supported by MEI at this time."
_ObjectIsOnAnIllogicalObject "Bar %s, voice %s. %s is added to a %s object. This will create invalid MEI. You should fix this in your Sibelius file if possible, or edit your MEI file after export."
_ObjectCouldNotFindAttachment "Bar %s, voice %s. %s could not be attached to a Note object, so it will not appear in the output."

LOGFILE "sibelius.log"

Version     "2.2.0"
PluginName  "Sibelius to MEI Exporter"
Author      "Andrew Hankinson"

_InitialProgressTitle "Exporting %s to MEI"
_ExportFileIsNull "You must specify a file to save."
_ScoreError "Please open a score and try again."
_ExportSuccess "The file was exported successfully."
_ExportFailure "The file was not exported because of an error."
_VersionNotSupported "Versions earlier than Sibelius 7 are not supported."
_ExportingBars "Exporting to MEI: Bar %s of %s"

_ObjectAssignedToAllVoicesWarning "Bar %s, voice %s. %s assigned to all voices will be encoded on voice 1. If this is incorrect, you should explicitly assign this object to a voice."
_ObjectHasNoMEISupport "%s is not supported by MEI at this time."
_ObjectIsOnAnIllogicalObject "Bar %s, voice %s. %s is added to a %s object. This will create invalid MEI. You should fix this in your Sibelius file if possible, or edit your MEI file after export."
_ObjectCouldNotFindAttachment "Bar %s, voice %s. %s could not be attached to a Note object, so it will not appear in the output."

LOGFILE "sibelius.log"


style new default shield

style new default shield

@text_font_transport: 'PT Sans Narrow Regular', 'Unifont Medium';
@text_font_shield: 'PT Sans Bold', 'Unifont Medium';
@text_font_administrative: 'PT Sans Bold', 'Unifont Medium';
@text_font_city: 'PT Sans Narrow Regular', 'Unifont Medium';
@text_font_parks: 'PT Sans Narrow Regular', 'Unifont Medium';
@text_font_water: 'PT Sans Italic', 'Unifont Medium';
@text_font_water_bold: 'PT Sans Bold Italic', 'Unifont Medium';

@label_color_transport: #524c4c;
@label_color_shield: #fff;
@label_color_shield_fed: #333;
@label_color_administrative: #2e2115;
@label_color_city: #2e2115;

@text_font_size_xxsm: 12;
@text_font_size_xsm: 14;
@text_font_size_sm: 15;
@text_font_size_medium: 17;
@text_font_size_medium_plus: 18;
@text_font_size_large: 20;
@text_font_size_xlg: 24;
@text_font_size_xxlg: 34;

@text_character_spacing_sm: 0.7;
@text_character_spacing_md: 1.2;
@text_character_spacing_lg: 1.7;
@text_character_spacing_xlg: 2.2;

@text_font_halo_radius_xsm: 1;
@text_font_halo_radius_sm: 1.5;
@text_font_halo_radius_md: 1.75;
@text_font_halo_radius_large: 2;

@label_color_halo_low: fadeout(rgba(255,255,255,0.7), 30%);
@label_color_halo_high: fadeout(rgba(255,255,255,1), 30%);
@label_color_administrative_halo: fadeout(#fff, 30%);
@label_color_physical: #000;
@label_color_physical_halo: #fff;
@label_color_transport_halo: desaturate(#F7F7E6,50%);
@label_color_airport_halo: #f7f7e6;
@label_color_places_halo_low: fadeout(rgba(255,255,255, 1), 30%);
@label_color_places_halo_high: fadeout(rgba(255,255,255, 1), 30%);

@label_color_green_area: #374c30;
@label_color_green_area_halo: #c0d3b5;
@label_color_water: darken(@color_water,20);
@label_color_water_halo: @color_water;

Map {
  font-directory: url("fonts/");
  buffer-size: 128;
}

#minor_road_labels,
#major_road_labels,
{
  text-name: [name];
  text-face-name: @text_font_transport;
  text-placement: line;
  text-label-position-tolerance: 2;
  text-max-char-angle-delta: 20;
  text-min-path-length: 30;
  text-fill: #444;
  text-spacing: 256;
  text-min-distance: 5;
  text-character-spacing: @text_character_spacing_sm;
  text-avoid-edges: true;
  text-halo-fill: @label_color_transport_halo;
  text-halo-radius: @text_font_halo_radius_md;

  [kind='major_road'] {
    text-size: @text_font_size_xxsm;
  }

  [zoom>=13] {
    text-size: @text_font_size_xxsm;

    [kind='major_road'] {
      text-size: @text_font_size_xxsm * 1.2;
    }
  }

  [zoom>=14] {
    text-min-distance: 10;
    text-size: @text_font_size_sm;
    text-character-spacing: @text_character_spacing_md;
    text-halo-radius: @text_font_halo_radius_large;

    [kind='major_road'] {
      text-size: @text_font_size_sm * 1.2;
    }
  }

  [zoom>=16]{
    text-min-distance: 100;
    text-character-spacing: @text_character_spacing_lg;
  }
}

#highway_shields {
  [zoom>=11],
  [highway='motorway'],
  [highway='trunk'],
  [highway='primary'] {

    // default rectangle shield
    shield-file: url(shields/default-sheild-export.svg);
    shield-fill: @label_color_shield_fed;
    shield-transform: scale(1.1,1.1);
    shield-face-name: @text_font_shield;
    shield-name: [ref];
    shield-size: 10;
    shield-min-distance: 60;
    shield-spacing: 60;
    // half the width of the shield to prevent from wrapping
    shield-min-padding: 10;

    [zoom>=11][zoom<=12][highway='trunk'],
    [zoom>=11][zoom<=12][highway='primary'],
    [zoom>=11][zoom<=12][highway='secondary'],
    [zoom>=11][zoom<=12][highway='tertiary'] {
      shield-opacity: 0;
      shield-size: 0;
    }

    [ref=~'I \d+'] {
      shield-file: url(shields/interstate_2.svg);
      shield-transform: scale(0.033, 0.033);
      shield-fill: @label_color_shield;
      shield-size: 9;
      shield-name: "[ref].replace('I ', '')";

      [zoom>=13] {
        shield-size: 11;
        shield-transform: scale(0.038, 0.038);
        shield-min-distance: 65;
      }

      [zoom>=15] {
        shield-size: 13;
        shield-transform: scale(0.045, 0.045);
      }

      [zoom>=17] {
        shield-size: 15;
        shield-transform: scale(0.05, 0.05);
      }
    }

    [ref=~'I \d{3,}'] {
      shield-file: url(shields/interstate_3.svg);
      shield-transform: scale(0.033, 0.033);
      shield-fill: @label_color_shield;
      shield-size: 9;
      shield-name: "[ref].replace('I ', '')";

      [zoom>=13] {
        shield-size: 11;
        shield-transform: scale(0.038, 0.038);
        shield-min-distance: 65;
      }

      [zoom>=15] {
        shield-size: 13;
        shield-transform: scale(0.045, 0.045);
      }

      [zoom>=17] {
        shield-size: 13;
        shield-transform: scale(0.05, 0.05);
      }
    }

    [ref=~'US \d+'] {
      shield-file: url(shields/us.svg);
      shield-transform: scale(0.062, 0.062);
      shield-size: 10;
      shield-name: "[ref].replace('US ', '')";
      shield-fill: @label_color_shield_fed;
      shield-text-dy: 1;
      shield-character-spacing: -1;

      [zoom>=13] {
        shield-size: 12;
        shield-transform: scale(0.075, 0.075);
      }

      [zoom>=15] {
        shield-size: 14;
        shield-transform: scale(0.088, 0.088);
      }

      [zoom>=17] {
        shield-size: 16;
        shield-transform: scale(0.091, 0.091);
      }
    }

    [ref=~'CA \d+'] {
      shield-file: url(shields/ca.svg);
      shield-fill: @label_color_shield;
      shield-transform: scale(0.052, 0.052);
      shield-size: 10;
      shield-name: "[ref].replace('CA ', '')";
      shield-dy: -2.5;
      shield-character-spacing: -1;

      [zoom>=11][zoom<=12][highway='trunk'],
      [zoom>=11][zoom<=12][highway='primary'],
      [zoom>=11][zoom<=12][highway='secondary'],
      [zoom>=11][zoom<=12][highway='tertiary'] {
        shield-opacity: 0;
        shield-size: 0;
      }

      [zoom>=13] {
        shield-size: 12;
        shield-transform: scale(0.060, 0.060);
        shield-min-distance: 70;
      }

      [zoom>=14] {
        shield-min-distance: 80;
      }

      [zoom>=15] {
        shield-size: 14;
        shield-transform: scale(0.080, 0.080);
        shield-dy: -3.5;
      }

      [zoom>=17] {
        shield-size: 16;
        shield-transform: scale(0.090, 0.090);
      }
    }
  }
}

#ne_110m_geography_marine_polys[zoom=2][scalerank=0][changed!=''],
#ne_110m_geography_marine_polys[zoom=3][changed!=''],
#ne_50m_geography_marine_polys[zoom=4][scalerank<4][changed!=''] {
    text-name: [name];

    [namealt!=''] {
      text-name: [name] + '\n(' + [namealt] + ')';
    }

    text-face-name: @text_font_water_bold;
    text-wrap-width: 40;
    text-wrap-character: ' ';
    text-size: @text_font_size_sm;
    text-character-spacing: @text_character_spacing_xlg;
    text-align: center;

    text-fill: @label_color_water;
    text-halo-radius: @text_font_halo_radius_xsm;
    text-halo-fill: @label_color_water_halo;
    text-placement: interior;
}

#ne_50m_geography_marine_polys[zoom=5][scalerank<4][changed!=''],
#ne_10m_geography_marine_polys[zoom>=6][zoom<=8][scalerank<7][changed!='']
{
    text-name: [name];

    [namealt!=''] {
      text-name: [name] + '\n(' + [namealt] + ')';
    }

    [name = 'Hecate Straight'] {
      text-name: 'Hecate Strait' + [namealt]; // Becase we know namealt is empty
    }

    [name = 'Queen Charlotte Straight'] {
      text-name: 'Queen Charlotte Strait' + [namealt]; // Becase we know namealt is empty
    }

    text-face-name: @text_font_water_bold;
    text-wrap-width: 50;
    text-size: @text_font_size_medium;
    text-character-spacing: @text_character_spacing_lg;
    text-fill: @label_color_water;
    text-halo-radius: @text_font_halo_radius_xsm;
    text-halo-fill: @label_color_water_halo;
    text-placement: interior;
    text-align: center;
}

#water-bodies-labels-low,
#water-bodies-labels-med,
#water-bodies-labels-high {
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>25000000],
  [zoom=12][area>5000000],
  [zoom=13][area>2000000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
    text-name: "[name]";
    text-face-name: @text_font_water;
    text-placement: interior;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: @text_font_halo_radius_large;
    text-fill: @label_color_water;
    text-halo-fill: @label_color_water_halo;
    text-size: @text_font_size_xsm;

    [zoom>9][zoom<12] {
      text-spacing: 200;
      text-wrap-width: 50;
    }
    [zoom=12] {
      text-size: @text_font_size_xsm;
      text-spacing: 200;
      text-wrap-width: 70;
    }
    [zoom=13] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom=14] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom>=15] {
      text-size: @text_font_size_sm;
      text-spacing: 100;
      text-wrap-width: 40;
    }
  }
}

#green-areas-labels-low,
#green-areas-labels-med,
#green-areas-labels-high {
  [zoom=8][area>100000000],
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>5000000],
  [zoom=12][area>1000000],
  [zoom=13][area>400000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
    text-name: [name];
    text-face-name: @text_font_parks;
    text-placement: interior;
    text-wrap-width: 96;
    text-wrap-before: true;
    text-line-spacing: -3;
    text-fill: @label_color_green_area;
    text-size: 15;

    [zoom>=8] {
      text-halo-fill: @label_color_green_area_halo;
      text-halo-radius: @text_font_halo_radius_sm;
    }

    [zoom>=11] {
      text-fill: #586e50;
      text-halo-radius: @text_font_halo_radius_large;
    }

    [zoom>=15] {
      text-size: 20;
      text-line-spacing: -7;
    }
  }
}

#continents
{
  text-name: [name];
  text-face-name: @text_font_administrative;
  text-wrap-width: 32;
  text-size: 24;
  text-line-spacing: -12;
  text-fill: #2e2115;
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_halo_low;
}

#admin1-labels {
  // [zoom>=4][scalerank<3],
  [zoom>=5][scalerank<3][admin!='United States of America'][admin!='Canada'],
  [zoom>=6][scalerank<5],
  [zoom>=7][scalerank>=5] {
    text-name: [name];
    text-transform: uppercase;
    text-face-name: @text_font_administrative;
    text-face-name: @text_font_administrative;
    text-fill: @label_color_administrative;
    text-halo-fill: @label_color_halo_low;
    text-halo-radius: @text_font_halo_radius_sm;
    text-size: @text_font_size_sm;
    text-character-spacing: 1;
    text-wrap-width: 40;
    text-placement-type: simple;
    text-placements: 'E,N,W,S';
    text-allow-overlap: false;
    text-min-distance: 3;
    text-avoid-edges: true;
    text-min-padding: 5;

    [zoom>=5] {
     text-size: @text_font_size_sm;
    }

    [zoom>=6] {
      text-size: @text_font_size_medium;
      text-character-spacing: 2;
    }

    [zoom>=7] {
      text-size: @text_font_size_large;
      text-character-spacing: 3;
    }
  }
}

#admin1-labels-50m-z4 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-name: "[label_z4]";
    text-size:  @text_font_size_xsm;
    text-character-spacing: 1;
}

#admin1-labels-50m-z5 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    // text-halo-comp-op: overlay;
    text-halo-rasterizer: fast;
    text-name: "[label_z5]";
    text-size:  @text_font_size_sm;
    text-character-spacing: 1;
}

// #admin1-labels-50m-z6 {
//     text-face-name: @text_font_administrative;
//     text-wrap-width: 80;
//     text-fill: @label_color_administrative;
//     text-halo-radius: @text_font_halo_radius_sm;
//     text-halo-fill: @label_color_halo_low;
//     text-name: "[label_z6]";
//     text-size:  @text_font_size_medium;
//     text-character-spacing: 2;
// }

// #admin1-labels-50m-z7 {
//     text-face-name: @text_font_administrative;
//     text-wrap-width: 80;
//     text-fill: @label_color_administrative;
//     text-halo-radius: @text_font_halo_radius_sm;
//     text-halo-fill: @label_color_halo_low;
//     text-name: "[label_z7]";
//     text-size:  @text_font_size_large;
//     text-character-spacing: 3;
// }

/* Admin 0 labels */

#admin0-labels-z3[longfrom>3] {
    text-name: "[shortname]";
    text-face-name: @text_font_administrative;
    text-transform: uppercase;
    text-wrap-width: 80;
    text-character-spacing: @text_character_spacing_sm;
    text-size: @text_font_size_medium_plus;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-fill: @label_color_administrative;
    text-min-distance: 5;
}

#admin0-labels-z3[longfrom<=3] {
    text-name: "[name]";
    text-face-name: @text_font_administrative;
    text-transform: uppercase;
    text-size: @text_font_size_large;
    text-line-spacing: -8;
    text-wrap-width: 100;
    text-character-spacing: @text_character_spacing_sm;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-fill: @label_color_administrative;
}

#admin0-labels-z4 {
    text-name: [name];
    text-face-name: @text_font_administrative;
    text-transform: uppercase;
    text-wrap-width: 80;
    text-character-spacing: @text_character_spacing_lg;
    text-size: @text_font_size_large;
    [population<100] { text-size: @text_font_size_medium_plus; }
    text-min-distance: 15;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-fill: @label_color_administrative;
}

#admin0-labels-z5 {
  text-name: [name];
  text-face-name: @text_font_administrative;
  text-transform: uppercase;
  text-wrap-width: 80;
  text-character-spacing: @text_character_spacing_xlg;
  text-size: @text_font_size_xlg;
  [population<100] { text-size: @text_font_size_large; }
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_halo_low;
  text-fill: @label_color_administrative;
}

#admin0-labels-z6 {
  text-name: [name];
  text-face-name: @text_font_administrative;
  text-transform: uppercase;
  text-wrap-width: 80;
  text-character-spacing: @text_character_spacing_xlg;
  text-size: @text_font_size_xxlg;
  [population<100] { text-size: @text_font_size_xlg; }
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_halo_low;
  text-fill: @label_color_administrative;
}

/* city labels - using hwy shields */
#aries-places-labels {
  [zoom=4][scalerank<5],
  [zoom=5][scalerank<6],
  [zoom=6][scalerank<7],
  [zoom=7][scalerank<8],
  [zoom=8][scalerank<9],
  [zoom=9][scalerank<10],
  [zoom=10][scalerank<11],
  [zoom=11][scalerank<12],
  [zoom=12][scalerank<13],
  [zoom=13][scalerank<14],
  [zoom=14][scalerank<15]
  [zoom>=15][scalerank<15]{

    shield-file: url(shields/circle-12.svg);
    shield-fill: @label_color_city;
    shield-halo-fill: @label_color_halo_low;
    shield-halo-radius: @text_font_halo_radius_sm;
    shield-unlock-image: true;
    shield-avoid-edges: true;
    shield-transform: scale(0.5, 0.5);
    shield-face-name: @text_font_city;
    shield-name: [name];
    shield-min-distance: 2;
    shield-placement-type: simple;
    shield-placements: 'NE,SW,NW,SE,E,W';
    shield-text-dy: 3;
    shield-text-dx: 3;
    shield-min-distance: 10;

    [zoom>=4] {
      shield-size: @text_font_size_xsm;

      [population>700000] {
        shield-size: @text_font_size_xsm * 1.2;
        shield-transform: scale(0.7, 0.7);
      }

      [population>7000000] {
        shield-size: @text_font_size_xsm * 1.3;
        shield-transform: scale(0.8, 0.8);
      }
    }

    [zoom>=5]{
      shield-size: @text_font_size_sm;

      [population>700000] {
        shield-size: @text_font_size_sm * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_sm * 1.3;
      }
    }

    [zoom>=6]{
      shield-size: @text_font_size_medium;

      [population>700000] {
        shield-size: @text_font_size_medium * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_medium * 1.5;
      }
    }

    [zoom>=8] {
      shield-halo-radius: @text_font_halo_radius_md;
    }

    [zoom>=10]{
      shield-size: @text_font_size_medium_plus;
      shield-halo-radius: @text_font_halo_radius_large;
      shield-halo-fill: @label_color_halo_high;

      [population>700000] {
        shield-size: @text_font_size_medium_plus * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_medium_plus * 1.3;
      }
    }

    [zoom>=11] {
      shield-opacity: 0;
    }

    [zoom>=12] {
      shield-size: @text_font_size_xlg;

      [population>700000] {
        shield-size: @text_font_size_xlg * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_xlg * 1.3;
      }
    }
  }
}

#airports {
  [zoom>=10] {
    text-name: [abbrev];
    text-face-name: @text_font_transport;
    text-fill: #444;
    text-size: @text_font_size_medium_plus;

    text-halo-fill: @label_color_airport_halo;
    text-halo-radius: @text_font_halo_radius_large;

    text-wrap-width: 128;
    text-dy: 14;
  }

  [zoom>=13] {
    text-name: [name];
  }

  [zoom=14][natlscale>.04],
  [zoom=15][natlscale>.02],
  [zoom>=16][natlscale>.01]
  {
      text-dy: 20;
  }

  [zoom=8][natlscale>2.3][type='major'],
  [zoom=9][natlscale>1.2][type='major'],
  [zoom=10][natlscale>0.57][type='major'],
  [zoom=11][natlscale>0.29][type='major'],
  [zoom=12][natlscale>0.29][type='major'],
  [zoom=13][natlscale>0.29][type='major']
  {
    point-file: url('icons/airport_major_l.png');
  }

  [zoom=14][natlscale>.29][type='major'],
  [zoom=15][natlscale>.29][type='major'],
  [zoom>=16][natlscale>.29][type='major']
  {
      point-file: url('icons/airport_major_xl.png');
  }

  [zoom=8][natlscale>2.3][type='small'],
  [zoom=9][natlscale>1.2][type='small'],
  [zoom=10][natlscale>.57][type='small'],
  [zoom=11][natlscale>.29][type='small'],
  [zoom=12][natlscale>.29][type='small'],
  [zoom=13][natlscale>.29][type='small']
  {
      point-file: url('icons/airport_small_l.png');
  }

  [zoom=14][natlscale>.29][type='small'],
  [zoom=15][natlscale>.29][type='small'],
  [zoom>=16][natlscale>.29][type='small']
  {
      point-file: url('icons/airport_small_xl.png');
  }

  [zoom=8][natlscale>2.3][type='military'],
  [zoom=9][natlscale>1.2][type='military'],
  [zoom=10][natlscale>.57][type='military'],
  [zoom=11][natlscale>.29][type='military'],
  [zoom=12][natlscale>.29][type='military'],
  [zoom=13][natlscale>.29][type='military']
  {
      point-file: url('icons/airport_military_l.png');
  }

  [zoom=14][natlscale>.29][type='military'],
  [zoom=15][natlscale>.29][type='military'],
  [zoom>=16][natlscale>.29][type='military']
  {
      point-file: url('icons/airport_military_xl.png');
  }

  [zoom=8][natlscale>2.3][type='spaceport'],
  [zoom=9][natlscale>1.2][type='spaceport'],
  [zoom=10][natlscale>.57][type='spaceport'],
  [zoom=11][natlscale>.29][type='spaceport'],
  [zoom=12][natlscale>.29][type='spaceport'],
  [zoom=13][natlscale>.29][type='spaceport']
  {
      point-file: url('icons/intergalactic_l.png');
  }

  [zoom=14][natlscale>.29][type='spaceport'],
  [zoom=15][natlscale>.29][type='spaceport'],
  [zoom>=16][natlscale>.29][type='spaceport']
  {
      point-file: url('icons/intergalactic_xl.png');
  }
}

@text_font_transport: 'PT Sans Narrow Regular', 'Unifont Medium';
@text_font_shield: 'PT Sans Bold', 'Unifont Medium';
@text_font_administrative: 'PT Sans Bold', 'Unifont Medium';
@text_font_city: 'PT Sans Narrow Regular', 'Unifont Medium';
@text_font_parks: 'PT Sans Narrow Regular', 'Unifont Medium';
@text_font_water: 'PT Sans Italic', 'Unifont Medium';
@text_font_water_bold: 'PT Sans Bold Italic', 'Unifont Medium';

@label_color_transport: #524c4c;
@label_color_shield: #fff;
@label_color_shield_fed: #333;
@label_color_administrative: #2e2115;
@label_color_city: #2e2115;

@text_font_size_xxsm: 12;
@text_font_size_xsm: 14;
@text_font_size_sm: 15;
@text_font_size_medium: 17;
@text_font_size_medium_plus: 18;
@text_font_size_large: 20;
@text_font_size_xlg: 24;
@text_font_size_xxlg: 34;

@text_character_spacing_sm: 0.7;
@text_character_spacing_md: 1.2;
@text_character_spacing_lg: 1.7;
@text_character_spacing_xlg: 2.2;

@text_font_halo_radius_xsm: 1;
@text_font_halo_radius_sm: 1.5;
@text_font_halo_radius_md: 1.75;
@text_font_halo_radius_large: 2;

@label_color_halo_low: fadeout(rgba(255,255,255,0.7), 30%);
@label_color_halo_high: fadeout(rgba(255,255,255,1), 30%);
@label_color_administrative_halo: fadeout(#fff, 30%);
@label_color_physical: #000;
@label_color_physical_halo: #fff;
@label_color_transport_halo: desaturate(#F7F7E6,50%);
@label_color_airport_halo: #f7f7e6;
@label_color_places_halo_low: fadeout(rgba(255,255,255, 1), 30%);
@label_color_places_halo_high: fadeout(rgba(255,255,255, 1), 30%);

@label_color_green_area: #374c30;
@label_color_green_area_halo: #c0d3b5;
@label_color_water: darken(@color_water,20);
@label_color_water_halo: @color_water;

Map {
  font-directory: url("fonts/");
  buffer-size: 128;
}

#minor_road_labels,
#major_road_labels,
{
  text-name: [name];
  text-face-name: @text_font_transport;
  text-placement: line;
  text-label-position-tolerance: 2;
  text-max-char-angle-delta: 20;
  text-min-path-length: 30;
  text-fill: #444;
  text-spacing: 256;
  text-min-distance: 5;
  text-character-spacing: @text_character_spacing_sm;
  text-avoid-edges: true;
  text-halo-fill: @label_color_transport_halo;
  text-halo-radius: @text_font_halo_radius_md;

  [kind='major_road'] {
    text-size: @text_font_size_xxsm;
  }

  [zoom>=13] {
    text-size: @text_font_size_xxsm;

    [kind='major_road'] {
      text-size: @text_font_size_xxsm * 1.2;
    }
  }

  [zoom>=14] {
    text-min-distance: 10;
    text-size: @text_font_size_sm;
    text-character-spacing: @text_character_spacing_md;
    text-halo-radius: @text_font_halo_radius_large;

    [kind='major_road'] {
      text-size: @text_font_size_sm * 1.2;
    }
  }

  [zoom>=16]{
    text-min-distance: 100;
    text-character-spacing: @text_character_spacing_lg;
  }
}

#highway_shields {
  [zoom>=11],
  [highway='motorway'],
  [highway='trunk'],
  [highway='primary'] {
    // default rectangle shield
    shield-file: url(shields/default.svg);
    shield-fill: @label_color_shield_fed;
    shield-transform: scale(0.2,0.2);
    shield-face-name: @text_font_shield;
    shield-name: [ref];
    shield-size: 10;
    shield-min-distance: 80;
    shield-spacing: 80;
    // half the width of the shield to prevent from wrapping
    shield-min-padding: 10;

    [zoom>=11][zoom<=12][highway='trunk'],
    [zoom>=11][zoom<=12][highway='primary'],
    [zoom>=11][zoom<=12][highway='secondary'],
    [zoom>=11][zoom<=12][highway='tertiary'] {
      shield-opacity: 0;
      shield-size: 0;
    }

    [ref=~'I \d+'] {
      shield-file: url(shields/interstate_2.svg);
      shield-transform: scale(0.033, 0.033);
      shield-fill: @label_color_shield;
      shield-size: 9;
      shield-name: "[ref].replace('I ', '')";

      [zoom>=13] {
        shield-size: 11;
        shield-transform: scale(0.038, 0.038);
        shield-min-distance: 65;
      }

      [zoom>=15] {
        shield-size: 13;
        shield-transform: scale(0.045, 0.045);
      }

      [zoom>=17] {
        shield-size: 15;
        shield-transform: scale(0.05, 0.05);
      }
    }

    [ref=~'I \d{3,}'] {
      shield-file: url(shields/interstate_3.svg);
      shield-transform: scale(0.033, 0.033);
      shield-fill: @label_color_shield;
      shield-size: 9;
      shield-name: "[ref].replace('I ', '')";

      [zoom>=13] {
        shield-size: 11;
        shield-transform: scale(0.038, 0.038);
        shield-min-distance: 65;
      }

      [zoom>=15] {
        shield-size: 13;
        shield-transform: scale(0.045, 0.045);
      }

      [zoom>=17] {
        shield-size: 13;
        shield-transform: scale(0.05, 0.05);
      }
    }

    [ref=~'US \d+'] {
      shield-file: url(shields/us.svg);
      shield-transform: scale(0.062, 0.062);
      shield-size: 10;
      shield-name: "[ref].replace('US ', '')";
      shield-fill: @label_color_shield_fed;
      shield-text-dy: 1;
      shield-character-spacing: -1;

      [zoom>=13] {
        shield-size: 12;
        shield-transform: scale(0.075, 0.075);
      }

      [zoom>=15] {
        shield-size: 14;
        shield-transform: scale(0.088, 0.088);
      }

      [zoom>=17] {
        shield-size: 16;
        shield-transform: scale(0.091, 0.091);
      }
    }

    [ref=~'CA \d+'] {
      shield-file: url(shields/ca.svg);
      shield-fill: @label_color_shield;
      shield-transform: scale(0.052, 0.052);
      shield-size: 10;
      shield-name: "[ref].replace('CA ', '')";
      shield-dy: -2.5;
      shield-character-spacing: -1;

      [zoom>=11][zoom<=12][highway='trunk'],
      [zoom>=11][zoom<=12][highway='primary'],
      [zoom>=11][zoom<=12][highway='secondary'],
      [zoom>=11][zoom<=12][highway='tertiary'] {
        shield-opacity: 0;
        shield-size: 0;
      }

      [zoom>=13] {
        shield-size: 12;
        shield-transform: scale(0.060, 0.060);
        shield-min-distance: 70;
      }

      [zoom>=14] {
        shield-min-distance: 80;
      }

      [zoom>=15] {
        shield-size: 14;
        shield-transform: scale(0.080, 0.080);
        shield-dy: -3.5;
      }

      [zoom>=17] {
        shield-size: 16;
        shield-transform: scale(0.090, 0.090);
      }
    }
  }
}

#ne_110m_geography_marine_polys[zoom=2][scalerank=0][changed!=''],
#ne_110m_geography_marine_polys[zoom=3][changed!=''],
#ne_50m_geography_marine_polys[zoom=4][scalerank<4][changed!=''] {
    text-name: [name];

    [namealt!=''] {
      text-name: [name] + '\n(' + [namealt] + ')';
    }

    text-face-name: @text_font_water_bold;
    text-wrap-width: 40;
    text-wrap-character: ' ';
    text-size: @text_font_size_sm;
    text-character-spacing: @text_character_spacing_xlg;
    text-align: center;

    text-fill: @label_color_water;
    text-halo-radius: @text_font_halo_radius_xsm;
    text-halo-fill: @label_color_water_halo;
    text-placement: interior;
}

#ne_50m_geography_marine_polys[zoom=5][scalerank<4][changed!=''],
#ne_10m_geography_marine_polys[zoom>=6][zoom<=8][scalerank<7][changed!='']
{
    text-name: [name];

    [namealt!=''] {
      text-name: [name] + '\n(' + [namealt] + ')';
    }

    [name = 'Hecate Straight'] {
      text-name: 'Hecate Strait' + [namealt]; // Becase we know namealt is empty
    }

    [name = 'Queen Charlotte Straight'] {
      text-name: 'Queen Charlotte Strait' + [namealt]; // Becase we know namealt is empty
    }

    text-face-name: @text_font_water_bold;
    text-wrap-width: 50;
    text-size: @text_font_size_medium;
    text-character-spacing: @text_character_spacing_lg;
    text-fill: @label_color_water;
    text-halo-radius: @text_font_halo_radius_xsm;
    text-halo-fill: @label_color_water_halo;
    text-placement: interior;
    text-align: center;
}

#water-bodies-labels-low,
#water-bodies-labels-med,
#water-bodies-labels-high {
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>25000000],
  [zoom=12][area>5000000],
  [zoom=13][area>2000000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
    text-name: "[name]";
    text-face-name: @text_font_water;
    text-placement: interior;
    text-max-char-angle-delta: 30;
    text-wrap-width: 40;
    text-halo-radius: @text_font_halo_radius_large;
    text-fill: @label_color_water;
    text-halo-fill: @label_color_water_halo;
    text-size: @text_font_size_xsm;

    [zoom>9][zoom<12] {
      text-spacing: 200;
      text-wrap-width: 50;
    }
    [zoom=12] {
      text-size: @text_font_size_xsm;
      text-spacing: 200;
      text-wrap-width: 70;
    }
    [zoom=13] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom=14] {
      text-size: @text_font_size_xsm;
      text-spacing: 100;
      text-wrap-width: 70;
    }
    [zoom>=15] {
      text-size: @text_font_size_sm;
      text-spacing: 100;
      text-wrap-width: 40;
    }
  }
}

#green-areas-labels-low,
#green-areas-labels-med,
#green-areas-labels-high {
  [zoom=8][area>100000000],
  [zoom=9][area>100000000],
  [zoom=10][area>100000000],
  [zoom=11][area>5000000],
  [zoom=12][area>1000000],
  [zoom=13][area>400000],
  [zoom=14][area>200000],
  [zoom=15][area>50000],
  [zoom=16][area>10000],
  [zoom>=17] {
    text-name: [name];
    text-face-name: @text_font_parks;
    text-placement: interior;
    text-wrap-width: 96;
    text-wrap-before: true;
    text-line-spacing: -3;
    text-fill: @label_color_green_area;
    text-size: 15;

    [zoom>=8] {
      text-halo-fill: @label_color_green_area_halo;
      text-halo-radius: @text_font_halo_radius_sm;
    }

    [zoom>=11] {
      text-fill: #586e50;
      text-halo-radius: @text_font_halo_radius_large;
    }

    [zoom>=15] {
      text-size: 20;
      text-line-spacing: -7;
    }
  }
}

#continents
{
  text-name: [name];
  text-face-name: @text_font_administrative;
  text-wrap-width: 32;
  text-size: 24;
  text-line-spacing: -12;
  text-fill: #2e2115;
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_halo_low;
}

#admin1-labels {
  // [zoom>=4][scalerank<3],
  [zoom>=5][scalerank<3][admin!='United States of America'][admin!='Canada'],
  [zoom>=6][scalerank<5],
  [zoom>=7][scalerank>=5] {
    text-name: [name];
    text-transform: uppercase;
    text-face-name: @text_font_administrative;
    text-face-name: @text_font_administrative;
    text-fill: @label_color_administrative;
    text-halo-fill: @label_color_halo_low;
    text-halo-radius: @text_font_halo_radius_sm;
    text-size: @text_font_size_sm;
    text-character-spacing: 1;
    text-wrap-width: 40;
    text-placement-type: simple;
    text-placements: 'E,N,W,S';
    text-allow-overlap: false;
    text-min-distance: 3;
    text-avoid-edges: true;
    text-min-padding: 5;

    [zoom>=5] {
     text-size: @text_font_size_sm;
    }

    [zoom>=6] {
      text-size: @text_font_size_medium;
      text-character-spacing: 2;
    }

    [zoom>=7] {
      text-size: @text_font_size_large;
      text-character-spacing: 3;
    }
  }
}

#admin1-labels-50m-z4 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-name: "[label_z4]";
    text-size:  @text_font_size_xsm;
    text-character-spacing: 1;
}

#admin1-labels-50m-z5 {
    text-face-name: @text_font_administrative;
    text-wrap-width: 80;
    text-fill: @label_color_administrative;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    // text-halo-comp-op: overlay;
    text-halo-rasterizer: fast;
    text-name: "[label_z5]";
    text-size:  @text_font_size_sm;
    text-character-spacing: 1;
}

// #admin1-labels-50m-z6 {
//     text-face-name: @text_font_administrative;
//     text-wrap-width: 80;
//     text-fill: @label_color_administrative;
//     text-halo-radius: @text_font_halo_radius_sm;
//     text-halo-fill: @label_color_halo_low;
//     text-name: "[label_z6]";
//     text-size:  @text_font_size_medium;
//     text-character-spacing: 2;
// }

// #admin1-labels-50m-z7 {
//     text-face-name: @text_font_administrative;
//     text-wrap-width: 80;
//     text-fill: @label_color_administrative;
//     text-halo-radius: @text_font_halo_radius_sm;
//     text-halo-fill: @label_color_halo_low;
//     text-name: "[label_z7]";
//     text-size:  @text_font_size_large;
//     text-character-spacing: 3;
// }

/* Admin 0 labels */

#admin0-labels-z3[longfrom>3] {
    text-name: "[shortname]";
    text-face-name: @text_font_administrative;
    text-transform: uppercase;
    text-wrap-width: 80;
    text-character-spacing: @text_character_spacing_sm;
    text-size: @text_font_size_medium_plus;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-fill: @label_color_administrative;
    text-min-distance: 5;
}

#admin0-labels-z3[longfrom<=3] {
    text-name: "[name]";
    text-face-name: @text_font_administrative;
    text-transform: uppercase;
    text-size: @text_font_size_large;
    text-line-spacing: -8;
    text-wrap-width: 100;
    text-character-spacing: @text_character_spacing_sm;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-fill: @label_color_administrative;
}

#admin0-labels-z4 {
    text-name: [name];
    text-face-name: @text_font_administrative;
    text-transform: uppercase;
    text-wrap-width: 80;
    text-character-spacing: @text_character_spacing_lg;
    text-size: @text_font_size_large;
    [population<100] { text-size: @text_font_size_medium_plus; }
    text-min-distance: 15;
    text-halo-radius: @text_font_halo_radius_sm;
    text-halo-fill: @label_color_halo_low;
    text-fill: @label_color_administrative;
}

#admin0-labels-z5 {
  text-name: [name];
  text-face-name: @text_font_administrative;
  text-transform: uppercase;
  text-wrap-width: 80;
  text-character-spacing: @text_character_spacing_xlg;
  text-size: @text_font_size_xlg;
  [population<100] { text-size: @text_font_size_large; }
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_halo_low;
  text-fill: @label_color_administrative;
}

#admin0-labels-z6 {
  text-name: [name];
  text-face-name: @text_font_administrative;
  text-transform: uppercase;
  text-wrap-width: 80;
  text-character-spacing: @text_character_spacing_xlg;
  text-size: @text_font_size_xxlg;
  [population<100] { text-size: @text_font_size_xlg; }
  text-halo-radius: @text_font_halo_radius_sm;
  text-halo-fill: @label_color_halo_low;
  text-fill: @label_color_administrative;
}

/* city labels - using hwy shields */
#aries-places-labels {
  [zoom=4][scalerank<5],
  [zoom=5][scalerank<6],
  [zoom=6][scalerank<7],
  [zoom=7][scalerank<8],
  [zoom=8][scalerank<9],
  [zoom=9][scalerank<10],
  [zoom=10][scalerank<11],
  [zoom=11][scalerank<12],
  [zoom=12][scalerank<13],
  [zoom=13][scalerank<14],
  [zoom=14][scalerank<15]
  [zoom>=15][scalerank<15]{

    shield-file: url(shields/circle-12.svg);
    shield-fill: @label_color_city;
    shield-halo-fill: @label_color_halo_low;
    shield-halo-radius: @text_font_halo_radius_sm;
    shield-unlock-image: true;
    shield-avoid-edges: true;
    shield-transform: scale(0.5, 0.5);
    shield-face-name: @text_font_city;
    shield-name: [name];
    shield-min-distance: 2;
    shield-placement-type: simple;
    shield-placements: 'NE,SW,NW,SE,E,W';
    shield-text-dy: 3;
    shield-text-dx: 3;
    shield-min-distance: 10;

    [zoom>=4] {
      shield-size: @text_font_size_xsm;

      [population>700000] {
        shield-size: @text_font_size_xsm * 1.2;
        shield-transform: scale(0.7, 0.7);
      }

      [population>7000000] {
        shield-size: @text_font_size_xsm * 1.3;
        shield-transform: scale(0.8, 0.8);
      }
    }

    [zoom>=5]{
      shield-size: @text_font_size_sm;

      [population>700000] {
        shield-size: @text_font_size_sm * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_sm * 1.3;
      }
    }

    [zoom>=6]{
      shield-size: @text_font_size_medium;

      [population>700000] {
        shield-size: @text_font_size_medium * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_medium * 1.5;
      }
    }

    [zoom>=8] {
      shield-halo-radius: @text_font_halo_radius_md;
    }

    [zoom>=10]{
      shield-size: @text_font_size_medium_plus;
      shield-halo-radius: @text_font_halo_radius_large;
      shield-halo-fill: @label_color_halo_high;

      [population>700000] {
        shield-size: @text_font_size_medium_plus * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_medium_plus * 1.3;
      }
    }

    [zoom>=11] {
      shield-opacity: 0;
    }

    [zoom>=12] {
      shield-size: @text_font_size_xlg;

      [population>700000] {
        shield-size: @text_font_size_xlg * 1.2;
      }

      [population>7000000] {
        shield-size: @text_font_size_xlg * 1.3;
      }
    }
  }
}

#airports {
  [zoom>=10] {
    text-name: [abbrev];
    text-face-name: @text_font_transport;
    text-fill: #444;
    text-size: @text_font_size_medium_plus;

    text-halo-fill: @label_color_airport_halo;
    text-halo-radius: @text_font_halo_radius_large;

    text-wrap-width: 128;
    text-dy: 14;
  }

  [zoom>=13] {
    text-name: [name];
  }

  [zoom=14][natlscale>.04],
  [zoom=15][natlscale>.02],
  [zoom>=16][natlscale>.01]
  {
      text-dy: 20;
  }

  [zoom=8][natlscale>2.3][type='major'],
  [zoom=9][natlscale>1.2][type='major'],
  [zoom=10][natlscale>0.57][type='major'],
  [zoom=11][natlscale>0.29][type='major'],
  [zoom=12][natlscale>0.29][type='major'],
  [zoom=13][natlscale>0.29][type='major']
  {
    point-file: url('icons/airport_major_l.png');
  }

  [zoom=14][natlscale>.29][type='major'],
  [zoom=15][natlscale>.29][type='major'],
  [zoom>=16][natlscale>.29][type='major']
  {
      point-file: url('icons/airport_major_xl.png');
  }

  [zoom=8][natlscale>2.3][type='small'],
  [zoom=9][natlscale>1.2][type='small'],
  [zoom=10][natlscale>.57][type='small'],
  [zoom=11][natlscale>.29][type='small'],
  [zoom=12][natlscale>.29][type='small'],
  [zoom=13][natlscale>.29][type='small']
  {
      point-file: url('icons/airport_small_l.png');
  }

  [zoom=14][natlscale>.29][type='small'],
  [zoom=15][natlscale>.29][type='small'],
  [zoom>=16][natlscale>.29][type='small']
  {
      point-file: url('icons/airport_small_xl.png');
  }

  [zoom=8][natlscale>2.3][type='military'],
  [zoom=9][natlscale>1.2][type='military'],
  [zoom=10][natlscale>.57][type='military'],
  [zoom=11][natlscale>.29][type='military'],
  [zoom=12][natlscale>.29][type='military'],
  [zoom=13][natlscale>.29][type='military']
  {
      point-file: url('icons/airport_military_l.png');
  }

  [zoom=14][natlscale>.29][type='military'],
  [zoom=15][natlscale>.29][type='military'],
  [zoom>=16][natlscale>.29][type='military']
  {
      point-file: url('icons/airport_military_xl.png');
  }

  [zoom=8][natlscale>2.3][type='spaceport'],
  [zoom=9][natlscale>1.2][type='spaceport'],
  [zoom=10][natlscale>.57][type='spaceport'],
  [zoom=11][natlscale>.29][type='spaceport'],
  [zoom=12][natlscale>.29][type='spaceport'],
  [zoom=13][natlscale>.29][type='spaceport']
  {
      point-file: url('icons/intergalactic_l.png');
  }

  [zoom=14][natlscale>.29][type='spaceport'],
  [zoom=15][natlscale>.29][type='spaceport'],
  [zoom>=16][natlscale>.29][type='spaceport']
  {
      point-file: url('icons/intergalactic_xl.png');
  }
}