{{~#if (ne selected false)~}}
<div class="tah-subgroup tah-tab-subgroup{{~#if class}} {{class}}{{~/if~}}" id="tah-subgroup-{{nestId}}"
data-part="subgroup" data-group-type="tab" data-nest-id="{{nestId}}" data-has-actions="{{~#if (tokenActionHudCoreTrue hasActions)~}}true{{~else~}}false{{~/if~}}" data-level="{{level}}" data-type="{{type}}" data-show-title="{{settings.showTitle}}">
    <button class="tah-subgroup-button tah-button-box" value="{{id}}" data-part="groupButton" data-action="clickSubgroup">
        {{~#if settings.image~}}
        <img class="tah-button-image" src="{{settings.image}}"
            {{~#if tooltip.content}} data-tooltip="{{tooltip.content}}" data-tooltip-class="tah-tooltip{{#if tooltip.class}} {{tooltip.class}}{{/if}}"{{#if tooltip.direction}} data-tooltip-direction="{{{tooltip.direction}}}"{{/if}}{{~/if~}}>
        {{~/if~}}
        <span class="tah-button-content">
            {{~#if icon1~}}<div class="tah-icon">{{{icon1}}}</div>{{~/if~}}
            {{~#if icon2~}}<div class="tah-icon">{{{icon2}}}</div>{{~/if~}}
            {{~#if icon3~}}<div class="tah-icon">{{{icon3}}}</div>{{~/if~}}
            {{~#if settings.showTitle~}}<div class="tah-button-text">{{tokenActionHudCoreCap name}}</div>{{~/if~}}
            {{~#if info1.text~}}<div class="tah-info tah-info1{{~#if info1.class}} {{info1.class}}{{~/if~}}" data-tooltip="{{~#if info1.title}}{{info1.title}}{{~else~}}{{info1.text}}{{~/if}}" data-tooltip-class="tah-tooltip">{{info1.text}}</div>{{~/if~}}
            {{~#if info2.text~}}<div class="tah-info tah-info2{{~#if info2.class}} {{info2.class}}{{~/if~}}" data-tooltip="{{~#if info2.title}}{{info2.title}}{{~else~}}{{info2.text}}{{~/if}}" data-tooltip-class="tah-tooltip">{{info2.text}}</div>{{~/if~}}
            {{~#if info3.text~}}<div class="tah-info tah-info3{{~#if info3.class}} {{info3.class}}{{~/if~}}" data-tooltip="{{~#if info3.title}}{{info3.title}}{{~else~}}{{info3.text}}{{~/if}}" data-tooltip-class="tah-tooltip">{{info3.text}}</div>{{~/if~}}
        </span>
    </button>
    <div class="tah-subgroups-container" data-part="subgroupsContainer">
        <div class="tah-subgroups" data-part="subgroups">
            <div class="tah-actions{{~#if actionsClass}} {{actionsClass}}{{~/if~}}" data-part="actions">
            {{#each actions}}
                {{>"modules/token-action-hud-core/templates/action.hbs"}}
            {{/each}}
                <button type="button" class="tah-add-action-button tah-hidden"
                        data-part="addActionButton" data-action="addAction"
                        data-parent-nest-id="{{nestId}}" data-parent-level="{{level}}"
                        aria-label="{{localize 'tokenActionHud.addAction.label'}}"
                        data-tooltip="{{localize 'tokenActionHud.addAction.label'}}">
                    <i class="fa-solid fa-plus"></i>
                </button>
            </div>
            <div class="tah-list-subgroups" data-part="listSubgroups">
                {{#each groups.lists}}
                    <button type="button" class="tah-add-subgroup-button tah-hidden"
                            data-part="addSubgroupButton" data-action="addSubgroup"
                            data-parent-nest-id="{{../nestId}}" data-parent-level="{{../level}}"
                            data-position="{{@index}}"
                            aria-label="{{localize 'tokenActionHud.addSubgroup.label'}}"
                            data-tooltip="{{localize 'tokenActionHud.addSubgroup.label'}}">
                        <i class="tah-add-icon fa-solid fa-plus"></i>
                        <i class="tah-drop-icon fa-solid fa-arrow-down-to-line"></i>
                    </button>
                    {{>"modules/token-action-hud-core/templates/list-subgroup.hbs" categoryId=../id}}
                {{/each}}
                <button type="button" class="tah-add-subgroup-button tah-hidden"
                        data-part="addSubgroupButton" data-action="addSubgroup"
                        data-parent-nest-id="{{nestId}}" data-parent-level="{{level}}"
                        data-position="{{#if groups.lists.length}}{{groups.lists.length}}{{else}}0{{/if}}"
                        aria-label="{{localize 'tokenActionHud.addSubgroup.label'}}"
                            data-tooltip="{{localize 'tokenActionHud.addSubgroup.label'}}">
                    <i class="tah-add-icon fa-solid fa-plus"></i>
                    <i class="tah-drop-icon fa-solid fa-arrow-down-to-line"></i>
                </button>
            </div>
            {{~#if (tokenActionHudCoreTrue groups.tabs.length)~}}
            <div class="tah-tab-subgroups" data-part="tabSubgroups">
                {{#each groups.tabs}}
                    {{>"modules/token-action-hud-core/templates/tab-subgroup.hbs" categoryId=../id}}
                {{/each}}
            </div>
            {{~/if~}}
        </div>
    </div>
</div>
{{~/if~}}