1import{r as d,j as e,B as N,s as b}from"./index-CEISlULX.js";import{L as j}from"./loader-circle-C0qiwHXp.js";import{R as w}from"./refresh-cw-uC6mqHyu.js";function I(){const[r,a]=d.useState(null),[n,l]=d.useState(!0),[o,m]=d.useState(null),[c,u]=d.useState(null),x=async s=>{s?u(s):l(!0),m(null);try{const{data:t,error:g}=await b.functions.invoke("test-imagen-compare",{body:s?{vault_taste_id:s}:{}});if(g)throw g;if(t!=null&&t.error)throw new Error(t.error);const h=(t==null?void 0:t.items)||[];a(s?f=>(f||[]).map(p=>h.find(v=>v.vault_taste_id===p.vault_taste_id)||p):h)}catch(t){m((t==null?void 0:t.message)||"Failed to load")}finally{l(!1),u(null)}};return d.useEffect(()=>{x()},[]),e.jsxs("div",{className:"min-h-screen bg-background p-6 max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Imagen 4 Fast vs Nano Banana"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Side-by-side test on your latest place, recipe, and product. Same prompt to both models."})]}),n&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(j,{className:"h-4 w-4 animate-spin"})," Generating 6 imagesâ¦"]}),o&&e.jsx("div",{className:"p-4 rounded border border-destructive/30 bg-destructive/5 text-destructive text-sm",children:o}),r&&r.length===0&&!n&&e.jsx("div",{className:"text-muted-foreground",children:"No matching cards found in your vault."}),e.jsx("div",{className:"space-y-8",children:r==null?void 0:r.map(s=>e.jsxs("div",{className:"border rounded-lg p-4 bg-card",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:s.domain}),e.jsx("div",{className:"font-semibold text-lg truncate",children:s.title}),s.subtitle&&e.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.subtitle})]}),e.jsx(N,{size:"sm",variant:"outline",onClick:()=>x(s.vault_taste_id),disabled:c===s.vault_taste_id,children:c===s.vault_taste_id?e.jsx(j,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"h-4 w-4 mr-1"})," Regenerate"]})})]}),e.jsxs("details",{className:"mb-4 text-xs text-muted-foreground",children:[e.jsx("summary",{className:"cursor-pointer select-none",children:"Prompt"}),e.jsx("div",{className:"mt-2 p-2 bg-muted rounded font-mono whitespace-pre-wrap",children:s.prompt})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(i,{label:"Existing thumbnail",url:s.existing_thumbnail,ms:null,error:null}),e.jsx(i,{label:"Nano Banana (2.5 Flash Image)",url:s.nano_url,ms:s.nano_ms,error:s.nano_error}),e.jsx(i,{label:"Imagen 4 Fast",url:s.imagen4_url,ms:s.imagen4_ms,error:s.imagen4_error})]})]},s.vault_taste_id))})]})}function i({label:r,url:a,ms:n,error:l}){return e.jsxs("div",{children:[e.jsx("div",{className:"aspect-square rounded-md overflow-hidden bg-muted flex items-center justify-center",children:a?e.jsx("img",{src:a,alt:r,className:"w-full h-full object-cover"}):l?e.jsx("div",{className:"p-3 text-xs text-destructive text-center",children:l}):e.jsx("div",{className:"text-xs text-muted-foreground",children:"no image"})}),e.jsxs("div",{className:"mt-2 text-xs",children:[e.jsx("div",{className:"font-medium",children:r}),n!==null&&e.jsxs("div",{className:"text-muted-foreground",children:[(n/1e3).toFixed(1),"s"]})]})]})}export{I 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.