import{a as e,n as t}from"./lit-xS7RrYW6.js";import{a as n}from"./index-Bt8RaTD0.js";function r(r){let i=r.status&&typeof r.status==`object`?r.status.securityAudit:null,a=(i==null?void 0:i.summary)??null,o=(a==null?void 0:a.critical)??0,s=(a==null?void 0:a.warn)??0,c=(a==null?void 0:a.info)??0,l=o>0?`danger`:s>0?`warn`:`success`,u=o>0?`${String(o)} 个严重问题`:s>0?`${String(s)} 个警告`:`无严重问题`;return e`
    <section class="grid">
      <div class="card">
        <div class="row" style="justify-content: space-between;">
          <div>
            <div class="card-title">${`快照`}</div>
            <div class="card-sub">${`状态、健康状况和心跳数据。`}</div>
          </div>
          <button class="btn" ?disabled=${r.loading} @click=${r.onRefresh}>
            ${r.loading?`刷新中…`:`刷新`}
          </button>
        </div>
        <div class="stack" style="margin-top: 12px;">
          <div>
            <div class="muted">${`状态`}</div>
            ${a?e`<div class="callout ${l}" style="margin-top: 8px;">
                  ${`安全审计`}:
                  ${u}${c>0?` · ${`${String(c)} 条信息`}`:``}. ${`运行`}
                  <span class="mono">openclaw security audit --deep</span>
                  ${`查看详情。`}
                </div>`:t}
            <pre class="code-block">${JSON.stringify(r.status??{},null,2)}</pre>
          </div>
          <div>
            <div class="muted">${`健康状况`}</div>
            <pre class="code-block">${JSON.stringify(r.health??{},null,2)}</pre>
          </div>
          <div>
            <div class="muted">${`上次心跳`}</div>
            <pre class="code-block">${JSON.stringify(r.heartbeat??{},null,2)}</pre>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="card-title">${`手动 RPC`}</div>
        <div class="card-sub">${`发送带 JSON 参数的原始 Gateway 方法。`}</div>
        <div class="stack" style="margin-top: 16px;">
          <label class="field">
            <span>${`方法`}</span>
            <select
              .value=${r.callMethod}
              @change=${e=>r.onCallMethodChange(e.target.value)}
            >
              ${r.callMethod?t:e` <option value="" disabled>${`选择方法…`}</option> `}
              ${r.methods.map(t=>e`<option value=${t}>${t}</option>`)}
            </select>
          </label>
          <label class="field">
            <span>${`参数 (JSON)`}</span>
            <textarea
              .value=${r.callParams}
              @input=${e=>r.onCallParamsChange(e.target.value)}
              rows="6"
            ></textarea>
          </label>
        </div>
        <div class="row" style="margin-top: 12px;">
          <button class="btn primary" @click=${r.onCall}>${`调用`}</button>
        </div>
        ${r.callError?e`<div class="callout danger" style="margin-top: 12px;">${r.callError}</div>`:t}
        ${r.callResult?e`<pre class="code-block" style="margin-top: 12px;">${r.callResult}</pre>`:t}
      </div>
    </section>

    <section class="card" style="margin-top: 18px;">
      <div class="card-title">${`模型`}</div>
      <div class="card-sub">${`来自 models.list 的目录。`}</div>
      <pre class="code-block" style="margin-top: 12px;">
${JSON.stringify(r.models??[],null,2)}</pre
      >
    </section>

    <section class="card" style="margin-top: 18px;">
      <div class="card-title">${`事件日志`}</div>
      <div class="card-sub">${`最新 Gateway 事件。`}</div>
      ${r.eventLog.length===0?e` <div class="muted" style="margin-top: 12px">${`暂无事件。`}</div> `:e`
            <div class="list debug-event-log" style="margin-top: 12px;">
              ${r.eventLog.map(t=>e`
                  <div class="list-item debug-event-log__item">
                    <div class="list-main">
                      <div class="list-title">${t.event}</div>
                      <div class="list-sub">${new Date(t.ts).toLocaleTimeString()}</div>
                    </div>
                    <div class="list-meta debug-event-log__meta">
                      <pre class="code-block debug-event-log__payload">
${n(t.payload)}</pre
                      >
                    </div>
                  </div>
                `)}
            </div>
          `}
    </section>
  `}export{r as renderDebug};
//# sourceMappingURL=debug-2lDKhv4v.js.map