@Nullable
  private static String transformPattern(@NotNull String urlPattern, Map<String, String> macroValues) {
    for (Map.Entry<String, String> entry : macroValues.entrySet()) {
      if (entry.getValue() == null) {
        if (urlPattern.contains("{" + entry.getKey())) {
          return null;
        }
        continue;
      }
      if (entry.getKey().endsWith("?")) {
        String regex = "\\{" + Pattern.quote(entry.getKey()) + "([^}]+)\\}";

        Matcher matcher = Pattern.compile(regex).matcher(urlPattern);
        if (matcher.find()) {
          String value = Boolean.parseBoolean(entry.getValue()) ? matcher.group(1) : "";

          urlPattern = urlPattern.replaceAll(regex, value);
        }
      }
      urlPattern = urlPattern
        .replace("{" + entry.getKey() + "}", entry.getValue())
        .replace("{" + entry.getKey() + ".lower}", StringUtil.toLowerCase(entry.getValue()))
        .replace("{" + entry.getKey() + ".slashes}", entry.getValue().replace(".", "/"))
        .replace("{" + entry.getKey() + ".dashes}", entry.getValue().replace("_", "-"));
    }
    return urlPattern.replace("{}", "");
  }
@Nullable
  private static String transformPattern(@NotNull String urlPattern, Map<String, String> macroValues)