1import{u as T}from"./adminLocalization-BnJJWmNq.js";import{d as U,o as x,ay as B,c as i,a as e,t as l,u as a,F as _,r as h,h as m,b as p,e as C,f as u,E as S,_ as D}from"./index-DaM-Wkq5.js";import"./roles-DFrmCF_M.js";const J={class:"admin-page"},V={class:"admin-page__header"},q={class:"admin-page__summary"},z={key:0,class:"admin-message admin-message--error"},F={key:1,class:"admin-message"},M={key:2,class:"trial-leads-layout"},O={class:"admin-table"},R=["onClick"],$={class:"lead-detail","aria-live":"polite"},I={class:"lead-detail__avatar"},j={class:"lead-detail__eyebrow"},H=["href"],Q={class:"lead-detail__facts"},G={class:"lead-detail__block"},K={key:0,class:"lead-detail__block"},X={key:1,class:"lead-detail__block"},Y={key:2,class:"lead-detail__block"},Z={class:"lead-detail__block lead-detail__block--muted"},ee={key:1,class:"lead-detail__empty"},le=U({__name:"AdminTrialLeadsView",setup(ae){const{adminText:t,adminLabel:d,adminError:w,adminLocale:N}=T(),c=p([]),s=p(null),y=p(!0),v=p(""),g=C(()=>{var n;return k((n=s.value)==null?void 0:n.competitorsJson)}),f=C(()=>{var n;return k((n=s.value)==null?void 0:n.quickWinsJson)});x(async()=>{try{c.value=await B(),s.value=c.value[0]??null}catch(n){v.value=n instanceof Error?n.message:"Unable to load trial leads."}finally{y.value=!1}});function A(n){return new Intl.DateTimeFormat(N.value,{dateStyle:"medium",timeStyle:"short"}).format(new Date(n))}function L(n){return n.visibilityScore==null?"Pending":`${n.visibilityScore}/100`}function W(n){const r=n.toLowerCase();return{"status-pill--complete":r.includes("complete"),"status-pill--failed":r.includes("fail"),"status-pill--active":r.includes("started")||r.includes("updated")||r.includes("autofill")}}function P(n){return n.split(/\s+/).filter(Boolean).slice(0,2).map(r=>r.charAt(0).toUpperCase()).join("")||"TL"}function E(n){return/^https?:\/\//i.test(n)?n:`https://${n}`}function k(n){if(!n)return[];try{const r=JSON.parse(n);return Array.isArray(r)?r:[]}catch{return[]}}return(n,r)=>(u(),i("section",J,[e("header",V,[e("div",null,[e("h1",null,l(a(t)("Trial Leads")),1),e("p",null,l(a(t)("Public trial attempts, autofill data, prompts, scores, and follow-up details.")),1)]),e("div",q,[e("strong",null,l(c.value.length),1),e("span",null,l(a(t)("recent attempts")),1)])]),v.value?(u(),i("p",z,l(a(w)(v.value)),1)):y.value?(u(),i("p",F,l(a(t)("Loading trial leads...")),1)):(u(),i("div",M,[e("div",O,[e("table",null,[e("thead",null,[e("tr",null,[e("th",null,l(a(t)("Company")),1),e("th",null,l(a(t)("Website")),1),e("th",null,l(a(t)("Status")),1),e("th",null,l(a(t)("Category")),1),e("th",null,l(a(t)("Region")),1),e("th",null,l(a(t)("Email")),1),e("th",null,l(a(t)("Score")),1),e("th",null,l(a(t)("Created")),1)])]),e("tbody",null,[(u(!0),i(_,null,h(c.value,o=>{var b;return u(),i("tr",{key:o.id,class:S({"is-selected":((b=s.value)==null?void 0:b.id)===o.id}),onClick:te=>s.value=o},[e("td",null,[e("strong",null,l(o.companyName||a(t)("Unknown company")),1),e("span",null,l(o.locale.toUpperCase())+" · "+l(o.countryCode),1)]),e("td",null,l(o.resolvedWebsite||o.submittedWebsite||a(t)("Not resolved")),1),e("td",null,[e("span",{class:S(["status-pill",W(o.status)])},l(a(d)(o.status)),3)]),e("td",null,l(o.fieldOrCategory||a(t)("Pending")),1),e("td",null,l(o.region||a(t)("Not provided")),1),e("td",null,l(o.workEmail||a(t)("Not provided")),1),e("td",null,l(a(d)(L(o))),1),e("td",null,l(A(o.createdAt)),1)],10,R)}),128))])])]),e("aside",$,[s.value?(u(),i(_,{key:0},[e("header",null,[e("span",I,l(P(s.value.companyName)),1),e("div",null,[e("p",j,l(a(d)(s.value.status))+" · "+l(a(d)(s.value.websiteSource||"manual")),1),e("h2",null,l(s.value.companyName||a(t)("Unknown company")),1),s.value.resolvedWebsite?(u(),i("a",{key:0,href:E(s.value.resolvedWebsite),target:"_blank",rel:"noreferrer"},l(s.value.resolvedWebsite),9,H)):m("",!0)])]),e("dl",Q,[e("div",null,[e("dt",null,l(a(t)("Work email")),1),e("dd",null,l(s.value.workEmail||a(t)("Not provided")),1)]),e("div",null,[e("dt",null,l(a(t)("Region")),1),e("dd",null,l(s.value.region||a(t)("Not provided")),1)]),e("div",null,[e("dt",null,l(a(t)("Category")),1),e("dd",null,l(s.value.fieldOrCategory||a(t)("Pending")),1)]),e("div",null,[e("dt",null,l(a(t)("Source path")),1),e("dd",null,l(s.value.sourcePath||a(t)("Unknown")),1)])]),e("section",G,[e("h3",null,l(a(t)("Prompt")),1),e("p",null,l(s.value.finalPrompt||s.value.suggestedPrompt||a(t)("No prompt c
1aptured yet.")),1),e("small",null,l(a(d)(s.value.promptSuggestionConfidence||s.value.promptSuggestionSource)),1)]),s.value.analysisSummary?(u(),i("section",K,[e("h3",null,l(a(t)("Analysis Summary")),1),e("p",null,l(s.value.analysisSummary),1)])):m("",!0),g.value.length?(u(),i("section",X,[e("h3",null,l(a(t)("Competitors")),1),e("ul",null,[(u(!0),i(_,null,h(g.value,o=>(u(),i("li",{key:o.name},[e("strong",null,l(o.name),1),e("span",null,l(o.visibilityShare??0)+"%",1)]))),128))])])):m("",!0),f.value.length?(u(),i("section",Y,[e("h3",null,l(a(t)("Quick Wins")),1),e("ul",null,[(u(!0),i(_,null,h(f.value,o=>(u(),i("li",{key:o.title},[e("strong",null,l(o.title),1),e("span",null,l(a(d)(o.impact)),1)]))),128))])])):m("",!0),e("section",Z,[e("h3",null,l(a(t)("Request Metadata")),1),e("p",null,l(s.value.userAgent||a(t)("No user agent captured.")),1),e("small",null,l(s.value.referrer||a(t)("No referrer")),1)])],64)):(u(),i("div",ee,[e("h2",null,l(a(t)("Select a trial lead")),1),e("p",null,l(a(t)("Choose a row to inspect the submitted prompt, contact details, and captured analysis.")),1)]))])]))]))}}),ie=D(le,[["__scopeId","data-v-5cb75038"]]);export{ie 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.