import { ChangeDetectionStrategy, Component, input } from '@angular/core'; interface SourceReference { step_id?: string; step_number?: number; call_id?: string; source_id?: string; } interface RecordedSource { id: string; kind: string; label: string; target_id: string; plugin_id: string; category: 'interface' | 'auxiliary'; references: SourceReference[]; reference_count: number; } interface SourceSummary { sources: RecordedSource[]; total_sources: number; sources_omitted: number; unattributed_step_count: number; note: string; } @Component({ selector: 'app-evidence-sources', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `@if (value(); as summary) {
证据来源 · {{ summary.total_sources ? summary.total_sources + ' 个' : '未记录' }}

{{ summary.note }}

@for (source of summary.sources; track source.id) {
{{ source.category === 'interface' ? '界面来源' : '辅助来源' }} · {{ kind(source.kind) }}
{{ source.label || source.target_id }}
目标 {{ source.target_id }}@if(source.plugin_id) { · 插件 {{ source.plugin_id }} } @if(source.reference_count > source.references.length) { 另 {{ source.reference_count - source.references.length }} 条引用见步骤记录。 }
} @if(summary.sources_omitted) {

另 {{ summary.sources_omitted }} 个来源见原始步骤记录。

} @if(summary.unattributed_step_count) {

来源未完整记录的步骤:{{ summary.unattributed_step_count }};不据此推断执行平台。

}
}`, styles: [` :host { display:block; margin:10px 0; } .sources { border:1px solid var(--app-border-control,#cbd5e1); border-radius:8px; padding:10px 12px; background:var(--app-surface,#fff); color:var(--app-text-control,#1e293b); font-size:12px; line-height:1.7; overflow-wrap:anywhere; } summary { cursor:pointer; font-weight:600; } article { border-top:1px solid var(--app-border-control,#cbd5e1); margin-top:8px; padding-top:8px; } p,small { color:var(--app-text-secondary,#475569); } ul { padding-left:20px; margin:4px 0; } code { font-size:11px; } `] }) export class EvidenceSourcesComponent { value = input(null); kind(kind: string): string { return ({android:'安卓界面', computer:'电脑界面', api:'接口数据', terminal:'终端', file:'文件', other:'其他'} as Record)[kind] || '来源类型未记录'; } }