<xf:macro id="depth1"
	arg-node="!"
	arg-extras="!"
	arg-children="!"
	arg-childExtras="!"
	arg-depth="1">

	<div class="block">
		<div class="block-container">
			<div class="block-body">
				<xf:macro id="search_forum"
					arg-node="{$node}"
					arg-extras="{$extras}"
					arg-children="{$children}"
					arg-childExtras="{$childExtras}"
					arg-depth="{$depth}" />
			</div>
		</div>
	</div>
</xf:macro>

<xf:macro id="depth2"
	arg-node="!"
	arg-extras="!"
	arg-children="!"
	arg-childExtras="!"
	arg-depth="1">

	<xf:macro id="search_forum"
		arg-node="{$node}"
		arg-extras="{$extras}"
		arg-children="{$children}"
		arg-childExtras="{$childExtras}"
		arg-depth="{$depth}" />
</xf:macro>

<xf:macro id="depthN"
	arg-node="!"
	arg-extras="!"
	arg-children="!"
	arg-childExtras="!"
	arg-depth="1">

	<li>
		<a href="{{ link('search-forums', $node) }}" class="subNodeLink subNodeLink--search">{$node.title}</a>

		<xf:macro id="forum_list::sub_node_list"
			arg-children="{$children}"
			arg-childExtras="{$childExtras}"
			arg-depth="{{ $depth + 1 }}" />
	</li>
</xf:macro>

<xf:macro id="search_forum"
	arg-node="!"
	arg-extras="!"
	arg-children="{$children}"
	arg-childExtras="{$childExtras}"
	arg-depth="!">

	<div class="node node--id{$node.node_id} node--depth{$depth} node--search">
		<div class="node-body">
			<span class="node-icon" aria-hidden="true">
				<xf:fa icon="fa-search" />
			</span>

			<div class="node-main js-nodeMain">
				<xf:set var="$descriptionDisplay" value="{{ property('nodeListDescriptionDisplay') }}" />

				<h3 class="node-title">
					<a
						href="{{ link('search-forums', $node) }}"
						data-xf-init="{{ $descriptionDisplay == 'tooltip' ? 'element-tooltip' : '' }}"
						data-shortcut="node-description">

						{$node.title}
					</a>
				</h3>

				<xf:if is="$descriptionDisplay != 'none' && $node.description">
					<div class="node-description {{ $descriptionDisplay == 'tooltip' ? 'node-description--tooltip js-nodeDescTooltip' : '' }}">
						{$node.description|raw}
					</div>
				</xf:if>

				<div class="node-meta">
					<div class="node-statsMeta">
						<dl class="pairs pairs--inline">
							<dt>{{ phrase('threads') }}</dt>
							<dd>{$extras.discussion_count|number_short(1)}{{ $extras.discussion_count == $extras.max_results ? '+' : ''}}</dd>
						</dl>

						<dl class="pairs pairs--inline">
							<dt>{{ phrase('messages') }}</dt>
							<dd>{$extras.message_count|number_short(1)}</dd>
						</dl>
					</div>

					<xf:if is="$depth == 2 && property('nodeListSubDisplay') == 'menu'">
						<xf:macro id="forum_list::sub_nodes_menu"
							arg-children="{$children}"
							arg-childExtras="{$childExtras}"
							arg-depth="{{ $depth + 1 }}" />
					</xf:if>
				</div>

				<xf:if is="$depth == 2 && property('nodeListSubDisplay') == 'flat'">
					<xf:macro id="forum_list::sub_nodes_flat"
						arg-children="{$children}"
						arg-childExtras="{$childExtras}"
						arg-depth="{{ $depth + 1 }}" />
				</xf:if>
			</div>

			<div class="node-stats">
				<dl class="pairs pairs--rows">
					<dt>{{ phrase('threads') }}</dt>
					<dd>{$extras.discussion_count|number_short(1)}{{ $extras.discussion_count == $extras.max_results ? '+' : ''}}</dd>
				</dl>

				<dl class="pairs pairs--rows">
					<dt>{{ phrase('messages') }}</dt>
					<dd>{$extras.message_count|number_short(1)}</dd>
				</dl>
			</div>

			<div class="node-extra">
				<xf:if is="$extras.discussion_count">
					<xf:if is="$extras.LastThread">
						<div class="node-extra-icon">
							<xf:if is="$xf.visitor.isIgnoring($extras.last_post_user_id)">
								<xf:avatar user="{{ null }}" size="xs" />
							<xf:else />
								<xf:avatar user="{$extras.LastPostUser}" defaultname="{$extras.last_post_username}" size="xs" />
							</xf:if>
						</div>

						<div class="node-extra-row">
							<xf:if is="$extras.LastThread.isUnread()">
								<a href="{{ link('threads/unread', $extras.LastThread) }}" class="node-extra-title" title="{$extras.LastThread.title}">
									{{ prefix('thread', $extras.LastThread) }}{$extras.LastThread.title}
								</a>
							<xf:else />
								<a href="{{ link('threads/post', $extras.LastThread, {'post_id': $extras.last_post_id}) }}" class="node-extra-title" title="{$extras.LastThread.title}">
									{{ prefix('thread', $extras.LastThread) }}{$extras.LastThread.title}
								</a>
							</xf:if>
						</div>

						<div class="node-extra-row">
							<ul class="listInline listInline--bullet">
								<li><xf:date time="{$extras.last_post_date}" class="node-extra-date" /></li>
								<xf:if is="$xf.visitor.isIgnoring($extras.last_post_user_id)">
									<li class="node-extra-user">{{ phrase('ignored_member') }}</li>
								<xf:else />
									<li class="node-extra-user"><xf:username user="{$extras.LastPostUser}" defaultname="{$extras.last_post_username}" /></li>
								</xf:if>
							</ul>
						</div>
					<xf:else />
						<span class="node-extra-placeholder">{{ phrase('private') }}</span>
					</xf:if>
				<xf:else />
					<span class="node-extra-placeholder">{{ phrase('none') }}</span>
				</xf:if>
			</div>
		</div>
	</div>

	<xf:if is="{$depth} == 1">
		<xf:macro id="forum_list::node_list"
			arg-children="{$children}"
			arg-extras="{$childExtras}"
			arg-depth="{{ $depth + 1 }}" />
	</xf:if>
</xf:macro>