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