unleash-server 4.22.0 → 4.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/routes/admin-api/api-token.js +1 -1
- package/dist/lib/routes/admin-api/api-token.js.map +1 -1
- package/dist/lib/routes/admin-api/project/api-token.js +1 -1
- package/dist/lib/routes/admin-api/project/api-token.js.map +1 -1
- package/dist/lib/routes/admin-api/user/pat.d.ts +1 -0
- package/dist/lib/routes/admin-api/user/pat.js +9 -0
- package/dist/lib/routes/admin-api/user/pat.js.map +1 -1
- package/dist/lib/services/project-schema.js +1 -4
- package/dist/lib/services/project-schema.js.map +1 -1
- package/dist/lib/services/proxy-service.d.ts +6 -1
- package/dist/lib/services/proxy-service.js +18 -7
- package/dist/lib/services/proxy-service.js.map +1 -1
- package/dist/lib/types/experimental.d.ts +1 -0
- package/dist/lib/types/experimental.js +1 -0
- package/dist/lib/types/experimental.js.map +1 -1
- package/dist/test/e2e/api/proxy/proxy.concurrency.e2e.test.d.ts +1 -0
- package/dist/test/e2e/api/proxy/proxy.concurrency.e2e.test.js +58 -0
- package/dist/test/e2e/api/proxy/proxy.concurrency.e2e.test.js.map +1 -0
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{CreateProject-79087949.js → CreateProject-51932050.js} +1 -1
- package/frontend/build/static/{Error-b8ec37c0.js → Error-e6e1194a.js} +1 -1
- package/frontend/build/static/{ExpandMore-4c20b51c.js → ExpandMore-d71bbced.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-b81c4e16.js → FeatureArchiveDialog-fd71aac2.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-37e55387.js → FeatureMetricsChart-66e2ebdf.js} +1 -1
- package/frontend/build/static/FeatureViewLazyExport-3403c2b4.js +7 -0
- package/frontend/build/static/{LazyAdminExport-0f2734aa.js → LazyAdminExport-17ef1739.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-cb47b897.js → LazyProjectExport-96365c31.js} +1 -1
- package/frontend/build/static/{NetworkOverview-8b64cc40.js → NetworkOverview-02d7cec9.js} +1 -1
- package/frontend/build/static/{NetworkTraffic-38cef6f4.js → NetworkTraffic-ea8ea762.js} +1 -1
- package/frontend/build/static/{Playground-4e2c6704.js → Playground-1b14c01c.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-d93244f3.js → StrategyItemContainer-7ce39bda.js} +1 -1
- package/frontend/build/static/{chartjs-adapter-date-fns.esm-24250637.js → chartjs-adapter-date-fns.esm-8ccfeb24.js} +1 -1
- package/frontend/build/static/{index-32a0dc63.js → index-17782336.js} +1 -1
- package/frontend/build/static/{index-c4e310cb.js → index-1d165488.js} +66 -66
- package/frontend/build/static/{index-fe84ab30.js → index-96dcc77e.js} +1 -1
- package/frontend/build/static/{unknownify-8af014d5.js → unknownify-132fbce3.js} +1 -1
- package/frontend/build/static/{useProjectRole-08992a4c.js → useProjectRole-f048973d.js} +1 -1
- package/package.json +1 -1
- package/frontend/build/static/FeatureViewLazyExport-10ea877c.js +0 -7
package/frontend/build/static/{LazyProjectExport-cb47b897.js → LazyProjectExport-96365c31.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as W1,j as t,cO as j0,cP as D0,s as p,cj as O0,cg as Ke,g as n2,r as d,d$ as $0,l as i1,d as r1,f as s,S as a2,h as r2,i as o2,k as i2,bS as B0,a_ as ke,A as U1,aR as ie,aS as q1,aT as G1,e0 as Ct,aI as Q,e1 as k1,bL as T1,a2 as u1,ca as P1,au as s2,H as l1,e2 as _0,R as Ee,cV as J2,bC as Y2,e3 as E1,al as s1,V as x1,ak as p1,C,aO as R1,X as se,W as y1,ce as F0,K as c2,e4 as V0,a as A,e5 as C1,e6 as M0,bD as L0,cB as ce,cC as le,cD as de,b9 as K1,m as B1,e7 as z0,P as l2,du as d2,e8 as X1,ck as Q2,a8 as H1,e9 as k2,bd as ee,dN as H0,bf as te,T as B,cm as St,aN as p2,af as wt,c1 as X2,u as h1,N as g1,ea as N0,F as G,eb as xt,as as I1,a9 as v1,ec as W0,a4 as f1,bG as U0,bE as e3,cn as q0,ed as Tt,ds as At,bu as G0,ar as _1,L as t3,aV as u2,ee as K0,bB as J0,ch as Y0,ef as Q0,eg as X0,eh as en,ei as Et,ej as Rt,O as kt,ek as tn,c6 as h2,Q as m2,d5 as nn,cf as an,bJ as Pt,Y as g2,el as rn,D as It,aQ as on,cb as sn,M as Zt,em as cn,ah as F1,en as jt,ag as Dt,eo as Ot,ai as ln,ep as dn,eq as pn,aU as $t,er as n3,a1 as un,es as Bt,et as hn,eu as mn,ev as gn,ew as fn,by as _t,ex as Ft,ey as Vt,e as Pe,U as f2,ez as vn,eA as yn,aK as bn,bk as Cn,eB as Ie,eC as Mt,eD as Sn,aB as pe,aC as J1,aL as Z1,aD as ue,aG as he,aH as me,eE as wn,c7 as Ae,bI as Lt,eF as zt,eG as xn,bj as ge,aq as Ht,b1 as a3,b0 as r3,aZ as o3,eH as Tn,eI as An,ac as Je,eJ as En,eK as Rn,eL as kn,df as v2,bq as Pn,c5 as In,dn as Ye,eM as Zn,co as i3,eN as y2,bO as ne,aM as N1,aP as s3,aY as c3,aA as $1,av as Nt,eO as jn,ad as A3,eP as Dn,de as Ve,eQ as On,eR as $n,cG as Bn,cE as _n,dI as Fn,eS as Vn,eT as Mn,eU as Ln,bM as Ze,bN as n1,eV as zn,c4 as Wt,d_ as Ut,Z as l3,ax as Hn,eW as Nn,cZ as Wn,eX as Un,eY as qn,eZ as Gn,ci as qt,e_ as Kn,db as Gt,e$ as ae,f0 as J,f1 as Jn,f2 as Yn,f3 as Qn,f4 as Xn,f5 as e4,di as t4,f6 as n4,f7 as a4,f8 as r4,f9 as o4}from"./index-c4e310cb.js";import{A as i4,e as Kt,W as E3,c as s4,b as Jt,T as c4,d as l4,u as d4,E as p4,V as u4,a as h4,g as m4,C as g4,U as f4}from"./FeatureArchiveDialog-b81c4e16.js";import{M as v4,m as y4,h as b4,b as C4,c as S4,d as w4,e as x4,E as T4,f as A4,u as E4,a as R4,R as k4,C as P4,A as I4,B as Yt}from"./useProjectRole-08992a4c.js";import{a as Z4}from"./index-fe84ab30.js";import{E as j4}from"./Error-b8ec37c0.js";const D4=W1(t("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),O4=W1(t("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),$4=W1(t("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}),"FileDownload"),B4=W1(t("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),_4=W1(t("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),F4=W1(t("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),V4=W1(t("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function M4(e,n){j0(2,arguments);var a=D0(n);return Z4(e,-a)}const Me=p("div")(()=>({display:"flex"})),L4=p("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"})),z4=p("div")(()=>({display:"flex",flexDirection:"column"})),H4=p("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),z2=p("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"})),R3=p(z2)(({theme:e})=>({color:e.palette.neutral.dark})),N4=p(O0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),W4=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),U4=p("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),k3=p("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),q4=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),G4=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),K4=p(Ke)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),J4=e=>e.reduce((n,a)=>a.enabled?n+1:n,0),Y4=p(n2)(({theme:e})=>({marginTop:e.spacing(3)})),Q4=p("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:n})=>({color:n?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),X4=({environment:e,warnEnabledToggles:n})=>{const a=d.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:h}})=>t($0,{environment:h})},{Header:"Name",accessor:"name",Cell:i1},{Header:"Type",accessor:"type",Cell:i1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:h})=>t(i1,{children:t(Q4,{warning:h>0,children:h===1?"1 toggle":`${h} toggles`})}),align:"center"}],[n]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:c,prepareRow:l}=r1.useTable({columns:a,data:[e],disableSortBy:!0});return s(Y4,{...r(),rowHeight:"compact",children:[t(a2,{headerGroups:i}),t(r2,{...o(),children:c.map(h=>(l(h),t(o2,{hover:!0,...h.getRowProps(),children:h.cells.map(u=>t(i2,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},ea=p("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),ta=p(B0)(()=>({width:"100%"})),na=({environment:e,open:n,setOpen:a,onConfirm:r})=>{const[o,i]=d.useState("");return d.useEffect(()=>{i("")},[n]),s(ke,{title:"Hide environment and disable feature toggles?",open:n,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{a(!1)},children:[s(U1,{severity:"error",children:[t("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),t(X4,{environment:e}),s(ea,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",t("strong",{children:e==null?void 0:e.name})]}),t(ta,{label:"Environment name",value:o,onChange:c=>i(c.target.value)})]})},aa=e=>{const{data:n,error:a,mutate:r}=ie(q1(`api/admin/environments/project/${e}`),ra),o=d.useMemo(()=>n||[],[n]),i=d.useCallback(async()=>{await r()},[r]);return{environments:o,refetchEnvironments:i,loading:!a&&!n,error:a}},ra=async e=>(await fetch(e).then(G1("Environments")).then(a=>a.json())).environments.sort((a,r)=>a.sortOrder-r.sortOrder),oa=p(U1)(({theme:e})=>({marginBottom:e.spacing(4)})),ia=p("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),sa=p(Ct)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),Qt=()=>{const e=Q("projectId"),n=k1(e);T1(`Project environments – ${n}`);const{setToastData:a,setToastApiError:r}=u1(),{environments:o,loading:i,error:c,refetchEnvironments:l}=aa(e),{project:h,refetch:u}=P1(e),{removeEnvironmentFromProject:g,addEnvironmentToProject:f}=s2(),[m,b]=d.useState(),[S,x]=d.useState(!1),{isOss:Z}=l1(),v=d.useMemo(()=>o.map(I=>({...I,projectVisible:h==null?void 0:h.environments.includes(I.name)})),[o,h==null?void 0:h.environments]),j=()=>{l(),u()},H=()=>t(sa,{onClick:j,text:"Error fetching environments"}),z=I=>`Got an API error when trying to set the environment as ${I?"visible":"hidden"}`,U=async I=>{if(I.projectVisible){if(J4(v)>1){b(I),x(!0);return}a({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await f(e,I.name),j(),a({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{r(z(!0))}},w=async()=>{if(m)try{await g(e,m.name),j(),a({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{r(z(!1))}finally{x(!1)}},D=I=>Z()&&I==="default",O=d.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:I}})=>t(_0,{environment:I})},{Header:"Type",accessor:"type",Cell:Ee},{Header:"Project API tokens",accessor:I=>I.projectApiTokenCount===1?"1 token":`${I.projectApiTokenCount} tokens`,Cell:i1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:I}})=>t(J2,{children:t(Y2,{tooltip:I.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:D(I.name),projectId:e,permission:E1,checked:I.projectVisible,onChange:()=>U(I)})}),disableGlobalFilter:!0}],[v]),{getTableProps:F,getTableBodyProps:N,headerGroups:_,rows:K,prepareRow:Y,state:{globalFilter:y},setGlobalFilter:T}=r1.useTable({columns:O,data:v,disableSortBy:!0},r1.useGlobalFilter),V=t(s1,{title:`Environments (${K.length})`,actions:t(x1,{initialValue:y,onChange:T})});return t(p1,{header:V,isLoading:i,children:s(ia,{children:[t(C,{condition:Boolean(c),show:H()}),s(oa,{severity:"info",children:[t("strong",{children:"Important!"})," In order for your application to retrieve configured activation strategies for a specific environment, the application must use an environment specific API token. You can look up the environment-specific"," ",t(R1,{to:"/admin/api",children:"API tokens here"}),".",t("br",{}),t("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",t(R1,{to:"/admin/api",children:"create a new API token here"}),"."]}),t(se,{value:y,children:s(n2,{...F(),rowHeight:"compact",children:[t(a2,{headerGroups:_}),t(r2,{...N(),children:K.map(I=>(Y(I),t(o2,{hover:!0,...I.getRowProps(),children:I.cells.map(W=>t(i2,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),t(C,{condition:K.length===0,show:t(C,{condition:(y==null?void 0:y.length)>0,show:s(y1,{children:["No environments found matching “",y,"”"]}),elseShow:t(y1,{children:"No environments available. Get started by adding one."})})}),t(na,{environment:m,open:S,setOpen:x,onConfirm:w})]})})},ca={id:"archivedAt"},la=({projectId:e})=>{const{archivedFeatures:n,loading:a,refetchArchived:r}=F0(e),{value:o,setValue:i}=c2(`${e}:ProjectFeaturesArchiveTable`,ca);return t(V0,{title:"Project archive",archivedFeatures:n||[],loading:a,storedParams:o,setStoredParams:i,refetch:r,projectId:e})},da=()=>{const e=Q("projectId"),n=k1(e);return T1(`Project archive – ${n}`),t(la,{projectId:e})},pa=(e=[])=>{var a;const n=d.useRef(e);return(e==null?void 0:e.join(""))!==((a=n.current)==null?void 0:a.join(""))&&(n.current=e),n.current},ua=p(A)(()=>({mx:"auto",...C1})),ha=({projectId:e,featureName:n,environmentName:a,value:r,onToggle:o})=>{const[i,c,l]=M0(r);return t(ua,{children:t(Y2,{checked:r,environmentId:a,projectId:e,permission:L0,inputProps:{"aria-label":a},onClick:()=>{c(!i),o(e,n,a,!i).catch(l)},disabled:i!==r})},`${n}-${a}`)};var d3={},ma=le;Object.defineProperty(d3,"__esModule",{value:!0});var Xt=d3.default=void 0,ga=ma(ce()),fa=de,va=(0,ga.default)((0,fa.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");Xt=d3.default=va;var p3={},ya=le;Object.defineProperty(p3,"__esModule",{value:!0});var e0=p3.default=void 0,ba=ya(ce()),Ca=de,Sa=(0,ba.default)((0,Ca.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");e0=p3.default=Sa;const wa=p(A)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),xa=({projectId:e,row:n,onOpenArchiveDialog:a,onOpenStaleDialog:r})=>{const[o,i]=d.useState(null),{original:{name:c,stale:l}}=n,h=Boolean(o),u=b=>{i(b.currentTarget)},g=()=>{i(null)},f=`feature-${c}-actions`,m=`${f}-menu`;return s(wa,{children:[t(K1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:t(B1,{id:f,"aria-controls":h?m:void 0,"aria-haspopup":"true","aria-expanded":h?"true":void 0,onClick:u,type:"button",children:t(z0,{})})}),t(l2,{id:m,anchorEl:o,open:h,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:s(d2,{"aria-labelledby":f,children:[t(X1,{projectId:e,permission:Q2,children:({hasAccess:b})=>s(H1,{sx:k2,onClick:g,disabled:!b,component:R1,to:`/projects/${e}/features/${c}/strategies/copy`,children:[t(ee,{children:t(H0,{})}),t(te,{children:t(B,{variant:"body2",children:"Copy"})})]})}),t(X1,{projectId:e,permission:St,children:({hasAccess:b})=>s(H1,{sx:k2,onClick:()=>{a(c),g()},disabled:!b,children:[t(ee,{children:t(Xt,{})}),t(te,{children:t(B,{variant:"body2",children:"Archive"})})]})}),t(X1,{projectId:e,permission:p2,children:({hasAccess:b})=>s(H1,{sx:k2,onClick:()=>{g(),r({featureId:c,stale:l===!0})},disabled:!b,children:[t(ee,{children:t(e0,{})}),t(te,{children:s(B,{variant:"body2",children:[l?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var u3={},Ta=le;Object.defineProperty(u3,"__esModule",{value:!0});var t0=u3.default=void 0,Aa=Ta(ce()),Ea=de,Ra=(0,Aa.default)((0,Ea.jsx)("path",{d:"M5.33 20H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h1.33c1.1 0 2 .9 2 2v12c0 1.1-.89 2-2 2zM22 18V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2H20c1.11 0 2-.9 2-2zm-7.33 0V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h1.33c1.1 0 2-.9 2-2z"}),"ViewWeek");t0=u3.default=Ra;const ka=p(A)(()=>({...C1,justifyContent:"center"})),Pa=p(B1)(({theme:e})=>({margin:e.spacing(-1,0)})),Ia=p(A)(({theme:e})=>({...C1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),Za=p(H1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),P3=p(wt)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),ja=p(X2)(({theme:e})=>({padding:e.spacing(.75,1)})),Da={favorite:"Favorite"},Oa=({allColumns:e,staticColumns:n=[],dividerBefore:a=[],dividerAfter:r=[],isCustomized:o=!1,setHiddenColumns:i})=>{const[c,l]=d.useState(null),h=h1(),u=g1(h.breakpoints.down("sm")),g=g1(h.breakpoints.down("md")),f=g1(h.breakpoints.down("lg"));d.useEffect(()=>{if(o)return;const v=(j,H=0)=>{const z=e.filter(({id:w})=>w.startsWith("environments.")!==!1).map(({id:w})=>w).slice(0,H),U=e.map(({id:w})=>w).filter(w=>!j.includes(w)).filter(w=>!n.includes(w)).filter(w=>!z.includes(w));i(U)};if(u)return v(["createdAt"]);if(g)return v(["createdAt"],1);if(f)return v(["type","createdAt"],1);v(["lastSeenAt","type","createdAt"],3)},[u,g,f]);const m=v=>{l(v.currentTarget)},b=()=>{l(null)},S=Boolean(c),x="columns-menu",Z=`columns-menu-list-${x}`;return s(ka,{children:[t(K1,{title:"Select columns",arrow:!0,describeChild:!0,children:t(Pa,{id:x,"aria-controls":S?Z:void 0,"aria-haspopup":"true","aria-expanded":S?"true":void 0,onClick:m,type:"button",size:"large","data-loading":!0,children:t(t0,{})})}),s(l2,{id:Z,open:S,anchorEl:c,onClose:b,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:v.shape.borderRadius,paddingBottom:v.spacing(2)})},children:[s(Ia,{children:[t(B,{variant:"body2",children:t("strong",{children:"Columns"})}),t(B1,{onClick:b,children:t(N0,{})})]}),t(d2,{children:e.filter(({hideInMenu:v})=>!v).map(v=>[t(C,{condition:a.includes(v.id),show:t(P3,{})}),s(Za,{onClick:()=>v.toggleHidden(v.isVisible),disabled:n.includes(v.id),children:[t(ee,{children:t(ja,{edge:"start",checked:v.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":v.id},size:"medium"})}),t(te,{id:v.id,primary:t(B,{variant:"body2",children:t(C,{condition:Boolean(typeof v.Header=="string"&&v.Header),show:()=>t(G,{children:v.Header}),elseShow:()=>Da[v.id]||v.id})})})]}),t(C,{condition:r.includes(v.id),show:t(P3,{})})])})]})]})},$a=xt()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),Ba=({projectId:e,features:n})=>{const{refetch:a}=P1(e),[r,o]=d.useState(!1),{trackEvent:i}=I1();return s(G,{children:[t(X1,{projectId:e,permission:St,children:({hasAccess:l})=>t(v1,{disabled:!l||r,startIcon:t(i4,{}),variant:"outlined",size:"small",onClick:()=>o(!0),children:"Archive"})}),t(Kt,{projectId:e,featureIds:n,onConfirm:async()=>{o(!1),await a(),i("batch_operations",{props:{eventType:"features archived"}})},isOpen:r,onClose:()=>o(!1)})]})},Le="selection-actions-menu",_a=({projectId:e,data:n})=>{const{refetch:a}=P1(e),[r,o]=d.useState(null),{staleFeatures:i}=s2(),{setToastData:c,setToastApiError:l}=u1(),{trackEvent:h}=I1(),u=Boolean(r),g=n.map(({name:v})=>v),f=v=>{o(v.currentTarget)},m=()=>{o(null)},b=n.some(({stale:v})=>v===!0),S=n.some(({stale:v})=>v===!1),x=async()=>{try{m(),await i(e,g),await a(),c({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features staled"}})}catch(v){l(f1(v))}},Z=async()=>{try{m(),await i(e,g,!1),await a(),c({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features unstaled"}})}catch(v){l(f1(v))}};return s(G,{children:[t(K1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t(B1,{id:Le,"aria-controls":u?Le:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:f,type:"button","data-testid":W0,children:t(v4,{})})}),t(l2,{id:`${Le}-menu`,anchorEl:r,open:u,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:t(d2,{"aria-labelledby":`${Le}-menu`,children:t(X1,{projectId:e,permission:p2,children:({hasAccess:v})=>s(G,{children:[t(C,{condition:S,show:()=>s(H1,{onClick:x,disabled:!v,sx:{borderRadius:j=>`${j.shape.borderRadius}px`},children:[t(ee,{children:t(E3,{})}),t(te,{children:t(B,{variant:"body2",children:"Mark as stale"})})]})}),t(C,{condition:b,show:()=>s(H1,{onClick:Z,disabled:!v,sx:{borderRadius:j=>`${j.shape.borderRadius}px`},children:[t(ee,{children:t(E3,{})}),t(te,{children:t(B,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},Fa=p("section")(({theme:e})=>({["& > *"]:{margin:e.spacing(1,0)}})),I3="manage-tags-form",Z3=(e,n)=>[...e,...e.some(a=>a.value===n.value&&a.type===n.type)?[]:[n]],j3=(e,n)=>e.filter(a=>!(a.value===n.value&&a.type===n.type)),Va=(e,n)=>{switch(n.type){case"add":return{...e,addedTags:Z3(e.addedTags,n.payload),removedTags:j3(e.removedTags,n.payload)};case"remove":return{...e,addedTags:j3(e.addedTags,n.payload),removedTags:Z3(e.removedTags,n.payload)};case"clear":return{addedTags:[],removedTags:n.payload};default:return e}},D3={name:"",description:"",icon:""},Ma=({open:e,initialValues:n,initialIndeterminateValues:a,onCancel:r,onSubmit:o})=>{const{tagTypes:i,loading:c}=U0(),[l,h]=d.useState(D3),[u,g]=d.useState([]),[f,m]=d.useState([]),{tags:b,refetch:S}=s4(l.name),{createTag:x}=Jt(),Z=b.map(({value:O})=>({title:O})),[v,j]=d.useReducer(Va,{addedTags:[],removedTags:[]}),H=(O=i.length>0?i[0]:D3)=>{h(O);const F=a.filter(({type:N})=>N===O.name);g(n.filter(({type:N})=>N===O.name).filter(({type:N,value:_})=>!F.some(K=>K.value===_&&K.type===N)).map(({value:N})=>({title:N}))),m(F.map(({value:N})=>({title:N}))),j({type:"clear",payload:[]})};d.useEffect(()=>{i.length>0&&H()},[c]);const z=(O,F)=>{F!=null&&typeof F!="string"&&(O.preventDefault(),H(F))},U=(O,F)=>x({value:O,type:F}).then(async()=>{await S(),g(N=>[...N,{title:O}]),j({type:"add",payload:{value:O,type:F}})}),w=(O,F,N,_)=>{N==="selectOption"?F.forEach(K=>{if(typeof K!="string"&&typeof K.inputValue=="string"&&K.inputValue&&K.title.startsWith("Create new value"))return U(K.inputValue,l.name);g(F),m(Y=>Y.filter(({title:y})=>y!==K.title)),_!=null&&_.option&&j({type:"add",payload:{value:_.option.title,type:l.name}})}):N==="clear"?(g([]),j({type:"clear",payload:n})):N==="removeOption"&&(g(F),_!=null&&_.option&&j({type:"remove",payload:{value:_.option.title,type:l.name}}))},D=()=>{H(),r()};return s(ke,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>o(v),disabledPrimaryButton:v.addedTags.length===0&&v.removedTags.length===0,onClose:D,formId:I3,children:[t(B,{paragraph:!0,sx:{marginBottom:O=>O.spacing(2.5)},children:"Tags allow you to group features together"}),t("form",{id:I3,onSubmit:()=>o(v),children:s(Fa,{children:[t(c4,{options:i,disabled:c||i.length===0,value:l,onChange:z},c?"loading":i.length),t(C,{condition:!c&&i.length===0,show:s(B,{variant:"body1",children:["No"," ",t(e3,{component:R1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t(l4,{disabled:c,options:Z,existingTags:n,indeterminateOptions:f,tagType:l,selectedOptions:u,onChange:w})})]})})]})},La=({projectId:e,data:n})=>{const{bulkUpdateTags:a}=Jt(),{refetch:r}=P1(e),{setToastData:o,setToastApiError:i}=u1(),{trackEvent:c}=I1(),[l,h]=d.useState(!1),[u,g]=d.useMemo(()=>{const m=n.flatMap(({tags:S})=>S||[]).reduce((S,x)=>[...S,...S.some(Z=>Z.type===x.type&&Z.value===x.value)?[]:[x]],[]),b=m.filter(S=>!n.every(({tags:x})=>x==null?void 0:x.some(Z=>Z.type===S.type&&Z.value===S.value)));return[m,b]},[n]);return s(G,{children:[t(X1,{projectId:e,permission:p2,children:({hasAccess:m})=>t(v1,{disabled:!m||l,startIcon:t(q0,{}),variant:"outlined",size:"small",onClick:()=>h(!0),children:"Tags"})}),t(Ma,{open:l,onCancel:()=>h(!1),onSubmit:async({addedTags:m,removedTags:b})=>{const S=n.map(({name:Z})=>Z),x={features:S,tags:{addedTags:m,removedTags:b}};try{await a(x),r();const Z=m.length?`Added tags: ${m.map(({type:j,value:H})=>`${j}:${H}`).join(", ")}.`:"",v=b.length?`Removed tags: ${b.map(({type:j,value:H})=>`${j}:${H}`).join(", ")}.`:"";o({title:"Tags updated",text:`${S.length} feature toggles updated. ${Z} ${v}`,type:"success",autoHideDuration:12e3}),c("batch_operations",{props:{eventType:"tags updated"}})}catch(Z){i(f1(Z))}h(!1)},initialValues:u,initialIndeterminateValues:g},n.length)]})},za=({selectedIds:e,data:n,projectId:a})=>{var g,f;const{uiConfig:r}=l1(),[o,i]=d.useState(!1),{trackEvent:c}=I1(),l=d.useMemo(()=>n.filter(m=>e.includes(m.name)),[n,e]),h=d.useMemo(()=>{const m=l.flatMap(b=>b.environments).map(b=>b==null?void 0:b.name).filter(b=>b!==void 0);return Array.from(new Set(m))},[l]),u=()=>{c("batch_operations",{props:{eventType:"features exported"}})};return s(G,{children:[t(Ba,{projectId:a,features:e}),t(C,{condition:Boolean((g=r==null?void 0:r.flags)==null?void 0:g.featuresExportImport),show:t(v1,{startIcon:t($4,{}),variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"})}),t(La,{projectId:a,data:l}),t(_a,{projectId:a,data:l}),t(C,{condition:Boolean((f=r==null?void 0:r.flags)==null?void 0:f.featuresExportImport),show:t(Tt,{showExportDialog:o,data:l,onClose:()=>i(!1),environments:h,onConfirm:u})})]})},Ha=p(At)(()=>({whiteSpace:"nowrap"})),Na=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:n})=>({flexGrow:0,...C1,justifyContent:"center",...n&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),ze=["Select","Actions","name","favorite"],Wa={id:"createdAt"},Ua=({features:e,loading:n,environments:a=[]})=>{var E,$;const{classes:r}=$a(),o=h1(),i=g1(o.breakpoints.down("md")),[c,l]=d.useState({open:!1,featureId:"",environmentName:""}),[h,u]=d.useState({}),[g,f]=d.useState(),m=Q("projectId"),{value:b,setValue:S}=c2(`${m}:FeatureToggleListTable:v1`,Wa),{value:x,setValue:Z}=G0(),v=_1(),[j,H]=t3(),{isChangeRequestConfigured:z}=u2(m),U=pa(n?["a","b","c"]:a),{refetch:w}=P1(m),{setToastData:D,setToastApiError:O}=u1(),{isFavoritesPinned:F,sortTypes:N,onChangeIsFavoritePinned:_}=K0(j.has("favorites")?j.get("favorites")==="true":x.favorites),{toggleFeatureEnvironmentOn:K,toggleFeatureEnvironmentOff:Y}=J0(),{favorite:y,unfavorite:T}=Y0(),{onChangeRequestToggle:V,onChangeRequestToggleClose:I,onChangeRequestToggleConfirm:W,changeRequestDialogDetails:k}=d4(m),[X,c1]=d.useState(!1),{uiConfig:a1}=l1(),m1=d.useCallback(async(P,R,M,L)=>{if(z(M))throw V(R,M,L),new Error("Additional approval required");try{L?await K(P,R,M):await Y(P,R,M),w()}catch(e1){const O1=f1(e1);throw O1===p4?l({open:!0,featureId:R,environmentName:M}):O(O1),e1}D({type:"success",title:"Updated toggle status",text:"Successfully updated toggle status."}),w()},[Y,K,z]),j1=d.useCallback(async P=>{P!=null&&P.favorite?await T(m,P.name):await y(m,P.name),w()},[m,w]),Oe=d.useMemo(()=>e.some(P=>{var R;return(R=P==null?void 0:P.tags)==null?void 0:R.length}),[e]),b1=d.useMemo(()=>{var P;return[...(P=a1==null?void 0:a1.flags)!=null&&P.bulkOperations?[{id:"Select",Header:({getToggleAllRowsSelectedProps:R})=>t(X2,{...R()}),Cell:({row:R})=>{var M;return t(Q0,{...(M=R==null?void 0:R.getToggleRowSelectedProps)==null?void 0:M.call(R)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{id:"favorite",Header:t(X0,{isActive:F,onClick:_}),accessor:"favorite",Cell:({row:{original:R}})=>t(en,{value:R==null?void 0:R.favorite,onClick:()=>j1(R)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:Et,sortType:"date",align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:Rt,align:"center",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:R})=>t(kt,{title:R,to:`/projects/${m}/features/${R}`}),minWidth:100,sortType:"alphanumeric",searchable:!0},...Oe?[{id:"tags",Header:"Tags",accessor:R=>{var M;return((M=R.tags)==null?void 0:M.map(({type:L,value:e1})=>`${L}:${e1}`).join(`
|
|
1
|
+
import{c as W1,j as t,cO as j0,cP as D0,s as p,cj as O0,cg as Ke,g as n2,r as d,d$ as $0,l as i1,d as r1,f as s,S as a2,h as r2,i as o2,k as i2,bS as B0,a_ as ke,A as U1,aR as ie,aS as q1,aT as G1,e0 as Ct,aI as Q,e1 as k1,bL as T1,a2 as u1,ca as P1,au as s2,H as l1,e2 as _0,R as Ee,cV as J2,bC as Y2,e3 as E1,al as s1,V as x1,ak as p1,C,aO as R1,X as se,W as y1,ce as F0,K as c2,e4 as V0,a as A,e5 as C1,e6 as M0,bD as L0,cB as ce,cC as le,cD as de,b9 as K1,m as B1,e7 as z0,P as l2,du as d2,e8 as X1,ck as Q2,a8 as H1,e9 as k2,bd as ee,dN as H0,bf as te,T as B,cm as St,aN as p2,af as wt,c1 as X2,u as h1,N as g1,ea as N0,F as G,eb as xt,as as I1,a9 as v1,ec as W0,a4 as f1,bG as U0,bE as e3,cn as q0,ed as Tt,ds as At,bu as G0,ar as _1,L as t3,aV as u2,ee as K0,bB as J0,ch as Y0,ef as Q0,eg as X0,eh as en,ei as Et,ej as Rt,O as kt,ek as tn,c6 as h2,Q as m2,d5 as nn,cf as an,bJ as Pt,Y as g2,el as rn,D as It,aQ as on,cb as sn,M as Zt,em as cn,ah as F1,en as jt,ag as Dt,eo as Ot,ai as ln,ep as dn,eq as pn,aU as $t,er as n3,a1 as un,es as Bt,et as hn,eu as mn,ev as gn,ew as fn,by as _t,ex as Ft,ey as Vt,e as Pe,U as f2,ez as vn,eA as yn,aK as bn,bk as Cn,eB as Ie,eC as Mt,eD as Sn,aB as pe,aC as J1,aL as Z1,aD as ue,aG as he,aH as me,eE as wn,c7 as Ae,bI as Lt,eF as zt,eG as xn,bj as ge,aq as Ht,b1 as a3,b0 as r3,aZ as o3,eH as Tn,eI as An,ac as Je,eJ as En,eK as Rn,eL as kn,df as v2,bq as Pn,c5 as In,dn as Ye,eM as Zn,co as i3,eN as y2,bO as ne,aM as N1,aP as s3,aY as c3,aA as $1,av as Nt,eO as jn,ad as A3,eP as Dn,de as Ve,eQ as On,eR as $n,cG as Bn,cE as _n,dI as Fn,eS as Vn,eT as Mn,eU as Ln,bM as Ze,bN as n1,eV as zn,c4 as Wt,d_ as Ut,Z as l3,ax as Hn,eW as Nn,cZ as Wn,eX as Un,eY as qn,eZ as Gn,ci as qt,e_ as Kn,db as Gt,e$ as ae,f0 as J,f1 as Jn,f2 as Yn,f3 as Qn,f4 as Xn,f5 as e4,di as t4,f6 as n4,f7 as a4,f8 as r4,f9 as o4}from"./index-1d165488.js";import{A as i4,e as Kt,W as E3,c as s4,b as Jt,T as c4,d as l4,u as d4,E as p4,V as u4,a as h4,g as m4,C as g4,U as f4}from"./FeatureArchiveDialog-fd71aac2.js";import{M as v4,m as y4,h as b4,b as C4,c as S4,d as w4,e as x4,E as T4,f as A4,u as E4,a as R4,R as k4,C as P4,A as I4,B as Yt}from"./useProjectRole-f048973d.js";import{a as Z4}from"./index-96dcc77e.js";import{E as j4}from"./Error-e6e1194a.js";const D4=W1(t("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),O4=W1(t("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),$4=W1(t("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}),"FileDownload"),B4=W1(t("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),_4=W1(t("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),F4=W1(t("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),V4=W1(t("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function M4(e,n){j0(2,arguments);var a=D0(n);return Z4(e,-a)}const Me=p("div")(()=>({display:"flex"})),L4=p("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"})),z4=p("div")(()=>({display:"flex",flexDirection:"column"})),H4=p("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),z2=p("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"})),R3=p(z2)(({theme:e})=>({color:e.palette.neutral.dark})),N4=p(O0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),W4=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),U4=p("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),k3=p("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),q4=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),G4=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),K4=p(Ke)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),J4=e=>e.reduce((n,a)=>a.enabled?n+1:n,0),Y4=p(n2)(({theme:e})=>({marginTop:e.spacing(3)})),Q4=p("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:n})=>({color:n?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),X4=({environment:e,warnEnabledToggles:n})=>{const a=d.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:h}})=>t($0,{environment:h})},{Header:"Name",accessor:"name",Cell:i1},{Header:"Type",accessor:"type",Cell:i1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:h})=>t(i1,{children:t(Q4,{warning:h>0,children:h===1?"1 toggle":`${h} toggles`})}),align:"center"}],[n]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:c,prepareRow:l}=r1.useTable({columns:a,data:[e],disableSortBy:!0});return s(Y4,{...r(),rowHeight:"compact",children:[t(a2,{headerGroups:i}),t(r2,{...o(),children:c.map(h=>(l(h),t(o2,{hover:!0,...h.getRowProps(),children:h.cells.map(u=>t(i2,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},ea=p("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),ta=p(B0)(()=>({width:"100%"})),na=({environment:e,open:n,setOpen:a,onConfirm:r})=>{const[o,i]=d.useState("");return d.useEffect(()=>{i("")},[n]),s(ke,{title:"Hide environment and disable feature toggles?",open:n,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{a(!1)},children:[s(U1,{severity:"error",children:[t("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),t(X4,{environment:e}),s(ea,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",t("strong",{children:e==null?void 0:e.name})]}),t(ta,{label:"Environment name",value:o,onChange:c=>i(c.target.value)})]})},aa=e=>{const{data:n,error:a,mutate:r}=ie(q1(`api/admin/environments/project/${e}`),ra),o=d.useMemo(()=>n||[],[n]),i=d.useCallback(async()=>{await r()},[r]);return{environments:o,refetchEnvironments:i,loading:!a&&!n,error:a}},ra=async e=>(await fetch(e).then(G1("Environments")).then(a=>a.json())).environments.sort((a,r)=>a.sortOrder-r.sortOrder),oa=p(U1)(({theme:e})=>({marginBottom:e.spacing(4)})),ia=p("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),sa=p(Ct)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),Qt=()=>{const e=Q("projectId"),n=k1(e);T1(`Project environments – ${n}`);const{setToastData:a,setToastApiError:r}=u1(),{environments:o,loading:i,error:c,refetchEnvironments:l}=aa(e),{project:h,refetch:u}=P1(e),{removeEnvironmentFromProject:g,addEnvironmentToProject:f}=s2(),[m,b]=d.useState(),[S,x]=d.useState(!1),{isOss:Z}=l1(),v=d.useMemo(()=>o.map(I=>({...I,projectVisible:h==null?void 0:h.environments.includes(I.name)})),[o,h==null?void 0:h.environments]),j=()=>{l(),u()},H=()=>t(sa,{onClick:j,text:"Error fetching environments"}),z=I=>`Got an API error when trying to set the environment as ${I?"visible":"hidden"}`,U=async I=>{if(I.projectVisible){if(J4(v)>1){b(I),x(!0);return}a({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await f(e,I.name),j(),a({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{r(z(!0))}},w=async()=>{if(m)try{await g(e,m.name),j(),a({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{r(z(!1))}finally{x(!1)}},D=I=>Z()&&I==="default",O=d.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:I}})=>t(_0,{environment:I})},{Header:"Type",accessor:"type",Cell:Ee},{Header:"Project API tokens",accessor:I=>I.projectApiTokenCount===1?"1 token":`${I.projectApiTokenCount} tokens`,Cell:i1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:I}})=>t(J2,{children:t(Y2,{tooltip:I.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:D(I.name),projectId:e,permission:E1,checked:I.projectVisible,onChange:()=>U(I)})}),disableGlobalFilter:!0}],[v]),{getTableProps:F,getTableBodyProps:N,headerGroups:_,rows:K,prepareRow:Y,state:{globalFilter:y},setGlobalFilter:T}=r1.useTable({columns:O,data:v,disableSortBy:!0},r1.useGlobalFilter),V=t(s1,{title:`Environments (${K.length})`,actions:t(x1,{initialValue:y,onChange:T})});return t(p1,{header:V,isLoading:i,children:s(ia,{children:[t(C,{condition:Boolean(c),show:H()}),s(oa,{severity:"info",children:[t("strong",{children:"Important!"})," In order for your application to retrieve configured activation strategies for a specific environment, the application must use an environment specific API token. You can look up the environment-specific"," ",t(R1,{to:"/admin/api",children:"API tokens here"}),".",t("br",{}),t("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",t(R1,{to:"/admin/api",children:"create a new API token here"}),"."]}),t(se,{value:y,children:s(n2,{...F(),rowHeight:"compact",children:[t(a2,{headerGroups:_}),t(r2,{...N(),children:K.map(I=>(Y(I),t(o2,{hover:!0,...I.getRowProps(),children:I.cells.map(W=>t(i2,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),t(C,{condition:K.length===0,show:t(C,{condition:(y==null?void 0:y.length)>0,show:s(y1,{children:["No environments found matching “",y,"”"]}),elseShow:t(y1,{children:"No environments available. Get started by adding one."})})}),t(na,{environment:m,open:S,setOpen:x,onConfirm:w})]})})},ca={id:"archivedAt"},la=({projectId:e})=>{const{archivedFeatures:n,loading:a,refetchArchived:r}=F0(e),{value:o,setValue:i}=c2(`${e}:ProjectFeaturesArchiveTable`,ca);return t(V0,{title:"Project archive",archivedFeatures:n||[],loading:a,storedParams:o,setStoredParams:i,refetch:r,projectId:e})},da=()=>{const e=Q("projectId"),n=k1(e);return T1(`Project archive – ${n}`),t(la,{projectId:e})},pa=(e=[])=>{var a;const n=d.useRef(e);return(e==null?void 0:e.join(""))!==((a=n.current)==null?void 0:a.join(""))&&(n.current=e),n.current},ua=p(A)(()=>({mx:"auto",...C1})),ha=({projectId:e,featureName:n,environmentName:a,value:r,onToggle:o})=>{const[i,c,l]=M0(r);return t(ua,{children:t(Y2,{checked:r,environmentId:a,projectId:e,permission:L0,inputProps:{"aria-label":a},onClick:()=>{c(!i),o(e,n,a,!i).catch(l)},disabled:i!==r})},`${n}-${a}`)};var d3={},ma=le;Object.defineProperty(d3,"__esModule",{value:!0});var Xt=d3.default=void 0,ga=ma(ce()),fa=de,va=(0,ga.default)((0,fa.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");Xt=d3.default=va;var p3={},ya=le;Object.defineProperty(p3,"__esModule",{value:!0});var e0=p3.default=void 0,ba=ya(ce()),Ca=de,Sa=(0,ba.default)((0,Ca.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");e0=p3.default=Sa;const wa=p(A)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),xa=({projectId:e,row:n,onOpenArchiveDialog:a,onOpenStaleDialog:r})=>{const[o,i]=d.useState(null),{original:{name:c,stale:l}}=n,h=Boolean(o),u=b=>{i(b.currentTarget)},g=()=>{i(null)},f=`feature-${c}-actions`,m=`${f}-menu`;return s(wa,{children:[t(K1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:t(B1,{id:f,"aria-controls":h?m:void 0,"aria-haspopup":"true","aria-expanded":h?"true":void 0,onClick:u,type:"button",children:t(z0,{})})}),t(l2,{id:m,anchorEl:o,open:h,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:s(d2,{"aria-labelledby":f,children:[t(X1,{projectId:e,permission:Q2,children:({hasAccess:b})=>s(H1,{sx:k2,onClick:g,disabled:!b,component:R1,to:`/projects/${e}/features/${c}/strategies/copy`,children:[t(ee,{children:t(H0,{})}),t(te,{children:t(B,{variant:"body2",children:"Copy"})})]})}),t(X1,{projectId:e,permission:St,children:({hasAccess:b})=>s(H1,{sx:k2,onClick:()=>{a(c),g()},disabled:!b,children:[t(ee,{children:t(Xt,{})}),t(te,{children:t(B,{variant:"body2",children:"Archive"})})]})}),t(X1,{projectId:e,permission:p2,children:({hasAccess:b})=>s(H1,{sx:k2,onClick:()=>{g(),r({featureId:c,stale:l===!0})},disabled:!b,children:[t(ee,{children:t(e0,{})}),t(te,{children:s(B,{variant:"body2",children:[l?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var u3={},Ta=le;Object.defineProperty(u3,"__esModule",{value:!0});var t0=u3.default=void 0,Aa=Ta(ce()),Ea=de,Ra=(0,Aa.default)((0,Ea.jsx)("path",{d:"M5.33 20H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h1.33c1.1 0 2 .9 2 2v12c0 1.1-.89 2-2 2zM22 18V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2H20c1.11 0 2-.9 2-2zm-7.33 0V6c0-1.1-.9-2-2-2h-1.33c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h1.33c1.1 0 2-.9 2-2z"}),"ViewWeek");t0=u3.default=Ra;const ka=p(A)(()=>({...C1,justifyContent:"center"})),Pa=p(B1)(({theme:e})=>({margin:e.spacing(-1,0)})),Ia=p(A)(({theme:e})=>({...C1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),Za=p(H1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),P3=p(wt)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),ja=p(X2)(({theme:e})=>({padding:e.spacing(.75,1)})),Da={favorite:"Favorite"},Oa=({allColumns:e,staticColumns:n=[],dividerBefore:a=[],dividerAfter:r=[],isCustomized:o=!1,setHiddenColumns:i})=>{const[c,l]=d.useState(null),h=h1(),u=g1(h.breakpoints.down("sm")),g=g1(h.breakpoints.down("md")),f=g1(h.breakpoints.down("lg"));d.useEffect(()=>{if(o)return;const v=(j,H=0)=>{const z=e.filter(({id:w})=>w.startsWith("environments.")!==!1).map(({id:w})=>w).slice(0,H),U=e.map(({id:w})=>w).filter(w=>!j.includes(w)).filter(w=>!n.includes(w)).filter(w=>!z.includes(w));i(U)};if(u)return v(["createdAt"]);if(g)return v(["createdAt"],1);if(f)return v(["type","createdAt"],1);v(["lastSeenAt","type","createdAt"],3)},[u,g,f]);const m=v=>{l(v.currentTarget)},b=()=>{l(null)},S=Boolean(c),x="columns-menu",Z=`columns-menu-list-${x}`;return s(ka,{children:[t(K1,{title:"Select columns",arrow:!0,describeChild:!0,children:t(Pa,{id:x,"aria-controls":S?Z:void 0,"aria-haspopup":"true","aria-expanded":S?"true":void 0,onClick:m,type:"button",size:"large","data-loading":!0,children:t(t0,{})})}),s(l2,{id:Z,open:S,anchorEl:c,onClose:b,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:v.shape.borderRadius,paddingBottom:v.spacing(2)})},children:[s(Ia,{children:[t(B,{variant:"body2",children:t("strong",{children:"Columns"})}),t(B1,{onClick:b,children:t(N0,{})})]}),t(d2,{children:e.filter(({hideInMenu:v})=>!v).map(v=>[t(C,{condition:a.includes(v.id),show:t(P3,{})}),s(Za,{onClick:()=>v.toggleHidden(v.isVisible),disabled:n.includes(v.id),children:[t(ee,{children:t(ja,{edge:"start",checked:v.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":v.id},size:"medium"})}),t(te,{id:v.id,primary:t(B,{variant:"body2",children:t(C,{condition:Boolean(typeof v.Header=="string"&&v.Header),show:()=>t(G,{children:v.Header}),elseShow:()=>Da[v.id]||v.id})})})]}),t(C,{condition:r.includes(v.id),show:t(P3,{})})])})]})]})},$a=xt()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),Ba=({projectId:e,features:n})=>{const{refetch:a}=P1(e),[r,o]=d.useState(!1),{trackEvent:i}=I1();return s(G,{children:[t(X1,{projectId:e,permission:St,children:({hasAccess:l})=>t(v1,{disabled:!l||r,startIcon:t(i4,{}),variant:"outlined",size:"small",onClick:()=>o(!0),children:"Archive"})}),t(Kt,{projectId:e,featureIds:n,onConfirm:async()=>{o(!1),await a(),i("batch_operations",{props:{eventType:"features archived"}})},isOpen:r,onClose:()=>o(!1)})]})},Le="selection-actions-menu",_a=({projectId:e,data:n})=>{const{refetch:a}=P1(e),[r,o]=d.useState(null),{staleFeatures:i}=s2(),{setToastData:c,setToastApiError:l}=u1(),{trackEvent:h}=I1(),u=Boolean(r),g=n.map(({name:v})=>v),f=v=>{o(v.currentTarget)},m=()=>{o(null)},b=n.some(({stale:v})=>v===!0),S=n.some(({stale:v})=>v===!1),x=async()=>{try{m(),await i(e,g),await a(),c({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features staled"}})}catch(v){l(f1(v))}},Z=async()=>{try{m(),await i(e,g,!1),await a(),c({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features unstaled"}})}catch(v){l(f1(v))}};return s(G,{children:[t(K1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t(B1,{id:Le,"aria-controls":u?Le:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:f,type:"button","data-testid":W0,children:t(v4,{})})}),t(l2,{id:`${Le}-menu`,anchorEl:r,open:u,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:t(d2,{"aria-labelledby":`${Le}-menu`,children:t(X1,{projectId:e,permission:p2,children:({hasAccess:v})=>s(G,{children:[t(C,{condition:S,show:()=>s(H1,{onClick:x,disabled:!v,sx:{borderRadius:j=>`${j.shape.borderRadius}px`},children:[t(ee,{children:t(E3,{})}),t(te,{children:t(B,{variant:"body2",children:"Mark as stale"})})]})}),t(C,{condition:b,show:()=>s(H1,{onClick:Z,disabled:!v,sx:{borderRadius:j=>`${j.shape.borderRadius}px`},children:[t(ee,{children:t(E3,{})}),t(te,{children:t(B,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},Fa=p("section")(({theme:e})=>({["& > *"]:{margin:e.spacing(1,0)}})),I3="manage-tags-form",Z3=(e,n)=>[...e,...e.some(a=>a.value===n.value&&a.type===n.type)?[]:[n]],j3=(e,n)=>e.filter(a=>!(a.value===n.value&&a.type===n.type)),Va=(e,n)=>{switch(n.type){case"add":return{...e,addedTags:Z3(e.addedTags,n.payload),removedTags:j3(e.removedTags,n.payload)};case"remove":return{...e,addedTags:j3(e.addedTags,n.payload),removedTags:Z3(e.removedTags,n.payload)};case"clear":return{addedTags:[],removedTags:n.payload};default:return e}},D3={name:"",description:"",icon:""},Ma=({open:e,initialValues:n,initialIndeterminateValues:a,onCancel:r,onSubmit:o})=>{const{tagTypes:i,loading:c}=U0(),[l,h]=d.useState(D3),[u,g]=d.useState([]),[f,m]=d.useState([]),{tags:b,refetch:S}=s4(l.name),{createTag:x}=Jt(),Z=b.map(({value:O})=>({title:O})),[v,j]=d.useReducer(Va,{addedTags:[],removedTags:[]}),H=(O=i.length>0?i[0]:D3)=>{h(O);const F=a.filter(({type:N})=>N===O.name);g(n.filter(({type:N})=>N===O.name).filter(({type:N,value:_})=>!F.some(K=>K.value===_&&K.type===N)).map(({value:N})=>({title:N}))),m(F.map(({value:N})=>({title:N}))),j({type:"clear",payload:[]})};d.useEffect(()=>{i.length>0&&H()},[c]);const z=(O,F)=>{F!=null&&typeof F!="string"&&(O.preventDefault(),H(F))},U=(O,F)=>x({value:O,type:F}).then(async()=>{await S(),g(N=>[...N,{title:O}]),j({type:"add",payload:{value:O,type:F}})}),w=(O,F,N,_)=>{N==="selectOption"?F.forEach(K=>{if(typeof K!="string"&&typeof K.inputValue=="string"&&K.inputValue&&K.title.startsWith("Create new value"))return U(K.inputValue,l.name);g(F),m(Y=>Y.filter(({title:y})=>y!==K.title)),_!=null&&_.option&&j({type:"add",payload:{value:_.option.title,type:l.name}})}):N==="clear"?(g([]),j({type:"clear",payload:n})):N==="removeOption"&&(g(F),_!=null&&_.option&&j({type:"remove",payload:{value:_.option.title,type:l.name}}))},D=()=>{H(),r()};return s(ke,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>o(v),disabledPrimaryButton:v.addedTags.length===0&&v.removedTags.length===0,onClose:D,formId:I3,children:[t(B,{paragraph:!0,sx:{marginBottom:O=>O.spacing(2.5)},children:"Tags allow you to group features together"}),t("form",{id:I3,onSubmit:()=>o(v),children:s(Fa,{children:[t(c4,{options:i,disabled:c||i.length===0,value:l,onChange:z},c?"loading":i.length),t(C,{condition:!c&&i.length===0,show:s(B,{variant:"body1",children:["No"," ",t(e3,{component:R1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t(l4,{disabled:c,options:Z,existingTags:n,indeterminateOptions:f,tagType:l,selectedOptions:u,onChange:w})})]})})]})},La=({projectId:e,data:n})=>{const{bulkUpdateTags:a}=Jt(),{refetch:r}=P1(e),{setToastData:o,setToastApiError:i}=u1(),{trackEvent:c}=I1(),[l,h]=d.useState(!1),[u,g]=d.useMemo(()=>{const m=n.flatMap(({tags:S})=>S||[]).reduce((S,x)=>[...S,...S.some(Z=>Z.type===x.type&&Z.value===x.value)?[]:[x]],[]),b=m.filter(S=>!n.every(({tags:x})=>x==null?void 0:x.some(Z=>Z.type===S.type&&Z.value===S.value)));return[m,b]},[n]);return s(G,{children:[t(X1,{projectId:e,permission:p2,children:({hasAccess:m})=>t(v1,{disabled:!m||l,startIcon:t(q0,{}),variant:"outlined",size:"small",onClick:()=>h(!0),children:"Tags"})}),t(Ma,{open:l,onCancel:()=>h(!1),onSubmit:async({addedTags:m,removedTags:b})=>{const S=n.map(({name:Z})=>Z),x={features:S,tags:{addedTags:m,removedTags:b}};try{await a(x),r();const Z=m.length?`Added tags: ${m.map(({type:j,value:H})=>`${j}:${H}`).join(", ")}.`:"",v=b.length?`Removed tags: ${b.map(({type:j,value:H})=>`${j}:${H}`).join(", ")}.`:"";o({title:"Tags updated",text:`${S.length} feature toggles updated. ${Z} ${v}`,type:"success",autoHideDuration:12e3}),c("batch_operations",{props:{eventType:"tags updated"}})}catch(Z){i(f1(Z))}h(!1)},initialValues:u,initialIndeterminateValues:g},n.length)]})},za=({selectedIds:e,data:n,projectId:a})=>{var g,f;const{uiConfig:r}=l1(),[o,i]=d.useState(!1),{trackEvent:c}=I1(),l=d.useMemo(()=>n.filter(m=>e.includes(m.name)),[n,e]),h=d.useMemo(()=>{const m=l.flatMap(b=>b.environments).map(b=>b==null?void 0:b.name).filter(b=>b!==void 0);return Array.from(new Set(m))},[l]),u=()=>{c("batch_operations",{props:{eventType:"features exported"}})};return s(G,{children:[t(Ba,{projectId:a,features:e}),t(C,{condition:Boolean((g=r==null?void 0:r.flags)==null?void 0:g.featuresExportImport),show:t(v1,{startIcon:t($4,{}),variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"})}),t(La,{projectId:a,data:l}),t(_a,{projectId:a,data:l}),t(C,{condition:Boolean((f=r==null?void 0:r.flags)==null?void 0:f.featuresExportImport),show:t(Tt,{showExportDialog:o,data:l,onClose:()=>i(!1),environments:h,onConfirm:u})})]})},Ha=p(At)(()=>({whiteSpace:"nowrap"})),Na=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:n})=>({flexGrow:0,...C1,justifyContent:"center",...n&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),ze=["Select","Actions","name","favorite"],Wa={id:"createdAt"},Ua=({features:e,loading:n,environments:a=[]})=>{var E,$;const{classes:r}=$a(),o=h1(),i=g1(o.breakpoints.down("md")),[c,l]=d.useState({open:!1,featureId:"",environmentName:""}),[h,u]=d.useState({}),[g,f]=d.useState(),m=Q("projectId"),{value:b,setValue:S}=c2(`${m}:FeatureToggleListTable:v1`,Wa),{value:x,setValue:Z}=G0(),v=_1(),[j,H]=t3(),{isChangeRequestConfigured:z}=u2(m),U=pa(n?["a","b","c"]:a),{refetch:w}=P1(m),{setToastData:D,setToastApiError:O}=u1(),{isFavoritesPinned:F,sortTypes:N,onChangeIsFavoritePinned:_}=K0(j.has("favorites")?j.get("favorites")==="true":x.favorites),{toggleFeatureEnvironmentOn:K,toggleFeatureEnvironmentOff:Y}=J0(),{favorite:y,unfavorite:T}=Y0(),{onChangeRequestToggle:V,onChangeRequestToggleClose:I,onChangeRequestToggleConfirm:W,changeRequestDialogDetails:k}=d4(m),[X,c1]=d.useState(!1),{uiConfig:a1}=l1(),m1=d.useCallback(async(P,R,M,L)=>{if(z(M))throw V(R,M,L),new Error("Additional approval required");try{L?await K(P,R,M):await Y(P,R,M),w()}catch(e1){const O1=f1(e1);throw O1===p4?l({open:!0,featureId:R,environmentName:M}):O(O1),e1}D({type:"success",title:"Updated toggle status",text:"Successfully updated toggle status."}),w()},[Y,K,z]),j1=d.useCallback(async P=>{P!=null&&P.favorite?await T(m,P.name):await y(m,P.name),w()},[m,w]),Oe=d.useMemo(()=>e.some(P=>{var R;return(R=P==null?void 0:P.tags)==null?void 0:R.length}),[e]),b1=d.useMemo(()=>{var P;return[...(P=a1==null?void 0:a1.flags)!=null&&P.bulkOperations?[{id:"Select",Header:({getToggleAllRowsSelectedProps:R})=>t(X2,{...R()}),Cell:({row:R})=>{var M;return t(Q0,{...(M=R==null?void 0:R.getToggleRowSelectedProps)==null?void 0:M.call(R)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{id:"favorite",Header:t(X0,{isActive:F,onClick:_}),accessor:"favorite",Cell:({row:{original:R}})=>t(en,{value:R==null?void 0:R.favorite,onClick:()=>j1(R)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:Et,sortType:"date",align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:Rt,align:"center",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:R})=>t(kt,{title:R,to:`/projects/${m}/features/${R}`}),minWidth:100,sortType:"alphanumeric",searchable:!0},...Oe?[{id:"tags",Header:"Tags",accessor:R=>{var M;return((M=R.tags)==null?void 0:M.map(({type:L,value:e1})=>`${L}:${e1}`).join(`
|
|
2
2
|
`))||""},Cell:tn,width:80,searchable:!0}]:[],{Header:"Created",accessor:"createdAt",Cell:h2,sortType:"date",minWidth:120},...U.map(R=>({Header:n?()=>"":R,maxWidth:90,id:`environments.${R}`,accessor:M=>{var L;return(L=M.environments[R])==null?void 0:L.enabled},align:"center",Cell:({value:M,row:{original:L}})=>{const e1=L.someEnabledEnvironmentHasVariants&&L.environments[R].variantCount===0&&L.environments[R].enabled;return s(Na,{hasWarning:e1,children:[t(ha,{value:M,projectId:m,featureName:L==null?void 0:L.name,environmentName:R,onToggle:m1}),t(C,{condition:e1,show:t(u4,{})})]})},sortType:"boolean",filterName:R,filterParsing:M=>M?"enabled":"disabled"})),{id:"Actions",maxWidth:56,width:56,Cell:R=>t(xa,{projectId:m,onOpenArchiveDialog:f,onOpenStaleDialog:u,...R}),disableSortBy:!0,hideInMenu:!0}]},[m,U,n,m1]),[d1,Se]=d.useState(j.get("search")||""),$e=d.useMemo(()=>e.map(P=>{var R;return{...P,environments:Object.fromEntries(U.map(M=>{const L=P==null?void 0:P.environments.find(e1=>(e1==null?void 0:e1.name)===M);return[M,{name:M,enabled:(L==null?void 0:L.enabled)||!1,variantCount:(L==null?void 0:L.variantCount)||0}]})),someEnabledEnvironmentHasVariants:((R=P.environments)==null?void 0:R.some(M=>M.variantCount>0&&M.enabled))||!1}}),[e,U]),{data:V1,getSearchText:Y1,getSearchContext:A1}=m2(b1,d1,$e),we=d.useMemo(()=>n?Array(6).fill({type:"-",name:"Feature name",createdAt:new Date,environments:{production:{name:"production",enabled:!1}}}):V1,[n,V1]),Be=d.useMemo(()=>{var M;const P=b1.map(L=>(L==null?void 0:L.accessor)||(L==null?void 0:L.id));let R=U.filter((L,e1)=>e1>=3).map(L=>`environments.${L}`);if(j.has("columns")){const L=((M=j.get("columns"))==null?void 0:M.split(","))||[],e1=[...ze,...L];R=P.filter(O1=>!e1.includes(O1))}else if(b.columns){const L=[...ze,...b.columns];R=P.filter(e1=>!L.includes(e1))}return{sortBy:[{id:j.get("sort")||"createdAt",desc:j.has("order")?j.get("order")==="desc":b.desc}],hiddenColumns:R,selectedRowIds:{}}},[U]),_e=d.useCallback(P=>P.name,[]),{allColumns:xe,headerGroups:D1,rows:M1,state:{selectedRowIds:L1,sortBy:S1,hiddenColumns:Q1},prepareRow:C2,setHiddenColumns:S2}=r1.useTable({columns:b1,data:we,initialState:Be,sortTypes:N,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:_e},r1.useFlexLayout,r1.useSortBy,r1.useRowSelect);return d.useEffect(()=>{if(n)return;const P={};P.sort=S1[0].id,S1[0].desc&&(P.order="desc"),d1&&(P.search=d1),F&&(P.favorites="true"),P.columns=xe.map(({id:R})=>R).filter(R=>!ze.includes(R)&&!(Q1!=null&&Q1.includes(R))).join(","),H(P,{replace:!0}),S(R=>({...R,id:S1[0].id,desc:S1[0].desc||!1,columns:P.columns.split(",")})),Z(R=>({...R,favorites:Boolean(F)}))},[n,S1,Q1,d1,H,F]),s(G,{children:[s(p1,{isLoading:n,className:r.container,header:t(s1,{titleElement:`Feature toggles (${M1.length})`,actions:s(G,{children:[t(C,{condition:!i,show:t(x1,{initialValue:d1,onChange:Se,hasFilters:!0,getSearchContext:A1})}),t(Oa,{allColumns:xe,staticColumns:ze,dividerAfter:["createdAt"],dividerBefore:["Actions"],isCustomized:Boolean(b.columns),setHiddenColumns:S2}),t(s1.Divider,{sx:{marginLeft:0}}),t(C,{condition:Boolean((E=a1==null?void 0:a1.flags)==null?void 0:E.featuresExportImport),show:t(K1,{title:"Export toggles visible in the table below",arrow:!0,children:t(B1,{onClick:()=>c1(!0),sx:P=>({marginRight:P.spacing(2)}),children:t(nn,{})})})}),t(Ha,{onClick:()=>v(an(m)),maxWidth:"960px",Icon:Pt,projectId:m,permission:Q2,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:t(C,{condition:i,show:t(x1,{initialValue:d1,onChange:Se,hasFilters:!0,getSearchContext:A1})})}),children:[t(se,{value:Y1(d1),children:t(g2,{rows:M1,headerGroups:D1,prepareRow:C2})}),t(C,{condition:M1.length===0,show:t(C,{condition:(d1==null?void 0:d1.length)>0,show:s(y1,{children:["No feature toggles found matching “",d1,"”"]}),elseShow:t(y1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})}),t(h4,{onClose:()=>l(P=>({...P,open:!1})),projectId:m,...c}),t(m4,{isStale:h.stale===!0,isOpen:Boolean(h.featureId),onClose:()=>{u({}),w()},featureId:h.featureId||"",projectId:m}),t(Kt,{isOpen:Boolean(g),onConfirm:()=>{w()},onClose:()=>{f(void 0)},featureIds:[g||""],projectId:m})," ",t(g4,{isOpen:k.isOpen,onClose:I,environment:k==null?void 0:k.environment,onConfirm:W,messageComponent:t(f4,{featureName:k.featureName,enabled:k.enabled,environment:k==null?void 0:k.environment})}),t(C,{condition:Boolean(($=a1==null?void 0:a1.flags)==null?void 0:$.featuresExportImport)&&!n,show:t(Tt,{showExportDialog:X,data:we,onClose:()=>c1(!1),environments:U})})]}),t(rn,{count:Object.keys(L1).length,children:t(za,{selectedIds:Object.keys(L1),data:e,projectId:m})})]})},fe=p("div")(({theme:e})=>({margin:"0",textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",minWidth:225,padding:e.spacing(3),[e.breakpoints.down("md")]:{display:"flex",flexDirection:"column",position:"relative",padding:e.spacing(1.5)}})),je=p("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),h3=p("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),b2=({children:e,to:n})=>t(B,{variant:"body2",textAlign:"center",sx:{paddingTop:a=>a.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:t(e3,{component:R1,to:n,children:e})}),qa=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),Ga=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),Ka=({projectId:e,health:n})=>s(fe,{children:[t(je,{"data-loading":!0,children:"Project health"}),s(A,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:a=>a.spacing(2)},children:[t(Ga,{children:t(It,{percentage:n})}),s(qa,{"data-loading":!0,children:[n,"%"]})]}),t(b2,{to:`/projects/${e}/health`,children:"View project health"})]}),Ja=p(h3)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),Ya=p("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),width:"100%",gridTemplateColumns:`${e.spacing(2.5)} auto auto`,margin:e.spacing(1,0),fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,alignItems:"center",[e.breakpoints.down("md")]:{margin:0}})),Qa=({type:e,Icon:n,count:a})=>s(Ya,{"data-loading":!0,children:[t(n,{fontSize:"small","data-loading":!0}),t("div",{children:(o=>o.charAt(0).toUpperCase()+o.slice(1).replace("-"," "))(e)}),t(Ja,{children:a})]}),Xa=({features:e})=>{const n=d.useMemo(()=>{const a=(e==null?void 0:e.filter(l=>l.type==="release").length)||0,r=(e==null?void 0:e.filter(l=>l.type==="experiment").length)||0,o=(e==null?void 0:e.filter(l=>l.type==="operational").length)||0,i=(e==null?void 0:e.filter(l=>l.type==="kill-switch").length)||0,c=(e==null?void 0:e.filter(l=>l.type==="permission").length)||0;return{release:a,experiment:r,operational:o,"kill-switch":i,permission:c}},[e]);return s(fe,{sx:{padding:a=>a.spacing(3)},children:[t(je,{children:"Toggle types used"}),Object.keys(n).map(a=>t(Qa,{type:a,Icon:on(a),count:n[a]},a))]})},er=p("div")(({theme:e})=>({textAlign:"left",borderRadius:`${e.shape.borderRadius}px`,backgroundColor:`${e.palette.background.elevation2}`,padding:e.spacing(.5,2),fontSize:e.typography.body2.fontSize})),tr=({id:e,description:n})=>s(fe,{children:[t(je,{children:"Project Meta"}),s(er,{children:[t(B,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",t("code",{"data-loading":!0,children:e||"__________"})]}),t(C,{condition:Boolean(n),show:t(B,{variant:"body2",sx:{marginTop:a=>a.spacing(1.5),marginBottom:0,textAlign:"left"},children:n})}),t(C,{condition:!Boolean(n),show:t(b2,{to:`/projects/${e}/edit`,children:"Add description"})})]}),nr=p(B)(({theme:e})=>({marginBottom:e.spacing(2.5)})),ar=p(A)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),P2=p(A)(({theme:e})=>({...C1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),O3=p(B)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),rr=p(B)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),or=e=>e>0?t(O4,{sx:{color:"success.dark",height:20,width:20}}):t(V4,{sx:{color:"warning.dark",height:20,width:20}}),ir=e=>e>0?"success.dark":"warning.dark",Te=({title:e,boxText:n,change:a,percentage:r,children:o,customChangeElement:i})=>s(G,{children:[t(C,{condition:Boolean(e),show:t(nr,{children:e})}),o,s(A,{sx:{...C1,justifyContent:"center",width:"auto"},children:[t(ar,{children:n}),t(C,{condition:Boolean(i),show:t(P2,{children:i}),elseShow:t(C,{condition:a!==void 0&&a!==0,show:s(P2,{children:[s(A,{sx:{...C1},children:[or(a),s(rr,{color:ir(a),children:[a>0?"+":"",a,r?"%":""]})]}),t(O3,{children:"this month"})]}),elseShow:t(P2,{children:t(O3,{children:"No change"})})})})]})]}),sr=({projectId:e,memberCount:n,change:a=0})=>{var i,c;const{uiConfig:r}=l1();let o="/admin/users";return(c=(i=r==null?void 0:r.versionInfo)==null?void 0:i.current)!=null&&c.enterprise&&(o=`/projects/${e}/settings/access`),s(fe,{children:[t(je,{"data-loading":!0,children:"Project members"}),t(A,{sx:{display:"flex",justifyContent:"center"},children:t(Te,{boxText:`${n}`,change:a})}),t(b2,{to:o,children:"View all members"})]})},cr=e=>fetch(e).then(G1("ChangeRequest")).then(n=>n.json()),n0=e=>{const{data:n,error:a,mutate:r}=sn([],q1(`api/admin/projects/${e}/change-requests`),cr);return d.useMemo(()=>({changeRequests:n,loading:!a&&!n,refetch:r,error:a}),[n,a,r])},We="change-requests-widget",lr=p(A)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),$3=p(A)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),B3=p(A)(({theme:e})=>({display:"flex",alignItems:"center"})),dr=p(h3)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),pr=p(h3)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),_3=p(B)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),F3=()=>t(B,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":We,children:"change requests"}),ur=({projectId:e})=>{const{changeRequests:n,loading:a}=n0(e),r=Zt(a,`[data-loading="${We}"]`),o=n==null?void 0:n.filter(c=>(c==null?void 0:c.state)==="Approved").length,i=n==null?void 0:n.filter(c=>(c==null?void 0:c.state)==="In review").length;return s(fe,{ref:r,children:[t(je,{children:"Open change requests"}),s(lr,{children:[s($3,{sx:{background:c=>c.palette.success.light},children:[t(_3,{children:"To be applied"}),s(B3,{children:[t(dr,{"data-loading":We,children:o||0})," ",t(F3,{})]})]}),s($3,{sx:{background:c=>c.palette.secondary.light},children:[t(_3,{children:"To be reviewed"}),s(B3,{children:[t(pr,{"data-loading":We,children:i||0})," ",t(F3,{})]})]})]}),t(b2,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})};var m3={},hr=le;Object.defineProperty(m3,"__esModule",{value:!0});var g3=m3.default=void 0,mr=hr(ce()),gr=de,fr=(0,mr.default)((0,gr.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward");g3=m3.default=fr;const vr=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),yr=p("div")(()=>({display:"flex",justifyContent:"center"})),br=p(R1)(({theme:e})=>({textDecoration:"none",...C1,justifyContent:"center",color:e.palette.primary.main,[e.breakpoints.down("md")]:{position:"absolute",bottom:e.spacing(1.5),right:e.spacing(1.5)}})),Cr=p("p")(({theme:e})=>({[e.breakpoints.down("md")]:{display:"none"}})),Sr=p(g3)(({theme:e})=>({color:e.palette.primary.main,marginLeft:e.spacing(1)})),wr=({projectId:e,health:n})=>s(fe,{children:[t(yr,{children:t(It,{percentage:n})}),t(B,{"data-loading":!0,sx:{marginTop:a=>a.spacing(2)},children:"Overall health rating"}),t(A,{sx:{marginBottom:a=>a.spacing(2.5)},children:s(vr,{"data-loading":!0,children:[n,"%"]})}),s(br,{"data-loading":!0,to:`/projects/${e}/health`,children:[t(Cr,{"data-loading":!0,children:"view more "}),t(Sr,{"data-loading":!0})]})]}),xr=p("div")(({theme:e})=>({textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",padding:e.spacing(3,2,3,2),[e.breakpoints.down("md")]:{...C1,flexDirection:"column",justifyContent:"center",fontSize:e.fontSizes.smallBody,position:"relative",padding:e.spacing(1.5)}})),Tr=p("p")(({theme:e})=>({marginBottom:e.spacing(2)})),Ar=p("p")(({theme:e})=>({fontSize:"1.5rem",marginBottom:e.spacing(2),[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),Er=p("p")(({theme:e})=>({[e.breakpoints.down("md")]:{display:"none"}})),Rr=p(R1)(({theme:e})=>({textDecoration:"none",...C1,justifyContent:"center",color:e.palette.primary.main,[e.breakpoints.down("md")]:{position:"absolute",right:e.spacing(1.5),bottom:e.spacing(1.5)}})),kr=p(g3)(({theme:e})=>({color:e.palette.primary.main,marginLeft:e.spacing(1)})),Pr=({projectId:e,memberCount:n})=>{var o,i;const{uiConfig:a}=l1();let r="/admin/users";return(i=(o=a==null?void 0:a.versionInfo)==null?void 0:o.current)!=null&&i.enterprise&&(r=`/projects/${e}/settings/access`),s(xr,{children:[t(Tr,{"data-loading":!0,children:"Project members"}),t(Ar,{"data-loading":!0,children:n}),s(Rr,{"data-loading":!0,to:r,children:[t(Er,{"data-loading":!0,children:"view more "}),t(kr,{"data-loading":!0})]})]})},Ir=p(A)(({theme:e})=>({...C1,width:"225px",flexDirection:"column",gap:e.spacing(2),boxShadow:"none",[e.breakpoints.down("md")]:{display:"grid",width:"100%",alignItems:"stretch",marginBottom:e.spacing(2)},[e.breakpoints.down("sm")]:{display:"flex"}})),Zr=({id:e,description:n,memberCount:a,health:r,features:o,stats:i})=>{const{uiConfig:c,isEnterprise:l}=l1(),h=h1(),u=g1(h.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:g}=u2(e),f=l()&&g(),m=e!==cn,b=!f&&!m||u&&f&&m;return Boolean(c==null?void 0:c.flags.newProjectOverview)?t("aside",{children:s(Ir,{sx:b?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[t(C,{condition:f,show:t(A,{sx:{gridColumnStart:m?"span 2":"span 1",flex:1,display:"flex"},children:t(ur,{projectId:e})})}),t(tr,{id:e,description:n}),t(Ka,{projectId:e,health:r}),t(C,{condition:m,show:t(sr,{projectId:e,memberCount:a,change:i==null?void 0:i.projectMembersAddedCurrentWindow})}),t(Xa,{features:o})]})}):t("aside",{children:s(A,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(225px, 1fr))",gap:S=>S.spacing(2),paddingBottom:S=>S.spacing(2)},children:[t(wr,{projectId:e,health:r}),t(C,{condition:m,show:t(Pr,{projectId:e,memberCount:a})})]})})},jr=p(F1)(({theme:e})=>({padding:e.spacing(3,3),maxWidth:"350px",borderRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.neutral.border}`,fontSize:e.typography.body2.fontSize})),V3=({children:e,id:n})=>{const[a,r]=d.useState(null),o=l=>r(l.currentTarget),i=()=>r(null),c=Boolean(a);return s(A,{sx:{position:"absolute",top:l=>l.spacing(.5),right:l=>l.spacing(.5)},children:[t(B1,{onClick:o,"aria-describedby":n,size:"small",children:t(jt,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),t(Dt,{id:n,open:c,anchorEl:a,sx:l=>({zIndex:l.zIndex.tooltip}),children:t(Ot,{onClickAway:i,children:s(jr,{elevation:3,children:[t(B1,{onClick:i,sx:{position:"absolute",right:4,top:4},children:t(ln,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),e,t(dn,{id:n,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},Dr=p(A)(({theme:e})=>({padding:e.spacing(0,0,2,2),display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(4, 1fr)",flexWrap:"wrap",[e.breakpoints.down("lg")]:{gridTemplateColumns:"repeat(2, 1fr)"},[e.breakpoints.down("md")]:{padding:e.spacing(0,0,2)},[e.breakpoints.down("sm")]:{flexDirection:"column"}})),He=p(A)(({theme:e})=>({position:"relative",padding:e.spacing(3),backgroundColor:e.palette.background.paper,flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:`${e.shape.borderRadiusLarge}px`,[e.breakpoints.down("lg")]:{padding:e.spacing(2)}})),Or=p(B)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),$r=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:n,projectActivityCurrentWindow:a,projectActivityPastWindow:r,createdCurrentWindow:o,createdPastWindow:i,archivedCurrentWindow:c,archivedPastWindow:l}=e;return s(Dr,{children:[t(He,{children:t(Te,{title:"Total changes",boxText:String(a),change:a-r,children:t(V3,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),t(He,{children:t(Te,{title:"Avg. time to production",boxText:s(A,{sx:{display:"flex",alignItems:"center",gap:h=>h.spacing(1)},children:[n," ",t(B,{component:"span",children:"days"})]}),customChangeElement:t(Or,{children:"In project life"}),percentage:!0,children:t(V3,{id:"avg-time-to-prod",children:'How long did it take on average from a feature toggle was created until it was enabled in an environment of type production. This is calculated only from feature toggles with the type of "release".'})})}),t(He,{children:t(Te,{title:"Features created",boxText:String(o),change:o-i})}),t(He,{children:t(Te,{title:"Features archived",boxText:String(c),change:c-l})})]})},Br=15*1e3,_r=p("div")(({theme:e})=>({display:"flex",[e.breakpoints.down("md")]:{flexDirection:"column"}})),Fr=p("div")(()=>({width:"100%",minWidth:0})),Vr=p(A)(()=>({display:"flex",flexDirection:"column",width:"100%",minWidth:0})),Mr=()=>{const e=Q("projectId"),n=k1(e),{project:a,loading:r}=P1(e,{refreshInterval:Br}),{members:o,features:i,health:c,description:l,environments:h,stats:u}=a;T1(`Project overview – ${n}`);const{setLastViewed:g}=pn(),{uiConfig:f}=l1();return d.useEffect(()=>{g(e)},[e,g]),s(_r,{children:[t(Zr,{id:e,description:l,memberCount:o,health:c,features:i,stats:u}),s(Vr,{children:[t(C,{condition:Boolean(f==null?void 0:f.flags.newProjectOverview),show:t($r,{stats:a.stats})}),t(Fr,{children:t(Ua,{features:i,environments:h,loading:r})})]})]})},Lr=(e,n)=>{const a=q1(`api/admin/projects/${e}/health-report`),{data:r,error:o}=ie(a,zr,n),i=d.useCallback(()=>{$t(a).catch(console.warn)},[a]);return{healthReport:r,refetchHealthReport:i,loading:!o&&!r,error:o}},zr=e=>fetch(e).then(G1("Health report")).then(n=>n.json());var f3={},Hr=le;Object.defineProperty(f3,"__esModule",{value:!0});var H2=f3.default=void 0,Nr=Hr(ce()),Wr=de,Ur=(0,Nr.default)((0,Wr.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");H2=f3.default=Ur;const qr=p(A)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),M3=p(A)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Gr=p(F1)(({theme:e})=>({padding:e.spacing(4),marginBottom:e.spacing(2),borderRadius:e.shape.borderRadiusLarge,boxShadow:"none",display:"flex",justifyContent:"space-between",[e.breakpoints.down("md")]:{flexDirection:"column",gap:e.spacing(2)}})),I2=p("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1)})),Kr=p("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),Jr=p("p")(({theme:e})=>({color:e.palette.text.secondary})),L3=p("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),z3=p("p")(({theme:e})=>({marginLeft:e.spacing(4)})),Yr=({healthReport:e})=>{const n=e.health<50?"error.main":e.health<75?"warning.main":"success.main",a=()=>s(qr,{children:[t(un,{}),s("span",{children:[e.activeCount," active toggles"]})]}),r=()=>s(M3,{children:[t(H2,{}),s("span",{children:[e.staleCount," stale toggles"]})]}),o=()=>s(M3,{children:[t(H2,{}),s("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]});return s(Gr,{children:[s(A,{children:[t(I2,{children:"Health rating"}),t(C,{condition:e.health>-1,show:s(G,{children:[s(Kr,{sx:{color:n},children:[e.health,"%"]}),s(Jr,{children:["Last updated:"," ",t(n3,{date:e.updatedAt,live:!1})]})]})})]}),s(A,{children:[t(I2,{children:"Toggle report"}),s(L3,{children:[t("li",{children:t(C,{condition:Boolean(e.activeCount),show:a})}),t(C,{condition:Boolean(e.activeCount),show:t(z3,{children:"Also includes potentially stale toggles."})}),t("li",{children:t(C,{condition:Boolean(e.staleCount),show:r})})]})]}),s(A,{sx:{flexBasis:"40%"},children:[t(I2,{children:"Potential actions"}),t(L3,{children:t("li",{children:t(C,{condition:Boolean(e.potentiallyStaleCount),show:o})})}),t(C,{condition:Boolean(e.potentiallyStaleCount),show:t(z3,{children:"Review your feature toggles and delete unused toggles."}),elseShow:t("span",{children:"No action is required"})})]})]})},Qr=({row:e})=>{const n=h1();return e.original.expiredAt?t(h2,{value:e.original.expiredAt}):t(i1,{children:t(B,{variant:"body2",color:n.palette.text.secondary,children:"N/A"})})},Xr=p("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),eo=p("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),to=({row:e})=>e.original.status==="potentially-stale"?t(i1,{children:s(Xr,{children:[t(F4,{}),t("span",{children:"Potentially stale"})]})}):t(i1,{children:s(eo,{children:[t(Bt,{}),t("span",{children:"Healthy"})]})}),H3=40,no=7,a0={[mn]:H3,[gn]:H3,[fn]:no},r0=(e,n)=>Math.abs(hn(e,n)),o0=(e,n)=>e>=a0[n],ao=e=>{const{type:n,createdAt:a}=e,r=_t(a),o=new Date,i=r0(r,o);return o0(i,n)&&n!==Ft&&n!==Vt?"potentially-stale":"healthy"},ro=e=>{const{type:n,createdAt:a}=e;if(n===Ft||n===Vt)return;const r=_t(a),o=new Date,i=r0(r,o);if(o0(i,n)){const c=i-a0[n];return M4(o,c).toISOString()}},oo=({projectId:e,features:n})=>{const a=h1(),r=g1(a.breakpoints.down("sm")),o=g1(a.breakpoints.down("md")),i=g1(a.breakpoints.down("lg")),c=d.useMemo(()=>n.map(x=>({project:e,name:x.name,type:x.type,stale:x.stale,status:ao(x),lastSeenAt:x.lastSeenAt,createdAt:x.createdAt,expiredAt:ro(x)})),[e,n]),l=d.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt"}]}),[]),{headerGroups:h,rows:u,prepareRow:g,state:{globalFilter:f},setGlobalFilter:m,setHiddenColumns:b}=r1.useTable({columns:N3,data:c,initialState:l,sortTypes:Pe,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},r1.useGlobalFilter,r1.useFlexLayout,r1.useSortBy);f2([{condition:r,columns:["stale"]},{condition:o,columns:["expiredAt","lastSeenAt"]},{condition:i,columns:["createdAt"]}],b,N3);const S=u.length<c.length?`Feature toggles (${u.length} of ${c.length})`:`Feature toggles (${c.length})`;return s(p1,{header:t(s1,{title:S,actions:t(x1,{initialValue:f,onChange:m})}),children:[t(se,{value:f,children:t(g2,{headerGroups:h,prepareRow:g,rows:u})}),t(C,{condition:u.length===0,show:t(C,{condition:(f==null?void 0:f.length)>0,show:s(y1,{children:["No feature toggles found matching “",f,"”"]}),elseShow:t(y1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},N3=[{Header:"Seen",accessor:"lastSeenAt",sortType:"date",align:"center",Cell:Et,disableGlobalFilter:!0,maxWidth:85},{Header:"Type",accessor:"type",align:"center",Cell:Rt,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:vn,minWidth:120},{Header:"Created",accessor:"createdAt",sortType:"date",Cell:h2,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Qr,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:to,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:yn,disableGlobalFilter:!0,maxWidth:120}],io=()=>{const e=Q("projectId"),n=k1(e);T1(`Project health – ${n}`);const{healthReport:a,refetchHealthReport:r,error:o}=Lr(e,{refreshInterval:15*1e3});return a?s("div",{children:[t(C,{condition:Boolean(o),show:t(Ct,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:r,text:`Could not fetch health rating for ${e}`})}),t(Yr,{healthReport:a}),t(oo,{projectId:e,features:a.features})]}):null},so=p("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),co=()=>{const e=Q("projectId");return t(so,{children:t(bn,{title:"Event Log",project:e,displayInline:!0})})},i0=(e,n)=>{const{data:a,error:r,mutate:o}=ie(q1(`api/admin/projects/${e}/change-requests/${n}`),lo,{refreshInterval:15e3});return{data:a,loading:!r&&!a,refetchChangeRequest:()=>o(),error:r}},lo=e=>fetch(e).then(G1("Request changes")).then(n=>n.json()),po=p(F1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`})),uo=p(A)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)})),ho=p(A)(({theme:e})=>({display:"flex",alignItems:"center"})),mo=p(B)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),go=p(Cn)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),s0=p(Ie)(({theme:e})=>({height:"24px",width:"24px"})),fo=({changeRequest:e})=>{var n,a;return s(po,{elevation:0,children:[s(uo,{children:[s(mo,{variant:"h1",sx:{mr:1.5},children:["Change request #",e.id]}),t(Mt,{state:e.state})]}),s(ho,{children:[s(B,{variant:"body2",sx:{margin:"auto 0"},children:["Created"," ",t(n3,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),t(A,{sx:r=>({marginLeft:r.spacing(1)}),children:t(K1,{title:(n=e==null?void 0:e.createdBy)==null?void 0:n.username,children:t(s0,{src:(a=e==null?void 0:e.createdBy)==null?void 0:a.imageUrl})})}),t(A,{sx:r=>({marginLeft:r.spacing(1.5)}),children:t(go,{variant:"outlined",children:s(B,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",t(B,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",t(Sn,{})," Updates:"," ",s(B,{variant:"body2",display:"inline",fontWeight:"bold",component:"span",children:[e.features.length," ",e.features.length===1?"feature toggle":"feature toggles"]})]})})})]})]})};function o1(){return o1=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},o1.apply(this,arguments)}function ve(e,n){if(e==null)return{};var a={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(n.indexOf(o)>=0)&&(a[o]=e[o]);return a}const vo=d.createContext({}),Qe=vo;function yo(e){return pe("MuiTimeline",e)}J1("MuiTimeline",["root","positionLeft","positionRight","positionAlternate"]);const bo=["position","className"],Co=e=>{const{position:n,classes:a}=e,r={root:["root",n&&`position${Z1(n)}`]};return me(r,yo,a)},So=p("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:a}=e;return[n.root,a.position&&n[`position${Z1(a.position)}`]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),wo=d.forwardRef(function(n,a){const r=ue({props:n,name:"MuiTimeline"}),{position:o="right",className:i}=r,c=ve(r,bo),l=o1({},r,{position:o}),h=Co(l),u=d.useMemo(()=>({position:o}),[o]);return t(Qe.Provider,{value:u,children:t(So,o1({className:he(h.root,i),ownerState:l,ref:a},c))})}),c0=wo;function xo(e){return pe("MuiTimelineContent",e)}const To=J1("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate"]),Ao=["className"],Eo=e=>{const{position:n,classes:a}=e,r={root:["root",`position${Z1(n)}`]};return me(r,xo,a)},Ro=p(B,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:a}=e;return[n.root,n[`position${Z1(a.position)}`]]}})(({ownerState:e})=>o1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),ko=d.forwardRef(function(n,a){const r=ue({props:n,name:"MuiTimelineContent"}),{className:o}=r,i=ve(r,Ao),{position:c}=d.useContext(Qe),l=o1({},r,{position:c||"right"}),h=Eo(l);return t(Ro,o1({component:"div",className:he(h.root,o),ownerState:l,ref:a},i))}),l0=ko,Po=J1("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate"]),Io=Po;function Zo(e){return pe("MuiTimelineItem",e)}const jo=J1("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","missingOppositeContent"]),d0=jo,Do=["position","className"],Oo=e=>{const{position:n,classes:a,hasOppositeContent:r}=e,o={root:["root",`position${Z1(n)}`,!r&&"missingOppositeContent"]};return me(o,Zo,a)},$o=p("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:a}=e;return[n.root,n[`position${Z1(a.position)}`]]}})(({ownerState:e})=>o1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},e.position==="alternate"&&{"&:nth-of-type(even)":{flexDirection:"row-reverse",[`& .${To.root}`]:{textAlign:"right"},[`& .${Io.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&:before":{content:'""',flex:1,padding:"6px 16px"}})),Bo=d.forwardRef(function(n,a){const r=ue({props:n,name:"MuiTimelineItem"}),{position:o,className:i}=r,c=ve(r,Do),{position:l}=d.useContext(Qe);let h=!1;d.Children.forEach(r.children,m=>{wn(m,["TimelineOppositeContent"])&&(h=!0)});const u=o1({},r,{position:o||l||"right",hasOppositeContent:h}),g=Oo(u),f=d.useMemo(()=>({position:u.position}),[u.position]);return t(Qe.Provider,{value:f,children:t($o,o1({className:he(g.root,i),ownerState:u,ref:a},c))})}),Ue=Bo;function _o(e){return pe("MuiTimelineSeparator",e)}J1("MuiTimelineSeparator",["root"]);const Fo=["className"],Vo=e=>{const{classes:n}=e;return me({root:["root"]},_o,n)},Mo=p("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,n)=>n.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),Lo=d.forwardRef(function(n,a){const r=ue({props:n,name:"MuiTimelineSeparator"}),{className:o}=r,i=ve(r,Fo),c=r,l=Vo(c);return t(Mo,o1({className:he(l.root,o),ownerState:c,ref:a},i))}),qe=Lo;function zo(e){return pe("MuiTimelineDot",e)}J1("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const Ho=["className","color","variant"],No=e=>{const{color:n,variant:a,classes:r}=e,o={root:["root",a,n!=="inherit"&&`${a}${Z1(n)}`]};return me(o,zo,r)},Wo=p("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:a}=e;return[n.root,n[a.color!=="inherit"&&`${a.variant}${Z1(a.color)}`],n[a.variant]]}})(({ownerState:e,theme:n})=>o1({display:"flex",alignSelf:"baseline",borderStyle:"solid",borderWidth:2,padding:4,borderRadius:"50%",boxShadow:(n.vars||n).shadows[1],margin:"11.5px 0"},e.variant==="filled"&&o1({borderColor:"transparent"},e.color!=="inherit"&&o1({},e.color==="grey"?{color:(n.vars||n).palette.grey[50],backgroundColor:(n.vars||n).palette.grey[400]}:{color:(n.vars||n).palette[e.color].contrastText,backgroundColor:(n.vars||n).palette[e.color].main})),e.variant==="outlined"&&o1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&o1({},e.color==="grey"?{borderColor:(n.vars||n).palette.grey[400]}:{borderColor:(n.vars||n).palette[e.color].main})))),Uo=d.forwardRef(function(n,a){const r=ue({props:n,name:"MuiTimelineDot"}),{className:o,color:i="grey",variant:c="filled"}=r,l=ve(r,Ho),h=o1({},r,{color:i,variant:c}),u=No(h);return t(Wo,o1({className:he(u.root,o),ownerState:h,ref:a},l))}),p0=Uo;function qo(e){return pe("MuiTimelineConnector",e)}J1("MuiTimelineConnector",["root"]);const Go=["className"],Ko=e=>{const{classes:n}=e;return me({root:["root"]},qo,n)},Jo=p("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),Yo=d.forwardRef(function(n,a){const r=ue({props:n,name:"MuiTimelineConnector"}),{className:o}=r,i=ve(r,Go),c=r,l=Ko(c);return t(Jo,o1({className:he(l.root,o),ownerState:c,ref:a},i))}),v3=Yo,Qo=p(F1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),Xo=p(A)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),e5=p(c0)(()=>({[`& .${d0.root}:before`]:{flex:0,padding:0}})),t5=({state:e})=>{const n=r=>["Draft","In review","Approved","Applied"].map(i=>({title:i,active:i===r}));return t(Qo,{elevation:0,children:t(Xo,{children:t(e5,{children:(()=>{const r=n(e),o=r.findIndex(c=>c.active),i=o!==-1?o:null;return e==="Cancelled"?a5(r):n5(r,i)})()})})})},n5=(e,n)=>e.map(({title:a},r)=>{const o=r<e.length-1,i=t(C,{condition:o,show:t(v3,{})});return n!==null&&n>=r?Ge("success",a,i):n!==null&&n+1===r?Ge("primary",a,i,{variant:"outlined"}):Ge("grey",a,i)}),a5=e=>e.map(({title:n},a)=>{const r=a<e.length-1;return Ge("grey",n,t(C,{condition:r,show:t(v3,{})}))}),Ge=(e,n,a,r={})=>s(Ue,{children:[s(qe,{children:[t(p0,{color:e,...r}),a]}),t(l0,{children:n})]},n),r5=p(A)(({theme:e})=>({marginBottom:e.spacing(2)})),o5=({actualApprovals:e,minApprovals:n})=>s(G,{children:["Reviewers"," ",s(B,{component:"span",color:"text.secondary",children:["(",e,"/",n," required)"]})]}),i5=({header:e,children:n})=>s(F1,{elevation:0,sx:a=>({marginTop:a.spacing(2),padding:a.spacing(4),borderRadius:r=>`${r.shape.borderRadiusLarge}px`}),children:[t(r5,{children:e}),t(B,{variant:"body1",color:"text.secondary",children:t(C,{condition:Ae.Children.count(n)>0,show:"Approved by",elseShow:"No approvals yet"})}),n]}),y3=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",re=p(A)(({theme:e})=>({display:"flex",alignItems:"center"})),s5=p(Lt)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),W3=p(Lt)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),N2=p(zt)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),c5=p(A)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),l5=p(A,{shouldForwardProp:y3()})(({theme:e,bgColor:n,svgColor:a})=>({borderRadius:`${e.shape.borderRadiusMedium}px`,backgroundColor:n,padding:e.spacing(1,2),marginRight:e.spacing(2),height:"45px",width:"45px",display:"flex",alignItems:"center",justifyContent:"center",svg:{color:a}})),u0=p(wt)(({theme:e})=>({margin:e.spacing(2.5,0)})),d5=p(A,{shouldForwardProp:y3()})(({theme:e,border:n})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:n,padding:e.spacing(3),width:"100%"})),oe=p(B,{shouldForwardProp:y3()})(({theme:e,color:n})=>({fontWeight:"bold",color:n})),p5=(e,n)=>e==="Approved"?`2px solid ${n.palette.success.main}`:e==="Applied"?`2px solid ${n.palette.primary.main}`:`1px solid ${n.palette.divider}`,u5=(e,n)=>e==="Approved"?{bgColor:n.palette.success.main,svgColor:n.palette.background.paper}:e==="Applied"?{bgColor:n.palette.primary.main,svgColor:n.palette.background.paper}:{bgColor:n.palette.background.elevation2,svgColor:n.palette.neutral.main},h5=({changeRequest:e})=>{const n=h1();return s(c5,{children:[t(l5,{...u5(e.state,n),children:t(xn,{style:{transform:"scale(1.5)"}})}),t(d5,{sx:{backgroundColor:e.state==="In review"?n.palette.warning.light:"initial"},border:p5(e.state,n),children:t(m5,{changeRequest:e})})]})},m5=({changeRequest:e})=>{const{state:n}=e;return n?n==="Approved"?t(g5,{}):n==="Applied"?t(v5,{}):n==="Cancelled"?t(y5,{}):t(f5,{minApprovals:e.minApprovals}):null},g5=()=>{const e=h1();return s(G,{children:[s(re,{children:[t(N2,{}),s(A,{children:[t(oe,{color:e.palette.success.dark,children:"Changes approved"}),t(B,{children:"One approving review from requested approvers"})]})]}),t(u0,{}),s(re,{children:[t(N2,{}),t(A,{children:t(oe,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},f5=({minApprovals:e})=>{const n=h1();return s(G,{children:[s(re,{children:[t(W3,{}),s(A,{children:[t(oe,{color:n.palette.warning.dark,children:"Review required"}),s(B,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),t(u0,{}),s(re,{children:[t(W3,{}),t(oe,{color:n.palette.warning.dark,children:"Apply changes is blocked"})]})]})},v5=()=>{const e=h1();return t(G,{children:s(re,{children:[t(N2,{sx:{color:e.palette.primary.main}}),t(A,{children:t(oe,{color:e.palette.primary.main,children:"Changes applied"})})]})})},y5=()=>{const e=h1();return t(G,{children:s(re,{children:[t(s5,{}),t(A,{children:t(oe,{color:e.palette.error.main,children:"Changes cancelled"})})]})})};var b3={},b5=le;Object.defineProperty(b3,"__esModule",{value:!0});var h0=b3.default=void 0,C5=b5(ce()),S5=de,w5=(0,C5.default)((0,S5.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");h0=b3.default=w5;const x5=({disabled:e})=>{const{isAdmin:n}=d.useContext(ge),a=Q("projectId"),r=Q("id"),{user:o}=Ht(),{refetchChangeRequest:i,data:c}=i0(a,r),{refetch:l}=a3(a),{setToastApiError:h,setToastData:u}=u1(),{changeState:g}=r3(),[f,m]=Ae.useState(!1),b=Ae.useRef(null),S=async()=>{try{await g(a,Number(r),{state:"Approved"}),i(),l(),u({type:"success",title:"Success",text:"Changes approved"})}catch(v){h(f1(v))}},x=()=>{m(v=>!v)},Z=v=>{b.current&&b.current.contains(v.target)||m(!1)};return s(Ae.Fragment,{children:[t(o3,{variant:"contained",disabled:e||(c==null?void 0:c.createdBy.id)===(o==null?void 0:o.id)&&!n,"aria-controls":f?"review-options-menu":void 0,"aria-expanded":f?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:x,ref:b,endIcon:t(h0,{}),permission:Tn,projectId:a,environmentId:c==null?void 0:c.environment,children:"Review changes"}),t(Dt,{sx:{zIndex:1},open:f,anchorEl:b.current,role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:v,placement:j})=>t(An,{...v,style:{transformOrigin:j==="bottom"?"center top":"center bottom"},children:t(F1,{className:"dropdown-outline",children:t(Ot,{onClickAway:Z,children:t(d2,{id:"review-options-menu",autoFocusItem:!0,children:t(H1,{onClick:S,children:"Approve changes"})})})})})})]})},T5=p(A)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),A5=p(zt)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),E5=({name:e,imageUrl:n})=>s(T5,{children:[t(s0,{src:n}),t(B,{variant:"body1",color:"text.primary",sx:{maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:e}),t(A5,{})]}),m0=p(Ie)(({theme:e})=>({height:"32px",width:"32px",marginTop:e.spacing(1),marginRight:e.spacing(2)})),R5=p(A)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),k5=p(F1)(({theme:e})=>({width:"100%",padding:e.spacing(1.5,3,2.5,3),backgroundColor:e.palette.neutral.light,borderRadius:e.shape.borderRadiusLarge,borderColor:e.palette.divider})),P5=p(A)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),I5=({comment:e})=>s(R5,{children:[t(K1,{title:e.createdBy.username,children:t(m0,{src:e.createdBy.imageUrl})}),s(k5,{variant:"outlined",children:[t(P5,{children:s(A,{children:[t("strong",{children:e.createdBy.username})," ",s(B,{color:"text.secondary",component:"span",children:["commented"," ",t(n3,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),t(A,{sx:{paddingTop:2.5},children:e.text})]})]}),Z5=p(A)(({theme:e})=>({display:"flex",marginTop:e.spacing(2),marginBottom:e.spacing(1)})),j5=({user:e,commentText:n,onTypeComment:a,children:r})=>s(G,{children:[s(Z5,{children:[t(K1,{title:(e==null?void 0:e.name)||(e==null?void 0:e.username),children:t(m0,{src:(e==null?void 0:e.imageUrl)||""})}),t(Je,{variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>a(o.target.value),value:n})]}),t(A,{sx:{display:"flex",justifyContent:"flex-end"},children:r})]}),D5=p(A)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),O5=p(F1)(({theme:e})=>({marginTop:e.spacing(2),marginLeft:e.spacing(2),width:"70%",padding:e.spacing(1,2),borderRadius:e.shape.borderRadiusLarge,[e.breakpoints.down("sm")]:{marginLeft:0,width:"100%"}})),$5=p(A)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),B5=p(A)(({theme:e})=>({padding:e.spacing(2)})),_5=p(A)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),F5=()=>{var F,N;const e=Q("projectId"),[n,a]=d.useState(!1),{user:r}=Ht(),{isAdmin:o}=d.useContext(ge),[i,c]=d.useState(""),l=Q("id"),{data:h,refetchChangeRequest:u}=i0(e,l),{changeState:g,addComment:f,loading:m}=r3(),{refetch:b}=a3(e),{setToastData:S,setToastApiError:x}=u1(),{isChangeRequestConfigured:Z}=u2(e);if(!h)return null;const v=Z(h.environment),j=async()=>{try{await g(e,Number(l),{state:"Applied"}),u(),b(),S({type:"success",title:"Success",text:"Changes applied"})}catch(_){x(f1(_))}},H=async()=>{try{await f(e,l,i),c(""),u(),S({type:"success",title:"Success",text:"Comment added"})}catch(_){x(f1(_))}},z=async()=>{try{await g(e,Number(l),{state:"Cancelled"}),a(!1),u(),b(),S({type:"success",title:"Success",text:"Changes cancelled"})}catch(_){x(f1(_))}},U=()=>a(!0),w=()=>a(!1),D=(h==null?void 0:h.createdBy.id)===(r==null?void 0:r.id)&&h.state==="In review"&&!o,O=h.approvals.some(_=>_.createdBy.id===(r==null?void 0:r.id));return s(G,{children:[t(fo,{changeRequest:h}),s(_5,{children:[s(D5,{children:[t(t5,{state:h.state}),t(i5,{header:t(o5,{actualApprovals:h.approvals.length,minApprovals:h.minApprovals}),children:(F=h.approvals)==null?void 0:F.map(_=>t(E5,{name:_.createdBy.username||"Unknown user",imageUrl:_.createdBy.imageUrl},_.createdBy.username))})]}),t(O5,{elevation:0,children:s(B5,{children:["Requested Changes (",En(h),")",t(Rn,{changeRequest:h,onRefetch:u}),(N=h.comments)==null?void 0:N.map(_=>t(I5,{comment:_},_.id)),t(j5,{user:r,commentText:i,onTypeComment:c,children:t(v1,{variant:"outlined",onClick:H,disabled:!v||i.trim().length===0||i.trim().length>1e3,children:"Comment"})}),t(C,{condition:D,show:t(U1,{sx:_=>({marginTop:_.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),t(h5,{changeRequest:h}),s($5,{children:[t(C,{condition:h.state==="In review"&&!O,show:t(x5,{disabled:!v})}),t(C,{condition:h.state==="Approved",show:t(o3,{variant:"contained",onClick:j,projectId:e,permission:kn,environmentId:h.environment,disabled:!v||m,children:"Apply changes"})}),t(C,{condition:h.state!=="Applied"&&h.state!=="Cancelled"&&(h.createdBy.id===(r==null?void 0:r.id)||o),show:t(v1,{sx:{marginLeft:_=>_.spacing(2)},variant:"outlined",onClick:U,children:"Cancel changes"})})]})]})}),s(ke,{open:n,onClick:z,onClose:w,title:"Cancel change request",children:[t(B,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),t(B,{variant:"body2",sx:_=>({color:_.palette.neutral.dark}),children:"The change request will be moved to closed, and it can't be applied anymore. Once cancelled, the change request can't be reopened."})]})]})]})},V5=({value:e})=>{const n=()=>e?t(Mt,{state:e}):null;return e?t(i1,{children:n()}):t(i1,{})},M5=({value:e})=>t(i1,{children:t(v2,{user:e,sx:{maxWidth:"30px",maxHeight:"30px",alignSelf:"left"}})}),L5=p("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),z5=({value:e,row:{original:n}})=>{const a=Q("projectId"),{id:r,features:o}=n,i=Pn(),c=`/projects/${a}/change-requests/${r}`;return e?s(i1,{sx:{minWidth:"200px"},children:[t(L5,{children:s(B,{component:"span",variant:"body2",color:i.palette.text.secondary,children:[t(e3,{component:R1,underline:"hover",to:c,sx:l=>({paddingTop:l.spacing(.2),marginRight:l.spacing(1),"&:hover":{textDecoration:"underline"}}),children:"Change request"}),`#${r}`]})}),s("span",{children:[`${o==null?void 0:o.length}`," ",o.length<=1?"update":"updates"]})]}):t(i1,{})},H5=xt()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(4),overflowX:"auto"}})),N5={id:"createdAt"},W5=p("div")({paddingLeft:0,paddingBottom:0}),U5=p(Ke)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),q5=({changeRequests:e=[],loading:n,projectId:a})=>{var Y,y;const{classes:r}=H5(),o=g1(In.breakpoints.down("md")),[i,c]=t3(),[l,h]=d.useState(i.get("search")||""),{value:u,setValue:g}=c2(`${a}:ProjectChangeRequest`,N5),[f,m]=d.useMemo(()=>{const T=e.filter(I=>I.state!=="Cancelled"&&I.state!=="Applied"),V=e.filter(I=>I.state==="Cancelled"||I.state==="Applied");return[T,V]},[e]),b=[{title:"Change requests",data:f},{title:"Closed",data:m}],[S,x]=d.useState(0),Z=d.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"id",Cell:z5},{Header:"By",accessor:"createdBy",maxWidth:50,canSort:!1,Cell:M5,align:"center"},{Header:"Submitted",accessor:"createdAt",searchable:!0,maxWidth:100,Cell:Ye,sortType:"alphanumeric"},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:i1},{Header:"Status",accessor:"state",searchable:!0,minWidth:150,width:150,Cell:V5}],[a]),{data:v,getSearchText:j,getSearchContext:H}=m2(Z,l,(Y=b[S])==null?void 0:Y.data),z=d.useMemo(()=>n?Zn:v,[v,n]),[U]=d.useState(()=>({sortBy:[{id:i.get("sort")||u.id,desc:i.has("order")?i.get("order")==="desc":u.desc}],hiddenColumns:[]})),{headerGroups:w,rows:D,state:{sortBy:O},prepareRow:F,setHiddenColumns:N,getTableProps:_,getTableBodyProps:K}=r1.useTable({columns:Z,data:z,initialState:U,sortTypes:Pe,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:i1}},r1.useSortBy);return f2([{condition:o,columns:["createdBy"]}],N,Z),d.useEffect(()=>{if(n)return;const T={};T.sort=O[0].id,O[0].desc&&(T.order="desc"),l&&(T.search=l),c(T,{replace:!0}),g(V=>({...V,id:O[0].id,desc:O[0].desc||!1}))},[n,O,l,c]),s(p1,{isLoading:n,bodyClass:r.bodyClass,headerClass:r.header,header:t(s1,{titleElement:t(W5,{children:t(i3,{value:(y=b[S])==null?void 0:y.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:b.map((T,V)=>t(U5,{label:`${T.title} (${T.data.length})`,value:T.title,onClick:()=>x(V)},T.title))})}),actions:t(x1,{initialValue:l,onChange:h,hasFilters:!0,getSearchContext:H})}),children:[t(se,{value:j(l),children:s(n2,{..._(),children:[t(a2,{headerGroups:w}),t(r2,{...K(),children:D.map(T=>(F(T),t(o2,{hover:!0,...T.getRowProps(),children:T.cells.map(V=>t(i2,{...V.getCellProps(),padding:"none",children:V.render("Cell")}))})))})]})}),t(C,{condition:D.length===0,show:()=>t(C,{condition:(l==null?void 0:l.length)>0,show:s(y1,{children:["No changes found matching “",l,"”"]}),elseShow:t(y1,{children:"None of the changes were submitted yet."})})})]})},G5=()=>{const e=Q("projectId"),n=k1(e),{isOss:a,isPro:r}=l1();T1(`Change requests – ${n}`);const{changeRequests:o,loading:i}=n0(e);return a()||r()?t(p1,{sx:{justifyContent:"center"},children:t(y2,{feature:"change-requests"})}):t(q5,{changeRequests:o,projectId:e,loading:i})};var q=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(q||{});const ye=(e,n={})=>{const a=q1(`api/admin/projects/${e}/access`),r=()=>fetch(a,{method:"GET"}).then(G1("project access")).then(f=>f.json()),o=`api/admin/projects/${e}/users`,{data:i,error:c}=ie(o,r,n),[l,h]=d.useState(!c&&!i),u=()=>{$t(o)};return d.useEffect(()=>{h(!c&&!i)},[i,c]),{access:d.useMemo(()=>{if(i)return K5({roles:i.roles,users:i.users.filter(({accountType:f})=>!f||f==="User"),serviceAccounts:i.users.filter(({accountType:f})=>f==="Service Account"),groups:(i==null?void 0:i.groups.map(f=>({...f,users:y4(f.users??[])})))??[]})},[i]),error:c,loading:l,refetchProjectAccess:u}},K5=e=>{const n=e.users||[],a=e.serviceAccounts||[],r=e.groups||[];return{...e,rows:[...n.map(o=>({entity:o,type:"USERS"})),...a.map(o=>({entity:o,type:"SERVICE ACCOUNTS"})),...r.map(o=>({entity:o,type:"GROUPS"}))]}},J5=p(p1)(({theme:e})=>({height:"100vh",overflow:"auto",padding:e.spacing(7.5,6),[e.breakpoints.down("md")]:{padding:e.spacing(4,2)},"& .header":{padding:e.spacing(0,0,2,0)},"& .body":{padding:e.spacing(3,0,0,0)},borderRadius:`${e.spacing(1.5,0,0,1.5)} !important`})),Y5=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),U3={id:"joinedAt"},Z2=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>t(i1,{children:t(v2,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:Ee,minWidth:100,searchable:!0},{id:"username",Header:"Username",accessor:e=>e.username||e.email,Cell:Ee,minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:h2,sortType:"date",maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>t(Ye,{value:e.seenAt,emptyText:"Never",title:n=>`Last login: ${n}`}),sortType:"date",maxWidth:150}],Q5=["imageUrl","name","joined","lastLogin"],X5=({open:e,setOpen:n,group:a,projectId:r,subtitle:o,onEdit:i,onRemove:c})=>{const l=h1(),h=g1(l.breakpoints.down("md")),[u]=d.useState(()=>({sortBy:[{id:U3.id,desc:U3.desc}]})),[g,f]=d.useState(""),{data:m,getSearchText:b,getSearchContext:S}=m2(Z2,g,(a==null?void 0:a.users)??[]),{headerGroups:x,rows:Z,prepareRow:v,setHiddenColumns:j}=r1.useTable({columns:Z2,data:m,initialState:u,sortTypes:Pe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},r1.useSortBy,r1.useFlexLayout);return f2([{condition:h,columns:Q5}],j,Z2),t(ne,{open:e,onClose:()=>{n(!1)},label:(a==null?void 0:a.name)||"Group",children:s(J5,{header:t(s1,{secondary:!0,titleElement:s(Y5,{children:[a==null?void 0:a.name," (",Z.length<m.length?`${Z.length} of ${m.length}`:m.length,")",t("span",{children:o})]}),actions:s(G,{children:[t(C,{condition:!h,show:s(G,{children:[t(x1,{initialValue:g,onChange:f,hasFilters:!0,getSearchContext:S}),t(s1.Divider,{})]})}),t(N1,{permission:E1,projectId:r,tooltipProps:{title:"Edit group access"},onClick:i,children:t(s3,{})}),t(N1,{permission:E1,projectId:r,tooltipProps:{title:"Remove group access"},onClick:c,children:t(c3,{})})]}),children:t(C,{condition:h,show:t(x1,{initialValue:g,onChange:f,hasFilters:!0,getSearchContext:S})})}),children:[t(se,{value:b(g),children:t(g2,{rows:Z,headerGroups:x,prepareRow:v})}),t(C,{condition:Z.length===0,show:t(C,{condition:(g==null?void 0:g.length)>0,show:s(y1,{children:["No users found matching “",g,"” in this group."]}),elseShow:t(y1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},ei=({permissions:e})=>t(G,{children:e==null?void 0:e.filter(n=>!n.environment).map(n=>n.displayName).sort().map(n=>t("p",{children:n},n))}),ti=({environment:e,permissions:n})=>t(G,{children:[...new Set(n.filter(a=>a.environment===e).map(a=>a.displayName))].sort().map(a=>t("p",{children:a},`${e}-${a}`))}),ni=p("div",{shouldForwardProp:e=>e!=="roleId"&&e!=="popover"&&e!=="sx"})(({theme:e,popover:n})=>({width:"100%",maxWidth:e.spacing(50),padding:e.spacing(3),backgroundColor:n?e.palette.background.paper:e.palette.neutral.light,color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,borderRadius:e.shape.borderRadiusMedium})),j2=p("div")(({theme:e})=>({"& p:last-child":{marginBottom:e.spacing(2)}})),q3=p("p")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.fontSizes.smallBody,fontWeight:e.fontWeight.bold,marginBottom:e.spacing(2)})),G3=p("p")(({theme:e})=>({color:e.palette.text.primary,fontSize:e.fontSizes.smallBody,marginBottom:e.spacing(1)})),g0=d.forwardRef(({roleId:e,projectId:n,className:a,sx:r,...o},i)=>{var f;const{role:c}=b4(e.toString()),{access:l}=ye(n),h=l==null?void 0:l.roles.find(m=>m.id===e),u=d.useMemo(()=>{var b;const m=new Set;return(b=c.permissions)==null||b.filter(S=>S.environment).forEach(S=>{m.add(S.environment)}),[...m].sort()},[c]),g=d.useMemo(()=>{var m;return(m=c.permissions)==null?void 0:m.filter(b=>!b.environment)},[c]);return t(ni,{className:a,sx:r,...o,ref:i,children:t(C,{condition:((f=c.permissions)==null?void 0:f.length)>0,show:s(G,{children:[t(C,{condition:Boolean(g==null?void 0:g.length),show:s(G,{children:[t(q3,{children:"Project permissions"}),t(j2,{children:t(ei,{permissions:c.permissions})})]})}),t(C,{condition:Boolean(u.length),show:s(G,{children:[t(q3,{children:"Environment permissions"}),u.map(m=>s("div",{children:[t(G3,{children:m}),t(j2,{children:t(ti,{environment:m,permissions:c.permissions})})]},m))]})})]}),elseShow:s(G,{children:[t(G3,{children:h==null?void 0:h.name}),t(j2,{children:h==null?void 0:h.description})]})})})}),ai=p("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),K3=p("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),J3=p("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),ri=p("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),oi=p(v1)(({theme:e})=>({marginLeft:e.spacing(3)})),ii=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),si=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),ci=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),C3=({selected:e,accesses:n,users:a,serviceAccounts:r,groups:o,roles:i})=>{const{uiConfig:c}=l1(),{flags:l}=c,h=l.UG?"user / group":"user",u=Q("projectId"),{refetchProjectAccess:g}=ye(u),{addAccessToProject:f,changeUserRole:m,changeGroupRole:b,loading:S}=s2(),x=Boolean(e),{setToastData:Z,setToastApiError:v}=u1(),j=_1(),H=[...o.filter(y=>x||!n.some(({entity:{id:T},type:V})=>y.id===T&&V===q.GROUP)).map(y=>({id:y.id,entity:y,type:q.GROUP})),...a.filter(y=>x||!n.some(({entity:{id:T},type:V})=>y.id===T&&V===q.USER)).sort((y,T)=>{const V=y.name||y.username||"",I=T.name||T.username||"";return V.localeCompare(I)}).map(y=>({id:y.id,entity:y,type:q.USER})),...r.filter(y=>x||!n.some(({entity:{id:T},type:V})=>y.id===T&&V===q.SERVICE_ACCOUNT)).sort((y,T)=>{const V=y.name||y.username||"",I=T.name||T.username||"";return V.localeCompare(I)}).map(y=>({id:y.id,entity:y,type:q.SERVICE_ACCOUNT}))],[z,U]=d.useState(()=>H.filter(({id:y,type:T})=>y===(e==null?void 0:e.entity.id)&&T===(e==null?void 0:e.type))),[w,D]=d.useState(i.find(({id:y})=>y===(e==null?void 0:e.entity.roleId))??null),O={users:z==null?void 0:z.filter(({type:y})=>y===q.USER||y===q.SERVICE_ACCOUNT).map(({id:y})=>({id:y})),groups:z==null?void 0:z.filter(({type:y})=>y===q.GROUP).map(({id:y})=>({id:y}))},F=async y=>{if(y.preventDefault(),!!Y)try{x?(e==null?void 0:e.type)===q.USER||(e==null?void 0:e.type)===q.SERVICE_ACCOUNT?await m(u,w.id,e.entity.id):(e==null?void 0:e.type)===q.GROUP&&await b(u,w.id,e.entity.id):await f(u,w.id,O),g(),j($1),Z({title:`${z.length} ${z.length===1?"access":"accesses"} ${x?"edited":"assigned"} successfully`,type:"success"})}catch(T){v(f1(T))}},N=()=>x?`curl --location --request ${x?"PUT":"POST"} '${c.unleashUrl}/api/admin/projects/${u}/${(e==null?void 0:e.type)===q.USER||(e==null?void 0:e.type)===q.SERVICE_ACCOUNT?"users":"groups"}/${e==null?void 0:e.entity.id}/roles/${w==null?void 0:w.id}' \\
|
|
3
3
|
--header 'Authorization: INSERT_API_KEY'`:`curl --location --request ${x?"PUT":"POST"} '${c.unleashUrl}/api/admin/projects/${u}/role/${w==null?void 0:w.id}/access' \\
|
|
4
4
|
--header 'Authorization: INSERT_API_KEY' \\
|