<section class="flex flex-col gap-4">
    {% include 'lib/alert.twig' %}
    <div>
        <div class="flex flex-col gap-1">
            <h3 class="text-2xl font-semibold">
                Saved Shipping Address
            </h3>
            {% include 'lib/rule.twig' %}
            <p class="text-xs">
                This is your default shipping address for orders at checkout.
            </p>
        </div>
        {% for address in addresses %}
            {% if address.id == user.shipping_address_id %}
                {% include 'lib/address.twig' with {
                    address: address,
                    edit: true,
                    delete: true,
                    redirect: '/account/shipping'
                } %}
            {% endif %}
        {% endfor %}
    </div>
    <form action="/account/shipping" method="post" class="flex flex-col gap-2">
        {% include 'lib/forms/address.twig' with {
            type: 'shipping_'
        } %}
        {% include 'lib/buttons/submit.twig' with { 
            label: 'Add Address', 
        } %}
    </form>
    {% if addresses|length > 1 %}
        {% include 'lib/rule.twig' with {
                text: 'OR'
            } %}
        {% for address in addresses %}
            {% if address.id != user.shipping_address_id %}
                {% include 'lib/address.twig' with {
                    address: address,
                    edit: true,
                    delete: true,
                    redirect: '/account/shipping',
                    set_default: 'shipping'
                } %}
            {% endif %}
        {% endfor %}
    {% endif %}
</section>
