import{r as f,R as a,X as c,t as b,j as e,a2 as j,d as y,b as v,n as m}from"./index-B-YXshIJ.js";import{a as O}from"./query-hooks-C0Pc4MKj.js";import{T as w}from"./Icons-C9UDsqhh.js";import{X as N}from"./x-circle-CDDsrYQZ.js";function h(){return h=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},h.apply(this,arguments)}function P(t,o){if(t==null)return{};var r=z(t,o),s,i;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(i=0;i<n.length;i++)s=n[i],!(o.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(r[s]=t[s])}return r}function z(t,o){if(t==null)return{};var r={},s=Object.keys(t),i,n;for(n=0;n<s.length;n++)i=s[n],!(o.indexOf(i)>=0)&&(r[i]=t[i]);return r}var p=f.forwardRef(function(t,o){var r=t.color,s=r===void 0?"currentColor":r,i=t.size,n=i===void 0?24:i,d=P(t,["color","size"]);return a.createElement("svg",h({ref:o,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},d),a.createElement("circle",{cx:"18",cy:"18",r:"3"}),a.createElement("circle",{cx:"6",cy:"6",r:"3"}),a.createElement("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),a.createElement("line",{x1:"6",y1:"9",x2:"6",y2:"21"}))});p.propTypes={color:c.string,size:c.oneOfType([c.string,c.number])};p.displayName="GitPullRequest";const C=p,F=({centralTemplateRuns:t,mainBranchCentralTemplateBuilds:o,totalRuns:r,buildDefinitionId:s})=>{const i=O(),n="bdi-".concat(s),[d,x]=f.useState(!1),g=b.builds.centralTemplateOptions.useQuery({...i,buildDefinitionId:s},{enabled:d});return t===0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"px-1.5 py-0.5 bg-theme-danger-dim rounded-sm text-theme-danger font-medium","data-tooltip-id":n,"data-tooltip-content":"None of the builds used the central build template","data-tooltip-place":"bottom",children:"No"}),e.jsx(j,{id:n,place:"bottom",style:{borderRadius:"0.375rem",fontSize:"0.875rem",lineHeight:"1.25rem"},opacity:1})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"px-1.5 py-0.5 rounded-sm font-medium ".concat(t>=r?"text-theme-success bg-theme-success-dim":"text-theme-warn bg-theme-warn-dim"),onMouseOver:()=>x(!0),onFocus:()=>x(!0),"data-tooltip-id":n,children:"Yes"}),e.jsx(j,{id:n,place:"bottom",style:{borderRadius:"0.375rem",fontSize:"0.875rem",lineHeight:"1.25rem"},opacity:1,children:e.jsxs("div",{className:"w-72 pt-2 text-left whitespace-normal",children:[e.jsx("div",{className:"bg-theme-page-content rounded-3xl mb-2",children:e.jsx("div",{className:"bg-theme-highlight rounded-3xl h-2",style:{width:y(t,r).map(v).getOr("0%")}})}),e.jsxs("div",{className:"mb-2 leading-snug",children:[t>=r?e.jsx("strong",{children:"All"}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:m(Math.min(t,r))})," out of the ",e.jsx("strong",{children:m(r)})]})," build ".concat(r===1?"run":"runs"," used the central build template.")]}),e.jsxs("div",{className:"mb-2",children:[o>=t?e.jsx("strong",{children:"All"}):e.jsx("strong",{children:m(Math.min(o,t))})," ".concat(t===1?"run":"runs"," on the main branch.")]}),g.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"Template options:"}),e.jsx("ul",{children:Object.entries(g.data).map(([u,l])=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"".concat(u,": ")}),typeof l=="boolean"?e.jsx("span",{className:"".concat(l?"text-theme-success":"text-theme-danger"," inline-block"),children:l?e.jsx(w,{size:16}):e.jsx(N,{size:16})}):e.jsx("strong",{children:l})]},u))})]}):null]})})]})};export{F as C,C as G};
