<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames(([
    'name',
    'existing' => null,
    'required' => false,
]));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter(([
    'name',
    'existing' => null,
    'required' => false,
]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars, $__key, $__value); ?>

<?php
    $hasExisting = ! empty($existing);
    $inputId = 'file_'.\Illuminate\Support\Str::random(8);
?>

<div x-data="{
        fileName: '',
        previewUrl: '',
        isImage: false,
        pick(event) {
            const file = event.target.files[0];
            if (! file) {
                this.reset();
                return;
            }
            this.fileName = file.name;
            this.isImage = file.type.startsWith('image/');
            this.previewUrl = this.isImage ? URL.createObjectURL(file) : '';
        },
        reset() {
            this.fileName = '';
            this.previewUrl = '';
            this.isImage = false;
        }
    }"
    class="space-y-2">

    <?php if($hasExisting): ?>
        <div x-show="! fileName">
            <p class="text-xs text-slate-500 mb-1">Fichier actuel :</p>
            <?php if (isset($component)) { $__componentOriginale428ff3664af329988e8d13451374b90 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale428ff3664af329988e8d13451374b90 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.file-preview','data' => ['path' => $existing]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('file-preview'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['path' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($existing)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale428ff3664af329988e8d13451374b90)): ?>
<?php $attributes = $__attributesOriginale428ff3664af329988e8d13451374b90; ?>
<?php unset($__attributesOriginale428ff3664af329988e8d13451374b90); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale428ff3664af329988e8d13451374b90)): ?>
<?php $component = $__componentOriginale428ff3664af329988e8d13451374b90; ?>
<?php unset($__componentOriginale428ff3664af329988e8d13451374b90); ?>
<?php endif; ?>
        </div>
    <?php endif; ?>

    <label for="<?php echo e($inputId); ?>" class="file-dropzone" :class="fileName ? 'file-dropzone--filled' : ''">
        <svg class="file-dropzone-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
            <path stroke-linecap="round" stroke-linejoin="round" d="M21.44 11.05 12.25 20.24a5.5 5.5 0 0 1-7.78-7.78l9.19-9.19a3.5 3.5 0 0 1 4.95 4.95l-9.2 9.19a1.5 1.5 0 0 1-2.12-2.12l8.49-8.49"/>
        </svg>
        <div class="file-dropzone-text">
            <template x-if="! fileName">
                <span><span class="file-dropzone-accent">Choisir un fichier</span> ou glisser-déposer</span>
            </template>
            <template x-if="fileName">
                <span class="file-dropzone-filename" x-text="fileName"></span>
            </template>
        </div>
        <input id="<?php echo e($inputId); ?>" type="file" name="<?php echo e($name); ?>" class="sr-only"
               @change="pick($event)"
               <?php echo e($required && ! $hasExisting ? 'required' : ''); ?>>
    </label>

    <template x-if="previewUrl">
        <div class="file-input-local-preview">
            <img :src="previewUrl" alt="Aperçu" class="file-input-local-thumb">
        </div>
    </template>
</div>
<?php /**PATH C:\xampp\htdocs\teyssir\resources\views/components/file-input.blade.php ENDPATH**/ ?>