{#if loading}
{:else if loadError} {:else} {#if isOwnerMember} {:else if !canEdit} {/if}
{i18n.t("settings.permissions.roleHeading")}

{i18n.t("settings.permissions.roleHint")}

{#each PERMISSION_ROLES as role (role.id)} {@const selected = activeRole === role.id} {/each}
{#if activeRole === CUSTOM_ROLE_ID}

{roleLabel(CUSTOM_ROLE_ID)} — {roleDescription(CUSTOM_ROLE_ID)}

{/if}
{#if advancedOpen}
{#if !readOnly}
{/if}
{#if visibleSections.length === 0}

{i18n.t("settings.permissions.noMatches")}

{/if} {#each visibleSections as section (section.id)}

{sectionLabel(section.id)}

{#each section.entries as entry (entry.key)} {@const allowed = entry.plan_allowed && !isDenied(denied, entry.key)} {@const locked = !entry.plan_allowed}
toggle(entry.key, !allowed)} /> {#if locked} {i18n.t("settings.permissions.planLocked")} {/if}
{/each}
{/each}
{/if}
{/if}
{#snippet footer()} {#if !readOnly} {/if} {/snippet}