import{b as s}from"./vendor-lit-B2r-dKc0.js";import{aC as x,aE as y}from"./app-session-runtime-CeFJDILJ.js";import{p as g,a as b}from"./proposal-rev-marker-BsTX0uwt.js";import{p as $}from"./vendor-lucide-B9Yl1Gez.js";import"./vendor-mini-lit-CpUQub-j.js";import"./vendor-marked-_iteVaMm.js";import"./app-review-C3CmcSYC.js";import"./app-panel-workspace-C3XDRCgE.js";import"./app-routing-C_r2pdnC.js";import"./app-message-reducer-wATqnZGf.js";import"./vendor-sortable-B1o3v0Qs.js";import"./app-inbox-CaZD85aD.js";import"./app-pr-walkthrough-WipZACSB.js";function E(t){if(!t)return null;if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t;if(typeof t=="string")try{return JSON.parse(t)}catch{return null}return null}function d(t,n=120){return t?t.length>n?t.slice(0,n)+"…":t:""}class D{render(n,r,l){const c=x(r,l),o=E(n)||{},i=typeof o.type=="string"?o.type:"",u=typeof o.old_text=="string"?o.old_text:"",f=typeof o.new_text=="string"?o.new_text:"",e=g(r),p=b(r),m=!!r?.isError||r!==void 0&&e===void 0,v=a=>{a.preventDefault(),a.stopPropagation(),!(typeof e!="number"||e<=0||!i)&&document.dispatchEvent(new CustomEvent("proposal-open",{detail:{type:i,rev:e}}))};return{content:s`
				<div class="space-y-2">
					${y(c,$,i?`Edit ${i} draft`:"Edit draft")}
					<div class="text-xs space-y-1 font-mono whitespace-pre-wrap break-words">
						<div><span class="text-red-500">\u2212</span> ${d(u,120)}</div>
						<div><span class="text-green-500">+</span> ${d(f,120)}</div>
					</div>
					${typeof e=="number"&&e>0?s`
						<div class="text-xs text-muted-foreground" data-testid="proposal-rev">rev ${e}</div>
					`:""}
					${m&&p?s`
						<div class="text-xs text-red-500" data-testid="edit-proposal-error-code">${p}</div>
					`:""}
					${r&&typeof e=="number"&&e>0?s`
						<div class="flex justify-end">
							<button
								@click=${v}
								class="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded bg-primary/10 text-primary hover:bg-primary/20 transition-colors cursor-pointer"
								data-testid="proposal-open-button"
							>
								Open proposal
							</button>
						</div>
					`:""}
				</div>
			`,isCustom:!1}}}export{D as EditProposalRenderer};
