<!-- Copyright (C) 2005-2024 Splunk Inc. All Rights Reserved. -->
<%!
import splunk.rest as rest
import sys
from splunk.clilib.bundle_paths import make_splunkhome_path
sys.path.append(make_splunkhome_path(['etc', 'apps', 'SA-ITOA', 'lib', 'itsi']))
sys.path = list(set(sys.path))
from itsi_version_compare import VersionComparison
from itsi_feature_compare import FeatureComparison

version_compare = VersionComparison()
feature_compare = FeatureComparison()

if cherrypy.config['product_type'] == 'hunk':
	faviconFile = 'favicon_hunk.ico'
elif cherrypy.config['product_type'] == 'enterprise':
	faviconFile = 'favicon.ico'
else:
	faviconFile = 'favicon.ico'
%>\
<%
should_migrate = False if version_compare.is_version_consistent else version_compare.should_render_migration_page(cherrypy.session.get('sessionKey'))
should_redirect_to_license_upgrade = feature_compare.should_render_license_upgrade_page(cherrypy.session.get('sessionKey'), cherrypy.request.path_info)
requested_feature_page = cherrypy.request.path_info.split('/')[-1]
pages_requiring_jquery_ui = ['itsi_event_management', 'deep_dive']
should_load_jquery_ui = requested_feature_page in pages_requiring_jquery_ui
%>
<!doctype html>
<head>
	<%include file="lib.html" />
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	% if should_redirect_to_license_upgrade and not '/itsi/license_upgrade' in cherrypy.request.path_info:
		<meta http-equiv="refresh" content="0; URL=${make_url('/app/itsi/license_upgrade')}?feature=${requested_feature_page}" />
	% endif
	% if should_migrate and not '/itsi/app_upgrade' in cherrypy.request.path_info:
		<meta http-equiv="refresh" content="0; URL=${make_url('/app/itsi/app_upgrade')}" />
	% endif
	<title>${_('Loading...')}</title>
	<meta name="description" content="listen to your data" />
	<meta name="author" content="Splunk Inc." />
	<meta name="viewport" content="width=1024, initial-scale=1.0" />
	<link rel="shortcut icon" href="${make_url('/static/img/' + faviconFile)}" />
	<link rel="apple-touch-icon-precomposed" sizes="57x57" href="${make_url('/static/img/bookmark/apple-icon-57x57-precomposed.png')}" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="${make_url('/static/img/bookmark/apple-icon-72x72-precomposed.png')}" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="${make_url('/static/img/bookmark/apple-icon-114x114-precomposed.png')}" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="${make_url('/static/img/bookmark/apple-icon-144x144-precomposed.png')}" />
	<meta name="msapplication-TileColor" content="#65A637">
	<meta name="msapplication-TileImage" content="${make_url('/static/img/bookmark/ms-tileicon-144x144.png')}">
	<link rel="stylesheet" type="text/css" media="all" href="${make_url('/static/app/itsi/css/platform/build/bootstrap.min.css')}" />
	<link rel="stylesheet" type="text/css" media="all" href="${make_url('/static/app/itsi/css/fonts/common_style.css')}" />
	% if should_load_jquery_ui:
		<link rel="stylesheet" type="text/css" media="all" href="${make_url('/static/app/itsi/css/platform/jqueryui/jquery.ui.all.css')}" />
	% endif
</head>
<body>
	${next.body() if hasattr(next, 'body') else ''}
	<%
	config_qs = dict(autoload=1)
	if hasattr(cherrypy.request, 'guest_pass') and cherrypy.request.guest_pass:
		config_qs['guest_pass'] = 1
	%>
	<script src="${make_url('/config', _qs=config_qs)}"></script>
	<script src="${make_url('/static/js/i18n.js')}"></script>
	<script src="${make_url('/i18ncatalog?autoload=1')}"></script>
	<script>
	__splunkd_partials__ = ${json_decode(splunkd)};
	</script>
	<script src="${make_url('/static/app/itsi/build/pages/common.js')}"></script>
	<script src="${make_url('/static/app/itsi/build/pages/commonswc.js')}"></script>
	<script src="${make_url('/static/app/itsi/build/pages/%s.js' % page)}"></script>
</body>
</html>
