<template>
  <!-- COURRIEL AGRANDI — iframe sandbox plein écran. Viewer présentationnel pur.
       Extrait de ConversationPanel (découpage 2026-07-01). -->
  <q-dialog :model-value="modelValue" @update:model-value="v => emit('update:modelValue', v)" maximized>
    <q-card>
      <q-bar class="bg-green-1">
        <q-icon name="mail" color="primary" />
        <div class="text-weight-medium text-green-9">{{ subject || 'Courriel' }}</div>
        <q-space />
        <q-btn dense flat icon="close" v-close-popup><q-tooltip>Fermer</q-tooltip></q-btn>
      </q-bar>
      <iframe :srcdoc="emailSrcdoc(html)" sandbox="allow-popups allow-popups-to-escape-sandbox" referrerpolicy="no-referrer" style="width:100%;height:calc(100vh - 32px);border:0;background:#fff"></iframe>
    </q-card>
  </q-dialog>
</template>

<script setup>
import { emailSrcdoc } from 'src/composables/useEmailRender'

defineProps({
  modelValue: { type: Boolean, default: false },
  html: { type: String, default: '' },
  subject: { type: String, default: '' },
})
const emit = defineEmits(['update:modelValue'])
</script>
