private static SelectablePanel findSelectablePanel(@NotNull JComponent renderer) {
    Component result = renderer;
    while (result instanceof ExpandedItemRendererComponentWrapper) {
      result = ExpandedItemRendererComponentWrapper.unwrap(result);
    }

    if (result instanceof GroupedElementsRenderer.MyComponent myComponent) {
      result = myComponent.getRenderer().getItemComponent();
    }

    return result instanceof SelectablePanel selectablePanel ? selectablePanel : null;
  }
private static SelectablePanel findSelectablePanel(@NotNull JComponent renderer)