<div class="tab spellcasting spellbook-pane" data-group="primary" data-tab="spellcasting">
    <ol class="spellcastingEntry-list directory-list">
        {{#each spellcastingEntries as |entry eid|}}
            <li class="item item-container spellcasting-entry" data-item-id="{{entry.id}}" {{#if entry.hasCollection}}data-container-type="spellcastingEntry" data-container-id="{{entry.id}}"{{/if}}>
                <div class="action-header">
                    {{#unless entry.isRitual}}
                        <a class="drag-handle"><i class="fas fa-bars"></i></a>
                    {{/unless}}

                    <h3 class="item-name">
                        <input type="text" data-item-id="{{entry.id}}" data-item-property="name" class="item-name-input" value="{{entry.name}}"{{#if entry.isRitual}} readonly{{/if}} />
                    </h3>
                    {{#if @root.options.editable}}
                        <div class="item-controls">
                            {{#if entry.isFocusPool}}
                                <a class="item-control spell-browse" title="{{localize "PF2E.OpenSpellBrowserTitle"}}"
                                    data-type="focus"
                                    data-traditions="{{entry.tradition}}"
                                    data-location="{{entry.id}}"><i class="fas fa-fw fa-search"></i></a>
                            {{/if}}
                            {{#if (or entry.isPrepared entry.isSpontaneous entry.isInnate)}}
                                <a class="skill-name slotless-level-toggle" title="{{localize "PF2E.ToggleSlotlessSpellLevelsTitle"}}">
                                    <i class="{{#if entry.showSlotlessLevels}}fa-solid{{else}}fa-regular{{/if}} fa-fw fa-list-alt"></i>
                                </a>
                            {{/if}}
                            {{#unless entry.isRitual}}
                                <a class="item-control" data-action="spellcasting-edit" title="{{localize "PF2E.EditItemTitle"}}"><i class="fas fa-fw fa-edit"></i></a>
                                <a class="item-control" data-action="spellcasting-remove" title="{{localize "PF2E.RemoveSpellcastingEntryTitle"}}"><i class="fas fa-fw fa-trash"></i></a>
                            {{/unless}}
                        </div>
                    {{/if}}
                </div>

                {{#unless entry.isRitual}}
                    <div class="spell-ability-data">
                        <div class="statistic-values">
                            <section class="skill-data" title="{{entry.statistic.dc.breakdown}}">
                                <span class="skill-score spellcasting">{{entry.statistic.dc.value}}</span>
                                <h4 class="skill-name spellcasting">{{localize "PF2E.SpellSaveLabel"}}</h4>
                            </section>
                            <section>
                                (
                                    <div class="skill-data spell-attack rollable" title="{{entry.statistic.check.breakdown}}">
                                        {{> "systems/pf2e/templates/actors/character/icons/d20.hbs"}}
                                        <span class="skill-score">{{numberFormat entry.statistic.check.mod decimals=0 sign=true}}</span>
                                    </div>
                                )
                            </section>
                        </div>

                        {{#if entry.isPrepared}}
                            <button type="button" class="skill-name prepared-toggle blue-button">
                                <i class="fa-solid fa-book"></i>{{localize "PF2E.ToggleSpellVisibilityTitle"}}
                            </button>
                        {{/if}}

                        {{#if entry.isFocusPool}}
                            <section class="focus-pool">
                                <span class="pips">
                                    {{#times @root.data.resources.focus.max}}
                                        <i class="{{#if (gt @root.data.resources.focus.value this)}}fas fa-dot-circle{{else}}far fa-circle{{/if}}"></i>
                                    {{/times}}
                                </span>
                                <h4>{{localize "PF2E.Focus.Pool"}}</h4>
                            </section>
                        {{/if}}

                        <section class="spell-ability">
                            <span class="spell-tradition">{{localize entry.statistic.label}}</span>
                            <div class="spellcasting-prof button-group">
                                <select class="skill-proficiency pf-rank adjust-item-stat-select" data-item-property="system.proficiency.value" data-rank="{{entry.statistic.rank}}" data-dtype="Number">
                                    {{> "systems/pf2e/templates/actors/character/partials/proficiencylevels-dropdown.hbs" excludeUntrained=true proflevel=entry.statistic.rank}}
                                </select>
                            </div>
                        </section>
                    </div>
                {{/unless}}
                {{#if entry.hasCollection}}
                    {{> "systems/pf2e/templates/actors/spellcasting-spell-list.hbs" entry=entry}}
                {{/if}}
            </li>
        {{/each}}

        {{#if @root.options.editable}}
            <li class="item spellbook-empty">
                <div class="item-controls pf-add-item-row">
                    <a class="item-control blue-button" data-action="spellcasting-create" title="{{localize "PF2E.CreateSpellTitle"}}" data-type="spell" data-level="{{lvl}}">
                        <i class="fas fa-plus"></i>{{localize "PF2E.AddSpellcastingEntryTitle"}}
                    </a>
                </div>
            </li>
        {{/if}}
    </ol>

</div>
