unleash-server 6.0.0 → 6.0.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 (37) hide show
  1. package/dist/lib/features/feature-lifecycle/feature-lifecycle-service.d.ts.map +1 -1
  2. package/dist/lib/features/feature-lifecycle/feature-lifecycle-service.js +1 -1
  3. package/dist/lib/features/feature-lifecycle/feature-lifecycle-service.js.map +1 -1
  4. package/dist/lib/features/feature-lifecycle/feature-lifecycle-service.test.js +2 -2
  5. package/dist/lib/features/feature-lifecycle/feature-lifecycle-service.test.js.map +1 -1
  6. package/dist/lib/features/feature-lifecycle/feature-lifecycle.e2e.test.js +3 -3
  7. package/dist/lib/features/feature-lifecycle/feature-lifecycle.e2e.test.js.map +1 -1
  8. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.d.ts +1 -1
  9. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.d.ts.map +1 -1
  10. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.js +2 -0
  11. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.js.map +1 -1
  12. package/dist/lib/types/events.d.ts +1 -0
  13. package/dist/lib/types/events.d.ts.map +1 -1
  14. package/dist/lib/types/events.js +5 -4
  15. package/dist/lib/types/events.js.map +1 -1
  16. package/frontend/build/index.html +1 -1
  17. package/frontend/build/static/{AdvancedPlayground-DIV201O4.js → AdvancedPlayground-p7tDUOqb.js} +1 -1
  18. package/frontend/build/static/{CheckCircleOutline-DDRfoMo-.js → CheckCircleOutline-CZoWHYza.js} +1 -1
  19. package/frontend/build/static/{CreateProject-CP51S2Nl.js → CreateProject-DhmoT0x8.js} +1 -1
  20. package/frontend/build/static/{FeatureMetricsChart-C22E7CHm.js → FeatureMetricsChart-CrJhmvRS.js} +1 -1
  21. package/frontend/build/static/{FeatureStaleDialog-CYuAeCFM.js → FeatureStaleDialog-z-UTple3.js} +1 -1
  22. package/frontend/build/static/{FeatureViewLazyExport-Bk1x90Kb.js → FeatureViewLazyExport-BOJHJp48.js} +2 -2
  23. package/frontend/build/static/{LazyAdminExport-Bq-oujr9.js → LazyAdminExport-BfaFcAaS.js} +2 -2
  24. package/frontend/build/static/{LazyProjectExport-DkbRhMrD.js → LazyProjectExport-DbkNqnlj.js} +13 -13
  25. package/frontend/build/static/{LineChartComponent-DvXrMkk5.js → LineChartComponent-CLaoKci9.js} +1 -1
  26. package/frontend/build/static/{NetworkOverview-D6owvVGW.js → NetworkOverview-Cq83oqfi.js} +1 -1
  27. package/frontend/build/static/{NetworkTraffic-D1BTTyb9.js → NetworkTraffic-Bt6v3FUz.js} +1 -1
  28. package/frontend/build/static/{NetworkTrafficUsage-BzhZdcFn.js → NetworkTrafficUsage-Dv8h54l9.js} +1 -1
  29. package/frontend/build/static/{ProjectForm-DAM_SI2w.js → ProjectForm-CrLtsMQu.js} +1 -1
  30. package/frontend/build/static/{ReactJSONEditor-DDbLRmis.js → ReactJSONEditor-C-nON7ak.js} +1 -1
  31. package/frontend/build/static/{RoleCell-C3ZKNTZg.js → RoleCell-6hhnTvjl.js} +1 -1
  32. package/frontend/build/static/{StrategyItemContainer-HujAs_3i.js → StrategyItemContainer-BDY93O1W.js} +1 -1
  33. package/frontend/build/static/{index-C5Of-pcr.js → index-DZdOsPxT.js} +1 -1
  34. package/frontend/build/static/{index-CamDenZi.js → index-lGwH-xa2.js} +6 -6
  35. package/frontend/build/static/{unknownify-Cate6SHg.js → unknownify-D-iKcXLX.js} +1 -1
  36. package/frontend/build/static/{useApiTokens-DSkTQEX_.js → useApiTokens-BhaMXLXr.js} +1 -1
  37. package/package.json +1 -1
@@ -342,7 +342,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
342
342
  development or test environment without
343
343
  enabling the feature flag in the
344
344
  production environment.`,documentationLink:"https://docs.getunleash.io/reference/environments",documentationLinkLabel:"Environments documentation",formatApiCode:v,children:a.jsx(pK,{handleSubmit:x,handleCancel:y,name:l,type:c,setName:u,setType:d,mode:"Edit",errors:f,clearErrors:p,children:a.jsx(_g,{permission:Qo})})})},xC=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0}),o="api/admin/context";return{createContext:async u=>{const f=t(o,{method:"POST",body:JSON.stringify(u)});return e(f.caller,f.id)},validateContextName:async u=>{const d=`${o}/validate`,f=t(d,{method:"POST",body:JSON.stringify({name:u})});return e(f.caller,f.id)},updateContext:async u=>{const d=`${o}/${u.name}`,f=t(d,{method:"PUT",body:JSON.stringify(u)});return e(f.caller,f.id)},removeContext:async u=>{const d=`${o}/${u}`,f=t(d,{method:"DELETE"});return e(f.caller,f.id)},errors:n,loading:r}},dze=(e,t={})=>{const n=async()=>{const u=Ot(`api/admin/context/${e}`);return fetch(u,{method:"GET"}).then(fn("Context data")).then(d=>d.json())},r=`api/admin/context/${e}`,{data:o,error:i}=Pn(r,n,{...t}),[s,l]=m.useState(!i&&!o),c=()=>{Po(r)};return m.useEffect(()=>{l(!i&&!o)},[o,i]),{context:o||{name:"",description:"",legalValues:[],stickiness:!1},error:i,loading:s,refetch:c,FEATURE_CACHE_KEY:r}};var SP={},fze=ze;Object.defineProperty(SP,"__esModule",{value:!0});var hK=SP.default=void 0,pze=fze(He()),hze=a,gze=(0,pze.default)((0,hze.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),"Cancel");hK=SP.default=gze;const mze=b("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"})),vze=b("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),yze=b("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),xze=b("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}})),bze=({label:e,description:t,onRemove:n})=>a.jsxs(mze,{children:[a.jsxs("div",{children:[a.jsx(vze,{children:e}),a.jsx(W,{condition:!!t,show:()=>a.jsx(yze,{children:t})})]}),a.jsx(xze,{onClick:n,children:a.jsx(hK,{titleAccess:"Remove"})})]}),wze=b("ul")(({theme:e})=>({listStyleType:"none",display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:e.spacing(2),margin:0,marginBottom:"1rem !important",maxHeight:"412px",overflow:"auto",borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`,"&:empty":{display:"none"}})),Sze=wze,O9=e=>{const t=new URLSearchParams(window.location.search).get(e);if(!t)throw new Error(`Missing required query param: ${e}`);return t},Cze=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{addStrategyToFeature:async(u,d,f,p)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${f}/strategies`,g=t(h,{method:"POST",body:JSON.stringify(p)},"addStrategyToFeature");return(await e(g.caller,g.id)).json()},updateStrategyOnFeature:async(u,d,f,p,h)=>{const g=`api/admin/projects/${u}/features/${d}/environments/${f}/strategies/${p}`,v=t(g,{method:"PUT",body:JSON.stringify(h)},"updateStrategyOnFeature");await e(v.caller,v.id)},deleteStrategyFromFeature:async(u,d,f,p)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${f}/strategies/${p}`,g=t(h,{method:"DELETE"},"deleteStrategyFromFeature");await e(g.caller,g.id)},setStrategiesSortOrder:async(u,d,f,p)=>{const h=`api/admin/projects/${u}/features/${d}/environments/${f}/strategies/set-sort-order`,g=t(h,{method:"POST",body:JSON.stringify(p)},"setStrategiesSortOrderOnFeature");await e(g.caller,g.id)},setStrategyDisabledState:async(u,d,f,p,h)=>{const g=`api/admin/projects/${u}/features/${d}/environments/${f}/strategies/${p}`,v=t(g,{method:"PATCH",body:JSON.stringify([{path:"/disabled",value:h,op:"replace"}])},"setStrategyDisabledState");await e(v.caller,v.id)},loading:r,errors:n}};function Ia(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 Vh(e){return!!e&&!!e[js]}function Nf(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)===Pze}(e)||Array.isArray(e)||!!e[B9]||!!(!((t=e.constructor)===null||t===void 0)&&t[B9])||CP(e)||jP(e))}function h0(e,t,n){n===void 0&&(n=!1),Rg(e)===0?(n?Object.keys:RP)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,o){return t(o,r,e)})}function Rg(e){var t=e[js];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:CP(e)?2:jP(e)?3:0}function g_(e,t){return Rg(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function jze(e,t){return Rg(e)===2?e.get(t):e[t]}function gK(e,t,n){var r=Rg(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Eze(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function CP(e){return Rze&&e instanceof Map}function jP(e){return Aze&&e instanceof Set}function qd(e){return e.o||e.t}function EP(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Oze(e);delete t[js];for(var n=RP(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 TP(e,t){return t===void 0&&(t=!1),kP(e)||Vh(e)||!Nf(e)||(Rg(e)>1&&(e.set=e.add=e.clear=e.delete=Tze),Object.freeze(e),t&&h0(e,function(n,r){return TP(r,!0)},!0)),e}function Tze(){Ia(2)}function kP(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Il(e){var t=$ze[e];return t||Ia(18,e),t}function $9(){return g0}function aE(e,t){t&&(Il("Patches"),e.u=[],e.s=[],e.v=t)}function Mb(e){m_(e),e.p.forEach(kze),e.p=null}function m_(e){e===g0&&(g0=e.l)}function I9(e){return g0={p:[],l:g0,h:e,m:!0,_:0}}function kze(e){var t=e[js];t.i===0||t.i===1?t.j():t.g=!0}function lE(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||Il("ES5").S(t,e,r),r?(n[js].P&&(Mb(t),Ia(4)),Nf(e)&&(e=Db(t,e),t.l||Lb(t,e)),t.u&&Il("Patches").M(n[js].t,e,t.u,t.s)):e=Db(t,n,[]),Mb(t),t.u&&t.v(t.u,t.s),e!==mK?e:void 0}function Db(e,t,n){if(kP(t))return t;var r=t[js];if(!r)return h0(t,function(l,c){return M9(e,r,t,l,c,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Lb(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=r.i===4||r.i===5?r.o=EP(r.k):r.o,i=o,s=!1;r.i===3&&(i=new Set(o),o.clear(),s=!0),h0(i,function(l,c){return M9(e,r,o,l,c,n,s)}),Lb(e,o,!1),n&&e.u&&Il("Patches").N(r,n,e.u,e.s)}return r.o}function M9(e,t,n,r,o,i,s){if(Vh(o)){var l=Db(e,o,i&&t&&t.i!==3&&!g_(t.R,r)?i.concat(r):void 0);if(gK(n,r,l),!Vh(l))return;e.m=!1}else s&&n.add(o);if(Nf(o)&&!kP(o)){if(!e.h.D&&e._<1)return;Db(e,o),t&&t.A.l||Lb(e,o)}}function Lb(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&TP(t,n)}function cE(e,t){var n=e[js];return(n?qd(n):e)[t]}function D9(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 v_(e){e.P||(e.P=!0,e.l&&v_(e.l))}function uE(e){e.o||(e.o=EP(e.t))}function y_(e,t,n){var r=CP(t)?Il("MapSet").F(t,n):jP(t)?Il("MapSet").T(t,n):e.O?function(o,i){var s=Array.isArray(o),l={i:s?1:0,A:i?i.A:$9(),P:!1,I:!1,R:{},l:i,t:o,k:null,o:null,j:null,C:!1},c=l,u=x_;s&&(c=[l],u=qm);var d=Proxy.revocable(c,u),f=d.revoke,p=d.proxy;return l.k=p,l.j=f,p}(t,n):Il("ES5").J(t,n);return(n?n.A:$9()).p.push(r),r}function _ze(e){return Vh(e)||Ia(22,e),function t(n){if(!Nf(n))return n;var r,o=n[js],i=Rg(n);if(o){if(!o.P&&(o.i<4||!Il("ES5").K(o)))return o.t;o.I=!0,r=L9(n,i),o.I=!1}else r=L9(n,i);return h0(r,function(s,l){o&&jze(o.t,s)===l||gK(r,s,t(l))}),i===3?new Set(r):r}(e)}function L9(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return EP(e)}var N9,g0,_P=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Rze=typeof Map<"u",Aze=typeof Set<"u",F9=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",mK=_P?Symbol.for("immer-nothing"):((N9={})["immer-nothing"]=!0,N9),B9=_P?Symbol.for("immer-draftable"):"__$immer_draftable",js=_P?Symbol.for("immer-state"):"__$immer_state",Pze=""+Object.prototype.constructor,RP=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Oze=Object.getOwnPropertyDescriptors||function(e){var t={};return RP(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},$ze={},x_={get:function(e,t){if(t===js)return e;var n=qd(e);if(!g_(n,t))return function(o,i,s){var l,c=D9(i,s);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||!Nf(r)?r:r===cE(e.t,t)?(uE(e),e.o[t]=y_(e.A.h,r,e)):r},has:function(e,t){return t in qd(e)},ownKeys:function(e){return Reflect.ownKeys(qd(e))},set:function(e,t,n){var r=D9(qd(e),t);if(r!=null&&r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=cE(qd(e),t),i=o==null?void 0:o[js];if(i&&i.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(Eze(n,o)&&(n!==void 0||g_(e.t,t)))return!0;uE(e),v_(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 cE(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,uE(e),v_(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=qd(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){Ia(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Ia(12)}},qm={};h0(x_,function(e,t){qm[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),qm.deleteProperty=function(e,t){return qm.set.call(this,e,t,void 0)},qm.set=function(e,t,n){return x_.set.call(this,e[0],t,n,e[0])};var Ize=function(){function e(n){var r=this;this.O=F9,this.D=!0,this.produce=function(o,i,s){if(typeof o=="function"&&typeof i!="function"){var l=i;i=o;var c=r;return function(v){var x=this;v===void 0&&(v=l);for(var y=arguments.length,w=Array(y>1?y-1:0),S=1;S<y;S++)w[S-1]=arguments[S];return c.produce(v,function(C){var E;return(E=i).call.apply(E,[x,C].concat(w))})}}var u;if(typeof i!="function"&&Ia(6),s!==void 0&&typeof s!="function"&&Ia(7),Nf(o)){var d=I9(r),f=y_(r,o,void 0),p=!0;try{u=i(f),p=!1}finally{p?Mb(d):m_(d)}return typeof Promise<"u"&&u instanceof Promise?u.then(function(v){return aE(d,s),lE(v,d)},function(v){throw Mb(d),v}):(aE(d,s),lE(u,d))}if(!o||typeof o!="object"){if((u=i(o))===void 0&&(u=o),u===mK&&(u=void 0),r.D&&TP(u,!0),s){var h=[],g=[];Il("Patches").M(o,u,h,g),s(h,g)}return u}Ia(21,o)},this.produceWithPatches=function(o,i){if(typeof o=="function")return function(u){for(var d=arguments.length,f=Array(d>1?d-1:0),p=1;p<d;p++)f[p-1]=arguments[p];return r.produceWithPatches(u,function(h){return o.apply(void 0,[h].concat(f))})};var s,l,c=r.produce(o,i,function(u,d){s=u,l=d});return typeof Promise<"u"&&c instanceof Promise?c.then(function(u){return[u,s,l]}):[c,s,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){Nf(n)||Ia(8),Vh(n)&&(n=_ze(n));var r=I9(this),o=y_(this,n,void 0);return o[js].C=!0,m_(r),o},t.finishDraft=function(n,r){var o=n&&n[js],i=o.A;return aE(i,r),lE(void 0,i)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!F9&&Ia(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 s=Il("Patches").$;return Vh(n)?s(n,r):this.produce(n,function(l){return s(l,r)})},e}(),Es=new Ize,_i=Es.produce;Es.produceWithPatches.bind(Es);Es.setAutoFreeze.bind(Es);Es.setUseProxies.bind(Es);Es.applyPatches.bind(Es);Es.createDraft.bind(Es);Es.finishDraft.bind(Es);const vK=()=>{const[e,t]=m.useState({}),n=m.useCallback(s=>e[s],[e]),r=m.useCallback((s,l)=>{t(_i(c=>{c[s]=l}))},[t]),o=m.useCallback(s=>{t(_i(l=>{delete l[s]}))},[t]),i=m.useCallback(()=>Object.values(e).some(Boolean),[e]);return{getFormError:n,setFormError:r,removeFormError:o,hasFormErrors:i}},AP=e=>{const{data:t,error:n,mutate:r}=Pn(e?Ot(`api/admin/strategies/${e}`):null,Mze),o=m.useCallback(()=>{r().catch(console.warn)},[r]);return{strategyDefinition:t,refetchStrategy:o,loading:!n&&!t,error:n}},Mze=e=>fetch(e).then(fn("Strategy")).then(t=>t.json()),Dze=(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 z9=Object.prototype.hasOwnProperty;function H9(e,t,n){for(n of e.keys())if(Tv(n,t))return n}function Tv(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--&&Tv(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=H9(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=H9(t,o),!o)||!Tv(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(z9.call(e,n)&&++r&&!z9.call(t,n)||!(n in t)||!Tv(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var yK={exports:{}};(function(e,t){(function(n,r){var o=r(n);e.exports=o})(ro,function(n){var r=["N","E","A","D"];function o(T,_){T.super_=_,T.prototype=Object.create(_.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}})}function i(T,_){Object.defineProperty(this,"kind",{value:T,enumerable:!0}),_&&_.length&&Object.defineProperty(this,"path",{value:_,enumerable:!0})}function s(T,_,A){s.super_.call(this,"E",T),Object.defineProperty(this,"lhs",{value:_,enumerable:!0}),Object.defineProperty(this,"rhs",{value:A,enumerable:!0})}o(s,i);function l(T,_){l.super_.call(this,"N",T),Object.defineProperty(this,"rhs",{value:_,enumerable:!0})}o(l,i);function c(T,_){c.super_.call(this,"D",T),Object.defineProperty(this,"lhs",{value:_,enumerable:!0})}o(c,i);function u(T,_,A){u.super_.call(this,"A",T),Object.defineProperty(this,"index",{value:_,enumerable:!0}),Object.defineProperty(this,"item",{value:A,enumerable:!0})}o(u,i);function d(T,_,A){var M=T.slice((A||_)+1||T.length);return T.length=_<0?T.length+_:_,T.push.apply(T,M),T}function f(T){var _=typeof T;return _!=="object"?_:T===Math?"math":T===null?"null":Array.isArray(T)?"array":Object.prototype.toString.call(T)==="[object Date]"?"date":typeof T.toString=="function"&&/^\/.*\//.test(T.toString())?"regexp":"object"}function p(T){var _=0;if(T.length===0)return _;for(var A=0;A<T.length;A++){var M=T.charCodeAt(A);_=(_<<5)-_+M,_=_&_}return _}function h(T){var _=0,A=f(T);if(A==="array"){T.forEach(function(z){_+=h(z)});var M="[type: array, hash: "+_+"]";return _+p(M)}if(A==="object"){for(var I in T)if(T.hasOwnProperty(I)){var P="[ type: object, key: "+I+", value hash: "+h(T[I])+"]";_+=p(P)}return _}var $="[ type: "+A+" ; value: "+T+"]";return _+p($)}function g(T,_,A,M,I,P,$,z){A=A||[],I=I||[],$=$||[];var Y=I.slice(0);if(typeof P<"u"&&P!==null){if(M){if(typeof M=="function"&&M(Y,P))return;if(typeof M=="object"){if(M.prefilter&&M.prefilter(Y,P))return;if(M.normalize){var q=M.normalize(Y,P,T,_);q&&(T=q[0],_=q[1])}}}Y.push(P)}f(T)==="regexp"&&f(_)==="regexp"&&(T=T.toString(),_=_.toString());var G=typeof T,F=typeof _,U,O,L,te,re=G!=="undefined"||$&&$.length>0&&$[$.length-1].lhs&&Object.getOwnPropertyDescriptor($[$.length-1].lhs,P),ue=F!=="undefined"||$&&$.length>0&&$[$.length-1].rhs&&Object.getOwnPropertyDescriptor($[$.length-1].rhs,P);if(!re&&ue)A.push(new l(Y,_));else if(!ue&&re)A.push(new c(Y,T));else if(f(T)!==f(_))A.push(new s(Y,T,_));else if(f(T)==="date"&&T-_!==0)A.push(new s(Y,T,_));else if(G==="object"&&T!==null&&_!==null){for(U=$.length-1;U>-1;--U)if($[U].lhs===T){te=!0;break}if(te)T!==_&&A.push(new s(Y,T,_));else{if($.push({lhs:T,rhs:_}),Array.isArray(T)){for(z&&(T.sort(function(J,oe){return h(J)-h(oe)}),_.sort(function(J,oe){return h(J)-h(oe)})),U=_.length-1,O=T.length-1;U>O;)A.push(new u(Y,U,new l(void 0,_[U--])));for(;O>U;)A.push(new u(Y,O,new c(void 0,T[O--])));for(;U>=0;--U)g(T[U],_[U],A,M,Y,U,$,z)}else{var ve=Object.keys(T),Ce=Object.keys(_);for(U=0;U<ve.length;++U)L=ve[U],te=Ce.indexOf(L),te>=0?(g(T[L],_[L],A,M,Y,L,$,z),Ce[te]=null):g(T[L],void 0,A,M,Y,L,$,z);for(U=0;U<Ce.length;++U)L=Ce[U],L&&g(void 0,_[L],A,M,Y,L,$,z)}$.length=$.length-1}}else T!==_&&(G==="number"&&isNaN(T)&&isNaN(_)||A.push(new s(Y,T,_)))}function v(T,_,A,M,I){var P=[];if(g(T,_,P,M,null,null,null,I),A)for(var $=0;$<P.length;++$)A(P[$]);return P}function x(T,_,A,M,I,P,$){return g(T,_,A,M,I,P,$,!0)}function y(T,_,A,M){var I=M?function($){$&&M.push($)}:void 0,P=v(T,_,I,A);return M||(P.length?P:void 0)}function w(T,_,A,M){var I=M?function($){$&&M.push($)}:void 0,P=v(T,_,I,A,!0);return M||(P.length?P:void 0)}function S(T,_,A){if(A.path&&A.path.length){var M=T[_],I,P=A.path.length-1;for(I=0;I<P;I++)M=M[A.path[I]];switch(A.kind){case"A":S(M[A.path[I]],A.index,A.item);break;case"D":delete M[A.path[I]];break;case"E":case"N":M[A.path[I]]=A.rhs;break}}else switch(A.kind){case"A":S(T[_],A.index,A.item);break;case"D":T=d(T,_);break;case"E":case"N":T[_]=A.rhs;break}return T}function C(T,_,A){if(typeof A>"u"&&_&&~r.indexOf(_.kind)&&(A=_),T&&A&&A.kind){for(var M=T,I=-1,P=A.path?A.path.length-1:0;++I<P;)typeof M[A.path[I]]>"u"&&(M[A.path[I]]=typeof A.path[I+1]<"u"&&typeof A.path[I+1]=="number"?[]:{}),M=M[A.path[I]];switch(A.kind){case"A":A.path&&typeof M[A.path[I]]>"u"&&(M[A.path[I]]=[]),S(A.path?M[A.path[I]]:M,A.index,A.item);break;case"D":delete M[A.path[I]];break;case"E":case"N":M[A.path[I]]=A.rhs;break}}}function E(T,_,A){if(A.path&&A.path.length){var M=T[_],I,P=A.path.length-1;for(I=0;I<P;I++)M=M[A.path[I]];switch(A.kind){case"A":E(M[A.path[I]],A.index,A.item);break;case"D":M[A.path[I]]=A.lhs;break;case"E":M[A.path[I]]=A.lhs;break;case"N":delete M[A.path[I]];break}}else switch(A.kind){case"A":E(T[_],A.index,A.item);break;case"D":T[_]=A.lhs;break;case"E":T[_]=A.lhs;break;case"N":T=d(T,_);break}return T}function j(T,_,A){if(T&&_&&A&&A.kind){var M=T,I,P;for(P=A.path.length-1,I=0;I<P;I++)typeof M[A.path[I]]>"u"&&(M[A.path[I]]={}),M=M[A.path[I]];switch(A.kind){case"A":E(M[A.path[I]],A.index,A.item);break;case"D":M[A.path[I]]=A.lhs;break;case"E":M[A.path[I]]=A.lhs;break;case"N":delete M[A.path[I]];break}}}function k(T,_,A){if(T&&_){var M=function(I){(!A||A(T,_,I))&&C(T,_,I)};v(T,_,M)}}return Object.defineProperties(y,{diff:{value:y,enumerable:!0},orderIndependentDiff:{value:w,enumerable:!0},observableDiff:{value:v,enumerable:!0},orderIndependentObservableDiff:{value:x,enumerable:!0},orderIndepHash:{value:h,enumerable:!0},applyDiff:{value:k,enumerable:!0},applyChange:{value:C,enumerable:!0},revertChange:{value:j,enumerable:!0},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:!0}}),y.DeepDiff=y,n&&(n.DeepDiff=y),y})})(yK);var Lze=yK.exports;const Nze={A:" ",E:" ",D:"-",N:"+"},Ag=({entry:e,sort:t=(n,r)=>n.key.localeCompare(r.key)})=>{const n=z0(),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?Lze.diff(e.preData,e.data):void 0,i=(c,u)=>{let d;return c.lhs!==void 0?d=a.jsxs("div",{style:r.D,children:["- ",u,": ",JSON.stringify(c.lhs)]}):c.rhs!==void 0&&(d=a.jsxs("div",{style:r.N,children:["+ ",u,": ",JSON.stringify(c.rhs)]})),d},s=(c,u)=>{var p;let d;const f=((p=c.path)==null?void 0:p.join("."))??c.index;if(c.item)d=i(c.item,f);else if(c.lhs!==void 0&&c.rhs!==void 0)d=a.jsxs("div",{children:[a.jsxs("div",{style:r.D,children:["- ",f,": ",JSON.stringify(c.lhs)]}),a.jsxs("div",{style:r.N,children:["+ ",f,": ",JSON.stringify(c.rhs)]})]});else{const h=JSON.stringify(c.rhs||c.item);d=a.jsxs("div",{style:r[c.kind],children:[Nze[c.kind]," ",f,h?`: ${h}`:c.kind==="D"?" (deleted)":""]})}return{key:f.toString(),value:a.jsx("div",{children:d},u),index:u}};let l=[];if(o)l=o.map(s).sort(t).map(({value:c})=>c);else if(e.data==null||e.preData==null){const c=e.data||e.preData;l=[a.jsx("div",{style:e.data?r.N:r.D,children:JSON.stringify(c,null,2)},0)]}return a.jsx("pre",{style:{overflowX:"auto",overflowY:"hidden"},tabIndex:0,children:a.jsx("code",{children:l.length===0?"(no changes)":l})})},Fze=({refresh:e,show:t,afterSubmitAction:n,data:r,cache:o})=>{const i=It(),s=Qn(i.breakpoints.down("sm")),l=m.useMemo(()=>{const c={...GV,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 s?{...c,right:0,left:0,bottom:0,borderRadius:0}:c},[i,s]);return a.jsxs(n5,{mounted:t,start:l,enter:qV,children:[a.jsx(Z,{variant:"h5",sx:{my:2,mb:2},children:"Your data is stale"}),a.jsx(Z,{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."}),a.jsx(Ag,{entry:{preData:o,data:r}}),a.jsx(We,{sx:{mb:2},variant:"contained",color:"primary",onClick:()=>{e(),n()},children:"Refresh data"})]})},Bze=({unleashGetter:e,dataKey:t="",refetchFunctionKey:n="",options:r={},params:o=[""]})=>{const i=e(...o,{refreshInterval:5,...r});return{data:i[t],refetch:i[n]}},xK=(e,t,n,r)=>{const{data:o,refetch:i}=Bze(e),[s,l]=m.useState(t||null),[c,u]=m.useState(!1),d=p=>{u(!1),l(p)},f=p=>p&&(r&&typeof r=="function"?r(p):p);return m.useEffect(()=>{s===null&&l(t)},[t]),m.useEffect(()=>{if(!s||!o)return;Tv(f(s),f(o))||u(!0)},[o]),{data:s,refetch:i,staleDataNotification:a.jsx(Fze,{cache:f(s),data:f(o),refresh:()=>d(o),show:c,afterSubmitAction:n.afterSubmitAction}),forceRefreshCache:d}},zze={environments:[],name:"",type:"",stale:!1,archived:!1,createdAt:"",lastSeenAt:"",project:"",variants:[],description:"",favorite:!1,impressionData:!1,dependencies:[],children:[]},Wl=(e,t,n)=>{const r=Uze(e,t),{data:o,error:i,mutate:s}=Pn(["useFeature",r],()=>Hze(r),n),l=m.useCallback(()=>{s().catch(console.warn)},[s]);return{feature:(o==null?void 0:o.body)||zze,refetchFeature:l,loading:!i&&!o,status:o==null?void 0:o.status,error:i}},Hze=async e=>{const t=await fetch(e);return t.status===404?{status:404}:(t.ok||await fn("Feature flag data")(t),{status:t.status,body:await t.json()})},Uze=(e,t)=>Ot(`api/admin/projects/${e}/features/${t}?variantEnvironments=true`);function b_(e,...t){const n=new Set(t);if(Array.isArray(e))return e.map(r=>b_(r,...t));if(typeof e=="object"&&e!==null){const r={};for(const[o,i]of Object.entries(e))n.has(o)||(r[o]=b_(i,...t));return r}return e}const bK=e=>{const t={...e};return b_(t,"lastSeenAt","yes","no")},PP=(e,t)=>{var n;return`${e.baseUriPath||((n=e.versionInfo)==null?void 0:n.instanceId)}#${t}`},Vze={willOverwriteStrategyChanges:!1,registerWillOverwriteStrategyChanges:()=>{}},wK=m.createContext(Vze),Wze=wK.Provider,Gze=()=>m.useContext(wK),up=()=>{const{trackEvent:e}=Sn(),{makeRequest:t,createRequest:n,errors:r,loading:o}=sr({propagateErrors:!0}),{uiConfig:i}=ht(),{willOverwriteStrategyChanges:s}=Gze();return{addChange:async(v,x,y)=>{e("change_request",{props:{eventType:"change added"}});const w=`api/admin/projects/${v}/environments/${x}/change-requests`,S=n(w,{method:"POST",body:JSON.stringify(y)});return(await t(S.caller,S.id)).json()},editChange:async(v,x,y,w)=>{const S=`api/admin/projects/${v}/change-requests/${x}/changes/${y}`,C=n(S,{method:"PUT",body:JSON.stringify(w)});return t(C.caller,C.id)},changeState:async(v,x,y,w)=>{e("change_request",{props:{eventType:w.state,previousState:y,willOverwriteStrategyChanges:s,id:PP(i,x)}});const S=`api/admin/projects/${v}/change-requests/${x}/state`,C=n(S,{method:"PUT",body:JSON.stringify(w)});return(await t(C.caller,C.id)).json()},discardChange:async(v,x,y)=>{const w=`api/admin/projects/${v}/change-requests/${x}/changes/${y}`,S=n(w,{method:"DELETE"});return t(S.caller,S.id)},updateChangeRequestEnvironmentConfig:async({project:v,enabled:x,environment:y,requiredApprovals:w})=>{const S=`api/admin/projects/${v}/environments/${y}/change-requests/config`,C=n(S,{method:"PUT",body:JSON.stringify({changeRequestsEnabled:x,requiredApprovals:w})});return t(C.caller,C.id)},discardDraft:async(v,x)=>{const y=`api/admin/projects/${v}/change-requests/${x}`,w=n(y,{method:"DELETE"});return t(w.caller,w.id)},addComment:async(v,x,y)=>{e("change_request",{props:{eventType:"comment added"}});const w=`/api/admin/projects/${v}/change-requests/${x}/comments`,S=n(w,{method:"POST",body:JSON.stringify({text:y})});return t(S.caller,S.id)},updateTitle:async(v,x,y)=>{e("change_request",{props:{eventType:"title updated"}});const w=`api/admin/projects/${v}/change-requests/${x}/title`,S=n(w,{method:"PUT",body:JSON.stringify({title:y})});return t(S.caller,S.id)},errors:r,loading:o}},bC=(e,t,n,r={})=>{const{isEnterprise:o}=ht();return Ql(o(),e,t,n,r)},qze=e=>fetch(e).then(fn("ChangeRequest")).then(t=>t.json()),wC=e=>{const{data:t,error:n,mutate:r}=bC([],Ot(`api/admin/projects/${e}/change-requests/pending`),qze);return{data:t,loading:!n&&!t,refetch:r,error:n}},Yze=({strategyDefinition:e})=>a.jsx("p",{children:e==null?void 0:e.description}),Kze=dwe(Hye,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}})),Xze=b(Z)(({theme:e})=>({marginBottom:e.spacing(1)})),U9=b(Z)(({theme:e})=>({marginBottom:e.spacing(1),marginTop:e.spacing(1)})),Jze=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),Qze=Va()(e=>({slider:{width:"100%",maxWidth:"100%"},margin:{height:e.spacing(3)}})),Zze=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}],SK=({name:e,value:t,onChange:n,disabled:r=!1})=>{const{classes:o}=Qze(),i=s=>`${s}%`;return a.jsxs("div",{className:o.slider,children:[a.jsxs(Jze,{children:[a.jsx(Z,{id:"discrete-slider-always",children:e}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsxs(ne,{children:[a.jsx(Xze,{variant:"h3",children:"Rollout percentage"}),a.jsx(Z,{variant:"body2",children:"The rollout percentage determines the proportion of users exposed to a feature. It's based on the MurmurHash of a user's unique identifier, normalized to a number between 1 and 100. If the normalized hash is less than or equal to the rollout percentage, the user sees the feature. This ensures a consistent, random distribution of the feature among users."}),a.jsx(U9,{variant:"h3",children:"Stickiness"}),a.jsxs(Z,{variant:"body2",children:["Stickiness refers to the value used for hashing to ensure a consistent user experience. It determines the input for the MurmurHash, ensuring that a user's feature exposure remains consistent across sessions.",a.jsx("br",{}),"By default Unleash will use the first value present in the context in the order of"," ",a.jsx("b",{children:"userId, sessionId and random"}),"."]}),a.jsx(U9,{variant:"h3",children:"GroupId"}),a.jsx(Z,{variant:"body2",children:"The groupId is used as a seed for the hash function, ensuring consistent feature exposure across different feature flags for a uniform user experience."})]})})]}),a.jsx(Kze,{min:0,max:100,value:t,getAriaValueText:i,"aria-labelledby":"discrete-slider-always",step:1,"data-testid":qSe,marks:Zze,onChange:n,valueLabelDisplay:"on",disabled:r})]})},kv=e=>{const t=Number(Mu(e));return Number.isFinite(t)?t:0},Mu=e=>String(e??"").trim(),kc=e=>Mu(e).split(",").map(t=>t.trim()).filter(Boolean),SC=({name:e,value:t="",label:n="",options:r,onChange:o,id:i,disabled:s=!1,className:l,classes:c,formControlStyles:u={},...d})=>{const f=()=>r.map(p=>a.jsx(Mo,{value:p.key,title:p.title||"","data-testid":`${mW}-${p.label}`,children:p.label},p.key));return a.jsxs(Ua,{variant:"outlined",size:"small",classes:c,style:u,children:[a.jsx(Y0,{htmlFor:i,children:n}),a.jsx(Z0,{name:e,disabled:s,onChange:o,className:l,label:n,id:i,value:t,...d,children:f()})]})},eHe=({label:e,editable:t,value:n,onChange:r,dataTestId:o})=>{const i=It(),s=aK(n);return a.jsx(SC,{id:"stickiness-select",name:"stickiness",label:e,options:s,value:n,disabled:!t,"data-testid":o,onChange:r,style:{minWidth:"100%",marginBottom:i.spacing(2)},formControlStyles:{width:"100%"}})},tHe="default",nHe=e=>{const{project:t,loading:n,error:r}=u1(e);return{defaultStickiness:t.defaultStickiness?t.defaultStickiness:tHe,mode:t.mode,loading:n,error:r}},rHe=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),oHe=b(ne)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",width:"100%",justifyContent:"space-between"})),iHe=b(ne)(({theme:e})=>({width:"50%",marginRight:e.spacing(.5)})),sHe=b(ne)(({theme:e})=>({width:"50%",marginLeft:e.spacing(.5)})),aHe=({updateParameter:e,parameters:t,editable:n=!0})=>{const r=Fr("projectId"),{defaultStickiness:o,loading:i}=nHe(r),{pathname:s}=Ao(),l=s.includes("default-strategy"),c=p=>h=>{e(p,h)},u=(p,h)=>{e("rollout",h.toString())},d=t.rollout!==void 0?kv(t.rollout):100,f=m.useMemo(()=>t.stickiness===""&&!i?o:Mu(t.stickiness),[i,t.stickiness]);return t.stickiness===""&&c("stickiness")(f),m.useEffect(()=>{l&&!t.groupId&&c("groupId")("")},[l]),i?a.jsx(p0,{}):a.jsxs(rHe,{children:[a.jsx(SK,{name:"Rollout",value:d,disabled:!n,onChange:u}),a.jsxs(oHe,{children:[a.jsx(iHe,{children:a.jsx(eHe,{label:"Stickiness",value:f,editable:n,dataTestId:KSe,onChange:p=>c("stickiness")(p.target.value)})}),a.jsx(sHe,{children:a.jsx(ar,{label:"groupId",sx:{width:"100%"},id:"groupId-input",value:Mu(t.groupId),disabled:!n,onChange:p=>c("groupId")(p.target.value),"data-testid":XSe})})]})]})},hs=({text:e,maxWidth:t,maxLength:n,className:r,...o})=>a.jsx(W,{condition:((e==null?void 0:e.length)??0)>n,show:a.jsx(gt,{title:e,arrow:!0,children:a.jsx("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:a.jsx("span",{className:r,children:e})}),lHe=b("div")(({theme:e})=>({display:"grid",gap:e.spacing(1)})),cHe=b("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexWrap:"wrap"})),uHe=b("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"start"})),CK=({name:e,list:t,setConfig:n,disabled:r,errors:o})=>{const[i,s]=m.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 g=h.target.value;if(g){const v=g.split(/,\s*/).filter(x=>!t.includes(x));if(v.length>0){const x=t.concat(v).filter(y=>y);n(e,x.join(","))}s("")}},f=h=>{t[h]=null,n(e,t.length===1?"":t.filter(Boolean).join(","))},p=h=>{s(h.currentTarget.value)};return a.jsxs(lHe,{children:[a.jsxs(Z,{variant:"subtitle2",component:"h2",children:["List of ",e]}),a.jsx(W,{condition:t.length>0,show:a.jsx(cHe,{children:t.map((h,g)=>a.jsx(vi,{label:a.jsx(hs,{maxWidth:"300",text:h,maxLength:50}),onDelete:r?void 0:()=>f(g),title:"Remove value"},g+h))})}),a.jsx(W,{condition:!r,show:a.jsxs(uHe,{children:[a.jsx(Cn,{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:p,onKeyDown:u,"data-testid":JSe}),a.jsx(We,{onClick:d,"data-testid":QSe,variant:"outlined",color:"secondary",startIcon:a.jsx(ni,{}),children:"Add"})]})})]})},dHe=({editable:e,parameters:t,updateParameter:n,errors:r})=>a.jsx("div",{children:a.jsx(CK,{name:"userIds",list:kc(t.userIds),disabled:!e,setConfig:n,errors:r})}),ym=({text:e})=>e?a.jsx(ne,{sx:t=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallerBody,marginTop:t.spacing(1)}),children:e}):null,fHe=({definition:e,parameters:t,updateParameter:n,editable:r,errors:o})=>{const{type:i,name:s,description:l,required:c}=e,u=t[s],d=o.getFormError(s),f=c?`${s} * `:s,p=y=>{n(s,y.target.value)},h=y=>{n(s,Mu(y.target.value))},g=(y,w)=>{n(s,w.toString())},v=(y,w)=>{n(s,String(w))},x=(y,w)=>{n(y,kc(w).join(","))};if(i==="percentage")return a.jsxs("div",{children:[a.jsx(SK,{name:s,onChange:g,disabled:!r,value:kv(t[s]),minLabel:"off",maxLabel:"on"}),a.jsx(ym,{text:l})]});if(i==="list")return a.jsxs("div",{children:[a.jsx(CK,{name:s,list:kc(t[s]),disabled:!r,setConfig:x,errors:o}),a.jsx(ym,{text:l})]});if(i==="number")return a.jsxs("div",{children:[a.jsx(Cn,{error:!!d,helperText:d,variant:"outlined",size:"small","aria-required":c,style:{width:"100%"},disabled:!r,label:f,onChange:p,value:u}),a.jsx(ym,{text:l})]});if(i==="boolean"){const w=Mu(t[s])==="true";return a.jsxs("div",{children:[a.jsx(Qr,{label:s,control:a.jsx(is,{name:s,onChange:v,checked:w})}),a.jsx(ym,{text:l})]})}return a.jsxs("div",{children:[a.jsx(Cn,{rows:1,placeholder:"",variant:"outlined",size:"small",style:{width:"100%"},"aria-required":c,disabled:!r,error:!!d,helperText:d,name:s,label:f,onChange:h,value:Mu(t[s])}),a.jsx(ym,{text:l})]})},pHe=ql("div")(({theme:e})=>({display:"grid",gap:e.spacing(4)})),hHe=({parameters:e,strategyDefinition:t,updateParameter:n,editable:r,errors:o})=>!t||t.parameters.length===0?null:a.jsx(pHe,{children:t.parameters.map((i,s)=>a.jsx("div",{children:a.jsx(fHe,{definition:i,parameters:e,updateParameter:n,editable:r,errors:o})},s))}),gHe=({hasAccess:e,strategy:t,strategyDefinition:n,setStrategy:r,validateParameter:o,errors:i})=>{const{context:s}=yi(),l=(c,u)=>{r(_i(d=>{d.parameters=d.parameters??{},d.parameters[c]=u})),o(c,u)};switch(t.name){case"default":return a.jsx(Yze,{strategyDefinition:n});case"flexibleRollout":return a.jsx(aHe,{context:s,parameters:t.parameters??{},updateParameter:l,editable:e});case"userWithId":return a.jsx(dHe,{parameters:t.parameters??{},updateParameter:l,editable:e,errors:i});default:return a.jsx(hHe,{strategyDefinition:n,parameters:t.parameters??{},updateParameter:l,editable:e,errors:i})}},mHe=({projectId:e,featureId:t,environmentId:n,children:r})=>{const o=QP(e,t),{feature:i}=Wl(e,t),s=a.jsx(ln,{to:o,children:"feature flag page"});return a.jsx(W,{condition:vHe(i,n),show:r,elseShow:a.jsxs(Vt,{severity:"warning",children:["This feature flag is currently disabled in the"," ",a.jsx("strong",{children:n})," environment. Any changes made here will not take effect until the flag has been enabled on the ",s,"."]})})},vHe=(e,t)=>{const n=e.environments.find(r=>r.name===t);return n?n.enabled:!1},CC="NOT_IN",Pg="IN",jC="STR_ENDS_WITH",EC="STR_STARTS_WITH",TC="STR_CONTAINS",kC="NUM_EQ",_C="NUM_GT",RC="NUM_GTE",AC="NUM_LT",PC="NUM_LTE",Og="DATE_AFTER",OC="DATE_BEFORE",$C="SEMVER_EQ",IC="SEMVER_GT",MC="SEMVER_LT",yHe=[Pg,CC,TC,EC,jC,kC,_C,RC,AC,PC,OC,Og,$C,IC,MC],Ai=[TC,EC,jC],Zs=[Pg,CC],Ml=[kC,_C,RC,AC,PC],Do=[OC,Og],Dl=[$C,IC,MC],jK=[...Dl,...Do,...Ml];[...Ai,...Zs];const EK=[...Ai,...Do,...jK],Qt=(e,t)=>e.some(n=>n===t),OP=()=>a.jsxs(Vt,{severity:"warning",children:["Remember to update your Unleash client! New operators require new SDK versions. ",a.jsx(xHe,{}),"."]}),xHe=()=>a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators",target:"_blank",rel:"noreferrer",children:"Read more"}),bHe=b("div")(({theme:e})=>({padding:e.spacing(2)})),wHe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(2),borderTop:`1px solid ${e.palette.divider}`,width:"100%",padding:e.spacing(2)})),SHe=b("div")({marginLeft:"auto"}),CHe=b(We)(({theme:e})=>({marginRight:e.spacing(1),minWidth:"125px"})),jHe=b(We)(({theme:e})=>({marginLeft:e.spacing(1),minWidth:"125px"})),EHe=({localConstraint:e,children:t,triggerTransition:n,setAction:r,onSubmit:o})=>a.jsxs(a.Fragment,{children:[a.jsxs(bHe,{children:[a.jsx(W,{condition:Qt(EK,e.operator),show:a.jsx(OP,{})}),t]}),a.jsx(wHe,{children:a.jsxs(SHe,{children:[a.jsx(CHe,{type:"button",onClick:o,variant:"outlined",color:"primary","data-testid":"CONSTRAINT_SAVE_BUTTON",children:"Done"}),a.jsx(jHe,{onClick:()=>{r(tX),n()},children:"Cancel"})]})})]});var $P={},THe=ze;Object.defineProperty($P,"__esModule",{value:!0});var IP=$P.default=void 0,kHe=THe(He()),_He=a,RHe=(0,kHe.default)((0,_He.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");IP=$P.default=RHe;const DC=({compact:e,disabled:t})=>a.jsx(ne,{className:"constraint-icon-container",sx:n=>({backgroundColor:t?n.palette.neutral.border:"primary.light",p:e?"1px":"2px",borderRadius:"50%",width:e?"18px":"24px",height:e?"18px":"24px",marginRight:"13px"}),children:a.jsx(IP,{className:"constraint-icon",sx:n=>({fill:n.palette.common.white,display:"block",width:e?n.spacing(2):n.spacing(2.5),height:e?n.spacing(2):n.spacing(2.5)})})}),AHe=(e,t)=>{const n=`To satisfy this constraint, values passed into the SDK as ${t} must`;if(e===Pg)return`${n} include:`;if(e===CC)return`${n} not include:`;if(e===jC)return`${n} end with:`;if(e===EC)return`${n} start with:`;if(e===TC)return`${n} contain:`;if(e===kC)return`${n} match:`;if(e===_C)return`${n} be greater than:`;if(e===RC)return`${n} be greater than or equal to:`;if(e===AC)return`${n} be less than:`;if(e===PC)return`${n} be less than or equal to:`;if(e===Og)return`${n} be after the following date`;if(e===OC)return`${n} be before the following date:`;if(e===$C)return`${n} match the following version:`;if(e===IC)return`${n} be greater than the following version:`;if(e===MC)return`${n} be less than the following version:`},Nb=e=>PHe[e],PHe={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"},OHe=b("div")(({theme:e})=>({lineHeight:1.1,marginTop:-2,marginBottom:-10})),V9=b("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),W9=b("div")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"})),$He=b(Ua)(({theme:e})=>({[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(.5)}})),IHe=b(Mo,{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}}:{}),MHe=b("div")(({theme:e})=>({lineHeight:1.2})),TK=({options:e,value:t,onChange:n})=>{const[r,o]=m.useState(!1),i=l=>{n(l.target.value)},s=()=>a.jsxs(OHe,{children:[a.jsx(V9,{children:t}),a.jsx(W9,{children:Nb(t)})]});return a.jsxs($He,{variant:"outlined",size:"small",fullWidth:!0,children:[a.jsx(Y0,{htmlFor:"operator-select",children:"Operator"}),a.jsx(Z0,{id:"operator-select",name:"operator",label:"Operator",value:t,open:r,onOpen:()=>o(!0),onClose:()=>o(!1),onChange:i,renderValue:s,children:e.map(l=>a.jsx(IHe,{value:l,separator:DHe(e,l),children:a.jsxs(MHe,{children:[a.jsx(V9,{children:l}),a.jsx(W9,{children:Nb(l)})]})},l))})]})},DHe=(e,t)=>t===e[0]?!1:LHe.some(n=>n[0]===t),LHe=[Zs,Ai,Ml,Do,Dl],Ff="currentTime",MP=e=>yHe.filter(t=>!(Qt(Do,t)&&e!==Ff||!Qt(Do,t)&&e===Ff)),LC=e=>m.createElement("svg",{width:24,height:10,viewBox:"0 0 24 10",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{d:"M20.9238 0.46875V9H19.1719V0.46875H20.9238ZM23.5488 0.46875V1.8457H16.5879V0.46875H23.5488Z"}),m.createElement("path",{d:"M16.2422 4.53516V4.93945C16.2422 5.58789 16.1543 6.16992 15.9785 6.68555C15.8027 7.20117 15.5547 7.64062 15.2344 8.00391C14.9141 8.36328 14.5312 8.63867 14.0859 8.83008C13.6445 9.02148 13.1543 9.11719 12.6152 9.11719C12.0801 9.11719 11.5898 9.02148 11.1445 8.83008C10.7031 8.63867 10.3203 8.36328 9.99609 8.00391C9.67188 7.64062 9.41992 7.20117 9.24023 6.68555C9.06445 6.16992 8.97656 5.58789 8.97656 4.93945V4.53516C8.97656 3.88281 9.06445 3.30078 9.24023 2.78906C9.41602 2.27344 9.66406 1.83398 9.98438 1.4707C10.3086 1.10742 10.6914 0.830078 11.1328 0.638672C11.5781 0.447266 12.0684 0.351562 12.6035 0.351562C13.1426 0.351562 13.6328 0.447266 14.0742 0.638672C14.5195 0.830078 14.9023 1.10742 15.2227 1.4707C15.5469 1.83398 15.7969 2.27344 15.9727 2.78906C16.1523 3.30078 16.2422 3.88281 16.2422 4.53516ZM14.4668 4.93945V4.52344C14.4668 4.07031 14.4258 3.67188 14.3438 3.32812C14.2617 2.98438 14.1406 2.69531 13.9805 2.46094C13.8203 2.22656 13.625 2.05078 13.3945 1.93359C13.1641 1.8125 12.9004 1.75195 12.6035 1.75195C12.3066 1.75195 12.043 1.8125 11.8125 1.93359C11.5859 2.05078 11.3926 2.22656 11.2324 2.46094C11.0762 2.69531 10.957 2.98438 10.875 3.32812C10.793 3.67188 10.752 4.07031 10.752 4.52344V4.93945C10.752 5.38867 10.793 5.78711 10.875 6.13477C10.957 6.47852 11.0781 6.76953 11.2383 7.00781C11.3984 7.24219 11.5938 7.41992 11.8242 7.54102C12.0547 7.66211 12.3184 7.72266 12.6152 7.72266C12.9121 7.72266 13.1758 7.66211 13.4062 7.54102C13.6367 7.41992 13.8301 7.24219 13.9863 7.00781C14.1426 6.76953 14.2617 6.47852 14.3438 6.13477C14.4258 5.78711 14.4668 5.38867 14.4668 4.93945Z"}),m.createElement("path",{d:"M7.70508 0.46875V9H5.94727L2.51953 3.28125V9H0.761719V0.46875H2.51953L5.95312 6.19336V0.46875H7.70508Z"})),kK=e=>m.createElement("svg",{width:24,height:36,viewBox:"25 12 24 30",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{d:"M44.2145 31H45.9238V23.8457H48.5488V22.4688H45.9238H44.1719H41.5879V23.8457H44.1719V30.9574L44.2145 31ZM39.1419 28.7274L40.3188 29.9043C40.3146 29.9095 40.3104 29.9147 40.3061 29.9198L46.2004 35.8141L44.8004 37.2141L38.5868 31.0005C38.2828 31.0783 37.9589 31.1172 37.6152 31.1172C37.0801 31.1172 36.5898 31.0215 36.1445 30.8301C35.7031 30.6387 35.3203 30.3633 34.9961 30.0039C34.6719 29.6406 34.4199 29.2012 34.2402 28.6855C34.0645 28.1699 33.9766 27.5879 33.9766 26.9395V26.5352C33.9766 26.4869 33.977 26.4391 33.978 26.3917L32.7051 25.1188V31H30.9473L27.5195 25.2812V31H25.7617V22.4688H27.5195L30.9531 28.1934V23.3668L26.4004 18.8141L27.8004 17.4141L34.5229 24.1366C34.5262 24.1305 34.5295 24.1244 34.5328 24.1183L35.8509 25.4364C35.8493 25.4442 35.8477 25.452 35.8461 25.4598L37.0004 26.6141L39.1328 28.7465C39.1359 28.7402 39.1389 28.7338 39.1419 28.7274ZM39.4614 26.247L41.1626 27.9481C41.2157 27.632 41.2422 27.2957 41.2422 26.9395V26.5352C41.2422 25.8828 41.1523 25.3008 40.9727 24.7891C40.7969 24.2734 40.5469 23.834 40.2227 23.4707C39.9023 23.1074 39.5195 22.8301 39.0742 22.6387C38.6328 22.4473 38.1426 22.3516 37.6035 22.3516C37.0684 22.3516 36.5781 22.4473 36.1328 22.6387C36.0682 22.6667 36.0048 22.6966 35.9427 22.7283L37.0488 23.8344C37.2187 23.7794 37.4036 23.752 37.6035 23.752C37.9004 23.752 38.1641 23.8125 38.3945 23.9336C38.625 24.0508 38.8203 24.2266 38.9805 24.4609C39.1406 24.6953 39.2617 24.9844 39.3438 25.3281C39.4087 25.6002 39.4479 25.9065 39.4614 26.247ZM37.281 29.6947L35.9324 28.346C36.0101 28.5994 36.112 28.82 36.2383 29.0078C36.3984 29.2422 36.5938 29.4199 36.8242 29.541C36.9642 29.6146 37.1165 29.6658 37.281 29.6947Z"})),_K=ql(Ht)(({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"}})),RK=ql(Ht)(({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"}})),NHe=({localConstraint:e,setInvertedOperator:t})=>a.jsx(gt,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(ne,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(W,{condition:!!e.inverted,show:a.jsx(RK,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(LC,{})}),elseShow:a.jsx(_K,{onClick:t,disableRipple:!0,children:a.jsx(kK,{})})})})}),NC=e=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),AK=e=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e},m.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"})),FHe=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(gt,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(ne,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(W,{condition:!!e.caseInsensitive,show:a.jsx(_K,{onClick:t,disableRipple:!0,children:a.jsx(AK,{})}),elseShow:a.jsx(RK,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(NC,{})})})})}),BHe=b("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),PK=({onEdit:e,onDelete:t,disableDelete:n=!1,disableEdit:r=!1})=>{const o=e&&(s=>{s.stopPropagation(),e()}),i=t&&(s=>{s.stopPropagation(),t()});return a.jsxs(BHe,{children:[a.jsx(W,{condition:!!o&&!r,show:a.jsx(gt,{title:"Edit constraint",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:o,disabled:r,children:a.jsx(Oi,{})})})}),a.jsx(W,{condition:!!i&&!n,show:a.jsx(gt,{title:"Delete constraint",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:i,disabled:n,children:a.jsx(co,{})})})})]})},zHe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),HHe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(770)]:{flexDirection:"column"}})),UHe=b("div")(({theme:e})=>({[e.breakpoints.down(770)]:{marginTop:e.spacing(2)},display:"inline-flex"})),VHe=b("div")(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),WHe=b(rp)(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),GHe=b("p")(({theme:e})=>({maxWidth:"400px",fontSize:e.fontSizes.smallBody,[e.breakpoints.down("xl")]:{display:"none"}})),qHe=({compact:e,localConstraint:t,setLocalConstraint:n,setContextName:r,setOperator:o,onDelete:i,setInvertedOperator:s,setCaseInsensitive:l})=>{const{context:c}=yi(),{contextName:u,operator:d}=t,[f,p]=m.useState(!1),{uiConfig:h}=ht(),g=!!h.flags.caseInsensitiveInOperators;if(m.useEffect(()=>{u===Ff&&!Qt(Do,d)?n(y=>({...y,operator:Og,value:new Date().toISOString()})):u!==Ff&&Qt(Do,d)&&o(Pg),Qt(Ai,d)||Qt(Zs,d)&&g?p(!0):p(!1)},[u,o,d,n,g]),!c)return null;const v=c.map(y=>({key:y.name,label:y.name})),x=y=>{Qt(Ai,y)||Qt(Zs,y)&&g?p(!0):p(!1),Qt(Do,y)?n(w=>({...w,operator:y,value:new Date().toISOString()})):o(y)};return a.jsxs(zHe,{children:[a.jsx(DC,{}),a.jsxs(HHe,{children:[a.jsx("div",{children:a.jsx(WHe,{id:"context-field-select",name:"contextName",label:"Context Field",autoFocus:!0,options:v,value:u||"",onChange:r})}),a.jsxs(UHe,{children:[a.jsx(NHe,{localConstraint:t,setInvertedOperator:s}),a.jsx(VHe,{children:a.jsx(TK,{options:MP(u),value:d,onChange:x})}),a.jsx(W,{condition:f,show:a.jsx(FHe,{localConstraint:t,setCaseInsensitive:l})})]})]}),a.jsx(W,{condition:!e,show:a.jsx(GHe,{children:AHe(d,u)})}),a.jsx(PK,{onDelete:i,disableEdit:!0})]})},Xp=e=>_i(e,t=>{Qt(jK,e.operator)?delete t.values:delete t.value}),dp=()=>{const{makeRequest:e,makeLightRequest:t,createRequest:n,errors:r,loading:o}=sr({propagateErrors:!0}),i=async(j,k)=>{const _=n("api/admin/features/validate",{method:"POST",body:JSON.stringify({name:j,projectId:k})});return e(_.caller,_.id)},s=async j=>{const T=n("api/admin/constraints/validate",{method:"POST",body:JSON.stringify(j)});await e(T.caller,T.id)},l=async(j,k)=>{const T=`/api/admin/projects/${j}/features`,_=n(T,{method:"POST",body:JSON.stringify(k)});await e(_.caller,_.id)},c=m.useCallback(async(j,k,T,_=!1)=>{const A=`api/admin/projects/${j}/features/${k}/environments/${T}/on?shouldActivateDisabledStrategies=${_}`,M=n(A,{method:"POST"},"toggleFeatureEnvironmentOn");return t(M.caller,M.id)},[n,t]),u=m.useCallback(async(j,k,T,_=!1)=>{const A=`api/admin/projects/${j}/bulk_features/environments/${T}/on?shouldActivateDisabledStrategies=${_}`,M=n(A,{method:"POST",body:JSON.stringify({features:k})},"bulkToggleFeaturesEnvironmentOn");return e(M.caller,M.id)},[n,e]),d=m.useCallback(async(j,k,T,_=!1)=>{const A=`api/admin/projects/${j}/bulk_features/environments/${T}/off?shouldActivateDisabledStrategies=${_}`,M=n(A,{method:"POST",body:JSON.stringify({features:k})},"bulkToggleFeaturesEnvironmentOff");return e(M.caller,M.id)},[n,e]),f=m.useCallback(async(j,k,T)=>{const _=`api/admin/projects/${j}/features/${k}/environments/${T}/off`,A=n(_,{method:"POST"},"toggleFeatureEnvironmentOff");return t(A.caller,A.id)},[n,t]);return{validateFeatureToggleName:i,validateConstraint:s,createFeatureToggle:l,changeFeatureProject:async(j,k,T)=>{const _=`api/admin/projects/${j}/features/${k}/changeProject`,A=n(_,{method:"POST",body:JSON.stringify({newProjectId:T})});return e(A.caller,A.id)},errors:r,toggleFeatureEnvironmentOn:c,toggleFeatureEnvironmentOff:f,addTagToFeature:async(j,k)=>{const T=`api/admin/features/${j}/tags`,_=n(T,{method:"POST",body:JSON.stringify({...k})});return e(_.caller,_.id)},deleteTagFromFeature:async(j,k,T)=>{const _=`${encodeURIComponent(k)}/${encodeURIComponent(T)}`,A=`api/admin/features/${j}/tags/${_}`,M=n(A,{method:"DELETE"});return e(M.caller,M.id)},updateFeatureTags:async(j,k)=>{const T=`api/admin/features/${j}/tags`,_=n(T,{method:"PUT",body:JSON.stringify({...k})});return e(_.caller,_.id)},archiveFeatureToggle:async(j,k)=>{const T=`api/admin/projects/${j}/features/${k}`,_=n(T,{method:"DELETE"});return e(_.caller,_.id)},patchFeatureToggle:async(j,k,T)=>{const _=`api/admin/projects/${j}/features/${k}`,A=n(_,{method:"PATCH",body:JSON.stringify(T)});return e(A.caller,A.id)},patchFeatureVariants:async(j,k,T)=>{const _=`api/admin/projects/${j}/features/${k}/variants`,A=n(_,{method:"PATCH",body:JSON.stringify(T)});return e(A.caller,A.id)},patchFeatureEnvironmentVariants:async(j,k,T,_)=>{const A=`api/admin/projects/${j}/features/${k}/environments/${T}/variants`,M=n(A,{method:"PATCH",body:JSON.stringify(_)});return e(M.caller,M.id)},overrideVariantsInEnvironments:async(j,k,T,_)=>{const A=`api/admin/projects/${j}/features/${k}/variants-batch`,M=n(A,{method:"PUT",body:JSON.stringify({variants:T,environments:_})});return e(M.caller,M.id)},cloneFeatureToggle:async(j,k,T)=>{const _=`api/admin/projects/${j}/features/${k}/clone`,A=n(_,{method:"POST",body:JSON.stringify(T)});return e(A.caller,A.id)},loading:o,bulkToggleFeaturesEnvironmentOn:u,bulkToggleFeaturesEnvironmentOff:d}};var w_={exports:{}};const YHe="2.0.0",OK=256,KHe=Number.MAX_SAFE_INTEGER||9007199254740991,XHe=16,JHe=OK-6,QHe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var FC={MAX_LENGTH:OK,MAX_SAFE_COMPONENT_LENGTH:XHe,MAX_SAFE_BUILD_LENGTH:JHe,MAX_SAFE_INTEGER:KHe,RELEASE_TYPES:QHe,SEMVER_SPEC_VERSION:YHe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},dE={};const ZHe=typeof process=="object"&&dE&&dE.NODE_DEBUG&&/\bsemver\b/i.test(dE.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var BC=ZHe;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:o}=FC,i=BC;t=e.exports={};const s=t.re=[],l=t.safeRe=[],c=t.src=[],u=t.t={};let d=0;const f="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",o],[f,r]],h=v=>{for(const[x,y]of p)v=v.split(`${x}*`).join(`${x}{0,${y}}`).split(`${x}+`).join(`${x}{1,${y}}`);return v},g=(v,x,y)=>{const w=h(x),S=d++;i(v,S,x),u[v]=S,c[S]=x,s[S]=new RegExp(x,y?"g":void 0),l[S]=new RegExp(w,y?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),g("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),g("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${f}+`),g("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),g("FULL",`^${c[u.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),g("LOOSE",`^${c[u.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),g("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),g("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",c[u.COERCE],!0),g("COERCERTLFULL",c[u.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(w_,w_.exports);var v1=w_.exports;const eUe=Object.freeze({loose:!0}),tUe=Object.freeze({}),nUe=e=>e?typeof e!="object"?eUe:e:tUe;var DP=nUe;const G9=/^[0-9]+$/,$K=(e,t)=>{const n=G9.test(e),r=G9.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},rUe=(e,t)=>$K(t,e);var IK={compareIdentifiers:$K,rcompareIdentifiers:rUe};const Oy=BC,{MAX_LENGTH:q9,MAX_SAFE_INTEGER:$y}=FC,{safeRe:Y9,t:K9}=v1,oUe=DP,{compareIdentifiers:Rp}=IK;let iUe=class al{constructor(t,n){if(n=oUe(n),t instanceof al){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>q9)throw new TypeError(`version is longer than ${q9} characters`);Oy("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?Y9[K9.LOOSE]:Y9[K9.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>$y||this.major<0)throw new TypeError("Invalid major version");if(this.minor>$y||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>$y||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<$y)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(Oy("SemVer.compare",this.version,this.options,t),!(t instanceof al)){if(typeof t=="string"&&t===this.version)return 0;t=new al(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof al||(t=new al(t,this.options)),Rp(this.major,t.major)||Rp(this.minor,t.minor)||Rp(this.patch,t.patch)}comparePre(t){if(t instanceof al||(t=new al(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(Oy("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 Rp(r,o)}while(++n)}compareBuild(t){t instanceof al||(t=new al(t,this.options));let n=0;do{const r=this.build[n],o=t.build[n];if(Oy("build 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 Rp(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]),Rp(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 Fi=iUe;const X9=Fi,sUe=(e,t,n=!1)=>{if(e instanceof X9)return e;try{return new X9(e,t)}catch(r){if(!n)return null;throw r}};var $g=sUe;const aUe=$g,lUe=(e,t)=>{const n=aUe(e,t);return n?n.version:null};var cUe=lUe;const uUe=$g,dUe=(e,t)=>{const n=uUe(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null};var fUe=dUe;const J9=Fi,pUe=(e,t,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new J9(e instanceof J9?e.version:e,n).inc(t,r,o).version}catch{return null}};var hUe=pUe;const Q9=$g,gUe=(e,t)=>{const n=Q9(e,null,!0),r=Q9(t,null,!0),o=n.compare(r);if(o===0)return null;const i=o>0,s=i?n:r,l=i?r:n,c=!!s.prerelease.length;if(!!l.prerelease.length&&!c)return!l.patch&&!l.minor?"major":s.patch?"patch":s.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 mUe=gUe;const vUe=Fi,yUe=(e,t)=>new vUe(e,t).major;var xUe=yUe;const bUe=Fi,wUe=(e,t)=>new bUe(e,t).minor;var SUe=wUe;const CUe=Fi,jUe=(e,t)=>new CUe(e,t).patch;var EUe=jUe;const TUe=$g,kUe=(e,t)=>{const n=TUe(e,t);return n&&n.prerelease.length?n.prerelease:null};var _Ue=kUe;const Z9=Fi,RUe=(e,t,n)=>new Z9(e,n).compare(new Z9(t,n));var qa=RUe;const AUe=qa,PUe=(e,t,n)=>AUe(t,e,n);var OUe=PUe;const $Ue=qa,IUe=(e,t)=>$Ue(e,t,!0);var MUe=IUe;const e8=Fi,DUe=(e,t,n)=>{const r=new e8(e,n),o=new e8(t,n);return r.compare(o)||r.compareBuild(o)};var LP=DUe;const LUe=LP,NUe=(e,t)=>e.sort((n,r)=>LUe(n,r,t));var FUe=NUe;const BUe=LP,zUe=(e,t)=>e.sort((n,r)=>BUe(r,n,t));var HUe=zUe;const UUe=qa,VUe=(e,t,n)=>UUe(e,t,n)>0;var zC=VUe;const WUe=qa,GUe=(e,t,n)=>WUe(e,t,n)<0;var NP=GUe;const qUe=qa,YUe=(e,t,n)=>qUe(e,t,n)===0;var MK=YUe;const KUe=qa,XUe=(e,t,n)=>KUe(e,t,n)!==0;var DK=XUe;const JUe=qa,QUe=(e,t,n)=>JUe(e,t,n)>=0;var FP=QUe;const ZUe=qa,eVe=(e,t,n)=>ZUe(e,t,n)<=0;var BP=eVe;const tVe=MK,nVe=DK,rVe=zC,oVe=FP,iVe=NP,sVe=BP,aVe=(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 tVe(e,n,r);case"!=":return nVe(e,n,r);case">":return rVe(e,n,r);case">=":return oVe(e,n,r);case"<":return iVe(e,n,r);case"<=":return sVe(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};var LK=aVe;const lVe=Fi,cVe=$g,{safeRe:Iy,t:My}=v1,uVe=(e,t)=>{if(e instanceof lVe)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(t.includePrerelease?Iy[My.COERCEFULL]:Iy[My.COERCE]);else{const c=t.includePrerelease?Iy[My.COERCERTLFULL]:Iy[My.COERCERTL];let u;for(;(u=c.exec(e))&&(!n||n.index+n[0].length!==e.length);)(!n||u.index+u[0].length!==n.index+n[0].length)&&(n=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(n===null)return null;const r=n[2],o=n[3]||"0",i=n[4]||"0",s=t.includePrerelease&&n[5]?`-${n[5]}`:"",l=t.includePrerelease&&n[6]?`+${n[6]}`:"";return cVe(`${r}.${o}.${i}${s}${l}`,t)};var dVe=uVe;class fVe{constructor(){this.max=1e3,this.map=new Map}get(t){const n=this.map.get(t);if(n!==void 0)return this.map.delete(t),this.map.set(t,n),n}delete(t){return this.map.delete(t)}set(t,n){if(!this.delete(t)&&n!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(t,n)}return this}}var pVe=fVe,fE,t8;function Ya(){if(t8)return fE;t8=1;class e{constructor($,z){if(z=r(z),$ instanceof e)return $.loose===!!z.loose&&$.includePrerelease===!!z.includePrerelease?$:new e($.raw,z);if($ instanceof o)return this.raw=$.value,this.set=[[$]],this.format(),this;if(this.options=z,this.loose=!!z.loose,this.includePrerelease=!!z.includePrerelease,this.raw=$.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(q=>!g(q[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const q of this.set)if(q.length===1&&v(q[0])){this.set=[q];break}}}this.format()}format(){return this.range=this.set.map($=>$.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange($){const Y=((this.options.includePrerelease&&p)|(this.options.loose&&h))+":"+$,q=n.get(Y);if(q)return q;const G=this.options.loose,F=G?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];$=$.replace(F,M(this.options.includePrerelease)),i("hyphen replace",$),$=$.replace(l[c.COMPARATORTRIM],u),i("comparator trim",$),$=$.replace(l[c.TILDETRIM],d),i("tilde trim",$),$=$.replace(l[c.CARETTRIM],f),i("caret trim",$);let U=$.split(" ").map(re=>y(re,this.options)).join(" ").split(/\s+/).map(re=>A(re,this.options));G&&(U=U.filter(re=>(i("loose invalid filter",re,this.options),!!re.match(l[c.COMPARATORLOOSE])))),i("range list",U);const O=new Map,L=U.map(re=>new o(re,this.options));for(const re of L){if(g(re))return[re];O.set(re.value,re)}O.size>1&&O.has("")&&O.delete("");const te=[...O.values()];return n.set(Y,te),te}intersects($,z){if(!($ instanceof e))throw new TypeError("a Range is required");return this.set.some(Y=>x(Y,z)&&$.set.some(q=>x(q,z)&&Y.every(G=>q.every(F=>G.intersects(F,z)))))}test($){if(!$)return!1;if(typeof $=="string")try{$=new s($,this.options)}catch{return!1}for(let z=0;z<this.set.length;z++)if(I(this.set[z],$,this.options))return!0;return!1}}fE=e;const t=pVe,n=new t,r=DP,o=HC(),i=BC,s=Fi,{safeRe:l,t:c,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=v1,{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:h}=FC,g=P=>P.value==="<0.0.0-0",v=P=>P.value==="",x=(P,$)=>{let z=!0;const Y=P.slice();let q=Y.pop();for(;z&&Y.length;)z=Y.every(G=>q.intersects(G,$)),q=Y.pop();return z},y=(P,$)=>(i("comp",P,$),P=E(P,$),i("caret",P),P=S(P,$),i("tildes",P),P=k(P,$),i("xrange",P),P=_(P,$),i("stars",P),P),w=P=>!P||P.toLowerCase()==="x"||P==="*",S=(P,$)=>P.trim().split(/\s+/).map(z=>C(z,$)).join(" "),C=(P,$)=>{const z=$.loose?l[c.TILDELOOSE]:l[c.TILDE];return P.replace(z,(Y,q,G,F,U)=>{i("tilde",P,Y,q,G,F,U);let O;return w(q)?O="":w(G)?O=`>=${q}.0.0 <${+q+1}.0.0-0`:w(F)?O=`>=${q}.${G}.0 <${q}.${+G+1}.0-0`:U?(i("replaceTilde pr",U),O=`>=${q}.${G}.${F}-${U} <${q}.${+G+1}.0-0`):O=`>=${q}.${G}.${F} <${q}.${+G+1}.0-0`,i("tilde return",O),O})},E=(P,$)=>P.trim().split(/\s+/).map(z=>j(z,$)).join(" "),j=(P,$)=>{i("caret",P,$);const z=$.loose?l[c.CARETLOOSE]:l[c.CARET],Y=$.includePrerelease?"-0":"";return P.replace(z,(q,G,F,U,O)=>{i("caret",P,q,G,F,U,O);let L;return w(G)?L="":w(F)?L=`>=${G}.0.0${Y} <${+G+1}.0.0-0`:w(U)?G==="0"?L=`>=${G}.${F}.0${Y} <${G}.${+F+1}.0-0`:L=`>=${G}.${F}.0${Y} <${+G+1}.0.0-0`:O?(i("replaceCaret pr",O),G==="0"?F==="0"?L=`>=${G}.${F}.${U}-${O} <${G}.${F}.${+U+1}-0`:L=`>=${G}.${F}.${U}-${O} <${G}.${+F+1}.0-0`:L=`>=${G}.${F}.${U}-${O} <${+G+1}.0.0-0`):(i("no pr"),G==="0"?F==="0"?L=`>=${G}.${F}.${U}${Y} <${G}.${F}.${+U+1}-0`:L=`>=${G}.${F}.${U}${Y} <${G}.${+F+1}.0-0`:L=`>=${G}.${F}.${U} <${+G+1}.0.0-0`),i("caret return",L),L})},k=(P,$)=>(i("replaceXRanges",P,$),P.split(/\s+/).map(z=>T(z,$)).join(" ")),T=(P,$)=>{P=P.trim();const z=$.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return P.replace(z,(Y,q,G,F,U,O)=>{i("xRange",P,Y,q,G,F,U,O);const L=w(G),te=L||w(F),re=te||w(U),ue=re;return q==="="&&ue&&(q=""),O=$.includePrerelease?"-0":"",L?q===">"||q==="<"?Y="<0.0.0-0":Y="*":q&&ue?(te&&(F=0),U=0,q===">"?(q=">=",te?(G=+G+1,F=0,U=0):(F=+F+1,U=0)):q==="<="&&(q="<",te?G=+G+1:F=+F+1),q==="<"&&(O="-0"),Y=`${q+G}.${F}.${U}${O}`):te?Y=`>=${G}.0.0${O} <${+G+1}.0.0-0`:re&&(Y=`>=${G}.${F}.0${O} <${G}.${+F+1}.0-0`),i("xRange return",Y),Y})},_=(P,$)=>(i("replaceStars",P,$),P.trim().replace(l[c.STAR],"")),A=(P,$)=>(i("replaceGTE0",P,$),P.trim().replace(l[$.includePrerelease?c.GTE0PRE:c.GTE0],"")),M=P=>($,z,Y,q,G,F,U,O,L,te,re,ue)=>(w(Y)?z="":w(q)?z=`>=${Y}.0.0${P?"-0":""}`:w(G)?z=`>=${Y}.${q}.0${P?"-0":""}`:F?z=`>=${z}`:z=`>=${z}${P?"-0":""}`,w(L)?O="":w(te)?O=`<${+L+1}.0.0-0`:w(re)?O=`<${L}.${+te+1}.0-0`:ue?O=`<=${L}.${te}.${re}-${ue}`:P?O=`<${L}.${te}.${+re+1}-0`:O=`<=${O}`,`${z} ${O}`.trim()),I=(P,$,z)=>{for(let Y=0;Y<P.length;Y++)if(!P[Y].test($))return!1;if($.prerelease.length&&!z.includePrerelease){for(let Y=0;Y<P.length;Y++)if(i(P[Y].semver),P[Y].semver!==o.ANY&&P[Y].semver.prerelease.length>0){const q=P[Y].semver;if(q.major===$.major&&q.minor===$.minor&&q.patch===$.patch)return!0}return!1}return!0};return fE}var pE,n8;function HC(){if(n8)return pE;n8=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(d,f){if(f=n(f),d instanceof t){if(d.loose===!!f.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),s("comparator",d,f),this.options=f,this.loose=!!f.loose,this.parse(d),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(d){const f=this.options.loose?r[o.COMPARATORLOOSE]:r[o.COMPARATOR],p=d.match(f);if(!p)throw new TypeError(`Invalid comparator: ${d}`);this.operator=p[1]!==void 0?p[1]:"",this.operator==="="&&(this.operator=""),p[2]?this.semver=new l(p[2],this.options.loose):this.semver=e}toString(){return this.value}test(d){if(s("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,f){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,f).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,f).test(d.semver):(f=n(f),f.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!f.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,f)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||i(this.semver,">",d.semver,f)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}pE=t;const n=DP,{safeRe:r,t:o}=v1,i=LK,s=BC,l=Fi,c=Ya();return pE}const hVe=Ya(),gVe=(e,t,n)=>{try{t=new hVe(t,n)}catch{return!1}return t.test(e)};var UC=gVe;const mVe=Ya(),vVe=(e,t)=>new mVe(e,t).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));var yVe=vVe;const xVe=Fi,bVe=Ya(),wVe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new bVe(t,n)}catch{return null}return e.forEach(s=>{i.test(s)&&(!r||o.compare(s)===-1)&&(r=s,o=new xVe(r,n))}),r};var SVe=wVe;const CVe=Fi,jVe=Ya(),EVe=(e,t,n)=>{let r=null,o=null,i=null;try{i=new jVe(t,n)}catch{return null}return e.forEach(s=>{i.test(s)&&(!r||o.compare(s)===1)&&(r=s,o=new CVe(r,n))}),r};var TVe=EVe;const hE=Fi,kVe=Ya(),r8=zC,_Ve=(e,t)=>{e=new kVe(e,t);let n=new hE("0.0.0");if(e.test(n)||(n=new hE("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(s=>{const l=new hE(s.semver.version);switch(s.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!i||r8(l,i))&&(i=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!n||r8(n,i))&&(n=i)}return n&&e.test(n)?n:null};var RVe=_Ve;const AVe=Ya(),PVe=(e,t)=>{try{return new AVe(e,t).range||"*"}catch{return null}};var OVe=PVe;const $Ve=Fi,NK=HC(),{ANY:IVe}=NK,MVe=Ya(),DVe=UC,o8=zC,i8=NP,LVe=BP,NVe=FP,FVe=(e,t,n,r)=>{e=new $Ve(e,r),t=new MVe(t,r);let o,i,s,l,c;switch(n){case">":o=o8,i=LVe,s=i8,l=">",c=">=";break;case"<":o=i8,i=NVe,s=o8,l="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(DVe(e,t,r))return!1;for(let u=0;u<t.set.length;++u){const d=t.set[u];let f=null,p=null;if(d.forEach(h=>{h.semver===IVe&&(h=new NK(">=0.0.0")),f=f||h,p=p||h,o(h.semver,f.semver,r)?f=h:s(h.semver,p.semver,r)&&(p=h)}),f.operator===l||f.operator===c||(!p.operator||p.operator===l)&&i(e,p.semver))return!1;if(p.operator===c&&s(e,p.semver))return!1}return!0};var zP=FVe;const BVe=zP,zVe=(e,t,n)=>BVe(e,t,">",n);var HVe=zVe;const UVe=zP,VVe=(e,t,n)=>UVe(e,t,"<",n);var WVe=VVe;const s8=Ya(),GVe=(e,t,n)=>(e=new s8(e,n),t=new s8(t,n),e.intersects(t,n));var qVe=GVe;const YVe=UC,KVe=qa;var XVe=(e,t,n)=>{const r=[];let o=null,i=null;const s=e.sort((d,f)=>KVe(d,f,n));for(const d of s)YVe(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,f]of r)d===f?l.push(d):!f&&d===s[0]?l.push("*"):f?d===s[0]?l.push(`<=${f}`):l.push(`${d} - ${f}`):l.push(`>=${d}`);const c=l.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t};const a8=Ya(),HP=HC(),{ANY:gE}=HP,xm=UC,UP=qa,JVe=(e,t,n={})=>{if(e===t)return!0;e=new a8(e,n),t=new a8(t,n);let r=!1;e:for(const o of e.set){for(const i of t.set){const s=ZVe(o,i,n);if(r=r||s!==null,s)continue e}if(r)return!1}return!0},QVe=[new HP(">=0.0.0-0")],l8=[new HP(">=0.0.0")],ZVe=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===gE){if(t.length===1&&t[0].semver===gE)return!0;n.includePrerelease?e=QVe:e=l8}if(t.length===1&&t[0].semver===gE){if(n.includePrerelease)return!0;t=l8}const r=new Set;let o,i;for(const h of e)h.operator===">"||h.operator===">="?o=c8(o,h,n):h.operator==="<"||h.operator==="<="?i=u8(i,h,n):r.add(h.semver);if(r.size>1)return null;let s;if(o&&i){if(s=UP(o.semver,i.semver,n),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(const h of r){if(o&&!xm(h,String(o),n)||i&&!xm(h,String(i),n))return null;for(const g of t)if(!xm(h,String(g),n))return!1;return!0}let l,c,u,d,f=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,p=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;f&&f.prerelease.length===1&&i.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(const h of t){if(d=d||h.operator===">"||h.operator===">=",u=u||h.operator==="<"||h.operator==="<=",o){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(l=c8(o,h,n),l===h&&l!==o)return!1}else if(o.operator===">="&&!xm(o.semver,String(h),n))return!1}if(i){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(c=u8(i,h,n),c===h&&c!==i)return!1}else if(i.operator==="<="&&!xm(i.semver,String(h),n))return!1}if(!h.operator&&(i||o)&&s!==0)return!1}return!(o&&u&&!i&&s!==0||i&&d&&!o&&s!==0||p||f)},c8=(e,t,n)=>{if(!e)return t;const r=UP(e.semver,t.semver,n);return r>0?e:r<0||t.operator===">"&&e.operator===">="?t:e},u8=(e,t,n)=>{if(!e)return t;const r=UP(e.semver,t.semver,n);return r<0?e:r>0||t.operator==="<"&&e.operator==="<="?t:e};var eWe=JVe;const mE=v1,d8=FC,tWe=Fi,f8=IK,nWe=$g,rWe=cUe,oWe=fUe,iWe=hUe,sWe=mUe,aWe=xUe,lWe=SUe,cWe=EUe,uWe=_Ue,dWe=qa,fWe=OUe,pWe=MUe,hWe=LP,gWe=FUe,mWe=HUe,vWe=zC,yWe=NP,xWe=MK,bWe=DK,wWe=FP,SWe=BP,CWe=LK,jWe=dVe,EWe=HC(),TWe=Ya(),kWe=UC,_We=yVe,RWe=SVe,AWe=TVe,PWe=RVe,OWe=OVe,$We=zP,IWe=HVe,MWe=WVe,DWe=qVe,LWe=XVe,NWe=eWe;var FWe={parse:nWe,valid:rWe,clean:oWe,inc:iWe,diff:sWe,major:aWe,minor:lWe,patch:cWe,prerelease:uWe,compare:dWe,rcompare:fWe,compareLoose:pWe,compareBuild:hWe,sort:gWe,rsort:mWe,gt:vWe,lt:yWe,eq:xWe,neq:bWe,gte:wWe,lte:SWe,cmp:CWe,coerce:jWe,Comparator:EWe,Range:TWe,satisfies:kWe,toComparators:_We,maxSatisfying:RWe,minSatisfying:AWe,minVersion:PWe,validRange:OWe,outside:$We,gtr:IWe,ltr:MWe,intersects:DWe,simplifyRange:LWe,subset:NWe,SemVer:tWe,re:mE.re,src:mE.src,tokens:mE.t,SEMVER_SPEC_VERSION:d8.SEMVER_SPEC_VERSION,RELEASE_TYPES:d8.RELEASE_TYPES,compareIdentifiers:f8.compareIdentifiers,rcompareIdentifiers:f8.rcompareIdentifiers};const Fb=uo(FWe),BWe=e=>()=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?[!1,"Value must be a number"]:[!0,""]},zWe=e=>()=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},HWe=e=>()=>{const t=Fb.clean(e)===e;return!Fb.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},UWe=e=>()=>yg(Js(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],wu=e=>!!e&&Array.isArray(e)&&e.length>0,S_="IN_OPERATORS_LEGAL_VALUES",FK="STRING_OPERATORS_LEGAL_VALUES",BK="NUM_OPERATORS_LEGAL_VALUES",zK="SEMVER_OPERATORS_LEGAL_VALUES",HK="DATE_OPERATORS_SINGLE_VALUE",UK="IN_OPERATORS_FREETEXT",VK="STRING_OPERATORS_FREETEXT",WK="NUM_OPERATORS_SINGLE_VALUE",GK="SEMVER_OPERATORS_SINGLE_VALUE",p8="NUMBER_VALIDATOR",h8="SEMVER_VALIDATOR",vE="STRING_ARRAY_VALIDATOR",g8="DATE_VALIDATOR",VWe=({contextDefinition:e,localConstraint:t})=>{const[n,r]=m.useState(S_),[o,i]=m.useState(vE),[s,l]=m.useState(""),c=m.useCallback(()=>{wu(e.legalValues)&&Qt(Zs,t.operator)?r(S_):wu(e.legalValues)&&Qt(Ai,t.operator)?r(FK):wu(e.legalValues)&&Qt(Ml,t.operator)?r(BK):wu(e.legalValues)&&Qt(Dl,t.operator)?r(zK):Qt(Do,t.operator)?r(HK):Qt(Zs,t.operator)?r(UK):Qt(Ai,t.operator)?r(VK):Qt(Ml,t.operator)?r(WK):Qt(Dl,t.operator)&&r(GK)},[t,e]),u=()=>{switch(o){case p8:return BWe(t.value);case vE:return zWe(t.values||[]);case h8:return HWe(t.value||"");case g8:return UWe(t.value||"")}},d=m.useCallback(f=>{Qt(Ml,f)&&i(p8),Qt([...Ai,...Zs],f)&&i(vE),Qt(Dl,f)&&i(h8),Qt(Do,f)&&i(g8)},[i]);return m.useEffect(()=>{d(t.operator)},[t.operator,t.value,t.values,d]),m.useEffect(()=>{c()},[e,t,c]),{input:n,error:s,validator:u(),setError:l}},WWe=b("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),y1=({children:e,...t})=>a.jsx(WWe,{...t,children:e});function GWe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function m8(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 m0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?m8(Object(n),!0).forEach(function(r){VC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m8(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function VC(e,t,n){return t=eGe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qWe(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 YWe(e,t){if(e==null)return{};var n=qWe(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 KWe(e,t){return XWe(e)||GWe(e,t)||JWe(e,t)||QWe()}function XWe(e){if(Array.isArray(e))return e}function JWe(e,t){if(e){if(typeof e=="string")return v8(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 v8(e,t)}}function v8(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 QWe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
345
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZWe(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eGe(e){var t=ZWe(e,"string");return typeof t=="symbol"?t:String(t)}var tGe={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"},nGe={"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,d:-60,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}},x1={countries:tGe,timezones:nGe},yE;function rGe(e,t){var n=e.countries[t];if(!n)return null;var r=oGe(e)[t]||{};return{id:t,name:n,timezones:r.current||[],allTimezones:r.all||[]}}function oGe(e){return yE||(yE=iGe(e)),yE}function iGe(e){return Object.keys(e.timezones).reduce(function(t,n){var r=e.timezones[n],o=r.c,i=r.a,s=e.timezones[i]||{},l=o||s.c;return l&&l.forEach(function(c){t[c]||Object.assign(t,VC({},c,{current:[],all:[]})),r.r===void 0&&t[c].current.push(n),t[c].all.push(n)}),t},{})}function sGe(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]:{},s=m0(m0({},i),e.timezones[t]),l=s.c||[],c=s.u,u=Number.isInteger(s.d)?s.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:y8(c),dstOffset:u,dstOffsetStr:y8(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function y8(e){var t=Math.floor(Math.abs(e)/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(x8(t),":").concat(x8(n))}function x8(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var aGe=["allTimezones"],lGe=Object.keys(x1.timezones).length,C_={},_v={},qK=0;function cGe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(x1.countries).reduce(function(t,n){return Object.assign(t,VC({},n,WC(n,e)))},{})}function uGe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return lGe!==qK&&Object.keys(x1.timezones).forEach(GC),gGe(_v,e)}function WC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return C_[e]||dGe(rGe(x1,e)),mGe(C_[e],t)}function dGe(e){e&&(C_[e.id]=e)}function GC(e){return _v[e]||fGe(sGe(x1,e)),_v[e]?m0({},_v[e]):null}function fGe(e){e&&(_v[e.name]=e,qK=Object.keys(e).length)}function YK(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=GC(e)||{},r=n.countries||[];return r.map(function(o){return WC(o,t)})}function pGe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=YK(e,t),r=KWe(n,1),o=r[0];return o||null}function hGe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=WC(e,t);if(!n)return null;var r=n.timezones||[];return r.map(GC)}function gGe(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,VC({},i,e[i])),o},{})}function mGe(e,t){if(!e)return null;var n=t||{},r=n.deprecated;e.allTimezones;var o=YWe(e,aGe),i=r?e.allTimezones:e.timezones;return m0(m0({},o),{},{timezones:i})}var KK={getCountry:WC,getTimezone:GC,getAllCountries:cGe,getAllTimezones:uGe,getTimezonesForCountry:hGe,getCountriesForTimezone:YK,getCountryForTimezone:pGe};const vGe=b("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),yGe=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(KK.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[s,l]=m.useState(t||""),c=m.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?a.jsxs(a.Fragment,{children:[a.jsx(y1,{children:"Select a date"}),a.jsxs(vGe,{children:[a.jsx(ar,{id:"date",label:"Date",type:"datetime-local",value:CG(s),onChange:u=>{r("");const d=Y5(u.target.value),f=d==null?void 0:d.toISOString();f&&l(f),f&&e(f)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),a.jsx("p",{children:c})]})]}):null},XK=Va()(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"}})),xGe="Enter",b8=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,s]=m.useState(""),{classes:l}=XK(),c=d=>{d.key===xGe&&(d.preventDefault(),u())},u=()=>{const d=wGe([...e,...kc(i)]);d.length===0?o("values cannot be empty"):d.some(f=>f.length>100)?o("values cannot be longer than 100 characters"):(o(""),s(""),n(d))};return a.jsxs("div",{children:[a.jsx(y1,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(ar,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>s(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(We,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(bGe,{values:e,removeValue:t})})]})},bGe=({values:e,removeValue:t})=>{const{classes:n}=XK();return a.jsx(a.Fragment,{children:e.map((r,o)=>a.jsx(vi,{label:a.jsx(hs,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip},`${r}-${o}`))})},wGe=e=>Array.from(new Set(e)),b1=({filter:e,setFilter:t})=>a.jsx("div",{style:{display:"flex",alignItems:"center"},children:a.jsx("div",{style:{width:"100%"},children:a.jsx(Cn,{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:a.jsx(dd,{position:"start",children:a.jsx(md,{})})}})})}),SGe=Va()(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}})),JK=({legal:e,control:t})=>{const{classes:n}=SGe();return a.jsx("div",{className:n.container,children:a.jsx(Qr,{value:e.value,control:t,label:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:n.value,children:e.value}),a.jsx("div",{className:n.description,children:e.description})]})})})},QK=(e,t)=>e.filter(n=>n.value.includes(t)),xE=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),ZK=e=>new Set(e.map(({value:t})=>t)),eX=(e,t)=>{const n=ZK(t);return e.filter(r=>n.has(r))},CGe=({data:e,values:t,setValues:n,error:r,setError:o,constraintValues:i})=>{const[s,l]=m.useState(""),{legalValues:c,deletedLegalValues:u}=e,d=QK(c,s),[f,p]=m.useState(()=>xE(t)),{classes:h}=e1(),g=y=>{const w=ZK(u);return(y==null?void 0:y.filter(S=>!w.has(S)))||[]},v=eX(i,u);m.useEffect(()=>{p(xE(t))},[t,p,xE]),m.useEffect(()=>{v.length>0&&n(g(t))},[]);const x=y=>{if(o(""),f[y]){const w=t.findIndex(C=>C===y),S=[...t];S.splice(w,1),n(S);return}n([...g(t),y])};return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(v&&v.length>0),show:a.jsxs(Vt,{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:",a.jsx("ul",{children:v==null?void 0:v.map(y=>a.jsx("li",{children:y},y))})]})}),a.jsx(y1,{children:"Select values from a predefined set"}),a.jsx(W,{condition:c.length>100,show:a.jsx(b1,{filter:s,setFilter:l})}),d.map(y=>a.jsx(JK,{legal:y,control:a.jsx(os,{checked:!!f[y.value],onChange:()=>x(y.value),name:y.value,color:"primary",disabled:u.map(({value:w})=>w).includes(y.value)})},y.value)),a.jsx(W,{condition:!!r,show:a.jsx("p",{className:h.error,children:r})})]})},w8=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:s,constraintValue:l})=>{const[c,u]=m.useState(""),{classes:d}=e1(),f=QK(r,c),{deletedLegalValues:p}=s,h=eX([l],p);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(h&&h.length>0),show:a.jsxs(Vt,{severity:"warning",sx:g=>({marginTop:g.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."]})}),a.jsxs(y1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx(W,{condition:r.length>100,show:a.jsx(b1,{filter:c,setFilter:u})}),a.jsx(W,{condition:!!r.length,show:a.jsx(Ua,{component:"fieldset",children:a.jsx(Q0,{"aria-label":"selected-value",name:"selected",value:t,onChange:g=>{i(""),e(g.target.value)},children:f.map(g=>a.jsx(JK,{legal:g,control:a.jsx(jl,{})},g.value))})}),elseShow:a.jsx("p",{children:"No valid legal values available for this operator."})}),a.jsx(W,{condition:!!o,show:a.jsx("p",{className:d.error,children:o})})]})},jGe=Va()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),S8=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=jGe();return a.jsxs(a.Fragment,{children:[a.jsxs(y1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:i.singleValueContainer,children:a.jsx(ar,{label:n,name:"value",value:t||"",onChange:s=>{o(""),e(s.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},bE=(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}},EGe=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:s,setError:l,removeValue:c,error:u})=>{const d=()=>{var f;switch(e){case S_:case FK:return a.jsx(a.Fragment,{children:a.jsx(CGe,{data:bE(n,t.legalValues),constraintValues:n,values:o.values||[],setValues:s,error:u,setError:l})});case BK:return a.jsx(a.Fragment,{children:a.jsx(w8,{data:bE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((f=t.legalValues)==null?void 0:f.filter(p=>Number(p.value)))||[],error:u,setError:l})});case zK:return a.jsx(a.Fragment,{children:a.jsx(w8,{data:bE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:u,setError:l})});case HK:return a.jsx(yGe,{value:o.value,setValue:i,error:u,setError:l});case UK:return a.jsx(b8,{values:o.values||[],removeValue:c,setValues:s,error:u,setError:l});case VK:return a.jsx(a.Fragment,{children:a.jsx(b8,{values:o.values||[],removeValue:c,setValues:s,error:u,setError:l})});case WK:return a.jsx(S8,{setValue:i,value:o.value,type:"number",error:u,setError:l});case GK:return a.jsx(S8,{setValue:i,value:o.value,type:"semver",error:u,setError:l})}};return a.jsx(a.Fragment,{children:d()})},tX="cancel",C8="save",j8=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},TGe=b("div")({padding:0,margin:0,width:"100%"}),kGe=b(Jf)(({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"}}})),_Ge=b(Zf)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),RGe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),AGe=({constraint:e,compact:t,onCancel:n,onSave:r,onDelete:o})=>{const[i,s]=m.useState(Xp(e)),{context:l}=yi(),[c,u]=m.useState(j8(l,i.contextName)),{validateConstraint:d}=dp(),[f,p]=m.useState(!1),[h,g]=m.useState("");m.useEffect(()=>{p(!0)},[]),m.useEffect(()=>{u(j8(l,i.contextName))},[i.contextName,l]);const v=m.useCallback(P=>{s($=>({...$,contextName:P,values:[],value:""}))},[]),x=m.useCallback(P=>{s($=>({...$,operator:P,values:[],value:""}))},[]),y=m.useCallback(P=>{s($=>({...$,values:P}))},[]),w=m.useCallback(P=>{s($=>({...$,value:P}))},[]),S=()=>{s(P=>({...P,inverted:!P.inverted}))},C=m.useCallback(()=>{s(P=>({...P,caseInsensitive:!P.caseInsensitive}))},[]),E=m.useCallback(P=>{const $=[...i.values];$.splice(P,1),y($)},[i,y]),j=()=>{p(!1)},k=()=>{const P=Array.isArray(i.values)&&i.values.length>0,$=!!i.value;return P||$?(M(""),!0):(M("You must provide a value for the constraint"),!1)},T=async()=>{if(!k())return;const[$,z]=A();if($||M(z),$)try{await d(i),M(""),g(C8),j();return}catch(Y){M(Dt(Y))}},{input:_,validator:A,setError:M,error:I}=VWe({contextDefinition:c,localConstraint:i});return m.useEffect(()=>{M(""),s(P=>Xp(P))},[i.operator,i.contextName,M]),a.jsx(TGe,{children:a.jsxs(kGe,{expanded:f,TransitionProps:{onExited:()=>{h===tX?(g(""),n()):h===C8&&(g(""),r(i))}},children:[a.jsx(_Ge,{children:a.jsx(qHe,{localConstraint:i,setLocalConstraint:s,setContextName:v,setOperator:x,action:h,compact:t,setInvertedOperator:S,setCaseInsensitive:C,onDelete:o})}),a.jsx(RGe,{children:a.jsx(EHe,{localConstraint:i,setValues:y,setValue:w,triggerTransition:j,setAction:g,onSubmit:T,children:a.jsx(EGe,{setValues:y,setValue:w,setError:M,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:_,error:I,contextDefinition:c,removeValue:E})})})]})})},qC=(e,t)=>e.value&&e.contextName===Ff?l1(e.value,t.locale):e.value,PGe=b(hs)({whiteSpace:"pre"}),OGe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),$Ge=({values:e})=>{const[t,n]=m.useState("");return!e||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:e.length>20,show:a.jsx(b1,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>a.jsx(OGe,{label:a.jsx(PGe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},IGe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),MGe=b("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),DGe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),LGe=({value:e,operator:t})=>e?a.jsxs(IGe,{children:[a.jsxs(MGe,{children:["Value must be ",t]})," ",a.jsx(DGe,{label:a.jsx(hs,{maxWidth:"400",text:e,maxLength:50})})]}):null,NGe=b("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),FGe=({constraint:e})=>{const{locationSettings:t}=Mi();return a.jsx("div",{children:a.jsxs(NGe,{children:[a.jsx($Ge,{values:e.values}),a.jsx(LGe,{value:qC(e,t),operator:e.operator})]})})},BGe=b("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),zGe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14,color:t?e.palette.text.secondary:e.palette.text.primary})),HGe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallerBody,color:t?e.palette.text.secondary:e.palette.neutral.main})),UGe=({constraint:e,hasPrefix:t,disabled:n=!1})=>{const r=e.operator,o=Nb(e.operator);return a.jsxs(BGe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[a.jsx(zGe,{disabled:n,children:r}),a.jsx(HGe,{disabled:n,children:o})]})},nX=b("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})),VGe=b(nX)(({theme:e})=>({width:"auto",paddingLeft:e.spacing(1),paddingRight:e.spacing(1),marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),E8=m.forwardRef(({isPrefix:e,...t},n)=>a.jsx(W,{condition:!!e,show:()=>a.jsx(VGe,{ref:n,...t}),elseShow:()=>a.jsx(nX,{ref:n,...t})})),WGe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),GGe=b("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),qGe=({constraint:e,disabled:t=!1})=>(It(),a.jsxs(WGe,{children:[a.jsx(W,{condition:!!e.inverted,show:a.jsx(gt,{title:"Operator is negated",arrow:!0,children:a.jsx(ne,{sx:{display:"flex"},children:a.jsx(E8,{isPrefix:!0,children:a.jsx(LC,{})})})})}),a.jsx(GGe,{children:a.jsx(UGe,{constraint:e,hasPrefix:!!e.inverted,disabled:t})}),a.jsx(W,{condition:!e.caseInsensitive&&Qt(Ai,e.operator),show:a.jsx(gt,{title:"Case sensitive is active",arrow:!0,children:a.jsx(E8,{children:a.jsx(NC,{})})})})]})),YGe=b(vi)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),KGe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),XGe=({constraint:e,allowExpand:t,disabled:n=!1})=>{const{locationSettings:r}=Mi();return m.useEffect(()=>{t(!1)},[t]),a.jsx(KGe,{children:a.jsx(YGe,{sx:o=>({color:n?o.palette.text.secondary:"inherit"}),label:qC(e,r)})})},JGe=b("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"}})),QGe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),ZGe=b("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),eqe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),tqe=({constraint:e,expanded:t,allowExpand:n,maxLength:r,disabled:o=!1})=>{var c;const[i,s]=m.useState(!1),l=m.useMemo(()=>{var u;return(u=e==null?void 0:e.values)==null?void 0:u.map(d=>d).join(", ")},[e]);return m.useEffect(()=>{l&&(n(((l==null?void 0:l.length)??0)>r),s(((l==null?void 0:l.length)??0)>r))},[l,r,n,s]),a.jsx(QGe,{children:a.jsxs(ZGe,{children:[a.jsx(JGe,{sx:u=>({color:o?u.palette.text.secondary:"inherit"}),children:l}),a.jsx(W,{condition:i,show:a.jsx(eqe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(c=e==null?void 0:e.values)==null?void 0:c.length})`})})]})})},nqe=b("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"}})),rqe=b("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),oqe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),iqe=({constraint:e,singleValue:t,allowExpand:n,expanded:r,disabled:o=!1,maxLength:i=112})=>a.jsx(rqe,{children:a.jsxs(oqe,{children:[a.jsx(gt,{title:e.contextName,arrow:!0,children:a.jsx(nqe,{sx:s=>({color:o?s.palette.text.secondary:"inherit"}),children:e.contextName})}),a.jsx(qGe,{constraint:e,disabled:o}),a.jsx(W,{condition:t,show:a.jsx(XGe,{constraint:e,allowExpand:n,disabled:o}),elseShow:a.jsx(tqe,{constraint:e,expanded:r,allowExpand:n,maxLength:i,disabled:o})})]})}),sqe=ql("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),aqe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:s,disabled:l})=>{const{context:c}=yi(),{contextName:u}=e,d=!c.map(f=>f.name).includes(u);return a.jsxs(sqe,{children:[a.jsx(DC,{compact:s,disabled:l}),a.jsx(iqe,{constraint:e,singleValue:r,allowExpand:o,expanded:i,disabled:l}),a.jsx(PK,{onEdit:t,onDelete:n,disableEdit:d})]})},lqe=b(Jf)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),cqe=b(Zf)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),uqe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),dqe=b("div")({display:"flex",flexDirection:"column",width:"100%"}),fqe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,disabled:i=!1,renderAfter:s})=>{const[l,c]=m.useState(!0),[u,d]=m.useState(!1),f=Qt([...Dl,...Ml,...Do],e.operator),p=()=>{l&&d(!u)};return a.jsxs(lqe,{expanded:u,sx:r,children:[a.jsx(cqe,{expandIcon:null,onClick:p,sx:{cursor:l?"pointer":"default!important","&:hover":{cursor:l?"pointer":"default!important"}},children:a.jsxs(dqe,{children:[a.jsx(aqe,{constraint:e,onEdit:t,onDelete:n,singleValue:f,allowExpand:c,disabled:i,expanded:u,compact:o}),s]})}),a.jsx(uqe,{children:a.jsx(FGe,{constraint:e})})]})},pqe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:s})=>e?a.jsx(W,{condition:!!(n&&s),show:a.jsx(AGe,{constraint:e,onCancel:o,onSave:s,onDelete:i,compact:t}),elseShow:a.jsx(fqe,{constraint:e,onEdit:r,onDelete:i})}):null,hqe=e=>{const t=m.useRef(e??new WeakMap),[,n]=m.useState(0),r=m.useCallback((i,s)=>{t.current.set(i,s),n(l=>l+1)},[]),o=m.useCallback(i=>t.current.get(i),[]);return m.useMemo(()=>({set:r,get:o}),[r,o])},v0=Symbol("id"),gqe=e=>{const t=MP(e)[0],n=Qt(Do,t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1,[v0]:Uh()}},rX=b("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})),mqe=b(rX)(({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)})),YC=({text:e})=>{const t=It();return a.jsx(ne,{sx:{height:t.spacing(e==="AND"?1:1.5),position:"relative",width:"100%"},children:a.jsx(W,{condition:e==="AND",show:()=>a.jsx(rX,{children:e}),elseShow:()=>a.jsx(mqe,{children:e})})})},VP="constraintAccordionListId",oX=b("div")(({theme:e})=>({width:"100%",display:"flex",flexDirection:"column","&.constraint-list-element":{borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.default}})),vqe=b(gt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)})),yqe=b(Lf)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}})),xqe=b("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary})),bqe=b("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"})),iX=(e,t)=>{const n=hqe(),{context:r}=yi(),o=e&&(s=>{const l=gqe(s);n.set(l,{editing:!0,new:!0}),e(c=>[...c,l])});return m.useImperativeHandle(t,()=>({addConstraint:o})),{onAdd:o&&(()=>{o(r[0].name)}),state:n,context:r}},KC=m.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const{onAdd:i,state:s,context:l}=iX(t,o);return l.length===0?null:a.jsxs(oX,{id:VP,children:[a.jsx(W,{condition:e&&e.length>0&&r,show:a.jsx(xqe,{children:"Constraints"})}),a.jsx(wqe,{ref:o,setConstraints:t,constraints:e,state:s}),a.jsx(W,{condition:!!(n&&i),show:a.jsxs("div",{children:[a.jsxs(bqe,{children:[a.jsx("p",{children:"Add any number of constraints"}),a.jsx(vqe,{title:"View constraints documentation",arrow:!0,children:a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:a.jsx(yqe,{})})})]}),a.jsx(We,{type:"button",onClick:i,variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})]})}),wqe=m.forwardRef(({constraints:e,setConstraints:t,state:n},r)=>{const{context:o}=yi(),i=t&&(u=>{n.set(u,{editing:!0})}),s=t&&(u=>{const d=e[u];n.set(d,{}),t(_i(f=>{f.splice(u,1)}))}),l=t&&((u,d)=>{n.set(d,{}),t(_i(f=>{f[u]=d}))}),c=u=>{var f;const d=e[u];(f=n.get(d))!=null&&f.new&&(s==null||s(u)),n.set(d,{})};return o.length===0?null:a.jsx(oX,{id:VP,className:"constraint-list-element",children:e.map((u,d)=>{var f;return a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:d>0,show:a.jsx(YC,{text:"AND"})}),a.jsx(pqe,{constraint:u,onEdit:i==null?void 0:i.bind(null,u),onCancel:c.bind(null,d),onDelete:s==null?void 0:s.bind(null,d),onSave:l==null?void 0:l.bind(null,d),editing:!!((f=n.get(u))!=null&&f.editing),compact:!0})]},$b(u))})})}),Sqe=b("div")(({theme:e})=>({padding:e.spacing(2)})),Cqe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(2),borderTop:`1px solid ${e.palette.divider}`,width:"100%",padding:e.spacing(2)})),jqe=b("div")({marginLeft:"auto"}),Eqe=b(We)(({theme:e})=>({marginRight:e.spacing(1),minWidth:"125px"}));b(We)(({theme:e})=>({marginLeft:e.spacing(1),minWidth:"125px"}));const Tqe=({localConstraint:e,children:t,triggerTransition:n,setAction:r,onSubmit:o})=>a.jsxs(a.Fragment,{children:[a.jsxs(Sqe,{children:[a.jsx(W,{condition:Qt(EK,e.operator),show:a.jsx(OP,{})}),t]}),a.jsx(Cqe,{children:a.jsx(jqe,{children:a.jsx(Eqe,{type:"button",onClick:o,variant:"outlined",color:"primary","data-testid":"CONSTRAINT_SAVE_BUTTON",children:"Done"})})})]}),kqe=(e,t)=>{const n=`To satisfy this constraint, values passed into the SDK as ${t} must`;if(e===Pg)return`${n} include:`;if(e===CC)return`${n} not include:`;if(e===jC)return`${n} end with:`;if(e===EC)return`${n} start with:`;if(e===TC)return`${n} contain:`;if(e===kC)return`${n} match:`;if(e===_C)return`${n} be greater than:`;if(e===RC)return`${n} be greater than or equal to:`;if(e===AC)return`${n} be less than:`;if(e===PC)return`${n} be less than or equal to:`;if(e===Og)return`${n} be after the following date`;if(e===OC)return`${n} be before the following date:`;if(e===$C)return`${n} match the following version:`;if(e===IC)return`${n} be greater than the following version:`;if(e===MC)return`${n} be less than the following version:`},sX=ql(Ht)(({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"}})),aX=ql(Ht)(({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"}})),_qe=({localConstraint:e,setInvertedOperator:t})=>a.jsx(gt,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(ne,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(W,{condition:!!e.inverted,show:a.jsx(aX,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(LC,{})}),elseShow:a.jsx(sX,{onClick:t,disableRipple:!0,children:a.jsx(kK,{})})})})}),Rqe=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(gt,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(ne,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(W,{condition:!!e.caseInsensitive,show:a.jsx(sX,{onClick:t,disableRipple:!0,children:a.jsx(AK,{})}),elseShow:a.jsx(aX,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(NC,{})})})})});var WP={},Aqe=ze;Object.defineProperty(WP,"__esModule",{value:!0});var XC=WP.default=void 0,Pqe=Aqe(He()),Oqe=a,$qe=(0,Pqe.default)((0,Oqe.jsx)("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"Undo");XC=WP.default=$qe;const Iqe=b("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),lX=({onEdit:e,onDelete:t,onUndo:n,constraintChanges:r=[],disableDelete:o=!1,disableEdit:i=!1})=>{const s=e&&(u=>{u.stopPropagation(),e()}),l=t&&(u=>{u.stopPropagation(),t()}),c=n&&(u=>{u.stopPropagation(),n()});return a.jsxs(Iqe,{children:[a.jsx(W,{condition:!!s&&!i,show:a.jsx(gt,{title:"Edit constraint",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:s,disabled:i,"data-testid":"EDIT_CONSTRAINT_BUTTON",children:a.jsx(Oi,{})})})}),a.jsx(W,{condition:!!c&&r.length>1,show:a.jsx(gt,{title:"Undo last change",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:c,disabled:o,"data-testid":"UNDO_CONSTRAINT_CHANGE_BUTTON",children:a.jsx(XC,{})})})}),a.jsx(W,{condition:!!l&&!o,show:a.jsx(gt,{title:"Delete constraint",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:l,disabled:o,"data-testid":"DELETE_CONSTRAINT_BUTTON",children:a.jsx(co,{})})})})]})},Mqe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),Dqe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(770)]:{flexDirection:"column"}})),Lqe=b("div")(({theme:e})=>({[e.breakpoints.down(770)]:{marginTop:e.spacing(2)},display:"inline-flex"})),Nqe=b("div")(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),Fqe=b(rp)(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),Bqe=b("p")(({theme:e})=>({maxWidth:"400px",fontSize:e.fontSizes.smallBody,[e.breakpoints.down("xl")]:{display:"none"}})),zqe=({compact:e,constraintChanges:t,localConstraint:n,setLocalConstraint:r,setContextName:o,setOperator:i,onDelete:s,onUndo:l,setInvertedOperator:c,setCaseInsensitive:u})=>{const{context:d}=yi(),{contextName:f,operator:p}=n,[h,g]=m.useState(!1),{uiConfig:v}=ht(),x=!!v.flags.caseInsensitiveInOperators;if(m.useEffect(()=>{f===Ff&&!Qt(Do,p)?r(S=>({...S,operator:Og,value:new Date().toISOString()})):f!==Ff&&Qt(Do,p)&&i(Pg),Qt(Ai,p)||Qt(Zs,p)&&x?g(!0):g(!1)},[f,i,p,r,x]),!d)return null;const y=d.map(S=>({key:S.name,label:S.name})),w=S=>{Qt(Ai,S)||Qt(Zs,S)&&x?g(!0):g(!1),Qt(Do,S)?r(C=>({...C,operator:S,value:new Date().toISOString()})):i(S)};return a.jsxs(Mqe,{children:[a.jsx(DC,{}),a.jsxs(Dqe,{children:[a.jsx("div",{children:a.jsx(Fqe,{id:"context-field-select",name:"contextName",label:"Context Field",autoFocus:!0,options:y,value:f||"",onChange:o})}),a.jsxs(Lqe,{children:[a.jsx(_qe,{localConstraint:n,setInvertedOperator:c}),a.jsx(Nqe,{children:a.jsx(TK,{options:MP(f),value:p,onChange:w})}),a.jsx(W,{condition:h,show:a.jsx(Rqe,{localConstraint:n,setCaseInsensitive:u})})]})]}),a.jsx(W,{condition:!e,show:a.jsx(Bqe,{children:kqe(p,f)})}),a.jsx(lX,{onDelete:s,onUndo:l,constraintChanges:t,disableEdit:!0})]})},Hqe=e=>()=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?[!1,"Value must be a number"]:[!0,""]},Uqe=e=>()=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},Vqe=e=>()=>{const t=Fb.clean(e)===e;return!Fb.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},Wqe=e=>()=>yg(Js(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],j_="IN_OPERATORS_LEGAL_VALUES",cX="STRING_OPERATORS_LEGAL_VALUES",uX="NUM_OPERATORS_LEGAL_VALUES",dX="SEMVER_OPERATORS_LEGAL_VALUES",fX="DATE_OPERATORS_SINGLE_VALUE",pX="IN_OPERATORS_FREETEXT",hX="STRING_OPERATORS_FREETEXT",gX="NUM_OPERATORS_SINGLE_VALUE",mX="SEMVER_OPERATORS_SINGLE_VALUE",T8="NUMBER_VALIDATOR",k8="SEMVER_VALIDATOR",wE="STRING_ARRAY_VALIDATOR",_8="DATE_VALIDATOR",Gqe=({contextDefinition:e,localConstraint:t})=>{const[n,r]=m.useState(j_),[o,i]=m.useState(wE),[s,l]=m.useState(""),c=m.useCallback(()=>{wu(e.legalValues)&&Qt(Zs,t.operator)?r(j_):wu(e.legalValues)&&Qt(Ai,t.operator)?r(cX):wu(e.legalValues)&&Qt(Ml,t.operator)?r(uX):wu(e.legalValues)&&Qt(Dl,t.operator)?r(dX):Qt(Do,t.operator)?r(fX):Qt(Zs,t.operator)?r(pX):Qt(Ai,t.operator)?r(hX):Qt(Ml,t.operator)?r(gX):Qt(Dl,t.operator)&&r(mX)},[t,e]),u=()=>{switch(o){case T8:return Hqe(t.value);case wE:return Uqe(t.values||[]);case k8:return Vqe(t.value||"");case _8:return Wqe(t.value||"")}},d=m.useCallback(f=>{Qt(Ml,f)&&i(T8),Qt([...Ai,...Zs],f)&&i(wE),Qt(Dl,f)&&i(k8),Qt(Do,f)&&i(_8)},[i]);return m.useEffect(()=>{d(t.operator)},[t.operator,t.value,t.values,d]),m.useEffect(()=>{c()},[e,t,c]),{input:n,error:s,validator:u(),setError:l}},qqe=b("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular})),w1=({children:e,...t})=>a.jsx(qqe,{...t,children:e}),Yqe=b("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),Kqe=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(KK.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[s,l]=m.useState(t||""),c=m.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?a.jsxs(a.Fragment,{children:[a.jsx(w1,{children:"Select a date"}),a.jsxs(Yqe,{children:[a.jsx(ar,{id:"date",label:"Date",type:"datetime-local",value:CG(s),onChange:u=>{r("");const d=Y5(u.target.value),f=d==null?void 0:d.toISOString();f&&l(f),f&&e(f)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),a.jsx("p",{children:c})]})]}):null},vX=Va()(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"}})),Xqe="Enter",R8=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,s]=m.useState(""),{classes:l}=vX(),c=d=>{d.key===Xqe&&(d.preventDefault(),u())},u=()=>{const d=Qqe([...e,...kc(i)]);d.length===0?o("values cannot be empty"):d.some(f=>f.length>100)?o("values cannot be longer than 100 characters"):(o(""),s(""),n(d))};return a.jsxs(a.Fragment,{children:[a.jsx(w1,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(ar,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>s(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(We,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(Jqe,{values:e,removeValue:t})})]})},Jqe=({values:e,removeValue:t})=>{const{classes:n}=vX();return a.jsx(a.Fragment,{children:e.map((r,o)=>a.jsx(vi,{label:a.jsx(hs,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip,"data-testid":"CONSTRAINT_VALUES_CHIP"},`${r}-${o}`))})},Qqe=e=>Array.from(new Set(e)),Zqe=b("div")(({theme:e})=>({display:"inline-block",wordBreak:"break-word",padding:e.spacing(.5,1),background:e.palette.background.paper,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,"&:hover":{border:`1px solid ${e.palette.primary.main}`}})),eYe=b("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallBody})),tYe=b("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active})),yX=({legal:e,control:t,filter:n,value:r})=>a.jsx(Zqe,{children:a.jsx(Qr,{value:r||e.value,control:t,sx:{width:"100%"},label:a.jsxs(a.Fragment,{children:[a.jsx(eYe,{children:a.jsx(pi,{search:n,children:e.value})}),a.jsx(tYe,{children:a.jsx(pi,{search:n,children:e.description})})]})})}),xX=(e,t)=>e.filter(n=>{var r;return n.value.toLowerCase().includes(t.toLowerCase())||((r=n.description)==null?void 0:r.toLowerCase().includes(t.toLowerCase()))}),SE=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),bX=e=>new Set(e.map(({value:t})=>t)),wX=(e,t)=>{const n=bX(t);return e.filter(r=>n.has(r))},A8=b("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,maxHeight:"378px",overflow:"auto"})),nYe=b(lV)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(.5),justifyContent:"space-between"})),rYe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.error.main})),oYe=({data:e,values:t,setValues:n,setValuesWithRecord:r,error:o,setError:i,constraintValues:s})=>{const[l,c]=m.useState(""),{legalValues:u,deletedLegalValues:d}=e,f=xX(u,l),[p,h]=m.useState(()=>SE(t)),g=Nr("disableShowContextFieldSelectionValues"),v=C=>{const E=bX(d);return(C==null?void 0:C.filter(j=>!E.has(j)))||[]},x=wX(s,d);m.useEffect(()=>{h(SE(t))},[t,h,SE]),m.useEffect(()=>{x.length>0&&n(v(t))},[]);const y=C=>{if(i(""),p[C]){const E=t.findIndex(k=>k===C),j=[...t];j.splice(E,1),r(j);return}r([...v(t),C])},w=u.every(C=>t.includes(C.value)),S=()=>{if(w)return r([]);r([...u.map(C=>C.value)])};return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(x&&x.length>0),show:a.jsxs(Vt,{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:",a.jsx("ul",{children:x==null?void 0:x.map(C=>a.jsx("li",{children:C},C))})]})}),a.jsxs(nYe,{direction:"row",children:[a.jsx(w1,{children:"Select values from a predefined set"}),a.jsx(We,{variant:"text",onClick:S,children:w?"Unselect all":"Select all"})]}),a.jsx(W,{condition:u.length>100,show:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!g&&!!t,show:a.jsx(A8,{sx:{border:0},children:t.map(C=>a.jsx(vi,{label:C,onDelete:()=>y(C)},C))})}),a.jsx(b1,{filter:l,setFilter:c})]})}),a.jsx(A8,{children:f.map(C=>a.jsx(yX,{legal:C,filter:l,control:a.jsx(os,{checked:!!p[C.value],onChange:()=>y(C.value),name:C.value,color:"primary",disabled:d.map(({value:E})=>E).includes(C.value)})},C.value))}),a.jsx(W,{condition:!!o,show:a.jsx(rYe,{children:o})})]})},iYe=b("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,maxHeight:"378px",overflow:"auto"})),P8=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:s,constraintValue:l})=>{const[c,u]=m.useState(""),{classes:d}=e1(),f=xX(r,c),{deletedLegalValues:p}=s,h=wX([l],p);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(h&&h.length>0),show:a.jsxs(Vt,{severity:"warning",sx:g=>({marginTop:g.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."]})}),a.jsxs(w1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx(W,{condition:r.length>100,show:a.jsx(b1,{filter:c,setFilter:u})}),a.jsx(W,{condition:!!r.length,show:a.jsx(iYe,{children:a.jsx(Ua,{component:"fieldset",children:a.jsx(Q0,{"aria-label":"selected-value",name:"selected",value:t,sx:{gap:g=>g.spacing(.5)},onChange:g=>{i(""),e(g.target.value)},children:f.map(g=>a.jsx(yX,{legal:g,control:a.jsx(jl,{})},g.value))})})}),elseShow:a.jsx("p",{children:"No valid legal values available for this operator."})}),a.jsx(W,{condition:!!o,show:a.jsx("p",{className:d.error,children:o})})]})},sYe=Va()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),O8=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=sYe();return a.jsxs(a.Fragment,{children:[a.jsxs(w1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:i.singleValueContainer,children:a.jsx(ar,{label:n,name:"value",value:t||"",onChange:s=>{o(""),e(s.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},CE=(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}},aYe=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:s,setValuesWithRecord:l,setError:c,removeValue:u,error:d})=>{const f=()=>{var p;switch(e){case j_:case cX:return a.jsx(a.Fragment,{children:a.jsx(oYe,{data:CE(n,t.legalValues),constraintValues:n,values:o.values||[],setValuesWithRecord:l,setValues:s,error:d,setError:c})});case uX:return a.jsx(a.Fragment,{children:a.jsx(P8,{data:CE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((p=t.legalValues)==null?void 0:p.filter(h=>Number(h.value)))||[],error:d,setError:c})});case dX:return a.jsx(a.Fragment,{children:a.jsx(P8,{data:CE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:d,setError:c})});case fX:return a.jsx(Kqe,{value:o.value,setValue:i,error:d,setError:c});case pX:return a.jsx(R8,{values:o.values||[],removeValue:u,setValues:l,error:d,setError:c});case hX:return a.jsx(a.Fragment,{children:a.jsx(R8,{values:o.values||[],removeValue:u,setValues:l,error:d,setError:c})});case gX:return a.jsx(O8,{setValue:i,value:o.value,type:"number",error:d,setError:c});case mX:return a.jsx(O8,{setValue:i,value:o.value,type:"semver",error:d,setError:c})}};return a.jsx(a.Fragment,{children:f()})},$8="save",I8=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},lYe=b("div")({padding:0,margin:0,width:"100%"}),cYe=b(Jf)(({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"}}})),uYe=b(Zf)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),dYe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),fYe=({constraint:e,compact:t,onSave:n,onDelete:r,onAutoSave:o})=>{const[i,s]=m.useState(Xp(e)),[l,c]=m.useState([Xp(e)]),{context:u}=yi(),[d,f]=m.useState(I8(u,i.contextName)),{validateConstraint:p}=dp(),[h,g]=m.useState(!1),[v,x]=m.useState(""),{input:y,validator:w,setError:S,error:C}=Gqe({contextDefinition:d,localConstraint:i});m.useEffect(()=>{g(!0)},[]),m.useEffect(()=>{f(I8(u,i.contextName))},[i.contextName,u]),m.useEffect(()=>{S("")},[S]);const E=()=>{if(l.length<2)return;const F=l[l.length-2];s(F),c(U=>U.slice(0,U.length-1)),j(F)},j=F=>{o&&o(F)},k=F=>{c(U=>[...U,F]),j(F)},T=m.useCallback(F=>{s(U=>{const O=Xp({...U,contextName:F,values:[],value:""});return k(O),O})},[]),_=m.useCallback(F=>{s(U=>{const O=Xp({...U,operator:F,values:[],value:""});return k(O),O})},[]),A=m.useCallback(F=>{s(U=>{const O={...U,values:F};return k(O),O})},[]),M=m.useCallback(F=>{s(U=>({...U,values:F}))},[]),I=m.useCallback(F=>{s(U=>{const O={...U,value:F};return k(O),O})},[]),P=()=>{s(F=>{const U={...F,inverted:!F.inverted};return k(U),U})},$=m.useCallback(()=>{s(F=>{const U={...F,caseInsensitive:!F.caseInsensitive};return k(U),U})},[]),z=m.useCallback(F=>{const U=[...i.values];U.splice(F,1),A(U)},[i,A]),Y=()=>{g(!1)},q=()=>{const F=Array.isArray(i.values)&&i.values.length>0,U=!!i.value;return F||U?(S(""),!0):(S("You must provide a value for the constraint"),!1)},G=async()=>{if(!q())return;const[U,O]=w();if(U||S(O),U)try{await p(i),S(""),x($8),Y();return}catch(L){S(Dt(L))}};return a.jsx(lYe,{children:a.jsxs(cYe,{expanded:h,TransitionProps:{onExited:()=>{v===$8&&(x(""),n(i))}},children:[a.jsx(uYe,{children:a.jsx(zqe,{localConstraint:i,setLocalConstraint:s,setContextName:T,setOperator:_,action:v,compact:t,setInvertedOperator:P,setCaseInsensitive:$,onDelete:r,onUndo:E,constraintChanges:l})}),a.jsx(dYe,{children:a.jsx(Tqe,{localConstraint:i,setValues:M,setValue:I,triggerTransition:Y,setAction:x,onSubmit:G,children:a.jsx(aYe,{setValues:M,setValuesWithRecord:A,setValue:I,setError:S,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:y,error:C,contextDefinition:d,removeValue:z})})})]})})},pYe=({filter:e,setFilter:t})=>a.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a.jsx("div",{style:{width:"300px"},children:a.jsx(Cn,{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:a.jsx(dd,{position:"start",children:a.jsx(md,{})})}})}),a.jsx(W,{condition:!!e,show:a.jsx(vi,{style:{marginLeft:"1rem"},label:`filter active: ${e}`,onDelete:()=>t("")})})]}),hYe=b(hs)({whiteSpace:"pre"}),gYe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),mYe=({values:e})=>{const[t,n]=m.useState("");return!e||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:e.length>20,show:a.jsx(pYe,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>a.jsx(gYe,{label:a.jsx(hYe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},vYe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),yYe=b("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),xYe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),bYe=({value:e,operator:t})=>e?a.jsxs(vYe,{children:[a.jsxs(yYe,{children:["Value must be ",t]})," ",a.jsx(xYe,{label:a.jsx(hs,{maxWidth:"400",text:e,maxLength:50})})]}):null,wYe=b("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),SYe=({constraint:e})=>{const{locationSettings:t}=Mi();return a.jsx("div",{children:a.jsxs(wYe,{children:[a.jsx(mYe,{values:e.values}),a.jsx(bYe,{value:qC(e,t),operator:e.operator})]})})},CYe=b("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),jYe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14,color:t?e.palette.text.secondary:e.palette.text.primary})),EYe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallerBody,color:t?e.palette.text.secondary:e.palette.neutral.main})),TYe=({constraint:e,hasPrefix:t,disabled:n=!1})=>{const r=e.operator,o=Nb(e.operator);return a.jsxs(CYe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[a.jsx(jYe,{disabled:n,children:r}),a.jsx(EYe,{disabled:n,children:o})]})},SX=b("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})),kYe=b(SX)(({theme:e})=>({width:"auto",paddingLeft:e.spacing(1),paddingRight:e.spacing(1),marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),M8=m.forwardRef(({isPrefix:e,...t},n)=>a.jsx(W,{condition:!!e,show:()=>a.jsx(kYe,{ref:n,...t}),elseShow:()=>a.jsx(SX,{ref:n,...t})})),_Ye=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),RYe=b("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),AYe=({constraint:e,disabled:t=!1})=>(It(),a.jsxs(_Ye,{children:[a.jsx(W,{condition:!!e.inverted,show:a.jsx(gt,{title:"Operator is negated",arrow:!0,children:a.jsx(ne,{sx:{display:"flex"},children:a.jsx(M8,{isPrefix:!0,children:a.jsx(LC,{})})})})}),a.jsx(RYe,{children:a.jsx(TYe,{constraint:e,hasPrefix:!!e.inverted,disabled:t})}),a.jsx(W,{condition:!e.caseInsensitive&&Qt(Ai,e.operator),show:a.jsx(gt,{title:"Case sensitive is active",arrow:!0,children:a.jsx(M8,{children:a.jsx(NC,{})})})})]})),PYe=b(vi)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),OYe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),$Ye=({constraint:e,allowExpand:t,disabled:n=!1})=>{const{locationSettings:r}=Mi();return m.useEffect(()=>{t(!1)},[t]),a.jsx(OYe,{children:a.jsx(PYe,{sx:o=>({color:n?o.palette.text.secondary:"inherit"}),label:qC(e,r)})})},IYe=b("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"}})),MYe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),DYe=b("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),LYe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),NYe=({constraint:e,expanded:t,allowExpand:n,maxLength:r,disabled:o=!1})=>{var c;const[i,s]=m.useState(!1),l=m.useMemo(()=>{var u;return(u=e==null?void 0:e.values)==null?void 0:u.map(d=>d).join(", ")},[e]);return m.useEffect(()=>{l&&(n(((l==null?void 0:l.length)??0)>r),s(((l==null?void 0:l.length)??0)>r))},[l,r,n,s]),a.jsx(MYe,{children:a.jsxs(DYe,{children:[a.jsx(IYe,{sx:u=>({color:o?u.palette.text.secondary:"inherit"}),children:l}),a.jsx(W,{condition:i,show:a.jsx(LYe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(c=e==null?void 0:e.values)==null?void 0:c.length})`})})]})})},FYe=b("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"}})),BYe=b("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),zYe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),HYe=({constraint:e,singleValue:t,allowExpand:n,expanded:r,disabled:o=!1,maxLength:i=112})=>a.jsx(BYe,{children:a.jsxs(zYe,{children:[a.jsx(gt,{title:e.contextName,arrow:!0,children:a.jsx(FYe,{sx:s=>({color:o?s.palette.text.secondary:"inherit"}),children:e.contextName})}),a.jsx(AYe,{constraint:e,disabled:o}),a.jsx(W,{condition:t,show:a.jsx($Ye,{constraint:e,allowExpand:n,disabled:o}),elseShow:a.jsx(NYe,{constraint:e,expanded:r,allowExpand:n,maxLength:i,disabled:o})})]})}),UYe=ql("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),VYe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:s,disabled:l})=>{const{context:c}=yi(),{contextName:u}=e,d=!c.map(f=>f.name).includes(u);return a.jsxs(UYe,{children:[a.jsx(DC,{compact:s,disabled:l}),a.jsx(HYe,{constraint:e,singleValue:r,allowExpand:o,expanded:i,disabled:l}),a.jsx(lX,{onEdit:t,onDelete:n,disableEdit:d})]})},WYe=b(Jf)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),GYe=b(Zf)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),qYe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),YYe=b("div")({display:"flex",flexDirection:"column",width:"100%"}),KYe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,disabled:i=!1,renderAfter:s})=>{const[l,c]=m.useState(!0),[u,d]=m.useState(!1),f=Qt([...Dl,...Ml,...Do],e.operator),p=()=>{l&&d(!u)};return a.jsxs(WYe,{expanded:u,sx:r,children:[a.jsx(GYe,{expandIcon:null,onClick:p,sx:{cursor:l?"pointer":"default!important","&:hover":{cursor:l?"pointer":"default!important"}},children:a.jsxs(YYe,{children:[a.jsx(VYe,{constraint:e,onEdit:t,onDelete:n,singleValue:f,allowExpand:c,disabled:i,expanded:u,compact:o}),s]})}),a.jsx(qYe,{children:a.jsx(SYe,{constraint:e})})]})},XYe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:s,onAutoSave:l})=>e?a.jsx(W,{condition:!!(n&&s),show:a.jsx(fYe,{constraint:e,onCancel:o,onSave:s,onDelete:i,onAutoSave:l,compact:t}),elseShow:a.jsx(KYe,{constraint:e,onEdit:r,onDelete:i})}):null,JYe="constraintAccordionListId",QYe=b("div")({width:"100%",display:"flex",flexDirection:"column"});b(gt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)}));b(Lf)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}}));b("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary}));b("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"}));const ZYe=m.forwardRef(({constraints:e,setConstraints:t,state:n},r)=>{const{context:o}=yi(),i=t&&(d=>{n.set(d,{editing:!0})}),s=t&&(d=>{const f=e[d];n.set(f,{}),t(_i(p=>{p.splice(d,1)}))}),l=t&&((d,f)=>{n.set(f,{}),t(_i(p=>{p[d]=f}))}),c=t&&(d=>f=>{n.set(f,{editing:!0}),t(_i(p=>p.map(h=>h[v0]===d?f:h)))}),u=d=>{var p;const f=e[d];(p=n.get(f))!=null&&p.new&&(s==null||s(d)),n.set(f,{})};return o.length===0?null:a.jsx(QYe,{id:JYe,children:e.map((d,f)=>{var h;const p=d[v0];return a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:f>0,show:a.jsx(YC,{text:"AND"})}),a.jsx(XYe,{constraint:d,onEdit:i==null?void 0:i.bind(null,d),onCancel:u.bind(null,f),onDelete:s==null?void 0:s.bind(null,f),onSave:l==null?void 0:l.bind(null,f),onAutoSave:c==null?void 0:c(p),editing:!!((h=n.get(d))!=null&&h.editing),compact:!0})]},p)})})}),eKe="constraintAccordionListId",tKe=b("div")({width:"100%",display:"flex",flexDirection:"column"});b(gt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)}));b(Lf)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}}));b("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary}));b("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"}));const nKe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),rKe=m.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const{onAdd:i,state:s,context:l}=iX(t,o);return l.length===0?null:a.jsx(tKe,{id:eKe,children:a.jsx(W,{condition:!!(n&&i),show:a.jsxs("div",{children:[a.jsxs(nKe,{children:[a.jsx(Z,{children:"Constraints"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsx(ne,{children:a.jsxs(Z,{variant:"body2",children:["Constraints are advanced targeting rules that you can use to enable a feature flag for a subset of your users. Read more about constraints"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),a.jsx(ZYe,{ref:o,setConstraints:t,constraints:e,state:s}),a.jsx(We,{sx:{marginTop:"1rem"},type:"button",onClick:i,startIcon:a.jsx(ni,{}),variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})})}),oKe=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},iKe=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{m.useEffect(()=>()=>{n.constraints&&r(c=>{var u;return{...c,constraints:(u=c.constraints)==null?void 0:u.filter(oKe)}})},[]);const o=n.constraints||[],i=c=>{r(u=>({...u,constraints:c instanceof Function?c(u.constraints||[]):c}))},s=Fh(rq,e,t),l=Fh(YS,e,t);return a.jsx(rKe,{constraints:o,setConstraints:l?i:void 0,showCreateButton:s})},D8=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},GP=e=>{const t=!!(e&&e.length===0),[n,r]=m.useState(t),{validateConstraint:o}=dp();return m.useEffect(()=>{if(!e)return;if(e.find(l=>!D8(l))){r(!1);return}const s=e.filter(D8).map(l=>o(l));Promise.all(s).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},sKe=Va()(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}}})),aKe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}}));b("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}));const lKe=b(ep)({flex:1}),CX=({label:e,options:t,value:n=[],onChange:r,disabled:o})=>{const[i,s]=m.useState("Add Segments");sKe();const l=It(),c=u=>{const{InputProps:d}=u;return a.jsx(Cn,{...u,InputProps:{...d,startAdornment:a.jsx(dd,{position:"start",children:a.jsx(ni,{sx:{height:20,width:20,color:l.palette.primary.main}})})},variant:"outlined",sx:{width:"215px","& .MuiOutlinedInput-root":{"& .MuiInputBase-input":{color:l.palette.primary.main,opacity:1,"&::placeholder":{color:l.palette.primary.main,fontWeight:"bold",opacity:1}},"& .MuiOutlinedInput-notchedOutline":{borderColor:l.palette.primary.main,opacity:.5},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"1px"}}},placeholder:e,onFocus:()=>s(""),onBlur:()=>s(e)})};return a.jsx(aKe,{children:a.jsx(lKe,{options:t,value:n,onChange:(u,d)=>r(d||[]),renderInput:c,getOptionLabel:u=>u.label,disabled:o,size:"small",multiple:!0})})};var qP={},cKe=ze;Object.defineProperty(qP,"__esModule",{value:!0});var jX=qP.default=void 0,uKe=cKe(He()),dKe=a,fKe=(0,uKe.default)((0,dKe.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");jX=qP.default=fKe;const pKe=b("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})),L8=b("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer"})),hKe=b(ln)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),jE=e=>({fontSize:e.fontSizes.bodySize}),gKe=({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)},s=a.jsx(W,{condition:e===n,show:a.jsx(gC,{titleAccess:"Hide",sx:jE}),elseShow:a.jsx(hC,{titleAccess:"Show",sx:jE})}),l=e===n?"Hide segment constraints":"Preview segment constraints";return a.jsxs(pKe,{children:[a.jsx(hKe,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),a.jsx(gt,{title:l,arrow:!0,children:a.jsx(L8,{type:"button",onClick:i,"aria-expanded":e===n,"aria-controls":VP,children:s})}),a.jsx(gt,{title:"Remove segment",arrow:!0,children:a.jsx(L8,{type:"button",onClick:o,children:a.jsx(jX,{titleAccess:"Remove",sx:jE})})})]})};var YP={},mKe=ze;Object.defineProperty(YP,"__esModule",{value:!0});var KP=YP.default=void 0,vKe=mKe(He()),yKe=a,xKe=(0,vKe.default)((0,yKe.jsx)("path",{d:"M11 5.08V2c-5 .5-9 4.81-9 10s4 9.5 9 10v-3.08c-3-.48-6-3.4-6-6.92s3-6.44 6-6.92zM18.97 11H22c-.47-5-4-8.53-9-9v3.08C16 5.51 18.54 8 18.97 11zM13 18.92V22c5-.47 8.53-4 9-9h-3.03c-.43 3-2.97 5.49-5.97 5.92z"}),"DonutLarge");KP=YP.default=xKe;const bKe=b(Jf,{shouldForwardProp:e=>e!=="isDisabled"})(({theme:e,isDisabled:t})=>({border:`1px solid ${e.palette.divider}`,"&.segment-accordion":{borderRadius:e.shape.borderRadiusMedium},boxShadow:"none",margin:0,transition:"all 0.1s ease","&:before":{opacity:"0 !important"},"&.Mui-expanded":{backgroundColor:e.palette.neutral.light},backgroundColor:t?e.palette.envAccordion.disabled:e.palette.background.paper})),wKe=b(Zf)(({theme:e})=>({margin:e.spacing(0,.5),fontSize:e.typography.body2.fontSize,".MuiAccordionSummary-content":{display:"flex",alignItems:"center"}})),SKe=b(ln)(({theme:e})=>({textDecoration:"none",marginLeft:e.spacing(1),"&:hover":{textDecoration:"underline"}})),CKe=b("span",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({color:t?e.palette.text.secondary:"inherit"})),EX=({segment:e,isExpanded:t,headerContent:n,constraintList:r,disabled:o=!1})=>{var l;const[i,s]=m.useState(t||!1);return a.jsxs(bKe,{className:"segment-accordion",isDisabled:o,expanded:i,children:[a.jsxs(wKe,{id:`segment-accordion-${e.id}`,children:[a.jsx(KP,{sx:c=>({mr:1,color:o?c.palette.neutral.border:c.palette.secondary.main})}),a.jsx(CKe,{disabled:o,children:"Segment:"}),a.jsx(SKe,{to:`/segments/edit/${e.id}`,children:e.name}),a.jsx(W,{condition:!!n,show:n}),a.jsx(W,{condition:!t,show:a.jsx(We,{size:"small",variant:"outlined",onClick:()=>s(c=>!c),sx:{my:0,ml:"auto",fontSize:c=>c.typography.body2.fontSize},children:i?"Close preview":"Preview"})})]}),a.jsx(Qf,{sx:{pt:0},children:a.jsx(W,{condition:!!r,show:r,elseShow:a.jsx(W,{condition:(((l=e==null?void 0:e.constraints)==null?void 0:l.length)||0)>0,show:a.jsx(KC,{constraints:e.constraints,showLabel:!1}),elseShow:a.jsx(Z,{children:"This segment has no constraints."})})})})]})},jKe=b("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),EKe=b("p")(({theme:e})=>({color:e.palette.text.secondary})),TKe=b("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})),kKe=({segments:e,setSegments:t})=>{const[n,r]=m.useState(),o=e.length-1;return e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:e&&e.length>0,show:a.jsx(EKe,{children:"Selected Segments"})}),a.jsx(jKe,{children:e.map((i,s)=>a.jsxs(m.Fragment,{children:[a.jsx(gKe,{segment:i,setSegments:t,preview:n,setPreview:r}),a.jsx(W,{condition:s<o,show:a.jsx(TKe,{children:"AND"})})]},i.id))}),a.jsx(W,{condition:!!n,show:()=>a.jsx(EX,{segment:n,isExpanded:!0})})]})},fp=()=>{const{uiConfig:e}=ht();return{segmentValuesLimit:e.segmentValuesLimit,strategySegmentsLimit:e.strategySegmentsLimit}},_Ke=()=>{const{segmentValuesLimit:e}=fp();return typeof e>"u"?null:a.jsxs(Vt,{severity:"info",children:["A segment can have"," ",a.jsxs("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," across all of its contraints"]}),". ",a.jsx(TX,{})]})},RKe=e=>{const{segmentValuesLimit:t}=fp();return typeof t>"u"?null:a.jsxs(Vt,{severity:"error",children:["A segment can have"," ",a.jsxs("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","."]})},AKe=()=>{const{strategySegmentsLimit:e}=fp();return typeof e>"u"?null:a.jsxs(Vt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",a.jsx(TX,{})]})},TX=()=>a.jsxs(a.Fragment,{children:[a.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),kX="https://docs.getunleash.io/reference/segments";b(vr)(({theme:e})=>({fontSize:e.fontSizes.smallBody}));const PKe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),OKe=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=Wc(),{strategySegmentsLimit:o}=fp(),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(f=>f.id===d.id)).map(d=>({value:String(d.id),label:d.name})),u=([d])=>{const f=r.find(p=>String(p.id)===d.value);f&&t(p=>[...p,f])};return a.jsxs(a.Fragment,{children:[a.jsxs(PKe,{children:[a.jsx(Z,{children:"Segments"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsx(ne,{children:a.jsxs(Z,{variant:"body2",children:["Segments are reusable sets of constraints that can be defined once and reused across feature toggle configurations. You can create a segment on the global or the project level. Read more about segments"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),i&&a.jsx(AKe,{}),a.jsx(CX,{label:"Select segments",options:c,onChange:u,disabled:i}),a.jsx(kKe,{segments:e,setSegments:t})]})},$Ke=(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"&&!IKe(t))return"Not a valid number."}},IKe=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),MKe=({environment:e})=>a.jsxs(Vt,{severity:"info",children:[a.jsx("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."]}),E_="production",DKe=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const{value:i,setValue:s}=XP(),[l,c]=m.useState(i.hide),u=()=>{s(d=>({hide:!d.hide})),c(d=>!d)};return a.jsxs(rr,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[a.jsx(Vt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),a.jsx("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),a.jsx(Qr,{label:"Don't show again",control:a.jsx(os,{checked:l,onChange:u})})]})},LKe=(e,t)=>{var r;const{value:n}=XP();return n.hide?!1:typeof e=="string"?e===E_:(r=e==null?void 0:e.environments)==null?void 0:r.some(o=>o.name===t&&o.type===E_)},NKe="useFeatureStrategyProdGuardSettings:v2",XP=()=>Xl(NKe,{hide:!1}),REt=e=>{const{value:t}=XP();return e===E_&&!t.hide},FKe=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&Qt(["In review","Approved"],r.state)):!1,alert:a.jsx(Vt,{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?"})}),BKe=({title:e,setTitle:t})=>a.jsxs(ne,{sx:{paddingBottom:n=>n.spacing(2)},children:[a.jsx(Z,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),a.jsx(ar,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),zKe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),HKe=({enabled:e,onToggleEnabled:t})=>a.jsxs(zKe,{children:[a.jsx(Z,{children:"Strategy Status"}),a.jsx(Qr,{control:a.jsx(is,{name:"enabled",onChange:t,checked:e}),label:"Enabled"})]});var JP={},UKe=ze;Object.defineProperty(JP,"__esModule",{value:!0});var _X=JP.default=void 0,VKe=UKe(He()),WKe=a,GKe=(0,VKe.default)((0,WKe.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"}),"Cloud");_X=JP.default=GKe;const qKe=({enabled:e,className:t})=>{const n=It(),r=e?"Environment enabled":"Environment disabled",o={backgroundColor:e?n.palette.primary.light:n.palette.neutral.border,borderRadius:"50%",width:"28px",height:"28px",minWidth:"28px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:n.spacing(1)},i={fill:n.palette.common.white,width:"16px",height:"16px"};return a.jsx("div",{style:o,className:t,children:a.jsx(_X,{style:i,titleAccess:r})})},YKe=b(ne)(({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,width:"45px",position:"absolute",top:"-10px",left:"calc(50% - 45px)",lineHeight:1})),KKe=b("form")(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(6),paddingBottom:e.spacing(12),paddingTop:e.spacing(4),overflow:"auto",height:"100%"})),XKe=b("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),JKe=b("div")(({theme:e})=>({bottom:0,right:0,left:0,position:"absolute",display:"flex",padding:e.spacing(3),paddingRight:e.spacing(6),paddingLeft:e.spacing(6),backgroundColor:e.palette.background.paper,justifyContent:"end",borderTop:`1px solid ${e.palette.divider}`})),QKe=b(AV)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),ZKe=b(ne)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),eXe=b(vr)(({theme:e})=>({width:"100%"})),tXe=b("div")(({theme:e})=>({color:e.palette.text.secondary,marginTop:e.spacing(1.5)})),nXe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),rXe=b(ne)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),oXe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center"})),iXe=b(ne)(({theme:e})=>({transform:"scale(0.9)",display:"flex",alignItems:"center"})),sXe=b(Z)(({theme:e,enabled:t})=>({fontWeight:t?"bold":"normal"})),aXe=b(Z)(({theme:e})=>({marginRight:e.spacing(.5),color:e.palette.text.secondary})),lXe=b(pb)(({theme:e})=>({width:"100px"})),N8=b(qt)(({theme:e})=>({marginLeft:e.spacing(1)})),RX=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:s,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:f,isChangeRequest:p,tab:h,setTab:g,StrategyVariants:v})=>{var ue,ve;const{trackEvent:x}=Sn(),[y,w]=m.useState(!1),S=GP(l.constraints),C=LKe(t,n),E=Fh(r,e,n),{strategyDefinition:j}=AP(l==null?void 0:l.name);m.useEffect(()=>{x("new-strategy-form",{props:{eventType:"seen"}})});const k=l!=null&&l.parameters&&"stickiness"in(l==null?void 0:l.parameters)?String(l.parameters.stickiness):"default";m.useEffect(()=>{c(Ce=>({...Ce,variants:(l.variants||[]).map(J=>({stickiness:k,name:J.name,weight:J.weight,payload:J.payload,weightType:J.weightType}))}))},[k,JSON.stringify(l.variants)]);const T=t.environments.find(Ce=>Ce.name===n),{data:_}=wC(t.project),{changeRequestInReviewOrApproved:A,alert:M}=FKe(_),I=A(n||""),P=I?"Add to existing change request":"Add change to draft",$=$t(),{error:z,loading:Y}=ht();if(z)throw z;if(Y||!j)return null;const q=Ce=>j.parameters.find(J=>J.name===Ce),G=(Ce,J)=>{const oe=$Ke(q(Ce),J);return oe?(f.setFormError(Ce,oe),!1):(f.removeFormError(Ce),!0)},F=()=>j.parameters.map(Ce=>Ce.name).map(Ce=>{var J;return G(Ce,(J=l.parameters)==null?void 0:J[Ce])}).every(Boolean),U=()=>{$(QP(t.project,t.name))},O=async Ce=>{var J;Array.isArray(l.variants)&&((J=l.variants)==null?void 0:J.length)>0&&x("strategy-variants",{props:{eventType:"submitted"}}),Ce.preventDefault(),F()&&(x("new-strategy-form",{props:{eventType:"submitted"}}),C&&!p?w(!0):o())},L=(Ce,J)=>{g(J)},te=()=>{var oe;const Ce=((oe=l.constraints)==null?void 0:oe.length)||0,J=u.length||0;return Ce+J},re=l.parameters&&"stickiness"in l.parameters;return a.jsxs(a.Fragment,{children:[a.jsxs(nXe,{children:[a.jsxs(XKe,{children:[td(l.name||""),a.jsx(W,{condition:l.name==="flexibleRollout",show:a.jsxs(qt,{color:"success",sx:{marginLeft:"1rem"},children:[(ue=l.parameters)==null?void 0:ue.rollout,"%"]})})]}),T?a.jsxs(oXe,{children:[a.jsx(aXe,{children:"Environment:"}),a.jsxs(iXe,{children:[a.jsx(qKe,{enabled:T.enabled})," ",a.jsx(sXe,{enabled:T.enabled,children:T.name})]})]}):null]}),a.jsxs(rXe,{children:[a.jsx(W,{condition:I,show:M,elseShow:a.jsx(W,{condition:p,show:a.jsx(MKe,{environment:n})})}),a.jsx(W,{condition:!Jq.includes(l.name||"default"),show:a.jsxs(Vt,{severity:"warning",children:["Custom strategies are deprecated. We recommend not adding them to any flags going forward and using the predefined strategies like Gradual rollout with"," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",variant:"body2",children:"constraints"})," ","instead."]})}),a.jsx(mHe,{projectId:t.project,featureId:t.name,environmentId:n,children:a.jsx(W,{condition:!!p,show:a.jsxs(Vt,{severity:"success",children:["This feature flag is currently enabled in the"," ",a.jsx("strong",{children:n})," environment. Any changes made here will be available to users as soon as these changes are approved and applied."]}),elseShow:a.jsxs(Vt,{severity:"success",children:["This feature flag is currently enabled in the"," ",a.jsx("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit ",a.jsx("strong",{children:"save"}),"."]})})})]}),a.jsxs(QKe,{value:h,onChange:L,children:[a.jsx(lXe,{label:"General"}),a.jsx(pb,{"data-testid":"STRATEGY_TARGETING_TAB",label:a.jsxs(Z,{children:["Targeting",a.jsx(N8,{children:te()})]})}),re&&a.jsx(pb,{"data-testid":"STRATEGY_VARIANTS_TAB",label:a.jsxs(Z,{children:["Variants",a.jsx(N8,{children:((ve=l.variants)==null?void 0:ve.length)||0})]})})]}),a.jsxs(KKe,{onSubmit:O,children:[a.jsx(W,{condition:h===0,show:a.jsxs(a.Fragment,{children:[a.jsx(BKe,{title:l.title||"",setTitle:Ce=>{c(J=>({...J,title:Ce}))}}),a.jsx(HKe,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(Ce=>({...Ce,disabled:!Ce.disabled}))}),a.jsx(gHe,{strategy:l,strategyDefinition:j,setStrategy:c,validateParameter:G,errors:f,hasAccess:E})]})}),a.jsx(W,{condition:h===1,show:a.jsxs(a.Fragment,{children:[a.jsx(tXe,{children:"Segmentation and constraints allow you to set filters on your strategies, so that they will only be evaluated for users and applications that match the specified preconditions."}),a.jsx(OKe,{segments:u,setSegments:d,projectId:e}),a.jsxs(ZKe,{children:[a.jsx(eXe,{}),a.jsx(YKe,{children:"AND"})]}),a.jsx(iKe,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c})]})}),a.jsx(W,{condition:h===2,show:a.jsx(W,{condition:l.parameters!=null&&"stickiness"in l.parameters,show:v})}),a.jsxs(JKe,{children:[a.jsx(ei,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:s||!S||f.hasFormErrors(),"data-testid":ZSe,children:p?P:"Save strategy"}),a.jsx(We,{type:"button",color:"primary",onClick:i||U,disabled:s,children:"Cancel"}),a.jsx(DKe,{open:y,onClose:()=>w(!1),onClick:o,loading:s,label:"Save strategy"})]})]})]})},cXe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),uXe=function(e){return"/"+e},F8={},yd=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){const i=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));o=Promise.all(n.map(c=>{if(c=uXe(c),c in F8)return;F8[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const g=i[h];if(g.href===c&&(!u||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":cXe,u||(p.as="script",p.crossOrigin=""),p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}return o.then(()=>t()).catch(i=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=i,window.dispatchEvent(s),!s.defaultPrevented)throw i})},dXe=({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)},s=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 a.jsx(Cn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:s,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},fXe=b("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"}}})),pXe=b(SC)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),hXe=b("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),gXe=b(dXe)(()=>({width:"100%"})),mXe=b(Cn)(()=>({width:"100%"})),vXe=({overrides:e,overridesDispatch:t})=>{const{context:n}=yi(),r=n.map(({name:s})=>({key:s,label:s})),o=s=>l=>{t({type:"UPDATE_VALUES_AT",payload:[s,l]})},i=s=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[s,c||[]]})};return a.jsx(a.Fragment,{children:e.map((s,l)=>{var f;const c=n.find(({name:p})=>p===s.contextName),u=((f=c==null?void 0:c.legalValues)==null?void 0:f.map(({value:p})=>p))||[],d=s.values.filter(p=>u.includes(p));return a.jsxs(fXe,{children:[a.jsx(pXe,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:s.contextName,options:r,onChange:p=>t({type:"UPDATE_TYPE_AT",payload:[l,p.target.value]})}),a.jsxs(hXe,{children:[a.jsx(W,{condition:!!(u&&u.length>0),show:a.jsx(ep,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(p,h)=>p===h,options:u,onChange:i(l),getOptionLabel:p=>p,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:p=>a.jsx(mXe,{...p,variant:"outlined",label:"Legal values"})}),elseShow:a.jsx(gXe,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:s.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),a.jsx(gt,{title:"Remove",arrow:!0,children:a.jsx(Ht,{onClick:p=>{p.preventDefault(),t({type:"REMOVE",payload:l})},children:a.jsx(co,{})})})]})]},`override=${l}`)})})},yXe=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((n,r)=>r!==t.payload);case"UPDATE_VALUES_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,contextName:r}:o)}}},xXe=(e=[])=>m.useReducer(yXe,e);var mc=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(mc||{});const bXe=Me.lazy(()=>yd(()=>import("./ReactJSONEditor-DDbLRmis.js"),[])),wXe=b("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"})),SXe=b("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),CXe=b(gt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),AX=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),B8=b(AX)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),jXe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),EXe=b(Qr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),TXe=b("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),z8=b(ar)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),kXe=b("div")(({theme:e})=>({marginLeft:e.spacing(3)})),_Xe=b(ar)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),RXe=b("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),PX=b("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%"}}})),AXe=b(PX)({alignItems:"end",justifyContent:"space-between"}),PXe=b(SC)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),OXe=b(We)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),$Xe=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"},{key:"number",label:"number"}],IXe={type:"string",value:""},MXe=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:s})=>{const[l,c]=m.useState(e.name),[u,d]=m.useState(e.weightType===mc.FIX),[f,p]=m.useState(String(e.weight/10)),[h,g]=m.useState(e.payload||IXe),[v,x]=xXe("overrides"in e?e.overrides||[]:[]),{context:y}=yi(),[w,S]=m.useState({}),C=q=>{S(G=>({...G,[q]:void 0}))},E=(q,G)=>{S(F=>({...F,[q]:G}))};m.useEffect(()=>{C("percentage"),o!=null&&o.includes("%")&&E("percentage","Total weight must equal 100%")},[o]);const j=!e.new,k=t.filter(({id:q,weightType:G})=>q!==e.id&&G===mc.VARIABLE).length>0,T=q=>{const G=q.weightType===mc.VARIABLE,F=t.some(O=>O.weightType===mc.FIX),U=t.filter(O=>O.weightType===mc.VARIABLE).length===1;return F&&U&&G},_=q=>{C("name"),$(q,e.id)||E("name","A variant with that name already exists for this environment."),c(q.trim())},A=q=>{(q===""||z(q))&&p(q)},M=q=>{Y(q)||E("payload",q.type==="json"?"Invalid json":"Invalid number")},I=()=>{y.length>0&&x({type:"ADD",payload:{contextName:y[0].name,values:[]}})},P=q=>!!q.length,$=(q,G)=>j||!t.some(F=>F.name===q&&F.id!==G),z=q=>{if(!u)return!0;if(q===""||q.match(/\.[0-9]{2,}$/))return!1;const G=Number(q);return G>=0&&G<=100},Y=q=>{try{return q.type==="json"&&JSON.parse(q.value),q.type==="number"?!Number.isNaN(Number(q.value)):!0}catch{return!1}};return m.useEffect(()=>{const q={...e,name:l,weight:Number(u?f:100)*10,weightType:u?mc.FIX:mc.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:h.value?h:void 0,isValid:P(l)&&$(l,e.id)&&z(f)&&Y(h)&&!o};i||(q.overrides=v.map(G=>({contextName:G.contextName,values:G.values})).filter(G=>G.values&&G.values.length>0)),n(q)},[l,u,f,h,v]),m.useEffect(()=>{u||p(String(e.weight/10))},[e.weight]),a.jsxs(wXe,{"data-testid":"VARIANT",children:[a.jsx(SXe,{color:s}),a.jsx(CXe,{arrow:!0,title:T(e)?"You need to have at least one variable variant":"Delete variant",children:a.jsx("div",{children:a.jsx(Ht,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:T(e),children:a.jsx(co,{})})})}),a.jsxs(AXe,{children:[a.jsxs(RXe,{children:[a.jsx(AX,{children:"Variant name"}),a.jsx(jXe,{children:"This will be used to identify the variant in your code"}),a.jsx(z8,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:l,onChange:q=>_(q.target.value),disabled:j,required:!0})]}),a.jsx(W,{condition:k,show:a.jsxs(kXe,{children:[a.jsx(EXe,{label:"Custom percentage",control:a.jsx(is,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:u,onChange:q=>d(q.target.checked)})}),a.jsx(_Xe,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!w.percentage,errorText:w.percentage,value:f,onChange:q=>A(q.target.value),required:u,disabled:!u,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:a.jsx(dd,{position:"end",children:"%"})}})]})})]}),a.jsxs(B8,{children:["Payload",a.jsx(ua,{tooltip:"Passed along with the the variant object."})]}),a.jsxs(PX,{children:[a.jsx(PXe,{id:"variant-payload-type",name:"type",label:"Type",value:h.type,options:$Xe,onChange:q=>{C("payload"),g(G=>({...G,type:q.target.value}))}}),a.jsx(TXe,{children:a.jsx(W,{condition:h.type==="json",show:a.jsx(m.Suspense,{fallback:null,children:a.jsx(bXe,{content:{text:h.value},onChange:q=>g(G=>{var F;return{...G,value:"json"in q?((F=q.json)==null?void 0:F.toString())||"":q.text}})})}),elseShow:a.jsx(z8,{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:q=>{C("payload"),g(G=>({...G,value:q.target.value}))},placeholder:"",onBlur:()=>M(h),error:!!w.payload,errorText:w.payload})})})]}),i?null:a.jsxs(a.Fragment,{children:[a.jsxs(B8,{children:["Overrides",a.jsx(ua,{tooltip:"Here you can specify which users should get this variant."})]}),a.jsx(vXe,{overrides:v,overridesDispatch:x}),a.jsx("div",{children:a.jsx(OXe,{onClick:I,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})},DXe=b(ne)(()=>({display:"flex",width:"100%",position:"relative"})),LXe=b(ne)(({theme:e})=>({position:"absolute",height:e.spacing(3),width:"100%",display:"flex",overflow:"hidden"})),NXe=b(ne)(()=>({height:"100%",display:"flex",flexDirection:"column",alignItems:"center",width:"100%"})),FXe=b(ne,{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]})),BXe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),H8=b(Z)(({theme:e})=>({marginY:e.spacing(1)})),zXe=b(ne)(()=>({display:"flex",alignItems:"center",marginLeft:"auto"})),OX=b(ne,{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]}})),HXe=b(Z)(({theme:e})=>({marginTop:e.spacing(1)})),UXe=({variants:e})=>e.length<1?null:a.jsxs(ne,{sx:t=>({marginTop:t.spacing(2)}),children:[a.jsx(VXe,{variants:e}),a.jsxs(DXe,{children:[a.jsx(LXe,{}),e.map((t,n)=>{const r=t.weight/10;return a.jsx(Vc,{variant:"custom",arrow:!0,onClick:o=>o.preventDefault(),titleComponent:a.jsx(KXe,{variant:t,index:n}),children:a.jsxs(ne,{style:{width:`${r}%`},children:[" ",a.jsxs(NXe,{children:[a.jsx(FXe,{index:n}),a.jsxs(HXe,{variant:"subtitle2",children:[r,"%"]})]})]})},n)})]})]}),VXe=({variants:e})=>a.jsxs(BXe,{children:[a.jsxs(H8,{variant:"body2",children:["Feature variants (",e.length,")"]}),a.jsx(zXe,{children:e.map((t,n)=>a.jsxs(OX,{index:n,children:[a.jsx(ne,{}),a.jsx(H8,{variant:"body2",children:t.name})]},n))})]}),WXe=b(ne)(()=>({display:"flex",flexDirection:"column"})),GXe=b(ne)(()=>({display:"flex",alignItems:"center",minWidth:"250px"})),qXe=b(ne)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column"})),YXe=b(Z)(({theme:e})=>({marginBottom:e.spacing(1)})),KXe=({variant:e,index:t})=>a.jsxs(WXe,{children:[a.jsxs(GXe,{children:[a.jsx(OX,{index:t,children:a.jsx(ne,{})}),a.jsxs(Z,{variant:"subtitle2",children:[e.weight/10,"% - ",e.name]})]}),e.payload?a.jsxs(qXe,{children:[a.jsx(YXe,{variant:"body2",children:"Payload"}),a.jsx(W,{condition:e.payload.type==="json",show:a.jsx("code",{children:e.payload.value}),elseShow:a.jsx(Z,{variant:"body2",children:e.payload.value})})]}):null]}),XXe=()=>a.jsxs(Vt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",a.jsx(JXe,{}),"."]}),AEt=()=>a.jsxs(Vt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",a.jsx("b",{children:"variants inside strategies"}),". ",a.jsx(QXe,{})]}),JXe=()=>a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),QXe=()=>a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),ZXe=b("div")({display:"flex",flexDirection:"column"}),eJe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),tJe=b("div")(({theme:e})=>({color:e.palette.text.secondary,marginTop:e.spacing(1.5)})),$X=({strategy:e,setStrategy:t,projectId:n,environment:r,editable:o})=>{const{trackEvent:i}=Sn(),s=(e.variants||[]).map(h=>({...h,new:o||!1,isValid:!0,id:Uh(),overrides:[]})),[l,c]=m.useState(s),u=It(),d=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";m.useEffect(()=>()=>{t(h=>({...h,variants:l.filter(g=>!!g.name)}))},[JSON.stringify(l)]),m.useEffect(()=>{t(h=>({...h,variants:l.map(g=>({stickiness:d,name:g.name,weight:g.weight,payload:g.payload,weightType:g.weightType}))}))},[d,JSON.stringify(l)]);const f=(h,g)=>{c(v=>U6(v.map(x=>x.id===g?h:x),1e3))},p=()=>{const h=Uh();c(g=>[...g,{name:"",weightType:mc.VARIABLE,weight:0,stickiness:d,new:!0,isValid:!1,id:h}]),i("strategy-variants",{props:{eventType:"variant added"}})};return a.jsxs(a.Fragment,{children:[a.jsx(tJe,{children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),a.jsxs(eJe,{children:[a.jsx(Z,{children:"Variants"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsx(ne,{children:a.jsxs(Z,{variant:"body2",children:["Variants in feature toggling allow you to serve different versions of a feature to different users. This can be used for A/B testing, gradual rollouts, and canary releases. Variants provide a way to control the user experience at a granular level, enabling you to test and optimize different aspects of your features. Read more about variants"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),a.jsxs(ZXe,{children:[a.jsx(W,{condition:l.length>0,show:a.jsx(XXe,{})}),l.map((h,g)=>a.jsx(MXe,{disableOverrides:!0,variant:h,variants:l,updateVariant:v=>f(v,h.id),removeVariant:()=>c(v=>U6(v.filter(x=>x.id!==h.id),1e3)),decorationColor:u.palette.variants[g%u.palette.variants.length]},h.id))]}),a.jsx(ei,{onClick:p,variant:"outlined",permission:oq,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",startIcon:a.jsx(ni,{}),children:"Add variant"}),a.jsx(UXe,{variants:l})]})},nJe=e=>fetch(e).then(fn("ChangeRequest")).then(t=>t.json()),rJe=(e,t)=>{const{data:n,error:r,mutate:o}=bC([],Ot(`api/admin/projects/${e}/change-requests/scheduled?strategyId=${t}`),nJe);return{changeRequests:n,loading:!r&&!n,refetch:o,error:r}},oJe=(e,t,n,r)=>(e==null?void 0:e.filter(o=>{var i;return(i=o.features.find(s=>s.name===t))==null?void 0:i.changes.some(s=>s.action==="updateStrategy"&&s.payload.id===n)}).map(o=>({changeRequest:PP(r,o.id),state:o.state})))??[],iJe=(e,t)=>(e==null?void 0:e.map(n=>({changeRequest:PP(t,n.id),state:"Scheduled"})))??[],sJe=()=>{const[e,t]=m.useState(""),{trackEvent:n}=Sn();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"}})}}},aJe=e=>{if(e)return e==null?void 0:e.constraints.map(t=>({...t,[v0]:Uh()}))},PEt=()=>{const e=Fr("projectId"),t=Fr("featureId"),n=O9("environmentId"),r=O9("strategyId"),[o,i]=m.useState(0),[s,l]=m.useState({}),[c,u]=m.useState([]),{updateStrategyOnFeature:d,loading:f}=Cze(),{strategyDefinition:p}=AP(s.name),{setToastData:h,setToastApiError:g}=Yt(),v=vK(),{uiConfig:x}=ht(),{unleashUrl:y}=x,w=$t(),{addChange:S}=up(),{isChangeRequestConfigured:C}=ip(e),{refetch:E,data:j}=wC(e),{setPreviousTitle:k}=sJe(),{feature:T,refetchFeature:_}=Wl(e,t),A=m.useRef(T),{data:M,staleDataNotification:I,forceRefreshCache:P}=xK({unleashGetter:Wl,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},T,{afterSubmitAction:_},bK);m.useEffect(()=>{A.current.name===""&&T.name&&(P(T),A.current=T)},[T]);const{trackEvent:$}=Sn(),{changeRequests:z}=rJe(e,r),Y=oJe(j,t,r,x),q=iJe(z,x),G=()=>[...Y,...q].forEach(ue=>$("change_request",{props:{...ue,action:"edit-strategy",eventType:"conflict-created"}})),{segments:F,refetchSegments:U}=Wc(r);m.useEffect(()=>{const ue=M==null?void 0:M.environments.flatMap(J=>J.strategies).find(J=>J.id===r),ve=aJe(ue),Ce={...ue,constraints:ve};l(J=>({...J,...Ce})),k((ue==null?void 0:ue.title)||"")},[r,M]),m.useEffect(()=>{F&&u(F)},[JSON.stringify(F)]);const O=lJe(s,c),L=async ue=>{await d(e,t,n,r,ue),await U(),h({title:"Strategy updated",type:"success",confetti:!0})},te=async ue=>{await S(e,n,{action:"updateStrategy",feature:t,payload:{...ue,id:r}}),h({title:"Change added to draft",type:"success",confetti:!0}),E()},re=async()=>{try{C(n)?await te(O):await L(O),G(),_(),w(QP(e,t))}catch(ue){g(Dt(ue))}};return!s.id||!p||!M?null:a.jsxs(Br,{modal:!0,disablePadding:!0,description:uJe,documentationLink:dJe,documentationLinkLabel:fJe,formatApiCode:()=>cJe(e,t,n,r,O,p,y),children:[a.jsx(RX,{projectId:e,feature:M,strategy:s,setStrategy:l,segments:c,setSegments:u,environmentId:n,onSubmit:re,loading:f,permission:YS,errors:v,isChangeRequest:C(n),tab:o,setTab:i,StrategyVariants:a.jsx($X,{strategy:s,setStrategy:l,environment:n,projectId:e})}),I]})},lJe=(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}),QP=(e,t)=>`/projects/${e}/features/${t}`,ZP=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},cJe=(e,t,n,r,o,i,s)=>{if(!s)return"";const l={...o,parameters:Dze(o.parameters??{},i)},c=`${s}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${c}' \\
345
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZWe(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eGe(e){var t=ZWe(e,"string");return typeof t=="symbol"?t:String(t)}var tGe={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"},nGe={"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,d:-60,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}},x1={countries:tGe,timezones:nGe},yE;function rGe(e,t){var n=e.countries[t];if(!n)return null;var r=oGe(e)[t]||{};return{id:t,name:n,timezones:r.current||[],allTimezones:r.all||[]}}function oGe(e){return yE||(yE=iGe(e)),yE}function iGe(e){return Object.keys(e.timezones).reduce(function(t,n){var r=e.timezones[n],o=r.c,i=r.a,s=e.timezones[i]||{},l=o||s.c;return l&&l.forEach(function(c){t[c]||Object.assign(t,VC({},c,{current:[],all:[]})),r.r===void 0&&t[c].current.push(n),t[c].all.push(n)}),t},{})}function sGe(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]:{},s=m0(m0({},i),e.timezones[t]),l=s.c||[],c=s.u,u=Number.isInteger(s.d)?s.d:c,d={name:t,countries:l,utcOffset:c,utcOffsetStr:y8(c),dstOffset:u,dstOffsetStr:y8(u),aliasOf:o};return n.r&&(d.deprecated=!0),d}function y8(e){var t=Math.floor(Math.abs(e)/60),n=e%60,r=e<0?"-":"+";return"".concat(r).concat(x8(t),":").concat(x8(n))}function x8(e){var t=Math.abs(e),n=t<10?"0":"";return"".concat(n).concat(t)}var aGe=["allTimezones"],lGe=Object.keys(x1.timezones).length,C_={},_v={},qK=0;function cGe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(x1.countries).reduce(function(t,n){return Object.assign(t,VC({},n,WC(n,e)))},{})}function uGe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return lGe!==qK&&Object.keys(x1.timezones).forEach(GC),gGe(_v,e)}function WC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return C_[e]||dGe(rGe(x1,e)),mGe(C_[e],t)}function dGe(e){e&&(C_[e.id]=e)}function GC(e){return _v[e]||fGe(sGe(x1,e)),_v[e]?m0({},_v[e]):null}function fGe(e){e&&(_v[e.name]=e,qK=Object.keys(e).length)}function YK(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=GC(e)||{},r=n.countries||[];return r.map(function(o){return WC(o,t)})}function pGe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=YK(e,t),r=KWe(n,1),o=r[0];return o||null}function hGe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=WC(e,t);if(!n)return null;var r=n.timezones||[];return r.map(GC)}function gGe(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,VC({},i,e[i])),o},{})}function mGe(e,t){if(!e)return null;var n=t||{},r=n.deprecated;e.allTimezones;var o=YWe(e,aGe),i=r?e.allTimezones:e.timezones;return m0(m0({},o),{},{timezones:i})}var KK={getCountry:WC,getTimezone:GC,getAllCountries:cGe,getAllTimezones:uGe,getTimezonesForCountry:hGe,getCountriesForTimezone:YK,getCountryForTimezone:pGe};const vGe=b("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),yGe=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(KK.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[s,l]=m.useState(t||""),c=m.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?a.jsxs(a.Fragment,{children:[a.jsx(y1,{children:"Select a date"}),a.jsxs(vGe,{children:[a.jsx(ar,{id:"date",label:"Date",type:"datetime-local",value:CG(s),onChange:u=>{r("");const d=Y5(u.target.value),f=d==null?void 0:d.toISOString();f&&l(f),f&&e(f)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),a.jsx("p",{children:c})]})]}):null},XK=Va()(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"}})),xGe="Enter",b8=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,s]=m.useState(""),{classes:l}=XK(),c=d=>{d.key===xGe&&(d.preventDefault(),u())},u=()=>{const d=wGe([...e,...kc(i)]);d.length===0?o("values cannot be empty"):d.some(f=>f.length>100)?o("values cannot be longer than 100 characters"):(o(""),s(""),n(d))};return a.jsxs("div",{children:[a.jsx(y1,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(ar,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>s(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(We,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(bGe,{values:e,removeValue:t})})]})},bGe=({values:e,removeValue:t})=>{const{classes:n}=XK();return a.jsx(a.Fragment,{children:e.map((r,o)=>a.jsx(vi,{label:a.jsx(hs,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip},`${r}-${o}`))})},wGe=e=>Array.from(new Set(e)),b1=({filter:e,setFilter:t})=>a.jsx("div",{style:{display:"flex",alignItems:"center"},children:a.jsx("div",{style:{width:"100%"},children:a.jsx(Cn,{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:a.jsx(dd,{position:"start",children:a.jsx(md,{})})}})})}),SGe=Va()(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}})),JK=({legal:e,control:t})=>{const{classes:n}=SGe();return a.jsx("div",{className:n.container,children:a.jsx(Qr,{value:e.value,control:t,label:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:n.value,children:e.value}),a.jsx("div",{className:n.description,children:e.description})]})})})},QK=(e,t)=>e.filter(n=>n.value.includes(t)),xE=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),ZK=e=>new Set(e.map(({value:t})=>t)),eX=(e,t)=>{const n=ZK(t);return e.filter(r=>n.has(r))},CGe=({data:e,values:t,setValues:n,error:r,setError:o,constraintValues:i})=>{const[s,l]=m.useState(""),{legalValues:c,deletedLegalValues:u}=e,d=QK(c,s),[f,p]=m.useState(()=>xE(t)),{classes:h}=e1(),g=y=>{const w=ZK(u);return(y==null?void 0:y.filter(S=>!w.has(S)))||[]},v=eX(i,u);m.useEffect(()=>{p(xE(t))},[t,p,xE]),m.useEffect(()=>{v.length>0&&n(g(t))},[]);const x=y=>{if(o(""),f[y]){const w=t.findIndex(C=>C===y),S=[...t];S.splice(w,1),n(S);return}n([...g(t),y])};return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(v&&v.length>0),show:a.jsxs(Vt,{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:",a.jsx("ul",{children:v==null?void 0:v.map(y=>a.jsx("li",{children:y},y))})]})}),a.jsx(y1,{children:"Select values from a predefined set"}),a.jsx(W,{condition:c.length>100,show:a.jsx(b1,{filter:s,setFilter:l})}),d.map(y=>a.jsx(JK,{legal:y,control:a.jsx(os,{checked:!!f[y.value],onChange:()=>x(y.value),name:y.value,color:"primary",disabled:u.map(({value:w})=>w).includes(y.value)})},y.value)),a.jsx(W,{condition:!!r,show:a.jsx("p",{className:h.error,children:r})})]})},w8=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:s,constraintValue:l})=>{const[c,u]=m.useState(""),{classes:d}=e1(),f=QK(r,c),{deletedLegalValues:p}=s,h=eX([l],p);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(h&&h.length>0),show:a.jsxs(Vt,{severity:"warning",sx:g=>({marginTop:g.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."]})}),a.jsxs(y1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx(W,{condition:r.length>100,show:a.jsx(b1,{filter:c,setFilter:u})}),a.jsx(W,{condition:!!r.length,show:a.jsx(Ua,{component:"fieldset",children:a.jsx(Q0,{"aria-label":"selected-value",name:"selected",value:t,onChange:g=>{i(""),e(g.target.value)},children:f.map(g=>a.jsx(JK,{legal:g,control:a.jsx(jl,{})},g.value))})}),elseShow:a.jsx("p",{children:"No valid legal values available for this operator."})}),a.jsx(W,{condition:!!o,show:a.jsx("p",{className:d.error,children:o})})]})},jGe=Va()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),S8=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=jGe();return a.jsxs(a.Fragment,{children:[a.jsxs(y1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:i.singleValueContainer,children:a.jsx(ar,{label:n,name:"value",value:t||"",onChange:s=>{o(""),e(s.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},bE=(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}},EGe=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:s,setError:l,removeValue:c,error:u})=>{const d=()=>{var f;switch(e){case S_:case FK:return a.jsx(a.Fragment,{children:a.jsx(CGe,{data:bE(n,t.legalValues),constraintValues:n,values:o.values||[],setValues:s,error:u,setError:l})});case BK:return a.jsx(a.Fragment,{children:a.jsx(w8,{data:bE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((f=t.legalValues)==null?void 0:f.filter(p=>Number(p.value)))||[],error:u,setError:l})});case zK:return a.jsx(a.Fragment,{children:a.jsx(w8,{data:bE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:u,setError:l})});case HK:return a.jsx(yGe,{value:o.value,setValue:i,error:u,setError:l});case UK:return a.jsx(b8,{values:o.values||[],removeValue:c,setValues:s,error:u,setError:l});case VK:return a.jsx(a.Fragment,{children:a.jsx(b8,{values:o.values||[],removeValue:c,setValues:s,error:u,setError:l})});case WK:return a.jsx(S8,{setValue:i,value:o.value,type:"number",error:u,setError:l});case GK:return a.jsx(S8,{setValue:i,value:o.value,type:"semver",error:u,setError:l})}};return a.jsx(a.Fragment,{children:d()})},tX="cancel",C8="save",j8=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},TGe=b("div")({padding:0,margin:0,width:"100%"}),kGe=b(Jf)(({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"}}})),_Ge=b(Zf)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),RGe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),AGe=({constraint:e,compact:t,onCancel:n,onSave:r,onDelete:o})=>{const[i,s]=m.useState(Xp(e)),{context:l}=yi(),[c,u]=m.useState(j8(l,i.contextName)),{validateConstraint:d}=dp(),[f,p]=m.useState(!1),[h,g]=m.useState("");m.useEffect(()=>{p(!0)},[]),m.useEffect(()=>{u(j8(l,i.contextName))},[i.contextName,l]);const v=m.useCallback(P=>{s($=>({...$,contextName:P,values:[],value:""}))},[]),x=m.useCallback(P=>{s($=>({...$,operator:P,values:[],value:""}))},[]),y=m.useCallback(P=>{s($=>({...$,values:P}))},[]),w=m.useCallback(P=>{s($=>({...$,value:P}))},[]),S=()=>{s(P=>({...P,inverted:!P.inverted}))},C=m.useCallback(()=>{s(P=>({...P,caseInsensitive:!P.caseInsensitive}))},[]),E=m.useCallback(P=>{const $=[...i.values];$.splice(P,1),y($)},[i,y]),j=()=>{p(!1)},k=()=>{const P=Array.isArray(i.values)&&i.values.length>0,$=!!i.value;return P||$?(M(""),!0):(M("You must provide a value for the constraint"),!1)},T=async()=>{if(!k())return;const[$,z]=A();if($||M(z),$)try{await d(i),M(""),g(C8),j();return}catch(Y){M(Dt(Y))}},{input:_,validator:A,setError:M,error:I}=VWe({contextDefinition:c,localConstraint:i});return m.useEffect(()=>{M(""),s(P=>Xp(P))},[i.operator,i.contextName,M]),a.jsx(TGe,{children:a.jsxs(kGe,{expanded:f,TransitionProps:{onExited:()=>{h===tX?(g(""),n()):h===C8&&(g(""),r(i))}},children:[a.jsx(_Ge,{children:a.jsx(qHe,{localConstraint:i,setLocalConstraint:s,setContextName:v,setOperator:x,action:h,compact:t,setInvertedOperator:S,setCaseInsensitive:C,onDelete:o})}),a.jsx(RGe,{children:a.jsx(EHe,{localConstraint:i,setValues:y,setValue:w,triggerTransition:j,setAction:g,onSubmit:T,children:a.jsx(EGe,{setValues:y,setValue:w,setError:M,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:_,error:I,contextDefinition:c,removeValue:E})})})]})})},qC=(e,t)=>e.value&&e.contextName===Ff?l1(e.value,t.locale):e.value,PGe=b(hs)({whiteSpace:"pre"}),OGe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),$Ge=({values:e})=>{const[t,n]=m.useState("");return!e||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:e.length>20,show:a.jsx(b1,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>a.jsx(OGe,{label:a.jsx(PGe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},IGe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),MGe=b("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),DGe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),LGe=({value:e,operator:t})=>e?a.jsxs(IGe,{children:[a.jsxs(MGe,{children:["Value must be ",t]})," ",a.jsx(DGe,{label:a.jsx(hs,{maxWidth:"400",text:e,maxLength:50})})]}):null,NGe=b("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),FGe=({constraint:e})=>{const{locationSettings:t}=Mi();return a.jsx("div",{children:a.jsxs(NGe,{children:[a.jsx($Ge,{values:e.values}),a.jsx(LGe,{value:qC(e,t),operator:e.operator})]})})},BGe=b("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),zGe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14,color:t?e.palette.text.secondary:e.palette.text.primary})),HGe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallerBody,color:t?e.palette.text.secondary:e.palette.neutral.main})),UGe=({constraint:e,hasPrefix:t,disabled:n=!1})=>{const r=e.operator,o=Nb(e.operator);return a.jsxs(BGe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[a.jsx(zGe,{disabled:n,children:r}),a.jsx(HGe,{disabled:n,children:o})]})},nX=b("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})),VGe=b(nX)(({theme:e})=>({width:"auto",paddingLeft:e.spacing(1),paddingRight:e.spacing(1),marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),E8=m.forwardRef(({isPrefix:e,...t},n)=>a.jsx(W,{condition:!!e,show:()=>a.jsx(VGe,{ref:n,...t}),elseShow:()=>a.jsx(nX,{ref:n,...t})})),WGe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),GGe=b("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),qGe=({constraint:e,disabled:t=!1})=>(It(),a.jsxs(WGe,{children:[a.jsx(W,{condition:!!e.inverted,show:a.jsx(gt,{title:"Operator is negated",arrow:!0,children:a.jsx(ne,{sx:{display:"flex"},children:a.jsx(E8,{isPrefix:!0,children:a.jsx(LC,{})})})})}),a.jsx(GGe,{children:a.jsx(UGe,{constraint:e,hasPrefix:!!e.inverted,disabled:t})}),a.jsx(W,{condition:!e.caseInsensitive&&Qt(Ai,e.operator),show:a.jsx(gt,{title:"Case sensitive is active",arrow:!0,children:a.jsx(E8,{children:a.jsx(NC,{})})})})]})),YGe=b(vi)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),KGe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),XGe=({constraint:e,allowExpand:t,disabled:n=!1})=>{const{locationSettings:r}=Mi();return m.useEffect(()=>{t(!1)},[t]),a.jsx(KGe,{children:a.jsx(YGe,{sx:o=>({color:n?o.palette.text.secondary:"inherit"}),label:qC(e,r)})})},JGe=b("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"}})),QGe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),ZGe=b("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),eqe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),tqe=({constraint:e,expanded:t,allowExpand:n,maxLength:r,disabled:o=!1})=>{var c;const[i,s]=m.useState(!1),l=m.useMemo(()=>{var u;return(u=e==null?void 0:e.values)==null?void 0:u.map(d=>d).join(", ")},[e]);return m.useEffect(()=>{l&&(n(((l==null?void 0:l.length)??0)>r),s(((l==null?void 0:l.length)??0)>r))},[l,r,n,s]),a.jsx(QGe,{children:a.jsxs(ZGe,{children:[a.jsx(JGe,{sx:u=>({color:o?u.palette.text.secondary:"inherit"}),children:l}),a.jsx(W,{condition:i,show:a.jsx(eqe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(c=e==null?void 0:e.values)==null?void 0:c.length})`})})]})})},nqe=b("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"}})),rqe=b("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),oqe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),iqe=({constraint:e,singleValue:t,allowExpand:n,expanded:r,disabled:o=!1,maxLength:i=112})=>a.jsx(rqe,{children:a.jsxs(oqe,{children:[a.jsx(gt,{title:e.contextName,arrow:!0,children:a.jsx(nqe,{sx:s=>({color:o?s.palette.text.secondary:"inherit"}),children:e.contextName})}),a.jsx(qGe,{constraint:e,disabled:o}),a.jsx(W,{condition:t,show:a.jsx(XGe,{constraint:e,allowExpand:n,disabled:o}),elseShow:a.jsx(tqe,{constraint:e,expanded:r,allowExpand:n,maxLength:i,disabled:o})})]})}),sqe=ql("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),aqe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:s,disabled:l})=>{const{context:c}=yi(),{contextName:u}=e,d=!c.map(f=>f.name).includes(u);return a.jsxs(sqe,{children:[a.jsx(DC,{compact:s,disabled:l}),a.jsx(iqe,{constraint:e,singleValue:r,allowExpand:o,expanded:i,disabled:l}),a.jsx(PK,{onEdit:t,onDelete:n,disableEdit:d})]})},lqe=b(Jf)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),cqe=b(Zf)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),uqe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),dqe=b("div")({display:"flex",flexDirection:"column",width:"100%"}),fqe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,disabled:i=!1,renderAfter:s})=>{const[l,c]=m.useState(!0),[u,d]=m.useState(!1),f=Qt([...Dl,...Ml,...Do],e.operator),p=()=>{l&&d(!u)};return a.jsxs(lqe,{expanded:u,sx:r,children:[a.jsx(cqe,{expandIcon:null,onClick:p,sx:{cursor:l?"pointer":"default!important","&:hover":{cursor:l?"pointer":"default!important"}},children:a.jsxs(dqe,{children:[a.jsx(aqe,{constraint:e,onEdit:t,onDelete:n,singleValue:f,allowExpand:c,disabled:i,expanded:u,compact:o}),s]})}),a.jsx(uqe,{children:a.jsx(FGe,{constraint:e})})]})},pqe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:s})=>e?a.jsx(W,{condition:!!(n&&s),show:a.jsx(AGe,{constraint:e,onCancel:o,onSave:s,onDelete:i,compact:t}),elseShow:a.jsx(fqe,{constraint:e,onEdit:r,onDelete:i})}):null,hqe=e=>{const t=m.useRef(e??new WeakMap),[,n]=m.useState(0),r=m.useCallback((i,s)=>{t.current.set(i,s),n(l=>l+1)},[]),o=m.useCallback(i=>t.current.get(i),[]);return m.useMemo(()=>({set:r,get:o}),[r,o])},v0=Symbol("id"),gqe=e=>{const t=MP(e)[0],n=Qt(Do,t)?new Date().toISOString():"";return{contextName:e,operator:t,value:n,values:[],caseInsensitive:!1,inverted:!1,[v0]:Uh()}},rX=b("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})),mqe=b(rX)(({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)})),YC=({text:e})=>{const t=It();return a.jsx(ne,{sx:{height:t.spacing(e==="AND"?1:1.5),position:"relative",width:"100%"},children:a.jsx(W,{condition:e==="AND",show:()=>a.jsx(rX,{children:e}),elseShow:()=>a.jsx(mqe,{children:e})})})},VP="constraintAccordionListId",oX=b("div")(({theme:e})=>({width:"100%",display:"flex",flexDirection:"column","&.constraint-list-element":{borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.background.default}})),vqe=b(gt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)})),yqe=b(Lf)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}})),xqe=b("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary})),bqe=b("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"})),iX=(e,t)=>{const n=hqe(),{context:r}=yi(),o=e&&(s=>{const l=gqe(s);n.set(l,{editing:!0,new:!0}),e(c=>[...c,l])});return m.useImperativeHandle(t,()=>({addConstraint:o})),{onAdd:o&&(()=>{o(r[0].name)}),state:n,context:r}},KC=m.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const{onAdd:i,state:s,context:l}=iX(t,o);return l.length===0?null:a.jsxs(oX,{id:VP,children:[a.jsx(W,{condition:e&&e.length>0&&r,show:a.jsx(xqe,{children:"Constraints"})}),a.jsx(wqe,{ref:o,setConstraints:t,constraints:e,state:s}),a.jsx(W,{condition:!!(n&&i),show:a.jsxs("div",{children:[a.jsxs(bqe,{children:[a.jsx("p",{children:"Add any number of constraints"}),a.jsx(vqe,{title:"View constraints documentation",arrow:!0,children:a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:a.jsx(yqe,{})})})]}),a.jsx(We,{type:"button",onClick:i,variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})]})}),wqe=m.forwardRef(({constraints:e,setConstraints:t,state:n},r)=>{const{context:o}=yi(),i=t&&(u=>{n.set(u,{editing:!0})}),s=t&&(u=>{const d=e[u];n.set(d,{}),t(_i(f=>{f.splice(u,1)}))}),l=t&&((u,d)=>{n.set(d,{}),t(_i(f=>{f[u]=d}))}),c=u=>{var f;const d=e[u];(f=n.get(d))!=null&&f.new&&(s==null||s(u)),n.set(d,{})};return o.length===0?null:a.jsx(oX,{id:VP,className:"constraint-list-element",children:e.map((u,d)=>{var f;return a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:d>0,show:a.jsx(YC,{text:"AND"})}),a.jsx(pqe,{constraint:u,onEdit:i==null?void 0:i.bind(null,u),onCancel:c.bind(null,d),onDelete:s==null?void 0:s.bind(null,d),onSave:l==null?void 0:l.bind(null,d),editing:!!((f=n.get(u))!=null&&f.editing),compact:!0})]},$b(u))})})}),Sqe=b("div")(({theme:e})=>({padding:e.spacing(2)})),Cqe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(2),borderTop:`1px solid ${e.palette.divider}`,width:"100%",padding:e.spacing(2)})),jqe=b("div")({marginLeft:"auto"}),Eqe=b(We)(({theme:e})=>({marginRight:e.spacing(1),minWidth:"125px"}));b(We)(({theme:e})=>({marginLeft:e.spacing(1),minWidth:"125px"}));const Tqe=({localConstraint:e,children:t,triggerTransition:n,setAction:r,onSubmit:o})=>a.jsxs(a.Fragment,{children:[a.jsxs(Sqe,{children:[a.jsx(W,{condition:Qt(EK,e.operator),show:a.jsx(OP,{})}),t]}),a.jsx(Cqe,{children:a.jsx(jqe,{children:a.jsx(Eqe,{type:"button",onClick:o,variant:"outlined",color:"primary","data-testid":"CONSTRAINT_SAVE_BUTTON",children:"Done"})})})]}),kqe=(e,t)=>{const n=`To satisfy this constraint, values passed into the SDK as ${t} must`;if(e===Pg)return`${n} include:`;if(e===CC)return`${n} not include:`;if(e===jC)return`${n} end with:`;if(e===EC)return`${n} start with:`;if(e===TC)return`${n} contain:`;if(e===kC)return`${n} match:`;if(e===_C)return`${n} be greater than:`;if(e===RC)return`${n} be greater than or equal to:`;if(e===AC)return`${n} be less than:`;if(e===PC)return`${n} be less than or equal to:`;if(e===Og)return`${n} be after the following date`;if(e===OC)return`${n} be before the following date:`;if(e===$C)return`${n} match the following version:`;if(e===IC)return`${n} be greater than the following version:`;if(e===MC)return`${n} be less than the following version:`},sX=ql(Ht)(({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"}})),aX=ql(Ht)(({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"}})),_qe=({localConstraint:e,setInvertedOperator:t})=>a.jsx(gt,{title:e.inverted?"Remove negation":"Negate operator",arrow:!0,children:a.jsx(ne,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(W,{condition:!!e.inverted,show:a.jsx(aX,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(LC,{})}),elseShow:a.jsx(sX,{onClick:t,disableRipple:!0,children:a.jsx(kK,{})})})})}),Rqe=({localConstraint:e,setCaseInsensitive:t})=>a.jsx(gt,{title:e.caseInsensitive?"Make it case sensitive":"Make it case insensitive",arrow:!0,children:a.jsx(ne,{sx:{display:"flex",alignItems:"stretch"},children:a.jsx(W,{condition:!!e.caseInsensitive,show:a.jsx(sX,{onClick:t,disableRipple:!0,children:a.jsx(AK,{})}),elseShow:a.jsx(aX,{className:"operator-is-active",onClick:t,disableRipple:!0,children:a.jsx(NC,{})})})})});var WP={},Aqe=ze;Object.defineProperty(WP,"__esModule",{value:!0});var XC=WP.default=void 0,Pqe=Aqe(He()),Oqe=a,$qe=(0,Pqe.default)((0,Oqe.jsx)("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"Undo");XC=WP.default=$qe;const Iqe=b("div")(({theme:e})=>({marginLeft:"auto",whiteSpace:"nowrap",[e.breakpoints.down("sm")]:{display:"none"}})),lX=({onEdit:e,onDelete:t,onUndo:n,constraintChanges:r=[],disableDelete:o=!1,disableEdit:i=!1})=>{const s=e&&(u=>{u.stopPropagation(),e()}),l=t&&(u=>{u.stopPropagation(),t()}),c=n&&(u=>{u.stopPropagation(),n()});return a.jsxs(Iqe,{children:[a.jsx(W,{condition:!!s&&!i,show:a.jsx(gt,{title:"Edit constraint",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:s,disabled:i,"data-testid":"EDIT_CONSTRAINT_BUTTON",children:a.jsx(Oi,{})})})}),a.jsx(W,{condition:!!c&&r.length>1,show:a.jsx(gt,{title:"Undo last change",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:c,disabled:o,"data-testid":"UNDO_CONSTRAINT_CHANGE_BUTTON",children:a.jsx(XC,{})})})}),a.jsx(W,{condition:!!l&&!o,show:a.jsx(gt,{title:"Delete constraint",arrow:!0,children:a.jsx(Ht,{type:"button",onClick:l,disabled:o,"data-testid":"DELETE_CONSTRAINT_BUTTON",children:a.jsx(co,{})})})})]})},Mqe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),Dqe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(770)]:{flexDirection:"column"}})),Lqe=b("div")(({theme:e})=>({[e.breakpoints.down(770)]:{marginTop:e.spacing(2)},display:"inline-flex"})),Nqe=b("div")(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),Fqe=b(rp)(({theme:e})=>({marginRight:e.spacing(2),width:"200px",[e.breakpoints.between(1101,1365)]:{width:"170px",marginRight:e.spacing(1)}})),Bqe=b("p")(({theme:e})=>({maxWidth:"400px",fontSize:e.fontSizes.smallBody,[e.breakpoints.down("xl")]:{display:"none"}})),zqe=({compact:e,constraintChanges:t,localConstraint:n,setLocalConstraint:r,setContextName:o,setOperator:i,onDelete:s,onUndo:l,setInvertedOperator:c,setCaseInsensitive:u})=>{const{context:d}=yi(),{contextName:f,operator:p}=n,[h,g]=m.useState(!1),{uiConfig:v}=ht(),x=!!v.flags.caseInsensitiveInOperators;if(m.useEffect(()=>{f===Ff&&!Qt(Do,p)?r(S=>({...S,operator:Og,value:new Date().toISOString()})):f!==Ff&&Qt(Do,p)&&i(Pg),Qt(Ai,p)||Qt(Zs,p)&&x?g(!0):g(!1)},[f,i,p,r,x]),!d)return null;const y=d.map(S=>({key:S.name,label:S.name})),w=S=>{Qt(Ai,S)||Qt(Zs,S)&&x?g(!0):g(!1),Qt(Do,S)?r(C=>({...C,operator:S,value:new Date().toISOString()})):i(S)};return a.jsxs(Mqe,{children:[a.jsx(DC,{}),a.jsxs(Dqe,{children:[a.jsx("div",{children:a.jsx(Fqe,{id:"context-field-select",name:"contextName",label:"Context Field",autoFocus:!0,options:y,value:f||"",onChange:o})}),a.jsxs(Lqe,{children:[a.jsx(_qe,{localConstraint:n,setInvertedOperator:c}),a.jsx(Nqe,{children:a.jsx(TK,{options:MP(f),value:p,onChange:w})}),a.jsx(W,{condition:h,show:a.jsx(Rqe,{localConstraint:n,setCaseInsensitive:u})})]})]}),a.jsx(W,{condition:!e,show:a.jsx(Bqe,{children:kqe(p,f)})}),a.jsx(lX,{onDelete:s,onUndo:l,constraintChanges:t,disableEdit:!0})]})},Hqe=e=>()=>{const t=Number(e);return typeof t!="number"||Number.isNaN(t)?[!1,"Value must be a number"]:[!0,""]},Uqe=e=>()=>{const t=[!1,"Values must be a list of strings"];return!Array.isArray(e)||!e.every(n=>typeof n=="string")?t:[!0,""]},Vqe=e=>()=>{const t=Fb.clean(e)===e;return!Fb.valid(e)||!t?[!1,"Value is not a valid semver. For example 1.2.4"]:[!0,""]},Wqe=e=>()=>yg(Js(e))?[!0,""]:[!1,"Value must be a valid date matching RFC3339"],j_="IN_OPERATORS_LEGAL_VALUES",cX="STRING_OPERATORS_LEGAL_VALUES",uX="NUM_OPERATORS_LEGAL_VALUES",dX="SEMVER_OPERATORS_LEGAL_VALUES",fX="DATE_OPERATORS_SINGLE_VALUE",pX="IN_OPERATORS_FREETEXT",hX="STRING_OPERATORS_FREETEXT",gX="NUM_OPERATORS_SINGLE_VALUE",mX="SEMVER_OPERATORS_SINGLE_VALUE",T8="NUMBER_VALIDATOR",k8="SEMVER_VALIDATOR",wE="STRING_ARRAY_VALIDATOR",_8="DATE_VALIDATOR",Gqe=({contextDefinition:e,localConstraint:t})=>{const[n,r]=m.useState(j_),[o,i]=m.useState(wE),[s,l]=m.useState(""),c=m.useCallback(()=>{wu(e.legalValues)&&Qt(Zs,t.operator)?r(j_):wu(e.legalValues)&&Qt(Ai,t.operator)?r(cX):wu(e.legalValues)&&Qt(Ml,t.operator)?r(uX):wu(e.legalValues)&&Qt(Dl,t.operator)?r(dX):Qt(Do,t.operator)?r(fX):Qt(Zs,t.operator)?r(pX):Qt(Ai,t.operator)?r(hX):Qt(Ml,t.operator)?r(gX):Qt(Dl,t.operator)&&r(mX)},[t,e]),u=()=>{switch(o){case T8:return Hqe(t.value);case wE:return Uqe(t.values||[]);case k8:return Vqe(t.value||"");case _8:return Wqe(t.value||"")}},d=m.useCallback(f=>{Qt(Ml,f)&&i(T8),Qt([...Ai,...Zs],f)&&i(wE),Qt(Dl,f)&&i(k8),Qt(Do,f)&&i(_8)},[i]);return m.useEffect(()=>{d(t.operator)},[t.operator,t.value,t.values,d]),m.useEffect(()=>{c()},[e,t,c]),{input:n,error:s,validator:u(),setError:l}},qqe=b("h3")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightRegular})),w1=({children:e,...t})=>a.jsx(qqe,{...t,children:e}),Yqe=b("div")(({theme:e})=>({display:"flex",flexDirection:"row",marginBottom:e.spacing(1),alignItems:"center",gap:e.spacing(1)})),Kqe=({setValue:e,value:t,error:n,setError:r})=>{const o=Object.values(KK.getAllTimezones({deprecated:!1})).map(u=>({key:u.name,label:`${u.name}`,utcOffset:u.utcOffsetStr})),{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),[s,l]=m.useState(t||""),c=m.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?a.jsxs(a.Fragment,{children:[a.jsx(w1,{children:"Select a date"}),a.jsxs(Yqe,{children:[a.jsx(ar,{id:"date",label:"Date",type:"datetime-local",value:CG(s),onChange:u=>{r("");const d=Y5(u.target.value),f=d==null?void 0:d.toISOString();f&&l(f),f&&e(f)},InputLabelProps:{shrink:!0},error:!!n,errorText:n,required:!0}),a.jsx("p",{children:c})]})]}):null},vX=Va()(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"}})),Xqe="Enter",R8=({values:e,removeValue:t,setValues:n,error:r,setError:o})=>{const[i,s]=m.useState(""),{classes:l}=vX(),c=d=>{d.key===Xqe&&(d.preventDefault(),u())},u=()=>{const d=Qqe([...e,...kc(i)]);d.length===0?o("values cannot be empty"):d.some(f=>f.length>100)?o("values cannot be longer than 100 characters"):(o(""),s(""),n(d))};return a.jsxs(a.Fragment,{children:[a.jsx(w1,{style:{marginBottom:0},children:"Set values (maximum 100 char length per value)"}),a.jsxs("div",{className:l.inputContainer,children:[a.jsx("div",{className:l.inputInnerContainer,children:a.jsx(ar,{onKeyPress:c,label:"Values",name:"values",value:i,onFocus:()=>{o("")},onChange:d=>s(d.target.value),placeholder:"value1, value2, value3...",className:l.input,error:!!r,errorText:r,"data-testid":"CONSTRAINT_VALUES_INPUT"})}),a.jsx(We,{className:l.button,variant:"outlined",color:"primary",onClick:()=>u(),"data-testid":"CONSTRAINT_VALUES_ADD_BUTTON",children:"Add values"})]}),a.jsx("div",{className:l.valuesContainer,children:a.jsx(Jqe,{values:e,removeValue:t})})]})},Jqe=({values:e,removeValue:t})=>{const{classes:n}=vX();return a.jsx(a.Fragment,{children:e.map((r,o)=>a.jsx(vi,{label:a.jsx(hs,{text:r,maxLength:35,maxWidth:"100",className:n.chipValue}),onDelete:()=>t(o),className:n.valueChip,"data-testid":"CONSTRAINT_VALUES_CHIP"},`${r}-${o}`))})},Qqe=e=>Array.from(new Set(e)),Zqe=b("div")(({theme:e})=>({display:"inline-block",wordBreak:"break-word",padding:e.spacing(.5,1),background:e.palette.background.paper,border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius,"&:hover":{border:`1px solid ${e.palette.primary.main}`}})),eYe=b("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallBody})),tYe=b("div")(({theme:e})=>({lineHeight:1.33,fontSize:e.fontSizes.smallerBody,color:e.palette.action.active})),yX=({legal:e,control:t,filter:n,value:r})=>a.jsx(Zqe,{children:a.jsx(Qr,{value:r||e.value,control:t,sx:{width:"100%"},label:a.jsxs(a.Fragment,{children:[a.jsx(eYe,{children:a.jsx(pi,{search:n,children:e.value})}),a.jsx(tYe,{children:a.jsx(pi,{search:n,children:e.description})})]})})}),xX=(e,t)=>e.filter(n=>{var r;return n.value.toLowerCase().includes(t.toLowerCase())||((r=n.description)==null?void 0:r.toLowerCase().includes(t.toLowerCase()))}),SE=e=>e.reduce((t,n)=>(t[n]||(t[n]=!0),t),{}),bX=e=>new Set(e.map(({value:t})=>t)),wX=(e,t)=>{const n=bX(t);return e.filter(r=>n.has(r))},A8=b("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,maxHeight:"378px",overflow:"auto"})),nYe=b(lV)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(.5),justifyContent:"space-between"})),rYe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.error.main})),oYe=({data:e,values:t,setValues:n,setValuesWithRecord:r,error:o,setError:i,constraintValues:s})=>{const[l,c]=m.useState(""),{legalValues:u,deletedLegalValues:d}=e,f=xX(u,l),[p,h]=m.useState(()=>SE(t)),g=Nr("disableShowContextFieldSelectionValues"),v=C=>{const E=bX(d);return(C==null?void 0:C.filter(j=>!E.has(j)))||[]},x=wX(s,d);m.useEffect(()=>{h(SE(t))},[t,h,SE]),m.useEffect(()=>{x.length>0&&n(v(t))},[]);const y=C=>{if(i(""),p[C]){const E=t.findIndex(k=>k===C),j=[...t];j.splice(E,1),r(j);return}r([...v(t),C])},w=u.every(C=>t.includes(C.value)),S=()=>{if(w)return r([]);r([...u.map(C=>C.value)])};return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(x&&x.length>0),show:a.jsxs(Vt,{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:",a.jsx("ul",{children:x==null?void 0:x.map(C=>a.jsx("li",{children:C},C))})]})}),a.jsxs(nYe,{direction:"row",children:[a.jsx(w1,{children:"Select values from a predefined set"}),a.jsx(We,{variant:"text",onClick:S,children:w?"Unselect all":"Select all"})]}),a.jsx(W,{condition:u.length>100,show:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!g&&!!t,show:a.jsx(A8,{sx:{border:0},children:t.map(C=>a.jsx(vi,{label:C,onDelete:()=>y(C)},C))})}),a.jsx(b1,{filter:l,setFilter:c})]})}),a.jsx(A8,{children:f.map(C=>a.jsx(yX,{legal:C,filter:l,control:a.jsx(os,{checked:!!p[C.value],onChange:()=>y(C.value),name:C.value,color:"primary",disabled:d.map(({value:E})=>E).includes(C.value)})},C.value))}),a.jsx(W,{condition:!!o,show:a.jsx(rYe,{children:o})})]})},iYe=b("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1),padding:e.spacing(2),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,maxHeight:"378px",overflow:"auto"})),P8=({setValue:e,value:t,type:n,legalValues:r,error:o,setError:i,data:s,constraintValue:l})=>{const[c,u]=m.useState(""),{classes:d}=e1(),f=xX(r,c),{deletedLegalValues:p}=s,h=wX([l],p);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!(h&&h.length>0),show:a.jsxs(Vt,{severity:"warning",sx:g=>({marginTop:g.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."]})}),a.jsxs(w1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx(W,{condition:r.length>100,show:a.jsx(b1,{filter:c,setFilter:u})}),a.jsx(W,{condition:!!r.length,show:a.jsx(iYe,{children:a.jsx(Ua,{component:"fieldset",children:a.jsx(Q0,{"aria-label":"selected-value",name:"selected",value:t,sx:{gap:g=>g.spacing(.5)},onChange:g=>{i(""),e(g.target.value)},children:f.map(g=>a.jsx(yX,{legal:g,control:a.jsx(jl,{})},g.value))})})}),elseShow:a.jsx("p",{children:"No valid legal values available for this operator."})}),a.jsx(W,{condition:!!o,show:a.jsx("p",{className:d.error,children:o})})]})},sYe=Va()(e=>({singleValueContainer:{maxWidth:"300px",marginTop:"-1rem"},singleValueInput:{width:"100%",margin:"1rem 0"}})),O8=({setValue:e,value:t,type:n,error:r,setError:o})=>{const{classes:i}=sYe();return a.jsxs(a.Fragment,{children:[a.jsxs(w1,{children:["Add a single ",n.toLowerCase()," value"]}),a.jsx("div",{className:i.singleValueContainer,children:a.jsx(ar,{label:n,name:"value",value:t||"",onChange:s=>{o(""),e(s.target.value.trim())},onFocus:()=>o(""),placeholder:`Enter a single ${n} value`,className:i.singleValueInput,error:!!r,errorText:r})})]})},CE=(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}},aYe=({input:e,contextDefinition:t,constraintValues:n,constraintValue:r,localConstraint:o,setValue:i,setValues:s,setValuesWithRecord:l,setError:c,removeValue:u,error:d})=>{const f=()=>{var p;switch(e){case j_:case cX:return a.jsx(a.Fragment,{children:a.jsx(oYe,{data:CE(n,t.legalValues),constraintValues:n,values:o.values||[],setValuesWithRecord:l,setValues:s,error:d,setError:c})});case uX:return a.jsx(a.Fragment,{children:a.jsx(P8,{data:CE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"number",legalValues:((p=t.legalValues)==null?void 0:p.filter(h=>Number(h.value)))||[],error:d,setError:c})});case dX:return a.jsx(a.Fragment,{children:a.jsx(P8,{data:CE([r],t.legalValues),setValue:i,value:o.value,constraintValue:r,type:"semver",legalValues:t.legalValues||[],error:d,setError:c})});case fX:return a.jsx(Kqe,{value:o.value,setValue:i,error:d,setError:c});case pX:return a.jsx(R8,{values:o.values||[],removeValue:u,setValues:l,error:d,setError:c});case hX:return a.jsx(a.Fragment,{children:a.jsx(R8,{values:o.values||[],removeValue:u,setValues:l,error:d,setError:c})});case gX:return a.jsx(O8,{setValue:i,value:o.value,type:"number",error:d,setError:c});case mX:return a.jsx(O8,{setValue:i,value:o.value,type:"semver",error:d,setError:c})}};return a.jsx(a.Fragment,{children:f()})},$8="save",I8=(e,t)=>e.find(r=>r.name===t)||{name:"",description:"",createdAt:"",sortOrder:1,stickiness:!1},lYe=b("div")({padding:0,margin:0,width:"100%"}),cYe=b(Jf)(({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"}}})),uYe=b(Zf)(({theme:e})=>({border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}})),dYe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column",padding:0})),fYe=({constraint:e,compact:t,onSave:n,onDelete:r,onAutoSave:o})=>{const[i,s]=m.useState(Xp(e)),[l,c]=m.useState([Xp(e)]),{context:u}=yi(),[d,f]=m.useState(I8(u,i.contextName)),{validateConstraint:p}=dp(),[h,g]=m.useState(!1),[v,x]=m.useState(""),{input:y,validator:w,setError:S,error:C}=Gqe({contextDefinition:d,localConstraint:i});m.useEffect(()=>{g(!0)},[]),m.useEffect(()=>{f(I8(u,i.contextName))},[i.contextName,u]),m.useEffect(()=>{S("")},[S]);const E=()=>{if(l.length<2)return;const F=l[l.length-2];s(F),c(U=>U.slice(0,U.length-1)),j(F)},j=F=>{o&&o(F)},k=F=>{c(U=>[...U,F]),j(F)},T=m.useCallback(F=>{s(U=>{const O=Xp({...U,contextName:F,values:[],value:""});return k(O),O})},[]),_=m.useCallback(F=>{s(U=>{const O=Xp({...U,operator:F,values:[],value:""});return k(O),O})},[]),A=m.useCallback(F=>{s(U=>{const O={...U,values:F};return k(O),O})},[]),M=m.useCallback(F=>{s(U=>({...U,values:F}))},[]),I=m.useCallback(F=>{s(U=>{const O={...U,value:F};return k(O),O})},[]),P=()=>{s(F=>{const U={...F,inverted:!F.inverted};return k(U),U})},$=m.useCallback(()=>{s(F=>{const U={...F,caseInsensitive:!F.caseInsensitive};return k(U),U})},[]),z=m.useCallback(F=>{const U=[...i.values];U.splice(F,1),A(U)},[i,A]),Y=()=>{g(!1)},q=()=>{const F=Array.isArray(i.values)&&i.values.length>0,U=!!i.value;return F||U?(S(""),!0):(S("You must provide a value for the constraint"),!1)},G=async()=>{if(!q())return;const[U,O]=w();if(U||S(O),U)try{await p(i),S(""),x($8),Y();return}catch(L){S(Dt(L))}};return a.jsx(lYe,{children:a.jsxs(cYe,{expanded:h,TransitionProps:{onExited:()=>{v===$8&&(x(""),n(i))}},children:[a.jsx(uYe,{children:a.jsx(zqe,{localConstraint:i,setLocalConstraint:s,setContextName:T,setOperator:_,action:v,compact:t,setInvertedOperator:P,setCaseInsensitive:$,onDelete:r,onUndo:E,constraintChanges:l})}),a.jsx(dYe,{children:a.jsx(Tqe,{localConstraint:i,setValues:M,setValue:I,triggerTransition:Y,setAction:x,onSubmit:G,children:a.jsx(aYe,{setValues:M,setValuesWithRecord:A,setValue:I,setError:S,localConstraint:i,constraintValues:(e==null?void 0:e.values)||[],constraintValue:(e==null?void 0:e.value)||"",input:y,error:C,contextDefinition:d,removeValue:z})})})]})})},pYe=({filter:e,setFilter:t})=>a.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a.jsx("div",{style:{width:"300px"},children:a.jsx(Cn,{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:a.jsx(dd,{position:"start",children:a.jsx(md,{})})}})}),a.jsx(W,{condition:!!e,show:a.jsx(vi,{style:{marginLeft:"1rem"},label:`filter active: ${e}`,onDelete:()=>t("")})})]}),hYe=b(hs)({whiteSpace:"pre"}),gYe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),mYe=({values:e})=>{const[t,n]=m.useState("");return!e||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:e.length>20,show:a.jsx(pYe,{filter:t,setFilter:n})}),e.filter(r=>r.includes(t)).map((r,o)=>a.jsx(gYe,{label:a.jsx(hYe,{maxWidth:"400",text:r,maxLength:50})},`${r}-${o}`))]})},vYe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(600)]:{flexDirection:"column"}})),yYe=b("p")(({theme:e})=>({marginRight:e.spacing(1.5),[e.breakpoints.down(600)]:{marginBottom:e.spacing(1.5),marginRight:0}})),xYe=b(vi)(({theme:e})=>({margin:e.spacing(0,1,1,0)})),bYe=({value:e,operator:t})=>e?a.jsxs(vYe,{children:[a.jsxs(yYe,{children:["Value must be ",t]})," ",a.jsx(xYe,{label:a.jsx(hs,{maxWidth:"400",text:e,maxLength:50})})]}):null,wYe=b("div")(({theme:e})=>({padding:e.spacing(2,0),maxHeight:"400px",overflowY:"auto"})),SYe=({constraint:e})=>{const{locationSettings:t}=Mi();return a.jsx("div",{children:a.jsxs(wYe,{children:[a.jsx(mYe,{values:e.values}),a.jsx(bYe,{value:qC(e,t),operator:e.operator})]})})},CYe=b("div")(({theme:e})=>({padding:e.spacing(.5,1.5),borderRadius:e.shape.borderRadius,backgroundColor:e.palette.background.elevation2,lineHeight:1.25})),jYe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallBody,lineHeight:17/14,color:t?e.palette.text.secondary:e.palette.text.primary})),EYe=b("p",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.smallerBody,color:t?e.palette.text.secondary:e.palette.neutral.main})),TYe=({constraint:e,hasPrefix:t,disabled:n=!1})=>{const r=e.operator,o=Nb(e.operator);return a.jsxs(CYe,{style:{borderTopLeftRadius:t?0:void 0,borderBottomLeftRadius:t?0:void 0,paddingLeft:t?0:void 0},children:[a.jsx(jYe,{disabled:n,children:r}),a.jsx(EYe,{disabled:n,children:o})]})},SX=b("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})),kYe=b(SX)(({theme:e})=>({width:"auto",paddingLeft:e.spacing(1),paddingRight:e.spacing(1),marginLeft:0,borderTopRightRadius:0,borderBottomRightRadius:0})),M8=m.forwardRef(({isPrefix:e,...t},n)=>a.jsx(W,{condition:!!e,show:()=>a.jsx(kYe,{ref:n,...t}),elseShow:()=>a.jsx(SX,{ref:n,...t})})),_Ye=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),RYe=b("div")(({theme:e})=>({minWidth:"152px",position:"relative",[e.breakpoints.down("sm")]:{paddingRight:0}})),AYe=({constraint:e,disabled:t=!1})=>(It(),a.jsxs(_Ye,{children:[a.jsx(W,{condition:!!e.inverted,show:a.jsx(gt,{title:"Operator is negated",arrow:!0,children:a.jsx(ne,{sx:{display:"flex"},children:a.jsx(M8,{isPrefix:!0,children:a.jsx(LC,{})})})})}),a.jsx(RYe,{children:a.jsx(TYe,{constraint:e,hasPrefix:!!e.inverted,disabled:t})}),a.jsx(W,{condition:!e.caseInsensitive&&Qt(Ai,e.operator),show:a.jsx(gt,{title:"Case sensitive is active",arrow:!0,children:a.jsx(M8,{children:a.jsx(NC,{})})})})]})),PYe=b(vi)(({theme:e})=>({margin:"auto 0",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{margin:e.spacing(1,0)}})),OYe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),$Ye=({constraint:e,allowExpand:t,disabled:n=!1})=>{const{locationSettings:r}=Mi();return m.useEffect(()=>{t(!1)},[t]),a.jsx(OYe,{children:a.jsx(PYe,{sx:o=>({color:n?o.palette.text.secondary:"inherit"}),label:qC(e,r)})})},IYe=b("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"}})),MYe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",margin:"auto 0"})),DYe=b("div")(({theme:e})=>({display:"flex",justifyContent:"stretch",margin:"auto 0",flexDirection:"column",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0}})),LYe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,marginTop:e.spacing(.5),color:e.palette.links,[e.breakpoints.down("sm")]:{textAlign:"center"}})),NYe=({constraint:e,expanded:t,allowExpand:n,maxLength:r,disabled:o=!1})=>{var c;const[i,s]=m.useState(!1),l=m.useMemo(()=>{var u;return(u=e==null?void 0:e.values)==null?void 0:u.map(d=>d).join(", ")},[e]);return m.useEffect(()=>{l&&(n(((l==null?void 0:l.length)??0)>r),s(((l==null?void 0:l.length)??0)>r))},[l,r,n,s]),a.jsx(MYe,{children:a.jsxs(DYe,{children:[a.jsx(IYe,{sx:u=>({color:o?u.palette.text.secondary:"inherit"}),children:l}),a.jsx(W,{condition:i,show:a.jsx(LYe,{className:"valuesExpandLabel",children:t?"View less":`View all (${(c=e==null?void 0:e.values)==null?void 0:c.length})`})})]})})},FYe=b("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"}})),BYe=b("div")(({theme:e})=>({display:"flex",width:"100%",justifyContent:"space-between",borderRadius:e.spacing(1)})),zYe=b("div")(({theme:e})=>({display:"flex",alignItems:"stretch",marginLeft:e.spacing(1),[e.breakpoints.down("sm")]:{marginLeft:0,flexDirection:"column",alignItems:"center",width:"100%"}})),HYe=({constraint:e,singleValue:t,allowExpand:n,expanded:r,disabled:o=!1,maxLength:i=112})=>a.jsx(BYe,{children:a.jsxs(zYe,{children:[a.jsx(gt,{title:e.contextName,arrow:!0,children:a.jsx(FYe,{sx:s=>({color:o?s.palette.text.secondary:"inherit"}),children:e.contextName})}),a.jsx(AYe,{constraint:e,disabled:o}),a.jsx(W,{condition:t,show:a.jsx($Ye,{constraint:e,allowExpand:n,disabled:o}),elseShow:a.jsx(NYe,{constraint:e,expanded:r,allowExpand:n,maxLength:i,disabled:o})})]})}),UYe=ql("div")(({theme:e})=>({display:"flex",alignItems:"center",width:"100%",[e.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"center",position:"relative"}})),VYe=({constraint:e,onEdit:t,onDelete:n,singleValue:r,allowExpand:o,expanded:i,compact:s,disabled:l})=>{const{context:c}=yi(),{contextName:u}=e,d=!c.map(f=>f.name).includes(u);return a.jsxs(UYe,{children:[a.jsx(DC,{compact:s,disabled:l}),a.jsx(HYe,{constraint:e,singleValue:r,allowExpand:o,expanded:i,disabled:l}),a.jsx(lX,{onEdit:t,onDelete:n,disableEdit:d})]})},WYe=b(Jf)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,backgroundColor:"transparent",boxShadow:"none",margin:0,"&:before":{opacity:"0"}})),GYe=b(Zf)(({theme:e})=>({"& .root":{border:"none",padding:e.spacing(.5,3),"&:hover .valuesExpandLabel":{textDecoration:"underline"}},userSelect:"auto",WebkitUserSelect:"auto",MozUserSelect:"auto",MsUserSelect:"auto"})),qYe=b(Qf)(({theme:e})=>({borderTop:`1px dashed ${e.palette.divider}`,display:"flex",flexDirection:"column"})),YYe=b("div")({display:"flex",flexDirection:"column",width:"100%"}),KYe=({constraint:e,onEdit:t,onDelete:n,sx:r=void 0,compact:o=!1,disabled:i=!1,renderAfter:s})=>{const[l,c]=m.useState(!0),[u,d]=m.useState(!1),f=Qt([...Dl,...Ml,...Do],e.operator),p=()=>{l&&d(!u)};return a.jsxs(WYe,{expanded:u,sx:r,children:[a.jsx(GYe,{expandIcon:null,onClick:p,sx:{cursor:l?"pointer":"default!important","&:hover":{cursor:l?"pointer":"default!important"}},children:a.jsxs(YYe,{children:[a.jsx(VYe,{constraint:e,onEdit:t,onDelete:n,singleValue:f,allowExpand:c,disabled:i,expanded:u,compact:o}),s]})}),a.jsx(qYe,{children:a.jsx(SYe,{constraint:e})})]})},XYe=({constraint:e,compact:t=!1,editing:n,onEdit:r,onCancel:o,onDelete:i,onSave:s,onAutoSave:l})=>e?a.jsx(W,{condition:!!(n&&s),show:a.jsx(fYe,{constraint:e,onCancel:o,onSave:s,onDelete:i,onAutoSave:l,compact:t}),elseShow:a.jsx(KYe,{constraint:e,onEdit:r,onDelete:i})}):null,JYe="constraintAccordionListId",QYe=b("div")({width:"100%",display:"flex",flexDirection:"column"});b(gt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)}));b(Lf)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}}));b("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary}));b("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"}));const ZYe=m.forwardRef(({constraints:e,setConstraints:t,state:n},r)=>{const{context:o}=yi(),i=t&&(d=>{n.set(d,{editing:!0})}),s=t&&(d=>{const f=e[d];n.set(f,{}),t(_i(p=>{p.splice(d,1)}))}),l=t&&((d,f)=>{n.set(f,{}),t(_i(p=>{p[d]=f}))}),c=t&&(d=>f=>{n.set(f,{editing:!0}),t(_i(p=>p.map(h=>h[v0]===d?f:h)))}),u=d=>{var p;const f=e[d];(p=n.get(f))!=null&&p.new&&(s==null||s(d)),n.set(f,{})};return o.length===0?null:a.jsx(QYe,{id:JYe,children:e.map((d,f)=>{var h;const p=d[v0];return a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:f>0,show:a.jsx(YC,{text:"AND"})}),a.jsx(XYe,{constraint:d,onEdit:i==null?void 0:i.bind(null,d),onCancel:u.bind(null,f),onDelete:s==null?void 0:s.bind(null,f),onSave:l==null?void 0:l.bind(null,f),onAutoSave:c==null?void 0:c(p),editing:!!((h=n.get(d))!=null&&h.editing),compact:!0})]},p)})})}),eKe="constraintAccordionListId",tKe=b("div")({width:"100%",display:"flex",flexDirection:"column"});b(gt)(({theme:e})=>({marginLeft:e.spacing(.75),height:e.spacing(1.5)}));b(Lf)(({theme:e})=>({fill:e.palette.action.active,[e.breakpoints.down(860)]:{display:"none"}}));b("p")(({theme:e})=>({marginBottom:e.spacing(1),color:e.palette.text.secondary}));b("div")(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1),color:e.palette.text.primary,display:"flex"}));const nKe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),rKe=m.forwardRef(({constraints:e,setConstraints:t,showCreateButton:n,showLabel:r=!0},o)=>{const{onAdd:i,state:s,context:l}=iX(t,o);return l.length===0?null:a.jsx(tKe,{id:eKe,children:a.jsx(W,{condition:!!(n&&i),show:a.jsxs("div",{children:[a.jsxs(nKe,{children:[a.jsx(Z,{children:"Constraints"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsx(ne,{children:a.jsxs(Z,{variant:"body2",children:["Constraints are advanced targeting rules that you can use to enable a feature flag for a subset of your users. Read more about constraints"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),a.jsx(ZYe,{ref:o,setConstraints:t,constraints:e,state:s}),a.jsx(We,{sx:{marginTop:"1rem"},type:"button",onClick:i,startIcon:a.jsx(ni,{}),variant:"outlined",color:"primary","data-testid":"ADD_CONSTRAINT_BUTTON",children:"Add constraint"})]})})})}),oKe=e=>{if(e.hasOwnProperty("values")&&(!e.hasOwnProperty("value")||e.value===""))return e.values&&e.values.length>0;if(e.hasOwnProperty("value"))return e.value!==""},iKe=({projectId:e,environmentId:t,strategy:n,setStrategy:r})=>{m.useEffect(()=>()=>{n.constraints&&r(c=>{var u;return{...c,constraints:(u=c.constraints)==null?void 0:u.filter(oKe)}})},[]);const o=n.constraints||[],i=c=>{r(u=>({...u,constraints:c instanceof Function?c(u.constraints||[]):c}))},s=Fh(rq,e,t),l=Fh(YS,e,t);return a.jsx(rKe,{constraints:o,setConstraints:l?i:void 0,showCreateButton:s})},D8=e=>{const t=Array.isArray(e.values)&&e.values.length>0,n=!!e.value;return t||n},GP=e=>{const t=!!(e&&e.length===0),[n,r]=m.useState(t),{validateConstraint:o}=dp();return m.useEffect(()=>{if(!e)return;if(e.find(l=>!D8(l))){r(!1);return}const s=e.filter(D8).map(l=>o(l));Promise.all(s).then(()=>r(!0)).catch(()=>r(!1))},[JSON.stringify(e)]),n},sKe=Va()(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}}})),aKe=b("div")(({theme:e})=>({display:"flex",alignItems:"center",borderRadius:e.spacing(2),'& .MuiInputLabel-root[data-shrink="false"]':{top:3}}));b("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}));const lKe=b(ep)({flex:1}),CX=({label:e,options:t,value:n=[],onChange:r,disabled:o})=>{const[i,s]=m.useState("Add Segments");sKe();const l=It(),c=u=>{const{InputProps:d}=u;return a.jsx(Cn,{...u,InputProps:{...d,startAdornment:a.jsx(dd,{position:"start",children:a.jsx(ni,{sx:{height:20,width:20,color:l.palette.primary.main}})})},variant:"outlined",sx:{width:"215px","& .MuiOutlinedInput-root":{"& .MuiInputBase-input":{color:l.palette.primary.main,opacity:1,"&::placeholder":{color:l.palette.primary.main,fontWeight:"bold",opacity:1}},"& .MuiOutlinedInput-notchedOutline":{borderColor:l.palette.primary.main,opacity:.5},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"1px"}}},placeholder:e,onFocus:()=>s(""),onBlur:()=>s(e)})};return a.jsx(aKe,{children:a.jsx(lKe,{options:t,value:n,onChange:(u,d)=>r(d||[]),renderInput:c,getOptionLabel:u=>u.label,disabled:o,size:"small",multiple:!0})})};var qP={},cKe=ze;Object.defineProperty(qP,"__esModule",{value:!0});var jX=qP.default=void 0,uKe=cKe(He()),dKe=a,fKe=(0,uKe.default)((0,dKe.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");jX=qP.default=fKe;const pKe=b("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})),L8=b("button")(({theme:e})=>({all:"unset",height:e.spacing(2),cursor:"pointer"})),hKe=b(ln)(({theme:e})=>({marginRight:e.spacing(1),color:"inherit",textDecoration:"none"})),jE=e=>({fontSize:e.fontSizes.bodySize}),gKe=({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)},s=a.jsx(W,{condition:e===n,show:a.jsx(gC,{titleAccess:"Hide",sx:jE}),elseShow:a.jsx(hC,{titleAccess:"Show",sx:jE})}),l=e===n?"Hide segment constraints":"Preview segment constraints";return a.jsxs(pKe,{children:[a.jsx(hKe,{to:`/segments/edit/${e.id}`,target:"_blank",rel:"noreferrer",children:e.name}),a.jsx(gt,{title:l,arrow:!0,children:a.jsx(L8,{type:"button",onClick:i,"aria-expanded":e===n,"aria-controls":VP,children:s})}),a.jsx(gt,{title:"Remove segment",arrow:!0,children:a.jsx(L8,{type:"button",onClick:o,children:a.jsx(jX,{titleAccess:"Remove",sx:jE})})})]})};var YP={},mKe=ze;Object.defineProperty(YP,"__esModule",{value:!0});var KP=YP.default=void 0,vKe=mKe(He()),yKe=a,xKe=(0,vKe.default)((0,yKe.jsx)("path",{d:"M11 5.08V2c-5 .5-9 4.81-9 10s4 9.5 9 10v-3.08c-3-.48-6-3.4-6-6.92s3-6.44 6-6.92zM18.97 11H22c-.47-5-4-8.53-9-9v3.08C16 5.51 18.54 8 18.97 11zM13 18.92V22c5-.47 8.53-4 9-9h-3.03c-.43 3-2.97 5.49-5.97 5.92z"}),"DonutLarge");KP=YP.default=xKe;const bKe=b(Jf,{shouldForwardProp:e=>e!=="isDisabled"})(({theme:e,isDisabled:t})=>({border:`1px solid ${e.palette.divider}`,"&.segment-accordion":{borderRadius:e.shape.borderRadiusMedium},boxShadow:"none",margin:0,transition:"all 0.1s ease","&:before":{opacity:"0 !important"},"&.Mui-expanded":{backgroundColor:e.palette.neutral.light},backgroundColor:t?e.palette.envAccordion.disabled:e.palette.background.paper})),wKe=b(Zf)(({theme:e})=>({margin:e.spacing(0,.5),fontSize:e.typography.body2.fontSize,".MuiAccordionSummary-content":{display:"flex",alignItems:"center"}})),SKe=b(ln)(({theme:e})=>({textDecoration:"none",marginLeft:e.spacing(1),"&:hover":{textDecoration:"underline"}})),CKe=b("span",{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({color:t?e.palette.text.secondary:"inherit"})),EX=({segment:e,isExpanded:t,headerContent:n,constraintList:r,disabled:o=!1})=>{var l;const[i,s]=m.useState(t||!1);return a.jsxs(bKe,{className:"segment-accordion",isDisabled:o,expanded:i,children:[a.jsxs(wKe,{id:`segment-accordion-${e.id}`,children:[a.jsx(KP,{sx:c=>({mr:1,color:o?c.palette.neutral.border:c.palette.secondary.main})}),a.jsx(CKe,{disabled:o,children:"Segment:"}),a.jsx(SKe,{to:`/segments/edit/${e.id}`,children:e.name}),a.jsx(W,{condition:!!n,show:n}),a.jsx(W,{condition:!t,show:a.jsx(We,{size:"small",variant:"outlined",onClick:()=>s(c=>!c),sx:{my:0,ml:"auto",fontSize:c=>c.typography.body2.fontSize},children:i?"Close preview":"Preview"})})]}),a.jsx(Qf,{sx:{pt:0},children:a.jsx(W,{condition:!!r,show:r,elseShow:a.jsx(W,{condition:(((l=e==null?void 0:e.constraints)==null?void 0:l.length)||0)>0,show:a.jsx(KC,{constraints:e.constraints,showLabel:!1}),elseShow:a.jsx(Z,{children:"This segment has no constraints."})})})})]})},jKe=b("div")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1)})),EKe=b("p")(({theme:e})=>({color:e.palette.text.secondary})),TKe=b("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})),kKe=({segments:e,setSegments:t})=>{const[n,r]=m.useState(),o=e.length-1;return e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:e&&e.length>0,show:a.jsx(EKe,{children:"Selected Segments"})}),a.jsx(jKe,{children:e.map((i,s)=>a.jsxs(m.Fragment,{children:[a.jsx(gKe,{segment:i,setSegments:t,preview:n,setPreview:r}),a.jsx(W,{condition:s<o,show:a.jsx(TKe,{children:"AND"})})]},i.id))}),a.jsx(W,{condition:!!n,show:()=>a.jsx(EX,{segment:n,isExpanded:!0})})]})},fp=()=>{const{uiConfig:e}=ht();return{segmentValuesLimit:e.segmentValuesLimit,strategySegmentsLimit:e.strategySegmentsLimit}},_Ke=()=>{const{segmentValuesLimit:e}=fp();return typeof e>"u"?null:a.jsxs(Vt,{severity:"info",children:["A segment can have"," ",a.jsxs("a",{href:"https://docs.getunleash.io/reference/segments#segment-limits",target:"_blank",rel:"noreferrer",children:["at most ",e," across all of its contraints"]}),". ",a.jsx(TX,{})]})},RKe=e=>{const{segmentValuesLimit:t}=fp();return typeof t>"u"?null:a.jsxs(Vt,{severity:"error",children:["A segment can have"," ",a.jsxs("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","."]})},AKe=()=>{const{strategySegmentsLimit:e}=fp();return typeof e>"u"?null:a.jsxs(Vt,{severity:"warning",children:["You can't apply more than ",e," segments to a strategy. ",a.jsx(TX,{})]})},TX=()=>a.jsxs(a.Fragment,{children:[a.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Get in touch"})," ","if you'd like to increase this limit."]}),kX="https://docs.getunleash.io/reference/segments";b(vr)(({theme:e})=>({fontSize:e.fontSizes.smallBody}));const PKe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),OKe=({segments:e,setSegments:t,projectId:n})=>{const{segments:r}=Wc(),{strategySegmentsLimit:o}=fp(),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(f=>f.id===d.id)).map(d=>({value:String(d.id),label:d.name})),u=([d])=>{const f=r.find(p=>String(p.id)===d.value);f&&t(p=>[...p,f])};return a.jsxs(a.Fragment,{children:[a.jsxs(PKe,{children:[a.jsx(Z,{children:"Segments"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsx(ne,{children:a.jsxs(Z,{variant:"body2",children:["Segments are reusable sets of constraints that can be defined once and reused across feature toggle configurations. You can create a segment on the global or the project level. Read more about segments"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/segments",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),i&&a.jsx(AKe,{}),a.jsx(CX,{label:"Select segments",options:c,onChange:u,disabled:i}),a.jsx(kKe,{segments:e,setSegments:t})]})},$Ke=(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"&&!IKe(t))return"Not a valid number."}},IKe=e=>typeof e>"u"||e===""||/^\d+$/.test(String(e)),MKe=({environment:e})=>a.jsxs(Vt,{severity:"info",children:[a.jsx("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."]}),E_="production",DKe=({open:e,onClose:t,onClick:n,label:r,loading:o})=>{const{value:i,setValue:s}=XP(),[l,c]=m.useState(i.hide),u=()=>{s(d=>({hide:!d.hide})),c(d=>!d)};return a.jsxs(rr,{title:"Changing production environment!",primaryButtonText:r,disabledPrimaryButton:o,secondaryButtonText:"Cancel",onClick:n,onClose:t,open:e,children:[a.jsx(Vt,{severity:"error",children:"WARNING. You are about to make changes to a production environment. These changes will affect your customers."}),a.jsx("p",{style:{marginTop:"1rem"},children:"Are you sure you want to proceed?"}),a.jsx(Qr,{label:"Don't show again",control:a.jsx(os,{checked:l,onChange:u})})]})},LKe=(e,t)=>{var r;const{value:n}=XP();return n.hide?!1:typeof e=="string"?e===E_:(r=e==null?void 0:e.environments)==null?void 0:r.some(o=>o.name===t&&o.type===E_)},NKe="useFeatureStrategyProdGuardSettings:v2",XP=()=>Xl(NKe,{hide:!1}),REt=e=>{const{value:t}=XP();return e===E_&&!t.hide},FKe=e=>({changeRequestInReviewOrApproved:n=>e?e.some(r=>r.environment===n&&Qt(["In review","Approved"],r.state)):!1,alert:a.jsx(Vt,{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?"})}),BKe=({title:e,setTitle:t})=>a.jsxs(ne,{sx:{paddingBottom:n=>n.spacing(2)},children:[a.jsx(Z,{sx:{paddingBottom:n=>n.spacing(2)},children:"What would you like to call this strategy? (optional)"}),a.jsx(ar,{label:"Strategy title",id:"title-input",value:e,onChange:n=>t(n.target.value),sx:{width:"100%"}})]}),zKe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:`${e.shape.borderRadiusMedium}px`})),HKe=({enabled:e,onToggleEnabled:t})=>a.jsxs(zKe,{children:[a.jsx(Z,{children:"Strategy Status"}),a.jsx(Qr,{control:a.jsx(is,{name:"enabled",onChange:t,checked:e}),label:"Enabled"})]});var JP={},UKe=ze;Object.defineProperty(JP,"__esModule",{value:!0});var _X=JP.default=void 0,VKe=UKe(He()),WKe=a,GKe=(0,VKe.default)((0,WKe.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"}),"Cloud");_X=JP.default=GKe;const qKe=({enabled:e,className:t})=>{const n=It(),r=e?"Environment enabled":"Environment disabled",o={backgroundColor:e?n.palette.primary.light:n.palette.neutral.border,borderRadius:"50%",width:"28px",height:"28px",minWidth:"28px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:n.spacing(1)},i={fill:n.palette.common.white,width:"16px",height:"16px"};return a.jsx("div",{style:o,className:t,children:a.jsx(_X,{style:i,titleAccess:r})})},YKe=b(ne)(({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,width:"45px",position:"absolute",top:"-10px",left:"calc(50% - 45px)",lineHeight:1})),KKe=b("form")(({theme:e})=>({position:"relative",display:"flex",flexDirection:"column",gap:e.spacing(2),padding:e.spacing(6),paddingBottom:e.spacing(12),paddingTop:e.spacing(4),overflow:"auto",height:"100%"})),XKe=b("h1")(({theme:e})=>({fontWeight:"normal",display:"flex",alignItems:"center",paddingTop:e.spacing(2),paddingBottom:e.spacing(2)})),JKe=b("div")(({theme:e})=>({bottom:0,right:0,left:0,position:"absolute",display:"flex",padding:e.spacing(3),paddingRight:e.spacing(6),paddingLeft:e.spacing(6),backgroundColor:e.palette.background.paper,justifyContent:"end",borderTop:`1px solid ${e.palette.divider}`})),QKe=b(AV)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,borderBottom:`1px solid ${e.palette.divider}`,paddingLeft:e.spacing(6),paddingRight:e.spacing(6),minHeight:"60px"})),ZKe=b(ne)(({theme:e})=>({display:"flex",position:"relative",marginTop:e.spacing(3.5)})),eXe=b(vr)(({theme:e})=>({width:"100%"})),tXe=b("div")(({theme:e})=>({color:e.palette.text.secondary,marginTop:e.spacing(1.5)})),nXe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:e.spacing(6),paddingRight:e.spacing(6),paddingTop:e.spacing(2)})),rXe=b(ne)(({theme:e})=>({paddingLeft:e.spacing(6),paddingRight:e.spacing(6),"& > *":{marginTop:e.spacing(2),marginBottom:e.spacing(2)}})),oXe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center"})),iXe=b(ne)(({theme:e})=>({transform:"scale(0.9)",display:"flex",alignItems:"center"})),sXe=b(Z)(({theme:e,enabled:t})=>({fontWeight:t?"bold":"normal"})),aXe=b(Z)(({theme:e})=>({marginRight:e.spacing(.5),color:e.palette.text.secondary})),lXe=b(pb)(({theme:e})=>({width:"100px"})),N8=b(qt)(({theme:e})=>({marginLeft:e.spacing(1)})),RX=({projectId:e,feature:t,environmentId:n,permission:r,onSubmit:o,onCancel:i,loading:s,strategy:l,setStrategy:c,segments:u,setSegments:d,errors:f,isChangeRequest:p,tab:h,setTab:g,StrategyVariants:v})=>{var ue,ve;const{trackEvent:x}=Sn(),[y,w]=m.useState(!1),S=GP(l.constraints),C=LKe(t,n),E=Fh(r,e,n),{strategyDefinition:j}=AP(l==null?void 0:l.name);m.useEffect(()=>{x("new-strategy-form",{props:{eventType:"seen"}})});const k=l!=null&&l.parameters&&"stickiness"in(l==null?void 0:l.parameters)?String(l.parameters.stickiness):"default";m.useEffect(()=>{c(Ce=>({...Ce,variants:(l.variants||[]).map(J=>({stickiness:k,name:J.name,weight:J.weight,payload:J.payload,weightType:J.weightType}))}))},[k,JSON.stringify(l.variants)]);const T=t.environments.find(Ce=>Ce.name===n),{data:_}=wC(t.project),{changeRequestInReviewOrApproved:A,alert:M}=FKe(_),I=A(n||""),P=I?"Add to existing change request":"Add change to draft",$=$t(),{error:z,loading:Y}=ht();if(z)throw z;if(Y||!j)return null;const q=Ce=>j.parameters.find(J=>J.name===Ce),G=(Ce,J)=>{const oe=$Ke(q(Ce),J);return oe?(f.setFormError(Ce,oe),!1):(f.removeFormError(Ce),!0)},F=()=>j.parameters.map(Ce=>Ce.name).map(Ce=>{var J;return G(Ce,(J=l.parameters)==null?void 0:J[Ce])}).every(Boolean),U=()=>{$(QP(t.project,t.name))},O=async Ce=>{var J;Array.isArray(l.variants)&&((J=l.variants)==null?void 0:J.length)>0&&x("strategy-variants",{props:{eventType:"submitted"}}),Ce.preventDefault(),F()&&(x("new-strategy-form",{props:{eventType:"submitted"}}),C&&!p?w(!0):o())},L=(Ce,J)=>{g(J)},te=()=>{var oe;const Ce=((oe=l.constraints)==null?void 0:oe.length)||0,J=u.length||0;return Ce+J},re=l.parameters&&"stickiness"in l.parameters;return a.jsxs(a.Fragment,{children:[a.jsxs(nXe,{children:[a.jsxs(XKe,{children:[td(l.name||""),a.jsx(W,{condition:l.name==="flexibleRollout",show:a.jsxs(qt,{color:"success",sx:{marginLeft:"1rem"},children:[(ue=l.parameters)==null?void 0:ue.rollout,"%"]})})]}),T?a.jsxs(oXe,{children:[a.jsx(aXe,{children:"Environment:"}),a.jsxs(iXe,{children:[a.jsx(qKe,{enabled:T.enabled})," ",a.jsx(sXe,{enabled:T.enabled,children:T.name})]})]}):null]}),a.jsxs(rXe,{children:[a.jsx(W,{condition:I,show:M,elseShow:a.jsx(W,{condition:p,show:a.jsx(MKe,{environment:n})})}),a.jsx(W,{condition:!Jq.includes(l.name||"default"),show:a.jsxs(Vt,{severity:"warning",children:["Custom strategies are deprecated. We recommend not adding them to any flags going forward and using the predefined strategies like Gradual rollout with"," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",variant:"body2",children:"constraints"})," ","instead."]})}),a.jsx(mHe,{projectId:t.project,featureId:t.name,environmentId:n,children:a.jsx(W,{condition:!!p,show:a.jsxs(Vt,{severity:"success",children:["This feature flag is currently enabled in the"," ",a.jsx("strong",{children:n})," environment. Any changes made here will be available to users as soon as these changes are approved and applied."]}),elseShow:a.jsxs(Vt,{severity:"success",children:["This feature flag is currently enabled in the"," ",a.jsx("strong",{children:n})," environment. Any changes made here will be available to users as soon as you hit ",a.jsx("strong",{children:"save"}),"."]})})})]}),a.jsxs(QKe,{value:h,onChange:L,children:[a.jsx(lXe,{label:"General"}),a.jsx(pb,{"data-testid":"STRATEGY_TARGETING_TAB",label:a.jsxs(Z,{children:["Targeting",a.jsx(N8,{children:te()})]})}),re&&a.jsx(pb,{"data-testid":"STRATEGY_VARIANTS_TAB",label:a.jsxs(Z,{children:["Variants",a.jsx(N8,{children:((ve=l.variants)==null?void 0:ve.length)||0})]})})]}),a.jsxs(KKe,{onSubmit:O,children:[a.jsx(W,{condition:h===0,show:a.jsxs(a.Fragment,{children:[a.jsx(BKe,{title:l.title||"",setTitle:Ce=>{c(J=>({...J,title:Ce}))}}),a.jsx(HKe,{enabled:!(l!=null&&l.disabled),onToggleEnabled:()=>c(Ce=>({...Ce,disabled:!Ce.disabled}))}),a.jsx(gHe,{strategy:l,strategyDefinition:j,setStrategy:c,validateParameter:G,errors:f,hasAccess:E})]})}),a.jsx(W,{condition:h===1,show:a.jsxs(a.Fragment,{children:[a.jsx(tXe,{children:"Segmentation and constraints allow you to set filters on your strategies, so that they will only be evaluated for users and applications that match the specified preconditions."}),a.jsx(OKe,{segments:u,setSegments:d,projectId:e}),a.jsxs(ZKe,{children:[a.jsx(eXe,{}),a.jsx(YKe,{children:"AND"})]}),a.jsx(iKe,{projectId:t.project,environmentId:n,strategy:l,setStrategy:c})]})}),a.jsx(W,{condition:h===2,show:a.jsx(W,{condition:l.parameters!=null&&"stickiness"in l.parameters,show:v})}),a.jsxs(JKe,{children:[a.jsx(ei,{permission:r,projectId:t.project,environmentId:n,variant:"contained",color:"primary",type:"submit",disabled:s||!S||f.hasFormErrors(),"data-testid":ZSe,children:p?P:"Save strategy"}),a.jsx(We,{type:"button",color:"primary",onClick:i||U,disabled:s,children:"Cancel"}),a.jsx(DKe,{open:y,onClose:()=>w(!1),onClick:o,loading:s,label:"Save strategy"})]})]})]})},cXe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),uXe=function(e){return"/"+e},F8={},yd=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){const i=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));o=Promise.all(n.map(c=>{if(c=uXe(c),c in F8)return;F8[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const g=i[h];if(g.href===c&&(!u||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":cXe,u||(p.as="script",p.crossOrigin=""),p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}return o.then(()=>t()).catch(i=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=i,window.dispatchEvent(s),!s.defaultPrevented)throw i})},dXe=({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)},s=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 a.jsx(Cn,{...o,error:r,placeholder:n,value:e?e.join(", "):"",onKeyDown:s,onChange:i,style:{width:"100%"},variant:"outlined",size:"small"})},fXe=b("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"}}})),pXe=b(SC)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),hXe=b("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex"})),gXe=b(dXe)(()=>({width:"100%"})),mXe=b(Cn)(()=>({width:"100%"})),vXe=({overrides:e,overridesDispatch:t})=>{const{context:n}=yi(),r=n.map(({name:s})=>({key:s,label:s})),o=s=>l=>{t({type:"UPDATE_VALUES_AT",payload:[s,l]})},i=s=>(l,c)=>{l==null||l.preventDefault(),t({type:"UPDATE_VALUES_AT",payload:[s,c||[]]})};return a.jsx(a.Fragment,{children:e.map((s,l)=>{var f;const c=n.find(({name:p})=>p===s.contextName),u=((f=c==null?void 0:c.legalValues)==null?void 0:f.map(({value:p})=>p))||[],d=s.values.filter(p=>u.includes(p));return a.jsxs(fXe,{children:[a.jsx(pXe,{id:"override-context-name",name:"contextName",label:"Context Field","data-testid":"context_field",value:s.contextName,options:r,onChange:p=>t({type:"UPDATE_TYPE_AT",payload:[l,p.target.value]})}),a.jsxs(hXe,{children:[a.jsx(W,{condition:!!(u&&u.length>0),show:a.jsx(ep,{multiple:!0,id:`override-select-${l}`,isOptionEqualToValue:(p,h)=>p===h,options:u,onChange:i(l),getOptionLabel:p=>p,value:d,style:{width:"100%"},filterSelectedOptions:!0,size:"small",renderInput:p=>a.jsx(mXe,{...p,variant:"outlined",label:"Legal values"})}),elseShow:a.jsx(gXe,{label:"Values (v1, v2, ...)",name:"values",placeholder:"",values:s.values,updateValues:o(l),"data-testid":"OVERRIDE_VALUES"})}),a.jsx(gt,{title:"Remove",arrow:!0,children:a.jsx(Ht,{onClick:p=>{p.preventDefault(),t({type:"REMOVE",payload:l})},children:a.jsx(co,{})})})]})]},`override=${l}`)})})},yXe=(e,t)=>{switch(t.type){case"SET":return t.payload;case"CLEAR":return[];case"ADD":return[...e,t.payload];case"REMOVE":return e.filter((n,r)=>r!==t.payload);case"UPDATE_VALUES_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,values:r}:o)}case"UPDATE_TYPE_AT":{const[n,r]=t.payload;return e.map((o,i)=>i===n?{...o,contextName:r}:o)}}},xXe=(e=[])=>m.useReducer(yXe,e);var mc=(e=>(e.FIX="fix",e.VARIABLE="variable",e))(mc||{});const bXe=Me.lazy(()=>yd(()=>import("./ReactJSONEditor-C-nON7ak.js"),[])),wXe=b("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"})),SXe=b("div")(({theme:e,color:t})=>({position:"absolute",left:0,top:0,height:"100%",background:t||"transparent",width:e.spacing(1)})),CXe=b(gt)(({theme:e})=>({position:"absolute",top:e.spacing(2),right:e.spacing(2)})),AX=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),B8=b(AX)(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginTop:e.spacing(1),marginBottom:e.spacing(2)})),jXe=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(2)})),EXe=b(Qr)(({theme:e})=>({marginBottom:e.spacing(1),"& > span":{fontSize:e.fontSizes.smallBody},[e.breakpoints.down("sm")]:{marginTop:e.spacing(1),marginBottom:e.spacing(1.5)}})),TXe=b("div")(({theme:e})=>({width:"100%",gap:e.spacing(1.5),display:"flex","& > div":{width:"100%"}})),z8=b(ar)(({theme:e})=>({width:"100%","& textarea":{minHeight:e.spacing(3),resize:"vertical"}})),kXe=b("div")(({theme:e})=>({marginLeft:e.spacing(3)})),_Xe=b(ar)(({theme:e})=>({width:e.spacing(24),[e.breakpoints.down("sm")]:{width:"100%"}})),RXe=b("div")(({theme:e})=>({marginTop:e.spacing(3),flexGrow:1})),PX=b("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%"}}})),AXe=b(PX)({alignItems:"end",justifyContent:"space-between"}),PXe=b(SC)(({theme:e})=>({marginRight:e.spacing(10),[e.breakpoints.up("sm")]:{minWidth:e.spacing(20)}})),OXe=b(We)(({theme:e})=>({marginTop:e.spacing(-1),marginLeft:e.spacing(-1)})),$Xe=[{key:"string",label:"string"},{key:"json",label:"json"},{key:"csv",label:"csv"},{key:"number",label:"number"}],IXe={type:"string",value:""},MXe=({variant:e,variants:t,updateVariant:n,removeVariant:r,error:o,disableOverrides:i=!1,decorationColor:s})=>{const[l,c]=m.useState(e.name),[u,d]=m.useState(e.weightType===mc.FIX),[f,p]=m.useState(String(e.weight/10)),[h,g]=m.useState(e.payload||IXe),[v,x]=xXe("overrides"in e?e.overrides||[]:[]),{context:y}=yi(),[w,S]=m.useState({}),C=q=>{S(G=>({...G,[q]:void 0}))},E=(q,G)=>{S(F=>({...F,[q]:G}))};m.useEffect(()=>{C("percentage"),o!=null&&o.includes("%")&&E("percentage","Total weight must equal 100%")},[o]);const j=!e.new,k=t.filter(({id:q,weightType:G})=>q!==e.id&&G===mc.VARIABLE).length>0,T=q=>{const G=q.weightType===mc.VARIABLE,F=t.some(O=>O.weightType===mc.FIX),U=t.filter(O=>O.weightType===mc.VARIABLE).length===1;return F&&U&&G},_=q=>{C("name"),$(q,e.id)||E("name","A variant with that name already exists for this environment."),c(q.trim())},A=q=>{(q===""||z(q))&&p(q)},M=q=>{Y(q)||E("payload",q.type==="json"?"Invalid json":"Invalid number")},I=()=>{y.length>0&&x({type:"ADD",payload:{contextName:y[0].name,values:[]}})},P=q=>!!q.length,$=(q,G)=>j||!t.some(F=>F.name===q&&F.id!==G),z=q=>{if(!u)return!0;if(q===""||q.match(/\.[0-9]{2,}$/))return!1;const G=Number(q);return G>=0&&G<=100},Y=q=>{try{return q.type==="json"&&JSON.parse(q.value),q.type==="number"?!Number.isNaN(Number(q.value)):!0}catch{return!1}};return m.useEffect(()=>{const q={...e,name:l,weight:Number(u?f:100)*10,weightType:u?mc.FIX:mc.VARIABLE,stickiness:(t==null?void 0:t.length)>0?t[0].stickiness:"default",payload:h.value?h:void 0,isValid:P(l)&&$(l,e.id)&&z(f)&&Y(h)&&!o};i||(q.overrides=v.map(G=>({contextName:G.contextName,values:G.values})).filter(G=>G.values&&G.values.length>0)),n(q)},[l,u,f,h,v]),m.useEffect(()=>{u||p(String(e.weight/10))},[e.weight]),a.jsxs(wXe,{"data-testid":"VARIANT",children:[a.jsx(SXe,{color:s}),a.jsx(CXe,{arrow:!0,title:T(e)?"You need to have at least one variable variant":"Delete variant",children:a.jsx("div",{children:a.jsx(Ht,{"data-testid":`VARIANT_DELETE_BUTTON_${e.name}`,onClick:()=>r(e.id),disabled:T(e),children:a.jsx(co,{})})})}),a.jsxs(AXe,{children:[a.jsxs(RXe,{children:[a.jsx(AX,{children:"Variant name"}),a.jsx(jXe,{children:"This will be used to identify the variant in your code"}),a.jsx(z8,{id:`variant-name-input-${e.id}`,"data-testid":"VARIANT_NAME_INPUT",label:"Variant name",error:!!w.name,errorText:w.name,value:l,onChange:q=>_(q.target.value),disabled:j,required:!0})]}),a.jsx(W,{condition:k,show:a.jsxs(kXe,{children:[a.jsx(EXe,{label:"Custom percentage",control:a.jsx(is,{"data-testid":"VARIANT_WEIGHT_CHECK",checked:u,onChange:q=>d(q.target.checked)})}),a.jsx(_Xe,{"data-testid":"VARIANT_WEIGHT_INPUT",type:"number",label:"Variant weight",error:!!w.percentage,errorText:w.percentage,value:f,onChange:q=>A(q.target.value),required:u,disabled:!u,"aria-valuemin":0,"aria-valuemax":100,InputProps:{endAdornment:a.jsx(dd,{position:"end",children:"%"})}})]})})]}),a.jsxs(B8,{children:["Payload",a.jsx(ua,{tooltip:"Passed along with the the variant object."})]}),a.jsxs(PX,{children:[a.jsx(PXe,{id:"variant-payload-type",name:"type",label:"Type",value:h.type,options:$Xe,onChange:q=>{C("payload"),g(G=>({...G,type:q.target.value}))}}),a.jsx(TXe,{children:a.jsx(W,{condition:h.type==="json",show:a.jsx(m.Suspense,{fallback:null,children:a.jsx(bXe,{content:{text:h.value},onChange:q=>g(G=>{var F;return{...G,value:"json"in q?((F=q.json)==null?void 0:F.toString())||"":q.text}})})}),elseShow:a.jsx(z8,{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:q=>{C("payload"),g(G=>({...G,value:q.target.value}))},placeholder:"",onBlur:()=>M(h),error:!!w.payload,errorText:w.payload})})})]}),i?null:a.jsxs(a.Fragment,{children:[a.jsxs(B8,{children:["Overrides",a.jsx(ua,{tooltip:"Here you can specify which users should get this variant."})]}),a.jsx(vXe,{overrides:v,overridesDispatch:x}),a.jsx("div",{children:a.jsx(OXe,{onClick:I,variant:"text",color:"primary","data-testid":"VARIANT_ADD_OVERRIDE_BUTTON",children:"Add override"})})]})]})},DXe=b(ne)(()=>({display:"flex",width:"100%",position:"relative"})),LXe=b(ne)(({theme:e})=>({position:"absolute",height:e.spacing(3),width:"100%",display:"flex",overflow:"hidden"})),NXe=b(ne)(()=>({height:"100%",display:"flex",flexDirection:"column",alignItems:"center",width:"100%"})),FXe=b(ne,{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]})),BXe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(1)})),H8=b(Z)(({theme:e})=>({marginY:e.spacing(1)})),zXe=b(ne)(()=>({display:"flex",alignItems:"center",marginLeft:"auto"})),OX=b(ne,{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]}})),HXe=b(Z)(({theme:e})=>({marginTop:e.spacing(1)})),UXe=({variants:e})=>e.length<1?null:a.jsxs(ne,{sx:t=>({marginTop:t.spacing(2)}),children:[a.jsx(VXe,{variants:e}),a.jsxs(DXe,{children:[a.jsx(LXe,{}),e.map((t,n)=>{const r=t.weight/10;return a.jsx(Vc,{variant:"custom",arrow:!0,onClick:o=>o.preventDefault(),titleComponent:a.jsx(KXe,{variant:t,index:n}),children:a.jsxs(ne,{style:{width:`${r}%`},children:[" ",a.jsxs(NXe,{children:[a.jsx(FXe,{index:n}),a.jsxs(HXe,{variant:"subtitle2",children:[r,"%"]})]})]})},n)})]})]}),VXe=({variants:e})=>a.jsxs(BXe,{children:[a.jsxs(H8,{variant:"body2",children:["Feature variants (",e.length,")"]}),a.jsx(zXe,{children:e.map((t,n)=>a.jsxs(OX,{index:n,children:[a.jsx(ne,{}),a.jsx(H8,{variant:"body2",children:t.name})]},n))})]}),WXe=b(ne)(()=>({display:"flex",flexDirection:"column"})),GXe=b(ne)(()=>({display:"flex",alignItems:"center",minWidth:"250px"})),qXe=b(ne)(({theme:e})=>({marginTop:e.spacing(1),display:"flex",flexDirection:"column"})),YXe=b(Z)(({theme:e})=>({marginBottom:e.spacing(1)})),KXe=({variant:e,index:t})=>a.jsxs(WXe,{children:[a.jsxs(GXe,{children:[a.jsx(OX,{index:t,children:a.jsx(ne,{})}),a.jsxs(Z,{variant:"subtitle2",children:[e.weight/10,"% - ",e.name]})]}),e.payload?a.jsxs(qXe,{children:[a.jsx(YXe,{variant:"body2",children:"Payload"}),a.jsx(W,{condition:e.payload.type==="json",show:a.jsx("code",{children:e.payload.value}),elseShow:a.jsx(Z,{variant:"body2",children:e.payload.value})})]}):null]}),XXe=()=>a.jsxs(Vt,{severity:"warning",sx:{mb:3},children:["Remember to update your Unleash client! Strategy variants require new SDK versions. ",a.jsx(JXe,{}),"."]}),AEt=()=>a.jsxs(Vt,{severity:"warning",sx:{mb:4},children:["If you want advanced targeting capabilities you should use"," ",a.jsx("b",{children:"variants inside strategies"}),". ",a.jsx(QXe,{})]}),JXe=()=>a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Read more"}),QXe=()=>a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noreferrer",children:"Read more"}),ZXe=b("div")({display:"flex",flexDirection:"column"}),eJe=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(1),marginBottom:e.spacing(1)})),tJe=b("div")(({theme:e})=>({color:e.palette.text.secondary,marginTop:e.spacing(1.5)})),$X=({strategy:e,setStrategy:t,projectId:n,environment:r,editable:o})=>{const{trackEvent:i}=Sn(),s=(e.variants||[]).map(h=>({...h,new:o||!1,isValid:!0,id:Uh(),overrides:[]})),[l,c]=m.useState(s),u=It(),d=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";m.useEffect(()=>()=>{t(h=>({...h,variants:l.filter(g=>!!g.name)}))},[JSON.stringify(l)]),m.useEffect(()=>{t(h=>({...h,variants:l.map(g=>({stickiness:d,name:g.name,weight:g.weight,payload:g.payload,weightType:g.weightType}))}))},[d,JSON.stringify(l)]);const f=(h,g)=>{c(v=>U6(v.map(x=>x.id===g?h:x),1e3))},p=()=>{const h=Uh();c(g=>[...g,{name:"",weightType:mc.VARIABLE,weight:0,stickiness:d,new:!0,isValid:!1,id:h}]),i("strategy-variants",{props:{eventType:"variant added"}})};return a.jsxs(a.Fragment,{children:[a.jsx(tJe,{children:"Variants enhance a feature flag by providing a version of the feature to be enabled"}),a.jsxs(eJe,{children:[a.jsx(Z,{children:"Variants"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsx(ne,{children:a.jsxs(Z,{variant:"body2",children:["Variants in feature toggling allow you to serve different versions of a feature to different users. This can be used for A/B testing, gradual rollouts, and canary releases. Variants provide a way to control the user experience at a granular level, enabling you to test and optimize different aspects of your features. Read more about variants"," ",a.jsx("a",{href:"https://docs.getunleash.io/reference/strategy-variants",target:"_blank",rel:"noopener noreferrer",children:"here"})]})})})]}),a.jsxs(ZXe,{children:[a.jsx(W,{condition:l.length>0,show:a.jsx(XXe,{})}),l.map((h,g)=>a.jsx(MXe,{disableOverrides:!0,variant:h,variants:l,updateVariant:v=>f(v,h.id),removeVariant:()=>c(v=>U6(v.filter(x=>x.id!==h.id),1e3)),decorationColor:u.palette.variants[g%u.palette.variants.length]},h.id))]}),a.jsx(ei,{onClick:p,variant:"outlined",permission:oq,projectId:n,environmentId:r,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",startIcon:a.jsx(ni,{}),children:"Add variant"}),a.jsx(UXe,{variants:l})]})},nJe=e=>fetch(e).then(fn("ChangeRequest")).then(t=>t.json()),rJe=(e,t)=>{const{data:n,error:r,mutate:o}=bC([],Ot(`api/admin/projects/${e}/change-requests/scheduled?strategyId=${t}`),nJe);return{changeRequests:n,loading:!r&&!n,refetch:o,error:r}},oJe=(e,t,n,r)=>(e==null?void 0:e.filter(o=>{var i;return(i=o.features.find(s=>s.name===t))==null?void 0:i.changes.some(s=>s.action==="updateStrategy"&&s.payload.id===n)}).map(o=>({changeRequest:PP(r,o.id),state:o.state})))??[],iJe=(e,t)=>(e==null?void 0:e.map(n=>({changeRequest:PP(t,n.id),state:"Scheduled"})))??[],sJe=()=>{const[e,t]=m.useState(""),{trackEvent:n}=Sn();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"}})}}},aJe=e=>{if(e)return e==null?void 0:e.constraints.map(t=>({...t,[v0]:Uh()}))},PEt=()=>{const e=Fr("projectId"),t=Fr("featureId"),n=O9("environmentId"),r=O9("strategyId"),[o,i]=m.useState(0),[s,l]=m.useState({}),[c,u]=m.useState([]),{updateStrategyOnFeature:d,loading:f}=Cze(),{strategyDefinition:p}=AP(s.name),{setToastData:h,setToastApiError:g}=Yt(),v=vK(),{uiConfig:x}=ht(),{unleashUrl:y}=x,w=$t(),{addChange:S}=up(),{isChangeRequestConfigured:C}=ip(e),{refetch:E,data:j}=wC(e),{setPreviousTitle:k}=sJe(),{feature:T,refetchFeature:_}=Wl(e,t),A=m.useRef(T),{data:M,staleDataNotification:I,forceRefreshCache:P}=xK({unleashGetter:Wl,params:[e,t],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},T,{afterSubmitAction:_},bK);m.useEffect(()=>{A.current.name===""&&T.name&&(P(T),A.current=T)},[T]);const{trackEvent:$}=Sn(),{changeRequests:z}=rJe(e,r),Y=oJe(j,t,r,x),q=iJe(z,x),G=()=>[...Y,...q].forEach(ue=>$("change_request",{props:{...ue,action:"edit-strategy",eventType:"conflict-created"}})),{segments:F,refetchSegments:U}=Wc(r);m.useEffect(()=>{const ue=M==null?void 0:M.environments.flatMap(J=>J.strategies).find(J=>J.id===r),ve=aJe(ue),Ce={...ue,constraints:ve};l(J=>({...J,...Ce})),k((ue==null?void 0:ue.title)||"")},[r,M]),m.useEffect(()=>{F&&u(F)},[JSON.stringify(F)]);const O=lJe(s,c),L=async ue=>{await d(e,t,n,r,ue),await U(),h({title:"Strategy updated",type:"success",confetti:!0})},te=async ue=>{await S(e,n,{action:"updateStrategy",feature:t,payload:{...ue,id:r}}),h({title:"Change added to draft",type:"success",confetti:!0}),E()},re=async()=>{try{C(n)?await te(O):await L(O),G(),_(),w(QP(e,t))}catch(ue){g(Dt(ue))}};return!s.id||!p||!M?null:a.jsxs(Br,{modal:!0,disablePadding:!0,description:uJe,documentationLink:dJe,documentationLinkLabel:fJe,formatApiCode:()=>cJe(e,t,n,r,O,p,y),children:[a.jsx(RX,{projectId:e,feature:M,strategy:s,setStrategy:l,segments:c,setSegments:u,environmentId:n,onSubmit:re,loading:f,permission:YS,errors:v,isChangeRequest:C(n),tab:o,setTab:i,StrategyVariants:a.jsx($X,{strategy:s,setStrategy:l,environment:n,projectId:e})}),I]})},lJe=(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}),QP=(e,t)=>`/projects/${e}/features/${t}`,ZP=(e,t,n,r)=>{const o=new URLSearchParams({environmentId:n,strategyId:r});return`/projects/${e}/features/${t}/strategies/edit?${o}`},cJe=(e,t,n,r,o,i,s)=>{if(!s)return"";const l={...o,parameters:Dze(o.parameters??{},i)},c=`${s}/api/admin/projects/${e}/features/${t}/environments/${n}/strategies/${r}`,u=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${c}' \\
346
346
  --header 'Authorization: INSERT_API_KEY' \\
347
347
  --header 'Content-Type: application/json' \\
348
348
  --data-raw '${u}'`},uJe=`
@@ -403,12 +403,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
403
403
  --data-raw '${JSON.stringify(S(),void 0,2)}'`,I=mtt(r==null?void 0:r.project)(),{addChange:P}=up(),$=async z=>{if(r){z.preventDefault(),E();try{I?await P(r.project||"",I,{action:"updateSegment",feature:null,payload:{id:r.id,...S()}}):await c(r.id,S()),d(),l(t?`/projects/${t}/settings/segments/`:"/segments/"),i({title:`Segment ${I?"change added to draft":"updated"}`,type:"success"})}catch(Y){s(Dt(Y))}}};return a.jsx(Br,{loading:u,modal:e,title:"Edit segment",description:iJ,documentationLink:kX,documentationLinkLabel:"Segments documentation",formatApiCode:A,children:a.jsx(oJ,{handleSubmit:$,name:f,setName:p,description:h,setDescription:g,project:v,setProject:x,constraints:y,setConstraints:w,errors:C,clearErrors:E,mode:"edit",children:a.jsx(_g,{permission:[gA,Zu],projectId:t,disabled:!j||_,"data-testid":zSe,children:I?"Add to draft":"Save"})})})},ytt=()=>{const{uiConfig:e}=ht(),t=$t();return a.jsx(iK,{onClick:()=>t("/environments/create"),maxWidth:"700px",Icon:ni,permission:Qo,disabled:!e.flags.EEA,children:"New environment"})},xtt=(e,t,n)=>{const r=m.useRef(null);return m.useEffect(()=>{if(r.current)return r.current.dataset.index=String(e),btt(r.current,t,(n==null?void 0:n.current)??void 0)},[e,t]),r},btt=(e,t,n)=>{const r=f=>{Ly&&t(Number(Ly.dataset.index),Number(e.dataset.index),f)},o=n??e,i=f=>{f.target===o&&(e.draggable=!0)},s=()=>{e.draggable=!1},l=()=>{e.draggable=!0,Ly=e},c=()=>{r(!1)},u=f=>{f.preventDefault()},d=()=>{r(!0),Ly=null};return o.addEventListener("mouseenter",i),o.addEventListener("mouseleave",s),n&&e.addEventListener("mouseenter",s),e.addEventListener("dragstart",l),e.addEventListener("dragenter",c),e.addEventListener("dragover",u),e.addEventListener("drop",d),()=>{o.removeEventListener("mouseenter",i),o.removeEventListener("mouseleave",s),n&&e.removeEventListener("mouseenter",s),e.removeEventListener("dragstart",l),e.removeEventListener("dragenter",c),e.removeEventListener("dragover",u),e.removeEventListener("drop",d)}};let Ly;const wtt=b(Pi)(()=>({"&:hover":{".drag-handle .drag-icon":{display:"inherit",cursor:"grab"}}})),Stt=({row:e,moveListItem:t})=>{const{hasAccess:n}=m.useContext(Di),r=m.useRef(null),{searchQuery:o}=Jl(),i=!o&&n(Qk),s=xtt(e.index,t,r),l=(c,u)=>i&&c.column.isDragHandle?a.jsx(rs,{...c.getCellProps(),ref:u,className:"drag-handle",children:c.render("Cell")}):a.jsx(rs,{...c.getCellProps(),children:c.render("Cell")});return a.jsx(wtt,{hover:!0,ref:i?s:void 0,children:e.cells.map(c=>l(c,r))})},Ctt=b(Z)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallerBody})),jtt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),r7=b(qt)(({theme:e})=>({marginLeft:e.spacing(1)})),Ett=({environment:e})=>{const{searchQuery:t}=Jl();return a.jsxs(bn,{sx:n=>({[n.breakpoints.up("sm")]:{minWidth:"350px"}}),children:[a.jsx(pi,{search:t,children:e.name}),a.jsx(W,{condition:e.protected,show:a.jsx(r7,{color:"success",children:"Predefined"})}),a.jsx(W,{condition:!e.enabled,show:a.jsx(aa,{maxWidth:"270px",title:a.jsxs(a.Fragment,{children:[a.jsx(Ctt,{children:"Deprecated environment"}),a.jsx(jtt,{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:a.jsx(r7,{color:"neutral",children:"Deprecated"})})})]})};var p4={},Ttt=ze;Object.defineProperty(p4,"__esModule",{value:!0});var aJ=p4.default=void 0,ktt=Ttt(He()),_tt=a,Rtt=(0,ktt.default)((0,_tt.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"AddToPhotos");aJ=p4.default=Rtt;var h4={},Att=ze;Object.defineProperty(h4,"__esModule",{value:!0});var lJ=h4.default=void 0,Ptt=Att(He()),Ott=a,$tt=(0,Ptt.default)((0,Ott.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4 1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"}),"VisibilityOffOutlined");lJ=h4.default=$tt;var g4={},Itt=ze;Object.defineProperty(g4,"__esModule",{value:!0});var cJ=g4.default=void 0,Mtt=Itt(He()),Dtt=a,Ltt=(0,Mtt.default)((0,Dtt.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"}),"VisibilityOutlined");cJ=g4.default=Ltt;const Ntt=b(X0)(({theme:e})=>({padding:e.spacing(1)})),Cx=b(Mo)(({theme:e})=>({borderRadius:e.shape.borderRadius})),Ftt=b(Cx)(({theme:e})=>({color:e.palette.error.main})),Btt=b(Ti)(({theme:e})=>({color:e.palette.error.main})),ztt=({environment:e,onEdit:t,onDeprecateToggle:n,onClone:r,onDelete:o})=>{const[i,s]=m.useState(null),l=!!i,c=p=>{s(p.currentTarget)},u=()=>{s(null)},d=`environment-${e.name}-actions`,f=`${d}-menu`;return a.jsxs(a.Fragment,{children:[a.jsx(gt,{title:"Environment actions",arrow:!0,describeChild:!0,children:a.jsx(Ht,{id:d,"aria-controls":l?f:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:a.jsx(wg,{})})}),a.jsx(fd,{id:f,anchorEl:i,open:l,onClose:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:a.jsxs(Ntt,{"aria-labelledby":d,children:[a.jsx(Tl,{permission:Qk,children:({hasAccess:p})=>a.jsxs(Cx,{onClick:()=>{t(),u()},disabled:!p||e.protected,children:[a.jsx(Ti,{children:a.jsx(Oi,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"Edit"})})]})}),a.jsx(Tl,{permission:Qo,children:({hasAccess:p})=>a.jsxs(Cx,{onClick:()=>{r(),u()},disabled:!p,children:[a.jsx(Ti,{children:a.jsx(aJ,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"Clone"})})]})}),a.jsx(Tl,{permission:Qk,children:({hasAccess:p})=>a.jsxs(Cx,{onClick:()=>{n(),u()},disabled:!p||e.protected,children:[a.jsx(Ti,{children:a.jsx(W,{condition:e.enabled,show:a.jsx(lJ,{}),elseShow:a.jsx(cJ,{})})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:e.enabled?"Deprecate":"Undeprecate"})})]})}),a.jsx(Tl,{permission:i5e,children:({hasAccess:p})=>a.jsxs(Ftt,{onClick:()=>{o(),u()},disabled:!p||e.protected,children:[a.jsx(Btt,{children:a.jsx(co,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"Delete"})})]})})]})})]})},o7=(e,t)=>{var n;return!!((n=t==null?void 0:t.toLowerCase())!=null&&n.includes(e.toLowerCase()))},Htt=b(nr)(({theme:e})=>({cursor:"pointer",fontSize:e.fontSizes.bodySize})),uJ=({isAllSelected:e,onClick:t})=>a.jsx(ne,{sx:{ml:3.5,my:.5},children:a.jsx(Htt,{onClick:t,component:"button",underline:"hover",children:e?"Deselect all":"Select all"})}),Utt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",color:e.palette.text.secondary,"& > span:first-of-type":{color:e.palette.text.primary}})),Vtt=b("div")(({theme:e})=>({paddingLeft:e.spacing(1)})),Wtt=b("div")(({theme:e})=>({display:"flex",marginBottom:e.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:e.spacing(50),marginRight:e.spacing(1)}})),Gtt=(e,t,n)=>a.jsxs("li",{...e,children:[a.jsx(os,{icon:a.jsx(C1,{fontSize:"small"}),checkedIcon:a.jsx(j1,{fontSize:"small"}),style:{marginRight:8},checked:n}),a.jsxs(Utt,{children:[a.jsx("span",{children:t.name}),a.jsx("span",{children:t.description})]})]}),qtt=e=>a.jsx(Vtt,{children:e.length>1?`${e.length} projects selected`:e[0].name}),Ytt=({projects:e,setProjects:t})=>{const{projects:n}=_s(),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,s=()=>{const c=i?[]:r.map(({id:u})=>u);t(c)},l=({key:c,children:u})=>a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:r.length>2,show:a.jsx(uJ,{isAllSelected:i,onClick:s})}),u]},c);return a.jsx(Wtt,{children:a.jsx(ep,{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:f})=>f))},options:r,renderOption:(c,u,{selected:d})=>Gtt(c,u,d),filterOptions:(c,{inputValue:u})=>c.filter(({name:d,description:f})=>o7(u,d)||o7(u,f)),isOptionEqualToValue:(c,u)=>c.id===u.id,getOptionLabel:c=>c.name||c.description||"",renderInput:c=>a.jsx(Cn,{...c,label:"Projects"}),renderTags:c=>qtt(c),groupBy:()=>"Select/Deselect all",renderGroup:l})})},bm="*",Ktt=({...e})=>a.jsx(xr,{elevation:8,...e}),Xtt=b(os)(({theme:e})=>({marginRight:e.spacing(.4)})),Jtt=({options:e,defaultValue:t=[bm],onChange:n,disabled:r,error:o,onFocus:i})=>{const[s,l]=m.useState(typeof t=="string"?[t]:t),[c,u]=m.useState(typeof t=="string"||t.includes(bm)),d=s.length>0&&s.length===e.length&&s[0]!==bm,f=(x,y)=>{y?(u(!0),n([bm])):(u(!1),n(s.includes(bm)?[]:s))},p=()=>{const x=d?[]:e.map(({value:y})=>y);l(x),n(x)},h=(x,y,{selected:w})=>a.jsxs("li",{...x,children:[a.jsx(Xtt,{icon:a.jsx(C1,{fontSize:"small"}),checkedIcon:a.jsx(j1,{fontSize:"small"}),checked:w}),y.label]}),g=({key:x,children:y})=>a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:e.length>2,show:a.jsx(uJ,{isAllSelected:d,onClick:p})}),y]},x),v=x=>a.jsx(Cn,{...x,error:!!o,helperText:o,variant:"outlined",label:"Projects",placeholder:"Select one or more projects",onFocus:i,"data-testid":"select-input"});return a.jsxs(ne,{sx:{mt:-1,mb:3},children:[a.jsx(ne,{sx:{mt:1,mb:.25,ml:1.5},children:a.jsx(Qr,{disabled:r,"data-testid":"select-all-projects",control:a.jsx(os,{checked:r||c,onChange:f}),label:"ALL current and future projects"})}),a.jsx(ep,{disabled:r||c,multiple:!0,limitTags:2,options:e,disableCloseOnSelect:!0,getOptionLabel:({label:x})=>x,groupBy:()=>"Select/Deselect all",renderGroup:g,fullWidth:!0,PaperComponent:Ktt,renderOption:h,renderInput:v,value:c||r?e:e.filter(x=>s.includes(x.value)),onChange:(x,y)=>{const w=y.map(({value:S})=>S);l(w),n(w)}})]})},Qtt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{deleteToken:async s=>{const l=`api/admin/api-tokens/${s}`,c=t(l,{method:"DELETE"});return e(c.caller,c.id)},createToken:async s=>{const c=t("api/admin/api-tokens",{method:"POST",body:JSON.stringify(s)});return e(c.caller,c.id)},errors:n,loading:r}},Ztt=b("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Ap=b("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(4)}})),RE=b("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),ent=b(ar)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),tnt=b("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4)})),nnt=b("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),rnt=b("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),ont=b(We)(({theme:e})=>({marginLeft:e.spacing(3)})),int=({environment:e,open:t,setOpen:n,newToken:r})=>{const{environments:o,refetchEnvironments:i}=np(),{cloneEnvironment:s,loading:l}=kg(),{createToken:c}=Qtt(),{projects:u}=_s(),{setToastData:d,setToastApiError:f}=Yt(),{uiConfig:p}=ht(),[h,g]=m.useState(`${e.name}_clone`),[v,x]=m.useState("development"),[y,w]=m.useState([]),[S,C]=m.useState(["*"]),[E,j]=m.useState(!0),[k,T]=m.useState("later"),[_,A]=m.useState({}),M=te=>{A(re=>({...re,[te]:void 0}))},I=(te,re)=>{A(ue=>({...ue,[te]:re}))};m.useEffect(()=>{g(P(e.name)),x("development"),w([]),C(["*"]),j(!0),T("later"),A({})},[e]);const P=te=>{let re=`${te}_clone`,ue=2;for(;!F(re);)re=`${e.name}_clone_${ue}`,ue++;return re},$=()=>({name:h,type:v,projects:y,clonePermissions:E}),z=()=>({username:`${h}_token`,type:"CLIENT",environment:h,projects:S}),Y=async te=>{te.preventDefault();try{if(await s(e.name,$()),k==="now"){const ue=await(await c(z())).json();r(ue)}d({title:"Environment successfully cloned!",type:"success"}),i(),n(!1)}catch(re){f(Dt(re))}},q=()=>`curl --location --request POST '${p.unleashUrl}/api/admin/environments/${e.name}/clone' \\
404
404
  --header 'Authorization: INSERT_API_KEY' \\
405
405
  --header 'Content-Type: application/json' \\
406
- --data-raw '${JSON.stringify($(),void 0,2)}'`,G=te=>te.length,F=te=>!(o!=null&&o.some(re=>re.name===te)),U=G(h)&&F(h)&&S.length,O=te=>{M("name"),F(te)||I("name","An environment with that name already exists."),g(te)},L=u.map(te=>({value:te.id,label:te.name}));return a.jsx(pp,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:a.jsx(Br,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature flags 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:q,children:a.jsxs(Ztt,{onSubmit:Y,children:[a.jsxs("div",{children:[a.jsx(Ap,{children:"What is your new environment name? (Can't be changed later)"}),a.jsx(ent,{autoFocus:!0,label:"Environment name",error:!!_.name,errorText:_.name,value:h,onChange:te=>O(te.target.value),required:!0}),a.jsx(Ap,{children:"What type of environment do you want to create?"}),a.jsx(fK,{onChange:te=>x(te.currentTarget.value),value:v}),a.jsxs(Ap,{children:["Select which projects you want to clone the environment configuration in?",a.jsx(ua,{tooltip:"The cloned environment will keep the feature flag state for the selected projects, where it will be enabled by default."})]}),a.jsx(Ytt,{projects:y,setProjects:w}),a.jsx(Ap,{children:"Keep the users permission for this environment?"}),a.jsx(RE,{children:"If you turn it off, the permission for this environment across all projects and feature flags will remain only for admin and editor roles."}),a.jsx(Qr,{label:E?"Yes":"No",control:a.jsx(is,{onChange:te=>j(te.target.checked),checked:E})}),a.jsxs(tnt,{children:[a.jsx(Ap,{children:"API Token"}),a.jsxs(RE,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),a.jsx(Ua,{children:a.jsxs(Q0,{value:k,onChange:te=>T(te.target.value),name:"api-token-generation",children:[a.jsx(Qr,{value:"later",control:a.jsx(jl,{}),label:"I want to generate an API token later"}),a.jsx(Qr,{value:"now",control:a.jsx(jl,{}),label:"Generate an API token now"})]})}),a.jsxs(nnt,{children:[a.jsx(RE,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),a.jsx(W,{condition:k==="now",show:a.jsxs(a.Fragment,{children:[a.jsx(Ap,{children:"Which projects do you want this token to give access to?"}),a.jsx(Jtt,{options:L,defaultValue:S,onChange:C,error:_.projects,onFocus:()=>M("projects")})]})})]})]})]}),a.jsxs(rnt,{children:[a.jsx(We,{type:"submit",variant:"contained",color:"primary",disabled:!U,children:"Clone environment"}),a.jsx(ont,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},m4=({token:e})=>{const{setToastData:t}=Yt(),n=()=>{aC(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})};return a.jsxs(ne,{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,a.jsx(gt,{title:"Copy token",arrow:!0,children:a.jsx(Ht,{onClick:n,size:"large",children:a.jsx(sp,{})})})]})},snt=({open:e,setOpen:t,token:n})=>a.jsxs(rr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[a.jsx(Z,{variant:"body1",children:"Your new token has been created successfully."}),a.jsxs(Z,{variant:"body1",children:['You can also find it as "',a.jsx("strong",{children:n==null?void 0:n.username}),'" in the'," ",a.jsx(ln,{to:"/admin/api",children:"API access page"}),"."]}),a.jsx(m4,{token:(n==null?void 0:n.secret)||""})]});var v4={},ant=ze;Object.defineProperty(v4,"__esModule",{value:!0});var dJ=v4.default=void 0,lnt=ant(He()),cnt=a,unt=(0,lnt.default)((0,cnt.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicator");dJ=v4.default=unt;const dnt=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),fnt=b(Ht)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),pnt=b(op,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),fJ=({environment:e})=>a.jsxs(dnt,{children:[a.jsx(fnt,{size:"large",disableRipple:!0,className:"drag-icon",children:a.jsx(dJ,{titleAccess:"Drag to reorder"})}),a.jsx(pnt,{deprecated:!e.enabled})]}),hnt=b(sa)(({theme:e})=>({marginTop:e.spacing(3)})),gnt=b("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),pJ=({environment:e,warnEnabledToggles:t})=>{const n=m.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>a.jsx(fJ,{environment:c})},{Header:"Name",accessor:"name",Cell:bn},{Header:"Type",accessor:"type",Cell:bn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>a.jsxs(bn,{children:[u,a.jsx(W,{condition:!!t,show:a.jsx(gnt,{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:s,prepareRow:l}=un.useTable({columns:n,data:[e],disableSortBy:!0});return a.jsxs(hnt,{...r(),rowHeight:"compact",children:[a.jsx(ia,{headerGroups:i}),a.jsx(ws,{...o(),children:s.map(c=>(l(c),a.jsx(Pi,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>a.jsx(rs,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},mnt=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return a.jsxs(rr,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[a.jsx(W,{condition:o,show:a.jsx(Vt,{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:a.jsx(Vt,{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."})}),a.jsx(pJ,{environment:e})]})},vnt=b("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),ynt=b(ar)(()=>({width:"100%"})),xnt=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=m.useState("");return m.useEffect(()=>{i("")},[t]),a.jsxs(rr,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[a.jsxs(Vt,{severity:"error",children:[a.jsx("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 flags."]}),a.jsx(pJ,{environment:e,warnEnabledToggles:!0}),a.jsxs(vnt,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",a.jsx("strong",{children:e.name})]}),a.jsx(ynt,{label:"Environment name",value:o,onChange:s=>i(s.target.value)})]})},bnt=({environment:e})=>{const t=$t(),{setToastApiError:n,setToastData:r}=Yt(),{environments:o,refetchEnvironments:i}=np(),{refetch:s}=wP(),{deleteEnvironment:l,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=kg(),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,v]=m.useState(!1),[x,y]=m.useState(!1),[w,S]=m.useState(),C=async()=>{try{await l(e.name),s(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(j){n(Dt(j))}finally{f(!1),await i()}},E=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(j){n(Dt(j))}finally{h(!1),await i()}};return a.jsxs(Fc,{children:[a.jsx(ztt,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>h(!0),onClone:()=>{o.length<Ib?v(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${Ib}). Please reach out if you need more.`})},onDelete:()=>f(!0)}),a.jsx(xnt,{environment:e,open:d,setOpen:f,onConfirm:C}),a.jsx(mnt,{environment:e,open:p,setOpen:h,onConfirm:E}),a.jsx(int,{environment:e,open:g,setOpen:v,newToken:j=>{S(j),y(!0)}}),a.jsx(snt,{open:x,setOpen:y,token:w})]})},wnt=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),Snt=b("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),i7=b("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),ea=({value:e,subtitle:t,afterTitle:n})=>{const{searchQuery:r}=Jl(),o=a.jsx(W,{condition:!!(t&&t.length>40),show:a.jsx(aa,{title:t,placement:"bottom-start",arrow:!0,children:a.jsx(i7,{"data-loading":!0,children:a.jsx(pi,{search:r,children:t})})}),elseShow:a.jsx(i7,{"data-loading":!0,children:a.jsx(pi,{search:r,children:t})})});return a.jsxs(wnt,{children:[a.jsxs(Snt,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:[a.jsx(pi,{search:r,children:e}),n]}),a.jsx(W,{condition:!!t,show:o})]})},Cnt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(4)})),jnt=()=>{const{changeSortOrder:e}=kg(),{setToastApiError:t}=Yt(),{environments:n,mutateEnvironments:r}=np(),o=m.useCallback(async(x,y,w=!1)=>{const S=[...n],C=S[x];if(S.splice(x,1),S.splice(y,0,C),await r(S),w)try{await e(ZBe(S))}catch(E){t(Dt(E))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:s,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:f}=un.useTable({columns:Ent,data:n,disableSortBy:!0},un.useGlobalFilter),p=a.jsx(No,{initialValue:d,onChange:f}),h=a.jsxs(a.Fragment,{children:[p,a.jsx(Bn.Divider,{}),a.jsx(ytt,{})]}),g=c.length,v=a.jsx(Bn,{title:`Environments (${g})`,actions:h});return a.jsxs(yr,{header:v,children:[a.jsx(Cnt,{severity:"info",children:"This is the order of environments that you have today in each feature flag. Rearranging them here will change also the order inside each feature flag."}),a.jsx(ga,{value:d,children:a.jsxs(sa,{...i(),rowHeight:"compact",children:[a.jsx(ia,{headerGroups:l}),a.jsx(ws,{...s(),children:c.map(x=>(u(x),a.jsx(Stt,{row:x,moveListItem:o},x.original.name)))})]})}),a.jsx(W,{condition:c.length===0,show:a.jsx(W,{condition:(d==null?void 0:d.length)>0,show:a.jsxs(eo,{children:["No environments found matching “",d,"”"]}),elseShow:a.jsx(eo,{children:"No environments available. Get started by adding one."})})})]})},Ent=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>a.jsx(fJ,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>a.jsx(Ett,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:ea},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:bn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:bn},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>a.jsx(bnt,{environment:e}),disableGlobalFilter:!0}],Tnt=()=>{const e=Ha("projectId"),t=$t();return a.jsx(ei,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[KS,Zu],projectId:e,"data-testid":OSe,children:"New segment"})},knt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),_nt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),Rnt=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),Ant=b(ln)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Pnt=()=>{const e=Ha("projectId"),{hasAccess:t}=m.useContext(Di);return a.jsxs(knt,{children:[a.jsx(_nt,{children:"No segments yet!"}),a.jsx(Rnt,{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."}),a.jsx(W,{condition:t([KS,Zu],e),show:a.jsx(Ant,{to:"/segments/create",children:"Create your first segment"})})]})},Ont=b(ar)(({theme:e})=>({marginTop:e.spacing(2)})),$nt=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=m.useState(""),s=u=>i(u.currentTarget.value),l=()=>{n(),i("")},c="delete-segment-confirmation-form";return a.jsxs(rr,{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:[a.jsx(Vt,{sx:{marginBottom:2},severity:"warning",children:"Deleted segments may be referenced in strategies if the feature flag is archived. Removing the segment will also remove the segments from strategies of archived flags."}),a.jsxs("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",a.jsx("strong",{children:e==null?void 0:e.name})]}),a.jsx("form",{id:c,children:a.jsx(Ont,{autoFocus:!0,onChange:s,value:o,label:"Segment name","data-testid":USe})})]})},Int=b("ul")({marginBottom:0}),s7=b(ln)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Mnt=(e,t)=>`/projects/${e}/change-requests/${t}`,Dnt=({segment:e,open:t,onClose:n,strategies:r,changeRequestStrategies:o})=>{const i=eJ(r??[],o??[]);return a.jsxs(rr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[a.jsxs("p",{children:["The following feature flags are using the"," ",a.jsx("strong",{children:e.name})," segment for their strategies:"]}),a.jsx(Int,{children:i.map((s,l)=>Lnt(s,l))})]})},a7=e=>e.strategyName?`(${td(e.strategyName)})`:"",Lnt=(e,t)=>{if((r=>"changeRequest"in r)(e)){const{id:r,title:o}=e.changeRequest,i=o?`#${r} (${o})`:`#${r}`;return a.jsx("li",{children:a.jsxs("p",{children:[e.featureName," ",`${a7(e)} — in change request `,a.jsx(s7,{to:Mnt(e.projectId,r),target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:i})]})},`#${e.changeRequest.id}@${t}`)}else return a.jsx("li",{children:a.jsxs(s7,{to:ZP(e.projectId,e.featureName,e.environment,e.id),target:"_blank",rel:"noopener noreferrer",children:[e.featureName," ",a7(e)]})},e.id)},Nnt=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,changeRequestStrategies:i,loading:s}=ZX(e.id),l=(o==null?void 0:o.length)===0&&(i==null?void 0:i.length)===0;return s?null:a.jsx(W,{condition:l,show:a.jsx($nt,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:a.jsx(Dnt,{segment:e,open:t,onClose:n,strategies:o,changeRequestStrategies:i})})},Fnt=({segment:e})=>{const t=Ha("projectId"),{refetchSegments:n}=Wc(),{deleteSegment:r}=l4(),{setToastData:o,setToastApiError:i}=Yt(),[s,l]=m.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(Dt(u))}finally{l(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(ti,{onClick:()=>l(!0),permission:[l5e,Zu],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${HSe}_${e.name}`,children:a.jsx(co,{"data-loading":!0})}),a.jsx(W,{condition:s,show:()=>a.jsx(Nnt,{segment:e,open:s,onClose:()=>l(!1),onRemove:c})})]})},Bnt=({segment:e})=>{const t=Ha("projectId"),n=$t();return a.jsx(ti,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[gA,Zu],projectId:t,tooltipProps:{title:"Edit segment"},children:a.jsx(Oi,{"data-loading":!0})})},znt=({segment:e})=>a.jsxs(Fc,{children:[a.jsx(Bnt,{segment:e}),a.jsx(Fnt,{segment:e})]}),hp=(e,t,n)=>{m.useEffect(()=>{const r=e.filter(({condition:i})=>i).flatMap(({columns:i})=>i),o=e.flatMap(({columns:i})=>i).filter(i=>!r.includes(i));t(i=>[...new Set([...i,...r].filter(s=>!o.includes(s)))])},[...e.map(({condition:r})=>r),t,n])},Hnt=()=>{const e=Ha("projectId"),{segments:t,loading:n}=Wc(),r=Qn(Xo.breakpoints.down("md")),[o]=m.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=m.useMemo(()=>t?e?t.filter(({project:v})=>v===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),s=m.useMemo(()=>Unt(e),[e]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:f,state:{globalFilter:p},setGlobalFilter:h,setHiddenColumns:g}=un.useTable({initialState:o,columns:s,data:i,sortTypes:$i,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:ea}},un.useGlobalFilter,un.useSortBy);return hp([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],g,s),a.jsx(yr,{header:a.jsx(Bn,{title:`Segments (${d.length})`,actions:a.jsxs(a.Fragment,{children:[a.jsx(No,{initialValue:p,onChange:h}),a.jsx(Bn.Divider,{}),a.jsx(Tnt,{})]})}),isLoading:n,children:a.jsx(W,{condition:!n&&i.length===0,show:a.jsx(eo,{children:a.jsx(Pnt,{})}),elseShow:()=>a.jsxs(a.Fragment,{children:[a.jsx(ga,{value:p,children:a.jsxs(sa,{...l(),rowHeight:"standard",children:[a.jsx(ia,{headerGroups:u}),a.jsx(ws,{...c(),children:d.map(v=>(f(v),a.jsx(Pi,{hover:!0,...v.getRowProps(),children:v.cells.map(x=>a.jsx(rs,{...x.getCellProps(),children:x.render("Cell")}))})))})]})}),a.jsx(W,{condition:d.length===0&&(p==null?void 0:p.length)>0,show:a.jsxs(eo,{children:["No segments found matching “",p,"”"]})})]})})})},Unt=e=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>a.jsx(JC,{icon:a.jsx(KP,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:t,description:n,id:r}}})=>a.jsx(la,{title:t,to:e?`/projects/${e}/settings/segments/edit/${r}`:`/segments/edit/${r}`,subtitle:n})},{Header:"Used in",width:"60%",Cell:({row:{original:t}})=>a.jsx(WX,{original:t})},{Header:"Project",accessor:"project",Cell:({value:t})=>a.jsx(W,{condition:!!t,show:a.jsx(la,{title:t,to:`/projects/${t}`}),elseShow:a.jsx(bn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Qu,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:t}})=>a.jsx(znt,{segment:t})},{accessor:"description"}],Vnt=e=>fetch(e).then(fn("Feature flag archive")).then(t=>t.json()),hJ=e=>{const{data:t,error:n,mutate:r,isLoading:o}=Pn(Ot(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),Vnt,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},Wnt=({onRevive:e,onDelete:t,project:n})=>a.jsxs(Fc,{children:[a.jsx(ti,{onClick:e,projectId:n,permission:bg,tooltipProps:{title:"Revive feature flag"},"data-testid":"revive-feature-flag-button",children:a.jsx(XC,{})}),a.jsx(ti,{permission:hA,projectId:n,tooltipProps:{title:"Delete feature flag"},onClick:t,children:a.jsx(co,{})})]}),Gnt=({value:e})=>{const{locationSettings:t}=Mi(),n=It();return e?a.jsx(bn,{children:a.jsx(gt,{title:`Archived on: ${If(e,t.locale)}`,arrow:!0,children:a.jsx(Z,{noWrap:!0,variant:"body2","data-loading":!0,children:a.jsx(Lc,{date:new Date(e),title:"",live:!1})})})}):a.jsx(bn,{children:a.jsx(Z,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},l7=b("p")(({theme:e})=>({marginTop:e.spacing(3)})),qnt=b(ar)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),Ynt="I want to delete",gJ=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,s]=m.useState(""),{setToastData:l,setToastApiError:c}=Yt(),{deleteFeatures:u}=vC(),d=e.length>1?"toggles":"toggle",f=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",title:`Feature ${d} deleted`,text:`You have successfully deleted the following feature ${d}: ${e.join(", ")}.`})}catch(g){c(Dt(g))}finally{p()}},p=()=>{r(!1),s("")},h="delete-feature-toggle-confirmation-form";return a.jsxs(rr,{title:`Delete feature ${d}?`,open:n,primaryButtonText:`Delete feature ${d}`,secondaryButtonText:"Cancel",onClick:f,onClose:p,disabledPrimaryButton:Ynt!==i,formId:h,children:[a.jsxs(Vt,{severity:"warning",children:[a.jsx("b",{children:"Warning!"})," Before you delete a feature flag, make sure all in-code references to that feature flag have been removed. Otherwise, a new feature flag with the same name could activate the old code paths."]}),a.jsxs(l7,{children:["You are about to delete the following feature"," ",d,":"," ",a.jsx("strong",{children:e.join(", ")}),"."]}),a.jsxs(l7,{sx:g=>({marginTop:g.spacing(2)}),children:["In order to delete the feature ",d,", please enter the following confirmation text in the text field below:"," ",a.jsx("strong",{children:"I want to delete"})]}),a.jsx("form",{id:h,children:a.jsx(qnt,{autoFocus:!0,onChange:g=>{s(g.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},Knt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2),paddingRight:e.spacing(1)})),mJ=({onChange:e,checked:t,title:n})=>a.jsx(Knt,{"data-testid":lCe,children:a.jsx(os,{onChange:e,title:n,checked:t,"data-loading":!0})}),FEt=Me.memo(mJ),Xnt=b("div")(({theme:e})=>({position:"sticky",bottom:50,zIndex:e.zIndex.fab,pointerEvents:"none"})),Jnt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),Qnt=b(xr)(({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"})),Znt=b("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),ert=b(Z)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),trt=({count:e,children:t})=>e===0?null:a.jsx(Xnt,{"data-testid":sCe,children:a.jsx(Jnt,{children:a.jsxs(Qnt,{elevation:4,children:[a.jsxs(ert,{children:[a.jsx(Znt,{"data-testid":aCe,children:e})," selected"]}),t]})})}),c7=b("p")(({theme:e})=>({marginTop:e.spacing(2)})),vJ=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:i,setToastApiError:s}=Yt(),{reviveFeatures:l}=vC(),c=async()=>{try{if(e.length===0)return;await l(t,e),await o(),i({type:"success",title:"And we're back!",text:"The feature flags have been revived."})}catch(p){s(Dt(p))}finally{u()}},u=()=>{r(!1)},d=`Revive feature flag${e.length>1?"s":""}?`,f=`Revive feature flag${e.length>1?"s":""}`;return a.jsxs(rr,{title:d,open:n,primaryButtonText:f,secondaryButtonText:"Cancel",onClick:c,onClose:u,children:[a.jsx(Vt,{severity:"info",children:"Revived feature flags will be automatically disabled in all environments"}),a.jsx(W,{condition:e.length>1,show:a.jsxs(a.Fragment,{children:[a.jsx(c7,{children:"You are about to revive feature flags:"}),a.jsx("ul",{children:e.map(p=>a.jsx("li",{children:p},`revive-${p}`))})]}),elseShow:a.jsxs(c7,{children:["You are about to revive feature flag:"," ",e[0]]})})]})},nrt=({selectedIds:e,projectId:t,onConfirm:n})=>{const{refetchArchived:r}=hJ(t),[o,i]=m.useState(!1),[s,l]=m.useState(!1),{trackEvent:c}=Sn(),u=async()=>{l(!0)},d=async()=>{i(!0)};return a.jsxs(a.Fragment,{children:[a.jsx(Tl,{projectId:t,permission:bg,children:({hasAccess:f})=>a.jsx(We,{disabled:!f,startIcon:a.jsx(XC,{}),variant:"outlined",size:"small",onClick:u,"date-testid":"batch_revive",children:"Revive"})}),a.jsx(Tl,{projectId:t,permission:hA,children:({hasAccess:f})=>a.jsx(We,{disabled:!f,startIcon:a.jsx(co,{}),variant:"outlined",size:"small",onClick:d,children:"Delete"})}),a.jsx(gJ,{deletedFeatures:e,projectId:t,open:o,setOpen:i,refetch:()=>{r(),n==null||n(),c("batch_operations",{props:{eventType:"features deleted"}})}}),a.jsx(vJ,{revivedFeatures:e,projectId:t,open:s,setOpen:l,refetch:()=>{r(),n==null||n(),c("batch_operations",{props:{eventType:"features revived"}})}})]})},rrt=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:s})=>{const l=Qn(Xo.breakpoints.down("md")),c=Qn(Xo.breakpoints.down("lg")),[u,d]=m.useState(!1),[f,p]=m.useState(),[h,g]=m.useState(!1),[v,x]=m.useState(),[y,w]=Kf(),[S,C]=m.useState(y.get("search")||"");ht();const E=m.useMemo(()=>[...s?[{id:"Select",Header:({getToggleAllRowsSelectedProps:F})=>a.jsx(os,{"data-testid":"select_all_rows",...F()}),Cell:({row:F})=>{var U;return a.jsx(mJ,{...(U=F==null?void 0:F.getToggleRowSelectedProps)==null?void 0:U.call(F)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",accessor:"lastSeenAt",Cell:({value:F,row:{original:U}})=>a.jsx(vA,{feature:U}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:AG,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:F,row:{original:U}})=>a.jsx(ea,{value:F,subtitle:U.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Qu},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Gnt},...s?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:F})=>a.jsx(la,{title:F,to:`/projects/${F}`})}],{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:F}})=>a.jsx(Wnt,{project:F.project,onRevive:()=>{x(F),g(!0)},onDelete:()=>{p(F),d(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[s]),{data:j,getSearchText:k,getSearchContext:T}=xg(E,S,e),_=m.useMemo(()=>t?Nq:j,[j,t]),[A]=m.useState(()=>({sortBy:[{id:y.get("sort")||r.id,desc:y.has("order")?y.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),M=m.useCallback(F=>F.name,[]),{headerGroups:I,rows:P,state:{sortBy:$,selectedRowIds:z},prepareRow:Y,setHiddenColumns:q,toggleAllRowsSelected:G}=un.useTable({columns:E,data:_,initialState:A,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:M},un.useFlexLayout,un.useSortBy,un.useRowSelect);return hp([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],q,E),m.useEffect(()=>{if(t)return;const F={};F.sort=$[0].id,$[0].desc&&(F.order="desc"),S&&(F.search=S),w(F,{replace:!0}),o({id:$[0].id,desc:$[0].desc||!1})},[t,$,S]),a.jsxs(a.Fragment,{children:[a.jsxs(yr,{isLoading:t,header:a.jsx(Bn,{titleElement:`${i} (${P.length<_.length?`${P.length} of ${_.length}`:_.length})`,actions:a.jsx(No,{initialValue:S,onChange:C,hasFilters:!0,getSearchContext:T})}),children:[a.jsx(ga,{value:k(S),children:a.jsx(vg,{rows:P,headerGroups:I,prepareRow:Y})}),a.jsx(W,{condition:P.length===0,show:()=>a.jsx(W,{condition:(S==null?void 0:S.length)>0,show:a.jsxs(eo,{children:["No feature flags found matching “",S,"”"]}),elseShow:a.jsx(eo,{children:"None of the feature flags were archived yet."})})}),a.jsx(gJ,{deletedFeatures:[f==null?void 0:f.name],projectId:s??(f==null?void 0:f.project),open:u,setOpen:d,refetch:n}),a.jsx(vJ,{revivedFeatures:[v==null?void 0:v.name],projectId:s??(v==null?void 0:v.project),open:h,setOpen:g,refetch:n})]}),a.jsx(W,{condition:!!s,show:a.jsx(trt,{count:Object.keys(z).length,children:a.jsx(nrt,{selectedIds:Object.keys(z),projectId:s,onConfirm:()=>G(!1)})})})]})},ort={id:"createdAt"},{value:irt,setValue:srt}=Xl("FeaturesArchiveTable:v1",ort),art=()=>{eA("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=hJ();return a.jsx(rrt,{title:"Archive",archivedFeatures:e,loading:t,storedParams:irt,setStoredParams:srt,refetch:n})},lrt=m.lazy(()=>yd(()=>import("./AdvancedPlayground-DIV201O4.js"),[])),crt=b(We)(({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}})),urt=({label:e,selected:t,onClick:n,icon:r})=>a.jsxs(crt,{selected:!!t,onClick:n,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[e,r]}),drt=b("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),frt=b("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),prt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),hrt=({tabs:e,value:t,onChange:n,children:r})=>a.jsxs(drt,{children:[a.jsx(prt,{children:e.filter(o=>!o.hidden).map(o=>a.jsx(urt,{label:o.label,selected:o.id===t,onClick:()=>n(o),icon:o.icon},o.id))}),a.jsx(frt,{children:r})]}),yJ=(e,t={})=>{const n=async()=>{const u=Ot(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(fn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=bC({},r,n,t),[s,l]=m.useState(!i&&!o),c=()=>{Po(r)};return m.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:s,refetch:c}},grt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{changePassword:async i=>{const s=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});await e(s.caller,s.id)},errors:n,loading:r}},mrt=b("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),vrt=()=>{const{config:e,loading:t}=yJ("simple"),[n,r]=m.useState(!1),{setToastData:o,setToastApiError:i}=Yt(),[s,l]=m.useState(!1),[c,u]=m.useState(),[d,f]=m.useState(),[p,h]=m.useState(""),[g,v]=m.useState(""),[x,y]=m.useState(""),{changePassword:w}=grt(),S=async C=>{if(C.preventDefault(),p===g){if(!s)u(ZY);else{r(!0),u(void 0),f(void 0);try{await w({password:p,confirmPassword:g,oldPassword:x}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(E){const j=Dt(E);E instanceof _5?f(j):u(j),i(j)}}r(!1)}};return t?null:a.jsx(yr,{isLoading:n,header:"Change password",children:a.jsx(W,{condition:e.disabled,show:a.jsx(Vt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:a.jsxs(mrt,{children:[a.jsx(eK,{password:p,callback:l,"data-loading":!0}),a.jsx(pf,{"data-loading":!0,label:"Old password",name:"oldPassword",value:x,error:!!d,helperText:d,autoComplete:"current-password",onChange:C=>y(C.target.value)}),a.jsx(pf,{"data-loading":!0,label:"Password",name:"password",value:p,error:!!c,helperText:c,autoComplete:"new-password",onChange:C=>h(C.target.value)}),a.jsx(pf,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:g,autoComplete:"new-password",onChange:C=>v(C.target.value)}),a.jsx(tK,{"data-loading":!0,started:!!(p&&g),matchingPasswords:p===g}),a.jsx(We,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:S,children:"Save"})]})})})},yrt=/^[a-z0-9\-_]*$/,xrt="environment",brt="project",xJ="root",bJ="project",wrt="root-custom",Srt="custom",Crt=[xJ,bJ],BEt=[xJ,wrt],jrt=[bJ,Srt],wJ=10,y4=()=>{const{data:e,error:t,mutate:n}=Pn(Ot("api/admin/user/tokens"),Ert);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},Ert=e=>fetch(e).then(fn("Personal API Tokens")).then(t=>t.json()),SJ=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{createPersonalAPIToken:async s=>{const l=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(s)});return(await e(l.caller,l.id)).json()},deletePersonalAPIToken:async s=>{const l=t(`api/admin/user/tokens/${s}`,{method:"DELETE"});await e(l.caller,l.id)},errors:n,loading:r}},Trt=e=>{const t=new Date(e);return Ul(t,"yyyy-MM-dd")},krt=e=>{const t=new Date(e);return`${Ul(t,"yyyy-MM-dd")}T${Ul(t,"HH:mm")}`},_rt=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:s,onChange:l,...c})=>{const u=t==="datetime"?krt:Trt,d=t==="datetime"?"datetime-local":"date";return a.jsx(Cn,{type:d,size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(s.toISOString()),onChange:f=>{const p=Y5(f.target.value);l(p??s)},FormHelperTextProps:{"data-testid":vW},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},u7=b("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Rrt=b(ar)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),Art=b("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"}})),Prt=b(SC)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Ort=b(_rt)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),$rt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var CJ=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(CJ||{});const jJ=[{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"}],P_=e=>{const t=new Date,n=jJ.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},Irt=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:s,errors:l,setErrors:c})=>{const{locationSettings:u}=Mi(),d=v=>{c(x=>({...x,[v]:void 0}))},f=(v,x)=>{c(y=>({...y,[v]:x}))};m.useEffect(()=>{d("expiresAt"),s(P_(r))},[r]);const p=v=>{d("description"),n&&!n(v)&&f("description","A token with that description already exists."),t(v)},h=r==="custom",g=i.getFullYear()>new Date().getFullYear()+100;return a.jsxs(a.Fragment,{children:[a.jsx(u7,{children:"Describe what this token will be used for"}),a.jsx(Rrt,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:v=>p(v.target.value),required:!0}),a.jsx(u7,{children:"Token expiration date"}),a.jsxs(Art,{custom:h,children:[a.jsx(Prt,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:jJ}),a.jsx(W,{condition:h,show:()=>a.jsx(Ort,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&f("expiresAt","Invalid date, must be in the future"),s(v)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:a.jsx(W,{condition:g,show:a.jsxs(Z,{variant:"body2",children:["The token will ",a.jsx("strong",{children:"never"})," ","expire!"]}),elseShow:()=>a.jsxs(Z,{variant:"body2",children:["Token will expire on"," ",a.jsx("strong",{children:If(i,u.locale)})]})})})]}),a.jsx(W,{condition:g,show:a.jsx($rt,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},Mrt=b("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Drt=b("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Lrt=b(We)(({theme:e})=>({marginLeft:e.spacing(3)})),Ny=CJ["30DAYS"],Nrt=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=y4(),{createPersonalAPIToken:i,loading:s}=SJ(),{setToastApiError:l}=Yt(),{uiConfig:c}=ht(),[u,d]=m.useState(""),[f,p]=m.useState(Ny),[h,g]=m.useState(P_(Ny)),[v,x]=m.useState({});m.useEffect(()=>{d(""),p(Ny),g(P_(Ny)),x({})},[e]);const y=()=>({description:u,expiresAt:h}),w=async k=>{k.preventDefault();try{const T=await i(y());n(T),o(),t(!1)}catch(T){l(Dt(T))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
406
+ --data-raw '${JSON.stringify($(),void 0,2)}'`,G=te=>te.length,F=te=>!(o!=null&&o.some(re=>re.name===te)),U=G(h)&&F(h)&&S.length,O=te=>{M("name"),F(te)||I("name","An environment with that name already exists."),g(te)},L=u.map(te=>({value:te.id,label:te.name}));return a.jsx(pp,{open:t,onClose:()=>{n(!1)},label:`Clone ${e.name} environment`,children:a.jsx(Br,{loading:l,modal:!0,title:`Clone ${e.name} environment`,description:"Cloning an environment will clone all feature flags 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:q,children:a.jsxs(Ztt,{onSubmit:Y,children:[a.jsxs("div",{children:[a.jsx(Ap,{children:"What is your new environment name? (Can't be changed later)"}),a.jsx(ent,{autoFocus:!0,label:"Environment name",error:!!_.name,errorText:_.name,value:h,onChange:te=>O(te.target.value),required:!0}),a.jsx(Ap,{children:"What type of environment do you want to create?"}),a.jsx(fK,{onChange:te=>x(te.currentTarget.value),value:v}),a.jsxs(Ap,{children:["Select which projects you want to clone the environment configuration in?",a.jsx(ua,{tooltip:"The cloned environment will keep the feature flag state for the selected projects, where it will be enabled by default."})]}),a.jsx(Ytt,{projects:y,setProjects:w}),a.jsx(Ap,{children:"Keep the users permission for this environment?"}),a.jsx(RE,{children:"If you turn it off, the permission for this environment across all projects and feature flags will remain only for admin and editor roles."}),a.jsx(Qr,{label:E?"Yes":"No",control:a.jsx(is,{onChange:te=>j(te.target.checked),checked:E})}),a.jsxs(tnt,{children:[a.jsx(Ap,{children:"API Token"}),a.jsxs(RE,{children:["In order to connect your SDKs to your newly cloned environment, you will also need an API token."," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),a.jsx(Ua,{children:a.jsxs(Q0,{value:k,onChange:te=>T(te.target.value),name:"api-token-generation",children:[a.jsx(Qr,{value:"later",control:a.jsx(jl,{}),label:"I want to generate an API token later"}),a.jsx(Qr,{value:"now",control:a.jsx(jl,{}),label:"Generate an API token now"})]})}),a.jsxs(nnt,{children:[a.jsx(RE,{children:"A new Server-side SDK (CLIENT) API token will be generated for the cloned environment, so you can get started right away."}),a.jsx(W,{condition:k==="now",show:a.jsxs(a.Fragment,{children:[a.jsx(Ap,{children:"Which projects do you want this token to give access to?"}),a.jsx(Jtt,{options:L,defaultValue:S,onChange:C,error:_.projects,onFocus:()=>M("projects")})]})})]})]})]}),a.jsxs(rnt,{children:[a.jsx(We,{type:"submit",variant:"contained",color:"primary",disabled:!U,children:"Clone environment"}),a.jsx(ont,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},m4=({token:e})=>{const{setToastData:t}=Yt(),n=()=>{aC(e)?t({type:"success",title:"Token copied to clipboard"}):t({type:"error",title:"Could not copy token"})};return a.jsxs(ne,{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,a.jsx(gt,{title:"Copy token",arrow:!0,children:a.jsx(Ht,{onClick:n,size:"large",children:a.jsx(sp,{})})})]})},snt=({open:e,setOpen:t,token:n})=>a.jsxs(rr,{open:e,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"New API token created",children:[a.jsx(Z,{variant:"body1",children:"Your new token has been created successfully."}),a.jsxs(Z,{variant:"body1",children:['You can also find it as "',a.jsx("strong",{children:n==null?void 0:n.username}),'" in the'," ",a.jsx(ln,{to:"/admin/api",children:"API access page"}),"."]}),a.jsx(m4,{token:(n==null?void 0:n.secret)||""})]});var v4={},ant=ze;Object.defineProperty(v4,"__esModule",{value:!0});var dJ=v4.default=void 0,lnt=ant(He()),cnt=a,unt=(0,lnt.default)((0,cnt.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicator");dJ=v4.default=unt;const dnt=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"flex-end",paddingLeft:e.spacing(.5),minWidth:e.spacing(6.5),cursor:"grab"})),fnt=b(Ht)(({theme:e})=>({padding:e.spacing(1.5,0),cursor:"inherit",transition:"color 0.2s ease-in-out",color:e.palette.action.active})),pnt=b(op,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:t})=>({color:t?e.palette.neutral.border:e.palette.primary.main})),fJ=({environment:e})=>a.jsxs(dnt,{children:[a.jsx(fnt,{size:"large",disableRipple:!0,className:"drag-icon",children:a.jsx(dJ,{titleAccess:"Drag to reorder"})}),a.jsx(pnt,{deprecated:!e.enabled})]}),hnt=b(sa)(({theme:e})=>({marginTop:e.spacing(3)})),gnt=b("p",{shouldForwardProp:e=>e!=="warning"})(({theme:e,warning:t})=>({color:t?e.palette.error.dark:e.palette.text.primary})),pJ=({environment:e,warnEnabledToggles:t})=>{const n=m.useMemo(()=>[{id:"Icon",width:"1%",Cell:({row:{original:c}})=>a.jsx(fJ,{environment:c})},{Header:"Name",accessor:"name",Cell:bn},{Header:"Type",accessor:"type",Cell:bn},{Header:"Visible in",accessor:c=>c.projectCount===1?"1 project":`${c.projectCount} projects`,Cell:({row:{original:c},value:u})=>a.jsxs(bn,{children:[u,a.jsx(W,{condition:!!t,show:a.jsx(gnt,{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:s,prepareRow:l}=un.useTable({columns:n,data:[e],disableSortBy:!0});return a.jsxs(hnt,{...r(),rowHeight:"compact",children:[a.jsx(ia,{headerGroups:i}),a.jsx(ws,{...o(),children:s.map(c=>(l(c),a.jsx(Pi,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>a.jsx(rs,{...u.getCellProps(),children:u.render("Cell")}))})))})]})},mnt=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const{enabled:o}=e,i=o?"Deprecate":"Undeprecate";return a.jsxs(rr,{title:`${i} environment?`,open:t,primaryButtonText:i,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[a.jsx(W,{condition:o,show:a.jsx(Vt,{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:a.jsx(Vt,{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."})}),a.jsx(pJ,{environment:e})]})},vnt=b("p")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1.5)})),ynt=b(ar)(()=>({width:"100%"})),xnt=({environment:e,open:t,setOpen:n,onConfirm:r})=>{const[o,i]=m.useState("");return m.useEffect(()=>{i("")},[t]),a.jsxs(rr,{title:"Delete environment?",open:t,primaryButtonText:"Delete environment",disabledPrimaryButton:e.name!==o,secondaryButtonText:"Close",onClick:r,onClose:()=>{n(!1)},children:[a.jsxs(Vt,{severity:"error",children:[a.jsx("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 flags."]}),a.jsx(pJ,{environment:e,warnEnabledToggles:!0}),a.jsxs(vnt,{children:["In order to delete this environment, please enter the id of the environment in the textfield below:"," ",a.jsx("strong",{children:e.name})]}),a.jsx(ynt,{label:"Environment name",value:o,onChange:s=>i(s.target.value)})]})},bnt=({environment:e})=>{const t=$t(),{setToastApiError:n,setToastData:r}=Yt(),{environments:o,refetchEnvironments:i}=np(),{refetch:s}=wP(),{deleteEnvironment:l,toggleEnvironmentOn:c,toggleEnvironmentOff:u}=kg(),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,v]=m.useState(!1),[x,y]=m.useState(!1),[w,S]=m.useState(),C=async()=>{try{await l(e.name),s(),r({type:"success",title:"Environment deleted",text:`You have successfully deleted the ${e.name} environment.`})}catch(j){n(Dt(j))}finally{f(!1),await i()}},E=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(j){n(Dt(j))}finally{h(!1),await i()}};return a.jsxs(Fc,{children:[a.jsx(ztt,{environment:e,onEdit:()=>t(`/environments/${e.name}`),onDeprecateToggle:()=>h(!0),onClone:()=>{o.length<Ib?v(!0):r({type:"error",title:"Environment limit reached",text:`You have reached the maximum number of environments (${Ib}). Please reach out if you need more.`})},onDelete:()=>f(!0)}),a.jsx(xnt,{environment:e,open:d,setOpen:f,onConfirm:C}),a.jsx(mnt,{environment:e,open:p,setOpen:h,onConfirm:E}),a.jsx(int,{environment:e,open:g,setOpen:v,newToken:j=>{S(j),y(!0)}}),a.jsx(snt,{open:x,setOpen:y,token:w})]})},wnt=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",justifyContent:"center",wordBreak:"break-word",padding:e.spacing(1,2)})),Snt=b("span")(({theme:e})=>({overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"1",lineClamp:"1"})),i7=b("span")(({theme:e})=>({color:e.palette.text.secondary,overflow:"hidden",textOverflow:"ellipsis",fontSize:"inherit",WebkitLineClamp:"1",lineClamp:"1",display:"-webkit-box",WebkitBoxOrient:"vertical"})),ea=({value:e,subtitle:t,afterTitle:n})=>{const{searchQuery:r}=Jl(),o=a.jsx(W,{condition:!!(t&&t.length>40),show:a.jsx(aa,{title:t,placement:"bottom-start",arrow:!0,children:a.jsx(i7,{"data-loading":!0,children:a.jsx(pi,{search:r,children:t})})}),elseShow:a.jsx(i7,{"data-loading":!0,children:a.jsx(pi,{search:r,children:t})})});return a.jsxs(wnt,{children:[a.jsxs(Snt,{style:{WebkitLineClamp:t?1:2,lineClamp:t?1:2},"data-loading":!0,children:[a.jsx(pi,{search:r,children:e}),n]}),a.jsx(W,{condition:!!t,show:o})]})},Cnt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(4)})),jnt=()=>{const{changeSortOrder:e}=kg(),{setToastApiError:t}=Yt(),{environments:n,mutateEnvironments:r}=np(),o=m.useCallback(async(x,y,w=!1)=>{const S=[...n],C=S[x];if(S.splice(x,1),S.splice(y,0,C),await r(S),w)try{await e(ZBe(S))}catch(E){t(Dt(E))}},[e,n,r,t]),{getTableProps:i,getTableBodyProps:s,headerGroups:l,rows:c,prepareRow:u,state:{globalFilter:d},setGlobalFilter:f}=un.useTable({columns:Ent,data:n,disableSortBy:!0},un.useGlobalFilter),p=a.jsx(No,{initialValue:d,onChange:f}),h=a.jsxs(a.Fragment,{children:[p,a.jsx(Bn.Divider,{}),a.jsx(ytt,{})]}),g=c.length,v=a.jsx(Bn,{title:`Environments (${g})`,actions:h});return a.jsxs(yr,{header:v,children:[a.jsx(Cnt,{severity:"info",children:"This is the order of environments that you have today in each feature flag. Rearranging them here will change also the order inside each feature flag."}),a.jsx(ga,{value:d,children:a.jsxs(sa,{...i(),rowHeight:"compact",children:[a.jsx(ia,{headerGroups:l}),a.jsx(ws,{...s(),children:c.map(x=>(u(x),a.jsx(Stt,{row:x,moveListItem:o},x.original.name)))})]})}),a.jsx(W,{condition:c.length===0,show:a.jsx(W,{condition:(d==null?void 0:d.length)>0,show:a.jsxs(eo,{children:["No environments found matching “",d,"”"]}),elseShow:a.jsx(eo,{children:"No environments available. Get started by adding one."})})})]})},Ent=[{id:"Icon",width:"1%",Cell:({row:{original:e}})=>a.jsx(fJ,{environment:e}),disableGlobalFilter:!0,isDragHandle:!0},{Header:"Name",accessor:"name",Cell:({row:{original:e}})=>a.jsx(Ett,{environment:e}),minWidth:350},{Header:"Type",accessor:"type",Cell:ea},{Header:"Visible in",accessor:e=>e.projectCount===1?"1 project":`${e.projectCount} projects`,Cell:bn},{Header:"API Tokens",accessor:e=>e.apiTokenCount===1?"1 token":`${e.apiTokenCount} tokens`,Cell:bn},{Header:"Actions",id:"Actions",align:"center",width:"1%",Cell:({row:{original:e}})=>a.jsx(bnt,{environment:e}),disableGlobalFilter:!0}],Tnt=()=>{const e=Ha("projectId"),t=$t();return a.jsx(ei,{onClick:()=>{t(e?`/projects/${e}/settings/segments/create`:"/segments/create")},permission:[KS,Zu],projectId:e,"data-testid":OSe,children:"New segment"})},knt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:e.spacing(6),marginLeft:"auto",marginRight:"auto"})),_nt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(2.5)})),Rnt=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,maxWidth:515,marginBottom:e.spacing(2.5),textAlign:"center"})),Ant=b(ln)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Pnt=()=>{const e=Ha("projectId"),{hasAccess:t}=m.useContext(Di);return a.jsxs(knt,{children:[a.jsx(_nt,{children:"No segments yet!"}),a.jsx(Rnt,{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."}),a.jsx(W,{condition:t([KS,Zu],e),show:a.jsx(Ant,{to:"/segments/create",children:"Create your first segment"})})]})},Ont=b(ar)(({theme:e})=>({marginTop:e.spacing(2)})),$nt=({segment:e,open:t,onClose:n,onRemove:r})=>{const[o,i]=m.useState(""),s=u=>i(u.currentTarget.value),l=()=>{n(),i("")},c="delete-segment-confirmation-form";return a.jsxs(rr,{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:[a.jsx(Vt,{sx:{marginBottom:2},severity:"warning",children:"Deleted segments may be referenced in strategies if the feature flag is archived. Removing the segment will also remove the segments from strategies of archived flags."}),a.jsxs("p",{children:["In order to delete this segment, please enter the name of the segment in the field below: ",a.jsx("strong",{children:e==null?void 0:e.name})]}),a.jsx("form",{id:c,children:a.jsx(Ont,{autoFocus:!0,onChange:s,value:o,label:"Segment name","data-testid":USe})})]})},Int=b("ul")({marginBottom:0}),s7=b(ln)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Mnt=(e,t)=>`/projects/${e}/change-requests/${t}`,Dnt=({segment:e,open:t,onClose:n,strategies:r,changeRequestStrategies:o})=>{const i=eJ(r??[],o??[]);return a.jsxs(rr,{title:"You can't delete a segment that's currently in use",open:t,primaryButtonText:"OK",onClick:n,children:[a.jsxs("p",{children:["The following feature flags are using the"," ",a.jsx("strong",{children:e.name})," segment for their strategies:"]}),a.jsx(Int,{children:i.map((s,l)=>Lnt(s,l))})]})},a7=e=>e.strategyName?`(${td(e.strategyName)})`:"",Lnt=(e,t)=>{if((r=>"changeRequest"in r)(e)){const{id:r,title:o}=e.changeRequest,i=o?`#${r} (${o})`:`#${r}`;return a.jsx("li",{children:a.jsxs("p",{children:[e.featureName," ",`${a7(e)} — in change request `,a.jsx(s7,{to:Mnt(e.projectId,r),target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:i})]})},`#${e.changeRequest.id}@${t}`)}else return a.jsx("li",{children:a.jsxs(s7,{to:ZP(e.projectId,e.featureName,e.environment,e.id),target:"_blank",rel:"noopener noreferrer",children:[e.featureName," ",a7(e)]})},e.id)},Nnt=({segment:e,open:t,onClose:n,onRemove:r})=>{const{strategies:o,changeRequestStrategies:i,loading:s}=ZX(e.id),l=(o==null?void 0:o.length)===0&&(i==null?void 0:i.length)===0;return s?null:a.jsx(W,{condition:l,show:a.jsx($nt,{segment:e,open:t,onClose:n,onRemove:r}),elseShow:a.jsx(Dnt,{segment:e,open:t,onClose:n,strategies:o,changeRequestStrategies:i})})},Fnt=({segment:e})=>{const t=Ha("projectId"),{refetchSegments:n}=Wc(),{deleteSegment:r}=l4(),{setToastData:o,setToastApiError:i}=Yt(),[s,l]=m.useState(!1),c=async()=>{try{await r(e.id),await n(),o({type:"success",title:"Successfully deleted segment"})}catch(u){i(Dt(u))}finally{l(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(ti,{onClick:()=>l(!0),permission:[l5e,Zu],projectId:t,tooltipProps:{title:"Remove segment"},"data-testid":`${HSe}_${e.name}`,children:a.jsx(co,{"data-loading":!0})}),a.jsx(W,{condition:s,show:()=>a.jsx(Nnt,{segment:e,open:s,onClose:()=>l(!1),onRemove:c})})]})},Bnt=({segment:e})=>{const t=Ha("projectId"),n=$t();return a.jsx(ti,{onClick:()=>{n(t?`/projects/${t}/settings/segments/edit/${e.id}`:`/segments/edit/${e.id}`)},permission:[gA,Zu],projectId:t,tooltipProps:{title:"Edit segment"},children:a.jsx(Oi,{"data-loading":!0})})},znt=({segment:e})=>a.jsxs(Fc,{children:[a.jsx(Bnt,{segment:e}),a.jsx(Fnt,{segment:e})]}),hp=(e,t,n)=>{m.useEffect(()=>{const r=e.filter(({condition:i})=>i).flatMap(({columns:i})=>i),o=e.flatMap(({columns:i})=>i).filter(i=>!r.includes(i));t(i=>[...new Set([...i,...r].filter(s=>!o.includes(s)))])},[...e.map(({condition:r})=>r),t,n])},Hnt=()=>{const e=Ha("projectId"),{segments:t,loading:n}=Wc(),r=Qn(Xo.breakpoints.down("md")),[o]=m.useState({sortBy:[{id:"createdAt"}],hiddenColumns:["description"]}),i=m.useMemo(()=>t?e?t.filter(({project:v})=>v===e):t:Array(5).fill({name:"Segment name",description:"Segment descripton",createdAt:new Date().toISOString(),createdBy:"user",projectId:"Project"}),[t,e]),s=m.useMemo(()=>Unt(e),[e]),{getTableProps:l,getTableBodyProps:c,headerGroups:u,rows:d,prepareRow:f,state:{globalFilter:p},setGlobalFilter:h,setHiddenColumns:g}=un.useTable({initialState:o,columns:s,data:i,sortTypes:$i,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,defaultColumn:{Cell:ea}},un.useGlobalFilter,un.useSortBy);return hp([{condition:r,columns:["createdAt","createdBy"]},{condition:!!e,columns:["project"]}],g,s),a.jsx(yr,{header:a.jsx(Bn,{title:`Segments (${d.length})`,actions:a.jsxs(a.Fragment,{children:[a.jsx(No,{initialValue:p,onChange:h}),a.jsx(Bn.Divider,{}),a.jsx(Tnt,{})]})}),isLoading:n,children:a.jsx(W,{condition:!n&&i.length===0,show:a.jsx(eo,{children:a.jsx(Pnt,{})}),elseShow:()=>a.jsxs(a.Fragment,{children:[a.jsx(ga,{value:p,children:a.jsxs(sa,{...l(),rowHeight:"standard",children:[a.jsx(ia,{headerGroups:u}),a.jsx(ws,{...c(),children:d.map(v=>(f(v),a.jsx(Pi,{hover:!0,...v.getRowProps(),children:v.cells.map(x=>a.jsx(rs,{...x.getCellProps(),children:x.render("Cell")}))})))})]})}),a.jsx(W,{condition:d.length===0&&(p==null?void 0:p.length)>0,show:a.jsxs(eo,{children:["No segments found matching “",p,"”"]})})]})})})},Unt=e=>[{id:"Icon",width:"1%",disableGlobalFilter:!0,disableSortBy:!0,Cell:()=>a.jsx(JC,{icon:a.jsx(KP,{color:"disabled"})})},{Header:"Name",accessor:"name",width:"60%",Cell:({row:{original:{name:t,description:n,id:r}}})=>a.jsx(la,{title:t,to:e?`/projects/${e}/settings/segments/edit/${r}`:`/segments/edit/${r}`,subtitle:n})},{Header:"Used in",width:"60%",Cell:({row:{original:t}})=>a.jsx(WX,{original:t})},{Header:"Project",accessor:"project",Cell:({value:t})=>a.jsx(W,{condition:!!t,show:a.jsx(la,{title:t,to:`/projects/${t}`}),elseShow:a.jsx(bn,{children:"Global"})}),sortType:"alphanumeric",maxWidth:150,filterName:"project",searchable:!0},{Header:"Created at",accessor:"createdAt",minWidth:150,Cell:Qu,disableGlobalFilter:!0},{Header:"Created by",accessor:"createdBy",width:"25%"},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:({row:{original:t}})=>a.jsx(znt,{segment:t})},{accessor:"description"}],Vnt=e=>fetch(e).then(fn("Feature flag archive")).then(t=>t.json()),hJ=e=>{const{data:t,error:n,mutate:r,isLoading:o}=Pn(Ot(e?`/api/admin/archive/features/${e}`:"api/admin/archive/features"),Vnt,{refreshInterval:15e3});return{archivedFeatures:t==null?void 0:t.features,refetchArchived:r,loading:o,error:n}},Wnt=({onRevive:e,onDelete:t,project:n})=>a.jsxs(Fc,{children:[a.jsx(ti,{onClick:e,projectId:n,permission:bg,tooltipProps:{title:"Revive feature flag"},"data-testid":"revive-feature-flag-button",children:a.jsx(XC,{})}),a.jsx(ti,{permission:hA,projectId:n,tooltipProps:{title:"Delete feature flag"},onClick:t,children:a.jsx(co,{})})]}),Gnt=({value:e})=>{const{locationSettings:t}=Mi(),n=It();return e?a.jsx(bn,{children:a.jsx(gt,{title:`Archived on: ${If(e,t.locale)}`,arrow:!0,children:a.jsx(Z,{noWrap:!0,variant:"body2","data-loading":!0,children:a.jsx(Lc,{date:new Date(e),title:"",live:!1})})})}):a.jsx(bn,{children:a.jsx(Z,{variant:"body2",color:n.palette.text.secondary,children:"not available"})})},l7=b("p")(({theme:e})=>({marginTop:e.spacing(3)})),qnt=b(ar)(({theme:e})=>({marginTop:e.spacing(2),width:"100%"})),Ynt="I want to delete",gJ=({deletedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const[i,s]=m.useState(""),{setToastData:l,setToastApiError:c}=Yt(),{deleteFeatures:u}=vC(),d=e.length>1?"toggles":"toggle",f=async()=>{try{if(e.length===0)return;await u(t,e),await o(),l({type:"success",title:`Feature ${d} deleted`,text:`You have successfully deleted the following feature ${d}: ${e.join(", ")}.`})}catch(g){c(Dt(g))}finally{p()}},p=()=>{r(!1),s("")},h="delete-feature-toggle-confirmation-form";return a.jsxs(rr,{title:`Delete feature ${d}?`,open:n,primaryButtonText:`Delete feature ${d}`,secondaryButtonText:"Cancel",onClick:f,onClose:p,disabledPrimaryButton:Ynt!==i,formId:h,children:[a.jsxs(Vt,{severity:"warning",children:[a.jsx("b",{children:"Warning!"})," Before you delete a feature flag, make sure all in-code references to that feature flag have been removed. Otherwise, a new feature flag with the same name could activate the old code paths."]}),a.jsxs(l7,{children:["You are about to delete the following feature"," ",d,":"," ",a.jsx("strong",{children:e.join(", ")}),"."]}),a.jsxs(l7,{sx:g=>({marginTop:g.spacing(2)}),children:["In order to delete the feature ",d,", please enter the following confirmation text in the text field below:"," ",a.jsx("strong",{children:"I want to delete"})]}),a.jsx("form",{id:h,children:a.jsx(qnt,{autoFocus:!0,onChange:g=>{s(g.currentTarget.value)},value:i,placeholder:"<deletion confirmation>",label:"Deletion confirmation"})})]})},Knt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"center",paddingLeft:e.spacing(2),paddingRight:e.spacing(1)})),mJ=({onChange:e,checked:t,title:n})=>a.jsx(Knt,{"data-testid":lCe,children:a.jsx(os,{onChange:e,title:n,checked:t,"data-loading":!0})}),FEt=Me.memo(mJ),Xnt=b("div")(({theme:e})=>({position:"sticky",bottom:50,zIndex:e.zIndex.fab,pointerEvents:"none"})),Jnt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"center",width:"100%",flexWrap:"wrap",paddingBottom:e.spacing(2)})),Qnt=b(xr)(({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"})),Znt=b("span")(({theme:e})=>({background:e.palette.background.alternative,color:e.palette.common.white,padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius})),ert=b(Z)(({theme:e})=>({paddingRight:e.spacing(2),marginRight:"auto"})),trt=({count:e,children:t})=>e===0?null:a.jsx(Xnt,{"data-testid":sCe,children:a.jsx(Jnt,{children:a.jsxs(Qnt,{elevation:4,children:[a.jsxs(ert,{children:[a.jsx(Znt,{"data-testid":aCe,children:e})," selected"]}),t]})})}),c7=b("p")(({theme:e})=>({marginTop:e.spacing(2)})),vJ=({revivedFeatures:e,projectId:t,open:n,setOpen:r,refetch:o})=>{const{setToastData:i,setToastApiError:s}=Yt(),{reviveFeatures:l}=vC(),c=async()=>{try{if(e.length===0)return;await l(t,e),await o(),i({type:"success",title:"And we're back!",text:"The feature flags have been revived."})}catch(p){s(Dt(p))}finally{u()}},u=()=>{r(!1)},d=`Revive feature flag${e.length>1?"s":""}?`,f=`Revive feature flag${e.length>1?"s":""}`;return a.jsxs(rr,{title:d,open:n,primaryButtonText:f,secondaryButtonText:"Cancel",onClick:c,onClose:u,children:[a.jsx(Vt,{severity:"info",children:"Revived feature flags will be automatically disabled in all environments"}),a.jsx(W,{condition:e.length>1,show:a.jsxs(a.Fragment,{children:[a.jsx(c7,{children:"You are about to revive feature flags:"}),a.jsx("ul",{children:e.map(p=>a.jsx("li",{children:p},`revive-${p}`))})]}),elseShow:a.jsxs(c7,{children:["You are about to revive feature flag:"," ",e[0]]})})]})},nrt=({selectedIds:e,projectId:t,onConfirm:n})=>{const{refetchArchived:r}=hJ(t),[o,i]=m.useState(!1),[s,l]=m.useState(!1),{trackEvent:c}=Sn(),u=async()=>{l(!0)},d=async()=>{i(!0)};return a.jsxs(a.Fragment,{children:[a.jsx(Tl,{projectId:t,permission:bg,children:({hasAccess:f})=>a.jsx(We,{disabled:!f,startIcon:a.jsx(XC,{}),variant:"outlined",size:"small",onClick:u,"date-testid":"batch_revive",children:"Revive"})}),a.jsx(Tl,{projectId:t,permission:hA,children:({hasAccess:f})=>a.jsx(We,{disabled:!f,startIcon:a.jsx(co,{}),variant:"outlined",size:"small",onClick:d,children:"Delete"})}),a.jsx(gJ,{deletedFeatures:e,projectId:t,open:o,setOpen:i,refetch:()=>{r(),n==null||n(),c("batch_operations",{props:{eventType:"features deleted"}})}}),a.jsx(vJ,{revivedFeatures:e,projectId:t,open:s,setOpen:l,refetch:()=>{r(),n==null||n(),c("batch_operations",{props:{eventType:"features revived"}})}})]})},rrt=({archivedFeatures:e=[],loading:t,refetch:n,storedParams:r,setStoredParams:o,title:i,projectId:s})=>{const l=Qn(Xo.breakpoints.down("md")),c=Qn(Xo.breakpoints.down("lg")),[u,d]=m.useState(!1),[f,p]=m.useState(),[h,g]=m.useState(!1),[v,x]=m.useState(),[y,w]=Kf(),[S,C]=m.useState(y.get("search")||"");ht();const E=m.useMemo(()=>[...s?[{id:"Select",Header:({getToggleAllRowsSelectedProps:F})=>a.jsx(os,{"data-testid":"select_all_rows",...F()}),Cell:({row:F})=>{var U;return a.jsx(mJ,{...(U=F==null?void 0:F.getToggleRowSelectedProps)==null?void 0:U.call(F)})},maxWidth:50,disableSortBy:!0,hideInMenu:!0}]:[],{Header:"Seen",accessor:"lastSeenAt",Cell:({value:F,row:{original:U}})=>a.jsx(vA,{feature:U}),align:"center",maxWidth:80},{Header:"Type",accessor:"type",width:85,canSort:!0,Cell:AG,align:"center"},{Header:"Name",accessor:"name",searchable:!0,minWidth:100,Cell:({value:F,row:{original:U}})=>a.jsx(ea,{value:F,subtitle:U.description}),sortType:"alphanumeric"},{Header:"Created",accessor:"createdAt",width:150,Cell:Qu},{Header:"Archived",accessor:"archivedAt",width:150,Cell:Gnt},...s?[]:[{Header:"Project ID",accessor:"project",sortType:"alphanumeric",filterName:"project",searchable:!0,maxWidth:170,Cell:({value:F})=>a.jsx(la,{title:F,to:`/projects/${F}`})}],{Header:"Actions",id:"Actions",align:"center",maxWidth:120,canSort:!1,Cell:({row:{original:F}})=>a.jsx(Wnt,{project:F.project,onRevive:()=>{x(F),g(!0)},onDelete:()=>{p(F),d(!0)}})},{accessor:"description",header:"Description",searchable:!0}],[s]),{data:j,getSearchText:k,getSearchContext:T}=xg(E,S,e),_=m.useMemo(()=>t?Nq:j,[j,t]),[A]=m.useState(()=>({sortBy:[{id:y.get("sort")||r.id,desc:y.has("order")?y.get("order")==="desc":r.desc}],hiddenColumns:["description"],selectedRowIds:{}})),M=m.useCallback(F=>F.name,[]),{headerGroups:I,rows:P,state:{sortBy:$,selectedRowIds:z},prepareRow:Y,setHiddenColumns:q,toggleAllRowsSelected:G}=un.useTable({columns:E,data:_,initialState:A,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSelectedRows:!1,disableSortRemove:!0,autoResetSortBy:!1,getRowId:M},un.useFlexLayout,un.useSortBy,un.useRowSelect);return hp([{condition:l,columns:["type","createdAt"]},{condition:c,columns:["lastSeenAt","stale"]}],q,E),m.useEffect(()=>{if(t)return;const F={};F.sort=$[0].id,$[0].desc&&(F.order="desc"),S&&(F.search=S),w(F,{replace:!0}),o({id:$[0].id,desc:$[0].desc||!1})},[t,$,S]),a.jsxs(a.Fragment,{children:[a.jsxs(yr,{isLoading:t,header:a.jsx(Bn,{titleElement:`${i} (${P.length<_.length?`${P.length} of ${_.length}`:_.length})`,actions:a.jsx(No,{initialValue:S,onChange:C,hasFilters:!0,getSearchContext:T})}),children:[a.jsx(ga,{value:k(S),children:a.jsx(vg,{rows:P,headerGroups:I,prepareRow:Y})}),a.jsx(W,{condition:P.length===0,show:()=>a.jsx(W,{condition:(S==null?void 0:S.length)>0,show:a.jsxs(eo,{children:["No feature flags found matching “",S,"”"]}),elseShow:a.jsx(eo,{children:"None of the feature flags were archived yet."})})}),a.jsx(gJ,{deletedFeatures:[f==null?void 0:f.name],projectId:s??(f==null?void 0:f.project),open:u,setOpen:d,refetch:n}),a.jsx(vJ,{revivedFeatures:[v==null?void 0:v.name],projectId:s??(v==null?void 0:v.project),open:h,setOpen:g,refetch:n})]}),a.jsx(W,{condition:!!s,show:a.jsx(trt,{count:Object.keys(z).length,children:a.jsx(nrt,{selectedIds:Object.keys(z),projectId:s,onConfirm:()=>G(!1)})})})]})},ort={id:"createdAt"},{value:irt,setValue:srt}=Xl("FeaturesArchiveTable:v1",ort),art=()=>{eA("Archive");const{archivedFeatures:e=[],loading:t,refetchArchived:n}=hJ();return a.jsx(rrt,{title:"Archive",archivedFeatures:e,loading:t,storedParams:irt,setStoredParams:srt,refetch:n})},lrt=m.lazy(()=>yd(()=>import("./AdvancedPlayground-p7tDUOqb.js"),[])),crt=b(We)(({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}})),urt=({label:e,selected:t,onClick:n,icon:r})=>a.jsxs(crt,{selected:!!t,onClick:n,disableElevation:!0,disableFocusRipple:!0,fullWidth:!0,children:[e,r]}),drt=b("div")(({theme:e})=>({display:"flex",gap:e.spacing(3),[e.breakpoints.down("md")]:{flexDirection:"column"}})),frt=b("div")(()=>({flexGrow:1,display:"flex",flexDirection:"column"})),prt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1),width:e.spacing(30),flexShrink:0,[e.breakpoints.down("md")]:{width:"100%"}})),hrt=({tabs:e,value:t,onChange:n,children:r})=>a.jsxs(drt,{children:[a.jsx(prt,{children:e.filter(o=>!o.hidden).map(o=>a.jsx(urt,{label:o.label,selected:o.id===t,onClick:()=>n(o),icon:o.icon},o.id))}),a.jsx(frt,{children:r})]}),yJ=(e,t={})=>{const n=async()=>{const u=Ot(`api/admin/auth/${e}/settings`);return(await fetch(u,{method:"GET"}).then(fn("Auth settings"))).json()},r=`api/admin/auth/${e}/settings`,{data:o,error:i}=bC({},r,n,t),[s,l]=m.useState(!i&&!o),c=()=>{Po(r)};return m.useEffect(()=>{l(!i&&!o)},[o,i]),{config:o||{},error:i,loading:s,refetch:c}},grt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{changePassword:async i=>{const s=t("api/admin/user/change-password",{method:"POST",body:JSON.stringify(i)});await e(s.caller,s.id)},errors:n,loading:r}},mrt=b("form")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),maxWidth:e.spacing(44)})),vrt=()=>{const{config:e,loading:t}=yJ("simple"),[n,r]=m.useState(!1),{setToastData:o,setToastApiError:i}=Yt(),[s,l]=m.useState(!1),[c,u]=m.useState(),[d,f]=m.useState(),[p,h]=m.useState(""),[g,v]=m.useState(""),[x,y]=m.useState(""),{changePassword:w}=grt(),S=async C=>{if(C.preventDefault(),p===g){if(!s)u(ZY);else{r(!0),u(void 0),f(void 0);try{await w({password:p,confirmPassword:g,oldPassword:x}),o({title:"Password changed successfully",text:"Now you can sign in using your new password.",type:"success"})}catch(E){const j=Dt(E);E instanceof _5?f(j):u(j),i(j)}}r(!1)}};return t?null:a.jsx(yr,{isLoading:n,header:"Change password",children:a.jsx(W,{condition:e.disabled,show:a.jsx(Vt,{severity:"error",children:"Password based login is currently disabled for your Unleash instance."}),elseShow:a.jsxs(mrt,{children:[a.jsx(eK,{password:p,callback:l,"data-loading":!0}),a.jsx(pf,{"data-loading":!0,label:"Old password",name:"oldPassword",value:x,error:!!d,helperText:d,autoComplete:"current-password",onChange:C=>y(C.target.value)}),a.jsx(pf,{"data-loading":!0,label:"Password",name:"password",value:p,error:!!c,helperText:c,autoComplete:"new-password",onChange:C=>h(C.target.value)}),a.jsx(pf,{"data-loading":!0,label:"Confirm password",name:"confirmPassword",value:g,autoComplete:"new-password",onChange:C=>v(C.target.value)}),a.jsx(tK,{"data-loading":!0,started:!!(p&&g),matchingPasswords:p===g}),a.jsx(We,{"data-loading":!0,variant:"contained",color:"primary",type:"submit",onClick:S,children:"Save"})]})})})},yrt=/^[a-z0-9\-_]*$/,xrt="environment",brt="project",xJ="root",bJ="project",wrt="root-custom",Srt="custom",Crt=[xJ,bJ],BEt=[xJ,wrt],jrt=[bJ,Srt],wJ=10,y4=()=>{const{data:e,error:t,mutate:n}=Pn(Ot("api/admin/user/tokens"),Ert);return{tokens:e?e.pats:void 0,loading:!t&&!e,refetchTokens:()=>n(),error:t}},Ert=e=>fetch(e).then(fn("Personal API Tokens")).then(t=>t.json()),SJ=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{createPersonalAPIToken:async s=>{const l=t("api/admin/user/tokens",{method:"POST",body:JSON.stringify(s)});return(await e(l.caller,l.id)).json()},deletePersonalAPIToken:async s=>{const l=t(`api/admin/user/tokens/${s}`,{method:"DELETE"});await e(l.caller,l.id)},errors:n,loading:r}},Trt=e=>{const t=new Date(e);return Ul(t,"yyyy-MM-dd")},krt=e=>{const t=new Date(e);return`${Ul(t,"yyyy-MM-dd")}T${Ul(t,"HH:mm")}`},_rt=({label:e,type:t="datetime",error:n,errorText:r,min:o,max:i,value:s,onChange:l,...c})=>{const u=t==="datetime"?krt:Trt,d=t==="datetime"?"datetime-local":"date";return a.jsx(Cn,{type:d,size:"small",variant:"outlined",label:e,error:n,helperText:r,value:u(s.toISOString()),onChange:f=>{const p=Y5(f.target.value);l(p??s)},FormHelperTextProps:{"data-testid":vW},inputProps:{min:o&&u(o.toISOString()),max:i&&u(i.toISOString())},...c})},u7=b("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),Rrt=b(ar)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50),marginBottom:e.spacing(2)})),Art=b("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"}})),Prt=b(SC)(({theme:e})=>({minWidth:e.spacing(20),marginRight:e.spacing(.5),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),Ort=b(_rt)(({theme:e})=>({width:e.spacing(28),[e.breakpoints.down("sm")]:{width:e.spacing(50)}})),$rt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(2),maxWidth:e.spacing(50)}));var CJ=(e=>(e["7DAYS"]="7d",e["30DAYS"]="30d",e["60DAYS"]="60d",e.NEVER="never",e.CUSTOM="custom",e))(CJ||{});const jJ=[{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"}],P_=e=>{const t=new Date,n=jJ.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},Irt=({description:e,setDescription:t,isDescriptionUnique:n,expiration:r,setExpiration:o,expiresAt:i,setExpiresAt:s,errors:l,setErrors:c})=>{const{locationSettings:u}=Mi(),d=v=>{c(x=>({...x,[v]:void 0}))},f=(v,x)=>{c(y=>({...y,[v]:x}))};m.useEffect(()=>{d("expiresAt"),s(P_(r))},[r]);const p=v=>{d("description"),n&&!n(v)&&f("description","A token with that description already exists."),t(v)},h=r==="custom",g=i.getFullYear()>new Date().getFullYear()+100;return a.jsxs(a.Fragment,{children:[a.jsx(u7,{children:"Describe what this token will be used for"}),a.jsx(Rrt,{autoFocus:!0,label:"Description",error:!!l.description,errorText:l.description,value:e,onChange:v=>p(v.target.value),required:!0}),a.jsx(u7,{children:"Token expiration date"}),a.jsxs(Art,{custom:h,children:[a.jsx(Prt,{name:"expiration",id:"expiration",label:"Token will expire in",value:r,onChange:v=>o(v.target.value),options:jJ}),a.jsx(W,{condition:h,show:()=>a.jsx(Ort,{label:"Date",value:i,onChange:v=>{d("expiresAt"),v<new Date&&f("expiresAt","Invalid date, must be in the future"),s(v)},min:new Date,error:!!l.expiresAt,errorText:l.expiresAt,required:!0}),elseShow:a.jsx(W,{condition:g,show:a.jsxs(Z,{variant:"body2",children:["The token will ",a.jsx("strong",{children:"never"})," ","expire!"]}),elseShow:()=>a.jsxs(Z,{variant:"body2",children:["Token will expire on"," ",a.jsx("strong",{children:If(i,u.locale)})]})})})]}),a.jsx(W,{condition:g,show:a.jsx($rt,{severity:"warning",children:"We strongly recommend that you set an expiration date for your token to help keep your information secure."})})]})},Mrt=b("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Drt=b("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",[e.breakpoints.down("sm")]:{marginTop:e.spacing(4)}})),Lrt=b(We)(({theme:e})=>({marginLeft:e.spacing(3)})),Ny=CJ["30DAYS"],Nrt=({open:e,setOpen:t,newToken:n})=>{const{tokens:r,refetchTokens:o}=y4(),{createPersonalAPIToken:i,loading:s}=SJ(),{setToastApiError:l}=Yt(),{uiConfig:c}=ht(),[u,d]=m.useState(""),[f,p]=m.useState(Ny),[h,g]=m.useState(P_(Ny)),[v,x]=m.useState({});m.useEffect(()=>{d(""),p(Ny),g(P_(Ny)),x({})},[e]);const y=()=>({description:u,expiresAt:h}),w=async k=>{k.preventDefault();try{const T=await i(y());n(T),o(),t(!1)}catch(T){l(Dt(T))}},S=()=>`curl --location --request POST '${c.unleashUrl}/api/admin/user/tokens' \\
407
407
  --header 'Authorization: INSERT_API_KEY' \\
408
408
  --header 'Content-Type: application/json' \\
409
409
  --data-raw '${JSON.stringify(y(),void 0,2)}'`,C=k=>k.length,E=k=>!(r!=null&&r.some(T=>T.description===k)),j=C(u)&&E(u)&&h>new Date;return a.jsx(pp,{open:e,onClose:()=>{t(!1)},label:"Create personal API token",children:a.jsx(Br,{loading:s,modal:!0,title:"Create personal API token",description:`Use personal API tokens to authenticate to the Unleash API as
410
410
  yourself. A personal API token has the same access privileges as
411
- your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:S,children:a.jsxs(Mrt,{onSubmit:w,children:[a.jsx("div",{children:a.jsx(Irt,{description:u,setDescription:d,isDescriptionUnique:E,expiration:f,setExpiration:p,expiresAt:h,setExpiresAt:g,errors:v,setErrors:x})}),a.jsxs(Drt,{children:[a.jsx(We,{type:"submit",variant:"contained",color:"primary",disabled:!j,children:"Create token"}),a.jsx(Lrt,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},Frt=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=y4(),{deletePersonalAPIToken:o}=SJ(),{setToastData:i,setToastApiError:s}=Yt(),l=async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){s(Dt(c))}};return a.jsx(rr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:l,onClose:()=>{t(!1)},title:"Delete token?",children:a.jsxs(Z,{children:['Any applications or scripts using this token "',a.jsx("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},Brt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(3)})),zrt=({open:e,setOpen:t,token:n})=>a.jsxs(rr,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[a.jsx(Brt,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),a.jsx(Z,{variant:"body1",children:"Your token:"}),a.jsx(m4,{token:(n==null?void 0:n.secret)||""})]}),x4=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=If})=>{const{locationSettings:i}=Mi();if(!e)return a.jsx(bn,{children:n});const s=o(e,i.locale);return a.jsx(bn,{children:a.jsx(gt,{title:(r==null?void 0:r(s))??s,arrow:!0,children:a.jsx(Z,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:a.jsx(Lc,{date:new Date(e),live:t,title:""})})})})},Hrt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(3)})),Urt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),Vrt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),Wrt=b(Z)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),Grt=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),qrt={id:"createdAt",desc:!0},{value:d7,setValue:Yrt}=Xl("PersonalAPITokensTable:v1",qrt),Krt=()=>{const e=It(),t=Qn(e.breakpoints.down("md")),n=Qn(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=y4(),[i,s]=Kf(),[l]=m.useState(()=>({sortBy:[{id:i.get("sort")||d7.id,desc:i.has("order")?i.get("order")==="desc":d7.desc}],globalFilter:i.get("search")||""})),[c,u]=m.useState(l.globalFilter),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,v]=m.useState(!1),[x,y]=m.useState(),[w,S]=m.useState(),C=m.useMemo(()=>[{Header:"Description",accessor:"description",Cell:ea,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:$})=>new Date($).getFullYear()>new Date().getFullYear()+100?a.jsx(bn,{children:"Never"}):a.jsx(Qu,{value:$}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Qu,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:x4,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:$}})=>a.jsx(Fc,{children:a.jsx(gt,{title:"Delete token",arrow:!0,describeChild:!0,children:a.jsx("span",{children:a.jsx(Ht,{onClick:()=>{S($),v(!0)},children:a.jsx(co,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:E,getSearchText:j,getSearchContext:k}=xg(C,c,r),T=m.useMemo(()=>(E==null?void 0:E.length)===0&&o?Grt:E,[E,o]),{headerGroups:_,rows:A,prepareRow:M,state:{sortBy:I},setHiddenColumns:P}=un.useTable({columns:C,data:T,initialState:l,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},un.useSortBy,un.useFlexLayout);return hp([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],P,C),m.useEffect(()=>{const $={};$.sort=I[0].id,I[0].desc&&($.order="desc"),c&&($.search=c),s($,{replace:!0}),Yrt({id:I[0].id,desc:I[0].desc||!1})},[I,c,s]),a.jsxs(yr,{isLoading:o,header:a.jsx(Bn,{title:`Personal API tokens (${A.length<T.length?`${A.length} of ${T.length}`:T.length})`,actions:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!t,show:a.jsxs(a.Fragment,{children:[a.jsx(No,{initialValue:c,onChange:u,getSearchContext:k}),a.jsx(Bn.Divider,{})]})}),a.jsx(We,{variant:"contained",color:"primary",disabled:r.length>=wJ,onClick:()=>f(!0),children:"New token"})]}),children:a.jsx(W,{condition:t,show:a.jsx(No,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:k})})}),children:[a.jsx(Hrt,{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."}),a.jsx(ga,{value:j(c),children:a.jsx(vg,{rows:A,headerGroups:_,prepareRow:M})}),a.jsx(W,{condition:A.length===0,show:a.jsx(W,{condition:(c==null?void 0:c.length)>0,show:a.jsxs(eo,{children:["No tokens found matching “",c,"”"]}),elseShow:a.jsxs(Urt,{children:[a.jsx(Vrt,{children:"You have no personal API tokens yet."}),a.jsx(Wrt,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),a.jsx(We,{variant:"outlined",onClick:()=>f(!0),children:"Create your first token"})]})})}),a.jsx(Nrt,{open:d,setOpen:f,newToken:$=>{y($),h(!0)}}),a.jsx(zrt,{open:p,setOpen:h,token:x}),a.jsx(Frt,{open:g,setOpen:v,token:w})]})};var b4={},Xrt=ze;Object.defineProperty(b4,"__esModule",{value:!0});var w4=b4.default=void 0,Jrt=Xrt(He()),Qrt=a,Zrt=(0,Jrt.default)((0,Qrt.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");w4=b4.default=Zrt;const EJ=(e,t={})=>{const{isEnterprise:n}=ht(),{data:r,error:o,mutate:i}=Ql(!!e&&n(),void 0,Ot(`api/admin/roles/${e}`),eot,t);return m.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},eot=e=>fetch(e).then(fn("Role")).then(t=>t.json());var S4={},tot=ze;Object.defineProperty(S4,"__esModule",{value:!0});var O_=S4.default=void 0,not=tot(He()),rot=a,oot=(0,not.default)((0,rot.jsx)("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person");O_=S4.default=oot;var C4={},iot=ze;Object.defineProperty(C4,"__esModule",{value:!0});var TJ=C4.default=void 0,sot=iot(He()),aot=a,lot=(0,sot.default)((0,aot.jsx)("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm3.61 6.34c1.07 0 1.93.86 1.93 1.93 0 1.07-.86 1.93-1.93 1.93-1.07 0-1.93-.86-1.93-1.93-.01-1.07.86-1.93 1.93-1.93zm-6-1.58c1.3 0 2.36 1.06 2.36 2.36 0 1.3-1.06 2.36-2.36 2.36s-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36zm0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68zM11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09z"}),"SupervisedUserCircle");TJ=C4.default=lot;const gf=e=>e.environment?`${e.name}-${e.environment}`:`${e.name}`,zEt=e=>e.reduce((t,n)=>(t[gf(n)]=n,t),{}),HEt=(e,t)=>{const n=S1(e);return n[gf(t)]?delete n[gf(t)]:n[gf(t)]={...t},n},UEt=(e,t)=>{const n=S1(e);return t.every(o=>n[gf(o)])?t.forEach(o=>{delete n[gf(o)]}):t.forEach(o=>{n[gf(o)]={...o}}),n},cot=e=>e.filter(({name:r})=>r!=="ADMIN").reduce((r,o)=>{var l;const i=((l=wZe.find(c=>c.permissions.includes(o.name)))==null?void 0:l.label)||"Other",s=r.find(({label:c})=>c===i);return s?s.permissions.push(o):r.push({label:i,type:"root",permissions:[o]}),r},[]).map(r=>({...r,permissions:[...new Set(r.permissions.sort((o,i)=>o.displayName.localeCompare(i.displayName)))]})).sort(dot),uot=e=>{const t=e.filter(({type:o})=>o===brt),n=e.filter(({type:o})=>o===xrt),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const s=i.environment,l=o.find(({label:c})=>c===s);return l?l.permissions.push(i):o.push({label:s,type:"environment",permissions:[i]}),o},[])),r.map(o=>({...o,permissions:[...new Set(o.permissions.sort((i,s)=>i.displayName.localeCompare(s.displayName)))]}))},VEt=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],dot=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),fot=b("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})),pot=b("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),hot=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),got=b("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),mot=b(TJ)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),vot=b("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),yot=b("p")(({theme:e})=>({marginTop:e.spacing(.5)})),xot=b("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),bot=({roleId:e,tooltip:t,...n})=>{const{role:r}=EJ(e.toString());if(!r)return null;const{name:o,description:i,permissions:s,type:l}=r,u=jrt.includes(l)?uot(s):cot(s);return a.jsxs(fot,{tooltip:t,...n,children:[a.jsxs(got,{children:[a.jsx(mot,{color:"disabled"}),o]}),a.jsx(yot,{children:i}),a.jsx(W,{condition:!Crt.includes(r.type),show:()=>a.jsxs(a.Fragment,{children:[a.jsx(pot,{children:"Role permissions:"}),a.jsx(hot,{children:u.map(({label:d,permissions:f})=>a.jsxs("div",{children:[a.jsx(vot,{children:d}),a.jsx(xot,{children:f.map(p=>a.jsx("li",{children:p.displayName},p.name))})]},d))})]})})]})},wot=({roleId:e,children:t})=>{const{role:n}=EJ(e.toString());return n?a.jsx(aa,{title:a.jsx(bot,{roleId:e,tooltip:!0}),arrow:!0,children:a.jsx(qt,{color:"success",icon:a.jsx(O_,{}),sx:{cursor:"pointer"},children:n.name})}):t?a.jsx(qt,{color:"success",icon:a.jsx(O_,{}),children:t}):null},Sot=b("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})),Cot=b("div")(()=>({flexGrow:1})),jot=b(Z)(({theme:e})=>({fontSize:e.spacing(3.75)})),Eot=b(f5)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),f7=b(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),Tot=b("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),kot=b(qt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),_ot=b("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),Rot=b(Ua)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),Aot=b(Y0)(({theme:e})=>({backgroundColor:e.palette.background.paper})),Pot=({user:e})=>{const{profile:t}=sK(),n=$t(),{locationSettings:r,setLocationSettings:o}=Mi(),[i,s]=m.useState(),[l,c]=m.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);m.useEffect(()=>{const d=l.find(f=>f.toLowerCase().includes(r.locale.toLowerCase()));s(d),d||c(f=>[...f,r.locale])},[r]);const u=d=>{const f=d.target.value;s(f),o({locale:f})};return a.jsxs(a.Fragment,{children:[a.jsxs(Sot,{children:[a.jsx(Eot,{user:e}),a.jsxs(Cot,{children:[a.jsx(jot,{children:e.name||e.username}),a.jsx(Z,{variant:"body1",children:e.email})]})]}),a.jsxs(yr,{children:[a.jsx(f7,{children:"Access"}),a.jsxs(Tot,{children:[a.jsx(ne,{sx:{width:"50%"},children:a.jsx(W,{condition:!!(t!=null&&t.rootRole),show:()=>a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"body2",children:"Your root role"}),a.jsx(wot,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),a.jsxs(ne,{children:[a.jsx(Z,{variant:"body2",children:"Projects"}),a.jsx(W,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>a.jsx(gt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:a.jsx(kot,{onClick:f=>{f.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:a.jsx(w4,{}),children:d})},d)),elseShow:a.jsx(gt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:a.jsx(qt,{children:"No projects"})})})]})]}),a.jsx(_ot,{}),a.jsx(f7,{children:"Settings"}),a.jsx(Z,{variant:"body2",children:"This is the format used across the system for time and date"}),a.jsxs(Rot,{variant:"outlined",size:"small",children:[a.jsx(Aot,{htmlFor:"locale-select",children:"Date/Time formatting"}),a.jsx(Z0,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>a.jsx("option",{value:d,children:d},d))})]})]})]})},Oot=()=>{const{user:e}=ss(),t=Ao(),n=$t(),{config:r,loading:o}=yJ("simple"),{uiConfig:i}=ht(),s=[{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=f=>{n(f.path?`/profile/${f.path}`:"/profile",{replace:!0}),d(f.id)},c=()=>{const f=t.pathname;return(s.find(({path:h})=>h&&f.includes(h))||s[0]).id},[u,d]=m.useState(c());return m.useEffect(()=>{d(c())},[t]),o?null:a.jsxs(hrt,{tabs:s,value:u,onChange:l,children:[a.jsx(W,{condition:u==="profile",show:a.jsx(Pot,{user:e})}),a.jsx(W,{condition:u==="password",show:a.jsx(vrt,{})}),a.jsx(W,{condition:u==="pat",show:a.jsx(Krt,{})})]})},$ot=m.lazy(()=>yd(()=>import("./FeatureViewLazyExport-Bk1x90Kb.js").then(e=>e.F),[])),Iot=m.lazy(()=>yd(()=>import("./LazyAdminExport-Bq-oujr9.js").then(e=>e.L),[])),Mot=m.lazy(()=>yd(()=>import("./LazyProjectExport-DkbRhMrD.js"),[])),Dot=()=>{const{isEnterprise:e}=ht(),{data:t,error:n,mutate:r}=Ql(e(),{events:[]},Ot("api/admin/logins"),Lot);return m.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},Lot=e=>fetch(e).then(fn("Login History")).then(t=>t.json()),p7=b(ne)(()=>({display:"flex",justifyContent:"center"})),Not=({row:e,value:t})=>{const{searchQuery:n}=Jl();return t?a.jsx(p7,{children:a.jsx(qt,{color:"success",children:"True"})}):a.jsx(p7,{children:a.jsx(aa,{arrow:!0,title:a.jsx(pi,{search:n,children:e.original.failure_reason}),children:a.jsx(qt,{color:"error",children:"False"})})})},Fot=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=sr({propagateErrors:!0});return{downloadCSV:async()=>{const s=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await t(s.caller,s.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:r,loading:e}};var j4={},Bot=ze;Object.defineProperty(j4,"__esModule",{value:!0});var kJ=j4.default=void 0,zot=Bot(He()),Hot=a,Uot=(0,zot.default)((0,Hot.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");kJ=j4.default=Uot;const Vot={id:"created_at",desc:!0},{value:h7,setValue:Wot}=Xl("LoginHistoryTable:v1",Vot),Got={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},qot=()=>{const{events:e,loading:t}=Dot(),{downloadCSV:n}=Fot(),[r,o]=Kf(),[i]=m.useState(()=>({sortBy:[{id:r.get("sort")||h7.id,desc:r.has("order")?r.get("order")==="desc":h7.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[s,l]=m.useState(i.globalFilter),c=Qn(Xo.breakpoints.down("sm")),u=Qn(Xo.breakpoints.down("md")),d=m.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:S})=>a.jsx(x4,{value:S,dateFormat:l1}),maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:ea,searchable:!0},{Header:"Authentication",accessor:S=>Got[S.auth_type]||S.auth_type,width:150,maxWidth:150,Cell:ea,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:ea,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:Not,filterName:"success",filterParsing:S=>S.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:f,getSearchText:p,getSearchContext:h}=xg(d,s,e),{headerGroups:g,rows:v,prepareRow:x,state:{sortBy:y},setHiddenColumns:w}=un.useTable({columns:d,data:f,initialState:i,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:bn}},un.useSortBy,un.useFlexLayout);return hp([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),m.useEffect(()=>{const S={};S.sort=y[0].id,y[0].desc&&(S.order="desc"),s&&(S.search=s),o(S,{replace:!0}),Wot({id:y[0].id,desc:y[0].desc||!1})},[y,s,o]),a.jsxs(yr,{isLoading:t,header:a.jsx(Bn,{title:`Login history (${v.length})`,actions:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!u,show:a.jsx(No,{initialValue:s,onChange:l,hasFilters:!0,getSearchContext:h})}),a.jsx(W,{condition:v.length>0,show:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!u,show:a.jsx(Bn.Divider,{})}),a.jsx(gt,{title:"Download login history",arrow:!0,children:a.jsx(Ht,{onClick:n,children:a.jsx(kJ,{})})})]})})]}),children:a.jsx(W,{condition:u,show:a.jsx(No,{initialValue:s,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[a.jsx(ga,{value:p(s),children:a.jsx(vg,{rows:v,headerGroups:g,prepareRow:x})}),a.jsx(W,{condition:v.length===0,show:a.jsx(W,{condition:(s==null?void 0:s.length)>0,show:a.jsxs(eo,{children:["No login events found matching “",s,"”"]}),elseShow:a.jsx(eo,{children:"No login events available."})})})]})},Yot=()=>{const{isEnterprise:e}=ht();return e()?a.jsx("div",{children:a.jsx(i4,{permissions:Qo,children:a.jsx(qot,{})})}):a.jsx(hP,{feature:"login-history",page:!0})},Kot=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,s)=>{const l={lifetimeDays:s},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},Xot=b("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%"})),Jot=b(KV)(({theme:e})=>({height:"80px"})),Qot=b("div")(({theme:e})=>({display:"flex",position:"relative"})),Zot=b("div")(({theme:e})=>({marginTop:e.spacing(4)})),eit=b(We)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),E4=({children:e})=>{const t=$t(),n=()=>{t("/")},r=()=>{t(Ni)};return a.jsxs(Xot,{children:[a.jsxs("div",{children:[a.jsx(Jot,{}),a.jsx(Qot,{children:a.jsx(Z,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),a.jsxs(Zot,{children:[a.jsx(We,{variant:"contained",color:"primary",onClick:r,children:"Go back"}),a.jsx(eit,{onClick:n,children:"Go home"})]})]}),e]})},tit=b(ne)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),nit=b(ne)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),rit=({featureType:e,loading:t})=>{const n=$t(),{uiConfig:r}=ht(),{refetch:o}=c1(),{updateFeatureTypeLifetime:i,loading:s}=Kot(),[l,c]=m.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=m.useState(!(e!=null&&e.lifetimeDays)),{setToastData:f,setToastApiError:p}=Yt(),h=Sn(),g=S=>{const C=Number.parseInt(Ju(S.target.value),10);c(C),C===0&&d(!0)},v=S=>{d(S.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},x=!u&&(Number.isNaN(l)||l<0),y=async S=>{S.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature flag type loaded");const C=u?0:l;await i(e.id,C),o(),f({title:"Feature type updated",type:"success"}),n("/feature-toggle-type"),h.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:C}})}catch(C){p(Dt(C))}},w=m.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 '{
411
+ your user.`,documentationLink:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",documentationLinkLabel:"Tokens documentation",formatApiCode:S,children:a.jsxs(Mrt,{onSubmit:w,children:[a.jsx("div",{children:a.jsx(Irt,{description:u,setDescription:d,isDescriptionUnique:E,expiration:f,setExpiration:p,expiresAt:h,setExpiresAt:g,errors:v,setErrors:x})}),a.jsxs(Drt,{children:[a.jsx(We,{type:"submit",variant:"contained",color:"primary",disabled:!j,children:"Create token"}),a.jsx(Lrt,{onClick:()=>{t(!1)},children:"Cancel"})]})]})})})},Frt=({open:e,setOpen:t,token:n})=>{const{refetchTokens:r}=y4(),{deletePersonalAPIToken:o}=SJ(),{setToastData:i,setToastApiError:s}=Yt(),l=async()=>{if(n)try{await o(n==null?void 0:n.id),r(),t(!1),i({title:"Token deleted successfully",type:"success"})}catch(c){s(Dt(c))}};return a.jsx(rr,{open:e,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:l,onClose:()=>{t(!1)},title:"Delete token?",children:a.jsxs(Z,{children:['Any applications or scripts using this token "',a.jsx("strong",{children:n==null?void 0:n.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})},Brt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(3)})),zrt=({open:e,setOpen:t,token:n})=>a.jsxs(rr,{open:e,setOpen:t,secondaryButtonText:"Close",onClose:(r,o)=>{o||t(!1)},title:"Personal API token created",children:[a.jsx(Brt,{severity:"info",children:"Make sure to copy your personal API token now. You won't be able to see it again!"}),a.jsx(Z,{variant:"body1",children:"Your token:"}),a.jsx(m4,{token:(n==null?void 0:n.secret)||""})]}),x4=({value:e,live:t=!1,emptyText:n,title:r,dateFormat:o=If})=>{const{locationSettings:i}=Mi();if(!e)return a.jsx(bn,{children:n});const s=o(e,i.locale);return a.jsx(bn,{children:a.jsx(gt,{title:(r==null?void 0:r(s))??s,arrow:!0,children:a.jsx(Z,{noWrap:!0,component:"span",variant:"body2","data-loading":!0,children:a.jsx(Lc,{date:new Date(e),live:t,title:""})})})})},Hrt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(3)})),Urt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(10,2)})),Vrt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(1.5)})),Wrt=b(Z)(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(4.5)})),Grt=Array(15).fill({description:"Short description of the feature",type:"-",createdAt:new Date(2022,1,1),project:"projectID"}),qrt={id:"createdAt",desc:!0},{value:d7,setValue:Yrt}=Xl("PersonalAPITokensTable:v1",qrt),Krt=()=>{const e=It(),t=Qn(e.breakpoints.down("md")),n=Qn(e.breakpoints.down("sm")),{tokens:r=[],loading:o}=y4(),[i,s]=Kf(),[l]=m.useState(()=>({sortBy:[{id:i.get("sort")||d7.id,desc:i.has("order")?i.get("order")==="desc":d7.desc}],globalFilter:i.get("search")||""})),[c,u]=m.useState(l.globalFilter),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,v]=m.useState(!1),[x,y]=m.useState(),[w,S]=m.useState(),C=m.useMemo(()=>[{Header:"Description",accessor:"description",Cell:ea,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:$})=>new Date($).getFullYear()>new Date().getFullYear()+100?a.jsx(bn,{children:"Never"}):a.jsx(Qu,{value:$}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:Qu,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:x4,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:$}})=>a.jsx(Fc,{children:a.jsx(gt,{title:"Delete token",arrow:!0,describeChild:!0,children:a.jsx("span",{children:a.jsx(Ht,{onClick:()=>{S($),v(!0)},children:a.jsx(co,{})})})})}),maxWidth:100,disableSortBy:!0}],[S,v]),{data:E,getSearchText:j,getSearchContext:k}=xg(C,c,r),T=m.useMemo(()=>(E==null?void 0:E.length)===0&&o?Grt:E,[E,o]),{headerGroups:_,rows:A,prepareRow:M,state:{sortBy:I},setHiddenColumns:P}=un.useTable({columns:C,data:T,initialState:l,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},un.useSortBy,un.useFlexLayout);return hp([{condition:n,columns:["expiresAt"]},{condition:t,columns:["createdAt"]}],P,C),m.useEffect(()=>{const $={};$.sort=I[0].id,I[0].desc&&($.order="desc"),c&&($.search=c),s($,{replace:!0}),Yrt({id:I[0].id,desc:I[0].desc||!1})},[I,c,s]),a.jsxs(yr,{isLoading:o,header:a.jsx(Bn,{title:`Personal API tokens (${A.length<T.length?`${A.length} of ${T.length}`:T.length})`,actions:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!t,show:a.jsxs(a.Fragment,{children:[a.jsx(No,{initialValue:c,onChange:u,getSearchContext:k}),a.jsx(Bn.Divider,{})]})}),a.jsx(We,{variant:"contained",color:"primary",disabled:r.length>=wJ,onClick:()=>f(!0),children:"New token"})]}),children:a.jsx(W,{condition:t,show:a.jsx(No,{initialValue:c,onChange:u,hasFilters:!0,getSearchContext:k})})}),children:[a.jsx(Hrt,{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."}),a.jsx(ga,{value:j(c),children:a.jsx(vg,{rows:A,headerGroups:_,prepareRow:M})}),a.jsx(W,{condition:A.length===0,show:a.jsx(W,{condition:(c==null?void 0:c.length)>0,show:a.jsxs(eo,{children:["No tokens found matching “",c,"”"]}),elseShow:a.jsxs(Urt,{children:[a.jsx(Vrt,{children:"You have no personal API tokens yet."}),a.jsx(Wrt,{variant:"body2",children:"Need an API token for scripts or testing? Create a personal API token for quick access to the Unleash API."}),a.jsx(We,{variant:"outlined",onClick:()=>f(!0),children:"Create your first token"})]})})}),a.jsx(Nrt,{open:d,setOpen:f,newToken:$=>{y($),h(!0)}}),a.jsx(zrt,{open:p,setOpen:h,token:x}),a.jsx(Frt,{open:g,setOpen:v,token:w})]})};var b4={},Xrt=ze;Object.defineProperty(b4,"__esModule",{value:!0});var w4=b4.default=void 0,Jrt=Xrt(He()),Qrt=a,Zrt=(0,Jrt.default)((0,Qrt.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");w4=b4.default=Zrt;const EJ=(e,t={})=>{const{isEnterprise:n}=ht(),{data:r,error:o,mutate:i}=Ql(!!e&&n(),void 0,Ot(`api/admin/roles/${e}`),eot,t);return m.useMemo(()=>({role:r,loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},eot=e=>fetch(e).then(fn("Role")).then(t=>t.json());var S4={},tot=ze;Object.defineProperty(S4,"__esModule",{value:!0});var O_=S4.default=void 0,not=tot(He()),rot=a,oot=(0,not.default)((0,rot.jsx)("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person");O_=S4.default=oot;var C4={},iot=ze;Object.defineProperty(C4,"__esModule",{value:!0});var TJ=C4.default=void 0,sot=iot(He()),aot=a,lot=(0,sot.default)((0,aot.jsx)("path",{d:"M11.99 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm3.61 6.34c1.07 0 1.93.86 1.93 1.93 0 1.07-.86 1.93-1.93 1.93-1.07 0-1.93-.86-1.93-1.93-.01-1.07.86-1.93 1.93-1.93zm-6-1.58c1.3 0 2.36 1.06 2.36 2.36 0 1.3-1.06 2.36-2.36 2.36s-2.36-1.06-2.36-2.36c0-1.31 1.05-2.36 2.36-2.36zm0 9.13v3.75c-2.4-.75-4.3-2.6-5.14-4.96 1.05-1.12 3.67-1.69 5.14-1.69.53 0 1.2.08 1.9.22-1.64.87-1.9 2.02-1.9 2.68zM11.99 20c-.27 0-.53-.01-.79-.04v-4.07c0-1.42 2.94-2.13 4.4-2.13 1.07 0 2.92.39 3.84 1.15-1.17 2.97-4.06 5.09-7.45 5.09z"}),"SupervisedUserCircle");TJ=C4.default=lot;const gf=e=>e.environment?`${e.name}-${e.environment}`:`${e.name}`,zEt=e=>e.reduce((t,n)=>(t[gf(n)]=n,t),{}),HEt=(e,t)=>{const n=S1(e);return n[gf(t)]?delete n[gf(t)]:n[gf(t)]={...t},n},UEt=(e,t)=>{const n=S1(e);return t.every(o=>n[gf(o)])?t.forEach(o=>{delete n[gf(o)]}):t.forEach(o=>{n[gf(o)]={...o}}),n},cot=e=>e.filter(({name:r})=>r!=="ADMIN").reduce((r,o)=>{var l;const i=((l=wZe.find(c=>c.permissions.includes(o.name)))==null?void 0:l.label)||"Other",s=r.find(({label:c})=>c===i);return s?s.permissions.push(o):r.push({label:i,type:"root",permissions:[o]}),r},[]).map(r=>({...r,permissions:[...new Set(r.permissions.sort((o,i)=>o.displayName.localeCompare(i.displayName)))]})).sort(dot),uot=e=>{const t=e.filter(({type:o})=>o===brt),n=e.filter(({type:o})=>o===xrt),r=[];return t.length&&r.push({label:"Project",type:"project",permissions:t}),r.push(...n.reduce((o,i)=>{const s=i.environment,l=o.find(({label:c})=>c===s);return l?l.permissions.push(i):o.push({label:s,type:"environment",permissions:[i]}),o},[])),r.map(o=>({...o,permissions:[...new Set(o.permissions.sort((i,s)=>i.displayName.localeCompare(s.displayName)))]}))},VEt=(e,t)=>[...e,...t.flatMap(({permissions:n})=>n)],dot=({label:e},{label:t})=>e==="Other"&&t!=="Other"?1:e!=="Other"&&t==="Other"?-1:e.localeCompare(t),fot=b("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})),pot=b("p")(({theme:e})=>({color:e.palette.text.primary,marginTop:e.spacing(2),marginBottom:e.spacing(.5)})),hot=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(1)})),got=b("p")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.palette.text.primary,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),mot=b(TJ)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),vot=b("p")(({theme:e})=>({color:e.palette.text.secondary,fontWeight:e.fontWeight.bold})),yot=b("p")(({theme:e})=>({marginTop:e.spacing(.5)})),xot=b("ul")(({theme:e})=>({margin:0,paddingLeft:e.spacing(2)})),bot=({roleId:e,tooltip:t,...n})=>{const{role:r}=EJ(e.toString());if(!r)return null;const{name:o,description:i,permissions:s,type:l}=r,u=jrt.includes(l)?uot(s):cot(s);return a.jsxs(fot,{tooltip:t,...n,children:[a.jsxs(got,{children:[a.jsx(mot,{color:"disabled"}),o]}),a.jsx(yot,{children:i}),a.jsx(W,{condition:!Crt.includes(r.type),show:()=>a.jsxs(a.Fragment,{children:[a.jsx(pot,{children:"Role permissions:"}),a.jsx(hot,{children:u.map(({label:d,permissions:f})=>a.jsxs("div",{children:[a.jsx(vot,{children:d}),a.jsx(xot,{children:f.map(p=>a.jsx("li",{children:p.displayName},p.name))})]},d))})]})})]})},wot=({roleId:e,children:t})=>{const{role:n}=EJ(e.toString());return n?a.jsx(aa,{title:a.jsx(bot,{roleId:e,tooltip:!0}),arrow:!0,children:a.jsx(qt,{color:"success",icon:a.jsx(O_,{}),sx:{cursor:"pointer"},children:n.name})}):t?a.jsx(qt,{color:"success",icon:a.jsx(O_,{}),children:t}):null},Sot=b("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})),Cot=b("div")(()=>({flexGrow:1})),jot=b(Z)(({theme:e})=>({fontSize:e.spacing(3.75)})),Eot=b(f5)(({theme:e})=>({width:e.spacing(9.5),height:e.spacing(9.5),marginRight:e.spacing(3)})),f7=b(Z)(({theme:e})=>({fontSize:e.fontSizes.mainHeader,marginBottom:e.spacing(3)})),Tot=b("div")(({theme:e})=>({display:"flex",flexDirection:"row","& > div > p":{marginBottom:e.spacing(1.5)}})),kot=b(qt)(({theme:e})=>({cursor:"pointer",marginRight:e.spacing(1)})),_ot=b("div")(({theme:e})=>({width:"100%",height:"1px",backgroundColor:e.palette.divider,margin:e.spacing(3,0)})),Rot=b(Ua)(({theme:e})=>({marginTop:e.spacing(1.5),width:e.spacing(30)})),Aot=b(Y0)(({theme:e})=>({backgroundColor:e.palette.background.paper})),Pot=({user:e})=>{const{profile:t}=sK(),n=$t(),{locationSettings:r,setLocationSettings:o}=Mi(),[i,s]=m.useState(),[l,c]=m.useState(["en-US","en-GB","nb-NO","sv-SE","da-DK","en-IN","de","cs","pt-BR","fr-FR"]);m.useEffect(()=>{const d=l.find(f=>f.toLowerCase().includes(r.locale.toLowerCase()));s(d),d||c(f=>[...f,r.locale])},[r]);const u=d=>{const f=d.target.value;s(f),o({locale:f})};return a.jsxs(a.Fragment,{children:[a.jsxs(Sot,{children:[a.jsx(Eot,{user:e}),a.jsxs(Cot,{children:[a.jsx(jot,{children:e.name||e.username}),a.jsx(Z,{variant:"body1",children:e.email})]})]}),a.jsxs(yr,{children:[a.jsx(f7,{children:"Access"}),a.jsxs(Tot,{children:[a.jsx(ne,{sx:{width:"50%"},children:a.jsx(W,{condition:!!(t!=null&&t.rootRole),show:()=>a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"body2",children:"Your root role"}),a.jsx(wot,{roleId:t==null?void 0:t.rootRole.id,children:t==null?void 0:t.rootRole.name})]})})}),a.jsxs(ne,{children:[a.jsx(Z,{variant:"body2",children:"Projects"}),a.jsx(W,{condition:!!(t!=null&&t.projects.length),show:t==null?void 0:t.projects.map(d=>a.jsx(gt,{title:"View project",arrow:!0,placement:"bottom-end",describeChild:!0,children:a.jsx(kot,{onClick:f=>{f.preventDefault(),n(`/projects/${d}`)},color:"secondary",icon:a.jsx(w4,{}),children:d})},d)),elseShow:a.jsx(gt,{title:"You are not assigned to any projects",arrow:!0,describeChild:!0,children:a.jsx(qt,{children:"No projects"})})})]})]}),a.jsx(_ot,{}),a.jsx(f7,{children:"Settings"}),a.jsx(Z,{variant:"body2",children:"This is the format used across the system for time and date"}),a.jsxs(Rot,{variant:"outlined",size:"small",children:[a.jsx(Aot,{htmlFor:"locale-select",children:"Date/Time formatting"}),a.jsx(Z0,{id:"locale-select",value:i||"",native:!0,onChange:u,MenuProps:{style:{zIndex:9999}},children:l.map(d=>a.jsx("option",{value:d,children:d},d))})]})]})]})},Oot=()=>{const{user:e}=ss(),t=Ao(),n=$t(),{config:r,loading:o}=yJ("simple"),{uiConfig:i}=ht(),s=[{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=f=>{n(f.path?`/profile/${f.path}`:"/profile",{replace:!0}),d(f.id)},c=()=>{const f=t.pathname;return(s.find(({path:h})=>h&&f.includes(h))||s[0]).id},[u,d]=m.useState(c());return m.useEffect(()=>{d(c())},[t]),o?null:a.jsxs(hrt,{tabs:s,value:u,onChange:l,children:[a.jsx(W,{condition:u==="profile",show:a.jsx(Pot,{user:e})}),a.jsx(W,{condition:u==="password",show:a.jsx(vrt,{})}),a.jsx(W,{condition:u==="pat",show:a.jsx(Krt,{})})]})},$ot=m.lazy(()=>yd(()=>import("./FeatureViewLazyExport-BOJHJp48.js").then(e=>e.F),[])),Iot=m.lazy(()=>yd(()=>import("./LazyAdminExport-BfaFcAaS.js").then(e=>e.L),[])),Mot=m.lazy(()=>yd(()=>import("./LazyProjectExport-DbkNqnlj.js"),[])),Dot=()=>{const{isEnterprise:e}=ht(),{data:t,error:n,mutate:r}=Ql(e(),{events:[]},Ot("api/admin/logins"),Lot);return m.useMemo(()=>({events:(t==null?void 0:t.events)??[],loading:!n&&!t,refetch:()=>r(),error:n}),[t,n,r])},Lot=e=>fetch(e).then(fn("Login History")).then(t=>t.json()),p7=b(ne)(()=>({display:"flex",justifyContent:"center"})),Not=({row:e,value:t})=>{const{searchQuery:n}=Jl();return t?a.jsx(p7,{children:a.jsx(qt,{color:"success",children:"True"})}):a.jsx(p7,{children:a.jsx(aa,{arrow:!0,title:a.jsx(pi,{search:n,children:e.original.failure_reason}),children:a.jsx(qt,{color:"error",children:"False"})})})},Fot=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=sr({propagateErrors:!0});return{downloadCSV:async()=>{const s=n("api/admin/logins",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await t(s.caller,s.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:r,loading:e}};var j4={},Bot=ze;Object.defineProperty(j4,"__esModule",{value:!0});var kJ=j4.default=void 0,zot=Bot(He()),Hot=a,Uot=(0,zot.default)((0,Hot.jsx)("path",{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}),"Download");kJ=j4.default=Uot;const Vot={id:"created_at",desc:!0},{value:h7,setValue:Wot}=Xl("LoginHistoryTable:v1",Vot),Got={simple:"Password",oidc:"OIDC",saml:"SAML",google:"Google"},qot=()=>{const{events:e,loading:t}=Dot(),{downloadCSV:n}=Fot(),[r,o]=Kf(),[i]=m.useState(()=>({sortBy:[{id:r.get("sort")||h7.id,desc:r.has("order")?r.get("order")==="desc":h7.desc}],hiddenColumns:["failure_reason"],globalFilter:r.get("search")||""})),[s,l]=m.useState(i.globalFilter),c=Qn(Xo.breakpoints.down("sm")),u=Qn(Xo.breakpoints.down("md")),d=m.useMemo(()=>[{Header:"Created",accessor:"created_at",Cell:({value:S})=>a.jsx(x4,{value:S,dateFormat:l1}),maxWidth:150},{Header:"Username",accessor:"username",minWidth:100,Cell:ea,searchable:!0},{Header:"Authentication",accessor:S=>Got[S.auth_type]||S.auth_type,width:150,maxWidth:150,Cell:ea,searchable:!0,filterName:"auth"},{Header:"IP address",accessor:"ip",Cell:ea,searchable:!0},{Header:"Success",accessor:"successful",align:"center",Cell:Not,filterName:"success",filterParsing:S=>S.toString()},{accessor:"failure_reason",Header:"Failure Reason",searchable:!0}],[]),{data:f,getSearchText:p,getSearchContext:h}=xg(d,s,e),{headerGroups:g,rows:v,prepareRow:x,state:{sortBy:y},setHiddenColumns:w}=un.useTable({columns:d,data:f,initialState:i,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:bn}},un.useSortBy,un.useFlexLayout);return hp([{condition:c,columns:["role","seenAt"]},{condition:u,columns:["imageUrl","tokens","createdAt"]}],w,d),m.useEffect(()=>{const S={};S.sort=y[0].id,y[0].desc&&(S.order="desc"),s&&(S.search=s),o(S,{replace:!0}),Wot({id:y[0].id,desc:y[0].desc||!1})},[y,s,o]),a.jsxs(yr,{isLoading:t,header:a.jsx(Bn,{title:`Login history (${v.length})`,actions:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!u,show:a.jsx(No,{initialValue:s,onChange:l,hasFilters:!0,getSearchContext:h})}),a.jsx(W,{condition:v.length>0,show:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!u,show:a.jsx(Bn.Divider,{})}),a.jsx(gt,{title:"Download login history",arrow:!0,children:a.jsx(Ht,{onClick:n,children:a.jsx(kJ,{})})})]})})]}),children:a.jsx(W,{condition:u,show:a.jsx(No,{initialValue:s,onChange:l,hasFilters:!0,getSearchContext:h})})}),children:[a.jsx(ga,{value:p(s),children:a.jsx(vg,{rows:v,headerGroups:g,prepareRow:x})}),a.jsx(W,{condition:v.length===0,show:a.jsx(W,{condition:(s==null?void 0:s.length)>0,show:a.jsxs(eo,{children:["No login events found matching “",s,"”"]}),elseShow:a.jsx(eo,{children:"No login events available."})})})]})},Yot=()=>{const{isEnterprise:e}=ht();return e()?a.jsx("div",{children:a.jsx(i4,{permissions:Qo,children:a.jsx(qot,{})})}):a.jsx(hP,{feature:"login-history",page:!0})},Kot=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{updateFeatureTypeLifetime:async(i,s)=>{const l={lifetimeDays:s},c=`api/admin/feature-types/${i}/lifetime`,u=t(c,{method:"PUT",body:JSON.stringify(l)});await e(u.caller,u.id)},errors:n,loading:r}},Xot=b("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%"})),Jot=b(KV)(({theme:e})=>({height:"80px"})),Qot=b("div")(({theme:e})=>({display:"flex",position:"relative"})),Zot=b("div")(({theme:e})=>({marginTop:e.spacing(4)})),eit=b(We)(({theme:e})=>({height:"150px",width:"150px",position:"absolute",right:100,top:45})),E4=({children:e})=>{const t=$t(),n=()=>{t("/")},r=()=>{t(Ni)};return a.jsxs(Xot,{children:[a.jsxs("div",{children:[a.jsx(Jot,{}),a.jsx(Qot,{children:a.jsx(Z,{variant:"h1",style:{fontSize:"2rem"},children:"Ooops. That's a page we haven't toggled on yet."})}),a.jsxs(Zot,{children:[a.jsx(We,{variant:"contained",color:"primary",onClick:r,children:"Go back"}),a.jsx(eit,{onClick:n,children:"Go home"})]})]}),e]})},tit=b(ne)(({theme:e})=>({display:"flex",justifyContent:"flex-end",marginTop:"auto",gap:e.spacing(2),paddingTop:e.spacing(4)})),nit=b(ne)(()=>({display:"flex",flexDirection:"column",flexGrow:1})),rit=({featureType:e,loading:t})=>{const n=$t(),{uiConfig:r}=ht(),{refetch:o}=c1(),{updateFeatureTypeLifetime:i,loading:s}=Kot(),[l,c]=m.useState((e==null?void 0:e.lifetimeDays)||0),[u,d]=m.useState(!(e!=null&&e.lifetimeDays)),{setToastData:f,setToastApiError:p}=Yt(),h=Sn(),g=S=>{const C=Number.parseInt(Ju(S.target.value),10);c(C),C===0&&d(!0)},v=S=>{d(S.target.checked),l===0&&c((e==null?void 0:e.lifetimeDays)||1)},x=!u&&(Number.isNaN(l)||l<0),y=async S=>{S.preventDefault();try{if(!(e!=null&&e.id))throw new Error("No feature flag type loaded");const C=u?0:l;await i(e.id,C),o(),f({title:"Feature type updated",type:"success"}),n("/feature-toggle-type"),h.trackEvent("feature-type-edit",{props:{featureTypeId:e.id,newLifetime:C}})}catch(C){p(Dt(C))}},w=m.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 '{
412
412
  "lifetimeDays": 7
413
413
  }'`].join(` \\
414
414
  `),[r,e==null?void 0:e.id]);return!t&&!e?a.jsx(E4,{children:a.jsx("div",{"data-testid":"404_NOT_FOUND"})}):a.jsx(Br,{modal:!0,title:t?"Edit flag type":`Edit flag 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 flag types documentation",formatApiCode:w,children:a.jsxs(nit,{component:"form",onSubmit:y,children:[a.jsxs(Z,{sx:S=>({margin:S.spacing(3,0,1),display:"flex",alignItems:"center"}),children:[a.jsx(ne,{component:"label",htmlFor:"feature-flag-lifetime",children:"Expected lifetime"}),a.jsx(ua,{htmlTooltip:!0,tooltip:a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"If your flag exceeds the expected lifetime of its flag type it will be marked as potentially stale."}),a.jsx("br",{}),a.jsx("a",{href:"https://docs.getunleash.io/reference/feature-toggle-types#expected-lifetime",target:"_blank",rel:"noreferrer",children:"Read more in the documentation"})]})})]}),a.jsxs(ne,{component:"label",sx:S=>({display:"flex",alignItems:"center",cursor:"pointer",marginBottom:S.spacing(1),marginRight:"auto"}),htmlFor:"feature-flag-expire",children:[a.jsx(os,{checked:u||l===0,id:"feature-flag-expire",onChange:v,disabled:t}),a.jsx(ne,{children:"doesn't expire"})]}),a.jsx(ar,{autoFocus:!0,disabled:u||t,type:"number",label:"Lifetime in days",id:"feature-flag-lifetime",value:u?"0":`${l}`,onChange:g,error:x}),a.jsxs(tit,{children:[a.jsx(ei,{permission:Qo,variant:"contained",color:"primary",type:"submit",disabled:t||s,children:"Save feature flag type"}),a.jsx(We,{type:"button",color:"primary",onClick:()=>n(Ni),children:"Cancel"})]})]})})},oit=({featureTypes:e,loading:t})=>{const{featureTypeId:n}=l3(),r=e.find(o=>o.id===n);return a.jsx(rit,{featureType:r,loading:t})},iit="/feature-toggle-type",sit=()=>{const{featureTypes:e,loading:t}=c1(),n=$t(),r=m.useMemo(()=>[{accessor:"id",Cell:({value:d})=>{const f=RG(d);return a.jsx(JC,{icon:a.jsx(f,{"data-loading":"true",color:"action"})})},width:50,disableSortBy:!0},{Header:"Name",accessor:"name",width:"90%",Cell:({row:{original:{name:d,description:f}}})=>a.jsx(la,{"data-loading":!0,title:d,subtitle:f}),sortType:"alphanumeric"},{Header:"Lifetime",accessor:"lifetimeDays",Cell:({value:d})=>d?a.jsx(bn,{children:d===1?"1 day":`${d} days`}):a.jsx(bn,{children:"doesn't expire"}),minWidth:150,sortType:"numericZeroLast"},{Header:"Actions",Cell:({row:{original:d}})=>a.jsx(ne,{sx:f=>({padding:f.spacing(.5,0)}),children:a.jsx(Fc,{children:a.jsx(ti,{disabled:!d.id,"data-loading":"true",onClick:()=>n(`/feature-toggle-type/edit/${d.id}`),permission:Qo,tooltipProps:{title:`Edit ${d.name} feature flag type`},children:a.jsx(Oi,{})})})}),disableSortBy:!0}],[n]),o=m.useMemo(()=>t?Array(5).fill({id:"",name:"Loading...",description:"Loading...",lifetimeDays:1}):e,[t,e]),{getTableProps:i,getTableBodyProps:s,headerGroups:l,rows:c,prepareRow:u}=un.useTable({columns:r,data:o,sortTypes:$i,autoResetSortBy:!1,disableSortRemove:!0,initialState:{sortBy:[{id:"lifetimeDays"}]}},un.useSortBy);return a.jsxs(yr,{isLoading:t,header:a.jsx(Bn,{children:a.jsx(Z,{component:"h2",sx:d=>({fontSize:d.fontSizes.mainHeader}),children:"Feature flag types"})}),children:[a.jsxs(sa,{...i(),children:[a.jsx(ia,{headerGroups:l}),a.jsx(ws,{...s(),children:c.map(d=>(u(d),a.jsx(Pi,{hover:!0,...d.getRowProps(),children:d.cells.map(f=>a.jsx(rs,{...f.getCellProps(),children:f.render("Cell")}))})))})]}),a.jsx(u3,{children:a.jsx(lf,{path:"edit/:featureTypeId",element:a.jsx(pp,{label:"Edit feature flag type",onClose:()=>n(iit),open:!0,children:a.jsx(oit,{featureTypes:e,loading:t})})})})]})},ait="/static/edge-mode-CxSIDLbZ.svg",lit="/static/edge-offline-C6xyGCqC.svg",cit="/static/edge-daisy-chaining-CATtRukP.svg",uit=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2)})),dit=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(3)})),fit=b("div")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(1)})),AE=b(Z)(({theme:e})=>({marginTop:e.spacing(1),marginBottom:e.spacing(1)})),pit=b("a")({textDecoration:"none","&:hover":{textDecoration:"underline"}}),PE=b("figure")(({theme:e})=>({display:"flex",marginLeft:0,marginRight:0,marginTop:e.spacing(1.5),marginBottom:e.spacing(3),gap:e.spacing(1),flexDirection:"column"})),OE=b("figcaption")(({theme:e})=>({fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary,textAlign:"center"})),g7={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.
@@ -436,7 +436,7 @@ Unleash Edge offers two important features:
436
436
  * https://www.chartjs.org
437
437
  * (c) 2022 chartjs-adapter-date-fns Contributors
438
438
  * Released under the MIT license
439
- */const But={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};dQ._date.override({_id:"date-fns",formats:function(){return But},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=ot(e):n==="string"&&(typeof t=="string"?e=bG(e,t,new Date,this.options):e=Js(e,this.options)),yg(e)?e.getTime():null},format:function(e,t){return Ul(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return i1(e,t);case"second":return QW(e,t);case"minute":return JW(e,t);case"hour":return XW(e,t);case"day":return Dh(e,t);case"week":return ZW(e,t);case"month":return o1(e,t);case"quarter":return rEe(e,t);case"year":return eG(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return zS(e,t);case"second":return tG(e,t);case"minute":return dEe(e,t);case"hour":return uEe(e,t);case"day":return _S(e,t);case"week":return hEe(e,t);case"month":return V5(e,t);case"quarter":return pEe(e,t);case"year":return gEe(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Bke(e);case"minute":return mEe(e);case"hour":return Uk(e);case"day":return Ih(e);case"week":return Of(e);case"isoWeek":return Of(e,{weekStartsOn:+n});case"month":return nG(e);case"quarter":return vEe(e);case"year":return rG(e);default:return e}},endOf:function(e,t){switch(t){case"second":return wEe(e);case"minute":return xEe(e);case"hour":return yEe(e);case"day":return vb(e);case"week":return oG(e);case"month":return U5(e);case"quarter":return bEe(e);case"year":return Bk(e);default:return e}}});const bd=m.lazy(()=>yd(()=>import("./LineChartComponent-DvXrMkk5.js"),[])),zut=(e,t)=>n=>{const r=n.chart,{ctx:o,chartArea:i}=r;if(!i)return;const s=o.createLinearGradient(0,i.bottom,0,i.top);return s.addColorStop(0,e),s.addColorStop(1,t),s},R1=zut("rgba(129, 122, 254, 0)","rgba(129, 122, 254, 0.12)"),wd=()=>a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"body1",component:"h4",sx:e=>({paddingBottom:e.spacing(1)}),children:"Not enough data"}),a.jsx(Z,{variant:"body2",children:"Two or more weeks of data are needed to show a chart."})]}),Sd=e=>{const{fill:t=!1,type:n="constant"}=e||{},r=It();return m.useMemo(()=>({labels:Array.from({length:15},(o,i)=>i+1).map(o=>new Date(Date.now()-(15-o)*7*24*60*60*1e3)),datasets:n==="double"?[{label:"Total flags",data:[43,66,55,65,62,72,75,73,80,65,62,61,69,70,77],borderColor:r.palette.primary.light,backgroundColor:r.palette.primary.light},{label:"Stale",data:[3,5,4,6,2,7,5,3,8,3,5,11,8,4,3],borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border}]:[{label:"",data:n==="rising"?[3,5,15,17,25,40,47,48,55,65,62,72,75,73,80]:[54,52,53,49,54,50,47,46,51,51,50,51,49,49,51],borderColor:r.palette.primary.light,backgroundColor:t?R1:r.palette.primary.light,fill:t}]}),[r,t])},Hut=({userTrends:e,isLoading:t})=>{const n=Nr("showInactiveUsers"),r=It(),o=!t&&e.length<2,i=Sd({fill:!0,type:"rising"}),s=m.useMemo(()=>({labels:e.map(l=>l.date),datasets:[{label:"Total users",data:e.map(l=>l.total),borderColor:r.palette.primary.light,backgroundColor:R1,pointBackgroundColor:r.palette.primary.main,fill:!0,order:3},...n?[{label:"Active users",data:e.map(l=>l.active),borderColor:r.palette.success.border,backgroundColor:r.palette.success.border,order:2},{label:"Inactive users",data:e.map(l=>l.inactive),borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border,order:1}]:[]]}),[r,e]);return a.jsx(bd,{data:o||t?i:s,cover:o?a.jsx(wd,{}):t})},IQ=()=>{const{projects:e}=_s(),n=It().palette.charts.series,r=m.useMemo(()=>e.sort((i,s)=>new Date(i.createdAt).getTime()-new Date(s.createdAt).getTime()).map(i=>i.id),[e]);return i=>{const s=r.indexOf(i);return n[s%n.length]}},i2=e=>{const t=It(),n=IQ();return m.useMemo(()=>({datasets:Object.entries(e).map(([i,s])=>{const l=n(i);return{label:i,data:s,borderColor:l,backgroundColor:l,fill:!1}})}),[t,e])},Uut=({projectFlagTrends:e,isLoading:t})=>{const n=Sd({type:"constant"}),r=i2(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return a.jsx(bd,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"users",xAxisKey:"date"}},cover:o?a.jsx(wd,{}):t})},Vut=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center"})),Wut=b(ne)(({theme:e})=>({borderRadius:"50%",width:"200px",height:"200px",border:`10px solid ${e.palette.secondary.border}`,display:"flex",alignItems:"center",justifyContent:"center"})),Gut=b(ne)(({theme:e})=>({borderRadius:"50%",width:"180px",height:"180px",backgroundColor:e.palette.secondary.light,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,border:`10px solid ${e.palette.background.paper}`})),qut=b(ne)(({theme:e})=>({marginTop:e.spacing(4),padding:e.spacing(1.5,2),background:e.palette.background.elevation2,borderRadius:`${e.shape.borderRadiusMedium}px`,display:"flex",alignItems:"center"})),Yut=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(.5)})),Kut=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start"})),Xut=b(Z)(({theme:e})=>({marginLeft:"auto",fontSize:e.fontSizes.mainHeader})),Jut=b(gg)(({theme:e})=>({color:e.palette.primary.main,width:"15px",height:"15px",marginRight:e.spacing(.5),fontSize:"15px!important"})),Qut=({count:e,flagsPerUser:t,isLoading:n})=>a.jsxs(a.Fragment,{children:[a.jsx(Vut,{children:a.jsx(Wut,{children:a.jsx(Gut,{children:n?"":e})})}),a.jsx(W,{condition:t!==void 0&&t!=="",show:a.jsxs(qut,{children:[a.jsxs(Kut,{children:[a.jsxs(Yut,{children:[a.jsx(Jut,{children:"award_star"}),a.jsx(Z,{fontWeight:"bold",variant:"body2",color:"primary",children:"Insights"})]}),a.jsx(Z,{variant:"body2",children:"Flags per user"})]}),a.jsx(Xut,{children:t})]})})]}),Zut=({flagTrends:e,isLoading:t})=>{const n=It(),r=!t&&e.length<2,o=Sd({fill:!0,type:"double"}),i=m.useMemo(()=>({labels:e.map(s=>s.date),datasets:[{label:"Total flags",data:e.map(s=>s.total),borderColor:n.palette.primary.light,backgroundColor:n.palette.primary.light},{label:"Stale",data:e.map(s=>s.stale),borderColor:n.palette.warning.border,backgroundColor:n.palette.warning.border}]}),[n,e]);return a.jsx(bd,{data:r||t?o:i,cover:r?a.jsx(wd,{}):t})},edt=({projectFlagTrends:e,isLoading:t})=>{const n=Sd({type:"constant"}),r=i2(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return a.jsx(bd,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"total",xAxisKey:"date"}},cover:o?a.jsx(wd,{}):t})},tdt=({value:e,healthy:t,stale:n,potentiallyStale:r})=>{const{themeMode:o}=kS(),i=o==="dark",s=It();return a.jsxs("svg",{viewBox:"0 0 268 281",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("title",{children:"Health Stats"}),a.jsx("g",{filter:i?void 0:"url(#filter0_d_22043_268578)",children:a.jsx("circle",{cx:"134",cy:"129",r:"97",fill:s.palette.charts.health.mainCircleBackground})}),a.jsx("circle",{cx:"134",cy:"129",r:"121",stroke:s.palette.charts.health.orbit,strokeWidth:"3"}),a.jsx("text",{x:134,y:149,textAnchor:"middle",fontSize:48,fill:s.palette.charts.health.title,fontWeight:700,children:e!==void 0?`${e}%`:"N/A"}),a.jsx("g",{filter:i?void 0:"url(#filter1_d_22043_268578)",children:a.jsx("circle",{cx:"206",cy:"58",r:"50",fill:s.palette.charts.health.circles})}),a.jsx("text",{x:206,y:56,fill:s.palette.charts.health.healthy,fontWeight:700,fontSize:20,textAnchor:"middle",children:t||0}),a.jsx("text",{x:206,y:72,fill:s.palette.charts.health.text,fontSize:13,textAnchor:"middle",children:"Healthy"}),a.jsx("g",{filter:i?void 0:"url(#filter2_d_22043_268578)",children:a.jsx("circle",{cx:"53",cy:"66",r:"41",fill:s.palette.charts.health.circles})}),a.jsx("text",{x:53,y:65,fill:s.palette.charts.health.stale,fontWeight:700,fontSize:20,textAnchor:"middle",children:n||0}),a.jsx("text",{x:53,y:81,fill:s.palette.charts.health.text,fontSize:13,textAnchor:"middle",children:"Stale"}),a.jsx("g",{filter:i?void 0:"url(#filter3_d_22043_268578)",children:a.jsx("circle",{cx:"144",cy:"224",r:"41",fill:s.palette.charts.health.circles})}),a.jsx("text",{x:144,y:216,fill:s.palette.charts.health.potentiallyStale,fontWeight:700,fontSize:20,textAnchor:"middle",children:r||0}),a.jsxs("text",{x:144,y:232,fill:s.palette.charts.health.text,fontSize:13,textAnchor:"middle",children:[a.jsx("tspan",{x:144,dy:"0",children:"Potentially"}),a.jsx("tspan",{x:144,dy:"1.2em",children:"stale"})]}),a.jsx("path",{d:"M99.5 247.275C99.5 251.693 103.082 255.275 107.5 255.275C111.918 255.275 115.5 251.693 115.5 247.275C115.5 242.857 111.918 239.275 107.5 239.275C103.082 239.275 99.5 242.857 99.5 247.275ZM10.8811 92C10.8811 96.4183 14.4629 100 18.8811 100C23.2994 100 26.8811 96.4183 26.8811 92C26.8811 87.5817 23.2994 84 18.8811 84C14.4629 84 10.8811 87.5817 10.8811 92ZM107.827 245.811C54.4151 233.886 14.5 186.258 14.5 129.325H11.5C11.5 187.696 52.4223 236.515 107.173 248.739L107.827 245.811ZM14.5 129.325C14.5 116.458 16.5379 104.07 20.3078 92.4634L17.4545 91.5366C13.5886 103.439 11.5 116.14 11.5 129.325H14.5Z",fill:"url(#paint0_linear_22043_268578)"}),a.jsxs("defs",{children:[a.jsxs("filter",{id:"filter0_d_22043_268578",x:"15",y:"13",width:"238",height:"238",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feMorphology",{radius:"2",operator:"dilate",in:"SourceAlpha",result:"effect1_dropShadow_22043_268578"}),a.jsx("feOffset",{dy:"3"}),a.jsx("feGaussianBlur",{stdDeviation:"10"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.505882 0 0 0 0 0.478431 0 0 0 0 0.996078 0 0 0 0.36 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("filter",{id:"filter1_d_22043_268578",x:"144",y:"0",width:"124",height:"124",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feOffset",{dy:"4"}),a.jsx("feGaussianBlur",{stdDeviation:"6"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("filter",{id:"filter2_d_22043_268578",x:"0",y:"17",width:"106",height:"106",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feOffset",{dy:"4"}),a.jsx("feGaussianBlur",{stdDeviation:"6"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("filter",{id:"filter3_d_22043_268578",x:"91",y:"175",width:"106",height:"106",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feOffset",{dy:"4"}),a.jsx("feGaussianBlur",{stdDeviation:"6"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("linearGradient",{id:"paint0_linear_22043_268578",x1:"64.2447",y1:"87",x2:"64.2447",y2:"249",gradientUnits:"userSpaceOnUse",children:[a.jsx("stop",{stopColor:s.palette.charts.health.gradientStale}),a.jsx("stop",{offset:"1",stopColor:s.palette.charts.health.gradientPotentiallyStale})]})]})]})},ndt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),$N=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),rdt=e=>e==null?"info":e>=75?"success":e>=50?"warning":"error",odt=({stale:e=0,potentiallyStale:t=0,total:n=0})=>a.jsxs(a.Fragment,{children:[a.jsx($_,{sections:[{type:"default",value:100}],size:"small"}),a.jsx($_,{sections:[{type:"error",value:e/n*100},{type:"warning",value:t/n*100}],size:"small"}),a.jsxs(Z,{variant:"body2",component:"p",sx:r=>({marginTop:r.spacing(.5)}),children:[a.jsx(Z,{component:"span",sx:r=>({color:r.palette.error.border}),children:"● "}),"Stale flags: ",e]}),a.jsxs(Z,{variant:"body2",component:"p",children:[a.jsx(Z,{component:"span",sx:r=>({color:r.palette.warning.border}),children:"● "}),"Potentially stale flags: ",t]})]}),idt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(ndt,{elevation:3,children:[a.jsxs($N,{children:[a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label}),a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:"Project health"})]}),a.jsxs($N,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsxs(qt,{color:rdt(r.value.health),children:[r.value.health,"%"]})]})," ",a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsxs(Z,{variant:"body2",component:"p",sx:i=>({marginBottom:i.spacing(.5)}),children:["Total flags: ",r.value.total]}),a.jsx(W,{condition:!!(r.value.stale||r.value.potentiallyStale),show:a.jsx(odt,{...r.value})})]},`${r.title}-${o}`)))||null})},sdt=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=i2(e),o=It(),i=Sd(),s=m.useMemo(()=>({datasets:[{label:"Health",data:Array.from(new Set(r.datasets.flatMap(p=>p.data.map(h=>h.week)))).map(p=>r.datasets.map(h=>h.data.find(g=>g.week===p)).reduce((h,g)=>(g&&(h.total+=g.total,h.stale+=g.stale+g.potentiallyStale),h.date||(h.date=g==null?void 0:g.date),h),{total:0,stale:0,week:p})).sort((p,h)=>p.week>h.week?1:-1).map(p=>({health:p.total?((p.total-p.stale)/p.total*100).toFixed(2):void 0,date:p.date,total:p.total})),borderColor:o.palette.primary.light,backgroundColor:R1,fill:!0,order:3}]}),[r,o]),l=t?s:r,c=m.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?i:l;return a.jsx(bd,{data:u,TooltipComponent:idt,overrideOptions:c?{}:{parsing:{yAxisKey:"health",xAxisKey:"date"},scales:{y:{min:0,max:100,beginAtZero:!0,type:"linear",grid:{color:o.palette.divider,borderColor:o.palette.divider},ticks:{color:o.palette.text.secondary,display:!0,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:o.palette.text.secondary,display:!0,source:"data",maxRotation:90,minRotation:23.5}}}},cover:c?a.jsx(wd,{}):n},t?"aggregate":"project")},Qb=(e,t,n,r)=>({x:e+n*Math.cos(r),y:t+n*Math.sin(r)}),adt=e=>e*(Math.PI/180),ldt=(e,t,n)=>(e-t)/(n-t),IN=(e,t,n)=>{const r=Qb(0,0,e,n),o=Qb(0,0,e,t),i=n-t<=Math.PI?"0":"1";return["M",r.x,r.y,"A",e,e,0,i,0,o.x,o.y].join(" ")},cdt=()=>{const e=It(),t=.875,n=1.14,r=.1,o=.05,i=[230,310];return a.jsx(a.Fragment,{children:i.map(adt).map(s=>{const l=Qb(0,0,t,s),c=Qb(0,0,n,s);return a.jsxs(m.Fragment,{children:[a.jsx("path",{d:`M ${l.x} ${l.y} L ${c.x} ${c.y}`,fill:"none",stroke:e.palette.background.paper,strokeWidth:r,strokeLinecap:"round"}),a.jsx("path",{d:`M ${l.x} ${l.y} L ${c.x} ${c.y}`,fill:"none",stroke:e.palette.charts.gauge.sectionLine,strokeWidth:r-o,strokeLinecap:"round"})]},s)})})},udt=()=>a.jsxs(a.Fragment,{children:[a.jsx("text",{x:0,y:0,transform:"translate(-1.15 -0.5) rotate(-65)",textAnchor:"middle",fontSize:.175,fill:"currentColor",children:"Slow"}),a.jsx("text",{textAnchor:"middle",transform:"translate(0 -1.25)",fontSize:.175,fill:"currentColor",children:"Medium"}),a.jsx("text",{transform:"translate(1.15 -0.5) rotate(65)",textAnchor:"middle",fontSize:.175,fill:"currentColor",children:"Fast"})]}),ddt=({value:e,min:t=0,max:n=100})=>{const r=It(),o=1,i=.25,s=-Math.PI,l=0,c=s+(l-s)*ldt(e||0,t,n),u=IN(o,s,l),d=IN(o,s,c);return a.jsx(ne,{style:{textAlign:"center",fontFamily:"system-ui, sans-serif"},sx:{color:r.palette.charts.gauge.text},children:a.jsxs("svg",{width:"250",height:"150",viewBox:[-1.5,-1.5,3,1.5].join(" "),style:{overflow:"visible"},children:[a.jsx("title",{children:"Gauge chart for time to production"}),a.jsx("defs",{children:a.jsxs("linearGradient",{id:"Gauge__gradient",gradientUnits:"userSpaceOnUse",x1:"-1",x2:"1",y1:"0",y2:"0",gradientTransform:"rotate(-45)",children:[a.jsx("stop",{offset:"0%",stopColor:r.palette.charts.gauge.gradientStart}),a.jsx("stop",{offset:"100%",stopColor:r.palette.charts.gauge.gradientEnd})]})}),a.jsx("path",{d:u,fill:"none",stroke:r.palette.charts.gauge.background,strokeWidth:i-.01,strokeLinecap:"round"}),a.jsx(W,{condition:e!==void 0,show:a.jsx("path",{d,fill:"none",stroke:"url(#Gauge__gradient)",strokeWidth:i,strokeLinecap:"round"})}),a.jsx(cdt,{}),a.jsx(udt,{})]})})},fdt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:e.spacing(1),textAlign:"center"})),pdt=b("div")(({theme:e})=>({marginTop:e.spacing(-7),display:"flex",flexDirection:"column"})),YE=(e,[t,n],[r,o])=>e<t?r:e>n?o:(e-t)/(n-t)*(o-r)+r,hdt=e=>e===void 0||e===0?{value:void 0,gauge:void 0,score:void 0}:e<=7?{value:`${e.toFixed(1)} days`,gauge:YE(e,[1,7],[100,75]),score:"Fast"}:e<=31?{value:`${(e/7).toFixed(1)} weeks`,gauge:YE(e,[7,31],[67.5,30]),score:"Medium"}:{value:`${(e/30).toFixed(1)} months`,gauge:YE(e,[31,365/4],[23,0]),score:"Slow"},gdt=({daysToProduction:e})=>{const{value:t,gauge:n,score:r}=hdt(e);return a.jsxs(fdt,{children:[a.jsx(ddt,{value:n}),a.jsxs(pdt,{children:[a.jsx(Z,{variant:"h2",component:"div",children:e!==void 0?t:"N/A"}),a.jsx(Z,{variant:"body2",sx:o=>({color:r?o.palette.primary.main:o.palette.text.secondary}),children:r||"No data"})]})]})},mdt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),MN=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),vdt=e=>{if(!e)return 0;if(e>11){const t=e/7;return t>6?`${(t/4.34524).toFixed(2)} months`:`${t.toFixed(1)} weeks`}else return`${e.toFixed(2)} days`},ydt=e=>{if(!e)return null;if(e>=30)return a.jsx(qt,{color:"error",children:"Low"});if(e<=30&&e>=8)return a.jsx(qt,{children:"Medium"});if(e<=7)return a.jsx(qt,{color:"success",children:"High"})},xdt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(mdt,{elevation:3,children:[a.jsx(MN,{children:a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})}),a.jsxs(MN,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsx(Z,{variant:"body2",component:"span",sx:{mr:i=>i.spacing(1),pt:.25},children:vdt(r.value.timeToProduction)}),ydt(r.value.timeToProduction)]})]},`${r.title}-${o}`)))||null})};function bdt(e){const t={};e.forEach(r=>{const{date:o,timeToProduction:i}=r;t[o]||(t[o]=[]),i!==void 0&&t[o].push(i)});const n={};return Object.entries(t).forEach(([r,o])=>{const i=o.sort((c,u)=>c-u),s=Math.floor(i.length/2),l=i.length%2===0?(i[s-1]+i[s])/2:i[s];n[r]=l}),n}const wdt=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=It(),o=i2(e),i=m.useMemo(()=>!n&&!o.datasets.some(u=>u.data.length>1),[o,n]),s=m.useMemo(()=>{const u=bdt(Object.values(o.datasets).flatMap(f=>f.data));return{datasets:[{label:"Median time to production",data:Object.entries(u).map(([f,p])=>({date:f,timeToProduction:p})).sort((f,p)=>new Date(f.date).getTime()-new Date(p.date).getTime()),borderColor:r.palette.primary.light,backgroundColor:R1,fill:!0,order:3}]}},[JSON.stringify(o),r]),l=t?s:o,c=Sd();return a.jsx(bd,{data:i||n?c:l,TooltipComponent:xdt,overrideOptions:i?{}:{parsing:{yAxisKey:"timeToProduction",xAxisKey:"date"}},cover:i?a.jsx(wd,{}):n})},Sdt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),Cdt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),KE=({iconChar:e,title:t,color:n})=>a.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[a.jsx(Z,{component:"span",children:e}),a.jsx("strong",{children:t})]}),jdt=({data:e})=>a.jsx(ne,{display:"flex",flexDirection:"row",children:e.map(({key:t,value:n})=>a.jsxs("div",{style:{flex:1,flexDirection:"column"},children:[a.jsx("div",{style:{flex:1,textAlign:"center",marginBottom:"4px"},children:a.jsx(Z,{variant:"body1",component:"p",children:t})}),a.jsx("div",{style:{flex:1,textAlign:"center"},children:n})]},t))}),Edt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(Sdt,{elevation:3,children:[a.jsxs(Cdt,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsx(KE,{iconChar:"▣ ",title:`Total requests: ${(r.value.totalRequests??0).toLocaleString()}`,color:"info"}),a.jsx(KE,{iconChar:"▲ ",title:`Exposed: ${(r.value.totalYes??0).toLocaleString()}`,color:"success"}),a.jsx(KE,{iconChar:"▼ ",title:`Not exposed: ${(r.value.totalNo??0).toLocaleString()}`,color:"error"}),a.jsx(W,{condition:!!r.value.totalApps&&!!r.value.totalEnvironments&&!!r.value.totalFlags,show:a.jsxs(a.Fragment,{children:[a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsx(jdt,{data:[{key:"Flags",value:r.value.totalFlags},{key:"Environments",value:r.value.totalEnvironments},{key:"Apps",value:r.value.totalApps}]})]})})]},`${r.title}-${o}`)))||null})};function Tdt(e){return e.reduce((t,n)=>(t[n.date]||(t[n.date]={totalFlags:0,totalNo:0,totalRequests:0,totalYes:0}),t[n.date].totalFlags+=n.totalFlags,t[n.date].totalNo+=n.totalNo,t[n.date].totalRequests+=n.totalRequests,t[n.date].totalYes+=n.totalYes,t),{})}const kdt=e=>Ul(new Date(e),"yyyy-ww"),_dt=(e,t)=>{const n=It(),r=IQ();return m.useMemo(()=>({datasets:Object.entries(e).map(([s,l])=>{const c=new Map(l.map(f=>[f.date,f])),u=t.map(f=>c.get(f)||{date:f,totalRequests:0,totalNo:0,project:s,totalApps:0,totalYes:0,totalEnvironments:0,totalFlags:0,week:kdt(f)}),d=r(s);return{label:s,data:u,borderColor:d,backgroundColor:d,fill:!1}})}),[n,e,r])},Rdt=({metricsSummaryTrends:e,isAggregate:t,allDatapointsSorted:n,isLoading:r})=>{const o=It(),i=_dt(e,n),s=m.useMemo(()=>!r&&!i.datasets.some(d=>d.data.length>1),[i,r]),l=Sd(),c=m.useMemo(()=>{const d=Tdt(Object.values(i.datasets).flatMap(p=>p.data));return{datasets:[{label:"Total Requests",data:Object.entries(d).map(([p,h])=>({date:p,...h})).sort((p,h)=>new Date(p.date).getTime()-new Date(h.date).getTime()),borderColor:o.palette.primary.light,backgroundColor:R1,fill:!0,order:3}]}},[JSON.stringify(e),o]),u=t?c:i;return a.jsx(bd,{data:s||r?l:u,TooltipComponent:Edt,overrideOptions:s?{}:{parsing:{yAxisKey:"totalRequests",xAxisKey:"date"}},cover:s?a.jsx(wd,{}):r})},Adt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),Pdt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),Odt=({iconChar:e,title:t,color:n})=>a.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[a.jsx(Z,{component:"span",children:e}),a.jsx("strong",{children:t})]}),$dt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(Adt,{elevation:3,children:[a.jsxs(Pdt,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsx(Odt,{iconChar:"● ",title:`Total updates: ${r.value.totalUpdates}`,color:"info"})]},`${r.title}-${o}`)))||null})},Idt=e=>{if(!e.length)return{};const t={};for(const o of e)t[o.date]||(t[o.date]=[]),t[o.date].push(o);const n=Array.from(new Set(e.map(o=>o.environmentType))),r={};return Object.entries(t).forEach(([o,i])=>{const s=n.map(l=>{var u;const c=i.find(d=>d.environmentType===l);if(c)return c;{const d=((u=e.find(f=>f.date===o))==null?void 0:u.week)||"";return{date:o,environmentType:l,totalUpdates:0,week:d}}});r[o]=s}),r},Mdt=()=>{const e=It();return t=>{switch(t){case"production":return e.palette.charts.series[3];case"staging":return e.palette.charts.series[1];case"development":return e.palette.charts.series[0];case"test":return e.palette.charts.series[2];default:return e.palette.charts.series[4]}}},Ddt=({environmentTypeTrends:e,isLoading:t})=>{const n=It(),r=Mdt(),o=!t&&(e==null?void 0:e.length)<2,i=Sd({fill:!0,type:"double"}),s=m.useMemo(()=>{const l=Idt(e),c={};return Object.entries(l).forEach(([d,f])=>{f.forEach(p=>{c[p.environmentType]||(c[p.environmentType]=[]),c[p.environmentType].push(p)})}),{datasets:Object.entries(c).map(([d,f])=>{const p=r(d);return{label:d,data:f,borderColor:p,backgroundColor:p,fill:!1}})}},[n,e]);return a.jsx(bd,{data:o||t?i:s,overrideOptions:o?{}:{parsing:{yAxisKey:"totalUpdates",xAxisKey:"date"}},TooltipComponent:$dt,cover:o?a.jsx(wd,{}):t})},Uo={totalUsers:{title:"Total users",tooltip:"Total number of current users."},usersInProject:{title:"Users in project",tooltip:"Average number of users for selected projects."},avgUsersPerProject:{title:"Users per project on average",tooltip:"Number of users in selected projects."},users:{title:"Users",tooltip:"How the number of users changes over time."},usersPerProject:{title:"Users per project",tooltip:"How the number of users changes over time for the selected projects."},totalFlags:{title:"Total flags",tooltip:"Active flags (not archived) that currently exist across the selected projects."},flags:{title:"Number of flags",tooltip:"How the number of flags has changed over time across all projects."},flagsPerProject:{title:"Flags per project",tooltip:"How the number of flags changes over time for the selected projects."},averageHealth:{title:"Average health",tooltip:"Average health is the current percentage of flags in the selected projects that are not stale or potentially stale."},overallHealth:{title:"Overall Health",tooltip:"How the overall health changes over time across all projects."},healthPerProject:{title:"Health per project",tooltip:"How the overall health changes over time for the selected projects."},medianTimeToProduction:{title:"Median time to production",tooltip:'How long does it currently take on average from when a feature flag was created until it was enabled in a "production" type environment. This is calculated only from feature flags of the type "release" and is the median across the selected projects.'},timeToProduction:{title:"Time to production",tooltip:"How the median time to production changes over time across all projects."},timeToProductionPerProject:{title:"Time to production per project",tooltip:"How the average time to production changes over time for the selected projects."},metrics:{title:"Flag evaluation metrics",tooltip:"Summary of all flag evaluations reported by SDKs across all projects."},metricsPerProject:{title:"Flag evaluation metrics per project",tooltip:"Summary of all flag evaluations reported by SDKs for the selected projects."},updates:{title:"Updates per environment type",tooltip:"Summary of all configuration updates per environment type."}},Ldt=b(ne)(({theme:e})=>({display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gridAutoRows:"auto",gap:e.spacing(2),paddingBottom:e.spacing(2),[e.breakpoints.up("md")]:{gridTemplateColumns:"300px 1fr"}})),$p=b(lu)(({theme:e})=>({[e.breakpoints.down("md")]:{gridColumnStart:"span 2",order:2}})),Ndt=({projects:e,flags:t,users:n,summary:r,userTrends:o,groupedProjectsData:i,flagTrends:s,groupedMetricsData:l,environmentTypeTrends:c,allMetricsDatapoints:u,loading:d})=>{const{isEnterprise:f}=ht(),p=e[0]===Ra.id,h=e.length===1;function g(v,x){const y=v.total/x.total;return Number.isNaN(y)?"N/A":y.toFixed(2)}return a.jsxs(a.Fragment,{children:[a.jsxs(Ldt,{children:[a.jsx(W,{condition:p,show:a.jsx(lu,{...Uo.totalUsers,children:a.jsx(x7,{count:n.total,active:n.active,inactive:n.inactive,isLoading:d})}),elseShow:a.jsx(lu,{...h?Uo.usersInProject:Uo.avgUsersPerProject,children:a.jsx(x7,{count:r.averageUsers,isLoading:d})})}),a.jsx(W,{condition:p,show:a.jsx($p,{...Uo.users,children:a.jsx(Hut,{userTrends:o,isLoading:d})}),elseShow:a.jsx($p,{...Uo.usersPerProject,children:a.jsx(Uut,{projectFlagTrends:i,isLoading:d})})}),a.jsx(lu,{...Uo.totalFlags,children:a.jsx(Qut,{count:p?t.total:r.total,flagsPerUser:p?g(t,n):"",isLoading:d})}),a.jsx(W,{condition:p,show:a.jsx($p,{...Uo.flags,children:a.jsx(Zut,{flagTrends:s,isLoading:d})}),elseShow:a.jsx($p,{...Uo.flagsPerProject,children:a.jsx(edt,{projectFlagTrends:i,isLoading:d})})}),a.jsx(W,{condition:f(),show:a.jsxs(a.Fragment,{children:[a.jsx(lu,{...Uo.averageHealth,children:a.jsx(tdt,{value:r.averageHealth,healthy:r.active,stale:r.stale,potentiallyStale:r.potentiallyStale})}),a.jsx($p,{...p?Uo.overallHealth:Uo.healthPerProject,children:a.jsx(sdt,{projectFlagTrends:i,isAggregate:p,isLoading:d})}),a.jsx(lu,{...Uo.medianTimeToProduction,children:a.jsx(gdt,{daysToProduction:r.medianTimeToProduction})}),a.jsx($p,{...p?Uo.timeToProduction:Uo.timeToProductionPerProject,children:a.jsx(wdt,{projectFlagTrends:i,isAggregate:p,isLoading:d})})]})})]}),a.jsx(W,{condition:f(),show:a.jsxs(a.Fragment,{children:[a.jsx(lu,{...p?Uo.metrics:Uo.metricsPerProject,children:a.jsx(Rdt,{metricsSummaryTrends:l,allDatapointsSorted:u,isAggregate:p,isLoading:d})}),a.jsx(lu,{...Uo.updates,sx:{mt:v=>v.spacing(2)},children:a.jsx(Ddt,{environmentTypeTrends:c,isLoading:d})})]})})]})},Fdt=b(ne,{shouldForwardProp:e=>e!=="scrolled"})(({theme:e,scrolled:t})=>({position:"sticky",top:0,zIndex:e.zIndex.sticky,padding:t?e.spacing(2,0):e.spacing(0,0,2),background:e.palette.background.application,transition:"padding 0.3s ease"})),Bdt=()=>{const[e,t]=m.useState(!1),{insights:n,loading:r,error:o}=Rit(),i={projects:Pa(joe,[Ra.id])},[s,l]=kA("insights",i),c=p=>{l({projects:p})},u=s.projects?s.projects.filter(Boolean):[],d=Git(n,u),f=()=>{!e&&window.scrollY>0?t(!0):e&&window.scrollY===0&&t(!1)};return typeof window<"u"&&window.addEventListener("scroll",f),a.jsxs(a.Fragment,{children:[a.jsx(Fdt,{scrolled:e,children:a.jsx(zit,{actions:a.jsx(_it,{selectedProjects:u,onChange:c,dataTestId:"DASHBOARD_PROJECT_SELECT",limitTags:1,sx:{flex:1,maxWidth:"360px",width:"100%"}})})}),a.jsx(Ndt,{loading:r,projects:u,...d})]})},q_="api/admin/feedback",zdt=Ot(q_),Hdt=(e={})=>{const t=()=>fetch(zdt,{method:"GET"}).then(fn("FeedbackPosted")).then(l=>l.json()),{data:n,error:r}=Pn(q_,t,e),[o,i]=m.useState(!r&&!n),s=()=>{Po(q_)};return m.useEffect(()=>{i(!r&&!n)},[n,r]),{feedback:n||[],error:r,loading:o,refetchFeedback:s}},Udt=()=>{const{feedback:e}=Hdt(),[t,n]=m.useState(""),r=[{Header:"Category",accessor:"category",Cell:({row:{original:d}})=>a.jsx(bn,{children:d.category}),searchable:!0},{Header:"UserType",accessor:"userType",Cell:({row:{original:d}})=>a.jsx(bn,{children:d.userType}),searchable:!0},{Header:"DifficultyScore",accessor:"difficultyScore",Cell:({row:{original:d}})=>a.jsx(bn,{children:d.difficultyScore})},{Header:"Positive",accessor:"positive",minWidth:100,Cell:({row:{original:d}})=>a.jsx(bn,{children:d.positive}),disableSortBy:!0,searchable:!0},{Header:"Areas for improvement",accessor:"areasForImprovement",minWidth:100,Cell:({row:{original:d}})=>a.jsx(bn,{children:d.areasForImprovement}),disableSortBy:!0,searchable:!0},{Header:"Created at",accessor:"createdAt",Cell:Qu}],{data:o,getSearchText:i}=xg(r,t,e),{headerGroups:s,rows:l,prepareRow:c}=un.useTable({columns:r,data:o,initialState:{sortBy:[{id:"createdAt",desc:!0}]},sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:bn}},un.useSortBy,un.useFlexLayout),u=Qn(Xo.breakpoints.down("md"));return a.jsx(yr,{header:a.jsx(Bn,{title:`Feedbacks posted (${l.length})`,actions:a.jsx(a.Fragment,{children:a.jsx(W,{condition:!u,show:a.jsxs(a.Fragment,{children:[a.jsx(No,{initialValue:t,onChange:n}),a.jsx(Bn.Divider,{})]})})}),children:a.jsx(W,{condition:u,show:a.jsx(No,{initialValue:t,onChange:n})})}),children:a.jsx(ga,{value:i(t),children:a.jsx(vg,{rows:l,headerGroups:s,prepareRow:c})})})};var X4={},Vdt=ze;Object.defineProperty(X4,"__esModule",{value:!0});var MQ=X4.default=void 0,Wdt=Vdt(He()),Gdt=a,qdt=(0,Wdt.default)((0,Gdt.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"}),"Link");MQ=X4.default=qdt;const Ydt=e=>{const t=m.useMemo(()=>({sortBy:[{id:"lastSeen",desc:!0}]}),[]),n=m.useMemo(()=>[{Header:"Instances",accessor:"instanceId",Cell:ea,styles:{width:"45%"}},{Header:"SDK",accessor:"sdkVersion",Cell:ea,styles:{width:"20%"}},{Header:"Last seen",accessor:"lastSeen",Cell:x4,styles:{width:"20%"}},{Header:"IP",accessor:"ip",Cell:ea,styles:{width:"15%"}}],[]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d}=un.useTable({columns:n,data:e,initialState:t,sortTypes:$i,autoResetHiddenColumns:!1,disableSortRemove:!0},un.useGlobalFilter,un.useSortBy);return{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d,columns:n}},Kdt=({loading:e,rows:t,getTableProps:n,getTableBodyProps:r,headerGroups:o,prepareRow:i})=>a.jsxs(a.Fragment,{children:[a.jsx(ne,{sx:{overflowX:"auto"},children:a.jsxs(kV,{...n(),children:[a.jsx(ia,{headerGroups:o}),a.jsx(ws,{...r(),children:t.map(s=>(i(s),a.jsx(Pi,{hover:!0,...s.getRowProps(),children:s.cells.map(l=>a.jsx(rs,{...l.getCellProps(),children:l.render("Cell")}))})))})]})}),a.jsx(W,{condition:t.length===0&&!e,show:a.jsx(eo,{children:a.jsx("p",{children:"There's no data for any connected instances to display. Have you configured your clients correctly?"})})})]}),Xdt={environments:[],featureCount:0,projects:[],issues:{missingStrategies:[]}},DQ=(e,t={})=>{const n=Ot(`api/admin/metrics/applications/${e}/overview`),{data:r,error:o}=Pn(n,Jdt,t);return{data:r||Xdt,error:o,loading:!o&&!r}},Jdt=async e=>await(await fetch(e).then(fn("Application overview"))).json(),Qdt=(e,t,n={})=>{const r=Ot(`api/admin/metrics/instances/${e}/environment/${t}`),{data:o,error:i}=Ql(!!t,{instances:[]},r,Zdt,n);return{data:o||{instances:[]},error:i,loading:!i&&!o}},Zdt=async e=>await(await fetch(e).then(fn("Connected instances"))).json(),eft=e=>{const{data:t}=DQ(e),n=t.environments.map(i=>i.name).sort(),[r,o]=Woe("environment",Pa(Ac,n[0]));return m.useEffect(()=>{!r&&n.length>0&&o(n[0])},[JSON.stringify(n)]),{currentEnvironment:r,setCurrentEnvironment:o,environments:n}},tft=()=>{const{trackEvent:e}=Sn();return m.useEffect(()=>{e("sdk-reporting",{props:{eventType:"connected instances opened"}})},[]),()=>{e("sdk-reporting",{props:{eventType:"connected instances environment changed"}})}},nft=()=>{const e=tft(),t=Fr("name"),{currentEnvironment:n,setCurrentEnvironment:r,environments:o}=eft(t),{data:i,loading:s}=Qdt(t,n),l=m.useMemo(()=>{const h=({instanceId:g,sdkVersion:v,clientIp:x,lastSeen:y})=>({instanceId:g,ip:x||"",sdkVersion:v||"",lastSeen:y||""});return n?i.instances.map(h):[]},[JSON.stringify(i),n]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:f,prepareRow:p}=Ydt(l);return a.jsxs(ne,{children:[a.jsxs(ne,{sx:{mb:3},children:[a.jsx(ne,{sx:{mb:2},children:"Select which environment to display data for. Only environments that have received traffic for this application will be shown here."}),a.jsx(W,{condition:!!n,show:a.jsx(Dbe,{color:"primary",value:n,exclusive:!0,onChange:(h,g)=>{g!==null&&(e(),r(g))},children:o.map(h=>a.jsx(_be,{value:h,children:h},h))})})]}),a.jsx(Kdt,{loading:s,headerGroups:d,prepareRow:p,getTableBodyProps:u,getTableProps:c,rows:f})]})},rft=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0}),o="api/admin/metrics/applications";return{storeApplicationMetaData:async(l,c,u)=>{const d={};d[c]=u;const f=`${o}/${l}`,p=t(f,{method:"POST",body:JSON.stringify(d)});return e(p.caller,p.id)},deleteApplication:async l=>{const c=`${o}/${encodeURIComponent(l)}`,u=t(c,{method:"DELETE"});return e(u.caller,u.id)},errors:n,loading:r}},oft=(e,t={})=>{const n=Ot(`api/admin/metrics/applications/${e}`),r=async()=>fetch(n,{method:"GET"}).then(fn("Application")).then(d=>d.json()),o=`api/admin/metrics/applications/${e}`,{data:i,error:s}=Pn(o,r,{...t}),[l,c]=m.useState(!s&&!i),u=()=>{Po(o)};return m.useEffect(()=>{c(!s&&!i)},[i,s]),{application:i||{appName:e,color:"",createdAt:"2022-02-02T21:04:00.268Z",description:"",instances:[],strategies:[],seenToggles:[],url:""},error:s,loading:l,refetchApplication:u,APPLICATION_CACHE_KEY:o}};var J4={},ift=ze;Object.defineProperty(J4,"__esModule",{value:!0});var Q4=J4.default=void 0,sft=ift(He()),aft=a,lft=(0,sft.default)((0,aft.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zm0 5h2v2h-2z"}),"WarningAmberRounded");Q4=J4.default=lft;const cft=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",alignSelf:"stretch",fontSize:e.fontSizes.smallBody})),uft=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(2,3,2,3),alignItems:"center",gap:e.spacing(1.5),alignSelf:"stretch",borderRadius:`${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px 0 0`,border:`1px solid ${e.palette.warning.border}`,background:e.palette.warning.light,color:e.palette.warning.main})),dft=b(ne)(({theme:e})=>({color:e.palette.warning.dark,fontWeight:e.fontWeight.bold})),Z4=b("ul")(({theme:e})=>({padding:e.spacing(0,0,0,2)})),eO=b("li")(({theme:e})=>({fontWeight:e.fontWeight.bold})),fft=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(3),flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(3),borderRadius:` 0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`,border:`1px solid ${e.palette.warning.border}`})),tO=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(2),flexDirection:"column",justifyContent:"center",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(.5),borderRadius:e.spacing(1),border:`1px solid ${e.palette.divider}`})),nO=b(ne)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1.5),alignItems:"center"})),LQ=b(ln)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"underline"})),pft=({features:e})=>{const{hasAccess:t}=m.useContext(Di),n=e.length;return n===0?null:a.jsxs(tO,{children:[a.jsx(ne,{children:`We detected ${n} feature flag${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),a.jsx(Z4,{children:e.map(r=>a.jsxs(nO,{children:[a.jsx(eO,{children:r}),a.jsx(W,{condition:t(qS),show:a.jsx(LQ,{to:`/projects/default/create-toggle?name=${r}`,children:"Create feature flag"},r)})]},r))})]})},hft=({strategies:e})=>{const{hasAccess:t}=m.useContext(Di),n=e.length;return n===0?null:a.jsxs(tO,{children:[a.jsx(ne,{children:`We detected ${n} strategy type${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),a.jsx(Z4,{children:e.map(r=>a.jsxs(nO,{children:[a.jsx(eO,{children:r}),a.jsx(W,{condition:t(Tb),show:a.jsx(LQ,{to:"/strategies/create",children:"Create strategy type"},r)})]},r))})]})},gft=({sdks:e})=>e.length===0?null:a.jsxs(tO,{children:[a.jsx(ne,{children:"We detected the following outdated SDKs"}),a.jsx(Z4,{children:e.map(t=>a.jsx(nO,{children:a.jsx(eO,{children:t})},t))})]}),NQ=e=>{const t=[...new Set(e.environments.flatMap(o=>o.issues.outdatedSdks))],n=[...new Set(e.environments.flatMap(o=>o.issues.missingFeatures))],r=t.length+n.length+e.issues.missingStrategies.length;return{issueCount:r,outdatedSdks:t,missingFeatures:n,applicationMode:r>0?"warning":"success"}},mft=({application:e})=>{const t=NQ(e);if(t.applicationMode==="success")return null;const{issueCount:n,outdatedSdks:r,missingFeatures:o}=t;return a.jsxs(cft,{children:[a.jsxs(uft,{children:[a.jsx(Q4,{}),a.jsxs(dft,{children:["We detected ",n," issue",n!==1?"s":""," in this application"]})]}),a.jsxs(fft,{children:[a.jsx(gft,{sdks:r}),a.jsx(pft,{features:o}),a.jsx(hft,{strategies:e.issues.missingStrategies})]})]})};var FQ={exports:{}};(function(e,t){(function(n,r){e.exports=r(m)})(typeof self<"u"?self:ro,function(n){return function(r){var o={};function i(s){if(o[s])return o[s].exports;var l=o[s]={i:s,l:!1,exports:{}};return r[s].call(l.exports,l,l.exports,i),l.l=!0,l.exports}return i.m=r,i.c=o,i.d=function(s,l,c){i.o(s,l)||Object.defineProperty(s,l,{enumerable:!0,get:c})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,l){if(1&l&&(s=i(s)),8&l||4&l&&typeof s=="object"&&s&&s.__esModule)return s;var c=Object.create(null);if(i.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:s}),2&l&&typeof s!="string")for(var u in s)i.d(c,u,(function(d){return s[d]}).bind(null,u));return c},i.n=function(s){var l=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(l,"a",l),l},i.o=function(s,l){return Object.prototype.hasOwnProperty.call(s,l)},i.p="lib/",i(i.s=5)}([function(r,o){r.exports=n},function(r,o,i){var s=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainerContextProvider=o.ArcherContainerContext=void 0;var l=s(i(0));o.ArcherContainerContext=l.default.createContext(null),o.ArcherContainerContextProvider=o.ArcherContainerContext.Provider},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.encodeId=void 0,o.encodeId=function(s){return encodeURI(s).replace(/%/g,"_")}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.getMarkerId=o.createShapeObj=o.getSourceToTargets=o.getEndShapeFromStyle=void 0;var s=["arrow","circle"];o.getEndShapeFromStyle=function(l){return l.endShape&&Object.keys(l.endShape).filter(function(c){return s.includes(c)})[0]||s[0]},o.getSourceToTargets=function(l){var c=Object.keys(l).map(function(u){return l[u]});return[].concat.apply([],c).sort(function(u,d){return u.order-d.order})},o.createShapeObj=function(l,c){return{arrow:function(){var u;return{arrow:Object.assign(Object.assign({},c==null?void 0:c.arrow),(u=l.endShape)===null||u===void 0?void 0:u.arrow)}},circle:function(){var u;return{circle:Object.assign(Object.assign({},c==null?void 0:c.circle),(u=l.endShape)===null||u===void 0?void 0:u.circle)}}}[(0,o.getEndShapeFromStyle)(l)]()},o.getMarkerId=function(l,c,u){return"".concat(l).concat(c.id).concat(u.id)}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.endShapeDefaultProp=void 0,o.endShapeDefaultProp={arrow:{arrowLength:10,arrowThickness:6},circle:{radius:2,fillColor:"#f00",strokeColor:"#0ff",strokeWidth:1}}},function(r,o,i){var s=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainer=o.ArcherElement=void 0;var l=i(6);Object.defineProperty(o,"ArcherElement",{enumerable:!0,get:function(){return s(l).default}});var c=i(11);Object.defineProperty(o,"ArcherContainer",{enumerable:!0,get:function(){return s(c).default}})},function(r,o,i){var s=this&&this.__createBinding||(Object.create?function(v,x,y,w){w===void 0&&(w=y);var S=Object.getOwnPropertyDescriptor(x,y);S&&("get"in S?x.__esModule:!S.writable&&!S.configurable)||(S={enumerable:!0,get:function(){return x[y]}}),Object.defineProperty(v,w,S)}:function(v,x,y,w){w===void 0&&(w=y),v[w]=x[y]}),l=this&&this.__setModuleDefault||(Object.create?function(v,x){Object.defineProperty(v,"default",{enumerable:!0,value:x})}:function(v,x){v.default=x}),c=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var x={};if(v!=null)for(var y in v)y!=="default"&&Object.prototype.hasOwnProperty.call(v,y)&&s(x,v,y);return l(x,v),x};Object.defineProperty(o,"__esModule",{value:!0});var u=c(i(0)),d=i(7),f=i(1),p=i(2),h=i(8),g=i(10);o.default=function(v){var x=v.id,y=v.relations,w=y===void 0?[]:y,S=v.children,C=(0,u.useMemo)(function(){return(0,p.encodeId)(x)},[x]),E=(0,u.useContext)(f.ArcherContainerContext),j=(0,u.useRef)(),k=(0,u.useCallback)(function(I){var P=(0,g.generateSourceToTarget)(C,I);(0,g.assertContextExists)(E),E.registerTransitions(C,P)},[E,C]),T=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterTransitions(C)},[E,C]),_=(0,u.useCallback)(function(I){I&&((0,g.assertContextExists)(E),E.registerChild(C,I))},[C,E]),A=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterChild(C)},[E,C]);(0,d.useIsomorphicLayoutEffect)(function(){return _(j.current),function(){return A()}},[_,A]),(0,h.useDeepCompareEffect)(function(){return k(w),function(){return T()}},[k,w,T]),u.default.Children.only(S);var M=S;return u.default.cloneElement(M,Object.assign(Object.assign({},M.props),{ref:j}))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.useIsomorphicLayoutEffect=void 0;var s=i(0);o.useIsomorphicLayoutEffect=typeof window<"u"?s.useLayoutEffect:s.useEffect},function(r,o,i){var s=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(o,"__esModule",{value:!0}),o.useDeepCompareEffect=void 0;var l=i(0),c=s(i(9));function u(d){var f=(0,l.useRef)();return(0,c.default)(d,f.current)||(f.current=d),f.current}o.useDeepCompareEffect=function(d,f){(0,l.useEffect)(d,f.map(u))}},function(r,o,i){var s=Array.isArray,l=Object.keys,c=Object.prototype.hasOwnProperty,u=typeof Element<"u";r.exports=function(d,f){try{return function p(h,g){if(h===g)return!0;if(h&&g&&typeof h=="object"&&typeof g=="object"){var v,x,y,w=s(h),S=s(g);if(w&&S){if((x=h.length)!=g.length)return!1;for(v=x;v--!=0;)if(!p(h[v],g[v]))return!1;return!0}if(w!=S)return!1;var C=h instanceof Date,E=g instanceof Date;if(C!=E)return!1;if(C&&E)return h.getTime()==g.getTime();var j=h instanceof RegExp,k=g instanceof RegExp;if(j!=k)return!1;if(j&&k)return h.toString()==g.toString();var T=l(h);if((x=T.length)!==l(g).length)return!1;for(v=x;v--!=0;)if(!c.call(g,T[v]))return!1;if(u&&h instanceof Element&&g instanceof Element)return h===g;for(v=x;v--!=0;)if(!((y=T[v])==="_owner"&&h.$$typeof||p(h[y],g[y])))return!1;return!0}return h!=h&&g!=g}(d,f)}catch(p){if(p.message&&p.message.match(/stack|recursion/i)||p.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",p.name,p.message),!1;throw p}}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.generateSourceToTarget=o.assertContextExists=void 0;var s=i(2);o.assertContextExists=function(l){if(!l)throw new Error("Could not find ArcherContainerContext in <ArcherElement>. Please wrap the component in a <ArcherContainer>.")},o.generateSourceToTarget=function(l,c){return c.map(function(u){var d=u.targetId,f=u.sourceAnchor,p=u.targetAnchor,h=u.label,g=u.className,v=u.style,x=u.order,y=x===void 0?0:x,w=u.domAttributes,S=u.cursor,C=u.hitSlop;return{source:{id:(0,s.encodeId)(l),anchor:f},target:{id:(0,s.encodeId)(d),anchor:p},className:g,label:h,style:v,order:y,domAttributes:w,cursor:S,hitSlop:C}})}},function(r,o,i){function s(j,k,T){return k in j?Object.defineProperty(j,k,{value:T,enumerable:!0,configurable:!0,writable:!0}):j[k]=T,j}function l(j,k){return function(T){if(Array.isArray(T))return T}(j)||function(T,_){var A=T==null?null:typeof Symbol<"u"&&T[Symbol.iterator]||T["@@iterator"];if(A!=null){var M,I,P=[],$=!0,z=!1;try{for(A=A.call(T);!($=(M=A.next()).done)&&(P.push(M.value),!_||P.length!==_);$=!0);}catch(Y){z=!0,I=Y}finally{try{$||A.return==null||A.return()}finally{if(z)throw I}}return P}}(j,k)||function(T,_){if(T){if(typeof T=="string")return c(T,_);var A=Object.prototype.toString.call(T).slice(8,-1);if(A==="Object"&&T.constructor&&(A=T.constructor.name),A==="Map"||A==="Set")return Array.from(T);if(A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return c(T,_)}}(j,k)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
439
+ */const But={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};dQ._date.override({_id:"date-fns",formats:function(){return But},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=ot(e):n==="string"&&(typeof t=="string"?e=bG(e,t,new Date,this.options):e=Js(e,this.options)),yg(e)?e.getTime():null},format:function(e,t){return Ul(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return i1(e,t);case"second":return QW(e,t);case"minute":return JW(e,t);case"hour":return XW(e,t);case"day":return Dh(e,t);case"week":return ZW(e,t);case"month":return o1(e,t);case"quarter":return rEe(e,t);case"year":return eG(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return zS(e,t);case"second":return tG(e,t);case"minute":return dEe(e,t);case"hour":return uEe(e,t);case"day":return _S(e,t);case"week":return hEe(e,t);case"month":return V5(e,t);case"quarter":return pEe(e,t);case"year":return gEe(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Bke(e);case"minute":return mEe(e);case"hour":return Uk(e);case"day":return Ih(e);case"week":return Of(e);case"isoWeek":return Of(e,{weekStartsOn:+n});case"month":return nG(e);case"quarter":return vEe(e);case"year":return rG(e);default:return e}},endOf:function(e,t){switch(t){case"second":return wEe(e);case"minute":return xEe(e);case"hour":return yEe(e);case"day":return vb(e);case"week":return oG(e);case"month":return U5(e);case"quarter":return bEe(e);case"year":return Bk(e);default:return e}}});const bd=m.lazy(()=>yd(()=>import("./LineChartComponent-CLaoKci9.js"),[])),zut=(e,t)=>n=>{const r=n.chart,{ctx:o,chartArea:i}=r;if(!i)return;const s=o.createLinearGradient(0,i.bottom,0,i.top);return s.addColorStop(0,e),s.addColorStop(1,t),s},R1=zut("rgba(129, 122, 254, 0)","rgba(129, 122, 254, 0.12)"),wd=()=>a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"body1",component:"h4",sx:e=>({paddingBottom:e.spacing(1)}),children:"Not enough data"}),a.jsx(Z,{variant:"body2",children:"Two or more weeks of data are needed to show a chart."})]}),Sd=e=>{const{fill:t=!1,type:n="constant"}=e||{},r=It();return m.useMemo(()=>({labels:Array.from({length:15},(o,i)=>i+1).map(o=>new Date(Date.now()-(15-o)*7*24*60*60*1e3)),datasets:n==="double"?[{label:"Total flags",data:[43,66,55,65,62,72,75,73,80,65,62,61,69,70,77],borderColor:r.palette.primary.light,backgroundColor:r.palette.primary.light},{label:"Stale",data:[3,5,4,6,2,7,5,3,8,3,5,11,8,4,3],borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border}]:[{label:"",data:n==="rising"?[3,5,15,17,25,40,47,48,55,65,62,72,75,73,80]:[54,52,53,49,54,50,47,46,51,51,50,51,49,49,51],borderColor:r.palette.primary.light,backgroundColor:t?R1:r.palette.primary.light,fill:t}]}),[r,t])},Hut=({userTrends:e,isLoading:t})=>{const n=Nr("showInactiveUsers"),r=It(),o=!t&&e.length<2,i=Sd({fill:!0,type:"rising"}),s=m.useMemo(()=>({labels:e.map(l=>l.date),datasets:[{label:"Total users",data:e.map(l=>l.total),borderColor:r.palette.primary.light,backgroundColor:R1,pointBackgroundColor:r.palette.primary.main,fill:!0,order:3},...n?[{label:"Active users",data:e.map(l=>l.active),borderColor:r.palette.success.border,backgroundColor:r.palette.success.border,order:2},{label:"Inactive users",data:e.map(l=>l.inactive),borderColor:r.palette.warning.border,backgroundColor:r.palette.warning.border,order:1}]:[]]}),[r,e]);return a.jsx(bd,{data:o||t?i:s,cover:o?a.jsx(wd,{}):t})},IQ=()=>{const{projects:e}=_s(),n=It().palette.charts.series,r=m.useMemo(()=>e.sort((i,s)=>new Date(i.createdAt).getTime()-new Date(s.createdAt).getTime()).map(i=>i.id),[e]);return i=>{const s=r.indexOf(i);return n[s%n.length]}},i2=e=>{const t=It(),n=IQ();return m.useMemo(()=>({datasets:Object.entries(e).map(([i,s])=>{const l=n(i);return{label:i,data:s,borderColor:l,backgroundColor:l,fill:!1}})}),[t,e])},Uut=({projectFlagTrends:e,isLoading:t})=>{const n=Sd({type:"constant"}),r=i2(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return a.jsx(bd,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"users",xAxisKey:"date"}},cover:o?a.jsx(wd,{}):t})},Vut=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center"})),Wut=b(ne)(({theme:e})=>({borderRadius:"50%",width:"200px",height:"200px",border:`10px solid ${e.palette.secondary.border}`,display:"flex",alignItems:"center",justifyContent:"center"})),Gut=b(ne)(({theme:e})=>({borderRadius:"50%",width:"180px",height:"180px",backgroundColor:e.palette.secondary.light,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",fontSize:e.fontSizes.extraLargeHeader,border:`10px solid ${e.palette.background.paper}`})),qut=b(ne)(({theme:e})=>({marginTop:e.spacing(4),padding:e.spacing(1.5,2),background:e.palette.background.elevation2,borderRadius:`${e.shape.borderRadiusMedium}px`,display:"flex",alignItems:"center"})),Yut=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing(.5)})),Kut=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start"})),Xut=b(Z)(({theme:e})=>({marginLeft:"auto",fontSize:e.fontSizes.mainHeader})),Jut=b(gg)(({theme:e})=>({color:e.palette.primary.main,width:"15px",height:"15px",marginRight:e.spacing(.5),fontSize:"15px!important"})),Qut=({count:e,flagsPerUser:t,isLoading:n})=>a.jsxs(a.Fragment,{children:[a.jsx(Vut,{children:a.jsx(Wut,{children:a.jsx(Gut,{children:n?"":e})})}),a.jsx(W,{condition:t!==void 0&&t!=="",show:a.jsxs(qut,{children:[a.jsxs(Kut,{children:[a.jsxs(Yut,{children:[a.jsx(Jut,{children:"award_star"}),a.jsx(Z,{fontWeight:"bold",variant:"body2",color:"primary",children:"Insights"})]}),a.jsx(Z,{variant:"body2",children:"Flags per user"})]}),a.jsx(Xut,{children:t})]})})]}),Zut=({flagTrends:e,isLoading:t})=>{const n=It(),r=!t&&e.length<2,o=Sd({fill:!0,type:"double"}),i=m.useMemo(()=>({labels:e.map(s=>s.date),datasets:[{label:"Total flags",data:e.map(s=>s.total),borderColor:n.palette.primary.light,backgroundColor:n.palette.primary.light},{label:"Stale",data:e.map(s=>s.stale),borderColor:n.palette.warning.border,backgroundColor:n.palette.warning.border}]}),[n,e]);return a.jsx(bd,{data:r||t?o:i,cover:r?a.jsx(wd,{}):t})},edt=({projectFlagTrends:e,isLoading:t})=>{const n=Sd({type:"constant"}),r=i2(e),o=m.useMemo(()=>!t&&!r.datasets.some(i=>i.data.length>1),[r,t]);return a.jsx(bd,{data:o||t?n:r,overrideOptions:{parsing:{yAxisKey:"total",xAxisKey:"date"}},cover:o?a.jsx(wd,{}):t})},tdt=({value:e,healthy:t,stale:n,potentiallyStale:r})=>{const{themeMode:o}=kS(),i=o==="dark",s=It();return a.jsxs("svg",{viewBox:"0 0 268 281",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("title",{children:"Health Stats"}),a.jsx("g",{filter:i?void 0:"url(#filter0_d_22043_268578)",children:a.jsx("circle",{cx:"134",cy:"129",r:"97",fill:s.palette.charts.health.mainCircleBackground})}),a.jsx("circle",{cx:"134",cy:"129",r:"121",stroke:s.palette.charts.health.orbit,strokeWidth:"3"}),a.jsx("text",{x:134,y:149,textAnchor:"middle",fontSize:48,fill:s.palette.charts.health.title,fontWeight:700,children:e!==void 0?`${e}%`:"N/A"}),a.jsx("g",{filter:i?void 0:"url(#filter1_d_22043_268578)",children:a.jsx("circle",{cx:"206",cy:"58",r:"50",fill:s.palette.charts.health.circles})}),a.jsx("text",{x:206,y:56,fill:s.palette.charts.health.healthy,fontWeight:700,fontSize:20,textAnchor:"middle",children:t||0}),a.jsx("text",{x:206,y:72,fill:s.palette.charts.health.text,fontSize:13,textAnchor:"middle",children:"Healthy"}),a.jsx("g",{filter:i?void 0:"url(#filter2_d_22043_268578)",children:a.jsx("circle",{cx:"53",cy:"66",r:"41",fill:s.palette.charts.health.circles})}),a.jsx("text",{x:53,y:65,fill:s.palette.charts.health.stale,fontWeight:700,fontSize:20,textAnchor:"middle",children:n||0}),a.jsx("text",{x:53,y:81,fill:s.palette.charts.health.text,fontSize:13,textAnchor:"middle",children:"Stale"}),a.jsx("g",{filter:i?void 0:"url(#filter3_d_22043_268578)",children:a.jsx("circle",{cx:"144",cy:"224",r:"41",fill:s.palette.charts.health.circles})}),a.jsx("text",{x:144,y:216,fill:s.palette.charts.health.potentiallyStale,fontWeight:700,fontSize:20,textAnchor:"middle",children:r||0}),a.jsxs("text",{x:144,y:232,fill:s.palette.charts.health.text,fontSize:13,textAnchor:"middle",children:[a.jsx("tspan",{x:144,dy:"0",children:"Potentially"}),a.jsx("tspan",{x:144,dy:"1.2em",children:"stale"})]}),a.jsx("path",{d:"M99.5 247.275C99.5 251.693 103.082 255.275 107.5 255.275C111.918 255.275 115.5 251.693 115.5 247.275C115.5 242.857 111.918 239.275 107.5 239.275C103.082 239.275 99.5 242.857 99.5 247.275ZM10.8811 92C10.8811 96.4183 14.4629 100 18.8811 100C23.2994 100 26.8811 96.4183 26.8811 92C26.8811 87.5817 23.2994 84 18.8811 84C14.4629 84 10.8811 87.5817 10.8811 92ZM107.827 245.811C54.4151 233.886 14.5 186.258 14.5 129.325H11.5C11.5 187.696 52.4223 236.515 107.173 248.739L107.827 245.811ZM14.5 129.325C14.5 116.458 16.5379 104.07 20.3078 92.4634L17.4545 91.5366C13.5886 103.439 11.5 116.14 11.5 129.325H14.5Z",fill:"url(#paint0_linear_22043_268578)"}),a.jsxs("defs",{children:[a.jsxs("filter",{id:"filter0_d_22043_268578",x:"15",y:"13",width:"238",height:"238",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feMorphology",{radius:"2",operator:"dilate",in:"SourceAlpha",result:"effect1_dropShadow_22043_268578"}),a.jsx("feOffset",{dy:"3"}),a.jsx("feGaussianBlur",{stdDeviation:"10"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.505882 0 0 0 0 0.478431 0 0 0 0 0.996078 0 0 0 0.36 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("filter",{id:"filter1_d_22043_268578",x:"144",y:"0",width:"124",height:"124",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feOffset",{dy:"4"}),a.jsx("feGaussianBlur",{stdDeviation:"6"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("filter",{id:"filter2_d_22043_268578",x:"0",y:"17",width:"106",height:"106",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feOffset",{dy:"4"}),a.jsx("feGaussianBlur",{stdDeviation:"6"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("filter",{id:"filter3_d_22043_268578",x:"91",y:"175",width:"106",height:"106",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[a.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),a.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),a.jsx("feOffset",{dy:"4"}),a.jsx("feGaussianBlur",{stdDeviation:"6"}),a.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.380392 0 0 0 0 0.356863 0 0 0 0 0.760784 0 0 0 0.16 0"}),a.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_22043_268578"}),a.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_22043_268578",result:"shape"})]}),a.jsxs("linearGradient",{id:"paint0_linear_22043_268578",x1:"64.2447",y1:"87",x2:"64.2447",y2:"249",gradientUnits:"userSpaceOnUse",children:[a.jsx("stop",{stopColor:s.palette.charts.health.gradientStale}),a.jsx("stop",{offset:"1",stopColor:s.palette.charts.health.gradientPotentiallyStale})]})]})]})},ndt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),$N=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),rdt=e=>e==null?"info":e>=75?"success":e>=50?"warning":"error",odt=({stale:e=0,potentiallyStale:t=0,total:n=0})=>a.jsxs(a.Fragment,{children:[a.jsx($_,{sections:[{type:"default",value:100}],size:"small"}),a.jsx($_,{sections:[{type:"error",value:e/n*100},{type:"warning",value:t/n*100}],size:"small"}),a.jsxs(Z,{variant:"body2",component:"p",sx:r=>({marginTop:r.spacing(.5)}),children:[a.jsx(Z,{component:"span",sx:r=>({color:r.palette.error.border}),children:"● "}),"Stale flags: ",e]}),a.jsxs(Z,{variant:"body2",component:"p",children:[a.jsx(Z,{component:"span",sx:r=>({color:r.palette.warning.border}),children:"● "}),"Potentially stale flags: ",t]})]}),idt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(ndt,{elevation:3,children:[a.jsxs($N,{children:[a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label}),a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:"Project health"})]}),a.jsxs($N,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsxs(qt,{color:rdt(r.value.health),children:[r.value.health,"%"]})]})," ",a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsxs(Z,{variant:"body2",component:"p",sx:i=>({marginBottom:i.spacing(.5)}),children:["Total flags: ",r.value.total]}),a.jsx(W,{condition:!!(r.value.stale||r.value.potentiallyStale),show:a.jsx(odt,{...r.value})})]},`${r.title}-${o}`)))||null})},sdt=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=i2(e),o=It(),i=Sd(),s=m.useMemo(()=>({datasets:[{label:"Health",data:Array.from(new Set(r.datasets.flatMap(p=>p.data.map(h=>h.week)))).map(p=>r.datasets.map(h=>h.data.find(g=>g.week===p)).reduce((h,g)=>(g&&(h.total+=g.total,h.stale+=g.stale+g.potentiallyStale),h.date||(h.date=g==null?void 0:g.date),h),{total:0,stale:0,week:p})).sort((p,h)=>p.week>h.week?1:-1).map(p=>({health:p.total?((p.total-p.stale)/p.total*100).toFixed(2):void 0,date:p.date,total:p.total})),borderColor:o.palette.primary.light,backgroundColor:R1,fill:!0,order:3}]}),[r,o]),l=t?s:r,c=m.useMemo(()=>!n&&!r.datasets.some(d=>d.data.length>1),[r,n]),u=c||n?i:l;return a.jsx(bd,{data:u,TooltipComponent:idt,overrideOptions:c?{}:{parsing:{yAxisKey:"health",xAxisKey:"date"},scales:{y:{min:0,max:100,beginAtZero:!0,type:"linear",grid:{color:o.palette.divider,borderColor:o.palette.divider},ticks:{color:o.palette.text.secondary,display:!0,precision:0}},x:{type:"time",time:{unit:"week",tooltipFormat:"PPP"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:o.palette.text.secondary,display:!0,source:"data",maxRotation:90,minRotation:23.5}}}},cover:c?a.jsx(wd,{}):n},t?"aggregate":"project")},Qb=(e,t,n,r)=>({x:e+n*Math.cos(r),y:t+n*Math.sin(r)}),adt=e=>e*(Math.PI/180),ldt=(e,t,n)=>(e-t)/(n-t),IN=(e,t,n)=>{const r=Qb(0,0,e,n),o=Qb(0,0,e,t),i=n-t<=Math.PI?"0":"1";return["M",r.x,r.y,"A",e,e,0,i,0,o.x,o.y].join(" ")},cdt=()=>{const e=It(),t=.875,n=1.14,r=.1,o=.05,i=[230,310];return a.jsx(a.Fragment,{children:i.map(adt).map(s=>{const l=Qb(0,0,t,s),c=Qb(0,0,n,s);return a.jsxs(m.Fragment,{children:[a.jsx("path",{d:`M ${l.x} ${l.y} L ${c.x} ${c.y}`,fill:"none",stroke:e.palette.background.paper,strokeWidth:r,strokeLinecap:"round"}),a.jsx("path",{d:`M ${l.x} ${l.y} L ${c.x} ${c.y}`,fill:"none",stroke:e.palette.charts.gauge.sectionLine,strokeWidth:r-o,strokeLinecap:"round"})]},s)})})},udt=()=>a.jsxs(a.Fragment,{children:[a.jsx("text",{x:0,y:0,transform:"translate(-1.15 -0.5) rotate(-65)",textAnchor:"middle",fontSize:.175,fill:"currentColor",children:"Slow"}),a.jsx("text",{textAnchor:"middle",transform:"translate(0 -1.25)",fontSize:.175,fill:"currentColor",children:"Medium"}),a.jsx("text",{transform:"translate(1.15 -0.5) rotate(65)",textAnchor:"middle",fontSize:.175,fill:"currentColor",children:"Fast"})]}),ddt=({value:e,min:t=0,max:n=100})=>{const r=It(),o=1,i=.25,s=-Math.PI,l=0,c=s+(l-s)*ldt(e||0,t,n),u=IN(o,s,l),d=IN(o,s,c);return a.jsx(ne,{style:{textAlign:"center",fontFamily:"system-ui, sans-serif"},sx:{color:r.palette.charts.gauge.text},children:a.jsxs("svg",{width:"250",height:"150",viewBox:[-1.5,-1.5,3,1.5].join(" "),style:{overflow:"visible"},children:[a.jsx("title",{children:"Gauge chart for time to production"}),a.jsx("defs",{children:a.jsxs("linearGradient",{id:"Gauge__gradient",gradientUnits:"userSpaceOnUse",x1:"-1",x2:"1",y1:"0",y2:"0",gradientTransform:"rotate(-45)",children:[a.jsx("stop",{offset:"0%",stopColor:r.palette.charts.gauge.gradientStart}),a.jsx("stop",{offset:"100%",stopColor:r.palette.charts.gauge.gradientEnd})]})}),a.jsx("path",{d:u,fill:"none",stroke:r.palette.charts.gauge.background,strokeWidth:i-.01,strokeLinecap:"round"}),a.jsx(W,{condition:e!==void 0,show:a.jsx("path",{d,fill:"none",stroke:"url(#Gauge__gradient)",strokeWidth:i,strokeLinecap:"round"})}),a.jsx(cdt,{}),a.jsx(udt,{})]})})},fdt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:e.spacing(1),textAlign:"center"})),pdt=b("div")(({theme:e})=>({marginTop:e.spacing(-7),display:"flex",flexDirection:"column"})),YE=(e,[t,n],[r,o])=>e<t?r:e>n?o:(e-t)/(n-t)*(o-r)+r,hdt=e=>e===void 0||e===0?{value:void 0,gauge:void 0,score:void 0}:e<=7?{value:`${e.toFixed(1)} days`,gauge:YE(e,[1,7],[100,75]),score:"Fast"}:e<=31?{value:`${(e/7).toFixed(1)} weeks`,gauge:YE(e,[7,31],[67.5,30]),score:"Medium"}:{value:`${(e/30).toFixed(1)} months`,gauge:YE(e,[31,365/4],[23,0]),score:"Slow"},gdt=({daysToProduction:e})=>{const{value:t,gauge:n,score:r}=hdt(e);return a.jsxs(fdt,{children:[a.jsx(ddt,{value:n}),a.jsxs(pdt,{children:[a.jsx(Z,{variant:"h2",component:"div",children:e!==void 0?t:"N/A"}),a.jsx(Z,{variant:"body2",sx:o=>({color:r?o.palette.primary.main:o.palette.text.secondary}),children:r||"No data"})]})]})},mdt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),MN=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),vdt=e=>{if(!e)return 0;if(e>11){const t=e/7;return t>6?`${(t/4.34524).toFixed(2)} months`:`${t.toFixed(1)} weeks`}else return`${e.toFixed(2)} days`},ydt=e=>{if(!e)return null;if(e>=30)return a.jsx(qt,{color:"error",children:"Low"});if(e<=30&&e>=8)return a.jsx(qt,{children:"Medium"});if(e<=7)return a.jsx(qt,{color:"success",children:"High"})},xdt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(mdt,{elevation:3,children:[a.jsx(MN,{children:a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})}),a.jsxs(MN,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsx(Z,{variant:"body2",component:"span",sx:{mr:i=>i.spacing(1),pt:.25},children:vdt(r.value.timeToProduction)}),ydt(r.value.timeToProduction)]})]},`${r.title}-${o}`)))||null})};function bdt(e){const t={};e.forEach(r=>{const{date:o,timeToProduction:i}=r;t[o]||(t[o]=[]),i!==void 0&&t[o].push(i)});const n={};return Object.entries(t).forEach(([r,o])=>{const i=o.sort((c,u)=>c-u),s=Math.floor(i.length/2),l=i.length%2===0?(i[s-1]+i[s])/2:i[s];n[r]=l}),n}const wdt=({projectFlagTrends:e,isAggregate:t,isLoading:n})=>{const r=It(),o=i2(e),i=m.useMemo(()=>!n&&!o.datasets.some(u=>u.data.length>1),[o,n]),s=m.useMemo(()=>{const u=bdt(Object.values(o.datasets).flatMap(f=>f.data));return{datasets:[{label:"Median time to production",data:Object.entries(u).map(([f,p])=>({date:f,timeToProduction:p})).sort((f,p)=>new Date(f.date).getTime()-new Date(p.date).getTime()),borderColor:r.palette.primary.light,backgroundColor:R1,fill:!0,order:3}]}},[JSON.stringify(o),r]),l=t?s:o,c=Sd();return a.jsx(bd,{data:i||n?c:l,TooltipComponent:xdt,overrideOptions:i?{}:{parsing:{yAxisKey:"timeToProduction",xAxisKey:"date"}},cover:i?a.jsx(wd,{}):n})},Sdt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),Cdt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),KE=({iconChar:e,title:t,color:n})=>a.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[a.jsx(Z,{component:"span",children:e}),a.jsx("strong",{children:t})]}),jdt=({data:e})=>a.jsx(ne,{display:"flex",flexDirection:"row",children:e.map(({key:t,value:n})=>a.jsxs("div",{style:{flex:1,flexDirection:"column"},children:[a.jsx("div",{style:{flex:1,textAlign:"center",marginBottom:"4px"},children:a.jsx(Z,{variant:"body1",component:"p",children:t})}),a.jsx("div",{style:{flex:1,textAlign:"center"},children:n})]},t))}),Edt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(Sdt,{elevation:3,children:[a.jsxs(Cdt,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsx(KE,{iconChar:"▣ ",title:`Total requests: ${(r.value.totalRequests??0).toLocaleString()}`,color:"info"}),a.jsx(KE,{iconChar:"▲ ",title:`Exposed: ${(r.value.totalYes??0).toLocaleString()}`,color:"success"}),a.jsx(KE,{iconChar:"▼ ",title:`Not exposed: ${(r.value.totalNo??0).toLocaleString()}`,color:"error"}),a.jsx(W,{condition:!!r.value.totalApps&&!!r.value.totalEnvironments&&!!r.value.totalFlags,show:a.jsxs(a.Fragment,{children:[a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsx(jdt,{data:[{key:"Flags",value:r.value.totalFlags},{key:"Environments",value:r.value.totalEnvironments},{key:"Apps",value:r.value.totalApps}]})]})})]},`${r.title}-${o}`)))||null})};function Tdt(e){return e.reduce((t,n)=>(t[n.date]||(t[n.date]={totalFlags:0,totalNo:0,totalRequests:0,totalYes:0}),t[n.date].totalFlags+=n.totalFlags,t[n.date].totalNo+=n.totalNo,t[n.date].totalRequests+=n.totalRequests,t[n.date].totalYes+=n.totalYes,t),{})}const kdt=e=>Ul(new Date(e),"yyyy-ww"),_dt=(e,t)=>{const n=It(),r=IQ();return m.useMemo(()=>({datasets:Object.entries(e).map(([s,l])=>{const c=new Map(l.map(f=>[f.date,f])),u=t.map(f=>c.get(f)||{date:f,totalRequests:0,totalNo:0,project:s,totalApps:0,totalYes:0,totalEnvironments:0,totalFlags:0,week:kdt(f)}),d=r(s);return{label:s,data:u,borderColor:d,backgroundColor:d,fill:!1}})}),[n,e,r])},Rdt=({metricsSummaryTrends:e,isAggregate:t,allDatapointsSorted:n,isLoading:r})=>{const o=It(),i=_dt(e,n),s=m.useMemo(()=>!r&&!i.datasets.some(d=>d.data.length>1),[i,r]),l=Sd(),c=m.useMemo(()=>{const d=Tdt(Object.values(i.datasets).flatMap(p=>p.data));return{datasets:[{label:"Total Requests",data:Object.entries(d).map(([p,h])=>({date:p,...h})).sort((p,h)=>new Date(p.date).getTime()-new Date(h.date).getTime()),borderColor:o.palette.primary.light,backgroundColor:R1,fill:!0,order:3}]}},[JSON.stringify(e),o]),u=t?c:i;return a.jsx(bd,{data:s||r?l:u,TooltipComponent:Edt,overrideOptions:s?{}:{parsing:{yAxisKey:"totalRequests",xAxisKey:"date"}},cover:s?a.jsx(wd,{}):r})},Adt=b(xr)(({theme:e})=>({padding:e.spacing(2)})),Pdt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",gap:e.spacing(2),alignItems:"center"})),Odt=({iconChar:e,title:t,color:n})=>a.jsxs(Z,{variant:"body2",component:"p",sx:{color:r=>r.palette[n].main},children:[a.jsx(Z,{component:"span",children:e}),a.jsx("strong",{children:t})]}),$dt=({tooltip:e})=>{const t=e==null?void 0:e.dataPoints.map(r=>({label:r.label,title:r.dataset.label,color:r.dataset.borderColor,value:r.raw})),n=t==null?void 0:t.slice(0,5);return a.jsx(ne,{sx:r=>({display:"flex",flexDirection:"column",gap:r.spacing(2),width:"300px"}),children:(n==null?void 0:n.map((r,o)=>a.jsxs(Adt,{elevation:3,children:[a.jsxs(Pdt,{children:[a.jsxs(Z,{variant:"body2",component:"span",children:[a.jsx(Z,{sx:{color:r.color},component:"span",children:"● "}),a.jsx("strong",{children:r.title})]}),a.jsx(Z,{variant:"body2",color:"textSecondary",component:"span",children:r.label})]}),a.jsx(vr,{sx:i=>({margin:i.spacing(1.5,0)})}),a.jsx(Odt,{iconChar:"● ",title:`Total updates: ${r.value.totalUpdates}`,color:"info"})]},`${r.title}-${o}`)))||null})},Idt=e=>{if(!e.length)return{};const t={};for(const o of e)t[o.date]||(t[o.date]=[]),t[o.date].push(o);const n=Array.from(new Set(e.map(o=>o.environmentType))),r={};return Object.entries(t).forEach(([o,i])=>{const s=n.map(l=>{var u;const c=i.find(d=>d.environmentType===l);if(c)return c;{const d=((u=e.find(f=>f.date===o))==null?void 0:u.week)||"";return{date:o,environmentType:l,totalUpdates:0,week:d}}});r[o]=s}),r},Mdt=()=>{const e=It();return t=>{switch(t){case"production":return e.palette.charts.series[3];case"staging":return e.palette.charts.series[1];case"development":return e.palette.charts.series[0];case"test":return e.palette.charts.series[2];default:return e.palette.charts.series[4]}}},Ddt=({environmentTypeTrends:e,isLoading:t})=>{const n=It(),r=Mdt(),o=!t&&(e==null?void 0:e.length)<2,i=Sd({fill:!0,type:"double"}),s=m.useMemo(()=>{const l=Idt(e),c={};return Object.entries(l).forEach(([d,f])=>{f.forEach(p=>{c[p.environmentType]||(c[p.environmentType]=[]),c[p.environmentType].push(p)})}),{datasets:Object.entries(c).map(([d,f])=>{const p=r(d);return{label:d,data:f,borderColor:p,backgroundColor:p,fill:!1}})}},[n,e]);return a.jsx(bd,{data:o||t?i:s,overrideOptions:o?{}:{parsing:{yAxisKey:"totalUpdates",xAxisKey:"date"}},TooltipComponent:$dt,cover:o?a.jsx(wd,{}):t})},Uo={totalUsers:{title:"Total users",tooltip:"Total number of current users."},usersInProject:{title:"Users in project",tooltip:"Average number of users for selected projects."},avgUsersPerProject:{title:"Users per project on average",tooltip:"Number of users in selected projects."},users:{title:"Users",tooltip:"How the number of users changes over time."},usersPerProject:{title:"Users per project",tooltip:"How the number of users changes over time for the selected projects."},totalFlags:{title:"Total flags",tooltip:"Active flags (not archived) that currently exist across the selected projects."},flags:{title:"Number of flags",tooltip:"How the number of flags has changed over time across all projects."},flagsPerProject:{title:"Flags per project",tooltip:"How the number of flags changes over time for the selected projects."},averageHealth:{title:"Average health",tooltip:"Average health is the current percentage of flags in the selected projects that are not stale or potentially stale."},overallHealth:{title:"Overall Health",tooltip:"How the overall health changes over time across all projects."},healthPerProject:{title:"Health per project",tooltip:"How the overall health changes over time for the selected projects."},medianTimeToProduction:{title:"Median time to production",tooltip:'How long does it currently take on average from when a feature flag was created until it was enabled in a "production" type environment. This is calculated only from feature flags of the type "release" and is the median across the selected projects.'},timeToProduction:{title:"Time to production",tooltip:"How the median time to production changes over time across all projects."},timeToProductionPerProject:{title:"Time to production per project",tooltip:"How the average time to production changes over time for the selected projects."},metrics:{title:"Flag evaluation metrics",tooltip:"Summary of all flag evaluations reported by SDKs across all projects."},metricsPerProject:{title:"Flag evaluation metrics per project",tooltip:"Summary of all flag evaluations reported by SDKs for the selected projects."},updates:{title:"Updates per environment type",tooltip:"Summary of all configuration updates per environment type."}},Ldt=b(ne)(({theme:e})=>({display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gridAutoRows:"auto",gap:e.spacing(2),paddingBottom:e.spacing(2),[e.breakpoints.up("md")]:{gridTemplateColumns:"300px 1fr"}})),$p=b(lu)(({theme:e})=>({[e.breakpoints.down("md")]:{gridColumnStart:"span 2",order:2}})),Ndt=({projects:e,flags:t,users:n,summary:r,userTrends:o,groupedProjectsData:i,flagTrends:s,groupedMetricsData:l,environmentTypeTrends:c,allMetricsDatapoints:u,loading:d})=>{const{isEnterprise:f}=ht(),p=e[0]===Ra.id,h=e.length===1;function g(v,x){const y=v.total/x.total;return Number.isNaN(y)?"N/A":y.toFixed(2)}return a.jsxs(a.Fragment,{children:[a.jsxs(Ldt,{children:[a.jsx(W,{condition:p,show:a.jsx(lu,{...Uo.totalUsers,children:a.jsx(x7,{count:n.total,active:n.active,inactive:n.inactive,isLoading:d})}),elseShow:a.jsx(lu,{...h?Uo.usersInProject:Uo.avgUsersPerProject,children:a.jsx(x7,{count:r.averageUsers,isLoading:d})})}),a.jsx(W,{condition:p,show:a.jsx($p,{...Uo.users,children:a.jsx(Hut,{userTrends:o,isLoading:d})}),elseShow:a.jsx($p,{...Uo.usersPerProject,children:a.jsx(Uut,{projectFlagTrends:i,isLoading:d})})}),a.jsx(lu,{...Uo.totalFlags,children:a.jsx(Qut,{count:p?t.total:r.total,flagsPerUser:p?g(t,n):"",isLoading:d})}),a.jsx(W,{condition:p,show:a.jsx($p,{...Uo.flags,children:a.jsx(Zut,{flagTrends:s,isLoading:d})}),elseShow:a.jsx($p,{...Uo.flagsPerProject,children:a.jsx(edt,{projectFlagTrends:i,isLoading:d})})}),a.jsx(W,{condition:f(),show:a.jsxs(a.Fragment,{children:[a.jsx(lu,{...Uo.averageHealth,children:a.jsx(tdt,{value:r.averageHealth,healthy:r.active,stale:r.stale,potentiallyStale:r.potentiallyStale})}),a.jsx($p,{...p?Uo.overallHealth:Uo.healthPerProject,children:a.jsx(sdt,{projectFlagTrends:i,isAggregate:p,isLoading:d})}),a.jsx(lu,{...Uo.medianTimeToProduction,children:a.jsx(gdt,{daysToProduction:r.medianTimeToProduction})}),a.jsx($p,{...p?Uo.timeToProduction:Uo.timeToProductionPerProject,children:a.jsx(wdt,{projectFlagTrends:i,isAggregate:p,isLoading:d})})]})})]}),a.jsx(W,{condition:f(),show:a.jsxs(a.Fragment,{children:[a.jsx(lu,{...p?Uo.metrics:Uo.metricsPerProject,children:a.jsx(Rdt,{metricsSummaryTrends:l,allDatapointsSorted:u,isAggregate:p,isLoading:d})}),a.jsx(lu,{...Uo.updates,sx:{mt:v=>v.spacing(2)},children:a.jsx(Ddt,{environmentTypeTrends:c,isLoading:d})})]})})]})},Fdt=b(ne,{shouldForwardProp:e=>e!=="scrolled"})(({theme:e,scrolled:t})=>({position:"sticky",top:0,zIndex:e.zIndex.sticky,padding:t?e.spacing(2,0):e.spacing(0,0,2),background:e.palette.background.application,transition:"padding 0.3s ease"})),Bdt=()=>{const[e,t]=m.useState(!1),{insights:n,loading:r,error:o}=Rit(),i={projects:Pa(joe,[Ra.id])},[s,l]=kA("insights",i),c=p=>{l({projects:p})},u=s.projects?s.projects.filter(Boolean):[],d=Git(n,u),f=()=>{!e&&window.scrollY>0?t(!0):e&&window.scrollY===0&&t(!1)};return typeof window<"u"&&window.addEventListener("scroll",f),a.jsxs(a.Fragment,{children:[a.jsx(Fdt,{scrolled:e,children:a.jsx(zit,{actions:a.jsx(_it,{selectedProjects:u,onChange:c,dataTestId:"DASHBOARD_PROJECT_SELECT",limitTags:1,sx:{flex:1,maxWidth:"360px",width:"100%"}})})}),a.jsx(Ndt,{loading:r,projects:u,...d})]})},q_="api/admin/feedback",zdt=Ot(q_),Hdt=(e={})=>{const t=()=>fetch(zdt,{method:"GET"}).then(fn("FeedbackPosted")).then(l=>l.json()),{data:n,error:r}=Pn(q_,t,e),[o,i]=m.useState(!r&&!n),s=()=>{Po(q_)};return m.useEffect(()=>{i(!r&&!n)},[n,r]),{feedback:n||[],error:r,loading:o,refetchFeedback:s}},Udt=()=>{const{feedback:e}=Hdt(),[t,n]=m.useState(""),r=[{Header:"Category",accessor:"category",Cell:({row:{original:d}})=>a.jsx(bn,{children:d.category}),searchable:!0},{Header:"UserType",accessor:"userType",Cell:({row:{original:d}})=>a.jsx(bn,{children:d.userType}),searchable:!0},{Header:"DifficultyScore",accessor:"difficultyScore",Cell:({row:{original:d}})=>a.jsx(bn,{children:d.difficultyScore})},{Header:"Positive",accessor:"positive",minWidth:100,Cell:({row:{original:d}})=>a.jsx(bn,{children:d.positive}),disableSortBy:!0,searchable:!0},{Header:"Areas for improvement",accessor:"areasForImprovement",minWidth:100,Cell:({row:{original:d}})=>a.jsx(bn,{children:d.areasForImprovement}),disableSortBy:!0,searchable:!0},{Header:"Created at",accessor:"createdAt",Cell:Qu}],{data:o,getSearchText:i}=xg(r,t,e),{headerGroups:s,rows:l,prepareRow:c}=un.useTable({columns:r,data:o,initialState:{sortBy:[{id:"createdAt",desc:!0}]},sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:bn}},un.useSortBy,un.useFlexLayout),u=Qn(Xo.breakpoints.down("md"));return a.jsx(yr,{header:a.jsx(Bn,{title:`Feedbacks posted (${l.length})`,actions:a.jsx(a.Fragment,{children:a.jsx(W,{condition:!u,show:a.jsxs(a.Fragment,{children:[a.jsx(No,{initialValue:t,onChange:n}),a.jsx(Bn.Divider,{})]})})}),children:a.jsx(W,{condition:u,show:a.jsx(No,{initialValue:t,onChange:n})})}),children:a.jsx(ga,{value:i(t),children:a.jsx(vg,{rows:l,headerGroups:s,prepareRow:c})})})};var X4={},Vdt=ze;Object.defineProperty(X4,"__esModule",{value:!0});var MQ=X4.default=void 0,Wdt=Vdt(He()),Gdt=a,qdt=(0,Wdt.default)((0,Gdt.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"}),"Link");MQ=X4.default=qdt;const Ydt=e=>{const t=m.useMemo(()=>({sortBy:[{id:"lastSeen",desc:!0}]}),[]),n=m.useMemo(()=>[{Header:"Instances",accessor:"instanceId",Cell:ea,styles:{width:"45%"}},{Header:"SDK",accessor:"sdkVersion",Cell:ea,styles:{width:"20%"}},{Header:"Last seen",accessor:"lastSeen",Cell:x4,styles:{width:"20%"}},{Header:"IP",accessor:"ip",Cell:ea,styles:{width:"15%"}}],[]),{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d}=un.useTable({columns:n,data:e,initialState:t,sortTypes:$i,autoResetHiddenColumns:!1,disableSortRemove:!0},un.useGlobalFilter,un.useSortBy);return{getTableProps:r,getTableBodyProps:o,headerGroups:i,rows:s,prepareRow:l,state:c,setGlobalFilter:u,setHiddenColumns:d,columns:n}},Kdt=({loading:e,rows:t,getTableProps:n,getTableBodyProps:r,headerGroups:o,prepareRow:i})=>a.jsxs(a.Fragment,{children:[a.jsx(ne,{sx:{overflowX:"auto"},children:a.jsxs(kV,{...n(),children:[a.jsx(ia,{headerGroups:o}),a.jsx(ws,{...r(),children:t.map(s=>(i(s),a.jsx(Pi,{hover:!0,...s.getRowProps(),children:s.cells.map(l=>a.jsx(rs,{...l.getCellProps(),children:l.render("Cell")}))})))})]})}),a.jsx(W,{condition:t.length===0&&!e,show:a.jsx(eo,{children:a.jsx("p",{children:"There's no data for any connected instances to display. Have you configured your clients correctly?"})})})]}),Xdt={environments:[],featureCount:0,projects:[],issues:{missingStrategies:[]}},DQ=(e,t={})=>{const n=Ot(`api/admin/metrics/applications/${e}/overview`),{data:r,error:o}=Pn(n,Jdt,t);return{data:r||Xdt,error:o,loading:!o&&!r}},Jdt=async e=>await(await fetch(e).then(fn("Application overview"))).json(),Qdt=(e,t,n={})=>{const r=Ot(`api/admin/metrics/instances/${e}/environment/${t}`),{data:o,error:i}=Ql(!!t,{instances:[]},r,Zdt,n);return{data:o||{instances:[]},error:i,loading:!i&&!o}},Zdt=async e=>await(await fetch(e).then(fn("Connected instances"))).json(),eft=e=>{const{data:t}=DQ(e),n=t.environments.map(i=>i.name).sort(),[r,o]=Woe("environment",Pa(Ac,n[0]));return m.useEffect(()=>{!r&&n.length>0&&o(n[0])},[JSON.stringify(n)]),{currentEnvironment:r,setCurrentEnvironment:o,environments:n}},tft=()=>{const{trackEvent:e}=Sn();return m.useEffect(()=>{e("sdk-reporting",{props:{eventType:"connected instances opened"}})},[]),()=>{e("sdk-reporting",{props:{eventType:"connected instances environment changed"}})}},nft=()=>{const e=tft(),t=Fr("name"),{currentEnvironment:n,setCurrentEnvironment:r,environments:o}=eft(t),{data:i,loading:s}=Qdt(t,n),l=m.useMemo(()=>{const h=({instanceId:g,sdkVersion:v,clientIp:x,lastSeen:y})=>({instanceId:g,ip:x||"",sdkVersion:v||"",lastSeen:y||""});return n?i.instances.map(h):[]},[JSON.stringify(i),n]),{getTableProps:c,getTableBodyProps:u,headerGroups:d,rows:f,prepareRow:p}=Ydt(l);return a.jsxs(ne,{children:[a.jsxs(ne,{sx:{mb:3},children:[a.jsx(ne,{sx:{mb:2},children:"Select which environment to display data for. Only environments that have received traffic for this application will be shown here."}),a.jsx(W,{condition:!!n,show:a.jsx(Dbe,{color:"primary",value:n,exclusive:!0,onChange:(h,g)=>{g!==null&&(e(),r(g))},children:o.map(h=>a.jsx(_be,{value:h,children:h},h))})})]}),a.jsx(Kdt,{loading:s,headerGroups:d,prepareRow:p,getTableBodyProps:u,getTableProps:c,rows:f})]})},rft=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0}),o="api/admin/metrics/applications";return{storeApplicationMetaData:async(l,c,u)=>{const d={};d[c]=u;const f=`${o}/${l}`,p=t(f,{method:"POST",body:JSON.stringify(d)});return e(p.caller,p.id)},deleteApplication:async l=>{const c=`${o}/${encodeURIComponent(l)}`,u=t(c,{method:"DELETE"});return e(u.caller,u.id)},errors:n,loading:r}},oft=(e,t={})=>{const n=Ot(`api/admin/metrics/applications/${e}`),r=async()=>fetch(n,{method:"GET"}).then(fn("Application")).then(d=>d.json()),o=`api/admin/metrics/applications/${e}`,{data:i,error:s}=Pn(o,r,{...t}),[l,c]=m.useState(!s&&!i),u=()=>{Po(o)};return m.useEffect(()=>{c(!s&&!i)},[i,s]),{application:i||{appName:e,color:"",createdAt:"2022-02-02T21:04:00.268Z",description:"",instances:[],strategies:[],seenToggles:[],url:""},error:s,loading:l,refetchApplication:u,APPLICATION_CACHE_KEY:o}};var J4={},ift=ze;Object.defineProperty(J4,"__esModule",{value:!0});var Q4=J4.default=void 0,sft=ift(He()),aft=a,lft=(0,sft.default)((0,aft.jsx)("path",{d:"M12 5.99 19.53 19H4.47L12 5.99M2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zm0 5h2v2h-2z"}),"WarningAmberRounded");Q4=J4.default=lft;const cft=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",alignSelf:"stretch",fontSize:e.fontSizes.smallBody})),uft=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(2,3,2,3),alignItems:"center",gap:e.spacing(1.5),alignSelf:"stretch",borderRadius:`${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px 0 0`,border:`1px solid ${e.palette.warning.border}`,background:e.palette.warning.light,color:e.palette.warning.main})),dft=b(ne)(({theme:e})=>({color:e.palette.warning.dark,fontWeight:e.fontWeight.bold})),Z4=b("ul")(({theme:e})=>({padding:e.spacing(0,0,0,2)})),eO=b("li")(({theme:e})=>({fontWeight:e.fontWeight.bold})),fft=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(3),flexDirection:"column",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(3),borderRadius:` 0 0 ${e.shape.borderRadiusLarge}px ${e.shape.borderRadiusLarge}px`,border:`1px solid ${e.palette.warning.border}`})),tO=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(2),flexDirection:"column",justifyContent:"center",alignItems:"flex-start",alignSelf:"stretch",gap:e.spacing(.5),borderRadius:e.spacing(1),border:`1px solid ${e.palette.divider}`})),nO=b(ne)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1.5),alignItems:"center"})),LQ=b(ln)(()=>({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"underline"})),pft=({features:e})=>{const{hasAccess:t}=m.useContext(Di),n=e.length;return n===0?null:a.jsxs(tO,{children:[a.jsx(ne,{children:`We detected ${n} feature flag${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),a.jsx(Z4,{children:e.map(r=>a.jsxs(nO,{children:[a.jsx(eO,{children:r}),a.jsx(W,{condition:t(qS),show:a.jsx(LQ,{to:`/projects/default/create-toggle?name=${r}`,children:"Create feature flag"},r)})]},r))})]})},hft=({strategies:e})=>{const{hasAccess:t}=m.useContext(Di),n=e.length;return n===0?null:a.jsxs(tO,{children:[a.jsx(ne,{children:`We detected ${n} strategy type${n!==1?"s":""} defined in the SDK that ${n!==1?"do":"does"} not exist in Unleash`}),a.jsx(Z4,{children:e.map(r=>a.jsxs(nO,{children:[a.jsx(eO,{children:r}),a.jsx(W,{condition:t(Tb),show:a.jsx(LQ,{to:"/strategies/create",children:"Create strategy type"},r)})]},r))})]})},gft=({sdks:e})=>e.length===0?null:a.jsxs(tO,{children:[a.jsx(ne,{children:"We detected the following outdated SDKs"}),a.jsx(Z4,{children:e.map(t=>a.jsx(nO,{children:a.jsx(eO,{children:t})},t))})]}),NQ=e=>{const t=[...new Set(e.environments.flatMap(o=>o.issues.outdatedSdks))],n=[...new Set(e.environments.flatMap(o=>o.issues.missingFeatures))],r=t.length+n.length+e.issues.missingStrategies.length;return{issueCount:r,outdatedSdks:t,missingFeatures:n,applicationMode:r>0?"warning":"success"}},mft=({application:e})=>{const t=NQ(e);if(t.applicationMode==="success")return null;const{issueCount:n,outdatedSdks:r,missingFeatures:o}=t;return a.jsxs(cft,{children:[a.jsxs(uft,{children:[a.jsx(Q4,{}),a.jsxs(dft,{children:["We detected ",n," issue",n!==1?"s":""," in this application"]})]}),a.jsxs(fft,{children:[a.jsx(gft,{sdks:r}),a.jsx(pft,{features:o}),a.jsx(hft,{strategies:e.issues.missingStrategies})]})]})};var FQ={exports:{}};(function(e,t){(function(n,r){e.exports=r(m)})(typeof self<"u"?self:ro,function(n){return function(r){var o={};function i(s){if(o[s])return o[s].exports;var l=o[s]={i:s,l:!1,exports:{}};return r[s].call(l.exports,l,l.exports,i),l.l=!0,l.exports}return i.m=r,i.c=o,i.d=function(s,l,c){i.o(s,l)||Object.defineProperty(s,l,{enumerable:!0,get:c})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,l){if(1&l&&(s=i(s)),8&l||4&l&&typeof s=="object"&&s&&s.__esModule)return s;var c=Object.create(null);if(i.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:s}),2&l&&typeof s!="string")for(var u in s)i.d(c,u,(function(d){return s[d]}).bind(null,u));return c},i.n=function(s){var l=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(l,"a",l),l},i.o=function(s,l){return Object.prototype.hasOwnProperty.call(s,l)},i.p="lib/",i(i.s=5)}([function(r,o){r.exports=n},function(r,o,i){var s=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainerContextProvider=o.ArcherContainerContext=void 0;var l=s(i(0));o.ArcherContainerContext=l.default.createContext(null),o.ArcherContainerContextProvider=o.ArcherContainerContext.Provider},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.encodeId=void 0,o.encodeId=function(s){return encodeURI(s).replace(/%/g,"_")}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.getMarkerId=o.createShapeObj=o.getSourceToTargets=o.getEndShapeFromStyle=void 0;var s=["arrow","circle"];o.getEndShapeFromStyle=function(l){return l.endShape&&Object.keys(l.endShape).filter(function(c){return s.includes(c)})[0]||s[0]},o.getSourceToTargets=function(l){var c=Object.keys(l).map(function(u){return l[u]});return[].concat.apply([],c).sort(function(u,d){return u.order-d.order})},o.createShapeObj=function(l,c){return{arrow:function(){var u;return{arrow:Object.assign(Object.assign({},c==null?void 0:c.arrow),(u=l.endShape)===null||u===void 0?void 0:u.arrow)}},circle:function(){var u;return{circle:Object.assign(Object.assign({},c==null?void 0:c.circle),(u=l.endShape)===null||u===void 0?void 0:u.circle)}}}[(0,o.getEndShapeFromStyle)(l)]()},o.getMarkerId=function(l,c,u){return"".concat(l).concat(c.id).concat(u.id)}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.endShapeDefaultProp=void 0,o.endShapeDefaultProp={arrow:{arrowLength:10,arrowThickness:6},circle:{radius:2,fillColor:"#f00",strokeColor:"#0ff",strokeWidth:1}}},function(r,o,i){var s=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArcherContainer=o.ArcherElement=void 0;var l=i(6);Object.defineProperty(o,"ArcherElement",{enumerable:!0,get:function(){return s(l).default}});var c=i(11);Object.defineProperty(o,"ArcherContainer",{enumerable:!0,get:function(){return s(c).default}})},function(r,o,i){var s=this&&this.__createBinding||(Object.create?function(v,x,y,w){w===void 0&&(w=y);var S=Object.getOwnPropertyDescriptor(x,y);S&&("get"in S?x.__esModule:!S.writable&&!S.configurable)||(S={enumerable:!0,get:function(){return x[y]}}),Object.defineProperty(v,w,S)}:function(v,x,y,w){w===void 0&&(w=y),v[w]=x[y]}),l=this&&this.__setModuleDefault||(Object.create?function(v,x){Object.defineProperty(v,"default",{enumerable:!0,value:x})}:function(v,x){v.default=x}),c=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var x={};if(v!=null)for(var y in v)y!=="default"&&Object.prototype.hasOwnProperty.call(v,y)&&s(x,v,y);return l(x,v),x};Object.defineProperty(o,"__esModule",{value:!0});var u=c(i(0)),d=i(7),f=i(1),p=i(2),h=i(8),g=i(10);o.default=function(v){var x=v.id,y=v.relations,w=y===void 0?[]:y,S=v.children,C=(0,u.useMemo)(function(){return(0,p.encodeId)(x)},[x]),E=(0,u.useContext)(f.ArcherContainerContext),j=(0,u.useRef)(),k=(0,u.useCallback)(function(I){var P=(0,g.generateSourceToTarget)(C,I);(0,g.assertContextExists)(E),E.registerTransitions(C,P)},[E,C]),T=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterTransitions(C)},[E,C]),_=(0,u.useCallback)(function(I){I&&((0,g.assertContextExists)(E),E.registerChild(C,I))},[C,E]),A=(0,u.useCallback)(function(){(0,g.assertContextExists)(E),E.unregisterChild(C)},[E,C]);(0,d.useIsomorphicLayoutEffect)(function(){return _(j.current),function(){return A()}},[_,A]),(0,h.useDeepCompareEffect)(function(){return k(w),function(){return T()}},[k,w,T]),u.default.Children.only(S);var M=S;return u.default.cloneElement(M,Object.assign(Object.assign({},M.props),{ref:j}))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.useIsomorphicLayoutEffect=void 0;var s=i(0);o.useIsomorphicLayoutEffect=typeof window<"u"?s.useLayoutEffect:s.useEffect},function(r,o,i){var s=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(o,"__esModule",{value:!0}),o.useDeepCompareEffect=void 0;var l=i(0),c=s(i(9));function u(d){var f=(0,l.useRef)();return(0,c.default)(d,f.current)||(f.current=d),f.current}o.useDeepCompareEffect=function(d,f){(0,l.useEffect)(d,f.map(u))}},function(r,o,i){var s=Array.isArray,l=Object.keys,c=Object.prototype.hasOwnProperty,u=typeof Element<"u";r.exports=function(d,f){try{return function p(h,g){if(h===g)return!0;if(h&&g&&typeof h=="object"&&typeof g=="object"){var v,x,y,w=s(h),S=s(g);if(w&&S){if((x=h.length)!=g.length)return!1;for(v=x;v--!=0;)if(!p(h[v],g[v]))return!1;return!0}if(w!=S)return!1;var C=h instanceof Date,E=g instanceof Date;if(C!=E)return!1;if(C&&E)return h.getTime()==g.getTime();var j=h instanceof RegExp,k=g instanceof RegExp;if(j!=k)return!1;if(j&&k)return h.toString()==g.toString();var T=l(h);if((x=T.length)!==l(g).length)return!1;for(v=x;v--!=0;)if(!c.call(g,T[v]))return!1;if(u&&h instanceof Element&&g instanceof Element)return h===g;for(v=x;v--!=0;)if(!((y=T[v])==="_owner"&&h.$$typeof||p(h[y],g[y])))return!1;return!0}return h!=h&&g!=g}(d,f)}catch(p){if(p.message&&p.message.match(/stack|recursion/i)||p.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",p.name,p.message),!1;throw p}}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.generateSourceToTarget=o.assertContextExists=void 0;var s=i(2);o.assertContextExists=function(l){if(!l)throw new Error("Could not find ArcherContainerContext in <ArcherElement>. Please wrap the component in a <ArcherContainer>.")},o.generateSourceToTarget=function(l,c){return c.map(function(u){var d=u.targetId,f=u.sourceAnchor,p=u.targetAnchor,h=u.label,g=u.className,v=u.style,x=u.order,y=x===void 0?0:x,w=u.domAttributes,S=u.cursor,C=u.hitSlop;return{source:{id:(0,s.encodeId)(l),anchor:f},target:{id:(0,s.encodeId)(d),anchor:p},className:g,label:h,style:v,order:y,domAttributes:w,cursor:S,hitSlop:C}})}},function(r,o,i){function s(j,k,T){return k in j?Object.defineProperty(j,k,{value:T,enumerable:!0,configurable:!0,writable:!0}):j[k]=T,j}function l(j,k){return function(T){if(Array.isArray(T))return T}(j)||function(T,_){var A=T==null?null:typeof Symbol<"u"&&T[Symbol.iterator]||T["@@iterator"];if(A!=null){var M,I,P=[],$=!0,z=!1;try{for(A=A.call(T);!($=(M=A.next()).done)&&(P.push(M.value),!_||P.length!==_);$=!0);}catch(Y){z=!0,I=Y}finally{try{$||A.return==null||A.return()}finally{if(z)throw I}}return P}}(j,k)||function(T,_){if(T){if(typeof T=="string")return c(T,_);var A=Object.prototype.toString.call(T).slice(8,-1);if(A==="Object"&&T.constructor&&(A=T.constructor.name),A==="Map"||A==="Set")return Array.from(T);if(A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A))return c(T,_)}}(j,k)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
440
440
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function c(j,k){(k==null||k>j.length)&&(k=j.length);for(var T=0,_=new Array(k);T<k;T++)_[T]=j[T];return _}var u=this&&this.__createBinding||(Object.create?function(j,k,T,_){_===void 0&&(_=T);var A=Object.getOwnPropertyDescriptor(k,T);A&&("get"in A?k.__esModule:!A.writable&&!A.configurable)||(A={enumerable:!0,get:function(){return k[T]}}),Object.defineProperty(j,_,A)}:function(j,k,T,_){_===void 0&&(_=T),j[_]=k[T]}),d=this&&this.__setModuleDefault||(Object.create?function(j,k){Object.defineProperty(j,"default",{enumerable:!0,value:k})}:function(j,k){j.default=k}),f=this&&this.__importStar||function(j){if(j&&j.__esModule)return j;var k={};if(j!=null)for(var T in j)T!=="default"&&Object.prototype.hasOwnProperty.call(j,T)&&u(k,j,T);return d(k,j),k},p=this&&this.__importDefault||function(j){return j&&j.__esModule?j:{default:j}};Object.defineProperty(o,"__esModule",{value:!0});var h=f(i(0)),g=p(i(12)),v=i(1),x=i(14),y=i(4),w=i(19),S=i(20),C={position:"absolute",width:"100%",height:"100%",top:0,left:0,pointerEvents:"none"},E=h.default.forwardRef(function(j,k){var T=j.endShape,_=T===void 0?y.endShapeDefaultProp:T,A=j.strokeColor,M=A===void 0?"#f00":A,I=j.strokeWidth,P=I===void 0?2:I,$=j.svgContainerStyle,z=$===void 0?{}:$,Y=j.noCurves,q=j.children,G=j.className,F=j.endMarker,U=j.lineStyle,O=j.offset,L=j.startMarker,te=j.strokeDasharray,re=j.style,ue=l((0,h.useState)({}),2),ve=ue[0],Ce=ue[1],J=l((0,h.useState)({}),2),oe=J[0],ae=J[1],ce=(0,h.useRef)(new g.default(function(){Ee()})).current,he=(0,h.useRef)(null),se=l(h.default.useState(),2)[1],be=(0,h.useRef)("arrow".concat(Math.random().toString().slice(2))).current;(0,h.useImperativeHandle)(k,function(){return{refreshScreen:Ee,arrowMarkerUniquePrefix:be}});var xe,Ee=h.default.useCallback(function(){return se({})},[]),Ge=(0,h.useCallback)(function(mt,qe){ae(function(Te){return Object.assign(Object.assign({},Te),s({},mt,qe))})},[]),we=(0,h.useCallback)(function(mt){ae(function(qe){var Te=Object.assign({},qe);return delete Te[mt],Te})},[]),De=(0,h.useCallback)(function(mt,qe){Ce(function(Te){return Te[mt]===qe?Te:Object.assign(Object.assign({},Te),s({},mt,qe))})},[]),Ne=(0,h.useCallback)(function(mt){Ce(function(qe){var Te=Object.assign({},qe);return delete Te[mt],Te})},[]),it=(0,h.useMemo)(function(){return Object.assign(Object.assign({},C),z)},[z]);xe=typeof q=="function"?q(v.ArcherContainerContext):q,(0,S.useResizeListener)(Ee),(0,S.useObserveElements)(ve,ce);var Pt=(0,h.useMemo)(function(){return{registerTransitions:Ge,unregisterTransitions:we,registerChild:De,unregisterChild:Ne}},[Ge,we,De,Ne]);return h.default.createElement(v.ArcherContainerContextProvider,{value:Pt},h.default.createElement("div",{style:Object.assign(Object.assign({},re),{position:"relative"}),className:G},h.default.createElement("svg",{style:it},h.default.createElement("defs",null,h.default.createElement(w.ArrowMarkers,{endShape:_,sourceToTargetsMap:oe,strokeColor:M,uniqueId:be})),h.default.createElement(x.SvgArrows,{startMarker:L,endMarker:F,endShape:_,strokeColor:M,strokeWidth:P,strokeDasharray:te,noCurves:Y,lineStyle:U,offset:O,parentCurrent:he.current,refs:ve,uniqueId:be,sourceToTargetsMap:oe})),h.default.createElement("div",{style:{height:"100%"},ref:he},xe)))});o.default=E},function(r,o,i){i.r(o),(function(s){var l=function(){if(typeof Map<"u")return Map;function $(z,Y){var q=-1;return z.some(function(G,F){return G[0]===Y&&(q=F,!0)}),q}return function(){function z(){this.__entries__=[]}var Y={size:{configurable:!0}};return Y.size.get=function(){return this.__entries__.length},z.prototype.get=function(q){var G=$(this.__entries__,q),F=this.__entries__[G];return F&&F[1]},z.prototype.set=function(q,G){var F=$(this.__entries__,q);~F?this.__entries__[F][1]=G:this.__entries__.push([q,G])},z.prototype.delete=function(q){var G=this.__entries__,F=$(G,q);~F&&G.splice(F,1)},z.prototype.has=function(q){return!!~$(this.__entries__,q)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(q,G){G===void 0&&(G=null);for(var F=0,U=this.__entries__;F<U.length;F+=1){var O=U[F];q.call(G,O[1],O[0])}},Object.defineProperties(z.prototype,Y),z}()}(),c=typeof window<"u"&&typeof document<"u"&&window.document===document,u=function(){return s!==void 0&&s.Math===Math?s:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),d=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(u):function($){return setTimeout(function(){return $(Date.now())},1e3/60)}}(),f=2,p=["top","right","bottom","left","width","height","size","weight"],h=typeof MutationObserver<"u",g=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function($,z){var Y=!1,q=!1,G=0;function F(){Y&&(Y=!1,$()),q&&O()}function U(){d(F)}function O(){var L=Date.now();if(Y){if(L-G<f)return;q=!0}else Y=!0,q=!1,setTimeout(U,z);G=L}return O}(this.refresh.bind(this),20)};g.prototype.addObserver=function($){~this.observers_.indexOf($)||this.observers_.push($),this.connected_||this.connect_()},g.prototype.removeObserver=function($){var z=this.observers_,Y=z.indexOf($);~Y&&z.splice(Y,1),!z.length&&this.connected_&&this.disconnect_()},g.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},g.prototype.updateObservers_=function(){var $=this.observers_.filter(function(z){return z.gatherActive(),z.hasActive()});return $.forEach(function(z){return z.broadcastActive()}),$.length>0},g.prototype.connect_=function(){c&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),h?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},g.prototype.disconnect_=function(){c&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},g.prototype.onTransitionEnd_=function($){var z=$.propertyName;z===void 0&&(z=""),p.some(function(Y){return!!~z.indexOf(Y)})&&this.refresh()},g.getInstance=function(){return this.instance_||(this.instance_=new g),this.instance_},g.instance_=null;var v=function($,z){for(var Y=0,q=Object.keys(z);Y<q.length;Y+=1){var G=q[Y];Object.defineProperty($,G,{value:z[G],enumerable:!1,writable:!1,configurable:!0})}return $},x=function($){return $&&$.ownerDocument&&$.ownerDocument.defaultView||u},y=k(0,0,0,0);function w($){return parseFloat($)||0}function S($){for(var z=[],Y=arguments.length-1;Y-- >0;)z[Y]=arguments[Y+1];return z.reduce(function(q,G){return q+w($["border-"+G+"-width"])},0)}function C($){var z=$.clientWidth,Y=$.clientHeight;if(!z&&!Y)return y;var q=x($).getComputedStyle($),G=function(ue){for(var ve={},Ce=0,J=["top","right","bottom","left"];Ce<J.length;Ce+=1){var oe=J[Ce],ae=ue["padding-"+oe];ve[oe]=w(ae)}return ve}(q),F=G.left+G.right,U=G.top+G.bottom,O=w(q.width),L=w(q.height);if(q.boxSizing==="border-box"&&(Math.round(O+F)!==z&&(O-=S(q,"left","right")+F),Math.round(L+U)!==Y&&(L-=S(q,"top","bottom")+U)),!function(ue){return ue===x(ue).document.documentElement}($)){var te=Math.round(O+F)-z,re=Math.round(L+U)-Y;Math.abs(te)!==1&&(O-=te),Math.abs(re)!==1&&(L-=re)}return k(G.left,G.top,O,L)}var E=function(){return typeof SVGGraphicsElement<"u"?function($){return $ instanceof x($).SVGGraphicsElement}:function($){return $ instanceof x($).SVGElement&&typeof $.getBBox=="function"}}();function j($){return c?E($)?function(z){var Y=z.getBBox();return k(0,0,Y.width,Y.height)}($):C($):y}function k($,z,Y,q){return{x:$,y:z,width:Y,height:q}}var T=function($){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=k(0,0,0,0),this.target=$};T.prototype.isActive=function(){var $=j(this.target);return this.contentRect_=$,$.width!==this.broadcastWidth||$.height!==this.broadcastHeight},T.prototype.broadcastRect=function(){var $=this.contentRect_;return this.broadcastWidth=$.width,this.broadcastHeight=$.height,$};var _=function($,z){var Y=function(q){var G=q.x,F=q.y,U=q.width,O=q.height,L=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,te=Object.create(L.prototype);return v(te,{x:G,y:F,width:U,height:O,top:F,right:G+U,bottom:O+F,left:G}),te}(z);v(this,{target:$,contentRect:Y})},A=function($,z,Y){if(this.activeObservations_=[],this.observations_=new l,typeof $!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=$,this.controller_=z,this.callbackCtx_=Y};A.prototype.observe=function($){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element<"u"&&Element instanceof Object){if(!($ instanceof x($).Element))throw new TypeError('parameter 1 is not of type "Element".');var z=this.observations_;z.has($)||(z.set($,new T($)),this.controller_.addObserver(this),this.controller_.refresh())}},A.prototype.unobserve=function($){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(typeof Element<"u"&&Element instanceof Object){if(!($ instanceof x($).Element))throw new TypeError('parameter 1 is not of type "Element".');var z=this.observations_;z.has($)&&(z.delete($),z.size||this.controller_.removeObserver(this))}},A.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},A.prototype.gatherActive=function(){var $=this;this.clearActive(),this.observations_.forEach(function(z){z.isActive()&&$.activeObservations_.push(z)})},A.prototype.broadcastActive=function(){if(this.hasActive()){var $=this.callbackCtx_,z=this.activeObservations_.map(function(Y){return new _(Y.target,Y.broadcastRect())});this.callback_.call($,z,$),this.clearActive()}},A.prototype.clearActive=function(){this.activeObservations_.splice(0)},A.prototype.hasActive=function(){return this.activeObservations_.length>0};var M=typeof WeakMap<"u"?new WeakMap:new l,I=function($){if(!(this instanceof I))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var z=g.getInstance(),Y=new A($,z,this);M.set(this,Y)};["observe","unobserve","disconnect"].forEach(function($){I.prototype[$]=function(){return(z=M.get(this))[$].apply(z,arguments);var z}});var P=function(){return u.ResizeObserver!==void 0?u.ResizeObserver:I}();o.default=P}).call(this,i(13))},function(r,o){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch{typeof window=="object"&&(i=window)}r.exports=i},function(r,o,i){var s=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(o,"__esModule",{value:!0}),o.SvgArrows=void 0;var l=s(i(0)),c=i(15),u=s(i(17)),d=i(3),f=function(p){var h,g,v=p.style||{},x=v.startMarker||p.startMarker,y=(g=(h=v.endMarker)!==null&&h!==void 0?h:p.endMarker)===null||g===void 0||g,w=(0,d.createShapeObj)(v,p.endShape),S=p.domAttributes,C=p.cursor,E=p.hitSlop,j=v.strokeColor||p.strokeColor,k=v.strokeWidth||p.strokeWidth,T=v.strokeDasharray||p.strokeDasharray,_=!(!v.noCurves&&!p.noCurves),A=v.lineStyle||p.lineStyle||(_?"angle":"curve"),M=p.offset||0,I=p.source.anchor,P=(0,c.getPointCoordinatesFromAnchorPosition)(p.source.anchor,p.source.id,p.parentCoordinates,p.refs),$=p.target.anchor,z=(0,c.getPointCoordinatesFromAnchorPosition)(p.target.anchor,p.target.id,p.parentCoordinates,p.refs);return P?z?l.default.createElement(u.default,{className:p.className,startingPoint:P,startingAnchorOrientation:I,endingPoint:z,endingAnchorOrientation:$,strokeColor:j,strokeWidth:k,strokeDasharray:T,arrowLabel:p.label,arrowMarkerId:(0,d.getMarkerId)(p.uniqueId,p.source,p.target),lineStyle:A,offset:M,enableStartMarker:!!x,disableEndMarker:!y,endShape:w,domAttributes:S,hitSlop:E,cursor:C}):(console.warn("[React Archer] Could not find target element! Not drawing the arrow."),null):(console.warn("[React Archer] Could not find starting point of element! Not drawing the arrow."),null)};o.SvgArrows=function(p){var h=(0,c.getPointFromElement)(p.parentCurrent);return h?l.default.createElement(l.default.Fragment,null,(0,d.getSourceToTargets)(p.sourceToTargetsMap).map(function(g){return l.default.createElement(f,{key:JSON.stringify({source:g.source,target:g.target}),source:g.source,target:g.target,className:g.className,label:g.label,style:g.style||{},domAttributes:g.domAttributes,hitSlop:g.hitSlop,cursor:g.cursor,startMarker:p.startMarker,endMarker:p.endMarker,endShape:p.endShape,strokeColor:p.strokeColor,strokeWidth:p.strokeWidth,strokeDasharray:p.strokeDasharray,noCurves:p.noCurves,lineStyle:p.lineStyle,offset:p.offset,parentCoordinates:h,refs:p.refs,uniqueId:p.uniqueId})})):null}},function(r,o,i){var s=this&&this.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(o,"__esModule",{value:!0}),o.getPointCoordinatesFromAnchorPosition=o.getPointFromElement=void 0;var l=s(i(16));function c(d){return new l.default(d.left,d.top)}var u=function(d){return d?d.getBoundingClientRect():null};o.getPointFromElement=function(d){var f=u(d);return f?c(f):null},o.getPointCoordinatesFromAnchorPosition=function(d,f,p,h){var g=u(h[f]);if(!g)return null;var v=function(x,y){switch(x){case"top":return c(y).add(new l.default(y.width/2,0));case"bottom":return c(y).add(new l.default(y.width/2,y.height));case"left":return c(y).add(new l.default(0,y.height/2));case"right":return c(y).add(new l.default(y.width,y.height/2));case"middle":return c(y).add(new l.default(y.width/2,y.height/2));default:return console.error("[React Archer] Invalid anchor position was provided. Not drawing the arrow."),null}}(d,g);return v?v.substract(p):null}},function(r,o,i){function s(c,u){for(var d=0;d<u.length;d++){var f=u[d];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(c,f.key,f)}}Object.defineProperty(o,"__esModule",{value:!0});var l=function(){function c(u,d){(function(f,p){if(!(f instanceof p))throw new TypeError("Cannot call a class as a function")})(this,c),this.x=u,this.y=d}return function(u,d,f){d&&s(u.prototype,d),f&&s(u,f),Object.defineProperty(u,"prototype",{writable:!1})}(c,[{key:"add",value:function(u){return new c(this.x+u.x,this.y+u.y)}},{key:"substract",value:function(u){return new c(this.x-u.x,this.y-u.y)}}]),c}();o.default=l},function(r,o,i){var s=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(o,"__esModule",{value:!0}),o.computeLabelDimensions=o.computeEndingAnchorPosition=o.computeStartingAnchorPosition=o.computeArrowPointAccordingToArrowHead=void 0;var l=s(i(0)),c=i(18);function u(h,g,v,x,y,w,S,C){var E=(0,c.computeArrowDirectionVector)(y),j=E.arrowX,k=E.arrowY;if(w==="straight"&&S!==void 0&&C!==void 0){var T=Math.atan2(C-g,S-h);j=Math.cos(T),k=Math.sin(T)}return{xPoint:h+j*v*x/2,yPoint:g+k*v*x/2}}function d(h,g,v,x,y){return y==="top"||y==="bottom"?{xAnchor1:h,yAnchor1:g+(x-g)/2}:y==="left"||y==="right"?{xAnchor1:h+(v-h)/2,yAnchor1:g}:{xAnchor1:h,yAnchor1:g}}function f(h,g,v,x,y){return y==="top"||y==="bottom"?{xAnchor2:v,yAnchor2:x-(x-g)/2}:y==="left"||y==="right"?{xAnchor2:v-(v-h)/2,yAnchor2:x}:{xAnchor2:v,yAnchor2:x}}function p(h,g,v,x){return{xLabel:v>h?h:v,yLabel:x>g?g:x,labelWidth:Math.max(Math.abs(v-h),1),labelHeight:Math.max(Math.abs(x-g),1)}}o.computeArrowPointAccordingToArrowHead=u,o.computeStartingAnchorPosition=d,o.computeEndingAnchorPosition=f,o.computeLabelDimensions=p,o.default=function(h){var g=h.className,v=h.startingPoint,x=h.startingAnchorOrientation,y=h.endingPoint,w=h.endingAnchorOrientation,S=h.strokeColor,C=h.strokeWidth,E=h.strokeDasharray,j=h.arrowLabel,k=h.arrowMarkerId,T=h.lineStyle,_=h.offset,A=h.enableStartMarker,M=h.disableEndMarker,I=h.endShape,P=h.domAttributes,$=h.hitSlop,z=$===void 0?10:$,Y=h.cursor,q=Y===void 0?"pointer":Y,G=I.circle?2*I.circle.radius:2*I.arrow.arrowLength,F=u(v.x,v.y,A?G:0,C,x,T,y.x,y.y),U=F.xPoint,O=F.yPoint,L=u(y.x,y.y,M?0:G,C,w,T,v.x,v.y),te=L.xPoint,re=L.yPoint,ue=d(U,O,te,re,x),ve=ue.xAnchor1,Ce=ue.yAnchor1,J=f(U,O,te,re,w),oe=function(Ee){var Ge=Ee.xStart,we=Ee.yStart,De=Ee.xAnchor1,Ne=Ee.yAnchor1,it=Ee.xAnchor2,Pt=Ee.yAnchor2,mt=Ee.xEnd,qe=Ee.yEnd,Te=Ee.lineStyle,Ue=Ee.offset;if(Ue&&Ue!==0){var pe=Te==="straight"?Math.atan2(qe-we,mt-Ge):Math.atan2(Ne-we,De-Ge),ye=Ue*Math.cos(pe),Se=Ue*Math.sin(pe);Te!=="straight"&&(Ge+=ye,we+=Se),mt-=ye,qe-=Se}var Ye="M".concat(Ge,",").concat(we," ");return["curve","angle"].includes(Te)&&(Ye+="".concat(Te==="curve"?"C":"").concat(De,",").concat(Ne," ").concat(it,",").concat(Pt," ")),Ye+="".concat(mt,",").concat(qe)}({xStart:U,yStart:O,xAnchor1:ve,yAnchor1:Ce,xAnchor2:J.xAnchor2,yAnchor2:J.yAnchor2,xEnd:te,yEnd:re,lineStyle:T,offset:_}),ae=p(U,O,te,re),ce=ae.xLabel,he=ae.yLabel,se=ae.labelWidth,be=ae.labelHeight,xe="url(#".concat(k,")");return l.default.createElement("g",{className:g},l.default.createElement("path",{d:oe,style:{fill:"none",stroke:S,strokeWidth:C,strokeDasharray:E},markerStart:A?xe:void 0,markerEnd:M?void 0:xe}),P&&l.default.createElement("path",Object.assign({d:oe,style:{fill:"none",stroke:"rgba(0, 0, 0, 0)",strokeWidth:z,cursor:P?q:"initial",pointerEvents:"all"}},P)),j&&l.default.createElement("foreignObject",{x:ce,y:he,width:se,height:be,style:{overflow:"visible",pointerEvents:"none"}},l.default.createElement("div",{style:{position:"absolute",left:"50%",top:"50%",transform:"translateX(-50%) translateY(-50%)",pointerEvents:"all"}},l.default.createElement("div",null,j))))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.computeArrowDirectionVector=void 0,o.computeArrowDirectionVector=function(s){switch(s){case"left":return{arrowX:-1,arrowY:0};case"right":return{arrowX:1,arrowY:0};case"top":return{arrowX:0,arrowY:-1};case"bottom":return{arrowX:0,arrowY:1};default:return{arrowX:0,arrowY:0}}}},function(r,o,i){var s=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(o,"__esModule",{value:!0}),o.ArrowMarkers=void 0;var l=s(i(0)),c=i(4),u=i(3),d=function(p,h){return function(){var g,v,x,y,w,S,C,E,j,k,T,_,A=((v=(g=p.endShape)===null||g===void 0?void 0:g.circle)===null||v===void 0?void 0:v.radius)||((x=h.circle)===null||x===void 0?void 0:x.radius)||c.endShapeDefaultProp.circle.radius,M=((w=(y=p.endShape)===null||y===void 0?void 0:y.circle)===null||w===void 0?void 0:w.strokeWidth)||((S=h.circle)===null||S===void 0?void 0:S.strokeWidth)||c.endShapeDefaultProp.circle.strokeWidth,I=((E=(C=p.endShape)===null||C===void 0?void 0:C.circle)===null||E===void 0?void 0:E.strokeColor)||((j=h.circle)===null||j===void 0?void 0:j.strokeColor)||c.endShapeDefaultProp.circle.strokeColor,P=((T=(k=p.endShape)===null||k===void 0?void 0:k.circle)===null||T===void 0?void 0:T.fillColor)||((_=h.circle)===null||_===void 0?void 0:_.fillColor)||c.endShapeDefaultProp.circle.fillColor;return{markerWidth:4*A,markerHeight:4*A,refX:2*A+M,refY:2*A,path:l.default.createElement("circle",{cx:2*A,cy:2*A,r:A,fill:P,stroke:I,strokeWidth:M})}}},f=function(p,h,g){return function(){var v,x,y,w,S,C,E,j,k=p.strokeColor||g,T=(S=(y=(x=(v=p.endShape)===null||v===void 0?void 0:v.arrow)===null||x===void 0?void 0:x.arrowLength)!==null&&y!==void 0?y:(w=h==null?void 0:h.arrow)===null||w===void 0?void 0:w.arrowLength)!==null&&S!==void 0?S:c.endShapeDefaultProp.arrow.arrowLength,_=((E=(C=p.endShape)===null||C===void 0?void 0:C.arrow)===null||E===void 0?void 0:E.arrowThickness)||((j=h==null?void 0:h.arrow)===null||j===void 0?void 0:j.arrowThickness)||c.endShapeDefaultProp.arrow.arrowThickness,A="M0,0 L0,".concat(_," L").concat(T,",").concat(_/2," z");return{markerWidth:T,markerHeight:_,refX:0,refY:_/2,path:l.default.createElement("path",{d:A,fill:k})}}};o.ArrowMarkers=function(p){var h=p.sourceToTargetsMap,g=p.endShape,v=p.strokeColor,x=p.uniqueId;return l.default.createElement(l.default.Fragment,null,(0,u.getSourceToTargets)(h).map(function(y){var w=y.source,S=y.target,C=y.style,E=function(M){var I=M.style,P=M.strokeColor,$=M.endShape,z=(0,u.getEndShapeFromStyle)(I);return{circle:d(I,$),arrow:f(I,$,P)}[z]()}({style:C===void 0?{}:C,endShape:g,strokeColor:v}),j=E.markerHeight,k=E.markerWidth,T=E.path,_=E.refX,A=E.refY;return l.default.createElement("marker",{id:(0,u.getMarkerId)(x,w,S),key:(0,u.getMarkerId)(x,w,S),markerWidth:k,markerHeight:j,refX:_,refY:A,orient:"auto-start-reverse",markerUnits:"strokeWidth"},T)}))}},function(r,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.useResizeListener=o.useObserveElements=void 0;var s=i(0);o.useObserveElements=function(l,c){(0,s.useEffect)(function(){return Object.keys(l).map(function(u){c.observe(l[u])}),function(){Object.keys(l).map(function(u){c.unobserve(l[u])})}},[l,c])},o.useResizeListener=function(l){(0,s.useEffect)(function(){return window&&window.addEventListener("resize",l),function(){window&&window.removeEventListener("resize",l)}},[l])}}])})})(FQ);var XE=FQ.exports,rO={},vft=ze;Object.defineProperty(rO,"__esModule",{value:!0});var s2=rO.default=void 0,yft=vft(He()),xft=a,bft=(0,yft.default)((0,xft.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckCircle");s2=rO.default=bft;var oO={},wft=ze;Object.defineProperty(oO,"__esModule",{value:!0});var BQ=oO.default=void 0,Sft=wft(He()),Cft=a,jft=(0,Sft.default)((0,Cft.jsx)("path",{d:"M14.4 6 14 4H5v17h2v-7h5.6l.4 2h7V6z"}),"Flag");BQ=oO.default=jft;const Eft=b("table")(({theme:e})=>({fontSize:e.fontSizes.smallerBody,marginTop:e.spacing(1)})),Ip=b("td")(({theme:e})=>({verticalAlign:"top",paddingLeft:0,paddingRight:e.spacing(1)})),Tft=b(ne)(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),kft=b(ne)(({theme:e,mode:t})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette[t].border,backgroundColor:e.palette[t].light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5,3,2,3)})),_ft=b(ne)(({theme:e,mode:t})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette[t==="success"?"secondary":"warning"].border,backgroundColor:e.palette[t==="success"?"secondary":"warning"].light,display:"inline-block",padding:e.spacing(1.5,1.5,1.5,1.5),zIndex:1,opacity:.9})),Rft=b(vr)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),Aft=b(ne)({display:"flex",justifyContent:"center",flexWrap:"wrap",gap:"60px 20px"}),Pft=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,fontWeight:e.fontWeight.bold})),zQ=b(Z)(({theme:e,mode:t})=>({gap:e.spacing(1),fontSize:e.fontSizes.smallBody,color:e.palette[t].dark,display:"flex",alignItems:"center"})),Oft=b(ne)(({theme:e})=>({display:"flex",gap:e.spacing(3),color:e.palette.secondary.main,paddingTop:e.spacing(2)})),DN=b(ne)(({theme:e})=>({display:"flex",gap:e.spacing(.5)})),LN=b(ne)(({theme:e})=>({color:e.palette.text.primary,display:"flex",alignItems:"center"})),$ft=()=>{const e=m.useRef(null),[t,n]=m.useState("100%");return m.useLayoutEffect(()=>{var r;n(`${(r=e.current)==null?void 0:r.scrollWidth}px`)},[e,n]),{elementRef:e,width:t}},Ift=()=>a.jsxs(zQ,{mode:"success",children:[a.jsx(s2,{sx:e=>({color:e.palette.success.main})})," ","Everything looks good!"]}),Mft=({children:e})=>a.jsxs(zQ,{mode:"warning",children:[a.jsx(Q4,{sx:t=>({color:t.palette.warning.main})})," ",e]}),Dft=({environmentCount:e,featureCount:t})=>a.jsxs(Oft,{children:[a.jsxs(DN,{children:[a.jsx(op,{}),a.jsx(LN,{children:e})]}),a.jsxs(DN,{children:[a.jsx(BQ,{}),a.jsx(LN,{children:t})]})]}),Lft=()=>{const{trackEvent:e}=Sn();return()=>{e("sdk-reporting",{props:{eventType:"environment box clicked"}})}},NN=e=>e.issues.missingFeatures.length+e.issues.outdatedSdks.length===0?"success":"warning",Nft=({data:e})=>{const t=Lft(),n=Fr("name"),{elementRef:r,width:o}=$ft(),i=$t(),s=It(),l=NQ(e);return a.jsx(ne,{sx:{width:o},children:a.jsxs(XE.ArcherContainer,{strokeColor:s.palette.secondary.border,endMarker:!1,children:[a.jsx(Tft,{children:a.jsx(XE.ArcherElement,{id:"application",relations:e.environments.map(c=>({targetId:c.name,targetAnchor:"top",sourceAnchor:"bottom",style:{strokeColor:NN(c)==="success"?s.palette.secondary.border:s.palette.warning.border}})),children:a.jsxs(kft,{mode:l.applicationMode,children:[a.jsx(Z,{sx:c=>({fontSize:c.fontSizes.smallerBody}),color:"text.secondary",children:"Application"}),a.jsx(Z,{sx:c=>({fontSize:c.fontSizes.bodySize,fontWeight:c.fontWeight.bold}),children:n}),a.jsx(Dft,{environmentCount:e.environments.length,featureCount:e.featureCount}),a.jsx(Rft,{}),l.applicationMode==="success"?a.jsx(Ift,{}):a.jsxs(Mft,{children:[l.issueCount," issues detected"]})]})})}),a.jsx(Aft,{ref:r,children:e.environments.map(c=>a.jsx(XE.ArcherElement,{id:c.name,children:a.jsxs(_ft,{mode:NN(c),sx:{cursor:"pointer"},onClick:u=>{t(),i(`/applications/${n}/instances?environment=${c.name}`)},children:[a.jsxs(Pft,{children:[c.name," environment"]}),a.jsx(Eft,{children:a.jsxs("tbody",{children:[a.jsxs("tr",{children:[a.jsxs(Ip,{sx:{display:"flex"},children:["Instances:"," ",a.jsx(ua,{size:s.fontSizes.smallBody,tooltip:"Active instances in the last 2 days"})]}),a.jsx(Ip,{children:c.instanceCount})]}),a.jsxs("tr",{children:[a.jsx(Ip,{children:"SDK:"}),a.jsx(Ip,{children:c.sdks.map(u=>a.jsx("div",{children:u},u))})]}),a.jsxs("tr",{children:[a.jsx(Ip,{children:"Last seen:"}),a.jsx(Ip,{children:c.lastSeen&&a.jsx(Lc,{minPeriod:60,date:new Date(c.lastSeen)})})]})]})})]},c.name)},c.name))})]})})},Fft=b(vr)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),Bft=b(ne)(({theme:e})=>({display:"flex",padding:e.spacing(1),flexDirection:"column",alignItems:"center",gap:e.spacing(2),alignSelf:"stretch"})),zft=b(ne)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(2),alignSelf:"stretch"})),Hft=b("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignSelf:"stretch"})),Uft=()=>{const{trackEvent:e}=Sn();m.useEffect(()=>{e("sdk-reporting",{props:{eventType:"application overview opened"}})},[])},Vft=()=>{eA("Applications - Overview"),Uft();const e=Fr("name"),t=$t(),{data:n,loading:r}=DQ(e),{openFeedback:o}=AA("applicationOverview","automatic"),i=()=>{o({title:"How easy was it to use the application overview page?",positiveLabel:"What do you like most about the new application overview page?",areasForImprovementsLabel:"What should be improved on the application overview page?"})};return r?a.jsxs("div",{children:[a.jsx("p",{children:"Loading..."}),a.jsx(q3,{})]}):a.jsx(W,{condition:!r&&n.environments.length===0,show:a.jsx(Vt,{severity:"warning",children:"No data available."}),elseShow:a.jsxs(Bft,{children:[a.jsxs(Hft,{children:[a.jsxs(zft,{children:["Application is connected to these projects:",n.projects.map(s=>a.jsx(qt,{sx:{cursor:"pointer"},onClick:l=>{l.preventDefault(),t(`/projects/${s}`)},color:"secondary",icon:a.jsx(w4,{}),children:s},s))]}),a.jsx(We,{startIcon:a.jsx(mh,{}),variant:"outlined",onClick:i,size:"small",children:"Provide feedback"})]}),a.jsx(Fft,{}),a.jsx(mft,{application:n}),a.jsx(Nft,{data:n})]})})},Wft=b("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(3)})),Gft=b("div")(({theme:e})=>({padding:e.spacing(0,4)})),qft=b("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Yft=b(pb)(({theme:e})=>({textTransform:"none",fontSize:e.fontSizes.bodySize,flexGrow:1,flexBasis:0,[e.breakpoints.down("md")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.up("md")]:{minWidth:160}})),Kft=()=>{const e=$t(),t=Fr("name"),{application:n,loading:r}=oft(t),{appName:o,url:i,description:s,icon:l="apps",createdAt:c}=n,{hasAccess:u}=m.useContext(Di),{deleteApplication:d}=rft(),{locationSettings:f}=Mi(),{setToastData:p,setToastApiError:h}=Yt(),{pathname:g}=Ao(),v=`/applications/${t}`,[x,y]=m.useState(!1),w=()=>{y(!x)},S=T=>If(T,f.locale),C=async T=>{T.preventDefault();try{await d(o),p({title:"Deleted Successfully",text:"Application deleted successfully",type:"success"}),e("/applications")}catch(_){h(Dt(_))}},E=()=>a.jsx(rr,{open:x,onClose:w,onClick:C,title:"Are you sure you want to delete this application?"});if(r)return a.jsxs("div",{children:[a.jsx("p",{children:"Loading..."}),a.jsx(q3,{})]});if(!n)return a.jsxs("p",{children:["Application (",o,") not found"]});const j=[{title:"Overview",path:v,name:"overview"},{title:"Connected instances",path:`${v}/instances`,name:"instances"}],k=j.find(T=>T.path===g);return a.jsxs(a.Fragment,{children:[a.jsxs(Wft,{children:[a.jsxs(yr,{children:[a.jsx(Bn,{title:o,actions:a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!!i,show:a.jsx(Ht,{component:nr,href:i,size:"large",children:a.jsx(MQ,{titleAccess:i})})}),a.jsx(ti,{tooltipProps:{title:"Delete application"},onClick:w,permission:aL,children:a.jsx(co,{})})]})}),a.jsx(ne,{sx:T=>({marginTop:T.spacing(1)}),children:a.jsxs(Z,{variant:"body2",children:["Created: ",S(c)]})})]}),a.jsx(qft,{}),a.jsx(Gft,{children:a.jsx(AV,{value:k==null?void 0:k.path,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:j.map(T=>a.jsx(Yft,{label:T.title,value:T.path,onClick:()=>e(T.path),"data-testid":`TAB_${T.title}`},T.title))})})]}),a.jsxs(yr,{children:[a.jsx(W,{condition:u(aL),show:a.jsx("div",{children:E()})}),a.jsxs(u3,{children:[a.jsx(lf,{path:"instances",element:a.jsx(nft,{})}),a.jsx(lf,{path:"*",element:a.jsx(Vft,{})})]})]})]})},km="api/admin/signal-endpoints",HQ=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=sr({propagateErrors:!0}),o=async d=>{const p=n(km,{method:"POST",body:JSON.stringify(d)},"addSignalEndpoint");return(await t(p.caller,p.id)).json()},i=async(d,f)=>{const h=n(`${km}/${d}`,{method:"PUT",body:JSON.stringify(f)},"updateSignalEndpoint");await t(h.caller,h.id)},s=async d=>{const p=n(`${km}/${d}/on`,{method:"POST"},"enableSignalEndpoint");await t(p.caller,p.id)},l=async d=>{const p=n(`${km}/${d}/off`,{method:"POST"},"disableSignalEndpoint");await t(p.caller,p.id)};return{addSignalEndpoint:o,updateSignalEndpoint:i,removeSignalEndpoint:async d=>{const p=n(`${km}/${d}`,{method:"DELETE"},"removeSignalEndpoint");await t(p.caller,p.id)},toggleSignalEndpoint:async(d,f)=>{f?await s(d):await l(d)},errors:r,loading:e}},Xft=b(ne)({display:"flex",justifyContent:"center"}),Jft=({signalEndpointId:e,onCopyToClipboard:t,onOpenSignals:n,onEdit:r,onDelete:o})=>{const[i,s]=m.useState(null),l=!!i,c=p=>{s(p.currentTarget)},u=()=>{s(null)},d=`signal-endpoint-${e}-actions`,f=`${d}-menu`;return a.jsxs(Xft,{children:[a.jsx(gt,{title:"Signal endpoint actions",arrow:!0,describeChild:!0,children:a.jsx(Ht,{id:d,"data-loading":!0,"aria-controls":l?f:void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,onClick:c,type:"button",children:a.jsx(wg,{})})}),a.jsx(fd,{id:f,anchorEl:i,open:l,onClose:u,onClick:u,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:p=>({borderRadius:`${p.shape.borderRadius}px`,padding:p.spacing(1,1.5)})},children:a.jsxs(X0,{"aria-labelledby":d,children:[a.jsxs(Mo,{sx:gy,onClick:t,children:[a.jsx(Ti,{children:a.jsx(sp,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"Copy URL"})})]}),a.jsx(Tl,{permission:Qo,children:({hasAccess:p})=>a.jsxs(Mo,{sx:gy,onClick:n,disabled:!p,children:[a.jsx(Ti,{children:a.jsx(hC,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"View signals"})})]})}),a.jsx(Tl,{permission:Qo,children:({hasAccess:p})=>a.jsxs(Mo,{sx:gy,onClick:r,disabled:!p,children:[a.jsx(Ti,{children:a.jsx(Oi,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"Edit"})})]})}),a.jsx(Tl,{permission:Qo,children:({hasAccess:p})=>a.jsxs(Mo,{sx:gy,onClick:o,disabled:!p,children:[a.jsx(Ti,{children:a.jsx(co,{})}),a.jsx(mn,{children:a.jsx(Z,{variant:"body2",children:"Remove"})})]})})]})})]})},Qft=({signalEndpoint:e,open:t,setOpen:n,onConfirm:r})=>a.jsx(rr,{title:"Delete signal endpoint?",open:t,primaryButtonText:"Delete signal endpoint",secondaryButtonText:"Cancel",onClick:()=>r(e),onClose:()=>{n(!1)},children:a.jsxs("p",{children:["You are about to delete signal endpoint:"," ",a.jsx("strong",{children:e==null?void 0:e.name})]})}),Zft=({checked:e,setChecked:t,title:n})=>a.jsx(bn,{children:a.jsx(gt,{title:n||(e?"Disable":"Enable"),arrow:!0,children:a.jsx(is,{checked:e,onChange:r=>t(r.target.checked)})})}),ept=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),tpt=({signalEndpoint:{tokens:e},value:t,onCreateToken:n})=>{const{searchQuery:r}=Jl();return!e||e.length===0?n?a.jsx(la,{title:"Create token",onClick:n}):a.jsx(bn,{children:"0 tokens"}):a.jsx(bn,{children:a.jsx(Gc,{tooltip:a.jsx(a.Fragment,{children:e==null?void 0:e.map(({id:o,name:i})=>a.jsx(ept,{children:a.jsx(pi,{search:r,children:i})},o))}),highlighted:r.length>0&&t.toLowerCase().includes(r.toLowerCase()),children:(e==null?void 0:e.length)===1?"1 token":`${e==null?void 0:e.length} tokens`})})},JE="api/admin/signal-endpoints",UQ=()=>{const{loading:e,makeRequest:t,createRequest:n,errors:r}=sr({propagateErrors:!0});return{addSignalEndpointToken:async(l,c)=>{const d=n(`${JE}/${l}/tokens`,{method:"POST",body:JSON.stringify(c)},"addSignalEndpointToken");return(await t(d.caller,d.id)).json()},updateSignalEndpointToken:async(l,c,u)=>{const f=n(`${JE}/${l}/tokens/${c}`,{method:"PUT",body:JSON.stringify(u)},"updateSignalEndpointToken");await t(f.caller,f.id)},removeSignalEndpointToken:async(l,c)=>{const d=n(`${JE}/${l}/tokens/${c}`,{method:"DELETE"},"removeSignalEndpointToken");await t(d.caller,d.id)},errors:r,loading:e}},npt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",lineHeight:e.spacing(2.75)})),rpt=b(Qr)({marginRight:0}),opt=b("span")(({theme:e})=>({marginLeft:e.spacing(.5),fontSize:e.fontSizes.smallBody})),ipt=({checked:e,setChecked:t,children:n,...r})=>a.jsxs(npt,{...r,children:[n,a.jsx(rpt,{control:a.jsx(is,{checked:e,onChange:o=>t(o.target.checked)}),label:a.jsx(opt,{children:e?"Enabled":"Disabled"})})]}),FN={name:void 0,tokenName:void 0};var Iv=(e=>(e.LATER="later",e.NOW="now",e))(Iv||{});const spt=e=>{const{signalEndpoints:t}=Eg(),[n,r]=m.useState(!1),[o,i]=m.useState(""),[s,l]=m.useState(""),[c,u]=m.useState("later"),[d,f]=m.useState(""),p=()=>{r((e==null?void 0:e.enabled)??!0),i((e==null?void 0:e.name)||""),l((e==null?void 0:e.description)||""),u("later"),f(""),x(!1),g(FN)};m.useEffect(()=>{p()},[e]);const[h,g]=m.useState(FN),[v,x]=m.useState(!1),y=_=>{g(A=>({...A,[_]:void 0}))},w=(_,A)=>{g(M=>({...M,[_]:A}))},S=_=>!_.length,C=_=>t==null?void 0:t.some(({id:A,name:M})=>A!==(e==null?void 0:e.id)&&M===_),E=_=>!yrt.test(_),j=_=>S(_)?(w("name","Name is required."),!1):C(_)?(w("name","Name must be unique."),!1):E(_)?(w("name","Name must only contain alphanumeric lowercase characters, dashes and underscores."),!1):(y("name"),!0),k=(_,A)=>_==="now"&&S(A)?(w("tokenName","Token name is required."),!1):(y("tokenName"),!0);return{enabled:n,setEnabled:r,name:o,setName:i,description:s,setDescription:l,tokenGeneration:c,setTokenGeneration:u,tokenName:d,setTokenName:f,errors:h,setErrors:g,validated:v,validateName:j,validateTokenName:k,validate:()=>{const _=j(o),A=k(c,d);return x(!0),_&&A},reloadForm:p}},apt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(1.5),gap:e.spacing(1.5),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,marginBottom:e.spacing(4),marginTop:e.spacing(3)})),lpt=b("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),cpt=b("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,backgroundColor:e.palette.background.elevation2,padding:e.spacing(.5,1,.5,2),width:"100%",borderRadius:e.shape.borderRadiusMedium,display:"flex",justifyContent:"space-between",alignItems:"center",wordBreak:"break-all"})),upt=({name:e})=>{const{uiConfig:t}=ht(),{setToastData:n}=Yt(),r=`${t.unleashUrl}/api/signal-endpoint/${e}`,o=()=>{aC(r),n({type:"success",title:"Copied to clipboard"})};return a.jsxs(apt,{children:[a.jsx(lpt,{children:"Signal endpoint URL:"}),a.jsxs(cpt,{children:[r,a.jsx(gt,{title:"Copy URL",arrow:!0,children:a.jsx(Ht,{onClick:o,size:"large",children:a.jsx(sp,{})})})]})]})},dpt="api/admin/signal-endpoints",fpt={signalEndpointTokens:[]},ppt=e=>{const{isEnterprise:t}=ht(),n=Nr("signals"),{data:r,error:o,mutate:i}=Ql(t()&&n,fpt,Ot(`${dpt}/${e}/tokens`),hpt);return m.useMemo(()=>({signalEndpointTokens:(r==null?void 0:r.signalEndpointTokens)??[],loading:!o&&!r,refetch:()=>i(),error:o}),[r,o,i])},hpt=e=>fetch(e).then(fn("Signal endpoint tokens")).then(t=>t.json()),gpt=b("div")(({theme:e})=>({minHeight:e.spacing(12)})),mpt=b("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),vpt=b(ar)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),ypt=({open:e,setOpen:t,tokens:n,onCreateClick:r})=>{const[o,i]=m.useState(""),[s,l]=m.useState("");m.useEffect(()=>{i(""),l("")},[e]);const c=f=>!(n!=null&&n.some(p=>p.name===f)),u=f=>{f.length?c(f)?l(""):l("Name must be unique"):l("Name is required")},d=o.length&&c(o);return a.jsx(rr,{open:e,primaryButtonText:"Create token",secondaryButtonText:"Cancel",onClick:()=>r({name:o}),disabledPrimaryButton:!d,onClose:()=>{t(!1)},title:"New token",children:a.jsxs(gpt,{children:[a.jsx(mpt,{children:"What is your new token name?"}),a.jsx(vpt,{autoFocus:!0,label:"Token name",error:!!s,errorText:s,value:o,onChange:f=>{u(f.target.value),i(f.target.value)},autoComplete:"off"})]})})},xpt=b(Vt)(({theme:e})=>({marginBottom:e.spacing(3)})),bpt=b("pre")(({theme:e})=>({backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:"auto",fontSize:e.fontSizes.smallerBody})),VQ=({open:e,setOpen:t,token:n,signalEndpoint:r})=>{const{uiConfig:o}=ht();return a.jsxs(rr,{open:e,secondaryButtonText:"Close",onClose:(i,s)=>{s||t(!1)},title:"Signal endpoint token created",children:[a.jsx(xpt,{severity:"info",children:"Make sure to copy your signal endpoint token now. You won't be able to see it again!"}),a.jsx(Z,{variant:"body1",children:"Your token:"}),a.jsx(m4,{token:n||""}),a.jsx(W,{condition:!!r,show:()=>a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"body1",sx:{marginTop:3,marginBottom:2},children:"You can call your signal endpoint with the newly created token like this:"}),a.jsx(bpt,{children:`curl --request POST '${o.unleashUrl}/api/signal-endpoint/${r.name}' \\
441
441
  --header 'Authorization: Bearer ${n||"YOUR_TOKEN"}' \\
442
442
  --header 'Content-Type: application/json' \\
@@ -445,8 +445,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
445
445
  }'`})]})})]})},wpt=b("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:e.spacing(2),gap:e.spacing(2),"& > div":{[e.breakpoints.down("md")]:{marginTop:0}}})),Spt=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(3)})),Cpt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.bodySize,marginBottom:e.spacing(.5)})),jpt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(1.5)})),Ept={id:"createdAt",desc:!0},Tpt=({signalEndpoint:e})=>{const t=It(),{setToastData:n,setToastApiError:r}=Yt(),o=Qn(t.breakpoints.down("md")),{signalEndpointTokens:i,refetch:s}=ppt(e.id),{refetch:l}=Eg(),{addSignalEndpointToken:c,removeSignalEndpointToken:u}=UQ(),[d]=m.useState(()=>({sortBy:[Ept]})),[f,p]=m.useState(""),[h,g]=m.useState(!1),[v,x]=m.useState(!1),[y,w]=m.useState(!1),[S,C]=m.useState(""),[E,j]=m.useState(),k=async q=>{try{const{token:G}=await c(e.id,q);l(),s(),g(!1),C(G),x(!0),n({title:"Token created successfully",type:"success"})}catch(G){r(Dt(G))}},T=async()=>{if(E)try{await u(e.id,E.id),l(),s(),w(!1),n({title:"Token deleted successfully",type:"success"})}catch(q){r(Dt(q))}},_=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:ea,minWidth:100,searchable:!0},{Header:"Created",accessor:"createdAt",Cell:Qu,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:q}})=>a.jsx(Fc,{children:a.jsx(gt,{title:"Delete token",arrow:!0,describeChild:!0,children:a.jsx("span",{children:a.jsx(Ht,{onClick:()=>{j(q),w(!0)},children:a.jsx(co,{})})})})}),maxWidth:100,disableSortBy:!0}],[j,w]),{data:A,getSearchText:M,getSearchContext:I}=xg(_,f,i),{headerGroups:P,rows:$,prepareRow:z,setHiddenColumns:Y}=un.useTable({columns:_,data:A,initialState:d,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},un.useSortBy,un.useFlexLayout);return hp([{condition:o,columns:["createdAt"]}],Y,_),a.jsxs(a.Fragment,{children:[a.jsxs(wpt,{children:[a.jsx(No,{initialValue:f,onChange:p,getSearchContext:I}),a.jsx(We,{variant:"contained",color:"primary",disabled:i.length>=wJ,onClick:()=>g(!0),children:"New token"})]}),a.jsx(ga,{value:M(f),children:a.jsx(vg,{rows:$,headerGroups:P,prepareRow:z})}),a.jsx(W,{condition:$.length===0,show:a.jsx(W,{condition:(f==null?void 0:f.length)>0,show:a.jsxs(eo,{children:["No tokens found matching “",f,"”"]}),elseShow:a.jsxs(Spt,{children:[a.jsx(Cpt,{children:"You have no tokens for this signal endpoint yet."}),a.jsx(jpt,{children:"Create a token to start using this signal endpoint."}),a.jsx(We,{variant:"outlined",onClick:()=>g(!0),children:"Create new signal endpoint token"})]})})}),a.jsx(ypt,{open:h,setOpen:g,tokens:i,onCreateClick:k}),a.jsx(VQ,{open:v,setOpen:x,token:S,signalEndpoint:e}),a.jsx(rr,{open:y,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:T,onClose:()=>{w(!1)},title:"Delete token?",children:a.jsxs(Z,{children:['Any applications or scripts using this token "',a.jsx("strong",{children:E==null?void 0:E.name}),'" will no longer be able to make requests to this signal endpoint. You cannot undo this action.']})})]})},kpt=b("div")(({theme:e})=>({background:e.palette.background.elevation1,padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(4)})),Jy=b("p")(({theme:e})=>({display:"flex",color:e.palette.text.primary,marginBottom:e.spacing(1),"&:not(:first-of-type)":{marginTop:e.spacing(3)}})),QE=b("p")(({theme:e})=>({color:e.palette.text.secondary,marginBottom:e.spacing(1)})),ZE=b(ar)(({theme:e})=>({width:"100%",maxWidth:e.spacing(50)})),_pt=b("div")(({theme:e})=>({padding:e.spacing(3),backgroundColor:e.palette.background.elevation2,borderRadius:e.shape.borderRadiusMedium,marginTop:e.spacing(4),marginBottom:e.spacing(2)})),Rpt=b("div")(({theme:e})=>({padding:e.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:e.spacing(2)}})),Apt=({signalEndpoint:e,enabled:t,setEnabled:n,name:r,setName:o,description:i,setDescription:s,tokenGeneration:l,setTokenGeneration:c,tokenName:u,setTokenName:d,errors:f,validateName:p,validateTokenName:h,validated:g})=>{const v=y=>{setTimeout(()=>y(),300)},x=g&&Object.values(f).some(Boolean);return a.jsxs("div",{children:[a.jsx(kpt,{children:a.jsx(ipt,{checked:t,setChecked:n,children:"Signal endpoint status"})}),a.jsx(Jy,{children:"What is your new signal endpoint name?"}),a.jsx(ZE,{autoFocus:!0,label:"Signal endpoint name",error:!!f.name,errorText:f.name,value:r,onChange:y=>{p(y.target.value),o(y.target.value)},onBlur:y=>v(()=>p(y.target.value)),autoComplete:"off"}),a.jsx(Jy,{children:"What is your new signal endpoint description?"}),a.jsx(ZE,{label:"Signal endpoint description",value:i,onChange:y=>s(y.target.value),autoComplete:"off"}),a.jsx(upt,{name:r}),a.jsx(W,{condition:e===void 0,show:a.jsxs(_pt,{children:[a.jsx(Jy,{children:"Token"}),a.jsxs(QE,{children:["In order to connect your newly created signal endpoint, you will also need a token."," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),a.jsx(Ua,{children:a.jsxs(Q0,{value:l,onChange:y=>{const w=y.target.value;g&&h(w,u),c(w)},name:"token-generation",children:[a.jsx(Qr,{value:Iv.LATER,control:a.jsx(jl,{}),label:"I want to generate a token later"}),a.jsx(Qr,{value:Iv.NOW,control:a.jsx(jl,{}),label:"Generate a token now"})]})}),a.jsxs(Rpt,{children:[a.jsx(QE,{children:"A new signal endpoint token will be generated for the signal endpoint, so you can get started right away."}),a.jsx(W,{condition:l===Iv.NOW,show:a.jsxs(a.Fragment,{children:[a.jsx(QE,{children:"What is your new token name?"}),a.jsx(ZE,{autoFocus:!0,label:"Token name",error:!!f.tokenName,errorText:f.tokenName,value:u,onChange:y=>{h(l,y.target.value),d(y.target.value)},autoComplete:"off"})]})})]})]}),elseShow:a.jsxs(a.Fragment,{children:[a.jsx(Jy,{children:"Signal endpoint tokens"}),a.jsx(Tpt,{signalEndpoint:e})]})}),a.jsx(W,{condition:x,show:()=>a.jsx(Vt,{severity:"error",icon:!1,children:a.jsx("ul",{children:Object.values(f).filter(Boolean).map(y=>a.jsx("li",{children:y},y))})})})]})},Ppt=b("div")(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:e.fontSizes.mainHeader})),Opt=b("h1")({fontWeight:"normal"}),$pt=b("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Ipt=b("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),Mpt=b(We)(({theme:e})=>({marginLeft:e.spacing(3)})),Dpt=({signalEndpoint:e,open:t,setOpen:n,newToken:r,onOpenSignals:o})=>{const{refetch:i}=Eg(),{addSignalEndpoint:s,updateSignalEndpoint:l,loading:c}=HQ(),{addSignalEndpointToken:u}=UQ(),{setToastData:d,setToastApiError:f}=Yt(),{uiConfig:p}=ht(),{enabled:h,setEnabled:g,name:v,setName:x,description:y,setDescription:w,tokenGeneration:S,setTokenGeneration:C,tokenName:E,setTokenName:j,errors:k,validateName:T,validateTokenName:_,validate:A,validated:M,reloadForm:I}=spt(e);m.useEffect(()=>{I()},[t]);const P=e!==void 0,$=`${P?"Edit":"New"} signal endpoint`,z={enabled:h,name:v,description:y},Y=()=>`curl --location --request ${P?"PUT":"POST"} '${p.unleashUrl}/api/admin/signal-endpoints${P?`/${e.id}`:""}' \\
446
446
  --header 'Authorization: INSERT_API_KEY' \\
447
447
  --header 'Content-Type: application/json' \\
448
- --data-raw '${JSON.stringify(z,void 0,2)}'`,q=async G=>{if(G.preventDefault(),!!A())try{if(P)await l(e.id,z);else{const F=await s(z);if(S===Iv.NOW){const{token:U}=await u(F.id,{name:E});r(U,F)}}d({title:`Signal endpoint ${P?"updated":"added"} successfully`,type:"success"}),i(),n(!1)}catch(F){f(Dt(F))}};return a.jsx(pp,{open:t,onClose:()=>{n(!1)},label:$,children:a.jsxs(Br,{loading:c,modal:!0,description:"Signal endpoints allow third-party services to send signals to Unleash.",documentationLink:"https://docs.getunleash.io/reference/signals",documentationLinkLabel:"Signals documentation",formatApiCode:Y,children:[a.jsxs(Ppt,{children:[a.jsx(Opt,{children:$}),a.jsx(W,{condition:P,show:a.jsx(nr,{onClick:o,children:"View signals"})})]}),a.jsxs($pt,{onSubmit:q,children:[a.jsx(Apt,{signalEndpoint:e,enabled:h,setEnabled:g,name:v,setName:x,description:y,setDescription:w,tokenGeneration:S,setTokenGeneration:C,tokenName:E,setTokenName:j,errors:k,validateName:T,validateTokenName:_,validated:M}),a.jsxs(Ipt,{children:[a.jsxs(We,{type:"submit",variant:"contained",color:"primary",children:[P?"Save":"Add"," signal endpoint"]}),a.jsx(Mpt,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},BN=Me.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),eT={dedupe:!0},Lpt=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:s,revalidateOnMount:l,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:p}=n,[h,g,v,x]=Oa.get(r),[y,w]=Pf(e),S=m.useRef(!1),C=m.useRef(!1),E=m.useRef(y),j=m.useRef(t),k=m.useRef(n),T=()=>k.current,_=()=>T().isVisible()&&T().isOnline(),[A,M,I,P]=yc(r,y),$=m.useRef({}).current,z=zt(s)?n.fallback[y]:s,Y=(he,se)=>{for(const be in $){const xe=be;if(xe==="data"){if(!o(he[xe],se[xe])&&(!zt(he[xe])||!o(ue,se[xe])))return!1}else if(se[xe]!==he[xe])return!1}return!0},q=m.useMemo(()=>{const he=!y||!t?!1:zt(l)?T().isPaused()||i?!1:zt(c)?!0:c:l,se=De=>{const Ne=Hl(De);return delete Ne._k,he?{isValidating:!0,isLoading:!0,...Ne}:Ne},be=A(),xe=P(),Ee=se(be),Ge=be===xe?Ee:se(xe);let we=Ee;return[()=>{const De=se(A());return Y(De,we)?(we.data=De.data,we.isLoading=De.isLoading,we.isValidating=De.isValidating,we.error=De.error,we):(we=De,De)},()=>Ge]},[r,y]),G=RS.useSyncExternalStore(m.useCallback(he=>I(y,(se,be)=>{Y(be,se)||he()}),[r,y]),q[0],q[1]),F=!S.current,U=h[y]&&h[y].length>0,O=G.data,L=zt(O)?z:O,te=G.error,re=m.useRef(L),ue=p?zt(O)?re.current:O:L,ve=U&&!zt(te)?!1:F&&!zt(l)?l:T().isPaused()?!1:i?zt(L)?!1:c:zt(L)||c,Ce=!!(y&&t&&F&&ve),J=zt(G.isValidating)?Ce:G.isValidating,oe=zt(G.isLoading)?Ce:G.isLoading,ae=m.useCallback(async he=>{const se=j.current;if(!y||!se||C.current||T().isPaused())return!1;let be,xe,Ee=!0;const Ge=he||{},we=!v[y]||!Ge.dedupe,De=()=>hb?!C.current&&y===E.current&&S.current:y===E.current,Ne={isValidating:!1,isLoading:!1},it=()=>{M(Ne)},Pt=()=>{const qe=v[y];qe&&qe[1]===xe&&delete v[y]},mt={isValidating:!0};zt(A().data)&&(mt.isLoading=!0);try{if(we&&(M(mt),n.loadingTimeout&&zt(A().data)&&setTimeout(()=>{Ee&&De()&&T().onLoadingSlow(y,n)},n.loadingTimeout),v[y]=[se(w),gb()]),[be,xe]=v[y],be=await be,we&&setTimeout(Pt,n.dedupingInterval),!v[y]||v[y][1]!==xe)return we&&De()&&T().onDiscarded(y),!1;Ne.error=wo;const qe=g[y];if(!zt(qe)&&(xe<=qe[0]||xe<=qe[1]||qe[1]===0))return it(),we&&De()&&T().onDiscarded(y),!1;const Te=A().data;Ne.data=o(Te,be)?Te:be,we&&De()&&T().onSuccess(be,y,n)}catch(qe){Pt();const Te=T(),{shouldRetryOnError:Ue}=Te;Te.isPaused()||(Ne.error=qe,we&&De()&&(Te.onError(qe,y,Te),(Ue===!0||Gi(Ue)&&Ue(qe))&&(!T().revalidateOnFocus||!T().revalidateOnReconnect||_())&&Te.onErrorRetry(qe,y,Te,pe=>{const ye=h[y];ye&&ye[0]&&ye[0](gl.ERROR_REVALIDATE_EVENT,pe)},{retryCount:(Ge.retryCount||0)+1,dedupe:!0})))}return Ee=!1,it(),!0},[y,r]),ce=m.useCallback((...he)=>o5(r,E.current,...he),[]);if(Iu(()=>{j.current=t,k.current=n,zt(O)||(re.current=O)}),Iu(()=>{if(!y)return;const he=ae.bind(wo,eT);let se=0;const xe=fW(y,h,(Ee,Ge={})=>{if(Ee==gl.FOCUS_EVENT){const we=Date.now();T().revalidateOnFocus&&we>se&&_()&&(se=we+T().focusThrottleInterval,he())}else if(Ee==gl.RECONNECT_EVENT)T().revalidateOnReconnect&&_()&&he();else{if(Ee==gl.MUTATE_EVENT)return ae();if(Ee==gl.ERROR_REVALIDATE_EVENT)return ae(Ge)}});return C.current=!1,E.current=y,S.current=!0,M({_k:w}),ve&&(zt(L)||Af?he():eW(he)),()=>{C.current=!0,xe()}},[y]),Iu(()=>{let he;function se(){const xe=Gi(u)?u(A().data):u;xe&&he!==-1&&(he=setTimeout(be,xe))}function be(){!A().error&&(d||T().isVisible())&&(f||T().isOnline())?ae(eT).then(se):se()}return se(),()=>{he&&(clearTimeout(he),he=-1)}},[u,d,f,y]),m.useDebugValue(ue),i&&zt(L)&&y){if(!hb&&Af)throw new Error("Fallback data is required when using suspense in SSR.");j.current=t,k.current=n,C.current=!1;const he=x[y];if(!zt(he)){const se=ce(he);BN(se)}if(zt(te)){const se=ae(eT);zt(ue)||(se.status="fulfilled",se.value=!0),BN(se)}else throw te}return{mutate:ce,get data(){return $.data=!0,ue},get error(){return $.error=!0,te},get isValidating(){return $.isValidating=!0,J},get isLoading(){return $.isLoading=!0,oe}}};yv.defineProperty(sW,"defaultValue",{value:i5});const Npt=dW(Lpt),Fpt=e=>Pf(e?e(0,null):null)[0],tT=Promise.resolve(),Bpt=e=>(t,n,r)=>{const o=m.useRef(!1),{cache:i,initialSize:s=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:f=!1}=r,[,,,p]=Oa.get(PS);let h;try{h=Fpt(t),h&&(h=aW+h)}catch{}const[g,v,x]=yc(i,h),y=m.useCallback(()=>zt(g()._l)?s:g()._l,[i,h,s]);RS.useSyncExternalStore(m.useCallback(T=>h?x(h,()=>{T()}):()=>{},[i,h]),y,y);const w=m.useCallback(()=>{const T=g()._l;return zt(T)?s:T},[h,s]),S=m.useRef(w());Iu(()=>{if(!o.current){o.current=!0;return}h&&v({_l:c?S.current:w()})},[h,i]);const C=d&&!o.current,E=e(h,async T=>{const _=g()._i,A=g()._r;v({_r:wo});const M=[],I=w(),[P]=yc(i,T),$=P().data,z=[];let Y=null;for(let q=0;q<I;++q){const[G,F]=Pf(t(q,f?null:Y));if(!G)break;const[U,O]=yc(i,G);let L=U().data;const te=l||_||zt(L)||u&&!q&&!zt($)||C||$&&!zt($[q])&&!r.compare($[q],L);if(n&&(typeof A=="function"?A(L,F):te)){const re=async()=>{if(!(G in p))L=await n(F);else{const ve=p[G];delete p[G],L=await ve}O({data:L,_k:F}),M[q]=L};f?z.push(re):await re()}else M[q]=L;f||(Y=L)}return f&&await Promise.all(z.map(q=>q())),v({_i:wo}),M},r),j=m.useCallback(function(T,_){const A=typeof _=="boolean"?{revalidate:_}:_||{},M=A.revalidate!==!1;return h?(M&&(zt(T)?v({_i:!0,_r:A.revalidate}):v({_i:!1,_r:A.revalidate})),arguments.length?E.mutate(T,{...A,revalidate:M}):E.mutate()):tT},[h,i]),k=m.useCallback(T=>{if(!h)return tT;const[,_]=yc(i,h);let A;if(Gi(T)?A=T(w()):typeof T=="number"&&(A=T),typeof A!="number")return tT;_({_l:A}),S.current=A;const M=[],[I]=yc(i,h);let P=null;for(let $=0;$<A;++$){const[z]=Pf(t($,P)),[Y]=yc(i,z),q=z?Y().data:wo;if(zt(q))return j(I().data);M.push(q),P=q}return j(M)},[h,i,j,w]);return{size:w(),setSize:k,mutate:j,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}},zpt=nSe(Npt,Bpt),Hpt="api/admin/signal-endpoints",Upt=async e=>{const t=await fetch(e);return await fn("Signals")(t),t.json()},Vpt=(e,t=50,n={})=>{var y;const{isEnterprise:r}=ht(),o=Nr("signals"),i=(w,S)=>!e||!r||!o||S&&!S.signalEndpointSignals.length?null:Ot(`${Hpt}/${e}/signals?limit=${t}&offset=${w*t}`),{data:s,error:l,size:c,setSize:u,mutate:d}=zpt(i,Upt,{...n,revalidateAll:!0}),f=s?s.flatMap(({signalEndpointSignals:w})=>w):[],p=!s&&!l,h=c>0&&!(s!=null&&s[c-1]),g=p||h,v=((y=s==null?void 0:s[c-1])==null?void 0:y.signalEndpointSignals.length)===t;return{signalEndpointSignals:f,hasMore:v,loadMore:()=>{g||!v||u(c+1)},loading:g,refetch:()=>d(),error:l}},Wpt=b("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",borderTopLeftRadius:e.shape.borderRadiusMedium,borderTopRightRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.table.headerBackground})),zN=b("div",{shouldForwardProp:e=>e!=="maxWidth"})(({maxWidth:e})=>({display:"flex",flex:1,...e&&{maxWidth:e}})),Gpt=({columns:e,sidePanelHeader:t,leftPanelMaxWidth:n})=>a.jsxs(Wpt,{children:[a.jsx(zN,{maxWidth:n,children:e.map(({header:r,maxWidth:o,align:i})=>a.jsx(Y_,{maxWidth:o,align:i,children:r},r))}),a.jsx(zN,{children:a.jsx(Y_,{children:t})})]}),qpt=b("div")(({theme:e})=>({borderBottom:`1px solid ${e.palette.divider}`})),Ypt=b(We,{shouldForwardProp:e=>e!=="selected"})(({theme:e,selected:t})=>({"&.MuiButton-root":{width:"100%",backgroundColor:t?e.palette.secondary.light:"transparent",borderRight:`${e.spacing(.5)} solid ${t?e.palette.background.alternative:"transparent"}`,padding:0,borderRadius:0,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,overflow:"auto"},"&:hover":{backgroundColor:t?e.palette.secondary.light:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`}})),Kpt=({selected:e,onClick:t,children:n})=>a.jsx(qpt,{children:a.jsx(Ypt,{selected:e,onClick:t,children:n})}),Xpt=b("div")({display:"flex",flexDirection:"column",width:"100%"}),Jpt=b("div")({display:"flex",flexDirection:"row"}),WQ=b("div")({display:"flex",flexDirection:"column",flex:1}),Qpt=b(WQ,{shouldForwardProp:e=>e!=="height"&&e!=="maxWidth"})(({theme:e,height:t,maxWidth:n})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderBottomLeftRadius:e.shape.borderRadiusMedium,overflow:"auto",...t&&{height:t},...n&&{maxWidth:n}})),Zpt=b(WQ)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderLeft:0,borderBottomRightRadius:e.shape.borderRadiusMedium})),Y_=b("div",{shouldForwardProp:e=>e!=="maxWidth"&&e!=="align"})(({theme:e,maxWidth:t,align:n="start"})=>({display:"flex",flex:1,padding:e.spacing(2),fontSize:e.fontSizes.smallBody,justifyContent:n,...t&&{maxWidth:t},textAlign:n,alignItems:"center"})),eht=({items:e,columns:t,sidePanelHeader:n,renderContent:r,renderItem:o=(l,c)=>c,height:i,listEnd:s})=>{const[l,c]=m.useState(e[0]);if(e.length===0)return null;const u=l||e[0],d=t.every(({maxWidth:f})=>!!f)?t.reduce((f,{maxWidth:p})=>f+(p||0),0):void 0;return a.jsxs(Xpt,{children:[a.jsx(Gpt,{columns:t,sidePanelHeader:n,leftPanelMaxWidth:d}),a.jsxs(Jpt,{children:[a.jsxs(Qpt,{height:i,maxWidth:d,children:[e.map(f=>o(f,a.jsx(Kpt,{selected:u.id===f.id,onClick:()=>c(f),children:t.map(({header:p,maxWidth:h,align:g,cell:v})=>a.jsx(Y_,{maxWidth:h,align:g,children:v(f)},p))},f.id))),s]}),a.jsx(Zpt,{children:r(u)})]})]})},tht=m.lazy(()=>yd(()=>import("./ReactJSONEditor-DDbLRmis.js"),[])),nht=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),rht=b("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),oht=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginTop:e.spacing(2),fontSize:e.fontSizes.smallBody})),iht=b("p")(({theme:e})=>({color:e.palette.text.secondary})),sht=b("h1")({fontWeight:"normal"}),aht=b("form")({display:"flex",flexDirection:"column",height:"100%"}),lht=b("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),cht=({signalEndpoint:e,open:t,setOpen:n,onOpenConfiguration:r})=>{const{uiConfig:o}=ht(),{locationSettings:i}=Mi(),{signalEndpointSignals:s,hasMore:l,loadMore:c,loading:u}=Vpt(e==null?void 0:e.id,20,{refreshInterval:5e3});if(!e)return null;const d=`Signals: ${e.name}`;return a.jsx(pp,{open:t,onClose:()=>{n(!1)},label:d,children:a.jsxs(Br,{loading:u&&s.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[a.jsxs(nht,{children:[a.jsxs(rht,{children:[a.jsx(sht,{children:d}),a.jsx(nr,{onClick:r,children:"View configuration"})]}),a.jsxs(oht,{children:[a.jsxs("p",{children:[o.unleashUrl,"/api/signal-endpoint/",e.name]}),a.jsx(iht,{children:e.description})]})]}),a.jsxs(aht,{children:[a.jsx(eht,{height:960,items:s,columns:[{header:"Date",maxWidth:220,cell:({createdAt:f})=>l1(f,i==null?void 0:i.locale)},{header:"Token",maxWidth:300,cell:({tokenName:f})=>f}],sidePanelHeader:"Payload",renderContent:f=>a.jsx(m.Suspense,{fallback:null,children:a.jsx(tht,{content:{json:f.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})}),listEnd:a.jsx(W,{condition:l,show:a.jsx(We,{onClick:c,children:"Load more"})})}),a.jsx(W,{condition:s.length===0,show:a.jsx("p",{children:"No signals have been received on this signal endpoint."})}),a.jsx(lht,{children:a.jsx(We,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},uht=()=>{const{setToastData:e,setToastApiError:t}=Yt(),{uiConfig:n}=ht(),{signalEndpoints:r,refetch:o}=Eg(),{toggleSignalEndpoint:i,removeSignalEndpoint:s}=HQ(),[l,c]=m.useState(),[u,d]=m.useState(!1),[f,p]=m.useState(!1),[h,g]=m.useState(""),[v,x]=m.useState(!1),[y,w]=m.useState(!1),S=async({id:I,name:P},$)=>{try{await i(I,$),e({title:`"${P}" has been ${$?"enabled":"disabled"}`,type:"success"}),o()}catch(z){t(Dt(z))}},C=async({id:I,name:P})=>{try{await s(I),e({title:`"${P}" has been deleted`,type:"success"}),o(),x(!1)}catch($){t(Dt($))}},E=Qn(Xo.breakpoints.down("md")),j=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:I}})=>a.jsx(la,{title:I.name,onClick:()=>{c(I),d(!0)},subtitle:I.description}),width:240},{Header:"URL",accessor:I=>`${n.unleashUrl}/api/signal-endpoint/${I.name}`,minWidth:200},{id:"tokens",Header:"Tokens",accessor:I=>{var P;return((P=I.tokens)==null?void 0:P.map(({name:$})=>$).join(`
449
- `))||""},Cell:({row:{original:I},value:P})=>a.jsx(tpt,{signalEndpoint:I,value:P,onCreateToken:()=>{c(I),d(!0)}}),searchable:!0,maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:Qu,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:I}})=>a.jsx(Zft,{checked:I.enabled,setChecked:P=>S(I,P)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:I}})=>a.jsx(Jft,{signalEndpointId:I.id,onCopyToClipboard:()=>{aC(`${n.unleashUrl}/api/signal-endpoint/${I.name}`),e({type:"success",title:"Copied to clipboard"})},onOpenSignals:()=>{c(I),w(!0)},onEdit:()=>{c(I),d(!0)},onDelete:()=>{c(I),x(!0)}}),width:90,disableSortBy:!0}],[]),[k]=m.useState({sortBy:[{id:"createdAt",desc:!0}]}),{headerGroups:T,rows:_,prepareRow:A,setHiddenColumns:M}=un.useTable({columns:j,data:r,initialState:k,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:bn}},un.useSortBy,un.useFlexLayout);return hp([{condition:E,columns:["createdAt"]}],M,j),a.jsxs(yr,{header:a.jsx(Bn,{title:`Signal endpoints (${r.length})`,actions:a.jsx(We,{variant:"contained",color:"primary",onClick:()=>{c(void 0),d(!0)},children:"New signal endpoint"})}),children:[a.jsx(vg,{rows:_,headerGroups:T,prepareRow:A}),a.jsx(W,{condition:_.length===0,show:a.jsx(eo,{children:"No signal endpoints available. Get started by adding one."})}),a.jsx(Dpt,{signalEndpoint:l,open:u,setOpen:d,newToken:(I,P)=>{g(I),c(P),p(!0)},onOpenSignals:()=>{d(!1),w(!0)}}),a.jsx(cht,{signalEndpoint:l,open:y,setOpen:w,onOpenConfiguration:()=>{w(!1),d(!0)}}),a.jsx(VQ,{open:f,setOpen:p,token:h,signalEndpoint:l}),a.jsx(Qft,{signalEndpoint:l,open:v,setOpen:x,onConfirm:C})]})},dht=()=>{const{isEnterprise:e}=ht();return e()?a.jsx("div",{children:a.jsx(i4,{permissions:Qo,children:a.jsx(uht,{})})}):a.jsx(hP,{feature:"signals"})},fht=m.lazy(()=>yd(()=>import("./CreateProject-CP51S2Nl.js"),[])),j0=[{path:"/splash/:splashId",title:"Unleash",component:Cet,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:fht,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:QBe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/copy",parent:"/projects/:projectId/features/:featureId/",title:"Copy",component:YQe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:dQe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:$ot,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature flag",component:XJe,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:Mot,flag:$Ne,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:JBe,type:"protected",menu:{mobile:!0}},{path:"/search",title:"Search",component:b$e,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:lrt,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/insights",title:"Insights",component:Bdt,type:"protected",menu:{mobile:!0},notFlag:"killInsightsUI",enterprise:!0},{path:"/applications/:name/*",title:":name",parent:"/applications",component:Kft,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:jit,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:Tet,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:TJe,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:hQe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/feature-toggle-type/*",title:"Feature flag types",component:sit,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:tet,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:net,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:xIe,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:gMe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:aze,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:uze,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:jnt,type:"protected",flag:INe,menu:{mobile:!0,advanced:!0}},{path:"/feedback",title:"Feedback",component:Udt,type:"protected",flag:"featureSearchFeedbackPosting",menu:{}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:DJe,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:MJe,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:SMe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:IE,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:IE,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:IE,hidden:!1,type:"protected",menu:{}},{path:"/integrations/create/:providerId",parent:"/integrations",title:"Create",component:NQe,type:"protected",menu:{}},{path:"/integrations/view/:providerId",parent:"/integrations",title:"View",component:git,type:"protected",menu:{}},{path:"/integrations/edit/:addonId",parent:"/integrations",title:"Edit",component:FQe,type:"protected",menu:{}},{path:"/integrations",title:"Integrations",component:_7e,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/integrations/signals",title:"Signals",component:dht,hidden:!0,type:"protected",menu:{}},{path:"/segments/create",title:"Segments",component:ptt,hidden:!1,type:"protected",layout:"main",menu:{}},{path:"/segments/edit/:segmentId",title:"Segments",component:vtt,hidden:!1,type:"protected",layout:"main",menu:{}},{path:"/segments",title:"Segments",component:Hnt,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/history",title:"Event log",component:LZe,type:"protected",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",component:Yot,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived flags",component:art,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:Iot,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:Oot,type:"protected",menu:{}},{path:"/login",title:"Log in",component:ONe,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:sFe,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:cFe,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:mFe,type:"unprotected",menu:{},isStandalone:!0}],pht=j0.filter(e=>!e.hidden),hht=()=>{const e=pht.filter(o=>o.menu.advanced),t=j0.filter(o=>o.menu.adminSettings),n=j0.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},Yh=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag,notFlag:t.notFlag})),iO=hht(),QEt={users:"User administration",access:"Access control",instance:"Instance configuration",log:"Logs",other:"Other"},HN=[{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/banners",title:"Banners",menu:{adminSettings:!0,mode:["enterprise"]},group:"instance"},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0},group:"instance"},{path:"/admin/license",title:"License",menu:{adminSettings:!0,mode:["enterprise"]},flag:"enableLicense",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 $c=(e=>(e.UNASSIGNED="UNASSIGNED",e.TRIAL="TRIAL",e.ACTIVE="ACTIVE",e.EXPIRED="EXPIRED",e.CHURNED="CHURNED",e))($c||{}),ju=(e=>(e.PRO="Pro",e.COMPANY="Company",e.TEAM="Team",e.ENTERPRISE="Enterprise",e.UNKNOWN="Unknown",e))(ju||{});const ght=(e,t,n)=>{const{data:r,error:o,mutate:i}=Pn(e,t,n),s=m.useCallback(()=>{i().catch(console.warn)},[i]);return{data:r,error:o,refetch:s,loading:!o&&!r}},ZEt=(e,t)=>fetch(e).then(fn(t)).then(n=>n.json()),GQ=()=>{const{uiConfig:e}=ht(),{flags:{UNLEASH_CLOUD:t}}=e,{data:n,refetch:r,loading:o,error:i}=ght(["useInstanceStatus",t],()=>mht(t)),s=[ju.PRO,ju.COMPANY,ju.TEAM];return{instanceStatus:n,refetchInstanceStatus:r,refresh:async()=>{await fetch(Ot("api/instance/refresh"))},isBilling:s.includes((n==null?void 0:n.plan)??ju.UNKNOWN),loading:o,error:i}},mht=async e=>{if(!e)return UN;const t=await fetch(Ot("api/instance/status"));return t.ok?t.json():UN},UN={plan:ju.UNKNOWN},vht=(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"))},sO=()=>{const{uiConfig:e,isPro:t,isEnterprise:n}=ht(),{isBilling:r}=GQ(),o=[...HN];if(e.flags.UNLEASH_CLOUD){const i=HN.findIndex(s=>s.title==="Billing & invoices");o[i]={...o[i],path:"/admin/billing"}}return o.filter(Mf(e)).filter(i=>vht(i==null?void 0:i.menu,{enterprise:n(),pro:t(),billing:r})).map(Df)},qQ=()=>{const{uiConfig:e}=ht(),t=iO(),n=sO();return{routes:{mainNavRoutes:Yh(t.mainNavRoutes).filter(Mf(e)).map(Df),mobileRoutes:Yh(t.mobileRoutes).filter(Mf(e)).map(Df),adminRoutes:n}}},yht=e=>Array.from(new Set(e)),xht=()=>{const[e,t]=TW("navigation-expanded:v1",[]);return[e,(r,o)=>{t(o?yht([...e,r]):e.filter(i=>i!==r))}]},a2=e=>({borderRadius:e.spacing(.5),borderLeft:`${e.spacing(.5)} solid transparent`,"&.Mui-selected":{borderLeft:`${e.spacing(.5)} solid ${e.palette.primary.main}`}}),aO=b(Z)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"160px"}),l2=b(Ti)(({theme:e})=>({minWidth:e.spacing(4),margin:e.spacing(.25,0)})),lO=b(mn)(({theme:e})=>({margin:0})),c2=({href:e,text:t,badge:n,onClick:r,selected:o,children:i})=>a.jsx(za,{disablePadding:!0,onClick:r,children:a.jsxs(K0,{dense:!0,component:ln,to:e,sx:a2,selected:o,children:[a.jsx(l2,{children:i}),a.jsx(lO,{children:a.jsx(aO,{children:t})}),n]})}),bht=({href:e,text:t,children:n})=>a.jsx(za,{disablePadding:!0,children:a.jsxs(K0,{dense:!0,component:ln,to:e,sx:a2,rel:"noopener noreferrer",target:"_blank",children:[a.jsx(l2,{children:n}),a.jsx(lO,{children:a.jsx(aO,{children:t})})]})}),wht=()=>a.jsx("form",{method:"POST",action:`${ki}/logout`,children:a.jsx(za,{disablePadding:!0,children:a.jsxs(K0,{dense:!0,component:"button",type:"submit",sx:a2,children:[a.jsx(l2,{children:a.jsx(S5,{})}),a.jsx(lO,{children:a.jsx(aO,{children:"Sign out"})})]})})}),u2=({href:e,text:t,selected:n,onClick:r,children:o})=>a.jsx(za,{disablePadding:!0,onClick:r,children:a.jsx(K0,{dense:!0,component:ln,to:e,sx:a2,selected:n,children:a.jsx(gt,{title:t,placement:"right",children:a.jsx(l2,{children:o})})})});var cO={},Sht=ze;Object.defineProperty(cO,"__esModule",{value:!0});var YQ=cO.default=void 0,Cht=Sht(He()),jht=a,Eht=(0,Cht.default)((0,jht.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlankOutlined");YQ=cO.default=Eht;var uO={},Tht=ze;Object.defineProperty(uO,"__esModule",{value:!0});var KQ=uO.default=void 0,kht=Tht(He()),_ht=a,Rht=(0,kht.default)((0,_ht.jsx)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"}),"AppsOutlined");KQ=uO.default=Rht;var dO={},Aht=ze;Object.defineProperty(dO,"__esModule",{value:!0});var XQ=dO.default=void 0,Pht=Aht(He()),Oht=a,$ht=(0,Pht.default)((0,Oht.jsx)("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3h7zM7 9H4V5h3v4zm10 6h3v4h-3v-4zm0-10h3v4h-3V5z"}),"AccountTreeOutlined");XQ=dO.default=$ht;var fO={},Iht=ze;Object.defineProperty(fO,"__esModule",{value:!0});var pO=fO.default=void 0,Mht=Iht(He()),Dht=a,Lht=(0,Mht.default)((0,Dht.jsx)("path",{d:"m14 6-1-2H5v17h2v-7h5l1 2h7V6h-6zm4 8h-4l-1-2H7V6h5l1 2h5v6z"}),"OutlinedFlag");pO=fO.default=Lht;var hO={},Nht=ze;Object.defineProperty(hO,"__esModule",{value:!0});var JQ=hO.default=void 0,Fht=Nht(He()),VN=a,Bht=(0,Fht.default)([(0,VN.jsx)("path",{d:"M11 14.17 8.83 12 11 9.83 9.59 8.41 6 12l3.59 3.59zm3.41 1.42L18 12l-3.59-3.59L13 9.83 15.17 12 13 14.17z"},"0"),(0,VN.jsx)("path",{d:"M19 3h-4.18C14.4 1.84 13.3 1 12 1s-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64-.1.23-.16.49-.16.77v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75zM19 15v4H5V5h14v10z"},"1")],"IntegrationInstructionsOutlined");JQ=hO.default=Bht;var gO={},zht=ze;Object.defineProperty(gO,"__esModule",{value:!0});var QQ=gO.default=void 0,Hht=zht(He()),Uht=a,Vht=(0,Hht.default)((0,Uht.jsx)("path",{d:"M13 5.08c3.06.44 5.48 2.86 5.92 5.92h3.03c-.47-4.72-4.23-8.48-8.95-8.95v3.03zM18.92 13c-.44 3.06-2.86 5.48-5.92 5.92v3.03c4.72-.47 8.48-4.23 8.95-8.95h-3.03zM11 18.92c-3.39-.49-6-3.4-6-6.92s2.61-6.43 6-6.92V2.05c-5.05.5-9 4.76-9 9.95 0 5.19 3.95 9.45 9 9.95v-3.03z"}),"DonutLargeOutlined");QQ=gO.default=Vht;var mO={},Wht=ze;Object.defineProperty(mO,"__esModule",{value:!0});var ZQ=mO.default=void 0,Ght=Wht(He()),qht=a,Yht=(0,Ght.default)((0,qht.jsx)("path",{d:"M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z"}),"ExtensionOutlined");ZQ=mO.default=Yht;var vO={},Kht=ze;Object.defineProperty(vO,"__esModule",{value:!0});var eZ=vO.default=void 0,Xht=Kht(He()),Jht=a,Qht=(0,Xht.default)((0,Jht.jsx)("path",{d:"M4 18.99h11c.67 0 1.27-.32 1.63-.83L21 12l-4.37-6.16C16.27 5.33 15.67 5 15 5H4l5 7-5 6.99z"}),"LabelImportantOutlined");eZ=vO.default=Qht;var yO={},Zht=ze;Object.defineProperty(yO,"__esModule",{value:!0});var tZ=yO.default=void 0,egt=Zht(He()),tgt=a,ngt=(0,egt.default)((0,tgt.jsx)("path",{d:"M12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6m0-2C9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96C18.67 6.59 15.64 4 12 4z"}),"CloudOutlined");tZ=yO.default=ngt;var xO={},rgt=ze;Object.defineProperty(xO,"__esModule",{value:!0});var nZ=xO.default=void 0,ogt=rgt(He()),igt=a,sgt=(0,ogt.default)((0,igt.jsx)("path",{d:"M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5zM4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25H4.34zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12zm0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7zm7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44zM15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35z"}),"GroupOutlined");nZ=xO.default=sgt;var bO={},agt=ze;Object.defineProperty(bO,"__esModule",{value:!0});var rZ=bO.default=void 0,lgt=agt(He()),cgt=a,ugt=(0,lgt.default)((0,cgt.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"}),"Computer");rZ=bO.default=ugt;var wO={},dgt=ze;Object.defineProperty(wO,"__esModule",{value:!0});var oZ=wO.default=void 0,fgt=dgt(He()),pgt=a,hgt=(0,fgt.default)((0,pgt.jsx)("path",{d:"M4 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm1.13 1.1c-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29zM20 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4 3.43c0-.81-.48-1.53-1.22-1.85-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57zm-7.76-2.78c-1.17-.52-2.61-.9-4.24-.9-1.63 0-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74zM8.07 16c.09-.23.13-.39.91-.69.97-.38 1.99-.56 3.02-.56s2.05.18 3.02.56c.77.3.81.46.91.69H8.07zM12 8c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m0-2c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"GroupsOutlined");oZ=wO.default=hgt;var SO={},ggt=ze;Object.defineProperty(SO,"__esModule",{value:!0});var iZ=SO.default=void 0,mgt=ggt(He()),Qy=a,vgt=(0,mgt.default)((0,Qy.jsxs)("g",{fillRule:"evenodd",children:[(0,Qy.jsx)("circle",{cx:"17",cy:"15.5",r:"1.12"}),(0,Qy.jsx)("path",{d:"M17 17.5c-.73 0-2.19.36-2.24 1.08.5.71 1.32 1.17 2.24 1.17s1.74-.46 2.24-1.17c-.05-.72-1.51-1.08-2.24-1.08z"}),(0,Qy.jsx)("path",{d:"M18 11.09V6.27L10.5 3 3 6.27v4.91c0 4.54 3.2 8.79 7.5 9.82.55-.13 1.08-.32 1.6-.55C13.18 21.99 14.97 23 17 23c3.31 0 6-2.69 6-6 0-2.97-2.16-5.43-5-5.91zM11 17c0 .56.08 1.11.23 1.62-.24.11-.48.22-.73.3-3.17-1-5.5-4.24-5.5-7.74v-3.6l5.5-2.4 5.5 2.4v3.51c-2.84.48-5 2.94-5 5.91zm6 4c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"})]}),"AdminPanelSettingsOutlined");iZ=SO.default=vgt;var CO={},ygt=ze;Object.defineProperty(CO,"__esModule",{value:!0});var sZ=CO.default=void 0,xgt=ygt(He()),bgt=a,wgt=(0,xgt.default)((0,bgt.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"KeyOutlined");sZ=CO.default=wgt;var jO={},Sgt=ze;Object.defineProperty(jO,"__esModule",{value:!0});var aZ=jO.default=void 0,Cgt=Sgt(He()),jgt=a,Egt=(0,Cgt.default)((0,jgt.jsx)("path",{d:"M7 15h7v2H7zm0-4h10v2H7zm0-4h10v2H7zm12-4h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64-.1.23-.16.49-.16.77v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75zM19 19H5V5h14v14z"}),"AssignmentOutlined");aZ=jO.default=Egt;var EO={},Tgt=ze;Object.defineProperty(EO,"__esModule",{value:!0});var lZ=EO.default=void 0,kgt=Tgt(He()),_gt=a,Rgt=(0,kgt.default)((0,_gt.jsx)("path",{d:"M21 6.5c-1.66 0-3 1.34-3 3 0 .07 0 .14.01.21l-2.03.68c-.64-1.21-1.82-2.09-3.22-2.32V5.91C14.04 5.57 15 4.4 15 3c0-1.66-1.34-3-3-3S9 1.34 9 3c0 1.4.96 2.57 2.25 2.91v2.16c-1.4.23-2.58 1.11-3.22 2.32l-2.04-.68C6 9.64 6 9.57 6 9.5c0-1.66-1.34-3-3-3s-3 1.34-3 3 1.34 3 3 3c1.06 0 1.98-.55 2.52-1.37l2.03.68c-.2 1.29.17 2.66 1.09 3.69l-1.41 1.77C6.85 17.09 6.44 17 6 17c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3c0-.68-.22-1.3-.6-1.8l1.41-1.77c1.36.76 3.02.75 4.37 0l1.41 1.77c-.37.5-.59 1.12-.59 1.8 0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3c-.44 0-.85.09-1.23.26l-1.41-1.77c.93-1.04 1.29-2.4 1.09-3.69l2.03-.68c.53.82 1.46 1.37 2.52 1.37 1.66 0 3-1.34 3-3S22.66 6.5 21 6.5zm-18 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zM6 21c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm5-18c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1zm1 12c-1.38 0-2.5-1.12-2.5-2.5S10.62 10 12 10s2.5 1.12 2.5 2.5S13.38 15 12 15zm6 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm3-8.5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}),"HubOutlined");lZ=EO.default=Rgt;var TO={},Agt=ze;Object.defineProperty(TO,"__esModule",{value:!0});var cZ=TO.default=void 0,Pgt=Agt(He()),Ogt=a,$gt=(0,Pgt.default)((0,Ogt.jsx)("path",{d:"m22.61 18.99-9.08-9.08c.93-2.34.45-5.1-1.44-7C9.79.61 6.21.4 3.66 2.26L7.5 6.11 6.08 7.52 2.25 3.69C.39 6.23.6 9.82 2.9 12.11c1.86 1.86 4.57 2.35 6.89 1.48l9.11 9.11c.39.39 1.02.39 1.41 0l2.3-2.3c.4-.38.4-1.01 0-1.41zm-3 1.6-9.46-9.46c-.61.45-1.29.72-2 .82-1.36.2-2.79-.21-3.83-1.25C3.37 9.76 2.93 8.5 3 7.26l3.09 3.09 4.24-4.24-3.09-3.09c1.24-.07 2.49.37 3.44 1.31 1.08 1.08 1.49 2.57 1.24 3.96-.12.71-.42 1.37-.88 1.96l9.45 9.45-.88.89z"}),"BuildOutlined");cZ=TO.default=$gt;var kO={},Igt=ze;Object.defineProperty(kO,"__esModule",{value:!0});var uZ=kO.default=void 0,Mgt=Igt(He()),Dgt=a,Lgt=(0,Mgt.default)((0,Dgt.jsx)("path",{d:"M2 7h4v10H2V7zm5 12h10V5H7v14zM18 7h4v10h-4V7z"}),"ViewCarousel");uZ=kO.default=Lgt;var _O={},Ngt=ze;Object.defineProperty(_O,"__esModule",{value:!0});var dZ=_O.default=void 0,Fgt=Ngt(He()),Bgt=a,zgt=(0,Fgt.default)((0,Bgt.jsx)("path",{d:"M19.88 18.47c.44-.7.7-1.51.7-2.39 0-2.49-2.01-4.5-4.5-4.5s-4.5 2.01-4.5 4.5 2.01 4.5 4.49 4.5c.88 0 1.7-.26 2.39-.7L21.58 23 23 21.58l-3.12-3.11zm-3.8.11c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm-.36-8.5c-.74.02-1.45.18-2.1.45l-.55-.83-3.8 6.18-3.01-3.52-3.63 5.81L1 17l5-8 3 3.5L13 6l2.72 4.08zm2.59.5c-.64-.28-1.33-.45-2.05-.49L21.38 2 23 3.18l-4.69 7.4z"}),"QueryStatsOutlined");dZ=_O.default=zgt;var RO={},Hgt=ze;Object.defineProperty(RO,"__esModule",{value:!0});var fZ=RO.default=void 0,Ugt=Hgt(He()),WN=a,Vgt=(0,Ugt.default)([(0,WN.jsx)("path",{d:"M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2l-1.5 1.5zM15 20H6c-.55 0-1-.45-1-1v-1h10v2zm4-1c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11v14z"},"0"),(0,WN.jsx)("path",{d:"M9 7h6v2H9zm7 0h2v2h-2zm-7 3h6v2H9zm7 0h2v2h-2z"},"1")],"ReceiptLongOutlined");fZ=RO.default=Vgt;var AO={},Wgt=ze;Object.defineProperty(AO,"__esModule",{value:!0});var pZ=AO.default=void 0,Ggt=Wgt(He()),qgt=a,Ygt=(0,Ggt.default)((0,qgt.jsx)("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5l-8-3zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25v4.7z"}),"ShieldOutlined");pZ=AO.default=Ygt;var PO={},Kgt=ze;Object.defineProperty(PO,"__esModule",{value:!0});var hZ=PO.default=void 0,Xgt=Kgt(He()),Jgt=a,Qgt=(0,Xgt.default)((0,Jgt.jsx)("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"}),"HistoryOutlined");hZ=PO.default=Qgt;var OO={},Zgt=ze;Object.defineProperty(OO,"__esModule",{value:!0});var gZ=OO.default=void 0,emt=Zgt(He()),tmt=a,nmt=(0,emt.default)((0,tmt.jsx)("path",{d:"M2 20h20v-4H2v4zm2-3h2v2H4v-2zM2 4v4h20V4H2zm4 3H4V5h2v2zm-4 7h20v-4H2v4zm2-3h2v2H4v-2z"}),"StorageOutlined");gZ=OO.default=nmt;var $O={},rmt=ze;Object.defineProperty($O,"__esModule",{value:!0});var mZ=$O.default=void 0,omt=rmt(He()),imt=a,smt=(0,omt.default)((0,imt.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"}),"CreditCardOutlined");mZ=$O.default=smt;var IO={},amt=ze;Object.defineProperty(IO,"__esModule",{value:!0});var vZ=IO.default=void 0,lmt=amt(He()),cmt=a,umt=(0,lmt.default)((0,cmt.jsx)("path",{d:"M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V9h14v10zM5 7V5h14v2H5zm2 4h10v2H7zm0 4h7v2H7z"}),"EventNoteOutlined");vZ=IO.default=umt;const dmt={"/applications":KQ,"/context":XQ,"/feature-toggle-type":pO,"/integrations":JQ,"/segments":QQ,"/strategies":ZQ,"/tag-types":eZ,"/environments":tZ,"/admin/users":nZ,"/admin/service-accounts":rZ,"/admin/groups":oZ,"/admin/roles":iZ,"/admin/api":sZ,"/admin/auth":aZ,"/admin/network":lZ,"/admin/maintenance":cZ,"/admin/banners":uZ,"/admin/instance":dZ,"/admin/license":fZ,"/admin/instance-privacy":pZ,"/admin/logins":hZ,"/admin/cors":gZ,"/admin/billing":mZ,"/history":vZ,GitHub:MS,Documentation:DS},fmt=e=>dmt[e]||YQ,yZ=({path:e})=>{const t=fmt(e);return a.jsx(t,{})},xZ=b(mC)(({theme:e})=>({fill:e.palette.neutral.main,stroke:e.palette.neutral.main,width:e.spacing(3),height:e.spacing(3),fontSize:e.spacing(3)}));var MO={},pmt=ze;Object.defineProperty(MO,"__esModule",{value:!0});var bZ=MO.default=void 0,hmt=pmt(He()),gmt=a,mmt=(0,hmt.default)((0,gmt.jsx)("path",{d:"m22 2-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixNormal");bZ=MO.default=mmt;var DO={},vmt=ze;Object.defineProperty(DO,"__esModule",{value:!0});var wZ=DO.default=void 0,ymt=vmt(He()),GN=a,xmt=(0,ymt.default)([(0,GN.jsx)("path",{d:"M21 8c-1.45 0-2.26 1.44-1.93 2.51l-3.55 3.56c-.3-.09-.74-.09-1.04 0l-2.55-2.55C12.27 10.45 11.46 9 10 9c-1.45 0-2.27 1.44-1.93 2.52l-4.56 4.55C2.44 15.74 1 16.55 1 18c0 1.1.9 2 2 2 1.45 0 2.26-1.44 1.93-2.51l4.55-4.56c.3.09.74.09 1.04 0l2.55 2.55C12.73 16.55 13.54 18 15 18c1.45 0 2.27-1.44 1.93-2.52l3.56-3.55c1.07.33 2.51-.48 2.51-1.93 0-1.1-.9-2-2-2z"},"0"),(0,GN.jsx)("path",{d:"m15 9 .94-2.07L18 6l-2.06-.93L15 3l-.92 2.07L12 6l2.08.93zM3.5 11 4 9l2-.5L4 8l-.5-2L3 8l-2 .5L3 9z"},"1")],"Insights");wZ=DO.default=xmt;const bmt=b("div")(({theme:e})=>({paddingLeft:e.spacing(2),display:"flex"})),wmt=()=>a.jsx(gt,{title:"This is an Enterprise feature",children:a.jsx(bmt,{children:a.jsx(E5,{})})}),Smt=()=>{const{isPro:e}=ht();return m.useCallback(n=>!!(e()&&!(n!=null&&n.includes("pro"))&&(n!=null&&n.includes("enterprise"))),[e])},Zb=({routes:e,mode:t,onClick:n,activeItem:r})=>{const o=Smt(),i=t==="mini"?u2:c2;return a.jsx(ns,{children:e.map(s=>{var l;return a.jsx(i,{onClick:()=>n(s.path),href:s.path,text:s.title,selected:r===s.path,badge:o((l=s==null?void 0:s.menu)==null?void 0:l.mode)?a.jsx(wmt,{}):null,children:a.jsx(yZ,{path:s.path})},s.title)})})},Cmt=()=>{const{uiConfig:e}=ht();return a.jsxs(ns,{children:[e.links.map(t=>a.jsx(bht,{href:t.href,text:t.value,children:a.jsx(yZ,{path:t.value})},t.value)),a.jsx(wht,{})]})},jmt=({projectId:e,mode:t,onClick:n})=>{const r=t==="mini"?u2:c2;return a.jsx(ns,{children:a.jsx(r,{href:`/projects/${e}`,text:e,onClick:n,selected:!1,children:a.jsx(xZ,{})})})},Emt=({flags:e,mode:t,onClick:n})=>{const r=t==="mini"?u2:c2;return a.jsx(ns,{children:e.map(o=>a.jsx(r,{href:`/projects/${o.projectId}/features/${o.featureId}`,text:o.featureId,onClick:n,selected:!1,children:a.jsx(pO,{})},o.featureId))})},SZ=({mode:e,onClick:t,activeItem:n})=>{const r=e==="mini"?u2:c2,o=Nr("killInsightsUI"),{isOss:i}=ht();return a.jsxs(ns,{children:[a.jsx(r,{href:"/projects",text:"Projects",onClick:()=>t("/projects"),selected:n==="/projects",children:a.jsx(xZ,{})}),a.jsx(r,{href:"/search",text:"Search",onClick:()=>t("/search"),selected:n==="/search",children:a.jsx(md,{})}),a.jsx(r,{href:"/playground",text:"Playground",onClick:()=>t("/playground"),selected:n==="/playground",children:a.jsx(bZ,{})}),a.jsx(W,{condition:!o&&!i(),show:a.jsx(r,{href:"/insights",text:"Insights",onClick:()=>t("/insights"),selected:n==="/insights",children:a.jsx(wZ,{})})})]})},Tmt=({children:e})=>a.jsx(Zf,{expandIcon:a.jsx(n1,{}),"aria-controls":"configure-content",id:"configure-header",children:a.jsx(Z,{sx:{fontWeight:"bold",fontSize:"small"},children:e})}),qN=({mode:e,expanded:t,onExpandChange:n,title:r,children:o})=>a.jsxs(Jf,{disableGutters:!0,sx:{boxShadow:"none","&:before":{display:"none"}},expanded:t,onChange:(i,s)=>{n(s)},children:[e==="full"&&a.jsx(Tmt,{children:r}),a.jsx(Qf,{sx:{p:0},children:o})]}),kmt=({mode:e,onClick:t,projectId:n})=>a.jsxs(ne,{children:[e==="full"&&a.jsx(Z,{sx:{fontWeight:"bold",fontSize:"small",ml:2,mt:1.5},children:"Recent project"}),a.jsx(jmt,{projectId:n,mode:e,onClick:t})]}),_mt=({mode:e,onClick:t,flags:n})=>a.jsxs(ne,{children:[e==="full"&&a.jsx(Z,{sx:{fontWeight:"bold",fontSize:"small",ml:2},children:"Recent flags"}),a.jsx(Emt,{flags:n,mode:e,onClick:t})]}),Rmt=e=>{const t=e.split("/").filter(o=>o);return t.length===0||t[0]==="admin"&&t.length===1?"/projects":t[0]==="admin"&&t.length>1?`/${t[0]}/${t[1]}`:`/${t[0]}`},Amt=()=>{const{pathname:e,state:t}=Ao();return Rmt(e)},CZ=(e,t)=>{const n=m.useCallback(()=>{const r=new CustomEvent(e);document.dispatchEvent(r)},[e]);return m.useEffect(()=>{const r=o=>t(o);return document.addEventListener(e,r),()=>{document.removeEventListener(e,r)}},[e,t]),{emitEvent:n}},jZ=()=>{const e=`${ki}:unleash-lastViewedProject`,[t,n]=m.useState(()=>_f(e)),{emitEvent:r}=CZ("lastViewedProjectUpdated",()=>{n(_f(e))});return m.useEffect(()=>{t&&(Rf(e,t),r())},[t,e,r]),{lastViewed:t,setLastViewed:n}},YN=3,EZ=e=>Array.isArray(e)?e.filter(t=>t.featureId&&t.projectId):[],KN=e=>EZ(_f(e)||[]),Pmt=()=>{const e=`${ki}:unleash-lastViewedFlags`,[t,n]=m.useState(()=>KN(e)),{emitEvent:r}=CZ("lastViewedFlagsUpdated",m.useCallback(()=>{n(KN(e))},[e]));m.useEffect(()=>{t&&(Rf(e,t),r())},[JSON.stringify(t),e,r]);const o=m.useCallback(i=>{if(!i.featureId||!i.projectId||t.find(l=>l.featureId===i.featureId))return;const s=EZ([...t,i]);n(s.length>YN?s.slice(-YN):s)},[JSON.stringify(t)]);return{lastViewed:t,setLastViewed:o}},Omt=({onClick:e})=>{const{routes:t}=qQ();return a.jsxs(a.Fragment,{children:[a.jsx(SZ,{mode:"full",onClick:e}),a.jsx(Zb,{routes:t.mainNavRoutes,mode:"full",onClick:e}),a.jsx(Zb,{routes:t.adminRoutes,mode:"full",onClick:e}),a.jsx(Cmt,{})]})},$mt=b(ne)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(2),alignSelf:"stretch",display:"flex",flexDirection:"column",gap:e.spacing(2),zIndex:1,overflowAnchor:"none"})),Imt=()=>{const{routes:e}=qQ(),[t,n]=JCe(),[r,o]=xht(),i=Amt(),[s,l]=m.useState(i),{lastViewed:c}=jZ(),u=t==="full"&&c,{lastViewed:d}=Pmt(),f=t==="full"&&d.length>0;return a.jsxs($mt,{children:[a.jsx(SZ,{mode:t,onClick:l,activeItem:s}),a.jsx(qN,{expanded:r.includes("configure"),onExpandChange:p=>{o("configure",p)},mode:t,title:"Configure",children:a.jsx(Zb,{routes:e.mainNavRoutes,mode:t,onClick:l,activeItem:s})}),t==="full"&&a.jsx(qN,{expanded:r.includes("admin"),onExpandChange:p=>{o("admin",p)},mode:t,title:"Admin",children:a.jsx(Zb,{routes:e.adminRoutes,mode:t,onClick:l,activeItem:s})}),t==="mini"&&a.jsx(f2e,{onChange:()=>{o("admin",!0),n("full")}}),u&&a.jsx(kmt,{mode:t,projectId:c,onClick:()=>l("/projects")}),f&&a.jsx(_mt,{mode:t,flags:d,onClick:()=>l("/projects")}),a.jsx(u2e,{mode:t,onChange:()=>{n(t==="full"?"mini":"full")}})]})},Mmt=b("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"start","& svg":{width:"100%",height:"100%",maxHeight:e.spacing(8),padding:e.spacing(.5)}})),TZ=({links:e=[],open:t=!1,toggleDrawer:n,routes:r})=>{const o=Nr("navigationSidebar"),i=()=>e.map(s=>{let l=null;return s.value==="GitHub"?l=a.jsx(MS,{className:ka.navigationIcon}):s.value==="Documentation"&&(l=a.jsx(DS,{className:ka.navigationIcon})),a.jsxs("a",{href:s.href,rel:"noopener noreferrer",target:"_blank",className:ka.iconLink,children:[l,s.value]},s.value)});return a.jsx(kme,{className:ka.drawer,open:t,anchor:"left",onClose:n,style:{zIndex:Xo.zIndex.snackbar+1},children:a.jsxs("nav",{id:"header-drawer",className:ka.drawerContainer,children:[a.jsx(Mmt,{children:a.jsx(ln,{to:"/",className:ka.drawerTitle,"aria-label":"Home",onClick:()=>n(),children:a.jsx(hd,{darkmode:a.jsx(y5,{"aria-label":"Unleash logo"}),lightmode:a.jsx(v5,{"aria-label":"Unleash logo"})})})}),a.jsx(vr,{}),a.jsx(W,{condition:!!o,show:a.jsx(Omt,{onClick:n}),elseShow:a.jsxs(a.Fragment,{children:[a.jsx(ns,{className:ka.drawerList,children:r.mobileRoutes.map(s=>a.jsx(w6,{handleClose:()=>n(),path:s.path,text:s.title},s.path))}),a.jsx(vr,{}),a.jsx(ns,{className:ka.drawerList,children:r.adminRoutes.map(s=>{var l;return a.jsx(w6,{handleClose:()=>n(),path:s.path,text:s.title,mode:(l=s.menu)==null?void 0:l.mode},s.path)})}),a.jsx(vr,{}),a.jsxs("div",{className:ka.iconLinkList,children:[i(),a.jsxs("a",{className:ka.iconLink,href:`${ki}/logout`,children:[a.jsx(S5,{className:ka.navigationIcon}),"Sign out"]})]})]})})]})})};var LO={},Dmt=ze;Object.defineProperty(LO,"__esModule",{value:!0});var NO=LO.default=void 0,Lmt=Dmt(He()),Nmt=a,Fmt=(0,Lmt.default)((0,Nmt.jsx)("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49zM12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"}),"DarkModeOutlined");NO=LO.default=Fmt;var FO={},Bmt=ze;Object.defineProperty(FO,"__esModule",{value:!0});var BO=FO.default=void 0,zmt=Bmt(He()),Hmt=a,Umt=(0,zmt.default)((0,Hmt.jsx)("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"}),"LightModeOutlined");BO=FO.default=Umt;const Vmt=(e={})=>{const t=Ot("api/admin/notifications"),{data:n,error:r,mutate:o}=Pn(t,Wmt,e),i=m.useCallback(()=>{o().catch(console.warn)},[o]);return{notifications:n,error:r,loading:!r&&!n,refetchNotifications:i,mutateNotifications:o}},Wmt=async e=>await(await fetch(e).then(fn("Notifications"))).json();var zO={},Gmt=ze;Object.defineProperty(zO,"__esModule",{value:!0});var HO=zO.default=void 0,qmt=Gmt(He()),Ymt=a,Kmt=(0,qmt.default)((0,Ymt.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");HO=zO.default=Kmt;const Xmt=b(ne)(({theme:e})=>({padding:e.spacing(1,1.5,1,3),display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",boxShadow:e.boxShadows.separator})),Jmt=({children:e})=>a.jsx(a.Fragment,{children:a.jsxs(Xmt,{children:[a.jsx(Z,{fontWeight:"bold",children:"Notifications"}),e]})}),Qmt=b(ns)(({theme:e})=>({padding:e.spacing(1,1,3,1)})),Zmt=({children:e})=>a.jsx(Qmt,{"data-testid":"NOTIFICATIONS_LIST",children:e});var UO={},evt=ze;Object.defineProperty(UO,"__esModule",{value:!0});var kZ=UO.default=void 0,tvt=evt(He()),nvt=a,rvt=(0,tvt.default)((0,nvt.jsx)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"ToggleOffOutlined");kZ=UO.default=rvt;const XN=b(ne,{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})),ovt=b(K0)(({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}})),ivt=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%"})),svt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(1,0,0,5.25)})),avt=b(Z,{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"})),lvt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),cvt=b(ne)(({theme:e})=>({...tp})),uvt=b(hg)(({theme:e})=>({width:"18px",height:"18px"})),dvt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.neutral.main,marginLeft:e.spacing(1)})),fvt=({notification:e,onNotificationClick:t})=>{const n=It(),{readAt:r}=e,o=i=>{if(i==="change-request")return a.jsx(XN,{readAt:!!r,children:a.jsx(yP,{color:e.readAt?n.palette.neutral.main:n.palette.primary.main,style:{transform:"scale(0.8)"}})});if(i==="toggle")return a.jsx(XN,{readAt:!!r,children:a.jsx(kZ,{sx:s=>({height:"20px",width:"20px",color:r?s.palette.neutral.main:s.palette.primary.main})})})};return a.jsx(ovt,{onClick:()=>t(e),children:a.jsxs(ivt,{children:[a.jsxs(avt,{readAt:!!r,children:[o(e.notificationType)," ",e.message]}),a.jsxs(svt,{children:[a.jsxs(cvt,{children:[a.jsx(uvt,{src:e.createdBy.imageUrl||""}),a.jsxs(dvt,{children:["Created by ",e.createdBy.username]})]}),a.jsx(lvt,{children:a.jsx(Lc,{date:new Date(e.createdAt),minPeriod:60})})]})]})})},pvt=b(ne)(()=>({display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",minHeight:"150px"})),hvt=b(HO)(({theme:e})=>({height:"30px",width:"30px",color:e.palette.neutral.main,marginBottom:e.spacing(1)})),gvt=({text:e})=>a.jsxs(pvt,{children:[a.jsx(hvt,{}),a.jsx(Z,{color:"neutral.main",children:e})]}),mvt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{loading:r,errors:n,markAsRead:async i=>{const l=t("api/admin/notifications/read",{method:"POST",body:JSON.stringify(i)});await e(l.caller,l.id)}}},vvt=b(ne)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginTop:e.spacing(.5)})),yvt=({id:e,localStorageKey:t,eventName:n})=>{var d;const{uiConfig:r}=ht(),{value:o,setValue:i}=Xl(`${r.baseUriPath}:${t}:v1:${e}`,{}),[s,l]=m.useState(o.value),{trackEvent:c}=Sn();if(!((d=r==null?void 0:r.flags)!=null&&d.T)||s)return null;const u=f=>{l(f),i({value:f}),c(n,{props:{eventType:e,wasHelpful:f==="yes"}})};return a.jsxs(xr,{elevation:0,sx:{background:f=>f.palette.neutral.light,padding:f=>f.spacing(1.5,2),marginTop:f=>f.spacing(1.5)},children:["Was this information useful to you?",a.jsxs(vvt,{children:[a.jsx(We,{size:"small",variant:s==="yes"?"contained":"outlined",sx:{padding:0},onClick:()=>u("yes"),disabled:!!s,children:"Yes"}),a.jsx(We,{size:"small",variant:s==="no"?"contained":"outlined",sx:{padding:0},onClick:()=>u("no"),disabled:!!s,children:"No"})]})]})},xvt=b(ne)(()=>({position:"relative"})),bvt=b(ne)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,display:"flex",justifyContent:"center"})),wvt=b(Z)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,textAlign:"center"})),Svt=b(xr)(({theme:e})=>({width:"420px",boxShadow:e.boxShadows.popup,borderRadius:`${e.shape.borderRadiusLarge}px`,position:"absolute",right:-100,top:60,maxHeight:"80vh",overflowY:"auto"})),Cvt=b(ne)(({theme:e})=>({backgroundColor:e.palette.primary.main,borderRadius:"100%",width:"7px",height:"7px",position:"absolute",top:11,right:11})),jvt=b(ne)(()=>({...tp})),Evt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Tvt=b(Ht)(({theme:e})=>({"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),_Z=()=>{const[e,t]=m.useState(!1),{notifications:n,refetchNotifications:r}=Vmt({refreshInterval:15e3}),o=$t(),{markAsRead:i}=mvt(),{uiConfig:s}=ht(),{trackEvent:l}=Sn(),[c,u]=m.useState(!1),d=async w=>{var S;w.link&&o(w.link),(S=s==null?void 0:s.flags)!=null&&S.T&&l("notifications",{props:{eventType:w.notificationType}}),t(!1);try{await i({notifications:[w.id]}),r()}catch(C){console.error("Error marking notification as read: ",C)}},f=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)}},p=w=>{w.key==="Escape"&&t(!1)},h=n==null?void 0:n.filter(w=>w.readAt===null),g=!!(h&&h.length>0),v=w=>c?!w.readAt:!0,x=n==null?void 0:n.filter(v).map(w=>a.jsx(fvt,{notification:w,onNotificationClick:d},w.id)),y=!!(n&&n.length>0&&!c);return a.jsxs(xvt,{children:[a.jsx(gt,{title:"Notifications",arrow:!0,children:a.jsxs(Tvt,{onClick:()=>t(!e),"data-testid":"NOTIFICATIONS_BUTTON",size:"large",children:[a.jsx(W,{condition:g,show:a.jsx(Cvt,{})}),a.jsx(HO,{})]})}),a.jsx(W,{condition:e,show:a.jsx(pS,{onClickAway:()=>t(!1),children:a.jsxs(Svt,{className:"dropdown-outline",onKeyDown:p,"data-testid":"NOTIFICATIONS_MODAL",children:[a.jsx(Jmt,{children:a.jsxs(jvt,{children:[a.jsx(Evt,{children:"Show only unread"}),a.jsx(is,{onClick:()=>u(!c),checked:c})]})}),a.jsx(W,{condition:g,show:a.jsx(bvt,{"data-testid":"UNREAD_NOTIFICATIONS",children:a.jsx(We,{onClick:f,children:a.jsxs(wvt,{children:["Mark all as read (",h==null?void 0:h.length,")"]})})})})," ",a.jsx(W,{condition:(x==null?void 0:x.length)===0,show:a.jsx(gvt,{text:c?"No unread notifications":"No new notifications"})}),a.jsx(Zmt,{children:x}),a.jsx(W,{condition:y,show:a.jsxs(a.Fragment,{children:[a.jsx(yvt,{eventName:"notifications",id:"useful",localStorageKey:"NotificationsUsefulPrompt"}),a.jsx("br",{})]})})]})})})]})};var VO={},kvt=ze;Object.defineProperty(VO,"__esModule",{value:!0});var RZ=VO.default=void 0,_vt=kvt(He()),Rvt=a,Avt=(0,_vt.default)((0,Rvt.jsx)("path",{d:"M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"PersonAdd");RZ=VO.default=Avt;const AZ="api/admin/invite-link/tokens",Pvt=()=>{const e=Ot(AZ);return fetch(e,{method:"GET"}).then(t=>t.json())},Ovt=(e={})=>{var i;const{data:t,error:n}=Pn(AZ,Pvt,e),[r,o]=m.useState(!n&&!t);return m.useEffect(()=>{o(!n&&!t)},[t,n]),{data:t?{tokens:(i=t.tokens)==null?void 0:i.filter(s=>s.enabled)}:void 0,error:n,loading:r}},$vt=b(ne)(()=>({mb:{xs:1,md:0},display:"flex",justifyContent:"center",flexDirection:"column"})),Ivt=b(ne)(()=>({display:"flex",alignItems:"center",flexGrow:1})),Mvt=({onActionClick:e})=>{var x,y,w,S,C;const t=$t(),{data:n,loading:r}=Ovt(),o=gd(r);Sn();const i=((x=n==null?void 0:n.tokens)==null?void 0:x.find(E=>E.name==="default"))??null,s=i==null?void 0:i.url,l=((w=(y=n==null?void 0:n.tokens)==null?void 0:y[0])==null?void 0:w.createdAt)??"",u=(((C=(S=n==null?void 0:n.tokens)==null?void 0:S[0])==null?void 0:C.expiresAt)??"")||!1,d=!!(u&&wv(new Date,Js(u))),f=u&&wv(Zje(new Date,{days:14}),Js(u)),p=u?pG(Js(u)):!1,{locationSettings:h}=Mi(),g=a.jsx(Z,{component:"span",variant:"body2",color:f?"warning.dark":"inherit",fontWeight:"bold",children:p}),v=()=>{e==null||e(s),t("/admin/invite-link")};return a.jsxs(a.Fragment,{children:[a.jsx($vt,{ref:o,children:a.jsx(W,{condition:!!s,show:a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"body2",sx:{mb:1},children:[`You have an invite link created on ${If(l,h.locale)} `,a.jsx(W,{condition:d,show:a.jsxs(a.Fragment,{children:["that expired ",g," ","ago"]}),elseShow:a.jsxs(a.Fragment,{children:["that will expire in"," ",g]})})]}),a.jsx(AJ,{small:!0,inviteLink:s})]}),elseShow:a.jsx(Z,{variant:"body2","data-loading":!0,children:"You can easily create an invite link here that you can share and use to invite people from your company to your Unleash setup."})})}),a.jsx(Ivt,{sx:{justifyContent:{xs:"center",md:"flex-end"}},children:a.jsxs(We,{variant:"outlined",onClick:v,"data-loading":!0,children:[s?"Update":"Create"," invite link"]})})]})},Dvt=b(xr)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),alignItems:"flex-start",padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium,boxShadow:e.boxShadows.popup,position:"absolute",zIndex:5e3,right:-255,minWidth:e.spacing(80),[e.breakpoints.down("md")]:{width:"100%",padding:"1rem"}})),Lvt=({id:e,showInviteLinkContent:t,setShowInviteLinkContent:n})=>{const{trackEvent:r}=Sn(),o=i=>{n(!1),r("invite",{props:{eventType:i?"header link bar action: edit":"header link bar action: create"}})};return a.jsx(W,{condition:t,show:a.jsx(Dvt,{className:"dropdown-outline",id:e,children:a.jsx(Mvt,{onActionClick:o})})})},Nvt=b("div")(()=>({position:"relative"})),Fvt=b(Ht)(({theme:e})=>({...Kl(e),borderRadius:100,"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),PZ=()=>{const[e,t]=m.useState(!1),n=Dc(),{isAdmin:r}=m.useContext(Di);return r?a.jsx(pS,{onClickAway:()=>t(!1),children:a.jsxs(Nvt,{children:[a.jsx(gt,{title:"Invite users",arrow:!0,children:a.jsx(Fvt,{onClick:()=>t(!0),size:"large",children:a.jsx(RZ,{})})}),a.jsx(Lvt,{showInviteLinkContent:e,setShowInviteLinkContent:t,id:n})]})}):null},JN=b(BU)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300,paddingRight:e.spacing(9),[e.breakpoints.down("lg")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.down(1024)]:{marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"},margin:"0 auto"})),QN=b(ne)(()=>({display:"flex",alignItems:"center",width:"100%","&&&":{padding:0}})),ZN=b("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),Bvt=b("nav")({display:"flex",alignItems:"center",flexGrow:1}),zvt=b(y5)({width:"150px"}),Hvt=b(v5)({width:"150px"}),Uvt=b(yW)({width:"150px"});b("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}}));const Vvt=b(ln)(({theme:e})=>Kl(e));b("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)}));const eF=b(Ht)(({theme:e})=>({borderRadius:100,"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),Wvt=()=>{const{onSetThemeMode:e,themeMode:t}=kS(),n=It(),r=Nr("disableNotifications"),{uiConfig:o,isOss:i}=ht(),s=Qn(n.breakpoints.down("lg")),[l,c]=m.useState(!1),u=()=>c(g=>!g),d=Nr("celebrateUnleash"),f=iO(),p=sO(),h={mainNavRoutes:Yh(f.mainNavRoutes).filter(Mf(o)).map(Df),mobileRoutes:Yh(f.mobileRoutes).filter(Mf(o)).map(Df),adminRoutes:p};return s?a.jsx(JN,{position:"static",children:a.jsxs(QN,{children:[a.jsx(gt,{title:"Menu",arrow:!0,children:a.jsx(Ht,{sx:{color:g=>g.palette.text.primary},onClick:u,"aria-controls":"header-drawer","aria-expanded":l,size:"large",children:a.jsx(c5,{})})}),a.jsx(TZ,{links:o.links,open:l,toggleDrawer:u,routes:h}),a.jsx(ZN,{children:a.jsx(mb,{})})]})}):a.jsx(JN,{position:"static",children:a.jsxs(QN,{children:[a.jsx(Vvt,{to:"/",sx:tp,"aria-label":"Home",children:a.jsx(hd,{darkmode:a.jsx(W,{condition:d,show:a.jsx(xW,{}),elseShow:a.jsx(zvt,{"aria-label":"Unleash logo"})}),lightmode:a.jsx(W,{condition:d,show:a.jsx(Uvt,{}),elseShow:a.jsx(Hvt,{"aria-label":"Unleash logo"})})})}),a.jsx(Bvt,{children:a.jsxs(ZN,{children:[a.jsx(PZ,{}),a.jsx(gt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:a.jsx(eF,{onClick:e,size:"large",children:a.jsx(W,{condition:t==="dark",show:a.jsx(NO,{}),elseShow:a.jsx(BO,{})})})}),a.jsx(W,{condition:!i()&&!r,show:a.jsx(_Z,{})}),a.jsx(gt,{title:"Documentation",arrow:!0,children:a.jsx(eF,{component:"a",href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",sx:{mr:1},children:a.jsx(IS,{})})}),a.jsx(vr,{orientation:"vertical",variant:"middle",flexItem:!0,sx:{ml:1}}),a.jsx(mb,{})]})})]})})},Gvt=b(ln)(({theme:e})=>({textDecoration:"none",alignItems:"center",display:"flex",color:"inherit",height:"100%",width:"100%","&&":{padding:e.spacing(1,2)}})),qvt=b("span")(({theme:e})=>({width:"12.5px",height:"12.5px",display:"block",backgroundColor:e.palette.primary.main,marginRight:e.spacing(2),borderRadius:"2px"})),Yvt=b("div")(({theme:e})=>({marginLeft:"auto",paddingLeft:e.spacing(2),display:"flex"})),tF=({options:e,id:t,handleClose:n,anchorEl:r,style:o})=>{const{isPro:i,isOss:s}=ht(),l=m.useCallback(c=>!!(i()&&!(c!=null&&c.includes("pro"))&&(c!=null&&c.includes("enterprise"))),[i]);return a.jsx(J0,{id:t,onClose:n,anchorEl:r,open:!!r,style:o,children:e.flatMap((c,u)=>{var p,h,g;const d=(p=e[u-1])==null?void 0:p.group;return[d&&d!==c.group&&(!s()||c.group==="log")?a.jsx(vr,{variant:"middle"},c.group):null,a.jsx(gt,{title:l((h=c==null?void 0:c.menu)==null?void 0:h.mode)?"This is an Enterprise feature":"",arrow:!0,placement:"left",children:a.jsxs(Mo,{component:Gvt,to:c.path,onClick:n,children:[a.jsx(qvt,{}),c.title,a.jsx(W,{condition:l((g=c==null?void 0:c.menu)==null?void 0:g.mode),show:a.jsx(Yvt,{children:a.jsx(E5,{})})})]})},c.path)]}).filter(Boolean)})},nF=b(BU)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300,maxWidth:"1512px",[e.breakpoints.down("lg")]:{maxWidth:"1280px",paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.down(1024)]:{marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"},margin:"0 auto"})),rF=b(ne)(()=>({display:"flex",alignItems:"center",width:"100%","&&&":{padding:0}})),oF=b("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),Kvt=b("nav")({display:"flex",alignItems:"center",flexGrow:1}),Xvt=b(y5)({width:"150px"}),Jvt=b(v5)({width:"150px"}),Qvt=b(yW)({width:"150px"}),Zvt=b("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),e0t=b("button")(({theme:e})=>({...Kl(e),border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),t0t=e=>({color:e.palette.neutral.main}),_m=b(ln)(({theme:e})=>Kl(e));b("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)}));const nT=b(Ht)(({theme:e})=>({borderRadius:100,"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),n0t=()=>{const{onSetThemeMode:e,themeMode:t}=kS(),n=It(),r=Dc(),o=Dc(),[i,s]=m.useState(null),[l,c]=m.useState(null),u=Nr("disableNotifications"),{uiConfig:d,isOss:f}=ht(),p=Qn(n.breakpoints.down("md")),[h,g]=m.useState(!1),v=()=>g(k=>!k),x=()=>s(null),y=()=>c(null),w=Nr("celebrateUnleash"),S=Nr("killInsightsUI"),C=iO(),E=sO(),j={mainNavRoutes:Yh(C.mainNavRoutes).filter(Mf(d)).map(Df),mobileRoutes:Yh(C.mobileRoutes).filter(Mf(d)).map(Df),adminRoutes:E};return p?a.jsx(nF,{position:"static",children:a.jsxs(rF,{children:[a.jsx(gt,{title:"Menu",arrow:!0,children:a.jsx(Ht,{sx:{color:k=>k.palette.text.primary},onClick:v,"aria-controls":"header-drawer","aria-expanded":h,size:"large",children:a.jsx(c5,{})})}),a.jsx(TZ,{links:d.links,open:h,toggleDrawer:v,routes:j}),a.jsx(oF,{children:a.jsx(mb,{})})]})}):a.jsx(nF,{position:"static",children:a.jsxs(rF,{children:[a.jsx(_m,{to:"/",sx:tp,"aria-label":"Home",children:a.jsx(hd,{darkmode:a.jsx(W,{condition:w,show:a.jsx(xW,{}),elseShow:a.jsx(Xvt,{"aria-label":"Unleash logo"})}),lightmode:a.jsx(W,{condition:w,show:a.jsx(Qvt,{}),elseShow:a.jsx(Jvt,{"aria-label":"Unleash logo"})})})}),a.jsxs(Kvt,{children:[a.jsxs(Zvt,{children:[a.jsx(_m,{to:"/projects",children:"Projects"}),a.jsx(_m,{to:"/search",children:"Search"}),a.jsx(_m,{to:"/playground",children:"Playground"}),a.jsx(W,{condition:!S&&!f(),show:a.jsx(_m,{to:"/insights",children:"Insights"})}),a.jsxs(e0t,{onClick:k=>c(k.currentTarget),"aria-controls":l?o:void 0,"aria-expanded":!!l,children:["Configure",a.jsx(B5,{sx:t0t})]}),a.jsx(tF,{id:o,options:j.mainNavRoutes,anchorEl:l,handleClose:y,style:{top:10}})]}),a.jsxs(oF,{children:[a.jsx(PZ,{}),a.jsx(gt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:a.jsx(nT,{onClick:e,size:"large",children:a.jsx(W,{condition:t==="dark",show:a.jsx(NO,{}),elseShow:a.jsx(BO,{})})})}),a.jsx(W,{condition:!f()&&!u,show:a.jsx(_Z,{})}),a.jsx(gt,{title:"Documentation",arrow:!0,children:a.jsx(nT,{component:"a",href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",children:a.jsx(IS,{})})}),a.jsx(gt,{title:"Settings",arrow:!0,children:a.jsx(nT,{onClick:k=>s(k.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":!!i,size:"large",children:a.jsx(I5,{})})}),a.jsx(tF,{id:r,options:j.adminRoutes,anchorEl:i,handleClose:x,style:{top:5,left:-100}})," ",a.jsx(mb,{})]})]})]})})},r0t=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}`},o0t=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}`},Ex=b("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),i0t=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=r0t(e.uiConfig),r=e.uiConfig.environment,o=o0t(e.uiConfig);return a.jsxs("section",{title:"API details",children:[a.jsxs(Ex,{children:[n," ",a.jsx(W,{condition:!!r,show:a.jsxs("small",{children:["(",r,")"]})})]}),a.jsx(W,{condition:!!o,show:a.jsxs("small",{children:[o,a.jsx("br",{})]})}),a.jsx("br",{}),a.jsx("small",{children:e.uiConfig.slogan}),a.jsx("br",{}),a.jsx(W,{condition:!!t,show:a.jsx("small",{children:`${t}`})})]})},s0t=b("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.background.paper,overflowY:"hidden"})),rT=b(ns)({padding:0,margin:0}),Ur=b(za)(({theme:e})=>({padding:0,margin:0,"& a":{...Kl(e),textDecoration:"none",color:e.palette.text.primary,"&:hover":{textDecoration:"underline"}}})),a0t=()=>{const{uiConfig:e}=ht();return a.jsx(s0t,{children:a.jsxs(qo,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[a.jsx(qo,{item:!0,md:4,xs:12,children:a.jsx(i0t,{uiConfig:e})}),a.jsx(qo,{item:!0,xs:12,md:"auto",children:a.jsxs(qo,{container:!0,spacing:7,direction:"row",children:[a.jsx(qo,{item:!0,children:a.jsxs("section",{title:"Unleash SDK",children:[a.jsx(Ex,{children:"Server SDKs"}),a.jsxs(rT,{dense:!0,children:[a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",rel:"noreferrer",children:"Node.js"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",rel:"noreferrer",children:"Java"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",rel:"noreferrer",children:"Go"})})})," ",a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/rust",target:"_blank",rel:"noreferrer",children:"Rust"})})})," ",a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",rel:"noreferrer",children:"Ruby"})})})," ",a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",rel:"noreferrer",children:"Python"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",rel:"noreferrer",children:".NET"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",rel:"noreferrer",children:"PHP"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"All SDKs"})})})]})]})}),a.jsx(qo,{item:!0,children:a.jsxs("section",{title:"Unleash SDK",children:[a.jsx(Ex,{children:"Frontend SDKs"}),a.jsxs(rT,{dense:!0,children:[a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",rel:"noreferrer",children:"Unleash Proxy"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",rel:"noreferrer",children:"JavaScript"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",rel:"noreferrer",children:"React"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/next-js",target:"_blank",rel:"noreferrer",children:"Next.js"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/vue",target:"_blank",rel:"noreferrer",children:"Vue"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",rel:"noreferrer",children:"iOS"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",rel:"noreferrer",children:"Android"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/flutter",target:"_blank",rel:"noreferrer",children:"Flutter"})})})]})]})}),a.jsx(qo,{item:!0,children:a.jsxs("section",{children:[a.jsx(Ex,{children:"About"}),a.jsxs(rT,{dense:!0,children:[a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://www.getunleash.io/",target:"_blank",rel:"noreferrer",children:"getunleash.io"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://twitter.com/getunleash",target:"_blank",rel:"noreferrer",children:"Twitter"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",rel:"noreferrer",children:"LinkedIn"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://github.com/Unleash/unleash",target:"_blank",rel:"noreferrer",children:"GitHub"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Slack Community"})})})]})]})})]})})]})})},l0t=b(Vt)(({theme:e})=>({marginBottom:e.spacing(2)})),c0t=b(Z)(({theme:e})=>({maxWidth:"800px"})),u0t=b("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),d0t=e=>!(!e||localStorage&&localStorage.getItem(e)),f0t=({toast:e})=>{const[t,n]=m.useState(!1);m.useEffect(()=>{n(d0t((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?a.jsx(W,{condition:t,show:a.jsxs(l0t,{severity:e.severity,onClose:r,children:[a.jsx(c0t,{variant:"body2",children:e.message}),a.jsx(u0t,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},p0t=b("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),h0t=b(jhe)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),iF=b("p")(TS),g0t=b(ln)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),m0t=()=>{const{isAdmin:e}=m.useContext(Di),t=Ao(),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").map(decodeURI);return a.jsx(p0t,{children:a.jsx(W,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:a.jsx(W,{condition:n.length>1,show:a.jsx(h0t,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return a.jsx(iF,{children:r},r);let s="/";return n.forEach((l,c)=>{c!==o&&c<o?s+=`${l}/`:c===o&&(s+=l)}),a.jsx(g0t,{to:s,children:a.jsx(iF,{children:r})},r)})})})})})},sF="/static/texture-2nOOHMeS.png",OZ="skip-nav-target-id",v0t=()=>a.jsx("div",{id:OZ}),y0t=b("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,...Kl(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}})),x0t=()=>a.jsxs(y0t,{href:`#${OZ}`,children:["Skip to content ",a.jsx("span",{"aria-hidden":!0,children:"↓"})]}),$Z=({conflict:e})=>a.jsx(W,{condition:!!e,show:a.jsxs(Vt,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"},borderRadius:"0px"},children:[a.jsx("strong",{children:"Conflict!"})," ",e,"."]})}),b0t=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>a.jsxs(V3,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[a.jsxs(ne,{sx:i=>({backgroundColor:i.palette.neutral.light,borderRadius:s=>`${s.shape.borderRadiusLarge}px ${s.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:s=>n?s.palette.warning.border:s.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[a.jsx($Z,{conflict:n}),a.jsxs(ne,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[a.jsx(Z,{children:"Feature flag name: "}),a.jsx(nr,{component:ln,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:a.jsx("strong",{children:e})})]})]}),a.jsx(ne,{children:o})]});var WO={},w0t=ze;Object.defineProperty(WO,"__esModule",{value:!0});var IZ=WO.default=void 0,S0t=w0t(He()),C0t=a,j0t=(0,S0t.default)((0,C0t.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");IZ=WO.default=j0t;var E0t=200,GO="__lodash_hash_undefined__",T0t=1/0,MZ=9007199254740991,k0t="[object Arguments]",_0t="[object Function]",R0t="[object GeneratorFunction]",A0t="[object Symbol]",P0t=/[\\^$.*+?()[\]{}|]/g,O0t=/^\[object .+?Constructor\]$/,$0t=/^(?:0|[1-9]\d*)$/,I0t=typeof ro=="object"&&ro&&ro.Object===Object&&ro,M0t=typeof self=="object"&&self&&self.Object===Object&&self,qO=I0t||M0t||Function("return this")();function D0t(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 L0t(e,t){var n=e?e.length:0;return!!n&&B0t(e,t,0)>-1}function N0t(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function DZ(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 YO(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function F0t(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 B0t(e,t,n){if(t!==t)return F0t(e,z0t,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function z0t(e){return e!==e}function H0t(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function U0t(e){return function(t){return e(t)}}function V0t(e,t){return e.has(t)}function W0t(e,t){return e==null?void 0:e[t]}function G0t(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function LZ(e,t){return function(n){return e(t(n))}}var q0t=Array.prototype,Y0t=Function.prototype,d2=Object.prototype,oT=qO["__core-js_shared__"],aF=function(){var e=/[^.]+$/.exec(oT&&oT.keys&&oT.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),NZ=Y0t.toString,Ig=d2.hasOwnProperty,KO=d2.toString,K0t=RegExp("^"+NZ.call(Ig).replace(P0t,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lF=qO.Symbol,X0t=LZ(Object.getPrototypeOf,Object),J0t=d2.propertyIsEnumerable,Q0t=q0t.splice,cF=lF?lF.isConcatSpreadable:void 0,K_=Object.getOwnPropertySymbols,uF=Math.max,Z0t=BZ(qO,"Map"),E0=BZ(Object,"create");function Hf(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 e1t(){this.__data__=E0?E0(null):{}}function t1t(e){return this.has(e)&&delete this.__data__[e]}function n1t(e){var t=this.__data__;if(E0){var n=t[e];return n===GO?void 0:n}return Ig.call(t,e)?t[e]:void 0}function r1t(e){var t=this.__data__;return E0?t[e]!==void 0:Ig.call(t,e)}function o1t(e,t){var n=this.__data__;return n[e]=E0&&t===void 0?GO:t,this}Hf.prototype.clear=e1t;Hf.prototype.delete=t1t;Hf.prototype.get=n1t;Hf.prototype.has=r1t;Hf.prototype.set=o1t;function Mg(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 i1t(){this.__data__=[]}function s1t(e){var t=this.__data__,n=f2(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Q0t.call(t,n,1),!0}function a1t(e){var t=this.__data__,n=f2(t,e);return n<0?void 0:t[n][1]}function l1t(e){return f2(this.__data__,e)>-1}function c1t(e,t){var n=this.__data__,r=f2(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Mg.prototype.clear=i1t;Mg.prototype.delete=s1t;Mg.prototype.get=a1t;Mg.prototype.has=l1t;Mg.prototype.set=c1t;function Dg(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 u1t(){this.__data__={hash:new Hf,map:new(Z0t||Mg),string:new Hf}}function d1t(e){return p2(this,e).delete(e)}function f1t(e){return p2(this,e).get(e)}function p1t(e){return p2(this,e).has(e)}function h1t(e,t){return p2(this,e).set(e,t),this}Dg.prototype.clear=u1t;Dg.prototype.delete=d1t;Dg.prototype.get=f1t;Dg.prototype.has=p1t;Dg.prototype.set=h1t;function ew(e){var t=-1,n=e?e.length:0;for(this.__data__=new Dg;++t<n;)this.add(e[t])}function g1t(e){return this.__data__.set(e,GO),this}function m1t(e){return this.__data__.has(e)}ew.prototype.add=ew.prototype.push=g1t;ew.prototype.has=m1t;function v1t(e,t){var n=XO(e)||zZ(e)?H0t(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Ig.call(e,i))&&!(o&&(i=="length"||R1t(i,r)))&&n.push(i);return n}function f2(e,t){for(var n=e.length;n--;)if(D1t(e[n][0],t))return n;return-1}function y1t(e,t,n,r){var o=-1,i=L0t,s=!0,l=e.length,c=[],u=t.length;if(!l)return c;n&&(t=DZ(t,U0t(n))),r?(i=N0t,s=!1):t.length>=E0t&&(i=V0t,s=!1,t=new ew(t));e:for(;++o<l;){var d=e[o],f=n?n(d):d;if(d=r||d!==0?d:0,s&&f===f){for(var p=u;p--;)if(t[p]===f)continue e;c.push(d)}else i(t,f,r)||c.push(d)}return c}function FZ(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=_1t),o||(o=[]);++i<s;){var l=e[i];t>0&&n(l)?t>1?FZ(l,t-1,n,r,o):YO(o,l):r||(o[o.length]=l)}return o}function x1t(e,t,n){var r=t(e);return XO(e)?r:YO(r,n(e))}function b1t(e){if(!JO(e)||P1t(e))return!1;var t=UZ(e)||G0t(e)?K0t:O0t;return t.test(M1t(e))}function w1t(e){if(!JO(e))return $1t(e);var t=O1t(e),n=[];for(var r in e)r=="constructor"&&(t||!Ig.call(e,r))||n.push(r);return n}function S1t(e,t){return e=Object(e),C1t(e,t,function(n,r){return r in e})}function C1t(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],l=e[s];n(l,s)&&(i[s]=l)}return i}function j1t(e,t){return t=uF(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=uF(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=n[r];return s[t]=i,D0t(e,this,s)}}function E1t(e){return x1t(e,B1t,k1t)}function p2(e,t){var n=e.__data__;return A1t(t)?n[typeof t=="string"?"string":"hash"]:n.map}function BZ(e,t){var n=W0t(e,t);return b1t(n)?n:void 0}var T1t=K_?LZ(K_,Object):WZ,k1t=K_?function(e){for(var t=[];e;)YO(t,T1t(e)),e=X0t(e);return t}:WZ;function _1t(e){return XO(e)||zZ(e)||!!(cF&&e&&e[cF])}function R1t(e,t){return t=t??MZ,!!t&&(typeof e=="number"||$0t.test(e))&&e>-1&&e%1==0&&e<t}function A1t(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function P1t(e){return!!aF&&aF in e}function O1t(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||d2;return e===n}function $1t(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function I1t(e){if(typeof e=="string"||F1t(e))return e;var t=e+"";return t=="0"&&1/e==-T0t?"-0":t}function M1t(e){if(e!=null){try{return NZ.call(e)}catch{}try{return e+""}catch{}}return""}function D1t(e,t){return e===t||e!==e&&t!==t}function zZ(e){return L1t(e)&&Ig.call(e,"callee")&&(!J0t.call(e,"callee")||KO.call(e)==k0t)}var XO=Array.isArray;function HZ(e){return e!=null&&N1t(e.length)&&!UZ(e)}function L1t(e){return VZ(e)&&HZ(e)}function UZ(e){var t=JO(e)?KO.call(e):"";return t==_0t||t==R0t}function N1t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=MZ}function JO(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function VZ(e){return!!e&&typeof e=="object"}function F1t(e){return typeof e=="symbol"||VZ(e)&&KO.call(e)==A0t}function B1t(e){return HZ(e)?v1t(e,!0):w1t(e)}var z1t=j1t(function(e,t){return e==null?{}:(t=DZ(FZ(t,1),I1t),S1t(e,y1t(E1t(e),t)))});function WZ(){return[]}var H1t=z1t;const T0=uo(H1t),dF=b("div")(()=>({...TS,maxWidth:500})),GZ=({newName:e,previousName:t})=>{const n=!!(t&&t!==e);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:n,show:a.jsx(dF,{children:a.jsx(Z,{component:"del",color:"text.secondary",children:t})})}),a.jsx(W,{condition:!!e,show:a.jsx(dF,{children:a.jsx(Z,{children:e})})})]})},U1t=b("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),iT=({change:e,currentStrategy:t})=>{const n=e.action==="deleteStrategy"?void 0:e.payload;return a.jsx(U1t,{children:a.jsx(Ag,{entry:{preData:T0(t,"sortOrder"),data:T0(n,"snapshot")}})})},V1t=b("div")(({theme:e})=>({display:"grid",gridAutoFlow:"column",gridTemplateColumns:"auto 1fr",gap:e.spacing(1),alignItems:"center"})),W1t=b("div")(()=>({...TS,maxWidth:500})),sT=({change:e,previousTitle:t,children:n})=>a.jsxs(V1t,{children:[a.jsx(GIe,{strategyName:e.payload.name}),a.jsxs(W1t,{children:[a.jsx(Gc,{tooltip:n,tooltipProps:{maxWidth:500,maxHeight:600},children:a.jsx(Z,{component:"span",children:td(e.payload.name)})}),a.jsx(GZ,{newName:e.payload.title,previousName:t})]})]}),fF=({percentage:e,size:t="4rem",disabled:n=!1})=>{const r=It(),o={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:r.palette.background.elevation2},i=100/(2*Math.PI),s=2*i,l=n?r.palette.neutral.border:r.palette.primary.light;return a.jsxs("svg",{viewBox:`0 0 ${s} ${s}`,style:o,"aria-hidden":!0,children:[a.jsxs("title",{children:["A circle progress bar with ",e,"% completion."]}),a.jsx("circle",{r:i,cx:i,cy:i,fill:"none",stroke:l,strokeWidth:s,strokeDasharray:`${e} 100`})]})},G1t=b("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,background:e.palette.background.default,border:`1px solid ${e.palette.divider}`})),q1t=b("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),Y1t=b(vi)(({theme:e})=>({margin:e.spacing(.5)})),aT=({value:e,text:t})=>a.jsx(G1t,{children:a.jsx(W,{condition:e.length===0,show:a.jsxs("p",{children:["No ",t,"s added yet."]}),elseShow:a.jsxs("div",{children:[a.jsxs(q1t,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>a.jsx(Y1t,{label:a.jsx(hs,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),K1t=({segments:e,disabled:t=!1})=>!e||e.length===0?null:a.jsx(a.Fragment,{children:e.map((n,r)=>a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:r>0,show:a.jsx(YC,{text:"AND"})}),a.jsx(EX,{segment:n,disabled:t})]},n.id))}),X1t=b(ne,{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({"& p, & span, & h1, & h2, & h3, & h4, & h5, & h6":{color:t?e.palette.neutral.main:"inherit"},".constraint-icon-container":{backgroundColor:t?e.palette.neutral.border:e.palette.primary.light,borderRadius:"50%"},".constraint-icon":{fill:t?e.palette.neutral.light:e.palette.common.white}})),J1t=()=>a.jsxs(Vt,{severity:"warning",sx:{mb:2},children:["Custom strategies are deprecated and may be removed in a future major version. Consider rewriting this strategy as a predefined strategy with"," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",variant:"body2",children:"constraints."})]}),pF=()=>a.jsx(ne,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),zd=b(ne)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,background:e.palette.background.default})),lT=b("span")(({theme:e})=>({color:e.palette.neutral.main})),Tx=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,r=t==null?void 0:t.stickiness,o=typeof r=="string"&&r!=="default",{strategies:i}=Sg(),{segments:s}=Wc(),l=s==null?void 0:s.filter(p=>{var h;return(h=e.segments)==null?void 0:h.includes(p.id)}),c=i.find(p=>p.name===e.name),u=m.useMemo(()=>!t||c!=null&&c.editable?null:Object.keys(t).map(p=>{switch(p){case"rollout":case"Rollout":{const h=kv(t[p]),g=e.disabled?"neutral":"success";return a.jsxs(zd,{sx:{display:"flex",alignItems:"center"},children:[a.jsx(ne,{sx:{mr:2},children:a.jsx(fF,{percentage:h,size:"2rem",disabled:e.disabled})}),a.jsxs("div",{children:[a.jsxs(qt,{color:g,children:[h,"%"]})," ",a.jsx("span",{children:"of your base"})," ",a.jsxs("span",{children:[o?a.jsxs(a.Fragment,{children:["with ",a.jsx("strong",{children:r})]}):""," "]}),a.jsxs("span",{children:[n.length>0?"who match constraints":""," ","is included."]})]})]})}case"userIds":case"UserIds":{const h=kc(t[p]);return a.jsx(aT,{value:h,text:"user"},p)}case"hostNames":case"HostNames":{const h=kc(t[p]);return a.jsx(aT,{value:h,text:"host"},p)}case"IPs":{const h=kc(t[p]);return a.jsx(aT,{value:h,text:"IP"},p)}case"stickiness":case"groupId":return null;default:return null}}),[t,c,n,e.disabled]),d=m.useMemo(()=>{if(!t||!(c!=null&&c.editable))return null;const p=a.jsx(lT,{children:" is set to "});return c==null?void 0:c.parameters.map(h=>{const{type:g,name:v}={...h};if(!g||!v||t[v]===void 0)return null;const x=a.jsx(hs,{maxLength:15,maxWidth:"150",text:v});switch(h==null?void 0:h.type){case"list":{const y=kc(t[v]);return y.length>0?a.jsxs(zd,{children:[x," ",a.jsxs(lT,{children:["has ",y.length," ",y.length>1?"items":"item",":"," ",y.map(w=>a.jsx(vi,{label:a.jsx(hs,{maxWidth:"300",text:w,maxLength:50}),sx:{mr:.5}},w))]})]}):null}case"percentage":{const y=kv(t[v]);return t[v]!==""?a.jsxs(zd,{sx:{display:"flex",alignItems:"center"},children:[a.jsx(ne,{sx:{mr:2},children:a.jsx(fF,{percentage:y,size:"2rem"})}),a.jsxs("div",{children:[x,p,a.jsxs(qt,{color:"success",children:[y,"%"]})]})]}):null}case"boolean":return t[v]==="true"||t[v]==="false"?a.jsxs(zd,{children:[a.jsx(hs,{maxLength:15,maxWidth:"150",text:v}),p,a.jsx(qt,{color:t[v]==="true"?"success":"error",children:t[v]})]}):null;case"string":{const y=Mu(t[v]);return typeof t[v]<"u"?a.jsxs(zd,{children:[x,a.jsx(W,{condition:y==="",show:a.jsx(lT,{children:" is an empty string"}),elseShow:a.jsxs(a.Fragment,{children:[p,a.jsx(hs,{maxWidth:"300",text:y,maxLength:50})]})})]}):null}case"number":{const y=kv(t[v]);return t[v]!==""&&y!==void 0?a.jsxs(zd,{children:[x,p,a.jsx(hs,{maxWidth:"300",text:String(y),maxLength:50})]}):null}case"default":return null}return null})},[t,c]);if(!t)return a.jsx(pF,{});const f=[l&&l.length>0&&a.jsx(K1t,{segments:l,disabled:e.disabled}),n.length>0&&a.jsx(KC,{constraints:n,showLabel:!1}),e.name==="default"&&a.jsx(a.Fragment,{children:a.jsxs(zd,{sx:{width:"100%"},children:["The standard strategy is ",a.jsx(qt,{color:"success",children:"ON"})," ","for all users."]})}),...u??[],...d??[]].filter(Boolean);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!Jq.includes(e.name||"default"),show:a.jsx(J1t,{})}),a.jsx(W,{condition:f.length>0,show:a.jsx(X1t,{disabled:!!e.disabled,children:f.map((p,h)=>a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:h>0,show:a.jsx(YC,{text:"AND"})}),p]},h))}),elseShow:a.jsx(pF,{})})]})},Q1t=(e,t,n,r)=>{var s;const{feature:o}=Wl(t,n);return(s=o==null?void 0:o.environments.find(l=>l.name===r))==null?void 0:s.strategies.find(l=>"id"in e.payload&&l.id===e.payload.id)},Z1t=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,whiteSpace:"pre-wrap"})),eyt=({value:e})=>{const{searchQuery:t}=Jl();return e?e.type==="string"&&e.value.length<20?a.jsx(bn,{children:a.jsx(pi,{search:t,children:e.value})}):a.jsx(bn,{children:a.jsx(Gc,{tooltip:a.jsx(a.Fragment,{children:a.jsx(Z1t,{children:a.jsx(pi,{search:t,children:e.value})})}),highlighted:t.length>0&&e.value.toLowerCase().includes(t.toLowerCase()),children:e.type})}):a.jsx(bn,{})},tyt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),nyt=({value:e})=>{const{searchQuery:t}=Jl();if(!e||e.length===0)return a.jsx(bn,{});const n=r=>`${r.contextName}:${r.values.join()}`;return a.jsx(bn,{children:a.jsx(Gc,{tooltip:a.jsx(a.Fragment,{children:e.map((r,o)=>a.jsx(tyt,{children:a.jsx(pi,{search:t,children:n(r)})},r.contextName+o))}),highlighted:t.length>0&&(e==null?void 0:e.map(n).join(`
448
+ --data-raw '${JSON.stringify(z,void 0,2)}'`,q=async G=>{if(G.preventDefault(),!!A())try{if(P)await l(e.id,z);else{const F=await s(z);if(S===Iv.NOW){const{token:U}=await u(F.id,{name:E});r(U,F)}}d({title:`Signal endpoint ${P?"updated":"added"} successfully`,type:"success"}),i(),n(!1)}catch(F){f(Dt(F))}};return a.jsx(pp,{open:t,onClose:()=>{n(!1)},label:$,children:a.jsxs(Br,{loading:c,modal:!0,description:"Signal endpoints allow third-party services to send signals to Unleash.",documentationLink:"https://docs.getunleash.io/reference/signals",documentationLinkLabel:"Signals documentation",formatApiCode:Y,children:[a.jsxs(Ppt,{children:[a.jsx(Opt,{children:$}),a.jsx(W,{condition:P,show:a.jsx(nr,{onClick:o,children:"View signals"})})]}),a.jsxs($pt,{onSubmit:q,children:[a.jsx(Apt,{signalEndpoint:e,enabled:h,setEnabled:g,name:v,setName:x,description:y,setDescription:w,tokenGeneration:S,setTokenGeneration:C,tokenName:E,setTokenName:j,errors:k,validateName:T,validateTokenName:_,validated:M}),a.jsxs(Ipt,{children:[a.jsxs(We,{type:"submit",variant:"contained",color:"primary",children:[P?"Save":"Add"," signal endpoint"]}),a.jsx(Mpt,{onClick:()=>{n(!1)},children:"Cancel"})]})]})]})})},BN=Me.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),eT={dedupe:!0},Lpt=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:s,revalidateOnMount:l,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:p}=n,[h,g,v,x]=Oa.get(r),[y,w]=Pf(e),S=m.useRef(!1),C=m.useRef(!1),E=m.useRef(y),j=m.useRef(t),k=m.useRef(n),T=()=>k.current,_=()=>T().isVisible()&&T().isOnline(),[A,M,I,P]=yc(r,y),$=m.useRef({}).current,z=zt(s)?n.fallback[y]:s,Y=(he,se)=>{for(const be in $){const xe=be;if(xe==="data"){if(!o(he[xe],se[xe])&&(!zt(he[xe])||!o(ue,se[xe])))return!1}else if(se[xe]!==he[xe])return!1}return!0},q=m.useMemo(()=>{const he=!y||!t?!1:zt(l)?T().isPaused()||i?!1:zt(c)?!0:c:l,se=De=>{const Ne=Hl(De);return delete Ne._k,he?{isValidating:!0,isLoading:!0,...Ne}:Ne},be=A(),xe=P(),Ee=se(be),Ge=be===xe?Ee:se(xe);let we=Ee;return[()=>{const De=se(A());return Y(De,we)?(we.data=De.data,we.isLoading=De.isLoading,we.isValidating=De.isValidating,we.error=De.error,we):(we=De,De)},()=>Ge]},[r,y]),G=RS.useSyncExternalStore(m.useCallback(he=>I(y,(se,be)=>{Y(be,se)||he()}),[r,y]),q[0],q[1]),F=!S.current,U=h[y]&&h[y].length>0,O=G.data,L=zt(O)?z:O,te=G.error,re=m.useRef(L),ue=p?zt(O)?re.current:O:L,ve=U&&!zt(te)?!1:F&&!zt(l)?l:T().isPaused()?!1:i?zt(L)?!1:c:zt(L)||c,Ce=!!(y&&t&&F&&ve),J=zt(G.isValidating)?Ce:G.isValidating,oe=zt(G.isLoading)?Ce:G.isLoading,ae=m.useCallback(async he=>{const se=j.current;if(!y||!se||C.current||T().isPaused())return!1;let be,xe,Ee=!0;const Ge=he||{},we=!v[y]||!Ge.dedupe,De=()=>hb?!C.current&&y===E.current&&S.current:y===E.current,Ne={isValidating:!1,isLoading:!1},it=()=>{M(Ne)},Pt=()=>{const qe=v[y];qe&&qe[1]===xe&&delete v[y]},mt={isValidating:!0};zt(A().data)&&(mt.isLoading=!0);try{if(we&&(M(mt),n.loadingTimeout&&zt(A().data)&&setTimeout(()=>{Ee&&De()&&T().onLoadingSlow(y,n)},n.loadingTimeout),v[y]=[se(w),gb()]),[be,xe]=v[y],be=await be,we&&setTimeout(Pt,n.dedupingInterval),!v[y]||v[y][1]!==xe)return we&&De()&&T().onDiscarded(y),!1;Ne.error=wo;const qe=g[y];if(!zt(qe)&&(xe<=qe[0]||xe<=qe[1]||qe[1]===0))return it(),we&&De()&&T().onDiscarded(y),!1;const Te=A().data;Ne.data=o(Te,be)?Te:be,we&&De()&&T().onSuccess(be,y,n)}catch(qe){Pt();const Te=T(),{shouldRetryOnError:Ue}=Te;Te.isPaused()||(Ne.error=qe,we&&De()&&(Te.onError(qe,y,Te),(Ue===!0||Gi(Ue)&&Ue(qe))&&(!T().revalidateOnFocus||!T().revalidateOnReconnect||_())&&Te.onErrorRetry(qe,y,Te,pe=>{const ye=h[y];ye&&ye[0]&&ye[0](gl.ERROR_REVALIDATE_EVENT,pe)},{retryCount:(Ge.retryCount||0)+1,dedupe:!0})))}return Ee=!1,it(),!0},[y,r]),ce=m.useCallback((...he)=>o5(r,E.current,...he),[]);if(Iu(()=>{j.current=t,k.current=n,zt(O)||(re.current=O)}),Iu(()=>{if(!y)return;const he=ae.bind(wo,eT);let se=0;const xe=fW(y,h,(Ee,Ge={})=>{if(Ee==gl.FOCUS_EVENT){const we=Date.now();T().revalidateOnFocus&&we>se&&_()&&(se=we+T().focusThrottleInterval,he())}else if(Ee==gl.RECONNECT_EVENT)T().revalidateOnReconnect&&_()&&he();else{if(Ee==gl.MUTATE_EVENT)return ae();if(Ee==gl.ERROR_REVALIDATE_EVENT)return ae(Ge)}});return C.current=!1,E.current=y,S.current=!0,M({_k:w}),ve&&(zt(L)||Af?he():eW(he)),()=>{C.current=!0,xe()}},[y]),Iu(()=>{let he;function se(){const xe=Gi(u)?u(A().data):u;xe&&he!==-1&&(he=setTimeout(be,xe))}function be(){!A().error&&(d||T().isVisible())&&(f||T().isOnline())?ae(eT).then(se):se()}return se(),()=>{he&&(clearTimeout(he),he=-1)}},[u,d,f,y]),m.useDebugValue(ue),i&&zt(L)&&y){if(!hb&&Af)throw new Error("Fallback data is required when using suspense in SSR.");j.current=t,k.current=n,C.current=!1;const he=x[y];if(!zt(he)){const se=ce(he);BN(se)}if(zt(te)){const se=ae(eT);zt(ue)||(se.status="fulfilled",se.value=!0),BN(se)}else throw te}return{mutate:ce,get data(){return $.data=!0,ue},get error(){return $.error=!0,te},get isValidating(){return $.isValidating=!0,J},get isLoading(){return $.isLoading=!0,oe}}};yv.defineProperty(sW,"defaultValue",{value:i5});const Npt=dW(Lpt),Fpt=e=>Pf(e?e(0,null):null)[0],tT=Promise.resolve(),Bpt=e=>(t,n,r)=>{const o=m.useRef(!1),{cache:i,initialSize:s=1,revalidateAll:l=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:d=!1,parallel:f=!1}=r,[,,,p]=Oa.get(PS);let h;try{h=Fpt(t),h&&(h=aW+h)}catch{}const[g,v,x]=yc(i,h),y=m.useCallback(()=>zt(g()._l)?s:g()._l,[i,h,s]);RS.useSyncExternalStore(m.useCallback(T=>h?x(h,()=>{T()}):()=>{},[i,h]),y,y);const w=m.useCallback(()=>{const T=g()._l;return zt(T)?s:T},[h,s]),S=m.useRef(w());Iu(()=>{if(!o.current){o.current=!0;return}h&&v({_l:c?S.current:w()})},[h,i]);const C=d&&!o.current,E=e(h,async T=>{const _=g()._i,A=g()._r;v({_r:wo});const M=[],I=w(),[P]=yc(i,T),$=P().data,z=[];let Y=null;for(let q=0;q<I;++q){const[G,F]=Pf(t(q,f?null:Y));if(!G)break;const[U,O]=yc(i,G);let L=U().data;const te=l||_||zt(L)||u&&!q&&!zt($)||C||$&&!zt($[q])&&!r.compare($[q],L);if(n&&(typeof A=="function"?A(L,F):te)){const re=async()=>{if(!(G in p))L=await n(F);else{const ve=p[G];delete p[G],L=await ve}O({data:L,_k:F}),M[q]=L};f?z.push(re):await re()}else M[q]=L;f||(Y=L)}return f&&await Promise.all(z.map(q=>q())),v({_i:wo}),M},r),j=m.useCallback(function(T,_){const A=typeof _=="boolean"?{revalidate:_}:_||{},M=A.revalidate!==!1;return h?(M&&(zt(T)?v({_i:!0,_r:A.revalidate}):v({_i:!1,_r:A.revalidate})),arguments.length?E.mutate(T,{...A,revalidate:M}):E.mutate()):tT},[h,i]),k=m.useCallback(T=>{if(!h)return tT;const[,_]=yc(i,h);let A;if(Gi(T)?A=T(w()):typeof T=="number"&&(A=T),typeof A!="number")return tT;_({_l:A}),S.current=A;const M=[],[I]=yc(i,h);let P=null;for(let $=0;$<A;++$){const[z]=Pf(t($,P)),[Y]=yc(i,z),q=z?Y().data:wo;if(zt(q))return j(I().data);M.push(q),P=q}return j(M)},[h,i,j,w]);return{size:w(),setSize:k,mutate:j,get data(){return E.data},get error(){return E.error},get isValidating(){return E.isValidating},get isLoading(){return E.isLoading}}},zpt=nSe(Npt,Bpt),Hpt="api/admin/signal-endpoints",Upt=async e=>{const t=await fetch(e);return await fn("Signals")(t),t.json()},Vpt=(e,t=50,n={})=>{var y;const{isEnterprise:r}=ht(),o=Nr("signals"),i=(w,S)=>!e||!r||!o||S&&!S.signalEndpointSignals.length?null:Ot(`${Hpt}/${e}/signals?limit=${t}&offset=${w*t}`),{data:s,error:l,size:c,setSize:u,mutate:d}=zpt(i,Upt,{...n,revalidateAll:!0}),f=s?s.flatMap(({signalEndpointSignals:w})=>w):[],p=!s&&!l,h=c>0&&!(s!=null&&s[c-1]),g=p||h,v=((y=s==null?void 0:s[c-1])==null?void 0:y.signalEndpointSignals.length)===t;return{signalEndpointSignals:f,hasMore:v,loadMore:()=>{g||!v||u(c+1)},loading:g,refetch:()=>d(),error:l}},Wpt=b("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",borderTopLeftRadius:e.shape.borderRadiusMedium,borderTopRightRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.table.headerBackground})),zN=b("div",{shouldForwardProp:e=>e!=="maxWidth"})(({maxWidth:e})=>({display:"flex",flex:1,...e&&{maxWidth:e}})),Gpt=({columns:e,sidePanelHeader:t,leftPanelMaxWidth:n})=>a.jsxs(Wpt,{children:[a.jsx(zN,{maxWidth:n,children:e.map(({header:r,maxWidth:o,align:i})=>a.jsx(Y_,{maxWidth:o,align:i,children:r},r))}),a.jsx(zN,{children:a.jsx(Y_,{children:t})})]}),qpt=b("div")(({theme:e})=>({borderBottom:`1px solid ${e.palette.divider}`})),Ypt=b(We,{shouldForwardProp:e=>e!=="selected"})(({theme:e,selected:t})=>({"&.MuiButton-root":{width:"100%",backgroundColor:t?e.palette.secondary.light:"transparent",borderRight:`${e.spacing(.5)} solid ${t?e.palette.background.alternative:"transparent"}`,padding:0,borderRadius:0,justifyContent:"start",transition:"background-color 0.2s ease",color:e.palette.text.primary,textAlign:"left",fontWeight:t?e.fontWeight.bold:e.fontWeight.medium,fontSize:e.fontSizes.smallBody,overflow:"auto"},"&:hover":{backgroundColor:t?e.palette.secondary.light:e.palette.neutral.light},"&.Mui-disabled":{pointerEvents:"auto"},"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`}})),Kpt=({selected:e,onClick:t,children:n})=>a.jsx(qpt,{children:a.jsx(Ypt,{selected:e,onClick:t,children:n})}),Xpt=b("div")({display:"flex",flexDirection:"column",width:"100%"}),Jpt=b("div")({display:"flex",flexDirection:"row"}),WQ=b("div")({display:"flex",flexDirection:"column",flex:1}),Qpt=b(WQ,{shouldForwardProp:e=>e!=="height"&&e!=="maxWidth"})(({theme:e,height:t,maxWidth:n})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderBottomLeftRadius:e.shape.borderRadiusMedium,overflow:"auto",...t&&{height:t},...n&&{maxWidth:n}})),Zpt=b(WQ)(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderTop:0,borderLeft:0,borderBottomRightRadius:e.shape.borderRadiusMedium})),Y_=b("div",{shouldForwardProp:e=>e!=="maxWidth"&&e!=="align"})(({theme:e,maxWidth:t,align:n="start"})=>({display:"flex",flex:1,padding:e.spacing(2),fontSize:e.fontSizes.smallBody,justifyContent:n,...t&&{maxWidth:t},textAlign:n,alignItems:"center"})),eht=({items:e,columns:t,sidePanelHeader:n,renderContent:r,renderItem:o=(l,c)=>c,height:i,listEnd:s})=>{const[l,c]=m.useState(e[0]);if(e.length===0)return null;const u=l||e[0],d=t.every(({maxWidth:f})=>!!f)?t.reduce((f,{maxWidth:p})=>f+(p||0),0):void 0;return a.jsxs(Xpt,{children:[a.jsx(Gpt,{columns:t,sidePanelHeader:n,leftPanelMaxWidth:d}),a.jsxs(Jpt,{children:[a.jsxs(Qpt,{height:i,maxWidth:d,children:[e.map(f=>o(f,a.jsx(Kpt,{selected:u.id===f.id,onClick:()=>c(f),children:t.map(({header:p,maxWidth:h,align:g,cell:v})=>a.jsx(Y_,{maxWidth:h,align:g,children:v(f)},p))},f.id))),s]}),a.jsx(Zpt,{children:r(u)})]})]})},tht=m.lazy(()=>yd(()=>import("./ReactJSONEditor-C-nON7ak.js"),[])),nht=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.fontSizes.mainHeader})),rht=b("div")({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}),oht=b("div")(({theme:e})=>({display:"flex",flexDirection:"column",marginTop:e.spacing(2),fontSize:e.fontSizes.smallBody})),iht=b("p")(({theme:e})=>({color:e.palette.text.secondary})),sht=b("h1")({fontWeight:"normal"}),aht=b("form")({display:"flex",flexDirection:"column",height:"100%"}),lht=b("div")(({theme:e})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:e.spacing(4)})),cht=({signalEndpoint:e,open:t,setOpen:n,onOpenConfiguration:r})=>{const{uiConfig:o}=ht(),{locationSettings:i}=Mi(),{signalEndpointSignals:s,hasMore:l,loadMore:c,loading:u}=Vpt(e==null?void 0:e.id,20,{refreshInterval:5e3});if(!e)return null;const d=`Signals: ${e.name}`;return a.jsx(pp,{open:t,onClose:()=>{n(!1)},label:d,children:a.jsxs(Br,{loading:u&&s.length===0,modal:!0,description:"",documentationLink:"",documentationLinkLabel:"",showGuidance:!1,children:[a.jsxs(nht,{children:[a.jsxs(rht,{children:[a.jsx(sht,{children:d}),a.jsx(nr,{onClick:r,children:"View configuration"})]}),a.jsxs(oht,{children:[a.jsxs("p",{children:[o.unleashUrl,"/api/signal-endpoint/",e.name]}),a.jsx(iht,{children:e.description})]})]}),a.jsxs(aht,{children:[a.jsx(eht,{height:960,items:s,columns:[{header:"Date",maxWidth:220,cell:({createdAt:f})=>l1(f,i==null?void 0:i.locale)},{header:"Token",maxWidth:300,cell:({tokenName:f})=>f}],sidePanelHeader:"Payload",renderContent:f=>a.jsx(m.Suspense,{fallback:null,children:a.jsx(tht,{content:{json:f.payload},readOnly:!0,statusBar:!1,editorStyle:"sidePanel"})}),listEnd:a.jsx(W,{condition:l,show:a.jsx(We,{onClick:c,children:"Load more"})})}),a.jsx(W,{condition:s.length===0,show:a.jsx("p",{children:"No signals have been received on this signal endpoint."})}),a.jsx(lht,{children:a.jsx(We,{onClick:()=>{n(!1)},children:"Close"})})]})]})})},uht=()=>{const{setToastData:e,setToastApiError:t}=Yt(),{uiConfig:n}=ht(),{signalEndpoints:r,refetch:o}=Eg(),{toggleSignalEndpoint:i,removeSignalEndpoint:s}=HQ(),[l,c]=m.useState(),[u,d]=m.useState(!1),[f,p]=m.useState(!1),[h,g]=m.useState(""),[v,x]=m.useState(!1),[y,w]=m.useState(!1),S=async({id:I,name:P},$)=>{try{await i(I,$),e({title:`"${P}" has been ${$?"enabled":"disabled"}`,type:"success"}),o()}catch(z){t(Dt(z))}},C=async({id:I,name:P})=>{try{await s(I),e({title:`"${P}" has been deleted`,type:"success"}),o(),x(!1)}catch($){t(Dt($))}},E=Qn(Xo.breakpoints.down("md")),j=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:({row:{original:I}})=>a.jsx(la,{title:I.name,onClick:()=>{c(I),d(!0)},subtitle:I.description}),width:240},{Header:"URL",accessor:I=>`${n.unleashUrl}/api/signal-endpoint/${I.name}`,minWidth:200},{id:"tokens",Header:"Tokens",accessor:I=>{var P;return((P=I.tokens)==null?void 0:P.map(({name:$})=>$).join(`
449
+ `))||""},Cell:({row:{original:I},value:P})=>a.jsx(tpt,{signalEndpoint:I,value:P,onCreateToken:()=>{c(I),d(!0)}}),searchable:!0,maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:Qu,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:I}})=>a.jsx(Zft,{checked:I.enabled,setChecked:P=>S(I,P)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:I}})=>a.jsx(Jft,{signalEndpointId:I.id,onCopyToClipboard:()=>{aC(`${n.unleashUrl}/api/signal-endpoint/${I.name}`),e({type:"success",title:"Copied to clipboard"})},onOpenSignals:()=>{c(I),w(!0)},onEdit:()=>{c(I),d(!0)},onDelete:()=>{c(I),x(!0)}}),width:90,disableSortBy:!0}],[]),[k]=m.useState({sortBy:[{id:"createdAt",desc:!0}]}),{headerGroups:T,rows:_,prepareRow:A,setHiddenColumns:M}=un.useTable({columns:j,data:r,initialState:k,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:bn}},un.useSortBy,un.useFlexLayout);return hp([{condition:E,columns:["createdAt"]}],M,j),a.jsxs(yr,{header:a.jsx(Bn,{title:`Signal endpoints (${r.length})`,actions:a.jsx(We,{variant:"contained",color:"primary",onClick:()=>{c(void 0),d(!0)},children:"New signal endpoint"})}),children:[a.jsx(vg,{rows:_,headerGroups:T,prepareRow:A}),a.jsx(W,{condition:_.length===0,show:a.jsx(eo,{children:"No signal endpoints available. Get started by adding one."})}),a.jsx(Dpt,{signalEndpoint:l,open:u,setOpen:d,newToken:(I,P)=>{g(I),c(P),p(!0)},onOpenSignals:()=>{d(!1),w(!0)}}),a.jsx(cht,{signalEndpoint:l,open:y,setOpen:w,onOpenConfiguration:()=>{w(!1),d(!0)}}),a.jsx(VQ,{open:f,setOpen:p,token:h,signalEndpoint:l}),a.jsx(Qft,{signalEndpoint:l,open:v,setOpen:x,onConfirm:C})]})},dht=()=>{const{isEnterprise:e}=ht();return e()?a.jsx("div",{children:a.jsx(i4,{permissions:Qo,children:a.jsx(uht,{})})}):a.jsx(hP,{feature:"signals"})},fht=m.lazy(()=>yd(()=>import("./CreateProject-DhmoT0x8.js"),[])),j0=[{path:"/splash/:splashId",title:"Unleash",component:Cet,type:"protected",menu:{},isStandalone:!0},{path:"/projects/create",parent:"/projects",title:"Create",component:fht,type:"protected",enterprise:!0,menu:{}},{path:"/projects/:projectId/archived",title:":projectId",parent:"/archive",component:QBe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/copy",parent:"/projects/:projectId/features/:featureId/",title:"Copy",component:YQe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/edit",parent:"/projects",title:"Edit feature",component:dQe,type:"protected",menu:{}},{path:"/projects/:projectId/features/:featureId/*",parent:"/projects",title:"FeatureView",component:$ot,type:"protected",menu:{}},{path:"/projects/:projectId/create-toggle",parent:"/projects/:projectId/features",title:"Create feature flag",component:XJe,type:"protected",menu:{}},{path:"/projects/:projectId/*",parent:"/projects",title:":projectId",component:Mot,flag:$Ne,type:"protected",menu:{}},{path:"/projects",title:"Projects",component:JBe,type:"protected",menu:{mobile:!0}},{path:"/search",title:"Search",component:b$e,type:"protected",menu:{mobile:!0}},{path:"/playground",title:"Playground",component:lrt,hidden:!1,type:"protected",menu:{mobile:!0}},{path:"/insights",title:"Insights",component:Bdt,type:"protected",menu:{mobile:!0},notFlag:"killInsightsUI",enterprise:!0},{path:"/applications/:name/*",title:":name",parent:"/applications",component:Kft,type:"protected",menu:{}},{path:"/applications",title:"Applications",component:jit,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/context/create",parent:"/context",title:"Create",component:Tet,type:"protected",menu:{}},{path:"/context/edit/:name",parent:"/context",title:":name",component:TJe,type:"protected",menu:{}},{path:"/context",title:"Context fields",component:hQe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/feature-toggle-type/*",title:"Feature flag types",component:sit,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/strategies/create",title:"Create",parent:"/strategies",component:tet,type:"protected",menu:{}},{path:"/strategies/:name/edit",title:":name",parent:"/strategies",component:net,type:"protected",menu:{}},{path:"/strategies/:name",title:":name",parent:"/strategies",component:xIe,type:"protected",menu:{}},{path:"/strategies",title:"Strategy types",component:gMe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/environments/create",title:"Environments",component:aze,parent:"/environments",type:"protected",menu:{}},{path:"/environments/:id",title:"Edit",component:uze,type:"protected",menu:{}},{path:"/environments",title:"Environments",component:jnt,type:"protected",flag:INe,menu:{mobile:!0,advanced:!0}},{path:"/feedback",title:"Feedback",component:Udt,type:"protected",flag:"featureSearchFeedbackPosting",menu:{}},{path:"/tag-types/create",parent:"/tag-types",title:"Create",component:DJe,type:"protected",menu:{}},{path:"/tag-types/edit/:name",parent:"/tag-types",title:":name",component:MJe,type:"protected",menu:{}},{path:"/tag-types",title:"Tag types",component:SMe,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/addons/create/:providerId",parent:"/addons",title:"Create",component:IE,type:"protected",menu:{}},{path:"/addons/edit/:addonId",parent:"/addons",title:"Edit",component:IE,type:"protected",menu:{}},{path:"/addons",title:"Addons",component:IE,hidden:!1,type:"protected",menu:{}},{path:"/integrations/create/:providerId",parent:"/integrations",title:"Create",component:NQe,type:"protected",menu:{}},{path:"/integrations/view/:providerId",parent:"/integrations",title:"View",component:git,type:"protected",menu:{}},{path:"/integrations/edit/:addonId",parent:"/integrations",title:"Edit",component:FQe,type:"protected",menu:{}},{path:"/integrations",title:"Integrations",component:_7e,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/integrations/signals",title:"Signals",component:dht,hidden:!0,type:"protected",menu:{}},{path:"/segments/create",title:"Segments",component:ptt,hidden:!1,type:"protected",layout:"main",menu:{}},{path:"/segments/edit/:segmentId",title:"Segments",component:vtt,hidden:!1,type:"protected",layout:"main",menu:{}},{path:"/segments",title:"Segments",component:Hnt,hidden:!1,type:"protected",menu:{mobile:!0,advanced:!0}},{path:"/history",title:"Event log",component:LZe,type:"protected",menu:{adminSettings:!0}},{path:"/admin/logins",title:"Login history",component:Yot,type:"protected",menu:{adminSettings:!0}},{path:"/archive",title:"Archived flags",component:art,type:"protected",menu:{}},{path:"/admin/*",title:"Admin",component:Iot,hidden:!1,type:"protected",menu:{}},{path:"/profile/*",title:"Profile",component:Oot,type:"protected",menu:{}},{path:"/login",title:"Log in",component:ONe,type:"unprotected",hidden:!0,menu:{},isStandalone:!0},{path:"/new-user",title:"New user",hidden:!0,component:sFe,type:"unprotected",menu:{},isStandalone:!0},{path:"/reset-password",title:"Reset password",hidden:!0,component:cFe,type:"unprotected",menu:{},isStandalone:!0},{path:"/forgotten-password",title:"Forgotten password",hidden:!0,component:mFe,type:"unprotected",menu:{},isStandalone:!0}],pht=j0.filter(e=>!e.hidden),hht=()=>{const e=pht.filter(o=>o.menu.advanced),t=j0.filter(o=>o.menu.adminSettings),n=j0.filter(o=>o.menu.mobile),r={mainNavRoutes:e,adminRoutes:t,mobileRoutes:n};return()=>r},Yh=e=>e.map(t=>({path:t.path,flag:t.flag,title:t.title,menu:t.menu,configFlag:t.configFlag,notFlag:t.notFlag})),iO=hht(),QEt={users:"User administration",access:"Access control",instance:"Instance configuration",log:"Logs",other:"Other"},HN=[{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/banners",title:"Banners",menu:{adminSettings:!0,mode:["enterprise"]},group:"instance"},{path:"/admin/instance",title:"Instance stats",menu:{adminSettings:!0},group:"instance"},{path:"/admin/license",title:"License",menu:{adminSettings:!0,mode:["enterprise"]},flag:"enableLicense",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 $c=(e=>(e.UNASSIGNED="UNASSIGNED",e.TRIAL="TRIAL",e.ACTIVE="ACTIVE",e.EXPIRED="EXPIRED",e.CHURNED="CHURNED",e))($c||{}),ju=(e=>(e.PRO="Pro",e.COMPANY="Company",e.TEAM="Team",e.ENTERPRISE="Enterprise",e.UNKNOWN="Unknown",e))(ju||{});const ght=(e,t,n)=>{const{data:r,error:o,mutate:i}=Pn(e,t,n),s=m.useCallback(()=>{i().catch(console.warn)},[i]);return{data:r,error:o,refetch:s,loading:!o&&!r}},ZEt=(e,t)=>fetch(e).then(fn(t)).then(n=>n.json()),GQ=()=>{const{uiConfig:e}=ht(),{flags:{UNLEASH_CLOUD:t}}=e,{data:n,refetch:r,loading:o,error:i}=ght(["useInstanceStatus",t],()=>mht(t)),s=[ju.PRO,ju.COMPANY,ju.TEAM];return{instanceStatus:n,refetchInstanceStatus:r,refresh:async()=>{await fetch(Ot("api/instance/refresh"))},isBilling:s.includes((n==null?void 0:n.plan)??ju.UNKNOWN),loading:o,error:i}},mht=async e=>{if(!e)return UN;const t=await fetch(Ot("api/instance/status"));return t.ok?t.json():UN},UN={plan:ju.UNKNOWN},vht=(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"))},sO=()=>{const{uiConfig:e,isPro:t,isEnterprise:n}=ht(),{isBilling:r}=GQ(),o=[...HN];if(e.flags.UNLEASH_CLOUD){const i=HN.findIndex(s=>s.title==="Billing & invoices");o[i]={...o[i],path:"/admin/billing"}}return o.filter(Mf(e)).filter(i=>vht(i==null?void 0:i.menu,{enterprise:n(),pro:t(),billing:r})).map(Df)},qQ=()=>{const{uiConfig:e}=ht(),t=iO(),n=sO();return{routes:{mainNavRoutes:Yh(t.mainNavRoutes).filter(Mf(e)).map(Df),mobileRoutes:Yh(t.mobileRoutes).filter(Mf(e)).map(Df),adminRoutes:n}}},yht=e=>Array.from(new Set(e)),xht=()=>{const[e,t]=TW("navigation-expanded:v1",[]);return[e,(r,o)=>{t(o?yht([...e,r]):e.filter(i=>i!==r))}]},a2=e=>({borderRadius:e.spacing(.5),borderLeft:`${e.spacing(.5)} solid transparent`,"&.Mui-selected":{borderLeft:`${e.spacing(.5)} solid ${e.palette.primary.main}`}}),aO=b(Z)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"160px"}),l2=b(Ti)(({theme:e})=>({minWidth:e.spacing(4),margin:e.spacing(.25,0)})),lO=b(mn)(({theme:e})=>({margin:0})),c2=({href:e,text:t,badge:n,onClick:r,selected:o,children:i})=>a.jsx(za,{disablePadding:!0,onClick:r,children:a.jsxs(K0,{dense:!0,component:ln,to:e,sx:a2,selected:o,children:[a.jsx(l2,{children:i}),a.jsx(lO,{children:a.jsx(aO,{children:t})}),n]})}),bht=({href:e,text:t,children:n})=>a.jsx(za,{disablePadding:!0,children:a.jsxs(K0,{dense:!0,component:ln,to:e,sx:a2,rel:"noopener noreferrer",target:"_blank",children:[a.jsx(l2,{children:n}),a.jsx(lO,{children:a.jsx(aO,{children:t})})]})}),wht=()=>a.jsx("form",{method:"POST",action:`${ki}/logout`,children:a.jsx(za,{disablePadding:!0,children:a.jsxs(K0,{dense:!0,component:"button",type:"submit",sx:a2,children:[a.jsx(l2,{children:a.jsx(S5,{})}),a.jsx(lO,{children:a.jsx(aO,{children:"Sign out"})})]})})}),u2=({href:e,text:t,selected:n,onClick:r,children:o})=>a.jsx(za,{disablePadding:!0,onClick:r,children:a.jsx(K0,{dense:!0,component:ln,to:e,sx:a2,selected:n,children:a.jsx(gt,{title:t,placement:"right",children:a.jsx(l2,{children:o})})})});var cO={},Sht=ze;Object.defineProperty(cO,"__esModule",{value:!0});var YQ=cO.default=void 0,Cht=Sht(He()),jht=a,Eht=(0,Cht.default)((0,jht.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlankOutlined");YQ=cO.default=Eht;var uO={},Tht=ze;Object.defineProperty(uO,"__esModule",{value:!0});var KQ=uO.default=void 0,kht=Tht(He()),_ht=a,Rht=(0,kht.default)((0,_ht.jsx)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"}),"AppsOutlined");KQ=uO.default=Rht;var dO={},Aht=ze;Object.defineProperty(dO,"__esModule",{value:!0});var XQ=dO.default=void 0,Pht=Aht(He()),Oht=a,$ht=(0,Pht.default)((0,Oht.jsx)("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3h7zM7 9H4V5h3v4zm10 6h3v4h-3v-4zm0-10h3v4h-3V5z"}),"AccountTreeOutlined");XQ=dO.default=$ht;var fO={},Iht=ze;Object.defineProperty(fO,"__esModule",{value:!0});var pO=fO.default=void 0,Mht=Iht(He()),Dht=a,Lht=(0,Mht.default)((0,Dht.jsx)("path",{d:"m14 6-1-2H5v17h2v-7h5l1 2h7V6h-6zm4 8h-4l-1-2H7V6h5l1 2h5v6z"}),"OutlinedFlag");pO=fO.default=Lht;var hO={},Nht=ze;Object.defineProperty(hO,"__esModule",{value:!0});var JQ=hO.default=void 0,Fht=Nht(He()),VN=a,Bht=(0,Fht.default)([(0,VN.jsx)("path",{d:"M11 14.17 8.83 12 11 9.83 9.59 8.41 6 12l3.59 3.59zm3.41 1.42L18 12l-3.59-3.59L13 9.83 15.17 12 13 14.17z"},"0"),(0,VN.jsx)("path",{d:"M19 3h-4.18C14.4 1.84 13.3 1 12 1s-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64-.1.23-.16.49-.16.77v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75zM19 15v4H5V5h14v10z"},"1")],"IntegrationInstructionsOutlined");JQ=hO.default=Bht;var gO={},zht=ze;Object.defineProperty(gO,"__esModule",{value:!0});var QQ=gO.default=void 0,Hht=zht(He()),Uht=a,Vht=(0,Hht.default)((0,Uht.jsx)("path",{d:"M13 5.08c3.06.44 5.48 2.86 5.92 5.92h3.03c-.47-4.72-4.23-8.48-8.95-8.95v3.03zM18.92 13c-.44 3.06-2.86 5.48-5.92 5.92v3.03c4.72-.47 8.48-4.23 8.95-8.95h-3.03zM11 18.92c-3.39-.49-6-3.4-6-6.92s2.61-6.43 6-6.92V2.05c-5.05.5-9 4.76-9 9.95 0 5.19 3.95 9.45 9 9.95v-3.03z"}),"DonutLargeOutlined");QQ=gO.default=Vht;var mO={},Wht=ze;Object.defineProperty(mO,"__esModule",{value:!0});var ZQ=mO.default=void 0,Ght=Wht(He()),qht=a,Yht=(0,Ght.default)((0,qht.jsx)("path",{d:"M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z"}),"ExtensionOutlined");ZQ=mO.default=Yht;var vO={},Kht=ze;Object.defineProperty(vO,"__esModule",{value:!0});var eZ=vO.default=void 0,Xht=Kht(He()),Jht=a,Qht=(0,Xht.default)((0,Jht.jsx)("path",{d:"M4 18.99h11c.67 0 1.27-.32 1.63-.83L21 12l-4.37-6.16C16.27 5.33 15.67 5 15 5H4l5 7-5 6.99z"}),"LabelImportantOutlined");eZ=vO.default=Qht;var yO={},Zht=ze;Object.defineProperty(yO,"__esModule",{value:!0});var tZ=yO.default=void 0,egt=Zht(He()),tgt=a,ngt=(0,egt.default)((0,tgt.jsx)("path",{d:"M12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6m0-2C9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96C18.67 6.59 15.64 4 12 4z"}),"CloudOutlined");tZ=yO.default=ngt;var xO={},rgt=ze;Object.defineProperty(xO,"__esModule",{value:!0});var nZ=xO.default=void 0,ogt=rgt(He()),igt=a,sgt=(0,ogt.default)((0,igt.jsx)("path",{d:"M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5zM4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25H4.34zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12zm0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7zm7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44zM15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35z"}),"GroupOutlined");nZ=xO.default=sgt;var bO={},agt=ze;Object.defineProperty(bO,"__esModule",{value:!0});var rZ=bO.default=void 0,lgt=agt(He()),cgt=a,ugt=(0,lgt.default)((0,cgt.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"}),"Computer");rZ=bO.default=ugt;var wO={},dgt=ze;Object.defineProperty(wO,"__esModule",{value:!0});var oZ=wO.default=void 0,fgt=dgt(He()),pgt=a,hgt=(0,fgt.default)((0,pgt.jsx)("path",{d:"M4 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm1.13 1.1c-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29zM20 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4 3.43c0-.81-.48-1.53-1.22-1.85-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57zm-7.76-2.78c-1.17-.52-2.61-.9-4.24-.9-1.63 0-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74zM8.07 16c.09-.23.13-.39.91-.69.97-.38 1.99-.56 3.02-.56s2.05.18 3.02.56c.77.3.81.46.91.69H8.07zM12 8c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m0-2c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"GroupsOutlined");oZ=wO.default=hgt;var SO={},ggt=ze;Object.defineProperty(SO,"__esModule",{value:!0});var iZ=SO.default=void 0,mgt=ggt(He()),Qy=a,vgt=(0,mgt.default)((0,Qy.jsxs)("g",{fillRule:"evenodd",children:[(0,Qy.jsx)("circle",{cx:"17",cy:"15.5",r:"1.12"}),(0,Qy.jsx)("path",{d:"M17 17.5c-.73 0-2.19.36-2.24 1.08.5.71 1.32 1.17 2.24 1.17s1.74-.46 2.24-1.17c-.05-.72-1.51-1.08-2.24-1.08z"}),(0,Qy.jsx)("path",{d:"M18 11.09V6.27L10.5 3 3 6.27v4.91c0 4.54 3.2 8.79 7.5 9.82.55-.13 1.08-.32 1.6-.55C13.18 21.99 14.97 23 17 23c3.31 0 6-2.69 6-6 0-2.97-2.16-5.43-5-5.91zM11 17c0 .56.08 1.11.23 1.62-.24.11-.48.22-.73.3-3.17-1-5.5-4.24-5.5-7.74v-3.6l5.5-2.4 5.5 2.4v3.51c-2.84.48-5 2.94-5 5.91zm6 4c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"})]}),"AdminPanelSettingsOutlined");iZ=SO.default=vgt;var CO={},ygt=ze;Object.defineProperty(CO,"__esModule",{value:!0});var sZ=CO.default=void 0,xgt=ygt(He()),bgt=a,wgt=(0,xgt.default)((0,bgt.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"KeyOutlined");sZ=CO.default=wgt;var jO={},Sgt=ze;Object.defineProperty(jO,"__esModule",{value:!0});var aZ=jO.default=void 0,Cgt=Sgt(He()),jgt=a,Egt=(0,Cgt.default)((0,jgt.jsx)("path",{d:"M7 15h7v2H7zm0-4h10v2H7zm0-4h10v2H7zm12-4h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-.14 0-.27.01-.4.04-.39.08-.74.28-1.01.55-.18.18-.33.4-.43.64-.1.23-.16.49-.16.77v14c0 .27.06.54.16.78s.25.45.43.64c.27.27.62.47 1.01.55.13.02.26.03.4.03h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7-.25c.41 0 .75.34.75.75s-.34.75-.75.75-.75-.34-.75-.75.34-.75.75-.75zM19 19H5V5h14v14z"}),"AssignmentOutlined");aZ=jO.default=Egt;var EO={},Tgt=ze;Object.defineProperty(EO,"__esModule",{value:!0});var lZ=EO.default=void 0,kgt=Tgt(He()),_gt=a,Rgt=(0,kgt.default)((0,_gt.jsx)("path",{d:"M21 6.5c-1.66 0-3 1.34-3 3 0 .07 0 .14.01.21l-2.03.68c-.64-1.21-1.82-2.09-3.22-2.32V5.91C14.04 5.57 15 4.4 15 3c0-1.66-1.34-3-3-3S9 1.34 9 3c0 1.4.96 2.57 2.25 2.91v2.16c-1.4.23-2.58 1.11-3.22 2.32l-2.04-.68C6 9.64 6 9.57 6 9.5c0-1.66-1.34-3-3-3s-3 1.34-3 3 1.34 3 3 3c1.06 0 1.98-.55 2.52-1.37l2.03.68c-.2 1.29.17 2.66 1.09 3.69l-1.41 1.77C6.85 17.09 6.44 17 6 17c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3c0-.68-.22-1.3-.6-1.8l1.41-1.77c1.36.76 3.02.75 4.37 0l1.41 1.77c-.37.5-.59 1.12-.59 1.8 0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3c-.44 0-.85.09-1.23.26l-1.41-1.77c.93-1.04 1.29-2.4 1.09-3.69l2.03-.68c.53.82 1.46 1.37 2.52 1.37 1.66 0 3-1.34 3-3S22.66 6.5 21 6.5zm-18 4c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zM6 21c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm5-18c0-.55.45-1 1-1s1 .45 1 1-.45 1-1 1-1-.45-1-1zm1 12c-1.38 0-2.5-1.12-2.5-2.5S10.62 10 12 10s2.5 1.12 2.5 2.5S13.38 15 12 15zm6 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm3-8.5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"}),"HubOutlined");lZ=EO.default=Rgt;var TO={},Agt=ze;Object.defineProperty(TO,"__esModule",{value:!0});var cZ=TO.default=void 0,Pgt=Agt(He()),Ogt=a,$gt=(0,Pgt.default)((0,Ogt.jsx)("path",{d:"m22.61 18.99-9.08-9.08c.93-2.34.45-5.1-1.44-7C9.79.61 6.21.4 3.66 2.26L7.5 6.11 6.08 7.52 2.25 3.69C.39 6.23.6 9.82 2.9 12.11c1.86 1.86 4.57 2.35 6.89 1.48l9.11 9.11c.39.39 1.02.39 1.41 0l2.3-2.3c.4-.38.4-1.01 0-1.41zm-3 1.6-9.46-9.46c-.61.45-1.29.72-2 .82-1.36.2-2.79-.21-3.83-1.25C3.37 9.76 2.93 8.5 3 7.26l3.09 3.09 4.24-4.24-3.09-3.09c1.24-.07 2.49.37 3.44 1.31 1.08 1.08 1.49 2.57 1.24 3.96-.12.71-.42 1.37-.88 1.96l9.45 9.45-.88.89z"}),"BuildOutlined");cZ=TO.default=$gt;var kO={},Igt=ze;Object.defineProperty(kO,"__esModule",{value:!0});var uZ=kO.default=void 0,Mgt=Igt(He()),Dgt=a,Lgt=(0,Mgt.default)((0,Dgt.jsx)("path",{d:"M2 7h4v10H2V7zm5 12h10V5H7v14zM18 7h4v10h-4V7z"}),"ViewCarousel");uZ=kO.default=Lgt;var _O={},Ngt=ze;Object.defineProperty(_O,"__esModule",{value:!0});var dZ=_O.default=void 0,Fgt=Ngt(He()),Bgt=a,zgt=(0,Fgt.default)((0,Bgt.jsx)("path",{d:"M19.88 18.47c.44-.7.7-1.51.7-2.39 0-2.49-2.01-4.5-4.5-4.5s-4.5 2.01-4.5 4.5 2.01 4.5 4.49 4.5c.88 0 1.7-.26 2.39-.7L21.58 23 23 21.58l-3.12-3.11zm-3.8.11c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm-.36-8.5c-.74.02-1.45.18-2.1.45l-.55-.83-3.8 6.18-3.01-3.52-3.63 5.81L1 17l5-8 3 3.5L13 6l2.72 4.08zm2.59.5c-.64-.28-1.33-.45-2.05-.49L21.38 2 23 3.18l-4.69 7.4z"}),"QueryStatsOutlined");dZ=_O.default=zgt;var RO={},Hgt=ze;Object.defineProperty(RO,"__esModule",{value:!0});var fZ=RO.default=void 0,Ugt=Hgt(He()),WN=a,Vgt=(0,Ugt.default)([(0,WN.jsx)("path",{d:"M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2l-1.5 1.5zM15 20H6c-.55 0-1-.45-1-1v-1h10v2zm4-1c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11v14z"},"0"),(0,WN.jsx)("path",{d:"M9 7h6v2H9zm7 0h2v2h-2zm-7 3h6v2H9zm7 0h2v2h-2z"},"1")],"ReceiptLongOutlined");fZ=RO.default=Vgt;var AO={},Wgt=ze;Object.defineProperty(AO,"__esModule",{value:!0});var pZ=AO.default=void 0,Ggt=Wgt(He()),qgt=a,Ygt=(0,Ggt.default)((0,qgt.jsx)("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5l-8-3zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25v4.7z"}),"ShieldOutlined");pZ=AO.default=Ygt;var PO={},Kgt=ze;Object.defineProperty(PO,"__esModule",{value:!0});var hZ=PO.default=void 0,Xgt=Kgt(He()),Jgt=a,Qgt=(0,Xgt.default)((0,Jgt.jsx)("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"}),"HistoryOutlined");hZ=PO.default=Qgt;var OO={},Zgt=ze;Object.defineProperty(OO,"__esModule",{value:!0});var gZ=OO.default=void 0,emt=Zgt(He()),tmt=a,nmt=(0,emt.default)((0,tmt.jsx)("path",{d:"M2 20h20v-4H2v4zm2-3h2v2H4v-2zM2 4v4h20V4H2zm4 3H4V5h2v2zm-4 7h20v-4H2v4zm2-3h2v2H4v-2z"}),"StorageOutlined");gZ=OO.default=nmt;var $O={},rmt=ze;Object.defineProperty($O,"__esModule",{value:!0});var mZ=$O.default=void 0,omt=rmt(He()),imt=a,smt=(0,omt.default)((0,imt.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"}),"CreditCardOutlined");mZ=$O.default=smt;var IO={},amt=ze;Object.defineProperty(IO,"__esModule",{value:!0});var vZ=IO.default=void 0,lmt=amt(He()),cmt=a,umt=(0,lmt.default)((0,cmt.jsx)("path",{d:"M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V9h14v10zM5 7V5h14v2H5zm2 4h10v2H7zm0 4h7v2H7z"}),"EventNoteOutlined");vZ=IO.default=umt;const dmt={"/applications":KQ,"/context":XQ,"/feature-toggle-type":pO,"/integrations":JQ,"/segments":QQ,"/strategies":ZQ,"/tag-types":eZ,"/environments":tZ,"/admin/users":nZ,"/admin/service-accounts":rZ,"/admin/groups":oZ,"/admin/roles":iZ,"/admin/api":sZ,"/admin/auth":aZ,"/admin/network":lZ,"/admin/maintenance":cZ,"/admin/banners":uZ,"/admin/instance":dZ,"/admin/license":fZ,"/admin/instance-privacy":pZ,"/admin/logins":hZ,"/admin/cors":gZ,"/admin/billing":mZ,"/history":vZ,GitHub:MS,Documentation:DS},fmt=e=>dmt[e]||YQ,yZ=({path:e})=>{const t=fmt(e);return a.jsx(t,{})},xZ=b(mC)(({theme:e})=>({fill:e.palette.neutral.main,stroke:e.palette.neutral.main,width:e.spacing(3),height:e.spacing(3),fontSize:e.spacing(3)}));var MO={},pmt=ze;Object.defineProperty(MO,"__esModule",{value:!0});var bZ=MO.default=void 0,hmt=pmt(He()),gmt=a,mmt=(0,hmt.default)((0,gmt.jsx)("path",{d:"m22 2-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixNormal");bZ=MO.default=mmt;var DO={},vmt=ze;Object.defineProperty(DO,"__esModule",{value:!0});var wZ=DO.default=void 0,ymt=vmt(He()),GN=a,xmt=(0,ymt.default)([(0,GN.jsx)("path",{d:"M21 8c-1.45 0-2.26 1.44-1.93 2.51l-3.55 3.56c-.3-.09-.74-.09-1.04 0l-2.55-2.55C12.27 10.45 11.46 9 10 9c-1.45 0-2.27 1.44-1.93 2.52l-4.56 4.55C2.44 15.74 1 16.55 1 18c0 1.1.9 2 2 2 1.45 0 2.26-1.44 1.93-2.51l4.55-4.56c.3.09.74.09 1.04 0l2.55 2.55C12.73 16.55 13.54 18 15 18c1.45 0 2.27-1.44 1.93-2.52l3.56-3.55c1.07.33 2.51-.48 2.51-1.93 0-1.1-.9-2-2-2z"},"0"),(0,GN.jsx)("path",{d:"m15 9 .94-2.07L18 6l-2.06-.93L15 3l-.92 2.07L12 6l2.08.93zM3.5 11 4 9l2-.5L4 8l-.5-2L3 8l-2 .5L3 9z"},"1")],"Insights");wZ=DO.default=xmt;const bmt=b("div")(({theme:e})=>({paddingLeft:e.spacing(2),display:"flex"})),wmt=()=>a.jsx(gt,{title:"This is an Enterprise feature",children:a.jsx(bmt,{children:a.jsx(E5,{})})}),Smt=()=>{const{isPro:e}=ht();return m.useCallback(n=>!!(e()&&!(n!=null&&n.includes("pro"))&&(n!=null&&n.includes("enterprise"))),[e])},Zb=({routes:e,mode:t,onClick:n,activeItem:r})=>{const o=Smt(),i=t==="mini"?u2:c2;return a.jsx(ns,{children:e.map(s=>{var l;return a.jsx(i,{onClick:()=>n(s.path),href:s.path,text:s.title,selected:r===s.path,badge:o((l=s==null?void 0:s.menu)==null?void 0:l.mode)?a.jsx(wmt,{}):null,children:a.jsx(yZ,{path:s.path})},s.title)})})},Cmt=()=>{const{uiConfig:e}=ht();return a.jsxs(ns,{children:[e.links.map(t=>a.jsx(bht,{href:t.href,text:t.value,children:a.jsx(yZ,{path:t.value})},t.value)),a.jsx(wht,{})]})},jmt=({projectId:e,mode:t,onClick:n})=>{const r=t==="mini"?u2:c2;return a.jsx(ns,{children:a.jsx(r,{href:`/projects/${e}`,text:e,onClick:n,selected:!1,children:a.jsx(xZ,{})})})},Emt=({flags:e,mode:t,onClick:n})=>{const r=t==="mini"?u2:c2;return a.jsx(ns,{children:e.map(o=>a.jsx(r,{href:`/projects/${o.projectId}/features/${o.featureId}`,text:o.featureId,onClick:n,selected:!1,children:a.jsx(pO,{})},o.featureId))})},SZ=({mode:e,onClick:t,activeItem:n})=>{const r=e==="mini"?u2:c2,o=Nr("killInsightsUI"),{isOss:i}=ht();return a.jsxs(ns,{children:[a.jsx(r,{href:"/projects",text:"Projects",onClick:()=>t("/projects"),selected:n==="/projects",children:a.jsx(xZ,{})}),a.jsx(r,{href:"/search",text:"Search",onClick:()=>t("/search"),selected:n==="/search",children:a.jsx(md,{})}),a.jsx(r,{href:"/playground",text:"Playground",onClick:()=>t("/playground"),selected:n==="/playground",children:a.jsx(bZ,{})}),a.jsx(W,{condition:!o&&!i(),show:a.jsx(r,{href:"/insights",text:"Insights",onClick:()=>t("/insights"),selected:n==="/insights",children:a.jsx(wZ,{})})})]})},Tmt=({children:e})=>a.jsx(Zf,{expandIcon:a.jsx(n1,{}),"aria-controls":"configure-content",id:"configure-header",children:a.jsx(Z,{sx:{fontWeight:"bold",fontSize:"small"},children:e})}),qN=({mode:e,expanded:t,onExpandChange:n,title:r,children:o})=>a.jsxs(Jf,{disableGutters:!0,sx:{boxShadow:"none","&:before":{display:"none"}},expanded:t,onChange:(i,s)=>{n(s)},children:[e==="full"&&a.jsx(Tmt,{children:r}),a.jsx(Qf,{sx:{p:0},children:o})]}),kmt=({mode:e,onClick:t,projectId:n})=>a.jsxs(ne,{children:[e==="full"&&a.jsx(Z,{sx:{fontWeight:"bold",fontSize:"small",ml:2,mt:1.5},children:"Recent project"}),a.jsx(jmt,{projectId:n,mode:e,onClick:t})]}),_mt=({mode:e,onClick:t,flags:n})=>a.jsxs(ne,{children:[e==="full"&&a.jsx(Z,{sx:{fontWeight:"bold",fontSize:"small",ml:2},children:"Recent flags"}),a.jsx(Emt,{flags:n,mode:e,onClick:t})]}),Rmt=e=>{const t=e.split("/").filter(o=>o);return t.length===0||t[0]==="admin"&&t.length===1?"/projects":t[0]==="admin"&&t.length>1?`/${t[0]}/${t[1]}`:`/${t[0]}`},Amt=()=>{const{pathname:e,state:t}=Ao();return Rmt(e)},CZ=(e,t)=>{const n=m.useCallback(()=>{const r=new CustomEvent(e);document.dispatchEvent(r)},[e]);return m.useEffect(()=>{const r=o=>t(o);return document.addEventListener(e,r),()=>{document.removeEventListener(e,r)}},[e,t]),{emitEvent:n}},jZ=()=>{const e=`${ki}:unleash-lastViewedProject`,[t,n]=m.useState(()=>_f(e)),{emitEvent:r}=CZ("lastViewedProjectUpdated",()=>{n(_f(e))});return m.useEffect(()=>{t&&(Rf(e,t),r())},[t,e,r]),{lastViewed:t,setLastViewed:n}},YN=3,EZ=e=>Array.isArray(e)?e.filter(t=>t.featureId&&t.projectId):[],KN=e=>EZ(_f(e)||[]),Pmt=()=>{const e=`${ki}:unleash-lastViewedFlags`,[t,n]=m.useState(()=>KN(e)),{emitEvent:r}=CZ("lastViewedFlagsUpdated",m.useCallback(()=>{n(KN(e))},[e]));m.useEffect(()=>{t&&(Rf(e,t),r())},[JSON.stringify(t),e,r]);const o=m.useCallback(i=>{if(!i.featureId||!i.projectId||t.find(l=>l.featureId===i.featureId))return;const s=EZ([...t,i]);n(s.length>YN?s.slice(-YN):s)},[JSON.stringify(t)]);return{lastViewed:t,setLastViewed:o}},Omt=({onClick:e})=>{const{routes:t}=qQ();return a.jsxs(a.Fragment,{children:[a.jsx(SZ,{mode:"full",onClick:e}),a.jsx(Zb,{routes:t.mainNavRoutes,mode:"full",onClick:e}),a.jsx(Zb,{routes:t.adminRoutes,mode:"full",onClick:e}),a.jsx(Cmt,{})]})},$mt=b(ne)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(2),alignSelf:"stretch",display:"flex",flexDirection:"column",gap:e.spacing(2),zIndex:1,overflowAnchor:"none"})),Imt=()=>{const{routes:e}=qQ(),[t,n]=JCe(),[r,o]=xht(),i=Amt(),[s,l]=m.useState(i),{lastViewed:c}=jZ(),u=t==="full"&&c,{lastViewed:d}=Pmt(),f=t==="full"&&d.length>0;return a.jsxs($mt,{children:[a.jsx(SZ,{mode:t,onClick:l,activeItem:s}),a.jsx(qN,{expanded:r.includes("configure"),onExpandChange:p=>{o("configure",p)},mode:t,title:"Configure",children:a.jsx(Zb,{routes:e.mainNavRoutes,mode:t,onClick:l,activeItem:s})}),t==="full"&&a.jsx(qN,{expanded:r.includes("admin"),onExpandChange:p=>{o("admin",p)},mode:t,title:"Admin",children:a.jsx(Zb,{routes:e.adminRoutes,mode:t,onClick:l,activeItem:s})}),t==="mini"&&a.jsx(f2e,{onChange:()=>{o("admin",!0),n("full")}}),u&&a.jsx(kmt,{mode:t,projectId:c,onClick:()=>l("/projects")}),f&&a.jsx(_mt,{mode:t,flags:d,onClick:()=>l("/projects")}),a.jsx(u2e,{mode:t,onChange:()=>{n(t==="full"?"mini":"full")}})]})},Mmt=b("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"start","& svg":{width:"100%",height:"100%",maxHeight:e.spacing(8),padding:e.spacing(.5)}})),TZ=({links:e=[],open:t=!1,toggleDrawer:n,routes:r})=>{const o=Nr("navigationSidebar"),i=()=>e.map(s=>{let l=null;return s.value==="GitHub"?l=a.jsx(MS,{className:ka.navigationIcon}):s.value==="Documentation"&&(l=a.jsx(DS,{className:ka.navigationIcon})),a.jsxs("a",{href:s.href,rel:"noopener noreferrer",target:"_blank",className:ka.iconLink,children:[l,s.value]},s.value)});return a.jsx(kme,{className:ka.drawer,open:t,anchor:"left",onClose:n,style:{zIndex:Xo.zIndex.snackbar+1},children:a.jsxs("nav",{id:"header-drawer",className:ka.drawerContainer,children:[a.jsx(Mmt,{children:a.jsx(ln,{to:"/",className:ka.drawerTitle,"aria-label":"Home",onClick:()=>n(),children:a.jsx(hd,{darkmode:a.jsx(y5,{"aria-label":"Unleash logo"}),lightmode:a.jsx(v5,{"aria-label":"Unleash logo"})})})}),a.jsx(vr,{}),a.jsx(W,{condition:!!o,show:a.jsx(Omt,{onClick:n}),elseShow:a.jsxs(a.Fragment,{children:[a.jsx(ns,{className:ka.drawerList,children:r.mobileRoutes.map(s=>a.jsx(w6,{handleClose:()=>n(),path:s.path,text:s.title},s.path))}),a.jsx(vr,{}),a.jsx(ns,{className:ka.drawerList,children:r.adminRoutes.map(s=>{var l;return a.jsx(w6,{handleClose:()=>n(),path:s.path,text:s.title,mode:(l=s.menu)==null?void 0:l.mode},s.path)})}),a.jsx(vr,{}),a.jsxs("div",{className:ka.iconLinkList,children:[i(),a.jsxs("a",{className:ka.iconLink,href:`${ki}/logout`,children:[a.jsx(S5,{className:ka.navigationIcon}),"Sign out"]})]})]})})]})})};var LO={},Dmt=ze;Object.defineProperty(LO,"__esModule",{value:!0});var NO=LO.default=void 0,Lmt=Dmt(He()),Nmt=a,Fmt=(0,Lmt.default)((0,Nmt.jsx)("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49zM12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"}),"DarkModeOutlined");NO=LO.default=Fmt;var FO={},Bmt=ze;Object.defineProperty(FO,"__esModule",{value:!0});var BO=FO.default=void 0,zmt=Bmt(He()),Hmt=a,Umt=(0,zmt.default)((0,Hmt.jsx)("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"}),"LightModeOutlined");BO=FO.default=Umt;const Vmt=(e={})=>{const t=Ot("api/admin/notifications"),{data:n,error:r,mutate:o}=Pn(t,Wmt,e),i=m.useCallback(()=>{o().catch(console.warn)},[o]);return{notifications:n,error:r,loading:!r&&!n,refetchNotifications:i,mutateNotifications:o}},Wmt=async e=>await(await fetch(e).then(fn("Notifications"))).json();var zO={},Gmt=ze;Object.defineProperty(zO,"__esModule",{value:!0});var HO=zO.default=void 0,qmt=Gmt(He()),Ymt=a,Kmt=(0,qmt.default)((0,Ymt.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");HO=zO.default=Kmt;const Xmt=b(ne)(({theme:e})=>({padding:e.spacing(1,1.5,1,3),display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",boxShadow:e.boxShadows.separator})),Jmt=({children:e})=>a.jsx(a.Fragment,{children:a.jsxs(Xmt,{children:[a.jsx(Z,{fontWeight:"bold",children:"Notifications"}),e]})}),Qmt=b(ns)(({theme:e})=>({padding:e.spacing(1,1,3,1)})),Zmt=({children:e})=>a.jsx(Qmt,{"data-testid":"NOTIFICATIONS_LIST",children:e});var UO={},evt=ze;Object.defineProperty(UO,"__esModule",{value:!0});var kZ=UO.default=void 0,tvt=evt(He()),nvt=a,rvt=(0,tvt.default)((0,nvt.jsx)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}),"ToggleOffOutlined");kZ=UO.default=rvt;const XN=b(ne,{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})),ovt=b(K0)(({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}})),ivt=b(ne)(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%"})),svt=b(ne)(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",margin:e.spacing(1,0,0,5.25)})),avt=b(Z,{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"})),lvt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.neutral.main})),cvt=b(ne)(({theme:e})=>({...tp})),uvt=b(hg)(({theme:e})=>({width:"18px",height:"18px"})),dvt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.neutral.main,marginLeft:e.spacing(1)})),fvt=({notification:e,onNotificationClick:t})=>{const n=It(),{readAt:r}=e,o=i=>{if(i==="change-request")return a.jsx(XN,{readAt:!!r,children:a.jsx(yP,{color:e.readAt?n.palette.neutral.main:n.palette.primary.main,style:{transform:"scale(0.8)"}})});if(i==="toggle")return a.jsx(XN,{readAt:!!r,children:a.jsx(kZ,{sx:s=>({height:"20px",width:"20px",color:r?s.palette.neutral.main:s.palette.primary.main})})})};return a.jsx(ovt,{onClick:()=>t(e),children:a.jsxs(ivt,{children:[a.jsxs(avt,{readAt:!!r,children:[o(e.notificationType)," ",e.message]}),a.jsxs(svt,{children:[a.jsxs(cvt,{children:[a.jsx(uvt,{src:e.createdBy.imageUrl||""}),a.jsxs(dvt,{children:["Created by ",e.createdBy.username]})]}),a.jsx(lvt,{children:a.jsx(Lc,{date:new Date(e.createdAt),minPeriod:60})})]})]})})},pvt=b(ne)(()=>({display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",minHeight:"150px"})),hvt=b(HO)(({theme:e})=>({height:"30px",width:"30px",color:e.palette.neutral.main,marginBottom:e.spacing(1)})),gvt=({text:e})=>a.jsxs(pvt,{children:[a.jsx(hvt,{}),a.jsx(Z,{color:"neutral.main",children:e})]}),mvt=()=>{const{makeRequest:e,createRequest:t,errors:n,loading:r}=sr({propagateErrors:!0});return{loading:r,errors:n,markAsRead:async i=>{const l=t("api/admin/notifications/read",{method:"POST",body:JSON.stringify(i)});await e(l.caller,l.id)}}},vvt=b(ne)(({theme:e})=>({display:"flex",gap:e.spacing(1),marginTop:e.spacing(.5)})),yvt=({id:e,localStorageKey:t,eventName:n})=>{var d;const{uiConfig:r}=ht(),{value:o,setValue:i}=Xl(`${r.baseUriPath}:${t}:v1:${e}`,{}),[s,l]=m.useState(o.value),{trackEvent:c}=Sn();if(!((d=r==null?void 0:r.flags)!=null&&d.T)||s)return null;const u=f=>{l(f),i({value:f}),c(n,{props:{eventType:e,wasHelpful:f==="yes"}})};return a.jsxs(xr,{elevation:0,sx:{background:f=>f.palette.neutral.light,padding:f=>f.spacing(1.5,2),marginTop:f=>f.spacing(1.5)},children:["Was this information useful to you?",a.jsxs(vvt,{children:[a.jsx(We,{size:"small",variant:s==="yes"?"contained":"outlined",sx:{padding:0},onClick:()=>u("yes"),disabled:!!s,children:"Yes"}),a.jsx(We,{size:"small",variant:s==="no"?"contained":"outlined",sx:{padding:0},onClick:()=>u("no"),disabled:!!s,children:"No"})]})]})},xvt=b(ne)(()=>({position:"relative"})),bvt=b(ne)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,display:"flex",justifyContent:"center"})),wvt=b(Z)(({theme:e})=>({fontWeight:"bold",fontSize:e.fontSizes.smallBody,color:e.palette.primary.main,textAlign:"center"})),Svt=b(xr)(({theme:e})=>({width:"420px",boxShadow:e.boxShadows.popup,borderRadius:`${e.shape.borderRadiusLarge}px`,position:"absolute",right:-100,top:60,maxHeight:"80vh",overflowY:"auto"})),Cvt=b(ne)(({theme:e})=>({backgroundColor:e.palette.primary.main,borderRadius:"100%",width:"7px",height:"7px",position:"absolute",top:11,right:11})),jvt=b(ne)(()=>({...tp})),Evt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Tvt=b(Ht)(({theme:e})=>({"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),_Z=()=>{const[e,t]=m.useState(!1),{notifications:n,refetchNotifications:r}=Vmt({refreshInterval:15e3}),o=$t(),{markAsRead:i}=mvt(),{uiConfig:s}=ht(),{trackEvent:l}=Sn(),[c,u]=m.useState(!1),d=async w=>{var S;w.link&&o(w.link),(S=s==null?void 0:s.flags)!=null&&S.T&&l("notifications",{props:{eventType:w.notificationType}}),t(!1);try{await i({notifications:[w.id]}),r()}catch(C){console.error("Error marking notification as read: ",C)}},f=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)}},p=w=>{w.key==="Escape"&&t(!1)},h=n==null?void 0:n.filter(w=>w.readAt===null),g=!!(h&&h.length>0),v=w=>c?!w.readAt:!0,x=n==null?void 0:n.filter(v).map(w=>a.jsx(fvt,{notification:w,onNotificationClick:d},w.id)),y=!!(n&&n.length>0&&!c);return a.jsxs(xvt,{children:[a.jsx(gt,{title:"Notifications",arrow:!0,children:a.jsxs(Tvt,{onClick:()=>t(!e),"data-testid":"NOTIFICATIONS_BUTTON",size:"large",children:[a.jsx(W,{condition:g,show:a.jsx(Cvt,{})}),a.jsx(HO,{})]})}),a.jsx(W,{condition:e,show:a.jsx(pS,{onClickAway:()=>t(!1),children:a.jsxs(Svt,{className:"dropdown-outline",onKeyDown:p,"data-testid":"NOTIFICATIONS_MODAL",children:[a.jsx(Jmt,{children:a.jsxs(jvt,{children:[a.jsx(Evt,{children:"Show only unread"}),a.jsx(is,{onClick:()=>u(!c),checked:c})]})}),a.jsx(W,{condition:g,show:a.jsx(bvt,{"data-testid":"UNREAD_NOTIFICATIONS",children:a.jsx(We,{onClick:f,children:a.jsxs(wvt,{children:["Mark all as read (",h==null?void 0:h.length,")"]})})})})," ",a.jsx(W,{condition:(x==null?void 0:x.length)===0,show:a.jsx(gvt,{text:c?"No unread notifications":"No new notifications"})}),a.jsx(Zmt,{children:x}),a.jsx(W,{condition:y,show:a.jsxs(a.Fragment,{children:[a.jsx(yvt,{eventName:"notifications",id:"useful",localStorageKey:"NotificationsUsefulPrompt"}),a.jsx("br",{})]})})]})})})]})};var VO={},kvt=ze;Object.defineProperty(VO,"__esModule",{value:!0});var RZ=VO.default=void 0,_vt=kvt(He()),Rvt=a,Avt=(0,_vt.default)((0,Rvt.jsx)("path",{d:"M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"PersonAdd");RZ=VO.default=Avt;const AZ="api/admin/invite-link/tokens",Pvt=()=>{const e=Ot(AZ);return fetch(e,{method:"GET"}).then(t=>t.json())},Ovt=(e={})=>{var i;const{data:t,error:n}=Pn(AZ,Pvt,e),[r,o]=m.useState(!n&&!t);return m.useEffect(()=>{o(!n&&!t)},[t,n]),{data:t?{tokens:(i=t.tokens)==null?void 0:i.filter(s=>s.enabled)}:void 0,error:n,loading:r}},$vt=b(ne)(()=>({mb:{xs:1,md:0},display:"flex",justifyContent:"center",flexDirection:"column"})),Ivt=b(ne)(()=>({display:"flex",alignItems:"center",flexGrow:1})),Mvt=({onActionClick:e})=>{var x,y,w,S,C;const t=$t(),{data:n,loading:r}=Ovt(),o=gd(r);Sn();const i=((x=n==null?void 0:n.tokens)==null?void 0:x.find(E=>E.name==="default"))??null,s=i==null?void 0:i.url,l=((w=(y=n==null?void 0:n.tokens)==null?void 0:y[0])==null?void 0:w.createdAt)??"",u=(((C=(S=n==null?void 0:n.tokens)==null?void 0:S[0])==null?void 0:C.expiresAt)??"")||!1,d=!!(u&&wv(new Date,Js(u))),f=u&&wv(Zje(new Date,{days:14}),Js(u)),p=u?pG(Js(u)):!1,{locationSettings:h}=Mi(),g=a.jsx(Z,{component:"span",variant:"body2",color:f?"warning.dark":"inherit",fontWeight:"bold",children:p}),v=()=>{e==null||e(s),t("/admin/invite-link")};return a.jsxs(a.Fragment,{children:[a.jsx($vt,{ref:o,children:a.jsx(W,{condition:!!s,show:a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"body2",sx:{mb:1},children:[`You have an invite link created on ${If(l,h.locale)} `,a.jsx(W,{condition:d,show:a.jsxs(a.Fragment,{children:["that expired ",g," ","ago"]}),elseShow:a.jsxs(a.Fragment,{children:["that will expire in"," ",g]})})]}),a.jsx(AJ,{small:!0,inviteLink:s})]}),elseShow:a.jsx(Z,{variant:"body2","data-loading":!0,children:"You can easily create an invite link here that you can share and use to invite people from your company to your Unleash setup."})})}),a.jsx(Ivt,{sx:{justifyContent:{xs:"center",md:"flex-end"}},children:a.jsxs(We,{variant:"outlined",onClick:v,"data-loading":!0,children:[s?"Update":"Create"," invite link"]})})]})},Dvt=b(xr)(({theme:e})=>({display:"flex",flexDirection:"column",gap:e.spacing(2),alignItems:"flex-start",padding:e.spacing(3),borderRadius:e.shape.borderRadiusMedium,boxShadow:e.boxShadows.popup,position:"absolute",zIndex:5e3,right:-255,minWidth:e.spacing(80),[e.breakpoints.down("md")]:{width:"100%",padding:"1rem"}})),Lvt=({id:e,showInviteLinkContent:t,setShowInviteLinkContent:n})=>{const{trackEvent:r}=Sn(),o=i=>{n(!1),r("invite",{props:{eventType:i?"header link bar action: edit":"header link bar action: create"}})};return a.jsx(W,{condition:t,show:a.jsx(Dvt,{className:"dropdown-outline",id:e,children:a.jsx(Mvt,{onActionClick:o})})})},Nvt=b("div")(()=>({position:"relative"})),Fvt=b(Ht)(({theme:e})=>({...Kl(e),borderRadius:100,"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),PZ=()=>{const[e,t]=m.useState(!1),n=Dc(),{isAdmin:r}=m.useContext(Di);return r?a.jsx(pS,{onClickAway:()=>t(!1),children:a.jsxs(Nvt,{children:[a.jsx(gt,{title:"Invite users",arrow:!0,children:a.jsx(Fvt,{onClick:()=>t(!0),size:"large",children:a.jsx(RZ,{})})}),a.jsx(Lvt,{showInviteLinkContent:e,setShowInviteLinkContent:t,id:n})]})}):null},JN=b(BU)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300,paddingRight:e.spacing(9),[e.breakpoints.down("lg")]:{paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.down(1024)]:{marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"},margin:"0 auto"})),QN=b(ne)(()=>({display:"flex",alignItems:"center",width:"100%","&&&":{padding:0}})),ZN=b("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),Bvt=b("nav")({display:"flex",alignItems:"center",flexGrow:1}),zvt=b(y5)({width:"150px"}),Hvt=b(v5)({width:"150px"}),Uvt=b(yW)({width:"150px"});b("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}}));const Vvt=b(ln)(({theme:e})=>Kl(e));b("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)}));const eF=b(Ht)(({theme:e})=>({borderRadius:100,"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),Wvt=()=>{const{onSetThemeMode:e,themeMode:t}=kS(),n=It(),r=Nr("disableNotifications"),{uiConfig:o,isOss:i}=ht(),s=Qn(n.breakpoints.down("lg")),[l,c]=m.useState(!1),u=()=>c(g=>!g),d=Nr("celebrateUnleash"),f=iO(),p=sO(),h={mainNavRoutes:Yh(f.mainNavRoutes).filter(Mf(o)).map(Df),mobileRoutes:Yh(f.mobileRoutes).filter(Mf(o)).map(Df),adminRoutes:p};return s?a.jsx(JN,{position:"static",children:a.jsxs(QN,{children:[a.jsx(gt,{title:"Menu",arrow:!0,children:a.jsx(Ht,{sx:{color:g=>g.palette.text.primary},onClick:u,"aria-controls":"header-drawer","aria-expanded":l,size:"large",children:a.jsx(c5,{})})}),a.jsx(TZ,{links:o.links,open:l,toggleDrawer:u,routes:h}),a.jsx(ZN,{children:a.jsx(mb,{})})]})}):a.jsx(JN,{position:"static",children:a.jsxs(QN,{children:[a.jsx(Vvt,{to:"/",sx:tp,"aria-label":"Home",children:a.jsx(hd,{darkmode:a.jsx(W,{condition:d,show:a.jsx(xW,{}),elseShow:a.jsx(zvt,{"aria-label":"Unleash logo"})}),lightmode:a.jsx(W,{condition:d,show:a.jsx(Uvt,{}),elseShow:a.jsx(Hvt,{"aria-label":"Unleash logo"})})})}),a.jsx(Bvt,{children:a.jsxs(ZN,{children:[a.jsx(PZ,{}),a.jsx(gt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:a.jsx(eF,{onClick:e,size:"large",children:a.jsx(W,{condition:t==="dark",show:a.jsx(NO,{}),elseShow:a.jsx(BO,{})})})}),a.jsx(W,{condition:!i()&&!r,show:a.jsx(_Z,{})}),a.jsx(gt,{title:"Documentation",arrow:!0,children:a.jsx(eF,{component:"a",href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",sx:{mr:1},children:a.jsx(IS,{})})}),a.jsx(vr,{orientation:"vertical",variant:"middle",flexItem:!0,sx:{ml:1}}),a.jsx(mb,{})]})})]})})},Gvt=b(ln)(({theme:e})=>({textDecoration:"none",alignItems:"center",display:"flex",color:"inherit",height:"100%",width:"100%","&&":{padding:e.spacing(1,2)}})),qvt=b("span")(({theme:e})=>({width:"12.5px",height:"12.5px",display:"block",backgroundColor:e.palette.primary.main,marginRight:e.spacing(2),borderRadius:"2px"})),Yvt=b("div")(({theme:e})=>({marginLeft:"auto",paddingLeft:e.spacing(2),display:"flex"})),tF=({options:e,id:t,handleClose:n,anchorEl:r,style:o})=>{const{isPro:i,isOss:s}=ht(),l=m.useCallback(c=>!!(i()&&!(c!=null&&c.includes("pro"))&&(c!=null&&c.includes("enterprise"))),[i]);return a.jsx(J0,{id:t,onClose:n,anchorEl:r,open:!!r,style:o,children:e.flatMap((c,u)=>{var p,h,g;const d=(p=e[u-1])==null?void 0:p.group;return[d&&d!==c.group&&(!s()||c.group==="log")?a.jsx(vr,{variant:"middle"},c.group):null,a.jsx(gt,{title:l((h=c==null?void 0:c.menu)==null?void 0:h.mode)?"This is an Enterprise feature":"",arrow:!0,placement:"left",children:a.jsxs(Mo,{component:Gvt,to:c.path,onClick:n,children:[a.jsx(qvt,{}),c.title,a.jsx(W,{condition:l((g=c==null?void 0:c.menu)==null?void 0:g.mode),show:a.jsx(Yvt,{children:a.jsx(E5,{})})})]})},c.path)]}).filter(Boolean)})},nF=b(BU)(({theme:e})=>({backgroundColor:e.palette.background.paper,padding:e.spacing(1),boxShadow:"none",position:"relative",zIndex:300,maxWidth:"1512px",[e.breakpoints.down("lg")]:{maxWidth:"1280px",paddingLeft:e.spacing(1),paddingRight:e.spacing(1)},[e.breakpoints.down(1024)]:{marginLeft:0,marginRight:0},[e.breakpoints.down("sm")]:{minWidth:"100%"},margin:"0 auto"})),rF=b(ne)(()=>({display:"flex",alignItems:"center",width:"100%","&&&":{padding:0}})),oF=b("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),Kvt=b("nav")({display:"flex",alignItems:"center",flexGrow:1}),Xvt=b(y5)({width:"150px"}),Jvt=b(v5)({width:"150px"}),Qvt=b(yW)({width:"150px"}),Zvt=b("div")(({theme:e})=>({display:"flex",justifyContent:"center",marginLeft:e.spacing(3),"& a":{textDecoration:"none",color:"inherit",marginRight:e.spacing(3),display:"flex",alignItems:"center"}})),e0t=b("button")(({theme:e})=>({...Kl(e),border:"none",background:"transparent",height:"100%",display:"flex",fontSize:e.fontSizes.bodySize,fontFamily:e.typography.fontFamily,alignItems:"center",color:"inherit",cursor:"pointer"})),t0t=e=>({color:e.palette.neutral.main}),_m=b(ln)(({theme:e})=>Kl(e));b("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1)}));const nT=b(Ht)(({theme:e})=>({borderRadius:100,"&:focus-visible":{outlineStyle:"solid",outlineWidth:2,outlineColor:e.palette.primary.main,borderRadius:"100%"}})),n0t=()=>{const{onSetThemeMode:e,themeMode:t}=kS(),n=It(),r=Dc(),o=Dc(),[i,s]=m.useState(null),[l,c]=m.useState(null),u=Nr("disableNotifications"),{uiConfig:d,isOss:f}=ht(),p=Qn(n.breakpoints.down("md")),[h,g]=m.useState(!1),v=()=>g(k=>!k),x=()=>s(null),y=()=>c(null),w=Nr("celebrateUnleash"),S=Nr("killInsightsUI"),C=iO(),E=sO(),j={mainNavRoutes:Yh(C.mainNavRoutes).filter(Mf(d)).map(Df),mobileRoutes:Yh(C.mobileRoutes).filter(Mf(d)).map(Df),adminRoutes:E};return p?a.jsx(nF,{position:"static",children:a.jsxs(rF,{children:[a.jsx(gt,{title:"Menu",arrow:!0,children:a.jsx(Ht,{sx:{color:k=>k.palette.text.primary},onClick:v,"aria-controls":"header-drawer","aria-expanded":h,size:"large",children:a.jsx(c5,{})})}),a.jsx(TZ,{links:d.links,open:h,toggleDrawer:v,routes:j}),a.jsx(oF,{children:a.jsx(mb,{})})]})}):a.jsx(nF,{position:"static",children:a.jsxs(rF,{children:[a.jsx(_m,{to:"/",sx:tp,"aria-label":"Home",children:a.jsx(hd,{darkmode:a.jsx(W,{condition:w,show:a.jsx(xW,{}),elseShow:a.jsx(Xvt,{"aria-label":"Unleash logo"})}),lightmode:a.jsx(W,{condition:w,show:a.jsx(Qvt,{}),elseShow:a.jsx(Jvt,{"aria-label":"Unleash logo"})})})}),a.jsxs(Kvt,{children:[a.jsxs(Zvt,{children:[a.jsx(_m,{to:"/projects",children:"Projects"}),a.jsx(_m,{to:"/search",children:"Search"}),a.jsx(_m,{to:"/playground",children:"Playground"}),a.jsx(W,{condition:!S&&!f(),show:a.jsx(_m,{to:"/insights",children:"Insights"})}),a.jsxs(e0t,{onClick:k=>c(k.currentTarget),"aria-controls":l?o:void 0,"aria-expanded":!!l,children:["Configure",a.jsx(B5,{sx:t0t})]}),a.jsx(tF,{id:o,options:j.mainNavRoutes,anchorEl:l,handleClose:y,style:{top:10}})]}),a.jsxs(oF,{children:[a.jsx(PZ,{}),a.jsx(gt,{title:t==="dark"?"Switch to light theme":"Switch to dark theme",arrow:!0,children:a.jsx(nT,{onClick:e,size:"large",children:a.jsx(W,{condition:t==="dark",show:a.jsx(NO,{}),elseShow:a.jsx(BO,{})})})}),a.jsx(W,{condition:!f()&&!u,show:a.jsx(_Z,{})}),a.jsx(gt,{title:"Documentation",arrow:!0,children:a.jsx(nT,{component:"a",href:"https://docs.getunleash.io/",target:"_blank",rel:"noopener noreferrer",size:"large",children:a.jsx(IS,{})})}),a.jsx(gt,{title:"Settings",arrow:!0,children:a.jsx(nT,{onClick:k=>s(k.currentTarget),"aria-controls":i?r:void 0,"aria-expanded":!!i,size:"large",children:a.jsx(I5,{})})}),a.jsx(tF,{id:r,options:j.adminRoutes,anchorEl:i,handleClose:x,style:{top:5,left:-100}})," ",a.jsx(mb,{})]})]})]})})},r0t=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}`},o0t=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}`},Ex=b("h2")(({theme:e})=>({all:"unset",display:"block",margin:e.spacing(2,0),fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.bold})),i0t=e=>{var i;const t=(i=e.uiConfig.versionInfo)==null?void 0:i.instanceId,n=r0t(e.uiConfig),r=e.uiConfig.environment,o=o0t(e.uiConfig);return a.jsxs("section",{title:"API details",children:[a.jsxs(Ex,{children:[n," ",a.jsx(W,{condition:!!r,show:a.jsxs("small",{children:["(",r,")"]})})]}),a.jsx(W,{condition:!!o,show:a.jsxs("small",{children:[o,a.jsx("br",{})]})}),a.jsx("br",{}),a.jsx("small",{children:e.uiConfig.slogan}),a.jsx("br",{}),a.jsx(W,{condition:!!t,show:a.jsx("small",{children:`${t}`})})]})},s0t=b("footer")(({theme:e})=>({padding:e.spacing(4,8),width:"100%",flexGrow:1,zIndex:100,backgroundColor:e.palette.background.paper,overflowY:"hidden"})),rT=b(ns)({padding:0,margin:0}),Ur=b(za)(({theme:e})=>({padding:0,margin:0,"& a":{...Kl(e),textDecoration:"none",color:e.palette.text.primary,"&:hover":{textDecoration:"underline"}}})),a0t=()=>{const{uiConfig:e}=ht();return a.jsx(s0t,{children:a.jsxs(qo,{container:!0,justifyContent:"center",spacing:10,style:{marginBottom:0},children:[a.jsx(qo,{item:!0,md:4,xs:12,children:a.jsx(i0t,{uiConfig:e})}),a.jsx(qo,{item:!0,xs:12,md:"auto",children:a.jsxs(qo,{container:!0,spacing:7,direction:"row",children:[a.jsx(qo,{item:!0,children:a.jsxs("section",{title:"Unleash SDK",children:[a.jsx(Ex,{children:"Server SDKs"}),a.jsxs(rT,{dense:!0,children:[a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/node",target:"_blank",rel:"noreferrer",children:"Node.js"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/java",target:"_blank",rel:"noreferrer",children:"Java"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/go",target:"_blank",rel:"noreferrer",children:"Go"})})})," ",a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/rust",target:"_blank",rel:"noreferrer",children:"Rust"})})})," ",a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/ruby",target:"_blank",rel:"noreferrer",children:"Ruby"})})})," ",a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/python",target:"_blank",rel:"noreferrer",children:"Python"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/dotnet",target:"_blank",rel:"noreferrer",children:".NET"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/php",target:"_blank",rel:"noreferrer",children:"PHP"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"All SDKs"})})})]})]})}),a.jsx(qo,{item:!0,children:a.jsxs("section",{title:"Unleash SDK",children:[a.jsx(Ex,{children:"Frontend SDKs"}),a.jsxs(rT,{dense:!0,children:[a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/unleash-proxy",target:"_blank",rel:"noreferrer",children:"Unleash Proxy"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/javascript-browser",target:"_blank",rel:"noreferrer",children:"JavaScript"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/react",target:"_blank",rel:"noreferrer",children:"React"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/next-js",target:"_blank",rel:"noreferrer",children:"Next.js"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/vue",target:"_blank",rel:"noreferrer",children:"Vue"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/ios-proxy",target:"_blank",rel:"noreferrer",children:"iOS"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/android-proxy",target:"_blank",rel:"noreferrer",children:"Android"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://docs.getunleash.io/reference/sdks/flutter",target:"_blank",rel:"noreferrer",children:"Flutter"})})})]})]})}),a.jsx(qo,{item:!0,children:a.jsxs("section",{children:[a.jsx(Ex,{children:"About"}),a.jsxs(rT,{dense:!0,children:[a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://www.getunleash.io/",target:"_blank",rel:"noreferrer",children:"getunleash.io"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://twitter.com/getunleash",target:"_blank",rel:"noreferrer",children:"Twitter"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://www.linkedin.com/company/getunleash",target:"_blank",rel:"noreferrer",children:"LinkedIn"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://github.com/Unleash/unleash",target:"_blank",rel:"noreferrer",children:"GitHub"})})}),a.jsx(Ur,{children:a.jsx(mn,{primary:a.jsx("a",{href:"https://slack.unleash.run",target:"_blank",rel:"noreferrer",children:"Slack Community"})})})]})]})})]})})]})})},l0t=b(Vt)(({theme:e})=>({marginBottom:e.spacing(2)})),c0t=b(Z)(({theme:e})=>({maxWidth:"800px"})),u0t=b("a")(({theme:e})=>({display:"block",marginTop:e.spacing(1),width:"100px"})),d0t=e=>!(!e||localStorage&&localStorage.getItem(e)),f0t=({toast:e})=>{const[t,n]=m.useState(!1);m.useEffect(()=>{n(d0t((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?a.jsx(W,{condition:t,show:a.jsxs(l0t,{severity:e.severity,onClose:r,children:[a.jsx(c0t,{variant:"body2",children:e.message}),a.jsx(u0t,{href:e.link,target:"_blank",rel:"noopener noreferrer",children:"View more"})]})}):null},p0t=b("div")(({theme:e})=>({height:e.spacing(2.5),margin:e.spacing(2,0)})),h0t=b(jhe)({"& > ol":{flexWrap:"nowrap","& > li:last-child":{minWidth:0}}}),iF=b("p")(TS),g0t=b(ln)(({theme:e})=>({"& > *":{maxWidth:e.spacing(25)}})),m0t=()=>{const{isAdmin:e}=m.useContext(Di),t=Ao(),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").map(decodeURI);return a.jsx(p0t,{children:a.jsx(W,{condition:t.pathname.includes("admin")&&e||!t.pathname.includes("admin"),show:a.jsx(W,{condition:n.length>1,show:a.jsx(h0t,{"aria-label":"Breadcrumbs",children:n.map((r,o)=>{if(o===n.length-1)return a.jsx(iF,{children:r},r);let s="/";return n.forEach((l,c)=>{c!==o&&c<o?s+=`${l}/`:c===o&&(s+=l)}),a.jsx(g0t,{to:s,children:a.jsx(iF,{children:r})},r)})})})})})},sF="/static/texture-2nOOHMeS.png",OZ="skip-nav-target-id",v0t=()=>a.jsx("div",{id:OZ}),y0t=b("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,...Kl(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}})),x0t=()=>a.jsxs(y0t,{href:`#${OZ}`,children:["Skip to content ",a.jsx("span",{"aria-hidden":!0,children:"↓"})]}),$Z=({conflict:e})=>a.jsx(W,{condition:!!e,show:a.jsxs(Vt,{severity:"warning",sx:{px:3,mb:2,"&.MuiAlert-standardWarning":{borderStyle:"none"},borderRadius:"0px"},children:[a.jsx("strong",{children:"Conflict!"})," ",e,"."]})}),b0t=({featureName:e,projectId:t,conflict:n,onNavigate:r,children:o})=>a.jsxs(V3,{elevation:0,sx:i=>({marginTop:i.spacing(2),overflow:"hidden"}),children:[a.jsxs(ne,{sx:i=>({backgroundColor:i.palette.neutral.light,borderRadius:s=>`${s.shape.borderRadiusLarge}px ${s.shape.borderRadiusLarge}px 0 0`,border:"1px solid",borderColor:s=>n?s.palette.warning.border:s.palette.divider,borderBottom:"none",overflow:"hidden"}),children:[a.jsx($Z,{conflict:n}),a.jsxs(ne,{sx:{display:"flex",pt:n?0:2,pb:2,px:3},children:[a.jsx(Z,{children:"Feature flag name: "}),a.jsx(nr,{component:ln,to:`/projects/${t}/features/${e}`,color:"primary",underline:"hover",sx:{marginLeft:1,"& :hover":{textDecoration:"underline"}},onClick:r,children:a.jsx("strong",{children:e})})]})]}),a.jsx(ne,{children:o})]});var WO={},w0t=ze;Object.defineProperty(WO,"__esModule",{value:!0});var IZ=WO.default=void 0,S0t=w0t(He()),C0t=a,j0t=(0,S0t.default)((0,C0t.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");IZ=WO.default=j0t;var E0t=200,GO="__lodash_hash_undefined__",T0t=1/0,MZ=9007199254740991,k0t="[object Arguments]",_0t="[object Function]",R0t="[object GeneratorFunction]",A0t="[object Symbol]",P0t=/[\\^$.*+?()[\]{}|]/g,O0t=/^\[object .+?Constructor\]$/,$0t=/^(?:0|[1-9]\d*)$/,I0t=typeof ro=="object"&&ro&&ro.Object===Object&&ro,M0t=typeof self=="object"&&self&&self.Object===Object&&self,qO=I0t||M0t||Function("return this")();function D0t(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 L0t(e,t){var n=e?e.length:0;return!!n&&B0t(e,t,0)>-1}function N0t(e,t,n){for(var r=-1,o=e?e.length:0;++r<o;)if(n(t,e[r]))return!0;return!1}function DZ(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 YO(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function F0t(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 B0t(e,t,n){if(t!==t)return F0t(e,z0t,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}function z0t(e){return e!==e}function H0t(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function U0t(e){return function(t){return e(t)}}function V0t(e,t){return e.has(t)}function W0t(e,t){return e==null?void 0:e[t]}function G0t(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function LZ(e,t){return function(n){return e(t(n))}}var q0t=Array.prototype,Y0t=Function.prototype,d2=Object.prototype,oT=qO["__core-js_shared__"],aF=function(){var e=/[^.]+$/.exec(oT&&oT.keys&&oT.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),NZ=Y0t.toString,Ig=d2.hasOwnProperty,KO=d2.toString,K0t=RegExp("^"+NZ.call(Ig).replace(P0t,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lF=qO.Symbol,X0t=LZ(Object.getPrototypeOf,Object),J0t=d2.propertyIsEnumerable,Q0t=q0t.splice,cF=lF?lF.isConcatSpreadable:void 0,K_=Object.getOwnPropertySymbols,uF=Math.max,Z0t=BZ(qO,"Map"),E0=BZ(Object,"create");function Hf(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 e1t(){this.__data__=E0?E0(null):{}}function t1t(e){return this.has(e)&&delete this.__data__[e]}function n1t(e){var t=this.__data__;if(E0){var n=t[e];return n===GO?void 0:n}return Ig.call(t,e)?t[e]:void 0}function r1t(e){var t=this.__data__;return E0?t[e]!==void 0:Ig.call(t,e)}function o1t(e,t){var n=this.__data__;return n[e]=E0&&t===void 0?GO:t,this}Hf.prototype.clear=e1t;Hf.prototype.delete=t1t;Hf.prototype.get=n1t;Hf.prototype.has=r1t;Hf.prototype.set=o1t;function Mg(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 i1t(){this.__data__=[]}function s1t(e){var t=this.__data__,n=f2(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Q0t.call(t,n,1),!0}function a1t(e){var t=this.__data__,n=f2(t,e);return n<0?void 0:t[n][1]}function l1t(e){return f2(this.__data__,e)>-1}function c1t(e,t){var n=this.__data__,r=f2(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}Mg.prototype.clear=i1t;Mg.prototype.delete=s1t;Mg.prototype.get=a1t;Mg.prototype.has=l1t;Mg.prototype.set=c1t;function Dg(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 u1t(){this.__data__={hash:new Hf,map:new(Z0t||Mg),string:new Hf}}function d1t(e){return p2(this,e).delete(e)}function f1t(e){return p2(this,e).get(e)}function p1t(e){return p2(this,e).has(e)}function h1t(e,t){return p2(this,e).set(e,t),this}Dg.prototype.clear=u1t;Dg.prototype.delete=d1t;Dg.prototype.get=f1t;Dg.prototype.has=p1t;Dg.prototype.set=h1t;function ew(e){var t=-1,n=e?e.length:0;for(this.__data__=new Dg;++t<n;)this.add(e[t])}function g1t(e){return this.__data__.set(e,GO),this}function m1t(e){return this.__data__.has(e)}ew.prototype.add=ew.prototype.push=g1t;ew.prototype.has=m1t;function v1t(e,t){var n=XO(e)||zZ(e)?H0t(e.length,String):[],r=n.length,o=!!r;for(var i in e)(t||Ig.call(e,i))&&!(o&&(i=="length"||R1t(i,r)))&&n.push(i);return n}function f2(e,t){for(var n=e.length;n--;)if(D1t(e[n][0],t))return n;return-1}function y1t(e,t,n,r){var o=-1,i=L0t,s=!0,l=e.length,c=[],u=t.length;if(!l)return c;n&&(t=DZ(t,U0t(n))),r?(i=N0t,s=!1):t.length>=E0t&&(i=V0t,s=!1,t=new ew(t));e:for(;++o<l;){var d=e[o],f=n?n(d):d;if(d=r||d!==0?d:0,s&&f===f){for(var p=u;p--;)if(t[p]===f)continue e;c.push(d)}else i(t,f,r)||c.push(d)}return c}function FZ(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=_1t),o||(o=[]);++i<s;){var l=e[i];t>0&&n(l)?t>1?FZ(l,t-1,n,r,o):YO(o,l):r||(o[o.length]=l)}return o}function x1t(e,t,n){var r=t(e);return XO(e)?r:YO(r,n(e))}function b1t(e){if(!JO(e)||P1t(e))return!1;var t=UZ(e)||G0t(e)?K0t:O0t;return t.test(M1t(e))}function w1t(e){if(!JO(e))return $1t(e);var t=O1t(e),n=[];for(var r in e)r=="constructor"&&(t||!Ig.call(e,r))||n.push(r);return n}function S1t(e,t){return e=Object(e),C1t(e,t,function(n,r){return r in e})}function C1t(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],l=e[s];n(l,s)&&(i[s]=l)}return i}function j1t(e,t){return t=uF(t===void 0?e.length-1:t,0),function(){for(var n=arguments,r=-1,o=uF(n.length-t,0),i=Array(o);++r<o;)i[r]=n[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=n[r];return s[t]=i,D0t(e,this,s)}}function E1t(e){return x1t(e,B1t,k1t)}function p2(e,t){var n=e.__data__;return A1t(t)?n[typeof t=="string"?"string":"hash"]:n.map}function BZ(e,t){var n=W0t(e,t);return b1t(n)?n:void 0}var T1t=K_?LZ(K_,Object):WZ,k1t=K_?function(e){for(var t=[];e;)YO(t,T1t(e)),e=X0t(e);return t}:WZ;function _1t(e){return XO(e)||zZ(e)||!!(cF&&e&&e[cF])}function R1t(e,t){return t=t??MZ,!!t&&(typeof e=="number"||$0t.test(e))&&e>-1&&e%1==0&&e<t}function A1t(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function P1t(e){return!!aF&&aF in e}function O1t(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||d2;return e===n}function $1t(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}function I1t(e){if(typeof e=="string"||F1t(e))return e;var t=e+"";return t=="0"&&1/e==-T0t?"-0":t}function M1t(e){if(e!=null){try{return NZ.call(e)}catch{}try{return e+""}catch{}}return""}function D1t(e,t){return e===t||e!==e&&t!==t}function zZ(e){return L1t(e)&&Ig.call(e,"callee")&&(!J0t.call(e,"callee")||KO.call(e)==k0t)}var XO=Array.isArray;function HZ(e){return e!=null&&N1t(e.length)&&!UZ(e)}function L1t(e){return VZ(e)&&HZ(e)}function UZ(e){var t=JO(e)?KO.call(e):"";return t==_0t||t==R0t}function N1t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=MZ}function JO(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function VZ(e){return!!e&&typeof e=="object"}function F1t(e){return typeof e=="symbol"||VZ(e)&&KO.call(e)==A0t}function B1t(e){return HZ(e)?v1t(e,!0):w1t(e)}var z1t=j1t(function(e,t){return e==null?{}:(t=DZ(FZ(t,1),I1t),S1t(e,y1t(E1t(e),t)))});function WZ(){return[]}var H1t=z1t;const T0=uo(H1t),dF=b("div")(()=>({...TS,maxWidth:500})),GZ=({newName:e,previousName:t})=>{const n=!!(t&&t!==e);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:n,show:a.jsx(dF,{children:a.jsx(Z,{component:"del",color:"text.secondary",children:t})})}),a.jsx(W,{condition:!!e,show:a.jsx(dF,{children:a.jsx(Z,{children:e})})})]})},U1t=b("div")(({theme:e})=>({overflowX:"auto","& code":{wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5,fontSize:e.fontSizes.smallBody}})),iT=({change:e,currentStrategy:t})=>{const n=e.action==="deleteStrategy"?void 0:e.payload;return a.jsx(U1t,{children:a.jsx(Ag,{entry:{preData:T0(t,"sortOrder"),data:T0(n,"snapshot")}})})},V1t=b("div")(({theme:e})=>({display:"grid",gridAutoFlow:"column",gridTemplateColumns:"auto 1fr",gap:e.spacing(1),alignItems:"center"})),W1t=b("div")(()=>({...TS,maxWidth:500})),sT=({change:e,previousTitle:t,children:n})=>a.jsxs(V1t,{children:[a.jsx(GIe,{strategyName:e.payload.name}),a.jsxs(W1t,{children:[a.jsx(Gc,{tooltip:n,tooltipProps:{maxWidth:500,maxHeight:600},children:a.jsx(Z,{component:"span",children:td(e.payload.name)})}),a.jsx(GZ,{newName:e.payload.title,previousName:t})]})]}),fF=({percentage:e,size:t="4rem",disabled:n=!1})=>{const r=It(),o={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:t,width:t,background:r.palette.background.elevation2},i=100/(2*Math.PI),s=2*i,l=n?r.palette.neutral.border:r.palette.primary.light;return a.jsxs("svg",{viewBox:`0 0 ${s} ${s}`,style:o,"aria-hidden":!0,children:[a.jsxs("title",{children:["A circle progress bar with ",e,"% completion."]}),a.jsx("circle",{r:i,cx:i,cy:i,fill:"none",stroke:l,strokeWidth:s,strokeDasharray:`${e} 100`})]})},G1t=b("div")(({theme:e})=>({width:"100%",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,background:e.palette.background.default,border:`1px solid ${e.palette.divider}`})),q1t=b("p")(({theme:e})=>({display:"inline",margin:e.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),Y1t=b(vi)(({theme:e})=>({margin:e.spacing(.5)})),aT=({value:e,text:t})=>a.jsx(G1t,{children:a.jsx(W,{condition:e.length===0,show:a.jsxs("p",{children:["No ",t,"s added yet."]}),elseShow:a.jsxs("div",{children:[a.jsxs(q1t,{children:[e.length," ",e.length>1?`${t}s`:t," will get access."]}),e.map(n=>a.jsx(Y1t,{label:a.jsx(hs,{maxWidth:"300",text:n,maxLength:50})},n))]})})}),K1t=({segments:e,disabled:t=!1})=>!e||e.length===0?null:a.jsx(a.Fragment,{children:e.map((n,r)=>a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:r>0,show:a.jsx(YC,{text:"AND"})}),a.jsx(EX,{segment:n,disabled:t})]},n.id))}),X1t=b(ne,{shouldForwardProp:e=>e!=="disabled"})(({theme:e,disabled:t})=>({"& p, & span, & h1, & h2, & h3, & h4, & h5, & h6":{color:t?e.palette.neutral.main:"inherit"},".constraint-icon-container":{backgroundColor:t?e.palette.neutral.border:e.palette.primary.light,borderRadius:"50%"},".constraint-icon":{fill:t?e.palette.neutral.light:e.palette.common.white}})),J1t=()=>a.jsxs(Vt,{severity:"warning",sx:{mb:2},children:["Custom strategies are deprecated and may be removed in a future major version. Consider rewriting this strategy as a predefined strategy with"," ",a.jsx(nr,{href:"https://docs.getunleash.io/reference/strategy-constraints",target:"_blank",variant:"body2",children:"constraints."})]}),pF=()=>a.jsx(ne,{sx:{px:3,color:"text.disabled"},children:"This strategy does not have constraints or parameters."}),zd=b(ne)(({theme:e})=>({padding:e.spacing(2,3),border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadiusMedium,background:e.palette.background.default})),lT=b("span")(({theme:e})=>({color:e.palette.neutral.main})),Tx=({strategy:e})=>{const{parameters:t,constraints:n=[]}=e,r=t==null?void 0:t.stickiness,o=typeof r=="string"&&r!=="default",{strategies:i}=Sg(),{segments:s}=Wc(),l=s==null?void 0:s.filter(p=>{var h;return(h=e.segments)==null?void 0:h.includes(p.id)}),c=i.find(p=>p.name===e.name),u=m.useMemo(()=>!t||c!=null&&c.editable?null:Object.keys(t).map(p=>{switch(p){case"rollout":case"Rollout":{const h=kv(t[p]),g=e.disabled?"neutral":"success";return a.jsxs(zd,{sx:{display:"flex",alignItems:"center"},children:[a.jsx(ne,{sx:{mr:2},children:a.jsx(fF,{percentage:h,size:"2rem",disabled:e.disabled})}),a.jsxs("div",{children:[a.jsxs(qt,{color:g,children:[h,"%"]})," ",a.jsx("span",{children:"of your base"})," ",a.jsxs("span",{children:[o?a.jsxs(a.Fragment,{children:["with ",a.jsx("strong",{children:r})]}):""," "]}),a.jsxs("span",{children:[n.length>0?"who match constraints":""," ","is included."]})]})]})}case"userIds":case"UserIds":{const h=kc(t[p]);return a.jsx(aT,{value:h,text:"user"},p)}case"hostNames":case"HostNames":{const h=kc(t[p]);return a.jsx(aT,{value:h,text:"host"},p)}case"IPs":{const h=kc(t[p]);return a.jsx(aT,{value:h,text:"IP"},p)}case"stickiness":case"groupId":return null;default:return null}}),[t,c,n,e.disabled]),d=m.useMemo(()=>{if(!t||!(c!=null&&c.editable))return null;const p=a.jsx(lT,{children:" is set to "});return c==null?void 0:c.parameters.map(h=>{const{type:g,name:v}={...h};if(!g||!v||t[v]===void 0)return null;const x=a.jsx(hs,{maxLength:15,maxWidth:"150",text:v});switch(h==null?void 0:h.type){case"list":{const y=kc(t[v]);return y.length>0?a.jsxs(zd,{children:[x," ",a.jsxs(lT,{children:["has ",y.length," ",y.length>1?"items":"item",":"," ",y.map(w=>a.jsx(vi,{label:a.jsx(hs,{maxWidth:"300",text:w,maxLength:50}),sx:{mr:.5}},w))]})]}):null}case"percentage":{const y=kv(t[v]);return t[v]!==""?a.jsxs(zd,{sx:{display:"flex",alignItems:"center"},children:[a.jsx(ne,{sx:{mr:2},children:a.jsx(fF,{percentage:y,size:"2rem"})}),a.jsxs("div",{children:[x,p,a.jsxs(qt,{color:"success",children:[y,"%"]})]})]}):null}case"boolean":return t[v]==="true"||t[v]==="false"?a.jsxs(zd,{children:[a.jsx(hs,{maxLength:15,maxWidth:"150",text:v}),p,a.jsx(qt,{color:t[v]==="true"?"success":"error",children:t[v]})]}):null;case"string":{const y=Mu(t[v]);return typeof t[v]<"u"?a.jsxs(zd,{children:[x,a.jsx(W,{condition:y==="",show:a.jsx(lT,{children:" is an empty string"}),elseShow:a.jsxs(a.Fragment,{children:[p,a.jsx(hs,{maxWidth:"300",text:y,maxLength:50})]})})]}):null}case"number":{const y=kv(t[v]);return t[v]!==""&&y!==void 0?a.jsxs(zd,{children:[x,p,a.jsx(hs,{maxWidth:"300",text:String(y),maxLength:50})]}):null}case"default":return null}return null})},[t,c]);if(!t)return a.jsx(pF,{});const f=[l&&l.length>0&&a.jsx(K1t,{segments:l,disabled:e.disabled}),n.length>0&&a.jsx(KC,{constraints:n,showLabel:!1}),e.name==="default"&&a.jsx(a.Fragment,{children:a.jsxs(zd,{sx:{width:"100%"},children:["The standard strategy is ",a.jsx(qt,{color:"success",children:"ON"})," ","for all users."]})}),...u??[],...d??[]].filter(Boolean);return a.jsxs(a.Fragment,{children:[a.jsx(W,{condition:!Jq.includes(e.name||"default"),show:a.jsx(J1t,{})}),a.jsx(W,{condition:f.length>0,show:a.jsx(X1t,{disabled:!!e.disabled,children:f.map((p,h)=>a.jsxs(m.Fragment,{children:[a.jsx(W,{condition:h>0,show:a.jsx(YC,{text:"AND"})}),p]},h))}),elseShow:a.jsx(pF,{})})]})},Q1t=(e,t,n,r)=>{var s;const{feature:o}=Wl(t,n);return(s=o==null?void 0:o.environments.find(l=>l.name===r))==null?void 0:s.strategies.find(l=>"id"in e.payload&&l.id===e.payload.id)},Z1t=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,whiteSpace:"pre-wrap"})),eyt=({value:e})=>{const{searchQuery:t}=Jl();return e?e.type==="string"&&e.value.length<20?a.jsx(bn,{children:a.jsx(pi,{search:t,children:e.value})}):a.jsx(bn,{children:a.jsx(Gc,{tooltip:a.jsx(a.Fragment,{children:a.jsx(Z1t,{children:a.jsx(pi,{search:t,children:e.value})})}),highlighted:t.length>0&&e.value.toLowerCase().includes(t.toLowerCase()),children:e.type})}):a.jsx(bn,{})},tyt=b(Z)(({theme:e})=>({fontSize:e.fontSizes.smallerBody})),nyt=({value:e})=>{const{searchQuery:t}=Jl();if(!e||e.length===0)return a.jsx(bn,{});const n=r=>`${r.contextName}:${r.values.join()}`;return a.jsx(bn,{children:a.jsx(Gc,{tooltip:a.jsx(a.Fragment,{children:e.map((r,o)=>a.jsx(tyt,{children:a.jsx(pi,{search:t,children:n(r)})},r.contextName+o))}),highlighted:t.length>0&&(e==null?void 0:e.map(n).join(`
450
450
  `).toLowerCase().includes(t.toLowerCase())),children:e.length===1?"1 override":`${e.length} overrides`})})},X_=({variants:e,searchValue:t=""})=>{const n=Fr("projectId"),r=It(),o=Qn(r.breakpoints.down("md")),i=Qn(r.breakpoints.down("lg")),s=m.useMemo(()=>[{Header:"Name",accessor:"name",Cell:ea,sortType:"alphanumeric",minWidth:350,searchable:!0},{Header:"Payload",accessor:"payload",Cell:eyt,disableSortBy:!0,searchable:!0,filterParsing:x=>x==null?void 0:x.value},{Header:"Overrides",accessor:"overrides",Cell:nyt,disableSortBy:!0,searchable:!0,filterParsing:x=>(x==null?void 0:x.map(({contextName:y,values:w})=>`${y}:${w.join()}`).join(`
451
451
  `))||""},{Header:"Weight",accessor:"weight",Cell:({row:{original:{name:x,weight:y}}})=>a.jsxs(bn,{"data-testid":`VARIANT_WEIGHT_${x}`,children:[p_e(y)," %"]}),sortType:"number"},{Header:"Type",accessor:x=>x.weightType==="fix"?"Fixed":"Variable",Cell:bn,sortType:"alphanumeric"}],[n,e]),l=m.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{data:c,getSearchText:u}=xg(s,t,e),{getTableProps:d,getTableBodyProps:f,headerGroups:p,rows:h,prepareRow:g,setHiddenColumns:v}=un.useTable({columns:s,data:c,initialState:l,sortTypes:$i,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},un.useSortBy);return hp([{condition:o,columns:["payload","overrides"]},{condition:i,columns:["weightType"]}],v,s),a.jsxs(a.Fragment,{children:[a.jsx(ga,{value:u(t),children:a.jsxs(sa,{...d(),children:[a.jsx(ia,{headerGroups:p}),a.jsx(ws,{...f(),children:h.map(x=>(g(x),a.jsx(Pi,{hover:!0,...x.getRowProps(),children:x.cells.map(y=>a.jsx(rs,{...y.getCellProps(),children:y.render("Cell")}))})))})]})}),a.jsx(W,{condition:h.length===0,show:a.jsx(W,{condition:(t==null?void 0:t.length)>0,show:a.jsxs(eo,{children:["No variants found matching “",t,"”"]})})})]})},ryt=b(ne)(({theme:e})=>({color:e.palette.warning.dark,backgroundColor:e.palette.warning.light,fontSize:e.fontSizes.smallBody,borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(2),marginBottom:e.spacing(2)})),oyt=b("table")(({theme:e})=>({"&,td,tr,thead":{display:"block",textAlign:"margin-inline-start"},thead:{clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",overflow:"hidden",position:"absolute",whiteSpace:"nowrap",width:"1px"},"tr + tr":{marginBlockStart:e.spacing(2)},"td:first-of-type":{fontWeight:"bold","::after":{content:'":"'},textTransform:"capitalize",fontSize:e.fontSizes.bodySize},"td + td::before":{content:"attr(data-column)",marginInlineEnd:e.spacing(1),fontWeight:"bold"},pre:{background:e.palette.background.default,padding:e.spacing(2),borderRadius:e.shape.borderRadius,width:"100%","ins, del":{textDecoration:"none","code::before":{marginInlineEnd:e.spacing(1)}},"del code::before":{content:'"-"'},"ins code::before":{content:'"+"'}}})),iyt=({changesThatWouldBeOverwritten:e})=>a.jsxs(oyt,{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Property"}),a.jsx("th",{children:"Current value"}),a.jsx("th",{children:"Value after change"})]})}),a.jsx("tbody",{children:e.map(({property:t,oldValue:n,newValue:r})=>a.jsxs("tr",{children:[a.jsx("td",{"data-column":"Property",children:t}),a.jsx("td",{"data-column":"Current value",children:a.jsx("pre",{children:a.jsx("del",{children:JSON.stringify(n,null,2).split(`
452
452
  `).map((o,i)=>a.jsx("code",{children:`${o}