<section class="{{cssClass}}" autocomplete="off">
  {{>'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs'}}

    {{!-- Sheet Header --}}
    <header class="sheet-header">
      <div class="header-fields">
        <div class="flexcol">
          <div class="flexrow">
            <h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-buttons.hbs"}}
          </div>
          <div class="flexrow">
            <img class="profile-img" src="{{img}}" data-edit="img" data-tooltip="{{name}}" />
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs.hbs"}}
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-etat.hbs"}}
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-hautreve.hbs"}}
          </div>
        </div>
      </div>
    </header>

    {{!-- Sheet Tab Navigation --}}
    <nav class="sheet-tabs tabs" data-group="primary">
      {{#if options.isObserver}}
      <a class="item" data-action="tab" data-group="primary" data-tab="carac" data-tooltip="Caractéristiques">Carac.</a>
      <a class="item" data-action="tab" data-group="primary" data-tab="competences" data-tooltip="Caractéristiques">Compétences</a>
      <a class="item" data-action="tab" data-group="primary" data-tab="combat" data-tooltip="Combat et santé">Combat</a>
      <a class="item" data-action="tab" data-group="primary" data-tab="connaissances" data-tooltip="Savoirs et tâches">Savoirs&Taches</a>
      <a class="item" data-action="tab" data-group="primary" data-tab="hautreve" data-tooltip="Haut-rêve">Haut-Rêve</a>
      {{/if}}
      <a class="item" data-action="tab" data-group="primary" data-tab="items" data-tooltip="Liste d'équipement">Équipement</a>
      <a class="item" data-action="tab" data-group="primary" data-tab="description" data-tooltip="Description et compagnons">Description</a>
    </nav>

    {{!-- Sheet Body --}}
    <section class="sheet-body">
      {{#if options.isObserver}}{{!-- Carac Tab --}}
      <div class="tab items" data-group="primary" data-tab="carac">
        <div class="flexrow">
          {{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.hbs"}}
        </div>
        <div class="grid grid-2col">
          <div class="flex-group-left flexcol">
            <ul class="carac-list alterne-list">
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.hbs"}}
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/carac-total.hbs"}}
            </ul>
          </div>
          <div class="flex-group-left flexcol" >
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.hbs"}}
          </div>
        </div>
      </div>
      {{/if}}
      {{#if options.isObserver}}{{!-- Compétences Tab --}}
      <div class="tab competences" data-group="primary" data-tab="competences">
        <div class="flexrow">
          <span>
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.hbs"}}
          </span>
          <span class="flexrow"><a class="show-hide-competences">
            {{#if options.showCompNiveauBase}}
            <i class="fa-regular fa-filter-slash"></i> Montrer tout
            {{else}}
            <i class="fa-regular fa-filter"></i> Filtrer
            {{/if}}
          </a></span>
          <span class="embed-inline">
            <input class="recherche flex-grow" type="text" value="{{options.recherche.text}}" name="recherche" size="8" data-dtype="String" placeholder=""/>
          </span>
          <span>
            {{#if options.vueDetaillee}}
              &nbsp;&nbsp;
              {{#if @root.options.vueArchetype}}
              <a class="competence-archetype toggle-archetype chat-card-button-checked" data-tooltip="Retour à la vue détaillée des compétences">
                <i class="fa-solid fa-up-right-from-square"></i>Incarnation
              </a>
              {{else}}
              <a class="competence-archetype toggle-archetype chat-card-button" data-tooltip="Gestion de l'archétype et de la réincarnation">
                <i class="fa-solid fa-people-line"></i>Archétype
              </a>
              {{/if}}
            {{/if}}
          </span>
        </div>
        <div class="grid {{#if (and options.vueDetaillee options.vueArchetype)}}grid-competence-archetype{{else}}grid-2col{{/if}}">
          <div class="competence-column">
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.generale) categorie="Compétences générales"}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.particuliere) categorie="Compétences Particulières"}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.specialisee) categorie="Compétences Spécialisées"}}
          </div>
          <div class="competence-column">
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/xp-competences.hbs"}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.melee) categorie="Compétences de Mêlée"}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.tir) categorie="Compétences de Tir"}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.lancer) categorie="Compétences de Lancer"}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.connaissance) categorie="Connaissances"}}
            {{#if (or system.attributs.hautrevant.value options.vueDetaillee)}}
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/competence-categorie.hbs" competences=(filtreTriCompetences byCateg.draconic) categorie="Draconic"}}
            {{/if}}
          </div>
          {{#if (and options.vueDetaillee options.vueArchetype)}}
          <div>
            {{> "systems/foundryvtt-reve-de-dragon/templates/actor/archetype.hbs"}}
          </div>
          {{/if}}
        </div>
      </div>
      {{/if}}
      {{#if options.isObserver}}{{!-- Combat Tab --}}
      <div class="tab combat" data-group="primary" data-tab="combat">
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.hbs"}}<hr>
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.hbs"}}
      </div>
      {{/if}}

      {{#if options.isObserver}}{{!-- Connaissances Tab --}}
      <div class="tab connaissances" data-group="primary" data-tab="connaissances">
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/taches.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/jeux.hbs"}}
        <div class="flexrow oeuvre-buttons">
          <a class="chat-card-button creer-une-oeuvre">Créer une oeuvre</a>
        </div>
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/livres.hbs"}}
      </div>
      {{/if}}
      {{#if options.isObserver}}{{!-- hautreve Tab --}}
      <div class="tab hautreve" data-group="primary" data-tab="hautreve">
        <div>
          {{#if system.attributs.hautrevant.value}}
          {{> "systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.hbs"}}
          {{else}}
          <h4>Vous n'avez pas le don de haut-rêve</h4>
          {{> "systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs"}}
          {{/if}}
          <br><br>
        </div>
      </div>
      {{/if}}

      {{!-- Equipment Tab --}}
      <div class="tab items" data-group="primary" data-tab="items">
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire-monnaie.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/inventaire.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/liens-animaux.hbs"}}
        {{> "systems/foundryvtt-reve-de-dragon/templates/actor/liens-vehicules.hbs"}}
      </div>

      {{!-- Biography Tab --}}
      <div class="tab biography" data-group="primary" data-tab="description">
        <article class="flexrow">
          <ul class="item-list alterne-list">
            <li class="flexrow list-item" data-tooltip="Glisser une Race depuis un compendium pour changer">
              <label for="system.race">Race</label>
              {{#if race}}
              <img class="sheet-competence-img" src="{{race.img}}" />
              <label class="flex-grow">{{race.name}}</label>
              {{else}}
              <input class="flex-grow" type="text" name="system.race" value="{{system.race}}" data-dtype="String"/>
              {{/if}}
            </li>
            <li class="flexrow list-item">
              <label for="system.sexe">Sexe</label>
              <input class="flex-grow" type="text" name="system.sexe" value="{{system.sexe}}" data-dtype="String"/>
            </li>
            <li class="flexrow list-item">
              <label for="system.age">Age</label>
              <input class="flex-grow" type="text" name="system.age" value="{{system.age}}" data-dtype="String"/>
            </li>
            <li class="flexrow list-item">
              <label for="system.taille">Taille</label>
              <input class="flex-grow" type="text" name="system.taille" value="{{system.taille}}" data-dtype="String"/>
            </li>
            <li class="flexrow list-item">
              <label for="system.poids">Poids</label>
              <input class="flex-grow" type="text" name="system.poids" value="{{system.poids}}" data-dtype="String"/>
            </li>
            <li class="flexrow list-item">
              <label for="system.metier">Métier</label>
              <input class="flex-grow" type="text" name="system.metier" value="{{system.metier}}" data-dtype="String"/>
            </li>
          </ul>
          <ul class="item-list alterne-list">
            <li class="flexrow list-item">
              <label for="system.main">Main directrice</label>
              <div class="autocomplete">
                <input type="text" class="selection-main-directrice" name="system.main" value="{{system.main}}" data-dtype="String"/>
                {{>'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete.hbs' proposals=options.mainsDirectrices className='selection-main-directrice'}}
              </div>
            </li>
            <li class="flexrow list-item">
              <label for="system.heure">Heure de naissance</label>
              <select type="text" name="system.heure" value="{{system.heure}}" data-dtype="String">
                {{#select system.heure}}
                {{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.hbs"}}
                {{/select}}
              </select>
            </li>
            <li class="flexrow list-item">
              <label>Beauté</label>
              <input type="text" value="{{system.beaute}}" data-dtype="String" disabled/>
            </li>
            <li class="flexrow list-item">
              <label for="system.cheveux">Cheveux</label>
              <input class="flex-grow" type="text" name="system.cheveux" value="{{system.cheveux}}" data-dtype="String"/>
            </li>
            <li class="flexrow list-item">
              <label for="system.yeux">Yeux</label>
              <input class="flex-grow" type="text" name="system.yeux" value="{{system.yeux}}" data-dtype="String"/>
            </li>
            <a class="chat-card-button description-aleatoire" data-tooltip="Déterminer aléatoirement les détails de description">Description <i class="fa-solid fa-dice-d20"></i></a>
          </ul>
        </article>

        <article class="flexcol">
          {{> "systems/foundryvtt-reve-de-dragon/templates/actor/liens-suivants.hbs"}}
        </article>

        <article class="flexcol">
          <h4>Biographie</h4>
          <fieldset>
            <div>
              {{formInput systemFields.biographie enriched=biographie value=system.biographie name="system.biographie" toggled=true}}
            </div>
          </fieldset>
          <h4>Notes</h4>
          <fieldset>
            <div>
              {{formInput systemFields.notes enriched=notes value=system.notes name="system.notes" toggled=true}}
            </div>
          </fieldset>
          {{> "systems/foundryvtt-reve-de-dragon/templates/actor/xp-journal.hbs"}}
          {{> "systems/foundryvtt-reve-de-dragon/templates/actor/editor-notes-mj.hbs"}}
        </article>
      </div>

    </section>
</section>
