decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
2 lines (1 loc) • 31.2 kB
JavaScript
import{c as C,j as s,b as B,gZ as Q,m as D,F as fe,r as Z,d as xe,hJ as q,aA as pe}from"./index-DoEtSiIe.js";import{c as J,b as G,B as U,C as ee}from"./chart-BhhOak8o.js";import{e as he,a as ge,b as W,T as je,d as be,c as ye}from"./table-RDPVkrI6.js";import{i as ve}from"./AlertCircle-GoAGGV0G.js";import{i as ke,n as Ne}from"./ArrowUp-s5a8DQxj.js";import{n as Se,c as we,k as Ce,d as $e}from"./UserCheck01-CA8kXGn8.js";import{T as te,a as se}from"./toggle-group-CtXgLS7e.js";import{B as Y}from"./badge-DONoxQO7.js";import{l as ne,T as Te,P as De,S as Oe}from"./config-BOn4tvAD.js";import{C as H,X as P,Y as V}from"./CartesianChart-BFVvuNgw.js";import{A as Ie,a as Be}from"./AreaChart-BCH9fczV.js";function le(a){const e=C.c(8),{href:t,className:d,children:o}=a,c=xe();let r;e[0]!==t||e[1]!==c?(r=n=>{!t||n.button!==0||n.metaKey||n.ctrlKey||n.shiftKey||(n.preventDefault(),c({href:t}))},e[0]=t,e[1]=c,e[2]=r):r=e[2];let l;return e[3]!==o||e[4]!==d||e[5]!==t||e[6]!==r?(l=s.jsx("a",{href:t,className:d,onClick:r,children:o}),e[3]=o,e[4]=d,e[5]=t,e[6]=r,e[7]=l):l=e[7],l}const L=(a,e,t)=>a&&e?()=>a({drill:e,label:t}):void 0,E="cursor-pointer text-left transition-colors hover:bg-accent focus-ring",F=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"],R={fontSize:11,fill:"var(--muted-foreground)",opacity:.7};function ae(a){const e=Math.abs(a);return e<60?`${Math.round(a)}s`:e<3600?`${Math.round(a/60)}m`:e<86400?`${(a/3600).toFixed(1)}h`:`${(a/86400).toFixed(1)}d`}function M(a,e){return a===null||Number.isNaN(a)?"—":e==="s"?ae(a):e==="%"?`${Math.round(a*10)/10}%`:e==="USD"?`$${a.toFixed(2)}`:a.toLocaleString()}function X(a,e){return e==="s"?ae(a):e==="%"?`${a}%`:e==="USD"?`$${a}`:a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a)}const re=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/,Le=/^\d{4}-\d{2}-\d{2}$/;function Me(a,e){return typeof a=="number"?M(a,e):Le.test(a)?new Date(`${a}T12:00:00Z`).toLocaleDateString(void 0,{month:"short",day:"numeric"}):re.test(a)?q(a):a}function _(a){const e=C.c(21),{title:t,value:d,caption:o,aside:c,children:r,onClick:l,className:n}=a,i=l?"button":"section",u=l?"button":void 0,m=l&&E;let x;e[0]!==n||e[1]!==m?(x=D("surface @container flex h-full w-full min-w-0 flex-col gap-6 px-4 pt-4 pb-5",m,n),e[0]=n,e[1]=m,e[2]=x):x=e[2];let f;e[3]!==t?(f=s.jsx("h3",{className:"text-sm text-foreground/70",children:t}),e[3]=t,e[4]=f):f=e[4];let h;e[5]!==d?(h=d!==void 0&&s.jsx("span",{className:"tnum whitespace-nowrap text-4xl font-normal text-foreground @max-xs:text-3xl @max-3xs:text-2xl",children:d}),e[5]=d,e[6]=h):h=e[6];let p;e[7]!==o||e[8]!==f||e[9]!==h?(p=s.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[f,h,o]}),e[7]=o,e[8]=f,e[9]=h,e[10]=p):p=e[10];let j;e[11]!==c||e[12]!==p?(j=s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p,c]}),e[11]=c,e[12]=p,e[13]=j):j=e[13];let b;return e[14]!==i||e[15]!==r||e[16]!==l||e[17]!==u||e[18]!==x||e[19]!==j?(b=s.jsxs(i,{type:u,onClick:l,className:x,children:[j,r]}),e[14]=i,e[15]=r,e[16]=l,e[17]=u,e[18]=x,e[19]=j,e[20]=b):b=e[20],b}function ie(a){const e=C.c(9),{lane:t}=a,d=B();let o;e[0]!==t||e[1]!==d?(o=ne(t,d),e[0]=t,e[1]=d,e[2]=o):o=e[2];const{label:c,visual:r}=o,l=r.icon;let n;e[3]!==l||e[4]!==r.iconClassName?(n=s.jsx(l,{className:r.iconClassName}),e[3]=l,e[4]=r.iconClassName,e[5]=n):n=e[5];let i;return e[6]!==c||e[7]!==n?(i=s.jsxs(Y,{variant:"muted",children:[n,c]}),e[6]=c,e[7]=n,e[8]=i):i=e[8],i}function A(a){const e=C.c(2),{children:t}=a;let d;return e[0]!==t?(d=s.jsx("div",{className:"flex h-20 items-center justify-center text-sm text-muted-foreground",children:t}),e[0]=t,e[1]=d):d=e[1],d}function _e(a){const e=C.c(21),{value:t,previous:d,unit:o,better:c}=a,r=B();if(t===null||d===null||d===void 0){let p;e[0]!==r?(p=r("taskBoard.analytics.noPrior"),e[0]=r,e[1]=p):p=e[1];let j;return e[2]!==p?(j=s.jsx("span",{className:"text-meta",children:p}),e[2]=p,e[3]=j):j=e[3],j}const l=Math.round((t-d)*10)/10,n=c==="down"?l<0:l>0;let i;e[4]!==l||e[5]!==r||e[6]!==o?(i=o==="%"?r("taskBoard.analytics.points",{n:String(Math.abs(l))}):M(Math.abs(l),o),e[4]=l,e[5]=r,e[6]=o,e[7]=i):i=e[7];const u=i;let m;e[8]!==u||e[9]!==c||e[10]!==l||e[11]!==n||e[12]!==r?(m=l===0?r("taskBoard.analytics.unchanged"):s.jsxs("span",{className:D("inline-flex items-center gap-0.5 font-medium",c&&(n?"text-success":"text-destructive")),children:[l>0?s.jsx(ke,{size:12}):s.jsx(Ne,{size:12}),u]}),e[8]=u,e[9]=c,e[10]=l,e[11]=n,e[12]=r,e[13]=m):m=e[13];let x;e[14]!==r?(x=r("taskBoard.analytics.vsPrevious"),e[14]=r,e[15]=x):x=e[15];let f;e[16]!==x?(f=s.jsx("span",{children:x}),e[16]=x,e[17]=f):f=e[17];let h;return e[18]!==m||e[19]!==f?(h=s.jsxs("span",{className:"text-meta inline-flex items-center gap-1",children:[m,f]}),e[18]=m,e[19]=f,e[20]=h):h=e[20],h}const Ae={1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",5:"lg:grid-cols-5",6:"lg:grid-cols-3",9:"lg:grid-cols-3"};function Re(a){const e=C.c(10),{section:t,onDrill:d}=a,o=Ae[t.values.length]??"lg:grid-cols-4";let c;e[0]!==o?(c=D("grid grid-cols-2 gap-4",o),e[0]=o,e[1]=c):c=e[1];let r;if(e[2]!==d||e[3]!==t.values){let n;e[5]!==d?(n=i=>s.jsx(_,{title:i.label,value:M(i.value,i.unit),onClick:L(d,i.drill,i.label),caption:s.jsxs(s.Fragment,{children:[i.detail&&s.jsx("span",{className:"text-sm text-muted-foreground",children:i.detail}),i.previous!==void 0&&s.jsx(_e,{value:i.value,previous:i.previous,unit:i.unit,better:i.better})]})},i.label),e[5]=d,e[6]=n):n=e[6],r=t.values.map(n),e[2]=d,e[3]=t.values,e[4]=r}else r=e[4];let l;return e[7]!==c||e[8]!==r?(l=s.jsx("div",{className:c,children:r}),e[7]=c,e[8]=r,e[9]=l):l=e[9],l}function Ke(a){return Array.from(new Set(a.flatMap(e=>Object.keys(e)))).filter(e=>e!=="t").sort()}function Fe(a,e){const t=e.filter(d=>a.some(o=>typeof o[d]=="number"&&o[d]!==0));return t.length>0?t:e}function Ee(a,e,t){const d=new Map(a.map(l=>[String(l.t??"").slice(0,10),l])),o=new Date(`${t.from.slice(0,10)}T00:00:00.000Z`),c=t.to.slice(0,10),r=[];for(;o.toISOString().slice(0,10)<=c;){const l=o.toISOString().slice(0,10);r.push(d.get(l)??{t:o.toISOString(),...Object.fromEntries(e.map(n=>[n,0]))}),o.setUTCDate(o.getUTCDate()+1)}return r}function oe(a){const e=C.c(17),{active:t,payload:d,unit:o,nameOf:c}=a,r=c===void 0?String:c;if(!t||!d?.length)return null;const l=d[0]?.payload,n=l?.t;let i;e[0]!==l?.label||e[1]!==n?(i=typeof n=="string"?new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric"}):String(l?.label??""),e[0]=l?.label,e[1]=n,e[2]=i):i=e[2];let u;e[3]!==i?(u=s.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:i}),e[3]=i,e[4]=u):u=e[4];let m;if(e[5]!==r||e[6]!==d||e[7]!==o){let h;e[9]!==r||e[10]!==o?(h=p=>s.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[s.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:p.color}}),s.jsx("span",{className:"text-muted-foreground",children:r(String(p.dataKey))}),s.jsx("span",{className:"tnum ml-auto pl-3 font-medium",children:M(typeof p.value=="number"?p.value:null,o)})]},String(p.dataKey)),e[9]=r,e[10]=o,e[11]=h):h=e[11],m=d.map(h),e[5]=r,e[6]=d,e[7]=o,e[8]=m}else m=e[8];let x;e[12]!==m?(x=s.jsx("div",{className:"flex flex-col gap-1",children:m}),e[12]=m,e[13]=x):x=e[13];let f;return e[14]!==u||e[15]!==x?(f=s.jsxs("div",{className:"rounded-lg bg-popover px-3 py-2 shadow-soft",children:[u,x]}),e[14]=u,e[15]=x,e[16]=f):f=e[16],f}function ze(a){const e=C.c(27),{section:t,range:d}=a,o=B(),c=t.unit??void 0,r=c!=="%"&&c!=="s";let l;if(e[0]!==r||e[1]!==d||e[2]!==t.points||e[3]!==t.title||e[4]!==o||e[5]!==c){const n=Ke(t.points),i=r?Fe(t.points,n):n,u=v=>F[n.indexOf(v)%F.length],m=Object.fromEntries(i.map(v=>[v,{label:v,color:u(v)}])),f=(r&&d?Ee(t.points,n,d):t.points).map(Ge);let h;if(e[7]!==t.title){let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=/\W+/g,e[9]=v):v=e[9],h=t.title.replace(v,"-"),e[7]=t.title,e[8]=h}else h=e[8];const p=`analytics-${h}`;let j;e[10]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(H,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),e[10]=j):j=e[10];const b=j;let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(P,{dataKey:"label",axisLine:!1,tickLine:!1,tick:R,minTickGap:24,tickMargin:8}),e[11]=k):k=e[11];const y=k;let $;e[12]!==c?($=c==="%"?[0,100]:[0,"auto"],e[12]=c,e[13]=$):$=e[13];const S=c!==void 0;let g;e[14]!==c?(g=v=>X(v,c),e[14]=c,e[15]=g):g=e[15];let w;e[16]!==$||e[17]!==S||e[18]!==g?(w=s.jsx(V,{orientation:"right",axisLine:!1,tickLine:!1,tick:R,domain:$,allowDecimals:S,tickFormatter:g,width:48,tickCount:5}),e[16]=$,e[17]=S,e[18]=g,e[19]=w):w=e[19];const O=w;let T;e[20]!==r?(T=r?{fill:"var(--muted)",opacity:.4}:{stroke:"var(--border)",strokeDasharray:"4 4"},e[20]=r,e[21]=T):T=e[21];let I;e[22]!==c?(I=v=>{const{active:z,payload:me}=v;return s.jsx(oe,{active:z,payload:me,unit:c})},e[22]=c,e[23]=I):I=e[23];let N;e[24]!==I||e[25]!==T?(N=s.jsx(ee,{cursor:T,content:I}),e[24]=I,e[25]=T,e[26]=N):N=e[26];const K=N;l=s.jsx(_,{title:t.title,aside:i.length>1&&s.jsx("ul",{className:"flex flex-wrap justify-end gap-x-3 gap-y-1",children:i.map(v=>s.jsxs("li",{className:"text-meta flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:u(v)}}),v]},v))}),children:f.length===0?s.jsx(A,{children:o("taskBoard.analytics.noDataInRange")}):s.jsx(J,{role:"img","aria-label":t.title,className:"h-[140px] w-full md:h-[180px]",config:m,children:r?s.jsxs(G,{data:f,margin:{left:0,right:0,top:8},children:[b,y,O,K,i.map((v,z)=>s.jsx(U,{dataKey:v,stackId:"day",fill:u(v),maxBarSize:24,radius:z===i.length-1?[4,4,0,0]:0,animationDuration:300},v))]}):s.jsxs(Ie,{data:f,margin:{left:0,right:0,top:8},children:[i.length===1&&s.jsx("defs",{children:s.jsxs("linearGradient",{id:p,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:u(i[0]??""),stopOpacity:.2}),s.jsx("stop",{offset:"100%",stopColor:u(i[0]??""),stopOpacity:0})]})}),b,y,O,K,i.map(v=>s.jsx(Be,{type:"linear",dataKey:v,stroke:u(v),strokeWidth:2,fill:i.length===1?`url(#${p})`:"none",dot:f.length===1?{r:4}:!1,activeDot:{r:4,stroke:"var(--background)",strokeWidth:2},connectNulls:!0,animationDuration:300},v))]})})}),e[0]=r,e[1]=d,e[2]=t.points,e[3]=t.title,e[4]=o,e[5]=c,e[6]=l}else l=e[6];return l}function Ge(a){return{...a,label:new Date(String(a.t??"")).toLocaleDateString(void 0,{month:"short",day:"numeric"})}}function ce(a){const e=C.c(25),{label:t,note:d,share:o,value:c,fill:r,color:l,onClick:n}=a,i=n?"button":"div",u=n?"button":void 0;let m;e[0]!==n?(m=n&&D(E,"-mx-2 w-[calc(100%+1rem)] rounded-md px-2"),e[0]=n,e[1]=m):m=e[1];let x;e[2]!==m?(x=D("flex h-10 w-full items-center gap-3",m),e[2]=m,e[3]=x):x=e[3];let f;e[4]!==d?(f=d&&s.jsx("span",{className:"text-meta ml-2",children:d}),e[4]=d,e[5]=f):f=e[5];let h;e[6]!==t||e[7]!==f?(h=s.jsxs("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:[t,f]}),e[6]=t,e[7]=f,e[8]=h):h=e[8];const p=`${Math.max(0,Math.min(100,r))}%`;let j;e[9]!==l||e[10]!==p?(j=s.jsx("span",{className:"h-1.5 w-20 shrink-0 overflow-hidden rounded-full bg-muted",children:s.jsx("span",{className:"block h-full rounded-full",style:{width:p,backgroundColor:l}})}),e[9]=l,e[10]=p,e[11]=j):j=e[11];let b;e[12]!==o?(b=o!==void 0&&s.jsx("span",{className:"tnum w-16 shrink-0 text-right text-sm text-foreground/40",children:o}),e[12]=o,e[13]=b):b=e[13];let k;e[14]!==c?(k=s.jsx("span",{className:"tnum w-8 shrink-0 text-right text-sm text-foreground",children:c}),e[14]=c,e[15]=k):k=e[15];let y;return e[16]!==i||e[17]!==n||e[18]!==u||e[19]!==x||e[20]!==h||e[21]!==j||e[22]!==b||e[23]!==k?(y=s.jsx("li",{className:"border-b border-border/50 last:border-b-0",children:s.jsxs(i,{type:u,onClick:n,className:x,children:[h,j,b,k]})}),e[16]=i,e[17]=n,e[18]=u,e[19]=x,e[20]=h,e[21]=j,e[22]=b,e[23]=k,e[24]=y):y=e[24],y}function Ue(a){const e=C.c(17),{section:t,onDrill:d}=a,o=B(),c=t.stages[0]?.value??0,r=t.stages.at(-1)?.value??0;let l;e[0]!==r||e[1]!==c?(l=c?`${Math.round(100*r/c)}%`:"—",e[0]=r,e[1]=c,e[2]=l):l=e[2];let n;e[3]!==r||e[4]!==c||e[5]!==o?(n=c>0&&s.jsx("span",{className:"text-meta",children:o("taskBoard.analytics.funnelCaption",{end:String(r),start:String(c)})}),e[3]=r,e[4]=c,e[5]=o,e[6]=n):n=e[6];let i;e[7]!==d||e[8]!==t.stages||e[9]!==c||e[10]!==o?(i=c===0?s.jsx(A,{children:o("taskBoard.analytics.noDataInRange")}):s.jsx("ol",{className:"flex flex-col",children:t.stages.map((m,x)=>{const f=t.stages[x-1]?.value,h=f===void 0?0:f-m.value;return s.jsx(ce,{label:m.label,note:h>0?o("taskBoard.analytics.dropped",{n:String(h)}):void 0,share:`${Math.round(100*m.value/c)}%`,value:m.value.toLocaleString(),fill:100*m.value/c,color:"var(--chart-2)",onClick:L(d,m.drill,m.label)},m.label)})}),e[7]=d,e[8]=t.stages,e[9]=c,e[10]=o,e[11]=i):i=e[11];let u;return e[12]!==t.title||e[13]!==l||e[14]!==n||e[15]!==i?(u=s.jsx(_,{title:t.title,value:l,caption:n,children:i}),e[12]=t.title,e[13]=l,e[14]=n,e[15]=i,e[16]=u):u=e[16],u}function He(a){const e=C.c(19),{section:t,onDrill:d}=a,o=B();let c;e[0]!==t.bars?(c=Math.max(0,...t.bars.map(Pe)),e[0]=t.bars,e[1]=c):c=e[1];const r=c;let l;e[2]!==t.total?.value?(l=t.total?.value.toLocaleString(),e[2]=t.total?.value,e[3]=l):l=e[3];let n;e[4]!==t.total?(n=t.total&&s.jsx("span",{className:"text-meta",children:t.total.label}),e[4]=t.total,e[5]=n):n=e[5];let i;e[6]!==t.unit?(i=t.unit&&s.jsx("span",{className:"text-meta",children:t.unit}),e[6]=t.unit,e[7]=i):i=e[7];let u;e[8]!==r||e[9]!==d||e[10]!==t.bars||e[11]!==o?(u=t.bars.length===0?s.jsx(A,{children:o("taskBoard.analytics.nobodyStepped")}):s.jsx("ul",{className:"flex flex-col",children:t.bars.map(x=>s.jsx(ce,{label:x.label,note:x.note,share:x.detail,value:x.value.toLocaleString(),fill:r?100*x.value/r:0,color:"var(--chart-1)",onClick:L(d,x.drill,x.label)},x.label))}),e[8]=r,e[9]=d,e[10]=t.bars,e[11]=o,e[12]=u):u=e[12];let m;return e[13]!==t.title||e[14]!==l||e[15]!==n||e[16]!==i||e[17]!==u?(m=s.jsx(_,{title:t.title,value:l,caption:n,aside:i,children:u}),e[13]=t.title,e[14]=l,e[15]=n,e[16]=i,e[17]=u,e[18]=m):m=e[18],m}function Pe(a){return a.value}function Ve(a,e){return`/${encodeURIComponent(a)}/${encodeURIComponent(e)}`}const Xe=new Set(["Org ID","Task ID"]),Ye=new Set(["Run outcome","Failure kind","Moved in by","State"]),Qe=new Set(["Error","Signature"]),We=new Set(["Org","Orgs"]);function Ze(a){const e=C.c(32),{section:t,threadLinks:d,showOrg:o,taskHref:c,onDrill:r}=a,l=B(),n=t.columns.indexOf("Org");let i;e[0]!==n||e[1]!==t.columns||e[2]!==d?(i=d&&n>=0?t.columns.indexOf("Thread"):-1,e[0]=n,e[1]=t.columns,e[2]=d,e[3]=i):i=e[3];const u=i,m=t.columns.indexOf("Task ID");let x;e[4]!==t.columns||e[5]!==c||e[6]!==m?(x=c&&m>=0?t.columns.indexOf("Task"):-1,e[4]=t.columns,e[5]=c,e[6]=m,e[7]=x):x=e[7];const f=x,h=t.columns;let p,j;if(e[8]!==r||e[9]!==n||e[10]!==t.columns||e[11]!==t.drills||e[12]!==t.rows||e[13]!==t.title||e[14]!==t.units||e[15]!==o||e[16]!==l||e[17]!==f||e[18]!==c||e[19]!==m||e[20]!==u){j=Symbol.for("react.early_return_sentinel");e:{let b;e[23]!==o?(b=S=>{const{c:g}=S;return!Xe.has(g)&&(o!==!1||!We.has(g))},e[23]=o,e[24]=b):b=e[24];const k=h.map(st).filter(b).sort(tt);let y;e[25]!==t.rows?(y=S=>{const{j:g}=S,w=t.rows.map(O=>O[g]).filter(et);return w.length>0&&w.every(Je)},e[25]=t.rows,e[26]=y):y=e[26];const $=new Set(k.filter(y).map(qe));if(t.rows.length===1&&k.every(S=>{const{c:g}=S;return $.has(g)})){let S;e[27]!==t.rows[0]?(S=t.rows[0]??[],e[27]=t.rows[0],e[28]=S):S=e[28];const g=S;let w;e[29]!==g||e[30]!==t.units?(w=O=>{const{c:T,j:I}=O,N=g[I];return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("dt",{className:"text-meta",children:T}),s.jsx("dd",{className:"tnum text-2xl text-foreground",children:typeof N=="number"?M(N,t.units?.[T]):"—"})]},T)},e[29]=g,e[30]=t.units,e[31]=w):w=e[31],j=s.jsx(Q,{title:t.title,children:s.jsx("dl",{className:"surface grid px-4 pt-4 pb-5 grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3 lg:grid-cols-[repeat(auto-fill,minmax(120px,1fr))]",children:k.map(w)})});break e}p=s.jsx(Q,{title:t.title,children:t.rows.length===0?s.jsx("p",{className:"surface px-4 py-4 text-sm text-muted-foreground",children:l("taskBoard.analytics.nothingToShow")}):s.jsx("div",{className:"surface max-h-[480px] overflow-auto",children:s.jsxs(he,{variant:"flush",children:[s.jsx(ge,{children:s.jsx(W,{children:k.map(S=>{const{c:g}=S;return s.jsx(je,{className:D("whitespace-nowrap first:pl-4 last:pr-4",$.has(g)&&"text-right"),children:g==="Thread"?"":g},g)})})}),s.jsx(be,{children:t.rows.map((S,g)=>s.jsx(W,{children:k.map((w,O)=>{const{c:T,j:I}=w,N=S[I],K=f===I?S[m]:null,v=O===0?L(r,t.drills?.[g]??void 0,String(N??"")):void 0;return s.jsx(ye,{className:D("max-w-md truncate text-sm first:pl-4 last:pr-4",$.has(T)&&"text-right"),children:N==null?s.jsx("span",{className:"text-muted-foreground",children:"—"}):I===u?s.jsxs("a",{href:Ve(String(S[n]),String(N)),target:"_blank",rel:"noreferrer",className:"focus-ring inline-flex items-center gap-1 text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:[l("taskBoard.analytics.openChat"),s.jsx(fe,{size:12})]}):v?s.jsx("button",{type:"button",onClick:v,className:"focus-ring text-left text-foreground underline-offset-2 hover:underline",children:String(N)}):K?s.jsx(le,{href:c?.(String(K)),className:"focus-ring text-foreground underline-offset-2 hover:underline",children:String(N)}):T==="Lane"&&typeof N=="string"?s.jsx(ie,{lane:N}):T==="Priority"&&typeof N=="string"?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(de,{drill:`priority:${N.toLowerCase()}`}),N]}):Ye.has(T)?s.jsx(Y,{variant:"muted",children:String(N)}):Qe.has(T)?s.jsx("span",{title:String(N),className:"font-mono text-xs text-muted-foreground",children:String(N)}):s.jsx("span",{className:D("tnum",typeof N=="string"&&re.test(N)&&"text-muted-foreground"),children:Me(N,t.units?.[T])})},T)})},`${t.title}-${g}`))})]})})})}e[8]=r,e[9]=n,e[10]=t.columns,e[11]=t.drills,e[12]=t.rows,e[13]=t.title,e[14]=t.units,e[15]=o,e[16]=l,e[17]=f,e[18]=c,e[19]=m,e[20]=u,e[21]=p,e[22]=j}else p=e[21],j=e[22];return j!==Symbol.for("react.early_return_sentinel")?j:p}function qe(a){const{c:e}=a;return e}function Je(a){return typeof a=="number"}function et(a){return a!==null}function tt(a,e){return+(e.c==="Task")-+(a.c==="Task")}function st(a,e){return{c:a,j:e}}function $t(a){const e=C.c(17),{section:t,taskHref:d}=a,o=B();let c;e[0]!==t.columns?(c=i=>t.columns.indexOf(i),e[0]=t.columns,e[1]=c):c=e[1];const r=c;if(t.rows.length===0){let i;e[2]!==o?(i=o("taskBoard.analytics.nothingToShow"),e[2]=o,e[3]=i):i=e[3];let u;return e[4]!==i?(u=s.jsx(A,{children:i}),e[4]=i,e[5]=u):u=e[5],u}let l;if(e[6]!==r||e[7]!==t.rows||e[8]!==o||e[9]!==d){let i;e[11]!==r||e[12]!==o||e[13]!==d?(i=u=>{const m=String(u[r("Task ID")]??""),x=u[r("Lane")],f=u[r("Picked up")],h=Number(u[r("Actions by people")]??0),p=Number(u[r("Failed QA")]??0),j=[typeof f=="string"?q(f):null,h>0&&o(h===1?"taskBoard.analytics.humanActionsOne":"taskBoard.analytics.humanActions",{n:String(h)})].filter(Boolean),b=s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[s.jsx("span",{className:"truncate text-sm text-foreground",children:String(u[r("Task")]??"")}),s.jsx("span",{className:"text-meta truncate",children:j.join(" · ")})]}),p>0&&s.jsxs(Y,{variant:"muted",children:[s.jsx(ve,{className:"text-destructive"}),p===1?o("taskBoard.analytics.failedQa"):o("taskBoard.analytics.failedQaTimes",{n:String(p)})]}),typeof x=="string"&&s.jsx(ie,{lane:x})]});return s.jsx("li",{className:"border-b border-border/50 last:border-b-0",children:d?s.jsx(le,{href:d(m),className:D(E,"flex items-center gap-3 rounded-md p-2"),children:b}):s.jsx("div",{className:"flex items-center gap-3 p-2",children:b})},m)},e[11]=r,e[12]=o,e[13]=d,e[14]=i):i=e[14],l=t.rows.map(i),e[6]=r,e[7]=t.rows,e[8]=o,e[9]=d,e[10]=l}else l=e[10];let n;return e[15]!==l?(n=s.jsx("ul",{className:"flex flex-col",children:l}),e[15]=l,e[16]=n):n=e[16],n}const nt={Type:$e,Priority:Ce,Tag:we,Sprint:Se,"Brief by":pe};function de(a){const e=C.c(10),{drill:t}=a;let d;e[0]!==t?(d=(t??"").split("&")[0]?.split(":")??[],e[0]=t,e[1]=d):d=e[1];const[o,c]=d;let r,l,n;if(e[2]!==o||e[3]!==c){n=Symbol.for("react.early_return_sentinel");e:{const u=o==="type"?Object.entries(Te).find(x=>{const[f]=x;return f===c})?.[1]:o==="priority"?Object.entries(De).find(x=>{const[f]=x;return f===c})?.[1]:void 0;if(!u){n=null;break e}r=u.icon,l=D("size-3.5 shrink-0",u.iconClassName)}e[2]=o,e[3]=c,e[4]=r,e[5]=l,e[6]=n}else r=e[4],l=e[5],n=e[6];if(n!==Symbol.for("react.early_return_sentinel"))return n;let i;return e[7]!==r||e[8]!==l?(i=s.jsx(r,{className:l}),e[7]=r,e[8]=l,e[9]=i):i=e[9],i}function lt(a){const e=C.c(11),{value:t,metric:d,color:o}=a,c=t??0,r=`${d.unit==="%"?Math.min(100,c):0}%`;let l;e[0]!==o||e[1]!==r?(l=s.jsx("span",{className:"h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted",children:s.jsx("span",{className:"block h-full rounded-full",style:{width:r,backgroundColor:o}})}),e[0]=o,e[1]=r,e[2]=l):l=e[2];const n=t??null;let i;e[3]!==d.unit||e[4]!==n?(i=M(n,d.unit),e[3]=d.unit,e[4]=n,e[5]=i):i=e[5];let u;e[6]!==i?(u=s.jsx("span",{className:"tnum w-12 shrink-0 text-right text-sm text-foreground",children:i}),e[6]=i,e[7]=u):u=e[7];let m;return e[8]!==l||e[9]!==u?(m=s.jsxs("span",{className:"flex items-center gap-2",children:[l,u]}),e[8]=l,e[9]=u,e[10]=m):m=e[10],m}function at(a){const e=C.c(16),{section:t,onDrill:d}=a,o=B(),[c,r]=Z.useState(t.dimensions[0]?.label??"");let l;e[0]!==c||e[1]!==t.dimensions?(l=t.dimensions.find(f=>f.label===c)??t.dimensions[0],e[0]=c,e[1]=t.dimensions,e[2]=l):l=e[2];const n=l,i=`minmax(0,1fr) 56px repeat(${t.metrics.length}, minmax(96px, 168px))`;let u;e[3]!==n?.label||e[4]!==t.dimensions?(u=t.dimensions.length>1&&s.jsx(te,{type:"single",variant:"segmented",size:"sm",value:n?.label??"",onValueChange:f=>f&&r(f),children:t.dimensions.map(it)}),e[3]=n?.label,e[4]=t.dimensions,e[5]=u):u=e[5];let m;e[6]!==i||e[7]!==n||e[8]!==d||e[9]!==t.metrics||e[10]!==o?(m=!n||n.rows.length===0?s.jsx(A,{children:o("taskBoard.analytics.noDataInRange")}):s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"text-meta grid items-center gap-4 border-b border-border/50 pb-2",style:{gridTemplateColumns:i},children:[s.jsx("span",{children:n.label}),s.jsx("span",{className:"text-right",children:o("taskBoard.analytics.tasks")}),t.metrics.map(rt)]}),n.rows.map(f=>{const h=L(d,f.drill,f.label),p=h?"button":"div";return s.jsxs(p,{type:h?"button":void 0,onClick:h,className:D("grid h-11 items-center gap-4 border-b border-border/50 last:border-b-0",h&&D(E,"-mx-2 w-[calc(100%+1rem)] rounded-md px-2")),style:{gridTemplateColumns:i},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm text-foreground",children:[s.jsx(de,{drill:f.drill}),s.jsx("span",{className:"truncate",children:f.label})]}),s.jsx("span",{className:"tnum text-right text-sm text-muted-foreground",children:f.count.toLocaleString()}),t.metrics.map(j=>s.jsx(lt,{value:f.values[j.key],metric:j,color:j.better==="up"?"var(--success)":"var(--destructive)"},j.key))]},f.label)})]}),e[6]=i,e[7]=n,e[8]=d,e[9]=t.metrics,e[10]=o,e[11]=m):m=e[11];let x;return e[12]!==t.title||e[13]!==u||e[14]!==m?(x=s.jsx(_,{title:t.title,aside:u,children:m}),e[12]=t.title,e[13]=u,e[14]=m,e[15]=x):x=e[15],x}function rt(a){return s.jsx("span",{className:"text-right",children:a.label},a.key)}function it(a){const e=nt[a.label];return s.jsxs(se,{value:a.label,children:[e&&s.jsx(e,{}),a.label]},a.label)}const ue=3;function ot(a){const e=C.c(26),{section:t,onDrill:d}=a,o=B(),[c,r]=Z.useState(t.metrics[0]?.key??"");let l;e[0]!==c||e[1]!==t.metrics?(l=t.metrics.find(y=>y.key===c)??t.metrics[0],e[0]=c,e[1]=t.metrics,e[2]=l):l=e[2];const n=l;if(!n)return null;const i=n.better==="up"?"var(--success)":"var(--destructive)";let u;e[3]!==t.cols||e[4]!==t.rows?(u=t.rows.length===t.cols.length&&t.rows.every((y,$)=>t.cols[$]===y),e[3]=t.cols,e[4]=t.rows,e[5]=u):u=e[5];const m=u,x=`minmax(96px, 1fr) repeat(${t.cols.length}, minmax(72px, 1fr))`,f=t.title;let h;e[6]!==o?(h=o("taskBoard.analytics.matrixCaption",{n:String(ue)}),e[6]=o,e[7]=h):h=e[7];let p;e[8]!==h?(p=s.jsx("span",{className:"text-meta",children:h}),e[8]=h,e[9]=p):p=e[9];let j;e[10]!==n.key||e[11]!==t.metrics?(j=t.metrics.length>1&&s.jsx(te,{type:"single",variant:"segmented",size:"sm",value:n.key,onValueChange:y=>y&&r(y),children:t.metrics.map(dt)}),e[10]=n.key,e[11]=t.metrics,e[12]=j):j=e[12];let b;e[13]!==x||e[14]!==n||e[15]!==d||e[16]!==t||e[17]!==m||e[18]!==o||e[19]!==i?(b=t.rows.length===0?s.jsx(A,{children:o("taskBoard.analytics.noDataInRange")}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("div",{className:"grid min-w-fit gap-1",style:{gridTemplateColumns:x},children:[s.jsxs("span",{className:"text-meta self-end pb-1",children:[t.rowLabel," / ",t.colLabel]}),t.cols.map(ct),t.rows.map((y,$)=>s.jsx(ut,{row:y,section:t,metric:n,tint:i,onDrill:d,upTo:m?$:void 0},y))]})}),e[13]=x,e[14]=n,e[15]=d,e[16]=t,e[17]=m,e[18]=o,e[19]=i,e[20]=b):b=e[20];let k;return e[21]!==t.title||e[22]!==p||e[23]!==j||e[24]!==b?(k=s.jsx(_,{title:f,caption:p,aside:j,children:b}),e[21]=t.title,e[22]=p,e[23]=j,e[24]=b,e[25]=k):k=e[25],k}function ct(a){return s.jsx("span",{className:"text-meta self-end pb-1 text-center",children:a},a)}function dt(a){return s.jsx(se,{value:a.key,children:a.label},a.key)}function ut(a){const e=C.c(22),{row:t,section:d,metric:o,tint:c,onDrill:r,upTo:l}=a,n=B();let i;e[0]!==t?(i=s.jsx("span",{className:"flex items-center truncate pr-2 text-sm text-foreground",children:t}),e[0]=t,e[1]=i):i=e[1];let u;if(e[2]!==o||e[3]!==r||e[4]!==t||e[5]!==d.cells||e[6]!==d.cols||e[7]!==n||e[8]!==c||e[9]!==l){let x;e[11]!==o||e[12]!==r||e[13]!==t||e[14]!==d.cells||e[15]!==n||e[16]!==c||e[17]!==l?(x=(f,h)=>{if(l!==void 0&&h>l)return s.jsx("span",{},f);const p=d.cells.find(y=>y.row===t&&y.col===f),j=p?.values[o.key]??null;if(!p)return s.jsx("span",{className:"flex h-14 items-center justify-center rounded-md bg-muted/40 text-sm text-muted-foreground",children:"—"},f);const b=j===null?0:Math.min(100,o.unit==="%"?j:0),k=L(r,p.drill,t===f?t:`${t} · ${f}`);return s.jsxs("button",{type:"button",onClick:k,disabled:!k,className:D("flex h-14 flex-col items-center justify-center rounded-md transition-opacity focus-ring",k&&"cursor-pointer hover:opacity-80",p.count<ue&&"opacity-50"),style:{backgroundColor:`color-mix(in oklch, ${c} ${Math.round(8+b*.5)}%, var(--muted))`},children:[s.jsx("span",{className:"tnum text-sm font-medium text-foreground",children:M(j,o.unit)}),s.jsx("span",{className:"text-meta",children:p.count===1?n("taskBoard.analytics.drillCountOne"):n("taskBoard.analytics.drillCount",{n:String(p.count)})})]},f)},e[11]=o,e[12]=r,e[13]=t,e[14]=d.cells,e[15]=n,e[16]=c,e[17]=l,e[18]=x):x=e[18],u=d.cols.map(x),e[2]=o,e[3]=r,e[4]=t,e[5]=d.cells,e[6]=d.cols,e[7]=n,e[8]=c,e[9]=l,e[10]=u}else u=e[10];let m;return e[19]!==i||e[20]!==u?(m=s.jsxs(s.Fragment,{children:[i,u]}),e[19]=i,e[20]=u,e[21]=m):m=e[21],m}function mt(){const a=C.c(2),e=B();let t;return a[0]!==e?(t=d=>Object.hasOwn(Oe,d)?ne(d,e).label:d,a[0]=e,a[1]=t):t=a[1],t}function ft(a){const e=C.c(21),{section:t,onDrill:d}=a,o=B(),c=mt(),r=t.unit??void 0,l=t.layout==="stacked";let n;if(e[0]!==c||e[1]!==d||e[2]!==t.baseline||e[3]!==t.categories||e[4]!==t.keys||e[5]!==t.title||e[6]!==l||e[7]!==o||e[8]!==r){let i;e[10]!==t.baseline?(i=g=>g!==t.baseline,e[10]=t.baseline,e[11]=i):i=e[11];const u=t.keys.filter(i),m=g=>g===t.baseline?"var(--border)":F[u.indexOf(g)%F.length]??"",x=Object.fromEntries(t.keys.map(g=>[g,{label:c(g),color:m(g)}]));let f;e[12]!==t.categories?(f=t.categories.map(pt),e[12]=t.categories,e[13]=f):f=e[13];const h=f;let p;e[14]!==d||e[15]!==t.categories?(p=g=>{const w=t.categories[g];w&&L(d,w.drill,w.label)?.()},e[14]=d,e[15]=t.categories,e[16]=p):p=e[16];const j=p,b=t.categories.some(xt)&&!!d,k=l?Math.max(120,t.categories.length*44+32):220;let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y={fill:"var(--muted)",opacity:.4},e[17]=y):y=e[17];let $;e[18]!==c||e[19]!==r?($=s.jsx(ee,{cursor:y,content:g=>{const{active:w,payload:O}=g;return s.jsx(oe,{active:w,payload:O,unit:r,nameOf:c})}}),e[18]=c,e[19]=r,e[20]=$):$=e[20];const S=$;n=s.jsx(_,{title:t.title,aside:s.jsx("ul",{className:"flex flex-wrap justify-end gap-x-3 gap-y-1",children:t.keys.map(g=>s.jsxs("li",{className:"text-meta flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:m(g)}}),c(g)]},g))}),children:h.length===0?s.jsx(A,{children:o("taskBoard.analytics.noDataInRange")}):s.jsx(J,{role:"img","aria-label":t.title,className:"w-full",style:{height:k},config:x,children:l?s.jsxs(G,{data:h,layout:"vertical",margin:{left:0,right:8,top:0},children:[s.jsx(H,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,horizontal:!1}),s.jsx(P,{type:"number",axisLine:!1,tickLine:!1,tick:R,tickFormatter:g=>X(g,r)}),s.jsx(V,{type:"category",dataKey:"label",axisLine:!1,tickLine:!1,tick:R,width:72}),S,t.keys.map((g,w)=>s.jsx(U,{dataKey:g,stackId:"all",fill:m(g),maxBarSize:22,radius:w===t.keys.length-1?[0,4,4,0]:0,animationDuration:300},g))]}):s.jsxs(G,{data:h,margin:{left:0,right:0,top:8},barGap:4,barCategoryGap:"28%",children:[s.jsx(H,{strokeDasharray:"4 4",stroke:"var(--border)",strokeOpacity:.5,vertical:!1}),s.jsx(P,{dataKey:"label",axisLine:!1,tickLine:!1,tick:R,tickMargin:8}),s.jsx(V,{orientation:"right",axisLine:!1,tickLine:!1,tick:R,allowDecimals:r!==void 0,tickFormatter:g=>X(g,r),width:48}),S,t.keys.map(g=>s.jsx(U,{dataKey:g,fill:m(g),maxBarSize:32,radius:[4,4,0,0],animationDuration:300,className:D(b&&"cursor-pointer"),onClick:(w,O)=>j(O)},g))]})})}),e[0]=c,e[1]=d,e[2]=t.baseline,e[3]=t.categories,e[4]=t.keys,e[5]=t.title,e[6]=l,e[7]=o,e[8]=r,e[9]=n}else n=e[9];return n}function xt(a){return a.drill}function pt(a){return{label:a.label,...a.values}}function Tt(a){return a.kind==="funnel"||a.kind==="bars"?"half":"full"}function Dt(a){const e=C.c(27),{section:t,threadLinks:d,showOrg:o,taskHref:c,range:r,onDrill:l}=a;switch(t.kind){case"stat":{let n;return e[0]!==l||e[1]!==t?(n=s.jsx(Re,{section:t,onDrill:l}),e[0]=l,e[1]=t,e[2]=n):n=e[2],n}case"series":{let n;return e[3]!==r||e[4]!==t?(n=s.jsx(ze,{section:t,range:r}),e[3]=r,e[4]=t,e[5]=n):n=e[5],n}case"funnel":{let n;return e[6]!==l||e[7]!==t?(n=s.jsx(Ue,{section:t,onDrill:l}),e[6]=l,e[7]=t,e[8]=n):n=e[8],n}case"bars":{let n;return e[9]!==l||e[10]!==t?(n=s.jsx(He,{section:t,onDrill:l}),e[9]=l,e[10]=t,e[11]=n):n=e[11],n}case"breakdown":{let n;return e[12]!==l||e[13]!==t?(n=s.jsx(at,{section:t,onDrill:l}),e[12]=l,e[13]=t,e[14]=n):n=e[14],n}case"matrix":{let n;return e[15]!==l||e[16]!==t?(n=s.jsx(ot,{section:t,onDrill:l}),e[15]=l,e[16]=t,e[17]=n):n=e[17],n}case"categories":{let n;return e[18]!==l||e[19]!==t?(n=s.jsx(ft,{section:t,onDrill:l}),e[18]=l,e[19]=t,e[20]=n):n=e[20],n}case"table":{let n;return e[21]!==l||e[22]!==t||e[23]!==o||e[24]!==c||e[25]!==d?(n=s.jsx(Ze,{section:t,threadLinks:d,showOrg:o,taskHref:c,onDrill:l}),e[21]=l,e[22]=t,e[23]=o,e[24]=c,e[25]=d,e[26]=n):n=e[26],n}default:return t}}export{R as A,$t as D,_ as M,Dt as S,Tt as s};