PageSourceSearch

https://panzoe.ai/static/js/2040.148b3483.chunk.js

js panzoe.ai collected 2026-10-05 12:22:39 UTC 42,031 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[2040],{76011(e,s,t){t.r(s),t.d(s,{default:()=>be});var a=t(53986),r=t(89379),i=t(5544),n=t(9950),l=t(87348),d=t(16243),o=t(18635),c=t(62388),m=t(15952),p=t(6890),x=t(29975),u=t(70446),h=t(77737),b=t(96479),g=t(56150),v=t(95451),j=t(66987),f=t(27304),N=t(69830),w=t(33360),y=t(76274),k=t(25692),A=t(2999),z=t(16038),_=t(58406),C=t(25391),S=t(52607),K=t(71742),I=t(62343),P=t(84814),D=t(90983),F=t(74314),H=t(68354),W=t(10987),M=t(2847),O=t(93245),T=t(60158),B=t(44813),E=t(52174),G=t(24980),R=t(32033),$=t(8806),q=t(41111),U=t(25551),L=t(42070),Q=t(10581),V=t(44267),X=t(10801),J=t(22668),Y=t(56507),Z=t(42989),ee=t(2737),se=t(52257),te=t(24779),ae=t(66744),re=t(44414);const ie=[{id:"projects",get label(){return(0,ae.tx)("Projects")},icon:V.A},{id:"people",get label(){return(0,ae.tx)("People")},icon:x.A},{id:"meetings",get label(){return(0,ae.tx)("Meetings")},icon:X.A},{id:"decisions",get label(){return(0,ae.tx)("Decisions")},icon:J.A}],ne=[(0,ae.tx)("What commitments are overdue?"),(0,ae.tx)("Which projects have unresolved risks?"),(0,ae.tx)("What decisions haven't resulted in actions?"),(0,ae.tx)("What changed this week?")];function le(){const e=(0,te.Bd)().t,s=(0,n.useState)(null),t=(0,i.A)(s,2),a=t[0],r=t[1],d=(0,n.useState)("projects"),o=(0,i.A)(d,2),c=o[0],m=o[1],p=(0,n.use
1State)(null),x=(0,i.A)(p,2),u=x[0],h=x[1],b=(0,n.useState)(""),g=(0,i.A)(b,2),v=g[0],j=g[1],N=(0,n.useState)(null),w=(0,i.A)(N,2),y=w[0],k=w[1],A=(0,n.useState)(!1),z=(0,i.A)(A,2),_=z[0],C=z[1];(0,n.useEffect)(()=>{$.FH.get("/executive/twin").then(e=>{let s=e.data;return r(s)}).catch(()=>r({error:!0}))},[]);const S=(0,n.useMemo)(()=>!a||a.error?[]:"projects"===c?a.projects:"people"===c?a.people:"meetings"===c?a.meetings:a.decisions,[a,c]);(0,n.useEffect)(()=>{h(S[0]||null)},[S]);const K=async e=>{const s=(e||v).trim();if(s){C(!0),k(null);try{const e=(await $.FH.post("/executive/twin/ask",{question:s})).data;k({q:s,a:e.answer})}catch(t){R.toast.error((0,$.KI)(t))}finally{C(!1)}}};if(!a)return(0,re.jsx)("div",{className:"h-40 animate-pulse rounded-2xl bg-card"});if(a.error)return null;const I=a.commitments;return(0,re.jsxs)("section",{className:"pz-card overflow-hidden","data-testid":"twin-intel",children:[(0,re.jsxs)("div",{className:"border-b border-border px-6 py-4",children:[(0,re.jsxs)("div",{className:"pz-label flex items-center gap-1.5",children:[(0,re.jsx)(Y.A,{className:"h-3 w-3"})," ",e("Relationship intelligence")]}),(0,re.jsx)("h2",{className:"mt-1 font-display text-lg font-semibold tracking-tight",children:e("How your business connects")})]}),(0,re.jsxs)("div",{className:"border-b border-border bg-background/30 px-6 py-4","data-testid":"twin-ask",children:[(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)("input",{value:v,onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&K(),placeholder:e("Ask the Business Twin \u2014 grounded in your real data\u2026"),"data-testid":"twin-ask-input",className:"w-full rounded-full border border-border bg-background/50 px-4 py-2.5 text-sm placeholder:text-muted-foreground focus:border-pz-accent focus:outline-none"}),(0,re.jsx)("button",{onClick:()=>K(),disabled:_,"data-testid":"twin-ask-send",className:"rounded-full bg-pz-accent p-2.5 text-background transition-transform hover:scale-105 disabled:opacity-50",children:_?(0,re.jsx)(Z.A,{className:"h-4 w-4 animate-spin"}):(0,re.jsx)(ee.A,{className:"h-4 w-4"})})]}),(0,re.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:ne.map(e=>(0,re.jsx)("button",{onClick:()=>{j(e),K(e)},"data-testid":"twin-ask-chip",className:"rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground hover:border-pz-accent/50 hover:text-foreground",children:e},e))}),y&&(0,re.jsxs)("div",{className:"mt-3 rounded-xl border border-pz-accent/25 bg-pz-accent/5 p-4","data-testid":"twin-ask-answer",children:[(0,re.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] font-semibold text-pz-accent",children:[(0,re.jsx)(f.A,{className:"h-3 w-3"})," ",y.q]}),(0,re.jsx)("p",{className:"mt-1.5 text-sm leading-relaxed text-foreground/90",children:y.a})]})]}),(0,re.jsxs)("div",{className:"border-b border-border px-6 py-4","data-testid":"twin-commitments",children:[(0,re.jsx)("div",{className:"pz-label mb-2",children:e("Commitments")}),(0,re.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-5",children:[["Open",I.open],["Overdue",I.overdue,I.overdue>0],[e("Due 7 days"),I.due_soon],[e("Done (30d)"),I.completed_30d],["Unassigned",I.unassigned,I.unassigned>0]].map(e=>{let s=(0,i.A)(e,3),t=s[0],a=s[1],r=s[2];return(0,re.jsxs)(l.N_,{to:"Overdue"===t?"/business/actions?filter=overdue":"/business/actions",className:"rounded-xl border p-2.5 text-center hover:border-pz-accent/50 ".concat(r?"border-amber-400/30 bg-amber-400/5":"border-border bg-background/40"),children:[(0,re.jsx)("div",{className:"text-lg font-bold ".concat(r?"text-amber-400":""),children:a}),(0,re.jsx)("div",{className:"text-[10px] text-muted-foreground",children:t})]},t)})}),[...I.overdue_list,...I.due_soon_list].slice(0,4).map(e=>(0,re.jsxs)(l.N_,{to:"/business/actions","data-testid":"twin-commitment-row",className:"mt-1.5 flex items-center gap-2 rounded-lg border border-border/60 bg-background/30 px-3 py-2 text-xs hover:border-pz-accent/50",children:[(0,re.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat(e.due_date<a.date?"bg-red-400":"bg-amber-400")}),(0,re.jsx)("span",{className:"truncate",children:e.title}),e.owner&&(0,re.jsxs)("span",{className:"text-muted-foreground",children:["\xb7 ",e.owner]}),(0,re.jsx)("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-muted-foreground",children:e.due_date})]},e.action_id))]}),(0,re.jsxs)("div",{className:"px-6 py-4",children:[(0,re.jsx)("div",{className:"flex gap-1 rounded-full border border-border bg-background/40 p-1 w-fit",children:ie.map(e=>(0,re.jsxs)("button",{onClick:()=>m(e.id),"data-testid":"twin-entity-tab-".concat(e.id),className:"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-medium ".concat(c===e.id?"bg-pz-accent/15 text-pz-accent":"text-muted-foreground hover:text-foreground"),children:[(0,re.jsx)(e.icon,{className:"h-3 w-3"})," ",e.label]},e.id))}),0===S.length?(0,re.jsx)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"twin-empty",children:e("Nothing here yet \u2014 as you add {{v0}}, their relationships appear automatically.",{v0:c})}):(0,re.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-[280px_1fr]",children:[(0,re.jsx)("div",{className:"max-h-64 space-y-1 overflow-y-auto pr-1",children:S.slice(0,20).map(s=>{const t=s.project_id||s.user_id||s.meeting_id||s.decision_id,a=s.name||s.title,r=u&&(u.project_id||u.user_id||u.meeting_id||u.decision_id)===t;return(0,re.jsxs)("button",{onClick:()=>h(s),"data-testid":"twin-entity-row",className:"flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-left text-xs ".concat(r?"border-pz-accent/60 bg-pz-accent/10":"border-border/60 bg-background/30 hover:border-pz-accent/40"),children:[(0,re.jsx)("span",{className:"truncate font-medium",children:a}),s.no_follow_up&&(0,re.jsx)("span",{className:"ml-auto shrink-0 rounded-full bg-amber-400/10 px-1.5 py-px text-[9px] text-amber-400",children:e("no follow-up")}),s.overdue>0&&(0,re.jsx)("span",{className:"ml-auto shrink-0 rounded-full bg-red-400/10 px-1.5 py-px text-[9px] text-red-400",children:e("{{v0}} overdue",{v0:s.overdue})})]},t)})}),u&&(0,re.jsx)(de,{tab:c,sel:u,twin:a})]})]})]})}function de(e){let s=e.tab,t=e.sel,a=e.twin;const r=(0,te.Bd)().t,n=Object.fromEntries(a.people.map(e=>[e.user_id,e.name])),d=Object.fromEntries(a.projects.map(e=>[e.project_id,e.name])),o=[];return"projects"===s?o.push([r("{{v0}} open actions ({{v1}} overdue)",{v0:t.open_actions,v1:t.overdue}),"/business/actions"],["".concat(t.decisions," decisions"),"/business/actions?tab=decisions"],[r("{{v0}} linked meetings",{v0:t.meetings.length}),"/business/meetings"],[r("{{v0}} open risks",{v0:t.risks}
1),"/business/compliance"],[r("{{v0}} people involved{{v1}}",{v0:t.people.length,v1:t.people.length?": "+t.people.map(e=>n[e]||"member").join(", "):""}),"/team"]):"people"===s?o.push([r("{{v0}} open actions ({{v1}} overdue, {{v2}} due this week)",{v0:t.open_actions,v1:t.overdue,v2:t.due_7d}),"/business/actions"],["".concat(t.projects.length," projects").concat(t.projects.length?": "+t.projects.map(e=>d[e]||"project").join(", "):""),"/business/projects"],[r("{{v0}} meetings produced their actions",{v0:t.meetings}),"/business/meetings"]):"meetings"===s?o.push([r("{{v0}} decisions came from this meeting",{v0:t.decisions}),"/business/actions?tab=decisions"],[r("{{v0}} actions came from this meeting",{v0:t.actions}),"/business/actions"],["Status: ".concat(t.status),"/business/meetings"]):o.push([t.meeting_id?r("Created from a meeting"):r("Recorded manually"),"/business/meetings"],[t.project_id?"Project: ".concat(d[t.project_id]||"linked"):r("No project linked"),"/business/projects"],["".concat(t.follow_ups," follow-up action").concat(1===t.follow_ups?"":"s").concat(t.no_follow_up?" \u2014 needs follow-up":""),"/business/actions"],[t.decided_by_name?r("Decided by {{v0}}",{v0:t.decided_by_name}):"Status: ".concat(t.status),"/team"]),(0,re.jsxs)("div",{className:"rounded-xl border border-border/70 bg-background/40 p-4","data-testid":"twin-connections",children:[(0,re.jsx)("div",{className:"truncate text-sm font-semibold",children:t.name||t.title}),(0,re.jsx)("div",{className:"mt-2 space-y-1.5",children:o.map((e,s)=>{let t=(0,i.A)(e,2),a=t[0],r=t[1];return(0,re.jsxs)(l.N_,{to:r,className:"group flex items-center gap-2 rounded-lg px-2 py-1.5 text-xs text-foreground/85 hover:bg-secondary/50","data-testid":"twin-connection-link",children:[(0,re.jsx)("span",{className:"h-1 w-1 shrink-0 rounded-full bg-pz-accent/70"}),(0,re.jsx)("span",{className:"min-w-0 flex-1",children:a}),(0,re.jsx)(se.A,{className:"h-3 w-3 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100"})]},s)})})]})}const oe=["label","testid","className"],ce=["label","testid","className"],me={compliance:{label:"Compliance",icon:d.A,tone:"emerald"},projects:{label:"Project delivery",icon:o.A,tone:"blue"},operations:{label:"Operational health",icon:c.A,tone:"amber"},meetings:{label:"Meeting effectiveness",icon:m.A,tone:"fuchsia"},financial:{label:"Financial health",icon:p.A,tone:"rose"},team:{label:"Team health",icon:x.A,tone:"purple"}},pe={emerald:{text:"text-emerald-400",bg:"bg-emerald-500/10",stroke:"#34d399"},blue:{text:"text-pz-blue",bg:"bg-pz-blue/10",stroke:"#60a5fa"},amber:{text:"text-amber-400",bg:"bg-amber-500/10",stroke:"#fbbf24"},fuchsia:{text:"text-fuchsia-400",bg:"bg-fuchsia-500/10",stroke:"#e879f9"},rose:{text:"text-rose-400",bg:"bg-rose-500/10",stroke:"#fb7185"},purple:{text:"text-pz-purple",bg:"bg-pz-purple/10",stroke:"#a78bfa"}},xe=["revenue","profit","cashflow","projects","schedule","risks","compliance","customers","employees","custom"],ue=[{id:"accepted",label:"Accept",icon:u.A},{id:"deferred",label:"Defer",icon:h.A},{id:"dismissed",label:"Dismiss",icon:b.A},{id:"completed",label:"Complete",icon:g.A}],he=e=>({strong:"border-emerald-500/40 bg-emerald-500/10 text-emerald-300",ok:"border-amber-500/40 bg-amber-500/10 text-amber-300",weak:"border-rose-500/40 bg-rose-500/10 text-rose-300"}[e]||"border-border bg-background text-foreground");function be(){const e=(0,n.useState)(null),s=(0,i.A)(e,2),t=s[0],a=s[1],r=(0,n.useState)([]),l=(0,i.A)(r,2),d=l[0],o=l[1],c=(0,n.useState)("overview"),m=(0,i.A)(c,2),p=m[0],x=m[1],u=(0,n.useState)(!0),h=(0,i.A)(u,2),b=h[0],g=h[1],z=(0,n.useState)(!1),_=(0,i.A)(z,2),C=_[0],S=_[1],K=(0,n.useCallback)(async()=>{try{const e=await Promise.all([$.FH.get("/twin/summary"),$.FH.get("/twin/health/trend",{params:{days:30}})]),s=(0,i.A)(e,2),t=s[0],r=s[1];a(t.data),o(r.data||[])}catch(e){R.toast.error((0,$.KI)(e))}finally{g(!1)}},[]);(0,n.useEffect)(()=>{K()},[K]);if(b&&!t)return(0,re.jsx)(Pe,{});const I=null===t||void 0===t?void 0:t.health,P=(null===t||void 0===t?void 0:t.kpis)||[],D=(null===t||void 0===t?void 0:t.recommendations)||[],F=D.filter(e=>"open"===e.status);return(0,re.jsx)("div",{"data-testid":"business-twin",className:"px-6 py-8 sm:px-10",children:(0,re.jsxs)("div",{className:"mx-auto max-w-7xl space-y-8 animate-in-up",children:[(0,re.jsxs)("section",{className:"relative overflow-hidden rounded-2xl pz-glass p-8 sm:p-10",children:[(0,re.jsx)("div",{className:"pointer-events-none absolute -right-32 -top-32 h-[520px] w-[520px] rounded-full bg-gradient-to-br from-rose-500/20 via-pz-purple/15 to-pz-accent/0 blur-[140px]"}),(0,re.jsx)("div",{className:"pointer-events-none absolute inset-0 pz-noise"}),(0,re.jsxs)("div",{className:"relative grid gap-8 lg:grid-cols-[1.2fr_1fr] lg:items-center",children:[(0,re.jsxs)("div",{children:[(0,re.jsxs)("span",{className:"pz-pill",children:[(0,re.jsx)(v.A,{className:"h-3 w-3 text-rose-400 pz-pulse"}),"Panzoe \xb7 AI Business Twin"]}),(0,re.jsx)("h1",{className:"mt-4 font-display text-4xl font-bold tracking-tight sm:text-5xl",children:"A living digital twin of your business."}),(0,re.jsx)("p",{className:"mt-3 max-w-xl text-base leading-relaxed text-muted-foreground",children:"Every copilot, every meeting, every risk, every KPI \u2014 synthesised into one health score and a ranked queue of executive moves."}),(0,re.jsxs)("div",{className:"mt-5 flex flex-wrap items-center gap-2",children:[(0,re.jsxs)(q.$,{onClick:async()=>{S(!0);try{await $.FH.post("/twin/health/refresh"),await K(),R.toast.success("Business health refreshed")}catch(e){R.toast.error((0,$.KI)(e))}finally{S(!1)}},disabled:C,"data-testid":"twin-refresh",className:"gap-1.5 bg-gradient-to-r from-rose-500 to-pz-purple hover:opacity-90",children:[(0,re.jsx)(j.A,{className:"h-3.5 w-3.5 ".concat(C?"animate-spin":"")}),"Refresh score"]}),(0,re.jsxs)(q.$,{variant:"outline",onClick:async()=>{try{const e=(await $.FH.post("/twin/recommendations/generate")).data;R.toast.success("Created ".concat(e.count," recommendation(s)")),await K()}catch(e){R.toast.error((0,$.KI)(e))}},"data-testid":"twin-generate",className:"gap-1.5",children:[(0,re.jsx)(f.A,{className:"h-3.5 w-3.5"})," Generate AI recommendations"]}),(0,re.jsxs)("button",{"data-testid":"twin-ask-panzoe",onClick:Q.XB,className:"pz-pill",children:[(0,re.jsx)(N.A,{className:"h-3 w-3"}),' Ask Panzoe: "How healthy is my business?"']})]})]}),(0,re.jsx)(ge,{health:I,trend:d})]})]}),(0,re.jsx)(le,{}),(0,re.jsx)(L.A,{copilotKey:"twin",tone:"text-rose-400"}),(0,re.jsx)("div",{className:"flex items-center gap-1.5","data-testid":"twin-tabs",children:[{id:"overview",label:"Health overview",icon:w.A},{id:"kpis",label:"KPIs",icon:y.A},{id:"recommendations",label:"Recommendations",icon:f.A,badge:F.length},{id:"timeline",label:"Timeline",icon:k.A},{id:"profile",label:"Company profile",icon:A.A},{id:"copilot",label:"Ask Twin",icon:N.A}].map(e=>(0,re.jsxs)("button",{"data-testid":"twin-tab-".concat(e.id),onClick:()=>x(e.id),className:"inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs transition-colors ".concat(p===e.id?"border-pz-accent bg-pz-accent/15 text-pz-accent":"border-border text-muted-foreground hover:border-pz-purple/40"),children:[(0,re.jsx)(e.icon,{className:"h-3 w-3"}),e.label,"number"===typeof e.badge&&e.badge>0&&(0,re.jsx)("span",{className:"ml-1 rounded-full bg-pz-accent/20 px-1.5 py-[1px] text-[9px]",children:e.badge})]},e.id))}
1),"overview"===p&&(0,re.jsx)(ve,{health:I,trend:d,kpis:P,recs:F}),"kpis"===p&&(0,re.jsx)(fe,{kpis:P,onChanged:K}),"recommendations"===p&&(0,re.jsx)(ke,{recs:D,onChanged:K}),"timeline"===p&&(0,re.jsx)(ze,{}),"profile"===p&&(0,re.jsx)(_e,{initial:null===t||void 0===t?void 0:t.profile}),"copilot"===p&&(0,re.jsx)("div",{className:"pz-card p-4",children:(0,re.jsx)(U.A,{copilotId:"twin",title:"Ask the Business Twin",placeholder:"Ask about health, risks, priorities, or 'why did my score decrease?'"})})]})})}function ge(e){let s=e.health,t=e.trend;if(!s)return null;const a=s.overall||0,r=2*Math.PI*66,i=a/100*r,n=he(s.band),l=(t||[]).map(e=>({at:(e.created_at||"").slice(5,10),overall:e.overall}));return(0,re.jsx)("div",{className:"rounded-xl border border-border bg-background/50 p-6 backdrop-blur-xl",children:(0,re.jsxs)("div",{className:"flex items-center gap-6",children:[(0,re.jsxs)("div",{className:"relative flex h-40 w-40 shrink-0 items-center justify-center",children:[(0,re.jsxs)("svg",{viewBox:"0 0 160 160",className:"h-full w-full -rotate-90",children:[(0,re.jsx)("circle",{cx:"80",cy:"80",r:"66",stroke:"rgba(255,255,255,0.06)",strokeWidth:"12",fill:"none"}),(0,re.jsx)("circle",{cx:"80",cy:"80",r:"66",stroke:"url(#twinGrad)",strokeWidth:"12",fill:"none",strokeDasharray:"".concat(i," ").concat(r),strokeLinecap:"round",style:{transition:"stroke-dasharray 700ms ease"}}),(0,re.jsx)("defs",{children:(0,re.jsxs)("linearGradient",{id:"twinGrad",x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,re.jsx)("stop",{offset:"0%",stopColor:"#f472b6"}),(0,re.jsx)("stop",{offset:"60%",stopColor:"#a78bfa"}),(0,re.jsx)("stop",{offset:"100%",stopColor:"#60a5fa"})]})})]}),(0,re.jsxs)("div",{className:"absolute flex flex-col items-center",children:[(0,re.jsx)("div",{className:"font-display text-4xl font-bold tracking-tight","data-testid":"twin-overall-score",children:Math.round(a)}),(0,re.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"/ 100"})]})]}),(0,re.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,re.jsx)("div",{className:"pz-label",children:"Overall business health"}),(0,re.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium capitalize ".concat(n),"data-testid":"twin-band",children:[(0,re.jsx)(v.A,{className:"h-3 w-3"})," ",s.band]}),(0,re.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Computed ",(s.computed_at||"").slice(11,16)," UTC \xb7 ",(t||[]).length," snapshots recorded"]}),l.length>1&&(0,re.jsx)("div",{className:"h-14 min-h-[56px] w-full",children:(0,re.jsx)(F.u,{width:"100%",height:"100%",children:(0,re.jsxs)(H.Q,{data:l,children:[(0,re.jsx)("defs",{children:(0,re.jsxs)("linearGradient",{id:"spark",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,re.jsx)("stop",{offset:"0%",stopColor:"#a78bfa",stopOpacity:.5}),(0,re.jsx)("stop",{offset:"100%",stopColor:"#a78bfa",stopOpacity:0})]})}),(0,re.jsx)(W.Gk,{type:"monotone",dataKey:"overall",stroke:"#a78bfa",fill:"url(#spark)",strokeWidth:1.5})]})})})]})]})})}function ve(e){let s=e.health,t=e.trend,a=e.kpis,n=e.recs;if(!s)return null;const l=s.pillars||{};return(0,re.jsxs)("div",{className:"grid gap-4 lg:grid-cols-3",children:[Object.entries(l).map(e=>{var a;let r=(0,i.A)(e,2),n=r[0],l=r[1];return(0,re.jsx)(je,{id:n,pillar:l,trend:t,weight:null===(a=s.weights)||void 0===a?void 0:a[n]},n)}),(0,re.jsxs)("div",{className:"pz-card overflow-hidden lg:col-span-2","data-testid":"twin-trend-card",children:[(0,re.jsx)("header",{className:"border-b border-border px-5 py-3.5",children:(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)(z.A,{className:"h-3.5 w-3.5 text-pz-accent"}),(0,re.jsx)("div",{className:"text-sm font-medium",children:"Health score \xb7 last 30 days"})]})}),(0,re.jsx)("div",{className:"h-64 min-h-[240px] p-4",children:t.length<2?(0,re.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center",children:[(0,re.jsx)(z.A,{className:"h-6 w-6 text-muted-foreground"}),(0,re.jsx)("p",{className:"text-sm text-muted-foreground",children:"Refresh a few times to build a trend line."})]}):(0,re.jsx)(F.u,{width:"100%",height:"100%",children:(0,re.jsxs)(M.b,{data:t.map(e=>(0,r.A)({at:(e.created_at||"").slice(5,16).replace("T"," "),overall:e.overall},e.pillars)),children:[(0,re.jsx)(O.d,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.05)"}),(0,re.jsx)(T.W,{dataKey:"at",stroke:"rgba(255,255,255,0.4)",fontSize:10}),(0,re.jsx)(B.h,{domain:[0,100],stroke:"rgba(255,255,255,0.4)",fontSize:10}),(0,re.jsx)(E.m,{contentStyle:{background:"rgba(15,23,42,0.9)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,fontSize:12}}),(0,re.jsx)(G.N1,{dataKey:"overall",stroke:"#a78bfa",strokeWidth:2.5,dot:!1}),(0,re.jsx)(G.N1,{dataKey:"compliance",stroke:"#34d399",strokeWidth:1,dot:!1,strokeDasharray:"4 4"}),(0,re.jsx)(G.N1,{dataKey:"projects",stroke:"#60a5fa",strokeWidth:1,dot:!1,strokeDasharray:"4 4"}),(0,re.jsx)(G.N1,{dataKey:"financial",stroke:"#fb7185",strokeWidth:1,dot:!1,strokeDasharray:"4 4"})]})})})]}),(0,re.jsxs)("div",{className:"pz-card overflow-hidden","data-testid":"twin-top-recs",children:[(0,re.jsx)("header",{className:"border-b border-border px-5 py-3.5",children:(0,re.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)(f.A,{className:"h-3.5 w-3.5 text-pz-accent"}),(0,re.jsx)("div",{className:"text-sm font-medium",children:"Top recommendations"})]}),(0,re.jsxs)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:[n.length," open"]})]})}),0===n.length?(0,re.jsxs)("div",{className:"px-5 py-10 text-center text-sm text-muted-foreground",children:["No open recommendations. Click ",(0,re.jsx)("span",{className:"text-pz-accent",children:"Generate AI recommendations"}),"."]}):(0,re.jsx)("ul",{className:"divide-y divide-border",children:n.slice(0,4).map(e=>(0,re.jsxs)("li",{className:"px-5 py-3",children:[(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)(Ae,{score:e.priority_score}),(0,re.jsx)("span",{className:"truncate text-sm font-medium",children:e.title})]}),(0,re.jsxs)("div",{className:"mt-0.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:[e.category," \xb7 impact ",e.impact," \xb7 urgency ",e.urgency]})]},e.recommendation_id))})]}),(0,re.jsxs)("div",{className:"pz-card overflow-hidden lg:col-span-3","data-testid":"twin-signals",children:[(0,re.jsx)("header",{className:"border-b border-border px-5 py-3.5",children:(0,re.jsx)("div",{className:"text-sm font-medium",children:"Signals & KPIs feeding the score"})}),(0,re.jsx)("div",{className:"grid gap-4 p-5 sm:grid-cols-2 lg:grid-cols-3",children:Object.entries(l).map(e=>{var s;let t=(0,i.A)(e,2),a=t[0],r=t[1];return(0,re.jsxs)("div",{children:[(0,re.jsx)("div",{className:"pz-label mb-2",children:(null===(s=me[a])||void 0===s?void 0:s.label)||a}),(0,re.jsx)("ul",{className:"space-y-1 text-xs",children:(r.signals||[]).map((e,s)=>(0,re.jsxs)("li",{className:"flex items-center justify-between border-b border-border/40 pb-1",children:[(0,re.jsx)("span",{className:"text-muted-foreground",children:e.label}),(0,re.jsx)("span",{className:"font-mono",children:String(e.value)})]},s))})]},a)})}),a.length>0&&(0,re.jsxs)("div",{className:"border-t border-border px-5 py-3 text-[10px] uppercase tracking-wider text-muted-foreground",children:[a.length," KPI(s) currently attached to Financial & Team pillars"]})]})]})}function je(e){var s,t;let a=e.id,r=e.pillar,i=e.trend,n=e.weight;const l=me[a]||{label:a,icon:_.A,tone:"purple"},d=pe[l.tone],o=l.icon,c=(i||[]).map(e=>{var s,t;return{x:(e.created_at||"").slice(5,10),y:null!==(s=null===(t=e.pillars)||void 0===t?void 0:t[a])&&void 0!==s?s:null}}),m=c.length?null===(s=c[c.length-1])||void 0===s?void 0:s.y:null,x=c.length>1?null===(t=c[c.length-2])||void 0===t?void 0:t.y:null,u=null!=m&&null!=x?m-x:null;return(0,re.jsxs)("div",{className:"pz-card overflow-hidden","data-testid":"twin-pillar-".concat(a),children:[(0,re.jsxs)("div",{className:"flex items-start justify-between border-b border-border px-5 py-3.5",children:[(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)("div",{className:"flex h-7 w-7 items-center justify-center rounded-md ".concat(d.bg," ").concat(d.text),children:(0,re.jsx)(o,{className:"h-3.5 w-3.5"})}),(0,re.jsxs)("div",{children:[(0,re.jsx)("div",{className:"text-sm font-medium",children:l.label}),(0,re.jsxs)("div",{className:"mt-0.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:["weight ",(100*n).toFixed(0),"%"]})]})]}),(0,re.jsx)("span",{className:"rounded-full border px-2 py-0.5 text-[10px] capitalize ".concat(he(r.band)),children:r.band})]}),(0,re.jsxs)("div",{className:"flex items-center justify-between gap-4 px-5 py-4",children:[(0,re.jsxs)("div",{children:[(0,re.jsx)("div",{className:"font-display text-3xl font-bold ".concat(d.text),children:Math.round(r.
1score)}),null!=u&&(0,re.jsxs)("div",{className:"mt-1 flex items-center gap-1 text-[10px] uppercase tracking-wider ".concat(u>=0?"text-emerald-400":"text-rose-400"),children:[u>=0?(0,re.jsx)(p.A,{className:"h-3 w-3"}):(0,re.jsx)(C.A,{className:"h-3 w-3"}),u>0?"+":"",u.toFixed(1)]})]}),(0,re.jsx)("div",{className:"h-14 min-h-[56px] w-[140px] shrink-0",children:c.length>1&&(0,re.jsx)(F.u,{width:"100%",height:"100%",children:(0,re.jsxs)(H.Q,{data:c,children:[(0,re.jsx)("defs",{children:(0,re.jsxs)("linearGradient",{id:"grad-".concat(a),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,re.jsx)("stop",{offset:"0%",stopColor:d.stroke,stopOpacity:.5}),(0,re.jsx)("stop",{offset:"100%",stopColor:d.stroke,stopOpacity:0})]})}),(0,re.jsx)(W.Gk,{type:"monotone",dataKey:"y",stroke:d.stroke,fill:"url(#grad-".concat(a,")"),strokeWidth:1.5})]})})})]})]})}function fe(e){let s=e.kpis,t=e.onChanged;const a=(0,n.useState)(!1),r=(0,i.A)(a,2),l=r[0],d=r[1];return(0,re.jsxs)("div",{className:"space-y-4",children:[(0,re.jsxs)("div",{className:"flex items-center justify-between",children:[(0,re.jsxs)("div",{children:[(0,re.jsx)("h2",{className:"font-display text-xl font-semibold tracking-tight",children:"KPI framework"}),(0,re.jsx)("p",{className:"text-sm text-muted-foreground",children:"Configure the numbers Panzoe scores your business on."})]}),(0,re.jsxs)(q.$,{onClick:()=>d(!0),"data-testid":"twin-add-kpi",className:"gap-1.5",children:[(0,re.jsx)(S.A,{className:"h-3.5 w-3.5"})," Add KPI"]})]}),l&&(0,re.jsx)(Ne,{onClose:()=>d(!1),onSaved:()=>{d(!1),t()}}),(0,re.jsx)("div",{className:"pz-card overflow-hidden","data-testid":"twin-kpi-list",children:0===s.length?(0,re.jsxs)("div",{className:"flex flex-col items-center gap-2 px-6 py-16 text-center",children:[(0,re.jsx)(y.A,{className:"h-6 w-6 text-muted-foreground"}),(0,re.jsx)("p",{className:"font-medium",children:"No KPIs yet"}),(0,re.jsx)("p",{className:"text-sm text-muted-foreground",children:"Add Revenue, Profit and Cashflow first \u2014 they feed Financial health."})]}):(0,re.jsx)("ul",{className:"divide-y divide-border",children:s.map(e=>(0,re.jsx)(we,{kpi:e,onChanged:t},e.kpi_id))})})]})}function Ne(e){var s,t,a;let l=e.initial,d=e.onClose,o=e.onSaved;const c=(0,n.useState)({name:(null===l||void 0===l?void 0:l.name)||"",category:(null===l||void 0===l?void 0:l.category)||"revenue",value:null!==(s=null===l||void 0===l?void 0:l.value)&&void 0!==s?s:"",target:null!==(t=null===l||void 0===l?void 0:l.target)&&void 0!==t?t:"",unit:(null===l||void 0===l?void 0:l.unit)||"",weight:null!==(a=null===l||void 0===l?void 0:l.weight)&&void 0!==a?a:1,direction:(null===l||void 0===l?void 0:l.direction)||"up",notes:(null===l||void 0===l?void 0:l.notes)||""}),m=(0,i.A)(c,2),p=m[0],x=m[1];return(0,re.jsxs)("form",{onSubmit:async e=>{e.preventDefault();try{const e=(0,r.A)((0,r.A)({},p),{},{value:""===p.value?null:Number(p.value),target:""===p.target?null:Number(p.target),weight:Number(p.weight)});null!==l&&void 0!==l&&l.kpi_id?await $.FH.patch("/twin/kpis/".concat(l.kpi_id),e):await $.FH.post("/twin/kpis",e),R.toast.success("KPI saved"),o()}catch(s){R.toast.error((0,$.KI)(s))}},"data-testid":"twin-kpi-form",className:"pz-card grid gap-3 p-5 sm:grid-cols-2",children:[(0,re.jsxs)("div",{className:"sm:col-span-2",children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Name"}),(0,re.jsx)("input",{required:!0,"data-testid":"kpi-name",value:p.name,onChange:e=>x((0,r.A)((0,r.A)({},p),{},{name:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",placeholder:"e.g. Q1 Revenue"})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Category"}),(0,re.jsx)("select",{"data-testid":"kpi-category",value:p.category,onChange:e=>x((0,r.A)((0,r.A)({},p),{},{category:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm capitalize",children:xe.map(e=>(0,re.jsx)("option",{value:e,className:"capitalize",children:e},e))})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Direction"}),(0,re.jsxs)("select",{"data-testid":"kpi-direction",value:p.direction,onChange:e=>x((0,r.A)((0,r.A)({},p),{},{direction:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",children:[(0,re.jsx)("option",{value:"up",children:"Higher is better"}),(0,re.jsx)("option",{value:"down",children:"Lower is better"})]})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Current value"}),(0,re.jsx)("input",{type:"number",step:"any","data-testid":"kpi-value",value:p.value,onChange:e=>x((0,r.A)((0,r.A)({},p),{},{value:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Target"}),(0,re.jsx)("input",{type:"number",step:"any","data-testid":"kpi-target",value:p.target,onCh
1ange:e=>x((0,r.A)((0,r.A)({},p),{},{target:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Unit"}),(0,re.jsx)("input",{"data-testid":"kpi-unit",value:p.unit,onChange:e=>x((0,r.A)((0,r.A)({},p),{},{unit:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm",placeholder:"USD / % / users"})]}),(0,re.jsxs)("div",{children:[(0,re.jsx)("label",{className:"pz-label mb-1 block",children:"Weight (0-10)"}),(0,re.jsx)("input",{type:"number",step:"0.1",min:"0",max:"10","data-testid":"kpi-weight",value:p.weight,onChange:e=>x((0,r.A)((0,r.A)({},p),{},{weight:e.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"})]}),(0,re.jsxs)("div",{className:"sm:col-span-2 flex justify-end gap-2",children:[(0,re.jsx)(q.$,{type:"button",variant:"ghost",onClick:d,children:"Cancel"}),(0,re.jsxs)(q.$,{type:"submit","data-testid":"kpi-save",className:"gap-1.5",children:[(0,re.jsx)(K.A,{className:"h-3.5 w-3.5"})," Save KPI"]})]})]})}function we(e){var s;let t=e.kpi,a=e.onChanged;const r=(0,n.useState)(!1),l=(0,i.A)(r,2),d=l[0],o=l[1],c=t.target&&t.value?Number(t.value)/Number(t.target):null,m=null!=c?Math.max(0,Math.min(120,100*c)):null;return d?(0,re.jsx)("div",{className:"p-3",children:(0,re.jsx)(Ne,{initial:t,onClose:()=>o(!1),onSaved:()=>{o(!1),a()}})}):(0,re.jsxs)("li",{className:"grid gap-3 px-5 py-4 sm:grid-cols-[1fr_auto_auto] sm:items-center","data-testid":"kpi-row-".concat(t.kpi_id),children:[(0,re.jsxs)("div",{className:"min-w-0",children:[(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)("span",{className:"truncate text-sm font-medium",children:t.name}),(0,re.jsx)("span",{className:"pz-pill !py-0 !text-[9px] capitalize",children:t.category})]}),(0,re.jsxs)("div",{className:"mt-0.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:["Weight ",null!==(s=t.weight)&&void 0!==s?s:1," \xb7 ","down"===t.direction?"lower is better":"higher is better"]}),null!=m&&(0,re.jsx)("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-background/60",children:(0,re.jsx)("div",{className:"h-full rounded-full transition-all ".concat(m>=90?"bg-emerald-500":m>=60?"bg-amber-500":"bg-rose-500"),style:{width:"".concat(Math.min(100,m),"%")}})})]}),(0,re.jsxs)("div",{className:"text-right font-mono text-lg",children:[(0,re.jsxs)("div",{children:[ye(t.value),(0,re.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:t.unit})]}),(0,re.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:["target ",ye(t.target)]})]}),(0,re.jsxs)("div",{className:"flex items-center gap-1",children:[(0,re.jsx)("button",{"data-testid":"kpi-edit-".concat(t.kpi_id),onClick:()=>o(!0),className:"rounded-md p-2 hover:bg-accent/40",children:(0,re.jsx)(I.A,{className:"h-3.5 w-3.5"})}),(0,re.jsx)("button",{"data-testid":"kpi-del-".concat(t.kpi_id),onClick:async()=>{if(window.confirm('Delete "'.concat(t.name,'"?')))try{await $.FH.delete("/twin/kpis/".concat(t.kpi_id)),R.toast.success("KPI deleted"),a()}catch(e){R.toast.error((0,$.KI)(e))}},className:"rounded-md p-2 text-rose-400 hover:bg-rose-500/10",children:(0,re.jsx)(P.A,{className:"h-3.5 w-3.5"})})]})]})}const ye=e=>null==e||""===e?"\u2014":Number(e).toLocaleString();function ke(e){let s=e.recs,t=e.onChanged;const a=(0,n.useState)("open"),r=(0,i.A)(a,2),l=r[0],d=r[1],o=(0,n.useMemo)(()=>"all"===l?s:s.filter(e=>e.status===l),[s,l]);return(0,re.jsxs)("div",{className:"space-y-4",children:[(0,re.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:["open","accepted","deferred","dismissed","completed","all"].map(e=>(0,re.jsx)("button",{"data-testid":"rec-filter-".concat(e),onClick:()=>d(e),className:"rounded-full border px-2.5 py-0.5 text-[11px] capitalize ".concat(l===e?"border-pz-accent bg-pz-accent/15 text-pz-accent":"border-border text-muted-foreground hover:border-pz-purple/40"),children:e},e))}),0===o.length?(0,re.jsxs)("div",{className:"pz-card px-6 py-14 text-center",children:[(0,re.jsx)(f.A,{className:"mx-auto h-6 w-6 text-muted-foreground"}),(0,re.jsx)("p",{className:"mt-3 text-sm text-muted-foreground",children:"No recommendations in this state yet."})]}):(0,re.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(e=>(0,re.jsx)("div",{className:"pz-card p-4","data-testid":"rec-card-".concat(e.recommendation_id),children:(0,re.jsxs)("div",{className:"flex items-start gap-2",children:[(0,re.jsx)(Ae,{score:e.priority_score}),(0,re.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,re.jsxs)("div",{className:"flex items-center gap-2",children:[(0,re.jsx)("span",{className:"pz-pill !py-0 !text-[9px] capitalize",children:e.category}),(0,re.jsx)("span",{className:"pz-pill !py-0 !text-[9px] capitalize",children:e.status})]}),(0,re.jsx)("h3",{className:"mt-2 font-medium leading-snug",children:e.title}),e.detail&&(0,re.jsx)("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:e.detail}),(0,re.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,re.jsxs)("span",{children:["Impact ",(0,re.jsx)("span",{className:"text-foreground",children:e.impact})]}),(0,re.jsxs)("span",{children:["Urgency ",(0,re.jsx)("span",{className:"text-foreground",children:e.urgency})]}),(0,re.jsxs)("span",{children:["Confidence ",(0,re.jsxs)("span",{className:"text-foreground",children:[Math.round(100*(e.confidence||0)),"%"]})]}
1),(0,re.jsxs)("span",{children:["Priority ",(0,re.jsx)("span",{className:"text-foreground",children:Math.round(e.priority_score||0)})]})]}),"open"===e.status&&(0,re.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:ue.map(s=>(0,re.jsxs)("button",{"data-testid":"rec-".concat(e.recommendation_id,"-").concat(s.id),onClick:()=>(async(e,s)=>{try{await $.FH.patch("/twin/recommendations/".concat(e),{status:s}),R.toast.success("Marked ".concat(s)),t()}catch(a){R.toast.error((0,$.KI)(a))}})(e.recommendation_id,s.id),className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] hover:border-pz-accent/60 hover:bg-accent/40",children:[(0,re.jsx)(s.icon,{className:"h-3 w-3"})," ",s.label]},s.id))})]})]})},e.recommendation_id))})]})}function Ae(e){let s=e.score;const t=Number(s||0),a=t>=15?"bg-rose-500":t>=8?"bg-amber-500":"bg-emerald-500";return(0,re.jsx)("span",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full ".concat(a)})}function ze(){const e=(0,n.useState)([]),s=(0,i.A)(e,2),t=s[0],a=s[1],r=(0,n.useState)(!0),d=(0,i.A)(r,2),o=d[0],c=d[1];return(0,n.useEffect)(()=>{$.FH.get("/activity/timeline",{params:{limit:60}}).then(e=>{let s=e.data;return a(s.events||[])}).catch(()=>{}).finally(()=>c(!1))},[]),o?(0,re.jsx)("div",{className:"h-40 animate-pulse rounded-xl bg-card/60"}):0===t.length?(0,re.jsx)("div",{className:"pz-card px-6 py-14 text-center text-sm text-muted-foreground",children:"No org events yet."}):(0,re.jsx)("div",{className:"pz-card overflow-hidden","data-testid":"twin-timeline",children:(0,re.jsx)("ul",{className:"max-h-[560px] divide-y divide-border overflow-y-auto",children:t.map((e,s)=>{const t=me[e.copilot]||{icon:_.A,tone:"purple"},a=pe[t.tone],r=t.icon;return(0,re.jsxs)("li",{className:"flex items-start gap-3 px-5 py-3",children:[(0,re.jsx)("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md ".concat(a.bg," ").concat(a.text),children:(0,re.jsx)(r,{className:"h-3.5 w-3.5"})}),(0,re.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,re.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),e.detail&&(0,re.jsx)("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:e.detail}),(0,re.jsxs)("div",{className:"mt-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:[e.copilot," \xb7 ",(e.at||"").slice(0,19).replace("T"," ")]})]}),e.href&&(0,re.jsx)(l.N_,{to:e.href,className:"rounded-md p-1.5 text-muted-foreground hover:bg-accent/40",children:(0,re.jsx)(D.A,{className:"h-3.5 w-3.5"})})]},s)})})})}function _e(e){let s=e.initial;const t=(0,n.useState)(()=>Ce(s)),a=(0,i.A)(t,2),l=a[0],d=a[1];(0,n.useEffect)(()=>{d(Ce(s))},[s]);const o=(0,n.useState)(!1),c=(0,i.A)(o,2),m=c[0],p=c[1],x=e=>({value:l[e],onChange:s=>d((0,r.A)((0,r.A)({},l),{},{[e]:s.target.value}))});return(0,re.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),p(!0);try{await $.FH.put("/twin/profile",(0,r.A)((0,r.A)({},l),{},{core_values:Se(l.core_values),departments:Se(l.departments),locations:Se(l.locations),business_units:Se(l.business_units),strategic_objectives:Se(l.strategic_objectives),executive_team:(s=l.executive_team,Se(s).map(e=>{const s=e.split(/\u2014|-/).map(e=>e.trim()),t=(0,i.A)(s,3),a=t[0],r=void 0===a?"":a,n=t[1],l=void 0===n?"":n,d=t[2],o=void 0===d?"":d;return{name:r,role:l,email:o}}))})),R.toast.success("Company profile saved")}catch(t){R.toast.error((0,$.KI)(t))}finally{p(!1)}var s},className:"pz-card p-6 space-y-5","data-testid":"twin-profile-form",children:[(0,re.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,re.jsx)(Ke,(0,r.A)({label:"Company name",testid:"profile-company"},x("company_name"))),(0,re.jsx)(Ke,(0,r.A)({label:"Mission",testid:"profile-mission"},x("mission"))),(0,re.jsx)(Ke,(0,r.A)({label:"Vision",testid:"profile-vision"},x("vision"))),(0,re.jsx)(Ie,(0,r.A)({label:"Core values (one per line)",testid:"profile-values",rows:4},x("core_values"))),(0,re.jsx)(Ie,(0,r.A)({label:"Departments",testid:"profile-departments",rows:4},x("departments"))),(0,re.jsx)(Ie,(0,r.A)({label:"Locations",testid:"profile-locations",rows:4},x("locations"))),(0,re.jsx)(Ie,(0,r.A)({label:"Business units",testid:"profile-business-units",rows:4},x("business_units"))),(0,re.jsx)(Ie,(0,r.A)({label:"Strategic objectives",testid:"profile-objectives",rows:4},x("strategic_objectives"))),(0,re.jsx)(Ie,(0,r.A)((0,r.A)({label:"Executive team (name \u2014 role \u2014 email, one per line)",testid:"profile-exec",rows:5},x("executive_team")),{},{className:"md:col-span-2"}))]}),(0,re.jsx)("div",{className:"flex justify-end",children:(0,re.jsxs)(q.$,{type:"submit",disabled:m,"data-testid":"profile-save",className:"gap-1.5",children:[(0,re.jsx)(K.A,{className:"h-3.5 w-3.5"})," ",m?"Saving\u2026":"Save profile"]})})]})}function Ce(e){return{company_name:(null===e||void 0===e?void 0:e.company_name)||"",mission:(null===e||void 0===e?void 0:e.mission)||"",vision:(null===e||void 0===e?void 0:e.vision)||"",core_values:((null===e||void 0===e?void 0:e.core_values)||[]).join("\n"),departments:((null===e||void 0===e?void 0:e.departments)||[]).join("\n"),locations:((null===e||void 0===e?void 0:e.locations)||[]).join("\n"),business_units:((null===e||void 0===e?void 0:e.business_units)||[]).join("\n"),strategic_objectives:((null===e||void 0===e?void 0:e.strategic_objectives)||[]).join("\n"),executive_team:((null===e||void 0===e?void 0:e.executive_team)||[]).map(e=>"".concat(e.name||""," \u2014 ").concat(e.role||""," \u2014 ").concat(e.email||"")).join("\n")}}const Se=e=>(e||"").split(/\r?\n/).map(e=>
1e.trim()).filter(Boolean);function Ke(e){let s=e.label,t=e.testid,i=e.className,n=void 0===i?"":i,l=(0,a.A)(e,oe);return(0,re.jsxs)("label",{className:n,children:[(0,re.jsx)("div",{className:"pz-label mb-1",children:s}),(0,re.jsx)("input",(0,r.A)((0,r.A)({"data-testid":t},l),{},{className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm"}))]})}function Ie(e){let s=e.label,t=e.testid,i=e.className,n=void 0===i?"":i,l=(0,a.A)(e,ce);return(0,re.jsxs)("label",{className:n,children:[(0,re.jsx)("div",{className:"pz-label mb-1",children:s}),(0,re.jsx)("textarea",(0,r.A)((0,r.A)({"data-testid":t},l),{},{className:"w-full resize-y rounded-lg border border-border bg-background px-3 py-2 text-sm"}))]})}function Pe(){return(0,re.jsx)("div",{className:"px-6 py-8 sm:px-10",children:(0,re.jsxs)("div",{className:"mx-auto max-w-7xl space-y-6",children:[(0,re.jsx)("div",{className:"h-52 animate-pulse rounded-2xl bg-card/60"}),(0,re.jsx)("div",{className:"grid gap-4 lg:grid-cols-3",children:Array.from({length:6}).map((e,s)=>(0,re.jsx)("div",{className:"h-40 animate-pulse rounded-xl bg-card/60"},s))}),(0,re.jsx)("div",{className:"h-64 animate-pulse rounded-xl bg-card/60"})]})})}}}]);

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.