unleash-server 5.9.0 → 5.9.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/db/feature-tag-store.js +1 -1
- package/dist/lib/db/feature-tag-store.js.map +1 -1
- package/dist/lib/features/client-feature-toggles/client-feature-toggle-store.js +2 -2
- package/dist/lib/features/client-feature-toggles/client-feature-toggle-store.js.map +1 -1
- package/dist/lib/features/instance-stats/instance-stats-service.js +1 -1
- package/dist/lib/features/instance-stats/instance-stats-service.js.map +1 -1
- package/dist/lib/features/maintenance/maintenance-service.d.ts +1 -0
- package/dist/lib/features/maintenance/maintenance-service.d.ts.map +1 -1
- package/dist/lib/features/maintenance/maintenance-service.js +21 -3
- package/dist/lib/features/maintenance/maintenance-service.js.map +1 -1
- package/dist/lib/features/scheduler/scheduler-service.d.ts.map +1 -1
- package/dist/lib/features/scheduler/scheduler-service.js +2 -3
- package/dist/lib/features/scheduler/scheduler-service.js.map +1 -1
- package/dist/lib/routes/admin-api/config.js +1 -1
- package/dist/lib/routes/admin-api/config.js.map +1 -1
- package/dist/lib/services/version-service.d.ts +2 -3
- package/dist/lib/services/version-service.d.ts.map +1 -1
- package/dist/lib/services/version-service.js +13 -14
- package/dist/lib/services/version-service.js.map +1 -1
- package/dist/lib/services/version-service.test.js +3 -3
- package/dist/lib/services/version-service.test.js.map +1 -1
- package/dist/server-dev.js +1 -0
- package/dist/server-dev.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-DoQ1u8B6.js → AdvancedPlayground-FbP1gTKc.js} +1 -1
- package/frontend/build/static/{CreateProject-iLBz5afO.js → CreateProject-vjn1sh4D.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-NSAcrt7Z.js → FeatureArchiveDialog-ctoNJoqg.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-UhDepK_o.js → FeatureMetricsChart-ig6HN-Ms.js} +1 -1
- package/frontend/build/static/FeatureViewLazyExport-G75iq0Uc.js +25 -0
- package/frontend/build/static/{LazyAdminExport-w5iLam_A.js → LazyAdminExport-oCRFK_R5.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-iqGbEmyw.js → LazyProjectExport-Ul0xAhZq.js} +1 -1
- package/frontend/build/static/{LineChartComponent-rG1KLVNr.js → LineChartComponent-3-eT314R.js} +1 -1
- package/frontend/build/static/{NetworkOverview-7SCGp57r.js → NetworkOverview-d20eBsIq.js} +2 -2
- package/frontend/build/static/{NetworkTraffic-awTd8Zg5.js → NetworkTraffic-_52gjNiG.js} +1 -1
- package/frontend/build/static/{ReactJSONEditor-N-DWXE0h.js → ReactJSONEditor-0HyqnatD.js} +1 -1
- package/frontend/build/static/{RoleCell-mJ7DV61l.js → RoleCell--QIy8Oj_.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-wxQbaPXr.js → StrategyItemContainer-X6EIzBwJ.js} +1 -1
- package/frontend/build/static/{flowchart-elk-definition-170a3958-fa48ti80.js → flowchart-elk-definition-170a3958-XjUu-j5x.js} +1 -1
- package/frontend/build/static/{index-pAMHRYpv.js → index-UE-HeGu0.js} +1 -1
- package/frontend/build/static/{index-p2PlVFLf.js → index-uUGk-gee.js} +104 -104
- package/frontend/build/static/{is_dark-aAyqOy_I.js → is_dark-8v9B-WN0.js} +1 -1
- package/frontend/build/static/{mindmap-definition-44684416-AfCKDD9v.js → mindmap-definition-44684416-5sTvrm1Q.js} +1 -1
- package/frontend/build/static/{timeline-definition-8e5a9bc6-NKNlIEgm.js → timeline-definition-8e5a9bc6-MtFefIHV.js} +1 -1
- package/frontend/build/static/{unknownify-g-QgUElr.js → unknownify-joALjS6W.js} +1 -1
- package/frontend/build/static/{useApiTokens-hvnEZWgJ.js → useApiTokens-gCm2i_7X.js} +1 -1
- package/frontend/build/static/{useProjectForm-zqz6LJw4.js → useProjectForm-oXjjbjX3.js} +1 -1
- package/package.json +1 -1
- package/frontend/build/static/FeatureViewLazyExport-SpKYIb_J.js +0 -25
package/frontend/build/static/{LazyProjectExport-iqGbEmyw.js → LazyProjectExport-Ul0xAhZq.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Q1,j as t,eK as U0,eL as w6,eM as G0,s as d,cT as J0,cQ as i2,a5 as L3,r as s,eN as K0,ab as Q,a3 as t1,a6 as F3,a7 as P3,a8 as R3,a9 as I3,v as Z5,b7 as E1,J as h1,aN as U1,aO as L1,aP as F1,eO as E6,aE as W,eP as X1,ch as Z1,b as o1,cL as P1,az as e3,ax as a1,eQ as Y0,ae as x2,d8 as y5,eR as _6,eS as j1,au as X,ao as T1,at as n1,C as S,aK as v1,aq as l3,ap as g1,cO as Q0,ai as b5,eT as X0,T as k,c4 as C3,B as V,X as e7,aM as t7,ah as Y1,bp as a7,al as j2,a as r1,ac as m1,a_ as d3,eU as c7,y as O1,x as D1,eV as M6,P as H6,eW as A6,z as n7,eX as r7,ba as t3,bb as a3,t as S1,bg as k6,a1 as B3,bW as O3,M as H1,eY as s3,b3 as A1,d as Z2,eZ as s7,b5 as k1,e_ as z1,cW as V5,cX as T6,aJ as y2,c_ as o7,D as D6,l as S5,e$ as i7,aj as f1,h as d1,f0 as l7,f1 as C7,bJ as d7,f as c1,c5 as h7,bU as b2,c6 as L6,aV as V2,aW as S2,f2 as w5,dF as E5,ci as h3,ay as R1,f3 as u7,cP as m7,c9 as _5,am as w2,cC as N1,f4 as p7,f5 as v7,cH as _3,cK as m4,f6 as g7,cI as q2,f7,cJ as x7,f8 as p4,f9 as j7,fa as Z7,fb as y7,fc as b7,cR as V7,fd as v4,fe as S7,ff as w7,fg as E7,fh as F6,fi as _7,dq as E2,fj as M7,fk as H7,fl as A7,fm as k7,fn as T7,fo as D7,aQ as M5,fp as H5,fq as h5,a0 as L7,cU as P6,fr as F7,c0 as R6,fs as I6,ft as B6,fu as P7,fv as R7,fw as I7,a4 as u3,af as m3,ag as _2,aG as B7,fx as O7,fy as $3,fz as $7,fA as O6,fB as z7,fC as N7,fD as p3,fE as c3,aH as M2,fF as v3,fG as g3,_ as C1,fH as f3,fI as x3,fJ as W7,b_ as H2,fK as A2,E as l2,c8 as A5,fL as $6,fM as q7,aL as z3,fN as U7,bs as $1,aw as z6,bI as G1,fO as G7,fP as J7,fQ as K7,k as N3,fR as k2,fS as Y7,fT as Q7,fU as X7,fV as e8,dV as k5,dW as C2,fW as t8,br as T5,cB as d2,ak as N6,dN as h2,an as D5,fX as a8,cZ as L5,dj as j3,cl as q1,aI as o3,bX as F5,dz as P5,A as W6,dc as c8,m as q6,n as U6,aD as W1,aA as Z3,fY as n8,fZ as r8,dD as e2,f_ as s8,f$ as o8,g0 as i8,g1 as U2,g2 as l8,g3 as C8,cj as y3,ck as J,g4 as d8,g5 as h8,g6 as g4,g7 as f4,g8 as G6,g9 as u8,u as T2,aB as m8,ga as p8,db as v8,gb as x4,gc as g8,gd as f8,ge as x8,gf as j8,gg as Z8,bm as y8,bn as b8,bO as V8,bP as S8,bQ as w8,bR as E8,R as _8,gh as M8,gi as H8,cb as A8,gj as k8,w as j4,cq as T8,gk as J6,gl as D8,gm as K6,gn as L8,bZ as F8,go as P8,gp as R8,gq as I8,ds as Z4,eE as B8,gr as O8,eH as $8,d3 as y4,d0 as z8,cS as Y6,eC as u5,gs as N8,dx as Q6,gt as i3,gu as G,gv as W8,gw as q8,gx as U8,gy as G8,cv as X6,gz as J8,G as s2,bu as K8,gA as Y8,gB as Q8,gC as X8}from"./index-p2PlVFLf.js";import{e as e0,W as b4,c as e9,b as t0,T as t9,d as a9,F as c9,V as n9,f as r9,a as s9,E as o9}from"./FeatureArchiveDialog-NSAcrt7Z.js";import{i as i9,m as l9,j as V4,b as C9,c as d9,d as h9,e as u9,E as m9,f as p9,u as v9,a as g9,R as f9,C as x9,A as j9,g as a0}from"./RoleCell-mJ7DV61l.js";import{S as Z9}from"./StrategyItemContainer-wxQbaPXr.js";import{C as y9,u as b9,P as V9,D as S9}from"./useProjectForm-zqz6LJw4.js";const w9=Q1(t.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),E9=Q1(t.jsx("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),_9=Q1(t.jsx("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),M9=Q1(t.jsx("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"),H9=Q1(t.jsx("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),A9=Q1([t.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},"0"),t.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"Schedule"),k9=Q1(t.jsx("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function T9(e,a){U0(2,arguments);var c=G0(a);return w6(e,-c)}const S4=d("div")(()=>({display:"flex"})),D9=d("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));d("div")(()=>({display:"flex",flexDirection:"column"}));const L9=d("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),F9=d("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));d(F9)(({theme:e})=>({color:e.palette.neutral.dark}));const P9=d(J0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),R9=d("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),I9=d("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),B9=d("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),O9=d("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),$9=d("div")(({theme:e})=>({padding:e.spacing(0,4)})),z9=d(i2)(({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}})),N9=e=>e.reduce((a,c)=>c.enabled?a+1:a,0),W9=d(L3)(({theme:e})=>({marginTop:e.spacing(3)})),q9=d("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:a})=>({color:a?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),U9=({environment:e,warnEnabledToggles:a})=>{const c=s.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:h}})=>t.jsx(K0,{environment:h})},{Header:"Name",accessor:"name",Cell:Q},{Header:"Type",accessor:"type",Cell:Q},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:h})=>t.jsx(Q,{children:t.jsx(q9,{warning:h>0,children:h===1?"1 toggle":`${h} toggles`})}),align:"center"}],[a]),{getTableProps:n,getTableBodyProps:r,headerGroups:o,rows:i,prepareRow:l}=t1.useTable({columns:c,data:[e],disableSortBy:!0});return t.jsxs(W9,{...n(),rowHeight:"compact",children:[t.jsx(F3,{headerGroups:o}),t.jsx(P3,{...r(),children:i.map(h=>(l(h),t.jsx(R3,{hover:!0,...h.getRowProps(),children:h.cells.map(C=>t.jsx(I3,{...C.getCellProps(),children:C.render("Cell")}))})))})]})},G9=d("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),J9=d(Z5)(()=>({width:"100%"})),K9=({environment:e,open:a,setOpen:c,onConfirm:n})=>{const[r,o]=s.useState("");return s.useEffect(()=>{o("")},[a]),t.jsxs(E1,{title:"Hide environment and disable feature toggles?",open:a,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==r,secondaryButtonText:"Close",onClick:n,onClose:()=>{c(!1)},children:[t.jsxs(h1,{severity:"error",children:[t.jsx("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.jsx(U9,{environment:e}),t.jsxs(G9,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",t.jsx("strong",{children:e==null?void 0:e.name})]}),t.jsx(J9,{label:"Environment name",value:r,onChange:i=>o(i.target.value)})]})},Y9=e=>{const{data:a,error:c,mutate:n}=U1(L1(`api/admin/environments/project/${e}`),Q9),r=s.useMemo(()=>a||[],[a]),o=s.useCallback(async()=>{await n()},[n]);return{environments:r,refetchEnvironments:o,loading:!c&&!a,error:c}},Q9=async e=>(await fetch(e).then(F1("Environments")).then(c=>c.json())).environments.sort((c,n)=>c.sortOrder-n.sortOrder),X9=d(h1)(({theme:e})=>({marginBottom:e.spacing(4)})),ee=d("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),te=d(E6)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),c0=()=>{const e=W("projectId"),a=X1(e);Z1(`Project environments – ${a}`);const{setToastData:c,setToastApiError:n}=o1(),{environments:r,loading:o,error:i,refetchEnvironments:l}=Y9(e),{project:h,refetch:C}=P1(e),{removeEnvironmentFromProject:u,addEnvironmentToProject:m}=e3(),[p,j]=s.useState(),[g,y]=s.useState(!1),{isOss:v}=a1(),f=s.useMemo(()=>r.map(M=>({...M,projectVisible:h==null?void 0:h.environments.map(N=>N.environment).includes(M.name)})),[r,h==null?void 0:h.environments]),E=()=>{l(),C()},b=()=>t.jsx(te,{onClick:E,text:"Error fetching environments"}),L=M=>`Got an API error when trying to set the environment as ${M?"visible":"hidden"}`,I=async M=>{if(M.projectVisible){if(N9(f)>1){j(M),y(!0);return}c({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await m(e,M.name),E(),c({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{n(L(!0))}},_=async()=>{if(p)try{await u(e,p.name),E(),c({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{n(L(!1))}finally{y(!1)}},F=M=>v()&&M==="default",w=s.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:M}})=>t.jsx(Y0,{environment:M})},{Header:"Type",accessor:"type",Cell:x2},{Header:"Project API tokens",accessor:M=>M.projectApiTokenCount===1?"1 token":`${M.projectApiTokenCount} tokens`,Cell:Q},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:M}})=>t.jsx(y5,{children:t.jsx(_6,{tooltip:M.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:F(M.name),projectId:e,permission:j1,checked:M.projectVisible,onChange:()=>I(M)})}),disableGlobalFilter:!0}],[f]),{getTableProps:O,getTableBodyProps:B,headerGroups:z,rows:A,prepareRow:P,state:{globalFilter:x},setGlobalFilter:Z}=t1.useTable({columns:w,data:f,disableSortBy:!0},t1.useGlobalFilter),R=t.jsx(X,{title:`Environments (${A.length})`,actions:t.jsx(T1,{initialValue:x,onChange:Z})});return t.jsx(n1,{header:R,isLoading:o,children:t.jsxs(ee,{children:[t.jsx(S,{condition:!!i,show:b()}),t.jsxs(X9,{severity:"info",children:[t.jsx("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.jsx(v1,{to:"/admin/api",children:"API tokens here"}),".",t.jsx("br",{}),t.jsx("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",t.jsx(v1,{to:"/admin/api",children:"create a new API token here"}),"."]}),t.jsx(l3,{value:x,children:t.jsxs(L3,{...O(),rowHeight:"compact",children:[t.jsx(F3,{headerGroups:z}),t.jsx(P3,{...B(),children:A.map(M=>(P(M),t.jsx(R3,{hover:!0,...M.getRowProps(),children:M.cells.map(N=>t.jsx(I3,{...N.getCellProps(),children:N.render("Cell")}))})))})]})}),t.jsx(S,{condition:A.length===0,show:t.jsx(S,{condition:(x==null?void 0:x.length)>0,show:t.jsxs(g1,{children:["No environments found matching “",x,"”"]}),elseShow:t.jsx(g1,{children:"No environments available. Get started by adding one."})})}),t.jsx(K9,{environment:p,open:g,setOpen:y,onConfirm:_})]})})},ae={id:"archivedAt"},ce=({projectId:e})=>{const{archivedFeatures:a,loading:c,refetchArchived:n}=Q0(e),{value:r,setValue:o}=b5(`${e}:ProjectFeaturesArchiveTable`,ae);return t.jsx(X0,{title:"Project archive",archivedFeatures:a||[],loading:c,storedParams:r,setStoredParams:o,refetch:n,projectId:e})},ne=()=>{const e=W("projectId"),a=X1(e);return Z1(`Project archive – ${a}`),t.jsx(ce,{projectId:e})},W3=d("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)}})),q3=d("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),R5=d("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),D2=({children:e,to:a})=>t.jsx(k,{"data-loading":!0,variant:"body2",textAlign:"center",sx:{paddingTop:c=>c.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:t.jsx(C3,{component:v1,to:a,children:e})}),re=d("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),se=d("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),oe=({projectId:e,health:a})=>t.jsxs(W3,{children:[t.jsx(q3,{"data-loading":!0,children:"Project health"}),t.jsxs(V,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:c=>c.spacing(2)},children:[t.jsx(se,{"data-loading":!0,children:t.jsx(e7,{percentage:a})}),t.jsxs(re,{"data-loading":!0,children:[a,"%"]})]}),t.jsx(D2,{to:`/projects/${e}/health`,children:"View project health"})]}),ie=d(R5)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),le=d("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}})),Ce=({type:e,Icon:a,count:c})=>{const n=r=>r.charAt(0).toUpperCase()+r.slice(1).replace("-"," ");return t.jsxs(le,{"data-loading":!0,children:[t.jsx(a,{fontSize:"small","data-loading":!0}),t.jsx("div",{children:n(e)}),t.jsx(ie,{children:c})]})},de=({featureTypeCounts:e})=>{const a=s.useMemo(()=>{var l,h,C,u,m;const c=((l=e.find(p=>p.type==="release"))==null?void 0:l.count)||0,n=((h=e.find(p=>p.type==="experiment"))==null?void 0:h.count)||0,r=((C=e.find(p=>p.type==="operational"))==null?void 0:C.count)||0,o=((u=e.find(p=>p.type==="kill-switch"))==null?void 0:u.count)||0,i=((m=e.find(p=>p.type==="permission"))==null?void 0:m.count)||0;return{release:c,experiment:n,operational:r,"kill-switch":o,permission:i}},[e]);return t.jsxs(W3,{sx:{padding:c=>c.spacing(3)},children:[t.jsx(q3,{"data-loading":!0,children:"Toggle types used"}),Object.keys(a).map(c=>t.jsx(Ce,{type:c,Icon:t7(c),count:a[c]},c))]})},he=d("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})),ue=({id:e,description:a})=>t.jsxs(W3,{children:[t.jsx(q3,{"data-loading":!0,children:"Project Meta"}),t.jsxs(he,{"data-loading":!0,children:[t.jsx(k,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",t.jsx("code",{"data-loading":!0,children:e||"__________"})]}),t.jsx(S,{condition:!!a,show:t.jsx(k,{"data-loading":!0,variant:"body2",sx:{marginTop:c=>c.spacing(1.5),marginBottom:0,textAlign:"left"},children:a})}),t.jsx(S,{condition:!a,show:t.jsx(D2,{to:`/projects/${e}/settings`,children:"Add description"})})]}),me=d(k)(({theme:e})=>({marginBottom:e.spacing(2.5)})),pe=d(V)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),G2=d(V)(({theme:e})=>({...Y1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),w4=d(k)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ve=d(k)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),ge=e=>e>0?t.jsx(E9,{sx:{color:"success.dark",height:20,width:20}}):t.jsx(k9,{sx:{color:"warning.dark",height:20,width:20}}),fe=e=>e>0?"success.dark":"warning.dark",A3=({title:e,boxText:a,change:c,percentage:n,children:r,customChangeElement:o})=>t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!!e,show:t.jsx(me,{"data-loading":!0,children:e})}),r,t.jsxs(V,{sx:{...Y1,justifyContent:"center",width:"auto"},children:[t.jsx(pe,{"data-loading":!0,children:a}),t.jsx(S,{condition:!!o,show:t.jsx(G2,{"data-loading":!0,children:o}),elseShow:t.jsx(S,{condition:c!==void 0&&c!==0,show:t.jsxs(G2,{"data-loading":!0,children:[t.jsxs(V,{sx:{...Y1},children:[ge(c),t.jsxs(ve,{color:fe(c),children:[c>0?"+":"",c,n?"%":""]})]}),t.jsx(w4,{children:"this month"})]}),elseShow:t.jsx(G2,{children:t.jsx(w4,{"data-loading":!0,children:"No change"})})})})]})]}),xe=({projectId:e,memberCount:a,change:c=0})=>{var o,i;const{uiConfig:n}=a1();let r="/admin/users";return(i=(o=n==null?void 0:n.versionInfo)==null?void 0:o.current)!=null&&i.enterprise&&(r=`/projects/${e}/settings/access`),t.jsxs(W3,{children:[t.jsx(q3,{"data-loading":!0,children:"Project members"}),t.jsx(V,{"data-loading":!0,sx:{display:"flex",justifyContent:"center"},children:t.jsx(A3,{boxText:`${a}`,change:c})}),t.jsx(D2,{"data-loading":!0,to:r,children:"View all members"})]})},je=e=>fetch(e).then(F1("ChangeRequest")).then(a=>a.json()),n0=e=>{const{data:a,error:c,mutate:n}=a7([],L1(`api/admin/projects/${e}/change-requests`),je);return s.useMemo(()=>({changeRequests:a,loading:!c&&!a,refetch:n,error:c}),[a,c,n])},o2="change-requests-widget",Ze=d(V)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),E4=d(V)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),_4=d(V)(({theme:e})=>({display:"flex",alignItems:"center"})),ye=d(R5)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),be=d(R5)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),M4=d(k)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),H4=()=>t.jsx(k,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":o2,children:"change requests"}),Ve=({projectId:e})=>{const{changeRequests:a,loading:c}=n0(e),n=j2(c,`[data-loading="${o2}"]`),r=a==null?void 0:a.filter(i=>(i==null?void 0:i.state)==="Approved").length,o=a==null?void 0:a.filter(i=>(i==null?void 0:i.state)==="In review").length;return t.jsxs(W3,{ref:n,children:[t.jsx(q3,{children:"Open change requests"}),t.jsxs(Ze,{children:[t.jsxs(E4,{sx:{background:i=>i.palette.success.light},children:[t.jsx(M4,{children:"To be applied"}),t.jsxs(_4,{children:[t.jsx(ye,{"data-loading":o2,children:r||0})," ",t.jsx(H4,{})]})]}),t.jsxs(E4,{sx:{background:i=>i.palette.secondary.light},children:[t.jsx(M4,{children:"To be reviewed"}),t.jsxs(_4,{children:[t.jsx(be,{"data-loading":o2,children:o||0})," ",t.jsx(H4,{})]})]})]}),t.jsx(D2,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},Se=d(V)(({theme:e})=>({...Y1,width:"225px",flexDirection:"column",gap:e.spacing(2),boxShadow:"none",[e.breakpoints.down("md")]:{display:"grid",width:"100%",alignItems:"stretch"},[e.breakpoints.down("sm")]:{display:"flex"}})),we=({id:e,description:a,memberCount:c,health:n,featureTypeCounts:r,stats:o})=>{const{isEnterprise:i}=a1(),l=r1(),h=m1(l.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:C}=d3(e),u=i()&&C(),m=e!==c7,p=!u&&!m||h&&u&&m;return t.jsx("aside",{children:t.jsxs(Se,{sx:p?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[t.jsx(S,{condition:u,show:t.jsx(V,{sx:{gridColumnStart:m?"span 2":"span 1",flex:1,display:"flex"},children:t.jsx(Ve,{projectId:e})})}),t.jsx(ue,{id:e,description:a}),t.jsx(oe,{projectId:e,health:n}),t.jsx(S,{condition:m,show:t.jsx(xe,{projectId:e,memberCount:c,change:o==null?void 0:o.projectMembersAddedCurrentWindow})}),t.jsx(de,{featureTypeCounts:r})]})})},Ee=d(O1)(({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})),A4=({children:e,id:a})=>{const[c,n]=s.useState(null),r=l=>n(l.currentTarget),o=()=>n(null),i=!!c;return t.jsxs(V,{sx:{position:"absolute",top:l=>l.spacing(.5),right:l=>l.spacing(.5)},children:[t.jsx(D1,{onClick:r,"aria-describedby":a,size:"small",children:t.jsx(M6,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),t.jsx(H6,{id:a,open:i,anchorEl:c,sx:l=>({zIndex:l.zIndex.tooltip}),children:t.jsx(A6,{onClickAway:o,children:t.jsxs(Ee,{elevation:3,children:[t.jsx(D1,{onClick:o,sx:{position:"absolute",right:4,top:4},children:t.jsx(n7,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),e,t.jsx(r7,{id:a,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},_e=d(V)(({theme:e})=>({display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(4, 1fr)",flexWrap:"wrap",[e.breakpoints.down("lg")]:{gridTemplateColumns:"repeat(2, 1fr)"},[e.breakpoints.down("sm")]:{flexDirection:"column"}})),t2=d(V)(({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)}})),Me=d(k)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),He=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:a,projectActivityCurrentWindow:c,projectActivityPastWindow:n,createdCurrentWindow:r,createdPastWindow:o,archivedCurrentWindow:i,archivedPastWindow:l}=e;return t.jsxs(_e,{children:[t.jsx(t2,{children:t.jsx(A3,{title:"Total changes",boxText:String(c),change:c-n,children:t.jsx(A4,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),t.jsx(t2,{children:t.jsx(A3,{title:"Avg. time to production",boxText:t.jsxs(V,{sx:{display:"flex",alignItems:"center",gap:h=>h.spacing(1)},children:[a," ",t.jsx(k,{component:"span",children:"days"})]}),customChangeElement:t.jsx(Me,{children:"In project life"}),percentage:!0,children:t.jsx(A4,{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.jsx(t2,{children:t.jsx(A3,{title:"Features created",boxText:String(r),change:r-o})}),t.jsx(t2,{children:t.jsx(A3,{title:"Features archived",boxText:String(i),change:i-l})})]})};var I5={},Ae=a3;Object.defineProperty(I5,"__esModule",{value:!0});var r0=I5.default=void 0,ke=Ae(t3()),Te=t,De=(0,ke.default)((0,Te.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd");r0=I5.default=De;var B5={},Le=a3;Object.defineProperty(B5,"__esModule",{value:!0});var s0=B5.default=void 0,Fe=Le(t3()),Pe=t,Re=(0,Fe.default)((0,Pe.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");s0=B5.default=Re;var O5={},Ie=a3;Object.defineProperty(O5,"__esModule",{value:!0});var o0=O5.default=void 0,Be=Ie(t3()),Oe=t,$e=(0,Be.default)((0,Oe.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");o0=O5.default=$e;const ze=d(V)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),Ne=({projectId:e,row:a,onOpenArchiveDialog:c,onOpenStaleDialog:n})=>{const[r,o]=s.useState(null),[i,l]=s.useState(!1),{setToastData:h}=o1(),{original:{name:C,stale:u}}=a,m=!!r,p=f=>{o(f.currentTarget)},j=()=>{o(null)},g=`feature-${C}-actions`,y=`${g}-menu`,v=()=>{try{o7(C),l(!0),setTimeout(()=>{j(),l(!1)},1e3)}catch{h({type:"error",title:"Could not copy feature name"})}};return t.jsxs(ze,{children:[t.jsx(S1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:t.jsx(D1,{id:g,"data-loading":!0,"aria-controls":m?y:void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:p,type:"button",children:t.jsx(k6,{})})}),t.jsx(B3,{id:y,anchorEl:r,open:m,onClose:j,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:t.jsxs(O3,{"aria-labelledby":g,children:[t.jsxs(H1,{sx:s3,onClick:v,children:[t.jsx(A1,{children:i?t.jsx(Z2,{}):t.jsx(s7,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:i?"Copied!":"Copy Name"})})]}),t.jsx(z1,{projectId:e,permission:V5,children:({hasAccess:f})=>t.jsxs(H1,{sx:s3,onClick:j,disabled:!f,component:v1,to:`/projects/${e}/features/${C}/copy`,children:[t.jsx(A1,{children:t.jsx(r0,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Clone"})})]})}),t.jsx(z1,{projectId:e,permission:T6,children:({hasAccess:f})=>t.jsxs(H1,{sx:s3,onClick:()=>{c(C),j()},disabled:!f,children:[t.jsx(A1,{children:t.jsx(s0,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Archive"})})]})}),t.jsx(z1,{projectId:e,permission:y2,children:({hasAccess:f})=>t.jsxs(H1,{sx:s3,onClick:()=>{j(),n({featureId:C,stale:u===!0})},disabled:!f,children:[t.jsx(A1,{children:t.jsx(o0,{})}),t.jsx(k1,{children:t.jsxs(k,{variant:"body2",children:[u?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var $5={},We=a3;Object.defineProperty($5,"__esModule",{value:!0});var i0=$5.default=void 0,qe=We(t3()),Ue=t,Ge=(0,qe.default)((0,Ue.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");i0=$5.default=Ge;const Je=d(V)(()=>({...Y1,justifyContent:"center"})),Ke=d(D1)(({theme:e})=>({margin:e.spacing(-1,0)})),Ye=d(V)(({theme:e})=>({...Y1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),Qe=d(H1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),Xe=d(D6)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),et=d(S5)(({theme:e})=>({padding:e.spacing(.75,1)})),tt=({columns:e,onToggle:a})=>{const[c,n]=s.useState(null),r=C=>{n(C.currentTarget)},o=()=>{n(null)},i=!!c,l="columns-menu",h=`columns-menu-list-${l}`;return t.jsxs(Je,{children:[t.jsx(S1,{title:"Select columns",arrow:!0,describeChild:!0,children:t.jsx(Ke,{id:l,"aria-controls":i?h:void 0,"aria-haspopup":"true","aria-expanded":i?"true":void 0,onClick:r,type:"button",size:"large","data-loading":!0,children:t.jsx(i0,{})})}),t.jsxs(B3,{id:h,open:i,anchorEl:c,onClose:o,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:C=>({borderRadius:C.shape.borderRadius,paddingBottom:C.spacing(2)})},children:[t.jsxs(Ye,{children:[t.jsx(k,{variant:"body2",children:t.jsx("strong",{children:"Columns"})}),t.jsx(D1,{onClick:o,children:t.jsx(i7,{})})]}),t.jsx(O3,{children:e.map(C=>C.id==="divider"?t.jsx(Xe,{},"divider"):t.jsxs(Qe,{onClick:()=>{a==null||a(C.id)},disabled:C.isStatic===!0&&C.isVisible===!0,children:[t.jsx(A1,{children:t.jsx(et,{edge:"start",checked:C.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":C.id},size:"medium"})}),t.jsx(k1,{id:C.id,primary:t.jsx(k,{variant:"body2",children:C.header})})]},C.id))})]})]})},at=7,ct=e=>{const a=w6(new Date,-at);return!!(e!=null&&e.lastSeenAt&&l7(new Date(e.lastSeenAt),a))},nt=({projectId:e,featureIds:a,features:c,onConfirm:n})=>{const{refetch:r}=P1(e),[o,i]=s.useState(!1),{trackEvent:l}=f1(),h=s.useMemo(()=>a.filter(u=>{const m=c.find(p=>p.name===u);return ct(m)}),[JSON.stringify(c),a]),C=async()=>{i(!1),n==null||n(),await r(),l("batch_operations",{props:{eventType:"features archived"}})};return t.jsxs(t.Fragment,{children:[t.jsx(z1,{projectId:e,permission:T6,children:({hasAccess:u})=>t.jsx(d1,{disabled:!u||o,variant:"outlined",size:"small",onClick:()=>i(!0),children:"Archive"})}),t.jsx(e0,{projectId:e,featureIds:a,featuresWithUsage:h,onConfirm:C,isOpen:o,onClose:()=>i(!1)})]})},a2="selection-actions-menu",rt=({projectId:e,data:a,onChange:c})=>{const[n,r]=s.useState(null),{staleFeatures:o}=e3(),{setToastData:i,setToastApiError:l}=o1(),{trackEvent:h}=f1(),C=!!n,u=a.map(({name:f})=>f),m=f=>{r(f.currentTarget)},p=()=>{r(null)},j=a.some(({stale:f})=>f===!0),g=a.some(({stale:f})=>f===!1),y=async()=>{try{p(),await o(e,u),c==null||c(),i({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features staled"}})}catch(f){l(c1(f))}},v=async()=>{try{p(),await o(e,u,!1),c==null||c(),i({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){l(c1(f))}};return t.jsxs(t.Fragment,{children:[t.jsx(S1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t.jsx(D1,{id:a2,"aria-controls":C?a2:void 0,"aria-haspopup":"true","aria-expanded":C?"true":void 0,onClick:m,type:"button","data-testid":C7,children:t.jsx(d7,{})})}),t.jsx(B3,{id:`${a2}-menu`,anchorEl:n,open:C,onClose:p,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:t.jsx(O3,{"aria-labelledby":`${a2}-menu`,children:t.jsx(z1,{projectId:e,permission:y2,children:({hasAccess:f})=>t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:g,show:()=>t.jsxs(H1,{onClick:y,disabled:!f,sx:{borderRadius:E=>`${E.shape.borderRadius}px`},children:[t.jsx(A1,{children:t.jsx(b4,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Mark as stale"})})]})}),t.jsx(S,{condition:j,show:()=>t.jsxs(H1,{onClick:v,disabled:!f,sx:{borderRadius:E=>`${E.shape.borderRadius}px`},children:[t.jsx(A1,{children:t.jsx(b4,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},st=d("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),k4="manage-tags-form",T4=(e,a)=>[...e,...e.some(c=>c.value===a.value&&c.type===a.type)?[]:[a]],D4=(e,a)=>e.filter(c=>!(c.value===a.value&&c.type===a.type)),ot=(e,a)=>{switch(a.type){case"add":return{...e,addedTags:T4(e.addedTags,a.payload),removedTags:D4(e.removedTags,a.payload)};case"remove":return{...e,addedTags:D4(e.addedTags,a.payload),removedTags:T4(e.removedTags,a.payload)};case"clear":return{addedTags:[],removedTags:a.payload};default:return e}},L4={name:"",description:"",icon:""},it=({open:e,initialValues:a,initialIndeterminateValues:c,onCancel:n,onSubmit:r})=>{const{tagTypes:o,loading:i}=h7(),[l,h]=s.useState(L4),[C,u]=s.useState([]),[m,p]=s.useState([]),{tags:j,refetch:g}=e9(l.name),{createTag:y}=t0(),v=j.map(({value:w})=>({title:w})),[f,E]=s.useReducer(ot,{addedTags:[],removedTags:[]}),b=(w=o.length>0?o[0]:L4)=>{h(w);const O=c.filter(({type:B})=>B===w.name);u(a.filter(({type:B})=>B===w.name).filter(({type:B,value:z})=>!O.some(A=>A.value===z&&A.type===B)).map(({value:B})=>({title:B}))),p(O.map(({value:B})=>({title:B}))),E({type:"clear",payload:[]})};s.useEffect(()=>{o.length>0&&b()},[i]);const L=(w,O)=>{O!=null&&typeof O!="string"&&(w.preventDefault(),b(O))},I=(w,O)=>y({value:w,type:O}).then(async()=>{await g(),u(B=>[...B,{title:w}]),E({type:"add",payload:{value:w,type:O}})}),_=(w,O,B,z)=>{B==="selectOption"?O.forEach(A=>{if(typeof A!="string"&&typeof A.inputValue=="string"&&A.inputValue&&A.title.startsWith("Create new value"))return I(A.inputValue,l.name);u(O),p(P=>P.filter(({title:x})=>x!==A.title)),z!=null&&z.option&&E({type:"add",payload:{value:z.option.title,type:l.name}})}):B==="clear"?(u([]),E({type:"clear",payload:a})):B==="removeOption"&&(u(O),z!=null&&z.option&&E({type:"remove",payload:{value:z.option.title,type:l.name}}))},F=()=>{b(),n()};return t.jsxs(E1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature toggle tags",onClick:()=>r(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:F,formId:k4,children:[t.jsx(k,{paragraph:!0,sx:{marginBottom:w=>w.spacing(2.5)},children:"Tags allow you to group features together"}),t.jsx("form",{id:k4,onSubmit:()=>r(f),children:t.jsxs(st,{children:[t.jsx(t9,{options:o,disabled:i||o.length===0,value:l,onChange:L},i?"loading":o.length),t.jsx(S,{condition:!i&&o.length===0,show:t.jsxs(k,{variant:"body1",children:["No"," ",t.jsx(C3,{component:v1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t.jsx(a9,{disabled:i,options:v,existingTags:a,indeterminateOptions:m,tagType:l,selectedOptions:C,onChange:_})})]})})]})},lt=({projectId:e,data:a,onChange:c})=>{const{bulkUpdateTags:n}=t0(),{setToastData:r,setToastApiError:o}=o1(),{trackEvent:i}=f1(),[l,h]=s.useState(!1),[C,u]=s.useMemo(()=>{const p=a.flatMap(({tags:g})=>g||[]).reduce((g,y)=>[...g,...g.some(v=>v.type===y.type&&v.value===y.value)?[]:[y]],[]),j=p.filter(g=>!a.every(({tags:y})=>y==null?void 0:y.some(v=>v.type===g.type&&v.value===g.value)));return[p,j]},[a]),m=async({addedTags:p,removedTags:j})=>{const g=a.map(({name:v})=>v),y={features:g,tags:{addedTags:p,removedTags:j}};try{await n(y,e);const v=p.length?`Added tags: ${p.map(({type:E,value:b})=>`${E}:${b}`).join(", ")}.`:"",f=j.length?`Removed tags: ${j.map(({type:E,value:b})=>`${E}:${b}`).join(", ")}.`:"";r({title:"Tags updated",text:`${g.length} feature toggles updated. ${v} ${f}`,type:"success",autoHideDuration:12e3}),i("batch_operations",{props:{eventType:"tags updated"}})}catch(v){o(c1(v))}c==null||c(),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(z1,{projectId:e,permission:y2,children:({hasAccess:p})=>t.jsx(d1,{disabled:!p||l,variant:"outlined",size:"small",onClick:()=>h(!0),children:"Tags"})}),t.jsx(it,{open:l,onCancel:()=>h(!1),onSubmit:m,initialValues:C,initialIndeterminateValues:u},a.length)]})},Ct=d(b2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),F4=d(h1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),dt=({showExportDialog:e,data:a,onClose:c,onConfirm:n,environments:r,projectId:o})=>{const[i,l]=s.useState(r[0]),{bulkToggleFeaturesEnvironmentOff:h}=L6(),{addChange:C}=V2(),{refetch:u}=P1(o),{setToastApiError:m,setToastData:p}=o1(),{isChangeRequestConfigured:j}=d3(o),{refetch:g}=S2(o),y=a.filter(b=>{var L,I;return((I=(L=b.environments)==null?void 0:L.find(_=>i===_.name))==null?void 0:I.enabled)===!1}).length,v=()=>r.map(b=>({key:b,label:b})),f=async()=>{try{j(i)?(await C(o,i,a.map(b=>({action:"updateEnabled",feature:b.name,payload:{enabled:!1}}))),g(),p({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(o,a.map(b=>b.name),i),u(),p({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),c(),n==null||n()}catch(b){m(c1(b))}},E=j(i)?"Add to change request":"Disable toggles";return t.jsx(E1,{open:e,title:"Disable feature toggles",onClose:c,onClick:f,primaryButtonText:E,secondaryButtonText:"Cancel",children:t.jsxs(V,{children:["You have selected ",t.jsx("b",{children:a.length})," feature toggles to disable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx(k,{children:"Select which environment to disable the features for:"}),t.jsx(Ct,{options:v(),value:i,onChange:b=>l(b)}),t.jsx(S,{condition:j(i),show:t.jsx(F4,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(S,{condition:y>0,show:t.jsxs(F4,{severity:"info",children:[y," feature"," ",y>1?"toggles are ":"toggle is ","already disabled."]})})]})})},ht=d(b2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),P4=d(h1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),ut=({showExportDialog:e,data:a,onClose:c,onConfirm:n,environments:r,projectId:o})=>{const[i,l]=s.useState(r[0]),{bulkToggleFeaturesEnvironmentOn:h}=L6(),{addChange:C}=V2(),{refetch:u}=P1(o),{setToastApiError:m,setToastData:p}=o1(),{isChangeRequestConfigured:j}=d3(o),{refetch:g}=S2(o),y=a.filter(b=>{var L,I;return((I=(L=b.environments)==null?void 0:L.find(_=>i===_.name))==null?void 0:I.enabled)===!0}).length,v=()=>r.map(b=>({key:b,label:b})),f=async()=>{try{j(i)?(await C(o,i,a.map(b=>({action:"updateEnabled",feature:b.name,payload:{enabled:!0}}))),g(),p({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(o,a.map(b=>b.name),i),u(),p({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),c(),n==null||n()}catch(b){m(c1(b))}},E=j(i)?"Add to change request":"Enable toggles";return t.jsx(E1,{open:e,title:"Enable feature toggles",onClose:c,onClick:f,primaryButtonText:E,secondaryButtonText:"Cancel",children:t.jsxs(V,{children:["You have selected ",t.jsx("b",{children:a.length})," feature toggles to enable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx(k,{children:"Select which environment to enable the features for:"}),t.jsx(ht,{options:v(),value:i,onChange:b=>l(b)}),t.jsx(S,{condition:j(i),show:t.jsx(P4,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(S,{condition:y>0,show:t.jsxs(P4,{severity:"info",children:[y," feature"," ",y>1?"toggles are ":"toggle is ","already enabled."]})})]})})},mt=({selectedIds:e,data:a,projectId:c,onResetSelection:n,onChange:r})=>{var b,L;const{uiConfig:o}=a1(),[i,l]=s.useState(!1),[h,C]=s.useState(!1),[u,m]=s.useState(!1),{trackEvent:p}=f1(),j=s.useMemo(()=>a.filter(I=>e.includes(I.name)),[a,e]),g=s.useMemo(()=>{const I=j.flatMap(_=>_.environments).map(_=>_==null?void 0:_.name).filter(_=>_!==void 0);return Array.from(new Set(I))},[j]),y=()=>{r==null||r(),p("batch_operations",{props:{eventType:"features exported"}})},v=()=>{r==null||r(),p("batch_operations",{props:{eventType:"features enabled"}})},f=()=>{r==null||r(),p("batch_operations",{props:{eventType:"features disabled"}})},E=()=>{r==null||r(),n()};return t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!!((b=o==null?void 0:o.flags)!=null&&b.disableBulkToggle),show:null,elseShow:t.jsx(d1,{variant:"outlined",size:"small",onClick:()=>C(!0),children:"Enable"})}),t.jsx(S,{condition:!!((L=o==null?void 0:o.flags)!=null&&L.disableBulkToggle),show:null,elseShow:t.jsx(d1,{variant:"outlined",size:"small",onClick:()=>m(!0),children:"Disable"})}),t.jsx(nt,{projectId:c,featureIds:e,features:a,onConfirm:E}),t.jsx(d1,{variant:"outlined",size:"small",onClick:()=>l(!0),children:"Export"}),t.jsx(lt,{projectId:c,data:j,onChange:r}),t.jsx(rt,{projectId:c,data:j,onChange:r}),t.jsx(w5,{showExportDialog:i,data:j,onClose:()=>l(!1),environments:g,onConfirm:y}),t.jsx(ut,{showExportDialog:h,data:j,onClose:()=>C(!1),environments:g,projectId:c,onConfirm:v}),t.jsx(dt,{showExportDialog:u,data:j,onClose:()=>m(!1),environments:g,projectId:c,onConfirm:f})]})},pt=d(E5)(()=>({whiteSpace:"nowrap"})),vt=({isLoading:e,totalItems:a,searchQuery:c,onChangeSearchQuery:n,environmentsToExport:r,actions:o})=>{const i=W("projectId"),l=j2(e||!1),[h,C]=s.useState(!0),u=r1(),m=m1(u.breakpoints.down("md")),p=h3("featuresExportImport"),[j,g]=s.useState(!1),y=R1(),{trackEvent:v}=f1(),f=E=>{n==null||n(E),v("search-bar",{props:{screen:"project",length:E.length}})};return t.jsx(V,{ref:l,"aria-busy":e,"aria-live":"polite",sx:E=>({padding:`${E.spacing(2.5)} ${E.spacing(3.125)}`}),children:t.jsx(X,{titleElement:h?`Feature toggles ${a!==void 0?`(${a})`:""}`:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!m,show:t.jsx(T1,{"data-loading":!0,placeholder:"Search and Filter",expandable:!0,initialValue:c||"",onChange:f,onFocus:()=>C(!1),onBlur:()=>C(!0),hasFilters:!0,id:"projectFeatureToggles"})}),o,t.jsx(X.Divider,{sx:{marginLeft:0}}),t.jsx(S,{condition:p,show:t.jsxs(t.Fragment,{children:[t.jsx(S1,{title:"Export all project toggles",arrow:!0,children:t.jsx(D1,{"data-loading":!0,onClick:()=>g(!0),sx:E=>({marginRight:E.spacing(2)}),children:t.jsx(u7,{})})}),t.jsx(S,{condition:!e,show:t.jsx(w5,{showExportDialog:j,project:i,data:[],onClose:()=>g(!1),environments:r||[]})})]})}),t.jsx(pt,{onClick:()=>y(m7(i)),maxWidth:"960px",Icon:_5,projectId:i,permission:V5,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:t.jsx(S,{condition:m,show:t.jsx(T1,{initialValue:c||"",onChange:f,hasFilters:!0,id:"projectFeatureToggles"})})})})},l0=({row:e})=>t.jsx(w2,{title:e.original.name||"",subtitle:e.original.description||"",to:e.original.project&&e.original.name?`/projects/${e.original.project}/features/${e.original.name}`:void 0}),gt=d("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:a})=>({flexGrow:0,...Y1,justifyContent:"center",...a&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),ft=({value:e,featureId:a,projectId:c,environment:n,isChangeRequestEnabled:r,someEnabledEnvironmentHasVariants:o,refetch:i,onFeatureToggleSwitch:l})=>{const h=s.useMemo(()=>o&&(n==null?void 0:n.variantCount)===0&&(n==null?void 0:n.enabled),[o,n]),C=(u,m)=>{l(u,{projectId:c,featureId:a,environmentName:(n==null?void 0:n.name)||"",environmentType:n==null?void 0:n.type,hasStrategies:n==null?void 0:n.hasStrategies,hasEnabledStrategies:n==null?void 0:n.hasEnabledStrategies,isChangeRequestEnabled:r,onRollback:m,onSuccess:i})};return t.jsxs(gt,{hasWarning:h,children:[t.jsx(c9,{projectId:c,value:e,featureId:a,environmentName:(n==null?void 0:n.name)||"",onToggle:C}),t.jsx(S,{condition:h||!1,show:t.jsx(n9,{})})]})},xt=N1.memo(ft),jt=({state:e,onChange:a})=>{const{tags:c}=p7(),[n,r]=s.useState([]);return s.useEffect(()=>{const i=[{label:"Tags",icon:"label",options:(c||[]).map(l=>({label:`${l.type}:${l.value}`,value:`${l.type}:${l.value}`})),filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]}];r(i)},[JSON.stringify(c)]),t.jsx(v7,{availableFilters:n,state:e,onChange:a})},c2=["select","actions","name","favorite"],n2=(e,a)=>e.reduce((c,n)=>({...c,[n]:a.includes(n)}),{}),Zt=e=>{const a=r1(),c=m1(a.breakpoints.down("sm")),n=m1(a.breakpoints.down("md")),r=m1(a.breakpoints.down("lg")),o=s.useCallback((i=0)=>e.filter(l=>l.startsWith("environment:")!==!1).slice(0,i),[e]);return c?n2(e,[...c2,"createdAt"]):n?n2(e,[...c2,"createdAt",...o(1)]):r?n2(e,[...c2,"createdAt","type",...o(1)]):n2(e,[...c2,"lastSeenAt","createdAt","type","tags",...o(2)])},yt=({query:e})=>{var a;return((a=e||"")==null?void 0:a.length)>0?t.jsx(V,{sx:c=>({padding:c.spacing(3)}),children:t.jsxs(g1,{children:["No feature toggles found matching “",e,"”"]})}):t.jsx(V,{sx:c=>({padding:c.spacing(3)}),children:t.jsx(g1,{children:"No feature toggles available."})})},bt=(e,a)=>{const[c,n]=s.useState(),[r,o]=s.useState({});return{rowActionsDialogs:t.jsxs(t.Fragment,{children:[t.jsx(r9,{isStale:!!r.stale,isOpen:!!r.featureId,onClose:()=>{o({}),e()},featureId:r.featureId||"",projectId:a}),t.jsx(e0,{isOpen:!!c,onConfirm:e,onClose:()=>{n(void 0)},featureIds:[c||""],projectId:a})]}),setFeatureArchiveState:n,setFeatureStaleDialogState:o}},Vt=(e,a)=>{const[c,n]=s.useState([]);return s.useEffect(()=>{n(r=>{const o=[...e];return r.forEach(i=>{o.find(l=>l.name===i.name)||o.push(i)}),o.filter(i=>a[i.name])})},[e,a]),c},J2=e=>`environment:${e}`,B1=T7(),St=e=>e.name,wt=({environments:e,refreshInterval:a=15*1e3,storageKey:c="project-feature-toggles-v2"})=>{const n=W("projectId"),r=h3("featuresExportImport"),o={offset:_3(m4,0),limit:_3(m4,g7),query:q2,favoritesFirst:_3(f7,!0),sortBy:_3(q2,"createdAt"),sortOrder:_3(q2,"desc"),columns:x7,tag:p4,createdAt:p4},[i,l]=j7(`${c}-${n}`,o),h={tag:i.tag,createdAt:i.createdAt},{features:C,total:u,refetch:m,loading:p,initialLoad:j}=Z7(y7({...b7(o,i),project:`IS:${n}`},D=>D?`${D}`:void 0),{refreshInterval:a}),{favorite:g,unfavorite:y}=V7(),v=s.useCallback(async D=>{D!=null&&D.favorite?await y(n,D.name):await g(n,D.name),m()},[n,m]),{isChangeRequestConfigured:f}=d3(n),{onToggle:E,modals:b}=s9(n),{rowActionsDialogs:L,setFeatureArchiveState:I,setFeatureStaleDialogState:_}=bt(m,n),[F,w]=s.useState(!1),O=s.useMemo(()=>[B1.display({id:"select",header:({table:D})=>t.jsx(v4,{noPadding:!0,title:"Select all rows",checked:D==null?void 0:D.getIsAllRowsSelected(),onChange:D==null?void 0:D.getToggleAllRowsSelectedHandler()}),cell:({row:D})=>t.jsx(v4,{noPadding:!0,title:"Select row",checked:D==null?void 0:D.getIsSelected(),onChange:D==null?void 0:D.getToggleSelectedHandler()}),meta:{width:"1%"},enableHiding:!1}),B1.accessor("favorite",{id:"favorite",header:()=>t.jsx(S7,{isActive:i.favoritesFirst,onClick:()=>l({favoritesFirst:!i.favoritesFirst})}),cell:({row:{original:D}})=>t.jsx(w7,{value:D==null?void 0:D.favorite,onClick:()=>v(D)}),enableSorting:!1,enableHiding:!1,meta:{align:"center",width:"1%"}}),B1.accessor("lastSeenAt",{id:"lastSeenAt",header:"Last seen",cell:({row:{original:D}})=>t.jsx(E7,{feature:D,"data-loading":!0}),size:50,meta:{align:"center",width:"1%"}}),B1.accessor("type",{id:"type",header:"Type",cell:F6,meta:{align:"center",width:"1%"}}),B1.accessor("name",{id:"name",header:"Name",cell:l0,enableHiding:!1,meta:{width:"50%"}}),B1.accessor("tags",{id:"tags",header:"Tags",enableSorting:!1,cell:_7,meta:{width:"1%"}}),B1.accessor("createdAt",{id:"createdAt",header:"Created",cell:E2}),...e.map(D=>{const K=D.environment,y1=f(K);return B1.accessor(u1=>{var I1,i1;return{featureId:u1.name,environment:(I1=u1.environments)==null?void 0:I1.find(p1=>p1.name===K),someEnabledEnvironmentHasVariants:((i1=u1.environments)==null?void 0:i1.some(p1=>p1.variantCount&&p1.variantCount>0&&p1.enabled))||!1}},{id:J2(K),header:K,meta:{align:"center",width:90},cell:({getValue:u1})=>{const{featureId:I1,environment:i1,someEnabledEnvironmentHasVariants:p1}=u1();return t.jsx(xt,{value:(i1==null?void 0:i1.enabled)||!1,featureId:I1,someEnabledEnvironmentHasVariants:p1,environment:i1,projectId:n,environmentName:K,isChangeRequestEnabled:y1,refetch:m,onFeatureToggleSwitch:E})}})}),B1.display({id:"actions",header:"",cell:({row:D})=>t.jsx(Ne,{row:D,projectId:n,onOpenArchiveDialog:I,onOpenStaleDialog:_}),enableSorting:!1,enableHiding:!1,meta:{align:"right",width:"1%"}})],[n,e,i.favoritesFirst,m]),B=s.useMemo(()=>Array(i.limit).fill(null).map((D,K)=>({id:K,type:"-",name:`Feature name ${K}`,createdAt:new Date().toISOString(),environments:[{name:"production",enabled:!1},{name:"production",enabled:!1}]})),[i.limit]),z=!!(j||p&&u),A=j2(z),P=s.useMemo(()=>z?B:C,[z,C]),x=s.useMemo(()=>O.map(D=>D.id).filter(Boolean),[O]),Z=Zt(x),R=M7(H7(i,l,{columns:O,data:P,enableRowSelection:!0,state:{columnVisibility:Z},getRowId:St})),{columnVisibility:M,rowSelection:N}=R.getState(),T=s.useCallback(D=>{const K=M[D],y1={...M,[D]:!K};l({columns:Object.keys(y1).filter(u1=>y1[u1])})},[M,l]),U=Vt(C,N);return t.jsxs(t.Fragment,{children:[t.jsx(n1,{disableLoading:!0,disablePadding:!0,header:t.jsx(vt,{isLoading:j,totalItems:u,searchQuery:i.query||"",onChangeSearchQuery:D=>{l({query:D})},dataToExport:P,environmentsToExport:e.map(({environment:D})=>D),actions:t.jsx(tt,{columns:[{header:"Last seen",id:"lastSeenAt",isVisible:M.lastSeenAt},{header:"Type",id:"type",isVisible:M.type},{header:"Name",id:"name",isVisible:M.name,isStatic:!0},{header:"Tags",id:"tags",isVisible:M.tags},{header:"Created",id:"createdAt",isVisible:M.createdAt},{id:"divider"},...e.map(({environment:D})=>({header:D,id:J2(D),isVisible:M[J2(D)]}))],onToggle:T})}),bodyClass:"noop",style:{cursor:"inherit"},children:t.jsxs("div",{ref:A,"aria-busy":z,"aria-live":"polite",children:[t.jsx(jt,{onChange:l,state:h}),t.jsx(l3,{value:i.query||"",children:t.jsx(A7,{tableInstance:R,totalItems:u})}),t.jsx(S,{condition:!P.length&&!z,show:t.jsx(yt,{query:i.query||""})}),L,t.jsx(S,{condition:r&&!p,show:t.jsx(w5,{showExportDialog:F,data:P,onClose:()=>w(!1),environments:e.map(({environment:D})=>D)})}),b]})}),t.jsx(k7,{count:U.length,children:t.jsx(mt,{selectedIds:Object.keys(N),data:U,projectId:n,onResetSelection:R.resetRowSelection,onChange:m})})]})},Et=e=>{const a=()=>{const n=L1(`api/admin/projects/${e}/overview`);return fetch(n,{method:"GET"}).then(F1("Project overview")).then(r=>r.json())},c=`api/admin/projects/${e}/overview`;return{fetcher:a,KEY:c}},_t={featureTypeCounts:[],environments:[],name:"",health:0,members:0,version:"1",description:"Default",favorite:!1,mode:"open",defaultStickiness:"default",stats:{archivedCurrentWindow:0,archivedPastWindow:0,avgTimeToProdCurrentWindow:0,createdCurrentWindow:0,createdPastWindow:0,projectActivityCurrentWindow:0,projectActivityPastWindow:0,projectMembersAddedCurrentWindow:0}},z5=(e,a={})=>{const{KEY:c,fetcher:n}=Et(e),{data:r,error:o,mutate:i}=U1(c,n,a),l=s.useCallback(()=>{i()},[i]);return{project:r||_t,loading:!o&&!r,error:o,refetch:l}},U3=e=>z5(e).project.name||e,R4=15*1e3,Mt=d("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),[e.breakpoints.down("md")]:{flexDirection:"column"}})),Ht=d("div")(()=>({width:"100%",minWidth:0})),At=d(V)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),width:"100%",minWidth:0})),kt=({storageKey:e="project-overview-v2"})=>{const a=W("projectId"),c=U3(a),{project:n}=z5(a,{refreshInterval:R4});Z1(`Project overview – ${c}`);const{setLastViewed:r}=D7();s.useEffect(()=>{r(a)},[a,r]);const{members:o,featureTypeCounts:i,health:l,description:h,environments:C,stats:u}=n;return t.jsxs(Mt,{children:[t.jsx(we,{id:a,description:h,memberCount:o,health:l,featureTypeCounts:i,stats:u}),t.jsxs(At,{children:[t.jsx(He,{stats:n.stats}),t.jsx(Ht,{children:t.jsx(wt,{environments:C,refreshInterval:R4,storageKey:e})})]})]},a)},Tt=(e,a)=>{const c=L1(`api/admin/projects/${e}/health-report`),{data:n,error:r}=U1(c,Dt,a),o=s.useCallback(()=>{M5(c).catch(console.warn)},[c]);return{healthReport:n,refetchHealthReport:o,loading:!r&&!n,error:r}},Dt=e=>fetch(e).then(F1("Health report")).then(a=>a.json());var N5={},Lt=a3;Object.defineProperty(N5,"__esModule",{value:!0});var m5=N5.default=void 0,Ft=Lt(t3()),Pt=t,Rt=(0,Ft.default)((0,Pt.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");m5=N5.default=Rt;const It=d(V)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),I4=d(V)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Bt=d(O1)(({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)}})),K2=d("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1),justifyItems:"center",display:"flex"})),Ot=d("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),$t=d("p")(({theme:e})=>({color:e.palette.text.secondary})),B4=d("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),O4=d("p")(({theme:e})=>({marginLeft:e.spacing(4)})),zt=({healthReport:e})=>{const a=e.health<50?"error.main":e.health<75?"warning.main":"success.main",c=()=>t.jsxs(It,{children:[t.jsx(Z2,{}),t.jsxs("span",{children:[e.activeCount," active toggles"]})]}),n=()=>t.jsxs(I4,{children:[t.jsx(m5,{}),t.jsxs("span",{children:[e.staleCount," stale toggles"]})]}),r=()=>t.jsxs(I4,{children:[t.jsx(m5,{}),t.jsxs("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]}),o=()=>t.jsx(h5,{title:t.jsxs(t.Fragment,{children:["If your toggle exceeds the expected lifetime of it's toggle type it will be marked as potentially stale.",t.jsx(V,{sx:{mt:2},children:t.jsx("a",{href:"https://docs.getunleash.io/reference/technical-debt#stale-and-potentially-stale-toggles",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})})]}),children:t.jsx(L7,{sx:{color:i=>i.palette.text.secondary,ml:1}})});return t.jsxs(Bt,{children:[t.jsxs(V,{children:[t.jsx(K2,{children:"Health rating"}),t.jsx(S,{condition:e.health>-1,show:t.jsxs(t.Fragment,{children:[t.jsxs(Ot,{sx:{color:a},children:[e.health,"%"]}),t.jsxs($t,{children:["Last updated:"," ",t.jsx(H5,{date:e.updatedAt,live:!1})]})]})})]}),t.jsxs(V,{children:[t.jsx(K2,{children:"Toggle report"}),t.jsxs(B4,{children:[t.jsx("li",{children:t.jsx(S,{condition:!!e.activeCount,show:c})}),t.jsx(S,{condition:!!e.activeCount,show:t.jsx(O4,{children:"Also includes potentially stale toggles."})}),t.jsx("li",{children:t.jsx(S,{condition:!!e.staleCount,show:n})})]})]}),t.jsxs(V,{sx:{flexBasis:"40%"},children:[t.jsxs(K2,{children:["Potential actions"," ",t.jsx("span",{children:t.jsx(o,{})})]}),t.jsx(B4,{children:t.jsx("li",{children:t.jsx(S,{condition:!!e.potentiallyStaleCount,show:r})})}),t.jsx(S,{condition:!!e.potentiallyStaleCount,show:t.jsxs(t.Fragment,{children:[t.jsx(O4,{children:"Review your feature toggles and delete unused toggles."}),t.jsx(V,{sx:{mt:2},children:t.jsx(C3,{component:v1,to:"/feature-toggle-type",children:"Configure feature types lifetime"})})]}),elseShow:t.jsx("span",{children:"No action is required"})})]})]})},Nt=({row:e})=>{const a=r1();return e.original.expiredAt?t.jsx(E2,{value:e.original.expiredAt}):t.jsx(Q,{children:t.jsx(k,{variant:"body2",color:a.palette.text.secondary,children:"N/A"})})},Wt=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),qt=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),Ut=({row:e})=>e.original.status==="potentially-stale"?t.jsx(Q,{children:t.jsxs(Wt,{children:[t.jsx(H9,{}),t.jsx("span",{children:"Potentially stale"})]})}):t.jsx(Q,{children:t.jsxs(qt,{children:[t.jsx(P6,{}),t.jsx("span",{children:"Healthy"})]})}),C0=(e,a)=>Math.abs(F7(e,a)),d0=(e,a)=>{var c;return a.lifetimeDays?e>=((c=a==null?void 0:a.lifetimeDays)==null?void 0:c.valueOf()):!1},Gt=(e,a)=>{const{type:c,createdAt:n}=e,r=a.find(h=>h.id===c),o=R6(n),l=C0(o,new Date);return r&&d0(l,r)&&c!==I6&&c!==B6?"potentially-stale":"healthy"},Jt=(e,a)=>{var h;const{type:c,createdAt:n}=e,r=a.find(C=>C.id===c);if(r&&(r.name===I6||r.name===B6))return;const o=R6(n),i=new Date,l=C0(o,i);if(r&&d0(l,r)){const C=l-(((h=r==null?void 0:r.lifetimeDays)==null?void 0:h.valueOf())||0);return T9(i,C).toISOString()}},Kt=({projectId:e,features:a})=>{const c=r1(),n=m1(c.breakpoints.down("sm")),r=m1(c.breakpoints.down("md")),o=m1(c.breakpoints.down("lg"));a1();const{featureTypes:i}=P7(),l=s.useMemo(()=>a.map(f=>({project:e,name:f.name,type:f.type,stale:f.stale,environments:f.environments,status:Gt(f,i),lastSeenAt:f.lastSeenAt,createdAt:f.createdAt,expiredAt:Jt(f,i)})),[e,a,i]),h=s.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt",desc:!0}]}),[]),C=s.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({value:f,row:{original:E}})=>t.jsx(R7,{feature:E}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",align:"center",Cell:F6,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:l0,minWidth:120},{Header:"Created",accessor:"createdAt",Cell:E2,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Nt,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:Ut,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:I7,disableGlobalFilter:!0,maxWidth:120}],[]),{headerGroups:u,rows:m,prepareRow:p,state:{globalFilter:j},setGlobalFilter:g,setHiddenColumns:y}=t1.useTable({columns:C,data:l,initialState:h,sortTypes:u3,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},t1.useGlobalFilter,t1.useFlexLayout,t1.useSortBy);m3([{condition:n,columns:["stale"]},{condition:r,columns:["expiredAt","lastSeenAt"]},{condition:o,columns:["createdAt"]}],y,C);const v=m.length<l.length?`Feature toggles (${m.length} of ${l.length})`:`Feature toggles (${l.length})`;return t.jsxs(n1,{header:t.jsx(X,{title:v,actions:t.jsx(T1,{initialValue:j,onChange:g})}),children:[t.jsx(l3,{value:j,children:t.jsx(_2,{headerGroups:u,prepareRow:p,rows:m})}),t.jsx(S,{condition:m.length===0,show:t.jsx(S,{condition:(j==null?void 0:j.length)>0,show:t.jsxs(g1,{children:["No feature toggles found matching “",j,"”"]}),elseShow:t.jsx(g1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},Yt=()=>{const e=W("projectId"),a=X1(e);Z1(`Project health – ${a}`);const{healthReport:c,refetchHealthReport:n,error:r}=Tt(e,{refreshInterval:15*1e3});return c?t.jsxs("div",{children:[t.jsx(S,{condition:!!r,show:t.jsx(E6,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:n,text:`Could not fetch health rating for ${e}`})}),t.jsx(zt,{healthReport:c}),t.jsx(Kt,{projectId:e,features:c.features})]}):null},Qt=d("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),Xt=()=>{const e=W("projectId");return t.jsx(Qt,{children:t.jsx(B7,{title:"Event Log",project:e,displayInline:!0})})},h0=(e,a)=>{const{data:c,error:n,mutate:r}=U1(L1(`api/admin/projects/${e}/change-requests/${a}`),ea,{refreshInterval:15e3});return{data:c,loading:!n&&!c,refetchChangeRequest:()=>r(),error:n}},ea=e=>fetch(e).then(F1("Request changes")).then(a=>a.json()),ta=d(O1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));d(V)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const aa=d(V)(({theme:e})=>({display:"flex",alignItems:"center"})),ca=d(k)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),na=d(O7)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),W5=d($3)(({theme:e})=>({height:"24px",width:"24px"})),ra=({changeRequest:e})=>{var n,r,o;const[a,c]=s.useState(e.title);return t.jsxs(ta,{elevation:0,children:[t.jsx($7,{environmentChangeRequest:e,title:a,setTitle:c,children:t.jsx(ca,{variant:"h1",sx:{mr:1.5},children:a})}),t.jsxs(aa,{children:[t.jsx(O6,{changeRequest:e}),t.jsxs(k,{variant:"body2",sx:i=>({margin:i.spacing("auto",0,"auto",2)}),children:["Created"," ",t.jsx(H5,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),t.jsx(V,{sx:i=>({marginLeft:i.spacing(1)}),children:t.jsx(S1,{title:(n=e==null?void 0:e.createdBy)==null?void 0:n.username,children:t.jsx(W5,{src:(r=e==null?void 0:e.createdBy)==null?void 0:r.imageUrl})})}),t.jsx(k,{variant:"body2",sx:i=>({marginLeft:i.spacing(.5)}),children:(o=e==null?void 0:e.createdBy)==null?void 0:o.username}),t.jsx(V,{sx:i=>({marginLeft:i.spacing(1.5)}),children:t.jsx(na,{variant:"outlined",children:t.jsxs(k,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",t.jsx(k,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",t.jsx(z7,{}),"Updates:",t.jsx(N7,{featuresCount:e.features.length,segmentsCount:e.segments.length})]})})})]})]})},sa=s.createContext({}),u2=sa;function oa(e){return p3("MuiTimeline",e)}c3("MuiTimeline",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]);function b3(e){return e==="alternate-reverse"?"positionAlternateReverse":`position${M2(e)}`}const ia=["position","className"],la=e=>{const{position:a,classes:c}=e,n={root:["root",a&&b3(a)]};return x3(n,oa,c)},Ca=d("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,c.position&&a[b3(c.position)]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),da=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimeline"}),{position:r="right",className:o}=n,i=g3(n,ia),l=C1({},n,{position:r}),h=la(l),C=s.useMemo(()=>({position:r}),[r]);return t.jsx(u2.Provider,{value:C,children:t.jsx(Ca,C1({className:f3(h.root,o),ownerState:l,ref:c},i))})}),u0=da;function ha(e){return p3("MuiTimelineContent",e)}const ua=c3("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),ma=["className"],pa=e=>{const{position:a,classes:c}=e,n={root:["root",b3(a)]};return x3(n,ha,c)},va=d(k,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,a[b3(c.position)]]}})(({ownerState:e})=>C1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),ga=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineContent"}),{className:r}=n,o=g3(n,ma),{position:i}=s.useContext(u2),l=C1({},n,{position:i||"right"}),h=pa(l);return t.jsx(va,C1({component:"div",className:f3(h.root,r),ownerState:l,ref:c},o))}),q5=ga,fa=c3("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),xa=fa;function ja(e){return p3("MuiTimelineItem",e)}const Za=c3("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse","missingOppositeContent"]),m0=Za,ya=["position","className"],ba=e=>{const{position:a,classes:c,hasOppositeContent:n}=e,r={root:["root",b3(a),!n&&"missingOppositeContent"]};return x3(r,ja,c)},Va=d("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,a[b3(c.position)]]}})(({ownerState:e})=>C1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},(e.position==="alternate"||e.position==="alternate-reverse")&&{[`&:nth-of-type(${e.position==="alternate"?"even":"odd"})`]:{flexDirection:"row-reverse",[`& .${ua.root}`]:{textAlign:"right"},[`& .${xa.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&::before":{content:'""',flex:1,padding:"6px 16px"}})),Sa=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineItem"}),{position:r,className:o}=n,i=g3(n,ya),{position:l}=s.useContext(u2);let h=!1;s.Children.forEach(n.children,p=>{W7(p,["TimelineOppositeContent"])&&(h=!0)});const C=C1({},n,{position:r||l||"right",hasOppositeContent:h}),u=ba(C),m=s.useMemo(()=>({position:C.position}),[C.position]);return t.jsx(u2.Provider,{value:m,children:t.jsx(Va,C1({className:f3(u.root,o),ownerState:C,ref:c},i))})}),k3=Sa;function wa(e){return p3("MuiTimelineSeparator",e)}c3("MuiTimelineSeparator",["root"]);const Ea=["className"],_a=e=>{const{classes:a}=e;return x3({root:["root"]},wa,a)},Ma=d("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,a)=>a.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),Ha=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineSeparator"}),{className:r}=n,o=g3(n,Ea),i=n,l=_a(i);return t.jsx(Ma,C1({className:f3(l.root,r),ownerState:i,ref:c},o))}),T3=Ha;function Aa(e){return p3("MuiTimelineDot",e)}c3("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const ka=["className","color","variant"],Ta=e=>{const{color:a,variant:c,classes:n}=e,r={root:["root",c,a!=="inherit"&&`${c}${M2(a)}`]};return x3(r,Aa,n)},Da=d("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,a[c.color!=="inherit"&&`${c.variant}${M2(c.color)}`],a[c.variant]]}})(({ownerState:e,theme:a})=>C1({display:"flex",alignSelf:"baseline",borderStyle:"solid",borderWidth:2,padding:4,borderRadius:"50%",boxShadow:(a.vars||a).shadows[1],margin:"11.5px 0"},e.variant==="filled"&&C1({borderColor:"transparent"},e.color!=="inherit"&&C1({},e.color==="grey"?{color:(a.vars||a).palette.grey[50],backgroundColor:(a.vars||a).palette.grey[400]}:{color:(a.vars||a).palette[e.color].contrastText,backgroundColor:(a.vars||a).palette[e.color].main})),e.variant==="outlined"&&C1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&C1({},e.color==="grey"?{borderColor:(a.vars||a).palette.grey[400]}:{borderColor:(a.vars||a).palette[e.color].main})))),La=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineDot"}),{className:r,color:o="grey",variant:i="filled"}=n,l=g3(n,ka),h=C1({},n,{color:o,variant:i}),C=Ta(h);return t.jsx(Da,C1({className:f3(C.root,r),ownerState:h,ref:c},l))}),U5=La;function Fa(e){return p3("MuiTimelineConnector",e)}c3("MuiTimelineConnector",["root"]);const Pa=["className"],Ra=e=>{const{classes:a}=e;return x3({root:["root"]},Fa,a)},Ia=d("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,a)=>a.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),Ba=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineConnector"}),{className:r}=n,o=g3(n,Pa),i=n,l=Ra(i);return t.jsx(Ia,C1({className:f3(l.root,r),ownerState:i,ref:c},o))}),G5=Ba,Oa=d(O1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),$a=d(V)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),za=d(V)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"flex-end"})),Na=d(u0)(()=>({[`& .${m0.root}:before`]:{flex:0,padding:0}})),Wa=["Draft","In review","Approved","Applied"],qa=["Draft","In review","Rejected"],Ua=["Draft","In review","Approved","Scheduled","Applied"],Ga=(e,a,c,n)=>e==="Cancelled"?"grey":e==="Rejected"?c==="Rejected"?"error":"success":a!==-1&&a>=n?"success":a+1===n?"primary":"grey",Ja=({state:e,schedule:a})=>{let c;switch(e){case"Rejected":c=qa;break;case"Scheduled":c=Ua;break;default:c=Wa}const n=c.findIndex(r=>r===e);return t.jsx(Oa,{elevation:0,children:t.jsx($a,{children:t.jsx(Na,{children:c.map((r,o)=>{if(a&&r==="Scheduled")return Qa(a);const i=Ga(e,n,r,o);let l={};return n+1===o&&!(e==="Cancelled"&&r==="Draft")&&(l={variant:"outlined"}),Ka(i,r,o<c.length-1,l)})})})})},Ka=(e,a,c,n={})=>t.jsxs(k3,{children:[t.jsxs(T3,{children:[t.jsx(U5,{color:e,...n}),c&&t.jsx(G5,{})]}),t.jsx(q5,{children:a})]},a),Ya=(e,a)=>{switch(e.status){case"suspended":return{title:"Schedule suspended",subtitle:`was ${a}`,color:"grey",reason:t.jsx(h5,{title:e.reason,arrow:!0,children:t.jsx(l2,{color:"disabled",fontSize:"small"})})};case"failed":return{title:"Schedule failed",subtitle:`at ${a}`,color:"error",reason:t.jsx(h5,{title:`Schedule failed because of ${e.reason||e.failureReason}`,arrow:!0,children:t.jsx(l2,{color:"error",fontSize:"small"})})};default:return{title:"Scheduled",subtitle:`for ${a}`,color:"warning",reason:null}}},Qa=e=>{const{locationSettings:a}=H2(),c=A2(new Date(e.scheduledAt),a==null?void 0:a.locale),{title:n,subtitle:r,color:o,reason:i}=Ya(e,c);return t.jsxs(k3,{children:[t.jsxs(T3,{children:[t.jsx(U5,{color:o}),t.jsx(G5,{})]}),t.jsxs(q5,{children:[n,t.jsxs(za,{children:[t.jsx(k,{color:"text.secondary",sx:{mr:1},children:`(${r})`}),i]})]})]},n)},J5=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",w1=d(V)(({theme:e})=>({display:"flex",alignItems:"center"})),p0=d(A5)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),$4=d(A5)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),m2=d($6)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Xa=d(A9)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),ec=d(l2)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),tc=d(q7)(({theme:e})=>({color:e.palette.text.secondary,height:"35px",width:"35px",marginRight:e.spacing(1)})),ac=d(z3)(({theme:e})=>({color:e.palette.text.secondary,height:"24px",width:"24px"})),cc=d(V)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),nc=d(V,{shouldForwardProp:J5()})(({theme:e,bgColor:a,svgColor:c})=>({borderRadius:`${e.shape.borderRadiusMedium}px`,backgroundColor:a,padding:e.spacing(1,2),marginRight:e.spacing(2),height:"45px",width:"45px",display:"flex",alignItems:"center",justifyContent:"center",svg:{color:c}})),K5=d(D6)(({theme:e})=>({margin:e.spacing(2.5,0)})),rc=d(V,{shouldForwardProp:J5()})(({theme:e,border:a})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:a,padding:e.spacing(3),width:"100%"})),b1=d(k,{shouldForwardProp:J5()})(({theme:e,color:a})=>({fontWeight:"bold",color:a})),sc=d(V)({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}),L2=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,oc=(e,a)=>e==="Approved"||e==="Scheduled"?`2px solid ${a.palette.success.main}`:e==="Applied"?`2px solid ${a.palette.primary.main}`:`1px solid ${a.palette.divider}`,ic=(e,a)=>e==="Approved"?{bgColor:a.palette.success.main,svgColor:a.palette.background.paper}:e==="Applied"?{bgColor:a.palette.primary.main,svgColor:a.palette.background.paper}:{bgColor:a.palette.background.elevation2,svgColor:a.palette.neutral.main},lc=({changeRequest:e,onEditClick:a})=>{const c=r1();return t.jsxs(cc,{children:[t.jsx(nc,{...ic(e.state,c),children:t.jsx(U7,{style:{transform:"scale(1.5)"}})}),t.jsx(rc,{sx:{backgroundColor:e.state==="In review"?c.palette.warning.light:"initial"},border:oc(e.state,c),children:t.jsx(Cc,{changeRequest:e,onEditClick:a})})]})},Cc=({changeRequest:e,onEditClick:a})=>{const{state:c}=e;if(!c)return null;if(c==="Approved")return t.jsx(dc,{});if(c==="Applied")return t.jsx(uc,{});if(c==="Cancelled")return t.jsx(xc,{});if(c==="Rejected")return t.jsx(jc,{});if(c==="Scheduled"){const{schedule:n}=e;return t.jsx(pc,{schedule:n,onEditClick:a})}return t.jsx(hc,{minApprovals:e.minApprovals})},dc=()=>{const e=r1();return t.jsxs(t.Fragment,{children:[t.jsxs(w1,{children:[t.jsx(m2,{}),t.jsxs(V,{children:[t.jsx(b1,{color:e.palette.success.dark,children:"Changes approved"}),t.jsx(k,{children:"One approving review from requested approvers"})]})]}),t.jsx(K5,{}),t.jsxs(w1,{children:[t.jsx(m2,{}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},hc=({minApprovals:e})=>{const a=r1();return t.jsxs(t.Fragment,{children:[t.jsxs(w1,{children:[t.jsx($4,{}),t.jsxs(V,{children:[t.jsx(b1,{color:a.palette.warning.dark,children:"Review required"}),t.jsxs(k,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),t.jsx(K5,{}),t.jsxs(w1,{children:[t.jsx($4,{}),t.jsx(b1,{color:a.palette.warning.dark,children:"Apply changes is blocked"})]})]})},uc=()=>{const e=r1();return t.jsx(t.Fragment,{children:t.jsxs(w1,{children:[t.jsx(m2,{sx:{color:e.palette.primary.main}}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.primary.main,children:"Changes applied"})})]})})},mc=d(D1)({maxWidth:"32px",maxHeight:"32px"}),pc=({schedule:e,onEditClick:a})=>{const c=r1();if(!e)return null;const n=(()=>{switch(e.status){case"pending":return t.jsx(fc,{schedule:e});case"failed":return t.jsx(vc,{schedule:e});case"suspended":return t.jsx(gc,{schedule:e});default:return null}})();return t.jsxs(t.Fragment,{children:[t.jsxs(w1,{children:[t.jsx(m2,{}),t.jsxs(V,{children:[t.jsx(b1,{color:c.palette.success.dark,children:"Changes approved"}),t.jsx(k,{children:"One approving review from requested approvers"})]})]}),t.jsx(K5,{}),t.jsxs(sc,{children:[n,t.jsx(mc,{onClick:a,children:t.jsx(ac,{})})]})]})},vc=({schedule:e})=>{const a=r1(),c=L2(),{locationSettings:n}=H2(),r=A2(new Date(e==null?void 0:e.scheduledAt),n==null?void 0:n.locale);return t.jsxs(w1,{children:[t.jsx(ec,{}),t.jsxs(V,{children:[t.jsxs(b1,{color:a.palette.error.main,children:["Changes failed to be applied on ",r," because of"," ",e.reason??e.failureReason]}),t.jsxs(k,{children:["Your timezone is ",c]})]})]})},gc=({schedule:e})=>{const a=r1(),c=L2(),{locationSettings:n}=H2(),r=A2(new Date(e==null?void 0:e.scheduledAt),n==null?void 0:n.locale);return t.jsxs(w1,{children:[t.jsx(tc,{}),t.jsxs(V,{children:[t.jsxs(b1,{color:a.palette.text.secondary,children:["The change request is suspended for the following reason:"," ",e.reason]}),t.jsxs(b1,{color:a.palette.text.secondary,children:["It will not be applied on ",r,"."]}),t.jsxs(k,{children:["Your timezone is ",c]})]})]})},fc=({schedule:e})=>{const a=r1(),c=L2(),{locationSettings:n}=H2(),r=A2(new Date(e==null?void 0:e.scheduledAt),n==null?void 0:n.locale);return t.jsxs(w1,{children:[t.jsx(Xa,{}),t.jsxs(V,{children:[t.jsxs(b1,{color:a.palette.warning.dark,children:["Changes are scheduled to be applied on: ",r]}),t.jsxs(k,{children:["Your timezone is ",c]})]})]})},xc=()=>{const e=r1();return t.jsx(t.Fragment,{children:t.jsxs(w1,{children:[t.jsx(p0,{}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.error.main,children:"Changes cancelled"})})]})})},jc=()=>{const e=r1();return t.jsx(t.Fragment,{children:t.jsxs(w1,{children:[t.jsx(p0,{}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.error.main,children:"Changes rejected"})})]})})};var Y5={},Zc=a3;Object.defineProperty(Y5,"__esModule",{value:!0});var v0=Y5.default=void 0,yc=Zc(t3()),bc=t,Vc=(0,yc.default)((0,bc.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");v0=Y5.default=Vc;const g0=({disabled:e,children:a,actions:c,permission:n})=>{const{isAdmin:r}=s.useContext($1),o=W("projectId"),i=W("id"),{user:l}=z6(),{data:h}=h0(o,i),[C,u]=N1.useState(!1),m=N1.useRef(null),p=()=>{u(y=>!y)},j=y=>{var v;(v=m.current)!=null&&v.contains(y.target)||u(!1)},g=m.current?m.current.offsetWidth:null;return t.jsxs(N1.Fragment,{children:[t.jsx(G1,{variant:"contained",disabled:e||(h==null?void 0:h.createdBy.id)===(l==null?void 0:l.id)&&!r,"aria-controls":C?"review-options-menu":void 0,"aria-expanded":C?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:p,ref:m,endIcon:t.jsx(v0,{}),permission:n,projectId:o,environmentId:h==null?void 0:h.environment,children:a}),t.jsx(H6,{sx:{zIndex:1,width:g},open:C,anchorEl:m.current,transition:!0,disablePortal:!0,children:({TransitionProps:y,placement:v})=>t.jsx(G7,{...y,style:{transformOrigin:v==="bottom"?"center top":"center bottom"},children:t.jsx(O1,{className:"dropdown-outline",children:t.jsx(A6,{onClickAway:j,children:t.jsx(O3,{id:"review-options-menu",autoFocusItem:!0,children:c.map(({label:f,onSelect:E,icon:b})=>t.jsxs(H1,{onClick:E,children:[t.jsx(A1,{children:b}),t.jsx(k1,{children:f})]},`MenuItem-${f}`))})})})})})]})},Sc=({disabled:e,onReject:a,onApprove:c,children:n})=>t.jsx(g0,{permission:J7,disabled:e,actions:[{label:"Approve",onSelect:c,icon:t.jsx(Z2,{fontSize:"small"})},{label:"Reject",onSelect:a,icon:t.jsx(i9,{fontSize:"small"})}],children:n});var f0={},Q5={},X5={};Object.defineProperty(X5,"__esModule",{value:!0});var wc=s,Ec=_c(wc);function _c(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c]);return a.default=e,a}X5.default=function(e,a,c){return Ec.createElement("a",{href:e,key:c},a)};var e4={};Object.defineProperty(e4,"__esModule",{value:!0});e4.default=function(e){return e};var t4={},Y2,z4;function Mc(){return z4||(z4=1,Y2=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),Y2}var Q2,N4;function Hc(){return N4||(N4=1,Q2=/[\0-\x1F\x7F-\x9F]/),Q2}var X2,W4;function Ac(){return W4||(W4=1,X2=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),X2}var e5,q4;function kc(){return q4||(q4=1,e5=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),e5}var t5,U4;function Tc(){return U4||(U4=1,t5=function(e){var a={};a.src_Any=Mc().source,a.src_Cc=Hc().source,a.src_Z=Ac().source,a.src_P=kc().source,a.src_ZPCc=[a.src_Z,a.src_P,a.src_Cc].join("|"),a.src_ZCc=[a.src_Z,a.src_Cc].join("|");var c="[><|]";return a.src_pseudo_letter="(?:(?!"+c+"|"+a.src_ZPCc+")"+a.src_Any+")",a.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",a.src_auth="(?:(?:(?!"+a.src_ZCc+"|[@/\\[\\]()]).)+@)?",a.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",a.src_host_terminator="(?=$|"+c+"|"+a.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+a.src_ZPCc+"))",a.src_path="(?:[/?#](?:(?!"+a.src_ZCc+"|"+c+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+a.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+a.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+a.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+a.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+a.src_ZCc+"|[']).)+\\'|\\'(?="+a.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+a.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+a.src_ZCc+").|\\!(?!"+a.src_ZCc+"|[!]).|\\?(?!"+a.src_ZCc+"|[?]).)+|\\/)?",a.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',a.src_xn="xn--[a-z0-9\\-]{1,59}",a.src_domain_root="(?:"+a.src_xn+"|"+a.src_pseudo_letter+"{1,63})",a.src_domain="(?:"+a.src_xn+"|(?:"+a.src_pseudo_letter+")|(?:"+a.src_pseudo_letter+"(?:-|"+a.src_pseudo_letter+"){0,61}"+a.src_pseudo_letter+"))",a.src_host="(?:(?:(?:(?:"+a.src_domain+")\\.)*"+a.src_domain+"))",a.tpl_host_fuzzy="(?:"+a.src_ip4+"|(?:(?:(?:"+a.src_domain+")\\.)+(?:%TLDS%)))",a.tpl_host_no_ip_fuzzy="(?:(?:(?:"+a.src_domain+")\\.)+(?:%TLDS%))",a.src_host_strict=a.src_host+a.src_host_terminator,a.tpl_host_fuzzy_strict=a.tpl_host_fuzzy+a.src_host_terminator,a.src_host_port_strict=a.src_host+a.src_port+a.src_host_terminator,a.tpl_host_port_fuzzy_strict=a.tpl_host_fuzzy+a.src_port+a.src_host_terminator,a.tpl_host_port_no_ip_fuzzy_strict=a.tpl_host_no_ip_fuzzy+a.src_port+a.src_host_terminator,a.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+a.src_ZPCc+"|>|$))",a.tpl_email_fuzzy="(^|"+c+'|"|\\(|'+a.src_ZCc+")("+a.src_email_name+"@"+a.tpl_host_fuzzy_strict+")",a.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+a.src_ZPCc+"))((?![$+<=>^`||])"+a.tpl_host_port_fuzzy_strict+a.src_path+")",a.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+a.src_ZPCc+"))((?![$+<=>^`||])"+a.tpl_host_port_no_ip_fuzzy_strict+a.src_path+")",a}),t5}function p5(e){var a=Array.prototype.slice.call(arguments,1);return a.forEach(function(c){c&&Object.keys(c).forEach(function(n){e[n]=c[n]})}),e}function F2(e){return Object.prototype.toString.call(e)}function Dc(e){return F2(e)==="[object String]"}function Lc(e){return F2(e)==="[object Object]"}function Fc(e){return F2(e)==="[object RegExp]"}function G4(e){return F2(e)==="[object Function]"}function Pc(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var x0={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Rc(e){return Object.keys(e||{}).reduce(function(a,c){return a||x0.hasOwnProperty(c)},!1)}var Ic={"http:":{validate:function(e,a,c){var n=e.slice(a);return c.re.http||(c.re.http=new RegExp("^\\/\\/"+c.re.src_auth+c.re.src_host_port_strict+c.re.src_path,"i")),c.re.http.test(n)?n.match(c.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,a,c){var n=e.slice(a);return c.re.no_http||(c.re.no_http=new RegExp("^"+c.re.src_auth+"(?:localhost|(?:(?:"+c.re.src_domain+")\\.)+"+c.re.src_domain_root+")"+c.re.src_port+c.re.src_host_terminator+c.re.src_path,"i")),c.re.no_http.test(n)?a>=3&&e[a-3]===":"||a>=3&&e[a-3]==="/"?0:n.match(c.re.no_http)[0].length:0}},"mailto:":{validate:function(e,a,c){var n=e.slice(a);return c.re.mailto||(c.re.mailto=new RegExp("^"+c.re.src_email_name+"@"+c.re.src_host_strict,"i")),c.re.mailto.test(n)?n.match(c.re.mailto)[0].length:0}}},Bc="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",Oc="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function $c(e){e.__index__=-1,e.__text_cache__=""}function zc(e){return function(a,c){var n=a.slice(c);return e.test(n)?n.match(e)[0].length:0}}function J4(){return function(e,a){a.normalize(e)}}function p2(e){var a=e.re=Tc()(e.__opts__),c=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||c.push(Bc),c.push(a.src_xn),a.src_tlds=c.join("|");function n(l){return l.replace("%TLDS%",a.src_tlds)}a.email_fuzzy=RegExp(n(a.tpl_email_fuzzy),"i"),a.link_fuzzy=RegExp(n(a.tpl_link_fuzzy),"i"),a.link_no_ip_fuzzy=RegExp(n(a.tpl_link_no_ip_fuzzy),"i"),a.host_fuzzy_test=RegExp(n(a.tpl_host_fuzzy_test),"i");var r=[];e.__compiled__={};function o(l,h){throw new Error('(LinkifyIt) Invalid schema "'+l+'": '+h)}Object.keys(e.__schemas__).forEach(function(l){var h=e.__schemas__[l];if(h!==null){var C={validate:null,link:null};if(e.__compiled__[l]=C,Lc(h)){Fc(h.validate)?C.validate=zc(h.validate):G4(h.validate)?C.validate=h.validate:o(l,h),G4(h.normalize)?C.normalize=h.normalize:h.normalize?o(l,h):C.normalize=J4();return}if(Dc(h)){r.push(l);return}o(l,h)}}),r.forEach(function(l){e.__compiled__[e.__schemas__[l]]&&(e.__compiled__[l].validate=e.__compiled__[e.__schemas__[l]].validate,e.__compiled__[l].normalize=e.__compiled__[e.__schemas__[l]].normalize)}),e.__compiled__[""]={validate:null,normalize:J4()};var i=Object.keys(e.__compiled__).filter(function(l){return l.length>0&&e.__compiled__[l]}).map(Pc).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+i+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+i+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),$c(e)}function Nc(e,a){var c=e.__index__,n=e.__last_index__,r=e.__text_cache__.slice(c,n);this.schema=e.__schema__.toLowerCase(),this.index=c+a,this.lastIndex=n+a,this.raw=r,this.text=r,this.url=r}function K4(e,a){var c=new Nc(e,a);return e.__compiled__[c.schema].normalize(c,e),c}function V1(e,a){if(!(this instanceof V1))return new V1(e,a);a||Rc(e)&&(a=e,e={}),this.__opts__=p5({},x0,a),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=p5({},Ic,e),this.__compiled__={},this.__tlds__=Oc,this.__tlds_replaced__=!1,this.re={},p2(this)}V1.prototype.add=function(a,c){return this.__schemas__[a]=c,p2(this),this};V1.prototype.set=function(a){return this.__opts__=p5(this.__opts__,a),this};V1.prototype.test=function(a){if(this.__text_cache__=a,this.__index__=-1,!a.length)return!1;var c,n,r,o,i,l,h,C,u;if(this.re.schema_test.test(a)){for(h=this.re.schema_search,h.lastIndex=0;(c=h.exec(a))!==null;)if(o=this.testSchemaAt(a,c[2],h.lastIndex),o){this.__schema__=c[2],this.__index__=c.index+c[1].length,this.__last_index__=c.index+c[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(C=a.search(this.re.host_fuzzy_test),C>=0&&(this.__index__<0||C<this.__index__)&&(n=a.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(i=n.index+n[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(u=a.indexOf("@"),u>=0&&(r=a.match(this.re.email_fuzzy))!==null&&(i=r.index+r[1].length,l=r.index+r[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&l>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=l))),this.__index__>=0};V1.prototype.pretest=function(a){return this.re.pretest.test(a)};V1.prototype.testSchemaAt=function(a,c,n){return this.__compiled__[c.toLowerCase()]?this.__compiled__[c.toLowerCase()].validate(a,n,this):0};V1.prototype.match=function(a){var c=0,n=[];this.__index__>=0&&this.__text_cache__===a&&(n.push(K4(this,c)),c=this.__last_index__);for(var r=c?a.slice(c):a;this.test(r);)n.push(K4(this,c)),r=r.slice(this.__last_index__),c+=this.__last_index__;return n.length?n:null};V1.prototype.tlds=function(a,c){return a=Array.isArray(a)?a:[a],c?(this.__tlds__=this.__tlds__.concat(a).sort().filter(function(n,r,o){return n!==o[r-1]}).reverse(),p2(this),this):(this.__tlds__=a.slice(),this.__tlds_replaced__=!0,p2(this),this)};V1.prototype.normalize=function(a){a.schema||(a.url="http://"+a.url),a.schema==="mailto:"&&!/^mailto:/i.test(a.url)&&(a.url="mailto:"+a.url)};V1.prototype.onCompile=function(){};var Wc=V1;const qc=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","actor","ad","ads","adult","ae","aeg","aero","aetna","af","afl","africa","ag","agakhan","agency","ai","aig","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","amazon","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","casa","case","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","charity","chase","chat","cheap","chintai","christmas","chrome","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cpa","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dog","domains","dot","download","drive","dtv","dubai","dunlop","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epson","equipment","er","ericsson","erni","es","esq","estate","et","etisalat","eu","eurovision","eus","events","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gay","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","inc","industries","infiniti","info","ing","ink","institute","insurance","insure","int","international","intuit","investments","io","ipiranga","iq","ir","irish","is","ismaili","ist","istanbul","it","itau","itv","jaguar","java","jcb","je","jeep","jetzt","jewelry","jio","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kids","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","lamborghini","lamer","lancaster","lancia","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","link","lipsy","live","living","lk","llc","llp","loan","loans","locker","locus","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","luxe","luxury","lv","ly","ma","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","merckmsd","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","moda","moe","moi","mom","monash","money","monster","mormon","mortgage","moscow","moto","motorcycles","mov","movie","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","music","mutual","mv","mw","mx","my","mz","na","nab","nagoya","name","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","racing","radio","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","ril","rio","rip","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scot","sd","se","search","seat","secure","security","seek","select","sener","services","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","spa","space","sport","spot","sr","srl","ss","st","stada","staples","star","statebank","statefarm","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiss","sx","sy","sydney","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","vermögensberater","vermögensberatung","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zm","zone","zuerich","zw","ελ","ευ","бг","бел","дети","ею","католик","ком","мкд","мон","москва","онлайн","орг","рус","рф","сайт","срб","укр","қаз","հայ","ישראל","קום","ابوظبي","اتصالات","ارامكو","الاردن","البحرين","الجزائر","السعودية","العليان","المغرب","امارات","ایران","بارت","بازار","بيتك","بھارت","تونس","سودان","سورية","شبكة","عراق","عرب","عمان","فلسطين","قطر","كاثوليك","كوم","مصر","مليسيا","موريتانيا","موقع","همراه","پاکستان","ڀارت","कॉम","नेट","भारत","भारतम्","भारोत","संगठन","বাংলা","ভারত","ভাৰত","ਭਾਰਤ","ભારત","ଭାରତ","இந்தியா","இலங்கை","சிங்கப்பூர்","భారత్","ಭಾರತ","ഭാരതം","ලංකා","คอม","ไทย","ລາວ","გე","みんな","アマゾン","クラウド","グーグル","コム","ストア","セール","ファッション","ポイント","世界","中信","中国","中國","中文网","亚马逊","企业","佛山","信息","健康","八卦","公司","公益","台湾","台灣","商城","商店","商标","嘉里","嘉里大酒店","在线","大拿","天主教","娱乐","家電","广东","微博","慈善","我爱你","手机","招聘","政务","政府","新加坡","新闻","时尚","書籍","机构","淡马锡","游戏","澳門","点看","移动","组织机构","网址","网店","网站","网络","联通","谷歌","购物","通販","集团","電訊盈科","飞利浦","食品","餐厅","香格里拉","香港","닷넷","닷컴","삼성","한국"];Object.defineProperty(t4,"__esModule",{value:!0});var Uc=Wc,Gc=j0(Uc),Jc=qc,Kc=j0(Jc);function j0(e){return e&&e.__esModule?e:{default:e}}var Z0=new Gc.default;Z0.tlds(Kc.default);t4.default=function(e){return Z0.match(e)};var a4={};Object.defineProperty(a4,"__esModule",{value:!0});a4.default=function(e){return e};Object.defineProperty(Q5,"__esModule",{value:!0});var Yc=function(){function e(a,c){for(var n=0;n<c.length;n++){var r=c[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}return function(a,c,n){return c&&e(a.prototype,c),n&&e(a,n),a}}(),Qc=s,M3=on(Qc),Xc=X5,en=P2(Xc),tn=e4,an=P2(tn),cn=t4,nn=P2(cn),rn=a4,sn=P2(rn);function P2(e){return e&&e.__esModule?e:{default:e}}function on(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c]);return a.default=e,a}function ln(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function Cn(e,a){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a&&(typeof a=="object"||typeof a=="function")?a:e}function dn(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof a);e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),a&&(Object.setPrototypeOf?Object.setPrototypeOf(e,a):e.__proto__=a)}var y0=function(e){dn(a,e);function a(){return ln(this,a),Cn(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return Yc(a,[{key:"parseString",value:function(n){var r=this;if(n==="")return n;var o=this.props.matchDecorator(n);if(!o)return n;var i=[],l=0;return o.forEach(function(h,C){h.index>l&&i.push(n.substring(l,h.index));var u=r.props.hrefDecorator(h.url),m=r.props.textDecorator(h.text),p=r.props.componentDecorator(u,m,C);i.push(p),l=h.lastIndex}),n.length>l&&i.push(n.substring(l)),i.length===1?i[0]:i}},{key:"parse",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof n=="string"?this.parseString(n):M3.isValidElement(n)&&n.type!=="a"&&n.type!=="button"?M3.cloneElement(n,{key:o},this.parse(n.props.children)):Array.isArray(n)?n.map(function(i,l){return r.parse(i,l)}):n}},{key:"render",value:function(){return M3.createElement(M3.Fragment,null,this.parse(this.props.children))}}]),a}(M3.Component);y0.defaultProps={componentDecorator:en.default,hrefDecorator:an.default,matchDecorator:nn.default,textDecorator:sn.default};Q5.default=y0;Object.defineProperty(f0,"__esModule",{value:!0});var hn=Q5,un=mn(hn);function mn(e){return e&&e.__esModule?e:{default:e}}var pn=f0.default=un.default;const vn=d(V)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),gn=d(O1)(({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})),fn=d(V)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),xn=({comment:e})=>t.jsxs(vn,{children:[t.jsx(S1,{title:e.createdBy.username,children:t.jsx(K7,{src:e.createdBy.imageUrl})}),t.jsxs(gn,{variant:"outlined",children:[t.jsx(fn,{children:t.jsxs(V,{children:[t.jsx("strong",{children:e.createdBy.username})," ",t.jsxs(k,{color:"text.secondary",component:"span",children:["commented"," ",t.jsx(H5,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),t.jsx(V,{sx:{paddingTop:2.5},children:t.jsx(pn,{children:e.text})})]})]}),b0=d(V)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),jn=d($6)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),Zn=d(A5)(({theme:e})=>({color:e.palette.error.main,marginLeft:"auto"})),V0=d(k)({maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"text.primary"}),yn=({name:e,imageUrl:a})=>t.jsxs(b0,{children:[t.jsx(W5,{src:a}),t.jsx(V0,{variant:"body1",children:e}),t.jsx(jn,{})]}),bn=({name:e,imageUrl:a})=>t.jsxs(b0,{children:[t.jsx(W5,{src:a}),t.jsx(V0,{variant:"body1",children:e}),t.jsx(Zn,{})]}),Vn=({rejections:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx(k,{variant:"body1",color:"text.secondary",children:"Rejected by"}),e.map(a=>t.jsx(bn,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),Sn=({approvals:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx(k,{variant:"body1",color:"text.secondary",children:t.jsx(S,{condition:(e==null?void 0:e.length)>0,show:"Approved by",elseShow:"No approvals yet"})}),e.map(a=>t.jsx(yn,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),wn=d(V)(({theme:e})=>({marginBottom:e.spacing(2)})),En=({actualApprovals:e,minApprovals:a})=>t.jsxs(t.Fragment,{children:["Reviewers"," ",t.jsxs(k,{component:"span",color:"text.secondary",children:["(",e,"/",a," required)"]})]}),_n=({header:e,children:a})=>t.jsxs(O1,{elevation:0,sx:c=>({marginTop:c.spacing(2),padding:c.spacing(4),borderRadius:n=>`${n.shape.borderRadiusLarge}px`}),children:[t.jsx(wn,{children:e}),a]}),Mn=({changeRequest:e})=>t.jsx(_n,{header:t.jsx(En,{actualApprovals:e.approvals.length,minApprovals:e.minApprovals}),children:t.jsx(S,{condition:e.state==="Rejected",show:t.jsx(Vn,{rejections:e.rejections}),elseShow:t.jsx(Sn,{approvals:e.approvals})})}),Hn=({open:e,onConfirm:a,onClose:c})=>{const[n,r]=s.useState("");return t.jsxs(E1,{open:e,primaryButtonText:"Reject changes",secondaryButtonText:"Cancel",onClick:()=>a(n),onClose:c,title:"Reject changes",fullWidth:!0,children:[t.jsx(V,{children:"Add an optional comment why you reject those changes"}),t.jsx(N3,{sx:{mt:1},variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>r(o.target.value),value:n})]})};var c4={},An=a3;Object.defineProperty(c4,"__esModule",{value:!0});var S0=c4.default=void 0,kn=An(t3()),Tn=t,Dn=(0,kn.default)((0,Tn.jsx)("path",{d:"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"}),"Today");S0=c4.default=Dn;const Y4=({disabled:e,onSchedule:a,onApply:c,variant:n="create",children:r})=>t.jsx(g0,{permission:k2,disabled:e,actions:[{label:"Apply changes",onSelect:c,icon:t.jsx(Z2,{fontSize:"small"})},{label:n==="create"?"Schedule changes":"Update schedule",onSelect:a,icon:t.jsx(S0,{fontSize:"small"})}],children:r}),Ln=d(h1)(({theme:e})=>({marginBottom:e.spacing(2),backgroundColor:`${e.palette.neutral.light}!important`,color:`${e.palette.text.primary}!important`,borderColor:`${e.palette.neutral.light}!important`})),w0=({open:e,onConfirm:a,onClose:c,title:n,primaryButtonText:r,message:o,scheduledTime:i,permissionButton:l})=>i?t.jsxs(E1,{title:n,primaryButtonText:r,secondaryButtonText:"Cancel",open:e,onClose:c,onClick:()=>a(),permissionButton:l,fullWidth:!0,children:[t.jsxs(Ln,{icon:!1,children:["There is a scheduled time to apply these changes set for"," ",t.jsxs("strong",{children:[t.jsx("br",{}),`${new Date(i).toLocaleString()}`]})]}),t.jsx(k,{variant:"body1",children:o})]}):null,Fn=({projectId:e,environment:a,disabled:c,onConfirm:n,...r})=>t.jsx(w0,{message:"Applying the changes now means the scheduled time will be ignored",title:"Apply changes",primaryButtonText:"Apply changes now",onConfirm:n,permissionButton:t.jsx(G1,{variant:"contained",onClick:()=>n(),projectId:e,permission:k2,environmentId:a,disabled:c,children:"Apply changes now"}),...r}),Pn=({...e})=>t.jsx(w0,{message:"Rejecting this change request will delete its schedule and it can no longer be rescheduled or applied.",title:"Reject changes",primaryButtonText:"Reject changes",...e}),Rn=d(V)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(2)})),In=({open:e,onConfirm:a,onClose:c,title:n,primaryButtonText:r,projectId:o,environment:i,disabled:l,scheduledAt:h})=>{const[C,u]=s.useState(h?new Date(h):new Date),[m,p]=s.useState(void 0),j=L2();return t.jsxs(E1,{title:n,primaryButtonText:r,secondaryButtonText:"Cancel",open:e,onClose:()=>c(),onClick:()=>a(C),permissionButton:t.jsx(G1,{variant:"contained",onClick:()=>a(C),projectId:o,permission:k2,environmentId:i,disabled:l,children:r}),fullWidth:!0,children:[t.jsx(h1,{severity:"info",sx:{mb:g=>g.spacing(2)},children:"The time shown below is based on your browser's time zone."}),t.jsx(k,{variant:"body1",sx:{mb:g=>g.spacing(4)},children:"Select the date and time when these changes should be applied. If you change your mind later, you can reschedule the changes or apply them immediately."}),t.jsxs(Rn,{children:[t.jsx(Y7,{label:"Date",value:C,onChange:g=>{p(void 0),g<new Date&&p(`The time you provided (${g.toLocaleString()}) is not valid because it's in the past. Please select a time in the future.`),u(g)},min:new Date,error:!!m,errorText:m,required:!0}),t.jsxs(k,{variant:"body2",children:["Your browser's time zone is ",j]})]})]})},Bn=d(V)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),On=d(O1)(({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%"}})),$n=d(V)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),zn=d(V)(({theme:e})=>({padding:e.spacing(2)})),Q4=d(d1)(({theme:e})=>({marginLeft:e.spacing(2)})),Nn=d(V)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Wn=()=>{var w3,J1;const e=W("projectId"),[a,c]=s.useState(!1),[n,r]=s.useState(!1),[o,i]=s.useState(!1),[l,h]=s.useState(!1),[C,u]=s.useState(!1),{user:m}=z6(),{isAdmin:p}=s.useContext($1),[j,g]=s.useState(""),y=W("id"),{data:v,refetchChangeRequest:f}=h0(e,y),{changeState:E,addComment:b,loading:L}=V2(),{refetch:I}=S2(e),{setToastData:_,setToastApiError:F}=o1(),{isChangeRequestConfiguredForReview:w}=d3(e),O=h3("scheduledConfigurationChanges");if(!v)return null;const B=w(v.environment),z=()=>{switch(v.state){case"Scheduled":return`${v.state} ${v.schedule.status}`;default:return v.state}},A=async()=>{try{await E(e,Number(y),z(),{state:"Applied"}),h(!1),f(),I(),_({type:"success",title:"Success",text:"Changes applied"})}catch(Y){F(c1(Y))}},P=async Y=>{try{await E(e,Number(y),z(),{state:"Scheduled",scheduledAt:Y.toISOString()}),i(!1),f(),I(),_({type:"success",title:"Success",text:"Changes scheduled"})}catch(_1){F(c1(_1))}},x=async()=>{try{await b(e,y,j),g(""),f(),_({type:"success",title:"Success",text:"Comment added"})}catch(Y){F(c1(Y))}},Z=async()=>{try{await E(e,Number(y),z(),{state:"Cancelled"}),c(!1),f(),I(),_({type:"success",title:"Success",text:"Changes cancelled"})}catch(Y){F(c1(Y))}},R=async Y=>{try{await E(e,Number(y),z(),{state:"Rejected",comment:Y}),r(!1),_({type:"success",title:"Success",text:"Changes rejected"}),f(),I()}catch(_1){F(c1(_1))}},M=async()=>{try{await E(e,Number(y),z(),{state:"Approved"}),f(),I(),_({type:"success",title:"Success",text:"Changes approved"})}catch(Y){F(c1(Y))}},N=()=>c(!0),T=()=>c(!1),U=()=>r(!1),D=()=>h(!1),K=()=>i(!1),y1=()=>u(!1),u1=(v==null?void 0:v.createdBy.id)===(m==null?void 0:m.id)&&v.state==="In review"&&!p,I1=(w3=v.approvals)==null?void 0:w3.some(Y=>Y.createdBy.id===(m==null?void 0:m.id)),i1=Q7(v);(()=>{if("schedule"in v)switch(v.schedule.status){case"failed":return(v.schedule.reason||v.schedule.failureReason)??void 0;case"suspended":return v.schedule.reason;default:return}})();const p1="schedule"in v?v.schedule.scheduledAt:void 0,K3=v.state==="Scheduled"?{state:"Scheduled",schedule:v.schedule}:{state:v.state,schedule:void 0};return t.jsxs(t.Fragment,{children:[t.jsx(ra,{changeRequest:v}),t.jsxs(Nn,{children:[t.jsxs(Bn,{children:[t.jsx(Ja,{...K3}),t.jsx(Mn,{changeRequest:v})]}),t.jsx(On,{elevation:0,children:t.jsxs(zn,{children:["Requested Changes (",i1,")",t.jsx(X7,{changeRequest:v,onRefetch:f}),(J1=v.comments)==null?void 0:J1.map(Y=>t.jsx(xn,{comment:Y},Y.id)),t.jsx(e8,{user:m,commentText:j,onTypeComment:g,children:t.jsx(d1,{variant:"outlined",onClick:x,disabled:!B||j.trim().length===0||j.trim().length>1e3,children:"Comment"})}),t.jsx(S,{condition:u1,show:t.jsx(h1,{sx:Y=>({marginTop:Y.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),t.jsx(lc,{changeRequest:v,onEditClick:()=>i(!0)}),t.jsxs($n,{children:[t.jsx(S,{condition:v.state==="In review"&&!I1,show:t.jsxs(Sc,{onReject:()=>r(!0),onApprove:M,disabled:!B,children:["Review changes (",i1,")"]})}),t.jsx(S,{condition:v.state==="Approved",show:t.jsx(S,{condition:O,show:t.jsx(Y4,{onApply:A,disabled:!B||L,onSchedule:()=>i(!0),children:"Apply or schedule changes"}),elseShow:t.jsx(G1,{variant:"contained",onClick:A,projectId:e,permission:k2,environmentId:v.environment,disabled:!B||L,children:"Apply changes"})})}),t.jsx(S,{condition:O&&v.state==="Scheduled",show:t.jsx(Y4,{onApply:()=>h(!0),disabled:!B||L,onSchedule:()=>i(!0),variant:"update",children:"Apply or schedule changes"})}),t.jsx(S,{condition:v.state!=="Applied"&&v.state!=="Rejected"&&v.state!=="Cancelled"&&(v.createdBy.id===(m==null?void 0:m.id)||p),show:t.jsx(S,{condition:O&&!!p1,show:t.jsx(Q4,{variant:"outlined",onClick:()=>u(!0),children:"Reject changes"}),elseShow:t.jsx(Q4,{variant:"outlined",onClick:N,children:"Cancel changes"})})})]})]})}),t.jsxs(E1,{open:a,onClick:Z,onClose:T,title:"Cancel change request",children:[t.jsx(k,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),t.jsx(k,{variant:"body2",sx:Y=>({color:Y.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."})]}),t.jsx(Hn,{open:n,onConfirm:R,onClose:U}),t.jsx(S,{condition:O,show:t.jsxs(t.Fragment,{children:[t.jsx(In,{open:o,onConfirm:P,onClose:K,disabled:!B||L,projectId:e,environment:v.environment,primaryButtonText:v.state==="Scheduled"?"Update scheduled time":"Schedule changes",title:v.state==="Scheduled"?"Update schedule":"Schedule changes",scheduledAt:p1}),t.jsx(Fn,{open:l,onConfirm:A,onClose:D,scheduledTime:p1,disabled:!B||L,projectId:e,environment:v.environment}),t.jsx(Pn,{open:C,onConfirm:R,onClose:y1,scheduledTime:p1})]})})]})]})},qn=({value:e,row:{original:a}})=>{const c=()=>e?t.jsx(O6,{changeRequest:a}):null;return e?t.jsx(Q,{children:c()}):t.jsx(Q,{})},Un=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),Gn=({value:e})=>{const{searchQuery:a}=k5();return t.jsx(Q,{children:t.jsx(Un,{children:t.jsxs(k,{component:"span",variant:"body2",children:[" ",t.jsx(C2,{search:a,children:e==null?void 0:e.username})]})})})},Jn=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),Kn=({value:e,row:{original:a}})=>{const{searchQuery:c}=k5(),n=W("projectId"),{id:r,title:o,features:i,segments:l}=a,h=(i||[]).length+(l||[]).length,C=`/projects/${n}/change-requests/${r}`;return e?t.jsxs(Q,{sx:{minWidth:"200px"},children:[t.jsx(Jn,{children:t.jsx(k,{variant:"body2",children:t.jsx(C3,{component:v1,underline:"hover",to:C,sx:u=>({paddingTop:u.spacing(.2),marginRight:u.spacing(1),"&:hover":{textDecoration:"underline"}}),children:t.jsx(C2,{search:c,children:o})})})}),t.jsxs("span",{children:[`${h}`," ",h<=1?"update":"updates"]})]}):t.jsx(Q,{})},Yn=t8()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(2,4,4,4),overflowX:"auto"}})),Qn=d(V)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),Xn=d(v1)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),er=d(v1)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),tr=d(V)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),ar=({value:e,project:a})=>{const{searchQuery:c}=k5(),n=e==null?void 0:e.map(r=>r.name);return t.jsx(Qn,{children:t.jsx(S,{condition:(n==null?void 0:n.length)<3,show:n==null?void 0:n.map(r=>t.jsx(Xn,{title:r,to:`/projects/${a}/features/${r}`,children:t.jsx(C2,{search:c,children:r})},r)),elseShow:t.jsxs(T5,{tooltipProps:{maxWidth:"800px"},tooltip:t.jsx(tr,{children:n==null?void 0:n.map(r=>t.jsx(er,{title:r,to:`/projects/${a}/features/${r}`,children:t.jsx(C2,{search:c,children:r})},r))}),children:[n==null?void 0:n.length," toggles"]})})})},cr={id:"createdAt",desc:!0},nr=d("div")({paddingLeft:0,paddingBottom:0}),rr=d(i2)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),sr=d(V)(({theme:e})=>({textAlign:"right",paddingBottom:e.spacing(2),fontSize:e.fontSizes.smallBody})),or=({changeRequests:e=[],loading:a,projectId:c})=>{var P,x;const{classes:n}=Yn(),r=m1(d2.breakpoints.down("md")),[o,i]=N6(),[l,h]=s.useState(o.get("search")||""),{value:C,setValue:u}=b5(`${c}:ProjectChangeRequest`,cr),[m,p]=s.useMemo(()=>{const Z=e.filter(M=>M.state!=="Cancelled"&&M.state!=="Rejected"&&M.state!=="Applied"),R=e.filter(M=>M.state==="Cancelled"||M.state==="Rejected"||M.state==="Applied");return[Z,R]},[e]),j=[{title:"Change requests",data:m},{title:"Closed",data:p}],[g,y]=s.useState(0),v=s.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:Kn},{id:"Updated feature toggles",Header:"Updated feature toggles",canSort:!1,accessor:"features",searchable:!0,filterName:"feature",filterParsing:Z=>(Z==null?void 0:Z.map(({name:R})=>R).join(`
|
|
1
|
+
import{c as Q1,j as t,eK as U0,eL as w6,eM as G0,s as d,cT as J0,cQ as i2,a5 as L3,r as s,eN as K0,ab as Q,a3 as t1,a6 as F3,a7 as P3,a8 as R3,a9 as I3,v as Z5,b7 as E1,J as h1,aN as U1,aO as L1,aP as F1,eO as E6,aE as W,eP as X1,ch as Z1,b as o1,cL as P1,az as e3,ax as a1,eQ as Y0,ae as x2,d8 as y5,eR as _6,eS as j1,au as X,ao as T1,at as n1,C as S,aK as v1,aq as l3,ap as g1,cO as Q0,ai as b5,eT as X0,T as k,c4 as C3,B as V,X as e7,aM as t7,ah as Y1,bp as a7,al as j2,a as r1,ac as m1,a_ as d3,eU as c7,y as O1,x as D1,eV as M6,P as H6,eW as A6,z as n7,eX as r7,ba as t3,bb as a3,t as S1,bg as k6,a1 as B3,bW as O3,M as H1,eY as s3,b3 as A1,d as Z2,eZ as s7,b5 as k1,e_ as z1,cW as V5,cX as T6,aJ as y2,c_ as o7,D as D6,l as S5,e$ as i7,aj as f1,h as d1,f0 as l7,f1 as C7,bJ as d7,f as c1,c5 as h7,bU as b2,c6 as L6,aV as V2,aW as S2,f2 as w5,dF as E5,ci as h3,ay as R1,f3 as u7,cP as m7,c9 as _5,am as w2,cC as N1,f4 as p7,f5 as v7,cH as _3,cK as m4,f6 as g7,cI as q2,f7,cJ as x7,f8 as p4,f9 as j7,fa as Z7,fb as y7,fc as b7,cR as V7,fd as v4,fe as S7,ff as w7,fg as E7,fh as F6,fi as _7,dq as E2,fj as M7,fk as H7,fl as A7,fm as k7,fn as T7,fo as D7,aQ as M5,fp as H5,fq as h5,a0 as L7,cU as P6,fr as F7,c0 as R6,fs as I6,ft as B6,fu as P7,fv as R7,fw as I7,a4 as u3,af as m3,ag as _2,aG as B7,fx as O7,fy as $3,fz as $7,fA as O6,fB as z7,fC as N7,fD as p3,fE as c3,aH as M2,fF as v3,fG as g3,_ as C1,fH as f3,fI as x3,fJ as W7,b_ as H2,fK as A2,E as l2,c8 as A5,fL as $6,fM as q7,aL as z3,fN as U7,bs as $1,aw as z6,bI as G1,fO as G7,fP as J7,fQ as K7,k as N3,fR as k2,fS as Y7,fT as Q7,fU as X7,fV as e8,dV as k5,dW as C2,fW as t8,br as T5,cB as d2,ak as N6,dN as h2,an as D5,fX as a8,cZ as L5,dj as j3,cl as q1,aI as o3,bX as F5,dz as P5,A as W6,dc as c8,m as q6,n as U6,aD as W1,aA as Z3,fY as n8,fZ as r8,dD as e2,f_ as s8,f$ as o8,g0 as i8,g1 as U2,g2 as l8,g3 as C8,cj as y3,ck as J,g4 as d8,g5 as h8,g6 as g4,g7 as f4,g8 as G6,g9 as u8,u as T2,aB as m8,ga as p8,db as v8,gb as x4,gc as g8,gd as f8,ge as x8,gf as j8,gg as Z8,bm as y8,bn as b8,bO as V8,bP as S8,bQ as w8,bR as E8,R as _8,gh as M8,gi as H8,cb as A8,gj as k8,w as j4,cq as T8,gk as J6,gl as D8,gm as K6,gn as L8,bZ as F8,go as P8,gp as R8,gq as I8,ds as Z4,eE as B8,gr as O8,eH as $8,d3 as y4,d0 as z8,cS as Y6,eC as u5,gs as N8,dx as Q6,gt as i3,gu as G,gv as W8,gw as q8,gx as U8,gy as G8,cv as X6,gz as J8,G as s2,bu as K8,gA as Y8,gB as Q8,gC as X8}from"./index-uUGk-gee.js";import{e as e0,W as b4,c as e9,b as t0,T as t9,d as a9,F as c9,V as n9,f as r9,a as s9,E as o9}from"./FeatureArchiveDialog-ctoNJoqg.js";import{i as i9,m as l9,j as V4,b as C9,c as d9,d as h9,e as u9,E as m9,f as p9,u as v9,a as g9,R as f9,C as x9,A as j9,g as a0}from"./RoleCell--QIy8Oj_.js";import{S as Z9}from"./StrategyItemContainer-X6EIzBwJ.js";import{C as y9,u as b9,P as V9,D as S9}from"./useProjectForm-oXjjbjX3.js";const w9=Q1(t.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),E9=Q1(t.jsx("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),_9=Q1(t.jsx("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),M9=Q1(t.jsx("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"),H9=Q1(t.jsx("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),A9=Q1([t.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},"0"),t.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"Schedule"),k9=Q1(t.jsx("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function T9(e,a){U0(2,arguments);var c=G0(a);return w6(e,-c)}const S4=d("div")(()=>({display:"flex"})),D9=d("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));d("div")(()=>({display:"flex",flexDirection:"column"}));const L9=d("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),F9=d("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));d(F9)(({theme:e})=>({color:e.palette.neutral.dark}));const P9=d(J0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),R9=d("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),I9=d("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),B9=d("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),O9=d("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),$9=d("div")(({theme:e})=>({padding:e.spacing(0,4)})),z9=d(i2)(({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}})),N9=e=>e.reduce((a,c)=>c.enabled?a+1:a,0),W9=d(L3)(({theme:e})=>({marginTop:e.spacing(3)})),q9=d("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:a})=>({color:a?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),U9=({environment:e,warnEnabledToggles:a})=>{const c=s.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:h}})=>t.jsx(K0,{environment:h})},{Header:"Name",accessor:"name",Cell:Q},{Header:"Type",accessor:"type",Cell:Q},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:h})=>t.jsx(Q,{children:t.jsx(q9,{warning:h>0,children:h===1?"1 toggle":`${h} toggles`})}),align:"center"}],[a]),{getTableProps:n,getTableBodyProps:r,headerGroups:o,rows:i,prepareRow:l}=t1.useTable({columns:c,data:[e],disableSortBy:!0});return t.jsxs(W9,{...n(),rowHeight:"compact",children:[t.jsx(F3,{headerGroups:o}),t.jsx(P3,{...r(),children:i.map(h=>(l(h),t.jsx(R3,{hover:!0,...h.getRowProps(),children:h.cells.map(C=>t.jsx(I3,{...C.getCellProps(),children:C.render("Cell")}))})))})]})},G9=d("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),J9=d(Z5)(()=>({width:"100%"})),K9=({environment:e,open:a,setOpen:c,onConfirm:n})=>{const[r,o]=s.useState("");return s.useEffect(()=>{o("")},[a]),t.jsxs(E1,{title:"Hide environment and disable feature toggles?",open:a,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==r,secondaryButtonText:"Close",onClick:n,onClose:()=>{c(!1)},children:[t.jsxs(h1,{severity:"error",children:[t.jsx("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.jsx(U9,{environment:e}),t.jsxs(G9,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",t.jsx("strong",{children:e==null?void 0:e.name})]}),t.jsx(J9,{label:"Environment name",value:r,onChange:i=>o(i.target.value)})]})},Y9=e=>{const{data:a,error:c,mutate:n}=U1(L1(`api/admin/environments/project/${e}`),Q9),r=s.useMemo(()=>a||[],[a]),o=s.useCallback(async()=>{await n()},[n]);return{environments:r,refetchEnvironments:o,loading:!c&&!a,error:c}},Q9=async e=>(await fetch(e).then(F1("Environments")).then(c=>c.json())).environments.sort((c,n)=>c.sortOrder-n.sortOrder),X9=d(h1)(({theme:e})=>({marginBottom:e.spacing(4)})),ee=d("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),te=d(E6)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),c0=()=>{const e=W("projectId"),a=X1(e);Z1(`Project environments – ${a}`);const{setToastData:c,setToastApiError:n}=o1(),{environments:r,loading:o,error:i,refetchEnvironments:l}=Y9(e),{project:h,refetch:C}=P1(e),{removeEnvironmentFromProject:u,addEnvironmentToProject:m}=e3(),[p,j]=s.useState(),[g,y]=s.useState(!1),{isOss:v}=a1(),f=s.useMemo(()=>r.map(M=>({...M,projectVisible:h==null?void 0:h.environments.map(N=>N.environment).includes(M.name)})),[r,h==null?void 0:h.environments]),E=()=>{l(),C()},b=()=>t.jsx(te,{onClick:E,text:"Error fetching environments"}),L=M=>`Got an API error when trying to set the environment as ${M?"visible":"hidden"}`,I=async M=>{if(M.projectVisible){if(N9(f)>1){j(M),y(!0);return}c({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await m(e,M.name),E(),c({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{n(L(!0))}},_=async()=>{if(p)try{await u(e,p.name),E(),c({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{n(L(!1))}finally{y(!1)}},F=M=>v()&&M==="default",w=s.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:M}})=>t.jsx(Y0,{environment:M})},{Header:"Type",accessor:"type",Cell:x2},{Header:"Project API tokens",accessor:M=>M.projectApiTokenCount===1?"1 token":`${M.projectApiTokenCount} tokens`,Cell:Q},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:M}})=>t.jsx(y5,{children:t.jsx(_6,{tooltip:M.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:F(M.name),projectId:e,permission:j1,checked:M.projectVisible,onChange:()=>I(M)})}),disableGlobalFilter:!0}],[f]),{getTableProps:O,getTableBodyProps:B,headerGroups:z,rows:A,prepareRow:P,state:{globalFilter:x},setGlobalFilter:Z}=t1.useTable({columns:w,data:f,disableSortBy:!0},t1.useGlobalFilter),R=t.jsx(X,{title:`Environments (${A.length})`,actions:t.jsx(T1,{initialValue:x,onChange:Z})});return t.jsx(n1,{header:R,isLoading:o,children:t.jsxs(ee,{children:[t.jsx(S,{condition:!!i,show:b()}),t.jsxs(X9,{severity:"info",children:[t.jsx("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.jsx(v1,{to:"/admin/api",children:"API tokens here"}),".",t.jsx("br",{}),t.jsx("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",t.jsx(v1,{to:"/admin/api",children:"create a new API token here"}),"."]}),t.jsx(l3,{value:x,children:t.jsxs(L3,{...O(),rowHeight:"compact",children:[t.jsx(F3,{headerGroups:z}),t.jsx(P3,{...B(),children:A.map(M=>(P(M),t.jsx(R3,{hover:!0,...M.getRowProps(),children:M.cells.map(N=>t.jsx(I3,{...N.getCellProps(),children:N.render("Cell")}))})))})]})}),t.jsx(S,{condition:A.length===0,show:t.jsx(S,{condition:(x==null?void 0:x.length)>0,show:t.jsxs(g1,{children:["No environments found matching “",x,"”"]}),elseShow:t.jsx(g1,{children:"No environments available. Get started by adding one."})})}),t.jsx(K9,{environment:p,open:g,setOpen:y,onConfirm:_})]})})},ae={id:"archivedAt"},ce=({projectId:e})=>{const{archivedFeatures:a,loading:c,refetchArchived:n}=Q0(e),{value:r,setValue:o}=b5(`${e}:ProjectFeaturesArchiveTable`,ae);return t.jsx(X0,{title:"Project archive",archivedFeatures:a||[],loading:c,storedParams:r,setStoredParams:o,refetch:n,projectId:e})},ne=()=>{const e=W("projectId"),a=X1(e);return Z1(`Project archive – ${a}`),t.jsx(ce,{projectId:e})},W3=d("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)}})),q3=d("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),R5=d("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),D2=({children:e,to:a})=>t.jsx(k,{"data-loading":!0,variant:"body2",textAlign:"center",sx:{paddingTop:c=>c.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:t.jsx(C3,{component:v1,to:a,children:e})}),re=d("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),se=d("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),oe=({projectId:e,health:a})=>t.jsxs(W3,{children:[t.jsx(q3,{"data-loading":!0,children:"Project health"}),t.jsxs(V,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:c=>c.spacing(2)},children:[t.jsx(se,{"data-loading":!0,children:t.jsx(e7,{percentage:a})}),t.jsxs(re,{"data-loading":!0,children:[a,"%"]})]}),t.jsx(D2,{to:`/projects/${e}/health`,children:"View project health"})]}),ie=d(R5)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),le=d("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}})),Ce=({type:e,Icon:a,count:c})=>{const n=r=>r.charAt(0).toUpperCase()+r.slice(1).replace("-"," ");return t.jsxs(le,{"data-loading":!0,children:[t.jsx(a,{fontSize:"small","data-loading":!0}),t.jsx("div",{children:n(e)}),t.jsx(ie,{children:c})]})},de=({featureTypeCounts:e})=>{const a=s.useMemo(()=>{var l,h,C,u,m;const c=((l=e.find(p=>p.type==="release"))==null?void 0:l.count)||0,n=((h=e.find(p=>p.type==="experiment"))==null?void 0:h.count)||0,r=((C=e.find(p=>p.type==="operational"))==null?void 0:C.count)||0,o=((u=e.find(p=>p.type==="kill-switch"))==null?void 0:u.count)||0,i=((m=e.find(p=>p.type==="permission"))==null?void 0:m.count)||0;return{release:c,experiment:n,operational:r,"kill-switch":o,permission:i}},[e]);return t.jsxs(W3,{sx:{padding:c=>c.spacing(3)},children:[t.jsx(q3,{"data-loading":!0,children:"Toggle types used"}),Object.keys(a).map(c=>t.jsx(Ce,{type:c,Icon:t7(c),count:a[c]},c))]})},he=d("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})),ue=({id:e,description:a})=>t.jsxs(W3,{children:[t.jsx(q3,{"data-loading":!0,children:"Project Meta"}),t.jsxs(he,{"data-loading":!0,children:[t.jsx(k,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",t.jsx("code",{"data-loading":!0,children:e||"__________"})]}),t.jsx(S,{condition:!!a,show:t.jsx(k,{"data-loading":!0,variant:"body2",sx:{marginTop:c=>c.spacing(1.5),marginBottom:0,textAlign:"left"},children:a})}),t.jsx(S,{condition:!a,show:t.jsx(D2,{to:`/projects/${e}/settings`,children:"Add description"})})]}),me=d(k)(({theme:e})=>({marginBottom:e.spacing(2.5)})),pe=d(V)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),G2=d(V)(({theme:e})=>({...Y1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),w4=d(k)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ve=d(k)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),ge=e=>e>0?t.jsx(E9,{sx:{color:"success.dark",height:20,width:20}}):t.jsx(k9,{sx:{color:"warning.dark",height:20,width:20}}),fe=e=>e>0?"success.dark":"warning.dark",A3=({title:e,boxText:a,change:c,percentage:n,children:r,customChangeElement:o})=>t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!!e,show:t.jsx(me,{"data-loading":!0,children:e})}),r,t.jsxs(V,{sx:{...Y1,justifyContent:"center",width:"auto"},children:[t.jsx(pe,{"data-loading":!0,children:a}),t.jsx(S,{condition:!!o,show:t.jsx(G2,{"data-loading":!0,children:o}),elseShow:t.jsx(S,{condition:c!==void 0&&c!==0,show:t.jsxs(G2,{"data-loading":!0,children:[t.jsxs(V,{sx:{...Y1},children:[ge(c),t.jsxs(ve,{color:fe(c),children:[c>0?"+":"",c,n?"%":""]})]}),t.jsx(w4,{children:"this month"})]}),elseShow:t.jsx(G2,{children:t.jsx(w4,{"data-loading":!0,children:"No change"})})})})]})]}),xe=({projectId:e,memberCount:a,change:c=0})=>{var o,i;const{uiConfig:n}=a1();let r="/admin/users";return(i=(o=n==null?void 0:n.versionInfo)==null?void 0:o.current)!=null&&i.enterprise&&(r=`/projects/${e}/settings/access`),t.jsxs(W3,{children:[t.jsx(q3,{"data-loading":!0,children:"Project members"}),t.jsx(V,{"data-loading":!0,sx:{display:"flex",justifyContent:"center"},children:t.jsx(A3,{boxText:`${a}`,change:c})}),t.jsx(D2,{"data-loading":!0,to:r,children:"View all members"})]})},je=e=>fetch(e).then(F1("ChangeRequest")).then(a=>a.json()),n0=e=>{const{data:a,error:c,mutate:n}=a7([],L1(`api/admin/projects/${e}/change-requests`),je);return s.useMemo(()=>({changeRequests:a,loading:!c&&!a,refetch:n,error:c}),[a,c,n])},o2="change-requests-widget",Ze=d(V)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),E4=d(V)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),_4=d(V)(({theme:e})=>({display:"flex",alignItems:"center"})),ye=d(R5)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),be=d(R5)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),M4=d(k)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),H4=()=>t.jsx(k,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":o2,children:"change requests"}),Ve=({projectId:e})=>{const{changeRequests:a,loading:c}=n0(e),n=j2(c,`[data-loading="${o2}"]`),r=a==null?void 0:a.filter(i=>(i==null?void 0:i.state)==="Approved").length,o=a==null?void 0:a.filter(i=>(i==null?void 0:i.state)==="In review").length;return t.jsxs(W3,{ref:n,children:[t.jsx(q3,{children:"Open change requests"}),t.jsxs(Ze,{children:[t.jsxs(E4,{sx:{background:i=>i.palette.success.light},children:[t.jsx(M4,{children:"To be applied"}),t.jsxs(_4,{children:[t.jsx(ye,{"data-loading":o2,children:r||0})," ",t.jsx(H4,{})]})]}),t.jsxs(E4,{sx:{background:i=>i.palette.secondary.light},children:[t.jsx(M4,{children:"To be reviewed"}),t.jsxs(_4,{children:[t.jsx(be,{"data-loading":o2,children:o||0})," ",t.jsx(H4,{})]})]})]}),t.jsx(D2,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},Se=d(V)(({theme:e})=>({...Y1,width:"225px",flexDirection:"column",gap:e.spacing(2),boxShadow:"none",[e.breakpoints.down("md")]:{display:"grid",width:"100%",alignItems:"stretch"},[e.breakpoints.down("sm")]:{display:"flex"}})),we=({id:e,description:a,memberCount:c,health:n,featureTypeCounts:r,stats:o})=>{const{isEnterprise:i}=a1(),l=r1(),h=m1(l.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:C}=d3(e),u=i()&&C(),m=e!==c7,p=!u&&!m||h&&u&&m;return t.jsx("aside",{children:t.jsxs(Se,{sx:p?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[t.jsx(S,{condition:u,show:t.jsx(V,{sx:{gridColumnStart:m?"span 2":"span 1",flex:1,display:"flex"},children:t.jsx(Ve,{projectId:e})})}),t.jsx(ue,{id:e,description:a}),t.jsx(oe,{projectId:e,health:n}),t.jsx(S,{condition:m,show:t.jsx(xe,{projectId:e,memberCount:c,change:o==null?void 0:o.projectMembersAddedCurrentWindow})}),t.jsx(de,{featureTypeCounts:r})]})})},Ee=d(O1)(({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})),A4=({children:e,id:a})=>{const[c,n]=s.useState(null),r=l=>n(l.currentTarget),o=()=>n(null),i=!!c;return t.jsxs(V,{sx:{position:"absolute",top:l=>l.spacing(.5),right:l=>l.spacing(.5)},children:[t.jsx(D1,{onClick:r,"aria-describedby":a,size:"small",children:t.jsx(M6,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),t.jsx(H6,{id:a,open:i,anchorEl:c,sx:l=>({zIndex:l.zIndex.tooltip}),children:t.jsx(A6,{onClickAway:o,children:t.jsxs(Ee,{elevation:3,children:[t.jsx(D1,{onClick:o,sx:{position:"absolute",right:4,top:4},children:t.jsx(n7,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),e,t.jsx(r7,{id:a,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},_e=d(V)(({theme:e})=>({display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(4, 1fr)",flexWrap:"wrap",[e.breakpoints.down("lg")]:{gridTemplateColumns:"repeat(2, 1fr)"},[e.breakpoints.down("sm")]:{flexDirection:"column"}})),t2=d(V)(({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)}})),Me=d(k)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),He=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:a,projectActivityCurrentWindow:c,projectActivityPastWindow:n,createdCurrentWindow:r,createdPastWindow:o,archivedCurrentWindow:i,archivedPastWindow:l}=e;return t.jsxs(_e,{children:[t.jsx(t2,{children:t.jsx(A3,{title:"Total changes",boxText:String(c),change:c-n,children:t.jsx(A4,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),t.jsx(t2,{children:t.jsx(A3,{title:"Avg. time to production",boxText:t.jsxs(V,{sx:{display:"flex",alignItems:"center",gap:h=>h.spacing(1)},children:[a," ",t.jsx(k,{component:"span",children:"days"})]}),customChangeElement:t.jsx(Me,{children:"In project life"}),percentage:!0,children:t.jsx(A4,{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.jsx(t2,{children:t.jsx(A3,{title:"Features created",boxText:String(r),change:r-o})}),t.jsx(t2,{children:t.jsx(A3,{title:"Features archived",boxText:String(i),change:i-l})})]})};var I5={},Ae=a3;Object.defineProperty(I5,"__esModule",{value:!0});var r0=I5.default=void 0,ke=Ae(t3()),Te=t,De=(0,ke.default)((0,Te.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd");r0=I5.default=De;var B5={},Le=a3;Object.defineProperty(B5,"__esModule",{value:!0});var s0=B5.default=void 0,Fe=Le(t3()),Pe=t,Re=(0,Fe.default)((0,Pe.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");s0=B5.default=Re;var O5={},Ie=a3;Object.defineProperty(O5,"__esModule",{value:!0});var o0=O5.default=void 0,Be=Ie(t3()),Oe=t,$e=(0,Be.default)((0,Oe.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");o0=O5.default=$e;const ze=d(V)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),Ne=({projectId:e,row:a,onOpenArchiveDialog:c,onOpenStaleDialog:n})=>{const[r,o]=s.useState(null),[i,l]=s.useState(!1),{setToastData:h}=o1(),{original:{name:C,stale:u}}=a,m=!!r,p=f=>{o(f.currentTarget)},j=()=>{o(null)},g=`feature-${C}-actions`,y=`${g}-menu`,v=()=>{try{o7(C),l(!0),setTimeout(()=>{j(),l(!1)},1e3)}catch{h({type:"error",title:"Could not copy feature name"})}};return t.jsxs(ze,{children:[t.jsx(S1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:t.jsx(D1,{id:g,"data-loading":!0,"aria-controls":m?y:void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:p,type:"button",children:t.jsx(k6,{})})}),t.jsx(B3,{id:y,anchorEl:r,open:m,onClose:j,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:t.jsxs(O3,{"aria-labelledby":g,children:[t.jsxs(H1,{sx:s3,onClick:v,children:[t.jsx(A1,{children:i?t.jsx(Z2,{}):t.jsx(s7,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:i?"Copied!":"Copy Name"})})]}),t.jsx(z1,{projectId:e,permission:V5,children:({hasAccess:f})=>t.jsxs(H1,{sx:s3,onClick:j,disabled:!f,component:v1,to:`/projects/${e}/features/${C}/copy`,children:[t.jsx(A1,{children:t.jsx(r0,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Clone"})})]})}),t.jsx(z1,{projectId:e,permission:T6,children:({hasAccess:f})=>t.jsxs(H1,{sx:s3,onClick:()=>{c(C),j()},disabled:!f,children:[t.jsx(A1,{children:t.jsx(s0,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Archive"})})]})}),t.jsx(z1,{projectId:e,permission:y2,children:({hasAccess:f})=>t.jsxs(H1,{sx:s3,onClick:()=>{j(),n({featureId:C,stale:u===!0})},disabled:!f,children:[t.jsx(A1,{children:t.jsx(o0,{})}),t.jsx(k1,{children:t.jsxs(k,{variant:"body2",children:[u?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var $5={},We=a3;Object.defineProperty($5,"__esModule",{value:!0});var i0=$5.default=void 0,qe=We(t3()),Ue=t,Ge=(0,qe.default)((0,Ue.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");i0=$5.default=Ge;const Je=d(V)(()=>({...Y1,justifyContent:"center"})),Ke=d(D1)(({theme:e})=>({margin:e.spacing(-1,0)})),Ye=d(V)(({theme:e})=>({...Y1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),Qe=d(H1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),Xe=d(D6)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),et=d(S5)(({theme:e})=>({padding:e.spacing(.75,1)})),tt=({columns:e,onToggle:a})=>{const[c,n]=s.useState(null),r=C=>{n(C.currentTarget)},o=()=>{n(null)},i=!!c,l="columns-menu",h=`columns-menu-list-${l}`;return t.jsxs(Je,{children:[t.jsx(S1,{title:"Select columns",arrow:!0,describeChild:!0,children:t.jsx(Ke,{id:l,"aria-controls":i?h:void 0,"aria-haspopup":"true","aria-expanded":i?"true":void 0,onClick:r,type:"button",size:"large","data-loading":!0,children:t.jsx(i0,{})})}),t.jsxs(B3,{id:h,open:i,anchorEl:c,onClose:o,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:C=>({borderRadius:C.shape.borderRadius,paddingBottom:C.spacing(2)})},children:[t.jsxs(Ye,{children:[t.jsx(k,{variant:"body2",children:t.jsx("strong",{children:"Columns"})}),t.jsx(D1,{onClick:o,children:t.jsx(i7,{})})]}),t.jsx(O3,{children:e.map(C=>C.id==="divider"?t.jsx(Xe,{},"divider"):t.jsxs(Qe,{onClick:()=>{a==null||a(C.id)},disabled:C.isStatic===!0&&C.isVisible===!0,children:[t.jsx(A1,{children:t.jsx(et,{edge:"start",checked:C.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":C.id},size:"medium"})}),t.jsx(k1,{id:C.id,primary:t.jsx(k,{variant:"body2",children:C.header})})]},C.id))})]})]})},at=7,ct=e=>{const a=w6(new Date,-at);return!!(e!=null&&e.lastSeenAt&&l7(new Date(e.lastSeenAt),a))},nt=({projectId:e,featureIds:a,features:c,onConfirm:n})=>{const{refetch:r}=P1(e),[o,i]=s.useState(!1),{trackEvent:l}=f1(),h=s.useMemo(()=>a.filter(u=>{const m=c.find(p=>p.name===u);return ct(m)}),[JSON.stringify(c),a]),C=async()=>{i(!1),n==null||n(),await r(),l("batch_operations",{props:{eventType:"features archived"}})};return t.jsxs(t.Fragment,{children:[t.jsx(z1,{projectId:e,permission:T6,children:({hasAccess:u})=>t.jsx(d1,{disabled:!u||o,variant:"outlined",size:"small",onClick:()=>i(!0),children:"Archive"})}),t.jsx(e0,{projectId:e,featureIds:a,featuresWithUsage:h,onConfirm:C,isOpen:o,onClose:()=>i(!1)})]})},a2="selection-actions-menu",rt=({projectId:e,data:a,onChange:c})=>{const[n,r]=s.useState(null),{staleFeatures:o}=e3(),{setToastData:i,setToastApiError:l}=o1(),{trackEvent:h}=f1(),C=!!n,u=a.map(({name:f})=>f),m=f=>{r(f.currentTarget)},p=()=>{r(null)},j=a.some(({stale:f})=>f===!0),g=a.some(({stale:f})=>f===!1),y=async()=>{try{p(),await o(e,u),c==null||c(),i({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features staled"}})}catch(f){l(c1(f))}},v=async()=>{try{p(),await o(e,u,!1),c==null||c(),i({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){l(c1(f))}};return t.jsxs(t.Fragment,{children:[t.jsx(S1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t.jsx(D1,{id:a2,"aria-controls":C?a2:void 0,"aria-haspopup":"true","aria-expanded":C?"true":void 0,onClick:m,type:"button","data-testid":C7,children:t.jsx(d7,{})})}),t.jsx(B3,{id:`${a2}-menu`,anchorEl:n,open:C,onClose:p,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:t.jsx(O3,{"aria-labelledby":`${a2}-menu`,children:t.jsx(z1,{projectId:e,permission:y2,children:({hasAccess:f})=>t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:g,show:()=>t.jsxs(H1,{onClick:y,disabled:!f,sx:{borderRadius:E=>`${E.shape.borderRadius}px`},children:[t.jsx(A1,{children:t.jsx(b4,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Mark as stale"})})]})}),t.jsx(S,{condition:j,show:()=>t.jsxs(H1,{onClick:v,disabled:!f,sx:{borderRadius:E=>`${E.shape.borderRadius}px`},children:[t.jsx(A1,{children:t.jsx(b4,{})}),t.jsx(k1,{children:t.jsx(k,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},st=d("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),k4="manage-tags-form",T4=(e,a)=>[...e,...e.some(c=>c.value===a.value&&c.type===a.type)?[]:[a]],D4=(e,a)=>e.filter(c=>!(c.value===a.value&&c.type===a.type)),ot=(e,a)=>{switch(a.type){case"add":return{...e,addedTags:T4(e.addedTags,a.payload),removedTags:D4(e.removedTags,a.payload)};case"remove":return{...e,addedTags:D4(e.addedTags,a.payload),removedTags:T4(e.removedTags,a.payload)};case"clear":return{addedTags:[],removedTags:a.payload};default:return e}},L4={name:"",description:"",icon:""},it=({open:e,initialValues:a,initialIndeterminateValues:c,onCancel:n,onSubmit:r})=>{const{tagTypes:o,loading:i}=h7(),[l,h]=s.useState(L4),[C,u]=s.useState([]),[m,p]=s.useState([]),{tags:j,refetch:g}=e9(l.name),{createTag:y}=t0(),v=j.map(({value:w})=>({title:w})),[f,E]=s.useReducer(ot,{addedTags:[],removedTags:[]}),b=(w=o.length>0?o[0]:L4)=>{h(w);const O=c.filter(({type:B})=>B===w.name);u(a.filter(({type:B})=>B===w.name).filter(({type:B,value:z})=>!O.some(A=>A.value===z&&A.type===B)).map(({value:B})=>({title:B}))),p(O.map(({value:B})=>({title:B}))),E({type:"clear",payload:[]})};s.useEffect(()=>{o.length>0&&b()},[i]);const L=(w,O)=>{O!=null&&typeof O!="string"&&(w.preventDefault(),b(O))},I=(w,O)=>y({value:w,type:O}).then(async()=>{await g(),u(B=>[...B,{title:w}]),E({type:"add",payload:{value:w,type:O}})}),_=(w,O,B,z)=>{B==="selectOption"?O.forEach(A=>{if(typeof A!="string"&&typeof A.inputValue=="string"&&A.inputValue&&A.title.startsWith("Create new value"))return I(A.inputValue,l.name);u(O),p(P=>P.filter(({title:x})=>x!==A.title)),z!=null&&z.option&&E({type:"add",payload:{value:z.option.title,type:l.name}})}):B==="clear"?(u([]),E({type:"clear",payload:a})):B==="removeOption"&&(u(O),z!=null&&z.option&&E({type:"remove",payload:{value:z.option.title,type:l.name}}))},F=()=>{b(),n()};return t.jsxs(E1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature toggle tags",onClick:()=>r(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:F,formId:k4,children:[t.jsx(k,{paragraph:!0,sx:{marginBottom:w=>w.spacing(2.5)},children:"Tags allow you to group features together"}),t.jsx("form",{id:k4,onSubmit:()=>r(f),children:t.jsxs(st,{children:[t.jsx(t9,{options:o,disabled:i||o.length===0,value:l,onChange:L},i?"loading":o.length),t.jsx(S,{condition:!i&&o.length===0,show:t.jsxs(k,{variant:"body1",children:["No"," ",t.jsx(C3,{component:v1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t.jsx(a9,{disabled:i,options:v,existingTags:a,indeterminateOptions:m,tagType:l,selectedOptions:C,onChange:_})})]})})]})},lt=({projectId:e,data:a,onChange:c})=>{const{bulkUpdateTags:n}=t0(),{setToastData:r,setToastApiError:o}=o1(),{trackEvent:i}=f1(),[l,h]=s.useState(!1),[C,u]=s.useMemo(()=>{const p=a.flatMap(({tags:g})=>g||[]).reduce((g,y)=>[...g,...g.some(v=>v.type===y.type&&v.value===y.value)?[]:[y]],[]),j=p.filter(g=>!a.every(({tags:y})=>y==null?void 0:y.some(v=>v.type===g.type&&v.value===g.value)));return[p,j]},[a]),m=async({addedTags:p,removedTags:j})=>{const g=a.map(({name:v})=>v),y={features:g,tags:{addedTags:p,removedTags:j}};try{await n(y,e);const v=p.length?`Added tags: ${p.map(({type:E,value:b})=>`${E}:${b}`).join(", ")}.`:"",f=j.length?`Removed tags: ${j.map(({type:E,value:b})=>`${E}:${b}`).join(", ")}.`:"";r({title:"Tags updated",text:`${g.length} feature toggles updated. ${v} ${f}`,type:"success",autoHideDuration:12e3}),i("batch_operations",{props:{eventType:"tags updated"}})}catch(v){o(c1(v))}c==null||c(),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(z1,{projectId:e,permission:y2,children:({hasAccess:p})=>t.jsx(d1,{disabled:!p||l,variant:"outlined",size:"small",onClick:()=>h(!0),children:"Tags"})}),t.jsx(it,{open:l,onCancel:()=>h(!1),onSubmit:m,initialValues:C,initialIndeterminateValues:u},a.length)]})},Ct=d(b2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),F4=d(h1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),dt=({showExportDialog:e,data:a,onClose:c,onConfirm:n,environments:r,projectId:o})=>{const[i,l]=s.useState(r[0]),{bulkToggleFeaturesEnvironmentOff:h}=L6(),{addChange:C}=V2(),{refetch:u}=P1(o),{setToastApiError:m,setToastData:p}=o1(),{isChangeRequestConfigured:j}=d3(o),{refetch:g}=S2(o),y=a.filter(b=>{var L,I;return((I=(L=b.environments)==null?void 0:L.find(_=>i===_.name))==null?void 0:I.enabled)===!1}).length,v=()=>r.map(b=>({key:b,label:b})),f=async()=>{try{j(i)?(await C(o,i,a.map(b=>({action:"updateEnabled",feature:b.name,payload:{enabled:!1}}))),g(),p({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(o,a.map(b=>b.name),i),u(),p({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),c(),n==null||n()}catch(b){m(c1(b))}},E=j(i)?"Add to change request":"Disable toggles";return t.jsx(E1,{open:e,title:"Disable feature toggles",onClose:c,onClick:f,primaryButtonText:E,secondaryButtonText:"Cancel",children:t.jsxs(V,{children:["You have selected ",t.jsx("b",{children:a.length})," feature toggles to disable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx(k,{children:"Select which environment to disable the features for:"}),t.jsx(Ct,{options:v(),value:i,onChange:b=>l(b)}),t.jsx(S,{condition:j(i),show:t.jsx(F4,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(S,{condition:y>0,show:t.jsxs(F4,{severity:"info",children:[y," feature"," ",y>1?"toggles are ":"toggle is ","already disabled."]})})]})})},ht=d(b2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),P4=d(h1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),ut=({showExportDialog:e,data:a,onClose:c,onConfirm:n,environments:r,projectId:o})=>{const[i,l]=s.useState(r[0]),{bulkToggleFeaturesEnvironmentOn:h}=L6(),{addChange:C}=V2(),{refetch:u}=P1(o),{setToastApiError:m,setToastData:p}=o1(),{isChangeRequestConfigured:j}=d3(o),{refetch:g}=S2(o),y=a.filter(b=>{var L,I;return((I=(L=b.environments)==null?void 0:L.find(_=>i===_.name))==null?void 0:I.enabled)===!0}).length,v=()=>r.map(b=>({key:b,label:b})),f=async()=>{try{j(i)?(await C(o,i,a.map(b=>({action:"updateEnabled",feature:b.name,payload:{enabled:!0}}))),g(),p({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(o,a.map(b=>b.name),i),u(),p({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),c(),n==null||n()}catch(b){m(c1(b))}},E=j(i)?"Add to change request":"Enable toggles";return t.jsx(E1,{open:e,title:"Enable feature toggles",onClose:c,onClick:f,primaryButtonText:E,secondaryButtonText:"Cancel",children:t.jsxs(V,{children:["You have selected ",t.jsx("b",{children:a.length})," feature toggles to enable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx(k,{children:"Select which environment to enable the features for:"}),t.jsx(ht,{options:v(),value:i,onChange:b=>l(b)}),t.jsx(S,{condition:j(i),show:t.jsx(P4,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(S,{condition:y>0,show:t.jsxs(P4,{severity:"info",children:[y," feature"," ",y>1?"toggles are ":"toggle is ","already enabled."]})})]})})},mt=({selectedIds:e,data:a,projectId:c,onResetSelection:n,onChange:r})=>{var b,L;const{uiConfig:o}=a1(),[i,l]=s.useState(!1),[h,C]=s.useState(!1),[u,m]=s.useState(!1),{trackEvent:p}=f1(),j=s.useMemo(()=>a.filter(I=>e.includes(I.name)),[a,e]),g=s.useMemo(()=>{const I=j.flatMap(_=>_.environments).map(_=>_==null?void 0:_.name).filter(_=>_!==void 0);return Array.from(new Set(I))},[j]),y=()=>{r==null||r(),p("batch_operations",{props:{eventType:"features exported"}})},v=()=>{r==null||r(),p("batch_operations",{props:{eventType:"features enabled"}})},f=()=>{r==null||r(),p("batch_operations",{props:{eventType:"features disabled"}})},E=()=>{r==null||r(),n()};return t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!!((b=o==null?void 0:o.flags)!=null&&b.disableBulkToggle),show:null,elseShow:t.jsx(d1,{variant:"outlined",size:"small",onClick:()=>C(!0),children:"Enable"})}),t.jsx(S,{condition:!!((L=o==null?void 0:o.flags)!=null&&L.disableBulkToggle),show:null,elseShow:t.jsx(d1,{variant:"outlined",size:"small",onClick:()=>m(!0),children:"Disable"})}),t.jsx(nt,{projectId:c,featureIds:e,features:a,onConfirm:E}),t.jsx(d1,{variant:"outlined",size:"small",onClick:()=>l(!0),children:"Export"}),t.jsx(lt,{projectId:c,data:j,onChange:r}),t.jsx(rt,{projectId:c,data:j,onChange:r}),t.jsx(w5,{showExportDialog:i,data:j,onClose:()=>l(!1),environments:g,onConfirm:y}),t.jsx(ut,{showExportDialog:h,data:j,onClose:()=>C(!1),environments:g,projectId:c,onConfirm:v}),t.jsx(dt,{showExportDialog:u,data:j,onClose:()=>m(!1),environments:g,projectId:c,onConfirm:f})]})},pt=d(E5)(()=>({whiteSpace:"nowrap"})),vt=({isLoading:e,totalItems:a,searchQuery:c,onChangeSearchQuery:n,environmentsToExport:r,actions:o})=>{const i=W("projectId"),l=j2(e||!1),[h,C]=s.useState(!0),u=r1(),m=m1(u.breakpoints.down("md")),p=h3("featuresExportImport"),[j,g]=s.useState(!1),y=R1(),{trackEvent:v}=f1(),f=E=>{n==null||n(E),v("search-bar",{props:{screen:"project",length:E.length}})};return t.jsx(V,{ref:l,"aria-busy":e,"aria-live":"polite",sx:E=>({padding:`${E.spacing(2.5)} ${E.spacing(3.125)}`}),children:t.jsx(X,{titleElement:h?`Feature toggles ${a!==void 0?`(${a})`:""}`:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!m,show:t.jsx(T1,{"data-loading":!0,placeholder:"Search and Filter",expandable:!0,initialValue:c||"",onChange:f,onFocus:()=>C(!1),onBlur:()=>C(!0),hasFilters:!0,id:"projectFeatureToggles"})}),o,t.jsx(X.Divider,{sx:{marginLeft:0}}),t.jsx(S,{condition:p,show:t.jsxs(t.Fragment,{children:[t.jsx(S1,{title:"Export all project toggles",arrow:!0,children:t.jsx(D1,{"data-loading":!0,onClick:()=>g(!0),sx:E=>({marginRight:E.spacing(2)}),children:t.jsx(u7,{})})}),t.jsx(S,{condition:!e,show:t.jsx(w5,{showExportDialog:j,project:i,data:[],onClose:()=>g(!1),environments:r||[]})})]})}),t.jsx(pt,{onClick:()=>y(m7(i)),maxWidth:"960px",Icon:_5,projectId:i,permission:V5,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:t.jsx(S,{condition:m,show:t.jsx(T1,{initialValue:c||"",onChange:f,hasFilters:!0,id:"projectFeatureToggles"})})})})},l0=({row:e})=>t.jsx(w2,{title:e.original.name||"",subtitle:e.original.description||"",to:e.original.project&&e.original.name?`/projects/${e.original.project}/features/${e.original.name}`:void 0}),gt=d("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:a})=>({flexGrow:0,...Y1,justifyContent:"center",...a&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),ft=({value:e,featureId:a,projectId:c,environment:n,isChangeRequestEnabled:r,someEnabledEnvironmentHasVariants:o,refetch:i,onFeatureToggleSwitch:l})=>{const h=s.useMemo(()=>o&&(n==null?void 0:n.variantCount)===0&&(n==null?void 0:n.enabled),[o,n]),C=(u,m)=>{l(u,{projectId:c,featureId:a,environmentName:(n==null?void 0:n.name)||"",environmentType:n==null?void 0:n.type,hasStrategies:n==null?void 0:n.hasStrategies,hasEnabledStrategies:n==null?void 0:n.hasEnabledStrategies,isChangeRequestEnabled:r,onRollback:m,onSuccess:i})};return t.jsxs(gt,{hasWarning:h,children:[t.jsx(c9,{projectId:c,value:e,featureId:a,environmentName:(n==null?void 0:n.name)||"",onToggle:C}),t.jsx(S,{condition:h||!1,show:t.jsx(n9,{})})]})},xt=N1.memo(ft),jt=({state:e,onChange:a})=>{const{tags:c}=p7(),[n,r]=s.useState([]);return s.useEffect(()=>{const i=[{label:"Tags",icon:"label",options:(c||[]).map(l=>({label:`${l.type}:${l.value}`,value:`${l.type}:${l.value}`})),filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]}];r(i)},[JSON.stringify(c)]),t.jsx(v7,{availableFilters:n,state:e,onChange:a})},c2=["select","actions","name","favorite"],n2=(e,a)=>e.reduce((c,n)=>({...c,[n]:a.includes(n)}),{}),Zt=e=>{const a=r1(),c=m1(a.breakpoints.down("sm")),n=m1(a.breakpoints.down("md")),r=m1(a.breakpoints.down("lg")),o=s.useCallback((i=0)=>e.filter(l=>l.startsWith("environment:")!==!1).slice(0,i),[e]);return c?n2(e,[...c2,"createdAt"]):n?n2(e,[...c2,"createdAt",...o(1)]):r?n2(e,[...c2,"createdAt","type",...o(1)]):n2(e,[...c2,"lastSeenAt","createdAt","type","tags",...o(2)])},yt=({query:e})=>{var a;return((a=e||"")==null?void 0:a.length)>0?t.jsx(V,{sx:c=>({padding:c.spacing(3)}),children:t.jsxs(g1,{children:["No feature toggles found matching “",e,"”"]})}):t.jsx(V,{sx:c=>({padding:c.spacing(3)}),children:t.jsx(g1,{children:"No feature toggles available."})})},bt=(e,a)=>{const[c,n]=s.useState(),[r,o]=s.useState({});return{rowActionsDialogs:t.jsxs(t.Fragment,{children:[t.jsx(r9,{isStale:!!r.stale,isOpen:!!r.featureId,onClose:()=>{o({}),e()},featureId:r.featureId||"",projectId:a}),t.jsx(e0,{isOpen:!!c,onConfirm:e,onClose:()=>{n(void 0)},featureIds:[c||""],projectId:a})]}),setFeatureArchiveState:n,setFeatureStaleDialogState:o}},Vt=(e,a)=>{const[c,n]=s.useState([]);return s.useEffect(()=>{n(r=>{const o=[...e];return r.forEach(i=>{o.find(l=>l.name===i.name)||o.push(i)}),o.filter(i=>a[i.name])})},[e,a]),c},J2=e=>`environment:${e}`,B1=T7(),St=e=>e.name,wt=({environments:e,refreshInterval:a=15*1e3,storageKey:c="project-feature-toggles-v2"})=>{const n=W("projectId"),r=h3("featuresExportImport"),o={offset:_3(m4,0),limit:_3(m4,g7),query:q2,favoritesFirst:_3(f7,!0),sortBy:_3(q2,"createdAt"),sortOrder:_3(q2,"desc"),columns:x7,tag:p4,createdAt:p4},[i,l]=j7(`${c}-${n}`,o),h={tag:i.tag,createdAt:i.createdAt},{features:C,total:u,refetch:m,loading:p,initialLoad:j}=Z7(y7({...b7(o,i),project:`IS:${n}`},D=>D?`${D}`:void 0),{refreshInterval:a}),{favorite:g,unfavorite:y}=V7(),v=s.useCallback(async D=>{D!=null&&D.favorite?await y(n,D.name):await g(n,D.name),m()},[n,m]),{isChangeRequestConfigured:f}=d3(n),{onToggle:E,modals:b}=s9(n),{rowActionsDialogs:L,setFeatureArchiveState:I,setFeatureStaleDialogState:_}=bt(m,n),[F,w]=s.useState(!1),O=s.useMemo(()=>[B1.display({id:"select",header:({table:D})=>t.jsx(v4,{noPadding:!0,title:"Select all rows",checked:D==null?void 0:D.getIsAllRowsSelected(),onChange:D==null?void 0:D.getToggleAllRowsSelectedHandler()}),cell:({row:D})=>t.jsx(v4,{noPadding:!0,title:"Select row",checked:D==null?void 0:D.getIsSelected(),onChange:D==null?void 0:D.getToggleSelectedHandler()}),meta:{width:"1%"},enableHiding:!1}),B1.accessor("favorite",{id:"favorite",header:()=>t.jsx(S7,{isActive:i.favoritesFirst,onClick:()=>l({favoritesFirst:!i.favoritesFirst})}),cell:({row:{original:D}})=>t.jsx(w7,{value:D==null?void 0:D.favorite,onClick:()=>v(D)}),enableSorting:!1,enableHiding:!1,meta:{align:"center",width:"1%"}}),B1.accessor("lastSeenAt",{id:"lastSeenAt",header:"Last seen",cell:({row:{original:D}})=>t.jsx(E7,{feature:D,"data-loading":!0}),size:50,meta:{align:"center",width:"1%"}}),B1.accessor("type",{id:"type",header:"Type",cell:F6,meta:{align:"center",width:"1%"}}),B1.accessor("name",{id:"name",header:"Name",cell:l0,enableHiding:!1,meta:{width:"50%"}}),B1.accessor("tags",{id:"tags",header:"Tags",enableSorting:!1,cell:_7,meta:{width:"1%"}}),B1.accessor("createdAt",{id:"createdAt",header:"Created",cell:E2}),...e.map(D=>{const K=D.environment,y1=f(K);return B1.accessor(u1=>{var I1,i1;return{featureId:u1.name,environment:(I1=u1.environments)==null?void 0:I1.find(p1=>p1.name===K),someEnabledEnvironmentHasVariants:((i1=u1.environments)==null?void 0:i1.some(p1=>p1.variantCount&&p1.variantCount>0&&p1.enabled))||!1}},{id:J2(K),header:K,meta:{align:"center",width:90},cell:({getValue:u1})=>{const{featureId:I1,environment:i1,someEnabledEnvironmentHasVariants:p1}=u1();return t.jsx(xt,{value:(i1==null?void 0:i1.enabled)||!1,featureId:I1,someEnabledEnvironmentHasVariants:p1,environment:i1,projectId:n,environmentName:K,isChangeRequestEnabled:y1,refetch:m,onFeatureToggleSwitch:E})}})}),B1.display({id:"actions",header:"",cell:({row:D})=>t.jsx(Ne,{row:D,projectId:n,onOpenArchiveDialog:I,onOpenStaleDialog:_}),enableSorting:!1,enableHiding:!1,meta:{align:"right",width:"1%"}})],[n,e,i.favoritesFirst,m]),B=s.useMemo(()=>Array(i.limit).fill(null).map((D,K)=>({id:K,type:"-",name:`Feature name ${K}`,createdAt:new Date().toISOString(),environments:[{name:"production",enabled:!1},{name:"production",enabled:!1}]})),[i.limit]),z=!!(j||p&&u),A=j2(z),P=s.useMemo(()=>z?B:C,[z,C]),x=s.useMemo(()=>O.map(D=>D.id).filter(Boolean),[O]),Z=Zt(x),R=M7(H7(i,l,{columns:O,data:P,enableRowSelection:!0,state:{columnVisibility:Z},getRowId:St})),{columnVisibility:M,rowSelection:N}=R.getState(),T=s.useCallback(D=>{const K=M[D],y1={...M,[D]:!K};l({columns:Object.keys(y1).filter(u1=>y1[u1])})},[M,l]),U=Vt(C,N);return t.jsxs(t.Fragment,{children:[t.jsx(n1,{disableLoading:!0,disablePadding:!0,header:t.jsx(vt,{isLoading:j,totalItems:u,searchQuery:i.query||"",onChangeSearchQuery:D=>{l({query:D})},dataToExport:P,environmentsToExport:e.map(({environment:D})=>D),actions:t.jsx(tt,{columns:[{header:"Last seen",id:"lastSeenAt",isVisible:M.lastSeenAt},{header:"Type",id:"type",isVisible:M.type},{header:"Name",id:"name",isVisible:M.name,isStatic:!0},{header:"Tags",id:"tags",isVisible:M.tags},{header:"Created",id:"createdAt",isVisible:M.createdAt},{id:"divider"},...e.map(({environment:D})=>({header:D,id:J2(D),isVisible:M[J2(D)]}))],onToggle:T})}),bodyClass:"noop",style:{cursor:"inherit"},children:t.jsxs("div",{ref:A,"aria-busy":z,"aria-live":"polite",children:[t.jsx(jt,{onChange:l,state:h}),t.jsx(l3,{value:i.query||"",children:t.jsx(A7,{tableInstance:R,totalItems:u})}),t.jsx(S,{condition:!P.length&&!z,show:t.jsx(yt,{query:i.query||""})}),L,t.jsx(S,{condition:r&&!p,show:t.jsx(w5,{showExportDialog:F,data:P,onClose:()=>w(!1),environments:e.map(({environment:D})=>D)})}),b]})}),t.jsx(k7,{count:U.length,children:t.jsx(mt,{selectedIds:Object.keys(N),data:U,projectId:n,onResetSelection:R.resetRowSelection,onChange:m})})]})},Et=e=>{const a=()=>{const n=L1(`api/admin/projects/${e}/overview`);return fetch(n,{method:"GET"}).then(F1("Project overview")).then(r=>r.json())},c=`api/admin/projects/${e}/overview`;return{fetcher:a,KEY:c}},_t={featureTypeCounts:[],environments:[],name:"",health:0,members:0,version:"1",description:"Default",favorite:!1,mode:"open",defaultStickiness:"default",stats:{archivedCurrentWindow:0,archivedPastWindow:0,avgTimeToProdCurrentWindow:0,createdCurrentWindow:0,createdPastWindow:0,projectActivityCurrentWindow:0,projectActivityPastWindow:0,projectMembersAddedCurrentWindow:0}},z5=(e,a={})=>{const{KEY:c,fetcher:n}=Et(e),{data:r,error:o,mutate:i}=U1(c,n,a),l=s.useCallback(()=>{i()},[i]);return{project:r||_t,loading:!o&&!r,error:o,refetch:l}},U3=e=>z5(e).project.name||e,R4=15*1e3,Mt=d("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),[e.breakpoints.down("md")]:{flexDirection:"column"}})),Ht=d("div")(()=>({width:"100%",minWidth:0})),At=d(V)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),width:"100%",minWidth:0})),kt=({storageKey:e="project-overview-v2"})=>{const a=W("projectId"),c=U3(a),{project:n}=z5(a,{refreshInterval:R4});Z1(`Project overview – ${c}`);const{setLastViewed:r}=D7();s.useEffect(()=>{r(a)},[a,r]);const{members:o,featureTypeCounts:i,health:l,description:h,environments:C,stats:u}=n;return t.jsxs(Mt,{children:[t.jsx(we,{id:a,description:h,memberCount:o,health:l,featureTypeCounts:i,stats:u}),t.jsxs(At,{children:[t.jsx(He,{stats:n.stats}),t.jsx(Ht,{children:t.jsx(wt,{environments:C,refreshInterval:R4,storageKey:e})})]})]},a)},Tt=(e,a)=>{const c=L1(`api/admin/projects/${e}/health-report`),{data:n,error:r}=U1(c,Dt,a),o=s.useCallback(()=>{M5(c).catch(console.warn)},[c]);return{healthReport:n,refetchHealthReport:o,loading:!r&&!n,error:r}},Dt=e=>fetch(e).then(F1("Health report")).then(a=>a.json());var N5={},Lt=a3;Object.defineProperty(N5,"__esModule",{value:!0});var m5=N5.default=void 0,Ft=Lt(t3()),Pt=t,Rt=(0,Ft.default)((0,Pt.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");m5=N5.default=Rt;const It=d(V)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),I4=d(V)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Bt=d(O1)(({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)}})),K2=d("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1),justifyItems:"center",display:"flex"})),Ot=d("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),$t=d("p")(({theme:e})=>({color:e.palette.text.secondary})),B4=d("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),O4=d("p")(({theme:e})=>({marginLeft:e.spacing(4)})),zt=({healthReport:e})=>{const a=e.health<50?"error.main":e.health<75?"warning.main":"success.main",c=()=>t.jsxs(It,{children:[t.jsx(Z2,{}),t.jsxs("span",{children:[e.activeCount," active toggles"]})]}),n=()=>t.jsxs(I4,{children:[t.jsx(m5,{}),t.jsxs("span",{children:[e.staleCount," stale toggles"]})]}),r=()=>t.jsxs(I4,{children:[t.jsx(m5,{}),t.jsxs("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]}),o=()=>t.jsx(h5,{title:t.jsxs(t.Fragment,{children:["If your toggle exceeds the expected lifetime of it's toggle type it will be marked as potentially stale.",t.jsx(V,{sx:{mt:2},children:t.jsx("a",{href:"https://docs.getunleash.io/reference/technical-debt#stale-and-potentially-stale-toggles",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})})]}),children:t.jsx(L7,{sx:{color:i=>i.palette.text.secondary,ml:1}})});return t.jsxs(Bt,{children:[t.jsxs(V,{children:[t.jsx(K2,{children:"Health rating"}),t.jsx(S,{condition:e.health>-1,show:t.jsxs(t.Fragment,{children:[t.jsxs(Ot,{sx:{color:a},children:[e.health,"%"]}),t.jsxs($t,{children:["Last updated:"," ",t.jsx(H5,{date:e.updatedAt,live:!1})]})]})})]}),t.jsxs(V,{children:[t.jsx(K2,{children:"Toggle report"}),t.jsxs(B4,{children:[t.jsx("li",{children:t.jsx(S,{condition:!!e.activeCount,show:c})}),t.jsx(S,{condition:!!e.activeCount,show:t.jsx(O4,{children:"Also includes potentially stale toggles."})}),t.jsx("li",{children:t.jsx(S,{condition:!!e.staleCount,show:n})})]})]}),t.jsxs(V,{sx:{flexBasis:"40%"},children:[t.jsxs(K2,{children:["Potential actions"," ",t.jsx("span",{children:t.jsx(o,{})})]}),t.jsx(B4,{children:t.jsx("li",{children:t.jsx(S,{condition:!!e.potentiallyStaleCount,show:r})})}),t.jsx(S,{condition:!!e.potentiallyStaleCount,show:t.jsxs(t.Fragment,{children:[t.jsx(O4,{children:"Review your feature toggles and delete unused toggles."}),t.jsx(V,{sx:{mt:2},children:t.jsx(C3,{component:v1,to:"/feature-toggle-type",children:"Configure feature types lifetime"})})]}),elseShow:t.jsx("span",{children:"No action is required"})})]})]})},Nt=({row:e})=>{const a=r1();return e.original.expiredAt?t.jsx(E2,{value:e.original.expiredAt}):t.jsx(Q,{children:t.jsx(k,{variant:"body2",color:a.palette.text.secondary,children:"N/A"})})},Wt=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),qt=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),Ut=({row:e})=>e.original.status==="potentially-stale"?t.jsx(Q,{children:t.jsxs(Wt,{children:[t.jsx(H9,{}),t.jsx("span",{children:"Potentially stale"})]})}):t.jsx(Q,{children:t.jsxs(qt,{children:[t.jsx(P6,{}),t.jsx("span",{children:"Healthy"})]})}),C0=(e,a)=>Math.abs(F7(e,a)),d0=(e,a)=>{var c;return a.lifetimeDays?e>=((c=a==null?void 0:a.lifetimeDays)==null?void 0:c.valueOf()):!1},Gt=(e,a)=>{const{type:c,createdAt:n}=e,r=a.find(h=>h.id===c),o=R6(n),l=C0(o,new Date);return r&&d0(l,r)&&c!==I6&&c!==B6?"potentially-stale":"healthy"},Jt=(e,a)=>{var h;const{type:c,createdAt:n}=e,r=a.find(C=>C.id===c);if(r&&(r.name===I6||r.name===B6))return;const o=R6(n),i=new Date,l=C0(o,i);if(r&&d0(l,r)){const C=l-(((h=r==null?void 0:r.lifetimeDays)==null?void 0:h.valueOf())||0);return T9(i,C).toISOString()}},Kt=({projectId:e,features:a})=>{const c=r1(),n=m1(c.breakpoints.down("sm")),r=m1(c.breakpoints.down("md")),o=m1(c.breakpoints.down("lg"));a1();const{featureTypes:i}=P7(),l=s.useMemo(()=>a.map(f=>({project:e,name:f.name,type:f.type,stale:f.stale,environments:f.environments,status:Gt(f,i),lastSeenAt:f.lastSeenAt,createdAt:f.createdAt,expiredAt:Jt(f,i)})),[e,a,i]),h=s.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt",desc:!0}]}),[]),C=s.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({value:f,row:{original:E}})=>t.jsx(R7,{feature:E}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",align:"center",Cell:F6,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:l0,minWidth:120},{Header:"Created",accessor:"createdAt",Cell:E2,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Nt,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:Ut,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:I7,disableGlobalFilter:!0,maxWidth:120}],[]),{headerGroups:u,rows:m,prepareRow:p,state:{globalFilter:j},setGlobalFilter:g,setHiddenColumns:y}=t1.useTable({columns:C,data:l,initialState:h,sortTypes:u3,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},t1.useGlobalFilter,t1.useFlexLayout,t1.useSortBy);m3([{condition:n,columns:["stale"]},{condition:r,columns:["expiredAt","lastSeenAt"]},{condition:o,columns:["createdAt"]}],y,C);const v=m.length<l.length?`Feature toggles (${m.length} of ${l.length})`:`Feature toggles (${l.length})`;return t.jsxs(n1,{header:t.jsx(X,{title:v,actions:t.jsx(T1,{initialValue:j,onChange:g})}),children:[t.jsx(l3,{value:j,children:t.jsx(_2,{headerGroups:u,prepareRow:p,rows:m})}),t.jsx(S,{condition:m.length===0,show:t.jsx(S,{condition:(j==null?void 0:j.length)>0,show:t.jsxs(g1,{children:["No feature toggles found matching “",j,"”"]}),elseShow:t.jsx(g1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},Yt=()=>{const e=W("projectId"),a=X1(e);Z1(`Project health – ${a}`);const{healthReport:c,refetchHealthReport:n,error:r}=Tt(e,{refreshInterval:15*1e3});return c?t.jsxs("div",{children:[t.jsx(S,{condition:!!r,show:t.jsx(E6,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:n,text:`Could not fetch health rating for ${e}`})}),t.jsx(zt,{healthReport:c}),t.jsx(Kt,{projectId:e,features:c.features})]}):null},Qt=d("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),Xt=()=>{const e=W("projectId");return t.jsx(Qt,{children:t.jsx(B7,{title:"Event Log",project:e,displayInline:!0})})},h0=(e,a)=>{const{data:c,error:n,mutate:r}=U1(L1(`api/admin/projects/${e}/change-requests/${a}`),ea,{refreshInterval:15e3});return{data:c,loading:!n&&!c,refetchChangeRequest:()=>r(),error:n}},ea=e=>fetch(e).then(F1("Request changes")).then(a=>a.json()),ta=d(O1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));d(V)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const aa=d(V)(({theme:e})=>({display:"flex",alignItems:"center"})),ca=d(k)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),na=d(O7)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),W5=d($3)(({theme:e})=>({height:"24px",width:"24px"})),ra=({changeRequest:e})=>{var n,r,o;const[a,c]=s.useState(e.title);return t.jsxs(ta,{elevation:0,children:[t.jsx($7,{environmentChangeRequest:e,title:a,setTitle:c,children:t.jsx(ca,{variant:"h1",sx:{mr:1.5},children:a})}),t.jsxs(aa,{children:[t.jsx(O6,{changeRequest:e}),t.jsxs(k,{variant:"body2",sx:i=>({margin:i.spacing("auto",0,"auto",2)}),children:["Created"," ",t.jsx(H5,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),t.jsx(V,{sx:i=>({marginLeft:i.spacing(1)}),children:t.jsx(S1,{title:(n=e==null?void 0:e.createdBy)==null?void 0:n.username,children:t.jsx(W5,{src:(r=e==null?void 0:e.createdBy)==null?void 0:r.imageUrl})})}),t.jsx(k,{variant:"body2",sx:i=>({marginLeft:i.spacing(.5)}),children:(o=e==null?void 0:e.createdBy)==null?void 0:o.username}),t.jsx(V,{sx:i=>({marginLeft:i.spacing(1.5)}),children:t.jsx(na,{variant:"outlined",children:t.jsxs(k,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",t.jsx(k,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",t.jsx(z7,{}),"Updates:",t.jsx(N7,{featuresCount:e.features.length,segmentsCount:e.segments.length})]})})})]})]})},sa=s.createContext({}),u2=sa;function oa(e){return p3("MuiTimeline",e)}c3("MuiTimeline",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]);function b3(e){return e==="alternate-reverse"?"positionAlternateReverse":`position${M2(e)}`}const ia=["position","className"],la=e=>{const{position:a,classes:c}=e,n={root:["root",a&&b3(a)]};return x3(n,oa,c)},Ca=d("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,c.position&&a[b3(c.position)]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),da=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimeline"}),{position:r="right",className:o}=n,i=g3(n,ia),l=C1({},n,{position:r}),h=la(l),C=s.useMemo(()=>({position:r}),[r]);return t.jsx(u2.Provider,{value:C,children:t.jsx(Ca,C1({className:f3(h.root,o),ownerState:l,ref:c},i))})}),u0=da;function ha(e){return p3("MuiTimelineContent",e)}const ua=c3("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),ma=["className"],pa=e=>{const{position:a,classes:c}=e,n={root:["root",b3(a)]};return x3(n,ha,c)},va=d(k,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,a[b3(c.position)]]}})(({ownerState:e})=>C1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),ga=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineContent"}),{className:r}=n,o=g3(n,ma),{position:i}=s.useContext(u2),l=C1({},n,{position:i||"right"}),h=pa(l);return t.jsx(va,C1({component:"div",className:f3(h.root,r),ownerState:l,ref:c},o))}),q5=ga,fa=c3("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),xa=fa;function ja(e){return p3("MuiTimelineItem",e)}const Za=c3("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse","missingOppositeContent"]),m0=Za,ya=["position","className"],ba=e=>{const{position:a,classes:c,hasOppositeContent:n}=e,r={root:["root",b3(a),!n&&"missingOppositeContent"]};return x3(r,ja,c)},Va=d("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,a[b3(c.position)]]}})(({ownerState:e})=>C1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},(e.position==="alternate"||e.position==="alternate-reverse")&&{[`&:nth-of-type(${e.position==="alternate"?"even":"odd"})`]:{flexDirection:"row-reverse",[`& .${ua.root}`]:{textAlign:"right"},[`& .${xa.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&::before":{content:'""',flex:1,padding:"6px 16px"}})),Sa=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineItem"}),{position:r,className:o}=n,i=g3(n,ya),{position:l}=s.useContext(u2);let h=!1;s.Children.forEach(n.children,p=>{W7(p,["TimelineOppositeContent"])&&(h=!0)});const C=C1({},n,{position:r||l||"right",hasOppositeContent:h}),u=ba(C),m=s.useMemo(()=>({position:C.position}),[C.position]);return t.jsx(u2.Provider,{value:m,children:t.jsx(Va,C1({className:f3(u.root,o),ownerState:C,ref:c},i))})}),k3=Sa;function wa(e){return p3("MuiTimelineSeparator",e)}c3("MuiTimelineSeparator",["root"]);const Ea=["className"],_a=e=>{const{classes:a}=e;return x3({root:["root"]},wa,a)},Ma=d("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,a)=>a.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),Ha=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineSeparator"}),{className:r}=n,o=g3(n,Ea),i=n,l=_a(i);return t.jsx(Ma,C1({className:f3(l.root,r),ownerState:i,ref:c},o))}),T3=Ha;function Aa(e){return p3("MuiTimelineDot",e)}c3("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const ka=["className","color","variant"],Ta=e=>{const{color:a,variant:c,classes:n}=e,r={root:["root",c,a!=="inherit"&&`${c}${M2(a)}`]};return x3(r,Aa,n)},Da=d("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:c}=e;return[a.root,a[c.color!=="inherit"&&`${c.variant}${M2(c.color)}`],a[c.variant]]}})(({ownerState:e,theme:a})=>C1({display:"flex",alignSelf:"baseline",borderStyle:"solid",borderWidth:2,padding:4,borderRadius:"50%",boxShadow:(a.vars||a).shadows[1],margin:"11.5px 0"},e.variant==="filled"&&C1({borderColor:"transparent"},e.color!=="inherit"&&C1({},e.color==="grey"?{color:(a.vars||a).palette.grey[50],backgroundColor:(a.vars||a).palette.grey[400]}:{color:(a.vars||a).palette[e.color].contrastText,backgroundColor:(a.vars||a).palette[e.color].main})),e.variant==="outlined"&&C1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&C1({},e.color==="grey"?{borderColor:(a.vars||a).palette.grey[400]}:{borderColor:(a.vars||a).palette[e.color].main})))),La=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineDot"}),{className:r,color:o="grey",variant:i="filled"}=n,l=g3(n,ka),h=C1({},n,{color:o,variant:i}),C=Ta(h);return t.jsx(Da,C1({className:f3(C.root,r),ownerState:h,ref:c},l))}),U5=La;function Fa(e){return p3("MuiTimelineConnector",e)}c3("MuiTimelineConnector",["root"]);const Pa=["className"],Ra=e=>{const{classes:a}=e;return x3({root:["root"]},Fa,a)},Ia=d("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,a)=>a.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),Ba=s.forwardRef(function(a,c){const n=v3({props:a,name:"MuiTimelineConnector"}),{className:r}=n,o=g3(n,Pa),i=n,l=Ra(i);return t.jsx(Ia,C1({className:f3(l.root,r),ownerState:i,ref:c},o))}),G5=Ba,Oa=d(O1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),$a=d(V)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),za=d(V)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"flex-end"})),Na=d(u0)(()=>({[`& .${m0.root}:before`]:{flex:0,padding:0}})),Wa=["Draft","In review","Approved","Applied"],qa=["Draft","In review","Rejected"],Ua=["Draft","In review","Approved","Scheduled","Applied"],Ga=(e,a,c,n)=>e==="Cancelled"?"grey":e==="Rejected"?c==="Rejected"?"error":"success":a!==-1&&a>=n?"success":a+1===n?"primary":"grey",Ja=({state:e,schedule:a})=>{let c;switch(e){case"Rejected":c=qa;break;case"Scheduled":c=Ua;break;default:c=Wa}const n=c.findIndex(r=>r===e);return t.jsx(Oa,{elevation:0,children:t.jsx($a,{children:t.jsx(Na,{children:c.map((r,o)=>{if(a&&r==="Scheduled")return Qa(a);const i=Ga(e,n,r,o);let l={};return n+1===o&&!(e==="Cancelled"&&r==="Draft")&&(l={variant:"outlined"}),Ka(i,r,o<c.length-1,l)})})})})},Ka=(e,a,c,n={})=>t.jsxs(k3,{children:[t.jsxs(T3,{children:[t.jsx(U5,{color:e,...n}),c&&t.jsx(G5,{})]}),t.jsx(q5,{children:a})]},a),Ya=(e,a)=>{switch(e.status){case"suspended":return{title:"Schedule suspended",subtitle:`was ${a}`,color:"grey",reason:t.jsx(h5,{title:e.reason,arrow:!0,children:t.jsx(l2,{color:"disabled",fontSize:"small"})})};case"failed":return{title:"Schedule failed",subtitle:`at ${a}`,color:"error",reason:t.jsx(h5,{title:`Schedule failed because of ${e.reason||e.failureReason}`,arrow:!0,children:t.jsx(l2,{color:"error",fontSize:"small"})})};default:return{title:"Scheduled",subtitle:`for ${a}`,color:"warning",reason:null}}},Qa=e=>{const{locationSettings:a}=H2(),c=A2(new Date(e.scheduledAt),a==null?void 0:a.locale),{title:n,subtitle:r,color:o,reason:i}=Ya(e,c);return t.jsxs(k3,{children:[t.jsxs(T3,{children:[t.jsx(U5,{color:o}),t.jsx(G5,{})]}),t.jsxs(q5,{children:[n,t.jsxs(za,{children:[t.jsx(k,{color:"text.secondary",sx:{mr:1},children:`(${r})`}),i]})]})]},n)},J5=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",w1=d(V)(({theme:e})=>({display:"flex",alignItems:"center"})),p0=d(A5)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),$4=d(A5)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),m2=d($6)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Xa=d(A9)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),ec=d(l2)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),tc=d(q7)(({theme:e})=>({color:e.palette.text.secondary,height:"35px",width:"35px",marginRight:e.spacing(1)})),ac=d(z3)(({theme:e})=>({color:e.palette.text.secondary,height:"24px",width:"24px"})),cc=d(V)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),nc=d(V,{shouldForwardProp:J5()})(({theme:e,bgColor:a,svgColor:c})=>({borderRadius:`${e.shape.borderRadiusMedium}px`,backgroundColor:a,padding:e.spacing(1,2),marginRight:e.spacing(2),height:"45px",width:"45px",display:"flex",alignItems:"center",justifyContent:"center",svg:{color:c}})),K5=d(D6)(({theme:e})=>({margin:e.spacing(2.5,0)})),rc=d(V,{shouldForwardProp:J5()})(({theme:e,border:a})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:a,padding:e.spacing(3),width:"100%"})),b1=d(k,{shouldForwardProp:J5()})(({theme:e,color:a})=>({fontWeight:"bold",color:a})),sc=d(V)({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}),L2=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,oc=(e,a)=>e==="Approved"||e==="Scheduled"?`2px solid ${a.palette.success.main}`:e==="Applied"?`2px solid ${a.palette.primary.main}`:`1px solid ${a.palette.divider}`,ic=(e,a)=>e==="Approved"?{bgColor:a.palette.success.main,svgColor:a.palette.background.paper}:e==="Applied"?{bgColor:a.palette.primary.main,svgColor:a.palette.background.paper}:{bgColor:a.palette.background.elevation2,svgColor:a.palette.neutral.main},lc=({changeRequest:e,onEditClick:a})=>{const c=r1();return t.jsxs(cc,{children:[t.jsx(nc,{...ic(e.state,c),children:t.jsx(U7,{style:{transform:"scale(1.5)"}})}),t.jsx(rc,{sx:{backgroundColor:e.state==="In review"?c.palette.warning.light:"initial"},border:oc(e.state,c),children:t.jsx(Cc,{changeRequest:e,onEditClick:a})})]})},Cc=({changeRequest:e,onEditClick:a})=>{const{state:c}=e;if(!c)return null;if(c==="Approved")return t.jsx(dc,{});if(c==="Applied")return t.jsx(uc,{});if(c==="Cancelled")return t.jsx(xc,{});if(c==="Rejected")return t.jsx(jc,{});if(c==="Scheduled"){const{schedule:n}=e;return t.jsx(pc,{schedule:n,onEditClick:a})}return t.jsx(hc,{minApprovals:e.minApprovals})},dc=()=>{const e=r1();return t.jsxs(t.Fragment,{children:[t.jsxs(w1,{children:[t.jsx(m2,{}),t.jsxs(V,{children:[t.jsx(b1,{color:e.palette.success.dark,children:"Changes approved"}),t.jsx(k,{children:"One approving review from requested approvers"})]})]}),t.jsx(K5,{}),t.jsxs(w1,{children:[t.jsx(m2,{}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},hc=({minApprovals:e})=>{const a=r1();return t.jsxs(t.Fragment,{children:[t.jsxs(w1,{children:[t.jsx($4,{}),t.jsxs(V,{children:[t.jsx(b1,{color:a.palette.warning.dark,children:"Review required"}),t.jsxs(k,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),t.jsx(K5,{}),t.jsxs(w1,{children:[t.jsx($4,{}),t.jsx(b1,{color:a.palette.warning.dark,children:"Apply changes is blocked"})]})]})},uc=()=>{const e=r1();return t.jsx(t.Fragment,{children:t.jsxs(w1,{children:[t.jsx(m2,{sx:{color:e.palette.primary.main}}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.primary.main,children:"Changes applied"})})]})})},mc=d(D1)({maxWidth:"32px",maxHeight:"32px"}),pc=({schedule:e,onEditClick:a})=>{const c=r1();if(!e)return null;const n=(()=>{switch(e.status){case"pending":return t.jsx(fc,{schedule:e});case"failed":return t.jsx(vc,{schedule:e});case"suspended":return t.jsx(gc,{schedule:e});default:return null}})();return t.jsxs(t.Fragment,{children:[t.jsxs(w1,{children:[t.jsx(m2,{}),t.jsxs(V,{children:[t.jsx(b1,{color:c.palette.success.dark,children:"Changes approved"}),t.jsx(k,{children:"One approving review from requested approvers"})]})]}),t.jsx(K5,{}),t.jsxs(sc,{children:[n,t.jsx(mc,{onClick:a,children:t.jsx(ac,{})})]})]})},vc=({schedule:e})=>{const a=r1(),c=L2(),{locationSettings:n}=H2(),r=A2(new Date(e==null?void 0:e.scheduledAt),n==null?void 0:n.locale);return t.jsxs(w1,{children:[t.jsx(ec,{}),t.jsxs(V,{children:[t.jsxs(b1,{color:a.palette.error.main,children:["Changes failed to be applied on ",r," because of"," ",e.reason??e.failureReason]}),t.jsxs(k,{children:["Your timezone is ",c]})]})]})},gc=({schedule:e})=>{const a=r1(),c=L2(),{locationSettings:n}=H2(),r=A2(new Date(e==null?void 0:e.scheduledAt),n==null?void 0:n.locale);return t.jsxs(w1,{children:[t.jsx(tc,{}),t.jsxs(V,{children:[t.jsxs(b1,{color:a.palette.text.secondary,children:["The change request is suspended for the following reason:"," ",e.reason]}),t.jsxs(b1,{color:a.palette.text.secondary,children:["It will not be applied on ",r,"."]}),t.jsxs(k,{children:["Your timezone is ",c]})]})]})},fc=({schedule:e})=>{const a=r1(),c=L2(),{locationSettings:n}=H2(),r=A2(new Date(e==null?void 0:e.scheduledAt),n==null?void 0:n.locale);return t.jsxs(w1,{children:[t.jsx(Xa,{}),t.jsxs(V,{children:[t.jsxs(b1,{color:a.palette.warning.dark,children:["Changes are scheduled to be applied on: ",r]}),t.jsxs(k,{children:["Your timezone is ",c]})]})]})},xc=()=>{const e=r1();return t.jsx(t.Fragment,{children:t.jsxs(w1,{children:[t.jsx(p0,{}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.error.main,children:"Changes cancelled"})})]})})},jc=()=>{const e=r1();return t.jsx(t.Fragment,{children:t.jsxs(w1,{children:[t.jsx(p0,{}),t.jsx(V,{children:t.jsx(b1,{color:e.palette.error.main,children:"Changes rejected"})})]})})};var Y5={},Zc=a3;Object.defineProperty(Y5,"__esModule",{value:!0});var v0=Y5.default=void 0,yc=Zc(t3()),bc=t,Vc=(0,yc.default)((0,bc.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");v0=Y5.default=Vc;const g0=({disabled:e,children:a,actions:c,permission:n})=>{const{isAdmin:r}=s.useContext($1),o=W("projectId"),i=W("id"),{user:l}=z6(),{data:h}=h0(o,i),[C,u]=N1.useState(!1),m=N1.useRef(null),p=()=>{u(y=>!y)},j=y=>{var v;(v=m.current)!=null&&v.contains(y.target)||u(!1)},g=m.current?m.current.offsetWidth:null;return t.jsxs(N1.Fragment,{children:[t.jsx(G1,{variant:"contained",disabled:e||(h==null?void 0:h.createdBy.id)===(l==null?void 0:l.id)&&!r,"aria-controls":C?"review-options-menu":void 0,"aria-expanded":C?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:p,ref:m,endIcon:t.jsx(v0,{}),permission:n,projectId:o,environmentId:h==null?void 0:h.environment,children:a}),t.jsx(H6,{sx:{zIndex:1,width:g},open:C,anchorEl:m.current,transition:!0,disablePortal:!0,children:({TransitionProps:y,placement:v})=>t.jsx(G7,{...y,style:{transformOrigin:v==="bottom"?"center top":"center bottom"},children:t.jsx(O1,{className:"dropdown-outline",children:t.jsx(A6,{onClickAway:j,children:t.jsx(O3,{id:"review-options-menu",autoFocusItem:!0,children:c.map(({label:f,onSelect:E,icon:b})=>t.jsxs(H1,{onClick:E,children:[t.jsx(A1,{children:b}),t.jsx(k1,{children:f})]},`MenuItem-${f}`))})})})})})]})},Sc=({disabled:e,onReject:a,onApprove:c,children:n})=>t.jsx(g0,{permission:J7,disabled:e,actions:[{label:"Approve",onSelect:c,icon:t.jsx(Z2,{fontSize:"small"})},{label:"Reject",onSelect:a,icon:t.jsx(i9,{fontSize:"small"})}],children:n});var f0={},Q5={},X5={};Object.defineProperty(X5,"__esModule",{value:!0});var wc=s,Ec=_c(wc);function _c(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c]);return a.default=e,a}X5.default=function(e,a,c){return Ec.createElement("a",{href:e,key:c},a)};var e4={};Object.defineProperty(e4,"__esModule",{value:!0});e4.default=function(e){return e};var t4={},Y2,z4;function Mc(){return z4||(z4=1,Y2=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),Y2}var Q2,N4;function Hc(){return N4||(N4=1,Q2=/[\0-\x1F\x7F-\x9F]/),Q2}var X2,W4;function Ac(){return W4||(W4=1,X2=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),X2}var e5,q4;function kc(){return q4||(q4=1,e5=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/),e5}var t5,U4;function Tc(){return U4||(U4=1,t5=function(e){var a={};a.src_Any=Mc().source,a.src_Cc=Hc().source,a.src_Z=Ac().source,a.src_P=kc().source,a.src_ZPCc=[a.src_Z,a.src_P,a.src_Cc].join("|"),a.src_ZCc=[a.src_Z,a.src_Cc].join("|");var c="[><|]";return a.src_pseudo_letter="(?:(?!"+c+"|"+a.src_ZPCc+")"+a.src_Any+")",a.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",a.src_auth="(?:(?:(?!"+a.src_ZCc+"|[@/\\[\\]()]).)+@)?",a.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",a.src_host_terminator="(?=$|"+c+"|"+a.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+a.src_ZPCc+"))",a.src_path="(?:[/?#](?:(?!"+a.src_ZCc+"|"+c+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+a.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+a.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+a.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+a.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+a.src_ZCc+"|[']).)+\\'|\\'(?="+a.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+a.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+a.src_ZCc+").|\\!(?!"+a.src_ZCc+"|[!]).|\\?(?!"+a.src_ZCc+"|[?]).)+|\\/)?",a.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',a.src_xn="xn--[a-z0-9\\-]{1,59}",a.src_domain_root="(?:"+a.src_xn+"|"+a.src_pseudo_letter+"{1,63})",a.src_domain="(?:"+a.src_xn+"|(?:"+a.src_pseudo_letter+")|(?:"+a.src_pseudo_letter+"(?:-|"+a.src_pseudo_letter+"){0,61}"+a.src_pseudo_letter+"))",a.src_host="(?:(?:(?:(?:"+a.src_domain+")\\.)*"+a.src_domain+"))",a.tpl_host_fuzzy="(?:"+a.src_ip4+"|(?:(?:(?:"+a.src_domain+")\\.)+(?:%TLDS%)))",a.tpl_host_no_ip_fuzzy="(?:(?:(?:"+a.src_domain+")\\.)+(?:%TLDS%))",a.src_host_strict=a.src_host+a.src_host_terminator,a.tpl_host_fuzzy_strict=a.tpl_host_fuzzy+a.src_host_terminator,a.src_host_port_strict=a.src_host+a.src_port+a.src_host_terminator,a.tpl_host_port_fuzzy_strict=a.tpl_host_fuzzy+a.src_port+a.src_host_terminator,a.tpl_host_port_no_ip_fuzzy_strict=a.tpl_host_no_ip_fuzzy+a.src_port+a.src_host_terminator,a.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+a.src_ZPCc+"|>|$))",a.tpl_email_fuzzy="(^|"+c+'|"|\\(|'+a.src_ZCc+")("+a.src_email_name+"@"+a.tpl_host_fuzzy_strict+")",a.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+a.src_ZPCc+"))((?![$+<=>^`||])"+a.tpl_host_port_fuzzy_strict+a.src_path+")",a.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+a.src_ZPCc+"))((?![$+<=>^`||])"+a.tpl_host_port_no_ip_fuzzy_strict+a.src_path+")",a}),t5}function p5(e){var a=Array.prototype.slice.call(arguments,1);return a.forEach(function(c){c&&Object.keys(c).forEach(function(n){e[n]=c[n]})}),e}function F2(e){return Object.prototype.toString.call(e)}function Dc(e){return F2(e)==="[object String]"}function Lc(e){return F2(e)==="[object Object]"}function Fc(e){return F2(e)==="[object RegExp]"}function G4(e){return F2(e)==="[object Function]"}function Pc(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var x0={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Rc(e){return Object.keys(e||{}).reduce(function(a,c){return a||x0.hasOwnProperty(c)},!1)}var Ic={"http:":{validate:function(e,a,c){var n=e.slice(a);return c.re.http||(c.re.http=new RegExp("^\\/\\/"+c.re.src_auth+c.re.src_host_port_strict+c.re.src_path,"i")),c.re.http.test(n)?n.match(c.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,a,c){var n=e.slice(a);return c.re.no_http||(c.re.no_http=new RegExp("^"+c.re.src_auth+"(?:localhost|(?:(?:"+c.re.src_domain+")\\.)+"+c.re.src_domain_root+")"+c.re.src_port+c.re.src_host_terminator+c.re.src_path,"i")),c.re.no_http.test(n)?a>=3&&e[a-3]===":"||a>=3&&e[a-3]==="/"?0:n.match(c.re.no_http)[0].length:0}},"mailto:":{validate:function(e,a,c){var n=e.slice(a);return c.re.mailto||(c.re.mailto=new RegExp("^"+c.re.src_email_name+"@"+c.re.src_host_strict,"i")),c.re.mailto.test(n)?n.match(c.re.mailto)[0].length:0}}},Bc="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",Oc="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function $c(e){e.__index__=-1,e.__text_cache__=""}function zc(e){return function(a,c){var n=a.slice(c);return e.test(n)?n.match(e)[0].length:0}}function J4(){return function(e,a){a.normalize(e)}}function p2(e){var a=e.re=Tc()(e.__opts__),c=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||c.push(Bc),c.push(a.src_xn),a.src_tlds=c.join("|");function n(l){return l.replace("%TLDS%",a.src_tlds)}a.email_fuzzy=RegExp(n(a.tpl_email_fuzzy),"i"),a.link_fuzzy=RegExp(n(a.tpl_link_fuzzy),"i"),a.link_no_ip_fuzzy=RegExp(n(a.tpl_link_no_ip_fuzzy),"i"),a.host_fuzzy_test=RegExp(n(a.tpl_host_fuzzy_test),"i");var r=[];e.__compiled__={};function o(l,h){throw new Error('(LinkifyIt) Invalid schema "'+l+'": '+h)}Object.keys(e.__schemas__).forEach(function(l){var h=e.__schemas__[l];if(h!==null){var C={validate:null,link:null};if(e.__compiled__[l]=C,Lc(h)){Fc(h.validate)?C.validate=zc(h.validate):G4(h.validate)?C.validate=h.validate:o(l,h),G4(h.normalize)?C.normalize=h.normalize:h.normalize?o(l,h):C.normalize=J4();return}if(Dc(h)){r.push(l);return}o(l,h)}}),r.forEach(function(l){e.__compiled__[e.__schemas__[l]]&&(e.__compiled__[l].validate=e.__compiled__[e.__schemas__[l]].validate,e.__compiled__[l].normalize=e.__compiled__[e.__schemas__[l]].normalize)}),e.__compiled__[""]={validate:null,normalize:J4()};var i=Object.keys(e.__compiled__).filter(function(l){return l.length>0&&e.__compiled__[l]}).map(Pc).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+i+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+i+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),$c(e)}function Nc(e,a){var c=e.__index__,n=e.__last_index__,r=e.__text_cache__.slice(c,n);this.schema=e.__schema__.toLowerCase(),this.index=c+a,this.lastIndex=n+a,this.raw=r,this.text=r,this.url=r}function K4(e,a){var c=new Nc(e,a);return e.__compiled__[c.schema].normalize(c,e),c}function V1(e,a){if(!(this instanceof V1))return new V1(e,a);a||Rc(e)&&(a=e,e={}),this.__opts__=p5({},x0,a),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=p5({},Ic,e),this.__compiled__={},this.__tlds__=Oc,this.__tlds_replaced__=!1,this.re={},p2(this)}V1.prototype.add=function(a,c){return this.__schemas__[a]=c,p2(this),this};V1.prototype.set=function(a){return this.__opts__=p5(this.__opts__,a),this};V1.prototype.test=function(a){if(this.__text_cache__=a,this.__index__=-1,!a.length)return!1;var c,n,r,o,i,l,h,C,u;if(this.re.schema_test.test(a)){for(h=this.re.schema_search,h.lastIndex=0;(c=h.exec(a))!==null;)if(o=this.testSchemaAt(a,c[2],h.lastIndex),o){this.__schema__=c[2],this.__index__=c.index+c[1].length,this.__last_index__=c.index+c[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(C=a.search(this.re.host_fuzzy_test),C>=0&&(this.__index__<0||C<this.__index__)&&(n=a.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(i=n.index+n[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(u=a.indexOf("@"),u>=0&&(r=a.match(this.re.email_fuzzy))!==null&&(i=r.index+r[1].length,l=r.index+r[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&l>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=l))),this.__index__>=0};V1.prototype.pretest=function(a){return this.re.pretest.test(a)};V1.prototype.testSchemaAt=function(a,c,n){return this.__compiled__[c.toLowerCase()]?this.__compiled__[c.toLowerCase()].validate(a,n,this):0};V1.prototype.match=function(a){var c=0,n=[];this.__index__>=0&&this.__text_cache__===a&&(n.push(K4(this,c)),c=this.__last_index__);for(var r=c?a.slice(c):a;this.test(r);)n.push(K4(this,c)),r=r.slice(this.__last_index__),c+=this.__last_index__;return n.length?n:null};V1.prototype.tlds=function(a,c){return a=Array.isArray(a)?a:[a],c?(this.__tlds__=this.__tlds__.concat(a).sort().filter(function(n,r,o){return n!==o[r-1]}).reverse(),p2(this),this):(this.__tlds__=a.slice(),this.__tlds_replaced__=!0,p2(this),this)};V1.prototype.normalize=function(a){a.schema||(a.url="http://"+a.url),a.schema==="mailto:"&&!/^mailto:/i.test(a.url)&&(a.url="mailto:"+a.url)};V1.prototype.onCompile=function(){};var Wc=V1;const qc=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","actor","ad","ads","adult","ae","aeg","aero","aetna","af","afl","africa","ag","agakhan","agency","ai","aig","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","amazon","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","casa","case","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","charity","chase","chat","cheap","chintai","christmas","chrome","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cpa","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dog","domains","dot","download","drive","dtv","dubai","dunlop","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epson","equipment","er","ericsson","erni","es","esq","estate","et","etisalat","eu","eurovision","eus","events","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gay","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","inc","industries","infiniti","info","ing","ink","institute","insurance","insure","int","international","intuit","investments","io","ipiranga","iq","ir","irish","is","ismaili","ist","istanbul","it","itau","itv","jaguar","java","jcb","je","jeep","jetzt","jewelry","jio","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kids","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","lamborghini","lamer","lancaster","lancia","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","link","lipsy","live","living","lk","llc","llp","loan","loans","locker","locus","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","luxe","luxury","lv","ly","ma","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","merckmsd","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","moda","moe","moi","mom","monash","money","monster","mormon","mortgage","moscow","moto","motorcycles","mov","movie","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","music","mutual","mv","mw","mx","my","mz","na","nab","nagoya","name","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","racing","radio","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","ril","rio","rip","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scot","sd","se","search","seat","secure","security","seek","select","sener","services","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","spa","space","sport","spot","sr","srl","ss","st","stada","staples","star","statebank","statefarm","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiss","sx","sy","sydney","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","vermögensberater","vermögensberatung","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zm","zone","zuerich","zw","ελ","ευ","бг","бел","дети","ею","католик","ком","мкд","мон","москва","онлайн","орг","рус","рф","сайт","срб","укр","қаз","հայ","ישראל","קום","ابوظبي","اتصالات","ارامكو","الاردن","البحرين","الجزائر","السعودية","العليان","المغرب","امارات","ایران","بارت","بازار","بيتك","بھارت","تونس","سودان","سورية","شبكة","عراق","عرب","عمان","فلسطين","قطر","كاثوليك","كوم","مصر","مليسيا","موريتانيا","موقع","همراه","پاکستان","ڀارت","कॉम","नेट","भारत","भारतम्","भारोत","संगठन","বাংলা","ভারত","ভাৰত","ਭਾਰਤ","ભારત","ଭାରତ","இந்தியா","இலங்கை","சிங்கப்பூர்","భారత్","ಭಾರತ","ഭാരതം","ලංකා","คอม","ไทย","ລາວ","გე","みんな","アマゾン","クラウド","グーグル","コム","ストア","セール","ファッション","ポイント","世界","中信","中国","中國","中文网","亚马逊","企业","佛山","信息","健康","八卦","公司","公益","台湾","台灣","商城","商店","商标","嘉里","嘉里大酒店","在线","大拿","天主教","娱乐","家電","广东","微博","慈善","我爱你","手机","招聘","政务","政府","新加坡","新闻","时尚","書籍","机构","淡马锡","游戏","澳門","点看","移动","组织机构","网址","网店","网站","网络","联通","谷歌","购物","通販","集团","電訊盈科","飞利浦","食品","餐厅","香格里拉","香港","닷넷","닷컴","삼성","한국"];Object.defineProperty(t4,"__esModule",{value:!0});var Uc=Wc,Gc=j0(Uc),Jc=qc,Kc=j0(Jc);function j0(e){return e&&e.__esModule?e:{default:e}}var Z0=new Gc.default;Z0.tlds(Kc.default);t4.default=function(e){return Z0.match(e)};var a4={};Object.defineProperty(a4,"__esModule",{value:!0});a4.default=function(e){return e};Object.defineProperty(Q5,"__esModule",{value:!0});var Yc=function(){function e(a,c){for(var n=0;n<c.length;n++){var r=c[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(a,r.key,r)}}return function(a,c,n){return c&&e(a.prototype,c),n&&e(a,n),a}}(),Qc=s,M3=on(Qc),Xc=X5,en=P2(Xc),tn=e4,an=P2(tn),cn=t4,nn=P2(cn),rn=a4,sn=P2(rn);function P2(e){return e&&e.__esModule?e:{default:e}}function on(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c]);return a.default=e,a}function ln(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function Cn(e,a){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a&&(typeof a=="object"||typeof a=="function")?a:e}function dn(e,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof a);e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),a&&(Object.setPrototypeOf?Object.setPrototypeOf(e,a):e.__proto__=a)}var y0=function(e){dn(a,e);function a(){return ln(this,a),Cn(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return Yc(a,[{key:"parseString",value:function(n){var r=this;if(n==="")return n;var o=this.props.matchDecorator(n);if(!o)return n;var i=[],l=0;return o.forEach(function(h,C){h.index>l&&i.push(n.substring(l,h.index));var u=r.props.hrefDecorator(h.url),m=r.props.textDecorator(h.text),p=r.props.componentDecorator(u,m,C);i.push(p),l=h.lastIndex}),n.length>l&&i.push(n.substring(l)),i.length===1?i[0]:i}},{key:"parse",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof n=="string"?this.parseString(n):M3.isValidElement(n)&&n.type!=="a"&&n.type!=="button"?M3.cloneElement(n,{key:o},this.parse(n.props.children)):Array.isArray(n)?n.map(function(i,l){return r.parse(i,l)}):n}},{key:"render",value:function(){return M3.createElement(M3.Fragment,null,this.parse(this.props.children))}}]),a}(M3.Component);y0.defaultProps={componentDecorator:en.default,hrefDecorator:an.default,matchDecorator:nn.default,textDecorator:sn.default};Q5.default=y0;Object.defineProperty(f0,"__esModule",{value:!0});var hn=Q5,un=mn(hn);function mn(e){return e&&e.__esModule?e:{default:e}}var pn=f0.default=un.default;const vn=d(V)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),gn=d(O1)(({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})),fn=d(V)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),xn=({comment:e})=>t.jsxs(vn,{children:[t.jsx(S1,{title:e.createdBy.username,children:t.jsx(K7,{src:e.createdBy.imageUrl})}),t.jsxs(gn,{variant:"outlined",children:[t.jsx(fn,{children:t.jsxs(V,{children:[t.jsx("strong",{children:e.createdBy.username})," ",t.jsxs(k,{color:"text.secondary",component:"span",children:["commented"," ",t.jsx(H5,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),t.jsx(V,{sx:{paddingTop:2.5},children:t.jsx(pn,{children:e.text})})]})]}),b0=d(V)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),jn=d($6)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),Zn=d(A5)(({theme:e})=>({color:e.palette.error.main,marginLeft:"auto"})),V0=d(k)({maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"text.primary"}),yn=({name:e,imageUrl:a})=>t.jsxs(b0,{children:[t.jsx(W5,{src:a}),t.jsx(V0,{variant:"body1",children:e}),t.jsx(jn,{})]}),bn=({name:e,imageUrl:a})=>t.jsxs(b0,{children:[t.jsx(W5,{src:a}),t.jsx(V0,{variant:"body1",children:e}),t.jsx(Zn,{})]}),Vn=({rejections:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx(k,{variant:"body1",color:"text.secondary",children:"Rejected by"}),e.map(a=>t.jsx(bn,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),Sn=({approvals:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx(k,{variant:"body1",color:"text.secondary",children:t.jsx(S,{condition:(e==null?void 0:e.length)>0,show:"Approved by",elseShow:"No approvals yet"})}),e.map(a=>t.jsx(yn,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),wn=d(V)(({theme:e})=>({marginBottom:e.spacing(2)})),En=({actualApprovals:e,minApprovals:a})=>t.jsxs(t.Fragment,{children:["Reviewers"," ",t.jsxs(k,{component:"span",color:"text.secondary",children:["(",e,"/",a," required)"]})]}),_n=({header:e,children:a})=>t.jsxs(O1,{elevation:0,sx:c=>({marginTop:c.spacing(2),padding:c.spacing(4),borderRadius:n=>`${n.shape.borderRadiusLarge}px`}),children:[t.jsx(wn,{children:e}),a]}),Mn=({changeRequest:e})=>t.jsx(_n,{header:t.jsx(En,{actualApprovals:e.approvals.length,minApprovals:e.minApprovals}),children:t.jsx(S,{condition:e.state==="Rejected",show:t.jsx(Vn,{rejections:e.rejections}),elseShow:t.jsx(Sn,{approvals:e.approvals})})}),Hn=({open:e,onConfirm:a,onClose:c})=>{const[n,r]=s.useState("");return t.jsxs(E1,{open:e,primaryButtonText:"Reject changes",secondaryButtonText:"Cancel",onClick:()=>a(n),onClose:c,title:"Reject changes",fullWidth:!0,children:[t.jsx(V,{children:"Add an optional comment why you reject those changes"}),t.jsx(N3,{sx:{mt:1},variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>r(o.target.value),value:n})]})};var c4={},An=a3;Object.defineProperty(c4,"__esModule",{value:!0});var S0=c4.default=void 0,kn=An(t3()),Tn=t,Dn=(0,kn.default)((0,Tn.jsx)("path",{d:"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"}),"Today");S0=c4.default=Dn;const Y4=({disabled:e,onSchedule:a,onApply:c,variant:n="create",children:r})=>t.jsx(g0,{permission:k2,disabled:e,actions:[{label:"Apply changes",onSelect:c,icon:t.jsx(Z2,{fontSize:"small"})},{label:n==="create"?"Schedule changes":"Update schedule",onSelect:a,icon:t.jsx(S0,{fontSize:"small"})}],children:r}),Ln=d(h1)(({theme:e})=>({marginBottom:e.spacing(2),backgroundColor:`${e.palette.neutral.light}!important`,color:`${e.palette.text.primary}!important`,borderColor:`${e.palette.neutral.light}!important`})),w0=({open:e,onConfirm:a,onClose:c,title:n,primaryButtonText:r,message:o,scheduledTime:i,permissionButton:l})=>i?t.jsxs(E1,{title:n,primaryButtonText:r,secondaryButtonText:"Cancel",open:e,onClose:c,onClick:()=>a(),permissionButton:l,fullWidth:!0,children:[t.jsxs(Ln,{icon:!1,children:["There is a scheduled time to apply these changes set for"," ",t.jsxs("strong",{children:[t.jsx("br",{}),`${new Date(i).toLocaleString()}`]})]}),t.jsx(k,{variant:"body1",children:o})]}):null,Fn=({projectId:e,environment:a,disabled:c,onConfirm:n,...r})=>t.jsx(w0,{message:"Applying the changes now means the scheduled time will be ignored",title:"Apply changes",primaryButtonText:"Apply changes now",onConfirm:n,permissionButton:t.jsx(G1,{variant:"contained",onClick:()=>n(),projectId:e,permission:k2,environmentId:a,disabled:c,children:"Apply changes now"}),...r}),Pn=({...e})=>t.jsx(w0,{message:"Rejecting this change request will delete its schedule and it can no longer be rescheduled or applied.",title:"Reject changes",primaryButtonText:"Reject changes",...e}),Rn=d(V)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(2)})),In=({open:e,onConfirm:a,onClose:c,title:n,primaryButtonText:r,projectId:o,environment:i,disabled:l,scheduledAt:h})=>{const[C,u]=s.useState(h?new Date(h):new Date),[m,p]=s.useState(void 0),j=L2();return t.jsxs(E1,{title:n,primaryButtonText:r,secondaryButtonText:"Cancel",open:e,onClose:()=>c(),onClick:()=>a(C),permissionButton:t.jsx(G1,{variant:"contained",onClick:()=>a(C),projectId:o,permission:k2,environmentId:i,disabled:l,children:r}),fullWidth:!0,children:[t.jsx(h1,{severity:"info",sx:{mb:g=>g.spacing(2)},children:"The time shown below is based on your browser's time zone."}),t.jsx(k,{variant:"body1",sx:{mb:g=>g.spacing(4)},children:"Select the date and time when these changes should be applied. If you change your mind later, you can reschedule the changes or apply them immediately."}),t.jsxs(Rn,{children:[t.jsx(Y7,{label:"Date",value:C,onChange:g=>{p(void 0),g<new Date&&p(`The time you provided (${g.toLocaleString()}) is not valid because it's in the past. Please select a time in the future.`),u(g)},min:new Date,error:!!m,errorText:m,required:!0}),t.jsxs(k,{variant:"body2",children:["Your browser's time zone is ",j]})]})]})},Bn=d(V)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),On=d(O1)(({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%"}})),$n=d(V)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),zn=d(V)(({theme:e})=>({padding:e.spacing(2)})),Q4=d(d1)(({theme:e})=>({marginLeft:e.spacing(2)})),Nn=d(V)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Wn=()=>{var w3,J1;const e=W("projectId"),[a,c]=s.useState(!1),[n,r]=s.useState(!1),[o,i]=s.useState(!1),[l,h]=s.useState(!1),[C,u]=s.useState(!1),{user:m}=z6(),{isAdmin:p}=s.useContext($1),[j,g]=s.useState(""),y=W("id"),{data:v,refetchChangeRequest:f}=h0(e,y),{changeState:E,addComment:b,loading:L}=V2(),{refetch:I}=S2(e),{setToastData:_,setToastApiError:F}=o1(),{isChangeRequestConfiguredForReview:w}=d3(e),O=h3("scheduledConfigurationChanges");if(!v)return null;const B=w(v.environment),z=()=>{switch(v.state){case"Scheduled":return`${v.state} ${v.schedule.status}`;default:return v.state}},A=async()=>{try{await E(e,Number(y),z(),{state:"Applied"}),h(!1),f(),I(),_({type:"success",title:"Success",text:"Changes applied"})}catch(Y){F(c1(Y))}},P=async Y=>{try{await E(e,Number(y),z(),{state:"Scheduled",scheduledAt:Y.toISOString()}),i(!1),f(),I(),_({type:"success",title:"Success",text:"Changes scheduled"})}catch(_1){F(c1(_1))}},x=async()=>{try{await b(e,y,j),g(""),f(),_({type:"success",title:"Success",text:"Comment added"})}catch(Y){F(c1(Y))}},Z=async()=>{try{await E(e,Number(y),z(),{state:"Cancelled"}),c(!1),f(),I(),_({type:"success",title:"Success",text:"Changes cancelled"})}catch(Y){F(c1(Y))}},R=async Y=>{try{await E(e,Number(y),z(),{state:"Rejected",comment:Y}),r(!1),_({type:"success",title:"Success",text:"Changes rejected"}),f(),I()}catch(_1){F(c1(_1))}},M=async()=>{try{await E(e,Number(y),z(),{state:"Approved"}),f(),I(),_({type:"success",title:"Success",text:"Changes approved"})}catch(Y){F(c1(Y))}},N=()=>c(!0),T=()=>c(!1),U=()=>r(!1),D=()=>h(!1),K=()=>i(!1),y1=()=>u(!1),u1=(v==null?void 0:v.createdBy.id)===(m==null?void 0:m.id)&&v.state==="In review"&&!p,I1=(w3=v.approvals)==null?void 0:w3.some(Y=>Y.createdBy.id===(m==null?void 0:m.id)),i1=Q7(v);(()=>{if("schedule"in v)switch(v.schedule.status){case"failed":return(v.schedule.reason||v.schedule.failureReason)??void 0;case"suspended":return v.schedule.reason;default:return}})();const p1="schedule"in v?v.schedule.scheduledAt:void 0,K3=v.state==="Scheduled"?{state:"Scheduled",schedule:v.schedule}:{state:v.state,schedule:void 0};return t.jsxs(t.Fragment,{children:[t.jsx(ra,{changeRequest:v}),t.jsxs(Nn,{children:[t.jsxs(Bn,{children:[t.jsx(Ja,{...K3}),t.jsx(Mn,{changeRequest:v})]}),t.jsx(On,{elevation:0,children:t.jsxs(zn,{children:["Requested Changes (",i1,")",t.jsx(X7,{changeRequest:v,onRefetch:f}),(J1=v.comments)==null?void 0:J1.map(Y=>t.jsx(xn,{comment:Y},Y.id)),t.jsx(e8,{user:m,commentText:j,onTypeComment:g,children:t.jsx(d1,{variant:"outlined",onClick:x,disabled:!B||j.trim().length===0||j.trim().length>1e3,children:"Comment"})}),t.jsx(S,{condition:u1,show:t.jsx(h1,{sx:Y=>({marginTop:Y.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),t.jsx(lc,{changeRequest:v,onEditClick:()=>i(!0)}),t.jsxs($n,{children:[t.jsx(S,{condition:v.state==="In review"&&!I1,show:t.jsxs(Sc,{onReject:()=>r(!0),onApprove:M,disabled:!B,children:["Review changes (",i1,")"]})}),t.jsx(S,{condition:v.state==="Approved",show:t.jsx(S,{condition:O,show:t.jsx(Y4,{onApply:A,disabled:!B||L,onSchedule:()=>i(!0),children:"Apply or schedule changes"}),elseShow:t.jsx(G1,{variant:"contained",onClick:A,projectId:e,permission:k2,environmentId:v.environment,disabled:!B||L,children:"Apply changes"})})}),t.jsx(S,{condition:O&&v.state==="Scheduled",show:t.jsx(Y4,{onApply:()=>h(!0),disabled:!B||L,onSchedule:()=>i(!0),variant:"update",children:"Apply or schedule changes"})}),t.jsx(S,{condition:v.state!=="Applied"&&v.state!=="Rejected"&&v.state!=="Cancelled"&&(v.createdBy.id===(m==null?void 0:m.id)||p),show:t.jsx(S,{condition:O&&!!p1,show:t.jsx(Q4,{variant:"outlined",onClick:()=>u(!0),children:"Reject changes"}),elseShow:t.jsx(Q4,{variant:"outlined",onClick:N,children:"Cancel changes"})})})]})]})}),t.jsxs(E1,{open:a,onClick:Z,onClose:T,title:"Cancel change request",children:[t.jsx(k,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),t.jsx(k,{variant:"body2",sx:Y=>({color:Y.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."})]}),t.jsx(Hn,{open:n,onConfirm:R,onClose:U}),t.jsx(S,{condition:O,show:t.jsxs(t.Fragment,{children:[t.jsx(In,{open:o,onConfirm:P,onClose:K,disabled:!B||L,projectId:e,environment:v.environment,primaryButtonText:v.state==="Scheduled"?"Update scheduled time":"Schedule changes",title:v.state==="Scheduled"?"Update schedule":"Schedule changes",scheduledAt:p1}),t.jsx(Fn,{open:l,onConfirm:A,onClose:D,scheduledTime:p1,disabled:!B||L,projectId:e,environment:v.environment}),t.jsx(Pn,{open:C,onConfirm:R,onClose:y1,scheduledTime:p1})]})})]})]})},qn=({value:e,row:{original:a}})=>{const c=()=>e?t.jsx(O6,{changeRequest:a}):null;return e?t.jsx(Q,{children:c()}):t.jsx(Q,{})},Un=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),Gn=({value:e})=>{const{searchQuery:a}=k5();return t.jsx(Q,{children:t.jsx(Un,{children:t.jsxs(k,{component:"span",variant:"body2",children:[" ",t.jsx(C2,{search:a,children:e==null?void 0:e.username})]})})})},Jn=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),Kn=({value:e,row:{original:a}})=>{const{searchQuery:c}=k5(),n=W("projectId"),{id:r,title:o,features:i,segments:l}=a,h=(i||[]).length+(l||[]).length,C=`/projects/${n}/change-requests/${r}`;return e?t.jsxs(Q,{sx:{minWidth:"200px"},children:[t.jsx(Jn,{children:t.jsx(k,{variant:"body2",children:t.jsx(C3,{component:v1,underline:"hover",to:C,sx:u=>({paddingTop:u.spacing(.2),marginRight:u.spacing(1),"&:hover":{textDecoration:"underline"}}),children:t.jsx(C2,{search:c,children:o})})})}),t.jsxs("span",{children:[`${h}`," ",h<=1?"update":"updates"]})]}):t.jsx(Q,{})},Yn=t8()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(2,4,4,4),overflowX:"auto"}})),Qn=d(V)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),Xn=d(v1)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),er=d(v1)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),tr=d(V)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),ar=({value:e,project:a})=>{const{searchQuery:c}=k5(),n=e==null?void 0:e.map(r=>r.name);return t.jsx(Qn,{children:t.jsx(S,{condition:(n==null?void 0:n.length)<3,show:n==null?void 0:n.map(r=>t.jsx(Xn,{title:r,to:`/projects/${a}/features/${r}`,children:t.jsx(C2,{search:c,children:r})},r)),elseShow:t.jsxs(T5,{tooltipProps:{maxWidth:"800px"},tooltip:t.jsx(tr,{children:n==null?void 0:n.map(r=>t.jsx(er,{title:r,to:`/projects/${a}/features/${r}`,children:t.jsx(C2,{search:c,children:r})},r))}),children:[n==null?void 0:n.length," toggles"]})})})},cr={id:"createdAt",desc:!0},nr=d("div")({paddingLeft:0,paddingBottom:0}),rr=d(i2)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),sr=d(V)(({theme:e})=>({textAlign:"right",paddingBottom:e.spacing(2),fontSize:e.fontSizes.smallBody})),or=({changeRequests:e=[],loading:a,projectId:c})=>{var P,x;const{classes:n}=Yn(),r=m1(d2.breakpoints.down("md")),[o,i]=N6(),[l,h]=s.useState(o.get("search")||""),{value:C,setValue:u}=b5(`${c}:ProjectChangeRequest`,cr),[m,p]=s.useMemo(()=>{const Z=e.filter(M=>M.state!=="Cancelled"&&M.state!=="Rejected"&&M.state!=="Applied"),R=e.filter(M=>M.state==="Cancelled"||M.state==="Rejected"||M.state==="Applied");return[Z,R]},[e]),j=[{title:"Change requests",data:m},{title:"Closed",data:p}],[g,y]=s.useState(0),v=s.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:Kn},{id:"Updated feature toggles",Header:"Updated feature toggles",canSort:!1,accessor:"features",searchable:!0,filterName:"feature",filterParsing:Z=>(Z==null?void 0:Z.map(({name:R})=>R).join(`
|
|
2
2
|
`))||"",filterBy:(Z,R)=>Z.features.find(M=>R.map(N=>N.toLowerCase()).includes(M.name.toLowerCase())),Cell:({value:Z,row:{original:{title:R}}})=>t.jsx(ar,{project:c,value:Z},R)},{Header:"By",accessor:"createdBy",maxWidth:180,canSort:!1,Cell:Gn,align:"left",searchable:!0,filterName:"by",filterParsing:Z=>(Z==null?void 0:Z.username)||""},{Header:"Submitted",accessor:"createdAt",maxWidth:100,Cell:h2},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:x2,filterName:"environment"},{Header:"Status",accessor:"state",searchable:!0,maxWidth:"170px",Cell:qn,filterName:"status"}],[c]),{data:f,getSearchText:E,getSearchContext:b}=D5(v,l,(P=j[g])==null?void 0:P.data),L=s.useMemo(()=>a?a8:f,[f,a]),[I]=s.useState(()=>({sortBy:[{id:o.get("sort")||C.id,desc:o.has("order")?o.get("order")==="desc":C.desc}],hiddenColumns:[]})),{headerGroups:_,rows:F,state:{sortBy:w},prepareRow:O,setHiddenColumns:B,getTableProps:z,getTableBodyProps:A}=t1.useTable({columns:v,data:L,initialState:I,sortTypes:u3,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:Q}},t1.useSortBy);return m3([{condition:r,columns:["createdBy"]}],B,v),s.useEffect(()=>{if(a)return;const Z={};Z.sort=w[0].id,w[0].desc&&(Z.order="desc"),l&&(Z.search=l),i(Z,{replace:!0}),u(R=>({...R,id:w[0].id,desc:w[0].desc||!1}))},[a,w,l,i]),t.jsxs(n1,{isLoading:a,bodyClass:n.bodyClass,headerClass:n.header,header:t.jsx(X,{titleElement:t.jsx(nr,{children:t.jsx(L5,{value:(x=j[g])==null?void 0:x.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:j.map((Z,R)=>t.jsx(rr,{label:`${Z.title} (${Z.data.length})`,value:Z.title,onClick:()=>y(R)},Z.title))})}),actions:t.jsx(T1,{placeholder:"Search and Filter",expandable:!0,initialValue:l,onChange:h,hasFilters:!0,getSearchContext:b,id:"changeRequestList"})}),children:[t.jsx(sr,{children:t.jsx(v1,{to:`/projects/${c}/settings/change-requests`,children:"Change request configuration"})}),t.jsx(l3,{value:E(l),children:t.jsxs(L3,{...z(),children:[t.jsx(F3,{headerGroups:_}),t.jsx(P3,{...A(),children:F.map(Z=>(O(Z),t.jsx(R3,{hover:!0,...Z.getRowProps(),children:Z.cells.map(R=>t.jsx(I3,{...R.getCellProps(),padding:"none",children:R.render("Cell")}))})))})]})}),t.jsx(S,{condition:F.length===0,show:()=>t.jsx(S,{condition:(l==null?void 0:l.length)>0,show:t.jsxs(g1,{children:["No changes found matching “",l,"”"]}),elseShow:t.jsx(g1,{children:"None of the changes were submitted yet."})})})]})},ir=()=>{const e=W("projectId"),a=X1(e),{isOss:c,isPro:n}=a1();Z1(`Change requests – ${a}`);const{changeRequests:r,loading:o}=n0(e);return c()||n()?t.jsx(n1,{sx:{justifyContent:"center"},children:t.jsx(j3,{feature:"change-requests"})}):t.jsx(or,{changeRequests:r,projectId:e,loading:o})};var q=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(q||{});const G3=(e,a={})=>{const c=L1(`api/admin/projects/${e}/access`),n=()=>fetch(c,{method:"GET"}).then(F1("project access")).then(m=>m.json()),r=`api/admin/projects/${e}/users`,{data:o,error:i}=U1(r,n,a),[l,h]=s.useState(!i&&!o),C=()=>{M5(r)};return s.useEffect(()=>{h(!i&&!o)},[o,i]),{access:s.useMemo(()=>{if(o)return lr({roles:o.roles,users:o.users.filter(({accountType:m})=>!m||m==="User"),serviceAccounts:o.users.filter(({accountType:m})=>m==="Service Account"),groups:(o==null?void 0:o.groups.map(m=>({...m,users:l9(m.users??[])})))??[]})},[o]),error:i,loading:l,refetchProjectAccess:C}},lr=e=>{const a=e.users||[],c=e.serviceAccounts||[],n=e.groups||[];return{...e,rows:[...a.map(r=>({entity:r,type:"USERS"})),...c.map(r=>({entity:r,type:"SERVICE ACCOUNTS"})),...n.map(r=>({entity:r,type:"GROUPS"}))]}},Cr=d(n1)(({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`})),dr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{display:"flex",alignItems:"center",color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),X4={id:"joinedAt",desc:!0},a5=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>t.jsx(Q,{children:t.jsx(P5,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:({value:e,row:{original:a}})=>t.jsx(x2,{value:e,subtitle:a.email||a.username}),minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:E2,maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>t.jsx(h2,{value:e.seenAt,emptyText:"Never",title:a=>`Last login: ${a}`}),maxWidth:150},{accessor:e=>e.username||"",Header:"Username",searchable:!0},{accessor:e=>e.email||"",Header:"Email",searchable:!0}],hr=["imageUrl","name","joined","lastLogin"],ur=({open:e,setOpen:a,group:c,projectId:n,subtitle:r,onEdit:o,onRemove:i})=>{const l=r1(),h=m1(l.breakpoints.down("md")),[C]=s.useState(()=>({sortBy:[{id:X4.id,desc:X4.desc}],hiddenColumns:["Username","Email"]})),[u,m]=s.useState(""),{data:p,getSearchText:j,getSearchContext:g}=D5(a5,u,(c==null?void 0:c.users)??[]),{headerGroups:y,rows:v,prepareRow:f,setHiddenColumns:E}=t1.useTable({columns:a5,data:p,initialState:C,sortTypes:u3,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},t1.useSortBy,t1.useFlexLayout);return m3([{condition:h,columns:hr}],E,a5),t.jsx(q1,{open:e,onClose:()=>{a(!1)},label:(c==null?void 0:c.name)||"Group",children:t.jsxs(Cr,{header:t.jsx(X,{secondary:!0,titleElement:t.jsxs(dr,{children:[c==null?void 0:c.name," (",v.length<p.length?`${v.length} of ${p.length}`:p.length,")",t.jsx("span",{children:r})]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(S,{condition:!h,show:t.jsxs(t.Fragment,{children:[t.jsx(T1,{initialValue:u,onChange:m,hasFilters:!0,getSearchContext:g}),t.jsx(X.Divider,{})]})}),t.jsx(o3,{permission:j1,projectId:n,tooltipProps:{title:"Edit group access"},onClick:o,children:t.jsx(z3,{})}),t.jsx(o3,{permission:j1,projectId:n,tooltipProps:{title:"Remove group access"},onClick:i,children:t.jsx(F5,{})})]}),children:t.jsx(S,{condition:h,show:t.jsx(T1,{initialValue:u,onChange:m,hasFilters:!0,getSearchContext:g})})}),children:[t.jsx(l3,{value:j(u),children:t.jsx(_2,{rows:v,headerGroups:y,prepareRow:f})}),t.jsx(S,{condition:v.length===0,show:t.jsx(S,{condition:(u==null?void 0:u.length)>0,show:t.jsxs(g1,{children:["No users found matching “",u,"” in this group."]}),elseShow:t.jsx(g1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},mr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),pr=({roles:e,value:a,setValue:c,required:n,...r})=>{const o=(i,l,h)=>t.jsxs("li",{...i,children:[t.jsx(S5,{icon:t.jsx(q6,{fontSize:"small"}),checkedIcon:t.jsx(U6,{fontSize:"small"}),style:{marginRight:8},checked:h.selected}),t.jsxs(mr,{children:[t.jsx("span",{children:l.name}),t.jsx("span",{children:l.description})]})]});return t.jsxs(t.Fragment,{children:[t.jsx(W6,{multiple:!0,disableCloseOnSelect:!0,openOnFocus:!0,size:"small",value:a,onChange:(i,l)=>c(l),options:e,renderOption:o,getOptionLabel:i=>i.name,renderInput:i=>t.jsx(N3,{...i,label:"Role",required:n}),...r}),t.jsx(S,{condition:a.length>0,show:()=>a.map(({id:i})=>t.jsx(c8,{sx:{marginTop:1},roleId:i},i))})]})},vr=d("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),e6=d("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),t6=d("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),gr=d("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),fr=d(d1)(({theme:e})=>({marginLeft:e.spacing(3)})),xr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),jr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),n4=({selected:e,accesses:a,users:c,serviceAccounts:n,groups:r,roles:o})=>{const{uiConfig:i}=a1(),{flags:l}=i,h=l.UG?"user / group":"user",C=W("projectId"),{refetchProjectAccess:u}=G3(C),{addAccessToProject:m,setUserRoles:p,setGroupRoles:j,loading:g}=e3(),y=!!e,{setToastData:v,setToastApiError:f}=o1(),E=R1(),b=[...r.filter(x=>y||!a.some(({entity:{id:Z},type:R})=>x.id===Z&&R===q.GROUP)).map(x=>({id:x.id,entity:x,type:q.GROUP})),...c.filter(x=>y||!a.some(({entity:{id:Z},type:R})=>x.id===Z&&R===q.USER)).sort((x,Z)=>{const R=x.name||x.username||"",M=Z.name||Z.username||"";return R.localeCompare(M)}).map(x=>({id:x.id,entity:x,type:q.USER})),...n.filter(x=>y||!a.some(({entity:{id:Z},type:R})=>x.id===Z&&R===q.SERVICE_ACCOUNT)).sort((x,Z)=>{const R=x.name||x.username||"",M=Z.name||Z.username||"";return R.localeCompare(M)}).map(x=>({id:x.id,entity:x,type:q.SERVICE_ACCOUNT}))],[L,I]=s.useState(()=>b.filter(({id:x,type:Z})=>x===(e==null?void 0:e.entity.id)&&Z===(e==null?void 0:e.type))),[_,F]=s.useState(o.filter(({id:x})=>{var Z,R;return(R=(Z=e==null?void 0:e.entity)==null?void 0:Z.roles)==null?void 0:R.includes(x)})),w={roles:_.map(({id:x})=>x),groups:L==null?void 0:L.filter(({type:x})=>x===q.GROUP).map(({id:x})=>x),users:L==null?void 0:L.filter(({type:x})=>x===q.USER||x===q.SERVICE_ACCOUNT).map(({id:x})=>x)},O=async x=>{if(x.preventDefault(),!!P)try{y?(e==null?void 0:e.type)===q.USER||(e==null?void 0:e.type)===q.SERVICE_ACCOUNT?await p(C,_.map(({id:Z})=>Z),e.entity.id):(e==null?void 0:e.type)===q.GROUP&&await j(C,_.map(({id:Z})=>Z),e.entity.id):await m(C,w),u(),E(W1),v({title:`${L.length} ${L.length===1?"access":"accesses"} ${y?"edited":"assigned"} successfully`,type:"success"})}catch(Z){f(c1(Z))}},B=()=>y?`curl --location --request PUT '${i.unleashUrl}/api/admin/projects/${C}/${(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' \\
|
|
3
3
|
--header 'Authorization: INSERT_API_KEY' \\
|
|
4
4
|
--header 'Content-Type: application/json' \\
|