<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag; ?>
<?php foreach($attributes->onlyProps([
    'label' => '',
    'name' => '',
    'options' => [],
    'selected' => null,
    'placeholder' => 'Seleccione una opción',
    'variant' => 'primary',
]) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
} ?>
<?php $attributes = $attributes->exceptProps([
    'label' => '',
    'name' => '',
    'options' => [],
    'selected' => null,
    'placeholder' => 'Seleccione una opción',
    'variant' => 'primary',
]); ?>
<?php foreach (array_filter(([
    'label' => '',
    'name' => '',
    'options' => [],
    'selected' => null,
    'placeholder' => 'Seleccione una opción',
    'variant' => 'primary',
]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
} ?>
<?php $__defined_vars = get_defined_vars(); ?>
<?php foreach ($attributes as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
} ?>
<?php unset($__defined_vars); ?>

<?php
    // Resolver valor seleccionado: primero old(), luego prop selected
    $value = old($name, $selected);

    // Construir lista final de opciones
    $items = $options;

    // Si el placeholder todavía no existe, lo añadimos al principio
    if (!array_key_exists('', $items)) {
        $items = ['' => $placeholder] + $items;
    }
?>

<?php
    // Paleta por variante
    $palette = [
        'primary'   => 'select-primary',
        'secondary'   => 'select-secondary',
    ][$variant] ?? '';
?>


<label <?php echo e($attributes->merge(['class' => "select-main $palette"])); ?>>
    <?php if($label): ?>
        <p class="label">
            <?php echo e($label); ?>

        </p>
    <?php endif; ?>
    <div class="relative">
        <select
            name="<?php echo e($name); ?>"
        >
            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $optValue => $optLabel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option
                    value="<?php echo e($optValue); ?>"
                    <?php if($value === (string) $optValue): echo 'selected'; endif; ?>
                >
                    <?php echo e($optLabel); ?>

                </option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <div class="pointer-events-none absolute right-2 top-1/2 -translate-y-1/2">
            <?php if (isset($component)) { $__componentOriginalb812c3d4fc32bd0e54d75382d6e107c7 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb812c3d4fc32bd0e54d75382d6e107c7 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icons.arrow-down','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('icons.arrow-down'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb812c3d4fc32bd0e54d75382d6e107c7)): ?>
<?php $attributes = $__attributesOriginalb812c3d4fc32bd0e54d75382d6e107c7; ?>
<?php unset($__attributesOriginalb812c3d4fc32bd0e54d75382d6e107c7); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb812c3d4fc32bd0e54d75382d6e107c7)): ?>
<?php $component = $__componentOriginalb812c3d4fc32bd0e54d75382d6e107c7; ?>
<?php unset($__componentOriginalb812c3d4fc32bd0e54d75382d6e107c7); ?>
<?php endif; ?>
        </div>
    </div>

    <?php $__errorArgs = [$name];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
        <span class="text-red-500 text-sm mt-2 block"><?php echo e($message); ?></span>
    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</label><?php /**PATH C:\laragon\www\housecontract\resources\views/components/controls/select.blade.php ENDPATH**/ ?>