const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GateVerificationLive-DrCthf7p.js","assets/vendor-lit-BtHfzs80.js","assets/index-rvuS68Al.js","assets/vendor-mini-lit-Cx886NBU.js","assets/vendor-lucide-DBEJLfdn.js","assets/vendor-marked-_iteVaMm.js","assets/vendor-sortable-B1o3v0Qs.js","assets/index-BXulo2kC.css","assets/VerificationOutputModal-2ybDDaDs.js","assets/delegate-cards-BUepigK_.js"])))=>i.map(i=>d[i]);
import{b as t,n as R,e as k}from"./vendor-lit-BtHfzs80.js";import{_ as A,au as I,aw as d,ax as S,av as G}from"./index-rvuS68Al.js";import{ad as o}from"./vendor-lucide-DBEJLfdn.js";import"./vendor-mini-lit-Cx886NBU.js";import"./vendor-marked-_iteVaMm.js";import"./vendor-sortable-B1o3v0Qs.js";let h=!1;function y(){h||(h=!0,A(()=>import("./GateVerificationLive-DrCthf7p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])))}function $(u){const f=u?.content?.filter(c=>c.type==="text").map(c=>c.text).join(`
`)||"";let e=null;try{e=JSON.parse(f)}catch{}return{text:f,data:e}}function L(u){const e={pending:"bg-muted text-muted-foreground",passed:"bg-green-500/20 text-green-600 dark:text-green-400",failed:"bg-red-500/20 text-red-600 dark:text-red-400",running:"bg-blue-500/20 text-blue-600 dark:text-blue-400"}[u]||"bg-muted text-muted-foreground";return t`<span class="px-1.5 py-0.5 rounded text-xs font-medium ${e}">${u}</span>`}class D{render(f,e,c){const i=I(e,c);if(!e)return{content:t`<div>${d(i,o,"Listing gates…")}</div>`,isCustom:!1};const{data:s,text:a}=$(e);if(e.isError){const n=S(e);return{content:t`<div>
					${d(i,o,n?"Aborted gate list":"Gate list failed")}
					<div class="mt-1 text-xs ${n?"text-amber-600 dark:text-amber-400":"text-destructive"}">${a}</div>
				</div>`,isCustom:!1}}const g=s?.gates||(Array.isArray(s)?s:[]);if(g.length===0)return{content:t`<div>${d(i,o,"No gates")}</div>`,isCustom:!1};const m=new Map;for(const n of g)m.set(n.status||"pending",(m.get(n.status||"pending")||0)+1);const r=Array.from(m.entries()).map(([n,p])=>`${p} ${n}`).join(", "),v=k(),l=k();return{content:t`<div>
				${G(i,o,t`${g.length} gates <span class="text-xs text-muted-foreground ml-1">(${r})</span>`,v,l,!1)}
				<div ${R(v)} class="max-h-0 overflow-hidden transition-all duration-300">
					<div class="mt-2 space-y-1">${g.map(n=>t`
						<div class="flex items-center gap-2 text-xs py-0.5">
							${L(n.status||"pending")}
							<span class="font-medium truncate">${n.name||n.gateId}</span>
							${n.dependsOn?.length?t`<span class="text-muted-foreground">← ${n.dependsOn.join(", ")}</span>`:""}
						</div>
					`)}</div>
				</div>
			</div>`,isCustom:!1}}}class F{render(f,e,c){y();const i=I(e,c),s=f?.gate_id||"gate";if(!e)return{content:t`<div>${d(i,o,t`Signaling <span class="font-mono">${s}</span>…`)}</div>`,isCustom:!1};if(e.isError){const{text:l}=$(e),n=S(e),p=l.includes("409")||l.toLowerCase().includes("upstream")||l.toLowerCase().includes("has not passed"),x=n||p?"text-amber-600 dark:text-amber-400":"text-destructive";return{content:t`<div>
					${d(i,o,n?t`Aborted signal for <span class="font-mono">${s}</span>`:t`Failed to signal <span class="font-mono">${s}</span>`)}
					<div class="mt-1 text-xs ${x}">${l}</div>
				</div>`,isCustom:!1}}const{data:a}=$(e),g=a?.signal?.id||"",m=a?.signal?.goalId||a?.goalId||"",r=a?.signal?.status||"";if(r==="passed"||r==="failed")return{content:t`<div>
					${d(i,o,t`Signaled <span class="font-mono">${s}</span>`)}
					<gate-verification-live
						.goalId=${m}
						.gateId=${s}
						.signalId=${g}
						.finalStatus=${r}
					></gate-verification-live>
				</div>`,isCustom:!1};const v=a?.signal?.steps||[];return{content:t`<div>
				${d(i,o,t`Signaled <span class="font-mono">${s}</span>`)}
				<gate-verification-live
					.goalId=${m}
					.gateId=${s}
					.signalId=${g}
					.initialSteps=${v}
				></gate-verification-live>
			</div>`,isCustom:!1}}}class H{render(f,e,c){y();const i=I(e,c),s=f?.gate_id||"gate";if(!e)return{content:t`<div>${d(i,o,t`Checking gate <span class="font-mono">${s}</span>…`)}</div>`,isCustom:!1};const{data:a,text:g}=$(e);if(e.isError){const C=S(e);return{content:t`<div>
					${d(i,o,C?t`Aborted check of gate <span class="font-mono">${s}</span>`:t`Failed to check gate <span class="font-mono">${s}</span>`)}
					<div class="mt-1 text-xs ${C?"text-amber-600 dark:text-amber-400":"text-destructive"}">${g}</div>
				</div>`,isCustom:!1}}if(!a)return{content:t`<div>${d(i,o,t`Gate <span class="font-mono">${s}</span>`)}</div>`,isCustom:!1};const m=a.name||a.gateId||s,r=a.status||"pending",v=a.dependsOn||[],l=a.signals||[],n=a.goalId||"",p=l.length>0?l[l.length-1]:null,x=p?.id||"",b=p?.verification?.status||"",_=r!=="pending"&&!p?t` — <span class="${r==="passed"?"text-green-600 dark:text-green-400":r==="failed"?"text-red-600 dark:text-red-400":""}">${r}</span>`:"";return{content:t`<div>
				${d(i,o,t`Gate <span class="font-mono">${m}</span>${_}`)}
				${v.length?t`<div class="text-xs text-muted-foreground mt-1">Depends on: ${v.join(", ")}</div>`:""}
				${p?t`
					<gate-verification-live
						.goalId=${n}
						.gateId=${s}
						.signalId=${x}
						.finalStatus=${b==="passed"||b==="failed"?b:void 0}
						.initialSteps=${p.verification?.steps||[]}
					></gate-verification-live>
				`:""}
			</div>`,isCustom:!1}}}export{D as GateListRenderer,F as GateSignalRenderer,H as GateStatusRenderer,L as gateBadge,$ as getResult};
