unleash-server 5.3.0 → 5.3.1

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 (33) hide show
  1. package/dist/lib/services/client-metrics/metrics-service-v2.d.ts +2 -0
  2. package/dist/lib/services/client-metrics/metrics-service-v2.js +27 -17
  3. package/dist/lib/services/client-metrics/metrics-service-v2.js.map +1 -1
  4. package/dist/lib/services/client-metrics/metrics-service-v2.test.d.ts +1 -0
  5. package/dist/lib/services/client-metrics/metrics-service-v2.test.js +96 -0
  6. package/dist/lib/services/client-metrics/metrics-service-v2.test.js.map +1 -0
  7. package/dist/lib/types/experimental.d.ts +1 -1
  8. package/dist/lib/types/experimental.js +1 -0
  9. package/dist/lib/types/experimental.js.map +1 -1
  10. package/frontend/build/index.html +1 -1
  11. package/frontend/build/static/{AdvancedPlayground-4c9d02ea.js → AdvancedPlayground-48dddbf4.js} +1 -1
  12. package/frontend/build/static/{CreateProject-16b35d57.js → CreateProject-c1b0f704.js} +1 -1
  13. package/frontend/build/static/{Error-50364f10.js → Error-e6f7c2ee.js} +1 -1
  14. package/frontend/build/static/FeatureArchiveDialog-9ad60db1.js +10 -0
  15. package/frontend/build/static/{FeatureMetricsChart-839cdf1e.js → FeatureMetricsChart-81da0ce4.js} +1 -1
  16. package/frontend/build/static/{FeatureViewLazyExport-47bb7f13.js → FeatureViewLazyExport-58a3e977.js} +2 -2
  17. package/frontend/build/static/{LazyAdminExport-8ef0ca21.js → LazyAdminExport-c98b11d7.js} +2 -2
  18. package/frontend/build/static/{LazyProjectExport-49541c75.js → LazyProjectExport-14db2e37.js} +1 -1
  19. package/frontend/build/static/{NetworkOverview-711050f3.js → NetworkOverview-cd06e59f.js} +2 -2
  20. package/frontend/build/static/{NetworkTraffic-e587c2c7.js → NetworkTraffic-ba933617.js} +1 -1
  21. package/frontend/build/static/{RoleCell-9a62b4ed.js → RoleCell-c534790e.js} +1 -1
  22. package/frontend/build/static/{StrategyItemContainer-4098c8ef.js → StrategyItemContainer-88c18285.js} +1 -1
  23. package/frontend/build/static/{chartjs-adapter-date-fns.esm-d57aaddd.js → chartjs-adapter-date-fns.esm-799be047.js} +1 -1
  24. package/frontend/build/static/{flowchart-elk-definition-170a3958-4dece62b.js → flowchart-elk-definition-170a3958-543f0844.js} +1 -1
  25. package/frontend/build/static/{index-9c528324.js → index-1c4c68c3.js} +2 -2
  26. package/frontend/build/static/{index-9bb67f88.js → index-88f1c682.js} +1 -1
  27. package/frontend/build/static/{index-1c8194e0.js → index-aa638b65.js} +1 -1
  28. package/frontend/build/static/{is_dark-ba77f0b9.js → is_dark-735e3a95.js} +1 -1
  29. package/frontend/build/static/{mindmap-definition-44684416-a4071c9f.js → mindmap-definition-44684416-ac92f950.js} +1 -1
  30. package/frontend/build/static/{timeline-definition-8e5a9bc6-c996bf40.js → timeline-definition-8e5a9bc6-6c09f608.js} +1 -1
  31. package/frontend/build/static/{unknownify-db48ebae.js → unknownify-0b176a78.js} +1 -1
  32. package/package.json +1 -1
  33. package/frontend/build/static/FeatureArchiveDialog-fda1aa0c.js +0 -10
@@ -1,4 +1,4 @@
1
- import{c as le,j as n,cC as t0,cE as n0,s as p,cm as a0,cj as et,a3 as st,r as d,eb as r0,a9 as c1,a1 as t1,d as l,a4 as ct,a5 as lt,a6 as dt,a7 as ut,dd as o0,b6 as J1,E as _1,aM as de,aN as Y1,aO as Q1,ec as $3,aD as K,ed as E1,bS as T1,f as d1,cd as x1,aw as Ae,X as h1,ee as i0,ab as i2,cP as s2,ef as B3,eg as b1,ar as n1,al as D1,aq as i1,C as w,aJ as R1,an as ue,am as w1,ch as s0,af as pt,eh as c0,b9 as ke,ba as De,bb as Re,B as T,a$ as H1,t as N1,bg as l0,$ as ht,ds as mt,ei as ae,cn as c2,M as U1,ej as Zt,b3 as re,e1 as d0,b5 as oe,T as I,cp as z3,aI as gt,ae as G1,D as V3,m as l2,b as m1,aa as C1,ek as u0,y as Q,el as L3,ag as P1,i as u1,em as p0,bt as h0,h as p1,bM as m0,bK as d2,c7 as ft,bN as M3,aU as Pe,aZ as Fe,aV as je,en as H3,dq as N3,bC as g0,au as F1,ah as u2,eo as f0,ck as v0,ep as y0,eq as b0,er as C0,es as W3,et as q3,aj as U3,eu as _0,c$ as vt,ak as yt,d0 as x0,ci as w0,bQ as G3,ad as bt,ev as S0,R as T0,aL as E0,ce as A0,ai as K3,ew as k0,v as I1,ex as J3,P as Y3,ey as Q3,w as D0,ez as R0,eA as P0,aP as X3,eB as p2,e as F0,eC as en,eD as j0,eE as Z0,eF as I0,eG as O0,bH as tn,eH as nn,eI as an,a2 as Ze,ac as Ct,eJ as $0,eK as B0,aF as z0,eL as V0,eM as _t,eN as L0,eO as rn,eP as M0,eQ as pe,eR as X1,aG as O1,cs as he,eS as me,eT as ge,eU as H0,ca as Te,bP as on,eV as sn,eW as N0,bo as $1,at as cn,bs as Ie,eX as W0,eY as q0,eZ as U0,e_ as G0,e$ as K0,f0 as J0,f1 as Y0,by as Q0,c9 as X0,dl as tt,f2 as ea,cr as h2,f3 as xt,bV as K1,aH as L1,aK as wt,dc as m2,db as g2,aC as M1,ax as f2,f4 as ta,A as na,f5 as aa,da as We,l as ln,f6 as ra,f7 as oa,n as ia,o as sa,f8 as ca,f9 as la,fa as da,bT as fe,bU as X,fb as ua,fc as O2,fd as dn,u as v2,az as pa,fe as ha,cS as ma,ff as $2,fg as ga,fh as fa,fi as va,fj as ya,fk as ba,bm as Ca,bn as _a,bz as xa,bA as wa,bB as Sa,N as Ta,fl as Ea,fm as un,fn as pn,bZ as Aa,av as ka,ay as Da,aB as Ra,cl as hn,fo as Pa,d7 as mn,fp as ie,fq as Y,fr as Fa,fs as ja,ft as Za,fu as Ia,fv as Oa,dg as $a,fw as Ba,fx as za}from"./index-9c528324.js";import{e as gn,W as B2,b as Va,u as fn,T as La,c as Ma,h as Ha,F as Na,V as Wa,a as qa,g as Ua,C as Ga,U as Ka,E as Ja,i as Ya}from"./FeatureArchiveDialog-fda1aa0c.js";import{a as Qa}from"./index-1c8194e0.js";import{m as Xa,g as er,i as tr,b as nr,c as ar,d as rr,e as or,E as ir,f as sr,u as cr,a as lr,R as dr,C as ur,A as pr,B as vn}from"./RoleCell-9a62b4ed.js";import{S as hr}from"./StrategyItemContainer-4098c8ef.js";import{E as mr}from"./Error-50364f10.js";const gr=le(n("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),fr=le(n("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),vr=le(n("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),yr=le(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),br=le(n("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Cr=le(n("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function _r(e,t){t0(2,arguments);var a=n0(t);return Qa(e,-a)}const z2=p("div")(()=>({display:"flex"})),xr=p("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));p("div")(()=>({display:"flex",flexDirection:"column"}));const wr=p("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),Sr=p("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));p(Sr)(({theme:e})=>({color:e.palette.neutral.dark}));const Tr=p(a0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),Er=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),Ar=p("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),kr=p("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),Dr=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Rr=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),Pr=p(et)(({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}})),Fr=e=>e.reduce((t,a)=>a.enabled?t+1:t,0),jr=p(st)(({theme:e})=>({marginTop:e.spacing(3)})),Zr=p("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),Ir=({environment:e,warnEnabledToggles:t})=>{const a=d.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:u}})=>n(r0,{environment:u})},{Header:"Name",accessor:"name",Cell:c1},{Header:"Type",accessor:"type",Cell:c1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:u})=>n(c1,{children:n(Zr,{warning:u>0,children:u===1?"1 toggle":`${u} toggles`})}),align:"center"}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:c}=t1.useTable({columns:a,data:[e],disableSortBy:!0});return l(jr,{...r(),rowHeight:"compact",children:[n(ct,{headerGroups:i}),n(lt,{...o(),children:s.map(u=>(c(u),n(dt,{hover:!0,...u.getRowProps(),children:u.cells.map(h=>n(ut,{...h.getCellProps(),children:h.render("Cell")}))})))})]})},Or=p("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),$r=p(o0)(()=>({width:"100%"})),Br=({environment:e,open:t,setOpen:a,onConfirm:r})=>{const[o,i]=d.useState("");return d.useEffect(()=>{i("")},[t]),l(J1,{title:"Hide environment and disable feature toggles?",open:t,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{a(!1)},children:[l(_1,{severity:"error",children:[n("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),n(Ir,{environment:e}),l(Or,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",n("strong",{children:e==null?void 0:e.name})]}),n($r,{label:"Environment name",value:o,onChange:s=>i(s.target.value)})]})},zr=e=>{const{data:t,error:a,mutate:r}=de(Y1(`api/admin/environments/project/${e}`),Vr),o=d.useMemo(()=>t||[],[t]),i=d.useCallback(async()=>{await r()},[r]);return{environments:o,refetchEnvironments:i,loading:!a&&!t,error:a}},Vr=async e=>(await fetch(e).then(Q1("Environments")).then(a=>a.json())).environments.sort((a,r)=>a.sortOrder-r.sortOrder),Lr=p(_1)(({theme:e})=>({marginBottom:e.spacing(4)})),Mr=p("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),Hr=p($3)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),yn=()=>{const e=K("projectId"),t=E1(e);T1(`Project environments – ${t}`);const{setToastData:a,setToastApiError:r}=d1(),{environments:o,loading:i,error:s,refetchEnvironments:c}=zr(e),{project:u,refetch:h}=x1(e),{removeEnvironmentFromProject:m,addEnvironmentToProject:g}=Ae(),[y,_]=d.useState(),[C,b]=d.useState(!1),{isOss:D}=h1(),f=d.useMemo(()=>o.map(F=>({...F,projectVisible:u==null?void 0:u.environments.map(W=>W.environment).includes(F.name)})),[o,u==null?void 0:u.environments]),R=()=>{c(),h()},E=()=>n(Hr,{onClick:R,text:"Error fetching environments"}),O=F=>`Got an API error when trying to set the environment as ${F?"visible":"hidden"}`,L=async F=>{if(F.projectVisible){if(Fr(f)>1){_(F),b(!0);return}a({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await g(e,F.name),R(),a({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{r(O(!0))}},S=async()=>{if(y)try{await m(e,y.name),R(),a({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{r(O(!1))}finally{b(!1)}},j=F=>D()&&F==="default",Z=d.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:F}})=>n(i0,{environment:F})},{Header:"Type",accessor:"type",Cell:i2},{Header:"Project API tokens",accessor:F=>F.projectApiTokenCount===1?"1 token":`${F.projectApiTokenCount} tokens`,Cell:c1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:F}})=>n(s2,{children:n(B3,{tooltip:F.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:j(F.name),projectId:e,permission:b1,checked:F.projectVisible,onChange:()=>L(F)})}),disableGlobalFilter:!0}],[f]),{getTableProps:V,getTableBodyProps:M,headerGroups:B,rows:J,prepareRow:U,state:{globalFilter:v},setGlobalFilter:x}=t1.useTable({columns:Z,data:f,disableSortBy:!0},t1.useGlobalFilter),$=n(n1,{title:`Environments (${J.length})`,actions:n(D1,{initialValue:v,onChange:x})});return n(i1,{header:$,isLoading:i,children:l(Mr,{children:[n(w,{condition:!!s,show:E()}),l(Lr,{severity:"info",children:[n("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"," ",n(R1,{to:"/admin/api",children:"API tokens here"}),".",n("br",{}),n("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",n(R1,{to:"/admin/api",children:"create a new API token here"}),"."]}),n(ue,{value:v,children:l(st,{...V(),rowHeight:"compact",children:[n(ct,{headerGroups:B}),n(lt,{...M(),children:J.map(F=>(U(F),n(dt,{hover:!0,...F.getRowProps(),children:F.cells.map(W=>n(ut,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),n(w,{condition:J.length===0,show:n(w,{condition:(v==null?void 0:v.length)>0,show:l(w1,{children:["No environments found matching “",v,"”"]}),elseShow:n(w1,{children:"No environments available. Get started by adding one."})})}),n(Br,{environment:y,open:C,setOpen:b,onConfirm:S})]})})},Nr={id:"archivedAt"},Wr=({projectId:e})=>{const{archivedFeatures:t,loading:a,refetchArchived:r}=s0(e),{value:o,setValue:i}=pt(`${e}:ProjectFeaturesArchiveTable`,Nr);return n(c0,{title:"Project archive",archivedFeatures:t||[],loading:a,storedParams:o,setStoredParams:i,refetch:r,projectId:e})},qr=()=>{const e=K("projectId"),t=E1(e);return T1(`Project archive – ${t}`),n(Wr,{projectId:e})},Ur=(e=[])=>{var r;let t=e.map(o=>o.environment);const a=d.useRef(t);return t.join("")!==((r=a.current)==null?void 0:r.join(""))&&(a.current=t),a.current};var y2={},Gr=De;Object.defineProperty(y2,"__esModule",{value:!0});var bn=y2.default=void 0,Kr=Gr(ke()),Jr=Re,Yr=(0,Kr.default)((0,Jr.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");bn=y2.default=Yr;var b2={},Qr=De;Object.defineProperty(b2,"__esModule",{value:!0});var Cn=b2.default=void 0,Xr=Qr(ke()),eo=Re,to=(0,Xr.default)((0,eo.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");Cn=b2.default=to;const no=p(T)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),ao=({projectId:e,row:t,onOpenArchiveDialog:a,onOpenStaleDialog:r})=>{const[o,i]=d.useState(null),{original:{name:s,stale:c}}=t,u=!!o,h=_=>{i(_.currentTarget)},m=()=>{i(null)},g=`feature-${s}-actions`,y=`${g}-menu`;return l(no,{children:[n(H1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:n(N1,{id:g,"aria-controls":u?y:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:h,type:"button",children:n(l0,{})})}),n(ht,{id:y,anchorEl:o,open:u,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:_=>({borderRadius:`${_.shape.borderRadius}px`,padding:_.spacing(1,1.5)})},children:l(mt,{"aria-labelledby":g,children:[n(ae,{projectId:e,permission:c2,children:({hasAccess:_})=>l(U1,{sx:Zt,onClick:m,disabled:!_,component:R1,to:`/projects/${e}/features/${s}/strategies/copy`,children:[n(re,{children:n(d0,{})}),n(oe,{children:n(I,{variant:"body2",children:"Copy"})})]})}),n(ae,{projectId:e,permission:z3,children:({hasAccess:_})=>l(U1,{sx:Zt,onClick:()=>{a(s),m()},disabled:!_,children:[n(re,{children:n(bn,{})}),n(oe,{children:n(I,{variant:"body2",children:"Archive"})})]})}),n(ae,{projectId:e,permission:gt,children:({hasAccess:_})=>l(U1,{sx:Zt,onClick:()=>{m(),r({featureId:s,stale:c===!0})},disabled:!_,children:[n(re,{children:n(Cn,{})}),n(oe,{children:l(I,{variant:"body2",children:[c?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var C2={},ro=De;Object.defineProperty(C2,"__esModule",{value:!0});var _n=C2.default=void 0,oo=ro(ke()),io=Re,so=(0,oo.default)((0,io.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");_n=C2.default=so;const co=p(T)(()=>({...G1,justifyContent:"center"})),lo=p(N1)(({theme:e})=>({margin:e.spacing(-1,0)})),uo=p(T)(({theme:e})=>({...G1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),po=p(U1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),V2=p(V3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),ho=p(l2)(({theme:e})=>({padding:e.spacing(.75,1)})),mo={favorite:"Favorite"},go=({allColumns:e,staticColumns:t=[],dividerBefore:a=[],dividerAfter:r=[],isCustomized:o=!1,setHiddenColumns:i})=>{const[s,c]=d.useState(null),u=m1(),h=C1(u.breakpoints.down("sm")),m=C1(u.breakpoints.down("md")),g=C1(u.breakpoints.down("lg"));d.useEffect(()=>{if(o)return;const f=(R,E=0)=>{const O=e.filter(({id:S})=>S.startsWith("environments.")!==!1).map(({id:S})=>S).slice(0,E),L=e.map(({id:S})=>S).filter(S=>!R.includes(S)).filter(S=>!t.includes(S)).filter(S=>!O.includes(S));i(L)};if(h)return f(["createdAt"]);if(m)return f(["createdAt"],1);if(g)return f(["type","createdAt"],1);f(["lastSeenAt","type","createdAt"],3)},[h,m,g]);const y=f=>{c(f.currentTarget)},_=()=>{c(null)},C=!!s,b="columns-menu",D=`columns-menu-list-${b}`;return l(co,{children:[n(H1,{title:"Select columns",arrow:!0,describeChild:!0,children:n(lo,{id:b,"aria-controls":C?D:void 0,"aria-haspopup":"true","aria-expanded":C?"true":void 0,onClick:y,type:"button",size:"large","data-loading":!0,children:n(_n,{})})}),l(ht,{id:D,open:C,anchorEl:s,onClose:_,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:f.shape.borderRadius,paddingBottom:f.spacing(2)})},children:[l(uo,{children:[n(I,{variant:"body2",children:n("strong",{children:"Columns"})}),n(N1,{onClick:_,children:n(u0,{})})]}),n(mt,{children:e.filter(({hideInMenu:f})=>!f).map(f=>[n(w,{condition:a.includes(f.id),show:n(V2,{})}),l(po,{onClick:()=>f.toggleHidden(f.isVisible),disabled:t.includes(f.id),children:[n(re,{children:n(ho,{edge:"start",checked:f.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":f.id},size:"medium"})}),n(oe,{id:f.id,primary:n(I,{variant:"body2",children:n(w,{condition:!!(typeof f.Header=="string"&&f.Header),show:()=>n(Q,{children:f.Header}),elseShow:()=>mo[f.id]||f.id})})})]}),n(w,{condition:r.includes(f.id),show:n(V2,{})})])})]})]})},fo=L3()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),vo=({projectId:e,features:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(!1),{trackEvent:i}=P1();return l(Q,{children:[n(ae,{projectId:e,permission:z3,children:({hasAccess:c})=>n(u1,{disabled:!c||r,variant:"outlined",size:"small",onClick:()=>o(!0),children:"Archive"})}),n(gn,{projectId:e,featureIds:t,onConfirm:async()=>{o(!1),await a(),i("batch_operations",{props:{eventType:"features archived"}})},isOpen:r,onClose:()=>o(!1)})]})},qe="selection-actions-menu",yo=({projectId:e,data:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(null),{staleFeatures:i}=Ae(),{setToastData:s,setToastApiError:c}=d1(),{trackEvent:u}=P1(),h=!!r,m=t.map(({name:f})=>f),g=f=>{o(f.currentTarget)},y=()=>{o(null)},_=t.some(({stale:f})=>f===!0),C=t.some(({stale:f})=>f===!1),b=async()=>{try{y(),await i(e,m),await a(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features staled"}})}catch(f){c(p1(f))}},D=async()=>{try{y(),await i(e,m,!1),await a(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){c(p1(f))}};return l(Q,{children:[n(H1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:n(N1,{id:qe,"aria-controls":h?qe:void 0,"aria-haspopup":"true","aria-expanded":h?"true":void 0,onClick:g,type:"button","data-testid":p0,children:n(h0,{})})}),n(ht,{id:`${qe}-menu`,anchorEl:r,open:h,onClose:y,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:n(mt,{"aria-labelledby":`${qe}-menu`,children:n(ae,{projectId:e,permission:gt,children:({hasAccess:f})=>l(Q,{children:[n(w,{condition:C,show:()=>l(U1,{onClick:b,disabled:!f,sx:{borderRadius:R=>`${R.shape.borderRadius}px`},children:[n(re,{children:n(B2,{})}),n(oe,{children:n(I,{variant:"body2",children:"Mark as stale"})})]})}),n(w,{condition:_,show:()=>l(U1,{onClick:D,disabled:!f,sx:{borderRadius:R=>`${R.shape.borderRadius}px`},children:[n(re,{children:n(B2,{})}),n(oe,{children:n(I,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},bo=p("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),L2="manage-tags-form",M2=(e,t)=>[...e,...e.some(a=>a.value===t.value&&a.type===t.type)?[]:[t]],H2=(e,t)=>e.filter(a=>!(a.value===t.value&&a.type===t.type)),Co=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:M2(e.addedTags,t.payload),removedTags:H2(e.removedTags,t.payload)};case"remove":return{...e,addedTags:H2(e.addedTags,t.payload),removedTags:M2(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};default:return e}},N2={name:"",description:"",icon:""},_o=({open:e,initialValues:t,initialIndeterminateValues:a,onCancel:r,onSubmit:o})=>{const{tagTypes:i,loading:s}=m0(),[c,u]=d.useState(N2),[h,m]=d.useState([]),[g,y]=d.useState([]),{tags:_,refetch:C}=Va(c.name),{createTag:b}=fn(),D=_.map(({value:Z})=>({title:Z})),[f,R]=d.useReducer(Co,{addedTags:[],removedTags:[]}),E=(Z=i.length>0?i[0]:N2)=>{u(Z);const V=a.filter(({type:M})=>M===Z.name);m(t.filter(({type:M})=>M===Z.name).filter(({type:M,value:B})=>!V.some(J=>J.value===B&&J.type===M)).map(({value:M})=>({title:M}))),y(V.map(({value:M})=>({title:M}))),R({type:"clear",payload:[]})};d.useEffect(()=>{i.length>0&&E()},[s]);const O=(Z,V)=>{V!=null&&typeof V!="string"&&(Z.preventDefault(),E(V))},L=(Z,V)=>b({value:Z,type:V}).then(async()=>{await C(),m(M=>[...M,{title:Z}]),R({type:"add",payload:{value:Z,type:V}})}),S=(Z,V,M,B)=>{M==="selectOption"?V.forEach(J=>{if(typeof J!="string"&&typeof J.inputValue=="string"&&J.inputValue&&J.title.startsWith("Create new value"))return L(J.inputValue,c.name);m(V),y(U=>U.filter(({title:v})=>v!==J.title)),B!=null&&B.option&&R({type:"add",payload:{value:B.option.title,type:c.name}})}):M==="clear"?(m([]),R({type:"clear",payload:t})):M==="removeOption"&&(m(V),B!=null&&B.option&&R({type:"remove",payload:{value:B.option.title,type:c.name}}))},j=()=>{E(),r()};return l(J1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>o(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:j,formId:L2,children:[n(I,{paragraph:!0,sx:{marginBottom:Z=>Z.spacing(2.5)},children:"Tags allow you to group features together"}),n("form",{id:L2,onSubmit:()=>o(f),children:l(bo,{children:[n(La,{options:i,disabled:s||i.length===0,value:c,onChange:O},s?"loading":i.length),n(w,{condition:!s&&i.length===0,show:l(I,{variant:"body1",children:["No"," ",n(d2,{component:R1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:n(Ma,{disabled:s,options:D,existingTags:t,indeterminateOptions:g,tagType:c,selectedOptions:h,onChange:S})})]})})]})},xo=({projectId:e,data:t})=>{const{bulkUpdateTags:a}=fn(),{refetch:r}=x1(e),{setToastData:o,setToastApiError:i}=d1(),{trackEvent:s}=P1(),[c,u]=d.useState(!1),[h,m]=d.useMemo(()=>{const y=t.flatMap(({tags:C})=>C||[]).reduce((C,b)=>[...C,...C.some(D=>D.type===b.type&&D.value===b.value)?[]:[b]],[]),_=y.filter(C=>!t.every(({tags:b})=>b==null?void 0:b.some(D=>D.type===C.type&&D.value===C.value)));return[y,_]},[t]);return l(Q,{children:[n(ae,{projectId:e,permission:gt,children:({hasAccess:y})=>n(u1,{disabled:!y||c,variant:"outlined",size:"small",onClick:()=>u(!0),children:"Tags"})}),n(_o,{open:c,onCancel:()=>u(!1),onSubmit:async({addedTags:y,removedTags:_})=>{const C=t.map(({name:D})=>D),b={features:C,tags:{addedTags:y,removedTags:_}};try{await a(b,e),r();const D=y.length?`Added tags: ${y.map(({type:R,value:E})=>`${R}:${E}`).join(", ")}.`:"",f=_.length?`Removed tags: ${_.map(({type:R,value:E})=>`${R}:${E}`).join(", ")}.`:"";o({title:"Tags updated",text:`${C.length} feature toggles updated. ${D} ${f}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(D){i(p1(D))}u(!1)},initialValues:h,initialIndeterminateValues:m},t.length)]})},wo=p(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),W2=p(_1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),So=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOff:u}=M3(),{addChange:h}=Pe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=d1(),{isChangeRequestConfigured:_}=Fe(i),{refetch:C}=je(i),b=t.filter(E=>{var O,L;return((L=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:L.enabled)===!1}).length,D=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await h(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!1}}))),C(),y({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),a(),r==null||r()}catch(E){g(p1(E))}},R=_(s)?"Add to change request":"Disable toggles";return n(J1,{open:e,title:"Disable feature toggles",onClose:a,onClick:f,primaryButtonText:R,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to disable.",n("br",{}),n("br",{}),n(I,{children:"Select which environment to disable the features for:"}),n(wo,{options:D(),value:s,onChange:E=>c(E)}),n(w,{condition:_(s),show:n(W2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(w,{condition:b>0,show:l(W2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},To=p(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),q2=p(_1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Eo=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOn:u}=M3(),{addChange:h}=Pe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=d1(),{isChangeRequestConfigured:_}=Fe(i),{refetch:C}=je(i),b=t.filter(E=>{var O,L;return((L=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:L.enabled)===!0}).length,D=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await h(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!0}}))),C(),y({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),a(),r==null||r()}catch(E){g(p1(E))}},R=_(s)?"Add to change request":"Enable toggles";return n(J1,{open:e,title:"Enable feature toggles",onClose:a,onClick:f,primaryButtonText:R,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to enable.",n("br",{}),n("br",{}),n(I,{children:"Select which environment to enable the features for:"}),n(To,{options:D(),value:s,onChange:E=>c(E)}),n(w,{condition:_(s),show:n(q2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(w,{condition:b>0,show:l(q2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},Ao=({selectedIds:e,data:t,projectId:a})=>{var D,f;const{uiConfig:r}=h1(),[o,i]=d.useState(!1),[s,c]=d.useState(!1),[u,h]=d.useState(!1),{trackEvent:m}=P1(),g=d.useMemo(()=>t.filter(R=>e.includes(R.name)),[t,e]),y=d.useMemo(()=>{const R=g.flatMap(E=>E.environments).map(E=>E==null?void 0:E.name).filter(E=>E!==void 0);return Array.from(new Set(R))},[g]),_=()=>{m("batch_operations",{props:{eventType:"features exported"}})},C=()=>{m("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{m("batch_operations",{props:{eventType:"features disabled"}})};return l(Q,{children:[n(w,{condition:!!((D=r==null?void 0:r.flags)!=null&&D.disableBulkToggle),show:null,elseShow:n(u1,{variant:"outlined",size:"small",onClick:()=>c(!0),children:"Enable"})}),n(w,{condition:!!((f=r==null?void 0:r.flags)!=null&&f.disableBulkToggle),show:null,elseShow:n(u1,{variant:"outlined",size:"small",onClick:()=>h(!0),children:"Disable"})}),n(vo,{projectId:a,features:e}),n(u1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),n(xo,{projectId:a,data:g}),n(yo,{projectId:a,data:g}),n(H3,{showExportDialog:o,data:g,onClose:()=>i(!1),environments:y,onConfirm:_}),n(Eo,{showExportDialog:s,data:g,onClose:()=>c(!1),environments:y,projectId:a,onConfirm:C}),n(So,{showExportDialog:u,data:g,onClose:()=>h(!1),environments:y,projectId:a,onConfirm:b})]})},ko=p(N3)(()=>({whiteSpace:"nowrap"})),Do=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...G1,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Ue=["Select","Actions","name","favorite"],Ro={id:"createdAt"},Po=({features:e,loading:t,environments:a=[]})=>{var Z1,te;const{classes:r}=fo(),o=m1(),i=C1(o.breakpoints.down("md")),[s,c]=d.useState({open:!1,featureId:"",environmentName:""}),[u,h]=d.useState({}),[m,g]=d.useState(),y=K("projectId"),{value:_,setValue:C}=pt(`${y}:FeatureToggleListTable:v1`,Ro),{value:b,setValue:D}=g0(),f=F1(),[R,E]=u2(),O=Ur(t?[{environment:"a"},{environment:"b"},{environment:"c"}]:a),{refetch:L}=x1(y),{isFavoritesPinned:S,sortTypes:j,onChangeIsFavoritePinned:Z}=f0(R.has("favorites")?R.get("favorites")==="true":b.favorites),{favorite:V,unfavorite:M}=v0(),{onChangeRequestToggleClose:B,onChangeRequestToggleConfirm:J,changeRequestDialogDetails:U}=Ha(y),[v,x]=d.useState(!1),{uiConfig:$}=h1(),F=d.useCallback(async P=>{P!=null&&P.favorite?await M(y,P.name):await V(y,P.name),L()},[y,L]),W=d.useMemo(()=>e.some(P=>{var N;return(N=P==null?void 0:P.tags)==null?void 0:N.length}),[e]),k=d.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:P})=>n(l2,{...P()}),Cell:({row:P})=>{var N;return n(y0,{...(N=P==null?void 0:P.getToggleRowSelectedProps)==null?void 0:N.call(P)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:n(b0,{isActive:S,onClick:Z}),accessor:"favorite",Cell:({row:{original:P}})=>n(C0,{value:P==null?void 0:P.favorite,onClick:()=>F(P)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:W3,sortType:"date",align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:q3,align:"center",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:P})=>n(H1,{title:P,arrow:!0,describeChild:!0,children:n("span",{children:n(U3,{title:P,to:`/projects/${y}/features/${P}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...W?[{id:"tags",Header:"Tags",accessor:P=>{var N;return((N=P.tags)==null?void 0:N.map(({type:r1,value:q})=>`${r1}:${q}`).join(`
1
+ import{c as le,j as n,cC as t0,cE as n0,s as p,cm as a0,cj as et,a3 as st,r as d,eb as r0,a9 as c1,a1 as t1,d as l,a4 as ct,a5 as lt,a6 as dt,a7 as ut,dd as o0,b6 as J1,E as _1,aM as de,aN as Y1,aO as Q1,ec as $3,aD as K,ed as E1,bS as T1,f as d1,cd as x1,aw as Ae,X as h1,ee as i0,ab as i2,cP as s2,ef as B3,eg as b1,ar as n1,al as D1,aq as i1,C as w,aJ as R1,an as ue,am as w1,ch as s0,af as pt,eh as c0,b9 as ke,ba as De,bb as Re,B as T,a$ as H1,t as N1,bg as l0,$ as ht,ds as mt,ei as ae,cn as c2,M as U1,ej as Zt,b3 as re,e1 as d0,b5 as oe,T as I,cp as z3,aI as gt,ae as G1,D as V3,m as l2,b as m1,aa as C1,ek as u0,y as Q,el as L3,ag as P1,i as u1,em as p0,bt as h0,h as p1,bM as m0,bK as d2,c7 as ft,bN as M3,aU as Pe,aZ as Fe,aV as je,en as H3,dq as N3,bC as g0,au as F1,ah as u2,eo as f0,ck as v0,ep as y0,eq as b0,er as C0,es as W3,et as q3,aj as U3,eu as _0,c$ as vt,ak as yt,d0 as x0,ci as w0,bQ as G3,ad as bt,ev as S0,R as T0,aL as E0,ce as A0,ai as K3,ew as k0,v as I1,ex as J3,P as Y3,ey as Q3,w as D0,ez as R0,eA as P0,aP as X3,eB as p2,e as F0,eC as en,eD as j0,eE as Z0,eF as I0,eG as O0,bH as tn,eH as nn,eI as an,a2 as Ze,ac as Ct,eJ as $0,eK as B0,aF as z0,eL as V0,eM as _t,eN as L0,eO as rn,eP as M0,eQ as pe,eR as X1,aG as O1,cs as he,eS as me,eT as ge,eU as H0,ca as Te,bP as on,eV as sn,eW as N0,bo as $1,at as cn,bs as Ie,eX as W0,eY as q0,eZ as U0,e_ as G0,e$ as K0,f0 as J0,f1 as Y0,by as Q0,c9 as X0,dl as tt,f2 as ea,cr as h2,f3 as xt,bV as K1,aH as L1,aK as wt,dc as m2,db as g2,aC as M1,ax as f2,f4 as ta,A as na,f5 as aa,da as We,l as ln,f6 as ra,f7 as oa,n as ia,o as sa,f8 as ca,f9 as la,fa as da,bT as fe,bU as X,fb as ua,fc as O2,fd as dn,u as v2,az as pa,fe as ha,cS as ma,ff as $2,fg as ga,fh as fa,fi as va,fj as ya,fk as ba,bm as Ca,bn as _a,bz as xa,bA as wa,bB as Sa,N as Ta,fl as Ea,fm as un,fn as pn,bZ as Aa,av as ka,ay as Da,aB as Ra,cl as hn,fo as Pa,d7 as mn,fp as ie,fq as Y,fr as Fa,fs as ja,ft as Za,fu as Ia,fv as Oa,dg as $a,fw as Ba,fx as za}from"./index-1c4c68c3.js";import{e as gn,W as B2,b as Va,u as fn,T as La,c as Ma,h as Ha,F as Na,V as Wa,a as qa,g as Ua,C as Ga,U as Ka,E as Ja,i as Ya}from"./FeatureArchiveDialog-9ad60db1.js";import{a as Qa}from"./index-aa638b65.js";import{m as Xa,g as er,i as tr,b as nr,c as ar,d as rr,e as or,E as ir,f as sr,u as cr,a as lr,R as dr,C as ur,A as pr,B as vn}from"./RoleCell-c534790e.js";import{S as hr}from"./StrategyItemContainer-88c18285.js";import{E as mr}from"./Error-e6f7c2ee.js";const gr=le(n("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),fr=le(n("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),vr=le(n("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),yr=le(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),br=le(n("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Cr=le(n("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function _r(e,t){t0(2,arguments);var a=n0(t);return Qa(e,-a)}const z2=p("div")(()=>({display:"flex"})),xr=p("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));p("div")(()=>({display:"flex",flexDirection:"column"}));const wr=p("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),Sr=p("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));p(Sr)(({theme:e})=>({color:e.palette.neutral.dark}));const Tr=p(a0)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),Er=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),Ar=p("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),kr=p("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),Dr=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Rr=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),Pr=p(et)(({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}})),Fr=e=>e.reduce((t,a)=>a.enabled?t+1:t,0),jr=p(st)(({theme:e})=>({marginTop:e.spacing(3)})),Zr=p("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),Ir=({environment:e,warnEnabledToggles:t})=>{const a=d.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:u}})=>n(r0,{environment:u})},{Header:"Name",accessor:"name",Cell:c1},{Header:"Type",accessor:"type",Cell:c1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:u})=>n(c1,{children:n(Zr,{warning:u>0,children:u===1?"1 toggle":`${u} toggles`})}),align:"center"}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:c}=t1.useTable({columns:a,data:[e],disableSortBy:!0});return l(jr,{...r(),rowHeight:"compact",children:[n(ct,{headerGroups:i}),n(lt,{...o(),children:s.map(u=>(c(u),n(dt,{hover:!0,...u.getRowProps(),children:u.cells.map(h=>n(ut,{...h.getCellProps(),children:h.render("Cell")}))})))})]})},Or=p("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),$r=p(o0)(()=>({width:"100%"})),Br=({environment:e,open:t,setOpen:a,onConfirm:r})=>{const[o,i]=d.useState("");return d.useEffect(()=>{i("")},[t]),l(J1,{title:"Hide environment and disable feature toggles?",open:t,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{a(!1)},children:[l(_1,{severity:"error",children:[n("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),n(Ir,{environment:e}),l(Or,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",n("strong",{children:e==null?void 0:e.name})]}),n($r,{label:"Environment name",value:o,onChange:s=>i(s.target.value)})]})},zr=e=>{const{data:t,error:a,mutate:r}=de(Y1(`api/admin/environments/project/${e}`),Vr),o=d.useMemo(()=>t||[],[t]),i=d.useCallback(async()=>{await r()},[r]);return{environments:o,refetchEnvironments:i,loading:!a&&!t,error:a}},Vr=async e=>(await fetch(e).then(Q1("Environments")).then(a=>a.json())).environments.sort((a,r)=>a.sortOrder-r.sortOrder),Lr=p(_1)(({theme:e})=>({marginBottom:e.spacing(4)})),Mr=p("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),Hr=p($3)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),yn=()=>{const e=K("projectId"),t=E1(e);T1(`Project environments – ${t}`);const{setToastData:a,setToastApiError:r}=d1(),{environments:o,loading:i,error:s,refetchEnvironments:c}=zr(e),{project:u,refetch:h}=x1(e),{removeEnvironmentFromProject:m,addEnvironmentToProject:g}=Ae(),[y,_]=d.useState(),[C,b]=d.useState(!1),{isOss:D}=h1(),f=d.useMemo(()=>o.map(F=>({...F,projectVisible:u==null?void 0:u.environments.map(W=>W.environment).includes(F.name)})),[o,u==null?void 0:u.environments]),R=()=>{c(),h()},E=()=>n(Hr,{onClick:R,text:"Error fetching environments"}),O=F=>`Got an API error when trying to set the environment as ${F?"visible":"hidden"}`,L=async F=>{if(F.projectVisible){if(Fr(f)>1){_(F),b(!0);return}a({title:"One environment must be visible",text:"You must always have at least one visible environment per project",type:"error"})}else try{await g(e,F.name),R(),a({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{r(O(!0))}},S=async()=>{if(y)try{await m(e,y.name),R(),a({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{r(O(!1))}finally{b(!1)}},j=F=>D()&&F==="default",Z=d.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:F}})=>n(i0,{environment:F})},{Header:"Type",accessor:"type",Cell:i2},{Header:"Project API tokens",accessor:F=>F.projectApiTokenCount===1?"1 token":`${F.projectApiTokenCount} tokens`,Cell:c1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:F}})=>n(s2,{children:n(B3,{tooltip:F.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:j(F.name),projectId:e,permission:b1,checked:F.projectVisible,onChange:()=>L(F)})}),disableGlobalFilter:!0}],[f]),{getTableProps:V,getTableBodyProps:M,headerGroups:B,rows:J,prepareRow:U,state:{globalFilter:v},setGlobalFilter:x}=t1.useTable({columns:Z,data:f,disableSortBy:!0},t1.useGlobalFilter),$=n(n1,{title:`Environments (${J.length})`,actions:n(D1,{initialValue:v,onChange:x})});return n(i1,{header:$,isLoading:i,children:l(Mr,{children:[n(w,{condition:!!s,show:E()}),l(Lr,{severity:"info",children:[n("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"," ",n(R1,{to:"/admin/api",children:"API tokens here"}),".",n("br",{}),n("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",n(R1,{to:"/admin/api",children:"create a new API token here"}),"."]}),n(ue,{value:v,children:l(st,{...V(),rowHeight:"compact",children:[n(ct,{headerGroups:B}),n(lt,{...M(),children:J.map(F=>(U(F),n(dt,{hover:!0,...F.getRowProps(),children:F.cells.map(W=>n(ut,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),n(w,{condition:J.length===0,show:n(w,{condition:(v==null?void 0:v.length)>0,show:l(w1,{children:["No environments found matching “",v,"”"]}),elseShow:n(w1,{children:"No environments available. Get started by adding one."})})}),n(Br,{environment:y,open:C,setOpen:b,onConfirm:S})]})})},Nr={id:"archivedAt"},Wr=({projectId:e})=>{const{archivedFeatures:t,loading:a,refetchArchived:r}=s0(e),{value:o,setValue:i}=pt(`${e}:ProjectFeaturesArchiveTable`,Nr);return n(c0,{title:"Project archive",archivedFeatures:t||[],loading:a,storedParams:o,setStoredParams:i,refetch:r,projectId:e})},qr=()=>{const e=K("projectId"),t=E1(e);return T1(`Project archive – ${t}`),n(Wr,{projectId:e})},Ur=(e=[])=>{var r;let t=e.map(o=>o.environment);const a=d.useRef(t);return t.join("")!==((r=a.current)==null?void 0:r.join(""))&&(a.current=t),a.current};var y2={},Gr=De;Object.defineProperty(y2,"__esModule",{value:!0});var bn=y2.default=void 0,Kr=Gr(ke()),Jr=Re,Yr=(0,Kr.default)((0,Jr.jsx)("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive");bn=y2.default=Yr;var b2={},Qr=De;Object.defineProperty(b2,"__esModule",{value:!0});var Cn=b2.default=void 0,Xr=Qr(ke()),eo=Re,to=(0,Xr.default)((0,eo.jsx)("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"}),"WatchLater");Cn=b2.default=to;const no=p(T)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),ao=({projectId:e,row:t,onOpenArchiveDialog:a,onOpenStaleDialog:r})=>{const[o,i]=d.useState(null),{original:{name:s,stale:c}}=t,u=!!o,h=_=>{i(_.currentTarget)},m=()=>{i(null)},g=`feature-${s}-actions`,y=`${g}-menu`;return l(no,{children:[n(H1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:n(N1,{id:g,"aria-controls":u?y:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:h,type:"button",children:n(l0,{})})}),n(ht,{id:y,anchorEl:o,open:u,onClose:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:_=>({borderRadius:`${_.shape.borderRadius}px`,padding:_.spacing(1,1.5)})},children:l(mt,{"aria-labelledby":g,children:[n(ae,{projectId:e,permission:c2,children:({hasAccess:_})=>l(U1,{sx:Zt,onClick:m,disabled:!_,component:R1,to:`/projects/${e}/features/${s}/strategies/copy`,children:[n(re,{children:n(d0,{})}),n(oe,{children:n(I,{variant:"body2",children:"Copy"})})]})}),n(ae,{projectId:e,permission:z3,children:({hasAccess:_})=>l(U1,{sx:Zt,onClick:()=>{a(s),m()},disabled:!_,children:[n(re,{children:n(bn,{})}),n(oe,{children:n(I,{variant:"body2",children:"Archive"})})]})}),n(ae,{projectId:e,permission:gt,children:({hasAccess:_})=>l(U1,{sx:Zt,onClick:()=>{m(),r({featureId:s,stale:c===!0})},disabled:!_,children:[n(re,{children:n(Cn,{})}),n(oe,{children:l(I,{variant:"body2",children:[c?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var C2={},ro=De;Object.defineProperty(C2,"__esModule",{value:!0});var _n=C2.default=void 0,oo=ro(ke()),io=Re,so=(0,oo.default)((0,io.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");_n=C2.default=so;const co=p(T)(()=>({...G1,justifyContent:"center"})),lo=p(N1)(({theme:e})=>({margin:e.spacing(-1,0)})),uo=p(T)(({theme:e})=>({...G1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),po=p(U1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),V2=p(V3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),ho=p(l2)(({theme:e})=>({padding:e.spacing(.75,1)})),mo={favorite:"Favorite"},go=({allColumns:e,staticColumns:t=[],dividerBefore:a=[],dividerAfter:r=[],isCustomized:o=!1,setHiddenColumns:i})=>{const[s,c]=d.useState(null),u=m1(),h=C1(u.breakpoints.down("sm")),m=C1(u.breakpoints.down("md")),g=C1(u.breakpoints.down("lg"));d.useEffect(()=>{if(o)return;const f=(R,E=0)=>{const O=e.filter(({id:S})=>S.startsWith("environments.")!==!1).map(({id:S})=>S).slice(0,E),L=e.map(({id:S})=>S).filter(S=>!R.includes(S)).filter(S=>!t.includes(S)).filter(S=>!O.includes(S));i(L)};if(h)return f(["createdAt"]);if(m)return f(["createdAt"],1);if(g)return f(["type","createdAt"],1);f(["lastSeenAt","type","createdAt"],3)},[h,m,g]);const y=f=>{c(f.currentTarget)},_=()=>{c(null)},C=!!s,b="columns-menu",D=`columns-menu-list-${b}`;return l(co,{children:[n(H1,{title:"Select columns",arrow:!0,describeChild:!0,children:n(lo,{id:b,"aria-controls":C?D:void 0,"aria-haspopup":"true","aria-expanded":C?"true":void 0,onClick:y,type:"button",size:"large","data-loading":!0,children:n(_n,{})})}),l(ht,{id:D,open:C,anchorEl:s,onClose:_,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:f.shape.borderRadius,paddingBottom:f.spacing(2)})},children:[l(uo,{children:[n(I,{variant:"body2",children:n("strong",{children:"Columns"})}),n(N1,{onClick:_,children:n(u0,{})})]}),n(mt,{children:e.filter(({hideInMenu:f})=>!f).map(f=>[n(w,{condition:a.includes(f.id),show:n(V2,{})}),l(po,{onClick:()=>f.toggleHidden(f.isVisible),disabled:t.includes(f.id),children:[n(re,{children:n(ho,{edge:"start",checked:f.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":f.id},size:"medium"})}),n(oe,{id:f.id,primary:n(I,{variant:"body2",children:n(w,{condition:!!(typeof f.Header=="string"&&f.Header),show:()=>n(Q,{children:f.Header}),elseShow:()=>mo[f.id]||f.id})})})]}),n(w,{condition:r.includes(f.id),show:n(V2,{})})])})]})]})},fo=L3()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),vo=({projectId:e,features:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(!1),{trackEvent:i}=P1();return l(Q,{children:[n(ae,{projectId:e,permission:z3,children:({hasAccess:c})=>n(u1,{disabled:!c||r,variant:"outlined",size:"small",onClick:()=>o(!0),children:"Archive"})}),n(gn,{projectId:e,featureIds:t,onConfirm:async()=>{o(!1),await a(),i("batch_operations",{props:{eventType:"features archived"}})},isOpen:r,onClose:()=>o(!1)})]})},qe="selection-actions-menu",yo=({projectId:e,data:t})=>{const{refetch:a}=x1(e),[r,o]=d.useState(null),{staleFeatures:i}=Ae(),{setToastData:s,setToastApiError:c}=d1(),{trackEvent:u}=P1(),h=!!r,m=t.map(({name:f})=>f),g=f=>{o(f.currentTarget)},y=()=>{o(null)},_=t.some(({stale:f})=>f===!0),C=t.some(({stale:f})=>f===!1),b=async()=>{try{y(),await i(e,m),await a(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features staled"}})}catch(f){c(p1(f))}},D=async()=>{try{y(),await i(e,m,!1),await a(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),u("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){c(p1(f))}};return l(Q,{children:[n(H1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:n(N1,{id:qe,"aria-controls":h?qe:void 0,"aria-haspopup":"true","aria-expanded":h?"true":void 0,onClick:g,type:"button","data-testid":p0,children:n(h0,{})})}),n(ht,{id:`${qe}-menu`,anchorEl:r,open:h,onClose:y,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:f=>({borderRadius:`${f.shape.borderRadius}px`,padding:f.spacing(1,1.5)})},children:n(mt,{"aria-labelledby":`${qe}-menu`,children:n(ae,{projectId:e,permission:gt,children:({hasAccess:f})=>l(Q,{children:[n(w,{condition:C,show:()=>l(U1,{onClick:b,disabled:!f,sx:{borderRadius:R=>`${R.shape.borderRadius}px`},children:[n(re,{children:n(B2,{})}),n(oe,{children:n(I,{variant:"body2",children:"Mark as stale"})})]})}),n(w,{condition:_,show:()=>l(U1,{onClick:D,disabled:!f,sx:{borderRadius:R=>`${R.shape.borderRadius}px`},children:[n(re,{children:n(B2,{})}),n(oe,{children:n(I,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},bo=p("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),L2="manage-tags-form",M2=(e,t)=>[...e,...e.some(a=>a.value===t.value&&a.type===t.type)?[]:[t]],H2=(e,t)=>e.filter(a=>!(a.value===t.value&&a.type===t.type)),Co=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:M2(e.addedTags,t.payload),removedTags:H2(e.removedTags,t.payload)};case"remove":return{...e,addedTags:H2(e.addedTags,t.payload),removedTags:M2(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};default:return e}},N2={name:"",description:"",icon:""},_o=({open:e,initialValues:t,initialIndeterminateValues:a,onCancel:r,onSubmit:o})=>{const{tagTypes:i,loading:s}=m0(),[c,u]=d.useState(N2),[h,m]=d.useState([]),[g,y]=d.useState([]),{tags:_,refetch:C}=Va(c.name),{createTag:b}=fn(),D=_.map(({value:Z})=>({title:Z})),[f,R]=d.useReducer(Co,{addedTags:[],removedTags:[]}),E=(Z=i.length>0?i[0]:N2)=>{u(Z);const V=a.filter(({type:M})=>M===Z.name);m(t.filter(({type:M})=>M===Z.name).filter(({type:M,value:B})=>!V.some(J=>J.value===B&&J.type===M)).map(({value:M})=>({title:M}))),y(V.map(({value:M})=>({title:M}))),R({type:"clear",payload:[]})};d.useEffect(()=>{i.length>0&&E()},[s]);const O=(Z,V)=>{V!=null&&typeof V!="string"&&(Z.preventDefault(),E(V))},L=(Z,V)=>b({value:Z,type:V}).then(async()=>{await C(),m(M=>[...M,{title:Z}]),R({type:"add",payload:{value:Z,type:V}})}),S=(Z,V,M,B)=>{M==="selectOption"?V.forEach(J=>{if(typeof J!="string"&&typeof J.inputValue=="string"&&J.inputValue&&J.title.startsWith("Create new value"))return L(J.inputValue,c.name);m(V),y(U=>U.filter(({title:v})=>v!==J.title)),B!=null&&B.option&&R({type:"add",payload:{value:B.option.title,type:c.name}})}):M==="clear"?(m([]),R({type:"clear",payload:t})):M==="removeOption"&&(m(V),B!=null&&B.option&&R({type:"remove",payload:{value:B.option.title,type:c.name}}))},j=()=>{E(),r()};return l(J1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>o(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:j,formId:L2,children:[n(I,{paragraph:!0,sx:{marginBottom:Z=>Z.spacing(2.5)},children:"Tags allow you to group features together"}),n("form",{id:L2,onSubmit:()=>o(f),children:l(bo,{children:[n(La,{options:i,disabled:s||i.length===0,value:c,onChange:O},s?"loading":i.length),n(w,{condition:!s&&i.length===0,show:l(I,{variant:"body1",children:["No"," ",n(d2,{component:R1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:n(Ma,{disabled:s,options:D,existingTags:t,indeterminateOptions:g,tagType:c,selectedOptions:h,onChange:S})})]})})]})},xo=({projectId:e,data:t})=>{const{bulkUpdateTags:a}=fn(),{refetch:r}=x1(e),{setToastData:o,setToastApiError:i}=d1(),{trackEvent:s}=P1(),[c,u]=d.useState(!1),[h,m]=d.useMemo(()=>{const y=t.flatMap(({tags:C})=>C||[]).reduce((C,b)=>[...C,...C.some(D=>D.type===b.type&&D.value===b.value)?[]:[b]],[]),_=y.filter(C=>!t.every(({tags:b})=>b==null?void 0:b.some(D=>D.type===C.type&&D.value===C.value)));return[y,_]},[t]);return l(Q,{children:[n(ae,{projectId:e,permission:gt,children:({hasAccess:y})=>n(u1,{disabled:!y||c,variant:"outlined",size:"small",onClick:()=>u(!0),children:"Tags"})}),n(_o,{open:c,onCancel:()=>u(!1),onSubmit:async({addedTags:y,removedTags:_})=>{const C=t.map(({name:D})=>D),b={features:C,tags:{addedTags:y,removedTags:_}};try{await a(b,e),r();const D=y.length?`Added tags: ${y.map(({type:R,value:E})=>`${R}:${E}`).join(", ")}.`:"",f=_.length?`Removed tags: ${_.map(({type:R,value:E})=>`${R}:${E}`).join(", ")}.`:"";o({title:"Tags updated",text:`${C.length} feature toggles updated. ${D} ${f}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(D){i(p1(D))}u(!1)},initialValues:h,initialIndeterminateValues:m},t.length)]})},wo=p(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),W2=p(_1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),So=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOff:u}=M3(),{addChange:h}=Pe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=d1(),{isChangeRequestConfigured:_}=Fe(i),{refetch:C}=je(i),b=t.filter(E=>{var O,L;return((L=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:L.enabled)===!1}).length,D=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await h(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!1}}))),C(),y({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),a(),r==null||r()}catch(E){g(p1(E))}},R=_(s)?"Add to change request":"Disable toggles";return n(J1,{open:e,title:"Disable feature toggles",onClose:a,onClick:f,primaryButtonText:R,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to disable.",n("br",{}),n("br",{}),n(I,{children:"Select which environment to disable the features for:"}),n(wo,{options:D(),value:s,onChange:E=>c(E)}),n(w,{condition:_(s),show:n(W2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(w,{condition:b>0,show:l(W2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},To=p(ft)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),q2=p(_1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Eo=({showExportDialog:e,data:t,onClose:a,onConfirm:r,environments:o,projectId:i})=>{const[s,c]=d.useState(o[0]),{bulkToggleFeaturesEnvironmentOn:u}=M3(),{addChange:h}=Pe(),{refetch:m}=x1(i),{setToastApiError:g,setToastData:y}=d1(),{isChangeRequestConfigured:_}=Fe(i),{refetch:C}=je(i),b=t.filter(E=>{var O,L;return((L=(O=E.environments)==null?void 0:O.find(S=>s===S.name))==null?void 0:L.enabled)===!0}).length,D=()=>o.map(E=>({key:E,label:E})),f=async()=>{try{_(s)?(await h(i,s,t.map(E=>({action:"updateEnabled",feature:E.name,payload:{enabled:!0}}))),C(),y({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await u(i,t.map(E=>E.name),s),m(),y({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),a(),r==null||r()}catch(E){g(p1(E))}},R=_(s)?"Add to change request":"Enable toggles";return n(J1,{open:e,title:"Enable feature toggles",onClose:a,onClick:f,primaryButtonText:R,secondaryButtonText:"Cancel",children:l(T,{children:["You have selected ",n("b",{children:t.length})," feature toggles to enable.",n("br",{}),n("br",{}),n(I,{children:"Select which environment to enable the features for:"}),n(To,{options:D(),value:s,onChange:E=>c(E)}),n(w,{condition:_(s),show:n(q2,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(w,{condition:b>0,show:l(q2,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},Ao=({selectedIds:e,data:t,projectId:a})=>{var D,f;const{uiConfig:r}=h1(),[o,i]=d.useState(!1),[s,c]=d.useState(!1),[u,h]=d.useState(!1),{trackEvent:m}=P1(),g=d.useMemo(()=>t.filter(R=>e.includes(R.name)),[t,e]),y=d.useMemo(()=>{const R=g.flatMap(E=>E.environments).map(E=>E==null?void 0:E.name).filter(E=>E!==void 0);return Array.from(new Set(R))},[g]),_=()=>{m("batch_operations",{props:{eventType:"features exported"}})},C=()=>{m("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{m("batch_operations",{props:{eventType:"features disabled"}})};return l(Q,{children:[n(w,{condition:!!((D=r==null?void 0:r.flags)!=null&&D.disableBulkToggle),show:null,elseShow:n(u1,{variant:"outlined",size:"small",onClick:()=>c(!0),children:"Enable"})}),n(w,{condition:!!((f=r==null?void 0:r.flags)!=null&&f.disableBulkToggle),show:null,elseShow:n(u1,{variant:"outlined",size:"small",onClick:()=>h(!0),children:"Disable"})}),n(vo,{projectId:a,features:e}),n(u1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),n(xo,{projectId:a,data:g}),n(yo,{projectId:a,data:g}),n(H3,{showExportDialog:o,data:g,onClose:()=>i(!1),environments:y,onConfirm:_}),n(Eo,{showExportDialog:s,data:g,onClose:()=>c(!1),environments:y,projectId:a,onConfirm:C}),n(So,{showExportDialog:u,data:g,onClose:()=>h(!1),environments:y,projectId:a,onConfirm:b})]})},ko=p(N3)(()=>({whiteSpace:"nowrap"})),Do=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...G1,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Ue=["Select","Actions","name","favorite"],Ro={id:"createdAt"},Po=({features:e,loading:t,environments:a=[]})=>{var Z1,te;const{classes:r}=fo(),o=m1(),i=C1(o.breakpoints.down("md")),[s,c]=d.useState({open:!1,featureId:"",environmentName:""}),[u,h]=d.useState({}),[m,g]=d.useState(),y=K("projectId"),{value:_,setValue:C}=pt(`${y}:FeatureToggleListTable:v1`,Ro),{value:b,setValue:D}=g0(),f=F1(),[R,E]=u2(),O=Ur(t?[{environment:"a"},{environment:"b"},{environment:"c"}]:a),{refetch:L}=x1(y),{isFavoritesPinned:S,sortTypes:j,onChangeIsFavoritePinned:Z}=f0(R.has("favorites")?R.get("favorites")==="true":b.favorites),{favorite:V,unfavorite:M}=v0(),{onChangeRequestToggleClose:B,onChangeRequestToggleConfirm:J,changeRequestDialogDetails:U}=Ha(y),[v,x]=d.useState(!1),{uiConfig:$}=h1(),F=d.useCallback(async P=>{P!=null&&P.favorite?await M(y,P.name):await V(y,P.name),L()},[y,L]),W=d.useMemo(()=>e.some(P=>{var N;return(N=P==null?void 0:P.tags)==null?void 0:N.length}),[e]),k=d.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:P})=>n(l2,{...P()}),Cell:({row:P})=>{var N;return n(y0,{...(N=P==null?void 0:P.getToggleRowSelectedProps)==null?void 0:N.call(P)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:n(b0,{isActive:S,onClick:Z}),accessor:"favorite",Cell:({row:{original:P}})=>n(C0,{value:P==null?void 0:P.favorite,onClick:()=>F(P)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:W3,sortType:"date",align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:q3,align:"center",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:P})=>n(H1,{title:P,arrow:!0,describeChild:!0,children:n("span",{children:n(U3,{title:P,to:`/projects/${y}/features/${P}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...W?[{id:"tags",Header:"Tags",accessor:P=>{var N;return((N=P.tags)==null?void 0:N.map(({type:r1,value:q})=>`${r1}:${q}`).join(`
2
2
  `))||""},Cell:_0,width:80,searchable:!0}]:[],{Header:"Created",accessor:"createdAt",Cell:vt,sortType:"date",minWidth:120},...O.map(P=>{const N=typeof P=="string"?P:P.environment;return{Header:t?()=>"":N,maxWidth:90,id:`environments.${N}`,accessor:r1=>{var q;return(q=r1.environments[N])==null?void 0:q.enabled},align:"center",Cell:({value:r1,row:{original:q}})=>{const g1=q.someEnabledEnvironmentHasVariants&&q.environments[N].variantCount===0&&q.environments[N].enabled;return l(Do,{hasWarning:g1,children:[n(Na,{value:r1,projectId:y,featureId:q.name,environmentName:N}),n(w,{condition:g1,show:n(Wa,{})})]})},sortType:"boolean",filterName:N,filterParsing:r1=>r1?"enabled":"disabled"}}),{id:"Actions",maxWidth:56,width:56,Cell:P=>n(ao,{projectId:y,onOpenArchiveDialog:g,onOpenStaleDialog:h,...P}),disableSortBy:!0,hideInMenu:!0}],[y,O,t]),[H,l1]=d.useState(R.get("search")||""),f1=d.useMemo(()=>e.map(P=>{var N;return{...P,environments:Object.fromEntries(O.map(r1=>{const q=P==null?void 0:P.environments.find(g1=>(g1==null?void 0:g1.name)===r1);return[r1,{name:r1,enabled:(q==null?void 0:q.enabled)||!1,variantCount:(q==null?void 0:q.variantCount)||0}]})),someEnabledEnvironmentHasVariants:((N=P.environments)==null?void 0:N.some(r1=>r1.variantCount>0&&r1.enabled))||!1}}),[e,O]),{data:v1,getSearchText:B1,getSearchContext:Ce}=yt(k,H,f1),A1=d.useMemo(()=>t?Array(6).fill({type:"-",name:"Feature name",createdAt:new Date,environments:{production:{name:"production",enabled:!1}}}):v1,[t,v1]),Ve=d.useMemo(()=>{var r1;const P=k.map(q=>(q==null?void 0:q.id)||(typeof(q==null?void 0:q.accessor)=="string"?q==null?void 0:q.accessor:"")).filter(Boolean);let N=O.filter((q,g1)=>g1>=3).map(q=>`environments.${q}`);if(R.has("columns")){const q=((r1=R.get("columns"))==null?void 0:r1.split(","))||[],g1=[...Ue,...q];N=P.filter(A=>!g1.includes(A))}else if(_.columns){const q=[...Ue,..._.columns];N=P.filter(g1=>!q.includes(g1))}return{sortBy:[{id:R.get("sort")||"createdAt",desc:R.has("order")?R.get("order")==="desc":_.desc}],hiddenColumns:N,selectedRowIds:{}}},[O]),Le=d.useCallback(P=>P.name,[]),{allColumns:_e,headerGroups:ee,rows:z1,state:{selectedRowIds:j1,sortBy:V1,hiddenColumns:W1},prepareRow:Me,setHiddenColumns:He}=t1.useTable({columns:k,data:A1,initialState:Ve,sortTypes:j,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:Le},t1.useFlexLayout,t1.useSortBy,t1.useRowSelect);return d.useEffect(()=>{if(t)return;const P={};P.sort=V1[0].id,V1[0].desc&&(P.order="desc"),H&&(P.search=H),S&&(P.favorites="true"),P.columns=_e.map(({id:N})=>N).filter(N=>!Ue.includes(N)&&!(W1!=null&&W1.includes(N))).join(","),E(P,{replace:!0}),C(N=>({...N,id:V1[0].id,desc:V1[0].desc||!1,columns:P.columns.split(",")})),D(N=>({...N,favorites:!!S}))},[t,V1,W1,H,E,S]),l(Q,{children:[l(i1,{isLoading:t,className:r.container,header:n(n1,{titleElement:`Feature toggles (${z1.length})`,actions:l(Q,{children:[n(w,{condition:!i,show:n(D1,{initialValue:H,onChange:l1,hasFilters:!0,getSearchContext:Ce})}),n(go,{allColumns:_e,staticColumns:Ue,dividerAfter:["createdAt"],dividerBefore:["Actions"],isCustomized:!!_.columns,setHiddenColumns:He}),n(n1.Divider,{sx:{marginLeft:0}}),n(w,{condition:!!((Z1=$==null?void 0:$.flags)!=null&&Z1.featuresExportImport),show:n(H1,{title:"Export toggles visible in the table below",arrow:!0,children:n(N1,{onClick:()=>x(!0),sx:P=>({marginRight:P.spacing(2)}),children:n(x0,{})})})}),n(ko,{onClick:()=>f(w0(y)),maxWidth:"960px",Icon:G3,projectId:y,permission:c2,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:n(w,{condition:i,show:n(D1,{initialValue:H,onChange:l1,hasFilters:!0,getSearchContext:Ce})})}),children:[n(ue,{value:B1(H),children:n(bt,{rows:z1,headerGroups:ee,prepareRow:Me})}),n(w,{condition:z1.length===0,show:n(w,{condition:(H==null?void 0:H.length)>0,show:l(w1,{children:["No feature toggles found matching “",H,"”"]}),elseShow:n(w1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})}),n(qa,{onClose:()=>c(P=>({...P,open:!1})),projectId:y,...s}),n(Ua,{isStale:u.stale===!0,isOpen:!!u.featureId,onClose:()=>{h({}),L()},featureId:u.featureId||"",projectId:y}),n(gn,{isOpen:!!m,onConfirm:()=>{L()},onClose:()=>{g(void 0)},featureIds:[m||""],projectId:y})," ",n(Ga,{isOpen:U.isOpen,onClose:B,environment:U==null?void 0:U.environment,onConfirm:J,messageComponent:n(Ka,{featureName:U.featureName,enabled:U.enabled,environment:U==null?void 0:U.environment})}),n(w,{condition:!!((te=$==null?void 0:$.flags)!=null&&te.featuresExportImport)&&!t,show:n(H3,{showExportDialog:v,data:A1,onClose:()=>x(!1),environments:O})})]}),n(S0,{count:Object.keys(j1).length,children:n(Ao,{selectedIds:Object.keys(j1),data:e,projectId:y})})]})},Oe=p("div")(({theme:e})=>({margin:"0",textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",minWidth:225,padding:e.spacing(3),[e.breakpoints.down("md")]:{display:"flex",flexDirection:"column",position:"relative",padding:e.spacing(1.5)}})),$e=p("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),_2=p("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),St=({children:e,to:t})=>n(I,{variant:"body2",textAlign:"center",sx:{paddingTop:a=>a.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:n(d2,{component:R1,to:t,children:e})}),Fo=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),jo=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),Zo=({projectId:e,health:t})=>l(Oe,{children:[n($e,{"data-loading":!0,children:"Project health"}),l(T,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:a=>a.spacing(2)},children:[n(jo,{children:n(T0,{percentage:t})}),l(Fo,{"data-loading":!0,children:[t,"%"]})]}),n(St,{to:`/projects/${e}/health`,children:"View project health"})]}),Io=p(_2)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),Oo=p("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),width:"100%",gridTemplateColumns:`${e.spacing(2.5)} auto auto`,margin:e.spacing(1,0),fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,alignItems:"center",[e.breakpoints.down("md")]:{margin:0}})),$o=({type:e,Icon:t,count:a})=>l(Oo,{"data-loading":!0,children:[n(t,{fontSize:"small","data-loading":!0}),n("div",{children:(o=>o.charAt(0).toUpperCase()+o.slice(1).replace("-"," "))(e)}),n(Io,{children:a})]}),Bo=({features:e})=>{const t=d.useMemo(()=>{const a=(e==null?void 0:e.filter(c=>c.type==="release").length)||0,r=(e==null?void 0:e.filter(c=>c.type==="experiment").length)||0,o=(e==null?void 0:e.filter(c=>c.type==="operational").length)||0,i=(e==null?void 0:e.filter(c=>c.type==="kill-switch").length)||0,s=(e==null?void 0:e.filter(c=>c.type==="permission").length)||0;return{release:a,experiment:r,operational:o,"kill-switch":i,permission:s}},[e]);return l(Oe,{sx:{padding:a=>a.spacing(3)},children:[n($e,{children:"Toggle types used"}),Object.keys(t).map(a=>n($o,{type:a,Icon:E0(a),count:t[a]},a))]})},zo=p("div")(({theme:e})=>({textAlign:"left",borderRadius:`${e.shape.borderRadius}px`,backgroundColor:`${e.palette.background.elevation2}`,padding:e.spacing(.5,2),fontSize:e.typography.body2.fontSize})),Vo=({id:e,description:t})=>l(Oe,{children:[n($e,{children:"Project Meta"}),l(zo,{children:[n(I,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",n("code",{"data-loading":!0,children:e||"__________"})]}),n(w,{condition:!!t,show:n(I,{variant:"body2",sx:{marginTop:a=>a.spacing(1.5),marginBottom:0,textAlign:"left"},children:t})}),n(w,{condition:!t,show:n(St,{to:`/projects/${e}/edit`,children:"Add description"})})]}),Lo=p(I)(({theme:e})=>({marginBottom:e.spacing(2.5)})),Mo=p(T)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),It=p(T)(({theme:e})=>({...G1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),U2=p(I)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),Ho=p(I)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),No=e=>e>0?n(fr,{sx:{color:"success.dark",height:20,width:20}}):n(Cr,{sx:{color:"warning.dark",height:20,width:20}}),Wo=e=>e>0?"success.dark":"warning.dark",Se=({title:e,boxText:t,change:a,percentage:r,children:o,customChangeElement:i})=>l(Q,{children:[n(w,{condition:!!e,show:n(Lo,{children:e})}),o,l(T,{sx:{...G1,justifyContent:"center",width:"auto"},children:[n(Mo,{children:t}),n(w,{condition:!!i,show:n(It,{children:i}),elseShow:n(w,{condition:a!==void 0&&a!==0,show:l(It,{children:[l(T,{sx:{...G1},children:[No(a),l(Ho,{color:Wo(a),children:[a>0?"+":"",a,r?"%":""]})]}),n(U2,{children:"this month"})]}),elseShow:n(It,{children:n(U2,{children:"No change"})})})})]})]}),qo=({projectId:e,memberCount:t,change:a=0})=>{var i,s;const{uiConfig:r}=h1();let o="/admin/users";return(s=(i=r==null?void 0:r.versionInfo)==null?void 0:i.current)!=null&&s.enterprise&&(o=`/projects/${e}/settings/access`),l(Oe,{children:[n($e,{"data-loading":!0,children:"Project members"}),n(T,{sx:{display:"flex",justifyContent:"center"},children:n(Se,{boxText:`${t}`,change:a})}),n(St,{to:o,children:"View all members"})]})},Uo=e=>fetch(e).then(Q1("ChangeRequest")).then(t=>t.json()),xn=e=>{const{data:t,error:a,mutate:r}=A0([],Y1(`api/admin/projects/${e}/change-requests`),Uo);return d.useMemo(()=>({changeRequests:t,loading:!a&&!t,refetch:r,error:a}),[t,a,r])},Je="change-requests-widget",Go=p(T)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),G2=p(T)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),K2=p(T)(({theme:e})=>({display:"flex",alignItems:"center"})),Ko=p(_2)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),Jo=p(_2)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),J2=p(I)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),Y2=()=>n(I,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":Je,children:"change requests"}),Yo=({projectId:e})=>{const{changeRequests:t,loading:a}=xn(e),r=K3(a,`[data-loading="${Je}"]`),o=t==null?void 0:t.filter(s=>(s==null?void 0:s.state)==="Approved").length,i=t==null?void 0:t.filter(s=>(s==null?void 0:s.state)==="In review").length;return l(Oe,{ref:r,children:[n($e,{children:"Open change requests"}),l(Go,{children:[l(G2,{sx:{background:s=>s.palette.success.light},children:[n(J2,{children:"To be applied"}),l(K2,{children:[n(Ko,{"data-loading":Je,children:o||0})," ",n(Y2,{})]})]}),l(G2,{sx:{background:s=>s.palette.secondary.light},children:[n(J2,{children:"To be reviewed"}),l(K2,{children:[n(Jo,{"data-loading":Je,children:i||0})," ",n(Y2,{})]})]})]}),n(St,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},Qo=p(T)(({theme:e})=>({...G1,width:"225px",flexDirection:"column",gap:e.spacing(2),boxShadow:"none",[e.breakpoints.down("md")]:{display:"grid",width:"100%",alignItems:"stretch",marginBottom:e.spacing(2)},[e.breakpoints.down("sm")]:{display:"flex"}})),Xo=({id:e,description:t,memberCount:a,health:r,features:o,stats:i})=>{const{isEnterprise:s}=h1(),c=m1(),u=C1(c.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:h}=Fe(e),m=s()&&h(),g=e!==k0;return n("aside",{children:l(Qo,{sx:!m&&!g||u&&m&&g?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[n(w,{condition:m,show:n(T,{sx:{gridColumnStart:g?"span 2":"span 1",flex:1,display:"flex"},children:n(Yo,{projectId:e})})}),n(Vo,{id:e,description:t}),n(Zo,{projectId:e,health:r}),n(w,{condition:g,show:n(qo,{projectId:e,memberCount:a,change:i==null?void 0:i.projectMembersAddedCurrentWindow})}),n(Bo,{features:o})]})})},ei=p(I1)(({theme:e})=>({padding:e.spacing(3,3),maxWidth:"350px",borderRadius:`${e.shape.borderRadiusMedium}px`,border:`1px solid ${e.palette.neutral.border}`,fontSize:e.typography.body2.fontSize})),Q2=({children:e,id:t})=>{const[a,r]=d.useState(null),o=c=>r(c.currentTarget),i=()=>r(null);return l(T,{sx:{position:"absolute",top:c=>c.spacing(.5),right:c=>c.spacing(.5)},children:[n(N1,{onClick:o,"aria-describedby":t,size:"small",children:n(J3,{sx:{fontSize:c=>c.typography.body1.fontSize}})}),n(Y3,{id:t,open:!!a,anchorEl:a,sx:c=>({zIndex:c.zIndex.tooltip}),children:n(Q3,{onClickAway:i,children:l(ei,{elevation:3,children:[n(N1,{onClick:i,sx:{position:"absolute",right:4,top:4},children:n(D0,{sx:{fontSize:c=>c.typography.body1.fontSize}})}),e,n(R0,{id:t,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},ti=p(T)(({theme:e})=>({padding:e.spacing(0,0,2,2),display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(4, 1fr)",flexWrap:"wrap",[e.breakpoints.down("lg")]:{gridTemplateColumns:"repeat(2, 1fr)"},[e.breakpoints.down("md")]:{padding:e.spacing(0,0,2)},[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Ge=p(T)(({theme:e})=>({position:"relative",padding:e.spacing(3),backgroundColor:e.palette.background.paper,flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:`${e.shape.borderRadiusLarge}px`,[e.breakpoints.down("lg")]:{padding:e.spacing(2)}})),ni=p(I)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),ai=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:t,projectActivityCurrentWindow:a,projectActivityPastWindow:r,createdCurrentWindow:o,createdPastWindow:i,archivedCurrentWindow:s,archivedPastWindow:c}=e;return l(ti,{children:[n(Ge,{children:n(Se,{title:"Total changes",boxText:String(a),change:a-r,children:n(Q2,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),n(Ge,{children:n(Se,{title:"Avg. time to production",boxText:l(T,{sx:{display:"flex",alignItems:"center",gap:u=>u.spacing(1)},children:[t," ",n(I,{component:"span",children:"days"})]}),customChangeElement:n(ni,{children:"In project life"}),percentage:!0,children:n(Q2,{id:"avg-time-to-prod",children:'How long did it take on average from a feature toggle was created until it was enabled in an environment of type production. This is calculated only from feature toggles with the type of "release".'})})}),n(Ge,{children:n(Se,{title:"Features created",boxText:String(o),change:o-i})}),n(Ge,{children:n(Se,{title:"Features archived",boxText:String(s),change:s-c})})]})},ri=15*1e3,oi=p("div")(({theme:e})=>({display:"flex",[e.breakpoints.down("md")]:{flexDirection:"column"}})),ii=p("div")(()=>({width:"100%",minWidth:0})),si=p(T)(()=>({display:"flex",flexDirection:"column",width:"100%",minWidth:0})),ci=()=>{const e=K("projectId"),t=E1(e),{project:a,loading:r}=x1(e,{refreshInterval:ri}),{members:o,features:i,health:s,description:c,environments:u,stats:h}=a;T1(`Project overview – ${t}`);const{setLastViewed:m}=P0();return d.useEffect(()=>{m(e)},[e,m]),l(oi,{children:[n(Xo,{id:e,description:c,memberCount:o,health:s,features:i,stats:h}),l(si,{children:[n(ai,{stats:a.stats}),n(ii,{children:n(Po,{features:i,environments:u,loading:r})})]})]})},li=(e,t)=>{const a=Y1(`api/admin/projects/${e}/health-report`),{data:r,error:o}=de(a,di,t),i=d.useCallback(()=>{X3(a).catch(console.warn)},[a]);return{healthReport:r,refetchHealthReport:i,loading:!o&&!r,error:o}},di=e=>fetch(e).then(Q1("Health report")).then(t=>t.json());var x2={},ui=De;Object.defineProperty(x2,"__esModule",{value:!0});var Qt=x2.default=void 0,pi=ui(ke()),hi=Re,mi=(0,pi.default)((0,hi.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");Qt=x2.default=mi;const gi=p(T)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),X2=p(T)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),fi=p(I1)(({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)}})),Ot=p("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1)})),vi=p("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),yi=p("p")(({theme:e})=>({color:e.palette.text.secondary})),e3=p("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),t3=p("p")(({theme:e})=>({marginLeft:e.spacing(4)})),bi=({healthReport:e})=>{const t=e.health<50?"error.main":e.health<75?"warning.main":"success.main",a=()=>l(gi,{children:[n(F0,{}),l("span",{children:[e.activeCount," active toggles"]})]}),r=()=>l(X2,{children:[n(Qt,{}),l("span",{children:[e.staleCount," stale toggles"]})]}),o=()=>l(X2,{children:[n(Qt,{}),l("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]});return l(fi,{children:[l(T,{children:[n(Ot,{children:"Health rating"}),n(w,{condition:e.health>-1,show:l(Q,{children:[l(vi,{sx:{color:t},children:[e.health,"%"]}),l(yi,{children:["Last updated:"," ",n(p2,{date:e.updatedAt,live:!1})]})]})})]}),l(T,{children:[n(Ot,{children:"Toggle report"}),l(e3,{children:[n("li",{children:n(w,{condition:!!e.activeCount,show:a})}),n(w,{condition:!!e.activeCount,show:n(t3,{children:"Also includes potentially stale toggles."})}),n("li",{children:n(w,{condition:!!e.staleCount,show:r})})]})]}),l(T,{sx:{flexBasis:"40%"},children:[n(Ot,{children:"Potential actions"}),n(e3,{children:n("li",{children:n(w,{condition:!!e.potentiallyStaleCount,show:o})})}),n(w,{condition:!!e.potentiallyStaleCount,show:n(t3,{children:"Review your feature toggles and delete unused toggles."}),elseShow:n("span",{children:"No action is required"})})]})]})},Ci=({row:e})=>{const t=m1();return e.original.expiredAt?n(vt,{value:e.original.expiredAt}):n(c1,{children:n(I,{variant:"body2",color:t.palette.text.secondary,children:"N/A"})})},_i=p("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),xi=p("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),wi=({row:e})=>e.original.status==="potentially-stale"?n(c1,{children:l(_i,{children:[n(br,{}),n("span",{children:"Potentially stale"})]})}):n(c1,{children:l(xi,{children:[n(en,{}),n("span",{children:"Healthy"})]})}),n3=40,Si=7,wn={[Z0]:n3,[I0]:n3,[O0]:Si},Sn=(e,t)=>Math.abs(j0(e,t)),Tn=(e,t)=>e>=wn[t],Ti=e=>{const{type:t,createdAt:a}=e,r=tn(a),i=Sn(r,new Date);return Tn(i,t)&&t!==nn&&t!==an?"potentially-stale":"healthy"},Ei=e=>{const{type:t,createdAt:a}=e;if(t===nn||t===an)return;const r=tn(a),o=new Date,i=Sn(r,o);if(Tn(i,t)){const s=i-wn[t];return _r(o,s).toISOString()}},Ai=({projectId:e,features:t})=>{const a=m1(),r=C1(a.breakpoints.down("sm")),o=C1(a.breakpoints.down("md")),i=C1(a.breakpoints.down("lg")),s=d.useMemo(()=>t.map(b=>({project:e,name:b.name,type:b.type,stale:b.stale,status:Ti(b),lastSeenAt:b.lastSeenAt,createdAt:b.createdAt,expiredAt:Ei(b)})),[e,t]),c=d.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt"}]}),[]),{headerGroups:u,rows:h,prepareRow:m,state:{globalFilter:g},setGlobalFilter:y,setHiddenColumns:_}=t1.useTable({columns:a3,data:s,initialState:c,sortTypes:Ze,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},t1.useGlobalFilter,t1.useFlexLayout,t1.useSortBy);Ct([{condition:r,columns:["stale"]},{condition:o,columns:["expiredAt","lastSeenAt"]},{condition:i,columns:["createdAt"]}],_,a3);const C=h.length<s.length?`Feature toggles (${h.length} of ${s.length})`:`Feature toggles (${s.length})`;return l(i1,{header:n(n1,{title:C,actions:n(D1,{initialValue:g,onChange:y})}),children:[n(ue,{value:g,children:n(bt,{headerGroups:u,prepareRow:m,rows:h})}),n(w,{condition:h.length===0,show:n(w,{condition:(g==null?void 0:g.length)>0,show:l(w1,{children:["No feature toggles found matching “",g,"”"]}),elseShow:n(w1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},a3=[{Header:"Seen",accessor:"lastSeenAt",sortType:"date",align:"center",Cell:W3,disableGlobalFilter:!0,maxWidth:85},{Header:"Type",accessor:"type",align:"center",Cell:q3,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:$0,minWidth:120},{Header:"Created",accessor:"createdAt",sortType:"date",Cell:vt,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Ci,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:wi,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:B0,disableGlobalFilter:!0,maxWidth:120}],ki=()=>{const e=K("projectId"),t=E1(e);T1(`Project health – ${t}`);const{healthReport:a,refetchHealthReport:r,error:o}=li(e,{refreshInterval:15*1e3});return a?l("div",{children:[n(w,{condition:!!o,show:n($3,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:r,text:`Could not fetch health rating for ${e}`})}),n(bi,{healthReport:a}),n(Ai,{projectId:e,features:a.features})]}):null},Di=p("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),Ri=()=>{const e=K("projectId");return n(Di,{children:n(z0,{title:"Event Log",project:e,displayInline:!0})})},En=(e,t)=>{const{data:a,error:r,mutate:o}=de(Y1(`api/admin/projects/${e}/change-requests/${t}`),Pi,{refreshInterval:15e3});return{data:a,loading:!r&&!a,refetchChangeRequest:()=>o(),error:r}},Pi=e=>fetch(e).then(Q1("Request changes")).then(t=>t.json()),Fi=p(I1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));p(T)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const ji=p(T)(({theme:e})=>({display:"flex",alignItems:"center"})),Zi=p(I)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),Ii=p(V0)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),An=p(_t)(({theme:e})=>({height:"24px",width:"24px"})),Oi=({changeRequest:e})=>{var r,o,i;const[t,a]=d.useState(e.title);return l(Fi,{elevation:0,children:[n(L0,{environmentChangeRequest:e,title:t,setTitle:a,children:n(Zi,{variant:"h1",sx:{mr:1.5},children:t})}),l(ji,{children:[n(rn,{state:e.state}),l(I,{variant:"body2",sx:s=>({margin:s.spacing("auto",0,"auto",2)}),children:["Created"," ",n(p2,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),n(T,{sx:s=>({marginLeft:s.spacing(1)}),children:n(H1,{title:(r=e==null?void 0:e.createdBy)==null?void 0:r.username,children:n(An,{src:(o=e==null?void 0:e.createdBy)==null?void 0:o.imageUrl})})}),n(I,{variant:"body2",sx:s=>({marginLeft:s.spacing(.5)}),children:(i=e==null?void 0:e.createdBy)==null?void 0:i.username}),n(T,{sx:s=>({marginLeft:s.spacing(1.5)}),children:n(Ii,{variant:"outlined",children:l(I,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",n(I,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",n(M0,{})," Updates:"," ",l(I,{variant:"body2",display:"inline",fontWeight:"bold",component:"span",children:[e.features.length," ",e.features.length===1?"feature toggle":"feature toggles"]})]})})})]})]})};function o1(){return o1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},o1.apply(this,arguments)}function ve(e,t){if(e==null)return{};var a={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(a[o]=e[o]);return a}const $i=d.createContext({}),nt=$i;function Bi(e){return pe("MuiTimeline",e)}X1("MuiTimeline",["root","positionLeft","positionRight","positionAlternate"]);const zi=["position","className"],Vi=e=>{const{position:t,classes:a}=e,r={root:["root",t&&`position${O1(t)}`]};return ge(r,Bi,a)},Li=p("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,a.position&&t[`position${O1(a.position)}`]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),Mi=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimeline"}),{position:o="right",className:i}=r,s=ve(r,zi),c=o1({},r,{position:o}),u=Vi(c),h=d.useMemo(()=>({position:o}),[o]);return n(nt.Provider,{value:h,children:n(Li,o1({className:me(u.root,i),ownerState:c,ref:a},s))})}),kn=Mi;function Hi(e){return pe("MuiTimelineContent",e)}const Ni=X1("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate"]),Wi=["className"],qi=e=>{const{position:t,classes:a}=e,r={root:["root",`position${O1(t)}`]};return ge(r,Hi,a)},Ui=p(I,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`position${O1(a.position)}`]]}})(({ownerState:e})=>o1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),Gi=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineContent"}),{className:o}=r,i=ve(r,Wi),{position:s}=d.useContext(nt),c=o1({},r,{position:s||"right"}),u=qi(c);return n(Ui,o1({component:"div",className:me(u.root,o),ownerState:c,ref:a},i))}),Dn=Gi,Ki=X1("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate"]),Ji=Ki;function Yi(e){return pe("MuiTimelineItem",e)}const Qi=X1("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","missingOppositeContent"]),Rn=Qi,Xi=["position","className"],e4=e=>{const{position:t,classes:a,hasOppositeContent:r}=e,o={root:["root",`position${O1(t)}`,!r&&"missingOppositeContent"]};return ge(o,Yi,a)},t4=p("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`position${O1(a.position)}`]]}})(({ownerState:e})=>o1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},e.position==="alternate"&&{"&:nth-of-type(even)":{flexDirection:"row-reverse",[`& .${Ni.root}`]:{textAlign:"right"},[`& .${Ji.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&:before":{content:'""',flex:1,padding:"6px 16px"}})),n4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineItem"}),{position:o,className:i}=r,s=ve(r,Xi),{position:c}=d.useContext(nt);let u=!1;d.Children.forEach(r.children,y=>{H0(y,["TimelineOppositeContent"])&&(u=!0)});const h=o1({},r,{position:o||c||"right",hasOppositeContent:u}),m=e4(h),g=d.useMemo(()=>({position:h.position}),[h.position]);return n(nt.Provider,{value:g,children:n(t4,o1({className:me(m.root,i),ownerState:h,ref:a},s))})}),Ye=n4;function a4(e){return pe("MuiTimelineSeparator",e)}X1("MuiTimelineSeparator",["root"]);const r4=["className"],o4=e=>{const{classes:t}=e;return ge({root:["root"]},a4,t)},i4=p("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),s4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineSeparator"}),{className:o}=r,i=ve(r,r4),s=r,c=o4(s);return n(i4,o1({className:me(c.root,o),ownerState:s,ref:a},i))}),Qe=s4;function c4(e){return pe("MuiTimelineDot",e)}X1("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const l4=["className","color","variant"],d4=e=>{const{color:t,variant:a,classes:r}=e,o={root:["root",a,t!=="inherit"&&`${a}${O1(t)}`]};return ge(o,c4,r)},u4=p("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.color!=="inherit"&&`${a.variant}${O1(a.color)}`],t[a.variant]]}})(({ownerState:e,theme:t})=>o1({display:"flex",alignSelf:"baseline",borderStyle:"solid",borderWidth:2,padding:4,borderRadius:"50%",boxShadow:(t.vars||t).shadows[1],margin:"11.5px 0"},e.variant==="filled"&&o1({borderColor:"transparent"},e.color!=="inherit"&&o1({},e.color==="grey"?{color:(t.vars||t).palette.grey[50],backgroundColor:(t.vars||t).palette.grey[400]}:{color:(t.vars||t).palette[e.color].contrastText,backgroundColor:(t.vars||t).palette[e.color].main})),e.variant==="outlined"&&o1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&o1({},e.color==="grey"?{borderColor:(t.vars||t).palette.grey[400]}:{borderColor:(t.vars||t).palette[e.color].main})))),p4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineDot"}),{className:o,color:i="grey",variant:s="filled"}=r,c=ve(r,l4),u=o1({},r,{color:i,variant:s}),h=d4(u);return n(u4,o1({className:me(h.root,o),ownerState:u,ref:a},c))}),Pn=p4;function h4(e){return pe("MuiTimelineConnector",e)}X1("MuiTimelineConnector",["root"]);const m4=["className"],g4=e=>{const{classes:t}=e;return ge({root:["root"]},h4,t)},f4=p("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),v4=d.forwardRef(function(t,a){const r=he({props:t,name:"MuiTimelineConnector"}),{className:o}=r,i=ve(r,m4),s=r,c=g4(s);return n(f4,o1({className:me(c.root,o),ownerState:s,ref:a},i))}),w2=v4,y4=p(I1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),b4=p(T)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),C4=p(kn)(()=>({[`& .${Rn.root}:before`]:{flex:0,padding:0}})),_4=({state:e})=>{const t=r=>["Draft","In review","Approved","Applied"].map(i=>({title:i,active:i===r}));return n(y4,{elevation:0,children:n(b4,{children:n(C4,{children:(()=>{const r=t(e),o=r.findIndex(s=>s.active),i=o!==-1?o:null;return e==="Cancelled"?w4(r):x4(r,i)})()})})})},x4=(e,t)=>e.map(({title:a},r)=>{const o=r<e.length-1,i=n(w,{condition:o,show:n(w2,{})});return t!==null&&t>=r?Xe("success",a,i):t!==null&&t+1===r?Xe("primary",a,i,{variant:"outlined"}):Xe("grey",a,i)}),w4=e=>e.map(({title:t},a)=>{const r=a<e.length-1;return Xe("grey",t,n(w,{condition:r,show:n(w2,{})}))}),Xe=(e,t,a,r={})=>l(Ye,{children:[l(Qe,{children:[n(Pn,{color:e,...r}),a]}),n(Dn,{children:t})]},t),S4=p(T)(({theme:e})=>({marginBottom:e.spacing(2)})),T4=({actualApprovals:e,minApprovals:t})=>l(Q,{children:["Reviewers"," ",l(I,{component:"span",color:"text.secondary",children:["(",e,"/",t," required)"]})]}),E4=({header:e,children:t})=>l(I1,{elevation:0,sx:a=>({marginTop:a.spacing(2),padding:a.spacing(4),borderRadius:r=>`${r.shape.borderRadiusLarge}px`}),children:[n(S4,{children:e}),n(I,{variant:"body1",color:"text.secondary",children:n(w,{condition:Te.Children.count(t)>0,show:"Approved by",elseShow:"No approvals yet"})}),t]}),S2=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",se=p(T)(({theme:e})=>({display:"flex",alignItems:"center"})),A4=p(on)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),r3=p(on)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),Xt=p(sn)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),k4=p(T)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),D4=p(T,{shouldForwardProp:S2()})(({theme:e,bgColor:t,svgColor:a})=>({borderRadius:`${e.shape.borderRadiusMedium}px`,backgroundColor:t,padding:e.spacing(1,2),marginRight:e.spacing(2),height:"45px",width:"45px",display:"flex",alignItems:"center",justifyContent:"center",svg:{color:a}})),Fn=p(V3)(({theme:e})=>({margin:e.spacing(2.5,0)})),R4=p(T,{shouldForwardProp:S2()})(({theme:e,border:t})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:t,padding:e.spacing(3),width:"100%"})),ce=p(I,{shouldForwardProp:S2()})(({theme:e,color:t})=>({fontWeight:"bold",color:t})),P4=(e,t)=>e==="Approved"?`2px solid ${t.palette.success.main}`:e==="Applied"?`2px solid ${t.palette.primary.main}`:`1px solid ${t.palette.divider}`,F4=(e,t)=>e==="Approved"?{bgColor:t.palette.success.main,svgColor:t.palette.background.paper}:e==="Applied"?{bgColor:t.palette.primary.main,svgColor:t.palette.background.paper}:{bgColor:t.palette.background.elevation2,svgColor:t.palette.neutral.main},j4=({changeRequest:e})=>{const t=m1();return l(k4,{children:[n(D4,{...F4(e.state,t),children:n(N0,{style:{transform:"scale(1.5)"}})}),n(R4,{sx:{backgroundColor:e.state==="In review"?t.palette.warning.light:"initial"},border:P4(e.state,t),children:n(Z4,{changeRequest:e})})]})},Z4=({changeRequest:e})=>{const{state:t}=e;return t?t==="Approved"?n(I4,{}):t==="Applied"?n($4,{}):t==="Cancelled"?n(B4,{}):n(O4,{minApprovals:e.minApprovals}):null},I4=()=>{const e=m1();return l(Q,{children:[l(se,{children:[n(Xt,{}),l(T,{children:[n(ce,{color:e.palette.success.dark,children:"Changes approved"}),n(I,{children:"One approving review from requested approvers"})]})]}),n(Fn,{}),l(se,{children:[n(Xt,{}),n(T,{children:n(ce,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},O4=({minApprovals:e})=>{const t=m1();return l(Q,{children:[l(se,{children:[n(r3,{}),l(T,{children:[n(ce,{color:t.palette.warning.dark,children:"Review required"}),l(I,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),n(Fn,{}),l(se,{children:[n(r3,{}),n(ce,{color:t.palette.warning.dark,children:"Apply changes is blocked"})]})]})},$4=()=>{const e=m1();return n(Q,{children:l(se,{children:[n(Xt,{sx:{color:e.palette.primary.main}}),n(T,{children:n(ce,{color:e.palette.primary.main,children:"Changes applied"})})]})})},B4=()=>{const e=m1();return n(Q,{children:l(se,{children:[n(A4,{}),n(T,{children:n(ce,{color:e.palette.error.main,children:"Changes cancelled"})})]})})};var T2={},z4=De;Object.defineProperty(T2,"__esModule",{value:!0});var jn=T2.default=void 0,V4=z4(ke()),L4=Re,M4=(0,V4.default)((0,L4.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");jn=T2.default=M4;const H4=({disabled:e})=>{const{isAdmin:t}=d.useContext($1),a=K("projectId"),r=K("id"),{user:o}=cn(),{refetchChangeRequest:i,data:s}=En(a,r),{refetch:c}=je(a),{setToastApiError:u,setToastData:h}=d1(),{changeState:m}=Pe(),[g,y]=Te.useState(!1),_=Te.useRef(null),C=async()=>{try{await m(a,Number(r),{state:"Approved"}),i(),c(),h({type:"success",title:"Success",text:"Changes approved"})}catch(f){u(p1(f))}},b=()=>{y(f=>!f)},D=f=>{_.current&&_.current.contains(f.target)||y(!1)};return l(Te.Fragment,{children:[n(Ie,{variant:"contained",disabled:e||(s==null?void 0:s.createdBy.id)===(o==null?void 0:o.id)&&!t,"aria-controls":g?"review-options-menu":void 0,"aria-expanded":g?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:b,ref:_,endIcon:n(jn,{}),permission:W0,projectId:a,environmentId:s==null?void 0:s.environment,children:"Review changes"}),n(Y3,{sx:{zIndex:1},open:g,anchorEl:_.current,role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:f,placement:R})=>n(q0,{...f,style:{transformOrigin:R==="bottom"?"center top":"center bottom"},children:n(I1,{className:"dropdown-outline",children:n(Q3,{onClickAway:D,children:n(mt,{id:"review-options-menu",autoFocusItem:!0,children:n(U1,{onClick:C,children:"Approve changes"})})})})})})]})},N4=p(T)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),W4=p(sn)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),q4=({name:e,imageUrl:t})=>l(N4,{children:[n(An,{src:t}),n(I,{variant:"body1",color:"text.primary",sx:{maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"},children:e}),n(W4,{})]});var Zn={},E2={},A2={};Object.defineProperty(A2,"__esModule",{value:!0});var U4=d,G4=K4(U4);function K4(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}A2.default=function(e,t,a){return G4.createElement("a",{href:e,key:a},t)};var k2={};Object.defineProperty(k2,"__esModule",{value:!0});k2.default=function(e){return e};var D2={},$t,o3;function J4(){return o3||(o3=1,$t=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),$t}var Bt,i3;function Y4(){return i3||(i3=1,Bt=/[\0-\x1F\x7F-\x9F]/),Bt}var zt,s3;function Q4(){return s3||(s3=1,zt=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),zt}var Vt,c3;function X4(){return c3||(c3=1,Vt=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/),Vt}var Lt,l3;function es(){return l3||(l3=1,Lt=function(e){var t={};t.src_Any=J4().source,t.src_Cc=Y4().source,t.src_Z=Q4().source,t.src_P=X4().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");var a="[><|]";return t.src_pseudo_letter="(?:(?!"+a+"|"+t.src_ZPCc+")"+t.src_Any+")",t.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]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|"+a+"|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+a+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|"+a+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}),Lt}function e2(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach(function(a){a&&Object.keys(a).forEach(function(r){e[r]=a[r]})}),e}function Tt(e){return Object.prototype.toString.call(e)}function ts(e){return Tt(e)==="[object String]"}function ns(e){return Tt(e)==="[object Object]"}function as(e){return Tt(e)==="[object RegExp]"}function d3(e){return Tt(e)==="[object Function]"}function rs(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var In={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function os(e){return Object.keys(e||{}).reduce(function(t,a){return t||In.hasOwnProperty(a)},!1)}var is={"http:":{validate:function(e,t,a){var r=e.slice(t);return a.re.http||(a.re.http=new RegExp("^\\/\\/"+a.re.src_auth+a.re.src_host_port_strict+a.re.src_path,"i")),a.re.http.test(r)?r.match(a.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,a){var r=e.slice(t);return a.re.no_http||(a.re.no_http=new RegExp("^"+a.re.src_auth+"(?:localhost|(?:(?:"+a.re.src_domain+")\\.)+"+a.re.src_domain_root+")"+a.re.src_port+a.re.src_host_terminator+a.re.src_path,"i")),a.re.no_http.test(r)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:r.match(a.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,a){var r=e.slice(t);return a.re.mailto||(a.re.mailto=new RegExp("^"+a.re.src_email_name+"@"+a.re.src_host_strict,"i")),a.re.mailto.test(r)?r.match(a.re.mailto)[0].length:0}}},ss="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]",cs="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function ls(e){e.__index__=-1,e.__text_cache__=""}function ds(e){return function(t,a){var r=t.slice(a);return e.test(r)?r.match(e)[0].length:0}}function u3(){return function(e,t){t.normalize(e)}}function at(e){var t=e.re=es()(e.__opts__),a=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||a.push(ss),a.push(t.src_xn),t.src_tlds=a.join("|");function r(c){return c.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");var o=[];e.__compiled__={};function i(c,u){throw new Error('(LinkifyIt) Invalid schema "'+c+'": '+u)}Object.keys(e.__schemas__).forEach(function(c){var u=e.__schemas__[c];if(u!==null){var h={validate:null,link:null};if(e.__compiled__[c]=h,ns(u)){as(u.validate)?h.validate=ds(u.validate):d3(u.validate)?h.validate=u.validate:i(c,u),d3(u.normalize)?h.normalize=u.normalize:u.normalize?i(c,u):h.normalize=u3();return}if(ts(u)){o.push(c);return}i(c,u)}}),o.forEach(function(c){e.__compiled__[e.__schemas__[c]]&&(e.__compiled__[c].validate=e.__compiled__[e.__schemas__[c]].validate,e.__compiled__[c].normalize=e.__compiled__[e.__schemas__[c]].normalize)}),e.__compiled__[""]={validate:null,normalize:u3()};var s=Object.keys(e.__compiled__).filter(function(c){return c.length>0&&e.__compiled__[c]}).map(rs).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+s+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+s+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),ls(e)}function us(e,t){var a=e.__index__,r=e.__last_index__,o=e.__text_cache__.slice(a,r);this.schema=e.__schema__.toLowerCase(),this.index=a+t,this.lastIndex=r+t,this.raw=o,this.text=o,this.url=o}function p3(e,t){var a=new us(e,t);return e.__compiled__[a.schema].normalize(a,e),a}function S1(e,t){if(!(this instanceof S1))return new S1(e,t);t||os(e)&&(t=e,e={}),this.__opts__=e2({},In,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=e2({},is,e),this.__compiled__={},this.__tlds__=cs,this.__tlds_replaced__=!1,this.re={},at(this)}S1.prototype.add=function(t,a){return this.__schemas__[t]=a,at(this),this};S1.prototype.set=function(t){return this.__opts__=e2(this.__opts__,t),this};S1.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;var a,r,o,i,s,c,u,h,m;if(this.re.schema_test.test(t)){for(u=this.re.schema_search,u.lastIndex=0;(a=u.exec(t))!==null;)if(i=this.testSchemaAt(t,a[2],u.lastIndex),i){this.__schema__=a[2],this.__index__=a.index+a[1].length,this.__last_index__=a.index+a[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(h=t.search(this.re.host_fuzzy_test),h>=0&&(this.__index__<0||h<this.__index__)&&(r=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=r.index+r[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(m=t.indexOf("@"),m>=0&&(o=t.match(this.re.email_fuzzy))!==null&&(s=o.index+o[1].length,c=o.index+o[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&c>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=c))),this.__index__>=0};S1.prototype.pretest=function(t){return this.re.pretest.test(t)};S1.prototype.testSchemaAt=function(t,a,r){return this.__compiled__[a.toLowerCase()]?this.__compiled__[a.toLowerCase()].validate(t,r,this):0};S1.prototype.match=function(t){var a=0,r=[];this.__index__>=0&&this.__text_cache__===t&&(r.push(p3(this,a)),a=this.__last_index__);for(var o=a?t.slice(a):t;this.test(o);)r.push(p3(this,a)),o=o.slice(this.__last_index__),a+=this.__last_index__;return r.length?r:null};S1.prototype.tlds=function(t,a){return t=Array.isArray(t)?t:[t],a?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(r,o,i){return r!==i[o-1]}).reverse(),at(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,at(this),this)};S1.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};S1.prototype.onCompile=function(){};var ps=S1;const hs=["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(D2,"__esModule",{value:!0});var ms=ps,gs=On(ms),fs=hs,vs=On(fs);function On(e){return e&&e.__esModule?e:{default:e}}var $n=new gs.default;$n.tlds(vs.default);D2.default=function(e){return $n.match(e)};var R2={};Object.defineProperty(R2,"__esModule",{value:!0});R2.default=function(e){return e};Object.defineProperty(E2,"__esModule",{value:!0});var ys=function(){function e(t,a){for(var r=0;r<a.length;r++){var o=a[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}(),bs=d,we=ks(bs),Cs=A2,_s=Et(Cs),xs=k2,ws=Et(xs),Ss=D2,Ts=Et(Ss),Es=R2,As=Et(Es);function Et(e){return e&&e.__esModule?e:{default:e}}function ks(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}function Ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rs(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Ps(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Bn=function(e){Ps(t,e);function t(){return Ds(this,t),Rs(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return ys(t,[{key:"parseString",value:function(r){var o=this;if(r==="")return r;var i=this.props.matchDecorator(r);if(!i)return r;var s=[],c=0;return i.forEach(function(u,h){u.index>c&&s.push(r.substring(c,u.index));var m=o.props.hrefDecorator(u.url),g=o.props.textDecorator(u.text),y=o.props.componentDecorator(m,g,h);s.push(y),c=u.lastIndex}),r.length>c&&s.push(r.substring(c)),s.length===1?s[0]:s}},{key:"parse",value:function(r){var o=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof r=="string"?this.parseString(r):we.isValidElement(r)&&r.type!=="a"&&r.type!=="button"?we.cloneElement(r,{key:i},this.parse(r.props.children)):Array.isArray(r)?r.map(function(s,c){return o.parse(s,c)}):r}},{key:"render",value:function(){return we.createElement(we.Fragment,null,this.parse(this.props.children))}}]),t}(we.Component);Bn.defaultProps={componentDecorator:_s.default,hrefDecorator:ws.default,matchDecorator:Ts.default,textDecorator:As.default};E2.default=Bn;Object.defineProperty(Zn,"__esModule",{value:!0});var Fs=E2,js=Zs(Fs);function Zs(e){return e&&e.__esModule?e:{default:e}}var Is=Zn.default=js.default;const Os=p(T)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),$s=p(I1)(({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})),Bs=p(T)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),zs=({comment:e})=>l(Os,{children:[n(H1,{title:e.createdBy.username,children:n(U0,{src:e.createdBy.imageUrl})}),l($s,{variant:"outlined",children:[n(Bs,{children:l(T,{children:[n("strong",{children:e.createdBy.username})," ",l(I,{color:"text.secondary",component:"span",children:["commented"," ",n(p2,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),n(T,{sx:{paddingTop:2.5},children:n(Is,{children:e.text})})]})]}),Vs=p(T)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),Ls=p(I1)(({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%"}})),Ms=p(T)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),Hs=p(T)(({theme:e})=>({padding:e.spacing(2)})),Ns=p(T)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Ws=()=>{var V,M;const e=K("projectId"),[t,a]=d.useState(!1),{user:r}=cn(),{isAdmin:o}=d.useContext($1),[i,s]=d.useState(""),c=K("id"),{data:u,refetchChangeRequest:h}=En(e,c),{changeState:m,addComment:g,loading:y}=Pe(),{refetch:_}=je(e),{setToastData:C,setToastApiError:b}=d1(),{isChangeRequestConfiguredForReview:D}=Fe(e);if(!u)return null;const f=D(u.environment),R=async()=>{try{await m(e,Number(c),{state:"Applied"}),h(),_(),C({type:"success",title:"Success",text:"Changes applied"})}catch(B){b(p1(B))}},E=async()=>{try{await g(e,c,i),s(""),h(),C({type:"success",title:"Success",text:"Comment added"})}catch(B){b(p1(B))}},O=async()=>{try{await m(e,Number(c),{state:"Cancelled"}),a(!1),h(),_(),C({type:"success",title:"Success",text:"Changes cancelled"})}catch(B){b(p1(B))}},L=()=>a(!0),S=()=>a(!1),j=(u==null?void 0:u.createdBy.id)===(r==null?void 0:r.id)&&u.state==="In review"&&!o,Z=u.approvals.some(B=>B.createdBy.id===(r==null?void 0:r.id));return l(Q,{children:[n(Oi,{changeRequest:u}),l(Ns,{children:[l(Vs,{children:[n(_4,{state:u.state}),n(E4,{header:n(T4,{actualApprovals:u.approvals.length,minApprovals:u.minApprovals}),children:(V=u.approvals)==null?void 0:V.map(B=>n(q4,{name:B.createdBy.username||"Unknown user",imageUrl:B.createdBy.imageUrl},B.createdBy.username))})]}),n(Ls,{elevation:0,children:l(Hs,{children:["Requested Changes (",G0(u),")",n(K0,{changeRequest:u,onRefetch:h}),(M=u.comments)==null?void 0:M.map(B=>n(zs,{comment:B},B.id)),n(J0,{user:r,commentText:i,onTypeComment:s,children:n(u1,{variant:"outlined",onClick:E,disabled:!f||i.trim().length===0||i.trim().length>1e3,children:"Comment"})}),n(w,{condition:j,show:n(_1,{sx:B=>({marginTop:B.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),n(j4,{changeRequest:u}),l(Ms,{children:[n(w,{condition:u.state==="In review"&&!Z,show:n(H4,{disabled:!f})}),n(w,{condition:u.state==="Approved",show:n(Ie,{variant:"contained",onClick:R,projectId:e,permission:Y0,environmentId:u.environment,disabled:!f||y,children:"Apply changes"})}),n(w,{condition:u.state!=="Applied"&&u.state!=="Cancelled"&&(u.createdBy.id===(r==null?void 0:r.id)||o),show:n(u1,{sx:{marginLeft:B=>B.spacing(2)},variant:"outlined",onClick:L,children:"Cancel changes"})})]})]})}),l(J1,{open:t,onClick:O,onClose:S,title:"Cancel change request",children:[n(I,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),n(I,{variant:"body2",sx:B=>({color:B.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."})]})]})]})},qs=({value:e})=>{const t=()=>e?n(rn,{state:e}):null;return e?n(c1,{children:t()}):n(c1,{})},Us=p("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),Gs=({value:e})=>n(c1,{children:n(Us,{children:l(I,{component:"span",variant:"body2",children:[" ",e==null?void 0:e.username]})})}),Ks=p("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),Js=({value:e,row:{original:t}})=>{const a=K("projectId"),{id:r,title:o,features:i}=t,s=`/projects/${a}/change-requests/${r}`;return e?l(c1,{sx:{minWidth:"200px"},children:[n(Ks,{children:n(I,{variant:"body2",children:n(d2,{component:R1,underline:"hover",to:s,sx:c=>({paddingTop:c.spacing(.2),marginRight:c.spacing(1),"&:hover":{textDecoration:"underline"}}),children:o})})}),l("span",{children:[`${i==null?void 0:i.length}`," ",i.length<=1?"update":"updates"]})]}):n(c1,{})},Ys=L3()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(4),overflowX:"auto"}})),Qs=p(T)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),Xs=p(R1)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),ec=p(R1)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),tc=p(T)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),nc=({value:e,project:t})=>{const a=e==null?void 0:e.map(r=>r.name);return n(Qs,{children:n(w,{condition:(a==null?void 0:a.length)<3,show:a==null?void 0:a.map(r=>n(Xs,{title:r,to:`/projects/${t}/features/${r}`,children:r})),elseShow:l(Q0,{tooltipProps:{maxWidth:"800px"},tooltip:n(tc,{children:a==null?void 0:a.map(r=>n(ec,{title:r,to:`/projects/${t}/features/${r}`,children:r}))}),children:[a==null?void 0:a.length," toggles"]})})})},ac={id:"createdAt"},rc=p("div")({paddingLeft:0,paddingBottom:0}),oc=p(et)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),ic=({changeRequests:e=[],loading:t,projectId:a})=>{var U,v;const{classes:r}=Ys(),o=C1(X0.breakpoints.down("md")),[i,s]=u2(),[c,u]=d.useState(i.get("search")||""),{value:h,setValue:m}=pt(`${a}:ProjectChangeRequest`,ac),[g,y]=d.useMemo(()=>{const x=e.filter(F=>F.state!=="Cancelled"&&F.state!=="Applied"),$=e.filter(F=>F.state==="Cancelled"||F.state==="Applied");return[x,$]},[e]),_=[{title:"Change requests",data:g},{title:"Closed",data:y}],[C,b]=d.useState(0),D=d.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:Js},{id:"Updated feature toggles",Header:"Updated feature toggles",canSort:!1,accessor:"features",Cell:({value:x,row:{original:{title:$}}})=>n(nc,{project:a,value:x},$)},{Header:"By",accessor:"createdBy",maxWidth:180,canSort:!1,Cell:Gs,align:"left"},{Header:"Submitted",accessor:"createdAt",searchable:!0,maxWidth:100,Cell:tt,sortType:"alphanumeric"},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:c1},{Header:"Status",accessor:"state",searchable:!0,maxWidth:"170px",Cell:qs}],[a]),{data:f,getSearchText:R,getSearchContext:E}=yt(D,c,(U=_[C])==null?void 0:U.data),O=d.useMemo(()=>t?ea:f,[f,t]),[L]=d.useState(()=>({sortBy:[{id:i.get("sort")||h.id,desc:i.has("order")?i.get("order")==="desc":h.desc}],hiddenColumns:[]})),{headerGroups:S,rows:j,state:{sortBy:Z},prepareRow:V,setHiddenColumns:M,getTableProps:B,getTableBodyProps:J}=t1.useTable({columns:D,data:O,initialState:L,sortTypes:Ze,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:c1}},t1.useSortBy);return Ct([{condition:o,columns:["createdBy"]}],M,D),d.useEffect(()=>{if(t)return;const x={};x.sort=Z[0].id,Z[0].desc&&(x.order="desc"),c&&(x.search=c),s(x,{replace:!0}),m($=>({...$,id:Z[0].id,desc:Z[0].desc||!1}))},[t,Z,c,s]),l(i1,{isLoading:t,bodyClass:r.bodyClass,headerClass:r.header,header:n(n1,{titleElement:n(rc,{children:n(h2,{value:(v=_[C])==null?void 0:v.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:_.map((x,$)=>n(oc,{label:`${x.title} (${x.data.length})`,value:x.title,onClick:()=>b($)},x.title))})}),actions:n(D1,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:E})}),children:[n(ue,{value:R(c),children:l(st,{...B(),children:[n(ct,{headerGroups:S}),n(lt,{...J(),children:j.map(x=>(V(x),n(dt,{hover:!0,...x.getRowProps(),children:x.cells.map($=>n(ut,{...$.getCellProps(),padding:"none",children:$.render("Cell")}))})))})]})}),n(w,{condition:j.length===0,show:()=>n(w,{condition:(c==null?void 0:c.length)>0,show:l(w1,{children:["No changes found matching “",c,"”"]}),elseShow:n(w1,{children:"None of the changes were submitted yet."})})})]})},sc=()=>{const e=K("projectId"),t=E1(e),{isOss:a,isPro:r}=h1();T1(`Change requests – ${t}`);const{changeRequests:o,loading:i}=xn(e);return a()||r()?n(i1,{sx:{justifyContent:"center"},children:n(xt,{feature:"change-requests"})}):n(ic,{changeRequests:o,projectId:e,loading:i})};var G=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(G||{});const Be=(e,t={})=>{const a=Y1(`api/admin/projects/${e}/access`),r=()=>fetch(a,{method:"GET"}).then(Q1("project access")).then(g=>g.json()),o=`api/admin/projects/${e}/users`,{data:i,error:s}=de(o,r,t),[c,u]=d.useState(!s&&!i),h=()=>{X3(o)};return d.useEffect(()=>{u(!s&&!i)},[i,s]),{access:d.useMemo(()=>{if(i)return cc({roles:i.roles,users:i.users.filter(({accountType:g})=>!g||g==="User"),serviceAccounts:i.users.filter(({accountType:g})=>g==="Service Account"),groups:(i==null?void 0:i.groups.map(g=>({...g,users:Xa(g.users??[])})))??[]})},[i]),error:s,loading:c,refetchProjectAccess:h}},cc=e=>{const t=e.users||[],a=e.serviceAccounts||[],r=e.groups||[];return{...e,rows:[...t.map(o=>({entity:o,type:"USERS"})),...a.map(o=>({entity:o,type:"SERVICE ACCOUNTS"})),...r.map(o=>({entity:o,type:"GROUPS"}))]}},lc=p(i1)(({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`})),dc=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),h3={id:"joinedAt"},Mt=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>n(c1,{children:n(g2,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:({value:e,row:{original:t}})=>n(i2,{value:e,subtitle:t.email||t.username}),minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:vt,sortType:"date",maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>n(tt,{value:e.seenAt,emptyText:"Never",title:t=>`Last login: ${t}`}),sortType:"date",maxWidth:150},{accessor:e=>e.username||"",Header:"Username",searchable:!0},{accessor:e=>e.email||"",Header:"Email",searchable:!0}],uc=["imageUrl","name","joined","lastLogin"],pc=({open:e,setOpen:t,group:a,projectId:r,subtitle:o,onEdit:i,onRemove:s})=>{const c=m1(),u=C1(c.breakpoints.down("md")),[h]=d.useState(()=>({sortBy:[{id:h3.id,desc:h3.desc}],hiddenColumns:["Username","Email"]})),[m,g]=d.useState(""),{data:y,getSearchText:_,getSearchContext:C}=yt(Mt,m,(a==null?void 0:a.users)??[]),{headerGroups:b,rows:D,prepareRow:f,setHiddenColumns:R}=t1.useTable({columns:Mt,data:y,initialState:h,sortTypes:Ze,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},t1.useSortBy,t1.useFlexLayout);return Ct([{condition:u,columns:uc}],R,Mt),n(K1,{open:e,onClose:()=>{t(!1)},label:(a==null?void 0:a.name)||"Group",children:l(lc,{header:n(n1,{secondary:!0,titleElement:l(dc,{children:[a==null?void 0:a.name," (",D.length<y.length?`${D.length} of ${y.length}`:y.length,")",n("span",{children:o})]}),actions:l(Q,{children:[n(w,{condition:!u,show:l(Q,{children:[n(D1,{initialValue:m,onChange:g,hasFilters:!0,getSearchContext:C}),n(n1.Divider,{})]})}),n(L1,{permission:b1,projectId:r,tooltipProps:{title:"Edit group access"},onClick:i,children:n(wt,{})}),n(L1,{permission:b1,projectId:r,tooltipProps:{title:"Remove group access"},onClick:s,children:n(m2,{})})]}),children:n(w,{condition:u,show:n(D1,{initialValue:m,onChange:g,hasFilters:!0,getSearchContext:C})})}),children:[n(ue,{value:_(m),children:n(bt,{rows:D,headerGroups:b,prepareRow:f})}),n(w,{condition:D.length===0,show:n(w,{condition:(m==null?void 0:m.length)>0,show:l(w1,{children:["No users found matching “",m,"” in this group."]}),elseShow:n(w1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},hc=p("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),m3=p("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),g3=p("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),mc=p("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),gc=p(u1)(({theme:e})=>({marginLeft:e.spacing(3)})),fc=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),vc=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),P2=({selected:e,accesses:t,users:a,serviceAccounts:r,groups:o,roles:i})=>{const{uiConfig:s}=h1(),{flags:c}=s,u=c.UG?"user / group":"user",h=K("projectId"),{refetchProjectAccess:m}=Be(h),{addAccessToProject:g,changeUserRole:y,changeGroupRole:_,loading:C}=Ae(),b=!!e,{setToastData:D,setToastApiError:f}=d1(),R=F1(),E=[...o.filter(v=>b||!t.some(({entity:{id:x},type:$})=>v.id===x&&$===G.GROUP)).map(v=>({id:v.id,entity:v,type:G.GROUP})),...a.filter(v=>b||!t.some(({entity:{id:x},type:$})=>v.id===x&&$===G.USER)).sort((v,x)=>{const $=v.name||v.username||"",F=x.name||x.username||"";return $.localeCompare(F)}).map(v=>({id:v.id,entity:v,type:G.USER})),...r.filter(v=>b||!t.some(({entity:{id:x},type:$})=>v.id===x&&$===G.SERVICE_ACCOUNT)).sort((v,x)=>{const $=v.name||v.username||"",F=x.name||x.username||"";return $.localeCompare(F)}).map(v=>({id:v.id,entity:v,type:G.SERVICE_ACCOUNT}))],[O,L]=d.useState(()=>E.filter(({id:v,type:x})=>v===(e==null?void 0:e.entity.id)&&x===(e==null?void 0:e.type))),[S,j]=d.useState(i.find(({id:v})=>v===(e==null?void 0:e.entity.roleId))??null),Z={users:O==null?void 0:O.filter(({type:v})=>v===G.USER||v===G.SERVICE_ACCOUNT).map(({id:v})=>({id:v})),groups:O==null?void 0:O.filter(({type:v})=>v===G.GROUP).map(({id:v})=>({id:v}))},V=async v=>{if(v.preventDefault(),!!U)try{b?(e==null?void 0:e.type)===G.USER||(e==null?void 0:e.type)===G.SERVICE_ACCOUNT?await y(h,S.id,e.entity.id):(e==null?void 0:e.type)===G.GROUP&&await _(h,S.id,e.entity.id):await g(h,S.id,Z),m(),R(M1),D({title:`${O.length} ${O.length===1?"access":"accesses"} ${b?"edited":"assigned"} successfully`,type:"success"})}catch(x){f(p1(x))}},M=()=>b?`curl --location --request ${b?"PUT":"POST"} '${s.unleashUrl}/api/admin/projects/${h}/${(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/${S==null?void 0:S.id}' \\
3
3
  --header 'Authorization: INSERT_API_KEY'`:`curl --location --request ${b?"PUT":"POST"} '${s.unleashUrl}/api/admin/projects/${h}/role/${S==null?void 0:S.id}/access' \\
4
4
  --header 'Authorization: INSERT_API_KEY' \\
@@ -1,4 +1,4 @@
1
- import{g0 as T4,g1 as lc,g2 as cc,g3 as E4,g4 as C4,g5 as S4,s as m2,r as Wh,j as Po,bS as A4,g6 as L4,g7 as B4,C as D4,E as I4,g8 as M4,g9 as N4}from"./index-9c528324.js";import{u as R4,a as b2}from"./unknownify-db48ebae.js";const O4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F4(t){return typeof t=="string"&&O4.test(t)}function P4(t){if(!F4(t))throw TypeError("Invalid UUID");let e;const r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function V4(t){t=unescape(encodeURIComponent(t));const e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}const Y4="6ba7b810-9dad-11d1-80b4-00c04fd430c8",z4="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function U4(t,e,r){function i(n,s,a,o){var l;if(typeof n=="string"&&(n=V4(n)),typeof s=="string"&&(s=P4(s)),((l=s)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let h=new Uint8Array(16+n.length);if(h.set(s),h.set(n,s.length),h=r(h),h[6]=h[6]&15|e,h[8]=h[8]&63|128,a){o=o||0;for(let u=0;u<16;++u)a[o+u]=h[u];return a}return T4(h)}try{i.name=t}catch{}return i.DNS=Y4,i.URL=z4,i}function W4(t,e,r,i){switch(t){case 0:return e&r^~e&i;case 1:return e^r^i;case 2:return e&r^e&i^r&i;case 3:return e^r^i}}function eh(t,e){return t<<e|t>>>32-e}function H4(t){const e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){const a=unescape(encodeURIComponent(t));t=[];for(let o=0;o<a.length;++o)t.push(a.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const i=t.length/4+2,n=Math.ceil(i/16),s=new Array(n);for(let a=0;a<n;++a){const o=new Uint32Array(16);for(let l=0;l<16;++l)o[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=o}s[n-1][14]=(t.length-1)*8/Math.pow(2,32),s[n-1][14]=Math.floor(s[n-1][14]),s[n-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<n;++a){const o=new Uint32Array(80);for(let p=0;p<16;++p)o[p]=s[a][p];for(let p=16;p<80;++p)o[p]=eh(o[p-3]^o[p-8]^o[p-14]^o[p-16],1);let l=r[0],h=r[1],u=r[2],f=r[3],d=r[4];for(let p=0;p<80;++p){const m=Math.floor(p/20),b=eh(l,5)+W4(m,h,u,f)+d+e[m]+o[p]>>>0;d=f,f=u,u=eh(h,30)>>>0,h=l,l=b}r[0]=r[0]+l>>>0,r[1]=r[1]+h>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+d>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}const q4=U4("v5",80,H4),G4=q4;function _2(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=Array.from(typeof t=="string"?[t]:t);i[i.length-1]=i[i.length-1].replace(/\r?\n([\t ]*)$/,"");var n=i.reduce(function(o,l){var h=l.match(/\n([\t ]+|(?!\s).)/g);return h?o.concat(h.map(function(u){var f,d;return(d=(f=u.match(/[\t ]/g))===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0})):o},[]);if(n.length){var s=new RegExp(`
1
+ import{g0 as T4,g1 as lc,g2 as cc,g3 as E4,g4 as C4,g5 as S4,s as m2,r as Wh,j as Po,bS as A4,g6 as L4,g7 as B4,C as D4,E as I4,g8 as M4,g9 as N4}from"./index-1c4c68c3.js";import{u as R4,a as b2}from"./unknownify-0b176a78.js";const O4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F4(t){return typeof t=="string"&&O4.test(t)}function P4(t){if(!F4(t))throw TypeError("Invalid UUID");let e;const r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function V4(t){t=unescape(encodeURIComponent(t));const e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}const Y4="6ba7b810-9dad-11d1-80b4-00c04fd430c8",z4="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function U4(t,e,r){function i(n,s,a,o){var l;if(typeof n=="string"&&(n=V4(n)),typeof s=="string"&&(s=P4(s)),((l=s)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let h=new Uint8Array(16+n.length);if(h.set(s),h.set(n,s.length),h=r(h),h[6]=h[6]&15|e,h[8]=h[8]&63|128,a){o=o||0;for(let u=0;u<16;++u)a[o+u]=h[u];return a}return T4(h)}try{i.name=t}catch{}return i.DNS=Y4,i.URL=z4,i}function W4(t,e,r,i){switch(t){case 0:return e&r^~e&i;case 1:return e^r^i;case 2:return e&r^e&i^r&i;case 3:return e^r^i}}function eh(t,e){return t<<e|t>>>32-e}function H4(t){const e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){const a=unescape(encodeURIComponent(t));t=[];for(let o=0;o<a.length;++o)t.push(a.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const i=t.length/4+2,n=Math.ceil(i/16),s=new Array(n);for(let a=0;a<n;++a){const o=new Uint32Array(16);for(let l=0;l<16;++l)o[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=o}s[n-1][14]=(t.length-1)*8/Math.pow(2,32),s[n-1][14]=Math.floor(s[n-1][14]),s[n-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<n;++a){const o=new Uint32Array(80);for(let p=0;p<16;++p)o[p]=s[a][p];for(let p=16;p<80;++p)o[p]=eh(o[p-3]^o[p-8]^o[p-14]^o[p-16],1);let l=r[0],h=r[1],u=r[2],f=r[3],d=r[4];for(let p=0;p<80;++p){const m=Math.floor(p/20),b=eh(l,5)+W4(m,h,u,f)+d+e[m]+o[p]>>>0;d=f,f=u,u=eh(h,30)>>>0,h=l,l=b}r[0]=r[0]+l>>>0,r[1]=r[1]+h>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+d>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}const q4=U4("v5",80,H4),G4=q4;function _2(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=Array.from(typeof t=="string"?[t]:t);i[i.length-1]=i[i.length-1].replace(/\r?\n([\t ]*)$/,"");var n=i.reduce(function(o,l){var h=l.match(/\n([\t ]+|(?!\s).)/g);return h?o.concat(h.map(function(u){var f,d;return(d=(f=u.match(/[\t ]/g))===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0})):o},[]);if(n.length){var s=new RegExp(`
2
2
  [ ]{`+Math.min.apply(Math,n)+"}","g");i=i.map(function(o){return o.replace(s,`
3
3
  `)})}i[0]=i[0].replace(/^\r?\n/,"");var a=i[0];return e.forEach(function(o,l){var h=a.match(/(?:^|\n)( *)$/),u=h?h[1]:"",f=o;typeof o=="string"&&o.includes(`
4
4
  `)&&(f=String(o).split(`
@@ -1270,7 +1270,7 @@ Expecting `+Tt.join(", ")+", got '"+(this.terminals_[Y]||Y)+"'":$="Parse error o
1270
1270
  `+k+"^"},test_match:function(x,k){var v,B,R;if(this.options.backtrack_lexer&&(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(R.yylloc.range=this.yylloc.range.slice(0))),B=x[0].match(/(?:\r\n?|\n).*/g),B&&(this.yylineno+=B.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:B?B[B.length-1].length-B[B.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],v=this.performAction.call(this,this.yy,this,k,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var P in R)this[P]=R[P];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,k,v,B;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),P=0;P<R.length;P++)if(v=this._input.match(this.rules[R[P]]),v&&(!k||v[0].length>k[0].length)){if(k=v,B=P,this.options.backtrack_lexer){if(x=this.test_match(v,R[P]),x!==!1)return x;if(this._backtrack){k=!1;continue}else return!1}else if(!this.options.flex)break}return k?(x=this.test_match(k,R[B]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
1271
1271
  `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var k=this.next();return k||this.lex()},begin:function(k){this.conditionStack.push(k)},popState:function(){var k=this.conditionStack.length-1;return k>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},pushState:function(k){this.begin(k)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(k,v,B,R){switch(B){case 0:return this.begin("open_directive"),26;case 1:return this.begin("type_directive"),27;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:break;case 6:break;case 7:return 11;case 8:break;case 9:break;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}};return b}();d.lexer=p;function m(){this.yy={}}return m.prototype=d,d.Parser=m,new m}();e1.parser=e1;const fY=e1,dY=t=>t.match(/^\s*journey/)!==null;let zs="";const T0=[],to=[],eo=[],pY=function(t,e,r){xe.parseDirective(this,t,e,r)},gY=function(){T0.length=0,to.length=0,zs="",eo.length=0,Lr()},yY=function(t){zs=t,T0.push(t)},mY=function(){return T0},bY=function(){let t=l2();const e=100;let r=0;for(;!t&&r<e;)t=l2(),r++;return to.push(...eo),to},_Y=function(){const t=[];return to.forEach(r=>{r.people&&t.push(...r.people)}),[...new Set(t)].sort()},xY=function(t,e){const r=e.substr(1).split(":");let i=0,n=[];r.length===1?(i=Number(r[0]),n=[]):(i=Number(r[0]),n=r[1].split(","));const s=n.map(o=>o.trim()),a={section:zs,type:zs,people:s,task:t,score:i};eo.push(a)},vY=function(t){const e={section:zs,type:zs,description:t,task:t,classes:[]};to.push(e)},l2=function(){const t=function(r){return eo[r].processed};let e=!0;for(const[r,i]of eo.entries())t(r),e=e&&i.processed;return e},kY=function(){return _Y()},c2={parseDirective:pY,getConfig:()=>G().journey,clear:gY,setDiagramTitle:si,getDiagramTitle:ai,setAccTitle:kr,getAccTitle:Br,setAccDescription:Dr,getAccDescription:Ir,addSection:yY,getSections:mY,getTasks:bY,addTask:xY,addTaskOrg:vY,getActors:kY},Xc=function(t,e){const r=t.append("rect");return r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),r.attr("rx",e.rx),r.attr("ry",e.ry),e.class!==void 0&&r.attr("class",e.class),r},wY=function(t,e){const i=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=t.append("g");n.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function s(l){const h=nu().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}function a(l){const h=nu().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return e.score>3?s(n):e.score<3?a(n):o(n),i},Z3=function(t,e){const r=t.append("circle");return r.attr("cx",e.cx),r.attr("cy",e.cy),r.attr("class","actor-"+e.pos),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("r",e.r),r.class!==void 0&&r.attr("class",r.class),e.title!==void 0&&r.append("title").text(e.title),r},Q3=function(t,e){const r=e.text.replace(/<br\s*\/?>/gi," "),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.attr("class","legend"),i.style("text-anchor",e.anchor),e.class!==void 0&&i.attr("class",e.class);const n=i.append("tspan");return n.attr("x",e.x+e.textMargin*2),n.text(r),i},TY=function(t,e){function r(n,s,a,o,l){return n+","+s+" "+(n+a)+","+s+" "+(n+a)+","+(s+o-l)+" "+(n+a-l*1.2)+","+(s+o)+" "+n+","+(s+o)}const i=t.append("polygon");i.attr("points",r(e.x,e.y,50,20,7)),i.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,Q3(t,e)},EY=function(t,e,r){const i=t.append("g"),n=E0();n.x=e.x,n.y=e.y,n.fill=e.fill,n.width=r.width,n.height=r.height,n.class="journey-section section-type-"+e.num,n.rx=3,n.ry=3,Xc(i,n),J3(r)(e.text,i,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+e.num},r,e.colour)};let h2=-1;const CY=function(t,e,r){const i=e.x+r.width/2,n=t.append("g");h2++;const s=300+5*30;n.append("line").attr("id","task"+h2).attr("x1",i).attr("y1",e.y).attr("x2",i).attr("y2",s).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),wY(n,{cx:i,cy:300+(5-e.score)*30,score:e.score});const a=E0();a.x=e.x,a.y=e.y,a.fill=e.fill,a.width=r.width,a.height=r.height,a.class="task task-type-"+e.num,a.rx=3,a.ry=3,Xc(n,a);let o=e.x+14;e.people.forEach(l=>{const h=e.actors[l].color,u={cx:o,cy:e.y,r:7,fill:h,stroke:"#000",title:l,pos:e.actors[l].position};Z3(n,u),o+=10}),J3(r)(e.task,n,a.x,a.y,a.width,a.height,{class:"task"},r,e.colour)},SY=function(t,e){Xc(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},AY=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},E0=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},J3=function(){function t(n,s,a,o,l,h,u,f){const d=s.append("text").attr("x",a+l/2).attr("y",o+h/2+5).style("font-color",f).style("text-anchor","middle").text(n);i(d,u)}function e(n,s,a,o,l,h,u,f,d){const{taskFontSize:p,taskFontFamily:m}=f,b=n.split(/<br\s*\/?>/gi);for(let x=0;x<b.length;x++){const k=x*p-p*(b.length-1)/2,v=s.append("text").attr("x",a+l/2).attr("y",o).attr("fill",d).style("text-anchor","middle").style("font-size",p).style("font-family",m);v.append("tspan").attr("x",a+l/2).attr("dy",k).text(b[x]),v.attr("y",o+h/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(v,u)}}function r(n,s,a,o,l,h,u,f){const d=s.append("switch"),m=d.append("foreignObject").attr("x",a).attr("y",o).attr("width",l).attr("height",h).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");m.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(n),e(n,d,a,o,l,h,u,f),i(m,u)}function i(n,s){for(const a in s)a in s&&n.attr(a,s[a])}return function(n){return n.textPlacement==="fo"?r:n.textPlacement==="old"?t:e}}(),LY=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},ro={drawRect:Xc,drawCircle:Z3,drawSection:EY,drawText:Q3,drawLabel:TY,drawTask:CY,drawBackgroundRect:SY,getTextObj:AY,getNoteRect:E0,initGraphics:LY},BY=function(t){Object.keys(t).forEach(function(r){Kc[r]=t[r]})},Ui={};function DY(t){const e=G().journey;let r=60;Object.keys(Ui).forEach(i=>{const n=Ui[i].color,s={cx:20,cy:r,r:7,fill:n,stroke:"#000",pos:Ui[i].position};ro.drawCircle(t,s);const a={x:40,y:r+7,fill:"#666",text:i,textMargin:e.boxTextMargin|5};ro.drawText(t,a),r+=20})}const Kc=G().journey,Sn=Kc.leftMargin,IY=function(t,e,r,i){const n=G().journey;i.db.clear(),i.parser.parse(t+`
1272
1272
  `);const s=G().securityLevel;let a;s==="sandbox"&&(a=_t("#i"+e));const o=_t(s==="sandbox"?a.nodes()[0].contentDocument.body:"body");Pr.init();const l=o.select("#"+e);ro.initGraphics(l);const h=i.db.getTasks(),u=i.db.getDiagramTitle(),f=i.db.getActors();for(const k in Ui)delete Ui[k];let d=0;f.forEach(k=>{Ui[k]={color:n.actorColours[d%n.actorColours.length],position:d},d++}),DY(l),Pr.insert(0,0,Sn,Object.keys(Ui).length*50),MY(l,h,0);const p=Pr.getBounds();u&&l.append("text").text(u).attr("x",Sn).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const m=p.stopy-p.starty+2*n.diagramMarginY,b=Sn+p.stopx+2*n.diagramMarginX;ni(l,m,b,n.useMaxWidth),l.append("line").attr("x1",Sn).attr("y1",n.height*4).attr("x2",b-Sn-4).attr("y2",n.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const x=u?70:0;l.attr("viewBox",`${p.startx} -25 ${b} ${m+x}`),l.attr("preserveAspectRatio","xMinYMin meet"),l.attr("height",m+x+25)},Pr={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},updateVal:function(t,e,r,i){t[e]===void 0?t[e]=r:t[e]=i(r,t[e])},updateBounds:function(t,e,r,i){const n=G().journey,s=this;let a=0;function o(l){return function(u){a++;const f=s.sequenceItems.length-a+1;s.updateVal(u,"starty",e-f*n.boxMargin,Math.min),s.updateVal(u,"stopy",i+f*n.boxMargin,Math.max),s.updateVal(Pr.data,"startx",t-f*n.boxMargin,Math.min),s.updateVal(Pr.data,"stopx",r+f*n.boxMargin,Math.max),l!=="activation"&&(s.updateVal(u,"startx",t-f*n.boxMargin,Math.min),s.updateVal(u,"stopx",r+f*n.boxMargin,Math.max),s.updateVal(Pr.data,"starty",e-f*n.boxMargin,Math.min),s.updateVal(Pr.data,"stopy",i+f*n.boxMargin,Math.max))}}this.sequenceItems.forEach(o())},insert:function(t,e,r,i){const n=Math.min(t,r),s=Math.max(t,r),a=Math.min(e,i),o=Math.max(e,i);this.updateVal(Pr.data,"startx",n,Math.min),this.updateVal(Pr.data,"starty",a,Math.min),this.updateVal(Pr.data,"stopx",s,Math.max),this.updateVal(Pr.data,"stopy",o,Math.max),this.updateBounds(n,a,s,o)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return this.data}},zh=Kc.sectionFills,u2=Kc.sectionColours,MY=function(t,e,r){const i=G().journey;let n="";const s=i.height*2+i.diagramMarginY,a=r+s;let o=0,l="#CCC",h="black",u=0;for(const[f,d]of e.entries()){if(n!==d.section){l=zh[o%zh.length],u=o%zh.length,h=u2[o%u2.length];const m={x:f*i.taskMargin+f*i.width+Sn,y:50,text:d.section,fill:l,num:u,colour:h};ro.drawSection(t,m,i),n=d.section,o++}const p=d.people.reduce((m,b)=>(Ui[b]&&(m[b]=Ui[b]),m),{});d.x=f*i.taskMargin+f*i.width+Sn,d.y=a,d.width=i.diagramMarginX,d.height=i.diagramMarginY,d.colour=h,d.fill=l,d.num=u,d.actors=p,ro.drawTask(t,d,i),Pr.insert(d.x,d.y,d.x+d.width+i.taskMargin,300+5*30)}},f2={setConf:BY,draw:IY};let d2={};const NY=function(t){d2={...d2,...t}},RY=(t,e,r)=>{try{I.debug(`Renering svg for syntax error
1273
- `);const i=_t("#"+e),n=i.append("g");n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+r),i.attr("height",100),i.attr("width",500),i.attr("viewBox","768 0 912 512")}catch(i){I.error("Error while rendering info diagram"),I.error(PD(i))}},nc={setConf:NY,draw:RY},t4="flowchart-elk",OY=(t,e)=>{var r;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk")},FY=async()=>{const{diagram:t}=await import("./flowchart-elk-definition-170a3958-4dece62b.js");return{id:t4,diagram:t}},PY={id:t4,detector:OY,loader:FY},VY=PY,e4="timeline",YY=t=>t.match(/^\s*timeline/)!==null,zY=async()=>{const{diagram:t}=await import("./timeline-definition-8e5a9bc6-c996bf40.js");return{id:e4,diagram:t}},UY={id:e4,detector:YY,loader:zY},WY=UY,r4="mindmap",HY=t=>t.match(/^\s*mindmap/)!==null,qY=async()=>{const{diagram:t}=await import("./mindmap-definition-44684416-a4071c9f.js");return{id:r4,diagram:t}},GY={id:r4,detector:HY,loader:qY},$Y=GY;let p2=!1;const _o=()=>{p2||(p2=!0,oy(VY,WY,$Y),Ye("error",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{}},init:()=>{}},t=>t.toLowerCase().trim()==="error"),Ye("---",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with unindented `---` blocks")}},init:()=>null},t=>t.toLowerCase().trimStart().startsWith("---")),Ye("c4",{parser:GI,db:Fy,renderer:Nd,styles:Cy,init:t=>{Nd.setConf(t.c4)}},$I),Ye("class",{parser:Rd,db:fs,renderer:yN,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},VM),Ye("classDiagram",{parser:Rd,db:fs,renderer:LR,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},YM),Ye("er",{parser:BR,db:YR,renderer:QR,styles:_y},DR),Ye("gantt",{parser:bO,db:g0,renderer:JO,styles:xy},_O),Ye("info",{parser:tF,db:sF,renderer:oF,styles:vy},lF),Ye("pie",{parser:cF,db:bF,renderer:xF,styles:ky},hF),Ye("requirement",{parser:vF,db:zF,renderer:KF,styles:wy},kF),Ye("sequence",{parser:ZF,db:Qd,renderer:t2,styles:Ty,init:t=>{if(t.sequence||(t.sequence={}),t.sequence.arrowMarkerAbsolute=t.arrowMarkerAbsolute,"sequenceDiagram"in t)throw new Error("`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.");Qd.setWrap(t.wrap),t2.setConf(t.sequence)}},QF),Ye("state",{parser:e2,db:Ri,renderer:zV,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},QP),Ye("stateDiagram",{parser:e2,db:Ri,renderer:uY,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},JP),Ye("journey",{parser:fY,db:c2,renderer:f2,styles:Ey,init:t=>{f2.setConf(t.journey),c2.clear()}},dY),Ye("flowchart",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,pO.setConf(t.flowchart),hi.clear(),hi.setGen("gen-1")}},JR),Ye("flowchart-v2",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,gy({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Fh.setConf(t.flowchart),hi.clear(),hi.setGen("gen-2")}},tO),Ye("gitGraph",{parser:gI,db:RI,renderer:WI,styles:qI},yI))};class r1{constructor(e,r){var i,n;this.txt=e,this.type="graph",this.detectTypeFailed=!1;const s=G();this.txt=e;try{this.type=W1(e,s)}catch(l){this.handleError(l,r),this.type="error",this.detectTypeFailed=!0}const a=Ly(this.type);I.debug("Type "+this.type),this.db=a.db,(n=(i=this.db).clear)==null||n.call(i),this.renderer=a.renderer,this.parser=a.parser;const o=this.parser.parse.bind(this.parser);this.parser.parse=l=>o(bD(l,this.db)),this.parser.parser.yy=this.db,a.init&&(a.init(s),I.info("Initialized diagram "+this.type,s)),this.txt+=`
1273
+ `);const i=_t("#"+e),n=i.append("g");n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+r),i.attr("height",100),i.attr("width",500),i.attr("viewBox","768 0 912 512")}catch(i){I.error("Error while rendering info diagram"),I.error(PD(i))}},nc={setConf:NY,draw:RY},t4="flowchart-elk",OY=(t,e)=>{var r;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk")},FY=async()=>{const{diagram:t}=await import("./flowchart-elk-definition-170a3958-543f0844.js");return{id:t4,diagram:t}},PY={id:t4,detector:OY,loader:FY},VY=PY,e4="timeline",YY=t=>t.match(/^\s*timeline/)!==null,zY=async()=>{const{diagram:t}=await import("./timeline-definition-8e5a9bc6-6c09f608.js");return{id:e4,diagram:t}},UY={id:e4,detector:YY,loader:zY},WY=UY,r4="mindmap",HY=t=>t.match(/^\s*mindmap/)!==null,qY=async()=>{const{diagram:t}=await import("./mindmap-definition-44684416-ac92f950.js");return{id:r4,diagram:t}},GY={id:r4,detector:HY,loader:qY},$Y=GY;let p2=!1;const _o=()=>{p2||(p2=!0,oy(VY,WY,$Y),Ye("error",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{}},init:()=>{}},t=>t.toLowerCase().trim()==="error"),Ye("---",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with unindented `---` blocks")}},init:()=>null},t=>t.toLowerCase().trimStart().startsWith("---")),Ye("c4",{parser:GI,db:Fy,renderer:Nd,styles:Cy,init:t=>{Nd.setConf(t.c4)}},$I),Ye("class",{parser:Rd,db:fs,renderer:yN,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},VM),Ye("classDiagram",{parser:Rd,db:fs,renderer:LR,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},YM),Ye("er",{parser:BR,db:YR,renderer:QR,styles:_y},DR),Ye("gantt",{parser:bO,db:g0,renderer:JO,styles:xy},_O),Ye("info",{parser:tF,db:sF,renderer:oF,styles:vy},lF),Ye("pie",{parser:cF,db:bF,renderer:xF,styles:ky},hF),Ye("requirement",{parser:vF,db:zF,renderer:KF,styles:wy},kF),Ye("sequence",{parser:ZF,db:Qd,renderer:t2,styles:Ty,init:t=>{if(t.sequence||(t.sequence={}),t.sequence.arrowMarkerAbsolute=t.arrowMarkerAbsolute,"sequenceDiagram"in t)throw new Error("`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.");Qd.setWrap(t.wrap),t2.setConf(t.sequence)}},QF),Ye("state",{parser:e2,db:Ri,renderer:zV,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},QP),Ye("stateDiagram",{parser:e2,db:Ri,renderer:uY,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},JP),Ye("journey",{parser:fY,db:c2,renderer:f2,styles:Ey,init:t=>{f2.setConf(t.journey),c2.clear()}},dY),Ye("flowchart",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,pO.setConf(t.flowchart),hi.clear(),hi.setGen("gen-1")}},JR),Ye("flowchart-v2",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,gy({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Fh.setConf(t.flowchart),hi.clear(),hi.setGen("gen-2")}},tO),Ye("gitGraph",{parser:gI,db:RI,renderer:WI,styles:qI},yI))};class r1{constructor(e,r){var i,n;this.txt=e,this.type="graph",this.detectTypeFailed=!1;const s=G();this.txt=e;try{this.type=W1(e,s)}catch(l){this.handleError(l,r),this.type="error",this.detectTypeFailed=!0}const a=Ly(this.type);I.debug("Type "+this.type),this.db=a.db,(n=(i=this.db).clear)==null||n.call(i),this.renderer=a.renderer,this.parser=a.parser;const o=this.parser.parse.bind(this.parser);this.parser.parse=l=>o(bD(l,this.db)),this.parser.parser.yy=this.db,a.init&&(a.init(s),I.info("Initialized diagram "+this.type,s)),this.txt+=`
1274
1274
  `,this.parse(this.txt,r)}parse(e,r){var i,n;if(this.detectTypeFailed)return!1;try{return e=e+`
1275
1275
  `,(n=(i=this.db).clear)==null||n.call(i),this.parser.parse(e),!0}catch(s){this.handleError(s,r)}return!1}handleError(e,r){if(r===void 0)throw e;if(q1(e)){r(e.str,e.hash);return}r(e)}getParser(){return this.parser}getType(){return this.type}}const C0=(t,e)=>{const r=W1(t,G());try{Ly(r)}catch{const n=vD(r);if(!n)throw new Error(`Diagram ${r} not found.`);return n().then(({diagram:s})=>(Ye(r,s,void 0),new r1(t,e)))}return new r1(t,e)},S0=r1,jY="graphics-document document";function XY(t,e){t.attr("role",jY),bs(e)||t.attr("aria-roledescription",e)}function KY(t,e,r,i){if(t.insert!==void 0)if(e||r){if(r){const n="chart-desc-"+i;t.attr("aria-describedby",n),t.insert("desc",":first-child").attr("id",n).text(r)}if(e){const n="chart-title-"+i;t.attr("aria-labelledby",n),t.insert("title",":first-child").attr("id",n).text(e)}}else return}const A0=["graph","flowchart","flowchart-v2","stateDiagram","stateDiagram-v2"],i4="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",n4="sandbox",s4="loose",ZY="http://www.w3.org/2000/svg",a4="http://www.w3.org/1999/xlink",o4="http://www.w3.org/1999/xhtml",QY="100%",JY="100%",tz="border:0;margin:0;",ez="margin:0",rz="allow-top-navigation-by-user-activation allow-popups",iz='The "iframe" tag is not supported by your browser.',l4=["foreignobject"],c4=["dominant-baseline"];function nz(t,e){return _o(),new S0(t,e).parse(t,e)}async function sz(t,e){return _o(),(await C0(t,e)).parse(t,e)}const h4=function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const i=r.substring(1,r.length-1);return/^\+?\d+$/.test(i)?"fl°°"+i+"¶ß":"fl°"+i+"¶ß"}),e},L0=function(t){let e=t;return e=e.replace(/fl°°/g,"&#"),e=e.replace(/fl°/g,"&"),e=e.replace(/¶ß/g,";"),e},g2=(t,e,r=[])=>`
1276
1276
  .${t} ${e} { ${r.join(" !important; ")} !important; }`,az=(t,e,r={})=>{var i;let n="";if(t.themeCSS!==void 0&&(n+=`
@@ -1 +1 @@
1
- var f=Object.defineProperty;var C=(t,e,r)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(C(t,typeof e!="symbol"?e+"":e,r),r);import{bF as k,b as v,r as d,bS as w,j as s,C as P,E as S,f$ as u}from"./index-9c528324.js";import{u as T,a as g}from"./unknownify-db48ebae.js";import{L as I,C as M,a as A,b as L,P as N,c as R,T as q,p as E,e as _,f as D}from"./chartjs-adapter-date-fns.esm-d57aaddd.js";import{B as $}from"./RoleCell-9a62b4ed.js";import"./index-9bb67f88.js";import"./index-1c8194e0.js";class j{constructor(e){o(this,"current",0);o(this,"all");this.all=e}next(){const e=this.all[this.current];return this.current=(this.current+1)%this.all.length,e}}const m=["circle","rect","rectRounded","rectRot","triangle"],B=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),F=(t,e)=>({locale:e.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:t.palette.text.secondary,plugins:{tooltip:{backgroundColor:t.palette.background.paper,bodyColor:t.palette.text.primary,titleColor:t.palette.action.active,borderColor:t.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:r=>u(1e3*r[0].parsed.x,e.locale)},itemSort:(r,i)=>i.parsed.y-r.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:t.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:t.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:t.palette.text.secondary},grid:{color:t.palette.divider,borderColor:t.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:t.palette.divider,borderColor:t.palette.divider},ticks:{callback:(r,i,a)=>u(a[i].value*1e3,e.locale)}}}});class H{constructor(e){o(this,"items");o(this,"picked",new Map);this.items=new j(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const W=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new H([t.palette.success,t.palette.error,t.palette.primary,t.palette.warning]);return e.data.result.map((a,y)=>{var c,p;const n=g((c=a.metric)==null?void 0:c.endpoint),b=g((p=a.metric)==null?void 0:p.appName),l=i.pick(n),h=a.values||[];return{label:`${n}: ${b}`,borderColor:l.main,backgroundColor:l.main,data:B(h,x=>parseFloat(x)),elements:{point:{radius:4,pointStyle:m[y%m.length]},line:{borderDash:[8,4]}}}})}return[]},V=()=>{const{locationSettings:t}=k(),{metrics:e}=T(),r=v(),i=d.useMemo(()=>F(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:W(r,e)}),[r,e,t]);return s(P,{condition:a.datasets.length===0,show:s(S,{severity:"warning",children:"No data available."}),elseShow:s($,{sx:{display:"grid",gap:4},children:s("div",{style:{height:400},children:s(I,{data:a,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};M.register(A,L,N,R,q,E,_,D);export{V as NetworkTraffic,V as default};
1
+ var f=Object.defineProperty;var C=(t,e,r)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(C(t,typeof e!="symbol"?e+"":e,r),r);import{bF as k,b as v,r as d,bS as w,j as s,C as P,E as S,f$ as u}from"./index-1c4c68c3.js";import{u as T,a as g}from"./unknownify-0b176a78.js";import{L as I,C as M,a as A,b as L,P as N,c as R,T as q,p as E,e as _,f as D}from"./chartjs-adapter-date-fns.esm-799be047.js";import{B as $}from"./RoleCell-c534790e.js";import"./index-88f1c682.js";import"./index-aa638b65.js";class j{constructor(e){o(this,"current",0);o(this,"all");this.all=e}next(){const e=this.all[this.current];return this.current=(this.current+1)%this.all.length,e}}const m=["circle","rect","rectRounded","rectRot","triangle"],B=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),F=(t,e)=>({locale:e.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:t.palette.text.secondary,plugins:{tooltip:{backgroundColor:t.palette.background.paper,bodyColor:t.palette.text.primary,titleColor:t.palette.action.active,borderColor:t.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:r=>u(1e3*r[0].parsed.x,e.locale)},itemSort:(r,i)=>i.parsed.y-r.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:t.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:t.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:t.palette.text.secondary},grid:{color:t.palette.divider,borderColor:t.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:t.palette.divider,borderColor:t.palette.divider},ticks:{callback:(r,i,a)=>u(a[i].value*1e3,e.locale)}}}});class H{constructor(e){o(this,"items");o(this,"picked",new Map);this.items=new j(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const W=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new H([t.palette.success,t.palette.error,t.palette.primary,t.palette.warning]);return e.data.result.map((a,y)=>{var c,p;const n=g((c=a.metric)==null?void 0:c.endpoint),b=g((p=a.metric)==null?void 0:p.appName),l=i.pick(n),h=a.values||[];return{label:`${n}: ${b}`,borderColor:l.main,backgroundColor:l.main,data:B(h,x=>parseFloat(x)),elements:{point:{radius:4,pointStyle:m[y%m.length]},line:{borderDash:[8,4]}}}})}return[]},V=()=>{const{locationSettings:t}=k(),{metrics:e}=T(),r=v(),i=d.useMemo(()=>F(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:W(r,e)}),[r,e,t]);return s(P,{condition:a.datasets.length===0,show:s(S,{severity:"warning",children:"No data available."}),elseShow:s($,{sx:{display:"grid",gap:4},children:s("div",{style:{height:400},children:s(I,{data:a,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};M.register(A,L,N,R,q,E,_,D);export{V as NetworkTraffic,V as default};