unleash-server 6.0.2 → 6.0.3

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.
Files changed (31) hide show
  1. package/dist/lib/features/playground/advanced-playground.test.js +26 -1
  2. package/dist/lib/features/playground/advanced-playground.test.js.map +1 -1
  3. package/dist/lib/features/playground/feature-evaluator/client.d.ts.map +1 -1
  4. package/dist/lib/features/playground/feature-evaluator/client.js +2 -6
  5. package/dist/lib/features/playground/feature-evaluator/client.js.map +1 -1
  6. package/dist/test/e2e/helpers/test-helper.d.ts +2 -2
  7. package/dist/test/e2e/helpers/test-helper.d.ts.map +1 -1
  8. package/dist/test/e2e/helpers/test-helper.js +1 -1
  9. package/dist/test/e2e/helpers/test-helper.js.map +1 -1
  10. package/frontend/build/index.html +1 -1
  11. package/frontend/build/static/{AdvancedPlayground-p7tDUOqb.js → AdvancedPlayground-CQsMokDK.js} +1 -1
  12. package/frontend/build/static/{CheckCircleOutline-CZoWHYza.js → CheckCircleOutline-3N2b6C6u.js} +1 -1
  13. package/frontend/build/static/{CreateProject-DhmoT0x8.js → CreateProject-C50_8DJ-.js} +1 -1
  14. package/frontend/build/static/{FeatureMetricsChart-CrJhmvRS.js → FeatureMetricsChart-D7hBu9bH.js} +1 -1
  15. package/frontend/build/static/{FeatureStaleDialog-z-UTple3.js → FeatureStaleDialog-D-1JGcwj.js} +1 -1
  16. package/frontend/build/static/{FeatureViewLazyExport-BOJHJp48.js → FeatureViewLazyExport-CJKGy-V3.js} +2 -2
  17. package/frontend/build/static/{LazyAdminExport-BfaFcAaS.js → LazyAdminExport-DiDAlXlQ.js} +2 -2
  18. package/frontend/build/static/{LazyProjectExport-DbkNqnlj.js → LazyProjectExport-BeTXfctj.js} +2 -2
  19. package/frontend/build/static/{LineChartComponent-CLaoKci9.js → LineChartComponent-Bf3RodVh.js} +1 -1
  20. package/frontend/build/static/{NetworkOverview-Cq83oqfi.js → NetworkOverview-C-R8wA4S.js} +1 -1
  21. package/frontend/build/static/{NetworkTraffic-Bt6v3FUz.js → NetworkTraffic-D_eVTdGp.js} +1 -1
  22. package/frontend/build/static/{NetworkTrafficUsage-Dv8h54l9.js → NetworkTrafficUsage-BlFVx812.js} +1 -1
  23. package/frontend/build/static/{ProjectForm-CrLtsMQu.js → ProjectForm-c43ztjmB.js} +1 -1
  24. package/frontend/build/static/{ReactJSONEditor-C-nON7ak.js → ReactJSONEditor-DJyV5xPu.js} +1 -1
  25. package/frontend/build/static/{RoleCell-6hhnTvjl.js → RoleCell-C-E960FF.js} +1 -1
  26. package/frontend/build/static/{StrategyItemContainer-BDY93O1W.js → StrategyItemContainer-CvZqeW-d.js} +1 -1
  27. package/frontend/build/static/{index-DZdOsPxT.js → index-Bql--RTy.js} +1 -1
  28. package/frontend/build/static/{index-lGwH-xa2.js → index-D3PezXCS.js} +45 -45
  29. package/frontend/build/static/{unknownify-D-iKcXLX.js → unknownify-C7_4al21.js} +1 -1
  30. package/frontend/build/static/{useApiTokens-BhaMXLXr.js → useApiTokens-ZwBU99TL.js} +1 -1
  31. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{s as d,di as K8,df as b2,w as k1,x as T1,j as t,a6 as J3,r as l,f7 as J8,ac as Y,a4 as c1,a7 as Y3,a8 as Q3,a9 as X3,aa as e2,q as R2,aN as D1,K as i1,bj as s3,b5 as g1,b7 as S1,f8 as i6,aJ as q,f9 as F1,cI as C1,c as u1,da as X1,fa as e3,b8 as X,fb as Y8,af as P2,dz as z0,fc as l6,fd as b1,av as t1,ap as _1,au as d1,C,aM as Q,ar as r3,aq as f1,dd as Q8,aj as M0,fe as X8,B as Z,n as Z1,v as j1,aX as L0,a2 as t2,aY as a2,M as R1,ff as c3,aZ as P1,d as b3,dj as e7,a$ as I1,T as $,fg as H1,dk as N0,dl as d6,be as I2,dp as t7,ai as Z3,D as S3,aP as q0,E as h6,ak as x1,h as o1,fh as a7,fi as n7,fj as c7,f as r1,cB as s7,cA as o3,aS as C3,cC as u6,aT as $2,aW as w3,aU as V2,fk as p6,e7 as H0,am as n2,a as l1,ad as v1,b9 as V1,ba as B1,fl as r7,dT as o7,fm as i7,de as l7,cF as c2,bl as Y1,fn as d7,fo as h7,G as g3,em as _3,fp as m6,fq as L1,en as $1,fr as O4,fs as u7,aK as p7,bi as v6,d6 as q1,d9 as Z2,ft as m7,d7 as f3,fu as v7,d8 as g7,fv as n0,fw as g6,fx as f7,fy as f6,fz as x6,dg as x7,fA as B4,fB as j7,fC as y7,dS as O2,fD as b7,fE as Z7,fF as j6,fG as y6,fH as b6,fI as S7,fJ as Z6,b6 as B2,fK as S6,fL as C6,f0 as C7,fM as w7,bk as w6,z as U1,fN as W0,a1 as _7,an as E3,fO as E7,bg as _6,fP as E6,fQ as A6,fR as A7,fS as k7,fT as T7,fU as D7,a5 as A3,ag as k3,ah as z2,m as F7,aL as R7,fV as P7,fW as s2,fX as I7,fY as k6,fZ as $7,f_ as V7,aH as M2,aF as T3,aG as D3,aI as F3,f$ as O7,bb as R3,g0 as P3,b as S2,cE as U0,g1 as T6,g2 as B7,a_ as r2,g3 as z7,b3 as i3,g4 as M7,y as D6,g5 as L7,g6 as F6,c6 as G1,c5 as R6,g7 as N7,l as q7,g8 as H7,k as t3,g9 as G0,ga as W7,gb as U7,gc as G7,gd as K7,ge as J7,b1 as I3,d1 as G3,al as P6,ef as C2,ao as K0,gf as Y7,dn as J0,c4 as Q7,dN as l3,cM as W1,bd as x3,b0 as o2,e5 as Y0,A as i2,dF as X7,aQ as I6,aR as $6,dE as Q1,ce as d3,gg as ee,gh as te,e4 as m2,gi as ae,gj as ne,gk as ce,gl as c0,gm as se,gn as re,cK as $3,cL as K,go as oe,gp as V6,gq as ie,gr as z4,gs as M4,gt as O6,gu as le,u as L2,dC as de,gv as he,dD as ue,gw as L4,gx as pe,gy as me,gz as ve,gA as ge,gB as fe,c1 as xe,c2 as je,cs as Q0,ct as X0,cu as e4,cv as ye,V as be,gC as Ze,gD as Se,cH as B6,gE as Ce,t as N4,cR as we,gF as _e,gG as z6,gH as Ee,gI as Ae,gJ as ke,gK as Te,gL as De,gM as Fe,gN as Re,gO as Pe,gP as t4,d2 as M6,gQ as a4,cx as Ie,dV as s0,cz as $e,gR as Ve,gS as N3,gT as Oe,gU as Be,gV as q4,gW as H4,gX as ze,gY as Me,gZ as Le,g_ as Ne,g$ as qe,cS as w2,h0 as He,f1 as We,h1 as Ue,f4 as Ge,du as W4,dr as Ke,dh as L6,e$ as D0,h2 as Je,d_ as N6,aE as j3,h3 as J,h4 as Ye,h5 as Qe,h6 as Xe,h7 as e9,cX as q6,h8 as t9,cy as a9,h9 as n9,ha as c9,hb as s9,c8 as r9,hc as o9,hd as i9,he as l9}from"./index-lGwH-xa2.js";import{h as d9,i as h9,j as F0,F as H6,f as u9,e as W6,T as p9,g as m9,d as v9,V as g9,k as f9,M as x9,c as j9,E as y9}from"./FeatureStaleDialog-z-UTple3.js";import{m as b9,i as U4,b as Z9,c as S9,d as C9,e as w9,E as _9,f as E9,u as A9,a as k9,R as T9,C as D9,A as F9,g as U6}from"./RoleCell-6hhnTvjl.js";import{S as R9}from"./StrategyItemContainer-BDY93O1W.js";import{C as P9,P as I9}from"./ProjectForm-CrLtsMQu.js";import{d as N2}from"./CheckCircleOutline-CZoWHYza.js";const G4=d("div")(()=>({display:"flex"})),$9=d("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));d("div")(()=>({display:"flex",flexDirection:"column"}));const V9=d("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),O9=d("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));d(O9)(({theme:e})=>({color:e.palette.neutral.dark}));const B9=d(K8)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),z9=d("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),M9=d("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),L9=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)})),N9=d("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),q9=d("div")(({theme:e})=>({padding:e.spacing(0,4)})),H9=d(b2)(({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}}));var n4={},W9=T1;Object.defineProperty(n4,"__esModule",{value:!0});var G6=n4.default=void 0,U9=W9(k1()),G9=t,K9=(0,U9.default)((0,G9.jsx)("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload");G6=n4.default=K9;const J9=e=>e.reduce((a,n)=>n.enabled?a+1:a,0),Y9=d(J3)(({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"})),X9=({environment:e,warnEnabledToggles:a})=>{const n=l.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:h}})=>t.jsx(J8,{environment:h})},{Header:"Name",accessor:"name",Cell:Y},{Header:"Type",accessor:"type",Cell:Y},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:h})=>t.jsx(Y,{children:t.jsx(Q9,{warning:h>0,children:h===1?"1 toggle":`${h} toggles`})}),align:"center"}],[a]),{getTableProps:c,getTableBodyProps:s,headerGroups:r,rows:o,prepareRow:i}=c1.useTable({columns:n,data:[e],disableSortBy:!0});return t.jsxs(Y9,{...c(),rowHeight:"compact",children:[t.jsx(Y3,{headerGroups:r}),t.jsx(Q3,{...s(),children:o.map(h=>(i(h),t.jsx(X3,{hover:!0,...h.getRowProps(),children:h.cells.map(u=>t.jsx(e2,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},et=d("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),tt=d(R2)(()=>({width:"100%"})),at=({environment:e,open:a,setOpen:n,onConfirm:c})=>{const[s,r]=l.useState("");return l.useEffect(()=>{r("")},[a]),t.jsxs(D1,{title:"Hide environment and disable feature flags?",open:a,primaryButtonText:"Hide environment and disable feature flags",disabledPrimaryButton:(e==null?void 0:e.name)!==s,secondaryButtonText:"Close",onClick:c,onClose:()=>{n(!1)},children:[t.jsxs(i1,{severity:"error",children:[t.jsx("strong",{children:"Danger!"})," Hiding an environment will disable all the feature flags that are enabled in this environment and it can impact client applications connected to the environment."]}),t.jsx(X9,{environment:e}),t.jsxs(et,{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(tt,{label:"Environment name",value:s,onChange:o=>r(o.target.value)})]})},nt=e=>{const{data:a,error:n,mutate:c}=s3(g1(`api/admin/environments/project/${e}`),ct),s=l.useMemo(()=>a||[],[a]),r=l.useCallback(async()=>{await c()},[c]);return{environments:s,refetchEnvironments:r,loading:!n&&!a,error:n}},ct=async e=>(await fetch(e).then(S1("Environments")).then(n=>n.json())).environments.sort((n,c)=>n.sortOrder-c.sortOrder),st=d(i1)(({theme:e})=>({marginBottom:e.spacing(4)})),rt=d("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),ot=d(i6)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),K6=()=>{const e=q("projectId"),a=F1(e);C1(`Project environments – ${a}`);const{setToastData:n,setToastApiError:c}=u1(),{environments:s,loading:r,error:o,refetchEnvironments:i}=nt(e),{project:h,refetch:u}=X1(e),{removeEnvironmentFromProject:m,addEnvironmentToProject:p}=e3(),[f,g]=l.useState(),[v,S]=l.useState(!1),{isOss:x}=X(),b=l.useMemo(()=>s.map(j=>({...j,projectVisible:h==null?void 0:h.environments.map(A=>A.environment).includes(j.name)})),[s,h==null?void 0:h.environments]),w=()=>{i(),u()},E=()=>t.jsx(ot,{onClick:w,text:"Error fetching environments"}),O=j=>`Got an API error when trying to set the environment as ${j?"visible":"hidden"}`,k=async j=>{if(j.projectVisible){if(J9(b)>1){g(j),S(!0);return}n({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await p(e,j.name),w(),n({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{c(O(!0))}},_=async()=>{if(f)try{await m(e,f.name),w(),n({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{c(O(!1))}finally{S(!1)}},T=j=>x()&&j==="default",R=l.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:j}})=>t.jsx(Y8,{environment:j})},{Header:"Type",accessor:"type",Cell:P2},{Header:"Project API tokens",accessor:j=>j.projectApiTokenCount===1?"1 token":`${j.projectApiTokenCount} tokens`,Cell:Y},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:j}})=>t.jsx(z0,{children:t.jsx(l6,{tooltip:j.projectVisible?"Hide environment and disable feature flags":"Make it visible",size:"medium",disabled:T(j.name),projectId:e,permission:b1,checked:j.projectVisible,onChange:()=>k(j)})}),disableGlobalFilter:!0}],[b]),{getTableProps:F,getTableBodyProps:B,headerGroups:I,rows:M,prepareRow:H,state:{globalFilter:D},setGlobalFilter:P}=c1.useTable({columns:R,data:b,disableSortBy:!0},c1.useGlobalFilter),W=t.jsx(t1,{title:`Environments (${M.length})`,actions:t.jsx(_1,{initialValue:D,onChange:P})});return t.jsx(d1,{header:W,isLoading:r,children:t.jsxs(rt,{children:[t.jsx(C,{condition:!!o,show:E()}),t.jsxs(st,{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(Q,{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(Q,{to:"/admin/api",children:"create a new API token here"}),"."]}),t.jsx(r3,{value:D,children:t.jsxs(J3,{...F(),rowHeight:"compact",children:[t.jsx(Y3,{headerGroups:I}),t.jsx(Q3,{...B(),children:M.map(j=>(H(j),t.jsx(X3,{hover:!0,...j.getRowProps(),children:j.cells.map(A=>t.jsx(e2,{...A.getCellProps(),children:A.render("Cell")}))})))})]})}),t.jsx(C,{condition:M.length===0,show:t.jsx(C,{condition:(D==null?void 0:D.length)>0,show:t.jsxs(f1,{children:["No environments found matching “",D,"”"]}),elseShow:t.jsx(f1,{children:"No environments available. Get started by adding one."})})}),t.jsx(at,{environment:f,open:v,setOpen:S,onConfirm:_})]})})},it={id:"archivedAt"},lt=({projectId:e})=>{const{archivedFeatures:a,loading:n,refetchArchived:c}=Q8(e),{value:s,setValue:r}=M0(`${e}:ProjectFeaturesArchiveTable`,it);return t.jsx(X8,{title:"Project archive",archivedFeatures:a||[],loading:n,storedParams:s,setStoredParams:r,refetch:c,projectId:e})},dt=()=>{const e=q("projectId"),a=F1(e);return C1(`Project archive – ${a}`),t.jsx(lt,{projectId:e})},ht=d(Z)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),ut=({projectId:e,row:a,onOpenArchiveDialog:n,onOpenStaleDialog:c})=>{const[s,r]=l.useState(null),[o,i]=l.useState(!1),{setToastData:h}=u1(),{original:{name:u,stale:m}}=a,p=!!s,f=b=>{r(b.currentTarget)},g=()=>{r(null)},v=`feature-${u}-actions`,S=`${v}-menu`,x=()=>{try{t7(u),i(!0),setTimeout(()=>{g(),i(!1)},1e3)}catch{h({type:"error",title:"Could not copy feature name"})}};return t.jsxs(ht,{children:[t.jsx(Z1,{title:"Feature flag actions",arrow:!0,describeChild:!0,children:t.jsx(j1,{id:v,"data-loading":!0,"aria-controls":p?S:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:f,type:"button",children:t.jsx(L0,{})})}),t.jsx(t2,{id:S,anchorEl:s,open:p,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:t.jsxs(a2,{"aria-labelledby":v,children:[t.jsxs(R1,{sx:c3,onClick:x,children:[t.jsx(P1,{children:o?t.jsx(b3,{}):t.jsx(e7,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:o?"Copied!":"Copy Name"})})]}),t.jsx(H1,{projectId:e,permission:N0,children:({hasAccess:b})=>t.jsxs(R1,{sx:c3,onClick:g,disabled:!b,component:Q,to:`/projects/${e}/features/${u}/copy`,children:[t.jsx(P1,{children:t.jsx(d9,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Clone"})})]})}),t.jsx(H1,{projectId:e,permission:d6,children:({hasAccess:b})=>t.jsxs(R1,{sx:c3,onClick:()=>{n(u),g()},disabled:!b,children:[t.jsx(P1,{children:t.jsx(h9,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Archive"})})]})}),t.jsx(H1,{projectId:e,permission:I2,children:({hasAccess:b})=>t.jsxs(R1,{sx:c3,onClick:()=>{g(),c({featureId:u,stale:m===!0})},disabled:!b,children:[t.jsx(P1,{children:t.jsx(F0,{})}),t.jsx(I1,{children:t.jsxs($,{variant:"body2",children:[m?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var c4={},pt=T1;Object.defineProperty(c4,"__esModule",{value:!0});var J6=c4.default=void 0,mt=pt(k1()),vt=t,gt=(0,mt.default)((0,vt.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");J6=c4.default=gt;const ft=d(Z)(()=>({...Z3,justifyContent:"center"})),xt=d(j1)(({theme:e})=>({margin:e.spacing(-1,0)})),jt=d(Z)(({theme:e})=>({...Z3,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),yt=d(R1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),bt=d(S3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),Zt=d(q0)(({theme:e})=>({padding:e.spacing(.75,1)})),St=({columns:e,onToggle:a})=>{const[n,c]=l.useState(null),s=u=>{c(u.currentTarget)},r=()=>{c(null)},o=!!n,i="columns-menu",h=`columns-menu-list-${i}`;return t.jsxs(ft,{children:[t.jsx(Z1,{title:"Select columns",arrow:!0,describeChild:!0,children:t.jsx(xt,{id:i,"aria-controls":o?h:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:s,type:"button",size:"large","data-loading":!0,children:t.jsx(J6,{})})}),t.jsxs(t2,{id:h,open:o,anchorEl:n,onClose:r,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:u=>({borderRadius:u.shape.borderRadius,paddingBottom:u.spacing(2)})},children:[t.jsxs(jt,{children:[t.jsx($,{variant:"body2",children:t.jsx("strong",{children:"Columns"})}),t.jsx(j1,{onClick:r,children:t.jsx(h6,{})})]}),t.jsx(a2,{children:e.map(u=>u.id==="divider"?t.jsx(bt,{},"divider"):t.jsxs(yt,{onClick:()=>{a==null||a(u.id)},disabled:u.isStatic===!0&&u.isVisible===!0,children:[t.jsx(P1,{children:t.jsx(Zt,{edge:"start",checked:u.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":u.id},size:"medium"})}),t.jsx(I1,{id:u.id,primary:t.jsx($,{variant:"body2",children:u.header})})]},u.id))})]})]})},Ct=7,wt=e=>{const a=a7(new Date,-Ct);return!!(e!=null&&e.lastSeenAt&&n7(new Date(e.lastSeenAt),a))},_t=({projectId:e,featureIds:a,features:n,onConfirm:c})=>{const[s,r]=l.useState(!1),{trackEvent:o}=x1(),i=l.useMemo(()=>a.filter(u=>{const m=n.find(p=>p.name===u);return wt(m)}),[JSON.stringify(n),a]),h=async()=>{r(!1),c==null||c(),o("batch_operations",{props:{eventType:"features archived"}})};return t.jsxs(t.Fragment,{children:[t.jsx(H1,{projectId:e,permission:d6,children:({hasAccess:u})=>t.jsx(o1,{disabled:!u||s,variant:"outlined",size:"small",onClick:()=>r(!0),children:"Archive"})}),t.jsx(H6,{projectId:e,featureIds:a,featuresWithUsage:i,onConfirm:h,isOpen:s,onClose:()=>r(!1)})]})},v2="selection-actions-menu",Et=({projectId:e,data:a,onChange:n})=>{const[c,s]=l.useState(null),{staleFeatures:r}=e3(),{setToastData:o,setToastApiError:i}=u1(),{trackEvent:h}=x1(),u=!!c,m=a.map(({name:b})=>b),p=b=>{s(b.currentTarget)},f=()=>{s(null)},g=a.some(({stale:b})=>b===!0),v=a.some(({stale:b})=>b===!1),S=async()=>{try{f(),await r(e,m),n==null||n(),o({title:"State updated",text:"Feature flags marked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features staled"}})}catch(b){i(r1(b))}},x=async()=>{try{f(),await r(e,m,!1),n==null||n(),o({title:"State updated",text:"Feature flags unmarked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features unstaled"}})}catch(b){i(r1(b))}};return t.jsxs(t.Fragment,{children:[t.jsx(Z1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t.jsx(j1,{id:v2,"aria-controls":u?v2:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:p,type:"button","data-testid":c7,children:t.jsx(L0,{})})}),t.jsx(t2,{id:`${v2}-menu`,anchorEl:c,open:u,onClose:f,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:t.jsx(a2,{"aria-labelledby":`${v2}-menu`,children:t.jsx(H1,{projectId:e,permission:I2,children:({hasAccess:b})=>t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:v,show:()=>t.jsxs(R1,{onClick:S,disabled:!b,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t.jsx(P1,{children:t.jsx(F0,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Mark as stale"})})]})}),t.jsx(C,{condition:g,show:()=>t.jsxs(R1,{onClick:x,disabled:!b,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t.jsx(P1,{children:t.jsx(F0,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},At=d("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),K4="manage-tags-form",J4=(e,a)=>[...e,...e.some(n=>n.value===a.value&&n.type===a.type)?[]:[a]],Y4=(e,a)=>e.filter(n=>!(n.value===a.value&&n.type===a.type)),kt=(e,a)=>{switch(a.type){case"add":return{...e,addedTags:J4(e.addedTags,a.payload),removedTags:Y4(e.removedTags,a.payload)};case"remove":return{...e,addedTags:Y4(e.addedTags,a.payload),removedTags:J4(e.removedTags,a.payload)};case"clear":return{addedTags:[],removedTags:a.payload};default:return e}},Q4={name:"",description:"",icon:""},Tt=({open:e,initialValues:a,initialIndeterminateValues:n,onCancel:c,onSubmit:s})=>{const{tagTypes:r,loading:o}=s7(),[i,h]=l.useState(Q4),[u,m]=l.useState([]),[p,f]=l.useState([]),{tags:g,refetch:v}=u9(i.name),{createTag:S}=W6(),x=g.map(({value:R})=>({title:R})),[b,w]=l.useReducer(kt,{addedTags:[],removedTags:[]}),E=(R=r.length>0?r[0]:Q4)=>{h(R);const F=n.filter(({type:B})=>B===R.name);m(a.filter(({type:B})=>B===R.name).filter(({type:B,value:I})=>!F.some(M=>M.value===I&&M.type===B)).map(({value:B})=>({title:B}))),f(F.map(({value:B})=>({title:B}))),w({type:"clear",payload:[]})};l.useEffect(()=>{r.length>0&&E()},[o]);const O=(R,F)=>{F!=null&&typeof F!="string"&&(R.preventDefault(),E(F))},k=(R,F)=>S({value:R,type:F}).then(async()=>{await v(),m(B=>[...B,{title:R}]),w({type:"add",payload:{value:R,type:F}})}),_=(R,F,B,I)=>{B==="selectOption"?F.forEach(M=>{if(typeof M!="string"&&typeof M.inputValue=="string"&&M.inputValue&&M.title.startsWith("Create new value"))return k(M.inputValue,i.name);m(F),f(H=>H.filter(({title:D})=>D!==M.title)),I!=null&&I.option&&w({type:"add",payload:{value:I.option.title,type:i.name}})}):B==="clear"?(m([]),w({type:"clear",payload:a})):B==="removeOption"&&(m(F),I!=null&&I.option&&w({type:"remove",payload:{value:I.option.title,type:i.name}}))},T=()=>{E(),c()};return t.jsxs(D1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature flag tags",onClick:()=>s(b),disabledPrimaryButton:b.addedTags.length===0&&b.removedTags.length===0,onClose:T,formId:K4,children:[t.jsx($,{paragraph:!0,sx:{marginBottom:R=>R.spacing(2.5)},children:"Tags allow you to group features together"}),t.jsx("form",{id:K4,onSubmit:()=>s(b),children:t.jsxs(At,{children:[t.jsx(p9,{options:r,disabled:o||r.length===0,value:i,onChange:O},o?"loading":r.length),t.jsx(C,{condition:!o&&r.length===0,show:t.jsxs($,{variant:"body1",children:["No"," ",t.jsx(o3,{component:Q,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t.jsx(m9,{disabled:o,options:x,existingTags:a,indeterminateOptions:p,tagType:i,selectedOptions:u,onChange:_})})]})})]})},Dt=({projectId:e,data:a,onChange:n})=>{const{bulkUpdateTags:c}=W6(),{setToastData:s,setToastApiError:r}=u1(),{trackEvent:o}=x1(),[i,h]=l.useState(!1),[u,m]=l.useMemo(()=>{const f=a.flatMap(({tags:v})=>v||[]).reduce((v,S)=>[...v,...v.some(x=>x.type===S.type&&x.value===S.value)?[]:[S]],[]),g=f.filter(v=>!a.every(({tags:S})=>S==null?void 0:S.some(x=>x.type===v.type&&x.value===v.value)));return[f,g]},[a]),p=async({addedTags:f,removedTags:g})=>{const v=a.map(({name:x})=>x),S={features:v,tags:{addedTags:f,removedTags:g}};try{await c(S,e);const x=f.length?`Added tags: ${f.map(({type:w,value:E})=>`${w}:${E}`).join(", ")}.`:"",b=g.length?`Removed tags: ${g.map(({type:w,value:E})=>`${w}:${E}`).join(", ")}.`:"";s({title:"Tags updated",text:`${v.length} feature flags updated. ${x} ${b}`,type:"success",autoHideDuration:12e3}),o("batch_operations",{props:{eventType:"tags updated"}})}catch(x){r(r1(x))}n==null||n(),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(H1,{projectId:e,permission:I2,children:({hasAccess:f})=>t.jsx(o1,{disabled:!f||i,variant:"outlined",size:"small",onClick:()=>h(!0),children:"Tags"})}),t.jsx(Tt,{open:i,onCancel:()=>h(!1),onSubmit:p,initialValues:u,initialIndeterminateValues:m},a.length)]})},Ft=d(C3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),X4=d(i1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Rt=({showExportDialog:e,data:a,onClose:n,onConfirm:c,environments:s,projectId:r})=>{const[o,i]=l.useState(s[0]),{bulkToggleFeaturesEnvironmentOff:h}=u6(),{addChange:u}=$2(),{setToastApiError:m,setToastData:p}=u1(),{isChangeRequestConfigured:f}=w3(r),{refetch:g}=V2(r),v=a.filter(w=>{var E,O;return((O=(E=w.environments)==null?void 0:E.find(k=>o===k.name))==null?void 0:O.enabled)===!1}).length,S=()=>s.map(w=>({key:w,label:w})),x=async()=>{try{f(o)?(await u(r,o,a.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!1}}))),g(),p({text:"Your disabled feature flags changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(r,a.map(w=>w.name),o),p({text:"Your feature flags have been disabled",type:"success",title:"Features disabled"})),n(),c==null||c()}catch(w){m(r1(w))}},b=f(o)?"Add to change request":"Disable flags";return t.jsx(D1,{open:e,title:"Disable feature flags",onClose:n,onClick:x,primaryButtonText:b,secondaryButtonText:"Cancel",children:t.jsxs(Z,{children:["You have selected ",t.jsx("b",{children:a.length})," feature flags to disable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx($,{children:"Select which environment to disable the features for:"}),t.jsx(Ft,{options:S(),value:o,onChange:w=>i(w)}),t.jsx(C,{condition:f(o),show:t.jsx(X4,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(C,{condition:v>0,show:t.jsxs(X4,{severity:"info",children:[v," feature"," ",v>1?"flags are ":"flag is ","already disabled."]})})]})})},Pt=d(C3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),e5=d(i1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),It=({showExportDialog:e,data:a,onClose:n,onConfirm:c,environments:s,projectId:r})=>{const[o,i]=l.useState(s[0]),{bulkToggleFeaturesEnvironmentOn:h}=u6(),{addChange:u}=$2(),{setToastApiError:m,setToastData:p}=u1(),{isChangeRequestConfigured:f}=w3(r),{refetch:g}=V2(r),v=a.filter(w=>{var E,O;return((O=(E=w.environments)==null?void 0:E.find(k=>o===k.name))==null?void 0:O.enabled)===!0}).length,S=()=>s.map(w=>({key:w,label:w})),x=async()=>{try{f(o)?(await u(r,o,a.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!0}}))),g(),p({text:"Your enable feature flags changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(r,a.map(w=>w.name),o),p({text:"Your feature flags have been enabled",type:"success",title:"Features enabled"})),n(),c==null||c()}catch(w){m(r1(w))}},b=f(o)?"Add to change request":"Enable flags";return t.jsx(D1,{open:e,title:"Enable feature flags",onClose:n,onClick:x,primaryButtonText:b,secondaryButtonText:"Cancel",children:t.jsxs(Z,{children:["You have selected ",t.jsx("b",{children:a.length})," feature flags to enable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx($,{children:"Select which environment to enable the features for:"}),t.jsx(Pt,{options:S(),value:o,onChange:w=>i(w)}),t.jsx(C,{condition:f(o),show:t.jsx(e5,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(C,{condition:v>0,show:t.jsxs(e5,{severity:"info",children:[v," feature"," ",v>1?"flags are ":"flag is ","already enabled."]})})]})})},$t=({selectedIds:e,data:a,projectId:n,onResetSelection:c,onChange:s})=>{var E,O;const{uiConfig:r}=X(),[o,i]=l.useState(!1),[h,u]=l.useState(!1),[m,p]=l.useState(!1),{trackEvent:f}=x1(),g=l.useMemo(()=>a.filter(k=>e.includes(k.name)),[a,e]),v=l.useMemo(()=>{const k=g.flatMap(_=>_.environments).map(_=>_==null?void 0:_.name).filter(_=>_!==void 0);return Array.from(new Set(k))},[g]),S=()=>{s==null||s(),f("batch_operations",{props:{eventType:"features exported"}})},x=()=>{s==null||s(),f("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{s==null||s(),f("batch_operations",{props:{eventType:"features disabled"}})},w=()=>{s==null||s(),c()};return t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!!((E=r==null?void 0:r.flags)!=null&&E.disableBulkToggle),show:null,elseShow:t.jsx(o1,{variant:"outlined",size:"small",onClick:()=>u(!0),children:"Enable"})}),t.jsx(C,{condition:!!((O=r==null?void 0:r.flags)!=null&&O.disableBulkToggle),show:null,elseShow:t.jsx(o1,{variant:"outlined",size:"small",onClick:()=>p(!0),children:"Disable"})}),t.jsx(_t,{projectId:n,featureIds:e,features:a,onConfirm:w}),t.jsx(o1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),t.jsx(Dt,{projectId:n,data:g,onChange:s}),t.jsx(Et,{projectId:n,data:g,onChange:s}),t.jsx(p6,{showExportDialog:o,data:g,onClose:()=>i(!1),environments:v,onConfirm:S}),t.jsx(It,{showExportDialog:h,data:g,onClose:()=>u(!1),environments:v,projectId:n,onConfirm:x}),t.jsx(Rt,{showExportDialog:m,data:g,onClose:()=>p(!1),environments:v,projectId:n,onConfirm:b})]})},Vt=d(H0)(()=>({whiteSpace:"nowrap"})),Ot=({isLoading:e,totalItems:a,searchQuery:n,onChangeSearchQuery:c,environmentsToExport:s,actions:r})=>{const o=q("projectId"),i=n2(e||!1),[h,u]=l.useState(!0),m=l1(),p=v1(m.breakpoints.down("md")),f=V1("featuresExportImport"),[g,v]=l.useState(!1),S=B1(),{trackEvent:x}=x1(),b=V1("projectOverviewRefactorFeedback"),{openFeedback:w}=r7("newProjectOverview","automatic"),E=k=>{c==null||c(k),x("search-bar",{props:{screen:"project",length:k.length}})},O=()=>{w({title:"How easy was it to work with the project overview in Unleash?",positiveLabel:"What do you like most about the updated project overview?",areasForImprovementsLabel:"What improvements are needed in the project overview?"})};return t.jsx(Z,{ref:i,"aria-busy":e,"aria-live":"polite",sx:k=>({padding:`${k.spacing(2.5)} ${k.spacing(3.125)}`}),children:t.jsx(t1,{titleElement:h?`Feature flags ${a!==void 0?`(${a})`:""}`:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!p,show:t.jsx(_1,{"data-loading":!0,placeholder:"Search and Filter",expandable:!0,initialValue:n||"",onChange:E,onFocus:()=>u(!1),onBlur:()=>u(!0),hasFilters:!0,id:"projectFeatureFlags"})}),r,t.jsx(t1.Divider,{sx:{marginLeft:0}}),t.jsx(C,{condition:f,show:t.jsxs(t.Fragment,{children:[t.jsx(Z1,{title:"Export all project flags",arrow:!0,children:t.jsx(j1,{"data-loading":!0,onClick:()=>v(!0),sx:k=>({marginRight:k.spacing(2)}),children:t.jsx(o7,{})})}),t.jsx(C,{condition:!e,show:t.jsx(p6,{showExportDialog:g,project:o,data:[],onClose:()=>v(!1),environments:s||[]})})]})}),t.jsx(C,{condition:b&&!p,show:t.jsx(o1,{startIcon:t.jsx(i7,{}),onClick:O,variant:"outlined","data-loading":!0,children:"Provide feedback"})}),t.jsx(Vt,{onClick:()=>S(l7(o)),maxWidth:"960px",Icon:c2,projectId:o,permission:N0,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature flag"})]}),children:t.jsx(C,{condition:p,show:t.jsx(_1,{initialValue:n||"",onChange:E,hasFilters:!0,id:"projectFeatureFlags"})})})})},Y6=d("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:a})=>({flexGrow:0,...Z3,justifyContent:"center",...a&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Bt=({value:e,featureId:a,projectId:n,environment:c,isChangeRequestEnabled:s,someEnabledEnvironmentHasVariants:r,refetch:o,onFeatureToggleSwitch:i})=>{const h=l.useMemo(()=>r&&(c==null?void 0:c.variantCount)===0&&(c==null?void 0:c.enabled),[r,c]),u=(m,p)=>{i(m,{projectId:n,featureId:a,environmentName:(c==null?void 0:c.name)||"",environmentType:c==null?void 0:c.type,hasStrategies:c==null?void 0:c.hasStrategies,hasEnabledStrategies:c==null?void 0:c.hasEnabledStrategies,isChangeRequestEnabled:s,onRollback:p,onSuccess:o})};return t.jsxs(Y6,{hasWarning:h,children:[t.jsx(v9,{projectId:n,value:e,featureId:a,environmentName:(c==null?void 0:c.name)||"",onToggle:u}),t.jsx(C,{condition:h||!1,show:t.jsx(g9,{})})]})},zt=Y1.memo(Bt),Mt=()=>t.jsx(Y6,{children:t.jsx("div",{"data-loading":!0,children:"toggle"})}),Lt=({state:e,onChange:a})=>{const{tags:n}=d7(),[c,s]=l.useState([]);return l.useEffect(()=>{const o=[{label:"Tags",icon:"label",options:(n||[]).map(i=>({label:`${i.type}:${i.value}`,value:`${i.type}:${i.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"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}];s(o)},[JSON.stringify(n)]),t.jsx(h7,{availableFilters:c,state:e,onChange:a})},g2=["select","actions","name","favorite"],f2=(e,a)=>e.reduce((n,c)=>({...n,[c]:a.includes(c)}),{}),Nt=e=>{const a=l1(),n=v1(a.breakpoints.down("sm")),c=v1(a.breakpoints.down("md")),s=v1(a.breakpoints.down("lg")),r=V1("featureLifecycle"),o=l.useCallback((i=0)=>e.filter(h=>h.startsWith("environment:")),[e]);return n?f2(e,[...g2,"createdAt"]):c?f2(e,[...g2,"createdAt",...o(1)]):s?f2(e,[...g2,"createdAt","type",...o(1)]):f2(e,[...g2,"lastSeenAt",...r?["lifecycle"]:[],"createdAt","type","tags",...o(3)])},qt=({query:e})=>{var a;return((a=e||"")==null?void 0:a.length)>0?t.jsx(Z,{sx:n=>({padding:n.spacing(3)}),children:t.jsxs(f1,{children:["No feature flags found matching “",e,"”"]})}):t.jsx(Z,{sx:n=>({padding:n.spacing(3)}),children:t.jsx(f1,{children:"No feature flags available."})})},Ht=(e,a)=>{const[n,c]=l.useState(),[s,r]=l.useState({}),[o,i]=l.useState({featureId:"default",open:!1});return{rowActionsDialogs:t.jsxs(t.Fragment,{children:[t.jsx(f9,{isStale:!!s.stale,isOpen:!!s.featureId,onClose:()=>{r({}),e()},featureId:s.featureId||"",projectId:a}),t.jsx(H6,{isOpen:!!n,onConfirm:e,onClose:()=>{c(void 0)},featureIds:[n||""],projectId:a}),t.jsx(x9,{isOpen:o.open,setIsOpen:u=>{i({...o,open:u})},projectId:a,featureId:o.featureId,onComplete:e})]}),setFeatureArchiveState:c,setFeatureStaleDialogState:r,setShowMarkCompletedDialogue:i}},Wt=(e,a)=>{const[n,c]=l.useState([]);return l.useEffect(()=>{c(s=>{const r=[...e];return s.forEach(o=>{r.find(i=>i.name===o.name)||r.push(o)}),r.filter(o=>a[o.name])})},[e,a]),n},Ut=d(Q)({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}}),y2=d("button")(({theme:e})=>({marginRight:e.spacing(.5),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,textOverflow:"ellipsis",overflow:"hidden",textWrap:"nowrap",maxWidth:"250px",padding:e.spacing(.25,.5),cursor:"pointer",background:"inherit",color:"inherit"})),Gt=({text:e,searchQuery:a})=>t.jsx(C,{condition:!!(e&&e.length>40),show:t.jsx(L1,{title:t.jsx($1,{search:a,children:e}),placement:"bottom-start",arrow:!0,children:t.jsx(O4,{children:t.jsx($1,{search:a,children:e})})}),elseShow:t.jsx(O4,{children:t.jsx($1,{search:a,children:e})})}),r0=({tag:e,children:a})=>t.jsx(C,{condition:e.length>30,show:t.jsx(L1,{title:e,children:a}),elseShow:a}),Kt=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5),margin:e.spacing(1.25,0,1,0),paddingLeft:e.spacing(2)})),Jt=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.dark})),Yt=d(Z)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.25)})),Qt=d(g3)(({theme:e})=>({padding:e.spacing(.5),border:0,textTransform:"capitalize"})),Xt=({project:e,feature:a,searchQuery:n})=>t.jsx(Z,{sx:c=>({fontWeight:c.typography.fontWeightBold}),children:t.jsx(Ut,{to:`/projects/${e}/features/${a}`,children:t.jsx(u7,{style:{WebkitLineClamp:1,lineClamp:1},children:t.jsx($1,{search:n,children:a})})})}),ea=({tags:e,onClick:a})=>t.jsx(L1,{title:e.map(n=>t.jsx(Z,{sx:{cursor:"pointer"},onClick:()=>a(n),children:n},n)),children:t.jsxs(y2,{sx:{cursor:"initial"},children:[e.length," more..."]})}),ta=({tags:e,onClick:a})=>{const[n,c,s,...r]=(e||[]).map(({type:o,value:i})=>`${o}:${i}`);return t.jsxs(Yt,{children:[n&&t.jsx(r0,{tag:n,children:t.jsx(y2,{onClick:()=>a(n),children:n})}),c&&t.jsx(r0,{tag:c,children:t.jsx(y2,{onClick:()=>a(c),children:c})}),s&&t.jsx(r0,{tag:s,children:t.jsx(y2,{onClick:()=>a(s),children:s})}),t.jsx(C,{condition:r.length>0,show:t.jsx(ea,{tags:r,onClick:a})})]})},aa=d(Q)({display:"block"}),na=({feature:e,project:a})=>{const{feature:n}=p7(a,e),c=n.children,s=n.dependencies;if(c.length>0)return t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:"Children"}),c.map(r=>t.jsx(aa,{to:`/projects/${a}/features/${r}`,children:r},r))]});if(s[0]){const r=s[0].feature;return t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:"Parent"}),t.jsx(Q,{to:`/projects/${a}/features/${r}`,children:r})]})}return t.jsx(t.Fragment,{children:"Loading..."})},ca=({project:e,feature:a,type:n,searchQuery:c,dependencyType:s,onTypeClick:r,delay:o=500})=>{var f;const{featureTypes:i}=m6(),h=v6(n),m=`${((f=i.find(g=>g.id===n))==null?void 0:f.name)||n} flag`,p=()=>t.jsx(L1,{arrow:!0,title:m,describeChild:!0,children:t.jsx(j1,{sx:{p:0},"aria-label":`add ${n} flag to filter`,onClick:()=>r(n),children:t.jsx(h,{sx:g=>({fontSize:g.spacing(2)}),"data-testid":"feature-type-icon"})})});return t.jsxs(Jt,{"data-loading":!0,children:[t.jsx(p,{}),t.jsx(Xt,{project:e,feature:a,searchQuery:c}),t.jsx(C,{condition:!!s,show:t.jsx(L1,{title:t.jsx(na,{feature:a,project:e}),enterDelay:o,enterNextDelay:o,children:t.jsx(Qt,{color:s==="parent"?"warning":"secondary",children:s})})})]})},sa=({description:e,searchQuery:a})=>t.jsx(C,{condition:!!e,show:t.jsx(Z,{sx:n=>({display:"flex",gap:n.spacing(1)}),children:t.jsx(Gt,{text:e,searchQuery:a})})}),ra=(e,a)=>({row:n})=>{const{searchQuery:c}=_3();return t.jsxs(Kt,{children:[t.jsx(ca,{project:n.original.project||"",feature:n.original.name,searchQuery:c,type:n.original.type||"",dependencyType:n.original.dependencyType||"",onTypeClick:a}),t.jsx(sa,{description:n.original.description||"",searchQuery:c}),t.jsx(ta,{tags:n.original.tags,onClick:e})]})},Q6=(e,a="project-overview-v2",n=15*1e3)=>{const c={offset:q1(Z2,0),limit:q1(Z2,m7),query:f3,favoritesFirst:q1(v7,!0),sortBy:q1(f3,"createdAt"),sortOrder:q1(f3,"desc"),columns:g7,tag:n0,createdAt:n0,type:n0},[s,r]=g6(`${a}-${e}`,c),{columns:o,...i}=s,{features:h,total:u,refetch:m,loading:p,initialLoad:f}=f7(f6({...x6(c,i),project:`IS:${e}`},g=>g?`${g}`:void 0),{refreshInterval:n});return{features:h,total:u,refetch:m,loading:p,initialLoad:f,tableState:s,setTableState:r}},oa=(e,a)=>{const n=(r,o)=>{const i=e[r.key];i&&i.values.length>0&&!i.values.includes(o)?a({[r.key]:{operator:i.operator,values:[...i.values,o]}}):i||a({[r.key]:{operator:r.operator,values:[o]}})};return{onFlagTypeClick:r=>n({key:"type",operator:"IS"},r),onTagClick:r=>n({key:"tag",operator:"INCLUDE"},r)}},o0=e=>`environment:${e}`,J1=Z6(),ia=e=>e.name,la=({environments:e})=>{const a=q("projectId"),{features:n,total:c,refetch:s,loading:r,initialLoad:o,tableState:i,setTableState:h}=Q6(a),{onFlagTypeClick:u,onTagClick:m}=oa(i,h),p={tag:i.tag,createdAt:i.createdAt,type:i.type},{favorite:f,unfavorite:g}=x7(),v=l.useCallback(async y=>{y!=null&&y.favorite?await g(a,y.name):await f(a,y.name),s()},[a,s]),{isChangeRequestConfigured:S}=w3(a),{onToggle:x,modals:b}=j9(a),{rowActionsDialogs:w,setFeatureArchiveState:E,setFeatureStaleDialogState:O,setShowMarkCompletedDialogue:k}=Ht(s,a),_=!!(o||r&&c),T=V1("featureLifecycle"),R=l.useMemo(()=>[J1.display({id:"select",header:({table:y})=>t.jsx(B4,{title:"Select all rows",checked:y==null?void 0:y.getIsAllRowsSelected(),onChange:y==null?void 0:y.getToggleAllRowsSelectedHandler()}),cell:({row:y})=>t.jsx(B4,{title:"Select row",checked:y==null?void 0:y.getIsSelected(),onChange:y==null?void 0:y.getToggleSelectedHandler()}),meta:{width:"1%"},enableHiding:!1}),J1.accessor("favorite",{id:"favorite",header:()=>t.jsx(j7,{isActive:i.favoritesFirst,onClick:()=>h({favoritesFirst:!i.favoritesFirst})}),cell:({row:{original:y}})=>t.jsx(y7,{value:y==null?void 0:y.favorite,onClick:()=>v(y)}),enableSorting:!1,enableHiding:!1,meta:{align:"center",width:"1%"}}),J1.accessor("name",{id:"name",header:"Name",cell:ra(m,u),enableHiding:!1,meta:{width:"50%"}}),J1.accessor("createdAt",{id:"createdAt",header:"Created",cell:O2,meta:{width:"1%"}}),J1.accessor("lastSeenAt",{id:"lastSeenAt",header:"Last seen",cell:({row:{original:y}})=>t.jsx(b7,{feature:y,"data-loading":!0}),size:50,meta:{align:"center",width:"1%"}}),...T?[J1.accessor("lifecycle",{id:"lifecycle",header:"Lifecycle",cell:({row:{original:y}})=>t.jsx(Z7,{feature:y,onComplete:()=>{k({featureId:y.name,open:!0})},onUncomplete:s,onArchive:()=>E(y.name),"data-loading":!0}),enableSorting:!1,size:50,meta:{align:"center",width:"1%"}})]:[],...e.map(y=>{const z=S(y);return J1.accessor(L=>{var U,a1;return{featureId:L.name,environment:(U=L.environments)==null?void 0:U.find(s1=>s1.name===y),someEnabledEnvironmentHasVariants:((a1=L.environments)==null?void 0:a1.some(s1=>s1.variantCount&&s1.variantCount>0&&s1.enabled))||!1}},{id:o0(y),header:y,meta:{align:"center",width:90},cell:({getValue:L})=>{const{featureId:U,environment:a1,someEnabledEnvironmentHasVariants:s1}=L();return _?t.jsx(Mt,{}):t.jsx(zt,{value:(a1==null?void 0:a1.enabled)||!1,featureId:U,someEnabledEnvironmentHasVariants:s1,environment:a1,projectId:a,environmentName:y,isChangeRequestEnabled:z,refetch:s,onFeatureToggleSwitch:x})}})}),J1.display({id:"actions",header:"",cell:({row:y})=>t.jsx(ut,{row:y,projectId:a,onOpenArchiveDialog:E,onOpenStaleDialog:O}),enableSorting:!1,enableHiding:!1,meta:{align:"right",width:"1%"}})],[a,e,i.favoritesFirst,s,_,T]),F=l.useMemo(()=>Array(i.limit).fill(null).map((y,z)=>({id:z,type:"-",name:`Feature name ${z}`,createdAt:new Date().toISOString(),dependencyType:null,favorite:!1,impressionData:!1,project:"project",segments:[],stale:!1,environments:[{name:"development",enabled:!1,type:"development"},{name:"production",enabled:!1,type:"production"}]})),[i.limit]),B=n2(_),I=l.useMemo(()=>_?F:n,[_,JSON.stringify(n)]),M=l.useMemo(()=>R.map(y=>y.id).filter(Boolean),[R]),H=Nt(M),D=j6(y6(i,h,{columns:R,data:I,enableRowSelection:!0,state:{columnVisibility:H},getRowId:ia})),{columnVisibility:P,rowSelection:W}=D.getState(),j=l.useCallback(y=>{const z=P[y],L={...P,[y]:!z};h({columns:Object.keys(L).filter(U=>L[U]&&!U.includes(","))})},[P,h]),A=Wt(n,W);return t.jsxs(t.Fragment,{children:[t.jsx(d1,{disableLoading:!0,disablePadding:!0,header:t.jsx(Ot,{isLoading:o,totalItems:c,searchQuery:i.query||"",onChangeSearchQuery:y=>{h({query:y})},dataToExport:I,environmentsToExport:e,actions:t.jsx(St,{columns:[{header:"Name",id:"name",isVisible:P.name,isStatic:!0},{header:"Created",id:"createdAt",isVisible:P.createdAt},{header:"Last seen",id:"lastSeenAt",isVisible:P.lastSeenAt},...T?[{header:"Lifecycle",id:"lifecycle",isVisible:P.lifecycle}]:[],{id:"divider"},...e.map(y=>({header:y,id:o0(y),isVisible:P[o0(y)]}))],onToggle:j})}),bodyClass:"noop",style:{cursor:"inherit"},children:t.jsxs("div",{ref:B,"aria-busy":_,"aria-live":"polite",children:[t.jsx(Lt,{onChange:h,state:p}),t.jsx(r3,{value:i.query||"",children:t.jsx(b6,{tableInstance:D,totalItems:c})}),t.jsx(C,{condition:!I.length&&!_,show:t.jsx(qt,{query:i.query||""})}),w,b]})}),t.jsx(S7,{count:A.length,children:t.jsx($t,{selectedIds:Object.keys(W),data:A,projectId:a,onResetSelection:D.resetRowSelection,onChange:s})})]})},t5={applied:0,approved:0,rejected:0,scheduled:0,reviewRequired:0,total:0},X6=e=>{const{isEnterprise:a}=X(),{data:n,error:c,mutate:s}=B2(!!e&&a(),t5,g1(`api/admin/projects/${e}/change-requests/count`),da);return{data:n||t5,loading:!c&&!n,refetchChangeRequestConfig:s,error:c}},da=e=>fetch(e).then(S1("Request changes")).then(a=>a.json()),ha=d(Z)(({theme:e})=>({margin:"0",textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",padding:e.spacing(1,3.25),display:"flex",alignItems:"center",flexWrap:"wrap",gap:e.spacing(2),fontSize:e.fontSizes.smallBody})),e8=d(Z)(({theme:e})=>({borderRadius:"8px",padding:e.spacing(1,2),display:"flex",gap:e.spacing(2),justifyContent:"space-between",alignItems:"center",whiteSpace:"nowrap"})),ua=d(e8)(({theme:e})=>({background:e.palette.success.light})),pa=d(e8)(({theme:e})=>({background:e.palette.secondary.light})),a5=d($)(({theme:e})=>({fontSize:e.spacing(2),fontWeight:e.fontWeight.bold})),ma=({project:e})=>{const{isChangeRequestConfiguredInAnyEnv:a}=w3(e),{data:n}=X6(e);if(!a())return null;const c=n.scheduled+n.approved,s=n.reviewRequired;return t.jsxs(ha,{children:[t.jsx(Z,{children:"Open change requests"}),t.jsxs(ua,{children:[t.jsx("span",{children:"To be applied"}),t.jsx(a5,{children:c})]}),t.jsxs(pa,{children:[t.jsx("span",{children:"To be reviewed"}),t.jsx(a5,{children:s})]}),t.jsx(Q,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},va=e=>{const a=`api/admin/projects/${e}/sdks/outdated`,{data:n,refetch:c,loading:s,error:r}=S6(g1(a),()=>C6(g1(a),"Outdated SDKs"),{refreshInterval:60*1e3});return{data:n||{sdks:[]},refetch:c,error:r}},ga=d("ul")({margin:0}),fa=({project:e})=>{const{data:{sdks:a}}=va(e),{trackEvent:n}=x1(),c=o=>{n("sdk-banner",{props:{eventType:"banner application clicked",sdkVersion:o}})},s=()=>{n("sdk-banner",{props:{eventType:"banner clicked"}})},r={message:`We noticed that an outdated SDK version is connected to ${e} project.`,variant:"warning",link:"dialog",linkText:"Please update those versions",linkClicked:s,dialogTitle:"Outdated SDKs",dialog:t.jsx(t.Fragment,{children:a.map(o=>t.jsxs("div",{children:[t.jsx("span",{children:o.sdkVersion}),t.jsx(ga,{children:o.applications.map(i=>t.jsx("li",{onClick:()=>{c(o.sdkVersion)},onKeyDown:()=>{c(o.sdkVersion)},children:t.jsx(Q,{to:`/applications/${i}`,children:i})},i))})]},o.sdkVersion))})};return t.jsx(t.Fragment,{children:t.jsx(C,{condition:a.length>0,show:t.jsx(C7,{banner:r,inline:!0})})})},xa=15*1e3,ja=d("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),[e.breakpoints.down("md")]:{flexDirection:"column"}})),ya=d("div")(()=>({width:"100%",minWidth:0})),ba=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),width:"100%",minWidth:0})),Za=()=>{const e=q("projectId"),a=F1(e),n=V1("outdatedSdksBanner"),{project:c}=X1(e,{refreshInterval:xa});C1(`Project overview – ${a}`);const{setLastViewed:s}=w7();return l.useEffect(()=>{s(e)},[e,s]),t.jsx(ja,{children:t.jsxs(ba,{children:[t.jsx(ma,{project:e}),t.jsx(C,{condition:n,show:t.jsx(fa,{project:e})}),t.jsx(ya,{children:t.jsx(la,{environments:c.environments.map(r=>r.environment)})})]})},e)},Sa=(e,a)=>{const n=g1(`api/admin/projects/${e}/health-report`),{data:c,error:s}=s3(n,Ca,a),r=l.useCallback(()=>{w6(n).catch(console.warn)},[n]);return{healthReport:c,refetchHealthReport:r,loading:!s&&!c,error:s}},Ca=e=>fetch(e).then(S1("Health report")).then(a=>a.json());var s4={},wa=T1;Object.defineProperty(s4,"__esModule",{value:!0});var _2=s4.default=void 0,_a=wa(k1()),Ea=t,Aa=(0,_a.default)((0,Ea.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");_2=s4.default=Aa;const ka=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),n5=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Ta=d(U1)(({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)}})),i0=d("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1),justifyItems:"center",display:"flex"})),Da=d("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),Fa=d("p")(({theme:e})=>({color:e.palette.text.secondary})),c5=d("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),s5=d("p")(({theme:e})=>({marginLeft:e.spacing(4)})),Ra=({healthReport:e})=>{const a=e.health<50?"error.main":e.health<75?"warning.main":"success.main",n=()=>t.jsxs(ka,{children:[t.jsx(b3,{}),t.jsxs("span",{children:[e.activeCount," active flags"]})]}),c=()=>t.jsxs(n5,{children:[t.jsx(_2,{}),t.jsxs("span",{children:[e.staleCount," stale flags"]})]}),s=()=>t.jsxs(n5,{children:[t.jsx(_2,{}),t.jsxs("span",{children:[e.potentiallyStaleCount," potentially stale flags"]})]}),r=()=>t.jsx(L1,{title:t.jsxs(t.Fragment,{children:["If your flag exceeds the expected lifetime of its flag type it will be marked as potentially stale.",t.jsx(Z,{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(_7,{sx:{color:o=>o.palette.text.secondary,ml:1}})});return t.jsxs(Ta,{children:[t.jsxs(Z,{children:[t.jsx(i0,{children:"Health rating"}),t.jsx(C,{condition:e.health>-1,show:t.jsxs(t.Fragment,{children:[t.jsxs(Da,{sx:{color:a},children:[e.health,"%"]}),t.jsxs(Fa,{children:["Last updated:"," ",t.jsx(W0,{date:e.updatedAt,live:!1})]})]})})]}),t.jsxs(Z,{children:[t.jsx(i0,{children:"Flag report"}),t.jsxs(c5,{children:[t.jsx("li",{children:t.jsx(C,{condition:!!e.activeCount,show:n})}),t.jsx(C,{condition:!!e.activeCount,show:t.jsx(s5,{children:"Also includes potentially stale flags."})}),t.jsx("li",{children:t.jsx(C,{condition:!!e.staleCount,show:c})})]})]}),t.jsxs(Z,{sx:{flexBasis:"40%"},children:[t.jsxs(i0,{children:["Potential actions"," ",t.jsx("span",{children:t.jsx(r,{})})]}),t.jsx(c5,{children:t.jsx("li",{children:t.jsx(C,{condition:!!e.potentiallyStaleCount,show:s})})}),t.jsx(C,{condition:!!e.potentiallyStaleCount,show:t.jsxs(t.Fragment,{children:[t.jsx(s5,{children:"Review your feature flags and delete unused flags."}),t.jsx(Z,{sx:{mt:2},children:t.jsx(o3,{component:Q,to:"/feature-toggle-type",children:"Configure feature types lifetime"})})]}),elseShow:t.jsx("span",{children:"No action is required"})})]})]})},Pa=({row:e})=>t.jsx(E3,{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}),Ia=({row:e})=>{const a=l1();return e.original.expiredAt?t.jsx(O2,{value:e.original.expiredAt}):t.jsx(Y,{children:t.jsx($,{variant:"body2",color:a.palette.text.secondary,children:"N/A"})})},$a=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Va=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),Oa=({row:e})=>e.original.status==="potentially-stale"?t.jsx(Y,{children:t.jsxs($a,{children:[t.jsx(_2,{}),t.jsx("span",{children:"Potentially stale"})]})}):t.jsx(Y,{children:t.jsxs(Va,{children:[t.jsx(b3,{}),t.jsx("span",{children:"Healthy"})]})}),t8=(e,a)=>Math.abs(E7(e,a)),a8=(e,a)=>{var n;return a.lifetimeDays?e>=((n=a==null?void 0:a.lifetimeDays)==null?void 0:n.valueOf()):!1},Ba=(e,a)=>{const{type:n,createdAt:c}=e,s=a.find(h=>h.id===n),r=_6(c),i=t8(r,new Date);return s&&a8(i,s)&&n!==E6&&n!==A6?"potentially-stale":"healthy"},za=(e,a)=>{var h;const{type:n,createdAt:c}=e,s=a.find(u=>u.id===n);if(s&&(s.name===E6||s.name===A6))return;const r=_6(c),o=new Date,i=t8(r,o);if(s&&a8(i,s)){const u=i-(((h=s==null?void 0:s.lifetimeDays)==null?void 0:h.valueOf())||0);return A7(o,u).toISOString()}},Ma=({projectId:e,features:a})=>{const n=l1(),c=v1(n.breakpoints.down("sm")),s=v1(n.breakpoints.down("md")),r=v1(n.breakpoints.down("lg"));X();const{featureTypes:o}=m6(),i=l.useMemo(()=>a.map(b=>({project:e,name:b.name,type:b.type,stale:b.stale,environments:b.environments,status:Ba(b,o),lastSeenAt:b.lastSeenAt,createdAt:b.createdAt,expiredAt:za(b,o)})),[e,a,o]),h=l.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt",desc:!0}]}),[]),u=l.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({value:b,row:{original:w}})=>t.jsx(k7,{feature:w}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",align:"center",Cell:T7,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:Pa,minWidth:120},{Header:"Created",accessor:"createdAt",Cell:O2,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Ia,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:Oa,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:D7,disableGlobalFilter:!0,maxWidth:120}],[]),{headerGroups:m,rows:p,prepareRow:f,state:{globalFilter:g},setGlobalFilter:v,setHiddenColumns:S}=c1.useTable({columns:u,data:i,initialState:h,sortTypes:A3,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},c1.useGlobalFilter,c1.useFlexLayout,c1.useSortBy);k3([{condition:c,columns:["stale"]},{condition:s,columns:["expiredAt","lastSeenAt"]},{condition:r,columns:["createdAt"]}],S,u);const x=p.length<i.length?`Feature flags (${p.length} of ${i.length})`:`Feature flags (${i.length})`;return t.jsxs(d1,{header:t.jsx(t1,{title:x,actions:t.jsx(_1,{initialValue:g,onChange:v})}),children:[t.jsx(r3,{value:g,children:t.jsx(z2,{headerGroups:m,prepareRow:f,rows:p})}),t.jsx(C,{condition:p.length===0,show:t.jsx(C,{condition:(g==null?void 0:g.length)>0,show:t.jsxs(f1,{children:["No feature flags found matching “",g,"”"]}),elseShow:t.jsx(f1,{children:"No feature flags available. Get started by adding a new feature flag."})})})]})},La=()=>{const e=q("projectId"),a=F1(e);C1(`Project health – ${a}`);const{healthReport:n,refetchHealthReport:c,error:s}=Sa(e,{refreshInterval:15*1e3});return n?t.jsxs("div",{children:[t.jsx(C,{condition:!!s,show:t.jsx(i6,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:c,text:`Could not fetch health rating for ${e}`})}),t.jsx(Ra,{healthReport:n}),t.jsx(Ma,{projectId:e,features:n.features})]}):null},n8=({open:e,onClose:a,project:n,onSuccess:c})=>{const{deleteProject:s}=e3(),{refetch:r}=F7(),{setToastData:o,setToastApiError:i}=u1(),h=async u=>{u.preventDefault();try{await s(n),r(),o({title:"Deleted project",type:"success",text:"Successfully deleted project"}),c==null||c()}catch(m){i(r1(m))}a(u)};return t.jsx(D1,{open:e,onClick:h,onClose:a,title:"Really delete project"})},Na=d("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),qa=()=>{const e=q("projectId");return t.jsx(Na,{children:t.jsx(R7,{title:"Event Log",project:e,displayInline:!0})})},r4=(e,a)=>{const{data:n,error:c,mutate:s}=s3(g1(`api/admin/projects/${e}/change-requests/${a}`),Ha,{refreshInterval:15e3});return{data:n,loading:!c&&!n,refetchChangeRequest:()=>s(),error:c}},Ha=e=>fetch(e).then(S1("Request changes")).then(a=>a.json()),Wa=d(U1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));d(Z)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const Ua=d(Z)(({theme:e})=>({display:"flex",alignItems:"center"})),Ga=d($)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),Ka=d(P7)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),o4=d(s2)(({theme:e})=>({height:"24px",width:"24px"})),Ja=({changeRequest:e})=>{var c,s,r;const[a,n]=l.useState(e.title);return t.jsxs(Wa,{elevation:0,children:[t.jsx(I7,{environmentChangeRequest:e,title:a,setTitle:n,children:t.jsx(Ga,{variant:"h1",sx:{mr:1.5},children:a})}),t.jsxs(Ua,{children:[t.jsx(k6,{changeRequest:e}),t.jsxs($,{variant:"body2",sx:o=>({margin:o.spacing("auto",0,"auto",2)}),children:["Created"," ",t.jsx(W0,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),t.jsx(Z,{sx:o=>({marginLeft:o.spacing(1)}),children:t.jsx(Z1,{title:(c=e==null?void 0:e.createdBy)==null?void 0:c.username,children:t.jsx(o4,{src:(s=e==null?void 0:e.createdBy)==null?void 0:s.imageUrl})})}),t.jsx($,{variant:"body2",sx:o=>({marginLeft:o.spacing(.5)}),children:(r=e==null?void 0:e.createdBy)==null?void 0:r.username}),t.jsx(Z,{sx:o=>({marginLeft:o.spacing(1.5)}),children:t.jsx(Ka,{variant:"outlined",children:t.jsxs($,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",t.jsx($,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",t.jsx($7,{}),"Updates:",t.jsx(V7,{featuresCount:e.features.length,segmentsCount:e.segments.length})]})})})]})]})};function p1(){return p1=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},p1.apply(this,arguments)}function V3(e,a){if(e==null)return{};var n={},c=Object.keys(e),s,r;for(r=0;r<c.length;r++)s=c[r],!(a.indexOf(s)>=0)&&(n[s]=e[s]);return n}const Ya=l.createContext({}),E2=Ya,r5=e=>e,Qa=()=>{let e=r5;return{configure(a){e=a},generate(a){return e(a)},reset(){e=r5}}},Xa=Qa(),en={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function h3(e,a,n="Mui"){const c=en[a];return c?`${n}-${c}`:`${Xa.generate(e)}-${a}`}function u3(e,a,n="Mui"){const c={};return a.forEach(s=>{c[s]=h3(e,s,n)}),c}function tn(e){return h3("MuiTimeline",e)}u3("MuiTimeline",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]);function O3(e){return e==="alternate-reverse"?"positionAlternateReverse":`position${M2(e)}`}const an=["position","className"],nn=e=>{const{position:a,classes:n}=e,c={root:["root",a&&O3(a)]};return F3(c,tn,n)},cn=d("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,n.position&&a[O3(n.position)]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),sn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimeline"}),{position:s="right",className:r}=c,o=V3(c,an),i=p1({},c,{position:s}),h=nn(i),u=l.useMemo(()=>({position:s}),[s]);return t.jsx(E2.Provider,{value:u,children:t.jsx(cn,p1({className:D3(h.root,r),ownerState:i,ref:n},o))})}),c8=sn;function rn(e){return h3("MuiTimelineContent",e)}const on=u3("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),ln=["className"],dn=e=>{const{position:a,classes:n}=e,c={root:["root",O3(a)]};return F3(c,rn,n)},hn=d($,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,a[O3(n.position)]]}})(({ownerState:e})=>p1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),un=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineContent"}),{className:s}=c,r=V3(c,ln),{position:o}=l.useContext(E2),i=p1({},c,{position:o||"right"}),h=dn(i);return t.jsx(hn,p1({component:"div",className:D3(h.root,s),ownerState:i,ref:n},r))}),i4=un,pn=u3("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),mn=pn;function vn(e){return h3("MuiTimelineItem",e)}const gn=u3("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse","missingOppositeContent"]),s8=gn,fn=["position","className"],xn=e=>{const{position:a,classes:n,hasOppositeContent:c}=e,s={root:["root",O3(a),!c&&"missingOppositeContent"]};return F3(s,vn,n)},jn=d("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,a[O3(n.position)]]}})(({ownerState:e})=>p1({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",[`& .${on.root}`]:{textAlign:"right"},[`& .${mn.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&::before":{content:'""',flex:1,padding:"6px 16px"}})),yn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineItem"}),{position:s,className:r}=c,o=V3(c,fn),{position:i}=l.useContext(E2);let h=!1;l.Children.forEach(c.children,f=>{O7(f,["TimelineOppositeContent"])&&(h=!0)});const u=p1({},c,{position:s||i||"right",hasOppositeContent:h}),m=xn(u),p=l.useMemo(()=>({position:u.position}),[u.position]);return t.jsx(E2.Provider,{value:p,children:t.jsx(jn,p1({className:D3(m.root,r),ownerState:u,ref:n},o))})}),W3=yn;function bn(e){return h3("MuiTimelineSeparator",e)}u3("MuiTimelineSeparator",["root"]);const Zn=["className"],Sn=e=>{const{classes:a}=e;return F3({root:["root"]},bn,a)},Cn=d("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,a)=>a.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),wn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineSeparator"}),{className:s}=c,r=V3(c,Zn),o=c,i=Sn(o);return t.jsx(Cn,p1({className:D3(i.root,s),ownerState:o,ref:n},r))}),U3=wn;function _n(e){return h3("MuiTimelineDot",e)}u3("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const En=["className","color","variant"],An=e=>{const{color:a,variant:n,classes:c}=e,s={root:["root",n,a!=="inherit"&&`${n}${M2(a)}`]};return F3(s,_n,c)},kn=d("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,a[n.color!=="inherit"&&`${n.variant}${M2(n.color)}`],a[n.variant]]}})(({ownerState:e,theme:a})=>p1({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"&&p1({borderColor:"transparent"},e.color!=="inherit"&&p1({},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"&&p1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&p1({},e.color==="grey"?{borderColor:(a.vars||a).palette.grey[400]}:{borderColor:(a.vars||a).palette[e.color].main})))),Tn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineDot"}),{className:s,color:r="grey",variant:o="filled"}=c,i=V3(c,En),h=p1({},c,{color:r,variant:o}),u=An(h);return t.jsx(kn,p1({className:D3(u.root,s),ownerState:h,ref:n},i))}),l4=Tn;function Dn(e){return h3("MuiTimelineConnector",e)}u3("MuiTimelineConnector",["root"]);const Fn=["className"],Rn=e=>{const{classes:a}=e;return F3({root:["root"]},Dn,a)},Pn=d("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,a)=>a.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),In=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineConnector"}),{className:s}=c,r=V3(c,Fn),o=c,i=Rn(o);return t.jsx(Pn,p1({className:D3(i.root,s),ownerState:o,ref:n},r))}),d4=In,$n=d(U1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),Vn=d(Z)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),On=d(Z)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"flex-end"})),Bn=d(c8)(()=>({[`& .${s8.root}:before`]:{flex:0,padding:0}})),zn=["Draft","In review","Approved","Applied"],Mn=["Draft","In review","Rejected"],Ln=["Draft","In review","Approved","Scheduled","Applied"],Nn=(e,a,n,c)=>e==="Cancelled"?"grey":e==="Rejected"?n==="Rejected"?"error":"success":a!==-1&&a>=c?"success":a+1===c?"primary":"grey",qn=({state:e,schedule:a})=>{let n;switch(e){case"Rejected":n=Mn;break;case"Scheduled":n=Ln;break;default:n=zn}const c=n.findIndex(s=>s===e);return t.jsx($n,{elevation:0,children:t.jsx(Vn,{children:t.jsx(Bn,{children:n.map((s,r)=>{if(a&&s==="Scheduled")return Un(a);const o=Nn(e,c,s,r);let i={};return c+1===r&&!(e==="Cancelled"&&s==="Draft")&&(i={variant:"outlined"}),Hn(o,s,r<n.length-1,i)})})})})},Hn=(e,a,n,c={})=>t.jsxs(W3,{children:[t.jsxs(U3,{children:[t.jsx(l4,{color:e,...c}),n&&t.jsx(d4,{})]}),t.jsx(i4,{children:a})]},a),Wn=(e,a)=>{switch(e.status){case"suspended":return{title:"Schedule suspended",subtitle:`was ${a}`,color:"grey",reason:t.jsx(L1,{title:e.reason,arrow:!0,children:t.jsx(S2,{color:"disabled",fontSize:"small"})})};case"failed":return{title:"Schedule failed",subtitle:`at ${a}`,color:"error",reason:t.jsx(L1,{title:`Schedule failed because of ${e.reason||e.failureReason}`,arrow:!0,children:t.jsx(S2,{color:"error",fontSize:"small"})})};default:return{title:"Scheduled",subtitle:`for ${a}`,color:"warning",reason:null}}},Un=e=>{const{locationSettings:a}=R3(),n=P3(new Date(e.scheduledAt),a==null?void 0:a.locale),{title:c,subtitle:s,color:r,reason:o}=Wn(e,n);return t.jsxs(W3,{children:[t.jsxs(U3,{children:[t.jsx(l4,{color:r}),t.jsx(d4,{})]}),t.jsxs(i4,{children:[c,t.jsxs(On,{children:[t.jsx($,{color:"text.secondary",sx:{mr:1},children:`(${s})`}),o]})]})]},c)};var h4={},Gn=T1;Object.defineProperty(h4,"__esModule",{value:!0});var r8=h4.default=void 0,Kn=Gn(k1()),o5=t,Jn=(0,Kn.default)([(0,o5.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"),(0,o5.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"Schedule");r8=h4.default=Jn;const u4=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",O1=d(Z)(({theme:e})=>({display:"flex",alignItems:"center"})),o8=d(U0)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),i5=d(U0)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),A2=d(T6)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Yn=d(r8)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Qn=d(S2)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Xn=d(B7)(({theme:e})=>({color:e.palette.text.secondary,height:"35px",width:"35px",marginRight:e.spacing(1)})),ec=d(r2)(({theme:e})=>({color:e.palette.text.secondary,height:"24px",width:"24px"})),tc=d(Z)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),ac=d(Z,{shouldForwardProp:u4()})(({theme:e,bgColor:a,svgColor:n})=>({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:n}})),p4=d(S3)(({theme:e})=>({margin:e.spacing(2.5,0)})),nc=d(Z,{shouldForwardProp:u4()})(({theme:e,border:a})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:a,padding:e.spacing(3),width:"100%"})),E1=d($,{shouldForwardProp:u4()})(({theme:e,color:a})=>({fontWeight:"bold",color:a})),cc=d(Z)({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}),q2=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,sc=(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}`,rc=(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},oc=({changeRequest:e,onEditClick:a})=>{const n=l1();return t.jsxs(tc,{children:[t.jsx(ac,{...rc(e.state,n),children:t.jsx(z7,{style:{transform:"scale(1.5)"}})}),t.jsx(nc,{sx:{backgroundColor:e.state==="In review"?n.palette.warning.light:"initial"},border:sc(e.state,n),children:t.jsx(ic,{changeRequest:e,onEditClick:a})})]})},ic=({changeRequest:e,onEditClick:a})=>{const{state:n}=e;if(!n)return null;if(n==="Approved")return t.jsx(lc,{});if(n==="Applied")return t.jsx(hc,{});if(n==="Cancelled")return t.jsx(fc,{});if(n==="Rejected")return t.jsx(xc,{});if(n==="Scheduled"){const{schedule:c}=e;return t.jsx(pc,{schedule:c,onEditClick:a})}return t.jsx(dc,{minApprovals:e.minApprovals})},lc=()=>{const e=l1();return t.jsxs(t.Fragment,{children:[t.jsxs(O1,{children:[t.jsx(A2,{}),t.jsxs(Z,{children:[t.jsx(E1,{color:e.palette.success.dark,children:"Changes approved"}),t.jsx($,{children:"One approving review from requested approvers"})]})]}),t.jsx(p4,{}),t.jsxs(O1,{children:[t.jsx(A2,{}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},dc=({minApprovals:e})=>{const a=l1();return t.jsxs(t.Fragment,{children:[t.jsxs(O1,{children:[t.jsx(i5,{}),t.jsxs(Z,{children:[t.jsx(E1,{color:a.palette.warning.dark,children:"Review required"}),t.jsxs($,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),t.jsx(p4,{}),t.jsxs(O1,{children:[t.jsx(i5,{}),t.jsx(E1,{color:a.palette.warning.dark,children:"Apply changes is blocked"})]})]})},hc=()=>{const e=l1();return t.jsx(t.Fragment,{children:t.jsxs(O1,{children:[t.jsx(A2,{sx:{color:e.palette.primary.main}}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.primary.main,children:"Changes applied"})})]})})},uc=d(j1)({maxWidth:"32px",maxHeight:"32px"}),pc=({schedule:e,onEditClick:a})=>{const n=l1();if(!e)return null;const c=(()=>{switch(e.status){case"pending":return t.jsx(gc,{schedule:e});case"failed":return t.jsx(mc,{schedule:e});case"suspended":return t.jsx(vc,{schedule:e});default:return null}})();return t.jsxs(t.Fragment,{children:[t.jsxs(O1,{children:[t.jsx(A2,{}),t.jsxs(Z,{children:[t.jsx(E1,{color:n.palette.success.dark,children:"Changes approved"}),t.jsx($,{children:"One approving review from requested approvers"})]})]}),t.jsx(p4,{}),t.jsxs(cc,{children:[c,t.jsx(uc,{onClick:a,children:t.jsx(ec,{})})]})]})},mc=({schedule:e})=>{const a=l1(),n=q2(),{locationSettings:c}=R3(),s=P3(new Date(e==null?void 0:e.scheduledAt),c==null?void 0:c.locale);return t.jsxs(O1,{children:[t.jsx(Qn,{}),t.jsxs(Z,{children:[t.jsxs(E1,{color:a.palette.error.main,children:["Changes failed to be applied on ",s," because of"," ",e.reason??e.failureReason]}),t.jsxs($,{children:["Your timezone is ",n]})]})]})},vc=({schedule:e})=>{const a=l1(),n=q2(),{locationSettings:c}=R3(),s=P3(new Date(e==null?void 0:e.scheduledAt),c==null?void 0:c.locale);return t.jsxs(O1,{children:[t.jsx(Xn,{}),t.jsxs(Z,{children:[t.jsxs(E1,{color:a.palette.text.secondary,children:["The change request is suspended for the following reason:"," ",e.reason]}),t.jsxs(E1,{color:a.palette.text.secondary,children:["It will not be applied on ",s,"."]}),t.jsxs($,{children:["Your timezone is ",n]})]})]})},gc=({schedule:e})=>{const a=l1(),n=q2(),{locationSettings:c}=R3(),s=P3(new Date(e==null?void 0:e.scheduledAt),c==null?void 0:c.locale);return t.jsxs(O1,{children:[t.jsx(Yn,{}),t.jsxs(Z,{children:[t.jsxs(E1,{color:a.palette.warning.dark,children:["Changes are scheduled to be applied on: ",s]}),t.jsxs($,{children:["Your timezone is ",n]})]})]})},fc=()=>{const e=l1();return t.jsx(t.Fragment,{children:t.jsxs(O1,{children:[t.jsx(o8,{}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.error.main,children:"Changes cancelled"})})]})})},xc=()=>{const e=l1();return t.jsx(t.Fragment,{children:t.jsxs(O1,{children:[t.jsx(o8,{}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.error.main,children:"Changes rejected"})})]})})},i8=({disabled:e,children:a,actions:n,permission:c,projectId:s,ariaLabel:r,environmentId:o})=>{const[i,h]=Y1.useState(!1),u=Y1.useRef(null),m=()=>{h(g=>!g)},p=g=>{var v;(v=u.current)!=null&&v.contains(g.target)||h(!1)},f=u.current?u.current.offsetWidth:null;return t.jsxs(Y1.Fragment,{children:[t.jsx(i3,{variant:"contained",disabled:e,"aria-controls":i?"review-options-menu":void 0,"aria-expanded":i?"true":void 0,"aria-label":r,"aria-haspopup":"menu",onClick:m,ref:u,endIcon:t.jsx(M7,{}),permission:c,projectId:s,environmentId:o,children:a}),t.jsx(D6,{sx:{zIndex:1,width:f},open:i,anchorEl:u.current,transition:!0,disablePortal:!0,children:({TransitionProps:g,placement:v})=>t.jsx(L7,{...g,style:{transformOrigin:v==="bottom"?"center top":"center bottom"},children:t.jsx(U1,{className:"dropdown-outline",children:t.jsx(F6,{onClickAway:p,children:t.jsx(a2,{id:"review-options-menu",autoFocusItem:!0,children:n.map(({label:S,onSelect:x,icon:b})=>t.jsxs(R1,{disabled:e,onClick:x,children:[t.jsx(P1,{children:b}),t.jsx(I1,{children:S})]},`MenuItem-${S}`))})})})})})]})},jc=({disabled:e,onReject:a,onApprove:n,children:c})=>{const{isAdmin:s}=l.useContext(G1),r=q("projectId"),o=q("id"),{user:i}=R6(),{data:h}=r4(r,o),u=(h==null?void 0:h.createdBy.id)===(i==null?void 0:i.id),m=e||u&&!s;return t.jsx(i8,{permission:N7,disabled:m,actions:[{label:"Approve",onSelect:n,icon:t.jsx(b3,{fontSize:"small"})},{label:"Reject",onSelect:a,icon:t.jsx(q7,{fontSize:"small"})}],environmentId:h==null?void 0:h.environment,projectId:r,ariaLabel:"review or reject changes",children:c})};var l8={},m4={},v4={};Object.defineProperty(v4,"__esModule",{value:!0});var yc=l,bc=Zc(yc);function Zc(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a.default=e,a}v4.default=function(e,a,n){return bc.createElement("a",{href:e,key:n},a)};var g4={};Object.defineProperty(g4,"__esModule",{value:!0});g4.default=function(e){return e};var f4={},l0,l5;function Sc(){return l5||(l5=1,l0=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),l0}var d0,d5;function Cc(){return d5||(d5=1,d0=/[\0-\x1F\x7F-\x9F]/),d0}var h0,h5;function wc(){return h5||(h5=1,h0=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),h0}var u0,u5;function _c(){return u5||(u5=1,u0=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/),u0}var p0,p5;function Ec(){return p5||(p5=1,p0=function(e){var a={};a.src_Any=Sc().source,a.src_Cc=Cc().source,a.src_Z=wc().source,a.src_P=_c().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 n="[><|]";return a.src_pseudo_letter="(?:(?!"+n+"|"+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="(?=$|"+n+"|"+a.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+a.src_ZPCc+"))",a.src_path="(?:[/?#](?:(?!"+a.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+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="(^|"+n+'|"|\\(|'+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}),p0}function R0(e){var a=Array.prototype.slice.call(arguments,1);return a.forEach(function(n){n&&Object.keys(n).forEach(function(c){e[c]=n[c]})}),e}function H2(e){return Object.prototype.toString.call(e)}function Ac(e){return H2(e)==="[object String]"}function kc(e){return H2(e)==="[object Object]"}function Tc(e){return H2(e)==="[object RegExp]"}function m5(e){return H2(e)==="[object Function]"}function Dc(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var d8={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Fc(e){return Object.keys(e||{}).reduce(function(a,n){return a||d8.hasOwnProperty(n)},!1)}var Rc={"http:":{validate:function(e,a,n){var c=e.slice(a);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(c)?c.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,a,n){var c=e.slice(a);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(c)?a>=3&&e[a-3]===":"||a>=3&&e[a-3]==="/"?0:c.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,a,n){var c=e.slice(a);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(c)?c.match(n.re.mailto)[0].length:0}}},Pc="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]",Ic="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 Vc(e){return function(a,n){var c=a.slice(n);return e.test(c)?c.match(e)[0].length:0}}function v5(){return function(e,a){a.normalize(e)}}function k2(e){var a=e.re=Ec()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(Pc),n.push(a.src_xn),a.src_tlds=n.join("|");function c(i){return i.replace("%TLDS%",a.src_tlds)}a.email_fuzzy=RegExp(c(a.tpl_email_fuzzy),"i"),a.link_fuzzy=RegExp(c(a.tpl_link_fuzzy),"i"),a.link_no_ip_fuzzy=RegExp(c(a.tpl_link_no_ip_fuzzy),"i"),a.host_fuzzy_test=RegExp(c(a.tpl_host_fuzzy_test),"i");var s=[];e.__compiled__={};function r(i,h){throw new Error('(LinkifyIt) Invalid schema "'+i+'": '+h)}Object.keys(e.__schemas__).forEach(function(i){var h=e.__schemas__[i];if(h!==null){var u={validate:null,link:null};if(e.__compiled__[i]=u,kc(h)){Tc(h.validate)?u.validate=Vc(h.validate):m5(h.validate)?u.validate=h.validate:r(i,h),m5(h.normalize)?u.normalize=h.normalize:h.normalize?r(i,h):u.normalize=v5();return}if(Ac(h)){s.push(i);return}r(i,h)}}),s.forEach(function(i){e.__compiled__[e.__schemas__[i]]&&(e.__compiled__[i].validate=e.__compiled__[e.__schemas__[i]].validate,e.__compiled__[i].normalize=e.__compiled__[e.__schemas__[i]].normalize)}),e.__compiled__[""]={validate:null,normalize:v5()};var o=Object.keys(e.__compiled__).filter(function(i){return i.length>0&&e.__compiled__[i]}).map(Dc).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+o+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),$c(e)}function Oc(e,a){var n=e.__index__,c=e.__last_index__,s=e.__text_cache__.slice(n,c);this.schema=e.__schema__.toLowerCase(),this.index=n+a,this.lastIndex=c+a,this.raw=s,this.text=s,this.url=s}function g5(e,a){var n=new Oc(e,a);return e.__compiled__[n.schema].normalize(n,e),n}function A1(e,a){if(!(this instanceof A1))return new A1(e,a);a||Fc(e)&&(a=e,e={}),this.__opts__=R0({},d8,a),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=R0({},Rc,e),this.__compiled__={},this.__tlds__=Ic,this.__tlds_replaced__=!1,this.re={},k2(this)}A1.prototype.add=function(a,n){return this.__schemas__[a]=n,k2(this),this};A1.prototype.set=function(a){return this.__opts__=R0(this.__opts__,a),this};A1.prototype.test=function(a){if(this.__text_cache__=a,this.__index__=-1,!a.length)return!1;var n,c,s,r,o,i,h,u,m;if(this.re.schema_test.test(a)){for(h=this.re.schema_search,h.lastIndex=0;(n=h.exec(a))!==null;)if(r=this.testSchemaAt(a,n[2],h.lastIndex),r){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=a.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u<this.__index__)&&(c=a.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=c.index+c[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=c.index+c[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(m=a.indexOf("@"),m>=0&&(s=a.match(this.re.email_fuzzy))!==null&&(o=s.index+s[1].length,i=s.index+s[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&i>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=i))),this.__index__>=0};A1.prototype.pretest=function(a){return this.re.pretest.test(a)};A1.prototype.testSchemaAt=function(a,n,c){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(a,c,this):0};A1.prototype.match=function(a){var n=0,c=[];this.__index__>=0&&this.__text_cache__===a&&(c.push(g5(this,n)),n=this.__last_index__);for(var s=n?a.slice(n):a;this.test(s);)c.push(g5(this,n)),s=s.slice(this.__last_index__),n+=this.__last_index__;return c.length?c:null};A1.prototype.tlds=function(a,n){return a=Array.isArray(a)?a:[a],n?(this.__tlds__=this.__tlds__.concat(a).sort().filter(function(c,s,r){return c!==r[s-1]}).reverse(),k2(this),this):(this.__tlds__=a.slice(),this.__tlds_replaced__=!0,k2(this),this)};A1.prototype.normalize=function(a){a.schema||(a.url="http://"+a.url),a.schema==="mailto:"&&!/^mailto:/i.test(a.url)&&(a.url="mailto:"+a.url)};A1.prototype.onCompile=function(){};var Bc=A1;const zc=["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(f4,"__esModule",{value:!0});var Mc=Bc,Lc=h8(Mc),Nc=zc,qc=h8(Nc);function h8(e){return e&&e.__esModule?e:{default:e}}var u8=new Lc.default;u8.tlds(qc.default);f4.default=function(e){return u8.match(e)};var x4={};Object.defineProperty(x4,"__esModule",{value:!0});x4.default=function(e){return e};Object.defineProperty(m4,"__esModule",{value:!0});var Hc=function(){function e(a,n){for(var c=0;c<n.length;c++){var s=n[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}return function(a,n,c){return n&&e(a.prototype,n),c&&e(a,c),a}}(),Wc=l,q3=ts(Wc),Uc=v4,Gc=W2(Uc),Kc=g4,Jc=W2(Kc),Yc=f4,Qc=W2(Yc),Xc=x4,es=W2(Xc);function W2(e){return e&&e.__esModule?e:{default:e}}function ts(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a.default=e,a}function as(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function ns(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 cs(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 p8=function(e){cs(a,e);function a(){return as(this,a),ns(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return Hc(a,[{key:"parseString",value:function(c){var s=this;if(c==="")return c;var r=this.props.matchDecorator(c);if(!r)return c;var o=[],i=0;return r.forEach(function(h,u){h.index>i&&o.push(c.substring(i,h.index));var m=s.props.hrefDecorator(h.url),p=s.props.textDecorator(h.text),f=s.props.componentDecorator(m,p,u);o.push(f),i=h.lastIndex}),c.length>i&&o.push(c.substring(i)),o.length===1?o[0]:o}},{key:"parse",value:function(c){var s=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof c=="string"?this.parseString(c):q3.isValidElement(c)&&c.type!=="a"&&c.type!=="button"?q3.cloneElement(c,{key:r},this.parse(c.props.children)):Array.isArray(c)?c.map(function(o,i){return s.parse(o,i)}):c}},{key:"render",value:function(){return q3.createElement(q3.Fragment,null,this.parse(this.props.children))}}]),a}(q3.Component);p8.defaultProps={componentDecorator:Gc.default,hrefDecorator:Jc.default,matchDecorator:Qc.default,textDecorator:es.default};m4.default=p8;Object.defineProperty(l8,"__esModule",{value:!0});var ss=m4,rs=os(ss);function os(e){return e&&e.__esModule?e:{default:e}}var is=l8.default=rs.default;const ls=d(Z)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),ds=d(U1)(({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})),hs=d(Z)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),us=({comment:e})=>t.jsxs(ls,{children:[t.jsx(Z1,{title:e.createdBy.username,children:t.jsx(H7,{src:e.createdBy.imageUrl})}),t.jsxs(ds,{variant:"outlined",children:[t.jsx(hs,{children:t.jsxs(Z,{children:[t.jsx("strong",{children:e.createdBy.username})," ",t.jsxs($,{color:"text.secondary",component:"span",children:["commented"," ",t.jsx(W0,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),t.jsx(Z,{sx:{paddingTop:2.5},children:t.jsx(is,{children:e.text})})]})]}),m8=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),ps=d(T6)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),ms=d(U0)(({theme:e})=>({color:e.palette.error.main,marginLeft:"auto"})),v8=d($)({maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"text.primary"}),vs=({name:e,imageUrl:a})=>t.jsxs(m8,{children:[t.jsx(o4,{src:a}),t.jsx(v8,{variant:"body1",children:e}),t.jsx(ps,{})]}),gs=({name:e,imageUrl:a})=>t.jsxs(m8,{children:[t.jsx(o4,{src:a}),t.jsx(v8,{variant:"body1",children:e}),t.jsx(ms,{})]}),fs=({rejections:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx($,{variant:"body1",color:"text.secondary",children:"Rejected by"}),e.map(a=>t.jsx(gs,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),xs=({approvals:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx($,{variant:"body1",color:"text.secondary",children:t.jsx(C,{condition:(e==null?void 0:e.length)>0,show:"Approved by",elseShow:"No approvals yet"})}),e.map(a=>t.jsx(vs,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),js=d(Z)(({theme:e})=>({marginBottom:e.spacing(2)})),ys=({actualApprovals:e,minApprovals:a})=>t.jsxs(t.Fragment,{children:["Reviewers"," ",t.jsxs($,{component:"span",color:"text.secondary",children:["(",e,"/",a," required)"]})]}),bs=({header:e,children:a})=>t.jsxs(U1,{elevation:0,sx:n=>({marginTop:n.spacing(2),padding:n.spacing(4),borderRadius:c=>`${c.shape.borderRadiusLarge}px`}),children:[t.jsx(js,{children:e}),a]}),Zs=({changeRequest:e})=>t.jsx(bs,{header:t.jsx(ys,{actualApprovals:e.approvals.length,minApprovals:e.minApprovals}),children:t.jsx(C,{condition:e.state==="Rejected",show:t.jsx(fs,{rejections:e.rejections}),elseShow:t.jsx(xs,{approvals:e.approvals})})}),Ss=({open:e,onConfirm:a,onClose:n,disabled:c=!1})=>{const[s,r]=l.useState("");return t.jsxs(D1,{open:e,primaryButtonText:"Reject changes",secondaryButtonText:"Cancel",onClick:()=>a(s),disabledPrimaryButton:c,onClose:n,title:"Reject changes",fullWidth:!0,children:[t.jsx(Z,{children:"Add an optional comment why you reject those changes"}),t.jsx(t3,{sx:{mt:1},variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>r(o.target.value),value:s})]})};var j4={},Cs=T1;Object.defineProperty(j4,"__esModule",{value:!0});var g8=j4.default=void 0,ws=Cs(k1()),_s=t,Es=(0,ws.default)((0,_s.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");g8=j4.default=Es;const f5=({disabled:e,onSchedule:a,onApply:n,variant:c="create",children:s})=>{const r=q("projectId"),o=q("id"),{data:i}=r4(r,o);return t.jsx(i8,{permission:G0,disabled:e,actions:[{label:"Apply changes",onSelect:n,icon:t.jsx(b3,{fontSize:"small"})},{label:c==="create"?"Schedule changes":"Update schedule",onSelect:a,icon:t.jsx(g8,{fontSize:"small"})}],environmentId:i==null?void 0:i.environment,projectId:r,ariaLabel:"apply or schedule changes",children:s})},As=d(i1)(({theme:e})=>({marginBottom:e.spacing(2),backgroundColor:`${e.palette.neutral.light}!important`,color:`${e.palette.text.primary}!important`,borderColor:`${e.palette.neutral.light}!important`})),f8=({open:e,onConfirm:a,onClose:n,title:c,primaryButtonText:s,disabled:r,message:o,scheduledTime:i,permissionButton:h})=>i?t.jsxs(D1,{title:c,primaryButtonText:s,disabledPrimaryButton:r,secondaryButtonText:"Cancel",open:e,onClose:n,onClick:()=>a(),permissionButton:h,fullWidth:!0,children:[t.jsxs(As,{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($,{variant:"body1",children:o})]}):null,ks=({projectId:e,environment:a,disabled:n,onConfirm:c,...s})=>t.jsx(f8,{message:"Applying the changes now means the scheduled time will be ignored",title:"Apply changes",primaryButtonText:"Apply changes now",onConfirm:c,permissionButton:t.jsx(i3,{variant:"contained",onClick:()=>c(),projectId:e,permission:G0,environmentId:a,disabled:n,children:"Apply changes now"}),...s}),Ts=({...e})=>t.jsx(f8,{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}),Ds=d(Z)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(2)})),Fs=({open:e,onConfirm:a,onClose:n,title:c,primaryButtonText:s,projectId:r,environment:o,disabled:i,scheduledAt:h})=>{const[u,m]=l.useState(h?new Date(h):new Date),[p,f]=l.useState(void 0),g=q2();return t.jsxs(D1,{title:c,primaryButtonText:s,disabledPrimaryButton:i,secondaryButtonText:"Cancel",open:e,onClose:()=>n(),onClick:()=>a(u),permissionButton:t.jsx(i3,{variant:"contained",onClick:()=>a(u),projectId:r,permission:G0,environmentId:o,disabled:i,children:s}),fullWidth:!0,children:[t.jsx(i1,{severity:"info",sx:{mb:v=>v.spacing(2)},children:"The time shown below is based on your browser's time zone."}),t.jsx($,{variant:"body1",sx:{mb:v=>v.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(Ds,{children:[t.jsx(W7,{label:"Date",value:u,onChange:v=>{f(void 0),v<new Date&&f(`The time you provided (${v.toLocaleString()}) is not valid because it's in the past. Please select a time in the future.`),m(v)},min:new Date,error:!!p,errorText:p,required:!0}),t.jsxs($,{variant:"body2",children:["Your browser's time zone is ",g]})]})]})},Rs=d(Z)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),Ps=d(U1)(({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%"}})),Is=d(Z)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),$s=d(Z)(({theme:e})=>({padding:e.spacing(2)})),x5=d(o1)(({theme:e})=>({marginLeft:e.spacing(2)})),Vs=d(Z)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Os=()=>{var M3,a3;const e=q("projectId"),[a,n]=l.useState(!1),[c,s]=l.useState(!1),[r,o]=l.useState(!1),[i,h]=l.useState(!1),[u,m]=l.useState(!1),{user:p}=R6(),{isAdmin:f}=l.useContext(G1),[g,v]=l.useState(""),S=q("id"),{data:x,refetchChangeRequest:b}=r4(e,S),{changeState:w,addComment:E}=$2(),{refetch:O}=V2(e),{setToastData:k,setToastApiError:_}=u1(),{isChangeRequestConfiguredForReview:T}=w3(e),[R,F]=l.useState(!1);if(!x)return null;const B=T(x.environment),I=()=>{switch(x.state){case"Scheduled":return`${x.state} ${x.schedule.status}`;default:return x.state}},M=async()=>{try{F(!0),await w(e,Number(S),I(),{state:"Applied"}),h(!1),await b(),O(),k({type:"success",title:"Success",text:"Changes applied"})}catch(e1){_(r1(e1))}finally{F(!1)}},H=async e1=>{try{F(!0),await w(e,Number(S),I(),{state:"Scheduled",scheduledAt:e1.toISOString()}),o(!1),b(),O(),k({type:"success",title:"Success",text:"Changes scheduled"})}catch(z1){_(r1(z1))}finally{F(!1)}},D=async()=>{try{F(!0),await E(e,S,g),v(""),await b(),k({type:"success",title:"Success",text:"Comment added"})}catch(e1){_(r1(e1))}finally{F(!1)}},P=async()=>{try{F(!0),await w(e,Number(S),I(),{state:"Cancelled"}),n(!1),await b(),O(),k({type:"success",title:"Success",text:"Changes cancelled"})}catch(e1){_(r1(e1))}finally{F(!1)}},W=async e1=>{try{F(!0),await w(e,Number(S),I(),{state:"Rejected",comment:e1}),s(!1),await b(),k({type:"success",title:"Success",text:"Changes rejected"}),O()}catch(z1){_(r1(z1))}finally{F(!1)}},j=async()=>{try{F(!0),await w(e,Number(S),I(),{state:"Approved"}),await b(),O(),k({type:"success",title:"Success",text:"Changes approved"})}catch(e1){_(r1(e1))}finally{F(!1)}},A=()=>n(!0),y=()=>n(!1),z=()=>s(!1),L=()=>h(!1),U=()=>o(!1),a1=()=>m(!1),s1=(x==null?void 0:x.createdBy.id)===(p==null?void 0:p.id)&&x.state==="In review"&&!f,K1=(M3=x.approvals)==null?void 0:M3.some(e1=>e1.createdBy.id===(p==null?void 0:p.id)),w1=U7(x);(()=>{if("schedule"in x)switch(x.schedule.status){case"failed":return(x.schedule.reason||x.schedule.failureReason)??void 0;case"suspended":return x.schedule.reason;default:return}})();const N1="schedule"in x?x.schedule.scheduledAt:void 0,p3=x.state==="Scheduled"?{state:"Scheduled",schedule:x.schedule}:{state:x.state,schedule:void 0};return t.jsxs(t.Fragment,{children:[t.jsx(Ja,{changeRequest:x}),t.jsxs(Vs,{children:[t.jsxs(Rs,{children:[t.jsx(qn,{...p3}),t.jsx(Zs,{changeRequest:x})]}),t.jsx(Ps,{elevation:0,children:t.jsxs($s,{children:["Requested Changes (",w1,")",t.jsx(G7,{changeRequest:x,onRefetch:b}),(a3=x.comments)==null?void 0:a3.map(e1=>t.jsx(us,{comment:e1},e1.id)),t.jsx(K7,{user:p,commentText:g,onTypeComment:v,children:t.jsx(o1,{variant:"outlined",onClick:D,disabled:!B||g.trim().length===0||g.trim().length>1e3||R,children:"Comment"})}),t.jsx(C,{condition:s1,show:t.jsx(i1,{sx:e1=>({marginTop:e1.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),t.jsx(oc,{changeRequest:x,onEditClick:()=>o(!0)}),t.jsxs(Is,{children:[t.jsx(C,{condition:x.state==="In review"&&!K1,show:t.jsxs(jc,{onReject:()=>s(!0),onApprove:j,disabled:!B||R,children:["Review changes (",w1,")"]})}),t.jsx(C,{condition:x.state==="Approved",show:t.jsx(f5,{onApply:M,disabled:!B||R,onSchedule:()=>o(!0),children:"Apply or schedule changes"})}),t.jsx(C,{condition:x.state==="Scheduled",show:t.jsx(f5,{onApply:()=>h(!0),disabled:!B||R,onSchedule:()=>o(!0),variant:"update",children:"Apply or schedule changes"})}),t.jsx(C,{condition:x.state!=="Applied"&&x.state!=="Rejected"&&x.state!=="Cancelled"&&(x.createdBy.id===(p==null?void 0:p.id)||f),show:t.jsx(C,{condition:!!N1,show:t.jsx(x5,{variant:"outlined",onClick:()=>m(!0),disabled:R,children:"Reject changes"}),elseShow:t.jsx(x5,{variant:"outlined",onClick:A,disabled:R,children:"Cancel changes"})})})]})]})}),t.jsxs(D1,{open:a,onClick:P,onClose:y,title:"Cancel change request",children:[t.jsx($,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),t.jsx($,{variant:"body2",sx:e1=>({color:e1.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(Ss,{open:c,onConfirm:W,onClose:z,disabled:R}),t.jsxs(t.Fragment,{children:[t.jsx(Fs,{open:r,onConfirm:H,onClose:U,disabled:!B||R,projectId:e,environment:x.environment,primaryButtonText:x.state==="Scheduled"?"Update scheduled time":"Schedule changes",title:x.state==="Scheduled"?"Update schedule":"Schedule changes",scheduledAt:N1}),t.jsx(ks,{open:i,onConfirm:M,onClose:L,scheduledTime:N1,disabled:!B||R,projectId:e,environment:x.environment}),t.jsx(Ts,{open:u,onConfirm:W,onClose:a1,scheduledTime:N1,disabled:R})]})]})]})},Bs=({value:e,row:{original:a}})=>{const n=()=>e?t.jsx(k6,{changeRequest:a}):null;return e?t.jsx(Y,{children:n()}):t.jsx(Y,{})},zs=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),Ms=({value:e})=>{const{searchQuery:a}=_3();return t.jsx(Y,{children:t.jsx(zs,{children:t.jsxs($,{component:"span",variant:"body2",children:[" ",t.jsx($1,{search:a,children:e==null?void 0:e.username})]})})})},Ls=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),Ns=({value:e,row:{original:a}})=>{const{searchQuery:n}=_3(),c=q("projectId"),{id:s,title:r,features:o,segments:i}=a,h=(o||[]).length+(i||[]).length,u=`/projects/${c}/change-requests/${s}`;return e?t.jsxs(Y,{sx:{minWidth:"200px"},children:[t.jsx(Ls,{children:t.jsx($,{variant:"body2",children:t.jsx(o3,{component:Q,underline:"hover",to:u,sx:m=>({paddingTop:m.spacing(.2),marginRight:m.spacing(1),"&:hover":{textDecoration:"underline"}}),children:t.jsx($1,{search:n,children:r})})})}),t.jsxs("span",{children:[`${h}`," ",h<=1?"update":"updates"]})]}):t.jsx(Y,{})},qs=J7()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(2,4,4,4),overflowX:"auto"}})),Hs=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),Ws=d(Q)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Us=d(Q)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Gs=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),Ks=({value:e,project:a})=>{const{searchQuery:n}=_3(),c=e==null?void 0:e.map(s=>s.name);return t.jsx(Hs,{children:t.jsx(C,{condition:(c==null?void 0:c.length)<3,show:c==null?void 0:c.map(s=>t.jsx(Ws,{title:s,to:`/projects/${a}/features/${s}`,children:t.jsx($1,{search:n,children:s})},s)),elseShow:t.jsxs(I3,{tooltipProps:{maxWidth:"800px"},tooltip:t.jsx(Gs,{children:c==null?void 0:c.map(s=>t.jsx(Us,{title:s,to:`/projects/${a}/features/${s}`,children:t.jsx($1,{search:n,children:s})},s))}),children:[c==null?void 0:c.length," toggles"]})})})},Js={id:"createdAt",desc:!0},Ys=d("div")({paddingLeft:0,paddingBottom:0}),Qs=d(b2)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),Xs=d(Z)(({theme:e})=>({textAlign:"right",paddingBottom:e.spacing(2),fontSize:e.fontSizes.smallBody})),er=({changeRequests:e=[],loading:a,projectId:n})=>{var H,D;const{classes:c}=qs(),s=v1(G3.breakpoints.down("md")),[r,o]=P6(),[i,h]=l.useState(r.get("search")||""),{value:u,setValue:m}=M0(`${n}:ProjectChangeRequest`,Js),[p,f]=l.useMemo(()=>{const P=e.filter(j=>j.state!=="Cancelled"&&j.state!=="Rejected"&&j.state!=="Applied"),W=e.filter(j=>j.state==="Cancelled"||j.state==="Rejected"||j.state==="Applied");return[P,W]},[e]),g=[{title:"Change requests",data:p},{title:"Closed",data:f}],[v,S]=l.useState(0),x=l.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:Ns},{id:"Updated feature flags",Header:"Updated feature flags",canSort:!1,accessor:"features",searchable:!0,filterName:"feature",filterParsing:P=>(P==null?void 0:P.map(({name:W})=>W).join(`
1
+ import{s as d,di as K8,df as b2,w as k1,x as T1,j as t,a6 as J3,r as l,f7 as J8,ac as Y,a4 as c1,a7 as Y3,a8 as Q3,a9 as X3,aa as e2,q as R2,aN as D1,K as i1,bj as s3,b5 as g1,b7 as S1,f8 as i6,aJ as q,f9 as F1,cI as C1,c as u1,da as X1,fa as e3,b8 as X,fb as Y8,af as P2,dz as z0,fc as l6,fd as b1,av as t1,ap as _1,au as d1,C,aM as Q,ar as r3,aq as f1,dd as Q8,aj as M0,fe as X8,B as Z,n as Z1,v as j1,aX as L0,a2 as t2,aY as a2,M as R1,ff as c3,aZ as P1,d as b3,dj as e7,a$ as I1,T as $,fg as H1,dk as N0,dl as d6,be as I2,dp as t7,ai as Z3,D as S3,aP as q0,E as h6,ak as x1,h as o1,fh as a7,fi as n7,fj as c7,f as r1,cB as s7,cA as o3,aS as C3,cC as u6,aT as $2,aW as w3,aU as V2,fk as p6,e7 as H0,am as n2,a as l1,ad as v1,b9 as V1,ba as B1,fl as r7,dT as o7,fm as i7,de as l7,cF as c2,bl as Y1,fn as d7,fo as h7,G as g3,em as _3,fp as m6,fq as L1,en as $1,fr as O4,fs as u7,aK as p7,bi as v6,d6 as q1,d9 as Z2,ft as m7,d7 as f3,fu as v7,d8 as g7,fv as n0,fw as g6,fx as f7,fy as f6,fz as x6,dg as x7,fA as B4,fB as j7,fC as y7,dS as O2,fD as b7,fE as Z7,fF as j6,fG as y6,fH as b6,fI as S7,fJ as Z6,b6 as B2,fK as S6,fL as C6,f0 as C7,fM as w7,bk as w6,z as U1,fN as W0,a1 as _7,an as E3,fO as E7,bg as _6,fP as E6,fQ as A6,fR as A7,fS as k7,fT as T7,fU as D7,a5 as A3,ag as k3,ah as z2,m as F7,aL as R7,fV as P7,fW as s2,fX as I7,fY as k6,fZ as $7,f_ as V7,aH as M2,aF as T3,aG as D3,aI as F3,f$ as O7,bb as R3,g0 as P3,b as S2,cE as U0,g1 as T6,g2 as B7,a_ as r2,g3 as z7,b3 as i3,g4 as M7,y as D6,g5 as L7,g6 as F6,c6 as G1,c5 as R6,g7 as N7,l as q7,g8 as H7,k as t3,g9 as G0,ga as W7,gb as U7,gc as G7,gd as K7,ge as J7,b1 as I3,d1 as G3,al as P6,ef as C2,ao as K0,gf as Y7,dn as J0,c4 as Q7,dN as l3,cM as W1,bd as x3,b0 as o2,e5 as Y0,A as i2,dF as X7,aQ as I6,aR as $6,dE as Q1,ce as d3,gg as ee,gh as te,e4 as m2,gi as ae,gj as ne,gk as ce,gl as c0,gm as se,gn as re,cK as $3,cL as K,go as oe,gp as V6,gq as ie,gr as z4,gs as M4,gt as O6,gu as le,u as L2,dC as de,gv as he,dD as ue,gw as L4,gx as pe,gy as me,gz as ve,gA as ge,gB as fe,c1 as xe,c2 as je,cs as Q0,ct as X0,cu as e4,cv as ye,V as be,gC as Ze,gD as Se,cH as B6,gE as Ce,t as N4,cR as we,gF as _e,gG as z6,gH as Ee,gI as Ae,gJ as ke,gK as Te,gL as De,gM as Fe,gN as Re,gO as Pe,gP as t4,d2 as M6,gQ as a4,cx as Ie,dV as s0,cz as $e,gR as Ve,gS as N3,gT as Oe,gU as Be,gV as q4,gW as H4,gX as ze,gY as Me,gZ as Le,g_ as Ne,g$ as qe,cS as w2,h0 as He,f1 as We,h1 as Ue,f4 as Ge,du as W4,dr as Ke,dh as L6,e$ as D0,h2 as Je,d_ as N6,aE as j3,h3 as J,h4 as Ye,h5 as Qe,h6 as Xe,h7 as e9,cX as q6,h8 as t9,cy as a9,h9 as n9,ha as c9,hb as s9,c8 as r9,hc as o9,hd as i9,he as l9}from"./index-D3PezXCS.js";import{h as d9,i as h9,j as F0,F as H6,f as u9,e as W6,T as p9,g as m9,d as v9,V as g9,k as f9,M as x9,c as j9,E as y9}from"./FeatureStaleDialog-D-1JGcwj.js";import{m as b9,i as U4,b as Z9,c as S9,d as C9,e as w9,E as _9,f as E9,u as A9,a as k9,R as T9,C as D9,A as F9,g as U6}from"./RoleCell-C-E960FF.js";import{S as R9}from"./StrategyItemContainer-CvZqeW-d.js";import{C as P9,P as I9}from"./ProjectForm-c43ztjmB.js";import{d as N2}from"./CheckCircleOutline-3N2b6C6u.js";const G4=d("div")(()=>({display:"flex"})),$9=d("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));d("div")(()=>({display:"flex",flexDirection:"column"}));const V9=d("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),O9=d("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));d(O9)(({theme:e})=>({color:e.palette.neutral.dark}));const B9=d(K8)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),z9=d("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),M9=d("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),L9=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)})),N9=d("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),q9=d("div")(({theme:e})=>({padding:e.spacing(0,4)})),H9=d(b2)(({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}}));var n4={},W9=T1;Object.defineProperty(n4,"__esModule",{value:!0});var G6=n4.default=void 0,U9=W9(k1()),G9=t,K9=(0,U9.default)((0,G9.jsx)("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload");G6=n4.default=K9;const J9=e=>e.reduce((a,n)=>n.enabled?a+1:a,0),Y9=d(J3)(({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"})),X9=({environment:e,warnEnabledToggles:a})=>{const n=l.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:h}})=>t.jsx(J8,{environment:h})},{Header:"Name",accessor:"name",Cell:Y},{Header:"Type",accessor:"type",Cell:Y},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:h})=>t.jsx(Y,{children:t.jsx(Q9,{warning:h>0,children:h===1?"1 toggle":`${h} toggles`})}),align:"center"}],[a]),{getTableProps:c,getTableBodyProps:s,headerGroups:r,rows:o,prepareRow:i}=c1.useTable({columns:n,data:[e],disableSortBy:!0});return t.jsxs(Y9,{...c(),rowHeight:"compact",children:[t.jsx(Y3,{headerGroups:r}),t.jsx(Q3,{...s(),children:o.map(h=>(i(h),t.jsx(X3,{hover:!0,...h.getRowProps(),children:h.cells.map(u=>t.jsx(e2,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},et=d("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),tt=d(R2)(()=>({width:"100%"})),at=({environment:e,open:a,setOpen:n,onConfirm:c})=>{const[s,r]=l.useState("");return l.useEffect(()=>{r("")},[a]),t.jsxs(D1,{title:"Hide environment and disable feature flags?",open:a,primaryButtonText:"Hide environment and disable feature flags",disabledPrimaryButton:(e==null?void 0:e.name)!==s,secondaryButtonText:"Close",onClick:c,onClose:()=>{n(!1)},children:[t.jsxs(i1,{severity:"error",children:[t.jsx("strong",{children:"Danger!"})," Hiding an environment will disable all the feature flags that are enabled in this environment and it can impact client applications connected to the environment."]}),t.jsx(X9,{environment:e}),t.jsxs(et,{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(tt,{label:"Environment name",value:s,onChange:o=>r(o.target.value)})]})},nt=e=>{const{data:a,error:n,mutate:c}=s3(g1(`api/admin/environments/project/${e}`),ct),s=l.useMemo(()=>a||[],[a]),r=l.useCallback(async()=>{await c()},[c]);return{environments:s,refetchEnvironments:r,loading:!n&&!a,error:n}},ct=async e=>(await fetch(e).then(S1("Environments")).then(n=>n.json())).environments.sort((n,c)=>n.sortOrder-c.sortOrder),st=d(i1)(({theme:e})=>({marginBottom:e.spacing(4)})),rt=d("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),ot=d(i6)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),K6=()=>{const e=q("projectId"),a=F1(e);C1(`Project environments – ${a}`);const{setToastData:n,setToastApiError:c}=u1(),{environments:s,loading:r,error:o,refetchEnvironments:i}=nt(e),{project:h,refetch:u}=X1(e),{removeEnvironmentFromProject:m,addEnvironmentToProject:p}=e3(),[f,g]=l.useState(),[v,S]=l.useState(!1),{isOss:x}=X(),b=l.useMemo(()=>s.map(j=>({...j,projectVisible:h==null?void 0:h.environments.map(A=>A.environment).includes(j.name)})),[s,h==null?void 0:h.environments]),w=()=>{i(),u()},E=()=>t.jsx(ot,{onClick:w,text:"Error fetching environments"}),O=j=>`Got an API error when trying to set the environment as ${j?"visible":"hidden"}`,k=async j=>{if(j.projectVisible){if(J9(b)>1){g(j),S(!0);return}n({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await p(e,j.name),w(),n({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{c(O(!0))}},_=async()=>{if(f)try{await m(e,f.name),w(),n({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{c(O(!1))}finally{S(!1)}},T=j=>x()&&j==="default",R=l.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:j}})=>t.jsx(Y8,{environment:j})},{Header:"Type",accessor:"type",Cell:P2},{Header:"Project API tokens",accessor:j=>j.projectApiTokenCount===1?"1 token":`${j.projectApiTokenCount} tokens`,Cell:Y},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:j}})=>t.jsx(z0,{children:t.jsx(l6,{tooltip:j.projectVisible?"Hide environment and disable feature flags":"Make it visible",size:"medium",disabled:T(j.name),projectId:e,permission:b1,checked:j.projectVisible,onChange:()=>k(j)})}),disableGlobalFilter:!0}],[b]),{getTableProps:F,getTableBodyProps:B,headerGroups:I,rows:M,prepareRow:H,state:{globalFilter:D},setGlobalFilter:P}=c1.useTable({columns:R,data:b,disableSortBy:!0},c1.useGlobalFilter),W=t.jsx(t1,{title:`Environments (${M.length})`,actions:t.jsx(_1,{initialValue:D,onChange:P})});return t.jsx(d1,{header:W,isLoading:r,children:t.jsxs(rt,{children:[t.jsx(C,{condition:!!o,show:E()}),t.jsxs(st,{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(Q,{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(Q,{to:"/admin/api",children:"create a new API token here"}),"."]}),t.jsx(r3,{value:D,children:t.jsxs(J3,{...F(),rowHeight:"compact",children:[t.jsx(Y3,{headerGroups:I}),t.jsx(Q3,{...B(),children:M.map(j=>(H(j),t.jsx(X3,{hover:!0,...j.getRowProps(),children:j.cells.map(A=>t.jsx(e2,{...A.getCellProps(),children:A.render("Cell")}))})))})]})}),t.jsx(C,{condition:M.length===0,show:t.jsx(C,{condition:(D==null?void 0:D.length)>0,show:t.jsxs(f1,{children:["No environments found matching “",D,"”"]}),elseShow:t.jsx(f1,{children:"No environments available. Get started by adding one."})})}),t.jsx(at,{environment:f,open:v,setOpen:S,onConfirm:_})]})})},it={id:"archivedAt"},lt=({projectId:e})=>{const{archivedFeatures:a,loading:n,refetchArchived:c}=Q8(e),{value:s,setValue:r}=M0(`${e}:ProjectFeaturesArchiveTable`,it);return t.jsx(X8,{title:"Project archive",archivedFeatures:a||[],loading:n,storedParams:s,setStoredParams:r,refetch:c,projectId:e})},dt=()=>{const e=q("projectId"),a=F1(e);return C1(`Project archive – ${a}`),t.jsx(lt,{projectId:e})},ht=d(Z)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),ut=({projectId:e,row:a,onOpenArchiveDialog:n,onOpenStaleDialog:c})=>{const[s,r]=l.useState(null),[o,i]=l.useState(!1),{setToastData:h}=u1(),{original:{name:u,stale:m}}=a,p=!!s,f=b=>{r(b.currentTarget)},g=()=>{r(null)},v=`feature-${u}-actions`,S=`${v}-menu`,x=()=>{try{t7(u),i(!0),setTimeout(()=>{g(),i(!1)},1e3)}catch{h({type:"error",title:"Could not copy feature name"})}};return t.jsxs(ht,{children:[t.jsx(Z1,{title:"Feature flag actions",arrow:!0,describeChild:!0,children:t.jsx(j1,{id:v,"data-loading":!0,"aria-controls":p?S:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:f,type:"button",children:t.jsx(L0,{})})}),t.jsx(t2,{id:S,anchorEl:s,open:p,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:t.jsxs(a2,{"aria-labelledby":v,children:[t.jsxs(R1,{sx:c3,onClick:x,children:[t.jsx(P1,{children:o?t.jsx(b3,{}):t.jsx(e7,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:o?"Copied!":"Copy Name"})})]}),t.jsx(H1,{projectId:e,permission:N0,children:({hasAccess:b})=>t.jsxs(R1,{sx:c3,onClick:g,disabled:!b,component:Q,to:`/projects/${e}/features/${u}/copy`,children:[t.jsx(P1,{children:t.jsx(d9,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Clone"})})]})}),t.jsx(H1,{projectId:e,permission:d6,children:({hasAccess:b})=>t.jsxs(R1,{sx:c3,onClick:()=>{n(u),g()},disabled:!b,children:[t.jsx(P1,{children:t.jsx(h9,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Archive"})})]})}),t.jsx(H1,{projectId:e,permission:I2,children:({hasAccess:b})=>t.jsxs(R1,{sx:c3,onClick:()=>{g(),c({featureId:u,stale:m===!0})},disabled:!b,children:[t.jsx(P1,{children:t.jsx(F0,{})}),t.jsx(I1,{children:t.jsxs($,{variant:"body2",children:[m?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var c4={},pt=T1;Object.defineProperty(c4,"__esModule",{value:!0});var J6=c4.default=void 0,mt=pt(k1()),vt=t,gt=(0,mt.default)((0,vt.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");J6=c4.default=gt;const ft=d(Z)(()=>({...Z3,justifyContent:"center"})),xt=d(j1)(({theme:e})=>({margin:e.spacing(-1,0)})),jt=d(Z)(({theme:e})=>({...Z3,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),yt=d(R1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),bt=d(S3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),Zt=d(q0)(({theme:e})=>({padding:e.spacing(.75,1)})),St=({columns:e,onToggle:a})=>{const[n,c]=l.useState(null),s=u=>{c(u.currentTarget)},r=()=>{c(null)},o=!!n,i="columns-menu",h=`columns-menu-list-${i}`;return t.jsxs(ft,{children:[t.jsx(Z1,{title:"Select columns",arrow:!0,describeChild:!0,children:t.jsx(xt,{id:i,"aria-controls":o?h:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:s,type:"button",size:"large","data-loading":!0,children:t.jsx(J6,{})})}),t.jsxs(t2,{id:h,open:o,anchorEl:n,onClose:r,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:u=>({borderRadius:u.shape.borderRadius,paddingBottom:u.spacing(2)})},children:[t.jsxs(jt,{children:[t.jsx($,{variant:"body2",children:t.jsx("strong",{children:"Columns"})}),t.jsx(j1,{onClick:r,children:t.jsx(h6,{})})]}),t.jsx(a2,{children:e.map(u=>u.id==="divider"?t.jsx(bt,{},"divider"):t.jsxs(yt,{onClick:()=>{a==null||a(u.id)},disabled:u.isStatic===!0&&u.isVisible===!0,children:[t.jsx(P1,{children:t.jsx(Zt,{edge:"start",checked:u.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":u.id},size:"medium"})}),t.jsx(I1,{id:u.id,primary:t.jsx($,{variant:"body2",children:u.header})})]},u.id))})]})]})},Ct=7,wt=e=>{const a=a7(new Date,-Ct);return!!(e!=null&&e.lastSeenAt&&n7(new Date(e.lastSeenAt),a))},_t=({projectId:e,featureIds:a,features:n,onConfirm:c})=>{const[s,r]=l.useState(!1),{trackEvent:o}=x1(),i=l.useMemo(()=>a.filter(u=>{const m=n.find(p=>p.name===u);return wt(m)}),[JSON.stringify(n),a]),h=async()=>{r(!1),c==null||c(),o("batch_operations",{props:{eventType:"features archived"}})};return t.jsxs(t.Fragment,{children:[t.jsx(H1,{projectId:e,permission:d6,children:({hasAccess:u})=>t.jsx(o1,{disabled:!u||s,variant:"outlined",size:"small",onClick:()=>r(!0),children:"Archive"})}),t.jsx(H6,{projectId:e,featureIds:a,featuresWithUsage:i,onConfirm:h,isOpen:s,onClose:()=>r(!1)})]})},v2="selection-actions-menu",Et=({projectId:e,data:a,onChange:n})=>{const[c,s]=l.useState(null),{staleFeatures:r}=e3(),{setToastData:o,setToastApiError:i}=u1(),{trackEvent:h}=x1(),u=!!c,m=a.map(({name:b})=>b),p=b=>{s(b.currentTarget)},f=()=>{s(null)},g=a.some(({stale:b})=>b===!0),v=a.some(({stale:b})=>b===!1),S=async()=>{try{f(),await r(e,m),n==null||n(),o({title:"State updated",text:"Feature flags marked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features staled"}})}catch(b){i(r1(b))}},x=async()=>{try{f(),await r(e,m,!1),n==null||n(),o({title:"State updated",text:"Feature flags unmarked as stale",type:"success"}),h("batch_operations",{props:{eventType:"features unstaled"}})}catch(b){i(r1(b))}};return t.jsxs(t.Fragment,{children:[t.jsx(Z1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t.jsx(j1,{id:v2,"aria-controls":u?v2:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:p,type:"button","data-testid":c7,children:t.jsx(L0,{})})}),t.jsx(t2,{id:`${v2}-menu`,anchorEl:c,open:u,onClose:f,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:t.jsx(a2,{"aria-labelledby":`${v2}-menu`,children:t.jsx(H1,{projectId:e,permission:I2,children:({hasAccess:b})=>t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:v,show:()=>t.jsxs(R1,{onClick:S,disabled:!b,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t.jsx(P1,{children:t.jsx(F0,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Mark as stale"})})]})}),t.jsx(C,{condition:g,show:()=>t.jsxs(R1,{onClick:x,disabled:!b,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t.jsx(P1,{children:t.jsx(F0,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},At=d("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),K4="manage-tags-form",J4=(e,a)=>[...e,...e.some(n=>n.value===a.value&&n.type===a.type)?[]:[a]],Y4=(e,a)=>e.filter(n=>!(n.value===a.value&&n.type===a.type)),kt=(e,a)=>{switch(a.type){case"add":return{...e,addedTags:J4(e.addedTags,a.payload),removedTags:Y4(e.removedTags,a.payload)};case"remove":return{...e,addedTags:Y4(e.addedTags,a.payload),removedTags:J4(e.removedTags,a.payload)};case"clear":return{addedTags:[],removedTags:a.payload};default:return e}},Q4={name:"",description:"",icon:""},Tt=({open:e,initialValues:a,initialIndeterminateValues:n,onCancel:c,onSubmit:s})=>{const{tagTypes:r,loading:o}=s7(),[i,h]=l.useState(Q4),[u,m]=l.useState([]),[p,f]=l.useState([]),{tags:g,refetch:v}=u9(i.name),{createTag:S}=W6(),x=g.map(({value:R})=>({title:R})),[b,w]=l.useReducer(kt,{addedTags:[],removedTags:[]}),E=(R=r.length>0?r[0]:Q4)=>{h(R);const F=n.filter(({type:B})=>B===R.name);m(a.filter(({type:B})=>B===R.name).filter(({type:B,value:I})=>!F.some(M=>M.value===I&&M.type===B)).map(({value:B})=>({title:B}))),f(F.map(({value:B})=>({title:B}))),w({type:"clear",payload:[]})};l.useEffect(()=>{r.length>0&&E()},[o]);const O=(R,F)=>{F!=null&&typeof F!="string"&&(R.preventDefault(),E(F))},k=(R,F)=>S({value:R,type:F}).then(async()=>{await v(),m(B=>[...B,{title:R}]),w({type:"add",payload:{value:R,type:F}})}),_=(R,F,B,I)=>{B==="selectOption"?F.forEach(M=>{if(typeof M!="string"&&typeof M.inputValue=="string"&&M.inputValue&&M.title.startsWith("Create new value"))return k(M.inputValue,i.name);m(F),f(H=>H.filter(({title:D})=>D!==M.title)),I!=null&&I.option&&w({type:"add",payload:{value:I.option.title,type:i.name}})}):B==="clear"?(m([]),w({type:"clear",payload:a})):B==="removeOption"&&(m(F),I!=null&&I.option&&w({type:"remove",payload:{value:I.option.title,type:i.name}}))},T=()=>{E(),c()};return t.jsxs(D1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature flag tags",onClick:()=>s(b),disabledPrimaryButton:b.addedTags.length===0&&b.removedTags.length===0,onClose:T,formId:K4,children:[t.jsx($,{paragraph:!0,sx:{marginBottom:R=>R.spacing(2.5)},children:"Tags allow you to group features together"}),t.jsx("form",{id:K4,onSubmit:()=>s(b),children:t.jsxs(At,{children:[t.jsx(p9,{options:r,disabled:o||r.length===0,value:i,onChange:O},o?"loading":r.length),t.jsx(C,{condition:!o&&r.length===0,show:t.jsxs($,{variant:"body1",children:["No"," ",t.jsx(o3,{component:Q,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t.jsx(m9,{disabled:o,options:x,existingTags:a,indeterminateOptions:p,tagType:i,selectedOptions:u,onChange:_})})]})})]})},Dt=({projectId:e,data:a,onChange:n})=>{const{bulkUpdateTags:c}=W6(),{setToastData:s,setToastApiError:r}=u1(),{trackEvent:o}=x1(),[i,h]=l.useState(!1),[u,m]=l.useMemo(()=>{const f=a.flatMap(({tags:v})=>v||[]).reduce((v,S)=>[...v,...v.some(x=>x.type===S.type&&x.value===S.value)?[]:[S]],[]),g=f.filter(v=>!a.every(({tags:S})=>S==null?void 0:S.some(x=>x.type===v.type&&x.value===v.value)));return[f,g]},[a]),p=async({addedTags:f,removedTags:g})=>{const v=a.map(({name:x})=>x),S={features:v,tags:{addedTags:f,removedTags:g}};try{await c(S,e);const x=f.length?`Added tags: ${f.map(({type:w,value:E})=>`${w}:${E}`).join(", ")}.`:"",b=g.length?`Removed tags: ${g.map(({type:w,value:E})=>`${w}:${E}`).join(", ")}.`:"";s({title:"Tags updated",text:`${v.length} feature flags updated. ${x} ${b}`,type:"success",autoHideDuration:12e3}),o("batch_operations",{props:{eventType:"tags updated"}})}catch(x){r(r1(x))}n==null||n(),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(H1,{projectId:e,permission:I2,children:({hasAccess:f})=>t.jsx(o1,{disabled:!f||i,variant:"outlined",size:"small",onClick:()=>h(!0),children:"Tags"})}),t.jsx(Tt,{open:i,onCancel:()=>h(!1),onSubmit:p,initialValues:u,initialIndeterminateValues:m},a.length)]})},Ft=d(C3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),X4=d(i1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Rt=({showExportDialog:e,data:a,onClose:n,onConfirm:c,environments:s,projectId:r})=>{const[o,i]=l.useState(s[0]),{bulkToggleFeaturesEnvironmentOff:h}=u6(),{addChange:u}=$2(),{setToastApiError:m,setToastData:p}=u1(),{isChangeRequestConfigured:f}=w3(r),{refetch:g}=V2(r),v=a.filter(w=>{var E,O;return((O=(E=w.environments)==null?void 0:E.find(k=>o===k.name))==null?void 0:O.enabled)===!1}).length,S=()=>s.map(w=>({key:w,label:w})),x=async()=>{try{f(o)?(await u(r,o,a.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!1}}))),g(),p({text:"Your disabled feature flags changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(r,a.map(w=>w.name),o),p({text:"Your feature flags have been disabled",type:"success",title:"Features disabled"})),n(),c==null||c()}catch(w){m(r1(w))}},b=f(o)?"Add to change request":"Disable flags";return t.jsx(D1,{open:e,title:"Disable feature flags",onClose:n,onClick:x,primaryButtonText:b,secondaryButtonText:"Cancel",children:t.jsxs(Z,{children:["You have selected ",t.jsx("b",{children:a.length})," feature flags to disable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx($,{children:"Select which environment to disable the features for:"}),t.jsx(Ft,{options:S(),value:o,onChange:w=>i(w)}),t.jsx(C,{condition:f(o),show:t.jsx(X4,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(C,{condition:v>0,show:t.jsxs(X4,{severity:"info",children:[v," feature"," ",v>1?"flags are ":"flag is ","already disabled."]})})]})})},Pt=d(C3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),e5=d(i1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),It=({showExportDialog:e,data:a,onClose:n,onConfirm:c,environments:s,projectId:r})=>{const[o,i]=l.useState(s[0]),{bulkToggleFeaturesEnvironmentOn:h}=u6(),{addChange:u}=$2(),{setToastApiError:m,setToastData:p}=u1(),{isChangeRequestConfigured:f}=w3(r),{refetch:g}=V2(r),v=a.filter(w=>{var E,O;return((O=(E=w.environments)==null?void 0:E.find(k=>o===k.name))==null?void 0:O.enabled)===!0}).length,S=()=>s.map(w=>({key:w,label:w})),x=async()=>{try{f(o)?(await u(r,o,a.map(w=>({action:"updateEnabled",feature:w.name,payload:{enabled:!0}}))),g(),p({text:"Your enable feature flags changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await h(r,a.map(w=>w.name),o),p({text:"Your feature flags have been enabled",type:"success",title:"Features enabled"})),n(),c==null||c()}catch(w){m(r1(w))}},b=f(o)?"Add to change request":"Enable flags";return t.jsx(D1,{open:e,title:"Enable feature flags",onClose:n,onClick:x,primaryButtonText:b,secondaryButtonText:"Cancel",children:t.jsxs(Z,{children:["You have selected ",t.jsx("b",{children:a.length})," feature flags to enable.",t.jsx("br",{}),t.jsx("br",{}),t.jsx($,{children:"Select which environment to enable the features for:"}),t.jsx(Pt,{options:S(),value:o,onChange:w=>i(w)}),t.jsx(C,{condition:f(o),show:t.jsx(e5,{severity:"warning",children:"Change requests are enabled for this environment."})}),t.jsx(C,{condition:v>0,show:t.jsxs(e5,{severity:"info",children:[v," feature"," ",v>1?"flags are ":"flag is ","already enabled."]})})]})})},$t=({selectedIds:e,data:a,projectId:n,onResetSelection:c,onChange:s})=>{var E,O;const{uiConfig:r}=X(),[o,i]=l.useState(!1),[h,u]=l.useState(!1),[m,p]=l.useState(!1),{trackEvent:f}=x1(),g=l.useMemo(()=>a.filter(k=>e.includes(k.name)),[a,e]),v=l.useMemo(()=>{const k=g.flatMap(_=>_.environments).map(_=>_==null?void 0:_.name).filter(_=>_!==void 0);return Array.from(new Set(k))},[g]),S=()=>{s==null||s(),f("batch_operations",{props:{eventType:"features exported"}})},x=()=>{s==null||s(),f("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{s==null||s(),f("batch_operations",{props:{eventType:"features disabled"}})},w=()=>{s==null||s(),c()};return t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!!((E=r==null?void 0:r.flags)!=null&&E.disableBulkToggle),show:null,elseShow:t.jsx(o1,{variant:"outlined",size:"small",onClick:()=>u(!0),children:"Enable"})}),t.jsx(C,{condition:!!((O=r==null?void 0:r.flags)!=null&&O.disableBulkToggle),show:null,elseShow:t.jsx(o1,{variant:"outlined",size:"small",onClick:()=>p(!0),children:"Disable"})}),t.jsx(_t,{projectId:n,featureIds:e,features:a,onConfirm:w}),t.jsx(o1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),t.jsx(Dt,{projectId:n,data:g,onChange:s}),t.jsx(Et,{projectId:n,data:g,onChange:s}),t.jsx(p6,{showExportDialog:o,data:g,onClose:()=>i(!1),environments:v,onConfirm:S}),t.jsx(It,{showExportDialog:h,data:g,onClose:()=>u(!1),environments:v,projectId:n,onConfirm:x}),t.jsx(Rt,{showExportDialog:m,data:g,onClose:()=>p(!1),environments:v,projectId:n,onConfirm:b})]})},Vt=d(H0)(()=>({whiteSpace:"nowrap"})),Ot=({isLoading:e,totalItems:a,searchQuery:n,onChangeSearchQuery:c,environmentsToExport:s,actions:r})=>{const o=q("projectId"),i=n2(e||!1),[h,u]=l.useState(!0),m=l1(),p=v1(m.breakpoints.down("md")),f=V1("featuresExportImport"),[g,v]=l.useState(!1),S=B1(),{trackEvent:x}=x1(),b=V1("projectOverviewRefactorFeedback"),{openFeedback:w}=r7("newProjectOverview","automatic"),E=k=>{c==null||c(k),x("search-bar",{props:{screen:"project",length:k.length}})},O=()=>{w({title:"How easy was it to work with the project overview in Unleash?",positiveLabel:"What do you like most about the updated project overview?",areasForImprovementsLabel:"What improvements are needed in the project overview?"})};return t.jsx(Z,{ref:i,"aria-busy":e,"aria-live":"polite",sx:k=>({padding:`${k.spacing(2.5)} ${k.spacing(3.125)}`}),children:t.jsx(t1,{titleElement:h?`Feature flags ${a!==void 0?`(${a})`:""}`:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!p,show:t.jsx(_1,{"data-loading":!0,placeholder:"Search and Filter",expandable:!0,initialValue:n||"",onChange:E,onFocus:()=>u(!1),onBlur:()=>u(!0),hasFilters:!0,id:"projectFeatureFlags"})}),r,t.jsx(t1.Divider,{sx:{marginLeft:0}}),t.jsx(C,{condition:f,show:t.jsxs(t.Fragment,{children:[t.jsx(Z1,{title:"Export all project flags",arrow:!0,children:t.jsx(j1,{"data-loading":!0,onClick:()=>v(!0),sx:k=>({marginRight:k.spacing(2)}),children:t.jsx(o7,{})})}),t.jsx(C,{condition:!e,show:t.jsx(p6,{showExportDialog:g,project:o,data:[],onClose:()=>v(!1),environments:s||[]})})]})}),t.jsx(C,{condition:b&&!p,show:t.jsx(o1,{startIcon:t.jsx(i7,{}),onClick:O,variant:"outlined","data-loading":!0,children:"Provide feedback"})}),t.jsx(Vt,{onClick:()=>S(l7(o)),maxWidth:"960px",Icon:c2,projectId:o,permission:N0,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature flag"})]}),children:t.jsx(C,{condition:p,show:t.jsx(_1,{initialValue:n||"",onChange:E,hasFilters:!0,id:"projectFeatureFlags"})})})})},Y6=d("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:a})=>({flexGrow:0,...Z3,justifyContent:"center",...a&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Bt=({value:e,featureId:a,projectId:n,environment:c,isChangeRequestEnabled:s,someEnabledEnvironmentHasVariants:r,refetch:o,onFeatureToggleSwitch:i})=>{const h=l.useMemo(()=>r&&(c==null?void 0:c.variantCount)===0&&(c==null?void 0:c.enabled),[r,c]),u=(m,p)=>{i(m,{projectId:n,featureId:a,environmentName:(c==null?void 0:c.name)||"",environmentType:c==null?void 0:c.type,hasStrategies:c==null?void 0:c.hasStrategies,hasEnabledStrategies:c==null?void 0:c.hasEnabledStrategies,isChangeRequestEnabled:s,onRollback:p,onSuccess:o})};return t.jsxs(Y6,{hasWarning:h,children:[t.jsx(v9,{projectId:n,value:e,featureId:a,environmentName:(c==null?void 0:c.name)||"",onToggle:u}),t.jsx(C,{condition:h||!1,show:t.jsx(g9,{})})]})},zt=Y1.memo(Bt),Mt=()=>t.jsx(Y6,{children:t.jsx("div",{"data-loading":!0,children:"toggle"})}),Lt=({state:e,onChange:a})=>{const{tags:n}=d7(),[c,s]=l.useState([]);return l.useEffect(()=>{const o=[{label:"Tags",icon:"label",options:(n||[]).map(i=>({label:`${i.type}:${i.value}`,value:`${i.type}:${i.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"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}];s(o)},[JSON.stringify(n)]),t.jsx(h7,{availableFilters:c,state:e,onChange:a})},g2=["select","actions","name","favorite"],f2=(e,a)=>e.reduce((n,c)=>({...n,[c]:a.includes(c)}),{}),Nt=e=>{const a=l1(),n=v1(a.breakpoints.down("sm")),c=v1(a.breakpoints.down("md")),s=v1(a.breakpoints.down("lg")),r=V1("featureLifecycle"),o=l.useCallback((i=0)=>e.filter(h=>h.startsWith("environment:")),[e]);return n?f2(e,[...g2,"createdAt"]):c?f2(e,[...g2,"createdAt",...o(1)]):s?f2(e,[...g2,"createdAt","type",...o(1)]):f2(e,[...g2,"lastSeenAt",...r?["lifecycle"]:[],"createdAt","type","tags",...o(3)])},qt=({query:e})=>{var a;return((a=e||"")==null?void 0:a.length)>0?t.jsx(Z,{sx:n=>({padding:n.spacing(3)}),children:t.jsxs(f1,{children:["No feature flags found matching “",e,"”"]})}):t.jsx(Z,{sx:n=>({padding:n.spacing(3)}),children:t.jsx(f1,{children:"No feature flags available."})})},Ht=(e,a)=>{const[n,c]=l.useState(),[s,r]=l.useState({}),[o,i]=l.useState({featureId:"default",open:!1});return{rowActionsDialogs:t.jsxs(t.Fragment,{children:[t.jsx(f9,{isStale:!!s.stale,isOpen:!!s.featureId,onClose:()=>{r({}),e()},featureId:s.featureId||"",projectId:a}),t.jsx(H6,{isOpen:!!n,onConfirm:e,onClose:()=>{c(void 0)},featureIds:[n||""],projectId:a}),t.jsx(x9,{isOpen:o.open,setIsOpen:u=>{i({...o,open:u})},projectId:a,featureId:o.featureId,onComplete:e})]}),setFeatureArchiveState:c,setFeatureStaleDialogState:r,setShowMarkCompletedDialogue:i}},Wt=(e,a)=>{const[n,c]=l.useState([]);return l.useEffect(()=>{c(s=>{const r=[...e];return s.forEach(o=>{r.find(i=>i.name===o.name)||r.push(o)}),r.filter(o=>a[o.name])})},[e,a]),n},Ut=d(Q)({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}}),y2=d("button")(({theme:e})=>({marginRight:e.spacing(.5),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallerBody,textOverflow:"ellipsis",overflow:"hidden",textWrap:"nowrap",maxWidth:"250px",padding:e.spacing(.25,.5),cursor:"pointer",background:"inherit",color:"inherit"})),Gt=({text:e,searchQuery:a})=>t.jsx(C,{condition:!!(e&&e.length>40),show:t.jsx(L1,{title:t.jsx($1,{search:a,children:e}),placement:"bottom-start",arrow:!0,children:t.jsx(O4,{children:t.jsx($1,{search:a,children:e})})}),elseShow:t.jsx(O4,{children:t.jsx($1,{search:a,children:e})})}),r0=({tag:e,children:a})=>t.jsx(C,{condition:e.length>30,show:t.jsx(L1,{title:e,children:a}),elseShow:a}),Kt=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(.5),margin:e.spacing(1.25,0,1,0),paddingLeft:e.spacing(2)})),Jt=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),color:e.palette.primary.dark})),Yt=d(Z)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(.25)})),Qt=d(g3)(({theme:e})=>({padding:e.spacing(.5),border:0,textTransform:"capitalize"})),Xt=({project:e,feature:a,searchQuery:n})=>t.jsx(Z,{sx:c=>({fontWeight:c.typography.fontWeightBold}),children:t.jsx(Ut,{to:`/projects/${e}/features/${a}`,children:t.jsx(u7,{style:{WebkitLineClamp:1,lineClamp:1},children:t.jsx($1,{search:n,children:a})})})}),ea=({tags:e,onClick:a})=>t.jsx(L1,{title:e.map(n=>t.jsx(Z,{sx:{cursor:"pointer"},onClick:()=>a(n),children:n},n)),children:t.jsxs(y2,{sx:{cursor:"initial"},children:[e.length," more..."]})}),ta=({tags:e,onClick:a})=>{const[n,c,s,...r]=(e||[]).map(({type:o,value:i})=>`${o}:${i}`);return t.jsxs(Yt,{children:[n&&t.jsx(r0,{tag:n,children:t.jsx(y2,{onClick:()=>a(n),children:n})}),c&&t.jsx(r0,{tag:c,children:t.jsx(y2,{onClick:()=>a(c),children:c})}),s&&t.jsx(r0,{tag:s,children:t.jsx(y2,{onClick:()=>a(s),children:s})}),t.jsx(C,{condition:r.length>0,show:t.jsx(ea,{tags:r,onClick:a})})]})},aa=d(Q)({display:"block"}),na=({feature:e,project:a})=>{const{feature:n}=p7(a,e),c=n.children,s=n.dependencies;if(c.length>0)return t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:"Children"}),c.map(r=>t.jsx(aa,{to:`/projects/${a}/features/${r}`,children:r},r))]});if(s[0]){const r=s[0].feature;return t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:"Parent"}),t.jsx(Q,{to:`/projects/${a}/features/${r}`,children:r})]})}return t.jsx(t.Fragment,{children:"Loading..."})},ca=({project:e,feature:a,type:n,searchQuery:c,dependencyType:s,onTypeClick:r,delay:o=500})=>{var f;const{featureTypes:i}=m6(),h=v6(n),m=`${((f=i.find(g=>g.id===n))==null?void 0:f.name)||n} flag`,p=()=>t.jsx(L1,{arrow:!0,title:m,describeChild:!0,children:t.jsx(j1,{sx:{p:0},"aria-label":`add ${n} flag to filter`,onClick:()=>r(n),children:t.jsx(h,{sx:g=>({fontSize:g.spacing(2)}),"data-testid":"feature-type-icon"})})});return t.jsxs(Jt,{"data-loading":!0,children:[t.jsx(p,{}),t.jsx(Xt,{project:e,feature:a,searchQuery:c}),t.jsx(C,{condition:!!s,show:t.jsx(L1,{title:t.jsx(na,{feature:a,project:e}),enterDelay:o,enterNextDelay:o,children:t.jsx(Qt,{color:s==="parent"?"warning":"secondary",children:s})})})]})},sa=({description:e,searchQuery:a})=>t.jsx(C,{condition:!!e,show:t.jsx(Z,{sx:n=>({display:"flex",gap:n.spacing(1)}),children:t.jsx(Gt,{text:e,searchQuery:a})})}),ra=(e,a)=>({row:n})=>{const{searchQuery:c}=_3();return t.jsxs(Kt,{children:[t.jsx(ca,{project:n.original.project||"",feature:n.original.name,searchQuery:c,type:n.original.type||"",dependencyType:n.original.dependencyType||"",onTypeClick:a}),t.jsx(sa,{description:n.original.description||"",searchQuery:c}),t.jsx(ta,{tags:n.original.tags,onClick:e})]})},Q6=(e,a="project-overview-v2",n=15*1e3)=>{const c={offset:q1(Z2,0),limit:q1(Z2,m7),query:f3,favoritesFirst:q1(v7,!0),sortBy:q1(f3,"createdAt"),sortOrder:q1(f3,"desc"),columns:g7,tag:n0,createdAt:n0,type:n0},[s,r]=g6(`${a}-${e}`,c),{columns:o,...i}=s,{features:h,total:u,refetch:m,loading:p,initialLoad:f}=f7(f6({...x6(c,i),project:`IS:${e}`},g=>g?`${g}`:void 0),{refreshInterval:n});return{features:h,total:u,refetch:m,loading:p,initialLoad:f,tableState:s,setTableState:r}},oa=(e,a)=>{const n=(r,o)=>{const i=e[r.key];i&&i.values.length>0&&!i.values.includes(o)?a({[r.key]:{operator:i.operator,values:[...i.values,o]}}):i||a({[r.key]:{operator:r.operator,values:[o]}})};return{onFlagTypeClick:r=>n({key:"type",operator:"IS"},r),onTagClick:r=>n({key:"tag",operator:"INCLUDE"},r)}},o0=e=>`environment:${e}`,J1=Z6(),ia=e=>e.name,la=({environments:e})=>{const a=q("projectId"),{features:n,total:c,refetch:s,loading:r,initialLoad:o,tableState:i,setTableState:h}=Q6(a),{onFlagTypeClick:u,onTagClick:m}=oa(i,h),p={tag:i.tag,createdAt:i.createdAt,type:i.type},{favorite:f,unfavorite:g}=x7(),v=l.useCallback(async y=>{y!=null&&y.favorite?await g(a,y.name):await f(a,y.name),s()},[a,s]),{isChangeRequestConfigured:S}=w3(a),{onToggle:x,modals:b}=j9(a),{rowActionsDialogs:w,setFeatureArchiveState:E,setFeatureStaleDialogState:O,setShowMarkCompletedDialogue:k}=Ht(s,a),_=!!(o||r&&c),T=V1("featureLifecycle"),R=l.useMemo(()=>[J1.display({id:"select",header:({table:y})=>t.jsx(B4,{title:"Select all rows",checked:y==null?void 0:y.getIsAllRowsSelected(),onChange:y==null?void 0:y.getToggleAllRowsSelectedHandler()}),cell:({row:y})=>t.jsx(B4,{title:"Select row",checked:y==null?void 0:y.getIsSelected(),onChange:y==null?void 0:y.getToggleSelectedHandler()}),meta:{width:"1%"},enableHiding:!1}),J1.accessor("favorite",{id:"favorite",header:()=>t.jsx(j7,{isActive:i.favoritesFirst,onClick:()=>h({favoritesFirst:!i.favoritesFirst})}),cell:({row:{original:y}})=>t.jsx(y7,{value:y==null?void 0:y.favorite,onClick:()=>v(y)}),enableSorting:!1,enableHiding:!1,meta:{align:"center",width:"1%"}}),J1.accessor("name",{id:"name",header:"Name",cell:ra(m,u),enableHiding:!1,meta:{width:"50%"}}),J1.accessor("createdAt",{id:"createdAt",header:"Created",cell:O2,meta:{width:"1%"}}),J1.accessor("lastSeenAt",{id:"lastSeenAt",header:"Last seen",cell:({row:{original:y}})=>t.jsx(b7,{feature:y,"data-loading":!0}),size:50,meta:{align:"center",width:"1%"}}),...T?[J1.accessor("lifecycle",{id:"lifecycle",header:"Lifecycle",cell:({row:{original:y}})=>t.jsx(Z7,{feature:y,onComplete:()=>{k({featureId:y.name,open:!0})},onUncomplete:s,onArchive:()=>E(y.name),"data-loading":!0}),enableSorting:!1,size:50,meta:{align:"center",width:"1%"}})]:[],...e.map(y=>{const z=S(y);return J1.accessor(L=>{var U,a1;return{featureId:L.name,environment:(U=L.environments)==null?void 0:U.find(s1=>s1.name===y),someEnabledEnvironmentHasVariants:((a1=L.environments)==null?void 0:a1.some(s1=>s1.variantCount&&s1.variantCount>0&&s1.enabled))||!1}},{id:o0(y),header:y,meta:{align:"center",width:90},cell:({getValue:L})=>{const{featureId:U,environment:a1,someEnabledEnvironmentHasVariants:s1}=L();return _?t.jsx(Mt,{}):t.jsx(zt,{value:(a1==null?void 0:a1.enabled)||!1,featureId:U,someEnabledEnvironmentHasVariants:s1,environment:a1,projectId:a,environmentName:y,isChangeRequestEnabled:z,refetch:s,onFeatureToggleSwitch:x})}})}),J1.display({id:"actions",header:"",cell:({row:y})=>t.jsx(ut,{row:y,projectId:a,onOpenArchiveDialog:E,onOpenStaleDialog:O}),enableSorting:!1,enableHiding:!1,meta:{align:"right",width:"1%"}})],[a,e,i.favoritesFirst,s,_,T]),F=l.useMemo(()=>Array(i.limit).fill(null).map((y,z)=>({id:z,type:"-",name:`Feature name ${z}`,createdAt:new Date().toISOString(),dependencyType:null,favorite:!1,impressionData:!1,project:"project",segments:[],stale:!1,environments:[{name:"development",enabled:!1,type:"development"},{name:"production",enabled:!1,type:"production"}]})),[i.limit]),B=n2(_),I=l.useMemo(()=>_?F:n,[_,JSON.stringify(n)]),M=l.useMemo(()=>R.map(y=>y.id).filter(Boolean),[R]),H=Nt(M),D=j6(y6(i,h,{columns:R,data:I,enableRowSelection:!0,state:{columnVisibility:H},getRowId:ia})),{columnVisibility:P,rowSelection:W}=D.getState(),j=l.useCallback(y=>{const z=P[y],L={...P,[y]:!z};h({columns:Object.keys(L).filter(U=>L[U]&&!U.includes(","))})},[P,h]),A=Wt(n,W);return t.jsxs(t.Fragment,{children:[t.jsx(d1,{disableLoading:!0,disablePadding:!0,header:t.jsx(Ot,{isLoading:o,totalItems:c,searchQuery:i.query||"",onChangeSearchQuery:y=>{h({query:y})},dataToExport:I,environmentsToExport:e,actions:t.jsx(St,{columns:[{header:"Name",id:"name",isVisible:P.name,isStatic:!0},{header:"Created",id:"createdAt",isVisible:P.createdAt},{header:"Last seen",id:"lastSeenAt",isVisible:P.lastSeenAt},...T?[{header:"Lifecycle",id:"lifecycle",isVisible:P.lifecycle}]:[],{id:"divider"},...e.map(y=>({header:y,id:o0(y),isVisible:P[o0(y)]}))],onToggle:j})}),bodyClass:"noop",style:{cursor:"inherit"},children:t.jsxs("div",{ref:B,"aria-busy":_,"aria-live":"polite",children:[t.jsx(Lt,{onChange:h,state:p}),t.jsx(r3,{value:i.query||"",children:t.jsx(b6,{tableInstance:D,totalItems:c})}),t.jsx(C,{condition:!I.length&&!_,show:t.jsx(qt,{query:i.query||""})}),w,b]})}),t.jsx(S7,{count:A.length,children:t.jsx($t,{selectedIds:Object.keys(W),data:A,projectId:a,onResetSelection:D.resetRowSelection,onChange:s})})]})},t5={applied:0,approved:0,rejected:0,scheduled:0,reviewRequired:0,total:0},X6=e=>{const{isEnterprise:a}=X(),{data:n,error:c,mutate:s}=B2(!!e&&a(),t5,g1(`api/admin/projects/${e}/change-requests/count`),da);return{data:n||t5,loading:!c&&!n,refetchChangeRequestConfig:s,error:c}},da=e=>fetch(e).then(S1("Request changes")).then(a=>a.json()),ha=d(Z)(({theme:e})=>({margin:"0",textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",padding:e.spacing(1,3.25),display:"flex",alignItems:"center",flexWrap:"wrap",gap:e.spacing(2),fontSize:e.fontSizes.smallBody})),e8=d(Z)(({theme:e})=>({borderRadius:"8px",padding:e.spacing(1,2),display:"flex",gap:e.spacing(2),justifyContent:"space-between",alignItems:"center",whiteSpace:"nowrap"})),ua=d(e8)(({theme:e})=>({background:e.palette.success.light})),pa=d(e8)(({theme:e})=>({background:e.palette.secondary.light})),a5=d($)(({theme:e})=>({fontSize:e.spacing(2),fontWeight:e.fontWeight.bold})),ma=({project:e})=>{const{isChangeRequestConfiguredInAnyEnv:a}=w3(e),{data:n}=X6(e);if(!a())return null;const c=n.scheduled+n.approved,s=n.reviewRequired;return t.jsxs(ha,{children:[t.jsx(Z,{children:"Open change requests"}),t.jsxs(ua,{children:[t.jsx("span",{children:"To be applied"}),t.jsx(a5,{children:c})]}),t.jsxs(pa,{children:[t.jsx("span",{children:"To be reviewed"}),t.jsx(a5,{children:s})]}),t.jsx(Q,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},va=e=>{const a=`api/admin/projects/${e}/sdks/outdated`,{data:n,refetch:c,loading:s,error:r}=S6(g1(a),()=>C6(g1(a),"Outdated SDKs"),{refreshInterval:60*1e3});return{data:n||{sdks:[]},refetch:c,error:r}},ga=d("ul")({margin:0}),fa=({project:e})=>{const{data:{sdks:a}}=va(e),{trackEvent:n}=x1(),c=o=>{n("sdk-banner",{props:{eventType:"banner application clicked",sdkVersion:o}})},s=()=>{n("sdk-banner",{props:{eventType:"banner clicked"}})},r={message:`We noticed that an outdated SDK version is connected to ${e} project.`,variant:"warning",link:"dialog",linkText:"Please update those versions",linkClicked:s,dialogTitle:"Outdated SDKs",dialog:t.jsx(t.Fragment,{children:a.map(o=>t.jsxs("div",{children:[t.jsx("span",{children:o.sdkVersion}),t.jsx(ga,{children:o.applications.map(i=>t.jsx("li",{onClick:()=>{c(o.sdkVersion)},onKeyDown:()=>{c(o.sdkVersion)},children:t.jsx(Q,{to:`/applications/${i}`,children:i})},i))})]},o.sdkVersion))})};return t.jsx(t.Fragment,{children:t.jsx(C,{condition:a.length>0,show:t.jsx(C7,{banner:r,inline:!0})})})},xa=15*1e3,ja=d("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),[e.breakpoints.down("md")]:{flexDirection:"column"}})),ya=d("div")(()=>({width:"100%",minWidth:0})),ba=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),width:"100%",minWidth:0})),Za=()=>{const e=q("projectId"),a=F1(e),n=V1("outdatedSdksBanner"),{project:c}=X1(e,{refreshInterval:xa});C1(`Project overview – ${a}`);const{setLastViewed:s}=w7();return l.useEffect(()=>{s(e)},[e,s]),t.jsx(ja,{children:t.jsxs(ba,{children:[t.jsx(ma,{project:e}),t.jsx(C,{condition:n,show:t.jsx(fa,{project:e})}),t.jsx(ya,{children:t.jsx(la,{environments:c.environments.map(r=>r.environment)})})]})},e)},Sa=(e,a)=>{const n=g1(`api/admin/projects/${e}/health-report`),{data:c,error:s}=s3(n,Ca,a),r=l.useCallback(()=>{w6(n).catch(console.warn)},[n]);return{healthReport:c,refetchHealthReport:r,loading:!s&&!c,error:s}},Ca=e=>fetch(e).then(S1("Health report")).then(a=>a.json());var s4={},wa=T1;Object.defineProperty(s4,"__esModule",{value:!0});var _2=s4.default=void 0,_a=wa(k1()),Ea=t,Aa=(0,_a.default)((0,Ea.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");_2=s4.default=Aa;const ka=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),n5=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Ta=d(U1)(({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)}})),i0=d("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1),justifyItems:"center",display:"flex"})),Da=d("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),Fa=d("p")(({theme:e})=>({color:e.palette.text.secondary})),c5=d("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),s5=d("p")(({theme:e})=>({marginLeft:e.spacing(4)})),Ra=({healthReport:e})=>{const a=e.health<50?"error.main":e.health<75?"warning.main":"success.main",n=()=>t.jsxs(ka,{children:[t.jsx(b3,{}),t.jsxs("span",{children:[e.activeCount," active flags"]})]}),c=()=>t.jsxs(n5,{children:[t.jsx(_2,{}),t.jsxs("span",{children:[e.staleCount," stale flags"]})]}),s=()=>t.jsxs(n5,{children:[t.jsx(_2,{}),t.jsxs("span",{children:[e.potentiallyStaleCount," potentially stale flags"]})]}),r=()=>t.jsx(L1,{title:t.jsxs(t.Fragment,{children:["If your flag exceeds the expected lifetime of its flag type it will be marked as potentially stale.",t.jsx(Z,{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(_7,{sx:{color:o=>o.palette.text.secondary,ml:1}})});return t.jsxs(Ta,{children:[t.jsxs(Z,{children:[t.jsx(i0,{children:"Health rating"}),t.jsx(C,{condition:e.health>-1,show:t.jsxs(t.Fragment,{children:[t.jsxs(Da,{sx:{color:a},children:[e.health,"%"]}),t.jsxs(Fa,{children:["Last updated:"," ",t.jsx(W0,{date:e.updatedAt,live:!1})]})]})})]}),t.jsxs(Z,{children:[t.jsx(i0,{children:"Flag report"}),t.jsxs(c5,{children:[t.jsx("li",{children:t.jsx(C,{condition:!!e.activeCount,show:n})}),t.jsx(C,{condition:!!e.activeCount,show:t.jsx(s5,{children:"Also includes potentially stale flags."})}),t.jsx("li",{children:t.jsx(C,{condition:!!e.staleCount,show:c})})]})]}),t.jsxs(Z,{sx:{flexBasis:"40%"},children:[t.jsxs(i0,{children:["Potential actions"," ",t.jsx("span",{children:t.jsx(r,{})})]}),t.jsx(c5,{children:t.jsx("li",{children:t.jsx(C,{condition:!!e.potentiallyStaleCount,show:s})})}),t.jsx(C,{condition:!!e.potentiallyStaleCount,show:t.jsxs(t.Fragment,{children:[t.jsx(s5,{children:"Review your feature flags and delete unused flags."}),t.jsx(Z,{sx:{mt:2},children:t.jsx(o3,{component:Q,to:"/feature-toggle-type",children:"Configure feature types lifetime"})})]}),elseShow:t.jsx("span",{children:"No action is required"})})]})]})},Pa=({row:e})=>t.jsx(E3,{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}),Ia=({row:e})=>{const a=l1();return e.original.expiredAt?t.jsx(O2,{value:e.original.expiredAt}):t.jsx(Y,{children:t.jsx($,{variant:"body2",color:a.palette.text.secondary,children:"N/A"})})},$a=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Va=d("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),Oa=({row:e})=>e.original.status==="potentially-stale"?t.jsx(Y,{children:t.jsxs($a,{children:[t.jsx(_2,{}),t.jsx("span",{children:"Potentially stale"})]})}):t.jsx(Y,{children:t.jsxs(Va,{children:[t.jsx(b3,{}),t.jsx("span",{children:"Healthy"})]})}),t8=(e,a)=>Math.abs(E7(e,a)),a8=(e,a)=>{var n;return a.lifetimeDays?e>=((n=a==null?void 0:a.lifetimeDays)==null?void 0:n.valueOf()):!1},Ba=(e,a)=>{const{type:n,createdAt:c}=e,s=a.find(h=>h.id===n),r=_6(c),i=t8(r,new Date);return s&&a8(i,s)&&n!==E6&&n!==A6?"potentially-stale":"healthy"},za=(e,a)=>{var h;const{type:n,createdAt:c}=e,s=a.find(u=>u.id===n);if(s&&(s.name===E6||s.name===A6))return;const r=_6(c),o=new Date,i=t8(r,o);if(s&&a8(i,s)){const u=i-(((h=s==null?void 0:s.lifetimeDays)==null?void 0:h.valueOf())||0);return A7(o,u).toISOString()}},Ma=({projectId:e,features:a})=>{const n=l1(),c=v1(n.breakpoints.down("sm")),s=v1(n.breakpoints.down("md")),r=v1(n.breakpoints.down("lg"));X();const{featureTypes:o}=m6(),i=l.useMemo(()=>a.map(b=>({project:e,name:b.name,type:b.type,stale:b.stale,environments:b.environments,status:Ba(b,o),lastSeenAt:b.lastSeenAt,createdAt:b.createdAt,expiredAt:za(b,o)})),[e,a,o]),h=l.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt",desc:!0}]}),[]),u=l.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({value:b,row:{original:w}})=>t.jsx(k7,{feature:w}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",align:"center",Cell:T7,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:Pa,minWidth:120},{Header:"Created",accessor:"createdAt",Cell:O2,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Ia,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:Oa,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:D7,disableGlobalFilter:!0,maxWidth:120}],[]),{headerGroups:m,rows:p,prepareRow:f,state:{globalFilter:g},setGlobalFilter:v,setHiddenColumns:S}=c1.useTable({columns:u,data:i,initialState:h,sortTypes:A3,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},c1.useGlobalFilter,c1.useFlexLayout,c1.useSortBy);k3([{condition:c,columns:["stale"]},{condition:s,columns:["expiredAt","lastSeenAt"]},{condition:r,columns:["createdAt"]}],S,u);const x=p.length<i.length?`Feature flags (${p.length} of ${i.length})`:`Feature flags (${i.length})`;return t.jsxs(d1,{header:t.jsx(t1,{title:x,actions:t.jsx(_1,{initialValue:g,onChange:v})}),children:[t.jsx(r3,{value:g,children:t.jsx(z2,{headerGroups:m,prepareRow:f,rows:p})}),t.jsx(C,{condition:p.length===0,show:t.jsx(C,{condition:(g==null?void 0:g.length)>0,show:t.jsxs(f1,{children:["No feature flags found matching “",g,"”"]}),elseShow:t.jsx(f1,{children:"No feature flags available. Get started by adding a new feature flag."})})})]})},La=()=>{const e=q("projectId"),a=F1(e);C1(`Project health – ${a}`);const{healthReport:n,refetchHealthReport:c,error:s}=Sa(e,{refreshInterval:15*1e3});return n?t.jsxs("div",{children:[t.jsx(C,{condition:!!s,show:t.jsx(i6,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:c,text:`Could not fetch health rating for ${e}`})}),t.jsx(Ra,{healthReport:n}),t.jsx(Ma,{projectId:e,features:n.features})]}):null},n8=({open:e,onClose:a,project:n,onSuccess:c})=>{const{deleteProject:s}=e3(),{refetch:r}=F7(),{setToastData:o,setToastApiError:i}=u1(),h=async u=>{u.preventDefault();try{await s(n),r(),o({title:"Deleted project",type:"success",text:"Successfully deleted project"}),c==null||c()}catch(m){i(r1(m))}a(u)};return t.jsx(D1,{open:e,onClick:h,onClose:a,title:"Really delete project"})},Na=d("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),qa=()=>{const e=q("projectId");return t.jsx(Na,{children:t.jsx(R7,{title:"Event Log",project:e,displayInline:!0})})},r4=(e,a)=>{const{data:n,error:c,mutate:s}=s3(g1(`api/admin/projects/${e}/change-requests/${a}`),Ha,{refreshInterval:15e3});return{data:n,loading:!c&&!n,refetchChangeRequest:()=>s(),error:c}},Ha=e=>fetch(e).then(S1("Request changes")).then(a=>a.json()),Wa=d(U1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));d(Z)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const Ua=d(Z)(({theme:e})=>({display:"flex",alignItems:"center"})),Ga=d($)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),Ka=d(P7)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),o4=d(s2)(({theme:e})=>({height:"24px",width:"24px"})),Ja=({changeRequest:e})=>{var c,s,r;const[a,n]=l.useState(e.title);return t.jsxs(Wa,{elevation:0,children:[t.jsx(I7,{environmentChangeRequest:e,title:a,setTitle:n,children:t.jsx(Ga,{variant:"h1",sx:{mr:1.5},children:a})}),t.jsxs(Ua,{children:[t.jsx(k6,{changeRequest:e}),t.jsxs($,{variant:"body2",sx:o=>({margin:o.spacing("auto",0,"auto",2)}),children:["Created"," ",t.jsx(W0,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),t.jsx(Z,{sx:o=>({marginLeft:o.spacing(1)}),children:t.jsx(Z1,{title:(c=e==null?void 0:e.createdBy)==null?void 0:c.username,children:t.jsx(o4,{src:(s=e==null?void 0:e.createdBy)==null?void 0:s.imageUrl})})}),t.jsx($,{variant:"body2",sx:o=>({marginLeft:o.spacing(.5)}),children:(r=e==null?void 0:e.createdBy)==null?void 0:r.username}),t.jsx(Z,{sx:o=>({marginLeft:o.spacing(1.5)}),children:t.jsx(Ka,{variant:"outlined",children:t.jsxs($,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",t.jsx($,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",t.jsx($7,{}),"Updates:",t.jsx(V7,{featuresCount:e.features.length,segmentsCount:e.segments.length})]})})})]})]})};function p1(){return p1=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},p1.apply(this,arguments)}function V3(e,a){if(e==null)return{};var n={},c=Object.keys(e),s,r;for(r=0;r<c.length;r++)s=c[r],!(a.indexOf(s)>=0)&&(n[s]=e[s]);return n}const Ya=l.createContext({}),E2=Ya,r5=e=>e,Qa=()=>{let e=r5;return{configure(a){e=a},generate(a){return e(a)},reset(){e=r5}}},Xa=Qa(),en={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function h3(e,a,n="Mui"){const c=en[a];return c?`${n}-${c}`:`${Xa.generate(e)}-${a}`}function u3(e,a,n="Mui"){const c={};return a.forEach(s=>{c[s]=h3(e,s,n)}),c}function tn(e){return h3("MuiTimeline",e)}u3("MuiTimeline",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]);function O3(e){return e==="alternate-reverse"?"positionAlternateReverse":`position${M2(e)}`}const an=["position","className"],nn=e=>{const{position:a,classes:n}=e,c={root:["root",a&&O3(a)]};return F3(c,tn,n)},cn=d("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,n.position&&a[O3(n.position)]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),sn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimeline"}),{position:s="right",className:r}=c,o=V3(c,an),i=p1({},c,{position:s}),h=nn(i),u=l.useMemo(()=>({position:s}),[s]);return t.jsx(E2.Provider,{value:u,children:t.jsx(cn,p1({className:D3(h.root,r),ownerState:i,ref:n},o))})}),c8=sn;function rn(e){return h3("MuiTimelineContent",e)}const on=u3("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),ln=["className"],dn=e=>{const{position:a,classes:n}=e,c={root:["root",O3(a)]};return F3(c,rn,n)},hn=d($,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,a[O3(n.position)]]}})(({ownerState:e})=>p1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),un=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineContent"}),{className:s}=c,r=V3(c,ln),{position:o}=l.useContext(E2),i=p1({},c,{position:o||"right"}),h=dn(i);return t.jsx(hn,p1({component:"div",className:D3(h.root,s),ownerState:i,ref:n},r))}),i4=un,pn=u3("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse"]),mn=pn;function vn(e){return h3("MuiTimelineItem",e)}const gn=u3("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","positionAlternateReverse","missingOppositeContent"]),s8=gn,fn=["position","className"],xn=e=>{const{position:a,classes:n,hasOppositeContent:c}=e,s={root:["root",O3(a),!c&&"missingOppositeContent"]};return F3(s,vn,n)},jn=d("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,a[O3(n.position)]]}})(({ownerState:e})=>p1({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",[`& .${on.root}`]:{textAlign:"right"},[`& .${mn.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&::before":{content:'""',flex:1,padding:"6px 16px"}})),yn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineItem"}),{position:s,className:r}=c,o=V3(c,fn),{position:i}=l.useContext(E2);let h=!1;l.Children.forEach(c.children,f=>{O7(f,["TimelineOppositeContent"])&&(h=!0)});const u=p1({},c,{position:s||i||"right",hasOppositeContent:h}),m=xn(u),p=l.useMemo(()=>({position:u.position}),[u.position]);return t.jsx(E2.Provider,{value:p,children:t.jsx(jn,p1({className:D3(m.root,r),ownerState:u,ref:n},o))})}),W3=yn;function bn(e){return h3("MuiTimelineSeparator",e)}u3("MuiTimelineSeparator",["root"]);const Zn=["className"],Sn=e=>{const{classes:a}=e;return F3({root:["root"]},bn,a)},Cn=d("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,a)=>a.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),wn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineSeparator"}),{className:s}=c,r=V3(c,Zn),o=c,i=Sn(o);return t.jsx(Cn,p1({className:D3(i.root,s),ownerState:o,ref:n},r))}),U3=wn;function _n(e){return h3("MuiTimelineDot",e)}u3("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const En=["className","color","variant"],An=e=>{const{color:a,variant:n,classes:c}=e,s={root:["root",n,a!=="inherit"&&`${n}${M2(a)}`]};return F3(s,_n,c)},kn=d("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,a)=>{const{ownerState:n}=e;return[a.root,a[n.color!=="inherit"&&`${n.variant}${M2(n.color)}`],a[n.variant]]}})(({ownerState:e,theme:a})=>p1({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"&&p1({borderColor:"transparent"},e.color!=="inherit"&&p1({},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"&&p1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&p1({},e.color==="grey"?{borderColor:(a.vars||a).palette.grey[400]}:{borderColor:(a.vars||a).palette[e.color].main})))),Tn=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineDot"}),{className:s,color:r="grey",variant:o="filled"}=c,i=V3(c,En),h=p1({},c,{color:r,variant:o}),u=An(h);return t.jsx(kn,p1({className:D3(u.root,s),ownerState:h,ref:n},i))}),l4=Tn;function Dn(e){return h3("MuiTimelineConnector",e)}u3("MuiTimelineConnector",["root"]);const Fn=["className"],Rn=e=>{const{classes:a}=e;return F3({root:["root"]},Dn,a)},Pn=d("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,a)=>a.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),In=l.forwardRef(function(a,n){const c=T3({props:a,name:"MuiTimelineConnector"}),{className:s}=c,r=V3(c,Fn),o=c,i=Rn(o);return t.jsx(Pn,p1({className:D3(i.root,s),ownerState:o,ref:n},r))}),d4=In,$n=d(U1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),Vn=d(Z)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),On=d(Z)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"flex-end"})),Bn=d(c8)(()=>({[`& .${s8.root}:before`]:{flex:0,padding:0}})),zn=["Draft","In review","Approved","Applied"],Mn=["Draft","In review","Rejected"],Ln=["Draft","In review","Approved","Scheduled","Applied"],Nn=(e,a,n,c)=>e==="Cancelled"?"grey":e==="Rejected"?n==="Rejected"?"error":"success":a!==-1&&a>=c?"success":a+1===c?"primary":"grey",qn=({state:e,schedule:a})=>{let n;switch(e){case"Rejected":n=Mn;break;case"Scheduled":n=Ln;break;default:n=zn}const c=n.findIndex(s=>s===e);return t.jsx($n,{elevation:0,children:t.jsx(Vn,{children:t.jsx(Bn,{children:n.map((s,r)=>{if(a&&s==="Scheduled")return Un(a);const o=Nn(e,c,s,r);let i={};return c+1===r&&!(e==="Cancelled"&&s==="Draft")&&(i={variant:"outlined"}),Hn(o,s,r<n.length-1,i)})})})})},Hn=(e,a,n,c={})=>t.jsxs(W3,{children:[t.jsxs(U3,{children:[t.jsx(l4,{color:e,...c}),n&&t.jsx(d4,{})]}),t.jsx(i4,{children:a})]},a),Wn=(e,a)=>{switch(e.status){case"suspended":return{title:"Schedule suspended",subtitle:`was ${a}`,color:"grey",reason:t.jsx(L1,{title:e.reason,arrow:!0,children:t.jsx(S2,{color:"disabled",fontSize:"small"})})};case"failed":return{title:"Schedule failed",subtitle:`at ${a}`,color:"error",reason:t.jsx(L1,{title:`Schedule failed because of ${e.reason||e.failureReason}`,arrow:!0,children:t.jsx(S2,{color:"error",fontSize:"small"})})};default:return{title:"Scheduled",subtitle:`for ${a}`,color:"warning",reason:null}}},Un=e=>{const{locationSettings:a}=R3(),n=P3(new Date(e.scheduledAt),a==null?void 0:a.locale),{title:c,subtitle:s,color:r,reason:o}=Wn(e,n);return t.jsxs(W3,{children:[t.jsxs(U3,{children:[t.jsx(l4,{color:r}),t.jsx(d4,{})]}),t.jsxs(i4,{children:[c,t.jsxs(On,{children:[t.jsx($,{color:"text.secondary",sx:{mr:1},children:`(${s})`}),o]})]})]},c)};var h4={},Gn=T1;Object.defineProperty(h4,"__esModule",{value:!0});var r8=h4.default=void 0,Kn=Gn(k1()),o5=t,Jn=(0,Kn.default)([(0,o5.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"),(0,o5.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"Schedule");r8=h4.default=Jn;const u4=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",O1=d(Z)(({theme:e})=>({display:"flex",alignItems:"center"})),o8=d(U0)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),i5=d(U0)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),A2=d(T6)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Yn=d(r8)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Qn=d(S2)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Xn=d(B7)(({theme:e})=>({color:e.palette.text.secondary,height:"35px",width:"35px",marginRight:e.spacing(1)})),ec=d(r2)(({theme:e})=>({color:e.palette.text.secondary,height:"24px",width:"24px"})),tc=d(Z)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),ac=d(Z,{shouldForwardProp:u4()})(({theme:e,bgColor:a,svgColor:n})=>({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:n}})),p4=d(S3)(({theme:e})=>({margin:e.spacing(2.5,0)})),nc=d(Z,{shouldForwardProp:u4()})(({theme:e,border:a})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:a,padding:e.spacing(3),width:"100%"})),E1=d($,{shouldForwardProp:u4()})(({theme:e,color:a})=>({fontWeight:"bold",color:a})),cc=d(Z)({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}),q2=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,sc=(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}`,rc=(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},oc=({changeRequest:e,onEditClick:a})=>{const n=l1();return t.jsxs(tc,{children:[t.jsx(ac,{...rc(e.state,n),children:t.jsx(z7,{style:{transform:"scale(1.5)"}})}),t.jsx(nc,{sx:{backgroundColor:e.state==="In review"?n.palette.warning.light:"initial"},border:sc(e.state,n),children:t.jsx(ic,{changeRequest:e,onEditClick:a})})]})},ic=({changeRequest:e,onEditClick:a})=>{const{state:n}=e;if(!n)return null;if(n==="Approved")return t.jsx(lc,{});if(n==="Applied")return t.jsx(hc,{});if(n==="Cancelled")return t.jsx(fc,{});if(n==="Rejected")return t.jsx(xc,{});if(n==="Scheduled"){const{schedule:c}=e;return t.jsx(pc,{schedule:c,onEditClick:a})}return t.jsx(dc,{minApprovals:e.minApprovals})},lc=()=>{const e=l1();return t.jsxs(t.Fragment,{children:[t.jsxs(O1,{children:[t.jsx(A2,{}),t.jsxs(Z,{children:[t.jsx(E1,{color:e.palette.success.dark,children:"Changes approved"}),t.jsx($,{children:"One approving review from requested approvers"})]})]}),t.jsx(p4,{}),t.jsxs(O1,{children:[t.jsx(A2,{}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},dc=({minApprovals:e})=>{const a=l1();return t.jsxs(t.Fragment,{children:[t.jsxs(O1,{children:[t.jsx(i5,{}),t.jsxs(Z,{children:[t.jsx(E1,{color:a.palette.warning.dark,children:"Review required"}),t.jsxs($,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),t.jsx(p4,{}),t.jsxs(O1,{children:[t.jsx(i5,{}),t.jsx(E1,{color:a.palette.warning.dark,children:"Apply changes is blocked"})]})]})},hc=()=>{const e=l1();return t.jsx(t.Fragment,{children:t.jsxs(O1,{children:[t.jsx(A2,{sx:{color:e.palette.primary.main}}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.primary.main,children:"Changes applied"})})]})})},uc=d(j1)({maxWidth:"32px",maxHeight:"32px"}),pc=({schedule:e,onEditClick:a})=>{const n=l1();if(!e)return null;const c=(()=>{switch(e.status){case"pending":return t.jsx(gc,{schedule:e});case"failed":return t.jsx(mc,{schedule:e});case"suspended":return t.jsx(vc,{schedule:e});default:return null}})();return t.jsxs(t.Fragment,{children:[t.jsxs(O1,{children:[t.jsx(A2,{}),t.jsxs(Z,{children:[t.jsx(E1,{color:n.palette.success.dark,children:"Changes approved"}),t.jsx($,{children:"One approving review from requested approvers"})]})]}),t.jsx(p4,{}),t.jsxs(cc,{children:[c,t.jsx(uc,{onClick:a,children:t.jsx(ec,{})})]})]})},mc=({schedule:e})=>{const a=l1(),n=q2(),{locationSettings:c}=R3(),s=P3(new Date(e==null?void 0:e.scheduledAt),c==null?void 0:c.locale);return t.jsxs(O1,{children:[t.jsx(Qn,{}),t.jsxs(Z,{children:[t.jsxs(E1,{color:a.palette.error.main,children:["Changes failed to be applied on ",s," because of"," ",e.reason??e.failureReason]}),t.jsxs($,{children:["Your timezone is ",n]})]})]})},vc=({schedule:e})=>{const a=l1(),n=q2(),{locationSettings:c}=R3(),s=P3(new Date(e==null?void 0:e.scheduledAt),c==null?void 0:c.locale);return t.jsxs(O1,{children:[t.jsx(Xn,{}),t.jsxs(Z,{children:[t.jsxs(E1,{color:a.palette.text.secondary,children:["The change request is suspended for the following reason:"," ",e.reason]}),t.jsxs(E1,{color:a.palette.text.secondary,children:["It will not be applied on ",s,"."]}),t.jsxs($,{children:["Your timezone is ",n]})]})]})},gc=({schedule:e})=>{const a=l1(),n=q2(),{locationSettings:c}=R3(),s=P3(new Date(e==null?void 0:e.scheduledAt),c==null?void 0:c.locale);return t.jsxs(O1,{children:[t.jsx(Yn,{}),t.jsxs(Z,{children:[t.jsxs(E1,{color:a.palette.warning.dark,children:["Changes are scheduled to be applied on: ",s]}),t.jsxs($,{children:["Your timezone is ",n]})]})]})},fc=()=>{const e=l1();return t.jsx(t.Fragment,{children:t.jsxs(O1,{children:[t.jsx(o8,{}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.error.main,children:"Changes cancelled"})})]})})},xc=()=>{const e=l1();return t.jsx(t.Fragment,{children:t.jsxs(O1,{children:[t.jsx(o8,{}),t.jsx(Z,{children:t.jsx(E1,{color:e.palette.error.main,children:"Changes rejected"})})]})})},i8=({disabled:e,children:a,actions:n,permission:c,projectId:s,ariaLabel:r,environmentId:o})=>{const[i,h]=Y1.useState(!1),u=Y1.useRef(null),m=()=>{h(g=>!g)},p=g=>{var v;(v=u.current)!=null&&v.contains(g.target)||h(!1)},f=u.current?u.current.offsetWidth:null;return t.jsxs(Y1.Fragment,{children:[t.jsx(i3,{variant:"contained",disabled:e,"aria-controls":i?"review-options-menu":void 0,"aria-expanded":i?"true":void 0,"aria-label":r,"aria-haspopup":"menu",onClick:m,ref:u,endIcon:t.jsx(M7,{}),permission:c,projectId:s,environmentId:o,children:a}),t.jsx(D6,{sx:{zIndex:1,width:f},open:i,anchorEl:u.current,transition:!0,disablePortal:!0,children:({TransitionProps:g,placement:v})=>t.jsx(L7,{...g,style:{transformOrigin:v==="bottom"?"center top":"center bottom"},children:t.jsx(U1,{className:"dropdown-outline",children:t.jsx(F6,{onClickAway:p,children:t.jsx(a2,{id:"review-options-menu",autoFocusItem:!0,children:n.map(({label:S,onSelect:x,icon:b})=>t.jsxs(R1,{disabled:e,onClick:x,children:[t.jsx(P1,{children:b}),t.jsx(I1,{children:S})]},`MenuItem-${S}`))})})})})})]})},jc=({disabled:e,onReject:a,onApprove:n,children:c})=>{const{isAdmin:s}=l.useContext(G1),r=q("projectId"),o=q("id"),{user:i}=R6(),{data:h}=r4(r,o),u=(h==null?void 0:h.createdBy.id)===(i==null?void 0:i.id),m=e||u&&!s;return t.jsx(i8,{permission:N7,disabled:m,actions:[{label:"Approve",onSelect:n,icon:t.jsx(b3,{fontSize:"small"})},{label:"Reject",onSelect:a,icon:t.jsx(q7,{fontSize:"small"})}],environmentId:h==null?void 0:h.environment,projectId:r,ariaLabel:"review or reject changes",children:c})};var l8={},m4={},v4={};Object.defineProperty(v4,"__esModule",{value:!0});var yc=l,bc=Zc(yc);function Zc(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a.default=e,a}v4.default=function(e,a,n){return bc.createElement("a",{href:e,key:n},a)};var g4={};Object.defineProperty(g4,"__esModule",{value:!0});g4.default=function(e){return e};var f4={},l0,l5;function Sc(){return l5||(l5=1,l0=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),l0}var d0,d5;function Cc(){return d5||(d5=1,d0=/[\0-\x1F\x7F-\x9F]/),d0}var h0,h5;function wc(){return h5||(h5=1,h0=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),h0}var u0,u5;function _c(){return u5||(u5=1,u0=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/),u0}var p0,p5;function Ec(){return p5||(p5=1,p0=function(e){var a={};a.src_Any=Sc().source,a.src_Cc=Cc().source,a.src_Z=wc().source,a.src_P=_c().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 n="[><|]";return a.src_pseudo_letter="(?:(?!"+n+"|"+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="(?=$|"+n+"|"+a.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+a.src_ZPCc+"))",a.src_path="(?:[/?#](?:(?!"+a.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+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="(^|"+n+'|"|\\(|'+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}),p0}function R0(e){var a=Array.prototype.slice.call(arguments,1);return a.forEach(function(n){n&&Object.keys(n).forEach(function(c){e[c]=n[c]})}),e}function H2(e){return Object.prototype.toString.call(e)}function Ac(e){return H2(e)==="[object String]"}function kc(e){return H2(e)==="[object Object]"}function Tc(e){return H2(e)==="[object RegExp]"}function m5(e){return H2(e)==="[object Function]"}function Dc(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var d8={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Fc(e){return Object.keys(e||{}).reduce(function(a,n){return a||d8.hasOwnProperty(n)},!1)}var Rc={"http:":{validate:function(e,a,n){var c=e.slice(a);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(c)?c.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,a,n){var c=e.slice(a);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(c)?a>=3&&e[a-3]===":"||a>=3&&e[a-3]==="/"?0:c.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,a,n){var c=e.slice(a);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(c)?c.match(n.re.mailto)[0].length:0}}},Pc="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]",Ic="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 Vc(e){return function(a,n){var c=a.slice(n);return e.test(c)?c.match(e)[0].length:0}}function v5(){return function(e,a){a.normalize(e)}}function k2(e){var a=e.re=Ec()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(Pc),n.push(a.src_xn),a.src_tlds=n.join("|");function c(i){return i.replace("%TLDS%",a.src_tlds)}a.email_fuzzy=RegExp(c(a.tpl_email_fuzzy),"i"),a.link_fuzzy=RegExp(c(a.tpl_link_fuzzy),"i"),a.link_no_ip_fuzzy=RegExp(c(a.tpl_link_no_ip_fuzzy),"i"),a.host_fuzzy_test=RegExp(c(a.tpl_host_fuzzy_test),"i");var s=[];e.__compiled__={};function r(i,h){throw new Error('(LinkifyIt) Invalid schema "'+i+'": '+h)}Object.keys(e.__schemas__).forEach(function(i){var h=e.__schemas__[i];if(h!==null){var u={validate:null,link:null};if(e.__compiled__[i]=u,kc(h)){Tc(h.validate)?u.validate=Vc(h.validate):m5(h.validate)?u.validate=h.validate:r(i,h),m5(h.normalize)?u.normalize=h.normalize:h.normalize?r(i,h):u.normalize=v5();return}if(Ac(h)){s.push(i);return}r(i,h)}}),s.forEach(function(i){e.__compiled__[e.__schemas__[i]]&&(e.__compiled__[i].validate=e.__compiled__[e.__schemas__[i]].validate,e.__compiled__[i].normalize=e.__compiled__[e.__schemas__[i]].normalize)}),e.__compiled__[""]={validate:null,normalize:v5()};var o=Object.keys(e.__compiled__).filter(function(i){return i.length>0&&e.__compiled__[i]}).map(Dc).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+o+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+a.src_ZPCc+"))("+o+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),$c(e)}function Oc(e,a){var n=e.__index__,c=e.__last_index__,s=e.__text_cache__.slice(n,c);this.schema=e.__schema__.toLowerCase(),this.index=n+a,this.lastIndex=c+a,this.raw=s,this.text=s,this.url=s}function g5(e,a){var n=new Oc(e,a);return e.__compiled__[n.schema].normalize(n,e),n}function A1(e,a){if(!(this instanceof A1))return new A1(e,a);a||Fc(e)&&(a=e,e={}),this.__opts__=R0({},d8,a),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=R0({},Rc,e),this.__compiled__={},this.__tlds__=Ic,this.__tlds_replaced__=!1,this.re={},k2(this)}A1.prototype.add=function(a,n){return this.__schemas__[a]=n,k2(this),this};A1.prototype.set=function(a){return this.__opts__=R0(this.__opts__,a),this};A1.prototype.test=function(a){if(this.__text_cache__=a,this.__index__=-1,!a.length)return!1;var n,c,s,r,o,i,h,u,m;if(this.re.schema_test.test(a)){for(h=this.re.schema_search,h.lastIndex=0;(n=h.exec(a))!==null;)if(r=this.testSchemaAt(a,n[2],h.lastIndex),r){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=a.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u<this.__index__)&&(c=a.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=c.index+c[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=c.index+c[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(m=a.indexOf("@"),m>=0&&(s=a.match(this.re.email_fuzzy))!==null&&(o=s.index+s[1].length,i=s.index+s[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&i>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=i))),this.__index__>=0};A1.prototype.pretest=function(a){return this.re.pretest.test(a)};A1.prototype.testSchemaAt=function(a,n,c){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(a,c,this):0};A1.prototype.match=function(a){var n=0,c=[];this.__index__>=0&&this.__text_cache__===a&&(c.push(g5(this,n)),n=this.__last_index__);for(var s=n?a.slice(n):a;this.test(s);)c.push(g5(this,n)),s=s.slice(this.__last_index__),n+=this.__last_index__;return c.length?c:null};A1.prototype.tlds=function(a,n){return a=Array.isArray(a)?a:[a],n?(this.__tlds__=this.__tlds__.concat(a).sort().filter(function(c,s,r){return c!==r[s-1]}).reverse(),k2(this),this):(this.__tlds__=a.slice(),this.__tlds_replaced__=!0,k2(this),this)};A1.prototype.normalize=function(a){a.schema||(a.url="http://"+a.url),a.schema==="mailto:"&&!/^mailto:/i.test(a.url)&&(a.url="mailto:"+a.url)};A1.prototype.onCompile=function(){};var Bc=A1;const zc=["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(f4,"__esModule",{value:!0});var Mc=Bc,Lc=h8(Mc),Nc=zc,qc=h8(Nc);function h8(e){return e&&e.__esModule?e:{default:e}}var u8=new Lc.default;u8.tlds(qc.default);f4.default=function(e){return u8.match(e)};var x4={};Object.defineProperty(x4,"__esModule",{value:!0});x4.default=function(e){return e};Object.defineProperty(m4,"__esModule",{value:!0});var Hc=function(){function e(a,n){for(var c=0;c<n.length;c++){var s=n[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(a,s.key,s)}}return function(a,n,c){return n&&e(a.prototype,n),c&&e(a,c),a}}(),Wc=l,q3=ts(Wc),Uc=v4,Gc=W2(Uc),Kc=g4,Jc=W2(Kc),Yc=f4,Qc=W2(Yc),Xc=x4,es=W2(Xc);function W2(e){return e&&e.__esModule?e:{default:e}}function ts(e){if(e&&e.__esModule)return e;var a={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a.default=e,a}function as(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function ns(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 cs(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 p8=function(e){cs(a,e);function a(){return as(this,a),ns(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return Hc(a,[{key:"parseString",value:function(c){var s=this;if(c==="")return c;var r=this.props.matchDecorator(c);if(!r)return c;var o=[],i=0;return r.forEach(function(h,u){h.index>i&&o.push(c.substring(i,h.index));var m=s.props.hrefDecorator(h.url),p=s.props.textDecorator(h.text),f=s.props.componentDecorator(m,p,u);o.push(f),i=h.lastIndex}),c.length>i&&o.push(c.substring(i)),o.length===1?o[0]:o}},{key:"parse",value:function(c){var s=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof c=="string"?this.parseString(c):q3.isValidElement(c)&&c.type!=="a"&&c.type!=="button"?q3.cloneElement(c,{key:r},this.parse(c.props.children)):Array.isArray(c)?c.map(function(o,i){return s.parse(o,i)}):c}},{key:"render",value:function(){return q3.createElement(q3.Fragment,null,this.parse(this.props.children))}}]),a}(q3.Component);p8.defaultProps={componentDecorator:Gc.default,hrefDecorator:Jc.default,matchDecorator:Qc.default,textDecorator:es.default};m4.default=p8;Object.defineProperty(l8,"__esModule",{value:!0});var ss=m4,rs=os(ss);function os(e){return e&&e.__esModule?e:{default:e}}var is=l8.default=rs.default;const ls=d(Z)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),ds=d(U1)(({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})),hs=d(Z)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),us=({comment:e})=>t.jsxs(ls,{children:[t.jsx(Z1,{title:e.createdBy.username,children:t.jsx(H7,{src:e.createdBy.imageUrl})}),t.jsxs(ds,{variant:"outlined",children:[t.jsx(hs,{children:t.jsxs(Z,{children:[t.jsx("strong",{children:e.createdBy.username})," ",t.jsxs($,{color:"text.secondary",component:"span",children:["commented"," ",t.jsx(W0,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),t.jsx(Z,{sx:{paddingTop:2.5},children:t.jsx(is,{children:e.text})})]})]}),m8=d(Z)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),ps=d(T6)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),ms=d(U0)(({theme:e})=>({color:e.palette.error.main,marginLeft:"auto"})),v8=d($)({maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"text.primary"}),vs=({name:e,imageUrl:a})=>t.jsxs(m8,{children:[t.jsx(o4,{src:a}),t.jsx(v8,{variant:"body1",children:e}),t.jsx(ps,{})]}),gs=({name:e,imageUrl:a})=>t.jsxs(m8,{children:[t.jsx(o4,{src:a}),t.jsx(v8,{variant:"body1",children:e}),t.jsx(ms,{})]}),fs=({rejections:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx($,{variant:"body1",color:"text.secondary",children:"Rejected by"}),e.map(a=>t.jsx(gs,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),xs=({approvals:e=[]})=>t.jsxs(t.Fragment,{children:[t.jsx($,{variant:"body1",color:"text.secondary",children:t.jsx(C,{condition:(e==null?void 0:e.length)>0,show:"Approved by",elseShow:"No approvals yet"})}),e.map(a=>t.jsx(vs,{name:a.createdBy.username||"Unknown user",imageUrl:a.createdBy.imageUrl},a.createdBy.username))]}),js=d(Z)(({theme:e})=>({marginBottom:e.spacing(2)})),ys=({actualApprovals:e,minApprovals:a})=>t.jsxs(t.Fragment,{children:["Reviewers"," ",t.jsxs($,{component:"span",color:"text.secondary",children:["(",e,"/",a," required)"]})]}),bs=({header:e,children:a})=>t.jsxs(U1,{elevation:0,sx:n=>({marginTop:n.spacing(2),padding:n.spacing(4),borderRadius:c=>`${c.shape.borderRadiusLarge}px`}),children:[t.jsx(js,{children:e}),a]}),Zs=({changeRequest:e})=>t.jsx(bs,{header:t.jsx(ys,{actualApprovals:e.approvals.length,minApprovals:e.minApprovals}),children:t.jsx(C,{condition:e.state==="Rejected",show:t.jsx(fs,{rejections:e.rejections}),elseShow:t.jsx(xs,{approvals:e.approvals})})}),Ss=({open:e,onConfirm:a,onClose:n,disabled:c=!1})=>{const[s,r]=l.useState("");return t.jsxs(D1,{open:e,primaryButtonText:"Reject changes",secondaryButtonText:"Cancel",onClick:()=>a(s),disabledPrimaryButton:c,onClose:n,title:"Reject changes",fullWidth:!0,children:[t.jsx(Z,{children:"Add an optional comment why you reject those changes"}),t.jsx(t3,{sx:{mt:1},variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:o=>r(o.target.value),value:s})]})};var j4={},Cs=T1;Object.defineProperty(j4,"__esModule",{value:!0});var g8=j4.default=void 0,ws=Cs(k1()),_s=t,Es=(0,ws.default)((0,_s.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");g8=j4.default=Es;const f5=({disabled:e,onSchedule:a,onApply:n,variant:c="create",children:s})=>{const r=q("projectId"),o=q("id"),{data:i}=r4(r,o);return t.jsx(i8,{permission:G0,disabled:e,actions:[{label:"Apply changes",onSelect:n,icon:t.jsx(b3,{fontSize:"small"})},{label:c==="create"?"Schedule changes":"Update schedule",onSelect:a,icon:t.jsx(g8,{fontSize:"small"})}],environmentId:i==null?void 0:i.environment,projectId:r,ariaLabel:"apply or schedule changes",children:s})},As=d(i1)(({theme:e})=>({marginBottom:e.spacing(2),backgroundColor:`${e.palette.neutral.light}!important`,color:`${e.palette.text.primary}!important`,borderColor:`${e.palette.neutral.light}!important`})),f8=({open:e,onConfirm:a,onClose:n,title:c,primaryButtonText:s,disabled:r,message:o,scheduledTime:i,permissionButton:h})=>i?t.jsxs(D1,{title:c,primaryButtonText:s,disabledPrimaryButton:r,secondaryButtonText:"Cancel",open:e,onClose:n,onClick:()=>a(),permissionButton:h,fullWidth:!0,children:[t.jsxs(As,{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($,{variant:"body1",children:o})]}):null,ks=({projectId:e,environment:a,disabled:n,onConfirm:c,...s})=>t.jsx(f8,{message:"Applying the changes now means the scheduled time will be ignored",title:"Apply changes",primaryButtonText:"Apply changes now",onConfirm:c,permissionButton:t.jsx(i3,{variant:"contained",onClick:()=>c(),projectId:e,permission:G0,environmentId:a,disabled:n,children:"Apply changes now"}),...s}),Ts=({...e})=>t.jsx(f8,{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}),Ds=d(Z)(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(2)})),Fs=({open:e,onConfirm:a,onClose:n,title:c,primaryButtonText:s,projectId:r,environment:o,disabled:i,scheduledAt:h})=>{const[u,m]=l.useState(h?new Date(h):new Date),[p,f]=l.useState(void 0),g=q2();return t.jsxs(D1,{title:c,primaryButtonText:s,disabledPrimaryButton:i,secondaryButtonText:"Cancel",open:e,onClose:()=>n(),onClick:()=>a(u),permissionButton:t.jsx(i3,{variant:"contained",onClick:()=>a(u),projectId:r,permission:G0,environmentId:o,disabled:i,children:s}),fullWidth:!0,children:[t.jsx(i1,{severity:"info",sx:{mb:v=>v.spacing(2)},children:"The time shown below is based on your browser's time zone."}),t.jsx($,{variant:"body1",sx:{mb:v=>v.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(Ds,{children:[t.jsx(W7,{label:"Date",value:u,onChange:v=>{f(void 0),v<new Date&&f(`The time you provided (${v.toLocaleString()}) is not valid because it's in the past. Please select a time in the future.`),m(v)},min:new Date,error:!!p,errorText:p,required:!0}),t.jsxs($,{variant:"body2",children:["Your browser's time zone is ",g]})]})]})},Rs=d(Z)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),Ps=d(U1)(({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%"}})),Is=d(Z)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),$s=d(Z)(({theme:e})=>({padding:e.spacing(2)})),x5=d(o1)(({theme:e})=>({marginLeft:e.spacing(2)})),Vs=d(Z)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Os=()=>{var M3,a3;const e=q("projectId"),[a,n]=l.useState(!1),[c,s]=l.useState(!1),[r,o]=l.useState(!1),[i,h]=l.useState(!1),[u,m]=l.useState(!1),{user:p}=R6(),{isAdmin:f}=l.useContext(G1),[g,v]=l.useState(""),S=q("id"),{data:x,refetchChangeRequest:b}=r4(e,S),{changeState:w,addComment:E}=$2(),{refetch:O}=V2(e),{setToastData:k,setToastApiError:_}=u1(),{isChangeRequestConfiguredForReview:T}=w3(e),[R,F]=l.useState(!1);if(!x)return null;const B=T(x.environment),I=()=>{switch(x.state){case"Scheduled":return`${x.state} ${x.schedule.status}`;default:return x.state}},M=async()=>{try{F(!0),await w(e,Number(S),I(),{state:"Applied"}),h(!1),await b(),O(),k({type:"success",title:"Success",text:"Changes applied"})}catch(e1){_(r1(e1))}finally{F(!1)}},H=async e1=>{try{F(!0),await w(e,Number(S),I(),{state:"Scheduled",scheduledAt:e1.toISOString()}),o(!1),b(),O(),k({type:"success",title:"Success",text:"Changes scheduled"})}catch(z1){_(r1(z1))}finally{F(!1)}},D=async()=>{try{F(!0),await E(e,S,g),v(""),await b(),k({type:"success",title:"Success",text:"Comment added"})}catch(e1){_(r1(e1))}finally{F(!1)}},P=async()=>{try{F(!0),await w(e,Number(S),I(),{state:"Cancelled"}),n(!1),await b(),O(),k({type:"success",title:"Success",text:"Changes cancelled"})}catch(e1){_(r1(e1))}finally{F(!1)}},W=async e1=>{try{F(!0),await w(e,Number(S),I(),{state:"Rejected",comment:e1}),s(!1),await b(),k({type:"success",title:"Success",text:"Changes rejected"}),O()}catch(z1){_(r1(z1))}finally{F(!1)}},j=async()=>{try{F(!0),await w(e,Number(S),I(),{state:"Approved"}),await b(),O(),k({type:"success",title:"Success",text:"Changes approved"})}catch(e1){_(r1(e1))}finally{F(!1)}},A=()=>n(!0),y=()=>n(!1),z=()=>s(!1),L=()=>h(!1),U=()=>o(!1),a1=()=>m(!1),s1=(x==null?void 0:x.createdBy.id)===(p==null?void 0:p.id)&&x.state==="In review"&&!f,K1=(M3=x.approvals)==null?void 0:M3.some(e1=>e1.createdBy.id===(p==null?void 0:p.id)),w1=U7(x);(()=>{if("schedule"in x)switch(x.schedule.status){case"failed":return(x.schedule.reason||x.schedule.failureReason)??void 0;case"suspended":return x.schedule.reason;default:return}})();const N1="schedule"in x?x.schedule.scheduledAt:void 0,p3=x.state==="Scheduled"?{state:"Scheduled",schedule:x.schedule}:{state:x.state,schedule:void 0};return t.jsxs(t.Fragment,{children:[t.jsx(Ja,{changeRequest:x}),t.jsxs(Vs,{children:[t.jsxs(Rs,{children:[t.jsx(qn,{...p3}),t.jsx(Zs,{changeRequest:x})]}),t.jsx(Ps,{elevation:0,children:t.jsxs($s,{children:["Requested Changes (",w1,")",t.jsx(G7,{changeRequest:x,onRefetch:b}),(a3=x.comments)==null?void 0:a3.map(e1=>t.jsx(us,{comment:e1},e1.id)),t.jsx(K7,{user:p,commentText:g,onTypeComment:v,children:t.jsx(o1,{variant:"outlined",onClick:D,disabled:!B||g.trim().length===0||g.trim().length>1e3||R,children:"Comment"})}),t.jsx(C,{condition:s1,show:t.jsx(i1,{sx:e1=>({marginTop:e1.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),t.jsx(oc,{changeRequest:x,onEditClick:()=>o(!0)}),t.jsxs(Is,{children:[t.jsx(C,{condition:x.state==="In review"&&!K1,show:t.jsxs(jc,{onReject:()=>s(!0),onApprove:j,disabled:!B||R,children:["Review changes (",w1,")"]})}),t.jsx(C,{condition:x.state==="Approved",show:t.jsx(f5,{onApply:M,disabled:!B||R,onSchedule:()=>o(!0),children:"Apply or schedule changes"})}),t.jsx(C,{condition:x.state==="Scheduled",show:t.jsx(f5,{onApply:()=>h(!0),disabled:!B||R,onSchedule:()=>o(!0),variant:"update",children:"Apply or schedule changes"})}),t.jsx(C,{condition:x.state!=="Applied"&&x.state!=="Rejected"&&x.state!=="Cancelled"&&(x.createdBy.id===(p==null?void 0:p.id)||f),show:t.jsx(C,{condition:!!N1,show:t.jsx(x5,{variant:"outlined",onClick:()=>m(!0),disabled:R,children:"Reject changes"}),elseShow:t.jsx(x5,{variant:"outlined",onClick:A,disabled:R,children:"Cancel changes"})})})]})]})}),t.jsxs(D1,{open:a,onClick:P,onClose:y,title:"Cancel change request",children:[t.jsx($,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),t.jsx($,{variant:"body2",sx:e1=>({color:e1.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(Ss,{open:c,onConfirm:W,onClose:z,disabled:R}),t.jsxs(t.Fragment,{children:[t.jsx(Fs,{open:r,onConfirm:H,onClose:U,disabled:!B||R,projectId:e,environment:x.environment,primaryButtonText:x.state==="Scheduled"?"Update scheduled time":"Schedule changes",title:x.state==="Scheduled"?"Update schedule":"Schedule changes",scheduledAt:N1}),t.jsx(ks,{open:i,onConfirm:M,onClose:L,scheduledTime:N1,disabled:!B||R,projectId:e,environment:x.environment}),t.jsx(Ts,{open:u,onConfirm:W,onClose:a1,scheduledTime:N1,disabled:R})]})]})]})},Bs=({value:e,row:{original:a}})=>{const n=()=>e?t.jsx(k6,{changeRequest:a}):null;return e?t.jsx(Y,{children:n()}):t.jsx(Y,{})},zs=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),Ms=({value:e})=>{const{searchQuery:a}=_3();return t.jsx(Y,{children:t.jsx(zs,{children:t.jsxs($,{component:"span",variant:"body2",children:[" ",t.jsx($1,{search:a,children:e==null?void 0:e.username})]})})})},Ls=d("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),Ns=({value:e,row:{original:a}})=>{const{searchQuery:n}=_3(),c=q("projectId"),{id:s,title:r,features:o,segments:i}=a,h=(o||[]).length+(i||[]).length,u=`/projects/${c}/change-requests/${s}`;return e?t.jsxs(Y,{sx:{minWidth:"200px"},children:[t.jsx(Ls,{children:t.jsx($,{variant:"body2",children:t.jsx(o3,{component:Q,underline:"hover",to:u,sx:m=>({paddingTop:m.spacing(.2),marginRight:m.spacing(1),"&:hover":{textDecoration:"underline"}}),children:t.jsx($1,{search:n,children:r})})})}),t.jsxs("span",{children:[`${h}`," ",h<=1?"update":"updates"]})]}):t.jsx(Y,{})},qs=J7()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(2,4,4,4),overflowX:"auto"}})),Hs=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),Ws=d(Q)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Us=d(Q)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Gs=d(Z)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),Ks=({value:e,project:a})=>{const{searchQuery:n}=_3(),c=e==null?void 0:e.map(s=>s.name);return t.jsx(Hs,{children:t.jsx(C,{condition:(c==null?void 0:c.length)<3,show:c==null?void 0:c.map(s=>t.jsx(Ws,{title:s,to:`/projects/${a}/features/${s}`,children:t.jsx($1,{search:n,children:s})},s)),elseShow:t.jsxs(I3,{tooltipProps:{maxWidth:"800px"},tooltip:t.jsx(Gs,{children:c==null?void 0:c.map(s=>t.jsx(Us,{title:s,to:`/projects/${a}/features/${s}`,children:t.jsx($1,{search:n,children:s})},s))}),children:[c==null?void 0:c.length," toggles"]})})})},Js={id:"createdAt",desc:!0},Ys=d("div")({paddingLeft:0,paddingBottom:0}),Qs=d(b2)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),Xs=d(Z)(({theme:e})=>({textAlign:"right",paddingBottom:e.spacing(2),fontSize:e.fontSizes.smallBody})),er=({changeRequests:e=[],loading:a,projectId:n})=>{var H,D;const{classes:c}=qs(),s=v1(G3.breakpoints.down("md")),[r,o]=P6(),[i,h]=l.useState(r.get("search")||""),{value:u,setValue:m}=M0(`${n}:ProjectChangeRequest`,Js),[p,f]=l.useMemo(()=>{const P=e.filter(j=>j.state!=="Cancelled"&&j.state!=="Rejected"&&j.state!=="Applied"),W=e.filter(j=>j.state==="Cancelled"||j.state==="Rejected"||j.state==="Applied");return[P,W]},[e]),g=[{title:"Change requests",data:p},{title:"Closed",data:f}],[v,S]=l.useState(0),x=l.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:Ns},{id:"Updated feature flags",Header:"Updated feature flags",canSort:!1,accessor:"features",searchable:!0,filterName:"feature",filterParsing:P=>(P==null?void 0:P.map(({name:W})=>W).join(`
2
2
  `))||"",filterBy:(P,W)=>P.features.find(j=>W.map(A=>A.toLowerCase()).includes(j.name.toLowerCase())),Cell:({value:P,row:{original:{title:W}}})=>t.jsx(Ks,{project:n,value:P},W)},{Header:"By",accessor:"createdBy",maxWidth:180,canSort:!1,Cell:Ms,align:"left",searchable:!0,filterName:"by",filterParsing:P=>(P==null?void 0:P.username)||""},{Header:"Submitted",accessor:"createdAt",maxWidth:100,Cell:C2},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:P2,filterName:"environment"},{Header:"Status",accessor:"state",searchable:!0,maxWidth:"170px",Cell:Bs,filterName:"status"}],[n]),{data:b,getSearchText:w,getSearchContext:E}=K0(x,i,(H=g[v])==null?void 0:H.data),O=l.useMemo(()=>a?Y7:b,[b,a]),[k]=l.useState(()=>({sortBy:[{id:r.get("sort")||u.id,desc:r.has("order")?r.get("order")==="desc":u.desc}],hiddenColumns:[]})),{headerGroups:_,rows:T,state:{sortBy:R},prepareRow:F,setHiddenColumns:B,getTableProps:I,getTableBodyProps:M}=c1.useTable({columns:x,data:O,initialState:k,sortTypes:A3,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:Y}},c1.useSortBy);return k3([{condition:s,columns:["createdBy"]}],B,x),l.useEffect(()=>{if(a)return;const P={};P.sort=R[0].id,R[0].desc&&(P.order="desc"),i&&(P.search=i),o(P,{replace:!0}),m(W=>({...W,id:R[0].id,desc:R[0].desc||!1}))},[a,R,i,o]),t.jsxs(d1,{isLoading:a,bodyClass:c.bodyClass,headerClass:c.header,header:t.jsx(t1,{titleElement:t.jsx(Ys,{children:t.jsx(J0,{value:(D=g[v])==null?void 0:D.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:g.map((P,W)=>t.jsx(Qs,{label:`${P.title} (${P.data.length})`,value:P.title,onClick:()=>S(W)},P.title))})}),actions:t.jsx(_1,{placeholder:"Search and Filter",expandable:!0,initialValue:i,onChange:h,hasFilters:!0,getSearchContext:E,id:"changeRequestList"})}),children:[t.jsx(Xs,{children:t.jsx(Q,{to:`/projects/${n}/settings/change-requests`,children:"Change request configuration"})}),t.jsx(r3,{value:w(i),children:t.jsxs(J3,{...I(),children:[t.jsx(Y3,{headerGroups:_}),t.jsx(Q3,{...M(),children:T.map(P=>(F(P),t.jsx(X3,{hover:!0,...P.getRowProps(),children:P.cells.map(W=>t.jsx(e2,{...W.getCellProps(),padding:"none",children:W.render("Cell")}))})))})]})}),t.jsx(C,{condition:T.length===0,show:()=>t.jsx(C,{condition:(i==null?void 0:i.length)>0,show:t.jsxs(f1,{children:["No changes found matching “",i,"”"]}),elseShow:t.jsx(f1,{children:"None of the changes were submitted yet."})})})]})},tr=e=>fetch(e).then(S1("ChangeRequest")).then(a=>a.json()),ar=e=>{const{data:a,error:n,mutate:c}=Q7([],g1(`api/admin/projects/${e}/change-requests`),tr);return l.useMemo(()=>({changeRequests:a,loading:!n&&!a,refetch:c,error:n}),[a,n,c])},nr=()=>{const e=q("projectId"),a=F1(e),{isOss:n,isPro:c}=X();C1(`Change requests – ${a}`);const{changeRequests:s,loading:r}=ar(e);return n()||c()?t.jsx(d1,{sx:{justifyContent:"center"},children:t.jsx(l3,{feature:"change-requests"})}):t.jsx(er,{changeRequests:s,projectId:e,loading:r})};var G=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(G||{});const l2=(e,a={})=>{const n=g1(`api/admin/projects/${e}/access`),c=()=>fetch(n,{method:"GET"}).then(S1("project access")).then(p=>p.json()),s=`api/admin/projects/${e}/users`,{data:r,error:o}=s3(s,c,a),[i,h]=l.useState(!o&&!r),u=()=>{w6(s)};return l.useEffect(()=>{h(!o&&!r)},[r,o]),{access:l.useMemo(()=>{if(r)return cr({roles:r.roles,users:r.users.filter(({accountType:p})=>!p||p==="User"),serviceAccounts:r.users.filter(({accountType:p})=>p==="Service Account"),groups:(r==null?void 0:r.groups.map(p=>({...p,users:b9(p.users??[])})))??[]})},[r]),error:o,loading:i,refetchProjectAccess:u}},cr=e=>{const a=e.users||[],n=e.serviceAccounts||[],c=e.groups||[];return{...e,rows:[...a.map(s=>({entity:s,type:"USERS"})),...n.map(s=>({entity:s,type:"SERVICE ACCOUNTS"})),...c.map(s=>({entity:s,type:"GROUPS"}))]}},sr=d(d1)(({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`})),rr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{display:"flex",alignItems:"center",color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),j5={id:"joinedAt",desc:!0},m0=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>t.jsx(Y,{children:t.jsx(Y0,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:({value:e,row:{original:a}})=>t.jsx(P2,{value:e,subtitle:a.email||a.username}),minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:O2,maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>t.jsx(C2,{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}],or=["imageUrl","name","joined","lastLogin"],ir=({open:e,setOpen:a,group:n,projectId:c,subtitle:s,onEdit:r,onRemove:o})=>{const i=l1(),h=v1(i.breakpoints.down("md")),[u]=l.useState(()=>({sortBy:[{id:j5.id,desc:j5.desc}],hiddenColumns:["Username","Email"]})),[m,p]=l.useState(""),{data:f,getSearchText:g,getSearchContext:v}=K0(m0,m,(n==null?void 0:n.users)??[]),{headerGroups:S,rows:x,prepareRow:b,setHiddenColumns:w}=c1.useTable({columns:m0,data:f,initialState:u,sortTypes:A3,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},c1.useSortBy,c1.useFlexLayout);return k3([{condition:h,columns:or}],w,m0),t.jsx(W1,{open:e,onClose:()=>{a(!1)},label:(n==null?void 0:n.name)||"Group",children:t.jsxs(sr,{header:t.jsx(t1,{secondary:!0,titleElement:t.jsxs(rr,{children:[n==null?void 0:n.name," (",x.length<f.length?`${x.length} of ${f.length}`:f.length,")",t.jsx("span",{children:s})]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!h,show:t.jsxs(t.Fragment,{children:[t.jsx(_1,{initialValue:m,onChange:p,hasFilters:!0,getSearchContext:v}),t.jsx(t1.Divider,{})]})}),t.jsx(x3,{permission:b1,projectId:c,tooltipProps:{title:"Edit group access"},onClick:r,children:t.jsx(r2,{})}),t.jsx(x3,{permission:b1,projectId:c,tooltipProps:{title:"Remove group access"},onClick:o,children:t.jsx(o2,{})})]}),children:t.jsx(C,{condition:h,show:t.jsx(_1,{initialValue:m,onChange:p,hasFilters:!0,getSearchContext:v})})}),children:[t.jsx(r3,{value:g(m),children:t.jsx(z2,{rows:x,headerGroups:S,prepareRow:b})}),t.jsx(C,{condition:x.length===0,show:t.jsx(C,{condition:(m==null?void 0:m.length)>0,show:t.jsxs(f1,{children:["No users found matching “",m,"” in this group."]}),elseShow:t.jsx(f1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},lr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),dr=({roles:e,value:a,setValue:n,required:c,...s})=>{const r=(o,i,h)=>t.jsxs("li",{...o,children:[t.jsx(q0,{icon:t.jsx(I6,{fontSize:"small"}),checkedIcon:t.jsx($6,{fontSize:"small"}),style:{marginRight:8},checked:h.selected}),t.jsxs(lr,{children:[t.jsx("span",{children:i.name}),t.jsx("span",{children:i.description})]})]});return t.jsxs(t.Fragment,{children:[t.jsx(i2,{multiple:!0,disableCloseOnSelect:!0,openOnFocus:!0,size:"small",value:a,onChange:(o,i)=>n(i),options:e,renderOption:r,getOptionLabel:o=>o.name,renderInput:o=>t.jsx(t3,{...o,label:"Role",required:c}),...s}),t.jsx(C,{condition:a.length>0,show:()=>a.map(({id:o})=>t.jsx(X7,{sx:{marginTop:1},roleId:o},o))})]})},hr=d("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),y5=d("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),b5=d("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),ur=d("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),pr=d(o1)(({theme:e})=>({marginLeft:e.spacing(3)})),mr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),vr=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),y4=({selected:e,accesses:a,users:n,serviceAccounts:c,groups:s,roles:r,userRoles:o})=>{const{uiConfig:i}=X(),{flags:h}=i,u=h.UG?"user / group":"user",m=q("projectId"),{refetchProjectAccess:p}=l2(m),{addAccessToProject:f,setUserRoles:g,setGroupRoles:v,loading:S}=e3(),x=!!e,{setToastData:b,setToastApiError:w}=u1(),E=B1(),O=[...s.filter(j=>x||!a.some(({entity:{id:A},type:y})=>j.id===A&&y===G.GROUP)).map(j=>({id:j.id,entity:j,type:G.GROUP})),...n.filter(j=>x||!a.some(({entity:{id:A},type:y})=>j.id===A&&y===G.USER)).sort((j,A)=>{const y=j.name||j.username||"",z=A.name||A.username||"";return y.localeCompare(z)}).map(j=>({id:j.id,entity:j,type:G.USER})),...c.filter(j=>x||!a.some(({entity:{id:A},type:y})=>j.id===A&&y===G.SERVICE_ACCOUNT)).sort((j,A)=>{const y=j.name||j.username||"",z=A.name||A.username||"";return y.localeCompare(z)}).map(j=>({id:j.id,entity:j,type:G.SERVICE_ACCOUNT}))],[k,_]=l.useState(()=>O.filter(({id:j,type:A})=>j===(e==null?void 0:e.entity.id)&&A===(e==null?void 0:e.type))),[T,R]=l.useState(r.filter(({id:j})=>{var A,y;return(y=(A=e==null?void 0:e.entity)==null?void 0:A.roles)==null?void 0:y.includes(j)})),F={roles:T.map(({id:j})=>j),groups:k==null?void 0:k.filter(({type:j})=>j===G.GROUP).map(({id:j})=>j),users:k==null?void 0:k.filter(({type:j})=>j===G.USER||j===G.SERVICE_ACCOUNT).map(({id:j})=>j)},B=async j=>{if(j.preventDefault(),!!D)try{x?(e==null?void 0:e.type)===G.USER||(e==null?void 0:e.type)===G.SERVICE_ACCOUNT?await g(m,T.map(({id:A})=>A),e.entity.id):(e==null?void 0:e.type)===G.GROUP&&await v(m,T.map(({id:A})=>A),e.entity.id):await f(m,F),p(),E(Q1),b({title:`${k.length} ${k.length===1?"access":"accesses"} ${x?"edited":"assigned"} successfully`,type:"success"})}catch(A){w(r1(A))}},I=()=>x?`curl --location --request PUT '${i.unleashUrl}/api/admin/projects/${m}/${(e==null?void 0:e.type)===G.USER||(e==null?void 0:e.type)===G.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' \\
@@ -17,7 +17,7 @@ The flag name should contain the project name, the feature name, and the ticket
17
17
  --header 'Authorization: INSERT_API_KEY' \\
18
18
  --header 'Content-Type: application/json' \\
19
19
  --data-raw '${JSON.stringify(b(),void 0,2)}'`,B=async I=>{I.preventDefault();const M=b();if(O())try{await _(a,M),R(),c({title:"Project information updated",type:"success"}),m!==Ee&&o("project_stickiness_set")}catch(D){s(r1(D))}};return t.jsx(xo,{children:t.jsx(d3,{loading:T,title:"General settings",description:"Projects allows you to group feature flags together in the management UI.",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:F,compactPadding:!0,compact:!0,children:t.jsx(jo,{children:t.jsx(I9,{errors:k,handleSubmit:B,projectId:i,setProjectId:g,projectName:h,setProjectName:v,projectStickiness:m,setProjectStickiness:x,setFeatureLimit:f,featureLimit:p,projectDesc:u,setProjectDesc:S,mode:"Edit",clearErrors:w,validateProjectId:E,children:t.jsx(i3,{type:"submit",permission:[b1,z6],projectId:i,"data-testid":yo,children:"Save changes"})})})})})},Zo={actions:[]},U2=e=>{const{isEnterprise:a}=X(),n=V1("automatedActions"),{data:c,error:s,mutate:r}=B2(a()&&n,Zo,g1(`api/admin/projects/${e}/actions`),So);return l.useMemo(()=>({actions:(c==null?void 0:c.actions)??[],loading:!s&&!c,refetch:()=>r(),error:s}),[c,s,r])},So=e=>fetch(e).then(S1("Actions")).then(a=>a.json()),Co=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",borderTop:`1px solid ${e.palette.divider}`,paddingTop:e.spacing(4),gap:e.spacing(2)})),wo=d("div")(({theme:e})=>({display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(3)})),_o=({projectId:e,featureCount:a})=>{const{isEnterprise:n}=X(),c=V1("automatedActions"),{actions:s}=U2(e),[r,o]=l.useState(!1),i=B1();return t.jsxs(Co,{children:[t.jsx("p",{children:"Before you can delete a project, you must first archive all the feature flags associated with it. Keep in mind that deleting a project will permanently remove all the archived feature flags, and they cannot be recovered once deleted."}),t.jsx(C,{condition:n()&&c,show:t.jsx("p",{children:"Additionally, all configured actions for this project will no longer be executed as they will be permanently deleted."})}),t.jsxs("p",{children:["Currently there are"," ",t.jsxs("strong",{children:[a," feature flags active"]})]}),t.jsx(C,{condition:n()&&c,show:t.jsxs("p",{children:["Currently there are"," ",t.jsxs("strong",{children:[s.filter(({enabled:h})=>h).length," ","enabled actions"]})]})}),t.jsx(wo,{children:t.jsx(i3,{permission:Ae,disabled:a>0,projectId:e,onClick:()=>{o(!0)},tooltipProps:{title:"Delete project"},"data-loading":!0,children:"Delete project"})}),t.jsx(n8,{project:e,open:r,onClose:()=>{o(!1)},onSuccess:()=>{i("/projects")}})]})},Eo=d("div")(({theme:e})=>({borderRadius:e.spacing(2),overflow:"hidden"})),Ao=({featureCount:e})=>{const a=q("projectId"),{uiConfig:n}=X(),{loading:c}=e3(),s=()=>`curl --location --request DELETE '${n.unleashUrl}/api/admin/projects/${a}' \\
20
- --header 'Authorization: INSERT_API_KEY' '`;return t.jsx(Eo,{children:t.jsx(d3,{loading:c,title:"Delete project",description:"",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:s,compact:!0,compactPadding:!0,showDescription:!1,showLink:!1,children:t.jsx(_o,{projectId:a,featureCount:e})})})},ko=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),To=()=>{const{isEnterprise:e}=X(),{hasAccess:a}=l.useContext(G1),n=q("projectId"),{project:c}=X1(n);if(!c.name)return null;const s=!a([b1,z6],n)&&t.jsx(i1,{severity:"error",sx:{mb:4},children:"You do not have the required permissions to edit this project."});return t.jsxs(t.Fragment,{children:[s,t.jsxs(ko,{children:[t.jsx(bo,{project:c}),t.jsx(C,{condition:e(),show:t.jsx(fo,{project:c})}),t.jsx(Ao,{featureCount:ke(c)})]})]})},Do=()=>{const e=q("projectId"),a=F1(e),{hasAccess:n}=l.useContext(G1),{isOss:c}=X();return C1(`Project configuration – ${a}`),c()?t.jsx(d1,{header:t.jsx(t1,{title:"General settings"}),sx:{justifyContent:"center"},children:t.jsx(l3,{feature:"project-settings"})}):n([b1,Te],e)?t.jsx(To,{}):t.jsx(d1,{header:t.jsx(t1,{title:"General settings"}),children:t.jsx(i1,{severity:"error",children:"You need project owner permissions to access this section."})})},b8=e=>{const{loading:a,makeRequest:n,createRequest:c,errors:s}=L2({propagateErrors:!0}),r=`api/admin/projects/${e}/actions`,o=async f=>{const v=c(r,{method:"POST",body:JSON.stringify(f)},"addActionSet");return(await n(v.caller,v.id)).json()},i=async(f,g)=>{const S=c(`${r}/${f}`,{method:"PUT",body:JSON.stringify(g)},"updateActionSet");await n(S.caller,S.id)},h=async f=>{const v=c(`${r}/${f}/on`,{method:"POST"},"enableActionSet");await n(v.caller,v.id)},u=async f=>{const v=c(`${r}/${f}/off`,{method:"POST"},"disableActionSet");await n(v.caller,v.id)};return{addActionSet:o,updateActionSet:i,removeActionSet:async f=>{const v=c(`${r}/${f}`,{method:"DELETE"},"removeActionSet");await n(v.caller,v.id)},toggleActionSet:async(f,g)=>{g?await h(f):await u(f)},errors:s,loading:a}},Fo=d(Z)({display:"flex",alignItems:"center"}),Ro=d(s2)(({theme:e})=>({background:"transparent",borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(3),height:e.spacing(3),fontSize:e.fontSizes.mainHeader})),Po=d(o3)(({theme:e})=>({...De(e),"&:hover, &:focus":{textDecoration:"underline"}})),Io=({action:e,signalEndpoints:a})=>{const{sourceId:n,source:c}=e.match;if(c==="signal-endpoint"){const s=a.find(({id:r})=>r===n);if(s)return t.jsx(Y,{children:t.jsxs(Fo,{children:[t.jsx(L1,{title:"Signal endpoint",arrow:!0,children:t.jsx(Ro,{src:Fe(Re),alt:"Signal endpoint",variant:"rounded"})}),t.jsx(Po,{component:Q,to:"/integrations/signals",underline:"hover",children:s.name})]})})}return t.jsx(Y,{children:"No source"})},$o=e=>Vo[e],Vo={IN:"is one of",NOT_IN:"is not one of",STR_CONTAINS:"is a string that contains",STR_STARTS_WITH:"is a string that starts with",STR_ENDS_WITH:"is a string that ends with",NUM_EQ:"is a number equal to",NUM_GT:"is a number greater than",NUM_GTE:"is a number greater than or equal to",NUM_LT:"is a number less than",NUM_LTE:"is a number less than or equal to",DATE_BEFORE:"is a date before",DATE_AFTER:"is a date after",SEMVER_EQ:"is a SemVer equal to",SEMVER_GT:"is a SemVer greater than",SEMVER_LT:"is a SemVer less than"},Oo=d($)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Bo=({action:e})=>{const{payload:a}=e.match,n=Object.entries(a);return n.length===0?t.jsx(Y,{children:"0 filters"}):t.jsx(Y,{children:t.jsx(I3,{tooltipProps:{maxWidth:500},tooltip:t.jsx(t.Fragment,{children:n.map(([c,{inverted:s,operator:r,caseInsensitive:o,value:i,values:h}])=>{const u=$o(r),m=s?t.jsxs(t.Fragment,{children:["is ",t.jsx("u",{children:"not"})," ",u.substring(2)]}):u;return t.jsxs(Oo,{children:[t.jsx("strong",{children:c})," ",m,o?" (case insensitive)":"",": ",t.jsx("strong",{children:h?h.join(", "):i})]},c)})}),children:n.length===1?"1 filter":`${n.length} filters`})})},zo=({action:e,serviceAccounts:a})=>{const{actorId:n}=e,c=a.find(({id:s})=>s===n);return c?t.jsx(E3,{to:"/admin/service-accounts",title:c.name,subtitle:c.username}):t.jsx(Y,{children:"No service account"})},Mo=async e=>{const a=await fetch(e);return await S1("Action events")(a),a.json()},Z8=(e,a,n=50,c={})=>{var w;const{isEnterprise:s}=X(),r=V1("automatedActions"),o=(E,O)=>!e||!a||!s||!r||O&&!O.actionSetEvents.length?null:g1(`api/admin/projects/${a}/actions/${e}/events?limit=${n}&offset=${E*n}`),{data:i,error:h,size:u,setSize:m,mutate:p}=Pe(o,Mo,{...c,revalidateAll:!0}),f=i?i.flatMap(({actionSetEvents:E})=>E):[],g=!i&&!h,v=u>0&&!(i!=null&&i[u-1]),S=g||v,x=((w=i==null?void 0:i[u-1])==null?void 0:w.actionSetEvents.length)===n;return{actionEvents:f,hasMore:x,loadMore:()=>{S||!x||m(u+1)},loading:S,refetch:()=>p(),error:h}};var S4={},Lo=T1;Object.defineProperty(S4,"__esModule",{value:!0});var G2=S4.default=void 0,No=Lo(k1()),qo=t,Ho=(0,No.default)((0,qo.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.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"}),"ErrorOutline");G2=S4.default=Ho;const Wo=d("div",{shouldForwardProp:e=>e!=="state"})(({theme:e,state:a})=>({padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,...a==="not started"&&{backgroundColor:e.palette.background.elevation1}})),Uo=d("div")({display:"flex",flexDirection:"column"}),Go=d("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Ko=d("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,gap:e.spacing(2)})),Jo=d(N2)(({theme:e})=>({color:e.palette.success.main}));d(G2)(({theme:e})=>({color:e.palette.error.main}));const Yo=d(i1)(({theme:e})=>({marginTop:e.spacing(2),fontSize:"inherit"})),Qo=d(S3)(({theme:e})=>({margin:e.spacing(2,0)})),Xo=d("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),ei=d("p")(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(.5)})),ti=d("span")(({theme:e})=>({color:e.palette.text.secondary})),ai=({action:{state:e,details:a,action:n,executionParams:c},children:s})=>{const r=e==="success"?t.jsx(Jo,{}):e==="started"?t.jsx(t4,{size:20}):e==="not started"?t.jsx("span",{children:"Not started"}):null;return t.jsxs(Wo,{state:e,children:[t.jsxs(Uo,{children:[t.jsxs(Go,{children:[t.jsx("div",{children:s}),t.jsx(Ko,{children:r})]}),t.jsx(C,{condition:!!a,show:t.jsx(Yo,{severity:"error",children:a})})]}),t.jsx(Qo,{}),t.jsxs(Xo,{children:[t.jsx(ei,{children:n}),Object.entries(c).map(([o,i])=>t.jsxs("div",{children:[t.jsxs(ti,{children:[o,":"]})," ",i]},o))]})]})},ni=l.lazy(()=>M6(()=>import("./ReactJSONEditor-C-nON7ak.js"),[])),ci=d(Q0)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),si=d(X0)({lineHeight:"1.5rem"}),ri=d(Q)(({theme:e})=>({marginLeft:e.spacing(1)})),oi=({signal:e})=>{const{signalEndpoints:a}=a4(),n=l.useMemo(()=>{const c=a.find(({id:s})=>s===e.sourceId);return c==null?void 0:c.name},[a,e.sourceId]);return t.jsxs(ci,{children:[t.jsxs(si,{expandIcon:t.jsx(j1,{children:t.jsx(Ie,{titleAccess:"Toggle"})}),children:["Signal endpoint:",t.jsx(ri,{to:"/integrations/signals",children:n})]}),t.jsx(e4,{children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(ni,{content:{json:e.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]})},ii=({signal:e})=>{const{source:a}=e;return a==="signal-endpoint"?t.jsx(oi,{signal:e}):null},li=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),di=d(i1)({fontSize:"inherit"}),S8=({state:e,actionSet:{actions:a},signal:n})=>{const c=e==="failed"?`${a.filter(({state:s})=>s!=="success").length} out of ${a.length} actions were not successfully executed`:"All actions were successfully executed";return t.jsxs(li,{children:[t.jsx(di,{severity:e==="failed"?"error":"success",icon:e==="success"?t.jsx(N2,{}):void 0,children:c}),t.jsx(ii,{signal:n}),a.map((s,r)=>t.jsxs(ai,{action:s,children:["Action ",r+1]},s.id))]})},hi=d(I3)(({theme:e})=>({display:"flex",alignItems:"center"})),ui=d("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),pi=d("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),mi=d(N2)(({theme:e})=>({color:e.palette.success.main})),vi=d(G2)(({theme:e})=>({color:e.palette.error.main})),gi=({action:e})=>{const{id:a,project:n}=e,{actionEvents:c}=Z8(a,n,1,{refreshInterval:5e3}),{locationSettings:s}=R3();if(c.length===0)return null;const r=c[0],o=r.state==="success"?t.jsx(mi,{}):r.state==="failed"?t.jsx(vi,{}):t.jsx(t4,{size:20});return t.jsx(hi,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:t.jsxs(t.Fragment,{children:[t.jsxs(ui,{children:[t.jsx(pi,{children:"Last event"}),t.jsx("span",{children:P3(r.createdAt,s==null?void 0:s.locale)})]}),t.jsx(S8,{...r})]}),children:o})},fi=d("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2)})),xi=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),fontSize:e.fontSizes.smallerBody})),ji=d("ul")(({theme:e})=>({listStyle:"none",paddingLeft:e.spacing(1),margin:0})),yi=({action:e,onCreateAction:a})=>{const{actions:n}=e;return n.length===0?a?t.jsx(E3,{title:"Create action",onClick:a}):t.jsx(Y,{children:"0 actions"}):t.jsxs(fi,{children:[t.jsx(gi,{action:e}),t.jsx(I3,{tooltip:t.jsx(xi,{children:n.map(({id:c,action:s,executionParams:r})=>t.jsxs("div",{children:[t.jsx("strong",{children:s}),t.jsx(ji,{children:Object.entries(r).map(([o,i])=>t.jsxs("li",{children:[t.jsx("strong",{children:o}),":"," ",i]},o))})]},c))}),children:n.length===1?"1 action":`${n.length} actions`})]})},bi=d(Z)({display:"flex",justifyContent:"center"}),Zi=({actionId:e,onOpenEvents:a,onEdit:n,onDelete:c})=>{const[s,r]=l.useState(null),o=!!s,i=p=>{r(p.currentTarget)},h=()=>{r(null)},u=`action-${e}-actions`,m=`${u}-menu`;return t.jsxs(bi,{children:[t.jsx(Z1,{title:"Action actions",arrow:!0,describeChild:!0,children:t.jsx(j1,{id:u,"data-loading":!0,"aria-controls":o?m:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:i,type:"button",children:t.jsx(L0,{})})}),t.jsx(t2,{id:m,anchorEl:s,open:o,onClose:h,onClick:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:p=>({borderRadius:`${p.shape.borderRadius}px`,padding:p.spacing(1,1.5)})},children:t.jsxs(a2,{"aria-labelledby":u,children:[t.jsx(H1,{permission:s0,children:({hasAccess:p})=>t.jsxs(R1,{sx:c3,onClick:a,disabled:!p,children:[t.jsx(P1,{children:t.jsx($e,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"View events"})})]})}),t.jsx(H1,{permission:s0,children:({hasAccess:p})=>t.jsxs(R1,{sx:c3,onClick:n,disabled:!p,children:[t.jsx(P1,{children:t.jsx(r2,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Edit"})})]})}),t.jsx(H1,{permission:s0,children:({hasAccess:p})=>t.jsxs(R1,{sx:c3,onClick:c,disabled:!p,children:[t.jsx(P1,{children:t.jsx(o2,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Remove"})})]})})]})})]})},Si=d("div")(({theme:e})=>({marginTop:e.spacing(1),position:"relative"})),Ci=d("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:e.spacing(-2),left:e.spacing(2),lineHeight:1})),wi=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingTop:e.spacing(1),borderRadius:e.shape.borderRadiusMedium})),C8=d("div")({display:"flex",alignItems:"center"}),_i=d(C8)(({theme:e})=>({justifyContent:"space-between",marginBottom:e.spacing(1)})),w8=({index:e,header:a,separator:n="AND",children:c})=>t.jsxs(Si,{children:[t.jsx(C,{condition:e>0,show:t.jsx(Ci,{children:n})}),t.jsxs(wi,{children:[t.jsx(_i,{children:a}),t.jsx(C8,{children:c})]})]}),Ei=d(j1)({marginRight:"-6px"}),Ai=d("div")({display:"flex",flexDirection:"column",width:"100%"}),ki=d("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"start",gap:e.spacing(2)}})),Ti=d("div")(({theme:e})=>({width:"100%",display:"inline-flex",flex:1,gap:e.spacing(1)})),Di=d("div")(({theme:e})=>({width:"100%","&&& > div":{width:"100%"}})),E5=d("div")(({theme:e})=>({display:"inline-flex",flex:1,"&&& button":{marginRight:0,"&:not(.operator-is-active)":{backgroundColor:e.palette.background.elevation2}}})),Fi=d("div")({width:"100%",flex:1});d(R2)({width:"100%"});const Ri=d("div")(({theme:e})=>({"& > h3":{margin:e.spacing(1,0,0,0),fontSize:e.fontSizes.smallBody},"& > div":{margin:0,maxWidth:"unset","& > div":{flex:1},"& .MuiFormControl-root":{margin:e.spacing(.5,0,0,0)},"&:not(:first-of-type)":{marginTop:e.spacing(1)}}})),Pi=({filter:e,index:a,stateChanged:n,suggestions:c,onDelete:s})=>{const{parameter:r,inverted:o,operator:i,caseInsensitive:h,value:u,values:m}=e,p=t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["Filter ",a+1]}),t.jsx("div",{children:t.jsx(Z1,{title:"Delete filter",arrow:!0,children:t.jsx(Ei,{onClick:s,children:t.jsx(o2,{})})})})]}),[f,g]=l.useState(!1),v=V1("caseInsensitiveInOperators"),S=Ve.filter(F=>!N3(Oe,F)),{input:x,validator:b,setError:w,error:E}=Be({contextDefinition:{legalValues:[]},localConstraint:{operator:i,value:u,values:m}}),O=()=>{n({...e,error:void 0});const[F,B]=b();F||(w(B),n({...e,error:B}))};l.useEffect(()=>{O()},[u,E]),l.useEffect(()=>{N3(q4,i)||N3(H4,i)&&v?g(!0):g(!1)},[i,v]);const k=F=>{N3(q4,F)||N3(H4,F)&&v?g(!0):g(!1),n({...e,operator:F})},_=F=>{n({...e,values:void 0,value:F})},T=F=>{n({...e,value:void 0,values:F})},R=F=>{const B=(m==null?void 0:m.filter((I,M)=>M!==F))||[];T(B)};return t.jsx(w8,{index:a,header:p,children:t.jsxs(Ai,{children:[t.jsxs(ki,{children:[t.jsx(Fi,{children:t.jsx(i2,{freeSolo:!0,options:c,value:r,onInputChange:(F,B)=>n({...e,parameter:B}),renderInput:F=>t.jsx(t3,{...F,size:"small",label:"Parameter"})})}),t.jsxs(Ti,{children:[t.jsx(E5,{children:t.jsx(ze,{localConstraint:{inverted:o},setInvertedOperator:()=>n({...e,inverted:!o||void 0})})}),t.jsx(Di,{children:t.jsx(Me,{options:S,value:i,onChange:k})}),t.jsx(C,{condition:f,show:t.jsx(E5,{children:t.jsx(Le,{localConstraint:{caseInsensitive:h},setCaseInsensitive:()=>n({...e,caseInsensitive:!h||void 0})})})})]})]}),t.jsx(Ri,{children:t.jsx(Ne,{setValues:T,setValuesWithRecord:T,setValue:_,setError:w,localConstraint:{value:u,values:m},constraintValues:m||[],constraintValue:u||"",input:x,error:E,contextDefinition:{legalValues:[]},removeValue:R})})]})})},Ii=d("div")(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(2)})),$i=d("div")(({theme:e})=>({position:"absolute",right:0,fontSize:e.fontSizes.smallBody,[e.breakpoints.down("sm")]:{display:"none"}})),Vi=d(Z,{shouldForwardProp:e=>e!=="verticalConnector"})(({theme:e,verticalConnector:a})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,marginTop:a?0:e.spacing(3),padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium})),Oi=d(S3)(({theme:e})=>({margin:"auto",width:1,height:e.spacing(3)})),_8=({name:e,verticalConnector:a,resourceLink:n,children:c})=>t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!!a,show:t.jsx(Oi,{orientation:"vertical"})}),t.jsxs(Vi,{verticalConnector:a,children:[t.jsxs(Ii,{children:[t.jsx(g3,{color:"secondary",children:e}),t.jsx($i,{children:n})]}),c]})]});var C4={},Bi=T1;Object.defineProperty(C4,"__esModule",{value:!0});var E8=C4.default=void 0,zi=Bi(k1()),Mi=t,Li=(0,zi.default)((0,Mi.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");E8=C4.default=Li;const Ni=l.lazy(()=>M6(()=>import("./ReactJSONEditor-C-nON7ak.js"),[])),qi=d("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(1.5),marginBottom:e.spacing(-.75),height:e.spacing(3)})),Hi=d(Q0)({backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}}),Wi=d(X0)(({theme:e})=>({lineHeight:"1.5rem",padding:0,marginBottom:e.spacing(-2.25),fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"}})),Ui=d(E8)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.smallBody})),Gi=d(e4)(({theme:e})=>({marginTop:e.spacing(2),padding:0})),Ki=({payload:e})=>e?t.jsxs(Hi,{children:[t.jsx(Wi,{expandIcon:t.jsx(j1,{children:t.jsx(Ui,{titleAccess:"Toggle"})}),children:"Preview payload"}),t.jsx(Gi,{children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(Ni,{content:{json:e},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]}):t.jsx(qi,{children:"No signals were received from this source yet."}),P0=(e={},a="")=>Object.entries(e).reduce((n,[c,s])=>{const r=a?`${a}.${c}`:c;return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(n,P0(s,r)):Array.isArray(s)?s.forEach((o,i)=>{typeof o=="object"&&o!==null?Object.assign(n,P0(o,`${r}[${i}]`)):n[`${r}[${i}]`]=o}):n[r]=s,n},{}),Ji=d(S3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),Yi=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),Qi=d("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),Xi=({sourceId:e,setSourceId:a,filters:n,setFilters:c,validateSourceId:s})=>{const{signalEndpoints:r,loading:o}=a4(),{signalEndpointSignals:i}=qe(e,1),h=()=>{const g=w2();c(v=>[...v,{id:g,parameter:"",operator:He}])},u=g=>{c(v=>v.map(S=>S.id===g.id?g:S))},m=l.useMemo(()=>o?[]:r.map(({id:g,name:v})=>({label:v,key:`${g}`})),[o,r]),{lastSourcePayload:p,filterSuggestions:f}=l.useMemo(()=>{var v;const g=(v=i[0])==null?void 0:v.payload;return{lastSourcePayload:g,filterSuggestions:Object.keys(P0(g)||{}).sort()}},[i]);return t.jsxs(_8,{name:"When this",resourceLink:t.jsx(Q,{to:"/integrations/signals",children:"Create signal endpoint"}),children:[t.jsx(C3,{label:"Source",options:m,value:`${e}`,onChange:g=>{s(Number(g)),a(Number.parseInt(g))}}),t.jsx(C,{condition:!!e,show:t.jsx(Ki,{payload:p})}),t.jsx(Ji,{}),n.map((g,v)=>t.jsx(Pi,{index:v,filter:g,stateChanged:u,suggestions:f,onDelete:()=>c(S=>S.filter(({id:x})=>x!==g.id))},g.id)),t.jsxs(Qi,{children:[t.jsx(o1,{startIcon:t.jsx(c2,{}),onClick:h,variant:"outlined",color:"primary",children:"Add filter"}),t.jsx(B6,{htmlTooltip:!0,tooltip:t.jsxs(Yi,{children:[t.jsx("p",{children:"Filters allow you to add conditions to the execution of the actions based on the source payload."}),t.jsx("p",{children:"If no filters are defined then the action will always be triggered from the selected source, no matter the payload."})]})})]})]})},el=(e,a,n)=>{const c=`${a?`?project=${a}`:""}${n?`${a?"&":"?"}environment=${n}`:""}`,s=`api/admin/service-account/${e}/permissions${c}`,{data:r,error:o,mutate:i}=B2(!!e,void 0,g1(s),tl);return l.useMemo(()=>({matrix:r==null?void 0:r.matrix,projectRoles:r==null?void 0:r.projectRoles,rootRole:r==null?void 0:r.rootRole,serviceAccount:r==null?void 0:r.serviceAccount,permissions:(r==null?void 0:r.permissions)||[],loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},tl=e=>fetch(e).then(S1("Service account access matrix")).then(a=>a.json()),al=({label:e,value:a,onChange:n,options:c})=>t.jsx(i2,{options:c,autoHighlight:!0,autoSelect:!0,value:a,onInputChange:(s,r)=>n(r),renderInput:s=>t.jsx(t3,{...s,size:"small",label:e})}),nl=({parameter:e,value:a,onChange:n})=>{const{label:c,type:s}=e;if(s==="select"){const{options:r}=e;return t.jsx(al,{label:c,value:a,onChange:n,options:r})}return null},cl=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),sl=({value:e,onChange:a,actionConfigurations:n})=>{const c=(r,o)=>t.jsx("li",{...r,children:t.jsxs(cl,{children:[t.jsx("span",{children:o.label}),t.jsx("span",{children:o.description})]})}),s=[...n].map(([r,o])=>({key:r,...o}));return t.jsx(i2,{options:s,autoHighlight:!0,autoSelect:!0,value:s.find(({key:r})=>r===e)||null,onChange:(r,o)=>a(o?o.key:""),renderOption:c,getOptionLabel:({label:r})=>r,renderInput:r=>t.jsx(t3,{...r,size:"small",label:"Action"})})},rl=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",gap:e.spacing(2)})),A5=d("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",flexWrap:"wrap"})),k5=d("div")(({theme:e})=>({flex:1,minWidth:e.spacing(25)})),ol=({action:e,index:a,stateChanged:n,actorId:c,onDelete:s,actionConfigurations:r,validated:o})=>{const{action:i,executionParams:h,error:u}=e,m=q("projectId"),{permissions:p}=el(c,m,h.environment),f=r.get(i),g=l.useMemo(()=>{const x=f==null?void 0:f.permissions,{environment:b}=h;return p.length===0||!x||!b?!0:x.some(w=>p.some(({permission:E,project:O,environment:k})=>E===w&&O===m&&k===b))},[f,p]);l.useEffect(()=>{n({...e,error:void 0}),((f==null?void 0:f.parameters.filter(({optional:b})=>!b).map(({name:b})=>b))||[]).some(b=>!h[b])&&n({...e,error:"Please fill all required fields."})},[f,h]);const v=t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["Action ",a+1]}),t.jsx("div",{children:t.jsx(Z1,{title:"Delete action",arrow:!0,children:t.jsx(j1,{onClick:s,children:t.jsx(o2,{})})})})]}),S=(f==null?void 0:f.parameters.filter(({type:x})=>x!=="hidden"))||[];return t.jsx(w8,{index:a,header:v,separator:"THEN",children:t.jsxs(rl,{children:[t.jsx(A5,{children:t.jsx(k5,{children:t.jsx(sl,{value:i,onChange:x=>n({...e,action:x}),actionConfigurations:r})})}),t.jsx(C,{condition:S.length>0,show:t.jsx(A5,{children:S.map(x=>t.jsx(k5,{children:t.jsx(nl,{parameter:x,value:h[x.name],onChange:b=>n({...e,executionParams:{...h,[x.name]:b}})})},x.name))})}),t.jsx(C,{condition:o&&!!u,show:t.jsx(i1,{severity:"error",children:u})}),t.jsx(C,{condition:!g,show:t.jsx(i1,{severity:"error",children:"The selected service account does not have permissions to execute this action currently."})})]})})},il={},ll=e=>{const{isEnterprise:a}=X(),n=V1("automatedActions"),{data:c,error:s,mutate:r}=B2(a()&&n,il,g1(`api/admin/projects/${e}/actions/config`),dl);return l.useMemo(()=>({actionConfigurations:new Map(Object.entries(c||{})),loading:!s&&!c,refetch:()=>r(),error:s}),[c,s,r])},dl=e=>fetch(e).then(S1("Actions configuration")).then(a=>a.json()),hl=d(S3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),ul=d("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),pl=({serviceAccounts:e,serviceAccountsLoading:a,actions:n,setActions:c,actorId:s,setActorId:r,validateActorId:o,validated:i})=>{const h=q("projectId"),{actionConfigurations:u}=ll(h),m=g=>{const S={id:w2(),action:"",sortOrder:n.map(x=>x.sortOrder).reduce((x,b)=>Math.max(x,b),0)+1,executionParams:{project:g}};c([...n,S])},p=g=>{c(v=>v.map(S=>S.id===g.id?g:S))},f=l.useMemo(()=>a?[]:e.map(g=>({label:g.name,key:`${g.id}`})),[a,e]);return t.jsxs(_8,{name:"Do these actions",verticalConnector:!0,resourceLink:t.jsx(Q,{to:"/admin/service-accounts",children:"Create service account"}),children:[t.jsx(C3,{label:"Service account",name:"service-account",options:f,value:`${s}`,onChange:g=>{o(Number(g)),r(Number.parseInt(g))}}),t.jsx(hl,{}),n.map((g,v)=>t.jsx(ol,{index:v,action:g,stateChanged:p,actorId:s,onDelete:()=>c(S=>S.filter(x=>x.id!==g.id)),actionConfigurations:u,validated:i},g.id)),t.jsx(ul,{children:t.jsx(o1,{startIcon:t.jsx(c2,{}),onClick:()=>m(h),variant:"outlined",color:"primary",children:"Add action"})})]})},ml=d(i1)(({theme:e})=>({marginBottom:e.spacing(4)})),vl=d("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),T5=d("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),D5=d(R2)(()=>({width:"100%"})),gl=d(i1)(({theme:e})=>({marginTop:e.spacing(3)})),fl=({enabled:e,setEnabled:a,name:n,setName:c,description:s,setDescription:r,sourceId:o,setSourceId:i,filters:h,setFilters:u,actorId:m,setActorId:p,actions:f,setActions:g,errors:v,validateName:S,validateSourceId:x,validateActorId:b,validated:w})=>{const{serviceAccounts:E,loading:O}=U6(),k=T=>{setTimeout(()=>T(),300)},_=w&&Object.values(v).some(Boolean);return t.jsxs("div",{children:[t.jsx(C,{condition:E.length===0,show:t.jsxs(ml,{color:"warning",children:[t.jsx("strong",{children:"Heads up!"})," In order to create an action you need to create a service account first. Please"," ",t.jsx(o3,{to:"/admin/service-accounts",component:Q,children:"go ahead and create one"}),"."]})}),t.jsx(vl,{children:t.jsx(We,{checked:e,setChecked:a,children:"Action status"})}),t.jsx(T5,{children:"What is your new action name?"}),t.jsx(D5,{autoFocus:!0,label:"Action name",error:!!v.name,errorText:v.name,value:n,onChange:T=>{S(T.target.value),c(T.target.value)},onBlur:T=>k(()=>S(T.target.value)),autoComplete:"off"}),t.jsx(T5,{children:"What is your new action description?"}),t.jsx(D5,{label:"Action description",value:s,onChange:T=>r(T.target.value),autoComplete:"off"}),t.jsx(Xi,{sourceId:o,setSourceId:i,filters:h,setFilters:u,validateSourceId:x}),t.jsx(pl,{serviceAccounts:E,serviceAccountsLoading:O,actions:f,setActions:g,actorId:m,setActorId:p,validateActorId:b,validated:w}),t.jsx(C,{condition:_,show:()=>t.jsx(gl,{severity:"error",icon:!1,children:t.jsx("ul",{children:Object.values(v).filter(Boolean).map(T=>t.jsx("li",{children:T},T))})})})]})},F5={name:void 0,source:void 0,filters:void 0,actor:void 0,actions:void 0},xl=e=>{const a=q("projectId"),{actions:n}=U2(a),[c,s]=l.useState(!1),[r,o]=l.useState(""),[i,h]=l.useState(""),[u,m]=l.useState(0),[p,f]=l.useState([]),[g,v]=l.useState(0),[S,x]=l.useState([]),b=()=>{var j,A,y;s((e==null?void 0:e.enabled)??!0),o((e==null?void 0:e.name)||""),h((e==null?void 0:e.description)||""),m(((j=e==null?void 0:e.match)==null?void 0:j.sourceId)??0),f(Object.entries(((A=e==null?void 0:e.match)==null?void 0:A.payload)??{}).map(([z,{inverted:L,operator:U,caseInsensitive:a1,value:s1,values:K1}])=>({id:w2(),parameter:z,inverted:L,operator:U,caseInsensitive:a1,value:s1,values:K1}))),v((e==null?void 0:e.actorId)??0),x(((y=e==null?void 0:e.actions)==null?void 0:y.map(z=>({id:w2(),action:z.action,sortOrder:z.sortOrder,executionParams:z.executionParams})))??[]),k(!1),E(F5)};l.useEffect(()=>{b()},[e]);const[w,E]=l.useState(F5),[O,k]=l.useState(!1),_=j=>{E(A=>({...A,[j]:void 0}))},T=(j,A)=>{E(y=>({...y,[j]:A}))};l.useEffect(()=>{H(p)},[p]),l.useEffect(()=>{P(S)},[S]);const R=j=>!j.length,F=j=>n==null?void 0:n.some(({id:A,name:y})=>A!==(e==null?void 0:e.id)&&y===j),B=j=>j===0,I=j=>R(j)?(T("name","Name is required."),!1):F(j)?(T("name","Name must be unique."),!1):(_("name"),!0),M=j=>B(j)?(T("source","Source is required."),!1):(_("source"),!0),H=j=>j.some(({error:A})=>A)?(T("filters","One or more filters have errors."),!1):(_("filters"),!0),D=j=>B(j)?(T("actor","Service account is required."),!1):(_("actor"),!0),P=j=>j.filter(({action:A})=>!!A).length===0?(T("actions","At least one action is required."),!1):(_("actions"),j.some(({error:A})=>A)?(T("actions","One or more actions have errors."),!1):(_("actions"),!0));return{enabled:c,setEnabled:s,name:r,setName:o,description:i,setDescription:h,sourceId:u,setSourceId:m,filters:p,setFilters:f,actorId:g,setActorId:v,actions:S,setActions:x,errors:w,setErrors:E,validated:O,validateName:I,validateSourceId:M,validateActorId:D,validate:()=>{const j=I(r),A=M(u),y=H(p),z=D(g),L=P(S);return k(!0),j&&A&&y&&z&&L},reloadForm:b}},jl=d("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),yl=d("h1")({fontWeight:"normal"}),bl=d("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Zl=d("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Sl=d(o1)(({theme:e})=>({marginLeft:e.spacing(3)})),Cl=({action:e,open:a,setOpen:n,onOpenEvents:c})=>{const s=q("projectId"),{refetch:r}=U2(s),{addActionSet:o,updateActionSet:i,loading:h}=b8(s),{setToastData:u,setToastApiError:m}=u1(),{uiConfig:p}=X(),{enabled:f,setEnabled:g,name:v,setName:S,description:x,setDescription:b,sourceId:w,setSourceId:E,filters:O,setFilters:k,actorId:_,setActorId:T,actions:R,setActions:F,errors:B,validateName:I,validateSourceId:M,validateActorId:H,validate:D,validated:P,reloadForm:W}=xl(e);l.useEffect(()=>{W()},[a]);const j=e!==void 0,A=`${j?"Edit":"New"} action`,y={enabled:f,name:v,description:x,match:{source:"signal-endpoint",sourceId:w,payload:O.filter(U=>U.parameter.length>0).reduce((U,{parameter:a1,inverted:s1,operator:K1,caseInsensitive:w1,value:N1,values:p3})=>({...U,[a1]:{inverted:s1,operator:K1,caseInsensitive:w1,value:N1,values:p3}}),{})},actorId:_,actions:R.filter(({action:U})=>!!U).map(({action:U,sortOrder:a1,executionParams:s1})=>({action:U,sortOrder:a1,executionParams:s1}))},z=()=>`curl --location --request ${j?"PUT":"POST"} '${p.unleashUrl}/api/admin/projects/${s}/actions${j?`/${e.id}`:""}' \\
20
+ --header 'Authorization: INSERT_API_KEY' '`;return t.jsx(Eo,{children:t.jsx(d3,{loading:c,title:"Delete project",description:"",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:s,compact:!0,compactPadding:!0,showDescription:!1,showLink:!1,children:t.jsx(_o,{projectId:a,featureCount:e})})})},ko=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),To=()=>{const{isEnterprise:e}=X(),{hasAccess:a}=l.useContext(G1),n=q("projectId"),{project:c}=X1(n);if(!c.name)return null;const s=!a([b1,z6],n)&&t.jsx(i1,{severity:"error",sx:{mb:4},children:"You do not have the required permissions to edit this project."});return t.jsxs(t.Fragment,{children:[s,t.jsxs(ko,{children:[t.jsx(bo,{project:c}),t.jsx(C,{condition:e(),show:t.jsx(fo,{project:c})}),t.jsx(Ao,{featureCount:ke(c)})]})]})},Do=()=>{const e=q("projectId"),a=F1(e),{hasAccess:n}=l.useContext(G1),{isOss:c}=X();return C1(`Project configuration – ${a}`),c()?t.jsx(d1,{header:t.jsx(t1,{title:"General settings"}),sx:{justifyContent:"center"},children:t.jsx(l3,{feature:"project-settings"})}):n([b1,Te],e)?t.jsx(To,{}):t.jsx(d1,{header:t.jsx(t1,{title:"General settings"}),children:t.jsx(i1,{severity:"error",children:"You need project owner permissions to access this section."})})},b8=e=>{const{loading:a,makeRequest:n,createRequest:c,errors:s}=L2({propagateErrors:!0}),r=`api/admin/projects/${e}/actions`,o=async f=>{const v=c(r,{method:"POST",body:JSON.stringify(f)},"addActionSet");return(await n(v.caller,v.id)).json()},i=async(f,g)=>{const S=c(`${r}/${f}`,{method:"PUT",body:JSON.stringify(g)},"updateActionSet");await n(S.caller,S.id)},h=async f=>{const v=c(`${r}/${f}/on`,{method:"POST"},"enableActionSet");await n(v.caller,v.id)},u=async f=>{const v=c(`${r}/${f}/off`,{method:"POST"},"disableActionSet");await n(v.caller,v.id)};return{addActionSet:o,updateActionSet:i,removeActionSet:async f=>{const v=c(`${r}/${f}`,{method:"DELETE"},"removeActionSet");await n(v.caller,v.id)},toggleActionSet:async(f,g)=>{g?await h(f):await u(f)},errors:s,loading:a}},Fo=d(Z)({display:"flex",alignItems:"center"}),Ro=d(s2)(({theme:e})=>({background:"transparent",borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(3),height:e.spacing(3),fontSize:e.fontSizes.mainHeader})),Po=d(o3)(({theme:e})=>({...De(e),"&:hover, &:focus":{textDecoration:"underline"}})),Io=({action:e,signalEndpoints:a})=>{const{sourceId:n,source:c}=e.match;if(c==="signal-endpoint"){const s=a.find(({id:r})=>r===n);if(s)return t.jsx(Y,{children:t.jsxs(Fo,{children:[t.jsx(L1,{title:"Signal endpoint",arrow:!0,children:t.jsx(Ro,{src:Fe(Re),alt:"Signal endpoint",variant:"rounded"})}),t.jsx(Po,{component:Q,to:"/integrations/signals",underline:"hover",children:s.name})]})})}return t.jsx(Y,{children:"No source"})},$o=e=>Vo[e],Vo={IN:"is one of",NOT_IN:"is not one of",STR_CONTAINS:"is a string that contains",STR_STARTS_WITH:"is a string that starts with",STR_ENDS_WITH:"is a string that ends with",NUM_EQ:"is a number equal to",NUM_GT:"is a number greater than",NUM_GTE:"is a number greater than or equal to",NUM_LT:"is a number less than",NUM_LTE:"is a number less than or equal to",DATE_BEFORE:"is a date before",DATE_AFTER:"is a date after",SEMVER_EQ:"is a SemVer equal to",SEMVER_GT:"is a SemVer greater than",SEMVER_LT:"is a SemVer less than"},Oo=d($)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Bo=({action:e})=>{const{payload:a}=e.match,n=Object.entries(a);return n.length===0?t.jsx(Y,{children:"0 filters"}):t.jsx(Y,{children:t.jsx(I3,{tooltipProps:{maxWidth:500},tooltip:t.jsx(t.Fragment,{children:n.map(([c,{inverted:s,operator:r,caseInsensitive:o,value:i,values:h}])=>{const u=$o(r),m=s?t.jsxs(t.Fragment,{children:["is ",t.jsx("u",{children:"not"})," ",u.substring(2)]}):u;return t.jsxs(Oo,{children:[t.jsx("strong",{children:c})," ",m,o?" (case insensitive)":"",": ",t.jsx("strong",{children:h?h.join(", "):i})]},c)})}),children:n.length===1?"1 filter":`${n.length} filters`})})},zo=({action:e,serviceAccounts:a})=>{const{actorId:n}=e,c=a.find(({id:s})=>s===n);return c?t.jsx(E3,{to:"/admin/service-accounts",title:c.name,subtitle:c.username}):t.jsx(Y,{children:"No service account"})},Mo=async e=>{const a=await fetch(e);return await S1("Action events")(a),a.json()},Z8=(e,a,n=50,c={})=>{var w;const{isEnterprise:s}=X(),r=V1("automatedActions"),o=(E,O)=>!e||!a||!s||!r||O&&!O.actionSetEvents.length?null:g1(`api/admin/projects/${a}/actions/${e}/events?limit=${n}&offset=${E*n}`),{data:i,error:h,size:u,setSize:m,mutate:p}=Pe(o,Mo,{...c,revalidateAll:!0}),f=i?i.flatMap(({actionSetEvents:E})=>E):[],g=!i&&!h,v=u>0&&!(i!=null&&i[u-1]),S=g||v,x=((w=i==null?void 0:i[u-1])==null?void 0:w.actionSetEvents.length)===n;return{actionEvents:f,hasMore:x,loadMore:()=>{S||!x||m(u+1)},loading:S,refetch:()=>p(),error:h}};var S4={},Lo=T1;Object.defineProperty(S4,"__esModule",{value:!0});var G2=S4.default=void 0,No=Lo(k1()),qo=t,Ho=(0,No.default)((0,qo.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.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"}),"ErrorOutline");G2=S4.default=Ho;const Wo=d("div",{shouldForwardProp:e=>e!=="state"})(({theme:e,state:a})=>({padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,...a==="not started"&&{backgroundColor:e.palette.background.elevation1}})),Uo=d("div")({display:"flex",flexDirection:"column"}),Go=d("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Ko=d("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,gap:e.spacing(2)})),Jo=d(N2)(({theme:e})=>({color:e.palette.success.main}));d(G2)(({theme:e})=>({color:e.palette.error.main}));const Yo=d(i1)(({theme:e})=>({marginTop:e.spacing(2),fontSize:"inherit"})),Qo=d(S3)(({theme:e})=>({margin:e.spacing(2,0)})),Xo=d("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),ei=d("p")(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(.5)})),ti=d("span")(({theme:e})=>({color:e.palette.text.secondary})),ai=({action:{state:e,details:a,action:n,executionParams:c},children:s})=>{const r=e==="success"?t.jsx(Jo,{}):e==="started"?t.jsx(t4,{size:20}):e==="not started"?t.jsx("span",{children:"Not started"}):null;return t.jsxs(Wo,{state:e,children:[t.jsxs(Uo,{children:[t.jsxs(Go,{children:[t.jsx("div",{children:s}),t.jsx(Ko,{children:r})]}),t.jsx(C,{condition:!!a,show:t.jsx(Yo,{severity:"error",children:a})})]}),t.jsx(Qo,{}),t.jsxs(Xo,{children:[t.jsx(ei,{children:n}),Object.entries(c).map(([o,i])=>t.jsxs("div",{children:[t.jsxs(ti,{children:[o,":"]})," ",i]},o))]})]})},ni=l.lazy(()=>M6(()=>import("./ReactJSONEditor-DJyV5xPu.js"),[])),ci=d(Q0)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),si=d(X0)({lineHeight:"1.5rem"}),ri=d(Q)(({theme:e})=>({marginLeft:e.spacing(1)})),oi=({signal:e})=>{const{signalEndpoints:a}=a4(),n=l.useMemo(()=>{const c=a.find(({id:s})=>s===e.sourceId);return c==null?void 0:c.name},[a,e.sourceId]);return t.jsxs(ci,{children:[t.jsxs(si,{expandIcon:t.jsx(j1,{children:t.jsx(Ie,{titleAccess:"Toggle"})}),children:["Signal endpoint:",t.jsx(ri,{to:"/integrations/signals",children:n})]}),t.jsx(e4,{children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(ni,{content:{json:e.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]})},ii=({signal:e})=>{const{source:a}=e;return a==="signal-endpoint"?t.jsx(oi,{signal:e}):null},li=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),di=d(i1)({fontSize:"inherit"}),S8=({state:e,actionSet:{actions:a},signal:n})=>{const c=e==="failed"?`${a.filter(({state:s})=>s!=="success").length} out of ${a.length} actions were not successfully executed`:"All actions were successfully executed";return t.jsxs(li,{children:[t.jsx(di,{severity:e==="failed"?"error":"success",icon:e==="success"?t.jsx(N2,{}):void 0,children:c}),t.jsx(ii,{signal:n}),a.map((s,r)=>t.jsxs(ai,{action:s,children:["Action ",r+1]},s.id))]})},hi=d(I3)(({theme:e})=>({display:"flex",alignItems:"center"})),ui=d("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),pi=d("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),mi=d(N2)(({theme:e})=>({color:e.palette.success.main})),vi=d(G2)(({theme:e})=>({color:e.palette.error.main})),gi=({action:e})=>{const{id:a,project:n}=e,{actionEvents:c}=Z8(a,n,1,{refreshInterval:5e3}),{locationSettings:s}=R3();if(c.length===0)return null;const r=c[0],o=r.state==="success"?t.jsx(mi,{}):r.state==="failed"?t.jsx(vi,{}):t.jsx(t4,{size:20});return t.jsx(hi,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:t.jsxs(t.Fragment,{children:[t.jsxs(ui,{children:[t.jsx(pi,{children:"Last event"}),t.jsx("span",{children:P3(r.createdAt,s==null?void 0:s.locale)})]}),t.jsx(S8,{...r})]}),children:o})},fi=d("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2)})),xi=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),fontSize:e.fontSizes.smallerBody})),ji=d("ul")(({theme:e})=>({listStyle:"none",paddingLeft:e.spacing(1),margin:0})),yi=({action:e,onCreateAction:a})=>{const{actions:n}=e;return n.length===0?a?t.jsx(E3,{title:"Create action",onClick:a}):t.jsx(Y,{children:"0 actions"}):t.jsxs(fi,{children:[t.jsx(gi,{action:e}),t.jsx(I3,{tooltip:t.jsx(xi,{children:n.map(({id:c,action:s,executionParams:r})=>t.jsxs("div",{children:[t.jsx("strong",{children:s}),t.jsx(ji,{children:Object.entries(r).map(([o,i])=>t.jsxs("li",{children:[t.jsx("strong",{children:o}),":"," ",i]},o))})]},c))}),children:n.length===1?"1 action":`${n.length} actions`})]})},bi=d(Z)({display:"flex",justifyContent:"center"}),Zi=({actionId:e,onOpenEvents:a,onEdit:n,onDelete:c})=>{const[s,r]=l.useState(null),o=!!s,i=p=>{r(p.currentTarget)},h=()=>{r(null)},u=`action-${e}-actions`,m=`${u}-menu`;return t.jsxs(bi,{children:[t.jsx(Z1,{title:"Action actions",arrow:!0,describeChild:!0,children:t.jsx(j1,{id:u,"data-loading":!0,"aria-controls":o?m:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:i,type:"button",children:t.jsx(L0,{})})}),t.jsx(t2,{id:m,anchorEl:s,open:o,onClose:h,onClick:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:p=>({borderRadius:`${p.shape.borderRadius}px`,padding:p.spacing(1,1.5)})},children:t.jsxs(a2,{"aria-labelledby":u,children:[t.jsx(H1,{permission:s0,children:({hasAccess:p})=>t.jsxs(R1,{sx:c3,onClick:a,disabled:!p,children:[t.jsx(P1,{children:t.jsx($e,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"View events"})})]})}),t.jsx(H1,{permission:s0,children:({hasAccess:p})=>t.jsxs(R1,{sx:c3,onClick:n,disabled:!p,children:[t.jsx(P1,{children:t.jsx(r2,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Edit"})})]})}),t.jsx(H1,{permission:s0,children:({hasAccess:p})=>t.jsxs(R1,{sx:c3,onClick:c,disabled:!p,children:[t.jsx(P1,{children:t.jsx(o2,{})}),t.jsx(I1,{children:t.jsx($,{variant:"body2",children:"Remove"})})]})})]})})]})},Si=d("div")(({theme:e})=>({marginTop:e.spacing(1),position:"relative"})),Ci=d("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:e.spacing(-2),left:e.spacing(2),lineHeight:1})),wi=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingTop:e.spacing(1),borderRadius:e.shape.borderRadiusMedium})),C8=d("div")({display:"flex",alignItems:"center"}),_i=d(C8)(({theme:e})=>({justifyContent:"space-between",marginBottom:e.spacing(1)})),w8=({index:e,header:a,separator:n="AND",children:c})=>t.jsxs(Si,{children:[t.jsx(C,{condition:e>0,show:t.jsx(Ci,{children:n})}),t.jsxs(wi,{children:[t.jsx(_i,{children:a}),t.jsx(C8,{children:c})]})]}),Ei=d(j1)({marginRight:"-6px"}),Ai=d("div")({display:"flex",flexDirection:"column",width:"100%"}),ki=d("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"start",gap:e.spacing(2)}})),Ti=d("div")(({theme:e})=>({width:"100%",display:"inline-flex",flex:1,gap:e.spacing(1)})),Di=d("div")(({theme:e})=>({width:"100%","&&& > div":{width:"100%"}})),E5=d("div")(({theme:e})=>({display:"inline-flex",flex:1,"&&& button":{marginRight:0,"&:not(.operator-is-active)":{backgroundColor:e.palette.background.elevation2}}})),Fi=d("div")({width:"100%",flex:1});d(R2)({width:"100%"});const Ri=d("div")(({theme:e})=>({"& > h3":{margin:e.spacing(1,0,0,0),fontSize:e.fontSizes.smallBody},"& > div":{margin:0,maxWidth:"unset","& > div":{flex:1},"& .MuiFormControl-root":{margin:e.spacing(.5,0,0,0)},"&:not(:first-of-type)":{marginTop:e.spacing(1)}}})),Pi=({filter:e,index:a,stateChanged:n,suggestions:c,onDelete:s})=>{const{parameter:r,inverted:o,operator:i,caseInsensitive:h,value:u,values:m}=e,p=t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["Filter ",a+1]}),t.jsx("div",{children:t.jsx(Z1,{title:"Delete filter",arrow:!0,children:t.jsx(Ei,{onClick:s,children:t.jsx(o2,{})})})})]}),[f,g]=l.useState(!1),v=V1("caseInsensitiveInOperators"),S=Ve.filter(F=>!N3(Oe,F)),{input:x,validator:b,setError:w,error:E}=Be({contextDefinition:{legalValues:[]},localConstraint:{operator:i,value:u,values:m}}),O=()=>{n({...e,error:void 0});const[F,B]=b();F||(w(B),n({...e,error:B}))};l.useEffect(()=>{O()},[u,E]),l.useEffect(()=>{N3(q4,i)||N3(H4,i)&&v?g(!0):g(!1)},[i,v]);const k=F=>{N3(q4,F)||N3(H4,F)&&v?g(!0):g(!1),n({...e,operator:F})},_=F=>{n({...e,values:void 0,value:F})},T=F=>{n({...e,value:void 0,values:F})},R=F=>{const B=(m==null?void 0:m.filter((I,M)=>M!==F))||[];T(B)};return t.jsx(w8,{index:a,header:p,children:t.jsxs(Ai,{children:[t.jsxs(ki,{children:[t.jsx(Fi,{children:t.jsx(i2,{freeSolo:!0,options:c,value:r,onInputChange:(F,B)=>n({...e,parameter:B}),renderInput:F=>t.jsx(t3,{...F,size:"small",label:"Parameter"})})}),t.jsxs(Ti,{children:[t.jsx(E5,{children:t.jsx(ze,{localConstraint:{inverted:o},setInvertedOperator:()=>n({...e,inverted:!o||void 0})})}),t.jsx(Di,{children:t.jsx(Me,{options:S,value:i,onChange:k})}),t.jsx(C,{condition:f,show:t.jsx(E5,{children:t.jsx(Le,{localConstraint:{caseInsensitive:h},setCaseInsensitive:()=>n({...e,caseInsensitive:!h||void 0})})})})]})]}),t.jsx(Ri,{children:t.jsx(Ne,{setValues:T,setValuesWithRecord:T,setValue:_,setError:w,localConstraint:{value:u,values:m},constraintValues:m||[],constraintValue:u||"",input:x,error:E,contextDefinition:{legalValues:[]},removeValue:R})})]})})},Ii=d("div")(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(2)})),$i=d("div")(({theme:e})=>({position:"absolute",right:0,fontSize:e.fontSizes.smallBody,[e.breakpoints.down("sm")]:{display:"none"}})),Vi=d(Z,{shouldForwardProp:e=>e!=="verticalConnector"})(({theme:e,verticalConnector:a})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,marginTop:a?0:e.spacing(3),padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium})),Oi=d(S3)(({theme:e})=>({margin:"auto",width:1,height:e.spacing(3)})),_8=({name:e,verticalConnector:a,resourceLink:n,children:c})=>t.jsxs(t.Fragment,{children:[t.jsx(C,{condition:!!a,show:t.jsx(Oi,{orientation:"vertical"})}),t.jsxs(Vi,{verticalConnector:a,children:[t.jsxs(Ii,{children:[t.jsx(g3,{color:"secondary",children:e}),t.jsx($i,{children:n})]}),c]})]});var C4={},Bi=T1;Object.defineProperty(C4,"__esModule",{value:!0});var E8=C4.default=void 0,zi=Bi(k1()),Mi=t,Li=(0,zi.default)((0,Mi.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");E8=C4.default=Li;const Ni=l.lazy(()=>M6(()=>import("./ReactJSONEditor-DJyV5xPu.js"),[])),qi=d("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(1.5),marginBottom:e.spacing(-.75),height:e.spacing(3)})),Hi=d(Q0)({backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}}),Wi=d(X0)(({theme:e})=>({lineHeight:"1.5rem",padding:0,marginBottom:e.spacing(-2.25),fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"}})),Ui=d(E8)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.smallBody})),Gi=d(e4)(({theme:e})=>({marginTop:e.spacing(2),padding:0})),Ki=({payload:e})=>e?t.jsxs(Hi,{children:[t.jsx(Wi,{expandIcon:t.jsx(j1,{children:t.jsx(Ui,{titleAccess:"Toggle"})}),children:"Preview payload"}),t.jsx(Gi,{children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(Ni,{content:{json:e},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]}):t.jsx(qi,{children:"No signals were received from this source yet."}),P0=(e={},a="")=>Object.entries(e).reduce((n,[c,s])=>{const r=a?`${a}.${c}`:c;return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(n,P0(s,r)):Array.isArray(s)?s.forEach((o,i)=>{typeof o=="object"&&o!==null?Object.assign(n,P0(o,`${r}[${i}]`)):n[`${r}[${i}]`]=o}):n[r]=s,n},{}),Ji=d(S3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),Yi=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),Qi=d("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),Xi=({sourceId:e,setSourceId:a,filters:n,setFilters:c,validateSourceId:s})=>{const{signalEndpoints:r,loading:o}=a4(),{signalEndpointSignals:i}=qe(e,1),h=()=>{const g=w2();c(v=>[...v,{id:g,parameter:"",operator:He}])},u=g=>{c(v=>v.map(S=>S.id===g.id?g:S))},m=l.useMemo(()=>o?[]:r.map(({id:g,name:v})=>({label:v,key:`${g}`})),[o,r]),{lastSourcePayload:p,filterSuggestions:f}=l.useMemo(()=>{var v;const g=(v=i[0])==null?void 0:v.payload;return{lastSourcePayload:g,filterSuggestions:Object.keys(P0(g)||{}).sort()}},[i]);return t.jsxs(_8,{name:"When this",resourceLink:t.jsx(Q,{to:"/integrations/signals",children:"Create signal endpoint"}),children:[t.jsx(C3,{label:"Source",options:m,value:`${e}`,onChange:g=>{s(Number(g)),a(Number.parseInt(g))}}),t.jsx(C,{condition:!!e,show:t.jsx(Ki,{payload:p})}),t.jsx(Ji,{}),n.map((g,v)=>t.jsx(Pi,{index:v,filter:g,stateChanged:u,suggestions:f,onDelete:()=>c(S=>S.filter(({id:x})=>x!==g.id))},g.id)),t.jsxs(Qi,{children:[t.jsx(o1,{startIcon:t.jsx(c2,{}),onClick:h,variant:"outlined",color:"primary",children:"Add filter"}),t.jsx(B6,{htmlTooltip:!0,tooltip:t.jsxs(Yi,{children:[t.jsx("p",{children:"Filters allow you to add conditions to the execution of the actions based on the source payload."}),t.jsx("p",{children:"If no filters are defined then the action will always be triggered from the selected source, no matter the payload."})]})})]})]})},el=(e,a,n)=>{const c=`${a?`?project=${a}`:""}${n?`${a?"&":"?"}environment=${n}`:""}`,s=`api/admin/service-account/${e}/permissions${c}`,{data:r,error:o,mutate:i}=B2(!!e,void 0,g1(s),tl);return l.useMemo(()=>({matrix:r==null?void 0:r.matrix,projectRoles:r==null?void 0:r.projectRoles,rootRole:r==null?void 0:r.rootRole,serviceAccount:r==null?void 0:r.serviceAccount,permissions:(r==null?void 0:r.permissions)||[],loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},tl=e=>fetch(e).then(S1("Service account access matrix")).then(a=>a.json()),al=({label:e,value:a,onChange:n,options:c})=>t.jsx(i2,{options:c,autoHighlight:!0,autoSelect:!0,value:a,onInputChange:(s,r)=>n(r),renderInput:s=>t.jsx(t3,{...s,size:"small",label:e})}),nl=({parameter:e,value:a,onChange:n})=>{const{label:c,type:s}=e;if(s==="select"){const{options:r}=e;return t.jsx(al,{label:c,value:a,onChange:n,options:r})}return null},cl=d("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),sl=({value:e,onChange:a,actionConfigurations:n})=>{const c=(r,o)=>t.jsx("li",{...r,children:t.jsxs(cl,{children:[t.jsx("span",{children:o.label}),t.jsx("span",{children:o.description})]})}),s=[...n].map(([r,o])=>({key:r,...o}));return t.jsx(i2,{options:s,autoHighlight:!0,autoSelect:!0,value:s.find(({key:r})=>r===e)||null,onChange:(r,o)=>a(o?o.key:""),renderOption:c,getOptionLabel:({label:r})=>r,renderInput:r=>t.jsx(t3,{...r,size:"small",label:"Action"})})},rl=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",gap:e.spacing(2)})),A5=d("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",flexWrap:"wrap"})),k5=d("div")(({theme:e})=>({flex:1,minWidth:e.spacing(25)})),ol=({action:e,index:a,stateChanged:n,actorId:c,onDelete:s,actionConfigurations:r,validated:o})=>{const{action:i,executionParams:h,error:u}=e,m=q("projectId"),{permissions:p}=el(c,m,h.environment),f=r.get(i),g=l.useMemo(()=>{const x=f==null?void 0:f.permissions,{environment:b}=h;return p.length===0||!x||!b?!0:x.some(w=>p.some(({permission:E,project:O,environment:k})=>E===w&&O===m&&k===b))},[f,p]);l.useEffect(()=>{n({...e,error:void 0}),((f==null?void 0:f.parameters.filter(({optional:b})=>!b).map(({name:b})=>b))||[]).some(b=>!h[b])&&n({...e,error:"Please fill all required fields."})},[f,h]);const v=t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["Action ",a+1]}),t.jsx("div",{children:t.jsx(Z1,{title:"Delete action",arrow:!0,children:t.jsx(j1,{onClick:s,children:t.jsx(o2,{})})})})]}),S=(f==null?void 0:f.parameters.filter(({type:x})=>x!=="hidden"))||[];return t.jsx(w8,{index:a,header:v,separator:"THEN",children:t.jsxs(rl,{children:[t.jsx(A5,{children:t.jsx(k5,{children:t.jsx(sl,{value:i,onChange:x=>n({...e,action:x}),actionConfigurations:r})})}),t.jsx(C,{condition:S.length>0,show:t.jsx(A5,{children:S.map(x=>t.jsx(k5,{children:t.jsx(nl,{parameter:x,value:h[x.name],onChange:b=>n({...e,executionParams:{...h,[x.name]:b}})})},x.name))})}),t.jsx(C,{condition:o&&!!u,show:t.jsx(i1,{severity:"error",children:u})}),t.jsx(C,{condition:!g,show:t.jsx(i1,{severity:"error",children:"The selected service account does not have permissions to execute this action currently."})})]})})},il={},ll=e=>{const{isEnterprise:a}=X(),n=V1("automatedActions"),{data:c,error:s,mutate:r}=B2(a()&&n,il,g1(`api/admin/projects/${e}/actions/config`),dl);return l.useMemo(()=>({actionConfigurations:new Map(Object.entries(c||{})),loading:!s&&!c,refetch:()=>r(),error:s}),[c,s,r])},dl=e=>fetch(e).then(S1("Actions configuration")).then(a=>a.json()),hl=d(S3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),ul=d("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),pl=({serviceAccounts:e,serviceAccountsLoading:a,actions:n,setActions:c,actorId:s,setActorId:r,validateActorId:o,validated:i})=>{const h=q("projectId"),{actionConfigurations:u}=ll(h),m=g=>{const S={id:w2(),action:"",sortOrder:n.map(x=>x.sortOrder).reduce((x,b)=>Math.max(x,b),0)+1,executionParams:{project:g}};c([...n,S])},p=g=>{c(v=>v.map(S=>S.id===g.id?g:S))},f=l.useMemo(()=>a?[]:e.map(g=>({label:g.name,key:`${g.id}`})),[a,e]);return t.jsxs(_8,{name:"Do these actions",verticalConnector:!0,resourceLink:t.jsx(Q,{to:"/admin/service-accounts",children:"Create service account"}),children:[t.jsx(C3,{label:"Service account",name:"service-account",options:f,value:`${s}`,onChange:g=>{o(Number(g)),r(Number.parseInt(g))}}),t.jsx(hl,{}),n.map((g,v)=>t.jsx(ol,{index:v,action:g,stateChanged:p,actorId:s,onDelete:()=>c(S=>S.filter(x=>x.id!==g.id)),actionConfigurations:u,validated:i},g.id)),t.jsx(ul,{children:t.jsx(o1,{startIcon:t.jsx(c2,{}),onClick:()=>m(h),variant:"outlined",color:"primary",children:"Add action"})})]})},ml=d(i1)(({theme:e})=>({marginBottom:e.spacing(4)})),vl=d("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),T5=d("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),D5=d(R2)(()=>({width:"100%"})),gl=d(i1)(({theme:e})=>({marginTop:e.spacing(3)})),fl=({enabled:e,setEnabled:a,name:n,setName:c,description:s,setDescription:r,sourceId:o,setSourceId:i,filters:h,setFilters:u,actorId:m,setActorId:p,actions:f,setActions:g,errors:v,validateName:S,validateSourceId:x,validateActorId:b,validated:w})=>{const{serviceAccounts:E,loading:O}=U6(),k=T=>{setTimeout(()=>T(),300)},_=w&&Object.values(v).some(Boolean);return t.jsxs("div",{children:[t.jsx(C,{condition:E.length===0,show:t.jsxs(ml,{color:"warning",children:[t.jsx("strong",{children:"Heads up!"})," In order to create an action you need to create a service account first. Please"," ",t.jsx(o3,{to:"/admin/service-accounts",component:Q,children:"go ahead and create one"}),"."]})}),t.jsx(vl,{children:t.jsx(We,{checked:e,setChecked:a,children:"Action status"})}),t.jsx(T5,{children:"What is your new action name?"}),t.jsx(D5,{autoFocus:!0,label:"Action name",error:!!v.name,errorText:v.name,value:n,onChange:T=>{S(T.target.value),c(T.target.value)},onBlur:T=>k(()=>S(T.target.value)),autoComplete:"off"}),t.jsx(T5,{children:"What is your new action description?"}),t.jsx(D5,{label:"Action description",value:s,onChange:T=>r(T.target.value),autoComplete:"off"}),t.jsx(Xi,{sourceId:o,setSourceId:i,filters:h,setFilters:u,validateSourceId:x}),t.jsx(pl,{serviceAccounts:E,serviceAccountsLoading:O,actions:f,setActions:g,actorId:m,setActorId:p,validateActorId:b,validated:w}),t.jsx(C,{condition:_,show:()=>t.jsx(gl,{severity:"error",icon:!1,children:t.jsx("ul",{children:Object.values(v).filter(Boolean).map(T=>t.jsx("li",{children:T},T))})})})]})},F5={name:void 0,source:void 0,filters:void 0,actor:void 0,actions:void 0},xl=e=>{const a=q("projectId"),{actions:n}=U2(a),[c,s]=l.useState(!1),[r,o]=l.useState(""),[i,h]=l.useState(""),[u,m]=l.useState(0),[p,f]=l.useState([]),[g,v]=l.useState(0),[S,x]=l.useState([]),b=()=>{var j,A,y;s((e==null?void 0:e.enabled)??!0),o((e==null?void 0:e.name)||""),h((e==null?void 0:e.description)||""),m(((j=e==null?void 0:e.match)==null?void 0:j.sourceId)??0),f(Object.entries(((A=e==null?void 0:e.match)==null?void 0:A.payload)??{}).map(([z,{inverted:L,operator:U,caseInsensitive:a1,value:s1,values:K1}])=>({id:w2(),parameter:z,inverted:L,operator:U,caseInsensitive:a1,value:s1,values:K1}))),v((e==null?void 0:e.actorId)??0),x(((y=e==null?void 0:e.actions)==null?void 0:y.map(z=>({id:w2(),action:z.action,sortOrder:z.sortOrder,executionParams:z.executionParams})))??[]),k(!1),E(F5)};l.useEffect(()=>{b()},[e]);const[w,E]=l.useState(F5),[O,k]=l.useState(!1),_=j=>{E(A=>({...A,[j]:void 0}))},T=(j,A)=>{E(y=>({...y,[j]:A}))};l.useEffect(()=>{H(p)},[p]),l.useEffect(()=>{P(S)},[S]);const R=j=>!j.length,F=j=>n==null?void 0:n.some(({id:A,name:y})=>A!==(e==null?void 0:e.id)&&y===j),B=j=>j===0,I=j=>R(j)?(T("name","Name is required."),!1):F(j)?(T("name","Name must be unique."),!1):(_("name"),!0),M=j=>B(j)?(T("source","Source is required."),!1):(_("source"),!0),H=j=>j.some(({error:A})=>A)?(T("filters","One or more filters have errors."),!1):(_("filters"),!0),D=j=>B(j)?(T("actor","Service account is required."),!1):(_("actor"),!0),P=j=>j.filter(({action:A})=>!!A).length===0?(T("actions","At least one action is required."),!1):(_("actions"),j.some(({error:A})=>A)?(T("actions","One or more actions have errors."),!1):(_("actions"),!0));return{enabled:c,setEnabled:s,name:r,setName:o,description:i,setDescription:h,sourceId:u,setSourceId:m,filters:p,setFilters:f,actorId:g,setActorId:v,actions:S,setActions:x,errors:w,setErrors:E,validated:O,validateName:I,validateSourceId:M,validateActorId:D,validate:()=>{const j=I(r),A=M(u),y=H(p),z=D(g),L=P(S);return k(!0),j&&A&&y&&z&&L},reloadForm:b}},jl=d("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),yl=d("h1")({fontWeight:"normal"}),bl=d("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Zl=d("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Sl=d(o1)(({theme:e})=>({marginLeft:e.spacing(3)})),Cl=({action:e,open:a,setOpen:n,onOpenEvents:c})=>{const s=q("projectId"),{refetch:r}=U2(s),{addActionSet:o,updateActionSet:i,loading:h}=b8(s),{setToastData:u,setToastApiError:m}=u1(),{uiConfig:p}=X(),{enabled:f,setEnabled:g,name:v,setName:S,description:x,setDescription:b,sourceId:w,setSourceId:E,filters:O,setFilters:k,actorId:_,setActorId:T,actions:R,setActions:F,errors:B,validateName:I,validateSourceId:M,validateActorId:H,validate:D,validated:P,reloadForm:W}=xl(e);l.useEffect(()=>{W()},[a]);const j=e!==void 0,A=`${j?"Edit":"New"} action`,y={enabled:f,name:v,description:x,match:{source:"signal-endpoint",sourceId:w,payload:O.filter(U=>U.parameter.length>0).reduce((U,{parameter:a1,inverted:s1,operator:K1,caseInsensitive:w1,value:N1,values:p3})=>({...U,[a1]:{inverted:s1,operator:K1,caseInsensitive:w1,value:N1,values:p3}}),{})},actorId:_,actions:R.filter(({action:U})=>!!U).map(({action:U,sortOrder:a1,executionParams:s1})=>({action:U,sortOrder:a1,executionParams:s1}))},z=()=>`curl --location --request ${j?"PUT":"POST"} '${p.unleashUrl}/api/admin/projects/${s}/actions${j?`/${e.id}`:""}' \\
21
21
  --header 'Authorization: INSERT_API_KEY' \\
22
22
  --header 'Content-Type: application/json' \\
23
23
  --data-raw '${JSON.stringify(y,void 0,2)}'`,L=async U=>{if(U.preventDefault(),!!D())try{j?await i(e.id,y):await o(y),u({title:`action ${j?"updated":"added"} successfully`,type:"success"}),r(),n(!1)}catch(a1){m(r1(a1))}};return t.jsx(W1,{open:a,onClose:()=>{n(!1)},label:A,children:t.jsxs(d3,{loading:h,modal:!0,description:"Actions allow you to configure automations based on specific signals, like the ones originated from signal endpoints.",documentationLink:"https://docs.getunleash.io/reference/actions",documentationLinkLabel:"Actions documentation",formatApiCode:z,children:[t.jsxs(jl,{children:[t.jsx(yl,{children:A}),t.jsx(C,{condition:j,show:t.jsx(o3,{onClick:c,children:"View events"})})]}),t.jsxs(bl,{onSubmit:L,children:[t.jsx(fl,{enabled:f,setEnabled:g,name:v,setName:S,description:x,setDescription:b,sourceId:w,setSourceId:E,filters:O,setFilters:k,actorId:_,setActorId:T,actions:R,setActions:F,errors:B,validateName:I,validateSourceId:M,validateActorId:H,validated:P}),t.jsxs(Zl,{children:[t.jsxs(o1,{type:"submit",variant:"contained",color:"primary",children:[j?"Save":"Add"," action"]}),t.jsx(Sl,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},wl=({action:e,open:a,setOpen:n,onConfirm:c})=>t.jsx(D1,{title:"Delete action?",open:a,primaryButtonText:"Delete action",secondaryButtonText:"Cancel",onClick:()=>c(e),onClose:()=>{n(!1)},children:t.jsxs("p",{children:["You are about to delete action: ",t.jsx("strong",{children:e==null?void 0:e.name})]})}),_l=d(N2)(({theme:e})=>({color:e.palette.success.main})),El=d(G2)(({theme:e})=>({color:e.palette.error.main})),Al=({state:e})=>e==="success"?t.jsx(_l,{}):e==="failed"?t.jsx(El,{}):t.jsx(t4,{size:20}),kl=d("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),Tl=d("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Dl=d("h1")({fontWeight:"normal"}),Fl=d("form")({display:"flex",flexDirection:"column",height:"100%"}),Rl=d("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),Pl=d("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Il=({action:e,open:a,setOpen:n,onOpenConfiguration:c})=>{const s=q("projectId"),{locationSettings:r}=R3(),{actionEvents:o,hasMore:i,loadMore:h,loading:u}=Z8(e==null?void 0:e.id,s,20,{refreshInterval:5e3});if(!e)return null;const m=`Events: ${e.name}`;return t.jsx(W1,{open:a,onClose:()=>{n(!1)},label:m,children:t.jsxs(d3,{loading:u&&o.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[t.jsx(kl,{children:t.jsxs(Tl,{children:[t.jsx(Dl,{children:m}),t.jsx(o3,{onClick:c,children:"View configuration"})]})}),t.jsxs(Fl,{children:[t.jsx(Ue,{height:960,items:o,columns:[{header:"Status",align:"center",maxWidth:100,cell:Al},{header:"Date",maxWidth:240,cell:({createdAt:p})=>P3(p,r==null?void 0:r.locale)}],sidePanelHeader:"Details",renderContent:S8,renderItem:({id:p,state:f},g)=>f==="failed"?t.jsx(Rl,{children:g},p):g,listEnd:t.jsx(C,{condition:i,show:t.jsx(o1,{onClick:h,children:"Load more"})})}),t.jsx(C,{condition:o.length===0,show:t.jsx("p",{children:"No events have been registered for this action set."})}),t.jsx(Pl,{children:t.jsx(o1,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},$l=({modalOpen:e,setModalOpen:a,selectedAction:n,setSelectedAction:c})=>{const{setToastData:s,setToastApiError:r}=u1(),o=q("projectId"),{actions:i,refetch:h}=U2(o),{toggleActionSet:u,removeActionSet:m}=b8(o),{signalEndpoints:p}=a4(),{serviceAccounts:f}=U6(),[g,v]=l.useState(!1),[S,x]=l.useState(!1),b=async(I,M)=>{try{await u(I.id,M),s({title:`"${I.name}" has been ${M?"enabled":"disabled"}`,type:"success"}),h()}catch(H){r(r1(H))}},w=async I=>{try{await m(I.id),s({title:`"${I.name}" has been deleted`,type:"success"}),h(),x(!1)}catch(M){r(r1(M))}},E=v1(G3.breakpoints.down("sm")),O=v1(G3.breakpoints.down("lg")),k=l.useMemo(()=>[{Header:"Name",accessor:"name",minWidth:60,Cell:({row:{original:I}})=>t.jsx(E3,{title:I.name,subtitle:I.description,onClick:()=>{c(I),a(!0)}})},{id:"source",Header:"Source",Cell:({row:{original:I}})=>t.jsx(Io,{action:I,signalEndpoints:p})},{id:"filters",Header:"Filters",Cell:({row:{original:I}})=>t.jsx(Bo,{action:I}),maxWidth:90},{id:"actor",Header:"Service account",Cell:({row:{original:I}})=>t.jsx(zo,{action:I,serviceAccounts:f}),minWidth:160},{id:"actions",Header:"Actions",Cell:({row:{original:I}})=>t.jsx(yi,{action:I,onCreateAction:()=>{c(I),a(!0)}}),maxWidth:130},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:I}})=>t.jsx(Ge,{checked:I.enabled,setChecked:M=>b(I,M)}),sortType:"boolean",width:90,maxWidth:90},{id:"table-actions",Header:"",align:"center",Cell:({row:{original:I}})=>t.jsx(Zi,{actionId:I.id,onOpenEvents:()=>{c(I),v(!0)},onEdit:()=>{c(I),a(!0)},onDelete:()=>{c(I),x(!0)}}),width:50,disableSortBy:!0}],[p,f]),[_]=l.useState({sortBy:[{id:"name",desc:!0}]}),{headerGroups:T,rows:R,prepareRow:F,setHiddenColumns:B}=c1.useTable({columns:k,data:i,initialState:_,sortTypes:A3,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:Y}},c1.useSortBy,c1.useFlexLayout);return k3([{condition:O,columns:["actor","enabled"]},{condition:E,columns:["filters","actions"]}],B,k),t.jsxs(t.Fragment,{children:[t.jsx(z2,{rows:R,headerGroups:T,prepareRow:F}),t.jsx(C,{condition:R.length===0,show:t.jsx(f1,{children:"No actions available. Get started by adding one."})}),t.jsx(Cl,{action:n,open:e,setOpen:a,onOpenEvents:()=>{a(!1),v(!0)}}),t.jsx(Il,{action:n,open:g,setOpen:v,onOpenConfiguration:()=>{v(!1),a(!0)}}),t.jsx(wl,{action:n,open:S,setOpen:x,onConfirm:w})]})},Vl=()=>{const e=q("projectId"),a=F1(e),{isEnterprise:n}=X(),c=l1();C1(`Project actions – ${a}`);const[s,r]=l.useState(),[o,i]=l.useState(!1),h=()=>{r(void 0),i(!0)};return n()?t.jsx(d1,{header:t.jsx(t1,{title:"Actions",actions:t.jsx(H0,{onClick:h,maxWidth:`${c.breakpoints.values.sm}px`,Icon:c2,permission:W4,children:"New action"})}),children:t.jsx(Ke,{permissions:W4,children:t.jsx($l,{modalOpen:o,setModalOpen:i,selectedAction:s,setSelectedAction:r})})}):t.jsx(d1,{header:t.jsx(t1,{title:"Actions"}),children:t.jsx(l3,{feature:"actions"})})},R5=d(Z)({marginLeft:"auto",display:"flex",alignItems:"center"}),Ol=()=>{var i;const e=L6(),{isPro:a,isEnterprise:n}=X(),c=B1(),s=V1("automatedActions"),r=[...a()||n()?[{id:"",label:"Settings"},{id:"access",label:"Access"},{id:"segments",label:"Segments"},{id:"change-requests",label:"Change request configuration",icon:a()?t.jsx(R5,{children:t.jsx(D0,{})}):void 0}]:[],{id:"environments",label:"Environments"},{id:"api-access",label:"API access"},{id:"default-strategy",label:"Default strategy"}];s&&r.push({id:"actions",label:"Actions",icon:a()?t.jsx(R5,{children:t.jsx(D0,{})}):void 0});const o=h=>{c(h.id)};return t.jsx(Je,{tabs:r,value:((i=r.find(({id:h})=>{var u;return h&&((u=e.pathname)==null?void 0:u.includes(`/settings/${h}`))}))==null?void 0:i.id)||r[0].id,onChange:o,children:t.jsxs($3,{children:[t.jsx(K,{path:"/*",element:t.jsx(Do,{})}),t.jsx(K,{path:"environments/*",element:t.jsx(K6,{})}),t.jsx(K,{path:"access/*",element:t.jsx(kr,{})}),t.jsx(K,{path:"segments/*",element:t.jsx(Vr,{})}),t.jsx(K,{path:"change-requests/*",element:t.jsx(Fr,{})}),t.jsx(K,{path:"api-access/*",element:t.jsx($r,{})}),t.jsx(K,{path:"default-strategy/*",element:t.jsx(Xr,{})}),t.jsx(K,{path:"actions/*",element:t.jsx(Vl,{})}),t.jsx(K,{path:"*",element:t.jsx(N6,{replace:!0,to:r[0].id})})]})})},Bl=d(c8)(()=>({padding:0,margin:0,[`& .${s8.root}:before`]:{flex:0,padding:0}})),P5=d(d4,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:a})=>({width:"1px",backgroundColor:a?e.palette.common.white:`${j3(e.palette.common.white,.5)}`})),v0=d(l4,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:a})=>({color:a?e.palette.background.sidebar:`${j3(e.palette.common.white,.8)}`,backgroundColor:a?e.palette.common.white:"initial",fontWeight:a?e.fontWeight.bold:"normal",borderColor:a?e.palette.common.white:`${j3(e.palette.common.white,.8)}`,width:e.spacing(5),height:e.spacing(5),lineHeight:e.spacing(5),borderWidth:"1px",display:"flex",alignItems:"center",justifyContent:"center",margin:e.spacing(1,0)})),g0=d(i4,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:a})=>({padding:e.spacing(2,2,6,2),color:a?e.palette.common.white:`${j3(e.palette.common.white,.8)}`})),f0=d(Z,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:a})=>({fontWeight:a?e.fontWeight.bold:"normal",fontSize:e.fontSizes.bodySize})),x0=d(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),zl=({stage:e})=>t.jsxs(Bl,{children:[t.jsxs(W3,{children:[t.jsxs(U3,{children:[t.jsx(v0,{variant:"outlined",active:e==="configure",children:"1"}),t.jsx(P5,{active:e==="configure"})]}),t.jsxs(g0,{active:e==="configure",children:[t.jsx(f0,{active:e==="configure",children:"Import file"}),t.jsx(x0,{children:"Import previously exported flag configuration from another Unleash instance as a JSON file"})]})]}),t.jsxs(W3,{children:[t.jsxs(U3,{children:[t.jsx(v0,{variant:"outlined",active:e==="validate",children:"2"}),t.jsx(P5,{active:e==="validate"})]}),t.jsxs(g0,{active:e==="validate",children:[t.jsx(f0,{active:e==="validate",children:"Validate configuration"}),t.jsx(x0,{children:"Check the errors and warnings from the import process"})]})]}),t.jsxs(W3,{children:[t.jsx(U3,{children:t.jsx(v0,{variant:"outlined",active:e==="import",children:"3"})}),t.jsxs(g0,{active:e==="import",children:[t.jsx(f0,{active:e==="import",children:"Finish import"}),t.jsx(x0,{children:"Feature flag configuration will be imported to your new Unleash instance"})]})]})]});function B3(e,a,n,c){function s(r){return r instanceof n?r:new n(function(o){o(r)})}return new(n||(n=Promise))(function(r,o){function i(m){try{u(c.next(m))}catch(p){o(p)}}function h(m){try{u(c.throw(m))}catch(p){o(p)}}function u(m){m.done?r(m.value):s(m.value).then(i,h)}u((c=c.apply(e,a||[])).next())})}function z3(e,a){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},c,s,r,o;return o={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function i(u){return function(m){return h([u,m])}}function h(u){if(c)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(c=1,s&&(r=u[0]&2?s.return:u[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,u[1])).done)return r;switch(s=0,r&&(u=[u[0]&2,r.value]),u[0]){case 0:case 1:r=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,s=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){n.label=u[1];break}if(u[0]===6&&n.label<r[1]){n.label=r[1],r=u;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(u);break}r[2]&&n.ops.pop(),n.trys.pop();continue}u=a.call(e,n)}catch(m){u=[6,m],s=0}finally{c=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function I5(e,a){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var c=n.call(e),s,r=[],o;try{for(;(a===void 0||a-- >0)&&!(s=c.next()).done;)r.push(s.value)}catch(i){o={error:i}}finally{try{s&&!s.done&&(n=c.return)&&n.call(c)}finally{if(o)throw o.error}}return r}function $5(e,a,n){if(n||arguments.length===2)for(var c=0,s=a.length,r;c<s;c++)(r||!(c in a))&&(r||(r=Array.prototype.slice.call(a,0,c)),r[c]=a[c]);return e.concat(r||Array.prototype.slice.call(a))}var Ml=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function d2(e,a){var n=Ll(e);if(typeof n.path!="string"){var c=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof a=="string"?a:typeof c=="string"&&c.length>0?c:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function Ll(e){var a=e.name,n=a&&a.lastIndexOf(".")!==-1;if(n&&!e.type){var c=a.split(".").pop().toLowerCase(),s=Ml.get(c);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}var Nl=[".DS_Store","Thumbs.db"];function ql(e){return B3(this,void 0,void 0,function(){return z3(this,function(a){return T2(e)&&Hl(e.dataTransfer)?[2,Kl(e.dataTransfer,e.type)]:Wl(e)?[2,Ul(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,Gl(e)]:[2,[]]})})}function Hl(e){return T2(e)}function Wl(e){return T2(e)&&T2(e.target)}function T2(e){return typeof e=="object"&&e!==null}function Ul(e){return I0(e.target.files).map(function(a){return d2(a)})}function Gl(e){return B3(this,void 0,void 0,function(){var a;return z3(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(c){return c.getFile()}))];case 1:return a=n.sent(),[2,a.map(function(c){return d2(c)})]}})})}function Kl(e,a){return B3(this,void 0,void 0,function(){var n,c;return z3(this,function(s){switch(s.label){case 0:return e.items?(n=I0(e.items).filter(function(r){return r.kind==="file"}),a!=="drop"?[2,n]:[4,Promise.all(n.map(Jl))]):[3,2];case 1:return c=s.sent(),[2,V5(A8(c))];case 2:return[2,V5(I0(e.files).map(function(r){return d2(r)}))]}})})}function V5(e){return e.filter(function(a){return Nl.indexOf(a.name)===-1})}function I0(e){if(e===null)return[];for(var a=[],n=0;n<e.length;n++){var c=e[n];a.push(c)}return a}function Jl(e){if(typeof e.webkitGetAsEntry!="function")return O5(e);var a=e.webkitGetAsEntry();return a&&a.isDirectory?k8(a):O5(e)}function A8(e){return e.reduce(function(a,n){return $5($5([],I5(a),!1),I5(Array.isArray(n)?A8(n):[n]),!1)},[])}function O5(e){var a=e.getAsFile();if(!a)return Promise.reject("".concat(e," is not a File"));var n=d2(a);return Promise.resolve(n)}function Yl(e){return B3(this,void 0,void 0,function(){return z3(this,function(a){return[2,e.isDirectory?k8(e):Ql(e)]})})}function k8(e){var a=e.createReader();return new Promise(function(n,c){var s=[];function r(){var o=this;a.readEntries(function(i){return B3(o,void 0,void 0,function(){var h,u,m;return z3(this,function(p){switch(p.label){case 0:if(i.length)return[3,5];p.label=1;case 1:return p.trys.push([1,3,,4]),[4,Promise.all(s)];case 2:return h=p.sent(),n(h),[3,4];case 3:return u=p.sent(),c(u),[3,4];case 4:return[3,6];case 5:m=Promise.all(i.map(Yl)),s.push(m),r(),p.label=6;case 6:return[2]}})})},function(i){c(i)})}r()})}function Ql(e){return B3(this,void 0,void 0,function(){return z3(this,function(a){return[2,new Promise(function(n,c){e.file(function(s){var r=d2(s,e.fullPath);n(r)},function(s){c(s)})})]})})}var Xl=function(e,a){if(e&&a){var n=Array.isArray(a)?a:a.split(","),c=e.name||"",s=(e.type||"").toLowerCase(),r=s.replace(/\/.*$/,"");return n.some(function(o){var i=o.trim().toLowerCase();return i.charAt(0)==="."?c.toLowerCase().endsWith(i):i.endsWith("/*")?r===i.replace(/\/.*$/,""):s===i})}return!0};function B5(e){return ad(e)||td(e)||D8(e)||ed()}function ed(){throw new TypeError(`Invalid attempt to spread non-iterable instance.