<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <meta name="renderer" content="webkit" />
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1.0,user-scalable=no<% if(!isBuildApp) {%>,viewport-fit=cover<%}%>"
    />
    <meta name="format-detection" content="telephone=no" />
    <% if(desc){ %>
    <meta name="description" content="<%= desc %>" />
    <% } %>
    <link
      rel="stylesheet"
      href="<%=
        cdnEndpoints.cdngo
      %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.ba91c21b0d605c84ac7f.css"
    />
    <% cssStyles.forEach(function(styleUrl){%>
    <link type="text/css" rel="stylesheet" href="<%=styleUrl %>" />
    <% })%> <% if(cdnEndpoints.aegis){ %>
    <script crossorigin="anonymous" src="<%= cdnEndpoints.aegis %>/aegis-sdk/latest/aegis.min.js"></script>
    <script>
      if (Aegis) {
        const _aegis = new Aegis({
          id: 'lXHFsBpTjIzNADiczY', // 项目ID，即上报key
          reportApiSpeed: true, // 接口测速
          reportAssetSpeed: true, // 静态资源测速
          spa: true,
          ext1: '<%=appId%>',
          ext3: '<%=ext3%>',
          version: '<%= !isAdminPortal? "0.0.2" : "0.0.3" %>',
          env: '<%= mode !== "production"? "pre" : "production" %>',
        });
        window._aegis = _aegis;
      }
      window._aegis_inited = Date.now();
    </script>
    <% }%>
    <title><%= title %></title>
    <% if(mode !== 'production'){ %>
    <!-- <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.3.4/vconsole.min.js"></script>
    <script>new VConsole()</script> -->
    <% }%>

    <!-- 重置浏览器样式 -->
    <style type="text/css">
      .clearfix::before,
      .clearfix::after {
        content: '';
        display: table;
      }

      .clearfix::after {
        clear: both;
      }

      html {
        -ms-text-size-adjust: 100%;
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
        height: 100%;
      }

      body {
        margin: 0;
        font-size: 14px;
        font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
        line-height: 1.5;
        color: #333;
        background-color: #fff;
        min-height: 100%;
      }

      body > #react {
        height: 100%;
      }

      .weapps-page {
        min-height: 100%;
      }

      article,
      aside,
      details,
      figcaption,
      figure,
      footer,
      header,
      hgroup,
      main,
      menu,
      nav,
      section,
      summary {
        display: block;
      }

      audio,
      canvas,
      progress,
      video {
        display: inline-block;
      }

      audio:not([controls]) {
        display: none;
        height: 0;
      }

      progress {
        vertical-align: baseline;
      }

      [hidden],
      template {
        display: none;
      }

      a {
        background: transparent;
        text-decoration: none;
        color: #08c;
      }

      a:active {
        outline: 0;
      }

      abbr[title] {
        border-bottom: 1px dotted;
      }

      b,
      strong {
        font-weight: bold;
      }

      dfn {
        font-style: italic;
      }

      mark {
        background: #ff0;
        color: #000;
      }

      small {
        font-size: 80%;
      }

      sub,
      sup {
        font-size: 75%;
        line-height: 0;
        position: relative;
        vertical-align: baseline;
      }

      sup {
        top: -0.5em;
      }

      sub {
        bottom: -0.25em;
      }

      img {
        border: 0;
        vertical-align: middle;
      }

      svg:not(:root) {
        overflow: hidden;
      }

      pre {
        overflow: auto;
        white-space: pre;
        white-space: pre-wrap;
        word-wrap: break-word;
      }

      code,
      kbd,
      pre,
      samp {
        font-family: monospace, monospace;
        font-size: 1em;
      }

      button,
      input,
      optgroup,
      select,
      textarea {
        color: inherit;
        font: inherit;
        margin: 0;
        vertical-align: middle;
      }

      button,
      input,
      select {
        overflow: visible;
      }

      button,
      select {
        text-transform: none;
      }

      button,
      html input[type='button'],
      input[type='reset'],
      input[type='submit'] {
        -webkit-appearance: button;
        cursor: pointer;
      }

      [disabled] {
        cursor: default;
      }

      button::-moz-focus-inner,
      input::-moz-focus-inner {
        border: 0;
        padding: 0;
      }

      input {
        line-height: normal;
      }

      input[type='checkbox'],
      input[type='radio'] {
        box-sizing: border-box;
        padding: 0;
      }

      input[type='number']::-webkit-inner-spin-button,
      input[type='number']::-webkit-outer-spin-button {
        height: auto;
      }

      input[type='search'] {
        -webkit-appearance: textfield;
        box-sizing: border-box;
      }

      input[type='search']::-webkit-search-cancel-button,
      input[type='search']::-webkit-search-decoration {
        -webkit-appearance: none;
      }

      fieldset {
        border: 1px solid #c0c0c0;
        margin: 0 2px;
        padding: 0.35em 0.625em 0.75em;
      }

      legend {
        border: 0;
        padding: 0;
      }

      textarea {
        overflow: auto;
        resize: vertical;
        vertical-align: top;
      }

      optgroup {
        font-weight: bold;
      }

      input,
      select,
      textarea {
        outline: 0;
      }

      textarea,
      input {
        -webkit-user-modify: read-write-plaintext-only;
      }

      input::-ms-clear,
      input::-ms-reveal {
        display: none;
      }

      input::-moz-placeholder,
      textarea::-moz-placeholder {
        color: #999;
      }

      input:-ms-input-placeholder,
      textarea:-ms-input-placeholder {
        color: #999;
      }

      input::-webkit-input-placeholder,
      textarea::-webkit-input-placeholder {
        color: #999;
      }

      .placeholder {
        color: #999;
      }

      table {
        border-collapse: collapse;
        border-spacing: 0;
      }

      td,
      th {
        padding: 0;
      }

      h1,
      h2,
      h3,
      h4,
      h5,
      h6,
      p,
      figure,
      form,
      blockquote {
        margin: 0;
      }

      ul,
      ol,
      li,
      dl,
      dd {
        margin: 0;
        padding: 0;
      }

      ul,
      ol {
        list-style: none outside none;
      }

      h1,
      h2,
      h3 {
        line-height: 2;
        font-weight: normal;
      }

      h1 {
        font-size: 18px;
      }

      h2 {
        font-size: 16px;
      }

      h3 {
        font-size: 14px;
      }

      i {
        font-style: normal;
      }

      * {
        box-sizing: border-box;
      }

      .hide {
        display: none;
      }
    </style>
  </head>

  <body data-weui-theme="light">
    <div id="root" class="main-wrap">
      <% if(enableLoading){ %>
      <style type="text/css">
        .weda-loading-container {
          position: fixed;
          left: 0;
          top: 0;
          width: 100%;
          display: flex;
          justify-content: center;
          align-items: center;
          flex-direction: column;
          height: 100%;
          padding: 0 20px;
        }
        .weda-loading-container .logo {
          width: 100%;
          display: flex;
          justify-content: center;
          text-align: center;
          margin-bottom: 50px;
        }

        .weda-loading-container .sp {
          width: 48px;
          height: 48px;
        }

        .weda-loading-container .sp-circle {
          border: 6px rgba(0, 82, 217, 0.25) solid;
          border-top: 6px rgba(0, 82, 217, 1) solid;
          border-radius: 50%;
          -webkit-animation: spCircRot 0.6s infinite linear;
          animation: spCircRot 0.6s infinite linear;
        }
        @-webkit-keyframes spCircRot {
          from {
            -webkit-transform: rotate(0deg);
          }
          to {
            -webkit-transform: rotate(359deg);
          }
        }
        @keyframes spCircRot {
          from {
            transform: rotate(0deg);
          }
          to {
            transform: rotate(359deg);
          }
        }
      </style>
      <div class="weda-loading-container">
        <div class="logo">
          <div class="sp sp-circle"></div>
        </div>
        <div class="text">初始化中...</div>
        <script>
          const ua = navigator.userAgent.toLowerCase();
          if (ua.indexOf('wxwork') !== -1 && /[?&]code=/.test(location.search) && /[?&]state=/.test(location.search)) {
            var el = document.querySelector('#root .weda-loading-container>.text');
            if (el) {
              el.innerHTML = '数据加载中...';
            }
          }
        </script>
      </div>
      <% }%>
    </div>
    <% if(canUseVite){ %>
    <script type="module" src="/src/index.jsx"></script>
    <% } %> <% if(!isAdminPortal){ %>
    <script src="<%= wedaPrivateConfigEndpoint ? wedaPrivateConfigEndpoint : '' %>/weda-config/weda-private.js"></script>
    <script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.5.36-beta.0/cloudbase.full.js?v=1"></script>
    <% }%>
    <script>
      if (window.cloudbase && window._aegis) {
        const _callFunction = window.cloudbase.__proto__.callFunction;
        window.cloudbase.__proto__.callFunction = function (args) {
          let promise = _callFunction.call(window.cloudbase, ...arguments);
          if (promise instanceof Promise) {
            return promise
              .then(function (res) {
                const { name, data = {} } = args || {};
                try {
                  if (res.result && res.result.code) {
                    _aegis.report({
                      msg: '[' + name + ':' + data.methodName + ']: ' + (res.result.message || '函数调用失败'),
                      level: '16',
                      ext2: res.result.code,
                      ext3: res.requestId,
                      trace: 'trace',
                    });
                  }
                } catch (e) {}
                return res;
              })
              .catch(function (e) {
                try {
                  _aegis.report({
                    msg: '[' + name + ':' + data.methodName + ']: ' + (e.message || '函数调用失败'),
                    level: '16',
                    ext2: e.code,
                    ext3: e.requestId,
                    trace: 'trace',
                  });
                } catch (e) {}
                throw e;
              });
          } else {
            return promise;
          }
        };
      }
    </script>
    <script
      crossorigin
      src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/react@16.14.0/umd/react.production.min.js"
    ></script>
    <script
      crossorigin
      src="<%=
        cdnEndpoints.cdngo
      %>/lcap/lcap-resource-cdngo/-/release/_npm/react-dom@16.14.0/umd/react-dom.production.min.js"
    ></script>
    <script
      src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
      crossorigin="anonymous"
    ></script>
    <script
      crossorigin="anonymous"
      src="<%=
        cdnEndpoints.cdngo
      %>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.53/dist/h5.browser.js"
    ></script>
    <script
      crossorigin
      src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/acorn@8.10.0/dist/acorn.js"
    ></script>
    <script>
      // zxing polifill
      if (!this.globalThis) {
        this.globalThis = this;
      }
    </script>
    <script
      crossorigin="anonymous"
      src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"
    ></script>
    <script
      crossorigin
      src="<%=
        cdnEndpoints.cdngo
      %>/lcap/lcap-resource-cdngo/-/release/_url/qcloud/lowcode/static/ide/assets/js/babel.min.js"
    ></script>
    <% jsApis.forEach(function(jsApi){%>
    <script src="<%=jsApi %>"></script>
    <% })%>
    <script
      crossorigin
      src="<%=
      cdnEndpoints.cdngo
      %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.7b502f20fb4429d008f11.bundle.js"
    ></script>
  </body>
</html>
