<form class="{{cssClass}}" autocomplete="off" data-tooltip-class="pf2e">
    {{!-- ITEM SHEET HEADER --}}
    <header class="sheet-header">
        {{!-- Source image in case of change during data preparation --}}
        <img src="{{item._source.img}}" data-edit="img" />
        <div class="details">
            {{!-- Likewise with source name --}}
            <input
                name="name"
                type="text"
                value="{{item._source.name}}"
                placeholder="{{localize "PF2E.ItemNamePlaceholder"}}"
                spellcheck="false"
                aria-label="{{localize "PF2E.ItemNamePlaceholder"}}"
            />

            {{#if item.actionCost~}}
                {{{actionGlyph item.actionCost}}}
            {{~else if item.actionGlyph~}}
                <span class="action-glyph">{{item.actionGlyph}}</span>
            {{~/if}}

            {{#if itemType}}
                <span class="level">
                    {{#if adjustedLevelHint}}<i class="fa-solid fa-circle-info" data-tooltip="{{adjustedLevelHint}}"></i>{{/if}}
                    <span>{{itemType}}</span>
                    <input
                        type="number"
                        {{#if adjustedLevelHint}}class="adjusted"{{/if}}
                        {{#if isPhysical}}data-property="system.level.value"{{else}}name="system.level.value"{{/if}}
                        required="true"
                        min="0"
                        value="{{data.level.value}}"
                        aria-label="{{localize "PF2E.LevelLabel"}}"
                    />
                </span>
            {{/if}}
            <template class="traits-extra">
                {{#if item.rarity}}
                    <select class="tag rarity {{item.rarity}}" data-property="system.traits.rarity">
                        {{selectOptions rarities selected=item.rarity localize=true}}
                    </select>
                {{/if}}
            </template>
            {{#if showTraits}}
                <tagify-tags class="paizo-style tags" name="system.traits.value" value="{{json traitTagifyData}}"
                    {{#if (eq data.traits.value.length 0)}}placeholder="{{localize "PF2E.Traits"}}"{{/if}} />
            {{else if rarity}}
                <div class="paizo-style tags"></div>
            {{/if}}
        </div>
    </header>

    <nav class="sheet-tabs">
        {{#if sidebarTemplate}}
            <div class="sidebar-summary">{{sidebarTitle}}</div>
        {{/if}}

        <div class="tabs" data-tab-container="primary">
            <a class="list-row" data-tab="description">{{localize "Description"}}</a>
            <a class="list-row" data-tab="details">{{localize "PF2E.Details"}}</a>
            {{#if (and isPhysical user.isGM (not item.parentItem))}}
                <a class="list-row" data-tab="mystification">{{localize "PF2E.ItemMystification"}}</a>
            {{/if}}
            {{#if (and enabledRulesUI (not isVariant))}}
                <a class="list-row" data-tab="rules">{{localize "PF2E.Item.Rules.Tab"}}</a>
            {{/if}}
        </div>
    </nav>

    {{!-- ITEM SHEET CONTENT --}}
    <div class="sheet-content">
        {{!-- ITEM SHEET SIDEBAR --}}
        {{#if sidebarTemplate}}
            <section class="sidebar" data-tooltip-direction="UP">
                {{> (lookup . "sidebarTemplate")}}
            </section>
        {{/if}}

        {{!-- ITEM SHEET BODY --}}
        <div class="sheet-body">
            {{!-- Item Description --}}
            <section class="tab description" data-tab="description" data-tooltip-class="">
                {{#if user.isGM}}
                    <section class="editor-container gm-notes{{#if enrichedContent.gmNotes}} has-content{{/if}}">
                        {{editor enrichedContent.gmNotes target="system.description.gm" button=true owner=owner editable=editable engine="prosemirror"}}
                    </section>
                {{/if}}
                <section class="main editor-container">
                    {{#if (not isVariant)}}
                        {{editor enrichedContent.description target="system.description.value" button=true owner=owner editable=editable engine="prosemirror"}}
                    {{else}}
                        <div class="editor">
                            <div class="editor-content">{{{enrichedContent.description}}}</div>
                        </div>
                    {{/if}}
                </section>
            </section>

            <!-- Item Details -->
            <section
                class="tab details{{#unless sidebarTemplate}} no-sidebar{{/unless}}"
                data-tab="details"
                data-tooltip-direction="UP"
            >
                {{> (lookup . "detailsTemplate")}}

                <fieldset class="publication">
                    <legend>{{localize "PF2E.Publication.Label"}}</legend>
                    <div class="data">
                        {{> "systems/pf2e/templates/partials/publication-data.hbs" path="system.publication" data=data.publication}}
                    </div>
                </fieldset>
            </section>

            {{#if (and isPhysical user.isGM)}}
                <!-- Mystification Details -->
                {{> "systems/pf2e/templates/items/mystify-panel.hbs"}}
            {{/if}}

            <!-- Rules Elements -->
            {{#if (not isVariant)}}
                <section class="tab rules" data-tab="rules" data-tooltip-direction="UP">
                    {{!-- Use ~ so that text areas don't add further indentation --}}
                    {{~> systems/pf2e/templates/items/rules-panel.hbs item=item}}
                </section>
            {{/if}}
        </div>
    </div>
</form>
