import{i as e,n as t}from"./lit-Cl9PTnWs.js";import{P as n}from"./index-X6jQcISW.js";var r={emergent:`color: var(--info); border-color: rgba(59,130,246,0.35); background: rgba(59,130,246,0.08);`,stable:`color: var(--ok); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08);`,declining:`color: var(--warn); border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.08);`,dormant:`color: var(--muted); border-color: var(--border); background: var(--secondary);`,revived:`color: #f97316; border-color: rgba(249,115,22,0.35); background: rgba(249,115,22,0.08);`};function i(n){return n?e`<span
    style="display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:var(--radius-full);font-size:12px;font-weight:500;border:1px solid;${r[n]??r.dormant}"
    >${n}</span
  >`:t}function a(t){let n=Math.round(Math.max(0,Math.min(1,typeof t==`number`&&Number.isFinite(t)?t:0))*100),r=n>=70?`var(--ok)`:n>=40?`var(--warn)`:`var(--danger)`;return e`
    <div style="display:flex;align-items:center;gap:8px;">
      <div
        style="flex:1;height:6px;border-radius:var(--radius-full);background:var(--border);overflow:hidden;"
      >
        <div
          style="height:100%;width:${n}%;border-radius:var(--radius-full);background:${r};transition:width var(--duration-normal) var(--ease-out);"
        ></div>
      </div>
      <span style="font-size:13px;font-weight:600;color:${r};min-width:36px;text-align:right;"
        >${n}%</span
      >
    </div>
  `}function o(e){return!e||typeof e!=`object`?null:e}function s(r){let{list:o,selectedUserId:s,selectedAgentId:c,onUserSelect:l,onRefresh:u,headerTitle:d=`用户`,emptyMessage:f=`暂无用户数据。先与机器人对话后，画像会自动生成。`}=r,p=o.agents;return e`
    <div style="display:flex;flex-direction:column;gap:8px;overflow-y:auto;">
      <div class="row" style="justify-content:space-between;">
        <h3 style="font-size:16px;font-weight:600;margin:0;">${d}</h3>
        <button class="btn btn--sm" @click=${u}>刷新</button>
      </div>
      ${p.length===0?e`<div class="muted" style="text-align:center;padding:32px 16px;">
            ${f}
          </div>`:e`
            <div style="display:flex;flex-direction:column;gap:12px;">
              ${p.map(r=>e`
                  <div>
                    <div
                      style="font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var(--muted);margin-bottom:6px;padding:0 4px;"
                    >
                      ${r.agentId}
                      <span style="font-weight:400;text-transform:none;"
                        >(${r.users.length} 用户)</span
                      >
                    </div>
                    <div style="display:grid;gap:6px;">
                      ${r.users.map(o=>{let u=c===r.agentId&&s===o.userId;return e`
                          <div
                            class="list-item-clickable${u?` list-item-selected`:``}"
                            style="border:1px solid ${u?`var(--accent)`:`var(--border)`};border-radius:var(--radius-md);padding:10px 12px;background:var(--card);cursor:pointer;display:grid;gap:4px;transition:border-color var(--duration-fast) var(--ease-out);"
                            @click=${()=>l(r.agentId,o.userId)}
                          >
                            <div
                              style="display:flex;justify-content:space-between;align-items:center;gap:8px;"
                            >
                              <span
                                style="font-weight:600;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
                                >${o.displayName||o.userId}</span
                              >
                              ${i(o.phase)}
                            </div>
                            <div style="display:flex;align-items:center;gap:12px;">
                              ${a(o.trustScore)}
                            </div>
                            <div
                              style="display:flex;align-items:center;gap:8px;font-size:11px;color:var(--muted);"
                            >
                              <span>${o.domainCount} 领域</span>
                              ${o.lastActive?e`<span>·</span><span>${n(o.lastActive)}</span>`:t}
                            </div>
                          </div>
                        `})}
                    </div>
                  </div>
                `)}
            </div>
          `}
    </div>
  `}function c(t,n){return e`
    <div
      class="card"
      style="display:flex;align-items:center;justify-content:center;min-height:300px;"
    >
      <div class="muted" style="text-align:center;">
        <div style="font-size:15px;font-weight:500;">${t}</div>
        <div style="font-size:13px;margin-top:4px;">${n}</div>
      </div>
    </div>
  `}function l(t,n){return e`
    <section
      style="display:grid;grid-template-columns:minmax(0,0.3fr) minmax(0,0.7fr);gap:16px;min-height:0;"
    >
      ${t}
      <div style="overflow-y:auto;">${n}</div>
    </section>
  `}export{s as a,l as i,i as n,a as o,c as r,o as t};
//# sourceMappingURL=cognitive-shared-hZ0I1rin.js.map