unleash-server 5.2.0 → 5.2.3
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/frontend/build/index.html +1 -1
- package/frontend/build/static/{AdvancedPlayground-520a25e1.js → AdvancedPlayground-b8d00f81.js} +1 -1
- package/frontend/build/static/{CreateProject-c430691b.js → CreateProject-fe1d0f0f.js} +1 -1
- package/frontend/build/static/{Error-492e8b38.js → Error-6550f020.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-70daa567.js → FeatureArchiveDialog-42d2cf92.js} +3 -3
- package/frontend/build/static/{FeatureMetricsChart-bc99b364.js → FeatureMetricsChart-70a6747e.js} +1 -1
- package/frontend/build/static/{FeatureViewLazyExport-01d70575.js → FeatureViewLazyExport-60874e5e.js} +2 -2
- package/frontend/build/static/{LazyAdminExport-e2c90193.js → LazyAdminExport-c5eec10c.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-fa62d2fe.js → LazyProjectExport-7f66ff80.js} +6 -6
- package/frontend/build/static/{NetworkOverview-3b72e4ea.js → NetworkOverview-b82ebe0c.js} +2 -2
- package/frontend/build/static/{NetworkTraffic-365db744.js → NetworkTraffic-51a825ea.js} +1 -1
- package/frontend/build/static/{Playground-b473b399.js → Playground-2b482aeb.js} +1 -1
- package/frontend/build/static/{PlaygroundGuidancePopper-8e3e97db.js → PlaygroundGuidancePopper-5673aca8.js} +1 -1
- package/frontend/build/static/{RoleCell-9bb513a8.js → RoleCell-c9b26e7a.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-1f7503c7.js → StrategyItemContainer-7b356e23.js} +1 -1
- package/frontend/build/static/{chartjs-adapter-date-fns.esm-db338d44.js → chartjs-adapter-date-fns.esm-04fda623.js} +1 -1
- package/frontend/build/static/{flowchart-elk-definition-170a3958-a428dd25.js → flowchart-elk-definition-170a3958-68f1625d.js} +1 -1
- package/frontend/build/static/{index-dc5debe9.js → index-545ad556.js} +1 -1
- package/frontend/build/static/{index-0a56292a.js → index-78d048a4.js} +79 -79
- package/frontend/build/static/{index-d362ae7a.js → index-b74e9af8.js} +1 -1
- package/frontend/build/static/{is_dark-884249e0.js → is_dark-77b9ee14.js} +1 -1
- package/frontend/build/static/{mindmap-definition-44684416-3c9425ff.js → mindmap-definition-44684416-4cca63a5.js} +1 -1
- package/frontend/build/static/{timeline-definition-8e5a9bc6-d289cd6d.js → timeline-definition-8e5a9bc6-31dad151.js} +1 -1
- package/frontend/build/static/{unknownify-5b23bf29.js → unknownify-53fb2d5d.js} +1 -1
- package/frontend/package.json +4 -3
- package/package.json +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f$ as lc,g0 as cc,g1 as T4,g2 as E4,g3 as C4,t as m2,r as Wh,j as Po,bW as S4,g4 as A4,g5 as L4,C as B4,A as D4,g6 as I4,g7 as M4}from"./index-
|
|
1
|
+
import{f$ as lc,g0 as cc,g1 as T4,g2 as E4,g3 as C4,t as m2,r as Wh,j as Po,bW as S4,g4 as A4,g5 as L4,C as B4,A as D4,g6 as I4,g7 as M4}from"./index-78d048a4.js";import{u as N4}from"./stringify-ec884b6d.js";import{u as R4,a as b2}from"./unknownify-53fb2d5d.js";const O4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F4(t){return typeof t=="string"&&O4.test(t)}function P4(t){if(!F4(t))throw TypeError("Invalid UUID");let e;const r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function V4(t){t=unescape(encodeURIComponent(t));const e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}const Y4="6ba7b810-9dad-11d1-80b4-00c04fd430c8",z4="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function U4(t,e,r){function i(n,s,a,o){var l;if(typeof n=="string"&&(n=V4(n)),typeof s=="string"&&(s=P4(s)),((l=s)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let h=new Uint8Array(16+n.length);if(h.set(s),h.set(n,s.length),h=r(h),h[6]=h[6]&15|e,h[8]=h[8]&63|128,a){o=o||0;for(let u=0;u<16;++u)a[o+u]=h[u];return a}return N4(h)}try{i.name=t}catch{}return i.DNS=Y4,i.URL=z4,i}function W4(t,e,r,i){switch(t){case 0:return e&r^~e&i;case 1:return e^r^i;case 2:return e&r^e&i^r&i;case 3:return e^r^i}}function eh(t,e){return t<<e|t>>>32-e}function H4(t){const e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){const a=unescape(encodeURIComponent(t));t=[];for(let o=0;o<a.length;++o)t.push(a.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);const i=t.length/4+2,n=Math.ceil(i/16),s=new Array(n);for(let a=0;a<n;++a){const o=new Uint32Array(16);for(let l=0;l<16;++l)o[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=o}s[n-1][14]=(t.length-1)*8/Math.pow(2,32),s[n-1][14]=Math.floor(s[n-1][14]),s[n-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<n;++a){const o=new Uint32Array(80);for(let p=0;p<16;++p)o[p]=s[a][p];for(let p=16;p<80;++p)o[p]=eh(o[p-3]^o[p-8]^o[p-14]^o[p-16],1);let l=r[0],h=r[1],u=r[2],f=r[3],d=r[4];for(let p=0;p<80;++p){const m=Math.floor(p/20),b=eh(l,5)+W4(m,h,u,f)+d+e[m]+o[p]>>>0;d=f,f=u,u=eh(h,30)>>>0,h=l,l=b}r[0]=r[0]+l>>>0,r[1]=r[1]+h>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+d>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}const q4=U4("v5",80,H4),G4=q4;function _2(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=Array.from(typeof t=="string"?[t]:t);i[i.length-1]=i[i.length-1].replace(/\r?\n([\t ]*)$/,"");var n=i.reduce(function(o,l){var h=l.match(/\n([\t ]+|(?!\s).)/g);return h?o.concat(h.map(function(u){var f,d;return(d=(f=u.match(/[\t ]/g))===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0})):o},[]);if(n.length){var s=new RegExp(`
|
|
2
2
|
[ ]{`+Math.min.apply(Math,n)+"}","g");i=i.map(function(o){return o.replace(s,`
|
|
3
3
|
`)})}i[0]=i[0].replace(/^\r?\n/,"");var a=i[0];return e.forEach(function(o,l){var h=a.match(/(?:^|\n)( *)$/),u=h?h[1]:"",f=o;typeof o=="string"&&o.includes(`
|
|
4
4
|
`)&&(f=String(o).split(`
|
|
@@ -1270,7 +1270,7 @@ Expecting `+Tt.join(", ")+", got '"+(this.terminals_[Y]||Y)+"'":$="Parse error o
|
|
|
1270
1270
|
`+k+"^"},test_match:function(x,k){var v,B,R;if(this.options.backtrack_lexer&&(R={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(R.yylloc.range=this.yylloc.range.slice(0))),B=x[0].match(/(?:\r\n?|\n).*/g),B&&(this.yylineno+=B.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:B?B[B.length-1].length-B[B.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],v=this.performAction.call(this,this.yy,this,k,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var P in R)this[P]=R[P];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,k,v,B;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),P=0;P<R.length;P++)if(v=this._input.match(this.rules[R[P]]),v&&(!k||v[0].length>k[0].length)){if(k=v,B=P,this.options.backtrack_lexer){if(x=this.test_match(v,R[P]),x!==!1)return x;if(this._backtrack){k=!1;continue}else return!1}else if(!this.options.flex)break}return k?(x=this.test_match(k,R[B]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
1271
1271
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var k=this.next();return k||this.lex()},begin:function(k){this.conditionStack.push(k)},popState:function(){var k=this.conditionStack.length-1;return k>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},pushState:function(k){this.begin(k)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(k,v,B,R){switch(B){case 0:return this.begin("open_directive"),26;case 1:return this.begin("type_directive"),27;case 2:return this.popState(),this.begin("arg_directive"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:break;case 6:break;case 7:return 11;case 8:break;case 9:break;case 10:return 4;case 11:return 17;case 12:return this.begin("acc_title"),18;case 13:return this.popState(),"acc_title_value";case 14:return this.begin("acc_descr"),20;case 15:return this.popState(),"acc_descr_value";case 16:this.begin("acc_descr_multiline");break;case 17:this.popState();break;case 18:return"acc_descr_multiline_value";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return"INVALID"}},rules:[/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}};return b}();d.lexer=p;function m(){this.yy={}}return m.prototype=d,d.Parser=m,new m}();e1.parser=e1;const fY=e1,dY=t=>t.match(/^\s*journey/)!==null;let zs="";const T0=[],to=[],eo=[],pY=function(t,e,r){xe.parseDirective(this,t,e,r)},gY=function(){T0.length=0,to.length=0,zs="",eo.length=0,Lr()},yY=function(t){zs=t,T0.push(t)},mY=function(){return T0},bY=function(){let t=l2();const e=100;let r=0;for(;!t&&r<e;)t=l2(),r++;return to.push(...eo),to},_Y=function(){const t=[];return to.forEach(r=>{r.people&&t.push(...r.people)}),[...new Set(t)].sort()},xY=function(t,e){const r=e.substr(1).split(":");let i=0,n=[];r.length===1?(i=Number(r[0]),n=[]):(i=Number(r[0]),n=r[1].split(","));const s=n.map(o=>o.trim()),a={section:zs,type:zs,people:s,task:t,score:i};eo.push(a)},vY=function(t){const e={section:zs,type:zs,description:t,task:t,classes:[]};to.push(e)},l2=function(){const t=function(r){return eo[r].processed};let e=!0;for(const[r,i]of eo.entries())t(r),e=e&&i.processed;return e},kY=function(){return _Y()},c2={parseDirective:pY,getConfig:()=>G().journey,clear:gY,setDiagramTitle:si,getDiagramTitle:ai,setAccTitle:kr,getAccTitle:Br,setAccDescription:Dr,getAccDescription:Ir,addSection:yY,getSections:mY,getTasks:bY,addTask:xY,addTaskOrg:vY,getActors:kY},Xc=function(t,e){const r=t.append("rect");return r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),r.attr("rx",e.rx),r.attr("ry",e.ry),e.class!==void 0&&r.attr("class",e.class),r},wY=function(t,e){const i=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=t.append("g");n.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function s(l){const h=nu().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}function a(l){const h=nu().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return e.score>3?s(n):e.score<3?a(n):o(n),i},Z3=function(t,e){const r=t.append("circle");return r.attr("cx",e.cx),r.attr("cy",e.cy),r.attr("class","actor-"+e.pos),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("r",e.r),r.class!==void 0&&r.attr("class",r.class),e.title!==void 0&&r.append("title").text(e.title),r},Q3=function(t,e){const r=e.text.replace(/<br\s*\/?>/gi," "),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.attr("class","legend"),i.style("text-anchor",e.anchor),e.class!==void 0&&i.attr("class",e.class);const n=i.append("tspan");return n.attr("x",e.x+e.textMargin*2),n.text(r),i},TY=function(t,e){function r(n,s,a,o,l){return n+","+s+" "+(n+a)+","+s+" "+(n+a)+","+(s+o-l)+" "+(n+a-l*1.2)+","+(s+o)+" "+n+","+(s+o)}const i=t.append("polygon");i.attr("points",r(e.x,e.y,50,20,7)),i.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,Q3(t,e)},EY=function(t,e,r){const i=t.append("g"),n=E0();n.x=e.x,n.y=e.y,n.fill=e.fill,n.width=r.width,n.height=r.height,n.class="journey-section section-type-"+e.num,n.rx=3,n.ry=3,Xc(i,n),J3(r)(e.text,i,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+e.num},r,e.colour)};let h2=-1;const CY=function(t,e,r){const i=e.x+r.width/2,n=t.append("g");h2++;const s=300+5*30;n.append("line").attr("id","task"+h2).attr("x1",i).attr("y1",e.y).attr("x2",i).attr("y2",s).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),wY(n,{cx:i,cy:300+(5-e.score)*30,score:e.score});const a=E0();a.x=e.x,a.y=e.y,a.fill=e.fill,a.width=r.width,a.height=r.height,a.class="task task-type-"+e.num,a.rx=3,a.ry=3,Xc(n,a);let o=e.x+14;e.people.forEach(l=>{const h=e.actors[l].color,u={cx:o,cy:e.y,r:7,fill:h,stroke:"#000",title:l,pos:e.actors[l].position};Z3(n,u),o+=10}),J3(r)(e.task,n,a.x,a.y,a.width,a.height,{class:"task"},r,e.colour)},SY=function(t,e){Xc(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},AY=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},E0=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},J3=function(){function t(n,s,a,o,l,h,u,f){const d=s.append("text").attr("x",a+l/2).attr("y",o+h/2+5).style("font-color",f).style("text-anchor","middle").text(n);i(d,u)}function e(n,s,a,o,l,h,u,f,d){const{taskFontSize:p,taskFontFamily:m}=f,b=n.split(/<br\s*\/?>/gi);for(let x=0;x<b.length;x++){const k=x*p-p*(b.length-1)/2,v=s.append("text").attr("x",a+l/2).attr("y",o).attr("fill",d).style("text-anchor","middle").style("font-size",p).style("font-family",m);v.append("tspan").attr("x",a+l/2).attr("dy",k).text(b[x]),v.attr("y",o+h/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(v,u)}}function r(n,s,a,o,l,h,u,f){const d=s.append("switch"),m=d.append("foreignObject").attr("x",a).attr("y",o).attr("width",l).attr("height",h).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");m.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(n),e(n,d,a,o,l,h,u,f),i(m,u)}function i(n,s){for(const a in s)a in s&&n.attr(a,s[a])}return function(n){return n.textPlacement==="fo"?r:n.textPlacement==="old"?t:e}}(),LY=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},ro={drawRect:Xc,drawCircle:Z3,drawSection:EY,drawText:Q3,drawLabel:TY,drawTask:CY,drawBackgroundRect:SY,getTextObj:AY,getNoteRect:E0,initGraphics:LY},BY=function(t){Object.keys(t).forEach(function(r){Kc[r]=t[r]})},Ui={};function DY(t){const e=G().journey;let r=60;Object.keys(Ui).forEach(i=>{const n=Ui[i].color,s={cx:20,cy:r,r:7,fill:n,stroke:"#000",pos:Ui[i].position};ro.drawCircle(t,s);const a={x:40,y:r+7,fill:"#666",text:i,textMargin:e.boxTextMargin|5};ro.drawText(t,a),r+=20})}const Kc=G().journey,Sn=Kc.leftMargin,IY=function(t,e,r,i){const n=G().journey;i.db.clear(),i.parser.parse(t+`
|
|
1272
1272
|
`);const s=G().securityLevel;let a;s==="sandbox"&&(a=_t("#i"+e));const o=_t(s==="sandbox"?a.nodes()[0].contentDocument.body:"body");Pr.init();const l=o.select("#"+e);ro.initGraphics(l);const h=i.db.getTasks(),u=i.db.getDiagramTitle(),f=i.db.getActors();for(const k in Ui)delete Ui[k];let d=0;f.forEach(k=>{Ui[k]={color:n.actorColours[d%n.actorColours.length],position:d},d++}),DY(l),Pr.insert(0,0,Sn,Object.keys(Ui).length*50),MY(l,h,0);const p=Pr.getBounds();u&&l.append("text").text(u).attr("x",Sn).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);const m=p.stopy-p.starty+2*n.diagramMarginY,b=Sn+p.stopx+2*n.diagramMarginX;ni(l,m,b,n.useMaxWidth),l.append("line").attr("x1",Sn).attr("y1",n.height*4).attr("x2",b-Sn-4).attr("y2",n.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");const x=u?70:0;l.attr("viewBox",`${p.startx} -25 ${b} ${m+x}`),l.attr("preserveAspectRatio","xMinYMin meet"),l.attr("height",m+x+25)},Pr={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},updateVal:function(t,e,r,i){t[e]===void 0?t[e]=r:t[e]=i(r,t[e])},updateBounds:function(t,e,r,i){const n=G().journey,s=this;let a=0;function o(l){return function(u){a++;const f=s.sequenceItems.length-a+1;s.updateVal(u,"starty",e-f*n.boxMargin,Math.min),s.updateVal(u,"stopy",i+f*n.boxMargin,Math.max),s.updateVal(Pr.data,"startx",t-f*n.boxMargin,Math.min),s.updateVal(Pr.data,"stopx",r+f*n.boxMargin,Math.max),l!=="activation"&&(s.updateVal(u,"startx",t-f*n.boxMargin,Math.min),s.updateVal(u,"stopx",r+f*n.boxMargin,Math.max),s.updateVal(Pr.data,"starty",e-f*n.boxMargin,Math.min),s.updateVal(Pr.data,"stopy",i+f*n.boxMargin,Math.max))}}this.sequenceItems.forEach(o())},insert:function(t,e,r,i){const n=Math.min(t,r),s=Math.max(t,r),a=Math.min(e,i),o=Math.max(e,i);this.updateVal(Pr.data,"startx",n,Math.min),this.updateVal(Pr.data,"starty",a,Math.min),this.updateVal(Pr.data,"stopx",s,Math.max),this.updateVal(Pr.data,"stopy",o,Math.max),this.updateBounds(n,a,s,o)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return this.data}},zh=Kc.sectionFills,u2=Kc.sectionColours,MY=function(t,e,r){const i=G().journey;let n="";const s=i.height*2+i.diagramMarginY,a=r+s;let o=0,l="#CCC",h="black",u=0;for(const[f,d]of e.entries()){if(n!==d.section){l=zh[o%zh.length],u=o%zh.length,h=u2[o%u2.length];const m={x:f*i.taskMargin+f*i.width+Sn,y:50,text:d.section,fill:l,num:u,colour:h};ro.drawSection(t,m,i),n=d.section,o++}const p=d.people.reduce((m,b)=>(Ui[b]&&(m[b]=Ui[b]),m),{});d.x=f*i.taskMargin+f*i.width+Sn,d.y=a,d.width=i.diagramMarginX,d.height=i.diagramMarginY,d.colour=h,d.fill=l,d.num=u,d.actors=p,ro.drawTask(t,d,i),Pr.insert(d.x,d.y,d.x+d.width+i.taskMargin,300+5*30)}},f2={setConf:BY,draw:IY};let d2={};const NY=function(t){d2={...d2,...t}},RY=(t,e,r)=>{try{I.debug(`Renering svg for syntax error
|
|
1273
|
-
`);const i=_t("#"+e),n=i.append("g");n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+r),i.attr("height",100),i.attr("width",500),i.attr("viewBox","768 0 912 512")}catch(i){I.error("Error while rendering info diagram"),I.error(PD(i))}},nc={setConf:NY,draw:RY},t4="flowchart-elk",OY=(t,e)=>{var r;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk")},FY=async()=>{const{diagram:t}=await import("./flowchart-elk-definition-170a3958-
|
|
1273
|
+
`);const i=_t("#"+e),n=i.append("g");n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in graph"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text("mermaid version "+r),i.attr("height",100),i.attr("width",500),i.attr("viewBox","768 0 912 512")}catch(i){I.error("Error while rendering info diagram"),I.error(PD(i))}},nc={setConf:NY,draw:RY},t4="flowchart-elk",OY=(t,e)=>{var r;return!!(t.match(/^\s*flowchart-elk/)||t.match(/^\s*flowchart|graph/)&&((r=e==null?void 0:e.flowchart)==null?void 0:r.defaultRenderer)==="elk")},FY=async()=>{const{diagram:t}=await import("./flowchart-elk-definition-170a3958-68f1625d.js");return{id:t4,diagram:t}},PY={id:t4,detector:OY,loader:FY},VY=PY,e4="timeline",YY=t=>t.match(/^\s*timeline/)!==null,zY=async()=>{const{diagram:t}=await import("./timeline-definition-8e5a9bc6-31dad151.js");return{id:e4,diagram:t}},UY={id:e4,detector:YY,loader:zY},WY=UY,r4="mindmap",HY=t=>t.match(/^\s*mindmap/)!==null,qY=async()=>{const{diagram:t}=await import("./mindmap-definition-44684416-4cca63a5.js");return{id:r4,diagram:t}},GY={id:r4,detector:HY,loader:qY},$Y=GY;let p2=!1;const _o=()=>{p2||(p2=!0,oy(VY,WY,$Y),Ye("error",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{}},init:()=>{}},t=>t.toLowerCase().trim()==="error"),Ye("---",{db:{clear:()=>{}},styles:Eu,renderer:nc,parser:{parser:{yy:{}},parse:()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with unindented `---` blocks")}},init:()=>null},t=>t.toLowerCase().trimStart().startsWith("---")),Ye("c4",{parser:GI,db:Fy,renderer:Nd,styles:Cy,init:t=>{Nd.setConf(t.c4)}},$I),Ye("class",{parser:Rd,db:fs,renderer:yN,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},VM),Ye("classDiagram",{parser:Rd,db:fs,renderer:LR,styles:va,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,fs.clear()}},YM),Ye("er",{parser:BR,db:YR,renderer:QR,styles:_y},DR),Ye("gantt",{parser:bO,db:g0,renderer:JO,styles:xy},_O),Ye("info",{parser:tF,db:sF,renderer:oF,styles:vy},lF),Ye("pie",{parser:cF,db:bF,renderer:xF,styles:ky},hF),Ye("requirement",{parser:vF,db:zF,renderer:KF,styles:wy},kF),Ye("sequence",{parser:ZF,db:Qd,renderer:t2,styles:Ty,init:t=>{if(t.sequence||(t.sequence={}),t.sequence.arrowMarkerAbsolute=t.arrowMarkerAbsolute,"sequenceDiagram"in t)throw new Error("`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.");Qd.setWrap(t.wrap),t2.setConf(t.sequence)}},QF),Ye("state",{parser:e2,db:Ri,renderer:zV,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},QP),Ye("stateDiagram",{parser:e2,db:Ri,renderer:uY,styles:Fl,init:t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Ri.clear()}},JP),Ye("journey",{parser:fY,db:c2,renderer:f2,styles:Ey,init:t=>{f2.setConf(t.journey),c2.clear()}},dY),Ye("flowchart",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,pO.setConf(t.flowchart),hi.clear(),hi.setGen("gen-1")}},JR),Ye("flowchart-v2",{parser:jd,db:hi,renderer:Fh,styles:Ol,init:t=>{t.flowchart||(t.flowchart={}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,gy({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),Fh.setConf(t.flowchart),hi.clear(),hi.setGen("gen-2")}},tO),Ye("gitGraph",{parser:gI,db:RI,renderer:WI,styles:qI},yI))};class r1{constructor(e,r){var i,n;this.txt=e,this.type="graph",this.detectTypeFailed=!1;const s=G();this.txt=e;try{this.type=W1(e,s)}catch(l){this.handleError(l,r),this.type="error",this.detectTypeFailed=!0}const a=Ly(this.type);I.debug("Type "+this.type),this.db=a.db,(n=(i=this.db).clear)==null||n.call(i),this.renderer=a.renderer,this.parser=a.parser;const o=this.parser.parse.bind(this.parser);this.parser.parse=l=>o(bD(l,this.db)),this.parser.parser.yy=this.db,a.init&&(a.init(s),I.info("Initialized diagram "+this.type,s)),this.txt+=`
|
|
1274
1274
|
`,this.parse(this.txt,r)}parse(e,r){var i,n;if(this.detectTypeFailed)return!1;try{return e=e+`
|
|
1275
1275
|
`,(n=(i=this.db).clear)==null||n.call(i),this.parser.parse(e),!0}catch(s){this.handleError(s,r)}return!1}handleError(e,r){if(r===void 0)throw e;if(q1(e)){r(e.str,e.hash);return}r(e)}getParser(){return this.parser}getType(){return this.type}}const C0=(t,e)=>{const r=W1(t,G());try{Ly(r)}catch{const n=vD(r);if(!n)throw new Error(`Diagram ${r} not found.`);return n().then(({diagram:s})=>(Ye(r,s,void 0),new r1(t,e)))}return new r1(t,e)},S0=r1,jY="graphics-document document";function XY(t,e){t.attr("role",jY),bs(e)||t.attr("aria-roledescription",e)}function KY(t,e,r,i){if(t.insert!==void 0)if(e||r){if(r){const n="chart-desc-"+i;t.attr("aria-describedby",n),t.insert("desc",":first-child").attr("id",n).text(r)}if(e){const n="chart-title-"+i;t.attr("aria-labelledby",n),t.insert("title",":first-child").attr("id",n).text(e)}}else return}const A0=["graph","flowchart","flowchart-v2","stateDiagram","stateDiagram-v2"],i4="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",n4="sandbox",s4="loose",ZY="http://www.w3.org/2000/svg",a4="http://www.w3.org/1999/xlink",o4="http://www.w3.org/1999/xhtml",QY="100%",JY="100%",tz="border:0;margin:0;",ez="margin:0",rz="allow-top-navigation-by-user-activation allow-popups",iz='The "iframe" tag is not supported by your browser.',l4=["foreignobject"],c4=["dominant-baseline"];function nz(t,e){return _o(),new S0(t,e).parse(t,e)}async function sz(t,e){return _o(),(await C0(t,e)).parse(t,e)}const h4=function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){const i=r.substring(1,r.length-1);return/^\+?\d+$/.test(i)?"fl°°"+i+"¶ß":"fl°"+i+"¶ß"}),e},L0=function(t){let e=t;return e=e.replace(/fl°°/g,"&#"),e=e.replace(/fl°/g,"&"),e=e.replace(/¶ß/g,";"),e},g2=(t,e,r=[])=>`
|
|
1276
1276
|
.${t} ${e} { ${r.join(" !important; ")} !important; }`,az=(t,e,r={})=>{var i;let n="";if(t.themeCSS!==void 0&&(n+=`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var C=(t,e,r)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(C(t,typeof e!="symbol"?e+"":e,r),r);import{bK as k,b as v,r as d,bW as w,j as s,C as P,A as S,f_ as u}from"./index-
|
|
1
|
+
var f=Object.defineProperty;var C=(t,e,r)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>(C(t,typeof e!="symbol"?e+"":e,r),r);import{bK as k,b as v,r as d,bW as w,j as s,C as P,A as S,f_ as u}from"./index-78d048a4.js";import{u as T,a as g}from"./unknownify-53fb2d5d.js";import{L as A,C as I,a as M,b as L,P as N,c as R,T as _,p as q,e as D,f as E}from"./chartjs-adapter-date-fns.esm-04fda623.js";import{B as W}from"./RoleCell-c9b26e7a.js";import"./index-b74e9af8.js";import"./index-545ad556.js";class j{constructor(e){o(this,"current",0);o(this,"all");this.all=e}next(){const e=this.all[this.current];return this.current=(this.current+1)%this.all.length,e}}const m=["circle","rect","rectRounded","rectRot","triangle"],B=(t,e)=>t.map(r=>({x:r[0],y:e(r[1])})),H=(t,e)=>({locale:e.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:t.palette.text.secondary,plugins:{tooltip:{backgroundColor:t.palette.background.paper,bodyColor:t.palette.text.primary,titleColor:t.palette.action.active,borderColor:t.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:r=>u(1e3*r[0].parsed.x,e.locale)},itemSort:(r,i)=>i.parsed.y-r.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:t.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:t.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:t.palette.text.secondary},grid:{color:t.palette.divider,borderColor:t.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:t.palette.divider,borderColor:t.palette.divider},ticks:{callback:(r,i,a)=>u(a[i].value*1e3,e.locale)}}}});class ${constructor(e){o(this,"items");o(this,"picked",new Map);this.items=new j(e)}pick(e){return this.picked.has(e)||this.picked.set(e,this.items.next()),this.picked.get(e)}}const z=(t,e)=>{var r;if((r=e==null?void 0:e.data)!=null&&r.result){const i=new $([t.palette.success,t.palette.error,t.palette.primary,t.palette.warning]);return e.data.result.map((a,y)=>{var c,p;const n=g((c=a.metric)==null?void 0:c.endpoint),b=g((p=a.metric)==null?void 0:p.appName),l=i.pick(n),h=a.values||[];return{label:`${n}: ${b}`,borderColor:l.main,backgroundColor:l.main,data:B(h,x=>parseFloat(x)),elements:{point:{radius:4,pointStyle:m[y%m.length]},line:{borderDash:[8,4]}}}})}return[]},V=()=>{const{locationSettings:t}=k(),{metrics:e}=T(),r=v(),i=d.useMemo(()=>H(r,t),[r,t]);w("Network - Traffic");const a=d.useMemo(()=>({datasets:z(r,e)}),[r,e,t]);return s(P,{condition:a.datasets.length===0,show:s(S,{severity:"warning",children:"No data available."}),elseShow:s(W,{sx:{display:"grid",gap:4},children:s("div",{style:{height:400},children:s(A,{data:a,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};I.register(M,L,N,R,_,q,D,E);export{V as NetworkTraffic,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as D,u as V,a as M,r as d,b as $,d as I,j as t,L as U,e as A,f as w,s as G,H as O,g as q,h as P,F as J,B as C,T as z,S as Q,C as j,i as N,k as K,V as X,l as Y,m as Z,n as W,P as _,o as ee,p as te,q as ae}from"./index-
|
|
1
|
+
import{c as D,u as V,a as M,r as d,b as $,d as I,j as t,L as U,e as A,f as w,s as G,H as O,g as q,h as P,F as J,B as C,T as z,S as Q,C as j,i as N,k as K,V as X,l as Y,m as Z,n as W,P as _,o as ee,p as te,q as ae}from"./index-78d048a4.js";import{V as se,F as re,a as oe,u as ne,r as le,b as ie,P as ce,c as de,d as ue,e as he}from"./PlaygroundGuidancePopper-5673aca8.js";import"./StrategyItemContainer-7b356e23.js";import"./Error-6550f020.js";const me={id:"name"},{value:B,setValue:pe}=D("PlaygroundResultsTable:v1",me),fe=({features:f,input:m,loading:o})=>{const[u,b]=V(),h=M(o),[s,S]=d.useState(u.get("search")||""),x=$(),i=I(x.breakpoints.down("sm")),E=I(x.breakpoints.down("md")),g=d.useMemo(()=>[{Header:"Name",accessor:"name",searchable:!0,minWidth:160,Cell:({value:e,row:{original:a}})=>t(U,{title:e,to:`/projects/${a==null?void 0:a.projectId}/features/${e}`})},{Header:"Project ID",accessor:"projectId",sortType:"alphanumeric",filterName:"projectId",searchable:!0,maxWidth:170,Cell:({value:e})=>t(U,{title:e,to:`/projects/${e}`})},{Header:"Variant",id:"variant",accessor:"variant.name",sortType:"alphanumeric",filterName:"variant",searchable:!0,maxWidth:200,Cell:({value:e,row:{original:{variant:a,feature:l,variants:y,isEnabled:L}}})=>t(se,{variant:a!=null&&a.enabled?e:"",variants:y,feature:l,isEnabled:L})},{id:"isEnabled",Header:"isEnabled",filterName:"isEnabled",accessor:e=>{var a;return e!=null&&e.isEnabled?"true":((a=e==null?void 0:e.strategies)==null?void 0:a.result)==="unknown"?"unknown":"false"},Cell:({row:e})=>t(re,{feature:e.original}),sortType:"playgroundResultState",maxWidth:120,sortInverted:!0},{Header:"",maxWidth:70,id:"info",Cell:({row:e})=>t(oe,{feature:e.original,input:m})}],[m]),{data:c,getSearchText:F,getSearchContext:T}=A(g,s,f||[]),n=d.useMemo(()=>o?Array(5).fill({name:"Feature name",projectId:"FeatureProject",variant:{name:"FeatureVariant",variants:[]},enabled:!0}):c,[c,o]),[R]=d.useState(()=>({sortBy:[{id:u.get("sort")||B.id,desc:u.has("order")?u.get("order")==="desc":B.desc}]})),{headerGroups:k,rows:v,state:{sortBy:p},prepareRow:H,setHiddenColumns:r}=w.useTable({initialState:R,columns:g,data:n,sortTypes:G,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:O}},w.useGlobalFilter,w.useFlexLayout,w.useSortBy);return q([{condition:i,columns:["variant"]},{condition:E,columns:["projectId"]}],r,g),d.useEffect(()=>{if(o)return;const e=Object.fromEntries(u);e.sort=p[0].id,p[0].desc?e.order="desc":e.order&&delete e.order,s?e.search=s:delete e.search,b(e,{replace:!0}),pe({id:p[0].id,desc:p[0].desc||!1})},[o,p,s]),P(J,{children:[P(C,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[t(z,{variant:"subtitle1",sx:{ml:1},children:f!==void 0&&!o?`Results (${v.length<n.length?`${v.length} of ${n.length}`:n.length})`:"Results"}),t(Q,{initialValue:s,onChange:S,hasFilters:!0,getSearchContext:T,disabled:o,containerStyles:{marginLeft:"1rem",maxWidth:"400px"}})]}),t(j,{condition:!o&&!n,show:()=>t(N,{children:n===void 0?"None of the feature toggles were evaluated yet.":"No results found."}),elseShow:()=>P(C,{ref:h,children:[t(K,{value:F(s),children:t(X,{rows:v,headerGroups:k,prepareRow:H})}),t(j,{condition:n.length===0&&(s==null?void 0:s.length)>0,show:P(N,{children:["No feature toggles found matching “",s,"”"]})}),t(j,{condition:n&&n.length===0&&!s,show:t(N,{children:"No features toggles to display"})})]})})]})},xe=()=>{const{environments:f}=Y(),m=$(),o=I(m.breakpoints.down("lg")),[u,b]=d.useState([]),[h,s]=d.useState([]),[S,x]=d.useState(),[i,E]=d.useState(),{setToastData:g}=Z(),[c,F]=V(),{evaluatePlayground:T,loading:n}=ne();d.useEffect(()=>{b([le(f)])},[JSON.stringify(f)]),d.useEffect(()=>{try{const r=c.get("environment");r&&b([r]);let e,a=c.get("projects");a&&(e=a.split(","),s(e));let l=c.get("context");l&&(l=decodeURI(l),x(l)),(async()=>{r&&l&&await R(r,e||"*",l)})()}catch(r){g({type:"error",title:`Failed to parse URL parameters: ${W(r)}`})}},[]);const R=async(r,e,a,l)=>{try{const y=JSON.parse(a||"{}"),L=await T({environment:r,projects:ie(e),context:{appName:"playground",...y}});l&&typeof l=="function"&&l(),E(L)}catch(y){g({type:"error",title:`Error parsing context: ${W(y)}`})}},k=async r=>{r.preventDefault(),await R(u[0],h,S,v)},v=()=>{c.set("context",encodeURI(S||"")),c.set("environment",u[0]),Array.isArray(h)&&h.length>0&&!(h.length===1&&h[0]==="*")?c.set("projects",h.join(",")):c.delete("projects"),F(c)},p=i&&!o?"35%":"auto",H=he(o,i);return t(_,{header:t(ee,{title:"Unleash playground",actions:t(ce,{})}),disableLoading:!0,bodyClass:"no-padding",children:P(C,{sx:{display:"flex",flexDirection:o?"column":"row"},children:[t(C,{sx:{background:m.palette.background.elevation2,borderBottomLeftRadius:m.shape.borderRadiusMedium},children:t(te,{elevation:0,sx:{px:4,py:3,mb:4,mt:2,background:m.palette.background.elevation2,transition:"width 0.4s ease",minWidth:o?"auto":"500px",width:p,position:"sticky",top:0},children:t(de,{onSubmit:k,context:S,setContext:x,availableEnvironments:f,projects:h,environments:u,setProjects:s,setEnvironments:b})})}),t(C,{sx:r=>({width:H,transition:"width 0.4s ease",padding:r.spacing(4,2)}),children:t(j,{condition:n,show:t(ae,{}),elseShow:t(j,{condition:!!i,show:t(fe,{loading:n,features:i==null?void 0:i.features,input:i==null?void 0:i.input}),elseShow:t(ue,{})})})})]})})};export{xe as Playground,xe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as Vi,j as m,r as H,b as Pe,C as K,G as xi,t as z,B as Y,T as re,J as Wf,f as ks,s as Vf,h as E,K as Hf,M as zf,N as $f,O as qf,Q as jf,F as tt,R as Uf,U as Po,I as Ai,w as Ea,x as La,W as Kf,A as Mn,X as Hi,Y as Gf,Z as Ia,_ as Qf,$ as Jf,a0 as Xs,a1 as mn,a2 as Zs,a3 as _f,a4 as Yf,a5 as Xf,a6 as Qr,a7 as Zf,a8 as eu,a9 as tu,aa as Jr,ab as iu,ac as nu,m as su,ad as ru,n as Ro,ae as ou,af as lu,ag as au,ah as hu,ai as Na,aj as Bo,ak as Eo,al as wi,am as er,an as cu,ao as tr,ap as fu,p as uu,aq as du}from"./index-0a56292a.js";import{S as pu}from"./StrategyItemContainer-1f7503c7.js";import{E as mu}from"./Error-492e8b38.js";const rs=Vi(m("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined"),gu=Vi(m("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"CheckCircleOutline"),yu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),bu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help"),xu=Vi(m("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined"),wu=n=>H.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},H.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84818 0.184159C8.56367 -0.0789547 8.1234 -0.0575747 7.86482 0.231912C7.60623 0.521399 7.62724 0.96937 7.91175 1.23248C9.48292 2.68551 10.6076 4.74934 10.6076 7C10.6076 9.25066 9.48292 11.3145 7.91175 12.7675C7.62724 13.0306 7.60623 13.4786 7.86482 13.7681C8.1234 14.0576 8.56367 14.079 8.84818 13.8158C10.6396 12.1592 11.9998 9.73702 11.9998 7C11.9998 4.26298 10.6396 1.84083 8.84818 0.184159ZM6.04105 2.23302C6.29109 1.93586 6.73054 1.90121 7.02259 2.15563C8.33146 3.29586 9.35426 5.02309 9.35426 6.99995C9.35426 8.97682 8.33145 10.7039 7.02259 11.8441C6.73054 12.0986 6.29109 12.0639 6.04105 11.7668C5.79101 11.4696 5.82506 11.0225 6.11711 10.768C7.19425 9.82969 7.96199 8.46967 7.96199 6.99995C7.96199 5.53021 7.19423 4.17007 6.11711 3.23173C5.82506 2.97731 5.79101 2.53017 6.04105 2.23302ZM6.56908 7.00015C6.56908 8.56492 5.3224 9.83342 3.78454 9.83342C2.24668 9.83342 1 8.56492 1 7.00015C1 5.43539 2.24668 4.16689 3.78454 4.16689C5.3224 4.16689 6.56908 5.43539 6.56908 7.00015Z",fill:"currentColor"})),vu=n=>H.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},H.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84835 0.184159C8.56384 -0.0789547 8.12358 -0.0575747 7.86499 0.231912C7.6064 0.521399 7.62741 0.96937 7.91192 1.23248C9.4831 2.68551 10.6078 4.74934 10.6078 7C10.6078 7.40738 10.5709 7.80863 10.5012 8.20125L11.6597 9.35972C11.8783 8.60937 12 7.81877 12 7C12 4.26298 10.6397 1.84083 8.84835 0.184159ZM9.35443 6.99995L9.35418 7.0542L7.63252 5.33255C7.30901 4.52372 6.76993 3.80029 6.11728 3.23173C5.82523 2.97731 5.79118 2.53017 6.04122 2.23302C6.29127 1.93586 6.73072 1.90121 7.02276 2.15563C8.33164 3.29586 9.35443 5.02309 9.35443 6.99995ZM7.57827 8.79752L6.48307 7.70233C6.17606 8.92745 5.08437 9.83342 3.78471 9.83342C2.24685 9.83342 1.00017 8.56492 1.00017 7.00015C1.00017 5.69492 1.8676 4.59583 3.04789 4.26714L0.458225 1.67748C0.172794 1.39205 0.178843 0.923223 0.471736 0.63033C0.764629 0.337437 1.23345 0.331388 1.51889 0.616819L13.2132 12.3111C13.4986 12.5965 13.4926 13.0654 13.1997 13.3583C12.9068 13.6511 12.4379 13.6572 12.1525 13.3718L10.556 11.7753C10.0694 12.539 9.48623 13.2259 8.84835 13.8158C8.56384 14.079 8.12358 14.0576 7.86499 13.7681C7.6064 13.4786 7.62741 13.0306 7.91192 12.7675C8.54021 12.1865 9.0971 11.5078 9.53922 10.7585L8.62356 9.84281C8.20906 10.6195 7.64861 11.2989 7.02276 11.8441C6.73072 12.0986 6.29127 12.0639 6.04122 11.7668C5.79118 11.4696 5.82523 11.0225 6.11728 10.768C6.73471 10.2302 7.25048 9.55374 7.57827 8.79752Z",fill:"currentColor"})),On=({enabled:n,label:e,showIcon:t=!0})=>{const i=Pe(),s=m(K,{condition:n==="unknown"||n==="unevaluated",show:m(xu,{color:"warning",fontSize:"inherit"}),elseShow:m(K,{condition:typeof n=="boolean"&&!!n,show:m(wu,{color:i.palette.success.main,strokeWidth:"0.25"}),elseShow:m(vu,{color:i.palette.error.main,strokeWidth:"0.25"})})});return m(K,{condition:n==="unknown"||n==="unevaluated",show:m(xi,{icon:t?s:void 0,color:"warning",children:e}),elseShow:m(K,{condition:typeof n=="boolean"&&!!n,show:m(xi,{color:"success",icon:t?s:void 0,children:e}),elseShow:m(xi,{color:"error",icon:t?s:void 0,children:e})})})},ku=z(Y)(({theme:n})=>({display:"flex",alignItems:"center",padding:n.spacing(1,0,1,2)})),Su=z(Y)(()=>({marginRight:"auto"})),kb=({feature:n})=>{const[e,t]=(()=>{var i;return n!=null&&n.isEnabled?[!0,"True"]:((i=n==null?void 0:n.strategies)==null?void 0:i.result)==="unknown"?["unknown","Unknown"]:[!1,"False"]})();return m(ku,{children:m(Su,{"data-loading":!0,children:m(On,{enabled:e,label:t,showIcon:e!=="unknown"})})})},Cu=z("div")(({theme:n})=>({padding:n.spacing(4),maxWidth:"400px"})),Ss=z(re)(({theme:n})=>({marginBottom:n.spacing(2)})),Au=z(yu)(({theme:n})=>({color:n.palette.success.main})),Mu=({variants:n,selectedVariant:e})=>{const t=Pe(),i=H.useMemo(()=>n.map(c=>({name:c.name,weight:`${Wf(c.weight)}%`,selected:c.name===e})),[n,e]),s=H.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{getTableProps:r,getTableBodyProps:o,headerGroups:l,rows:a,prepareRow:h}=ks.useTable({initialState:s,columns:Ou,data:i,sortTypes:Vf,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},ks.useGlobalFilter,ks.useSortBy);return E(Cu,{children:[m(Ss,{variant:"subtitle2",children:"Variant Information"}),m(Ss,{variant:"body2",children:"The following table shows the variants defined on this feature toggle and the variant result based on your context configuration."}),m(Ss,{variant:"body2",children:'If you include "userId" or "sessionId" in your context, the variant will be the same every time because unleash uses these properties to ensure that the user receives the same experience.'}),E(Hf,{...r(),rowHeight:"dense",children:[m(zf,{headerGroups:l}),m($f,{...o(),children:a.map(c=>{let f={};return c.original.selected||(f.color=t.palette.text.secondary),h(c),m(qf,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>m(jf,{...u.getCellProps(),style:f,children:u.render("Cell")}))})})})]})]})},Ou=[{id:"Icon",Cell:({row:{original:{selected:n}}})=>m(tt,{children:m(K,{condition:n,show:m(Uf,{icon:m(Au,{})})})}),maxWidth:25,disableGlobalFilter:!0},{Header:"Name",accessor:"name",searchable:!0,Cell:({row:{original:{name:n}}})=>m(Po,{children:n}),maxWidth:175,width:175},{Header:"Weight",accessor:"weight",sortType:"alphanumeric",searchable:!0,maxWidth:75,Cell:({row:{original:{weight:n}}})=>m(Po,{children:n})}],Du=z("div")(()=>({maxWidth:"100%",display:"flex",alignItems:"center",wordBreak:"break-all"})),Sb=({variant:n,variants:e,feature:t,isEnabled:i})=>{const s=Pe(),[r,o]=H.useState(null),l=c=>o(c.currentTarget),a=()=>o(null),h=!!r;return E(Du,{children:[n,m(K,{condition:!!e&&e.length>0&&i,show:E(tt,{children:[m(Ai,{onClick:l,children:m(Ea,{})}),m(La,{open:h,id:`${t}-result-variants`,PaperProps:{sx:{borderRadius:`${s.shape.borderRadiusLarge}px`}},onClose:a,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:-320},children:m(Mu,{variants:e,selectedVariant:n})})]})})]})},Fa=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress","userWithId"];function Wa(n){return n===void 0?!0:Object.values(n).every(e=>e&&typeof e=="object"?Wa(e):e===null)}const Lo=n=>{var e,t;return(t=(e=n.strategies)==null?void 0:e.data)==null?void 0:t.find(i=>!Fa.includes(i.name))},Tu=n=>{var e,t;return!((t=(e=n.strategies)==null?void 0:e.data)!=null&&t.find(i=>Fa.includes(i.name)))},Pu=z("div")({display:"flex",justifyContent:"space-between",width:"100%"}),Ru=z("div")(({theme:n})=>({display:"inline-flex",alignItems:"center",gap:n.spacing(1.5),marginTop:n.spacing(1.5)})),Io=z("div")(({theme:n})=>({margin:n.spacing(1,0)})),Bu=z("div")(({theme:n})=>({margin:n.spacing(1,.5)})),Eu=z(re)(({theme:n})=>({fontWeight:600,padding:n.spacing(.5)})),Lu=z(Ai)({textAlign:"right"}),Iu=({feature:n,input:e,onClose:t})=>{var c;const i=Pe(),[s,r,o]=(()=>n.isEnabled?[`This feature toggle is True in ${e==null?void 0:e.environment} because `,"at least one strategy is True",i.palette.success.main]:n.isEnabledInCurrentEnvironment?Tu(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"no strategies could be fully evaluated",i.palette.warning.main]:Lo(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"not all strategies could be fully evaluated",i.palette.warning.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"all strategies are either False or could not be fully evaluated",i.palette.error.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"the environment is disabled",i.palette.error.main])(),l=Wa(e==null?void 0:e.context)?"You did not provide a value for your context field in step 2 of the configuration":void 0,a=Lo(n)?"This feature uses custom strategies. Custom strategies can't be evaluated, so they will be marked accordingly.":void 0,h=t&&(f=>{f.stopPropagation(),t()});return E(tt,{children:[E(Pu,{children:[E(Ru,{children:[m(Eu,{variant:"subtitle1",children:n.name}),m(K,{condition:((c=n==null?void 0:n.strategies)==null?void 0:c.result)!=="unknown",show:()=>m(On,{enabled:n.isEnabled,label:n.isEnabled?"True":"False"}),elseShow:()=>m(On,{enabled:"unknown",label:"Unknown",showIcon:!1})})]}),m(Lu,{onClick:h,children:m(Kf,{})})]}),E(Bu,{children:[m(re,{variant:"body1",component:"span",children:s}),m(re,{variant:"subtitle1",color:o,component:"span",children:r}),m(re,{variant:"body1",component:"span",children:"."})]}),m(K,{condition:!!l,show:m(Io,{children:m(Mn,{color:"info",children:l})})}),m(K,{condition:!!a,show:m(Io,{children:m(Mn,{severity:"warning",color:"info",children:a})})})]})},Nu=z("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.error.main})),Fu=({constraint:n,input:e})=>E(Nu,{children:[m(rs,{style:{marginRight:"0.25rem"}}),m(re,{variant:"body2",children:(()=>{const i=e==null?void 0:e.context[n.contextName];return i?`Constraint not met – the value in the context: { ${i} } is not ${n.operator} ${n.contextName}`:`Constraint not met – no value was specified for ${n.contextName}`})()})]}),Wu=z(gu)(({theme:n})=>({color:n.palette.success.main})),Vu=z("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.success.main})),Hu=()=>E(Vu,{children:[m(Wu,{style:{marginRight:"0.25rem"}}),m(re,{variant:"body2",children:"Constraint met by value in context"})]}),zu=z("div")(()=>({width:"100%",display:"flex",flexDirection:"column"})),Va=({constraints:n,input:e})=>n?m(zu,{children:n==null?void 0:n.map((t,i)=>E(H.Fragment,{children:[m(K,{condition:i>0,show:m(Hi,{text:"AND"})}),m(Gf,{constraint:t,compact:!0,renderAfter:m(K,{condition:t.result,show:m(Hu,{}),elseShow:m(Fu,{input:e,constraint:t})})})]},Ia(t)))}):null,$u=z("div")(({theme:n})=>({color:n.palette.error.main,display:"inline-flex",justifyContent:"center",marginLeft:"auto",gap:n.spacing(1)})),qu=({segments:n,input:e})=>n?m(tt,{children:n.map((t,i)=>E(H.Fragment,{children:[m(Qf,{segment:t,constraintList:m(Va,{constraints:t.constraints,input:e}),headerContent:m(K,{condition:!t.result,show:E($u,{children:[m(re,{variant:"subtitle2",sx:{pt:.25},children:"segment is false"}),m("span",{children:m(rs,{})})]})}),isExpanded:!0}),m(K,{condition:i>=0&&n.length>1&&i!==n.length-1,show:m(Hi,{text:"AND"})})]},t.id))}):null,ju=z("div",{shouldForwardProp:n=>n!=="showReason"})(({theme:n,showReason:e})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.divider}`,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.spacing(2),opacity:e?.9:1,backgroundColor:e?n.palette.background.paper:"inherit"})),Uu=z("div")(({theme:n})=>({flexDirection:"column"})),Ku=z(Jf)(({theme:n})=>({margin:n.spacing(.5)})),Gu=z("p")(({theme:n})=>({display:"inline",margin:n.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),Cs=({value:n,text:e,input:t,showReason:i=!1})=>{const s=Pe(),r=t==="no value"?"error":"neutral",o=`value does not match any ${e}`;return E(ju,{showReason:i,children:[m(re,{variant:"subtitle1",color:s.palette[r].main,children:`${t}`}),E(Uu,{children:[m(K,{condition:!!i,show:m(re,{variant:"subtitle1",color:s.palette.error.main,children:o})}),m(K,{condition:n.length===0,show:E("p",{children:["No ",e,"s added yet."]}),elseShow:E("div",{children:[E(Gu,{children:[n.length," ",n.length>1?`${e}s`:e," will get access."]}),n.map(l=>m(Ku,{label:m(Xs,{maxWidth:"300",text:l.toString(),maxLength:50})},l))]})})]}),m(K,{condition:!!i,show:m(rs,{color:"error"}),elseShow:m("div",{})})]})},Ha=z(Y)(({theme:n})=>({width:"auto",height:"auto",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.divider}`})),ct=n=>{switch(n.toUpperCase()){case"USERIDS":return"userId";case"IPS":return"remoteAddress";default:return n}},Qu=({parameters:n,constraints:e,input:t})=>m(tt,{children:Object.keys(n).map(i=>{var s,r,o,l,a,h,c,f;switch(i){case"rollout":case"Rollout":const u=Zs(n[i]);return E(Ha,{sx:{display:"flex",alignItems:"center"},children:[m(Y,{sx:{mr:"1rem"},children:m(_f,{percentage:u,size:"2rem"})}),E("div",{children:[E(xi,{color:"success",children:[u,"%"]})," ","of your base"," ",e.length>0?"who match constraints":""," ","is included."]})]},i);case"userIds":case"UserIds":const d=mn(n[i]);return m(Cs,{value:d,text:"user",input:(s=t==null?void 0:t.context)!=null&&s[ct(i)]?(r=t==null?void 0:t.context)==null?void 0:r[ct(i)]:"no value",showReason:(o=t==null?void 0:t.context)!=null&&o[ct(i)]?!d.includes((l=t==null?void 0:t.context)==null?void 0:l[ct(i)]):void 0},i);case"hostNames":case"HostNames":const p=mn(n[i]);return m(Cs,{value:p,text:"host",input:"no value",showReason:void 0},i);case"IPs":const g=mn(n[i]);return m(Cs,{value:g,text:"IP",input:(a=t==null?void 0:t.context)!=null&&a[ct(i)]?(h=t==null?void 0:t.context)==null?void 0:h[ct(i)]:"no value",showReason:(c=t==null?void 0:t.context)!=null&&c[ct(i)]?!g.includes((f=t==null?void 0:t.context)==null?void 0:f[ct(i)]):void 0},i);case"stickiness":case"groupId":return null;default:return null}})}),Ju=z(Y)(({theme:n})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.divider}`,display:"flex",flexDirection:"row",alignItems:"center",gap:2})),hi=({text:n,input:e=null,isRequired:t=!1})=>{const i=Pe(),s=e===null?"error":"neutral",r=t&&e===null;return E(Ju,{children:[m(re,{variant:"subtitle1",color:i.palette[s].main,sx:{minWidth:118},children:`${e===null?"no value":e}`}),m(Y,{sx:{flexGrow:1,flexDirection:"column"},children:m(Y,{sx:{flexGrow:1},children:m(K,{condition:!!r,show:E(tt,{children:[m(re,{component:"span",color:i.palette.error.main,children:" required parameter "}),m(Xs,{maxWidth:"300",text:n,maxLength:50}),m(re,{component:"span",color:i.palette.error.main,children:" is not set "})]}),elseShow:E(tt,{children:[m(re,{component:"span",color:"text.disabled",children:" set on parameter "}),m(Xs,{maxWidth:"300",text:n,maxLength:50})]})})})}),m(K,{condition:!!r,show:m(rs,{color:"error"}),elseShow:m("div",{})})]})},_u=({strategyName:n,parameters:e})=>{const{strategies:t}=Yf(),i=t.find(r=>r.name===n);if(!(i!=null&&i.editable))return null;const s=i==null?void 0:i.parameters.map(r=>{const o=e[r.name],l=r.required;switch(r==null?void 0:r.type){case"list":const a=mn(o);return m(hi,{isRequired:l,text:r.name,input:(a==null?void 0:a.length)>0?a.join(", "):null});case"percentage":const h=Zs(o),c=!(o===void 0||o===""||h<0||h>100);return m(hi,{text:r.name,isRequired:l,input:c?`${h}%`:void 0});case"boolean":const f=["true","false"].includes(o)?o:void 0;return m(hi,{isRequired:l,text:r.name,input:o!==void 0?f:void 0});case"string":const u=Xf(o);return m(hi,{text:r.name,isRequired:l,input:u!==void 0?u:void 0});case"number":const d=!(o===void 0||o===""),p=Zs(o);return m(hi,{text:r.name,isRequired:l,input:d?`${p}`:void 0});case"default":return null}return null});return m(tt,{children:s.map((r,o)=>E(H.Fragment,{children:[m(K,{condition:o>0,show:m(Hi,{text:"AND"})}),r]},o))})},Yu=z("div")(({theme:n})=>({padding:n.spacing(0)})),Xu=({strategyResult:n,input:e})=>{const{name:t,constraints:i,segments:s,parameters:r}=n,{uiConfig:o}=Qr(),l=!!o.flags.SE&&!!(s&&s.length>0),a=!!(i&&(i==null?void 0:i.length)>0),h=t!=="default"&&Object.keys(Zf).includes(t),c=Object.keys(r).length>0&&n.result.evaluationStatus==="incomplete";if(!r)return null;const f=[l&&m(qu,{segments:s,input:e}),a&&m(Va,{constraints:i,input:e}),h&&m(Qu,{parameters:r,constraints:i,input:e}),c&&m(_u,{strategyName:t,parameters:r}),t==="default"&&E(Ha,{sx:{width:"100%"},children:["The standard strategy is ",m(xi,{color:"success",children:"ON"})," for all users."]})].filter(Boolean);return m(Yu,{children:f.map((u,d)=>E(H.Fragment,{children:[m(K,{condition:d>0,show:m(Hi,{text:"AND"})}),u]},d))})},Zu=({strategy:n,input:e,index:t})=>{const{result:i}=n,s=Pe(),r=i.evaluationStatus==="incomplete"?"Unevaluated":i.enabled?"True":"False";return m(pu,{style:{borderColor:i.enabled?s.palette.success.main:"none"},strategy:{...n,id:`${Ia(n)}`},orderNumber:t+1,actions:m(On,{showIcon:!1,enabled:i.enabled,label:r}),children:m(Xu,{strategyResult:n,input:e,percentageFill:s.palette.background.elevation2})})},ed=z("div")(({theme:n})=>({display:"flex",padding:"0, 4px",flexDirection:"column",borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.warning.border}`})),td=z("div")(({theme:n})=>({padding:n.spacing(1,.5)})),id=z(Mn)(({theme:n})=>({border:"0!important",borderBottomLeftRadius:0,borderBottomRightRadius:0,borderBottom:`1px solid ${n.palette.warning.border}!important`})),za=({strategies:n,input:e})=>m(K,{condition:n.length>0,show:E(tt,{children:[m(re,{variant:"subtitle1",sx:{mt:2,ml:1,mb:2,color:"text.secondary"},children:`Strategies (${n==null?void 0:n.length})`}),m(Y,{sx:{width:"100%"},children:n==null?void 0:n.map((t,i)=>E(H.Fragment,{children:[m(K,{condition:i>0,show:m(Hi,{text:"OR"})}),m(Zu,{strategy:t,index:i,input:e},t.id)]},t.id))})]})}),nd=({strategies:n,input:e})=>E(ed,{sx:{pb:1,mt:2},children:[E(id,{severity:"info",color:"warning",children:["If environment was enabled, then this feature toggle would be"," ",n!=null&&n.result?"TRUE":"FALSE"," with strategies evaluated like so:"," "]}),m(td,{sx:{p:2.5},children:m(za,{strategies:(n==null?void 0:n.data)||[],input:e})})]}),sd=({feature:n,input:e})=>{var t,i,s,r;return E(tt,{children:[m(K,{condition:((i=(t=n==null?void 0:n.strategies)==null?void 0:t.data)==null?void 0:i.length)===0,show:m(Mn,{severity:"warning",sx:{mt:2},children:"There are no strategies added to this feature toggle in selected environment."})}),m(K,{condition:!n.isEnabledInCurrentEnvironment&&!!((s=n==null?void 0:n.strategies)!=null&&s.data),show:m(nd,{strategies:n==null?void 0:n.strategies,input:e}),elseShow:m(za,{strategies:((r=n==null?void 0:n.strategies)==null?void 0:r.data)||[],input:e})})]})},rd=z("div")(({theme:n})=>({alignItems:"flex-end",color:n.palette.divider})),Cb=({feature:n,input:e})=>{const[t,i]=H.useState(!1),s=H.useRef(null),r=()=>{i(!t)};return n?E(rd,{children:[m(Ai,{onClick:r,children:m(Ea,{ref:s})}),E(La,{open:t,onClose:()=>i(!1),anchorEl:s.current,PaperProps:{sx:o=>({display:"flex",flexDirection:"column",padding:o.spacing(6),width:728,maxWidth:"100%",height:"auto",overflowY:"auto",backgroundColor:o.palette.background.elevation2,borderRadius:o.shape.borderRadius})},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:[m(Iu,{feature:n,input:e,onClose:()=>i(!1)}),m(sd,{feature:n,input:e})]})]}):null},Ab=()=>{const{makeRequest:n,createRequest:e,errors:t,loading:i}=eu({propagateErrors:!0}),s="api/admin/playground";return{evaluatePlayground:async l=>{const a=e(s,{method:"POST",body:JSON.stringify(l)});try{return(await n(a.caller,a.id)).json()}catch(h){throw h}},evaluateAdvancedPlayground:async l=>{const a=`${s}/advanced`,h=e(a,{method:"POST",body:JSON.stringify(l)});try{return(await n(h.caller,h.id)).json()}catch(c){throw c}},errors:t,loading:i}},od=z("div")(({style:n,theme:e})=>({width:"25px",height:"25px",borderRadius:"50%",color:e.palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",...n})),os=({style:n,children:e,type:t})=>{const i=Pe(),s={backgroundColor:i.palette.background.alternative,color:i.palette.common.white};return t==="secondary"&&(s.backgroundColor=i.palette.background.paper,s.color=i.palette.text.secondary),m(od,{style:{...s,...n},children:e})};function ir(n,e,t){var i,s,r,o,l;e==null&&(e=100);function a(){var c=Date.now()-o;c<e&&c>=0?i=setTimeout(a,e-c):(i=null,t||(l=n.apply(r,s),r=s=null))}var h=function(){r=this,s=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(a,e)),c&&(l=n.apply(r,s),r=s=null),l};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(l=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},h}ir.debounce=ir;var ld=ir;class ${lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),_e.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),_e.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new vi(this),r=new vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new vi(this,e)}iterRange(e,t=this.length){return new $a(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qa(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?$.empty:e.length<=32?new se(e):_e.from(se.split(e,[]))}}class se extends ${constructor(e,t=ad(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new hd(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new se(No(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=gn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new se(l,o.length+r.length));else{let a=l.length>>1;i.push(new se(l.slice(0,a)),new se(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof se))return super.replace(e,t,i);let s=gn(this.text,gn(i.text,No(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new se(s,r):_e.from(se.split(s,[]),r)}sliceString(e,t=this.length,i=`
|
|
1
|
+
import{E as Vi,j as m,r as H,b as Pe,C as K,G as xi,t as z,B as Y,T as re,J as Wf,f as ks,s as Vf,h as E,K as Hf,M as zf,N as $f,O as qf,Q as jf,F as tt,R as Uf,U as Po,I as Ai,w as Ea,x as La,W as Kf,A as Mn,X as Hi,Y as Gf,Z as Ia,_ as Qf,$ as Jf,a0 as Xs,a1 as mn,a2 as Zs,a3 as _f,a4 as Yf,a5 as Xf,a6 as Qr,a7 as Zf,a8 as eu,a9 as tu,aa as Jr,ab as iu,ac as nu,m as su,ad as ru,n as Ro,ae as ou,af as lu,ag as au,ah as hu,ai as Na,aj as Bo,ak as Eo,al as wi,am as er,an as cu,ao as tr,ap as fu,p as uu,aq as du}from"./index-78d048a4.js";import{S as pu}from"./StrategyItemContainer-7b356e23.js";import{E as mu}from"./Error-6550f020.js";const rs=Vi(m("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined"),gu=Vi(m("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"CheckCircleOutline"),yu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),bu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help"),xu=Vi(m("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined"),wu=n=>H.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},H.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84818 0.184159C8.56367 -0.0789547 8.1234 -0.0575747 7.86482 0.231912C7.60623 0.521399 7.62724 0.96937 7.91175 1.23248C9.48292 2.68551 10.6076 4.74934 10.6076 7C10.6076 9.25066 9.48292 11.3145 7.91175 12.7675C7.62724 13.0306 7.60623 13.4786 7.86482 13.7681C8.1234 14.0576 8.56367 14.079 8.84818 13.8158C10.6396 12.1592 11.9998 9.73702 11.9998 7C11.9998 4.26298 10.6396 1.84083 8.84818 0.184159ZM6.04105 2.23302C6.29109 1.93586 6.73054 1.90121 7.02259 2.15563C8.33146 3.29586 9.35426 5.02309 9.35426 6.99995C9.35426 8.97682 8.33145 10.7039 7.02259 11.8441C6.73054 12.0986 6.29109 12.0639 6.04105 11.7668C5.79101 11.4696 5.82506 11.0225 6.11711 10.768C7.19425 9.82969 7.96199 8.46967 7.96199 6.99995C7.96199 5.53021 7.19423 4.17007 6.11711 3.23173C5.82506 2.97731 5.79101 2.53017 6.04105 2.23302ZM6.56908 7.00015C6.56908 8.56492 5.3224 9.83342 3.78454 9.83342C2.24668 9.83342 1 8.56492 1 7.00015C1 5.43539 2.24668 4.16689 3.78454 4.16689C5.3224 4.16689 6.56908 5.43539 6.56908 7.00015Z",fill:"currentColor"})),vu=n=>H.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},H.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84835 0.184159C8.56384 -0.0789547 8.12358 -0.0575747 7.86499 0.231912C7.6064 0.521399 7.62741 0.96937 7.91192 1.23248C9.4831 2.68551 10.6078 4.74934 10.6078 7C10.6078 7.40738 10.5709 7.80863 10.5012 8.20125L11.6597 9.35972C11.8783 8.60937 12 7.81877 12 7C12 4.26298 10.6397 1.84083 8.84835 0.184159ZM9.35443 6.99995L9.35418 7.0542L7.63252 5.33255C7.30901 4.52372 6.76993 3.80029 6.11728 3.23173C5.82523 2.97731 5.79118 2.53017 6.04122 2.23302C6.29127 1.93586 6.73072 1.90121 7.02276 2.15563C8.33164 3.29586 9.35443 5.02309 9.35443 6.99995ZM7.57827 8.79752L6.48307 7.70233C6.17606 8.92745 5.08437 9.83342 3.78471 9.83342C2.24685 9.83342 1.00017 8.56492 1.00017 7.00015C1.00017 5.69492 1.8676 4.59583 3.04789 4.26714L0.458225 1.67748C0.172794 1.39205 0.178843 0.923223 0.471736 0.63033C0.764629 0.337437 1.23345 0.331388 1.51889 0.616819L13.2132 12.3111C13.4986 12.5965 13.4926 13.0654 13.1997 13.3583C12.9068 13.6511 12.4379 13.6572 12.1525 13.3718L10.556 11.7753C10.0694 12.539 9.48623 13.2259 8.84835 13.8158C8.56384 14.079 8.12358 14.0576 7.86499 13.7681C7.6064 13.4786 7.62741 13.0306 7.91192 12.7675C8.54021 12.1865 9.0971 11.5078 9.53922 10.7585L8.62356 9.84281C8.20906 10.6195 7.64861 11.2989 7.02276 11.8441C6.73072 12.0986 6.29127 12.0639 6.04122 11.7668C5.79118 11.4696 5.82523 11.0225 6.11728 10.768C6.73471 10.2302 7.25048 9.55374 7.57827 8.79752Z",fill:"currentColor"})),On=({enabled:n,label:e,showIcon:t=!0})=>{const i=Pe(),s=m(K,{condition:n==="unknown"||n==="unevaluated",show:m(xu,{color:"warning",fontSize:"inherit"}),elseShow:m(K,{condition:typeof n=="boolean"&&!!n,show:m(wu,{color:i.palette.success.main,strokeWidth:"0.25"}),elseShow:m(vu,{color:i.palette.error.main,strokeWidth:"0.25"})})});return m(K,{condition:n==="unknown"||n==="unevaluated",show:m(xi,{icon:t?s:void 0,color:"warning",children:e}),elseShow:m(K,{condition:typeof n=="boolean"&&!!n,show:m(xi,{color:"success",icon:t?s:void 0,children:e}),elseShow:m(xi,{color:"error",icon:t?s:void 0,children:e})})})},ku=z(Y)(({theme:n})=>({display:"flex",alignItems:"center",padding:n.spacing(1,0,1,2)})),Su=z(Y)(()=>({marginRight:"auto"})),kb=({feature:n})=>{const[e,t]=(()=>{var i;return n!=null&&n.isEnabled?[!0,"True"]:((i=n==null?void 0:n.strategies)==null?void 0:i.result)==="unknown"?["unknown","Unknown"]:[!1,"False"]})();return m(ku,{children:m(Su,{"data-loading":!0,children:m(On,{enabled:e,label:t,showIcon:e!=="unknown"})})})},Cu=z("div")(({theme:n})=>({padding:n.spacing(4),maxWidth:"400px"})),Ss=z(re)(({theme:n})=>({marginBottom:n.spacing(2)})),Au=z(yu)(({theme:n})=>({color:n.palette.success.main})),Mu=({variants:n,selectedVariant:e})=>{const t=Pe(),i=H.useMemo(()=>n.map(c=>({name:c.name,weight:`${Wf(c.weight)}%`,selected:c.name===e})),[n,e]),s=H.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{getTableProps:r,getTableBodyProps:o,headerGroups:l,rows:a,prepareRow:h}=ks.useTable({initialState:s,columns:Ou,data:i,sortTypes:Vf,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},ks.useGlobalFilter,ks.useSortBy);return E(Cu,{children:[m(Ss,{variant:"subtitle2",children:"Variant Information"}),m(Ss,{variant:"body2",children:"The following table shows the variants defined on this feature toggle and the variant result based on your context configuration."}),m(Ss,{variant:"body2",children:'If you include "userId" or "sessionId" in your context, the variant will be the same every time because unleash uses these properties to ensure that the user receives the same experience.'}),E(Hf,{...r(),rowHeight:"dense",children:[m(zf,{headerGroups:l}),m($f,{...o(),children:a.map(c=>{let f={};return c.original.selected||(f.color=t.palette.text.secondary),h(c),m(qf,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>m(jf,{...u.getCellProps(),style:f,children:u.render("Cell")}))})})})]})]})},Ou=[{id:"Icon",Cell:({row:{original:{selected:n}}})=>m(tt,{children:m(K,{condition:n,show:m(Uf,{icon:m(Au,{})})})}),maxWidth:25,disableGlobalFilter:!0},{Header:"Name",accessor:"name",searchable:!0,Cell:({row:{original:{name:n}}})=>m(Po,{children:n}),maxWidth:175,width:175},{Header:"Weight",accessor:"weight",sortType:"alphanumeric",searchable:!0,maxWidth:75,Cell:({row:{original:{weight:n}}})=>m(Po,{children:n})}],Du=z("div")(()=>({maxWidth:"100%",display:"flex",alignItems:"center",wordBreak:"break-all"})),Sb=({variant:n,variants:e,feature:t,isEnabled:i})=>{const s=Pe(),[r,o]=H.useState(null),l=c=>o(c.currentTarget),a=()=>o(null),h=!!r;return E(Du,{children:[n,m(K,{condition:!!e&&e.length>0&&i,show:E(tt,{children:[m(Ai,{onClick:l,children:m(Ea,{})}),m(La,{open:h,id:`${t}-result-variants`,PaperProps:{sx:{borderRadius:`${s.shape.borderRadiusLarge}px`}},onClose:a,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:-320},children:m(Mu,{variants:e,selectedVariant:n})})]})})]})},Fa=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress","userWithId"];function Wa(n){return n===void 0?!0:Object.values(n).every(e=>e&&typeof e=="object"?Wa(e):e===null)}const Lo=n=>{var e,t;return(t=(e=n.strategies)==null?void 0:e.data)==null?void 0:t.find(i=>!Fa.includes(i.name))},Tu=n=>{var e,t;return!((t=(e=n.strategies)==null?void 0:e.data)!=null&&t.find(i=>Fa.includes(i.name)))},Pu=z("div")({display:"flex",justifyContent:"space-between",width:"100%"}),Ru=z("div")(({theme:n})=>({display:"inline-flex",alignItems:"center",gap:n.spacing(1.5),marginTop:n.spacing(1.5)})),Io=z("div")(({theme:n})=>({margin:n.spacing(1,0)})),Bu=z("div")(({theme:n})=>({margin:n.spacing(1,.5)})),Eu=z(re)(({theme:n})=>({fontWeight:600,padding:n.spacing(.5)})),Lu=z(Ai)({textAlign:"right"}),Iu=({feature:n,input:e,onClose:t})=>{var c;const i=Pe(),[s,r,o]=(()=>n.isEnabled?[`This feature toggle is True in ${e==null?void 0:e.environment} because `,"at least one strategy is True",i.palette.success.main]:n.isEnabledInCurrentEnvironment?Tu(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"no strategies could be fully evaluated",i.palette.warning.main]:Lo(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"not all strategies could be fully evaluated",i.palette.warning.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"all strategies are either False or could not be fully evaluated",i.palette.error.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"the environment is disabled",i.palette.error.main])(),l=Wa(e==null?void 0:e.context)?"You did not provide a value for your context field in step 2 of the configuration":void 0,a=Lo(n)?"This feature uses custom strategies. Custom strategies can't be evaluated, so they will be marked accordingly.":void 0,h=t&&(f=>{f.stopPropagation(),t()});return E(tt,{children:[E(Pu,{children:[E(Ru,{children:[m(Eu,{variant:"subtitle1",children:n.name}),m(K,{condition:((c=n==null?void 0:n.strategies)==null?void 0:c.result)!=="unknown",show:()=>m(On,{enabled:n.isEnabled,label:n.isEnabled?"True":"False"}),elseShow:()=>m(On,{enabled:"unknown",label:"Unknown",showIcon:!1})})]}),m(Lu,{onClick:h,children:m(Kf,{})})]}),E(Bu,{children:[m(re,{variant:"body1",component:"span",children:s}),m(re,{variant:"subtitle1",color:o,component:"span",children:r}),m(re,{variant:"body1",component:"span",children:"."})]}),m(K,{condition:!!l,show:m(Io,{children:m(Mn,{color:"info",children:l})})}),m(K,{condition:!!a,show:m(Io,{children:m(Mn,{severity:"warning",color:"info",children:a})})})]})},Nu=z("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.error.main})),Fu=({constraint:n,input:e})=>E(Nu,{children:[m(rs,{style:{marginRight:"0.25rem"}}),m(re,{variant:"body2",children:(()=>{const i=e==null?void 0:e.context[n.contextName];return i?`Constraint not met – the value in the context: { ${i} } is not ${n.operator} ${n.contextName}`:`Constraint not met – no value was specified for ${n.contextName}`})()})]}),Wu=z(gu)(({theme:n})=>({color:n.palette.success.main})),Vu=z("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.success.main})),Hu=()=>E(Vu,{children:[m(Wu,{style:{marginRight:"0.25rem"}}),m(re,{variant:"body2",children:"Constraint met by value in context"})]}),zu=z("div")(()=>({width:"100%",display:"flex",flexDirection:"column"})),Va=({constraints:n,input:e})=>n?m(zu,{children:n==null?void 0:n.map((t,i)=>E(H.Fragment,{children:[m(K,{condition:i>0,show:m(Hi,{text:"AND"})}),m(Gf,{constraint:t,compact:!0,renderAfter:m(K,{condition:t.result,show:m(Hu,{}),elseShow:m(Fu,{input:e,constraint:t})})})]},Ia(t)))}):null,$u=z("div")(({theme:n})=>({color:n.palette.error.main,display:"inline-flex",justifyContent:"center",marginLeft:"auto",gap:n.spacing(1)})),qu=({segments:n,input:e})=>n?m(tt,{children:n.map((t,i)=>E(H.Fragment,{children:[m(Qf,{segment:t,constraintList:m(Va,{constraints:t.constraints,input:e}),headerContent:m(K,{condition:!t.result,show:E($u,{children:[m(re,{variant:"subtitle2",sx:{pt:.25},children:"segment is false"}),m("span",{children:m(rs,{})})]})}),isExpanded:!0}),m(K,{condition:i>=0&&n.length>1&&i!==n.length-1,show:m(Hi,{text:"AND"})})]},t.id))}):null,ju=z("div",{shouldForwardProp:n=>n!=="showReason"})(({theme:n,showReason:e})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.divider}`,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.spacing(2),opacity:e?.9:1,backgroundColor:e?n.palette.background.paper:"inherit"})),Uu=z("div")(({theme:n})=>({flexDirection:"column"})),Ku=z(Jf)(({theme:n})=>({margin:n.spacing(.5)})),Gu=z("p")(({theme:n})=>({display:"inline",margin:n.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),Cs=({value:n,text:e,input:t,showReason:i=!1})=>{const s=Pe(),r=t==="no value"?"error":"neutral",o=`value does not match any ${e}`;return E(ju,{showReason:i,children:[m(re,{variant:"subtitle1",color:s.palette[r].main,children:`${t}`}),E(Uu,{children:[m(K,{condition:!!i,show:m(re,{variant:"subtitle1",color:s.palette.error.main,children:o})}),m(K,{condition:n.length===0,show:E("p",{children:["No ",e,"s added yet."]}),elseShow:E("div",{children:[E(Gu,{children:[n.length," ",n.length>1?`${e}s`:e," will get access."]}),n.map(l=>m(Ku,{label:m(Xs,{maxWidth:"300",text:l.toString(),maxLength:50})},l))]})})]}),m(K,{condition:!!i,show:m(rs,{color:"error"}),elseShow:m("div",{})})]})},Ha=z(Y)(({theme:n})=>({width:"auto",height:"auto",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.divider}`})),ct=n=>{switch(n.toUpperCase()){case"USERIDS":return"userId";case"IPS":return"remoteAddress";default:return n}},Qu=({parameters:n,constraints:e,input:t})=>m(tt,{children:Object.keys(n).map(i=>{var s,r,o,l,a,h,c,f;switch(i){case"rollout":case"Rollout":const u=Zs(n[i]);return E(Ha,{sx:{display:"flex",alignItems:"center"},children:[m(Y,{sx:{mr:"1rem"},children:m(_f,{percentage:u,size:"2rem"})}),E("div",{children:[E(xi,{color:"success",children:[u,"%"]})," ","of your base"," ",e.length>0?"who match constraints":""," ","is included."]})]},i);case"userIds":case"UserIds":const d=mn(n[i]);return m(Cs,{value:d,text:"user",input:(s=t==null?void 0:t.context)!=null&&s[ct(i)]?(r=t==null?void 0:t.context)==null?void 0:r[ct(i)]:"no value",showReason:(o=t==null?void 0:t.context)!=null&&o[ct(i)]?!d.includes((l=t==null?void 0:t.context)==null?void 0:l[ct(i)]):void 0},i);case"hostNames":case"HostNames":const p=mn(n[i]);return m(Cs,{value:p,text:"host",input:"no value",showReason:void 0},i);case"IPs":const g=mn(n[i]);return m(Cs,{value:g,text:"IP",input:(a=t==null?void 0:t.context)!=null&&a[ct(i)]?(h=t==null?void 0:t.context)==null?void 0:h[ct(i)]:"no value",showReason:(c=t==null?void 0:t.context)!=null&&c[ct(i)]?!g.includes((f=t==null?void 0:t.context)==null?void 0:f[ct(i)]):void 0},i);case"stickiness":case"groupId":return null;default:return null}})}),Ju=z(Y)(({theme:n})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.divider}`,display:"flex",flexDirection:"row",alignItems:"center",gap:2})),hi=({text:n,input:e=null,isRequired:t=!1})=>{const i=Pe(),s=e===null?"error":"neutral",r=t&&e===null;return E(Ju,{children:[m(re,{variant:"subtitle1",color:i.palette[s].main,sx:{minWidth:118},children:`${e===null?"no value":e}`}),m(Y,{sx:{flexGrow:1,flexDirection:"column"},children:m(Y,{sx:{flexGrow:1},children:m(K,{condition:!!r,show:E(tt,{children:[m(re,{component:"span",color:i.palette.error.main,children:" required parameter "}),m(Xs,{maxWidth:"300",text:n,maxLength:50}),m(re,{component:"span",color:i.palette.error.main,children:" is not set "})]}),elseShow:E(tt,{children:[m(re,{component:"span",color:"text.disabled",children:" set on parameter "}),m(Xs,{maxWidth:"300",text:n,maxLength:50})]})})})}),m(K,{condition:!!r,show:m(rs,{color:"error"}),elseShow:m("div",{})})]})},_u=({strategyName:n,parameters:e})=>{const{strategies:t}=Yf(),i=t.find(r=>r.name===n);if(!(i!=null&&i.editable))return null;const s=i==null?void 0:i.parameters.map(r=>{const o=e[r.name],l=r.required;switch(r==null?void 0:r.type){case"list":const a=mn(o);return m(hi,{isRequired:l,text:r.name,input:(a==null?void 0:a.length)>0?a.join(", "):null});case"percentage":const h=Zs(o),c=!(o===void 0||o===""||h<0||h>100);return m(hi,{text:r.name,isRequired:l,input:c?`${h}%`:void 0});case"boolean":const f=["true","false"].includes(o)?o:void 0;return m(hi,{isRequired:l,text:r.name,input:o!==void 0?f:void 0});case"string":const u=Xf(o);return m(hi,{text:r.name,isRequired:l,input:u!==void 0?u:void 0});case"number":const d=!(o===void 0||o===""),p=Zs(o);return m(hi,{text:r.name,isRequired:l,input:d?`${p}`:void 0});case"default":return null}return null});return m(tt,{children:s.map((r,o)=>E(H.Fragment,{children:[m(K,{condition:o>0,show:m(Hi,{text:"AND"})}),r]},o))})},Yu=z("div")(({theme:n})=>({padding:n.spacing(0)})),Xu=({strategyResult:n,input:e})=>{const{name:t,constraints:i,segments:s,parameters:r}=n,{uiConfig:o}=Qr(),l=!!o.flags.SE&&!!(s&&s.length>0),a=!!(i&&(i==null?void 0:i.length)>0),h=t!=="default"&&Object.keys(Zf).includes(t),c=Object.keys(r).length>0&&n.result.evaluationStatus==="incomplete";if(!r)return null;const f=[l&&m(qu,{segments:s,input:e}),a&&m(Va,{constraints:i,input:e}),h&&m(Qu,{parameters:r,constraints:i,input:e}),c&&m(_u,{strategyName:t,parameters:r}),t==="default"&&E(Ha,{sx:{width:"100%"},children:["The standard strategy is ",m(xi,{color:"success",children:"ON"})," for all users."]})].filter(Boolean);return m(Yu,{children:f.map((u,d)=>E(H.Fragment,{children:[m(K,{condition:d>0,show:m(Hi,{text:"AND"})}),u]},d))})},Zu=({strategy:n,input:e,index:t})=>{const{result:i}=n,s=Pe(),r=i.evaluationStatus==="incomplete"?"Unevaluated":i.enabled?"True":"False";return m(pu,{style:{borderColor:i.enabled?s.palette.success.main:"none"},strategy:{...n,id:`${Ia(n)}`},orderNumber:t+1,actions:m(On,{showIcon:!1,enabled:i.enabled,label:r}),children:m(Xu,{strategyResult:n,input:e,percentageFill:s.palette.background.elevation2})})},ed=z("div")(({theme:n})=>({display:"flex",padding:"0, 4px",flexDirection:"column",borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.warning.border}`})),td=z("div")(({theme:n})=>({padding:n.spacing(1,.5)})),id=z(Mn)(({theme:n})=>({border:"0!important",borderBottomLeftRadius:0,borderBottomRightRadius:0,borderBottom:`1px solid ${n.palette.warning.border}!important`})),za=({strategies:n,input:e})=>m(K,{condition:n.length>0,show:E(tt,{children:[m(re,{variant:"subtitle1",sx:{mt:2,ml:1,mb:2,color:"text.secondary"},children:`Strategies (${n==null?void 0:n.length})`}),m(Y,{sx:{width:"100%"},children:n==null?void 0:n.map((t,i)=>E(H.Fragment,{children:[m(K,{condition:i>0,show:m(Hi,{text:"OR"})}),m(Zu,{strategy:t,index:i,input:e},t.id)]},t.id))})]})}),nd=({strategies:n,input:e})=>E(ed,{sx:{pb:1,mt:2},children:[E(id,{severity:"info",color:"warning",children:["If environment was enabled, then this feature toggle would be"," ",n!=null&&n.result?"TRUE":"FALSE"," with strategies evaluated like so:"," "]}),m(td,{sx:{p:2.5},children:m(za,{strategies:(n==null?void 0:n.data)||[],input:e})})]}),sd=({feature:n,input:e})=>{var t,i,s,r;return E(tt,{children:[m(K,{condition:((i=(t=n==null?void 0:n.strategies)==null?void 0:t.data)==null?void 0:i.length)===0,show:m(Mn,{severity:"warning",sx:{mt:2},children:"There are no strategies added to this feature toggle in selected environment."})}),m(K,{condition:!n.isEnabledInCurrentEnvironment&&!!((s=n==null?void 0:n.strategies)!=null&&s.data),show:m(nd,{strategies:n==null?void 0:n.strategies,input:e}),elseShow:m(za,{strategies:((r=n==null?void 0:n.strategies)==null?void 0:r.data)||[],input:e})})]})},rd=z("div")(({theme:n})=>({alignItems:"flex-end",color:n.palette.divider})),Cb=({feature:n,input:e})=>{const[t,i]=H.useState(!1),s=H.useRef(null),r=()=>{i(!t)};return n?E(rd,{children:[m(Ai,{onClick:r,children:m(Ea,{ref:s})}),E(La,{open:t,onClose:()=>i(!1),anchorEl:s.current,PaperProps:{sx:o=>({display:"flex",flexDirection:"column",padding:o.spacing(6),width:728,maxWidth:"100%",height:"auto",overflowY:"auto",backgroundColor:o.palette.background.elevation2,borderRadius:o.shape.borderRadius})},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:[m(Iu,{feature:n,input:e,onClose:()=>i(!1)}),m(sd,{feature:n,input:e})]})]}):null},Ab=()=>{const{makeRequest:n,createRequest:e,errors:t,loading:i}=eu({propagateErrors:!0}),s="api/admin/playground";return{evaluatePlayground:async l=>{const a=e(s,{method:"POST",body:JSON.stringify(l)});try{return(await n(a.caller,a.id)).json()}catch(h){throw h}},evaluateAdvancedPlayground:async l=>{const a=`${s}/advanced`,h=e(a,{method:"POST",body:JSON.stringify(l)});try{return(await n(h.caller,h.id)).json()}catch(c){throw c}},errors:t,loading:i}},od=z("div")(({style:n,theme:e})=>({width:"25px",height:"25px",borderRadius:"50%",color:e.palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",...n})),os=({style:n,children:e,type:t})=>{const i=Pe(),s={backgroundColor:i.palette.background.alternative,color:i.palette.common.white};return t==="secondary"&&(s.backgroundColor=i.palette.background.paper,s.color=i.palette.text.secondary),m(od,{style:{...s,...n},children:e})};function ir(n,e,t){var i,s,r,o,l;e==null&&(e=100);function a(){var c=Date.now()-o;c<e&&c>=0?i=setTimeout(a,e-c):(i=null,t||(l=n.apply(r,s),r=s=null))}var h=function(){r=this,s=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(a,e)),c&&(l=n.apply(r,s),r=s=null),l};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(l=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},h}ir.debounce=ir;var ld=ir;class ${lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),_e.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),_e.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new vi(this),r=new vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new vi(this,e)}iterRange(e,t=this.length){return new $a(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qa(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?$.empty:e.length<=32?new se(e):_e.from(se.split(e,[]))}}class se extends ${constructor(e,t=ad(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new hd(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new se(No(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=gn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new se(l,o.length+r.length));else{let a=l.length>>1;i.push(new se(l.slice(0,a)),new se(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof se))return super.replace(e,t,i);let s=gn(this.text,gn(i.text,No(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new se(s,r):_e.from(se.split(s,[]),r)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(s+=i),e<a&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new se(i,s)),i=[],s=-1);return s>-1&&t.push(new se(i,s)),t}}class _e extends ${constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if(i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>5-1&&a.lines>h>>5+1){let c=this.children.slice();return c[s]=a,new _e(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(s+=i),e<a&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof _e))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new se(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof _e)for(let g of d.children)f(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof se&&a&&(p=c[c.length-1])instanceof se&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new se(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:_e.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new _e(l,t)}}$.empty=new se([""],0);function ad(n){let e=-1;for(let t of n)e+=t.length+1;return e}function gn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=t&&(a>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function No(n,e,t){return gn(n,[""],e,t)}class vi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof se?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof se?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(s instanceof se){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof se?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class $a{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new vi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class qa{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&($.prototype[Symbol.iterator]=function(){return this.iter()},vi.prototype[Symbol.iterator]=$a.prototype[Symbol.iterator]=qa.prototype[Symbol.iterator]=function(){return this});class hd{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Gt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<Gt.length;n++)Gt[n]+=Gt[n-1];function cd(n){for(let e=1;e<Gt.length;e+=2)if(Gt[e]>n)return Gt[e-1]<=n;return!1}function Fo(n){return n>=127462&&n<=127487}const Wo=8205;function Ce(n,e,t=!0,i=!0){return(t?ja:fd)(n,e,i)}function ja(n,e,t){if(e==n.length)return e;e&&Ua(n.charCodeAt(e))&&Ka(n.charCodeAt(e-1))&&e--;let i=me(n,e);for(e+=Ee(i);e<n.length;){let s=me(n,e);if(i==Wo||s==Wo||t&&cd(s))e+=Ee(s),i=s;else if(Fo(s)){let r=0,o=e-2;for(;o>=0&&Fo(me(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function fd(n,e,t){for(;e>0;){let i=ja(n,e-2,t);if(i<e)return i;e--}return 0}function Ua(n){return n>=56320&&n<57344}function Ka(n){return n>=55296&&n<56320}function me(n,e){let t=n.charCodeAt(e);if(!Ka(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Ua(i)?(t-55296<<10)+(i-56320)+65536:t}function _r(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Ee(n){return n<65536?1:2}const nr=/\r\n?|\n/;var Se=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Se||(Se={}));class Ze{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){sr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new Ze(e)}composeDesc(e){return this.empty?e:e.empty?this:Ga(this,e)}mapDesc(e,t=!1){return e.empty?this:rr(this,e,t)}mapPos(e,t=-1,i=Se.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>e)return r+(e-s);r+=l}else{if(i!=Se.Simple&&h>=e&&(i==Se.TrackDel&&s<e&&h>e||i==Se.TrackBefore&&s<e||i==Se.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=t&&l>=e)return s<e&&l>t?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ze(e)}static create(e){return new Ze(e)}}class ce extends Ze{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return sr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return rr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],l=t[s+1];if(l>=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length<a;)i.push($.empty);i.push(o?e.slice(r,r+o):$.empty)}r+=o}return new ce(t,i)}compose(e){return this.empty?e:e.empty?this:Ga(this,e,!0)}map(e,t=!1){return e.empty?this:rr(this,e,t,!0)}iterChanges(e,t=!1){sr(this,e,t)}get desc(){return Ze.create(this.sections)}filter(e){let t=[],i=[],s=[],r=new Mi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,a-l);xe(s,c,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;xe(t,c,f),f>0&&mt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l<h;){if(r.done)break e;let c=Math.min(r.len,h-l);xe(t,c,-1),xe(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new ce(t,i),filtered:Ze.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<t&&xe(s,t-o,-1);let f=new ce(s,r);l=l?l.compose(f.map(l)):f,s=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ce){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?$.of(d.split(i||nr)):d:$.empty,g=p.length;if(f==u&&g==0)return;f<o&&a(),f>o&&xe(s,f-o,-1),xe(s,u-f,g),mt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length<s;)i.push($.empty);i[s]=$.of(r.slice(1)),t.push(r[0],i[s].length)}}}return new ce(t,i)}static createSet(e,t){return new ce(e,t)}}function xe(n,e,t,i=!1){if(e==0&&t<=0)return;let s=n.length-2;s>=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function mt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push($.empty);n.push(t)}}function sr(n,e,t){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,c=r,f=$.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function rr(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Mi(n),l=new Mi(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);xe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(xe(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(xe(s,0,o.ins),r&&mt(r,s,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;xe(s,h,a<o.i?o.ins:0),r&&a<o.i&&mt(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?ce.createSet(s,r):Ze.create(s);throw new Error("Mismatched change set lengths")}}function Ga(n,e,t=!1){let i=[],s=t?[]:null,r=new Mi(n),o=new Mi(e);for(let l=!1;;){if(r.done&&o.done)return s?ce.createSet(i,s):Ze.create(i);if(r.ins==0)xe(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)xe(i,0,o.ins,l),s&&mt(s,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;xe(i,a,c,l),s&&c&&mt(s,i,o.text)}else o.ins==-1?(xe(i,r.off?0:r.len,a,l),s&&mt(s,i,r.textBit(a))):(xe(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&mt(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Mi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?$.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?$.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Bt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Bt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return w.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return w.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return w.range(e.anchor,e.head)}static create(e,t,i){return new Bt(e,t,i)}}class w{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:w.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new w([this.main],0)}addRange(e,t=!0){return w.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,w.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new w(e.ranges.map(t=>Bt.fromJSON(t)),e.main)}static single(e,t=e){return new w([w.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=i:r.from<i)return w.normalized(e.slice(),t);i=r.to}return new w(e,t)}static cursor(e,t=0,i,s){return Bt.create(e,e,(t==0?0:t<0?4:8)|(i==null?3:Math.min(2,i))|(s??33554431)<<5)}static range(e,t,i,s){let r=(i??33554431)<<5|(s==null?3:Math.min(2,s));return t<e?Bt.create(t,e,24|r):Bt.create(e,t,(t>e?4:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?w.range(a,l):w.range(l,a))}}return new w(e,t)}}function Qa(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Yr=0;class P{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=Yr++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new P(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Xr),!!e.static,e.enables)}of(e){return new yn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new yn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new yn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Xr(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class yn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=Yr++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||or(f,c)){let d=i(f);if(l?!Vo(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let g=Tn(u,p);if(this.dependencies.every(b=>b instanceof P?u.facet(b)===f.facet(b):b instanceof be?u.field(b,!1)==f.field(b,!1):!0)||(l?Vo(d=i(f),g,s):s(d=i(f),g)))return f.values[o]=g,0}else d=i(f);return f.values[o]=d,1}}}}function Vo(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function or(n,e){let t=!1;for(let i of e)ki(n,i)&1&&(t=!0);return t}function ud(n,e,t){let i=t.map(a=>n[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Tn(a,i[c]);if(s[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)ki(a,h);return a.values[o]=l(a),1},update(a,h){if(!or(a,r))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=or(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Xr(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const Ho=P.define({static:!0});class be{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new be(Yr++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Ho).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,Ho.of({field:this,create:e})]}get extension(){return this}}const Pt={lowest:4,low:3,default:2,high:1,highest:0};function ci(n){return e=>new Ja(e,n)}const oi={highest:ci(Pt.highest),high:ci(Pt.high),default:ci(Pt.default),low:ci(Pt.low),lowest:ci(Pt.lowest)};class Ja{constructor(e,t){this.inner=e,this.prec=t}}class ls{of(e){return new lr(this,e)}reconfigure(e){return ls.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class lr{constructor(e,t){this.compartment=e,this.inner=t}}class Dn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of dd(e,t,o))u instanceof be?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,g=c&&c[u]||[];if(d.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,Xr(g,d))a.push(i.facet(p));else{let b=p.combine(d.map(x=>x.value));a.push(i&&p.compare(b,i.facet(p))?i.facet(p):b)}else{for(let b of d)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=h.length<<1,h.push(x=>b.dynamicSlot(x)));l[p.id]=h.length<<1,h.push(b=>ud(b,p,d))}}let f=h.map(u=>u(l));return new Dn(e,o,f,l,a,r)}}function dd(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof lr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof lr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Ja)r(o.inner,o.prec);else if(o instanceof be)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof yn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Pt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,Pt.default),i.reduce((o,l)=>o.concat(l))}function ki(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Tn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const _a=P.define(),Ya=P.define({combine:n=>n.some(e=>e),static:!0}),Xa=P.define({combine:n=>n.length?n[0]:void 0,static:!0}),Za=P.define(),eh=P.define(),th=P.define(),ih=P.define({combine:n=>n.length?n[0]:!1});class at{constructor(e,t){this.type=e,this.value=t}static define(){return new pd}}class pd{of(e){return new at(this,e)}}class md{constructor(e){this.map=e}of(e){return new N(this,e)}}class N{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new N(this.type,t)}is(e){return this.type==e}static define(e={}){return new md(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}N.reconfigure=N.define();N.appendConfig=N.define();class fe{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Qa(i,t.newLength),r.some(l=>l.type==fe.time)||(this.annotations=r.concat(fe.time.of(Date.now())))}static create(e,t,i,s,r,o){return new fe(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(fe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}fe.time=at.define();fe.userEvent=at.define();fe.addToHistory=at.define();fe.remote=at.define();function gd(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==e.length||e[s]>=n[i]))r=n[i++],o=n[i++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function nh(n,e,t){var i;let s,r,o;return t?(s=e.changes,r=ce.empty(e.changes.length),o=n.changes.compose(e.changes)):(s=e.changes.map(n.changes),r=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:N.mapEffects(n.effects,s).concat(N.mapEffects(e.effects,r)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function ar(n,e,t){let i=e.selection,s=Qt(e.annotations);return e.userEvent&&(s=s.concat(fe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ce?e.changes:ce.of(e.changes||[],t,n.facet(Xa)),selection:i&&(i instanceof w?i:w.single(i.anchor,i.head)),effects:Qt(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function sh(n,e,t){let i=ar(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=nh(i,ar(n,e[r],o?i.changes.newLength:n.doc.length),o)}let s=fe.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return bd(t?yd(s):s)}function yd(n){let e=n.startState,t=!0;for(let s of e.facet(Za)){let r=s(n);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:gd(t,r))}if(t!==!0){let s,r;if(t===!1)r=n.changes.invertedDesc,s=ce.empty(e.doc.length);else{let o=n.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=fe.create(e,s,n.selection&&n.selection.map(r),N.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=e.facet(eh);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof fe?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof fe?n=r[0]:n=sh(e,Qt(r),!1)}return n}function bd(n){let e=n.startState,t=e.facet(th),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=nh(i,ar(e,r,n.changes.newLength),!0))}return i==n?n:fe.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const xd=[];function Qt(n){return n==null?xd:Array.isArray(n)?n:[n]}var X=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(X||(X={}));const wd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let hr;try{hr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vd(n){if(hr)return hr.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||wd.test(t)))return!0}return!1}function kd(n){return e=>{if(!/\S/.test(e))return X.Space;if(vd(e))return X.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return X.Word;return X.Other}}class V{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)ki(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return ki(this,i),Tn(this,i)}update(...e){return sh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let o of e.effects)o.is(ls.reconfigure)?(t&&(s=new Map,t.compartments.forEach((l,a)=>s.set(a,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(N.reconfigure)?(t=null,i=o.value):o.is(N.appendConfig)&&(t=null,i=Qt(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Dn.resolve(i,s,this),r=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new V(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:w.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Qt(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(s);for(let u=0;u<l;u++)r[u]=r[u].map(c);let f=s.mapDesc(h,!0);r.push(a.range.map(f)),s=s.compose(c),o=N.mapEffects(o,c).concat(N.mapEffects(Qt(a.effects),f))}return{changes:s,selection:w.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ce?e:ce.of(e,this.doc.length,this.facet(V.lineSeparator))}toText(e){return $.of(e.split(this.facet(V.lineSeparator)||nr))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ki(this,t),Tn(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof be&&this.config.address[s.id]!=null&&(t[i]=s.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:w.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Dn.resolve(e.extensions||[],new Map),i=e.doc instanceof $?e.doc:$.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||nr)),s=e.selection?e.selection instanceof w?e.selection:w.single(e.selection.anchor,e.selection.head):w.single(0);return Qa(s,i.length),t.staticFacet(Ya)||(s=s.asSingle()),new V(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fW as q,E as X,j as e,a6 as S,h as l,A as P,d as Y,ch as Z,g as J,F as E,C as g,B as T,k as ee,d7 as te,M as ne,N as oe,O as se,Q as re,i as H,y as O,as as ae,dy as le,bU as ie,fX as ce,t as m,aO as _,dG as de,U as A,dI as w,r as p,R as ue,H as v,d2 as he,du as pe,f as D,s as me,m as W,aM as G,cw as ye,fY as fe,c0 as be,bb as K,n as Ce,c2 as ge,cf as Te,ai as ke,l as $,fZ as R,cR as Ae,cP as Se,cQ as Ee,T as x,d_ as Ie,ae as Ne,e0 as we,c1 as ve,e1 as De,fc as Re,aR as xe,aS as Pe,aT as Be,dH as Le,dl as Fe}from"./index-0a56292a.js";const Ue=q(),st=Ue,je=X(e("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key"),He=()=>{const{uiConfig:t}=S();return l(P,{severity:"info",children:[l("p",{children:["Read the"," ",e("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e("strong",{children:"1 minute"})," before a new API key is activated."]}),e("br",{}),e("strong",{children:"API URL: "})," ",l("pre",{style:{display:"inline"},children:[t.unleashUrl,"/api/"]})]})},Me=["Icon","createdAt"],Oe=["Icon","project","seenAt"],rt=({compact:t=!1,setHiddenColumns:n,columns:s,loading:o,rows:r,getTableProps:a,getTableBodyProps:i,headerGroups:b,globalFilter:h,prepareRow:C})=>{const y=Y(Z.breakpoints.down("md"));return J([{condition:y,columns:Me},{condition:t,columns:Oe}],n,s),l(E,{children:[e(g,{condition:r.length>0,show:e(T,{sx:{mb:4},children:e(He,{})})}),e(T,{sx:{overflowX:"auto"},children:e(ee,{value:h,children:l(te,{...a(),children:[e(ne,{headerGroups:b}),e(oe,{...i(),children:r.map(f=>(C(f),e(se,{hover:!0,...f.getRowProps(),children:f.cells.map(c=>e(re,{...c.getCellProps(),children:c.render("Cell")}))})))})]})})}),e(g,{condition:r.length===0&&!o,show:e(g,{condition:(h==null?void 0:h.length)>0,show:l(H,{children:["No tokens found matching “",h,"”"]}),elseShow:e(H,{children:l("span",{children:["No tokens available. Read ",e(O,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},at=({path:t,permission:n,project:s})=>{const o=ae();return e(le,{Icon:ie,onClick:()=>o(t),"data-testid":ce,permission:n,projectId:s,maxWidth:"700px",children:"New API token"})},_e=m(_)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),We=({projects:t,project:n})=>{const{searchQuery:s}=de();let o=t&&Array.isArray(t)?t:n?[n]:[];return o.length===0?e(A,{children:e(w,{search:s,children:"*"})}):e(A,{children:o.map((r,a)=>l(p.Fragment,{children:[a>0&&", ",!r||r==="*"?e(w,{search:s,children:"*"}):e(_e,{to:`/projects/${r}`,children:e(w,{search:s,children:r})})]},r))})},lt=(t,n)=>{const s=p.useMemo(()=>({sortBy:[{id:"createdAt"}]}),[]),o=p.useMemo(()=>[{id:"Icon",width:"1%",Cell:()=>e(ue,{icon:e(je,{color:"disabled"})}),disableSortBy:!0,disableGlobalFilter:!0},{Header:"Username",accessor:"username",Cell:v},{Header:"Type",accessor:"type",Cell:({value:c})=>e(v,{value:M[c.toLowerCase()].label,subtitle:M[c.toLowerCase()].title}),minWidth:280},{Header:"Project",accessor:"project",Cell:c=>e(We,{project:c.row.original.project,projects:c.row.original.projects}),minWidth:120},{Header:"Environment",accessor:"environment",Cell:v,minWidth:120},{Header:"Created",accessor:"createdAt",Cell:he,minWidth:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:pe,minWidth:150,disableGlobalFilter:!0},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:n}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:b,prepareRow:h,state:C,setGlobalFilter:y,setHiddenColumns:f}=D.useTable({columns:o,data:t,initialState:s,sortTypes:me,autoResetHiddenColumns:!1,disableSortRemove:!0},D.useGlobalFilter,D.useSortBy);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:b,prepareRow:h,state:C,setGlobalFilter:y,setHiddenColumns:f,columns:o}},M={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},it=({token:t,project:n,permission:s,track:o})=>{const{setToastData:r}=W(),a=i=>{fe(i)&&(r({type:"success",title:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e(G,{permission:s,projectId:n,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e(ye,{})})},Ge=m("ul")({marginBottom:0}),ct=({token:t,permission:n,onRemove:s,project:o})=>{const[r,a]=p.useState(!1),{setToastData:i,setToastApiError:b}=W();return l(E,{children:[e(G,{permission:n,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e(be,{})}),e(K,{open:r,onClick:async()=>{try{await s(),a(!1),i({type:"success",title:"API token removed"})}catch(C){b(Ce(C))}},onClose:()=>a(!1),title:"Confirm deletion",children:l("div",{children:["Are you sure you want to delete the following API token?",e("br",{}),l(Ge,{children:[l("li",{children:[e("strong",{children:"username"}),":"," ",e("code",{children:t.username})]}),l("li",{children:[e("strong",{children:"type"}),": ",e("code",{children:t.type})]})]})]})})]})},Ke=m("div")(()=>({maxWidth:"400px"})),$e=m("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ze=m(ge)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),Qe=m(Te)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),z=m("p")(({theme:t})=>({marginBottom:t.spacing(1)})),Ve=m("label")(({theme:t})=>({marginBottom:t.spacing(1)})),qe=m(ke)(({theme:t})=>({marginLeft:t.spacing(3)})),Xe=m(T)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),dt=({children:t,actions:n,handleSubmit:s,handleCancel:o})=>{var i;const{uiConfig:r}=S(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return l($e,{onSubmit:s,children:[e(g,{condition:a,show:l(P,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e(O,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,l(Xe,{children:[n,e(qe,{onClick:o,children:"Cancel"})]})]})};var u=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(u||{});const ut=t=>{var F,U;const{environments:n}=$(),{uiConfig:s}=S(),o=(F=n==null?void 0:n.find(d=>d.enabled))==null?void 0:F.name,r=[{key:u.CLIENT,label:`Server-side SDK (${u.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy",enabled:R(Ae)}],a=R(Se),i=R(Ee);t||r.push({key:u.ADMIN,label:u.ADMIN,title:"Full access for managing Unleash",enabled:a}),s.flags.embedProxyFrontend&&r.splice(1,0,{key:u.FRONTEND,label:`Client-side SDK (${u.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:i});const b=(U=r.find(d=>d.enabled))==null?void 0:U.key,[h,C]=p.useState(""),[y,f]=p.useState(b||u.CLIENT),[c,I]=p.useState([t||"*"]),[Q,V]=p.useState(c),[B,k]=p.useState(),[L,N]=p.useState({});return p.useEffect(()=>{k(y==="ADMIN"?"*":o)},[y,o]),{username:h,type:y,apiTokenTypes:r,projects:c,environment:B,setUsername:C,setTokenType:d=>{d==="ADMIN"?(f(u.ADMIN),V(c),I(["*"]),k("*")):(f(d),I(Q),k(o))},setProjects:I,setEnvironment:k,getApiTokenPayload:()=>({username:h,type:y,environment:B,projects:c}),isValid:()=>{const d={};return h||(d.username="Username is required"),c.length===0&&(d.projects="At least one project is required"),N(d),Object.keys(d).length===0},clearErrors:d=>{if(d){const j={...L};delete j[d],N(j)}else N({})},errors:L}},ht=({open:t,closeConfirm:n,token:s,type:o})=>l(K,{open:t,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e(x,{variant:"body1",children:"Your new token has been created successfully."}),e(Ie,{token:s}),e(g,{condition:o===u.FRONTEND,show:l(P,{sx:{mt:2},severity:"info",children:["By default, all ",u.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e(_,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),pt=({username:t,setUsername:n,errors:s,clearErrors:o})=>l(E,{children:[e(z,{children:"What would you like to call this token?"}),e(ze,{value:t,name:"username",onChange:r=>n(r.target.value),label:"Token name",error:s.username!==void 0,errorText:s.username,onFocus:()=>o("username"),autoFocus:!0})]}),mt=({type:t,setType:n,apiTokenTypes:s})=>e(Ke,{children:l(Ne,{sx:{mb:2,width:"100%"},children:[e(Ve,{id:"token-type",children:"What do you want to connect?"}),e(we,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>n(r),children:s.map(({key:o,label:r,title:a,enabled:i})=>e(ve,{value:o,sx:{mb:1},disabled:!i,control:e(De,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e(T,{children:l(T,{children:[e(x,{children:r}),e(x,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),yt=({type:t,environment:n,setEnvironment:s})=>{const{environments:o}=$(),r=t===u.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return l(E,{children:[e(z,{children:"Which environment should the token have access to?"}),e(Qe,{disabled:t===u.ADMIN,options:r,value:n,onChange:s,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:Re,fullWidth:!0})]})},Ye=t=>t.map(n=>({...n.user,joinedAt:new Date(n.joinedAt),createdBy:n.createdBy})),ft=t=>{const{data:n,error:s,mutate:o}=xe(Pe(`api/admin/groups/${t}`),Ze);return p.useMemo(()=>({group:n&&{...n,users:Ye((n==null?void 0:n.users)??[])},loading:!s&&!n,refetchGroup:()=>o(),error:s}),[n,s,o])},Ze=t=>fetch(t).then(Be("Group")).then(n=>n.json()),bt=({roleId:t,value:n})=>{const{isEnterprise:s,uiConfig:o}=S();return s()&&o.flags.customRootRoles?e(A,{children:e(Le,{tooltip:e(Fe,{roleId:t,tooltip:!0}),children:n})}):e(A,{children:n})};export{rt as A,st as B,at as C,yt as E,ct as R,z as S,u as T,it as a,ut as b,dt as c,pt as d,mt as e,ht as f,ft as g,bt as h,Ye as m,lt as u};
|
|
1
|
+
import{fW as q,E as X,j as e,a6 as S,h as l,A as P,d as Y,ch as Z,g as J,F as E,C as g,B as T,k as ee,d7 as te,M as ne,N as oe,O as se,Q as re,i as H,y as O,as as ae,dy as le,bU as ie,fX as ce,t as m,aO as _,dG as de,U as A,dI as w,r as p,R as ue,H as v,d2 as he,du as pe,f as D,s as me,m as W,aM as G,cw as ye,fY as fe,c0 as be,bb as K,n as Ce,c2 as ge,cf as Te,ai as ke,l as $,fZ as R,cR as Ae,cP as Se,cQ as Ee,T as x,d_ as Ie,ae as Ne,e0 as we,c1 as ve,e1 as De,fc as Re,aR as xe,aS as Pe,aT as Be,dH as Le,dl as Fe}from"./index-78d048a4.js";const Ue=q(),st=Ue,je=X(e("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key"),He=()=>{const{uiConfig:t}=S();return l(P,{severity:"info",children:[l("p",{children:["Read the"," ",e("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e("strong",{children:"1 minute"})," before a new API key is activated."]}),e("br",{}),e("strong",{children:"API URL: "})," ",l("pre",{style:{display:"inline"},children:[t.unleashUrl,"/api/"]})]})},Me=["Icon","createdAt"],Oe=["Icon","project","seenAt"],rt=({compact:t=!1,setHiddenColumns:n,columns:s,loading:o,rows:r,getTableProps:a,getTableBodyProps:i,headerGroups:b,globalFilter:h,prepareRow:C})=>{const y=Y(Z.breakpoints.down("md"));return J([{condition:y,columns:Me},{condition:t,columns:Oe}],n,s),l(E,{children:[e(g,{condition:r.length>0,show:e(T,{sx:{mb:4},children:e(He,{})})}),e(T,{sx:{overflowX:"auto"},children:e(ee,{value:h,children:l(te,{...a(),children:[e(ne,{headerGroups:b}),e(oe,{...i(),children:r.map(f=>(C(f),e(se,{hover:!0,...f.getRowProps(),children:f.cells.map(c=>e(re,{...c.getCellProps(),children:c.render("Cell")}))})))})]})})}),e(g,{condition:r.length===0&&!o,show:e(g,{condition:(h==null?void 0:h.length)>0,show:l(H,{children:["No tokens found matching “",h,"”"]}),elseShow:e(H,{children:l("span",{children:["No tokens available. Read ",e(O,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},at=({path:t,permission:n,project:s})=>{const o=ae();return e(le,{Icon:ie,onClick:()=>o(t),"data-testid":ce,permission:n,projectId:s,maxWidth:"700px",children:"New API token"})},_e=m(_)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),We=({projects:t,project:n})=>{const{searchQuery:s}=de();let o=t&&Array.isArray(t)?t:n?[n]:[];return o.length===0?e(A,{children:e(w,{search:s,children:"*"})}):e(A,{children:o.map((r,a)=>l(p.Fragment,{children:[a>0&&", ",!r||r==="*"?e(w,{search:s,children:"*"}):e(_e,{to:`/projects/${r}`,children:e(w,{search:s,children:r})})]},r))})},lt=(t,n)=>{const s=p.useMemo(()=>({sortBy:[{id:"createdAt"}]}),[]),o=p.useMemo(()=>[{id:"Icon",width:"1%",Cell:()=>e(ue,{icon:e(je,{color:"disabled"})}),disableSortBy:!0,disableGlobalFilter:!0},{Header:"Username",accessor:"username",Cell:v},{Header:"Type",accessor:"type",Cell:({value:c})=>e(v,{value:M[c.toLowerCase()].label,subtitle:M[c.toLowerCase()].title}),minWidth:280},{Header:"Project",accessor:"project",Cell:c=>e(We,{project:c.row.original.project,projects:c.row.original.projects}),minWidth:120},{Header:"Environment",accessor:"environment",Cell:v,minWidth:120},{Header:"Created",accessor:"createdAt",Cell:he,minWidth:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:pe,minWidth:150,disableGlobalFilter:!0},{Header:"Actions",id:"Actions",align:"center",width:"1%",disableSortBy:!0,disableGlobalFilter:!0,Cell:n}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:b,prepareRow:h,state:C,setGlobalFilter:y,setHiddenColumns:f}=D.useTable({columns:o,data:t,initialState:s,sortTypes:me,autoResetHiddenColumns:!1,disableSortRemove:!0},D.useGlobalFilter,D.useSortBy);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:b,prepareRow:h,state:C,setGlobalFilter:y,setHiddenColumns:f,columns:o}},M={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},it=({token:t,project:n,permission:s,track:o})=>{const{setToastData:r}=W(),a=i=>{fe(i)&&(r({type:"success",title:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e(G,{permission:s,projectId:n,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e(ye,{})})},Ge=m("ul")({marginBottom:0}),ct=({token:t,permission:n,onRemove:s,project:o})=>{const[r,a]=p.useState(!1),{setToastData:i,setToastApiError:b}=W();return l(E,{children:[e(G,{permission:n,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e(be,{})}),e(K,{open:r,onClick:async()=>{try{await s(),a(!1),i({type:"success",title:"API token removed"})}catch(C){b(Ce(C))}},onClose:()=>a(!1),title:"Confirm deletion",children:l("div",{children:["Are you sure you want to delete the following API token?",e("br",{}),l(Ge,{children:[l("li",{children:[e("strong",{children:"username"}),":"," ",e("code",{children:t.username})]}),l("li",{children:[e("strong",{children:"type"}),": ",e("code",{children:t.type})]})]})]})})]})},Ke=m("div")(()=>({maxWidth:"400px"})),$e=m("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ze=m(ge)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),Qe=m(Te)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),z=m("p")(({theme:t})=>({marginBottom:t.spacing(1)})),Ve=m("label")(({theme:t})=>({marginBottom:t.spacing(1)})),qe=m(ke)(({theme:t})=>({marginLeft:t.spacing(3)})),Xe=m(T)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),dt=({children:t,actions:n,handleSubmit:s,handleCancel:o})=>{var i;const{uiConfig:r}=S(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return l($e,{onSubmit:s,children:[e(g,{condition:a,show:l(P,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e(O,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,l(Xe,{children:[n,e(qe,{onClick:o,children:"Cancel"})]})]})};var u=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(u||{});const ut=t=>{var F,U;const{environments:n}=$(),{uiConfig:s}=S(),o=(F=n==null?void 0:n.find(d=>d.enabled))==null?void 0:F.name,r=[{key:u.CLIENT,label:`Server-side SDK (${u.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy",enabled:R(Ae)}],a=R(Se),i=R(Ee);t||r.push({key:u.ADMIN,label:u.ADMIN,title:"Full access for managing Unleash",enabled:a}),s.flags.embedProxyFrontend&&r.splice(1,0,{key:u.FRONTEND,label:`Client-side SDK (${u.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:i});const b=(U=r.find(d=>d.enabled))==null?void 0:U.key,[h,C]=p.useState(""),[y,f]=p.useState(b||u.CLIENT),[c,I]=p.useState([t||"*"]),[Q,V]=p.useState(c),[B,k]=p.useState(),[L,N]=p.useState({});return p.useEffect(()=>{k(y==="ADMIN"?"*":o)},[y,o]),{username:h,type:y,apiTokenTypes:r,projects:c,environment:B,setUsername:C,setTokenType:d=>{d==="ADMIN"?(f(u.ADMIN),V(c),I(["*"]),k("*")):(f(d),I(Q),k(o))},setProjects:I,setEnvironment:k,getApiTokenPayload:()=>({username:h,type:y,environment:B,projects:c}),isValid:()=>{const d={};return h||(d.username="Username is required"),c.length===0&&(d.projects="At least one project is required"),N(d),Object.keys(d).length===0},clearErrors:d=>{if(d){const j={...L};delete j[d],N(j)}else N({})},errors:L}},ht=({open:t,closeConfirm:n,token:s,type:o})=>l(K,{open:t,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e(x,{variant:"body1",children:"Your new token has been created successfully."}),e(Ie,{token:s}),e(g,{condition:o===u.FRONTEND,show:l(P,{sx:{mt:2},severity:"info",children:["By default, all ",u.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e(_,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),pt=({username:t,setUsername:n,errors:s,clearErrors:o})=>l(E,{children:[e(z,{children:"What would you like to call this token?"}),e(ze,{value:t,name:"username",onChange:r=>n(r.target.value),label:"Token name",error:s.username!==void 0,errorText:s.username,onFocus:()=>o("username"),autoFocus:!0})]}),mt=({type:t,setType:n,apiTokenTypes:s})=>e(Ke,{children:l(Ne,{sx:{mb:2,width:"100%"},children:[e(Ve,{id:"token-type",children:"What do you want to connect?"}),e(we,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>n(r),children:s.map(({key:o,label:r,title:a,enabled:i})=>e(ve,{value:o,sx:{mb:1},disabled:!i,control:e(De,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e(T,{children:l(T,{children:[e(x,{children:r}),e(x,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),yt=({type:t,environment:n,setEnvironment:s})=>{const{environments:o}=$(),r=t===u.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return l(E,{children:[e(z,{children:"Which environment should the token have access to?"}),e(Qe,{disabled:t===u.ADMIN,options:r,value:n,onChange:s,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:Re,fullWidth:!0})]})},Ye=t=>t.map(n=>({...n.user,joinedAt:new Date(n.joinedAt),createdBy:n.createdBy})),ft=t=>{const{data:n,error:s,mutate:o}=xe(Pe(`api/admin/groups/${t}`),Ze);return p.useMemo(()=>({group:n&&{...n,users:Ye((n==null?void 0:n.users)??[])},loading:!s&&!n,refetchGroup:()=>o(),error:s}),[n,s,o])},Ze=t=>fetch(t).then(Be("Group")).then(n=>n.json()),bt=({roleId:t,value:n})=>{const{isEnterprise:s,uiConfig:o}=S();return s()&&o.flags.customRootRoles?e(A,{children:e(Le,{tooltip:e(Fe,{roleId:t,tooltip:!0}),children:n})}):e(A,{children:n})};export{rt as A,st as B,at as C,yt as E,ct as R,z as S,u as T,it as a,ut as b,dt as c,pt as d,mt as e,ht as f,ft as g,bt as h,Ye as m,lt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,I as S,B as t,bw as v,h as a,j as o,C as l,fV as k,a0 as m,a$ as p,F as b,G as y,aO as B}from"./index-
|
|
1
|
+
import{t as e,I as S,B as t,bw as v,h as a,j as o,C as l,fV as k,a0 as m,a$ as p,F as b,G as y,aO as B}from"./index-78d048a4.js";const I=e(S)({padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"}),w=e("div")(({theme:i})=>({fontSize:i.typography.fontSize,color:i.palette.text.secondary,position:"absolute",display:"none",right:"calc(100% + 6px)",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),C=e("div")(({theme:i})=>({fontSize:i.typography.fontSize,fontWeight:"normal",color:i.palette.text.secondary,display:"none",top:i.spacing(2.5),[i.breakpoints.up("md")]:{display:"block"}})),L=e("div")(({theme:i})=>({fontWeight:"normal",display:"none",[i.breakpoints.up("md")]:{display:"block"}})),j=e("div")({flexDirection:"column",justifyContent:"center",verticalAlign:"middle"}),z=e(t,{shouldForwardProp:i=>i!=="disabled"})(({theme:i,disabled:n})=>({borderRadius:i.shape.borderRadiusMedium,border:`1px solid ${i.palette.divider}`,"& + &":{marginTop:i.spacing(2)},background:n?i.palette.envAccordion.disabled:i.palette.background.paper})),F=e("div",{shouldForwardProp:i=>i!=="draggable"&&i!=="disabled"})(({theme:i,draggable:n,disabled:r})=>({padding:i.spacing(.5,2),display:"flex",gap:i.spacing(1),alignItems:"center",borderBottom:`1px solid ${i.palette.divider}`,fontWeight:i.typography.fontWeightMedium,paddingLeft:n?i.spacing(1):i.spacing(2),color:r?i.palette.text.secondary:i.palette.text.primary})),D=({strategy:i,onDragStart:n,onDragEnd:r,actions:g,children:u,orderNumber:s,style:x={},description:c})=>{const f=v(i.name),h="links"in i?({children:d})=>o(B,{to:i.links.edit,children:d}):({children:d})=>a(b,{children:[" ",d," "]});return a(t,{sx:{position:"relative"},children:[o(l,{condition:s!==void 0,show:o(w,{children:s})}),a(z,{disabled:(i==null?void 0:i.disabled)||!1,style:x,children:[a(F,{draggable:!!n,disabled:!!(i!=null&&i.disabled),children:[o(l,{condition:!!n,show:()=>o(I,{draggable:!0,disableRipple:!0,size:"small",onDragStart:n,onDragEnd:r,sx:{cursor:"move"},children:o(k,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"action.active"}})})}),o(f,{sx:{fill:d=>d.palette.action.disabled}}),a(j,{children:[a(h,{children:[o(m,{maxWidth:"400",maxLength:15,text:p(String(i.name))}),o(l,{condition:!!i.title,show:o(L,{children:p(String(i.title))})})]}),o(l,{condition:!!c,show:o(C,{children:c})})]}),o(l,{condition:!!(i!=null&&i.disabled),show:()=>o(b,{children:o(y,{color:"disabled",children:"Disabled"})})}),o(t,{sx:{marginLeft:"auto",display:"flex",minHeight:d=>d.spacing(6),alignItems:"center"},children:g})]}),o(t,{sx:{p:2,justifyItems:"center"},children:u})]})]})};export{D as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cH as A,g8 as li,cJ as ht,cK as z,g9 as ci,ga as zs,gb as Bs,gc as xe,eH as Hs,cI as Pe,gd as Zr,ge as Jr,gf as Li,gg as Ns,gh as to,gi as eo,gj as io,gk as vn,gl as no,gm as wn,gn as so,go as ro,gp as oo,gq as ao,r as kt,ci as Ws,bM as lo,gr as co,gs as ho,gt as uo}from"./index-
|
|
1
|
+
import{cH as A,g8 as li,cJ as ht,cK as z,g9 as ci,ga as zs,gb as Bs,gc as xe,eH as Hs,cI as Pe,gd as Zr,ge as Jr,gf as Li,gg as Ns,gh as to,gi as eo,gj as io,gk as vn,gl as no,gm as wn,gn as so,go as ro,gp as oo,gq as ao,r as kt,ci as Ws,bM as lo,gr as co,gs as ho,gt as uo}from"./index-78d048a4.js";import{a as $i}from"./index-b74e9af8.js";import{a as Vs}from"./index-545ad556.js";var fo=36e5;function go(i,t){A(2,arguments);var e=ht(t);return li(i,e*fo)}function Mn(i,t){var e,n,s,r,o,a,l,c;A(1,arguments);var h=ci(),u=ht((e=(n=(s=(r=t==null?void 0:t.weekStartsOn)!==null&&r!==void 0?r:t==null||(o=t.locale)===null||o===void 0||(a=o.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&s!==void 0?s:h.weekStartsOn)!==null&&n!==void 0?n:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&e!==void 0?e:0);if(!(u>=0&&u<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=z(i),f=d.getDay(),g=(f<u?7:0)+f-u;return d.setDate(d.getDate()-g),d.setHours(0,0,0,0),d}var po=6e4;function mo(i,t){A(2,arguments);var e=ht(t);return li(i,e*po)}function bo(i,t){A(2,arguments);var e=ht(t),n=e*3;return $i(i,n)}function yo(i,t){A(2,arguments);var e=ht(t);return li(i,e*1e3)}function xo(i,t){A(2,arguments);var e=ht(t),n=e*7;return Vs(i,n)}function _o(i,t){A(2,arguments);var e=ht(t);return $i(i,e*12)}function vo(i,t){A(2,arguments);var e=z(i),n=z(t),s=e.getFullYear()-n.getFullYear(),r=e.getMonth()-n.getMonth();return s*12+r}function wo(i,t){A(2,arguments);var e=z(i),n=z(t);return e.getFullYear()-n.getFullYear()}function hi(i,t){return A(2,arguments),z(i).getTime()-z(t).getTime()}var kn={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}},Mo="trunc";function Ae(i){return i?kn[i]:kn[Mo]}function ko(i,t,e){A(2,arguments);var n=hi(i,t)/zs;return Ae(e==null?void 0:e.roundingMethod)(n)}function Po(i,t,e){A(2,arguments);var n=hi(i,t)/Bs;return Ae(e==null?void 0:e.roundingMethod)(n)}function js(i){A(1,arguments);var t=z(i);return t.setHours(23,59,59,999),t}function Ys(i){A(1,arguments);var t=z(i),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(23,59,59,999),t}function So(i){A(1,arguments);var t=z(i);return js(t).getTime()===Ys(t).getTime()}function Us(i,t){A(2,arguments);var e=z(i),n=z(t),s=xe(e,n),r=Math.abs(vo(e,n)),o;if(r<1)o=0;else{e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-s*r);var a=xe(e,n)===-s;So(z(i))&&r===1&&xe(i,n)===1&&(a=!1),o=s*(r-Number(a))}return o===0?0:o}function To(i,t,e){A(2,arguments);var n=Us(i,t)/3;return Ae(e==null?void 0:e.roundingMethod)(n)}function Oo(i,t,e){A(2,arguments);var n=hi(i,t)/1e3;return Ae(e==null?void 0:e.roundingMethod)(n)}function Co(i,t,e){A(2,arguments);var n=Hs(i,t)/7;return Ae(e==null?void 0:e.roundingMethod)(n)}function Do(i,t){A(2,arguments);var e=z(i),n=z(t),s=xe(e,n),r=Math.abs(wo(e,n));e.setFullYear(1584),n.setFullYear(1584);var o=xe(e,n)===-s,a=s*(r-Number(o));return a===0?0:a}function Ao(i){A(1,arguments);var t=z(i);return t.setSeconds(0,0),t}function Lo(i){A(1,arguments);var t=z(i),e=t.getMonth(),n=e-e%3;return t.setMonth(n,1),t.setHours(0,0,0,0),t}function Ro(i){A(1,arguments);var t=z(i);return t.setDate(1),t.setHours(0,0,0,0),t}function Eo(i){A(1,arguments);var t=z(i),e=t.getFullYear();return t.setFullYear(e+1,0,0),t.setHours(23,59,59,999),t}function Io(i){A(1,arguments);var t=z(i),e=new Date(0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}function Fo(i){A(1,arguments);var t=z(i);return t.setMinutes(59,59,999),t}function zo(i,t){var e,n,s,r,o,a,l,c;A(1,arguments);var h=ci(),u=ht((e=(n=(s=(r=t==null?void 0:t.weekStartsOn)!==null&&r!==void 0?r:t==null||(o=t.locale)===null||o===void 0||(a=o.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&s!==void 0?s:h.weekStartsOn)!==null&&n!==void 0?n:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&e!==void 0?e:0);if(!(u>=0&&u<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=z(i),f=d.getDay(),g=(f<u?-7:0)+6-(f-u);return d.setDate(d.getDate()+g),d.setHours(23,59,59,999),d}function Bo(i){A(1,arguments);var t=z(i);return t.setSeconds(59,999),t}function Ho(i){A(1,arguments);var t=z(i),e=t.getMonth(),n=e-e%3+3;return t.setMonth(n,0),t.setHours(23,59,59,999),t}function No(i){A(1,arguments);var t=z(i);return t.setMilliseconds(999),t}function Pn(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=i[e];return n}function Wo(i,t){if(i){if(typeof i=="string")return Pn(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Pn(i,t)}}function Sn(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=Wo(i))||t&&i&&typeof i.length=="number"){e&&(i=e);var n=0,s=function(){};return{s,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(c){throw c},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var r=!0,o=!1,a;return{s:function(){e=e.call(i)},n:function(){var c=e.next();return r=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!r&&e.return!=null&&e.return()}finally{if(o)throw a}}}}function P(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ri(i,t){return Ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},Ri(i,t)}function H(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),t&&Ri(i,t)}function Ge(i){return Ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ge(i)}function Vo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function jo(i,t){if(t&&(Pe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P(i)}function N(i){var t=Vo();return function(){var n=Ge(i),s;if(t){var r=Ge(this).constructor;s=Reflect.construct(n,arguments,r)}else s=n.apply(this,arguments);return jo(this,s)}}function I(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function Yo(i,t){if(Pe(i)!=="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(Pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function $s(i){var t=Yo(i,"string");return Pe(t)==="symbol"?t:String(t)}function Tn(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,$s(n.key),n)}}function F(i,t,e){return t&&Tn(i.prototype,t),e&&Tn(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function k(i,t,e){return t=$s(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}var Uo=10,Xs=function(){function i(){I(this,i),k(this,"priority",void 0),k(this,"subPriority",0)}return F(i,[{key:"validate",value:function(e,n){return!0}}]),i}(),$o=function(i){H(e,i);var t=N(e);function e(n,s,r,o,a){var l;return I(this,e),l=t.call(this),l.value=n,l.validateValue=s,l.setValue=r,l.priority=o,a&&(l.subPriority=a),l}return F(e,[{key:"validate",value:function(s,r){return this.validateValue(s,this.value,r)}},{key:"set",value:function(s,r,o){return this.setValue(s,r,this.value,o)}}]),e}(Xs),Xo=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",Uo),k(P(n),"subPriority",-1),n}return F(e,[{key:"set",value:function(s,r){if(r.timestampIsSet)return s;var o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}}]),e}(Xs),W=function(){function i(){I(this,i),k(this,"incompatibleTokens",void 0),k(this,"priority",void 0),k(this,"subPriority",void 0)}return F(i,[{key:"run",value:function(e,n,s,r){var o=this.parse(e,n,s,r);return o?{setter:new $o(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}},{key:"validate",value:function(e,n,s){return!0}}]),i}(),qo=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",140),k(P(n),"incompatibleTokens",["R","u","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"G":case"GG":case"GGG":return o.era(s,{width:"abbreviated"})||o.era(s,{width:"narrow"});case"GGGGG":return o.era(s,{width:"narrow"});case"GGGG":default:return o.era(s,{width:"wide"})||o.era(s,{width:"abbreviated"})||o.era(s,{width:"narrow"})}}},{key:"set",value:function(s,r,o){return r.era=o,s.setUTCFullYear(o,0,1),s.setUTCHours(0,0,0,0),s}}]),e}(W),et={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Pt={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function it(i,t){return i&&{value:t(i.value),rest:i.rest}}function Z(i,t){var e=t.match(i);return e?{value:parseInt(e[0],10),rest:t.slice(e[0].length)}:null}function St(i,t){var e=t.match(i);if(!e)return null;if(e[0]==="Z")return{value:0,rest:t.slice(1)};var n=e[1]==="+"?1:-1,s=e[2]?parseInt(e[2],10):0,r=e[3]?parseInt(e[3],10):0,o=e[5]?parseInt(e[5],10):0;return{value:n*(s*zs+r*Bs+o*Zr),rest:t.slice(e[0].length)}}function qs(i){return Z(et.anyDigitsSigned,i)}function tt(i,t){switch(i){case 1:return Z(et.singleDigit,t);case 2:return Z(et.twoDigits,t);case 3:return Z(et.threeDigits,t);case 4:return Z(et.fourDigits,t);default:return Z(new RegExp("^\\d{1,"+i+"}"),t)}}function Ze(i,t){switch(i){case 1:return Z(et.singleDigitSigned,t);case 2:return Z(et.twoDigitsSigned,t);case 3:return Z(et.threeDigitsSigned,t);case 4:return Z(et.fourDigitsSigned,t);default:return Z(new RegExp("^-?\\d{1,"+i+"}"),t)}}function Xi(i){switch(i){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function Ks(i,t){var e=t>0,n=e?t:1-t,s;if(n<=50)s=i||100;else{var r=n+50,o=Math.floor(r/100)*100,a=i>=r%100;s=i+o-(a?100:0)}return e?s:1-s}function Qs(i){return i%400===0||i%4===0&&i%100!==0}var Ko=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",130),k(P(n),"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){var a=function(c){return{year:c,isTwoDigitYear:r==="yy"}};switch(r){case"y":return it(tt(4,s),a);case"yo":return it(o.ordinalNumber(s,{unit:"year"}),a);default:return it(tt(r.length,s),a)}}},{key:"validate",value:function(s,r){return r.isTwoDigitYear||r.year>0}},{key:"set",value:function(s,r,o){var a=s.getUTCFullYear();if(o.isTwoDigitYear){var l=Ks(o.year,a);return s.setUTCFullYear(l,0,1),s.setUTCHours(0,0,0,0),s}var c=!("era"in r)||r.era===1?o.year:1-o.year;return s.setUTCFullYear(c,0,1),s.setUTCHours(0,0,0,0),s}}]),e}(W),Qo=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",130),k(P(n),"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){var a=function(c){return{year:c,isTwoDigitYear:r==="YY"}};switch(r){case"Y":return it(tt(4,s),a);case"Yo":return it(o.ordinalNumber(s,{unit:"year"}),a);default:return it(tt(r.length,s),a)}}},{key:"validate",value:function(s,r){return r.isTwoDigitYear||r.year>0}},{key:"set",value:function(s,r,o,a){var l=Jr(s,a);if(o.isTwoDigitYear){var c=Ks(o.year,l);return s.setUTCFullYear(c,0,a.firstWeekContainsDate),s.setUTCHours(0,0,0,0),Li(s,a)}var h=!("era"in r)||r.era===1?o.year:1-o.year;return s.setUTCFullYear(h,0,a.firstWeekContainsDate),s.setUTCHours(0,0,0,0),Li(s,a)}}]),e}(W),Go=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",130),k(P(n),"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r){return Ze(r==="R"?4:r.length,s)}},{key:"set",value:function(s,r,o){var a=new Date(0);return a.setUTCFullYear(o,0,4),a.setUTCHours(0,0,0,0),Ns(a)}}]),e}(W),Zo=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",130),k(P(n),"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r){return Ze(r==="u"?4:r.length,s)}},{key:"set",value:function(s,r,o){return s.setUTCFullYear(o,0,1),s.setUTCHours(0,0,0,0),s}}]),e}(W),Jo=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",120),k(P(n),"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"Q":case"QQ":return tt(r.length,s);case"Qo":return o.ordinalNumber(s,{unit:"quarter"});case"QQQ":return o.quarter(s,{width:"abbreviated",context:"formatting"})||o.quarter(s,{width:"narrow",context:"formatting"});case"QQQQQ":return o.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return o.quarter(s,{width:"wide",context:"formatting"})||o.quarter(s,{width:"abbreviated",context:"formatting"})||o.quarter(s,{width:"narrow",context:"formatting"})}}},{key:"validate",value:function(s,r){return r>=1&&r<=4}},{key:"set",value:function(s,r,o){return s.setUTCMonth((o-1)*3,1),s.setUTCHours(0,0,0,0),s}}]),e}(W),ta=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",120),k(P(n),"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"q":case"qq":return tt(r.length,s);case"qo":return o.ordinalNumber(s,{unit:"quarter"});case"qqq":return o.quarter(s,{width:"abbreviated",context:"standalone"})||o.quarter(s,{width:"narrow",context:"standalone"});case"qqqqq":return o.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return o.quarter(s,{width:"wide",context:"standalone"})||o.quarter(s,{width:"abbreviated",context:"standalone"})||o.quarter(s,{width:"narrow",context:"standalone"})}}},{key:"validate",value:function(s,r){return r>=1&&r<=4}},{key:"set",value:function(s,r,o){return s.setUTCMonth((o-1)*3,1),s.setUTCHours(0,0,0,0),s}}]),e}(W),ea=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]),k(P(n),"priority",110),n}return F(e,[{key:"parse",value:function(s,r,o){var a=function(c){return c-1};switch(r){case"M":return it(Z(et.month,s),a);case"MM":return it(tt(2,s),a);case"Mo":return it(o.ordinalNumber(s,{unit:"month"}),a);case"MMM":return o.month(s,{width:"abbreviated",context:"formatting"})||o.month(s,{width:"narrow",context:"formatting"});case"MMMMM":return o.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return o.month(s,{width:"wide",context:"formatting"})||o.month(s,{width:"abbreviated",context:"formatting"})||o.month(s,{width:"narrow",context:"formatting"})}}},{key:"validate",value:function(s,r){return r>=0&&r<=11}},{key:"set",value:function(s,r,o){return s.setUTCMonth(o,1),s.setUTCHours(0,0,0,0),s}}]),e}(W),ia=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",110),k(P(n),"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){var a=function(c){return c-1};switch(r){case"L":return it(Z(et.month,s),a);case"LL":return it(tt(2,s),a);case"Lo":return it(o.ordinalNumber(s,{unit:"month"}),a);case"LLL":return o.month(s,{width:"abbreviated",context:"standalone"})||o.month(s,{width:"narrow",context:"standalone"});case"LLLLL":return o.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return o.month(s,{width:"wide",context:"standalone"})||o.month(s,{width:"abbreviated",context:"standalone"})||o.month(s,{width:"narrow",context:"standalone"})}}},{key:"validate",value:function(s,r){return r>=0&&r<=11}},{key:"set",value:function(s,r,o){return s.setUTCMonth(o,1),s.setUTCHours(0,0,0,0),s}}]),e}(W);function na(i,t,e){A(2,arguments);var n=z(i),s=ht(t),r=to(n,e)-s;return n.setUTCDate(n.getUTCDate()-r*7),n}var sa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",100),k(P(n),"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"w":return Z(et.week,s);case"wo":return o.ordinalNumber(s,{unit:"week"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=1&&r<=53}},{key:"set",value:function(s,r,o,a){return Li(na(s,o,a),a)}}]),e}(W);function ra(i,t){A(2,arguments);var e=z(i),n=ht(t),s=eo(e)-n;return e.setUTCDate(e.getUTCDate()-s*7),e}var oa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",100),k(P(n),"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"I":return Z(et.week,s);case"Io":return o.ordinalNumber(s,{unit:"week"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=1&&r<=53}},{key:"set",value:function(s,r,o){return Ns(ra(s,o))}}]),e}(W),aa=[31,28,31,30,31,30,31,31,30,31,30,31],la=[31,29,31,30,31,30,31,31,30,31,30,31],ca=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",90),k(P(n),"subPriority",1),k(P(n),"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"d":return Z(et.date,s);case"do":return o.ordinalNumber(s,{unit:"date"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){var o=s.getUTCFullYear(),a=Qs(o),l=s.getUTCMonth();return a?r>=1&&r<=la[l]:r>=1&&r<=aa[l]}},{key:"set",value:function(s,r,o){return s.setUTCDate(o),s.setUTCHours(0,0,0,0),s}}]),e}(W),ha=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",90),k(P(n),"subpriority",1),k(P(n),"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"D":case"DD":return Z(et.dayOfYear,s);case"Do":return o.ordinalNumber(s,{unit:"date"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){var o=s.getUTCFullYear(),a=Qs(o);return a?r>=1&&r<=366:r>=1&&r<=365}},{key:"set",value:function(s,r,o){return s.setUTCMonth(0,o),s.setUTCHours(0,0,0,0),s}}]),e}(W);function qi(i,t,e){var n,s,r,o,a,l,c,h;A(2,arguments);var u=ci(),d=ht((n=(s=(r=(o=e==null?void 0:e.weekStartsOn)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(l=a.options)===null||l===void 0?void 0:l.weekStartsOn)!==null&&r!==void 0?r:u.weekStartsOn)!==null&&s!==void 0?s:(c=u.locale)===null||c===void 0||(h=c.options)===null||h===void 0?void 0:h.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=z(i),g=ht(t),p=f.getUTCDay(),m=g%7,b=(m+7)%7,y=(b<d?7:0)+g-p;return f.setUTCDate(f.getUTCDate()+y),f}var ua=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",90),k(P(n),"incompatibleTokens",["D","i","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"E":case"EE":case"EEE":return o.day(s,{width:"abbreviated",context:"formatting"})||o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"});case"EEEEE":return o.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"});case"EEEE":default:return o.day(s,{width:"wide",context:"formatting"})||o.day(s,{width:"abbreviated",context:"formatting"})||o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"})}}},{key:"validate",value:function(s,r){return r>=0&&r<=6}},{key:"set",value:function(s,r,o,a){return s=qi(s,o,a),s.setUTCHours(0,0,0,0),s}}]),e}(W),da=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",90),k(P(n),"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o,a){var l=function(h){var u=Math.floor((h-1)/7)*7;return(h+a.weekStartsOn+6)%7+u};switch(r){case"e":case"ee":return it(tt(r.length,s),l);case"eo":return it(o.ordinalNumber(s,{unit:"day"}),l);case"eee":return o.day(s,{width:"abbreviated",context:"formatting"})||o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"});case"eeeee":return o.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"});case"eeee":default:return o.day(s,{width:"wide",context:"formatting"})||o.day(s,{width:"abbreviated",context:"formatting"})||o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"})}}},{key:"validate",value:function(s,r){return r>=0&&r<=6}},{key:"set",value:function(s,r,o,a){return s=qi(s,o,a),s.setUTCHours(0,0,0,0),s}}]),e}(W),fa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",90),k(P(n),"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o,a){var l=function(h){var u=Math.floor((h-1)/7)*7;return(h+a.weekStartsOn+6)%7+u};switch(r){case"c":case"cc":return it(tt(r.length,s),l);case"co":return it(o.ordinalNumber(s,{unit:"day"}),l);case"ccc":return o.day(s,{width:"abbreviated",context:"standalone"})||o.day(s,{width:"short",context:"standalone"})||o.day(s,{width:"narrow",context:"standalone"});case"ccccc":return o.day(s,{width:"narrow",context:"standalone"});case"cccccc":return o.day(s,{width:"short",context:"standalone"})||o.day(s,{width:"narrow",context:"standalone"});case"cccc":default:return o.day(s,{width:"wide",context:"standalone"})||o.day(s,{width:"abbreviated",context:"standalone"})||o.day(s,{width:"short",context:"standalone"})||o.day(s,{width:"narrow",context:"standalone"})}}},{key:"validate",value:function(s,r){return r>=0&&r<=6}},{key:"set",value:function(s,r,o,a){return s=qi(s,o,a),s.setUTCHours(0,0,0,0),s}}]),e}(W);function ga(i,t){A(2,arguments);var e=ht(t);e%7===0&&(e=e-7);var n=1,s=z(i),r=s.getUTCDay(),o=e%7,a=(o+7)%7,l=(a<n?7:0)+e-r;return s.setUTCDate(s.getUTCDate()+l),s}var pa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",90),k(P(n),"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){var a=function(c){return c===0?7:c};switch(r){case"i":case"ii":return tt(r.length,s);case"io":return o.ordinalNumber(s,{unit:"day"});case"iii":return it(o.day(s,{width:"abbreviated",context:"formatting"})||o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"}),a);case"iiiii":return it(o.day(s,{width:"narrow",context:"formatting"}),a);case"iiiiii":return it(o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"}),a);case"iiii":default:return it(o.day(s,{width:"wide",context:"formatting"})||o.day(s,{width:"abbreviated",context:"formatting"})||o.day(s,{width:"short",context:"formatting"})||o.day(s,{width:"narrow",context:"formatting"}),a)}}},{key:"validate",value:function(s,r){return r>=1&&r<=7}},{key:"set",value:function(s,r,o){return s=ga(s,o),s.setUTCHours(0,0,0,0),s}}]),e}(W),ma=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",80),k(P(n),"incompatibleTokens",["b","B","H","k","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"a":case"aa":case"aaa":return o.dayPeriod(s,{width:"abbreviated",context:"formatting"})||o.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaaa":return o.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return o.dayPeriod(s,{width:"wide",context:"formatting"})||o.dayPeriod(s,{width:"abbreviated",context:"formatting"})||o.dayPeriod(s,{width:"narrow",context:"formatting"})}}},{key:"set",value:function(s,r,o){return s.setUTCHours(Xi(o),0,0,0),s}}]),e}(W),ba=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",80),k(P(n),"incompatibleTokens",["a","B","H","k","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"b":case"bb":case"bbb":return o.dayPeriod(s,{width:"abbreviated",context:"formatting"})||o.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbbb":return o.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return o.dayPeriod(s,{width:"wide",context:"formatting"})||o.dayPeriod(s,{width:"abbreviated",context:"formatting"})||o.dayPeriod(s,{width:"narrow",context:"formatting"})}}},{key:"set",value:function(s,r,o){return s.setUTCHours(Xi(o),0,0,0),s}}]),e}(W),ya=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",80),k(P(n),"incompatibleTokens",["a","b","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"B":case"BB":case"BBB":return o.dayPeriod(s,{width:"abbreviated",context:"formatting"})||o.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBBB":return o.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return o.dayPeriod(s,{width:"wide",context:"formatting"})||o.dayPeriod(s,{width:"abbreviated",context:"formatting"})||o.dayPeriod(s,{width:"narrow",context:"formatting"})}}},{key:"set",value:function(s,r,o){return s.setUTCHours(Xi(o),0,0,0),s}}]),e}(W),xa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",70),k(P(n),"incompatibleTokens",["H","K","k","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"h":return Z(et.hour12h,s);case"ho":return o.ordinalNumber(s,{unit:"hour"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=1&&r<=12}},{key:"set",value:function(s,r,o){var a=s.getUTCHours()>=12;return a&&o<12?s.setUTCHours(o+12,0,0,0):!a&&o===12?s.setUTCHours(0,0,0,0):s.setUTCHours(o,0,0,0),s}}]),e}(W),_a=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",70),k(P(n),"incompatibleTokens",["a","b","h","K","k","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"H":return Z(et.hour23h,s);case"Ho":return o.ordinalNumber(s,{unit:"hour"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=0&&r<=23}},{key:"set",value:function(s,r,o){return s.setUTCHours(o,0,0,0),s}}]),e}(W),va=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",70),k(P(n),"incompatibleTokens",["h","H","k","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"K":return Z(et.hour11h,s);case"Ko":return o.ordinalNumber(s,{unit:"hour"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=0&&r<=11}},{key:"set",value:function(s,r,o){var a=s.getUTCHours()>=12;return a&&o<12?s.setUTCHours(o+12,0,0,0):s.setUTCHours(o,0,0,0),s}}]),e}(W),wa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",70),k(P(n),"incompatibleTokens",["a","b","h","H","K","t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"k":return Z(et.hour24h,s);case"ko":return o.ordinalNumber(s,{unit:"hour"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=1&&r<=24}},{key:"set",value:function(s,r,o){var a=o<=24?o%24:o;return s.setUTCHours(a,0,0,0),s}}]),e}(W),Ma=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",60),k(P(n),"incompatibleTokens",["t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"m":return Z(et.minute,s);case"mo":return o.ordinalNumber(s,{unit:"minute"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=0&&r<=59}},{key:"set",value:function(s,r,o){return s.setUTCMinutes(o,0,0),s}}]),e}(W),ka=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",50),k(P(n),"incompatibleTokens",["t","T"]),n}return F(e,[{key:"parse",value:function(s,r,o){switch(r){case"s":return Z(et.second,s);case"so":return o.ordinalNumber(s,{unit:"second"});default:return tt(r.length,s)}}},{key:"validate",value:function(s,r){return r>=0&&r<=59}},{key:"set",value:function(s,r,o){return s.setUTCSeconds(o,0),s}}]),e}(W),Pa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",30),k(P(n),"incompatibleTokens",["t","T"]),n}return F(e,[{key:"parse",value:function(s,r){var o=function(l){return Math.floor(l*Math.pow(10,-r.length+3))};return it(tt(r.length,s),o)}},{key:"set",value:function(s,r,o){return s.setUTCMilliseconds(o),s}}]),e}(W),Sa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",10),k(P(n),"incompatibleTokens",["t","T","x"]),n}return F(e,[{key:"parse",value:function(s,r){switch(r){case"X":return St(Pt.basicOptionalMinutes,s);case"XX":return St(Pt.basic,s);case"XXXX":return St(Pt.basicOptionalSeconds,s);case"XXXXX":return St(Pt.extendedOptionalSeconds,s);case"XXX":default:return St(Pt.extended,s)}}},{key:"set",value:function(s,r,o){return r.timestampIsSet?s:new Date(s.getTime()-o)}}]),e}(W),Ta=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",10),k(P(n),"incompatibleTokens",["t","T","X"]),n}return F(e,[{key:"parse",value:function(s,r){switch(r){case"x":return St(Pt.basicOptionalMinutes,s);case"xx":return St(Pt.basic,s);case"xxxx":return St(Pt.basicOptionalSeconds,s);case"xxxxx":return St(Pt.extendedOptionalSeconds,s);case"xxx":default:return St(Pt.extended,s)}}},{key:"set",value:function(s,r,o){return r.timestampIsSet?s:new Date(s.getTime()-o)}}]),e}(W),Oa=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",40),k(P(n),"incompatibleTokens","*"),n}return F(e,[{key:"parse",value:function(s){return qs(s)}},{key:"set",value:function(s,r,o){return[new Date(o*1e3),{timestampIsSet:!0}]}}]),e}(W),Ca=function(i){H(e,i);var t=N(e);function e(){var n;I(this,e);for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return n=t.call.apply(t,[this].concat(r)),k(P(n),"priority",20),k(P(n),"incompatibleTokens","*"),n}return F(e,[{key:"parse",value:function(s){return qs(s)}},{key:"set",value:function(s,r,o){return[new Date(o),{timestampIsSet:!0}]}}]),e}(W),Da={G:new qo,y:new Ko,Y:new Qo,R:new Go,u:new Zo,Q:new Jo,q:new ta,M:new ea,L:new ia,w:new sa,I:new oa,d:new ca,D:new ha,E:new ua,e:new da,c:new fa,i:new pa,a:new ma,b:new ba,B:new ya,h:new xa,H:new _a,K:new va,k:new wa,m:new Ma,s:new ka,S:new Pa,X:new Sa,x:new Ta,t:new Oa,T:new Ca},Aa=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,La=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ra=/^'([^]*?)'?$/,Ea=/''/g,Ia=/\S/,Fa=/[a-zA-Z]/;function za(i,t,e,n){var s,r,o,a,l,c,h,u,d,f,g,p,m,b,y,_,v,x;A(3,arguments);var w=String(i),M=String(t),T=ci(),S=(s=(r=n==null?void 0:n.locale)!==null&&r!==void 0?r:T.locale)!==null&&s!==void 0?s:io;if(!S.match)throw new RangeError("locale must contain match property");var L=ht((o=(a=(l=(c=n==null?void 0:n.firstWeekContainsDate)!==null&&c!==void 0?c:n==null||(h=n.locale)===null||h===void 0||(u=h.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&l!==void 0?l:T.firstWeekContainsDate)!==null&&a!==void 0?a:(d=T.locale)===null||d===void 0||(f=d.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(L>=1&&L<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var R=ht((g=(p=(m=(b=n==null?void 0:n.weekStartsOn)!==null&&b!==void 0?b:n==null||(y=n.locale)===null||y===void 0||(_=y.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&m!==void 0?m:T.weekStartsOn)!==null&&p!==void 0?p:(v=T.locale)===null||v===void 0||(x=v.options)===null||x===void 0?void 0:x.weekStartsOn)!==null&&g!==void 0?g:0);if(!(R>=0&&R<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(M==="")return w===""?z(e):new Date(NaN);var D={firstWeekContainsDate:L,weekStartsOn:R,locale:S},K=[new Xo],rt=M.match(La).map(function(st){var U=st[0];if(U in vn){var ft=vn[U];return ft(st,S.formatLong)}return st}).join("").match(Aa),O=[],X=Sn(rt),Q;try{var Ct=function(){var U=Q.value;!(n!=null&&n.useAdditionalWeekYearTokens)&&no(U)&&wn(U,M,i),!(n!=null&&n.useAdditionalDayOfYearTokens)&&so(U)&&wn(U,M,i);var ft=U[0],ze=Da[ft];if(ze){var yn=ze.incompatibleTokens;if(Array.isArray(yn)){var xn=O.find(function(_n){return yn.includes(_n.token)||_n.token===ft});if(xn)throw new RangeError("The format string mustn't contain `".concat(xn.fullToken,"` and `").concat(U,"` at the same time"))}else if(ze.incompatibleTokens==="*"&&O.length>0)throw new RangeError("The format string mustn't contain `".concat(U,"` and any other token at the same time"));O.push({token:ft,fullToken:U});var xi=ze.run(w,U,S.match,D);if(!xi)return{v:new Date(NaN)};K.push(xi.setter),w=xi.rest}else{if(ft.match(Fa))throw new RangeError("Format string contains an unescaped latin alphabet character `"+ft+"`");if(U==="''"?U="'":ft==="'"&&(U=Ba(U)),w.indexOf(U)===0)w=w.slice(U.length);else return{v:new Date(NaN)}}};for(X.s();!(Q=X.n()).done;){var ie=Ct();if(Pe(ie)==="object")return ie.v}}catch(st){X.e(st)}finally{X.f()}if(w.length>0&&Ia.test(w))return new Date(NaN);var Et=K.map(function(st){return st.priority}).sort(function(st,U){return U-st}).filter(function(st,U,ft){return ft.indexOf(st)===U}).map(function(st){return K.filter(function(U){return U.priority===st}).sort(function(U,ft){return ft.subPriority-U.subPriority})}).map(function(st){return st[0]}),It=z(e);if(isNaN(It.getTime()))return new Date(NaN);var dt=ro(It,oo(It)),Ft={},zt=Sn(Et),ne;try{for(zt.s();!(ne=zt.n()).done;){var se=ne.value;if(!se.validate(dt,D))return new Date(NaN);var Fe=se.set(dt,Ft,D);Array.isArray(Fe)?(dt=Fe[0],ao(Ft,Fe[1])):dt=Fe}}catch(st){zt.e(st)}finally{zt.f()}return dt}function Ba(i){return i.match(Ra)[1].replace(Ea,"'")}function Ha(i){A(1,arguments);var t=z(i);return t.setMinutes(0,0,0),t}function Na(i){A(1,arguments);var t=z(i);return t.setMilliseconds(0),t}/*!
|
|
3
3
|
* Chart.js v3.9.1
|
|
4
4
|
* https://www.chartjs.org
|