<commit_before>////
/// @author <NAME>
/// @access public
/// @group API
////

///
/// A map containing color values
///
$color-palette-map: () !default;

// API
// -------------------------------------------------------------------------------------------------

/// Lookup a colour value using a key or set of keys
///
/// @param {ArgList} $path
///   A key or list of keys mapping to a colour stored in the `$color-palette-map`.
///
/// @returns {Color}
///   A Color value.
///
/// @throws
///   $cp-missing-color-error
///
@function color-palette($path...) {
  $list: null;

  // Handle lists so that they can be passed aswell as separate arguments
  $first-argument: nth($path, 1);
  @if type-of($first-argument) == list {
    $list: $first-argument;
  } @else {
    $list: $path;
  }

  // Handle cases where a single key is passed - if the key's value is a map, delegate to its `base` value
  @if length($list) == 1 {
    $root-value: map-get($color-palette-map, $list...);
    @if type-of($root-value) == map {
      $list: append($list, base);
    }@else if $root-value {
      @return $root-value;
    }
  }

  $value: map-get-deep($color-palette-map, $list);
  @if $value {
    @return $value;
  } @else {
    @return map-get-deep($color-palette-map, cp-parse-value-filter($list...));
  }
}<commit_msg>refactor: Move parsing to before get<commit_after>////
/// @author <NAME>
/// @access public
/// @group API
////

///
/// A map containing color values
///
$color-palette-map: () !default;

// API
// -------------------------------------------------------------------------------------------------

/// Lookup a colour value using a key or set of keys
///
/// @param {ArgList} $path
///   A key or list of keys mapping to a colour stored in the `$color-palette-map`.
///
/// @returns {Color}
///   A Color value.
///
/// @throws
///   $cp-missing-color-error
///
@function color-palette($path...) {
  $list: null;

  // Handle lists so that they can be passed aswell as separate arguments
  $first-argument: nth($path, 1);
  @if type-of($first-argument) == list {
    $list: $first-argument;
  } @else {
    $list: $path;
  }

  // Check whether the first value is present. If not, give the filter a chance to parse it
  @if not map-has-key($color-palette-map, nth($list,1)) {
    $list: cp-parse-value-filter($list...);
  }

  // Handle cases where a single key is passed - if the key's value is a map, delegate to its `base` value
  @if length($list) == 1 {
    $root-value: map-get($color-palette-map, $list...);
    @if type-of($root-value) == map {
      $list: append($list, base);
    }@else if $root-value {
      @return $root-value;
    }
  }

  $value: map-get-deep($color-palette-map, $list);
  @if $value {
    @return $value;
  } @else {
    @return cp-throw-error($cp-missing-color-error, "Palette value at path: `#{$value}` didn't exist in map `#{inspect($color-palette-map)}`");
  }
}
{'fraction_non_alphanumeric': 0.2463121783876501, 'fraction_numerical': 0.0017152658662092624, 'mean_word_length': 1.9938398357289528, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '3074953', 'n_tokens_mistral': 959, 'n_tokens_neox': 943, 'n_words': 287}