<#if space?? && !(is_module_ai_present?? && is_module_ai_present)>
#if>
<#macro flattenSpaceChildren children editRights depth=0>
<#list children as child>
<#assign hasEditRights = editRights?? && editRights[child.id?c]?? && editRights[child.id?c]>
<#assign pendingCount = (pending_counts?? && pending_counts[child.id?c]??)?then(pending_counts[child.id?c], 0)>
<#if child.type.code == "category">
<#assign category = child>
<#if (category.children?? && category.children?has_content) || hasEditRights>
<#if category.children?? && category.children?has_content>
<@flattenSpaceChildren children=category.children editRights=editRights depth=depth+1 />
#if>
#if>
<#elseif child.type.code == "book">
<#elseif child.type.code == "page">
#if>
#list>
#macro>
<#if space_children?has_content>
<#elseif can_edit?? && can_edit && space??>
#i18n{wiki.sidebar.emptySpace.title}
#i18n{wiki.sidebar.emptySpace.message}
#if>