<html>
  <head>
    <link rel="icon" href="./favicon.ico" />
    <meta charset="utf-8" />
    <title><%=title%></title>
    <meta
      name="viewport"
      content="width=device-width,user-scalable=no,initial-scale=1,minimum-scale=1,maximum-scale=1,minimal-ui=true"
    />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="full-screen" content="yes" />
    <meta name="screen-orientation" content="portrait" />
    <meta name="x5-fullscreen" content="true" />
    <meta name="360-fullscreen" content="true" />
    <meta name="renderer" content="webkit" />
    <meta name="force-rendering" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <link rel="stylesheet" type="text/css" href="./index.css" />
    <script src="./lib/ads5.js"></script>

    <!-- Source Map Support for Preview -->
    <script>
      // Enable source maps in preview mode
      window.__PREVIEW_DEBUG__ = true;
      window.__SOURCE_MAPS_ENABLED__ = true;

      // Override console methods to show better stack traces
      if (window.__PREVIEW_DEBUG__) {
        const originalError = console.error;
        const originalWarn = console.warn;
        const originalLog = console.log;

        console.error = function (...args) {
          const stack = new Error().stack;
          originalError.apply(console, [...args, "\nStack:", stack]);
        };

        console.warn = function (...args) {
          const stack = new Error().stack;
          originalWarn.apply(console, [...args, "\nStack:", stack]);
        };

        console.log = function (...args) {
          const stack = new Error().stack;
          originalLog.apply(console, [...args, "\nStack:", stack]);
        };
      }
    </script>
  </head>
  <body style="overflow: hidden">
    <%- include(cocosToolBar, {config: config}) %>
    <div id="content" class="content" style="overflow: hidden">
      <div class="contentWrap">
        <div id="GameDiv" class="wrapper">
          <div id="Cocos3dGameContainer">
            <canvas
              id="GameCanvas"
              tabindex="-1"
              style="background-color: ''"
            ></canvas>
          </div>
          <div id="splash">
            <div class="progress-bar stripes"><span></span></div>
          </div>
          <div id="bulletin">
            <div id="sceneIsEmpty" class="inner"><%=tip_sceneIsEmpty%></div>
          </div>
          <div class="error" id="error">
            <div class="title">
              Error <i>(Please open the console to see detailed errors)</i>
            </div>
            <div class="error-main"></div>
            <div class="error-stack"></div>
          </div>
        </div>
      </div>
    </div>
    <%- include(cocosTemplate, {}) %>

    <script type="module">
      // 文档加载完成时的逻辑

      async function onInit() {
        const adapter = await window.AbsHelper.create({
          network: "ccc",
          apiKey: "your-api-key",
        });
        let result = await window.AbsHelper.connect(adapter);
        console.log("result", result);
      }
      // document.addEventListener("DOMContentLoaded", onInit);
    </script>
  </body>
</html>
