auto
  N   ˆl–Ðz¾”Ên-jeAà_¸'TÅ£�þ]$ƒYÀ67dŒ¢|$óÑ„d/¸/ÐÏa–äY>” ”¾R( 	Å åÀ·p)‹FÿÎ ?÷     /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef intl_components_DisplayNames_h_
#define intl_components_DisplayNames_h_

#include <string>
#include <string_view>
#include "unicode/udat.h"
#include "unicode/udatpg.h"
#include "unicode/uldnames.h"
#include "unicode/uloc.h"
#include "unicode/ucurr.h"
#include "mozilla/intl/Calendar.h"
#include "mozilla/intl/DateTimePatternGenerator.h"
#include "mozilla/intl/ICU4CGlue.h"
#include "mozilla/intl/Locale.h"
#include "mozilla/Buffer.h"
#include "mozilla/Casting.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Result.h"
#include "mozilla/Span.h"
#include "mozilla/TextUtils.h"
#include "mozilla/UniquePtr.h"

namespace mozilla::intl {
/**
 * Provide more granular errors for DisplayNames rather than use the generic
 * ICUError type. This helps with providing more actionable feedback for
 * errors with input validation.
 *
 * This type can't be nested in the DisplayNames class because it needs the
 * UnusedZero and HasFreeLSB definitions.
 */
enum class DisplayNamesError {
  // Since we claim UnusedZero<DisplayNamesError>::value and
  // HasFreeLSB<Error>::value == true below, we must only use positive,
  // even enum values.
  InternalError = 2,
  OutOfMemory = 4,
  InvalidOption = 6,
  DuplicateVariantSubtag = 8,
  InvalidLanguageTag = 10,
};
}  // namespace mozilla::intl

namespace mozilla::detail {
// Ensure the efficient packing of the error types into the result. See
// ICUError.h and the ICUError comments for more information.
template <>
struct UnusedZero<intl::DisplayNamesError>
    : UnusedZeroEnum<intl::DisplayNamesError> {};

template <>
struct HasFreeLSB<intl::DisplayNamesError> {
  static constexpr bool value = true;
};
}  // namespace mozilla::detail

namespace mozilla::intl {

// NOTE: The UTF-35 canonical "code" value for months and quarters are 1-based
// integers, so some of the following enums are 1-based for consistency with
// that. For simplicity, we make all of the following enums 1-based, but use
// `EnumToIndex` (see below) to convert to zero based if indexing into internal
// (non-ICU) tables.

/**
 * Month choices for display names.
 */
enum class Month : uint8_t {
  January = 1,
  February,
  March,
  April,
  May,
  June,
  July,
  August,
  September,
  October,
  November,
  December,
  // Some calendar systems feature a 13th month.
  // https://en.wikipedia.org/wiki/Undecimber
  Undecimber
};

/**
 * Quarter choices for display names.
 */
enum class Quarter : uint8_t {
  Q1 = 1,
  Q2,
  Q3,
  Q4,
};

/**
 * Day period choices for display names.
 */
enum class DayPeriod : uint8_t {
  AM = 1,
  PM,
};

/**
 * DateTimeField choices for display names.
 */
enum class DateTimeField : uint8_t {
  Era = 1,
  Year,
  Quarter,
  Month,
  WeekOfYear,
  Weekday,
  Day,
  DayPeriod,
  Hour,
  Minute,
  Second,
  TimeZoneName,
};

/**
 * DisplayNames provide a way to get the localized names of various types of
 * information such as the names of the day of the week, months, currency etc.
 *
 * This class backs SpiderMonkeys implementation of Intl.DisplayNames
 * https://tc39.es/ecma402/#intl-displaynames-objects
 */
class DisplayNames final {
 public:
  /**
   * The style of the display name, specified by the amount of space available
   * for displaying the text.
   */
  enum class Style {
    Narrow,
    Short,
    Long,
    // Note: Abbreviated is not part of ECMA-402, but it is available for
    // internal Mozilla usage.
    Abbreviated,
  };

  /**
   * Use either standard or dialect names for the "Language" type.
   */
  enum class LanguageDisplay {
    Standard,
    Dialect,
  };

  /**
   * Determines the fallback behavior if no match is found.
   */
  enum class Fallback {
    // The buffer will contain an empty string.
    None,
    // The buffer will contain the code, but typically in a