 {% if v and v.theme2 %}
 	{% set theme = v.theme2 %}
 {% else %}
 	{% set theme = 'theme-iron dark' %}
 {% endif %}

<!DOCTYPE html>
<html lang="en" class="{{ theme }}">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="">
	<meta name="author" content="">

	<link rel="icon" type="image/png" href="/assets/CHRISTMAS/images/{{'SITE_NAME' | app_config}}/icon.webp?a=1">

	<title>{% block pagetitle %}Settings - {{'SITE_NAME' | app_config}}{% endblock %}</title>
	<meta property="og:type" content="article" >
	<meta property="og:title" content="{{'SITE_NAME' | app_config}}" >
	<meta property="og:site_name" content="{{request.host}}" >
	<meta property="og:image" content="{{'SITE_NAME' | app_config}}/assets/CHRISTMAS/images/{{'SITE_NAME' | app_config}}/preview.gif" >
	<meta property="og:url" content="{{request.host}}">
	<meta property="og:description" name="description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}">
	<meta property="og:author" name="author" content="@{{request.host_url}}" >
	<meta property="og:site_name" content="{{request.host}}" >

	<meta name="twitter:card" content="summary_large_image">
	<meta name="twitter:site" content="@{{request.host_url}}">
	<meta name="twitter:title" content="{{'SITE_NAME' | app_config}}" >
	<meta name="twitter:creator" content="@{{request.host_url}}">
	<meta name="twitter:description" content="{{'SITE_NAME' | app_config}} - {{'SLOGAN' | app_config}}" >
	<meta name="twitter:image" content="{{'SITE_NAME' | app_config}}/assets/CHRISTMAS/images/{{'SITE_NAME' | app_config}}/preview.gif" >
	<meta name="twitter:url" content="{{request.host}}" >

	{% block stylesheets %}

	<link rel="stylesheet" href="/static/assets/CHRISTMAS/css/main.css?a=10">

  	<link rel="stylesheet" href="/static/dist/main.css?a=15">

	{% if v %}
		<style>:root{--primary:#{{v.themecolor}}}</style>
		<!-- <link rel="stylesheet" href="/assets/CHRISTMAS/css/{{v.theme}}.css?a=1"> -->
		{% if v.agendaposter %}
		<link rel="stylesheet" href="/static/assets/CHRISTMAS/css/agendaposter.css?a=1">
		{% elif v.css and not request.path.startswith('/settings/css') %}
		<link rel="stylesheet" href="/@{{v.username}}/css">
		{% endif %}
	{% else %}
		<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
		<!-- <link rel="stylesheet" href="/assets/CHRISTMAS/css/{{'DEFAULT_THEME' | app_config}}.css?a=1"> -->
	{% endif %}

	{% endblock %}

	<link rel="preload" href="/static/assets/CHRISTMAS/css/fa.css?a=1" as="style" onload="this.onload=null;this.rel='stylesheet'">
	<noscript><link rel="stylesheet" href="/assets/CHRISTMAS/css/fa.css?a=1"></noscript>
</head>

 <body class="overflow-hidden overflow-y-auto antialiased text-black bg-gray-700 dark:text-gray-100">

	{% include "CHRISTMAS/header-tw.html" %}

	<div class="flex h-full pt-20 bg-gray-500 dark:bg-gray-700 dark:text-gray-200">
		<div class="w-full">

			<div class="md:px-4 bg-gray-700" id="sub-header-row">
				<div class="relative max-w-screen-2xl mx-auto px-4 py-4 grid grid-cols-12 rounded-t">
					<div class="absolute top-0 left-0 w-full h-full bg-gradient-to-t from-gray-300 to-gray-200 dark:bg-none dark:bg-gray-800 rounded-t sub-header-shadow dark:border-b dark:border-gray-700"></div>
					<div class="relative col-span-full flex items-center">
						<div>
							<h1 class="font-bold text-xl font-heading leading-normal mb-0">
								Settings
							</h1>
							<small class="hidden lg:block text-gray-700 dark:text-gray-400 leading-normal">
								Manage your rDrama profile and more.
							</small>
							<ul class="text-xs flex lg:hidden items-center space-x-3 leading-normal mb-0">
								<li>
									<a class="{{ 'font-bold text-red-600' if '/settings/profile' in request.full_path else 'text-gray-500' }}" href="/settings/profile">
										Profile
									</a>
								</li>
								<li>
									<a class="{{ 'font-bold text-red-600' if '/settings/security' in request.full_path else 'text-gray-500' }}" href="/settings/security">
										Security
									</a>
								</li>
								<li>
									<a class="{{ 'font-bold text-red-600' if '/settings/content' in request.full_path else 'text-gray-500' }}" href="/settings/content">
										Content
									</a>
								</li>
								<li>
									<a class="{{ 'font-bold text-red-600' if '/settings/css' in request.full_path else 'text-gray-500' }}" href="/settings/css">
										CSS
									</a>
								</li>
								<li>
									<a class="{{ 'font-bold text-red-600' if '/settings/blocks' in request.full_path else 'text-gray-500' }}" href="/settings/blocks">
										Blocked
									</a>
								</li>
								<li>
									<a class="{{ 'font-bold text-red-600' if '/settings/apps' in request.full_path else 'text-gray-500' }}" href="/settings/apps">
										Apps
									</a>
								</li>
							</ul>
						</div>
					</div>
				</div>
			</div>

			<div class="w-full md:px-4">
				<div class="w-full max-w-screen-2xl mx-auto mb-4 md:px-4 grid grid-cols-12 gap-6 bg-gray-300 md:bg-gray-200 dark:bg-gray-800 rounded-b" id="main-content-row">

					<div class="col-span-full xl:col-span-9">
						{% if error %}
						<div class="mt-4 mb-0 alert show fade rounded-lg shadow-lg p-3 text-white bg-red-600 border border-red-900 shadow-inset-t-white-10" role="alert">
							<i class="fas fa-exclamation-circle fa-fw mr-1"></i>
							<span class="font-medium">
								{{error}}
							</span>
							<button type="button" class="close" data-bs-dismiss="alert" aria-label="Close">
								<span aria-hidden="true"><i class="far fa-times"></i></span>
							</button>
						</div>
						{% endif %}
						{% if msg %}
						<div class="mt-4 mb-0 alert show fade rounded-lg shadow-lg p-3 text-gray-200 bg-green-600 border border-green-900 shadow-inset-t-white-10" role="alert">
							<i class="fas fa-check-circle fa-fw mr-1"></i>
							<span class="font-medium">
								{{msg}}
							</span>
							<button type="button" class="close" data-bs-dismiss="alert" aria-label="Close">
								<span aria-hidden="true"><i class="far fa-times"></i></span>
							</button>
						</div>
						{% endif %}

						{% block content %}
						{% endblock %}
					</div>

					{% include "CHRISTMAS/sidebars/SettingsSidebar.html" %}

				</div>
			</div>

			{% include "CHRISTMAS/footer.html" %}
		</div>
	</div>

	{% block clipboard %}
	<div class="toast clipboard" id="toast-success" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
		<div class="toast-body text-center">
			<i class="fas fa-check-circle text-success mr-2"></i>Link copied to clipboard
		</div>
	</div>
	{% endblock %}

	<div class="toast" id="toast-post-success" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
		<div class="toast-body bg-success text-center text-white">
			<i class="fas fa-comment-alt-smile mr-2"></i><span id="toast-post-success-text"></span>
		</div>
	</div>
	<div class="toast" id="toast-post-error" style="position: fixed; bottom: 1.5rem; margin: 0 auto; left: 0; right: 0; width: 275px; z-index: 1000" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true" data-bs-autohide="true" data-bs-delay="5000">
		<div class="toast-body bg-danger text-center text-white">
			<i class="fas fa-exclamation-circle mr-2"></i><span id="toast-post-error-text">Error, please try again later.</span>
		</div>
	</div>

	{% if v %}
		<div id="formkey" class="hidden">{{ v.formkey }}</div>
	{% endif %}

	{% if v %}
	{% include "CHRISTMAS/modals/Modal2FA.html" %}
	{% include "CHRISTMAS/modals/ModalThemePicker.html" %}
	{% endif %}

	{% include "CHRISTMAS/mobile_navigation_bar.html" %}

	{% block modals %}{% endblock %}

	{% block onload %}{% endblock %}

	{% block scripts %}{% endblock %}

	<!-- Scripts -->

	<script src="/assets/CHRISTMAS/js/header.js?a=1"></script>

	<!-- Lazy Loading -->
	<script src="/assets/CHRISTMAS/js/lozad.js?a=1"></script>
	<script>
		const observer = lozad();
		observer.observe();
	</script>

	<!-- Bootstrap -->
	<script src="/assets/CHRISTMAS/js/bootstrap.js"></script>

	<!-- Clipboard JS -->
	<script src="/assets/CHRISTMAS/js/clipboard.js"></script>
	<script>
		var clipboard = new ClipboardJS('.copy-link');
		clipboard.on('success', function(e) {
				var myToast = new bootstrap.Toast(document.getElementById('toast-success'));
				myToast.show();
				console.log(e);
		});
	</script>

	<script src="/assets/CHRISTMAS/js/mobile_navigation_bar.js?a=1"></script>

	{% if v %}
		<script>
			function formkey() {return '{{v.formkey}}';}

			var previousTheme = '{{ v.theme2 }}'.split(' ');
			function changeTheme(theme) {
				const root = document.documentElement
				// if previous selection has a value, remove them from root html tag
				if (previousTheme.length) {
					previousTheme.map(v => root.classList.toggle(v));
				}
				// toggle classes in root html tag
				theme.map(v => root.classList.toggle(v));
				// Set global previous selection to current selection
				previousTheme = theme;
			}

			const twoStepModal = new bootstrap.Modal(document.getElementById('2faModal'));
		</script>

	{% endif %}

	<script src="/assets/CHRISTMAS/js/default.js?a=41"></script>
</body>
</html>