import{r as $,R as N,X as h,f as i,i as u,a0 as R,P as l,Q as C,j as n}from"./index-B-YXshIJ.js";import{e as H}from"./Icons-C9UDsqhh.js";import{U as L}from"./users-CDgG5m3x.js";function v(){return v=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},v.apply(this,arguments)}function z(e,a){if(e==null)return{};var t=A(e,a),r,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(a.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}function A(e,a){if(e==null)return{};var t={},r=Object.keys(e),s,o;for(o=0;o<r.length;o++)s=r[o],!(a.indexOf(s)>=0)&&(t[s]=e[s]);return t}var U=$.forwardRef(function(e,a){var t=e.color,r=t===void 0?"currentColor":t,s=e.size,o=s===void 0?24:s,c=z(e,["color","size"]);return N.createElement("svg",v({ref:a,xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},c),N.createElement("circle",{cx:"11",cy:"11",r:"8"}),N.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))});U.propTypes={color:h.string,size:h.oneOfType([h.string,h.number])};U.displayName="Search";const W=U,Z=({label:e,onClose:a})=>n.jsxs("span",{className:"ml-1 py-1 pl-3 pr-2 rounded-md bg-theme-tag flex items-center gap-2",children:[n.jsx("span",{className:"flex items-center gap-2",children:e}),n.jsx("button",{onClick:a,"aria-label":"Remove filter ".concat(e),children:n.jsx(H,{})})]}),Q=()=>{const[e,a]=i("search",u),[t,r]=i("teams",R),[s,o]=i("commitsGreaterThanZero",l),[c,k]=i("buildsGreaterThanZero",l),[b,B]=i("withFailingLastBuilds",l),[m,T]=i("techDebtGreaterThan",C),[d,w]=i("group",u),[y,I]=i("nonMasterReleases",l),[x,G]=i("notStartsWithArtifact",l),[g,S]=i("stageNameExists",u),[f,E]=i("stageNameExistsNotUsed",u),[j,O]=i("nonPolicyConforming",l),P=e||t||s||c||b||m!==void 0||d||y||x||g||f||j,F=$.useMemo(()=>[{renderIf:!!e,label:n.jsxs(n.Fragment,{children:[n.jsx(W,{size:20}),n.jsx("span",{className:"font-semibold",children:e})]}),key:"search",clearUsing:a},{renderIf:!!t,label:n.jsxs(n.Fragment,{children:[n.jsx(L,{size:20}),n.jsx("span",{className:"font-semibold",children:t==null?void 0:t.join(",")})]}),key:"teams",clearUsing:r},{renderIf:!!s,label:"Has commits",key:"Has commits",clearUsing:o},{renderIf:!!c,label:"Has builds",key:"Has builds",clearUsing:k},{renderIf:!!b,label:"Has failing builds",key:"Has failing builds",clearUsing:B},{renderIf:!!m,label:"Tech debt > ".concat(m),key:"Tech debt > ".concat(m),clearUsing:T},{renderIf:!!d,label:"Group: ".concat(d),key:"Group: ".concat(d),clearUsing:w},{renderIf:!!y,label:"Non-master releases",key:"Non-master releases",clearUsing:I},{renderIf:!!x,label:"No starting artifact",key:"No starting artifact",clearUsing:G},{renderIf:!!g,label:"Has stage: ".concat(g),key:"Has stage: ".concat(g),clearUsing:S},{renderIf:!!f,label:"Unused stage: ".concat(f),key:"Unused stage: ".concat(f),clearUsing:E},{renderIf:!!j,label:"Doesn't conform to branch policies",key:"Doesn't conform to branch policies",clearUsing:O}].filter(p=>p.renderIf),[c,s,y,j,x,e,d,k,o,I,O,G,a,w,S,E,r,T,B,g,f,t,m,b]);return P?n.jsxs("div",{className:"w-auto flex flex-wrap gap-2 items-center text-gray-800 mt-6 mb-6 ml-1",children:[n.jsx("span",{children:"Filters applied"}),F.map(p=>n.jsx(Z,{label:p.label,onClose:()=>p.clearUsing(void 0,!0)},p.key))]}):null};export{Q as A};
