unleash-server 5.9.0 → 5.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/db/feature-tag-store.js +1 -1
- package/dist/lib/db/feature-tag-store.js.map +1 -1
- package/dist/lib/features/client-feature-toggles/client-feature-toggle-store.js +2 -2
- package/dist/lib/features/client-feature-toggles/client-feature-toggle-store.js.map +1 -1
- package/dist/lib/features/instance-stats/instance-stats-service.js +1 -1
- package/dist/lib/features/instance-stats/instance-stats-service.js.map +1 -1
- package/dist/lib/features/maintenance/maintenance-service.d.ts +1 -0
- package/dist/lib/features/maintenance/maintenance-service.d.ts.map +1 -1
- package/dist/lib/features/maintenance/maintenance-service.js +21 -3
- package/dist/lib/features/maintenance/maintenance-service.js.map +1 -1
- package/dist/lib/features/scheduler/scheduler-service.d.ts.map +1 -1
- package/dist/lib/features/scheduler/scheduler-service.js +2 -3
- package/dist/lib/features/scheduler/scheduler-service.js.map +1 -1
- package/dist/lib/routes/admin-api/config.js +1 -1
- package/dist/lib/routes/admin-api/config.js.map +1 -1
- package/dist/lib/services/version-service.d.ts +2 -3
- package/dist/lib/services/version-service.d.ts.map +1 -1
- package/dist/lib/services/version-service.js +13 -14
- package/dist/lib/services/version-service.js.map +1 -1
- package/dist/lib/services/version-service.test.js +3 -3
- package/dist/lib/services/version-service.test.js.map +1 -1
- package/dist/server-dev.js +1 -0
- package/dist/server-dev.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-DoQ1u8B6.js → AdvancedPlayground-FbP1gTKc.js} +1 -1
- package/frontend/build/static/{CreateProject-iLBz5afO.js → CreateProject-vjn1sh4D.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-NSAcrt7Z.js → FeatureArchiveDialog-ctoNJoqg.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-UhDepK_o.js → FeatureMetricsChart-ig6HN-Ms.js} +1 -1
- package/frontend/build/static/FeatureViewLazyExport-G75iq0Uc.js +25 -0
- package/frontend/build/static/{LazyAdminExport-w5iLam_A.js → LazyAdminExport-oCRFK_R5.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-iqGbEmyw.js → LazyProjectExport-Ul0xAhZq.js} +1 -1
- package/frontend/build/static/{LineChartComponent-rG1KLVNr.js → LineChartComponent-3-eT314R.js} +1 -1
- package/frontend/build/static/{NetworkOverview-7SCGp57r.js → NetworkOverview-d20eBsIq.js} +2 -2
- package/frontend/build/static/{NetworkTraffic-awTd8Zg5.js → NetworkTraffic-_52gjNiG.js} +1 -1
- package/frontend/build/static/{ReactJSONEditor-N-DWXE0h.js → ReactJSONEditor-0HyqnatD.js} +1 -1
- package/frontend/build/static/{RoleCell-mJ7DV61l.js → RoleCell--QIy8Oj_.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-wxQbaPXr.js → StrategyItemContainer-X6EIzBwJ.js} +1 -1
- package/frontend/build/static/{flowchart-elk-definition-170a3958-fa48ti80.js → flowchart-elk-definition-170a3958-XjUu-j5x.js} +1 -1
- package/frontend/build/static/{index-pAMHRYpv.js → index-UE-HeGu0.js} +1 -1
- package/frontend/build/static/{index-p2PlVFLf.js → index-uUGk-gee.js} +104 -104
- package/frontend/build/static/{is_dark-aAyqOy_I.js → is_dark-8v9B-WN0.js} +1 -1
- package/frontend/build/static/{mindmap-definition-44684416-AfCKDD9v.js → mindmap-definition-44684416-5sTvrm1Q.js} +1 -1
- package/frontend/build/static/{timeline-definition-8e5a9bc6-NKNlIEgm.js → timeline-definition-8e5a9bc6-MtFefIHV.js} +1 -1
- package/frontend/build/static/{unknownify-g-QgUElr.js → unknownify-joALjS6W.js} +1 -1
- package/frontend/build/static/{useApiTokens-hvnEZWgJ.js → useApiTokens-gCm2i_7X.js} +1 -1
- package/frontend/build/static/{useProjectForm-zqz6LJw4.js → useProjectForm-oXjjbjX3.js} +1 -1
- package/package.json +1 -1
- package/frontend/build/static/FeatureViewLazyExport-SpKYIb_J.js +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as s,U as r}from"./NetworkOverview-
|
|
1
|
+
import{C as s,U as r}from"./NetworkOverview-d20eBsIq.js";const i=n=>{const{r:t,g:a,b:o}=s.parse(n),e=.2126*r.channel.toLinear(t)+.7152*r.channel.toLinear(a)+.0722*r.channel.toLinear(o);return r.lang.round(e)},c=n=>i(n)>=.5,u=n=>!c(n);export{u as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{w as bp,g as sn,l as qr,s as nn,a as Ep,t as wp,u as xp}from"./NetworkOverview-
|
|
1
|
+
import{w as bp,g as sn,l as qr,s as nn,a as Ep,t as wp,u as xp}from"./NetworkOverview-d20eBsIq.js";import{g$ as Ca,g as Vu}from"./index-uUGk-gee.js";import{i as Tp}from"./is_dark-8v9B-WN0.js";import"./uniqueId-ebLYlRiD.js";import"./unknownify-joALjS6W.js";var _u={exports:{}};(function(de,fe){(function(Q,he){de.exports=he()})(Ca,function(){function Q(t){"@babel/helpers - typeof";return Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q(t)}function he(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Y(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function A(t,e,r){return e&&Y(t.prototype,e),r&&Y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function w(t,e){return L(t)||G(t,e)||U(t,e)||K()}function L(t){if(Array.isArray(t))return t}function G(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a=[],n=!0,i=!1,s,o;try{for(r=r.call(t);!(n=(s=r.next()).done)&&(a.push(s.value),!(e&&a.length===e));n=!0);}catch(l){i=!0,o=l}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw o}}return a}}function U(t,e){if(t){if(typeof t=="string")return P(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(t,e)}}function P(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function K(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var D=typeof window>"u"?null:window,V=D?D.navigator:null;D&&D.document;var _=Q(""),J=Q({}),ne=Q(function(){}),oe=typeof HTMLElement>"u"?"undefined":Q(HTMLElement),j=function(e){return e&&e.instanceString&&H(e.instanceString)?e.instanceString():null},ee=function(e){return e!=null&&Q(e)==_},H=function(e){return e!=null&&Q(e)===ne},te=function(e){return!ge(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},S=function(e){return e!=null&&Q(e)===J&&!te(e)&&e.constructor===Object},$=function(e){return e!=null&&Q(e)===J},k=function(e){return e!=null&&Q(e)===Q(1)&&!isNaN(e)},q=function(e){return k(e)&&Math.floor(e)===e},ce=function(e){if(oe!=="undefined")return e!=null&&e instanceof HTMLElement},ge=function(e){return Ae(e)||Ne(e)},Ae=function(e){return j(e)==="collection"&&e._private.single},Ne=function(e){return j(e)==="collection"&&!e._private.single},_e=function(e){return j(e)==="core"},tt=function(e){return j(e)==="stylesheet"},ct=function(e){return j(e)==="event"},Pe=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},$e=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Xe=function(e){return S(e)&&k(e.x1)&&k(e.x2)&&k(e.y1)&&k(e.y2)},rt=function(e){return $(e)&&H(e.then)},lt=function(){return V&&V.userAgent.match(/msie|trident|edge/i)},nt=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function n(){var i=this,s=arguments,o,l=r.apply(i,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return a.cache={},a},je=nt(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),pt=nt(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Et=nt(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),kt=function(e){return Pe(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},vt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",vr="rgb[a]?\\(("+vt+"[%]?)\\s*,\\s*("+vt+"[%]?)\\s*,\\s*("+vt+"[%]?)(?:\\s*,\\s*("+vt+"))?\\)",qt="rgb[a]?\\((?:"+vt+"[%]?)\\s*,\\s*(?:"+vt+"[%]?)\\s*,\\s*(?:"+vt+"[%]?)(?:\\s*,\\s*(?:"+vt+"))?\\)",un="hsl[a]?\\(("+vt+")\\s*,\\s*("+vt+"[%])\\s*,\\s*("+vt+"[%])(?:\\s*,\\s*("+vt+"))?\\)",Kr="hsl[a]?\\((?:"+vt+")\\s*,\\s*(?:"+vt+"[%])\\s*,\\s*(?:"+vt+"[%])(?:\\s*,\\s*(?:"+vt+"))?\\)",Da="\\#[0-9a-fA-F]{3}",jt="\\#[0-9a-fA-F]{6}",Ji=function(e,r){return e<r?-1:e>r?1:0},Ju=function(e,r){return-1*Ji(e,r)},Ue=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];t[s]=a[s]}}return t},ju=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,s=16;return r?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},el=function(e){var r,a,n,i,s,o,l,u;function f(v,p,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?v+(p-v)*6*y:y<1/2?p:y<2/3?v+(p-v)*(2/3-y)*6:v}var h=new RegExp("^"+un+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,d=2*i-c;o=Math.round(255*f(d,c,a+1/3)),l=Math.round(255*f(d,c,a)),u=Math.round(255*f(d,c,a-1/3))}r=[o,l,u,s]}return r},tl=function(e){var r,a=new RegExp("^"+vr+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},rl=function(e){return nl[e.toLowerCase()]},al=function(e){return(te(e)?e:null)||rl(e)||ju(e)||tl(e)||el(e)},nl={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ji=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(S(s))throw Error("Tried to set map with object key");i<a.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},es=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(S(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r};function il(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Rr=il,Sa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ca<"u"?Ca:typeof self<"u"?self:{};function sl(t,e){return e={exports:{}},t(e,e.exports),e.exports}var ol=typeof Sa=="object"&&Sa&&Sa.Object===Object&&Sa,ul=ol,ll=typeof self=="object"&&self&&self.Object===Object&&self,fl=ul||ll||Function("return this")(),ln=fl,hl=function(){return ln.Date.now()},ti=hl,cl=/\s/;function vl(t){for(var e=t.length;e--&&cl.test(t.charAt(e)););return e}var dl=vl,gl=/^\s+/;function pl(t){return t&&t.slice(0,dl(t)+1).replace(gl,"")}var yl=pl,ml=ln.Symbol,Zr=ml,ts=Object.prototype,bl=ts.hasOwnProperty,El=ts.toString,La=Zr?Zr.toStringTag:void 0;function wl(t){var e=bl.call(t,La),r=t[La];try{t[La]=void 0;var a=!0}catch{}var n=El.call(t);return a&&(e?t[La]=r:delete t[La]),n}var xl=wl,Tl=Object.prototype,Cl=Tl.toString;function Dl(t){return Cl.call(t)}var Sl=Dl,Ll="[object Null]",Al="[object Undefined]",rs=Zr?Zr.toStringTag:void 0;function Ol(t){return t==null?t===void 0?Al:Ll:rs&&rs in Object(t)?xl(t):Sl(t)}var as=Ol;function Nl(t){return t!=null&&typeof t=="object"}var Ml=Nl,Il="[object Symbol]";function Rl(t){return typeof t=="symbol"||Ml(t)&&as(t)==Il}var Aa=Rl,ns=NaN,kl=/^[-+]0x[0-9a-f]+$/i,Pl=/^0b[01]+$/i,Bl=/^0o[0-7]+$/i,Fl=parseInt;function zl(t){if(typeof t=="number")return t;if(Aa(t))return ns;if(Rr(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Rr(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=yl(t);var r=Pl.test(t);return r||Bl.test(t)?Fl(t.slice(2),r?2:8):kl.test(t)?ns:+t}var is=zl,Gl="Expected a function",$l=Math.max,Vl=Math.min;function _l(t,e,r){var a,n,i,s,o,l,u=0,f=!1,h=!1,c=!0;if(typeof t!="function")throw new TypeError(Gl);e=is(e)||0,Rr(r)&&(f=!!r.leading,h="maxWait"in r,i=h?$l(is(r.maxWait)||0,e):i,c="trailing"in r?!!r.trailing:c);function d(O){var x=a,R=n;return a=n=void 0,u=O,s=t.apply(R,x),s}function v(O){return u=O,o=setTimeout(g,e),f?d(O):s}function p(O){var x=O-l,R=O-u,C=e-x;return h?Vl(C,i-R):C}function y(O){var x=O-l,R=O-u;return l===void 0||x>=e||x<0||h&&R>=i}function g(){var O=ti();if(y(O))return m(O);o=setTimeout(g,p(O))}function m(O){return o=void 0,c&&a?d(O):(a=n=void 0,s)}function b(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}function E(){return o===void 0?s:m(ti())}function M(){var O=ti(),x=y(O);if(a=arguments,n=this,l=O,x){if(o===void 0)return v(l);if(h)return clearTimeout(o),o=setTimeout(g,e),d(l)}return o===void 0&&(o=setTimeout(g,e)),s}return M.cancel=b,M.flush=E,M}var fn=_l,ri=D?D.performance:null,ss=ri&&ri.now?function(){return ri.now()}:function(){return Date.now()},Ul=function(){if(D){if(D.requestAnimationFrame)return function(t){D.requestAnimationFrame(t)};if(D.mozRequestAnimationFrame)return function(t){D.mozRequestAnimationFrame(t)};if(D.webkitRequestAnimationFrame)return function(t){D.webkitRequestAnimationFrame(t)};if(D.msRequestAnimationFrame)return function(t){D.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(ss())},1e3/60)}}(),hn=function(e){return Ul(e)},dr=ss,Qr=9261,os=65599,Oa=5381,us=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qr,a=r,n;n=e.next(),!n.done;)a=a*os+n.value|0;return a},Na=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qr;return r*os+e|0},Ma=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oa;return(r<<5)+r+e|0},Yl=function(e,r){return e*2097152+r},Er=function(e){return e[0]*2097152+e[1]},cn=function(e,r){return[Na(e[0],r[0]),Ma(e[1],r[1])]},Hl=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return us(s,r)},kr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return us(s,r)},ls=function(){return Xl(arguments)},Xl=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=kr(n):r=kr(n,r)}return r},fs=!0,ql=console.warn!=null,Wl=console.trace!=null,ai=Number.MAX_SAFE_INTEGER||9007199254740991,hs=function(){return!0},vn=function(){return!1},cs=function(){return 0},ni=function(){},xt=function(e){throw new Error(e)},vs=function(e){if(e!==void 0)fs=!!e;else return fs},ft=function(e){vs()&&(ql?console.warn(e):(console.log(e),Wl&&console.trace()))},Kl=function(e){return Ue({},e)},or=function(e){return e==null?e:te(e)?e.slice():S(e)?Kl(e):e},Zl=function(e){return e.slice()},ds=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},Ql={},gs=function(){return Ql},Lt=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var s=r[i],o=a==null?void 0:a[s];n[s]=o===void 0?e[s]:o}return n}},wr=function(e,r,a){for(var n=e.length-1;n>=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},ii=function(e){e.splice(0,e.length)},Jl=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},er=function(e,r,a){return a&&(r=Et(a,r)),e[r]},xr=function(e,r,a,n){a&&(r=Et(a,r)),e[r]=n},jl=function(){function t(){he(this,t),this._obj={}}return A(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}]),t}(),ur=typeof Map<"u"?Map:jl,ef="undefined",tf=function(){function t(e){if(he(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return A(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}]),t}(),Jr=(typeof Set>"u"?"undefined":Q(Set))!==ef?Set:tf,dn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!_e(e)){xt("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){xt("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new Jr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];te(r.classes)?u=r.classes:ee(r.classes)&&(u=r.classes.split(/\s+/));for(var f=0,h=u.length;f<h;f++){var c=u[f];!c||c===""||i.classes.add(c)}this.createEmitter();var d=r.style||r.css;d&&(ft("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d)),(a===void 0||a)&&this.restore()},ps=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;S(a)&&!ge(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!H(n)?n:i,n=H(n)?n:function(){};for(var o=this._private.cy,l=a=ee(a)?this.filter(a):a,u=[],f=[],h={},c={},d={},v=0,p,y=this.byGroup(),g=y.nodes,m=y.edges,b=0;b<l.length;b++){var E=l[b],M=E.id();E.isNode()&&(u.unshift(E),e.bfs&&(d[M]=!0,f.push(E)),c[M]=0)}for(var O=function(){var X=e.bfs?u.shift():u.pop(),B=X.id();if(e.dfs){if(d[B])return"continue";d[B]=!0,f.push(X)}var re=c[B],W=h[B],Z=W!=null?W.source():null,ie=W!=null?W.target():null,ue=W==null?void 0:X.same(Z)?ie[0]:Z[0],pe=void 0;if(pe=n(X,W,ue,v++,re),pe===!0)return p=X,"break";if(pe===!1)return"break";for(var se=X.connectedEdges().filter(function(ye){return(!i||ye.source().same(X))&&m.has(ye)}),ve=0;ve<se.length;ve++){var we=se[ve],Te=we.connectedNodes().filter(function(ye){return!ye.same(X)&&g.has(ye)}),Ee=Te.id();Te.length!==0&&!d[Ee]&&(Te=Te[0],u.push(Te),e.bfs&&(d[Ee]=!0,f.push(Te)),h[Ee]=we,c[Ee]=c[B]+1)}};u.length!==0;){var x=O();if(x!=="continue"&&x==="break")break}for(var R=o.collection(),C=0;C<f.length;C++){var F=f[C],z=h[F.id()];z!=null&&R.push(z),R.push(F)}return{path:o.collection(R),found:o.collection(p)}}},Ia={breadthFirstSearch:ps({bfs:!0}),depthFirstSearch:ps({dfs:!0})};Ia.bfs=Ia.breadthFirstSearch,Ia.dfs=Ia.depthFirstSearch;var rf=sl(function(t,e){(function(){var r,a,n,i,s,o,l,u,f,h,c,d,v,p,y;n=Math.floor,h=Math.min,a=function(g,m){return g<m?-1:g>m?1:0},f=function(g,m,b,E,M){var O;if(b==null&&(b=0),M==null&&(M=a),b<0)throw new Error("lo must be non-negative");for(E==null&&(E=g.length);b<E;)O=n((b+E)/2),M(m,g[O])<0?E=O:b=O+1;return[].splice.apply(g,[b,b-b].concat(m)),m},o=function(g,m,b){return b==null&&(b=a),g.push(m),p(g,0,g.length-1,b)},s=function(g,m){var b,E;return m==null&&(m=a),b=g.pop(),g.length?(E=g[0],g[0]=b,y(g,0,m)):E=b,E},u=function(g,m,b){var E;return b==null&&(b=a),E=g[0],g[0]=m,y(g,0,b),E},l=function(g,m,b){var E;return b==null&&(b=a),g.length&&b(g[0],m)<0&&(E=[g[0],m],m=E[0],g[0]=E[1],y(g,0,b)),m},i=function(g,m){var b,E,M,O,x,R;for(m==null&&(m=a),O=(function(){R=[];for(var C=0,F=n(g.length/2);0<=F?C<F:C>F;0<=F?C++:C--)R.push(C);return R}).apply(this).reverse(),x=[],E=0,M=O.length;E<M;E++)b=O[E],x.push(y(g,b,m));return x},v=function(g,m,b){var E;if(b==null&&(b=a),E=g.indexOf(m),E!==-1)return p(g,0,E,b),y(g,E,b)},c=function(g,m,b){var E,M,O,x,R;if(b==null&&(b=a),M=g.slice(0,m),!M.length)return M;for(i(M,b),R=g.slice(m),O=0,x=R.length;O<x;O++)E=R[O],l(M,E,b);return M.sort(b).reverse()},d=function(g,m,b){var E,M,O,x,R,C,F,z,I;if(b==null&&(b=a),m*10<=g.length){if(O=g.slice(0,m).sort(b),!O.length)return O;for(M=O[O.length-1],F=g.slice(m),x=0,C=F.length;x<C;x++)E=F[x],b(E,M)<0&&(f(O,E,0,null,b),O.pop(),M=O[O.length-1]);return O}for(i(g,b),I=[],R=0,z=h(m,g.length);0<=z?R<z:R>z;0<=z?++R:--R)I.push(s(g,b));return I},p=function(g,m,b,E){var M,O,x;for(E==null&&(E=a),M=g[b];b>m;){if(x=b-1>>1,O=g[x],E(M,O)<0){g[b]=O,b=x;continue}break}return g[b]=M},y=function(g,m,b){var E,M,O,x,R;for(b==null&&(b=a),M=g.length,R=m,O=g[m],E=2*m+1;E<M;)x=E+1,x<M&&!(b(g[E],g[x])<0)&&(E=x),g[m]=g[E],m=E,E=2*m+1;return g[m]=O,p(g,R,m,b)},r=function(){g.push=o,g.pop=s,g.replace=u,g.pushpop=l,g.heapify=i,g.updateItem=v,g.nlargest=c,g.nsmallest=d;function g(m){this.cmp=m??a,this.nodes=[]}return g.prototype.push=function(m){return o(this.nodes,m,this.cmp)},g.prototype.pop=function(){return s(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},g.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},g.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(m){return v(this.nodes,m,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var m;return m=new g,m.nodes=this.nodes.slice(0),m},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g}(),function(g,m){return t.exports=m()}(this,function(){return r})}).call(Sa)}),Ra=rf,af=Lt({root:null,weight:function(e){return 1},directed:!1}),nf={dijkstra:function(e){if(!S(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=af(e),n=a.root,i=a.weight,s=a.directed,o=this,l=i,u=ee(n)?this.filter(n)[0]:n[0],f={},h={},c={},d=this.byGroup(),v=d.nodes,p=d.edges;p.unmergeBy(function(re){return re.isLoop()});for(var y=function(W){return f[W.id()]},g=function(W,Z){f[W.id()]=Z,m.updateItem(W)},m=new Ra(function(re,W){return y(re)-y(W)}),b=0;b<v.length;b++){var E=v[b];f[E.id()]=E.same(u)?0:1/0,m.push(E)}for(var M=function(W,Z){for(var ie=(s?W.edgesTo(Z):W.edgesWith(Z)).intersect(p),ue=1/0,pe,se=0;se<ie.length;se++){var ve=ie[se],we=l(ve);(we<ue||!pe)&&(ue=we,pe=ve)}return{edge:pe,dist:ue}};m.size()>0;){var O=m.pop(),x=y(O),R=O.id();if(c[R]=x,x!==1/0)for(var C=O.neighborhood().intersect(v),F=0;F<C.length;F++){var z=C[F],I=z.id(),X=M(O,z),B=x+X.dist;B<y(z)&&(g(z,B),h[I]={node:O,edge:X.edge})}}return{distanceTo:function(W){var Z=ee(W)?v.filter(W)[0]:W[0];return c[Z.id()]},pathTo:function(W){var Z=ee(W)?v.filter(W)[0]:W[0],ie=[],ue=Z,pe=ue.id();if(Z.length>0)for(ie.unshift(Z);h[pe];){var se=h[pe];ie.unshift(se.edge),ie.unshift(se.node),ue=se.node,pe=ue.id()}return o.spawn(ie)}}}},sf={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,l=function(E){for(var M=0;M<s.length;M++){var O=s[M];if(O.has(E))return M}},u=0;u<i;u++)s[u]=this.spawn(a[u]);for(var f=n.sort(function(b,E){return e(b)-e(E)}),h=0;h<f.length;h++){var c=f[h],d=c.source()[0],v=c.target()[0],p=l(d),y=l(v),g=s[p],m=s[y];p!==y&&(o.merge(c),g.merge(m),s.splice(y,1))}return o}},of=Lt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),uf={aStar:function(e){var r=this.cy(),a=of(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,l=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var u=n.id(),f=i.id(),h={},c={},d={},v=new Ra(function(pe,se){return c[pe.id()]-c[se.id()]}),p=new Jr,y={},g={},m=function(se,ve){v.push(se),p.add(ve)},b,E,M=function(){b=v.pop(),E=b.id(),p.delete(E)},O=function(se){return p.has(se)};m(n,u),h[u]=0,c[u]=s(n);for(var x=0;v.size()>0;){if(M(),x++,E===f){for(var R=[],C=i,F=f,z=g[F];R.unshift(C),z!=null&&R.unshift(z),C=y[F],C!=null;)F=C.id(),z=g[F];return{found:!0,distance:h[E],path:this.spawn(R),steps:x}}d[E]=!0;for(var I=b._private.edges,X=0;X<I.length;X++){var B=I[X];if(this.hasElementWithId(B.id())&&!(o&&B.data("source")!==E)){var re=B.source(),W=B.target(),Z=re.id()!==E?re:W,ie=Z.id();if(this.hasElementWithId(ie)&&!d[ie]){var ue=h[E]+l(B);if(!O(ie)){h[ie]=ue,c[ie]=ue+s(Z),m(Z,ie),y[ie]=b,g[ie]=B;continue}ue<h[ie]&&(h[ie]=ue,c[ie]=ue+s(Z),y[ie]=b,g[ie]=B)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},lf=Lt({weight:function(e){return 1},directed:!1}),ff={floydWarshall:function(e){for(var r=this.cy(),a=lf(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),l=o.nodes,u=o.edges,f=l.length,h=f*f,c=function(we){return l.indexOf(we)},d=function(we){return l[we]},v=new Array(h),p=0;p<h;p++){var y=p%f,g=(p-y)/f;g===y?v[p]=0:v[p]=1/0}for(var m=new Array(h),b=new Array(h),E=0;E<u.length;E++){var M=u[E],O=M.source()[0],x=M.target()[0];if(O!==x){var R=c(O),C=c(x),F=R*f+C,z=s(M);if(v[F]>z&&(v[F]=z,m[F]=C,b[F]=M),!i){var I=C*f+R;!i&&v[I]>z&&(v[I]=z,m[I]=R,b[I]=M)}}}for(var X=0;X<f;X++)for(var B=0;B<f;B++)for(var re=B*f+X,W=0;W<f;W++){var Z=B*f+W,ie=X*f+W;v[re]+v[ie]<v[Z]&&(v[Z]=v[re]+v[ie],m[Z]=m[re])}var ue=function(we){return(ee(we)?r.filter(we):we)[0]},pe=function(we){return c(ue(we))},se={distance:function(we,Te){var Ee=pe(we),ye=pe(Te);return v[Ee*f+ye]},path:function(we,Te){var Ee=pe(we),ye=pe(Te),ae=d(Ee);if(Ee===ye)return ae.collection();if(m[Ee*f+ye]==null)return r.collection();var xe=r.collection(),Ce=Ee,Oe;for(xe.merge(ae);Ee!==ye;)Ce=Ee,Ee=m[Ee*f+ye],Oe=b[Ce*f+Ee],xe.merge(Oe),xe.merge(d(Ee));return xe}};return se}},hf=Lt({weight:function(e){return 1},directed:!1,root:null}),cf={bellmanFord:function(e){var r=this,a=hf(e),n=a.weight,i=a.directed,s=a.root,o=n,l=this,u=this.cy(),f=this.byGroup(),h=f.edges,c=f.nodes,d=c.length,v=new ur,p=!1,y=[];s=u.collection(s)[0],h.unmergeBy(function(Fe){return Fe.isLoop()});for(var g=h.length,m=function(ke){var Ge=v.get(ke.id());return Ge||(Ge={},v.set(ke.id(),Ge)),Ge},b=function(ke){return(ee(ke)?u.$(ke):ke)[0]},E=function(ke){return m(b(ke)).dist},M=function(ke){for(var Ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,et=b(ke),We=[],Ye=et;;){if(Ye==null)return r.spawn();var Se=m(Ye),N=Se.edge,le=Se.pred;if(We.unshift(Ye[0]),Ye.same(Ge)&&We.length>0)break;N!=null&&We.unshift(N),Ye=le}return l.spawn(We)},O=0;O<d;O++){var x=c[O],R=m(x);x.same(s)?R.dist=0:R.dist=1/0,R.pred=null,R.edge=null}for(var C=!1,F=function(ke,Ge,et,We,Ye,Se){var N=We.dist+Se;N<Ye.dist&&!et.same(We.edge)&&(Ye.dist=N,Ye.pred=ke,Ye.edge=et,C=!0)},z=1;z<d;z++){C=!1;for(var I=0;I<g;I++){var X=h[I],B=X.source(),re=X.target(),W=o(X),Z=m(B),ie=m(re);F(B,re,X,Z,ie,W),i||F(re,B,X,ie,Z,W)}if(!C)break}if(C)for(var ue=[],pe=0;pe<g;pe++){var se=h[pe],ve=se.source(),we=se.target(),Te=o(se),Ee=m(ve).dist,ye=m(we).dist;if(Ee+Te<ye||!i&&ye+Te<Ee)if(p||(ft("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var ae=[];Ee+Te<ye&&ae.push(ve),!i&&ye+Te<Ee&&ae.push(we);for(var xe=ae.length,Ce=0;Ce<xe;Ce++){var Oe=ae[Ce],Ie=[Oe];Ie.push(m(Oe).edge);for(var He=m(Oe).pred;Ie.indexOf(He)===-1;)Ie.push(He),Ie.push(m(He).edge),He=m(He).pred;Ie=Ie.slice(Ie.indexOf(He));for(var qe=Ie[0].id(),Re=0,Me=2;Me<Ie.length;Me+=2)Ie[Me].id()<qe&&(qe=Ie[Me].id(),Re=Me);Ie=Ie.slice(Re).concat(Ie.slice(0,Re)),Ie.push(Ie[0]);var Ve=Ie.map(function(Fe){return Fe.id()}).join(",");ue.indexOf(Ve)===-1&&(y.push(l.spawn(Ie)),ue.push(Ve))}}else break}return{distanceTo:E,pathTo:M,hasNegativeWeightCycle:p,negativeWeightCycles:y}}},vf=Math.sqrt(2),df=function(e,r,a){a.length===0&&xt("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=r[i],l=r[s],u=a,f=u.length-1;f>=0;f--){var h=u[f],c=h[1],d=h[2];(r[c]===o&&r[d]===l||r[c]===l&&r[d]===o)&&u.splice(f,1)}for(var v=0;v<u.length;v++){var p=u[v];p[1]===l?(u[v]=p.slice(),u[v][1]=o):p[2]===l&&(u[v]=p.slice(),u[v][2]=o)}for(var y=0;y<r.length;y++)r[y]===l&&(r[y]=o);return u},si=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=df(i,e,r),a--}return r},gf={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(ie){return ie.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/vf);if(i<2){xt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f<s;f++){var h=n[f];u.push([f,a.indexOf(h.source()),a.indexOf(h.target())])}for(var c=1/0,d=[],v=new Array(i),p=new Array(i),y=new Array(i),g=function(ue,pe){for(var se=0;se<i;se++)pe[se]=ue[se]},m=0;m<=o;m++){for(var b=0;b<i;b++)p[b]=b;var E=si(p,u.slice(),i,l),M=E.slice();g(p,y);var O=si(p,E,l,2),x=si(y,M,l,2);O.length<=x.length&&O.length<c?(c=O.length,d=O,g(p,v)):x.length<=O.length&&x.length<c&&(c=x.length,d=x,g(y,v))}for(var R=this.spawn(d.map(function(ie){return n[ie[0]]})),C=this.spawn(),F=this.spawn(),z=v[0],I=0;I<v.length;I++){var X=v[I],B=a[I];X===z?C.merge(B):F.merge(B)}var re=function(ue){var pe=e.spawn();return ue.forEach(function(se){pe.merge(se),se.connectedEdges().forEach(function(ve){e.contains(ve)&&!R.contains(ve)&&pe.merge(ve)})}),pe},W=[re(C),re(F)],Z={cut:R,components:W,partition1:C,partition2:F};return Z}},pf=function(e){return{x:e.x,y:e.y}},gn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},ys=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},jr=function(e){return{x:e[0],y:e[1]}},yf=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},mf=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},bf=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},Ef=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,d){return c-d});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},wf=function(e){return Math.PI*e/180},pn=function(e,r){return Math.atan2(r,e)-Math.PI/2},oi=Math.log2||function(t){return Math.log(t)/Math.log(2)},ms=function(e){return e>0?1:e<0?-1:0},Pr=function(e,r){return Math.sqrt(Br(e,r))},Br=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},xf=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},St=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},ea=function(e,r,a,n){return{x:St(e.x,r.x,a.x,n),y:St(e.y,r.y,a.y,n)}},Tf=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},s=Pr(e,r),o={x:i.x/s,y:i.y/s};return a=a??0,n=n??a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},ka=function(e,r,a){return Math.max(e,Math.min(a,r))},Ut=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Cf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Df=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Sf=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},Lf=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},yn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ui=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=w(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},bs=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},li=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},ta=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Af=function(e,r){return ta(e,r.x,r.y)},Es=function(e,r){return ta(e,r.x1,r.y1)&&ta(e,r.x2,r.y2)},ws=function(e,r,a,n,i,s,o){var l=Fa(i,s),u=i/2,f=s/2,h;{var c=a-u+l-o,d=n-f-o,v=a+u-l+o,p=d;if(h=Tr(e,r,a,n,c,d,v,p,!1),h.length>0)return h}{var y=a+u+o,g=n-f+l-o,m=y,b=n+f-l+o;if(h=Tr(e,r,a,n,y,g,m,b,!1),h.length>0)return h}{var E=a-u+l-o,M=n+f+o,O=a+u-l+o,x=M;if(h=Tr(e,r,a,n,E,M,O,x,!1),h.length>0)return h}{var R=a-u-o,C=n-f+l-o,F=R,z=n+f-l+o;if(h=Tr(e,r,a,n,R,C,F,z,!1),h.length>0)return h}var I;{var X=a-u+l,B=n-f+l;if(I=Pa(e,r,a,n,X,B,l+o),I.length>0&&I[0]<=X&&I[1]<=B)return[I[0],I[1]]}{var re=a+u-l,W=n-f+l;if(I=Pa(e,r,a,n,re,W,l+o),I.length>0&&I[0]>=re&&I[1]<=W)return[I[0],I[1]]}{var Z=a+u-l,ie=n+f-l;if(I=Pa(e,r,a,n,Z,ie,l+o),I.length>0&&I[0]>=Z&&I[1]>=ie)return[I[0],I[1]]}{var ue=a-u+l,pe=n+f-l;if(I=Pa(e,r,a,n,ue,pe,l+o),I.length>0&&I[0]<=ue&&I[1]>=pe)return[I[0],I[1]]}return[]},Of=function(e,r,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=f+l&&h-l<=r&&r<=c+l},Nf=function(e,r,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},Mf=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},If=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,l,u,f,h,c,d,v;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,o=l*l*l+u*u,i[1]=0,d=r/3,o>0){h=u+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=u-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+h+c,d+=(h+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+h)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,o===0){v=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-d+2*v,i[4]=i[2]=-(v+d);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),v=2*Math.sqrt(l),i[0]=-d+v*Math.cos(f/3),i[2]=-d+v*Math.cos((f+2*Math.PI)/3),i[4]=-d+v*Math.cos((f+4*Math.PI)/3)},Rf=function(e,r,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*r+2*s*s+2*s*r-l*r,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,d=[];If(u,f,h,c,d);for(var v=1e-7,p=[],y=0;y<6;y+=2)Math.abs(d[y+1])<v&&d[y]>=0&&d[y]<=1&&p.push(d[y]);p.push(1),p.push(0);for(var g=-1,m,b,E,M=0;M<p.length;M++)m=Math.pow(1-p[M],2)*a+2*(1-p[M])*p[M]*i+p[M]*p[M]*o,b=Math.pow(1-p[M],2)*n+2*(1-p[M])*p[M]*s+p[M]*p[M]*l,E=Math.pow(m-e,2)+Math.pow(b-r,2),g>=0?E<g&&(g=E):g=E;return g},kf=function(e,r,a,n,i,s){var o=[e-a,r-n],l=[i-a,s-n],u=l[0]*l[0]+l[1]*l[1],f=o[0]*o[0]+o[1]*o[1],h=o[0]*l[0]+o[1]*l[1],c=h*h/u;return h<0?f:c>u?(e-i)*(e-i)+(r-s)*(r-s):f-c},Yt=function(e,r,a){for(var n,i,s,o,l,u=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>r&&u++;else continue;return u%2!==0},gr=function(e,r,a,n,i,s,o,l,u){var f=new Array(a.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var c=Math.cos(-h),d=Math.sin(-h),v=0;v<f.length/2;v++)f[v*2]=s/2*(a[v*2]*c-a[v*2+1]*d),f[v*2+1]=o/2*(a[v*2+1]*c+a[v*2]*d),f[v*2]+=n,f[v*2+1]+=i;var p;if(u>0){var y=Ts(f,-u);p=xs(y)}else p=f;return Yt(e,r,p)},Pf=function(e,r,a,n,i,s,o){for(var l=new Array(a.length),u=s/2,f=o/2,h=ci(s,o),c=h*h,d=0;d<a.length/4;d++){var v=void 0,p=void 0;d===0?v=a.length-2:v=d*4-2,p=d*4+2;var y=n+u*a[d*4],g=i+f*a[d*4+1],m=-a[v]*a[p]-a[v+1]*a[p+1],b=h/Math.tan(Math.acos(m)/2),E=y-b*a[v],M=g-b*a[v+1],O=y+b*a[p],x=g+b*a[p+1];l[d*4]=E,l[d*4+1]=M,l[d*4+2]=O,l[d*4+3]=x;var R=a[v+1],C=-a[v],F=R*a[p]+C*a[p+1];F<0&&(R*=-1,C*=-1);var z=E+R*h,I=M+C*h,X=Math.pow(z-e,2)+Math.pow(I-r,2);if(X<=c)return!0}return Yt(e,r,l)},xs=function(e){for(var r=new Array(e.length/2),a,n,i,s,o,l,u,f,h=0;h<e.length/4;h++){a=e[h*4],n=e[h*4+1],i=e[h*4+2],s=e[h*4+3],h<e.length/4-1?(o=e[(h+1)*4],l=e[(h+1)*4+1],u=e[(h+1)*4+2],f=e[(h+1)*4+3]):(o=e[0],l=e[1],u=e[2],f=e[3]);var c=Tr(a,n,i,s,o,l,u,f,!0);r[h*2]=c[0],r[h*2+1]=c[1]}return r},Ts=function(e,r){for(var a=new Array(e.length*2),n,i,s,o,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-i,f=-(s-n),h=Math.sqrt(u*u+f*f),c=u/h,d=f/h;a[l*4]=n+c*r,a[l*4+1]=i+d*r,a[l*4+2]=s+c*r,a[l*4+3]=o+d*r}return a},Bf=function(e,r,a,n,i,s){var o=a-e,l=n-r;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),f=u-1;if(f<0)return[];var h=f/u;return[(a-e)*h+e,(n-r)*h+r]},Fr=function(e,r,a,n,i,s,o){return e-=i,r-=s,e/=a/2+o,r/=n/2+o,e*e+r*r<=1},Pa=function(e,r,a,n,i,s,o){var l=[a-e,n-r],u=[e-i,r-s],f=l[0]*l[0]+l[1]*l[1],h=2*(u[0]*l[0]+u[1]*l[1]),c=u[0]*u[0]+u[1]*u[1]-o*o,d=h*h-4*f*c;if(d<0)return[];var v=(-h+Math.sqrt(d))/(2*f),p=(-h-Math.sqrt(d))/(2*f),y=Math.min(v,p),g=Math.max(v,p),m=[];if(y>=0&&y<=1&&m.push(y),g>=0&&g<=1&&m.push(g),m.length===0)return[];var b=m[0]*l[0]+e,E=m[0]*l[1]+r;if(m.length>1){if(m[0]==m[1])return[b,E];var M=m[1]*l[0]+e,O=m[1]*l[1]+r;return[b,E,M,O]}else return[b,E]},fi=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Tr=function(e,r,a,n,i,s,o,l,u){var f=e-i,h=a-e,c=o-i,d=r-s,v=n-r,p=l-s,y=c*d-p*f,g=h*d-v*f,m=p*h-c*v;if(m!==0){var b=y/m,E=g/m,M=.001,O=0-M,x=1+M;return O<=b&&b<=x&&O<=E&&E<=x?[e+b*h,r+b*v]:u?[e+b*h,r+b*v]:[]}else return y===0||g===0?fi(e,a,o)===o?[o,l]:fi(e,a,i)===i?[i,s]:fi(i,o,a)===a?[a,n]:[]:[]},Ba=function(e,r,a,n,i,s,o,l){var u=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var d;if(c){for(var v=0;v<h.length/2;v++)h[v*2]=a[v*2]*s+n,h[v*2+1]=a[v*2+1]*o+i;if(l>0){var p=Ts(h,-l);d=xs(p)}else d=h}else d=a;for(var y,g,m,b,E=0;E<d.length/2;E++)y=d[E*2],g=d[E*2+1],E<d.length/2-1?(m=d[(E+1)*2],b=d[(E+1)*2+1]):(m=d[0],b=d[1]),f=Tr(e,r,n,i,y,g,m,b),f.length!==0&&u.push(f[0],f[1]);return u},Ff=function(e,r,a,n,i,s,o,l){for(var u=[],f,h=new Array(a.length),c=s/2,d=o/2,v=ci(s,o),p=0;p<a.length/4;p++){var y=void 0,g=void 0;p===0?y=a.length-2:y=p*4-2,g=p*4+2;var m=n+c*a[p*4],b=i+d*a[p*4+1],E=-a[y]*a[g]-a[y+1]*a[g+1],M=v/Math.tan(Math.acos(E)/2),O=m-M*a[y],x=b-M*a[y+1],R=m+M*a[g],C=b+M*a[g+1];p===0?(h[a.length-2]=O,h[a.length-1]=x):(h[p*4-2]=O,h[p*4-1]=x),h[p*4]=R,h[p*4+1]=C;var F=a[y+1],z=-a[y],I=F*a[g]+z*a[g+1];I<0&&(F*=-1,z*=-1);var X=O+F*v,B=x+z*v;f=Pa(e,r,n,i,X,B,v),f.length!==0&&u.push(f[0],f[1])}for(var re=0;re<h.length/4;re++)f=Tr(e,r,n,i,h[re*4],h[re*4+1],h[re*4+2],h[re*4+3],!1),f.length!==0&&u.push(f[0],f[1]);if(u.length>2){for(var W=[u[0],u[1]],Z=Math.pow(W[0]-e,2)+Math.pow(W[1]-r,2),ie=1;ie<u.length/2;ie++){var ue=Math.pow(u[ie*2]-e,2)+Math.pow(u[ie*2+1]-r,2);ue<=Z&&(W[0]=u[ie*2],W[1]=u[ie*2+1],Z=ue)}return W}return u},mn=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[r[0]+s*n[0],r[1]+s*n[1]]},$t=function(e,r){var a=hi(e,r);return a=Cs(a),a},Cs=function(e){for(var r,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<n;u++)r=e[2*u],a=e[2*u+1],i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);for(var f=2/(o-i),h=2/(l-s),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*h,i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);if(s<-1)for(var d=0;d<n;d++)a=e[2*d+1]=e[2*d+1]+(-1-s);return e},hi=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},Fa=function(e,r){return Math.min(e/4,r/4,8)},ci=function(e,r){return Math.min(e/10,r/10,8)},Ds=function(){return 8},zf=function(e,r,a){return[e-2*r+a,2*(r-e),e]},vi=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Gf=Lt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),$f={pageRank:function(e){for(var r=Gf(e),a=r.dampingFactor,n=r.precision,i=r.iterations,s=r.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,f=l.edges,h=u.length,c=h*h,d=f.length,v=new Array(c),p=new Array(h),y=(1-a)/h,g=0;g<h;g++){for(var m=0;m<h;m++){var b=g*h+m;v[b]=0}p[g]=0}for(var E=0;E<d;E++){var M=f[E],O=M.data("source"),x=M.data("target");if(O!==x){var R=u.indexOfId(O),C=u.indexOfId(x),F=s(M),z=C*h+R;v[z]+=F,p[R]+=F}}for(var I=1/h+y,X=0;X<h;X++)if(p[X]===0)for(var B=0;B<h;B++){var re=B*h+X;v[re]=I}else for(var W=0;W<h;W++){var Z=W*h+X;v[Z]=v[Z]/p[X]+y}for(var ie=new Array(h),ue=new Array(h),pe,se=0;se<h;se++)ie[se]=1;for(var ve=0;ve<i;ve++){for(var we=0;we<h;we++)ue[we]=0;for(var Te=0;Te<h;Te++)for(var Ee=0;Ee<h;Ee++){var ye=Te*h+Ee;ue[Te]+=v[ye]*ie[Ee]}xf(ue),pe=ie,ie=ue,ue=pe;for(var ae=0,xe=0;xe<h;xe++){var Ce=pe[xe]-ie[xe];ae+=Ce*Ce}if(ae<n)break}var Oe={rank:function(He){return He=o.collection(He)[0],ie[u.indexOf(He)]}};return Oe}},Ss=Lt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ra={degreeCentralityNormalized:function(e){e=Ss(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},h={},c=0,d=0,v=0;v<n;v++){var p=a[v],y=p.id();e.root=p;var g=this.degreeCentrality(e);c<g.indegree&&(c=g.indegree),d<g.outdegree&&(d=g.outdegree),f[y]=g.indegree,h[y]=g.outdegree}return{indegree:function(b){return c==0?0:(ee(b)&&(b=r.filter(b)),f[b.id()]/c)},outdegree:function(b){return d===0?0:(ee(b)&&(b=r.filter(b)),h[b.id()]/d)}}}else{for(var i={},s=0,o=0;o<n;o++){var l=a[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(b){return s===0?0:(ee(b)&&(b=r.filter(b)),i[b.id()]/s)}}}},degreeCentrality:function(e){e=Ss(e);var r=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,l=n.alpha;if(i=r.collection(i)[0],o){for(var d=i.connectedEdges(),v=d.filter(function(O){return O.target().same(i)&&a.has(O)}),p=d.filter(function(O){return O.source().same(i)&&a.has(O)}),y=v.length,g=p.length,m=0,b=0,E=0;E<v.length;E++)m+=s(v[E]);for(var M=0;M<p.length;M++)b+=s(p[M]);return{indegree:Math.pow(y,1-l)*Math.pow(m,l),outdegree:Math.pow(g,1-l)*Math.pow(b,l)}}else{for(var u=i.connectedEdges().intersection(a),f=u.length,h=0,c=0;c<u.length;c++)h+=s(u[c]);return{degree:Math.pow(f,1-l)*Math.pow(h,l)}}}};ra.dc=ra.degreeCentrality,ra.dcn=ra.degreeCentralityNormalised=ra.degreeCentralityNormalized;var Ls=Lt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),aa={closenessCentralityNormalized:function(e){for(var r=Ls(e),a=r.harmonic,n=r.weight,i=r.directed,s=this.cy(),o={},l=0,u=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),h=0;h<u.length;h++){for(var c=0,d=u[h],v=0;v<u.length;v++)if(h!==v){var p=f.distance(d,u[v]);a?c+=1/p:c+=p}a||(c=1/c),l<c&&(l=c),o[d.id()]=c}return{closeness:function(g){return l==0?0:(ee(g)?g=s.filter(g)[0].id():g=g.id(),o[g]/l)}}},closenessCentrality:function(e){var r=Ls(e),a=r.root,n=r.weight,i=r.directed,s=r.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),f=0;f<u.length;f++){var h=u[f];if(!h.same(a)){var c=o.distanceTo(h);s?l+=1/c:l+=c}}return s?l:1/l}};aa.cc=aa.closenessCentrality,aa.ccn=aa.closenessCentralityNormalised=aa.closenessCentralityNormalized;var Vf=Lt({weight:null,directed:!1}),di={betweennessCentrality:function(e){for(var r=Vf(e),a=r.directed,n=r.weight,i=n!=null,s=this.cy(),o=this.nodes(),l={},u={},f=0,h={set:function(b,E){u[b]=E,E>f&&(f=E)},get:function(b){return u[b]}},c=0;c<o.length;c++){var d=o[c],v=d.id();a?l[v]=d.outgoers().nodes():l[v]=d.openNeighborhood().nodes(),h.set(v,0)}for(var p=function(b){for(var E=o[b].id(),M=[],O={},x={},R={},C=new Ra(function(Ee,ye){return R[Ee]-R[ye]}),F=0;F<o.length;F++){var z=o[F].id();O[z]=[],x[z]=0,R[z]=1/0}for(x[E]=1,R[E]=0,C.push(E);!C.empty();){var I=C.pop();if(M.push(I),i)for(var X=0;X<l[I].length;X++){var B=l[I][X],re=s.getElementById(I),W=void 0;re.edgesTo(B).length>0?W=re.edgesTo(B)[0]:W=B.edgesTo(re)[0];var Z=n(W);B=B.id(),R[B]>R[I]+Z&&(R[B]=R[I]+Z,C.nodes.indexOf(B)<0?C.push(B):C.updateItem(B),x[B]=0,O[B]=[]),R[B]==R[I]+Z&&(x[B]=x[B]+x[I],O[B].push(I))}else for(var ie=0;ie<l[I].length;ie++){var ue=l[I][ie].id();R[ue]==1/0&&(C.push(ue),R[ue]=R[I]+1),R[ue]==R[I]+1&&(x[ue]=x[ue]+x[I],O[ue].push(I))}}for(var pe={},se=0;se<o.length;se++)pe[o[se].id()]=0;for(;M.length>0;){for(var ve=M.pop(),we=0;we<O[ve].length;we++){var Te=O[ve][we];pe[Te]=pe[Te]+x[Te]/x[ve]*(1+pe[ve])}ve!=o[b].id()&&h.set(ve,h.get(ve)+pe[ve])}},y=0;y<o.length;y++)p(y);var g={betweenness:function(b){var E=s.collection(b).id();return h.get(E)},betweennessNormalized:function(b){if(f==0)return 0;var E=s.collection(b).id();return h.get(E)/f}};return g.betweennessNormalised=g.betweennessNormalized,g}};di.bc=di.betweennessCentrality;var _f=Lt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),Uf=function(e){return _f(e)},Yf=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},Hf=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},As=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var s=0;s<r;s++)e[s*r+n]=e[s*r+n]/a}},Xf=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+o]*r[o*a+l]}return n},qf=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=Xf(e,n,r);return e},Wf=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return As(n,r),n},Kf=function(e,r,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},Zf=function(e,r,a,n){for(var i=[],s=0;s<r;s++){for(var o=[],l=0;l<r;l++)Math.round(e[s*r+l]*1e3)/1e3>0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},Qf=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},Jf=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&Qf(e[r],e[a])&&e.splice(a,1);return e},Os=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=Uf(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;for(var l=r.length,u=l*l,f=new Array(u),h,c=0;c<u;c++)f[c]=0;for(var d=0;d<a.length;d++){var v=a[d],p=s[v.source().id()],y=s[v.target().id()],g=Yf(v,i.attributes);f[p*l+y]+=g,f[y*l+p]+=g}Hf(f,l,i.multFactor),As(f,l);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,h=qf(f,l,i.expandFactor),f=Wf(h,l,i.inflateFactor),Kf(f,h,u,4)||(m=!0),b++;var E=Zf(f,l,r,n);return E=Jf(E),E},jf={markovClustering:Os,mcl:Os},eh=function(e){return e},Ns=function(e,r){return Math.abs(r-e)},Ms=function(e,r,a){return e+Ns(r,a)},Is=function(e,r,a){return e+Math.pow(a-r,2)},th=function(e){return Math.sqrt(e)},rh=function(e,r,a){return Math.max(e,Ns(r,a))},za=function(e,r,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:eh,o=n,l,u,f=0;f<e;f++)l=r(f),u=a(f),o=i(o,l,u);return s(o)},na={euclidean:function(e,r,a){return e>=2?za(e,r,a,0,Is,th):za(e,r,a,0,Ms)},squaredEuclidean:function(e,r,a){return za(e,r,a,0,Is)},manhattan:function(e,r,a){return za(e,r,a,0,Ms)},max:function(e,r,a){return za(e,r,a,-1/0,rh)}};na["squared-euclidean"]=na.squaredEuclidean,na.squaredeuclidean=na.squaredEuclidean;function bn(t,e,r,a,n,i){var s;return H(t)?s=t:s=na[t]||na.euclidean,e===0&&H(t)?s(n,i):s(e,r,a,n,i)}var ah=Lt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),gi=function(e){return ah(e)},En=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},l=function(c){return n[c](r)},u=a,f=r;return bn(e,n.length,o,l,u,f)},pi=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,s[u]=e.max(a[u]).value;for(var f=0;f<r;f++){l=[];for(var h=0;h<n;h++)l[h]=Math.random()*(s[h]-i[h])+i[h];o[f]=l}return o},Rs=function(e,r,a,n,i){for(var s=1/0,o=0,l=0;l<r.length;l++){var u=En(a,e,r[l],n,i);u<s&&(s=u,o=l)}return o},ks=function(e,r,a){for(var n=[],i=null,s=0;s<r.length;s++)i=r[s],a[i.id()]===e&&n.push(i);return n},nh=function(e,r,a){return Math.abs(r-e)<=a},ih=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-r[n][i]);if(s>a)return!1}return!0},sh=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Ps=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];sh(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<r;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},Bs=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=En("manhattan",r[i],e,a,"kMedoids");return n},oh=function(e){var r=this.cy(),a=this.nodes(),n=null,i=gi(e),s=new Array(i.k),o={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=pi(a,i.k,i.attributes)):Q(i.testCentroids)==="object"?l=i.testCentroids:l=pi(a,i.k,i.attributes):l=pi(a,i.k,i.attributes);for(var u=!0,f=0;u&&f<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],o[n.id()]=Rs(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var d=ks(c,a,o);if(d.length!==0){for(var v=i.attributes.length,p=l[c],y=new Array(v),g=new Array(v),m=0;m<v;m++){g[m]=0;for(var b=0;b<d.length;b++)n=d[b],g[m]+=i.attributes[m](n);y[m]=g[m]/d.length,nh(y[m],p[m],i.sensitivityThreshold)||(u=!0)}l[c]=y,s[c]=r.collection(d)}}f++}return s},uh=function(e){var r=this.cy(),a=this.nodes(),n=null,i=gi(e),s=new Array(i.k),o,l={},u,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(Q(i.testCentroids)==="object"?o=i.testCentroids:o=Ps(a,i.k)):o=Ps(a,i.k);for(var h=!0,c=0;h&&c<i.maxIterations;){for(var d=0;d<a.length;d++)n=a[d],l[n.id()]=Rs(n,o,i.distance,i.attributes,"kMedoids");h=!1;for(var v=0;v<o.length;v++){var p=ks(v,a,l);if(p.length!==0){f[v]=Bs(o[v],p,i.attributes);for(var y=0;y<p.length;y++)u=Bs(p[y],p,i.attributes),u<f[v]&&(f[v]=u,o[v]=p[y],h=!0);s[v]=r.collection(p)}}c++}return s},lh=function(e,r,a,n,i){for(var s,o,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var f=0;f<e.length;f++)for(var h=0;h<i.attributes.length;h++){s=0,o=0;for(var c=0;c<r.length;c++)s+=n[c][f]*i.attributes[h](r[c]),o+=n[c][f];e[f][h]=s/o}},fh=function(e,r,a,n,i){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var o,l,u,f=2/(i.m-1),h=0;h<a.length;h++)for(var c=0;c<n.length;c++){o=0;for(var d=0;d<a.length;d++)l=En(i.distance,n[c],a[h],i.attributes,"cmeans"),u=En(i.distance,n[c],a[d],i.attributes,"cmeans"),o+=Math.pow(l/u,f);e[c][h]=1/o}},hh=function(e,r,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<r.length;u++){o=-1/0,l=-1;for(var f=0;f<r[0].length;f++)r[u][f]>o&&(o=r[u][f],l=f);i[l].push(e[u])}for(var h=0;h<i.length;h++)i[h]=n.collection(i[h]);return i},Fs=function(e){var r=this.cy(),a=this.nodes(),n=gi(e),i,s,o,l,u;l=new Array(a.length);for(var f=0;f<a.length;f++)l[f]=new Array(n.k);o=new Array(a.length);for(var h=0;h<a.length;h++)o[h]=new Array(n.k);for(var c=0;c<a.length;c++){for(var d=0,v=0;v<n.k;v++)o[c][v]=Math.random(),d+=o[c][v];for(var p=0;p<n.k;p++)o[c][p]=o[c][p]/d}s=new Array(n.k);for(var y=0;y<n.k;y++)s[y]=new Array(n.attributes.length);u=new Array(a.length);for(var g=0;g<a.length;g++)u[g]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,lh(s,a,o,u,n),fh(o,l,s,a,n),ih(o,l,n.sensitivityThreshold)||(m=!0),b++;return i=hh(a,o,n,r),{clusters:i,degreeOfMembership:o}},ch={kMeans:oh,kMedoids:uh,fuzzyCMeans:Fs,fcm:Fs},vh=Lt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),dh={single:"min",complete:"max"},gh=function(e){var r=vh(e),a=dh[r.linkage];return a!=null&&(r.linkage=a),r},zs=function(e,r,a,n,i){for(var s=0,o=1/0,l,u=i.attributes,f=function(C,F){return bn(i.distance,u.length,function(z){return u[z](C)},function(z){return u[z](F)},C,F)},h=0;h<e.length;h++){var c=e[h].key,d=a[c][n[c]];d<o&&(s=c,o=d)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var v=r[s],p=r[n[s]],y;i.mode==="dendrogram"?y={left:v,right:p,key:v.key}:y={value:v.value.concat(p.value),key:v.key},e[v.index]=y,e.splice(p.index,1),r[v.key]=y;for(var g=0;g<e.length;g++){var m=e[g];v.key===m.key?l=1/0:i.linkage==="min"?(l=a[v.key][m.key],a[v.key][m.key]>a[p.key][m.key]&&(l=a[p.key][m.key])):i.linkage==="max"?(l=a[v.key][m.key],a[v.key][m.key]<a[p.key][m.key]&&(l=a[p.key][m.key])):i.linkage==="mean"?l=(a[v.key][m.key]*v.size+a[p.key][m.key]*p.size)/(v.size+p.size):i.mode==="dendrogram"?l=f(m.value,v.value):l=f(m.value[0],v.value[0]),a[v.key][m.key]=a[m.key][v.key]=l}for(var b=0;b<e.length;b++){var E=e[b].key;if(n[E]===v.key||n[E]===p.key){for(var M=E,O=0;O<e.length;O++){var x=e[O].key;a[E][x]<a[E][M]&&(M=x)}n[E]=M}e[b].index=b}return v.key=p.key=v.index=p.index=null,!0},wn=function t(e,r,a){e&&(e.value?r.push(e.value):(e.left&&t(e.left,r),e.right&&t(e.right,r)))},ph=function t(e,r){if(!e)return"";if(e.left&&e.right){var a=t(e.left,r),n=t(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},yh=function t(e,r,a){if(!e)return[];var n=[],i=[],s=[];return r===0?(e.left&&wn(e.left,n),e.right&&wn(e.right,i),s=n.concat(i),[a.collection(s)]):r===1?e.value?[a.collection(e.value)]:(e.left&&wn(e.left,n),e.right&&wn(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=t(e.left,r-1,a)),e.right&&(i=t(e.right,r-1,a)),n.concat(i))},Gs=function(e){for(var r=this.cy(),a=this.nodes(),n=gh(e),i=n.attributes,s=function(b,E){return bn(n.distance,i.length,function(M){return i[M](b)},function(M){return i[M](E)},b,E)},o=[],l=[],u=[],f=[],h=0;h<a.length;h++){var c={value:n.mode==="dendrogram"?a[h]:[a[h]],key:h,index:h};o[h]=c,f[h]=c,l[h]=[],u[h]=0}for(var d=0;d<o.length;d++)for(var v=0;v<=d;v++){var p=void 0;n.mode==="dendrogram"?p=d===v?1/0:s(o[d].value,o[v].value):p=d===v?1/0:s(o[d].value[0],o[v].value[0]),l[d][v]=p,l[v][d]=p,p<l[d][u[d]]&&(u[d]=v)}for(var y=zs(o,f,l,u,n);y;)y=zs(o,f,l,u,n);var g;return n.mode==="dendrogram"?(g=yh(o[0],n.dendrogramDepth,r),n.addDendrogram&&ph(o[0],r)):(g=new Array(o.length),o.forEach(function(m,b){m.key=m.index=null,g[b]=r.collection(m.value)})),g},mh={hierarchicalClustering:Gs,hca:Gs},bh=Lt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Eh=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||xt("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||k(a)||xt("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),bh(e)},wh=function(e,r,a,n){var i=function(o,l){return n[l](o)};return-bn(e,n.length,function(s){return i(r,s)},function(s){return i(a,s)},r,a)},xh=function(e,r){var a=null;return r==="median"?a=Ef(e):r==="mean"?a=bf(e):r==="min"?a=yf(e):r==="max"?a=mf(e):a=r,a},Th=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},$s=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<a.length;l++){var u=a[l];r[i*e+u]>o&&(s=u,o=r[i*e+u])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Ch=function(e,r,a){for(var n=$s(e,r,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var l=-1,u=-1/0,f=0;f<s.length;f++){for(var h=0,c=0;c<s.length;c++)h+=r[s[c]*e+s[f]];h>u&&(l=f,u=h)}a[i]=s[l]}return n=$s(e,r,a),n},Vs=function(e){for(var r=this.cy(),a=this.nodes(),n=Eh(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,l,u,f,h,c;o=a.length,l=o*o,u=new Array(l);for(var d=0;d<l;d++)u[d]=-1/0;for(var v=0;v<o;v++)for(var p=0;p<o;p++)v!==p&&(u[v*o+p]=wh(n.distance,a[v],a[p],n.attributes));f=xh(u,n.preference);for(var y=0;y<o;y++)u[y*o+y]=f;h=new Array(l);for(var g=0;g<l;g++)h[g]=0;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;for(var b=new Array(o),E=new Array(o),M=new Array(o),O=0;O<o;O++)b[O]=0,E[O]=0,M[O]=0;for(var x=new Array(o*n.minIterations),R=0;R<x.length;R++)x[R]=0;var C;for(C=0;C<n.maxIterations;C++){for(var F=0;F<o;F++){for(var z=-1/0,I=-1/0,X=-1,B=0,re=0;re<o;re++)b[re]=h[F*o+re],B=c[F*o+re]+u[F*o+re],B>=z?(I=z,z=B,X=re):B>I&&(I=B);for(var W=0;W<o;W++)h[F*o+W]=(1-n.damping)*(u[F*o+W]-z)+n.damping*b[W];h[F*o+X]=(1-n.damping)*(u[F*o+X]-I)+n.damping*b[X]}for(var Z=0;Z<o;Z++){for(var ie=0,ue=0;ue<o;ue++)b[ue]=c[ue*o+Z],E[ue]=Math.max(0,h[ue*o+Z]),ie+=E[ue];ie-=E[Z],E[Z]=h[Z*o+Z],ie+=E[Z];for(var pe=0;pe<o;pe++)c[pe*o+Z]=(1-n.damping)*Math.min(0,ie-E[pe])+n.damping*b[pe];c[Z*o+Z]=(1-n.damping)*(ie-E[Z])+n.damping*b[Z]}for(var se=0,ve=0;ve<o;ve++){var we=c[ve*o+ve]+h[ve*o+ve]>0?1:0;x[C%n.minIterations*o+ve]=we,se+=we}if(se>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var Te=0,Ee=0;Ee<o;Ee++){M[Ee]=0;for(var ye=0;ye<n.minIterations;ye++)M[Ee]+=x[ye*o+Ee];(M[Ee]===0||M[Ee]===n.minIterations)&&Te++}if(Te===o)break}}for(var ae=Th(o,h,c),xe=Ch(o,u,ae),Ce={},Oe=0;Oe<ae.length;Oe++)Ce[ae[Oe]]=[];for(var Ie=0;Ie<a.length;Ie++){var He=i[a[Ie].id()],qe=xe[He];qe!=null&&Ce[qe].push(a[Ie])}for(var Re=new Array(ae.length),Me=0;Me<ae.length;Me++)Re[Me]=r.collection(Ce[ae[Me]]);return Re},Dh={affinityPropagation:Vs,ap:Vs},Sh=Lt({root:void 0,directed:!1}),Lh={hierholzer:function(e){if(!S(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Sh(e),n=a.root,i=a.directed,s=this,o=!1,l,u,f;n&&(f=ee(n)?this.filter(n)[0].id():n[0].id());var h={},c={};i?s.forEach(function(m){var b=m.id();if(m.isNode()){var E=m.indegree(!0),M=m.outdegree(!0),O=E-M,x=M-E;O==1?l?o=!0:l=b:x==1?u?o=!0:u=b:(x>1||O>1)&&(o=!0),h[b]=[],m.outgoers().forEach(function(R){R.isEdge()&&h[b].push(R.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();if(m.isNode()){var E=m.degree(!0);E%2&&(l?u?o=!0:u=b:l=b),h[b]=[],m.connectedEdges().forEach(function(M){return h[b].push(M.id())})}else c[b]=[m.source().id(),m.target().id()]});var d={found:!1,trail:void 0};if(o)return d;if(u&&l)if(i){if(f&&u!=f)return d;f=u}else{if(f&&u!=f&&l!=f)return d;f||(f=u)}else f||(f=s[0].id());var v=function(b){for(var E=b,M=[b],O,x,R;h[E].length;)O=h[E].shift(),x=c[O][0],R=c[O][1],E!=R?(h[R]=h[R].filter(function(C){return C!=O}),E=R):!i&&E!=x&&(h[x]=h[x].filter(function(C){return C!=O}),E=x),M.unshift(O),M.unshift(E);return M},p=[],y=[];for(y=v(f);y.length!=1;)h[y[0]].length==0?(p.unshift(s.getElementById(y.shift())),p.unshift(s.getElementById(y.shift()))):y=v(y.shift()).concat(y);p.unshift(s.getElementById(y.shift()));for(var g in h)if(h[g].length)return d;return d.found=!0,d.trail=this.spawn(p,!0),d}},xn=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},l=function(c,d){for(var v=s.length-1,p=[],y=e.spawn();s[v].x!=c||s[v].y!=d;)p.push(s.pop().edge),v--;p.push(s.pop().edge),p.forEach(function(g){var m=g.connectedNodes().intersection(e);y.merge(g),m.forEach(function(b){var E=b.id(),M=b.connectedEdges().intersection(e);y.merge(b),r[E].cutVertex?y.merge(M.filter(function(O){return O.isLoop()})):y.merge(M)})}),i.push(y)},u=function h(c,d,v){c===v&&(n+=1),r[d]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(d).connectedEdges().intersection(e);if(p.size()===0)i.push(e.spawn(e.getElementById(d)));else{var y,g,m,b;p.forEach(function(E){y=E.source().id(),g=E.target().id(),m=y===d?g:y,m!==v&&(b=E.id(),o[b]||(o[b]=!0,s.push({x:d,y:m,edge:E})),m in r?r[d].low=Math.min(r[d].low,r[m].id):(h(c,m,d),r[d].low=Math.min(r[d].low,r[m].low),r[d].id<=r[m].low&&(r[d].cutVertex=!0,l(d,m))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in r||(n=0,u(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},Ah={hopcroftTarjanBiconnected:xn,htbc:xn,htb:xn,hopcroftTarjanBiconnectedComponents:xn},Tn=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function l(u){i.push(u),r[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(p){var y=p.target().id();y!==u&&(y in r||l(y),r[y].explored||(r[u].low=Math.min(r[u].low,r[y].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),r[c].low=r[u].index,r[c].explored=!0,c===u)break}var d=h.edgesWith(h),v=h.merge(d);n.push(v),s=s.difference(v)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:n}},Oh={tarjanStronglyConnected:Tn,tsc:Tn,tscc:Tn,tarjanStronglyConnectedComponents:Tn},_s={};[Ia,nf,sf,uf,ff,cf,gf,$f,ra,aa,di,jf,ch,mh,Dh,Lh,Ah,Oh].forEach(function(t){Ue(_s,t)});/*!
|
|
3
3
|
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
4
4
|
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as kt,q as vt,r as wt,g as rt,l as I,s as q,a as St,t as Et,u as Tt,v as et}from"./NetworkOverview-
|
|
1
|
+
import{o as kt,q as vt,r as wt,g as rt,l as I,s as q,a as St,t as Et,u as Tt,v as et}from"./NetworkOverview-d20eBsIq.js";import{i as It}from"./is_dark-8v9B-WN0.js";import"./index-uUGk-gee.js";import"./uniqueId-ebLYlRiD.js";import"./unknownify-joALjS6W.js";var X=function(){var n=function(k,r,a,h){for(a=a||{},h=k.length;h--;a[k[h]]=r);return a},t=[1,2],e=[1,5],s=[6,9,11,17,18,20,22,23,26,27,28],i=[1,15],o=[1,16],l=[1,17],p=[1,18],g=[1,19],d=[1,23],f=[1,24],v=[1,27],_=[4,6,9,11,17,18,20,22,23,26,27,28],b={trace:function(){},yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,":":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,period_statement:24,event_statement:25,period:26,event:27,open_directive:28,type_directive:29,arg_directive:30,close_directive:31,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",26:"period",27:"event",28:"open_directive",29:"type_directive",30:"arg_directive",31:"close_directive"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[24,1],[25,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(r,a,h,u,y,c,M){var x=c.length-1;switch(y){case 1:return c[x-1];case 3:this.$=[];break;case 4:c[x-1].push(c[x]),this.$=c[x-1];break;case 5:case 6:this.$=c[x];break;case 7:case 8:this.$=[];break;case 11:u.getCommonDb().setDiagramTitle(c[x].substr(6)),this.$=c[x].substr(6);break;case 12:this.$=c[x].trim(),u.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=c[x].trim(),u.getCommonDb().setAccDescription(this.$);break;case 15:u.addSection(c[x].substr(8)),this.$=c[x].substr(8);break;case 19:u.addTask(c[x],0,""),this.$=c[x];break;case 20:u.addEvent(c[x].substr(2)),this.$=c[x];break;case 21:u.parseDirective("%%{","open_directive");break;case 22:u.parseDirective(c[x],"type_directive");break;case 23:c[x]=c[x].trim().replace(/'/g,'"'),u.parseDirective(c[x],"arg_directive");break;case 24:u.parseDirective("}%%","close_directive","timeline");break}},table:[{3:1,4:t,7:3,12:4,28:e},{1:[3]},n(s,[2,3],{5:6}),{3:7,4:t,7:3,12:4,28:e},{13:8,29:[1,9]},{29:[2,21]},{6:[1,10],7:22,8:11,9:[1,12],10:13,11:[1,14],12:4,17:i,18:o,20:l,22:p,23:g,24:20,25:21,26:d,27:f,28:e},{1:[2,2]},{14:25,15:[1,26],31:v},n([15,31],[2,22]),n(s,[2,8],{1:[2,1]}),n(s,[2,4]),{7:22,10:28,12:4,17:i,18:o,20:l,22:p,23:g,24:20,25:21,26:d,27:f,28:e},n(s,[2,6]),n(s,[2,7]),n(s,[2,11]),{19:[1,29]},{21:[1,30]},n(s,[2,14]),n(s,[2,15]),n(s,[2,16]),n(s,[2,17]),n(s,[2,18]),n(s,[2,19]),n(s,[2,20]),{11:[1,31]},{16:32,30:[1,33]},{11:[2,24]},n(s,[2,5]),n(s,[2,12]),n(s,[2,13]),n(_,[2,9]),{14:34,31:v},{31:[2,23]},{11:[1,35]},n(_,[2,10])],defaultActions:{5:[2,21],7:[2,2],27:[2,24],33:[2,23]},parseError:function(r,a){if(a.recoverable)this.trace(r);else{var h=new Error(r);throw h.hash=a,h}},parse:function(r){var a=this,h=[0],u=[],y=[null],c=[],M=this.table,x="",N=0,S=0,L=2,V=1,H=c.slice.call(arguments,1),m=Object.create(this.lexer),C={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(C.yy[O]=this.yy[O]);m.setInput(r,C.yy),C.yy.lexer=m,C.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var J=m.yylloc;c.push(J);var _t=m.options&&m.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function bt(){var P;return P=u.pop()||m.lex()||V,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=a.symbols_[P]||P),P}for(var T,z,$,K,W={},j,A,tt,G;;){if(z=h[h.length-1],this.defaultActions[z]?$=this.defaultActions[z]:((T===null||typeof T>"u")&&(T=bt()),$=M[z]&&M[z][T]),typeof $>"u"||!$.length||!$[0]){var Q="";G=[];for(j in M[z])this.terminals_[j]&&j>L&&G.push("'"+this.terminals_[j]+"'");m.showPosition?Q="Parse error on line "+(N+1)+`:
|
|
2
2
|
`+m.showPosition()+`
|
|
3
3
|
Expecting `+G.join(", ")+", got '"+(this.terminals_[T]||T)+"'":Q="Parse error on line "+(N+1)+": Unexpected "+(T==V?"end of input":"'"+(this.terminals_[T]||T)+"'"),this.parseError(Q,{text:m.match,token:this.terminals_[T]||T,line:m.yylineno,loc:J,expected:G})}if($[0]instanceof Array&&$.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+T);switch($[0]){case 1:h.push(T),y.push(m.yytext),c.push(m.yylloc),h.push($[1]),T=null,S=m.yyleng,x=m.yytext,N=m.yylineno,J=m.yylloc;break;case 2:if(A=this.productions_[$[1]][1],W.$=y[y.length-A],W._$={first_line:c[c.length-(A||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(A||1)].first_column,last_column:c[c.length-1].last_column},_t&&(W._$.range=[c[c.length-(A||1)].range[0],c[c.length-1].range[1]]),K=this.performAction.apply(W,[x,S,N,C.yy,$[1],y,c].concat(H)),typeof K<"u")return K;A&&(h=h.slice(0,-1*A*2),y=y.slice(0,-1*A),c=c.slice(0,-1*A)),h.push(this.productions_[$[1]][0]),y.push(W.$),c.push(W._$),tt=M[h[h.length-2]][h[h.length-1]],h.push(tt);break;case 3:return!0}}return!0}},w=function(){var k={EOF:1,parseError:function(a,h){if(this.yy.parser)this.yy.parser.parseError(a,h);else throw new Error(a)},setInput:function(r,a){return this.yy=a||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var a=r.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var a=r.length,h=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===u.length?this.yylloc.first_column:0)+u[u.length-h.length].length-h[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),a=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aN as r,aO as a,r as o,aP as c}from"./index-
|
|
1
|
+
import{aN as r,aO as a,r as o,aP as c}from"./index-uUGk-gee.js";const u=(e={})=>{const{data:t,error:n,mutate:s}=r(a("api/admin/metrics/rps"),i,e);return o.useMemo(()=>({metrics:t,loading:!n&&!t,refetch:()=>s(),error:n}),[t,n,s])},i=e=>fetch(e).then(c("Instance Metrics")).then(t=>t.json()),f=e=>!e||e==="undefined"?"unknown":e;export{f as a,u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aO as i,aN as p,r as n,aP as u}from"./index-
|
|
1
|
+
import{aO as i,aN as p,r as n,aP as u}from"./index-uUGk-gee.js";const k=(a={})=>{const s=i("api/admin/api-tokens"),{data:t,error:e,mutate:o}=p(s,h,a),r=n.useMemo(()=>t??[],[t]),c=n.useCallback(()=>{o().catch(console.warn)},[o]);return{tokens:r,error:e,loading:!e&&!t,refetch:c}},h=async a=>(await(await fetch(a).then(u("Api tokens"))).json()).tokens;export{k as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,cb as O,B as d,s as a,T as w,gj as k,v as A,k as q,ax as J,ew as L,C as v,co as z,r as s,az as K,f as H}from"./index-
|
|
1
|
+
import{j as e,cb as O,B as d,s as a,T as w,gj as k,v as A,k as q,ax as J,ew as L,C as v,co as z,r as s,az as K,f as H}from"./index-uUGk-gee.js";const M=()=>e.jsx(O,{htmlTooltip:!0,tooltip:e.jsx(d,{children:"Enforce an upper limit of the number of feature toggles that may be created for this project. You can create unlimited feature toggle if there is no limit set."})}),_=a(w)(({theme:t})=>({fontWeight:t.fontWeight.bold,display:"inline"})),B=a(w)(({theme:t})=>({display:"inline",color:t.palette.text.secondary})),Y=()=>e.jsx(O,{htmlTooltip:!0,tooltip:e.jsxs(e.Fragment,{children:[e.jsxs(d,{children:[e.jsx(_,{children:"open: "}),e.jsx(B,{children:"Everyone can submit change requests"})]}),e.jsxs(d,{sx:{mt:2},children:[e.jsx(_,{children:"protected: "}),e.jsx(B,{children:"Only admins and project members can submit change requests"})]}),e.jsxs(d,{sx:{mt:2},children:[e.jsx(_,{children:"private: "}),e.jsx(B,{children:"Only admins, editors and project members can see and access the project and associated feature toggles"})]})]})}),$="PROJECT_STICKINESS_SELECT",G="PROJECT_ID_INPUT",Q="PROJECT_NAME_INPUT",V="PROJECT_DESCRIPTION_INPUT",X=a("form")(({theme:t})=>({height:"100%",paddingBottom:t.spacing(1)})),N=a("p")(({theme:t})=>({marginBottom:t.spacing(1),marginRight:t.spacing(1)})),Z=a(k)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"200px"})),ee=a("div")(({theme:t})=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallerBody,lineHeight:1.25,paddingBottom:t.spacing(1)})),R=a(A)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2),paddingRight:t.spacing(1)})),te=a(q)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),ne=a("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),se=a("div")(()=>({display:"flex",alignItems:"center"})),ce=({children:t,handleSubmit:g,projectId:x,projectName:h,projectDesc:j,projectStickiness:f,featureLimit:l,featureCount:i,projectMode:S,setProjectMode:u,setProjectId:T,setProjectName:c,setProjectDesc:C,setProjectStickiness:r,setFeatureLimit:I,errors:o,mode:p,validateProjectId:y,clearErrors:b})=>{const{isEnterprise:P}=J(),m=[{key:"open",label:"open"},{key:"protected",label:"protected"},{key:"private",label:"private"}];return e.jsxs(X,{onSubmit:n=>{g(n)},children:[e.jsx(N,{children:"What is your project Id?"}),e.jsx(R,{label:"Project Id",value:x,onChange:n=>T(L(n.target.value)),error:!!o.id,errorText:o.id,onFocus:()=>b(),onBlur:y,disabled:p==="Edit","data-testid":G,autoFocus:!0,required:!0}),e.jsx(N,{children:"What is your project name?"}),e.jsx(R,{label:"Project name",value:h,onChange:n=>c(n.target.value),error:!!o.name,errorText:o.name,onFocus:()=>{delete o.name},"data-testid":Q,required:!0}),e.jsx(N,{children:"What is your project description?"}),e.jsx(te,{label:"Project description",variant:"outlined",multiline:!0,maxRows:4,value:j,onChange:n=>C(n.target.value),"data-testid":V}),e.jsx(v,{condition:r!=null,show:e.jsxs(e.Fragment,{children:[e.jsx(N,{children:"What is the default stickiness for the project?"}),e.jsx(z,{label:"Stickiness",value:f,"data-testid":$,onChange:n=>r==null?void 0:r(n.target.value),editable:!0})]})}),e.jsx(v,{condition:p==="Edit",show:()=>e.jsxs(e.Fragment,{children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",marginBottom:1,gap:1},children:[e.jsx("p",{children:"Feature flag limit?"}),e.jsx(M,{})]}),e.jsx(ee,{children:"Leave it empty if you don’t want to add a limit"}),e.jsxs(se,{children:[e.jsx(R,{label:"Limit",name:"value",type:"number",value:l==="null"||l===void 0?"":l,onChange:n=>I(n.target.value)}),e.jsx(v,{condition:i!==void 0&&!!l,show:e.jsxs(d,{children:["(",i," of ",l," used)"]})})]})]})}),e.jsx(v,{condition:p==="Create"&&P(),show:e.jsxs(e.Fragment,{children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",marginBottom:1,gap:1},children:[e.jsx("p",{children:"What is your project collaboration mode?"}),e.jsx(Y,{})]}),e.jsx(Z,{id:"project-mode",value:S,label:"Project collaboration mode",name:"Project collaboration mode",onChange:n=>{u==null||u(n.target.value)},options:m})]})}),e.jsx(ne,{children:t})]})},oe="default",de=(t="",g="",x="",h=oe,j="",f="open")=>{const{isEnterprise:l}=J(),[i,S]=s.useState(t),[u,T]=s.useState(f),[c,C]=s.useState(g),[r,I]=s.useState(x),[o,p]=s.useState(h),[y,b]=s.useState(j),[P,m]=s.useState({}),{validateId:n}=K();s.useEffect(()=>{S(t)},[t]),s.useEffect(()=>{C(g)},[g]),s.useEffect(()=>{I(x)},[x]),s.useEffect(()=>{b(j)},[j]),s.useEffect(()=>{p(h)},[h]),s.useEffect(()=>{T(f)},[f]);const F=()=>l()?{id:i,name:c,description:r,defaultStickiness:o,mode:u}:{id:i,name:c,description:r,defaultStickiness:o},U=()=>({id:i,name:c,description:r,defaultStickiness:o,featureLimit:D()}),D=()=>y===""?null:Number(y);return{projectId:i,projectName:c,projectDesc:r,projectMode:u,projectStickiness:o,featureLimit:y,setProjectId:S,setProjectName:C,setProjectDesc:I,setProjectStickiness:p,setFeatureLimit:b,setProjectMode:T,getCreateProjectPayload:F,getEditProjectPayload:U,validateName:()=>c.length===0?(m(E=>({...E,name:"Name can not be empty."})),!1):!0,validateProjectId:async()=>{if(i.length===0)return m(E=>({...E,id:"Id can not be empty."})),!1;try{return await n(F().id),!0}catch(E){return m(W=>({...W,id:H(E)})),!1}},clearErrors:()=>{m({})},errors:P}};export{Y as C,oe as D,ce as P,de as u};
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{c as pt,j as t,s as p,aE as A,aF as M,aG as Js,aH as Qs,C as b,aI as re,aJ as Ce,aK as Q,aL as we,aM as Zs,aN as He,r as g,aO as ge,aP as ye,aQ as gt,aR as Xs,aS as en,aT as tn,aU as sn,b as U,aV as ne,aW as te,f as N,T as W,aX as Fe,aY as he,aZ as rs,a_ as Z,a$ as de,t as ee,x as $e,b0 as nn,b1 as an,b2 as ke,M as ue,b3 as Te,b4 as os,b5 as me,b6 as is,b7 as oe,ay as ce,b8 as We,J as ie,b9 as rn,ba as on,bb as cn,bc as lt,bd as ln,be as dn,B as K,bf as un,bg as pn,bh as gn,bi as hn,bj as fn,bk as xn,bl as mn,bm as cs,bn as yn,bo as Ft,bp as ls,aw as jn,bq as Sn,a as ht,ac as Ie,br as ft,G as Ee,K as bn,bs as xt,h as je,bt as Ae,bu as ds,bv as mt,bw as yt,bx as jt,ax as fe,aj as ae,by as St,bz as us,aA as Ue,bA as ps,bB as gs,bC as hs,bD as vn,bE as bt,R as vt,bF as fs,Y as Cn,bG as Ct,bH as ve,bI as pe,bJ as xs,a1 as ms,bK as wn,bL as le,bM as Tn,bN as En,X as An,ai as Dn,bO as Fn,bP as Rn,bQ as $n,bR as kn,bS as In,bT as Pn,u as On,bU as ys,bV as wt,bW as Bn,bX as Ln,bY as Rt,bZ as js,b_ as Ss,b$ as _n,c0 as bs,c1 as Mn,c2 as qn,c3 as zn,c4 as Tt,c5 as Vn,c6 as Ye,c7 as Nn,Q as vs,D as Re,c8 as Hn,c9 as Wn,ca as Un,cb as Yn,cc as Cs,cd as ws,ce as Gn,cf as Kn,cg as _e,ch as Ts,ci as Es,cj as As,ck as xe,cl as dt,cm as Jn,cn as Ds,co as Qn,cp as Zn,e as Xn,cq as ea,cr as $t,av as ta,cs as be,ct as kt,cu as sa,cv as na,cw as aa,l as ra,at as Et,au as oa,ao as It,cx as ia,cy as ca,cz as la,cA as Pt,ab as Fs,cB as da,a3 as Je,af as ua,a5 as pa,a6 as ga,a7 as ha,a8 as fa,a9 as xa,aa as ma,cC as ya,cD as ja,cE as Ot,cF as Sa,cG as ba,cH as Qe,cI as va,cJ as Ca,cK as wa,cL as Rs,q as Ta,cM as Bt,cN as Ea,cO as Aa,cP as Da,cQ as Fa,cR as Ra,cS as $a,al as ka,cT as Ia,cU as Pa,cV as Oa,cW as Ba,cX as La,cY as _a,cZ as Ma,c_ as qa}from"./index-p2PlVFLf.js";import{C as $s,u as ks,a as za,F as Va,V as Na,b as Ha,c as Wa,T as Ua,d as Ya,W as Ga,e as Ka,f as Ja}from"./FeatureArchiveDialog-NSAcrt7Z.js";import{S as Qa}from"./StrategyItemContainer-wxQbaPXr.js";const Za=pt(t.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"}),"Archive"),Xa=pt(t.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"}),"Assessment"),er=pt(t.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"}),"LibraryAdd"),tr=p("div")(({theme:e})=>({borderRadius:e.spacing(1.5),backgroundColor:e.palette.background.paper,padding:e.spacing(4)})),sr=()=>{const e=A("projectId"),s=A("featureId"),{feature:n}=M(e,s);return n.name?t.jsx(tr,{children:t.jsx(Js,{title:"Event log",feature:s,displayInline:!0})}):null},nr=p("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,color:e.palette.primary.contrastText,backgroundColor:e.palette.background.alternative,display:"flex",flexDirection:"column",maxWidth:"350px",minWidth:"350px",marginRight:e.spacing(2),[e.breakpoints.down(1e3)]:{width:"100%",maxWidth:"none",minWidth:"auto"}})),ar=p("div")({padding:"1.5rem 1.5rem 0 1.5rem"}),rr=p("div")({display:"flex",alignItems:"center"}),or=p("h2")(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:"normal",margin:0})),ir=p("div")(({theme:e})=>({margin:e.spacing(2,0),display:"flex",flexDirection:"column"})),Lt=p("span")(({theme:e})=>({margin:e.spacing(1,0),fontSize:e.fontSizes.bodySize})),_t=p("div")(({theme:e})=>({display:"flex",alignItems:"center",color:e.palette.primary.contrastText})),cr=()=>{const e=A("projectId"),s=A("featureId"),{feature:n}=M(e,s),{project:r,description:a,type:o}=n,i=Zs(o);return t.jsx(nr,{children:t.jsxs(ar,{children:[t.jsxs(rr,{"data-loading":!0,children:[t.jsx(i,{sx:c=>({marginRight:c.spacing(2),height:"40px",width:"40px",fill:c.palette.primary.contrastText})})," ",t.jsxs(or,{children:[Qs(o||"")," toggle"]})]}),t.jsxs(ir,{children:[t.jsxs(Lt,{"data-loading":!0,children:["Project: ",r]}),t.jsx(b,{condition:!!a,show:t.jsxs(Lt,{"data-loading":!0,children:[t.jsx("div",{children:"Description:"}),t.jsxs(_t,{children:[t.jsx("p",{children:a}),t.jsx(re,{projectId:e,permission:Ce,component:Q,to:`/projects/${e}/features/${s}/settings`,tooltipProps:{title:"Edit description"},children:t.jsx(we,{sx:c=>({color:c.palette.primary.contrastText})})})]})]}),elseShow:t.jsx("span",{"data-loading":!0,children:t.jsxs(_t,{children:["No description."," ",t.jsx(re,{projectId:e,permission:Ce,component:Q,to:`/projects/${e}/features/${s}/settings`,tooltipProps:{title:"Edit description"},children:t.jsx(we,{sx:c=>({color:c.palette.primary.contrastText})})})]})})})]})]})})},Mt={lastHourUsage:[],seenApplications:[]},lr=(e,s,n={})=>{const r=async()=>{const u=ge(`api/admin/client-metrics/features/${s}`),h=await fetch(u,{method:"GET"}).then(ye("feature metrics"));return h.ok?h.json():Mt},a=`${e}_${s}_metrics`,{data:o,error:i}=He(a,r,{...n}),[c,l]=g.useState(!i&&!o),d=()=>{gt(a)};return g.useEffect(()=>{l(!i&&!o)},[o,i]),{metrics:o||Mt,error:i,loading:c,refetch:d,FEATURE_METRICS_CACHE_KEY:a}},dr=e=>({yes:0,no:0,environment:e,timestamp:""}),ur=(e,s)=>e.map(n=>s.lastHourUsage.find(a=>a.environment===n.name)||dr(n.name)),pr=e=>(s,n,r)=>(r.revalidateOnFocus=!1,r.revalidateIfStale=!1,r.revalidateOnReconnect=!1,e(s,n,r)),gr=Xs(He,pr),Is=(e,s)=>{const{refetchFeature:n}=M(e,s),r=en(e,s),{data:a,error:o,mutate:i}=gr(["useFeatureImmutable",r],()=>tn(r)),c=g.useCallback(async()=>{await i(),await n()},[i,n]);return{feature:(a==null?void 0:a.body)||sn,refetchFeature:c,loading:!o&&!a,status:a==null?void 0:a.status,error:o}},Ps=(e,s,n)=>{const{setToastData:r,setToastApiError:a}=U(),{addChange:o}=ne(),{refetch:i}=te(e),[c,l]=g.useState({isOpen:!1}),d=g.useCallback((y,T,f)=>{l({featureName:s,environment:y,fromEnvironment:f,strategy:T,isOpen:!0})},[]),u=g.useCallback((y,T,f)=>{l({featureName:s,environment:y,fromEnvironment:f,strategies:T,isOpen:!0})},[]),h=g.useCallback(()=>{l({isOpen:!1})},[]),m=g.useCallback(async()=>{try{await o(e,c.environment,{feature:c.featureName,action:n,payload:c.strategy}),i(),l({isOpen:!1}),r({type:"success",title:"Changes added to the draft!"})}catch(y){a(N(y)),l({isOpen:!1})}},[o]),j=g.useCallback(async()=>{try{await Promise.all(c.strategies.map(y=>o(e,c.environment,{feature:c.featureName,action:n,payload:y}))),i(),l({isOpen:!1}),r({type:"success",title:"Changes added to the draft!"})}catch(y){a(N(y)),l({isOpen:!1})}},[o]);return{onChangeRequestAddStrategy:d,onChangeRequestAddStrategies:u,onChangeRequestAddStrategyClose:h,onChangeRequestAddStrategyConfirm:m,onChangeRequestAddStrategiesConfirm:j,changeRequestDialogDetails:c}},hr=({payload:e,fromEnvironment:s,environment:n})=>t.jsxs(W,{children:[t.jsxs("strong",{children:["Copy ",Fe((e==null?void 0:e.name)||"")," strategy"," "]})," ","from ",s," to ",n]}),fr=({environmentId:e,environments:s,strategy:n})=>{const r=A("projectId"),a=A("featureId"),[o,i]=g.useState(null),c=!!o,{addStrategyToFeature:l}=he(),{setToastData:d,setToastApiError:u}=U(),{refetchFeature:h}=M(r,a),{refetchFeature:m}=Is(r,a),j=()=>{i(null)},y=rs(r),{isChangeRequestConfigured:T}=Z(r),{changeRequestDialogDetails:f,onChangeRequestAddStrategyClose:x,onChangeRequestAddStrategy:R,onChangeRequestAddStrategyConfirm:L}=Ps(r,a,"addStrategy"),q=async v=>{const{id:C,...$}={...n,targetEnvironment:v};if(T(v)){await R(v,{id:C,...$},e);return}try{await l(r,a,v,n),h(),m(),d({title:"Strategy created",text:`Successfully copied a strategy to ${v}`,type:"success"})}catch(O){u(N(O))}j()},z=s.some(v=>y(de,v));return t.jsxs("div",{children:[t.jsx($s,{isOpen:f.isOpen,onClose:x,environment:f==null?void 0:f.environment,onConfirm:L,messageComponent:t.jsx(hr,{fromEnvironment:f.fromEnvironment,payload:f.strategy})}),t.jsx(ee,{title:`Copy to another environment${z?"":" (Access denied)"}`,children:t.jsx("div",{children:t.jsx($e,{size:"large",id:`copy-strategy-icon-menu-${n.id}`,"aria-controls":c?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":c?"true":void 0,onClick:v=>{i(v.currentTarget)},"data-testid":nn,disabled:!z,children:t.jsx(an,{})})})}),t.jsx(ke,{id:"basic-menu",anchorEl:o,open:c,onClose:j,MenuListProps:{"aria-labelledby":`copy-strategy-icon-menu-${n.id}`},children:s.map(v=>{const C=y(de,v);return t.jsx(ee,{title:C?"":"You don't have access to add a strategy to this environment",children:t.jsx("div",{children:t.jsxs(ue,{onClick:()=>q(v),disabled:!C,children:[t.jsx(b,{condition:!C,show:t.jsx(Te,{children:t.jsx(os,{fontSize:"small"})})}),t.jsxs(me,{children:["Copy to ",v]})]})})},v)})})]})},xr=()=>t.jsx(ie,{severity:"error",children:"Removing the strategy will change which users receive access to the feature."}),mr=p("div")(({theme:e})=>({"> * + *":{marginTop:e.spacing(1)}})),yr=({changeRequests:e,projectId:s})=>e&&e.length>0?t.jsxs(ie,{severity:"warning",children:[t.jsx("p",{children:"This strategy is in use by at least one scheduled change request. If you remove it, those change requests can no longer be applied."}),t.jsx("p",{children:"The following scheduled change requests use this strategy:"}),t.jsx("ul",{children:e.map(({id:n,title:r})=>{const a=r?`#${n} (${r})`:`#${n}`;return t.jsx("li",{children:t.jsx(Q,{to:`/projects/${s}/change-requests/${n}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${n}`,children:a})},n)})})]}):e===void 0?t.jsx(ie,{severity:"warning",children:t.jsx("p",{children:"This strategy may be in use by one or more scheduled change requests. If you remove it, those change requests can no longer be applied."})}):null,Os=({scheduledChangeRequestsForStrategy:e})=>t.jsxs(mr,{children:[t.jsx(xr,{}),t.jsx(yr,{projectId:e.projectId,changeRequests:e.changeRequests})]}),jr=({onRemove:e,onClose:s,isOpen:n,scheduledChangeRequestsForStrategy:r})=>t.jsx(oe,{title:"Are you sure you want to delete this strategy?",open:n,primaryButtonText:"Remove strategy",secondaryButtonText:"Cancel",onClick:e,onClose:s,children:t.jsx(Os,{scheduledChangeRequestsForStrategy:r})}),Sr=p("div")(({theme:e})=>({marginTop:e.spacing(3),marginBottom:e.spacing(1)})),br=({onRemove:e,onClose:s,isOpen:n,scheduledChangeRequestsForStrategy:r})=>t.jsxs(oe,{title:"Suggest changes",open:n,primaryButtonText:"Add suggestion to draft",secondaryButtonText:"Cancel",onClick:e,onClose:s,children:[t.jsx(Os,{scheduledChangeRequestsForStrategy:r}),t.jsx(Sr,{children:t.jsx(W,{variant:"body2",color:"text.secondary",children:"Your suggestion:"})}),t.jsx(W,{fontWeight:"bold",children:"Remove strategy"})]}),vr=({projectId:e,featureId:s,environmentId:n,strategyId:r})=>{const{deleteStrategyFromFeature:a}=he(),{setToastData:o,setToastApiError:i}=U(),c=ce(),{refetchFeature:l}=M(e,s);return async u=>{try{u.preventDefault(),await a(e,s,n,r),o({title:"Strategy deleted",type:"success"}),l(),c(We(e,s))}catch(h){i(N(h))}}},Cr=({projectId:e,featureId:s,environmentId:n,strategyId:r})=>{const{addChange:a}=ne(),{refetch:o}=te(e),{setToastData:i,setToastApiError:c}=U();return async d=>{try{d.preventDefault(),await a(e,n,{action:"deleteStrategy",feature:s,payload:{id:r}}),i({title:"Changes added to the draft!",type:"success"}),await o()}catch(u){c(N(u))}}},wr=({projectId:e,featureId:s,environmentId:n,strategyId:r,isOpen:a,onClose:o})=>{const{isChangeRequestConfigured:i}=Z(e),{changeRequests:c}=is(e,r),l={changeRequests:c,projectId:e},d=vr({featureId:s,projectId:e,strategyId:r,environmentId:n}),u=Cr({featureId:s,projectId:e,strategyId:r,environmentId:n});return i(n)?t.jsx(br,{isOpen:a,onClose:()=>o(),onRemove:async h=>{await u(h),o()},scheduledChangeRequestsForStrategy:l}):t.jsx(jr,{isOpen:a,onClose:()=>o(),onRemove:d,scheduledChangeRequestsForStrategy:l})},Tr=({projectId:e,environmentId:s,featureId:n,strategy:r})=>{const{refetchFeature:a}=M(e,n),{setStrategyDisabledState:o}=he(),{setToastData:i,setToastApiError:c}=U(),l=d=>async()=>{try{await o(e,n,s,r.id,!d),i({title:`Strategy ${d?"enabled":"disabled"}`,type:"success"}),a()}catch(u){c(N(u))}};return{onDisable:l(!1),onEnable:l(!0)}},Er=({projectId:e,environmentId:s,featureId:n,strategy:r})=>{const{addChange:a}=ne(),{refetch:o}=te(e),{setToastData:i,setToastApiError:c}=U(),l=d=>async()=>{try{await a(e,s,{action:"updateStrategy",feature:n,payload:{...r,disabled:!d}}),i({title:"Changes added to the draft!",type:"success"}),await o()}catch(u){c(N(u))}};return{onSuggestDisable:l(!1),onSuggestEnable:l(!0)}},Ar=({isOpen:e,onClose:s,...n})=>{var j;const{projectId:r,environmentId:a}=n,{isChangeRequestConfigured:o}=Z(r),i=o(a),{onSuggestEnable:c,onSuggestDisable:l}=Er({...n}),{onEnable:d,onDisable:u}=Tr({...n}),h=!!((j=n.strategy)!=null&&j.disabled),m=y=>{y.preventDefault(),i?h?c():l():h?d():u(),s()};return t.jsx(oe,{title:i?`Add ${h?"enable":"disable"} strategy to change request?`:`Are you sure you want to ${h?"enable":"disable"} this strategy?`,open:e,primaryButtonText:i?"Add to draft":`${h?"Enable":"Disable"} strategy`,secondaryButtonText:"Cancel",onClick:m,onClose:()=>s(),children:t.jsx(b,{condition:i,show:t.jsx(rn,{environment:a}),elseShow:t.jsxs(ie,{severity:"error",children:[h?"Enabling":"Disabling"," the strategy will change which users receive access to the feature."]})})})};var At={},Dr=cn;Object.defineProperty(At,"__esModule",{value:!0});var Bs=At.default=void 0,Fr=Dr(on()),Rr=t,$r=(0,Fr.default)((0,Rr.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");Bs=At.default=$r;const kr=({projectId:e,strategy:s,featureId:n,environmentId:r})=>{const[a,o]=g.useState(null),[i,c]=g.useState(!1),[l,d]=g.useState(!1),u=!!a,h=T=>{o(T.currentTarget)},m=T=>{o(null),T.stopPropagation()},j=lt(ln,e,r),y=lt(dn,e,r);return t.jsxs(t.Fragment,{children:[t.jsx(K,{sx:{display:"flex",alignItems:"center",textAlign:"center"},children:t.jsx(ee,{title:"More actions",children:t.jsx($e,{onClick:h,size:"small","aria-controls":u?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":u?"true":void 0,"data-testid":un,children:t.jsx(pn,{sx:{width:32,height:32}})})})}),t.jsxs(ke,{anchorEl:a,id:"actions-menu",open:u,onClose:m,onClick:m,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},"data-testid":gn,children:[t.jsx(ee,{title:s.disabled?"Enable strategy":"Disable strategy",arrow:!0,placement:"left",children:t.jsxs(ue,{disabled:!j,onClick:()=>c(!0),children:[t.jsx(Te,{children:s.disabled?t.jsx(hn,{}):t.jsx(fn,{})}),t.jsx(me,{children:s.disabled?"Enable":"Disable"})]})}),t.jsx(ee,{title:"Remove strategy",arrow:!0,placement:"left",children:t.jsxs(ue,{disabled:!y,onClick:()=>d(!0),"data-testid":xn,children:[t.jsx(Te,{children:t.jsx(Bs,{})}),t.jsx(me,{children:"Remove"})]})})]}),t.jsx(Ar,{isOpen:i,onClose:()=>c(!1),projectId:e,featureId:n,environmentId:r,strategy:s}),t.jsx(wr,{isOpen:l,onClose:()=>d(!1),projectId:e,featureId:n,environmentId:r,strategyId:s.id})]})},Ir=({environmentId:e,strategy:s,onDragStart:n,onDragEnd:r,otherEnvironments:a,orderNumber:o,headerChildren:i})=>{const c=A("projectId"),l=A("featureId"),d=mn(c,l,e,s.id);return t.jsxs(Qa,{strategy:s,onDragStart:n,onDragEnd:r,orderNumber:o,actions:t.jsxs(t.Fragment,{children:[i,t.jsx(b,{condition:!!(a&&(a==null?void 0:a.length)>0),show:()=>t.jsx(fr,{environmentId:e,environments:a,strategy:s})}),t.jsx(re,{permission:cs,environmentId:e,projectId:c,component:Q,to:d,tooltipProps:{title:"Edit strategy"},"data-testid":`STRATEGY_EDIT-${s.name}`,children:t.jsx(we,{})}),t.jsx(kr,{projectId:c,featureId:l,environmentId:e,strategy:s})]}),children:[t.jsx(yn,{strategy:s}),s.variants&&s.variants.length>0&&(s.disabled?t.jsx(K,{sx:{opacity:"0.5"},children:t.jsx(Ft,{variants:s.variants})}):t.jsx(Ft,{variants:s.variants}))]})},Pr=e=>fetch(e).then(ye("ChangeRequest")).then(s=>s.json()),Ls=(e,s)=>{const{data:n,error:r,mutate:a}=ls([],ge(`api/admin/projects/${e}/change-requests/pending/${s}`),Pr);return{changeRequests:n,loading:!r&&!n,refetch:a,error:r}},Or=(e,s,n,r)=>{const{user:a}=jn(),{changeRequests:o}=Ls(e,s),i=[],c=o==null?void 0:o.filter(l=>l.environment===n);return c==null||c.forEach(l=>{const d=l==null?void 0:l.features.find(h=>h.name===s),u=d==null?void 0:d.changes.find(h=>h.action==="updateStrategy"||h.action==="deleteStrategy"?h.payload.id===r:!1);if(u){const h=l.state==="Scheduled",m=!h&&l.createdBy.id===(a==null?void 0:a.id);h&&i.push({changeRequestId:l.id,change:u,isScheduledChange:h}),m&&i.push({changeRequestId:l.id,change:u,isScheduledChange:h})}}),i},Me=p("div")({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}),qe=p("div")(({theme:e})=>({justifyContent:"center",paddingTop:e.spacing(.75),...Sn})),ze=p("span")(({theme:e})=>({color:e.palette.text.secondary,marginRight:e.spacing(1)})),Dt=p(Q)(({theme:e})=>({maxWidth:"100%",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),_s=({scheduledChangeRequestIds:e})=>{const s=ht(),n=Ie(s.breakpoints.down("sm")),r=A("projectId");return n?null:t.jsx(K,{sx:{mr:1.5},children:t.jsx(ft,{tooltip:t.jsx(t.Fragment,{children:e==null?void 0:e.map((a,o)=>t.jsxs(Dt,{to:`/projects/${r}/change-requests/${a}`,children:["Change request #",a]},`${r}-${o}`))}),children:t.jsx(Ee,{color:"warning",children:"Changes Scheduled"})})})},Br=({strategy:e,index:s,environmentName:n,otherEnvironments:r,isDragging:a,onDragStartRef:o,onDragOver:i,onDragEnd:c})=>{const l=A("projectId"),d=A("featureId"),u=g.useRef(null),h=Or(l,d,n,e.id),{changeRequests:m}=is(l,e.id);return t.jsxs(K,{ref:u,onDragOver:i(u,s),sx:{opacity:a?"0.5":"1"},children:[t.jsx(b,{condition:s>0,show:t.jsx(bn,{text:"OR"})}),t.jsx(Ir,{strategy:e,environmentId:n,otherEnvironments:r,onDragStart:o(u,s),onDragEnd:c,orderNumber:s+1,headerChildren:_r(h,m)})]},e.id)},Lr=({change:e})=>{const s=ht();return Ie(s.breakpoints.down("sm"))?null:t.jsxs(K,{sx:{mr:1.5},children:[t.jsx(b,{condition:(e==null?void 0:e.action)==="updateStrategy",show:t.jsx(Ee,{color:"warning",children:"Modified in draft"})}),t.jsx(b,{condition:(e==null?void 0:e.action)==="deleteStrategy",show:t.jsx(Ee,{color:"error",children:"Deleted in draft"})})]})},_r=(e,s)=>{const n=[];if((e==null?void 0:e.length)===0&&(s==null?void 0:s.length)===0)return[];const r=e==null?void 0:e.find(({isScheduledChange:a})=>!a);return r&&n.push(t.jsx(Lr,{change:r.change},`draft-change#${r.change.id}`)),s&&s.length>0&&n.push(t.jsx(_s,{scheduledChangeRequestIds:s.map(a=>a.id)},"scheduled-changes")),n},Mr=({environmentId:e,environments:s,onClick:n})=>{const r=A("projectId"),[a,o]=g.useState(null),i=!!a,{hasAccess:c}=g.useContext(xt),l=s.some(d=>c(de,r,d));return t.jsxs("div",{children:[t.jsx(ee,{title:l?"":"(Access denied)",children:t.jsx("div",{children:t.jsx(je,{id:`copy-all-strategies-${e}`,"aria-controls":i?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":i?"true":void 0,onClick:d=>{o(d.currentTarget)},disabled:!l,variant:"outlined",children:"Copy from another environment"})})}),t.jsx(ke,{id:"basic-menu",anchorEl:a,open:i,onClose:()=>{o(null)},MenuListProps:{"aria-labelledby":`copy-all-strategies-${e}`},children:s.map(d=>{const u=c(de,r,d);return t.jsx(ee,{title:u?"":"You don't have access to add a strategy to this environment",children:t.jsx("div",{children:t.jsxs(ue,{onClick:()=>n(d),disabled:!u,children:[t.jsx(b,{condition:!u,show:t.jsx(Te,{children:t.jsx(os,{fontSize:"small"})})}),t.jsxs(me,{children:["Copy from ",d]})]})})},d)})})]})},qr=p("div")(({theme:e})=>({"&>*:nth-child(n)":{margin:e.spacing(1,0)}})),zr=({payload:e,fromEnvironment:s,environment:n})=>t.jsxs(qr,{children:[t.jsx(W,{children:t.jsx("strong",{children:"Copy: "})}),e==null?void 0:e.map(r=>t.jsxs(W,{children:[t.jsxs("strong",{children:[Fe((r==null?void 0:r.name)||"")," strategy"," "]})," "]})),t.jsxs(W,{children:["from ",s," to ",n]})]}),Ms=(e,s)=>{const n={};return s.parameters.forEach(r=>{n[r.name]=Vr(e,r)}),{name:s.name,constraints:[],parameters:n}},Vr=(e,s)=>s.name==="rollout"||s.name==="percentage"||s.type==="percentage"?"50":s.name==="stickiness"?"":s.name==="groupId"?e:s.type==="boolean"?"false":"",Nr=()=>{const e=A("projectId"),s=A("featureId"),n=Ae("environmentId"),r=Ae("strategyName"),{strategy:a,defaultStrategyFallback:o}=ks(e,n),i=JSON.parse(ds().get("defaultStrategy")||"false"),{segments:c}=mt(),l=(c||[]).filter(P=>{var H;return(H=a==null?void 0:a.segments)==null?void 0:H.includes(P.id)}),[d,u]=g.useState({}),[h,m]=g.useState(i?l:[]),{strategyDefinition:j}=yt(r),y=jt(),{addStrategyToFeature:T,loading:f}=he(),{addChange:x}=ne(),{setToastData:R,setToastApiError:L}=U(),{uiConfig:q}=fe(),{unleashUrl:z}=q,v=ce(),{feature:C,refetchFeature:$}=M(e,s),O=g.useRef(C),{isChangeRequestConfigured:V}=Z(e),{refetch:G}=te(e),{trackEvent:Y}=ae(),{data:S,staleDataNotification:k,forceRefreshCache:w}=St({unleashGetter:M,params:[e,s],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},C,{afterSubmitAction:$},bt);g.useEffect(()=>{O.current.name===""&&C.name&&(w(C),O.current=C)},[C.name]),g.useEffect(()=>{var P;if(i){const H=a||o;((P=H.parameters)==null?void 0:P.groupId)===""&&s?u({...H,parameters:{...H.parameters,groupId:s}}):u(H)}else j&&u(Ms(s,j))},[s,JSON.stringify(j),i]);const E=async P=>{await T(e,s,n,P),R({title:"Strategy created",type:"success",confetti:!0})},F=async P=>{await x(e,n,{action:"addStrategy",feature:s,payload:P}),R({title:"Strategy added to draft",type:"success",confetti:!0}),G()},B=us(d,h),I=async()=>{Y("strategyTitle",{props:{hasTitle:!!d.title,on:"create"}});try{V(n)?await F(B):await E(B),$(),v(We(e,s))}catch(P){L(N(P))}};return!S||!S.project?null:t.jsxs(Ue,{modal:!0,title:Fe(r),description:ps,documentationLink:gs,documentationLinkLabel:hs,formatApiCode:()=>Hr(e,s,n,B,z),children:[t.jsx(vn,{projectId:e,feature:S,strategy:d,setStrategy:u,segments:h,setSegments:m,environmentId:n,onSubmit:I,loading:f,permission:de,errors:y,isChangeRequest:V(n)}),k]})},qs=(e,s,n,r,a=!1)=>{const o=new URLSearchParams({environmentId:n,strategyName:r,defaultStrategy:String(a)});return`/projects/${e}/features/${s}/strategies/create?${o}`},Hr=(e,s,n,r,a)=>{if(!a)return"";const o=`${a}/api/admin/projects/${e}/features/${s}/environments/${n}/strategies`,i=JSON.stringify(r,void 0,2);return`curl --location --request POST '${o}' \\
|
|
2
|
-
--header 'Authorization: INSERT_API_KEY' \\
|
|
3
|
-
--header 'Content-Type: application/json' \\
|
|
4
|
-
--data-raw '${i}'`},Wr=p("div")(({theme:e})=>({width:e.spacing(4),height:"auto","& > svg":{fill:e.palette.primary.main},"& > div":{height:e.spacing(2),marginLeft:"-.75rem",color:e.palette.primary.main}})),Ur=p("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody})),Yr=p(vt)(({theme:e})=>({fontWeight:e.fontWeight.bold})),Gr=p(Q)(({theme:e})=>({display:"grid",gridTemplateColumns:"3rem 1fr",width:"20rem",padding:e.spacing(2),color:"inherit",textDecoration:"inherit",lineHeight:1.25,borderWidth:"1px",borderStyle:"solid",borderColor:e.palette.divider,borderRadius:e.spacing(1),"&:hover, &:focus":{borderColor:e.palette.primary.main}})),Ze=({projectId:e,featureId:s,environmentId:n,strategy:r,defaultStrategy:a})=>{const o=fs(r.name),i=Fe(r.name),{trackEvent:c}=ae(),l=qs(e,s,n,r.name,a),d=()=>{c("strategy-add",{props:{buttonTitle:r.displayName||i}})};return t.jsxs(Gr,{to:l,onClick:d,children:[t.jsx(Wr,{children:t.jsx(o,{})}),t.jsxs("div",{children:[t.jsx(Yr,{text:r.displayName||i,maxWidth:"200",maxLength:25}),t.jsx(Ur,{children:r.description})]})]})},Xe=p(W)(({theme:e})=>({fontSize:e.fontSizes.smallBody,padding:e.spacing(1,2)})),Kr=({projectId:e,featureId:s,environmentId:n})=>{const{strategies:r}=Cn(),a=r.filter(c=>!c.deprecated&&!c.editable),o=r.filter(c=>!c.deprecated&&c.editable),i={name:"flexibleRollout",displayName:"Default strategy",description:"This is the default strategy defined for this environment in the project"};return t.jsxs(Ct,{dense:!0,children:[t.jsxs(t.Fragment,{children:[t.jsxs(Xe,{color:"textSecondary",children:[n," environment default strategy"]}),t.jsx(ve,{children:t.jsx(Ze,{projectId:e,featureId:s,environmentId:n,strategy:i,defaultStrategy:!0})},i.name)]}),t.jsx(Xe,{color:"textSecondary",children:"Predefined strategy types"}),a.map(c=>t.jsx(ve,{children:t.jsx(Ze,{projectId:e,featureId:s,environmentId:n,strategy:c})},c.name)),t.jsx(b,{condition:o.length>0,show:t.jsxs(t.Fragment,{children:[t.jsx(Xe,{color:"textSecondary",children:"Custom strategies"}),o.map(c=>t.jsx(ve,{children:t.jsx(Ze,{projectId:e,featureId:s,environmentId:n,strategy:c})},c.name))]})})]})},Jr=p("div")({flexShrink:0}),Qr=p(pe)(({theme:e})=>({minWidth:0,width:e.spacing(4.5),alignItems:"center",justifyContent:"center",align:"center",flexDirection:"column",marginLeft:e.spacing(1)})),ut=({label:e,projectId:s,featureId:n,environmentId:r,variant:a,size:o,matchWidth:i})=>{const[c,l]=g.useState(),d=ce(),{trackEvent:u}=ae(),h=!!c,m=h?"FeatureStrategyMenuPopover":void 0,j=()=>{l(void 0)},y=x=>{u("strategy-add",{props:{buttonTitle:e}}),d(f)},T=x=>{l(x.currentTarget)},f=qs(s,n,r,"flexibleRollout",!0);return t.jsxs(Jr,{onClick:x=>x.stopPropagation(),children:[t.jsx(pe,{permission:de,projectId:s,environmentId:r,onClick:y,"aria-labelledby":m,variant:a,size:o,sx:{minWidth:i?"282px":"auto"},children:e}),t.jsx(Qr,{permission:de,projectId:s,environmentId:r,onClick:T,"aria-labelledby":m,variant:"outlined",size:o,hideLockIcon:!0,tooltipProps:{title:"More strategies"},children:t.jsx(xs,{sx:x=>({margin:x.spacing(.25,0)})})}),t.jsx(ms,{id:m,open:h,anchorEl:c,onClose:j,onClick:j,PaperProps:{sx:x=>({paddingBottom:x.spacing(1)})},children:t.jsx(Kr,{projectId:s,featureId:n,environmentId:r})})]})},Zr=p("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",paddingTop:e.spacing(2)})),Xr=p("div")(({theme:e})=>({fontSize:e.fontSizes.bodySize,textAlign:"center",color:e.palette.text.primary,marginBottom:e.spacing(1)})),eo=p("p")(({theme:e})=>({color:e.palette.text.secondary,fontSize:e.fontSizes.smallBody,textAlign:"center",marginBottom:e.spacing(3),a:{color:e.palette.links}})),to=({projectId:e,featureId:s,environmentId:n})=>{const{addStrategyToFeature:r}=he(),{setToastData:a,setToastApiError:o}=U(),{refetchFeature:i}=M(e,s),{refetchFeature:c}=Is(e,s),{feature:l}=M(e,s),d=l==null?void 0:l.environments.filter(R=>R.name!==n&&R.strategies&&R.strategies.length>0),{isChangeRequestConfigured:u}=Z(e),{changeRequestDialogDetails:h,onChangeRequestAddStrategies:m,onChangeRequestAddStrategiesConfirm:j,onChangeRequestAddStrategyClose:y}=Ps(e,s,"addStrategy"),T=(R=!1)=>{i(),c(),a({title:R?"Strategies created":"Strategy created",text:R?"Successfully copied from another environment":"Successfully created strategy",type:"success"})},f=async R=>{var q;const L=((q=d==null?void 0:d.find(z=>z.name===R))==null?void 0:q.strategies)||[];if(u(n)){await m(n,L,R);return}try{await Promise.all(L.map(z=>{const{id:v,...C}={...z,environment:n};return r(e,s,n,C)})),T(!0)}catch(z){o(N(z))}},x=d&&d.length>0;return t.jsxs(t.Fragment,{children:[t.jsx($s,{isOpen:h.isOpen,onClose:y,environment:h==null?void 0:h.environment,onConfirm:j,messageComponent:t.jsx(zr,{fromEnvironment:h.fromEnvironment,payload:h.strategies})}),t.jsxs(Zr,{children:[t.jsx(Xr,{children:"You have not defined any strategies yet."}),t.jsxs(eo,{children:["Strategies added in this environment will only be executed if the SDK is using an"," ",t.jsx(Q,{to:"/admin/api",children:"API key configured"})," for this environment."]}),t.jsxs(K,{sx:{w:"100%",display:"flex",flexWrap:"wrap",gap:2,alignItems:"center",justifyContent:"center"},children:[t.jsx(ut,{label:"Add your first strategy",projectId:e,featureId:s,environmentId:n,matchWidth:x}),t.jsx(b,{condition:x,show:t.jsx(Mr,{environmentId:n,environments:d.map(R=>R.name),onClick:f})})]})]})]})},so=p("div")(({theme:e})=>({width:"100%",position:"relative",paddingBottom:e.spacing(2)})),no=p("div")(({theme:e})=>({[e.breakpoints.down(400)]:{padding:e.spacing(1)}})),ao=({featureEnvironment:e,isDisabled:s,otherEnvironments:n})=>{const r=A("projectId"),a=A("featureId"),{setStrategiesSortOrder:o}=he(),{addChange:i}=ne(),{isChangeRequestConfigured:c}=Z(r),{refetch:l}=te(r),{setToastData:d,setToastApiError:u}=U(),{refetchFeature:h}=M(r,a),[m,j]=g.useState((e==null?void 0:e.strategies)||[]),[y,T]=g.useState(null);if(g.useEffect(()=>{j((e==null?void 0:e.strategies)||[])},[e==null?void 0:e.strategies]),!e)return null;const f=async v=>{try{await o(r,a,e.name,v),h(),d({title:"Order of strategies updated",type:"success"})}catch(C){u(N(C))}},x=async v=>{await i(r,e.name,{action:"reorderStrategy",feature:a,payload:v}),d({title:"Strategy execution order added to draft",type:"success",confetti:!0}),l()},R=async v=>{try{c(e.name)?await x(v):await f(v)}catch(C){u(N(C))}},L=(v,C)=>$=>{var O;T({id:m[C].id,index:C,height:((O=v.current)==null?void 0:O.offsetHeight)||0}),v!=null&&v.current&&($.dataTransfer.effectAllowed="move",$.dataTransfer.setData("text/html",v.current.outerHTML),$.dataTransfer.setDragImage(v.current,20,20))},q=v=>(C,$)=>O=>{if(y===null||C.current===null||y.index===$||v===y.id)return;const{top:V,bottom:G}=C.current.getBoundingClientRect(),Y=O.clientY-V<y.height,S=G-O.clientY<y.height,k=y.index>$;if(Y&&k||S&&!k){const w=[...m],E=w.splice(y.index,1)[0];w.splice($,0,E),j(w),T({...y,index:$})}},z=()=>{T(null),R(m.map((v,C)=>({id:v.id,sortOrder:C})))};return t.jsx(so,{children:t.jsxs(no,{children:[t.jsx(b,{condition:m.length>0&&s,show:()=>t.jsx(ie,{severity:"warning",sx:{mb:2},children:"This environment is disabled, which means that none of your strategies are executing."})}),t.jsx(b,{condition:m.length>0,show:t.jsx(t.Fragment,{children:m.map((v,C)=>t.jsx(Br,{strategy:v,index:C,environmentName:e.name,otherEnvironments:n,isDragging:(y==null?void 0:y.id)===v.id,onDragStartRef:L,onDragOver:q(v.id),onDragEnd:z},v.id))}),elseShow:t.jsx(to,{projectId:r,featureId:a,environmentId:e.name})})]})})},zs=(e,s)=>e===0?0:Math.round(s/e*100);var Ge={},Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.defaultOptions=void 0;Ke.defaultOptions={lowercase:!1,precision:1,space:!1,units:["","K","M","B","T","P","E"]};var se={};Object.defineProperty(se,"__esModule",{value:!0});se.getLocales=se.getFractionDigits=se.roundTo=se.parseValue=void 0;function ro(e){const s=parseFloat(e==null?void 0:e.toString());if(isNaN(s))throw new Error("Input value is not a number");if(s>Number.MAX_SAFE_INTEGER||s<Number.MIN_SAFE_INTEGER)throw new RangeError("Input value is outside of safe integer range");return s}se.parseValue=ro;function oo(e,s){if(!Number.isFinite(e))throw new Error("Input value is not a finite number");if(!Number.isInteger(s)||s<0)throw new Error("Precision is not a positive integer");return Number.isInteger(e)?e:parseFloat(e.toFixed(s))}se.roundTo=oo;function io(e){var s;if(Number.isInteger(e))return 0;const n=e.toString().split(".")[1];return(s=n==null?void 0:n.length)!==null&&s!==void 0?s:0}se.getFractionDigits=io;function co(){var e;return typeof navigator>"u"?[]:Array.from((e=navigator.languages)!==null&&e!==void 0?e:[])}se.getLocales=co;Object.defineProperty(Ge,"__esModule",{value:!0});Ge.millify=void 0;const qt=Ke,Oe=se,zt=1e3;function*Vt(e){let s=zt;for(;;){const n=e/s;if(n<1)return;yield n,s*=zt}}function Vs(e,s){var n,r;const a=s?{...qt.defaultOptions,...s}:qt.defaultOptions;if(!Array.isArray(a.units)||!a.units.length)throw new Error("Option `units` must be a non-empty array");let o;try{o=Oe.parseValue(e)}catch(y){return y instanceof Error&&console.warn(`WARN: ${y.message} (millify)`),String(e)}const i=o<0?"-":"";o=Math.abs(o);let c=0;for(const y of Vt(o))o=y,c+=1;if(c>=a.units.length)return e.toString();let d=Oe.roundTo(o,a.precision);for(const y of Vt(d))d=y,c+=1;const u=(n=a.units[c])!==null&&n!==void 0?n:"",h=a.lowercase?u.toLowerCase():u,m=a.space?" ":"",j=d.toLocaleString((r=a.locales)!==null&&r!==void 0?r:Oe.getLocales(),{minimumFractionDigits:Oe.getFractionDigits(d)});return`${i}${j}${m}${h}`}Ge.millify=Vs;var lo=Ge.default=Vs;const Ve=({value:e,threshold:s=1e6,precision:n=2})=>{let r,a=!1;e<s?r=e.toLocaleString():(r=lo(e,{precision:n}),a=!0);const o=t.jsx("span",{"data-testid":wn,children:r});return t.jsx(b,{condition:a,show:t.jsx(ee,{title:e.toLocaleString(),arrow:!0,children:o}),elseShow:o})},uo=e=>e>48?`${Math.floor(e/24)} days (UTC)`:`${e} hours (local time)`,et=p("article")(({theme:e})=>({padding:e.spacing(2),background:"transparent",borderRadius:e.spacing(2),textAlign:"center",[e.breakpoints.up("md")]:{padding:e.spacing(4)}})),tt=p("h3")(({theme:e})=>({margin:0,fontSize:e.fontSizes.bodySize,fontWeight:e.fontWeight.thin})),st=p("p")(({theme:e})=>({fontSize:"2.25rem",fontWeight:e.fontWeight.bold,color:e.palette.primary.main})),nt=p("p")(({theme:e})=>({margin:e.spacing(1,0,0,0),padding:e.spacing(2,0,0,0),borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:e.palette.divider,fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),Ns=({totalYes:e,totalNo:s,hoursBack:n,statsSectionId:r,tableSectionId:a})=>{const o=n===1?"in the last hour":`in the last ${uo(n)}`;return t.jsxs(le,{container:!0,spacing:2,id:r,"aria-describedby":a,"aria-label":"Feature metrics summary",component:"section",children:[t.jsx(le,{item:!0,xs:12,sm:4,children:t.jsxs(et,{children:[t.jsx(tt,{children:"Exposure"}),t.jsx(st,{children:t.jsx(Ve,{value:e})}),t.jsxs(nt,{children:["Total exposure of the feature in the environment"," ",o,"."]})]})}),t.jsx(le,{item:!0,xs:12,sm:4,children:t.jsxs(et,{children:[t.jsx(tt,{children:"Exposure %"}),t.jsxs(st,{children:[zs(e+s,e),"%"]}),t.jsxs(nt,{children:["% total exposure of the feature in the environment"," ",o,"."]})]})}),t.jsx(le,{item:!0,xs:12,sm:4,children:t.jsxs(et,{children:[t.jsx(tt,{children:"Requests"}),t.jsx(st,{children:t.jsx(Ve,{value:e+s})}),t.jsxs(nt,{children:["Total requests for the feature in the environment"," ",o,"."]})]})})]})},po=p("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",margin:"1rem 0",position:"relative","&:before":{content:'""',position:"absolute",top:"50%",transform:"translateY(-50%)",height:2,width:"100%",backgroundColor:e.palette.divider}})),go=p("span")(({theme:e})=>({fontSize:e.fontSizes.bodySize,textAlign:"center",padding:"0 1rem",background:e.palette.envAccordion.expanded,position:"relative",maxWidth:"80%",color:e.palette.text.primary})),ho=({children:e})=>t.jsx(po,{children:t.jsx(go,{children:e})}),fo=({environmentMetric:e})=>e?t.jsxs(t.Fragment,{children:[t.jsx(ho,{children:"Feature toggle exposure"}),t.jsx("div",{children:t.jsx(Ns,{totalYes:e.yes,totalNo:e.no,hoursBack:1})})]}):null,Nt=p("div")({marginLeft:"auto",display:"flex",alignItems:"center"}),Ht=p("div")(({theme:e})=>({marginRight:e.spacing(1),display:"flex",flexDirection:"column"})),Wt=p("p")(({theme:e})=>({color:e.palette.primary.main,textAlign:"right",fontSize:e.fontSizes.bodySize})),Ut=p("p")(({theme:e})=>({maxWidth:"270px",marginTop:e.spacing(.5),fontSize:e.fontSizes.smallBody,textAlign:"right",[e.breakpoints.down(700)]:{display:"none"}})),xo=p(Tn)(({theme:e})=>({fill:e.palette.background.elevation2,height:"75px",width:"75px",[e.breakpoints.down(500)]:{display:"none"}})),mo=p("div")(({theme:e})=>({margin:e.spacing(0,2),[e.breakpoints.down(500)]:{display:"none"}})),yo=({environmentMetric:e,disabled:s=!1})=>{const n=En();if(!e)return null;const r=e.yes+e.no,a=zs(r,e==null?void 0:e.yes);return!e||e.yes===0&&e.no===0?t.jsxs(Nt,{children:[t.jsxs(Ht,{children:[t.jsxs(Wt,{style:{color:s?n.palette.text.secondary:void 0},"data-loading":!0,children:[a,"%"]}),t.jsxs(Ut,{style:{color:s?n.palette.text.secondary:n.palette.text.primary},"data-loading":!0,children:["The feature has been requested ",t.jsx("b",{children:"0 times"})," and exposed",t.jsx("b",{children:" 0 times"})," in the last hour"]})]}),t.jsx(xo,{style:{transform:"scale(1.1)"},"data-loading":!0})]}):t.jsxs(Nt,{children:[t.jsxs(Ht,{children:[t.jsxs(Wt,{children:[a,"%"]}),t.jsxs(Ut,{children:["The feature has been requested"," ",t.jsxs("b",{children:[t.jsx(Ve,{value:r})," times"]})," ","and exposed"," ",t.jsxs("b",{children:[t.jsx(Ve,{value:e.yes})," ","times"]})," ","in the last hour"]})]}),t.jsx(mo,{"data-loading":!0,children:t.jsx(An,{percentage:a,size:"3rem"})})]})},at=({strategy:e})=>{const s=fs(e.name);return t.jsx(ee,{title:Fe(e.name)+(e.title?` - ${e.title}`:""),arrow:!0,children:t.jsx(jo,{children:t.jsx(s,{})})})},jo=p("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.palette.action.disabled,"& svg":{width:e.spacing(2.5),height:e.spacing(2.5)}})),Yt=p("ul")(()=>({all:"unset",display:"flex",alignItems:"center",alignContent:"center"})),rt=p("li")(()=>({all:"unset",minWidth:30,textAlign:"center"})),So=p("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(1)})),Be=5,bo=({strategies:e})=>e!=null&&e.length?e.length>Be+1?t.jsxs(Yt,{"aria-label":"Feature strategies",children:[e.slice(0,Be).map(s=>t.jsx(rt,{children:t.jsx(at,{strategy:s})},s.id)),t.jsxs(ft,{tooltip:e.slice(Be).map(s=>t.jsx(rt,{children:t.jsxs(So,{children:[t.jsx(at,{strategy:s})," ",Fe(s.name)+(s.title?` - ${s.title}`:"")]})},s.id)),children:["(+",e.length-Be,")"]})]}):t.jsx(Yt,{"aria-label":"Feature strategies",children:e.map(s=>t.jsx(rt,{children:t.jsx(at,{strategy:s})},s.id))}):null,Hs=()=>{const{value:e,setValue:s}=Dn("global:v1",{});return{value:{...e,hiddenEnvironments:Array.from(e.hiddenEnvironments||[])},setValue:s}},vo=p("div",{shouldForwardProp:e=>e!=="enabled"})(({theme:e,enabled:s})=>({borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2),backgroundColor:s?e.palette.background.paper:e.palette.envAccordion.disabled})),Co=p(Fn)({boxShadow:"none",background:"none"}),wo=p(Rn)(({theme:e})=>({boxShadow:"none",padding:e.spacing(2,4),[e.breakpoints.down(400)]:{padding:e.spacing(1,2)}})),To=p($n,{shouldForwardProp:e=>e!=="enabled"})(({theme:e})=>({padding:e.spacing(3),background:e.palette.envAccordion.expanded,borderBottomLeftRadius:e.shape.borderRadiusLarge,borderBottomRightRadius:e.shape.borderRadiusLarge,boxShadow:"inset 0px 2px 4px rgba(32, 32, 33, 0.05)",[e.breakpoints.down("md")]:{padding:e.spacing(2,1)}})),Eo=p(ao)(({theme:e})=>({width:"100%",position:"relative",paddingBottom:e.spacing(2)})),Ao=p("div",{shouldForwardProp:e=>e!=="enabled"})(({theme:e,enabled:s})=>({display:"flex",justifyContent:"center",flexDirection:"column",color:s?e.palette.text.primary:e.palette.text.secondary})),Do=p("div")(({theme:e})=>({display:"flex",alignItems:"center",[e.breakpoints.down(560)]:{flexDirection:"column",textAlign:"center"}})),Fo=p(kn)(({theme:e})=>({[e.breakpoints.down(560)]:{marginBottom:"0.5rem"}})),Ro=p(vt)(({theme:e})=>({fontSize:e.fontSizes.bodySize,fontWeight:e.typography.fontWeightMedium,[e.breakpoints.down(560)]:{textAlign:"center"}})),$o=p("div")(({theme:e})=>({display:"flex",alignItems:"center",marginTop:e.spacing(2),gap:e.spacing(2),flexWrap:"wrap",[e.breakpoints.down(560)]:{flexDirection:"column"}})),ko=({env:e})=>{var d;const s=A("projectId"),n=A("featureId"),{metrics:r}=lr(s,n),{feature:a}=M(s,n),{value:o}=Hs(),c=ur(a==null?void 0:a.environments,r).find(u=>u.environment===e.name),l=a==null?void 0:a.environments.find(u=>u.name===e.name);return t.jsx(b,{condition:!new Set(o.hiddenEnvironments).has(e.name),show:t.jsx(vo,{enabled:e.enabled,children:t.jsxs(Co,{TransitionProps:{mountOnEnter:!0},"data-testid":`${In}_${e.name}`,className:`environment-accordion ${e.enabled?"":"accordion-disabled"}`,children:[t.jsxs(wo,{expandIcon:t.jsx(Pn,{titleAccess:"Toggle"}),children:[t.jsxs(Ao,{"data-loading":!0,enabled:e.enabled,children:[t.jsxs(Do,{children:[t.jsx(Fo,{enabled:e.enabled}),t.jsx("div",{children:t.jsx(Ro,{text:e.name,maxWidth:"100",maxLength:15})}),t.jsx(b,{condition:!e.enabled,show:t.jsx(Ee,{color:"neutral",sx:{ml:1},children:"Disabled"})})]}),t.jsxs($o,{children:[t.jsx(ut,{label:"Add strategy",projectId:s,featureId:n,environmentId:e.name,variant:"outlined",size:"small"}),t.jsx(bo,{strategies:l==null?void 0:l.strategies})]})]}),t.jsx(yo,{environmentMetric:c,disabled:!e.enabled})]}),t.jsxs(To,{enabled:e.enabled,children:[t.jsx(Eo,{featureEnvironment:l,isDisabled:!e.enabled,otherEnvironments:a==null?void 0:a.environments.map(({name:u})=>u).filter(u=>u!==e.name)}),t.jsx(b,{condition:(((d=l==null?void 0:l.strategies)==null?void 0:d.length)||0)>0,show:t.jsxs(t.Fragment,{children:[t.jsx(K,{sx:{display:"flex",justifyContent:"center",py:1},children:t.jsx(ut,{label:"Add strategy",projectId:s,featureId:n,environmentId:e.name})}),t.jsx(fo,{environmentMetric:c})]})})]})]})})})},Io=()=>{const e=A("projectId"),s=A("featureId"),{feature:n}=M(e,s);if(!n)return null;const{environments:r}=n;return t.jsx(t.Fragment,{children:r==null?void 0:r.map(a=>t.jsx(ko,{env:a},a.name))})},Ws=e=>{const{makeRequest:s,createRequest:n,errors:r,loading:a}=On({propagateErrors:!0}),o=async(d,u)=>{const h=n(`/api/admin/projects/${e}/features/${d}/dependencies`,{method:"POST",body:JSON.stringify(u)});await s(h.caller,h.id)},i=async(d,u)=>{const h=n(`/api/admin/projects/${e}/features/${d}/dependencies/${u}`,{method:"DELETE"});await s(h.caller,h.id)},c=async d=>{const u=n(`/api/admin/projects/${e}/features/${d}/dependencies`,{method:"DELETE"});await s(u.caller,u.id)},l=[n,s,N,e];return{addDependency:g.useCallback(o,l),removeDependency:g.useCallback(i,l),removeDependencies:g.useCallback(c,l),errors:r,loading:a}},Po=(e,s,n={})=>{const r=ge(`/api/admin/projects/${e}/features/${s}/parents`),{data:a,error:o,mutate:i}=He(r,Oo,n);return{parentOptions:a,error:o,loading:!o&&!a}},Oo=async e=>await(await fetch(e).then(ye("Parent Options"))).json(),Bo=()=>t.jsxs(ie,{severity:"warning",children:["Remember to update your Unleash client! Feature dependencies require new SDK versions. Read more about ",t.jsx(Lo,{}),"."]}),Lo=()=>t.jsx("a",{href:"https://docs.getunleash.io/reference/dependent-features#client-sdk-support",target:"_blank",rel:"noreferrer",children:"Client SDK support for feature dependencies"}),_o=p(ys)(({theme:e})=>({marginTop:e.spacing(2),marginBottom:e.spacing(1.5)})),De={key:"none (remove dependency)",label:"none (remove dependency)"},Mo=({project:e,featureId:s,parent:n,onSelect:r})=>{const{parentOptions:a,loading:o}=Po(e,s),i=a?[De,...a.map(c=>({key:c,label:c}))]:[De];return t.jsx(_o,{fullWidth:!0,options:i,value:n,onChange:r})},qo=(e,s,n,r)=>{const{trackEvent:a}=ae(),{addChange:o}=ne(),{refetch:i}=te(e),{setToastData:c,setToastApiError:l}=U(),{refetchFeature:d}=M(e,s),u=wt(e)(),{isChangeRequestConfiguredInAnyEnv:h}=Z(e),{addDependency:m,removeDependencies:j}=Ws(e),y=async f=>{if(!u){console.error("No change request environment");return}f==="addDependency"&&(await o(e,u,[{action:f,feature:s,payload:{feature:n}}]),a("dependent_features",{props:{eventType:"dependency added"}})),f==="deleteDependency"&&await o(e,u,[{action:f,feature:s,payload:void 0}]),i(),c({text:f==="addDependency"?`${s} will depend on ${n}`:`${s} dependency will be removed`,type:"success",title:"Change added to a draft"})};return async()=>{try{if(h()){const f=n===De.key?"deleteDependency":"addDependency";await y(f),a("dependent_features",{props:{eventType:f==="addDependency"?"add dependency added to change request":"delete dependency added to change request"}})}else n===De.key?(await j(s),a("dependent_features",{props:{eventType:"dependency removed"}}),c({title:"Dependency removed",type:"success"})):(await m(s,{feature:n}),a("dependent_features",{props:{eventType:"dependency added"}}),c({title:"Dependency added",type:"success"}))}catch(f){l(N(f))}await d(),r()}},zo=({project:e,featureId:s,showDependencyDialogue:n,onClose:r})=>{const[a,o]=g.useState(De.key),i=qo(e,s,a,r),{isChangeRequestConfiguredInAnyEnv:c}=Z(e);return t.jsx(oe,{open:n,title:"Add parent feature dependency",onClose:r,onClick:i,primaryButtonText:c()?"Add change to draft":a===De.key?"Remove":"Add",secondaryButtonText:"Cancel",children:t.jsxs(K,{children:[t.jsx(Bo,{}),t.jsx(K,{sx:{mt:2,mb:4},children:"Your feature will be evaluated only when the selected parent feature is enabled in the same environment."}),t.jsx(W,{children:"What feature do you want to depend on?"}),t.jsx(b,{condition:n,show:t.jsx(Mo,{project:e,featureId:s,parent:a,onSelect:o})})]})})},Vo=p(ms)(({theme:e})=>({borderRadius:e.shape.borderRadiusLarge,padding:e.spacing(1,1.5)})),No=({feature:e,onEdit:s,onDelete:n})=>{const r=`dependency-${e}-actions`,a=`${r}-menu`,[o,i]=g.useState(null),c=!!o,l=u=>{i(u.currentTarget)},d=()=>{i(null)};return t.jsxs("span",{children:[t.jsx(ee,{title:"Dependency actions",arrow:!0,describeChild:!0,children:t.jsx($e,{id:r,"aria-controls":c?a:void 0,"aria-haspopup":"true","aria-expanded":c?"true":void 0,onClick:l,type:"button",children:t.jsx(xs,{})})}),t.jsx(Vo,{id:a,anchorEl:o,open:c,onClose:d,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:t.jsxs(Bn,{"aria-labelledby":r,children:[t.jsx(b,{condition:!0,show:t.jsxs(ue,{onClick:()=>{s(),d()},children:[t.jsx(Te,{children:t.jsx(we,{})}),t.jsx(me,{children:t.jsx(W,{variant:"body2",children:"Edit"})})]})}),t.jsx(b,{condition:!0,show:t.jsxs(ue,{onClick:()=>{n(),d()},children:[t.jsx(Te,{children:t.jsx(Ln,{})}),t.jsx(me,{children:t.jsx(W,{variant:"body2",children:"Delete"})})]})})]})})]})},Us=({childFeatures:e,project:s})=>t.jsx(ft,{tooltip:t.jsx(t.Fragment,{children:e.map(n=>t.jsx(Dt,{to:`/projects/${s}/features/${n}`,children:t.jsx("div",{children:n})},`${s}-${n}`))}),children:e.length===1?"1 feature":`${e.length} features`}),Ho=(e,s)=>{const{trackEvent:n}=ae(),{addChange:r}=ne(),{refetch:a}=te(e),{setToastData:o,setToastApiError:i}=U(),{refetchFeature:c}=M(e,s),l=wt(e)(),{isChangeRequestConfiguredInAnyEnv:d}=Z(e),{removeDependencies:u}=Ws(e),h=async()=>{if(!l){console.error("No change request environment");return}await r(e,l,[{action:"deleteDependency",feature:s,payload:void 0}])};return async()=>{try{d()?(await h(),n("dependent_features",{props:{eventType:"delete dependency added to change request"}}),o({text:`${s} dependency will be removed`,type:"success",title:"Change added to a draft"}),await a()):(await u(s),n("dependent_features",{props:{eventType:"dependency removed"}}),o({title:"Dependency removed",type:"success"}),await c())}catch(j){i(N(j))}}},Wo=({feature:e})=>{var d,u;const[s,n]=g.useState(!1),r=!!e.project&&e.dependencies.length===0&&e.children.length===0,a=!!e.project&&e.dependencies.length>0,o=!!e.project&&e.children.length>0,i=wt(e.project)(),c=rs(e.project),l=Ho(e.project,e.name);return t.jsxs(t.Fragment,{children:[t.jsx(b,{condition:r,show:t.jsx(Me,{children:t.jsxs(qe,{children:[t.jsx(ze,{children:"Dependency:"}),t.jsx(pe,{permission:Rt,projectId:e.project,variant:"text",onClick:()=>{n(!0)},children:"Add parent feature"})]})})}),t.jsx(b,{condition:a,show:t.jsxs(Me,{children:[t.jsxs(qe,{children:[t.jsx(ze,{children:"Dependency:"}),t.jsx(Dt,{to:`/projects/${e.project}/features/${(d=e.dependencies[0])==null?void 0:d.feature}`,children:(u=e.dependencies[0])==null?void 0:u.feature})]}),t.jsx(b,{condition:c(Rt,i),show:t.jsx(No,{feature:e.name,onEdit:()=>n(!0),onDelete:l})})]})}),t.jsx(b,{condition:o,show:t.jsx(Me,{children:t.jsxs(qe,{children:[t.jsx(ze,{children:"Children:"}),t.jsx(Us,{childFeatures:e.children,project:e.project})]})})}),t.jsx(b,{condition:!!e.project,show:t.jsx(zo,{project:e.project,featureId:e.name,onClose:()=>n(!1),showDependencyDialogue:s})})]})},Uo=(e,s={})=>{const n=ge(`/api/admin/projects/${e}/dependencies`),{data:r,error:a}=js(e,!1,n,Yo,s);return{dependenciesExist:r,error:a,loading:!a&&!r}},Yo=async e=>await(await fetch(e).then(ye("Dependencies exist check"))).json(),Go=e=>{const{dependenciesExist:s}=Uo(e),{isOss:n}=fe();return!!(!n()||s)},Ko=p("div")(({theme:e})=>({display:"flex",flexDirection:"column",justifyItems:"center",padding:e.spacing(3),fontSize:e.fontSizes.smallBody})),Jo=({feature:e,header:s})=>{var o;const{locationSettings:n}=Ss();fe();const r=Go(e.project),a=(o=e.environments)==null?void 0:o.map(i=>({name:i.name,lastSeenAt:i.lastSeenAt,enabled:i.enabled}));return t.jsxs(Ko,{children:[s,t.jsxs(Me,{children:[t.jsxs(qe,{children:[t.jsx(ze,{children:"Created at:"}),t.jsx("span",{children:_n(bs(e.createdAt),n.locale)})]}),t.jsx(Mn,{featureLastSeen:e.lastSeenAt,environments:a,sx:{p:0}})]}),t.jsx(b,{condition:r,show:t.jsx(Wo,{feature:e})})]})},Qo=p($e,{shouldForwardProp:e=>e!=="visibilityOff"})(({theme:e,visibilityOff:s})=>({marginLeft:"auto",marginRight:e.spacing(-1),color:s?e.palette.action.active:e.palette.action.focus,"&:hover":{color:e.palette.action.active}})),Zo=({environment:e,hiddenEnvironments:s,setHiddenEnvironments:n})=>{const r=()=>{n(e.name)};return t.jsx(Qo,{onClick:r,visibilityOff:s.has(e.name),children:t.jsx(b,{condition:s.has(e.name),show:t.jsx(qn,{}),elseShow:t.jsx(zn,{})})})},Xo=p("div")(({theme:e})=>({marginLeft:e.spacing(-1.5),"&:not(:last-of-type)":{marginBottom:e.spacing(2)},display:"flex",alignItems:"center"})),ei=p("label")(()=>({display:"inline-flex",alignItems:"center",cursor:"pointer"})),ti=({environment:e,callback:s,children:n,hiddenEnvironments:r,setHiddenEnvironments:a})=>{const o=A("projectId"),i=A("featureId"),{feature:c,refetchFeature:l}=M(o,i),{isChangeRequestConfigured:d}=Z(o),u=t.jsxs(t.Fragment,{children:[" ",t.jsxs("span",{"data-loading":!0,children:[e.enabled?"enabled":"disabled"," in"]})," ",t.jsx(vt,{text:e.name,maxWidth:"120",maxLength:15})]}),{onToggle:h,modals:m}=za(o),j=(y,T)=>h(y,{projectId:o,featureId:i,environmentName:e.name,environmentType:e.type,hasStrategies:e.strategies.length>0,hasEnabledStrategies:e.strategies.some(f=>!f.disabled),isChangeRequestEnabled:d(e.name),onRollback:T,onSuccess:()=>{s&&s(),l()}});return t.jsxs(Xo,{children:[t.jsxs(ei,{children:[t.jsx(Va,{featureId:c.name,projectId:o,environmentName:e.name,onToggle:j,value:e.enabled}),n??u]}),t.jsx(Zo,{environment:e,hiddenEnvironments:r,setHiddenEnvironments:a}),m]})},si=p("div")(({theme:e})=>({padding:e.spacing(3)})),ni=p("div")(()=>({display:"flex",flexDirection:"column"})),ai=p("p")(({theme:e})=>({fontSize:e.fontSizes.bodySize})),ri=p("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,display:"flex",alignItems:"center"})),Gt=p("span")(({theme:e})=>({padding:e.spacing(0,.5),"::after":{content:'"-"'}})),oi=p(Tt)(()=>({"&:hover, &:focus":{textDecoration:"underline"}})),ii=({feature:e,header:s,hiddenEnvironments:n,setHiddenEnvironments:r})=>{const a=e.environments.some(o=>{var i;return o.enabled&&((i=o.variants)==null?void 0:i.length)});return t.jsxs(si,{"data-testid":"feature-toggle-status",children:[s,e.environments.map(o=>{const i=o.strategies.length===1?"1 strategy":`${o.strategies.length} strategies`,c=o.variants??[],l=c.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Gt,{}),t.jsx(ee,{title:"View variants",arrow:!0,describeChild:!0,children:t.jsx(oi,{component:Q,to:`/projects/${e.project}/features/${e.name}/variants`,underline:"hover",children:c.length===1?"1 variant":`${c.length} variants`})})]}),d=o.enabled&&c.length===0&&a;return t.jsx(ti,{environment:o,hiddenEnvironments:n,setHiddenEnvironments:r,children:t.jsxs(ni,{children:[t.jsx(ai,{children:o.name}),t.jsxs(ri,{children:[i,l,t.jsx(b,{condition:d,show:t.jsxs(t.Fragment,{children:[t.jsx(Gt,{}),t.jsx(Na,{})]})})]})]})},o.name)})]})},Ys=(e,s={})=>{const n=async()=>{const d=ge(`api/admin/features/${e}/tags`);return(await fetch(d,{method:"GET"}).then(ye("Tags"))).json()},r=`api/admin/features/${e}/tags`,{data:a,error:o}=js(!!e,{tags:[]},r,n,s),[i,c]=g.useState(!o&&!a),l=()=>{gt(r)};return g.useEffect(()=>{c(!o&&!a)},[a,o]),{tags:(a==null?void 0:a.tags)||[],error:o,loading:i,refetch:l}},ci=p("section")(({theme:e})=>({"& > *":{margin:e.spacing(1,0)}})),ot=e=>e.map(s=>({title:s.value})),Kt=(e,s)=>e.map(n=>({value:n.title,type:s})),Gs=({open:e,setOpen:s})=>{const{tagTypes:n}=Vn(),r=A("featureId"),{createTag:a}=Ha(),{updateFeatureTags:o,loading:i}=Ye(),{tags:c,refetch:l,loading:d}=Ys(r),{setToastData:u}=U(),h=n&&n.length>0?n[0]:{name:"simple",description:"Simple tag to get you started",icon:""},[m,j]=g.useState(h),y=i||d,[T,f]=g.useState(0),{trackEvent:x}=ae(),[R,L]=g.useState(ot(c.filter(E=>E.type===m.name))),{tags:q,refetch:z}=Wa(m.name),v=g.useMemo(()=>ot(q),[q]);g.useEffect(()=>{c&&m&&L(ot(c.filter(E=>E.type===m.name)))},[JSON.stringify(c),m]);const C=()=>{s(!1),L([])};function $(E,F){const B=E.filter(_=>_.type===m.name).filter(_=>!F.find(P=>_.value===P.value&&_.type===P.type)),I=F.filter(_=>_.type===m.name).filter(_=>!E.find(P=>_.value===P.value&&_.type===P.type));return f(B.length+I.length),{added:B,removed:I}}const O=E=>E.filter(F=>!F.title.startsWith("Create")),V=async(E,F)=>{try{await o(r,{addedTags:E,removedTags:F}),await l()}catch(B){const I=N(B);u({type:"error",title:"Failed to add tag",text:I,confetti:!1})}},G=(E,F)=>{let B="We successfully";return E>0&&(B=B.concat(` added ${E} new tag${E>1?"s":""}`)),E>0&&F>0&&(B=B.concat(" and ")),F>0&&(B=B.concat(` removed ${F} tag${F>1?"s":""}`)),B},Y=async E=>{E.preventDefault();const F=Kt(O(R),m.name),{added:B,removed:I}=$(F,c);T>0&&(await V(B,I),T>1&&x("suggest_tags",{props:{eventType:"multiple_tags_added"}}),T>0&&u({type:"success",title:`Updated tag${B.length>1?"s":""} to toggle`,text:G(B.length,I.length),confetti:!0})),f(0),L([]),s(!1)},S=(E,F)=>{F!=null&&typeof F!="string"&&(E.preventDefault(),j(F),L([]),f(0))},k=(E,F,B)=>{const I=Nn(F);B==="selectOption"&&F.forEach((P,H)=>{if(typeof P!="string"&&P.inputValue&&P.inputValue!==""){const J={value:P.inputValue,type:m.name};a(J).then(()=>{x("suggest_tags",{props:{eventType:"tag_created"}}),z()}),P.title=P.inputValue,P.inputValue="",I[H]=P}});const _=Kt(O(I),m.name);$(_,c),L(I)},w="add-tag-form";return t.jsx(oe,{open:e,secondaryButtonText:"Cancel",primaryButtonText:"Save tags",title:"Update feature toggle tags",onClick:Y,disabledPrimaryButton:y||T===0,onClose:C,formId:w,children:t.jsxs(t.Fragment,{children:[t.jsx(W,{paragraph:!0,sx:{marginBottom:E=>E.spacing(2.5)},children:"Tags allow you to group features together"}),t.jsx("form",{id:w,onSubmit:Y,children:t.jsxs(ci,{children:[t.jsx(Ua,{options:n,value:m,onChange:S}),t.jsx(Ya,{options:v,existingTags:c,tagType:m,selectedOptions:R,onChange:k})]})})]})})},li=p("div")(({theme:e})=>({display:"flex",flexDirection:"column",padding:e.spacing(3)})),di=p("div")(({theme:e})=>({display:"flex",gap:e.spacing(1),flexWrap:"wrap"})),ui=p(vs)(({theme:e})=>({fontSize:e.fontSizes.smallBody})),pi=p(Re)(({theme:e})=>({margin:e.spacing(3),borderStyle:"dashed"})),gi=p(je)(({theme:e})=>({maxWidth:e.spacing(20),alignSelf:"center"})),hi=({feature:e,header:s})=>{const{tags:n,refetch:r}=Ys(e.name),{deleteTagFromFeature:a}=Ye(),[o,i]=g.useState(!1),[c,l]=g.useState(!1),[d,u]=g.useState(),{setToastData:h,setToastApiError:m}=U(),{hasAccess:j}=g.useContext(xt),y=j(Ce,e.project),T=async()=>{if(d)try{await a(e.name,d.type,d.value),r(),h({type:"success",title:"Tag deleted",text:"Successfully deleted tag"})}catch(f){m(N(f))}};return t.jsxs(li,{children:[s,t.jsx(di,{children:n.map(f=>{const x=`${f.type}:${f.value}`;return t.jsx(ui,{label:x,deleteIcon:t.jsx(Hn,{titleAccess:"Remove"}),onDelete:y?()=>{l(!0),u(f)}:void 0},x)})}),t.jsx(b,{condition:y,show:t.jsxs(t.Fragment,{children:[t.jsx(b,{condition:n.length>0,show:t.jsx(pi,{})}),t.jsx(gi,{"data-loading":!0,variant:"outlined",startIcon:t.jsx(Wn,{}),onClick:()=>i(!0),children:"Add new tag"})]})}),t.jsx(Gs,{open:o,setOpen:i}),t.jsxs(oe,{open:c,primaryButtonText:"Delete tag",secondaryButtonText:"Cancel",onClose:()=>{l(!1),u(void 0)},onClick:()=>{l(!1),T(),u(void 0)},title:"Delete tag?",children:["You are about to delete tag:"," ",t.jsxs("strong",{children:[d==null?void 0:d.type,":",d==null?void 0:d.value]})]})]})},fi=p(K)(({theme:e})=>({top:e.spacing(2),borderRadius:e.shape.borderRadiusLarge,backgroundColor:e.palette.background.paper,display:"flex",flexDirection:"column",maxWidth:"350px",minWidth:"350px",marginRight:"1rem",marginTop:"1rem",[e.breakpoints.down(1e3)]:{marginBottom:"1rem",width:"100%",maxWidth:"none",minWidth:"auto"}})),it=p("h3")(({theme:e})=>({display:"flex",gap:e.spacing(1),alignItems:"center",fontSize:e.fontSizes.bodySize,margin:0,marginBottom:e.spacing(3),"& > :last-child":{position:"relative",top:1}})),xi=({hiddenEnvironments:e,setHiddenEnvironments:s})=>{var i;const n=A("projectId"),r=A("featureId"),{feature:a}=M(n,r),o=((i=a.environments)==null?void 0:i.length)<=3;return t.jsxs(fi,{as:o?Un:K,children:[t.jsx(ii,{header:t.jsxs(it,{"data-loading":!0,children:["Enabled in environments (",a.environments.filter(({enabled:c})=>c).length,")",t.jsx(Yn,{tooltip:"When a feature is switched off in an environment, it will always return false. When switched on, it will return true or false depending on its strategies.",placement:"top"})]}),feature:a,hiddenEnvironments:e,setHiddenEnvironments:s}),t.jsx(Re,{}),t.jsx(Jo,{header:t.jsx(it,{"data-loading":!0,children:"Feature toggle details"}),feature:a}),t.jsx(Re,{}),t.jsx(hi,{header:t.jsx(it,{"data-loading":!0,children:"Tags for this feature toggle"}),feature:a})]})},mi=()=>{const{trackEvent:e}=ae(),{value:s,setValue:n}=Hs(),[r,a]=g.useState(new Set(s.hiddenEnvironments));return{hiddenEnvironments:r,setHiddenEnvironments:i=>{n(c=>{const l=new Set(Array.from(c.hiddenEnvironments||[]));return l.has(i)?(l.delete(i),e("hidden_environment",{props:{eventType:"environment unhidden"}})):(l.add(i),e("hidden_environment",{props:{eventType:"environment hidden"}})),a(l),{...s,hiddenEnvironments:[...l]}})}}},yi=()=>{const[e,s]=g.useState(0),n=A("projectId"),r=A("featureId"),a=Ae("environmentId"),o=Ae("strategyName"),{strategy:i,defaultStrategyFallback:c}=ks(n,a),l=JSON.parse(ds().get("defaultStrategy")||"false"),{segments:d}=mt(),u=(d||[]).filter(J=>{var D;return(D=i==null?void 0:i.segments)==null?void 0:D.includes(J.id)}),[h,m]=g.useState({}),[j,y]=g.useState(l?u:[]),{strategyDefinition:T}=yt(o),f=jt(),{addStrategyToFeature:x,loading:R}=he(),{addChange:L}=ne(),{setToastData:q,setToastApiError:z}=U(),{uiConfig:v}=fe(),{unleashUrl:C}=v,$=ce(),{feature:O,refetchFeature:V}=M(n,r),G=g.useRef(O),{isChangeRequestConfigured:Y}=Z(n),{refetch:S}=te(n),{trackEvent:k}=ae(),{data:w,staleDataNotification:E,forceRefreshCache:F}=St({unleashGetter:M,params:[n,r],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},O,{afterSubmitAction:V},bt);g.useEffect(()=>{G.current.name===""&&O.name&&(F(O),G.current=O)},[O.name]),g.useEffect(()=>{var J;if(l){const D=i||c;((J=D.parameters)==null?void 0:J.groupId)===""&&r?m({...D,parameters:{...D.parameters,groupId:r}}):m(D)}else T&&m(Ms(r,T))},[r,JSON.stringify(T),l]);const B=async J=>{await x(n,r,a,J),q({title:"Strategy created",type:"success",confetti:!0})},I=async J=>{await L(n,a,{action:"addStrategy",feature:r,payload:J}),q({title:"Strategy added to draft",type:"success",confetti:!0}),S()},_=us(h,j),P=async()=>{k("strategyTitle",{props:{hasTitle:!!h.title,on:"create"}});try{Y(a)?await I(_):await B(_),V(),$(We(n,r))}catch(J){z(N(J))}};return!w||!w.project?null:t.jsxs(Ue,{modal:!0,description:ps,documentationLink:gs,documentationLinkLabel:hs,disablePadding:!0,formatApiCode:()=>ji(n,r,a,_,C),children:[t.jsx(Cs,{projectId:n,feature:w,strategy:h,setStrategy:m,segments:j,setSegments:y,environmentId:a,onSubmit:P,loading:R,permission:de,errors:f,isChangeRequest:Y(a),tab:e,setTab:s,StrategyVariants:t.jsx(ws,{strategy:h,setStrategy:m,environment:a,projectId:n,editable:!0})}),E]})},ji=(e,s,n,r,a)=>{if(!a)return"";const o=`${a}/api/admin/projects/${e}/features/${s}/environments/${n}/strategies`,i=JSON.stringify(r,void 0,2);return`curl --location --request POST '${o}' \\
|
|
5
|
-
--header 'Authorization: INSERT_API_KEY' \\
|
|
6
|
-
--header 'Content-Type: application/json' \\
|
|
7
|
-
--data-raw '${i}'`},Si=()=>{const[e,s]=g.useState(""),{trackEvent:n}=ae();return{setPreviousTitle:s,trackTitle:(a="")=>{a===e&&n("strategyTitle",{props:{action:"none",on:"edit"}}),e===""&&a!==""&&n("strategyTitle",{props:{action:"added",on:"edit"}}),e!==""&&a===""&&n("strategyTitle",{props:{action:"removed",on:"edit"}}),e!==""&&a!==""&&a!==e&&n("strategyTitle",{props:{action:"edited",on:"edit"}})}}},bi=e=>{if(e)return e==null?void 0:e.constraints.map(s=>({...s,[Kn]:_e()}))},vi=()=>{const e=A("projectId"),s=A("featureId"),n=Ae("environmentId"),r=Ae("strategyId"),[a,o]=g.useState(0),[i,c]=g.useState({}),[l,d]=g.useState([]),{updateStrategyOnFeature:u,loading:h}=he(),{strategyDefinition:m}=yt(i.name),{setToastData:j,setToastApiError:y}=U(),T=jt(),{uiConfig:f}=fe(),{unleashUrl:x}=f,R=ce(),{addChange:L}=ne(),{isChangeRequestConfigured:q}=Z(e),{refetch:z}=te(e),{setPreviousTitle:v}=Si(),{feature:C,refetchFeature:$}=M(e,s),O=g.useRef(C),{data:V,staleDataNotification:G,forceRefreshCache:Y}=St({unleashGetter:M,params:[e,s],dataKey:"feature",refetchFunctionKey:"refetchFeature",options:{}},C,{afterSubmitAction:$},bt);g.useEffect(()=>{O.current.name===""&&C.name&&(Y(C),O.current=C)},[C]);const{segments:S,refetchSegments:k}=mt(r);g.useEffect(()=>{const I=V==null?void 0:V.environments.flatMap(H=>H.strategies).find(H=>H.id===r),_=bi(I),P={...I,constraints:_};c(H=>({...H,...P})),v((I==null?void 0:I.title)||"")},[r,V]),g.useEffect(()=>{S&&d(S)},[JSON.stringify(S)]);const w=Ci(i,l),E=async I=>{await u(e,s,n,r,I),await k(),j({title:"Strategy updated",type:"success",confetti:!0})},F=async I=>{await L(e,n,{action:"updateStrategy",feature:s,payload:{...I,id:r}}),j({title:"Change added to draft",type:"success",confetti:!0}),z()},B=async()=>{try{q(n)?await F(w):await E(w),$(),R(wi(e,s))}catch(I){y(N(I))}};return!i.id||!m||!V?null:t.jsxs(Ue,{modal:!0,disablePadding:!0,description:Ei,documentationLink:Ai,documentationLinkLabel:Di,formatApiCode:()=>Ti(e,s,n,r,w,m,x),children:[t.jsx(Cs,{projectId:e,feature:V,strategy:i,setStrategy:c,segments:l,setSegments:d,environmentId:n,onSubmit:B,loading:h,permission:cs,errors:T,isChangeRequest:q(n),tab:a,setTab:o,StrategyVariants:t.jsx(ws,{strategy:i,setStrategy:c,environment:n,projectId:e})}),G]})},Ci=(e,s)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:s.map(n=>n.id),disabled:e.disabled??!1}),wi=(e,s)=>`/projects/${e}/features/${s}`,Ti=(e,s,n,r,a,o,i)=>{if(!i)return"";const c={...a,parameters:Gn(a.parameters??{},o)},l=`${i}/api/admin/projects/${e}/features/${s}/environments/${n}/strategies/${r}`,d=JSON.stringify(c,void 0,2);return`curl --location --request PUT '${l}' \\
|
|
8
|
-
--header 'Authorization: INSERT_API_KEY' \\
|
|
9
|
-
--header 'Content-Type: application/json' \\
|
|
10
|
-
--data-raw '${d}'`},Ei=`
|
|
11
|
-
An activation strategy will only run when a feature toggle is enabled and provides a way to control who will get access to the feature.
|
|
12
|
-
If any of a feature toggle's activation strategies returns true, the user will get access.
|
|
13
|
-
`,Ai="https://docs.getunleash.io/reference/activation-strategies",Di="Strategies documentation",Fi=p("div")(({theme:e})=>({display:"flex",width:"100%",[e.breakpoints.down(1e3)]:{flexDirection:"column"}})),Ri=p("div")(({theme:e})=>({display:"flex",flexDirection:"column",width:"calc(100% - (350px + 1rem))",[e.breakpoints.down(1e3)]:{width:"100%"}})),$i=()=>{const e=ce(),s=A("projectId"),n=A("featureId"),r=We(s,n),{hiddenEnvironments:a,setHiddenEnvironments:o}=mi(),i=()=>e(r);Ts(n);const c=Es("newStrategyConfiguration");return t.jsxs(Fi,{children:[t.jsxs("div",{children:[t.jsx(cr,{}),t.jsx(xi,{hiddenEnvironments:a,setHiddenEnvironments:o})]}),t.jsx(Ri,{children:t.jsx(Io,{})}),t.jsxs(As,{children:[t.jsx(xe,{path:"strategies/create",element:t.jsx(dt,{label:"Create feature strategy",onClose:i,open:!0,children:t.jsx(b,{condition:c,show:t.jsx(yi,{}),elseShow:t.jsx(Nr,{})})})}),t.jsx(xe,{path:"strategies/edit",element:t.jsx(dt,{label:"Edit feature strategy",onClose:i,open:!0,children:t.jsx(b,{condition:c,show:t.jsx(vi,{}),elseShow:t.jsx(Jn,{})})})})]})]})},ki=p("div")(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between","& > div":{display:"flex",alignItems:"center"},marginTop:e.spacing(-3.5),marginBottom:e.spacing(2),backgroundColor:e.palette.background.default,paddingTop:e.spacing(2),paddingBottom:e.spacing(2),position:"sticky",top:0,zIndex:2})),Ii=p(Ds,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:s})=>({color:s?e.palette.neutral.border:e.palette.primary.main})),Pi=p("span",{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:s})=>({color:s?e.palette.text.secondary:e.palette.text.primary,marginLeft:e.spacing(1.25),fontSize:e.fontSizes.mainHeader,fontWeight:e.fontWeight.bold})),Oi=p("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Bi=p(ie)(({theme:e})=>({marginBottom:e.spacing(2)})),Li=p(ie)(({theme:e})=>({marginTop:e.spacing(4)})),_i=p("div")({display:"flex",flexDirection:"column"}),Mi=p("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1.5),marginBottom:e.spacing(.5)})),Jt=p("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(1.5)})),qi=p(Re)(({theme:e})=>({margin:e.spacing(4,0)})),zi=p(Qn)(({theme:e})=>({minWidth:e.spacing(20),width:"100%"})),Vi=p("div")(({theme:e})=>({marginTop:"auto",paddingTop:e.spacing(4),display:"flex",justifyContent:"flex-end"})),Ni=p(je)(({theme:e})=>({marginLeft:e.spacing(3)})),Hi=g.memo(Zn),Wi=({environment:e,open:s,setOpen:n,getApiPayload:r,getCrPayload:a,onConfirm:o})=>{const i=A("projectId"),c=A("featureId"),{uiConfig:l}=fe(),{context:d}=Xn(),{defaultStickiness:u,loading:h}=ea(i),{isChangeRequestConfigured:m}=Z(i),{data:j}=te(i),{changeRequestInReviewOrApproved:y,alert:T}=sa(j),f=(e==null?void 0:e.variants)||[],[x,R]=g.useState([]),[L,q]=g.useState();g.useEffect(()=>{h||R(f.length?f.map(D=>({...D,isValid:!0,new:!1,id:_e()})):[{name:"",weightType:$t.VARIABLE,weight:0,overrides:[],stickiness:(x==null?void 0:x.length)>0?x[0].stickiness:u,new:!0,isValid:!1,id:_e()}])},[s,h]);const z=(D,X)=>{R(Se=>kt(Se.map(Pe=>Pe.id===X?D:Pe),1e3))},v=()=>{const D=_e();R(X=>[...X,{name:"",weightType:$t.VARIABLE,weight:0,overrides:[],stickiness:(X==null?void 0:X.length)>0?X[0].stickiness:u,new:!0,isValid:!1,id:D}]),q(D)};g.useEffect(()=>{if(L){const D=document.getElementById(`variant-name-input-${L}`);D==null||D.scrollIntoView({behavior:"smooth",block:"center"}),D==null||D.focus({preventScroll:!0}),q(void 0)}},[L]);const C=x.map(({new:D,isValid:X,id:Se,...Pe})=>Pe),$=r(f,C),O=a(C),V=async D=>{D.preventDefault(),o(C)},G=()=>w?`curl --location --request POST '${l.unleashUrl}/api/admin/projects/${i}/environments/${e==null?void 0:e.name}/change-requests' \\
|
|
14
|
-
--header 'Authorization: INSERT_API_KEY' \\
|
|
15
|
-
--header 'Content-Type: application/json' \\
|
|
16
|
-
--data-raw '${JSON.stringify(O,void 0,2)}'`:`curl --location --request PATCH '${l.unleashUrl}/api/admin/projects/${i}/features/${c}/environments/${e==null?void 0:e.name}/variants' \\
|
|
17
|
-
--header 'Authorization: INSERT_API_KEY' \\
|
|
18
|
-
--header 'Content-Type: application/json' \\
|
|
19
|
-
--data-raw '${JSON.stringify($.patch,void 0,2)}'`,Y=x.every(({isValid:D})=>D),S=y((e==null?void 0:e.name)||""),k=S?"Add to existing change request":"Add change to draft",w=m((e==null?void 0:e.name)||""),E=g.useMemo(()=>{var D;return h?"":((D=C[0])==null?void 0:D.stickiness)||u},[h,u,JSON.stringify(C[0]??{})]),F=g.useMemo(()=>["default",...d.filter(D=>D.stickiness).map(D=>D.name)],[d]),B=F.map(D=>({key:D,label:D}));F.includes(E)||B.push({key:E,label:E});const I=async D=>{R(X=>X.map(Se=>({...Se,stickiness:D})))},_=D=>{I(D)},[P,H]=g.useState();g.useEffect(()=>{H(void 0),$.error&&H($.error)},[$.error]);const J=()=>{I(u),n(!1)};return h||E===""?t.jsx(ta,{}):t.jsx(dt,{open:s,onClose:J,label:"",children:t.jsxs(Ue,{modal:!0,title:"",description:"Variants allow you to return a variant object if the feature toggle is considered enabled for the current request.",documentationLink:"https://docs.getunleash.io/reference/feature-toggle-variants",documentationLinkLabel:"Feature toggle variants documentation",formatApiCode:G,loading:!s,children:[t.jsxs(ki,{children:[t.jsxs("div",{children:[t.jsx(Ii,{deprecated:!(e!=null&&e.enabled)}),t.jsx(Pi,{deprecated:!(e!=null&&e.enabled),children:e==null?void 0:e.name})]}),t.jsx(pe,{"data-testid":"MODAL_ADD_VARIANT_BUTTON",onClick:v,variant:"outlined",permission:be,projectId:i,environmentId:e==null?void 0:e.name,children:"Add variant"})]}),t.jsxs(Oi,{onSubmit:V,children:[t.jsx(b,{condition:S,show:T,elseShow:t.jsx(b,{condition:!!w,show:t.jsxs(Bi,{severity:"info",children:[t.jsx("strong",{children:"Change requests"})," are enabled",e?` for ${e.name}`:"",". Your changes need 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."]})})}),t.jsx(_i,{children:x.map(D=>t.jsx(Hi,{variant:D,variants:x,updateVariant:X=>z(X,D.id),removeVariant:()=>R(X=>kt(X.filter(Se=>Se.id!==D.id),1e3)),error:$.error},D.id))}),t.jsx(pe,{onClick:v,variant:"outlined",permission:be,projectId:i,environmentId:e==null?void 0:e.name,children:"Add variant"}),t.jsx(qi,{}),t.jsx(b,{condition:x.length>0,show:t.jsxs(t.Fragment,{children:[t.jsx(Mi,{children:t.jsx("p",{children:"Stickiness"})}),t.jsxs(Jt,{children:["By overriding the stickiness you can control which parameter is used to ensure consistent traffic allocation across variants."," ",t.jsx(Tt,{href:"https://docs.getunleash.io/reference/feature-toggle-variants",target:"_blank",rel:"noreferrer",children:"Read more"})]}),t.jsx("div",{children:t.jsx(zi,{value:E,label:"",editable:!0,onChange:D=>_(D.target.value)})})]}),elseShow:t.jsx(Jt,{children:"This environment has no variants. Get started by adding a variant."})}),t.jsxs(Li,{severity:"error",hidden:!P,children:[t.jsx("strong",{children:"Error: "}),P]}),t.jsxs(Vi,{children:[t.jsx(je,{"data-testid":"DIALOGUE_CONFIRM_ID",type:"submit",variant:"contained",color:"primary",disabled:!Y,children:w?k:"Save variants"}),t.jsx(Ni,{onClick:J,children:"Cancel"})]})]})]})})},Ui=e=>fetch(e).then(ye("ChangeRequest")).then(s=>s.json()),Yi=(e,s)=>{const{data:n,error:r,mutate:a}=ls([],ge(`api/admin/projects/${e}/change-requests/scheduled?variantForFlag=${s}`),Ui);return{changeRequests:n,loading:!r&&!n,refetch:a,error:r}},Gi=(e,s,n)=>{const{changeRequests:r}=Yi(e,s),a=r==null?void 0:r.filter(o=>o.environment===n);return a?a.map(o=>o.id):[]},Ki=p("div")(({theme:e})=>({padding:e.spacing(3),borderRadius:e.shape.borderRadiusLarge,border:`1px solid ${e.palette.divider}`,"&:not(:last-child)":{marginBottom:e.spacing(3)}})),Ji=p("div")({display:"flex",alignItems:"center",justifyContent:"space-between","& > div":{display:"flex",alignItems:"center"}}),Qi=p(Ds,{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:s})=>({color:s?e.palette.neutral.border:e.palette.primary.main})),Zi=p("span",{shouldForwardProp:e=>e!=="deprecated"})(({theme:e,deprecated:s})=>({color:s?e.palette.text.secondary:e.palette.text.primary,marginLeft:e.spacing(1.25),fontWeight:e.fontWeight.bold})),Xi=p("p")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary,marginBottom:e.spacing(1.5)})),ec=p("div")(({theme:e})=>({margin:e.spacing(3,0)})),tc=p("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1.5),marginBottom:e.spacing(.5)})),sc=({environment:e,searchValue:s,children:n})=>{var l;const r=A("projectId"),a=A("featureId"),o=Gi(r,a,e.name),i=e.variants??[],c=((l=i[0])==null?void 0:l.stickiness)||"default";return t.jsxs(Ki,{children:[t.jsxs(Ji,{children:[t.jsxs("div",{children:[t.jsx(Qi,{deprecated:!e.enabled}),t.jsx(Zi,{deprecated:!e.enabled,children:e.name}),t.jsx(b,{condition:o.length>0,show:t.jsx(na,{sx:{ml:2},children:t.jsx(_s,{scheduledChangeRequestIds:o})})})]}),n]}),t.jsx(b,{condition:i.length>0,show:t.jsxs(t.Fragment,{children:[t.jsx(ec,{children:t.jsx(aa,{variants:i,searchValue:s})}),t.jsx(b,{condition:i.length>1,show:t.jsxs(t.Fragment,{children:[t.jsxs(tc,{children:[t.jsx("p",{children:"Stickiness:"}),t.jsx(Ee,{children:c})]}),t.jsxs(Xi,{children:["By overriding the stickiness you can control which parameter is used to ensure consistent traffic allocation across variants."," ",t.jsx(Tt,{href:"https://docs.getunleash.io/reference/feature-toggle-variants",target:"_blank",rel:"noreferrer",children:"Read more"})]})]})})]})})]})},nc=p(me)(({theme:e})=>({"& span":{fontSize:e.fontSizes.smallBody}})),ac=({environment:e,permission:s,projectId:n,environmentId:r,onCopyVariantsFrom:a,otherEnvsWithVariants:o})=>{const[i,c]=g.useState(null),l=!!i,d=e.variants??[];return t.jsx(b,{condition:o.length>0&&d.length===0,show:t.jsxs(t.Fragment,{children:[t.jsx(pe,{onClick:u=>{c(u.currentTarget)},id:`copy-from-menu-${e.name}`,"aria-controls":l?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":l?"true":void 0,variant:"outlined",permission:s,projectId:n,environmentId:r,children:"Copy variants from"}),t.jsx(ke,{anchorEl:i,open:l,onClose:()=>c(null),MenuListProps:{"aria-labelledby":`copy-from-menu-${e.name}`},children:o.map(u=>t.jsx(ue,{onClick:()=>a(u,e),children:t.jsx(nc,{children:`Copy from ${u.name}`})},u.name))})]})})},rc=({permission:e,projectId:s,environment:n,checked:r,onClick:a,...o})=>{const i=lt(e,s,n);return t.jsxs(ue,{disabled:!i,onClick:a,...o,children:[t.jsx(ra,{checked:r}),n]})},oc=p(ke)(({theme:e})=>({"& > div > ul":{display:"flex",flexDirection:"column",justifyContent:"center","& > li":{padding:e.spacing(0,1)}}})),ic=p("div")(({theme:e})=>({margin:e.spacing(1,2)})),cc=p(je)(({theme:e})=>({marginTop:e.spacing(2)})),lc=({current:e,environments:s,permission:n,projectId:r,onSubmit:a})=>{var T;const[o,i]=g.useState(null),c=!!o,[l,d]=g.useState([]),u=f=>{d(x=>[...x,f])},h=f=>{d(x=>x.filter(({name:R})=>R!==f.name))},m=f=>{l.includes(f)?h(f):u(f)},j=()=>{d([]),i(null)},y=((T=s.find(f=>f.name===e))==null?void 0:T.variants)??[];return t.jsx(b,{condition:y.length>0&&s.length>1,show:t.jsxs(t.Fragment,{children:[t.jsx(je,{onClick:f=>{i(f.currentTarget)},id:`push-to-menu-${e}`,"aria-controls":c?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":c?"true":void 0,variant:"outlined",children:"Copy to environment"}),t.jsxs(oc,{anchorEl:o,open:c,onClose:()=>i(null),MenuListProps:{"aria-labelledby":`push-to-menu-${e}`},children:[s.filter(f=>f.name!==e).map(f=>t.jsx(rc,{projectId:r,permission:n,environment:f.name,checked:l.includes(f),onClick:()=>m(f)},f.name)),t.jsxs(ic,{children:[t.jsx(Re,{}),t.jsxs(cc,{variant:"outlined",onClick:()=>{a(l),j()},disabled:l.length===0,children:["Push to selected (",l.length,")"]})]})]})]})})},dc=p("div")(({theme:e})=>({display:"flex",gap:e.spacing(1.5)})),uc=()=>{const{setToastData:e,setToastApiError:s}=U(),n=ht(),r=Ie(n.breakpoints.down("md")),a=A("projectId"),o=A("featureId"),{feature:i,refetchFeature:c,loading:l}=M(a,o),{patchFeatureEnvironmentVariants:d,overrideVariantsInEnvironments:u}=Ye(),{refetch:h}=te(a),{addChange:m}=ne(),{isChangeRequestConfigured:j}=Z(a),[y,T]=g.useState(""),[f,x]=g.useState(),[R,L]=g.useState(!1),q=g.useMemo(()=>{var S;return((S=i==null?void 0:i.environments)==null?void 0:S.map(k=>({...k,crEnabled:j(k.name)})))||[]},[i.environments]),z=(S,k)=>la(S,k),v=(S,k)=>{try{const w=ca(k,1e3);return{patch:z(S,w)}}catch(w){return{patch:[],error:N(w)}}},C=S=>({feature:o,action:"patchVariant",payload:{variants:S}}),$=async(S,k)=>{if(S.crEnabled)await m(a,S.name,C(k)),h();else{const w=S.variants??[],{patch:E,error:F}=v(w,k);if(E.length===0)return;if(F){e({type:"error",title:F});return}await d(a,o,S.name,E)}c()},O=async(S,k)=>{try{const w=k.filter(({crEnabled:_})=>_),E=k.filter(({crEnabled:_})=>!_);w.length&&await Promise.all(w.map(_=>m(a,_.name,C(S)))),E.length&&await u(a,o,S,E.map(({name:_})=>_)),h(),c();const F=E.length?`Variants pushed to ${E.length===1?E[0].name:`${E.length} environments`}`:"",B=w.length?`Variants push added to ${w.length===1?`${w[0].name} draft`:`${w.length} drafts`}`:"",I=`${F}${F&&B?". ":""}${B}`;e({title:I,type:"success"})}catch(w){s(N(w))}},V=S=>{x(S),L(!0)},G=async S=>{if(f)try{await $(f,S),L(!1),e({title:f.crEnabled?"Variant changes added to draft":"Variants updated successfully",type:"success"})}catch(k){s(N(k))}},Y=async(S,k)=>{try{const w=S.variants??[];await $(k,w),e({title:k.crEnabled?"Variants copy added to draft":"Variants copied successfully",type:"success"})}catch(w){s(N(w))}};return t.jsxs(Et,{isLoading:l,header:t.jsx(oa,{title:"Variants",actions:t.jsx(b,{condition:!r,show:t.jsx(t.Fragment,{children:t.jsx(It,{initialValue:y,onChange:T})})}),children:t.jsx(b,{condition:r,show:t.jsx(It,{initialValue:y,onChange:T})})}),children:[t.jsx(ia,{}),q.map(S=>{var w;const k=q.filter(({name:E,variants:F})=>E!==S.name&&(F==null?void 0:F.length));return t.jsx(sc,{environment:S,searchValue:y,children:t.jsxs(dc,{children:[t.jsx(lc,{current:S.name,environments:q,permission:be,projectId:a,onSubmit:E=>O(S.variants??[],E)}),t.jsx(ac,{environment:S,permission:be,projectId:a,environmentId:S.name,onCopyVariantsFrom:Y,otherEnvsWithVariants:k}),t.jsx(b,{condition:!!((w=S.variants)!=null&&w.length),show:t.jsx(re,{"data-testid":"EDIT_VARIANTS_BUTTON",onClick:()=>V(S),permission:be,projectId:a,environmentId:S.name,tooltipProps:{title:"Edit variants"},children:t.jsx(we,{})}),elseShow:t.jsx(pe,{"data-testid":"ADD_VARIANT_BUTTON",onClick:()=>V(S),variant:"outlined",permission:be,projectId:a,environmentId:S.name,children:"Add variant"})})]})},S.name)}),t.jsx(Wi,{environment:f,open:R,setOpen:L,getApiPayload:v,getCrPayload:C,onConfirm:G})]})},pc=ge("api/admin/client-metrics/features"),Ks=(e,s)=>{const n=ge(`api/admin/client-metrics/features/${e}/raw?hoursBack=${s}`),{data:r,error:a}=He(n,()=>gc(n)),o=g.useCallback(()=>{gt(pc).catch(console.warn)},[]);return{featureMetrics:r==null?void 0:r.data,loading:!a&&!r,refetchFeatureMetrics:o,error:a}},gc=e=>fetch(e).then(ye("Features")).then(s=>s.json()).then(),hc=()=>{const{isEnterprise:e}=fe(),s=Es("extendedUsageMetricsUI");return e()&&s},fc=p("h2")(({theme:e})=>({margin:0,marginBottom:e.spacing(1),fontSize:e.fontSizes.smallBody,fontWeight:e.fontWeight.thin,color:e.palette.text.secondary})),Ne=48,xc=({hoursBack:e,setHoursBack:s})=>{const{trackEvent:n}=ae(),r=c=>{s(parseInt(c)),n("feature-metrics",{props:{eventType:"change-period",hoursBack:c}})},o=hc()?[...Qt,...mc]:Qt,i=o.map(c=>Number(c.key)).includes(e)?e:Ne;return g.useEffect(()=>{e!==i&&s(i)},[e]),t.jsxs("div",{children:[t.jsx(fc,{children:"Period"}),t.jsx(ys,{name:"feature-metrics-period",id:"feature-metrics-period",options:o,value:String(i),onChange:r,fullWidth:!0})]})},Qt=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],mc=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],yc=({value:e,timeZone:s})=>{const{locationSettings:n}=Ss(),r=e?e instanceof Date?Pt(e,n.locale,s):Pt(bs(e),n.locale,s):void 0;return t.jsx(Fs,{lineClamp:1,children:r})},jc=({metrics:e,tableSectionId:s})=>{const n=Ie(da.breakpoints.down("md")),r=g.useMemo(()=>({sortBy:[{id:"timestamp"}]}),[]),{getTableProps:a,getTableBodyProps:o,headerGroups:i,rows:c,prepareRow:l,setHiddenColumns:d}=Je.useTable({initialState:r,columns:Zt,data:e,autoResetHiddenColumns:!1,disableSortRemove:!0,defaultColumn:{Cell:Fs}},Je.useGlobalFilter,Je.useSortBy);return ua([{condition:n,columns:["appName","environment"]}],d,Zt),e.length===0?null:t.jsxs(pa,{...a(),rowHeight:"standard",id:s,children:[t.jsx(ga,{headerGroups:i}),t.jsx(ha,{...o(),children:c.map(u=>(l(u),t.jsx(fa,{hover:!0,...u.getRowProps(),children:u.cells.map(h=>t.jsx(xa,{...h.getCellProps(),children:h.render("Cell")}))})))})]})},Zt=[{id:"Icon",width:"1%",disableSortBy:!0,Cell:()=>t.jsx(ma,{icon:t.jsx(Xa,{color:"disabled"})})},{Header:"Time",accessor:"timestamp",Cell:e=>t.jsx(yc,{value:e.row.original.timestamp,timeZone:e.row.original.timestamp.includes("23:59")?"UTC":void 0})},{Header:"Application",accessor:"appName"},{Header:"Environment",accessor:"environment"},{id:"requested",Header:"Requested",accessor:e=>e.yes+e.no},{Header:"Exposed",accessor:"yes"}],Sc=({metrics:e,...s})=>{const n=g.useMemo(()=>e.reduce((a,o)=>a+o.yes,0),[e]),r=g.useMemo(()=>e.reduce((a,o)=>a+o.no,0),[e]);return t.jsx(Ns,{...s,totalYes:n,totalNo:r})},bc=({metrics:e,hoursBack:s})=>{const n=Ot(),r=Ot();return e.length===0?t.jsxs(K,{mt:6,children:[t.jsx(W,{variant:"body1",paragraph:!0,children:"We have yet to receive any metrics for this feature toggle in the selected time period."}),t.jsx(W,{variant:"body1",paragraph:!0,children:"Please note that, since the SDKs send metrics on an interval, it might take some time before metrics appear."})]}):t.jsxs(g.Suspense,{fallback:null,children:[t.jsx(K,{borderTop:1,pt:2,mt:3,borderColor:"divider",children:t.jsx(vc,{metrics:e,hoursBack:s,statsSectionId:n})}),t.jsx(K,{mt:4,children:t.jsx(Sc,{metrics:e,hoursBack:s,statsSectionId:n,tableSectionId:r})}),t.jsx(K,{mt:4,children:t.jsx(jc,{metrics:e,tableSectionId:r})})]})},vc=ya.lazy(()=>ja(()=>import("./FeatureMetricsChart-UhDepK_o.js"),__vite__mapDeps([]))),Cc=p("h2")(({theme:e})=>({margin:0,marginBottom:e.spacing(1.5),fontSize:e.fontSizes.smallBody,fontWeight:e.fontWeight.thin,color:e.palette.text.secondary})),wc=p("ul")(({theme:e})=>({display:"flex",flexWrap:"wrap",gap:e.spacing(1),listStyleType:"none",padding:0,minHeight:"100%",alignItems:"center",maxHeight:"200px",overflowY:"auto"})),Tc=p("li")(({theme:e})=>({"& > [aria-pressed=true]":{backgroundColor:e.palette.background.alternative,color:e.palette.primary.contrastText},"& > [aria-pressed=true]:hover":{backgroundColor:e.palette.primary.light}})),Xt=({title:e,values:s,selectedValues:n,toggleValue:r,toggleValues:a})=>{const o=l=>()=>{r(l)},i=[...s].every(l=>n.includes(l)),c=g.useMemo(()=>Array.from(s).sort((l,d)=>l.localeCompare(d)),[s]);return t.jsxs("div",{children:[t.jsx(Cc,{children:e}),t.jsxs(wc,{children:[c.map(l=>t.jsx(Tc,{children:t.jsx(vs,{label:l,onClick:o(l),"aria-pressed":n==null?void 0:n.includes(l),sx:Sa})},l)),a&&s.size>1&&t.jsx(je,{size:"small",onClick:a,"aria-pressed":i,children:i?"Unselect":"Select all"})]})]})},Ec=e=>{const s=new Map;return e.forEach(n=>{let r=s.get(n.timestamp);if(r||(r={...n,yes:0,no:0,variants:{}},s.set(n.timestamp,r)),r.yes+=n.yes,r.no+=n.no,n.variants){r.variants=r.variants||{};for(const[a,o]of Object.entries(n.variants))r.variants[a]=(r.variants[a]||0)+o}}),Array.from(s.values()).map(n=>({...n,variants:n.variants&&Object.keys(n.variants).length===0?void 0:n.variants}))},Ac=()=>{const e=A("projectId"),s=A("featureId"),n=Dc(e,s);Ts("Metrics");const r=Array.from(n)[0],[a,o]=ba({environment:Qe(va,r),applications:Qe(Ca,[]),hoursBack:Qe(wa,Ne)}),i=Fc(s,a.hoursBack||Ne),c=Array.from(i)[0],{environment:l,hoursBack:d}=a,u=a.applications.filter(f=>f!==null);g.useEffect(()=>{a.applications&&a.applications.length===0&&c&&o({applications:[c]})},[JSON.stringify(Array.from(i))]);const h=[...i].every(f=>u.includes(f)),{featureMetrics:m}=Ks(s,d),[j,y]=g.useState(m);g.useEffect(()=>{m&&y(m)},[m]);const T=g.useMemo(()=>Ec((j==null?void 0:j.filter(f=>l===f.environment).filter(f=>u.includes(f.appName)))||[]),[j,l,JSON.stringify(u)]);return T?t.jsxs(Et,{children:[t.jsxs(le,{container:!0,component:"header",spacing:2,children:[t.jsx(le,{item:!0,xs:12,md:5,children:t.jsx(b,{condition:n.size>0,show:t.jsx(Xt,{title:"Environments",values:n,selectedValues:[l],toggleValue:f=>{o({environment:f})}})})}),t.jsx(le,{item:!0,xs:12,md:5,children:t.jsx(b,{condition:i.size>0,show:t.jsx(Xt,{title:"Applications",values:i,selectedValues:u,toggleValues:()=>{o(h?{applications:[c]}:{applications:[...i]})},toggleValue:f=>{u.includes(f)?o({applications:u.filter(x=>x!==f)}):o({applications:[...u,f]})}})})}),t.jsx(le,{item:!0,xs:12,md:2,children:t.jsx(xc,{hoursBack:d,setHoursBack:f=>o({hoursBack:f})})})]}),t.jsx(bc,{metrics:T,hoursBack:d})]}):null},Dc=(e,s)=>{const{feature:n}=M(e,s),r=n.environments.map(a=>a.name);return new Set(r)},Fc=(e,s=Ne)=>{const{featureMetrics:n=[]}=Ks(e,s),r=n.map(a=>a.appName);return new Set(r)},Rc=(e,s)=>{const n=new Set(e),r=new Set(s);return n.size!==r.size?!1:[...n].every(a=>r.has(a))},es=p("div")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),ts=p(ie)(({theme:e})=>({marginBottom:e.spacing(1)})),$c=p(Ct)({padding:0}),kc=({projectId:e,open:s,onClose:n,onClick:r,feature:a,changeRequests:o})=>{const i=A("projectId"),{project:c}=Rs(e),{isChangeRequestConfiguredInAnyEnv:l}=Z(e),d=l(),u=g.useMemo(()=>Rc(a.environments.map(j=>j.name),c.environments.map(j=>j.environment)),[a,c]),h=o?o.length>0:!1,m=a.dependencies.length>0||a.children.length>0;return t.jsx(b,{condition:u&&!m&&!h&&!d,show:t.jsx(oe,{open:s,onClose:n,onClick:r,title:"Confirm change project",primaryButtonText:"Change project",secondaryButtonText:"Cancel",children:t.jsxs(es,{children:[t.jsx(ts,{severity:"success",children:"This feature toggle is compatible with the new project."}),t.jsx("p",{children:"Are you sure you want to change the project for this toggle?"})]})}),elseShow:t.jsx(oe,{open:s,onClick:n,title:"Confirm change project",primaryButtonText:"Close",children:t.jsxs(es,{children:[t.jsx(ts,{severity:"warning",children:"Cannot proceed with the move"}),t.jsx(b,{condition:m,show:t.jsxs("p",{children:[t.jsx("span",{children:"The feature toggle must not have any dependencies."})," ",t.jsx("br",{}),t.jsx("span",{children:"Please remove feature dependencies first."})]})}),t.jsx(b,{condition:!u,show:t.jsx("p",{children:"In order to move a feature toggle between two projects, both projects must have the exact same environments enabled."})}),t.jsx(b,{condition:h,show:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:"The feature toggle must not have any pending change requests. This feature toggle is currently referenced in the following change requests:"}),t.jsx($c,{children:o==null?void 0:o.map(j=>t.jsx(ve,{children:t.jsxs(Q,{to:`/projects/${i}/change-requests/${j.id}`,children:["View change request"," ",j.id]})},j.id))})]})}),t.jsx(b,{condition:d,show:t.jsxs("p",{children:["You're not allowed to move the feature to project"," ",t.jsx(Q,{to:`/projects/${e}/settings/change-requests`,children:e}),". This project has change requests enabled."]})})]})})})},Ic=()=>{const{hasAccess:e}=g.useContext(xt),s=A("projectId"),n=A("featureId"),{feature:r,refetchFeature:a}=M(s,n),[o,i]=g.useState(!1),{changeFeatureProject:c}=Ye(),{setToastData:l,setToastApiError:d}=U(),[u,h]=g.useState(s),{projects:m}=Ta(),j=ce(),{changeRequests:y}=Ls(s,n),T=async()=>{try{u&&(await c(s,n,u),a(),l({title:"Project changed",type:"success"}),i(!1),j(`/projects/${u}/features/${n}/settings`,{replace:!0}))}catch(x){d(N(x))}},f=g.useMemo(()=>m.map(x=>x.id).filter(x=>e(Bt,x)),[m,e]);return f.length===0?null:t.jsxs(t.Fragment,{children:[t.jsx(Ea,{value:u,onChange:h,label:"Project",filter:x=>f.includes(x),enabled:!0}),t.jsx(pe,{permission:Bt,onClick:()=>i(!0),disabled:u===s,projectId:s,children:"Save"}),t.jsx(kc,{changeRequests:y,projectId:u,open:o,feature:r,onClose:()=>i(!1),onClick:T})]})},Pc=p("div")({display:"flex",alignItems:"center"}),Oc=p(W)(({theme:e})=>({fontSize:e.fontSizes.mainHeader})),Bc=({projectId:e,featureId:s})=>{var o;const{feature:n}=M(e,s),r=ce(),a=()=>{r(`/projects/${e}/features/${s}/edit`)};return t.jsxs(t.Fragment,{children:[t.jsxs(Pc,{children:[t.jsx(Oc,{children:"Feature information"}),t.jsx(re,{permission:Ce,projectId:e,"data-loading":!0,onClick:a,tooltipProps:{title:"Edit"},children:t.jsx(we,{})})]}),t.jsxs(W,{children:["Name: ",t.jsx("strong",{children:n.name})]}),t.jsxs(W,{children:["Description:"," ",t.jsx("strong",{children:(o=n.description)!=null&&o.length?n.description:"no description"})]}),t.jsxs(W,{children:["Type: ",t.jsx("strong",{children:n.type})]}),t.jsxs(W,{children:["Impression Data:"," ",t.jsx("strong",{children:n.impressionData?"enabled":"disabled"})]})]})},Le="metadata",ct="project",Lc=p("div")(({theme:e})=>({width:"20%",borderRight:`1px solid ${e.palette.divider}`,padding:e.spacing(2,0),[e.breakpoints.down("md")]:{width:"35%"}})),_c=p("div")(({theme:e})=>({padding:e.spacing(4),display:"flex",flexDirection:"column",width:400,"& > *":{margin:e.spacing(1,0)}})),Mc=()=>{const e=A("projectId"),s=A("featureId"),[n,r]=g.useState(Le),{uiConfig:a}=fe();return t.jsx(Et,{header:"Settings",sx:{padding:0},children:t.jsxs(K,{sx:{display:"flex"},children:[t.jsx(Lc,{children:t.jsxs(Ct,{children:[t.jsx(ve,{sx:{padding:"0.75rem 2rem"},button:!0,onClick:()=>r(Le),selected:n===Le,children:"Metadata"},0),t.jsx(ve,{sx:{padding:"0.75rem 2rem"},button:!0,onClick:()=>r(ct),selected:n===ct,hidden:!a.flags.P,children:"Project"},1)]})}),t.jsxs(_c,{children:[t.jsx(b,{condition:n===Le,show:t.jsx(Bc,{projectId:e,featureId:s})}),t.jsx(b,{condition:n===ct&&a.flags.P,show:t.jsx(Ic,{})})]})]})})},qc=({stale:e,showActive:s=!0})=>{if(!e&&!s)return null;const n=e?"Feature toggle is deprecated.":"Feature toggle is active.",r=e?"Stale":"Active";return t.jsx("div",{"data-loading":!0,style:{marginLeft:"8px"},children:t.jsx(Ee,{color:e?"error":"success",title:n,children:r})})},ss=p("strong")({wordBreak:"break-all"}),zc=()=>{const e=A("projectId"),s=A("featureId"),{archivedFeatures:n}=Aa(),r=Da(e,{name:s});return n?n.some(o=>o.name===s)?t.jsxs("p",{children:["The feature ",t.jsx(ss,{children:s})," has been archived. You can find it on the"," ",t.jsx(Q,{to:`/projects/${e}/archive`,children:"project archive page"}),"."]}):t.jsxs("p",{children:["The feature ",t.jsx(ss,{children:s})," does not exist. Would you like to"," ",t.jsx(Q,{to:r,children:"create it"}),"?"]}):null},Vc=p(Q)(({theme:e})=>({textDecoration:"none",color:e.palette.primary.main,fontWeight:e.fontWeight.bold})),Nc=({isOpen:e,onClose:s,features:n,project:r})=>t.jsxs(oe,{title:"You can't archive a feature that other features depend on",open:e,primaryButtonText:"OK",onClick:s,children:[t.jsx("p",{children:"The following features depend on your feature:"}),t.jsx("ul",{children:n.map(a=>t.jsx("li",{children:t.jsx(Vc,{to:`/projects/${r}/features/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})},a))})]}),Hc=e=>g.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},g.createElement("path",{d:"M1 12a5 5 0 0 1 5-5h4a5 5 0 0 1 4.584 7H14a1.993 1.993 0 0 1-1.375-.547A3 3 0 0 0 10 9H6a3 3 0 1 0 0 6h2.803a6.03 6.03 0 0 0 1.822 1.961A5.033 5.033 0 0 1 10 17H6a5 5 0 0 1-5-5Z",fill:"#202021"}),g.createElement("path",{d:"M9 12c0-.711.148-1.387.416-2H10c.532 0 1.016.208 1.375.547A3 3 0 0 0 14 15h4a3 3 0 1 0 0-6h-2.803a6.03 6.03 0 0 0-1.822-1.961C13.58 7.013 13.788 7 14 7h4a5 5 0 0 1 0 10h-4a5 5 0 0 1-5-5Z",fill:"#202021"})),Wc=e=>g.createElement("svg",{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1 8a5 5 0 0 1 5-5h4a5 5 0 0 1 4.584 7H14a1.993 1.993 0 0 1-1.375-.547A3 3 0 0 0 10 5H6a3 3 0 0 0 0 6h2.803a6.03 6.03 0 0 0 1.822 1.961A5.033 5.033 0 0 1 10 13H8v3a1 1 0 0 0 1 1h1.17A3.001 3.001 0 0 1 13 15h7a3 3 0 1 1 0 6h-7a3.001 3.001 0 0 1-2.83-2H9a3 3 0 0 1-3-3v-3a5 5 0 0 1-5-5Zm8 0c0-.711.148-1.388.416-2H10c.532 0 1.016.208 1.375.547A3 3 0 0 0 14 11h4a3 3 0 1 0 0-6h-2.803a6.03 6.03 0 0 0-1.822-1.961C13.58 3.013 13.788 3 14 3h4a5 5 0 0 1 0 10h-4a5 5 0 0 1-5-5Z",fill:"#202021"})),Uc=p("div")(({theme:e})=>({backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadiusLarge,marginBottom:e.spacing(2)})),Yc=p("div")(({theme:e})=>({padding:e.spacing(2,4,2,2),display:"flex",justifyContent:"space-between",alignItems:"center",[e.breakpoints.down(500)]:{flexDirection:"column"}})),ns=p("div")({display:"flex",alignItems:"center"}),as=p("div")(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginTop:e.spacing(1),fontSize:e.fontSizes.smallBody,padding:e.spacing(.75,1.5),backgroundColor:e.palette.background.elevation2,borderRadius:`${e.shape.borderRadiusMedium}px`,width:"max-content"}));p(Hc)(({theme:e})=>({width:e.fontSizes.smallBody,height:e.fontSizes.smallBody}));p(Wc)(({theme:e})=>({width:e.fontSizes.smallBody,height:e.fontSizes.smallBody}));const Gc=p("h1")(({theme:e})=>({fontSize:e.fontSizes.mainHeader,fontWeight:"normal",display:"flex",alignItems:"center",wordBreak:"break-all"})),Kc=p("div")({flexShrink:0,display:"flex"}),Jc=p("div")(({theme:e})=>({width:"100%",backgroundColor:e.palette.divider,height:"1px"})),Qc=p("div")(({theme:e})=>({padding:e.spacing(0,4)})),Zc=p(Fa)(({theme:e})=>({textTransform:"none",width:"auto",fontSize:e.fontSizes.bodySize,padding:"0 !important",[e.breakpoints.up("md")]:{minWidth:160}})),Xc=p(Q)(({theme:e})=>({maxWidth:"100%",textDecoration:"none","&:hover, &:focus":{textDecoration:"underline"}})),el=()=>{var S,k;const e=A("projectId"),s=A("featureId"),{refetch:n}=Rs(e),{favorite:r,unfavorite:a}=Ra(),{refetchFeature:o}=M(e,s),{setToastData:i,setToastApiError:c}=U(),[l,d]=g.useState(!1),[u,h]=g.useState(!1),[m,j]=g.useState(!1),[y,T]=g.useState(!1),f=Ie("(max-width:500px)"),{feature:x,loading:R,error:L,status:q}=M(e,s),z=ce(),{pathname:v}=$a(),C=ka(R),$=`/projects/${e}/features/${s}`,O=[{title:"Overview",path:`${$}`,name:"overview"},{title:"Metrics",path:`${$}/metrics`,name:"Metrics"},{title:"Variants",path:`${$}/variants`,name:"Variants"},{title:"Settings",path:`${$}/settings`,name:"Settings"},{title:"Event log",path:`${$}/logs`,name:"Event log"}],V=O.find(w=>w.path===v)??O[0],G=async()=>{try{x!=null&&x.favorite?await a(e,x.name):await r(e,x.name),o()}catch{c("Something went wrong, could not update favorite")}};if(q===404)return t.jsx(zc,{});if(L!==void 0)return t.jsx("div",{ref:C});const Y=()=>{try{qa(x.name),T(!0),setTimeout(()=>{T(!1)},3e3)}catch{i({type:"error",title:"Could not copy feature name"})}};return t.jsxs("div",{ref:C,children:[t.jsxs(Uc,{children:[t.jsxs(Yc,{children:[t.jsxs(ns,{children:[t.jsx(Ia,{onClick:G,isFavorite:x==null?void 0:x.favorite}),t.jsxs("div",{children:[t.jsxs(ns,{children:[t.jsxs(Gc,{"data-loading":!0,children:[x.name," "]}),t.jsx(ee,{title:y?"Copied!":"Copy name",arrow:!0,children:t.jsx($e,{onClick:Y,style:{marginLeft:8},children:y?t.jsx(Pa,{style:{fontSize:16}}):t.jsx(Oa,{style:{fontSize:16}})})}),t.jsx(b,{condition:!f,show:t.jsx(qc,{stale:x==null?void 0:x.stale})})]}),t.jsx(b,{condition:x.dependencies.length>0,show:t.jsxs(as,{children:[t.jsx("b",{children:"Has parent: "}),t.jsx(Xc,{to:`/projects/${x.project}/features/${(S=x==null?void 0:x.dependencies[0])==null?void 0:S.feature}`,children:(k=x==null?void 0:x.dependencies[0])==null?void 0:k.feature})]})}),t.jsx(b,{condition:x.children.length>0,show:t.jsxs(as,{children:[t.jsx("b",{children:"Has children:"}),t.jsx(Us,{childFeatures:x.children,project:x.project})]})})]})]}),t.jsxs(Kc,{children:[t.jsx(re,{permission:Ba,projectId:e,"data-loading":!0,component:Q,to:`/projects/${e}/features/${s}/copy`,tooltipProps:{title:"Clone"},children:t.jsx(er,{})}),t.jsx(re,{permission:La,projectId:e,tooltipProps:{title:"Archive feature toggle"},"data-loading":!0,onClick:()=>h(!0),children:t.jsx(Za,{})}),t.jsx(re,{onClick:()=>j(!0),permission:Ce,projectId:e,tooltipProps:{title:"Toggle stale state"},"data-loading":!0,children:t.jsx(Ga,{})}),t.jsx(re,{onClick:()=>d(!0),permission:Ce,projectId:e,tooltipProps:{title:"Add tag"},"data-loading":!0,children:t.jsx(_a,{})})]})]}),t.jsx(Jc,{}),t.jsx(Qc,{children:t.jsx(Ma,{value:V.path,indicatorColor:"primary",textColor:"primary",children:O.map(w=>t.jsx(Zc,{label:w.title,value:w.path,onClick:()=>z(w.path),"data-testid":`TAB-${w.title}`},w.title))})})]}),t.jsxs(As,{children:[t.jsx(xe,{path:"metrics",element:t.jsx(Ac,{})}),t.jsx(xe,{path:"logs",element:t.jsx(sr,{})}),t.jsx(xe,{path:"variants",element:t.jsx(uc,{})}),t.jsx(xe,{path:"settings",element:t.jsx(Mc,{})}),t.jsx(xe,{path:"*",element:t.jsx($i,{})})]}),t.jsx(b,{condition:x.children.length>0,show:t.jsx(Nc,{features:x.children,project:e,isOpen:u,onClose:()=>h(!1)}),elseShow:t.jsx(Ka,{isOpen:u,onConfirm:()=>{n(),z(`/projects/${e}`)},onClose:()=>h(!1),projectId:e,featureIds:[s]})}),t.jsx(Ja,{isStale:x.stale,isOpen:m,onClose:()=>{j(!1),o()},featureId:s,projectId:e}),t.jsx(Gs,{open:l,setOpen:d})]})},al=Object.freeze(Object.defineProperty({__proto__:null,default:el},Symbol.toStringTag,{value:"Module"}));export{al as F,uo as d};
|
|
20
|
-
function __vite__mapDeps(indexes) {
|
|
21
|
-
if (!__vite__mapDeps.viteFileDeps) {
|
|
22
|
-
__vite__mapDeps.viteFileDeps = []
|
|
23
|
-
}
|
|
24
|
-
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
25
|
-
}
|