unleash-server 5.5.0 → 5.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/lib/db/event-store.d.ts +1 -1
  2. package/dist/lib/db/event-store.js +0 -1
  3. package/dist/lib/db/event-store.js.map +1 -1
  4. package/dist/lib/db/event-store.test.js +21 -0
  5. package/dist/lib/db/event-store.test.js.map +1 -1
  6. package/dist/migrations/20230927172930-events-announced-index.d.ts +2 -0
  7. package/dist/migrations/20230927172930-events-announced-index.js +13 -0
  8. package/dist/migrations/20230927172930-events-announced-index.js.map +1 -0
  9. package/frontend/build/index.html +1 -1
  10. package/frontend/build/static/{AdvancedPlayground-20059178.js → AdvancedPlayground-aa02fee7.js} +1 -1
  11. package/frontend/build/static/{CreateProject-6955728f.js → CreateProject-1e9f20af.js} +1 -1
  12. package/frontend/build/static/{Error-f56339ab.js → Error-3e2dcc74.js} +1 -1
  13. package/frontend/build/static/{FeatureArchiveDialog-33dc3a5b.js → FeatureArchiveDialog-1edc277b.js} +1 -1
  14. package/frontend/build/static/{FeatureMetricsChart-5ad514bc.js → FeatureMetricsChart-67045ba1.js} +1 -1
  15. package/frontend/build/static/{FeatureViewLazyExport-85a68ed0.js → FeatureViewLazyExport-578a84bd.js} +2 -2
  16. package/frontend/build/static/{LazyAdminExport-e2677758.js → LazyAdminExport-98306920.js} +2 -2
  17. package/frontend/build/static/{LazyProjectExport-969bb54e.js → LazyProjectExport-ebbfce17.js} +1 -1
  18. package/frontend/build/static/{NetworkOverview-894877e6.js → NetworkOverview-0a4063f9.js} +2 -2
  19. package/frontend/build/static/{NetworkTraffic-81eff1ae.js → NetworkTraffic-2b9ad0d8.js} +1 -1
  20. package/frontend/build/static/{ReactJSONEditor-59c8a094.js → ReactJSONEditor-95bd65b6.js} +1 -1
  21. package/frontend/build/static/{RoleCell-35857d41.js → RoleCell-61b5602f.js} +1 -1
  22. package/frontend/build/static/{StrategyItemContainer-b250f2d4.js → StrategyItemContainer-1bd0d884.js} +1 -1
  23. package/frontend/build/static/{chartjs-adapter-date-fns.esm-c51fe022.js → chartjs-adapter-date-fns.esm-d24144ba.js} +1 -1
  24. package/frontend/build/static/{flowchart-elk-definition-170a3958-a8c4a86a.js → flowchart-elk-definition-170a3958-94e3633c.js} +1 -1
  25. package/frontend/build/static/{index-0515f416.js → index-5f6e673f.js} +1 -1
  26. package/frontend/build/static/{index-a59b2d65.js → index-6d970dd2.js} +1 -1
  27. package/frontend/build/static/{index-942e9eeb.js → index-fcc452e3.js} +4 -4
  28. package/frontend/build/static/{is_dark-464961a8.js → is_dark-bdb20af3.js} +1 -1
  29. package/frontend/build/static/{mindmap-definition-44684416-3a71a9a5.js → mindmap-definition-44684416-c90e3c48.js} +1 -1
  30. package/frontend/build/static/{timeline-definition-8e5a9bc6-da4ebc88.js → timeline-definition-8e5a9bc6-03e7fdb4.js} +1 -1
  31. package/frontend/build/static/{unknownify-3563456b.js → unknownify-e5651baf.js} +1 -1
  32. package/package.json +1 -1
@@ -312,7 +312,7 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
312
312
  --header 'Authorization: INSERT_API_KEY' \\
313
313
  --header 'Content-Type: application/json' \\
314
314
  --data-raw '${JSON.stringify(m(),void 0,2)}'`,children:s(qM,{handleSubmit:async w=>{w.preventDefault();try{await i(r,m()),h(),a("/environments"),t({type:"success",title:"Successfully updated environment."})}catch(C){n(gt(C))}},handleCancel:()=>{a(bo)},name:l,type:c,setName:u,setType:d,mode:"Edit",errors:p,clearErrors:f,children:s(Vc,{permission:hi})})})},n0=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0}),o="api/admin/context";return{createContext:async u=>{const p=t(o,{method:"POST",body:JSON.stringify(u)});try{return await e(p.caller,p.id)}catch(f){throw f}},validateContextName:async u=>{const d=`${o}/validate`,p=t(d,{method:"POST",body:JSON.stringify({name:u})});try{return await e(p.caller,p.id)}catch(f){throw f}},updateContext:async u=>{const d=`${o}/${u.name}`,p=t(d,{method:"PUT",body:JSON.stringify(u)});try{return await e(p.caller,p.id)}catch(f){throw f}},removeContext:async u=>{const d=`${o}/${u}`,p=t(d,{method:"DELETE"});try{return await e(p.caller,p.id)}catch(f){throw f}},errors:n,loading:r}},Zxe=(e,t={})=>{const n=async()=>{const u=kt(`api/admin/context/${e}`);return fetch(u,{method:"GET"}).then(xn("Context data")).then(d=>d.json())},r=`api/admin/context/${e}`,{data:o,error:i}=Pn(r,n,{...t}),[a,l]=g.useState(!i&&!o),c=()=>{Jr(r)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{context:o||{name:"",description:"",legalValues:[],stickiness:!1},error:i,loading:a,refetch:c,FEATURE_CACHE_KEY:r}},eCe=x("li")(({theme:e})=>({display:"grid",lineHeight:1.25,gridTemplateColumns:"1fr auto",alignSelf:"start",alignItems:"start",gap:e.spacing(1),padding:e.spacing(1),background:e.palette.background.elevation2,borderRadius:e.shape.borderRadius,wordBreak:"break-word"})),tCe=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),nCe=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),rCe=x("button")(({theme:e})=>({all:"unset",lineHeight:.1,paddingTop:"1px",display:"block",cursor:"pointer","& svg":{fontSize:e.fontSizes.bodySize,opacity:.5},"&:hover svg, &:focus-visible svg":{opacity:.75}})),oCe=({label:e,description:t,onRemove:n})=>S(eCe,{children:[S("div",{children:[s(tCe,{children:e}),s(V,{condition:!!t,show:()=>s(nCe,{children:t})})]}),s(rCe,{onClick:n,children:s(xce,{titleAccess:"Remove"})})]}),iCe=x("ul")(({theme:e})=>({listStyleType:"none",display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:0,margin:0,marginBottom:"1rem !important"})),aCe=iCe,sCe=({strategyDefinition:e})=>s("p",{children:e==null?void 0:e.description}),lCe=Dae(Toe,e=>({root:{height:8},thumb:{height:24,width:24,backgroundColor:e.palette.background.paper,border:"2px solid currentColor"},active:{},valueLabel:{},track:{height:8,borderRadius:e.shape.borderRadius},rail:{height:8,borderRadius:e.shape.borderRadius}})),cCe=$s()(e=>({slider:{width:"100%",maxWidth:"100%"},margin:{height:e.spacing(3)}})),uCe=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}],KM=({name:e,value:t,onChange:n,disabled:r=!1})=>{const{classes:o}=cCe(),i=a=>`${a}%`;return S("div",{className:o.slider,children:[s(re,{id:"discrete-slider-always",variant:"h3",gutterBottom:!0,component:"h3",children:e}),s(lCe,{min:0,max:100,value:t,getAriaValueText:i,"aria-labelledby":"discrete-slider-always",step:1,"data-testid":dse,marks:uCe,onChange:n,valueLabelDisplay:"on",disabled:r})]})},Lf=e=>{const t=Number(cl(e));return Number.isFinite(t)?t:0},cl=e=>String(e??"").trim(),Js=e=>cl(e).split(",").map(t=>t.trim()).filter(Boolean),fg=({name:e,value:t="",label:n="",options:r,onChange:o,id:i,disabled:a=!1,className:l,classes:c,...u})=>S(Os,{variant:"outlined",size:"small",classes:c,children:[s(Zh,{htmlFor:i,children:n}),s(eg,{name:e,disabled:a,onChange:o,className:l,label:n,id:i,value:t,...u,children:(()=>r.map(p=>s(sa,{value:p.key,title:p.title||"","data-testid":`${UL}-${p.label}`,children:p.label},p.key)))()})]}),ga=(e={revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0})=>{const t=()=>{const l=kt("api/admin/context");return fetch(l,{method:"GET"}).then(xn("Context variables")).then(c=>c.json())},n="api/admin/context",{data:r,mutate:o,error:i,isValidating:a}=Pn(n,t,e);return{context:r||[],error:i,loading:a&&!i&&!r,refetchUnleashContext:o}},dCe="random",pCe="default",YM=({label:e,editable:t,value:n,onChange:r,dataTestId:o})=>{const{context:i}=ga(),a=on(),c=(()=>{const u=i.filter(d=>d.stickiness).map(d=>({key:d.name,label:d.name}));return!u.find(d=>d.key==="default")&&!i.find(d=>d.name===pCe)&&u.push({key:"default",label:"default"}),!u.find(d=>d.key==="random")&&!i.find(d=>d.name===dCe)&&u.push({key:"random",label:"random"}),n&&!u.find(d=>d.key===n)&&u.push({key:n,label:n}),u})();return s(fg,{id:"stickiness-select",name:"stickiness",label:e,options:c,value:n,disabled:!t,"data-testid":o,onChange:r,style:{width:"inherit",minWidth:"100%",marginBottom:a.spacing(2)}})},fCe="default",XM=e=>{const{project:t,loading:n,error:r}=kc(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:fCe,mode:t.mode,loading:n,error:r}},hCe=({updateParameter:e,parameters:t,editable:n=!0})=>{const r=lr("projectId"),{defaultStickiness:o,loading:i}=XM(r),{pathname:a}=vo(),l=a.includes("default-strategy"),c=f=>h=>{e(f,h)},u=(f,h)=>{e("rollout",h.toString())},d=t.rollout!==void 0?Lf(t.rollout):100,p=g.useMemo(()=>t.stickiness===""&&!i?o:cl(t.stickiness),[i,t.stickiness]);return t.stickiness===""&&c("stickiness")(p),g.useEffect(()=>{l&&!t.groupId&&c("groupId")("")},[l]),i?s(Eh,{}):S("div",{children:[s(KM,{name:"Rollout",value:d,disabled:!n,onChange:u}),s("br",{}),S("div",{children:[S(re,{variant:"subtitle2",style:{marginBottom:"1rem",display:"flex",gap:"1ch"},component:"h2",children:["Stickiness",s(Wi,{tooltip:"Stickiness defines what parameter should be used to ensure that your users get consistency in features. By default unleash will use the first value present in the context in the order of userId, sessionId and random."})]}),s(YM,{label:"Stickiness",value:p,editable:n,dataTestId:fse,onChange:f=>c("stickiness")(f.target.value)})," ",s("br",{}),s("br",{}),S(re,{variant:"subtitle2",style:{marginBottom:"1rem",display:"flex",gap:"1ch"},component:"h2",children:["GroupId",s(Wi,{tooltip:"GroupId is used to ensure that different toggles will hash differently for the same user. The groupId defaults to feature toggle name, but you can override it to correlate rollout of multiple feature toggles."})]}),s(ir,{label:"groupId",id:"groupId-input",value:cl(t.groupId),disabled:!n,onChange:f=>c("groupId")(f.target.value),"data-testid":hse})]})]})},_a=({text:e,maxWidth:t,maxLength:n,className:r,...o})=>s(V,{condition:((e==null?void 0:e.length)??0)>n,show:s(wt,{title:e,arrow:!0,children:s("span",{"data-loading":!0,className:r,style:{maxWidth:`${t}px`,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"middle"},...o,children:e})}),elseShow:s("span",{className:r,children:e})}),gCe=x("div")(({theme:e})=>({display:"grid",gap:e.spacing(1)})),mCe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexWrap:"wrap"})),yCe=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start"})),JM=({name:e,list:t,setConfig:n,disabled:r,errors:o})=>{const[i,a]=g.useState(""),l="Enter",c=h=>{d(h)},u=h=>{(h==null?void 0:h.key)===l&&(d(h),h.preventDefault(),h.stopPropagation())},d=h=>{h.preventDefault();const m=h.target.value;if(m){const y=m.split(/,\s*/).filter(b=>!t.includes(b));if(y.length>0){const b=t.concat(y).filter(v=>v);n(e,b.join(","))}a("")}},p=h=>{t[h]=null,n(e,t.length===1?"":t.filter(Boolean).join(","))},f=h=>{a(h.currentTarget.value)};return S(gCe,{children:[S(re,{variant:"subtitle2",component:"h2",children:["List of ",e]}),s(V,{condition:t.length>0,show:s(mCe,{children:t.map((h,m)=>s(Is,{label:s(_a,{maxWidth:"300",text:h,maxLength:50}),onDelete:r?void 0:()=>p(m),title:"Remove value"},m+h))})}),s(V,{condition:!r,show:S(yCe,{children:[s(fn,{error:!!o.getFormError(e),helperText:o.getFormError(e),name:"input_field",variant:"outlined",label:"Add items",id:"input-add-items",value:i,size:"small",placeholder:"",onBlur:c,onChange:f,onKeyDown:u,"data-testid":gse}),s(Ve,{onClick:d,"data-testid":mse,variant:"outlined",color:"secondary",startIcon:s(fa,{}),children:"Add"})]})})]})},vCe=({editable:e,parameters:t,updateParameter:n,errors:r})=>s("div",{children:s(JM,{name:"userIds",list:Js(t.userIds),disabled:!e,setConfig:n,errors:r})}),Fp=({text:e})=>e?s(fe,{sx:t=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallerBody,marginTop:t.spacing(1)}),children:e}):null,bCe=({definition:e,parameters:t,updateParameter:n,editable:r,errors:o})=>{const{type:i,name:a,description:l,required:c}=e,u=t[a],d=o.getFormError(a),p=c?`${a} * `:a,f=v=>{n(a,v.target.value)},h=v=>{n(a,cl(v.target.value))},m=(v,w)=>{n(a,w.toString())},y=(v,w)=>{n(a,String(w))},b=(v,w)=>{n(v,Js(w).join(","))};if(i==="percentage")return S("div",{children:[s(KM,{name:a,onChange:m,disabled:!r,value:Lf(t[a]),minLabel:"off",maxLabel:"on"}),s(Fp,{text:l})]});if(i==="list")return S("div",{children:[s(JM,{name:a,list:Js(t[a]),disabled:!r,setConfig:b,errors:o}),s(Fp,{text:l})]});if(i==="number")return S("div",{children:[s(fn,{error:!!d,helperText:d,variant:"outlined",size:"small","aria-required":c,style:{width:"100%"},disabled:!r,label:p,onChange:f,value:u}),s(Fp,{text:l})]});if(i==="boolean"){const w=cl(t[a])==="true";return S("div",{children:[s(Gr,{label:a,control:s(pa,{name:a,onChange:y,checked:w})}),s(Fp,{text:l})]})}return S("div",{children:[s(fn,{rows:1,placeholder:"",variant:"outlined",size:"small",style:{width:"100%"},"aria-required":c,disabled:!r,error:!!d,helperText:d,name:a,label:p,onChange:h,value:cl(t[a])}),s(Fp,{text:l})]})},wCe=Mc("div")(({theme:e})=>({display:"grid",gap:e.spacing(4)})),SCe=({parameters:e,strategyDefinition:t,updateParameter:n,editable:r,errors:o})=>!t||t.parameters.length===0?null:s(wCe,{children:t.parameters.map((i,a)=>s("div",{children:s(bCe,{definition:i,parameters:e,updateParameter:n,editable:r,errors:o})},a))});function ta(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(o){return"'"+o+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function dd(e){return!!e&&!!e[ci]}function Ac(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var o=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return o===Object||typeof o=="function"&&Function.toString.call(o)===_Ce}(e)||Array.isArray(e)||!!e[Z3]||!!(!((t=e.constructor)===null||t===void 0)&&t[Z3])||YT(e)||XT(e))}function Th(e,t,n){n===void 0&&(n=!1),Gd(e)===0?(n?Object.keys:tk)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,o){return t(o,r,e)})}function Gd(e){var t=e[ci];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:YT(e)?2:XT(e)?3:0}function oC(e,t){return Gd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function xCe(e,t){return Gd(e)===2?e.get(t):e[t]}function QM(e,t,n){var r=Gd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function CCe(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function YT(e){return ACe&&e instanceof Map}function XT(e){return RCe&&e instanceof Set}function Xl(e){return e.o||e.t}function JT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=PCe(e);delete t[ci];for(var n=tk(t),r=0;r<n.length;r++){var o=n[r],i=t[o];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function QT(e,t){return t===void 0&&(t=!1),ZT(e)||dd(e)||!Ac(e)||(Gd(e)>1&&(e.set=e.add=e.clear=e.delete=ECe),Object.freeze(e),t&&Th(e,function(n,r){return QT(r,!0)},!0)),e}function ECe(){ta(2)}function ZT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Ha(e){var t=ICe[e];return t||ta(18,e),t}function G3(){return kh}function Rw(e,t){t&&(Ha("Patches"),e.u=[],e.s=[],e.v=t)}function ov(e){iC(e),e.p.forEach(TCe),e.p=null}function iC(e){e===kh&&(kh=e.l)}function q3(e){return kh={p:[],l:kh,h:e,m:!0,_:0}}function TCe(e){var t=e[ci];t.i===0||t.i===1?t.j():t.g=!0}function _w(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Ha("ES5").S(t,e,r),r?(n[ci].P&&(ov(t),ta(4)),Ac(e)&&(e=iv(t,e),t.l||av(t,e)),t.u&&Ha("Patches").M(n[ci].t,e,t.u,t.s)):e=iv(t,n,[]),ov(t),t.u&&t.v(t.u,t.s),e!==ZM?e:void 0}function iv(e,t,n){if(ZT(t))return t;var r=t[ci];if(!r)return Th(t,function(l,c){return K3(e,r,t,l,c,n)},!0),t;if(r.A!==e)return t;if(!r.P)return av(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=r.i===4||r.i===5?r.o=JT(r.k):r.o,i=o,a=!1;r.i===3&&(i=new Set(o),o.clear(),a=!0),Th(i,function(l,c){return K3(e,r,o,l,c,n,a)}),av(e,o,!1),n&&e.u&&Ha("Patches").N(r,n,e.u,e.s)}return r.o}function K3(e,t,n,r,o,i,a){if(dd(o)){var l=iv(e,o,i&&t&&t.i!==3&&!oC(t.R,r)?i.concat(r):void 0);if(QM(n,r,l),!dd(l))return;e.m=!1}else a&&n.add(o);if(Ac(o)&&!ZT(o)){if(!e.h.D&&e._<1)return;iv(e,o),t&&t.A.l||av(e,o)}}function av(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&QT(t,n)}function Pw(e,t){var n=e[ci];return(n?Xl(n):e)[t]}function Y3(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function aC(e){e.P||(e.P=!0,e.l&&aC(e.l))}function Iw(e){e.o||(e.o=JT(e.t))}function sC(e,t,n){var r=YT(t)?Ha("MapSet").F(t,n):XT(t)?Ha("MapSet").T(t,n):e.O?function(o,i){var a=Array.isArray(o),l={i:a?1:0,A:i?i.A:G3(),P:!1,I:!1,R:{},l:i,t:o,k:null,o:null,j:null,C:!1},c=l,u=lC;a&&(c=[l],u=cf);var d=Proxy.revocable(c,u),p=d.revoke,f=d.proxy;return l.k=f,l.j=p,f}(t,n):Ha("ES5").J(t,n);return(n?n.A:G3()).p.push(r),r}function kCe(e){return dd(e)||ta(22,e),function t(n){if(!Ac(n))return n;var r,o=n[ci],i=Gd(n);if(o){if(!o.P&&(o.i<4||!Ha("ES5").K(o)))return o.t;o.I=!0,r=X3(n,i),o.I=!1}else r=X3(n,i);return Th(r,function(a,l){o&&xCe(o.t,a)===l||QM(r,a,t(l))}),i===3?new Set(r):r}(e)}function X3(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return JT(e)}var J3,kh,ek=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",ACe=typeof Map<"u",RCe=typeof Set<"u",Q3=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",ZM=ek?Symbol.for("immer-nothing"):((J3={})["immer-nothing"]=!0,J3),Z3=ek?Symbol.for("immer-draftable"):"__$immer_draftable",ci=ek?Symbol.for("immer-state"):"__$immer_state",_Ce=""+Object.prototype.constructor,tk=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,PCe=Object.getOwnPropertyDescriptors||function(e){var t={};return tk(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},ICe={},lC={get:function(e,t){if(t===ci)return e;var n=Xl(e);if(!oC(n,t))return function(o,i,a){var l,c=Y3(i,a);return c?"value"in c?c.value:(l=c.get)===null||l===void 0?void 0:l.call(o.k):void 0}(e,n,t);var r=n[t];return e.I||!Ac(r)?r:r===Pw(e.t,t)?(Iw(e),e.o[t]=sC(e.A.h,r,e)):r},has:function(e,t){return t in Xl(e)},ownKeys:function(e){return Reflect.ownKeys(Xl(e))},set:function(e,t,n){var r=Y3(Xl(e),t);if(r!=null&&r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=Pw(Xl(e),t),i=o==null?void 0:o[ci];if(i&&i.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(CCe(n,o)&&(n!==void 0||oC(e.t,t)))return!0;Iw(e),aC(e)}return e.o[t]===n&&(n!==void 0||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return Pw(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,Iw(e),aC(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Xl(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){ta(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ta(12)}},cf={};Th(lC,function(e,t){cf[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),cf.deleteProperty=function(e,t){return cf.set.call(this,e,t,void 0)},cf.set=function(e,t,n){return lC.set.call(this,e[0],t,n,e[0])};var OCe=function(){function e(n){var r=this;this.O=Q3,this.D=!0,this.produce=function(o,i,a){if(typeof o=="function"&&typeof i!="function"){var l=i;i=o;var c=r;return function(y){var b=this;y===void 0&&(y=l);for(var v=arguments.length,w=Array(v>1?v-1:0),C=1;C<v;C++)w[C-1]=arguments[C];return c.produce(y,function(k){var A;return(A=i).call.apply(A,[b,k].concat(w))})}}var u;if(typeof i!="function"&&ta(6),a!==void 0&&typeof a!="function"&&ta(7),Ac(o)){var d=q3(r),p=sC(r,o,void 0),f=!0;try{u=i(p),f=!1}finally{f?ov(d):iC(d)}return typeof Promise<"u"&&u instanceof Promise?u.then(function(y){return Rw(d,a),_w(y,d)},function(y){throw ov(d),y}):(Rw(d,a),_w(u,d))}if(!o||typeof o!="object"){if((u=i(o))===void 0&&(u=o),u===ZM&&(u=void 0),r.D&&QT(u,!0),a){var h=[],m=[];Ha("Patches").M(o,u,h,m),a(h,m)}return u}ta(21,o)},this.produceWithPatches=function(o,i){if(typeof o=="function")return function(u){for(var d=arguments.length,p=Array(d>1?d-1:0),f=1;f<d;f++)p[f-1]=arguments[f];return r.produceWithPatches(u,function(h){return o.apply(void 0,[h].concat(p))})};var a,l,c=r.produce(o,i,function(u,d){a=u,l=d});return typeof Promise<"u"&&c instanceof Promise?c.then(function(u){return[u,a,l]}):[c,a,l]},typeof(n==null?void 0:n.useProxies)=="boolean"&&this.setUseProxies(n.useProxies),typeof(n==null?void 0:n.autoFreeze)=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){Ac(n)||ta(8),dd(n)&&(n=kCe(n));var r=q3(this),o=sC(this,n,void 0);return o[ci].C=!0,iC(r),o},t.finishDraft=function(n,r){var o=n&&n[ci],i=o.A;return Rw(i,r),_w(void 0,i)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!Q3&&ta(20),this.O=n},t.applyPatches=function(n,r){var o;for(o=r.length-1;o>=0;o--){var i=r[o];if(i.path.length===0&&i.op==="replace"){n=i.value;break}}o>-1&&(r=r.slice(o+1));var a=Ha("Patches").$;return dd(n)?a(n,r):this.produce(n,function(l){return a(l,r)})},e}(),ui=new OCe,$Ce=ui.produce;ui.produceWithPatches.bind(ui);ui.setAutoFreeze.bind(ui);ui.setUseProxies.bind(ui);ui.applyPatches.bind(ui);ui.createDraft.bind(ui);ui.finishDraft.bind(ui);const Ei=$Ce,NCe=({hasAccess:e,strategy:t,strategyDefinition:n,setStrategy:r,validateParameter:o,errors:i})=>{const{context:a}=ga(),l=(c,u)=>{r(Ei(d=>{d.parameters=d.parameters??{},d.parameters[c]=u})),o(c,u)};switch(t.name){case"default":return s(sCe,{strategyDefinition:n});case"flexibleRollout":return s(hCe,{context:a,parameters:t.parameters??{},updateParameter:l,editable:e});case"userWithId":return s(vCe,{parameters:t.parameters??{},updateParameter:l,editable:e,errors:i});default:return s(SCe,{strategyDefinition:n,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i})}},LCe={environments:[],name:"",type:"",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1},Ja=(e,t,n)=>{const r=MCe(e,t),{data:o,error:i,mutate:a}=Pn(["useFeature",r],()=>DCe(r),n),l=g.useCallback(()=>{a().catch(console.warn)},[a]);return{feature:(o==null?void 0:o.body)||LCe,refetchFeature:l,loading:!i&&!o,status:o==null?void 0:o.status,error:i}},DCe=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await xn("Feature toggle data")(t),{status:t.status,body:await t.json()})},MCe=(e,t)=>kt(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`),BCe=({projectId:e,featureId:t,environmentId:n,children:r})=>{const o=Ak(e,t),{feature:i}=Ja(e,t),a=s(Kt,{to:o,children:"feature toggle page"});return s(V,{condition:FCe(i,n),show:r,elseShow:S(Bt,{severity:"warning",children:["This feature toggle is currently disabled in the"," ",s("strong",{children:n})," environment. Any changes made here will not take effect until the toggle has been enabled on the ",a,"."]})})},FCe=(e,t)=>{const n=e.environments.find(r=>r.name===t);return n?n.enabled:!1},nk="NOT_IN",r0="IN",rk="STR_ENDS_WITH",ok="STR_STARTS_WITH",ik="STR_CONTAINS",ak="NUM_EQ",sk="NUM_GT",lk="NUM_GTE",ck="NUM_LT",uk="NUM_LTE",o0="DATE_AFTER",dk="DATE_BEFORE",pk="SEMVER_EQ",fk="SEMVER_GT",hk="SEMVER_LT",zCe=[r0,nk,ik,ok,rk,ak,sk,lk,ck,uk,dk,o0,pk,fk,hk],Ss=[ik,ok,rk],hc=[r0,nk],Hu=[ak,sk,lk,ck,uk],Ii=[dk,o0],Vu=[pk,fk,hk],eB=[...Vu,...Ii,...Hu];[...Ss,...hc];const jCe=[...Ss,...Ii,...eB],Mn=(e,t)=>e.some(n=>n===t),tB=()=>S(Bt,{severity:"warning",children:["Remember to update your Unleash client! New operators require new SDK versions. ",s(UCe,{}),"."]}),UCe=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators",target:"_blank",rel:"noreferrer",children:"Read more"}),WCe=x("div")(({theme:e})=>({padding:e.spacing(2)})),HCe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(2),borderTop:`1px solid ${e.palette.divider}`,width:"100%",padding:e.spacing(2)})),VCe=x("div")({marginLeft:"auto"}),GCe=x(Ve)(({theme:e})=>({marginRight:e.spacing(1),minWidth:"125px"})),qCe=x(Ve)(({theme:e})=>({marginLeft:e.spacing(1),minWidth:"125px"})),KCe=({localConstraint:e,children:t,triggerTransition:n,setAction:r,onSubmit:o})=>S(ce,{children:[S(WCe,{children:[s(V,{condition:Mn(jCe,e.operator),show:s(tB,{})}),t]}),s(HCe,{children:S(VCe,{children:[s(GCe,{type:"button",onClick:o,variant:"contained",color:"primary","data-testid":"CONSTRAINT_SAVE_BUTTON",children:"Save"}),s(qCe,{onClick:()=>{r(OB),n()},children:"Cancel"})]})})]}),nB=({compact:e})=>s(fe,{sx:{backgroundColor:"primary.light",p:e?"1px":"2px",borderRadius:"50%",width:e?"18px":"24px",height:e?"18px":"24px",marginRight:"13px"},children:s(Yce,{sx:t=>({fill:t.palette.common.white,display:"block",width:e?t.spacing(2):t.spacing(2.5),height:e?t.spacing(2):t.spacing(2.5)})})}),YCe=(e,t)=>{const n=`To satisfy this constraint, values passed into the SDK as ${t} must`;if(e===r0)return`${n} include:`;if(e===nk)return`${n} not include:`;if(e===rk)return`${n} end with:`;if(e===ok)return`${n} start with:`;if(e===ik)return`${n} contain:`;if(e===ak)return`${n} match:`;if(e===sk)return`${n} be greater than:`;if(e===lk)return`${n} be greater than or equal to:`;if(e===ck)return`${n} be less than:`;if(e===uk)return`${n} be less than or equal to:`;if(e===o0)return`${n} be after the following date`;if(e===dk)return`${n} be before the following date:`;if(e===pk)return`${n} match the following version:`;if(e===fk)return`${n} be greater than the following version:`;if(e===hk)return`${n} be less than the following version:`},cC=e=>XCe[e],XCe={IN:"is one of",NOT_IN:"is not one of",STR_CONTAINS:"is a string that contains",STR_STARTS_WITH:"is a string that starts with",STR_ENDS_WITH:"is a string that ends with",NUM_EQ:"is a number equal to",NUM_GT:"is a number greater than",NUM_GTE:"is a number greater than or equal to",NUM_LT:"is a number less than",NUM_LTE:"is a number less than or equal to",DATE_BEFORE:"is a date before",DATE_AFTER:"is a date after",SEMVER_EQ:"is a SemVer equal to",SEMVER_GT:"is a SemVer greater than",SEMVER_LT:"is a SemVer less than"},JCe=x("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),eI=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),tI=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),QCe=x(Os)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),ZCe=x(sa,{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}}:{}),e2e=x("div")(({theme:e})=>({lineHeight:1.2})),t2e=({options:e,value:t,onChange:n})=>{const[r,o]=g.useState(!1);return S(QCe,{variant:"outlined",size:"small",fullWidth:!0,children:[s(Zh,{htmlFor:"operator-select",children:"Operator"}),s(eg,{id:"operator-select",name:"operator",label:"Operator",value:t,open:r,onOpen:()=>o(!0),onClose:()=>o(!1),onChange:l=>{n(l.target.value)},renderValue:()=>S(JCe,{children:[s(eI,{children:t}),s(tI,{children:cC(t)})]}),children:e.map(l=>s(ZCe,{value:l,separator:n2e(e,l),children:S(e2e,{children:[s(eI,{children:l}),s(tI,{children:cC(l)})]})},l))})]})},n2e=(e,t)=>t===e[0]?!1:r2e.some(n=>n[0]===t),r2e=[hc,Ss,Hu,Ii,Vu],Ah="currentTime",rB=e=>zCe.filter(t=>!(Mn(Ii,t)&&e!==Ah||!Mn(Ii,t)&&e===Ah)),oB=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0033 3C10.6666 3 9.62387 4.15704 9.76236 5.48654L10.6238 13.7567C10.6974 14.4633 11.293 15 12.0033 15C12.7137 15 13.3093 14.4633 13.3829 13.7567L14.2443 5.48655C14.3828 4.15704 13.34 3 12.0033 3ZM12.0033 17C11.0368 17 10.2533 17.7835 10.2533 18.75C10.2533 19.7165 11.0368 20.5 12.0033 20.5C12.9698 20.5 13.7533 19.7165 13.7533 18.75C13.7533 17.7835 12.9698 17 12.0033 17Z"})),o2e=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.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.03523L10.414 11.7423L10.6238 13.7566C10.6974 14.4631 11.293 14.9998 12.0033 14.9998C12.4551 14.9998 12.8605 14.7827 13.1147 14.4429L19.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.60839ZM13.8264 9.4983L14.2443 5.4864C14.3828 4.15689 13.34 2.99985 12.0033 2.99985C10.6859 2.99985 9.65401 4.12375 9.7571 5.42898L13.8264 9.4983ZM12.0033 16.9998C11.0368 16.9998 10.2533 17.7834 10.2533 18.7498C10.2533 19.7163 11.0368 20.4998 12.0033 20.4998C12.9698 20.4998 13.7533 19.7163 13.7533 18.7498C13.7533 17.7834 12.9698 16.9998 12.0033 16.9998Z"})),iB=Mc(jt)(({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"}})),aB=Mc(jt)(({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"}})),i2e=({localConstraint:e,setInvertedOperator:t})=>s(wt,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:s(fe,{sx:{display:"flex",alignItems:"stretch"},children:s(V,{condition:!!e.inverted,show:s(aB,{className:"operator-is-active",onClick:t,disableRipple:!0,children:s(oB,{})}),elseShow:s(iB,{onClick:t,disableRipple:!0,children:s(o2e,{})})})})}),sB=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.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"})),a2e=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},g.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"})),s2e=({localConstraint:e,setCaseInsensitive:t})=>s(wt,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:s(fe,{sx:{display:"flex",alignItems:"stretch"},children:s(V,{condition:!!e.caseInsensitive,show:s(iB,{onClick:t,disableRipple:!0,children:s(a2e,{})}),elseShow:s(aB,{className:"operator-is-active",onClick:t,disableRipple:!0,children:s(sB,{})})})})}),l2e=x("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),lB=({onEdit:e,onDelete:t,disableDelete:n=!1,disableEdit:r=!1})=>{const o=e&&(a=>{a.stopPropagation(),e()}),i=t&&(a=>{a.stopPropagation(),t()});return S(l2e,{children:[s(V,{condition:!!o&&!r,show:s(wt,{title:"Edit constraint",arrow:!0,children:s(jt,{type:"button",onClick:o,disabled:r,children:s(ji,{})})})}),s(V,{condition:!!i&&!n,show:s(wt,{title:"Delete constraint",arrow:!0,children:s(jt,{type:"button",onClick:i,disabled:n,children:s(yo,{})})})})]})},c2e=x("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),u2e=x("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(770)]:{flexDirection:"column"}})),d2e=x("div")(({theme:e})=>({[e.breakpoints.down(770)]:{marginTop:e.spacing(2)},display:"inline-flex"})),p2e=x("div")(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),f2e=x(Fd)(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),h2e=x("p")(({theme:e})=>({maxWidth:"400px",fontSize:e.fontSizes.smallBody,[e.breakpoints.down("xl")]:{display:"none"}})),g2e=({compact:e,localConstraint:t,setLocalConstraint:n,setContextName:r,setOperator:o,onDelete:i,setInvertedOperator:a,setCaseInsensitive:l})=>{const{context:c}=ga(),{contextName:u,operator:d}=t,[p,f]=g.useState(!1),{uiConfig:h}=St(),m=!!h.flags.caseInsensitiveInOperators;if(g.useEffect(()=>{u===Ah&&!Mn(Ii,d)?n(v=>({...v,operator:o0,value:new Date().toISOString()})):u!==Ah&&Mn(Ii,d)&&o(r0),Mn(Ss,d)||Mn(hc,d)&&m?f(!0):f(!1)},[u,o,d,n,m]),!c)return null;const y=c.map(v=>({key:v.name,label:v.name})),b=v=>{Mn(Ss,v)||Mn(hc,v)&&m?f(!0):f(!1),Mn(Ii,v)?n(w=>({...w,operator:v,value:new Date().toISOString()})):o(v)};return S(c2e,{children:[s(nB,{}),S(u2e,{children:[s("div",{children:s(f2e,{id:"context-field-select",name:"contextName",label:"Context Field",autoFocus:!0,options:y,value:u||"",onChange:r})}),S(d2e,{children:[s(i2e,{localConstraint:t,setInvertedOperator:a}),s(p2e,{children:s(t2e,{options:rB(u),value:d,onChange:b})}),s(V,{condition:p,show:s(s2e,{localConstraint:t,setCaseInsensitive:l})})]})]}),s(V,{condition:!e,show:s(h2e,{children:YCe(d,u)})}),s(lB,{onDelete:i,disableEdit:!0})]})},nI=e=>Ei(e,t=>{Mn(eB,e.operator)?delete t.values:delete t.value}),qd=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0}),o=async(A,T)=>{const P=t("api/admin/features/validate",{method:"POST",body:JSON.stringify({name:A,projectId:T})});try{return await e(P.caller,P.id)}catch(I){throw I}},i=async A=>{const _=t("api/admin/constraints/validate",{method:"POST",body:JSON.stringify(A)});await e(_.caller,_.id)},a=async(A,T)=>{const _=`/api/admin/projects/${A}/features`,P=t(_,{method:"POST",body:JSON.stringify(T)});await e(P.caller,P.id)},l=g.useCallback(async(A,T,_,P=!1)=>{const I=`api/admin/projects/${A}/features/${T}/environments/${_}/on?shouldActivateDisabledStrategies=${P}`,O=t(I,{method:"POST"},"toggleFeatureEnvironmentOn");try{return await e(O.caller,O.id)}catch($){throw $}},[t,e]),c=g.useCallback(async(A,T,_,P=!1)=>{const I=`api/admin/projects/${A}/bulk_features/environments/${_}/on?shouldActivateDisabledStrategies=${P}`,O=t(I,{method:"POST",body:JSON.stringify({features:T})},"bulkToggleFeaturesEnvironmentOn");try{return await e(O.caller,O.id)}catch($){throw $}},[t,e]),u=g.useCallback(async(A,T,_,P=!1)=>{const I=`api/admin/projects/${A}/bulk_features/environments/${_}/off?shouldActivateDisabledStrategies=${P}`,O=t(I,{method:"POST",body:JSON.stringify({features:T})},"bulkToggleFeaturesEnvironmentOff");try{return await e(O.caller,O.id)}catch($){throw $}},[t,e]),d=g.useCallback(async(A,T,_)=>{const P=`api/admin/projects/${A}/features/${T}/environments/${_}/off`,I=t(P,{method:"POST"},"toggleFeatureEnvironmentOff");try{return await e(I.caller,I.id)}catch(O){throw O}},[t,e]);return{validateFeatureToggleName:o,validateConstraint:i,createFeatureToggle:a,changeFeatureProject:async(A,T,_)=>{const P=`api/admin/projects/${A}/features/${T}/changeProject`,I=t(P,{method:"POST",body:JSON.stringify({newProjectId:_})});try{return await e(I.caller,I.id)}catch(O){throw O}},errors:n,toggleFeatureEnvironmentOn:l,toggleFeatureEnvironmentOff:d,addTagToFeature:async(A,T)=>{const _=`api/admin/features/${A}/tags`,P=t(_,{method:"POST",body:JSON.stringify({...T})});try{return await e(P.caller,P.id)}catch(I){throw I}},deleteTagFromFeature:async(A,T,_)=>{const P=`${encodeURIComponent(T)}/${encodeURIComponent(_)}`,I=`api/admin/features/${A}/tags/${P}`,O=t(I,{method:"DELETE"});try{return await e(O.caller,O.id)}catch($){throw $}},updateFeatureTags:async(A,T)=>{const _=`api/admin/features/${A}/tags`,P=t(_,{method:"PUT",body:JSON.stringify({...T})});try{return await e(P.caller,P.id)}catch(I){throw I}},archiveFeatureToggle:async(A,T)=>{const _=`api/admin/projects/${A}/features/${T}`,P=t(_,{method:"DELETE"});try{return await e(P.caller,P.id)}catch(I){throw I}},patchFeatureToggle:async(A,T,_)=>{const P=`api/admin/projects/${A}/features/${T}`,I=t(P,{method:"PATCH",body:JSON.stringify(_)});try{return await e(I.caller,I.id)}catch(O){throw O}},patchFeatureVariants:async(A,T,_)=>{const P=`api/admin/projects/${A}/features/${T}/variants`,I=t(P,{method:"PATCH",body:JSON.stringify(_)});try{return await e(I.caller,I.id)}catch(O){throw O}},patchFeatureEnvironmentVariants:async(A,T,_,P)=>{const I=`api/admin/projects/${A}/features/${T}/environments/${_}/variants`,O=t(I,{method:"PATCH",body:JSON.stringify(P)});try{return await e(O.caller,O.id)}catch($){throw $}},overrideVariantsInEnvironments:async(A,T,_,P)=>{const I=`api/admin/projects/${A}/features/${T}/variants-batch`,O=t(I,{method:"PUT",body:JSON.stringify({variants:_,environments:P})});try{return await e(O.caller,O.id)}catch($){throw $}},cloneFeatureToggle:async(A,T,_)=>{const P=`api/admin/projects/${A}/features/${T}/clone`,I=t(P,{method:"POST",body:JSON.stringify(_)});try{return await e(I.caller,I.id)}catch(O){throw O}},loading:r,bulkToggleFeaturesEnvironmentOn:c,bulkToggleFeaturesEnvironmentOff:u}};var uC={exports:{}};const m2e="2.0.0",cB=256,y2e=Number.MAX_SAFE_INTEGER||9007199254740991,v2e=16,b2e=cB-6,w2e=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var i0={MAX_LENGTH:cB,MAX_SAFE_COMPONENT_LENGTH:v2e,MAX_SAFE_BUILD_LENGTH:b2e,MAX_SAFE_INTEGER:y2e,RELEASE_TYPES:w2e,SEMVER_SPEC_VERSION:m2e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const S2e=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var a0=S2e;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=i0,i=a0;t=e.exports={};const a=t.re=[],l=t.safeRe=[],c=t.src=[],u=t.t={};let d=0;const p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",o],[p,r]],h=y=>{for(const[b,v]of f)y=y.split(`${b}*`).join(`${b}{0,${v}}`).split(`${b}+`).join(`${b}{1,${v}}`);return y},m=(y,b,v)=>{const w=h(b),C=d++;i(y,C,b),u[y]=C,c[C]=b,a[C]=new RegExp(b,v?"g":void 0),l[C]=new RegExp(w,v?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),m("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),m("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${p}+`),m("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),m("FULL",`^${c[u.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),m("LOOSE",`^${c[u.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),m("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),m("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),m("COERCERTL",c[u.COERCE],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(uC,uC.exports);var hg=uC.exports;const x2e=Object.freeze({loose:!0}),C2e=Object.freeze({}),E2e=e=>e?typeof e!="object"?x2e:e:C2e;var gk=E2e;const rI=/^[0-9]+$/,uB=(e,t)=>{const n=rI.test(e),r=rI.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},T2e=(e,t)=>uB(t,e);var dB={compareIdentifiers:uB,rcompareIdentifiers:T2e};const Tm=a0,{MAX_LENGTH:oI,MAX_SAFE_INTEGER:km}=i0,{safeRe:iI,t:aI}=hg,k2e=gk,{compareIdentifiers:su}=dB;let A2e=class wa{constructor(t,n){if(n=k2e(n),t instanceof wa){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>oI)throw new TypeError(`version is longer than ${oI} characters`);Tm("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?iI[aI.LOOSE]:iI[aI.FULL]);if(!r)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>km||this.major<0)throw new TypeError("Invalid major version");if(this.minor>km||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>km||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){const i=+o;if(i>=0&&i<km)return i}return o}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Tm("SemVer.compare",this.version,this.options,t),!(t instanceof wa)){if(typeof t=="string"&&t===this.version)return 0;t=new wa(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof wa||(t=new wa(t,this.options)),su(this.major,t.major)||su(this.minor,t.minor)||su(this.patch,t.patch)}comparePre(t){if(t instanceof wa||(t=new wa(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],o=t.prerelease[n];if(Tm("prerelease compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return su(r,o)}while(++n)}compareBuild(t){t instanceof wa||(t=new wa(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(Tm("prerelease compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return su(r,o)}while(++n)}inc(t,n,r){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const o=Number(r)?1:0;if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let i=[n,o];r===!1&&(i=[n]),su(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Oo=A2e;const sI=Oo,R2e=(e,t,n=!1)=>{if(e instanceof sI)return e;try{return new sI(e,t)}catch(r){if(!n)return null;throw r}};var Kd=R2e;const _2e=Kd,P2e=(e,t)=>{const n=_2e(e,t);return n?n.version:null};var I2e=P2e;const O2e=Kd,$2e=(e,t)=>{const n=O2e(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var N2e=$2e;const lI=Oo,L2e=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new lI(e instanceof lI?e.version:e,n).inc(t,r,o).version}catch{return null}};var D2e=L2e;const cI=Kd,M2e=(e,t)=>{const n=cI(e,null,!0),r=cI(t,null,!0),o=n.compare(r);if(o===0)return null;const i=o>0,a=i?n:r,l=i?r:n,c=!!a.prerelease.length;if(!!l.prerelease.length&&!c)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";const d=c?"pre":"";return n.major!==r.major?d+"major":n.minor!==r.minor?d+"minor":n.patch!==r.patch?d+"patch":"prerelease"};var B2e=M2e;const F2e=Oo,z2e=(e,t)=>new F2e(e,t).major;var j2e=z2e;const U2e=Oo,W2e=(e,t)=>new U2e(e,t).minor;var H2e=W2e;const V2e=Oo,G2e=(e,t)=>new V2e(e,t).patch;var q2e=G2e;const K2e=Kd,Y2e=(e,t)=>{const n=K2e(e,t);return n&&n.prerelease.length?n.prerelease:null};var X2e=Y2e;const uI=Oo,J2e=(e,t,n)=>new uI(e,n).compare(new uI(t,n));var ma=J2e;const Q2e=ma,Z2e=(e,t,n)=>Q2e(t,e,n);var eEe=Z2e;const tEe=ma,nEe=(e,t)=>tEe(e,t,!0);var rEe=nEe;const dI=Oo,oEe=(e,t,n)=>{const r=new dI(e,n),o=new dI(t,n);return r.compare(o)||r.compareBuild(o)};var mk=oEe;const iEe=mk,aEe=(e,t)=>e.sort((n,r)=>iEe(n,r,t));var sEe=aEe;const lEe=mk,cEe=(e,t)=>e.sort((n,r)=>lEe(r,n,t));var uEe=cEe;const dEe=ma,pEe=(e,t,n)=>dEe(e,t,n)>0;var s0=pEe;const fEe=ma,hEe=(e,t,n)=>fEe(e,t,n)<0;var yk=hEe;const gEe=ma,mEe=(e,t,n)=>gEe(e,t,n)===0;var pB=mEe;const yEe=ma,vEe=(e,t,n)=>yEe(e,t,n)!==0;var fB=vEe;const bEe=ma,wEe=(e,t,n)=>bEe(e,t,n)>=0;var vk=wEe;const SEe=ma,xEe=(e,t,n)=>SEe(e,t,n)<=0;var bk=xEe;const CEe=pB,EEe=fB,TEe=s0,kEe=vk,AEe=yk,REe=bk,_Ee=(e,t,n,r)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return CEe(e,n,r);case"!=":return EEe(e,n,r);case">":return TEe(e,n,r);case">=":return kEe(e,n,r);case"<":return AEe(e,n,r);case"<=":return REe(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var hB=_Ee;const PEe=Oo,IEe=Kd,{safeRe:Am,t:Rm}=hg,OEe=(e,t)=>{if(e instanceof PEe)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let n=null;if(!t.rtl)n=e.match(Am[Rm.COERCE]);else{let r;for(;(r=Am[Rm.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)(!n||r.index+r[0].length!==n.index+n[0].length)&&(n=r),Am[Rm.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;Am[Rm.COERCERTL].lastIndex=-1}return n===null?null:IEe(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};var $Ee=OEe,Ow,pI;function NEe(){return pI||(pI=1,Ow=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),Ow}var LEe=Sn;Sn.Node=Rc;Sn.create=Sn;function Sn(e){var t=this;if(t instanceof Sn||(t=new Sn),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,r=arguments.length;n<r;n++)t.push(arguments[n]);return t}Sn.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t};Sn.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}};Sn.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}};Sn.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)MEe(this,arguments[e]);return this.length};Sn.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)BEe(this,arguments[e]);return this.length};Sn.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}};Sn.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}};Sn.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next};Sn.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev};Sn.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value};Sn.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value};Sn.prototype.map=function(e,t){t=t||this;for(var n=new Sn,r=this.head;r!==null;)n.push(e.call(t,r.value,this)),r=r.next;return n};Sn.prototype.mapReverse=function(e,t){t=t||this;for(var n=new Sn,r=this.tail;r!==null;)n.push(e.call(t,r.value,this)),r=r.prev;return n};Sn.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;r!==null;o++)n=e(n,r.value,o),r=r.next;return n};Sn.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;r!==null;o--)n=e(n,r.value,o),r=r.prev;return n};Sn.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e};Sn.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e};Sn.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var n=new Sn;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=0,o=this.head;o!==null&&r<e;r++)o=o.next;for(;o!==null&&r<t;r++,o=o.next)n.push(o.value);return n};Sn.prototype.sliceReverse=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var n=new Sn;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=this.length,o=this.tail;o!==null&&r>t;r--)o=o.prev;for(;o!==null&&r>e;r--,o=o.prev)n.push(o.value);return n};Sn.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,o=this.head;o!==null&&r<e;r++)o=o.next;for(var i=[],r=0;o&&r<t;r++)i.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var r=0;r<n.length;r++)o=DEe(this,o,n[r]);return i};Sn.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function DEe(e,t,n){var r=t===e.head?new Rc(n,null,t,e):new Rc(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function MEe(e,t){e.tail=new Rc(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function BEe(e,t){e.head=new Rc(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function Rc(e,t,n,r){if(!(this instanceof Rc))return new Rc(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{NEe()(Sn)}catch{}const FEe=LEe,nc=Symbol("max"),fs=Symbol("length"),lu=Symbol("lengthCalculator"),Df=Symbol("allowStale"),uc=Symbol("maxAge"),us=Symbol("dispose"),fI=Symbol("noDisposeOnSet"),Vr=Symbol("lruList"),Qi=Symbol("cache"),gB=Symbol("updateAgeOnGet"),$w=()=>1;class zEe{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");this[nc]=t.max||1/0;const n=t.length||$w;if(this[lu]=typeof n!="function"?$w:n,this[Df]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[uc]=t.maxAge||0,this[us]=t.dispose,this[fI]=t.noDisposeOnSet||!1,this[gB]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[nc]=t||1/0,zp(this)}get max(){return this[nc]}set allowStale(t){this[Df]=!!t}get allowStale(){return this[Df]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[uc]=t,zp(this)}get maxAge(){return this[uc]}set lengthCalculator(t){typeof t!="function"&&(t=$w),t!==this[lu]&&(this[lu]=t,this[fs]=0,this[Vr].forEach(n=>{n.length=this[lu](n.value,n.key),this[fs]+=n.length})),zp(this)}get lengthCalculator(){return this[lu]}get length(){return this[fs]}get itemCount(){return this[Vr].length}rforEach(t,n){n=n||this;for(let r=this[Vr].tail;r!==null;){const o=r.prev;hI(this,t,r,n),r=o}}forEach(t,n){n=n||this;for(let r=this[Vr].head;r!==null;){const o=r.next;hI(this,t,r,n),r=o}}keys(){return this[Vr].toArray().map(t=>t.key)}values(){return this[Vr].toArray().map(t=>t.value)}reset(){this[us]&&this[Vr]&&this[Vr].length&&this[Vr].forEach(t=>this[us](t.key,t.value)),this[Qi]=new Map,this[Vr]=new FEe,this[fs]=0}dump(){return this[Vr].map(t=>sv(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[Vr]}set(t,n,r){if(r=r||this[uc],r&&typeof r!="number")throw new TypeError("maxAge must be a number");const o=r?Date.now():0,i=this[lu](n,t);if(this[Qi].has(t)){if(i>this[nc])return Gu(this,this[Qi].get(t)),!1;const c=this[Qi].get(t).value;return this[us]&&(this[fI]||this[us](t,c.value)),c.now=o,c.maxAge=r,c.value=n,this[fs]+=i-c.length,c.length=i,this.get(t),zp(this),!0}const a=new jEe(t,n,i,o,r);return a.length>this[nc]?(this[us]&&this[us](t,n),!1):(this[fs]+=a.length,this[Vr].unshift(a),this[Qi].set(t,this[Vr].head),zp(this),!0)}has(t){if(!this[Qi].has(t))return!1;const n=this[Qi].get(t).value;return!sv(this,n)}get(t){return Nw(this,t,!0)}peek(t){return Nw(this,t,!1)}pop(){const t=this[Vr].tail;return t?(Gu(this,t),t.value):null}del(t){Gu(this,this[Qi].get(t))}load(t){this.reset();const n=Date.now();for(let r=t.length-1;r>=0;r--){const o=t[r],i=o.e||0;if(i===0)this.set(o.k,o.v);else{const a=i-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[Qi].forEach((t,n)=>Nw(this,n,!1))}}const Nw=(e,t,n)=>{const r=e[Qi].get(t);if(r){const o=r.value;if(sv(e,o)){if(Gu(e,r),!e[Df])return}else n&&(e[gB]&&(r.value.now=Date.now()),e[Vr].unshiftNode(r));return o.value}},sv=(e,t)=>{if(!t||!t.maxAge&&!e[uc])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[uc]&&n>e[uc]},zp=e=>{if(e[fs]>e[nc])for(let t=e[Vr].tail;e[fs]>e[nc]&&t!==null;){const n=t.prev;Gu(e,t),t=n}},Gu=(e,t)=>{if(t){const n=t.value;e[us]&&e[us](n.key,n.value),e[fs]-=n.length,e[Qi].delete(n.key),e[Vr].removeNode(t)}};class jEe{constructor(t,n,r,o,i){this.key=t,this.value=n,this.length=r,this.now=o,this.maxAge=i||0}}const hI=(e,t,n,r)=>{let o=n.value;sv(e,o)&&(Gu(e,n),e[Df]||(o=void 0)),o&&t.call(r,o.value,o.key,e)};var UEe=zEe,Lw,gI;function ya(){if(gI)return Lw;gI=1;class e{constructor(B,q){if(q=r(q),B instanceof e)return B.loose===!!q.loose&&B.includePrerelease===!!q.includePrerelease?B:new e(B.raw,q);if(B instanceof o)return this.raw=B.value,this.set=[[B]],this.format(),this;if(this.options=q,this.loose=!!q.loose,this.includePrerelease=!!q.includePrerelease,this.raw=B.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(Y=>this.parseRange(Y.trim())).filter(Y=>Y.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const Y=this.set[0];if(this.set=this.set.filter(te=>!m(te[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const te of this.set)if(te.length===1&&y(te[0])){this.set=[te];break}}}this.format()}format(){return this.range=this.set.map(B=>B.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(B){const Y=((this.options.includePrerelease&&f)|(this.options.loose&&h))+":"+B,te=n.get(Y);if(te)return te;const H=this.options.loose,j=H?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];B=B.replace(j,$(this.options.includePrerelease)),i("hyphen replace",B),B=B.replace(l[c.COMPARATORTRIM],u),i("comparator trim",B),B=B.replace(l[c.TILDETRIM],d),i("tilde trim",B),B=B.replace(l[c.CARETTRIM],p),i("caret trim",B);let U=B.split(" ").map(se=>v(se,this.options)).join(" ").split(/\s+/).map(se=>O(se,this.options));H&&(U=U.filter(se=>(i("loose invalid filter",se,this.options),!!se.match(l[c.COMPARATORLOOSE])))),i("range list",U);const R=new Map,N=U.map(se=>new o(se,this.options));for(const se of N){if(m(se))return[se];R.set(se.value,se)}R.size>1&&R.has("")&&R.delete("");const X=[...R.values()];return n.set(Y,X),X}intersects(B,q){if(!(B instanceof e))throw new TypeError("a Range is required");return this.set.some(Y=>b(Y,q)&&B.set.some(te=>b(te,q)&&Y.every(H=>te.every(j=>H.intersects(j,q)))))}test(B){if(!B)return!1;if(typeof B=="string")try{B=new a(B,this.options)}catch{return!1}for(let q=0;q<this.set.length;q++)if(F(this.set[q],B,this.options))return!0;return!1}}Lw=e;const t=UEe,n=new t({max:1e3}),r=gk,o=l0(),i=a0,a=Oo,{safeRe:l,t:c,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:p}=hg,{FLAG_INCLUDE_PRERELEASE:f,FLAG_LOOSE:h}=i0,m=D=>D.value==="<0.0.0-0",y=D=>D.value==="",b=(D,B)=>{let q=!0;const Y=D.slice();let te=Y.pop();for(;q&&Y.length;)q=Y.every(H=>te.intersects(H,B)),te=Y.pop();return q},v=(D,B)=>(i("comp",D,B),D=A(D,B),i("caret",D),D=C(D,B),i("tildes",D),D=_(D,B),i("xrange",D),D=I(D,B),i("stars",D),D),w=D=>!D||D.toLowerCase()==="x"||D==="*",C=(D,B)=>D.trim().split(/\s+/).map(q=>k(q,B)).join(" "),k=(D,B)=>{const q=B.loose?l[c.TILDELOOSE]:l[c.TILDE];return D.replace(q,(Y,te,H,j,U)=>{i("tilde",D,Y,te,H,j,U);let R;return w(te)?R="":w(H)?R=`>=${te}.0.0 <${+te+1}.0.0-0`:w(j)?R=`>=${te}.${H}.0 <${te}.${+H+1}.0-0`:U?(i("replaceTilde pr",U),R=`>=${te}.${H}.${j}-${U} <${te}.${+H+1}.0-0`):R=`>=${te}.${H}.${j} <${te}.${+H+1}.0-0`,i("tilde return",R),R})},A=(D,B)=>D.trim().split(/\s+/).map(q=>T(q,B)).join(" "),T=(D,B)=>{i("caret",D,B);const q=B.loose?l[c.CARETLOOSE]:l[c.CARET],Y=B.includePrerelease?"-0":"";return D.replace(q,(te,H,j,U,R)=>{i("caret",D,te,H,j,U,R);let N;return w(H)?N="":w(j)?N=`>=${H}.0.0${Y} <${+H+1}.0.0-0`:w(U)?H==="0"?N=`>=${H}.${j}.0${Y} <${H}.${+j+1}.0-0`:N=`>=${H}.${j}.0${Y} <${+H+1}.0.0-0`:R?(i("replaceCaret pr",R),H==="0"?j==="0"?N=`>=${H}.${j}.${U}-${R} <${H}.${j}.${+U+1}-0`:N=`>=${H}.${j}.${U}-${R} <${H}.${+j+1}.0-0`:N=`>=${H}.${j}.${U}-${R} <${+H+1}.0.0-0`):(i("no pr"),H==="0"?j==="0"?N=`>=${H}.${j}.${U}${Y} <${H}.${j}.${+U+1}-0`:N=`>=${H}.${j}.${U}${Y} <${H}.${+j+1}.0-0`:N=`>=${H}.${j}.${U} <${+H+1}.0.0-0`),i("caret return",N),N})},_=(D,B)=>(i("replaceXRanges",D,B),D.split(/\s+/).map(q=>P(q,B)).join(" ")),P=(D,B)=>{D=D.trim();const q=B.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return D.replace(q,(Y,te,H,j,U,R)=>{i("xRange",D,Y,te,H,j,U,R);const N=w(H),X=N||w(j),se=X||w(U),we=se;return te==="="&&we&&(te=""),R=B.includePrerelease?"-0":"",N?te===">"||te==="<"?Y="<0.0.0-0":Y="*":te&&we?(X&&(j=0),U=0,te===">"?(te=">=",X?(H=+H+1,j=0,U=0):(j=+j+1,U=0)):te==="<="&&(te="<",X?H=+H+1:j=+j+1),te==="<"&&(R="-0"),Y=`${te+H}.${j}.${U}${R}`):X?Y=`>=${H}.0.0${R} <${+H+1}.0.0-0`:se&&(Y=`>=${H}.${j}.0${R} <${H}.${+j+1}.0-0`),i("xRange return",Y),Y})},I=(D,B)=>(i("replaceStars",D,B),D.trim().replace(l[c.STAR],"")),O=(D,B)=>(i("replaceGTE0",D,B),D.trim().replace(l[B.includePrerelease?c.GTE0PRE:c.GTE0],"")),$=D=>(B,q,Y,te,H,j,U,R,N,X,se,we,ge)=>(w(Y)?q="":w(te)?q=`>=${Y}.0.0${D?"-0":""}`:w(H)?q=`>=${Y}.${te}.0${D?"-0":""}`:j?q=`>=${q}`:q=`>=${q}${D?"-0":""}`,w(N)?R="":w(X)?R=`<${+N+1}.0.0-0`:w(se)?R=`<${N}.${+X+1}.0-0`:we?R=`<=${N}.${X}.${se}-${we}`:D?R=`<${N}.${X}.${+se+1}-0`:R=`<=${R}`,`${q} ${R}`.trim()),F=(D,B,q)=>{for(let Y=0;Y<D.length;Y++)if(!D[Y].test(B))return!1;if(B.prerelease.length&&!q.includePrerelease){for(let Y=0;Y<D.length;Y++)if(i(D[Y].semver),D[Y].semver!==o.ANY&&D[Y].semver.prerelease.length>0){const te=D[Y].semver;if(te.major===B.major&&te.minor===B.minor&&te.patch===B.patch)return!0}return!1}return!0};return Lw}var Dw,mI;function l0(){if(mI)return Dw;mI=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(d,p){if(p=n(p),d instanceof t){if(d.loose===!!p.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),a("comparator",d,p),this.options=p,this.loose=!!p.loose,this.parse(d),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(d){const p=this.options.loose?r[o.COMPARATORLOOSE]:r[o.COMPARATOR],f=d.match(p);if(!f)throw new TypeError(`Invalid comparator: ${d}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new l(f[2],this.options.loose):this.semver=e}toString(){return this.value}test(d){if(a("Comparator.test",d,this.options.loose),this.semver===e||d===e)return!0;if(typeof d=="string")try{d=new l(d,this.options)}catch{return!1}return i(d,this.operator,this.semver,this.options)}intersects(d,p){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,p).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,p).test(d.semver):(p=n(p),p.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!p.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||i(this.semver,"<",d.semver,p)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||i(this.semver,">",d.semver,p)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}Dw=t;const n=gk,{safeRe:r,t:o}=hg,i=hB,a=a0,l=Oo,c=ya();return Dw}const WEe=ya(),HEe=(e,t,n)=>{try{t=new WEe(t,n)}catch{return!1}return t.test(e)};var c0=HEe;const VEe=ya(),GEe=(e,t)=>new VEe(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var qEe=GEe;const KEe=Oo,YEe=ya(),XEe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new YEe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===-1)&&(r=a,o=new KEe(r,n))}),r};var JEe=XEe;const QEe=Oo,ZEe=ya(),eTe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new ZEe(t,n)}catch{return null}return e.forEach(a=>{i.test(a)&&(!r||o.compare(a)===1)&&(r=a,o=new QEe(r,n))}),r};var tTe=eTe;const Mw=Oo,nTe=ya(),yI=s0,rTe=(e,t)=>{e=new nTe(e,t);let n=new Mw("0.0.0");if(e.test(n)||(n=new Mw("0.0.0-0"),e.test(n)))return n;n=null;for(let r=0;r<e.set.length;++r){const o=e.set[r];let i=null;o.forEach(a=>{const l=new Mw(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!i||yI(l,i))&&(i=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!n||yI(n,i))&&(n=i)}return n&&e.test(n)?n:null};var oTe=rTe;const iTe=ya(),aTe=(e,t)=>{try{return new iTe(e,t).range||"*"}catch{return null}};var sTe=aTe;const lTe=Oo,mB=l0(),{ANY:cTe}=mB,uTe=ya(),dTe=c0,vI=s0,bI=yk,pTe=bk,fTe=vk,hTe=(e,t,n,r)=>{e=new lTe(e,r),t=new uTe(t,r);let o,i,a,l,c;switch(n){case">":o=vI,i=pTe,a=bI,l=">",c=">=";break;case"<":o=bI,i=fTe,a=vI,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(dTe(e,t,r))return!1;for(let u=0;u<t.set.length;++u){const d=t.set[u];let p=null,f=null;if(d.forEach(h=>{h.semver===cTe&&(h=new mB(">=0.0.0")),p=p||h,f=f||h,o(h.semver,p.semver,r)?p=h:a(h.semver,f.semver,r)&&(f=h)}),p.operator===l||p.operator===c||(!f.operator||f.operator===l)&&i(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};var wk=hTe;const gTe=wk,mTe=(e,t,n)=>gTe(e,t,">",n);var yTe=mTe;const vTe=wk,bTe=(e,t,n)=>vTe(e,t,"<",n);var wTe=bTe;const wI=ya(),STe=(e,t,n)=>(e=new wI(e,n),t=new wI(t,n),e.intersects(t,n));var xTe=STe;const CTe=c0,ETe=ma;var TTe=(e,t,n)=>{const r=[];let o=null,i=null;const a=e.sort((d,p)=>ETe(d,p,n));for(const d of a)CTe(d,t,n)?(i=d,o||(o=d)):(i&&r.push([o,i]),i=null,o=null);o&&r.push([o,null]);const l=[];for(const[d,p]of r)d===p?l.push(d):!p&&d===a[0]?l.push("*"):p?d===a[0]?l.push(`<=${p}`):l.push(`${d} - ${p}`):l.push(`>=${d}`);const c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t};const SI=ya(),Sk=l0(),{ANY:Bw}=Sk,jp=c0,xk=ma,kTe=(e,t,n={})=>{if(e===t)return!0;e=new SI(e,n),t=new SI(t,n);let r=!1;e:for(const o of e.set){for(const i of t.set){const a=RTe(o,i,n);if(r=r||a!==null,a)continue e}if(r)return!1}return!0},ATe=[new Sk(">=0.0.0-0")],xI=[new Sk(">=0.0.0")],RTe=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Bw){if(t.length===1&&t[0].semver===Bw)return!0;n.includePrerelease?e=ATe:e=xI}if(t.length===1&&t[0].semver===Bw){if(n.includePrerelease)return!0;t=xI}const r=new Set;let o,i;for(const h of e)h.operator===">"||h.operator===">="?o=CI(o,h,n):h.operator==="<"||h.operator==="<="?i=EI(i,h,n):r.add(h.semver);if(r.size>1)return null;let a;if(o&&i){if(a=xk(o.semver,i.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||i.operator!=="<="))return null}for(const h of r){if(o&&!jp(h,String(o),n)||i&&!jp(h,String(i),n))return null;for(const m of t)if(!jp(h,String(m),n))return!1;return!0}let l,c,u,d,p=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(const h of t){if(d=d||h.operator===">"||h.operator===">=",u=u||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(l=CI(o,h,n),l===h&&l!==o)return!1}else if(o.operator===">="&&!jp(o.semver,String(h),n))return!1}if(i){if(p&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===p.major&&h.semver.minor===p.minor&&h.semver.patch===p.patch&&(p=!1),h.operator==="<"||h.operator==="<="){if(c=EI(i,h,n),c===h&&c!==i)return!1}else if(i.operator==="<="&&!jp(i.semver,String(h),n))return!1}if(!h.operator&&(i||o)&&a!==0)return!1}return!(o&&u&&!i&&a!==0||i&&d&&!o&&a!==0||f||p)},CI=(e,t,n)=>{if(!e)return t;const r=xk(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},EI=(e,t,n)=>{if(!e)return t;const r=xk(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var _Te=kTe;const Fw=hg,TI=i0,PTe=Oo,kI=dB,ITe=Kd,OTe=I2e,$Te=N2e,NTe=D2e,LTe=B2e,DTe=j2e,MTe=H2e,BTe=q2e,FTe=X2e,zTe=ma,jTe=eEe,UTe=rEe,WTe=mk,HTe=sEe,VTe=uEe,GTe=s0,qTe=yk,KTe=pB,YTe=fB,XTe=vk,JTe=bk,QTe=hB,ZTe=$Ee,eke=l0(),tke=ya(),nke=c0,rke=qEe,oke=JEe,ike=tTe,ake=oTe,ske=sTe,lke=wk,cke=yTe,uke=wTe,dke=xTe,pke=TTe,fke=_Te;var hke={parse:ITe,valid:OTe,clean:$Te,inc:NTe,diff:LTe,major:DTe,minor:MTe,patch:BTe,prerelease:FTe,compare:zTe,rcompare:jTe,compareLoose:UTe,compareBuild:WTe,sort:HTe,rsort:VTe,gt:GTe,lt:qTe,eq:KTe,neq:YTe,gte:XTe,lte:JTe,cmp:QTe,coerce:ZTe,Comparator:eke,Range:tke,satisfies:nke,toComparators:rke,maxSatisfying:oke,minSatisfying:ike,minVersion:ake,validRange:ske,outside:lke,gtr:cke,ltr:uke,intersects:dke,simplifyRange:pke,subset:fke,SemVer:PTe,re:Fw.re,src:Fw.src,tokens:Fw.t,SEMVER_SPEC_VERSION:TI.SEMVER_SPEC_VERSION,RELEASE_TYPES:TI.RELEASE_TYPES,compareIdentifiers:kI.compareIdentifiers,rcompareIdentifiers:kI.rcompareIdentifiers};const AI=Yr(hke),gke=e=>()=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?[!1,"Value must be a number"]:[!0,""]},mke=e=>()=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},yke=e=>()=>{const t=AI.clean(e)===e;return!AI.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},vke=e=>()=>dT(ig(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],_m=e=>!!e&&Array.isArray(e)&&e.length>0,dC="IN_OPERATORS_LEGAL_VALUES",yB="STRING_OPERATORS_LEGAL_VALUES",vB="NUM_OPERATORS_LEGAL_VALUES",bB="SEMVER_OPERATORS_LEGAL_VALUES",wB="DATE_OPERATORS_SINGLE_VALUE",SB="IN_OPERATORS_FREETEXT",xB="STRING_OPERATORS_FREETEXT",CB="NUM_OPERATORS_SINGLE_VALUE",EB="SEMVER_OPERATORS_SINGLE_VALUE",RI="NUMBER_VALIDATOR",_I="SEMVER_VALIDATOR",zw="STRING_ARRAY_VALIDATOR",PI="DATE_VALIDATOR",bke=({contextDefinition:e,localConstraint:t})=>{const[n,r]=g.useState(dC),[o,i]=g.useState(zw),[a,l]=g.useState(""),c=g.useCallback(()=>{_m(e.legalValues)&&Mn(hc,t.operator)?r(dC):_m(e.legalValues)&&Mn(Ss,t.operator)?r(yB):_m(e.legalValues)&&Mn(Hu,t.operator)?r(vB):_m(e.legalValues)&&Mn(Vu,t.operator)?r(bB):Mn(Ii,t.operator)?r(wB):Mn(hc,t.operator)?r(SB):Mn(Ss,t.operator)?r(xB):Mn(Hu,t.operator)?r(CB):Mn(Vu,t.operator)&&r(EB)},[t,e]),u=()=>{switch(o){case RI:return gke(t.value);case zw:return mke(t.values||[]);case _I:return yke(t.value||"");case PI:return vke(t.value||"")}},d=g.useCallback(p=>{Mn(Hu,p)&&i(RI),Mn([...Ss,...hc],p)&&i(zw),Mn(Vu,p)&&i(_I),Mn(Ii,p)&&i(PI)},[i]);return g.useEffect(()=>{d(t.operator)},[t.operator,t.value,t.values,d]),g.useEffect(()=>{c()},[e,t,c]),{input:n,error:a,validator:u(),setError:l}},wke=x("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),gg=({children:e,...t})=>s(wke,{...t,children:e});function II(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Rh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?II(Object(n),!0).forEach(function(r){u0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):II(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function u0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ske(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function xke(e,t){if(e==null)return{};var n=Ske(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Cke(e,t){return Eke(e)||Tke(e,t)||kke(e,t)||Ake()}function Eke(e){if(Array.isArray(e))return e}function Tke(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,a,l;try{for(n=n.call(e);!(o=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));o=!0);}catch(c){i=!0,l=c}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw l}}return r}}function kke(e,t){if(e){if(typeof e=="string")return OI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OI(e,t)}}function OI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ake(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
315
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Rke={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestine",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Türkiye",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands (UK)",VI:"Virgin Islands (US)",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},_ke={"Africa/Abidjan":{u:0,c:["CI","BF","GH","GM","GN","IS","ML","MR","SH","SL","SN","TG"]},"Africa/Accra":{a:"Africa/Abidjan",c:["GH"],r:1},"Africa/Addis_Ababa":{a:"Africa/Nairobi",c:["ET"],r:1},"Africa/Algiers":{u:60,c:["DZ"]},"Africa/Asmara":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Asmera":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Bamako":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Bangui":{a:"Africa/Lagos",c:["CF"],r:1},"Africa/Banjul":{a:"Africa/Abidjan",c:["GM"],r:1},"Africa/Bissau":{u:0,c:["GW"]},"Africa/Blantyre":{a:"Africa/Maputo",c:["MW"],r:1},"Africa/Brazzaville":{a:"Africa/Lagos",c:["CG"],r:1},"Africa/Bujumbura":{a:"Africa/Maputo",c:["BI"],r:1},"Africa/Cairo":{u:120,d:180,c:["EG"]},"Africa/Casablanca":{u:60,d:0,c:["MA"]},"Africa/Ceuta":{u:60,d:120,c:["ES"]},"Africa/Conakry":{a:"Africa/Abidjan",c:["GN"],r:1},"Africa/Dakar":{a:"Africa/Abidjan",c:["SN"],r:1},"Africa/Dar_es_Salaam":{a:"Africa/Nairobi",c:["TZ"],r:1},"Africa/Djibouti":{a:"Africa/Nairobi",c:["DJ"],r:1},"Africa/Douala":{a:"Africa/Lagos",c:["CM"],r:1},"Africa/El_Aaiun":{u:60,d:0,c:["EH"]},"Africa/Freetown":{a:"Africa/Abidjan",c:["SL"],r:1},"Africa/Gaborone":{a:"Africa/Maputo",c:["BW"],r:1},"Africa/Harare":{a:"Africa/Maputo",c:["ZW"],r:1},"Africa/Johannesburg":{u:120,c:["ZA","LS","SZ"]},"Africa/Juba":{u:120,c:["SS"]},"Africa/Kampala":{a:"Africa/Nairobi",c:["UG"],r:1},"Africa/Khartoum":{u:120,c:["SD"]},"Africa/Kigali":{a:"Africa/Maputo",c:["RW"],r:1},"Africa/Kinshasa":{a:"Africa/Lagos",c:["CD"],r:1},"Africa/Lagos":{u:60,c:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"Africa/Libreville":{a:"Africa/Lagos",c:["GA"],r:1},"Africa/Lome":{a:"Africa/Abidjan",c:["TG"],r:1},"Africa/Luanda":{a:"Africa/Lagos",c:["AO"],r:1},"Africa/Lubumbashi":{a:"Africa/Maputo",c:["CD"],r:1},"Africa/Lusaka":{a:"Africa/Maputo",c:["ZM"],r:1},"Africa/Malabo":{a:"Africa/Lagos",c:["GQ"],r:1},"Africa/Maputo":{u:120,c:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Maseru":{a:"Africa/Johannesburg",c:["LS"],r:1},"Africa/Mbabane":{a:"Africa/Johannesburg",c:["SZ"],r:1},"Africa/Mogadishu":{a:"Africa/Nairobi",c:["SO"],r:1},"Africa/Monrovia":{u:0,c:["LR"]},"Africa/Nairobi":{u:180,c:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Africa/Ndjamena":{u:60,c:["TD"]},"Africa/Niamey":{a:"Africa/Lagos",c:["NE"],r:1},"Africa/Nouakchott":{a:"Africa/Abidjan",c:["MR"],r:1},"Africa/Ouagadougou":{a:"Africa/Abidjan",c:["BF"],r:1},"Africa/Porto-Novo":{a:"Africa/Lagos",c:["BJ"],r:1},"Africa/Sao_Tome":{u:0,c:["ST"]},"Africa/Timbuktu":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Tripoli":{u:120,c:["LY"]},"Africa/Tunis":{u:60,c:["TN"]},"Africa/Windhoek":{u:120,c:["NA"]},"America/Adak":{u:-600,d:-540,c:["US"]},"America/Anchorage":{u:-540,d:-480,c:["US"]},"America/Anguilla":{a:"America/Puerto_Rico",c:["AI"],r:1},"America/Antigua":{a:"America/Puerto_Rico",c:["AG"],r:1},"America/Araguaina":{u:-180,c:["BR"]},"America/Argentina/Buenos_Aires":{u:-180,c:["AR"]},"America/Argentina/Catamarca":{u:-180,c:["AR"]},"America/Argentina/ComodRivadavia":{a:"America/Argentina/Catamarca",r:1},"America/Argentina/Cordoba":{u:-180,c:["AR"]},"America/Argentina/Jujuy":{u:-180,c:["AR"]},"America/Argentina/La_Rioja":{u:-180,c:["AR"]},"America/Argentina/Mendoza":{u:-180,c:["AR"]},"America/Argentina/Rio_Gallegos":{u:-180,c:["AR"]},"America/Argentina/Salta":{u:-180,c:["AR"]},"America/Argentina/San_Juan":{u:-180,c:["AR"]},"America/Argentina/San_Luis":{u:-180,c:["AR"]},"America/Argentina/Tucuman":{u:-180,c:["AR"]},"America/Argentina/Ushuaia":{u:-180,c:["AR"]},"America/Aruba":{a:"America/Puerto_Rico",c:["AW"],r:1},"America/Asuncion":{u:-240,d:-180,c:["PY"]},"America/Atikokan":{a:"America/Panama",c:["CA"],r:1},"America/Atka":{a:"America/Adak",r:1},"America/Bahia":{u:-180,c:["BR"]},"America/Bahia_Banderas":{u:-360,c:["MX"]},"America/Barbados":{u:-240,c:["BB"]},"America/Belem":{u:-180,c:["BR"]},"America/Belize":{u:-360,c:["BZ"]},"America/Blanc-Sablon":{a:"America/Puerto_Rico",c:["CA"],r:1},"America/Boa_Vista":{u:-240,c:["BR"]},"America/Bogota":{u:-300,c:["CO"]},"America/Boise":{u:-420,d:-360,c:["US"]},"America/Buenos_Aires":{a:"America/Argentina/Buenos_Aires",r:1},"America/Cambridge_Bay":{u:-420,d:-360,c:["CA"]},"America/Campo_Grande":{u:-240,c:["BR"]},"America/Cancun":{u:-300,c:["MX"]},"America/Caracas":{u:-240,c:["VE"]},"America/Catamarca":{a:"America/Argentina/Catamarca",r:1},"America/Cayenne":{u:-180,c:["GF"]},"America/Cayman":{a:"America/Panama",c:["KY"],r:1},"America/Chicago":{u:-360,d:-300,c:["US"]},"America/Chihuahua":{u:-360,c:["MX"]},"America/Ciudad_Juarez":{u:-420,d:-360,c:["MX"]},"America/Coral_Harbour":{a:"America/Panama",c:["CA"],r:1},"America/Cordoba":{a:"America/Argentina/Cordoba",r:1},"America/Costa_Rica":{u:-360,c:["CR"]},"America/Creston":{a:"America/Phoenix",c:["CA"],r:1},"America/Cuiaba":{u:-240,c:["BR"]},"America/Curacao":{a:"America/Puerto_Rico",c:["CW"],r:1},"America/Danmarkshavn":{u:0,c:["GL"]},"America/Dawson":{u:-420,c:["CA"]},"America/Dawson_Creek":{u:-420,c:["CA"]},"America/Denver":{u:-420,d:-360,c:["US"]},"America/Detroit":{u:-300,d:-240,c:["US"]},"America/Dominica":{a:"America/Puerto_Rico",c:["DM"],r:1},"America/Edmonton":{u:-420,d:-360,c:["CA"]},"America/Eirunepe":{u:-300,c:["BR"]},"America/El_Salvador":{u:-360,c:["SV"]},"America/Ensenada":{a:"America/Tijuana",r:1},"America/Fort_Nelson":{u:-420,c:["CA"]},"America/Fort_Wayne":{a:"America/Indiana/Indianapolis",r:1},"America/Fortaleza":{u:-180,c:["BR"]},"America/Glace_Bay":{u:-240,d:-180,c:["CA"]},"America/Godthab":{a:"America/Nuuk",r:1},"America/Goose_Bay":{u:-240,d:-180,c:["CA"]},"America/Grand_Turk":{u:-300,d:-240,c:["TC"]},"America/Grenada":{a:"America/Puerto_Rico",c:["GD"],r:1},"America/Guadeloupe":{a:"America/Puerto_Rico",c:["GP"],r:1},"America/Guatemala":{u:-360,c:["GT"]},"America/Guayaquil":{u:-300,c:["EC"]},"America/Guyana":{u:-240,c:["GY"]},"America/Halifax":{u:-240,d:-180,c:["CA"]},"America/Havana":{u:-300,d:-240,c:["CU"]},"America/Hermosillo":{u:-420,c:["MX"]},"America/Indiana/Indianapolis":{u:-300,d:-240,c:["US"]},"America/Indiana/Knox":{u:-360,d:-300,c:["US"]},"America/Indiana/Marengo":{u:-300,d:-240,c:["US"]},"America/Indiana/Petersburg":{u:-300,d:-240,c:["US"]},"America/Indiana/Tell_City":{u:-360,d:-300,c:["US"]},"America/Indiana/Vevay":{u:-300,d:-240,c:["US"]},"America/Indiana/Vincennes":{u:-300,d:-240,c:["US"]},"America/Indiana/Winamac":{u:-300,d:-240,c:["US"]},"America/Indianapolis":{a:"America/Indiana/Indianapolis",r:1},"America/Inuvik":{u:-420,d:-360,c:["CA"]},"America/Iqaluit":{u:-300,d:-240,c:["CA"]},"America/Jamaica":{u:-300,c:["JM"]},"America/Jujuy":{a:"America/Argentina/Jujuy",r:1},"America/Juneau":{u:-540,d:-480,c:["US"]},"America/Kentucky/Louisville":{u:-300,d:-240,c:["US"]},"America/Kentucky/Monticello":{u:-300,d:-240,c:["US"]},"America/Knox_IN":{a:"America/Indiana/Knox",r:1},"America/Kralendijk":{a:"America/Puerto_Rico",c:["BQ"],r:1},"America/La_Paz":{u:-240,c:["BO"]},"America/Lima":{u:-300,c:["PE"]},"America/Los_Angeles":{u:-480,d:-420,c:["US"]},"America/Louisville":{a:"America/Kentucky/Louisville",r:1},"America/Lower_Princes":{a:"America/Puerto_Rico",c:["SX"],r:1},"America/Maceio":{u:-180,c:["BR"]},"America/Managua":{u:-360,c:["NI"]},"America/Manaus":{u:-240,c:["BR"]},"America/Marigot":{a:"America/Puerto_Rico",c:["MF"],r:1},"America/Martinique":{u:-240,c:["MQ"]},"America/Matamoros":{u:-360,d:-300,c:["MX"]},"America/Mazatlan":{u:-420,c:["MX"]},"America/Mendoza":{a:"America/Argentina/Mendoza",r:1},"America/Menominee":{u:-360,d:-300,c:["US"]},"America/Merida":{u:-360,c:["MX"]},"America/Metlakatla":{u:-540,d:-480,c:["US"]},"America/Mexico_City":{u:-360,c:["MX"]},"America/Miquelon":{u:-180,d:-120,c:["PM"]},"America/Moncton":{u:-240,d:-180,c:["CA"]},"America/Monterrey":{u:-360,c:["MX"]},"America/Montevideo":{u:-180,c:["UY"]},"America/Montreal":{a:"America/Toronto",c:["CA"],r:1},"America/Montserrat":{a:"America/Puerto_Rico",c:["MS"],r:1},"America/Nassau":{a:"America/Toronto",c:["BS"],r:1},"America/New_York":{u:-300,d:-240,c:["US"]},"America/Nipigon":{a:"America/Toronto",c:["CA"],r:1},"America/Nome":{u:-540,d:-480,c:["US"]},"America/Noronha":{u:-120,c:["BR"]},"America/North_Dakota/Beulah":{u:-360,d:-300,c:["US"]},"America/North_Dakota/Center":{u:-360,d:-300,c:["US"]},"America/North_Dakota/New_Salem":{u:-360,d:-300,c:["US"]},"America/Nuuk":{u:-120,c:["GL"]},"America/Ojinaga":{u:-360,d:-300,c:["MX"]},"America/Panama":{u:-300,c:["PA","CA","KY"]},"America/Pangnirtung":{a:"America/Iqaluit",r:1},"America/Paramaribo":{u:-180,c:["SR"]},"America/Phoenix":{u:-420,c:["US","CA"]},"America/Port-au-Prince":{u:-300,d:-240,c:["HT"]},"America/Port_of_Spain":{a:"America/Puerto_Rico",c:["TT"],r:1},"America/Porto_Acre":{a:"America/Rio_Branco",r:1},"America/Porto_Velho":{u:-240,c:["BR"]},"America/Puerto_Rico":{u:-240,c:["PR","AG","CA","AI","AW","BL","BQ","CW","DM","GD","GP","KN","LC","MF","MS","SX","TT","VC","VG","VI"]},"America/Punta_Arenas":{u:-180,c:["CL"]},"America/Rainy_River":{a:"America/Winnipeg",r:1},"America/Rankin_Inlet":{u:-360,d:-300,c:["CA"]},"America/Recife":{u:-180,c:["BR"]},"America/Regina":{u:-360,c:["CA"]},"America/Resolute":{u:-360,d:-300,c:["CA"]},"America/Rio_Branco":{u:-300,c:["BR"]},"America/Rosario":{a:"America/Argentina/Cordoba",r:1},"America/Santa_Isabel":{a:"America/Tijuana",r:1},"America/Santarem":{u:-180,c:["BR"]},"America/Santiago":{u:-240,d:-180,c:["CL"]},"America/Santo_Domingo":{u:-240,c:["DO"]},"America/Sao_Paulo":{u:-180,c:["BR"]},"America/Scoresbysund":{u:-60,d:0,c:["GL"]},"America/Shiprock":{a:"America/Denver",r:1},"America/Sitka":{u:-540,d:-480,c:["US"]},"America/St_Barthelemy":{a:"America/Puerto_Rico",c:["BL"],r:1},"America/St_Johns":{u:-210,d:-150,c:["CA"]},"America/St_Kitts":{a:"America/Puerto_Rico",c:["KN"],r:1},"America/St_Lucia":{a:"America/Puerto_Rico",c:["LC"],r:1},"America/St_Thomas":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/St_Vincent":{a:"America/Puerto_Rico",c:["VC"],r:1},"America/Swift_Current":{u:-360,c:["CA"]},"America/Tegucigalpa":{u:-360,c:["HN"]},"America/Thule":{u:-240,d:-180,c:["GL"]},"America/Thunder_Bay":{a:"America/Toronto",c:["CA"],r:1},"America/Tijuana":{u:-480,d:-420,c:["MX"]},"America/Toronto":{u:-300,d:-240,c:["CA","BS"]},"America/Tortola":{a:"America/Puerto_Rico",c:["VG"],r:1},"America/Vancouver":{u:-480,d:-420,c:["CA"]},"America/Virgin":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/Whitehorse":{u:-420,c:["CA"]},"America/Winnipeg":{u:-360,d:-300,c:["CA"]},"America/Yakutat":{u:-540,d:-480,c:["US"]},"America/Yellowknife":{a:"America/Edmonton",r:1},"Antarctica/Casey":{u:660,c:["AQ"]},"Antarctica/Davis":{u:420,c:["AQ"]},"Antarctica/DumontDUrville":{a:"Pacific/Port_Moresby",c:["AQ"],r:1},"Antarctica/Macquarie":{u:600,d:660,c:["AU"]},"Antarctica/Mawson":{u:300,c:["AQ"]},"Antarctica/McMurdo":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Palmer":{u:-180,c:["AQ"]},"Antarctica/Rothera":{u:-180,c:["AQ"]},"Antarctica/South_Pole":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Syowa":{a:"Asia/Riyadh",c:["AQ"],r:1},"Antarctica/Troll":{u:0,d:120,c:["AQ"]},"Antarctica/Vostok":{a:"Asia/Urumqi",c:["AQ"],r:1},"Arctic/Longyearbyen":{a:"Europe/Berlin",c:["SJ"],r:1},"Asia/Aden":{a:"Asia/Riyadh",c:["YE"],r:1},"Asia/Almaty":{u:360,c:["KZ"]},"Asia/Amman":{u:180,c:["JO"]},"Asia/Anadyr":{u:720,c:["RU"]},"Asia/Aqtau":{u:300,c:["KZ"]},"Asia/Aqtobe":{u:300,c:["KZ"]},"Asia/Ashgabat":{u:300,c:["TM"]},"Asia/Ashkhabad":{a:"Asia/Ashgabat",r:1},"Asia/Atyrau":{u:300,c:["KZ"]},"Asia/Baghdad":{u:180,c:["IQ"]},"Asia/Bahrain":{a:"Asia/Qatar",c:["BH"],r:1},"Asia/Baku":{u:240,c:["AZ"]},"Asia/Bangkok":{u:420,c:["TH","CX","KH","LA","VN"]},"Asia/Barnaul":{u:420,c:["RU"]},"Asia/Beirut":{u:120,d:180,c:["LB"]},"Asia/Bishkek":{u:360,c:["KG"]},"Asia/Brunei":{a:"Asia/Kuching",c:["BN"],r:1},"Asia/Calcutta":{a:"Asia/Kolkata",r:1},"Asia/Chita":{u:540,c:["RU"]},"Asia/Choibalsan":{u:480,c:["MN"]},"Asia/Chongqing":{a:"Asia/Shanghai",r:1},"Asia/Chungking":{a:"Asia/Shanghai",r:1},"Asia/Colombo":{u:330,c:["LK"]},"Asia/Dacca":{a:"Asia/Dhaka",r:1},"Asia/Damascus":{u:180,c:["SY"]},"Asia/Dhaka":{u:360,c:["BD"]},"Asia/Dili":{u:540,c:["TL"]},"Asia/Dubai":{u:240,c:["AE","OM","RE","SC","TF"]},"Asia/Dushanbe":{u:300,c:["TJ"]},"Asia/Famagusta":{u:120,d:180,c:["CY"]},"Asia/Gaza":{u:120,d:180,c:["PS"]},"Asia/Harbin":{a:"Asia/Shanghai",r:1},"Asia/Hebron":{u:120,d:180,c:["PS"]},"Asia/Ho_Chi_Minh":{u:420,c:["VN"]},"Asia/Hong_Kong":{u:480,c:["HK"]},"Asia/Hovd":{u:420,c:["MN"]},"Asia/Irkutsk":{u:480,c:["RU"]},"Asia/Istanbul":{a:"Europe/Istanbul",r:1},"Asia/Jakarta":{u:420,c:["ID"]},"Asia/Jayapura":{u:540,c:["ID"]},"Asia/Jerusalem":{u:120,d:180,c:["IL"]},"Asia/Kabul":{u:270,c:["AF"]},"Asia/Kamchatka":{u:720,c:["RU"]},"Asia/Karachi":{u:300,c:["PK"]},"Asia/Kashgar":{a:"Asia/Urumqi",c:["CN"],r:1},"Asia/Kathmandu":{u:345,c:["NP"]},"Asia/Katmandu":{a:"Asia/Kathmandu",r:1},"Asia/Khandyga":{u:540,c:["RU"]},"Asia/Kolkata":{u:330,c:["IN"]},"Asia/Krasnoyarsk":{u:420,c:["RU"]},"Asia/Kuala_Lumpur":{a:"Asia/Singapore",c:["MY"],r:1},"Asia/Kuching":{u:480,c:["MY","BN"]},"Asia/Kuwait":{a:"Asia/Riyadh",c:["KW"],r:1},"Asia/Macao":{a:"Asia/Macau",r:1},"Asia/Macau":{u:480,c:["MO"]},"Asia/Magadan":{u:660,c:["RU"]},"Asia/Makassar":{u:480,c:["ID"]},"Asia/Manila":{u:480,c:["PH"]},"Asia/Muscat":{a:"Asia/Dubai",c:["OM"],r:1},"Asia/Nicosia":{u:120,d:180,c:["CY"]},"Asia/Novokuznetsk":{u:420,c:["RU"]},"Asia/Novosibirsk":{u:420,c:["RU"]},"Asia/Omsk":{u:360,c:["RU"]},"Asia/Oral":{u:300,c:["KZ"]},"Asia/Phnom_Penh":{a:"Asia/Bangkok",c:["KH"],r:1},"Asia/Pontianak":{u:420,c:["ID"]},"Asia/Pyongyang":{u:540,c:["KP"]},"Asia/Qatar":{u:180,c:["QA","BH"]},"Asia/Qostanay":{u:360,c:["KZ"]},"Asia/Qyzylorda":{u:300,c:["KZ"]},"Asia/Rangoon":{a:"Asia/Yangon",c:["MM"],r:1},"Asia/Riyadh":{u:180,c:["SA","AQ","KW","YE"]},"Asia/Saigon":{a:"Asia/Ho_Chi_Minh",r:1},"Asia/Sakhalin":{u:660,c:["RU"]},"Asia/Samarkand":{u:300,c:["UZ"]},"Asia/Seoul":{u:540,c:["KR"]},"Asia/Shanghai":{u:480,c:["CN"]},"Asia/Singapore":{u:480,c:["SG","MY"]},"Asia/Srednekolymsk":{u:660,c:["RU"]},"Asia/Taipei":{u:480,c:["TW"]},"Asia/Tashkent":{u:300,c:["UZ"]},"Asia/Tbilisi":{u:240,c:["GE"]},"Asia/Tehran":{u:210,c:["IR"]},"Asia/Tel_Aviv":{a:"Asia/Jerusalem",r:1},"Asia/Thimbu":{a:"Asia/Thimphu",r:1},"Asia/Thimphu":{u:360,c:["BT"]},"Asia/Tokyo":{u:540,c:["JP"]},"Asia/Tomsk":{u:420,c:["RU"]},"Asia/Ujung_Pandang":{a:"Asia/Makassar",r:1},"Asia/Ulaanbaatar":{u:480,c:["MN"]},"Asia/Ulan_Bator":{a:"Asia/Ulaanbaatar",r:1},"Asia/Urumqi":{u:360,c:["CN","AQ"]},"Asia/Ust-Nera":{u:600,c:["RU"]},"Asia/Vientiane":{a:"Asia/Bangkok",c:["LA"],r:1},"Asia/Vladivostok":{u:600,c:["RU"]},"Asia/Yakutsk":{u:540,c:["RU"]},"Asia/Yangon":{u:390,c:["MM","CC"]},"Asia/Yekaterinburg":{u:300,c:["RU"]},"Asia/Yerevan":{u:240,c:["AM"]},"Atlantic/Azores":{u:-60,d:0,c:["PT"]},"Atlantic/Bermuda":{u:-240,d:-180,c:["BM"]},"Atlantic/Canary":{u:0,d:60,c:["ES"]},"Atlantic/Cape_Verde":{u:-60,c:["CV"]},"Atlantic/Faeroe":{a:"Atlantic/Faroe",r:1},"Atlantic/Faroe":{u:0,d:60,c:["FO"]},"Atlantic/Jan_Mayen":{a:"Europe/Berlin",c:["SJ"],r:1},"Atlantic/Madeira":{u:0,d:60,c:["PT"]},"Atlantic/Reykjavik":{a:"Africa/Abidjan",c:["IS"],r:1},"Atlantic/South_Georgia":{u:-120,c:["GS"]},"Atlantic/St_Helena":{a:"Africa/Abidjan",c:["SH"],r:1},"Atlantic/Stanley":{u:-180,c:["FK"]},"Australia/ACT":{a:"Australia/Sydney",r:1},"Australia/Adelaide":{u:570,d:630,c:["AU"]},"Australia/Brisbane":{u:600,c:["AU"]},"Australia/Broken_Hill":{u:570,d:630,c:["AU"]},"Australia/Canberra":{a:"Australia/Sydney",r:1},"Australia/Currie":{a:"Australia/Hobart",r:1},"Australia/Darwin":{u:570,c:["AU"]},"Australia/Eucla":{u:525,c:["AU"]},"Australia/Hobart":{u:600,d:660,c:["AU"]},"Australia/LHI":{a:"Australia/Lord_Howe",r:1},"Australia/Lindeman":{u:600,c:["AU"]},"Australia/Lord_Howe":{u:630,d:660,c:["AU"]},"Australia/Melbourne":{u:600,d:660,c:["AU"]},"Australia/NSW":{a:"Australia/Sydney",r:1},"Australia/North":{a:"Australia/Darwin",r:1},"Australia/Perth":{u:480,c:["AU"]},"Australia/Queensland":{a:"Australia/Brisbane",r:1},"Australia/South":{a:"Australia/Adelaide",r:1},"Australia/Sydney":{u:600,d:660,c:["AU"]},"Australia/Tasmania":{a:"Australia/Hobart",r:1},"Australia/Victoria":{a:"Australia/Melbourne",r:1},"Australia/West":{a:"Australia/Perth",r:1},"Australia/Yancowinna":{a:"Australia/Broken_Hill",r:1},"Brazil/Acre":{a:"America/Rio_Branco",r:1},"Brazil/DeNoronha":{a:"America/Noronha",r:1},"Brazil/East":{a:"America/Sao_Paulo",r:1},"Brazil/West":{a:"America/Manaus",r:1},CET:{u:60,d:120},CST6CDT:{u:-360,d:-300},"Canada/Atlantic":{a:"America/Halifax",r:1},"Canada/Central":{a:"America/Winnipeg",r:1},"Canada/Eastern":{a:"America/Toronto",c:["CA"],r:1},"Canada/Mountain":{a:"America/Edmonton",r:1},"Canada/Newfoundland":{a:"America/St_Johns",r:1},"Canada/Pacific":{a:"America/Vancouver",r:1},"Canada/Saskatchewan":{a:"America/Regina",r:1},"Canada/Yukon":{a:"America/Whitehorse",r:1},"Chile/Continental":{a:"America/Santiago",r:1},"Chile/EasterIsland":{a:"Pacific/Easter",r:1},Cuba:{a:"America/Havana",r:1},EET:{u:120,d:180},EST:{u:-300},EST5EDT:{u:-300,d:-240},Egypt:{a:"Africa/Cairo",r:1},Eire:{a:"Europe/Dublin",r:1},"Etc/GMT":{u:0},"Etc/GMT+0":{a:"Etc/GMT",r:1},"Etc/GMT+1":{u:-60},"Etc/GMT+10":{u:-600},"Etc/GMT+11":{u:-660},"Etc/GMT+12":{u:-720},"Etc/GMT+2":{u:-120},"Etc/GMT+3":{u:-180},"Etc/GMT+4":{u:-240},"Etc/GMT+5":{u:-300},"Etc/GMT+6":{u:-360},"Etc/GMT+7":{u:-420},"Etc/GMT+8":{u:-480},"Etc/GMT+9":{u:-540},"Etc/GMT-0":{a:"Etc/GMT",r:1},"Etc/GMT-1":{u:60},"Etc/GMT-10":{u:600},"Etc/GMT-11":{u:660},"Etc/GMT-12":{u:720},"Etc/GMT-13":{u:780},"Etc/GMT-14":{u:840},"Etc/GMT-2":{u:120},"Etc/GMT-3":{u:180},"Etc/GMT-4":{u:240},"Etc/GMT-5":{u:300},"Etc/GMT-6":{u:360},"Etc/GMT-7":{u:420},"Etc/GMT-8":{u:480},"Etc/GMT-9":{u:540},"Etc/GMT0":{a:"Etc/GMT",r:1},"Etc/Greenwich":{a:"Etc/GMT",r:1},"Etc/UCT":{a:"Etc/UTC",r:1},"Etc/UTC":{u:0},"Etc/Universal":{a:"Etc/UTC",r:1},"Etc/Zulu":{a:"Etc/UTC",r:1},"Europe/Amsterdam":{a:"Europe/Brussels",c:["NL"],r:1},"Europe/Andorra":{u:60,d:120,c:["AD"]},"Europe/Astrakhan":{u:240,c:["RU"]},"Europe/Athens":{u:120,d:180,c:["GR"]},"Europe/Belfast":{a:"Europe/London",c:["GB"],r:1},"Europe/Belgrade":{u:60,d:120,c:["RS","BA","HR","ME","MK","SI"]},"Europe/Berlin":{u:60,d:120,c:["DE","DK","NO","SE","SJ"]},"Europe/Bratislava":{a:"Europe/Prague",c:["SK"],r:1},"Europe/Brussels":{u:60,d:120,c:["BE","LU","NL"]},"Europe/Bucharest":{u:120,d:180,c:["RO"]},"Europe/Budapest":{u:60,d:120,c:["HU"]},"Europe/Busingen":{a:"Europe/Zurich",c:["DE"],r:1},"Europe/Chisinau":{u:120,d:180,c:["MD"]},"Europe/Copenhagen":{a:"Europe/Berlin",c:["DK"],r:1},"Europe/Dublin":{u:60,d:0,c:["IE"]},"Europe/Gibraltar":{u:60,d:120,c:["GI"]},"Europe/Guernsey":{a:"Europe/London",c:["GG"],r:1},"Europe/Helsinki":{u:120,d:180,c:["FI","AX"]},"Europe/Isle_of_Man":{a:"Europe/London",c:["IM"],r:1},"Europe/Istanbul":{u:180,c:["TR"]},"Europe/Jersey":{a:"Europe/London",c:["JE"],r:1},"Europe/Kaliningrad":{u:120,c:["RU"]},"Europe/Kiev":{a:"Europe/Kyiv",r:1},"Europe/Kirov":{u:180,c:["RU"]},"Europe/Kyiv":{u:120,d:180,c:["UA"]},"Europe/Lisbon":{u:0,d:60,c:["PT"]},"Europe/Ljubljana":{a:"Europe/Belgrade",c:["SI"],r:1},"Europe/London":{u:0,d:60,c:["GB","GG","IM","JE"]},"Europe/Luxembourg":{a:"Europe/Brussels",c:["LU"],r:1},"Europe/Madrid":{u:60,d:120,c:["ES"]},"Europe/Malta":{u:60,d:120,c:["MT"]},"Europe/Mariehamn":{a:"Europe/Helsinki",c:["AX"],r:1},"Europe/Minsk":{u:180,c:["BY"]},"Europe/Monaco":{a:"Europe/Paris",c:["MC"],r:1},"Europe/Moscow":{u:180,c:["RU"]},"Europe/Nicosia":{a:"Asia/Nicosia",r:1},"Europe/Oslo":{a:"Europe/Berlin",c:["NO"],r:1},"Europe/Paris":{u:60,d:120,c:["FR","MC"]},"Europe/Podgorica":{a:"Europe/Belgrade",c:["ME"],r:1},"Europe/Prague":{u:60,d:120,c:["CZ","SK"]},"Europe/Riga":{u:120,d:180,c:["LV"]},"Europe/Rome":{u:60,d:120,c:["IT","SM","VA"]},"Europe/Samara":{u:240,c:["RU"]},"Europe/San_Marino":{a:"Europe/Rome",c:["SM"],r:1},"Europe/Sarajevo":{a:"Europe/Belgrade",c:["BA"],r:1},"Europe/Saratov":{u:240,c:["RU"]},"Europe/Simferopol":{u:180,c:["RU","UA"]},"Europe/Skopje":{a:"Europe/Belgrade",c:["MK"],r:1},"Europe/Sofia":{u:120,d:180,c:["BG"]},"Europe/Stockholm":{a:"Europe/Berlin",c:["SE"],r:1},"Europe/Tallinn":{u:120,d:180,c:["EE"]},"Europe/Tirane":{u:60,d:120,c:["AL"]},"Europe/Tiraspol":{a:"Europe/Chisinau",r:1},"Europe/Ulyanovsk":{u:240,c:["RU"]},"Europe/Uzhgorod":{a:"Europe/Kyiv",r:1},"Europe/Vaduz":{a:"Europe/Zurich",c:["LI"],r:1},"Europe/Vatican":{a:"Europe/Rome",c:["VA"],r:1},"Europe/Vienna":{u:60,d:120,c:["AT"]},"Europe/Vilnius":{u:120,d:180,c:["LT"]},"Europe/Volgograd":{u:180,c:["RU"]},"Europe/Warsaw":{u:60,d:120,c:["PL"]},"Europe/Zagreb":{a:"Europe/Belgrade",c:["HR"],r:1},"Europe/Zaporozhye":{a:"Europe/Kyiv",r:1},"Europe/Zurich":{u:60,d:120,c:["CH","DE","LI"]},Factory:{u:0},GB:{a:"Europe/London",c:["GB"],r:1},"GB-Eire":{a:"Europe/London",c:["GB"],r:1},GMT:{a:"Etc/GMT",r:1},"GMT+0":{a:"Etc/GMT",r:1},"GMT-0":{a:"Etc/GMT",r:1},GMT0:{a:"Etc/GMT",r:1},Greenwich:{a:"Etc/GMT",r:1},HST:{u:-600},Hongkong:{a:"Asia/Hong_Kong",r:1},Iceland:{a:"Africa/Abidjan",c:["IS"],r:1},"Indian/Antananarivo":{a:"Africa/Nairobi",c:["MG"],r:1},"Indian/Chagos":{u:360,c:["IO"]},"Indian/Christmas":{a:"Asia/Bangkok",c:["CX"],r:1},"Indian/Cocos":{a:"Asia/Yangon",c:["CC"],r:1},"Indian/Comoro":{a:"Africa/Nairobi",c:["KM"],r:1},"Indian/Kerguelen":{a:"Indian/Maldives",c:["TF"],r:1},"Indian/Mahe":{a:"Asia/Dubai",c:["SC"],r:1},"Indian/Maldives":{u:300,c:["MV","TF"]},"Indian/Mauritius":{u:240,c:["MU"]},"Indian/Mayotte":{a:"Africa/Nairobi",c:["YT"],r:1},"Indian/Reunion":{a:"Asia/Dubai",c:["RE"],r:1},Iran:{a:"Asia/Tehran",r:1},Israel:{a:"Asia/Jerusalem",r:1},Jamaica:{a:"America/Jamaica",r:1},Japan:{a:"Asia/Tokyo",r:1},Kwajalein:{a:"Pacific/Kwajalein",r:1},Libya:{a:"Africa/Tripoli",r:1},MET:{u:60,d:120},MST:{u:-420},MST7MDT:{u:-420,d:-360},"Mexico/BajaNorte":{a:"America/Tijuana",r:1},"Mexico/BajaSur":{a:"America/Mazatlan",r:1},"Mexico/General":{a:"America/Mexico_City",r:1},NZ:{a:"Pacific/Auckland",c:["NZ"],r:1},"NZ-CHAT":{a:"Pacific/Chatham",r:1},Navajo:{a:"America/Denver",r:1},PRC:{a:"Asia/Shanghai",r:1},PST8PDT:{u:-480,d:-420},"Pacific/Apia":{u:780,c:["WS"]},"Pacific/Auckland":{u:720,d:780,c:["NZ","AQ"]},"Pacific/Bougainville":{u:660,c:["PG"]},"Pacific/Chatham":{u:765,d:825,c:["NZ"]},"Pacific/Chuuk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Easter":{u:-360,d:-300,c:["CL"]},"Pacific/Efate":{u:660,c:["VU"]},"Pacific/Enderbury":{a:"Pacific/Kanton",r:1},"Pacific/Fakaofo":{u:780,c:["TK"]},"Pacific/Fiji":{u:720,c:["FJ"]},"Pacific/Funafuti":{a:"Pacific/Tarawa",c:["TV"],r:1},"Pacific/Galapagos":{u:-360,c:["EC"]},"Pacific/Gambier":{u:-540,c:["PF"]},"Pacific/Guadalcanal":{u:660,c:["SB","FM"]},"Pacific/Guam":{u:600,c:["GU","MP"]},"Pacific/Honolulu":{u:-600,c:["US"]},"Pacific/Johnston":{a:"Pacific/Honolulu",r:1},"Pacific/Kanton":{u:780,c:["KI"]},"Pacific/Kiritimati":{u:840,c:["KI"]},"Pacific/Kosrae":{u:660,c:["FM"]},"Pacific/Kwajalein":{u:720,c:["MH"]},"Pacific/Majuro":{a:"Pacific/Tarawa",c:["MH"],r:1},"Pacific/Marquesas":{u:-570,c:["PF"]},"Pacific/Midway":{a:"Pacific/Pago_Pago",c:["UM"],r:1},"Pacific/Nauru":{u:720,c:["NR"]},"Pacific/Niue":{u:-660,c:["NU"]},"Pacific/Norfolk":{u:660,d:720,c:["NF"]},"Pacific/Noumea":{u:660,c:["NC"]},"Pacific/Pago_Pago":{u:-660,c:["AS","UM"]},"Pacific/Palau":{u:540,c:["PW"]},"Pacific/Pitcairn":{u:-480,c:["PN"]},"Pacific/Pohnpei":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Ponape":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Port_Moresby":{u:600,c:["PG","AQ","FM"]},"Pacific/Rarotonga":{u:-600,c:["CK"]},"Pacific/Saipan":{a:"Pacific/Guam",c:["MP"],r:1},"Pacific/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},"Pacific/Tahiti":{u:-600,c:["PF"]},"Pacific/Tarawa":{u:720,c:["KI","MH","TV","UM","WF"]},"Pacific/Tongatapu":{u:780,c:["TO"]},"Pacific/Truk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Wake":{a:"Pacific/Tarawa",c:["UM"],r:1},"Pacific/Wallis":{a:"Pacific/Tarawa",c:["WF"],r:1},"Pacific/Yap":{a:"Pacific/Port_Moresby",c:["FM"],r:1},Poland:{a:"Europe/Warsaw",r:1},Portugal:{a:"Europe/Lisbon",r:1},ROC:{a:"Asia/Taipei",r:1},ROK:{a:"Asia/Seoul",r:1},Singapore:{a:"Asia/Singapore",c:["SG"],r:1},Turkey:{a:"Europe/Istanbul",r:1},UCT:{a:"Etc/UTC",r:1},"US/Alaska":{a:"America/Anchorage",r:1},"US/Aleutian":{a:"America/Adak",r:1},"US/Arizona":{a:"America/Phoenix",c:["US"],r:1},"US/Central":{a:"America/Chicago",r:1},"US/East-Indiana":{a:"America/Indiana/Indianapolis",r:1},"US/Eastern":{a:"America/New_York",r:1},"US/Hawaii":{a:"Pacific/Honolulu",r:1},"US/Indiana-Starke":{a:"America/Indiana/Knox",r:1},"US/Michigan":{a:"America/Detroit",r:1},"US/Mountain":{a:"America/Denver",r:1},"US/Pacific":{a:"America/Los_Angeles",r:1},"US/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},UTC:{a:"Etc/UTC",r:1},Universal:{a:"Etc/UTC",r:1},"W-SU":{a:"Europe/Moscow",r:1},WET:{u:0,d:60},Zulu:{a:"Etc/UTC",r:1}},mg={countries:Rke,timezones:_ke},jw;function Pke(e,t){var n=e.countries[t];if(!n)return null;var r=Ike(e)[t]||{};return{id:t,name:n,timezones:r.current||[],allTimezones:r.all||[]}}function Ike(e){return jw||(jw=Oke(e)),jw}function Oke(e){return Object.keys(e.timezones).reduce(function(t,n){var r=e.timezones[n],o=r.c,i=r.a,a=e.timezones[i]||{},l=o||a.c;return l&&l.forEach(function(c){t[c]||Object.assign(t,u0({},c,{current:[],all:[]})),r.r===void 0&&t[c].current.push(n),t[c].all.push(n)}),t},{})}function $ke(e,t){var n=e.timezones[t];if(!n)return null;var r=n.a,o=r===void 0?null:r,i=o?e.timezones[o]:{},a=Rh(Rh({},i),e.timezones[t]),l=a.c||[],c=a.u,u=Number.isInteger(a.d)?a.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:$I(c),dstOffset:u,dstOffsetStr:$I(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function $I(e){var t=Math.floor(e/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(NI(t),":").concat(NI(n))}function NI(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var Nke=["allTimezones"],Lke=Object.keys(mg.timezones).length,pC={},Mf={},TB=0;function Dke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(mg.countries).reduce(function(t,n){return Object.assign(t,u0({},n,d0(n,e)))},{})}function Mke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Lke!==TB&&Object.keys(mg.timezones).forEach(p0),Uke(Mf,e)}function d0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return pC[e]||Bke(Pke(mg,e)),Wke(pC[e],t)}function Bke(e){e&&(pC[e.id]=e)}function p0(e){return Mf[e]||Fke($ke(mg,e)),Mf[e]?Rh({},Mf[e]):null}function Fke(e){e&&(Mf[e.name]=e,TB=Object.keys(e).length)}function kB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=p0(e)||{},r=n.countries||[];return r.map(function(o){return d0(o,t)})}function zke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=kB(e,t),r=Cke(n,1),o=r[0];return o||null}function jke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=d0(e,t);if(!n)return null;var r=n.timezones||[];return r.map(p0)}function Uke(e,t){var n=t||{},r=n.deprecated;return r===!0?e:Object.keys(e).reduce(function(o,i){return e[i].deprecated||Object.assign(o,u0({},i,e[i])),o},{})}function Wke(e,t){if(!e)return null;var n=t||{},r=n.deprecated;e.allTimezones;var o=xke(e,Nke),i=r?e.allTimezones:e.timezones;return Rh(Rh({},o),{},{timezones:i})}var Hke={getCountry:d0,getTimezone:p0,getAllCountries:Dke,getAllTimezones:Mke,getTimezonesForCountry:jke,getCountriesForTimezone:kB,getCountryForTimezone:zke};const Vke=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),Gke=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(Hke.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[a,l]=g.useState(t||""),c=g.useMemo(()=>{const u=o.find(d=>d.key===i);return u!=null?`${u.key} (UTC ${u.utcOffset})`:"The time shown is in your local time zone according to your browser."},[o,i]);return t?S(ce,{children:[s(gg,{children:"Select a date"}),S(Vke,{children:[s(ir,{id:"date",label:"Date",type:"datetime-local",value:jxe(a),onChange:u=>{r("");const d=GM(u.target.value),p=d==null?void 0:d.toISOString();p&&l(p),p&&e(p)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),s("p",{children:c})]})]}):null},AB=$s()(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"}})),qke="Enter",LI=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,a]=g.useState(""),{classes:l}=AB(),c=d=>{d.key===qke&&(d.preventDefault(),u())},u=()=>{const d=Yke([...e,...Js(i)]);d.length===0?o("values cannot be empty"):d.some(p=>p.length>100)?o("values cannot be longer than 100 characters"):(o(""),a(""),n(d))};return S("div",{children:[s(gg,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),S("div",{className:l.inputContainer,children:[s("div",{className:l.inputInnerContainer,children:s(ir,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>a(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),s(Ve,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),s("div",{className:l.valuesContainer,children:s(Kke,{values:e,removeValue:t})})]})},Kke=({values:e,removeValue:t})=>{const{classes:n}=AB();return s(ce,{children:e.map((r,o)=>s(Is,{label:s(_a,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip},`${r}-${o}`))})},Yke=e=>Array.from(new Set(e)),Ck=({filter:e,setFilter:t})=>S("div",{style:{display:"flex",alignItems:"center"},children:[s("div",{style:{width:"300px"},children:s(fn,{label:"Search",name:"search",value:e,onChange:n=>t(n.target.value),placeholder:"Filter values",style:{width:"100%",margin:"1rem 0"},variant:"outlined",size:"small",InputProps:{startAdornment:s(ph,{position:"start",children:s(tT,{})})}})}),s(V,{condition:!!e,show:s(Is,{style:{marginLeft:"1rem"},label:`filter active: ${e}`,onDelete:()=>t("")})})]}),Xke=$s()(e=>({container:{display:"inline-block",wordBreak:"break-word"},value:{lineHeight:1.33,fontSize:e.fontSizes.smallBody},description:{lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active}})),RB=({legal:e,control:t})=>{const{classes:n}=Xke();return s("div",{className:n.container,children:s(Gr,{value:e.value,control:t,label:S(ce,{children:[s("div",{className:n.value,children:e.value}),s("div",{className:n.description,children:e.description})]})})})},_B=(e,t)=>e.filter(n=>n.value.includes(t)),Uw=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),PB=e=>new Set(e.map(({value:t})=>t)),IB=(e,t)=>{const n=PB(t);return e.filter(r=>n.has(r))},Jke=({data:e,values:t,setValues:n,error:r,setError:o,constraintValues:i})=>{const[a,l]=g.useState(""),{legalValues:c,deletedLegalValues:u}=e,d=_B(c,a),[p,f]=g.useState(()=>Uw(t)),{classes:h}=tg(),m=v=>{const w=PB(u);return(v==null?void 0:v.filter(C=>!w.has(C)))||[]},y=IB(i,u);g.useEffect(()=>{f(Uw(t))},[t,f,Uw]),g.useEffect(()=>{y.length>0&&n(m(t))},[]);const b=v=>{if(o(""),p[v]){const w=t.findIndex(k=>k===v),C=[...t];C.splice(w,1),n(C);return}n([...m(t),v])};return S(ce,{children:[s(V,{condition:!!(y&&y.length>0),show:S(Bt,{severity:"warning",children:["This constraint is using legal values that have been deleted as valid options. If you save changes on this constraint and then save the strategy the following values will be removed:",s("ul",{children:y==null?void 0:y.map(v=>s("li",{children:v},v))})]})}),s(gg,{children:"Select values from a predefined set"}),s(V,{condition:c.length>100,show:s(Ck,{filter:a,setFilter:l})}),d.map(v=>s(RB,{legal:v,control:s(es,{checked:!!p[v.value],onChange:()=>b(v.value),name:v.value,color:"primary",disabled:u.map(({value:w})=>w).includes(v.value)})},v.value)),s(V,{condition:!!r,show:s("p",{className:h.error,children:r})})]})},DI=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:a,constraintValue:l})=>{const[c,u]=g.useState(""),{classes:d}=tg(),p=_B(r,c),{deletedLegalValues:f}=a,h=IB([l],f);return S(ce,{children:[s(V,{condition:!!(h&&h.length>0),show:S(Bt,{severity:"warning",sx:m=>({marginTop:m.spacing(1)}),children:[" ","This constraint is using legal values that have been deleted as a valid option. Please select a new value from the remaining predefined legal values. The constraint will be updated with the new value when you save the strategy."]})}),S(gg,{children:["Add a single ",n.toLowerCase()," value"]}),s(V,{condition:r.length>100,show:s(Ck,{filter:c,setFilter:u})}),s(V,{condition:!!r.length,show:s(Os,{component:"fieldset",children:s(RE,{"aria-label":"selected-value",name:"selected",value:t,onChange:m=>{i(""),e(m.target.value)},children:p.map(m=>s(RB,{legal:m,control:s(cc,{})},m.value))})}),elseShow:s("p",{children:"No valid legal values available for this operator."})}),s(V,{condition:!!o,show:s("p",{className:d.error,children:o})})]})},Qke=$s()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),MI=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=Qke();return S(ce,{children:[S(gg,{children:["Add a single ",n.toLowerCase()," value"]}),s("div",{className:i.singleValueContainer,children:s(ir,{label:n,name:"value",value:t||"",onChange:a=>{o(""),e(a.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},Ww=(e,t)=>{if((t==null?void 0:t.length)===0)return{legalValues:[],deletedLegalValues:[]};const n=(e||[]).filter(r=>!(t||[]).some(({value:o})=>o===r)).map(r=>({value:r,description:""}));return{legalValues:t||[],deletedLegalValues:n}},Zke=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:a,setError:l,removeValue:c,error:u})=>s(ce,{children:(()=>{var p;switch(e){case dC:case yB:return s(ce,{children:s(Jke,{data:Ww(n,t.legalValues),constraintValues:n,values:o.values||[],setValues:a,error:u,setError:l})});case vB:return s(ce,{children:s(DI,{data:Ww([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((p=t.legalValues)==null?void 0:p.filter(f=>Number(f.value)))||[],error:u,setError:l})});case bB:return s(ce,{children:s(DI,{data:Ww([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:u,setError:l})});case wB:return s(Gke,{value:o.value,setValue:i,error:u,setError:l});case SB:return s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l});case xB:return s(ce,{children:s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l})});case CB:return s(MI,{setValue:i,value:o.value,type:"number",error:u,setError:l});case EB:return s(MI,{setValue:i,value:o.value,type:"semver",error:u,setError:l})}})()}),OB="cancel",BI="save",FI=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},eAe=x("div")({padding:0,margin:0,width:"100%"}),tAe=x(w1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.elevation1,boxShadow:"none",margin:0,"& .expanded":{"&:before":{opacity:"0 !important"}}})),nAe=x(C1)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),rAe=x(S1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),oAe=({constraint:e,compact:t,onCancel:n,onSave:r,onDelete:o})=>{const[i,a]=g.useState(nI(e)),{context:l}=ga(),[c,u]=g.useState(FI(l,i.contextName)),{validateConstraint:d}=qd(),[p,f]=g.useState(!1),[h,m]=g.useState("");g.useEffect(()=>{f(!0)},[]),g.useEffect(()=>{u(FI(l,i.contextName))},[i.contextName,l]);const y=g.useCallback(D=>{a(B=>({...B,contextName:D,values:[],value:""}))},[]),b=g.useCallback(D=>{a(B=>({...B,operator:D,values:[],value:""}))},[]),v=g.useCallback(D=>{a(B=>({...B,values:D}))},[]),w=g.useCallback(D=>{a(B=>({...B,value:D}))},[]),C=()=>{a(D=>({...D,inverted:!D.inverted}))},k=g.useCallback(()=>{a(D=>({...D,caseInsensitive:!D.caseInsensitive}))},[]),A=g.useCallback(D=>{const B=[...i.values];B.splice(D,1),v(B)},[i,v]),T=()=>{f(!1)},_=()=>{const D=Array.isArray(i.values)&&i.values.length>0,B=!!i.value;return D||B?($(""),!0):($("You must provide a value for the constraint"),!1)},P=async()=>{if(!_())return;const[B,q]=O();if(B||$(q),B)try{await d(i),$(""),m(BI),T();return}catch(Y){$(gt(Y))}},{input:I,validator:O,setError:$,error:F}=bke({contextDefinition:c,localConstraint:i});return g.useEffect(()=>{$(""),a(D=>nI(D))},[i.operator,i.contextName,$]),s(eAe,{children:S(tAe,{expanded:p,TransitionProps:{onExited:()=>{h===OB?(m(""),n()):h===BI&&(m(""),r(i))}},children:[s(nAe,{children:s(g2e,{localConstraint:i,setLocalConstraint:a,setContextName:y,setOperator:b,action:h,compact:t,setInvertedOperator:C,setCaseInsensitive:k,onDelete:o})}),s(rAe,{children:s(KCe,{localConstraint:i,setValues:v,setValue:w,triggerTransition:T,setAction:m,onSubmit:P,children:s(Zke,{setValues:v,setValue:w,setError:$,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:I,error:F,contextDefinition:c,removeValue:A})})})]})})},$B=(e,t)=>e.value&&e.contextName===Ah?U1(e.value,t.locale):e.value,iAe=x(_a)({whiteSpace:"pre"}),aAe=x(Is)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),sAe=({values:e})=>{const[t,n]=g.useState("");return!e||e.length===0?null:S(ce,{children:[s(V,{condition:e.length>20,show:s(Ck,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>s(aAe,{label:s(iAe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},lAe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),cAe=x("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),uAe=x(Is)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),dAe=({value:e,operator:t})=>e?S(lAe,{children:[S(cAe,{children:["Value must be ",t]})," ",s(uAe,{label:s(_a,{maxWidth:"400",text:e,maxLength:50})})]}):null,pAe=x("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),fAe=({constraint:e})=>{const{locationSettings:t}=ns();return s("div",{children:S(pAe,{children:[s(sAe,{values:e.values}),s(dAe,{value:$B(e,t),operator:e.operator})]})})},hAe=x("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),gAe=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14})),mAe=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),yAe=({constraint:e,hasPrefix:t})=>{const n=e.operator,r=cC(e.operator);return S(hAe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[s(gAe,{children:n}),s(mAe,{children:r})]})},NB=x("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation2,width:24,display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"stretch",color:e.palette.primary.main,marginLeft:e.spacing(1),borderRadius:e.shape.borderRadius})),vAe=x(NB)(()=>({marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),zI=g.forwardRef(({isPrefix:e,...t},n)=>s(V,{condition:!!e,show:()=>s(vAe,{ref:n,...t}),elseShow:()=>s(NB,{ref:n,...t})})),bAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),wAe=x("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),SAe=({constraint:e})=>S(bAe,{children:[s(V,{condition:!!e.inverted,show:s(wt,{title:"Operator is negated",arrow:!0,children:s(fe,{sx:{display:"flex"},children:s(zI,{isPrefix:!0,children:s(oB,{})})})})}),s(wAe,{children:s(yAe,{constraint:e,hasPrefix:!!e.inverted})}),s(V,{condition:!e.caseInsensitive&&Mn(Ss,e.operator),show:s(wt,{title:"Case sensitive is active",arrow:!0,children:s(zI,{children:s(sB,{})})})})]}),xAe=x(Is)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),CAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),EAe=({constraint:e,allowExpand:t})=>{const{locationSettings:n}=ns();return g.useEffect(()=>{t(!1)},[t]),s(CAe,{children:s(xAe,{label:$B(e,n)})})},TAe=x("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,margin:"auto 0",[e.breakpoints.down("sm")]:{margin:e.spacing(1,0),textAlign:"center"}})),kAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),AAe=x("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),RAe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),_Ae=({constraint:e,expanded:t,allowExpand:n,maxLength:r})=>{var l;const[o,i]=g.useState(!1),a=g.useMemo(()=>{var c;return(c=e==null?void 0:e.values)==null?void 0:c.map(u=>u).join(", ")},[e]);return g.useEffect(()=>{a&&(n(((a==null?void 0:a.length)??0)>r),i(((a==null?void 0:a.length)??0)>r))},[a,r,n,i]),s(kAe,{children:S(AAe,{children:[s(TAe,{children:a}),s(V,{condition:o,show:s(RAe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(l=e==null?void 0:e.values)==null?void 0:l.length})`})})]})})},PAe=x("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",maxWidth:"100px",minWidth:"100px",marginRight:"10px",marginTop:"auto",marginBottom:"auto",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,[e.breakpoints.down(710)]:{textAlign:"center",padding:e.spacing(1,0),marginRight:"inherit",maxWidth:"inherit"}})),IAe=x("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),OAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),$Ae=({constraint:e,singleValue:t,allowExpand:n,expanded:r,maxLength:o=112})=>s(IAe,{children:S(OAe,{children:[s(wt,{title:e.contextName,arrow:!0,children:s(PAe,{children:e.contextName})}),s(SAe,{constraint:e}),s(V,{condition:t,show:s(EAe,{constraint:e,allowExpand:n}),elseShow:s(_Ae,{constraint:e,expanded:r,allowExpand:n,maxLength:o})})]})}),NAe=Mc("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),LAe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:a})=>{const{context:l}=ga(),{contextName:c}=e,u=!l.map(d=>d.name).includes(c);return S(NAe,{children:[s(nB,{compact:a}),s($Ae,{constraint:e,singleValue:r,allowExpand:o,expanded:i}),s(lB,{onEdit:t,onDelete:n,disableEdit:u})]})},DAe=x(w1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),MAe=x(C1)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}}})),BAe=x(S1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),FAe=x("div")({display:"flex",flexDirection:"column",width:"100%"}),zAe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,renderAfter:i})=>{const[a,l]=g.useState(!0),[c,u]=g.useState(!1),d=Mn([...Vu,...Hu,...Ii],e.operator);return S(DAe,{expanded:c,sx:r,children:[s(MAe,{expandIcon:null,onClick:()=>{a&&u(!c)},sx:{cursor:a?"pointer":"default!important","&:hover":{cursor:a?"pointer":"default!important"}},children:S(FAe,{children:[s(LAe,{constraint:e,onEdit:t,onDelete:n,singleValue:d,allowExpand:l,expanded:c,compact:o}),i]})}),s(BAe,{children:s(fAe,{constraint:e})})]})},jAe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:a})=>e?s(V,{condition:!!(n&&a),show:s(oAe,{constraint:e,onCancel:o,onSave:a,onDelete:i,compact:t}),elseShow:s(zAe,{constraint:e,onEdit:r,onDelete:i})}):null,UAe=e=>{const t=g.useRef(e??new WeakMap),[,n]=g.useState(0),r=g.useCallback((i,a)=>{t.current.set(i,a),n(l=>l+1)},[]),o=g.useCallback(i=>t.current.get(i),[]);return g.useMemo(()=>({set:r,get:o}),[r,o])},LB=e=>(Hw.has(e)||(jI++,Hw.set(e,jI)),Hw.get(e)),Hw=new WeakMap;let jI=0;const WAe=e=>{const t=rB(e)[0],n=Mn(Ii,t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1}},DB=x("div")(({theme:e})=>({padding:e.spacing(.75,1),color:e.palette.text.primary,fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:"50%",left:e.spacing(2),transform:"translateY(-50%)",lineHeight:1})),HAe=x(DB)(({theme:e})=>({top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.75,1.5)})),Ek=({text:e})=>{const t=on();return s(fe,{sx:{height:t.spacing(e==="AND"?1:1.5),position:"relative",width:"100%"},children:s(V,{condition:e==="AND",show:()=>s(DB,{children:e}),elseShow:()=>s(HAe,{children:e})})})},MB="constraintAccordionListId",VAe=x("div")({width:"100%",display:"flex",flexDirection:"column"}),GAe=x(wt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)})),qAe=x(Gy)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}})),KAe=x("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary})),YAe=x("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"})),yg=g.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const i=UAe(),{context:a}=ga(),l=t&&(h=>{const m=WAe(h);i.set(m,{editing:!0,new:!0}),t(y=>[...y,m])});g.useImperativeHandle(o,()=>({addConstraint:l}));const c=l&&(()=>{l(a[0].name)}),u=t&&(h=>{i.set(h,{editing:!0})}),d=t&&(h=>{const m=e[h];i.set(m,{}),t(Ei(y=>{y.splice(h,1)}))}),p=t&&((h,m)=>{i.set(m,{}),t(Ei(y=>{y[h]=m}))}),f=h=>{var y;const m=e[h];(y=i.get(m))!=null&&y.new&&(d==null||d(h)),i.set(m,{})};return a.length===0?null:S(VAe,{id:MB,children:[s(V,{condition:e&&e.length>0&&r,show:s(KAe,{children:"Constraints"})}),e.map((h,m)=>{var y;return S(g.Fragment,{children:[s(V,{condition:m>0,show:s(Ek,{text:"AND"})}),s(jAe,{constraint:h,onEdit:u&&u.bind(null,h),onCancel:f.bind(null,m),onDelete:d&&d.bind(null,m),onSave:p&&p.bind(null,m),editing:!!((y=i.get(h))!=null&&y.editing),compact:!0})]},LB(h))}),s(V,{condition:!!(n&&c),show:S("div",{children:[S(YAe,{children:[s("p",{children:"Add any number of constraints"}),s(GAe,{title:"View constraints documentation",arrow:!0,children:s("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:s(qAe,{})})})]}),s(Ve,{type:"button",onClick:c,variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})]})}),XAe=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{const o=g.useMemo(()=>n.constraints??[],[n]),i=c=>{r(u=>({...u,constraints:c instanceof Function?c(o):c}))},a=cd(p9,e,t),l=cd(H1,e,t);return s(yg,{constraints:o,setConstraints:l?i:void 0,showCreateButton:a})},UI=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},Tk=e=>{const t=!!(e&&e.length===0),[n,r]=g.useState(t),{validateConstraint:o}=qd();return g.useEffect(()=>{if(!e)return;if(e.find(l=>!UI(l))){r(!1);return}const a=e.filter(UI).map(l=>o(l));Promise.all(a).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},Ll=e=>{St();const t=kt(e?`api/admin/segments/strategies/${e}`:"api/admin/segments"),{data:n,error:r,mutate:o}=Pn(t,()=>JAe(t),{refreshInterval:15*1e3}),i=g.useCallback(()=>{o().catch(console.warn)},[o]);return{segments:n,refetchSegments:i,loading:!r&&!n,error:r}},JAe=async e=>fetch(e).then(xn("Segments")).then(t=>t.json()).then(t=>t.segments),QAe=$s()(e=>({inputRoot:{height:48,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTopRightRadius:50,borderBottomRightRadius:50,"& fieldset":{borderColor:e.palette.divider,borderLeftColor:"transparent"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:1}}})),ZAe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),eRe=x("div",{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({background:t?e.palette.primary.light:e.palette.primary.main,height:"48px",width:"48px",display:"flex",alignItems:"center",justifyContent:"center",paddingLeft:6,borderTopLeftRadius:"40px",borderBottomLeftRadius:"40px",color:e.palette.primary.contrastText})),tRe=x($d)({flex:1}),BB=({label:e,options:t,value:n=[],onChange:r,disabled:o})=>{const{classes:i}=QAe(),a=l=>s(fn,{...l,variant:"outlined",label:e});return S(ZAe,{children:[s(eRe,{$disabled:!!o,"aria-hidden":!0,children:s(tT,{})}),s(tRe,{classes:{inputRoot:i.inputRoot},options:t,value:n,popupIcon:s(Sce,{titleAccess:"Toggle"}),onChange:(l,c)=>r(c||[]),renderInput:a,getOptionLabel:l=>l.label,disabled:o,size:"small",multiple:!0})]})},nRe=x("span")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),paddingInlineStart:e.spacing(2),paddingInlineEnd:e.spacing(1),paddingBlockStart:e.spacing(.5),paddingBlockEnd:e.spacing(.5),borderRadius:"100rem",background:e.palette.primary.main,color:e.palette.primary.contrastText})),WI=x("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer"})),rRe=x(Kt)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),Vw=e=>({fontSize:e.fontSizes.bodySize}),oRe=({segment:e,setSegments:t,preview:n,setPreview:r})=>{const o=()=>{t(c=>c.filter(u=>u.id!==e.id)),r(c=>c===e?void 0:c)},i=()=>{r(c=>c===e?void 0:e)},a=s(V,{condition:e===n,show:s(OD,{titleAccess:"Hide",sx:Vw}),elseShow:s(ID,{titleAccess:"Show",sx:Vw})}),l=e===n?"Hide segment constraints":"Preview segment constraints";return S(nRe,{children:[s(rRe,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),s(wt,{title:l,arrow:!0,children:s(WI,{type:"button",onClick:i,"aria-expanded":e===n,"aria-controls":MB,children:a})}),s(wt,{title:"Remove segment",arrow:!0,children:s(WI,{type:"button",onClick:o,children:s(Cce,{titleAccess:"Remove",sx:Vw})})})]})},iRe=x(w1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none",margin:0,transition:"all 0.1s ease","&:before":{opacity:"0 !important"},"&.Mui-expanded":{backgroundColor:e.palette.neutral.light}})),aRe=x(C1)(({theme:e})=>({margin:e.spacing(0,.5),fontSize:e.typography.body2.fontSize,".MuiAccordionSummary-content":{display:"flex",alignItems:"center"}})),sRe=x(Kt)(({theme:e})=>({textDecoration:"none",marginLeft:e.spacing(1),"&:hover":{textDecoration:"underline"}})),FB=({segment:e,isExpanded:t,headerContent:n,constraintList:r})=>{var a;const[o,i]=g.useState(t||!1);return S(iRe,{expanded:o,children:[S(aRe,{id:`segment-accordion-${e.id}`,children:[s(TD,{color:"secondary",sx:{mr:1}}),s("span",{children:"Segment:"}),s(sRe,{to:`/segments/edit/${e.id}`,children:e.name}),s(V,{condition:!!n,show:n}),s(V,{condition:!t,show:s(Ve,{size:"small",variant:"outlined",onClick:()=>i(l=>!l),sx:{my:0,ml:"auto",fontSize:l=>l.typography.body2.fontSize},children:o?"Close preview":"Preview"})})]}),s(S1,{sx:{pt:0},children:s(V,{condition:!!r,show:r,elseShow:s(V,{condition:(((a=e==null?void 0:e.constraints)==null?void 0:a.length)||0)>0,show:s(yg,{constraints:e.constraints,showLabel:!1}),elseShow:s(re,{children:"This segment has no constraints."})})})})]})},lRe=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),cRe=x("p")(({theme:e})=>({color:e.palette.text.secondary})),uRe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,padding:e.spacing(.75,1),display:"block",marginTop:"auto",marginBottom:"auto",alignItems:"center",borderRadius:e.shape.borderRadius,lineHeight:1,color:e.palette.text.primary,backgroundColor:e.palette.background.elevation2})),dRe=({segments:e,setSegments:t})=>{const[n,r]=g.useState(),o=e.length-1;return e.length===0?null:S(ce,{children:[s(V,{condition:e&&e.length>0,show:s(cRe,{children:"Selected Segments"})}),s(lRe,{children:e.map((i,a)=>S(g.Fragment,{children:[s(oRe,{segment:i,setSegments:t,preview:n,setPreview:r}),s(V,{condition:a<o,show:s(uRe,{children:"AND"})})]},i.id))}),s(V,{condition:!!n,show:()=>s(FB,{segment:n,isExpanded:!0})})]})},Gc=()=>{const{uiConfig:e}=St();return{segmentValuesLimit:e.segmentValuesLimit,strategySegmentsLimit:e.strategySegmentsLimit}},pRe=()=>{const{segmentValuesLimit:e}=Gc();return typeof e>"u"?null:S(Bt,{severity:"info",children:["A segment can have"," ",S("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," across all of its contraints"]}),". ",s(zB,{})]})},fRe=e=>{const{segmentValuesLimit:t}=Gc();return typeof t>"u"?null:S(Bt,{severity:"error",children:["A segment can have"," ",S("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",t," across all of its contraints"]}),". This segment has ",e.values," ",e.values===1?"value":"values","."]})},hRe=()=>{const{strategySegmentsLimit:e}=Gc();return typeof e>"u"?null:S(Bt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",s(zB,{})]})},zB=()=>S(ce,{children:[s("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),jB="https://docs.getunleash.io/reference/segments",gRe=x(xr)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),mRe=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=Ll(),{strategySegmentsLimit:o}=Gc(),i=!!(o&&e.length>=o);if(!r||r.length===0)return null;const c=r.filter(({project:d})=>!d||d===n).filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name}));return S(ce,{children:[s(re,{component:"h3",sx:{m:0},variant:"h3",children:"Segmentation"}),i&&s(hRe,{}),s("p",{children:"Add a predefined segment to constrain this feature toggle:"}),s(BB,{label:"Select segments",options:c,onChange:([d])=>{const p=r.find(f=>String(f.id)===d.value);p&&t(f=>[...f,p])},disabled:i}),s(dRe,{segments:e,setSegments:t}),s(gRe,{})]})},yRe=(e,t)=>{const{type:n,required:r}=e;if(!(n!=="string"&&n!=="list"&&n!=="number")){if(r&&(typeof t>"u"||t===""))return"Field is required";if(n==="number"&&!vRe(t))return"Not a valid number."}},vRe=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),kk=e=>{const{data:t,error:n,mutate:r}=Pn(e?kt(`api/admin/strategies/${e}`):null,bRe),o=g.useCallback(()=>{r().catch(console.warn)},[r]);return{strategyDefinition:t,refetchStrategy:o,loading:!n&&!t,error:n}},bRe=e=>fetch(e).then(xn("Strategy")).then(t=>t.json()),wRe=({environment:e})=>S(Bt,{severity:"info",children:[s("strong",{children:"Change requests"})," are enabled",e?` for ${e}`:"",". Your changes needs to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]}),SRe="production",xRe=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const[i,a]=UB(),l=()=>{a(c=>({hide:!c.hide}))};return S(nr,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[s(Bt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),s("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),s(Gr,{label:"Don't show again",control:s(es,{checked:i.hide,onChange:l})})]})},CRe=(e,t)=>{const[n]=UB(),r=e.environments.find(o=>o.name===t);return n.hide?!1:(r==null?void 0:r.type)===SRe},ERe="useFeatureStrategyProdGuardSettings:v2",UB=uT(ERe,{hide:!1}),TRe=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&Mn(["In review","Approved"],r.state)):!1,alert:s(Bt,{sx:{margin:"1rem 0"},severity:"warning",children:"You currently have a change request in review for this environment. Adding a new change will add the change to the existing change request, and all existing approvals will be reset. Are you sure you want to continue?"})}),WB=(e,t,n,r={})=>{const{isEnterprise:o}=St();return Dd(o(),e,t,n,r)},kRe=e=>fetch(e).then(xn("ChangeRequest")).then(t=>t.json()),f0=e=>{const{data:t,error:n,mutate:r}=WB([],kt(`api/admin/projects/${e}/change-requests/pending`),kRe);return{data:t,loading:!n&&!t,refetch:r,error:n}},ARe=({title:e,setTitle:t})=>S(fe,{sx:{paddingBottom:n=>n.spacing(2)},children:[s(re,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),s(ir,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),RRe=({enabled:e,onToggleEnabled:t})=>s(Gr,{control:s(pa,{name:"enabled",onChange:t,checked:e}),label:"Enabled – This strategy will be used when evaluating feature toggles."}),_Re=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),PRe=function(e){return"/"+e},HI={},Yd=function(t,n,r){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(i=>{if(i=PRe(i),i in HI)return;HI[i]=!0;const a=i.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let d=o.length-1;d>=0;d--){const p=o[d];if(p.href===i&&(!a||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":_Re,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((d,p)=>{u.addEventListener("load",d),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})},IRe=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const i=l=>{const u=l.target.value.split(/,\s?/).map(d=>d.trim());t(u)},a=l=>{if(l.key==="Backspace"){const c=l.target.value;if(c.endsWith(", ")){l.preventDefault();const u=c.slice(0,-2);t(u.split(/,\s*/))}}};return s(fn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},ORe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%",alignItems:"flex-start"}}})),$Re=x(fg)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),NRe=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),LRe=x(IRe)(()=>({width:"100%"})),DRe=x(fn)(()=>({width:"100%"})),MRe=({overrides:e,overridesDispatch:t})=>{const{context:n}=ga(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},i=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return s(ce,{children:e.map((a,l)=>{var p;const c=n.find(({name:f})=>f===a.contextName),u=((p=c==null?void 0:c.legalValues)==null?void 0:p.map(({value:f})=>f))||[],d=a.values.filter(f=>u.includes(f));return S(ORe,{children:[s($Re,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:a.contextName,options:r,onChange:f=>t({type:"UPDATE_TYPE_AT",payload:[l,f.target.value]})}),S(NRe,{children:[s(V,{condition:!!(u&&u.length>0),show:s($d,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(f,h)=>f===h,options:u,onChange:i(l),getOptionLabel:f=>f,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:f=>s(DRe,{...f,variant:"outlined",label:"Legal values"})}),elseShow:s(LRe,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),s(wt,{title:"Remove",arrow:!0,children:s(jt,{onClick:f=>{f.preventDefault(),t({type:"REMOVE",payload:l})},children:s(yo,{})})})]})]},`override=${l}`)})})},BRe=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((a,l)=>l!==t.payload);case"UPDATE_VALUES_AT":const[n,r]=t.payload;return e.map((a,l)=>l===n?{...a,values:r}:a);case"UPDATE_TYPE_AT":const[o,i]=t.payload;return e.map((a,l)=>l===o?{...a,contextName:i}:a)}},FRe=(e=[])=>g.useReducer(BRe,e);var ds=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(ds||{});const vg=e=>{var n;const{uiConfig:t}=St();return((n=t==null?void 0:t.flags)==null?void 0:n[e])||!1},zRe=Te.lazy(()=>Yd(()=>import("./ReactJSONEditor-59c8a094.js"),[])),jRe=x("div")(({theme:e})=>({position:"relative",backgroundColor:e.palette.neutral.light,display:"flex",flexDirection:"column",padding:e.spacing(3),marginBottom:e.spacing(3),borderRadius:e.shape.borderRadiusLarge,overflow:"hidden"})),URe=x("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),WRe=x(wt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),HB=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),VI=x(HB)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),HRe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),VRe=x(Gr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),GRe=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),GI=x(ir)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),qRe=x("div")(({theme:e})=>({marginLeft:e.spacing(3)})),KRe=x(ir)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),YRe=x("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),VB=x("div")(({theme:e})=>({display:"flex",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%"}}})),XRe=x(VB)({alignItems:"end",justifyContent:"space-between"}),JRe=x(fg)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),QRe=x(Ve)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),Gw=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"}],ZRe={type:"string",value:""},e_e=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:a})=>{const[l,c]=g.useState(e.name),[u,d]=g.useState(e.weightType===ds.FIX),[p,f]=g.useState(String(e.weight/10)),[h,m]=g.useState(e.payload||ZRe),[y,b]=FRe("overrides"in e?e.overrides||[]:[]),{context:v}=ga(),[w,C]=g.useState({}),k=vg("variantTypeNumber");g.useEffect(()=>{k&&!Gw.some(H=>H.key==="number")&&Gw.push({key:"number",label:"number"})},[k]);const A=H=>{C(j=>({...j,[H]:void 0}))},T=(H,j)=>{C(U=>({...U,[H]:j}))};g.useEffect(()=>{A("percentage"),o!=null&&o.includes("%")&&T("percentage","Total weight must equal 100%")},[o]);const _=!e.new,P=t.filter(({id:H,weightType:j})=>H!==e.id&&j===ds.VARIABLE).length>0,I=H=>{const j=H.weightType===ds.VARIABLE,U=t.some(N=>N.weightType===ds.FIX),R=t.filter(N=>N.weightType===ds.VARIABLE).length===1;return U&&R&&j},O=H=>{A("name"),q(H,e.id)||T("name","A variant with that name already exists for this environment."),c(H.trim())},$=H=>{(H===""||Y(H))&&f(H)},F=H=>{te(H)||T("payload",H.type==="json"?"Invalid json":"Invalid number")},D=()=>{v.length>0&&b({type:"ADD",payload:{contextName:v[0].name,values:[]}})},B=H=>!!H.length,q=(H,j)=>_||!t.some(U=>U.name===H&&U.id!==j),Y=H=>{if(!u)return!0;if(H===""||H.match(/\.[0-9]{2,}$/))return!1;const j=Number(H);return j>=0&&j<=100},te=H=>{try{return H.type==="json"&&JSON.parse(H.value),k&&H.type==="number"?!Number.isNaN(Number(H.value)):!0}catch{return!1}};return g.useEffect(()=>{const H={...e,name:l,weight:Number(u?p:100)*10,weightType:u?ds.FIX:ds.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:h.value?h:void 0,isValid:B(l)&&q(l,e.id)&&Y(p)&&te(h)&&!o};i||(H.overrides=y.map(j=>({contextName:j.contextName,values:j.values})).filter(j=>j.values&&j.values.length>0)),n(H)},[l,u,p,h,y]),g.useEffect(()=>{u||f(String(e.weight/10))},[e.weight]),S(jRe,{"data-testid":"VARIANT",children:[s(URe,{color:a}),s(WRe,{arrow:!0,title:I(e)?"You need to have at least one variable variant":"Delete variant",children:s("div",{children:s(jt,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:I(e),children:s(yo,{})})})}),S(XRe,{children:[S(YRe,{children:[s(HB,{children:"Variant name"}),s(HRe,{children:"This will be used to identify the variant in your code"}),s(GI,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:l,onChange:H=>O(H.target.value),disabled:_,required:!0})]}),s(V,{condition:P,show:S(qRe,{children:[s(VRe,{label:"Custom percentage",control:s(pa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:u,onChange:H=>d(H.target.checked)})}),s(KRe,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!w.percentage,errorText:w.percentage,value:p,onChange:H=>$(H.target.value),required:u,disabled:!u,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:s(ph,{position:"end",children:"%"})}})]})})]}),S(VI,{children:["Payload",s(Wi,{tooltip:"Passed along with the the variant object."})]}),S(VB,{children:[s(JRe,{id:"variant-payload-type",name:"type",label:"Type",value:h.type,options:Gw,onChange:H=>{A("payload"),m(j=>({...j,type:H.target.value}))}}),s(GRe,{children:s(V,{condition:h.type==="json",show:s(g.Suspense,{fallback:null,children:s(zRe,{content:{text:h.value},onChange:H=>m(j=>{var U;return{...j,value:"json"in H?((U=H.json)==null?void 0:U.toString())||"":H.text}})})}),elseShow:s(GI,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:h.type!=="string",rows:h.type==="string"||h.type==="number"?1:4,value:h.value,onChange:H=>{A("payload"),m(j=>({...j,value:H.target.value}))},placeholder:"",onBlur:()=>F(h),error:!!w.payload,errorText:w.payload})})})]}),i?null:S(ce,{children:[S(VI,{children:["Overrides",s(Wi,{tooltip:"Here you can specify which users should get this variant."})]}),s(MRe,{overrides:y,overridesDispatch:b}),s("div",{children:s(QRe,{onClick:D,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})};let Pm;const t_e=new Uint8Array(16);function n_e(){if(!Pm&&(Pm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pm(t_e)}const to=[];for(let e=0;e<256;++e)to.push((e+256).toString(16).slice(1));function r_e(e,t=0){return(to[e[t+0]]+to[e[t+1]]+to[e[t+2]]+to[e[t+3]]+"-"+to[e[t+4]]+to[e[t+5]]+"-"+to[e[t+6]]+to[e[t+7]]+"-"+to[e[t+8]]+to[e[t+9]]+"-"+to[e[t+10]]+to[e[t+11]]+to[e[t+12]]+to[e[t+13]]+to[e[t+14]]+to[e[t+15]]).toLowerCase()}const o_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qI={randomUUID:o_e};function KI(e,t,n){if(qI.randomUUID&&!t&&!e)return qI.randomUUID();e=e||{};const r=e.random||(e.rng||n_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return r_e(r)}const i_e=x(fe)(()=>({display:"flex",width:"100%",position:"relative"})),a_e=x(fe)(({theme:e})=>({position:"absolute",height:e.spacing(3),width:"100%",display:"flex",overflow:"hidden"})),s_e=x(fe)(()=>({height:"100%",display:"flex",flexDirection:"column",alignItems:"center",width:"100%"})),l_e=x(fe,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({height:e.spacing(1.8),width:"100%",position:"relative",background:e.palette.variants[t%e.palette.variants.length]})),c_e=x(fe)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),YI=x(re)(({theme:e})=>({marginY:e.spacing(1)})),u_e=x(fe)(()=>({display:"flex",alignItems:"center",marginLeft:"auto"})),GB=x(fe,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({display:"flex",alignItems:"center",marginRight:e.spacing(2),"& div":{width:e.spacing(1.6),height:e.spacing(1.6),borderRadius:"50%",marginRight:e.spacing(1),background:e.palette.variants[t%e.palette.variants.length]}})),d_e=x(re)(({theme:e})=>({marginTop:e.spacing(1)})),p_e=({variants:e})=>e.length<1?null:S(fe,{sx:t=>({marginTop:t.spacing(2)}),children:[s(f_e,{variants:e}),S(i_e,{children:[s(a_e,{}),e.map((t,n)=>{const r=t.weight/10;return s($l,{variant:"custom",arrow:!0,onClick:o=>o.preventDefault(),titleComponent:s(v_e,{variant:t,index:n}),children:S(fe,{style:{width:`${r}%`},children:[" ",S(s_e,{children:[s(l_e,{index:n}),S(d_e,{variant:"subtitle2",children:[r,"%"]})]})]})},n)})]})]}),f_e=({variants:e})=>S(c_e,{children:[S(YI,{variant:"body2",children:["Feature variants (",e.length,")"]}),s(u_e,{children:e.map((t,n)=>S(GB,{index:n,children:[s(fe,{}),s(YI,{variant:"body2",children:t.name})]},n))})]}),h_e=x(fe)(()=>({display:"flex",flexDirection:"column"})),g_e=x(fe)(()=>({display:"flex",alignItems:"center",minWidth:"250px"})),m_e=x(fe)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column"})),y_e=x(re)(({theme:e})=>({marginBottom:e.spacing(1)})),v_e=({variant:e,index:t})=>S(h_e,{children:[S(g_e,{children:[s(GB,{index:t,children:s(fe,{})}),S(re,{variant:"subtitle2",children:[e.weight/10,"% - ",e.name]})]}),e.payload?S(m_e,{children:[s(y_e,{variant:"body2",children:"Payload"}),s(V,{condition:e.payload.type==="json",show:s("code",{children:e.payload.value}),elseShow:s(re,{variant:"body2",children:e.payload.value})})]}):null]}),b_e=()=>S(Bt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",s(w_e,{}),"."]}),Xze=()=>S(Bt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",s("b",{children:"variants inside strategies"}),". ",s(S_e,{})]}),w_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),S_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),x_e=x("div")({display:"flex",flexDirection:"column"}),C_e=({strategy:e,setStrategy:t,projectId:n,environment:r})=>{const{trackEvent:o}=jn(),[i,a]=g.useState([]),l=on(),c=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>{a((e.variants||[]).map(p=>({...p,new:!1,isValid:!0,id:KI(),overrides:[]})))},[]),g.useEffect(()=>{t(p=>({...p,variants:i.map(f=>({stickiness:c,name:f.name,weight:f.weight,payload:f.payload,weightType:f.weightType}))}))},[c,JSON.stringify(i)]);const u=(p,f)=>{a(h=>H3(h.map(m=>m.id===f?p:m),1e3))},d=()=>{const p=KI();a(f=>[...f,{name:"",weightType:ds.VARIABLE,weight:0,stickiness:c,new:!0,isValid:!1,id:p}]),o("strategy-variants",{props:{eventType:"variant added"}})};return S(ce,{children:[S(re,{component:"h3",sx:{m:0,display:"flex",gap:"1ch"},variant:"h3",children:["Variants",s(Wi,{htmlTooltip:!0,tooltip:S(ce,{children:[s("span",{children:"Variants allow to attach one or more values to this strategy. Variants at the strategy level override variants at the feature level."}),s(Nr,{target:"_blank",href:"https://docs.getunleash.io/reference/strategy-variants",children:"Learn more"})]})})]}),S(x_e,{children:[s(b_e,{}),i.map((p,f)=>s(e_e,{disableOverrides:!0,variant:p,variants:i,updateVariant:h=>u(h,p.id),removeVariant:()=>a(h=>H3(h.filter(m=>m.id!==p.id),1e3)),decorationColor:l.palette.variants[f%l.palette.variants.length]},p.id))]}),s(Io,{onClick:d,variant:"outlined",permission:f9,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",children:"Add variant"}),s(p_e,{variants:i})]})},E_e=x("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),Up=x("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),T_e=x("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),qB=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:a,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:p,isChangeRequest:f})=>{const{trackEvent:h}=jn(),[m,y]=g.useState(!1),b=Tk(l.constraints),v=CRe(t,n),w=cd(r,e,n),{strategyDefinition:C}=kk(l==null?void 0:l.name),{data:k}=f0(t.project),{changeRequestInReviewOrApproved:A,alert:T}=TRe(k),_=A(n||""),P=_?"Add to existing change request":"Add change to draft",I=pt(),{uiConfig:O,error:$,loading:F}=St();if($)throw $;if(F||!C)return null;const D=H=>C.parameters.find(j=>j.name===H),B=(H,j)=>{const U=yRe(D(H),j);return U?(p.setFormError(H,U),!1):(p.removeFormError(H),!0)},q=()=>C.parameters.map(H=>H.name).map(H=>{var j;return B(H,(j=l.parameters)==null?void 0:j[H])}).every(Boolean),Y=()=>{I(Ak(t.project,t.name))};return S(E_e,{onSubmit:async H=>{var j;Array.isArray(l.variants)&&((j=l.variants)==null?void 0:j.length)>0&&h("strategy-variants",{props:{eventType:"submitted"}}),H.preventDefault(),q()&&(v&&!f?y(!0):o())},children:[s(V,{condition:_,show:T,elseShow:s(V,{condition:!!f,show:s(wRe,{environment:n})})}),s(BCe,{projectId:t.project,featureId:t.name,environmentId:n,children:s(V,{condition:!!f,show:S(Bt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as these changes are approved and applied."]}),elseShow:S(Bt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit ",s("strong",{children:"save"}),"."]})})}),s(Up,{}),s(ARe,{title:l.title||"",setTitle:H=>{c(j=>({...j,title:H}))}}),s(mRe,{segments:u,setSegments:d,projectId:e}),s(XAe,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c}),s(Up,{}),s(NCe,{strategy:l,strategyDefinition:C,setStrategy:c,validateParameter:B,errors:p,hasAccess:w}),s(Up,{}),s(V,{condition:l.parameters!=null&&"stickiness"in l.parameters,show:s(C_e,{strategy:l,setStrategy:c,environment:n,projectId:e})}),s(Up,{}),s(RRe,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(H=>({...H,disabled:!H.disabled}))}),s(Up,{}),S(T_e,{children:[s(Io,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:a||!b||p.hasFormErrors(),"data-testid":yse,children:f?P:"Save strategy"}),s(Ve,{type:"button",color:"primary",onClick:i||Y,disabled:a,children:"Cancel"}),s(xRe,{open:m,onClose:()=>y(!1),onClick:o,loading:a,label:"Save strategy"})]})]})},XI=e=>{const t=new URLSearchParams(window.location.search).get(e);if(!t)throw new Error(`Missing required query param: ${e}`);return t},k_e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{addStrategyToFeature:async(u,d,p,f)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies`,m=t(h,{method:"POST",body:JSON.stringify(f)},"addStrategyToFeature");return(await e(m.caller,m.id)).json()},updateStrategyOnFeature:async(u,d,p,f,h)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${f}`,y=t(m,{method:"PUT",body:JSON.stringify(h)},"updateStrategyOnFeature");await e(y.caller,y.id)},deleteStrategyFromFeature:async(u,d,p,f)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${f}`,m=t(h,{method:"DELETE"},"deleteStrategyFromFeature");await e(m.caller,m.id)},setStrategiesSortOrder:async(u,d,p,f)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/set-sort-order`,m=t(h,{method:"POST",body:JSON.stringify(f)},"setStrategiesSortOrderOnFeature");await e(m.caller,m.id)},setStrategyDisabledState:async(u,d,p,f,h)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${f}`,y=t(m,{method:"PATCH",body:JSON.stringify([{path:"/disabled",value:h,op:"replace"}])},"setStrategyDisabledState");await e(y.caller,y.id)},loading:r,errors:n}},KB=()=>{const[e,t]=g.useState({}),n=g.useCallback(a=>e[a],[e]),r=g.useCallback((a,l)=>{t(Ei(c=>{c[a]=l}))},[t]),o=g.useCallback(a=>{t(Ei(l=>{delete l[a]}))},[t]),i=g.useCallback(()=>Object.values(e).some(Boolean),[e]);return{getFormError:n,setFormError:r,removeFormError:o,hasFormErrors:i}},A_e=(e,t)=>{const n=t.parameters.map(r=>r.name);return Object.fromEntries(Object.entries(e).sort((r,o)=>n.indexOf(r[0])-n.indexOf(o[0])))};var JI=Object.prototype.hasOwnProperty;function QI(e,t,n){for(n of e.keys())if(Bf(n,t))return n}function Bf(e,t){var n,r,o;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Bf(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(o=r,o&&typeof o=="object"&&(o=QI(t,o),!o)||!t.has(o))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(o=r[0],o&&typeof o=="object"&&(o=QI(t,o),!o)||!Bf(r[1],t.get(o)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(JI.call(e,n)&&++r&&!JI.call(t,n)||!(n in t)||!Bf(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var YB={exports:{}};(function(e,t){(function(n,r){var o=r(n);e.exports=o})(xi,function(n){var r=["N","E","A","D"];function o(P,I){P.super_=I,P.prototype=Object.create(I.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}})}function i(P,I){Object.defineProperty(this,"kind",{value:P,enumerable:!0}),I&&I.length&&Object.defineProperty(this,"path",{value:I,enumerable:!0})}function a(P,I,O){a.super_.call(this,"E",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0}),Object.defineProperty(this,"rhs",{value:O,enumerable:!0})}o(a,i);function l(P,I){l.super_.call(this,"N",P),Object.defineProperty(this,"rhs",{value:I,enumerable:!0})}o(l,i);function c(P,I){c.super_.call(this,"D",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0})}o(c,i);function u(P,I,O){u.super_.call(this,"A",P),Object.defineProperty(this,"index",{value:I,enumerable:!0}),Object.defineProperty(this,"item",{value:O,enumerable:!0})}o(u,i);function d(P,I,O){var $=P.slice((O||I)+1||P.length);return P.length=I<0?P.length+I:I,P.push.apply(P,$),P}function p(P){var I=typeof P;return I!=="object"?I:P===Math?"math":P===null?"null":Array.isArray(P)?"array":Object.prototype.toString.call(P)==="[object Date]"?"date":typeof P.toString=="function"&&/^\/.*\//.test(P.toString())?"regexp":"object"}function f(P){var I=0;if(P.length===0)return I;for(var O=0;O<P.length;O++){var $=P.charCodeAt(O);I=(I<<5)-I+$,I=I&I}return I}function h(P){var I=0,O=p(P);if(O==="array"){P.forEach(function(q){I+=h(q)});var $="[type: array, hash: "+I+"]";return I+f($)}if(O==="object"){for(var F in P)if(P.hasOwnProperty(F)){var D="[ type: object, key: "+F+", value hash: "+h(P[F])+"]";I+=f(D)}return I}var B="[ type: "+O+" ; value: "+P+"]";return I+f(B)}function m(P,I,O,$,F,D,B,q){O=O||[],F=F||[],B=B||[];var Y=F.slice(0);if(typeof D<"u"&&D!==null){if($){if(typeof $=="function"&&$(Y,D))return;if(typeof $=="object"){if($.prefilter&&$.prefilter(Y,D))return;if($.normalize){var te=$.normalize(Y,D,P,I);te&&(P=te[0],I=te[1])}}}Y.push(D)}p(P)==="regexp"&&p(I)==="regexp"&&(P=P.toString(),I=I.toString());var H=typeof P,j=typeof I,U,R,N,X,se=H!=="undefined"||B&&B.length>0&&B[B.length-1].lhs&&Object.getOwnPropertyDescriptor(B[B.length-1].lhs,D),we=j!=="undefined"||B&&B.length>0&&B[B.length-1].rhs&&Object.getOwnPropertyDescriptor(B[B.length-1].rhs,D);if(!se&&we)O.push(new l(Y,I));else if(!we&&se)O.push(new c(Y,P));else if(p(P)!==p(I))O.push(new a(Y,P,I));else if(p(P)==="date"&&P-I!==0)O.push(new a(Y,P,I));else if(H==="object"&&P!==null&&I!==null){for(U=B.length-1;U>-1;--U)if(B[U].lhs===P){X=!0;break}if(X)P!==I&&O.push(new a(Y,P,I));else{if(B.push({lhs:P,rhs:I}),Array.isArray(P)){for(q&&(P.sort(function(ee,ae){return h(ee)-h(ae)}),I.sort(function(ee,ae){return h(ee)-h(ae)})),U=I.length-1,R=P.length-1;U>R;)O.push(new u(Y,U,new l(void 0,I[U--])));for(;R>U;)O.push(new u(Y,R,new c(void 0,P[R--])));for(;U>=0;--U)m(P[U],I[U],O,$,Y,U,B,q)}else{var ge=Object.keys(P),Ie=Object.keys(I);for(U=0;U<ge.length;++U)N=ge[U],X=Ie.indexOf(N),X>=0?(m(P[N],I[N],O,$,Y,N,B,q),Ie[X]=null):m(P[N],void 0,O,$,Y,N,B,q);for(U=0;U<Ie.length;++U)N=Ie[U],N&&m(void 0,I[N],O,$,Y,N,B,q)}B.length=B.length-1}}else P!==I&&(H==="number"&&isNaN(P)&&isNaN(I)||O.push(new a(Y,P,I)))}function y(P,I,O,$,F){var D=[];if(m(P,I,D,$,null,null,null,F),O)for(var B=0;B<D.length;++B)O(D[B]);return D}function b(P,I,O,$,F,D,B){return m(P,I,O,$,F,D,B,!0)}function v(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,D=y(P,I,F,O);return $||(D.length?D:void 0)}function w(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,D=y(P,I,F,O,!0);return $||(D.length?D:void 0)}function C(P,I,O){if(O.path&&O.path.length){var $=P[I],F,D=O.path.length-1;for(F=0;F<D;F++)$=$[O.path[F]];switch(O.kind){case"A":C($[O.path[F]],O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}else switch(O.kind){case"A":C(P[I],O.index,O.item);break;case"D":P=d(P,I);break;case"E":case"N":P[I]=O.rhs;break}return P}function k(P,I,O){if(typeof O>"u"&&I&&~r.indexOf(I.kind)&&(O=I),P&&O&&O.kind){for(var $=P,F=-1,D=O.path?O.path.length-1:0;++F<D;)typeof $[O.path[F]]>"u"&&($[O.path[F]]=typeof O.path[F+1]<"u"&&typeof O.path[F+1]=="number"?[]:{}),$=$[O.path[F]];switch(O.kind){case"A":O.path&&typeof $[O.path[F]]>"u"&&($[O.path[F]]=[]),C(O.path?$[O.path[F]]:$,O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}}function A(P,I,O){if(O.path&&O.path.length){var $=P[I],F,D=O.path.length-1;for(F=0;F<D;F++)$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}else switch(O.kind){case"A":A(P[I],O.index,O.item);break;case"D":P[I]=O.lhs;break;case"E":P[I]=O.lhs;break;case"N":P=d(P,I);break}return P}function T(P,I,O){if(P&&I&&O&&O.kind){var $=P,F,D;for(D=O.path.length-1,F=0;F<D;F++)typeof $[O.path[F]]>"u"&&($[O.path[F]]={}),$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}}function _(P,I,O){if(P&&I){var $=function(F){(!O||O(P,I,F))&&k(P,I,F)};y(P,I,$)}}return Object.defineProperties(v,{diff:{value:v,enumerable:!0},orderIndependentDiff:{value:w,enumerable:!0},observableDiff:{value:y,enumerable:!0},orderIndependentObservableDiff:{value:b,enumerable:!0},orderIndepHash:{value:h,enumerable:!0},applyDiff:{value:_,enumerable:!0},applyChange:{value:k,enumerable:!0},revertChange:{value:T,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),v.DeepDiff=v,n&&(n.DeepDiff=v),v})})(YB);var R_e=YB.exports;const __e={A:" ",E:" ",D:"-",N:"+"},Xd=({entry:e,sort:t=(n,r)=>n.key.localeCompare(r.key)})=>{const n=Kh(),r={A:{color:n.palette.eventLog.edited},E:{color:n.palette.eventLog.edited},D:{color:n.palette.eventLog.diffSub},N:{color:n.palette.eventLog.diffAdd}},o=e.data&&e.preData?R_e.diff(e.preData,e.data):void 0,i=(c,u)=>{let d;return c.lhs!==void 0?d=S("div",{style:r.D,children:["- ",u,": ",JSON.stringify(c.lhs)]}):c.rhs!==void 0&&(d=S("div",{style:r.N,children:["+ ",u,": ",JSON.stringify(c.rhs)]})),d},a=(c,u)=>{var f;let d;const p=((f=c.path)==null?void 0:f.join("."))??c.index;if(c.item)d=i(c.item,p);else if(c.lhs!==void 0&&c.rhs!==void 0)d=S("div",{children:[S("div",{style:r.D,children:["- ",p,": ",JSON.stringify(c.lhs)]}),S("div",{style:r.N,children:["+ ",p,": ",JSON.stringify(c.rhs)]})]});else{const h=JSON.stringify(c.rhs||c.item);d=S("div",{style:r[c.kind],children:[__e[c.kind]," ",p,h?`: ${h}`:c.kind==="D"?" (deleted)":""]})}return{key:p.toString(),value:s("div",{children:d},u),index:u}};let l=[];if(o)l=o.map(a).sort(t).map(({value:c})=>c);else if(e.data==null||e.preData==null){const c=e.data||e.preData;l=[s("div",{style:e.data?r.N:r.D,children:JSON.stringify(c,null,2)},0)]}return s("pre",{style:{overflowX:"auto",overflowY:"hidden"},tabIndex:0,children:s("code",{children:l.length===0?"(no changes)":l})})},P_e=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=on(),a=or(i.breakpoints.down("sm")),l=g.useMemo(()=>{const c={...BL,padding:`${i.spacing(3)} ${i.spacing(4)}`,boxShadow:i.boxShadows.elevated,borderRadius:i.shape.borderRadiusLarge,backgroundColor:i.palette.background.paper,maxWidth:i.spacing(75),zIndex:i.zIndex.mobileStepper};return a?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,a]);return S(DE,{mounted:t,start:l,enter:FL,children:[s(re,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),s(re,{variant:"body1",sx:{my:2,mb:3},children:"The data you have been working on is stale, would you like to refresh your data? This may happen if someone has been making changes to the data while you were working."}),s(Xd,{entry:{preData:o,data:r}}),s(Ve,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},I_e=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},XB=(e,t,n,r)=>{const{data:o,refetch:i}=I_e(e),[a,l]=g.useState(t||null),[c,u]=g.useState(!1),d=f=>{u(!1),l(f)},p=f=>f&&(r&&typeof r=="function"?r(f):f);return g.useEffect(()=>{a===null&&l(t)},[t]),g.useEffect(()=>{if(!a||!o)return;Bf(p(a),p(o))||u(!0)},[o]),{data:a,refetch:i,staleDataNotification:s(P_e,{cache:p(a),data:p(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}};function fC(e,t){if(Array.isArray(e))return e.map(n=>fC(n,t));if(typeof e=="object"&&e!==null){const n={};for(const[r,o]of Object.entries(e))r!==t&&(n[r]=fC(o,t));return n}return e}const JB=e=>{const t={...e};return fC(t,"lastSeenAt")},Jd=()=>{const{trackEvent:e}=jn(),{makeRequest:t,createRequest:n,errors:r,loading:o}=Gn({propagateErrors:!0});return{addChange:async(h,m,y)=>{e("change_request",{props:{eventType:"change added"}});const b=`api/admin/projects/${h}/environments/${m}/change-requests`,v=n(b,{method:"POST",body:JSON.stringify(y)});try{return(await t(v.caller,v.id)).json()}catch(w){throw w}},editChange:async(h,m,y,b)=>{const v=`api/admin/projects/${h}/change-requests/${m}/changes/${y}`,w=n(v,{method:"PUT",body:JSON.stringify(b)});try{return await t(w.caller,w.id)}catch(C){throw C}},changeState:async(h,m,y)=>{e("change_request",{props:{eventType:y.state}});const b=`api/admin/projects/${h}/change-requests/${m}/state`,v=n(b,{method:"PUT",body:JSON.stringify(y)});try{return(await t(v.caller,v.id)).json()}catch(w){throw w}},discardChange:async(h,m,y)=>{const b=`api/admin/projects/${h}/change-requests/${m}/changes/${y}`,v=n(b,{method:"DELETE"});try{return await t(v.caller,v.id)}catch(w){throw w}},updateChangeRequestEnvironmentConfig:async({project:h,enabled:m,environment:y,requiredApprovals:b})=>{const v=`api/admin/projects/${h}/environments/${y}/change-requests/config`,w=n(v,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:m,requiredApprovals:b})});try{return await t(w.caller,w.id)}catch(C){throw C}},discardDraft:async(h,m)=>{const y=`api/admin/projects/${h}/change-requests/${m}`,b=n(y,{method:"DELETE"});try{return await t(b.caller,b.id)}catch(v){throw v}},addComment:async(h,m,y)=>{e("change_request",{props:{eventType:"comment added"}});const b=`/api/admin/projects/${h}/change-requests/${m}/comments`,v=n(b,{method:"POST",body:JSON.stringify({text:y})});try{return await t(v.caller,v.id)}catch(w){throw w}},updateTitle:async(h,m,y)=>{e("change_request",{props:{eventType:"title updated"}});const b=`api/admin/projects/${h}/change-requests/${m}/title`,v=n(b,{method:"PUT",body:JSON.stringify({title:y})});try{await t(v.caller,v.id)}catch(w){throw w}},errors:r,loading:o}},O_e=()=>{const[e,t]=g.useState(""),{trackEvent:n}=jn();return{setPreviousTitle:t,trackTitle:(o="")=>{o===e&&n("strategyTitle",{props:{action:"none",on:"edit"}}),e===""&&o!==""&&n("strategyTitle",{props:{action:"added",on:"edit"}}),e!==""&&o===""&&n("strategyTitle",{props:{action:"removed",on:"edit"}}),e!==""&&o!==""&&o!==e&&n("strategyTitle",{props:{action:"edited",on:"edit"}})}}},Jze=()=>{const e=lr("projectId"),t=lr("featureId"),n=XI("environmentId"),r=XI("strategyId"),[o,i]=g.useState({}),[a,l]=g.useState([]),{updateStrategyOnFeature:c,loading:u}=k_e(),{strategyDefinition:d}=kk(o.name),{setToastData:p,setToastApiError:f}=Ot(),h=KB(),{uiConfig:m}=St(),{unleashUrl:y}=m,b=pt(),{addChange:v}=Jd(),{isChangeRequestConfigured:w}=jc(e),{refetch:C}=f0(e),{setPreviousTitle:k}=O_e(),{feature:A,refetchFeature:T}=Ja(e,t),_=g.useRef(A),{data:P,staleDataNotification:I,forceRefreshCache:O}=XB({unleashGetter:Ja,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},A,{afterSubmitAction:T},JB);g.useEffect(()=>{_.current.name===""&&A.name&&(O(A),_.current=A)},[A]);const{segments:$,refetchSegments:F}=Ll(r);g.useEffect(()=>{const te=P==null?void 0:P.environments.flatMap(H=>H.strategies).find(H=>H.id===r);i(H=>({...H,...te})),k((te==null?void 0:te.title)||"")},[r,P]),g.useEffect(()=>{$&&l($)},[JSON.stringify($)]);const D=$_e(o,a),B=async te=>{await c(e,t,n,r,te),await F(),p({title:"Strategy updated",type:"success",confetti:!0})},q=async te=>{await v(e,n,{action:"updateStrategy",feature:t,payload:{...te,id:r}}),p({title:"Change added to draft",type:"success",confetti:!0}),C()},Y=async()=>{try{w(n)?await q(D):await B(D),T(),b(Ak(e,t))}catch(te){f(gt(te))}};return!o.id||!d||!P?null:S(Er,{modal:!0,title:ks(o.name??""),description:L_e,documentationLink:D_e,documentationLinkLabel:M_e,formatApiCode:()=>N_e(e,t,n,r,D,d,y),children:[s(qB,{projectId:e,feature:P,strategy:o,setStrategy:i,segments:a,setSegments:l,environmentId:n,onSubmit:Y,loading:u,permission:H1,errors:h,isChangeRequest:w(n)}),I]})},$_e=(e,t)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:t.map(n=>n.id),disabled:e.disabled??!1}),Ak=(e,t)=>`/projects/${e}/features/${t}`,Rk=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},N_e=(e,t,n,r,o,i,a)=>{if(!a)return"";const l={...o,parameters:A_e(o.parameters??{},i)},c=`${a}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${c}' \\
315
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Rke={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua and Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Åland Islands",AZ:"Azerbaijan",BA:"Bosnia and Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthélemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos Islands",CD:"Democratic Republic of the Congo",CF:"Central African Republic",CG:"Republic of the Congo",CH:"Switzerland",CI:"Ivory Coast",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cabo Verde",CW:"Curaçao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GG:"Guernsey",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia and the South Sandwich Islands",GT:"Guatemala",GU:"Guam",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Jersey",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts and Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"North Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"Saint Pierre and Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestine",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Réunion",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"Saint Helena, Ascension and Tristan da Cunha",SI:"Slovenia",SJ:"Svalbard and Jan Mayen",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome and Principe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks and Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Türkiye",TT:"Trinidad and Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States of America",UY:"Uruguay",UZ:"Uzbekistan",VA:"Holy See",VC:"Saint Vincent and the Grenadines",VE:"Venezuela",VG:"Virgin Islands (UK)",VI:"Virgin Islands (US)",VN:"Vietnam",VU:"Vanuatu",WF:"Wallis and Futuna",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"},_ke={"Africa/Abidjan":{u:0,c:["CI","BF","GH","GM","GN","IS","ML","MR","SH","SL","SN","TG"]},"Africa/Accra":{a:"Africa/Abidjan",c:["GH"],r:1},"Africa/Addis_Ababa":{a:"Africa/Nairobi",c:["ET"],r:1},"Africa/Algiers":{u:60,c:["DZ"]},"Africa/Asmara":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Asmera":{a:"Africa/Nairobi",c:["ER"],r:1},"Africa/Bamako":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Bangui":{a:"Africa/Lagos",c:["CF"],r:1},"Africa/Banjul":{a:"Africa/Abidjan",c:["GM"],r:1},"Africa/Bissau":{u:0,c:["GW"]},"Africa/Blantyre":{a:"Africa/Maputo",c:["MW"],r:1},"Africa/Brazzaville":{a:"Africa/Lagos",c:["CG"],r:1},"Africa/Bujumbura":{a:"Africa/Maputo",c:["BI"],r:1},"Africa/Cairo":{u:120,d:180,c:["EG"]},"Africa/Casablanca":{u:60,d:0,c:["MA"]},"Africa/Ceuta":{u:60,d:120,c:["ES"]},"Africa/Conakry":{a:"Africa/Abidjan",c:["GN"],r:1},"Africa/Dakar":{a:"Africa/Abidjan",c:["SN"],r:1},"Africa/Dar_es_Salaam":{a:"Africa/Nairobi",c:["TZ"],r:1},"Africa/Djibouti":{a:"Africa/Nairobi",c:["DJ"],r:1},"Africa/Douala":{a:"Africa/Lagos",c:["CM"],r:1},"Africa/El_Aaiun":{u:60,d:0,c:["EH"]},"Africa/Freetown":{a:"Africa/Abidjan",c:["SL"],r:1},"Africa/Gaborone":{a:"Africa/Maputo",c:["BW"],r:1},"Africa/Harare":{a:"Africa/Maputo",c:["ZW"],r:1},"Africa/Johannesburg":{u:120,c:["ZA","LS","SZ"]},"Africa/Juba":{u:120,c:["SS"]},"Africa/Kampala":{a:"Africa/Nairobi",c:["UG"],r:1},"Africa/Khartoum":{u:120,c:["SD"]},"Africa/Kigali":{a:"Africa/Maputo",c:["RW"],r:1},"Africa/Kinshasa":{a:"Africa/Lagos",c:["CD"],r:1},"Africa/Lagos":{u:60,c:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},"Africa/Libreville":{a:"Africa/Lagos",c:["GA"],r:1},"Africa/Lome":{a:"Africa/Abidjan",c:["TG"],r:1},"Africa/Luanda":{a:"Africa/Lagos",c:["AO"],r:1},"Africa/Lubumbashi":{a:"Africa/Maputo",c:["CD"],r:1},"Africa/Lusaka":{a:"Africa/Maputo",c:["ZM"],r:1},"Africa/Malabo":{a:"Africa/Lagos",c:["GQ"],r:1},"Africa/Maputo":{u:120,c:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},"Africa/Maseru":{a:"Africa/Johannesburg",c:["LS"],r:1},"Africa/Mbabane":{a:"Africa/Johannesburg",c:["SZ"],r:1},"Africa/Mogadishu":{a:"Africa/Nairobi",c:["SO"],r:1},"Africa/Monrovia":{u:0,c:["LR"]},"Africa/Nairobi":{u:180,c:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},"Africa/Ndjamena":{u:60,c:["TD"]},"Africa/Niamey":{a:"Africa/Lagos",c:["NE"],r:1},"Africa/Nouakchott":{a:"Africa/Abidjan",c:["MR"],r:1},"Africa/Ouagadougou":{a:"Africa/Abidjan",c:["BF"],r:1},"Africa/Porto-Novo":{a:"Africa/Lagos",c:["BJ"],r:1},"Africa/Sao_Tome":{u:0,c:["ST"]},"Africa/Timbuktu":{a:"Africa/Abidjan",c:["ML"],r:1},"Africa/Tripoli":{u:120,c:["LY"]},"Africa/Tunis":{u:60,c:["TN"]},"Africa/Windhoek":{u:120,c:["NA"]},"America/Adak":{u:-600,d:-540,c:["US"]},"America/Anchorage":{u:-540,d:-480,c:["US"]},"America/Anguilla":{a:"America/Puerto_Rico",c:["AI"],r:1},"America/Antigua":{a:"America/Puerto_Rico",c:["AG"],r:1},"America/Araguaina":{u:-180,c:["BR"]},"America/Argentina/Buenos_Aires":{u:-180,c:["AR"]},"America/Argentina/Catamarca":{u:-180,c:["AR"]},"America/Argentina/ComodRivadavia":{a:"America/Argentina/Catamarca",r:1},"America/Argentina/Cordoba":{u:-180,c:["AR"]},"America/Argentina/Jujuy":{u:-180,c:["AR"]},"America/Argentina/La_Rioja":{u:-180,c:["AR"]},"America/Argentina/Mendoza":{u:-180,c:["AR"]},"America/Argentina/Rio_Gallegos":{u:-180,c:["AR"]},"America/Argentina/Salta":{u:-180,c:["AR"]},"America/Argentina/San_Juan":{u:-180,c:["AR"]},"America/Argentina/San_Luis":{u:-180,c:["AR"]},"America/Argentina/Tucuman":{u:-180,c:["AR"]},"America/Argentina/Ushuaia":{u:-180,c:["AR"]},"America/Aruba":{a:"America/Puerto_Rico",c:["AW"],r:1},"America/Asuncion":{u:-240,d:-180,c:["PY"]},"America/Atikokan":{a:"America/Panama",c:["CA"],r:1},"America/Atka":{a:"America/Adak",r:1},"America/Bahia":{u:-180,c:["BR"]},"America/Bahia_Banderas":{u:-360,c:["MX"]},"America/Barbados":{u:-240,c:["BB"]},"America/Belem":{u:-180,c:["BR"]},"America/Belize":{u:-360,c:["BZ"]},"America/Blanc-Sablon":{a:"America/Puerto_Rico",c:["CA"],r:1},"America/Boa_Vista":{u:-240,c:["BR"]},"America/Bogota":{u:-300,c:["CO"]},"America/Boise":{u:-420,d:-360,c:["US"]},"America/Buenos_Aires":{a:"America/Argentina/Buenos_Aires",r:1},"America/Cambridge_Bay":{u:-420,d:-360,c:["CA"]},"America/Campo_Grande":{u:-240,c:["BR"]},"America/Cancun":{u:-300,c:["MX"]},"America/Caracas":{u:-240,c:["VE"]},"America/Catamarca":{a:"America/Argentina/Catamarca",r:1},"America/Cayenne":{u:-180,c:["GF"]},"America/Cayman":{a:"America/Panama",c:["KY"],r:1},"America/Chicago":{u:-360,d:-300,c:["US"]},"America/Chihuahua":{u:-360,c:["MX"]},"America/Ciudad_Juarez":{u:-420,d:-360,c:["MX"]},"America/Coral_Harbour":{a:"America/Panama",c:["CA"],r:1},"America/Cordoba":{a:"America/Argentina/Cordoba",r:1},"America/Costa_Rica":{u:-360,c:["CR"]},"America/Creston":{a:"America/Phoenix",c:["CA"],r:1},"America/Cuiaba":{u:-240,c:["BR"]},"America/Curacao":{a:"America/Puerto_Rico",c:["CW"],r:1},"America/Danmarkshavn":{u:0,c:["GL"]},"America/Dawson":{u:-420,c:["CA"]},"America/Dawson_Creek":{u:-420,c:["CA"]},"America/Denver":{u:-420,d:-360,c:["US"]},"America/Detroit":{u:-300,d:-240,c:["US"]},"America/Dominica":{a:"America/Puerto_Rico",c:["DM"],r:1},"America/Edmonton":{u:-420,d:-360,c:["CA"]},"America/Eirunepe":{u:-300,c:["BR"]},"America/El_Salvador":{u:-360,c:["SV"]},"America/Ensenada":{a:"America/Tijuana",r:1},"America/Fort_Nelson":{u:-420,c:["CA"]},"America/Fort_Wayne":{a:"America/Indiana/Indianapolis",r:1},"America/Fortaleza":{u:-180,c:["BR"]},"America/Glace_Bay":{u:-240,d:-180,c:["CA"]},"America/Godthab":{a:"America/Nuuk",r:1},"America/Goose_Bay":{u:-240,d:-180,c:["CA"]},"America/Grand_Turk":{u:-300,d:-240,c:["TC"]},"America/Grenada":{a:"America/Puerto_Rico",c:["GD"],r:1},"America/Guadeloupe":{a:"America/Puerto_Rico",c:["GP"],r:1},"America/Guatemala":{u:-360,c:["GT"]},"America/Guayaquil":{u:-300,c:["EC"]},"America/Guyana":{u:-240,c:["GY"]},"America/Halifax":{u:-240,d:-180,c:["CA"]},"America/Havana":{u:-300,d:-240,c:["CU"]},"America/Hermosillo":{u:-420,c:["MX"]},"America/Indiana/Indianapolis":{u:-300,d:-240,c:["US"]},"America/Indiana/Knox":{u:-360,d:-300,c:["US"]},"America/Indiana/Marengo":{u:-300,d:-240,c:["US"]},"America/Indiana/Petersburg":{u:-300,d:-240,c:["US"]},"America/Indiana/Tell_City":{u:-360,d:-300,c:["US"]},"America/Indiana/Vevay":{u:-300,d:-240,c:["US"]},"America/Indiana/Vincennes":{u:-300,d:-240,c:["US"]},"America/Indiana/Winamac":{u:-300,d:-240,c:["US"]},"America/Indianapolis":{a:"America/Indiana/Indianapolis",r:1},"America/Inuvik":{u:-420,d:-360,c:["CA"]},"America/Iqaluit":{u:-300,d:-240,c:["CA"]},"America/Jamaica":{u:-300,c:["JM"]},"America/Jujuy":{a:"America/Argentina/Jujuy",r:1},"America/Juneau":{u:-540,d:-480,c:["US"]},"America/Kentucky/Louisville":{u:-300,d:-240,c:["US"]},"America/Kentucky/Monticello":{u:-300,d:-240,c:["US"]},"America/Knox_IN":{a:"America/Indiana/Knox",r:1},"America/Kralendijk":{a:"America/Puerto_Rico",c:["BQ"],r:1},"America/La_Paz":{u:-240,c:["BO"]},"America/Lima":{u:-300,c:["PE"]},"America/Los_Angeles":{u:-480,d:-420,c:["US"]},"America/Louisville":{a:"America/Kentucky/Louisville",r:1},"America/Lower_Princes":{a:"America/Puerto_Rico",c:["SX"],r:1},"America/Maceio":{u:-180,c:["BR"]},"America/Managua":{u:-360,c:["NI"]},"America/Manaus":{u:-240,c:["BR"]},"America/Marigot":{a:"America/Puerto_Rico",c:["MF"],r:1},"America/Martinique":{u:-240,c:["MQ"]},"America/Matamoros":{u:-360,d:-300,c:["MX"]},"America/Mazatlan":{u:-420,c:["MX"]},"America/Mendoza":{a:"America/Argentina/Mendoza",r:1},"America/Menominee":{u:-360,d:-300,c:["US"]},"America/Merida":{u:-360,c:["MX"]},"America/Metlakatla":{u:-540,d:-480,c:["US"]},"America/Mexico_City":{u:-360,c:["MX"]},"America/Miquelon":{u:-180,d:-120,c:["PM"]},"America/Moncton":{u:-240,d:-180,c:["CA"]},"America/Monterrey":{u:-360,c:["MX"]},"America/Montevideo":{u:-180,c:["UY"]},"America/Montreal":{a:"America/Toronto",c:["CA"],r:1},"America/Montserrat":{a:"America/Puerto_Rico",c:["MS"],r:1},"America/Nassau":{a:"America/Toronto",c:["BS"],r:1},"America/New_York":{u:-300,d:-240,c:["US"]},"America/Nipigon":{a:"America/Toronto",c:["CA"],r:1},"America/Nome":{u:-540,d:-480,c:["US"]},"America/Noronha":{u:-120,c:["BR"]},"America/North_Dakota/Beulah":{u:-360,d:-300,c:["US"]},"America/North_Dakota/Center":{u:-360,d:-300,c:["US"]},"America/North_Dakota/New_Salem":{u:-360,d:-300,c:["US"]},"America/Nuuk":{u:-120,c:["GL"]},"America/Ojinaga":{u:-360,d:-300,c:["MX"]},"America/Panama":{u:-300,c:["PA","CA","KY"]},"America/Pangnirtung":{a:"America/Iqaluit",r:1},"America/Paramaribo":{u:-180,c:["SR"]},"America/Phoenix":{u:-420,c:["US","CA"]},"America/Port-au-Prince":{u:-300,d:-240,c:["HT"]},"America/Port_of_Spain":{a:"America/Puerto_Rico",c:["TT"],r:1},"America/Porto_Acre":{a:"America/Rio_Branco",r:1},"America/Porto_Velho":{u:-240,c:["BR"]},"America/Puerto_Rico":{u:-240,c:["PR","AG","CA","AI","AW","BL","BQ","CW","DM","GD","GP","KN","LC","MF","MS","SX","TT","VC","VG","VI"]},"America/Punta_Arenas":{u:-180,c:["CL"]},"America/Rainy_River":{a:"America/Winnipeg",r:1},"America/Rankin_Inlet":{u:-360,d:-300,c:["CA"]},"America/Recife":{u:-180,c:["BR"]},"America/Regina":{u:-360,c:["CA"]},"America/Resolute":{u:-360,d:-300,c:["CA"]},"America/Rio_Branco":{u:-300,c:["BR"]},"America/Rosario":{a:"America/Argentina/Cordoba",r:1},"America/Santa_Isabel":{a:"America/Tijuana",r:1},"America/Santarem":{u:-180,c:["BR"]},"America/Santiago":{u:-240,d:-180,c:["CL"]},"America/Santo_Domingo":{u:-240,c:["DO"]},"America/Sao_Paulo":{u:-180,c:["BR"]},"America/Scoresbysund":{u:-60,d:0,c:["GL"]},"America/Shiprock":{a:"America/Denver",r:1},"America/Sitka":{u:-540,d:-480,c:["US"]},"America/St_Barthelemy":{a:"America/Puerto_Rico",c:["BL"],r:1},"America/St_Johns":{u:-210,d:-150,c:["CA"]},"America/St_Kitts":{a:"America/Puerto_Rico",c:["KN"],r:1},"America/St_Lucia":{a:"America/Puerto_Rico",c:["LC"],r:1},"America/St_Thomas":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/St_Vincent":{a:"America/Puerto_Rico",c:["VC"],r:1},"America/Swift_Current":{u:-360,c:["CA"]},"America/Tegucigalpa":{u:-360,c:["HN"]},"America/Thule":{u:-240,d:-180,c:["GL"]},"America/Thunder_Bay":{a:"America/Toronto",c:["CA"],r:1},"America/Tijuana":{u:-480,d:-420,c:["MX"]},"America/Toronto":{u:-300,d:-240,c:["CA","BS"]},"America/Tortola":{a:"America/Puerto_Rico",c:["VG"],r:1},"America/Vancouver":{u:-480,d:-420,c:["CA"]},"America/Virgin":{a:"America/Puerto_Rico",c:["VI"],r:1},"America/Whitehorse":{u:-420,c:["CA"]},"America/Winnipeg":{u:-360,d:-300,c:["CA"]},"America/Yakutat":{u:-540,d:-480,c:["US"]},"America/Yellowknife":{a:"America/Edmonton",r:1},"Antarctica/Casey":{u:660,c:["AQ"]},"Antarctica/Davis":{u:420,c:["AQ"]},"Antarctica/DumontDUrville":{a:"Pacific/Port_Moresby",c:["AQ"],r:1},"Antarctica/Macquarie":{u:600,d:660,c:["AU"]},"Antarctica/Mawson":{u:300,c:["AQ"]},"Antarctica/McMurdo":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Palmer":{u:-180,c:["AQ"]},"Antarctica/Rothera":{u:-180,c:["AQ"]},"Antarctica/South_Pole":{a:"Pacific/Auckland",c:["AQ"],r:1},"Antarctica/Syowa":{a:"Asia/Riyadh",c:["AQ"],r:1},"Antarctica/Troll":{u:0,d:120,c:["AQ"]},"Antarctica/Vostok":{a:"Asia/Urumqi",c:["AQ"],r:1},"Arctic/Longyearbyen":{a:"Europe/Berlin",c:["SJ"],r:1},"Asia/Aden":{a:"Asia/Riyadh",c:["YE"],r:1},"Asia/Almaty":{u:360,c:["KZ"]},"Asia/Amman":{u:180,c:["JO"]},"Asia/Anadyr":{u:720,c:["RU"]},"Asia/Aqtau":{u:300,c:["KZ"]},"Asia/Aqtobe":{u:300,c:["KZ"]},"Asia/Ashgabat":{u:300,c:["TM"]},"Asia/Ashkhabad":{a:"Asia/Ashgabat",r:1},"Asia/Atyrau":{u:300,c:["KZ"]},"Asia/Baghdad":{u:180,c:["IQ"]},"Asia/Bahrain":{a:"Asia/Qatar",c:["BH"],r:1},"Asia/Baku":{u:240,c:["AZ"]},"Asia/Bangkok":{u:420,c:["TH","CX","KH","LA","VN"]},"Asia/Barnaul":{u:420,c:["RU"]},"Asia/Beirut":{u:120,d:180,c:["LB"]},"Asia/Bishkek":{u:360,c:["KG"]},"Asia/Brunei":{a:"Asia/Kuching",c:["BN"],r:1},"Asia/Calcutta":{a:"Asia/Kolkata",r:1},"Asia/Chita":{u:540,c:["RU"]},"Asia/Choibalsan":{u:480,c:["MN"]},"Asia/Chongqing":{a:"Asia/Shanghai",r:1},"Asia/Chungking":{a:"Asia/Shanghai",r:1},"Asia/Colombo":{u:330,c:["LK"]},"Asia/Dacca":{a:"Asia/Dhaka",r:1},"Asia/Damascus":{u:180,c:["SY"]},"Asia/Dhaka":{u:360,c:["BD"]},"Asia/Dili":{u:540,c:["TL"]},"Asia/Dubai":{u:240,c:["AE","OM","RE","SC","TF"]},"Asia/Dushanbe":{u:300,c:["TJ"]},"Asia/Famagusta":{u:120,d:180,c:["CY"]},"Asia/Gaza":{u:120,d:180,c:["PS"]},"Asia/Harbin":{a:"Asia/Shanghai",r:1},"Asia/Hebron":{u:120,d:180,c:["PS"]},"Asia/Ho_Chi_Minh":{u:420,c:["VN"]},"Asia/Hong_Kong":{u:480,c:["HK"]},"Asia/Hovd":{u:420,c:["MN"]},"Asia/Irkutsk":{u:480,c:["RU"]},"Asia/Istanbul":{a:"Europe/Istanbul",r:1},"Asia/Jakarta":{u:420,c:["ID"]},"Asia/Jayapura":{u:540,c:["ID"]},"Asia/Jerusalem":{u:120,d:180,c:["IL"]},"Asia/Kabul":{u:270,c:["AF"]},"Asia/Kamchatka":{u:720,c:["RU"]},"Asia/Karachi":{u:300,c:["PK"]},"Asia/Kashgar":{a:"Asia/Urumqi",c:["CN"],r:1},"Asia/Kathmandu":{u:345,c:["NP"]},"Asia/Katmandu":{a:"Asia/Kathmandu",r:1},"Asia/Khandyga":{u:540,c:["RU"]},"Asia/Kolkata":{u:330,c:["IN"]},"Asia/Krasnoyarsk":{u:420,c:["RU"]},"Asia/Kuala_Lumpur":{a:"Asia/Singapore",c:["MY"],r:1},"Asia/Kuching":{u:480,c:["MY","BN"]},"Asia/Kuwait":{a:"Asia/Riyadh",c:["KW"],r:1},"Asia/Macao":{a:"Asia/Macau",r:1},"Asia/Macau":{u:480,c:["MO"]},"Asia/Magadan":{u:660,c:["RU"]},"Asia/Makassar":{u:480,c:["ID"]},"Asia/Manila":{u:480,c:["PH"]},"Asia/Muscat":{a:"Asia/Dubai",c:["OM"],r:1},"Asia/Nicosia":{u:120,d:180,c:["CY"]},"Asia/Novokuznetsk":{u:420,c:["RU"]},"Asia/Novosibirsk":{u:420,c:["RU"]},"Asia/Omsk":{u:360,c:["RU"]},"Asia/Oral":{u:300,c:["KZ"]},"Asia/Phnom_Penh":{a:"Asia/Bangkok",c:["KH"],r:1},"Asia/Pontianak":{u:420,c:["ID"]},"Asia/Pyongyang":{u:540,c:["KP"]},"Asia/Qatar":{u:180,c:["QA","BH"]},"Asia/Qostanay":{u:360,c:["KZ"]},"Asia/Qyzylorda":{u:300,c:["KZ"]},"Asia/Rangoon":{a:"Asia/Yangon",c:["MM"],r:1},"Asia/Riyadh":{u:180,c:["SA","AQ","KW","YE"]},"Asia/Saigon":{a:"Asia/Ho_Chi_Minh",r:1},"Asia/Sakhalin":{u:660,c:["RU"]},"Asia/Samarkand":{u:300,c:["UZ"]},"Asia/Seoul":{u:540,c:["KR"]},"Asia/Shanghai":{u:480,c:["CN"]},"Asia/Singapore":{u:480,c:["SG","MY"]},"Asia/Srednekolymsk":{u:660,c:["RU"]},"Asia/Taipei":{u:480,c:["TW"]},"Asia/Tashkent":{u:300,c:["UZ"]},"Asia/Tbilisi":{u:240,c:["GE"]},"Asia/Tehran":{u:210,c:["IR"]},"Asia/Tel_Aviv":{a:"Asia/Jerusalem",r:1},"Asia/Thimbu":{a:"Asia/Thimphu",r:1},"Asia/Thimphu":{u:360,c:["BT"]},"Asia/Tokyo":{u:540,c:["JP"]},"Asia/Tomsk":{u:420,c:["RU"]},"Asia/Ujung_Pandang":{a:"Asia/Makassar",r:1},"Asia/Ulaanbaatar":{u:480,c:["MN"]},"Asia/Ulan_Bator":{a:"Asia/Ulaanbaatar",r:1},"Asia/Urumqi":{u:360,c:["CN","AQ"]},"Asia/Ust-Nera":{u:600,c:["RU"]},"Asia/Vientiane":{a:"Asia/Bangkok",c:["LA"],r:1},"Asia/Vladivostok":{u:600,c:["RU"]},"Asia/Yakutsk":{u:540,c:["RU"]},"Asia/Yangon":{u:390,c:["MM","CC"]},"Asia/Yekaterinburg":{u:300,c:["RU"]},"Asia/Yerevan":{u:240,c:["AM"]},"Atlantic/Azores":{u:-60,d:0,c:["PT"]},"Atlantic/Bermuda":{u:-240,d:-180,c:["BM"]},"Atlantic/Canary":{u:0,d:60,c:["ES"]},"Atlantic/Cape_Verde":{u:-60,c:["CV"]},"Atlantic/Faeroe":{a:"Atlantic/Faroe",r:1},"Atlantic/Faroe":{u:0,d:60,c:["FO"]},"Atlantic/Jan_Mayen":{a:"Europe/Berlin",c:["SJ"],r:1},"Atlantic/Madeira":{u:0,d:60,c:["PT"]},"Atlantic/Reykjavik":{a:"Africa/Abidjan",c:["IS"],r:1},"Atlantic/South_Georgia":{u:-120,c:["GS"]},"Atlantic/St_Helena":{a:"Africa/Abidjan",c:["SH"],r:1},"Atlantic/Stanley":{u:-180,c:["FK"]},"Australia/ACT":{a:"Australia/Sydney",r:1},"Australia/Adelaide":{u:570,d:630,c:["AU"]},"Australia/Brisbane":{u:600,c:["AU"]},"Australia/Broken_Hill":{u:570,d:630,c:["AU"]},"Australia/Canberra":{a:"Australia/Sydney",r:1},"Australia/Currie":{a:"Australia/Hobart",r:1},"Australia/Darwin":{u:570,c:["AU"]},"Australia/Eucla":{u:525,c:["AU"]},"Australia/Hobart":{u:600,d:660,c:["AU"]},"Australia/LHI":{a:"Australia/Lord_Howe",r:1},"Australia/Lindeman":{u:600,c:["AU"]},"Australia/Lord_Howe":{u:630,d:660,c:["AU"]},"Australia/Melbourne":{u:600,d:660,c:["AU"]},"Australia/NSW":{a:"Australia/Sydney",r:1},"Australia/North":{a:"Australia/Darwin",r:1},"Australia/Perth":{u:480,c:["AU"]},"Australia/Queensland":{a:"Australia/Brisbane",r:1},"Australia/South":{a:"Australia/Adelaide",r:1},"Australia/Sydney":{u:600,d:660,c:["AU"]},"Australia/Tasmania":{a:"Australia/Hobart",r:1},"Australia/Victoria":{a:"Australia/Melbourne",r:1},"Australia/West":{a:"Australia/Perth",r:1},"Australia/Yancowinna":{a:"Australia/Broken_Hill",r:1},"Brazil/Acre":{a:"America/Rio_Branco",r:1},"Brazil/DeNoronha":{a:"America/Noronha",r:1},"Brazil/East":{a:"America/Sao_Paulo",r:1},"Brazil/West":{a:"America/Manaus",r:1},CET:{u:60,d:120},CST6CDT:{u:-360,d:-300},"Canada/Atlantic":{a:"America/Halifax",r:1},"Canada/Central":{a:"America/Winnipeg",r:1},"Canada/Eastern":{a:"America/Toronto",c:["CA"],r:1},"Canada/Mountain":{a:"America/Edmonton",r:1},"Canada/Newfoundland":{a:"America/St_Johns",r:1},"Canada/Pacific":{a:"America/Vancouver",r:1},"Canada/Saskatchewan":{a:"America/Regina",r:1},"Canada/Yukon":{a:"America/Whitehorse",r:1},"Chile/Continental":{a:"America/Santiago",r:1},"Chile/EasterIsland":{a:"Pacific/Easter",r:1},Cuba:{a:"America/Havana",r:1},EET:{u:120,d:180},EST:{u:-300},EST5EDT:{u:-300,d:-240},Egypt:{a:"Africa/Cairo",r:1},Eire:{a:"Europe/Dublin",r:1},"Etc/GMT":{u:0},"Etc/GMT+0":{a:"Etc/GMT",r:1},"Etc/GMT+1":{u:-60},"Etc/GMT+10":{u:-600},"Etc/GMT+11":{u:-660},"Etc/GMT+12":{u:-720},"Etc/GMT+2":{u:-120},"Etc/GMT+3":{u:-180},"Etc/GMT+4":{u:-240},"Etc/GMT+5":{u:-300},"Etc/GMT+6":{u:-360},"Etc/GMT+7":{u:-420},"Etc/GMT+8":{u:-480},"Etc/GMT+9":{u:-540},"Etc/GMT-0":{a:"Etc/GMT",r:1},"Etc/GMT-1":{u:60},"Etc/GMT-10":{u:600},"Etc/GMT-11":{u:660},"Etc/GMT-12":{u:720},"Etc/GMT-13":{u:780},"Etc/GMT-14":{u:840},"Etc/GMT-2":{u:120},"Etc/GMT-3":{u:180},"Etc/GMT-4":{u:240},"Etc/GMT-5":{u:300},"Etc/GMT-6":{u:360},"Etc/GMT-7":{u:420},"Etc/GMT-8":{u:480},"Etc/GMT-9":{u:540},"Etc/GMT0":{a:"Etc/GMT",r:1},"Etc/Greenwich":{a:"Etc/GMT",r:1},"Etc/UCT":{a:"Etc/UTC",r:1},"Etc/UTC":{u:0},"Etc/Universal":{a:"Etc/UTC",r:1},"Etc/Zulu":{a:"Etc/UTC",r:1},"Europe/Amsterdam":{a:"Europe/Brussels",c:["NL"],r:1},"Europe/Andorra":{u:60,d:120,c:["AD"]},"Europe/Astrakhan":{u:240,c:["RU"]},"Europe/Athens":{u:120,d:180,c:["GR"]},"Europe/Belfast":{a:"Europe/London",c:["GB"],r:1},"Europe/Belgrade":{u:60,d:120,c:["RS","BA","HR","ME","MK","SI"]},"Europe/Berlin":{u:60,d:120,c:["DE","DK","NO","SE","SJ"]},"Europe/Bratislava":{a:"Europe/Prague",c:["SK"],r:1},"Europe/Brussels":{u:60,d:120,c:["BE","LU","NL"]},"Europe/Bucharest":{u:120,d:180,c:["RO"]},"Europe/Budapest":{u:60,d:120,c:["HU"]},"Europe/Busingen":{a:"Europe/Zurich",c:["DE"],r:1},"Europe/Chisinau":{u:120,d:180,c:["MD"]},"Europe/Copenhagen":{a:"Europe/Berlin",c:["DK"],r:1},"Europe/Dublin":{u:60,d:0,c:["IE"]},"Europe/Gibraltar":{u:60,d:120,c:["GI"]},"Europe/Guernsey":{a:"Europe/London",c:["GG"],r:1},"Europe/Helsinki":{u:120,d:180,c:["FI","AX"]},"Europe/Isle_of_Man":{a:"Europe/London",c:["IM"],r:1},"Europe/Istanbul":{u:180,c:["TR"]},"Europe/Jersey":{a:"Europe/London",c:["JE"],r:1},"Europe/Kaliningrad":{u:120,c:["RU"]},"Europe/Kiev":{a:"Europe/Kyiv",r:1},"Europe/Kirov":{u:180,c:["RU"]},"Europe/Kyiv":{u:120,d:180,c:["UA"]},"Europe/Lisbon":{u:0,d:60,c:["PT"]},"Europe/Ljubljana":{a:"Europe/Belgrade",c:["SI"],r:1},"Europe/London":{u:0,d:60,c:["GB","GG","IM","JE"]},"Europe/Luxembourg":{a:"Europe/Brussels",c:["LU"],r:1},"Europe/Madrid":{u:60,d:120,c:["ES"]},"Europe/Malta":{u:60,d:120,c:["MT"]},"Europe/Mariehamn":{a:"Europe/Helsinki",c:["AX"],r:1},"Europe/Minsk":{u:180,c:["BY"]},"Europe/Monaco":{a:"Europe/Paris",c:["MC"],r:1},"Europe/Moscow":{u:180,c:["RU"]},"Europe/Nicosia":{a:"Asia/Nicosia",r:1},"Europe/Oslo":{a:"Europe/Berlin",c:["NO"],r:1},"Europe/Paris":{u:60,d:120,c:["FR","MC"]},"Europe/Podgorica":{a:"Europe/Belgrade",c:["ME"],r:1},"Europe/Prague":{u:60,d:120,c:["CZ","SK"]},"Europe/Riga":{u:120,d:180,c:["LV"]},"Europe/Rome":{u:60,d:120,c:["IT","SM","VA"]},"Europe/Samara":{u:240,c:["RU"]},"Europe/San_Marino":{a:"Europe/Rome",c:["SM"],r:1},"Europe/Sarajevo":{a:"Europe/Belgrade",c:["BA"],r:1},"Europe/Saratov":{u:240,c:["RU"]},"Europe/Simferopol":{u:180,c:["RU","UA"]},"Europe/Skopje":{a:"Europe/Belgrade",c:["MK"],r:1},"Europe/Sofia":{u:120,d:180,c:["BG"]},"Europe/Stockholm":{a:"Europe/Berlin",c:["SE"],r:1},"Europe/Tallinn":{u:120,d:180,c:["EE"]},"Europe/Tirane":{u:60,d:120,c:["AL"]},"Europe/Tiraspol":{a:"Europe/Chisinau",r:1},"Europe/Ulyanovsk":{u:240,c:["RU"]},"Europe/Uzhgorod":{a:"Europe/Kyiv",r:1},"Europe/Vaduz":{a:"Europe/Zurich",c:["LI"],r:1},"Europe/Vatican":{a:"Europe/Rome",c:["VA"],r:1},"Europe/Vienna":{u:60,d:120,c:["AT"]},"Europe/Vilnius":{u:120,d:180,c:["LT"]},"Europe/Volgograd":{u:180,c:["RU"]},"Europe/Warsaw":{u:60,d:120,c:["PL"]},"Europe/Zagreb":{a:"Europe/Belgrade",c:["HR"],r:1},"Europe/Zaporozhye":{a:"Europe/Kyiv",r:1},"Europe/Zurich":{u:60,d:120,c:["CH","DE","LI"]},Factory:{u:0},GB:{a:"Europe/London",c:["GB"],r:1},"GB-Eire":{a:"Europe/London",c:["GB"],r:1},GMT:{a:"Etc/GMT",r:1},"GMT+0":{a:"Etc/GMT",r:1},"GMT-0":{a:"Etc/GMT",r:1},GMT0:{a:"Etc/GMT",r:1},Greenwich:{a:"Etc/GMT",r:1},HST:{u:-600},Hongkong:{a:"Asia/Hong_Kong",r:1},Iceland:{a:"Africa/Abidjan",c:["IS"],r:1},"Indian/Antananarivo":{a:"Africa/Nairobi",c:["MG"],r:1},"Indian/Chagos":{u:360,c:["IO"]},"Indian/Christmas":{a:"Asia/Bangkok",c:["CX"],r:1},"Indian/Cocos":{a:"Asia/Yangon",c:["CC"],r:1},"Indian/Comoro":{a:"Africa/Nairobi",c:["KM"],r:1},"Indian/Kerguelen":{a:"Indian/Maldives",c:["TF"],r:1},"Indian/Mahe":{a:"Asia/Dubai",c:["SC"],r:1},"Indian/Maldives":{u:300,c:["MV","TF"]},"Indian/Mauritius":{u:240,c:["MU"]},"Indian/Mayotte":{a:"Africa/Nairobi",c:["YT"],r:1},"Indian/Reunion":{a:"Asia/Dubai",c:["RE"],r:1},Iran:{a:"Asia/Tehran",r:1},Israel:{a:"Asia/Jerusalem",r:1},Jamaica:{a:"America/Jamaica",r:1},Japan:{a:"Asia/Tokyo",r:1},Kwajalein:{a:"Pacific/Kwajalein",r:1},Libya:{a:"Africa/Tripoli",r:1},MET:{u:60,d:120},MST:{u:-420},MST7MDT:{u:-420,d:-360},"Mexico/BajaNorte":{a:"America/Tijuana",r:1},"Mexico/BajaSur":{a:"America/Mazatlan",r:1},"Mexico/General":{a:"America/Mexico_City",r:1},NZ:{a:"Pacific/Auckland",c:["NZ"],r:1},"NZ-CHAT":{a:"Pacific/Chatham",r:1},Navajo:{a:"America/Denver",r:1},PRC:{a:"Asia/Shanghai",r:1},PST8PDT:{u:-480,d:-420},"Pacific/Apia":{u:780,c:["WS"]},"Pacific/Auckland":{u:720,d:780,c:["NZ","AQ"]},"Pacific/Bougainville":{u:660,c:["PG"]},"Pacific/Chatham":{u:765,d:825,c:["NZ"]},"Pacific/Chuuk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Easter":{u:-360,d:-300,c:["CL"]},"Pacific/Efate":{u:660,c:["VU"]},"Pacific/Enderbury":{a:"Pacific/Kanton",r:1},"Pacific/Fakaofo":{u:780,c:["TK"]},"Pacific/Fiji":{u:720,c:["FJ"]},"Pacific/Funafuti":{a:"Pacific/Tarawa",c:["TV"],r:1},"Pacific/Galapagos":{u:-360,c:["EC"]},"Pacific/Gambier":{u:-540,c:["PF"]},"Pacific/Guadalcanal":{u:660,c:["SB","FM"]},"Pacific/Guam":{u:600,c:["GU","MP"]},"Pacific/Honolulu":{u:-600,c:["US"]},"Pacific/Johnston":{a:"Pacific/Honolulu",r:1},"Pacific/Kanton":{u:780,c:["KI"]},"Pacific/Kiritimati":{u:840,c:["KI"]},"Pacific/Kosrae":{u:660,c:["FM"]},"Pacific/Kwajalein":{u:720,c:["MH"]},"Pacific/Majuro":{a:"Pacific/Tarawa",c:["MH"],r:1},"Pacific/Marquesas":{u:-570,c:["PF"]},"Pacific/Midway":{a:"Pacific/Pago_Pago",c:["UM"],r:1},"Pacific/Nauru":{u:720,c:["NR"]},"Pacific/Niue":{u:-660,c:["NU"]},"Pacific/Norfolk":{u:660,d:720,c:["NF"]},"Pacific/Noumea":{u:660,c:["NC"]},"Pacific/Pago_Pago":{u:-660,c:["AS","UM"]},"Pacific/Palau":{u:540,c:["PW"]},"Pacific/Pitcairn":{u:-480,c:["PN"]},"Pacific/Pohnpei":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Ponape":{a:"Pacific/Guadalcanal",c:["FM"],r:1},"Pacific/Port_Moresby":{u:600,c:["PG","AQ","FM"]},"Pacific/Rarotonga":{u:-600,c:["CK"]},"Pacific/Saipan":{a:"Pacific/Guam",c:["MP"],r:1},"Pacific/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},"Pacific/Tahiti":{u:-600,c:["PF"]},"Pacific/Tarawa":{u:720,c:["KI","MH","TV","UM","WF"]},"Pacific/Tongatapu":{u:780,c:["TO"]},"Pacific/Truk":{a:"Pacific/Port_Moresby",c:["FM"],r:1},"Pacific/Wake":{a:"Pacific/Tarawa",c:["UM"],r:1},"Pacific/Wallis":{a:"Pacific/Tarawa",c:["WF"],r:1},"Pacific/Yap":{a:"Pacific/Port_Moresby",c:["FM"],r:1},Poland:{a:"Europe/Warsaw",r:1},Portugal:{a:"Europe/Lisbon",r:1},ROC:{a:"Asia/Taipei",r:1},ROK:{a:"Asia/Seoul",r:1},Singapore:{a:"Asia/Singapore",c:["SG"],r:1},Turkey:{a:"Europe/Istanbul",r:1},UCT:{a:"Etc/UTC",r:1},"US/Alaska":{a:"America/Anchorage",r:1},"US/Aleutian":{a:"America/Adak",r:1},"US/Arizona":{a:"America/Phoenix",c:["US"],r:1},"US/Central":{a:"America/Chicago",r:1},"US/East-Indiana":{a:"America/Indiana/Indianapolis",r:1},"US/Eastern":{a:"America/New_York",r:1},"US/Hawaii":{a:"Pacific/Honolulu",r:1},"US/Indiana-Starke":{a:"America/Indiana/Knox",r:1},"US/Michigan":{a:"America/Detroit",r:1},"US/Mountain":{a:"America/Denver",r:1},"US/Pacific":{a:"America/Los_Angeles",r:1},"US/Samoa":{a:"Pacific/Pago_Pago",c:["AS"],r:1},UTC:{a:"Etc/UTC",r:1},Universal:{a:"Etc/UTC",r:1},"W-SU":{a:"Europe/Moscow",r:1},WET:{u:0,d:60},Zulu:{a:"Etc/UTC",r:1}},mg={countries:Rke,timezones:_ke},jw;function Pke(e,t){var n=e.countries[t];if(!n)return null;var r=Ike(e)[t]||{};return{id:t,name:n,timezones:r.current||[],allTimezones:r.all||[]}}function Ike(e){return jw||(jw=Oke(e)),jw}function Oke(e){return Object.keys(e.timezones).reduce(function(t,n){var r=e.timezones[n],o=r.c,i=r.a,a=e.timezones[i]||{},l=o||a.c;return l&&l.forEach(function(c){t[c]||Object.assign(t,u0({},c,{current:[],all:[]})),r.r===void 0&&t[c].current.push(n),t[c].all.push(n)}),t},{})}function $ke(e,t){var n=e.timezones[t];if(!n)return null;var r=n.a,o=r===void 0?null:r,i=o?e.timezones[o]:{},a=Rh(Rh({},i),e.timezones[t]),l=a.c||[],c=a.u,u=Number.isInteger(a.d)?a.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:$I(c),dstOffset:u,dstOffsetStr:$I(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function $I(e){var t=Math.floor(e/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(NI(t),":").concat(NI(n))}function NI(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var Nke=["allTimezones"],Lke=Object.keys(mg.timezones).length,pC={},Mf={},TB=0;function Dke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(mg.countries).reduce(function(t,n){return Object.assign(t,u0({},n,d0(n,e)))},{})}function Mke(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Lke!==TB&&Object.keys(mg.timezones).forEach(p0),Uke(Mf,e)}function d0(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return pC[e]||Bke(Pke(mg,e)),Wke(pC[e],t)}function Bke(e){e&&(pC[e.id]=e)}function p0(e){return Mf[e]||Fke($ke(mg,e)),Mf[e]?Rh({},Mf[e]):null}function Fke(e){e&&(Mf[e.name]=e,TB=Object.keys(e).length)}function kB(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=p0(e)||{},r=n.countries||[];return r.map(function(o){return d0(o,t)})}function zke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=kB(e,t),r=Cke(n,1),o=r[0];return o||null}function jke(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=d0(e,t);if(!n)return null;var r=n.timezones||[];return r.map(p0)}function Uke(e,t){var n=t||{},r=n.deprecated;return r===!0?e:Object.keys(e).reduce(function(o,i){return e[i].deprecated||Object.assign(o,u0({},i,e[i])),o},{})}function Wke(e,t){if(!e)return null;var n=t||{},r=n.deprecated;e.allTimezones;var o=xke(e,Nke),i=r?e.allTimezones:e.timezones;return Rh(Rh({},o),{},{timezones:i})}var Hke={getCountry:d0,getTimezone:p0,getAllCountries:Dke,getAllTimezones:Mke,getTimezonesForCountry:jke,getCountriesForTimezone:kB,getCountryForTimezone:zke};const Vke=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),Gke=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(Hke.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[a,l]=g.useState(t||""),c=g.useMemo(()=>{const u=o.find(d=>d.key===i);return u!=null?`${u.key} (UTC ${u.utcOffset})`:"The time shown is in your local time zone according to your browser."},[o,i]);return t?S(ce,{children:[s(gg,{children:"Select a date"}),S(Vke,{children:[s(ir,{id:"date",label:"Date",type:"datetime-local",value:jxe(a),onChange:u=>{r("");const d=GM(u.target.value),p=d==null?void 0:d.toISOString();p&&l(p),p&&e(p)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),s("p",{children:c})]})]}):null},AB=$s()(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"}})),qke="Enter",LI=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,a]=g.useState(""),{classes:l}=AB(),c=d=>{d.key===qke&&(d.preventDefault(),u())},u=()=>{const d=Yke([...e,...Js(i)]);d.length===0?o("values cannot be empty"):d.some(p=>p.length>100)?o("values cannot be longer than 100 characters"):(o(""),a(""),n(d))};return S("div",{children:[s(gg,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),S("div",{className:l.inputContainer,children:[s("div",{className:l.inputInnerContainer,children:s(ir,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>a(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),s(Ve,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),s("div",{className:l.valuesContainer,children:s(Kke,{values:e,removeValue:t})})]})},Kke=({values:e,removeValue:t})=>{const{classes:n}=AB();return s(ce,{children:e.map((r,o)=>s(Is,{label:s(_a,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip},`${r}-${o}`))})},Yke=e=>Array.from(new Set(e)),Ck=({filter:e,setFilter:t})=>S("div",{style:{display:"flex",alignItems:"center"},children:[s("div",{style:{width:"300px"},children:s(fn,{label:"Search",name:"search",value:e,onChange:n=>t(n.target.value),placeholder:"Filter values",style:{width:"100%",margin:"1rem 0"},variant:"outlined",size:"small",InputProps:{startAdornment:s(ph,{position:"start",children:s(tT,{})})}})}),s(V,{condition:!!e,show:s(Is,{style:{marginLeft:"1rem"},label:`filter active: ${e}`,onDelete:()=>t("")})})]}),Xke=$s()(e=>({container:{display:"inline-block",wordBreak:"break-word"},value:{lineHeight:1.33,fontSize:e.fontSizes.smallBody},description:{lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active}})),RB=({legal:e,control:t})=>{const{classes:n}=Xke();return s("div",{className:n.container,children:s(Gr,{value:e.value,control:t,label:S(ce,{children:[s("div",{className:n.value,children:e.value}),s("div",{className:n.description,children:e.description})]})})})},_B=(e,t)=>e.filter(n=>n.value.includes(t)),Uw=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),PB=e=>new Set(e.map(({value:t})=>t)),IB=(e,t)=>{const n=PB(t);return e.filter(r=>n.has(r))},Jke=({data:e,values:t,setValues:n,error:r,setError:o,constraintValues:i})=>{const[a,l]=g.useState(""),{legalValues:c,deletedLegalValues:u}=e,d=_B(c,a),[p,f]=g.useState(()=>Uw(t)),{classes:h}=tg(),m=v=>{const w=PB(u);return(v==null?void 0:v.filter(C=>!w.has(C)))||[]},y=IB(i,u);g.useEffect(()=>{f(Uw(t))},[t,f,Uw]),g.useEffect(()=>{y.length>0&&n(m(t))},[]);const b=v=>{if(o(""),p[v]){const w=t.findIndex(k=>k===v),C=[...t];C.splice(w,1),n(C);return}n([...m(t),v])};return S(ce,{children:[s(V,{condition:!!(y&&y.length>0),show:S(Bt,{severity:"warning",children:["This constraint is using legal values that have been deleted as valid options. If you save changes on this constraint and then save the strategy the following values will be removed:",s("ul",{children:y==null?void 0:y.map(v=>s("li",{children:v},v))})]})}),s(gg,{children:"Select values from a predefined set"}),s(V,{condition:c.length>100,show:s(Ck,{filter:a,setFilter:l})}),d.map(v=>s(RB,{legal:v,control:s(es,{checked:!!p[v.value],onChange:()=>b(v.value),name:v.value,color:"primary",disabled:u.map(({value:w})=>w).includes(v.value)})},v.value)),s(V,{condition:!!r,show:s("p",{className:h.error,children:r})})]})},DI=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:a,constraintValue:l})=>{const[c,u]=g.useState(""),{classes:d}=tg(),p=_B(r,c),{deletedLegalValues:f}=a,h=IB([l],f);return S(ce,{children:[s(V,{condition:!!(h&&h.length>0),show:S(Bt,{severity:"warning",sx:m=>({marginTop:m.spacing(1)}),children:[" ","This constraint is using legal values that have been deleted as a valid option. Please select a new value from the remaining predefined legal values. The constraint will be updated with the new value when you save the strategy."]})}),S(gg,{children:["Add a single ",n.toLowerCase()," value"]}),s(V,{condition:r.length>100,show:s(Ck,{filter:c,setFilter:u})}),s(V,{condition:!!r.length,show:s(Os,{component:"fieldset",children:s(RE,{"aria-label":"selected-value",name:"selected",value:t,onChange:m=>{i(""),e(m.target.value)},children:p.map(m=>s(RB,{legal:m,control:s(cc,{})},m.value))})}),elseShow:s("p",{children:"No valid legal values available for this operator."})}),s(V,{condition:!!o,show:s("p",{className:d.error,children:o})})]})},Qke=$s()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),MI=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=Qke();return S(ce,{children:[S(gg,{children:["Add a single ",n.toLowerCase()," value"]}),s("div",{className:i.singleValueContainer,children:s(ir,{label:n,name:"value",value:t||"",onChange:a=>{o(""),e(a.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},Ww=(e,t)=>{if((t==null?void 0:t.length)===0)return{legalValues:[],deletedLegalValues:[]};const n=(e||[]).filter(r=>!(t||[]).some(({value:o})=>o===r)).map(r=>({value:r,description:""}));return{legalValues:t||[],deletedLegalValues:n}},Zke=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:a,setError:l,removeValue:c,error:u})=>s(ce,{children:(()=>{var p;switch(e){case dC:case yB:return s(ce,{children:s(Jke,{data:Ww(n,t.legalValues),constraintValues:n,values:o.values||[],setValues:a,error:u,setError:l})});case vB:return s(ce,{children:s(DI,{data:Ww([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((p=t.legalValues)==null?void 0:p.filter(f=>Number(f.value)))||[],error:u,setError:l})});case bB:return s(ce,{children:s(DI,{data:Ww([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:u,setError:l})});case wB:return s(Gke,{value:o.value,setValue:i,error:u,setError:l});case SB:return s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l});case xB:return s(ce,{children:s(LI,{values:o.values||[],removeValue:c,setValues:a,error:u,setError:l})});case CB:return s(MI,{setValue:i,value:o.value,type:"number",error:u,setError:l});case EB:return s(MI,{setValue:i,value:o.value,type:"semver",error:u,setError:l})}})()}),OB="cancel",BI="save",FI=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},eAe=x("div")({padding:0,margin:0,width:"100%"}),tAe=x(w1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.elevation1,boxShadow:"none",margin:0,"& .expanded":{"&:before":{opacity:"0 !important"}}})),nAe=x(C1)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),rAe=x(S1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),oAe=({constraint:e,compact:t,onCancel:n,onSave:r,onDelete:o})=>{const[i,a]=g.useState(nI(e)),{context:l}=ga(),[c,u]=g.useState(FI(l,i.contextName)),{validateConstraint:d}=qd(),[p,f]=g.useState(!1),[h,m]=g.useState("");g.useEffect(()=>{f(!0)},[]),g.useEffect(()=>{u(FI(l,i.contextName))},[i.contextName,l]);const y=g.useCallback(D=>{a(B=>({...B,contextName:D,values:[],value:""}))},[]),b=g.useCallback(D=>{a(B=>({...B,operator:D,values:[],value:""}))},[]),v=g.useCallback(D=>{a(B=>({...B,values:D}))},[]),w=g.useCallback(D=>{a(B=>({...B,value:D}))},[]),C=()=>{a(D=>({...D,inverted:!D.inverted}))},k=g.useCallback(()=>{a(D=>({...D,caseInsensitive:!D.caseInsensitive}))},[]),A=g.useCallback(D=>{const B=[...i.values];B.splice(D,1),v(B)},[i,v]),T=()=>{f(!1)},_=()=>{const D=Array.isArray(i.values)&&i.values.length>0,B=!!i.value;return D||B?($(""),!0):($("You must provide a value for the constraint"),!1)},P=async()=>{if(!_())return;const[B,q]=O();if(B||$(q),B)try{await d(i),$(""),m(BI),T();return}catch(Y){$(gt(Y))}},{input:I,validator:O,setError:$,error:F}=bke({contextDefinition:c,localConstraint:i});return g.useEffect(()=>{$(""),a(D=>nI(D))},[i.operator,i.contextName,$]),s(eAe,{children:S(tAe,{expanded:p,TransitionProps:{onExited:()=>{h===OB?(m(""),n()):h===BI&&(m(""),r(i))}},children:[s(nAe,{children:s(g2e,{localConstraint:i,setLocalConstraint:a,setContextName:y,setOperator:b,action:h,compact:t,setInvertedOperator:C,setCaseInsensitive:k,onDelete:o})}),s(rAe,{children:s(KCe,{localConstraint:i,setValues:v,setValue:w,triggerTransition:T,setAction:m,onSubmit:P,children:s(Zke,{setValues:v,setValue:w,setError:$,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:I,error:F,contextDefinition:c,removeValue:A})})})]})})},$B=(e,t)=>e.value&&e.contextName===Ah?U1(e.value,t.locale):e.value,iAe=x(_a)({whiteSpace:"pre"}),aAe=x(Is)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),sAe=({values:e})=>{const[t,n]=g.useState("");return!e||e.length===0?null:S(ce,{children:[s(V,{condition:e.length>20,show:s(Ck,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>s(aAe,{label:s(iAe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},lAe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),cAe=x("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),uAe=x(Is)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),dAe=({value:e,operator:t})=>e?S(lAe,{children:[S(cAe,{children:["Value must be ",t]})," ",s(uAe,{label:s(_a,{maxWidth:"400",text:e,maxLength:50})})]}):null,pAe=x("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),fAe=({constraint:e})=>{const{locationSettings:t}=ns();return s("div",{children:S(pAe,{children:[s(sAe,{values:e.values}),s(dAe,{value:$B(e,t),operator:e.operator})]})})},hAe=x("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),gAe=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14})),mAe=x("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),yAe=({constraint:e,hasPrefix:t})=>{const n=e.operator,r=cC(e.operator);return S(hAe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[s(gAe,{children:n}),s(mAe,{children:r})]})},NB=x("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation2,width:24,display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"stretch",color:e.palette.primary.main,marginLeft:e.spacing(1),borderRadius:e.shape.borderRadius})),vAe=x(NB)(()=>({marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),zI=g.forwardRef(({isPrefix:e,...t},n)=>s(V,{condition:!!e,show:()=>s(vAe,{ref:n,...t}),elseShow:()=>s(NB,{ref:n,...t})})),bAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),wAe=x("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),SAe=({constraint:e})=>S(bAe,{children:[s(V,{condition:!!e.inverted,show:s(wt,{title:"Operator is negated",arrow:!0,children:s(fe,{sx:{display:"flex"},children:s(zI,{isPrefix:!0,children:s(oB,{})})})})}),s(wAe,{children:s(yAe,{constraint:e,hasPrefix:!!e.inverted})}),s(V,{condition:!e.caseInsensitive&&Mn(Ss,e.operator),show:s(wt,{title:"Case sensitive is active",arrow:!0,children:s(zI,{children:s(sB,{})})})})]}),xAe=x(Is)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),CAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),EAe=({constraint:e,allowExpand:t})=>{const{locationSettings:n}=ns();return g.useEffect(()=>{t(!1)},[t]),s(CAe,{children:s(xAe,{label:$B(e,n)})})},TAe=x("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,margin:"auto 0",[e.breakpoints.down("sm")]:{margin:e.spacing(1,0),textAlign:"center"}})),kAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),AAe=x("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),RAe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),_Ae=({constraint:e,expanded:t,allowExpand:n,maxLength:r})=>{var l;const[o,i]=g.useState(!1),a=g.useMemo(()=>{var c;return(c=e==null?void 0:e.values)==null?void 0:c.map(u=>u).join(", ")},[e]);return g.useEffect(()=>{a&&(n(((a==null?void 0:a.length)??0)>r),i(((a==null?void 0:a.length)??0)>r))},[a,r,n,i]),s(kAe,{children:S(AAe,{children:[s(TAe,{children:a}),s(V,{condition:o,show:s(RAe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(l=e==null?void 0:e.values)==null?void 0:l.length})`})})]})})},PAe=x("span")(({theme:e})=>({display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden",maxWidth:"100px",minWidth:"100px",marginRight:"10px",marginTop:"auto",marginBottom:"auto",wordBreak:"break-word",fontSize:e.fontSizes.smallBody,[e.breakpoints.down(710)]:{textAlign:"center",padding:e.spacing(1,0),marginRight:"inherit",maxWidth:"inherit"}})),IAe=x("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),OAe=x("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),$Ae=({constraint:e,singleValue:t,allowExpand:n,expanded:r,maxLength:o=112})=>s(IAe,{children:S(OAe,{children:[s(wt,{title:e.contextName,arrow:!0,children:s(PAe,{children:e.contextName})}),s(SAe,{constraint:e}),s(V,{condition:t,show:s(EAe,{constraint:e,allowExpand:n}),elseShow:s(_Ae,{constraint:e,expanded:r,allowExpand:n,maxLength:o})})]})}),NAe=Mc("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),LAe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:a})=>{const{context:l}=ga(),{contextName:c}=e,u=!l.map(d=>d.name).includes(c);return S(NAe,{children:[s(nB,{compact:a}),s($Ae,{constraint:e,singleValue:r,allowExpand:o,expanded:i}),s(lB,{onEdit:t,onDelete:n,disableEdit:u})]})},DAe=x(w1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),MAe=x(C1)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}}})),BAe=x(S1)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),FAe=x("div")({display:"flex",flexDirection:"column",width:"100%"}),zAe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,renderAfter:i})=>{const[a,l]=g.useState(!0),[c,u]=g.useState(!1),d=Mn([...Vu,...Hu,...Ii],e.operator);return S(DAe,{expanded:c,sx:r,children:[s(MAe,{expandIcon:null,onClick:()=>{a&&u(!c)},sx:{cursor:a?"pointer":"default!important","&:hover":{cursor:a?"pointer":"default!important"}},children:S(FAe,{children:[s(LAe,{constraint:e,onEdit:t,onDelete:n,singleValue:d,allowExpand:l,expanded:c,compact:o}),i]})}),s(BAe,{children:s(fAe,{constraint:e})})]})},jAe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:a})=>e?s(V,{condition:!!(n&&a),show:s(oAe,{constraint:e,onCancel:o,onSave:a,onDelete:i,compact:t}),elseShow:s(zAe,{constraint:e,onEdit:r,onDelete:i})}):null,UAe=e=>{const t=g.useRef(e??new WeakMap),[,n]=g.useState(0),r=g.useCallback((i,a)=>{t.current.set(i,a),n(l=>l+1)},[]),o=g.useCallback(i=>t.current.get(i),[]);return g.useMemo(()=>({set:r,get:o}),[r,o])},LB=e=>(Hw.has(e)||(jI++,Hw.set(e,jI)),Hw.get(e)),Hw=new WeakMap;let jI=0;const WAe=e=>{const t=rB(e)[0],n=Mn(Ii,t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1}},DB=x("div")(({theme:e})=>({padding:e.spacing(.75,1),color:e.palette.text.primary,fontSize:e.fontSizes.smallerBody,backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadius,position:"absolute",zIndex:e.zIndex.fab,top:"50%",left:e.spacing(2),transform:"translateY(-50%)",lineHeight:1})),HAe=x(DB)(({theme:e})=>({top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:e.palette.seen.primary,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(.75,1.5)})),Ek=({text:e})=>{const t=on();return s(fe,{sx:{height:t.spacing(e==="AND"?1:1.5),position:"relative",width:"100%"},children:s(V,{condition:e==="AND",show:()=>s(DB,{children:e}),elseShow:()=>s(HAe,{children:e})})})},MB="constraintAccordionListId",VAe=x("div")({width:"100%",display:"flex",flexDirection:"column"}),GAe=x(wt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)})),qAe=x(Gy)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}})),KAe=x("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary})),YAe=x("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"})),yg=g.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const i=UAe(),{context:a}=ga(),l=t&&(h=>{const m=WAe(h);i.set(m,{editing:!0,new:!0}),t(y=>[...y,m])});g.useImperativeHandle(o,()=>({addConstraint:l}));const c=l&&(()=>{l(a[0].name)}),u=t&&(h=>{i.set(h,{editing:!0})}),d=t&&(h=>{const m=e[h];i.set(m,{}),t(Ei(y=>{y.splice(h,1)}))}),p=t&&((h,m)=>{i.set(m,{}),t(Ei(y=>{y[h]=m}))}),f=h=>{var y;const m=e[h];(y=i.get(m))!=null&&y.new&&(d==null||d(h)),i.set(m,{})};return a.length===0?null:S(VAe,{id:MB,children:[s(V,{condition:e&&e.length>0&&r,show:s(KAe,{children:"Constraints"})}),e.map((h,m)=>{var y;return S(g.Fragment,{children:[s(V,{condition:m>0,show:s(Ek,{text:"AND"})}),s(jAe,{constraint:h,onEdit:u&&u.bind(null,h),onCancel:f.bind(null,m),onDelete:d&&d.bind(null,m),onSave:p&&p.bind(null,m),editing:!!((y=i.get(h))!=null&&y.editing),compact:!0})]},LB(h))}),s(V,{condition:!!(n&&c),show:S("div",{children:[S(YAe,{children:[s("p",{children:"Add any number of constraints"}),s(GAe,{title:"View constraints documentation",arrow:!0,children:s("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:s(qAe,{})})})]}),s(Ve,{type:"button",onClick:c,variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})]})}),XAe=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{const o=g.useMemo(()=>n.constraints??[],[n]),i=c=>{r(u=>({...u,constraints:c instanceof Function?c(o):c}))},a=cd(p9,e,t),l=cd(H1,e,t);return s(yg,{constraints:o,setConstraints:l?i:void 0,showCreateButton:a})},UI=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},Tk=e=>{const t=!!(e&&e.length===0),[n,r]=g.useState(t),{validateConstraint:o}=qd();return g.useEffect(()=>{if(!e)return;if(e.find(l=>!UI(l))){r(!1);return}const a=e.filter(UI).map(l=>o(l));Promise.all(a).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},Ll=e=>{St();const t=kt(e?`api/admin/segments/strategies/${e}`:"api/admin/segments"),{data:n,error:r,mutate:o}=Pn(t,()=>JAe(t),{refreshInterval:15*1e3}),i=g.useCallback(()=>{o().catch(console.warn)},[o]);return{segments:n,refetchSegments:i,loading:!r&&!n,error:r}},JAe=async e=>fetch(e).then(xn("Segments")).then(t=>t.json()).then(t=>t.segments),QAe=$s()(e=>({inputRoot:{height:48,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderTopRightRadius:50,borderBottomRightRadius:50,"& fieldset":{borderColor:e.palette.divider,borderLeftColor:"transparent"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:1}}})),ZAe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}})),eRe=x("div",{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({background:t?e.palette.primary.light:e.palette.primary.main,height:"48px",width:"48px",display:"flex",alignItems:"center",justifyContent:"center",paddingLeft:6,borderTopLeftRadius:"40px",borderBottomLeftRadius:"40px",color:e.palette.primary.contrastText})),tRe=x($d)({flex:1}),BB=({label:e,options:t,value:n=[],onChange:r,disabled:o})=>{const{classes:i}=QAe(),a=l=>s(fn,{...l,variant:"outlined",label:e});return S(ZAe,{children:[s(eRe,{$disabled:!!o,"aria-hidden":!0,children:s(tT,{})}),s(tRe,{classes:{inputRoot:i.inputRoot},options:t,value:n,popupIcon:s(Sce,{titleAccess:"Toggle"}),onChange:(l,c)=>r(c||[]),renderInput:a,getOptionLabel:l=>l.label,disabled:o,size:"small",multiple:!0})]})},nRe=x("span")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),paddingInlineStart:e.spacing(2),paddingInlineEnd:e.spacing(1),paddingBlockStart:e.spacing(.5),paddingBlockEnd:e.spacing(.5),borderRadius:"100rem",background:e.palette.primary.main,color:e.palette.primary.contrastText})),WI=x("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer"})),rRe=x(Kt)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),Vw=e=>({fontSize:e.fontSizes.bodySize}),oRe=({segment:e,setSegments:t,preview:n,setPreview:r})=>{const o=()=>{t(c=>c.filter(u=>u.id!==e.id)),r(c=>c===e?void 0:c)},i=()=>{r(c=>c===e?void 0:e)},a=s(V,{condition:e===n,show:s(OD,{titleAccess:"Hide",sx:Vw}),elseShow:s(ID,{titleAccess:"Show",sx:Vw})}),l=e===n?"Hide segment constraints":"Preview segment constraints";return S(nRe,{children:[s(rRe,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),s(wt,{title:l,arrow:!0,children:s(WI,{type:"button",onClick:i,"aria-expanded":e===n,"aria-controls":MB,children:a})}),s(wt,{title:"Remove segment",arrow:!0,children:s(WI,{type:"button",onClick:o,children:s(Cce,{titleAccess:"Remove",sx:Vw})})})]})},iRe=x(w1)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.paper,boxShadow:"none",margin:0,transition:"all 0.1s ease","&:before":{opacity:"0 !important"},"&.Mui-expanded":{backgroundColor:e.palette.neutral.light}})),aRe=x(C1)(({theme:e})=>({margin:e.spacing(0,.5),fontSize:e.typography.body2.fontSize,".MuiAccordionSummary-content":{display:"flex",alignItems:"center"}})),sRe=x(Kt)(({theme:e})=>({textDecoration:"none",marginLeft:e.spacing(1),"&:hover":{textDecoration:"underline"}})),FB=({segment:e,isExpanded:t,headerContent:n,constraintList:r})=>{var a;const[o,i]=g.useState(t||!1);return S(iRe,{expanded:o,children:[S(aRe,{id:`segment-accordion-${e.id}`,children:[s(TD,{color:"secondary",sx:{mr:1}}),s("span",{children:"Segment:"}),s(sRe,{to:`/segments/edit/${e.id}`,children:e.name}),s(V,{condition:!!n,show:n}),s(V,{condition:!t,show:s(Ve,{size:"small",variant:"outlined",onClick:()=>i(l=>!l),sx:{my:0,ml:"auto",fontSize:l=>l.typography.body2.fontSize},children:o?"Close preview":"Preview"})})]}),s(S1,{sx:{pt:0},children:s(V,{condition:!!r,show:r,elseShow:s(V,{condition:(((a=e==null?void 0:e.constraints)==null?void 0:a.length)||0)>0,show:s(yg,{constraints:e.constraints,showLabel:!1}),elseShow:s(re,{children:"This segment has no constraints."})})})})]})},lRe=x("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),cRe=x("p")(({theme:e})=>({color:e.palette.text.secondary})),uRe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,padding:e.spacing(.75,1),display:"block",marginTop:"auto",marginBottom:"auto",alignItems:"center",borderRadius:e.shape.borderRadius,lineHeight:1,color:e.palette.text.primary,backgroundColor:e.palette.background.elevation2})),dRe=({segments:e,setSegments:t})=>{const[n,r]=g.useState(),o=e.length-1;return e.length===0?null:S(ce,{children:[s(V,{condition:e&&e.length>0,show:s(cRe,{children:"Selected Segments"})}),s(lRe,{children:e.map((i,a)=>S(g.Fragment,{children:[s(oRe,{segment:i,setSegments:t,preview:n,setPreview:r}),s(V,{condition:a<o,show:s(uRe,{children:"AND"})})]},i.id))}),s(V,{condition:!!n,show:()=>s(FB,{segment:n,isExpanded:!0})})]})},Gc=()=>{const{uiConfig:e}=St();return{segmentValuesLimit:e.segmentValuesLimit,strategySegmentsLimit:e.strategySegmentsLimit}},pRe=()=>{const{segmentValuesLimit:e}=Gc();return typeof e>"u"?null:S(Bt,{severity:"info",children:["A segment can have"," ",S("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," across all of its contraints"]}),". ",s(zB,{})]})},fRe=e=>{const{segmentValuesLimit:t}=Gc();return typeof t>"u"?null:S(Bt,{severity:"error",children:["A segment can have"," ",S("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",t," across all of its contraints"]}),". This segment has ",e.values," ",e.values===1?"value":"values","."]})},hRe=()=>{const{strategySegmentsLimit:e}=Gc();return typeof e>"u"?null:S(Bt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",s(zB,{})]})},zB=()=>S(ce,{children:[s("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),jB="https://docs.getunleash.io/reference/segments",gRe=x(xr)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),mRe=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=Ll(),{strategySegmentsLimit:o}=Gc(),i=!!(o&&e.length>=o);if(!r||r.length===0)return null;const c=r.filter(({project:d})=>!d||d===n).filter(d=>!e.find(p=>p.id===d.id)).map(d=>({value:String(d.id),label:d.name}));return S(ce,{children:[s(re,{component:"h3",sx:{m:0},variant:"h3",children:"Segmentation"}),i&&s(hRe,{}),s("p",{children:"Add a predefined segment to constrain this feature toggle:"}),s(BB,{label:"Select segments",options:c,onChange:([d])=>{const p=r.find(f=>String(f.id)===d.value);p&&t(f=>[...f,p])},disabled:i}),s(dRe,{segments:e,setSegments:t}),s(gRe,{})]})},yRe=(e,t)=>{const{type:n,required:r}=e;if(!(n!=="string"&&n!=="list"&&n!=="number")){if(r&&(typeof t>"u"||t===""))return"Field is required";if(n==="number"&&!vRe(t))return"Not a valid number."}},vRe=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),kk=e=>{const{data:t,error:n,mutate:r}=Pn(e?kt(`api/admin/strategies/${e}`):null,bRe),o=g.useCallback(()=>{r().catch(console.warn)},[r]);return{strategyDefinition:t,refetchStrategy:o,loading:!n&&!t,error:n}},bRe=e=>fetch(e).then(xn("Strategy")).then(t=>t.json()),wRe=({environment:e})=>S(Bt,{severity:"info",children:[s("strong",{children:"Change requests"})," are enabled",e?` for ${e}`:"",". Your changes needs to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]}),SRe="production",xRe=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const[i,a]=UB(),l=()=>{a(c=>({hide:!c.hide}))};return S(nr,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[s(Bt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),s("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),s(Gr,{label:"Don't show again",control:s(es,{checked:i.hide,onChange:l})})]})},CRe=(e,t)=>{const[n]=UB(),r=e.environments.find(o=>o.name===t);return n.hide?!1:(r==null?void 0:r.type)===SRe},ERe="useFeatureStrategyProdGuardSettings:v2",UB=uT(ERe,{hide:!1}),TRe=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&Mn(["In review","Approved"],r.state)):!1,alert:s(Bt,{sx:{margin:"1rem 0"},severity:"warning",children:"You currently have a change request in review for this environment. Adding a new change will add the change to the existing change request, and all existing approvals will be reset. Are you sure you want to continue?"})}),WB=(e,t,n,r={})=>{const{isEnterprise:o}=St();return Dd(o(),e,t,n,r)},kRe=e=>fetch(e).then(xn("ChangeRequest")).then(t=>t.json()),f0=e=>{const{data:t,error:n,mutate:r}=WB([],kt(`api/admin/projects/${e}/change-requests/pending`),kRe);return{data:t,loading:!n&&!t,refetch:r,error:n}},ARe=({title:e,setTitle:t})=>S(fe,{sx:{paddingBottom:n=>n.spacing(2)},children:[s(re,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),s(ir,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),RRe=({enabled:e,onToggleEnabled:t})=>s(Gr,{control:s(pa,{name:"enabled",onChange:t,checked:e}),label:"Enabled – This strategy will be used when evaluating feature toggles."}),_Re=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),PRe=function(e){return"/"+e},HI={},Yd=function(t,n,r){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(i=>{if(i=PRe(i),i in HI)return;HI[i]=!0;const a=i.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!r)for(let d=o.length-1;d>=0;d--){const p=o[d];if(p.href===i&&(!a||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":_Re,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((d,p)=>{u.addEventListener("load",d),u.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})},IRe=({values:e=[],updateValues:t,placeholder:n="",error:r,...o})=>{const i=l=>{const u=l.target.value.split(/,\s?/).map(d=>d.trim());t(u)},a=l=>{if(l.key==="Backspace"){const c=l.target.value;if(c.endsWith(", ")){l.preventDefault();const u=c.slice(0,-2);t(u.split(/,\s*/))}}};return s(fn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:a,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},ORe=x("div")(({theme:e})=>({display:"flex",alignItems:"center",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%",alignItems:"flex-start"}}})),$Re=x(fg)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),NRe=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),LRe=x(IRe)(()=>({width:"100%"})),DRe=x(fn)(()=>({width:"100%"})),MRe=({overrides:e,overridesDispatch:t})=>{const{context:n}=ga(),r=n.map(({name:a})=>({key:a,label:a})),o=a=>l=>{t({type:"UPDATE_VALUES_AT",payload:[a,l]})},i=a=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[a,c||[]]})};return s(ce,{children:e.map((a,l)=>{var p;const c=n.find(({name:f})=>f===a.contextName),u=((p=c==null?void 0:c.legalValues)==null?void 0:p.map(({value:f})=>f))||[],d=a.values.filter(f=>u.includes(f));return S(ORe,{children:[s($Re,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:a.contextName,options:r,onChange:f=>t({type:"UPDATE_TYPE_AT",payload:[l,f.target.value]})}),S(NRe,{children:[s(V,{condition:!!(u&&u.length>0),show:s($d,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(f,h)=>f===h,options:u,onChange:i(l),getOptionLabel:f=>f,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:f=>s(DRe,{...f,variant:"outlined",label:"Legal values"})}),elseShow:s(LRe,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:a.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),s(wt,{title:"Remove",arrow:!0,children:s(jt,{onClick:f=>{f.preventDefault(),t({type:"REMOVE",payload:l})},children:s(yo,{})})})]})]},`override=${l}`)})})},BRe=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((a,l)=>l!==t.payload);case"UPDATE_VALUES_AT":const[n,r]=t.payload;return e.map((a,l)=>l===n?{...a,values:r}:a);case"UPDATE_TYPE_AT":const[o,i]=t.payload;return e.map((a,l)=>l===o?{...a,contextName:i}:a)}},FRe=(e=[])=>g.useReducer(BRe,e);var ds=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(ds||{});const vg=e=>{var n;const{uiConfig:t}=St();return((n=t==null?void 0:t.flags)==null?void 0:n[e])||!1},zRe=Te.lazy(()=>Yd(()=>import("./ReactJSONEditor-95bd65b6.js"),[])),jRe=x("div")(({theme:e})=>({position:"relative",backgroundColor:e.palette.neutral.light,display:"flex",flexDirection:"column",padding:e.spacing(3),marginBottom:e.spacing(3),borderRadius:e.shape.borderRadiusLarge,overflow:"hidden"})),URe=x("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),WRe=x(wt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),HB=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),VI=x(HB)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),HRe=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),VRe=x(Gr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),GRe=x("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),GI=x(ir)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),qRe=x("div")(({theme:e})=>({marginLeft:e.spacing(3)})),KRe=x(ir)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),YRe=x("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),VB=x("div")(({theme:e})=>({display:"flex",rowGap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column","& > div, .MuiInputBase-root":{width:"100%"}}})),XRe=x(VB)({alignItems:"end",justifyContent:"space-between"}),JRe=x(fg)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),QRe=x(Ve)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),Gw=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"}],ZRe={type:"string",value:""},e_e=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:a})=>{const[l,c]=g.useState(e.name),[u,d]=g.useState(e.weightType===ds.FIX),[p,f]=g.useState(String(e.weight/10)),[h,m]=g.useState(e.payload||ZRe),[y,b]=FRe("overrides"in e?e.overrides||[]:[]),{context:v}=ga(),[w,C]=g.useState({}),k=vg("variantTypeNumber");g.useEffect(()=>{k&&!Gw.some(H=>H.key==="number")&&Gw.push({key:"number",label:"number"})},[k]);const A=H=>{C(j=>({...j,[H]:void 0}))},T=(H,j)=>{C(U=>({...U,[H]:j}))};g.useEffect(()=>{A("percentage"),o!=null&&o.includes("%")&&T("percentage","Total weight must equal 100%")},[o]);const _=!e.new,P=t.filter(({id:H,weightType:j})=>H!==e.id&&j===ds.VARIABLE).length>0,I=H=>{const j=H.weightType===ds.VARIABLE,U=t.some(N=>N.weightType===ds.FIX),R=t.filter(N=>N.weightType===ds.VARIABLE).length===1;return U&&R&&j},O=H=>{A("name"),q(H,e.id)||T("name","A variant with that name already exists for this environment."),c(H.trim())},$=H=>{(H===""||Y(H))&&f(H)},F=H=>{te(H)||T("payload",H.type==="json"?"Invalid json":"Invalid number")},D=()=>{v.length>0&&b({type:"ADD",payload:{contextName:v[0].name,values:[]}})},B=H=>!!H.length,q=(H,j)=>_||!t.some(U=>U.name===H&&U.id!==j),Y=H=>{if(!u)return!0;if(H===""||H.match(/\.[0-9]{2,}$/))return!1;const j=Number(H);return j>=0&&j<=100},te=H=>{try{return H.type==="json"&&JSON.parse(H.value),k&&H.type==="number"?!Number.isNaN(Number(H.value)):!0}catch{return!1}};return g.useEffect(()=>{const H={...e,name:l,weight:Number(u?p:100)*10,weightType:u?ds.FIX:ds.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:h.value?h:void 0,isValid:B(l)&&q(l,e.id)&&Y(p)&&te(h)&&!o};i||(H.overrides=y.map(j=>({contextName:j.contextName,values:j.values})).filter(j=>j.values&&j.values.length>0)),n(H)},[l,u,p,h,y]),g.useEffect(()=>{u||f(String(e.weight/10))},[e.weight]),S(jRe,{"data-testid":"VARIANT",children:[s(URe,{color:a}),s(WRe,{arrow:!0,title:I(e)?"You need to have at least one variable variant":"Delete variant",children:s("div",{children:s(jt,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:I(e),children:s(yo,{})})})}),S(XRe,{children:[S(YRe,{children:[s(HB,{children:"Variant name"}),s(HRe,{children:"This will be used to identify the variant in your code"}),s(GI,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:l,onChange:H=>O(H.target.value),disabled:_,required:!0})]}),s(V,{condition:P,show:S(qRe,{children:[s(VRe,{label:"Custom percentage",control:s(pa,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:u,onChange:H=>d(H.target.checked)})}),s(KRe,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!w.percentage,errorText:w.percentage,value:p,onChange:H=>$(H.target.value),required:u,disabled:!u,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:s(ph,{position:"end",children:"%"})}})]})})]}),S(VI,{children:["Payload",s(Wi,{tooltip:"Passed along with the the variant object."})]}),S(VB,{children:[s(JRe,{id:"variant-payload-type",name:"type",label:"Type",value:h.type,options:Gw,onChange:H=>{A("payload"),m(j=>({...j,type:H.target.value}))}}),s(GRe,{children:s(V,{condition:h.type==="json",show:s(g.Suspense,{fallback:null,children:s(zRe,{content:{text:h.value},onChange:H=>m(j=>{var U;return{...j,value:"json"in H?((U=H.json)==null?void 0:U.toString())||"":H.text}})})}),elseShow:s(GI,{id:"variant-payload-value",name:"variant-payload-value",label:"Value",multiline:h.type!=="string",rows:h.type==="string"||h.type==="number"?1:4,value:h.value,onChange:H=>{A("payload"),m(j=>({...j,value:H.target.value}))},placeholder:"",onBlur:()=>F(h),error:!!w.payload,errorText:w.payload})})})]}),i?null:S(ce,{children:[S(VI,{children:["Overrides",s(Wi,{tooltip:"Here you can specify which users should get this variant."})]}),s(MRe,{overrides:y,overridesDispatch:b}),s("div",{children:s(QRe,{onClick:D,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})};let Pm;const t_e=new Uint8Array(16);function n_e(){if(!Pm&&(Pm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pm))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pm(t_e)}const to=[];for(let e=0;e<256;++e)to.push((e+256).toString(16).slice(1));function r_e(e,t=0){return(to[e[t+0]]+to[e[t+1]]+to[e[t+2]]+to[e[t+3]]+"-"+to[e[t+4]]+to[e[t+5]]+"-"+to[e[t+6]]+to[e[t+7]]+"-"+to[e[t+8]]+to[e[t+9]]+"-"+to[e[t+10]]+to[e[t+11]]+to[e[t+12]]+to[e[t+13]]+to[e[t+14]]+to[e[t+15]]).toLowerCase()}const o_e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),qI={randomUUID:o_e};function KI(e,t,n){if(qI.randomUUID&&!t&&!e)return qI.randomUUID();e=e||{};const r=e.random||(e.rng||n_e)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=r[o];return t}return r_e(r)}const i_e=x(fe)(()=>({display:"flex",width:"100%",position:"relative"})),a_e=x(fe)(({theme:e})=>({position:"absolute",height:e.spacing(3),width:"100%",display:"flex",overflow:"hidden"})),s_e=x(fe)(()=>({height:"100%",display:"flex",flexDirection:"column",alignItems:"center",width:"100%"})),l_e=x(fe,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({height:e.spacing(1.8),width:"100%",position:"relative",background:e.palette.variants[t%e.palette.variants.length]})),c_e=x(fe)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),YI=x(re)(({theme:e})=>({marginY:e.spacing(1)})),u_e=x(fe)(()=>({display:"flex",alignItems:"center",marginLeft:"auto"})),GB=x(fe,{shouldForwardProp:e=>e!=="index"})(({theme:e,index:t})=>({display:"flex",alignItems:"center",marginRight:e.spacing(2),"& div":{width:e.spacing(1.6),height:e.spacing(1.6),borderRadius:"50%",marginRight:e.spacing(1),background:e.palette.variants[t%e.palette.variants.length]}})),d_e=x(re)(({theme:e})=>({marginTop:e.spacing(1)})),p_e=({variants:e})=>e.length<1?null:S(fe,{sx:t=>({marginTop:t.spacing(2)}),children:[s(f_e,{variants:e}),S(i_e,{children:[s(a_e,{}),e.map((t,n)=>{const r=t.weight/10;return s($l,{variant:"custom",arrow:!0,onClick:o=>o.preventDefault(),titleComponent:s(v_e,{variant:t,index:n}),children:S(fe,{style:{width:`${r}%`},children:[" ",S(s_e,{children:[s(l_e,{index:n}),S(d_e,{variant:"subtitle2",children:[r,"%"]})]})]})},n)})]})]}),f_e=({variants:e})=>S(c_e,{children:[S(YI,{variant:"body2",children:["Feature variants (",e.length,")"]}),s(u_e,{children:e.map((t,n)=>S(GB,{index:n,children:[s(fe,{}),s(YI,{variant:"body2",children:t.name})]},n))})]}),h_e=x(fe)(()=>({display:"flex",flexDirection:"column"})),g_e=x(fe)(()=>({display:"flex",alignItems:"center",minWidth:"250px"})),m_e=x(fe)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column"})),y_e=x(re)(({theme:e})=>({marginBottom:e.spacing(1)})),v_e=({variant:e,index:t})=>S(h_e,{children:[S(g_e,{children:[s(GB,{index:t,children:s(fe,{})}),S(re,{variant:"subtitle2",children:[e.weight/10,"% - ",e.name]})]}),e.payload?S(m_e,{children:[s(y_e,{variant:"body2",children:"Payload"}),s(V,{condition:e.payload.type==="json",show:s("code",{children:e.payload.value}),elseShow:s(re,{variant:"body2",children:e.payload.value})})]}):null]}),b_e=()=>S(Bt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",s(w_e,{}),"."]}),Xze=()=>S(Bt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",s("b",{children:"variants inside strategies"}),". ",s(S_e,{})]}),w_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),S_e=()=>s("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),x_e=x("div")({display:"flex",flexDirection:"column"}),C_e=({strategy:e,setStrategy:t,projectId:n,environment:r})=>{const{trackEvent:o}=jn(),[i,a]=g.useState([]),l=on(),c=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";g.useEffect(()=>{a((e.variants||[]).map(p=>({...p,new:!1,isValid:!0,id:KI(),overrides:[]})))},[]),g.useEffect(()=>{t(p=>({...p,variants:i.map(f=>({stickiness:c,name:f.name,weight:f.weight,payload:f.payload,weightType:f.weightType}))}))},[c,JSON.stringify(i)]);const u=(p,f)=>{a(h=>H3(h.map(m=>m.id===f?p:m),1e3))},d=()=>{const p=KI();a(f=>[...f,{name:"",weightType:ds.VARIABLE,weight:0,stickiness:c,new:!0,isValid:!1,id:p}]),o("strategy-variants",{props:{eventType:"variant added"}})};return S(ce,{children:[S(re,{component:"h3",sx:{m:0,display:"flex",gap:"1ch"},variant:"h3",children:["Variants",s(Wi,{htmlTooltip:!0,tooltip:S(ce,{children:[s("span",{children:"Variants allow to attach one or more values to this strategy. Variants at the strategy level override variants at the feature level."}),s(Nr,{target:"_blank",href:"https://docs.getunleash.io/reference/strategy-variants",children:"Learn more"})]})})]}),S(x_e,{children:[s(b_e,{}),i.map((p,f)=>s(e_e,{disableOverrides:!0,variant:p,variants:i,updateVariant:h=>u(h,p.id),removeVariant:()=>a(h=>H3(h.filter(m=>m.id!==p.id),1e3)),decorationColor:l.palette.variants[f%l.palette.variants.length]},p.id))]}),s(Io,{onClick:d,variant:"outlined",permission:f9,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",children:"Add variant"}),s(p_e,{variants:i})]})},E_e=x("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),Up=x("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),T_e=x("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),qB=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:a,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:p,isChangeRequest:f})=>{const{trackEvent:h}=jn(),[m,y]=g.useState(!1),b=Tk(l.constraints),v=CRe(t,n),w=cd(r,e,n),{strategyDefinition:C}=kk(l==null?void 0:l.name),{data:k}=f0(t.project),{changeRequestInReviewOrApproved:A,alert:T}=TRe(k),_=A(n||""),P=_?"Add to existing change request":"Add change to draft",I=pt(),{uiConfig:O,error:$,loading:F}=St();if($)throw $;if(F||!C)return null;const D=H=>C.parameters.find(j=>j.name===H),B=(H,j)=>{const U=yRe(D(H),j);return U?(p.setFormError(H,U),!1):(p.removeFormError(H),!0)},q=()=>C.parameters.map(H=>H.name).map(H=>{var j;return B(H,(j=l.parameters)==null?void 0:j[H])}).every(Boolean),Y=()=>{I(Ak(t.project,t.name))};return S(E_e,{onSubmit:async H=>{var j;Array.isArray(l.variants)&&((j=l.variants)==null?void 0:j.length)>0&&h("strategy-variants",{props:{eventType:"submitted"}}),H.preventDefault(),q()&&(v&&!f?y(!0):o())},children:[s(V,{condition:_,show:T,elseShow:s(V,{condition:!!f,show:s(wRe,{environment:n})})}),s(BCe,{projectId:t.project,featureId:t.name,environmentId:n,children:s(V,{condition:!!f,show:S(Bt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as these changes are approved and applied."]}),elseShow:S(Bt,{severity:"success",children:["This feature toggle is currently enabled in the"," ",s("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit ",s("strong",{children:"save"}),"."]})})}),s(Up,{}),s(ARe,{title:l.title||"",setTitle:H=>{c(j=>({...j,title:H}))}}),s(mRe,{segments:u,setSegments:d,projectId:e}),s(XAe,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c}),s(Up,{}),s(NCe,{strategy:l,strategyDefinition:C,setStrategy:c,validateParameter:B,errors:p,hasAccess:w}),s(Up,{}),s(V,{condition:l.parameters!=null&&"stickiness"in l.parameters,show:s(C_e,{strategy:l,setStrategy:c,environment:n,projectId:e})}),s(Up,{}),s(RRe,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(H=>({...H,disabled:!H.disabled}))}),s(Up,{}),S(T_e,{children:[s(Io,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:a||!b||p.hasFormErrors(),"data-testid":yse,children:f?P:"Save strategy"}),s(Ve,{type:"button",color:"primary",onClick:i||Y,disabled:a,children:"Cancel"}),s(xRe,{open:m,onClose:()=>y(!1),onClick:o,loading:a,label:"Save strategy"})]})]})},XI=e=>{const t=new URLSearchParams(window.location.search).get(e);if(!t)throw new Error(`Missing required query param: ${e}`);return t},k_e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{addStrategyToFeature:async(u,d,p,f)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies`,m=t(h,{method:"POST",body:JSON.stringify(f)},"addStrategyToFeature");return(await e(m.caller,m.id)).json()},updateStrategyOnFeature:async(u,d,p,f,h)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${f}`,y=t(m,{method:"PUT",body:JSON.stringify(h)},"updateStrategyOnFeature");await e(y.caller,y.id)},deleteStrategyFromFeature:async(u,d,p,f)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${f}`,m=t(h,{method:"DELETE"},"deleteStrategyFromFeature");await e(m.caller,m.id)},setStrategiesSortOrder:async(u,d,p,f)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/set-sort-order`,m=t(h,{method:"POST",body:JSON.stringify(f)},"setStrategiesSortOrderOnFeature");await e(m.caller,m.id)},setStrategyDisabledState:async(u,d,p,f,h)=>{const m=`api/admin/projects/${u}/features/${d}/environments/${p}/strategies/${f}`,y=t(m,{method:"PATCH",body:JSON.stringify([{path:"/disabled",value:h,op:"replace"}])},"setStrategyDisabledState");await e(y.caller,y.id)},loading:r,errors:n}},KB=()=>{const[e,t]=g.useState({}),n=g.useCallback(a=>e[a],[e]),r=g.useCallback((a,l)=>{t(Ei(c=>{c[a]=l}))},[t]),o=g.useCallback(a=>{t(Ei(l=>{delete l[a]}))},[t]),i=g.useCallback(()=>Object.values(e).some(Boolean),[e]);return{getFormError:n,setFormError:r,removeFormError:o,hasFormErrors:i}},A_e=(e,t)=>{const n=t.parameters.map(r=>r.name);return Object.fromEntries(Object.entries(e).sort((r,o)=>n.indexOf(r[0])-n.indexOf(o[0])))};var JI=Object.prototype.hasOwnProperty;function QI(e,t,n){for(n of e.keys())if(Bf(n,t))return n}function Bf(e,t){var n,r,o;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Bf(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(o=r,o&&typeof o=="object"&&(o=QI(t,o),!o)||!t.has(o))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(o=r[0],o&&typeof o=="object"&&(o=QI(t,o),!o)||!Bf(r[1],t.get(o)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(JI.call(e,n)&&++r&&!JI.call(t,n)||!(n in t)||!Bf(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var YB={exports:{}};(function(e,t){(function(n,r){var o=r(n);e.exports=o})(xi,function(n){var r=["N","E","A","D"];function o(P,I){P.super_=I,P.prototype=Object.create(I.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}})}function i(P,I){Object.defineProperty(this,"kind",{value:P,enumerable:!0}),I&&I.length&&Object.defineProperty(this,"path",{value:I,enumerable:!0})}function a(P,I,O){a.super_.call(this,"E",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0}),Object.defineProperty(this,"rhs",{value:O,enumerable:!0})}o(a,i);function l(P,I){l.super_.call(this,"N",P),Object.defineProperty(this,"rhs",{value:I,enumerable:!0})}o(l,i);function c(P,I){c.super_.call(this,"D",P),Object.defineProperty(this,"lhs",{value:I,enumerable:!0})}o(c,i);function u(P,I,O){u.super_.call(this,"A",P),Object.defineProperty(this,"index",{value:I,enumerable:!0}),Object.defineProperty(this,"item",{value:O,enumerable:!0})}o(u,i);function d(P,I,O){var $=P.slice((O||I)+1||P.length);return P.length=I<0?P.length+I:I,P.push.apply(P,$),P}function p(P){var I=typeof P;return I!=="object"?I:P===Math?"math":P===null?"null":Array.isArray(P)?"array":Object.prototype.toString.call(P)==="[object Date]"?"date":typeof P.toString=="function"&&/^\/.*\//.test(P.toString())?"regexp":"object"}function f(P){var I=0;if(P.length===0)return I;for(var O=0;O<P.length;O++){var $=P.charCodeAt(O);I=(I<<5)-I+$,I=I&I}return I}function h(P){var I=0,O=p(P);if(O==="array"){P.forEach(function(q){I+=h(q)});var $="[type: array, hash: "+I+"]";return I+f($)}if(O==="object"){for(var F in P)if(P.hasOwnProperty(F)){var D="[ type: object, key: "+F+", value hash: "+h(P[F])+"]";I+=f(D)}return I}var B="[ type: "+O+" ; value: "+P+"]";return I+f(B)}function m(P,I,O,$,F,D,B,q){O=O||[],F=F||[],B=B||[];var Y=F.slice(0);if(typeof D<"u"&&D!==null){if($){if(typeof $=="function"&&$(Y,D))return;if(typeof $=="object"){if($.prefilter&&$.prefilter(Y,D))return;if($.normalize){var te=$.normalize(Y,D,P,I);te&&(P=te[0],I=te[1])}}}Y.push(D)}p(P)==="regexp"&&p(I)==="regexp"&&(P=P.toString(),I=I.toString());var H=typeof P,j=typeof I,U,R,N,X,se=H!=="undefined"||B&&B.length>0&&B[B.length-1].lhs&&Object.getOwnPropertyDescriptor(B[B.length-1].lhs,D),we=j!=="undefined"||B&&B.length>0&&B[B.length-1].rhs&&Object.getOwnPropertyDescriptor(B[B.length-1].rhs,D);if(!se&&we)O.push(new l(Y,I));else if(!we&&se)O.push(new c(Y,P));else if(p(P)!==p(I))O.push(new a(Y,P,I));else if(p(P)==="date"&&P-I!==0)O.push(new a(Y,P,I));else if(H==="object"&&P!==null&&I!==null){for(U=B.length-1;U>-1;--U)if(B[U].lhs===P){X=!0;break}if(X)P!==I&&O.push(new a(Y,P,I));else{if(B.push({lhs:P,rhs:I}),Array.isArray(P)){for(q&&(P.sort(function(ee,ae){return h(ee)-h(ae)}),I.sort(function(ee,ae){return h(ee)-h(ae)})),U=I.length-1,R=P.length-1;U>R;)O.push(new u(Y,U,new l(void 0,I[U--])));for(;R>U;)O.push(new u(Y,R,new c(void 0,P[R--])));for(;U>=0;--U)m(P[U],I[U],O,$,Y,U,B,q)}else{var ge=Object.keys(P),Ie=Object.keys(I);for(U=0;U<ge.length;++U)N=ge[U],X=Ie.indexOf(N),X>=0?(m(P[N],I[N],O,$,Y,N,B,q),Ie[X]=null):m(P[N],void 0,O,$,Y,N,B,q);for(U=0;U<Ie.length;++U)N=Ie[U],N&&m(void 0,I[N],O,$,Y,N,B,q)}B.length=B.length-1}}else P!==I&&(H==="number"&&isNaN(P)&&isNaN(I)||O.push(new a(Y,P,I)))}function y(P,I,O,$,F){var D=[];if(m(P,I,D,$,null,null,null,F),O)for(var B=0;B<D.length;++B)O(D[B]);return D}function b(P,I,O,$,F,D,B){return m(P,I,O,$,F,D,B,!0)}function v(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,D=y(P,I,F,O);return $||(D.length?D:void 0)}function w(P,I,O,$){var F=$?function(B){B&&$.push(B)}:void 0,D=y(P,I,F,O,!0);return $||(D.length?D:void 0)}function C(P,I,O){if(O.path&&O.path.length){var $=P[I],F,D=O.path.length-1;for(F=0;F<D;F++)$=$[O.path[F]];switch(O.kind){case"A":C($[O.path[F]],O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}else switch(O.kind){case"A":C(P[I],O.index,O.item);break;case"D":P=d(P,I);break;case"E":case"N":P[I]=O.rhs;break}return P}function k(P,I,O){if(typeof O>"u"&&I&&~r.indexOf(I.kind)&&(O=I),P&&O&&O.kind){for(var $=P,F=-1,D=O.path?O.path.length-1:0;++F<D;)typeof $[O.path[F]]>"u"&&($[O.path[F]]=typeof O.path[F+1]<"u"&&typeof O.path[F+1]=="number"?[]:{}),$=$[O.path[F]];switch(O.kind){case"A":O.path&&typeof $[O.path[F]]>"u"&&($[O.path[F]]=[]),C(O.path?$[O.path[F]]:$,O.index,O.item);break;case"D":delete $[O.path[F]];break;case"E":case"N":$[O.path[F]]=O.rhs;break}}}function A(P,I,O){if(O.path&&O.path.length){var $=P[I],F,D=O.path.length-1;for(F=0;F<D;F++)$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}else switch(O.kind){case"A":A(P[I],O.index,O.item);break;case"D":P[I]=O.lhs;break;case"E":P[I]=O.lhs;break;case"N":P=d(P,I);break}return P}function T(P,I,O){if(P&&I&&O&&O.kind){var $=P,F,D;for(D=O.path.length-1,F=0;F<D;F++)typeof $[O.path[F]]>"u"&&($[O.path[F]]={}),$=$[O.path[F]];switch(O.kind){case"A":A($[O.path[F]],O.index,O.item);break;case"D":$[O.path[F]]=O.lhs;break;case"E":$[O.path[F]]=O.lhs;break;case"N":delete $[O.path[F]];break}}}function _(P,I,O){if(P&&I){var $=function(F){(!O||O(P,I,F))&&k(P,I,F)};y(P,I,$)}}return Object.defineProperties(v,{diff:{value:v,enumerable:!0},orderIndependentDiff:{value:w,enumerable:!0},observableDiff:{value:y,enumerable:!0},orderIndependentObservableDiff:{value:b,enumerable:!0},orderIndepHash:{value:h,enumerable:!0},applyDiff:{value:_,enumerable:!0},applyChange:{value:k,enumerable:!0},revertChange:{value:T,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),v.DeepDiff=v,n&&(n.DeepDiff=v),v})})(YB);var R_e=YB.exports;const __e={A:" ",E:" ",D:"-",N:"+"},Xd=({entry:e,sort:t=(n,r)=>n.key.localeCompare(r.key)})=>{const n=Kh(),r={A:{color:n.palette.eventLog.edited},E:{color:n.palette.eventLog.edited},D:{color:n.palette.eventLog.diffSub},N:{color:n.palette.eventLog.diffAdd}},o=e.data&&e.preData?R_e.diff(e.preData,e.data):void 0,i=(c,u)=>{let d;return c.lhs!==void 0?d=S("div",{style:r.D,children:["- ",u,": ",JSON.stringify(c.lhs)]}):c.rhs!==void 0&&(d=S("div",{style:r.N,children:["+ ",u,": ",JSON.stringify(c.rhs)]})),d},a=(c,u)=>{var f;let d;const p=((f=c.path)==null?void 0:f.join("."))??c.index;if(c.item)d=i(c.item,p);else if(c.lhs!==void 0&&c.rhs!==void 0)d=S("div",{children:[S("div",{style:r.D,children:["- ",p,": ",JSON.stringify(c.lhs)]}),S("div",{style:r.N,children:["+ ",p,": ",JSON.stringify(c.rhs)]})]});else{const h=JSON.stringify(c.rhs||c.item);d=S("div",{style:r[c.kind],children:[__e[c.kind]," ",p,h?`: ${h}`:c.kind==="D"?" (deleted)":""]})}return{key:p.toString(),value:s("div",{children:d},u),index:u}};let l=[];if(o)l=o.map(a).sort(t).map(({value:c})=>c);else if(e.data==null||e.preData==null){const c=e.data||e.preData;l=[s("div",{style:e.data?r.N:r.D,children:JSON.stringify(c,null,2)},0)]}return s("pre",{style:{overflowX:"auto",overflowY:"hidden"},tabIndex:0,children:s("code",{children:l.length===0?"(no changes)":l})})},P_e=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=on(),a=or(i.breakpoints.down("sm")),l=g.useMemo(()=>{const c={...BL,padding:`${i.spacing(3)} ${i.spacing(4)}`,boxShadow:i.boxShadows.elevated,borderRadius:i.shape.borderRadiusLarge,backgroundColor:i.palette.background.paper,maxWidth:i.spacing(75),zIndex:i.zIndex.mobileStepper};return a?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,a]);return S(DE,{mounted:t,start:l,enter:FL,children:[s(re,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),s(re,{variant:"body1",sx:{my:2,mb:3},children:"The data you have been working on is stale, would you like to refresh your data? This may happen if someone has been making changes to the data while you were working."}),s(Xd,{entry:{preData:o,data:r}}),s(Ve,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},I_e=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},XB=(e,t,n,r)=>{const{data:o,refetch:i}=I_e(e),[a,l]=g.useState(t||null),[c,u]=g.useState(!1),d=f=>{u(!1),l(f)},p=f=>f&&(r&&typeof r=="function"?r(f):f);return g.useEffect(()=>{a===null&&l(t)},[t]),g.useEffect(()=>{if(!a||!o)return;Bf(p(a),p(o))||u(!0)},[o]),{data:a,refetch:i,staleDataNotification:s(P_e,{cache:p(a),data:p(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}};function fC(e,t){if(Array.isArray(e))return e.map(n=>fC(n,t));if(typeof e=="object"&&e!==null){const n={};for(const[r,o]of Object.entries(e))r!==t&&(n[r]=fC(o,t));return n}return e}const JB=e=>{const t={...e};return fC(t,"lastSeenAt")},Jd=()=>{const{trackEvent:e}=jn(),{makeRequest:t,createRequest:n,errors:r,loading:o}=Gn({propagateErrors:!0});return{addChange:async(h,m,y)=>{e("change_request",{props:{eventType:"change added"}});const b=`api/admin/projects/${h}/environments/${m}/change-requests`,v=n(b,{method:"POST",body:JSON.stringify(y)});try{return(await t(v.caller,v.id)).json()}catch(w){throw w}},editChange:async(h,m,y,b)=>{const v=`api/admin/projects/${h}/change-requests/${m}/changes/${y}`,w=n(v,{method:"PUT",body:JSON.stringify(b)});try{return await t(w.caller,w.id)}catch(C){throw C}},changeState:async(h,m,y)=>{e("change_request",{props:{eventType:y.state}});const b=`api/admin/projects/${h}/change-requests/${m}/state`,v=n(b,{method:"PUT",body:JSON.stringify(y)});try{return(await t(v.caller,v.id)).json()}catch(w){throw w}},discardChange:async(h,m,y)=>{const b=`api/admin/projects/${h}/change-requests/${m}/changes/${y}`,v=n(b,{method:"DELETE"});try{return await t(v.caller,v.id)}catch(w){throw w}},updateChangeRequestEnvironmentConfig:async({project:h,enabled:m,environment:y,requiredApprovals:b})=>{const v=`api/admin/projects/${h}/environments/${y}/change-requests/config`,w=n(v,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:m,requiredApprovals:b})});try{return await t(w.caller,w.id)}catch(C){throw C}},discardDraft:async(h,m)=>{const y=`api/admin/projects/${h}/change-requests/${m}`,b=n(y,{method:"DELETE"});try{return await t(b.caller,b.id)}catch(v){throw v}},addComment:async(h,m,y)=>{e("change_request",{props:{eventType:"comment added"}});const b=`/api/admin/projects/${h}/change-requests/${m}/comments`,v=n(b,{method:"POST",body:JSON.stringify({text:y})});try{return await t(v.caller,v.id)}catch(w){throw w}},updateTitle:async(h,m,y)=>{e("change_request",{props:{eventType:"title updated"}});const b=`api/admin/projects/${h}/change-requests/${m}/title`,v=n(b,{method:"PUT",body:JSON.stringify({title:y})});try{await t(v.caller,v.id)}catch(w){throw w}},errors:r,loading:o}},O_e=()=>{const[e,t]=g.useState(""),{trackEvent:n}=jn();return{setPreviousTitle:t,trackTitle:(o="")=>{o===e&&n("strategyTitle",{props:{action:"none",on:"edit"}}),e===""&&o!==""&&n("strategyTitle",{props:{action:"added",on:"edit"}}),e!==""&&o===""&&n("strategyTitle",{props:{action:"removed",on:"edit"}}),e!==""&&o!==""&&o!==e&&n("strategyTitle",{props:{action:"edited",on:"edit"}})}}},Jze=()=>{const e=lr("projectId"),t=lr("featureId"),n=XI("environmentId"),r=XI("strategyId"),[o,i]=g.useState({}),[a,l]=g.useState([]),{updateStrategyOnFeature:c,loading:u}=k_e(),{strategyDefinition:d}=kk(o.name),{setToastData:p,setToastApiError:f}=Ot(),h=KB(),{uiConfig:m}=St(),{unleashUrl:y}=m,b=pt(),{addChange:v}=Jd(),{isChangeRequestConfigured:w}=jc(e),{refetch:C}=f0(e),{setPreviousTitle:k}=O_e(),{feature:A,refetchFeature:T}=Ja(e,t),_=g.useRef(A),{data:P,staleDataNotification:I,forceRefreshCache:O}=XB({unleashGetter:Ja,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},A,{afterSubmitAction:T},JB);g.useEffect(()=>{_.current.name===""&&A.name&&(O(A),_.current=A)},[A]);const{segments:$,refetchSegments:F}=Ll(r);g.useEffect(()=>{const te=P==null?void 0:P.environments.flatMap(H=>H.strategies).find(H=>H.id===r);i(H=>({...H,...te})),k((te==null?void 0:te.title)||"")},[r,P]),g.useEffect(()=>{$&&l($)},[JSON.stringify($)]);const D=$_e(o,a),B=async te=>{await c(e,t,n,r,te),await F(),p({title:"Strategy updated",type:"success",confetti:!0})},q=async te=>{await v(e,n,{action:"updateStrategy",feature:t,payload:{...te,id:r}}),p({title:"Change added to draft",type:"success",confetti:!0}),C()},Y=async()=>{try{w(n)?await q(D):await B(D),T(),b(Ak(e,t))}catch(te){f(gt(te))}};return!o.id||!d||!P?null:S(Er,{modal:!0,title:ks(o.name??""),description:L_e,documentationLink:D_e,documentationLinkLabel:M_e,formatApiCode:()=>N_e(e,t,n,r,D,d,y),children:[s(qB,{projectId:e,feature:P,strategy:o,setStrategy:i,segments:a,setSegments:l,environmentId:n,onSubmit:Y,loading:u,permission:H1,errors:h,isChangeRequest:w(n)}),I]})},$_e=(e,t)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:t.map(n=>n.id),disabled:e.disabled??!1}),Ak=(e,t)=>`/projects/${e}/features/${t}`,Rk=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},N_e=(e,t,n,r,o,i,a)=>{if(!a)return"";const l={...o,parameters:A_e(o.parameters??{},i)},c=`${a}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${c}' \\
316
316
  --header 'Authorization: INSERT_API_KEY' \\
317
317
  --header 'Content-Type: application/json' \\
318
318
  --data-raw '${u}'`},L_e=`
@@ -378,12 +378,12 @@ The flag name should contain the project name, the feature name, and the ticket
378
378
  --data-raw '${JSON.stringify(C(),void 0,2)}'`,F=eOe(r==null?void 0:r.project)(),{addChange:D}=Jd();return s(Er,{loading:u,modal:e,title:"Edit segment",description:E8,documentationLink:jB,documentationLinkLabel:"Segments documentation",formatApiCode:O,children:s(C8,{handleSubmit:async q=>{if(r){q.preventDefault(),A();try{F?await D(r.project||"",F,{action:"updateSegment",feature:null,payload:{id:r.id,...C()}}):await c(r.id,C()),d(),l(t?`/projects/${t}/settings/segments/`:"/segments/"),i({title:`Segment ${F?"change added to draft":"updated"}`,type:"success"})}catch(Y){a(gt(Y))}}},name:p,setName:f,description:h,setDescription:m,project:y,setProject:b,constraints:v,setConstraints:w,errors:k,clearErrors:A,mode:"edit",children:s(Vc,{permission:bT,disabled:!T||I,"data-testid":ise,children:F?"Add to draft":"Save"})})})},nOe=()=>{const{uiConfig:e}=St(),t=pt();return s(UM,{onClick:()=>t("/environments/create"),maxWidth:"700px",Icon:fa,permission:hi,disabled:!e.flags.EEA,children:"New environment"})},rOe=(e,t,n)=>{const r=g.useRef(null);return g.useEffect(()=>{if(r.current)return r.current.dataset.index=String(e),oOe(r.current,t,(n==null?void 0:n.current)??void 0)},[e,t]),r},oOe=(e,t,n)=>{const r=p=>{$m&&t(Number($m.dataset.index),Number(e.dataset.index),p)},o=n??e,i=p=>{p.target===o&&(e.draggable=!0)},a=()=>{e.draggable=!1},l=()=>{e.draggable=!0,$m=e},c=()=>{r(!1)},u=p=>{p.preventDefault()},d=()=>{r(!0),$m=null};return o.addEventListener("mouseenter",i),o.addEventListener("mouseleave",a),n&&e.addEventListener("mouseenter",a),e.addEventListener("dragstart",l),e.addEventListener("dragenter",c),e.addEventListener("dragover",u),e.addEventListener("drop",d),()=>{o.removeEventListener("mouseenter",i),o.removeEventListener("mouseleave",a),n&&e.removeEventListener("mouseenter",a),e.removeEventListener("dragstart",l),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",u),e.removeEventListener("drop",d)}};let $m;const iOe=x(Fi)(()=>({"&:hover":{".drag-handle .drag-icon":{display:"inherit",cursor:"grab"}}})),aOe=({row:e,moveListItem:t})=>{const{hasAccess:n}=g.useContext(Po),r=g.useRef(null),{searchQuery:o}=Il(),i=!o&&n(Ux),a=rOe(e.index,t,r),l=(c,u)=>i&&c.column.isDragHandle?s(Ui,{...c.getCellProps(),ref:u,className:"drag-handle",children:c.render("Cell")}):s(Ui,{...c.getCellProps(),children:c.render("Cell")});return s(iOe,{hover:!0,ref:i?a:void 0,children:e.cells.map(c=>l(c,r))})},sOe=x(re)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallerBody})),lOe=x(re)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),hO=x(zt)(({theme:e})=>({marginLeft:e.spacing(1)})),cOe=({environment:e})=>{const{searchQuery:t}=Il();return S(zn,{sx:n=>({[n.breakpoints.up("sm")]:{minWidth:"350px"}}),children:[s(qa,{search:t,children:e.name}),s(V,{condition:e.protected,show:s(hO,{color:"success",children:"Predefined"})}),s(V,{condition:!e.enabled,show:s(Ld,{maxWidth:"270px",title:S(ce,{children:[s(sOe,{children:"Deprecated environment"}),s(lOe,{children:"This environment is not auto-enabled for new projects. The project owner will need to manually enable it in the project."})]}),describeChild:!0,arrow:!0,children:s(hO,{color:"neutral",children:"Deprecated"})})})]})},Eu=({permission:e,projectId:t,children:n,environmentId:r,tooltip:o,tooltipProps:i})=>{const{hasAccess:a}=g.useContext(Po);let l;return t&&r?l=a(e,t,r):t?l=a(e,t):l=a(e),s($l,{...i,title:W1(l,o),children:n({hasAccess:l})})},uOe=x(TE)(({theme:e})=>({padding:e.spacing(1)})),ay=x(sa)(({theme:e})=>({borderRadius:e.shape.borderRadius})),dOe=x(ay)(({theme:e})=>({color:e.palette.error.main})),pOe=x(ll)(({theme:e})=>({color:e.palette.error.main})),fOe=({environment:e,onEdit:t,onDeprecateToggle:n,onClone:r,onDelete:o})=>{const[i,a]=g.useState(null),l=!!i,c=f=>{a(f.currentTarget)},u=()=>{a(null)},d=`environment-${e.name}-actions`,p=`${d}-menu`;return S(ce,{children:[s(wt,{title:"Environment actions",arrow:!0,describeChild:!0,children:s(jt,{id:d,"aria-controls":l?p:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:s(K1,{})})}),s(kE,{id:p,anchorEl:i,open:l,onClose:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:S(uOe,{"aria-labelledby":d,children:[s(Eu,{permission:Ux,children:({hasAccess:f})=>S(ay,{onClick:()=>{t(),u()},disabled:!f||e.protected,children:[s(ll,{children:s(ji,{})}),s(en,{children:s(re,{variant:"body2",children:"Edit"})})]})}),s(Eu,{permission:hi,children:({hasAccess:f})=>S(ay,{onClick:()=>{r(),u()},disabled:!f,children:[s(ll,{children:s(vce,{})}),s(en,{children:s(re,{variant:"body2",children:"Clone"})})]})}),s(Eu,{permission:Ux,children:({hasAccess:f})=>S(ay,{onClick:()=>{n(),u()},disabled:!f||e.protected,children:[s(ll,{children:s(V,{condition:e.enabled,show:s(Jce,{}),elseShow:s(Qce,{})})}),s(en,{children:s(re,{variant:"body2",children:e.enabled?"Deprecate":"Undeprecate"})})]})}),s(Eu,{permission:Ffe,children:({hasAccess:f})=>S(dOe,{onClick:()=>{o(),u()},disabled:!f||e.protected,children:[s(pOe,{children:s(yo,{})}),s(en,{children:s(re,{variant:"body2",children:"Delete"})})]})})]})})]})},gO=(e,t)=>{var n;return!!((n=t==null?void 0:t.toLowerCase())!=null&&n.includes(e.toLowerCase()))},hOe=x(Nr)(({theme:e})=>({cursor:"pointer",fontSize:e.fontSizes.bodySize})),k8=({isAllSelected:e,onClick:t})=>s(fe,{sx:{ml:3.5,my:.5},children:s(hOe,{onClick:t,component:"button",underline:"hover",children:e?"Deselect all":"Select all"})}),gOe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",color:e.palette.text.secondary,"& > span:first-of-type":{color:e.palette.text.primary}})),mOe=x("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),yOe=x("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginRight:e.spacing(1)}})),vOe=(e,t,n)=>S("li",{...e,children:[s(es,{icon:s(g0,{fontSize:"small"}),checkedIcon:s(m0,{fontSize:"small"}),style:{marginRight:8},checked:n}),S(gOe,{children:[s("span",{children:t.name}),s("span",{children:t.description})]})]}),bOe=e=>s(mOe,{children:e.length>1?`${e.length} projects selected`:e[0].name}),wOe=({projects:e,setProjects:t})=>{const{projects:n}=ha(),r=n.sort((c,u)=>c.name.localeCompare(u.name)).map(({id:c,name:u,description:d})=>({id:c,name:u,description:d})),o=r.filter(({id:c})=>e.includes(c)),i=e.length>0&&e.length===r.length,a=()=>{const c=i?[]:r.map(({id:u})=>u);t(c)};return s(yOe,{children:s($d,{size:"small",multiple:!0,limitTags:1,openOnFocus:!0,disableCloseOnSelect:!0,value:o,onChange:(c,u,d)=>{c.type==="keydown"&&c.key==="Backspace"&&d==="removeOption"||t(u.map(({id:p})=>p))},options:r,renderOption:(c,u,{selected:d})=>vOe(c,u,d),filterOptions:(c,{inputValue:u})=>c.filter(({name:d,description:p})=>gO(u,d)||gO(u,p)),isOptionEqualToValue:(c,u)=>c.id===u.id,getOptionLabel:c=>c.name||c.description||"",renderInput:c=>s(fn,{...c,label:"Projects"}),renderTags:c=>bOe(c),groupBy:()=>"Select/Deselect all",renderGroup:({key:c,children:u})=>S(g.Fragment,{children:[s(V,{condition:r.length>2,show:s(k8,{isAllSelected:i,onClick:a})}),u]},c)})})},Hp="*",SOe=({...e})=>s(Cr,{elevation:8,...e}),xOe=x(es)(({theme:e})=>({marginRight:e.spacing(.4)})),COe=({options:e,defaultValue:t=[Hp],onChange:n,disabled:r,error:o,onFocus:i})=>{const[a,l]=g.useState(typeof t=="string"?[t]:t),[c,u]=g.useState(typeof t=="string"||t.includes(Hp)),d=a.length>0&&a.length===e.length&&a[0]!==Hp,p=(b,v)=>{v?(u(!0),n([Hp])):(u(!1),n(a.includes(Hp)?[]:a))},f=()=>{const b=d?[]:e.map(({value:v})=>v);l(b),n(b)};return S(fe,{sx:{mt:-1,mb:3},children:[s(fe,{sx:{mt:1,mb:.25,ml:1.5},children:s(Gr,{disabled:r,"data-testid":"select-all-projects",control:s(es,{checked:r||c,onChange:p}),label:"ALL current and future projects"})}),s($d,{disabled:r||c,multiple:!0,limitTags:2,options:e,disableCloseOnSelect:!0,getOptionLabel:({label:b})=>b,groupBy:()=>"Select/Deselect all",renderGroup:({key:b,children:v})=>S(g.Fragment,{children:[s(V,{condition:e.length>2,show:s(k8,{isAllSelected:d,onClick:f})}),v]},b),fullWidth:!0,PaperComponent:SOe,renderOption:(b,v,{selected:w})=>S("li",{...b,children:[s(xOe,{icon:s(g0,{fontSize:"small"}),checkedIcon:s(m0,{fontSize:"small"}),checked:w}),v.label]}),renderInput:b=>s(fn,{...b,error:!!o,helperText:o,variant:"outlined",label:"Projects",placeholder:"Select one or more projects",onFocus:i,"data-testid":"select-input"}),value:c||r?e:e.filter(b=>a.includes(b.value)),onChange:(b,v)=>{const w=v.map(({value:C})=>C);l(w),n(w)}})]})},EOe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{deleteToken:async a=>{const l=`api/admin/api-tokens/${a}`,c=t(l,{method:"DELETE"});try{return await e(c.caller,c.id)}catch(u){throw u}},createToken:async a=>{const c=t("api/admin/api-tokens",{method:"POST",body:JSON.stringify(a)});try{return await e(c.caller,c.id)}catch(u){throw u}},errors:n,loading:r}},TOe=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),cu=x("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(4)}})),eS=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),kOe=x(ir)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),AOe=x("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4)})),ROe=x("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),_Oe=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),POe=x(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),IOe=({environment:e,open:t,setOpen:n,newToken:r})=>{const{environments:o,refetchEnvironments:i}=Bd(),{cloneEnvironment:a,loading:l}=Hd(),{createToken:c}=EOe(),{projects:u}=ha(),{setToastData:d,setToastApiError:p}=Ot(),{uiConfig:f}=St(),[h,m]=g.useState(`${e.name}_clone`),[y,b]=g.useState("development"),[v,w]=g.useState([]),[C,k]=g.useState(["*"]),[A,T]=g.useState(!0),[_,P]=g.useState("later"),[I,O]=g.useState({}),$=X=>{O(se=>({...se,[X]:void 0}))},F=(X,se)=>{O(we=>({...we,[X]:se}))};g.useEffect(()=>{m(D(e.name)),b("development"),w([]),k(["*"]),T(!0),P("later"),O({})},[e]);const D=X=>{let se=`${X}_clone`,we=2;for(;!j(se);)se=`${e.name}_clone_${we}`,we++;return se},B=()=>({name:h,type:y,projects:v,clonePermissions:A}),q=()=>({username:`${h}_token`,type:"CLIENT",environment:h,projects:C}),Y=async X=>{X.preventDefault();try{if(await a(e.name,B()),_==="now"){const we=await(await c(q())).json();r(we)}d({title:"Environment successfully cloned!",type:"success"}),i(),n(!1)}catch(se){p(gt(se))}},te=()=>`curl --location --request POST '${f.unleashUrl}/api/admin/environments/${e.name}/clone' \\
379
379
  --header 'Authorization: INSERT_API_KEY' \\
380
380
  --header 'Content-Type: application/json' \\
381
- --data-raw '${JSON.stringify(B(),void 0,2)}'`,H=X=>X.length,j=X=>!(o!=null&&o.some(se=>se.name===X)),U=H(h)&&j(h)&&C.length,R=X=>{$("name"),j(X)||F("name","An environment with that name already exists."),m(X)},N=u.map(X=>({value:X.id,label:X.name}));return s(wg,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:s(Er,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature toggles and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/reference/environments#cloning-environments",documentationLinkLabel:"Cloning environments documentation",formatApiCode:te,children:S(TOe,{onSubmit:Y,children:[S("div",{children:[s(cu,{children:"What is your new environment name? (Can't be changed later)"}),s(kOe,{autoFocus:!0,label:"Environment name",error:!!I.name,errorText:I.name,value:h,onChange:X=>R(X.target.value),required:!0}),s(cu,{children:"What type of environment do you want to create?"}),s(VM,{onChange:X=>b(X.currentTarget.value),value:y}),S(cu,{children:["Select which projects you want to clone the environment configuration in?",s(Wi,{tooltip:"The cloned environment will keep the feature toggle state for the selected projects, where it will be enabled by default."})]}),s(wOe,{projects:v,setProjects:w}),s(cu,{children:"Keep the users permission for this environment?"}),s(eS,{children:"If you turn it off, the permission for this environment across all projects and feature toggles will remain only for admin and editor roles."}),s(Gr,{label:A?"Yes":"No",control:s(pa,{onChange:X=>T(X.target.checked),checked:A})}),S(AOe,{children:[s(cu,{children:"API Token"}),S(eS,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",s(Nr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s(Os,{children:S(RE,{value:_,onChange:X=>P(X.target.value),name:"api-token-generation",children:[s(Gr,{value:"later",control:s(cc,{}),label:"I want to generate an API token later"}),s(Gr,{value:"now",control:s(cc,{}),label:"Generate an API token now"})]})}),S(ROe,{children:[s(eS,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),s(V,{condition:_==="now",show:S(ce,{children:[s(cu,{children:"Which projects do you want this token to give access to?"}),s(COe,{options:N,defaultValue:C,onChange:k,error:I.projects,onFocus:()=>$("projects")})]})})]})]})]}),S(_Oe,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!U,children:"Clone environment"}),s(POe,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})};var Fk={},OOe=hn;Object.defineProperty(Fk,"__esModule",{value:!0});var A8=Fk.default=void 0,$Oe=OOe(gn()),NOe=mn,LOe=(0,$Oe.default)((0,NOe.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");A8=Fk.default=LOe;const R8=({token:e})=>{const{setToastData:t}=Ot();return S(fe,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,s(wt,{title:"Copy token",arrow:!0,children:s(jt,{onClick:()=>{U9(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})},size:"large",children:s(A8,{})})})]})},DOe=({open:e,setOpen:t,token:n})=>S(nr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[s(re,{variant:"body1",children:"Your new token has been created successfully."}),S(re,{variant:"body1",children:['You can also find it as "',s("strong",{children:n==null?void 0:n.username}),'" in the'," ",s(Kt,{to:"/admin/api",children:"API access page"}),"."]}),s(R8,{token:(n==null?void 0:n.secret)||""})]}),MOe=x(fe)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),BOe=x(jt)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),FOe=x(ED,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),_8=({environment:e})=>S(MOe,{children:[s(BOe,{size:"large",disableRipple:!0,className:"drag-icon",children:s(Ace,{titleAccess:"Drag to reorder"})}),s(FOe,{deprecated:!e.enabled})]}),zOe=x(da)(({theme:e})=>({marginTop:e.spacing(3)})),jOe=x("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),P8=({environment:e,warnEnabledToggles:t})=>{const n=g.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>s(_8,{environment:c})},{Header:"Name",accessor:"name",Cell:zn},{Header:"Type",accessor:"type",Cell:zn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>S(zn,{children:[u,s(V,{condition:!!t,show:s(jOe,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l}=nn.useTable({columns:n,data:[e],disableSortBy:!0});return S(zOe,{...r(),rowHeight:"compact",children:[s(ua,{headerGroups:i}),s(la,{...o(),children:a.map(c=>(l(c),s(Fi,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>s(Ui,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},UOe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return S(nr,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s(V,{condition:o,show:s(Bt,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:s(Bt,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),s(P8,{environment:e})]})},WOe=x("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),HOe=x(ir)(()=>({width:"100%"})),VOe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=g.useState("");return g.useEffect(()=>{i("")},[t]),S(nr,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[S(Bt,{severity:"error",children:[s("strong",{children:"Danger! This action is not reversible. Please proceed with caution."})," ","Deleting this environment will result in removing all strategies that are active in this environment across all feature toggles."]}),s(P8,{environment:e,warnEnabledToggles:!0}),S(WOe,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",s("strong",{children:e.name})]}),s(HOe,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},GOe=({environment:e})=>{const t=pt(),{setToastApiError:n,setToastData:r}=Ot(),{environments:o,refetchEnvironments:i}=Bd(),{refetch:a}=KT(),{deleteEnvironment:l,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=Hd(),[d,p]=g.useState(!1),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(!1),[w,C]=g.useState();return S(Cl,{children:[s(fOe,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>h(!0),onClone:()=>{o.length<rv?y(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${rv}). Please reach out if you need more.`})},onDelete:()=>p(!0)}),s(VOe,{environment:e,open:d,setOpen:p,onConfirm:async()=>{try{await l(e.name),a(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(T){n(gt(T))}finally{p(!1),await i()}}}),s(UOe,{environment:e,open:f,setOpen:h,onConfirm:async()=>{try{e.enabled?(await u(e.name),r({type:"success",title:"Environment deprecated successfully"})):(await c(e.name),r({type:"success",title:"Environment undeprecated successfully"}))}catch(T){n(gt(T))}finally{h(!1),await i()}}}),s(IOe,{environment:e,open:m,setOpen:y,newToken:T=>{C(T),v(!0)}}),s(DOe,{open:b,setOpen:v,token:w})]})},qOe=x(fe)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),KOe=x("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),YOe=x("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),ul=({value:e,subtitle:t,afterTitle:n})=>{const{searchQuery:r}=Il();return S(qOe,{children:[S(KOe,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:[s(qa,{search:r,children:e}),n]}),s(V,{condition:!!t,show:()=>s(YOe,{"data-loading":!0,children:s(qa,{search:r,children:t})})})]})},XOe=x(Bt)(({theme:e})=>({marginBottom:e.spacing(4)})),JOe=()=>{const{changeSortOrder:e}=Hd(),{setToastApiError:t}=Ot(),{environments:n,mutateEnvironments:r}=Bd(),o=g.useCallback(async(b,v,w=!1)=>{const C=[...n],k=C[b];if(C.splice(b,1),C.splice(v,0,k),await r(C),w)try{await e(Dxe(C))}catch(A){t(gt(A))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=nn.useTable({columns:QOe,data:n,disableSortBy:!0},nn.useGlobalFilter),h=S(ce,{children:[s(Ro,{initialValue:d,onChange:p}),s(kn.Divider,{}),s(nOe,{})]});let m=c.length;const y=s(kn,{title:`Environments (${m})`,actions:h});return S(Jn,{header:y,children:[s(XOe,{severity:"info",children:"This is the order of environments that you have today in each feature toggle. Rearranging them here will change also the order inside each feature toggle."}),s(ts,{value:d,children:S(da,{...i(),rowHeight:"compact",children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(b=>(u(b),s(aOe,{row:b,moveListItem:o},b.original.name)))})]})}),s(V,{condition:c.length===0,show:s(V,{condition:(d==null?void 0:d.length)>0,show:S(Fr,{children:["No environments found matching “",d,"”"]}),elseShow:s(Fr,{children:"No environments available. Get started by adding one."})})})]})},QOe=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>s(_8,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>s(cOe,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:ul},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:zn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:zn},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>s(GOe,{environment:e}),disableGlobalFilter:!0}],ZOe=()=>{const e=Ya("projectId"),t=pt();return s(Io,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[V1,wT],projectId:e,"data-testid":Xae,children:"New segment"})},e4e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),t4e=x(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),n4e=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),r4e=x(Kt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),o4e=()=>{const{hasAccess:e}=g.useContext(Po);return S(e4e,{children:[s(t4e,{children:"No segments yet!"}),s(n4e,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),s(V,{condition:e(V1),show:s(r4e,{to:"/segments/create",children:"Create your first segment"})})]})},i4e=x(ir)(({theme:e})=>({marginTop:e.spacing(2)})),a4e=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=g.useState(""),a=u=>i(u.currentTarget.value),l=()=>{n(),i("")},c="delete-segment-confirmation-form";return S(nr,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:"Delete segment",secondaryButtonText:"Cancel",onClick:()=>{r(),i("")},disabledPrimaryButton:(e==null?void 0:e.name)!==o,onClose:l,formId:c,children:[S("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",s("strong",{children:e==null?void 0:e.name})]}),s("form",{id:c,children:s(i4e,{autoFocus:!0,onChange:a,value:o,label:"Segment name","data-testid":sse})})]})},s4e=x("ul")({marginBottom:0}),l4e=x(Kt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),c4e=({segment:e,open:t,onClose:n,strategies:r})=>S(nr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[S("p",{children:["The following feature toggles are using the"," ",s("strong",{children:e.name})," segment for their strategies:"]}),s(s4e,{children:r==null?void 0:r.map(o=>s("li",{children:S(l4e,{to:Rk(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",u4e(o)]})},o.id))})]}),u4e=e=>e.strategyName?`(${ks(e.strategyName)})`:"",d4e=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=w8(e.id),a=(o==null?void 0:o.length)===0;return i?null:s(V,{condition:a,show:s(a4e,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:s(c4e,{segment:e,open:t,onClose:n,strategies:o})})},p4e=({segment:e})=>{const t=Ya("projectId"),{refetchSegments:n}=Ll(),{deleteSegment:r}=Lk(),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(gt(u))}finally{l(!1)}};return S(ce,{children:[s(Kr,{onClick:()=>l(!0),permission:[Ufe,wT],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${ase}_${e.name}`,children:s(yo,{"data-loading":!0})}),s(V,{condition:a,show:()=>s(d4e,{segment:e,open:a,onClose:()=>l(!1),onRemove:c})})]})},f4e=({segment:e})=>{const t=Ya("projectId"),n=pt();return s(Kr,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[bT,wT],projectId:t,tooltipProps:{title:"Edit segment"},children:s(ji,{"data-loading":!0})})},h4e=({segment:e})=>S(Cl,{children:[s(f4e,{segment:e}),s(p4e,{segment:e})]}),g4e=()=>{const e=Ya("projectId"),{segments:t,loading:n}=Ll(),r=or(ca.breakpoints.down("md")),[o]=g.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=g.useMemo(()=>t?e?t.filter(({project:y})=>y===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),a=g.useMemo(()=>m4e(),[]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:f},setGlobalFilter:h,setHiddenColumns:m}=nn.useTable({initialState:o,columns:a,data:i,sortTypes:li,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:ul}},nn.useGlobalFilter,nn.useSortBy);return Md([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],m,a),s(Jn,{header:s(kn,{title:`Segments (${d.length})`,actions:S(ce,{children:[s(Ro,{initialValue:f,onChange:h}),s(kn.Divider,{}),s(ZOe,{})]})}),isLoading:n,children:s(V,{condition:!n&&i.length===0,show:s(Fr,{children:s(o4e,{})}),elseShow:()=>S(ce,{children:[s(ts,{value:f,children:S(da,{...l(),rowHeight:"standard",children:[s(ua,{headerGroups:u}),s(la,{...c(),children:d.map(y=>(p(y),s(Fi,{hover:!0,...y.getRowProps(),children:y.cells.map(b=>s(Ui,{...b.getCellProps(),children:b.render("Cell")}))})))})]})}),s(V,{condition:d.length===0&&(f==null?void 0:f.length)>0,show:S(Fr,{children:["No segments found matching “",f,"”"]})})]})})})},m4e=()=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s(h0,{icon:s(TD,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:e,description:t,id:n}}})=>s(Ka,{title:e,to:`/segments/edit/${n}`,subtitle:t})},{Header:"Used in",width:"60%",Cell:({row:{original:e}})=>s(d8,{original:e})},{Header:"Project",accessor:"project",Cell:({value:e})=>s(V,{condition:!!e,show:s(Ka,{title:e,to:`/projects/${e}`}),elseShow:s(zn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:wh,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>s(h4e,{segment:e})},{accessor:"description"}],y4e=e=>fetch(e).then(xn("Feature toggle archive")).then(t=>t.json()),I8=e=>{const{data:t,error:n,mutate:r,isLoading:o}=Pn(kt(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),y4e,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},v4e=({onRevive:e,onDelete:t,project:n})=>S(Cl,{children:[s(Kr,{onClick:e,projectId:n,permission:vT,tooltipProps:{title:"Revive feature toggle"},children:s(PD,{})}),s(Kr,{permission:l9,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:s(yo,{})})]}),b4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{reviveFeature:async a=>{const l=`api/admin/archive/revive/${a}`,c=t(l,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const l=`api/admin/archive/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},w4e=({value:e})=>{const{locationSettings:t}=ns(),n=on();return e?s(zn,{children:s(wt,{title:`Archived on: ${ld(e,t.locale)}`,arrow:!0,children:s(re,{noWrap:!0,variant:"body2","data-loading":!0,children:s(Tc,{date:new Date(e),title:"",live:!1})})})}):s(zn,{children:s(re,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},S4e=x("p")(({theme:e})=>({marginTop:e.spacing(3)})),x4e=x(ir)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),C4e="I want to delete",O8=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=g.useState(""),{setToastData:l,setToastApiError:c}=Ot(),{deleteFeatures:u}=pg(),d=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",title:"Feature toggles deleted",text:`You have successfully deleted following features toggles: ${e.join(", ")}.`})}catch(h){c(gt(h))}finally{p()}},p=()=>{r(!1),a("")},f="delete-feature-toggle-confirmation-form";return S(nr,{title:"Delete feature toggles?",open:n,primaryButtonText:"Delete feature toggles",secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:C4e!==i,formId:f,children:[S(Bt,{severity:"warning",children:[s("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),S(S4e,{children:["In order to delete feature toggles, please enter the following confirmation text in the text field below:"," ",s("strong",{children:"I want to delete"})]}),s("form",{id:f,children:s(x4e,{autoFocus:!0,onChange:h=>{a(h.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},E4e=x(fe)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2)})),T4e=({onChange:e,checked:t,title:n})=>s(E4e,{"data-testid":kse,children:s(es,{onChange:e,title:n,checked:t})}),k4e=x("div")(({theme:e})=>({position:"sticky",marginTop:"auto",bottom:0,zIndex:e.zIndex.mobileStepper,pointerEvents:"none"})),A4e=x(fe)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),R4e=x(Cr)(({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"})),_4e=x("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),P4e=x(re)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),I4e=({count:e,children:t})=>e===0?null:s(k4e,{"data-testid":Ese,children:s(A4e,{children:S(R4e,{elevation:4,children:[S(P4e,{children:[s(_4e,{"data-testid":Tse,children:e})," selected"]}),t]})})}),O4e=({selectedIds:e,projectId:t,onReviveConfirm:n})=>{const{reviveFeatures:r}=pg(),{setToastData:o,setToastApiError:i}=Ot(),{refetchArchived:a}=I8(t),[l,c]=g.useState(!1),{trackEvent:u}=jn(),d=async()=>{try{await r(t,e),n==null||n(),await a(),o({type:"success",title:"And we're back!",text:"The feature toggles have been revived."}),u("batch_operations",{props:{eventType:"features revived"}})}catch(f){i(gt(f))}},p=async()=>{c(!0)};return S(ce,{children:[s(Eu,{projectId:t,permission:vT,children:({hasAccess:f})=>s(Ve,{disabled:!f,startIcon:s(PD,{}),variant:"outlined",size:"small",onClick:d,children:"Revive"})}),s(Eu,{projectId:t,permission:l9,children:({hasAccess:f})=>s(Ve,{disabled:!f,startIcon:s(yo,{}),variant:"outlined",size:"small",onClick:p,children:"Delete"})}),s(O8,{deletedFeatures:e,projectId:t,open:l,setOpen:c,refetch:()=>{a(),u("batch_operations",{props:{eventType:"features deleted"}})}})]})},$4e=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const l=or(ca.breakpoints.down("md")),c=or(ca.breakpoints.down("lg")),{setToastData:u,setToastApiError:d}=Ot(),[p,f]=g.useState(!1),[h,m]=g.useState(),[y,b]=Uh(),{reviveFeature:v}=b4e(),[w,C]=g.useState(y.get("search")||""),{uiConfig:k}=St(),A=!!k.flags.lastSeenByEnvironment,T=g.useCallback(async R=>{try{await v(R),await n(),u({type:"success",title:"And we're back!",text:"The feature toggle has been revived."})}catch(N){d(gt(N))}},[n,v,d,u]),_=g.useMemo(()=>[...a?[{id:"Select",Header:({getToggleAllRowsSelectedProps:R})=>s(es,{...R()}),Cell:({row:R})=>{var N;return s(T4e,{...(N=R==null?void 0:R.getToggleRowSelectedProps)==null?void 0:N.call(R)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",accessor:"lastSeenAt",Cell:({value:R,row:{original:N}})=>A?s(R9,{feature:N}):s(ZD,{value:R}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:o9,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:R,row:{original:N}})=>s(ul,{value:R,subtitle:N.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:wh,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:w4e,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:R})=>s(Ka,{title:R,to:`/projects/${R}`})}],{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:R}})=>s(v4e,{project:R.project,onRevive:()=>T(R.name),onDelete:()=>{m(R),f(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a,A]),{data:P,getSearchText:I,getSearchContext:O}=lg(_,w,e),$=g.useMemo(()=>t?_9:P,[P,t]),[F]=g.useState(()=>({sortBy:[{id:y.get("sort")||r.id,desc:y.has("order")?y.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),D=g.useCallback(R=>R.name,[]),{headerGroups:B,rows:q,state:{sortBy:Y,selectedRowIds:te},prepareRow:H,setHiddenColumns:j,toggleAllRowsSelected:U}=nn.useTable({columns:_,data:$,initialState:F,sortTypes:li,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:D},nn.useFlexLayout,nn.useSortBy,nn.useRowSelect);return Md([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],j,_),g.useEffect(()=>{if(t)return;const R={};R.sort=Y[0].id,Y[0].desc&&(R.order="desc"),w&&(R.search=w),b(R,{replace:!0}),o({id:Y[0].id,desc:Y[0].desc||!1})},[t,Y,w]),S(ce,{children:[S(Jn,{isLoading:t,header:s(kn,{titleElement:`${i} (${q.length<$.length?`${q.length} of ${$.length}`:$.length})`,actions:s(Ro,{initialValue:w,onChange:C,hasFilters:!0,getSearchContext:O})}),children:[s(ts,{value:I(w),children:s(z1,{rows:q,headerGroups:B,prepareRow:H})}),s(V,{condition:q.length===0,show:()=>s(V,{condition:(w==null?void 0:w.length)>0,show:S(Fr,{children:["No feature toggles found matching “",w,"”"]}),elseShow:s(Fr,{children:"None of the feature toggles were archived yet."})})}),s(O8,{deletedFeatures:[h==null?void 0:h.name],projectId:a??(h==null?void 0:h.project),open:p,setOpen:f,refetch:n})]}),s(V,{condition:!!a,show:s(I4e,{count:Object.keys(te).length,children:s(O4e,{selectedIds:Object.keys(te),projectId:a,onReviveConfirm:()=>U(!1)})})})]})},N4e={id:"createdAt"},{value:L4e,setValue:D4e}=Ol("FeaturesArchiveTable:v1",N4e),M4e=()=>{i9("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=I8();return s($4e,{title:"Archive",archivedFeatures:e,loading:t,storedParams:L4e,setStoredParams:D4e,refetch:n})},B4e=g.lazy(()=>Yd(()=>import("./AdvancedPlayground-20059178.js"),[])),F4e=x(Ve)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.background.alternative:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`},justifyContent:"space-between","& > span":{borderTopLeftRadius:0,borderBottomLeftRadius:0}})),z4e=({label:e,selected:t,onClick:n,icon:r})=>S(F4e,{selected:!!t,onClick:n,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[e,r]}),j4e=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),U4e=x("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),W4e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),H4e=({tabs:e,value:t,onChange:n,children:r})=>S(j4e,{children:[s(W4e,{children:e.filter(o=>!o.hidden).map(o=>s(z4e,{label:o.label,selected:o.id===t,onClick:()=>n(o),icon:o.icon},o.id))}),s(U4e,{children:r})]}),$8=(e,t={})=>{const n=async()=>{const u=kt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(xn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=WB({},r,n,t),[a,l]=g.useState(!i&&!o),c=()=>{Jr(r)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},V4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});try{await e(a.caller,a.id)}catch(l){throw l}},errors:n,loading:r}},G4e=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),q4e=()=>{const{config:e,loading:t}=$8("simple"),[n,r]=g.useState(!1),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),[c,u]=g.useState(),[d,p]=g.useState(),[f,h]=g.useState(""),[m,y]=g.useState(""),[b,v]=g.useState(""),{changePassword:w}=V4e(),C=async k=>{if(k.preventDefault(),f===m){if(!a)u(LM);else{r(!0),u(void 0),p(void 0);try{await w({password:f,confirmPassword:m,oldPassword:b}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(A){const T=gt(A);A instanceof iT?p(T):u(T),i(T)}}r(!1)}};return t?null:s(Jn,{isLoading:n,header:"Change password",children:s(V,{condition:e.disabled,show:s(Bt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:S(G4e,{children:[s(DM,{password:f,callback:l,"data-loading":!0}),s(fc,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:k=>v(k.target.value)}),s(fc,{"data-loading":!0,label:"Password",name:"password",value:f,error:!!c,helperText:c,autoComplete:"new-password",onChange:k=>h(k.target.value)}),s(fc,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:m,autoComplete:"new-password",onChange:k=>y(k.target.value)}),s(BM,{"data-loading":!0,started:!!(f&&m),matchingPasswords:f===m}),s(Ve,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:C,children:"Save"})]})})})},K4e="environment",Y4e="project",N8="root",L8="project",X4e="root-custom",J4e="custom",Q4e=[N8,L8],ije=[N8,X4e],Z4e=[L8,J4e],e$e=10,zk=()=>{const{data:e,error:t,mutate:n}=Pn(kt("api/admin/user/tokens"),t$e);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},t$e=e=>fetch(e).then(xn("Personal API Tokens")).then(t=>t.json()),D8=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{createPersonalAPIToken:async a=>{const l=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(a)});try{return await(await e(l.caller,l.id)).json()}catch(c){throw c}},deletePersonalAPIToken:async a=>{const l=t(`api/admin/user/tokens/${a}`,{method:"DELETE"});try{await e(l.caller,l.id)}catch(c){throw c}},errors:n,loading:r}},n$e=e=>{const t=new Date(e);return bh(t,"yyyy-MM-dd")},r$e=e=>{const t=new Date(e);return bh(t,"yyyy-MM-dd")+"T"+bh(t,"HH:mm")},o$e=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?r$e:n$e;return s(fn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=GM(p.target.value);l(f??a)},FormHelperTextProps:{"data-testid":WL},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},mO=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),i$e=x(ir)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),a$e=x("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),s$e=x(fg)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),l$e=x(o$e)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),c$e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var M8=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(M8||{});const B8=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],bC=e=>{const t=new Date,n=B8.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},u$e=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=ns(),d=y=>{c(b=>({...b,[y]:void 0}))},p=(y,b)=>{c(v=>({...v,[y]:b}))};g.useEffect(()=>{d("expiresAt"),a(bC(r))},[r]);const f=y=>{d("description"),n&&!n(y)&&p("description","A token with that description already exists."),t(y)},h=r==="custom",m=i.getFullYear()>new Date().getFullYear()+100;return S(ce,{children:[s(mO,{children:"Describe what this token will be used for"}),s(i$e,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:y=>f(y.target.value),required:!0}),s(mO,{children:"Token expiration date"}),S(a$e,{custom:h,children:[s(s$e,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:y=>o(y.target.value),options:B8}),s(V,{condition:h,show:()=>s(l$e,{label:"Date",value:i,onChange:y=>{d("expiresAt"),y<new Date&&p("expiresAt","Invalid date, must be in the future"),a(y)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:s(V,{condition:m,show:S(re,{variant:"body2",children:["The token will ",s("strong",{children:"never"})," ","expire!"]}),elseShow:()=>S(re,{variant:"body2",children:["Token will expire on"," ",s("strong",{children:ld(i,u.locale)})]})})})]}),s(V,{condition:m,show:s(c$e,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},d$e=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),p$e=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),f$e=x(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),Nm=M8["30DAYS"],h$e=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=zk(),{createPersonalAPIToken:i,loading:a}=D8(),{setToastApiError:l}=Ot(),{uiConfig:c}=St(),[u,d]=g.useState(""),[p,f]=g.useState(Nm),[h,m]=g.useState(bC(Nm)),[y,b]=g.useState({});g.useEffect(()=>{d(""),f(Nm),m(bC(Nm)),b({})},[e]);const v=()=>({description:u,expiresAt:h}),w=async _=>{_.preventDefault();try{const P=await i(v());n(P),o(),t(!1)}catch(P){l(gt(P))}},C=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
381
+ --data-raw '${JSON.stringify(B(),void 0,2)}'`,H=X=>X.length,j=X=>!(o!=null&&o.some(se=>se.name===X)),U=H(h)&&j(h)&&C.length,R=X=>{$("name"),j(X)||F("name","An environment with that name already exists."),m(X)},N=u.map(X=>({value:X.id,label:X.name}));return s(wg,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:s(Er,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature toggles and their configuration (activation strategies, segments, status, etc) into a new environment.",documentationLink:"https://docs.getunleash.io/reference/environments#cloning-environments",documentationLinkLabel:"Cloning environments documentation",formatApiCode:te,children:S(TOe,{onSubmit:Y,children:[S("div",{children:[s(cu,{children:"What is your new environment name? (Can't be changed later)"}),s(kOe,{autoFocus:!0,label:"Environment name",error:!!I.name,errorText:I.name,value:h,onChange:X=>R(X.target.value),required:!0}),s(cu,{children:"What type of environment do you want to create?"}),s(VM,{onChange:X=>b(X.currentTarget.value),value:y}),S(cu,{children:["Select which projects you want to clone the environment configuration in?",s(Wi,{tooltip:"The cloned environment will keep the feature toggle state for the selected projects, where it will be enabled by default."})]}),s(wOe,{projects:v,setProjects:w}),s(cu,{children:"Keep the users permission for this environment?"}),s(eS,{children:"If you turn it off, the permission for this environment across all projects and feature toggles will remain only for admin and editor roles."}),s(Gr,{label:A?"Yes":"No",control:s(pa,{onChange:X=>T(X.target.checked),checked:A})}),S(AOe,{children:[s(cu,{children:"API Token"}),S(eS,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",s(Nr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),s(Os,{children:S(RE,{value:_,onChange:X=>P(X.target.value),name:"api-token-generation",children:[s(Gr,{value:"later",control:s(cc,{}),label:"I want to generate an API token later"}),s(Gr,{value:"now",control:s(cc,{}),label:"Generate an API token now"})]})}),S(ROe,{children:[s(eS,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),s(V,{condition:_==="now",show:S(ce,{children:[s(cu,{children:"Which projects do you want this token to give access to?"}),s(COe,{options:N,defaultValue:C,onChange:k,error:I.projects,onFocus:()=>$("projects")})]})})]})]})]}),S(_Oe,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!U,children:"Clone environment"}),s(POe,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})};var Fk={},OOe=hn;Object.defineProperty(Fk,"__esModule",{value:!0});var A8=Fk.default=void 0,$Oe=OOe(gn()),NOe=mn,LOe=(0,$Oe.default)((0,NOe.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"}),"FileCopy");A8=Fk.default=LOe;const R8=({token:e})=>{const{setToastData:t}=Ot();return S(fe,{sx:r=>({backgroundColor:r.palette.background.elevation2,padding:r.spacing(4),borderRadius:`${r.shape.borderRadius}px`,marginTop:r.spacing(2),display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"}),children:[e,s(wt,{title:"Copy token",arrow:!0,children:s(jt,{onClick:()=>{U9(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})},size:"large",children:s(A8,{})})})]})},DOe=({open:e,setOpen:t,token:n})=>S(nr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[s(re,{variant:"body1",children:"Your new token has been created successfully."}),S(re,{variant:"body1",children:['You can also find it as "',s("strong",{children:n==null?void 0:n.username}),'" in the'," ",s(Kt,{to:"/admin/api",children:"API access page"}),"."]}),s(R8,{token:(n==null?void 0:n.secret)||""})]}),MOe=x(fe)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),BOe=x(jt)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),FOe=x(ED,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),_8=({environment:e})=>S(MOe,{children:[s(BOe,{size:"large",disableRipple:!0,className:"drag-icon",children:s(Ace,{titleAccess:"Drag to reorder"})}),s(FOe,{deprecated:!e.enabled})]}),zOe=x(da)(({theme:e})=>({marginTop:e.spacing(3)})),jOe=x("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),P8=({environment:e,warnEnabledToggles:t})=>{const n=g.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>s(_8,{environment:c})},{Header:"Name",accessor:"name",Cell:zn},{Header:"Type",accessor:"type",Cell:zn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>S(zn,{children:[u,s(V,{condition:!!t,show:s(jOe,{warning:!!(c.enabledToggleCount&&c.enabledToggleCount>0),children:c.enabledToggleCount===1?"1 toggle enabled":`${c.enabledToggleCount} toggles enabled`})})]})}],[t]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:a,prepareRow:l}=nn.useTable({columns:n,data:[e],disableSortBy:!0});return S(zOe,{...r(),rowHeight:"compact",children:[s(ua,{headerGroups:i}),s(la,{...o(),children:a.map(c=>(l(c),s(Fi,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>s(Ui,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},UOe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return S(nr,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[s(V,{condition:o,show:s(Bt,{severity:"info",children:"Deprecating an environment will mark it as deprecated. Deprecated environments are set as not visible by default for new projects. Project owners are still able to override this setting in the project. This environment will still be visible in any current projects."}),elseShow:s(Bt,{severity:"info",children:"Undeprecating an environment will no longer mark it as deprecated. An undeprecated environment will be set as visible by default for new projects."})}),s(P8,{environment:e})]})},WOe=x("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),HOe=x(ir)(()=>({width:"100%"})),VOe=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=g.useState("");return g.useEffect(()=>{i("")},[t]),S(nr,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[S(Bt,{severity:"error",children:[s("strong",{children:"Danger! This action is not reversible. Please proceed with caution."})," ","Deleting this environment will result in removing all strategies that are active in this environment across all feature toggles."]}),s(P8,{environment:e,warnEnabledToggles:!0}),S(WOe,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",s("strong",{children:e.name})]}),s(HOe,{label:"Environment name",value:o,onChange:a=>i(a.target.value)})]})},GOe=({environment:e})=>{const t=pt(),{setToastApiError:n,setToastData:r}=Ot(),{environments:o,refetchEnvironments:i}=Bd(),{refetch:a}=KT(),{deleteEnvironment:l,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=Hd(),[d,p]=g.useState(!1),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(!1),[w,C]=g.useState();return S(Cl,{children:[s(fOe,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>h(!0),onClone:()=>{o.length<rv?y(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${rv}). Please reach out if you need more.`})},onDelete:()=>p(!0)}),s(VOe,{environment:e,open:d,setOpen:p,onConfirm:async()=>{try{await l(e.name),a(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(T){n(gt(T))}finally{p(!1),await i()}}}),s(UOe,{environment:e,open:f,setOpen:h,onConfirm:async()=>{try{e.enabled?(await u(e.name),r({type:"success",title:"Environment deprecated successfully"})):(await c(e.name),r({type:"success",title:"Environment undeprecated successfully"}))}catch(T){n(gt(T))}finally{h(!1),await i()}}}),s(IOe,{environment:e,open:m,setOpen:y,newToken:T=>{C(T),v(!0)}}),s(DOe,{open:b,setOpen:v,token:w})]})},qOe=x(fe)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),KOe=x("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),YOe=x("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),ul=({value:e,subtitle:t,afterTitle:n})=>{const{searchQuery:r}=Il();return S(qOe,{children:[S(KOe,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:[s(qa,{search:r,children:e}),n]}),s(V,{condition:!!t,show:()=>s(YOe,{"data-loading":!0,children:s(qa,{search:r,children:t})})})]})},XOe=x(Bt)(({theme:e})=>({marginBottom:e.spacing(4)})),JOe=()=>{const{changeSortOrder:e}=Hd(),{setToastApiError:t}=Ot(),{environments:n,mutateEnvironments:r}=Bd(),o=g.useCallback(async(b,v,w=!1)=>{const C=[...n],k=C[b];if(C.splice(b,1),C.splice(v,0,k),await r(C),w)try{await e(Dxe(C))}catch(A){t(gt(A))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=nn.useTable({columns:QOe,data:n,disableSortBy:!0},nn.useGlobalFilter),h=S(ce,{children:[s(Ro,{initialValue:d,onChange:p}),s(kn.Divider,{}),s(nOe,{})]});let m=c.length;const y=s(kn,{title:`Environments (${m})`,actions:h});return S(Jn,{header:y,children:[s(XOe,{severity:"info",children:"This is the order of environments that you have today in each feature toggle. Rearranging them here will change also the order inside each feature toggle."}),s(ts,{value:d,children:S(da,{...i(),rowHeight:"compact",children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(b=>(u(b),s(aOe,{row:b,moveListItem:o},b.original.name)))})]})}),s(V,{condition:c.length===0,show:s(V,{condition:(d==null?void 0:d.length)>0,show:S(Fr,{children:["No environments found matching “",d,"”"]}),elseShow:s(Fr,{children:"No environments available. Get started by adding one."})})})]})},QOe=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>s(_8,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>s(cOe,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:ul},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:zn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:zn},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>s(GOe,{environment:e}),disableGlobalFilter:!0}],ZOe=()=>{const e=Ya("projectId"),t=pt();return s(Io,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[V1,wT],projectId:e,"data-testid":Xae,children:"New segment"})},e4e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),t4e=x(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),n4e=x("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),r4e=x(Kt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),o4e=()=>{const{hasAccess:e}=g.useContext(Po);return S(e4e,{children:[s(t4e,{children:"No segments yet!"}),s(n4e,{children:"Segment makes it easy for you to define who should be exposed to your feature. The segment is often a collection of constraints and can be reused."}),s(V,{condition:e(V1),show:s(r4e,{to:"/segments/create",children:"Create your first segment"})})]})},i4e=x(ir)(({theme:e})=>({marginTop:e.spacing(2)})),a4e=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=g.useState(""),a=u=>i(u.currentTarget.value),l=()=>{n(),i("")},c="delete-segment-confirmation-form";return S(nr,{title:"Are you sure you want to delete this segment?",open:t,primaryButtonText:"Delete segment",secondaryButtonText:"Cancel",onClick:()=>{r(),i("")},disabledPrimaryButton:(e==null?void 0:e.name)!==o,onClose:l,formId:c,children:[S("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",s("strong",{children:e==null?void 0:e.name})]}),s("form",{id:c,children:s(i4e,{autoFocus:!0,onChange:a,value:o,label:"Segment name","data-testid":sse})})]})},s4e=x("ul")({marginBottom:0}),l4e=x(Kt)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),c4e=({segment:e,open:t,onClose:n,strategies:r})=>S(nr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[S("p",{children:["The following feature toggles are using the"," ",s("strong",{children:e.name})," segment for their strategies:"]}),s(s4e,{children:r==null?void 0:r.map(o=>s("li",{children:S(l4e,{to:Rk(o.projectId,o.featureName,o.environment,o.id),target:"_blank",rel:"noopener noreferrer",children:[o.featureName," ",u4e(o)]})},o.id))})]}),u4e=e=>e.strategyName?`(${ks(e.strategyName)})`:"",d4e=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,loading:i}=w8(e.id),a=(o==null?void 0:o.length)===0;return i?null:s(V,{condition:a,show:s(a4e,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:s(c4e,{segment:e,open:t,onClose:n,strategies:o})})},p4e=({segment:e})=>{const t=Ya("projectId"),{refetchSegments:n}=Ll(),{deleteSegment:r}=Lk(),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(gt(u))}finally{l(!1)}};return S(ce,{children:[s(Kr,{onClick:()=>l(!0),permission:[Ufe,wT],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${ase}_${e.name}`,children:s(yo,{"data-loading":!0})}),s(V,{condition:a,show:()=>s(d4e,{segment:e,open:a,onClose:()=>l(!1),onRemove:c})})]})},f4e=({segment:e})=>{const t=Ya("projectId"),n=pt();return s(Kr,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[bT,wT],projectId:t,tooltipProps:{title:"Edit segment"},children:s(ji,{"data-loading":!0})})},h4e=({segment:e})=>S(Cl,{children:[s(f4e,{segment:e}),s(p4e,{segment:e})]}),g4e=()=>{const e=Ya("projectId"),{segments:t,loading:n}=Ll(),r=or(ca.breakpoints.down("md")),[o]=g.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=g.useMemo(()=>t?e?t.filter(({project:y})=>y===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),a=g.useMemo(()=>m4e(),[]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:p,state:{globalFilter:f},setGlobalFilter:h,setHiddenColumns:m}=nn.useTable({initialState:o,columns:a,data:i,sortTypes:li,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:ul}},nn.useGlobalFilter,nn.useSortBy);return Md([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],m,a),s(Jn,{header:s(kn,{title:`Segments (${d.length})`,actions:S(ce,{children:[s(Ro,{initialValue:f,onChange:h}),s(kn.Divider,{}),s(ZOe,{})]})}),isLoading:n,children:s(V,{condition:!n&&i.length===0,show:s(Fr,{children:s(o4e,{})}),elseShow:()=>S(ce,{children:[s(ts,{value:f,children:S(da,{...l(),rowHeight:"standard",children:[s(ua,{headerGroups:u}),s(la,{...c(),children:d.map(y=>(p(y),s(Fi,{hover:!0,...y.getRowProps(),children:y.cells.map(b=>s(Ui,{...b.getCellProps(),children:b.render("Cell")}))})))})]})}),s(V,{condition:d.length===0&&(f==null?void 0:f.length)>0,show:S(Fr,{children:["No segments found matching “",f,"”"]})})]})})})},m4e=()=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>s(h0,{icon:s(TD,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:e,description:t,id:n}}})=>s(Ka,{title:e,to:`/segments/edit/${n}`,subtitle:t})},{Header:"Used in",width:"60%",Cell:({row:{original:e}})=>s(d8,{original:e})},{Header:"Project",accessor:"project",Cell:({value:e})=>s(V,{condition:!!e,show:s(Ka,{title:e,to:`/projects/${e}`}),elseShow:s(zn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:wh,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:e}})=>s(h4e,{segment:e})},{accessor:"description"}],y4e=e=>fetch(e).then(xn("Feature toggle archive")).then(t=>t.json()),I8=e=>{const{data:t,error:n,mutate:r,isLoading:o}=Pn(kt(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),y4e,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},v4e=({onRevive:e,onDelete:t,project:n})=>S(Cl,{children:[s(Kr,{onClick:e,projectId:n,permission:vT,tooltipProps:{title:"Revive feature toggle"},children:s(PD,{})}),s(Kr,{permission:l9,projectId:n,tooltipProps:{title:"Delete feature toggle"},onClick:t,children:s(yo,{})})]}),b4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{reviveFeature:async a=>{const l=`api/admin/archive/revive/${a}`,c=t(l,{method:"POST"});return e(c.caller,c.id)},deleteFeature:async a=>{const l=`api/admin/archive/${a}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},errors:n,loading:r}},w4e=({value:e})=>{const{locationSettings:t}=ns(),n=on();return e?s(zn,{children:s(wt,{title:`Archived on: ${ld(e,t.locale)}`,arrow:!0,children:s(re,{noWrap:!0,variant:"body2","data-loading":!0,children:s(Tc,{date:new Date(e),title:"",live:!1})})})}):s(zn,{children:s(re,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},S4e=x("p")(({theme:e})=>({marginTop:e.spacing(3)})),x4e=x(ir)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),C4e="I want to delete",O8=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,a]=g.useState(""),{setToastData:l,setToastApiError:c}=Ot(),{deleteFeatures:u}=pg(),d=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",title:"Feature toggles deleted",text:`You have successfully deleted following features toggles: ${e.join(", ")}.`})}catch(h){c(gt(h))}finally{p()}},p=()=>{r(!1),a("")},f="delete-feature-toggle-confirmation-form";return S(nr,{title:"Delete feature toggles?",open:n,primaryButtonText:"Delete feature toggles",secondaryButtonText:"Cancel",onClick:d,onClose:p,disabledPrimaryButton:C4e!==i,formId:f,children:[S(Bt,{severity:"warning",children:[s("b",{children:"Warning!"})," Before you delete a feature toggle, make sure all in-code references to that feature toggle have been removed. Otherwise, a new feature toggle with the same name could activate the old code paths."]}),S(S4e,{children:["In order to delete feature toggles, please enter the following confirmation text in the text field below:"," ",s("strong",{children:"I want to delete"})]}),s("form",{id:f,children:s(x4e,{autoFocus:!0,onChange:h=>{a(h.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},E4e=x(fe)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2)})),T4e=({onChange:e,checked:t,title:n})=>s(E4e,{"data-testid":kse,children:s(es,{onChange:e,title:n,checked:t})}),k4e=x("div")(({theme:e})=>({position:"sticky",marginTop:"auto",bottom:0,zIndex:e.zIndex.mobileStepper,pointerEvents:"none"})),A4e=x(fe)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),R4e=x(Cr)(({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"})),_4e=x("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),P4e=x(re)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),I4e=({count:e,children:t})=>e===0?null:s(k4e,{"data-testid":Ese,children:s(A4e,{children:S(R4e,{elevation:4,children:[S(P4e,{children:[s(_4e,{"data-testid":Tse,children:e})," selected"]}),t]})})}),O4e=({selectedIds:e,projectId:t,onReviveConfirm:n})=>{const{reviveFeatures:r}=pg(),{setToastData:o,setToastApiError:i}=Ot(),{refetchArchived:a}=I8(t),[l,c]=g.useState(!1),{trackEvent:u}=jn(),d=async()=>{try{await r(t,e),n==null||n(),await a(),o({type:"success",title:"And we're back!",text:"The feature toggles have been revived."}),u("batch_operations",{props:{eventType:"features revived"}})}catch(f){i(gt(f))}},p=async()=>{c(!0)};return S(ce,{children:[s(Eu,{projectId:t,permission:vT,children:({hasAccess:f})=>s(Ve,{disabled:!f,startIcon:s(PD,{}),variant:"outlined",size:"small",onClick:d,children:"Revive"})}),s(Eu,{projectId:t,permission:l9,children:({hasAccess:f})=>s(Ve,{disabled:!f,startIcon:s(yo,{}),variant:"outlined",size:"small",onClick:p,children:"Delete"})}),s(O8,{deletedFeatures:e,projectId:t,open:l,setOpen:c,refetch:()=>{a(),u("batch_operations",{props:{eventType:"features deleted"}})}})]})},$4e=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:a})=>{const l=or(ca.breakpoints.down("md")),c=or(ca.breakpoints.down("lg")),{setToastData:u,setToastApiError:d}=Ot(),[p,f]=g.useState(!1),[h,m]=g.useState(),[y,b]=Uh(),{reviveFeature:v}=b4e(),[w,C]=g.useState(y.get("search")||""),{uiConfig:k}=St(),A=!!k.flags.lastSeenByEnvironment,T=g.useCallback(async R=>{try{await v(R),await n(),u({type:"success",title:"And we're back!",text:"The feature toggle has been revived."})}catch(N){d(gt(N))}},[n,v,d,u]),_=g.useMemo(()=>[...a?[{id:"Select",Header:({getToggleAllRowsSelectedProps:R})=>s(es,{...R()}),Cell:({row:R})=>{var N;return s(T4e,{...(N=R==null?void 0:R.getToggleRowSelectedProps)==null?void 0:N.call(R)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",accessor:"lastSeenAt",Cell:({value:R,row:{original:N}})=>A?s(R9,{feature:N}):s(ZD,{value:R}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:o9,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:R,row:{original:N}})=>s(ul,{value:R,subtitle:N.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:wh,sortType:"date"},{Header:"Archived",accessor:"archivedAt",width:150,Cell:w4e,sortType:"date"},...a?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:R})=>s(Ka,{title:R,to:`/projects/${R}`})}],{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:R}})=>s(v4e,{project:R.project,onRevive:()=>T(R.name),onDelete:()=>{m(R),f(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[a,A]),{data:P,getSearchText:I,getSearchContext:O}=lg(_,w,e),$=g.useMemo(()=>t?_9:P,[P,t]),[F]=g.useState(()=>({sortBy:[{id:y.get("sort")||r.id,desc:y.has("order")?y.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),D=g.useCallback(R=>R.name,[]),{headerGroups:B,rows:q,state:{sortBy:Y,selectedRowIds:te},prepareRow:H,setHiddenColumns:j,toggleAllRowsSelected:U}=nn.useTable({columns:_,data:$,initialState:F,sortTypes:li,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:D},nn.useFlexLayout,nn.useSortBy,nn.useRowSelect);return Md([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],j,_),g.useEffect(()=>{if(t)return;const R={};R.sort=Y[0].id,Y[0].desc&&(R.order="desc"),w&&(R.search=w),b(R,{replace:!0}),o({id:Y[0].id,desc:Y[0].desc||!1})},[t,Y,w]),S(ce,{children:[S(Jn,{isLoading:t,header:s(kn,{titleElement:`${i} (${q.length<$.length?`${q.length} of ${$.length}`:$.length})`,actions:s(Ro,{initialValue:w,onChange:C,hasFilters:!0,getSearchContext:O})}),children:[s(ts,{value:I(w),children:s(z1,{rows:q,headerGroups:B,prepareRow:H})}),s(V,{condition:q.length===0,show:()=>s(V,{condition:(w==null?void 0:w.length)>0,show:S(Fr,{children:["No feature toggles found matching “",w,"”"]}),elseShow:s(Fr,{children:"None of the feature toggles were archived yet."})})}),s(O8,{deletedFeatures:[h==null?void 0:h.name],projectId:a??(h==null?void 0:h.project),open:p,setOpen:f,refetch:n})]}),s(V,{condition:!!a,show:s(I4e,{count:Object.keys(te).length,children:s(O4e,{selectedIds:Object.keys(te),projectId:a,onReviveConfirm:()=>U(!1)})})})]})},N4e={id:"createdAt"},{value:L4e,setValue:D4e}=Ol("FeaturesArchiveTable:v1",N4e),M4e=()=>{i9("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=I8();return s($4e,{title:"Archive",archivedFeatures:e,loading:t,storedParams:L4e,setStoredParams:D4e,refetch:n})},B4e=g.lazy(()=>Yd(()=>import("./AdvancedPlayground-aa02fee7.js"),[])),F4e=x(Ve)(({theme:e,selected:t})=>({"&.MuiButton-root":{cursor:"pointer",height:e.spacing(6.5),border:0,backgroundColor:t?e.palette.background.paper:"transparent",borderLeft:`${e.spacing(1)} solid ${t?e.palette.background.alternative:"transparent"}`,borderRadius:e.shape.borderRadiusMedium,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",padding:e.spacing(2,4),fontSize:e.fontSizes.bodySize,fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,lineHeight:1.2},"&:hover":{backgroundColor:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`},justifyContent:"space-between","& > span":{borderTopLeftRadius:0,borderBottomLeftRadius:0}})),z4e=({label:e,selected:t,onClick:n,icon:r})=>S(F4e,{selected:!!t,onClick:n,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[e,r]}),j4e=x("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),U4e=x("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),W4e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),H4e=({tabs:e,value:t,onChange:n,children:r})=>S(j4e,{children:[s(W4e,{children:e.filter(o=>!o.hidden).map(o=>s(z4e,{label:o.label,selected:o.id===t,onClick:()=>n(o),icon:o.icon},o.id))}),s(U4e,{children:r})]}),$8=(e,t={})=>{const n=async()=>{const u=kt(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(xn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=WB({},r,n,t),[a,l]=g.useState(!i&&!o),c=()=>{Jr(r)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:a,refetch:c}},V4e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{changePassword:async i=>{const a=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});try{await e(a.caller,a.id)}catch(l){throw l}},errors:n,loading:r}},G4e=x("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),q4e=()=>{const{config:e,loading:t}=$8("simple"),[n,r]=g.useState(!1),{setToastData:o,setToastApiError:i}=Ot(),[a,l]=g.useState(!1),[c,u]=g.useState(),[d,p]=g.useState(),[f,h]=g.useState(""),[m,y]=g.useState(""),[b,v]=g.useState(""),{changePassword:w}=V4e(),C=async k=>{if(k.preventDefault(),f===m){if(!a)u(LM);else{r(!0),u(void 0),p(void 0);try{await w({password:f,confirmPassword:m,oldPassword:b}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(A){const T=gt(A);A instanceof iT?p(T):u(T),i(T)}}r(!1)}};return t?null:s(Jn,{isLoading:n,header:"Change password",children:s(V,{condition:e.disabled,show:s(Bt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:S(G4e,{children:[s(DM,{password:f,callback:l,"data-loading":!0}),s(fc,{"data-loading":!0,label:"Old password",name:"oldPassword",value:b,error:!!d,helperText:d,autoComplete:"current-password",onChange:k=>v(k.target.value)}),s(fc,{"data-loading":!0,label:"Password",name:"password",value:f,error:!!c,helperText:c,autoComplete:"new-password",onChange:k=>h(k.target.value)}),s(fc,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:m,autoComplete:"new-password",onChange:k=>y(k.target.value)}),s(BM,{"data-loading":!0,started:!!(f&&m),matchingPasswords:f===m}),s(Ve,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:C,children:"Save"})]})})})},K4e="environment",Y4e="project",N8="root",L8="project",X4e="root-custom",J4e="custom",Q4e=[N8,L8],ije=[N8,X4e],Z4e=[L8,J4e],e$e=10,zk=()=>{const{data:e,error:t,mutate:n}=Pn(kt("api/admin/user/tokens"),t$e);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},t$e=e=>fetch(e).then(xn("Personal API Tokens")).then(t=>t.json()),D8=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{createPersonalAPIToken:async a=>{const l=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(a)});try{return await(await e(l.caller,l.id)).json()}catch(c){throw c}},deletePersonalAPIToken:async a=>{const l=t(`api/admin/user/tokens/${a}`,{method:"DELETE"});try{await e(l.caller,l.id)}catch(c){throw c}},errors:n,loading:r}},n$e=e=>{const t=new Date(e);return bh(t,"yyyy-MM-dd")},r$e=e=>{const t=new Date(e);return bh(t,"yyyy-MM-dd")+"T"+bh(t,"HH:mm")},o$e=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:a,onChange:l,...c})=>{const u=t==="datetime"?r$e:n$e;return s(fn,{type:t==="datetime"?"datetime-local":"date",size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(a.toISOString()),onChange:p=>{const f=GM(p.target.value);l(f??a)},FormHelperTextProps:{"data-testid":WL},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},mO=x("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),i$e=x(ir)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),a$e=x("div")(({theme:e,custom:t})=>({display:"flex",alignItems:t?"start":"center",gap:e.spacing(1.5),marginBottom:e.spacing(2),[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start"}})),s$e=x(fg)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),l$e=x(o$e)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),c$e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var M8=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(M8||{});const B8=[{key:"7d",days:7,label:"7 days"},{key:"30d",days:30,label:"30 days"},{key:"60d",days:60,label:"60 days"},{key:"never",label:"Never"},{key:"custom",label:"Custom"}],bC=e=>{const t=new Date,n=B8.find(({key:r})=>r===e);return e==="never"?t.setFullYear(t.getFullYear()+1e3):e==="custom"?t.setMinutes(t.getMinutes()+30):n!=null&&n.days&&t.setDate(t.getDate()+n.days),t},u$e=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:a,errors:l,setErrors:c})=>{const{locationSettings:u}=ns(),d=y=>{c(b=>({...b,[y]:void 0}))},p=(y,b)=>{c(v=>({...v,[y]:b}))};g.useEffect(()=>{d("expiresAt"),a(bC(r))},[r]);const f=y=>{d("description"),n&&!n(y)&&p("description","A token with that description already exists."),t(y)},h=r==="custom",m=i.getFullYear()>new Date().getFullYear()+100;return S(ce,{children:[s(mO,{children:"Describe what this token will be used for"}),s(i$e,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:y=>f(y.target.value),required:!0}),s(mO,{children:"Token expiration date"}),S(a$e,{custom:h,children:[s(s$e,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:y=>o(y.target.value),options:B8}),s(V,{condition:h,show:()=>s(l$e,{label:"Date",value:i,onChange:y=>{d("expiresAt"),y<new Date&&p("expiresAt","Invalid date, must be in the future"),a(y)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:s(V,{condition:m,show:S(re,{variant:"body2",children:["The token will ",s("strong",{children:"never"})," ","expire!"]}),elseShow:()=>S(re,{variant:"body2",children:["Token will expire on"," ",s("strong",{children:ld(i,u.locale)})]})})})]}),s(V,{condition:m,show:s(c$e,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},d$e=x("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),p$e=x("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),f$e=x(Ve)(({theme:e})=>({marginLeft:e.spacing(3)})),Nm=M8["30DAYS"],h$e=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=zk(),{createPersonalAPIToken:i,loading:a}=D8(),{setToastApiError:l}=Ot(),{uiConfig:c}=St(),[u,d]=g.useState(""),[p,f]=g.useState(Nm),[h,m]=g.useState(bC(Nm)),[y,b]=g.useState({});g.useEffect(()=>{d(""),f(Nm),m(bC(Nm)),b({})},[e]);const v=()=>({description:u,expiresAt:h}),w=async _=>{_.preventDefault();try{const P=await i(v());n(P),o(),t(!1)}catch(P){l(gt(P))}},C=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
382
382
  --header 'Authorization: INSERT_API_KEY' \\
383
383
  --header 'Content-Type: application/json' \\
384
384
  --data-raw '${JSON.stringify(v(),void 0,2)}'`,k=_=>_.length,A=_=>!(r!=null&&r.some(P=>P.description===_)),T=k(u)&&A(u)&&h>new Date;return s(wg,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:s(Er,{loading:a,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
385
385
  yourself. A personal API token has the same access privileges as
386
- your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:C,children:S(d$e,{onSubmit:w,children:[s("div",{children:s(u$e,{description:u,setDescription:d,isDescriptionUnique:A,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:m,errors:y,setErrors:b})}),S(p$e,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!T,children:"Create token"}),s(f$e,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},g$e=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=zk(),{deletePersonalAPIToken:o}=D8(),{setToastData:i,setToastApiError:a}=Ot();return s(nr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(gt(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:S(re,{children:['Any applications or scripts using this token "',s("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},m$e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(3)})),y$e=({open:e,setOpen:t,token:n})=>S(nr,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s(m$e,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s(re,{variant:"body1",children:"Your token:"}),s(R8,{token:(n==null?void 0:n.secret)||""})]}),F8=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=ld})=>{const{locationSettings:i}=ns();if(!e)return s(zn,{children:n});const a=o(e,i.locale);return s(zn,{children:s(wt,{title:(r==null?void 0:r(a))??a,arrow:!0,children:s(re,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:s(Tc,{date:new Date(e),live:t,title:""})})})})},v$e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(3)})),b$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),w$e=x(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),S$e=x(re)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),x$e=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),C$e={id:"createdAt"},{value:yO,setValue:E$e}=Ol("PersonalAPITokensTable:v1",C$e),T$e=()=>{const e=on(),t=or(e.breakpoints.down("md")),n=or(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=zk(),[i,a]=Uh(),[l]=g.useState(()=>({sortBy:[{id:i.get("sort")||yO.id,desc:i.has("order")?i.get("order")==="desc":yO.desc}],globalFilter:i.get("search")||""})),[c,u]=g.useState(l.globalFilter),[d,p]=g.useState(!1),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(),[w,C]=g.useState(),k=g.useMemo(()=>[{Header:"Description",accessor:"description",Cell:ul,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:B})=>new Date(B).getFullYear()>new Date().getFullYear()+100?s(zn,{children:"Never"}):s(wh,{value:B}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:wh,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:F8,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>s(Cl,{children:s(wt,{title:"Delete token",arrow:!0,describeChild:!0,children:s("span",{children:s(jt,{onClick:()=>{C(B),y(!0)},children:s(yo,{})})})})}),maxWidth:100,disableSortBy:!0}],[C,y]),{data:A,getSearchText:T,getSearchContext:_}=lg(k,c,r),P=g.useMemo(()=>(A==null?void 0:A.length)===0&&o?x$e:A,[A,o]),{headerGroups:I,rows:O,prepareRow:$,state:{sortBy:F},setHiddenColumns:D}=nn.useTable({columns:k,data:P,initialState:l,sortTypes:li,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},nn.useSortBy,nn.useFlexLayout);return Md([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],D,k),g.useEffect(()=>{const B={};B.sort=F[0].id,F[0].desc&&(B.order="desc"),c&&(B.search=c),a(B,{replace:!0}),E$e({id:F[0].id,desc:F[0].desc||!1})},[F,c,a]),S(Jn,{isLoading:o,header:s(kn,{title:`Personal API tokens (${O.length<P.length?`${O.length} of ${P.length}`:P.length})`,actions:S(ce,{children:[s(V,{condition:!t,show:S(ce,{children:[s(Ro,{initialValue:c,onChange:u,getSearchContext:_}),s(kn.Divider,{})]})}),s(Ve,{variant:"contained",color:"primary",disabled:r.length>=e$e,onClick:()=>p(!0),children:"New token"})]}),children:s(V,{condition:t,show:s(Ro,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:_})})}),children:[s(v$e,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s(ts,{value:T(c),children:s(z1,{rows:O,headerGroups:I,prepareRow:$})}),s(V,{condition:O.length===0,show:s(V,{condition:(c==null?void 0:c.length)>0,show:S(Fr,{children:["No tokens found matching “",c,"”"]}),elseShow:S(b$e,{children:[s(w$e,{children:"You have no personal API tokens yet."}),s(S$e,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s(Ve,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s(h$e,{open:d,setOpen:p,newToken:B=>{v(B),h(!0)}}),s(y$e,{open:f,setOpen:h,token:b}),s(g$e,{open:m,setOpen:y,token:w})]})},k$e=()=>{const{data:e,error:t,mutate:n}=Pn(kt("api/admin/user/profile"),A$e);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},A$e=e=>fetch(e).then(xn("Profile")).then(t=>t.json());var jk={},R$e=hn;Object.defineProperty(jk,"__esModule",{value:!0});var z8=jk.default=void 0,_$e=R$e(gn()),P$e=mn,I$e=(0,_$e.default)((0,P$e.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");z8=jk.default=I$e;const j8=(e,t={})=>{const{isEnterprise:n}=St(),{data:r,error:o,mutate:i}=Dd(!!e&&n(),void 0,kt(`api/admin/roles/${e}`),O$e,t);return g.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},O$e=e=>fetch(e).then(xn("Role")).then(t=>t.json()),mc=e=>e.environment?`${e.id}-${e.environment}`:`${e.id}`,aje=e=>e.reduce((t,n)=>(t[mc(n)]=n,t),{}),sje=(e,t)=>{let n=bg(e);return n[mc(t)]?delete n[mc(t)]:n[mc(t)]={...t},n},lje=(e,t)=>{let n=bg(e);return t.every(o=>n[mc(o)])?t.forEach(o=>{delete n[mc(o)]}):t.forEach(o=>{n[mc(o)]={...o}}),n},$$e=e=>e.filter(({name:n})=>n!=="ADMIN").reduce((n,r)=>{var a;const o=((a=y3e.find(l=>l.permissions.includes(r.name)))==null?void 0:a.label)||"Other",i=n.find(({label:l})=>l===o);return i?i.permissions.push(r):n.push({label:o,type:"root",permissions:[r]}),n},[]).sort(L$e),N$e=e=>{const t=e.filter(({type:o})=>o===Y4e),n=e.filter(({type:o})=>o===K4e),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const a=i.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(i):o.push({label:a,type:"environment",permissions:[i]}),o},[])),r},cje=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],L$e=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),D$e=x("div",{shouldForwardProp:e=>e!=="tooltip"})(({theme:e,tooltip:t})=>({width:"100%",maxWidth:e.spacing(50),padding:t?e.spacing(1):e.spacing(3),backgroundColor:t?e.palette.background.paper:e.palette.neutral.light,color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,borderRadius:t?0:e.shape.borderRadiusMedium})),M$e=x("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),B$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),F$e=x("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),z$e=x(Gce)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),j$e=x("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),U$e=x("p")(({theme:e})=>({marginTop:e.spacing(.5)})),W$e=x("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),H$e=({roleId:e,tooltip:t,...n})=>{const{role:r}=j8(e.toString());if(!r)return null;const{name:o,description:i,permissions:a,type:l}=r,u=Z4e.includes(l)?N$e(a):$$e(a);return S(D$e,{tooltip:t,...n,children:[S(F$e,{children:[s(z$e,{color:"disabled"}),o]}),s(U$e,{children:i}),s(V,{condition:!Q4e.includes(r.type),show:()=>S(ce,{children:[s(M$e,{children:"Role permissions:"}),s(B$e,{children:u.map(({label:d,permissions:p})=>S("div",{children:[s(j$e,{children:d}),s(W$e,{children:p.map(f=>s("li",{children:f.displayName},f.id))})]},d))})]})})]})},V$e=({roleId:e,children:t})=>{const{role:n}=j8(e.toString());return n?s(Ld,{title:s(H$e,{roleId:e,tooltip:!0}),arrow:!0,children:s(zt,{color:"success",icon:s(l5,{}),sx:{cursor:"pointer"},children:n.name})}):t?s(zt,{color:"success",icon:s(l5,{}),children:t}):null},G$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),q$e=x("div")(()=>({flexGrow:1})),K$e=x(re)(({theme:e})=>({fontSize:e.spacing(3.75)})),Y$e=x(qE)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),vO=x(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),X$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),J$e=x(zt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),Q$e=x("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),Z$e=x(Os)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),eNe=x(Zh)(({theme:e})=>({backgroundColor:e.palette.background.paper})),tNe=({user:e})=>{const{profile:t}=k$e(),n=pt(),{locationSettings:r,setLocationSettings:o}=ns(),[i,a]=g.useState(),[l,c]=g.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);g.useEffect(()=>{const d=l.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return S(ce,{children:[S(G$e,{children:[s(Y$e,{user:e}),S(q$e,{children:[s(K$e,{children:e.name||e.username}),s(re,{variant:"body1",children:e.email})]})]}),S(Jn,{children:[s(vO,{children:"Access"}),S(X$e,{children:[s(fe,{sx:{width:"50%"},children:s(V,{condition:!!(t!=null&&t.rootRole),show:()=>S(ce,{children:[s(re,{variant:"body2",children:"Your root role"}),s(V$e,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),S(fe,{children:[s(re,{variant:"body2",children:"Projects"}),s(V,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>s(wt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(J$e,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:s(z8,{}),children:d})},d)),elseShow:s(wt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s(zt,{children:"No projects"})})})]})]}),s(Q$e,{}),s(vO,{children:"Settings"}),s(re,{variant:"body2",children:"This is the format used across the system for time and date"}),S(Z$e,{variant:"outlined",size:"small",children:[s(eNe,{htmlFor:"locale-select",children:"Date/Time formatting"}),s(eg,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>s("option",{value:d,children:d},d))})]})]})]})},nNe=()=>{const{user:e}=fi(),t=vo(),n=pt(),{config:r,loading:o}=$8("simple"),{uiConfig:i}=St(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],l=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:h})=>h&&p.includes(h))||a[0]).id},[u,d]=g.useState(c());return g.useEffect(()=>{d(c())},[t]),o?null:S(H4e,{tabs:a,value:u,onChange:l,children:[s(V,{condition:u==="profile",show:s(tNe,{user:e})}),s(V,{condition:u==="password",show:s(q4e,{})}),s(V,{condition:u==="pat",show:s(T$e,{})})]})},rNe=g.lazy(()=>Yd(()=>import("./CreateProject-6955728f.js"),[])),oNe=g.lazy(()=>Yd(()=>import("./FeatureViewLazyExport-85a68ed0.js"),[])),iNe=g.lazy(()=>Yd(()=>import("./LazyAdminExport-e2677758.js"),[])),aNe=g.lazy(()=>Yd(()=>import("./LazyProjectExport-969bb54e.js"),[])),sNe=()=>{const{isEnterprise:e}=St(),{data:t,error:n,mutate:r}=Dd(e(),{events:[]},kt("api/admin/logins"),lNe);return g.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},lNe=e=>fetch(e).then(xn("Login History")).then(t=>t.json()),bO=x(fe)(()=>({display:"flex",justifyContent:"center"})),cNe=({row:e,value:t})=>{const{searchQuery:n}=Il();return t?s(bO,{children:s(zt,{color:"success",children:"True"})}):s(bO,{children:s(Ld,{arrow:!0,title:s(qa,{search:n,children:e.original.failure_reason}),children:s(zt,{color:"error",children:"False"})})})},uNe=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=Gn({propagateErrors:!0});return{downloadCSV:async()=>{const a=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await t(a.caller,a.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:r,loading:e}},dNe={id:"created_at"},{value:wO,setValue:pNe}=Ol("LoginHistoryTable:v1",dNe),fNe={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},hNe=()=>{const{events:e,loading:t}=sNe(),{downloadCSV:n}=uNe(),[r,o]=Uh(),[i]=g.useState(()=>({sortBy:[{id:r.get("sort")||wO.id,desc:r.has("order")?r.get("order")==="desc":wO.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=g.useState(i.globalFilter),c=or(ca.breakpoints.down("sm")),u=or(ca.breakpoints.down("md")),d=g.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:C})=>s(F8,{value:C,dateFormat:U1}),sortType:"date",maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:ul,searchable:!0},{Header:"Authentication",accessor:C=>fNe[C.auth_type]||C.auth_type,width:150,maxWidth:150,Cell:ul,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:ul,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:cNe,filterName:"success",filterParsing:C=>C.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:f,getSearchContext:h}=lg(d,a,e),{headerGroups:m,rows:y,prepareRow:b,state:{sortBy:v},setHiddenColumns:w}=nn.useTable({columns:d,data:p,initialState:i,sortTypes:li,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:zn}},nn.useSortBy,nn.useFlexLayout);return Md([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),g.useEffect(()=>{const C={};C.sort=v[0].id,v[0].desc&&(C.order="desc"),a&&(C.search=a),o(C,{replace:!0}),pNe({id:v[0].id,desc:v[0].desc||!1})},[v,a,o]),S(Jn,{isLoading:t,header:s(kn,{title:`Login history (${y.length})`,actions:S(ce,{children:[s(V,{condition:!u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})}),s(V,{condition:y.length>0,show:S(ce,{children:[s(V,{condition:!u,show:s(kn.Divider,{})}),s(wt,{title:"Download login history",arrow:!0,children:s(jt,{onClick:n,children:s(kce,{})})})]})})]}),children:s(V,{condition:u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[s(ts,{value:f(a),children:s(z1,{rows:y,headerGroups:m,prepareRow:b})}),s(V,{condition:y.length===0,show:s(V,{condition:(a==null?void 0:a.length)>0,show:S(Fr,{children:["No login events found matching “",a,"”"]}),elseShow:s(Fr,{children:"No login events available."})})})]})},gNe=()=>{const{isEnterprise:e}=St();return e()?s("div",{children:s(h8,{permissions:hi,children:s(hNe,{})})}):s(WM,{feature:"login-history",page:!0})},mNe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});try{await e(u.caller,u.id)}catch(d){throw d}},errors:n,loading:r}},yNe=x("div")(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:e.spacing(4),position:"fixed",inset:0,backgroundColor:e.palette.background.paper,width:"100%"})),vNe=x(GL)(({theme:e})=>({height:"80px"})),bNe=x("div")(({theme:e})=>({display:"flex",position:"relative"})),wNe=x("div")(({theme:e})=>({marginTop:e.spacing(4)})),SNe=x(Ve)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),Uk=({children:e})=>{const t=pt();return S(yNe,{children:[S("div",{children:[s(vNe,{}),s(bNe,{children:s(re,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),S(wNe,{children:[s(Ve,{variant:"contained",color:"primary",onClick:()=>{t(bo)},children:"Go back"}),s(SNe,{onClick:()=>{t("/")},children:"Go home"})]})]}),e]})},xNe=x(fe)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),CNe=x(fe)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),ENe=({featureType:e,loading:t})=>{const n=pt(),{uiConfig:r}=St(),{refetch:o}=ag(),{updateFeatureTypeLifetime:i,loading:a}=mNe(),[l,c]=g.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=g.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:f}=Ot(),h=jn(),m=C=>{const k=parseInt(As(C.target.value),10);c(k),k===0&&d(!0)},y=C=>{d(C.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),v=async C=>{C.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature toggle type loaded");const k=u?0:l;await i(e.id,k),o(),p({title:"Feature type updated",type:"success"}),n("/feature-toggle-type"),h.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:k}})}catch(k){f(gt(k))}},w=g.useCallback(()=>[`curl --location --request PUT '${r.unleashUrl}/api/admin/feature-types/${e==null?void 0:e.id}/lifetime`,"--header 'Authorization: INSERT_API_KEY'","--header 'Content-Type: application/json'",`--data-raw '{
386
+ your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:C,children:S(d$e,{onSubmit:w,children:[s("div",{children:s(u$e,{description:u,setDescription:d,isDescriptionUnique:A,expiration:p,setExpiration:f,expiresAt:h,setExpiresAt:m,errors:y,setErrors:b})}),S(p$e,{children:[s(Ve,{type:"submit",variant:"contained",color:"primary",disabled:!T,children:"Create token"}),s(f$e,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},g$e=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=zk(),{deletePersonalAPIToken:o}=D8(),{setToastData:i,setToastApiError:a}=Ot();return s(nr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){a(gt(c))}},onClose:()=>{t(!1)},title:"Delete token?",children:S(re,{children:['Any applications or scripts using this token "',s("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},m$e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(3)})),y$e=({open:e,setOpen:t,token:n})=>S(nr,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[s(m$e,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),s(re,{variant:"body1",children:"Your token:"}),s(R8,{token:(n==null?void 0:n.secret)||""})]}),F8=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=ld})=>{const{locationSettings:i}=ns();if(!e)return s(zn,{children:n});const a=o(e,i.locale);return s(zn,{children:s(wt,{title:(r==null?void 0:r(a))??a,arrow:!0,children:s(re,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:s(Tc,{date:new Date(e),live:t,title:""})})})})},v$e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(3)})),b$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),w$e=x(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),S$e=x(re)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),x$e=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),C$e={id:"createdAt"},{value:yO,setValue:E$e}=Ol("PersonalAPITokensTable:v1",C$e),T$e=()=>{const e=on(),t=or(e.breakpoints.down("md")),n=or(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=zk(),[i,a]=Uh(),[l]=g.useState(()=>({sortBy:[{id:i.get("sort")||yO.id,desc:i.has("order")?i.get("order")==="desc":yO.desc}],globalFilter:i.get("search")||""})),[c,u]=g.useState(l.globalFilter),[d,p]=g.useState(!1),[f,h]=g.useState(!1),[m,y]=g.useState(!1),[b,v]=g.useState(),[w,C]=g.useState(),k=g.useMemo(()=>[{Header:"Description",accessor:"description",Cell:ul,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:B})=>new Date(B).getFullYear()>new Date().getFullYear()+100?s(zn,{children:"Never"}):s(wh,{value:B}),sortType:"date",maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:wh,sortType:"date",maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:F8,sortType:"date",maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:B}})=>s(Cl,{children:s(wt,{title:"Delete token",arrow:!0,describeChild:!0,children:s("span",{children:s(jt,{onClick:()=>{C(B),y(!0)},children:s(yo,{})})})})}),maxWidth:100,disableSortBy:!0}],[C,y]),{data:A,getSearchText:T,getSearchContext:_}=lg(k,c,r),P=g.useMemo(()=>(A==null?void 0:A.length)===0&&o?x$e:A,[A,o]),{headerGroups:I,rows:O,prepareRow:$,state:{sortBy:F},setHiddenColumns:D}=nn.useTable({columns:k,data:P,initialState:l,sortTypes:li,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},nn.useSortBy,nn.useFlexLayout);return Md([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],D,k),g.useEffect(()=>{const B={};B.sort=F[0].id,F[0].desc&&(B.order="desc"),c&&(B.search=c),a(B,{replace:!0}),E$e({id:F[0].id,desc:F[0].desc||!1})},[F,c,a]),S(Jn,{isLoading:o,header:s(kn,{title:`Personal API tokens (${O.length<P.length?`${O.length} of ${P.length}`:P.length})`,actions:S(ce,{children:[s(V,{condition:!t,show:S(ce,{children:[s(Ro,{initialValue:c,onChange:u,getSearchContext:_}),s(kn.Divider,{})]})}),s(Ve,{variant:"contained",color:"primary",disabled:r.length>=e$e,onClick:()=>p(!0),children:"New token"})]}),children:s(V,{condition:t,show:s(Ro,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:_})})}),children:[s(v$e,{severity:"info",children:"Use personal API tokens to authenticate to the Unleash API as yourself. A personal API token has the same access privileges as your user."}),s(ts,{value:T(c),children:s(z1,{rows:O,headerGroups:I,prepareRow:$})}),s(V,{condition:O.length===0,show:s(V,{condition:(c==null?void 0:c.length)>0,show:S(Fr,{children:["No tokens found matching “",c,"”"]}),elseShow:S(b$e,{children:[s(w$e,{children:"You have no personal API tokens yet."}),s(S$e,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),s(Ve,{variant:"outlined",onClick:()=>p(!0),children:"Create your first token"})]})})}),s(h$e,{open:d,setOpen:p,newToken:B=>{v(B),h(!0)}}),s(y$e,{open:f,setOpen:h,token:b}),s(g$e,{open:m,setOpen:y,token:w})]})},k$e=()=>{const{data:e,error:t,mutate:n}=Pn(kt("api/admin/user/profile"),A$e);return{profile:e,loading:!t&&!e,refetchProfile:()=>n(),error:t}},A$e=e=>fetch(e).then(xn("Profile")).then(t=>t.json());var jk={},R$e=hn;Object.defineProperty(jk,"__esModule",{value:!0});var z8=jk.default=void 0,_$e=R$e(gn()),P$e=mn,I$e=(0,_$e.default)((0,P$e.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16.77c.68 0 1.23-.56 1.23-1.23V8c0-1.1-.9-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-2-6H6v-2h12v2zm-4 4H6v-2h8v2z"}),"TopicOutlined");z8=jk.default=I$e;const j8=(e,t={})=>{const{isEnterprise:n}=St(),{data:r,error:o,mutate:i}=Dd(!!e&&n(),void 0,kt(`api/admin/roles/${e}`),O$e,t);return g.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},O$e=e=>fetch(e).then(xn("Role")).then(t=>t.json()),mc=e=>e.environment?`${e.id}-${e.environment}`:`${e.id}`,aje=e=>e.reduce((t,n)=>(t[mc(n)]=n,t),{}),sje=(e,t)=>{let n=bg(e);return n[mc(t)]?delete n[mc(t)]:n[mc(t)]={...t},n},lje=(e,t)=>{let n=bg(e);return t.every(o=>n[mc(o)])?t.forEach(o=>{delete n[mc(o)]}):t.forEach(o=>{n[mc(o)]={...o}}),n},$$e=e=>e.filter(({name:n})=>n!=="ADMIN").reduce((n,r)=>{var a;const o=((a=y3e.find(l=>l.permissions.includes(r.name)))==null?void 0:a.label)||"Other",i=n.find(({label:l})=>l===o);return i?i.permissions.push(r):n.push({label:o,type:"root",permissions:[r]}),n},[]).sort(L$e),N$e=e=>{const t=e.filter(({type:o})=>o===Y4e),n=e.filter(({type:o})=>o===K4e),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const a=i.environment,l=o.find(({label:c})=>c===a);return l?l.permissions.push(i):o.push({label:a,type:"environment",permissions:[i]}),o},[])),r},cje=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],L$e=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),D$e=x("div",{shouldForwardProp:e=>e!=="tooltip"})(({theme:e,tooltip:t})=>({width:"100%",maxWidth:e.spacing(50),padding:t?e.spacing(1):e.spacing(3),backgroundColor:t?e.palette.background.paper:e.palette.neutral.light,color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,borderRadius:t?0:e.shape.borderRadiusMedium})),M$e=x("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),B$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),F$e=x("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),z$e=x(Gce)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),j$e=x("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),U$e=x("p")(({theme:e})=>({marginTop:e.spacing(.5)})),W$e=x("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),H$e=({roleId:e,tooltip:t,...n})=>{const{role:r}=j8(e.toString());if(!r)return null;const{name:o,description:i,permissions:a,type:l}=r,u=Z4e.includes(l)?N$e(a):$$e(a);return S(D$e,{tooltip:t,...n,children:[S(F$e,{children:[s(z$e,{color:"disabled"}),o]}),s(U$e,{children:i}),s(V,{condition:!Q4e.includes(r.type),show:()=>S(ce,{children:[s(M$e,{children:"Role permissions:"}),s(B$e,{children:u.map(({label:d,permissions:p})=>S("div",{children:[s(j$e,{children:d}),s(W$e,{children:p.map(f=>s("li",{children:f.displayName},f.id))})]},d))})]})})]})},V$e=({roleId:e,children:t})=>{const{role:n}=j8(e.toString());return n?s(Ld,{title:s(H$e,{roleId:e,tooltip:!0}),arrow:!0,children:s(zt,{color:"success",icon:s(l5,{}),sx:{cursor:"pointer"},children:n.name})}):t?s(zt,{color:"success",icon:s(l5,{}),children:t}):null},G$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:e.spacing(6),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText,marginBottom:e.spacing(3),boxShadow:e.boxShadows.primaryHeader})),q$e=x("div")(()=>({flexGrow:1})),K$e=x(re)(({theme:e})=>({fontSize:e.spacing(3.75)})),Y$e=x(qE)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),vO=x(re)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),X$e=x("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),J$e=x(zt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),Q$e=x("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),Z$e=x(Os)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),eNe=x(Zh)(({theme:e})=>({backgroundColor:e.palette.background.paper})),tNe=({user:e})=>{const{profile:t}=k$e(),n=pt(),{locationSettings:r,setLocationSettings:o}=ns(),[i,a]=g.useState(),[l,c]=g.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);g.useEffect(()=>{const d=l.find(p=>p.toLowerCase().includes(r.locale.toLowerCase()));a(d),d||c(p=>[...p,r.locale])},[r]);const u=d=>{const p=d.target.value;a(p),o({locale:p})};return S(ce,{children:[S(G$e,{children:[s(Y$e,{user:e}),S(q$e,{children:[s(K$e,{children:e.name||e.username}),s(re,{variant:"body1",children:e.email})]})]}),S(Jn,{children:[s(vO,{children:"Access"}),S(X$e,{children:[s(fe,{sx:{width:"50%"},children:s(V,{condition:!!(t!=null&&t.rootRole),show:()=>S(ce,{children:[s(re,{variant:"body2",children:"Your root role"}),s(V$e,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),S(fe,{children:[s(re,{variant:"body2",children:"Projects"}),s(V,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>s(wt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:s(J$e,{onClick:p=>{p.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:s(z8,{}),children:d})},d)),elseShow:s(wt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:s(zt,{children:"No projects"})})})]})]}),s(Q$e,{}),s(vO,{children:"Settings"}),s(re,{variant:"body2",children:"This is the format used across the system for time and date"}),S(Z$e,{variant:"outlined",size:"small",children:[s(eNe,{htmlFor:"locale-select",children:"Date/Time formatting"}),s(eg,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>s("option",{value:d,children:d},d))})]})]})]})},nNe=()=>{const{user:e}=fi(),t=vo(),n=pt(),{config:r,loading:o}=$8("simple"),{uiConfig:i}=St(),a=[{id:"profile",label:"Profile"},{id:"password",label:"Change password",path:"change-password",hidden:r.disabled},{id:"pat",label:"Personal API tokens",path:"personal-api-tokens",hidden:i.flags.personalAccessTokensKillSwitch}],l=p=>{n(p.path?`/profile/${p.path}`:"/profile",{replace:!0}),d(p.id)},c=()=>{const p=t.pathname;return(a.find(({path:h})=>h&&p.includes(h))||a[0]).id},[u,d]=g.useState(c());return g.useEffect(()=>{d(c())},[t]),o?null:S(H4e,{tabs:a,value:u,onChange:l,children:[s(V,{condition:u==="profile",show:s(tNe,{user:e})}),s(V,{condition:u==="password",show:s(q4e,{})}),s(V,{condition:u==="pat",show:s(T$e,{})})]})},rNe=g.lazy(()=>Yd(()=>import("./CreateProject-1e9f20af.js"),[])),oNe=g.lazy(()=>Yd(()=>import("./FeatureViewLazyExport-578a84bd.js"),[])),iNe=g.lazy(()=>Yd(()=>import("./LazyAdminExport-98306920.js"),[])),aNe=g.lazy(()=>Yd(()=>import("./LazyProjectExport-ebbfce17.js"),[])),sNe=()=>{const{isEnterprise:e}=St(),{data:t,error:n,mutate:r}=Dd(e(),{events:[]},kt("api/admin/logins"),lNe);return g.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},lNe=e=>fetch(e).then(xn("Login History")).then(t=>t.json()),bO=x(fe)(()=>({display:"flex",justifyContent:"center"})),cNe=({row:e,value:t})=>{const{searchQuery:n}=Il();return t?s(bO,{children:s(zt,{color:"success",children:"True"})}):s(bO,{children:s(Ld,{arrow:!0,title:s(qa,{search:n,children:e.original.failure_reason}),children:s(zt,{color:"error",children:"False"})})})},uNe=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=Gn({propagateErrors:!0});return{downloadCSV:async()=>{const a=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await t(a.caller,a.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:r,loading:e}},dNe={id:"created_at"},{value:wO,setValue:pNe}=Ol("LoginHistoryTable:v1",dNe),fNe={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},hNe=()=>{const{events:e,loading:t}=sNe(),{downloadCSV:n}=uNe(),[r,o]=Uh(),[i]=g.useState(()=>({sortBy:[{id:r.get("sort")||wO.id,desc:r.has("order")?r.get("order")==="desc":wO.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[a,l]=g.useState(i.globalFilter),c=or(ca.breakpoints.down("sm")),u=or(ca.breakpoints.down("md")),d=g.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:C})=>s(F8,{value:C,dateFormat:U1}),sortType:"date",maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:ul,searchable:!0},{Header:"Authentication",accessor:C=>fNe[C.auth_type]||C.auth_type,width:150,maxWidth:150,Cell:ul,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:ul,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:cNe,filterName:"success",filterParsing:C=>C.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:p,getSearchText:f,getSearchContext:h}=lg(d,a,e),{headerGroups:m,rows:y,prepareRow:b,state:{sortBy:v},setHiddenColumns:w}=nn.useTable({columns:d,data:p,initialState:i,sortTypes:li,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:zn}},nn.useSortBy,nn.useFlexLayout);return Md([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),g.useEffect(()=>{const C={};C.sort=v[0].id,v[0].desc&&(C.order="desc"),a&&(C.search=a),o(C,{replace:!0}),pNe({id:v[0].id,desc:v[0].desc||!1})},[v,a,o]),S(Jn,{isLoading:t,header:s(kn,{title:`Login history (${y.length})`,actions:S(ce,{children:[s(V,{condition:!u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})}),s(V,{condition:y.length>0,show:S(ce,{children:[s(V,{condition:!u,show:s(kn.Divider,{})}),s(wt,{title:"Download login history",arrow:!0,children:s(jt,{onClick:n,children:s(kce,{})})})]})})]}),children:s(V,{condition:u,show:s(Ro,{initialValue:a,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[s(ts,{value:f(a),children:s(z1,{rows:y,headerGroups:m,prepareRow:b})}),s(V,{condition:y.length===0,show:s(V,{condition:(a==null?void 0:a.length)>0,show:S(Fr,{children:["No login events found matching “",a,"”"]}),elseShow:s(Fr,{children:"No login events available."})})})]})},gNe=()=>{const{isEnterprise:e}=St();return e()?s("div",{children:s(h8,{permissions:hi,children:s(hNe,{})})}):s(WM,{feature:"login-history",page:!0})},mNe=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,a)=>{const l={lifetimeDays:a},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});try{await e(u.caller,u.id)}catch(d){throw d}},errors:n,loading:r}},yNe=x("div")(({theme:e})=>({display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:e.spacing(4),position:"fixed",inset:0,backgroundColor:e.palette.background.paper,width:"100%"})),vNe=x(GL)(({theme:e})=>({height:"80px"})),bNe=x("div")(({theme:e})=>({display:"flex",position:"relative"})),wNe=x("div")(({theme:e})=>({marginTop:e.spacing(4)})),SNe=x(Ve)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),Uk=({children:e})=>{const t=pt();return S(yNe,{children:[S("div",{children:[s(vNe,{}),s(bNe,{children:s(re,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),S(wNe,{children:[s(Ve,{variant:"contained",color:"primary",onClick:()=>{t(bo)},children:"Go back"}),s(SNe,{onClick:()=>{t("/")},children:"Go home"})]})]}),e]})},xNe=x(fe)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),CNe=x(fe)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),ENe=({featureType:e,loading:t})=>{const n=pt(),{uiConfig:r}=St(),{refetch:o}=ag(),{updateFeatureTypeLifetime:i,loading:a}=mNe(),[l,c]=g.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=g.useState(!(e!=null&&e.lifetimeDays)),{setToastData:p,setToastApiError:f}=Ot(),h=jn(),m=C=>{const k=parseInt(As(C.target.value),10);c(k),k===0&&d(!0)},y=C=>{d(C.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},b=!u&&(Number.isNaN(l)||l<0),v=async C=>{C.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature toggle type loaded");const k=u?0:l;await i(e.id,k),o(),p({title:"Feature type updated",type:"success"}),n("/feature-toggle-type"),h.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:k}})}catch(k){f(gt(k))}},w=g.useCallback(()=>[`curl --location --request PUT '${r.unleashUrl}/api/admin/feature-types/${e==null?void 0:e.id}/lifetime`,"--header 'Authorization: INSERT_API_KEY'","--header 'Content-Type: application/json'",`--data-raw '{
387
387
  "lifetimeDays": 7
388
388
  }'`].join(` \\
389
389
  `),[r,e==null?void 0:e.id]);return!t&&!e?s(Uk,{children:s("div",{"data-testid":"404_NOT_FOUND"})}):s(Er,{modal:!0,title:t?"Edit toggle type":`Edit toggle type: ${e==null?void 0:e.name}`,description:(e==null?void 0:e.description)||"",documentationLink:"https://docs.getunleash.io/reference/feature-toggle-types",documentationLinkLabel:"Feature toggle types documentation",formatApiCode:w,children:S(CNe,{component:"form",onSubmit:v,children:[S(re,{sx:C=>({margin:C.spacing(3,0,1),display:"flex",alignItems:"center"}),children:[s(fe,{component:"label",htmlFor:"feature-toggle-lifetime",children:"Expected lifetime"}),s(Wi,{htmlTooltip:!0,tooltip:S(ce,{children:[s("p",{children:"If your toggle exceeded lifetime of it's type it will be marked as potencially stale."}),s("br",{}),s("a",{href:"https://docs.getunleash.io/reference/feature-toggle-types#expected-lifetime",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})]})})]}),S(fe,{component:"label",sx:C=>({display:"flex",alignItems:"center",cursor:"pointer",marginBottom:C.spacing(1),marginRight:"auto"}),htmlFor:"feature-toggle-expire",children:[s(es,{checked:u||l===0,id:"feature-toggle-expire",onChange:y,disabled:t}),s(fe,{children:"doesn't expire"})]}),s(ir,{autoFocus:!0,disabled:u||t,type:"number",label:"Lifetime in days",id:"feature-toggle-lifetime",value:u?"0":`${l}`,onChange:m,error:b}),S(xNe,{children:[s(Io,{permission:hi,variant:"contained",color:"primary",type:"submit",disabled:t||a,children:"Save feature toggle type"}),s(Ve,{type:"button",color:"primary",onClick:()=>n(bo),children:"Cancel"})]})]})})},TNe=({featureTypes:e,loading:t})=>{const{featureTypeId:n}=N2(),r=e.find(o=>o.id===n);return s(ENe,{featureType:r,loading:t})},kNe="/feature-toggle-type",ANe=()=>{const{featureTypes:e,loading:t}=ag(),n=pt(),r=g.useMemo(()=>[{accessor:"id",Cell:({value:d})=>{const p=r9(d);return s(h0,{icon:s(p,{"data-loading":"true",color:"action"})})},width:50,disableSortBy:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:d,description:p}}})=>s(Ka,{"data-loading":!0,title:d,subtitle:p}),sortType:"alphanumeric"},{Header:"Lifetime",accessor:"lifetimeDays",Cell:({value:d})=>d?s(zn,{children:d===1?"1 day":`${d} days`}):s(zn,{children:"doesn't expire"}),minWidth:150,sortType:"numericZeroLast"},{Header:"Actions",Cell:({row:{original:d}})=>s(fe,{sx:p=>({padding:p.spacing(.5,0)}),children:s(Cl,{children:s(Kr,{disabled:!d.id,"data-loading":"true",onClick:()=>n(`/feature-toggle-type/edit/${d.id}`),permission:hi,tooltipProps:{title:`Edit ${d.name} feature toggle type`},children:s(ji,{})})})}),disableSortBy:!0}],[n]),o=g.useMemo(()=>t?Array(5).fill({id:"",name:"Loading...",description:"Loading...",lifetimeDays:1}):e,[t,e]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u}=nn.useTable({columns:r,data:o,sortTypes:li,autoResetSortBy:!1,disableSortRemove:!0,initialState:{sortBy:[{id:"lifetimeDays"}]}},nn.useSortBy);return S(Jn,{isLoading:t,header:s(kn,{children:s(re,{component:"h2",sx:d=>({fontSize:d.fontSizes.mainHeader}),children:"Feature toggle types"})}),children:[S(da,{...i(),children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(d=>(u(d),s(Fi,{hover:!0,...d.getRowProps(),children:d.cells.map(p=>s(Ui,{...p.getCellProps(),children:p.render("Cell")}))})))})]}),s(WN,{children:s(Cf,{path:"edit/:featureTypeId",element:s(wg,{label:"Edit feature toggle type",onClose:()=>n(kNe),open:!0,children:s(TNe,{featureTypes:e,loading:t})})})})]})},RNe="/static/edge-mode-5d25949b.svg",_Ne="/static/edge-offline-f6a0f761.svg",PNe="/static/edge-daisy-chaining-012bfdef.svg",INe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),ONe=x("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3)})),$Ne=x("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(1)})),tS=x(re)(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1)})),NNe=x("a")({textDecoration:"none","&:hover":{textDecoration:"underline"}}),nS=x("figure")(({theme:e})=>({display:"flex",marginLeft:0,marginRight:0,marginTop:e.spacing(1.5),marginBottom:e.spacing(3),gap:e.spacing(1),flexDirection:"column"})),rS=x("figcaption")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary,textAlign:"center"})),SO={name:"unleash",displayName:"Unleash Edge",description:"Unleash Edge is the successor to the Unleash Proxy.",documentationUrl:"https://docs.getunleash.io/reference/unleash-edge",howTo:`Unleash Edge sits between the Unleash API and your SDKs and provides a cached read-replica of your Unleash instance. This means you can scale up your Unleash instance to thousands of connected SDKs without increasing the number of requests you make to your Unleash instance.
@@ -391,7 +391,7 @@ Unleash Edge offers two important features:
391
391
  - **Performance:** Unleash Edge caches in memory and can run close to your end-users. A single instance can handle tens to hundreds of thousands of requests per second.
392
392
  - **Resilience:** Unleash Edge is designed to survive restarts and operate properly even if you lose connection to your Unleash server.`},LNe=()=>{const{displayName:e,description:t,documentationUrl:n}=SO;return s(Er,{title:`${e}`,description:t||"",documentationLink:n,documentationLinkLabel:"Unleash Edge documentation",children:S(INe,{children:[s(WT,{provider:SO,title:"Why would you need Edge?"}),s($Ne,{children:S(NNe,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash-edge#readme",children:["View Unleash Edge on GitHub"," ",s(OT,{fontSize:"inherit",sx:{verticalAlign:"middle",marginBottom:"2px"}})]})}),s(xr,{sx:r=>({marginTop:r.spacing(2),marginBottom:r.spacing(2)})}),s("iframe",{src:"https://www.youtube-nocookie.com/embed/6uIdF-yByWs?si=rPzsFCM_2IheaTUo",title:"YouTube video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,style:{width:"100%",aspectRatio:"16/9"}}),S(ONe,{children:[S("section",{children:[s(tS,{variant:"h3",children:"Modes"}),S(re,{variant:"body1",children:["Edge currently supports 2 different modes:"," ",S("ul",{children:[S("li",{children:[s("a",{href:"https://docs.getunleash.io/reference/unleash-edge#edge",target:"_blank",rel:"noopener noreferrer",children:"Edge"})," ","Edge – Connection to upstream node (Unleash instance or another Edge). Supports dynamic tokens, metrics and other advanced features;"]}),S("li",{children:[s("a",{href:"https://docs.getunleash.io/reference/unleash-edge#offline",target:"_blank",rel:"noopener noreferrer",children:"Offline"})," ","– No connection to upstream node. Full control of data and tokens;"]})]})]})]}),S("section",{children:[s(tS,{variant:"h3",children:"Edge"}),s(re,{variant:"body1",children:'Edge mode is the "standard" mode for Unleash Edge and the one you should default to in most cases. It connects to an upstream node, such as your Unleash instance, and uses that as the source of truth for feature toggles.'}),S(nS,{children:[s("img",{src:aa(RNe),alt:"test"}),s(rS,{children:"Edge mode"})]}),s(re,{children:"Other than connecting Edge directly to your Unleash instance, it's also possible to connect to another Edge instance (daisy chaining). You can have as many Edge nodes as you'd like between the Edge node your clients are accessing and the Unleash server, and it's also possible for multiple nodes to connect to a single upstream one."}),S(nS,{children:[s("img",{src:aa(PNe),alt:"test"}),s(rS,{children:"Edge daisy chaining"})]})]}),S("section",{children:[s(tS,{variant:"h3",children:"Offline"}),s(re,{children:"Offline mode is useful when there is no connection to an upstream node, such as your Unleash instance or another Edge instance, or as a tool to make working with Unleash easier during development."}),S(nS,{children:[s("img",{src:aa(_Ne),alt:"test"}),s(rS,{children:"Edge offline"})]})]})]})]})})},DNe=()=>{const{providerId:e}=N2();return e==="jira"?s(vwe,{}):e==="edge"?s(LNe,{}):s(Uk,{})},MNe=x(Kt)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),BNe=(e,t)=>{const n=t!==0?", ":"",r=e.project!=="*"?s(MNe,{to:`/projects/${e.project}`,children:e.project}):e.project,o=` (${e.environments.join(", ")})`;return[n,r,o]},FNe=({usage:e})=>{const t=on(),n=e==null?void 0:e.flatMap((r,o)=>BNe(r,o));return s(zn,{children:s(V,{condition:e!==void 0&&e.length>0,show:s(re,{variant:"body2",children:n}),elseShow:s(re,{variant:"body2",color:t.palette.text.secondary,children:"not connected"})})})},zNe=()=>{const{applications:e,loading:t}=P9(),n=()=>s(ce,{children:S("section",{style:{textAlign:"center"},children:[s(Zce,{titleAccess:"Warning"})," ",s("br",{}),s("br",{}),"Oh snap, it does not seem like you have connected any applications. To connect your application to Unleash you will require a Client SDK.",s("br",{}),s("br",{}),"You can read more about how to use Unleash in your application in the"," ",s(Nr,{href:"https://docs.getunleash.io/docs/sdks/",children:"documentation."})]})}),r=g.useMemo(()=>({sortBy:[{id:"name",desc:!1}],hiddenColumns:["description","sortOrder"]}),[]),o=g.useMemo(()=>[{id:"Icon",Cell:({row:{original:{icon:f}}})=>s(h0,{icon:s(Bc,{children:s(O1,{children:f})})}),disableGlobalFilter:!0},{Header:"Name",accessor:"appName",width:"50%",Cell:({row:{original:{appName:f,description:h}}})=>s(Ka,{title:f,to:`/applications/${f}`,subtitle:h}),sortType:"alphanumeric"},{Header:"Project(environment)",accessor:"usage",width:"50%",Cell:({row:{original:f}})=>s(FNe,{usage:f.usage}),sortType:"alphanumeric"},{accessor:"description",disableSortBy:!0},{accessor:"sortOrder",disableGlobalFilter:!0,sortType:"number"}],[]),{getTableProps:i,getTableBodyProps:a,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:p}=nn.useTable({columns:o,data:e,initialState:r,sortTypes:li,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},nn.useGlobalFilter,nn.useSortBy);return e?s(ce,{children:s(Jn,{header:s(kn,{title:`Applications (${c.length})`,actions:s(Ro,{initialValue:d,onChange:p})}),children:s("div",{className:ju.fullwidth,children:s(V,{condition:e.length>0,show:s(ts,{value:d,children:S(da,{...i(),children:[s(ua,{headerGroups:l}),s(la,{...a(),children:c.map(f=>(u(f),s(Fi,{hover:!0,...f.getRowProps(),children:f.cells.map(h=>s(Ui,{...h.getCellProps(),children:h.render("Cell")}))})))})]})}),elseShow:s(V,{condition:t,show:s("div",{children:"...loading"}),elseShow:n()})})})})}):s(QQ,{variant:"indeterminate"})},oS=()=>{const e=vo(),t=pt();return g.useEffect(()=>{t(`/integrations${e.pathname.replace("/addons","")}`)},[e.pathname,t]),S(Jn,{children:["Addons where renamed to"," ",s(Kt,{to:"/integrations",children:"/integrations"})]})},Ph=[{path:"/splash/:splashId",title:"Unleash",component:pIe,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:rNe,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/edit",parent:"/projects",title:":projectId",component:_Pe,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:Lxe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/:activeTab/copy",parent:"/projects/:projectId/features/:featureId/:activeTab",title:"Copy",component:V5e,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:o5e,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:oNe,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature toggle",component:WPe,type:"protected",menu:{}},{path:"/projects/:projectId/features2/:featureId",parent:"/features",title:":featureId",component:iO,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:aNe,flag:RSe,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:Nxe,type:"protected",menu:{mobile:!0}},{path:"/features/:activeTab/:featureId",parent:"/features",title:":featureId",component:iO,type:"protected",menu:{}},{path:"/features",title:"Feature toggles",component:cge,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:B4e,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/applications/:name",title:":name",parent:"/applications",component:c5e,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:zNe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:gIe,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:Q_e,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:p5e,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/feature-toggle-type/*",title:"Feature toggle types",component:ANe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:X3e,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:J3e,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:Yge,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:Nme,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:Yxe,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:Qxe,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:JOe,type:"protected",flag:_Se,menu:{mobile:!0,advanced:!0}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:lPe,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:sPe,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:Mme,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:oS,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:oS,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:oS,hidden:!1,type:"protected",menu:{}},{path:"/integrations/create/:providerId",parent:"/integrations",title:"Create",component:D5e,type:"protected",menu:{}},{path:"/integrations/view/:providerId",parent:"/integrations",title:"View",component:DNe,type:"protected",menu:{}},{path:"/integrations/edit/:addonId",parent:"/integrations",title:"Edit",component:M5e,type:"protected",menu:{}},{path:"/integrations",title:"Integrations",component:Iwe,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/segments/create",title:"Segments",component:JIe,hidden:!1,type:"protected",layout:"main",menu:{}},{path:"/segments/edit/:segmentId",title:"Segments",component:tOe,hidden:!1,type:"protected",layout:"main",menu:{}},{path:"/segments",title:"Segments",component:g4e,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/history",title:"Event log",component:$3e,type:"protected",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",component:gNe,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived toggles",component:M4e,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:iNe,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:nNe,type:"protected",menu:{}},{path:"/login",title:"Log in",component:ASe,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:txe,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:oxe,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:dxe,type:"unprotected",menu:{},isStandalone:!0}],jNe=Ph.filter(e=>!e.hidden),UNe=()=>{const e=jNe.filter(o=>o.menu.advanced),t=Ph.filter(o=>o.menu.adminSettings),n=Ph.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},xO=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag,notFlag:t.notFlag})),WNe=UNe(),HNe=(e={})=>{const t=kt("api/admin/notifications"),{data:n,error:r,mutate:o}=Pn(t,VNe,e),i=g.useCallback(()=>{o().catch(console.warn)},[o]);return{notifications:n,error:r,loading:!r&&!n,refetchNotifications:i,mutateNotifications:o}},VNe=async e=>await(await fetch(e).then(xn("Notifications"))).json();var Wk={},GNe=hn;Object.defineProperty(Wk,"__esModule",{value:!0});var Hk=Wk.default=void 0,qNe=GNe(gn()),KNe=mn,YNe=(0,qNe.default)((0,KNe.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"}),"Notifications");Hk=Wk.default=YNe;const XNe=x(fe)(({theme:e})=>({padding:e.spacing(1,1.5,1,3),display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",boxShadow:e.boxShadows.separator})),JNe=({children:e})=>s(ce,{children:S(XNe,{children:[s(re,{fontWeight:"bold",children:"Notifications"}),e]})}),QNe=x(ia)(({theme:e})=>({padding:e.spacing(1,1,3,1)})),ZNe=({children:e})=>s(QNe,{"data-testid":"NOTIFICATIONS_LIST",children:e}),e6e=e=>g.createElement("svg",{width:18,height:14,viewBox:"0 0 18 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{d:"M0.59 2.00016L2 0.590157L5.41 4.00016L4 5.41016L0.59 2.00016ZM13 11.5002L13 8.00016L7.41 8.00016L2 13.4102L0.59 12.0002L6.59 6.00016L13 6.00016L13 2.50016L17.5 7.00016L13 11.5002Z",fill:"currentColor"})),CO=x(fe,{shouldForwardProp:e=>e!=="readAt"})(({theme:e,readAt:t})=>({padding:e.spacing(.5),marginRight:e.spacing(1.5),backgroundColor:t?e.palette.neutral.light:e.palette.secondary.light,width:"30px",height:"30px",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:`${e.shape.borderRadius}px`,top:3,left:7})),t6e=x(pne)(({theme:e})=>({position:"relative",cursor:"pointer",padding:e.spacing(2.5,2,3,2),borderRadius:e.shape.borderRadiusMedium,width:"100%","&:after":{content:'""',width:`calc(100% - ${e.spacing(4)})`,height:"1px",position:"absolute",bottom:0,backgroundColor:e.palette.divider}})),n6e=x(fe)(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%"})),r6e=x(fe)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(1,0,0,5.25)})),o6e=x(re,{shouldForwardProp:e=>e!=="readAt"})(({theme:e,readAt:t})=>({display:"flex",alignItems:"center",fontSize:e.fontSizes.smallBody,fontWeight:t?"normal":"bold",textDecoration:"none",color:"inherit",wordBreak:"break-all"})),i6e=x(re)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),a6e=x(fe)(({theme:e})=>({...Fc})),s6e=x(Bc)(({theme:e})=>({width:"18px",height:"18px"})),l6e=x(re)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.neutral.main,marginLeft:e.spacing(1)})),c6e=({notification:e,onNotificationClick:t})=>{const n=on(),{readAt:r}=e;return s(t6e,{onClick:()=>t(e),children:S(n6e,{children:[S(o6e,{readAt:!!r,children:[(i=>{if(i==="change-request")return s(CO,{readAt:!!r,children:s(e6e,{color:e.readAt?n.palette.neutral.main:n.palette.primary.main,style:{transform:"scale(0.8)"}})});if(i==="toggle")return s(CO,{readAt:!!r,children:s(Kce,{sx:a=>({height:"20px",width:"20px",color:r?a.palette.neutral.main:a.palette.primary.main})})})})(e.notificationType)," ",e.message]}),S(r6e,{children:[S(a6e,{children:[s(s6e,{src:e.createdBy.imageUrl||""}),S(l6e,{children:["Created by ",e.createdBy.username]})]}),s(i6e,{children:s(Tc,{date:new Date(e.createdAt),minPeriod:60})})]})]})})},u6e=x(fe)(()=>({display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",minHeight:"150px"})),d6e=x(Hk)(({theme:e})=>({height:"30px",width:"30px",color:e.palette.neutral.main,marginBottom:e.spacing(1)})),p6e=({text:e})=>S(u6e,{children:[s(d6e,{}),s(re,{color:"neutral.main",children:e})]}),f6e=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=Gn({propagateErrors:!0});return{loading:r,errors:n,markAsRead:async i=>{const l=t("api/admin/notifications/read",{method:"POST",body:JSON.stringify(i)});try{await e(l.caller,l.id)}catch(c){throw c}}}},h6e=x(fe)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginTop:e.spacing(.5)})),g6e=({id:e,localStorageKey:t,eventName:n})=>{var d;const{uiConfig:r}=St(),{value:o,setValue:i}=Ol(`${r.baseUriPath}:${t}:v1:${e}`,{}),[a,l]=g.useState(o.value),{trackEvent:c}=jn();if(!((d=r==null?void 0:r.flags)!=null&&d.T)||a)return null;const u=p=>{l(p),i({value:p}),c(n,{props:{eventType:e,wasHelpful:p==="yes"}})};return S(Cr,{elevation:0,sx:{background:p=>p.palette.neutral.light,padding:p=>p.spacing(1.5,2),marginTop:p=>p.spacing(1.5)},children:["Was this information useful to you?",S(h6e,{children:[s(Ve,{size:"small",variant:a==="yes"?"contained":"outlined",sx:{padding:0},onClick:()=>u("yes"),disabled:!!a,children:"Yes"}),s(Ve,{size:"small",variant:a==="no"?"contained":"outlined",sx:{padding:0},onClick:()=>u("no"),disabled:!!a,children:"No"})]})]})},m6e=x(fe)(()=>({position:"relative"})),y6e=x(fe)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,display:"flex",justifyContent:"center"})),v6e=x(re)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,textAlign:"center"})),b6e=x(Cr)(({theme:e})=>({width:"420px",boxShadow:e.boxShadows.popup,borderRadius:`${e.shape.borderRadiusLarge}px`,position:"absolute",right:-100,top:60,maxHeight:"80vh",overflowY:"auto"})),w6e=x(fe)(({theme:e})=>({backgroundColor:e.palette.primary.main,borderRadius:"100%",width:"7px",height:"7px",position:"absolute",top:7,right:4})),S6e=x(fe)(()=>({...Fc})),x6e=x(re)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),C6e=x(jt)(({theme:e})=>({"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),E6e=()=>{const[e,t]=g.useState(!1),{notifications:n,refetchNotifications:r}=HNe({refreshInterval:15e3}),o=pt(),{markAsRead:i}=f6e(),{uiConfig:a}=St(),{trackEvent:l}=jn(),[c,u]=g.useState(!1),d=async w=>{var C;w.link&&o(w.link),(C=a==null?void 0:a.flags)!=null&&C.T&&l("notifications",{props:{eventType:w.notificationType}}),t(!1);try{await i({notifications:[w.id]}),r()}catch(k){console.error("Error marking notification as read: ",k)}},p=async()=>{try{n&&n.length>0&&(await i({notifications:n.map(w=>w.id)}),r())}catch(w){console.error("Error marking all notification as read: ",w)}},f=w=>{w.key==="Escape"&&t(!1)},h=n==null?void 0:n.filter(w=>w.readAt===null),m=!!(h&&h.length>0),y=w=>c?!w.readAt:!0,b=n==null?void 0:n.filter(y).map(w=>s(c6e,{notification:w,onNotificationClick:d},w.id)),v=!!(n&&n.length>0&&!c);return S(m6e,{children:[S(C6e,{onClick:()=>t(!e),"data-testid":"NOTIFICATIONS_BUTTON",disableFocusRipple:!0,children:[s(V,{condition:m,show:s(w6e,{})}),s(Hk,{})]}),s(V,{condition:e,show:s(M6,{onClickAway:()=>t(!1),children:S(b6e,{className:"dropdown-outline",onKeyDown:f,"data-testid":"NOTIFICATIONS_MODAL",children:[s(JNe,{children:S(S6e,{children:[s(x6e,{children:"Show only unread"}),s(pa,{onClick:()=>u(!c),checked:c})]})}),s(V,{condition:m,show:s(y6e,{"data-testid":"UNREAD_NOTIFICATIONS",children:s(Ve,{onClick:p,children:S(v6e,{children:["Mark all as read (",h==null?void 0:h.length,")"]})})})})," ",s(V,{condition:(b==null?void 0:b.length)===0,show:s(p6e,{text:c?"No unread notifications":"No new notifications"})}),s(ZNe,{children:b}),s(V,{condition:v,show:S(ce,{children:[s(g6e,{eventName:"notifications",id:"useful",localStorageKey:"NotificationsUsefulPrompt"}),s("br",{})]})})]})})})]})},uje={users:"User administration",access:"Access control",instance:"Instance configuration",log:"Logs",other:"Other"},EO=[{path:"/admin/users",title:"Users",menu:{adminSettings:!0},group:"users"},{path:"/admin/service-accounts",title:"Service accounts",menu:{adminSettings:!0,mode:["enterprise"]},group:"users"},{path:"/admin/groups",title:"Groups",menu:{adminSettings:!0,mode:["enterprise"]},group:"users"},{path:"/admin/roles/*",title:"Roles",menu:{adminSettings:!0,mode:["enterprise"]},group:"users"},{path:"/admin/api",title:"API access",menu:{adminSettings:!0},group:"access"},{path:"/admin/cors",title:"CORS origins",flag:"embedProxyFrontend",menu:{adminSettings:!0},group:"access"},{path:"/admin/auth",title:"Single sign-on",menu:{adminSettings:!0,mode:["pro","enterprise"]},group:"access"},{path:"/admin/network/*",title:"Network",menu:{adminSettings:!0,mode:["pro","enterprise"]},configFlag:"networkViewEnabled",group:"instance"},{path:"/admin/maintenance",title:"Maintenance",menu:{adminSettings:!0},group:"instance"},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0},group:"instance"},{path:"/admin/instance-privacy",title:"Instance privacy",menu:{adminSettings:!0},group:"instance"},{path:"/admin/admin-invoices",title:"Billing & invoices",menu:{adminSettings:!0,billing:!0},group:"instance"},{path:"/admin/logins",title:"Login history",menu:{adminSettings:!0,mode:["enterprise"]},group:"log"},{path:"/history",title:"Event log",menu:{adminSettings:!0},group:"log"}];var xs=(e=>(e.UNASSIGNED="UNASSIGNED",e.TRIAL="TRIAL",e.ACTIVE="ACTIVE",e.EXPIRED="EXPIRED",e.CHURNED="CHURNED",e))(xs||{}),Qs=(e=>(e.PRO="Pro",e.COMPANY="Company",e.TEAM="Team",e.ENTERPRISE="Enterprise",e.UNKNOWN="Unknown",e))(Qs||{});const T6e=(e,t,n)=>{const{data:r,error:o,mutate:i}=Pn(e,t,n),a=g.useCallback(()=>{i().catch(console.warn)},[i]);return{data:r,error:o,refetch:a,loading:!o&&!r}},U8=()=>{const{uiConfig:e}=St(),{flags:{UNLEASH_CLOUD:t}}=e,{data:n,refetch:r,loading:o,error:i}=T6e(["useInstanceStatus",t],()=>k6e(t)),a=[Qs.PRO,Qs.COMPANY,Qs.TEAM];return{instanceStatus:n,refetchInstanceStatus:r,refresh:async()=>{await fetch(kt("api/instance/refresh"))},isBilling:a.includes((n==null?void 0:n.plan)??Qs.UNKNOWN),loading:o,error:i}},k6e=async e=>{if(!e)return TO;const t=await fetch(kt("api/instance/status"));return t.ok?t.json():TO},TO={plan:Qs.UNKNOWN},A6e=(e,{pro:t,enterprise:n,billing:r})=>{const o=e==null?void 0:e.mode;return e!=null&&e.billing&&!r?!1:!!(!o||o.length===0||t&&(o.includes("pro")||o.includes("enterprise"))||n&&o.includes("enterprise"))},R6e=()=>{const{uiConfig:e,isPro:t,isEnterprise:n}=St(),{isBilling:r}=U8(),o=[...EO];if(e.flags.UNLEASH_CLOUD){const i=EO.findIndex(a=>a.title==="Billing & invoices");o[i]={...o[i],path:"/admin/billing"}}return o.filter(nC(e)).filter(i=>A6e(i==null?void 0:i.menu,{enterprise:n(),pro:t(),billing:r})).map(rC)},kO=x(PX)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300})),AO=x(eZ)(({theme:e})=>({display:"flex",alignItems:"center",maxWidth:1280,"&&&":{padding:0}})),RO=x("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),_6e=x("nav")({display:"flex",alignItems:"center",flexGrow:1}),P6e=x(gD)({width:"150px"}),I6e=x(hD)({width:"150px"}),O6e=x("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),$6e=x("button")(({theme:e})=>({...zi(e),border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),_O=e=>({color:e.palette.neutral.main}),Lm=x(Kt)(({theme:e})=>zi(e)),N6e=x(jt)(({theme:e})=>({...zi(e),borderRadius:100})),L6e=()=>{const{onSetThemeMode:e,themeMode:t}=zL(),n=on(),r=Sl(),o=Sl(),[i,a]=g.useState(null),[l,c]=g.useState(null),{uiConfig:u,isOss:d}=St(),p=or(n.breakpoints.down("md")),[f,h]=g.useState(!1),m=()=>h(k=>!k),y=()=>a(null),b=()=>c(null),v=WNe(),w=R6e(),C={mainNavRoutes:xO(v.mainNavRoutes).filter(nC(u)).map(rC),mobileRoutes:xO(v.mobileRoutes).filter(nC(u)).map(rC),adminRoutes:w};return p?s(kO,{position:"static",children:S(AO,{children:[s(wt,{title:"Menu",arrow:!0,children:s(jt,{sx:{color:k=>k.palette.text.primary},onClick:m,"aria-controls":"header-drawer","aria-expanded":f,size:"large",children:s(uD,{})})}),s(Sue,{links:u.links,open:f,toggleDrawer:m,routes:C}),s(RO,{children:s(a5,{})})]})}):s(kO,{position:"static",children:S(AO,{children:[s(Lm,{to:"/",sx:Fc,"aria-label":"Home",children:s(zc,{darkmode:s(P6e,{"aria-label":"Unleash logo"}),lightmode:s(I6e,{"aria-label":"Unleash logo"})})}),S(_6e,{children:[S(O6e,{children:[s(Lm,{to:"/projects",children:"Projects"}),s(Lm,{to:"/features",children:"Feature toggles"}),s(Lm,{to:"/playground",children:"Playground"}),S($6e,{onClick:k=>c(k.currentTarget),"aria-controls":l?o:void 0,"aria-expanded":!!l,children:["Configure",s(Nx,{sx:_O})]}),s(p5,{id:o,options:C.mainNavRoutes,anchorEl:l,handleClose:b,style:{top:10}})]}),S(RO,{children:[s(wt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:s(jt,{onClick:e,sx:zi,children:s(V,{condition:t==="dark",show:s(Ece,{}),elseShow:s(Bce,{})})})})," ",s(V,{condition:!d()&&!(u!=null&&u.flags.disableNotifications),show:s(E6e,{})}),s(wt,{title:"Documentation",arrow:!0,children:s(jt,{href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",disableRipple:!0,sx:zi,children:s(YE,{})})}),s(wt,{title:"Settings",arrow:!0,children:S(N6e,{onClick:k=>a(k.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":!!i,size:"large",disableRipple:!0,children:[s(dD,{}),s(Nx,{sx:_O})]})}),s(p5,{id:r,options:C.adminRoutes,anchorEl:i,handleClose:y,style:{top:5,left:-100}})," ",s(a5,{})]})]})]})})},D6e=e=>{var n;const t=(n=e.versionInfo)==null?void 0:n.current;return t!=null&&t.enterprise?`${e.name} ${t.enterprise}`:t!=null&&t.oss?`${e.name} ${t.oss}`:`${e.name} ${e.version}`},M6e=e=>{var r,o;const t=(r=e.versionInfo)==null?void 0:r.latest,n=(o=e.versionInfo)==null?void 0:o.isLatest;if(t!=null&&t.enterprise&&!n)return`Upgrade available - Latest Enterprise release: ${t.enterprise}`;if(t!=null&&t.oss&&!n)return`Upgrade available - Latest OSS release: ${t.oss}`},sy=x("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),B6e=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=D6e(e.uiConfig),r=e.uiConfig.environment,o=M6e(e.uiConfig);return S("section",{title:"API details",children:[S(sy,{children:[n," ",s(V,{condition:!!r,show:S("small",{children:["(",r,")"]})})]}),s(V,{condition:!!o,show:S("small",{children:[o,s("br",{})]})}),s("br",{}),s("small",{children:e.uiConfig.slogan}),s("br",{}),s(V,{condition:!!t,show:s("small",{children:`${t}`})})]})},F6e=x("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.background.paper})),iS=x(ia)({padding:0,margin:0}),pr=x(Na)(({theme:e})=>({padding:0,margin:0,"& a":{...zi(e),textDecoration:"none",color:e.palette.text.primary,"&:hover":{textDecoration:"underline"}}})),z6e=()=>{const{uiConfig:e}=St();return s(F6e,{children:S(Vn,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[s(Vn,{item:!0,md:4,xs:12,children:s(B6e,{uiConfig:e})}),s(Vn,{item:!0,xs:12,md:"auto",children:S(Vn,{container:!0,spacing:7,direction:"row",children:[s(Vn,{item:!0,children:S("section",{title:"Unleash SDK",children:[s(sy,{children:"Server SDKs"}),S(iS,{dense:!0,children:[s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",rel:"noreferrer",children:"Node.js"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",rel:"noreferrer",children:"Java"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",rel:"noreferrer",children:"Go"})})})," ",s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/rust",target:"_blank",rel:"noreferrer",children:"Rust"})})})," ",s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",rel:"noreferrer",children:"Ruby"})})})," ",s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",rel:"noreferrer",children:"Python"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",rel:"noreferrer",children:".NET"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",rel:"noreferrer",children:"PHP"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"All SDKs"})})})]})]})}),s(Vn,{item:!0,children:S("section",{title:"Unleash SDK",children:[s(sy,{children:"Frontend SDKs"}),S(iS,{dense:!0,children:[s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",rel:"noreferrer",children:"Unleash Proxy"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",rel:"noreferrer",children:"JavaScript"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",rel:"noreferrer",children:"React"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/next-js",target:"_blank",rel:"noreferrer",children:"Next.js"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/vue",target:"_blank",rel:"noreferrer",children:"Vue"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",rel:"noreferrer",children:"iOS"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",rel:"noreferrer",children:"Android"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://docs.getunleash.io/reference/sdks/flutter",target:"_blank",rel:"noreferrer",children:"Flutter"})})})]})]})}),s(Vn,{item:!0,children:S("section",{children:[s(sy,{children:"About"}),S(iS,{dense:!0,children:[s(pr,{children:s(en,{primary:s("a",{href:"https://www.getunleash.io/",target:"_blank",rel:"noreferrer",children:"getunleash.io"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://twitter.com/getunleash",target:"_blank",rel:"noreferrer",children:"Twitter"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",rel:"noreferrer",children:"LinkedIn"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://github.com/Unleash/unleash",target:"_blank",rel:"noreferrer",children:"GitHub"})})}),s(pr,{children:s(en,{primary:s("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Slack Community"})})})]})]})})]})})]})})},j6e=x(Bt)(({theme:e})=>({marginBottom:e.spacing(2)})),U6e=x(re)(({theme:e})=>({maxWidth:"800px"})),W6e=x("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),H6e=e=>!(!e||localStorage&&localStorage.getItem(e)),V6e=({toast:e})=>{const[t,n]=g.useState(!1);g.useEffect(()=>{n(H6e((e==null?void 0:e.id)||""))},[e==null?void 0:e.id]);const r=()=>{localStorage&&localStorage.setItem((e==null?void 0:e.id)||"","seen"),n(!1)};return e?s(V,{condition:t,show:S(j6e,{severity:e.severity,onClose:r,children:[s(U6e,{variant:"body2",children:e.message}),s(W6e,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},G6e=x("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),q6e=x(rQ)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),PO=x("p")(D1),K6e=x(Kt)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),Y6e=()=>{const{isAdmin:e}=g.useContext(Po),t=vo(),n=t.pathname.split("/").filter(r=>r).filter(r=>r!=="create"&&r!=="edit"&&r!=="view"&&r!=="variants"&&r!=="logs"&&r!=="metrics"&&r!=="copy"&&r!=="features"&&r!=="features2"&&r!=="create-toggle"&&r!=="settings"&&r!=="profile");return s(G6e,{children:s(V,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:s(V,{condition:n.length>1,show:s(q6e,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return s(PO,{children:r},r);let a="/";return n.forEach((l,c)=>{c!==o&&c<o?a+=l+"/":c===o&&(a+=l)}),s(K6e,{to:a,children:s(PO,{children:r})},r)})})})})})},IO="/static/texture-c29e66c0.png",W8="skip-nav-target-id",X6e=()=>s("div",{id:W8}),J6e=x("a")(({theme:e})=>({position:"fixed",overflow:"hidden",zIndex:1e3,top:e.spacing(2.25),left:e.spacing(2.25),padding:e.spacing(1,2),whiteSpace:"nowrap",textDecoration:"none",background:e.palette.background.alternative,color:e.palette.common.white,borderRadius:e.shape.borderRadius,fontSize:e.fontSizes.smallBody,...zi(e),[e.breakpoints.down(960)]:{top:"0.8rem",left:"0.8rem"},"&:not(:focus):not(:active)":{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",zIndex:-1,width:1,height:1,margin:-1,padding:0}})),Q6e=()=>S(J6e,{href:`#${W8}`,children:["Skip to content ",s("span",{"aria-hidden":!0,children:"↓"})]}),H8=({conflict:e})=>s(V,{condition:!!e,show:S(Bt,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"},borderRadius:"0px"},children:[s("strong",{children:"Conflict!"})," ",e,"."]})}),Z6e=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>S(SE,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[S(fe,{sx:i=>({backgroundColor:i.palette.neutral.light,borderRadius:a=>`${a.shape.borderRadiusLarge}px ${a.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:a=>n?a.palette.warning.border:a.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[s(H8,{conflict:n}),S(fe,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[s(re,{children:"Feature toggle name: "}),s(Nr,{component:Kt,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:s("strong",{children:e})})]})]}),s(fe,{children:o})]});var Vk={},eLe=hn;Object.defineProperty(Vk,"__esModule",{value:!0});var V8=Vk.default=void 0,tLe=eLe(gn()),nLe=mn,rLe=(0,tLe.default)((0,nLe.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}),"Block");V8=Vk.default=rLe;var Gk={},oLe=hn;Object.defineProperty(Gk,"__esModule",{value:!0});var G8=Gk.default=void 0,iLe=oLe(gn()),aLe=mn,sLe=(0,iLe.default)((0,aLe.jsx)("path",{d:"m19.07 4.93-1.41 1.41C19.1 7.79 20 9.79 20 12c0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02C8.16 6.57 6 9.03 6 12c0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41C15.55 9.9 16 10.9 16 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V2h-1C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07z"}),"TrackChanges");G8=Gk.default=sLe;var lLe=200,qk="__lodash_hash_undefined__",cLe=1/0,q8=9007199254740991,uLe="[object Arguments]",dLe="[object Function]",pLe="[object GeneratorFunction]",fLe="[object Symbol]",hLe=/[\\^$.*+?()[\]{}|]/g,gLe=/^\[object .+?Constructor\]$/,mLe=/^(?:0|[1-9]\d*)$/,yLe=typeof xi=="object"&&xi&&xi.Object===Object&&xi,vLe=typeof self=="object"&&self&&self.Object===Object&&self,Kk=yLe||vLe||Function("return this")();function bLe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function wLe(e,t){var n=e?e.length:0;return!!n&&CLe(e,t,0)>-1}function SLe(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function K8(e,t){for(var n=-1,r=e?e.length:0,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function Yk(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function xLe(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function CLe(e,t,n){if(t!==t)return xLe(e,ELe,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function ELe(e){return e!==e}function TLe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function kLe(e){return function(t){return e(t)}}function ALe(e,t){return e.has(t)}function RLe(e,t){return e==null?void 0:e[t]}function _Le(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function Y8(e,t){return function(n){return e(t(n))}}var PLe=Array.prototype,ILe=Function.prototype,y0=Object.prototype,aS=Kk["__core-js_shared__"],OO=function(){var e=/[^.]+$/.exec(aS&&aS.keys&&aS.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X8=ILe.toString,Qd=y0.hasOwnProperty,Xk=y0.toString,OLe=RegExp("^"+X8.call(Qd).replace(hLe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$O=Kk.Symbol,$Le=Y8(Object.getPrototypeOf,Object),NLe=y0.propertyIsEnumerable,LLe=PLe.splice,NO=$O?$O.isConcatSpreadable:void 0,wC=Object.getOwnPropertySymbols,LO=Math.max,DLe=Q8(Kk,"Map"),Ih=Q8(Object,"create");function _c(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function MLe(){this.__data__=Ih?Ih(null):{}}function BLe(e){return this.has(e)&&delete this.__data__[e]}function FLe(e){var t=this.__data__;if(Ih){var n=t[e];return n===qk?void 0:n}return Qd.call(t,e)?t[e]:void 0}function zLe(e){var t=this.__data__;return Ih?t[e]!==void 0:Qd.call(t,e)}function jLe(e,t){var n=this.__data__;return n[e]=Ih&&t===void 0?qk:t,this}_c.prototype.clear=MLe;_c.prototype.delete=BLe;_c.prototype.get=FLe;_c.prototype.has=zLe;_c.prototype.set=jLe;function Zd(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ULe(){this.__data__=[]}function WLe(e){var t=this.__data__,n=v0(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():LLe.call(t,n,1),!0}function HLe(e){var t=this.__data__,n=v0(t,e);return n<0?void 0:t[n][1]}function VLe(e){return v0(this.__data__,e)>-1}function GLe(e,t){var n=this.__data__,r=v0(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Zd.prototype.clear=ULe;Zd.prototype.delete=WLe;Zd.prototype.get=HLe;Zd.prototype.has=VLe;Zd.prototype.set=GLe;function ep(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qLe(){this.__data__={hash:new _c,map:new(DLe||Zd),string:new _c}}function KLe(e){return b0(this,e).delete(e)}function YLe(e){return b0(this,e).get(e)}function XLe(e){return b0(this,e).has(e)}function JLe(e,t){return b0(this,e).set(e,t),this}ep.prototype.clear=qLe;ep.prototype.delete=KLe;ep.prototype.get=YLe;ep.prototype.has=XLe;ep.prototype.set=JLe;function dv(e){var t=-1,n=e?e.length:0;for(this.__data__=new ep;++t<n;)this.add(e[t])}function QLe(e){return this.__data__.set(e,qk),this}function ZLe(e){return this.__data__.has(e)}dv.prototype.add=dv.prototype.push=QLe;dv.prototype.has=ZLe;function eDe(e,t){var n=Jk(e)||Z8(e)?TLe(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Qd.call(e,i))&&!(o&&(i=="length"||pDe(i,r)))&&n.push(i);return n}function v0(e,t){for(var n=e.length;n--;)if(bDe(e[n][0],t))return n;return-1}function tDe(e,t,n,r){var o=-1,i=wLe,a=!0,l=e.length,c=[],u=t.length;if(!l)return c;n&&(t=K8(t,kLe(n))),r?(i=SLe,a=!1):t.length>=lLe&&(i=ALe,a=!1,t=new dv(t));e:for(;++o<l;){var d=e[o],p=n?n(d):d;if(d=r||d!==0?d:0,a&&p===p){for(var f=u;f--;)if(t[f]===p)continue e;c.push(d)}else i(t,p,r)||c.push(d)}return c}function J8(e,t,n,r,o){var i=-1,a=e.length;for(n||(n=dDe),o||(o=[]);++i<a;){var l=e[i];t>0&&n(l)?t>1?J8(l,t-1,n,r,o):Yk(o,l):r||(o[o.length]=l)}return o}function nDe(e,t,n){var r=t(e);return Jk(e)?r:Yk(r,n(e))}function rDe(e){if(!Qk(e)||hDe(e))return!1;var t=t7(e)||_Le(e)?OLe:gLe;return t.test(vDe(e))}function oDe(e){if(!Qk(e))return mDe(e);var t=gDe(e),n=[];for(var r in e)r=="constructor"&&(t||!Qd.call(e,r))||n.push(r);return n}function iDe(e,t){return e=Object(e),aDe(e,t,function(n,r){return r in e})}function aDe(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var a=t[r],l=e[a];n(l,a)&&(i[a]=l)}return i}function sDe(e,t){return t=LO(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=LO(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=n[r];return a[t]=i,bLe(e,this,a)}}function lDe(e){return nDe(e,CDe,uDe)}function b0(e,t){var n=e.__data__;return fDe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Q8(e,t){var n=RLe(e,t);return rDe(n)?n:void 0}var cDe=wC?Y8(wC,Object):r7,uDe=wC?function(e){for(var t=[];e;)Yk(t,cDe(e)),e=$Le(e);return t}:r7;function dDe(e){return Jk(e)||Z8(e)||!!(NO&&e&&e[NO])}function pDe(e,t){return t=t??q8,!!t&&(typeof e=="number"||mLe.test(e))&&e>-1&&e%1==0&&e<t}function fDe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function hDe(e){return!!OO&&OO in e}function gDe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||y0;return e===n}function mDe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function yDe(e){if(typeof e=="string"||xDe(e))return e;var t=e+"";return t=="0"&&1/e==-cLe?"-0":t}function vDe(e){if(e!=null){try{return X8.call(e)}catch{}try{return e+""}catch{}}return""}function bDe(e,t){return e===t||e!==e&&t!==t}function Z8(e){return wDe(e)&&Qd.call(e,"callee")&&(!NLe.call(e,"callee")||Xk.call(e)==uLe)}var Jk=Array.isArray;function e7(e){return e!=null&&SDe(e.length)&&!t7(e)}function wDe(e){return n7(e)&&e7(e)}function t7(e){var t=Qk(e)?Xk.call(e):"";return t==dLe||t==pLe}function SDe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=q8}function Qk(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function n7(e){return!!e&&typeof e=="object"}function xDe(e){return typeof e=="symbol"||n7(e)&&Xk.call(e)==fLe}function CDe(e){return e7(e)?eDe(e,!0):oDe(e)}var EDe=sDe(function(e,t){return e==null?{}:(t=K8(J8(t,1),yDe),iDe(e,tDe(lDe(e),t)))});function r7(){return[]}var TDe=EDe;const o7=Yr(TDe),DO=x("div")(()=>({...D1,maxWidth:500})),i7=({newName:e,previousName:t})=>S(ce,{children:[s(V,{condition:!!(t&&t!==e),show:s(DO,{children:s(re,{component:"del",color:"text.secondary",children:t})})}),s(V,{condition:!!e,show:s(DO,{children:s(re,{children:e})})})]}),kDe=x("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),sS=({change:e,currentStrategy:t})=>{const n=e.action==="deleteStrategy"?void 0:e.payload;return s(kDe,{children:s(Xd,{entry:{preData:o7(t,"sortOrder"),data:n}})})},ADe=x("div")(({theme:e})=>({display:"grid",gridAutoFlow:"column",gridTemplateColumns:"auto 1fr",gap:e.spacing(1),alignItems:"center"})),RDe=x("div")(()=>({...D1,maxWidth:500})),lS=({change:e,previousTitle:t,children:n})=>S(ADe,{children:[s(vme,{strategyName:e.payload.name}),S(RDe,{children:[s(Uc,{tooltip:n,tooltipProps:{maxWidth:500,maxHeight:600},children:s(re,{component:"span",children:ks(e.payload.name)})}),s(i7,{newName:e.payload.title,previousName:t})]})]}),MO=({percentage:e,size:t="4rem"})=>{const n=on(),r={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:n.palette.background.elevation2},o=100/(2*Math.PI),i=2*o;return s("svg",{viewBox:`0 0 ${i} ${i}`,style:r,"aria-hidden":!0,children:s("circle",{r:o,cx:o,cy:o,fill:"none",stroke:n.palette.primary.light,strokeWidth:i,strokeDasharray:`${e} 100`})})},_De=x("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`})),PDe=x("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),IDe=x(Is)(({theme:e})=>({margin:e.spacing(.5)})),cS=({value:e,text:t})=>s(_De,{children:s(V,{condition:e.length===0,show:S("p",{children:["No ",t,"s added yet."]}),elseShow:S("div",{children:[S(PDe,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>s(IDe,{label:s(_a,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),ODe=({segments:e})=>!e||e.length===0?null:s(ce,{children:e.map((t,n)=>S(g.Fragment,{children:[s(V,{condition:n>0,show:s(Ek,{text:"AND"})}),s(FB,{segment:t})]},t.id))}),BO=()=>s(fe,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),Wl=x(fe)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium})),uS=x("span")(({theme:e})=>({color:e.palette.neutral.main})),SC=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,{strategies:r}=zd();St();const{segments:o}=Ll(),i=o==null?void 0:o.filter(d=>{var p;return(p=e.segments)==null?void 0:p.includes(d.id)}),a=r.find(d=>d.name===e.name),l=g.useMemo(()=>!t||a!=null&&a.editable?null:Object.keys(t).map(d=>{switch(d){case"rollout":case"Rollout":const p=Lf(t[d]);return S(Wl,{sx:{display:"flex",alignItems:"center"},children:[s(fe,{sx:{mr:2},children:s(MO,{percentage:p,size:"2rem"})}),S("div",{children:[S(zt,{color:"success",children:[p,"%"]})," of your base"," ",n.length>0?"who match constraints":""," ","is included."]})]});case"userIds":case"UserIds":const f=Js(t[d]);return s(cS,{value:f,text:"user"},d);case"hostNames":case"HostNames":const h=Js(t[d]);return s(cS,{value:h,text:"host"},d);case"IPs":const m=Js(t[d]);return s(cS,{value:m,text:"IP"},d);case"stickiness":case"groupId":return null;default:return null}}),[t,a,n]),c=g.useMemo(()=>{if(!t||!(a!=null&&a.editable))return null;const d=s(uS,{children:" is set to "});return a==null?void 0:a.parameters.map(p=>{const{type:f,name:h}={...p};if(!f||!h||t[h]===void 0)return null;const m=s(_a,{maxLength:15,maxWidth:"150",text:h});switch(p==null?void 0:p.type){case"list":const y=Js(t[h]);return y.length>0?S(Wl,{children:[m," ",S(uS,{children:["has ",y.length," ",y.length>1?"items":"item",":"," ",y.map(C=>s(Is,{label:s(_a,{maxWidth:"300",text:C,maxLength:50}),sx:{mr:.5}},C))]})]}):null;case"percentage":const b=Lf(t[h]);return t[h]!==""?S(Wl,{sx:{display:"flex",alignItems:"center"},children:[s(fe,{sx:{mr:2},children:s(MO,{percentage:b,size:"2rem"})}),S("div",{children:[m,d,S(zt,{color:"success",children:[b,"%"]})]})]}):null;case"boolean":return t[h]==="true"||t[h]==="false"?S(Wl,{children:[s(_a,{maxLength:15,maxWidth:"150",text:h}),d,s(zt,{color:t[h]==="true"?"success":"error",children:t[h]})]}):null;case"string":const v=cl(t[h]);return typeof t[h]<"u"?S(Wl,{children:[m,s(V,{condition:v==="",show:s(uS,{children:" is an empty string"}),elseShow:S(ce,{children:[d,s(_a,{maxWidth:"300",text:v,maxLength:50})]})})]}):null;case"number":const w=Lf(t[h]);return t[h]!==""&&w!==void 0?S(Wl,{children:[m,d,s(_a,{maxWidth:"300",text:String(w),maxLength:50})]}):null;case"default":return null}return null})},[t,a]);if(!t)return s(BO,{});const u=[i&&i.length>0&&s(ODe,{segments:i}),n.length>0&&s(yg,{constraints:n,showLabel:!1}),e.name==="default"&&s(ce,{children:S(Wl,{sx:{width:"100%"},children:["The standard strategy is ",s(zt,{color:"success",children:"ON"})," ","for all users."]})}),...l??[],...c??[]].filter(Boolean);return s(V,{condition:u.length>0,show:s(ce,{children:u.map((d,p)=>S(g.Fragment,{children:[s(V,{condition:p>0,show:s(Ek,{text:"AND"})}),d]},p))}),elseShow:s(BO,{})})},$De=(e,t,n,r)=>{var a,l;return(l=(a=Ja(t,n).feature)==null?void 0:a.environments.find(c=>c.name===r))==null?void 0:l.strategies.find(c=>"id"in e.payload&&c.id===e.payload.id)},NDe=x(re)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,whiteSpace:"pre-wrap"})),LDe=({value:e})=>{const{searchQuery:t}=Il();return e?e.type==="string"&&e.value.length<20?s(zn,{children:s(qa,{search:t,children:e.value})}):s(zn,{children:s(Uc,{tooltip:s(ce,{children:s(NDe,{children:s(qa,{search:t,children:e.value})})}),highlighted:t.length>0&&e.value.toLowerCase().includes(t.toLowerCase()),children:e.type})}):s(zn,{})},DDe=x(re)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),MDe=({value:e})=>{const{searchQuery:t}=Il();if(!e||e.length===0)return s(zn,{});const n=r=>`${r.contextName}:${r.values.join()}`;return s(zn,{children:s(Uc,{tooltip:s(ce,{children:e.map((r,o)=>s(DDe,{children:s(qa,{search:t,children:n(r)})},r.contextName+o))}),highlighted:t.length>0&&(e==null?void 0:e.map(n).join(`
393
393
  `).toLowerCase().includes(t.toLowerCase())),children:e.length===1?"1 override":`${e.length} overrides`})})},a7=({variants:e,searchValue:t=""})=>{const n=lr("projectId"),r=on(),o=or(r.breakpoints.down("md")),i=or(r.breakpoints.down("lg")),a=g.useMemo(()=>[{Header:"Name",accessor:"name",Cell:ul,sortType:"alphanumeric",minWidth:350,searchable:!0},{Header:"Payload",accessor:"payload",Cell:LDe,disableSortBy:!0,searchable:!0,filterParsing:b=>b==null?void 0:b.value},{Header:"Overrides",accessor:"overrides",Cell:MDe,disableSortBy:!0,searchable:!0,filterParsing:b=>(b==null?void 0:b.map(({contextName:v,values:w})=>`${v}:${w.join()}`).join(`
394
- `))||""},{Header:"Weight",accessor:"weight",Cell:({row:{original:{name:b,weight:v}}})=>S(zn,{"data-testid":`VARIANT_WEIGHT_${b}`,children:[Uxe(v)," %"]}),sortType:"number"},{Header:"Type",accessor:b=>b.weightType==="fix"?"Fixed":"Variable",Cell:zn,sortType:"alphanumeric"}],[n,e]),l=g.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{data:c,getSearchText:u}=lg(a,t,e),{getTableProps:d,getTableBodyProps:p,headerGroups:f,rows:h,prepareRow:m,setHiddenColumns:y}=nn.useTable({columns:a,data:c,initialState:l,sortTypes:li,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},nn.useSortBy);return Md([{condition:o,columns:["payload","overrides"]},{condition:i,columns:["weightType"]}],y,a),S(ce,{children:[s(ts,{value:u(t),children:S(da,{...d(),children:[s(ua,{headerGroups:f}),s(la,{...p(),children:h.map(b=>(m(b),s(Fi,{hover:!0,...b.getRowProps(),children:b.cells.map(v=>s(Ui,{...v.getCellProps(),children:v.render("Cell")}))})))})]})}),s(V,{condition:h.length===0,show:s(V,{condition:(t==null?void 0:t.length)>0,show:S(Fr,{children:["No variants found matching “",t,"”"]})})})]})},Zk=x(fe)({display:"flex",justifyContent:"space-between",alignItems:"center"}),FO=x(fe)(({theme:e})=>({display:"grid",gridTemplateColumns:"auto auto",justifyContent:"space-between",gap:e.spacing(1),alignItems:"center",marginBottom:e.spacing(2),width:"100%"})),dS=x(fe)(({theme:e})=>({display:"grid",gridTemplateColumns:"150px auto",gridAutoFlow:"column",alignItems:"center",flexGrow:1,gap:e.spacing(1)})),BDe=x(fe)(({theme:e})=>({marginTop:e.spacing(2)})),FDe=x(re)(({theme:e})=>({margin:`${e.spacing(1)} 0`})),zDe=e=>typeof e=="object"&&e!==null&&"name"in e,zO=({show:e=!0,disabled:t})=>e?t?s(wt,{title:"This strategy will not be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:s(zt,{color:"disabled",icon:s(V8,{}),children:"Disabled"})}):s(wt,{title:"This was disabled before and with this change it will be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:s(zt,{color:"success",icon:s(G8,{}),children:"Enabled"})}):null,jDe=({wasDisabled:e=!1,willBeDisabled:t=!1})=>e&&t?s(re,{color:"action.disabled",children:"Editing strategy:"}):!e&&t?s(re,{color:"error.dark",children:"Editing strategy:"}):e&&!t?s(re,{color:"success.dark",children:"Editing strategy:"}):s(re,{children:"Editing strategy:"}),UDe=({actions:e,change:t,featureName:n,environmentName:r,projectId:o})=>{var c,u,d,p,f;const i=$De(t,o,n,r),l=(t.action==="addStrategy"||t.action==="updateStrategy")&&t.payload.variants?S(BDe,{children:[s(FDe,{children:"Updating feature variants to:"}),s(a7,{variants:t.payload.variants})]}):null;return S(ce,{children:[t.action==="addStrategy"&&S(ce,{children:[S(FO,{children:[S(dS,{children:[s(re,{color:(c=t.payload)!=null&&c.disabled?"action.disabled":"success.dark",children:"+ Adding strategy:"}),s(lS,{change:t,children:s(sS,{change:t,currentStrategy:i})}),s("div",{children:s(zO,{disabled:!0,show:((u=t.payload)==null?void 0:u.disabled)===!0})})]}),s("div",{children:e})]}),s(SC,{strategy:t.payload}),l]}),t.action==="deleteStrategy"&&S(Zk,{children:[S(dS,{children:[s(re,{sx:h=>({color:h.palette.error.main}),children:"- Deleting strategy:"}),zDe(t.payload)&&s(lS,{change:t,children:s(sS,{change:t,currentStrategy:i})})]}),s("div",{children:e})]}),t.action==="updateStrategy"&&S(ce,{children:[S(FO,{children:[S(dS,{children:[s(jDe,{wasDisabled:i==null?void 0:i.disabled,willBeDisabled:(d=t.payload)==null?void 0:d.disabled}),s(lS,{change:t,previousTitle:i==null?void 0:i.title,children:s(sS,{change:t,currentStrategy:i})})]}),s("div",{children:e})]}),s(V,{condition:((p=t.payload)==null?void 0:p.disabled)!==(i==null?void 0:i.disabled),show:S(re,{sx:{marginTop:h=>h.spacing(2),marginBottom:h=>h.spacing(2),...Fc,gap:h=>h.spacing(1)},children:["This strategy will be"," ",s(zO,{disabled:((f=t.payload)==null?void 0:f.disabled)||!1})]})}),s(SC,{strategy:t.payload}),l]})]})},WDe=({enabled:e,actions:t})=>S(Zk,{children:[S(fe,{sx:{display:"flex",alignItems:"center"},children:["New status:"," ",s(zt,{sx:n=>({marginLeft:n.spacing(1)}),color:e?"success":"error",children:e?" Enabled":"Disabled"})]}),t]}),HDe=x("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),jO=e=>e.reduce((t,{name:n,...r})=>({...t,[n]:r}),{}),VDe=({preData:e,data:t})=>s(HDe,{children:s(Xd,{entry:{preData:jO(e),data:jO(t)},sort:(n,r)=>n.index-r.index})}),GDe=x(fe)({display:"flex",flexDirection:"column"}),qDe=x(fe)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2),lineHeight:e.spacing(3)})),KDe=x("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",alignItems:"center",gap:e.spacing(1.5),marginBottom:e.spacing(.5),fontSize:e.fontSizes.smallBody})),YDe=({feature:e,project:t,environment:n,change:r,actions:o})=>{var l,c;const{feature:i}=Ja(t,e),a=((l=i.environments.find(({name:u})=>n===u))==null?void 0:l.variants)??[];return S(GDe,{children:[S(qDe,{children:[s(Uc,{tooltip:s(VDe,{preData:a,data:r.payload.variants}),tooltipProps:{maxWidth:500,maxHeight:600},children:"Updating variants to:"}),o]}),s(a7,{variants:r.payload.variants}),s(V,{condition:r.payload.variants.length>1,show:s(ce,{children:S(KDe,{children:[s("p",{children:"Stickiness:"}),s(zt,{children:((c=r.payload.variants[0])==null?void 0:c.stickiness)||"default"})]})})})]})},XDe=x("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),JDe=({preData:e,data:t})=>s(XDe,{children:s(Xd,{entry:{preData:e.strategyIds,data:t.strategyIds},sort:(n,r)=>n.index-r.index})}),QDe=x(fe)({display:"flex",flexDirection:"column"}),ZDe=x(fe)(({theme:e})=>({display:"flex",justifyContent:"space-between",flexDirection:"row",alignItems:"start",marginBottom:e.spacing(2),lineHeight:e.spacing(3)})),e9e=x(fe)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"flex-start",lineHeight:e.spacing(3),gap:e.spacing(2.5),marginBottom:e.spacing(1)})),t9e=x("div")({flexDirection:"row",width:"100%"}),n9e=({feature:e,environment:t,change:n,project:r,actions:o})=>{const{feature:i,loading:a}=Ja(r,e);if(a)return null;const l=i.environments.find(({name:f})=>t===f),c=(l==null?void 0:l.strategies)||[],u={strategyIds:c.sort((f,h)=>typeof f.sortOrder=="number"&&typeof h.sortOrder=="number"?f.sortOrder-h.sortOrder:0).map(f=>f.id)??[]},d=n.payload.map(({id:f})=>c.find(h=>h.id===f)).filter(Boolean),p={strategyIds:d.map(f=>f.id)};return S(QDe,{children:[S(ZDe,{children:[s(Uc,{tooltip:s(JDe,{preData:u,data:p}),tooltipProps:{maxWidth:500,maxHeight:600},children:"Updating strategy execution order to:"}),o]}),s(e9e,{children:d.map((f,h)=>S(t9e,{children:[`${h+1}: `,ks((f==null?void 0:f.name)||""),(f==null?void 0:f.title)&&` - ${f.title}`,s(SC,{strategy:f})]}))})]})},r9e=x(fe)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.error.main})),o9e=({actions:e})=>S(Zk,{children:[s(r9e,{children:"Archiving feature"}),e]}),i9e=x(fe,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$hasConflict:t,$isInConflictFeature:n,$isAfterWarning:r,$isLast:o})=>({borderLeft:"1px solid",borderRight:"1px solid",borderTop:"1px solid",borderBottom:o?"1px solid":"none",borderRadius:o?`0 0
394
+ `))||""},{Header:"Weight",accessor:"weight",Cell:({row:{original:{name:b,weight:v}}})=>S(zn,{"data-testid":`VARIANT_WEIGHT_${b}`,children:[Uxe(v)," %"]}),sortType:"number"},{Header:"Type",accessor:b=>b.weightType==="fix"?"Fixed":"Variable",Cell:zn,sortType:"alphanumeric"}],[n,e]),l=g.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{data:c,getSearchText:u}=lg(a,t,e),{getTableProps:d,getTableBodyProps:p,headerGroups:f,rows:h,prepareRow:m,setHiddenColumns:y}=nn.useTable({columns:a,data:c,initialState:l,sortTypes:li,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},nn.useSortBy);return Md([{condition:o,columns:["payload","overrides"]},{condition:i,columns:["weightType"]}],y,a),S(ce,{children:[s(ts,{value:u(t),children:S(da,{...d(),children:[s(ua,{headerGroups:f}),s(la,{...p(),children:h.map(b=>(m(b),s(Fi,{hover:!0,...b.getRowProps(),children:b.cells.map(v=>s(Ui,{...v.getCellProps(),children:v.render("Cell")}))})))})]})}),s(V,{condition:h.length===0,show:s(V,{condition:(t==null?void 0:t.length)>0,show:S(Fr,{children:["No variants found matching “",t,"”"]})})})]})},Zk=x(fe)({display:"flex",justifyContent:"space-between",alignItems:"center"}),FO=x(fe)(({theme:e})=>({display:"grid",gridTemplateColumns:"auto auto",justifyContent:"space-between",gap:e.spacing(1),alignItems:"center",marginBottom:e.spacing(2),width:"100%"})),dS=x(fe)(({theme:e})=>({display:"grid",gridTemplateColumns:"150px auto",gridAutoFlow:"column",alignItems:"center",flexGrow:1,gap:e.spacing(1)})),BDe=x(fe)(({theme:e})=>({marginTop:e.spacing(2)})),FDe=x(re)(({theme:e})=>({margin:`${e.spacing(1)} 0`})),zDe=e=>typeof e=="object"&&e!==null&&"name"in e,zO=({show:e=!0,disabled:t})=>e?t?s(wt,{title:"This strategy will not be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:s(zt,{color:"disabled",icon:s(V8,{}),children:"Disabled"})}):s(wt,{title:"This was disabled before and with this change it will be taken into account when evaluating feature toggle.",arrow:!0,sx:{cursor:"pointer"},children:s(zt,{color:"success",icon:s(G8,{}),children:"Enabled"})}):null,jDe=({wasDisabled:e=!1,willBeDisabled:t=!1})=>e&&t?s(re,{color:"action.disabled",children:"Editing strategy:"}):!e&&t?s(re,{color:"error.dark",children:"Editing strategy:"}):e&&!t?s(re,{color:"success.dark",children:"Editing strategy:"}):s(re,{children:"Editing strategy:"}),UDe=({actions:e,change:t,featureName:n,environmentName:r,projectId:o})=>{var c,u,d,p,f;const i=$De(t,o,n,r),l=(t.action==="addStrategy"||t.action==="updateStrategy")&&t.payload.variants&&t.payload.variants.length>0?S(BDe,{children:[s(FDe,{children:"Updating feature variants to:"}),s(a7,{variants:t.payload.variants})]}):null;return S(ce,{children:[t.action==="addStrategy"&&S(ce,{children:[S(FO,{children:[S(dS,{children:[s(re,{color:(c=t.payload)!=null&&c.disabled?"action.disabled":"success.dark",children:"+ Adding strategy:"}),s(lS,{change:t,children:s(sS,{change:t,currentStrategy:i})}),s("div",{children:s(zO,{disabled:!0,show:((u=t.payload)==null?void 0:u.disabled)===!0})})]}),s("div",{children:e})]}),s(SC,{strategy:t.payload}),l]}),t.action==="deleteStrategy"&&S(Zk,{children:[S(dS,{children:[s(re,{sx:h=>({color:h.palette.error.main}),children:"- Deleting strategy:"}),zDe(t.payload)&&s(lS,{change:t,children:s(sS,{change:t,currentStrategy:i})})]}),s("div",{children:e})]}),t.action==="updateStrategy"&&S(ce,{children:[S(FO,{children:[S(dS,{children:[s(jDe,{wasDisabled:i==null?void 0:i.disabled,willBeDisabled:(d=t.payload)==null?void 0:d.disabled}),s(lS,{change:t,previousTitle:i==null?void 0:i.title,children:s(sS,{change:t,currentStrategy:i})})]}),s("div",{children:e})]}),s(V,{condition:((p=t.payload)==null?void 0:p.disabled)!==(i==null?void 0:i.disabled),show:S(re,{sx:{marginTop:h=>h.spacing(2),marginBottom:h=>h.spacing(2),...Fc,gap:h=>h.spacing(1)},children:["This strategy will be"," ",s(zO,{disabled:((f=t.payload)==null?void 0:f.disabled)||!1})]})}),s(SC,{strategy:t.payload}),l]})]})},WDe=({enabled:e,actions:t})=>S(Zk,{children:[S(fe,{sx:{display:"flex",alignItems:"center"},children:["New status:"," ",s(zt,{sx:n=>({marginLeft:n.spacing(1)}),color:e?"success":"error",children:e?" Enabled":"Disabled"})]}),t]}),HDe=x("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),jO=e=>e.reduce((t,{name:n,...r})=>({...t,[n]:r}),{}),VDe=({preData:e,data:t})=>s(HDe,{children:s(Xd,{entry:{preData:jO(e),data:jO(t)},sort:(n,r)=>n.index-r.index})}),GDe=x(fe)({display:"flex",flexDirection:"column"}),qDe=x(fe)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2),lineHeight:e.spacing(3)})),KDe=x("div")(({theme:e})=>({marginTop:e.spacing(1.5),display:"flex",alignItems:"center",gap:e.spacing(1.5),marginBottom:e.spacing(.5),fontSize:e.fontSizes.smallBody})),YDe=({feature:e,project:t,environment:n,change:r,actions:o})=>{var l,c;const{feature:i}=Ja(t,e),a=((l=i.environments.find(({name:u})=>n===u))==null?void 0:l.variants)??[];return S(GDe,{children:[S(qDe,{children:[s(Uc,{tooltip:s(VDe,{preData:a,data:r.payload.variants}),tooltipProps:{maxWidth:500,maxHeight:600},children:"Updating variants to:"}),o]}),s(a7,{variants:r.payload.variants}),s(V,{condition:r.payload.variants.length>1,show:s(ce,{children:S(KDe,{children:[s("p",{children:"Stickiness:"}),s(zt,{children:((c=r.payload.variants[0])==null?void 0:c.stickiness)||"default"})]})})})]})},XDe=x("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),JDe=({preData:e,data:t})=>s(XDe,{children:s(Xd,{entry:{preData:e.strategyIds,data:t.strategyIds},sort:(n,r)=>n.index-r.index})}),QDe=x(fe)({display:"flex",flexDirection:"column"}),ZDe=x(fe)(({theme:e})=>({display:"flex",justifyContent:"space-between",flexDirection:"row",alignItems:"start",marginBottom:e.spacing(2),lineHeight:e.spacing(3)})),e9e=x(fe)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"flex-start",lineHeight:e.spacing(3),gap:e.spacing(2.5),marginBottom:e.spacing(1)})),t9e=x("div")({flexDirection:"row",width:"100%"}),n9e=({feature:e,environment:t,change:n,project:r,actions:o})=>{const{feature:i,loading:a}=Ja(r,e);if(a)return null;const l=i.environments.find(({name:f})=>t===f),c=(l==null?void 0:l.strategies)||[],u={strategyIds:c.sort((f,h)=>typeof f.sortOrder=="number"&&typeof h.sortOrder=="number"?f.sortOrder-h.sortOrder:0).map(f=>f.id)??[]},d=n.payload.map(({id:f})=>c.find(h=>h.id===f)).filter(Boolean),p={strategyIds:d.map(f=>f.id)};return S(QDe,{children:[S(ZDe,{children:[s(Uc,{tooltip:s(JDe,{preData:u,data:p}),tooltipProps:{maxWidth:500,maxHeight:600},children:"Updating strategy execution order to:"}),o]}),s(e9e,{children:d.map((f,h)=>S(t9e,{children:[`${h+1}: `,ks((f==null?void 0:f.name)||""),(f==null?void 0:f.title)&&` - ${f.title}`,s(SC,{strategy:f})]}))})]})},r9e=x(fe)(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.error.main})),o9e=({actions:e})=>S(Zk,{children:[s(r9e,{children:"Archiving feature"}),e]}),i9e=x(fe,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$hasConflict:t,$isInConflictFeature:n,$isAfterWarning:r,$isLast:o})=>({borderLeft:"1px solid",borderRight:"1px solid",borderTop:"1px solid",borderBottom:o?"1px solid":"none",borderRadius:o?`0 0
395
395
  ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`:0,borderColor:t||n?e.palette.warning.border:e.palette.divider,borderTopColor:(t||r)&&!n?e.palette.warning.border:e.palette.divider})),a9e=x(Bt)(({theme:e})=>({borderRadius:0,padding:e.spacing(0,2),"&.MuiAlert-standardWarning":{borderStyle:"none none solid none"}})),UO=({index:e,change:t,feature:n,changeRequest:r,actions:o})=>{var a;const i=n.defaultChange?n.changes.length+1:n.changes.length;return S(i9e,{$hasConflict:!!t.conflict,$isInConflictFeature:!!n.conflict,$isAfterWarning:!!((a=n.changes[e-1])!=null&&a.conflict),$isLast:e+1===i,children:[s(V,{condition:!!t.conflict&&!n.conflict,show:S(a9e,{severity:"warning",children:[s("strong",{children:"Conflict!"})," This change can’t be applied."," ",t.conflict,"."]})}),S(fe,{sx:l=>({padding:l.spacing(3)}),children:[t.action==="updateEnabled"&&s(WDe,{enabled:t.payload.enabled,actions:o}),t.action==="archiveFeature"&&s(o9e,{actions:o}),t.action==="addStrategy"||t.action==="deleteStrategy"||t.action==="updateStrategy"?s(UDe,{actions:o,change:t,featureName:n.name,environmentName:r.environment,projectId:r.project}):null,t.action==="patchVariant"&&s(YDe,{feature:n.name,project:r.project,environment:r.environment,change:t,actions:o}),t.action==="reorderStrategy"&&s(n9e,{feature:n.name,project:r.project,environment:r.environment,change:t,actions:o})]})]},LB(t))},eA=e=>e.features.flatMap(t=>t.changes).length+e.segments.length,s9e=({change:e,changeRequestId:t,environment:n,open:r,onSubmit:o,onClose:i,featureId:a})=>{const l=lr("projectId"),{editChange:c}=Jd(),[u,d]=g.useState(e.payload),{segments:p}=Ll(),f=(p||[]).filter(B=>{var q;return(q=e.payload.segments)==null?void 0:q.includes(B.id)}),[h,m]=g.useState(f),y={parameters:e.payload.parameters,name:e.payload.name},{setToastData:b,setToastApiError:v}=Ot(),w=KB(),{uiConfig:C}=St(),{unleashUrl:k}=C,{isChangeRequestConfigured:A}=jc(l),{feature:T,refetchFeature:_}=Ja(l,a),P=g.useRef(T),{data:I,staleDataNotification:O,forceRefreshCache:$}=XB({unleashGetter:Ja,params:[l,a],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},T,{afterSubmitAction:_},JB);g.useEffect(()=>{P.current.name===""&&T.name&&($(T),P.current=T)},[T]);const F={...u,segments:h.map(B=>B.id)},D=async()=>{try{await c(l,t,e.id,{action:u.id?"updateStrategy":"addStrategy",feature:a,payload:F}),o(),b({title:"Change updated",type:"success"})}catch(B){v(gt(B))}};return!y||!I?null:s(wg,{open:r,onClose:i,label:"Edit change",onClick:B=>{B.stopPropagation()},children:S(Er,{modal:!0,title:ks(y.name??""),description:c9e,documentationLink:u9e,documentationLinkLabel:d9e,formatApiCode:()=>l9e(l,t,e.id,F,k),children:[s(qB,{projectId:l,feature:I,strategy:u,setStrategy:d,segments:h,setSegments:m,environmentId:n,onSubmit:D,onCancel:i,loading:!1,permission:H1,errors:w,isChangeRequest:A(n)}),O]})})},l9e=(e,t,n,r,o)=>{if(!o)return"";const i=`${o}/api/admin/projects/${e}/change-requests/${t}/changes/${n}`,a=JSON.stringify(r,void 0,2);return`curl --location --request PUT '${i}' \\
396
396
  --header 'Authorization: INSERT_API_KEY' \\
397
397
  --header 'Content-Type: application/json' \\