<!doctype html>
<html lang="en" style="height: 100%;">
  <head>
    <meta charset="utf-8">
    <title>Element</title>
    <link rel="apple-touch-icon" sizes="57x57" href="<%= require('../../res/vector-icons/apple-touch-icon-57.png') %>">
    <link rel="apple-touch-icon" sizes="60x60" href="<%= require('../../res/vector-icons/apple-touch-icon-60.png') %>">
    <link rel="apple-touch-icon" sizes="72x72" href="<%= require('../../res/vector-icons/apple-touch-icon-72.png') %>">
    <link rel="apple-touch-icon" sizes="76x76" href="<%= require('../../res/vector-icons/apple-touch-icon-76.png') %>">
    <link rel="apple-touch-icon" sizes="114x114" href="<%= require('../../res/vector-icons/apple-touch-icon-114.png') %>">
    <link rel="apple-touch-icon" sizes="120x120" href="<%= require('../../res/vector-icons/apple-touch-icon-120.png') %>">
    <link rel="apple-touch-icon" sizes="144x144" href="<%= require('../../res/vector-icons/apple-touch-icon-144.png') %>">
    <link rel="apple-touch-icon" sizes="152x152" href="<%= require('../../res/vector-icons/apple-touch-icon-152.png') %>">
    <link rel="apple-touch-icon" sizes="180x180" href="<%= require('../../res/vector-icons/apple-touch-icon-180.png') %>">
    <link rel="manifest" href="manifest.json">
    <meta name="referrer" content="no-referrer">
    <link rel="shortcut icon" href="<%= require('../../res/vector-icons/favicon.ico') %>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="apple-mobile-web-app-title" content="Element">
    <meta name="application-name" content="Element">
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="msapplication-TileImage" content="<%= require('../../res/vector-icons/mstile-150.png') %>">
    <meta name="msapplication-config" content="<%= require('../../res/vector-icons/browserconfig.xml') %>">
    <meta name="theme-color" content="#ffffff">
    <meta property="og:image" content="<%= og_image_url %>" />
    <meta http-equiv="Content-Security-Policy" content="
        default-src 'none';
        style-src 'self' 'unsafe-inline' <%= csp_extra_source %>;
        script-src 'self' 'wasm-unsafe-eval' https://www.recaptcha.net/recaptcha/ https://www.gstatic.com/recaptcha/ <%= csp_extra_source %>;
        img-src * blob: data:;
        connect-src * blob:;
        font-src 'self' data: <%= csp_extra_source %>;
        media-src * blob: data:;
        child-src * blob: data:;
        worker-src 'self' blob: <%= csp_extra_source %>;
        frame-src * blob: data:;
        form-action 'self' <%= csp_extra_source %>;
        manifest-src 'self' <%= csp_extra_source %>;
    ">
    <% for (var i=0; i < htmlWebpackPlugin.files.css.length; i++) {
        var file = htmlWebpackPlugin.files.css[i];
        var match = file.match(/^bundles\/.*?\/theme-(.*)\.css$/);
        if (match) {
            var title = match[1].charAt(0).toUpperCase() + match[1].slice(1);
        %>
           <link rel="stylesheet" disabled="disabled" data-mx-theme="<%= title %>" title="<%= title %>" href="<%= file %>">
        <% } else { %>
           <link rel="stylesheet" href="<%= file %>">
        <% }
    } %>

    <% for (const tag of htmlWebpackPlugin.tags.headTags) {
        let path = tag.attributes && tag.attributes.href;
        if (path && path.includes("/Inter/")) { %>
            <link rel="preload" as="font" href="<%= path %>" crossorigin="anonymous"/>
        <% }
    } %>

  </head>
  <body style="height: 100%; margin: 0;">
    <noscript>Sorry, Element requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
    <div id="matrixchat" style="height: 100%;" class="notranslate"></div>

<%
    // insert <script> tags for the JS entry points
    for (let file of htmlWebpackPlugin.files.js) {
        if (file.includes("bundle.js") || file.includes("unhomoglyph_data")) {
%>    <script src="<%= file %>"></script>
<%
        }
    }
%>

    <!-- Legacy supporting Prefetch images -->
    <img src="<%= require('matrix-react-sdk/res/img/warning.svg').default %>" aria-hidden alt="" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/e2e/warning.svg').default %>" aria-hidden alt="" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/feather-customised/warning-triangle.svg').default %>" aria-hidden alt="" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/format/bold.svg').default %>" aria-hidden alt="" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/format/code.svg').default %>" aria-hidden alt="" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/format/italics.svg').default %>" aria-hidden alt="" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/format/quote.svg').default %>" aria-hidden alt="" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
    <img src="<%= require('matrix-react-sdk/res/img/format/strikethrough.svg').default %>" aria-hidden alt="" width="25" height="22" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>

    <audio id="messageAudio">
        <source src="media/message.ogg" type="audio/ogg" />
        <source src="media/message.mp3" type="audio/mpeg" />
    </audio>
    <audio id="ringAudio" loop>
        <source src="media/ring.ogg" type="audio/ogg" />
        <source src="media/ring.mp3" type="audio/mpeg" />
    </audio>
    <audio id="ringbackAudio" loop>
        <source src="media/ringback.ogg" type="audio/ogg" />
        <source src="media/ringback.mp3" type="audio/mpeg" />
    </audio>
    <audio id="callendAudio">
        <source src="media/callend.ogg" type="audio/ogg" />
        <source src="media/callend.mp3" type="audio/mpeg" />
    </audio>
    <audio id="busyAudio">
        <source src="media/busy.ogg" type="audio/ogg" />
        <source src="media/busy.mp3" type="audio/mpeg" />
    </audio>
    <audio id="errorAudio">
        <source src="media/error.ogg" type="audio/ogg" />
        <source src="media/error.mp3" type="audio/mpeg" />
    </audio>
    <audio id="remoteAudio"></audio>
    <!-- let CSS themes pass constants to the app -->
    <div id="mx_theme_accentColor"></div><div id="mx_theme_secondaryAccentColor"></div><div id="mx_theme_tertiaryAccentColor"></div>

    <!-- We eagerly create these containers to ensure their CSS stacking context order is sensible -->
    <div id="mx_PersistedElement_container"></div>
    <div id="mx_Dialog_StaticContainer"></div>
    <div id="mx_Dialog_Container"></div>
    <div id="mx_ContextualMenu_Container"></div>
  </body>
</html>
