class InternalComponentIdentifier {

    private record Patterns(Pattern groupPattern, Pattern namePattern) {

        private boolean hasPattern() {
            return groupPattern != null || namePattern != null;
        }

    }

    private final Supplier<Patterns> patternsSupplier = Suppliers.memoize(InternalComponentIdentifier::loadPatterns);

    public boolean isInternal(final Component component) {<FILL_FUNCTION_BODY>}

    private static Patterns loadPatterns() {
        try (final var qm = new QueryManager()) {
            final ConfigProperty groupsRegexProperty = qm.getConfigProperty(
                    INTERNAL_COMPONENTS_GROUPS_REGEX.getGroupName(),
                    INTERNAL_COMPONENTS_GROUPS_REGEX.getPropertyName()
            );
            final ConfigProperty namesRegexProperty = qm.getConfigProperty(
                    INTERNAL_COMPONENTS_NAMES_REGEX.getGroupName(),
                    INTERNAL_COMPONENTS_NAMES_REGEX.getPropertyName()
            );

            return new Patterns(
                    tryCompilePattern(groupsRegexProperty).orElse(null),
                    tryCompilePattern(namesRegexProperty).orElse(null)
            );
        }
    }

    private static Optional<Pattern> tryCompilePattern(final ConfigProperty property) {
        return Optional.ofNullable(property)
                .map(ConfigProperty::getPropertyValue)
                .map(StringUtils::trimToNull)
                .map(Pattern::compile);
    }

}

        final Patterns patterns = patternsSupplier.get();
        if (!patterns.hasPattern()) {
            return false;
        }

        final boolean matchesGroup;
        if (isNotBlank(component.getGroup()) && patterns.groupPattern() != null) {
            matchesGroup = patterns.groupPattern().matcher(component.getGroup()).matches();
        } else {
            matchesGroup = false;
        }

        final boolean matchesName;
        if (isNotBlank(component.getName()) && patterns.namePattern() != null) {
            matchesName = patterns.namePattern().matcher(component.getName()).matches();
        } else {
            matchesName = false;
        }

        return matchesGroup || matchesName;
    
<no_super_class>