private static @NotNull Style simplifyStyleForBlank(final @NotNull Style style, final @Nullable Style parentStyle) {
    if (!SIMPLIFY_STYLE_FOR_BLANK_COMPONENTS) {
      // todo: can this be fixed a better way?
      // https://github.com/KyoriPowered/adventure/issues/849
      return style;
    }

    final Style.Builder builder = style.toBuilder();

    // TextColor doesn't affect spaces, unless there is other decoration present
    if (!(style.hasDecoration(TextDecoration.UNDERLINED) || style.hasDecoration(TextDecoration.STRIKETHROUGH))
      && (parentStyle == null || !(parentStyle.hasDecoration(TextDecoration.UNDERLINED) || parentStyle.hasDecoration(TextDecoration.STRIKETHROUGH)))) {
      builder.color(null);
    }

    // ITALIC/OBFUSCATED don't affect spaces (in modern versions), as these styles only affect glyph rendering
    builder.decoration(TextDecoration.ITALIC, TextDecoration.State.NOT_SET);
    builder.decoration(TextDecoration.OBFUSCATED, TextDecoration.State.NOT_SET);

    // UNDERLINE/STRIKETHROUGH affects spaces because the line renders on top
    // BOLD affects spaces because it increments the character advance by 1

    // font affects spaces in 1.19+ (since 22w11a), due to the font glyph provider for spaces

    return builder.build();
  }
Simplify the provided style to remove any information that is redundant,
given that the content is blank.

@param style style to simplify
@param parentStyle style from component's parents, for context
@return a new, simplified style
api/src/main/java/net/kyori/adventure/text/ComponentCompaction.java