unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
4 lines • 865 kB
JavaScript
import{n as e,r as t,s as n,t as r}from"./jsx-runtime-ButemYzH.js";import{_ as i,a,c as o,d as s,g as c,h as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,v}from"./RoleCell-DPCs9tBq.js";import{t as y}from"./toDate-zSA17Csy.js";import{$a as b,$c as x,$d as S,$i as C,$l as w,$o as T,$s as E,$u as D,Ac as O,Ad as k,Al as A,Ar as j,Au as ee,Ba as te,Bs as M,Bu as ne,C as re,Ca as N,Cd as P,Ci as ie,Cl as ae,Cn as oe,Co as se,Cr as ce,Cs as le,Ct as ue,Da as de,Dd as fe,Dn as pe,Dr as me,Ds as he,Dt as ge,Du as _e,Ea as ve,En as ye,Er as be,Et as xe,Eu as Se,Fa as Ce,Fi as we,Fl as Te,Fn as Ee,Fr as De,Fs as Oe,Fu as ke,Ga as Ae,Gc as je,Gd as Me,Gi as Ne,Go as Pe,Gr as Fe,Gs as Ie,Gt as Le,Gu as Re,Hc as ze,Hd as Be,Hi as Ve,Hn as He,Hr as Ue,Hs as F,Hu as We,Ia as Ge,Ii as Ke,Io as qe,Ir as Je,Iu as Ye,Ja as Xe,Jd as Ze,Ji as Qe,Jo as $e,Js as et,Jt as tt,Ju as nt,Kc as rt,Kd as it,Ki as at,Kn as ot,Ko as st,Kr as ct,Ks as lt,Kt as ut,Ku as dt,La as ft,Li as pt,Ll as mt,Ln as ht,Ls as I,Lu as gt,Ma as _t,Mc as vt,Md as yt,Ml as bt,Mo as xt,Ms as St,Mu as Ct,Na as L,Nc as wt,Nd as Tt,Nn as Et,Ns as R,Nu as Dt,Oi as Ot,Ol as kt,On as At,Oo as jt,Or as Mt,Os as Nt,Ou as Pt,Pn as Ft,Pr as It,Ps as Lt,Pu as Rt,Qa as zt,Qc as Bt,Qd as Vt,Qi as Ht,Ql as Ut,Qn as Wt,Qo as Gt,Qs as Kt,Qt as qt,Qu as Jt,Rc as Yt,Ri as Xt,Rn as Zt,Rs as Qt,Rt as $t,S as en,Sa as tn,Sc as nn,Sd as rn,Si as an,Sl as on,Sn as sn,So as cn,Sr as ln,Ss as un,T as dn,Ta as fn,Tc as pn,Td as mn,Ti as hn,Tn as gn,To as _n,Tr as vn,Ts as yn,Tt as bn,Uc as xn,Ui as Sn,Ur as Cn,Us as wn,Uu as Tn,Va as En,Vc as Dn,Vi as On,Vl as kn,Vo as An,Vs as jn,Vu as Mn,Wa as Nn,Wc as Pn,Wi as Fn,Wn as In,Wo as Ln,Wr as Rn,Ws as zn,Wt as Bn,X as Vn,Xa as Hn,Xc as Un,Xd as z,Xi as Wn,Xo as Gn,Xs as Kn,Xu as B,Ya as qn,Yc as Jn,Yd as Yn,Yl as Xn,Yn as Zn,Yo as Qn,Ys as $n,Yu as V,Za as er,Zc as tr,Zd as nr,Zi as rr,Zs as ir,Zu as ar,_d as or,_o as sr,_s as cr,_u as lr,ad as ur,al as dr,ao as fr,at as pr,b as mr,bd as hr,bi as gr,bs as _r,cc as vr,cd as yr,cl as br,co as xr,dc as Sr,dd as Cr,di as wr,du as Tr,ea as Er,ec as Dr,ed as Or,ef as kr,eo as Ar,es as jr,eu as Mr,fi as Nr,fu as Pr,g as Fr,gc as Ir,gd as Lr,gi as Rr,gr as zr,hc as Br,hi as Vr,ho as Hr,hs as Ur,hu as Wr,ic as Gr,id as Kr,il as qr,io as Jr,it as Yr,jd as Xr,ji as Zr,jo as Qr,jr as $r,js as ei,kc as ti,kd as ni,kl as ri,kn as ii,kr as ai,ku as oi,lc as si,lo as ci,lr as li,ls as ui,lu as di,mi as fi,ms as pi,na as mi,nc as hi,nf as gi,ni as _i,nl as vi,no as yi,nt as bi,nu as xi,oc as Si,od as Ci,oi as wi,ol as Ti,oo as Ei,ot as Di,ou as Oi,pd as ki,pi as Ai,pn as ji,pt as Mi,qa as Ni,qd as Pi,qi as Fi,qn as Ii,qo as Li,qs as Ri,qu as zi,ra as Bi,rc as Vi,rd as H,ri as Hi,rl as Ui,ro as Wi,rs as Gi,rt as Ki,ru as qi,sc as Ji,si as Yi,sl as Xi,so as Zi,ss as Qi,st as $i,ta as ea,tc as ta,td as na,tf as ra,tl as ia,to as aa,tr as oa,tu as sa,uc as ca,ud as la,ui as ua,uo as da,us as fa,uu as pa,v as ma,vi as ha,w as ga,wa as _a,wc as va,wi as ya,wl as ba,wn as xa,wo as Sa,wr as Ca,ws as wa,wt as Ta,wu as Ea,x as Da,xa as Oa,xc as ka,xd as U,xi as Aa,xl as ja,xo as Ma,xr as Na,xs as Pa,xu as Fa,y as Ia,ya as La,yi as Ra,yl as za,yo as Ba,yr as Va,ys as Ha,yu as Ua,z as Wa,za as Ga,zi as Ka,zs as qa}from"./index-B0RbDPtk.js";import{i as Ja,t as Ya}from"./MarkCompletedDialogue-x4B5vgpn.js";import{b as Xa,c as Za,d as Qa,f as $a,g as eo,h as to,l as no,m as ro,n as io,o as ao,p as oo,s as so,t as co,u as lo,v as uo,x as fo,y as po}from"./FeatureStaleDialog-BfIPQAKa.js";function mo(e,t){let n=y(e,t?.in);if(isNaN(+n))throw RangeError(`Invalid time value`);let r=t?.format??`extended`,i=t?.representation??`complete`,a=``,o=``,s=r===`extended`?`-`:``,c=r===`extended`?`:`:``;if(i!==`time`){let e=kn(n.getDate(),2),t=kn(n.getMonth()+1,2);a=`${kn(n.getFullYear(),4)}${s}${t}${s}${e}`}if(i!==`date`){let e=n.getTimezoneOffset();if(e!==0){let t=Math.abs(e),n=kn(Math.trunc(t/60),2),r=kn(t%60,2);o=`${e<0?`+`:`-`}${n}:${r}`}else o=`Z`;let t=kn(n.getHours(),2),r=kn(n.getMinutes(),2),i=kn(n.getSeconds(),2),s=a===``?``:`T`,l=[t,r,i].join(c);a=`${a}${s}${l}${o}`}return a}var W=n(e()),G=r(),ho=e=>(0,G.jsx)(`svg`,{width:20,height:18,viewBox:`0 0 20 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsx)(`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`})}),go=U(`div`)(()=>({display:`flex`})),_o=U(`div`)(()=>({display:`grid`,gridTemplateColumns:`minmax(0, 1fr) auto`,width:`100%`}));U(`div`)(()=>({display:`flex`,flexDirection:`column`}));var vo=U(`span`)(({theme:e})=>({textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`}));U(U(`span`)(({theme:e})=>({fontSize:e.fontSizes.smallBody,fontWeight:`normal`})))(({theme:e})=>({color:e.palette.neutral.dark}));var yo=U(ya)(({theme:e})=>({marginLeft:e.spacing(-1.5)})),bo=U(`div`)(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),xo=U(`div`)(({theme:e})=>({padding:e.spacing(2.5,5),display:`flex`,flexDirection:`column`,alignItems:`start`})),So=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})),Co=U(`div`)(({theme:e})=>({width:`100%`,backgroundColor:e.palette.divider,height:`1px`})),wo=U(`div`)(({theme:e})=>({padding:e.spacing(0,4)})),To=U(lr)(({theme:e})=>({textTransform:`none`,flexBasis:0,[e.breakpoints.down(`md`)]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1),minWidth:170},[e.breakpoints.up(`md`)]:{minWidth:170}})),Eo=or((0,G.jsx)(`path`,{d:`M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-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-2m-1 9h-4v4h-2v-4H9V9h4V5h2v4h4z`}),`LibraryAdd`),Do=or((0,G.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.27M12 17.5 6.5 12H10v-2h4v2h3.5zM5.12 5l.81-1h12l.94 1z`}),`Archive`),Oo=or((0,G.jsx)(`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2m4.2 14.2L11 13V7h1.5v5.2l4.5 2.7z`}),`WatchLater`),ko=n(Qe(),1),Ao=U(B)(({theme:e})=>({display:`flex`,justifyContent:`center`,paddingRight:e.spacing(2)})),jo=({projectId:e,row:t,onOpenArchiveDialog:n,onOpenStaleDialog:r})=>{let[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1),{setToastData:c}=Lt(),{original:{name:l,stale:u}}=t,d=!!i,f=e=>{a(e.currentTarget)},p=()=>{a(null)},m=`feature-${l}-actions`,h=`${m}-menu`;return(0,G.jsxs)(Ao,{children:[(0,G.jsx)(Ua,{title:`Feature flag actions`,arrow:!0,describeChild:!0,children:(0,G.jsx)(ur,{id:m,"data-loading":!0,"aria-controls":d?h:void 0,"aria-haspopup":`true`,"aria-expanded":d?`true`:void 0,onClick:f,type:`button`,children:(0,G.jsx)(Bi,{})})}),(0,G.jsx)(Se,{id:h,anchorEl:i,open:d,onClose:p,transformOrigin:{horizontal:`right`,vertical:`top`},anchorOrigin:{horizontal:`right`,vertical:`bottom`},disableScrollLock:!0,PaperProps:{sx:e=>({borderRadius:`${e.shape.borderRadius}px`,padding:e.spacing(1,1.5)})},children:(0,G.jsxs)(_e,{"aria-labelledby":m,children:[(0,G.jsxs)(Ea,{sx:xi,onClick:()=>{try{(0,ko.default)(l),s(!0),setTimeout(()=>{p(),s(!1)},1e3)}catch{c({type:`error`,text:`Could not copy feature name`})}},children:[(0,G.jsx)(oi,{children:o?(0,G.jsx)(Zr,{}):(0,G.jsx)(rr,{})}),(0,G.jsx)(Pt,{children:(0,G.jsx)(H,{variant:`body2`,children:o?`Copied!`:`Copy Name`})})]}),(0,G.jsx)(ea,{projectId:e,permission:Gn,children:({hasAccess:t})=>(0,G.jsxs)(Ea,{sx:xi,onClick:p,disabled:!t,component:z,to:`/projects/${e}/features/${l}/copy`,children:[(0,G.jsx)(oi,{children:(0,G.jsx)(Eo,{})}),(0,G.jsx)(Pt,{children:(0,G.jsx)(H,{variant:`body2`,children:`Clone`})})]})}),(0,G.jsx)(ea,{projectId:e,permission:T,children:({hasAccess:e})=>(0,G.jsxs)(Ea,{sx:xi,onClick:()=>{n(l),p()},disabled:!e,children:[(0,G.jsx)(oi,{children:(0,G.jsx)(Do,{})}),(0,G.jsx)(Pt,{children:(0,G.jsx)(H,{variant:`body2`,children:`Archive`})})]})}),(0,G.jsx)(ea,{projectId:e,permission:fa,children:({hasAccess:e})=>(0,G.jsxs)(Ea,{sx:xi,onClick:()=>{p(),r({featureId:l,stale:u===!0})},disabled:!e,children:[(0,G.jsx)(oi,{children:(0,G.jsx)(Oo,{})}),(0,G.jsx)(Pt,{children:(0,G.jsxs)(H,{variant:`body2`,children:[u?`Un-mark`:`Mark`,` as stale`]})})]})})]})})]})},Mo=U(B)(({theme:e})=>({display:`flex`,justifyContent:`center`,marginRight:e.spacing(-2)})),No=W.memo(({onChange:e,checked:t,title:n})=>(0,G.jsx)(Mo,{"data-testid":xn,children:(0,G.jsx)(zi,{onChange:e,title:n,checked:t,"data-loading":!0})})),Po=U(`div`)(({theme:e})=>({position:`sticky`,bottom:50,zIndex:e.zIndex.fab,pointerEvents:`none`})),Fo=U(B)(({theme:e})=>({display:`flex`,justifyContent:`center`,width:`100%`,flexWrap:`wrap`,paddingBottom:e.spacing(2)})),Io=U(ki)(({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`})),Lo=U(`span`)(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),Ro=U(H)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:`auto`})),zo=({count:e,children:t})=>e===0?null:(0,G.jsx)(Po,{"data-testid":ze,children:(0,G.jsx)(Fo,{children:(0,G.jsxs)(Io,{elevation:4,children:[(0,G.jsxs)(Ro,{children:[(0,G.jsx)(Lo,{"data-testid":Pn,children:e}),` selected`]}),t]})})}),Bo=7,Vo=e=>{let t=Xn(new Date,-Bo);return!!(e?.lastSeenAt&&mt(new Date(e.lastSeenAt),t))},Ho=({projectId:e,featureIds:t,features:n,onConfirm:r})=>{let[i,a]=(0,W.useState)(!1),{trackEvent:o}=I(),s=(0,W.useMemo)(()=>t.filter(e=>Vo(n.find(t=>t.name===e))),[JSON.stringify(n),t]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ea,{projectId:e,permission:T,children:({hasAccess:e})=>(0,G.jsx)(`span`,{children:(0,G.jsx)(V,{disabled:!e||i,variant:`outlined`,size:`small`,onClick:()=>a(!0),children:`Archive`})})}),(0,G.jsx)(Ja,{projectId:e,featureIds:t,featuresWithUsage:s,onConfirm:async()=>{a(!1),r?.(),o(`batch_operations`,{props:{eventType:`features archived`}})},isOpen:i,onClose:()=>a(!1)})]})},Uo=`selection-actions-menu`,Wo=({projectId:e,data:t,onChange:n})=>{let[r,i]=(0,W.useState)(null),{staleFeatures:a}=Ra(),{setToastData:o,setToastApiError:s}=Lt(),{trackEvent:c}=I(),l=!!r,u=t.map(({name:e})=>e),d=e=>{i(e.currentTarget)},f=()=>{i(null)},p=t.some(({stale:e})=>e===!0),m=t.some(({stale:e})=>e===!1),h=async()=>{try{f(),await a(e,u),n?.(),o({text:`Feature flags marked as stale`,type:`success`}),c(`batch_operations`,{props:{eventType:`features staled`}})}catch(e){s(R(e))}},g=async()=>{try{f(),await a(e,u,!1),n?.(),o({text:`Feature flags unmarked as stale`,type:`success`}),c(`batch_operations`,{props:{eventType:`features unstaled`}})}catch(e){s(R(e))}};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ua,{title:`More bulk actions`,arrow:!0,describeChild:!0,children:(0,G.jsx)(ur,{id:Uo,"aria-controls":l?Uo:void 0,"aria-haspopup":`true`,"aria-expanded":l?`true`:void 0,onClick:d,type:`button`,"data-testid":Bt,children:(0,G.jsx)(Bi,{})})}),(0,G.jsx)(Se,{id:`${Uo}-menu`,anchorEl:r,open:l,onClose:f,transformOrigin:{horizontal:`right`,vertical:`top`},anchorOrigin:{horizontal:`right`,vertical:`bottom`},disableScrollLock:!0,PaperProps:{sx:e=>({borderRadius:`${e.shape.borderRadius}px`,padding:e.spacing(1,1.5)})},children:(0,G.jsx)(_e,{"aria-labelledby":`${Uo}-menu`,children:(0,G.jsx)(ea,{projectId:e,permission:fa,children:({hasAccess:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(w,{condition:m,show:()=>(0,G.jsxs)(Ea,{onClick:h,disabled:!e,sx:{borderRadius:e=>`${e.shape.borderRadius}px`},children:[(0,G.jsx)(oi,{children:(0,G.jsx)(Oo,{})}),(0,G.jsx)(Pt,{children:(0,G.jsx)(H,{variant:`body2`,children:`Mark as stale`})})]})}),(0,G.jsx)(w,{condition:p,show:()=>(0,G.jsxs)(Ea,{onClick:g,disabled:!e,sx:{borderRadius:e=>`${e.shape.borderRadius}px`},children:[(0,G.jsx)(oi,{children:(0,G.jsx)(Oo,{})}),(0,G.jsx)(Pt,{children:(0,G.jsx)(H,{variant:`body2`,children:`Un-mark as stale`})})]})})]})})})})]})},Go=U(`section`)(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),Ko=`manage-tags-form`,qo=(e,t)=>[...e,...e.some(e=>e.value===t.value&&e.type===t.type)?[]:[t]],Jo=(e,t)=>e.filter(e=>!(e.value===t.value&&e.type===t.type)),Yo=(e,t)=>{switch(t.type){case`add`:return{...e,addedTags:qo(e.addedTags,t.payload),removedTags:Jo(e.removedTags,t.payload)};case`remove`:return{...e,addedTags:Jo(e.addedTags,t.payload),removedTags:qo(e.removedTags,t.payload)};case`clear`:return{addedTags:[],removedTags:t.payload};case`reset`:return{addedTags:[],removedTags:[]};default:return e}},Xo={name:``,description:``,icon:``},Zo=({open:e,initialValues:t,initialIndeterminateValues:n,onCancel:r,onSubmit:i})=>{let{tagTypes:a,loading:o}=Oa(),[s,c]=(0,W.useState)(Xo),[l,u]=(0,W.useState)([]),[d,f]=(0,W.useState)([]),{tags:p,refetch:m}=uo(s.name),{createTag:h}=po(),g=p.map(({value:e})=>({title:e})),[_,v]=(0,W.useReducer)(Yo,{addedTags:[],removedTags:[]}),y=()=>{i(_),v({type:`reset`})},b=(e=a.length>0?a[0]:Xo)=>{c(e);let r=n.filter(({type:t})=>t===e.name);u(t.filter(({type:t})=>t===e.name).filter(({type:e,value:t})=>!r.some(n=>n.value===t&&n.type===e)).map(({value:e})=>({title:e}))),f(r.map(({value:e})=>({title:e}))),v({type:`clear`,payload:[]})};(0,W.useEffect)(()=>{a.length>0&&b()},[o]);let x=(e,t)=>{t!=null&&typeof t!=`string`&&(e.preventDefault(),b(t))},S=(e,t)=>h({value:e,type:t}).then(async()=>{m(),u(t=>[...t,{title:e}]),v({type:`add`,payload:{value:e,type:t}})});return(0,G.jsxs)(yn,{open:e,secondaryButtonText:`Cancel`,primaryButtonText:`Save tags`,title:`Update feature flag tags`,onClick:y,disabledPrimaryButton:_.addedTags.length===0&&_.removedTags.length===0,onClose:()=>{b(),r()},formId:Ko,children:[(0,G.jsx)(H,{paragraph:!0,sx:{marginBottom:e=>e.spacing(2.5)},children:`Tags allow you to group features together`}),(0,G.jsx)(`form`,{id:Ko,onSubmit:y,children:(0,G.jsxs)(Go,{children:[(0,G.jsx)(Xa,{options:a,disabled:o||a.length===0,value:s,onChange:x},o?`loading`:a.length),(0,G.jsx)(w,{condition:!o&&a.length===0,show:(0,G.jsxs)(H,{variant:`body1`,children:[`No`,` `,(0,G.jsx)(Dt,{component:z,to:`/tag-types`,children:`tag types`}),` `,`available.`]}),elseShow:(0,G.jsx)(fo,{disabled:o,options:g,existingTags:t,indeterminateOptions:d,tagType:s,selectedOptions:l,onChange:(e,n,r,i)=>{r===`selectOption`?n.forEach(e=>{typeof e!=`string`&&typeof e.inputValue==`string`&&e.inputValue&&e.title.startsWith(`Create new value`)&&S(e.inputValue,s.name),u(n),f(t=>t.filter(({title:t})=>t!==e.title)),i?.option&&v({type:`add`,payload:{value:i.option.title,type:s.name}})}):r===`clear`?(u([]),v({type:`clear`,payload:t})):r===`removeOption`&&(u(n),i?.option&&v({type:`remove`,payload:{value:i.option.title,type:s.name}}))}})})]})})]})},Qo=({projectId:e,data:t,onChange:n})=>{let{bulkUpdateTags:r}=po(),{setToastData:i,setToastApiError:a}=Lt(),{trackEvent:o}=I(),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useMemo)(()=>{let e=t.flatMap(({tags:e})=>e||[]).reduce((e,t)=>[...e,...e.some(e=>e.type===t.type&&e.value===t.value)?[]:[t]],[]);return[e,e.filter(e=>!t.every(({tags:t})=>t?.some(t=>t.type===e.type&&t.value===e.value)))]},[t]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ea,{projectId:e,permission:fa,children:({hasAccess:e})=>(0,G.jsx)(`span`,{children:(0,G.jsx)(V,{disabled:!e||s,variant:`outlined`,size:`small`,onClick:()=>c(!0),children:`Tags`})})}),(0,G.jsx)(Zo,{open:s,onCancel:()=>c(!1),onSubmit:async({addedTags:s,removedTags:l})=>{let u={features:t.map(({name:e})=>e),tags:{addedTags:s,removedTags:l}};try{let t=[s.length>0&&`added ${s.length} tag${s.length>1?`s`:``}`,l.length>0&&`removed ${l.length} tag${l.length>1?`s`:``}`].filter(Boolean).join(` and `);await r(u,e),i({text:t,type:`success`,autoHideDuration:12e3}),o(`batch_operations`,{props:{eventType:`tags updated`}})}catch(e){a(R(e))}n?.(),c(!1)},initialValues:l,initialIndeterminateValues:u},t.length)]})},$o=U(le)(({theme:e})=>({minWidth:`450px`,marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),es=U(Kr)(({theme:e})=>({marginBottom:e.spacing(1.5)})),ts=({showExportDialog:e,data:t,onClose:n,onConfirm:r,environments:i,projectId:a})=>{let[o,s]=(0,W.useState)(i[0]),{bulkToggleFeaturesEnvironmentOff:c}=Ue(),{addChange:l}=Fe(),{setToastApiError:u,setToastData:d}=Lt(),{isChangeRequestConfigured:f}=Pe(a),{refetch:p}=Cn(a),m=t.filter(e=>e.environments?.find(e=>o===e.name)?.enabled===!1).length;return(0,G.jsx)(yn,{open:e,title:`Disable feature flags`,onClose:n,onClick:async()=>{try{f(o)?(await l(a,o,t.map(e=>({action:`updateEnabled`,feature:e.name,payload:{enabled:!1}}))),p(),d({type:`success`,text:`Changes added to draft`})):(await c(a,t.map(e=>e.name),o),d({type:`success`,text:`Feature flags disabled`})),n(),r?.()}catch(e){u(R(e))}},primaryButtonText:f(o)?`Add to change request`:`Disable flags`,secondaryButtonText:`Cancel`,children:(0,G.jsxs)(B,{children:[`You have selected `,(0,G.jsx)(`b`,{children:t.length}),` feature flags to disable.`,(0,G.jsx)(`br`,{}),(0,G.jsx)(`br`,{}),(0,G.jsx)(H,{children:`Select which environment to disable the features for:`}),(0,G.jsx)($o,{options:i.map(e=>({key:e,label:e})),value:o,onChange:e=>s(e)}),(0,G.jsx)(w,{condition:f(o),show:(0,G.jsx)(es,{severity:`warning`,children:`Change requests are enabled for this environment.`})}),(0,G.jsx)(w,{condition:m>0,show:(0,G.jsxs)(es,{severity:`info`,children:[m,` feature`,` `,m>1?`flags are `:`flag is `,`already disabled.`]})})]})})},ns=U(le)(({theme:e})=>({minWidth:`450px`,marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),rs=U(Kr)(({theme:e})=>({marginBottom:e.spacing(1.5)})),is=({showExportDialog:e,data:t,onClose:n,onConfirm:r,environments:i,projectId:a})=>{let[o,s]=(0,W.useState)(i[0]),{bulkToggleFeaturesEnvironmentOn:c}=Ue(),{addChange:l}=Fe(),{setToastApiError:u,setToastData:d}=Lt(),{isChangeRequestConfigured:f}=Pe(a),{refetch:p}=Cn(a),m=t.filter(e=>e.environments?.find(e=>o===e.name)?.enabled===!0).length;return(0,G.jsx)(yn,{open:e,title:`Enable feature flags`,onClose:n,onClick:async()=>{try{f(o)?(await l(a,o,t.map(e=>({action:`updateEnabled`,feature:e.name,payload:{enabled:!0}}))),p(),d({type:`success`,text:`Changes added to draft`})):(await c(a,t.map(e=>e.name),o),d({type:`success`,text:`Feature flags enabled`})),n(),r?.()}catch(e){u(R(e))}},primaryButtonText:f(o)?`Add to change request`:`Enable flags`,secondaryButtonText:`Cancel`,children:(0,G.jsxs)(B,{children:[`You have selected `,(0,G.jsx)(`b`,{children:t.length}),` feature flags to enable.`,(0,G.jsx)(`br`,{}),(0,G.jsx)(`br`,{}),(0,G.jsx)(H,{children:`Select which environment to enable the features for:`}),(0,G.jsx)(ns,{options:i.map(e=>({key:e,label:e})),value:o,onChange:e=>s(e)}),(0,G.jsx)(w,{condition:f(o),show:(0,G.jsx)(rs,{severity:`warning`,children:`Change requests are enabled for this environment.`})}),(0,G.jsx)(w,{condition:m>0,show:(0,G.jsxs)(rs,{severity:`info`,children:[m,` feature`,` `,m>1?`flags are `:`flag is `,`already enabled.`]})})]})})},as=({selectedIds:e,data:t,projectId:n,onResetSelection:r,onChange:i})=>{let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),{trackEvent:d}=I(),f=(0,W.useMemo)(()=>t.filter(t=>e.includes(t.name)),[t,e]),p=(0,W.useMemo)(()=>{let e=f.flatMap(e=>e.environments).map(e=>e?.name).filter(e=>e!==void 0);return Array.from(new Set(e))},[f]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(V,{variant:`outlined`,size:`small`,onClick:()=>c(!0),children:`Enable`}),(0,G.jsx)(V,{variant:`outlined`,size:`small`,onClick:()=>u(!0),children:`Disable`}),(0,G.jsx)(Ho,{projectId:n,featureIds:e,features:t,onConfirm:()=>{i?.(),r()}}),(0,G.jsx)(V,{variant:`outlined`,size:`small`,onClick:()=>o(!0),children:`Export`}),(0,G.jsx)(Qo,{projectId:n,data:f,onChange:i}),(0,G.jsx)(Wo,{projectId:n,data:f,onChange:i}),(0,G.jsx)(_r,{showExportDialog:a,data:f,onClose:()=>o(!1),environments:p,onConfirm:()=>{i?.(),d(`batch_operations`,{props:{eventType:`features exported`}})}}),(0,G.jsx)(is,{showExportDialog:s,data:f,onClose:()=>c(!1),environments:p,projectId:n,onConfirm:()=>{i?.(),d(`batch_operations`,{props:{eventType:`features enabled`}})}}),(0,G.jsx)(ts,{showExportDialog:l,data:f,onClose:()=>u(!1),environments:p,projectId:n,onConfirm:()=>{i?.(),d(`batch_operations`,{props:{eventType:`features disabled`}})}})]})},os=U(Sn)(({theme:e})=>({color:e.palette.warning.main,fontSize:e.fontSizes.bodySize})),ss=()=>(0,G.jsx)(ae,{arrow:!0,title:(0,G.jsxs)(G.Fragment,{children:[`This environment has no variants enabled. If you check this feature's variants in this environment, you will get the`,` `,(0,G.jsx)(`a`,{href:`https://docs.getunleash.io/concepts/feature-flag-variants#the-disabled-variant`,target:`_blank`,rel:`noreferrer`,children:`disabled variant`}),`.`]}),children:(0,G.jsx)(os,{})}),cs=U(`div`,{shouldForwardProp:e=>e!==`hasWarning`})(({theme:e,hasWarning:t})=>({flexGrow:0,...qi,justifyContent:`center`,...t&&{"::before":{content:`""`,display:`block`,width:e.spacing(2)}}})),ls=U(`div`)(({theme:e})=>({flexGrow:0,...qi,justifyContent:`center`})),us=W.memo(({value:e,featureId:t,projectId:n,environment:r,isChangeRequestEnabled:i,someEnabledEnvironmentHasVariants:a,refetch:o,onFeatureToggleSwitch:s})=>{let c=(0,W.useMemo)(()=>a&&r?.variantCount===0&&r?.enabled,[a,r]);return(0,G.jsxs)(cs,{hasWarning:c,children:[(0,G.jsx)(oo,{projectId:n,value:e,featureId:t,environmentName:r?.name||``,onToggle:(e,a)=>{s(e,{projectId:n,featureId:t,environmentName:r?.name||``,environmentType:r?.type,hasStrategies:r?.hasStrategies,hasReleasePlans:!!r?.releasePlans?.length,hasEnabledStrategies:r?.hasEnabledStrategies,isChangeRequestEnabled:i,onRollback:a,onSuccess:o})}}),(0,G.jsx)(w,{condition:c||!1,show:(0,G.jsx)(ss,{})})]})}),ds=()=>(0,G.jsx)(cs,{children:(0,G.jsx)(`div`,{"data-loading":!0,children:`toggle`})}),fs=()=>(0,G.jsx)(ls,{"aria-hidden":`true`,children:`-`}),ps=e=>{let t=`api/admin/projects/${e}/flag-creators`,{data:n,refetch:r,error:i}=pn(kt(t),()=>va(kt(t),`Flag creators`));return{flagCreators:n||[],refetch:r,error:i}},ms=U(fr)({padding:0}),hs=({state:e,onChange:t,project:n})=>{let{tags:r}=Zi(),{flagCreators:i}=ps(n),[a,o]=(0,W.useState)([]),{trackEvent:s}=I();return(0,W.useEffect)(()=>{let e=(r||[]).map(e=>{let t=Jr(e);return{label:t,value:t}}),t=i.map(e=>({label:e.name,value:String(e.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:e,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:t,filterKey:`createdBy`,singularOperators:[`IS`,`IS_NOT`],pluralOperators:[`IS_ANY_OF`,`IS_NONE_OF`]},{label:`Favorite`,icon:`star`,options:[{label:`True`,value:`true`},{label:`False`,value:`false`}],filterKey:`favorite`,singularOperators:[`IS`],pluralOperators:[`IS_ANY_OF`]}])},[JSON.stringify(r),JSON.stringify(i)]),(0,G.jsx)(ms,{availableFilters:a,state:e,onChange:n=>{n.favorite!==e.favorite&&s(`favorite`,{props:{action:n.favorite?`filter-enabled`:`filter-disabled`}}),t(n)}})},gs=e=>`api/admin/projects/${e}/status`,_s={activityCountByDate:[],resources:{members:0,apiTokens:0,segments:0},health:{current:0},technicalDebt:{current:0},lifecycleSummary:{initial:{currentFlags:0,averageDays:null},preLive:{currentFlags:0,averageDays:null},live:{currentFlags:0,averageDays:null},completed:{currentFlags:0,averageDays:null},archived:{currentFlags:0,last30Days:0}},staleFlags:{total:0}},vs=e=>{let t=kt(gs(e)),{data:n,refetch:r,loading:i,error:a}=pn(t,()=>va(t,`Project Status`));return{data:n||_s,refetch:r,loading:i,error:a}},ys=({projectId:e,state:t,onChange:n,children:r})=>{let{data:i}=vs(e),a=Object.entries(i?.lifecycleSummary||{}).reduce((e,[t,n])=>(e[t===`preLive`?`pre-live`:t]=n.currentFlags||0,e),{}),o=t.archived?.values?.includes(`true`);return(0,W.useEffect)(()=>{o&&t.lifecycle&&n({...t,lifecycle:null})},[o,t,n]),o?null:(0,G.jsx)(B,{sx:{marginRight:`auto`},children:(0,G.jsx)(qn,{state:t,onChange:n,countData:a,children:r})})},bs=[`select`,`actions`,`name`,`favorite`],xs=(e,t)=>e.reduce((e,n)=>({...e,[n]:t.includes(n)}),{}),Ss=e=>{let t=P(),n=Ye(t.breakpoints.down(`sm`)),r=Ye(t.breakpoints.down(`md`)),i=Ye(t.breakpoints.down(`lg`)),a=(0,W.useCallback)((t=0)=>e.filter(e=>e.startsWith(`environment:`)),[e]);return n?xs(e,[...bs,`createdAt`]):r?xs(e,[...bs,`createdAt`,...a(1)]):i?xs(e,[...bs,`createdAt`,`type`,...a(1)]):xs(e,[...bs,`lastSeenAt`,`lifecycle`,`createdAt`,`createdBy`,`type`,`tags`,...a(3)])},Cs=({query:e})=>(e||``)?.length>0?(0,G.jsx)(B,{sx:e=>({padding:e.spacing(3)}),children:(0,G.jsxs)(ta,{children:[`No feature flags found matching “`,e,`”`]})}):(0,G.jsx)(B,{sx:e=>({padding:e.spacing(3)}),children:(0,G.jsx)(ta,{children:`No feature flags available.`})}),ws=(e,t,n)=>{let[r,i]=(0,W.useState)(),[a,o]=(0,W.useState)({}),[s,c]=(0,W.useState)({featureId:`default`,open:!1}),[l,u]=(0,W.useState)({featureId:`default`,open:!1}),[d,f]=(0,W.useState)({featureId:`default`,open:!1});return{rowActionsDialogs:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(co,{isStale:!!a.stale,isOpen:!!a.featureId,onClose:()=>{o({}),e()},featureId:a.featureId||``,projectId:t}),(0,G.jsx)(Ja,{isOpen:!!r,onConfirm:()=>{e(),n?.()},onClose:()=>{i(void 0)},featureIds:[r||``],projectId:t}),(0,G.jsx)(Ya,{isOpen:s.open,setIsOpen:e=>{c({...s,open:e})},projectId:t,featureId:s.featureId,onComplete:e}),(0,G.jsx)(xa,{deletedFeatures:[d.featureId],projectId:t,open:d.open,setOpen:e=>{f(t=>({...t,open:e}))},refetch:e}),(0,G.jsx)(oe,{revivedFeatures:[l.featureId],projectId:t,open:l.open,setOpen:e=>{u(t=>({...t,open:e}))},refetch:()=>{u(e=>({...e,open:!1})),e()}})]}),setFeatureArchiveState:i,setFeatureStaleDialogState:o,setShowMarkCompletedDialogue:c,setShowFeatureReviveDialogue:u,setShowFeatureDeleteDialogue:f}},Ts=(e,t)=>{let[n,r]=(0,W.useState)([]);return(0,W.useEffect)(()=>{r(n=>{let r=[...e];return n.forEach(e=>{r.find(t=>t.name===e.name)||r.push(e)}),r.filter(e=>t[e.name])})},[e,t]),n},Es=n(zt(),1),Ds=(e,t=`project-overview-v2`,n=15*1e3)=>{let r={offset:Yn(er,0),limit:Yn(er,25),query:Ze,favoritesFirst:Yn(Ar,!0),sortBy:Yn(Ze,`createdAt`),sortOrder:Yn(Ze,`desc`),columns:it,tag:aa,state:aa,createdAt:aa,lastSeenAt:aa,type:aa,createdBy:aa,archived:aa,lifecycle:aa,favorite:aa},[i,a]=b(`${t}-${e}`,r),{features:o,total:s,refetch:c,loading:l,initialLoad:u}=yi((0,Es.default)({...Me(r,i),project:`IS:${e}`},e=>e?`${e}`:void 0),{refreshInterval:n});return{features:o,total:s,refetch:c,loading:l,initialLoad:u,tableState:i,setTableState:a}},Os=(e,t)=>{let n=(n,r)=>{let i=e[n.key];i&&i.values.length>0&&!i.values.includes(r)?t({[n.key]:{operator:i.operator,values:[...i.values,r]}}):i||t({[n.key]:{operator:n.operator,values:[r]}})};return{onFlagTypeClick:e=>n({key:`type`,operator:`IS`},e),onTagClick:e=>n({key:`tag`,operator:`INCLUDE`},e),onAvatarClick:e=>n({key:`createdBy`,operator:`IS`},e.toString())}},ks=or((0,G.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.01M11 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 6zm10 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.37z`}),`AltRoute`);function As({onClick:e,currentValue:t,label:n,icon:r,labelWidth:i,tooltip:a}){return(0,G.jsx)(Nt,{titleComponent:(0,G.jsxs)(wr,{children:[(0,G.jsx)(`h3`,{children:a.header}),(0,G.jsx)(`p`,{children:a.description}),a.additionalContent]}),variant:`custom`,children:(0,G.jsx)(V,{role:`switch`,"aria-checked":t,variant:t?`contained`:`outlined`,color:`primary`,startIcon:r,onClick:e,disableElevation:!0,children:(0,G.jsx)(ua,{labelWidth:i,children:n})})})}var js=({global:e,project:t})=>{let{limitReached:n,limitMessage:r}=Ms(e.limit,e.count),i=Ns(t.limit,t.count);return{limitMessage:n?r:i?`You have reached the project limit of ${t.limit} feature flags.`:void 0,globalFlagLimitReached:n,projectFlagLimitReached:i}},Ms=(e,t)=>{let n=t>=e;return{limitReached:n,limitMessage:n?`You have reached the instance-wide limit of ${e} feature flags.`:void 0}},Ns=(e,t)=>e!=null&&e<=t,Ps=()=>{let{setShowFeedback:e}=(0,W.useContext)(di);return(0,W.useCallback)(()=>{let{value:t,setValue:n}=ca(`flagsCreated`,`0`),r=Number.parseInt(t,10)+1;n(`${r}`),r>1&&e(!0)},[e])},Fs=U(Re)(({theme:e})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:e.spacing(170),width:`100%`,backgroundColor:`transparent`},padding:0,"& .MuiPaper-root > section":{overflowX:`hidden`}})),Is={project:{icon:(0,G.jsx)(wt,{}),text:`Projects allow you to group feature flags together in the Unleash admin UI and in SDK payloads.`},tags:{icon:(0,G.jsx)(tn,{}),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:(0,G.jsx)(xe,{}),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:(0,G.jsx)(ks,{}),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.`}},Ls=({open:e,onClose:t,onSuccess:n,skipNavigationOnComplete:r})=>{if(e)return(0,G.jsx)(Rs,{open:e,onClose:t,skipNavigationOnComplete:r,onSuccess:n})},Rs=({open:e,onClose:t,skipNavigationOnComplete:n,onSuccess:r})=>{let{setToastData:i,setToastApiError:a}=Lt(),{uiConfig:o,isOss:s}=ti(),c=gi(),l=Ps(),[u,d]=si(`flag-creation-dialog`,{},3600*1e3),{type:f,setType:p,tags:m,setTags:h,name:g,setName:_,project:v,setProject:y,description:b,setDescription:x,validateToggleName:S,impressionData:C,setImpressionData:T,getTogglePayload:E,clearErrors:D,errors:O}=Wt(u),{createFeatureToggle:k,loading:A}=Ue(),j={icon:(0,G.jsx)(xe,{}),text:`Feature flags are at the core of Unleash. Use them to control your feature rollouts.`,link:{url:`https://docs.getunleash.io/concepts/feature-flags`,label:`Feature flags documentation`}},[ee,te]=(0,W.useState)(j),M=()=>te(j),ne=E(),re=()=>`curl --location --request POST '${o.unleashUrl}/api/admin/projects/${v}/features' \\
--header 'Authorization: INSERT_API_KEY' \\
--header 'Content-Type: application/json' \\
--data-raw '${JSON.stringify(ne,void 0,2)}'`,N=async e=>{if(e.preventDefault(),D(),await S()){let e=E();try{await k(v,e),n||c(`/projects/${v}/features/${g}`),i({text:`Flag created successfully`,type:`success`}),t(),r?.(),d({}),l()}catch(e){a(R(e))}}},{total:P,loading:ie}=Hn(1),{project:ae}=se(v),{tags:oe}=Zi(),{globalFlagLimitReached:ce,projectFlagLimitReached:le,limitMessage:ue}=js({global:{limit:o.resourceLimits.featureFlags,count:P??0},project:{limit:ae.featureLimit||void 0,count:cn(ae)??0}}),{projects:de}=xr(),{featureTypes:fe}=Ni(),pe=Ae(f),me=fe.reduce((e,t)=>e>=t.name.length?e:t.name.length,0),he=(0,W.useMemo)(()=>de.find(e=>e.id===v)?.name,[v,de]);return(0,G.jsx)(Fs,{open:e,onClose:()=>{d({name:g,tags:m,impressionData:C,type:f,description:b}),t()},children:(0,G.jsx)(Fi,{compact:!0,disablePadding:!0,description:ee.text,documentationIcon:ee.icon,documentationLink:ee.link?.url,documentationLinkLabel:ee.link?.label,formatApiCode:re,useFixedSidebar:!0,children:(0,G.jsx)(Nr,{createButtonProps:{projectId:v,disabled:A||ie||ce||le,permission:Gn,tooltipProps:{title:ue,arrow:!0}},description:b,namingPattern:ae.featureNaming,errors:O,handleSubmit:N,Icon:(0,G.jsx)(xe,{}),validateName:S,Limit:(0,G.jsx)(Vr,{name:`feature flags`,limit:o.resourceLimits.featureFlags,currentValue:P??0}),name:g,onClose:t,resource:`feature flag`,setDescription:x,setName:_,configButtons:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(w,{condition:!s(),show:(0,G.jsx)(wi,{tooltip:{header:`Select a project for the flag`},description:Is.project.text,options:de.map(e=>({label:e.name,value:e.id})),onChange:e=>{y(e)},button:{label:he??v,icon:Is.project.icon,labelWidth:`20ch`},search:{label:`Filter projects`,placeholder:`Select project`},onOpen:()=>te(Is.project),onClose:M})}),(0,G.jsx)(Yi,{tooltip:{header:`Select tags`},description:Is.tags.text,selectedOptions:new Set(Array.from(m).map(e=>`${e.type}:${e.value}`)),options:oe.map(e=>({label:Jr(e),value:`${e.type}:${e.value}`})),onChange:e=>{let t=Array.from(e).map(e=>{let[t,n]=e.split(`:`);return{type:t,value:n}});h(new Set(t))},button:{label:m.size>0?`${m.size} selected`:`Tags`,labelWidth:`11ch`,icon:(0,G.jsx)(tn,{})},search:{label:`Filter tags`,placeholder:`Select tags`},onOpen:()=>te(Is.tags),onClose:M}),(0,G.jsx)(wi,{tooltip:{header:`Select a flag type`},description:Is.type.text,options:fe.map(e=>({label:e.name,value:e.id})),onChange:e=>{p(e)},button:{label:fe.find(e=>e.id===f)?.name||`Select flag type`,icon:(0,G.jsx)(pe,{}),labelWidth:`${me}ch`},search:{label:`Filter flag types`,placeholder:`Select flag type`},onOpen:()=>te({text:Is.type.text,icon:(0,G.jsx)(pe,{})}),onClose:M}),(0,G.jsx)(As,{tooltip:{header:`Enable or disable impression data`,description:Is.impressionData.text},currentValue:C,onClick:()=>T(!C),label:`Impression data ${C?`on`:`off`}`,icon:(0,G.jsx)(ks,{}),labelWidth:`19ch`})]})})})})},zs=U(Aa)(()=>({whiteSpace:`nowrap`})),Bs=({variant:e,text:t=`New feature flag`,skipNavigationOnComplete:n,isLoading:r,onSuccess:i})=>{let{loading:a}=ti(),[o]=nr(),s=L(`projectId`),[c,l]=(0,W.useState)(!!o.get(`create`));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zs,{onClick:()=>l(!0),maxWidth:`960px`,Icon:ft,projectId:s,disabled:a||r,variant:e,permission:Gn,"data-testid":a||r?``:x,children:t}),(0,G.jsx)(Ls,{open:c,onClose:()=>l(!1),skipNavigationOnComplete:n,onSuccess:i})]})},Vs=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,gap:e.spacing(2),alignItems:`center`,fontSize:e.spacing(1.75),fontWeight:`bold`})),Hs=U(V)({fontWeight:`bold`,textDecoration:`none`}),Us=U(B)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(1)})),Ws=`https://github.com/Unleash/unleash-sdk-examples/tree/main`,Gs=()=>{let{trackEvent:e}=I(),t=Za.map(e=>({key:e.name,label:e.name})),[n,r]=si(`onboarding-sdk-example`,t[0].key);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vs,{children:`View SDK Example`}),(0,G.jsx)(H,{children:`Choose your preferred SDK to view an example.`}),(0,G.jsxs)(Us,{children:[(0,G.jsx)(zr,{id:`sdk-select`,name:`sdk`,options:t,value:n,onChange:e=>{r(e.target.value)},style:{width:`60%`}}),(0,G.jsx)(B,{children:(0,G.jsx)(Hs,{to:`${Ws}/${n}`,target:`_blank`,component:z,variant:`text`,color:`primary`,onClick:()=>{e(`onboarding`,{props:{eventType:`sdk-example-opened`,sdk:n}})},children:`Go to example`})})]})]})},Ks=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,backgroundColor:e.palette.background.paper,flexBasis:`70%`,borderRadius:e.shape.borderRadiusLarge})),qs=U(`div`)(({theme:e})=>({padding:e.spacing(2,2.5,2,5),borderBottom:`1px solid`,borderColor:e.palette.divider,minHeight:`80px`})),Js=U(`div`)(({theme:e})=>({display:`flex`,flexGrow:1,padding:e.spacing(0,1),[e.breakpoints.down(`md`)]:{flexDirection:`column`,padding:e.spacing(0)}})),Ys=U(`div`)(({theme:e})=>({flexBasis:`50%`,display:`flex`,gap:e.spacing(3),flexDirection:`column`,borderRight:`1px solid ${e.palette.divider}`,padding:e.spacing(4),[e.breakpoints.down(`md`)]:{borderRight:0,borderBottom:`1px solid ${e.palette.divider}`},"&:last-child":{borderWidth:0}})),Xs=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,gap:e.spacing(2),alignItems:`center`,fontSize:e.spacing(1.75),fontWeight:`bold`})),Zs=U(`span`)(({theme:e})=>({width:`28px`,height:`28px`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:e.palette.neutral.border,borderRadius:`50%`})),Qs=U(Zs)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper})),$s=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(3),height:`100%`})),ec=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,fontSize:e.spacing(1.75),fontWeight:`bold`,backgroundColor:e.palette.success.light,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(2,2,2,2)})),tc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`})),nc=({projectId:e,setConnectSdkOpen:t,setOnboardingFlow:n,refetchFeatures:r})=>{let{project:i}=se(e),a=i.onboardingStatus?.status===`first-flag-created`;return(0,G.jsxs)(Ks,{children:[(0,G.jsxs)(qs,{children:[(0,G.jsxs)(tc,{children:[(0,G.jsx)(H,{fontWeight:`bold`,children:`Welcome to your project`}),(0,G.jsx)(Ua,{title:`Close`,arrow:!0,children:(0,G.jsx)(ur,{onClick:()=>{n(`closed`)},size:`small`,children:(0,G.jsx)(Ut,{})})})]}),(0,G.jsx)(H,{variant:`body2`,children:`Complete the steps below to start working with this project`})]}),(0,G.jsxs)(Js,{children:[(0,G.jsx)(Ys,{children:i.onboardingStatus?.status===`first-flag-created`?(0,G.jsx)(ic,{}):(0,G.jsx)(rc,{projectId:e,refetchFeatures:r})}),(0,G.jsxs)(Ys,{children:[(0,G.jsxs)(Xs,{children:[(0,G.jsx)(Zs,{children:`2`}),`Connect an SDK`]}),(0,G.jsx)(H,{children:`Your project is not yet connected to any SDK. To start using your feature flag, connect an SDK to the project.`}),(0,G.jsx)(Aa,{onClick:()=>{t(!0)},maxWidth:`200px`,projectId:e,Icon:ft,disabled:!a,permission:[pi,Gt],children:`Connect SDK`})]}),(0,G.jsx)(Ys,{children:(0,G.jsx)(Gs,{})})]})]})},rc=({projectId:e,refetchFeatures:t})=>{let{refetch:n}=se(e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Xs,{children:[(0,G.jsx)(Zs,{children:`1`}),`Create a feature flag`]}),(0,G.jsx)(H,{children:`The project currently holds no feature flags. Create one to get started.`}),(0,G.jsx)(Bs,{text:`Create flag`,skipNavigationOnComplete:!0,onSuccess:()=>{n(),t()}})]})},ic=()=>(0,G.jsxs)($s,{children:[(0,G.jsxs)(Xs,{children:[(0,G.jsx)(Qs,{children:`✓`}),`Create a feature flag`]}),(0,G.jsxs)(ec,{children:[(0,G.jsx)(H,{fontWeight:`bold`,variant:`body2`,children:`Congratulations, your first flag is ready!`}),(0,G.jsx)(H,{variant:`body2`,children:`You can open it to customize further.`})]})]}),ac=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,backgroundColor:e.palette.background.paper,flexBasis:`70%`,borderRadius:e.shape.borderRadiusLarge})),oc=U(`div`)(({theme:e})=>({padding:e.spacing(2,2.5,2,5),borderBottom:`1px solid`,borderColor:e.palette.divider,minHeight:`80px`})),sc=U(`div`)(({theme:e})=>({display:`flex`,flexGrow:1,padding:e.spacing(0,1),[e.breakpoints.down(`md`)]:{flexDirection:`column`,padding:e.spacing(0)}})),cc=U(`div`)(({theme:e})=>({flexBasis:`50%`,display:`flex`,gap:e.spacing(3),flexDirection:`column`,borderRight:`1px solid ${e.palette.divider}`,padding:e.spacing(4),[e.breakpoints.down(`md`)]:{borderRight:0,borderBottom:`1px solid ${e.palette.divider}`},"&:last-child":{borderWidth:0}})),lc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,gap:e.spacing(2),alignItems:`center`,fontSize:e.spacing(1.75),fontWeight:`bold`})),uc=U(`span`)(({theme:e})=>({width:`28px`,height:`28px`,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:e.palette.neutral.border,borderRadius:`50%`})),dc=U(uc)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper})),fc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(3),height:`100%`})),pc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,fontSize:e.spacing(1.75),fontWeight:`bold`,backgroundColor:e.palette.success.light,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(2,2,2,2)})),mc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`})),hc=({projectId:e,setConnectSdkOpen:t,setOnboardingFlow:n,refetchFeatures:r})=>{let{project:i}=se(e),a=i.onboardingStatus?.status===`first-flag-created`;return(0,G.jsxs)(ac,{children:[(0,G.jsxs)(oc,{children:[(0,G.jsxs)(mc,{children:[(0,G.jsx)(H,{fontWeight:`bold`,children:`Welcome to your project`}),(0,G.jsx)(Ua,{title:`Close`,arrow:!0,children:(0,G.jsx)(ur,{onClick:()=>{n(`closed`)},size:`small`,children:(0,G.jsx)(Ut,{})})})]}),(0,G.jsx)(H,{variant:`body2`,children:`Complete the steps below to start working with this project`})]}),(0,G.jsxs)(sc,{children:[(0,G.jsx)(cc,{children:i.onboardingStatus?.status===`first-flag-created`?(0,G.jsx)(_c,{}):(0,G.jsx)(gc,{projectId:e,refetchFeatures:r})}),(0,G.jsxs)(cc,{children:[(0,G.jsxs)(lc,{children:[(0,G.jsx)(uc,{children:`2`}),`Connect an SDK`]}),(0,G.jsx)(H,{children:`Your project is not yet connected to any SDK. To start using your feature flag, connect an SDK to the project.`}),(0,G.jsx)(Aa,{onClick:()=>{t(!0)},maxWidth:`200px`,projectId:e,Icon:ft,disabled:!a,permission:[pi,Gt],children:`Connect SDK`})]}),(0,G.jsx)(cc,{children:(0,G.jsx)(Gs,{})})]})]})},gc=({projectId:e,refetchFeatures:t})=>{let{refetch:n}=se(e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(lc,{children:[(0,G.jsx)(uc,{children:`1`}),`Create a feature flag`]}),(0,G.jsx)(H,{children:`The project currently holds no feature flags. Create one to get started.`}),(0,G.jsx)(Bs,{text:`Create flag`,skipNavigationOnComplete:!0,onSuccess:()=>{n(),t()}})]})},_c=()=>(0,G.jsxs)(fc,{children:[(0,G.jsxs)(lc,{children:[(0,G.jsx)(dc,{children:`✓`}),`Create a feature flag`]}),(0,G.jsxs)(pc,{children:[(0,G.jsx)(H,{fontWeight:`bold`,variant:`body2`,children:`Congratulations, your first flag is ready!`}),(0,G.jsx)(H,{variant:`body2`,children:`You can open it to customize further.`})]})]}),vc=or([(0,G.jsx)(`path`,{d:`M21 5c-1.11-.35-2.33-.5-3.5-.5-1.95 0-4.05.4-5.5 1.5-1.45-1.1-3.55-1.5-5.5-1.5S2.45 4.9 1 6v14.65c0 .25.25.5.5.5.1 0 .15-.05.25-.05C3.1 20.45 5.05 20 6.5 20c1.95 0 4.05.4 5.5 1.5 1.35-.85 3.8-1.5 5.5-1.5 1.65 0 3.35.3 4.75 1.05.1.05.15.05.25.05.25 0 .5-.25.5-.5V6c-.6-.45-1.25-.75-2-1m0 13.5c-1.1-.35-2.3-.5-3.5-.5-1.7 0-4.15.65-5.5 1.5V8c1.35-.85 3.8-1.5 5.5-1.5 1.2 0 2.4.15 3.5.5z`},`0`),(0,G.jsx)(`path`,{d:`M17.5 10.5c.88 0 1.73.09 2.5.26V9.24c-.79-.15-1.64-.24-2.5-.24-1.7 0-3.24.29-4.5.83v1.66c1.13-.64 2.7-.99 4.5-.99M13 12.49v1.66c1.13-.64 2.7-.99 4.5-.99.88 0 1.73.09 2.5.26V11.9c-.79-.15-1.64-.24-2.5-.24-1.7 0-3.24.3-4.5.83m4.5 1.84c-1.7 0-3.24.29-4.5.83v1.66c1.13-.64 2.7-.99 4.5-.99.88 0 1.73.09 2.5.26v-1.52c-.79-.16-1.64-.24-2.5-.24`},`1`)],`MenuBookOutlined`),yc=or((0,G.jsx)(`path`,{d:`M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5M4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12m0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7m7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44M15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35`}),`PeopleOutlined`),bc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,backgroundColor:e.palette.background.paper,flexBasis:`70%`,borderRadius:e.shape.borderRadiusLarge})),xc=U(`div`)(({theme:e})=>({padding:e.spacing(2,4,2,7),borderBottom:`1px solid`,borderColor:e.palette.divider,display:`flex`,flexDirection:`row`,justifyContent:`flex-start`,gap:e.spacing(3),alignItems:`center`})),Sc=U(`div`)(({theme:e})=>({display:`flex`,flexGrow:1})),Cc=U(`div`)(({theme:e})=>({flexBasis:`50%`,padding:e.spacing(3,2,6,8),display:`flex`,gap:e.spacing(3),flexDirection:`column`})),wc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,gap:e.spacing(2),alignItems:`center`,fontSize:e.spacing(1.75),fontWeight:`bold`})),Tc=U(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,justifyContent:`space-between`})),Ec=U(Zr)(({theme:e})=>({backgroundColor:e.palette.primary.main,color:e.palette.background.paper,borderRadius:`50%`,padding:e.spacing(.5),width:`28px`,height:`28px`})),Dc=U(Yt)(({theme:e})=>({color:e.palette.primary.main})),Oc=U(yc)(({theme:e})=>({color:e.palette.primary.main})),kc=U(vc)(({theme:e})=>({color:e.palette.primary.main})),Ac=({projectId:e,onClose:t})=>(0,G.jsxs)(bc,{children:[(0,G.jsxs)(xc,{children:[(0,G.jsx)(Ec,{}),(0,G.jsxs)(Tc,{children:[(0,G.jsx)(H,{fontWeight:`bold`,children:`Setup completed`}),(0,G.jsx)(H,{variant:`body2`,children:`Next steps`})]}),(0,G.jsx)(Ua,{title:`Close`,arrow:!0,sx:{ml:`auto`},children:(0,G.jsx)(ur,{onClick:t,size:`small`,children:(0,G.jsx)(Ut,{})})})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsxs)(Cc,{children:[(0,G.jsxs)(wc,{children:[(0,G.jsx)(Dc,{}),`Expose your feature flag to users`]}),(0,G.jsxs)(H,{children:[`You can have fine grained control over who is exposed to your feature flag by leveraging`,` `,(0,G.jsx)(z,{className:`unleash-action-button`,to:`https://docs.getunleash.io/concepts/activation-strategies`,target:`_blank`,rel:`noopener noreferrer`,children:`strategies`}),`. Visit the feature flag page to start adding strategies to control exposure.`]})]}),(0,G.jsxs)(Cc,{children:[(0,G.jsxs)(wc,{children:[(0,G.jsx)(Oc,{}),`Add members to your project`]}),(0,G.jsxs)(H,{children:[`Unleash is best when collaborating with your co-workers.`,` `,(0,G.jsx)(z,{className:`unleash-action-button`,to:`/projects/${e}/settings/access`,children:`Add your co-workers to the project`}),`.`]})]}),(0,G.jsxs)(Cc,{children:[(0,G.jsxs)(wc,{children:[(0,G.jsx)(kc,{}),`Learn about Unleash`]}),(0,G.jsxs)(H,{children:[`Take a deep dive through our documentation,`,` `,(0,G.jsx)(z,{className:`unleash-action-button`,to:`https://docs.getunleash.io/unleash-academy/foundational`,target:`_blank`,rel:`noopener noreferrer`,children:`starting with the foundations of Unleash`}),`.`]})]})]})]}),jc=({selectedIds:e,projectId:t,onConfirm:n})=>{let[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),{trackEvent:s}=I(),c=async()=>{o(!0)},l=async()=>{i(!0)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ea,{projectId:t,permission:fa,children:({hasAccess:e})=>(0,G.jsx)(V,{disabled:!e,startIcon:(0,G.jsx)(Hi,{}),variant:`outlined`,size:`small`,onClick:c,"date-testid":`batch_revive`,children:`Revive`})}),(0,G.jsx)(ea,{projectId:t,permission:T,children:({hasAccess:e})=>(0,G.jsx)(V,{disabled:!e,startIcon:(0,G.jsx)(fn,{}),variant:`outlined`,size:`small`,onClick:l,children:`Delete`})}),(0,G.jsx)(xa,{deletedFeatures:e,projectId:t,open:r,setOpen:i,refetch:()=>{n?.(),s(`batch_operations`,{props:{eventType:`features deleted`}})}}),(0,G.jsx)(oe,{revivedFeatures:e,projectId:t,open:a,setOpen:o,refetch:()=>{n?.(),s(`batch_operations`,{props:{eventType:`features revived`}})}})]})};function Mc(e){return yt(`MuiTimelineSeparator`,e)}Xr(`MuiTimelineSeparator`,[`root`]);var Nc=e=>{let{classes:t}=e;return mn({root:[`root`]},Mc,t)},Pc=U(`div`,{name:`MuiTimelineSeparator`,slot:`Root`,overridesResolver:(e,t)=>t.root})({display:`flex`,flexDirection:`column`,flex:0,alignItems:`center`}),Fc=W.forwardRef(function(e,t){let n=rn({props:e,name:`MuiTimelineSeparator`}),{className:r,...i}=n,a=n;return(0,G.jsx)(Pc,{className:Tt(Nc(a).root,r),ownerState:a,ref:t,...i})}),Ic=W.createContext({});function Lc(e){return yt(`MuiTimelineContent`,e)}var Rc=Xr(`MuiTimelineContent`,[`root`,`positionLeft`,`positionRight`,`positionAlternate`,`positionAlternateReverse`]);function zc(e){return e===`alternate-reverse`?`positionAlternateReverse`:`position${hr(e)}`}var Bc=e=>{let{position:t,classes:n}=e;return mn({root:[`root`,zc(t)]},Lc,n)},Vc=U(H,{name:`MuiTimelineContent`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[zc(n.position)]]}})(({ownerState:e})=>({flex:1,padding:`6px 16px`,textAlign:`left`,...e.position===`left`&&{textAlign:`right`}})),Hc=W.forwardRef(function(e,t){let n=rn({props:e,name:`MuiTimelineContent`}),{className:r,...i}=n,{position:a}=W.useContext(Ic),o={...n,position:a||`right`};return(0,G.jsx)(Vc,{component:`div`,className:Tt(Bc(o).root,r),ownerState:o,ref:t,...i})}),Uc=Xr(`MuiTimelineOppositeContent`,[`root`,`positionLeft`,`positionRight`,`positionAlternate`,`po