unleash-server 7.2.1 → 7.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/frontend/build/index.html +1 -1
  2. package/frontend/build/static/{AdvancedPlayground-CUkOz1YF.js → AdvancedPlayground-D2Y0O_LK.js} +1 -1
  3. package/frontend/build/static/{BackendConnections-Bi1Fsohi.js → BackendConnections-C9HcQ9To.js} +1 -1
  4. package/frontend/build/static/{ChartItem-Ci-KFL7s.js → ChartItem-COMyVdgD.js} +1 -1
  5. package/frontend/build/static/{CreateProject-COHPsP3X.js → CreateProject-jRfRrbUO.js} +1 -1
  6. package/frontend/build/static/{FeatureMetricsChart-ClbKeGOa.js → FeatureMetricsChart-CQkGp91T.js} +1 -1
  7. package/frontend/build/static/{FeatureStaleDialog-DZvKjxPB.js → FeatureStaleDialog-DKeGFuL1.js} +1 -1
  8. package/frontend/build/static/{FeatureViewLazyExport-yCIrczZt.js → FeatureViewLazyExport-CgntSCvS.js} +2 -2
  9. package/frontend/build/static/{FlagMetricsChart-D0GI-ltv.js → FlagMetricsChart-oDTQTkxU.js} +1 -1
  10. package/frontend/build/static/{FrontendNetworkTrafficUsage-DlRkx8CV.js → FrontendNetworkTrafficUsage-E4pIeMFQ.js} +1 -1
  11. package/frontend/build/static/{ImpactMetricsPage-BYcbHNWC.js → ImpactMetricsPage-B3STis_H.js} +1 -1
  12. package/frontend/build/static/{LazyAdminExport-BjSYZTvt.js → LazyAdminExport-CsCsRIwk.js} +2 -2
  13. package/frontend/build/static/{LazyProjectExport-9mNkV9Jq.js → LazyProjectExport-DkN0UegC.js} +2 -2
  14. package/frontend/build/static/{LifecycleChartComponent-BigwXcU3.js → LifecycleChartComponent-Dz1wdYkW.js} +1 -1
  15. package/frontend/build/static/{LineChartComponent-CPcDsiNa.js → LineChartComponent-DG1LdcL_.js} +1 -1
  16. package/frontend/build/static/{MarkCompletedDialogue-CS-kM4vW.js → MarkCompletedDialogue-Bw9Iccid.js} +1 -1
  17. package/frontend/build/static/{NetworkConnectedEdges-C2nfTRKM.js → NetworkConnectedEdges-HU923-QZ.js} +1 -1
  18. package/frontend/build/static/{NetworkOverview-BKozpi8w.js → NetworkOverview-_igGCPCJ.js} +1 -1
  19. package/frontend/build/static/{NetworkPrometheusAPIWarning-wqCXwcem.js → NetworkPrometheusAPIWarning-BS9PGbzI.js} +1 -1
  20. package/frontend/build/static/{NetworkTraffic-Co7oakIE.js → NetworkTraffic-BpNEMFBl.js} +1 -1
  21. package/frontend/build/static/{NetworkTrafficUsage-DNDJZGXi.js → NetworkTrafficUsage-bSUVPjoc.js} +1 -1
  22. package/frontend/build/static/{ReactJSONEditor-BDMT4-_1.js → ReactJSONEditor-DZ9l5V9S.js} +1 -1
  23. package/frontend/build/static/{RoleCell-COtuTPWk.js → RoleCell-C-hJFmul.js} +1 -1
  24. package/frontend/build/static/{aggregateFeatureMetrics-ClblY5Ev.js → aggregateFeatureMetrics-Dli6i5No.js} +1 -1
  25. package/frontend/build/static/{formatTickValue-DojfJagm.js → formatTickValue-D3KZyzeb.js} +1 -1
  26. package/frontend/build/static/{index-CqYZiU1N.js → index-A5We7bvX.js} +9 -9
  27. package/frontend/build/static/{networkTrafficUsageHighlightPlugin-BMMmh5e_.js → networkTrafficUsageHighlightPlugin-DLE_BBMN.js} +1 -1
  28. package/frontend/build/static/{useApiTokens-B6vbGXUF.js → useApiTokens-DNIDLJlc.js} +1 -1
  29. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- var nd=Object.defineProperty;var ad=(e,t,n)=>t in e?nd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t,n)=>ad(e,typeof t!="symbol"?t+"":t,n);import{fB as rd,fC as id,fD as Le,r as h,s as u,fE as cd,di as p2,G as Q1,H as J1,j as a,B as D,e as $1,y as Y1,D as E1,a_ as Ir,J as D0,a$ as $0,M as re,fF as f3,b0 as ue,d as R3,fG as Xi,b2 as ie,T as I,fH as he,dn as E2,L as g1,cQ as Z2,bi as I2,dg as ec,aq as M2,E as V3,m as T0,K as A2,dt as $e,fI as sd,aE as Pe,fJ as od,fK as ld,as as T1,i as a1,fL as dd,fM as ud,fN as Ge,fO as hd,C as R,h as _1,be as md,aY as le,c0 as ce,aT as L3,V as Z1,bf as Mr,aU as P0,aX as E0,aV as F2,bc as p1,fP as tc,dp as fd,fQ as pd,fR as vd,U as gd,ar as Ar,c4 as Fr,bt as te,cK as w0,fS as xd,fT as bd,db as X1,fU as nc,fV as ac,x as rc,fW as jd,bK as Qe,fX as yd,fY as br,bR as ic,fZ as jr,f_ as _d,bk as cc,f$ as sc,g0 as oc,g1 as wd,ey as R2,aQ as e1,au as N3,b as O1,al as K1,cc as W3,g2 as lc,aD as S1,ax as me,g3 as Sd,g4 as Od,at as V2,bh as Je,g5 as Cd,fl as Dd,g6 as I3,dC as Rr,dD as Vr,b9 as N1,g7 as $d,ay as ee,g8 as dc,g9 as uc,dy as Ce,dB as v2,ga as Td,dz as Z3,gb as Pd,dA as Ed,gc as Ne,gd as hc,dd as mc,ge as fc,gf as pc,ci as g3,bb as ne,u as L2,N as z3,cZ as vc,gg as o3,gh as Zd,gi as Id,gj as Md,gk as Ad,gl as Fd,gm as Rd,gn as Vd,go as Ld,gp as Nd,gq as Wd,gr as zd,gs as Bd,gt as Yd,gu as Hd,gv as Ud,gw as x3,fp as S0,gx as kd,aL as Ke,gy as g2,aF as qd,gz as Lr,gA as G1,gB as gc,gC as Kd,gD as Gd,b3,aG as j3,aH as B3,aM as Y3,_ as H3,a as z1,aN as U3,aP as k3,aO as N2,gE as Qd,gF as v1,l as se,dh as Nr,gG as Jd,gH as Xd,gI as eu,b5 as y3,gJ as tu,d6 as xc,c as x2,gK as nu,gL as bc,cX as Te,gM as au,gN as ru,dj as iu,gO as cu,gP as su,gQ as ou,ee as jc,gR as lu,gS as du,gT as uu,gU as hu,gV as yc,gW as _c,aC as R1,cC as M3,gX as mu,gY as fu,az as q3,gZ as wc,g_ as Sc,fs as pu,g$ as je,cS as pe,h0 as vu,aS as gu,h1 as xu,ew as W2,h2 as bu,h3 as Oc,h4 as Cc,h5 as ju,h6 as yu,bs as K3,dq as _u,Z as Wr,Y as Dc,h7 as wu,b1 as G3,h8 as $c,h9 as Z0,ha as Su,hb as Ou,hc as Cu,hd as Du,bj as Ee,cg as Tc,he as $u,v as Tu,hf as Pu,hg as zr,hh as Eu,cf as Pc,hi as Zu,hj as Iu,et as Ec,n as Br,o as Yr,ev as p3,hk as Mu,hl as Au,hm as Fu,ak as w1,eo as I0,ep as v3,hn as Hr,b8 as b2,b4 as Q3,dr as O0,eF as j2,an as z2,aw as Ur,ho as Ru,ac as k1,ad as M0,ao as B2,ae as Y2,af as H2,ag as U2,ah as k2,ai as q2,hp as Zc,e0 as A0,bd as Vu,ap as kr,A as K2,dU as Lu,hq as Nu,eg as d2,dT as ke,hr as Wu,hs as zu,ht as Bu,hu as Yu,av as F0,dO as qr,hv as Hu,hw as A4,hx as Uu,hy as ku,cV as J3,cW as y1,hz as qu,hA as Ku,w as _3,hB as Gu,hC as Qu,hD as Ic,hE as Mc,hF as yr,hG as x8,hH as Ju,dR as Xu,dS as eh,hI as b8,hJ as th,hK as nh,hL as ah,hM as rh,hN as ih,hO as ch,hP as sh,cG as Kr,cH as Gr,hQ as oh,hR as lh,hS as dh,c2 as R0,hT as uh,c9 as hh,bx as mh,by as fh,z as j8,fj as ph,c_ as vh,d0 as gh,hU as xh,hV as Ac,hW as bh,hX as jh,hY as yh,ba as Qr,hZ as _h,h_ as wh,h$ as _r,i0 as Sh,i1 as G2,i2 as Jr,i3 as Xr,du as Fc,eR as Rc,i4 as e5,bp as Oh,fu as Ch,i5 as Vc,t as Dh,bZ as $h,i6 as Th,i7 as Ph,i8 as wr,i9 as Eh,ia as Zh,F as Ih,I as Mh,S as Ah,ib as Lc,ic as Nc,id as Wc,ie as Fh,ig as zc,ih as Rh,ii as Vh,d1 as y2,ij as Lh,ft as Nh,ik as Wh,fx as zh,dJ as y8,dG as Bh,dk as Bc,il as Sr,im as Yh,e2 as Yc,io as Hh,ip as Uh,iq as kh,ir as qh,is as i0,ce as Hc,it as Kh,iu as Gh,iv as Qh,iw as Jh,fo as Xh,ix as em,bC as tm,iy as nm,iz as am,iA as rm}from"./index-CqYZiU1N.js";import{F as Uc,M as im}from"./MarkCompletedDialogue-CS-kM4vW.js";import{a as cm,u as kc,T as sm,b as om,F as lm,h as dm,f as um,g as hm,d as mm,E as fm,i as pm}from"./FeatureStaleDialog-DZvKjxPB.js";import{m as vm,i as _8,b as gm,c as xm,d as bm,e as jm,E as ym,f as _m,u as wm,a as Sm,R as Om,C as Cm,A as Dm,g as qc,j as $m}from"./RoleCell-COtuTPWk.js";import"./useApiTokens-B6vbGXUF.js";function Tm(e,t){var n,i;rd(1,arguments);var c=id(e);if(isNaN(c.getTime()))throw new RangeError("Invalid time value");var s=String((n=t==null?void 0:t.format)!==null&&n!==void 0?n:"extended"),o=String((i=t==null?void 0:t.representation)!==null&&i!==void 0?i:"complete");if(s!=="extended"&&s!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(o!=="date"&&o!=="time"&&o!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var l="",d="",m=s==="extended"?"-":"",f=s==="extended"?":":"";if(o!=="time"){var v=Le(c.getDate(),2),g=Le(c.getMonth()+1,2),p=Le(c.getFullYear(),4);l="".concat(p).concat(m).concat(g).concat(m).concat(v)}if(o!=="date"){var x=c.getTimezoneOffset();if(x!==0){var j=Math.abs(x),y=Le(Math.floor(j/60),2),b=Le(j%60,2),S=x<0?"+":"-";d="".concat(S).concat(y,":").concat(b)}else d="Z";var C=Le(c.getHours(),2),T=Le(c.getMinutes(),2),$=Le(c.getSeconds(),2),Z=l===""?"":"T",O=[C,T,$].join(f);l="".concat(l).concat(Z).concat(O).concat(d)}return l}const Kc=e=>h.createElement("svg",{width:20,height:18,viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M14.125 0C15.7917 0 17.1875 0.616667 18.3125 1.85C19.4375 3.08333 20 4.55 20 6.25C20 6.55 19.9833 6.84583 19.95 7.1375C19.9167 7.42917 19.8583 7.71667 19.775 8H13.525L11.825 5.45C11.7417 5.31667 11.625 5.20833 11.475 5.125C11.325 5.04167 11.1667 5 11 5C10.7833 5 10.5875 5.06667 10.4125 5.2C10.2375 5.33333 10.1167 5.5 10.05 5.7L8.7 9.75L7.825 8.45C7.74167 8.31667 7.625 8.20833 7.475 8.125C7.325 8.04167 7.16667 8 7 8H0.225C0.141667 7.71667 0.0833333 7.42917 0.05 7.1375C0.0166667 6.84583 0 6.55833 0 6.275C0 4.55833 0.558333 3.08333 1.675 1.85C2.79167 0.616667 4.18333 0 5.85 0C6.65 0 7.40417 0.158333 8.1125 0.475C8.82083 0.791667 9.45 1.23333 10 1.8C10.5333 1.23333 11.1542 0.791667 11.8625 0.475C12.5708 0.158333 13.325 0 14.125 0ZM10 18C9.7 18 9.4125 17.9458 9.1375 17.8375C8.8625 17.7292 8.61667 17.5667 8.4 17.35L1.7 10.625C1.6 10.525 1.50833 10.425 1.425 10.325C1.34167 10.225 1.25833 10.1167 1.175 10H6.45L8.15 12.55C8.23333 12.6833 8.35 12.7917 8.5 12.875C8.65 12.9583 8.80833 13 8.975 13C9.19167 13 9.39167 12.9333 9.575 12.8C9.75833 12.6667 9.88333 12.5 9.95 12.3L11.3 8.25L12.15 9.55C12.25 9.68333 12.375 9.79167 12.525 9.875C12.675 9.95833 12.8333 10 13 10H18.8L18.55 10.3L18.3 10.6L11.575 17.35C11.3583 17.5667 11.1167 17.7292 10.85 17.8375C10.5833 17.9458 10.3 18 10 18Z"})),w8=u("div")(()=>({display:"flex"})),Pm=u("div")(()=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",width:"100%"}));u("div")(()=>({display:"flex",flexDirection:"column"}));const Em=u("span")(({theme:e})=>({textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"})),Zm=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));u(Zm)(({theme:e})=>({color:e.palette.neutral.dark}));const Im=u(cd)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),Mm=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),Am=u("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),Fm=u("h1")(({theme:e})=>({margin:0,width:"100%",fontSize:e.typography.h1.fontSize,fontWeight:"bold",display:"flex",alignItems:"center",gap:e.spacing(2),overflow:"hidden",lineHeight:1.5})),Rm=u("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Vm=u("div")(({theme:e})=>({padding:e.spacing(0,4)})),Lm=u(p2)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1),minWidth:170},[e.breakpoints.up("md")]:{minWidth:170}})),Nm=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 16 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.58 10.08L12 11.5L8 15.5L4 11.5L5.42 10.08L7.01 11.67V0.5H8.99V11.67L10.58 10.08ZM16 19V8C16 6.89 15.1 6 14 6H11V8H14V19H2V8H5V6H2C0.889999 6 0 6.89 0 8V19C0 20.1 0.889999 21 2 21H14C15.1 21 16 20.1 16 19Z",fill:"currentColor"}));var t5={},Wm=J1;Object.defineProperty(t5,"__esModule",{value:!0});var Gc=t5.default=void 0,zm=Wm(Q1()),Bm=a,Ym=(0,zm.default)((0,Bm.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd");Gc=t5.default=Ym;var n5={},Hm=J1;Object.defineProperty(n5,"__esModule",{value:!0});var Qc=n5.default=void 0,Um=Hm(Q1()),km=a,qm=(0,Um.default)((0,km.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");Qc=n5.default=qm;var a5={},Km=J1;Object.defineProperty(a5,"__esModule",{value:!0});var _2=a5.default=void 0,Gm=Km(Q1()),Qm=a,Jm=(0,Gm.default)((0,Qm.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");_2=a5.default=Jm;const Xm=u(D)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),ef=({projectId:e,row:t,onOpenArchiveDialog:n,onOpenStaleDialog:i})=>{const[c,s]=h.useState(null),[o,l]=h.useState(!1),{setToastData:d}=$1(),{original:{name:m,stale:f}}=t,v=!!c,g=b=>{s(b.currentTarget)},p=()=>{s(null)},x=`feature-${m}-actions`,j=`${x}-menu`,y=()=>{try{ec(m),l(!0),setTimeout(()=>{p(),l(!1)},1e3)}catch{d({type:"error",text:"Could not copy feature name"})}};return a.jsxs(Xm,{children:[a.jsx(Y1,{title:"Feature flag actions",arrow:!0,describeChild:!0,children:a.jsx(E1,{id:x,"data-loading":!0,"aria-controls":v?j:void 0,"aria-haspopup":"true","aria-expanded":v?"true":void 0,onClick:g,type:"button",children:a.jsx(Ir,{})})}),a.jsx(D0,{id:j,anchorEl:c,open:v,onClose:p,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:a.jsxs($0,{"aria-labelledby":x,children:[a.jsxs(re,{sx:f3,onClick:y,children:[a.jsx(ue,{children:o?a.jsx(R3,{}):a.jsx(Xi,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:o?"Copied!":"Copy Name"})})]}),a.jsx(he,{projectId:e,permission:E2,children:({hasAccess:b})=>a.jsxs(re,{sx:f3,onClick:p,disabled:!b,component:g1,to:`/projects/${e}/features/${m}/copy`,children:[a.jsx(ue,{children:a.jsx(Gc,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Clone"})})]})}),a.jsx(he,{projectId:e,permission:Z2,children:({hasAccess:b})=>a.jsxs(re,{sx:f3,onClick:()=>{n(m),p()},disabled:!b,children:[a.jsx(ue,{children:a.jsx(Qc,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Archive"})})]})}),a.jsx(he,{projectId:e,permission:I2,children:({hasAccess:b})=>a.jsxs(re,{sx:f3,onClick:()=>{p(),i({featureId:m,stale:f===!0})},disabled:!b,children:[a.jsx(ue,{children:a.jsx(_2,{})}),a.jsx(ie,{children:a.jsxs(I,{variant:"body2",children:[f?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var r5={},tf=J1;Object.defineProperty(r5,"__esModule",{value:!0});var Jc=r5.default=void 0,nf=tf(Q1()),af=a,rf=(0,nf.default)((0,af.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");Jc=r5.default=rf;const cf=u(D)(()=>({...M2,justifyContent:"center"})),sf=u(E1)(({theme:e})=>({margin:e.spacing(-1,0)})),of=u(D)(({theme:e})=>({...M2,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),lf=u(re)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),df=u(V3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),uf=u(T0)(({theme:e})=>({padding:e.spacing(.75,1)})),hf=({columns:e,onToggle:t})=>{const[n,i]=h.useState(null),c=m=>{i(m.currentTarget)},s=()=>{i(null)},o=!!n,l="columns-menu",d=`columns-menu-list-${l}`;return a.jsxs(cf,{children:[a.jsx(Y1,{title:"Select columns",arrow:!0,describeChild:!0,children:a.jsx(sf,{id:l,"aria-controls":o?d:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:c,type:"button",size:"large","data-loading":!0,children:a.jsx(Jc,{})})}),a.jsxs(D0,{id:d,open:o,anchorEl:n,onClose:s,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:m=>({borderRadius:m.shape.borderRadius,paddingBottom:m.spacing(2)})},children:[a.jsxs(of,{children:[a.jsx(I,{variant:"body2",children:a.jsx("strong",{children:"Columns"})}),a.jsx(E1,{onClick:s,children:a.jsx(A2,{})})]}),a.jsx($0,{children:e.map(m=>m.id==="divider"?a.jsx(df,{},"divider"):a.jsxs(lf,{onClick:()=>{t==null||t(m.id)},disabled:m.isStatic===!0&&m.isVisible===!0,children:[a.jsx(ue,{children:a.jsx(uf,{edge:"start",checked:m.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":m.id},size:"medium"})}),a.jsx(ie,{id:m.id,primary:a.jsx(I,{variant:"body2",children:m.header})})]},m.id))})]})]})},mf=u(D)(({theme:e})=>({display:"flex",justifyContent:"center",marginRight:e.spacing(-2)})),ff=({onChange:e,checked:t,title:n})=>a.jsx(mf,{"data-testid":sd,children:a.jsx(T0,{onChange:e,title:n,checked:t,"data-loading":!0})}),S8=$e.memo(ff),pf=u("div")(({theme:e})=>({position:"sticky",bottom:50,zIndex:e.zIndex.fab,pointerEvents:"none"})),vf=u(D)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),gf=u(Pe)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),xf=u("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),bf=u(I)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),jf=({count:e,children:t})=>e===0?null:a.jsx(pf,{"data-testid":od,children:a.jsx(vf,{children:a.jsxs(gf,{elevation:4,children:[a.jsxs(bf,{children:[a.jsx(xf,{"data-testid":ld,children:e})," selected"]}),t]})})}),yf=7,_f=e=>{const t=dd(new Date,-yf);return!!(e!=null&&e.lastSeenAt&&ud(new Date(e.lastSeenAt),t))},wf=({projectId:e,featureIds:t,features:n,onConfirm:i})=>{const[c,s]=h.useState(!1),{trackEvent:o}=T1(),l=h.useMemo(()=>t.filter(m=>{const f=n.find(v=>v.name===m);return _f(f)}),[JSON.stringify(n),t]),d=async()=>{s(!1),i==null||i(),o("batch_operations",{props:{eventType:"features archived"}})};return a.jsxs(a.Fragment,{children:[a.jsx(he,{projectId:e,permission:Z2,children:({hasAccess:m})=>a.jsx("span",{children:a.jsx(a1,{disabled:!m||c,variant:"outlined",size:"small",onClick:()=>s(!0),children:"Archive"})})}),a.jsx(Uc,{projectId:e,featureIds:t,featuresWithUsage:l,onConfirm:d,isOpen:c,onClose:()=>s(!1)})]})},Q0="selection-actions-menu",Sf=({projectId:e,data:t,onChange:n})=>{const[i,c]=h.useState(null),{staleFeatures:s}=Ge(),{setToastData:o,setToastApiError:l}=$1(),{trackEvent:d}=T1(),m=!!i,f=t.map(({name:b})=>b),v=b=>{c(b.currentTarget)},g=()=>{c(null)},p=t.some(({stale:b})=>b===!0),x=t.some(({stale:b})=>b===!1),j=async()=>{try{g(),await s(e,f),n==null||n(),o({text:"Feature flags marked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features staled"}})}catch(b){l(_1(b))}},y=async()=>{try{g(),await s(e,f,!1),n==null||n(),o({text:"Feature flags unmarked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features unstaled"}})}catch(b){l(_1(b))}};return a.jsxs(a.Fragment,{children:[a.jsx(Y1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:a.jsx(E1,{id:Q0,"aria-controls":m?Q0:void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:v,type:"button","data-testid":hd,children:a.jsx(Ir,{})})}),a.jsx(D0,{id:`${Q0}-menu`,anchorEl:i,open:m,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:a.jsx($0,{"aria-labelledby":`${Q0}-menu`,children:a.jsx(he,{projectId:e,permission:I2,children:({hasAccess:b})=>a.jsxs(a.Fragment,{children:[a.jsx(R,{condition:x,show:()=>a.jsxs(re,{onClick:j,disabled:!b,sx:{borderRadius:S=>`${S.shape.borderRadius}px`},children:[a.jsx(ue,{children:a.jsx(_2,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Mark as stale"})})]})}),a.jsx(R,{condition:p,show:()=>a.jsxs(re,{onClick:y,disabled:!b,sx:{borderRadius:S=>`${S.shape.borderRadius}px`},children:[a.jsx(ue,{children:a.jsx(_2,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},Of=u("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),O8="manage-tags-form",C8=(e,t)=>[...e,...e.some(n=>n.value===t.value&&n.type===t.type)?[]:[t]],D8=(e,t)=>e.filter(n=>!(n.value===t.value&&n.type===t.type)),Cf=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:C8(e.addedTags,t.payload),removedTags:D8(e.removedTags,t.payload)};case"remove":return{...e,addedTags:D8(e.addedTags,t.payload),removedTags:C8(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};case"reset":return{addedTags:[],removedTags:[]};default:return e}},$8={name:"",description:"",icon:""},Df=({open:e,initialValues:t,initialIndeterminateValues:n,onCancel:i,onSubmit:c})=>{const{tagTypes:s,loading:o}=md(),[l,d]=h.useState($8),[m,f]=h.useState([]),[v,g]=h.useState([]),{tags:p,refetch:x}=cm(l.name),{createTag:j}=kc(),y=p.map(({value:z})=>({title:z})),[b,S]=h.useReducer(Cf,{addedTags:[],removedTags:[]}),C=()=>{c(b),S({type:"reset"})},T=(z=s.length>0?s[0]:$8)=>{d(z);const V=n.filter(({type:M})=>M===z.name);f(t.filter(({type:M})=>M===z.name).filter(({type:M,value:H})=>!V.some(K=>K.value===H&&K.type===M)).map(({value:M})=>({title:M}))),g(V.map(({value:M})=>({title:M}))),S({type:"clear",payload:[]})};h.useEffect(()=>{s.length>0&&T()},[o]);const $=(z,V)=>{V!=null&&typeof V!="string"&&(z.preventDefault(),T(V))},Z=(z,V)=>j({value:z,type:V}).then(async()=>{x(),f(M=>[...M,{title:z}]),S({type:"add",payload:{value:z,type:V}})}),O=(z,V,M,H)=>{M==="selectOption"?V.forEach(K=>{if(typeof K!="string"&&typeof K.inputValue=="string"&&K.inputValue&&K.title.startsWith("Create new value"))return Z(K.inputValue,l.name);f(V),g(A=>A.filter(({title:Y})=>Y!==K.title)),H!=null&&H.option&&S({type:"add",payload:{value:H.option.title,type:l.name}})}):M==="clear"?(f([]),S({type:"clear",payload:t})):M==="removeOption"&&(f(V),H!=null&&H.option&&S({type:"remove",payload:{value:H.option.title,type:l.name}}))},N=()=>{T(),i()};return a.jsxs(le,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature flag tags",onClick:C,disabledPrimaryButton:b.addedTags.length===0&&b.removedTags.length===0,onClose:N,formId:O8,children:[a.jsx(I,{paragraph:!0,sx:{marginBottom:z=>z.spacing(2.5)},children:"Tags allow you to group features together"}),a.jsx("form",{id:O8,onSubmit:C,children:a.jsxs(Of,{children:[a.jsx(sm,{options:s,disabled:o||s.length===0,value:l,onChange:$},o?"loading":s.length),a.jsx(R,{condition:!o&&s.length===0,show:a.jsxs(I,{variant:"body1",children:["No"," ",a.jsx(ce,{component:g1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:a.jsx(om,{disabled:o,options:y,existingTags:t,indeterminateOptions:v,tagType:l,selectedOptions:m,onChange:O})})]})})]})},$f=({projectId:e,data:t,onChange:n})=>{const{bulkUpdateTags:i}=kc(),{setToastData:c,setToastApiError:s}=$1(),{trackEvent:o}=T1(),[l,d]=h.useState(!1),[m,f]=h.useMemo(()=>{const g=t.flatMap(({tags:x})=>x||[]).reduce((x,j)=>[...x,...x.some(y=>y.type===j.type&&y.value===j.value)?[]:[j]],[]),p=g.filter(x=>!t.every(({tags:j})=>j==null?void 0:j.some(y=>y.type===x.type&&y.value===x.value)));return[g,p]},[t]),v=async({addedTags:g,removedTags:p})=>{const j={features:t.map(({name:y})=>y),tags:{addedTags:g,removedTags:p}};try{const y=[g.length>0&&`added ${g.length} tag${g.length>1?"s":""}`,p.length>0&&`removed ${p.length} tag${p.length>1?"s":""}`].filter(Boolean).join(" and ");await i(j,e),c({text:y,type:"success",autoHideDuration:12e3}),o("batch_operations",{props:{eventType:"tags updated"}})}catch(y){s(_1(y))}n==null||n(),d(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(he,{projectId:e,permission:I2,children:({hasAccess:g})=>a.jsx("span",{children:a.jsx(a1,{disabled:!g||l,variant:"outlined",size:"small",onClick:()=>d(!0),children:"Tags"})})}),a.jsx(Df,{open:l,onCancel:()=>d(!1),onSubmit:v,initialValues:m,initialIndeterminateValues:f},t.length)]})},Tf=u(L3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),T8=u(Z1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Pf=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOff:d}=Mr(),{addChange:m}=P0(),{setToastApiError:f,setToastData:v}=$1(),{isChangeRequestConfigured:g}=E0(s),{refetch:p}=F2(s),x=t.filter(S=>{var C,T;return((T=(C=S.environments)==null?void 0:C.find($=>o===$.name))==null?void 0:T.enabled)===!1}).length,j=()=>c.map(S=>({key:S,label:S})),y=async()=>{try{g(o)?(await m(s,o,t.map(S=>({action:"updateEnabled",feature:S.name,payload:{enabled:!1}}))),p(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(S=>S.name),o),v({type:"success",text:"Feature flags disabled"})),n(),i==null||i()}catch(S){f(_1(S))}},b=g(o)?"Add to change request":"Disable flags";return a.jsx(le,{open:e,title:"Disable feature flags",onClose:n,onClick:y,primaryButtonText:b,secondaryButtonText:"Cancel",children:a.jsxs(D,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to disable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to disable the features for:"}),a.jsx(Tf,{options:j(),value:o,onChange:S=>l(S)}),a.jsx(R,{condition:g(o),show:a.jsx(T8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(R,{condition:x>0,show:a.jsxs(T8,{severity:"info",children:[x," feature"," ",x>1?"flags are ":"flag is ","already disabled."]})})]})})},Ef=u(L3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),P8=u(Z1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Zf=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOn:d}=Mr(),{addChange:m}=P0(),{setToastApiError:f,setToastData:v}=$1(),{isChangeRequestConfigured:g}=E0(s),{refetch:p}=F2(s),x=t.filter(S=>{var C,T;return((T=(C=S.environments)==null?void 0:C.find($=>o===$.name))==null?void 0:T.enabled)===!0}).length,j=()=>c.map(S=>({key:S,label:S})),y=async()=>{try{g(o)?(await m(s,o,t.map(S=>({action:"updateEnabled",feature:S.name,payload:{enabled:!0}}))),p(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(S=>S.name),o),v({type:"success",text:"Feature flags enabled"})),n(),i==null||i()}catch(S){f(_1(S))}},b=g(o)?"Add to change request":"Enable flags";return a.jsx(le,{open:e,title:"Enable feature flags",onClose:n,onClick:y,primaryButtonText:b,secondaryButtonText:"Cancel",children:a.jsxs(D,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to enable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to enable the features for:"}),a.jsx(Ef,{options:j(),value:o,onChange:S=>l(S)}),a.jsx(R,{condition:g(o),show:a.jsx(P8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(R,{condition:x>0,show:a.jsxs(P8,{severity:"info",children:[x," feature"," ",x>1?"flags are ":"flag is ","already enabled."]})})]})})},If=({selectedIds:e,data:t,projectId:n,onResetSelection:i,onChange:c})=>{p1();const[s,o]=h.useState(!1),[l,d]=h.useState(!1),[m,f]=h.useState(!1),{trackEvent:v}=T1(),g=h.useMemo(()=>t.filter(S=>e.includes(S.name)),[t,e]),p=h.useMemo(()=>{const S=g.flatMap(C=>C.environments).map(C=>C==null?void 0:C.name).filter(C=>C!==void 0);return Array.from(new Set(S))},[g]),x=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features exported"}})},j=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features enabled"}})},y=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features disabled"}})},b=()=>{c==null||c(),i()};return a.jsxs(a.Fragment,{children:[a.jsx(a1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Enable"}),a.jsx(a1,{variant:"outlined",size:"small",onClick:()=>f(!0),children:"Disable"}),a.jsx(wf,{projectId:n,featureIds:e,features:t,onConfirm:b}),a.jsx(a1,{variant:"outlined",size:"small",onClick:()=>o(!0),children:"Export"}),a.jsx($f,{projectId:n,data:g,onChange:c}),a.jsx(Sf,{projectId:n,data:g,onChange:c}),a.jsx(tc,{showExportDialog:s,data:g,onClose:()=>o(!1),environments:p,onConfirm:x}),a.jsx(Zf,{showExportDialog:l,data:g,onClose:()=>d(!1),environments:p,projectId:n,onConfirm:j}),a.jsx(Pf,{showExportDialog:m,data:g,onClose:()=>f(!1),environments:p,projectId:n,onConfirm:y})]})};var i5={},Mf=J1;Object.defineProperty(i5,"__esModule",{value:!0});var c5=i5.default=void 0,Af=Mf(Q1()),Ff=a,Rf=(0,Af.default)((0,Ff.jsx)("path",{d:"m9.78 11.16-1.42 1.42c-.68-.69-1.34-1.58-1.79-2.94l1.94-.49c.32.89.77 1.5 1.27 2.01zM11 6 7 2 3 6h3.02c.02.81.08 1.54.19 2.17l1.94-.49C8.08 7.2 8.03 6.63 8.02 6H11zm10 0-4-4-4 4h2.99c-.1 3.68-1.28 4.75-2.54 5.88-.5.44-1.01.92-1.45 1.55-.34-.49-.73-.88-1.13-1.24L9.46 13.6c.93.85 1.54 1.54 1.54 3.4v5h2v-5c0-2.02.71-2.66 1.79-3.63 1.38-1.24 3.08-2.78 3.2-7.37H21z"}),"AltRoute");c5=i5.default=Rf;function Vf({onClick:e,currentValue:t,label:n,icon:i,labelWidth:c,tooltip:s}){return a.jsx(fd,{titleComponent:a.jsxs(pd,{children:[a.jsx("h3",{children:s.header}),a.jsx("p",{children:s.description}),s.additionalContent]}),variant:"custom",children:a.jsx(a1,{role:"switch","aria-checked":t,variant:t?"contained":"outlined",color:"primary",startIcon:i,onClick:e,disableElevation:!0,children:a.jsx(vd,{labelWidth:c,children:n})})})}const Lf=({global:e,project:t})=>{const{limitReached:n,limitMessage:i}=Nf(e.limit,e.count),c=Wf(t.limit,t.count);return{limitMessage:n?i:c?`You have reached the project limit of ${t.limit} feature flags.`:void 0,globalFlagLimitReached:n,projectFlagLimitReached:c}},Nf=(e,t)=>{const n=t>=e;return{limitReached:n,limitMessage:n?`You have reached the instance-wide limit of ${e} feature flags.`:void 0}},Wf=(e,t)=>e!=null&&e<=t,zf=()=>{const{setShowFeedback:e}=h.useContext(gd);return h.useCallback(()=>{const{value:t,setValue:n}=Ar("flagsCreated","0"),i=Number.parseInt(t)+1;n(`${i}`),i>1&&e(!0)},[e])},Bf=u(Fr)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:e.spacing(170),width:"100%",backgroundColor:"transparent"},padding:0,"& .MuiPaper-root > section":{overflowX:"hidden"}})),We={project:{icon:a.jsx(oc,{}),text:"Projects allow you to group feature flags together in the Unleash admin UI and in SDK payloads."},tags:{icon:a.jsx(sc,{}),text:"Tags are used to label flags in Unleash. They can be used when filtering flags in the UI. Additionally, they are used by some integrations."},type:{icon:a.jsx(br,{}),text:"A flag's type conveys its purpose. All types have the same capabilities, but choosing the right type signals what kind of flag it is. You can change this at any time."},impressionData:{icon:a.jsx(c5,{}),text:"Impression data is used to track how your flag is performing. When enabled, you can subscribe to 'impression events' in the SDK and process them according to your needs."}},Yf=({open:e,onClose:t,onSuccess:n,skipNavigationOnComplete:i})=>{if(e)return a.jsx(Hf,{open:e,onClose:t,skipNavigationOnComplete:i,onSuccess:n})},Hf=({open:e,onClose:t,skipNavigationOnComplete:n,onSuccess:i})=>{var U,U1,C1;const{setToastData:c,setToastApiError:s}=$1(),{uiConfig:o,isOss:l}=p1(),d=te(),m=zf(),[f,v]=w0("flag-creation-dialog",{},60*60*1e3),g=f,{type:p,setType:x,tags:j,setTags:y,name:b,setName:S,project:C,setProject:T,description:$,setDescription:Z,validateToggleName:O,impressionData:N,setImpressionData:z,getTogglePayload:V,clearErrors:M,errors:H}=xd(g),{createFeatureToggle:K,loading:A}=Mr(),Y={icon:a.jsx(br,{}),text:"Feature flags are at the core of Unleash. Use them to control your feature rollouts.",link:{url:"https://docs.getunleash.io/reference/feature-toggles",label:"Feature flags documentation"}},[W,E]=h.useState(Y),w=()=>E(Y),_=V(),F=()=>`curl --location --request POST '${o.unleashUrl}/api/admin/projects/${C}/features' \\
1
+ var nd=Object.defineProperty;var ad=(e,t,n)=>t in e?nd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t,n)=>ad(e,typeof t!="symbol"?t+"":t,n);import{fB as rd,fC as id,fD as Le,r as h,s as u,fE as cd,di as p2,G as Q1,H as J1,j as a,B as D,e as $1,y as Y1,D as E1,a_ as Ir,J as D0,a$ as $0,M as re,fF as f3,b0 as ue,d as R3,fG as Xi,b2 as ie,T as I,fH as he,dn as E2,L as g1,cQ as Z2,bi as I2,dg as ec,aq as M2,E as V3,m as T0,K as A2,dt as $e,fI as sd,aE as Pe,fJ as od,fK as ld,as as T1,i as a1,fL as dd,fM as ud,fN as Ge,fO as hd,C as R,h as _1,be as md,aY as le,c0 as ce,aT as L3,V as Z1,bf as Mr,aU as P0,aX as E0,aV as F2,bc as p1,fP as tc,dp as fd,fQ as pd,fR as vd,U as gd,ar as Ar,c4 as Fr,bt as te,cK as w0,fS as xd,fT as bd,db as X1,fU as nc,fV as ac,x as rc,fW as jd,bK as Qe,fX as yd,fY as br,bR as ic,fZ as jr,f_ as _d,bk as cc,f$ as sc,g0 as oc,g1 as wd,ey as R2,aQ as e1,au as N3,b as O1,al as K1,cc as W3,g2 as lc,aD as S1,ax as me,g3 as Sd,g4 as Od,at as V2,bh as Je,g5 as Cd,fl as Dd,g6 as I3,dC as Rr,dD as Vr,b9 as N1,g7 as $d,ay as ee,g8 as dc,g9 as uc,dy as Ce,dB as v2,ga as Td,dz as Z3,gb as Pd,dA as Ed,gc as Ne,gd as hc,dd as mc,ge as fc,gf as pc,ci as g3,bb as ne,u as L2,N as z3,cZ as vc,gg as o3,gh as Zd,gi as Id,gj as Md,gk as Ad,gl as Fd,gm as Rd,gn as Vd,go as Ld,gp as Nd,gq as Wd,gr as zd,gs as Bd,gt as Yd,gu as Hd,gv as Ud,gw as x3,fp as S0,gx as kd,aL as Ke,gy as g2,aF as qd,gz as Lr,gA as G1,gB as gc,gC as Kd,gD as Gd,b3,aG as j3,aH as B3,aM as Y3,_ as H3,a as z1,aN as U3,aP as k3,aO as N2,gE as Qd,gF as v1,l as se,dh as Nr,gG as Jd,gH as Xd,gI as eu,b5 as y3,gJ as tu,d6 as xc,c as x2,gK as nu,gL as bc,cX as Te,gM as au,gN as ru,dj as iu,gO as cu,gP as su,gQ as ou,ee as jc,gR as lu,gS as du,gT as uu,gU as hu,gV as yc,gW as _c,aC as R1,cC as M3,gX as mu,gY as fu,az as q3,gZ as wc,g_ as Sc,fs as pu,g$ as je,cS as pe,h0 as vu,aS as gu,h1 as xu,ew as W2,h2 as bu,h3 as Oc,h4 as Cc,h5 as ju,h6 as yu,bs as K3,dq as _u,Z as Wr,Y as Dc,h7 as wu,b1 as G3,h8 as $c,h9 as Z0,ha as Su,hb as Ou,hc as Cu,hd as Du,bj as Ee,cg as Tc,he as $u,v as Tu,hf as Pu,hg as zr,hh as Eu,cf as Pc,hi as Zu,hj as Iu,et as Ec,n as Br,o as Yr,ev as p3,hk as Mu,hl as Au,hm as Fu,ak as w1,eo as I0,ep as v3,hn as Hr,b8 as b2,b4 as Q3,dr as O0,eF as j2,an as z2,aw as Ur,ho as Ru,ac as k1,ad as M0,ao as B2,ae as Y2,af as H2,ag as U2,ah as k2,ai as q2,hp as Zc,e0 as A0,bd as Vu,ap as kr,A as K2,dU as Lu,hq as Nu,eg as d2,dT as ke,hr as Wu,hs as zu,ht as Bu,hu as Yu,av as F0,dO as qr,hv as Hu,hw as A4,hx as Uu,hy as ku,cV as J3,cW as y1,hz as qu,hA as Ku,w as _3,hB as Gu,hC as Qu,hD as Ic,hE as Mc,hF as yr,hG as x8,hH as Ju,dR as Xu,dS as eh,hI as b8,hJ as th,hK as nh,hL as ah,hM as rh,hN as ih,hO as ch,hP as sh,cG as Kr,cH as Gr,hQ as oh,hR as lh,hS as dh,c2 as R0,hT as uh,c9 as hh,bx as mh,by as fh,z as j8,fj as ph,c_ as vh,d0 as gh,hU as xh,hV as Ac,hW as bh,hX as jh,hY as yh,ba as Qr,hZ as _h,h_ as wh,h$ as _r,i0 as Sh,i1 as G2,i2 as Jr,i3 as Xr,du as Fc,eR as Rc,i4 as e5,bp as Oh,fu as Ch,i5 as Vc,t as Dh,bZ as $h,i6 as Th,i7 as Ph,i8 as wr,i9 as Eh,ia as Zh,F as Ih,I as Mh,S as Ah,ib as Lc,ic as Nc,id as Wc,ie as Fh,ig as zc,ih as Rh,ii as Vh,d1 as y2,ij as Lh,ft as Nh,ik as Wh,fx as zh,dJ as y8,dG as Bh,dk as Bc,il as Sr,im as Yh,e2 as Yc,io as Hh,ip as Uh,iq as kh,ir as qh,is as i0,ce as Hc,it as Kh,iu as Gh,iv as Qh,iw as Jh,fo as Xh,ix as em,bC as tm,iy as nm,iz as am,iA as rm}from"./index-A5We7bvX.js";import{F as Uc,M as im}from"./MarkCompletedDialogue-Bw9Iccid.js";import{a as cm,u as kc,T as sm,b as om,F as lm,h as dm,f as um,g as hm,d as mm,E as fm,i as pm}from"./FeatureStaleDialog-DKeGFuL1.js";import{m as vm,i as _8,b as gm,c as xm,d as bm,e as jm,E as ym,f as _m,u as wm,a as Sm,R as Om,C as Cm,A as Dm,g as qc,j as $m}from"./RoleCell-C-hJFmul.js";import"./useApiTokens-DNIDLJlc.js";function Tm(e,t){var n,i;rd(1,arguments);var c=id(e);if(isNaN(c.getTime()))throw new RangeError("Invalid time value");var s=String((n=t==null?void 0:t.format)!==null&&n!==void 0?n:"extended"),o=String((i=t==null?void 0:t.representation)!==null&&i!==void 0?i:"complete");if(s!=="extended"&&s!=="basic")throw new RangeError("format must be 'extended' or 'basic'");if(o!=="date"&&o!=="time"&&o!=="complete")throw new RangeError("representation must be 'date', 'time', or 'complete'");var l="",d="",m=s==="extended"?"-":"",f=s==="extended"?":":"";if(o!=="time"){var v=Le(c.getDate(),2),g=Le(c.getMonth()+1,2),p=Le(c.getFullYear(),4);l="".concat(p).concat(m).concat(g).concat(m).concat(v)}if(o!=="date"){var x=c.getTimezoneOffset();if(x!==0){var j=Math.abs(x),y=Le(Math.floor(j/60),2),b=Le(j%60,2),S=x<0?"+":"-";d="".concat(S).concat(y,":").concat(b)}else d="Z";var C=Le(c.getHours(),2),T=Le(c.getMinutes(),2),$=Le(c.getSeconds(),2),Z=l===""?"":"T",O=[C,T,$].join(f);l="".concat(l).concat(Z).concat(O).concat(d)}return l}const Kc=e=>h.createElement("svg",{width:20,height:18,viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M14.125 0C15.7917 0 17.1875 0.616667 18.3125 1.85C19.4375 3.08333 20 4.55 20 6.25C20 6.55 19.9833 6.84583 19.95 7.1375C19.9167 7.42917 19.8583 7.71667 19.775 8H13.525L11.825 5.45C11.7417 5.31667 11.625 5.20833 11.475 5.125C11.325 5.04167 11.1667 5 11 5C10.7833 5 10.5875 5.06667 10.4125 5.2C10.2375 5.33333 10.1167 5.5 10.05 5.7L8.7 9.75L7.825 8.45C7.74167 8.31667 7.625 8.20833 7.475 8.125C7.325 8.04167 7.16667 8 7 8H0.225C0.141667 7.71667 0.0833333 7.42917 0.05 7.1375C0.0166667 6.84583 0 6.55833 0 6.275C0 4.55833 0.558333 3.08333 1.675 1.85C2.79167 0.616667 4.18333 0 5.85 0C6.65 0 7.40417 0.158333 8.1125 0.475C8.82083 0.791667 9.45 1.23333 10 1.8C10.5333 1.23333 11.1542 0.791667 11.8625 0.475C12.5708 0.158333 13.325 0 14.125 0ZM10 18C9.7 18 9.4125 17.9458 9.1375 17.8375C8.8625 17.7292 8.61667 17.5667 8.4 17.35L1.7 10.625C1.6 10.525 1.50833 10.425 1.425 10.325C1.34167 10.225 1.25833 10.1167 1.175 10H6.45L8.15 12.55C8.23333 12.6833 8.35 12.7917 8.5 12.875C8.65 12.9583 8.80833 13 8.975 13C9.19167 13 9.39167 12.9333 9.575 12.8C9.75833 12.6667 9.88333 12.5 9.95 12.3L11.3 8.25L12.15 9.55C12.25 9.68333 12.375 9.79167 12.525 9.875C12.675 9.95833 12.8333 10 13 10H18.8L18.55 10.3L18.3 10.6L11.575 17.35C11.3583 17.5667 11.1167 17.7292 10.85 17.8375C10.5833 17.9458 10.3 18 10 18Z"})),w8=u("div")(()=>({display:"flex"})),Pm=u("div")(()=>({display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",width:"100%"}));u("div")(()=>({display:"flex",flexDirection:"column"}));const Em=u("span")(({theme:e})=>({textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"})),Zm=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:"normal"}));u(Zm)(({theme:e})=>({color:e.palette.neutral.dark}));const Im=u(cd)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),Mm=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),Am=u("div")(({theme:e})=>({padding:e.spacing(2.5,5),display:"flex",flexDirection:"column",alignItems:"start"})),Fm=u("h1")(({theme:e})=>({margin:0,width:"100%",fontSize:e.typography.h1.fontSize,fontWeight:"bold",display:"flex",alignItems:"center",gap:e.spacing(2),overflow:"hidden",lineHeight:1.5})),Rm=u("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Vm=u("div")(({theme:e})=>({padding:e.spacing(0,4)})),Lm=u(p2)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1),minWidth:170},[e.breakpoints.up("md")]:{minWidth:170}})),Nm=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 16 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.58 10.08L12 11.5L8 15.5L4 11.5L5.42 10.08L7.01 11.67V0.5H8.99V11.67L10.58 10.08ZM16 19V8C16 6.89 15.1 6 14 6H11V8H14V19H2V8H5V6H2C0.889999 6 0 6.89 0 8V19C0 20.1 0.889999 21 2 21H14C15.1 21 16 20.1 16 19Z",fill:"currentColor"}));var t5={},Wm=J1;Object.defineProperty(t5,"__esModule",{value:!0});var Gc=t5.default=void 0,zm=Wm(Q1()),Bm=a,Ym=(0,zm.default)((0,Bm.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd");Gc=t5.default=Ym;var n5={},Hm=J1;Object.defineProperty(n5,"__esModule",{value:!0});var Qc=n5.default=void 0,Um=Hm(Q1()),km=a,qm=(0,Um.default)((0,km.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");Qc=n5.default=qm;var a5={},Km=J1;Object.defineProperty(a5,"__esModule",{value:!0});var _2=a5.default=void 0,Gm=Km(Q1()),Qm=a,Jm=(0,Gm.default)((0,Qm.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");_2=a5.default=Jm;const Xm=u(D)(({theme:e})=>({display:"flex",justifyContent:"center",paddingRight:e.spacing(2)})),ef=({projectId:e,row:t,onOpenArchiveDialog:n,onOpenStaleDialog:i})=>{const[c,s]=h.useState(null),[o,l]=h.useState(!1),{setToastData:d}=$1(),{original:{name:m,stale:f}}=t,v=!!c,g=b=>{s(b.currentTarget)},p=()=>{s(null)},x=`feature-${m}-actions`,j=`${x}-menu`,y=()=>{try{ec(m),l(!0),setTimeout(()=>{p(),l(!1)},1e3)}catch{d({type:"error",text:"Could not copy feature name"})}};return a.jsxs(Xm,{children:[a.jsx(Y1,{title:"Feature flag actions",arrow:!0,describeChild:!0,children:a.jsx(E1,{id:x,"data-loading":!0,"aria-controls":v?j:void 0,"aria-haspopup":"true","aria-expanded":v?"true":void 0,onClick:g,type:"button",children:a.jsx(Ir,{})})}),a.jsx(D0,{id:j,anchorEl:c,open:v,onClose:p,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:a.jsxs($0,{"aria-labelledby":x,children:[a.jsxs(re,{sx:f3,onClick:y,children:[a.jsx(ue,{children:o?a.jsx(R3,{}):a.jsx(Xi,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:o?"Copied!":"Copy Name"})})]}),a.jsx(he,{projectId:e,permission:E2,children:({hasAccess:b})=>a.jsxs(re,{sx:f3,onClick:p,disabled:!b,component:g1,to:`/projects/${e}/features/${m}/copy`,children:[a.jsx(ue,{children:a.jsx(Gc,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Clone"})})]})}),a.jsx(he,{projectId:e,permission:Z2,children:({hasAccess:b})=>a.jsxs(re,{sx:f3,onClick:()=>{n(m),p()},disabled:!b,children:[a.jsx(ue,{children:a.jsx(Qc,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Archive"})})]})}),a.jsx(he,{projectId:e,permission:I2,children:({hasAccess:b})=>a.jsxs(re,{sx:f3,onClick:()=>{p(),i({featureId:m,stale:f===!0})},disabled:!b,children:[a.jsx(ue,{children:a.jsx(_2,{})}),a.jsx(ie,{children:a.jsxs(I,{variant:"body2",children:[f?"Un-mark":"Mark"," as stale"]})})]})})]})})]})};var r5={},tf=J1;Object.defineProperty(r5,"__esModule",{value:!0});var Jc=r5.default=void 0,nf=tf(Q1()),af=a,rf=(0,nf.default)((0,af.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");Jc=r5.default=rf;const cf=u(D)(()=>({...M2,justifyContent:"center"})),sf=u(E1)(({theme:e})=>({margin:e.spacing(-1,0)})),of=u(D)(({theme:e})=>({...M2,justifyContent:"space-between",padding:e.spacing(1,1,0,4)})),lf=u(re)(({theme:e})=>({padding:e.spacing(0,2),margin:e.spacing(0,2),borderRadius:e.shape.borderRadius})),df=u(V3)(({theme:e})=>({"&.MuiDivider-root.MuiDivider-fullWidth":{margin:e.spacing(.75,0)}})),uf=u(T0)(({theme:e})=>({padding:e.spacing(.75,1)})),hf=({columns:e,onToggle:t})=>{const[n,i]=h.useState(null),c=m=>{i(m.currentTarget)},s=()=>{i(null)},o=!!n,l="columns-menu",d=`columns-menu-list-${l}`;return a.jsxs(cf,{children:[a.jsx(Y1,{title:"Select columns",arrow:!0,describeChild:!0,children:a.jsx(sf,{id:l,"aria-controls":o?d:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:c,type:"button",size:"large","data-loading":!0,children:a.jsx(Jc,{})})}),a.jsxs(D0,{id:d,open:o,anchorEl:n,onClose:s,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},disableScrollLock:!0,PaperProps:{sx:m=>({borderRadius:m.shape.borderRadius,paddingBottom:m.spacing(2)})},children:[a.jsxs(of,{children:[a.jsx(I,{variant:"body2",children:a.jsx("strong",{children:"Columns"})}),a.jsx(E1,{onClick:s,children:a.jsx(A2,{})})]}),a.jsx($0,{children:e.map(m=>m.id==="divider"?a.jsx(df,{},"divider"):a.jsxs(lf,{onClick:()=>{t==null||t(m.id)},disabled:m.isStatic===!0&&m.isVisible===!0,children:[a.jsx(ue,{children:a.jsx(uf,{edge:"start",checked:m.isVisible,disableRipple:!0,inputProps:{"aria-labelledby":m.id},size:"medium"})}),a.jsx(ie,{id:m.id,primary:a.jsx(I,{variant:"body2",children:m.header})})]},m.id))})]})]})},mf=u(D)(({theme:e})=>({display:"flex",justifyContent:"center",marginRight:e.spacing(-2)})),ff=({onChange:e,checked:t,title:n})=>a.jsx(mf,{"data-testid":sd,children:a.jsx(T0,{onChange:e,title:n,checked:t,"data-loading":!0})}),S8=$e.memo(ff),pf=u("div")(({theme:e})=>({position:"sticky",bottom:50,zIndex:e.zIndex.fab,pointerEvents:"none"})),vf=u(D)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),gf=u(Pe)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",marginTop:e.spacing(2),marginLeft:"auto",marginRight:"auto",padding:e.spacing(2,3),backgroundColor:e.palette.background.paper,border:`1px solid ${e.palette.background.alternative}`,borderRadius:e.shape.borderRadiusLarge,gap:e.spacing(1),flexWrap:"wrap",pointerEvents:"auto"})),xf=u("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),bf=u(I)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),jf=({count:e,children:t})=>e===0?null:a.jsx(pf,{"data-testid":od,children:a.jsx(vf,{children:a.jsxs(gf,{elevation:4,children:[a.jsxs(bf,{children:[a.jsx(xf,{"data-testid":ld,children:e})," selected"]}),t]})})}),yf=7,_f=e=>{const t=dd(new Date,-yf);return!!(e!=null&&e.lastSeenAt&&ud(new Date(e.lastSeenAt),t))},wf=({projectId:e,featureIds:t,features:n,onConfirm:i})=>{const[c,s]=h.useState(!1),{trackEvent:o}=T1(),l=h.useMemo(()=>t.filter(m=>{const f=n.find(v=>v.name===m);return _f(f)}),[JSON.stringify(n),t]),d=async()=>{s(!1),i==null||i(),o("batch_operations",{props:{eventType:"features archived"}})};return a.jsxs(a.Fragment,{children:[a.jsx(he,{projectId:e,permission:Z2,children:({hasAccess:m})=>a.jsx("span",{children:a.jsx(a1,{disabled:!m||c,variant:"outlined",size:"small",onClick:()=>s(!0),children:"Archive"})})}),a.jsx(Uc,{projectId:e,featureIds:t,featuresWithUsage:l,onConfirm:d,isOpen:c,onClose:()=>s(!1)})]})},Q0="selection-actions-menu",Sf=({projectId:e,data:t,onChange:n})=>{const[i,c]=h.useState(null),{staleFeatures:s}=Ge(),{setToastData:o,setToastApiError:l}=$1(),{trackEvent:d}=T1(),m=!!i,f=t.map(({name:b})=>b),v=b=>{c(b.currentTarget)},g=()=>{c(null)},p=t.some(({stale:b})=>b===!0),x=t.some(({stale:b})=>b===!1),j=async()=>{try{g(),await s(e,f),n==null||n(),o({text:"Feature flags marked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features staled"}})}catch(b){l(_1(b))}},y=async()=>{try{g(),await s(e,f,!1),n==null||n(),o({text:"Feature flags unmarked as stale",type:"success"}),d("batch_operations",{props:{eventType:"features unstaled"}})}catch(b){l(_1(b))}};return a.jsxs(a.Fragment,{children:[a.jsx(Y1,{title:"More bulk actions",arrow:!0,describeChild:!0,children:a.jsx(E1,{id:Q0,"aria-controls":m?Q0:void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:v,type:"button","data-testid":hd,children:a.jsx(Ir,{})})}),a.jsx(D0,{id:`${Q0}-menu`,anchorEl:i,open:m,onClose:g,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:b=>({borderRadius:`${b.shape.borderRadius}px`,padding:b.spacing(1,1.5)})},children:a.jsx($0,{"aria-labelledby":`${Q0}-menu`,children:a.jsx(he,{projectId:e,permission:I2,children:({hasAccess:b})=>a.jsxs(a.Fragment,{children:[a.jsx(R,{condition:x,show:()=>a.jsxs(re,{onClick:j,disabled:!b,sx:{borderRadius:S=>`${S.shape.borderRadius}px`},children:[a.jsx(ue,{children:a.jsx(_2,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Mark as stale"})})]})}),a.jsx(R,{condition:p,show:()=>a.jsxs(re,{onClick:y,disabled:!b,sx:{borderRadius:S=>`${S.shape.borderRadius}px`},children:[a.jsx(ue,{children:a.jsx(_2,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Un-mark as stale"})})]})})]})})})})]})},Of=u("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),O8="manage-tags-form",C8=(e,t)=>[...e,...e.some(n=>n.value===t.value&&n.type===t.type)?[]:[t]],D8=(e,t)=>e.filter(n=>!(n.value===t.value&&n.type===t.type)),Cf=(e,t)=>{switch(t.type){case"add":return{...e,addedTags:C8(e.addedTags,t.payload),removedTags:D8(e.removedTags,t.payload)};case"remove":return{...e,addedTags:D8(e.addedTags,t.payload),removedTags:C8(e.removedTags,t.payload)};case"clear":return{addedTags:[],removedTags:t.payload};case"reset":return{addedTags:[],removedTags:[]};default:return e}},$8={name:"",description:"",icon:""},Df=({open:e,initialValues:t,initialIndeterminateValues:n,onCancel:i,onSubmit:c})=>{const{tagTypes:s,loading:o}=md(),[l,d]=h.useState($8),[m,f]=h.useState([]),[v,g]=h.useState([]),{tags:p,refetch:x}=cm(l.name),{createTag:j}=kc(),y=p.map(({value:z})=>({title:z})),[b,S]=h.useReducer(Cf,{addedTags:[],removedTags:[]}),C=()=>{c(b),S({type:"reset"})},T=(z=s.length>0?s[0]:$8)=>{d(z);const V=n.filter(({type:M})=>M===z.name);f(t.filter(({type:M})=>M===z.name).filter(({type:M,value:H})=>!V.some(K=>K.value===H&&K.type===M)).map(({value:M})=>({title:M}))),g(V.map(({value:M})=>({title:M}))),S({type:"clear",payload:[]})};h.useEffect(()=>{s.length>0&&T()},[o]);const $=(z,V)=>{V!=null&&typeof V!="string"&&(z.preventDefault(),T(V))},Z=(z,V)=>j({value:z,type:V}).then(async()=>{x(),f(M=>[...M,{title:z}]),S({type:"add",payload:{value:z,type:V}})}),O=(z,V,M,H)=>{M==="selectOption"?V.forEach(K=>{if(typeof K!="string"&&typeof K.inputValue=="string"&&K.inputValue&&K.title.startsWith("Create new value"))return Z(K.inputValue,l.name);f(V),g(A=>A.filter(({title:Y})=>Y!==K.title)),H!=null&&H.option&&S({type:"add",payload:{value:H.option.title,type:l.name}})}):M==="clear"?(f([]),S({type:"clear",payload:t})):M==="removeOption"&&(f(V),H!=null&&H.option&&S({type:"remove",payload:{value:H.option.title,type:l.name}}))},N=()=>{T(),i()};return a.jsxs(le,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature flag tags",onClick:C,disabledPrimaryButton:b.addedTags.length===0&&b.removedTags.length===0,onClose:N,formId:O8,children:[a.jsx(I,{paragraph:!0,sx:{marginBottom:z=>z.spacing(2.5)},children:"Tags allow you to group features together"}),a.jsx("form",{id:O8,onSubmit:C,children:a.jsxs(Of,{children:[a.jsx(sm,{options:s,disabled:o||s.length===0,value:l,onChange:$},o?"loading":s.length),a.jsx(R,{condition:!o&&s.length===0,show:a.jsxs(I,{variant:"body1",children:["No"," ",a.jsx(ce,{component:g1,to:"/tag-types",children:"tag types"})," ","available."]}),elseShow:a.jsx(om,{disabled:o,options:y,existingTags:t,indeterminateOptions:v,tagType:l,selectedOptions:m,onChange:O})})]})})]})},$f=({projectId:e,data:t,onChange:n})=>{const{bulkUpdateTags:i}=kc(),{setToastData:c,setToastApiError:s}=$1(),{trackEvent:o}=T1(),[l,d]=h.useState(!1),[m,f]=h.useMemo(()=>{const g=t.flatMap(({tags:x})=>x||[]).reduce((x,j)=>[...x,...x.some(y=>y.type===j.type&&y.value===j.value)?[]:[j]],[]),p=g.filter(x=>!t.every(({tags:j})=>j==null?void 0:j.some(y=>y.type===x.type&&y.value===x.value)));return[g,p]},[t]),v=async({addedTags:g,removedTags:p})=>{const j={features:t.map(({name:y})=>y),tags:{addedTags:g,removedTags:p}};try{const y=[g.length>0&&`added ${g.length} tag${g.length>1?"s":""}`,p.length>0&&`removed ${p.length} tag${p.length>1?"s":""}`].filter(Boolean).join(" and ");await i(j,e),c({text:y,type:"success",autoHideDuration:12e3}),o("batch_operations",{props:{eventType:"tags updated"}})}catch(y){s(_1(y))}n==null||n(),d(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(he,{projectId:e,permission:I2,children:({hasAccess:g})=>a.jsx("span",{children:a.jsx(a1,{disabled:!g||l,variant:"outlined",size:"small",onClick:()=>d(!0),children:"Tags"})})}),a.jsx(Df,{open:l,onCancel:()=>d(!1),onSubmit:v,initialValues:m,initialIndeterminateValues:f},t.length)]})},Tf=u(L3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),T8=u(Z1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Pf=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOff:d}=Mr(),{addChange:m}=P0(),{setToastApiError:f,setToastData:v}=$1(),{isChangeRequestConfigured:g}=E0(s),{refetch:p}=F2(s),x=t.filter(S=>{var C,T;return((T=(C=S.environments)==null?void 0:C.find($=>o===$.name))==null?void 0:T.enabled)===!1}).length,j=()=>c.map(S=>({key:S,label:S})),y=async()=>{try{g(o)?(await m(s,o,t.map(S=>({action:"updateEnabled",feature:S.name,payload:{enabled:!1}}))),p(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(S=>S.name),o),v({type:"success",text:"Feature flags disabled"})),n(),i==null||i()}catch(S){f(_1(S))}},b=g(o)?"Add to change request":"Disable flags";return a.jsx(le,{open:e,title:"Disable feature flags",onClose:n,onClick:y,primaryButtonText:b,secondaryButtonText:"Cancel",children:a.jsxs(D,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to disable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to disable the features for:"}),a.jsx(Tf,{options:j(),value:o,onChange:S=>l(S)}),a.jsx(R,{condition:g(o),show:a.jsx(T8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(R,{condition:x>0,show:a.jsxs(T8,{severity:"info",children:[x," feature"," ",x>1?"flags are ":"flag is ","already disabled."]})})]})})},Ef=u(L3)(({theme:e})=>({minWidth:"450px",marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),P8=u(Z1)(({theme:e})=>({marginBottom:e.spacing(1.5)})),Zf=({showExportDialog:e,data:t,onClose:n,onConfirm:i,environments:c,projectId:s})=>{const[o,l]=h.useState(c[0]),{bulkToggleFeaturesEnvironmentOn:d}=Mr(),{addChange:m}=P0(),{setToastApiError:f,setToastData:v}=$1(),{isChangeRequestConfigured:g}=E0(s),{refetch:p}=F2(s),x=t.filter(S=>{var C,T;return((T=(C=S.environments)==null?void 0:C.find($=>o===$.name))==null?void 0:T.enabled)===!0}).length,j=()=>c.map(S=>({key:S,label:S})),y=async()=>{try{g(o)?(await m(s,o,t.map(S=>({action:"updateEnabled",feature:S.name,payload:{enabled:!0}}))),p(),v({type:"success",text:"Changes added to draft"})):(await d(s,t.map(S=>S.name),o),v({type:"success",text:"Feature flags enabled"})),n(),i==null||i()}catch(S){f(_1(S))}},b=g(o)?"Add to change request":"Enable flags";return a.jsx(le,{open:e,title:"Enable feature flags",onClose:n,onClick:y,primaryButtonText:b,secondaryButtonText:"Cancel",children:a.jsxs(D,{children:["You have selected ",a.jsx("b",{children:t.length})," feature flags to enable.",a.jsx("br",{}),a.jsx("br",{}),a.jsx(I,{children:"Select which environment to enable the features for:"}),a.jsx(Ef,{options:j(),value:o,onChange:S=>l(S)}),a.jsx(R,{condition:g(o),show:a.jsx(P8,{severity:"warning",children:"Change requests are enabled for this environment."})}),a.jsx(R,{condition:x>0,show:a.jsxs(P8,{severity:"info",children:[x," feature"," ",x>1?"flags are ":"flag is ","already enabled."]})})]})})},If=({selectedIds:e,data:t,projectId:n,onResetSelection:i,onChange:c})=>{p1();const[s,o]=h.useState(!1),[l,d]=h.useState(!1),[m,f]=h.useState(!1),{trackEvent:v}=T1(),g=h.useMemo(()=>t.filter(S=>e.includes(S.name)),[t,e]),p=h.useMemo(()=>{const S=g.flatMap(C=>C.environments).map(C=>C==null?void 0:C.name).filter(C=>C!==void 0);return Array.from(new Set(S))},[g]),x=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features exported"}})},j=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features enabled"}})},y=()=>{c==null||c(),v("batch_operations",{props:{eventType:"features disabled"}})},b=()=>{c==null||c(),i()};return a.jsxs(a.Fragment,{children:[a.jsx(a1,{variant:"outlined",size:"small",onClick:()=>d(!0),children:"Enable"}),a.jsx(a1,{variant:"outlined",size:"small",onClick:()=>f(!0),children:"Disable"}),a.jsx(wf,{projectId:n,featureIds:e,features:t,onConfirm:b}),a.jsx(a1,{variant:"outlined",size:"small",onClick:()=>o(!0),children:"Export"}),a.jsx($f,{projectId:n,data:g,onChange:c}),a.jsx(Sf,{projectId:n,data:g,onChange:c}),a.jsx(tc,{showExportDialog:s,data:g,onClose:()=>o(!1),environments:p,onConfirm:x}),a.jsx(Zf,{showExportDialog:l,data:g,onClose:()=>d(!1),environments:p,projectId:n,onConfirm:j}),a.jsx(Pf,{showExportDialog:m,data:g,onClose:()=>f(!1),environments:p,projectId:n,onConfirm:y})]})};var i5={},Mf=J1;Object.defineProperty(i5,"__esModule",{value:!0});var c5=i5.default=void 0,Af=Mf(Q1()),Ff=a,Rf=(0,Af.default)((0,Ff.jsx)("path",{d:"m9.78 11.16-1.42 1.42c-.68-.69-1.34-1.58-1.79-2.94l1.94-.49c.32.89.77 1.5 1.27 2.01zM11 6 7 2 3 6h3.02c.02.81.08 1.54.19 2.17l1.94-.49C8.08 7.2 8.03 6.63 8.02 6H11zm10 0-4-4-4 4h2.99c-.1 3.68-1.28 4.75-2.54 5.88-.5.44-1.01.92-1.45 1.55-.34-.49-.73-.88-1.13-1.24L9.46 13.6c.93.85 1.54 1.54 1.54 3.4v5h2v-5c0-2.02.71-2.66 1.79-3.63 1.38-1.24 3.08-2.78 3.2-7.37H21z"}),"AltRoute");c5=i5.default=Rf;function Vf({onClick:e,currentValue:t,label:n,icon:i,labelWidth:c,tooltip:s}){return a.jsx(fd,{titleComponent:a.jsxs(pd,{children:[a.jsx("h3",{children:s.header}),a.jsx("p",{children:s.description}),s.additionalContent]}),variant:"custom",children:a.jsx(a1,{role:"switch","aria-checked":t,variant:t?"contained":"outlined",color:"primary",startIcon:i,onClick:e,disableElevation:!0,children:a.jsx(vd,{labelWidth:c,children:n})})})}const Lf=({global:e,project:t})=>{const{limitReached:n,limitMessage:i}=Nf(e.limit,e.count),c=Wf(t.limit,t.count);return{limitMessage:n?i:c?`You have reached the project limit of ${t.limit} feature flags.`:void 0,globalFlagLimitReached:n,projectFlagLimitReached:c}},Nf=(e,t)=>{const n=t>=e;return{limitReached:n,limitMessage:n?`You have reached the instance-wide limit of ${e} feature flags.`:void 0}},Wf=(e,t)=>e!=null&&e<=t,zf=()=>{const{setShowFeedback:e}=h.useContext(gd);return h.useCallback(()=>{const{value:t,setValue:n}=Ar("flagsCreated","0"),i=Number.parseInt(t)+1;n(`${i}`),i>1&&e(!0)},[e])},Bf=u(Fr)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:e.spacing(170),width:"100%",backgroundColor:"transparent"},padding:0,"& .MuiPaper-root > section":{overflowX:"hidden"}})),We={project:{icon:a.jsx(oc,{}),text:"Projects allow you to group feature flags together in the Unleash admin UI and in SDK payloads."},tags:{icon:a.jsx(sc,{}),text:"Tags are used to label flags in Unleash. They can be used when filtering flags in the UI. Additionally, they are used by some integrations."},type:{icon:a.jsx(br,{}),text:"A flag's type conveys its purpose. All types have the same capabilities, but choosing the right type signals what kind of flag it is. You can change this at any time."},impressionData:{icon:a.jsx(c5,{}),text:"Impression data is used to track how your flag is performing. When enabled, you can subscribe to 'impression events' in the SDK and process them according to your needs."}},Yf=({open:e,onClose:t,onSuccess:n,skipNavigationOnComplete:i})=>{if(e)return a.jsx(Hf,{open:e,onClose:t,skipNavigationOnComplete:i,onSuccess:n})},Hf=({open:e,onClose:t,skipNavigationOnComplete:n,onSuccess:i})=>{var U,U1,C1;const{setToastData:c,setToastApiError:s}=$1(),{uiConfig:o,isOss:l}=p1(),d=te(),m=zf(),[f,v]=w0("flag-creation-dialog",{},60*60*1e3),g=f,{type:p,setType:x,tags:j,setTags:y,name:b,setName:S,project:C,setProject:T,description:$,setDescription:Z,validateToggleName:O,impressionData:N,setImpressionData:z,getTogglePayload:V,clearErrors:M,errors:H}=xd(g),{createFeatureToggle:K,loading:A}=Mr(),Y={icon:a.jsx(br,{}),text:"Feature flags are at the core of Unleash. Use them to control your feature rollouts.",link:{url:"https://docs.getunleash.io/reference/feature-toggles",label:"Feature flags documentation"}},[W,E]=h.useState(Y),w=()=>E(Y),_=V(),F=()=>`curl --location --request POST '${o.unleashUrl}/api/admin/projects/${C}/features' \\
2
2
  --header 'Authorization: INSERT_API_KEY' \\
3
3
  --header 'Content-Type: application/json' \\
4
4
  --data-raw '${JSON.stringify(_,void 0,2)}'`,G=async n1=>{if(n1.preventDefault(),M(),await O()){const A1=V();try{await K(C,A1),n||d(`/projects/${C}/features/${b}`),c({text:"Flag created successfully",type:"success"}),t(),i==null||i(),v({}),m()}catch(de){s(_1(de))}}},{total:q,loading:l1}=bd(1),{project:m1}=X1(C),{tags:J}=nc(),{globalFlagLimitReached:t1,projectFlagLimitReached:r1,limitMessage:s1}=Lf({global:{limit:o.resourceLimits.featureFlags,count:q??0},project:{limit:m1.featureLimit||void 0,count:ac(m1)??0}}),{projects:i1}=rc(),{featureTypes:d1}=jd(),x1=wd(p),M1=d1.reduce((n1,b1)=>n1>=b1.name.length?n1:b1.name.length,0),u1=h.useMemo(()=>{const n1=i1.find(b1=>b1.id===C);return n1==null?void 0:n1.name},[C,i1]),q1=()=>{v({name:b,tags:j,impressionData:N,type:p,description:$}),t()};return a.jsx(Bf,{open:e,onClose:q1,children:a.jsx(Qe,{compact:!0,disablePadding:!0,description:W.text,documentationIcon:W.icon,documentationLink:(U=W.link)==null?void 0:U.url,documentationLinkLabel:(U1=W.link)==null?void 0:U1.label,formatApiCode:F,useFixedSidebar:!0,children:a.jsx(yd,{createButtonProps:{projectId:C,disabled:A||l1||t1||r1,permission:E2,tooltipProps:{title:s1,arrow:!0}},description:$,namingPattern:m1.featureNaming,errors:H,handleSubmit:G,Icon:a.jsx(br,{}),validateName:O,Limit:a.jsx(ic,{name:"feature flags",limit:o.resourceLimits.featureFlags,currentValue:q??0}),name:b,onClose:t,resource:"feature flag",setDescription:Z,setName:S,configButtons:a.jsxs(a.Fragment,{children:[a.jsx(R,{condition:!l(),show:a.jsx(jr,{tooltip:{header:"Select a project for the flag"},description:We.project.text,options:i1.map(n1=>({label:n1.name,value:n1.id})),onChange:n1=>{T(n1)},button:{label:u1??C,icon:We.project.icon,labelWidth:"20ch"},search:{label:"Filter projects",placeholder:"Select project"},onOpen:()=>E(We.project),onClose:w})}),a.jsx(_d,{tooltip:{header:"Select tags"},description:We.tags.text,selectedOptions:new Set(Array.from(j).map(n1=>`${n1.type}:${n1.value}`)),options:J.map(n1=>({label:cc(n1),value:`${n1.type}:${n1.value}`})),onChange:n1=>{const b1=Array.from(n1).map(A1=>{const[de,e3]=A1.split(":");return{type:de,value:e3}});y(new Set(b1))},button:{label:j.size>0?`${j.size} selected`:"Tags",labelWidth:"11ch",icon:a.jsx(sc,{})},search:{label:"Filter tags",placeholder:"Select tags"},onOpen:()=>E(We.tags),onClose:w}),a.jsx(jr,{tooltip:{header:"Select a flag type"},description:We.type.text,options:d1.map(n1=>({label:n1.name,value:n1.id})),onChange:n1=>{x(n1)},button:{label:((C1=d1.find(n1=>n1.id===p))==null?void 0:C1.name)||"Select flag type",icon:a.jsx(x1,{}),labelWidth:`${M1}ch`},search:{label:"Filter flag types",placeholder:"Select flag type"},onOpen:()=>E({text:We.type.text,icon:a.jsx(x1,{})}),onClose:w}),a.jsx(Vf,{tooltip:{header:"Enable or disable impression data",description:We.impressionData.text},currentValue:N,onClick:()=>z(!N),label:`Impression data ${N?"on":"off"}`,icon:a.jsx(c5,{}),labelWidth:"19ch"})]})})})})},Uf=u(R2)(()=>({whiteSpace:"nowrap"})),Xc=({variant:e,text:t="New feature flag",skipNavigationOnComplete:n,isLoading:i,onSuccess:c})=>{const{loading:s}=p1(),[o]=V2(),l=e1("projectId"),d=!!o.get("create"),[m,f]=h.useState(d);return a.jsxs(a.Fragment,{children:[a.jsx(Uf,{onClick:()=>f(!0),maxWidth:"960px",Icon:Je,projectId:l,disabled:s||i,variant:e,permission:E2,"data-testid":s||i?"":Cd,children:t}),a.jsx(Yf,{open:m,onClose:()=>f(!1),skipNavigationOnComplete:n,onSuccess:c})]})},kf=({isLoading:e,totalItems:t,searchQuery:n,onChangeSearchQuery:i,environmentsToExport:c,actions:s})=>{const o=e1("projectId"),l=N3(e||!1),[d,m]=h.useState(!0),f=O1(),v=K1(f.breakpoints.down("md")),[g,p]=h.useState(!1),{trackEvent:x}=T1(),j=W3("projectOverviewRefactorFeedback"),{openFeedback:y}=lc("newProjectOverview","automatic"),b=C=>{i==null||i(C),x("search-bar",{props:{screen:"project",length:C.length}})},S=()=>{y({title:"How easy was it to work with the project overview in Unleash?",positiveLabel:"What do you like most about the updated project overview?",areasForImprovementsLabel:"What improvements are needed in the project overview?"})};return a.jsx(D,{ref:l,"aria-busy":e,"aria-live":"polite",sx:C=>({padding:`${C.spacing(2.5)} ${C.spacing(3.125)}`}),children:a.jsx(S1,{titleElement:d?`Feature flags ${t!==void 0?`(${t})`:""}`:null,actions:a.jsxs(a.Fragment,{children:[a.jsx(R,{condition:!v,show:a.jsx(me,{"data-loading":!0,placeholder:"Search and Filter",expandable:!0,initialValue:n||"",onChange:b,onFocus:()=>m(!1),onBlur:()=>m(!0),hasFilters:!0,id:"projectFeatureFlags"})}),s,a.jsx(S1.Divider,{sx:{marginLeft:0}}),a.jsx(Y1,{title:"Export all project flags",arrow:!0,children:a.jsx(E1,{"data-loading":!0,onClick:()=>p(!0),sx:C=>({marginRight:C.spacing(2)}),children:a.jsx(Sd,{})})}),a.jsx(R,{condition:!e,show:a.jsx(tc,{showExportDialog:g,project:o,data:[],onClose:()=>p(!1),environments:c||[]})}),a.jsx(R,{condition:j&&!v,show:a.jsx(a1,{startIcon:a.jsx(Od,{}),onClick:S,variant:"outlined","data-loading":!0,children:"Provide feedback"})}),a.jsx(Xc,{isLoading:e})]}),children:a.jsx(R,{condition:v,show:a.jsx(me,{initialValue:n||"",onChange:b,hasFilters:!0,id:"projectFeatureFlags"})})})})},qf=u(Dd)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.bodySize})),Kf=()=>a.jsx(I3,{arrow:!0,title:a.jsxs(a.Fragment,{children:["This environment has no variants enabled. If you check this feature's variants in this environment, you will get the"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/feature-toggle-variants#the-disabled-variant",target:"_blank",rel:"noreferrer",children:"disabled variant"}),"."]}),children:a.jsx(qf,{})}),es=u("div",{shouldForwardProp:e=>e!=="hasWarning"})(({theme:e,hasWarning:t})=>({flexGrow:0,...M2,justifyContent:"center",...t&&{"::before":{content:'""',display:"block",width:e.spacing(2)}}})),Gf=u("div")(({theme:e})=>({flexGrow:0,...M2,justifyContent:"center"})),Qf=({value:e,featureId:t,projectId:n,environment:i,isChangeRequestEnabled:c,someEnabledEnvironmentHasVariants:s,refetch:o,onFeatureToggleSwitch:l})=>{const d=h.useMemo(()=>s&&(i==null?void 0:i.variantCount)===0&&(i==null?void 0:i.enabled),[s,i]),m=(f,v)=>{l(f,{projectId:n,featureId:t,environmentName:(i==null?void 0:i.name)||"",environmentType:i==null?void 0:i.type,hasStrategies:i==null?void 0:i.hasStrategies,hasEnabledStrategies:i==null?void 0:i.hasEnabledStrategies,isChangeRequestEnabled:c,onRollback:v,onSuccess:o})};return a.jsxs(es,{hasWarning:d,children:[a.jsx(lm,{projectId:n,value:e,featureId:t,environmentName:(i==null?void 0:i.name)||"",onToggle:m}),a.jsx(R,{condition:d||!1,show:a.jsx(Kf,{})})]})},Jf=$e.memo(Qf),Xf=()=>a.jsx(es,{children:a.jsx("div",{"data-loading":!0,children:"toggle"})}),ep=()=>a.jsx(Gf,{"aria-hidden":"true",children:"-"}),tp=e=>{const t=`api/admin/projects/${e}/flag-creators`,{data:n,refetch:i,loading:c,error:s}=Rr(N1(t),()=>Vr(N1(t),"Flag creators"));return{flagCreators:n||[],refetch:i,error:s}},np=({state:e,onChange:t,project:n})=>{const{tags:i}=nc(),{flagCreators:c}=tp(n),[s,o]=h.useState([]);return h.useEffect(()=>{const l=(i||[]).map(v=>{const g=cc(v);return{label:g,value:g}}),d=c.map(v=>({label:v.name,value:String(v.id)}));o([{label:"State",icon:"hexagon",options:[{label:"Active",value:"active"},{label:"Stale",value:"stale"},{label:"Potentially stale",value:"potentially-stale"}],filterKey:"state",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Tags",icon:"label",options:l,filterKey:"tag",singularOperators:["INCLUDE","DO_NOT_INCLUDE"],pluralOperators:["INCLUDE_ALL_OF","INCLUDE_ANY_OF","EXCLUDE_IF_ANY_OF","EXCLUDE_ALL"]},{label:"Created date",icon:"today",options:[],filterKey:"createdAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Last seen",icon:"monitor_heart",options:[],filterKey:"lastSeenAt",dateOperators:["IS_ON_OR_AFTER","IS_BEFORE"]},{label:"Flag type",icon:"flag",options:[{label:"Release",value:"release"},{label:"Experiment",value:"experiment"},{label:"Operational",value:"operational"},{label:"Kill switch",value:"kill-switch"},{label:"Permission",value:"permission"}],filterKey:"type",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Created by",icon:"person",options:d,filterKey:"createdBy",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]},{label:"Show only archived",icon:"inventory",options:[{label:"True",value:"true"}],filterKey:"archived",singularOperators:["IS"],pluralOperators:["IS_ANY_OF"]},{label:"Lifecycle stage",icon:"model_training",options:[{label:"Define",value:"initial"},{label:"Develop",value:"pre-live"},{label:"Rollout production",value:"live"},{label:"Cleanup",value:"completed"}],filterKey:"lifecycle",singularOperators:["IS","IS_NOT"],pluralOperators:["IS_ANY_OF","IS_NONE_OF"]}])},[JSON.stringify(i),JSON.stringify(c)]),a.jsx($d,{availableFilters:s,state:e,onChange:t})},J0=["select","actions","name","favorite"],X0=(e,t)=>e.reduce((n,i)=>({...n,[i]:t.includes(i)}),{}),ap=e=>{const t=O1(),n=K1(t.breakpoints.down("sm")),i=K1(t.breakpoints.down("md")),c=K1(t.breakpoints.down("lg")),s=h.useCallback((o=0)=>e.filter(l=>l.startsWith("environment:")),[e]);return n?X0(e,[...J0,"createdAt"]):i?X0(e,[...J0,"createdAt",...s(1)]):c?X0(e,[...J0,"createdAt","type",...s(1)]):X0(e,[...J0,"lastSeenAt","lifecycle","createdAt","createdBy","type","tags",...s(3)])},rp=({query:e})=>{var t;return((t=e||"")==null?void 0:t.length)>0?a.jsx(D,{sx:n=>({padding:n.spacing(3)}),children:a.jsxs(ee,{children:["No feature flags found matching “",e,"”"]})}):a.jsx(D,{sx:n=>({padding:n.spacing(3)}),children:a.jsx(ee,{children:"No feature flags available."})})},ip=(e,t,n)=>{const[i,c]=h.useState(),[s,o]=h.useState({}),[l,d]=h.useState({featureId:"default",open:!1}),[m,f]=h.useState({featureId:"default",open:!1}),[v,g]=h.useState({featureId:"default",open:!1});return{rowActionsDialogs:a.jsxs(a.Fragment,{children:[a.jsx(dm,{isStale:!!s.stale,isOpen:!!s.featureId,onClose:()=>{o({}),e()},featureId:s.featureId||"",projectId:t}),a.jsx(Uc,{isOpen:!!i,onConfirm:()=>{e(),n==null||n()},onClose:()=>{c(void 0)},featureIds:[i||""],projectId:t}),a.jsx(im,{isOpen:l.open,setIsOpen:x=>{d({...l,open:x})},projectId:t,featureId:l.featureId,onComplete:e}),a.jsx(dc,{deletedFeatures:[v.featureId],projectId:t,open:v.open,setOpen:x=>{g(j=>({...j,open:x}))},refetch:e}),a.jsx(uc,{revivedFeatures:[m.featureId],projectId:t,open:m.open,setOpen:x=>{f(j=>({...j,open:x}))},refetch:()=>{f(x=>({...x,open:!1})),e()}})]}),setFeatureArchiveState:c,setFeatureStaleDialogState:o,setShowMarkCompletedDialogue:d,setShowFeatureReviveDialogue:f,setShowFeatureDeleteDialogue:g}},cp=(e,t)=>{const[n,i]=h.useState([]);return h.useEffect(()=>{i(c=>{const s=[...e];return c.forEach(o=>{s.find(l=>l.name===o.name)||s.push(o)}),s.filter(o=>t[o.name])})},[e,t]),n},ts=(e,t="project-overview-v2",n=15*1e3)=>{const i={offset:Ce(v2,0),limit:Ce(v2,Td),query:Z3,favoritesFirst:Ce(Pd,!0),sortBy:Ce(Z3,"createdAt"),sortOrder:Ce(Z3,"desc"),columns:Ed,tag:Ne,state:Ne,createdAt:Ne,lastSeenAt:Ne,type:Ne,createdBy:Ne,archived:Ne,lifecycle:Ne},[c,s]=hc(`${t}-${e}`,i),{columns:o,...l}=c,{features:d,total:m,refetch:f,loading:v,initialLoad:g}=mc(fc({...pc(i,l),project:`IS:${e}`},p=>p?`${p}`:void 0),{refreshInterval:n});return{features:d,total:m,refetch:f,loading:v,initialLoad:g,tableState:c,setTableState:s}},sp=(e,t)=>{const n=(o,l)=>{const d=e[o.key];d&&d.values.length>0&&!d.values.includes(l)?t({[o.key]:{operator:d.operator,values:[...d.values,l]}}):d||t({[o.key]:{operator:o.operator,values:[l]}})};return{onFlagTypeClick:o=>n({key:"type",operator:"IS"},o),onTagClick:o=>n({key:"tag",operator:"INCLUDE"},o),onAvatarClick:o=>n({key:"createdBy",operator:"IS"},o.toString())}},s5=(e,t={})=>{const n=N1(`api/admin/projects/${e}/api-tokens`),{data:i,error:c,mutate:s}=g3(n,op,t),o=h.useMemo(()=>i??[],[i]),l=h.useCallback(()=>{s().catch(console.warn)},[s]);return{tokens:o,error:c,loading:!c&&!i,refetch:l}},op=async e=>(await(await fetch(e).then(ne("Project Api tokens"))).json()).tokens,o5=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:i}=L2({propagateErrors:!0});return{deleteToken:async(o,l)=>{const d=`api/admin/projects/${l}/api-tokens/${o}`,m=t(d,{method:"DELETE"});return e(m.caller,m.id)},createToken:async(o,l)=>{const d=`api/admin/projects/${l}/api-tokens`,m=t(d,{method:"POST",body:JSON.stringify(o)});return e(m.caller,m.id)},errors:n,loading:i}},lp=e=>{if(!e)return null;const[t,n]=e.split(":",2);if(!n)return null;const[i,c,...s]=n.split(".");return t&&i&&c&&s.length===0?{project:t,environment:i,secret:c}:null},A3=u("div")(({theme:e})=>({fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(1),fontSize:e.typography.body1.fontSize})),Q2=u("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:e.spacing(2)})),dp=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1)})),up=u("div")(({theme:e})=>({background:e.palette.background.application,borderRadius:e.shape.borderRadius,width:e.spacing(7),height:e.spacing(1)})),hp=u("div")(({theme:e})=>({background:e.palette.background.sidebar,borderRadius:e.shape.borderRadius,width:e.spacing(7),height:e.spacing(1)})),J2=({active:e,steps:t})=>a.jsx(dp,{children:Array.from({length:t},(n,i)=>i===e?a.jsx(hp,{},i):a.jsx(up,{},i))}),mp=({environments:e,onSelect:t,currentEnvironment:n})=>{const i=Math.max(...e.map(c=>c.length));return a.jsx(jr,{tooltip:{header:""},description:"Select the environment where the API key will be created",options:e.map(c=>({label:c,value:c})),onChange:c=>{t(c)},button:{label:n,icon:a.jsx(vc,{}),labelWidth:`${i+5}ch`},search:{label:"Filter project mode options",placeholder:"Select project mode"}})},fp=u("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(3),display:"flex",flexDirection:"column",alignItems:"center"})),F4=u("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:e.spacing(2),flex:1,color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize})),pp=u(D)(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"flex-start",marginTop:e.spacing(8),flexWrap:"wrap"})),R4=u("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,marginBottom:e.spacing(2)})),vp=u("div")(({theme:e})=>({padding:e.spacing(5,8,3,8),display:"flex",flexDirection:"column",gap:e.spacing(3)})),gp=({project:e,environment:t,secret:n})=>{const i=O1(),c=K1(i.breakpoints.up("lg"));return a.jsx(o3.ArcherContainer,{strokeColor:i.palette.secondary.border,endMarker:!1,lineStyle:"curve",children:a.jsxs(fp,{children:[a.jsxs(D,{sx:{wordBreak:"break-all"},children:[a.jsx(o3.ArcherElement,{id:"project",children:a.jsx("span",{children:e})}),":",a.jsx(o3.ArcherElement,{id:"environment",children:a.jsx("span",{children:t})}),".",a.jsx(o3.ArcherElement,{id:"secret",children:a.jsx("span",{children:n})})]}),c?a.jsxs(pp,{children:[a.jsx(o3.ArcherElement,{id:"project-description",relations:[{targetId:"project",targetAnchor:"bottom",sourceAnchor:"top"}],children:a.jsx(F4,{children:"The project this API key can retrieve feature flags from"})}),a.jsx(o3.ArcherElement,{id:"environment-description",relations:[{targetId:"environment",targetAnchor:"bottom",sourceAnchor:"top"}],children:a.jsx(F4,{children:"The environment this API key can retrieve feature flag configuration from"})}),a.jsx(o3.ArcherElement,{id:"secret-description",relations:[{targetId:"secret",targetAnchor:"right",sourceAnchor:"top"}],children:a.jsx(F4,{children:"The API key secret"})})]}):null]})})},xp=({environments:e,environment:t,project:n,sdkType:i,onEnvSelect:c,onApiKey:s})=>{const{trackEvent:o}=T1(),{tokens:l,refetch:d}=s5(n),{createToken:m,loading:f}=o5(),v=l.find(y=>y.environment===t&&y.type===i);h.useEffect(()=>{s((v==null?void 0:v.secret)||null)},[v]);const g=lp(v==null?void 0:v.secret),{setToastApiError:p}=$1(),x=async()=>{try{await m({environment:t,type:i,projects:[n],tokenName:`api-key-${n}-${t}`},n),d(),j()}catch(y){p(_1(y))}},j=()=>{o("onboarding",{props:{eventType:"api-key-generated"}})};return a.jsxs(vp,{children:[a.jsx(I,{variant:"h2",children:"Connect an SDK to Unleash"}),a.jsxs(Q2,{children:[a.jsx(J2,{active:1,steps:3}),a.jsx(z3,{color:"secondary",children:"2/3 - Generate API Key"})]}),a.jsxs(D,{sx:{mt:2},children:[a.jsx(A3,{children:"Environment"}),a.jsx(R4,{children:"The environment the SDK connects to to retrieve configuration."}),e.length>0?a.jsx(mp,{environments:e,currentEnvironment:t,onSelect:c}):null]}),a.jsxs(D,{sx:{mt:3},children:[a.jsx(A3,{children:"API Key"}),g?a.jsxs(R4,{children:["Here is your generated API key. We will use it to connect to the ",a.jsx("b",{children:g.project})," project in the ",a.jsx("b",{children:g.environment})," environment."]}):a.jsx(R4,{children:"You currently have no active API keys for this project/environment combination. Generate an API key to proceed with connecting your SDK."}),g?a.jsx(gp,{project:g.project,environment:g.environment,secret:g.secret}):a.jsx(a1,{variant:"contained",disabled:f,onClick:x,children:"Generate API Key"})]})]})},ns=[{name:"Node.js",icon:Zd},{name:"Go",icon:Id},{name:"Ruby",icon:Md},{name:"PHP",icon:Ad},{name:"Rust",icon:Fd},{name:".NET",icon:Rd},{name:"Java",icon:Vd},{name:"Python",icon:Ld}],as=[{name:"JavaScript",icon:Nd},{name:"React",icon:Wd},{name:"Vue",icon:zd},{name:"Svelte",icon:Bd},{name:"Swift",icon:Yd},{name:"Android",icon:Hd},{name:"Flutter",icon:Ud}],rs=[...ns,...as],bp=u("div")(({theme:e})=>({padding:e.spacing(5,8,8,8),display:"flex",flexDirection:"column",gap:e.spacing(3)})),E8=u("div")(({theme:e})=>({marginTop:e.spacing(4),marginBottom:e.spacing(2),fontSize:e.typography.body1.fontSize})),Z8=u("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(6),display:"flex",columnGap:e.spacing(2),rowGap:e.spacing(5),alignItems:"center",justifyContent:"flex-start",flexWrap:"wrap"})),I8=u("div")(({theme:e})=>({fontSize:e.typography.body2.fontSize,backgroundColor:e.palette.background.default,borderRadius:e.shape.borderRadius,padding:e.spacing(2,3),width:"170px",position:"relative"})),M8=u("div")(()=>({display:"flex",justifyContent:"space-between"})),A8=u(x3)(({theme:e})=>({position:"absolute",width:e.spacing(4),height:e.spacing(4),top:e.spacing(-2.75),left:e.spacing(2),boxShadow:e.shadows[2]})),jp=({onSelect:e})=>a.jsxs(bp,{children:[a.jsx(I,{variant:"h2",children:"Connect an SDK to Unleash"}),a.jsxs(Q2,{children:[a.jsx(J2,{active:0,steps:3}),a.jsx(z3,{color:"secondary",children:"1/3 - Choose SDK"})]}),a.jsxs(D,{sx:{mt:2},children:[a.jsx(A3,{children:"Select SDK"}),a.jsx(E8,{children:"Server side SDKs"}),a.jsx(Z8,{children:ns.map(t=>a.jsxs(I8,{children:[a.jsx(A8,{src:S0(t.icon)}),a.jsxs(M8,{children:[a.jsx("b",{children:t.name})," ",a.jsx(ce,{onClick:()=>e({name:t.name,type:"client"}),component:"button",children:"Select"})]})]},t.name))}),a.jsx(E8,{children:"Client side SDKs"}),a.jsx(Z8,{children:as.map(t=>a.jsxs(I8,{children:[a.jsx(A8,{src:S0(t.icon)}),a.jsxs(M8,{children:[a.jsx("b",{children:t.name})," ",a.jsx(ce,{onClick:()=>e({name:t.name,type:"frontend"}),component:"button",children:"Select"})]})]},t.name))})]})]}),is=u("div")(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(12,6,6,6),flex:0,minWidth:"400px"})),u2=u("p")(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.caption.fontSize,marginBottom:e.spacing(2)})),l5=({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize,marginTop:e.spacing(.5)}),yp=u(oc)(l5),_p=u(vc)(l5),cs=u(kd)(l5),h2=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5),alignItems:"flex-start",marginTop:e.spacing(3)})),m2=u("div")(({theme:e})=>({color:e.palette.primary.contrastText,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(2)})),wp=()=>a.jsxs(is,{children:[a.jsxs(h2,{children:[a.jsx(yp,{}),a.jsxs(D,{children:[a.jsx(m2,{children:"Flags live in projects"}),a.jsx(u2,{children:"Projects are containers for feature flags. Each flag belongs to the project where you create it."})]})]}),a.jsxs(h2,{children:[a.jsx(_p,{}),a.jsxs(D,{children:[a.jsx(m2,{children:"Flags have configuration in environments"}),a.jsx(u2,{children:"You can have multiple environments, and each feature flag has a different configuration per environment."})]})]}),a.jsxs(h2,{children:[a.jsx(cs,{}),a.jsxs(D,{children:[a.jsx(m2,{children:"SDKs connect to Unleash to retrieve configuration"}),a.jsx(u2,{children:"When you connect an SDK to Unleash, it uses the API key to identify which feature flags and configuration to retrieve from each environment."})]})]})]}),Sp=()=>a.jsx(is,{children:a.jsxs(h2,{children:[a.jsx(cs,{}),a.jsxs(D,{children:[a.jsx(m2,{children:"SDKs and Unleash"}),a.jsx(u2,{children:"SDKs serve to bind your application to Unleash. The SDK can connect to Unleash via HTTP and retrieve feature flag configuration that is then cached in your application. Making sure none of your application data ever leaves your servers."})]})]})}),ss=u(x3,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({transition:"background-color 0.5s ease",color:e.palette.common.white,backgroundColor:t?e.palette.primary.main:e.palette.divider,"@keyframes pulse":{"0%":{boxShadow:`0 0 0 0px ${Ke(e.palette.primary.main,.7)}`},"100%":{boxShadow:`0 0 0 20px ${Ke(e.palette.primary.main,0)}`}},animation:t?"pulse 2s infinite":""})),Op=u(x3,{shouldForwardProp:e=>e!=="active"})(({theme:e,active:t})=>({transition:"background-color 0.5s ease",color:e.palette.primary.main,backgroundColor:t?e.palette.background.default:e.palette.divider,"@keyframes pulse":{"0%":{boxShadow:`0 0 0 0px ${Ke(e.palette.background.default,.7)}`},"100%":{boxShadow:`0 0 0 20px ${Ke(e.palette.background.default,0)}`}},animation:t?"pulse 2s infinite":""}));var d5={},Cp=J1;Object.defineProperty(d5,"__esModule",{value:!0});var X2=d5.default=void 0,Dp=Cp(Q1()),$p=a,Tp=(0,Dp.default)((0,$p.jsx)("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");X2=d5.default=Tp;const Pp=u("div")(({theme:e})=>({backgroundColor:e.palette.background.sidebar,padding:e.spacing(6,9,6,9),minWidth:"400px",display:"flex",flexDirection:"column",color:e.palette.primary.contrastText})),Ep=u(I)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",fontWeight:e.typography.fontWeightBold})),Zp=u("div")(({theme:e})=>({display:"flex",flexDirection:"row",padding:e.spacing(4,0,12,0),justifyContent:"space-between",fontSize:e.spacing(1)})),F8=u("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexDirection:"column"})),R8=u("div")(({theme:e})=>({alignItems:"center",justifyContent:"center",display:"flex",gap:e.spacing(2),flexDirection:"column",fontSize:e.fontSizes.smallBody})),Ip=u(R3)(({theme:e})=>({color:e.palette.primary.main,backgroundColor:e.palette.background.paper,borderRadius:"50%",padding:e.spacing(1),width:"80px",height:"80px"})),Mp=({projectId:e,sdk:t,environment:n})=>{const i=O1(),{project:c}=X1(e,{refreshInterval:1e3}),s=c.onboardingStatus.status==="onboarded";return a.jsxs(Pp,{children:[a.jsx(Ep,{children:"Connection information"}),a.jsxs(Zp,{children:[a.jsxs(F8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Environment"}),a.jsx(I,{variant:"body2",children:n})]}),a.jsxs(F8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"SDK"}),a.jsx(I,{variant:"body2",children:t})]})]}),s?a.jsxs(R8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Connection status"}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"Connected"}),a.jsx(Ip,{}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"We received metrics from your application!"})]}):a.jsxs(R8,{children:[a.jsx(I,{fontWeight:"bold",variant:"body2",children:"Connection status"}),a.jsx(I,{sx:{mb:i.spacing(4)},variant:"body2",children:"Waiting for SDK data..."}),a.jsx(Op,{sx:{width:80,height:80},active:!0,children:a.jsx(X2,{fontSize:"large"})})]})]})},Ap=`1\\. Install the SDK
@@ -706,7 +706,7 @@ The flag name should contain the project name, the feature name, and the ticket
706
706
  --header 'Authorization: INSERT_API_KEY' \\
707
707
  --header 'Content-Type: application/json' \\
708
708
  --data-raw '${JSON.stringify(b(),void 0,2)}'`,V=async M=>{M.preventDefault();const H=b();if(T())try{await Z(t,H),N(),i({text:"Project information updated",type:"success"}),f!==bh&&o("project_stickiness_set")}catch(A){c(_1(A))}};return a.jsx(uw,{children:a.jsx(Qe,{loading:O,title:"General settings",description:"Projects allow you to group feature flags together in the management UI.",documentationLink:"https://docs.getunleash.io/reference/projects#update-a-project",documentationLinkLabel:"Projects documentation",formatApiCode:z,compactPadding:!0,compact:!0,children:a.jsx(hw,{children:a.jsx(dw,{errors:$,handleSubmit:V,projectId:l,setProjectId:p,projectName:d,setProjectName:x,projectStickiness:f,setProjectStickiness:y,setFeatureLimit:g,featureLimit:v,projectDesc:m,setProjectDesc:j,mode:"Edit",clearErrors:S,validateProjectId:C,children:a.jsx(y3,{type:"submit",permission:[G1,Ac],projectId:l,"data-testid":mw,children:"Save changes"})})})})})},pw=({open:e,onClose:t,project:n,onSuccess:i})=>{const{archiveProject:c}=Ge(),{refetch:s}=rc(),{setToastData:o,setToastApiError:l}=$1(),d=async m=>{m.preventDefault();try{await c(n),s(),o({text:"Project archived",type:"success"}),i==null||i()}catch(f){l(_1(f))}t(m)};return a.jsx(le,{open:e,onClick:d,onClose:t,title:"Are you sure?",children:a.jsx(I,{children:"The project will be moved to the projects archive, where it can either be revived or permanently deleted."})})},vw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",borderTop:`1px solid ${e.palette.divider}`,paddingTop:e.spacing(4),gap:e.spacing(2)})),gw=u("div")(({theme:e})=>({display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(3)})),xw=({projectId:e,featureCount:t})=>{const[n,i]=h.useState(!1),c=te(),s=t>0;return a.jsxs(vw,{children:[a.jsx("p",{children:"Before you can archive a project, you must first archive all of the feature flags associated with it."}),a.jsx(R,{condition:t>0,show:a.jsxs("p",{children:["Currently there ",t<=1?"is":"are"," ",a.jsx(ce,{component:g1,to:"../..",children:a.jsxs("strong",{children:[t," active feature"," ",t===1?"flag":"flags","."]})})]})}),a.jsx(gw,{children:a.jsx(y3,{permission:jh,disabled:s,projectId:e,onClick:()=>{i(!0)},tooltipProps:{title:"Archive project"},"data-loading":!0,children:"Archive project"})}),a.jsx(pw,{project:e,open:n,onClose:()=>{i(!1)},onSuccess:()=>{c("/projects")}})]})},bw=u("div")(({theme:e})=>({borderRadius:e.spacing(2),overflow:"hidden"})),jw=({featureCount:e})=>{const t=e1("projectId"),{uiConfig:n}=p1(),{loading:i}=Ge(),c=()=>`curl --location --request POST '${n.unleashUrl}/api/admin/projects/archive/${t}' \\
709
- --header 'Authorization: INSERT_API_KEY'`;return a.jsx(bw,{children:a.jsx(Qe,{loading:i,title:"Archive project",description:"",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:c,compact:!0,compactPadding:!0,showDescription:!1,showLink:!1,children:a.jsx(xw,{projectId:t,featureCount:e})})})},yw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),_w=()=>{const{isEnterprise:e}=p1(),{hasAccess:t}=h.useContext(Ee),n=e1("projectId"),{project:i}=X1(n);if(!i.name)return null;const c=!t([G1,Ac],n)&&a.jsx(Z1,{severity:"error",sx:{mb:4},children:"You do not have the required permissions to edit this project."});return a.jsxs(a.Fragment,{children:[c,a.jsxs(yw,{children:[a.jsx(fw,{project:i}),a.jsx(R,{condition:e(),show:a.jsx(J_,{project:i})}),a.jsx(jw,{featureCount:ac(i)??0})]})]})},ww=()=>{const e=e1("projectId"),t=je(e),{hasAccess:n}=h.useContext(Ee),{isOss:i}=p1();return pe(`Project configuration – ${t}`),i()?a.jsx(R1,{header:a.jsx(S1,{title:"General settings"}),sx:{justifyContent:"center"},children:a.jsx(A0,{feature:"project-settings"})}):n([G1,yh],e)?a.jsx(_w,{}):a.jsx(R1,{header:a.jsx(S1,{title:"General settings"}),children:a.jsx(Z1,{severity:"error",children:"You need project owner permissions to access this section."})})},Sw={actions:[]},Z5=e=>{const{isEnterprise:t}=p1(),n=W3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,Sw,N1(`api/admin/projects/${e}/actions`),Ow);return h.useMemo(()=>({actions:(i==null?void 0:i.actions)??[],loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},Ow=e=>fetch(e).then(ne("Actions")).then(t=>t.json()),Vs=e=>{const{loading:t,makeRequest:n,createRequest:i,errors:c}=L2({propagateErrors:!0}),s=`api/admin/projects/${e}/actions`,o=async g=>{const x=i(s,{method:"POST",body:JSON.stringify(g)},"addActionSet");return(await n(x.caller,x.id)).json()},l=async(g,p)=>{const j=i(`${s}/${g}`,{method:"PUT",body:JSON.stringify(p)},"updateActionSet");await n(j.caller,j.id)},d=async g=>{const x=i(`${s}/${g}/on`,{method:"POST"},"enableActionSet");await n(x.caller,x.id)},m=async g=>{const x=i(`${s}/${g}/off`,{method:"POST"},"disableActionSet");await n(x.caller,x.id)};return{addActionSet:o,updateActionSet:l,removeActionSet:async g=>{const x=i(`${s}/${g}`,{method:"DELETE"},"removeActionSet");await n(x.caller,x.id)},toggleActionSet:async(g,p)=>{p?await d(g):await m(g)},errors:c,loading:t}},Cw=u(D)({display:"flex",alignItems:"center"}),Dw=u(x3)(({theme:e})=>({background:"transparent",borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(3),height:e.spacing(3),fontSize:e.fontSizes.mainHeader})),$w=u(ce)(({theme:e})=>({..._h(e),"&:hover, &:focus":{textDecoration:"underline"}})),Tw=({action:e,signalEndpoints:t})=>{const{sourceId:n,source:i}=e.match;if(i==="signal-endpoint"){const c=t.find(({id:s})=>s===n);if(c)return a.jsx(w1,{children:a.jsxs(Cw,{children:[a.jsx(I3,{title:"Signal endpoint",arrow:!0,children:a.jsx(Dw,{src:S0(wh),alt:"Signal endpoint",variant:"rounded"})}),a.jsx($w,{component:g1,to:"/integrations/signals",underline:"hover",children:c.name})]})})}return a.jsx(w1,{children:"No source"})},Pw=u(I)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Ew=({action:e})=>{const{payload:t}=e.match,n=Object.entries(t);return n.length===0?a.jsx(w1,{children:"0 filters"}):a.jsx(w1,{children:a.jsx(Q3,{tooltipProps:{maxWidth:500},tooltip:a.jsx(a.Fragment,{children:n.map(([i,{inverted:c,operator:s,caseInsensitive:o,value:l,values:d}])=>{const m=_r(s),f=c?a.jsxs(a.Fragment,{children:["is ",a.jsx("u",{children:"not"})," ",m.substring(2)]}):m;return a.jsxs(Pw,{children:[a.jsx("strong",{children:i})," ",f,o?" (case insensitive)":"",": ",a.jsx("strong",{children:d?d.join(", "):l})]},i)})}),children:n.length===1?"1 filter":`${n.length} filters`})})},Zw=({action:e,serviceAccounts:t})=>{const{actorId:n}=e,i=t.find(({id:c})=>c===n);return i?a.jsx(F0,{to:"/admin/service-accounts",title:i.name,subtitle:i.username}):a.jsx(w1,{children:"No service account"})},Iw=async e=>{const t=await fetch(e);return await ne("Action events")(t),t.json()},Ls=(e,t,n=50,i={})=>{var S;const{isEnterprise:c}=p1(),s=W3("automatedActions"),o=(C,T)=>!e||!t||!c||!s||T&&!T.actionSetEvents.length?null:N1(`api/admin/projects/${t}/actions/${e}/events?limit=${n}&offset=${C*n}`),{data:l,error:d,size:m,setSize:f,mutate:v}=Sh(o,Iw,{...i,revalidateAll:!0}),g=l?l.flatMap(({actionSetEvents:C})=>C):[],p=!l&&!d,x=m>0&&!(l!=null&&l[m-1]),j=p||x,y=((S=l==null?void 0:l[m-1])==null?void 0:S.actionSetEvents.length)===n;return{actionEvents:g,hasMore:y,loadMore:()=>{j||!y||f(m+1)},loading:j,refetch:()=>v(),error:d}},Mw=u("div",{shouldForwardProp:e=>e!=="state"})(({theme:e,state:t})=>({padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,...t==="not started"&&{backgroundColor:e.palette.background.elevation1}})),Aw=u("div")({display:"flex",flexDirection:"column"}),Fw=u("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Rw=u("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,gap:e.spacing(2)})),Vw=u(G2)(({theme:e})=>({color:e.palette.success.main}));u(Jr)(({theme:e})=>({color:e.palette.error.main}));const Lw=u(Z1)(({theme:e})=>({marginTop:e.spacing(2),fontSize:"inherit"})),Nw=u(V3)(({theme:e})=>({margin:e.spacing(2,0)})),Ww=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),zw=u("p")(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(.5)})),Bw=u("span")(({theme:e})=>({color:e.palette.text.secondary})),Yw=({action:{state:e,details:t,action:n,executionParams:i},children:c})=>{const s=e==="success"?a.jsx(Vw,{}):e==="started"?a.jsx(Xr,{size:20}):e==="not started"?a.jsx("span",{children:"Not started"}):null;return a.jsxs(Mw,{state:e,children:[a.jsxs(Aw,{children:[a.jsxs(Fw,{children:[a.jsx("div",{children:c}),a.jsx(Rw,{children:s})]}),a.jsx(R,{condition:!!t,show:a.jsx(Lw,{severity:"error",children:t})})]}),a.jsx(Nw,{}),a.jsxs(Ww,{children:[a.jsx(zw,{children:n}),Object.entries(i).map(([o,l])=>a.jsxs("div",{children:[a.jsxs(Bw,{children:[o,":"]})," ",l]},o))]})]})},Hw=h.lazy(()=>Fc(()=>import("./ReactJSONEditor-BDMT4-_1.js"),[])),Uw=u(Kr)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),kw=u(Rc)({lineHeight:"1.5rem"}),qw=u(g1)(({theme:e})=>({marginLeft:e.spacing(1)})),Kw=({signal:e})=>{const{signalEndpoints:t}=e5(),n=h.useMemo(()=>{const i=t.find(({id:c})=>c===e.sourceId);return i==null?void 0:i.name},[t,e.sourceId]);return a.jsxs(Uw,{children:[a.jsxs(kw,{expandIcon:a.jsx(E1,{children:a.jsx(Oh,{titleAccess:"Toggle"})}),children:["Signal endpoint:",a.jsx(qw,{to:"/integrations/signals",children:n})]}),a.jsx(Gr,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(Hw,{content:{json:e.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]})},Gw=({signal:e})=>{const{source:t}=e;return t==="signal-endpoint"?a.jsx(Kw,{signal:e}):null},Qw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),Jw=u(Z1)({fontSize:"inherit"}),Ns=({state:e,actionSet:{actions:t},signal:n})=>{const i=e==="failed"?`${t.filter(({state:c})=>c!=="success").length} out of ${t.length} actions were not successfully executed`:"All actions were successfully executed";return a.jsxs(Qw,{children:[a.jsx(Jw,{severity:e==="failed"?"error":"success",icon:e==="success"?a.jsx(G2,{}):void 0,children:i}),a.jsx(Gw,{signal:n}),t.map((c,s)=>a.jsxs(Yw,{action:c,children:["Action ",s+1]},c.id))]})},Xw=u(Q3)(({theme:e})=>({display:"flex",alignItems:"center"})),eS=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),tS=u("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),nS=u(G2)(({theme:e})=>({color:e.palette.success.main})),aS=u(Jr)(({theme:e})=>({color:e.palette.error.main})),rS=({action:e})=>{const{id:t,project:n}=e,{actionEvents:i}=Ls(t,n,1,{refreshInterval:5e3}),{locationSettings:c}=K3();if(i.length===0)return null;const s=i[0],o=s.state==="success"?a.jsx(nS,{}):s.state==="failed"?a.jsx(aS,{}):a.jsx(Xr,{size:20});return a.jsx(Xw,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:a.jsxs(a.Fragment,{children:[a.jsxs(eS,{children:[a.jsx(tS,{children:"Last event"}),a.jsx("span",{children:Z0(s.createdAt,c==null?void 0:c.locale)})]}),a.jsx(Ns,{...s})]}),children:o})},iS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2)})),cS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),fontSize:e.fontSizes.smallerBody})),sS=u("ul")(({theme:e})=>({listStyle:"none",paddingLeft:e.spacing(1),margin:0})),oS=({action:e,onCreateAction:t})=>{const{actions:n}=e;return n.length===0?t?a.jsx(F0,{title:"Create action",onClick:t}):a.jsx(w1,{children:"0 actions"}):a.jsxs(iS,{children:[a.jsx(rS,{action:e}),a.jsx(Q3,{tooltip:a.jsx(cS,{children:n.map(({id:i,action:c,executionParams:s})=>a.jsxs("div",{children:[a.jsx("strong",{children:c}),a.jsx(sS,{children:Object.entries(s).map(([o,l])=>a.jsxs("li",{children:[a.jsx("strong",{children:o}),":"," ",l]},o))})]},i))}),children:n.length===1?"1 action":`${n.length} actions`})]})},lS=u(D)({display:"flex",justifyContent:"center"}),dS=({actionId:e,onOpenEvents:t,onEdit:n,onDelete:i})=>{const[c,s]=h.useState(null),o=!!c,l=v=>{s(v.currentTarget)},d=()=>{s(null)},m=`action-${e}-actions`,f=`${m}-menu`;return a.jsxs(lS,{children:[a.jsx(Y1,{title:"Action actions",arrow:!0,describeChild:!0,children:a.jsx(E1,{id:m,"data-loading":!0,"aria-controls":o?f:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:l,type:"button",children:a.jsx(Ir,{})})}),a.jsx(D0,{id:f,anchorEl:c,open:o,onClose:d,onClick:d,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:a.jsxs($0,{"aria-labelledby":m,children:[a.jsx(he,{permission:d2,children:({hasAccess:v})=>a.jsxs(re,{sx:f3,onClick:t,disabled:!v,children:[a.jsx(ue,{children:a.jsx(Ch,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"View events"})})]})}),a.jsx(he,{permission:d2,children:({hasAccess:v})=>a.jsxs(re,{sx:f3,onClick:n,disabled:!v,children:[a.jsx(ue,{children:a.jsx(G3,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Edit"})})]})}),a.jsx(he,{permission:d2,children:({hasAccess:v})=>a.jsxs(re,{sx:f3,onClick:i,disabled:!v,children:[a.jsx(ue,{children:a.jsx(b3,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Remove"})})]})})]})})]})},uS=u("div")(({theme:e})=>({marginTop:e.spacing(1),position:"relative"})),hS=u("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:e.spacing(-2),left:e.spacing(2),lineHeight:1})),mS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingTop:e.spacing(1),borderRadius:e.shape.borderRadiusMedium})),Ws=u("div")({display:"flex",alignItems:"center"}),fS=u(Ws)(({theme:e})=>({justifyContent:"space-between",marginBottom:e.spacing(1)})),zs=({index:e,header:t,separator:n="AND",children:i})=>a.jsxs(uS,{children:[a.jsx(R,{condition:e>0,show:a.jsx(hS,{children:n})}),a.jsxs(mS,{children:[a.jsx(fS,{children:t}),a.jsx(Ws,{children:i})]})]}),pS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M5 18C5 18.55 5.45 19 6 19H18C18.55 19 19 18.55 19 18C19 17.45 18.55 17 18 17H6C5.45 17 5 17.45 5 18ZM9.5 12.8H14.5L15.16 14.4C15.31 14.76 15.66 15 16.05 15C16.74 15 17.2 14.29 16.93 13.66L13.05 4.69C12.87 4.27 12.46 4 12 4C11.54 4 11.13 4.27 10.95 4.69L7.07 13.66C6.8 14.29 7.27 15 7.96 15C8.35 15 8.7 14.76 8.85 14.4L9.5 12.8ZM12 5.98L13.87 11H10.13L12 5.98Z"})),vS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10831 2.60839C3.71687 2.23054 3.09322 2.23475 2.70696 2.62102C2.31643 3.01154 2.31643 3.64471 2.70696 4.03523L8.65871 9.98698L7.07 13.6598C6.8 14.2898 7.27 14.9998 7.96 14.9998C8.35 14.9998 8.7 14.7598 8.85 14.3998L9.5 12.7998H11.4716L15.6716 16.9998H6C5.45 16.9998 5 17.4498 5 17.9998C5 18.5498 5.45 18.9998 6 18.9998H17.6716L19.6775 21.0058C20.068 21.3963 20.7012 21.3963 21.0917 21.0058C21.478 20.6195 21.4822 19.9959 21.1044 19.6044C21.1001 19.6003 21.0958 19.5961 21.0916 19.5919L4.12102 2.62132C4.11674 2.61704 4.1125 2.61273 4.10831 2.60839ZM16.1235 11.7954L13.05 4.68985C12.87 4.26985 12.46 3.99985 12 3.99985C11.54 3.99985 11.13 4.26985 10.95 4.68985L10.3666 6.03851L11.5408 7.21265L12 5.97985L13.0045 8.67635L16.1235 11.7954Z"})),Bs=Vc(E1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",height:"auto",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:"0 1px 0",marginRight:"1rem","&:hover":{background:e.palette.background.application},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),Ys=Vc(E1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main,borderRadius:e.shape.borderRadius,marginRight:"1rem",padding:"0 1px 0","&:hover":{color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),gS=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(Y1,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(D,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(R,{condition:!!e.caseInsensitive,show:a.jsx(Bs,{onClick:t,disableRipple:!0,children:a.jsx(vS,{})}),elseShow:a.jsx(Ys,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(pS,{})})})})}),xS=e=>h.createElement("svg",{width:24,height:10,viewBox:"0 0 24 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M20.9238 0.46875V9H19.1719V0.46875H20.9238ZM23.5488 0.46875V1.8457H16.5879V0.46875H23.5488Z"}),h.createElement("path",{d:"M16.2422 4.53516V4.93945C16.2422 5.58789 16.1543 6.16992 15.9785 6.68555C15.8027 7.20117 15.5547 7.64062 15.2344 8.00391C14.9141 8.36328 14.5312 8.63867 14.0859 8.83008C13.6445 9.02148 13.1543 9.11719 12.6152 9.11719C12.0801 9.11719 11.5898 9.02148 11.1445 8.83008C10.7031 8.63867 10.3203 8.36328 9.99609 8.00391C9.67188 7.64062 9.41992 7.20117 9.24023 6.68555C9.06445 6.16992 8.97656 5.58789 8.97656 4.93945V4.53516C8.97656 3.88281 9.06445 3.30078 9.24023 2.78906C9.41602 2.27344 9.66406 1.83398 9.98438 1.4707C10.3086 1.10742 10.6914 0.830078 11.1328 0.638672C11.5781 0.447266 12.0684 0.351562 12.6035 0.351562C13.1426 0.351562 13.6328 0.447266 14.0742 0.638672C14.5195 0.830078 14.9023 1.10742 15.2227 1.4707C15.5469 1.83398 15.7969 2.27344 15.9727 2.78906C16.1523 3.30078 16.2422 3.88281 16.2422 4.53516ZM14.4668 4.93945V4.52344C14.4668 4.07031 14.4258 3.67188 14.3438 3.32812C14.2617 2.98438 14.1406 2.69531 13.9805 2.46094C13.8203 2.22656 13.625 2.05078 13.3945 1.93359C13.1641 1.8125 12.9004 1.75195 12.6035 1.75195C12.3066 1.75195 12.043 1.8125 11.8125 1.93359C11.5859 2.05078 11.3926 2.22656 11.2324 2.46094C11.0762 2.69531 10.957 2.98438 10.875 3.32812C10.793 3.67188 10.752 4.07031 10.752 4.52344V4.93945C10.752 5.38867 10.793 5.78711 10.875 6.13477C10.957 6.47852 11.0781 6.76953 11.2383 7.00781C11.3984 7.24219 11.5938 7.41992 11.8242 7.54102C12.0547 7.66211 12.3184 7.72266 12.6152 7.72266C12.9121 7.72266 13.1758 7.66211 13.4062 7.54102C13.6367 7.41992 13.8301 7.24219 13.9863 7.00781C14.1426 6.76953 14.2617 6.47852 14.3438 6.13477C14.4258 5.78711 14.4668 5.38867 14.4668 4.93945Z"}),h.createElement("path",{d:"M7.70508 0.46875V9H5.94727L2.51953 3.28125V9H0.761719V0.46875H2.51953L5.95312 6.19336V0.46875H7.70508Z"})),bS=e=>h.createElement("svg",{width:24,height:36,viewBox:"25 12 24 30",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M44.2145 31H45.9238V23.8457H48.5488V22.4688H45.9238H44.1719H41.5879V23.8457H44.1719V30.9574L44.2145 31ZM39.1419 28.7274L40.3188 29.9043C40.3146 29.9095 40.3104 29.9147 40.3061 29.9198L46.2004 35.8141L44.8004 37.2141L38.5868 31.0005C38.2828 31.0783 37.9589 31.1172 37.6152 31.1172C37.0801 31.1172 36.5898 31.0215 36.1445 30.8301C35.7031 30.6387 35.3203 30.3633 34.9961 30.0039C34.6719 29.6406 34.4199 29.2012 34.2402 28.6855C34.0645 28.1699 33.9766 27.5879 33.9766 26.9395V26.5352C33.9766 26.4869 33.977 26.4391 33.978 26.3917L32.7051 25.1188V31H30.9473L27.5195 25.2812V31H25.7617V22.4688H27.5195L30.9531 28.1934V23.3668L26.4004 18.8141L27.8004 17.4141L34.5229 24.1366C34.5262 24.1305 34.5295 24.1244 34.5328 24.1183L35.8509 25.4364C35.8493 25.4442 35.8477 25.452 35.8461 25.4598L37.0004 26.6141L39.1328 28.7465C39.1359 28.7402 39.1389 28.7338 39.1419 28.7274ZM39.4614 26.247L41.1626 27.9481C41.2157 27.632 41.2422 27.2957 41.2422 26.9395V26.5352C41.2422 25.8828 41.1523 25.3008 40.9727 24.7891C40.7969 24.2734 40.5469 23.834 40.2227 23.4707C39.9023 23.1074 39.5195 22.8301 39.0742 22.6387C38.6328 22.4473 38.1426 22.3516 37.6035 22.3516C37.0684 22.3516 36.5781 22.4473 36.1328 22.6387C36.0682 22.6667 36.0048 22.6966 35.9427 22.7283L37.0488 23.8344C37.2187 23.7794 37.4036 23.752 37.6035 23.752C37.9004 23.752 38.1641 23.8125 38.3945 23.9336C38.625 24.0508 38.8203 24.2266 38.9805 24.4609C39.1406 24.6953 39.2617 24.9844 39.3438 25.3281C39.4087 25.6002 39.4479 25.9065 39.4614 26.247ZM37.281 29.6947L35.9324 28.346C36.0101 28.5994 36.112 28.82 36.2383 29.0078C36.3984 29.2422 36.5938 29.4199 36.8242 29.541C36.9642 29.6146 37.1165 29.6658 37.281 29.6947Z"})),jS=({localConstraint:e,setInvertedOperator:t})=>a.jsx(Y1,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(D,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(R,{condition:!!e.inverted,show:a.jsx(Ys,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(xS,{})}),elseShow:a.jsx(Bs,{onClick:t,disableRipple:!0,children:a.jsx(bS,{})})})})}),yS=u("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular})),Hs=({children:e,...t})=>a.jsx(yS,{...t,children:e}),Us=Hr()(e=>({valueChip:{margin:"0 0.5rem 0.5rem 0"},chipValue:{whiteSpace:"pre"},inputContainer:{display:"flex",alignItems:"center",[e.breakpoints.down(700)]:{flexDirection:"column",alignItems:"flex-start"}},inputInnerContainer:{minWidth:"300px",[e.breakpoints.down(700)]:{minWidth:"100%"}},input:{width:"100%",margin:"1rem 0"},button:{marginLeft:"1rem",[e.breakpoints.down(700)]:{marginLeft:0,marginBottom:"0.5rem"}},valuesContainer:{marginTop:"1rem"}})),_S=u(D)(({theme:e})=>({"&:has(*)":{marginTop:e.spacing(2)}})),wS="Enter",g7=({values:e,removeValue:t,setValues:n,error:i,setError:c})=>{const[s,o]=h.useState(""),{classes:l}=Us(),{uiConfig:d,loading:m}=p1(),f=d.resourceLimits.constraintValues,v=p=>{p.key===wS&&(p.preventDefault(),g())},g=()=>{const p=OS([...e,...Th(s)]);p.length>f?c(`constraints cannot have more than ${f} values`):p.length===0?c("values cannot be empty"):p.some(j=>j.length>100)?c("values cannot be longer than 100 characters"):(c(""),o(""),n(p))};return a.jsxs(a.Fragment,{children:[a.jsx(Hs,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(_3,{onKeyPress:v,label:"Values",name:"values",value:s,onFocus:()=>{c("")},onChange:p=>o(p.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!i,errorText:i,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(a1,{className:l.button,variant:"outlined",color:"primary",onClick:g,"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",disabled:m,children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(SS,{values:e,removeValue:t})}),a.jsx(_S,{children:a.jsx(ic,{name:"single constraint values",shortName:"values",currentValue:e.length,limit:f})})]})},SS=({values:e,removeValue:t})=>{const{classes:n}=Us();return a.jsx(a.Fragment,{children:e.map((i,c)=>a.jsx(Dh,{label:a.jsx($h,{text:i,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(c),className:n.valueChip,"data-testid":"CONSTRAINT_VALUES_CHIP"},`${i}-${c}`))})},OS=e=>Array.from(new Set(e)),CS=Hr()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),x7=({setValue:e,value:t,type:n,error:i,setError:c})=>{const{classes:s}=CS();return a.jsxs(a.Fragment,{children:[a.jsxs(Hs,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:s.singleValueContainer,children:a.jsx(_3,{label:n,name:"value",value:t||"",onChange:o=>{c(""),e(o.target.value.trim())},onFocus:()=>c(""),placeholder:`Enter a single ${n} value`,className:s.singleValueInput,error:!!i,errorText:i})})]})},DS=({operator:e,localConstraint:t,setValue:n,setValues:i,setError:c,removeValue:s,error:o})=>{if(Ph(e))return a.jsx(g7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(wr(e))return a.jsx(g7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(Eh(e))return a.jsx(x7,{setValue:n,value:t.value,type:"number",error:o,setError:c});if(Zh(e))return a.jsx(x7,{setValue:n,value:t.value,type:"semver",error:o,setError:c})},$S=u("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),b7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),j7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),TS=u(Ih)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),PS=u(re,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),ES=u("div")(({theme:e})=>({lineHeight:1.2})),ZS=({options:e,value:t,onChange:n})=>{const[i,c]=h.useState(!1),s=l=>{n(l.target.value)},o=()=>a.jsxs($S,{children:[a.jsx(b7,{children:t}),a.jsx(j7,{children:_r(t)})]});return a.jsxs(TS,{variant:"outlined",size:"small",fullWidth:!0,children:[a.jsx(Mh,{htmlFor:"operator-select",children:"Operator"}),a.jsx(Ah,{id:"operator-select",name:"operator",label:"Operator",value:t,open:i,onOpen:()=>c(!0),onClose:()=>c(!1),onChange:s,renderValue:o,children:e.map(l=>a.jsx(PS,{value:l,separator:IS(e,l),children:a.jsxs(ES,{children:[a.jsx(b7,{children:l}),a.jsx(j7,{children:_r(l)})]})},l))})]})},IS=(e,t)=>t===e[0]?!1:MS.some(n=>n[0]===t),MS=[Lc,Nc,Wc,Fh,zc],AS=u(E1)({marginRight:"-6px"}),FS=u("div")({display:"flex",flexDirection:"column",width:"100%"}),RS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"start",gap:e.spacing(2)}})),VS=u("div")(({theme:e})=>({width:"100%",display:"inline-flex",flex:1,gap:e.spacing(1)})),LS=u("div")(({theme:e})=>({width:"100%","&&& > div":{width:"100%"}})),y7=u("div")(({theme:e})=>({display:"inline-flex",flex:1,"&&& button":{marginRight:0,"&:not(.operator-is-active)":{backgroundColor:e.palette.background.elevation2}}})),NS=u("div")({width:"100%",flex:1});u(_3)({width:"100%"});const WS=u("div")(({theme:e})=>({"& > h3":{margin:e.spacing(1,0,0,0),fontSize:e.fontSizes.smallBody},"& > div":{margin:0,maxWidth:"unset","& > div":{flex:1},"& .MuiFormControl-root":{margin:e.spacing(.5,0,0,0)},"&:not(:first-of-type)":{marginTop:e.spacing(1)}}})),zS=({filter:e,index:t,stateChanged:n,suggestions:i,onDelete:c})=>{const{parameter:s,inverted:o,operator:l,caseInsensitive:d,value:m,values:f}=e,v=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Filter ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete filter",arrow:!0,children:a.jsx(AS,{onClick:c,children:a.jsx(b3,{})})})})]}),[g,p]=h.useState(!1),x=[...Lc,...Nc,...Wc,...zc],[j,y]=h.useState(""),b=Rh(l),S=()=>{if(n({...e,error:void 0}),m===void 0&&f===void 0)return;const O=f||[m||""],[N,z]=b(...O);N||(y(z),n({...e,error:z}))};h.useEffect(()=>{S()},[m,j]),h.useEffect(()=>{wr(l)?p(!0):p(!1)},[l]);const C=O=>{wr(O)?p(!0):p(!1),n({...e,operator:O})},T=O=>{n({...e,values:void 0,value:O})},$=O=>{n({...e,value:void 0,values:O})},Z=O=>{const N=(f==null?void 0:f.filter((z,V)=>V!==O))||[];$(N)};return a.jsx(zs,{index:t,header:v,children:a.jsxs(FS,{children:[a.jsxs(RS,{children:[a.jsx(NS,{children:a.jsx(K2,{freeSolo:!0,options:i,value:s,onInputChange:(O,N)=>n({...e,parameter:N}),renderInput:O=>a.jsx(se,{...O,size:"small",label:"Parameter"})})}),a.jsxs(VS,{children:[a.jsx(y7,{children:a.jsx(jS,{localConstraint:{inverted:o},setInvertedOperator:()=>n({...e,inverted:!o||void 0})})}),a.jsx(LS,{children:a.jsx(ZS,{options:x,value:l,onChange:C})}),a.jsx(R,{condition:g,show:a.jsx(y7,{children:a.jsx(gS,{localConstraint:{caseInsensitive:d},setCaseInsensitive:()=>n({...e,caseInsensitive:!d||void 0})})})})]})]}),a.jsx(WS,{children:a.jsx(DS,{setValues:$,setValue:T,setError:y,localConstraint:{value:m,values:f},operator:l,error:j,removeValue:Z})})]})})},BS=u("div")(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(2)})),YS=u("div")(({theme:e})=>({position:"absolute",right:0,fontSize:e.fontSizes.smallBody,[e.breakpoints.down("sm")]:{display:"none"}})),HS=u(D,{shouldForwardProp:e=>e!=="verticalConnector"})(({theme:e,verticalConnector:t})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,marginTop:t?0:e.spacing(3),padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium})),US=u(V3)(({theme:e})=>({margin:"auto",width:1,height:e.spacing(3)})),ks=({name:e,verticalConnector:t,resourceLink:n,children:i})=>a.jsxs(a.Fragment,{children:[a.jsx(R,{condition:!!t,show:a.jsx(US,{orientation:"vertical"})}),a.jsxs(HS,{verticalConnector:t,children:[a.jsxs(BS,{children:[a.jsx(z3,{color:"secondary",children:e}),a.jsx(YS,{children:n})]}),i]})]});var I5={},kS=J1;Object.defineProperty(I5,"__esModule",{value:!0});var qs=I5.default=void 0,qS=kS(Q1()),KS=a,GS=(0,qS.default)((0,KS.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");qs=I5.default=GS;const QS=h.lazy(()=>Fc(()=>import("./ReactJSONEditor-BDMT4-_1.js"),[])),JS=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(1.5),marginBottom:e.spacing(-.75),height:e.spacing(3)})),XS=u(Kr)({backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}}),eO=u(Rc)(({theme:e})=>({lineHeight:"1.5rem",padding:0,marginBottom:e.spacing(-2.25),fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"}})),tO=u(qs)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.smallBody})),nO=u(Gr)(({theme:e})=>({marginTop:e.spacing(2),padding:0})),aO=({payload:e})=>e?a.jsxs(XS,{children:[a.jsx(eO,{expandIcon:a.jsx(E1,{children:a.jsx(tO,{titleAccess:"Toggle"})}),children:"Preview payload"}),a.jsx(nO,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(QS,{content:{json:e},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]}):a.jsx(JS,{children:"No signals were received from this source yet."}),Er=(e={},t="")=>Object.entries(e).reduce((n,[i,c])=>{const s=t?`${t}.${i}`:i;return typeof c=="object"&&c!==null&&!Array.isArray(c)?Object.assign(n,Er(c,s)):Array.isArray(c)?c.forEach((o,l)=>{typeof o=="object"&&o!==null?Object.assign(n,Er(o,`${s}[${l}]`)):n[`${s}[${l}]`]=o}):n[s]=c,n},{}),rO=u(V3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),iO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),cO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),sO=({sourceId:e,setSourceId:t,filters:n,setFilters:i,validateSourceId:c})=>{const{signalEndpoints:s,loading:o}=e5(),{signalEndpointSignals:l}=Vh(e,1),d=()=>{const p=y2();i(x=>[...x,{id:p,parameter:"",operator:Lh}])},m=p=>{i(x=>x.map(j=>j.id===p.id?p:j))},f=h.useMemo(()=>o?[]:s.map(({id:p,name:x})=>({label:x,key:`${p}`})),[o,s]),{lastSourcePayload:v,filterSuggestions:g}=h.useMemo(()=>{var x;const p=(x=l[0])==null?void 0:x.payload;return{lastSourcePayload:p,filterSuggestions:Object.keys(Er(p)||{}).sort()}},[l]);return a.jsxs(ks,{name:"When this",resourceLink:a.jsx(g1,{to:"/integrations/signals",children:"Create signal endpoint"}),children:[a.jsx(L3,{label:"Source",options:f,value:`${e}`,onChange:p=>{c(Number(p)),t(Number.parseInt(p))}}),a.jsx(R,{condition:!!e,show:a.jsx(aO,{payload:v})}),a.jsx(rO,{}),n.map((p,x)=>a.jsx(zS,{index:x,filter:p,stateChanged:m,suggestions:g,onDelete:()=>i(j=>j.filter(({id:y})=>y!==p.id))},p.id)),a.jsxs(cO,{children:[a.jsx(a1,{startIcon:a.jsx(Je,{}),onClick:d,variant:"outlined",color:"primary",children:"Add filter"}),a.jsx(R0,{htmlTooltip:!0,tooltip:a.jsxs(iO,{children:[a.jsx("p",{children:"Filters allow you to add conditions to the execution of the actions based on the source payload."}),a.jsx("p",{children:"If no filters are defined then the action will always be triggered from the selected source, no matter the payload."})]})})]})]})},oO=(e,t,n)=>{const i=`${t?`?project=${t}`:""}${n?`${t?"&":"?"}environment=${n}`:""}`,c=`api/admin/service-account/${e}/permissions${i}`,{data:s,error:o,mutate:l}=Qr(!!e,void 0,N1(c),lO);return h.useMemo(()=>({overview:s==null?void 0:s.overview,projectRoles:s==null?void 0:s.projectRoles,rootRole:s==null?void 0:s.rootRole,serviceAccount:s==null?void 0:s.serviceAccount,permissions:(s==null?void 0:s.permissions)||[],loading:!o&&!s,refetch:()=>l(),error:o}),[s,o,l])},lO=e=>fetch(e).then(ne("Service account access overview")).then(t=>t.json()),dO=({label:e,value:t,onChange:n,options:i})=>a.jsx(K2,{options:i,autoHighlight:!0,autoSelect:!0,value:t,onInputChange:(c,s)=>n(s),renderInput:c=>a.jsx(se,{...c,size:"small",label:e})}),uO=({parameter:e,value:t,onChange:n})=>{const{label:i,type:c}=e;if(c==="select"){const{options:s}=e;return a.jsx(dO,{label:i,value:t,onChange:n,options:s})}return null},hO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),mO=({value:e,onChange:t,actionConfigurations:n})=>{const i=(s,o)=>a.jsx("li",{...s,children:a.jsxs(hO,{children:[a.jsx("span",{children:o.label}),a.jsx("span",{children:o.description})]})}),c=[...n].map(([s,o])=>({key:s,...o}));return a.jsx(K2,{options:c,autoHighlight:!0,autoSelect:!0,value:c.find(({key:s})=>s===e)||null,onChange:(s,o)=>t(o?o.key:""),renderOption:i,getOptionLabel:({label:s})=>s,renderInput:s=>a.jsx(se,{...s,size:"small",label:"Action"})})},fO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",gap:e.spacing(2)})),_7=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",flexWrap:"wrap"})),w7=u("div")(({theme:e})=>({flex:1,minWidth:e.spacing(25)})),pO=({action:e,index:t,stateChanged:n,actorId:i,onDelete:c,actionConfigurations:s,validated:o})=>{const{action:l,executionParams:d,error:m}=e,f=e1("projectId"),{permissions:v}=oO(i,f,d.environment),g=s.get(l),p=h.useMemo(()=>{const y=g==null?void 0:g.permissions,{environment:b}=d;return v.length===0||!y||!b?!0:y.some(S=>v.some(({permission:C,project:T,environment:$})=>C===S&&T===f&&$===b))},[g,v]);h.useEffect(()=>{n({...e,error:void 0}),((g==null?void 0:g.parameters.filter(({optional:b})=>!b).map(({name:b})=>b))||[]).some(b=>!d[b])&&n({...e,error:"Please fill all required fields."})},[g,d]);const x=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Action ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete action",arrow:!0,children:a.jsx(E1,{onClick:c,children:a.jsx(b3,{})})})})]}),j=(g==null?void 0:g.parameters.filter(({type:y})=>y!=="hidden"))||[];return a.jsx(zs,{index:t,header:x,separator:"THEN",children:a.jsxs(fO,{children:[a.jsx(_7,{children:a.jsx(w7,{children:a.jsx(mO,{value:l,onChange:y=>n({...e,action:y}),actionConfigurations:s})})}),a.jsx(R,{condition:j.length>0,show:a.jsx(_7,{children:j.map(y=>a.jsx(w7,{children:a.jsx(uO,{parameter:y,value:d[y.name],onChange:b=>n({...e,executionParams:{...d,[y.name]:b}})})},y.name))})}),a.jsx(R,{condition:o&&!!m,show:a.jsx(Z1,{severity:"error",children:m})}),a.jsx(R,{condition:!p,show:a.jsx(Z1,{severity:"error",children:"The selected service account does not have permissions to execute this action currently."})})]})})},vO={},gO=e=>{const{isEnterprise:t}=p1(),n=W3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,vO,N1(`api/admin/projects/${e}/actions/config`),xO);return h.useMemo(()=>({actionConfigurations:new Map(Object.entries(i||{})),loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},xO=e=>fetch(e).then(ne("Actions configuration")).then(t=>t.json()),bO=u(V3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),jO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),yO=({serviceAccounts:e,serviceAccountsLoading:t,actions:n,setActions:i,actorId:c,setActorId:s,validateActorId:o,validated:l})=>{const d=e1("projectId"),{actionConfigurations:m}=gO(d),f=p=>{const j={id:y2(),action:"",sortOrder:n.map(y=>y.sortOrder).reduce((y,b)=>Math.max(y,b),0)+1,executionParams:{project:p}};i([...n,j])},v=p=>{i(x=>x.map(j=>j.id===p.id?p:j))},g=h.useMemo(()=>t?[]:e.map(p=>({label:p.name,key:`${p.id}`})),[t,e]);return a.jsxs(ks,{name:"Do these actions",verticalConnector:!0,resourceLink:a.jsx(g1,{to:"/admin/service-accounts",children:"Create service account"}),children:[a.jsx(L3,{label:"Service account",name:"service-account",options:g,value:`${c}`,onChange:p=>{o(Number(p)),s(Number.parseInt(p))}}),a.jsx(bO,{}),n.map((p,x)=>a.jsx(pO,{index:x,action:p,stateChanged:v,actorId:c,onDelete:()=>i(j=>j.filter(y=>y.id!==p.id)),actionConfigurations:m,validated:l},p.id)),a.jsx(jO,{children:a.jsx(a1,{startIcon:a.jsx(Je,{}),onClick:()=>f(d),variant:"outlined",color:"primary",children:"Add action"})})]})},_O=u(Z1)(({theme:e})=>({marginBottom:e.spacing(4)})),wO=u("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),S7=u("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),O7=u(_3)(()=>({width:"100%"})),SO=u(Z1)(({theme:e})=>({marginTop:e.spacing(3)})),OO=({enabled:e,setEnabled:t,name:n,setName:i,description:c,setDescription:s,sourceId:o,setSourceId:l,filters:d,setFilters:m,actorId:f,setActorId:v,actions:g,setActions:p,errors:x,validateName:j,validateSourceId:y,validateActorId:b,validated:S})=>{const{serviceAccounts:C,loading:T}=qc(),$=O=>{setTimeout(()=>O(),300)},Z=S&&Object.values(x).some(Boolean);return a.jsxs("div",{children:[a.jsx(R,{condition:C.length===0,show:a.jsxs(_O,{color:"warning",children:[a.jsx("strong",{children:"Heads up!"})," In order to create an action you need to create a service account first. Please"," ",a.jsx(ce,{to:"/admin/service-accounts",component:g1,children:"go ahead and create one"}),"."]})}),a.jsx(wO,{children:a.jsx(Nh,{checked:e,setChecked:t,children:"Action status"})}),a.jsx(S7,{children:"What is your new action name?"}),a.jsx(O7,{autoFocus:!0,label:"Action name",error:!!x.name,errorText:x.name,value:n,onChange:O=>{j(O.target.value),i(O.target.value)},onBlur:O=>$(()=>j(O.target.value)),autoComplete:"off"}),a.jsx(S7,{children:"What is your new action description?"}),a.jsx(O7,{label:"Action description",value:c,onChange:O=>s(O.target.value),autoComplete:"off"}),a.jsx(sO,{sourceId:o,setSourceId:l,filters:d,setFilters:m,validateSourceId:y}),a.jsx(yO,{serviceAccounts:C,serviceAccountsLoading:T,actions:g,setActions:p,actorId:f,setActorId:v,validateActorId:b,validated:S}),a.jsx(R,{condition:Z,show:()=>a.jsx(SO,{severity:"error",icon:!1,children:a.jsx("ul",{children:Object.values(x).filter(Boolean).map(O=>a.jsx("li",{children:O},O))})})})]})},C7={name:void 0,source:void 0,filters:void 0,actor:void 0,actions:void 0},CO=e=>{const t=e1("projectId"),{actions:n}=Z5(t),[i,c]=h.useState(!1),[s,o]=h.useState(""),[l,d]=h.useState(""),[m,f]=h.useState(0),[v,g]=h.useState([]),[p,x]=h.useState(0),[j,y]=h.useState([]),b=()=>{var E,w,_;c((e==null?void 0:e.enabled)??!0),o((e==null?void 0:e.name)||""),d((e==null?void 0:e.description)||""),f(((E=e==null?void 0:e.match)==null?void 0:E.sourceId)??0),g(Object.entries(((w=e==null?void 0:e.match)==null?void 0:w.payload)??{}).map(([F,{inverted:G,operator:q,caseInsensitive:l1,value:m1,values:J}])=>({id:y2(),parameter:F,inverted:G,operator:q,caseInsensitive:l1,value:m1,values:J}))),x((e==null?void 0:e.actorId)??0),y(((_=e==null?void 0:e.actions)==null?void 0:_.map(F=>({id:y2(),action:F.action,sortOrder:F.sortOrder,executionParams:F.executionParams})))??[]),$(!1),C(C7)};h.useEffect(()=>{b()},[e]);const[S,C]=h.useState(C7),[T,$]=h.useState(!1),Z=E=>{C(w=>({...w,[E]:void 0}))},O=(E,w)=>{C(_=>({..._,[E]:w}))};h.useEffect(()=>{K(v)},[v]),h.useEffect(()=>{Y(j)},[j]);const N=E=>!E.length,z=E=>n==null?void 0:n.some(({id:w,name:_})=>w!==(e==null?void 0:e.id)&&_===E),V=E=>E===0,M=E=>N(E)?(O("name","Name is required."),!1):z(E)?(O("name","Name must be unique."),!1):(Z("name"),!0),H=E=>V(E)?(O("source","Source is required."),!1):(Z("source"),!0),K=E=>E.some(({error:w})=>w)?(O("filters","One or more filters have errors."),!1):(Z("filters"),!0),A=E=>V(E)?(O("actor","Service account is required."),!1):(Z("actor"),!0),Y=E=>E.filter(({action:w})=>!!w).length===0?(O("actions","At least one action is required."),!1):(Z("actions"),E.some(({error:w})=>w)?(O("actions","One or more actions have errors."),!1):(Z("actions"),!0));return{enabled:i,setEnabled:c,name:s,setName:o,description:l,setDescription:d,sourceId:m,setSourceId:f,filters:v,setFilters:g,actorId:p,setActorId:x,actions:j,setActions:y,errors:S,setErrors:C,validated:T,validateName:M,validateSourceId:H,validateActorId:A,validate:()=>{const E=M(s),w=H(m),_=K(v),F=A(p),G=Y(j);return $(!0),E&&w&&_&&F&&G},reloadForm:b}},DO=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),$O=u("h1")({fontWeight:"normal"}),TO=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),PO=u("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),EO=u(a1)(({theme:e})=>({marginLeft:e.spacing(3)})),ZO=({action:e,open:t,setOpen:n,onOpenEvents:i})=>{const c=e1("projectId"),{refetch:s}=Z5(c),{addActionSet:o,updateActionSet:l,loading:d}=Vs(c),{setToastData:m,setToastApiError:f}=$1(),{uiConfig:v}=p1(),{enabled:g,setEnabled:p,name:x,setName:j,description:y,setDescription:b,sourceId:S,setSourceId:C,filters:T,setFilters:$,actorId:Z,setActorId:O,actions:N,setActions:z,errors:V,validateName:M,validateSourceId:H,validateActorId:K,validate:A,validated:Y,reloadForm:W}=CO(e);h.useEffect(()=>{W()},[t]);const E=e!==void 0,w=`${E?"Edit":"New"} action`,_={enabled:g,name:x,description:y,match:{source:"signal-endpoint",sourceId:S,payload:T.filter(q=>q.parameter.length>0).reduce((q,{parameter:l1,inverted:m1,operator:J,caseInsensitive:t1,value:r1,values:s1})=>({...q,[l1]:{inverted:m1,operator:J,caseInsensitive:t1,value:r1,values:s1}}),{})},actorId:Z,actions:N.filter(({action:q})=>!!q).map(({action:q,sortOrder:l1,executionParams:m1})=>({action:q,sortOrder:l1,executionParams:m1}))},F=()=>`curl --location --request ${E?"PUT":"POST"} '${v.unleashUrl}/api/admin/projects/${c}/actions${E?`/${e.id}`:""}' \\
709
+ --header 'Authorization: INSERT_API_KEY'`;return a.jsx(bw,{children:a.jsx(Qe,{loading:i,title:"Archive project",description:"",documentationLink:"https://docs.getunleash.io/reference/projects",documentationLinkLabel:"Projects documentation",formatApiCode:c,compact:!0,compactPadding:!0,showDescription:!1,showLink:!1,children:a.jsx(xw,{projectId:t,featureCount:e})})})},yw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),_w=()=>{const{isEnterprise:e}=p1(),{hasAccess:t}=h.useContext(Ee),n=e1("projectId"),{project:i}=X1(n);if(!i.name)return null;const c=!t([G1,Ac],n)&&a.jsx(Z1,{severity:"error",sx:{mb:4},children:"You do not have the required permissions to edit this project."});return a.jsxs(a.Fragment,{children:[c,a.jsxs(yw,{children:[a.jsx(fw,{project:i}),a.jsx(R,{condition:e(),show:a.jsx(J_,{project:i})}),a.jsx(jw,{featureCount:ac(i)??0})]})]})},ww=()=>{const e=e1("projectId"),t=je(e),{hasAccess:n}=h.useContext(Ee),{isOss:i}=p1();return pe(`Project configuration – ${t}`),i()?a.jsx(R1,{header:a.jsx(S1,{title:"General settings"}),sx:{justifyContent:"center"},children:a.jsx(A0,{feature:"project-settings"})}):n([G1,yh],e)?a.jsx(_w,{}):a.jsx(R1,{header:a.jsx(S1,{title:"General settings"}),children:a.jsx(Z1,{severity:"error",children:"You need project owner permissions to access this section."})})},Sw={actions:[]},Z5=e=>{const{isEnterprise:t}=p1(),n=W3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,Sw,N1(`api/admin/projects/${e}/actions`),Ow);return h.useMemo(()=>({actions:(i==null?void 0:i.actions)??[],loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},Ow=e=>fetch(e).then(ne("Actions")).then(t=>t.json()),Vs=e=>{const{loading:t,makeRequest:n,createRequest:i,errors:c}=L2({propagateErrors:!0}),s=`api/admin/projects/${e}/actions`,o=async g=>{const x=i(s,{method:"POST",body:JSON.stringify(g)},"addActionSet");return(await n(x.caller,x.id)).json()},l=async(g,p)=>{const j=i(`${s}/${g}`,{method:"PUT",body:JSON.stringify(p)},"updateActionSet");await n(j.caller,j.id)},d=async g=>{const x=i(`${s}/${g}/on`,{method:"POST"},"enableActionSet");await n(x.caller,x.id)},m=async g=>{const x=i(`${s}/${g}/off`,{method:"POST"},"disableActionSet");await n(x.caller,x.id)};return{addActionSet:o,updateActionSet:l,removeActionSet:async g=>{const x=i(`${s}/${g}`,{method:"DELETE"},"removeActionSet");await n(x.caller,x.id)},toggleActionSet:async(g,p)=>{p?await d(g):await m(g)},errors:c,loading:t}},Cw=u(D)({display:"flex",alignItems:"center"}),Dw=u(x3)(({theme:e})=>({background:"transparent",borderRadius:e.shape.borderRadius,overflow:"hidden",width:e.spacing(3),height:e.spacing(3),fontSize:e.fontSizes.mainHeader})),$w=u(ce)(({theme:e})=>({..._h(e),"&:hover, &:focus":{textDecoration:"underline"}})),Tw=({action:e,signalEndpoints:t})=>{const{sourceId:n,source:i}=e.match;if(i==="signal-endpoint"){const c=t.find(({id:s})=>s===n);if(c)return a.jsx(w1,{children:a.jsxs(Cw,{children:[a.jsx(I3,{title:"Signal endpoint",arrow:!0,children:a.jsx(Dw,{src:S0(wh),alt:"Signal endpoint",variant:"rounded"})}),a.jsx($w,{component:g1,to:"/integrations/signals",underline:"hover",children:c.name})]})})}return a.jsx(w1,{children:"No source"})},Pw=u(I)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),Ew=({action:e})=>{const{payload:t}=e.match,n=Object.entries(t);return n.length===0?a.jsx(w1,{children:"0 filters"}):a.jsx(w1,{children:a.jsx(Q3,{tooltipProps:{maxWidth:500},tooltip:a.jsx(a.Fragment,{children:n.map(([i,{inverted:c,operator:s,caseInsensitive:o,value:l,values:d}])=>{const m=_r(s),f=c?a.jsxs(a.Fragment,{children:["is ",a.jsx("u",{children:"not"})," ",m.substring(2)]}):m;return a.jsxs(Pw,{children:[a.jsx("strong",{children:i})," ",f,o?" (case insensitive)":"",": ",a.jsx("strong",{children:d?d.join(", "):l})]},i)})}),children:n.length===1?"1 filter":`${n.length} filters`})})},Zw=({action:e,serviceAccounts:t})=>{const{actorId:n}=e,i=t.find(({id:c})=>c===n);return i?a.jsx(F0,{to:"/admin/service-accounts",title:i.name,subtitle:i.username}):a.jsx(w1,{children:"No service account"})},Iw=async e=>{const t=await fetch(e);return await ne("Action events")(t),t.json()},Ls=(e,t,n=50,i={})=>{var S;const{isEnterprise:c}=p1(),s=W3("automatedActions"),o=(C,T)=>!e||!t||!c||!s||T&&!T.actionSetEvents.length?null:N1(`api/admin/projects/${t}/actions/${e}/events?limit=${n}&offset=${C*n}`),{data:l,error:d,size:m,setSize:f,mutate:v}=Sh(o,Iw,{...i,revalidateAll:!0}),g=l?l.flatMap(({actionSetEvents:C})=>C):[],p=!l&&!d,x=m>0&&!(l!=null&&l[m-1]),j=p||x,y=((S=l==null?void 0:l[m-1])==null?void 0:S.actionSetEvents.length)===n;return{actionEvents:g,hasMore:y,loadMore:()=>{j||!y||f(m+1)},loading:j,refetch:()=>v(),error:d}},Mw=u("div",{shouldForwardProp:e=>e!=="state"})(({theme:e,state:t})=>({padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,...t==="not started"&&{backgroundColor:e.palette.background.elevation1}})),Aw=u("div")({display:"flex",flexDirection:"column"}),Fw=u("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),Rw=u("div")(({theme:e})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,gap:e.spacing(2)})),Vw=u(G2)(({theme:e})=>({color:e.palette.success.main}));u(Jr)(({theme:e})=>({color:e.palette.error.main}));const Lw=u(Z1)(({theme:e})=>({marginTop:e.spacing(2),fontSize:"inherit"})),Nw=u(V3)(({theme:e})=>({margin:e.spacing(2,0)})),Ww=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),zw=u("p")(({theme:e})=>({fontWeight:e.fontWeight.bold,marginBottom:e.spacing(.5)})),Bw=u("span")(({theme:e})=>({color:e.palette.text.secondary})),Yw=({action:{state:e,details:t,action:n,executionParams:i},children:c})=>{const s=e==="success"?a.jsx(Vw,{}):e==="started"?a.jsx(Xr,{size:20}):e==="not started"?a.jsx("span",{children:"Not started"}):null;return a.jsxs(Mw,{state:e,children:[a.jsxs(Aw,{children:[a.jsxs(Fw,{children:[a.jsx("div",{children:c}),a.jsx(Rw,{children:s})]}),a.jsx(R,{condition:!!t,show:a.jsx(Lw,{severity:"error",children:t})})]}),a.jsx(Nw,{}),a.jsxs(Ww,{children:[a.jsx(zw,{children:n}),Object.entries(i).map(([o,l])=>a.jsxs("div",{children:[a.jsxs(Bw,{children:[o,":"]})," ",l]},o))]})]})},Hw=h.lazy(()=>Fc(()=>import("./ReactJSONEditor-DZ9l5V9S.js"),[])),Uw=u(Kr)(({theme:e})=>({boxShadow:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,"&:before":{display:"none"}})),kw=u(Rc)({lineHeight:"1.5rem"}),qw=u(g1)(({theme:e})=>({marginLeft:e.spacing(1)})),Kw=({signal:e})=>{const{signalEndpoints:t}=e5(),n=h.useMemo(()=>{const i=t.find(({id:c})=>c===e.sourceId);return i==null?void 0:i.name},[t,e.sourceId]);return a.jsxs(Uw,{children:[a.jsxs(kw,{expandIcon:a.jsx(E1,{children:a.jsx(Oh,{titleAccess:"Toggle"})}),children:["Signal endpoint:",a.jsx(qw,{to:"/integrations/signals",children:n})]}),a.jsx(Gr,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(Hw,{content:{json:e.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]})},Gw=({signal:e})=>{const{source:t}=e;return t==="signal-endpoint"?a.jsx(Kw,{signal:e}):null},Qw=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(2)})),Jw=u(Z1)({fontSize:"inherit"}),Ns=({state:e,actionSet:{actions:t},signal:n})=>{const i=e==="failed"?`${t.filter(({state:c})=>c!=="success").length} out of ${t.length} actions were not successfully executed`:"All actions were successfully executed";return a.jsxs(Qw,{children:[a.jsx(Jw,{severity:e==="failed"?"error":"success",icon:e==="success"?a.jsx(G2,{}):void 0,children:i}),a.jsx(Gw,{signal:n}),t.map((c,s)=>a.jsxs(Yw,{action:c,children:["Action ",s+1]},c.id))]})},Xw=u(Q3)(({theme:e})=>({display:"flex",alignItems:"center"})),eS=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(0,2),marginTop:e.spacing(2)})),tS=u("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),nS=u(G2)(({theme:e})=>({color:e.palette.success.main})),aS=u(Jr)(({theme:e})=>({color:e.palette.error.main})),rS=({action:e})=>{const{id:t,project:n}=e,{actionEvents:i}=Ls(t,n,1,{refreshInterval:5e3}),{locationSettings:c}=K3();if(i.length===0)return null;const s=i[0],o=s.state==="success"?a.jsx(nS,{}):s.state==="failed"?a.jsx(aS,{}):a.jsx(Xr,{size:20});return a.jsx(Xw,{tooltipProps:{maxWidth:500,maxHeight:600},tooltip:a.jsxs(a.Fragment,{children:[a.jsxs(eS,{children:[a.jsx(tS,{children:"Last event"}),a.jsx("span",{children:Z0(s.createdAt,c==null?void 0:c.locale)})]}),a.jsx(Ns,{...s})]}),children:o})},iS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(2)})),cS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),fontSize:e.fontSizes.smallerBody})),sS=u("ul")(({theme:e})=>({listStyle:"none",paddingLeft:e.spacing(1),margin:0})),oS=({action:e,onCreateAction:t})=>{const{actions:n}=e;return n.length===0?t?a.jsx(F0,{title:"Create action",onClick:t}):a.jsx(w1,{children:"0 actions"}):a.jsxs(iS,{children:[a.jsx(rS,{action:e}),a.jsx(Q3,{tooltip:a.jsx(cS,{children:n.map(({id:i,action:c,executionParams:s})=>a.jsxs("div",{children:[a.jsx("strong",{children:c}),a.jsx(sS,{children:Object.entries(s).map(([o,l])=>a.jsxs("li",{children:[a.jsx("strong",{children:o}),":"," ",l]},o))})]},i))}),children:n.length===1?"1 action":`${n.length} actions`})]})},lS=u(D)({display:"flex",justifyContent:"center"}),dS=({actionId:e,onOpenEvents:t,onEdit:n,onDelete:i})=>{const[c,s]=h.useState(null),o=!!c,l=v=>{s(v.currentTarget)},d=()=>{s(null)},m=`action-${e}-actions`,f=`${m}-menu`;return a.jsxs(lS,{children:[a.jsx(Y1,{title:"Action actions",arrow:!0,describeChild:!0,children:a.jsx(E1,{id:m,"data-loading":!0,"aria-controls":o?f:void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:l,type:"button",children:a.jsx(Ir,{})})}),a.jsx(D0,{id:f,anchorEl:c,open:o,onClose:d,onClick:d,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:v=>({borderRadius:`${v.shape.borderRadius}px`,padding:v.spacing(1,1.5)})},children:a.jsxs($0,{"aria-labelledby":m,children:[a.jsx(he,{permission:d2,children:({hasAccess:v})=>a.jsxs(re,{sx:f3,onClick:t,disabled:!v,children:[a.jsx(ue,{children:a.jsx(Ch,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"View events"})})]})}),a.jsx(he,{permission:d2,children:({hasAccess:v})=>a.jsxs(re,{sx:f3,onClick:n,disabled:!v,children:[a.jsx(ue,{children:a.jsx(G3,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Edit"})})]})}),a.jsx(he,{permission:d2,children:({hasAccess:v})=>a.jsxs(re,{sx:f3,onClick:i,disabled:!v,children:[a.jsx(ue,{children:a.jsx(b3,{})}),a.jsx(ie,{children:a.jsx(I,{variant:"body2",children:"Remove"})})]})})]})})]})},uS=u("div")(({theme:e})=>({marginTop:e.spacing(1),position:"relative"})),hS=u("div")(({theme:e})=>({padding:e.spacing(.75,1),fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:e.spacing(-2),left:e.spacing(2),lineHeight:1})),mS=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.default,border:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingTop:e.spacing(1),borderRadius:e.shape.borderRadiusMedium})),Ws=u("div")({display:"flex",alignItems:"center"}),fS=u(Ws)(({theme:e})=>({justifyContent:"space-between",marginBottom:e.spacing(1)})),zs=({index:e,header:t,separator:n="AND",children:i})=>a.jsxs(uS,{children:[a.jsx(R,{condition:e>0,show:a.jsx(hS,{children:n})}),a.jsxs(mS,{children:[a.jsx(fS,{children:t}),a.jsx(Ws,{children:i})]})]}),pS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M5 18C5 18.55 5.45 19 6 19H18C18.55 19 19 18.55 19 18C19 17.45 18.55 17 18 17H6C5.45 17 5 17.45 5 18ZM9.5 12.8H14.5L15.16 14.4C15.31 14.76 15.66 15 16.05 15C16.74 15 17.2 14.29 16.93 13.66L13.05 4.69C12.87 4.27 12.46 4 12 4C11.54 4 11.13 4.27 10.95 4.69L7.07 13.66C6.8 14.29 7.27 15 7.96 15C8.35 15 8.7 14.76 8.85 14.4L9.5 12.8ZM12 5.98L13.87 11H10.13L12 5.98Z"})),vS=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.10831 2.60839C3.71687 2.23054 3.09322 2.23475 2.70696 2.62102C2.31643 3.01154 2.31643 3.64471 2.70696 4.03523L8.65871 9.98698L7.07 13.6598C6.8 14.2898 7.27 14.9998 7.96 14.9998C8.35 14.9998 8.7 14.7598 8.85 14.3998L9.5 12.7998H11.4716L15.6716 16.9998H6C5.45 16.9998 5 17.4498 5 17.9998C5 18.5498 5.45 18.9998 6 18.9998H17.6716L19.6775 21.0058C20.068 21.3963 20.7012 21.3963 21.0917 21.0058C21.478 20.6195 21.4822 19.9959 21.1044 19.6044C21.1001 19.6003 21.0958 19.5961 21.0916 19.5919L4.12102 2.62132C4.11674 2.61704 4.1125 2.61273 4.10831 2.60839ZM16.1235 11.7954L13.05 4.68985C12.87 4.26985 12.46 3.99985 12 3.99985C11.54 3.99985 11.13 4.26985 10.95 4.68985L10.3666 6.03851L11.5408 7.21265L12 5.97985L13.0045 8.67635L16.1235 11.7954Z"})),Bs=Vc(E1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",height:"auto",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,padding:"0 1px 0",marginRight:"1rem","&:hover":{background:e.palette.background.application},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),Ys=Vc(E1)(({theme:e})=>({width:"28px",minWidth:"28px",maxWidth:"28px",color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main,borderRadius:e.shape.borderRadius,marginRight:"1rem",padding:"0 1px 0","&:hover":{color:e.palette.primary.contrastText,backgroundColor:e.palette.primary.main},[e.breakpoints.between(1101,1365)]:{marginRight:"0.5rem",alignItems:"center"}})),gS=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(Y1,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(D,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(R,{condition:!!e.caseInsensitive,show:a.jsx(Bs,{onClick:t,disableRipple:!0,children:a.jsx(vS,{})}),elseShow:a.jsx(Ys,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(pS,{})})})})}),xS=e=>h.createElement("svg",{width:24,height:10,viewBox:"0 0 24 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M20.9238 0.46875V9H19.1719V0.46875H20.9238ZM23.5488 0.46875V1.8457H16.5879V0.46875H23.5488Z"}),h.createElement("path",{d:"M16.2422 4.53516V4.93945C16.2422 5.58789 16.1543 6.16992 15.9785 6.68555C15.8027 7.20117 15.5547 7.64062 15.2344 8.00391C14.9141 8.36328 14.5312 8.63867 14.0859 8.83008C13.6445 9.02148 13.1543 9.11719 12.6152 9.11719C12.0801 9.11719 11.5898 9.02148 11.1445 8.83008C10.7031 8.63867 10.3203 8.36328 9.99609 8.00391C9.67188 7.64062 9.41992 7.20117 9.24023 6.68555C9.06445 6.16992 8.97656 5.58789 8.97656 4.93945V4.53516C8.97656 3.88281 9.06445 3.30078 9.24023 2.78906C9.41602 2.27344 9.66406 1.83398 9.98438 1.4707C10.3086 1.10742 10.6914 0.830078 11.1328 0.638672C11.5781 0.447266 12.0684 0.351562 12.6035 0.351562C13.1426 0.351562 13.6328 0.447266 14.0742 0.638672C14.5195 0.830078 14.9023 1.10742 15.2227 1.4707C15.5469 1.83398 15.7969 2.27344 15.9727 2.78906C16.1523 3.30078 16.2422 3.88281 16.2422 4.53516ZM14.4668 4.93945V4.52344C14.4668 4.07031 14.4258 3.67188 14.3438 3.32812C14.2617 2.98438 14.1406 2.69531 13.9805 2.46094C13.8203 2.22656 13.625 2.05078 13.3945 1.93359C13.1641 1.8125 12.9004 1.75195 12.6035 1.75195C12.3066 1.75195 12.043 1.8125 11.8125 1.93359C11.5859 2.05078 11.3926 2.22656 11.2324 2.46094C11.0762 2.69531 10.957 2.98438 10.875 3.32812C10.793 3.67188 10.752 4.07031 10.752 4.52344V4.93945C10.752 5.38867 10.793 5.78711 10.875 6.13477C10.957 6.47852 11.0781 6.76953 11.2383 7.00781C11.3984 7.24219 11.5938 7.41992 11.8242 7.54102C12.0547 7.66211 12.3184 7.72266 12.6152 7.72266C12.9121 7.72266 13.1758 7.66211 13.4062 7.54102C13.6367 7.41992 13.8301 7.24219 13.9863 7.00781C14.1426 6.76953 14.2617 6.47852 14.3438 6.13477C14.4258 5.78711 14.4668 5.38867 14.4668 4.93945Z"}),h.createElement("path",{d:"M7.70508 0.46875V9H5.94727L2.51953 3.28125V9H0.761719V0.46875H2.51953L5.95312 6.19336V0.46875H7.70508Z"})),bS=e=>h.createElement("svg",{width:24,height:36,viewBox:"25 12 24 30",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M44.2145 31H45.9238V23.8457H48.5488V22.4688H45.9238H44.1719H41.5879V23.8457H44.1719V30.9574L44.2145 31ZM39.1419 28.7274L40.3188 29.9043C40.3146 29.9095 40.3104 29.9147 40.3061 29.9198L46.2004 35.8141L44.8004 37.2141L38.5868 31.0005C38.2828 31.0783 37.9589 31.1172 37.6152 31.1172C37.0801 31.1172 36.5898 31.0215 36.1445 30.8301C35.7031 30.6387 35.3203 30.3633 34.9961 30.0039C34.6719 29.6406 34.4199 29.2012 34.2402 28.6855C34.0645 28.1699 33.9766 27.5879 33.9766 26.9395V26.5352C33.9766 26.4869 33.977 26.4391 33.978 26.3917L32.7051 25.1188V31H30.9473L27.5195 25.2812V31H25.7617V22.4688H27.5195L30.9531 28.1934V23.3668L26.4004 18.8141L27.8004 17.4141L34.5229 24.1366C34.5262 24.1305 34.5295 24.1244 34.5328 24.1183L35.8509 25.4364C35.8493 25.4442 35.8477 25.452 35.8461 25.4598L37.0004 26.6141L39.1328 28.7465C39.1359 28.7402 39.1389 28.7338 39.1419 28.7274ZM39.4614 26.247L41.1626 27.9481C41.2157 27.632 41.2422 27.2957 41.2422 26.9395V26.5352C41.2422 25.8828 41.1523 25.3008 40.9727 24.7891C40.7969 24.2734 40.5469 23.834 40.2227 23.4707C39.9023 23.1074 39.5195 22.8301 39.0742 22.6387C38.6328 22.4473 38.1426 22.3516 37.6035 22.3516C37.0684 22.3516 36.5781 22.4473 36.1328 22.6387C36.0682 22.6667 36.0048 22.6966 35.9427 22.7283L37.0488 23.8344C37.2187 23.7794 37.4036 23.752 37.6035 23.752C37.9004 23.752 38.1641 23.8125 38.3945 23.9336C38.625 24.0508 38.8203 24.2266 38.9805 24.4609C39.1406 24.6953 39.2617 24.9844 39.3438 25.3281C39.4087 25.6002 39.4479 25.9065 39.4614 26.247ZM37.281 29.6947L35.9324 28.346C36.0101 28.5994 36.112 28.82 36.2383 29.0078C36.3984 29.2422 36.5938 29.4199 36.8242 29.541C36.9642 29.6146 37.1165 29.6658 37.281 29.6947Z"})),jS=({localConstraint:e,setInvertedOperator:t})=>a.jsx(Y1,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(D,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(R,{condition:!!e.inverted,show:a.jsx(Ys,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(xS,{})}),elseShow:a.jsx(Bs,{onClick:t,disableRipple:!0,children:a.jsx(bS,{})})})})}),yS=u("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular})),Hs=({children:e,...t})=>a.jsx(yS,{...t,children:e}),Us=Hr()(e=>({valueChip:{margin:"0 0.5rem 0.5rem 0"},chipValue:{whiteSpace:"pre"},inputContainer:{display:"flex",alignItems:"center",[e.breakpoints.down(700)]:{flexDirection:"column",alignItems:"flex-start"}},inputInnerContainer:{minWidth:"300px",[e.breakpoints.down(700)]:{minWidth:"100%"}},input:{width:"100%",margin:"1rem 0"},button:{marginLeft:"1rem",[e.breakpoints.down(700)]:{marginLeft:0,marginBottom:"0.5rem"}},valuesContainer:{marginTop:"1rem"}})),_S=u(D)(({theme:e})=>({"&:has(*)":{marginTop:e.spacing(2)}})),wS="Enter",g7=({values:e,removeValue:t,setValues:n,error:i,setError:c})=>{const[s,o]=h.useState(""),{classes:l}=Us(),{uiConfig:d,loading:m}=p1(),f=d.resourceLimits.constraintValues,v=p=>{p.key===wS&&(p.preventDefault(),g())},g=()=>{const p=OS([...e,...Th(s)]);p.length>f?c(`constraints cannot have more than ${f} values`):p.length===0?c("values cannot be empty"):p.some(j=>j.length>100)?c("values cannot be longer than 100 characters"):(c(""),o(""),n(p))};return a.jsxs(a.Fragment,{children:[a.jsx(Hs,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(_3,{onKeyPress:v,label:"Values",name:"values",value:s,onFocus:()=>{c("")},onChange:p=>o(p.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!i,errorText:i,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(a1,{className:l.button,variant:"outlined",color:"primary",onClick:g,"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",disabled:m,children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(SS,{values:e,removeValue:t})}),a.jsx(_S,{children:a.jsx(ic,{name:"single constraint values",shortName:"values",currentValue:e.length,limit:f})})]})},SS=({values:e,removeValue:t})=>{const{classes:n}=Us();return a.jsx(a.Fragment,{children:e.map((i,c)=>a.jsx(Dh,{label:a.jsx($h,{text:i,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(c),className:n.valueChip,"data-testid":"CONSTRAINT_VALUES_CHIP"},`${i}-${c}`))})},OS=e=>Array.from(new Set(e)),CS=Hr()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),x7=({setValue:e,value:t,type:n,error:i,setError:c})=>{const{classes:s}=CS();return a.jsxs(a.Fragment,{children:[a.jsxs(Hs,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:s.singleValueContainer,children:a.jsx(_3,{label:n,name:"value",value:t||"",onChange:o=>{c(""),e(o.target.value.trim())},onFocus:()=>c(""),placeholder:`Enter a single ${n} value`,className:s.singleValueInput,error:!!i,errorText:i})})]})},DS=({operator:e,localConstraint:t,setValue:n,setValues:i,setError:c,removeValue:s,error:o})=>{if(Ph(e))return a.jsx(g7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(wr(e))return a.jsx(g7,{values:t.values||[],removeValue:s,setValues:i,error:o,setError:c});if(Eh(e))return a.jsx(x7,{setValue:n,value:t.value,type:"number",error:o,setError:c});if(Zh(e))return a.jsx(x7,{setValue:n,value:t.value,type:"semver",error:o,setError:c})},$S=u("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),b7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),j7=u("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),TS=u(Ih)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),PS=u(re,{shouldForwardProp:e=>e!=="separator"})(({theme:e,separator:t})=>t?{position:"relative",overflow:"visible",marginTop:e.spacing(2),"&:before":{content:'""',display:"block",position:"absolute",top:e.spacing(-1),left:0,right:0,borderTop:"1px solid",borderTopColor:e.palette.divider}}:{}),ES=u("div")(({theme:e})=>({lineHeight:1.2})),ZS=({options:e,value:t,onChange:n})=>{const[i,c]=h.useState(!1),s=l=>{n(l.target.value)},o=()=>a.jsxs($S,{children:[a.jsx(b7,{children:t}),a.jsx(j7,{children:_r(t)})]});return a.jsxs(TS,{variant:"outlined",size:"small",fullWidth:!0,children:[a.jsx(Mh,{htmlFor:"operator-select",children:"Operator"}),a.jsx(Ah,{id:"operator-select",name:"operator",label:"Operator",value:t,open:i,onOpen:()=>c(!0),onClose:()=>c(!1),onChange:s,renderValue:o,children:e.map(l=>a.jsx(PS,{value:l,separator:IS(e,l),children:a.jsxs(ES,{children:[a.jsx(b7,{children:l}),a.jsx(j7,{children:_r(l)})]})},l))})]})},IS=(e,t)=>t===e[0]?!1:MS.some(n=>n[0]===t),MS=[Lc,Nc,Wc,Fh,zc],AS=u(E1)({marginRight:"-6px"}),FS=u("div")({display:"flex",flexDirection:"column",width:"100%"}),RS=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"start",gap:e.spacing(2)}})),VS=u("div")(({theme:e})=>({width:"100%",display:"inline-flex",flex:1,gap:e.spacing(1)})),LS=u("div")(({theme:e})=>({width:"100%","&&& > div":{width:"100%"}})),y7=u("div")(({theme:e})=>({display:"inline-flex",flex:1,"&&& button":{marginRight:0,"&:not(.operator-is-active)":{backgroundColor:e.palette.background.elevation2}}})),NS=u("div")({width:"100%",flex:1});u(_3)({width:"100%"});const WS=u("div")(({theme:e})=>({"& > h3":{margin:e.spacing(1,0,0,0),fontSize:e.fontSizes.smallBody},"& > div":{margin:0,maxWidth:"unset","& > div":{flex:1},"& .MuiFormControl-root":{margin:e.spacing(.5,0,0,0)},"&:not(:first-of-type)":{marginTop:e.spacing(1)}}})),zS=({filter:e,index:t,stateChanged:n,suggestions:i,onDelete:c})=>{const{parameter:s,inverted:o,operator:l,caseInsensitive:d,value:m,values:f}=e,v=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Filter ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete filter",arrow:!0,children:a.jsx(AS,{onClick:c,children:a.jsx(b3,{})})})})]}),[g,p]=h.useState(!1),x=[...Lc,...Nc,...Wc,...zc],[j,y]=h.useState(""),b=Rh(l),S=()=>{if(n({...e,error:void 0}),m===void 0&&f===void 0)return;const O=f||[m||""],[N,z]=b(...O);N||(y(z),n({...e,error:z}))};h.useEffect(()=>{S()},[m,j]),h.useEffect(()=>{wr(l)?p(!0):p(!1)},[l]);const C=O=>{wr(O)?p(!0):p(!1),n({...e,operator:O})},T=O=>{n({...e,values:void 0,value:O})},$=O=>{n({...e,value:void 0,values:O})},Z=O=>{const N=(f==null?void 0:f.filter((z,V)=>V!==O))||[];$(N)};return a.jsx(zs,{index:t,header:v,children:a.jsxs(FS,{children:[a.jsxs(RS,{children:[a.jsx(NS,{children:a.jsx(K2,{freeSolo:!0,options:i,value:s,onInputChange:(O,N)=>n({...e,parameter:N}),renderInput:O=>a.jsx(se,{...O,size:"small",label:"Parameter"})})}),a.jsxs(VS,{children:[a.jsx(y7,{children:a.jsx(jS,{localConstraint:{inverted:o},setInvertedOperator:()=>n({...e,inverted:!o||void 0})})}),a.jsx(LS,{children:a.jsx(ZS,{options:x,value:l,onChange:C})}),a.jsx(R,{condition:g,show:a.jsx(y7,{children:a.jsx(gS,{localConstraint:{caseInsensitive:d},setCaseInsensitive:()=>n({...e,caseInsensitive:!d||void 0})})})})]})]}),a.jsx(WS,{children:a.jsx(DS,{setValues:$,setValue:T,setError:y,localConstraint:{value:m,values:f},operator:l,error:j,removeValue:Z})})]})})},BS=u("div")(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:e.spacing(2)})),YS=u("div")(({theme:e})=>({position:"absolute",right:0,fontSize:e.fontSizes.smallBody,[e.breakpoints.down("sm")]:{display:"none"}})),HS=u(D,{shouldForwardProp:e=>e!=="verticalConnector"})(({theme:e,verticalConnector:t})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,marginTop:t?0:e.spacing(3),padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium})),US=u(V3)(({theme:e})=>({margin:"auto",width:1,height:e.spacing(3)})),ks=({name:e,verticalConnector:t,resourceLink:n,children:i})=>a.jsxs(a.Fragment,{children:[a.jsx(R,{condition:!!t,show:a.jsx(US,{orientation:"vertical"})}),a.jsxs(HS,{verticalConnector:t,children:[a.jsxs(BS,{children:[a.jsx(z3,{color:"secondary",children:e}),a.jsx(YS,{children:n})]}),i]})]});var I5={},kS=J1;Object.defineProperty(I5,"__esModule",{value:!0});var qs=I5.default=void 0,qS=kS(Q1()),KS=a,GS=(0,qS.default)((0,KS.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");qs=I5.default=GS;const QS=h.lazy(()=>Fc(()=>import("./ReactJSONEditor-DZ9l5V9S.js"),[])),JS=u("span")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(1.5),marginBottom:e.spacing(-.75),height:e.spacing(3)})),XS=u(Kr)({backgroundColor:"transparent",boxShadow:"none","&:before":{display:"none"}}),eO=u(Rc)(({theme:e})=>({lineHeight:"1.5rem",padding:0,marginBottom:e.spacing(-2.25),fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"}})),tO=u(qs)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.fontSizes.smallBody})),nO=u(Gr)(({theme:e})=>({marginTop:e.spacing(2),padding:0})),aO=({payload:e})=>e?a.jsxs(XS,{children:[a.jsx(eO,{expandIcon:a.jsx(E1,{children:a.jsx(tO,{titleAccess:"Toggle"})}),children:"Preview payload"}),a.jsx(nO,{children:a.jsx(h.Suspense,{fallback:null,children:a.jsx(QS,{content:{json:e},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})})})]}):a.jsx(JS,{children:"No signals were received from this source yet."}),Er=(e={},t="")=>Object.entries(e).reduce((n,[i,c])=>{const s=t?`${t}.${i}`:i;return typeof c=="object"&&c!==null&&!Array.isArray(c)?Object.assign(n,Er(c,s)):Array.isArray(c)?c.forEach((o,l)=>{typeof o=="object"&&o!==null?Object.assign(n,Er(o,`${s}[${l}]`)):n[`${s}[${l}]`]=o}):n[s]=c,n},{}),rO=u(V3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),iO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),cO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),sO=({sourceId:e,setSourceId:t,filters:n,setFilters:i,validateSourceId:c})=>{const{signalEndpoints:s,loading:o}=e5(),{signalEndpointSignals:l}=Vh(e,1),d=()=>{const p=y2();i(x=>[...x,{id:p,parameter:"",operator:Lh}])},m=p=>{i(x=>x.map(j=>j.id===p.id?p:j))},f=h.useMemo(()=>o?[]:s.map(({id:p,name:x})=>({label:x,key:`${p}`})),[o,s]),{lastSourcePayload:v,filterSuggestions:g}=h.useMemo(()=>{var x;const p=(x=l[0])==null?void 0:x.payload;return{lastSourcePayload:p,filterSuggestions:Object.keys(Er(p)||{}).sort()}},[l]);return a.jsxs(ks,{name:"When this",resourceLink:a.jsx(g1,{to:"/integrations/signals",children:"Create signal endpoint"}),children:[a.jsx(L3,{label:"Source",options:f,value:`${e}`,onChange:p=>{c(Number(p)),t(Number.parseInt(p))}}),a.jsx(R,{condition:!!e,show:a.jsx(aO,{payload:v})}),a.jsx(rO,{}),n.map((p,x)=>a.jsx(zS,{index:x,filter:p,stateChanged:m,suggestions:g,onDelete:()=>i(j=>j.filter(({id:y})=>y!==p.id))},p.id)),a.jsxs(cO,{children:[a.jsx(a1,{startIcon:a.jsx(Je,{}),onClick:d,variant:"outlined",color:"primary",children:"Add filter"}),a.jsx(R0,{htmlTooltip:!0,tooltip:a.jsxs(iO,{children:[a.jsx("p",{children:"Filters allow you to add conditions to the execution of the actions based on the source payload."}),a.jsx("p",{children:"If no filters are defined then the action will always be triggered from the selected source, no matter the payload."})]})})]})]})},oO=(e,t,n)=>{const i=`${t?`?project=${t}`:""}${n?`${t?"&":"?"}environment=${n}`:""}`,c=`api/admin/service-account/${e}/permissions${i}`,{data:s,error:o,mutate:l}=Qr(!!e,void 0,N1(c),lO);return h.useMemo(()=>({overview:s==null?void 0:s.overview,projectRoles:s==null?void 0:s.projectRoles,rootRole:s==null?void 0:s.rootRole,serviceAccount:s==null?void 0:s.serviceAccount,permissions:(s==null?void 0:s.permissions)||[],loading:!o&&!s,refetch:()=>l(),error:o}),[s,o,l])},lO=e=>fetch(e).then(ne("Service account access overview")).then(t=>t.json()),dO=({label:e,value:t,onChange:n,options:i})=>a.jsx(K2,{options:i,autoHighlight:!0,autoSelect:!0,value:t,onInputChange:(c,s)=>n(s),renderInput:c=>a.jsx(se,{...c,size:"small",label:e})}),uO=({parameter:e,value:t,onChange:n})=>{const{label:i,type:c}=e;if(c==="select"){const{options:s}=e;return a.jsx(dO,{label:i,value:t,onChange:n,options:s})}return null},hO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary}})),mO=({value:e,onChange:t,actionConfigurations:n})=>{const i=(s,o)=>a.jsx("li",{...s,children:a.jsxs(hO,{children:[a.jsx("span",{children:o.label}),a.jsx("span",{children:o.description})]})}),c=[...n].map(([s,o])=>({key:s,...o}));return a.jsx(K2,{options:c,autoHighlight:!0,autoSelect:!0,value:c.find(({key:s})=>s===e)||null,onChange:(s,o)=>t(o?o.key:""),renderOption:i,getOptionLabel:({label:s})=>s,renderInput:s=>a.jsx(se,{...s,size:"small",label:"Action"})})},fO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",gap:e.spacing(2)})),_7=u("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),width:"100%",flexWrap:"wrap"})),w7=u("div")(({theme:e})=>({flex:1,minWidth:e.spacing(25)})),pO=({action:e,index:t,stateChanged:n,actorId:i,onDelete:c,actionConfigurations:s,validated:o})=>{const{action:l,executionParams:d,error:m}=e,f=e1("projectId"),{permissions:v}=oO(i,f,d.environment),g=s.get(l),p=h.useMemo(()=>{const y=g==null?void 0:g.permissions,{environment:b}=d;return v.length===0||!y||!b?!0:y.some(S=>v.some(({permission:C,project:T,environment:$})=>C===S&&T===f&&$===b))},[g,v]);h.useEffect(()=>{n({...e,error:void 0}),((g==null?void 0:g.parameters.filter(({optional:b})=>!b).map(({name:b})=>b))||[]).some(b=>!d[b])&&n({...e,error:"Please fill all required fields."})},[g,d]);const x=a.jsxs(a.Fragment,{children:[a.jsxs("span",{children:["Action ",t+1]}),a.jsx("div",{children:a.jsx(Y1,{title:"Delete action",arrow:!0,children:a.jsx(E1,{onClick:c,children:a.jsx(b3,{})})})})]}),j=(g==null?void 0:g.parameters.filter(({type:y})=>y!=="hidden"))||[];return a.jsx(zs,{index:t,header:x,separator:"THEN",children:a.jsxs(fO,{children:[a.jsx(_7,{children:a.jsx(w7,{children:a.jsx(mO,{value:l,onChange:y=>n({...e,action:y}),actionConfigurations:s})})}),a.jsx(R,{condition:j.length>0,show:a.jsx(_7,{children:j.map(y=>a.jsx(w7,{children:a.jsx(uO,{parameter:y,value:d[y.name],onChange:b=>n({...e,executionParams:{...d,[y.name]:b}})})},y.name))})}),a.jsx(R,{condition:o&&!!m,show:a.jsx(Z1,{severity:"error",children:m})}),a.jsx(R,{condition:!p,show:a.jsx(Z1,{severity:"error",children:"The selected service account does not have permissions to execute this action currently."})})]})})},vO={},gO=e=>{const{isEnterprise:t}=p1(),n=W3("automatedActions"),{data:i,error:c,mutate:s}=Qr(t()&&n,vO,N1(`api/admin/projects/${e}/actions/config`),xO);return h.useMemo(()=>({actionConfigurations:new Map(Object.entries(i||{})),loading:!c&&!i,refetch:()=>s(),error:c}),[i,c,s])},xO=e=>fetch(e).then(ne("Actions configuration")).then(t=>t.json()),bO=u(V3)(({theme:e})=>({margin:e.spacing(2,0),marginBottom:e.spacing(1),borderStyle:"dashed"})),jO=u("div")(({theme:e})=>({display:"flex",marginTop:e.spacing(1),gap:e.spacing(1)})),yO=({serviceAccounts:e,serviceAccountsLoading:t,actions:n,setActions:i,actorId:c,setActorId:s,validateActorId:o,validated:l})=>{const d=e1("projectId"),{actionConfigurations:m}=gO(d),f=p=>{const j={id:y2(),action:"",sortOrder:n.map(y=>y.sortOrder).reduce((y,b)=>Math.max(y,b),0)+1,executionParams:{project:p}};i([...n,j])},v=p=>{i(x=>x.map(j=>j.id===p.id?p:j))},g=h.useMemo(()=>t?[]:e.map(p=>({label:p.name,key:`${p.id}`})),[t,e]);return a.jsxs(ks,{name:"Do these actions",verticalConnector:!0,resourceLink:a.jsx(g1,{to:"/admin/service-accounts",children:"Create service account"}),children:[a.jsx(L3,{label:"Service account",name:"service-account",options:g,value:`${c}`,onChange:p=>{o(Number(p)),s(Number.parseInt(p))}}),a.jsx(bO,{}),n.map((p,x)=>a.jsx(pO,{index:x,action:p,stateChanged:v,actorId:c,onDelete:()=>i(j=>j.filter(y=>y.id!==p.id)),actionConfigurations:m,validated:l},p.id)),a.jsx(jO,{children:a.jsx(a1,{startIcon:a.jsx(Je,{}),onClick:()=>f(d),variant:"outlined",color:"primary",children:"Add action"})})]})},_O=u(Z1)(({theme:e})=>({marginBottom:e.spacing(4)})),wO=u("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),S7=u("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),O7=u(_3)(()=>({width:"100%"})),SO=u(Z1)(({theme:e})=>({marginTop:e.spacing(3)})),OO=({enabled:e,setEnabled:t,name:n,setName:i,description:c,setDescription:s,sourceId:o,setSourceId:l,filters:d,setFilters:m,actorId:f,setActorId:v,actions:g,setActions:p,errors:x,validateName:j,validateSourceId:y,validateActorId:b,validated:S})=>{const{serviceAccounts:C,loading:T}=qc(),$=O=>{setTimeout(()=>O(),300)},Z=S&&Object.values(x).some(Boolean);return a.jsxs("div",{children:[a.jsx(R,{condition:C.length===0,show:a.jsxs(_O,{color:"warning",children:[a.jsx("strong",{children:"Heads up!"})," In order to create an action you need to create a service account first. Please"," ",a.jsx(ce,{to:"/admin/service-accounts",component:g1,children:"go ahead and create one"}),"."]})}),a.jsx(wO,{children:a.jsx(Nh,{checked:e,setChecked:t,children:"Action status"})}),a.jsx(S7,{children:"What is your new action name?"}),a.jsx(O7,{autoFocus:!0,label:"Action name",error:!!x.name,errorText:x.name,value:n,onChange:O=>{j(O.target.value),i(O.target.value)},onBlur:O=>$(()=>j(O.target.value)),autoComplete:"off"}),a.jsx(S7,{children:"What is your new action description?"}),a.jsx(O7,{label:"Action description",value:c,onChange:O=>s(O.target.value),autoComplete:"off"}),a.jsx(sO,{sourceId:o,setSourceId:l,filters:d,setFilters:m,validateSourceId:y}),a.jsx(yO,{serviceAccounts:C,serviceAccountsLoading:T,actions:g,setActions:p,actorId:f,setActorId:v,validateActorId:b,validated:S}),a.jsx(R,{condition:Z,show:()=>a.jsx(SO,{severity:"error",icon:!1,children:a.jsx("ul",{children:Object.values(x).filter(Boolean).map(O=>a.jsx("li",{children:O},O))})})})]})},C7={name:void 0,source:void 0,filters:void 0,actor:void 0,actions:void 0},CO=e=>{const t=e1("projectId"),{actions:n}=Z5(t),[i,c]=h.useState(!1),[s,o]=h.useState(""),[l,d]=h.useState(""),[m,f]=h.useState(0),[v,g]=h.useState([]),[p,x]=h.useState(0),[j,y]=h.useState([]),b=()=>{var E,w,_;c((e==null?void 0:e.enabled)??!0),o((e==null?void 0:e.name)||""),d((e==null?void 0:e.description)||""),f(((E=e==null?void 0:e.match)==null?void 0:E.sourceId)??0),g(Object.entries(((w=e==null?void 0:e.match)==null?void 0:w.payload)??{}).map(([F,{inverted:G,operator:q,caseInsensitive:l1,value:m1,values:J}])=>({id:y2(),parameter:F,inverted:G,operator:q,caseInsensitive:l1,value:m1,values:J}))),x((e==null?void 0:e.actorId)??0),y(((_=e==null?void 0:e.actions)==null?void 0:_.map(F=>({id:y2(),action:F.action,sortOrder:F.sortOrder,executionParams:F.executionParams})))??[]),$(!1),C(C7)};h.useEffect(()=>{b()},[e]);const[S,C]=h.useState(C7),[T,$]=h.useState(!1),Z=E=>{C(w=>({...w,[E]:void 0}))},O=(E,w)=>{C(_=>({..._,[E]:w}))};h.useEffect(()=>{K(v)},[v]),h.useEffect(()=>{Y(j)},[j]);const N=E=>!E.length,z=E=>n==null?void 0:n.some(({id:w,name:_})=>w!==(e==null?void 0:e.id)&&_===E),V=E=>E===0,M=E=>N(E)?(O("name","Name is required."),!1):z(E)?(O("name","Name must be unique."),!1):(Z("name"),!0),H=E=>V(E)?(O("source","Source is required."),!1):(Z("source"),!0),K=E=>E.some(({error:w})=>w)?(O("filters","One or more filters have errors."),!1):(Z("filters"),!0),A=E=>V(E)?(O("actor","Service account is required."),!1):(Z("actor"),!0),Y=E=>E.filter(({action:w})=>!!w).length===0?(O("actions","At least one action is required."),!1):(Z("actions"),E.some(({error:w})=>w)?(O("actions","One or more actions have errors."),!1):(Z("actions"),!0));return{enabled:i,setEnabled:c,name:s,setName:o,description:l,setDescription:d,sourceId:m,setSourceId:f,filters:v,setFilters:g,actorId:p,setActorId:x,actions:j,setActions:y,errors:S,setErrors:C,validated:T,validateName:M,validateSourceId:H,validateActorId:A,validate:()=>{const E=M(s),w=H(m),_=K(v),F=A(p),G=Y(j);return $(!0),E&&w&&_&&F&&G},reloadForm:b}},DO=u("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),$O=u("h1")({fontWeight:"normal"}),TO=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),PO=u("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),EO=u(a1)(({theme:e})=>({marginLeft:e.spacing(3)})),ZO=({action:e,open:t,setOpen:n,onOpenEvents:i})=>{const c=e1("projectId"),{refetch:s}=Z5(c),{addActionSet:o,updateActionSet:l,loading:d}=Vs(c),{setToastData:m,setToastApiError:f}=$1(),{uiConfig:v}=p1(),{enabled:g,setEnabled:p,name:x,setName:j,description:y,setDescription:b,sourceId:S,setSourceId:C,filters:T,setFilters:$,actorId:Z,setActorId:O,actions:N,setActions:z,errors:V,validateName:M,validateSourceId:H,validateActorId:K,validate:A,validated:Y,reloadForm:W}=CO(e);h.useEffect(()=>{W()},[t]);const E=e!==void 0,w=`${E?"Edit":"New"} action`,_={enabled:g,name:x,description:y,match:{source:"signal-endpoint",sourceId:S,payload:T.filter(q=>q.parameter.length>0).reduce((q,{parameter:l1,inverted:m1,operator:J,caseInsensitive:t1,value:r1,values:s1})=>({...q,[l1]:{inverted:m1,operator:J,caseInsensitive:t1,value:r1,values:s1}}),{})},actorId:Z,actions:N.filter(({action:q})=>!!q).map(({action:q,sortOrder:l1,executionParams:m1})=>({action:q,sortOrder:l1,executionParams:m1}))},F=()=>`curl --location --request ${E?"PUT":"POST"} '${v.unleashUrl}/api/admin/projects/${c}/actions${E?`/${e.id}`:""}' \\
710
710
  --header 'Authorization: INSERT_API_KEY' \\
711
711
  --header 'Content-Type: application/json' \\
712
712
  --data-raw '${JSON.stringify(_,void 0,2)}'`,G=async q=>{if(q.preventDefault(),!!A())try{E?await l(e.id,_):await o(_),m({text:`action ${E?"updated":"added"} successfully`,type:"success"}),s(),n(!1)}catch(l1){f(_1(l1))}};return a.jsx(Te,{open:t,onClose:()=>{n(!1)},label:w,children:a.jsxs(Qe,{loading:d,modal:!0,description:"Actions allow you to configure automations based on specific signals, like the ones originated from signal endpoints.",documentationLink:"https://docs.getunleash.io/reference/actions",documentationLinkLabel:"Actions documentation",formatApiCode:F,children:[a.jsxs(DO,{children:[a.jsx($O,{children:w}),a.jsx(R,{condition:E,show:a.jsx(ce,{onClick:i,children:"View events"})})]}),a.jsxs(TO,{onSubmit:G,children:[a.jsx(OO,{enabled:g,setEnabled:p,name:x,setName:j,description:y,setDescription:b,sourceId:S,setSourceId:C,filters:T,setFilters:$,actorId:Z,setActorId:O,actions:N,setActions:z,errors:V,validateName:M,validateSourceId:H,validateActorId:K,validated:Y}),a.jsxs(PO,{children:[a.jsxs(a1,{type:"submit",variant:"contained",color:"primary",children:[E?"Save":"Add"," action"]}),a.jsx(EO,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},IO=({action:e,open:t,setOpen:n,onConfirm:i})=>a.jsx(le,{title:"Delete action?",open:t,primaryButtonText:"Delete action",secondaryButtonText:"Cancel",onClick:()=>i(e),onClose:()=>{n(!1)},children:a.jsxs("p",{children:["You are about to delete action: ",a.jsx("strong",{children:e==null?void 0:e.name})]})}),MO=u(G2)(({theme:e})=>({color:e.palette.success.main})),AO=u(Jr)(({theme:e})=>({color:e.palette.error.main})),FO=({state:e})=>e==="success"?a.jsx(MO,{}):e==="failed"?a.jsx(AO,{}):a.jsx(Xr,{size:20}),RO=u("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),VO=u("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),LO=u("h1")({fontWeight:"normal"}),NO=u("form")({display:"flex",flexDirection:"column",height:"100%"}),WO=u("div")(({theme:e})=>({backgroundColor:e.palette.error.light})),zO=u("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),BO=({action:e,open:t,setOpen:n,onOpenConfiguration:i})=>{const c=e1("projectId"),{locationSettings:s}=K3(),{actionEvents:o,hasMore:l,loadMore:d,loading:m}=Ls(e==null?void 0:e.id,c,20,{refreshInterval:5e3});if(!e)return null;const f=`Events: ${e.name}`;return a.jsx(Te,{open:t,onClose:()=>{n(!1)},label:f,children:a.jsxs(Qe,{loading:m&&o.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[a.jsx(RO,{children:a.jsxs(VO,{children:[a.jsx(LO,{children:f}),a.jsx(ce,{onClick:i,children:"View configuration"})]})}),a.jsxs(NO,{children:[a.jsx(Wh,{height:960,items:o,columns:[{header:"Status",align:"center",maxWidth:100,cell:FO},{header:"Date",maxWidth:240,cell:({createdAt:v})=>Z0(v,s==null?void 0:s.locale)}],sidePanelHeader:"Details",renderContent:Ns,renderItem:({id:v,state:g},p)=>g==="failed"?a.jsx(WO,{children:p},v):p,listEnd:a.jsx(R,{condition:l,show:a.jsx(a1,{onClick:d,children:"Load more"})})}),a.jsx(R,{condition:o.length===0,show:a.jsx("p",{children:"No events have been registered for this action set."})}),a.jsx(zO,{children:a.jsx(a1,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},YO=({modalOpen:e,setModalOpen:t,selectedAction:n,setSelectedAction:i})=>{const{setToastData:c,setToastApiError:s}=$1(),o=e1("projectId"),{actions:l,refetch:d}=Z5(o),{toggleActionSet:m,removeActionSet:f}=Vs(o),{signalEndpoints:v}=e5(),{serviceAccounts:g}=qc(),[p,x]=h.useState(!1),[j,y]=h.useState(!1),b=async(M,H)=>{try{await m(M.id,H),c({text:`"${M.name}" has been ${H?"enabled":"disabled"}`,type:"success"}),d()}catch(K){s(_1(K))}},S=async M=>{try{await f(M.id),c({text:`"${M.name}" has been deleted`,type:"success"}),d(),y(!1)}catch(H){s(_1(H))}},C=K1(O0.breakpoints.down("sm")),T=K1(O0.breakpoints.down("lg")),$=h.useMemo(()=>[{Header:"Name",accessor:"name",minWidth:60,Cell:({row:{original:M}})=>a.jsx(F0,{title:M.name,subtitle:M.description,onClick:()=>{i(M),t(!0)}})},{id:"source",Header:"Source",Cell:({row:{original:M}})=>a.jsx(Tw,{action:M,signalEndpoints:v})},{id:"filters",Header:"Filters",Cell:({row:{original:M}})=>a.jsx(Ew,{action:M}),maxWidth:90},{id:"actor",Header:"Service account",Cell:({row:{original:M}})=>a.jsx(Zw,{action:M,serviceAccounts:g}),minWidth:160},{id:"actions",Header:"Actions",Cell:({row:{original:M}})=>a.jsx(oS,{action:M,onCreateAction:()=>{i(M),t(!0)}}),maxWidth:130},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:M}})=>a.jsx(zh,{checked:M.enabled,setChecked:H=>b(M,H)}),sortType:"boolean",width:90,maxWidth:90},{id:"table-actions",Header:"",align:"center",Cell:({row:{original:M}})=>a.jsx(dS,{actionId:M.id,onOpenEvents:()=>{i(M),x(!0)},onEdit:()=>{i(M),t(!0)},onDelete:()=>{i(M),y(!0)}}),width:50,disableSortBy:!0}],[v,g]),[Z]=h.useState({sortBy:[{id:"name",desc:!0}]}),{headerGroups:O,rows:N,prepareRow:z,setHiddenColumns:V}=k1.useTable({columns:$,data:l,initialState:Z,sortTypes:M0,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:w1}},k1.useSortBy,k1.useFlexLayout);return B2([{condition:T,columns:["actor","enabled"]},{condition:C,columns:["filters","actions"]}],V,$),a.jsxs(a.Fragment,{children:[a.jsx(kr,{rows:N,headerGroups:O,prepareRow:z}),a.jsx(R,{condition:N.length===0,show:a.jsx(ee,{children:"No actions available. Get started by adding one."})}),a.jsx(ZO,{action:n,open:e,setOpen:t,onOpenEvents:()=>{t(!1),x(!0)}}),a.jsx(BO,{action:n,open:p,setOpen:x,onOpenConfiguration:()=>{x(!1),t(!0)}}),a.jsx(IO,{action:n,open:j,setOpen:y,onConfirm:S})]})},HO=()=>{const e=e1("projectId"),t=je(e),{isEnterprise:n}=p1(),i=O1();pe(`Project actions – ${t}`);const[c,s]=h.useState(),[o,l]=h.useState(!1),d=()=>{s(void 0),l(!0)};return n()?a.jsx(R1,{header:a.jsx(S1,{title:"Actions",actions:a.jsx(R2,{onClick:d,maxWidth:`${i.breakpoints.values.sm}px`,Icon:Je,permission:y8,children:"New action"})}),children:a.jsx(Bh,{permissions:y8,children:a.jsx(YO,{modalOpen:o,setModalOpen:l,selectedAction:c,setSelectedAction:s})})}):a.jsx(R1,{header:a.jsx(S1,{title:"Actions"}),children:a.jsx(A0,{feature:"actions"})})},D7=u(D)({marginLeft:"auto",display:"flex",alignItems:"center"}),UO=()=>{var d;const e=Bc(),{isPro:t,isEnterprise:n}=p1(),i=te(),c=W3("automatedActions"),s=(...m)=>t()||n()?m:[],o=[...s({id:"",label:"Project settings"},{id:"access",label:"User access"}),{id:"api-access",label:"API access"},{id:"segments",label:"Segments"},{id:"environments",label:"Environments"},{id:"default-strategy",label:"Default strategy"},...s({id:"change-requests",label:"Change request configuration",endIcon:t()?a.jsx(D7,{children:a.jsx(Sr,{})}):void 0})];c&&o.push({id:"actions",label:"Actions",endIcon:t()?a.jsx(D7,{children:a.jsx(Sr,{})}):void 0});const l=m=>{i(m.id)};return a.jsx(Yh,{tabs:o,value:((d=o.find(({id:m})=>{var f;return m&&((f=e.pathname)==null?void 0:f.includes(`/settings/${m}`))}))==null?void 0:d.id)||o[0].id,onChange:l,children:a.jsxs(J3,{children:[a.jsx(y1,{path:"/*",element:a.jsx(ww,{})}),a.jsx(y1,{path:"environments/*",element:a.jsx(d_,{})}),a.jsx(y1,{path:"access/*",element:a.jsx(By,{})}),a.jsx(y1,{path:"segments/*",element:a.jsx(g_,{})}),a.jsx(y1,{path:"change-requests/*",element:a.jsx(m_,{})}),a.jsx(y1,{path:"api-access/*",element:a.jsx(v_,{})}),a.jsx(y1,{path:"default-strategy/*",element:a.jsx(C_,{})}),a.jsx(y1,{path:"actions/*",element:a.jsx(HO,{})}),a.jsx(y1,{path:"*",element:a.jsx(Yc,{replace:!0,to:o[0].id})})]})})},kO=u(Hh)(({theme:e})=>({color:e.palette.action.disabled})),qO=()=>a.jsx(I3,{title:`This projects collaboration mode is set to private. The project and associated feature
@@ -1,4 +1,4 @@
1
- import{j9 as w,ja as K,jb as v,jc as V,jd as Y,je as Z,jf as W,jg as p,jh as Q,ji as D,j2 as O,jj as ee,jk as re,b as te,bs as ae,r as ie,j as ne,j6 as oe,i$ as se,j0 as le,j1 as ue,jl as de,j4 as fe,j5 as ve,jm as he,jn as ye}from"./index-CqYZiU1N.js";/*!
1
+ import{j9 as w,ja as K,jb as v,jc as V,jd as Y,je as Z,jf as W,jg as p,jh as Q,ji as D,j2 as O,jj as ee,jk as re,b as te,bs as ae,r as ie,j as ne,j6 as oe,i$ as se,j0 as le,j1 as ue,jl as de,j4 as fe,j5 as ve,jm as he,jn as ye}from"./index-A5We7bvX.js";/*!
2
2
  * chartjs-plugin-datalabels v2.2.0
3
3
  * https://chartjs-plugin-datalabels.netlify.app
4
4
  * (c) 2017-2022 chartjs-plugin-datalabels contributors
@@ -1 +1 @@
1
- import{jo as u,jp as g,s as x,b as j,bs as y,r as p,j as a,jq as b,jr as m,C,js as S,jt as h,ju as f,i$ as L,j0 as R,j1 as w,ji as A,jv as T,jl as k,j4 as v,j5 as E,jm as _,jn as D}from"./index-CqYZiU1N.js";const F={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:t=>{var l;const s=t.data.datasets,{labels:{usePointStyle:e,pointStyle:o,textAlign:r,color:d}}=((l=t==null?void 0:t.legend)==null?void 0:l.options)||{labels:{}};return t._getSortedDatasetMetas().map(n=>{const i=n.controller.getStyle(e?0:void 0);return{text:s[n.index].label,fillStyle:i.borderColor,fontColor:d,hidden:!n.visible,lineWidth:0,borderRadius:6,strokeStyle:i.borderColor,pointStyle:o||i.pointStyle,textAlign:r||i.textAlign,datasetIndex:n.index}})}}},M=(t,s,e,o)=>({responsive:!0,...o?{animation:{duration:0}}:{},plugins:{legend:{...F,display:!o},tooltip:{enabled:!1,position:"nearest",external:u(e)}},locale:s.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},color:t.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:t.palette.divider,borderColor:t.palette.divider},ticks:{color:t.palette.text.secondary,display:!o,precision:0}},x:{adapters:{date:{locale:g(s.locale)}},type:"time",time:{unit:"week",tooltipFormat:"P"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:t.palette.text.secondary,display:!o,source:"data",maxRotation:90,minRotation:23.5}}}}),W=x("div")(({theme:t})=>({position:"relative"}));function q(t){return D.all(t.filter(s=>s))}const G=({data:t,aspectRatio:s=2.5,cover:e,overrideOptions:o,TooltipComponent:r})=>{const d=j(),{locationSettings:l}=y(),[n,i]=p.useState(null),c=p.useMemo(()=>q([M(d,l,i,!!e),o??{}]),[d,l,i,o,e]);return a.jsxs(W,{children:[a.jsx(b,{options:c,data:t,plugins:[m({width:26})],height:100,width:100*s},e?"cover":"chart"),a.jsx(C,{condition:!e,show:r?a.jsx(S,{tooltip:n,children:a.jsx(r,{tooltip:n})}):a.jsx(h,{tooltip:n}),elseShow:a.jsx(f,{children:e!==!0?e:" "})})]})};L.register(R,w,A,T,k,v,E,_);export{G as default};
1
+ import{jo as u,jp as g,s as x,b as j,bs as y,r as p,j as a,jq as b,jr as m,C,js as S,jt as h,ju as f,i$ as L,j0 as R,j1 as w,ji as A,jv as T,jl as k,j4 as v,j5 as E,jm as _,jn as D}from"./index-A5We7bvX.js";const F={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:t=>{var l;const s=t.data.datasets,{labels:{usePointStyle:e,pointStyle:o,textAlign:r,color:d}}=((l=t==null?void 0:t.legend)==null?void 0:l.options)||{labels:{}};return t._getSortedDatasetMetas().map(n=>{const i=n.controller.getStyle(e?0:void 0);return{text:s[n.index].label,fillStyle:i.borderColor,fontColor:d,hidden:!n.visible,lineWidth:0,borderRadius:6,strokeStyle:i.borderColor,pointStyle:o||i.pointStyle,textAlign:r||i.textAlign,datasetIndex:n.index}})}}},M=(t,s,e,o)=>({responsive:!0,...o?{animation:{duration:0}}:{},plugins:{legend:{...F,display:!o},tooltip:{enabled:!1,position:"nearest",external:u(e)}},locale:s.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},color:t.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:t.palette.divider,borderColor:t.palette.divider},ticks:{color:t.palette.text.secondary,display:!o,precision:0}},x:{adapters:{date:{locale:g(s.locale)}},type:"time",time:{unit:"week",tooltipFormat:"P"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:t.palette.text.secondary,display:!o,source:"data",maxRotation:90,minRotation:23.5}}}}),W=x("div")(({theme:t})=>({position:"relative"}));function q(t){return D.all(t.filter(s=>s))}const G=({data:t,aspectRatio:s=2.5,cover:e,overrideOptions:o,TooltipComponent:r})=>{const d=j(),{locationSettings:l}=y(),[n,i]=p.useState(null),c=p.useMemo(()=>q([M(d,l,i,!!e),o??{}]),[d,l,i,o,e]);return a.jsxs(W,{children:[a.jsx(b,{options:c,data:t,plugins:[m({width:26})],height:100,width:100*s},e?"cover":"chart"),a.jsx(C,{condition:!e,show:r?a.jsx(S,{tooltip:n,children:a.jsx(r,{tooltip:n})}):a.jsx(h,{tooltip:n}),elseShow:a.jsx(f,{children:e!==!0?e:" "})})]})};L.register(R,w,A,T,k,v,E,_);export{G as default};
@@ -1 +1 @@
1
- import{cf as H,b9 as C,bb as L,j as e,aY as P,C as p,V as m,T as k,L as y,aW as R,aX as D,e as M,bf as W,fN as E,aU as _,aV as N,h as z,r as f,dC as F,dD as V,s as G,A as J,m as K,l as X,n as Y,o as Q,j7 as Z,as as U,B as T,f7 as I,j8 as A,f8 as b}from"./index-CqYZiU1N.js";const ee=t=>fetch(t).then(L("ChangeRequest")).then(s=>s.json()),te=(t,s)=>{const r=s.map(i=>`feature=${i}`).join("&"),{data:n,error:a,mutate:o}=H([],C(`api/admin/projects/${t}/change-requests/scheduled?${r}`),ee);return{changeRequests:n,loading:!a&&!n,refetch:o,error:a}},S=()=>e.jsx(m,{severity:"warning",sx:{m:t=>t.spacing(2,0)},children:"Archiving flags with dependencies will also remove those dependencies."}),ne=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t?e.jsxs(m,{severity:"warning",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(k,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have usage from applications. If you archive these feature flags they will not be available to Client SDKs:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):null},$=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t&&t.length>1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(k,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have child features that depend on them and are not part of the archive operation. These parent features can not be archived:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):t&&t.length===1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(y,{to:r(t[0]),children:t[0]})," has child features that depend on it and are not part of the archive operation."]}):null},q=({changeRequests:t,projectId:s})=>t&&t.length>0?e.jsxs(m,{severity:"warning",sx:{m:r=>r.spacing(2,0)},children:[e.jsxs("p",{children:["This archive operation would conflict with"," ",t.length," scheduled change request(s). The change request(s) that would be affected by this are:"]}),e.jsx("ul",{children:t.map(({id:r,title:n})=>{const a=n?`#${r} (${n})`:`Change request #${r}`;return e.jsx("li",{children:e.jsx(y,{to:`/projects/${s}/change-requests/${r}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:a})},r)})})]}):t===void 0?e.jsx(m,{severity:"warning",children:e.jsx("p",{children:"This archive operation might conflict with one or more scheduled change requests. If you complete it, those change requests can no longer be applied."})}):null,se=(t,s)=>{const n=R(t)(),{isChangeRequestConfiguredForReview:a}=D(t);return n&&a(n)&&s?"Add to change request":n&&a(n)?"Add change to draft":s?"Archive flags":"Archive flag"},ae=({projectId:t,featureIds:s,onSuccess:r,onError:n})=>{const{setToastData:a,setToastApiError:o}=M(),{archiveFeatureToggle:i}=W(),{archiveFeatures:c}=E(),{isChangeRequestConfiguredForReview:h}=D(t),{addChange:x}=_(),{refetch:u}=N(t),d=R(t),g=(s==null?void 0:s.length)>1,l=d(),v=async()=>{if(!l){console.error("No change request environment");return}await x(t,l,s.map(w=>({action:"archiveFeature",feature:w,payload:void 0}))),u(),a({type:"success",text:g?"Changes added to a draft":"Change added to a draft"})},j=async()=>{await i(t,s[0]),a({type:"success",text:"Feature flag archived"})},O=async()=>{await c(t,s),a({type:"success",text:"Feature flags archived"})};return async()=>{try{l&&h(l)?await v():g?await O():await j(),r()}catch(w){o(z(w)),n()}}},re=(t,s,r)=>{const[n,a]=f.useState(!0),[o,i]=f.useState([]),[c,h]=f.useState(!1),{verifyArchiveFeatures:x}=E();return f.useEffect(()=>{r&&x(s,t).then(u=>u.json()).then(({hasDeletedDependencies:u,parentsWithChildFeatures:d})=>{d.length===0?(a(!1),i(d)):(a(!0),i(d)),h(u)})},[JSON.stringify(t),r,s,i,a,h]),{disableArchive:n,offendingParents:o,hasDeletedDependencies:c}},ue=({isOpen:t,onClose:s,onConfirm:r,projectId:n,featureIds:a,featuresWithUsage:o})=>{const i=(a==null?void 0:a.length)>1,c=se(n,i),h=i?"Archive feature flags":"Archive feature flag",x=ae({projectId:n,featureIds:a,onSuccess(){r(),s()},onError(){s()}}),{changeRequests:u}=te(n,a),{disableArchive:d,offendingParents:g,hasDeletedDependencies:l}=re(a,n,t),v=g.length===0&&l;return e.jsx(P,{onClick:x,open:t,onClose:s,primaryButtonText:c,secondaryButtonText:"Cancel",title:h,disabledPrimaryButton:d,children:e.jsx(p,{condition:i,show:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",e.jsx("strong",{children:a==null?void 0:a.length})," feature flags?"]}),e.jsx(p,{condition:!!(o&&(o==null?void 0:o.length)>0),show:e.jsx(ne,{ids:o,projectId:n})}),e.jsx(p,{condition:g.length>0,show:e.jsx($,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(q,{changeRequests:u,projectId:n}),e.jsx(p,{condition:(a==null?void 0:a.length)<=5,show:e.jsx("ul",{children:a==null?void 0:a.map(j=>e.jsx("li",{children:j},j))})})]}),elseShow:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",i?"these feature flags":"this feature flag","?"]}),e.jsx(p,{condition:g.length>0,show:e.jsx($,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(q,{changeRequests:u,projectId:n})]})})})},ie=(t,s)=>`/api/admin/projects/${t}/features/${s}/parents`,ge=(t,s)=>{const r=C(ie(t,s)),{data:n,refetch:a,loading:o,error:i}=F(r,()=>V(r,"Parent Options"));return{parentOptions:n,loading:o,error:i}},oe=(t,s)=>`/api/admin/projects/${t}/features/${s}/parent-variants`,B=(t,s)=>{const r=C(oe(t,s)),{data:n,refetch:a,loading:o,error:i}=F(r,()=>V(r,"Parent Variant Options"));return{parentVariantOptions:n||[],loading:o,error:i}},ce=G(J)(({theme:t})=>({marginTop:t.spacing(2),marginBottom:t.spacing(1.5)})),le=({project:t,parent:s,onSelect:r})=>{const{parentVariantOptions:n}=B(t,s),a=e.jsx(Y,{fontSize:"small"}),o=e.jsx(Q,{fontSize:"small"});return e.jsx(ce,{id:"single-variant-options",options:n,renderOption:(i,c,{selected:h})=>e.jsxs("li",{...i,children:[e.jsx(K,{icon:a,checkedIcon:o,style:{marginRight:8},checked:h}),c]}),renderInput:i=>e.jsx(X,{...i,placeholder:"Select variant"}),fullWidth:!0,onChange:(i,c)=>{r(String(c))}})},de=({projectId:t,featureId:s,isOpen:r,setIsOpen:n,onComplete:a})=>{const{markFeatureCompleted:o}=Z(),{parentVariantOptions:i}=B(t,s),[c,h]=f.useState("kept"),[x,u]=f.useState(void 0),{trackEvent:d}=U(),g=async()=>{const l=c==="kept-with-variant"?"kept":c;await o(s,t,{status:l,statusValue:x}),n(!1),a(),d("feature-lifecycle",{props:{eventType:"complete",status:l}})};return e.jsx(P,{open:r,title:"Mark completed",onClose:()=>{n(!1)},disabledPrimaryButton:c==="kept-with-variant"&&x===null,onClick:g,primaryButtonText:"Mark completed",secondaryButtonText:"Cancel",children:e.jsxs(T,{children:[e.jsxs(T,{sx:{mt:2,mb:4},children:["Marking the feature ",e.jsx("b",{children:s})," as complete does not affect any configuration, but it moves the feature flag into it’s next life cycle stage and is an indication that you have learned what you needed in order to progress with the feature. It serves as a reminder to start cleaning up the feature flag and removing it from the code."]}),e.jsx(k,{sx:{mb:2},children:e.jsx("b",{children:"What was the outcome of this feature?"})}),e.jsxs(I,{"aria-label":"selected-value",name:"selected",sx:{gap:l=>l.spacing(.5)},onChange:(l,v)=>{h(v)},children:[e.jsx(A,{value:"kept",legal:{value:"We decided to keep the feature"},control:e.jsx(b,{})},"kept"),e.jsx(A,{value:"discarded",legal:{value:"We decided to discard the feature"},control:e.jsx(b,{})},"discarded"),e.jsx(p,{condition:i.length>0,show:e.jsx(A,{value:"kept-with-variant",legal:{value:"We decided to keep the feature variant",description:"Choose to specify which feature variant will be kept"},control:e.jsx(b,{})},"kept-with-variant")}),e.jsx(p,{condition:i.length>0&&c==="kept-with-variant",show:e.jsx(le,{parent:s,project:t,onSelect:l=>{u(l)}})})]})]})})};export{ue as F,de as M,ge as a,B as u};
1
+ import{cf as H,b9 as C,bb as L,j as e,aY as P,C as p,V as m,T as k,L as y,aW as R,aX as D,e as M,bf as W,fN as E,aU as _,aV as N,h as z,r as f,dC as F,dD as V,s as G,A as J,m as K,l as X,n as Y,o as Q,j7 as Z,as as U,B as T,f7 as I,j8 as A,f8 as b}from"./index-A5We7bvX.js";const ee=t=>fetch(t).then(L("ChangeRequest")).then(s=>s.json()),te=(t,s)=>{const r=s.map(i=>`feature=${i}`).join("&"),{data:n,error:a,mutate:o}=H([],C(`api/admin/projects/${t}/change-requests/scheduled?${r}`),ee);return{changeRequests:n,loading:!a&&!n,refetch:o,error:a}},S=()=>e.jsx(m,{severity:"warning",sx:{m:t=>t.spacing(2,0)},children:"Archiving flags with dependencies will also remove those dependencies."}),ne=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t?e.jsxs(m,{severity:"warning",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(k,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have usage from applications. If you archive these feature flags they will not be available to Client SDKs:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):null},$=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t&&t.length>1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(k,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have child features that depend on them and are not part of the archive operation. These parent features can not be archived:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):t&&t.length===1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(y,{to:r(t[0]),children:t[0]})," has child features that depend on it and are not part of the archive operation."]}):null},q=({changeRequests:t,projectId:s})=>t&&t.length>0?e.jsxs(m,{severity:"warning",sx:{m:r=>r.spacing(2,0)},children:[e.jsxs("p",{children:["This archive operation would conflict with"," ",t.length," scheduled change request(s). The change request(s) that would be affected by this are:"]}),e.jsx("ul",{children:t.map(({id:r,title:n})=>{const a=n?`#${r} (${n})`:`Change request #${r}`;return e.jsx("li",{children:e.jsx(y,{to:`/projects/${s}/change-requests/${r}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:a})},r)})})]}):t===void 0?e.jsx(m,{severity:"warning",children:e.jsx("p",{children:"This archive operation might conflict with one or more scheduled change requests. If you complete it, those change requests can no longer be applied."})}):null,se=(t,s)=>{const n=R(t)(),{isChangeRequestConfiguredForReview:a}=D(t);return n&&a(n)&&s?"Add to change request":n&&a(n)?"Add change to draft":s?"Archive flags":"Archive flag"},ae=({projectId:t,featureIds:s,onSuccess:r,onError:n})=>{const{setToastData:a,setToastApiError:o}=M(),{archiveFeatureToggle:i}=W(),{archiveFeatures:c}=E(),{isChangeRequestConfiguredForReview:h}=D(t),{addChange:x}=_(),{refetch:u}=N(t),d=R(t),g=(s==null?void 0:s.length)>1,l=d(),v=async()=>{if(!l){console.error("No change request environment");return}await x(t,l,s.map(w=>({action:"archiveFeature",feature:w,payload:void 0}))),u(),a({type:"success",text:g?"Changes added to a draft":"Change added to a draft"})},j=async()=>{await i(t,s[0]),a({type:"success",text:"Feature flag archived"})},O=async()=>{await c(t,s),a({type:"success",text:"Feature flags archived"})};return async()=>{try{l&&h(l)?await v():g?await O():await j(),r()}catch(w){o(z(w)),n()}}},re=(t,s,r)=>{const[n,a]=f.useState(!0),[o,i]=f.useState([]),[c,h]=f.useState(!1),{verifyArchiveFeatures:x}=E();return f.useEffect(()=>{r&&x(s,t).then(u=>u.json()).then(({hasDeletedDependencies:u,parentsWithChildFeatures:d})=>{d.length===0?(a(!1),i(d)):(a(!0),i(d)),h(u)})},[JSON.stringify(t),r,s,i,a,h]),{disableArchive:n,offendingParents:o,hasDeletedDependencies:c}},ue=({isOpen:t,onClose:s,onConfirm:r,projectId:n,featureIds:a,featuresWithUsage:o})=>{const i=(a==null?void 0:a.length)>1,c=se(n,i),h=i?"Archive feature flags":"Archive feature flag",x=ae({projectId:n,featureIds:a,onSuccess(){r(),s()},onError(){s()}}),{changeRequests:u}=te(n,a),{disableArchive:d,offendingParents:g,hasDeletedDependencies:l}=re(a,n,t),v=g.length===0&&l;return e.jsx(P,{onClick:x,open:t,onClose:s,primaryButtonText:c,secondaryButtonText:"Cancel",title:h,disabledPrimaryButton:d,children:e.jsx(p,{condition:i,show:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",e.jsx("strong",{children:a==null?void 0:a.length})," feature flags?"]}),e.jsx(p,{condition:!!(o&&(o==null?void 0:o.length)>0),show:e.jsx(ne,{ids:o,projectId:n})}),e.jsx(p,{condition:g.length>0,show:e.jsx($,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(q,{changeRequests:u,projectId:n}),e.jsx(p,{condition:(a==null?void 0:a.length)<=5,show:e.jsx("ul",{children:a==null?void 0:a.map(j=>e.jsx("li",{children:j},j))})})]}),elseShow:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",i?"these feature flags":"this feature flag","?"]}),e.jsx(p,{condition:g.length>0,show:e.jsx($,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(q,{changeRequests:u,projectId:n})]})})})},ie=(t,s)=>`/api/admin/projects/${t}/features/${s}/parents`,ge=(t,s)=>{const r=C(ie(t,s)),{data:n,refetch:a,loading:o,error:i}=F(r,()=>V(r,"Parent Options"));return{parentOptions:n,loading:o,error:i}},oe=(t,s)=>`/api/admin/projects/${t}/features/${s}/parent-variants`,B=(t,s)=>{const r=C(oe(t,s)),{data:n,refetch:a,loading:o,error:i}=F(r,()=>V(r,"Parent Variant Options"));return{parentVariantOptions:n||[],loading:o,error:i}},ce=G(J)(({theme:t})=>({marginTop:t.spacing(2),marginBottom:t.spacing(1.5)})),le=({project:t,parent:s,onSelect:r})=>{const{parentVariantOptions:n}=B(t,s),a=e.jsx(Y,{fontSize:"small"}),o=e.jsx(Q,{fontSize:"small"});return e.jsx(ce,{id:"single-variant-options",options:n,renderOption:(i,c,{selected:h})=>e.jsxs("li",{...i,children:[e.jsx(K,{icon:a,checkedIcon:o,style:{marginRight:8},checked:h}),c]}),renderInput:i=>e.jsx(X,{...i,placeholder:"Select variant"}),fullWidth:!0,onChange:(i,c)=>{r(String(c))}})},de=({projectId:t,featureId:s,isOpen:r,setIsOpen:n,onComplete:a})=>{const{markFeatureCompleted:o}=Z(),{parentVariantOptions:i}=B(t,s),[c,h]=f.useState("kept"),[x,u]=f.useState(void 0),{trackEvent:d}=U(),g=async()=>{const l=c==="kept-with-variant"?"kept":c;await o(s,t,{status:l,statusValue:x}),n(!1),a(),d("feature-lifecycle",{props:{eventType:"complete",status:l}})};return e.jsx(P,{open:r,title:"Mark completed",onClose:()=>{n(!1)},disabledPrimaryButton:c==="kept-with-variant"&&x===null,onClick:g,primaryButtonText:"Mark completed",secondaryButtonText:"Cancel",children:e.jsxs(T,{children:[e.jsxs(T,{sx:{mt:2,mb:4},children:["Marking the feature ",e.jsx("b",{children:s})," as complete does not affect any configuration, but it moves the feature flag into it’s next life cycle stage and is an indication that you have learned what you needed in order to progress with the feature. It serves as a reminder to start cleaning up the feature flag and removing it from the code."]}),e.jsx(k,{sx:{mb:2},children:e.jsx("b",{children:"What was the outcome of this feature?"})}),e.jsxs(I,{"aria-label":"selected-value",name:"selected",sx:{gap:l=>l.spacing(.5)},onChange:(l,v)=>{h(v)},children:[e.jsx(A,{value:"kept",legal:{value:"We decided to keep the feature"},control:e.jsx(b,{})},"kept"),e.jsx(A,{value:"discarded",legal:{value:"We decided to discard the feature"},control:e.jsx(b,{})},"discarded"),e.jsx(p,{condition:i.length>0,show:e.jsx(A,{value:"kept-with-variant",legal:{value:"We decided to keep the feature variant",description:"Choose to specify which feature variant will be kept"},control:e.jsx(b,{})},"kept-with-variant")}),e.jsx(p,{condition:i.length>0&&c==="kept-with-variant",show:e.jsx(le,{parent:s,project:t,onSelect:l=>{u(l)}})})]})]})})};export{ue as F,de as M,ge as a,B as u};