1import{v as ie,y as m,a4 as xe,U as be,h,d as Dt,C as zt,S as Mt,P as He,s as Lt,D as Et,E as qt,c as n,a as s,j as re,w as Ge,i as d,t as o,F as R,n as O,g as L,e as j,b as de,f as S,r as G,I as te,W as ge,T as Ke,L as Bt,_ as Ut,o as l,H as fe,J as Qe}from"./-Guljtto.js";import{_ as jt,A as Pt,a as Vt,p as Ot,b as Nt,u as Ht,c as Gt,d as Kt,I as Qt,r as Zt}from"./Df1yyWzT.js";import{u as Jt,n as $e,_ as Wt,a as Xt,d as Ae,b as Yt,A as es,g as ts}from"./DiDTylG_.js";import{e as ss}from"./wY6eMctq.js";import{a as Te}from"./D0G1-iW3.js";import{g as Fe,c as Ze,d as as,e as ls}from"./CaWhbIuH.js";import{_ as ns}from"./88Xunaqu.js";import{_ as os}from"./DlAUqK2U.js";import"./LG6eIpGy.js";import"./BT8TPNEc.js";import"./DdIFmJcZ.js";function is(c){const x=m("idle"),I=m([]),p=m(new Set),z=m(null),u=m(null);async function N(){z.value=null;try{const i=await $fetch(`/api/videos/${c()}/ai-suggest`,{method:"GET"});return I.value=i.suggestions||[],u.value=i.metrics||null,p.value=new Set,I.value.length&&(x.value="ready"),I.value}catch{return[]}}const $=()=>I.value.filter(i=>!p.value.has(i.suggestion_id));async function X(){x.value="loading",z.value=null;try{const i=await $fetch(`/api/videos/${c()}/ai-suggest`,{method:"POST"});return I.value=i.suggestions||[],u.value=i.metrics||null,p.value=new Set,x.value="ready",I.value}catch(i){x.value="error";const _=i?.statusMessage||i?.data?.message||i?.message||"AI suggestions are currently unavailable.";return z.value=_,I.value=[],[]}}async function v(i,_){try{await $fetch(`/api/videos/${c()}/ai-suggestions/${encodeURIComponent(i)}`,{method:"PATCH",body:{status:_}})}catch{}}async function T(i){if(!p.value.has(i)){const _=new Set(p.value);_.add(i),p.value=_,await v(i,"dismissed")}}async function b(i){if(I.value=I.value.filter(_=>_.suggestion_id!==i),p.value.has(i)){const _=new Set(p.value);_.delete(i),p.value=_}await v(i,"saved")}function C(){x.value="idle",I.value=[],p.value=new Set,z.value=null,u.value=null}return{state:ie(x),suggestions:ie(I),dismissed:ie(p),visibleSuggestions:$,error:ie(z),metrics:ie(u),loadPersistedSuggestions:N,fetchSuggestions:X,dismissSuggestion:T,removeSuggestion:b,reset:C}}function Re(c){return{id:String(c.id),issueId:c.issueId??null,keyframeId:c.keyframeId??null,mediaId:c.mediaId??null,authorId:String(c.authorId),kind:c.kind,geometry:c.geometry??{},style:c.style??{color:"#FF3366",strokeWidth:.003},body:c.body??null,createdAt:c.createdAt,updatedAt:c.updatedAt}}function rs(c){const x={};return c.issueId&&(x.issueId=c.issueId),c.keyframeId&&(x.keyframeId=c.keyframeId),c.mediaId&&(x.mediaId=c.mediaId),x}function ds(){try{const c=xe("auth:dbUserId",()=>null);if(c.value)return c.value}catch{}return"anonymous"}function us(c){const x=h(()=>c.issueId?`issue:${c.issueId}`:c.keyframeId?`keyframe:${c.keyframeId}`:c.mediaId?`media:${c.mediaId}`:"none"),I=h(()=>`annotations:list:${x.value}`),p=xe(I.value,()=>[]),z=xe(`${I.value}:loading`,()=>!1),u=xe(`${I.value}:error`,()=>null);let N=0;async function $(){const b=x.value,C=++N;z.value=!0,u.value=null;try{const i=await $fetch("/api/annotations",{query:rs(c)});if(C!==N||b!==x.value)return;p.value=(i.annotations||[]).map(Re)}catch(i){if(C!==N||b!==x.value)return;u.value=i?.data?.message||i?.message||"Failed to load annotations"}finally{C===N&&b===x.value&&(z.value=!1)}}async function X(b){const C=x.value;u.value=null;try{const i=await $fetch("/api/annotations",{method:"POST",body:{...b,issueId:b.issueId??c.issueId??null,keyframeId:b.keyframeId??c.keyframeId??null,mediaId:b.mediaId??c.mediaId??null}}),_=Re(i);return C!==x.value?null:(p.value=[...p.value,_],_)}catch(i){return u.value=i?.data?.message||i?.message||"Failed to create annotation",null}}async function v(b,C){const i=x.value;u.value=null;try{const _=await $fetch(`/api/annotations/${b}`,{method:"PATCH",body:C}),K=Re(_);return i!==x.value?null:(p.value=p.value.map(Y=>Y.id===b?K:Y),K)}catch(_){return u.value=_?.data?.message||_?.message||"Failed to update annotation",null}}async function T(b){const C=x.value;u.value=null;try{return await $fetch(`/api/annotations/${b}`,{method:"DELETE"}),C!==x.value?!1:(p.value=p.value.filter(i=>i.id!==b),!0)}catch(i){return u.value=i?.data?.message||i?.message||"Failed to delete annotation",!1}}return be(x,async b=>{if(b==="none"){p.value=[];return}await $()},{immediate:!0}),{annotations:p,loading:z,error:u,load:$,create:X,update:v,remove:T,authorId:ds()}}const cs={class:"image-review min-h-[calc(100vh-56px)] bg-gray-50"},vs={class:"bg-white border-b border-gray-200 px-6 py-3"},ms={class:"max-w-7xl mx-auto flex items-center gap-3 text-sm text-gray-600 flex-wrap"},ys={key:1,class:"text-gray-300"},ps=["title"],gs=["title"],fs={class:"flex items-center gap-1.5"},xs={class:"ml-auto flex items-center gap-2"},bs={key:0,class:"max-w-7xl mx-auto px-6 pt-4"},_s={class:"max-w-7xl mx-auto px-6 pt-6"},hs={class:"bg-white border border-gray-200 rounded-xl px-6 py-4 flex flex-wrap items-center gap-4"},ks={class:"text-lg font-semibold text-gray-900","data-testid":"summary-total"},ws={key:0,class:"inline-flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-full bg-rose-100 text-rose-600"},Cs={key:1,class:"inline-flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-full bg-orange-100 text-orange-600"},Ss={key:2,class:"inline-flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-full bg-yellow-100 text-yellow-700"},Is={key:3,class:"inline-flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-full bg-sky-100 text-sky-600"},$s={key:4,class:"text-sm text-gray-500 ml-auto"},As={key:2,class:"max-w-7xl mx-auto px-6 py-12"},Ts={key:3,class:"max-w-7xl mx-auto px-6 py-12 text-center"},Fs={key:4,class:"max-w-7xl mx-auto px-6 py-6 space-y-6"},Rs={class:"grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_340px] gap-6 items-start"},Ds={class:"space-y-3"},zs={class:"flex items-center justify-between"},Ms={class:"bg-white border border-gray-200 rounded-xl overflow-hidden image-annotation-shell"},Ls={class:"flex items-center justify-between text-xs text-gray-500"},Es={key:0,class:"text-amber-600 font-medium"},qs={key:0,class:"space-y-4 xl:sticky xl:top-20"},Bs={class:"bg-white border border-gray-200 rounded-xl p-4 space-y-3"},Us={class:"flex items-center justify-between"},js={key:0,class:"text-xs text-gray-500"},Ps={key:0,class:"text-sm text-gray-600 space-y-2"},Vs={key:1,class:"flex flex-col items-center justify-center py-8 gap-2 text-sm text-gray-500"},Os={key:2,class:"rounded-md border border-error/40 bg-error-subtle p-3 text-sm space-y-2"},Ns={class:"text-gray-700"}
1,Hs={key:3,class:"space-y-2"},Gs={key:0,class:"text-sm text-gray-500 italic"},Ks={class:"flex items-start justify-between gap-2"},Qs={class:"text-sm font-medium text-gray-900 leading-snug"},Zs={key:0,class:"text-xs text-gray-600 leading-relaxed"},Js={class:"flex items-center gap-1.5 text-[11px] text-gray-500"},Ws={class:"px-1.5 py-0.5 rounded bg-gray-100 text-gray-700 font-medium uppercase tracking-wide"},Xs={class:"ml-auto"},Ys={class:"flex items-center gap-1 pt-1"},ea=["disabled","onClick"],ta=["onClick"],sa={class:"space-y-4","data-testid":"image-issues-section"},aa={class:"flex items-center gap-4 flex-wrap"},la={class:"flex items-center gap-2 text-sm text-gray-600 cursor-pointer select-none"},na=["checked","indeterminate"],oa={key:1,class:"flex items-center gap-3 bg-indigo-50 border border-primary/30 rounded-lg px-4 py-2","data-testid":"image-issues-bulk-actions"},ia={class:"text-sm font-medium text-primary"},ra={class:"flex items-center gap-2 ml-auto"},da={class:"flex items-center gap-1.5"},ua=["onClick"],ca={class:"flex items-center gap-1.5",role:"group","aria-label":"Filter issues by reviewer source"},va=["aria-pressed","onClick"],ma={key:0,class:"text-xs bg-primary text-white rounded-full w-4 h-4 flex items-center justify-center"},ya={key:0,class:"absolute right-0 top-full mt-1 w-52 bg-white border border-gray-200 rounded-xl shadow-lg z-30 p-3 space-y-1"},pa=["checked","onChange"],ga={class:"text-gray-700 capitalize"},fa={key:0,class:"border-t border-gray-100 pt-1.5 mt-1.5"},xa=["value"],ba={key:0,class:"bg-white border border-gray-200 rounded-xl p-4 space-y-3"},_a={key:1,class:"text-center py-12 bg-white border border-gray-200 rounded-xl"},ha={class:"text-gray-500 mb-5"},ka={key:2,class:"text-center py-12 bg-white border border-gray-200 rounded-xl"},wa={key:3,class:"max-h-[40rem] overflow-auto overscroll-contain bg-white border border-gray-200 rounded-xl","data-testid":"image-issues-table"},Ca={class:"w-full text-sm"},Sa={class:"divide-y divide-gray-100"},Ia=["id","onClick"],$a=["checked","onChange"],Aa={class:"px-3 py-3 align-top"},Ta={class:"px-3 py-3 align-top min-w-0"},Fa={class:"flex items-start gap-2"},Ra={class:"min-w-0 flex-1"},Da={key:0,class:"mt-1 text-xs text-gray-500 leading-relaxed line-clamp-2"},za={key:0,class:"inline-flex items-center gap-1 text-xs font-medium px-2 py-0.5 rounded-md bg-indigo-50 text-primary shrink-0"},Ma={key:1,class:"inline-flex items-center text-xs font-semibold px-2 py-0.5 rounded-md bg-emerald-50 text-emerald-700 shrink-0","data-testid":"image-issue-exported-badge"},La={class:"px-3 py-3 align-top hidden md:table-cell"},Ea={class:"text-xs font-medium px-2 py-0.5 rounded-md bg-gray-100 text-gray-600 capitalize"},qa={class:"px-3 py-3 align-top hidden md:table-cell"},Ba={class:"flex flex-col items-start gap-1.5"},Ua={class:"text-xs font-medium text-gray-500 capitalize"},ja=["disabled","aria-label","onClick"],Pa={class:"px-3 py-3 align-top hidden lg:table-cell"},Va={class:"w-[84px] h-[52px] rounded-lg bg-gray-100 overflow-hidden flex items-center justify-center"},Oa=["src","alt"],Na={key:1,class:"w-7 h-7 text-gray-300",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},Ha={class:"px-4 py-3 align-top"},Ga={key:0,class:"bg-white"},Ka={colspan:"7",class:"px-4 py-4"},Qa={key:0,class:"space-y-3"},Za={class:"text-sm text-gray-700 leading-relaxed whitespace-pre-wrap"},Ja={class:"flex flex-wrap items-center gap-2 text-xs text-gray-500"},Wa={class:"px-2 py-1 rounded bg-gray-100"},Xa={key:0,class:"px-2 py-1 rounded bg-gray-100"},Ya={class:"px-2 py-1 rounded bg-gray-100"},el={class:"flex items-center gap-3 pt-1"},tl=["onClick"],sl=["onClick"],al={key:1,class:"space-y-4"},ll={class:"flex gap-4"},nl={class:"flex-1"},ol={class:"flex-1"},il=["value"],rl={key:0,class:"fixed inset-0 z-50 flex items-center justify-center"},dl={class:"relative bg-white rounded-2xl shadow-xl max-w-md w-full mx-4 p-6"},ul={class:"flex items-start gap-3 mb-4"},cl={key:0,class:"mt-3 bg-gray-50 rounded-lg px-3 py-2 text-sm text-gray-700"},vl={class:"flex justify-end gap-3 mt-6"},ml={key:0,class:"fixed inset-0 z-50 flex items-center justify-center"},yl={class:"relative bg-white rounded-2xl shadow-xl max-w-md w-full mx-4 p-6"},pl={class:"text-lg font-semibold text-gray-900 mb-2"},gl={class:"flex justify-end gap-3 mt-6"},fl=Dt({__name:"[id]",setup(c){const x=["visual","usability","accessibility","performance","content","navigation","functionality"],I=["severity_desc","severity_asc","title_asc","category_asc","created_desc"],p=zt(),z=Mt(),u=h(()=>ss(p.params.id)),N=h(()=>typeof p.query?.share=="string"?p.query.share:null),$=h(()=>!!N.value),X=Jt(N),v=m(null),T=m([]),b=m(!0),C=m(!1),i=m(null),_=m(null),K=m(!1),Y=m(!1),D=h(()=>v.value?.permissions?.can_edit_review_content===!0),ue=h(()=>!$.value&&v.value?.permissions?.can_view===!0),_e=m(!1),w=m([]),he=m(!1),ce=m(null),ve=m(0),E=m({}),q=m(null),Q=m(null),k=m(new Set),Z=m(new Set),ke=m(!1),se=m(!1),ae=m(!1),le=m(!1),ne=m(null),oe=m(!1),we=m(null),P=m(dt()),B=m(ut()),A=m(ct()),Je=[{value:"all",label:"All"},{value:"ai",label:"Auto"},{value:"human",label:"Manual"}],M=m(vt()),U=m(typeof p.query.label=="string"?p.query.label:""),g=He({title:"",description:"",severity:"medium",category:"visual",labels:[],report:$e({report:{reproduction_steps:["",""]}})}),De=h(()=>w.value.find(t=>
1t.id===Q.value)||null),ze=h(()=>[...new Set(w.value.flatMap(t=>t.labels||[]))].sort()),Me=He({mediaId:u.value}),me=us(Me),Le=m(null),ye=Ht({adapter:me,replaceCanvasId(t,e){const r=T.value.findIndex(f=>f.id===t);r>=0&&T.value.splice(r,1,e),Le.value?.reconcileAnnotationId(t,e)}}),F=is(()=>u.value),Ee=h(()=>F.suggestions.value.filter(t=>!F.dismissed.value.has(t.suggestion_id))),We=m(null),pe=h(()=>v.value?.filename?.trim()||(b.value?"Loading imageâ¦":"Review image")),qe=h(()=>as(v.value?.size_bytes??null)),Xe=h(()=>Ze(v.value?.status||(b.value?"loading":"unknown"))),Ye=h(()=>ls(v.value?.status||(b.value?"loading":"unknown")));function et(){v.value&&(v.value.status="queued",v.value.error_message=null)}const Be=h(()=>v.value?.created_at?Te(v.value.created_at):""),tt=h(()=>{const t=T.value.length;if(!t)return"No annotations yet â pick a tool and start marking up.";const e={};for(const r of T.value)e[r.kind]=(e[r.kind]||0)+1;return`${t} annotation${t===1?"":"s"}: ${Object.entries(e).map(([r,f])=>`${f} ${r}`).join(", ")}`}),st=h(()=>i.value?`/cycles/${i.value}`:"/cycles"),at=h(()=>i.value?"Cycle":"Cycles"),lt=h(()=>B.value.size>0||A.value.size>0||M.value!=="all"||!!U.value),nt=h(()=>{const t=[];for(const e of B.value)t.push(e.charAt(0).toUpperCase()+e.slice(1));for(const e of A.value)t.push(e.charAt(0).toUpperCase()+e.slice(1));return M.value!=="all"&&t.push(M.value==="ai"?"Auto":"Manual"),U.value&&t.push(`Label: ${U.value}`),t}),ot=h(()=>{let t=w.value;return B.value.size>0&&(t=t.filter(e=>B.value.has(e.severity))),A.value.size>0&&(t=t.filter(e=>A.value.has(e.category))),M.value==="ai"&&(t=t.filter(e=>e.is_ai_generated)),M.value==="human"&&(t=t.filter(e=>!e.is_ai_generated)),U.value&&(t=t.filter(e=>(e.labels||[]).includes(U.value))),t}),J=h(()=>{const t=[...ot.value];if(P.value==="severity_desc"){const e={critical:0,high:1,medium:2,low:3};t.sort((r,f)=>(e[r.severity]??9)-(e[f.severity]??9)||r.sort_order-f.sort_order)}else if(P.value==="severity_asc"){const e={low:0,medium:1,high:2,critical:3};t.sort((r,f)=>(e[r.severity]??9)-(e[f.severity]??9)||r.sort_order-f.sort_order)}else P.value==="title_asc"?t.sort((e,r)=>e.title.localeCompare(r.title)):P.value==="category_asc"?t.sort((e,r)=>e.category.localeCompare(r.category)||e.title.localeCompare(r.title)):P.value==="created_desc"&&t.sort((e,r)=>new Date(r.created_at||0).getTime()-new Date(e.created_at||0).getTime());return t}),it=h(()=>w.value.filter(t=>k.value.has(t.id))),Ce=h(()=>J.value.length>0&&J.value.every(t=>k.value.has(t.id))),rt=h(()=>k.value.size>0&&!Ce.value);function dt(){const t=p.query.sort;return I.includes(t)?t:"severity_desc"}function ut(){const t=p.query.severity;return t?new Set(t.split(",").filter(e=>["critical","high","medium","low"].includes(e))):new Set}function ct(){const t=p.query.category;return t?new Set(t.split(",").filter(e=>x.includes(e))):new Set}function vt(){const t=p.query.source;return t==="ai"||t==="human"?t:"all"}function Ue(t){const e=new Date().toISOString();return{id:String(t?.id??""),video_id:String(t?.video_id??t?.media_id??u.value),review_cycle_id:String(t?.review_cycle_id??v.value?.review_cycle_id??""),title:String(t?.title??"Untitled issue"),description:t?.description??null,severity:String(t?.severity??"medium"),category:String(t?.category??"visual"),timestamp_start:typeof t?.timestamp_start=="number"?t.timestamp_start:null,timestamp_end:typeof t?.timestamp_end=="number"?t.timestamp_end:null,is_ai_generated:t?.is_ai_generated!==!1,is_edited:!!t?.is_edited,edited_by:t?.edited_by??null,author_id:t?.author_id??null,confidence:typeof t?.confidence=="number"?t.confidence:null,status:String(t?.status??"open"),exported_at:typeof t?.exported_at=="string"?t.exported_at:null,sort_order:typeof t?.sort_order=="number"?t.sort_order:0,merged_into_id:t?.merged_into_id??null,merged_from_ids:Array.isArray(t?.merged_from_ids)?t.merged_from_ids:[],url:typeof t?.url=="string"?t.url:typeof t?.metadata?.url=="string"?t.metadata.url:null,route:typeof t?.route=="string"?t.route:typeof t?.metadata?.route=="string"?t.metadata.route:null,spoken_quote:typeof t?.spoken_quote=="string"?t.spoken_quote:typeof t?.metadata?.spoken_quote=="string"?t.metadata.spoken_quote:null,labels:Array.isArray(t?.labels)?t.labels:Array.isArray(t?.report?.labels)?t.report.labels:[],report:t?.report&&typeof t.report=="object"?t.report:t?.metadata?.report&&typeof t.metadata.report=="object"?t.metadata.report:null,provenance:t?.provenance??t?.report?.provenance??t?.metadata?.provenance??null,verified:!!(t?.verified??t?.report?.verified??t?.metadata?.verified??t?.metadata?.keyframe_verified),metadata:t?.metadata&&typeof t.metadata=="object"?t.metadata:null,keyframes:Array.isArray(t?.keyframes)?t.keyframes:[],created_at:t?.created_at??e,updated_at:t?.updated_at??t?.created_at??e}}function ee(){ve.value=w.value.length;const t={};for(const e of w.value)t[e.severity]=(t[e.severity]||0)+1;E.value=t}function je(t){const e=Array.isArray(t.keyframes)?t.keyframes[0]:null;return(e?ts(e):null)||v.value?.url||null}async function Pe(){!u.value||!D.value||(C.value=!0,await ye.sync(T.value),C.value=!await ye.flush())}let Se=0;async function Ve(){const t=++Se,e=u.value;b.value=!0;try{const r=$.value?await X.load():null,f=r?.mediaItems.find(a=>a.id===e),V=f&&r?{id:f.id,review_cycle_id:r.cycle.id,uploaded_by:"",filename:f.filename,description:null,mime_type:f.mimeType,media_type:f.mediaType,status:"completed",error_message:null,size_bytes:0,created_at:r.cycle.createdAt,url:f.signedReadUrl,url_expires_at:null,issue_count:r.issues.length,permissions:{scope:"external",role:"viewer",can_view:!0,can_edit_review_content:!1,can_upload_media:!1,can_view_roster:!1,can_manage_cycle:!1,can_manage_media:!1,can_manage_people:!1,can_manage_invitations:!1,can_manage_sharing:!1}}:await $fetch(`/api/videos/${e}`);if(t!==Se||e!==u.value)return;if(V.media_type!=="image"){z.replace(`/videos/${u.value}/issues`);return}if(v.value=V,i.value=V.review_cycle_id,$.value||await me.load(),t!==Se||e!==u.value)return;T.value=$.value?[]:me.annotations.value.map(a=>
1Ot(a)).filter(Boolean),$.value||ye.seed(me.annotations.value,T.value),C.value=!1,await Promise.all([H(),$.value?Promise.resolve():F.loadPersistedSuggestions()])}catch(r){console.error("Failed to load image:",r),v.value=null}finally{b.value=!1,await mt()}}async function H(){if(u.value){he.value=!0,ce.value=null;try{const t=$.value?await X.load():null,e=t?.cycle,r=t&&e?t.issues.map(a=>({...a,video_id:a.video_id??a.videoId??u.value,review_cycle_id:a.review_cycle_id??a.reviewCycleId??e.id,timestamp_start:a.timestamp_start??a.timestampStart??null,timestamp_end:a.timestamp_end??a.timestampEnd??null,is_ai_generated:a.is_ai_generated??a.isAiGenerated??!1,created_at:a.created_at??e.createdAt,updated_at:a.updated_at??e.createdAt,status:a.status??"open",labels:a.labels??[],keyframes:(a.keyframes??[]).map(y=>({...y,timestamp_seconds:y.timestamp_seconds??y.timestampSeconds,keyframe_url:y.keyframe_url??y.signedReadUrl}))})):null,[f,V]=r?[{issues:r},null]:await Promise.all([$fetch(`/api/videos/${u.value}/issues`),$fetch(`/api/videos/${u.value}/issues/summary`).catch(()=>null)]);w.value=Array.isArray(f.issues)?f.issues.map(Ue).filter(a=>a.id):[],V&&typeof V.total_count=="number"?(ve.value=V.total_count,E.value=V.severity_breakdown||{}):typeof f.total_count=="number"?(ve.value=f.total_count,E.value=f.severity_breakdown||{}):ee(),v.value&&(v.value.issue_count=w.value.length),k.value=new Set([...k.value].filter(a=>w.value.some(y=>y.id===a)))}catch(t){w.value=[],ee(),ce.value=t?.data?.message||t?.statusMessage||t?.message||"Failed to load saved issues."}finally{he.value=!1}}}async function mt(){const t=typeof p.query.issue=="string"?p.query.issue:null;t&&w.value.some(e=>e.id===t)&&await yt(t)}async function yt(t){J.value.some(e=>e.id===t)||(B.value=new Set,A.value=new Set,M.value="all",U.value=""),q.value=t,k.value=new Set([t]),await Bt(),document.getElementById(`issue-${t}`)?.scrollIntoView({behavior:"smooth",block:"center"})}async function Ie(){C.value&&(_e.value=!0,await Pe()),await F.fetchSuggestions()}async function pt(t){if(!_.value){_.value=t.suggestion_id;
1try{const e=t.primary_keyframe_id||(Array.isArray(t.keyframe_ids)?t.keyframe_ids[0]:null)||null,r=Array.isArray(t.keyframe_ids)&&t.keyframe_ids.length>0?t.keyframe_ids:e?[e]:[],f=Zt(t.region||null,e);await $fetch(`/api/videos/${u.value}/issues`,{method:"POST",body:{title:t.title,description:t.description||null,severity:t.severity||"medium",category:t.category||"visual",labels:t.labels||[],report:t.report||null,timestamp_start:null,timestamp_end:null,keyframe_ids:r,regions:f?[f]:[]}}),await F.removeSuggestion(t.suggestion_id),await H()}catch(e){console.error("Failed to save AI suggestion:",e)}finally{_.value=null}}}function gt(t){q.value=q.value===t?null:t,q.value!==t&&(Q.value=null)}function ft(t){const e=new Set(k.value);e.has(t)?e.delete(t):e.add(t),k.value=e}function xt(){Ce.value?Oe():k.value=new Set(J.value.map(t=>t.id))}function Oe(){k.value=new Set}function bt(t){const e=new Set(B.value);e.has(t)?e.delete(t):e.add(t),B.value=e,W()}function _t(t){const e=new Set(A.value);e.has(t)?e.delete(t):e.add(t),A.value=e,W()}function ht(){B.value=new Set,A.value=new Set,M.value="all",U.value="",W()}function W(){const t={};P.value!=="severity_desc"&&(t.sort=P.value),B.value.size>0&&(t.severity=[...B.value].join(",")),A.value.size>0&&(t.category=[...A.value].join(",")),M.value!=="all"&&(t.source=M.value),U.value&&(t.label=U.value),z.replace({query:t})}function kt(t){q.value=t.id,Q.value=t.id,g.title=t.title,g.description=t.description||"",g.severity=t.severity,g.category=t.category,g.labels=[...t.labels||[]],g.report=$e(t)}function wt(){Q.value=null}function Ct(t){t.title!==void 0&&(g.title=t.title),t.description!==void 0&&(g.description=t.description),t.severity!==void 0&&(g.severity=t.severity),t.category!==void 0&&(g.category=t.category),t.labels!==void 0&&(g.labels=[...t.labels]),t.report!==void 0&&(g.report=$e({...De.value,...g,report:t.report}))}async function St(){const t=Q.value;if(t)try{const e={title:g.title,description:g.description,severity:g.severity,category:g.category,labels:g.labels,report:g.report};await $fetch(`/api/videos/${u.value}/issues/${t}`,{method:"PATCH",body:e});const r=w.value.findIndex(f=>f.id===t);r>=0&&(w.value[r]={...w.value[r],...e,is_edited:!0,updated_at:new Date().toISOString()},ee()),Q.value=null}catch(e){console.error("Failed to save issue edits:",e)}}function It(t){ne.value=t,ae.value=!0}async function $t(){const t=ne.value;if(t)try{await $fetch(`/api/videos/${u.value}/issues/${t.id}`,{method:"DELETE"}),w.value=w.value.filter(e=>e.id!==t.id),k.value=new Set([...k.value].filter(e=>e!==t.id)),q.value===t.id&&(q.value=null),ee()}catch(e){console.error("Failed to delete issue:",e)}finally{ae.value=!1,ne.value=null}}async function At(){const t=[...k.value];try{await $fetch(`/api/videos/${u.value}/issues/bulk-delete`,{method:"POST",body:{issue_ids:t}}),w.value=w.value.filter(e=>!k.value.has(e.id)),k.value=new Set,ee()}catch(e){console.error("Failed to delete selected issues:",e)}finally{le.value=!1}}async function Tt(t){t?.id?(w.value.unshift(Ue(t)),ee(),q.value=t.id):await H()}async function Ft(t){if(!(!D.value||Z.value.has(t.id))){Z.value=new Set(Z.value).add(t.id);try{const e=await $fetch(`/api/cycles/${t.review_cycle_id}/issues/${t.id}/status`,{method:"PATCH",body:{completed:t.status!=="resolved",expected_updated_at:t.updated_at}});t.status=e.status,t.updated_at=e.updated_at}catch(e){(e?.statusCode===409||e?.status===409||e?.response?.status===409)&&await H(),console.error("Failed to update issue status:",e)}finally{const e=new Set(Z.value);e.delete(t.id),Z.value=e}}}async function Rt(t){if(t.length>0){const e=new Set(t.map(r=>r.id));k.value=new Set([...k.value].filter(r=>!e.has(r))),await H()}}function Ne(t){we.value&&!we.value.contains(t.target)&&(oe.value=!1)}return Lt({title:()=>v.value?`${v.value.filename} â Image Review`:"Image Review â Retick",meta:[{name:"description",content:"Review AI-extracted issues on this image. Annotate, comment, and export to Jira or Linear."},{name:"robots",content:"noindex, nofollow"}]}),Et(()=>{document.addEventListener("click",Ne),Ve()}),qt(()=>{document.removeEventListener("click",Ne)}
1),be(u,()=>{ye.reset(),Me.mediaId=u.value,F.reset(),T.value=[],w.value=[],k.value=new Set,C.value=!1,Ve()}),be(P,()=>W()),be(T,()=>{_e.value&&(_e.value=!1)},{deep:!0}),(t,e)=>{const r=Ut,f=Nt,V=Yt;return l(),n("div",cs,[s("div",vs,[s("div",ms,[$.value?d("",!0):(l(),re(r,{key:0,to:st.value,class:"hover:text-primary transition-colors"},{default:Ge(()=>[L(" â Back to "+o(at.value),1)]),_:1},8,["to"])),$.value?d("",!0):(l(),n("span",ys,"|")),s("span",{class:"font-medium text-gray-900 truncate max-w-[260px]",title:pe.value},o(pe.value),9,ps),v.value?.description?(l(),n("span",{key:2,class:"max-w-md truncate text-gray-500",title:v.value.description},o(v.value.description),9,gs)):d("",!0),e[30]||(e[30]=s("span",{class:"text-gray-300"},"·",-1)),e[31]||(e[31]=s("span",{class:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-purple-50 text-purple-700 border border-purple-200"}," ð¼ Image ",-1)),qe.value?(l(),n(R,{key:3},[e[28]||(e[28]=s("span",{class:"text-gray-300"},"·",-1)),s("span",null,o(qe.value),1)],64)):d("",!0),e[32]||(e[32]=s("span",{class:"text-gray-300"},"·",-1)),s("span",fs,[s("span",{class:O(["w-2 h-2 rounded-full",Ye.value])},null,2),L(" "+o(Xe.value),1)]),Be.value?(l(),n(R,{key:4},[e[29]||(e[29]=s("span",{class:"text-gray-300"},"·",-1)),s("span",null,o(Be.value),1)],64)):d("",!0),s("div",xs,[$.value?d("",!0):(l(),re(Wt,{key:0,"media-id":u.value,"media-title":pe.value,"media-type":"image",status:v.value?.status,"uploaded-by":v.value?.uploaded_by,"can-edit":D.value,"issue-count":v.value?.issue_count||0,onChanged:H,onCompleted:H},null,8,["media-id","media-title","status","uploaded-by","can-edit","issue-count"])),v.value?.permissions?.can_manage_sharing?(l(),n("button",{key:1,type:"button",class:"btn-secondary btn-sm","data-testid":"media-share-button",onClick:e[0]||(e[0]=a=>Y.value=!0)},"Share")):d("",!0),v.value?.permissions?.can_manage_people?(l(),n("button",{key:2,type:"button",class:"btn-secondary btn-sm","data-testid":"media-access-button",onClick:e[1]||(e[1]=a=>K.value=!K.value)},"Manage access")):d("",!0)])])]),K.value?(l(),n("div",bs,[j(f,{"video-id":u.value,onClose:e[2]||(e[2]=a=>K.value=!1)},null,8,["video-id"])])):d("",!0),$.value?d("",!0):(l(),re(jt,{key:1,"media-id":u.value,status:v.value?.status,"error-message":v.value?.error_message,onRetried:et},null,8,["media-id","status","error-message"])),s("div",_s,[s("div",hs,[b.value?(l(),n(R,{key:0},[e[33]||(e[33]=de('<div class="h-6 w-32 bg-gray-200 rounded shimmer" data-testid="summary-loading" data-v-e67d252d></div><div class="h-5 w-20 bg-gray-200 rounded-full shimmer" data-v-e67d252d></div><div class="h-5 w-16 bg-gray-200 rounded-full shimmer" data-v-e67d252d></div><div class="h-5 w-20 bg-gray-200 rounded-full shimmer" data-v-e67d252d></div><div class="h-5 w-16 bg-gray-200 rounded-full shimmer" data-v-e67d252d></div>',5))],64)):(l(),n(R,{key:1},[s("span",ks,o(ve.value)+" issues",1),E.value.critical?(l(),n("span",ws,o(E.value.critical)+" Critical ",1)):d("",!0),E.value.high?(l(),n("span",Cs,o(E.value.high)+" High ",1)):d("",!0),E.value.medium?(l(),n("span",Ss,o(E.value.medium)+" Medium ",1)):d("",!0),E.value.low?(l(),n("span",Is,o(E.value.low)+" Low ",1)):d("",!0),lt.value?(l(),n("span",$s,[L(o(J.value.length)+" of "+o(w.value.length)+" issues shown · Filtered by: "+o(nt.value.join(", "))+" ",1),s("button",{type:"button",class:"text-primary hover:underline ml-2",onClick:ht},"Clear")])):d("",!0)],64))])]),b.value?(l(),n("div",As,[...e[34]||(e[34]=[s("div",{class:"card-padded"},[s("div",{class:"skeleton h-6 w-64 mb-3"}),s("div",{class:"skeleton h-4 w-96 mb-4"}),s("div",{class:"skeleton h-72 w-full"})],-1)])])):v.value?(l(),n("div",Fs,[s("div",Rs,[s("div",Ds,[s("div",zs,[e[39]||(e[39]=s("div",null,[s("h1",{class:"text-lg font-semibold text-gray-900"},"Image review"),s("p",{class:"text-sm text-gray-500"},"Annotate the image, run AI suggestions, then manage the saved issues below.")],-1)),D.value?(l(),n("button",{key:0,type:"button",class:"inline-flex items-center gap-1.5 text-sm font-semibold text-emerald-700 bg-emerald-50 hover:bg-emerald-100 border border-emerald-200 px-3 py-1.5 rounded-lg transition-colors","data-testid":"image-add-issue-open",onClick:e[3]||(e[3]=a=>se.value=!0)},[...e[38]||(e[38]=[s("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[s("path",{d:"M12 5v14M5 12h14","stroke-linecap":"round"})],-1),L(" Add issue ",-1)])])):d("",!0)]),s("div",Ms,[j(Pt,{ref_key:"annotationCanvasRef",ref:Le,annotations:T.value,"onUpdate:annotations":e[4]||(e[4]=a=>T.value=a),"media-src":v.value.url||"","media-alt":v.value.filename,"media-aspect-ratio":We.value,readonly:!D.value,onChange:e[5]||(e[5]=a=>D.value?Pe():void 0)},null,8,["annotations","media-src","media-alt","media-aspect-ratio","readonly"])]),s("div",Ls,[s("span",null,o(tt.value),1),C.value?(l(),n("span",Es,"â Unsaved changes")):d("",!0)])]),$.value?d("",!0):(l(),n("aside",qs,[s("section",Bs,[s("div",Us,[e[40]||(e[40]=s("h2",{class:"text-base font-semibold text-gray-900"},"AI Suggestions",-1)),S(F).state.value==="ready"?(l(),n("span",js,o(Ee.value.length)+" of "+o(S(F).suggestions.value.length)+" shown ",1)):d("",!0)]),S(F).state.value==="idle"?(l(),n("div",Ps,[e[41]||(e[41]=s("p",null,[L(" Run the same vision analysis the video pipeline uses on a
1single image. Suggestions are "),s("strong",null,"not auto-saved"),L(" â review them and click Save to promote each to a real issue. ")],-1)),D.value?(l(),n("button",{key:0,type:"button",class:"btn btn-primary btn-sm w-full",onClick:Ie}," ⨠Suggest issues ")):d("",!0)])):S(F).state.value==="loading"?(l(),n("div",Vs,[...e[42]||(e[42]=[s("svg",{class:"animate-spin w-5 h-5 text-primary",viewBox:"0 0 24 24",fill:"none"},[s("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"2","stroke-dasharray":"40"})],-1),L(" Analyzing image and annotations with GPT-5.5 vision⦠",-1)])])):S(F).state.value==="error"?(l(),n("div",Os,[e[43]||(e[43]=s("p",{class:"font-medium text-error"},"AI suggestions unavailable",-1)),s("p",Ns,o(S(F).error.value),1),s("button",{type:"button",class:"btn btn-secondary btn-sm w-full",onClick:Ie}," Try again ")])):S(F).state.value==="ready"?(l(),n("div",Hs,[S(F).suggestions.value.length?d("",!0):(l(),n("p",Gs," No issues found by the AI. Add or adjust annotations, then run it again. ")),(l(!0),n(R,null,G(Ee.value,a=>(l(),n("div",{key:a.suggestion_id,class:"border border-gray-200 rounded-md p-3 space-y-1.5 hover:border-gray-300 transition-colors"},[s("div",Ks,[s("p",Qs,o(a.title),1),e[44]||(e[44]=s("span",{class:"shrink-0 inline-flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded bg-primary-subtle text-primary"}," AI-suggested ",-1))]),a.description?(l(),n("p",Zs,o(a.description),1)):d("",!0),s("div",Js,[s("span",{class:O([S(Fe)(a.severity),"px-1.5 py-0.5 rounded font-medium uppercase tracking-wide"])},o(a.severity),3),s("span",Ws,o(a.category),1),s("span",Xs,"confidence "+o(Math.round((a.confidence||0)*100))+"%",1)]),s("div",Ys,[s("button",{type:"button",class:"text-[11px] text-primary font-medium hover:underline disabled:text-gray-400 disabled:no-underline",disabled:_.value===a.suggestion_id,onClick:y=>pt(a)},o(_.value===a.suggestion_id?"Savingâ¦":"Save"),9,ea),e[45]||(e[45]=s("span",{class:"text-[11px] text-gray-300"},"·",-1)),s("button",{type:"button",class:"text-[11px] text-gray-500 hover:text-error",onClick:y=>S(F).dismissSuggestion(a.suggestion_id)}," Dismiss ",8,ta)])]))),128)),s("button",{type:"button",class:"btn btn-secondary btn-sm w-full mt-2",onClick:Ie}," Re-run AI suggestions ")])):d("",!0)])]))]),s("section",sa,[e[66]||(e[66]=s("div",{class:"flex flex-wrap items-center justify-between gap-3"},[s("div",null,[s("h2",{class:"text-lg font-semibold text-gray-900"},"Issues"),s("p",{class:"text-sm text-gray-500"},"Select, filter, edit, delete, and export issues for this image.")])],-1)),s("div",aa,[s("label",la,[ue.value?(l(),n("input",{key:0,type:"checkbox",checked:Ce.value,indeterminate:rt.value,class:"w-4 h-4 rounded border-gray-300 text-primary focus:ring-primary","data-testid":"image-issues-select-all",onChange:xt},null,40,na)):d("",!0),ue.value?(l(),n(R,{key:1},[L("Select All ("+o(J.value.length)+")",1)],64)):d("",!0)]),D.value?(l(),n("button",{key:0,type:"button",class:"inline-flex items-center gap-1.5 text-sm font-semibold text-emerald-700 bg-emerald-50 hover:bg-emerald-100 border border-emerald-200 px-3 py-1.5 rounded-lg transition-colors",onClick:e[6]||(e[6]=a=>se.value=!0)},[...e[46]||(e[46]=[s("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[s("path",{d:"M12 5v14M5 12h14","stroke-linecap":"round"})],-1),L(" Add issue ",-1)])])):d("",!0),te(s("select",{"onUpdate:modelValue":e[7]||(e[7]=a=>P.value=a),class:"text-sm border border-gray-300 rounded-lg px-3 py-2 bg-white focus:ring-2 focus:ring-primary/20 focus:border-primary"},[...e[47]||(e[47]=[de('<option value="severity_desc" data-v-e67d252d>Sort: Severity (High-Low)</option><option value="severity_asc" data-v-e67d252d>Sort: Severity (Low-High)</option><option value="title_asc" data-v-e67d252d>Sort: Title (A-Z)</option><option value="category_asc" data-v-e67d252d>Sort: Category (A-Z)</option><option value="created_desc" data-v-e67d252d>Sort: Newest</option>',5)])],512),[[ge,P.value]]),ue.value&&k.value.size?(l(),n("div",oa,[s("span",ia,o(k.value.size)+" selected",1),s("button",{type:"button",class:"text-sm font-semibold text-white bg-primary hover:bg-primary/90 px-4 py-1.5 rounded-lg transition-colors",onClick:e[8]||(e[8]=a=>ke.value=!0)}
1,"Export to PMS â"),D.value?(l(),n("button",{key:0,type:"button",class:"text-sm font-medium text-rose-600 hover:bg-rose-50 px-3 py-1 rounded-md transition-colors",onClick:e[9]||(e[9]=a=>le.value=!0)},"Delete")):d("",!0),s("button",{type:"button",class:"text-sm text-gray-500 hover:text-gray-700",onClick:Oe},"Cancel")])):d("",!0),s("div",ra,[s("div",da,[e[48]||(e[48]=s("span",{class:"text-xs text-gray-400 font-medium hidden sm:inline"},"Severity:",-1)),(l(),n(R,null,G(["critical","high","medium","low"],a=>s("button",{key:a,type:"button",class:O(["text-xs font-medium px-2.5 py-1 rounded-full border transition-colors",B.value.has(a)?S(Fe)(a)+" border-current":"bg-white text-gray-500 border-gray-300 hover:border-gray-400"]),onClick:y=>bt(a)},o(a.charAt(0).toUpperCase()+a.slice(1)),11,ua)),64))]),s("div",ca,[e[49]||(e[49]=s("span",{class:"text-xs text-gray-400 font-medium hidden sm:inline"},"Source:",-1)),(l(),n(R,null,G(Je,a=>s("button",{key:a.value,type:"button","aria-pressed":M.value===a.value,class:O(["text-xs font-medium px-2.5 py-1 rounded-full border transition-colors",M.value===a.value?"bg-primary text-white border-primary":"bg-white text-gray-500 border-gray-300 hover:border-gray-400"]),onClick:y=>{M.value=a.value,W()}},o(a.label),11,va)),64))]),s("div",{class:"relative",ref_key:"categoryDropdownRef",ref:we},[s("button",{type:"button",class:O(["text-sm border rounded-lg px-3 py-2 bg-white transition-colors flex items-center gap-1.5",A.value.size>0?"border-primary/50 text-primary":"border-gray-300 text-gray-600 hover:border-gray-400"]),onClick:e[10]||(e[10]=a=>oe.value=!oe.value)},[e[51]||(e[51]=s("span",null,"Category",-1)),A.value.size>0?(l(),n("span",ma,o(A.value.size),1)):d("",!0),(l(),n("svg",{class:O(["w-3.5 h-3.5 transition-transform",oe.value?"rotate-180":""]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[...e[50]||(e[50]=[s("polyline",{points:"6 9 12 15 18 9"},null,-1)])],2))],2),oe.value?(l(),n("div",ya,[(l(),n(R,null,G(x,a=>s("label",{key:a,class:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-50 cursor-pointer text-sm"},[s("input",{type:"checkbox",checked:A.value.has(a),class:"w-3.5 h-3.5 rounded border-gray-300 text-primary focus:ring-primary",onChange:y=>_t(a)},null,40,pa),s("span",ga,o(a),1)])),64)),A.value.size>0?(l(),n("div",fa,[s("button",{type:"button",class:"text-xs text-gray-500 hover:text-primary px-2",onClick:e[11]||(e[11]=a=>{A.value=new Set,W()})},"Clear categories")])):d("",!0)])):d("",!0)],512),te(s("select",{"onUpdate:modelValue":e[12]||(e[12]=a=>U.value=a),class:"text-sm border border-gray-300 rounded-lg px-3 py-2 bg-white","aria-label":"Filter issues by label",onChange:W},[e[52]||(e[52]=s("option",{value:""},"All labels",-1)),(l(!0),n(R,null,G(ze.value,a=>(l(),n("option",{key:a,value:a},o(a),9,xa))),128))],544),[[ge,U.value]])])]),he.value?(l(),n("div",ba,[(l(),n(R,null,G(4,a=>s("div",{key:"issue-skeleton-"+a,class:"flex items-center gap-3"},[...e[53]||(e[53]=[de('<div class="w-4 h-4 rounded bg-gray-200 shimmer" data-v-e67d252d></div><div class="w-16 h-5 rounded-full bg-gray-200 shimmer" data-v-e67d252d></div><div class="h-4 bg-gray-200 rounded shimmer flex-1" data-v-e67d252d></div><div class="w-20 h-5 rounded bg-gray-200 shimmer" data-v-e67d252d></div><div class="w-[84px] h-[52px] rounded-lg bg-gray-200 shimmer" data-v-e67d252d></div>',5)])])),64))])):ce.value?(l(),n("div",_a,[e[54]||(e[54]=de('<svg class="w-12 h-12 mx-auto mb-3 text-red-300" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-v-e67d252d><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" data-v-e67d252d></path><line x1="12" y1="9" x2="12" y2="13" data-v-e67d252d></line><line x1="12" y1="17" x2="12.01" y2="17" data-v-e67d252d></line></svg><h3 class="text-lg font-semibold text-gray-800 mb-2" data-v-e67d252d>Couldn't load issues</h3>',2)),s("p",ha,o(ce.value),1),s("button",{type:"button",class:"btn-primary-md",onClick:H},"Retry")])):w.value.length===0?(l(),n("div",ka,[e[55]||(e[55]=de('<svg class="w-14 h-14 mx-auto mb-4 text-gray-300" viewB
1ox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-v-e67d252d><rect x="3" y="3" width="18" height="18" rx="2" ry="2" data-v-e67d252d></rect><line x1="3" y1="9" x2="21" y2="9" data-v-e67d252d></line><line x1="9" y1="21" x2="9" y2="9" data-v-e67d252d></line></svg><h3 class="text-xl font-semibold text-gray-800 mb-2" data-v-e67d252d>No issues saved for this image</h3><p class="text-gray-500 mb-6" data-v-e67d252d>Run AI suggestions or add an issue manually to start the review table.</p>',3)),D.value?(l(),n("button",{key:0,type:"button",class:"btn-primary-md",onClick:e[13]||(e[13]=a=>se.value=!0)},"Add First Issue")):d("",!0)])):(l(),n("div",wa,[s("table",Ca,[e[65]||(e[65]=s("thead",{class:"sticky top-0 z-10 bg-gray-50 border-b border-gray-200"},[s("tr",null,[s("th",{class:"w-10 px-4 py-3 text-left"}),s("th",{class:"px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-gray-500"},"Severity"),s("th",{class:"px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-gray-500"},"Issue"),s("th",{class:"px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-gray-500 hidden md:table-cell"},"Category"),s("th",{class:"px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-gray-500 hidden md:table-cell"},"Status"),s("th",{class:"px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-gray-500 hidden lg:table-cell"},"Image"),s("th",{class:"w-10 px-4 py-3"})])],-1)),s("tbody",Sa,[(l(!0),n(R,null,G(J.value,a=>(l(),n(R,{key:a.id},[s("tr",{id:`issue-${a.id}`,class:O(["hover:bg-gray-50/80 cursor-pointer transition-colors",k.value.has(a.id)?"bg-indigo-50/40":"",q.value===a.id?"bg-blue-50/30":""]),onClick:y=>gt(a.id)},[s("td",{class:"px-4 py-3",onClick:e[14]||(e[14]=fe(()=>{},["stop"]))},[ue.value?(l(),n("input",{key:0,type:"checkbox",checked:k.value.has(a.id),class:"w-4 h-4 rounded border-gray-300 text-primary focus:ring-primary","data-testid":"image-issue-checkbox",onChange:y=>ft(a.id)},null,40,$a)):d("",!0)]),s("td",Aa,[s("span",{class:O(["severity-badge text-xs font-semibold px-2.5 py-1 rounded-full",S(Fe)(a.severity)])},o(a.severity.toUpperCase()),3)]),s("td",Ta,[s("div",Fa,[s("div",Ra,[s("p",{class:O(["font-medium leading-snug line-clamp-2",a.status==="resolved"?"text-gray-500 line-through":"text-gray-900"])},o(S(Ae)(a.title)),3),a.description?(l(),n("p",Da,o(S(Ae)(a.description)),1)):d("",!0)]),j(Gt,{issue:a},null,8,["issue"]),a.is_edited?(l(),n("span",za,"Edited")):d("",!0),a.exported_at?(l(),n("span",Ma,"Exported")):d("",!0)])]),s("td",La,[s("span",Ea,o(a.category),1)]),s("td",qa,[s("div",Ba,[s("span",Ua,o(a.status==="resolved"?"Resolved":S(Ze)(a.status||"open")),1),D.value?(l(),n("button",{key:0,type:"button",class:"btn-secondary btn-sm",disabled:Z.value.has(a.id),"aria-label":`${a.status==="resolved"?"Reopen":"Resolve"} ${a.title}`,onClick:fe(y=>Ft(a),["stop"])},o(Z.value.has(a.id)?"Savingâ¦":a.status==="resolved"?"Reopen":"Resolve"),9,ja)):d("",!0)])]),s("td",Pa,[s("div",Va,[je(a)?(l(),n("img",{key:0,src:je(a
1),alt:a.title,class:"w-full h-full object-cover",loading:"lazy"},null,8,Oa)):(l(),n("svg",Na,[...e[56]||(e[56]=[s("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},null,-1),s("circle",{cx:"8.5",cy:"8.5",r:"1.5"},null,-1),s("polyline",{points:"21 15 16 10 5 21"},null,-1)])]))])]),s("td",Ha,[(l(),n("svg",{class:O(["w-5 h-5 text-gray-400 transition-transform",q.value===a.id?"rotate-90":""]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[...e[57]||(e[57]=[s("polyline",{points:"9 18 15 12 9 6"},null,-1)])],2))])],10,Ia),q.value===a.id?(l(),n("tr",Ga,[s("td",Ka,[Q.value!==a.id?(l(),n("div",Qa,[s("p",Za,o(S(Ae)(a.description)||"No description provided."),1),j(Kt,{issue:a},null,8,["issue"]),j(V,{url:a.url,route:a.route,"spoken-quote":a.spoken_quote},null,8,["url","route","spoken-quote"]),s("div",Ja,[s("span",Wa,"Created "+o(S(Te)(a.created_at)),1),a.updated_at?(l(),n("span",Xa,"Updated "+o(S(Te)(a.updated_at)),1)):d("",!0),s("span",Ya,o(a.keyframes.length)+" keyframe"+o(a.keyframes.length===1?"":"s"),1)]),s("div",el,[D.value?(l(),n("button",{key:0,type:"button",class:"btn-ghost-sm text-primary",onClick:fe(y=>kt(a),["stop"])},[...e[58]||(e[58]=[s("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[s("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})],-1),L(" Edit Issue ",-1)])],8,tl)):d("",!0),D.value?(l(),n("button",{key:1,type:"button",class:"btn-ghost-sm text-rose-600",onClick:fe(y=>It(a),["stop"])},[...e[59]||(e[59]=[s("svg",{class:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[s("polyline",{points:"3 6 5 6 21 6"}),s("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1),L(" Delete ",-1)])],8,sl)):d("",!0)])])):(l(),n("div",al,[s("div",null,[e[60]||(e[60]=s("label",{class:"block text-xs font-medium text-gray-500 mb-1"},"Title",-1)),te(s("input",{"onUpdate:modelValue":e[15]||(e[15]=y=>g.title=y),maxlength:"500",class:"w-full text-sm border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary/20 focus:border-primary"},null,512),[[Qe,g.title]])]),s("div",null,[e[61]||(e[61]=s("label",{class:"block text-xs font-medium text-gray-500 mb-1"},"Description",-1)),te(s("textarea",{"onUpdate:modelValue":e[16]||(e[16]=y=>g.description=y),rows:"4",class:"w-full text-sm border border-gray-300 rounded-lg px-3 py-2 focus:ring-2 focus:ring-primary/20 focus:border-primary resize-y"},null,512),[[Qe,g.description]])]),s("div",ll,[s("div",nl,[e[63]||(e[63]=s("label",{class:"block text-xs font-medium text-gray-500 mb-1"},"Severity",-1)),te(s("select",{"onUpdate:modelValue":e[17]||(e[17]=y=>g.severity=y),class:"w-full text-sm border border-gray-300 rounded-lg px-3 py-2 bg-white focus:ring-2 focus:ring-primary/20 focus:border-primary"},[...e[62]||(e[62]=[s("option",{value:"critical"},"Critical",-1),s("option",{value:"high"},"High",-1),s("option",{value:"medium"},"Medium",-1),s("option",{value:"low"},"Low",-1)])],512),[[ge,g.severity]])]),s("div",ol,[e[64]||(e[64]=s("label",{class:"block text-xs font-medium text-gray-500 mb-1"},"Category",-1)),te(s("select",{"onUpdate:modelValue":e[18]||(e[18]=y=>g.category=y),class:"w-full text-sm border border-gray-300 rounded-lg px-3 py-2 bg-white focus:ring-2 focus:ring-primary/20 focus:border-primary"},[(l(),n(R,null,G(x,y=>s("option",{key:y,value:y},o(y.charAt(0).toUpperCase()+y.slice(1)),9,il)),64))],512),[[ge,g.category]])])]),j(Qt,{issue:De.value||{},report:g.report,labels:g.labels,"label-options":ze.value,"onUpdate:report":e[19]||(e[19]=y=>g.report=y),"onUpdate:labels":e[20]||(e[20]=y=>g.labels=y)},null,8,["issue","report","labels","label-options"]),j(es,{mode:"update","media-id":u.value,"issue-id":a.id,"current-draft":g,onApply:Ct},null,8,["media-id","issue-id","current-draft"]),s("div",{class:"flex items-center justify-end gap-2 pt-2 border-t border-gray-100"},[s("button",{type:"button",class:"btn-ghost-sm",onClick:wt},"Cancel"),s("button",{type:"button",class:"btn-primary-sm",onClick:St},"Save")])]))])])):d("",!0)],64))),128))])])]))])])):(l(),n("div",Ts,[e[36]||(e[36]=s("h3",{class:"text-xl font-semibold text-gray-800 mb
1-2"},"Image not found",-1)),e[37]||(e[37]=s("p",{class:"text-gray-500 mb-4"},"This image may have been deleted or does not exist.",-1)),j(r,{to:"/cycles",class:"btn-primary-md"},{default:Ge(()=>[...e[35]||(e[35]=[L("Back to Cycles",-1)])]),_:1})])),j(ns,{visible:Y.value,"target-type":"video","target-id":u.value,"target-name":pe.value,onClose:e[21]||(e[21]=a=>Y.value=!1)},null,8,["visible","target-id","target-name"]),(l(),re(Ke,{to:"body"},[ae.value?(l(),n("div",rl,[s("div",{class:"absolute inset-0 bg-black/50",onClick:e[22]||(e[22]=a=>ae.value=!1)}),s("div",dl,[s("div",ul,[e[69]||(e[69]=s("div",{class:"w-10 h-10 rounded-full bg-red-100 flex items-center justify-center flex-shrink-0"},[s("svg",{class:"w-5 h-5 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[s("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})])],-1)),s("div",null,[e[67]||(e[67]=s("h3",{class:"text-lg font-semibold text-gray-900"},"Delete Issue?",-1)),e[68]||(e[68]=s("p",{class:"text-sm text-gray-600 mt-1"},"This action cannot be undone. The issue will be permanently removed.",-1)),ne.value?(l(),n("div",cl,o(ne.value.title),1)):d("",!0)])]),s("div",vl,[s("button",{type:"button",class:"btn-ghost-md",onClick:e[23]||(e[23]=a=>ae.value=!1)},"Cancel"),s("button",{type:"button",class:"btn-danger-md",onClick:$t},"Delete")])])])):d("",!0)])),(l(),re(Ke,{to:"body"},[le.value?(l(),n("div",ml,[s("div",{class:"absolute inset-0 bg-black/50",onClick:e[24]||(e[24]=a=>le.value=!1)}),s("div",yl,[s("h3",pl,"Delete "+o(k.value.size)+" issues?",1),e[70]||(e[70]=s("p",{class:"text-sm text-gray-600"},"This action cannot be undone. All selected issues will be permanently removed.",-1)),s("div",gl,[s("button",{type:"button",class:"btn-ghost-md",onClick:e[25]||(e[25]=a=>le.value=!1)},"Cancel"),s("button",{type:"button",class:"btn-danger-md",onClick:At},"Delete "+o(k.value.size)+" issues",1)])])])):d("",!0)])),j(Xt,{visible:ke.value,issues:it.value,"video-id":u.value,onClose:e[26]||(e[26]=a=>ke.value=!1),onExported:Rt},null,8,["visible","issues","video-id"]),j(Vt,{visible:se.value,"onUpdate:visible":e[27]||(e[27]=a=>se.value=a),"video-id":u.value,onCreated:Tt},null,8,["visible","video-id"])])}}}),Tl=os(fl,[["__scopeId","data-v-e67d252d"]]);export{Tl as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.