<config version="2" />
<!DOCTYPE html>
<html lang="{!! $lang_type = Context::getLangType() !!}" class="xe-mobilelayout"|if="$m">
<head>

<!-- META -->
<meta charset="utf-8">
<meta name="generator" content="Zittme">
<meta name="viewport" content="{{ config('mobile.viewport') ?? HTMLDisplayHandler::DEFAULT_VIEWPORT }}" />
<meta name="csrf-token" content="{!! \Zittme\Framework\Session::getGenericToken() !!}" />
@foreach (Context::getMetaTag() as $val)
@if ($val['is_before_title'])
<meta http-equiv="{{ $val['name'] }}"|if="$val['is_http_equiv']" name="{{ $val['name'] }}"|if="!$val['is_http_equiv']" content="{!! $val['content'] !!}" />
@endif
@endforeach

<!-- TITLE -->
<title>{{ Context::getBrowserTitle() }}</title>

<!-- CSS -->
@foreach (Context::getCssFile(true) as $css_file)
<link rel="stylesheet" href="{!! $css_file['file'] !!}" media="{{ $css_file['media'] }}"|if="$css_file['media'] !== 'all'" />
@endforeach

<!-- JS -->
@foreach (Context::getJsFile('head', true) as $js_file)
<script src="{!! $js_file['file'] !!}"{!! $js_file['attrs'] !!}></script>
@endforeach

<!-- RSS -->
@if (!empty($rss_url))
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ $rss_url }}" />
@endif
@if (!empty($general_rss_url))
<link rel="alternate" type="application/rss+xml" title="Site RSS" href="{{ $general_rss_url }}" />
@endif
@if (!empty($atom_url))
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ $atom_url }}" />
@endif
@if (!empty($general_atom_url))
<link rel="alternate" type="application/atom+xml" title="Site Atom" href="{{ $general_atom_url }}" />
@endif

<!-- ICONS AND OTHER LINKS -->
@if (!empty($canonical_url = Context::getCanonicalURL()))
<link rel="canonical" href="{{ $canonical_url }}" />
@endif
@if (!empty($dark_favicon_url))
<link rel="icon" href="{{ $dark_favicon_url }}" media="(prefers-color-scheme: dark)" />
@endif
@if (!empty($favicon_url))
<link rel="icon" href="{{ $favicon_url }}" media="(prefers-color-scheme: light)"|if="!empty($dark_favicon_url)" />
@endif
@if (!empty($mobicon_url))
<link rel="apple-touch-icon" href="{{ $mobicon_url }}" />
@endif
@foreach (Context::getLinks() as $link_url => $link_rel)
<link rel="{{ $link_rel }}" href="{{ $link_url }}" />
@endforeach

<!-- OTHER HEADERS -->
@foreach (Context::getMetaTag() as $val)
@if (!$val['is_before_title'])
<meta http-equiv="{{ $val['name'] }}"|if="$val['is_http_equiv']" name="{{ $val['name'] }}"|if="!$val['is_http_equiv']" content="{!! $val['content'] !!}" />
@endif
@endforeach
@foreach (Context::getOpenGraphData() as $og_metadata)
<meta property="{{ $og_metadata['property'] }}" content="{{ $og_metadata['content'] }}" />
@endforeach
{!! Context::getHtmlHeader() !!}
</head>

<!-- BODY START -->
<body{!! Context::getBodyClass() !!}>

<!-- COMMON JS VARIABLES -->
<script>
	var default_url = @json(\Zittme\Framework\URL::encodeIdna(Context::getDefaultUrl(null, RX_SSL)));
	var current_url = @json(\Zittme\Framework\URL::encodeIdna($current_url));
	var request_uri = @json(\Zittme\Framework\URL::encodeIdna($request_uri));
	var current_lang = xe.current_lang = @json($lang_type);
	var current_mid = @json($mid ?? null);
	var http_port = @json(Context::get("_http_port") ?: null);
	var https_port = @json(Context::get("_https_port") ?: null);
	var enforce_ssl = @json($site_module_info->security === 'always' ? true : false);
	var cookies_ssl = @json(config('session.use_ssl_cookies') ? true : false);
	var rewrite_level = @json(intval(\Zittme\Framework\Router::getRewriteLevel()));
	if (detectColorScheme) detectColorScheme();
</script>

<!-- PAGE CONTENT -->
{!! Context::getBodyHeader() !!}
{!! $content !!}
{!! Context::getHtmlFooter() !!}
{!! "\n\n" !!}

<!-- ETC -->
<div id="Zittme_alert"></div>
<div id="Zittme_debug_panel"></div>
<div id="Zittme_debug_button"></div>

<!-- BODY JS -->
@foreach (Context::getJsFile('body', true) as $js_file)
<script src="{!! $js_file['file'] !!}"></script>
@endforeach

</body>
</html>
