{# Calculate counts for display #} {% set num_valid = analysis.valid_new | length %} {% set num_existing = analysis.existing | length %} {% set num_invalid = analysis.invalid | length %} {% set num_parsing_errors = parsing_errors | length %} {# --- Display Parsing Errors First (if any) --- #} {% if parsing_errors %}
warningJSON Parsing/Extraction Errors:
{% for error in parsing_errors %}
error_outline{{ error }}
{% endfor %}
{% endif %} {# --- Section: Valid New Servers --- #} {% if num_valid > 0 %}
check_circleReady to Add ({{ num_valid }})
{% endif %} {# --- Section: Existing Servers --- #} {% if num_existing > 0 %}
infoAlready Exist ({{ num_existing }}) - Will be ignored
{% endif %} {# --- Section: Invalid Servers --- #} {% if num_invalid > 0 %}
errorInvalid Entries ({{ num_invalid }}) - Cannot be added
{% endif %} {# --- Summary and Confirmation Form --- #}
{% if num_valid > 0 %}

playlist_add_checkReady to add {{ num_valid }} new server definition(s). Review the lists above.

{# Form to confirm and actually add the servers #}
{# Hidden input containing the JSON string of valid server data #} (Existing and invalid entries shown above will be ignored)
{% elif not parsing_errors %} {# Show message only if no parsing errors prevented analysis #}

info_outlineNo valid new server definitions found to add. Check the 'Already Exist' or 'Invalid Entries' lists above, or verify your input JSON format.

{% else %}

errorCannot proceed due to JSON parsing/extraction errors listed above. Please fix the JSON and analyze again.

{% endif %}
{# Initialize tooltips within the loaded partial #}