unleash-server 5.4.0 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/lib/addons/slack-app-definition.js +1 -0
  2. package/dist/lib/addons/slack-app-definition.js.map +1 -1
  3. package/dist/lib/routes/admin-api/feature-type.js +2 -7
  4. package/dist/lib/routes/admin-api/feature-type.js.map +1 -1
  5. package/dist/lib/types/experimental.d.ts +1 -1
  6. package/dist/lib/types/experimental.js +0 -1
  7. package/dist/lib/types/experimental.js.map +1 -1
  8. package/dist/server-dev.js +0 -1
  9. package/dist/server-dev.js.map +1 -1
  10. package/dist/test/e2e/api/admin/feature-type.test.js +0 -1
  11. package/dist/test/e2e/api/admin/feature-type.test.js.map +1 -1
  12. package/frontend/build/index.html +1 -1
  13. package/frontend/build/static/{AdvancedPlayground-2d715a2c.js → AdvancedPlayground-1748fcdd.js} +1 -1
  14. package/frontend/build/static/{CreateProject-5b1090c2.js → CreateProject-972fa820.js} +1 -1
  15. package/frontend/build/static/{Error-e44ea66b.js → Error-cbce6b64.js} +1 -1
  16. package/frontend/build/static/{FeatureArchiveDialog-b47b18e8.js → FeatureArchiveDialog-8a281845.js} +1 -1
  17. package/frontend/build/static/{FeatureMetricsChart-36caeeb7.js → FeatureMetricsChart-8fd8a304.js} +1 -1
  18. package/frontend/build/static/{FeatureViewLazyExport-49d56afd.js → FeatureViewLazyExport-a215d53b.js} +2 -2
  19. package/frontend/build/static/{LazyAdminExport-87c9ab51.js → LazyAdminExport-ba7d55ca.js} +13 -13
  20. package/frontend/build/static/{LazyProjectExport-c4634b2a.js → LazyProjectExport-12bccd40.js} +1 -1
  21. package/frontend/build/static/{NetworkOverview-c762698b.js → NetworkOverview-349a7bdd.js} +2 -2
  22. package/frontend/build/static/{NetworkTraffic-c8d9eb9b.js → NetworkTraffic-60478e50.js} +1 -1
  23. package/frontend/build/static/{RoleCell-d1aa8288.js → RoleCell-144e7eca.js} +1 -1
  24. package/frontend/build/static/{StrategyItemContainer-c7c352a4.js → StrategyItemContainer-a4caeace.js} +1 -1
  25. package/frontend/build/static/{chartjs-adapter-date-fns.esm-9c67372b.js → chartjs-adapter-date-fns.esm-03d2fbea.js} +1 -1
  26. package/frontend/build/static/{flowchart-elk-definition-170a3958-5ea9fc56.js → flowchart-elk-definition-170a3958-fc100c77.js} +1 -1
  27. package/frontend/build/static/{index-b7003840.js → index-17d74ac9.js} +84 -84
  28. package/frontend/build/static/{index-1aaa8c27.js → index-3c63138f.js} +1 -1
  29. package/frontend/build/static/{index-670c9345.js → index-866f9bf9.js} +1 -1
  30. package/frontend/build/static/{is_dark-b445e102.js → is_dark-31c253e9.js} +1 -1
  31. package/frontend/build/static/{mindmap-definition-44684416-254e936e.js → mindmap-definition-44684416-398682f9.js} +1 -1
  32. package/frontend/build/static/{timeline-definition-8e5a9bc6-24fd1725.js → timeline-definition-8e5a9bc6-04a0ae08.js} +1 -1
  33. package/frontend/build/static/{unknownify-ea4585e8.js → unknownify-b8618d88.js} +1 -1
  34. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{c as l5,j as n,cF as I6,cI as P3,cH as C7,s as u,cp as l7,cm as Y5,a3 as a2,r as c,ek as c7,a9 as d1,a1 as n1,d as l,a4 as i2,a5 as s2,a6 as C2,a7 as l2,dp as d7,b6 as W1,E as y1,aM as c5,aN as e5,aO as t5,el as O6,aD as J,em as H1,bT as w1,f as h1,cg as v1,aw as H5,X as l1,en as u7,ab as c2,cS as i3,eo as B6,ep as V1,ar as r1,al as k1,aq as s1,C as S,aJ as S1,an as d5,am as _1,ck as p7,af as d2,eq as h7,b9 as M5,ba as E5,bb as T5,B as H,a$ as z1,t as N1,bg as g7,$ as u2,de as p2,er as i5,cq as s3,M as I1,es as Z2,b3 as O1,e6 as m7,b5 as B1,T as F,cs as $6,aI as h2,ae as J1,D as z6,m as C3,b as u1,aa as f1,et as f7,y as Y,eu as N6,ag as A1,i as p1,ev as y7,bt as v7,h as c1,bN as b7,bL as l3,c9 as g2,bO as W6,aU as m2,aZ as k5,aV as f2,ew as U6,dm as q6,bC as V7,au as L1,ah as c3,ex as _7,cn as x7,ey as w7,ez as S7,eA as H7,eB as G6,eC as K6,eD as J6,aj as Y6,eE as M7,eF as E7,eG as T7,d3 as y2,ak as v2,d4 as k7,cl as A7,bR as Q6,ad as b2,eH as L7,R as D7,aL as Z7,ch as R7,ai as X6,eI as F7,v as Z1,eJ as e4,P as t4,eK as n4,w as j7,eL as P7,eM as I7,aP as r4,eN as d3,e as o4,eO as a4,eP as O7,eQ as B7,eR as $7,eS as z7,bH as i4,eT as s4,eU as C4,eV as N7,eW as W7,a2 as A5,ac as V2,aF as U7,eX as q7,eY as _2,eZ as G7,e_ as l4,e$ as K7,f0 as J7,f1 as u5,f2 as n5,aG as R1,cv as p5,f3 as h5,f4 as g5,f5 as Y7,bQ as u3,f6 as c4,f7 as Q7,bo as F1,at as d4,cc as q5,bs as L5,f8 as X7,f9 as e8,fa as t8,l as p3,fb as n8,fc as r8,fd as o8,fe as a8,dE as h3,dF as Q5,by as i8,cb as s8,dv as X5,ff as C8,cu as g3,cZ as x2,bW as Y1,aH as s5,aK as m3,df as u4,dd as f3,aC as $1,ax as y3,fg as l8,A as c8,fh as d8,dj as $5,fi as u8,fj as p8,n as h8,o as g8,fk as m8,fl as f8,fm as y8,bU as m5,bV as e1,fn as v8,fo as I3,fp as p4,u as v3,az as b8,fq as V8,cV as _8,fr as O3,fs as x8,ft as w8,fu as S8,fv as H8,fw as M8,bm as E8,bn as T8,bz as k8,bA as A8,bB as L8,N as D8,fx as Z8,fy as R8,fz as h4,b$ as F8,av as j8,ay as P8,aB as I8,co as g4,ej as m4,fA as O8,db as f4,fB as C5,fC as Q,fD as B8,fE as $8,fF as z8,fG as N8,fH as W8,dk as U8,fI as q8,fJ as G8}from"./index-b7003840.js";import{e as y4,W as B3,b as K8,u as v4,T as J8,c as Y8,h as Q8,F as X8,V as e9,a as t9,g as n9,C as r9,U as o9,E as a9,i as i9}from"./FeatureArchiveDialog-b47b18e8.js";import{a as b4}from"./index-670c9345.js";import{i as s9,m as C9,h as l9,j as c9,b as d9,c as u9,d as p9,e as h9,E as g9,f as m9,u as f9,a as y9,R as v9,C as b9,A as V9,B as V4}from"./RoleCell-d1aa8288.js";import{S as _9}from"./StrategyItemContainer-c7c352a4.js";import{E as x9}from"./Error-e44ea66b.js";const w9=l5(n("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),S9=l5(n("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),H9=l5(n("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),M9=l5(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"),E9=l5(n("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),T9=l5(n("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function k9(e,t){I6(2,arguments);var r=P3(e),o=P3(t);return r.getTime()<o.getTime()}function A9(e,t){I6(2,arguments);var r=C7(t);return b4(e,-r)}const $3=u("div")(()=>({display:"flex"})),L9=u("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));u("div")(()=>({display:"flex",flexDirection:"column"}));const D9=u("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),Z9=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));u(Z9)(({theme:e})=>({color:e.palette.neutral.dark}));const R9=u(l7)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),F9=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),j9=u("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),P9=u("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),I9=u("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),O9=u("div")(({theme:e})=>({padding:e.spacing(0,4)})),B9=u(Y5)(({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}})),$9=e=>e.reduce((t,r)=>r.enabled?t+1:t,0),z9=u(a2)(({theme:e})=>({marginTop:e.spacing(3)})),N9=u("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),W9=({environment:e,warnEnabledToggles:t})=>{const r=c.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:p}})=>n(c7,{environment:p})},{Header:"Name",accessor:"name",Cell:d1},{Header:"Type",accessor:"type",Cell:d1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:p})=>n(d1,{children:n(N9,{warning:p>0,children:p===1?"1 toggle":`${p} toggles`})}),align:"center"}],[t]),{getTableProps:o,getTableBodyProps:a,headerGroups:i,rows:s,prepareRow:C}=n1.useTable({columns:r,data:[e],disableSortBy:!0});return l(z9,{...o(),rowHeight:"compact",children:[n(i2,{headerGroups:i}),n(s2,{...a(),children:s.map(p=>(C(p),n(C2,{hover:!0,...p.getRowProps(),children:p.cells.map(d=>n(l2,{...d.getCellProps(),children:d.render("Cell")}))})))})]})},U9=u("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),q9=u(d7)(()=>({width:"100%"})),G9=({environment:e,open:t,setOpen:r,onConfirm:o})=>{const[a,i]=c.useState("");return c.useEffect(()=>{i("")},[t]),l(W1,{title:"Hide environment and disable feature toggles?",open:t,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==a,secondaryButtonText:"Close",onClick:o,onClose:()=>{r(!1)},children:[l(y1,{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(W9,{environment:e}),l(U9,{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(q9,{label:"Environment name",value:a,onChange:s=>i(s.target.value)})]})},K9=e=>{const{data:t,error:r,mutate:o}=c5(e5(`api/admin/environments/project/${e}`),J9),a=c.useMemo(()=>t||[],[t]),i=c.useCallback(async()=>{await o()},[o]);return{environments:a,refetchEnvironments:i,loading:!r&&!t,error:r}},J9=async e=>(await fetch(e).then(t5("Environments")).then(r=>r.json())).environments.sort((r,o)=>r.sortOrder-o.sortOrder),Y9=u(y1)(({theme:e})=>({marginBottom:e.spacing(4)})),Q9=u("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),X9=u(O6)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),_4=()=>{const e=J("projectId"),t=H1(e);w1(`Project environments – ${t}`);const{setToastData:r,setToastApiError:o}=h1(),{environments:a,loading:i,error:s,refetchEnvironments:C}=K9(e),{project:p,refetch:d}=v1(e),{removeEnvironmentFromProject:h,addEnvironmentToProject:g}=H5(),[m,w]=c.useState(),[V,b]=c.useState(!1),{isOss:k}=l1(),f=c.useMemo(()=>a.map(L=>({...L,projectVisible:p==null?void 0:p.environments.map(N=>N.environment).includes(L.name)})),[a,p==null?void 0:p.environments]),T=()=>{C(),d()},M=()=>n(X9,{onClick:T,text:"Error fetching environments"}),j=L=>`Got an API error when trying to set the environment as ${L?"visible":"hidden"}`,B=async L=>{if(L.projectVisible){if($9(f)>1){w(L),b(!0);return}r({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,L.name),T(),r({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{o(j(!0))}},x=async()=>{if(m)try{await h(e,m.name),T(),r({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{o(j(!1))}finally{b(!1)}},Z=L=>k()&&L==="default",I=c.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:L}})=>n(u7,{environment:L})},{Header:"Type",accessor:"type",Cell:c2},{Header:"Project API tokens",accessor:L=>L.projectApiTokenCount===1?"1 token":`${L.projectApiTokenCount} tokens`,Cell:d1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:L}})=>n(i3,{children:n(B6,{tooltip:L.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:Z(L.name),projectId:e,permission:V1,checked:L.projectVisible,onChange:()=>B(L)})}),disableGlobalFilter:!0}],[f]),{getTableProps:O,getTableBodyProps:R,headerGroups:q,rows:G,prepareRow:W,state:{globalFilter:y},setGlobalFilter:v}=n1.useTable({columns:I,data:f,disableSortBy:!0},n1.useGlobalFilter),E=n(r1,{title:`Environments (${G.length})`,actions:n(k1,{initialValue:y,onChange:v})});return n(s1,{header:E,isLoading:i,children:l(Q9,{children:[n(S,{condition:!!s,show:M()}),l(Y9,{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(S1,{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(S1,{to:"/admin/api",children:"create a new API token here"}),"."]}),n(d5,{value:y,children:l(a2,{...O(),rowHeight:"compact",children:[n(i2,{headerGroups:q}),n(s2,{...R(),children:G.map(L=>(W(L),n(C2,{hover:!0,...L.getRowProps(),children:L.cells.map(N=>n(l2,{...N.getCellProps(),children:N.render("Cell")}))})))})]})}),n(S,{condition:G.length===0,show:n(S,{condition:(y==null?void 0:y.length)>0,show:l(_1,{children:["No environments found matching “",y,"”"]}),elseShow:n(_1,{children:"No environments available. Get started by adding one."})})}),n(G9,{environment:m,open:V,setOpen:b,onConfirm:x})]})})},e0={id:"archivedAt"},t0=({projectId:e})=>{const{archivedFeatures:t,loading:r,refetchArchived:o}=p7(e),{value:a,setValue:i}=d2(`${e}:ProjectFeaturesArchiveTable`,e0);return n(h7,{title:"Project archive",archivedFeatures:t||[],loading:r,storedParams:a,setStoredParams:i,refetch:o,projectId:e})},n0=()=>{const e=J("projectId"),t=H1(e);return w1(`Project archive – ${t}`),n(t0,{projectId:e})},r0=(e=[])=>{var o;let t=e.map(a=>a.environment);const r=c.useRef(t);return t.join("")!==((o=r.current)==null?void 0:o.join(""))&&(r.current=t),r.current};var b3={},o0=E5;Object.defineProperty(b3,"__esModule",{value:!0});var x4=b3.default=void 0,a0=o0(M5()),i0=T5,s0=(0,a0.default)((0,i0.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");x4=b3.default=s0;var V3={},C0=E5;Object.defineProperty(V3,"__esModule",{value:!0});var w4=V3.default=void 0,l0=C0(M5()),c0=T5,d0=(0,l0.default)((0,c0.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");w4=V3.default=d0;const u0=u(H)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),p0=({projectId:e,row:t,onOpenArchiveDialog:r,onOpenStaleDialog:o})=>{const[a,i]=c.useState(null),{original:{name:s,stale:C}}=t,p=!!a,d=w=>{i(w.currentTarget)},h=()=>{i(null)},g=`feature-${s}-actions`,m=`${g}-menu`;return l(u0,{children:[n(z1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:n(N1,{id:g,"aria-controls":p?m:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:d,type:"button",children:n(g7,{})})}),n(u2,{id:m,anchorEl:a,open:p,onClose:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:w=>({borderRadius:`${w.shape.borderRadius}px`,padding:w.spacing(1,1.5)})},children:l(p2,{"aria-labelledby":g,children:[n(i5,{projectId:e,permission:s3,children:({hasAccess:w})=>l(I1,{sx:Z2,onClick:h,disabled:!w,component:S1,to:`/projects/${e}/features/${s}/strategies/copy`,children:[n(O1,{children:n(m7,{})}),n(B1,{children:n(F,{variant:"body2",children:"Copy"})})]})}),n(i5,{projectId:e,permission:$6,children:({hasAccess:w})=>l(I1,{sx:Z2,onClick:()=>{r(s),h()},disabled:!w,children:[n(O1,{children:n(x4,{})}),n(B1,{children:n(F,{variant:"body2",children:"Archive"})})]})}),n(i5,{projectId:e,permission:h2,children:({hasAccess:w})=>l(I1,{sx:Z2,onClick:()=>{h(),o({featureId:s,stale:C===!0})},disabled:!w,children:[n(O1,{children:n(w4,{})}),n(B1,{children:l(F,{variant:"body2",children:[C?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var _3={},h0=E5;Object.defineProperty(_3,"__esModule",{value:!0});var S4=_3.default=void 0,g0=h0(M5()),m0=T5,f0=(0,g0.default)((0,m0.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");S4=_3.default=f0;const y0=u(H)(()=>({...J1,justifyContent:"center"})),v0=u(N1)(({theme:e})=>({margin:e.spacing(-1,0)})),b0=u(H)(({theme:e})=>({...J1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),V0=u(I1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),z3=u(z6)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),_0=u(C3)(({theme:e})=>({padding:e.spacing(.75,1)})),x0={favorite:"Favorite"},w0=({allColumns:e,staticColumns:t=[],dividerBefore:r=[],dividerAfter:o=[],isCustomized:a=!1,setHiddenColumns:i})=>{const[s,C]=c.useState(null),p=u1(),d=f1(p.breakpoints.down("sm")),h=f1(p.breakpoints.down("md")),g=f1(p.breakpoints.down("lg"));c.useEffect(()=>{if(a)return;const f=(T,M=0)=>{const j=e.filter(({id:x})=>x.startsWith("environments.")!==!1).map(({id:x})=>x).slice(0,M),B=e.map(({id:x})=>x).filter(x=>!T.includes(x)).filter(x=>!t.includes(x)).filter(x=>!j.includes(x));i(B)};if(d)return f(["createdAt"]);if(h)return f(["createdAt"],1);if(g)return f(["type","createdAt"],1);f(["lastSeenAt","type","createdAt"],3)},[d,h,g]);const m=f=>{C(f.currentTarget)},w=()=>{C(null)},V=!!s,b="columns-menu",k=`columns-menu-list-${b}`;return l(y0,{children:[n(z1,{title:"Select columns",arrow:!0,describeChild:!0,children:n(v0,{id:b,"aria-controls":V?k:void 0,"aria-haspopup":"true","aria-expanded":V?"true":void 0,onClick:m,type:"button",size:"large","data-loading":!0,children:n(S4,{})})}),l(u2,{id:k,open:V,anchorEl:s,onClose:w,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(b0,{children:[n(F,{variant:"body2",children:n("strong",{children:"Columns"})}),n(N1,{onClick:w,children:n(f7,{})})]}),n(p2,{children:e.filter(({hideInMenu:f})=>!f).map(f=>[n(S,{condition:r.includes(f.id),show:n(z3,{})}),l(V0,{onClick:()=>f.toggleHidden(f.isVisible),disabled:t.includes(f.id),children:[n(O1,{children:n(_0,{edge:"start",checked:f.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":f.id},size:"medium"})}),n(B1,{id:f.id,primary:n(F,{variant:"body2",children:n(S,{condition:!!(typeof f.Header=="string"&&f.Header),show:()=>n(Y,{children:f.Header}),elseShow:()=>x0[f.id]||f.id})})})]}),n(S,{condition:o.includes(f.id),show:n(z3,{})})])})]})]})},S0=N6()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),H0=7,M0=e=>{const t=b4(new Date,-H0);return!!(e&&e.lastSeenAt&&k9(new Date(e.lastSeenAt),t))},E0=({projectId:e,featureIds:t,features:r})=>{const{refetch:o}=v1(e),[a,i]=c.useState(!1),{trackEvent:s}=A1(),C=c.useMemo(()=>t.filter(d=>{const h=r.find(g=>g.name===d);return M0(h)}),[JSON.stringify(r),t]);return l(Y,{children:[n(i5,{projectId:e,permission:$6,children:({hasAccess:d})=>n(p1,{disabled:!d||a,variant:"outlined",size:"small",onClick:()=>i(!0),children:"Archive"})}),n(y4,{projectId:e,featureIds:t,featuresWithUsage:C,onConfirm:async()=>{i(!1),await o(),s("batch_operations",{props:{eventType:"features archived"}})},isOpen:a,onClose:()=>i(!1)})]})},z5="selection-actions-menu",T0=({projectId:e,data:t})=>{const{refetch:r}=v1(e),[o,a]=c.useState(null),{staleFeatures:i}=H5(),{setToastData:s,setToastApiError:C}=h1(),{trackEvent:p}=A1(),d=!!o,h=t.map(({name:f})=>f),g=f=>{a(f.currentTarget)},m=()=>{a(null)},w=t.some(({stale:f})=>f===!0),V=t.some(({stale:f})=>f===!1),b=async()=>{try{m(),await i(e,h),await r(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),p("batch_operations",{props:{eventType:"features staled"}})}catch(f){C(c1(f))}},k=async()=>{try{m(),await i(e,h,!1),await r(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),p("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){C(c1(f))}};return l(Y,{children:[n(z1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:n(N1,{id:z5,"aria-controls":d?z5:void 0,"aria-haspopup":"true","aria-expanded":d?"true":void 0,onClick:g,type:"button","data-testid":y7,children:n(v7,{})})}),n(u2,{id:`${z5}-menu`,anchorEl:o,open:d,onClose:m,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(p2,{"aria-labelledby":`${z5}-menu`,children:n(i5,{projectId:e,permission:h2,children:({hasAccess:f})=>l(Y,{children:[n(S,{condition:V,show:()=>l(I1,{onClick:b,disabled:!f,sx:{borderRadius:T=>`${T.shape.borderRadius}px`},children:[n(O1,{children:n(B3,{})}),n(B1,{children:n(F,{variant:"body2",children:"Mark as stale"})})]})}),n(S,{condition:w,show:()=>l(I1,{onClick:k,disabled:!f,sx:{borderRadius:T=>`${T.shape.borderRadius}px`},children:[n(O1,{children:n(B3,{})}),n(B1,{children:n(F,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},k0=u("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),N3="manage-tags-form",W3=(e,t)=>[...e,...e.some(r=>r.value===t.value&&r.type===t.type)?[]:[t]],U3=(e,t)=>e.filter(r=>!(r.value===t.value&&r.type===t.type)),A0=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:W3(e.addedTags,t.payload),removedTags:U3(e.removedTags,t.payload)};case"remove":return{...e,addedTags:U3(e.addedTags,t.payload),removedTags:W3(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};default:return e}},q3={name:"",description:"",icon:""},L0=({open:e,initialValues:t,initialIndeterminateValues:r,onCancel:o,onSubmit:a})=>{const{tagTypes:i,loading:s}=b7(),[C,p]=c.useState(q3),[d,h]=c.useState([]),[g,m]=c.useState([]),{tags:w,refetch:V}=K8(C.name),{createTag:b}=v4(),k=w.map(({value:I})=>({title:I})),[f,T]=c.useReducer(A0,{addedTags:[],removedTags:[]}),M=(I=i.length>0?i[0]:q3)=>{p(I);const O=r.filter(({type:R})=>R===I.name);h(t.filter(({type:R})=>R===I.name).filter(({type:R,value:q})=>!O.some(G=>G.value===q&&G.type===R)).map(({value:R})=>({title:R}))),m(O.map(({value:R})=>({title:R}))),T({type:"clear",payload:[]})};c.useEffect(()=>{i.length>0&&M()},[s]);const j=(I,O)=>{O!=null&&typeof O!="string"&&(I.preventDefault(),M(O))},B=(I,O)=>b({value:I,type:O}).then(async()=>{await V(),h(R=>[...R,{title:I}]),T({type:"add",payload:{value:I,type:O}})}),x=(I,O,R,q)=>{R==="selectOption"?O.forEach(G=>{if(typeof G!="string"&&typeof G.inputValue=="string"&&G.inputValue&&G.title.startsWith("Create new value"))return B(G.inputValue,C.name);h(O),m(W=>W.filter(({title:y})=>y!==G.title)),q!=null&&q.option&&T({type:"add",payload:{value:q.option.title,type:C.name}})}):R==="clear"?(h([]),T({type:"clear",payload:t})):R==="removeOption"&&(h(O),q!=null&&q.option&&T({type:"remove",payload:{value:q.option.title,type:C.name}}))},Z=()=>{M(),o()};return l(W1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>a(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:Z,formId:N3,children:[n(F,{paragraph:!0,sx:{marginBottom:I=>I.spacing(2.5)},children:"Tags allow you to group features together"}),n("form",{id:N3,onSubmit:()=>a(f),children:l(k0,{children:[n(J8,{options:i,disabled:s||i.length===0,value:C,onChange:j},s?"loading":i.length),n(S,{condition:!s&&i.length===0,show:l(F,{variant:"body1",children:["No"," ",n(l3,{component:S1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:n(Y8,{disabled:s,options:k,existingTags:t,indeterminateOptions:g,tagType:C,selectedOptions:d,onChange:x})})]})})]})},D0=({projectId:e,data:t})=>{const{bulkUpdateTags:r}=v4(),{refetch:o}=v1(e),{setToastData:a,setToastApiError:i}=h1(),{trackEvent:s}=A1(),[C,p]=c.useState(!1),[d,h]=c.useMemo(()=>{const m=t.flatMap(({tags:V})=>V||[]).reduce((V,b)=>[...V,...V.some(k=>k.type===b.type&&k.value===b.value)?[]:[b]],[]),w=m.filter(V=>!t.every(({tags:b})=>b==null?void 0:b.some(k=>k.type===V.type&&k.value===V.value)));return[m,w]},[t]);return l(Y,{children:[n(i5,{projectId:e,permission:h2,children:({hasAccess:m})=>n(p1,{disabled:!m||C,variant:"outlined",size:"small",onClick:()=>p(!0),children:"Tags"})}),n(L0,{open:C,onCancel:()=>p(!1),onSubmit:async({addedTags:m,removedTags:w})=>{const V=t.map(({name:k})=>k),b={features:V,tags:{addedTags:m,removedTags:w}};try{await r(b,e),o();const k=m.length?`Added tags: ${m.map(({type:T,value:M})=>`${T}:${M}`).join(", ")}.`:"",f=w.length?`Removed tags: ${w.map(({type:T,value:M})=>`${T}:${M}`).join(", ")}.`:"";a({title:"Tags updated",text:`${V.length} feature toggles updated. ${k} ${f}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(k){i(c1(k))}p(!1)},initialValues:d,initialIndeterminateValues:h},t.length)]})},Z0=u(g2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),G3=u(y1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),R0=({showExportDialog:e,data:t,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,C]=c.useState(a[0]),{bulkToggleFeaturesEnvironmentOff:p}=W6(),{addChange:d}=m2(),{refetch:h}=v1(i),{setToastApiError:g,setToastData:m}=h1(),{isChangeRequestConfigured:w}=k5(i),{refetch:V}=f2(i),b=t.filter(M=>{var j,B;return((B=(j=M.environments)==null?void 0:j.find(x=>s===x.name))==null?void 0:B.enabled)===!1}).length,k=()=>a.map(M=>({key:M,label:M})),f=async()=>{try{w(s)?(await d(i,s,t.map(M=>({action:"updateEnabled",feature:M.name,payload:{enabled:!1}}))),V(),m({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await p(i,t.map(M=>M.name),s),h(),m({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),r(),o==null||o()}catch(M){g(c1(M))}},T=w(s)?"Add to change request":"Disable toggles";return n(W1,{open:e,title:"Disable feature toggles",onClose:r,onClick:f,primaryButtonText:T,secondaryButtonText:"Cancel",children:l(H,{children:["You have selected ",n("b",{children:t.length})," feature toggles to disable.",n("br",{}),n("br",{}),n(F,{children:"Select which environment to disable the features for:"}),n(Z0,{options:k(),value:s,onChange:M=>C(M)}),n(S,{condition:w(s),show:n(G3,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(S,{condition:b>0,show:l(G3,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},F0=u(g2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),K3=u(y1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),j0=({showExportDialog:e,data:t,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,C]=c.useState(a[0]),{bulkToggleFeaturesEnvironmentOn:p}=W6(),{addChange:d}=m2(),{refetch:h}=v1(i),{setToastApiError:g,setToastData:m}=h1(),{isChangeRequestConfigured:w}=k5(i),{refetch:V}=f2(i),b=t.filter(M=>{var j,B;return((B=(j=M.environments)==null?void 0:j.find(x=>s===x.name))==null?void 0:B.enabled)===!0}).length,k=()=>a.map(M=>({key:M,label:M})),f=async()=>{try{w(s)?(await d(i,s,t.map(M=>({action:"updateEnabled",feature:M.name,payload:{enabled:!0}}))),V(),m({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await p(i,t.map(M=>M.name),s),h(),m({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),r(),o==null||o()}catch(M){g(c1(M))}},T=w(s)?"Add to change request":"Enable toggles";return n(W1,{open:e,title:"Enable feature toggles",onClose:r,onClick:f,primaryButtonText:T,secondaryButtonText:"Cancel",children:l(H,{children:["You have selected ",n("b",{children:t.length})," feature toggles to enable.",n("br",{}),n("br",{}),n(F,{children:"Select which environment to enable the features for:"}),n(F0,{options:k(),value:s,onChange:M=>C(M)}),n(S,{condition:w(s),show:n(K3,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(S,{condition:b>0,show:l(K3,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},P0=({selectedIds:e,data:t,projectId:r})=>{var k,f;const{uiConfig:o}=l1(),[a,i]=c.useState(!1),[s,C]=c.useState(!1),[p,d]=c.useState(!1),{trackEvent:h}=A1(),g=c.useMemo(()=>t.filter(T=>e.includes(T.name)),[t,e]),m=c.useMemo(()=>{const T=g.flatMap(M=>M.environments).map(M=>M==null?void 0:M.name).filter(M=>M!==void 0);return Array.from(new Set(T))},[g]),w=()=>{h("batch_operations",{props:{eventType:"features exported"}})},V=()=>{h("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{h("batch_operations",{props:{eventType:"features disabled"}})};return l(Y,{children:[n(S,{condition:!!((k=o==null?void 0:o.flags)!=null&&k.disableBulkToggle),show:null,elseShow:n(p1,{variant:"outlined",size:"small",onClick:()=>C(!0),children:"Enable"})}),n(S,{condition:!!((f=o==null?void 0:o.flags)!=null&&f.disableBulkToggle),show:null,elseShow:n(p1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Disable"})}),n(E0,{projectId:r,featureIds:e,features:t}),n(p1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),n(D0,{projectId:r,data:g}),n(T0,{projectId:r,data:g}),n(U6,{showExportDialog:a,data:g,onClose:()=>i(!1),environments:m,onConfirm:w}),n(j0,{showExportDialog:s,data:g,onClose:()=>C(!1),environments:m,projectId:r,onConfirm:V}),n(R0,{showExportDialog:p,data:g,onClose:()=>d(!1),environments:m,projectId:r,onConfirm:b})]})},I0=u(q6)(()=>({whiteSpace:"nowrap"})),O0=u("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...J1,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),N5=["Select","Actions","name","favorite"],B0={id:"createdAt"},$0=({features:e,loading:t,environments:r=[]})=>{var o5,G1;const{classes:o}=S0(),a=u1(),i=f1(a.breakpoints.down("md")),[s,C]=c.useState({open:!1,featureId:"",environmentName:""}),[p,d]=c.useState({}),[h,g]=c.useState(),m=J("projectId"),{value:w,setValue:V}=d2(`${m}:FeatureToggleListTable:v1`,B0),{value:b,setValue:k}=V7(),f=L1(),[T,M]=c3(),j=r0(t?[{environment:"a"},{environment:"b"},{environment:"c"}]:r),{refetch:B}=v1(m),{isFavoritesPinned:x,sortTypes:Z,onChangeIsFavoritePinned:I}=_7(T.has("favorites")?T.get("favorites")==="true":b.favorites),{favorite:O,unfavorite:R}=x7(),{onChangeRequestToggleClose:q,onChangeRequestToggleConfirm:G,changeRequestDialogDetails:W}=Q8(m),[y,v]=c.useState(!1),{uiConfig:E}=l1(),L=!!E.flags.lastSeenByEnvironment,N=c.useCallback(async A=>{A!=null&&A.favorite?await R(m,A.name):await O(m,A.name),B()},[m,B]),D=c.useMemo(()=>e.some(A=>{var $;return($=A==null?void 0:A.tags)==null?void 0:$.length}),[e]),K=c.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:A})=>n(C3,{...A()}),Cell:({row:A})=>{var $;return n(w7,{...($=A==null?void 0:A.getToggleRowSelectedProps)==null?void 0:$.call(A)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:n(S7,{isActive:x,onClick:I}),accessor:"favorite",Cell:({row:{original:A}})=>n(H7,{value:A==null?void 0:A.favorite,onClick:()=>N(A)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:({value:A,row:{original:$}})=>L?n(G6,{feature:$}):n(K6,{value:A}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:J6,align:"center",filterName:"type",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:A})=>n(z1,{title:A,arrow:!0,describeChild:!0,children:n("span",{children:n(Y6,{title:A,to:`/projects/${m}/features/${A}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...D?[{id:"tags",Header:"Tags",accessor:A=>{var $;return(($=A.tags)==null?void 0:$.map(({type:a1,value:z})=>`${a1}:${z}`).join(`
1
+ import{c as l5,j as n,cF as I6,cI as P3,cH as C7,s as u,cp as l7,cm as Y5,a3 as a2,r as c,ek as c7,a9 as d1,a1 as n1,d as l,a4 as i2,a5 as s2,a6 as C2,a7 as l2,dp as d7,b6 as W1,E as y1,aM as c5,aN as e5,aO as t5,el as O6,aD as J,em as H1,bT as w1,f as h1,cg as v1,aw as H5,X as l1,en as u7,ab as c2,cS as i3,eo as B6,ep as V1,ar as r1,al as k1,aq as s1,C as S,aJ as S1,an as d5,am as _1,ck as p7,af as d2,eq as h7,b9 as M5,ba as E5,bb as T5,B as H,a$ as z1,t as N1,bg as g7,$ as u2,de as p2,er as i5,cq as s3,M as I1,es as Z2,b3 as O1,e6 as m7,b5 as B1,T as F,cs as $6,aI as h2,ae as J1,D as z6,m as C3,b as u1,aa as f1,et as f7,y as Y,eu as N6,ag as A1,i as p1,ev as y7,bt as v7,h as c1,bN as b7,bL as l3,c9 as g2,bO as W6,aU as m2,aZ as k5,aV as f2,ew as U6,dm as q6,bC as V7,au as L1,ah as c3,ex as _7,cn as x7,ey as w7,ez as S7,eA as H7,eB as G6,eC as K6,eD as J6,aj as Y6,eE as M7,eF as E7,eG as T7,d3 as y2,ak as v2,d4 as k7,cl as A7,bR as Q6,ad as b2,eH as L7,R as D7,aL as Z7,ch as R7,ai as X6,eI as F7,v as Z1,eJ as e4,P as t4,eK as n4,w as j7,eL as P7,eM as I7,aP as r4,eN as d3,e as o4,eO as a4,eP as O7,eQ as B7,eR as $7,eS as z7,bH as i4,eT as s4,eU as C4,eV as N7,eW as W7,a2 as A5,ac as V2,aF as U7,eX as q7,eY as _2,eZ as G7,e_ as l4,e$ as K7,f0 as J7,f1 as u5,f2 as n5,aG as R1,cv as p5,f3 as h5,f4 as g5,f5 as Y7,bQ as u3,f6 as c4,f7 as Q7,bo as F1,at as d4,cc as q5,bs as L5,f8 as X7,f9 as e8,fa as t8,l as p3,fb as n8,fc as r8,fd as o8,fe as a8,dE as h3,dF as Q5,by as i8,cb as s8,dv as X5,ff as C8,cu as g3,cZ as x2,bW as Y1,aH as s5,aK as m3,df as u4,dd as f3,aC as $1,ax as y3,fg as l8,A as c8,fh as d8,dj as $5,fi as u8,fj as p8,n as h8,o as g8,fk as m8,fl as f8,fm as y8,bU as m5,bV as e1,fn as v8,fo as I3,fp as p4,u as v3,az as b8,fq as V8,cV as _8,fr as O3,fs as x8,ft as w8,fu as S8,fv as H8,fw as M8,bm as E8,bn as T8,bz as k8,bA as A8,bB as L8,N as D8,fx as Z8,fy as R8,fz as h4,b$ as F8,av as j8,ay as P8,aB as I8,co as g4,ej as m4,fA as O8,db as f4,fB as C5,fC as Q,fD as B8,fE as $8,fF as z8,fG as N8,fH as W8,dk as U8,fI as q8,fJ as G8}from"./index-17d74ac9.js";import{e as y4,W as B3,b as K8,u as v4,T as J8,c as Y8,h as Q8,F as X8,V as e9,a as t9,g as n9,C as r9,U as o9,E as a9,i as i9}from"./FeatureArchiveDialog-8a281845.js";import{a as b4}from"./index-866f9bf9.js";import{i as s9,m as C9,h as l9,j as c9,b as d9,c as u9,d as p9,e as h9,E as g9,f as m9,u as f9,a as y9,R as v9,C as b9,A as V9,B as V4}from"./RoleCell-144e7eca.js";import{S as _9}from"./StrategyItemContainer-a4caeace.js";import{E as x9}from"./Error-cbce6b64.js";const w9=l5(n("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),S9=l5(n("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),H9=l5(n("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),M9=l5(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"),E9=l5(n("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),T9=l5(n("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function k9(e,t){I6(2,arguments);var r=P3(e),o=P3(t);return r.getTime()<o.getTime()}function A9(e,t){I6(2,arguments);var r=C7(t);return b4(e,-r)}const $3=u("div")(()=>({display:"flex"})),L9=u("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));u("div")(()=>({display:"flex",flexDirection:"column"}));const D9=u("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),Z9=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));u(Z9)(({theme:e})=>({color:e.palette.neutral.dark}));const R9=u(l7)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),F9=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),j9=u("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),P9=u("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),I9=u("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),O9=u("div")(({theme:e})=>({padding:e.spacing(0,4)})),B9=u(Y5)(({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}})),$9=e=>e.reduce((t,r)=>r.enabled?t+1:t,0),z9=u(a2)(({theme:e})=>({marginTop:e.spacing(3)})),N9=u("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),W9=({environment:e,warnEnabledToggles:t})=>{const r=c.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:p}})=>n(c7,{environment:p})},{Header:"Name",accessor:"name",Cell:d1},{Header:"Type",accessor:"type",Cell:d1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:p})=>n(d1,{children:n(N9,{warning:p>0,children:p===1?"1 toggle":`${p} toggles`})}),align:"center"}],[t]),{getTableProps:o,getTableBodyProps:a,headerGroups:i,rows:s,prepareRow:C}=n1.useTable({columns:r,data:[e],disableSortBy:!0});return l(z9,{...o(),rowHeight:"compact",children:[n(i2,{headerGroups:i}),n(s2,{...a(),children:s.map(p=>(C(p),n(C2,{hover:!0,...p.getRowProps(),children:p.cells.map(d=>n(l2,{...d.getCellProps(),children:d.render("Cell")}))})))})]})},U9=u("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),q9=u(d7)(()=>({width:"100%"})),G9=({environment:e,open:t,setOpen:r,onConfirm:o})=>{const[a,i]=c.useState("");return c.useEffect(()=>{i("")},[t]),l(W1,{title:"Hide environment and disable feature toggles?",open:t,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==a,secondaryButtonText:"Close",onClick:o,onClose:()=>{r(!1)},children:[l(y1,{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(W9,{environment:e}),l(U9,{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(q9,{label:"Environment name",value:a,onChange:s=>i(s.target.value)})]})},K9=e=>{const{data:t,error:r,mutate:o}=c5(e5(`api/admin/environments/project/${e}`),J9),a=c.useMemo(()=>t||[],[t]),i=c.useCallback(async()=>{await o()},[o]);return{environments:a,refetchEnvironments:i,loading:!r&&!t,error:r}},J9=async e=>(await fetch(e).then(t5("Environments")).then(r=>r.json())).environments.sort((r,o)=>r.sortOrder-o.sortOrder),Y9=u(y1)(({theme:e})=>({marginBottom:e.spacing(4)})),Q9=u("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),X9=u(O6)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),_4=()=>{const e=J("projectId"),t=H1(e);w1(`Project environments – ${t}`);const{setToastData:r,setToastApiError:o}=h1(),{environments:a,loading:i,error:s,refetchEnvironments:C}=K9(e),{project:p,refetch:d}=v1(e),{removeEnvironmentFromProject:h,addEnvironmentToProject:g}=H5(),[m,w]=c.useState(),[V,b]=c.useState(!1),{isOss:k}=l1(),f=c.useMemo(()=>a.map(L=>({...L,projectVisible:p==null?void 0:p.environments.map(N=>N.environment).includes(L.name)})),[a,p==null?void 0:p.environments]),T=()=>{C(),d()},M=()=>n(X9,{onClick:T,text:"Error fetching environments"}),j=L=>`Got an API error when trying to set the environment as ${L?"visible":"hidden"}`,B=async L=>{if(L.projectVisible){if($9(f)>1){w(L),b(!0);return}r({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,L.name),T(),r({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{o(j(!0))}},x=async()=>{if(m)try{await h(e,m.name),T(),r({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{o(j(!1))}finally{b(!1)}},Z=L=>k()&&L==="default",I=c.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:L}})=>n(u7,{environment:L})},{Header:"Type",accessor:"type",Cell:c2},{Header:"Project API tokens",accessor:L=>L.projectApiTokenCount===1?"1 token":`${L.projectApiTokenCount} tokens`,Cell:d1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:L}})=>n(i3,{children:n(B6,{tooltip:L.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:Z(L.name),projectId:e,permission:V1,checked:L.projectVisible,onChange:()=>B(L)})}),disableGlobalFilter:!0}],[f]),{getTableProps:O,getTableBodyProps:R,headerGroups:q,rows:G,prepareRow:W,state:{globalFilter:y},setGlobalFilter:v}=n1.useTable({columns:I,data:f,disableSortBy:!0},n1.useGlobalFilter),E=n(r1,{title:`Environments (${G.length})`,actions:n(k1,{initialValue:y,onChange:v})});return n(s1,{header:E,isLoading:i,children:l(Q9,{children:[n(S,{condition:!!s,show:M()}),l(Y9,{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(S1,{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(S1,{to:"/admin/api",children:"create a new API token here"}),"."]}),n(d5,{value:y,children:l(a2,{...O(),rowHeight:"compact",children:[n(i2,{headerGroups:q}),n(s2,{...R(),children:G.map(L=>(W(L),n(C2,{hover:!0,...L.getRowProps(),children:L.cells.map(N=>n(l2,{...N.getCellProps(),children:N.render("Cell")}))})))})]})}),n(S,{condition:G.length===0,show:n(S,{condition:(y==null?void 0:y.length)>0,show:l(_1,{children:["No environments found matching “",y,"”"]}),elseShow:n(_1,{children:"No environments available. Get started by adding one."})})}),n(G9,{environment:m,open:V,setOpen:b,onConfirm:x})]})})},e0={id:"archivedAt"},t0=({projectId:e})=>{const{archivedFeatures:t,loading:r,refetchArchived:o}=p7(e),{value:a,setValue:i}=d2(`${e}:ProjectFeaturesArchiveTable`,e0);return n(h7,{title:"Project archive",archivedFeatures:t||[],loading:r,storedParams:a,setStoredParams:i,refetch:o,projectId:e})},n0=()=>{const e=J("projectId"),t=H1(e);return w1(`Project archive – ${t}`),n(t0,{projectId:e})},r0=(e=[])=>{var o;let t=e.map(a=>a.environment);const r=c.useRef(t);return t.join("")!==((o=r.current)==null?void 0:o.join(""))&&(r.current=t),r.current};var b3={},o0=E5;Object.defineProperty(b3,"__esModule",{value:!0});var x4=b3.default=void 0,a0=o0(M5()),i0=T5,s0=(0,a0.default)((0,i0.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");x4=b3.default=s0;var V3={},C0=E5;Object.defineProperty(V3,"__esModule",{value:!0});var w4=V3.default=void 0,l0=C0(M5()),c0=T5,d0=(0,l0.default)((0,c0.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");w4=V3.default=d0;const u0=u(H)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),p0=({projectId:e,row:t,onOpenArchiveDialog:r,onOpenStaleDialog:o})=>{const[a,i]=c.useState(null),{original:{name:s,stale:C}}=t,p=!!a,d=w=>{i(w.currentTarget)},h=()=>{i(null)},g=`feature-${s}-actions`,m=`${g}-menu`;return l(u0,{children:[n(z1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:n(N1,{id:g,"aria-controls":p?m:void 0,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:d,type:"button",children:n(g7,{})})}),n(u2,{id:m,anchorEl:a,open:p,onClose:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:w=>({borderRadius:`${w.shape.borderRadius}px`,padding:w.spacing(1,1.5)})},children:l(p2,{"aria-labelledby":g,children:[n(i5,{projectId:e,permission:s3,children:({hasAccess:w})=>l(I1,{sx:Z2,onClick:h,disabled:!w,component:S1,to:`/projects/${e}/features/${s}/strategies/copy`,children:[n(O1,{children:n(m7,{})}),n(B1,{children:n(F,{variant:"body2",children:"Copy"})})]})}),n(i5,{projectId:e,permission:$6,children:({hasAccess:w})=>l(I1,{sx:Z2,onClick:()=>{r(s),h()},disabled:!w,children:[n(O1,{children:n(x4,{})}),n(B1,{children:n(F,{variant:"body2",children:"Archive"})})]})}),n(i5,{projectId:e,permission:h2,children:({hasAccess:w})=>l(I1,{sx:Z2,onClick:()=>{h(),o({featureId:s,stale:C===!0})},disabled:!w,children:[n(O1,{children:n(w4,{})}),n(B1,{children:l(F,{variant:"body2",children:[C?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var _3={},h0=E5;Object.defineProperty(_3,"__esModule",{value:!0});var S4=_3.default=void 0,g0=h0(M5()),m0=T5,f0=(0,g0.default)((0,m0.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");S4=_3.default=f0;const y0=u(H)(()=>({...J1,justifyContent:"center"})),v0=u(N1)(({theme:e})=>({margin:e.spacing(-1,0)})),b0=u(H)(({theme:e})=>({...J1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),V0=u(I1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),z3=u(z6)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),_0=u(C3)(({theme:e})=>({padding:e.spacing(.75,1)})),x0={favorite:"Favorite"},w0=({allColumns:e,staticColumns:t=[],dividerBefore:r=[],dividerAfter:o=[],isCustomized:a=!1,setHiddenColumns:i})=>{const[s,C]=c.useState(null),p=u1(),d=f1(p.breakpoints.down("sm")),h=f1(p.breakpoints.down("md")),g=f1(p.breakpoints.down("lg"));c.useEffect(()=>{if(a)return;const f=(T,M=0)=>{const j=e.filter(({id:x})=>x.startsWith("environments.")!==!1).map(({id:x})=>x).slice(0,M),B=e.map(({id:x})=>x).filter(x=>!T.includes(x)).filter(x=>!t.includes(x)).filter(x=>!j.includes(x));i(B)};if(d)return f(["createdAt"]);if(h)return f(["createdAt"],1);if(g)return f(["type","createdAt"],1);f(["lastSeenAt","type","createdAt"],3)},[d,h,g]);const m=f=>{C(f.currentTarget)},w=()=>{C(null)},V=!!s,b="columns-menu",k=`columns-menu-list-${b}`;return l(y0,{children:[n(z1,{title:"Select columns",arrow:!0,describeChild:!0,children:n(v0,{id:b,"aria-controls":V?k:void 0,"aria-haspopup":"true","aria-expanded":V?"true":void 0,onClick:m,type:"button",size:"large","data-loading":!0,children:n(S4,{})})}),l(u2,{id:k,open:V,anchorEl:s,onClose:w,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(b0,{children:[n(F,{variant:"body2",children:n("strong",{children:"Columns"})}),n(N1,{onClick:w,children:n(f7,{})})]}),n(p2,{children:e.filter(({hideInMenu:f})=>!f).map(f=>[n(S,{condition:r.includes(f.id),show:n(z3,{})}),l(V0,{onClick:()=>f.toggleHidden(f.isVisible),disabled:t.includes(f.id),children:[n(O1,{children:n(_0,{edge:"start",checked:f.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":f.id},size:"medium"})}),n(B1,{id:f.id,primary:n(F,{variant:"body2",children:n(S,{condition:!!(typeof f.Header=="string"&&f.Header),show:()=>n(Y,{children:f.Header}),elseShow:()=>x0[f.id]||f.id})})})]}),n(S,{condition:o.includes(f.id),show:n(z3,{})})])})]})]})},S0=N6()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),H0=7,M0=e=>{const t=b4(new Date,-H0);return!!(e&&e.lastSeenAt&&k9(new Date(e.lastSeenAt),t))},E0=({projectId:e,featureIds:t,features:r})=>{const{refetch:o}=v1(e),[a,i]=c.useState(!1),{trackEvent:s}=A1(),C=c.useMemo(()=>t.filter(d=>{const h=r.find(g=>g.name===d);return M0(h)}),[JSON.stringify(r),t]);return l(Y,{children:[n(i5,{projectId:e,permission:$6,children:({hasAccess:d})=>n(p1,{disabled:!d||a,variant:"outlined",size:"small",onClick:()=>i(!0),children:"Archive"})}),n(y4,{projectId:e,featureIds:t,featuresWithUsage:C,onConfirm:async()=>{i(!1),await o(),s("batch_operations",{props:{eventType:"features archived"}})},isOpen:a,onClose:()=>i(!1)})]})},z5="selection-actions-menu",T0=({projectId:e,data:t})=>{const{refetch:r}=v1(e),[o,a]=c.useState(null),{staleFeatures:i}=H5(),{setToastData:s,setToastApiError:C}=h1(),{trackEvent:p}=A1(),d=!!o,h=t.map(({name:f})=>f),g=f=>{a(f.currentTarget)},m=()=>{a(null)},w=t.some(({stale:f})=>f===!0),V=t.some(({stale:f})=>f===!1),b=async()=>{try{m(),await i(e,h),await r(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),p("batch_operations",{props:{eventType:"features staled"}})}catch(f){C(c1(f))}},k=async()=>{try{m(),await i(e,h,!1),await r(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),p("batch_operations",{props:{eventType:"features unstaled"}})}catch(f){C(c1(f))}};return l(Y,{children:[n(z1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:n(N1,{id:z5,"aria-controls":d?z5:void 0,"aria-haspopup":"true","aria-expanded":d?"true":void 0,onClick:g,type:"button","data-testid":y7,children:n(v7,{})})}),n(u2,{id:`${z5}-menu`,anchorEl:o,open:d,onClose:m,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(p2,{"aria-labelledby":`${z5}-menu`,children:n(i5,{projectId:e,permission:h2,children:({hasAccess:f})=>l(Y,{children:[n(S,{condition:V,show:()=>l(I1,{onClick:b,disabled:!f,sx:{borderRadius:T=>`${T.shape.borderRadius}px`},children:[n(O1,{children:n(B3,{})}),n(B1,{children:n(F,{variant:"body2",children:"Mark as stale"})})]})}),n(S,{condition:w,show:()=>l(I1,{onClick:k,disabled:!f,sx:{borderRadius:T=>`${T.shape.borderRadius}px`},children:[n(O1,{children:n(B3,{})}),n(B1,{children:n(F,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},k0=u("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),N3="manage-tags-form",W3=(e,t)=>[...e,...e.some(r=>r.value===t.value&&r.type===t.type)?[]:[t]],U3=(e,t)=>e.filter(r=>!(r.value===t.value&&r.type===t.type)),A0=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:W3(e.addedTags,t.payload),removedTags:U3(e.removedTags,t.payload)};case"remove":return{...e,addedTags:U3(e.addedTags,t.payload),removedTags:W3(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};default:return e}},q3={name:"",description:"",icon:""},L0=({open:e,initialValues:t,initialIndeterminateValues:r,onCancel:o,onSubmit:a})=>{const{tagTypes:i,loading:s}=b7(),[C,p]=c.useState(q3),[d,h]=c.useState([]),[g,m]=c.useState([]),{tags:w,refetch:V}=K8(C.name),{createTag:b}=v4(),k=w.map(({value:I})=>({title:I})),[f,T]=c.useReducer(A0,{addedTags:[],removedTags:[]}),M=(I=i.length>0?i[0]:q3)=>{p(I);const O=r.filter(({type:R})=>R===I.name);h(t.filter(({type:R})=>R===I.name).filter(({type:R,value:q})=>!O.some(G=>G.value===q&&G.type===R)).map(({value:R})=>({title:R}))),m(O.map(({value:R})=>({title:R}))),T({type:"clear",payload:[]})};c.useEffect(()=>{i.length>0&&M()},[s]);const j=(I,O)=>{O!=null&&typeof O!="string"&&(I.preventDefault(),M(O))},B=(I,O)=>b({value:I,type:O}).then(async()=>{await V(),h(R=>[...R,{title:I}]),T({type:"add",payload:{value:I,type:O}})}),x=(I,O,R,q)=>{R==="selectOption"?O.forEach(G=>{if(typeof G!="string"&&typeof G.inputValue=="string"&&G.inputValue&&G.title.startsWith("Create new value"))return B(G.inputValue,C.name);h(O),m(W=>W.filter(({title:y})=>y!==G.title)),q!=null&&q.option&&T({type:"add",payload:{value:q.option.title,type:C.name}})}):R==="clear"?(h([]),T({type:"clear",payload:t})):R==="removeOption"&&(h(O),q!=null&&q.option&&T({type:"remove",payload:{value:q.option.title,type:C.name}}))},Z=()=>{M(),o()};return l(W1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>a(f),disabledPrimaryButton:f.addedTags.length===0&&f.removedTags.length===0,onClose:Z,formId:N3,children:[n(F,{paragraph:!0,sx:{marginBottom:I=>I.spacing(2.5)},children:"Tags allow you to group features together"}),n("form",{id:N3,onSubmit:()=>a(f),children:l(k0,{children:[n(J8,{options:i,disabled:s||i.length===0,value:C,onChange:j},s?"loading":i.length),n(S,{condition:!s&&i.length===0,show:l(F,{variant:"body1",children:["No"," ",n(l3,{component:S1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:n(Y8,{disabled:s,options:k,existingTags:t,indeterminateOptions:g,tagType:C,selectedOptions:d,onChange:x})})]})})]})},D0=({projectId:e,data:t})=>{const{bulkUpdateTags:r}=v4(),{refetch:o}=v1(e),{setToastData:a,setToastApiError:i}=h1(),{trackEvent:s}=A1(),[C,p]=c.useState(!1),[d,h]=c.useMemo(()=>{const m=t.flatMap(({tags:V})=>V||[]).reduce((V,b)=>[...V,...V.some(k=>k.type===b.type&&k.value===b.value)?[]:[b]],[]),w=m.filter(V=>!t.every(({tags:b})=>b==null?void 0:b.some(k=>k.type===V.type&&k.value===V.value)));return[m,w]},[t]);return l(Y,{children:[n(i5,{projectId:e,permission:h2,children:({hasAccess:m})=>n(p1,{disabled:!m||C,variant:"outlined",size:"small",onClick:()=>p(!0),children:"Tags"})}),n(L0,{open:C,onCancel:()=>p(!1),onSubmit:async({addedTags:m,removedTags:w})=>{const V=t.map(({name:k})=>k),b={features:V,tags:{addedTags:m,removedTags:w}};try{await r(b,e),o();const k=m.length?`Added tags: ${m.map(({type:T,value:M})=>`${T}:${M}`).join(", ")}.`:"",f=w.length?`Removed tags: ${w.map(({type:T,value:M})=>`${T}:${M}`).join(", ")}.`:"";a({title:"Tags updated",text:`${V.length} feature toggles updated. ${k} ${f}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(k){i(c1(k))}p(!1)},initialValues:d,initialIndeterminateValues:h},t.length)]})},Z0=u(g2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),G3=u(y1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),R0=({showExportDialog:e,data:t,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,C]=c.useState(a[0]),{bulkToggleFeaturesEnvironmentOff:p}=W6(),{addChange:d}=m2(),{refetch:h}=v1(i),{setToastApiError:g,setToastData:m}=h1(),{isChangeRequestConfigured:w}=k5(i),{refetch:V}=f2(i),b=t.filter(M=>{var j,B;return((B=(j=M.environments)==null?void 0:j.find(x=>s===x.name))==null?void 0:B.enabled)===!1}).length,k=()=>a.map(M=>({key:M,label:M})),f=async()=>{try{w(s)?(await d(i,s,t.map(M=>({action:"updateEnabled",feature:M.name,payload:{enabled:!1}}))),V(),m({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await p(i,t.map(M=>M.name),s),h(),m({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),r(),o==null||o()}catch(M){g(c1(M))}},T=w(s)?"Add to change request":"Disable toggles";return n(W1,{open:e,title:"Disable feature toggles",onClose:r,onClick:f,primaryButtonText:T,secondaryButtonText:"Cancel",children:l(H,{children:["You have selected ",n("b",{children:t.length})," feature toggles to disable.",n("br",{}),n("br",{}),n(F,{children:"Select which environment to disable the features for:"}),n(Z0,{options:k(),value:s,onChange:M=>C(M)}),n(S,{condition:w(s),show:n(G3,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(S,{condition:b>0,show:l(G3,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},F0=u(g2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),K3=u(y1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),j0=({showExportDialog:e,data:t,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,C]=c.useState(a[0]),{bulkToggleFeaturesEnvironmentOn:p}=W6(),{addChange:d}=m2(),{refetch:h}=v1(i),{setToastApiError:g,setToastData:m}=h1(),{isChangeRequestConfigured:w}=k5(i),{refetch:V}=f2(i),b=t.filter(M=>{var j,B;return((B=(j=M.environments)==null?void 0:j.find(x=>s===x.name))==null?void 0:B.enabled)===!0}).length,k=()=>a.map(M=>({key:M,label:M})),f=async()=>{try{w(s)?(await d(i,s,t.map(M=>({action:"updateEnabled",feature:M.name,payload:{enabled:!0}}))),V(),m({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await p(i,t.map(M=>M.name),s),h(),m({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),r(),o==null||o()}catch(M){g(c1(M))}},T=w(s)?"Add to change request":"Enable toggles";return n(W1,{open:e,title:"Enable feature toggles",onClose:r,onClick:f,primaryButtonText:T,secondaryButtonText:"Cancel",children:l(H,{children:["You have selected ",n("b",{children:t.length})," feature toggles to enable.",n("br",{}),n("br",{}),n(F,{children:"Select which environment to enable the features for:"}),n(F0,{options:k(),value:s,onChange:M=>C(M)}),n(S,{condition:w(s),show:n(K3,{severity:"warning",children:"Change requests are enabled for this environment."})}),n(S,{condition:b>0,show:l(K3,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},P0=({selectedIds:e,data:t,projectId:r})=>{var k,f;const{uiConfig:o}=l1(),[a,i]=c.useState(!1),[s,C]=c.useState(!1),[p,d]=c.useState(!1),{trackEvent:h}=A1(),g=c.useMemo(()=>t.filter(T=>e.includes(T.name)),[t,e]),m=c.useMemo(()=>{const T=g.flatMap(M=>M.environments).map(M=>M==null?void 0:M.name).filter(M=>M!==void 0);return Array.from(new Set(T))},[g]),w=()=>{h("batch_operations",{props:{eventType:"features exported"}})},V=()=>{h("batch_operations",{props:{eventType:"features enabled"}})},b=()=>{h("batch_operations",{props:{eventType:"features disabled"}})};return l(Y,{children:[n(S,{condition:!!((k=o==null?void 0:o.flags)!=null&&k.disableBulkToggle),show:null,elseShow:n(p1,{variant:"outlined",size:"small",onClick:()=>C(!0),children:"Enable"})}),n(S,{condition:!!((f=o==null?void 0:o.flags)!=null&&f.disableBulkToggle),show:null,elseShow:n(p1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Disable"})}),n(E0,{projectId:r,featureIds:e,features:t}),n(p1,{variant:"outlined",size:"small",onClick:()=>i(!0),children:"Export"}),n(D0,{projectId:r,data:g}),n(T0,{projectId:r,data:g}),n(U6,{showExportDialog:a,data:g,onClose:()=>i(!1),environments:m,onConfirm:w}),n(j0,{showExportDialog:s,data:g,onClose:()=>C(!1),environments:m,projectId:r,onConfirm:V}),n(R0,{showExportDialog:p,data:g,onClose:()=>d(!1),environments:m,projectId:r,onConfirm:b})]})},I0=u(q6)(()=>({whiteSpace:"nowrap"})),O0=u("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...J1,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),N5=["Select","Actions","name","favorite"],B0={id:"createdAt"},$0=({features:e,loading:t,environments:r=[]})=>{var o5,G1;const{classes:o}=S0(),a=u1(),i=f1(a.breakpoints.down("md")),[s,C]=c.useState({open:!1,featureId:"",environmentName:""}),[p,d]=c.useState({}),[h,g]=c.useState(),m=J("projectId"),{value:w,setValue:V}=d2(`${m}:FeatureToggleListTable:v1`,B0),{value:b,setValue:k}=V7(),f=L1(),[T,M]=c3(),j=r0(t?[{environment:"a"},{environment:"b"},{environment:"c"}]:r),{refetch:B}=v1(m),{isFavoritesPinned:x,sortTypes:Z,onChangeIsFavoritePinned:I}=_7(T.has("favorites")?T.get("favorites")==="true":b.favorites),{favorite:O,unfavorite:R}=x7(),{onChangeRequestToggleClose:q,onChangeRequestToggleConfirm:G,changeRequestDialogDetails:W}=Q8(m),[y,v]=c.useState(!1),{uiConfig:E}=l1(),L=!!E.flags.lastSeenByEnvironment,N=c.useCallback(async A=>{A!=null&&A.favorite?await R(m,A.name):await O(m,A.name),B()},[m,B]),D=c.useMemo(()=>e.some(A=>{var $;return($=A==null?void 0:A.tags)==null?void 0:$.length}),[e]),K=c.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:A})=>n(C3,{...A()}),Cell:({row:A})=>{var $;return n(w7,{...($=A==null?void 0:A.getToggleRowSelectedProps)==null?void 0:$.call(A)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:n(S7,{isActive:x,onClick:I}),accessor:"favorite",Cell:({row:{original:A}})=>n(H7,{value:A==null?void 0:A.favorite,onClick:()=>N(A)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:({value:A,row:{original:$}})=>L?n(G6,{feature:$}):n(K6,{value:A}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:J6,align:"center",filterName:"type",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:A})=>n(z1,{title:A,arrow:!0,describeChild:!0,children:n("span",{children:n(Y6,{title:A,to:`/projects/${m}/features/${A}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...D?[{id:"tags",Header:"Tags",accessor:A=>{var $;return(($=A.tags)==null?void 0:$.map(({type:a1,value:z})=>`${a1}:${z}`).join(`
2
2
  `))||""},Cell:M7,width:80,searchable:!0,filterName:"tags",filterBy(A,$){return E7(T7(this,A),$)}}]:[],{Header:"Created",accessor:"createdAt",Cell:y2,sortType:"date",minWidth:120},...j.map(A=>{const $=typeof A=="string"?A:A.environment;return{Header:t?()=>"":$,maxWidth:90,id:`environments.${$}`,accessor:a1=>{var z;return(z=a1.environments[$])==null?void 0:z.enabled},align:"center",Cell:({value:a1,row:{original:z}})=>{const _=z.someEnabledEnvironmentHasVariants&&z.environments[$].variantCount===0&&z.environments[$].enabled;return l(O0,{hasWarning:_,children:[n(X8,{value:a1,projectId:m,featureId:z.name,environmentName:$}),n(S,{condition:_,show:n(e9,{})})]})},sortType:"boolean",filterName:$,filterParsing:a1=>a1?"enabled":"disabled"}}),{id:"Actions",maxWidth:56,width:56,Cell:A=>n(p0,{projectId:m,onOpenArchiveDialog:g,onOpenStaleDialog:d,...A}),disableSortBy:!0,hideInMenu:!0}],[m,j,t]),[X,g1]=c.useState(T.get("search")||""),b1=c.useMemo(()=>e.map(A=>{var $;return{...A,environments:Object.fromEntries(j.map(a1=>{const z=A==null?void 0:A.environments.find(_=>(_==null?void 0:_.name)===a1);return[a1,{name:a1,enabled:(z==null?void 0:z.enabled)||!1,variantCount:(z==null?void 0:z.variantCount)||0,lastSeenAt:z==null?void 0:z.lastSeenAt}]})),someEnabledEnvironmentHasVariants:(($=A.environments)==null?void 0:$.some(a1=>a1.variantCount>0&&a1.enabled))||!1}}),[e,j]),{data:D1,getSearchText:j5,getSearchContext:M1}=v2(K,X,b1),b5=c.useMemo(()=>t?Array(6).fill({type:"-",name:"Feature name",createdAt:new Date,environments:{production:{name:"production",enabled:!1}}}):D1,[t,D1]),P5=c.useMemo(()=>{var a1;const A=K.map(z=>(z==null?void 0:z.id)||(typeof(z==null?void 0:z.accessor)=="string"?z==null?void 0:z.accessor:"")).filter(Boolean);let $=j.filter((z,_)=>_>=3).map(z=>`environments.${z}`);if(T.has("columns")){const z=((a1=T.get("columns"))==null?void 0:a1.split(","))||[],_=[...N5,...z];$=A.filter(P=>!_.includes(P))}else if(w.columns){const z=[...N5,...w.columns];$=A.filter(_=>!z.includes(_))}return{sortBy:[{id:T.get("sort")||"createdAt",desc:T.has("order")?T.get("order")==="desc":w.desc}],hiddenColumns:$,selectedRowIds:{}}},[j]),I5=c.useCallback(A=>A.name,[]),{allColumns:U1,headerGroups:r5,rows:E1,state:{selectedRowIds:V5,sortBy:j1,hiddenColumns:q1},prepareRow:O5,setHiddenColumns:P1}=n1.useTable({columns:K,data:b5,initialState:P5,sortTypes:Z,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:I5},n1.useFlexLayout,n1.useSortBy,n1.useRowSelect);return c.useEffect(()=>{if(t)return;const A={};A.sort=j1[0].id,j1[0].desc&&(A.order="desc"),X&&(A.search=X),x&&(A.favorites="true"),A.columns=U1.map(({id:$})=>$).filter($=>!N5.includes($)&&!(q1!=null&&q1.includes($))).join(","),M(A,{replace:!0}),V($=>({...$,id:j1[0].id,desc:j1[0].desc||!1,columns:A.columns.split(",")})),k($=>({...$,favorites:!!x}))},[t,j1,q1,X,M,x]),l(Y,{children:[l(s1,{isLoading:t,className:o.container,header:n(r1,{titleElement:`Feature toggles (${E1.length})`,actions:l(Y,{children:[n(S,{condition:!i,show:n(k1,{initialValue:X,onChange:g1,hasFilters:!0,getSearchContext:M1})}),n(w0,{allColumns:U1,staticColumns:N5,dividerAfter:["createdAt"],dividerBefore:["Actions"],isCustomized:!!w.columns,setHiddenColumns:P1}),n(r1.Divider,{sx:{marginLeft:0}}),n(S,{condition:!!((o5=E==null?void 0:E.flags)!=null&&o5.featuresExportImport),show:n(z1,{title:"Export toggles visible in the table below",arrow:!0,children:n(N1,{onClick:()=>v(!0),sx:A=>({marginRight:A.spacing(2)}),children:n(k7,{})})})}),n(I0,{onClick:()=>f(A7(m)),maxWidth:"960px",Icon:Q6,projectId:m,permission:s3,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:n(S,{condition:i,show:n(k1,{initialValue:X,onChange:g1,hasFilters:!0,getSearchContext:M1})})}),children:[n(d5,{value:j5(X),children:n(b2,{rows:E1,headerGroups:r5,prepareRow:O5})}),n(S,{condition:E1.length===0,show:n(S,{condition:(X==null?void 0:X.length)>0,show:l(_1,{children:["No feature toggles found matching “",X,"”"]}),elseShow:n(_1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})}),n(t9,{onClose:()=>C(A=>({...A,open:!1})),projectId:m,...s}),n(n9,{isStale:p.stale===!0,isOpen:!!p.featureId,onClose:()=>{d({}),B()},featureId:p.featureId||"",projectId:m}),n(y4,{isOpen:!!h,onConfirm:()=>{B()},onClose:()=>{g(void 0)},featureIds:[h||""],projectId:m})," ",n(r9,{isOpen:W.isOpen,onClose:q,environment:W==null?void 0:W.environment,onConfirm:G,messageComponent:n(o9,{featureName:W.featureName,enabled:W.enabled,environment:W==null?void 0:W.environment})}),n(S,{condition:!!((G1=E==null?void 0:E.flags)!=null&&G1.featuresExportImport)&&!t,show:n(U6,{showExportDialog:y,data:b5,onClose:()=>v(!1),environments:j})})]}),n(L7,{count:Object.keys(V5).length,children:n(P0,{selectedIds:Object.keys(V5),data:e,projectId:m})})]})},D5=u("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)}})),Z5=u("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),x3=u("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),w2=({children:e,to:t})=>n(F,{variant:"body2",textAlign:"center",sx:{paddingTop:r=>r.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:n(l3,{component:S1,to:t,children:e})}),z0=u("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),N0=u("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),W0=({projectId:e,health:t})=>l(D5,{children:[n(Z5,{"data-loading":!0,children:"Project health"}),l(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:r=>r.spacing(2)},children:[n(N0,{children:n(D7,{percentage:t})}),l(z0,{"data-loading":!0,children:[t,"%"]})]}),n(w2,{to:`/projects/${e}/health`,children:"View project health"})]}),U0=u(x3)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),q0=u("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}})),G0=({type:e,Icon:t,count:r})=>l(q0,{"data-loading":!0,children:[n(t,{fontSize:"small","data-loading":!0}),n("div",{children:(a=>a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "))(e)}),n(U0,{children:r})]}),K0=({features:e})=>{const t=c.useMemo(()=>{const r=(e==null?void 0:e.filter(C=>C.type==="release").length)||0,o=(e==null?void 0:e.filter(C=>C.type==="experiment").length)||0,a=(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:r,experiment:o,operational:a,"kill-switch":i,permission:s}},[e]);return l(D5,{sx:{padding:r=>r.spacing(3)},children:[n(Z5,{children:"Toggle types used"}),Object.keys(t).map(r=>n(G0,{type:r,Icon:Z7(r),count:t[r]},r))]})},J0=u("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})),Y0=({id:e,description:t})=>l(D5,{children:[n(Z5,{children:"Project Meta"}),l(J0,{children:[n(F,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",n("code",{"data-loading":!0,children:e||"__________"})]}),n(S,{condition:!!t,show:n(F,{variant:"body2",sx:{marginTop:r=>r.spacing(1.5),marginBottom:0,textAlign:"left"},children:t})}),n(S,{condition:!t,show:n(w2,{to:`/projects/${e}/edit`,children:"Add description"})})]}),Q0=u(F)(({theme:e})=>({marginBottom:e.spacing(2.5)})),X0=u(H)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),R2=u(H)(({theme:e})=>({...J1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),J3=u(F)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),ee=u(F)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),te=e=>e>0?n(S9,{sx:{color:"success.dark",height:20,width:20}}):n(T9,{sx:{color:"warning.dark",height:20,width:20}}),ne=e=>e>0?"success.dark":"warning.dark",w5=({title:e,boxText:t,change:r,percentage:o,children:a,customChangeElement:i})=>l(Y,{children:[n(S,{condition:!!e,show:n(Q0,{children:e})}),a,l(H,{sx:{...J1,justifyContent:"center",width:"auto"},children:[n(X0,{children:t}),n(S,{condition:!!i,show:n(R2,{children:i}),elseShow:n(S,{condition:r!==void 0&&r!==0,show:l(R2,{children:[l(H,{sx:{...J1},children:[te(r),l(ee,{color:ne(r),children:[r>0?"+":"",r,o?"%":""]})]}),n(J3,{children:"this month"})]}),elseShow:n(R2,{children:n(J3,{children:"No change"})})})})]})]}),re=({projectId:e,memberCount:t,change:r=0})=>{var i,s;const{uiConfig:o}=l1();let a="/admin/users";return(s=(i=o==null?void 0:o.versionInfo)==null?void 0:i.current)!=null&&s.enterprise&&(a=`/projects/${e}/settings/access`),l(D5,{children:[n(Z5,{"data-loading":!0,children:"Project members"}),n(H,{sx:{display:"flex",justifyContent:"center"},children:n(w5,{boxText:`${t}`,change:r})}),n(w2,{to:a,children:"View all members"})]})},oe=e=>fetch(e).then(t5("ChangeRequest")).then(t=>t.json()),H4=e=>{const{data:t,error:r,mutate:o}=R7([],e5(`api/admin/projects/${e}/change-requests`),oe);return c.useMemo(()=>({changeRequests:t,loading:!r&&!t,refetch:o,error:r}),[t,r,o])},G5="change-requests-widget",ae=u(H)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),Y3=u(H)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),Q3=u(H)(({theme:e})=>({display:"flex",alignItems:"center"})),ie=u(x3)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),se=u(x3)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),X3=u(F)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),e6=()=>n(F,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":G5,children:"change requests"}),Ce=({projectId:e})=>{const{changeRequests:t,loading:r}=H4(e),o=X6(r,`[data-loading="${G5}"]`),a=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(D5,{ref:o,children:[n(Z5,{children:"Open change requests"}),l(ae,{children:[l(Y3,{sx:{background:s=>s.palette.success.light},children:[n(X3,{children:"To be applied"}),l(Q3,{children:[n(ie,{"data-loading":G5,children:a||0})," ",n(e6,{})]})]}),l(Y3,{sx:{background:s=>s.palette.secondary.light},children:[n(X3,{children:"To be reviewed"}),l(Q3,{children:[n(se,{"data-loading":G5,children:i||0})," ",n(e6,{})]})]})]}),n(w2,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},le=u(H)(({theme:e})=>({...J1,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"}})),ce=({id:e,description:t,memberCount:r,health:o,features:a,stats:i})=>{const{isEnterprise:s}=l1(),C=u1(),p=f1(C.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:d}=k5(e),h=s()&&d(),g=e!==F7;return n("aside",{children:l(le,{sx:!h&&!g||p&&h&&g?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[n(S,{condition:h,show:n(H,{sx:{gridColumnStart:g?"span 2":"span 1",flex:1,display:"flex"},children:n(Ce,{projectId:e})})}),n(Y0,{id:e,description:t}),n(W0,{projectId:e,health:o}),n(S,{condition:g,show:n(re,{projectId:e,memberCount:r,change:i==null?void 0:i.projectMembersAddedCurrentWindow})}),n(K0,{features:a})]})})},de=u(Z1)(({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})),t6=({children:e,id:t})=>{const[r,o]=c.useState(null),a=C=>o(C.currentTarget),i=()=>o(null);return l(H,{sx:{position:"absolute",top:C=>C.spacing(.5),right:C=>C.spacing(.5)},children:[n(N1,{onClick:a,"aria-describedby":t,size:"small",children:n(e4,{sx:{fontSize:C=>C.typography.body1.fontSize}})}),n(t4,{id:t,open:!!r,anchorEl:r,sx:C=>({zIndex:C.zIndex.tooltip}),children:n(n4,{onClickAway:i,children:l(de,{elevation:3,children:[n(N1,{onClick:i,sx:{position:"absolute",right:4,top:4},children:n(j7,{sx:{fontSize:C=>C.typography.body1.fontSize}})}),e,n(P7,{id:t,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},ue=u(H)(({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"}})),W5=u(H)(({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)}})),pe=u(F)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),he=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:t,projectActivityCurrentWindow:r,projectActivityPastWindow:o,createdCurrentWindow:a,createdPastWindow:i,archivedCurrentWindow:s,archivedPastWindow:C}=e;return l(ue,{children:[n(W5,{children:n(w5,{title:"Total changes",boxText:String(r),change:r-o,children:n(t6,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),n(W5,{children:n(w5,{title:"Avg. time to production",boxText:l(H,{sx:{display:"flex",alignItems:"center",gap:p=>p.spacing(1)},children:[t," ",n(F,{component:"span",children:"days"})]}),customChangeElement:n(pe,{children:"In project life"}),percentage:!0,children:n(t6,{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(W5,{children:n(w5,{title:"Features created",boxText:String(a),change:a-i})}),n(W5,{children:n(w5,{title:"Features archived",boxText:String(s),change:s-C})})]})},ge=15*1e3,me=u("div")(({theme:e})=>({display:"flex",[e.breakpoints.down("md")]:{flexDirection:"column"}})),fe=u("div")(()=>({width:"100%",minWidth:0})),ye=u(H)(()=>({display:"flex",flexDirection:"column",width:"100%",minWidth:0})),ve=()=>{const e=J("projectId"),t=H1(e),{project:r,loading:o}=v1(e,{refreshInterval:ge}),{members:a,features:i,health:s,description:C,environments:p,stats:d}=r;w1(`Project overview – ${t}`);const{setLastViewed:h}=I7();return c.useEffect(()=>{h(e)},[e,h]),l(me,{children:[n(ce,{id:e,description:C,memberCount:a,health:s,features:i,stats:d}),l(ye,{children:[n(he,{stats:r.stats}),n(fe,{children:n($0,{features:i,environments:p,loading:o})})]})]})},be=(e,t)=>{const r=e5(`api/admin/projects/${e}/health-report`),{data:o,error:a}=c5(r,Ve,t),i=c.useCallback(()=>{r4(r).catch(console.warn)},[r]);return{healthReport:o,refetchHealthReport:i,loading:!a&&!o,error:a}},Ve=e=>fetch(e).then(t5("Health report")).then(t=>t.json());var w3={},_e=E5;Object.defineProperty(w3,"__esModule",{value:!0});var Q2=w3.default=void 0,xe=_e(M5()),we=T5,Se=(0,xe.default)((0,we.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");Q2=w3.default=Se;const He=u(H)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),n6=u(H)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Me=u(Z1)(({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)}})),F2=u("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1)})),Ee=u("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),Te=u("p")(({theme:e})=>({color:e.palette.text.secondary})),r6=u("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),o6=u("p")(({theme:e})=>({marginLeft:e.spacing(4)})),ke=({healthReport:e})=>{const t=e.health<50?"error.main":e.health<75?"warning.main":"success.main",r=()=>l(He,{children:[n(o4,{}),l("span",{children:[e.activeCount," active toggles"]})]}),o=()=>l(n6,{children:[n(Q2,{}),l("span",{children:[e.staleCount," stale toggles"]})]}),a=()=>l(n6,{children:[n(Q2,{}),l("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]});return l(Me,{children:[l(H,{children:[n(F2,{children:"Health rating"}),n(S,{condition:e.health>-1,show:l(Y,{children:[l(Ee,{sx:{color:t},children:[e.health,"%"]}),l(Te,{children:["Last updated:"," ",n(d3,{date:e.updatedAt,live:!1})]})]})})]}),l(H,{children:[n(F2,{children:"Toggle report"}),l(r6,{children:[n("li",{children:n(S,{condition:!!e.activeCount,show:r})}),n(S,{condition:!!e.activeCount,show:n(o6,{children:"Also includes potentially stale toggles."})}),n("li",{children:n(S,{condition:!!e.staleCount,show:o})})]})]}),l(H,{sx:{flexBasis:"40%"},children:[n(F2,{children:"Potential actions"}),n(r6,{children:n("li",{children:n(S,{condition:!!e.potentiallyStaleCount,show:a})})}),n(S,{condition:!!e.potentiallyStaleCount,show:n(o6,{children:"Review your feature toggles and delete unused toggles."}),elseShow:n("span",{children:"No action is required"})})]})]})},Ae=({row:e})=>{const t=u1();return e.original.expiredAt?n(y2,{value:e.original.expiredAt}):n(d1,{children:n(F,{variant:"body2",color:t.palette.text.secondary,children:"N/A"})})},Le=u("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),De=u("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),Ze=({row:e})=>e.original.status==="potentially-stale"?n(d1,{children:l(Le,{children:[n(E9,{}),n("span",{children:"Potentially stale"})]})}):n(d1,{children:l(De,{children:[n(a4,{}),n("span",{children:"Healthy"})]})}),a6=40,Re=7,M4={[B7]:a6,[$7]:a6,[z7]:Re},E4=(e,t)=>Math.abs(O7(e,t)),T4=(e,t)=>e>=M4[t],Fe=e=>{const{type:t,createdAt:r}=e,o=i4(r),i=E4(o,new Date);return T4(i,t)&&t!==s4&&t!==C4?"potentially-stale":"healthy"},je=e=>{const{type:t,createdAt:r}=e;if(t===s4||t===C4)return;const o=i4(r),a=new Date,i=E4(o,a);if(T4(i,t)){const s=i-M4[t];return A9(a,s).toISOString()}},Pe=({projectId:e,features:t})=>{const r=u1(),o=f1(r.breakpoints.down("sm")),a=f1(r.breakpoints.down("md")),i=f1(r.breakpoints.down("lg")),{uiConfig:s}=l1(),C=!!s.flags.lastSeenByEnvironment,p=c.useMemo(()=>t.map(T=>({project:e,name:T.name,type:T.type,stale:T.stale,environments:T.environments,status:Fe(T),lastSeenAt:T.lastSeenAt,createdAt:T.createdAt,expiredAt:je(T)})),[e,t]),d=c.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt"}]}),[]),h=c.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({value:T,row:{original:M}})=>C?n(G6,{feature:M}):n(K6,{value:T}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",align:"center",Cell:J6,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:N7,minWidth:120},{Header:"Created",accessor:"createdAt",sortType:"date",Cell:y2,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:Ae,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:Ze,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:W7,disableGlobalFilter:!0,maxWidth:120}],[C]),{headerGroups:g,rows:m,prepareRow:w,state:{globalFilter:V},setGlobalFilter:b,setHiddenColumns:k}=n1.useTable({columns:h,data:p,initialState:d,sortTypes:A5,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},n1.useGlobalFilter,n1.useFlexLayout,n1.useSortBy);V2([{condition:o,columns:["stale"]},{condition:a,columns:["expiredAt","lastSeenAt"]},{condition:i,columns:["createdAt"]}],k,h);const f=m.length<p.length?`Feature toggles (${m.length} of ${p.length})`:`Feature toggles (${p.length})`;return l(s1,{header:n(r1,{title:f,actions:n(k1,{initialValue:V,onChange:b})}),children:[n(d5,{value:V,children:n(b2,{headerGroups:g,prepareRow:w,rows:m})}),n(S,{condition:m.length===0,show:n(S,{condition:(V==null?void 0:V.length)>0,show:l(_1,{children:["No feature toggles found matching “",V,"”"]}),elseShow:n(_1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},Ie=()=>{const e=J("projectId"),t=H1(e);w1(`Project health – ${t}`);const{healthReport:r,refetchHealthReport:o,error:a}=be(e,{refreshInterval:15*1e3});return r?l("div",{children:[n(S,{condition:!!a,show:n(O6,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:o,text:`Could not fetch health rating for ${e}`})}),n(ke,{healthReport:r}),n(Pe,{projectId:e,features:r.features})]}):null},Oe=u("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),Be=()=>{const e=J("projectId");return n(Oe,{children:n(U7,{title:"Event Log",project:e,displayInline:!0})})},k4=(e,t)=>{const{data:r,error:o,mutate:a}=c5(e5(`api/admin/projects/${e}/change-requests/${t}`),$e,{refreshInterval:15e3});return{data:r,loading:!o&&!r,refetchChangeRequest:()=>a(),error:o}},$e=e=>fetch(e).then(t5("Request changes")).then(t=>t.json()),ze=u(Z1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));u(H)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const Ne=u(H)(({theme:e})=>({display:"flex",alignItems:"center"})),We=u(F)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),Ue=u(q7)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),S3=u(_2)(({theme:e})=>({height:"24px",width:"24px"})),qe=({changeRequest:e})=>{var o,a,i;const[t,r]=c.useState(e.title);return l(ze,{elevation:0,children:[n(G7,{environmentChangeRequest:e,title:t,setTitle:r,children:n(We,{variant:"h1",sx:{mr:1.5},children:t})}),l(Ne,{children:[n(l4,{state:e.state}),l(F,{variant:"body2",sx:s=>({margin:s.spacing("auto",0,"auto",2)}),children:["Created"," ",n(d3,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),n(H,{sx:s=>({marginLeft:s.spacing(1)}),children:n(z1,{title:(o=e==null?void 0:e.createdBy)==null?void 0:o.username,children:n(S3,{src:(a=e==null?void 0:e.createdBy)==null?void 0:a.imageUrl})})}),n(F,{variant:"body2",sx:s=>({marginLeft:s.spacing(.5)}),children:(i=e==null?void 0:e.createdBy)==null?void 0:i.username}),n(H,{sx:s=>({marginLeft:s.spacing(1.5)}),children:n(Ue,{variant:"outlined",children:l(F,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",n(F,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",n(K7,{}),"Updates:",n(J7,{featuresCount:e.features.length,segmentsCount:e.segments.length})]})})})]})]})};function i1(){return i1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},i1.apply(this,arguments)}function f5(e,t){if(e==null)return{};var r={},o=Object.keys(e),a,i;for(i=0;i<o.length;i++)a=o[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}const Ge=c.createContext({}),e2=Ge;function Ke(e){return u5("MuiTimeline",e)}n5("MuiTimeline",["root","positionLeft","positionRight","positionAlternate"]);const Je=["position","className"],Ye=e=>{const{position:t,classes:r}=e,o={root:["root",t&&`position${R1(t)}`]};return g5(o,Ke,r)},Qe=u("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.position&&t[`position${R1(r.position)}`]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),Xe=c.forwardRef(function(t,r){const o=p5({props:t,name:"MuiTimeline"}),{position:a="right",className:i}=o,s=f5(o,Je),C=i1({},o,{position:a}),p=Ye(C),d=c.useMemo(()=>({position:a}),[a]);return n(e2.Provider,{value:d,children:n(Qe,i1({className:h5(p.root,i),ownerState:C,ref:r},s))})}),A4=Xe;function et(e){return u5("MuiTimelineContent",e)}const tt=n5("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate"]),nt=["className"],rt=e=>{const{position:t,classes:r}=e,o={root:["root",`position${R1(t)}`]};return g5(o,et,r)},ot=u(F,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[`position${R1(r.position)}`]]}})(({ownerState:e})=>i1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),at=c.forwardRef(function(t,r){const o=p5({props:t,name:"MuiTimelineContent"}),{className:a}=o,i=f5(o,nt),{position:s}=c.useContext(e2),C=i1({},o,{position:s||"right"}),p=rt(C);return n(ot,i1({component:"div",className:h5(p.root,a),ownerState:C,ref:r},i))}),L4=at,it=n5("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate"]),st=it;function Ct(e){return u5("MuiTimelineItem",e)}const lt=n5("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","missingOppositeContent"]),D4=lt,ct=["position","className"],dt=e=>{const{position:t,classes:r,hasOppositeContent:o}=e,a={root:["root",`position${R1(t)}`,!o&&"missingOppositeContent"]};return g5(a,Ct,r)},ut=u("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[`position${R1(r.position)}`]]}})(({ownerState:e})=>i1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},e.position==="alternate"&&{"&:nth-of-type(even)":{flexDirection:"row-reverse",[`& .${tt.root}`]:{textAlign:"right"},[`& .${st.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&:before":{content:'""',flex:1,padding:"6px 16px"}})),pt=c.forwardRef(function(t,r){const o=p5({props:t,name:"MuiTimelineItem"}),{position:a,className:i}=o,s=f5(o,ct),{position:C}=c.useContext(e2);let p=!1;c.Children.forEach(o.children,m=>{Y7(m,["TimelineOppositeContent"])&&(p=!0)});const d=i1({},o,{position:a||C||"right",hasOppositeContent:p}),h=dt(d),g=c.useMemo(()=>({position:d.position}),[d.position]);return n(e2.Provider,{value:g,children:n(ut,i1({className:h5(h.root,i),ownerState:d,ref:r},s))})}),K5=pt;function ht(e){return u5("MuiTimelineSeparator",e)}n5("MuiTimelineSeparator",["root"]);const gt=["className"],mt=e=>{const{classes:t}=e;return g5({root:["root"]},ht,t)},ft=u("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),yt=c.forwardRef(function(t,r){const o=p5({props:t,name:"MuiTimelineSeparator"}),{className:a}=o,i=f5(o,gt),s=o,C=mt(s);return n(ft,i1({className:h5(C.root,a),ownerState:s,ref:r},i))}),J5=yt;function vt(e){return u5("MuiTimelineDot",e)}n5("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const bt=["className","color","variant"],Vt=e=>{const{color:t,variant:r,classes:o}=e,a={root:["root",r,t!=="inherit"&&`${r}${R1(t)}`]};return g5(a,vt,o)},_t=u("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[r.color!=="inherit"&&`${r.variant}${R1(r.color)}`],t[r.variant]]}})(({ownerState:e,theme:t})=>i1({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"&&i1({borderColor:"transparent"},e.color!=="inherit"&&i1({},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"&&i1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&i1({},e.color==="grey"?{borderColor:(t.vars||t).palette.grey[400]}:{borderColor:(t.vars||t).palette[e.color].main})))),xt=c.forwardRef(function(t,r){const o=p5({props:t,name:"MuiTimelineDot"}),{className:a,color:i="grey",variant:s="filled"}=o,C=f5(o,bt),p=i1({},o,{color:i,variant:s}),d=Vt(p);return n(_t,i1({className:h5(d.root,a),ownerState:p,ref:r},C))}),Z4=xt;function wt(e){return u5("MuiTimelineConnector",e)}n5("MuiTimelineConnector",["root"]);const St=["className"],Ht=e=>{const{classes:t}=e;return g5({root:["root"]},wt,t)},Mt=u("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),Et=c.forwardRef(function(t,r){const o=p5({props:t,name:"MuiTimelineConnector"}),{className:a}=o,i=f5(o,St),s=o,C=Ht(s);return n(Mt,i1({className:h5(C.root,a),ownerState:s,ref:r},i))}),R4=Et,Tt=u(Z1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),kt=u(H)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),At=u(A4)(()=>({[`& .${D4.root}:before`]:{flex:0,padding:0}})),Lt=["Draft","In review","Approved","Applied"],Dt=["Draft","In review","Rejected"],Zt=(e,t,r,o)=>e==="Cancelled"?"grey":e==="Rejected"?r==="Rejected"?"error":"success":t!==-1&&t>=o?"success":t+1===o?"primary":"grey",Rt=({state:e})=>{const t=e==="Rejected"?Dt:Lt,r=t.findIndex(o=>o===e);return n(Tt,{elevation:0,children:n(kt,{children:n(At,{children:t.map((o,a)=>{const i=Zt(e,r,o,a);let s={};return r+1===a&&!(e==="Cancelled"&&o==="Draft")&&(s={variant:"outlined"}),Ft(i,o,a<t.length-1,s)})})})})},Ft=(e,t,r,o={})=>l(K5,{children:[l(J5,{children:[n(Z4,{color:e,...o}),r&&n(R4,{})]}),n(L4,{children:t})]},t),H3=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",Q1=u(H)(({theme:e})=>({display:"flex",alignItems:"center"})),F4=u(u3)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),i6=u(u3)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),X2=u(c4)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),jt=u(H)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),Pt=u(H,{shouldForwardProp:H3()})(({theme:e,bgColor:t,svgColor:r})=>({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:r}})),j4=u(z6)(({theme:e})=>({margin:e.spacing(2.5,0)})),It=u(H,{shouldForwardProp:H3()})(({theme:e,border:t})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:t,padding:e.spacing(3),width:"100%"})),X1=u(F,{shouldForwardProp:H3()})(({theme:e,color:t})=>({fontWeight:"bold",color:t})),Ot=(e,t)=>e==="Approved"?`2px solid ${t.palette.success.main}`:e==="Applied"?`2px solid ${t.palette.primary.main}`:`1px solid ${t.palette.divider}`,Bt=(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},$t=({changeRequest:e})=>{const t=u1();return l(jt,{children:[n(Pt,{...Bt(e.state,t),children:n(Q7,{style:{transform:"scale(1.5)"}})}),n(It,{sx:{backgroundColor:e.state==="In review"?t.palette.warning.light:"initial"},border:Ot(e.state,t),children:n(zt,{changeRequest:e})})]})},zt=({changeRequest:e})=>{const{state:t}=e;return t?t==="Approved"?n(Nt,{}):t==="Applied"?n(Ut,{}):t==="Cancelled"?n(qt,{}):t==="Rejected"?n(Gt,{}):n(Wt,{minApprovals:e.minApprovals}):null},Nt=()=>{const e=u1();return l(Y,{children:[l(Q1,{children:[n(X2,{}),l(H,{children:[n(X1,{color:e.palette.success.dark,children:"Changes approved"}),n(F,{children:"One approving review from requested approvers"})]})]}),n(j4,{}),l(Q1,{children:[n(X2,{}),n(H,{children:n(X1,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},Wt=({minApprovals:e})=>{const t=u1();return l(Y,{children:[l(Q1,{children:[n(i6,{}),l(H,{children:[n(X1,{color:t.palette.warning.dark,children:"Review required"}),l(F,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),n(j4,{}),l(Q1,{children:[n(i6,{}),n(X1,{color:t.palette.warning.dark,children:"Apply changes is blocked"})]})]})},Ut=()=>{const e=u1();return n(Y,{children:l(Q1,{children:[n(X2,{sx:{color:e.palette.primary.main}}),n(H,{children:n(X1,{color:e.palette.primary.main,children:"Changes applied"})})]})})},qt=()=>{const e=u1();return n(Y,{children:l(Q1,{children:[n(F4,{}),n(H,{children:n(X1,{color:e.palette.error.main,children:"Changes cancelled"})})]})})},Gt=()=>{const e=u1();return n(Y,{children:l(Q1,{children:[n(F4,{}),n(H,{children:n(X1,{color:e.palette.error.main,children:"Changes rejected"})})]})})};var M3={},Kt=E5;Object.defineProperty(M3,"__esModule",{value:!0});var P4=M3.default=void 0,Jt=Kt(M5()),Yt=T5,Qt=(0,Jt.default)((0,Yt.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");P4=M3.default=Qt;const Xt=({disabled:e,onReject:t,onApprove:r,children:o})=>{const{uiConfig:a}=l1(),{isAdmin:i}=c.useContext(F1),s=J("projectId"),C=J("id"),{user:p}=d4(),{data:d}=k4(s,C),[h,g]=q5.useState(!1),m=q5.useRef(null),w=()=>{g(k=>!k)},V=k=>{m.current&&m.current.contains(k.target)||g(!1)},b=m.current?m.current.offsetWidth:null;return l(q5.Fragment,{children:[n(L5,{variant:"contained",disabled:e||(d==null?void 0:d.createdBy.id)===(p==null?void 0:p.id)&&!i,"aria-controls":h?"review-options-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:w,ref:m,endIcon:n(P4,{}),permission:X7,projectId:s,environmentId:d==null?void 0:d.environment,children:o}),n(t4,{sx:{zIndex:1,width:b},open:h,anchorEl:m.current,role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:k,placement:f})=>{var T;return n(e8,{...k,style:{transformOrigin:f==="bottom"?"center top":"center bottom"},children:n(Z1,{className:"dropdown-outline",children:n(n4,{onClickAway:V,children:l(p2,{id:"review-options-menu",autoFocusItem:!0,children:[l(I1,{onClick:r,children:[n(O1,{children:n(o4,{fontSize:"small"})}),n(B1,{children:"Approve changes"})]}),n(S,{condition:!!((T=a==null?void 0:a.flags)!=null&&T.changeRequestReject),show:l(I1,{onClick:t,children:[n(O1,{children:n(s9,{fontSize:"small"})}),n(B1,{children:"Reject changes"})]})})]})})})})}})]})};var I4={},E3={},T3={};Object.defineProperty(T3,"__esModule",{value:!0});var en=c,tn=nn(en);function nn(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}T3.default=function(e,t,r){return tn.createElement("a",{href:e,key:r},t)};var k3={};Object.defineProperty(k3,"__esModule",{value:!0});k3.default=function(e){return e};var A3={},j2,s6;function rn(){return s6||(s6=1,j2=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),j2}var P2,C6;function on(){return C6||(C6=1,P2=/[\0-\x1F\x7F-\x9F]/),P2}var I2,l6;function an(){return l6||(l6=1,I2=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),I2}var O2,c6;function sn(){return c6||(c6=1,O2=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/),O2}var B2,d6;function Cn(){return d6||(d6=1,B2=function(e){var t={};t.src_Any=rn().source,t.src_Cc=on().source,t.src_Z=an().source,t.src_P=sn().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 r="[><|]";return t.src_pseudo_letter="(?:(?!"+r+"|"+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="(?=$|"+r+"|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+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="(^|"+r+'|"|\\(|'+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}),B2}function e3(e){var t=Array.prototype.slice.call(arguments,1);return t.forEach(function(r){r&&Object.keys(r).forEach(function(o){e[o]=r[o]})}),e}function S2(e){return Object.prototype.toString.call(e)}function ln(e){return S2(e)==="[object String]"}function cn(e){return S2(e)==="[object Object]"}function dn(e){return S2(e)==="[object RegExp]"}function u6(e){return S2(e)==="[object Function]"}function un(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var O4={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function pn(e){return Object.keys(e||{}).reduce(function(t,r){return t||O4.hasOwnProperty(r)},!1)}var hn={"http:":{validate:function(e,t,r){var o=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(o)?o.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){var o=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(o)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:o.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){var o=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(o)?o.match(r.re.mailto)[0].length:0}}},gn="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]",mn="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function fn(e){e.__index__=-1,e.__text_cache__=""}function yn(e){return function(t,r){var o=t.slice(r);return e.test(o)?o.match(e)[0].length:0}}function p6(){return function(e,t){t.normalize(e)}}function t2(e){var t=e.re=Cn()(e.__opts__),r=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||r.push(gn),r.push(t.src_xn),t.src_tlds=r.join("|");function o(C){return C.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(o(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(o(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(o(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(o(t.tpl_host_fuzzy_test),"i");var a=[];e.__compiled__={};function i(C,p){throw new Error('(LinkifyIt) Invalid schema "'+C+'": '+p)}Object.keys(e.__schemas__).forEach(function(C){var p=e.__schemas__[C];if(p!==null){var d={validate:null,link:null};if(e.__compiled__[C]=d,cn(p)){dn(p.validate)?d.validate=yn(p.validate):u6(p.validate)?d.validate=p.validate:i(C,p),u6(p.normalize)?d.normalize=p.normalize:p.normalize?i(C,p):d.normalize=p6();return}if(ln(p)){a.push(C);return}i(C,p)}}),a.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:p6()};var s=Object.keys(e.__compiled__).filter(function(C){return C.length>0&&e.__compiled__[C]}).map(un).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"),fn(e)}function vn(e,t){var r=e.__index__,o=e.__last_index__,a=e.__text_cache__.slice(r,o);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=o+t,this.raw=a,this.text=a,this.url=a}function h6(e,t){var r=new vn(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function x1(e,t){if(!(this instanceof x1))return new x1(e,t);t||pn(e)&&(t=e,e={}),this.__opts__=e3({},O4,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=e3({},hn,e),this.__compiled__={},this.__tlds__=mn,this.__tlds_replaced__=!1,this.re={},t2(this)}x1.prototype.add=function(t,r){return this.__schemas__[t]=r,t2(this),this};x1.prototype.set=function(t){return this.__opts__=e3(this.__opts__,t),this};x1.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;var r,o,a,i,s,C,p,d,h;if(this.re.schema_test.test(t)){for(p=this.re.schema_search,p.lastIndex=0;(r=p.exec(t))!==null;)if(i=this.testSchemaAt(t,r[2],p.lastIndex),i){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(d=t.search(this.re.host_fuzzy_test),d>=0&&(this.__index__<0||d<this.__index__)&&(o=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=o.index+o[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=o.index+o[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(h=t.indexOf("@"),h>=0&&(a=t.match(this.re.email_fuzzy))!==null&&(s=a.index+a[1].length,C=a.index+a[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};x1.prototype.pretest=function(t){return this.re.pretest.test(t)};x1.prototype.testSchemaAt=function(t,r,o){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(t,o,this):0};x1.prototype.match=function(t){var r=0,o=[];this.__index__>=0&&this.__text_cache__===t&&(o.push(h6(this,r)),r=this.__last_index__);for(var a=r?t.slice(r):t;this.test(a);)o.push(h6(this,r)),a=a.slice(this.__last_index__),r+=this.__last_index__;return o.length?o:null};x1.prototype.tlds=function(t,r){return t=Array.isArray(t)?t:[t],r?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(o,a,i){return o!==i[a-1]}).reverse(),t2(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,t2(this),this)};x1.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};x1.prototype.onCompile=function(){};var bn=x1;const Vn=["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(A3,"__esModule",{value:!0});var _n=bn,xn=B4(_n),wn=Vn,Sn=B4(wn);function B4(e){return e&&e.__esModule?e:{default:e}}var $4=new xn.default;$4.tlds(Sn.default);A3.default=function(e){return $4.match(e)};var L3={};Object.defineProperty(L3,"__esModule",{value:!0});L3.default=function(e){return e};Object.defineProperty(E3,"__esModule",{value:!0});var Hn=function(){function e(t,r){for(var o=0;o<r.length;o++){var a=r[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),Mn=c,x5=Fn(Mn),En=T3,Tn=H2(En),kn=k3,An=H2(kn),Ln=A3,Dn=H2(Ln),Zn=L3,Rn=H2(Zn);function H2(e){return e&&e.__esModule?e:{default:e}}function Fn(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function jn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pn(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 In(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 z4=function(e){In(t,e);function t(){return jn(this,t),Pn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return Hn(t,[{key:"parseString",value:function(o){var a=this;if(o==="")return o;var i=this.props.matchDecorator(o);if(!i)return o;var s=[],C=0;return i.forEach(function(p,d){p.index>C&&s.push(o.substring(C,p.index));var h=a.props.hrefDecorator(p.url),g=a.props.textDecorator(p.text),m=a.props.componentDecorator(h,g,d);s.push(m),C=p.lastIndex}),o.length>C&&s.push(o.substring(C)),s.length===1?s[0]:s}},{key:"parse",value:function(o){var a=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof o=="string"?this.parseString(o):x5.isValidElement(o)&&o.type!=="a"&&o.type!=="button"?x5.cloneElement(o,{key:i},this.parse(o.props.children)):Array.isArray(o)?o.map(function(s,C){return a.parse(s,C)}):o}},{key:"render",value:function(){return x5.createElement(x5.Fragment,null,this.parse(this.props.children))}}]),t}(x5.Component);z4.defaultProps={componentDecorator:Tn.default,hrefDecorator:An.default,matchDecorator:Dn.default,textDecorator:Rn.default};E3.default=z4;Object.defineProperty(I4,"__esModule",{value:!0});var On=E3,Bn=$n(On);function $n(e){return e&&e.__esModule?e:{default:e}}var zn=I4.default=Bn.default;const Nn=u(H)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),Wn=u(Z1)(({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})),Un=u(H)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),qn=({comment:e})=>l(Nn,{children:[n(z1,{title:e.createdBy.username,children:n(t8,{src:e.createdBy.imageUrl})}),l(Wn,{variant:"outlined",children:[n(Un,{children:l(H,{children:[n("strong",{children:e.createdBy.username})," ",l(F,{color:"text.secondary",component:"span",children:["commented"," ",n(d3,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),n(H,{sx:{paddingTop:2.5},children:n(zn,{children:e.text})})]})]}),N4=u(H)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),Gn=u(c4)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),Kn=u(u3)(({theme:e})=>({color:e.palette.error.main,marginLeft:"auto"})),W4=u(F)({maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"text.primary"}),Jn=({name:e,imageUrl:t})=>l(N4,{children:[n(S3,{src:t}),n(W4,{variant:"body1",children:e}),n(Gn,{})]}),Yn=({name:e,imageUrl:t})=>l(N4,{children:[n(S3,{src:t}),n(W4,{variant:"body1",children:e}),n(Kn,{})]}),Qn=({rejections:e=[]})=>l(Y,{children:[n(F,{variant:"body1",color:"text.secondary",children:"Rejected by"}),e.map(t=>n(Yn,{name:t.createdBy.username||"Unknown user",imageUrl:t.createdBy.imageUrl},t.createdBy.username))]}),Xn=({approvals:e=[]})=>l(Y,{children:[n(F,{variant:"body1",color:"text.secondary",children:n(S,{condition:(e==null?void 0:e.length)>0,show:"Approved by",elseShow:"No approvals yet"})}),e.map(t=>n(Jn,{name:t.createdBy.username||"Unknown user",imageUrl:t.createdBy.imageUrl},t.createdBy.username))]}),er=u(H)(({theme:e})=>({marginBottom:e.spacing(2)})),tr=({actualApprovals:e,minApprovals:t})=>l(Y,{children:["Reviewers"," ",l(F,{component:"span",color:"text.secondary",children:["(",e,"/",t," required)"]})]}),nr=({header:e,children:t})=>l(Z1,{elevation:0,sx:r=>({marginTop:r.spacing(2),padding:r.spacing(4),borderRadius:o=>`${o.shape.borderRadiusLarge}px`}),children:[n(er,{children:e}),t]}),rr=({changeRequest:e})=>n(nr,{header:n(tr,{actualApprovals:e.approvals.length,minApprovals:e.minApprovals}),children:n(S,{condition:e.state==="Rejected",show:n(Qn,{rejections:e.rejections}),elseShow:n(Xn,{approvals:e.approvals})})}),or=({open:e,onConfirm:t,onClose:r})=>{const[o,a]=c.useState("");return l(W1,{open:e,primaryButtonText:"Reject changes",secondaryButtonText:"Cancel",onClick:()=>t(o),onClose:r,title:"Reject changes",fullWidth:!0,children:[n(H,{children:"Add an optional comment why you reject those changes"}),n(p3,{sx:{mt:1},variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:i=>a(i.target.value),value:o})]})},ar=u(H)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),ir=u(Z1)(({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%"}})),sr=u(H)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),Cr=u(H)(({theme:e})=>({padding:e.spacing(2)})),lr=u(H)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),cr=()=>{var v;const e=J("projectId"),[t,r]=c.useState(!1),[o,a]=c.useState(!1),{user:i}=d4(),{isAdmin:s}=c.useContext(F1),[C,p]=c.useState(""),d=J("id"),{data:h,refetchChangeRequest:g}=k4(e,d),{changeState:m,addComment:w,loading:V}=m2(),{refetch:b}=f2(e),{setToastData:k,setToastApiError:f}=h1(),{isChangeRequestConfiguredForReview:T}=k5(e);if(!h)return null;const M=T(h.environment),j=async()=>{try{await m(e,Number(d),{state:"Applied"}),g(),b(),k({type:"success",title:"Success",text:"Changes applied"})}catch(E){f(c1(E))}},B=async()=>{try{await w(e,d,C),p(""),g(),k({type:"success",title:"Success",text:"Comment added"})}catch(E){f(c1(E))}},x=async()=>{try{await m(e,Number(d),{state:"Cancelled"}),r(!1),g(),b(),k({type:"success",title:"Success",text:"Changes cancelled"})}catch(E){f(c1(E))}},Z=async E=>{try{await m(e,Number(d),{state:"Rejected",comment:E}),a(!1),g(),b(),k({type:"success",title:"Success",text:"Changes rejected"})}catch(L){f(c1(L))}},I=async()=>{try{await m(e,Number(d),{state:"Approved"}),g(),b(),k({type:"success",title:"Success",text:"Changes approved"})}catch(E){f(c1(E))}},O=()=>r(!0),R=()=>r(!1),q=()=>a(!1),G=(h==null?void 0:h.createdBy.id)===(i==null?void 0:i.id)&&h.state==="In review"&&!s,W=h.approvals.some(E=>E.createdBy.id===(i==null?void 0:i.id)),y=n8(h);return l(Y,{children:[n(qe,{changeRequest:h}),l(lr,{children:[l(ar,{children:[n(Rt,{state:h.state}),n(rr,{changeRequest:h})]}),n(ir,{elevation:0,children:l(Cr,{children:["Requested Changes (",y,")",n(r8,{changeRequest:h,onRefetch:g}),(v=h.comments)==null?void 0:v.map(E=>n(qn,{comment:E},E.id)),n(o8,{user:i,commentText:C,onTypeComment:p,children:n(p1,{variant:"outlined",onClick:B,disabled:!M||C.trim().length===0||C.trim().length>1e3,children:"Comment"})}),n(S,{condition:G,show:n(y1,{sx:E=>({marginTop:E.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),n($t,{changeRequest:h}),l(sr,{children:[n(S,{condition:h.state==="In review"&&!W,show:l(Xt,{onReject:()=>a(!0),onApprove:I,disabled:!M,children:["Review changes (",y,")"]})}),n(S,{condition:h.state==="Approved",show:n(L5,{variant:"contained",onClick:j,projectId:e,permission:a8,environmentId:h.environment,disabled:!M||V,children:"Apply changes"})}),n(S,{condition:h.state!=="Applied"&&h.state!=="Rejected"&&h.state!=="Cancelled"&&(h.createdBy.id===(i==null?void 0:i.id)||s),show:n(p1,{sx:{marginLeft:E=>E.spacing(2)},variant:"outlined",onClick:O,children:"Cancel changes"})})]})]})}),l(W1,{open:t,onClick:x,onClose:R,title:"Cancel change request",children:[n(F,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),n(F,{variant:"body2",sx:E=>({color:E.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."})]}),n(or,{open:o,onConfirm:Z,onClose:q})]})]})},dr=({value:e})=>{const t=()=>e?n(l4,{state:e}):null;return e?n(d1,{children:t()}):n(d1,{})},ur=u("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),pr=({value:e})=>{const{searchQuery:t}=h3();return n(d1,{children:n(ur,{children:l(F,{component:"span",variant:"body2",children:[" ",n(Q5,{search:t,children:e==null?void 0:e.username})]})})})},hr=u("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),gr=({value:e,row:{original:t}})=>{const{searchQuery:r}=h3(),o=J("projectId"),{id:a,title:i,features:s,segments:C}=t,p=(s||[]).length+(C||[]).length,d=`/projects/${o}/change-requests/${a}`;return e?l(d1,{sx:{minWidth:"200px"},children:[n(hr,{children:n(F,{variant:"body2",children:n(l3,{component:S1,underline:"hover",to:d,sx:h=>({paddingTop:h.spacing(.2),marginRight:h.spacing(1),"&:hover":{textDecoration:"underline"}}),children:n(Q5,{search:r,children:i})})})}),l("span",{children:[`${p}`," ",p<=1?"update":"updates"]})]}):n(d1,{})},mr=N6()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(2,4,4,4),overflowX:"auto"}})),fr=u(H)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),yr=u(S1)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),vr=u(S1)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),br=u(H)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),Vr=({value:e,project:t})=>{const{searchQuery:r}=h3(),o=e==null?void 0:e.map(a=>a.name);return n(fr,{children:n(S,{condition:(o==null?void 0:o.length)<3,show:o==null?void 0:o.map(a=>n(yr,{title:a,to:`/projects/${t}/features/${a}`,children:n(Q5,{search:r,children:a})})),elseShow:l(i8,{tooltipProps:{maxWidth:"800px"},tooltip:n(br,{children:o==null?void 0:o.map(a=>n(vr,{title:a,to:`/projects/${t}/features/${a}`,children:n(Q5,{search:r,children:a})}))}),children:[o==null?void 0:o.length," toggles"]})})})},_r={id:"createdAt"},xr=u("div")({paddingLeft:0,paddingBottom:0}),wr=u(Y5)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),Sr=u(H)(({theme:e})=>({textAlign:"right",paddingBottom:e.spacing(2),fontSize:e.fontSizes.smallBody})),Hr=({changeRequests:e=[],loading:t,projectId:r})=>{var W,y;const{classes:o}=mr(),a=f1(s8.breakpoints.down("md")),[i,s]=c3(),[C,p]=c.useState(i.get("search")||""),{value:d,setValue:h}=d2(`${r}:ProjectChangeRequest`,_r),[g,m]=c.useMemo(()=>{const v=e.filter(L=>L.state!=="Cancelled"&&L.state!=="Rejected"&&L.state!=="Applied"),E=e.filter(L=>L.state==="Cancelled"||L.state==="Rejected"||L.state==="Applied");return[v,E]},[e]),w=[{title:"Change requests",data:g},{title:"Closed",data:m}],[V,b]=c.useState(0),k=c.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:gr},{id:"Updated feature toggles",Header:"Updated feature toggles",canSort:!1,accessor:"features",searchable:!0,filterName:"feature",filterParsing:v=>(v==null?void 0:v.map(({name:E})=>E).join(`
3
3
  `))||"",filterBy:(v,E)=>v.features.find(L=>E.map(N=>N.toLowerCase()).includes(L.name.toLowerCase())),Cell:({value:v,row:{original:{title:E}}})=>n(Vr,{project:r,value:v},E)},{Header:"By",accessor:"createdBy",maxWidth:180,canSort:!1,Cell:pr,align:"left",searchable:!0,filterName:"by",filterParsing:v=>(v==null?void 0:v.username)||""},{Header:"Submitted",accessor:"createdAt",maxWidth:100,Cell:X5,sortType:"alphanumeric"},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:c2,filterName:"environment"},{Header:"Status",accessor:"state",searchable:!0,maxWidth:"170px",Cell:dr,filterName:"status"}],[r]),{data:f,getSearchText:T,getSearchContext:M}=v2(k,C,(W=w[V])==null?void 0:W.data),j=c.useMemo(()=>t?C8:f,[f,t]),[B]=c.useState(()=>({sortBy:[{id:i.get("sort")||d.id,desc:i.has("order")?i.get("order")==="desc":d.desc}],hiddenColumns:[]})),{headerGroups:x,rows:Z,state:{sortBy:I},prepareRow:O,setHiddenColumns:R,getTableProps:q,getTableBodyProps:G}=n1.useTable({columns:k,data:j,initialState:B,sortTypes:A5,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:d1}},n1.useSortBy);return V2([{condition:a,columns:["createdBy"]}],R,k),c.useEffect(()=>{if(t)return;const v={};v.sort=I[0].id,I[0].desc&&(v.order="desc"),C&&(v.search=C),s(v,{replace:!0}),h(E=>({...E,id:I[0].id,desc:I[0].desc||!1}))},[t,I,C,s]),l(s1,{isLoading:t,bodyClass:o.bodyClass,headerClass:o.header,header:n(r1,{titleElement:n(xr,{children:n(g3,{value:(y=w[V])==null?void 0:y.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:w.map((v,E)=>n(wr,{label:`${v.title} (${v.data.length})`,value:v.title,onClick:()=>b(E)},v.title))})}),actions:n(k1,{initialValue:C,onChange:p,hasFilters:!0,getSearchContext:M})}),children:[n(Sr,{children:n(S1,{to:`/projects/${r}/settings/change-requests`,children:"Change request configuration"})}),n(d5,{value:T(C),children:l(a2,{...q(),children:[n(i2,{headerGroups:x}),n(s2,{...G(),children:Z.map(v=>(O(v),n(C2,{hover:!0,...v.getRowProps(),children:v.cells.map(E=>n(l2,{...E.getCellProps(),padding:"none",children:E.render("Cell")}))})))})]})}),n(S,{condition:Z.length===0,show:()=>n(S,{condition:(C==null?void 0:C.length)>0,show:l(_1,{children:["No changes found matching “",C,"”"]}),elseShow:n(_1,{children:"None of the changes were submitted yet."})})})]})},Mr=()=>{const e=J("projectId"),t=H1(e),{isOss:r,isPro:o}=l1();w1(`Change requests – ${t}`);const{changeRequests:a,loading:i}=H4(e);return r()||o()?n(s1,{sx:{justifyContent:"center"},children:n(x2,{feature:"change-requests"})}):n(Hr,{changeRequests:a,projectId:e,loading:i})};var U=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(U||{});const R5=(e,t={})=>{const r=e5(`api/admin/projects/${e}/access`),o=()=>fetch(r,{method:"GET"}).then(t5("project access")).then(g=>g.json()),a=`api/admin/projects/${e}/users`,{data:i,error:s}=c5(a,o,t),[C,p]=c.useState(!s&&!i),d=()=>{r4(a)};return c.useEffect(()=>{p(!s&&!i)},[i,s]),{access:c.useMemo(()=>{if(i)return Er({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:C9(g.users??[])})))??[]})},[i]),error:s,loading:C,refetchProjectAccess:d}},Er=e=>{const t=e.users||[],r=e.serviceAccounts||[],o=e.groups||[];return{...e,rows:[...t.map(a=>({entity:a,type:"USERS"})),...r.map(a=>({entity:a,type:"SERVICE ACCOUNTS"})),...o.map(a=>({entity:a,type:"GROUPS"}))]}},Tr=u(s1)(({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`})),kr=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),g6={id:"joinedAt"},$2=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>n(d1,{children:n(f3,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:({value:e,row:{original:t}})=>n(c2,{value:e,subtitle:t.email||t.username}),minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:y2,sortType:"date",maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>n(X5,{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}],Ar=["imageUrl","name","joined","lastLogin"],Lr=({open:e,setOpen:t,group:r,projectId:o,subtitle:a,onEdit:i,onRemove:s})=>{const C=u1(),p=f1(C.breakpoints.down("md")),[d]=c.useState(()=>({sortBy:[{id:g6.id,desc:g6.desc}],hiddenColumns:["Username","Email"]})),[h,g]=c.useState(""),{data:m,getSearchText:w,getSearchContext:V}=v2($2,h,(r==null?void 0:r.users)??[]),{headerGroups:b,rows:k,prepareRow:f,setHiddenColumns:T}=n1.useTable({columns:$2,data:m,initialState:d,sortTypes:A5,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},n1.useSortBy,n1.useFlexLayout);return V2([{condition:p,columns:Ar}],T,$2),n(Y1,{open:e,onClose:()=>{t(!1)},label:(r==null?void 0:r.name)||"Group",children:l(Tr,{header:n(r1,{secondary:!0,titleElement:l(kr,{children:[r==null?void 0:r.name," (",k.length<m.length?`${k.length} of ${m.length}`:m.length,")",n("span",{children:a})]}),actions:l(Y,{children:[n(S,{condition:!p,show:l(Y,{children:[n(k1,{initialValue:h,onChange:g,hasFilters:!0,getSearchContext:V}),n(r1.Divider,{})]})}),n(s5,{permission:V1,projectId:o,tooltipProps:{title:"Edit group access"},onClick:i,children:n(m3,{})}),n(s5,{permission:V1,projectId:o,tooltipProps:{title:"Remove group access"},onClick:s,children:n(u4,{})})]}),children:n(S,{condition:p,show:n(k1,{initialValue:h,onChange:g,hasFilters:!0,getSearchContext:V})})}),children:[n(d5,{value:w(h),children:n(b2,{rows:k,headerGroups:b,prepareRow:f})}),n(S,{condition:k.length===0,show:n(S,{condition:(h==null?void 0:h.length)>0,show:l(_1,{children:["No users found matching “",h,"” in this group."]}),elseShow:n(_1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},Dr=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),m6=u("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),f6=u("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),Zr=u("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),Rr=u(p1)(({theme:e})=>({marginLeft:e.spacing(3)})),Fr=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),jr=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),D3=({selected:e,accesses:t,users:r,serviceAccounts:o,groups:a,roles:i})=>{const{uiConfig:s}=l1(),{flags:C}=s,p=C.UG?"user / group":"user",d=J("projectId"),{refetchProjectAccess:h}=R5(d),{addAccessToProject:g,changeUserRole:m,changeGroupRole:w,loading:V}=H5(),b=!!e,{setToastData:k,setToastApiError:f}=h1(),T=L1(),M=[...a.filter(y=>b||!t.some(({entity:{id:v},type:E})=>y.id===v&&E===U.GROUP)).map(y=>({id:y.id,entity:y,type:U.GROUP})),...r.filter(y=>b||!t.some(({entity:{id:v},type:E})=>y.id===v&&E===U.USER)).sort((y,v)=>{const E=y.name||y.username||"",L=v.name||v.username||"";return E.localeCompare(L)}).map(y=>({id:y.id,entity:y,type:U.USER})),...o.filter(y=>b||!t.some(({entity:{id:v},type:E})=>y.id===v&&E===U.SERVICE_ACCOUNT)).sort((y,v)=>{const E=y.name||y.username||"",L=v.name||v.username||"";return E.localeCompare(L)}).map(y=>({id:y.id,entity:y,type:U.SERVICE_ACCOUNT}))],[j,B]=c.useState(()=>M.filter(({id:y,type:v})=>y===(e==null?void 0:e.entity.id)&&v===(e==null?void 0:e.type))),[x,Z]=c.useState(i.find(({id:y})=>y===(e==null?void 0:e.entity.roleId))??null),I={users:j==null?void 0:j.filter(({type:y})=>y===U.USER||y===U.SERVICE_ACCOUNT).map(({id:y})=>({id:y})),groups:j==null?void 0:j.filter(({type:y})=>y===U.GROUP).map(({id:y})=>({id:y}))},O=async y=>{if(y.preventDefault(),!!W)try{b?(e==null?void 0:e.type)===U.USER||(e==null?void 0:e.type)===U.SERVICE_ACCOUNT?await m(d,x.id,e.entity.id):(e==null?void 0:e.type)===U.GROUP&&await w(d,x.id,e.entity.id):await g(d,x.id,I),h(),T($1),k({title:`${j.length} ${j.length===1?"access":"accesses"} ${b?"edited":"assigned"} successfully`,type:"success"})}catch(v){f(c1(v))}},R=()=>b?`curl --location --request ${b?"PUT":"POST"} '${s.unleashUrl}/api/admin/projects/${d}/${(e==null?void 0:e.type)===U.USER||(e==null?void 0:e.type)===U.SERVICE_ACCOUNT?"users":"groups"}/${e==null?void 0:e.entity.id}/roles/${x==null?void 0:x.id}' \\
4
4
  --header 'Authorization: INSERT_API_KEY'`:`curl --location --request ${b?"PUT":"POST"} '${s.unleashUrl}/api/admin/projects/${d}/role/${x==null?void 0:x.id}/access' \\
@@ -1,4 +1,4 @@
1
- import{gd as E4,ge as lc,gf as cc,gg as C4,gh as S4,gi as A4,cd as i1,s as b2,r as Wh,j as Po,bT as L4,gj as B4,gk as D4,C as I4,E as M4,gl as N4,gm as R4}from"./index-b7003840.js";import{u as O4,a as _2}from"./unknownify-ea4585e8.js";const F4=/^(?:[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 P4(t){return typeof t=="string"&&F4.test(t)}function V4(t){if(!P4(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 Y4(t){t=unescape(encodeURIComponent(t));const e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}const z4="6ba7b810-9dad-11d1-80b4-00c04fd430c8",U4="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function W4(t,e,r){function i(n,s,a,o){var l;if(typeof n=="string"&&(n=Y4(n)),typeof s=="string"&&(s=V4(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 E4(h)}try{i.name=t}catch{}return i.DNS=z4,i.URL=U4,i}function H4(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 q4(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)+H4(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 G4=W4("v5",80,q4),$4=G4;function x2(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{gd as E4,ge as lc,gf as cc,gg as C4,gh as S4,gi as A4,cd as i1,s as b2,r as Wh,j as Po,bT as L4,gj as B4,gk as D4,C as I4,E as M4,gl as N4,gm as R4}from"./index-17d74ac9.js";import{u as O4,a as _2}from"./unknownify-b8618d88.js";const F4=/^(?:[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 P4(t){return typeof t=="string"&&F4.test(t)}function V4(t){if(!P4(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 Y4(t){t=unescape(encodeURIComponent(t));const e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}const z4="6ba7b810-9dad-11d1-80b4-00c04fd430c8",U4="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function W4(t,e,r){function i(n,s,a,o){var l;if(typeof n=="string"&&(n=Y4(n)),typeof s=="string"&&(s=V4(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 E4(h)}try{i.name=t}catch{}return i.DNS=z4,i.URL=U4,i}function H4(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 q4(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)+H4(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 G4=W4("v5",80,q4),$4=G4;function x2(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 dY=e1,pY=t=>t.match(/^\s*journey/)!==null;let zs="";const E0=[],to=[],eo=[],gY=function(t,e,r){xe.parseDirective(this,t,e,r)},yY=function(){E0.length=0,to.length=0,zs="",eo.length=0,Lr()},mY=function(t){zs=t,E0.push(t)},bY=function(){return E0},_Y=function(){let t=c2();const e=100;let r=0;for(;!t&&r<e;)t=c2(),r++;return to.push(...eo),to},xY=function(){const t=[];return to.forEach(r=>{r.people&&t.push(...r.people)}),[...new Set(t)].sort()},vY=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)},kY=function(t){const e={section:zs,type:zs,description:t,task:t,classes:[]};to.push(e)},c2=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},wY=function(){return xY()},h2={parseDirective:gY,getConfig:()=>G().journey,clear:yY,setDiagramTitle:si,getDiagramTitle:ai,setAccTitle:kr,getAccTitle:Br,setAccDescription:Dr,getAccDescription:Ir,addSection:mY,getSections:bY,getTasks:_Y,addTask:vY,addTaskOrg:kY,getActors:wY},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},TY=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},Q3=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},J3=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},EY=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,J3(t,e)},CY=function(t,e,r){const i=t.append("g"),n=C0();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),t4(r)(e.text,i,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+e.num},r,e.colour)};let u2=-1;const SY=function(t,e,r){const i=e.x+r.width/2,n=t.append("g");u2++;const s=300+5*30;n.append("line").attr("id","task"+u2).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"),TY(n,{cx:i,cy:300+(5-e.score)*30,score:e.score});const a=C0();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};Q3(n,u),o+=10}),t4(r)(e.task,n,a.x,a.y,a.width,a.height,{class:"task"},r,e.colour)},AY=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()},LY=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},C0=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},t4=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}}(),BY=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:Q3,drawSection:CY,drawText:J3,drawLabel:EY,drawTask:SY,drawBackgroundRect:AY,getTextObj:LY,getNoteRect:C0,initGraphics:BY},DY=function(t){Object.keys(t).forEach(function(r){Kc[r]=t[r]})},Ui={};function IY(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,MY=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++}),IY(l),Pr.insert(0,0,Sn,Object.keys(Ui).length*50),NY(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,f2=Kc.sectionColours,NY=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=f2[o%f2.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)}},d2={setConf:DY,draw:MY};let p2={};const RY=function(t){p2={...p2,...t}},OY=(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(VD(i))}},nc={setConf:RY,draw:OY},e4="flowchart-elk",FY=(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")},PY=async()=>{const{diagram:t}=await i1(()=>import("./flowchart-elk-definition-170a3958-5ea9fc56.js"),[]);return{id:e4,diagram:t}},VY={id:e4,detector:FY,loader:PY},YY=VY,r4="timeline",zY=t=>t.match(/^\s*timeline/)!==null,UY=async()=>{const{diagram:t}=await i1(()=>import("./timeline-definition-8e5a9bc6-24fd1725.js"),[]);return{id:r4,diagram:t}},WY={id:r4,detector:zY,loader:UY},HY=WY,i4="mindmap",qY=t=>t.match(/^\s*mindmap/)!==null,GY=async()=>{const{diagram:t}=await i1(()=>import("./mindmap-definition-44684416-254e936e.js"),[]);return{id:i4,diagram:t}},$Y={id:i4,detector:qY,loader:GY},jY=$Y;let g2=!1;const _o=()=>{g2||(g2=!0,ly(YY,HY,jY),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:$I,db:Py,renderer:Rd,styles:Sy,init:t=>{Rd.setConf(t.c4)}},jI),Ye("class",{parser:Od,db:fs,renderer:mN,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},YM),Ye("classDiagram",{parser:Od,db:fs,renderer:BR,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},zM),Ye("er",{parser:DR,db:zR,renderer:JR,styles:xy},IR),Ye("gantt",{parser:_O,db:y0,renderer:tF,styles:vy},xO),Ye("info",{parser:eF,db:aF,renderer:lF,styles:ky},cF),Ye("pie",{parser:hF,db:_F,renderer:vF,styles:wy},uF),Ye("requirement",{parser:kF,db:UF,renderer:ZF,styles:Ty},wF),Ye("sequence",{parser:QF,db:Jd,renderer:e2,styles:Ey,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.");Jd.setWrap(t.wrap),e2.setConf(t.sequence)}},JF),Ye("state",{parser:r2,db:Ri,renderer:UV,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},JP),Ye("stateDiagram",{parser:r2,db:Ri,renderer:fY,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},tV),Ye("journey",{parser:dY,db:h2,renderer:d2,styles:Cy,init:t=>{d2.setConf(t.journey),h2.clear()}},pY),Ye("flowchart",{parser:Xd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,gO.setConf(t.flowchart),hi.clear(),hi.setGen("gen-1")}},tO),Ye("flowchart-v2",{parser:Xd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,yy({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Fh.setConf(t.flowchart),hi.clear(),hi.setGen("gen-2")}},eO),Ye("gitGraph",{parser:yI,db:OI,renderer:HI,styles:GI},mI))};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=H1(e,s)}catch(l){this.handleError(l,r),this.type="error",this.detectTypeFailed=!0}const a=By(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(_D(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(VD(i))}},nc={setConf:RY,draw:OY},e4="flowchart-elk",FY=(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")},PY=async()=>{const{diagram:t}=await i1(()=>import("./flowchart-elk-definition-170a3958-fc100c77.js"),[]);return{id:e4,diagram:t}},VY={id:e4,detector:FY,loader:PY},YY=VY,r4="timeline",zY=t=>t.match(/^\s*timeline/)!==null,UY=async()=>{const{diagram:t}=await i1(()=>import("./timeline-definition-8e5a9bc6-04a0ae08.js"),[]);return{id:r4,diagram:t}},WY={id:r4,detector:zY,loader:UY},HY=WY,i4="mindmap",qY=t=>t.match(/^\s*mindmap/)!==null,GY=async()=>{const{diagram:t}=await i1(()=>import("./mindmap-definition-44684416-398682f9.js"),[]);return{id:i4,diagram:t}},$Y={id:i4,detector:qY,loader:GY},jY=$Y;let g2=!1;const _o=()=>{g2||(g2=!0,ly(YY,HY,jY),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:$I,db:Py,renderer:Rd,styles:Sy,init:t=>{Rd.setConf(t.c4)}},jI),Ye("class",{parser:Od,db:fs,renderer:mN,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},YM),Ye("classDiagram",{parser:Od,db:fs,renderer:BR,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},zM),Ye("er",{parser:DR,db:zR,renderer:JR,styles:xy},IR),Ye("gantt",{parser:_O,db:y0,renderer:tF,styles:vy},xO),Ye("info",{parser:eF,db:aF,renderer:lF,styles:ky},cF),Ye("pie",{parser:hF,db:_F,renderer:vF,styles:wy},uF),Ye("requirement",{parser:kF,db:UF,renderer:ZF,styles:Ty},wF),Ye("sequence",{parser:QF,db:Jd,renderer:e2,styles:Ey,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.");Jd.setWrap(t.wrap),e2.setConf(t.sequence)}},JF),Ye("state",{parser:r2,db:Ri,renderer:UV,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},JP),Ye("stateDiagram",{parser:r2,db:Ri,renderer:fY,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},tV),Ye("journey",{parser:dY,db:h2,renderer:d2,styles:Cy,init:t=>{d2.setConf(t.journey),h2.clear()}},pY),Ye("flowchart",{parser:Xd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,gO.setConf(t.flowchart),hi.clear(),hi.setGen("gen-1")}},tO),Ye("flowchart-v2",{parser:Xd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,yy({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Fh.setConf(t.flowchart),hi.clear(),hi.setGen("gen-2")}},eO),Ye("gitGraph",{parser:yI,db:OI,renderer:HI,styles:GI},mI))};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=H1(e,s)}catch(l){this.handleError(l,r),this.type="error",this.detectTypeFailed=!0}const a=By(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(_D(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(G1(e)){r(e.str,e.hash);return}r(e)}getParser(){return this.parser}getType(){return this.type}}const S0=(t,e)=>{const r=H1(t,G());try{By(r)}catch{const n=kD(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)},A0=r1,XY="graphics-document document";function KY(t,e){t.attr("role",XY),bs(e)||t.attr("aria-roledescription",e)}function ZY(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 L0=["graph","flowchart","flowchart-v2","stateDiagram","stateDiagram-v2"],n4="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",s4="sandbox",a4="loose",QY="http://www.w3.org/2000/svg",o4="http://www.w3.org/1999/xlink",l4="http://www.w3.org/1999/xhtml",JY="100%",tz="100%",ez="border:0;margin:0;",rz="margin:0",iz="allow-top-navigation-by-user-activation allow-popups",nz='The "iframe" tag is not supported by your browser.',c4=["foreignobject"],h4=["dominant-baseline"];function sz(t,e){return _o(),new A0(t,e).parse(t,e)}async function az(t,e){return _o(),(await S0(t,e)).parse(t,e)}const u4=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},B0=function(t){let e=t;return e=e.replace(/fl°°/g,"&#"),e=e.replace(/fl°/g,"&"),e=e.replace(/¶ß/g,";"),e},y2=(t,e,r=[])=>`
1276
1276
  .${t} ${e} { ${r.join(" !important; ")} !important; }`,oz=(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,bT as w,j as s,C as P,E as S,gc as u}from"./index-b7003840.js";import{u as T,a as g}from"./unknownify-ea4585e8.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-9c67372b.js";import{B as j}from"./RoleCell-d1aa8288.js";import"./index-1aaa8c27.js";import"./index-670c9345.js";class B{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"],F=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),H=(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 W{constructor(e){o(this,"items");o(this,"picked",new Map);this.items=new B(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const $=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new W([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:F(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(()=>H(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:$(r,e)}),[r,e,t]);return s(P,{condition:a.datasets.length===0,show:s(S,{severity:"warning",children:"No data available."}),elseShow:s(j,{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,bT as w,j as s,C as P,E as S,gc as u}from"./index-17d74ac9.js";import{u as T,a as g}from"./unknownify-b8618d88.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-03d2fbea.js";import{B as j}from"./RoleCell-144e7eca.js";import"./index-3c63138f.js";import"./index-866f9bf9.js";class B{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"],F=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),H=(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 W{constructor(e){o(this,"items");o(this,"picked",new Map);this.items=new B(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const $=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new W([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:F(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(()=>H(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:$(r,e)}),[r,e,t]);return s(P,{condition:a.datasets.length===0,show:s(S,{severity:"warning",children:"No data available."}),elseShow:s(j,{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};