<form class="{{cssClass}}" autocomplete="off">
  {{! Sheet Header }}
  <header class="sheet-header card clipped-bot">
    <h1 class="name">
      <input
        class="lancer-input header-field"
        name="name"
        type="text"
        value="{{item.name}}"
        placeholder="{{localize 'lancer.placeholder.name'}}"
      >
    </h1>
    {{{ref-portrait-img item.img "img" item}}}
    <div class="header-details">
      {{{item-edit-license}}}
    </div>
  </header>

  {{! Sheet Tab Navigation }}
  <nav class="lancer-tabs" data-group="primary">
    {{#each system.profiles as |profile prof_index|}}
      <a
        class="item lancer-tab medium weapon-profile-tab"
        data-tab="profile{{prof_index}}"
        data-path="system.profiles.{{prof_index}}"
        data-rename-subpath=".name"
      >
        &lt;{{profile.name}}&gt;
      </a>
    {{/each}}

    {{! Fake tab to add new profiles }}
    <a
      class="item lancer-tab medium gen-control"
      data-action="append"
      data-action-value="(struct)weapon_profile"
      data-path="system.profiles"
    >+</a>
  </nav>

  {{! Sheet Body }}
  <section class="sheet-body">
    <div class="wraprow double">
      {{! Size }}
      <div class="card clipped">
        <div class="lancer-header lancer-primary major">SIZE</div>
        {{{wpn-size-sel "system.size"}}}
      </div>

      {{! Status }}
      <div class="card clipped">
        <div class="lancer-header lancer-primary major">STATUS</div>
        <div class="flexrow" style="align-self: center">
          {{#if (is-loading item)}}
            {{{loading-indicator item "item"}}}
          {{/if}}
          {{#if (is-limited item)}}
            {{{limited-uses-indicator item "item"}}}
          {{/if}}
        </div>
      </div>

      {{#each system.profiles as |profile prof_index|}}
        <div class="tab profile{{prof_index}} double" data-group="primary" data-tab="profile{{prof_index}}">
          <div class="wraprow quintuple">
            {{! Type }}
            <div class="card clipped">
              <span class="lancer-header lancer-primary submajor">TYPE</span>
              {{{wpn-type-sel (concat "system.profiles." prof_index ".type")}}}
            </div>

            {{! Range }}
            {{{item-edit-arrayed-range (concat "system.profiles." prof_index ".range") "RANGE"}}}

            {{! Damage }}
            {{{item-edit-arrayed-damage (concat "system.profiles." prof_index ".damage") "DAMAGE"}}}

            {{! Description }}
            {{{textarea-card "DESCRIPTION" (concat "system.profiles." prof_index ".description")}}}

            {{! Effect }}
            {{{textarea-card "EFFECT" (concat "system.profiles." prof_index ".effect")}}}

            {{! On Attack }}
            {{{textarea-card "ON ATTACK" (concat "system.profiles." prof_index ".on_attack")}}}

            {{! On Hit }}
            {{{textarea-card "ON HIT" (concat "system.profiles." prof_index ".on_hit")}}}

            {{! On Crit }}
            {{{textarea-card "ON CRIT" (concat "system.profiles." prof_index ".on_crit")}}}

            {{! Actions }}
            {{{item-edit-arrayed-actions (concat "system.profiles." prof_index ".actions") "PROFILE ACTIONS"}}}

            {{! Tags }}
            {{{item-edit-arrayed-tags (concat "system.profiles." prof_index ".tags") "TAGS"}}}
          </div>
        </div>
      {{/each}}
      {{! Actions }}
      {{{item-edit-arrayed-actions (concat "system.actions") "BASE ACTIONS"}}}
    </div>
  </section>
</form>
