import{b as e,n as D,e as w}from"./vendor-lit-B2r-dKc0.js";import{aC as C,aE as m,aF as k,aD as E}from"./app-session-runtime-CeFJDILJ.js";import{a as I}from"./vendor-mini-lit-CpUQub-j.js";import{aD as h,aE as y,aF as v,aG as F,aH as L,Z as S}from"./vendor-lucide-B9Yl1Gez.js";import"./app-review-C3CmcSYC.js";import"./app-panel-workspace-C3XDRCgE.js";import"./app-routing-C_r2pdnC.js";import"./vendor-marked-_iteVaMm.js";import"./app-message-reducer-wATqnZGf.js";import"./vendor-sortable-B1o3v0Qs.js";import"./app-inbox-CaZD85aD.js";import"./app-pr-walkthrough-WipZACSB.js";function $(t){const s=t?.content?.filter(o=>o.type==="text").map(o=>o.text).join(`
`)||"";let n=null;try{n=JSON.parse(s)}catch{}return{text:s,data:n}}function g(t,s=60){return t?t.length>s?t.slice(0,s)+"…":t:""}function A(t){return!t||typeof t!="string"?"":t.length>8?t.slice(0,8):t}function T(t){if(!t||typeof t!="number")return"";const s=Math.max(0,Date.now()-t),n=Math.floor(s/1e3);if(n<60)return"now";const o=Math.floor(n/60);if(o<60)return`${o}m`;const r=Math.floor(o/60);if(r<24)return`${r}h`;const a=Math.floor(r/24);return a<30?`${a}d`:`${Math.floor(a/30)}mo`}function M(t){const n={pending:"bg-blue-500/20 text-blue-600 dark:text-blue-400",completed:"bg-green-500/20 text-green-600 dark:text-green-400",failed:"bg-red-500/20 text-red-600 dark:text-red-400",cancelled:"bg-muted text-muted-foreground line-through"}[t]||"bg-muted text-muted-foreground";return e`<span class="px-1.5 py-0.5 rounded text-xs font-medium ${n}">${t}</span>`}function _(t){const s=t?.type||"";let n="",o=null;switch(s){case"trigger":n="trigger",o=S;break;case"manual_api":n="api",o=L;break;case"manual_ui":n="ui",o=F;break;default:return e``}return e`
		<span class="inline-flex items-center gap-1 text-xs text-muted-foreground">
			<span class="inline-block">${I(o,"sm")}</span>
			${n}
		</span>
	`}function H(t){const s=A(t);return s?e`<span class="font-mono text-xs text-muted-foreground">${s}</span>`:e``}function j(t){return e`
		<div class="flex items-center gap-2 text-xs py-0.5 min-w-0">
			${M(t.state||"pending")}
			${_(t.source)}
			<span class="font-medium truncate flex-1 min-w-0">${g(t.title||"Untitled",60)}</span>
			${t.createdAt?e`<span class="text-xs text-muted-foreground shrink-0">${T(t.createdAt)}</span>`:""}
			${H(t.id)}
		</div>
	`}class Q{render(s,n,o){const r=C(n,o),a=s?.state||"pending";if(!n)return{content:e`<div>${m(r,v,e`Listing inbox <span class="text-xs text-muted-foreground">(${a})</span>…`)}</div>`,isCustom:!1};const{data:i,text:c}=$(n);if(n.isError){const l=k(n);return{content:e`<div>
					${m(r,v,l?"Aborted inbox list":"Inbox list failed")}
					<div class="mt-1 text-xs ${l?"text-amber-600 dark:text-amber-400":"text-destructive"}">${c}</div>
				</div>`,isCustom:!1}}const d=i?.entries||(Array.isArray(i)?i:[]);if(d.length===0)return{content:e`<div>${m(r,v,e`No ${a} entries`)}</div>`,isCustom:!1};const x=new Map;for(const l of d)x.set(l.state||"pending",(x.get(l.state||"pending")||0)+1);const p=Array.from(x.entries()).map(([l,R])=>`${R} ${l}`).join(", "),u=w(),f=w(),b=`${d.length} inbox ${d.length===1?"entry":"entries"}`;return{content:e`<div>
				${E(r,v,e`${b} <span class="text-xs text-muted-foreground ml-1">(${p})</span>`,u,f,!1)}
				<div ${D(u)} class="max-h-0 overflow-hidden transition-all duration-300">
					<div class="mt-2 space-y-1">${d.map(j)}</div>
				</div>
			</div>`,isCustom:!1}}}class V{render(s,n,o){const r=C(n,o),a=A(s?.entry_id);if(!n)return{content:e`<div>${m(r,h,e`Completing <span class="font-mono text-xs">${a}</span>…`)}</div>`,isCustom:!1};if(n.isError){const{text:x}=$(n),p=k(n),u=p?e`Aborted completing <span class="font-mono text-xs">${a}</span>`:e`Failed to complete <span class="font-mono text-xs">${a}</span>`,f=p?"text-amber-600 dark:text-amber-400":"text-destructive";return{content:e`<div>
					${m(r,h,u)}
					<div class="mt-1 text-xs ${f}">${x}</div>
				</div>`,isCustom:!1}}const{data:i}=$(n),c=i?.title?g(i.title,50):"",d=s?.summary||i?.result;return{content:e`<div>
				${m(r,h,e`Completed <span class="font-mono text-xs">${a}</span>
						${c?e`<span class="font-medium text-xs">${c}</span>`:""}
						${M("completed")}`)}
				${d?e`<div class="mt-1 text-xs text-muted-foreground">${g(d,240)}</div>`:""}
			</div>`,isCustom:!1}}}class W{render(s,n,o){const r=C(n,o),a=A(s?.entry_id),i=s?.outcome||"";if(!n)return{content:e`<div>${m(r,y,e`Dismissing <span class="font-mono text-xs">${a}</span>${i?e` <span class="text-xs text-muted-foreground">(${i})</span>`:""}…`)}</div>`,isCustom:!1};if(n.isError){const{text:u}=$(n),f=k(n),b=f?e`Aborted dismissing <span class="font-mono text-xs">${a}</span>`:e`Failed to dismiss <span class="font-mono text-xs">${a}</span>`,l=f?"text-amber-600 dark:text-amber-400":"text-destructive";return{content:e`<div>
					${m(r,y,b)}
					<div class="mt-1 text-xs ${l}">${u}</div>
				</div>`,isCustom:!1}}const{data:c}=$(n),d=c?.title?g(c.title,50):"",x=c?.state||i||"failed",p=s?.reason||c?.error;return{content:e`<div>
				${m(r,y,e`Dismissed <span class="font-mono text-xs">${a}</span>
						${d?e`<span class="font-medium text-xs">${d}</span>`:""}
						${M(x)}`)}
				${p?e`<div class="mt-1 text-xs text-muted-foreground">${g(p,240)}</div>`:""}
			</div>`,isCustom:!1}}}export{V as InboxCompleteRenderer,W as InboxDismissRenderer,Q as InboxListRenderer};
