import{a as e,n as t}from"./lit-xS7RrYW6.js";import{G as n,W as r,X as i,Y as a,l as o,u as s}from"./index-Bt8RaTD0.js";import{n as c,t as l}from"./channel-config-extras-D50yz0bl.js";function u(e,t){let n=e;for(let e of t){if(!n)return null;let t=i(n);if(t===`object`){let t=n.properties??{};if(typeof e==`string`&&t[e]){n=t[e];continue}let r=n.additionalProperties;if(typeof e==`string`&&r&&typeof r==`object`){n=r;continue}return null}if(t===`array`){if(typeof e!=`number`)return null;n=(Array.isArray(n.items)?n.items[0]:n.items)??null;continue}return null}return n}function d(e,t){return c(e,t)??{}}var f=[`groupPolicy`,`streamMode`,`dmPolicy`];function p(t){let n=f.flatMap(e=>e in t?[[e,t[e]]]:[]);return n.length===0?null:e`
    <div class="status-list" style="margin-top: 12px;">
      ${n.map(([t,n])=>e`
          <div>
            <span class="label">${t}</span>
            <span>${l(n)}</span>
          </div>
        `)}
    </div>
  `}function m(t){let n=o(t.schema),r=n.schema;if(!r)return e` <div class="callout danger">Schema unavailable. Use Raw.</div> `;let i=u(r,[`channels`,t.channelId]);if(!i)return e` <div class="callout danger">Channel config schema unavailable.</div> `;let a=d(t.configValue??{},t.channelId);return e`
    <div class="config-form">
      ${s({schema:i,value:a,path:[`channels`,t.channelId],hints:t.uiHints,unsupported:new Set(n.unsupportedPaths),disabled:t.disabled,showLabel:!1,onPatch:t.onPatch})}
    </div>
    ${p(a)}
  `}function h(t){let{channelId:n,props:r}=t,i=r.configSaving||r.configSchemaLoading;return e`
    <div style="margin-top: 16px;">
      ${r.configSchemaLoading?e` <div class="muted">Loading config schema…</div> `:m({channelId:n,configValue:r.configForm,schema:r.configSchema,uiHints:r.configUiHints,disabled:i,onPatch:r.onConfigPatch})}
      <div class="row" style="margin-top: 12px;">
        <button
          class="btn primary"
          ?disabled=${i||!r.configFormDirty}
          @click=${()=>r.onConfigSave()}
        >
          ${r.configSaving?`Saving…`:`Save`}
        </button>
        <button class="btn" ?disabled=${i} @click=${()=>r.onConfigReload()}>
          ${`重新加载`}
        </button>
      </div>
    </div>
  `}function g(e,t){var n;let r=(n=t.snapshot)==null?void 0:n.channels;return r==null?void 0:r[e]}function _(e,t){var n,r;let i=((n=t.snapshot)==null||(n=n.channelAccounts)==null?void 0:n[e])??[],a=(r=t.snapshot)==null||(r=r.channelDefaultAccountId)==null?void 0:r[e];return(a?i.find(e=>e.accountId===a):void 0)??i[0]??null}function v(e,t){var n;let r=g(e,t),i=((n=t.snapshot)==null||(n=n.channelAccounts)==null?void 0:n[e])??[],a=_(e,t);return{configured:typeof(r==null?void 0:r.configured)==`boolean`?r.configured:typeof(a==null?void 0:a.configured)==`boolean`?a.configured:null,running:typeof(r==null?void 0:r.running)==`boolean`?r.running:null,connected:typeof(r==null?void 0:r.connected)==`boolean`?r.connected:null,defaultAccount:a,hasAnyActiveAccount:i.some(e=>e.configured||e.running||e.connected),status:r}}function y(e,t){if(!t.snapshot)return!1;let n=v(e,t);return n.configured===!0||n.running===!0||n.connected===!0||n.hasAnyActiveAccount}function b(e,t){return v(e,t).configured}function x(e){return e==null?`不适用`:e?`是`:`否`}function S(n){return e`
    <div class="card">
      <div class="card-title">${n.title}</div>
      <div class="card-sub">${n.subtitle}</div>
      ${n.accountCountLabel}

      <div class="status-list" style="margin-top: 16px;">
        ${n.statusRows.map(t=>e`
            <div>
              <span class="label">${t.label}</span>
              <span>${t.value}</span>
            </div>
          `)}
      </div>

      ${n.lastError?e`<div class="callout danger" style="margin-top: 12px;">${n.lastError}</div>`:t}
      ${n.secondaryCallout??t} ${n.extraContent??t}
      ${n.configSection} ${n.footer??t}
    </div>
  `}function C(e,t){var n;return(t==null||(n=t[e])==null?void 0:n.length)??0}function w(n,r){let i=C(n,r);return i<2?t:e`<div class="account-count">Accounts (${i})</div>`}function T(n){let{props:i,discord:a,accountCountLabel:o}=n;return S({title:`Discord`,subtitle:`Bot status and channel configuration.`,accountCountLabel:o,statusRows:[{label:`已配置`,value:x(b(`discord`,i))},{label:`运行中`,value:a!=null&&a.running?`是`:`否`},{label:`上次启动`,value:a!=null&&a.lastStartAt?r(a.lastStartAt):`不适用`},{label:`上次探测`,value:a!=null&&a.lastProbeAt?r(a.lastProbeAt):`不适用`}],lastError:a==null?void 0:a.lastError,secondaryCallout:a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
          ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.status??``}
          ${a.probe.error??``}
        </div>`:t,configSection:h({channelId:`discord`,props:i}),footer:e`<div class="row" style="margin-top: 12px;">
      <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
    </div>`})}function E(n){let{props:i,googleChat:a,accountCountLabel:o}=n;return S({title:`Google Chat`,subtitle:`Chat API webhook status and channel configuration.`,accountCountLabel:o,statusRows:[{label:`已配置`,value:x(b(`googlechat`,i))},{label:`运行中`,value:a?a.running?`是`:`否`:`不适用`},{label:`凭证`,value:(a==null?void 0:a.credentialSource)??`不适用`},{label:`受众`,value:a!=null&&a.audienceType?`${a.audienceType}${a.audience?` · ${a.audience}`:``}`:`不适用`},{label:`上次启动`,value:a!=null&&a.lastStartAt?r(a.lastStartAt):`不适用`},{label:`上次探测`,value:a!=null&&a.lastProbeAt?r(a.lastProbeAt):`不适用`}],lastError:a==null?void 0:a.lastError,secondaryCallout:a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
          ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.status??``}
          ${a.probe.error??``}
        </div>`:t,configSection:h({channelId:`googlechat`,props:i}),footer:e`<div class="row" style="margin-top: 12px;">
      <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
    </div>`})}function D(n){let{props:i,imessage:a,accountCountLabel:o}=n;return S({title:`iMessage`,subtitle:`macOS bridge status and channel configuration.`,accountCountLabel:o,statusRows:[{label:`已配置`,value:x(b(`imessage`,i))},{label:`运行中`,value:a!=null&&a.running?`是`:`否`},{label:`上次启动`,value:a!=null&&a.lastStartAt?r(a.lastStartAt):`不适用`},{label:`上次探测`,value:a!=null&&a.lastProbeAt?r(a.lastProbeAt):`不适用`}],lastError:a==null?void 0:a.lastError,secondaryCallout:a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
          ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.error??``}
        </div>`:t,configSection:h({channelId:`imessage`,props:i}),footer:e`<div class="row" style="margin-top: 12px;">
      <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
    </div>`})}function O(e){return e?e.length<=20?e:`${e.slice(0,8)}...${e.slice(-8)}`:`不适用`}function k(n){let{props:i,nostr:o,nostrAccounts:s,accountCountLabel:c,profileFormState:l,profileFormCallbacks:u,onEditProfile:d}=n,f=s[0],p=(o==null?void 0:o.configured)??(f==null?void 0:f.configured)??!1,m=(o==null?void 0:o.running)??(f==null?void 0:f.running)??!1,g=(o==null?void 0:o.publicKey)??(f==null?void 0:f.publicKey),_=(o==null?void 0:o.lastStartAt)??(f==null?void 0:f.lastStartAt)??null,v=(o==null?void 0:o.lastError)??(f==null?void 0:f.lastError)??null,y=s.length>1,b=l!=null,x=n=>{let i=n.publicKey,a=n.profile;return e`
      <div class="account-card">
        <div class="account-card-header">
          <div class="account-card-title">${(a==null?void 0:a.displayName)??(a==null?void 0:a.name)??n.name??n.accountId}</div>
          <div class="account-card-id">${n.accountId}</div>
        </div>
        <div class="status-list account-card-status">
          <div>
            <span class="label">${`运行中`}</span>
            <span>${n.running?`是`:`否`}</span>
          </div>
          <div>
            <span class="label">${`已配置`}</span>
            <span>${n.configured?`是`:`否`}</span>
          </div>
          <div>
            <span class="label">${`公钥`}</span>
            <span class="monospace" title="${i??``}">${O(i)}</span>
          </div>
          <div>
            <span class="label">${`上次入站`}</span>
            <span
              >${n.lastInboundAt?r(n.lastInboundAt):`不适用`}</span
            >
          </div>
          ${n.lastError?e` <div class="account-card-error">${n.lastError}</div> `:t}
        </div>
      </div>
    `};return e`
    <div class="card">
      <div class="card-title">Nostr</div>
      <div class="card-sub">Decentralized DMs via Nostr relays (NIP-04).</div>
      ${c}
      ${y?e`
            <div class="account-card-list">
              ${s.map(e=>x(e))}
            </div>
          `:e`
            <div class="status-list" style="margin-top: 16px;">
              <div>
                <span class="label">${`已配置`}</span>
                <span>${p?`是`:`否`}</span>
              </div>
              <div>
                <span class="label">${`运行中`}</span>
                <span>${m?`是`:`否`}</span>
              </div>
              <div>
                <span class="label">${`公钥`}</span>
                <span class="monospace" title="${g??``}"
                  >${O(g)}</span
                >
              </div>
              <div>
                <span class="label">${`上次启动`}</span>
                <span>
                  ${_?r(_):`不适用`}
                </span>
              </div>
            </div>
          `}
      ${v?e`<div class="callout danger" style="margin-top: 12px;">${v}</div>`:t}
      ${(()=>{if(b&&u){var n;return a({state:l,callbacks:u,accountId:((n=s[0])==null?void 0:n.accountId)??`default`})}let{name:r,displayName:i,about:c,picture:m,nip05:h}=(f==null?void 0:f.profile)??(o==null?void 0:o.profile)??{},g=r||i||c||m||h;return e`
      <div
        style="margin-top: 16px; padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-md);"
      >
        <div
          style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;"
        >
          <div style="font-weight: 500;">${`个人资料`}</div>
          ${p?e`
                <button
                  class="btn btn--sm"
                  @click=${d}
                  style="font-size: 12px; padding: 4px 8px;"
                >
                  ${`编辑个人资料`}
                </button>
              `:t}
        </div>
        ${g?e`
              <div class="status-list">
                ${m?e`
                      <div style="margin-bottom: 8px;">
                        <img
                          src=${m}
                          alt=${`头像`}
                          style="width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color);"
                          @error=${e=>{e.target.style.display=`none`}}
                        />
                      </div>
                    `:t}
                ${r?e`<div><span class="label">${`姓名`}</span><span>${r}</span></div>`:t}
                ${i?e`<div>
                      <span class="label">${`显示名称`}</span><span>${i}</span>
                    </div>`:t}
                ${c?e`<div>
                      <span class="label">${`关于`}</span
                      ><span style="max-width: 300px; overflow: hidden; text-overflow: ellipsis;"
                        >${c}</span
                      >
                    </div>`:t}
                ${h?e`<div><span class="label">NIP-05</span><span>${h}</span></div>`:t}
              </div>
            `:e`
              <div style="color: var(--text-muted); font-size: 13px">
                ${`尚未设置个人资料。`} ${`点击“编辑个人资料”以添加你的姓名、简介和头像。`}
              </div>
            `}
      </div>
    `})()} ${h({channelId:`nostr`,props:i})}

      <div class="row" style="margin-top: 12px;">
        <button class="btn" @click=${()=>i.onRefresh(!1)}>${`刷新`}</button>
      </div>
    </div>
  `}function A(n){let{props:i,signal:a,accountCountLabel:o}=n;return S({title:`Signal`,subtitle:`signal-cli status and channel configuration.`,accountCountLabel:o,statusRows:[{label:`已配置`,value:x(b(`signal`,i))},{label:`运行中`,value:a!=null&&a.running?`是`:`否`},{label:`基础 URL`,value:(a==null?void 0:a.baseUrl)??`不适用`},{label:`上次启动`,value:a!=null&&a.lastStartAt?r(a.lastStartAt):`不适用`},{label:`上次探测`,value:a!=null&&a.lastProbeAt?r(a.lastProbeAt):`不适用`}],lastError:a==null?void 0:a.lastError,secondaryCallout:a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
          ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.status??``}
          ${a.probe.error??``}
        </div>`:t,configSection:h({channelId:`signal`,props:i}),footer:e`<div class="row" style="margin-top: 12px;">
      <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
    </div>`})}function j(n){let{props:i,slack:a,accountCountLabel:o}=n;return S({title:`Slack`,subtitle:`Socket mode status and channel configuration.`,accountCountLabel:o,statusRows:[{label:`已配置`,value:x(b(`slack`,i))},{label:`运行中`,value:a!=null&&a.running?`是`:`否`},{label:`上次启动`,value:a!=null&&a.lastStartAt?r(a.lastStartAt):`不适用`},{label:`上次探测`,value:a!=null&&a.lastProbeAt?r(a.lastProbeAt):`不适用`}],lastError:a==null?void 0:a.lastError,secondaryCallout:a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
          ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.status??``}
          ${a.probe.error??``}
        </div>`:t,configSection:h({channelId:`slack`,props:i}),footer:e`<div class="row" style="margin-top: 12px;">
      <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
    </div>`})}function M(n){let{props:i,telegram:a,telegramAccounts:o,accountCountLabel:s}=n,c=o.length>1,l=b(`telegram`,i),u=n=>{var i;let a=n.probe,o=a==null||(i=a.bot)==null?void 0:i.username,s=n.name||n.accountId;return e`
      <div class="account-card">
        <div class="account-card-header">
          <div class="account-card-title">${o?`@${o}`:s}</div>
          <div class="account-card-id">${n.accountId}</div>
        </div>
        <div class="status-list account-card-status">
          <div>
            <span class="label">${`运行中`}</span>
            <span>${n.running?`是`:`否`}</span>
          </div>
          <div>
            <span class="label">${`已配置`}</span>
            <span>${n.configured?`是`:`否`}</span>
          </div>
          <div>
            <span class="label">${`上次入站`}</span>
            <span
              >${n.lastInboundAt?r(n.lastInboundAt):`不适用`}</span
            >
          </div>
          ${n.lastError?e` <div class="account-card-error">${n.lastError}</div> `:t}
        </div>
      </div>
    `};return c?e`
      <div class="card">
        <div class="card-title">Telegram</div>
        <div class="card-sub">Bot status and channel configuration.</div>
        ${s}

        <div class="account-card-list">
          ${o.map(e=>u(e))}
        </div>

        ${a!=null&&a.lastError?e`<div class="callout danger" style="margin-top: 12px;">${a.lastError}</div>`:t}
        ${a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
              ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.status??``}
              ${a.probe.error??``}
            </div>`:t}
        ${h({channelId:`telegram`,props:i})}

        <div class="row" style="margin-top: 12px;">
          <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
        </div>
      </div>
    `:S({title:`Telegram`,subtitle:`Bot status and channel configuration.`,accountCountLabel:s,statusRows:[{label:`已配置`,value:x(l)},{label:`运行中`,value:a!=null&&a.running?`是`:`否`},{label:`模式`,value:(a==null?void 0:a.mode)??`不适用`},{label:`上次启动`,value:a!=null&&a.lastStartAt?r(a.lastStartAt):`不适用`},{label:`上次探测`,value:a!=null&&a.lastProbeAt?r(a.lastProbeAt):`不适用`}],lastError:a==null?void 0:a.lastError,secondaryCallout:a!=null&&a.probe?e`<div class="callout" style="margin-top: 12px;">
          ${a.probe.ok?`探测成功`:`探测失败`} · ${a.probe.status??``}
          ${a.probe.error??``}
        </div>`:t,configSection:h({channelId:`telegram`,props:i}),footer:e`<div class="row" style="margin-top: 12px;">
      <button class="btn" @click=${()=>i.onRefresh(!0)}>${`探测`}</button>
    </div>`})}function N(i){let{props:a,whatsapp:o,accountCountLabel:s}=i;return S({title:`WhatsApp`,subtitle:`Link WhatsApp Web and monitor connection health.`,accountCountLabel:s,statusRows:[{label:`已配置`,value:x(b(`whatsapp`,a))},{label:`已关联`,value:o!=null&&o.linked?`是`:`否`},{label:`运行中`,value:o!=null&&o.running?`是`:`否`},{label:`已连接`,value:o!=null&&o.connected?`是`:`否`},{label:`上次连接`,value:o!=null&&o.lastConnectedAt?r(o.lastConnectedAt):`不适用`},{label:`上条消息`,value:o!=null&&o.lastMessageAt?r(o.lastMessageAt):`不适用`},{label:`认证时长`,value:(o==null?void 0:o.authAgeMs)==null?`不适用`:n(o.authAgeMs)}],lastError:o==null?void 0:o.lastError,extraContent:e`
      ${a.whatsappMessage?e`<div class="callout" style="margin-top: 12px;">${a.whatsappMessage}</div>`:t}
      ${a.whatsappQrDataUrl?e`<div class="qr-wrap">
            <img src=${a.whatsappQrDataUrl} alt="WhatsApp QR" />
          </div>`:t}
    `,configSection:h({channelId:`whatsapp`,props:a}),footer:e`<div class="row" style="margin-top: 14px; flex-wrap: wrap;">
      <button
        class="btn primary"
        ?disabled=${a.whatsappBusy}
        @click=${()=>a.onWhatsAppStart(!1)}
      >
        ${a.whatsappBusy?`处理中…`:`显示二维码`}
      </button>
      <button
        class="btn"
        ?disabled=${a.whatsappBusy}
        @click=${()=>a.onWhatsAppStart(!0)}
      >
        ${`重新关联`}
      </button>
      <button class="btn" ?disabled=${a.whatsappBusy} @click=${()=>a.onWhatsAppWait()}>
        ${`等待扫描`}
      </button>
      <button
        class="btn danger"
        ?disabled=${a.whatsappBusy}
        @click=${()=>a.onWhatsAppLogout()}
      >
        ${`退出登录`}
      </button>
      <button class="btn" @click=${()=>a.onRefresh(!0)}>${`刷新`}</button>
    </div>`})}function P(n){var i;let a=(i=n.snapshot)==null?void 0:i.channels,o=(a==null?void 0:a.whatsapp)??void 0,s=(a==null?void 0:a.telegram)??void 0,c=(a==null?void 0:a.discord)??null,l=(a==null?void 0:a.googlechat)??null,u=(a==null?void 0:a.slack)??null,d=(a==null?void 0:a.signal)??null,f=(a==null?void 0:a.imessage)??null,p=(a==null?void 0:a.nostr)??null;return e`
    <section class="grid grid-cols-2">
      ${F(n.snapshot).map((e,t)=>({key:e,enabled:y(e,n),order:t})).toSorted((e,t)=>e.enabled===t.enabled?e.order-t.order:e.enabled?-1:1).map(e=>{var t;return I(e.key,n,{whatsapp:o,telegram:s,discord:c,googlechat:l,slack:u,signal:d,imessage:f,nostr:p,channelAccounts:((t=n.snapshot)==null?void 0:t.channelAccounts)??null})})}
    </section>

    <section class="card" style="margin-top: 18px;">
      <div class="row" style="justify-content: space-between;">
        <div>
          <div class="card-title">${`频道健康状态`}</div>
          <div class="card-sub">${`来自 Gateway 的频道状态快照。`}</div>
        </div>
        <div class="muted">
          ${n.lastSuccessAt?r(n.lastSuccessAt):`不适用`}
        </div>
      </div>
      ${n.lastError?e`<div class="callout danger" style="margin-top: 12px;">${n.lastError}</div>`:t}
      <pre class="code-block" style="margin-top: 12px;">
${n.snapshot?JSON.stringify(n.snapshot,null,2):`尚无快照。`}
      </pre
      >
    </section>
  `}function F(e){var t,n;return!(e==null||(t=e.channelMeta)==null)&&t.length?e.channelMeta.map(e=>e.id):!(e==null||(n=e.channelOrder)==null)&&n.length?e.channelOrder:[`whatsapp`,`telegram`,`discord`,`googlechat`,`slack`,`signal`,`imessage`,`nostr`]}function I(e,t,n){let r=w(e,n.channelAccounts);switch(e){case`whatsapp`:return N({props:t,whatsapp:n.whatsapp,accountCountLabel:r});case`telegram`:var i;return M({props:t,telegram:n.telegram,telegramAccounts:((i=n.channelAccounts)==null?void 0:i.telegram)??[],accountCountLabel:r});case`discord`:return T({props:t,discord:n.discord,accountCountLabel:r});case`googlechat`:return E({props:t,googleChat:n.googlechat,accountCountLabel:r});case`slack`:return j({props:t,slack:n.slack,accountCountLabel:r});case`signal`:return A({props:t,signal:n.signal,accountCountLabel:r});case`imessage`:return D({props:t,imessage:n.imessage,accountCountLabel:r});case`nostr`:{var a;let e=((a=n.channelAccounts)==null?void 0:a.nostr)??[],i=e[0],o=(i==null?void 0:i.accountId)??`default`,s=(i==null?void 0:i.profile)??null,c=t.nostrProfileAccountId===o?t.nostrProfileFormState:null,l=c?{onFieldChange:t.onNostrProfileFieldChange,onSave:t.onNostrProfileSave,onImport:t.onNostrProfileImport,onCancel:t.onNostrProfileCancel,onToggleAdvanced:t.onNostrProfileToggleAdvanced}:null;return k({props:t,nostr:n.nostr,nostrAccounts:e,accountCountLabel:r,profileFormState:c,profileFormCallbacks:l,onEditProfile:()=>t.onNostrProfileEdit(o,s)})}default:return L(e,t,n.channelAccounts??{})}}function L(n,r,i){var a;let o=z(r.snapshot,n),s=v(n,r),c=typeof((a=s.status)==null?void 0:a.lastError)==`string`?s.status.lastError:void 0,l=i[n]??[];return e`
    <div class="card">
      <div class="card-title">${o}</div>
      <div class="card-sub">${`频道状态和配置。`}</div>
      ${w(n,i)}
      ${l.length>0?e`
            <div class="account-card-list">
              ${l.map(e=>W(e))}
            </div>
          `:e`
            <div class="status-list" style="margin-top: 16px;">
              <div>
                <span class="label">${`已配置`}</span>
                <span>${x(s.configured)}</span>
              </div>
              <div>
                <span class="label">${`运行中`}</span>
                <span>${x(s.running)}</span>
              </div>
              <div>
                <span class="label">${`已连接`}</span>
                <span>${x(s.connected)}</span>
              </div>
            </div>
          `}
      ${c?e`<div class="callout danger" style="margin-top: 12px;">${c}</div>`:t}
      ${h({channelId:n,props:r})}
    </div>
  `}function R(e){var t;return!(e==null||(t=e.channelMeta)==null)&&t.length?Object.fromEntries(e.channelMeta.map(e=>[e.id,e])):{}}function z(e,t){var n;let r=R(e)[t];return(r==null?void 0:r.label)??(e==null||(n=e.channelLabels)==null?void 0:n[t])??t}var B=600*1e3;function V(e){return e.lastInboundAt?Date.now()-e.lastInboundAt<B:!1}function H(e){return e.running?`是`:V(e)?`活跃`:`否`}function U(e){return e.connected===!0?`是`:e.connected===!1?`否`:V(e)?`活跃`:`不适用`}function W(n){let i=H(n),a=U(n);return e`
    <div class="account-card">
      <div class="account-card-header">
        <div class="account-card-title">${n.name||n.accountId}</div>
        <div class="account-card-id">${n.accountId}</div>
      </div>
      <div class="status-list account-card-status">
        <div>
          <span class="label">${`运行中`}</span>
          <span>${i}</span>
        </div>
        <div>
          <span class="label">${`已配置`}</span>
          <span>${n.configured?`是`:`否`}</span>
        </div>
        <div>
          <span class="label">${`已连接`}</span>
          <span>${a}</span>
        </div>
        <div>
          <span class="label">${`上次入站`}</span>
          <span
            >${n.lastInboundAt?r(n.lastInboundAt):`不适用`}</span
          >
        </div>
        ${n.lastError?e` <div class="account-card-error">${n.lastError}</div> `:t}
      </div>
    </div>
  `}export{P as renderChannels};
//# sourceMappingURL=channels-Bg8iwprB.js.map