<commit_before>define ->

    # Original structure from:
    # https://github.com/reitti/reittiopas/blob/90a4d5f20bed3868b5fb608ee1a1c7ce77b70ed8/web/js/utils.coffee
    hslColors =
        #walk: '#9ab9c9' # walking; HSL official color is too light #bee4f8
        walk: '#7a7a7a' # changed from standard for legibility
        wait: '#999999' # waiting time at a stop
        1:    '#007ac9' # Helsinki internal bus lines
        2:    '#00985f' # Trams
        3:    '#007ac9' # Espoo internal bus lines
        4:    '#007ac9' # Vantaa internal bus lines
        5:    '#007ac9' # Regional bus lines
        6:    '#ff6319' # Metro
        7:    '#00b9e4' # Ferry
        8:    '#007ac9' # U-lines
        12:   '#64be14' # Commuter trains
        21:   '#007ac9' # Helsinki service lines
        22:   '#007ac9' # Helsinki night buses
        23:   '#007ac9' # Espoo service lines
        24:   '#007ac9' # Vantaa service lines
        25:   '#007ac9' # Region night buses
        36:   '#007ac9' # Kirkkonummi internal bus lines
        38:   '#007ac9' # Undocumented, assumed bus
        39:   '#007ac9' # Kerava internal bus lines

    googleColors =
        WALK: hslColors.walk
        CAR: hslColors.walk
        BICYCLE: hslColors.walk
        WAIT: hslColors.wait
        0: hslColors[2]
        1: hslColors[6]
        2: hslColors[12]
        3: hslColors[5]
        4: hslColors[7]
        109: hslColors[12]

    class TransitMapMixin
        initializeTransitMap: (opts) ->
            @listenTo opts.route, 'change:plan', (route) =>
                if route.has 'plan'
                    @drawItinerary route
                else
                    @clearItinerary()
            if opts.selectedUnits?
                @listenTo opts.selectedUnits, 'reset', @clearItinerary
            if opts.selectedPosition?
                @listenTo opts.selectedPosition, 'change:value', @clearItinerary

        # Renders each leg of the route to the map
        createRouteLayerFromItinerary: (itinerary) ->
            routeLayer = L.featureGroup()
            alertLayer = L.featureGroup()
            legs = itinerary.legs

            sum = (xs) -> _.reduce(xs, ((x, y) -> x+y), 0)
            totalWalkingDistance = sum(leg.distance for leg in legs when leg.distance and not leg.routeType?)
            totalWalkingDuration = sum(leg.duration for leg in legs when leg.distance and not leg.routeType?)

            routeIncludesTransit = _.any(leg.routeType? for leg in legs)

            mins = Math.ceil(itinerary.duration/1000/60)
            walkMins = Math.ceil(totalWalkingDuration/1000/60)
            walkKms = Math.ceil(totalWalkingDistance/100)/10

            for leg in legs<commit_msg>Fix colors for HSL API.<commit_after>define ->

    # Original structure from:
    # https://github.com/reitti/reittiopas/blob/90a4d5f20bed3868b5fb608ee1a1c7ce77b70ed8/web/js/utils.coffee
    hslColors =
        #walk: '#9ab9c9' # walking; HSL official color is too light #bee4f8
        walk: '#7a7a7a' # changed from standard for legibility
        wait: '#999999' # waiting time at a stop
        1:    '#007ac9' # Helsinki internal bus lines
        2:    '#00985f' # Trams
        3:    '#007ac9' # Espoo internal bus lines
        4:    '#007ac9' # Vantaa internal bus lines
        5:    '#007ac9' # Regional bus lines
        6:    '#ff6319' # Metro
        7:    '#00b9e4' # Ferry
        8:    '#007ac9' # U-lines
        12:   '#64be14' # Commuter trains
        21:   '#007ac9' # Helsinki service lines
        22:   '#007ac9' # Helsinki night buses
        23:   '#007ac9' # Espoo service lines
        24:   '#007ac9' # Vantaa service lines
        25:   '#007ac9' # Region night buses
        36:   '#007ac9' # Kirkkonummi internal bus lines
        38:   '#007ac9' # Undocumented, assumed bus
        39:   '#007ac9' # Kerava internal bus lines

    googleColors =
        WALK: hslColors.walk
        CAR: hslColors.walk
        BICYCLE: hslColors.walk
        WAIT: hslColors.wait
        BUS: hslColors[1]
        FERRY: hslColors[7]
        TRAM: hslColors[2]
        SUBWAY: hslColors[6]
        RAIL: hslColors[12]
        # 0: hslColors[2] # tram
        # 1: hslColors[6] # metro
        # 2: hslColors[12] # commuter trains
        # 3: hslColors[5] # regional bus lines
        # 4: hslColors[7] # ferry
        # 109: hslColors[12] # commuter trains

    class TransitMapMixin
        initializeTransitMap: (opts) ->
            @listenTo opts.route, 'change:plan', (route) =>
                if route.has 'plan'
                    @drawItinerary route
                else
                    @clearItinerary()
            if opts.selectedUnits?
                @listenTo opts.selectedUnits, 'reset', @clearItinerary
            if opts.selectedPosition?
                @listenTo opts.selectedPosition, 'change:value', @clearItinerary

        # Renders each leg of the route to the map
        createRouteLayerFromItinerary: (itinerary) ->
            routeLayer = L.featureGroup()
            alertLayer = L.featureGroup()
            legs = itinerary.legs

            sum = (xs) -> _.reduce(xs, ((x, y) -> x+y), 0)
            totalWalkingDistance = sum(leg.distance for leg in legs when leg.distance and not leg.routeType?)
            totalWalkingDuration = sum(leg.duration for leg in legs when leg.distance and not leg.routeType?)

            routeIncludesTransit = _.any(leg.routeType? for leg in legs)

            mins = Math.ceil(itinerary.duration/1000/60)
            walkMins = Math.ceil(totalWalkingDuration/1000/60)
            walkKms = Math.ceil(totalWalkingDistance/100)/10

            for leg in legs
{'fraction_non_alphanumeric': 0.09954112248499823, 'fraction_numerical': 0.05930109424638193, 'mean_word_length': 1.9670157068062828, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1513853', 'n_tokens_mistral': 1971, 'n_tokens_neox': 1822, 'n_words': 465}