{% import "utils.html" as utils %}

<!DOCTYPE html>
<html lang="en" class="{% if prefs.fixed_navbar == "on" %}fixed_navbar{% endif %}">
	<head>
		{% block head %}
		<title>{% block title %}Redlib{% endblock %}</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta name="description" content="View on Redlib, an alternative private front-end to Reddit.">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		{% if crate::utils::disable_indexing() %}
		<meta name="robots" content="noindex, nofollow">
		{% endif %}
		<!-- General PWA -->
		<meta name="theme-color" content="#1F1F1F">
		<!-- iOS Application -->
		<meta name="apple-mobile-web-app-title" content="Redlib">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="default">
		<!-- Android -->
		<meta name="mobile-web-app-capable" content="yes">
		<!-- iOS Logo -->
		<link href="/touch-icon-iphone.png" rel="apple-touch-icon">
		<!-- OpenSearch description file -->
		<link rel="search" type="application/opensearchdescription+xml" title="Search Redlib" href="/opensearch.xml">
		<!-- PWA Manifest -->
		<link rel="manifest" type="application/json" href="/manifest.json">
		<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> 
		<link rel="stylesheet" type="text/css" href="/style.css?v={{ env!("CARGO_PKG_VERSION") }}">
		<!-- Video quality -->
		<div id="video_quality" data-value="{{ prefs.video_quality }}"></div>
		{% endblock %}
		</head>
	<body class="
		{% if prefs.layout != "" %}{{ prefs.layout }}{% endif %}
		{% if prefs.wide == "on" || prefs.layout == "old" || prefs.layout == "waterfall" %} wide{% endif %}
		{% if prefs.theme != "system" %} {{ prefs.theme }}{% endif %}
		{% if prefs.fixed_navbar == "on" %} fixed_navbar{% endif %}">
		<!-- NAVIGATION BAR -->
		<nav class="
			{% if prefs.fixed_navbar == "on" %} fixed_navbar{% endif %}">
			<div id="logo">
				<a id="redlib" href="/">
					<span id="lib" {% if prefs.redsublib_colorway == "on" %}style="color: #ff8585;"{% endif %}">red</span><span id="reddit" {% if prefs.redsublib_colorway == "on" %}style="color: #ffbfbf;"{% endif %}>sun</span><span id="lib" {% if prefs.redsublib_colorway == "on" %}style="color: #ff8585;"{% endif %}>lib.</span>
				</a>
				{% block subscriptions %}{% endblock %}
			</div>
			{% block search %}{% endblock %}
			<div id="links">
				<a id="reddit_link" {% if prefs.disable_visit_reddit_confirmation != "on" %}href="#popup"{% else %}href="https://www.reddit.com{{ url }}" rel="nofollow"{% endif %}>
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
						<title>redirect to reddit</title>
						<g fill="none">
							<path d="m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z" />
							<path fill="currentColor" d="M6.301 6a4 4 0 0 1 3.312 1.756l.118.186l4.253 7.087a2 2 0 0 0 1.553.965L15.7 16h1.194l.02-.415l.022-.36l.012-.159c.027-.346.352-.557.631-.41l.306.164l.36.203l.198.117l.43.263l.229.147l.463.31l.21.147l.377.273l.315.24l.133.104c.236.188.225.566-.023.762l-.28.217l-.34.252l-.4.282l-.456.305l-.462.291l-.416.249l-.365.205l-.307.165c-.275.143-.572-.036-.598-.36l-.025-.347l-.024-.415l-.01-.23H15.7a4 4 0 0 1-3.312-1.756l-.118-.186l-4.253-7.087a2 2 0 0 0-1.553-.965L6.3 8H4a1 1 0 0 1-.117-1.993L4 6zm3.714 7.643a1 1 0 0 1 .342 1.371l-.626 1.044A4 4 0 0 1 6.301 18H4a1 1 0 1 1 0-2h2.301a2 2 0 0 0 1.715-.971l.627-1.043a1 1 0 0 1 1.371-.344Zm7.563-8.988l.306.165l.36.203l.198.117l.43.263l.229.147l.463.31l.21.147l.377.273l.315.24l.133.104c.236.188.225.566-.023.762l-.28.217l-.34.252q-.186.135-.4.282l-.456.305l-.462.291l-.416.249l-.365.206l-.307.164c-.275.143-.572-.036-.598-.36l-.025-.347l-.024-.415l-.01-.23H15.7a2 2 0 0 0-1.627.836l-.088.135l-.626 1.043a1 1 0 0 1-1.77-.925l.055-.104l.626-1.043a4 4 0 0 1 3.209-1.936l.22-.006h1.195l.02-.415l.022-.36l.012-.159c.027-.346.352-.557.631-.41Z" />
						</g>
					</svg>
					<span>reddit</span>
				</a>
				{% if prefs.disable_visit_reddit_confirmation != "on" %}
					{% call utils::visit_reddit_confirmation(url) %}
				{% endif %}
				<a id="settings_link" href="/settings">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
						<g fill="none" fill-rule="evenodd">
							<title>settings</title>
							<path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z" />
							<path fill="currentColor" d="M14.035 2.809c.37-.266.89-.39 1.401-.203a10 10 0 0 1 2.982 1.725c.417.35.57.861.524 1.313c-.075.753.057 1.48.42 2.106c.32.557.802.997 1.39 1.307l.225.11c.414.187.782.576.875 1.113a10 10 0 0 1 0 3.44c-.083.484-.39.847-.753 1.051l-.122.063c-.69.31-1.254.79-1.616 1.416c-.362.627-.494 1.353-.419 2.106c.045.452-.107.964-.524 1.313a10 10 0 0 1-2.982 1.725a1.51 1.51 0 0 1-1.4-.203C13.42 20.75 12.723 20.5 12 20.5s-1.42.249-2.035.691a1.51 1.51 0 0 1-1.401.203a10 10 0 0 1-2.982-1.725a1.51 1.51 0 0 1-.524-1.313c.075-.753-.058-1.48-.42-2.106a3.4 3.4 0 0 0-1.39-1.307l-.225-.11a1.51 1.51 0 0 1-.875-1.113a10 10 0 0 1 0-3.44c.083-.484.39-.847.753-1.051l.122-.062c.69-.311 1.254-.79 1.616-1.417c.361-.626.494-1.353.419-2.106a1.51 1.51 0 0 1 .524-1.313a10 10 0 0 1 2.982-1.725a1.51 1.51 0 0 1 1.4.203c.615.442 1.312.691 2.036.691s1.42-.249 2.035-.691m.957 1.769c-.866.57-1.887.922-2.992.922s-2.126-.353-2.992-.922A8 8 0 0 0 7.068 5.7c.06 1.033-.145 2.093-.697 3.05c-.553.956-1.368 1.663-2.293 2.128a8 8 0 0 0 0 2.242c.925.465 1.74 1.172 2.293 2.13c.552.955.757 2.015.697 3.048a8 8 0 0 0 1.94 1.123c.866-.57 1.887-.922 2.992-.922s2.126.353 2.992.922a8 8 0 0 0 1.94-1.122c-.06-1.034.145-2.094.697-3.05c.552-.957 1.368-1.664 2.293-2.13a8 8 0 0 0 0-2.24c-.925-.466-1.74-1.173-2.293-2.13c-.552-.956-.757-2.016-.697-3.05a8 8 0 0 0-1.94-1.122ZM12 8a4 4 0 1 1 0 8a4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4a2 2 0 0 0 0-4" />
						</g>
					</svg>
					<span>settings</span>
				</a>
			</div>
		</nav>

		{% if prefs.mascot != "none" && prefs.mascot != "" %}
		<!-- MASCOT -->
		<div class="mascot">
			<img src="/mascot/{{ prefs.mascot }}.png">
		</div> 
		{% endif %}
		
		<!-- MAIN CONTENT -->
		{% block body %}
		<main>
			{% block content %}
			{% endblock %}
		</main>
		{% endblock %}

		<!-- FOOTER -->
		{% block footer %}
			<footer>
				<p id="version">v{{ env!("CARGO_PKG_VERSION") }}</p>
				<div class="footer-button">
					<a href="/info" title="View instance information">ⓘ View instance info</a>
				</div>
				<div class="footer-button">
					<a href="https://git.stardust.wtf/iridium/redsunlib" title="View code on git.stardust.wtf">&lt;&gt; Code</a>
				</div>
			</footer>
		{% endblock %}
	</body>
</html>