unleash-server 5.2.2 → 5.2.4
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-0dfff43f.js → AdvancedPlayground-b8d00f81.js} +1 -1
- package/frontend/build/static/{CreateProject-b7f8de7a.js → CreateProject-fe1d0f0f.js} +1 -1
- package/frontend/build/static/{Error-71e2c977.js → Error-6550f020.js} +1 -1
- package/frontend/build/static/{FeatureArchiveDialog-4d2f3953.js → FeatureArchiveDialog-42d2cf92.js} +1 -1
- package/frontend/build/static/{FeatureMetricsChart-e1a34382.js → FeatureMetricsChart-70a6747e.js} +1 -1
- package/frontend/build/static/{FeatureViewLazyExport-3a021f35.js → FeatureViewLazyExport-60874e5e.js} +2 -2
- package/frontend/build/static/{LazyAdminExport-546d2ced.js → LazyAdminExport-c5eec10c.js} +2 -2
- package/frontend/build/static/{LazyProjectExport-6445b527.js → LazyProjectExport-7f66ff80.js} +1 -1
- package/frontend/build/static/{NetworkOverview-c0c2c8df.js → NetworkOverview-b82ebe0c.js} +2 -2
- package/frontend/build/static/{NetworkTraffic-9390e1ed.js → NetworkTraffic-51a825ea.js} +1 -1
- package/frontend/build/static/{Playground-f63ff456.js → Playground-2b482aeb.js} +1 -1
- package/frontend/build/static/{PlaygroundGuidancePopper-b56ef034.js → PlaygroundGuidancePopper-5673aca8.js} +1 -1
- package/frontend/build/static/{RoleCell-1aaafbaa.js → RoleCell-c9b26e7a.js} +1 -1
- package/frontend/build/static/{StrategyItemContainer-0c77dc4b.js → StrategyItemContainer-7b356e23.js} +1 -1
- package/frontend/build/static/{chartjs-adapter-date-fns.esm-21bf4359.js → chartjs-adapter-date-fns.esm-04fda623.js} +1 -1
- package/frontend/build/static/{flowchart-elk-definition-170a3958-a7461fc0.js → flowchart-elk-definition-170a3958-68f1625d.js} +1 -1
- package/frontend/build/static/{index-d3c3fe33.js → index-545ad556.js} +1 -1
- package/frontend/build/static/{index-7bc6399c.js → index-78d048a4.js} +79 -79
- package/frontend/build/static/{index-cd43ec71.js → index-b74e9af8.js} +1 -1
- package/frontend/build/static/{is_dark-59f2cf1b.js → is_dark-77b9ee14.js} +1 -1
- package/frontend/build/static/{mindmap-definition-44684416-4924e603.js → mindmap-definition-44684416-4cca63a5.js} +1 -1
- package/frontend/build/static/{timeline-definition-8e5a9bc6-31a3401d.js → timeline-definition-8e5a9bc6-31dad151.js} +1 -1
- package/frontend/build/static/{unknownify-e3fc74cf.js → unknownify-53fb2d5d.js} +1 -1
- package/frontend/package.json +4 -3
- package/package.json +4 -3
|
@@ -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-7bc6399c.js";import{S as pu}from"./StrategyItemContainer-0c77dc4b.js";import{E as mu}from"./Error-71e2c977.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-7bc6399c.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
|