unleash-server 5.6.0 → 5.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
- package/dist/lib/features/feature-toggle/feature-toggle-service.js +0 -12
- package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
- package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.d.ts.map +1 -1
- package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js +3 -1
- package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js.map +1 -1
- package/dist/lib/features/feature-toggle/tests/feature-toggle-last-seen-at.e2e.test.js +29 -0
- package/dist/lib/features/feature-toggle/tests/feature-toggle-last-seen-at.e2e.test.js.map +1 -1
- package/dist/lib/features/private-project/privateProjectStore.js +2 -2
- package/dist/lib/features/private-project/privateProjectStore.js.map +1 -1
- package/dist/lib/features/segment/segment-controller.d.ts.map +1 -1
- package/dist/lib/features/segment/segment-controller.js +2 -3
- package/dist/lib/features/segment/segment-controller.js.map +1 -1
- package/dist/lib/segments/segment-service-interface.d.ts +7 -1
- package/dist/lib/segments/segment-service-interface.d.ts.map +1 -1
- package/dist/lib/services/segment-service.d.ts +2 -1
- package/dist/lib/services/segment-service.d.ts.map +1 -1
- package/dist/lib/services/segment-service.js +6 -4
- package/dist/lib/services/segment-service.js.map +1 -1
- package/dist/lib/types/experimental.d.ts +1 -1
- package/dist/lib/types/experimental.d.ts.map +1 -1
- package/dist/lib/types/experimental.js +0 -1
- package/dist/lib/types/experimental.js.map +1 -1
- package/dist/migrations/20231004120900-create-changes-stats-table-and-trigger.js +2 -2
- package/dist/server-dev.js +0 -1
- package/dist/server-dev.js.map +1 -1
- package/dist/test/e2e/helpers/test-helper.d.ts.map +1 -1
- package/dist/test/e2e/helpers/test-helper.js +8 -2
- package/dist/test/e2e/helpers/test-helper.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-83369892.js → AdvancedPlayground-b7bccfbe.js} +1 -1
- package/frontend/build/static/{CreateProject-be345ba6.js → CreateProject-556f9c57.js} +1 -1
- package/frontend/build/static/{Error-4004f50f.js → Error-db0d1d33.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-0449c522.js → FeatureArchiveDialog-9165a49c.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-24ad4d71.js → FeatureMetricsChart-c575d046.js} +1 -1
- package/frontend/build/static/{FeatureViewLazyExport-397aadc2.js → FeatureViewLazyExport-e2d57dd1.js} +2 -2
- package/frontend/build/static/{LazyAdminExport-4e6e4e1f.js → LazyAdminExport-d83c093e.js} +15 -15
- package/frontend/build/static/{LazyProjectExport-e3f9f7ab.js → LazyProjectExport-9d441d13.js} +1 -1
- package/frontend/build/static/{NetworkOverview-7fb4bd20.js → NetworkOverview-0d48bf0d.js} +2 -2
- package/frontend/build/static/{NetworkTraffic-aa2ac309.js → NetworkTraffic-0aa8a7ac.js} +1 -1
- package/frontend/build/static/{ReactJSONEditor-deab371a.js → ReactJSONEditor-693b261e.js} +1 -1
- package/frontend/build/static/{RoleCell-fdb157bb.js → RoleCell-900af983.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-f7d370e4.js → StrategyItemContainer-ec516690.js} +1 -1
- package/frontend/build/static/{chartjs-adapter-date-fns.esm-60e47456.js → chartjs-adapter-date-fns.esm-9887b8bf.js} +1 -1
- package/frontend/build/static/{flowchart-elk-definition-170a3958-3ee04194.js → flowchart-elk-definition-170a3958-44f11932.js} +1 -1
- package/frontend/build/static/{index-749ce17d.js → index-97019f83.js} +3 -3
- package/frontend/build/static/{is_dark-d5faa57f.js → is_dark-bae6928c.js} +1 -1
- package/frontend/build/static/{mindmap-definition-44684416-79315733.js → mindmap-definition-44684416-9154286a.js} +1 -1
- package/frontend/build/static/{timeline-definition-8e5a9bc6-0b2af611.js → timeline-definition-8e5a9bc6-6cd8c6b1.js} +1 -1
- package/frontend/build/static/{unknownify-efd92e6b.js → unknownify-470ee1ff.js} +1 -1
- package/frontend/build/static/{useApiTokens-96bce8a7.js → useApiTokens-9215ec27.js} +1 -1
- package/frontend/build/static/{useProjectForm-2e1738ba.js → useProjectForm-5dd2ec50.js} +1 -1
- package/package.json +1 -2
- package/dist/lib/features/feature-toggle/deep-diff.d.ts +0 -9
- package/dist/lib/features/feature-toggle/deep-diff.d.ts.map +0 -1
- package/dist/lib/features/feature-toggle/deep-diff.js +0 -62
- package/dist/lib/features/feature-toggle/deep-diff.js.map +0 -1
- package/dist/lib/features/feature-toggle/tests/deep-diff.test.d.ts +0 -2
- package/dist/lib/features/feature-toggle/tests/deep-diff.test.d.ts.map +0 -1
- package/dist/lib/features/feature-toggle/tests/deep-diff.test.js +0 -74
- package/dist/lib/features/feature-toggle/tests/deep-diff.test.js.map +0 -1
package/frontend/build/static/{LazyProjectExport-e3f9f7ab.js → LazyProjectExport-9d441d13.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Y1,j as t,et as s4,eu as e6,ev as l4,ew as W7,s as p,cy as U7,cv as p2,a7 as P5,r as C,ex as q7,ad as h1,a5 as X,d as c,a8 as Z5,a9 as j5,aa as F5,ab as I5,x as c4,b8 as Q1,L as x1,aP as c5,aQ as X1,aR as e5,ey as C4,aG as J,ez as k1,c1 as M1,f as d1,cp as g1,aB as C5,az as o1,eA as G7,ag as S2,cX as g3,eB as m3,eC as S1,aw as n1,aq as H1,av as i1,C as M,aM as T1,as as d5,ar as f1,ct as K7,ak as b5,eD as J7,bb as B5,bc as O5,bd as $5,B as T,w as w1,z as P1,bi as Y7,a3 as w2,bL as x2,eE as f5,cz as V2,M as q1,eF as O2,b5 as G1,eG as Q7,b7 as K1,T as O,cB as d4,aL as _2,aj as Z1,D as f3,m as z5,b as u1,ae as m1,eH as X7,J as G,eI as u4,al as v1,i as C1,eJ as e8,bw as t8,h as s1,bW as n8,bV as y3,bI as H2,bX as v3,aX as E2,b0 as S5,aY as M2,eK as b3,dq as S3,bF as p4,aA as A1,am as T2,eL as h4,cw as g4,eM as m4,eN as f4,eO as y4,eP as w3,eQ as x3,eR as V3,ao as _3,eS as v4,eT as b4,eU as S4,d8 as N5,ap as W5,d9 as w4,cu as x4,b_ as H3,ai as U5,eV as V4,eW as r8,eX as o8,eY as a8,Z as i8,aO as s8,cq as l8,an as _4,eZ as c8,E as j1,e_ as H4,P as E4,e$ as M4,G as C8,f0 as d8,f1 as u8,t as i3,aS as E3,f2 as M3,e as T4,f3 as k4,f4 as p8,bR as A4,f5 as D4,f6 as L4,f7 as h8,f8 as g8,f9 as m8,a6 as q5,ah as G5,aI as f8,fa as y8,fb as k2,fc as v8,fd as R4,fe as b8,ff as S8,fg as w5,fh as u5,aJ as F1,cE as x5,fi as V5,fj as _5,fk as w8,bZ as T3,fl as P4,fm as x8,br as I1,ay as Z4,cl as a5,bv as H5,fn as V8,fo as _8,fp as H8,l as K5,fq as E8,fr as M8,fs as T8,ft as k8,dH as k3,dI as h2,bB as A8,ck as j4,dy as g2,fu as D8,cD as A3,d2 as J5,c4 as i5,aK as y5,aN as D3,bM as F4,di as L3,A as I4,ds as L8,n as B4,o as O4,aF as J1,aC as Y5,fv as R8,fw as P8,dm as r2,fx as Z8,fy as j8,fz as F8,fA as I8,fB as B8,c2 as E5,c3 as t1,fC as O8,fD as t6,fE as $4,u as R3,aD as $8,fF as z8,c_ as N8,fG as n6,fH as W8,fI as U8,fJ as q8,fK as G8,fL as K8,bo as J8,bp as Y8,bC as Q8,bD as X8,bE as e9,W as t9,fM as n9,c0 as r9,fN as o9,y as r6,c9 as a9,fO as i9,fP as z4,cx as N4,ep as W4,fQ as s9,dg as U4,fR as v5,fS as e1,fT as l9,fU as c9,fV as C9,fW as d9,fX as u9,H as c2,dn as p9,fY as h9,fZ as g9}from"./index-749ce17d.js";import{e as P3,W as o6,b as m9,u as q4,T as f9,c as y9,h as G4,F as v9,V as K4,a as J4,g as Y4,C as Q4,U as X4,i as b9,j as S9,E as w9,k as x9}from"./FeatureArchiveDialog-0449c522.js";import{h as V9,m as _9,i as a6,b as H9,c as E9,d as M9,e as T9,E as k9,f as A9,u as D9,a as L9,R as R9,C as P9,A as Z9,B as e7}from"./RoleCell-fdb157bb.js";import{S as j9}from"./StrategyItemContainer-f7d370e4.js";import{C as F9,u as I9,P as B9,D as O9}from"./useProjectForm-2e1738ba.js";import{E as $9}from"./Error-4004f50f.js";const z9=Y1(t("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),N9=Y1(t("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),W9=Y1(t("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),U9=Y1(t("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),q9=Y1(t("path",{d:"M2 6H0v5h.01L0 20c0 1.1.9 2 2 2h18v-2H2V6zm20-2h-8l-2-2H6c-1.1 0-1.99.9-1.99 2L4 16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM7 15l4.5-6 3.5 4.51 2.5-3.01L21 15H7z"}),"PermMedia"),G9=Y1(t("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),K9=Y1(t("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send"),J9=Y1(t("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function Y9(e,n){s4(2,arguments);var r=e6(e),o=e6(n);return r.getTime()<o.getTime()}function Q9(e,n){s4(2,arguments);var r=W7(n);return l4(e,-r)}const i6=p("div")(()=>({display:"flex"})),X9=p("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));p("div")(()=>({display:"flex",flexDirection:"column"}));const ee=p("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),te=p("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));p(te)(({theme:e})=>({color:e.palette.neutral.dark}));const ne=p(U7)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),re=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),oe=p("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),ae=p("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),ie=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),se=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),le=p(p2)(({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}})),ce=e=>e.reduce((n,r)=>r.enabled?n+1:n,0),Ce=p(P5)(({theme:e})=>({marginTop:e.spacing(3)})),de=p("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:n})=>({color:n?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),ue=({environment:e,warnEnabledToggles:n})=>{const r=C.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:d}})=>t(q7,{environment:d})},{Header:"Name",accessor:"name",Cell:h1},{Header:"Type",accessor:"type",Cell:h1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:d})=>t(h1,{children:t(de,{warning:d>0,children:d===1?"1 toggle":`${d} toggles`})}),align:"center"}],[n]),{getTableProps:o,getTableBodyProps:a,headerGroups:i,rows:s,prepareRow:l}=X.useTable({columns:r,data:[e],disableSortBy:!0});return c(Ce,{...o(),rowHeight:"compact",children:[t(Z5,{headerGroups:i}),t(j5,{...a(),children:s.map(d=>(l(d),t(F5,{hover:!0,...d.getRowProps(),children:d.cells.map(u=>t(I5,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},pe=p("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),he=p(c4)(()=>({width:"100%"})),ge=({environment:e,open:n,setOpen:r,onConfirm:o})=>{const[a,i]=C.useState("");return C.useEffect(()=>{i("")},[n]),c(Q1,{title:"Hide environment and disable feature toggles?",open:n,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==a,secondaryButtonText:"Close",onClick:o,onClose:()=>{r(!1)},children:[c(x1,{severity:"error",children:[t("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),t(ue,{environment:e}),c(pe,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",t("strong",{children:e==null?void 0:e.name})]}),t(he,{label:"Environment name",value:a,onChange:s=>i(s.target.value)})]})},me=e=>{const{data:n,error:r,mutate:o}=c5(X1(`api/admin/environments/project/${e}`),fe),a=C.useMemo(()=>n||[],[n]),i=C.useCallback(async()=>{await o()},[o]);return{environments:a,refetchEnvironments:i,loading:!r&&!n,error:r}},fe=async e=>(await fetch(e).then(e5("Environments")).then(r=>r.json())).environments.sort((r,o)=>r.sortOrder-o.sortOrder),ye=p(x1)(({theme:e})=>({marginBottom:e.spacing(4)})),ve=p("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),be=p(C4)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),t7=()=>{const e=J("projectId"),n=k1(e);M1(`Project environments – ${n}`);const{setToastData:r,setToastApiError:o}=d1(),{environments:a,loading:i,error:s,refetchEnvironments:l}=me(e),{project:d,refetch:u}=g1(e),{removeEnvironmentFromProject:h,addEnvironmentToProject:f}=C5(),[g,_]=C.useState(),[H,b]=C.useState(!1),{isOss:L}=o1(),v=C.useMemo(()=>a.map(j=>({...j,projectVisible:d==null?void 0:d.environments.map(W=>W.environment).includes(j.name)})),[a,d==null?void 0:d.environments]),w=()=>{l(),u()},k=()=>t(be,{onClick:w,text:"Error fetching environments"}),R=j=>`Got an API error when trying to set the environment as ${j?"visible":"hidden"}`,z=async j=>{if(j.projectVisible){if(ce(v)>1){_(j),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 f(e,j.name),w(),r({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{o(R(!0))}},V=async()=>{if(g)try{await h(e,g.name),w(),r({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{o(R(!1))}finally{b(!1)}},B=j=>L()&&j==="default",P=C.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:j}})=>t(G7,{environment:j})},{Header:"Type",accessor:"type",Cell:S2},{Header:"Project API tokens",accessor:j=>j.projectApiTokenCount===1?"1 token":`${j.projectApiTokenCount} tokens`,Cell:h1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:j}})=>t(g3,{children:t(m3,{tooltip:j.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:B(j.name),projectId:e,permission:S1,checked:j.projectVisible,onChange:()=>z(j)})}),disableGlobalFilter:!0}],[v]),{getTableProps:$,getTableBodyProps:Z,headerGroups:F,rows:U,prepareRow:q,state:{globalFilter:S},setGlobalFilter:x}=X.useTable({columns:P,data:v,disableSortBy:!0},X.useGlobalFilter),A=t(n1,{title:`Environments (${U.length})`,actions:t(H1,{initialValue:S,onChange:x})});return t(i1,{header:A,isLoading:i,children:c(ve,{children:[t(M,{condition:!!s,show:k()}),c(ye,{severity:"info",children:[t("strong",{children:"Important!"})," In order for your application to retrieve configured activation strategies for a specific environment, the application must use an environment specific API token. You can look up the environment-specific"," ",t(T1,{to:"/admin/api",children:"API tokens here"}),".",t("br",{}),t("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",t(T1,{to:"/admin/api",children:"create a new API token here"}),"."]}),t(d5,{value:S,children:c(P5,{...$(),rowHeight:"compact",children:[t(Z5,{headerGroups:F}),t(j5,{...Z(),children:U.map(j=>(q(j),t(F5,{hover:!0,...j.getRowProps(),children:j.cells.map(W=>t(I5,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),t(M,{condition:U.length===0,show:t(M,{condition:(S==null?void 0:S.length)>0,show:c(f1,{children:["No environments found matching “",S,"”"]}),elseShow:t(f1,{children:"No environments available. Get started by adding one."})})}),t(ge,{environment:g,open:H,setOpen:b,onConfirm:V})]})})},Se={id:"archivedAt"},we=({projectId:e})=>{const{archivedFeatures:n,loading:r,refetchArchived:o}=K7(e),{value:a,setValue:i}=b5(`${e}:ProjectFeaturesArchiveTable`,Se);return t(J7,{title:"Project archive",archivedFeatures:n||[],loading:r,storedParams:a,setStoredParams:i,refetch:o,projectId:e})},xe=()=>{const e=J("projectId"),n=k1(e);return M1(`Project archive – ${n}`),t(we,{projectId:e})},n7=(e=[])=>{var o;const n=e.map(a=>a.environment),r=C.useRef(n);return n.join("")!==((o=r.current)==null?void 0:o.join(""))&&(r.current=n),r.current};var Z3={},Ve=O5;Object.defineProperty(Z3,"__esModule",{value:!0});var r7=Z3.default=void 0,_e=Ve(B5()),He=$5,Ee=(0,_e.default)((0,He.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");r7=Z3.default=Ee;var j3={},Me=O5;Object.defineProperty(j3,"__esModule",{value:!0});var o7=j3.default=void 0,Te=Me(B5()),ke=$5,Ae=(0,Te.default)((0,ke.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");o7=j3.default=Ae;const De=p(T)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),a7=({projectId:e,row:n,onOpenArchiveDialog:r,onOpenStaleDialog:o})=>{const[a,i]=C.useState(null),{original:{name:s,stale:l}}=n,d=!!a,u=_=>{i(_.currentTarget)},h=()=>{i(null)},f=`feature-${s}-actions`,g=`${f}-menu`;return c(De,{children:[t(w1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:t(P1,{id:f,"aria-controls":d?g:void 0,"aria-haspopup":"true","aria-expanded":d?"true":void 0,onClick:u,type:"button",children:t(Y7,{})})}),t(w2,{id:g,anchorEl:a,open:d,onClose:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:_=>({borderRadius:`${_.shape.borderRadius}px`,padding:_.spacing(1,1.5)})},children:c(x2,{"aria-labelledby":f,children:[t(f5,{projectId:e,permission:V2,children:({hasAccess:_})=>c(q1,{sx:O2,onClick:h,disabled:!_,component:T1,to:`/projects/${e}/features/${s}/copy`,children:[t(G1,{children:t(Q7,{})}),t(K1,{children:t(O,{variant:"body2",children:"Copy"})})]})}),t(f5,{projectId:e,permission:d4,children:({hasAccess:_})=>c(q1,{sx:O2,onClick:()=>{r(s),h()},disabled:!_,children:[t(G1,{children:t(r7,{})}),t(K1,{children:t(O,{variant:"body2",children:"Archive"})})]})}),t(f5,{projectId:e,permission:_2,children:({hasAccess:_})=>c(q1,{sx:O2,onClick:()=>{h(),o({featureId:s,stale:l===!0})},disabled:!_,children:[t(G1,{children:t(o7,{})}),t(K1,{children:c(O,{variant:"body2",children:[l?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var F3={},Le=O5;Object.defineProperty(F3,"__esModule",{value:!0});var i7=F3.default=void 0,Re=Le(B5()),Pe=$5,Ze=(0,Re.default)((0,Pe.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");i7=F3.default=Ze;const je=p(T)(()=>({...Z1,justifyContent:"center"})),Fe=p(P1)(({theme:e})=>({margin:e.spacing(-1,0)})),Ie=p(T)(({theme:e})=>({...Z1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),Be=p(q1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),s6=p(f3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),Oe=p(z5)(({theme:e})=>({padding:e.spacing(.75,1)})),$e={favorite:"Favorite"},s7=({allColumns:e,staticColumns:n=[],dividerBefore:r=[],dividerAfter:o=[],isCustomized:a=!1,setHiddenColumns:i})=>{const[s,l]=C.useState(null),d=u1(),u=m1(d.breakpoints.down("sm")),h=m1(d.breakpoints.down("md")),f=m1(d.breakpoints.down("lg"));C.useEffect(()=>{if(a)return;const v=(w,k=0)=>{const R=e.filter(({id:V})=>V.startsWith("environments.")!==!1).map(({id:V})=>V).slice(0,k),z=e.map(({id:V})=>V).filter(V=>!w.includes(V)).filter(V=>!n.includes(V)).filter(V=>!R.includes(V));i(z)};if(u)return v(["createdAt"]);if(h)return v(["createdAt"],1);if(f)return v(["type","createdAt"],1);v(["lastSeenAt","type","createdAt"],3)},[u,h,f]);const g=v=>{l(v.currentTarget)},_=()=>{l(null)},H=!!s,b="columns-menu",L=`columns-menu-list-${b}`;return c(je,{children:[t(w1,{title:"Select columns",arrow:!0,describeChild:!0,children:t(Fe,{id:b,"aria-controls":H?L:void 0,"aria-haspopup":"true","aria-expanded":H?"true":void 0,onClick:g,type:"button",size:"large","data-loading":!0,children:t(i7,{})})}),c(w2,{id:L,open:H,anchorEl:s,onClose:_,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:v.shape.borderRadius,paddingBottom:v.spacing(2)})},children:[c(Ie,{children:[t(O,{variant:"body2",children:t("strong",{children:"Columns"})}),t(P1,{onClick:_,children:t(X7,{})})]}),t(x2,{children:e.filter(({hideInMenu:v})=>!v).map(v=>[t(M,{condition:r.includes(v.id),show:t(s6,{})}),c(Be,{onClick:()=>v.toggleHidden(v.isVisible),disabled:n.includes(v.id),children:[t(G1,{children:t(Oe,{edge:"start",checked:v.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":v.id},size:"medium"})}),t(K1,{id:v.id,primary:t(O,{variant:"body2",children:t(M,{condition:!!(typeof v.Header=="string"&&v.Header),show:()=>t(G,{children:v.Header}),elseShow:()=>$e[v.id]||v.id})})})]}),t(M,{condition:o.includes(v.id),show:t(s6,{})})])})]})]})},l7=u4()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),ze=7,Ne=e=>{const n=l4(new Date,-ze);return!!(e!=null&&e.lastSeenAt&&Y9(new Date(e.lastSeenAt),n))},We=({projectId:e,featureIds:n,features:r,onConfirm:o})=>{const{refetch:a}=g1(e),[i,s]=C.useState(!1),{trackEvent:l}=v1(),d=C.useMemo(()=>n.filter(h=>{const f=r.find(g=>g.name===h);return Ne(f)}),[JSON.stringify(r),n]);return c(G,{children:[t(f5,{projectId:e,permission:d4,children:({hasAccess:h})=>t(C1,{disabled:!h||i,variant:"outlined",size:"small",onClick:()=>s(!0),children:"Archive"})}),t(P3,{projectId:e,featureIds:n,featuresWithUsage:d,onConfirm:async()=>{s(!1),o==null||o(),await a(),l("batch_operations",{props:{eventType:"features archived"}})},isOpen:i,onClose:()=>s(!1)})]})},o2="selection-actions-menu",Ue=({projectId:e,data:n})=>{const{refetch:r}=g1(e),[o,a]=C.useState(null),{staleFeatures:i}=C5(),{setToastData:s,setToastApiError:l}=d1(),{trackEvent:d}=v1(),u=!!o,h=n.map(({name:v})=>v),f=v=>{a(v.currentTarget)},g=()=>{a(null)},_=n.some(({stale:v})=>v===!0),H=n.some(({stale:v})=>v===!1),b=async()=>{try{g(),await i(e,h),await r(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features staled"}})}catch(v){l(s1(v))}},L=async()=>{try{g(),await i(e,h,!1),await r(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features unstaled"}})}catch(v){l(s1(v))}};return c(G,{children:[t(w1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t(P1,{id:o2,"aria-controls":u?o2:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:f,type:"button","data-testid":e8,children:t(t8,{})})}),t(w2,{id:`${o2}-menu`,anchorEl:o,open:u,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:t(x2,{"aria-labelledby":`${o2}-menu`,children:t(f5,{projectId:e,permission:_2,children:({hasAccess:v})=>c(G,{children:[t(M,{condition:H,show:()=>c(q1,{onClick:b,disabled:!v,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t(G1,{children:t(o6,{})}),t(K1,{children:t(O,{variant:"body2",children:"Mark as stale"})})]})}),t(M,{condition:_,show:()=>c(q1,{onClick:L,disabled:!v,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t(G1,{children:t(o6,{})}),t(K1,{children:t(O,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},qe=p("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),l6="manage-tags-form",c6=(e,n)=>[...e,...e.some(r=>r.value===n.value&&r.type===n.type)?[]:[n]],C6=(e,n)=>e.filter(r=>!(r.value===n.value&&r.type===n.type)),Ge=(e,n)=>{switch(n.type){case"add":return{...e,addedTags:c6(e.addedTags,n.payload),removedTags:C6(e.removedTags,n.payload)};case"remove":return{...e,addedTags:C6(e.addedTags,n.payload),removedTags:c6(e.removedTags,n.payload)};case"clear":return{addedTags:[],removedTags:n.payload};default:return e}},d6={name:"",description:"",icon:""},Ke=({open:e,initialValues:n,initialIndeterminateValues:r,onCancel:o,onSubmit:a})=>{const{tagTypes:i,loading:s}=n8(),[l,d]=C.useState(d6),[u,h]=C.useState([]),[f,g]=C.useState([]),{tags:_,refetch:H}=m9(l.name),{createTag:b}=q4(),L=_.map(({value:P})=>({title:P})),[v,w]=C.useReducer(Ge,{addedTags:[],removedTags:[]}),k=(P=i.length>0?i[0]:d6)=>{d(P);const $=r.filter(({type:Z})=>Z===P.name);h(n.filter(({type:Z})=>Z===P.name).filter(({type:Z,value:F})=>!$.some(U=>U.value===F&&U.type===Z)).map(({value:Z})=>({title:Z}))),g($.map(({value:Z})=>({title:Z}))),w({type:"clear",payload:[]})};C.useEffect(()=>{i.length>0&&k()},[s]);const R=(P,$)=>{$!=null&&typeof $!="string"&&(P.preventDefault(),k($))},z=(P,$)=>b({value:P,type:$}).then(async()=>{await H(),h(Z=>[...Z,{title:P}]),w({type:"add",payload:{value:P,type:$}})}),V=(P,$,Z,F)=>{Z==="selectOption"?$.forEach(U=>{if(typeof U!="string"&&typeof U.inputValue=="string"&&U.inputValue&&U.title.startsWith("Create new value"))return z(U.inputValue,l.name);h($),g(q=>q.filter(({title:S})=>S!==U.title)),F!=null&&F.option&&w({type:"add",payload:{value:F.option.title,type:l.name}})}):Z==="clear"?(h([]),w({type:"clear",payload:n})):Z==="removeOption"&&(h($),F!=null&&F.option&&w({type:"remove",payload:{value:F.option.title,type:l.name}}))},B=()=>{k(),o()};return c(Q1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>a(v),disabledPrimaryButton:v.addedTags.length===0&&v.removedTags.length===0,onClose:B,formId:l6,children:[t(O,{paragraph:!0,sx:{marginBottom:P=>P.spacing(2.5)},children:"Tags allow you to group features together"}),t("form",{id:l6,onSubmit:()=>a(v),children:c(qe,{children:[t(f9,{options:i,disabled:s||i.length===0,value:l,onChange:R},s?"loading":i.length),t(M,{condition:!s&&i.length===0,show:c(O,{variant:"body1",children:["No"," ",t(y3,{component:T1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t(y9,{disabled:s,options:L,existingTags:n,indeterminateOptions:f,tagType:l,selectedOptions:u,onChange:V})})]})})]})},Je=({projectId:e,data:n})=>{const{bulkUpdateTags:r}=q4(),{refetch:o}=g1(e),{setToastData:a,setToastApiError:i}=d1(),{trackEvent:s}=v1(),[l,d]=C.useState(!1),[u,h]=C.useMemo(()=>{const g=n.flatMap(({tags:H})=>H||[]).reduce((H,b)=>[...H,...H.some(L=>L.type===b.type&&L.value===b.value)?[]:[b]],[]),_=g.filter(H=>!n.every(({tags:b})=>b==null?void 0:b.some(L=>L.type===H.type&&L.value===H.value)));return[g,_]},[n]);return c(G,{children:[t(f5,{projectId:e,permission:_2,children:({hasAccess:g})=>t(C1,{disabled:!g||l,variant:"outlined",size:"small",onClick:()=>d(!0),children:"Tags"})}),t(Ke,{open:l,onCancel:()=>d(!1),onSubmit:async({addedTags:g,removedTags:_})=>{const H=n.map(({name:L})=>L),b={features:H,tags:{addedTags:g,removedTags:_}};try{await r(b,e),o();const L=g.length?`Added tags: ${g.map(({type:w,value:k})=>`${w}:${k}`).join(", ")}.`:"",v=_.length?`Removed tags: ${_.map(({type:w,value:k})=>`${w}:${k}`).join(", ")}.`:"";a({title:"Tags updated",text:`${H.length} feature toggles updated. ${L} ${v}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(L){i(s1(L))}d(!1)},initialValues:u,initialIndeterminateValues:h},n.length)]})},Ye=p(H2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),u6=p(x1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Qe=({showExportDialog:e,data:n,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,l]=C.useState(a[0]),{bulkToggleFeaturesEnvironmentOff:d}=v3(),{addChange:u}=E2(),{refetch:h}=g1(i),{setToastApiError:f,setToastData:g}=d1(),{isChangeRequestConfigured:_}=S5(i),{refetch:H}=M2(i),b=n.filter(k=>{var R,z;return((z=(R=k.environments)==null?void 0:R.find(V=>s===V.name))==null?void 0:z.enabled)===!1}).length,L=()=>a.map(k=>({key:k,label:k})),v=async()=>{try{_(s)?(await u(i,s,n.map(k=>({action:"updateEnabled",feature:k.name,payload:{enabled:!1}}))),H(),g({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await d(i,n.map(k=>k.name),s),h(),g({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),r(),o==null||o()}catch(k){f(s1(k))}},w=_(s)?"Add to change request":"Disable toggles";return t(Q1,{open:e,title:"Disable feature toggles",onClose:r,onClick:v,primaryButtonText:w,secondaryButtonText:"Cancel",children:c(T,{children:["You have selected ",t("b",{children:n.length})," feature toggles to disable.",t("br",{}),t("br",{}),t(O,{children:"Select which environment to disable the features for:"}),t(Ye,{options:L(),value:s,onChange:k=>l(k)}),t(M,{condition:_(s),show:t(u6,{severity:"warning",children:"Change requests are enabled for this environment."})}),t(M,{condition:b>0,show:c(u6,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},Xe=p(H2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),p6=p(x1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),e0=({showExportDialog:e,data:n,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,l]=C.useState(a[0]),{bulkToggleFeaturesEnvironmentOn:d}=v3(),{addChange:u}=E2(),{refetch:h}=g1(i),{setToastApiError:f,setToastData:g}=d1(),{isChangeRequestConfigured:_}=S5(i),{refetch:H}=M2(i),b=n.filter(k=>{var R,z;return((z=(R=k.environments)==null?void 0:R.find(V=>s===V.name))==null?void 0:z.enabled)===!0}).length,L=()=>a.map(k=>({key:k,label:k})),v=async()=>{try{_(s)?(await u(i,s,n.map(k=>({action:"updateEnabled",feature:k.name,payload:{enabled:!0}}))),H(),g({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await d(i,n.map(k=>k.name),s),h(),g({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),r(),o==null||o()}catch(k){f(s1(k))}},w=_(s)?"Add to change request":"Enable toggles";return t(Q1,{open:e,title:"Enable feature toggles",onClose:r,onClick:v,primaryButtonText:w,secondaryButtonText:"Cancel",children:c(T,{children:["You have selected ",t("b",{children:n.length})," feature toggles to enable.",t("br",{}),t("br",{}),t(O,{children:"Select which environment to enable the features for:"}),t(Xe,{options:L(),value:s,onChange:k=>l(k)}),t(M,{condition:_(s),show:t(p6,{severity:"warning",children:"Change requests are enabled for this environment."})}),t(M,{condition:b>0,show:c(p6,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},c7=({selectedIds:e,data:n,projectId:r,onResetSelection:o})=>{var v,w;const{uiConfig:a}=o1(),[i,s]=C.useState(!1),[l,d]=C.useState(!1),[u,h]=C.useState(!1),{trackEvent:f}=v1(),g=C.useMemo(()=>n.filter(k=>e.includes(k.name)),[n,e]),_=C.useMemo(()=>{const k=g.flatMap(R=>R.environments).map(R=>R==null?void 0:R.name).filter(R=>R!==void 0);return Array.from(new Set(k))},[g]),H=()=>{f("batch_operations",{props:{eventType:"features exported"}})},b=()=>{f("batch_operations",{props:{eventType:"features enabled"}})},L=()=>{f("batch_operations",{props:{eventType:"features disabled"}})};return c(G,{children:[t(M,{condition:!!((v=a==null?void 0:a.flags)!=null&&v.disableBulkToggle),show:null,elseShow:t(C1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Enable"})}),t(M,{condition:!!((w=a==null?void 0:a.flags)!=null&&w.disableBulkToggle),show:null,elseShow:t(C1,{variant:"outlined",size:"small",onClick:()=>h(!0),children:"Disable"})}),t(We,{projectId:r,featureIds:e,features:n,onConfirm:o}),t(C1,{variant:"outlined",size:"small",onClick:()=>s(!0),children:"Export"}),t(Je,{projectId:r,data:g}),t(Ue,{projectId:r,data:g}),t(b3,{showExportDialog:i,data:g,onClose:()=>s(!1),environments:_,onConfirm:H}),t(e0,{showExportDialog:l,data:g,onClose:()=>d(!1),environments:_,projectId:r,onConfirm:b}),t(Qe,{showExportDialog:u,data:g,onClose:()=>h(!1),environments:_,projectId:r,onConfirm:L})]})},t0=p(S3)(()=>({whiteSpace:"nowrap"})),n0=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:n})=>({flexGrow:0,...Z1,justifyContent:"center",...n&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),a2=["Select","Actions","name","favorite"],r0={id:"createdAt"},o0=({features:e,loading:n,environments:r=[]})=>{var n5,r5;const{classes:o}=l7(),a=u1(),i=m1(a.breakpoints.down("md")),[s,l]=C.useState({open:!1,featureId:"",environmentName:""}),[d,u]=C.useState({}),[h,f]=C.useState(),g=J("projectId"),{value:_,setValue:H}=b5(`${g}:FeatureToggleListTable:v1`,r0),{value:b,setValue:L}=p4(),v=A1(),[w,k]=T2(),R=n7(n?[{environment:"a"},{environment:"b"},{environment:"c"}]:r),{refetch:z}=g1(g),{isFavoritesPinned:V,sortTypes:B,onChangeIsFavoritePinned:P}=h4(w.has("favorites")?w.get("favorites")==="true":b.favorites),{favorite:$,unfavorite:Z}=g4(),{onChangeRequestToggleClose:F,onChangeRequestToggleConfirm:U,changeRequestDialogDetails:q}=G4(g),[S,x]=C.useState(!1),{uiConfig:A}=o1(),j=!!A.flags.lastSeenByEnvironment,W=C.useCallback(async y=>{y!=null&&y.favorite?await Z(g,y.name):await $(g,y.name),z()},[g,z]),I=C.useMemo(()=>e.some(y=>{var m;return(m=y==null?void 0:y.tags)==null?void 0:m.length}),[e]),Y=C.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:y})=>t(z5,{...y()}),Cell:({row:y})=>{var m;return t(m4,{...(m=y==null?void 0:y.getToggleRowSelectedProps)==null?void 0:m.call(y)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:t(f4,{isActive:V,onClick:P}),accessor:"favorite",Cell:({row:{original:y}})=>t(y4,{value:y==null?void 0:y.favorite,onClick:()=>W(y)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:({value:y,row:{original:m}})=>j?t(w3,{feature:m}):t(x3,{value:y}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:V3,align:"center",filterName:"type",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:y})=>t(w1,{title:y,arrow:!0,describeChild:!0,children:t("span",{children:t(_3,{title:y,to:`/projects/${g}/features/${y}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...I?[{id:"tags",Header:"Tags",accessor:y=>{var m;return((m=y.tags)==null?void 0:m.map(({type:D,value:E})=>`${D}:${E}`).join(`
|
|
1
|
+
import{c as Y1,j as t,et as s4,eu as e6,ev as l4,ew as W7,s as p,cy as U7,cv as p2,a7 as P5,r as C,ex as q7,ad as h1,a5 as X,d as c,a8 as Z5,a9 as j5,aa as F5,ab as I5,x as c4,b8 as Q1,L as x1,aP as c5,aQ as X1,aR as e5,ey as C4,aG as J,ez as k1,c1 as M1,f as d1,cp as g1,aB as C5,az as o1,eA as G7,ag as S2,cX as g3,eB as m3,eC as S1,aw as n1,aq as H1,av as i1,C as M,aM as T1,as as d5,ar as f1,ct as K7,ak as b5,eD as J7,bb as B5,bc as O5,bd as $5,B as T,w as w1,z as P1,bi as Y7,a3 as w2,bL as x2,eE as f5,cz as V2,M as q1,eF as O2,b5 as G1,eG as Q7,b7 as K1,T as O,cB as d4,aL as _2,aj as Z1,D as f3,m as z5,b as u1,ae as m1,eH as X7,J as G,eI as u4,al as v1,i as C1,eJ as e8,bw as t8,h as s1,bW as n8,bV as y3,bI as H2,bX as v3,aX as E2,b0 as S5,aY as M2,eK as b3,dq as S3,bF as p4,aA as A1,am as T2,eL as h4,cw as g4,eM as m4,eN as f4,eO as y4,eP as w3,eQ as x3,eR as V3,ao as _3,eS as v4,eT as b4,eU as S4,d8 as N5,ap as W5,d9 as w4,cu as x4,b_ as H3,ai as U5,eV as V4,eW as r8,eX as o8,eY as a8,Z as i8,aO as s8,cq as l8,an as _4,eZ as c8,E as j1,e_ as H4,P as E4,e$ as M4,G as C8,f0 as d8,f1 as u8,t as i3,aS as E3,f2 as M3,e as T4,f3 as k4,f4 as p8,bR as A4,f5 as D4,f6 as L4,f7 as h8,f8 as g8,f9 as m8,a6 as q5,ah as G5,aI as f8,fa as y8,fb as k2,fc as v8,fd as R4,fe as b8,ff as S8,fg as w5,fh as u5,aJ as F1,cE as x5,fi as V5,fj as _5,fk as w8,bZ as T3,fl as P4,fm as x8,br as I1,ay as Z4,cl as a5,bv as H5,fn as V8,fo as _8,fp as H8,l as K5,fq as E8,fr as M8,fs as T8,ft as k8,dH as k3,dI as h2,bB as A8,ck as j4,dy as g2,fu as D8,cD as A3,d2 as J5,c4 as i5,aK as y5,aN as D3,bM as F4,di as L3,A as I4,ds as L8,n as B4,o as O4,aF as J1,aC as Y5,fv as R8,fw as P8,dm as r2,fx as Z8,fy as j8,fz as F8,fA as I8,fB as B8,c2 as E5,c3 as t1,fC as O8,fD as t6,fE as $4,u as R3,aD as $8,fF as z8,c_ as N8,fG as n6,fH as W8,fI as U8,fJ as q8,fK as G8,fL as K8,bo as J8,bp as Y8,bC as Q8,bD as X8,bE as e9,W as t9,fM as n9,c0 as r9,fN as o9,y as r6,c9 as a9,fO as i9,fP as z4,cx as N4,ep as W4,fQ as s9,dg as U4,fR as v5,fS as e1,fT as l9,fU as c9,fV as C9,fW as d9,fX as u9,H as c2,dn as p9,fY as h9,fZ as g9}from"./index-97019f83.js";import{e as P3,W as o6,b as m9,u as q4,T as f9,c as y9,h as G4,F as v9,V as K4,a as J4,g as Y4,C as Q4,U as X4,i as b9,j as S9,E as w9,k as x9}from"./FeatureArchiveDialog-9165a49c.js";import{h as V9,m as _9,i as a6,b as H9,c as E9,d as M9,e as T9,E as k9,f as A9,u as D9,a as L9,R as R9,C as P9,A as Z9,B as e7}from"./RoleCell-900af983.js";import{S as j9}from"./StrategyItemContainer-ec516690.js";import{C as F9,u as I9,P as B9,D as O9}from"./useProjectForm-5dd2ec50.js";import{E as $9}from"./Error-db0d1d33.js";const z9=Y1(t("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpward"),N9=Y1(t("path",{d:"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"}),"CallMade"),W9=Y1(t("path",{d:"M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"}),"FileUpload"),U9=Y1(t("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"Pending"),q9=Y1(t("path",{d:"M2 6H0v5h.01L0 20c0 1.1.9 2 2 2h18v-2H2V6zm20-2h-8l-2-2H6c-1.1 0-1.99.9-1.99 2L4 16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM7 15l4.5-6 3.5 4.51 2.5-3.01L21 15H7z"}),"PermMedia"),G9=Y1(t("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),K9=Y1(t("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"}),"Send"),J9=Y1(t("path",{d:"M19 9h-2v6.59L5.41 4 4 5.41 15.59 17H9v2h10V9z"}),"SouthEast");function Y9(e,n){s4(2,arguments);var r=e6(e),o=e6(n);return r.getTime()<o.getTime()}function Q9(e,n){s4(2,arguments);var r=W7(n);return l4(e,-r)}const i6=p("div")(()=>({display:"flex"})),X9=p("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%"}));p("div")(()=>({display:"flex",flexDirection:"column"}));const ee=p("span")(({theme:e})=>({fontSize:e.typography.h1.fontSize,textOverflow:"ellipsis",whiteSpace:"nowrap"})),te=p("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));p(te)(({theme:e})=>({color:e.palette.neutral.dark}));const ne=p(U7)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),re=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),oe=p("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),ae=p("span")(({theme:e})=>({margin:0,width:"100%",fontSize:e.fontSizes.mainHeader,fontWeight:"bold",display:"flex",justifyContent:"space-between",alignItems:"center",gap:e.spacing(2)})),ie=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),se=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),le=p(p2)(({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}})),ce=e=>e.reduce((n,r)=>r.enabled?n+1:n,0),Ce=p(P5)(({theme:e})=>({marginTop:e.spacing(3)})),de=p("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:n})=>({color:n?e.palette.error.dark:e.palette.text.primary,textAlign:"center"})),ue=({environment:e,warnEnabledToggles:n})=>{const r=C.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:d}})=>t(q7,{environment:d})},{Header:"Name",accessor:"name",Cell:h1},{Header:"Type",accessor:"type",Cell:h1},{Header:"Toggles enabled",accessor:"projectEnabledToggleCount",Cell:({value:d})=>t(h1,{children:t(de,{warning:d>0,children:d===1?"1 toggle":`${d} toggles`})}),align:"center"}],[n]),{getTableProps:o,getTableBodyProps:a,headerGroups:i,rows:s,prepareRow:l}=X.useTable({columns:r,data:[e],disableSortBy:!0});return c(Ce,{...o(),rowHeight:"compact",children:[t(Z5,{headerGroups:i}),t(j5,{...a(),children:s.map(d=>(l(d),t(F5,{hover:!0,...d.getRowProps(),children:d.cells.map(u=>t(I5,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},pe=p("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),he=p(c4)(()=>({width:"100%"})),ge=({environment:e,open:n,setOpen:r,onConfirm:o})=>{const[a,i]=C.useState("");return C.useEffect(()=>{i("")},[n]),c(Q1,{title:"Hide environment and disable feature toggles?",open:n,primaryButtonText:"Hide environment and disable feature toggles",disabledPrimaryButton:(e==null?void 0:e.name)!==a,secondaryButtonText:"Close",onClick:o,onClose:()=>{r(!1)},children:[c(x1,{severity:"error",children:[t("strong",{children:"Danger!"})," Hiding an environment will disable all the feature toggles that are enabled in this environment and it can impact client applications connected to the environment."]}),t(ue,{environment:e}),c(pe,{children:["In order to hide this environment, please enter the id of the environment in the textfield below:"," ",t("strong",{children:e==null?void 0:e.name})]}),t(he,{label:"Environment name",value:a,onChange:s=>i(s.target.value)})]})},me=e=>{const{data:n,error:r,mutate:o}=c5(X1(`api/admin/environments/project/${e}`),fe),a=C.useMemo(()=>n||[],[n]),i=C.useCallback(async()=>{await o()},[o]);return{environments:a,refetchEnvironments:i,loading:!r&&!n,error:r}},fe=async e=>(await fetch(e).then(e5("Environments")).then(r=>r.json())).environments.sort((r,o)=>r.sortOrder-o.sortOrder),ye=p(x1)(({theme:e})=>({marginBottom:e.spacing(4)})),ve=p("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",[e.breakpoints.down("sm")]:{justifyContent:"center"}})),be=p(C4)(({theme:e})=>({maxWidth:"400px",marginBottom:e.spacing(2)})),t7=()=>{const e=J("projectId"),n=k1(e);M1(`Project environments – ${n}`);const{setToastData:r,setToastApiError:o}=d1(),{environments:a,loading:i,error:s,refetchEnvironments:l}=me(e),{project:d,refetch:u}=g1(e),{removeEnvironmentFromProject:h,addEnvironmentToProject:f}=C5(),[g,_]=C.useState(),[H,b]=C.useState(!1),{isOss:L}=o1(),v=C.useMemo(()=>a.map(j=>({...j,projectVisible:d==null?void 0:d.environments.map(W=>W.environment).includes(j.name)})),[a,d==null?void 0:d.environments]),w=()=>{l(),u()},k=()=>t(be,{onClick:w,text:"Error fetching environments"}),R=j=>`Got an API error when trying to set the environment as ${j?"visible":"hidden"}`,z=async j=>{if(j.projectVisible){if(ce(v)>1){_(j),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 f(e,j.name),w(),r({title:"Environment set as visible",text:"Environment successfully set as visible.",type:"success"})}catch{o(R(!0))}},V=async()=>{if(g)try{await h(e,g.name),w(),r({title:"Environment set as hidden",text:"Environment successfully set as hidden.",type:"success"})}catch{o(R(!1))}finally{b(!1)}},B=j=>L()&&j==="default",P=C.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:j}})=>t(G7,{environment:j})},{Header:"Type",accessor:"type",Cell:S2},{Header:"Project API tokens",accessor:j=>j.projectApiTokenCount===1?"1 token":`${j.projectApiTokenCount} tokens`,Cell:h1},{Header:"Visible in project",accessor:"enabled",align:"center",width:1,Cell:({row:{original:j}})=>t(g3,{children:t(m3,{tooltip:j.projectVisible?"Hide environment and disable feature toggles":"Make it visible",size:"medium",disabled:B(j.name),projectId:e,permission:S1,checked:j.projectVisible,onChange:()=>z(j)})}),disableGlobalFilter:!0}],[v]),{getTableProps:$,getTableBodyProps:Z,headerGroups:F,rows:U,prepareRow:q,state:{globalFilter:S},setGlobalFilter:x}=X.useTable({columns:P,data:v,disableSortBy:!0},X.useGlobalFilter),A=t(n1,{title:`Environments (${U.length})`,actions:t(H1,{initialValue:S,onChange:x})});return t(i1,{header:A,isLoading:i,children:c(ve,{children:[t(M,{condition:!!s,show:k()}),c(ye,{severity:"info",children:[t("strong",{children:"Important!"})," In order for your application to retrieve configured activation strategies for a specific environment, the application must use an environment specific API token. You can look up the environment-specific"," ",t(T1,{to:"/admin/api",children:"API tokens here"}),".",t("br",{}),t("br",{}),"Your administrator can configure an environment-specific API token to be used in the SDK. If you are an administrator you can ",t(T1,{to:"/admin/api",children:"create a new API token here"}),"."]}),t(d5,{value:S,children:c(P5,{...$(),rowHeight:"compact",children:[t(Z5,{headerGroups:F}),t(j5,{...Z(),children:U.map(j=>(q(j),t(F5,{hover:!0,...j.getRowProps(),children:j.cells.map(W=>t(I5,{...W.getCellProps(),children:W.render("Cell")}))})))})]})}),t(M,{condition:U.length===0,show:t(M,{condition:(S==null?void 0:S.length)>0,show:c(f1,{children:["No environments found matching “",S,"”"]}),elseShow:t(f1,{children:"No environments available. Get started by adding one."})})}),t(ge,{environment:g,open:H,setOpen:b,onConfirm:V})]})})},Se={id:"archivedAt"},we=({projectId:e})=>{const{archivedFeatures:n,loading:r,refetchArchived:o}=K7(e),{value:a,setValue:i}=b5(`${e}:ProjectFeaturesArchiveTable`,Se);return t(J7,{title:"Project archive",archivedFeatures:n||[],loading:r,storedParams:a,setStoredParams:i,refetch:o,projectId:e})},xe=()=>{const e=J("projectId"),n=k1(e);return M1(`Project archive – ${n}`),t(we,{projectId:e})},n7=(e=[])=>{var o;const n=e.map(a=>a.environment),r=C.useRef(n);return n.join("")!==((o=r.current)==null?void 0:o.join(""))&&(r.current=n),r.current};var Z3={},Ve=O5;Object.defineProperty(Z3,"__esModule",{value:!0});var r7=Z3.default=void 0,_e=Ve(B5()),He=$5,Ee=(0,_e.default)((0,He.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");r7=Z3.default=Ee;var j3={},Me=O5;Object.defineProperty(j3,"__esModule",{value:!0});var o7=j3.default=void 0,Te=Me(B5()),ke=$5,Ae=(0,Te.default)((0,ke.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");o7=j3.default=Ae;const De=p(T)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),a7=({projectId:e,row:n,onOpenArchiveDialog:r,onOpenStaleDialog:o})=>{const[a,i]=C.useState(null),{original:{name:s,stale:l}}=n,d=!!a,u=_=>{i(_.currentTarget)},h=()=>{i(null)},f=`feature-${s}-actions`,g=`${f}-menu`;return c(De,{children:[t(w1,{title:"Feature toggle actions",arrow:!0,describeChild:!0,children:t(P1,{id:f,"aria-controls":d?g:void 0,"aria-haspopup":"true","aria-expanded":d?"true":void 0,onClick:u,type:"button",children:t(Y7,{})})}),t(w2,{id:g,anchorEl:a,open:d,onClose:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:_=>({borderRadius:`${_.shape.borderRadius}px`,padding:_.spacing(1,1.5)})},children:c(x2,{"aria-labelledby":f,children:[t(f5,{projectId:e,permission:V2,children:({hasAccess:_})=>c(q1,{sx:O2,onClick:h,disabled:!_,component:T1,to:`/projects/${e}/features/${s}/copy`,children:[t(G1,{children:t(Q7,{})}),t(K1,{children:t(O,{variant:"body2",children:"Copy"})})]})}),t(f5,{projectId:e,permission:d4,children:({hasAccess:_})=>c(q1,{sx:O2,onClick:()=>{r(s),h()},disabled:!_,children:[t(G1,{children:t(r7,{})}),t(K1,{children:t(O,{variant:"body2",children:"Archive"})})]})}),t(f5,{projectId:e,permission:_2,children:({hasAccess:_})=>c(q1,{sx:O2,onClick:()=>{h(),o({featureId:s,stale:l===!0})},disabled:!_,children:[t(G1,{children:t(o7,{})}),t(K1,{children:c(O,{variant:"body2",children:[l?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var F3={},Le=O5;Object.defineProperty(F3,"__esModule",{value:!0});var i7=F3.default=void 0,Re=Le(B5()),Pe=$5,Ze=(0,Re.default)((0,Pe.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");i7=F3.default=Ze;const je=p(T)(()=>({...Z1,justifyContent:"center"})),Fe=p(P1)(({theme:e})=>({margin:e.spacing(-1,0)})),Ie=p(T)(({theme:e})=>({...Z1,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),Be=p(q1)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),s6=p(f3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),Oe=p(z5)(({theme:e})=>({padding:e.spacing(.75,1)})),$e={favorite:"Favorite"},s7=({allColumns:e,staticColumns:n=[],dividerBefore:r=[],dividerAfter:o=[],isCustomized:a=!1,setHiddenColumns:i})=>{const[s,l]=C.useState(null),d=u1(),u=m1(d.breakpoints.down("sm")),h=m1(d.breakpoints.down("md")),f=m1(d.breakpoints.down("lg"));C.useEffect(()=>{if(a)return;const v=(w,k=0)=>{const R=e.filter(({id:V})=>V.startsWith("environments.")!==!1).map(({id:V})=>V).slice(0,k),z=e.map(({id:V})=>V).filter(V=>!w.includes(V)).filter(V=>!n.includes(V)).filter(V=>!R.includes(V));i(z)};if(u)return v(["createdAt"]);if(h)return v(["createdAt"],1);if(f)return v(["type","createdAt"],1);v(["lastSeenAt","type","createdAt"],3)},[u,h,f]);const g=v=>{l(v.currentTarget)},_=()=>{l(null)},H=!!s,b="columns-menu",L=`columns-menu-list-${b}`;return c(je,{children:[t(w1,{title:"Select columns",arrow:!0,describeChild:!0,children:t(Fe,{id:b,"aria-controls":H?L:void 0,"aria-haspopup":"true","aria-expanded":H?"true":void 0,onClick:g,type:"button",size:"large","data-loading":!0,children:t(i7,{})})}),c(w2,{id:L,open:H,anchorEl:s,onClose:_,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:v.shape.borderRadius,paddingBottom:v.spacing(2)})},children:[c(Ie,{children:[t(O,{variant:"body2",children:t("strong",{children:"Columns"})}),t(P1,{onClick:_,children:t(X7,{})})]}),t(x2,{children:e.filter(({hideInMenu:v})=>!v).map(v=>[t(M,{condition:r.includes(v.id),show:t(s6,{})}),c(Be,{onClick:()=>v.toggleHidden(v.isVisible),disabled:n.includes(v.id),children:[t(G1,{children:t(Oe,{edge:"start",checked:v.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":v.id},size:"medium"})}),t(K1,{id:v.id,primary:t(O,{variant:"body2",children:t(M,{condition:!!(typeof v.Header=="string"&&v.Header),show:()=>t(G,{children:v.Header}),elseShow:()=>$e[v.id]||v.id})})})]}),t(M,{condition:o.includes(v.id),show:t(s6,{})})])})]})]})},l7=u4()(e=>({container:{boxShadow:"none",marginLeft:"1rem",minHeight:"100%",width:"calc(100% - 1rem)",position:"relative",[e.breakpoints.down("md")]:{marginLeft:"0",paddingBottom:"4rem",width:"inherit"}}})),ze=7,Ne=e=>{const n=l4(new Date,-ze);return!!(e!=null&&e.lastSeenAt&&Y9(new Date(e.lastSeenAt),n))},We=({projectId:e,featureIds:n,features:r,onConfirm:o})=>{const{refetch:a}=g1(e),[i,s]=C.useState(!1),{trackEvent:l}=v1(),d=C.useMemo(()=>n.filter(h=>{const f=r.find(g=>g.name===h);return Ne(f)}),[JSON.stringify(r),n]);return c(G,{children:[t(f5,{projectId:e,permission:d4,children:({hasAccess:h})=>t(C1,{disabled:!h||i,variant:"outlined",size:"small",onClick:()=>s(!0),children:"Archive"})}),t(P3,{projectId:e,featureIds:n,featuresWithUsage:d,onConfirm:async()=>{s(!1),o==null||o(),await a(),l("batch_operations",{props:{eventType:"features archived"}})},isOpen:i,onClose:()=>s(!1)})]})},o2="selection-actions-menu",Ue=({projectId:e,data:n})=>{const{refetch:r}=g1(e),[o,a]=C.useState(null),{staleFeatures:i}=C5(),{setToastData:s,setToastApiError:l}=d1(),{trackEvent:d}=v1(),u=!!o,h=n.map(({name:v})=>v),f=v=>{a(v.currentTarget)},g=()=>{a(null)},_=n.some(({stale:v})=>v===!0),H=n.some(({stale:v})=>v===!1),b=async()=>{try{g(),await i(e,h),await r(),s({title:"State updated",text:"Feature toggles marked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features staled"}})}catch(v){l(s1(v))}},L=async()=>{try{g(),await i(e,h,!1),await r(),s({title:"State updated",text:"Feature toggles unmarked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features unstaled"}})}catch(v){l(s1(v))}};return c(G,{children:[t(w1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:t(P1,{id:o2,"aria-controls":u?o2:void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,onClick:f,type:"button","data-testid":e8,children:t(t8,{})})}),t(w2,{id:`${o2}-menu`,anchorEl:o,open:u,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:t(x2,{"aria-labelledby":`${o2}-menu`,children:t(f5,{projectId:e,permission:_2,children:({hasAccess:v})=>c(G,{children:[t(M,{condition:H,show:()=>c(q1,{onClick:b,disabled:!v,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t(G1,{children:t(o6,{})}),t(K1,{children:t(O,{variant:"body2",children:"Mark as stale"})})]})}),t(M,{condition:_,show:()=>c(q1,{onClick:L,disabled:!v,sx:{borderRadius:w=>`${w.shape.borderRadius}px`},children:[t(G1,{children:t(o6,{})}),t(K1,{children:t(O,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},qe=p("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),l6="manage-tags-form",c6=(e,n)=>[...e,...e.some(r=>r.value===n.value&&r.type===n.type)?[]:[n]],C6=(e,n)=>e.filter(r=>!(r.value===n.value&&r.type===n.type)),Ge=(e,n)=>{switch(n.type){case"add":return{...e,addedTags:c6(e.addedTags,n.payload),removedTags:C6(e.removedTags,n.payload)};case"remove":return{...e,addedTags:C6(e.addedTags,n.payload),removedTags:c6(e.removedTags,n.payload)};case"clear":return{addedTags:[],removedTags:n.payload};default:return e}},d6={name:"",description:"",icon:""},Ke=({open:e,initialValues:n,initialIndeterminateValues:r,onCancel:o,onSubmit:a})=>{const{tagTypes:i,loading:s}=n8(),[l,d]=C.useState(d6),[u,h]=C.useState([]),[f,g]=C.useState([]),{tags:_,refetch:H}=m9(l.name),{createTag:b}=q4(),L=_.map(({value:P})=>({title:P})),[v,w]=C.useReducer(Ge,{addedTags:[],removedTags:[]}),k=(P=i.length>0?i[0]:d6)=>{d(P);const $=r.filter(({type:Z})=>Z===P.name);h(n.filter(({type:Z})=>Z===P.name).filter(({type:Z,value:F})=>!$.some(U=>U.value===F&&U.type===Z)).map(({value:Z})=>({title:Z}))),g($.map(({value:Z})=>({title:Z}))),w({type:"clear",payload:[]})};C.useEffect(()=>{i.length>0&&k()},[s]);const R=(P,$)=>{$!=null&&typeof $!="string"&&(P.preventDefault(),k($))},z=(P,$)=>b({value:P,type:$}).then(async()=>{await H(),h(Z=>[...Z,{title:P}]),w({type:"add",payload:{value:P,type:$}})}),V=(P,$,Z,F)=>{Z==="selectOption"?$.forEach(U=>{if(typeof U!="string"&&typeof U.inputValue=="string"&&U.inputValue&&U.title.startsWith("Create new value"))return z(U.inputValue,l.name);h($),g(q=>q.filter(({title:S})=>S!==U.title)),F!=null&&F.option&&w({type:"add",payload:{value:F.option.title,type:l.name}})}):Z==="clear"?(h([]),w({type:"clear",payload:n})):Z==="removeOption"&&(h($),F!=null&&F.option&&w({type:"remove",payload:{value:F.option.title,type:l.name}}))},B=()=>{k(),o()};return c(Q1,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update tags to feature toggle",onClick:()=>a(v),disabledPrimaryButton:v.addedTags.length===0&&v.removedTags.length===0,onClose:B,formId:l6,children:[t(O,{paragraph:!0,sx:{marginBottom:P=>P.spacing(2.5)},children:"Tags allow you to group features together"}),t("form",{id:l6,onSubmit:()=>a(v),children:c(qe,{children:[t(f9,{options:i,disabled:s||i.length===0,value:l,onChange:R},s?"loading":i.length),t(M,{condition:!s&&i.length===0,show:c(O,{variant:"body1",children:["No"," ",t(y3,{component:T1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:t(y9,{disabled:s,options:L,existingTags:n,indeterminateOptions:f,tagType:l,selectedOptions:u,onChange:V})})]})})]})},Je=({projectId:e,data:n})=>{const{bulkUpdateTags:r}=q4(),{refetch:o}=g1(e),{setToastData:a,setToastApiError:i}=d1(),{trackEvent:s}=v1(),[l,d]=C.useState(!1),[u,h]=C.useMemo(()=>{const g=n.flatMap(({tags:H})=>H||[]).reduce((H,b)=>[...H,...H.some(L=>L.type===b.type&&L.value===b.value)?[]:[b]],[]),_=g.filter(H=>!n.every(({tags:b})=>b==null?void 0:b.some(L=>L.type===H.type&&L.value===H.value)));return[g,_]},[n]);return c(G,{children:[t(f5,{projectId:e,permission:_2,children:({hasAccess:g})=>t(C1,{disabled:!g||l,variant:"outlined",size:"small",onClick:()=>d(!0),children:"Tags"})}),t(Ke,{open:l,onCancel:()=>d(!1),onSubmit:async({addedTags:g,removedTags:_})=>{const H=n.map(({name:L})=>L),b={features:H,tags:{addedTags:g,removedTags:_}};try{await r(b,e),o();const L=g.length?`Added tags: ${g.map(({type:w,value:k})=>`${w}:${k}`).join(", ")}.`:"",v=_.length?`Removed tags: ${_.map(({type:w,value:k})=>`${w}:${k}`).join(", ")}.`:"";a({title:"Tags updated",text:`${H.length} feature toggles updated. ${L} ${v}`,type:"success",autoHideDuration:12e3}),s("batch_operations",{props:{eventType:"tags updated"}})}catch(L){i(s1(L))}d(!1)},initialValues:u,initialIndeterminateValues:h},n.length)]})},Ye=p(H2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),u6=p(x1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Qe=({showExportDialog:e,data:n,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,l]=C.useState(a[0]),{bulkToggleFeaturesEnvironmentOff:d}=v3(),{addChange:u}=E2(),{refetch:h}=g1(i),{setToastApiError:f,setToastData:g}=d1(),{isChangeRequestConfigured:_}=S5(i),{refetch:H}=M2(i),b=n.filter(k=>{var R,z;return((z=(R=k.environments)==null?void 0:R.find(V=>s===V.name))==null?void 0:z.enabled)===!1}).length,L=()=>a.map(k=>({key:k,label:k})),v=async()=>{try{_(s)?(await u(i,s,n.map(k=>({action:"updateEnabled",feature:k.name,payload:{enabled:!1}}))),H(),g({text:"Your disabled feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await d(i,n.map(k=>k.name),s),h(),g({text:"Your feature toggles have been disabled",type:"success",title:"Features disabled"})),r(),o==null||o()}catch(k){f(s1(k))}},w=_(s)?"Add to change request":"Disable toggles";return t(Q1,{open:e,title:"Disable feature toggles",onClose:r,onClick:v,primaryButtonText:w,secondaryButtonText:"Cancel",children:c(T,{children:["You have selected ",t("b",{children:n.length})," feature toggles to disable.",t("br",{}),t("br",{}),t(O,{children:"Select which environment to disable the features for:"}),t(Ye,{options:L(),value:s,onChange:k=>l(k)}),t(M,{condition:_(s),show:t(u6,{severity:"warning",children:"Change requests are enabled for this environment."})}),t(M,{condition:b>0,show:c(u6,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already disabled."]})})]})})},Xe=p(H2)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),p6=p(x1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),e0=({showExportDialog:e,data:n,onClose:r,onConfirm:o,environments:a,projectId:i})=>{const[s,l]=C.useState(a[0]),{bulkToggleFeaturesEnvironmentOn:d}=v3(),{addChange:u}=E2(),{refetch:h}=g1(i),{setToastApiError:f,setToastData:g}=d1(),{isChangeRequestConfigured:_}=S5(i),{refetch:H}=M2(i),b=n.filter(k=>{var R,z;return((z=(R=k.environments)==null?void 0:R.find(V=>s===V.name))==null?void 0:z.enabled)===!0}).length,L=()=>a.map(k=>({key:k,label:k})),v=async()=>{try{_(s)?(await u(i,s,n.map(k=>({action:"updateEnabled",feature:k.name,payload:{enabled:!0}}))),H(),g({text:"Your enable feature toggles changes have been added to change request",type:"success",title:"Changes added to a draft"})):(await d(i,n.map(k=>k.name),s),h(),g({text:"Your feature toggles have been enabled",type:"success",title:"Features enabled"})),r(),o==null||o()}catch(k){f(s1(k))}},w=_(s)?"Add to change request":"Enable toggles";return t(Q1,{open:e,title:"Enable feature toggles",onClose:r,onClick:v,primaryButtonText:w,secondaryButtonText:"Cancel",children:c(T,{children:["You have selected ",t("b",{children:n.length})," feature toggles to enable.",t("br",{}),t("br",{}),t(O,{children:"Select which environment to enable the features for:"}),t(Xe,{options:L(),value:s,onChange:k=>l(k)}),t(M,{condition:_(s),show:t(p6,{severity:"warning",children:"Change requests are enabled for this environment."})}),t(M,{condition:b>0,show:c(p6,{severity:"info",children:[b," feature"," ",b>1?"toggles are ":"toggle is ","already enabled."]})})]})})},c7=({selectedIds:e,data:n,projectId:r,onResetSelection:o})=>{var v,w;const{uiConfig:a}=o1(),[i,s]=C.useState(!1),[l,d]=C.useState(!1),[u,h]=C.useState(!1),{trackEvent:f}=v1(),g=C.useMemo(()=>n.filter(k=>e.includes(k.name)),[n,e]),_=C.useMemo(()=>{const k=g.flatMap(R=>R.environments).map(R=>R==null?void 0:R.name).filter(R=>R!==void 0);return Array.from(new Set(k))},[g]),H=()=>{f("batch_operations",{props:{eventType:"features exported"}})},b=()=>{f("batch_operations",{props:{eventType:"features enabled"}})},L=()=>{f("batch_operations",{props:{eventType:"features disabled"}})};return c(G,{children:[t(M,{condition:!!((v=a==null?void 0:a.flags)!=null&&v.disableBulkToggle),show:null,elseShow:t(C1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Enable"})}),t(M,{condition:!!((w=a==null?void 0:a.flags)!=null&&w.disableBulkToggle),show:null,elseShow:t(C1,{variant:"outlined",size:"small",onClick:()=>h(!0),children:"Disable"})}),t(We,{projectId:r,featureIds:e,features:n,onConfirm:o}),t(C1,{variant:"outlined",size:"small",onClick:()=>s(!0),children:"Export"}),t(Je,{projectId:r,data:g}),t(Ue,{projectId:r,data:g}),t(b3,{showExportDialog:i,data:g,onClose:()=>s(!1),environments:_,onConfirm:H}),t(e0,{showExportDialog:l,data:g,onClose:()=>d(!1),environments:_,projectId:r,onConfirm:b}),t(Qe,{showExportDialog:u,data:g,onClose:()=>h(!1),environments:_,projectId:r,onConfirm:L})]})},t0=p(S3)(()=>({whiteSpace:"nowrap"})),n0=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:n})=>({flexGrow:0,...Z1,justifyContent:"center",...n&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),a2=["Select","Actions","name","favorite"],r0={id:"createdAt"},o0=({features:e,loading:n,environments:r=[]})=>{var n5,r5;const{classes:o}=l7(),a=u1(),i=m1(a.breakpoints.down("md")),[s,l]=C.useState({open:!1,featureId:"",environmentName:""}),[d,u]=C.useState({}),[h,f]=C.useState(),g=J("projectId"),{value:_,setValue:H}=b5(`${g}:FeatureToggleListTable:v1`,r0),{value:b,setValue:L}=p4(),v=A1(),[w,k]=T2(),R=n7(n?[{environment:"a"},{environment:"b"},{environment:"c"}]:r),{refetch:z}=g1(g),{isFavoritesPinned:V,sortTypes:B,onChangeIsFavoritePinned:P}=h4(w.has("favorites")?w.get("favorites")==="true":b.favorites),{favorite:$,unfavorite:Z}=g4(),{onChangeRequestToggleClose:F,onChangeRequestToggleConfirm:U,changeRequestDialogDetails:q}=G4(g),[S,x]=C.useState(!1),{uiConfig:A}=o1(),j=!!A.flags.lastSeenByEnvironment,W=C.useCallback(async y=>{y!=null&&y.favorite?await Z(g,y.name):await $(g,y.name),z()},[g,z]),I=C.useMemo(()=>e.some(y=>{var m;return(m=y==null?void 0:y.tags)==null?void 0:m.length}),[e]),Y=C.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:y})=>t(z5,{...y()}),Cell:({row:y})=>{var m;return t(m4,{...(m=y==null?void 0:y.getToggleRowSelectedProps)==null?void 0:m.call(y)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:t(f4,{isActive:V,onClick:P}),accessor:"favorite",Cell:({row:{original:y}})=>t(y4,{value:y==null?void 0:y.favorite,onClick:()=>W(y)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:({value:y,row:{original:m}})=>j?t(w3,{feature:m}):t(x3,{value:y}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:V3,align:"center",filterName:"type",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:y})=>t(w1,{title:y,arrow:!0,describeChild:!0,children:t("span",{children:t(_3,{title:y,to:`/projects/${g}/features/${y}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...I?[{id:"tags",Header:"Tags",accessor:y=>{var m;return((m=y.tags)==null?void 0:m.map(({type:D,value:E})=>`${D}:${E}`).join(`
|
|
2
2
|
`))||""},Cell:v4,width:80,searchable:!0,filterName:"tags",filterBy(y,m){return b4(S4(this,y),m)}}]:[],{Header:"Created",accessor:"createdAt",Cell:N5,sortType:"date",minWidth:120},...R.map(y=>{const m=typeof y=="string"?y:y.environment;return{Header:n?()=>"":m,maxWidth:90,id:`environments.${m}`,accessor:D=>{var E;return(E=D.environments[m])==null?void 0:E.enabled},align:"center",Cell:({value:D,row:{original:E}})=>{const N=E.someEnabledEnvironmentHasVariants&&E.environments[m].variantCount===0&&E.environments[m].enabled;return c(n0,{hasWarning:N,children:[t(v9,{value:D,projectId:g,featureId:E.name,environmentName:m}),t(M,{condition:N,show:t(K4,{})})]})},sortType:"boolean",filterName:m,filterParsing:D=>D?"enabled":"disabled"}}),{id:"Actions",maxWidth:56,width:56,Cell:y=>t(a7,{projectId:g,onOpenArchiveDialog:f,onOpenStaleDialog:u,...y}),disableSortBy:!0,hideInMenu:!0}],[g,R,n]),[K,c1]=C.useState(w.get("search")||""),[R1,V1]=C.useState(!0),p5=C.useMemo(()=>e.map(y=>{var m;return{...y,environments:Object.fromEntries(R.map(D=>{const E=y==null?void 0:y.environments.find(N=>(N==null?void 0:N.name)===D);return[D,{name:D,enabled:(E==null?void 0:E.enabled)||!1,variantCount:(E==null?void 0:E.variantCount)||0,lastSeenAt:E==null?void 0:E.lastSeenAt}]})),someEnabledEnvironmentHasVariants:((m=y.environments)==null?void 0:m.some(D=>D.variantCount>0&&D.enabled))||!1}}),[e,R]),{data:b1,getSearchText:h5,getSearchContext:B1}=W5(Y,K,p5),O1=C.useMemo(()=>n?Array(6).fill({type:"-",name:"Feature name",createdAt:new Date,environments:{production:{name:"production",enabled:!1}}}):b1,[n,b1]),$1=C.useMemo(()=>{var D;const y=Y.map(E=>(E==null?void 0:E.id)||(typeof(E==null?void 0:E.accessor)=="string"?E==null?void 0:E.accessor:"")).filter(Boolean);let m=R.filter((E,N)=>N>=3).map(E=>`environments.${E}`);if(w.has("columns")){const E=((D=w.get("columns"))==null?void 0:D.split(","))||[],N=[...a2,...E];m=y.filter(a1=>!N.includes(a1))}else if(_.columns){const E=[...a2,..._.columns];m=y.filter(N=>!E.includes(N))}return{sortBy:[{id:w.get("sort")||"createdAt",desc:w.has("order")?w.get("order")==="desc":_.desc}],hiddenColumns:m,selectedRowIds:{}}},[R]),z1=C.useCallback(y=>y.name,[]),{allColumns:_1,headerGroups:g5,rows:D1,state:{selectedRowIds:N1,sortBy:y1,hiddenColumns:p1},prepareRow:t5,setHiddenColumns:W1,toggleAllRowsSelected:U1}=X.useTable({columns:Y,data:O1,initialState:$1,sortTypes:B,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:z1},X.useFlexLayout,X.useSortBy,X.useRowSelect);return C.useEffect(()=>{if(n)return;const y={};y.sort=y1[0].id,y1[0].desc&&(y.order="desc"),K&&(y.search=K),V&&(y.favorites="true"),y.columns=_1.map(({id:m})=>m).filter(m=>!a2.includes(m)&&!(p1!=null&&p1.includes(m))).join(","),k(y,{replace:!0}),H(m=>({...m,id:y1[0].id,desc:y1[0].desc||!1,columns:y.columns.split(",")})),L(m=>({...m,favorites:!!V}))},[n,y1,p1,K,k,V]),c(G,{children:[c(i1,{isLoading:n,className:o.container,header:t(n1,{titleElement:R1?`Feature toggles (${D1.length})`:null,actions:c(G,{children:[t(M,{condition:!i,show:t(H1,{placeholder:"Search and Filter",expandable:!0,initialValue:K,onChange:c1,onFocus:()=>V1(!1),onBlur:()=>V1(!0),hasFilters:!0,getSearchContext:B1,id:"projectFeatureToggles"})}),t(s7,{allColumns:_1,staticColumns:a2,dividerAfter:["createdAt"],dividerBefore:["Actions"],isCustomized:!!_.columns,setHiddenColumns:W1}),t(n1.Divider,{sx:{marginLeft:0}}),t(M,{condition:!!((n5=A==null?void 0:A.flags)!=null&&n5.featuresExportImport),show:t(w1,{title:"Export toggles visible in the table below",arrow:!0,children:t(P1,{onClick:()=>x(!0),sx:y=>({marginRight:y.spacing(2)}),children:t(w4,{})})})}),t(t0,{onClick:()=>v(x4(g)),maxWidth:"960px",Icon:H3,projectId:g,permission:V2,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:t(M,{condition:i,show:t(H1,{initialValue:K,onChange:c1,hasFilters:!0,getSearchContext:B1,id:"projectFeatureToggles"})})}),children:[t(d5,{value:h5(K),children:t(U5,{rows:D1,headerGroups:g5,prepareRow:t5})}),t(M,{condition:D1.length===0,show:t(M,{condition:(K==null?void 0:K.length)>0,show:c(f1,{children:["No feature toggles found matching “",K,"”"]}),elseShow:t(f1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})}),t(J4,{onClose:()=>l(y=>({...y,open:!1})),projectId:g,...s}),t(Y4,{isStale:d.stale===!0,isOpen:!!d.featureId,onClose:()=>{u({}),z()},featureId:d.featureId||"",projectId:g}),t(P3,{isOpen:!!h,onConfirm:()=>{z()},onClose:()=>{f(void 0)},featureIds:[h||""],projectId:g})," ",t(Q4,{isOpen:q.isOpen,onClose:F,environment:q==null?void 0:q.environment,onConfirm:U,messageComponent:t(X4,{featureName:q.featureName,enabled:q.enabled,environment:q==null?void 0:q.environment})}),t(M,{condition:!!((r5=A==null?void 0:A.flags)!=null&&r5.featuresExportImport)&&!n,show:t(b3,{showExportDialog:S,data:O1,onClose:()=>x(!1),environments:R})})]}),t(V4,{count:Object.keys(N1).length,children:t(c7,{selectedIds:Object.keys(N1),data:e,projectId:g,onResetSelection:()=>U1(!1)})})]})},a0=p(T)(()=>({mx:"auto",...Z1})),i0=({projectId:e,featureId:n,environmentName:r,value:o,onToggle:a})=>{const[i,s,l]=b9(o),d=()=>{s(!i),requestAnimationFrame(()=>{a(!i,l)})},u=`${n}-${r}`;return t(G,{children:t(a0,{"data-testid":`TOGGLE-${u}`,children:t(m3,{tooltip:i?`Disable feature in ${r}`:`Enable feature in ${r}`,checked:o,environmentId:r,projectId:e,permission:r8,inputProps:{"aria-label":r},onClick:d,"data-testid":"permission-switch",disableRipple:!0,disabled:o!==i})},u)})},s0=p("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:n})=>({flexGrow:0,...Z1,justifyContent:"center",...n&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),l0=(e,n,r,o,a)=>({value:i,row:{original:s}})=>{const l=s.environments[n],d=C.useMemo(()=>s.someEnabledEnvironmentHasVariants&&l.variantCount===0&&l.enabled,[s,l]),u=(h,f)=>{a(h,{projectId:e,featureId:s.name,environmentName:n,environmentType:l==null?void 0:l.type,hasStrategies:l==null?void 0:l.hasStrategies,hasEnabledStrategies:l==null?void 0:l.hasEnabledStrategies,isChangeRequestEnabled:r,onRollback:f,onSuccess:o})};return c(s0,{hasWarning:d,children:[t(i0,{projectId:e,value:i,featureId:s.name,environmentName:n,onToggle:u}),t(M,{condition:d,show:t(K4,{})})]})},c0=e=>{const n=r=>{r<e.length&&e[r](()=>n(r+1))};n(0)},C0=e=>{const{toggleFeatureEnvironmentOn:n,toggleFeatureEnvironmentOff:r}=v3(),{setToastData:o,setToastApiError:a}=d1(),[i,s]=C.useState({open:!1,label:"",loading:!1,onClose:()=>{},onClick:()=>{}}),[l,d]=C.useState({isOpen:!1,environment:"",onClose:()=>{},onActivateDisabledStrategies:()=>{},onAddDefaultStrategy:()=>{}}),{onChangeRequestToggle:u,onChangeRequestToggleClose:h,onChangeRequestToggleConfirm:f,changeRequestDialogDetails:g}=G4(e),[_,H]=C.useState(),b=C.useCallback(async(v,w)=>{let k=!1;return c0([$=>{if(w.isChangeRequestEnabled||!a8(w.environmentType||""))return $();s({open:!0,label:`${v?"Enable":"Disable"} Environment`,loading:!1,onClose:()=>{var Z;s(F=>({...F,open:!1})),(Z=w.onRollback)==null||Z.call(w)},onClick:()=>{s(Z=>({...Z,open:!1,loading:!0})),$()}})},$=>{if(!w.hasStrategies||w.hasEnabledStrategies)return $();d({isOpen:!0,environment:w.environmentName,onClose:()=>{var Z;d(F=>({...F,isOpen:!1})),(Z=w.onRollback)==null||Z.call(w)},onActivateDisabledStrategies:()=>{d(Z=>({...Z,isOpen:!1})),k=!0,$()},onAddDefaultStrategy:()=>{d(Z=>({...Z,isOpen:!1})),$()}})},$=>{if(!w.isChangeRequestEnabled)return $();H(()=>{var Z;H(void 0),(Z=w.onRollback)==null||Z.call(w)}),u(w.featureId,w.environmentName,v,k)},async $=>{var Z,F;if(v!==!1)return $();try{await r(w.projectId,w.featureId,w.environmentName),o({type:"success",title:`Disabled in ${w.environmentName}`,text:`${w.featureId} is unavailable in ${w.environmentName} and its strategies will no longer have any effect.`}),(Z=w.onSuccess)==null||Z.call(w)}catch(U){a(s1(U)),(F=w.onRollback)==null||F.call(w)}},async $=>{var Z,F;if(v!==!0)return $();try{await n(w.projectId,w.featureId,w.environmentName,k),o({type:"success",title:`Enabled in ${w.environmentName}`,text:`${w.featureId} is now available in ${w.environmentName} based on its defined strategies.`}),(Z=w.onSuccess)==null||Z.call(w)}catch(U){a(s1(U)),(F=w.onRollback)==null||F.call(w)}}])},[s]),L=c(G,{children:[t(o8,{...i}),t(S9,{...l}),t(Q4,{isOpen:g.isOpen,onClose:()=>{_==null||_(),h()},environment:g==null?void 0:g.environment,onConfirm:()=>{_==null||_(),f()},messageComponent:t(X4,{enabled:g==null?void 0:g.enabled,featureName:g==null?void 0:g.featureName,environment:g.environment})})]});return{onToggle:b,modals:L}},d0=p(S3)(()=>({whiteSpace:"nowrap"})),i2=["Select","Actions","name","favorite"],u0={id:"createdAt"},p0=({features:e,loading:n,environments:r=[]})=>{var n5,r5;const{classes:o}=l7(),a=u1(),i=m1(a.breakpoints.down("md")),[s,l]=C.useState({open:!1,featureId:"",environmentName:""}),[d,u]=C.useState({}),[h,f]=C.useState(),g=J("projectId"),{onToggle:_,modals:H}=C0(g),{value:b,setValue:L}=b5(`${g}:FeatureToggleListTable:v1`,u0),{value:v,setValue:w}=p4(),k=A1(),[R,z]=T2(),V=n7(n?[{environment:"a"},{environment:"b"},{environment:"c"}]:r),{refetch:B}=g1(g),{isFavoritesPinned:P,sortTypes:$,onChangeIsFavoritePinned:Z}=h4(R.has("favorites")?R.get("favorites")==="true":v.favorites),{favorite:F,unfavorite:U}=g4(),{isChangeRequestConfigured:q}=S5(g),[S,x]=C.useState(!1),{uiConfig:A}=o1(),j=!!A.flags.lastSeenByEnvironment,W=C.useCallback(async y=>{y!=null&&y.favorite?await U(g,y.name):await F(g,y.name),B()},[g,B]),I=C.useMemo(()=>e.some(y=>{var m;return(m=y==null?void 0:y.tags)==null?void 0:m.length}),[e]),Y=C.useMemo(()=>[{id:"Select",Header:({getToggleAllRowsSelectedProps:y})=>t(z5,{...y()}),Cell:({row:y})=>{var m;return t(m4,{...(m=y==null?void 0:y.getToggleRowSelectedProps)==null?void 0:m.call(y)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0},{id:"favorite",Header:t(f4,{isActive:P,onClick:Z}),accessor:"favorite",Cell:({row:{original:y}})=>t(y4,{value:y==null?void 0:y.favorite,onClick:()=>W(y)}),maxWidth:50,disableSortBy:!0,hideInMenu:!0},{Header:"Seen",accessor:"lastSeenAt",Cell:({value:y,row:{original:m}})=>j?t(w3,{feature:m}):t(x3,{value:y}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",Cell:V3,align:"center",filterName:"type",maxWidth:80},{Header:"Name",accessor:"name",Cell:({value:y})=>t(w1,{title:y,arrow:!0,describeChild:!0,children:t("span",{children:t(_3,{title:y,to:`/projects/${g}/features/${y}`})})}),minWidth:100,sortType:"alphanumeric",searchable:!0},...I?[{id:"tags",Header:"Tags",accessor:y=>{var m;return((m=y.tags)==null?void 0:m.map(({type:D,value:E})=>`${D}:${E}`).join(`
|
|
3
3
|
`))||""},Cell:v4,width:80,searchable:!0,filterName:"tags",filterBy(y,m){return b4(S4(this,y),m)}}]:[],{Header:"Created",accessor:"createdAt",Cell:N5,sortType:"date",minWidth:120},...V.map(y=>{const m=typeof y=="string"?y:y.environment,D=q(m),E=l0(g,m,D,B,_);return{Header:n?()=>"":m,maxWidth:90,id:`environments.${m}`,accessor:N=>{var a1;return(a1=N.environments[m])==null?void 0:a1.enabled},align:"center",Cell:E,sortType:"boolean",filterName:m,filterParsing:N=>N?"enabled":"disabled"}}),{id:"Actions",maxWidth:56,width:56,Cell:y=>t(a7,{projectId:g,onOpenArchiveDialog:f,onOpenStaleDialog:u,...y}),disableSortBy:!0,hideInMenu:!0}],[g,V,n]),[K,c1]=C.useState(R.get("search")||""),[R1,V1]=C.useState(!0),p5=C.useMemo(()=>e.map(y=>{var m;return{...y,environments:Object.fromEntries(V.map(D=>{const E=y==null?void 0:y.environments.find(N=>(N==null?void 0:N.name)===D);return[D,{name:D,enabled:(E==null?void 0:E.enabled)||!1,variantCount:(E==null?void 0:E.variantCount)||0,lastSeenAt:E==null?void 0:E.lastSeenAt,type:E==null?void 0:E.type,hasStrategies:E==null?void 0:E.hasStrategies,hasEnabledStrategies:E==null?void 0:E.hasEnabledStrategies}]})),someEnabledEnvironmentHasVariants:((m=y.environments)==null?void 0:m.some(D=>D.variantCount>0&&D.enabled))||!1}}),[e,V]),{data:b1,getSearchText:h5,getSearchContext:B1}=W5(Y,K,p5),O1=C.useMemo(()=>n?Array(6).fill({type:"-",name:"Feature name",createdAt:new Date,environments:{production:{name:"production",enabled:!1}}}):b1,[n,b1]),$1=C.useMemo(()=>{var D;const y=Y.map(E=>(E==null?void 0:E.id)||(typeof(E==null?void 0:E.accessor)=="string"?E==null?void 0:E.accessor:"")).filter(Boolean);let m=V.filter((E,N)=>N>=3).map(E=>`environments.${E}`);if(R.has("columns")){const E=((D=R.get("columns"))==null?void 0:D.split(","))||[],N=[...i2,...E];m=y.filter(a1=>!N.includes(a1))}else if(b.columns){const E=[...i2,...b.columns];m=y.filter(N=>!E.includes(N))}return{sortBy:[{id:R.get("sort")||"createdAt",desc:R.has("order")?R.get("order")==="desc":b.desc}],hiddenColumns:m,selectedRowIds:{}}},[V]),z1=C.useCallback(y=>y.name,[]),{allColumns:_1,headerGroups:g5,rows:D1,state:{selectedRowIds:N1,sortBy:y1,hiddenColumns:p1},prepareRow:t5,setHiddenColumns:W1,toggleAllRowsSelected:U1}=X.useTable({columns:Y,data:O1,initialState:$1,sortTypes:$,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:z1},X.useFlexLayout,X.useSortBy,X.useRowSelect);return C.useEffect(()=>{if(n)return;const y={};y.sort=y1[0].id,y1[0].desc&&(y.order="desc"),K&&(y.search=K),P&&(y.favorites="true"),y.columns=_1.map(({id:m})=>m).filter(m=>!i2.includes(m)&&!(p1!=null&&p1.includes(m))).join(","),z(y,{replace:!0}),L(m=>({...m,id:y1[0].id,desc:y1[0].desc||!1,columns:y.columns.split(",")})),w(m=>({...m,favorites:!!P}))},[n,y1,p1,K,z,P]),c(G,{children:[c(i1,{isLoading:n,className:o.container,header:t(n1,{titleElement:R1?`Feature toggles (${D1.length})`:null,actions:c(G,{children:[t(M,{condition:!i,show:t(H1,{placeholder:"Search and Filter",expandable:!0,initialValue:K,onChange:c1,onFocus:()=>V1(!1),onBlur:()=>V1(!0),hasFilters:!0,getSearchContext:B1,id:"projectFeatureToggles"})}),t(s7,{allColumns:_1,staticColumns:i2,dividerAfter:["createdAt"],dividerBefore:["Actions"],isCustomized:!!b.columns,setHiddenColumns:W1}),t(n1.Divider,{sx:{marginLeft:0}}),t(M,{condition:!!((n5=A==null?void 0:A.flags)!=null&&n5.featuresExportImport),show:t(w1,{title:"Export toggles visible in the table below",arrow:!0,children:t(P1,{onClick:()=>x(!0),sx:y=>({marginRight:y.spacing(2)}),children:t(w4,{})})})}),t(d0,{onClick:()=>k(x4(g)),maxWidth:"960px",Icon:H3,projectId:g,permission:V2,"data-testid":"NAVIGATE_TO_CREATE_FEATURE",children:"New feature toggle"})]}),children:t(M,{condition:i,show:t(H1,{initialValue:K,onChange:c1,hasFilters:!0,getSearchContext:B1,id:"projectFeatureToggles"})})}),children:[t(d5,{value:h5(K),children:t(U5,{rows:D1,headerGroups:g5,prepareRow:t5})}),t(M,{condition:D1.length===0,show:t(M,{condition:(K==null?void 0:K.length)>0,show:c(f1,{children:["No feature toggles found matching “",K,"”"]}),elseShow:t(f1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})}),t(J4,{onClose:()=>l(y=>({...y,open:!1})),projectId:g,...s}),t(Y4,{isStale:d.stale===!0,isOpen:!!d.featureId,onClose:()=>{u({}),B()},featureId:d.featureId||"",projectId:g}),t(P3,{isOpen:!!h,onConfirm:()=>{B()},onClose:()=>{f(void 0)},featureIds:[h||""],projectId:g}),t(M,{condition:!!((r5=A==null?void 0:A.flags)!=null&&r5.featuresExportImport)&&!n,show:t(b3,{showExportDialog:S,data:O1,onClose:()=>x(!1),environments:V})}),H]}),t(V4,{count:Object.keys(N1).length,children:t(c7,{selectedIds:Object.keys(N1),data:e,projectId:g,onResetSelection:()=>U1(!1)})})]})},Q5=p("div")(({theme:e})=>({margin:"0",textAlign:"center",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,width:"100%",minWidth:225,padding:e.spacing(3),[e.breakpoints.down("md")]:{display:"flex",flexDirection:"column",position:"relative",padding:e.spacing(1.5)}})),X5=p("p")(({theme:e})=>({marginBottom:e.spacing(2.5)})),I3=p("span")(({theme:e})=>({fontSize:e.typography.h2.fontSize,fontWeight:"bold",color:e.palette.text.primary})),A2=({children:e,to:n})=>t(O,{variant:"body2",textAlign:"center",sx:{paddingTop:r=>r.spacing(2.5),marginTop:"auto",justifySelf:"flex-end"},children:t(y3,{component:T1,to:n,children:e})}),h0=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(4)}})),g0=p("p")(({theme:e})=>({fontSize:"1.5rem",[e.breakpoints.down("md")]:{fontSize:e.fontSizes.bodySize}})),m0=({projectId:e,health:n})=>c(Q5,{children:[t(X5,{"data-loading":!0,children:"Project health"}),c(T,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:r=>r.spacing(2)},children:[t(g0,{children:t(i8,{percentage:n})}),c(h0,{"data-loading":!0,children:[n,"%"]})]}),t(A2,{to:`/projects/${e}/health`,children:"View project health"})]}),f0=p(I3)(({theme:e})=>({marginLeft:"auto",fontWeight:e.typography.fontWeightRegular,color:e.palette.text.secondary})),y0=p("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),width:"100%",gridTemplateColumns:`${e.spacing(2.5)} auto auto`,margin:e.spacing(1,0),fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,alignItems:"center",[e.breakpoints.down("md")]:{margin:0}})),v0=({type:e,Icon:n,count:r})=>c(y0,{"data-loading":!0,children:[t(n,{fontSize:"small","data-loading":!0}),t("div",{children:(a=>a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "))(e)}),t(f0,{children:r})]}),b0=({features:e})=>{const n=C.useMemo(()=>{const r=(e==null?void 0:e.filter(l=>l.type==="release").length)||0,o=(e==null?void 0:e.filter(l=>l.type==="experiment").length)||0,a=(e==null?void 0:e.filter(l=>l.type==="operational").length)||0,i=(e==null?void 0:e.filter(l=>l.type==="kill-switch").length)||0,s=(e==null?void 0:e.filter(l=>l.type==="permission").length)||0;return{release:r,experiment:o,operational:a,"kill-switch":i,permission:s}},[e]);return c(Q5,{sx:{padding:r=>r.spacing(3)},children:[t(X5,{children:"Toggle types used"}),Object.keys(n).map(r=>t(v0,{type:r,Icon:s8(r),count:n[r]},r))]})},S0=p("div")(({theme:e})=>({textAlign:"left",borderRadius:`${e.shape.borderRadius}px`,backgroundColor:`${e.palette.background.elevation2}`,padding:e.spacing(.5,2),fontSize:e.typography.body2.fontSize})),w0=({id:e,description:n})=>c(Q5,{children:[t(X5,{children:"Project Meta"}),c(S0,{children:[t(O,{component:"span",variant:"body2",color:"text.secondary",children:"ID:"})," ",t("code",{"data-loading":!0,children:e||"__________"})]}),t(M,{condition:!!n,show:t(O,{variant:"body2",sx:{marginTop:r=>r.spacing(1.5),marginBottom:0,textAlign:"left"},children:n})}),t(M,{condition:!n,show:t(A2,{to:`/projects/${e}/settings`,children:"Add description"})})]}),x0=p(O)(({theme:e})=>({marginBottom:e.spacing(2.5)})),V0=p(T)(({theme:e})=>({fontSize:e.fontSizes.largeHeader})),$2=p(T)(({theme:e})=>({...Z1,flexDirection:"column",alignItems:"center",marginLeft:e.spacing(2.5)})),h6=p(O)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),_0=p(O)(({theme:e})=>({marginLeft:e.spacing(1),fontSize:e.typography.body1.fontSize,fontWeight:e.typography.fontWeightBold})),H0=e=>e>0?t(N9,{sx:{color:"success.dark",height:20,width:20}}):t(J9,{sx:{color:"warning.dark",height:20,width:20}}),E0=e=>e>0?"success.dark":"warning.dark",L5=({title:e,boxText:n,change:r,percentage:o,children:a,customChangeElement:i})=>c(G,{children:[t(M,{condition:!!e,show:t(x0,{children:e})}),a,c(T,{sx:{...Z1,justifyContent:"center",width:"auto"},children:[t(V0,{children:n}),t(M,{condition:!!i,show:t($2,{children:i}),elseShow:t(M,{condition:r!==void 0&&r!==0,show:c($2,{children:[c(T,{sx:{...Z1},children:[H0(r),c(_0,{color:E0(r),children:[r>0?"+":"",r,o?"%":""]})]}),t(h6,{children:"this month"})]}),elseShow:t($2,{children:t(h6,{children:"No change"})})})})]})]}),M0=({projectId:e,memberCount:n,change:r=0})=>{var i,s;const{uiConfig:o}=o1();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`),c(Q5,{children:[t(X5,{"data-loading":!0,children:"Project members"}),t(T,{sx:{display:"flex",justifyContent:"center"},children:t(L5,{boxText:`${n}`,change:r})}),t(A2,{to:a,children:"View all members"})]})},T0=e=>fetch(e).then(e5("ChangeRequest")).then(n=>n.json()),C7=e=>{const{data:n,error:r,mutate:o}=l8([],X1(`api/admin/projects/${e}/change-requests`),T0);return C.useMemo(()=>({changeRequests:n,loading:!r&&!n,refetch:o,error:r}),[n,r,o])},C2="change-requests-widget",k0=p(T)(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1.5)})),g6=p(T)(({theme:e})=>({flex:1,textAlign:"left",padding:e.spacing(1.5),borderRadius:e.shape.borderRadiusMedium,alignItems:"center",minWidth:175})),m6=p(T)(({theme:e})=>({display:"flex",alignItems:"center"})),A0=p(I3)(({theme:e})=>({background:e.palette.seen.recent,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),D0=p(I3)(({theme:e})=>({background:e.palette.seen.primary,padding:e.spacing(0,1),marginRight:e.spacing(.5),borderRadius:e.shape.borderRadius})),f6=p(O)(({theme:e})=>({fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(.5)})),y6=()=>t(O,{component:"span",variant:"body2",color:"text.secondary",lineHeight:1,"data-loading":C2,children:"change requests"}),L0=({projectId:e})=>{const{changeRequests:n,loading:r}=C7(e),o=_4(r,`[data-loading="${C2}"]`),a=n==null?void 0:n.filter(s=>(s==null?void 0:s.state)==="Approved").length,i=n==null?void 0:n.filter(s=>(s==null?void 0:s.state)==="In review").length;return c(Q5,{ref:o,children:[t(X5,{children:"Open change requests"}),c(k0,{children:[c(g6,{sx:{background:s=>s.palette.success.light},children:[t(f6,{children:"To be applied"}),c(m6,{children:[t(A0,{"data-loading":C2,children:a||0})," ",t(y6,{})]})]}),c(g6,{sx:{background:s=>s.palette.secondary.light},children:[t(f6,{children:"To be reviewed"}),c(m6,{children:[t(D0,{"data-loading":C2,children:i||0})," ",t(y6,{})]})]})]}),t(A2,{to:`/projects/${e}/change-requests`,children:"View change requests"})]})},R0=p(T)(({theme:e})=>({...Z1,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"}})),P0=({id:e,description:n,memberCount:r,health:o,features:a,stats:i})=>{const{isEnterprise:s}=o1(),l=u1(),d=m1(l.breakpoints.down("md")),{isChangeRequestConfiguredInAnyEnv:u}=S5(e),h=s()&&u(),f=e!==c8;return t("aside",{children:c(R0,{sx:!h&&!f||d&&h&&f?{gridTemplateColumns:"repeat(auto-fill, minmax(225px, 1fr))"}:{gridTemplateColumns:"repeat(2, 1fr)"},children:[t(M,{condition:h,show:t(T,{sx:{gridColumnStart:f?"span 2":"span 1",flex:1,display:"flex"},children:t(L0,{projectId:e})})}),t(w0,{id:e,description:n}),t(m0,{projectId:e,health:o}),t(M,{condition:f,show:t(M0,{projectId:e,memberCount:r,change:i==null?void 0:i.projectMembersAddedCurrentWindow})}),t(b0,{features:a})]})})},Z0=p(j1)(({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})),v6=({children:e,id:n})=>{const[r,o]=C.useState(null),a=l=>o(l.currentTarget),i=()=>o(null);return c(T,{sx:{position:"absolute",top:l=>l.spacing(.5),right:l=>l.spacing(.5)},children:[t(P1,{onClick:a,"aria-describedby":n,size:"small",children:t(H4,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),t(E4,{id:n,open:!!r,anchorEl:r,sx:l=>({zIndex:l.zIndex.tooltip}),children:t(M4,{onClickAway:i,children:c(Z0,{elevation:3,children:[t(P1,{onClick:i,sx:{position:"absolute",right:4,top:4},children:t(C8,{sx:{fontSize:l=>l.typography.body1.fontSize}})}),e,t(d8,{id:n,eventName:"project_overview",localStorageKey:"ProjectOverviewFeedback"})]})})})]})},j0=p(T)(({theme:e})=>({padding:e.spacing(0,0,2,2),display:"grid",gap:e.spacing(2),gridTemplateColumns:"repeat(4, 1fr)",flexWrap:"wrap",[e.breakpoints.down("lg")]:{gridTemplateColumns:"repeat(2, 1fr)"},[e.breakpoints.down("md")]:{padding:e.spacing(0,0,2)},[e.breakpoints.down("sm")]:{flexDirection:"column"}})),s2=p(T)(({theme:e})=>({position:"relative",padding:e.spacing(3),backgroundColor:e.palette.background.paper,flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:`${e.shape.borderRadiusLarge}px`,[e.breakpoints.down("lg")]:{padding:e.spacing(2)}})),F0=p(O)(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,lineHeight:e.typography.body2.lineHeight})),I0=({stats:e})=>{if(Object.keys(e).length===0)return null;const{avgTimeToProdCurrentWindow:n,projectActivityCurrentWindow:r,projectActivityPastWindow:o,createdCurrentWindow:a,createdPastWindow:i,archivedCurrentWindow:s,archivedPastWindow:l}=e;return c(j0,{children:[t(s2,{children:t(L5,{title:"Total changes",boxText:String(r),change:r-o,children:t(v6,{id:"total-changes",children:"Sum of all configuration and state modifications in the project."})})}),t(s2,{children:t(L5,{title:"Avg. time to production",boxText:c(T,{sx:{display:"flex",alignItems:"center",gap:d=>d.spacing(1)},children:[n," ",t(O,{component:"span",children:"days"})]}),customChangeElement:t(F0,{children:"In project life"}),percentage:!0,children:t(v6,{id:"avg-time-to-prod",children:'How long did it take on average from a feature toggle was created until it was enabled in an environment of type production. This is calculated only from feature toggles with the type of "release".'})})}),t(s2,{children:t(L5,{title:"Features created",boxText:String(a),change:a-i})}),t(s2,{children:t(L5,{title:"Features archived",boxText:String(s),change:s-l})})]})},B0=15*1e3,O0=p("div")(({theme:e})=>({display:"flex",[e.breakpoints.down("md")]:{flexDirection:"column"}})),$0=p("div")(()=>({width:"100%",minWidth:0})),z0=p(T)(()=>({display:"flex",flexDirection:"column",width:"100%",minWidth:0})),N0=()=>{const e=J("projectId"),n=k1(e),{project:r,loading:o}=g1(e,{refreshInterval:B0}),{members:a,features:i,health:s,description:l,environments:d,stats:u}=r;M1(`Project overview – ${n}`);const{setLastViewed:h}=u8(),f=i3("featureSwitchRefactor");return C.useEffect(()=>{h(e)},[e,h]),c(O0,{children:[t(P0,{id:e,description:l,memberCount:a,health:s,features:i,stats:u}),c(z0,{children:[t(I0,{stats:r.stats}),t($0,{children:t(M,{condition:!!f,show:()=>t(p0,{features:i,environments:d,loading:o},o?"loading":"ready"),elseShow:()=>t(o0,{features:i,environments:d,loading:o},o?"loading":"ready")})})]})]})},W0=(e,n)=>{const r=X1(`api/admin/projects/${e}/health-report`),{data:o,error:a}=c5(r,U0,n),i=C.useCallback(()=>{E3(r).catch(console.warn)},[r]);return{healthReport:o,refetchHealthReport:i,loading:!a&&!o,error:a}},U0=e=>fetch(e).then(e5("Health report")).then(n=>n.json());var B3={},q0=O5;Object.defineProperty(B3,"__esModule",{value:!0});var s3=B3.default=void 0,G0=q0(B5()),K0=$5,J0=(0,G0.default)((0,K0.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M12 2 1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined");s3=B3.default=J0;const Y0=p(T)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),b6=p(T)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),Q0=p(j1)(({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)}})),z2=p("h2")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1)})),X0=p("p")(({theme:e})=>({fontSize:"2rem",fontWeight:e.fontWeight.bold})),et=p("p")(({theme:e})=>({color:e.palette.text.secondary})),S6=p("ul")(({theme:e})=>({listStyleType:"none",margin:0,padding:0,"& svg":{marginRight:e.spacing(1)}})),w6=p("p")(({theme:e})=>({marginLeft:e.spacing(4)})),tt=({healthReport:e})=>{const n=e.health<50?"error.main":e.health<75?"warning.main":"success.main",r=()=>c(Y0,{children:[t(T4,{}),c("span",{children:[e.activeCount," active toggles"]})]}),o=()=>c(b6,{children:[t(s3,{}),c("span",{children:[e.staleCount," stale toggles"]})]}),a=()=>c(b6,{children:[t(s3,{}),c("span",{children:[e.potentiallyStaleCount," potentially stale toggles"]})]});return c(Q0,{children:[c(T,{children:[t(z2,{children:"Health rating"}),t(M,{condition:e.health>-1,show:c(G,{children:[c(X0,{sx:{color:n},children:[e.health,"%"]}),c(et,{children:["Last updated:"," ",t(M3,{date:e.updatedAt,live:!1})]})]})})]}),c(T,{children:[t(z2,{children:"Toggle report"}),c(S6,{children:[t("li",{children:t(M,{condition:!!e.activeCount,show:r})}),t(M,{condition:!!e.activeCount,show:t(w6,{children:"Also includes potentially stale toggles."})}),t("li",{children:t(M,{condition:!!e.staleCount,show:o})})]})]}),c(T,{sx:{flexBasis:"40%"},children:[t(z2,{children:"Potential actions"}),t(S6,{children:t("li",{children:t(M,{condition:!!e.potentiallyStaleCount,show:a})})}),t(M,{condition:!!e.potentiallyStaleCount,show:t(w6,{children:"Review your feature toggles and delete unused toggles."}),elseShow:t("span",{children:"No action is required"})})]})]})},nt=({row:e})=>{const n=u1();return e.original.expiredAt?t(N5,{value:e.original.expiredAt}):t(h1,{children:t(O,{variant:"body2",color:n.palette.text.secondary,children:"N/A"})})},rt=p("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.warning.dark,"& svg":{color:e.palette.warning.main}})),ot=p("span")(({theme:e})=>({display:"flex",gap:"1ch",alignItems:"center",color:e.palette.success.dark,"& svg":{color:e.palette.success.main}})),at=({row:e})=>e.original.status==="potentially-stale"?t(h1,{children:c(rt,{children:[t(G9,{}),t("span",{children:"Potentially stale"})]})}):t(h1,{children:c(ot,{children:[t(k4,{}),t("span",{children:"Healthy"})]})}),d7=(e,n)=>Math.abs(p8(e,n)),u7=(e,n)=>{var r;return n.lifetimeDays?e>=((r=n==null?void 0:n.lifetimeDays)==null?void 0:r.valueOf()):!1},it=(e,n)=>{const{type:r,createdAt:o}=e,a=n.find(d=>d.id===r),i=A4(o),l=d7(i,new Date);return a&&u7(l,a)&&r!==D4&&r!==L4?"potentially-stale":"healthy"},st=(e,n)=>{var d;const{type:r,createdAt:o}=e,a=n.find(u=>u.id===r);if(a&&(a.name===D4||a.name===L4))return;const i=A4(o),s=new Date,l=d7(i,s);if(a&&u7(l,a)){const u=l-(((d=a==null?void 0:a.lifetimeDays)==null?void 0:d.valueOf())||0);return Q9(s,u).toISOString()}},lt=({projectId:e,features:n})=>{const r=u1(),o=m1(r.breakpoints.down("sm")),a=m1(r.breakpoints.down("md")),i=m1(r.breakpoints.down("lg")),{uiConfig:s}=o1(),l=!!s.flags.lastSeenByEnvironment,{featureTypes:d}=h8(),u=C.useMemo(()=>n.map(k=>({project:e,name:k.name,type:k.type,stale:k.stale,environments:k.environments,status:it(k,d),lastSeenAt:k.lastSeenAt,createdAt:k.createdAt,expiredAt:st(k,d)})),[e,n,d]),h=C.useMemo(()=>({hiddenColumns:[],sortBy:[{id:"createdAt"}]}),[]),f=C.useMemo(()=>[{Header:"Seen",accessor:"lastSeenAt",Cell:({value:k,row:{original:R}})=>l?t(w3,{feature:R}):t(x3,{value:k}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",align:"center",Cell:V3,disableGlobalFilter:!0,maxWidth:85},{Header:"Name",accessor:"name",sortType:"alphanumeric",Cell:g8,minWidth:120},{Header:"Created",accessor:"createdAt",sortType:"date",Cell:N5,disableGlobalFilter:!0,maxWidth:150},{Header:"Expired",accessor:"expiredAt",Cell:nt,disableGlobalFilter:!0,maxWidth:150},{Header:"Status",id:"status",accessor:"status",Cell:at,disableGlobalFilter:!0,width:180},{Header:"State",accessor:"stale",sortType:"boolean",Cell:m8,disableGlobalFilter:!0,maxWidth:120}],[l]),{headerGroups:g,rows:_,prepareRow:H,state:{globalFilter:b},setGlobalFilter:L,setHiddenColumns:v}=X.useTable({columns:f,data:u,initialState:h,sortTypes:q5,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0},X.useGlobalFilter,X.useFlexLayout,X.useSortBy);G5([{condition:o,columns:["stale"]},{condition:a,columns:["expiredAt","lastSeenAt"]},{condition:i,columns:["createdAt"]}],v,f);const w=_.length<u.length?`Feature toggles (${_.length} of ${u.length})`:`Feature toggles (${u.length})`;return c(i1,{header:t(n1,{title:w,actions:t(H1,{initialValue:b,onChange:L})}),children:[t(d5,{value:b,children:t(U5,{headerGroups:g,prepareRow:H,rows:_})}),t(M,{condition:_.length===0,show:t(M,{condition:(b==null?void 0:b.length)>0,show:c(f1,{children:["No feature toggles found matching “",b,"”"]}),elseShow:t(f1,{children:"No feature toggles available. Get started by adding a new feature toggle."})})})]})},ct=()=>{const e=J("projectId"),n=k1(e);M1(`Project health – ${n}`);const{healthReport:r,refetchHealthReport:o,error:a}=W0(e,{refreshInterval:15*1e3});return r?c("div",{children:[t(M,{condition:!!a,show:t(C4,{"data-loading":!0,style:{maxWidth:"500px",marginTop:"1rem"},onClick:o,text:`Could not fetch health rating for ${e}`})}),t(tt,{healthReport:r}),t(lt,{projectId:e,features:r.features})]}):null},Ct=p("div")(({theme:e})=>({borderRadius:"12.5px",backgroundColor:e.palette.background.paper,padding:"2rem"})),dt=()=>{const e=J("projectId");return t(Ct,{children:t(f8,{title:"Event Log",project:e,displayInline:!0})})},p7=(e,n)=>{const{data:r,error:o,mutate:a}=c5(X1(`api/admin/projects/${e}/change-requests/${n}`),ut,{refreshInterval:15e3});return{data:r,loading:!o&&!r,refetchChangeRequest:()=>a(),error:o}},ut=e=>fetch(e).then(e5("Request changes")).then(n=>n.json()),pt=p(j1)(({theme:e})=>({padding:e.spacing(3,4),borderRadius:`${e.shape.borderRadiusLarge}px`}));p(T)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(2)}));const ht=p(T)(({theme:e})=>({display:"flex",alignItems:"center"})),gt=p(O)(({theme:e})=>({display:"flex",alignItems:"center",marginRight:e.spacing(1),fontSize:e.fontSizes.mainHeader})),mt=p(y8)(({theme:e})=>({padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2})),O3=p(k2)(({theme:e})=>({height:"24px",width:"24px"})),ft=({changeRequest:e})=>{var o,a,i;const[n,r]=C.useState(e.title);return c(pt,{elevation:0,children:[t(v8,{environmentChangeRequest:e,title:n,setTitle:r,children:t(gt,{variant:"h1",sx:{mr:1.5},children:n})}),c(ht,{children:[t(R4,{state:e.state}),c(O,{variant:"body2",sx:s=>({margin:s.spacing("auto",0,"auto",2)}),children:["Created"," ",t(M3,{minPeriod:60,date:new Date(e.createdAt)})," ","by"]}),t(T,{sx:s=>({marginLeft:s.spacing(1)}),children:t(w1,{title:(o=e==null?void 0:e.createdBy)==null?void 0:o.username,children:t(O3,{src:(a=e==null?void 0:e.createdBy)==null?void 0:a.imageUrl})})}),t(O,{variant:"body2",sx:s=>({marginLeft:s.spacing(.5)}),children:(i=e==null?void 0:e.createdBy)==null?void 0:i.username}),t(T,{sx:s=>({marginLeft:s.spacing(1.5)}),children:t(mt,{variant:"outlined",children:c(O,{variant:"body2",sx:{lineHeight:1},children:["Environment:"," ",t(O,{display:"inline",fontWeight:"bold",variant:"body2",component:"span",children:e==null?void 0:e.environment})," ",t(b8,{}),"Updates:",t(S8,{featuresCount:e.features.length,segmentsCount:e.segments.length})]})})})]})]})};function l1(){return l1=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l1.apply(this,arguments)}function M5(e,n){if(e==null)return{};var r={},o=Object.keys(e),a,i;for(i=0;i<o.length;i++)a=o[i],!(n.indexOf(a)>=0)&&(r[a]=e[a]);return r}const yt=C.createContext({}),m2=yt;function vt(e){return w5("MuiTimeline",e)}u5("MuiTimeline",["root","positionLeft","positionRight","positionAlternate"]);const bt=["position","className"],St=e=>{const{position:n,classes:r}=e,o={root:["root",n&&`position${F1(n)}`]};return _5(o,vt,r)},wt=p("ul",{name:"MuiTimeline",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:r}=e;return[n.root,r.position&&n[`position${F1(r.position)}`]]}})({display:"flex",flexDirection:"column",padding:"6px 16px",flexGrow:1}),xt=C.forwardRef(function(n,r){const o=x5({props:n,name:"MuiTimeline"}),{position:a="right",className:i}=o,s=M5(o,bt),l=l1({},o,{position:a}),d=St(l),u=C.useMemo(()=>({position:a}),[a]);return t(m2.Provider,{value:u,children:t(wt,l1({className:V5(d.root,i),ownerState:l,ref:r},s))})}),h7=xt;function Vt(e){return w5("MuiTimelineContent",e)}const _t=u5("MuiTimelineContent",["root","positionLeft","positionRight","positionAlternate"]),Ht=["className"],Et=e=>{const{position:n,classes:r}=e,o={root:["root",`position${F1(n)}`]};return _5(o,Vt,r)},Mt=p(O,{name:"MuiTimelineContent",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:r}=e;return[n.root,n[`position${F1(r.position)}`]]}})(({ownerState:e})=>l1({flex:1,padding:"6px 16px",textAlign:"left"},e.position==="left"&&{textAlign:"right"})),Tt=C.forwardRef(function(n,r){const o=x5({props:n,name:"MuiTimelineContent"}),{className:a}=o,i=M5(o,Ht),{position:s}=C.useContext(m2),l=l1({},o,{position:s||"right"}),d=Et(l);return t(Mt,l1({component:"div",className:V5(d.root,a),ownerState:l,ref:r},i))}),g7=Tt,kt=u5("MuiTimelineOppositeContent",["root","positionLeft","positionRight","positionAlternate"]),At=kt;function Dt(e){return w5("MuiTimelineItem",e)}const Lt=u5("MuiTimelineItem",["root","positionLeft","positionRight","positionAlternate","missingOppositeContent"]),m7=Lt,Rt=["position","className"],Pt=e=>{const{position:n,classes:r,hasOppositeContent:o}=e,a={root:["root",`position${F1(n)}`,!o&&"missingOppositeContent"]};return _5(a,Dt,r)},Zt=p("li",{name:"MuiTimelineItem",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:r}=e;return[n.root,n[`position${F1(r.position)}`]]}})(({ownerState:e})=>l1({listStyle:"none",display:"flex",position:"relative",minHeight:70},e.position==="left"&&{flexDirection:"row-reverse"},e.position==="alternate"&&{"&:nth-of-type(even)":{flexDirection:"row-reverse",[`& .${_t.root}`]:{textAlign:"right"},[`& .${At.root}`]:{textAlign:"left"}}},!e.hasOppositeContent&&{"&:before":{content:'""',flex:1,padding:"6px 16px"}})),jt=C.forwardRef(function(n,r){const o=x5({props:n,name:"MuiTimelineItem"}),{position:a,className:i}=o,s=M5(o,Rt),{position:l}=C.useContext(m2);let d=!1;C.Children.forEach(o.children,g=>{w8(g,["TimelineOppositeContent"])&&(d=!0)});const u=l1({},o,{position:a||l||"right",hasOppositeContent:d}),h=Pt(u),f=C.useMemo(()=>({position:u.position}),[u.position]);return t(m2.Provider,{value:f,children:t(Zt,l1({className:V5(h.root,i),ownerState:u,ref:r},s))})}),d2=jt;function Ft(e){return w5("MuiTimelineSeparator",e)}u5("MuiTimelineSeparator",["root"]);const It=["className"],Bt=e=>{const{classes:n}=e;return _5({root:["root"]},Ft,n)},Ot=p("div",{name:"MuiTimelineSeparator",slot:"Root",overridesResolver:(e,n)=>n.root})({display:"flex",flexDirection:"column",flex:0,alignItems:"center"}),$t=C.forwardRef(function(n,r){const o=x5({props:n,name:"MuiTimelineSeparator"}),{className:a}=o,i=M5(o,It),s=o,l=Bt(s);return t(Ot,l1({className:V5(l.root,a),ownerState:s,ref:r},i))}),u2=$t;function zt(e){return w5("MuiTimelineDot",e)}u5("MuiTimelineDot",["root","filled","outlined","filledGrey","outlinedGrey","filledPrimary","outlinedPrimary","filledSecondary","outlinedSecondary"]);const Nt=["className","color","variant"],Wt=e=>{const{color:n,variant:r,classes:o}=e,a={root:["root",r,n!=="inherit"&&`${r}${F1(n)}`]};return _5(a,zt,o)},Ut=p("span",{name:"MuiTimelineDot",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:r}=e;return[n.root,n[r.color!=="inherit"&&`${r.variant}${F1(r.color)}`],n[r.variant]]}})(({ownerState:e,theme:n})=>l1({display:"flex",alignSelf:"baseline",borderStyle:"solid",borderWidth:2,padding:4,borderRadius:"50%",boxShadow:(n.vars||n).shadows[1],margin:"11.5px 0"},e.variant==="filled"&&l1({borderColor:"transparent"},e.color!=="inherit"&&l1({},e.color==="grey"?{color:(n.vars||n).palette.grey[50],backgroundColor:(n.vars||n).palette.grey[400]}:{color:(n.vars||n).palette[e.color].contrastText,backgroundColor:(n.vars||n).palette[e.color].main})),e.variant==="outlined"&&l1({boxShadow:"none",backgroundColor:"transparent"},e.color!=="inherit"&&l1({},e.color==="grey"?{borderColor:(n.vars||n).palette.grey[400]}:{borderColor:(n.vars||n).palette[e.color].main})))),qt=C.forwardRef(function(n,r){const o=x5({props:n,name:"MuiTimelineDot"}),{className:a,color:i="grey",variant:s="filled"}=o,l=M5(o,Nt),d=l1({},o,{color:i,variant:s}),u=Wt(d);return t(Ut,l1({className:V5(u.root,a),ownerState:d,ref:r},l))}),f7=qt;function Gt(e){return w5("MuiTimelineConnector",e)}u5("MuiTimelineConnector",["root"]);const Kt=["className"],Jt=e=>{const{classes:n}=e;return _5({root:["root"]},Gt,n)},Yt=p("span",{name:"MuiTimelineConnector",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>({width:2,backgroundColor:(e.vars||e).palette.grey[400],flexGrow:1})),Qt=C.forwardRef(function(n,r){const o=x5({props:n,name:"MuiTimelineConnector"}),{className:a}=o,i=M5(o,Kt),s=o,l=Jt(s);return t(Yt,l1({className:V5(l.root,a),ownerState:s,ref:r},i))}),y7=Qt,Xt=p(j1)(({theme:e})=>({marginTop:e.spacing(2),borderRadius:`${e.shape.borderRadiusLarge}px`})),en=p(T)(({theme:e})=>({padding:e.spacing(2),marginBottom:`-${e.spacing(4)}`})),tn=p(h7)(()=>({[`& .${m7.root}:before`]:{flex:0,padding:0}})),nn=["Draft","In review","Approved","Applied"],rn=["Draft","In review","Rejected"],on=(e,n,r,o)=>e==="Cancelled"?"grey":e==="Rejected"?r==="Rejected"?"error":"success":n!==-1&&n>=o?"success":n+1===o?"primary":"grey",an=({state:e})=>{const n=e==="Rejected"?rn:nn,r=n.findIndex(o=>o===e);return t(Xt,{elevation:0,children:t(en,{children:t(tn,{children:n.map((o,a)=>{const i=on(e,r,o,a);let s={};return r+1===a&&!(e==="Cancelled"&&o==="Draft")&&(s={variant:"outlined"}),sn(i,o,a<n.length-1,s)})})})})},sn=(e,n,r,o={})=>c(d2,{children:[c(u2,{children:[t(f7,{color:e,...o}),r&&t(y7,{})]}),t(g7,{children:n})]},n),$3=()=>e=>e!=="color"&&e!=="sx"&&e!=="approved"&&e!=="border"&&e!=="bgColor"&&e!=="svgColor",s5=p(T)(({theme:e})=>({display:"flex",alignItems:"center"})),v7=p(T3)(({theme:e})=>({color:e.palette.error.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),x6=p(T3)(({theme:e})=>({color:e.palette.warning.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),l3=p(P4)(({theme:e})=>({color:e.palette.success.main,height:"35px",width:"35px",marginRight:e.spacing(1)})),ln=p(T)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),cn=p(T,{shouldForwardProp:$3()})(({theme:e,bgColor:n,svgColor:r})=>({borderRadius:`${e.shape.borderRadiusMedium}px`,backgroundColor:n,padding:e.spacing(1,2),marginRight:e.spacing(2),height:"45px",width:"45px",display:"flex",alignItems:"center",justifyContent:"center",svg:{color:r}})),b7=p(f3)(({theme:e})=>({margin:e.spacing(2.5,0)})),Cn=p(T,{shouldForwardProp:$3()})(({theme:e,border:n})=>({borderRadius:`${e.shape.borderRadiusLarge}px`,border:n,padding:e.spacing(3),width:"100%"})),l5=p(O,{shouldForwardProp:$3()})(({theme:e,color:n})=>({fontWeight:"bold",color:n})),dn=(e,n)=>e==="Approved"?`2px solid ${n.palette.success.main}`:e==="Applied"?`2px solid ${n.palette.primary.main}`:`1px solid ${n.palette.divider}`,un=(e,n)=>e==="Approved"?{bgColor:n.palette.success.main,svgColor:n.palette.background.paper}:e==="Applied"?{bgColor:n.palette.primary.main,svgColor:n.palette.background.paper}:{bgColor:n.palette.background.elevation2,svgColor:n.palette.neutral.main},pn=({changeRequest:e})=>{const n=u1();return c(ln,{children:[t(cn,{...un(e.state,n),children:t(x8,{style:{transform:"scale(1.5)"}})}),t(Cn,{sx:{backgroundColor:e.state==="In review"?n.palette.warning.light:"initial"},border:dn(e.state,n),children:t(hn,{changeRequest:e})})]})},hn=({changeRequest:e})=>{const{state:n}=e;return n?n==="Approved"?t(gn,{}):n==="Applied"?t(fn,{}):n==="Cancelled"?t(yn,{}):n==="Rejected"?t(vn,{}):t(mn,{minApprovals:e.minApprovals}):null},gn=()=>{const e=u1();return c(G,{children:[c(s5,{children:[t(l3,{}),c(T,{children:[t(l5,{color:e.palette.success.dark,children:"Changes approved"}),t(O,{children:"One approving review from requested approvers"})]})]}),t(b7,{}),c(s5,{children:[t(l3,{}),t(T,{children:t(l5,{color:e.palette.success.dark,children:"Changes are ready to be applied"})})]})]})},mn=({minApprovals:e})=>{const n=u1();return c(G,{children:[c(s5,{children:[t(x6,{}),c(T,{children:[t(l5,{color:n.palette.warning.dark,children:"Review required"}),c(O,{children:["At least ",e," approval(s) must be submitted before changes can be applied"]})]})]}),t(b7,{}),c(s5,{children:[t(x6,{}),t(l5,{color:n.palette.warning.dark,children:"Apply changes is blocked"})]})]})},fn=()=>{const e=u1();return t(G,{children:c(s5,{children:[t(l3,{sx:{color:e.palette.primary.main}}),t(T,{children:t(l5,{color:e.palette.primary.main,children:"Changes applied"})})]})})},yn=()=>{const e=u1();return t(G,{children:c(s5,{children:[t(v7,{}),t(T,{children:t(l5,{color:e.palette.error.main,children:"Changes cancelled"})})]})})},vn=()=>{const e=u1();return t(G,{children:c(s5,{children:[t(v7,{}),t(T,{children:t(l5,{color:e.palette.error.main,children:"Changes rejected"})})]})})};var z3={},bn=O5;Object.defineProperty(z3,"__esModule",{value:!0});var S7=z3.default=void 0,Sn=bn(B5()),wn=$5,xn=(0,Sn.default)((0,wn.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");S7=z3.default=xn;const Vn=({disabled:e,onReject:n,onApprove:r,children:o})=>{const{isAdmin:a}=C.useContext(I1),i=J("projectId"),s=J("id"),{user:l}=Z4(),{data:d}=p7(i,s),[u,h]=a5.useState(!1),f=a5.useRef(null),g=()=>{h(b=>!b)},_=b=>{var L;(L=f.current)!=null&&L.contains(b.target)||h(!1)},H=f.current?f.current.offsetWidth:null;return c(a5.Fragment,{children:[t(H5,{variant:"contained",disabled:e||(d==null?void 0:d.createdBy.id)===(l==null?void 0:l.id)&&!a,"aria-controls":u?"review-options-menu":void 0,"aria-expanded":u?"true":void 0,"aria-label":"review changes","aria-haspopup":"menu",onClick:g,ref:f,endIcon:t(S7,{}),permission:V8,projectId:i,environmentId:d==null?void 0:d.environment,children:o}),t(E4,{sx:{zIndex:1,width:H},open:u,anchorEl:f.current,role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:b,placement:L})=>t(_8,{...b,style:{transformOrigin:L==="bottom"?"center top":"center bottom"},children:t(j1,{className:"dropdown-outline",children:t(M4,{onClickAway:_,children:c(x2,{id:"review-options-menu",autoFocusItem:!0,children:[c(q1,{onClick:r,children:[t(G1,{children:t(T4,{fontSize:"small"})}),t(K1,{children:"Approve changes"})]}),c(q1,{onClick:n,children:[t(G1,{children:t(V9,{fontSize:"small"})}),t(K1,{children:"Reject changes"})]})]})})})})})]})};var w7={},N3={},W3={};Object.defineProperty(W3,"__esModule",{value:!0});var _n=C,Hn=En(_n);function En(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}W3.default=function(e,n,r){return Hn.createElement("a",{href:e,key:r},n)};var U3={};Object.defineProperty(U3,"__esModule",{value:!0});U3.default=function(e){return e};var q3={},N2,V6;function Mn(){return V6||(V6=1,N2=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),N2}var W2,_6;function Tn(){return _6||(_6=1,W2=/[\0-\x1F\x7F-\x9F]/),W2}var U2,H6;function kn(){return H6||(H6=1,U2=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/),U2}var q2,E6;function An(){return E6||(E6=1,q2=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/),q2}var G2,M6;function Dn(){return M6||(M6=1,G2=function(e){var n={};n.src_Any=Mn().source,n.src_Cc=Tn().source,n.src_Z=kn().source,n.src_P=An().source,n.src_ZPCc=[n.src_Z,n.src_P,n.src_Cc].join("|"),n.src_ZCc=[n.src_Z,n.src_Cc].join("|");var r="[><|]";return n.src_pseudo_letter="(?:(?!"+r+"|"+n.src_ZPCc+")"+n.src_Any+")",n.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]?)",n.src_auth="(?:(?:(?!"+n.src_ZCc+"|[@/\\[\\]()]).)+@)?",n.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",n.src_host_terminator="(?=$|"+r+"|"+n.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+n.src_ZPCc+"))",n.src_path="(?:[/?#](?:(?!"+n.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-]).|\\[(?:(?!`+n.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+n.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+n.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+n.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+n.src_ZCc+"|[']).)+\\'|\\'(?="+n.src_pseudo_letter+"|[-]).|\\.{2,4}[a-zA-Z0-9%/]|\\.(?!"+n.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+n.src_ZCc+").|\\!(?!"+n.src_ZCc+"|[!]).|\\?(?!"+n.src_ZCc+"|[?]).)+|\\/)?",n.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',n.src_xn="xn--[a-z0-9\\-]{1,59}",n.src_domain_root="(?:"+n.src_xn+"|"+n.src_pseudo_letter+"{1,63})",n.src_domain="(?:"+n.src_xn+"|(?:"+n.src_pseudo_letter+")|(?:"+n.src_pseudo_letter+"(?:-|"+n.src_pseudo_letter+"){0,61}"+n.src_pseudo_letter+"))",n.src_host="(?:(?:(?:(?:"+n.src_domain+")\\.)*"+n.src_domain+"))",n.tpl_host_fuzzy="(?:"+n.src_ip4+"|(?:(?:(?:"+n.src_domain+")\\.)+(?:%TLDS%)))",n.tpl_host_no_ip_fuzzy="(?:(?:(?:"+n.src_domain+")\\.)+(?:%TLDS%))",n.src_host_strict=n.src_host+n.src_host_terminator,n.tpl_host_fuzzy_strict=n.tpl_host_fuzzy+n.src_host_terminator,n.src_host_port_strict=n.src_host+n.src_port+n.src_host_terminator,n.tpl_host_port_fuzzy_strict=n.tpl_host_fuzzy+n.src_port+n.src_host_terminator,n.tpl_host_port_no_ip_fuzzy_strict=n.tpl_host_no_ip_fuzzy+n.src_port+n.src_host_terminator,n.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+n.src_ZPCc+"|>|$))",n.tpl_email_fuzzy="(^|"+r+'|"|\\(|'+n.src_ZCc+")("+n.src_email_name+"@"+n.tpl_host_fuzzy_strict+")",n.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+n.src_ZPCc+"))((?![$+<=>^`||])"+n.tpl_host_port_fuzzy_strict+n.src_path+")",n.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+n.src_ZPCc+"))((?![$+<=>^`||])"+n.tpl_host_port_no_ip_fuzzy_strict+n.src_path+")",n}),G2}function c3(e){var n=Array.prototype.slice.call(arguments,1);return n.forEach(function(r){r&&Object.keys(r).forEach(function(o){e[o]=r[o]})}),e}function D2(e){return Object.prototype.toString.call(e)}function Ln(e){return D2(e)==="[object String]"}function Rn(e){return D2(e)==="[object Object]"}function Pn(e){return D2(e)==="[object RegExp]"}function T6(e){return D2(e)==="[object Function]"}function Zn(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var x7={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function jn(e){return Object.keys(e||{}).reduce(function(n,r){return n||x7.hasOwnProperty(r)},!1)}var Fn={"http:":{validate:function(e,n,r){var o=e.slice(n);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,n,r){var o=e.slice(n);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)?n>=3&&e[n-3]===":"||n>=3&&e[n-3]==="/"?0:o.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,n,r){var o=e.slice(n);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}}},In="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]",Bn="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function On(e){e.__index__=-1,e.__text_cache__=""}function $n(e){return function(n,r){var o=n.slice(r);return e.test(o)?o.match(e)[0].length:0}}function k6(){return function(e,n){n.normalize(e)}}function f2(e){var n=e.re=Dn()(e.__opts__),r=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||r.push(In),r.push(n.src_xn),n.src_tlds=r.join("|");function o(l){return l.replace("%TLDS%",n.src_tlds)}n.email_fuzzy=RegExp(o(n.tpl_email_fuzzy),"i"),n.link_fuzzy=RegExp(o(n.tpl_link_fuzzy),"i"),n.link_no_ip_fuzzy=RegExp(o(n.tpl_link_no_ip_fuzzy),"i"),n.host_fuzzy_test=RegExp(o(n.tpl_host_fuzzy_test),"i");var a=[];e.__compiled__={};function i(l,d){throw new Error('(LinkifyIt) Invalid schema "'+l+'": '+d)}Object.keys(e.__schemas__).forEach(function(l){var d=e.__schemas__[l];if(d!==null){var u={validate:null,link:null};if(e.__compiled__[l]=u,Rn(d)){Pn(d.validate)?u.validate=$n(d.validate):T6(d.validate)?u.validate=d.validate:i(l,d),T6(d.normalize)?u.normalize=d.normalize:d.normalize?i(l,d):u.normalize=k6();return}if(Ln(d)){a.push(l);return}i(l,d)}}),a.forEach(function(l){e.__compiled__[e.__schemas__[l]]&&(e.__compiled__[l].validate=e.__compiled__[e.__schemas__[l]].validate,e.__compiled__[l].normalize=e.__compiled__[e.__schemas__[l]].normalize)}),e.__compiled__[""]={validate:null,normalize:k6()};var s=Object.keys(e.__compiled__).filter(function(l){return l.length>0&&e.__compiled__[l]}).map(Zn).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+n.src_ZPCc+"))("+s+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+n.src_ZPCc+"))("+s+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),On(e)}function zn(e,n){var r=e.__index__,o=e.__last_index__,a=e.__text_cache__.slice(r,o);this.schema=e.__schema__.toLowerCase(),this.index=r+n,this.lastIndex=o+n,this.raw=a,this.text=a,this.url=a}function A6(e,n){var r=new zn(e,n);return e.__compiled__[r.schema].normalize(r,e),r}function E1(e,n){if(!(this instanceof E1))return new E1(e,n);n||jn(e)&&(n=e,e={}),this.__opts__=c3({},x7,n),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=c3({},Fn,e),this.__compiled__={},this.__tlds__=Bn,this.__tlds_replaced__=!1,this.re={},f2(this)}E1.prototype.add=function(n,r){return this.__schemas__[n]=r,f2(this),this};E1.prototype.set=function(n){return this.__opts__=c3(this.__opts__,n),this};E1.prototype.test=function(n){if(this.__text_cache__=n,this.__index__=-1,!n.length)return!1;var r,o,a,i,s,l,d,u,h;if(this.re.schema_test.test(n)){for(d=this.re.schema_search,d.lastIndex=0;(r=d.exec(n))!==null;)if(i=this.testSchemaAt(n,r[2],d.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:"]&&(u=n.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u<this.__index__)&&(o=n.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=n.indexOf("@"),h>=0&&(a=n.match(this.re.email_fuzzy))!==null&&(s=a.index+a[1].length,l=a.index+a[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&l>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=l))),this.__index__>=0};E1.prototype.pretest=function(n){return this.re.pretest.test(n)};E1.prototype.testSchemaAt=function(n,r,o){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(n,o,this):0};E1.prototype.match=function(n){var r=0,o=[];this.__index__>=0&&this.__text_cache__===n&&(o.push(A6(this,r)),r=this.__last_index__);for(var a=r?n.slice(r):n;this.test(a);)o.push(A6(this,r)),a=a.slice(this.__last_index__),r+=this.__last_index__;return o.length?o:null};E1.prototype.tlds=function(n,r){return n=Array.isArray(n)?n:[n],r?(this.__tlds__=this.__tlds__.concat(n).sort().filter(function(o,a,i){return o!==i[a-1]}).reverse(),f2(this),this):(this.__tlds__=n.slice(),this.__tlds_replaced__=!0,f2(this),this)};E1.prototype.normalize=function(n){n.schema||(n.url="http://"+n.url),n.schema==="mailto:"&&!/^mailto:/i.test(n.url)&&(n.url="mailto:"+n.url)};E1.prototype.onCompile=function(){};var Nn=E1;const Wn=["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(q3,"__esModule",{value:!0});var Un=Nn,qn=V7(Un),Gn=Wn,Kn=V7(Gn);function V7(e){return e&&e.__esModule?e:{default:e}}var _7=new qn.default;_7.tlds(Kn.default);q3.default=function(e){return _7.match(e)};var G3={};Object.defineProperty(G3,"__esModule",{value:!0});G3.default=function(e){return e};Object.defineProperty(N3,"__esModule",{value:!0});var Jn=function(){function e(n,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(n,a.key,a)}}return function(n,r,o){return r&&e(n.prototype,r),o&&e(n,o),n}}(),Yn=C,D5=ir(Yn),Qn=W3,Xn=L2(Qn),er=U3,tr=L2(er),nr=q3,rr=L2(nr),or=G3,ar=L2(or);function L2(e){return e&&e.__esModule?e:{default:e}}function ir(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}function sr(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function lr(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n&&(typeof n=="object"||typeof n=="function")?n:e}function cr(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}var H7=function(e){cr(n,e);function n(){return sr(this,n),lr(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return Jn(n,[{key:"parseString",value:function(o){var a=this;if(o==="")return o;var i=this.props.matchDecorator(o);if(!i)return o;var s=[],l=0;return i.forEach(function(d,u){d.index>l&&s.push(o.substring(l,d.index));var h=a.props.hrefDecorator(d.url),f=a.props.textDecorator(d.text),g=a.props.componentDecorator(h,f,u);s.push(g),l=d.lastIndex}),o.length>l&&s.push(o.substring(l)),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):D5.isValidElement(o)&&o.type!=="a"&&o.type!=="button"?D5.cloneElement(o,{key:i},this.parse(o.props.children)):Array.isArray(o)?o.map(function(s,l){return a.parse(s,l)}):o}},{key:"render",value:function(){return D5.createElement(D5.Fragment,null,this.parse(this.props.children))}}]),n}(D5.Component);H7.defaultProps={componentDecorator:Xn.default,hrefDecorator:tr.default,matchDecorator:rr.default,textDecorator:ar.default};N3.default=H7;Object.defineProperty(w7,"__esModule",{value:!0});var Cr=N3,dr=ur(Cr);function ur(e){return e&&e.__esModule?e:{default:e}}var pr=w7.default=dr.default;const hr=p(T)(({theme:e})=>({display:"flex",marginTop:e.spacing(2)})),gr=p(j1)(({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})),mr=p(T)(({theme:e})=>({display:"flex",borderBottom:"1px solid",borderColor:e.palette.divider,paddingBottom:e.spacing(1.5)})),fr=({comment:e})=>c(hr,{children:[t(w1,{title:e.createdBy.username,children:t(H8,{src:e.createdBy.imageUrl})}),c(gr,{variant:"outlined",children:[t(mr,{children:c(T,{children:[t("strong",{children:e.createdBy.username})," ",c(O,{color:"text.secondary",component:"span",children:["commented"," ",t(M3,{minPeriod:60,date:new Date(e.createdAt)})]})]})}),t(T,{sx:{paddingTop:2.5},children:t(pr,{children:e.text})})]})]}),E7=p(T)(({theme:e})=>({display:"flex",alignItems:"center",flexWrap:"wrap",marginTop:e.spacing(1.5),gap:e.spacing(1)})),yr=p(P4)(({theme:e})=>({color:e.palette.success.main,marginLeft:"auto"})),vr=p(T3)(({theme:e})=>({color:e.palette.error.main,marginLeft:"auto"})),M7=p(O)({maxWidth:"170px",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"text.primary"}),br=({name:e,imageUrl:n})=>c(E7,{children:[t(O3,{src:n}),t(M7,{variant:"body1",children:e}),t(yr,{})]}),Sr=({name:e,imageUrl:n})=>c(E7,{children:[t(O3,{src:n}),t(M7,{variant:"body1",children:e}),t(vr,{})]}),wr=({rejections:e=[]})=>c(G,{children:[t(O,{variant:"body1",color:"text.secondary",children:"Rejected by"}),e.map(n=>t(Sr,{name:n.createdBy.username||"Unknown user",imageUrl:n.createdBy.imageUrl},n.createdBy.username))]}),xr=({approvals:e=[]})=>c(G,{children:[t(O,{variant:"body1",color:"text.secondary",children:t(M,{condition:(e==null?void 0:e.length)>0,show:"Approved by",elseShow:"No approvals yet"})}),e.map(n=>t(br,{name:n.createdBy.username||"Unknown user",imageUrl:n.createdBy.imageUrl},n.createdBy.username))]}),Vr=p(T)(({theme:e})=>({marginBottom:e.spacing(2)})),_r=({actualApprovals:e,minApprovals:n})=>c(G,{children:["Reviewers"," ",c(O,{component:"span",color:"text.secondary",children:["(",e,"/",n," required)"]})]}),Hr=({header:e,children:n})=>c(j1,{elevation:0,sx:r=>({marginTop:r.spacing(2),padding:r.spacing(4),borderRadius:o=>`${o.shape.borderRadiusLarge}px`}),children:[t(Vr,{children:e}),n]}),Er=({changeRequest:e})=>t(Hr,{header:t(_r,{actualApprovals:e.approvals.length,minApprovals:e.minApprovals}),children:t(M,{condition:e.state==="Rejected",show:t(wr,{rejections:e.rejections}),elseShow:t(xr,{approvals:e.approvals})})}),Mr=({open:e,onConfirm:n,onClose:r})=>{const[o,a]=C.useState("");return c(Q1,{open:e,primaryButtonText:"Reject changes",secondaryButtonText:"Cancel",onClick:()=>n(o),onClose:r,title:"Reject changes",fullWidth:!0,children:[t(T,{children:"Add an optional comment why you reject those changes"}),t(K5,{sx:{mt:1},variant:"outlined",placeholder:"Add your comment here",fullWidth:!0,multiline:!0,minRows:2,onChange:i=>a(i.target.value),value:o})]})},Tr=p(T)(({theme:e})=>({width:"30%",display:"flex",flexDirection:"column",[e.breakpoints.down("sm")]:{width:"100%"}})),kr=p(j1)(({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%"}})),Ar=p(T)(({theme:e})=>({marginTop:e.spacing(3),display:"flex",justifyContent:"flex-end"})),Dr=p(T)(({theme:e})=>({padding:e.spacing(2)})),Lr=p(T)(({theme:e})=>({display:"flex",[e.breakpoints.down("sm")]:{flexDirection:"column"}})),Rr=()=>{var x;const e=J("projectId"),[n,r]=C.useState(!1),[o,a]=C.useState(!1),{user:i}=Z4(),{isAdmin:s}=C.useContext(I1),[l,d]=C.useState(""),u=J("id"),{data:h,refetchChangeRequest:f}=p7(e,u),{changeState:g,addComment:_,loading:H}=E2(),{refetch:b}=M2(e),{setToastData:L,setToastApiError:v}=d1(),{isChangeRequestConfiguredForReview:w}=S5(e);if(!h)return null;const k=w(h.environment),R=async()=>{try{await g(e,Number(u),{state:"Applied"}),f(),b(),L({type:"success",title:"Success",text:"Changes applied"})}catch(A){v(s1(A))}},z=async()=>{try{await _(e,u,l),d(""),f(),L({type:"success",title:"Success",text:"Comment added"})}catch(A){v(s1(A))}},V=async()=>{try{await g(e,Number(u),{state:"Cancelled"}),r(!1),f(),b(),L({type:"success",title:"Success",text:"Changes cancelled"})}catch(A){v(s1(A))}},B=async A=>{try{await g(e,Number(u),{state:"Rejected",comment:A}),a(!1),f(),b(),L({type:"success",title:"Success",text:"Changes rejected"})}catch(j){v(s1(j))}},P=async()=>{try{await g(e,Number(u),{state:"Approved"}),f(),b(),L({type:"success",title:"Success",text:"Changes approved"})}catch(A){v(s1(A))}},$=()=>r(!0),Z=()=>r(!1),F=()=>a(!1),U=(h==null?void 0:h.createdBy.id)===(i==null?void 0:i.id)&&h.state==="In review"&&!s,q=h.approvals.some(A=>A.createdBy.id===(i==null?void 0:i.id)),S=E8(h);return c(G,{children:[t(ft,{changeRequest:h}),c(Lr,{children:[c(Tr,{children:[t(an,{state:h.state}),t(Er,{changeRequest:h})]}),t(kr,{elevation:0,children:c(Dr,{children:["Requested Changes (",S,")",t(M8,{changeRequest:h,onRefetch:f}),(x=h.comments)==null?void 0:x.map(A=>t(fr,{comment:A},A.id)),t(T8,{user:i,commentText:l,onTypeComment:d,children:t(C1,{variant:"outlined",onClick:z,disabled:!k||l.trim().length===0||l.trim().length>1e3,children:"Comment"})}),t(M,{condition:U,show:t(x1,{sx:A=>({marginTop:A.spacing(1.5)}),severity:"info",children:"You can not approve your own change request"})}),t(pn,{changeRequest:h}),c(Ar,{children:[t(M,{condition:h.state==="In review"&&!q,show:c(Vn,{onReject:()=>a(!0),onApprove:P,disabled:!k,children:["Review changes (",S,")"]})}),t(M,{condition:h.state==="Approved",show:t(H5,{variant:"contained",onClick:R,projectId:e,permission:k8,environmentId:h.environment,disabled:!k||H,children:"Apply changes"})}),t(M,{condition:h.state!=="Applied"&&h.state!=="Rejected"&&h.state!=="Cancelled"&&(h.createdBy.id===(i==null?void 0:i.id)||s),show:t(C1,{sx:{marginLeft:A=>A.spacing(2)},variant:"outlined",onClick:$,children:"Cancel changes"})})]})]})}),c(Q1,{open:n,onClick:V,onClose:Z,title:"Cancel change request",children:[t(O,{sx:{marginBottom:2},children:"You are about to cancel this change request"}),t(O,{variant:"body2",sx:A=>({color:A.palette.neutral.dark}),children:"The change request will be moved to closed, and it can't be applied anymore. Once cancelled, the change request can't be reopened."})]}),t(Mr,{open:o,onConfirm:B,onClose:F})]})]})},Pr=({value:e})=>{const n=()=>e?t(R4,{state:e}):null;return e?t(h1,{children:n()}):t(h1,{})},Zr=p("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",margin:0})),jr=({value:e})=>{const{searchQuery:n}=k3();return t(h1,{children:t(Zr,{children:c(O,{component:"span",variant:"body2",children:[" ",t(h2,{search:n,children:e==null?void 0:e.username})]})})})},Fr=p("div")(({theme:e})=>({display:"flex",flexDirection:"row",margin:0})),Ir=({value:e,row:{original:n}})=>{const{searchQuery:r}=k3(),o=J("projectId"),{id:a,title:i,features:s,segments:l}=n,d=(s||[]).length+(l||[]).length,u=`/projects/${o}/change-requests/${a}`;return e?c(h1,{sx:{minWidth:"200px"},children:[t(Fr,{children:t(O,{variant:"body2",children:t(y3,{component:T1,underline:"hover",to:u,sx:h=>({paddingTop:h.spacing(.2),marginRight:h.spacing(1),"&:hover":{textDecoration:"underline"}}),children:t(h2,{search:r,children:i})})})}),c("span",{children:[`${d}`," ",d<=1?"update":"updates"]})]}):t(h1,{})},Br=u4()(e=>({header:{padding:e.spacing(0,4)},bodyClass:{padding:e.spacing(2,4,4,4),overflowX:"auto"}})),Or=p(T)(({theme:e})=>({display:"flex",flexDirection:"column",width:"300px",padding:e.spacing(1,0,1,2)})),$r=p(T1)(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),zr=p(T1)(({theme:e})=>({textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),Nr=p(T)(({theme:e})=>({display:"flex",flexDirection:"column",fontSize:e.fontSizes.smallBody,width:"100%",whiteSpace:"nowrap"})),Wr=({value:e,project:n})=>{const{searchQuery:r}=k3(),o=e==null?void 0:e.map(a=>a.name);return t(Or,{children:t(M,{condition:(o==null?void 0:o.length)<3,show:o==null?void 0:o.map(a=>t($r,{title:a,to:`/projects/${n}/features/${a}`,children:t(h2,{search:r,children:a})})),elseShow:c(A8,{tooltipProps:{maxWidth:"800px"},tooltip:t(Nr,{children:o==null?void 0:o.map(a=>t(zr,{title:a,to:`/projects/${n}/features/${a}`,children:t(h2,{search:r,children:a})}))}),children:[o==null?void 0:o.length," toggles"]})})})},Ur={id:"createdAt"},qr=p("div")({paddingLeft:0,paddingBottom:0}),Gr=p(p2)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,[e.breakpoints.up("md")]:{minWidth:160}})),Kr=p(T)(({theme:e})=>({textAlign:"right",paddingBottom:e.spacing(2),fontSize:e.fontSizes.smallBody})),Jr=({changeRequests:e=[],loading:n,projectId:r})=>{var q,S;const{classes:o}=Br(),a=m1(j4.breakpoints.down("md")),[i,s]=T2(),[l,d]=C.useState(i.get("search")||""),{value:u,setValue:h}=b5(`${r}:ProjectChangeRequest`,Ur),[f,g]=C.useMemo(()=>{const x=e.filter(j=>j.state!=="Cancelled"&&j.state!=="Rejected"&&j.state!=="Applied"),A=e.filter(j=>j.state==="Cancelled"||j.state==="Rejected"||j.state==="Applied");return[x,A]},[e]),_=[{title:"Change requests",data:f},{title:"Closed",data:g}],[H,b]=C.useState(0),L=C.useMemo(()=>[{id:"Title",Header:"Title",width:100,canSort:!0,accessor:"title",searchable:!0,Cell:Ir},{id:"Updated feature toggles",Header:"Updated feature toggles",canSort:!1,accessor:"features",searchable:!0,filterName:"feature",filterParsing:x=>(x==null?void 0:x.map(({name:A})=>A).join(`
|
|
4
4
|
`))||"",filterBy:(x,A)=>x.features.find(j=>A.map(W=>W.toLowerCase()).includes(j.name.toLowerCase())),Cell:({value:x,row:{original:{title:A}}})=>t(Wr,{project:r,value:x},A)},{Header:"By",accessor:"createdBy",maxWidth:180,canSort:!1,Cell:jr,align:"left",searchable:!0,filterName:"by",filterParsing:x=>(x==null?void 0:x.username)||""},{Header:"Submitted",accessor:"createdAt",maxWidth:100,Cell:g2,sortType:"alphanumeric"},{Header:"Environment",accessor:"environment",searchable:!0,maxWidth:100,Cell:S2,filterName:"environment"},{Header:"Status",accessor:"state",searchable:!0,maxWidth:"170px",Cell:Pr,filterName:"status"}],[r]),{data:v,getSearchText:w,getSearchContext:k}=W5(L,l,(q=_[H])==null?void 0:q.data),R=C.useMemo(()=>n?D8:v,[v,n]),[z]=C.useState(()=>({sortBy:[{id:i.get("sort")||u.id,desc:i.has("order")?i.get("order")==="desc":u.desc}],hiddenColumns:[]})),{headerGroups:V,rows:B,state:{sortBy:P},prepareRow:$,setHiddenColumns:Z,getTableProps:F,getTableBodyProps:U}=X.useTable({columns:L,data:R,initialState:z,sortTypes:q5,autoResetHiddenColumns:!1,disableSortRemove:!0,autoResetSortBy:!1,defaultColumn:{Cell:h1}},X.useSortBy);return G5([{condition:a,columns:["createdBy"]}],Z,L),C.useEffect(()=>{if(n)return;const x={};x.sort=P[0].id,P[0].desc&&(x.order="desc"),l&&(x.search=l),s(x,{replace:!0}),h(A=>({...A,id:P[0].id,desc:P[0].desc||!1}))},[n,P,l,s]),c(i1,{isLoading:n,bodyClass:o.bodyClass,headerClass:o.header,header:t(n1,{titleElement:t(qr,{children:t(A3,{value:(S=_[H])==null?void 0:S.title,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:_.map((x,A)=>t(Gr,{label:`${x.title} (${x.data.length})`,value:x.title,onClick:()=>b(A)},x.title))})}),actions:t(H1,{placeholder:"Search and Filter",expandable:!0,initialValue:l,onChange:d,hasFilters:!0,getSearchContext:k,id:"changeRequestList"})}),children:[t(Kr,{children:t(T1,{to:`/projects/${r}/settings/change-requests`,children:"Change request configuration"})}),t(d5,{value:w(l),children:c(P5,{...F(),children:[t(Z5,{headerGroups:V}),t(j5,{...U(),children:B.map(x=>($(x),t(F5,{hover:!0,...x.getRowProps(),children:x.cells.map(A=>t(I5,{...A.getCellProps(),padding:"none",children:A.render("Cell")}))})))})]})}),t(M,{condition:B.length===0,show:()=>t(M,{condition:(l==null?void 0:l.length)>0,show:c(f1,{children:["No changes found matching “",l,"”"]}),elseShow:t(f1,{children:"None of the changes were submitted yet."})})})]})},Yr=()=>{const e=J("projectId"),n=k1(e),{isOss:r,isPro:o}=o1();M1(`Change requests – ${n}`);const{changeRequests:a,loading:i}=C7(e);return r()||o()?t(i1,{sx:{justifyContent:"center"},children:t(J5,{feature:"change-requests"})}):t(Jr,{changeRequests:a,projectId:e,loading:i})};var Q=(e=>(e.USER="USERS",e.GROUP="GROUPS",e.SERVICE_ACCOUNT="SERVICE ACCOUNTS",e))(Q||{});const e2=(e,n={})=>{const r=X1(`api/admin/projects/${e}/access`),o=()=>fetch(r,{method:"GET"}).then(e5("project access")).then(f=>f.json()),a=`api/admin/projects/${e}/users`,{data:i,error:s}=c5(a,o,n),[l,d]=C.useState(!s&&!i),u=()=>{E3(a)};return C.useEffect(()=>{d(!s&&!i)},[i,s]),{access:C.useMemo(()=>{if(i)return Qr({roles:i.roles,users:i.users.filter(({accountType:f})=>!f||f==="User"),serviceAccounts:i.users.filter(({accountType:f})=>f==="Service Account"),groups:(i==null?void 0:i.groups.map(f=>({...f,users:_9(f.users??[])})))??[]})},[i]),error:s,loading:l,refetchProjectAccess:u}},Qr=e=>{const n=e.users||[],r=e.serviceAccounts||[],o=e.groups||[];return{...e,rows:[...n.map(a=>({entity:a,type:"USERS"})),...r.map(a=>({entity:a,type:"SERVICE ACCOUNTS"})),...o.map(a=>({entity:a,type:"GROUPS"}))]}},Xr=p(i1)(({theme:e})=>({height:"100vh",overflow:"auto",padding:e.spacing(7.5,6),[e.breakpoints.down("md")]:{padding:e.spacing(4,2)},"& .header":{padding:e.spacing(0,0,2,0)},"& .body":{padding:e.spacing(3,0,0,0)},borderRadius:`${e.spacing(1.5,0,0,1.5)} !important`})),eo=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span":{display:"flex",alignItems:"center",color:e.palette.text.secondary,fontSize:e.fontSizes.bodySize}})),D6={id:"joinedAt"},K2=[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:e}})=>t(h1,{children:t(L3,{user:e})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:e=>e.name||"",Cell:({value:e,row:{original:n}})=>t(S2,{value:e,subtitle:n.email||n.username}),minWidth:100,searchable:!0},{id:"joined",Header:"Joined",accessor:"joinedAt",Cell:N5,sortType:"date",maxWidth:150},{id:"lastLogin",Header:"Last login",accessor:e=>e.seenAt||"",Cell:({row:{original:e}})=>t(g2,{value:e.seenAt,emptyText:"Never",title:n=>`Last login: ${n}`}),sortType:"date",maxWidth:150},{accessor:e=>e.username||"",Header:"Username",searchable:!0},{accessor:e=>e.email||"",Header:"Email",searchable:!0}],to=["imageUrl","name","joined","lastLogin"],no=({open:e,setOpen:n,group:r,projectId:o,subtitle:a,onEdit:i,onRemove:s})=>{const l=u1(),d=m1(l.breakpoints.down("md")),[u]=C.useState(()=>({sortBy:[{id:D6.id,desc:D6.desc}],hiddenColumns:["Username","Email"]})),[h,f]=C.useState(""),{data:g,getSearchText:_,getSearchContext:H}=W5(K2,h,(r==null?void 0:r.users)??[]),{headerGroups:b,rows:L,prepareRow:v,setHiddenColumns:w}=X.useTable({columns:K2,data:g,initialState:u,sortTypes:q5,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},X.useSortBy,X.useFlexLayout);return G5([{condition:d,columns:to}],w,K2),t(i5,{open:e,onClose:()=>{n(!1)},label:(r==null?void 0:r.name)||"Group",children:c(Xr,{header:t(n1,{secondary:!0,titleElement:c(eo,{children:[r==null?void 0:r.name," (",L.length<g.length?`${L.length} of ${g.length}`:g.length,")",t("span",{children:a})]}),actions:c(G,{children:[t(M,{condition:!d,show:c(G,{children:[t(H1,{initialValue:h,onChange:f,hasFilters:!0,getSearchContext:H}),t(n1.Divider,{})]})}),t(y5,{permission:S1,projectId:o,tooltipProps:{title:"Edit group access"},onClick:i,children:t(D3,{})}),t(y5,{permission:S1,projectId:o,tooltipProps:{title:"Remove group access"},onClick:s,children:t(F4,{})})]}),children:t(M,{condition:d,show:t(H1,{initialValue:h,onChange:f,hasFilters:!0,getSearchContext:H})})}),children:[t(d5,{value:_(h),children:t(U5,{rows:L,headerGroups:b,prepareRow:v})}),t(M,{condition:L.length===0,show:t(M,{condition:(h==null?void 0:h.length)>0,show:c(f1,{children:["No users found matching “",h,"” in this group."]}),elseShow:t(f1,{children:"This group is empty. Get started by adding a user to the group."})})})]})})},ro=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),oo=({roles:e,value:n,setValue:r,required:o,...a})=>c(G,{children:[t(I4,{multiple:!0,disableCloseOnSelect:!0,openOnFocus:!0,size:"small",value:n,onChange:(s,l)=>r(l),options:e,renderOption:(s,l,d)=>c("li",{...s,children:[t(z5,{icon:t(B4,{fontSize:"small"}),checkedIcon:t(O4,{fontSize:"small"}),style:{marginRight:8},checked:d.selected}),c(ro,{children:[t("span",{children:l.name}),t("span",{children:l.description})]})]}),getOptionLabel:s=>s.name,renderInput:s=>t(K5,{...s,label:"Role",required:o}),...a}),t(M,{condition:n.length>0,show:()=>n.map(({id:s})=>t(L8,{sx:{marginTop:1},roleId:s},s))})]}),ao=p("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),L6=p("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),R6=p("div")(({theme:e})=>({"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)}})),io=p("div")(({theme:e})=>({marginTop:e.spacing(6),display:"flex",justifyContent:"flex-end"})),so=p(C1)(({theme:e})=>({marginLeft:e.spacing(3)})),lo=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{color:e.palette.text.secondary}})),co=p("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:e.palette.text.secondary}})),K3=({selected:e,accesses:n,users:r,serviceAccounts:o,groups:a,roles:i})=>{const{uiConfig:s}=o1(),{flags:l}=s,d=l.UG?"user / group":"user",u=J("projectId"),{refetchProjectAccess:h}=e2(u),{addAccessToProject:f,setUserRoles:g,setGroupRoles:_,loading:H}=C5(),b=!!e,{setToastData:L,setToastApiError:v}=d1(),w=A1(),k=[...a.filter(S=>b||!n.some(({entity:{id:x},type:A})=>S.id===x&&A===Q.GROUP)).map(S=>({id:S.id,entity:S,type:Q.GROUP})),...r.filter(S=>b||!n.some(({entity:{id:x},type:A})=>S.id===x&&A===Q.USER)).sort((S,x)=>{const A=S.name||S.username||"",j=x.name||x.username||"";return A.localeCompare(j)}).map(S=>({id:S.id,entity:S,type:Q.USER})),...o.filter(S=>b||!n.some(({entity:{id:x},type:A})=>S.id===x&&A===Q.SERVICE_ACCOUNT)).sort((S,x)=>{const A=S.name||S.username||"",j=x.name||x.username||"";return A.localeCompare(j)}).map(S=>({id:S.id,entity:S,type:Q.SERVICE_ACCOUNT}))],[R,z]=C.useState(()=>k.filter(({id:S,type:x})=>S===(e==null?void 0:e.entity.id)&&x===(e==null?void 0:e.type))),[V,B]=C.useState(i.filter(({id:S})=>{var x,A;return(A=(x=e==null?void 0:e.entity)==null?void 0:x.roles)==null?void 0:A.includes(S)})),P={roles:V.map(({id:S})=>S),groups:R==null?void 0:R.filter(({type:S})=>S===Q.GROUP).map(({id:S})=>S),users:R==null?void 0:R.filter(({type:S})=>S===Q.USER||S===Q.SERVICE_ACCOUNT).map(({id:S})=>S)},$=async S=>{if(S.preventDefault(),!!q)try{b?(e==null?void 0:e.type)===Q.USER||(e==null?void 0:e.type)===Q.SERVICE_ACCOUNT?await g(u,V.map(({id:x})=>x),e.entity.id):(e==null?void 0:e.type)===Q.GROUP&&await _(u,V.map(({id:x})=>x),e.entity.id):await f(u,P),h(),w(J1),L({title:`${R.length} ${R.length===1?"access":"accesses"} ${b?"edited":"assigned"} successfully`,type:"success"})}catch(x){v(s1(x))}},Z=()=>b?`curl --location --request PUT '${s.unleashUrl}/api/admin/projects/${u}/${(e==null?void 0:e.type)===Q.USER||(e==null?void 0:e.type)===Q.SERVICE_ACCOUNT?"users":"groups"}/${e==null?void 0:e.entity.id}/roles' \\
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{gs as E4,gt as lc,gu as cc,gv as C4,gw as S4,gx as A4,cm as i1,s as b2,r as Wh,j as Po,c1 as L4,gy as B4,gz as D4,C as I4,L as M4,gA as N4,gB as R4}from"./index-
|
|
1
|
+
import{gs as E4,gt as lc,gu as cc,gv as C4,gw as S4,gx as A4,cm as i1,s as b2,r as Wh,j as Po,c1 as L4,gy as B4,gz as D4,C as I4,L as M4,gA as N4,gB as R4}from"./index-97019f83.js";import{u as O4,a as _2}from"./unknownify-470ee1ff.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-
|
|
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-44f11932.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-6cd8c6b1.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-9154286a.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{bP as k,b as v,r as d,c1 as w,j as s,C as P,L as S,gr as u}from"./index-
|
|
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{bP as k,b as v,r as d,c1 as w,j as s,C as P,L as S,gr as u}from"./index-97019f83.js";import{u as T,a as g}from"./unknownify-470ee1ff.js";import{L as I,C as L,a as M,b as A,P as N,c as R,T as q,p as _,e as D,f as E}from"./chartjs-adapter-date-fns.esm-9887b8bf.js";import{B as j}from"./RoleCell-900af983.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"],H=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),W=(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 ${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 z=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new $([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:H(h,x=>parseFloat(x)),elements:{point:{radius:4,pointStyle:m[y%m.length]},line:{borderDash:[8,4]}}}})}return[]},Q=()=>{const{locationSettings:t}=k(),{metrics:e}=T(),r=v(),i=d.useMemo(()=>W(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:z(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"})})})})};L.register(M,A,N,R,q,_,D,E);export{Q as NetworkTraffic,Q as default};
|