1import{d as A,r as f,j as e,bf as M}from"./index-CRQcHE7J.js";import{A as y,a as j,b,c as N}from"./accordion-6Lj7bhrD.js";import{T as S,a as P,b as v,c as w}from"./tabs-CpCXxbUW.js";import{u as L,d as c,g as i,e as z,l as C,b as k,S as T}from"./SelfLearningSignals-s1kAz2sr.js";import"./badge-9A7JSrdQ.js";import"./play-BpbkoC0P.js";const E=A("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);function G(){const{rows:d,gates:_,loading:n,busyId:m,act:p}=L(),h=d.filter(s=>s.scope==="shop"),x=d.filter(s=>s.scope==="sector"),u=f.useMemo(()=>{const s=new Map;for(const a of h)s.has(a.scope_key)||s.set(a.scope_key,[]),s.get(a.scope_key).push(a);return[...s.entries()].sort((a,t)=>{const o=a[1].some(r=>r.kind==="click_token_prior"&&r.status==="approved")?0:1,l=t[1].some(r=>r.kind==="click_token_prior"&&r.status==="approved")?0:1;return o-l||c(a[1][0]).localeCompare(c(t[1][0]))})},[h]),g=f.useMemo(()=>{const s=new Map;for(const a of x)s.has(a.scope_key)||s.set(a.scope_key,[]),s.get(a.scope_key).push(a);return[...s.entries()]},[x]);return e.jsxs("div",{className:"space-y-5 max-w-4xl",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Self-learning"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Morvo learns automatically every week. This page shows, in plain terms, what it has learned, what actually changes for shoppers, and the controls. Pause anything a brand queries and it stops within ~10 minutes."})]}),e.jsxs(S,{defaultValue:"brand",children:[e.jsxs(P,{children:[e.jsxs(v,{value:"brand",className:"gap-1.5",children:[e.jsx(M,{className:"h-4 w-4"})," Per-brand flywheel"]}),e.jsxs(v,{value:"pooled",className:"gap-1.5",children:[e.jsx(E,{className:"h-4 w-4"})," Pooled cross-brand"]})]}),e.jsxs(w,{value:"brand",className:"mt-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Each store learns from its own shoppers only. The headline is the most significant thing that changed. Open a brand for the full picture and controls. The same view appears on each client's details page."}),n&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loadingâ¦"}),!n&&u.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing learned yet. Signals appear as stores build up real traffic."}),e.jsx(y,{type:"multiple",className:"space-y-2",children:u.map(([s,a])=>{const t=i(a),o=t.map(r=>r.current),l=z(o);return e.jsxs(j,{value:s,className:"border rounded-lg px-4 bg-card",children:[e.jsx(b,{className:"hover:no-underline py-3",children:e.jsxs("div",{className:"flex flex-col items-start text-left gap-0.5",children:[e.jsxs("span",{className:"font-semibold",children:[c(a[0]),e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:C(_.get(s))})]}),e.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:k(o)})]})}),e.jsxs(N,{className:"pb-4 space-y-2",children:[t.map(r=>e.jsx(T,{row:r.current,history:r.history,pooled:!1,exampleTerm:l,busyId:m,onAct:p},r.current.id)),e.jsx("p",{className:"text-[11px] text-muted-foreground/60 font-mono",children:s})]})]},s)})})]}),e.jsxs(w,{value:"pooled",className:"mt-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Patterns pooled across stores in a sector. A pattern only exists where at least three opted-in stores share it, stored as counts, never conversations. Today these change nothing automatically: they feed reviewed sector-wide improvements and benchmarking, and each card says exactly that."}),!n&&g.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"No pooled patterns yet. They appear once three or more stores in a sector share a signal."}),e.jsx(y,{type:"multiple",className:"space-y-2",children:g.map(([s,a])=>e.jsxs(j,{value:s,className:"border rounded-lg px-4 bg-card",children:[e.jsx(b,{className:"hover:no-underline py-3",children:e.jsxs("div",{className:"flex flex-col items-start text-left gap-0.5",children:[e.jsxs("span",{className:"font-semibold capitalize",children:[s,". Pooled from ",Math.max(...a.map(t=>t.shops_contributing))," stores"]}),e.jsx("span",{className:"text-sm text-muted-foreground font-normal",children:k(i(a).map(t=>t.current))})]})}),e.jsx(N,{className:"pb-4 space-y-2",children:i(a).map(t=>e.jsx(T,{row:t.current,history:t.history,pooled:!0,exampleTerm:null,busyId:m,onAct:p},t.current.id))})]},s))})]})]})]})}export{G 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.