summaryrefslogtreecommitdiffstats
path: root/src/web/gui/v2/8910.019974f8675d8834dd07.chunk.js
blob: 4994dbcd92550ad12f817b0688678a16f5f0ed79 (plain)
1
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="de8a317e-0a71-4867-90ec-4ad8fd101ec6",e._sentryDebugIdIdentifier="sentry-dbid-de8a317e-0a71-4867-90ec-4ad8fd101ec6")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"30b1ba65cc8722be7e184f4a401fb43e6b21634d"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[8910],{8910:(e,t,n)=>{n.r(t),n.d(t,{default:()=>lo});var l=n(58168),o=(n(62953),n(96540)),r=n(83199),a=n(46741),i=n(11128),s=n(47762),c=n(47193);n(14905),n(98992),n(8872);const d=function(){let{selectedNode:e,nodes:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=(0,o.useMemo)((()=>t.reduce(((e,t)=>{var n;let{id:l,ni:o,name:r,isLive:a,isPreferred:i,capabilities:s}=t;return a&&i&&null!==(n=s.dyncfg)&&void 0!==n&&n.enabled?[...e,{label:r,value:l,isParent:0==o}]:e}),[])),[t]),l=(0,o.useMemo)((()=>(e=>e?null!==e&&void 0!==e&&e.id&&null!==e&&void 0!==e&&e.name?{label:e.name,value:e.id,isParent:0==e.ni}:e:null)(e)||(n.length?n[0]:"")),[n]),[r,a]=(0,o.useState)();return(0,o.useEffect)((()=>{l&&a(l)}),[l,a]),{options:n,node:r,setNode:a}};n(41393),n(81454);var u=n(63950),m=n.n(u);const p=function(){let{node:e,setNode:t=m(),options:n=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o.createElement(r.Box,{width:"250px"},o.createElement(r.Flex,{column:!0,gap:1},o.createElement(r.TextBig,null,"Node"),o.createElement(r.Select,{placeholder:"Select a node",options:n,value:e,onChange:t})))};n(74648),n(17333),n(23215),n(54520);var g=n(27467);const h=(0,o.createContext)({}),f=()=>{const e=(0,o.useContext)(h),[,t]=(0,g.N9)(),{searchItem:n,setSearchItem:l}=e||{},{term:r,props:a}=n||{},i=!!Object.keys(n.props||{}).length,s=(0,o.useCallback)((e=>{t({dyncfgSearchTerm:void 0}),l((t=>({...t,term:e})))}),[l,t]),c=(0,o.useCallback)(((e,t)=>{l((n=>({...n,props:{...n.props||{},[e]:t}})))}),[l]),d=(0,o.useCallback)((e=>{l((t=>{var n;const l={...t};return null!==(n=l.props)&&void 0!==n&&n[e]&&delete l.props[e],l}))}),[l]),u=(0,o.useCallback)((e=>{try{return new RegExp(r).test(e)}catch(t){return m()}}),[r]),p=(0,o.useCallback)((e=>!a||!Object.entries(a).filter((e=>{let[,t]=e;return void 0!==t})).length||Object.entries(a).every((t=>{let[n,l]=t;return e[n]==l}))),[a]);if(!e)throw new Error("Attempt to use 'useSearch' outside of 'SearchContext.Provider'");return{searchItem:n,hasProps:i,searchForTerm:s,searchByProp:c,testString:u,testProps:p,removeSearchProp:d}},b=e=>{let{children:t}=e;const[{dyncfgSearchTerm:n}]=(0,g.N9)(),[l,r]=(0,o.useState)({term:n});return o.createElement(h.Provider,{value:{searchItem:l,setSearchItem:r}},t)},E=()=>{const{searchItem:e,searchForTerm:t}=f(),{term:n}=e||{};return o.createElement(r.Box,{width:"250px"},o.createElement(r.Flex,{column:!0,gap:1},o.createElement(r.TextBig,null,"Search"),o.createElement(r.SearchInput,{value:n,placeholder:"Search",onChange:t,size:"large",height:"33px",padding:[2,3]})))};var v=n(29217),y=n(32089),C=n(8711);const x=(0,C.default)(r.Flex).withConfig({displayName:"styled__StyledSection",componentId:"sc-dutbst-0"})(["&:hover{background-color:",";}"],(0,r.getColor)("secondaryHighlight")),w=(0,C.default)(r.Button).withConfig({displayName:"styled__StyledButton",componentId:"sc-dutbst-1"})(["&:before{content:",";width:18px;height:18px;display:",";align-items:center;justify-content:center;font-size:11px;font-weight:bold;position:absolute;top:-6px;left:-10px;border-radius:50%;background-color:",";color:",";z-index:10;}"],(e=>{let{warningItems:t}=e;return'"'.concat(t,'"')}),(e=>{let{warningItems:t}=e;return t?"flex":"none"}),(0,r.getColor)("error"),(0,r.getColor)("bright"));var k=n(94390),S=n(49286);const I=e=>{let{title:t="",props:n={},config:l={}}=e;const{searchItem:a,searchByProp:i,removeSearchProp:s}=f(),{props:c}=a||{},d=(0,o.useCallback)(((e,t)=>{const{searchCondition:n}=l[e]||{},o=Object.entries(n||{});if(o.length){const[e,n]=o[0];t?s(e):i(e,n)}}),[i,s]);return o.createElement(r.Flex,{column:!0,gap:1},o.createElement(r.TextBig,{strong:!0},t),o.createElement(r.Flex,{column:!0},Object.entries(l).map((e=>{var t;let[a,{label:i,searchCondition:s}]=e;const u=(0,S.bn)(n||{})[a]||0,[m,p]=Object.entries(s)[0],g=!!c&&c[m]==p,h=k.zy.includes(a)&&u>0?{color:"error"}:{};return o.createElement(v.A,{key:a,content:null===(t=l[a])||void 0===t?void 0:t.tooltip,align:"bottom",isBasic:!0,base:{background:"main",padding:[2]}},o.createElement(x,{width:"100%",alignItems:"center",justifyContent:"between",gap:2,background:g?"menuItemSelected":"none",padding:[1,2],round:!0,cursor:"pointer",onClick:()=>d(a,g)},o.createElement(r.TextBig,h,i),o.createElement(r.TextBig,h,u)))}))))},A=e=>{let{attention:t,source_type:n,status:l}=e;return o.createElement(r.Flex,{column:!0,padding:[3],gap:2},o.createElement(I,{title:"Attention",props:t,config:k.lp}),o.createElement(y.A,{color:"border"}),o.createElement(I,{title:"Source type",props:n,config:k.V8}),o.createElement(y.A,{color:"border"}),o.createElement(I,{title:"Status",props:l,config:k.T_}))},T=(0,o.memo)(A),F=Object.keys(k.T_),B=Object.keys(k.V8),D=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=t.reduce(((e,t)=>({...e,[t]:0})),{});return function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;for(let n=0;n<t.length;n++)if(t[n]==l[e]){var r;const t=l[e];o[e]||(o[e]={}),o[e][t]=((null===(r=o[e])||void 0===r?void 0:r[t])||0)+1}}},N=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,l;(t.attention||(t.attention={}),e.restart_required)&&(t.attention.restart_required=((null===(n=t.attention)||void 0===n?void 0:n.restart_required)||0)+1);e.plugin_rejected&&(t.attention.plugin_rejected=((null===(l=t.attention)||void 0===l?void 0:l.plugin_rejected)||0)+1)},P=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Object.entries(e);if(n.length)for(let l=0;l<n.length;l++){const[e,o]=n[l];if(e.match(/\/[^/]+/g))return P(o,t);o.type&&"template"!=o.type&&(D("status",F)(o,t),D("source_type",B)(o,t),N(o,t))}return t},_=e=>{let{tree:t}=e;const{attention:n,source_type:l,status:r}=(0,o.useMemo)((()=>Object.keys(t)?P(t):{}),[t]);return{warningItems:((null===n||void 0===n?void 0:n.restart_required)||0)+((null===n||void 0===n?void 0:n.plugin_rejected)||0)+((null===r||void 0===r?void 0:r.failed)||0)+((null===r||void 0===r?void 0:r.incomplete)||0),menuItems:{attention:n,source_type:l,status:r}}};var L=n(87659);const M=e=>{let{tree:t={}}=e;const n=(0,o.useRef)(),[l,a,,i]=(0,L.A)(!1),{hasProps:s}=f(),{warningItems:c,menuItems:d}=_({tree:t});return o.createElement(o.Fragment,null,o.createElement(v.A,{align:"bottom",content:"Show filters"},o.createElement(r.Flex,{ref:n},o.createElement(w,{flavour:s?"default":"hollow",icon:"filterList",onClick:a,warningItems:c}))),l&&n.current?o.createElement(r.Drop,{width:60,target:n.current,align:{top:"bottom",right:"right"},animation:!0,background:"modalTabsBackground",margin:[2,0,0],round:1,close:i,onClickOutside:i,onEsc:i},o.createElement(T,d)):null)};var O=n(8239);const R=()=>{const e=(0,O.Hj)();return o.createElement(v.A,{align:"bottom",content:"Reload"},o.createElement(r.Flex,null,o.createElement(r.Button,{flavour:"hollow",icon:"refresh",onClick:e})))};var j=n(39225);n(8159),n(37550);const z=(0,o.createContext)({}),H=()=>(0,o.useContext)(z),U=z,W=(0,o.createContext)(),V={name:""},K=()=>{const e=(0,o.useContext)(W),{id:t,open:n,isNewItem:l,formData:r,setFormData:a,submitType:i,setSubmitType:s,isLoading:c,startLoading:d,stopLoading:u,fullPage:m,setFullPage:p,entityProps:g,isDirty:h,setIsDirty:f,error:b}=e||{},E=(0,o.useCallback)((e=>a((t=>({...t,name:e})))),[a]);if(!e)throw new Error("Attempt to use 'useConfigItemContext' outside of 'ConfigItemContext.Provider'");return{id:t,open:n,isNewItem:l,formData:r,setFormData:a,submitType:i,setSubmitType:s,setName:E,isLoading:c,startLoading:d,stopLoading:u,fullPage:m,setFullPage:p,entityProps:g,isDirty:h,setIsDirty:f,error:b}},q=e=>{let{children:t,...n}=e;const[l,r]=(0,o.useState)(V),[a,i]=(0,o.useState)("submit");return o.createElement(W.Provider,{value:{...n,formData:l,setFormData:r,submitType:a,setSubmitType:i}},t)};var Y=n(81198);n(9391);const $=()=>{const[e,t]=(0,o.useState)([]),n=(0,o.useCallback)((e=>t(e)),[t]);return{errors:e,onError:n,resetErrors:(0,o.useCallback)((()=>t([])),[t])}};var G=n(71835);const J=function(){let{defaultName:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,formData:n,isNewItem:l}=K();return(0,o.useMemo)((()=>(l?null===n||void 0===n?void 0:n.name:(0,Y.J3)(t))||e),[l,null===n||void 0===n?void 0:n.name,t,e])};var Q=n(80158);const Z=()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Something went wrong",{data:n={}}=(null===e||void 0===e?void 0:e.response)||{};try{n=JSON.parse(n)}catch(a){}const{message:l,errorMessage:o,error_message:r}=n;return(0,Q.Zr)(l||o||r||t)},X=()=>{const[e,t,,n]=(0,G.A)(),l=Z(),r=(0,o.useCallback)((function(){let{successMessage:t="Successfully saved"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l=>{let{data:{message:o}}=l;(o?n:e)({header:o?"Warning":"Success",text:o||t})}}),[e,n]),a=(0,o.useCallback)((function(){let{header:e="Error",text:n="Something went wrong"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return o=>{const r=l(o,n);t({header:e,text:r})}}),[t]);return[r,a]};var ee=n(50876);const te=function(){let{id:e,node:t,onError:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const l=(0,O.y8)({id:e,node:t}),r=J(),{setValue:a,setError:i}=(0,O.MQ)(),[,s]=X(),c=s(),d="function"==typeof n?n:c,u=Z(),m=(0,o.useRef)();return(e,t)=>{m.current&&(clearTimeout(m.current),m.current=null);const n=null===t?t:t||r;m.current=setTimeout((()=>{l({name:n,payload:e}).then((e=>{a(e.data||"")})).catch((e=>{i(u(e)),d(e)}))}),500)}},ne=e=>{let{id:t,node:n,data:l,userConfigIsOpen:r,submitMethod:a,onSchemaFetch:i,setIsDirty:s,setError:c}=e;const{isNewItem:d,formData:u,setFormData:p,isLoading:g,startLoading:h,stopLoading:f,entityProps:b={}}=K(),{cmds:E=[]}=b,v=E.includes("userconfig"),{sendLog:y}=(0,ee.A)(),[C,x]=(0,G.A)(),{loaded:w,value:k,hasError:S,error:I,refresh:A}=(0,O.t8)({id:t,node:n}),{loaded:T,value:F,hasError:B,refresh:D}=l,N=w&&T,P=I||B,_=(0,O.Hj)(),L=(0,O.O_)({node:n,id:t}),M=te({id:t,node:n,onError:m()}),{errors:R,onError:j,resetErrors:z}=$();(0,o.useEffect)((()=>{w&&k&&!S&&i(k)}),[w,k]),(0,o.useEffect)((()=>{c(P)}),[P]);const H=(0,o.useCallback)(((e,t)=>{const{name:n,...l}=e.formData,o={name:F.name,...l};p(o),s(!t),v&&r&&M(o)}),[p,s,v,r,M]),U=(0,o.useCallback)((e=>{H({formData:e})}),[H]),W=(0,o.useCallback)((e=>{z();const n={...e.formData,...d&&null!==u&&void 0!==u&&u.name?{name:u.name}:{}};h(),a(n).then((()=>{s(!1),d?_():(L(),A(),D()),C({header:"Success",text:"Successfully submitted configuration"}),y({feature:"DyncnfForm",description:"Submit success",id:t})})).catch((e=>{var n,l;const o=(null===(n=e.response)||void 0===n?void 0:n.data)||e;x({header:"Error",text:(null===o||void 0===o?void 0:o.message)||"Something went wrong"}),y({feature:"DyncnfForm",description:"Submit error",id:t,error:JSON.stringify((null===(l=e.response)||void 0===l?void 0:l.data)||{})})})).finally((()=>{f()}))}),[d,u,h,f,L,A,D,j]);return{isLoading:g,loaded:N,formData:F,setFormData:U,schema:k,resourcesError:P,errors:R,onChange:H,onSubmit:W,onError:j,getUserConfig:M}},le=(0,C.default)(r.TextBig).withConfig({displayName:"styled__StyledTitle",componentId:"sc-16w9sl7-0"})(["font-family:monospace;"]),oe=(0,C.default)(r.Icon).attrs((e=>({opacity:"1",cursor:"pointer",...e}))).withConfig({displayName:"styled__StyledTemplateArrow",componentId:"sc-16w9sl7-1"})(["opacity:",";cursor:",";"],(e=>{let{hasTemplateChildren:t}=e;return t?"1":"0"}),(e=>{let{hasTemplateChildren:t}=e;return t?"pointer":"default"})),re=(0,C.default)(r.Flex).withConfig({displayName:"styled__StyledHeader",componentId:"sc-16w9sl7-2"})(["height:","px;border-top:1px solid ",";border-left:1px solid ",";border-right:1px solid ",";border-bottom:1px solid ",";border-bottom-style:",";"],k.FL,(0,r.getColor)("border"),(0,r.getColor)("border"),(0,r.getColor)("border"),(0,r.getColor)("border"),(e=>{let{isOpenEntity:t}=e;return t?"none":"solid"})),ae=(0,C.default)(r.Collapsible).withConfig({displayName:"styled__StyledCollapsible",componentId:"sc-16w9sl7-3"})(["height:",";max-height:",";overflow:auto;"],(e=>{let{open:t,fullPage:n}=e;return t&&n?"100%":"auto"}),(e=>{let{flavour:t,fullPage:n,isJob:l}=e;return"path"!=t?n?"calc(100% - 55px)":l?"500px":"unset":"unset"})),ie=(0,C.default)(r.TextBig).withConfig({displayName:"styled__StyledNodeName",componentId:"sc-16w9sl7-4"})(["font-family:monospace;"]);var se=n(47130);const ce=(0,se.A)(r.Flex),de=e=>{let{source:t="",sourceType:n}=e;const l=t.split(",");return o.createElement(r.Flex,{column:!0,gap:2},o.createElement(r.Flex,{alignItems:"center",gap:1},o.createElement(r.Text,{strong:!0},"Source type"),o.createElement(r.Pill,null,n)),o.createElement(r.Flex,{column:!0,gap:1},l.length?l.map((e=>o.createElement(r.TextSmall,{key:e},e))):null))},ue=e=>{let{source:t,sourceType:n,...a}=e;const i=k.V6[n];if(!i)return null;const{icon:s}=i;return o.createElement(v.A,{isBasic:!0,content:o.createElement(de,{source:t,sourceType:n})},o.createElement(r.Box,null,o.createElement(r.Icon,(0,l.A)({name:s},a))))},me=e=>{let{type:t,status:n}=e;const l=k.bM[n];if(!l)return null;const{label:a,color:i,icon:s}=l;return"template"!=t?o.createElement(r.Flex,{width:{min:28},gap:1,padding:[1,2],border:{side:"all",color:i},round:!0,alignItems:"center",justifyContent:"center"},o.createElement(r.Icon,{name:s,height:"12px",color:i}),o.createElement(r.Text,{color:i},a)):null},pe=()=>o.createElement(r.Flex,{width:{max:100}},o.createElement(r.Text,null,"You can submit your changes to another node, or to multiple nodes by selecting"," ",o.createElement(r.Text,{strong:!0},"Submit to multiple nodes")," button.")),ge=()=>{const{submitType:e}=K(),{node:t,nodes:n}=H(),[l]=(0,i.Oj)({extraKey:"dyncfg",merge:!1}),a=n.filter((e=>{let{value:t}=e;return l.includes(t)})),s=a.length?a[0].label:"0",c="submit"==e?t.label:s,d=l.length>1?"and ".concat(l.length-1," more"):"",u="submit"==e?"node":l.length>1?"nodes":"node";return o.createElement(r.Flex,{"data-testid":"dyncfg-on-node",gap:2,alignItems:"center"},o.createElement(r.TextBig,null,"on"),o.createElement(ce,{padding:[1],background:"mainBackground",tooltip:"submit"==e?o.createElement(pe,null):null,tooltipProps:{isBasic:!0,plain:!1}},o.createElement(ie,{strong:!0},c)," "),o.createElement(r.TextBig,null,"multiple_submit"==e?o.createElement(r.TextBig,{strong:!0},"".concat(d," ")):null,u))},he=function(){let{title:e,type:t,source:n,sourceType:l,status:a,templateChildren:i={},onCollapseExpand:s,userDisabled:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:d}=k.g7[t]||k.g7.default,u=c||"disabled"==a?"disabled":d,{node:p}=H(),{open:g,isNewItem:h,formData:f,setName:b,entityProps:E={}}=K(),{cmds:v=[]}=E,y=v.includes("userconfig"),{name:C}=f||{},x=!!Object.keys(i).length,w=te({id:e,node:p,onError:m()}),S=(0,o.useCallback)((e=>{b(e.target.value),y&&w(f,e.target.value||"test")}),[f,b,y,w]);return o.createElement(r.Flex,{gap:2,alignItems:"center"},"template"==t?o.createElement(oe,{name:"chevron_right",color:"textLite",rotate:g?3:1,onClick:s,hasTemplateChildren:x}):null,o.createElement(me,{type:t,status:a}),o.createElement(ue,{source:n,sourceType:l,color:u}),h?null:o.createElement(le,{color:u},(0,Y.J3)(e)),h&&g?o.createElement(r.TextInput,{"data-testid":"dyncfg-config-item-name",width:65,value:C,onChange:S,placeholder:"Add configuration name",error:h&&!(null!==f&&void 0!==f&&f.name),hideErrorMessage:!0}):null,"template"!=t&&g?o.createElement(ge,null):null)};var fe=n(26688),be=n(70895),Ee=n(92155);const ve=(0,Ee.A)(be.A),ye=function(){let{title:e,buttonProps:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[,n]=(0,O.QH)(),r=(0,fe.A)(),{isLoading:a,entityProps:i}=K(),{cmds:s=[]}=i||{},c=a,d=(0,o.useCallback)((()=>{n(r({template:e,entityProps:i}))}),[e,i,r,n]);return s.includes("add")?o.createElement(ve,(0,l.A)({edit:!0,feature:"DyncnfTemplate",payload:{id:e,label:"Add job"},tooltip:"Add a new configuration item",icon:"plus",iconWidth:18,iconHeight:18,onClick:d,disabled:c},t)):null},Ce=(0,Ee.A)(be.A),xe=e=>{let{id:t,enable:n,open:l,onDecline:a,onConfirm:i}=e;const s=n?"enable":"disable";return l?o.createElement(r.ConfirmationDialog,{title:"".concat((0,Q.Zr)(s)," item?"),handleConfirm:i,handleDecline:a,confirmLabel:"Yes ".concat(s),declineLabel:"No",isConfirmPositive:!!n,message:o.createElement(r.Flex,{column:!0,gap:2},o.createElement(r.TextBig,null,"You are about to ",s," ",o.createElement(le,{strong:!0},t)," module and all its configurations."),o.createElement(r.TextBig,null,"Are you sure?"))}):null},we=function(){let{id:e,userDisabled:t,buttonProps:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{isLoading:l,startLoading:r,stopLoading:a}=K(),{node:i}=H(),s=(0,O.DP)({id:e,node:i}),c=(0,O.O_)({node:i,id:e}),[d,u]=X(),[m,p]=(0,o.useState)(),[g,,h,f]=(0,L.A)(),b=(0,o.useCallback)((()=>{f(),r(),s(m).then((e=>{c(),d({successMessage:"Successfully ".concat(m?"enabled":"disabled"," module")})(e)})).catch((e=>{u({header:"Couldn't ".concat(m?"enabled":"disabled"," module")})(e)})).finally((()=>{a()}))}),[f,r,s,c,d,u,a]),E=(0,o.useCallback)((e=>{l||(p(e),h())}),[l,h]),v=(0,o.useMemo)((()=>({edit:!0,feature:"DyncnfTemplate",payload:{id:e,label:t?"Enable":"Disable"},isLoading:l,disabled:l,...n,...t?{tooltip:"Enable this module",icon:"switch_off",iconColor:"disabled",onClick:()=>E(!0)}:{tooltip:"Disable this module",icon:"switch_off",onClick:()=>E(!1),iconColor:"success",danger:!0}})),[e,t,l,n,E]);return o.createElement(o.Fragment,null,o.createElement(Ce,v),o.createElement(xe,{id:e,enable:m,open:g,onDecline:f,onConfirm:b}))},ke="success",Se={iconColor:ke,flavour:"borderless",color:ke},Ie=e=>{let{title:t,userDisabled:n}=e;return o.createElement(o.Fragment,null,o.createElement(ye,{title:t,buttonProps:Se}),o.createElement(we,{id:t,userDisabled:n,buttonProps:Se}))};var Ae=n(16607);const Te=(0,Ae.A)(r.Button),Fe=function(){let{buttonProps:e={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{open:t,fullPage:n,setFullPage:r,isNewItem:a}=K(),i=(0,o.useMemo)((()=>({...e,icon:n?"reduceSize":"fullScreen",tooltip:n?"Reduce window size":"Expand window size"})),[n]),s=(0,o.useCallback)((()=>{r(!n)}),[n,r]);return t&&!a?o.createElement(Te,(0,l.A)({onClick:s},i)):null},Be=(0,Ee.A)(be.A),De=function(){let{id:e,onClick:t,buttonProps:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{open:r,isLoading:a,entityProps:i}=K(),{cmds:s=[]}=i||{},c=a,d=s.includes("update")?"Edit configuration":"You have no permissions to edit the configuration";return o.createElement(Be,(0,l.A)({view:!0,feature:"DyncnfItem",payload:{id:e,label:r?"Close":"View"},tooltip:r?"Close":d,icon:r?"x":"pencilOutline",onClick:t,disabled:c},n))},Ne=(0,Ae.A)(r.Button),Pe=function(){let{title:e,template:t={},onCollapseExpand:n=m(),buttonProps:r={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=(0,Y.UE)(e),[,i]=(0,O.QH)(),{cmds:s,user_disabled:c}=t,{isLoading:d,open:u,formData:p,entityProps:g}=K(),h=(0,fe.A)(),f=(0,o.useCallback)((()=>{d||(i(h({template:a,formData:p,entityProps:g})),n())}),[d,a,p,g,i,h]);return u&&null!==s&&void 0!==s&&s.includes("add")?o.createElement(Ne,(0,l.A)({icon:"copy",onClick:f,disabled:d||c},c?{}:{tooltip:"Copy this item and create a new one"},r)):null},_e=(0,Ee.A)(be.A),Le=e=>{let{id:t,open:n,onDecline:l,onConfirm:a}=e;return n?o.createElement(r.ConfirmationDialog,{title:"Delete item?",handleConfirm:a,handleDecline:l,confirmLabel:"Yes, delete",declineLabel:"No",message:o.createElement(r.Flex,{column:!0,gap:2},o.createElement(r.TextBig,null,"You are going to completely remove ",o.createElement(le,{strong:!0},t)," and this action cannot be reverted."),o.createElement(r.TextBig,null,"Are you sure that you want to delete this item?"))}):null},Me=function(){let{id:e,buttonProps:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{isLoading:n,entityProps:r,startLoading:a,stopLoading:i}=K(),{type:s,cmds:c=[]}=r||{},{node:d}=H(),u=(0,O.OU)({id:e,node:d}),[m,p]=X(),g=(0,O.Hj)(),[h,,f,b]=(0,L.A)(),{sendButtonClickedLog:E}=(0,ee.A)(),v=n,y=(0,o.useCallback)((()=>{b(),a(),u().then((t=>{m({successMessage:"Successfully removed configuration"})(t),E({feature:"DyncnfItem",description:"Confirm deletion",id:e}),g()})).catch((e=>{p({header:"Couldn't remove configuration"})(e)})).finally((()=>{i()})),setTimeout((()=>{i()}),1e3)}),[u,b,a,i,g,E,m,p]),C=(0,o.useCallback)((()=>{n||f()}),[n,f]);return"job"==s&&c.includes("remove")?o.createElement(o.Fragment,null,o.createElement(_e,(0,l.A)({edit:!0,feature:"DyncnfItem",payload:{id:e,label:"Remove"},icon:"trashcan",onClick:C,disabled:v,tooltip:"Remove"},t)),o.createElement(Le,{id:e,open:h,onDecline:b,onConfirm:y})):null},Oe=(0,Ee.A)(be.A),Re=function(){let{id:e,template:t={},buttonProps:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{node:r}=H(),a=(0,O.ZN)({id:e,node:r}),[i,s]=X(),{isLoading:c,entityProps:d,startLoading:u,stopLoading:m}=K(),{user_disabled:p}=t,{cmds:g=[]}=d||{},h=(0,O.O_)({node:r,id:e}),f=c||p,b=(0,o.useCallback)((()=>{c||p||(u(),a().then((e=>{i({successMessage:"Successfully restarted configuration"})(e),h()})).catch((e=>{s({header:"Couldn't restart configuration"})(e)})).finally((()=>{m()})))}),[c,p,a,u,h,m,i,s]);return g.includes("restart")?o.createElement(Oe,(0,l.A)({edit:!0,feature:"DyncnfItem",payload:{id:e,label:"Restart"},icon:"refresh",onClick:b,disabled:f,tooltip:"Restart"},n)):null},je=e=>{let{id:t,template:n={}}=e;const{isLoading:l,entityProps:a,startLoading:i,stopLoading:s}=K(),{cmds:c=[],userDisabled:d}=a||{},[u,m]=(0,o.useState)(!d),{node:p}=H(),{user_disabled:g}=n,h=(0,O.DP)({id:t,node:p}),f=(0,O.O_)({node:p,id:t}),[b,E]=X(),{sendButtonClickedLog:y}=(0,ee.A)(),{hidden:C,isDisabled:x,tooltipText:w}=(0,be.j)({edit:!0,tooltip:u?"Disable":"Enable",disabled:l||g}),k=(0,o.useCallback)((e=>{if(!g){const n=e.currentTarget.checked;m(n),i(),h(n).then((e=>{y({feature:"DyncnfItem",description:n?"Enable item":"Disable item",id:t}),b({successMessage:"Successfully ".concat(n?"enabled":"disabled"," configuration")})(e),f()})).catch((e=>{y({feature:"DyncnfItem",description:"Failed to ".concat(n?"enable":"disable"," item"),id:t}),m(!n),E({header:"Couldn't ".concat(n?"enable":"disable"," configuration")})(e)})).finally((()=>{s()}))}}),[g,h,i,m,f,y,b,E]),S=c.includes("enable"),I=c.includes("disable");return!C&&S&&I?o.createElement(v.A,{align:"bottom",content:w},o.createElement(r.Box,{padding:[1.5,2]},o.createElement(r.Toggle,{onChange:k,checked:u,colored:!0,disabled:x}))):null},ze=()=>{const{id:e,isNewItem:t,entityProps:n}=K(),{node:l,path:o}=H(),{template:r}=n,a=(0,O.SD)({node:l,path:o,isNewItem:t})(t?r:e),i=(0,O._O)({node:l,id:r});return i?(0,S.Jz)(i):a||{}},He="text",Ue={iconColor:He,flavour:"borderless",color:He,type:"button"},We=(0,C.default)(r.Flex).attrs({alignItems:"center",border:{side:"all",color:"border"},round:!0}).withConfig({displayName:"itemActions__StyledContainer",componentId:"sc-1kpuq1a-0"})([""]),Ve=function(){let{title:e,isOpenEntity:t,isEditFromState:n,onViewButtonClick:l,onCollapseExpand:r=m()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=ze();return o.createElement(o.Fragment,null,n?null:o.createElement(We,{gap:1},o.createElement(Pe,{title:e,template:a,onCollapseExpand:r,buttonProps:Ue}),o.createElement(Re,{id:e,template:a,buttonProps:Ue}),o.createElement(Me,{id:e,buttonProps:Ue}),t?null:o.createElement(je,{id:e,template:a})),o.createElement(We,{gap:1},n?null:o.createElement(Fe,{buttonProps:Ue}),o.createElement(De,{id:e,onClick:l,buttonProps:Ue})))},Ke=e=>{let{title:t,onViewButtonClick:n,onCollapseExpand:l,type:a,userDisabled:i,isOpenEntity:s,isEditFromState:c}=e;return o.createElement(r.Flex,{gap:2,alignItems:"center"},"template"==a?o.createElement(Ie,{title:t,userDisabled:i}):o.createElement(Ve,{title:t,onViewButtonClick:n,onCollapseExpand:l,isOpenEntity:s,isEditFromState:c}))},qe={vertical:2,horizontal:4},Ye=e=>{let{path:t,onClick:n,...a}=e;const{open:i}=K();return o.createElement(r.Flex,(0,l.A)({gap:2,onClick:n,cursor:"pointer"},a),o.createElement(r.Icon,{name:"chevron_right",color:"textLite",rotate:i?3:1}),o.createElement(le,{strong:!0},t))},$e=e=>{let{flavour:t,title:n,onViewButtonClick:r,onCollapseExpand:a,level:i,entityProps:s={},isOpenEntity:c,isEditFromState:d}=e;const{vertical:u,horizontal:m}=qe,p=(0,o.useMemo)((()=>[u,m,u,m*i]),[i]),g="path"==t;return o.createElement(re,{alignItems:"center",justifyContent:"between",padding:p,isOpenEntity:c},g?o.createElement(Ye,{path:n,onClick:a}):o.createElement(o.Fragment,null,o.createElement(he,(0,l.A)({title:n,onCollapseExpand:a},s)),o.createElement(Ke,(0,l.A)({title:n,onViewButtonClick:r,onCollapseExpand:a,isOpenEntity:c,isEditFromState:d},s))))},Ge=e=>{let{open:t,onDecline:n,onConfirm:l}=e;return t?o.createElement(r.ConfirmationDialog,{title:"Discard changes?",handleConfirm:l,handleDecline:n,confirmLabel:"Yes, discard",declineLabel:"No, keep editing",message:o.createElement(r.Flex,{column:!0,gap:2},o.createElement(r.TextBig,null,"If you exit Edit mode before submit, your changes will be lost."),o.createElement(r.TextBig,null,"Are you sure?"))}):null},Je=e=>(0,o.useEffect)((()=>{if(!e)return;const t=t=>{"Escape"==t.code&&e(t)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}),[e]),Qe=e=>{let{title:t,open:n,isLoading:l,isDirty:r,setIsDirty:a,toggle:i,refresh:s,refreshUserConfig:c,entityProps:d,error:u}=e;const m=d[k.D9],p=["single","job"].includes(null===d||void 0===d?void 0:d.type),[,g]=(0,O.QH)(),[h,,f,b]=(0,L.A)(),{close:E}=(0,O.IP)(),v=(0,o.useCallback)((()=>{r&&(a(!1),i(),b()),s(),c(),g(null),E(t)}),[t,E,g,r,a,i,s,c,b]),y=(0,o.useCallback)((()=>{l||(m||r?u?v():f():i())}),[l,m,r,u,v,f]);return Je((e=>{"Escape"==e.code&&n&&p&&(e.preventDefault(),y())})),{confirmationOpen:h,closeConfirmation:b,onConfirm:v,onClick:y}};var Ze=n(28738);const Xe=e=>{let{virtualIndex:t,virtualRowStart:n,flavour:a="path",title:i="",level:s=1,entityProps:c={},children:d,isNewItem:u,isOpen:m,isEditFromState:p,...g}=e;const[h,f]=(0,L.A)(u||m),{node:b,inModal:E}=H(),v=(0,O._O)({node:b,id:i})||c,y="job"==(null===v||void 0===v?void 0:v.type),C=["single","job"].includes(null===v||void 0===v?void 0:v.type),[x,,w,k]=(0,L.A)(),[S,I]=(0,o.useState)(u||p),[A,T]=(0,o.useState)(),[F,B]=(0,o.useState)(),D="path"!=a&&h&&x,{refresh:N}=(0,O.L5)(),{refresh:P}=(0,O.MQ)(),{confirmationOpen:_,closeConfirmation:M,onConfirm:R,onClick:j}=Qe({title:i,open:h,isLoading:x,isDirty:F,setIsDirty:B,refresh:N,refreshUserConfig:P,toggle:f,entityProps:v,error:A});(0,o.useEffect)((()=>{h||P()}),[h,N,P]);const z=(0,o.useCallback)((e=>{var t;u||I(null===e||void 0===e||null===(t=e.uiSchema)||void 0===t||null===(t=t.uiOptions)||void 0===t?void 0:t.fullPage)}),[I]);(0,o.useEffect)((()=>{if(void 0!==t&&void 0!==n){const e=document.querySelector(".dyncnf-virtual-row[data-key='".concat(i,"']"));e&&(e.style.transform=S&&h?"none":"translateY(".concat(n,"px)"))}}),[h,S]);const{containerProps:U,collapsibleProps:W,loaderProps:V}=(0,o.useMemo)((()=>({containerProps:{...h&&S?{position:"fixed",zIndex:"100",...E?{top:0,left:0,width:"100%",height:"100%"}:{top:"5vh",left:"5vw",width:"90vw",height:"90vh"}}:{position:"relative"},...h&&C?{border:{side:"all",color:"border"}}:{},...S?{}:{height:"100%"},background:C&&h?"modalBackground":"mainBackground",round:!0},collapsibleProps:{level:s,open:h,duration:0,flavour:a,fullPage:S,isJob:y,...h&&C?{padding:[2,2,2,4*s]}:{}},loaderProps:{position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:".9",zIndex:"100"}})),[h,S,E,C]);return o.createElement(o.Fragment,null,o.createElement(q,{id:i,open:h,isNewItem:u,isLoading:x,startLoading:w,stopLoading:k,fullPage:S,setFullPage:I,entityProps:v,isDirty:F,setIsDirty:B,error:A},o.createElement(r.Flex,(0,l.A)({"data-testid":"dyncfg-config-item-container",column:!0},U,g),o.createElement($e,{key:h,flavour:a,title:i,onViewButtonClick:j,onCollapseExpand:f,level:s,entityProps:v,isOpenEntity:h&&!!C,isEditFromState:p}),o.createElement(ae,W,o.Children.map(d,(e=>o.isValidElement(e)?o.cloneElement(e,{level:s+1,onSchemaFetch:z,setIsDirty:B,setError:T}):e))),D?o.createElement(Ze.A,(0,l.A)({title:"Loading..."},V)):null)),o.createElement(Ge,{open:_,onDecline:M,onConfirm:R}))};var et=n(73700),tt=n(51220);const nt=e=>{let{virtualIndex:t,virtualRowStart:n,flavour:r="entity",entryKey:a,entityProps:i,configItemLevel:s=1,children:c,...d}=e;return o.createElement(o.Fragment,null,o.createElement(Xe,(0,l.A)({virtualIndex:t,virtualRowStart:n,flavour:r,title:a,level:s,entityProps:i},d),c))};var lt=n(74810),ot=n(36091),rt=n(4659),at=n(87292),it=n(68831);const st=C.default.span.withConfig({displayName:"markdocSchema__Strong",componentId:"sc-1se2vza-0"})(["font-weight:bold;"]),ct=C.default.ol.withConfig({displayName:"markdocSchema__OrderedList",componentId:"sc-1se2vza-1"})(["list-style:roman;padding-left:14px;"]),dt=C.default.ul.withConfig({displayName:"markdocSchema__UnorderedList",componentId:"sc-1se2vza-2"})(['list-style-image:url("','/img/list-style-image.svg");padding-left:14px;'],it.A.assetsBaseURL),ut={heading:{render:e=>{let{level:t=1,...n}=e,a=r.H1;switch(t){case 2:a=r.H2;break;case 3:a=r.H3;break;case 4:a=r.H4;break;case 5:a=r.H5;break;case 6:a=r.H6}return o.createElement(a,(0,l.A)({margin:[2,0]},n))},attributes:{id:{type:String},level:{type:Number}}},paragraph:{render:e=>{let{children:t,...n}=e;return o.createElement(r.Flex,n,o.createElement(r.Text,null,t))}},strong:{render:st},link:{render:e=>{let{children:t,href:n,...r}=e;return o.createElement(rt.A,(0,l.A)({href:n,rel:"noopener noreferrer",target:"_blank"},r),t)},attributes:{href:{type:String}}},code:{render:e=>{let{content:t,...n}=e;return o.createElement(at.R0,n,t)},attributes:{content:{type:String}}},fence:{render:e=>{let{content:t,...n}=e;return o.createElement(at.Ay,n,t)},attributes:{content:{type:String}}},list:{render:e=>{let{ordered:t,children:n,...l}=e;const r=t?ct:dt;return o.createElement(r,l,n)},attributes:{ordered:{type:Boolean}}}},mt=e=>{let{children:t}=e;return o.createElement(ot.A,{transformConfiguration:{nodes:ut}},t)},pt=e=>{var t;let{description:n}=e;return("string"==typeof n&&n?n:"object"==typeof n?null===n||void 0===n||null===(t=n.props)||void 0===t?void 0:t.description:null)?o.createElement(v.A,{isBasic:!0,plain:!0,allowHoverOnTooltip:!0,content:o.createElement(r.Flex,{width:{max:70}},o.createElement(mt,null,n))},o.createElement(r.Icon,{name:"information",color:"text",size:"small"})):null},gt=e=>{var t;let{description:n}=e;if(!n)return null;const l="string"==typeof n?n:null===(t=n.props)||void 0===t?void 0:t.description;return o.createElement(mt,null,l)},ht=e=>{let{title:t,required:n,description:l,help:a}=e;return t?o.createElement(r.Flex,{column:!0,gap:.5},o.createElement(r.Flex,{alignItems:"center",gap:1},o.createElement(r.TextBig,{strong:!0},t,n?"*":null),a?o.createElement(pt,{description:a}):null),o.createElement(gt,{description:l})):null},ft=e=>{let{id:t,displayLabel:n,label:l,required:r,description:a,schema:i,uiSchema:s={}}=e;const c=s["ui:title"]||l,d=s["ui:help"],u=["array","boolean"].includes(i.type)||Array.isArray(i.type)&&(i.type.includes("array")||i.type.includes("boolean"));return c&&(n||u)?o.createElement("label",{htmlFor:t},o.createElement(ht,{title:c,required:r,description:a,help:d})):null},bt=e=>{let{id:t,label:n,required:l,description:a,errors:i,children:s,displayLabel:c,schema:d,classNames:u,hidden:m,uiSchema:p}=e;return m?null:o.createElement(r.Flex,{width:"100%",className:"".concat(u," dyncfg-field-container"),column:!0,gap:.5},o.createElement(ft,{id:t,displayLabel:c,label:n,required:l,description:a,schema:d,uiSchema:p}),o.createElement(r.Flex,{className:"dyncfg-field-content",column:!0,padding:[0,0,0,1]},s,i?o.createElement(r.TextMicro,{color:"errorText"},i):null))},Et=(vt=e=>{let{onAddClick:t,schema:n,registry:a,properties:i,...s}=e;const{WrapIfAdditionalTemplate:c,ButtonTemplates:d}=a.templates,{AddButton:u}=d;return o.createElement(o.Fragment,null,o.createElement(r.Flex,(0,l.A)({className:"dyncfg-object-field-content",column:!0,gap:3,padding:[0,0,0,3],border:{side:"left",color:"border"}},s),i.map((e=>o.createElement(c,(0,l.A)({key:e.content.key,elemKey:e.content.key},e.content.props),e.content)))),n.additionalProperties?o.createElement(r.Flex,{padding:[2]},o.createElement(u,{onClick:t(n)})):null)},e=>{let{className:t,...n}=e;return null!==t&&void 0!==t&&t.includes("dyncfg-grid")?o.createElement("div",{className:t},o.createElement(vt,n)):o.createElement(vt,n)});var vt;const yt=(0,o.createContext)(),Ct=e=>{let{children:t}=e;const[n,l]=(0,o.useState)({});return o.createElement(yt.Provider,{value:{collapsibleItemsState:n,setCollapsibleItemsState:l}},t)},xt=e=>{const{properties:t,uiSchema:n}=e,{tabs:a,rest:i}=n["ui:options"]||{},[s,c]=(0,o.useState)(0),d=(0,o.useMemo)((()=>(e=>{let{properties:t=[],tabs:n=[]}=e;return n.map((e=>({...e,properties:t.filter((t=>e.fields.includes(t.name)))})))})({properties:t,tabs:a})),[t,a]);return o.createElement(Ct,null,(i||[]).length?o.createElement(Et,(0,l.A)({},e,{properties:t.filter((e=>i.includes(e.name)))})):null,o.createElement(r.Tabs,{selected:s,onChange:c,height:"100%"},d.map((t=>{let{title:n,...a}=t;return o.createElement(r.Tab,{key:n,label:n},o.createElement(Et,(0,l.A)({},e,a,{border:{side:"top",color:"border"},padding:[2,0,0,3]})))}))))},wt={tabs:{Component:xt},default:{Component:Et}},kt=e=>{var t;const{title:n,description:l,required:a,uiSchema:i={},idSchema:s,formData:c}=e,d=s.$id,u=i["ui:flavour"],p=i["ui:help"],{Component:g}=wt[u]||wt.default,h=!(null===i||void 0===i||!i["ui:collapsible"])||!(null===i||void 0===i||null===(t=i["ui:options"])||void 0===t||!t.collapsible),{inContext:f,isItemDirty:b,isItemExpanded:E,setItemState:v}=(()=>{const e=(0,o.useContext)(yt),{collapsibleItemsState:t,setCollapsibleItemsState:n}=e||{},l=(0,o.useCallback)((e=>void 0!==t[e]),[t]),r=(0,o.useCallback)((e=>t[e]),[t]),a=(0,o.useCallback)(((e,t)=>{n((n=>({...n,[e]:t})))}),[n]);return{inContext:!!e,isItemDirty:e?l:m(),isItemExpanded:e?r:m(),setItemState:e?a:m()}})(),y=i["ui:initiallyExpanded"]||!!c,C=(0,o.useMemo)((()=>b(d)?E(d):y),[b,E]),[x,w]=(0,L.A)(C);return(0,o.useEffect)((()=>{f&&v(d,x)}),[f,x,v]),o.createElement(r.Flex,{className:"dyncfg-object-field-container",width:"100%",column:!0,gap:2},n?o.createElement(r.Flex,{gap:1,alignItems:"center"},o.createElement(ht,{title:n,required:a,description:l,help:p}),h?o.createElement(r.Icon,{name:"chevron_down",color:"text",size:"small",onClick:w,cursor:"pointer",rotate:x?2:0}):null):null,o.createElement(r.Collapsible,{className:"dyncfg-object-field-collapsible",open:x||!h,duration:0},o.createElement(g,e)))};n(25440);const St=(0,o.forwardRef)(((e,t)=>{let{title:n,active:a,index:i,setActiveTab:s,onDropIndexClick:c,onReorderClick:d,reordering:u,setReordering:m,hasRemove:p,hasMoveUp:g,hasMoveDown:h,...f}=e;const{onAddIndexClick:b,onCopyIndexClick:E,...v}=f,y=(0,o.useCallback)((e=>{p&&c(e)()}),[p,c]);return(0,o.useEffect)((()=>{if(2==(null===u||void 0===u?void 0:u.length)&&u[0]==i){const e=u[1];d(i,e)(),s(e),m()}}),[u]),o.createElement(r.NavigationTab,(0,l.A)({ref:t},v,{index:i,draggable:!!h&&!!g,active:a,icon:p?o.createElement(r.Icon,{name:"x",size:"small"}):null,onClick:()=>{s(i)},onRemove:y,fixed:!p}),o.createElement(r.TextBig,{whiteSpace:"nowrap"},n))})),It=(0,C.default)(r.IconButton).attrs((e=>({small:!0,padding:[0,1],...e}))).withConfig({displayName:"styled__StyledIconButton",componentId:"sc-xc1c2v-0"})(["height:",";"],(e=>{let{inTabs:t}=e;return t?"auto":"24px"})),At=e=>{let{icon:t,iconType:n,...r}=e;return o.createElement(It,(0,l.A)({flavour:"default",icon:"plus",tooltip:"Add item",type:"button",neutral:!1},r))},Tt=e=>{let{icon:t,iconType:n,...r}=e;return o.createElement(It,(0,l.A)({flavour:"hollow",icon:"copy",tooltip:"Copy current item into a new one",type:"button",neutral:!1},r))};var Ft=n(3705);const Bt=e=>{var t;let{items:n,onAddClick:l,onCopyClick:a,canAdd:i}=e;const[s,{width:c}]=(0,Ft.A)(),[d,u]=(0,o.useState)(0),[m,p]=(0,o.useState)();(0,o.useEffect)((()=>{d>=n.length&&u(0)}),[n.length]);const g=i?"calc(".concat(c,"px - 80px)"):"".concat(c,"px");return o.createElement(r.Flex,{ref:s,column:!0},o.createElement(r.Flex,{width:"".concat(c,"px"),margin:[0,0,2,0]},o.createElement(r.NavigationTabs,{width:g,overflow:{horizontal:"auto"}},o.createElement(r.DraggableTabs,{items:n.map(((e,t)=>({id:e.key,title:"Item ".concat(t),active:d==t,setActiveTab:u,reordering:m,setReordering:p,...e}))),Item:St,onDragEnd:(e,t)=>{p([e,t])}})),i?o.createElement(o.Fragment,null,o.createElement(Tt,{onClick:()=>a(d),padding:[1,3],inTabs:!0,groupFirst:!0}),o.createElement(At,{onClick:l,padding:[1,3],inTabs:!0,groupLast:!0})):null),o.Children.map(null===(t=n[d])||void 0===t?void 0:t.children,(e=>o.isValidElement(e)?o.cloneElement(e,{title:""}):e)))},Dt=(0,o.memo)(Bt),Nt=e=>{let{icon:t,iconType:n,...r}=e;return o.createElement(It,(0,l.A)({flavour:"hollow",icon:"checkmark_partial_s",danger:!0,tooltip:"Remove item",type:"button"},r))},Pt=e=>{let{icon:t,iconType:n,...r}=e;return o.createElement(It,(0,l.A)({flavour:"hollow",icon:"sort_ascending",tooltip:"Move up",type:"button"},r))},_t=e=>{let{icon:t,iconType:n,...r}=e;return o.createElement(It,(0,l.A)({flavour:"hollow",icon:"sort_descending",tooltip:"Move down",type:"button"},r))},Lt=(0,C.default)(r.Flex).attrs((e=>({open:!0,...e}))).withConfig({displayName:"collapsible__ContentWrapper",componentId:"sc-6ate9-0"})(["display:",";"],(e=>{let{open:t}=e;return t?"flex":"none"})),Mt=(0,se.A)(r.Icon),Ot=e=>{let{title:t="",isCollapsible:n,isOpen:a,onChange:i,children:s,...c}=e;const[d,u]=(0,L.A)(a);return(0,o.useEffect)((()=>{i(d)}),[d]),n?o.createElement(r.Flex,{width:"100%",column:!0,padding:[3,0]},o.createElement(r.Flex,{gap:2},o.createElement(Mt,{name:"chevron_left",size:"small",color:"textLite",rotate:d?1:3,onClick:u,cursor:"pointer",tooltip:d?"Hide contents":"Show contents"}),t?o.createElement(r.Text,{strong:!0},t):null),o.createElement(Lt,(0,l.A)({open:d},c),s)):s},Rt=e=>{var t,n;let{hasMoveDown:l,hasMoveUp:a,hasRemove:i,index:s,totalItems:c,onAddIndexClick:d,onDropIndexClick:u,onReorderClick:m,canAdd:p,uiSchema:g={},onCopyClick:h,children:f}=e;const[b,E]=(0,o.useState)(!0),v=a||l||i||p,y=m(s,s-1),C=m(s,s+1),x=u(s),w=d(s+1),k=!(null===g||void 0===g||!g["ui:collapsible"])||!(null===g||void 0===g||null===(t=g["ui:options"])||void 0===t||!t.collapsible),S=(0,o.useCallback)((e=>{E(e)}),[E]);return o.createElement(r.Flex,{width:"100%",gap:2,alignItems:b?"start":"center",justifyContent:"between",border:{side:"all",color:"border"},padding:[2,4]},o.createElement(Ot,{isCollapsible:k,title:null===(n=f.props)||void 0===n?void 0:n.title,isOpen:b,onChange:S},f),v?o.createElement(r.Flex,{gap:2,padding:[2,0]},a?o.createElement(Pt,{onClick:y}):null,l?o.createElement(_t,{onClick:C}):null,i?o.createElement(Nt,{onClick:x}):null,p?o.createElement(Tt,{onClick:()=>h(s)}):null,p&&s==c-1?o.createElement(At,{onClick:w}):null):null)},jt=e=>{let{onCopyClick:t,items:n}=e;return n.map((e=>o.createElement(Rt,(0,l.A)({key:e.key,onCopyClick:t},e))))},zt=(0,o.memo)(jt),Ht=e=>{let{canAdd:t,onAddClick:n,openEmptyItem:l}=e;return(0,o.useEffect)((()=>{l&&n()}),[l,n]),o.createElement(r.Flex,{gap:2,alignItems:"center"},o.createElement(r.TextBig,null,"No items"),t?o.createElement(At,{onClick:n}):null)},Ut=(0,se.A)(r.Toggle),Wt=e=>{var t,n;const{items:a,canAdd:i,onAddClick:s,idSchema:c,formContext:d}=e,u="list"==(null===e||void 0===e||null===(t=e.uiSchema)||void 0===t?void 0:t["ui:listFlavour"]),m=!(null===e||void 0===e||null===(n=e.uiSchema)||void 0===n||!n["ui:openEmptyItem"]),[p,g]=(0,L.A)(u),{formData:h}=K(),f=p?zt:Dt,b=(0,o.useCallback)((e=>{var t;const n=null===(t=a[e])||void 0===t||null===(t=t.children)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.formData,{$id:l}=c,o=((e,t,n)=>{const l=e.replace(/^root_/,"").split("_");let o=n;for(let r=0;r<l.length;r++){const e=l[r];if(r===l.length-1){if(!Array.isArray(o[e]))throw new Error("Expected an array at path ".concat(l.slice(0,r+1).join("_")));o[e].push(t)}else o=o[e]}return n})(l,n,JSON.parse(JSON.stringify(h)));d.setFormData(o)}),[a,c,d.setFormData]);return o.createElement(r.Flex,{width:"100%",column:!0,gap:2,padding:[1,0,0,0]},o.createElement(r.Flex,null,o.createElement(Ut,{labelRight:"List",labelLeft:"Tabs",onChange:g,checked:p,tooltip:"Switch between list and tabs layout"})),a.length?o.createElement(f,(0,l.A)({},e,{onCopyClick:b})):o.createElement(Ht,{canAdd:i,onAddClick:s,openEmptyItem:m}))};var Vt=n(78239);const Kt=e=>{var t;let{elemKey:n,onKeyChange:l,schema:a,onDropPropertyClick:i,registry:s,children:c}=e;const[d,u]=(0,o.useState)((null===c||void 0===c||null===(t=c.props)||void 0===t?void 0:t.name)||""),{RemoveButton:m}=s.templates.ButtonTemplates,p=Vt.Rr in a,g=(0,o.useCallback)((e=>{i(n)(e)}),[i,n]),h=(0,o.useCallback)((e=>u(e.target.value)),[u]);return p?o.createElement(r.Flex,{width:"100%",gap:2,alignItems:"center"},o.createElement(r.Flex,{column:!0,gap:1,flex:{grow:1,shrink:1}},o.createElement(r.TextBig,{strong:!0},"Key"),o.createElement(r.TextInput,{value:d,onInput:h,onBlur:e=>l(e.target.value),border:"inputBorder",size:"small"})),o.createElement(r.Flex,{flex:{grow:2,shrink:1}},c),o.createElement(r.Flex,{column:!0,gap:.5},o.createElement(r.TextBig,{opacity:"0"},"x"),o.createElement(m,{onClick:g}))):c},qt={FieldTemplate:bt,ArrayFieldTemplate:Wt,ObjectFieldTemplate:kt,WrapIfAdditionalTemplate:Kt,ErrorListTemplate:()=>null,ButtonTemplates:{SubmitButton:()=>o.createElement(r.Button,{label:"Save"}),AddButton:At,RemoveButton:Nt,MoveUpButton:Pt,MoveDownButton:_t}},Yt=e=>{let{value:t,type:n,disabled:l,onChange:a,onBlur:i,placeholder:s,schema:c,rawErrors:d}=e;const u=n||(e=>"integer"==e||Array.isArray(e)&&e.includes("integer")?"number":"text")(c.type),m="number"==u?null==t||void 0==t?0:t:t||"";return o.createElement(r.TextInput,{value:m,type:u,placeholder:s,onChange:e=>{var t;return a(null===(t=e.target)||void 0===t?void 0:t.value)},onBlur:i,disabled:l,error:!(null===d||void 0===d||!d.length),hideErrorMessage:!0,border:"inputBorder",size:"small"})},$t=e=>{let{value:t,disabled:n,onChange:l}=e;return o.createElement(r.Flex,null,o.createElement(r.Checkbox,{checked:t,onChange:l,disabled:n}))};n(3064),n(72577);const Gt=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e||0==t.length)return"";if(Array.isArray(e)){return[...t.filter((t=>e.map((e=>"string"==typeof e?e:e.value)).includes(t.value))),...e.filter((e=>"object"==typeof e&&e.__isNew__))]}return t.find((t=>t.value==e))},Jt=e=>{let{value:t,options:n,disabled:l,multiple:a,onChange:i,uiSchema:s}=e;const{enumOptions:c}=n||{},d=null===s||void 0===s?void 0:s["ui:creatable"],u=(0,o.useCallback)((e=>{var t;i((t=e)?Array.isArray(t)?t.map((e=>e.value)):t.value||"":"")}),[]);return c?o.createElement(r.Select,{value:Gt(t,c),isMulti:a,options:c,onChange:u,isDisabled:l,isCreatable:d,styles:{size:"tiny"}}):null},Qt=e=>{let{value:t,disabled:n,onChange:l,uiSchema:a,options:i}=e;const s=a[Vt.ce],c=(null===s||void 0===s?void 0:s.enumOptions)||(null===i||void 0===i?void 0:i.enumOptions),d=null===s||void 0===s?void 0:s.inline,u="buttonGroup"==(null===s||void 0===s?void 0:s.flavour),m=(0,o.useMemo)((()=>({gap:2,...d?{alignItems:"center"}:{column:!0}})),[d]);if(u){const e=c.map((e=>{var t;return{...e,title:null===(t=e.schema)||void 0===t?void 0:t.description}}));return o.createElement(r.ButtonGroup,{items:e,checked:t,onChange:l,buttonProps:{type:"button",small:!0}})}return c?o.createElement(r.Flex,m,c.map((e=>{var a;return o.createElement(r.RadioButton,{key:e.value,checked:t==e.value,onChange:()=>l(e.value),disabled:n},o.createElement("label",{title:null===e||void 0===e||null===(a=e.schema)||void 0===a?void 0:a.description},e.label))}))):null},Zt=C.default.textarea.withConfig({displayName:"textareaWidget__Textarea",componentId:"sc-3aqoej-0"})(["background:",";border-width:1px;border-style:solid;border-color:",";border-radius:2px;color:",";padding:8px 12px;opacity:",';font-size:14px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif;'],(0,r.getColor)("inputBg"),(e=>{let{hasValue:t,error:n}=e;return t?(0,r.getColor)("text"):n?(0,r.getColor)("error"):(0,r.getColor)("inputBorder")}),(e=>{let{disabled:t,hasValue:n}=e;return n?(0,r.getColor)("text"):t?(0,r.getColor)("placeholder"):(0,r.getColor)("textLite")}),(e=>{let{disabled:t}=e;return t?".4":"1"})),Xt=e=>{let{value:t,placeholder:n,disabled:l,onChange:r,options:a,rawErrors:i}=e;const{rows:s=2}=a||{};return o.createElement(Zt,{placeholder:n,disabled:l,onChange:e=>r(e.target.value),rows:s,hasValue:!!t,error:!(null===i||void 0===i||!i.length)},t)},en=e=>o.createElement(Yt,(0,l.A)({type:"password"},e)),tn=e=>o.createElement(Yt,(0,l.A)({type:"url"},e));var nn=n(40267);const ln=/^\$this\s*(==|>|<|>=|<=)\s*\((\d+)\)$/,on=/^\$this\s*(==|>|<|>=|<=)\s*\(\(\$status\s*(==|>|<|>=|<=)\s*(\$WARNING|\$CRITICAL)\s*\)\s*\?\s*\((\d+)\)\s*:\s*\((\d+)\)\)$/,rn=Object.values({lt:{label:"Lower than",value:"lt",symbol:"<"},lte:{label:"Lower than or equal",value:"lte",symbol:"<="},eq:{label:"Equal",value:"eq",symbol:"=="},gt:{label:"Greater than",value:"gt",symbol:">"},gte:{label:"Greater than or equal",value:"gte",symbol:">="}}),an={$CRITICAL:"critical",$WARNING:"warning"},sn={critical:"$CRITICAL",warning:"$WARNING"},cn=e=>{let{value:t,onChange:n,isDisabled:l}=e;const a=rn.find((e=>{let{symbol:n}=e;return n==t}))||"";return o.createElement(r.Select,{options:rn,value:a,onChange:n,isDisabled:l,styles:{size:"tiny"}})},dn=e=>{let{isDisabled:t,parsedExpression:n={},toggleRecoveryThreshold:l,onChangeThreshold:a}=e;const{isComplex:i,threshold:s}=n,c=(0,o.useCallback)((e=>{t||a(e.target.value)}),[a,t]),d=(0,o.useCallback)((e=>{t||l(e)}),[l,t]);return i?o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(r.Pill,{flavour:"success",hollow:!0,icon:"reload"},"Recovery Threshold"),o.createElement(r.TextInput,{onChange:c,value:s,type:"number",min:0,size:"tiny",metaShrinked:!0,containerStyles:{width:"80px"},disabled:t}),o.createElement(v.A,{content:"Remove recovery threshold"},o.createElement(r.Button,{type:"button",icon:"trashcan",flavour:"borderless",onClick:()=>d(!1),iconColor:"textLite",iconSize:"small",disabled:t}))):o.createElement(r.Button,{type:"button",label:"Recovery Threshold",icon:"plus",flavour:"borderless",onClick:()=>d(!0),disabled:t})},un=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{isSimple:t,isComplex:n,operator:l,status:o,value:r,threshold:a}=e;return t?"$this ".concat(l," (").concat(r,")"):n?"$this ".concat(l," (($status >= ").concat(o,") ? (").concat(a,") : (").concat(r,"))"):""},mn=e=>{let{status:t,parsedExpression:n,onChange:l,isDisabled:r}=e;return{onOperatorChange:(0,o.useCallback)((e=>{let{symbol:t}=e;if(!r){const e=un({...n,operator:t});l(e)}}),[n,l,r]),onValueChange:(0,o.useCallback)((e=>{if(!r){const t=un({...n,value:e});l(t)}}),[n,l,r]),toggleRecoveryThreshold:(0,o.useCallback)((e=>{if(!r){const o=!e,r=!!e,a=un({...n,isSimple:o,isComplex:r,status:sn[t],threshold:"70"});l(a)}}),[t,n,l,r]),onChangeThreshold:(0,o.useCallback)((e=>{if(!r){const t=un({...n,threshold:e});l(t)}}),[n,l,r])}},pn=e=>{let{isDisabled:t,expression:n="",onChange:l}=e;const a=t?"":n,i=(0,o.useCallback)((e=>{var n;t||l((null===(n=e.target)||void 0===n?void 0:n.value)||"")}),[t,l]);return o.createElement(r.Flex,{column:!0,gap:1},o.createElement(r.Text,null,"Formula"),o.createElement(r.Box,{width:"500px"},o.createElement(r.TextInput,{value:a,placeholder:"$this",onChange:i,size:"tiny",disabled:t})))},gn=e=>{let{onDecline:t,onConfirm:n}=e;return o.createElement(r.ConfirmationDialog,{title:"Reset expression",confirmLabel:"Continue",handleConfirm:n,handleDecline:t,message:o.createElement(r.Flex,{gap:2,column:!0},o.createElement(r.TextBig,null,"Your custom expression is going to be reset."),o.createElement(r.TextBig,null,"Are you sure you want to change?"))})},hn=e=>t=>{const{isSimple:n,isComplex:a}=t.parsedExpression,i=t.value&&!n&&!a,[s,c]=(0,o.useState)(i?1:0),[d,,u,m]=(0,L.A)(),p=(0,o.useCallback)((e=>{"0"==e.target.value?u():c(1)}),[u,c]),g=(0,o.useCallback)((()=>{c(0),m()}),[c,m]),h=(0,o.useMemo)((()=>[{radioButtonValue:0,isDisabled:0!=s,checked:0==s,Component:e},{radioButtonValue:1,isDisabled:1!=s,checked:1==s,Component:pn}]),[s]);return o.createElement(o.Fragment,null,o.createElement(r.Flex,{column:!0,gap:2},h.map((e=>{let{radioButtonValue:n,isDisabled:a,checked:i,Component:s}=e;return o.createElement(r.Flex,{key:n,alignItems:"center",gap:2},o.createElement(r.RadioButton,{value:n,checked:i,onChange:p}),o.createElement(s,(0,l.A)({isDisabled:a},t)))}))),d?o.createElement(gn,{onDecline:m,onConfirm:g}):null)},fn=hn((e=>{let{isDisabled:t,parsedExpression:n={},options:l={},onChange:a}=e;const{alertStatus:i}=l,{operator:s,value:c,status:d}=n,u=an[d]||i,{onOperatorChange:m,onValueChange:p,toggleRecoveryThreshold:g,onChangeThreshold:h}=mn({status:u,parsedExpression:n,onChange:a,isDisabled:t});return o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(r.Box,null,o.createElement(nn.A,{width:"80px",flavour:u,textSize:"small"},(0,Q.Zr)(u,!0))),o.createElement(cn,{value:s,onChange:m,isDisabled:t}),o.createElement(r.TextInput,{onChange:e=>p(e.target.value),value:c,type:"number",disabled:t,min:0,size:"tiny",metaShrinked:!0,containerStyles:{width:"80px"}}),o.createElement(dn,{isDisabled:t,parsedExpression:n,toggleRecoveryThreshold:g,onChangeThreshold:h}))})),bn=e=>{const{alertStatus:t}=e.options,n=(0,o.useMemo)((()=>function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const t=e.match(ln);if(t)return{isSimple:!0,operator:t[1],value:t[2]};const n=e.match(on);return n?{isComplex:!0,operator:n[1],statusOperator:n[2],status:n[3],threshold:n[4],value:n[5]}:{}}(e.value)),[e.value]);return t?o.createElement(fn,(0,l.A)({expression:e.value,parsedExpression:n},e)):(console.warn("".concat(e.id," field is declared to be an alert expression but it does not provide an alert status")),null)},En=(e,t)=>{const n=parseFloat(e),{multiplier:l}=t||{};return{num:n,multiplier:parseFloat(l)}},vn=e=>{let{value:t=0,onChange:n=m(),scale:l=[],defaultScale:a,min:i=0,step:s=1}=e;const c=l.find((e=>{let{value:t}=e;return t==a}))||l[0],[d,u]=(0,o.useState)(c),p=((e,t)=>{const{num:n,multiplier:l}=En(e,t);return l&&!isNaN(n)?Math.round(n/l*100)/100:0})(t,d),g=(0,o.useCallback)((e=>{const t=((e,t)=>{const{num:n,multiplier:l}=En(e,t);return l&&!isNaN(n)?n*l:0})(e.target.value,d);n(t)}),[d,n]);return o.createElement(r.Flex,{gap:2,alignItems:"center"},o.createElement(r.TextInput,{value:p,onChange:g,type:"number",min:i,step:s,size:"small"}),o.createElement(r.Select,{value:d,options:l,onChange:u,styles:{minWidth:"80px",size:"tiny"}}))},yn=[{value:"sec",label:"Seconds",multiplier:1},{value:"min",label:"Minutes",multiplier:60},{value:"hour",label:"Hours",multiplier:3600},{value:"day",label:"Days",multiplier:86400},{value:"week",label:"Weeks",multiplier:604800},{value:"month",label:"Months",multiplier:2592e3},{value:"year",label:"Years",multiplier:31536e3}],Cn=e=>{const{schema:t={}}=e,{type:n}=t,r="number"==n?.1:1,{scales:a}=e.options||{},i=a?yn.filter((e=>{let{value:t}=e;return a.includes(t)})):yn;return o.createElement(vn,(0,l.A)({scale:i,step:r},e))},xn=e=>{var t;return o.createElement(Cn,(0,l.A)({},e,{defaultScale:null===(t=e.options)||void 0===t?void 0:t.scale}))},wn=[{value:"B",label:"Bytes",multiplier:1},{value:"KiB",label:"KiB",multiplier:1024},{value:"MiB",label:"MiB",multiplier:Math.pow(1024,2)},{value:"GiB",label:"GiB",multiplier:Math.pow(1024,3)},{value:"TiB",label:"TiB",multiplier:Math.pow(1024,4)}],kn=e=>{const{scales:t}=e.options||{},n=t?wn.filter((e=>{let{value:n}=e;return t.includes(n)})):wn;return o.createElement(vn,(0,l.A)({scale:n},e))},Sn={TextWidget:Yt,CheckboxWidget:$t,SelectWidget:Jt,RadioWidget:Qt,TextareaWidget:Xt,PasswordWidget:en,URLWidget:tn,alertExpressionWidget:bn,durationWidget:xn,memorySizeWidget:e=>{var t;return o.createElement(kn,(0,l.A)({},e,{defaultScale:null===(t=e.options)||void 0===t?void 0:t.scale}))}};var In=n(22086);const An=(0,C.default)(In.Ay).withConfig({displayName:"styled__StyledForm",componentId:"sc-epjsfn-0"})(["display:flex;flex-direction:column;justify-content:space-between;height:100%;overflow-y:auto;padding-right:8px;"]);var Tn=n(83084),Fn=n(81638),Bn=n(30577),Dn=n(93615);const Nn=C.default.div.withConfig({displayName:"styled__StyledTerminalCommand",componentId:"sc-1oflxul-0"})(["display:flex;position:relative;flex-direction:column;color:",";background:",";border:1px solid ",";border-radius:4px;overflow-wrap:anywhere;white-space:pre-wrap;padding:16px 16px 24px;width:100%;height:100%;font-family:monospace;font-weight:bold;letter-spacing:0.09px;line-height:16px;font-size:12px;word-break:break-word;overflow-y:auto;"],(0,r.getColor)("primary"),(0,r.getColor)("terminalGreen"),(0,r.getColor)("primary")),Pn=(0,C.default)(r.Icon).withConfig({displayName:"styled__StyledIcon",componentId:"sc-1oflxul-1"})(["display:flex;align-self:flex-end;cursor:pointer;position:absolute;bottom:16px;right:16px;"]);var _n=n(3914),Ln=n(22292),Mn=n(19673),On=n(28061);const Rn={Business:!0,Pro:!0,Homelab:!0,Community:!1},jn=(0,se.A)(r.Button),zn=e=>{let{getShouldUpgrade:t,...n}=e;const{value:l}=(0,Mn.JN)(),r=(0,a.JT)("billing:Manage"),i=(0,On.A)(),s=(0,o.useMemo)((()=>"function"==typeof t?t(l):!function(){return Rn[(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).class]}(l)),[t,l]),c=(0,o.useMemo)((()=>s?r?"Upgrade your plan to use this feature":"You don't have sufficient permissions to upgrade the plan":null),[r,s]),d=(0,o.useMemo)((()=>({label:"Upgrade now!",onClick:i,tooltip:c,disabled:!r,noWrapper:!0,...n})),[i,c,r,n]);return s?o.createElement(jn,d):null},Hn=function(){let{getShouldUpgrade:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=(0,Ln.uW)("isAnonymous"),r=(0,_n.dg)();return n||r?null:o.createElement(zn,(0,l.A)({getShouldUpgrade:e},t))};var Un=n(18682);const Wn=e=>{let{error:t}=e;return o.createElement(r.Flex,{padding:[4]},o.createElement(r.Text,{color:"error"},t))},Vn=e=>o.createElement(r.Flex,(0,l.A)({column:!0,gap:2},e),o.createElement(r.Flex,{gap:2,alignItems:"center"},o.createElement(r.Icon,{color:"warning",name:"warning_triangle"}),o.createElement(r.Text,null,"This feature is only available to paid plans")),o.createElement(Hn,{small:!0})),Kn=e=>{let{canGetUserConfig:t,onOpenTerminal:n}=e;const{value:l,error:a}=(0,O.MQ)(),i=(0,o.useMemo)((()=>(e=>e?e.replace(/password:\s*[^ \n]*/i,"password: ****"):e)(l)),[l]),{hasPermission:s}=(0,be.j)({edit:!0});return(0,o.useEffect)((()=>{n()}),[]),t?a?o.createElement(Wn,{error:a}):s?o.createElement(Nn,null,i,o.createElement(Pn,{name:"copy",size:"small",color:"textLite",onClick:(0,Un.C)(l,{text:"Config copied to your clipboard."})})):o.createElement(Vn,null):o.createElement(r.Flex,{padding:[4]},o.createElement(r.Text,null,"Configuration text export is not supported by this node."))},qn={configuration:{iconName:"gear",color:{active:"success",notActive:"textLite"},width:"14px",Content:Kn,dataTestId:"configurationTab",label:"Config"}},Yn=["configuration"],$n=e=>{let{isOpen:t,toggleIsOpen:n,canGetUserConfig:l,onOpenTerminal:r}=e;const{Content:a}=qn.configuration;return o.createElement(Fn.Ay,{collapsedComponent:o.createElement(Bn.A,{onClickTab:n,availableTabs:qn,tabsToShow:Yn}),isOpen:t,header:o.createElement(Dn.A,{isOpen:t,onToggle:n,title:"Configuration",icon:null})},t?o.createElement(a,{padding:[0,3,30],canGetUserConfig:l,onOpenTerminal:r}):null)},Gn=e=>{let{title:t="Error",children:n,...a}=e;return o.createElement(r.Flex,(0,l.A)({column:!0,gap:2},a),o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(r.Icon,{name:"warning_triangle",color:"errorText"}),o.createElement(r.TextBigger,{color:"errorText"},t)),n)};var Jn=n(63314);const Qn=function(){let{remainingErrors:e=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[t,n]=(0,L.A)();return o.createElement(o.Fragment,null,o.createElement(r.Collapsible,{open:t,duration:0},e.map((e=>{let{message:t}=e;return o.createElement(r.Text,{key:t,color:"errorText"},t)}))),o.createElement(r.Flex,{padding:[2,0,0,0]},o.createElement(r.Button,{flavour:"hollow",neutral:!0,small:!0,label:t?"Hide":"Show ".concat(e.length," more"),onClick:n})))},Zn=function(){let{id:e,errors:t=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.length?o.createElement(Jn.Ay,{feature:"DyncnfForm",id:e,validationErrors:!0},o.createElement(Gn,null,o.createElement(r.Flex,{alignItems:"start",column:!0},o.createElement(r.Text,{color:"errorText"},t[0].message),t.length>1?o.createElement(Qn,{remainingErrors:t.slice(1)}):null))):null},Xn=(0,C.default)(r.Flex).attrs((e=>({padding:[2,4,2,1.5],border:{side:"bottom",color:"border"},cursor:"pointer",...e}))).withConfig({displayName:"styled__StyledMenuItem",componentId:"sc-1sw1he6-0"})(["&:last-child{border:none;}&:hover{background:",";}"],(0,r.getColor)("modalBackground")),el=e=>{let{id:t,isActive:n,title:l,description:a,setSubmitType:i,closeMenu:s}=e;const c=(0,o.useCallback)((()=>{i(t),s()}),[t,i,s]);return o.createElement(Xn,{onClick:c},o.createElement(r.Flex,{gap:1},o.createElement(r.Box,{width:"16px",height:"16px"},n?o.createElement(r.Icon,{name:"check",color:"primary"}):null),o.createElement(r.Flex,{column:!0,gap:1},o.createElement(r.TextBig,{strong:!0},l),o.createElement(r.Text,null,a))))},tl=e=>{let{submitType:t,setSubmitType:n,closeMenu:a,node:i}=e;const s=(0,o.useMemo)((()=>(e=>[{id:"submit",title:"Submit",description:null!==e&&void 0!==e&&e.label?"Submit your changes to ".concat(e.label," node"):"Submit your changes"},{id:"multiple_submit",title:"Submit to multiple nodes",description:"Submit your changes to multiple nodes. You can use parent nodes to apply your changes automatically to their children."}])(i)),[i]);return o.createElement(r.Flex,{width:120,position:"absolute",column:!0,bottom:30,right:0,round:!0,background:"tooltip",border:{side:"all",color:"border"}},s.map((e=>o.createElement(el,(0,l.A)({key:e.id},e,{isActive:t==e.id,setSubmitType:n,closeMenu:a})))))};var nl=n(94177),ll=n(99292),ol=n(42828);const rl={...ol.Ii,Live:{...ol.Ii.Live,head:{...ol.Ii.Live.head,hasML:!1,hasParentNode:!0,hasFn:!1},node:{...ol.Ii.Live.node,showMl:!1,showParentNode:!0,showFn:!1}}},al=e=>{let{extraKey:t=k.q4}=e;return o.createElement(r.Flex,{column:!0,height:{max:"60vh"}},o.createElement(r.Flex,{flex:"1",overflow:"hidden"},o.createElement(r.Flex,{column:!0,flex:!0},o.createElement(nl.A,{flavour:"dyncfg",extraKey:t,statusProps:rl,testIdPrefix:"node-ids",param:"selectedNodeIds",groupProps:{collapsible:!1,background:"modalBackground",padding:[3],flex:"1",overflow:"hidden"},height:"auto",width:"100%"})),o.createElement(ll.Ay,{basis:60,baseWidth:60,flex:!1,title:"Dynamic filters",help:"Filter your nodes for this page. Count next to each item refer to the number of nodes that will be selected and used across the page.",includedTabs:["filters"],loaded:!0,onClose:()=>{},groupProps:{background:"modalBackground"},background:"modalBackground"})))},il=(0,C.default)(r.TextBig).withConfig({displayName:"styled__NodeName",componentId:"sc-1dfnbe3-0"})(["font-family:monospace;"]),sl={fulfilled:{text:"Success",color:"primary"},rejected:{text:"Failed",color:"error"},default:{text:"Processing...",color:"text"}},cl=e=>{var t;let{label:n,result:l={}}=e;const{status:a,reason:i}=l,s=(null===i||void 0===i||null===(t=i.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.errorMessage)||(null===i||void 0===i?void 0:i.message)||"Something went wrong...",{text:c,color:d}=(0,o.useMemo)((()=>sl[a]||sl.default),[a]),[u,m]=(0,L.A)(!0);return o.createElement(r.Flex,{column:!0,gap:1},o.createElement(r.Flex,{gap:2,alignItems:"center"},o.createElement(r.TextBig,{color:d},c),o.createElement(il,null,n),i?o.createElement(r.Icon,{name:"chevron_down",width:"10px",height:"10px",color:"textLite",cursor:"pointer",onClick:m,rotate:u?2:null}):null),i?o.createElement(r.Collapsible,{open:u,padding:[0,0,0,2]},o.createElement(r.Text,{color:"error"},(0,Q.Zr)(s))):null)},dl=e=>{let{selectedNodes:t,results:n=[]}=e;return o.createElement(r.Flex,{column:!0,gap:4,padding:[4,0]},n.length?null:o.createElement(r.TextBig,null,"Submitting to multiple nodes..."),o.createElement(r.Flex,{column:!0,gap:3},t.map((e=>{let{value:t,label:l}=e;const r=n.find((e=>{let{nodeId:n}=e;return n==t}));return o.createElement(cl,{key:t,label:l,result:r})}))))},ul=e=>{let{id:t,formRef:n,onClose:l}=e;const{nodes:r}=H(),a=(0,i.a7)({extraKey:k.q4,merge:!1}),s=r.filter((e=>{let{value:t}=e;return a.includes(t)})),{isNewItem:c,setIsDirty:d}=K(),[u,m]=(0,o.useState)([]),p=(0,O.hp)({id:t,isNewItem:c}),[g,,h,f]=(0,L.A)(),[b,,E,v]=(0,L.A)(),[y,C]=(0,o.useState)(),x=(0,O.Hj)(),[w,S,,I]=(0,G.A)(),A=(0,o.useCallback)((()=>{null===l||void 0===l||l(),c&&y&&x()}),[l,y,c,x]),T=(0,o.useCallback)((()=>{var e;const t=null===n||void 0===n||null===(e=n.current)||void 0===e||null===(e=e.state)||void 0===e?void 0:e.formData;m([]),h(),E(),p({nodes:s,payload:t}).then((e=>{d(!1),m(e.map(((e,t)=>{var n;return{...e,nodeId:null===(n=s[t])||void 0===n?void 0:n.value}})));const t=e.map((e=>{let{status:t}=e;return t}));t.find((e=>"fulfilled"==e))?t.some((e=>"rejected"==e))?I({text:"Some submissions have failed."}):w({text:"All nodes updated successfully."}):S({text:"All submissions have failed."})})).catch(S).finally((()=>{f(),C(!0)}))}),[n,s,p,h,f,m,d,x,C]);return{selectedNodes:s,onSubmit:T,onCloseButtonClick:A,loading:g,inProcess:b,hideProcess:v,results:u,submitFinished:y}},ml=(0,se.A)(r.Button),pl=e=>{let{id:t,formRef:n,onClose:l}=e;const{selectedNodes:a,onSubmit:i,onCloseButtonClick:s,loading:c,inProcess:d,hideProcess:u,results:m,submitFinished:p}=ul({id:t,formRef:n,onClose:l});return o.createElement(r.Modal,{backdropProps:{backdropBlur:!0}},o.createElement(r.ModalContent,{width:{min:100,base:200},background:"modalBackground",round:2,overflow:"hidden"},o.createElement(r.ModalHeader,{background:"modalBackground"},o.createElement(r.H4,null,"Select nodes")),o.createElement(r.ModalBody,null,d?o.createElement(dl,{selectedNodes:a,results:m}):o.createElement(al,null)),o.createElement(r.ModalFooter,{gap:2},d?o.createElement(ml,{type:"button",flavour:"hollow",small:!0,label:"Back",icon:"arrow_left",iconColor:"primary",iconSize:"small",onClick:u,tooltip:"Go back to nodes selector",disabled:c}):null,o.createElement(r.Button,{type:"button",flavour:"hollow",small:!0,label:"Close",onClick:s,disabled:c}),o.createElement(ml,{type:"button",label:"Submit",small:!0,onClick:i,tooltip:a.length?null:"Select some nodes",disabled:c||!a.length||p}))))},gl=(0,Ae.A)(r.Button),hl=e=>{var t;let{id:n,formRef:s,loading:c}=e;const[d,u,,m]=(0,L.A)(),[p,,g,h]=(0,L.A)(),{state:f}=(0,O.L5)(),{nodeIds:b=[]}=f||{},{node:E,nodes:v}=H(),y=(v||[]).length>1,{isNewItem:C,entityProps:x={},submitType:w,setSubmitType:k}=K(),{cmds:S=[]}=x,I=C||S.includes("update"),{user_disabled:A}=ze(),T=J(),F=(0,On.A)(),B=(0,Ln.uW)("isAnonymous"),D=(0,a.JT)("billing:Manage"),[,N]=(0,i.Oj)({extraKey:"dyncfg",merge:!1});(0,o.useEffect)((()=>{g&&b.length&&(N(b),k("multiple_submit"))}),[g,b,N,k]);const P=(0,o.useCallback)((e=>T?I?e||null:"You don't have permissions to save your changes":"Please provide a name first"),[T,I]),_=(0,o.useMemo)((()=>({submit:{label:"Submit",tooltip:P("Submit your changes to ".concat(E.label," node"))},multiple_submit:{type:"button",label:"Submit to Multiple Nodes",tooltip:P("Submit your changes to another node or to multiple nodes"),onClick:g},nonPaid:{type:"button",label:"Upgrade",tooltip:"Upgrade your plan to use this feature.",disabled:!D||B,onClick:F}})),[g,I,D,B,F]),M=!I||c||A||!T,{hidden:R,isDisabled:j,tooltipText:z,showUpgradeButton:U}=(0,be.j)({edit:!0,tooltip:null===(t=_[w])||void 0===t?void 0:t.tooltip,disabled:M});return R?null:U?o.createElement(gl,(0,l.A)({small:!0,disabled:M,isLoading:c},_.nonPaid)):o.createElement(r.Flex,{position:"relative",alignItem:"center"},o.createElement(gl,(0,l.A)({small:!0,groupFirst:y,disabled:j,isLoading:c},_[w],{tooltip:z})),y?o.createElement(r.Button,{type:"button",icon:"chevron_down",tiny:!0,flavour:"hollow",groupLast:!0,onClick:u,disabled:j}):null,d?o.createElement(tl,{submitType:w,setSubmitType:k,closeMenu:m,node:E}):null,p?o.createElement(pl,{id:n,formRef:s,onClose:h}):null)},fl=(0,Ee.A)(be.A),bl=e=>{let{loading:t}=e;const{node:n}=H(),{id:l,formData:r,entityProps:a={}}=K(),{cmds:i=[]}=a,{user_disabled:s}=ze(),c=i.includes("test"),d=(0,O.EZ)({id:l,node:n}),u=J({defaultName:"test"}),m=t||s,[p,g]=X(),h=p({successMessage:"Successfully tested configuration"}),f=g(),b=(0,o.useCallback)((()=>{d({name:u,payload:r}).then(h).catch(f)}),[u,d,r,h,f]);return c?o.createElement(fl,{edit:!0,feature:"DyncnfItem",payload:{id:l,node:null===n||void 0===n?void 0:n.value},label:"Test",small:!0,tooltip:"Test your configuration",flavour:"hollow",onClick:b,disabled:m,type:"button"}):null},El=((0,Ae.A)(r.Button),e=>{let{id:t,formRef:n,loading:l,errors:a=[],openUserConfig:i}=e;return o.createElement(r.Flex,{background:"modalBackground",position:"sticky",bottom:0,gap:2,padding:[4,0,0,0],alignItems:"baseline",justifyContent:"between",zIndex:10},a.length?o.createElement(Zn,{id:t,errors:a}):o.createElement(r.Flex,null),o.createElement(r.Flex,{gap:2},null,o.createElement(bl,{loading:l}),o.createElement(hl,{id:t,formRef:n,loading:l})))}),vl=function(){let{id:e,error:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n="string"==typeof t?{error_message:t}:"object"==typeof t?t:{},{error_message:l,message:a}=n;return o.createElement(Jn.DL,{feature:"DyncnfForm",id:e,error:JSON.stringify(t)},o.createElement(r.Flex,{column:!0,gap:2},o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(r.Icon,{name:"warning_triangle",color:"text"}),o.createElement(r.H3,null,"Error")),o.createElement(r.TextBig,null,l||a||k.Fn)))},yl=function(){let{id:e,node:t,isNewItem:n,data:l=k.gh,submitMethod:r,onSchemaFetch:a=m(),setIsDirty:i=m(),setError:s=m()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const c=(0,o.useRef)(0),d=(0,o.useRef)(),{entityProps:u={}}=K(),{cmds:p=[]}=u,g=p.includes("userconfig"),[h,f,b]=(0,L.A)(g),{isLoading:E,loaded:v,formData:y,setFormData:C,schema:x,resourcesError:w,errors:S,onChange:I,onSubmit:A,onError:T,getUserConfig:F}=ne({id:e,node:t,data:l,submitMethod:r,userConfigIsOpen:h,onSchemaFetch:a,setIsDirty:i,setError:s}),{jsonSchema:B,uiSchema:D}=x||{};(0,o.useEffect)((()=>(c.current=Date.now(),()=>{c.current=0})),[]);const N=(0,o.useCallback)((e=>{const t=Date.now()-c.current,n=0==c.current||t<500;I(e,n)}),[I]),P=(0,o.useCallback)((()=>{setTimeout((()=>{if(c.current>0&&g){var e;const t=null===(e=d.current)||void 0===e||null===(e=e.state)||void 0===e?void 0:e.formData;F(t)}}),50)}),[c.current,d.current,g,F]);return v?w?o.createElement(vl,{id:e,error:w}):o.createElement(Jn.Ay,{feature:"DyncnfForm",id:e,isNewItem:n},o.createElement(Tn.A,{margin:[0,0,2],padding:[2,0,0,0],sidebar:o.createElement($n,{isOpen:h,toggleIsOpen:f,canGetUserConfig:g,onOpenTerminal:P}),containerProps:{id:"dyncfg-form-layout",border:{side:"top",color:"border"}}},o.createElement(An,{ref:d,className:"dyncfg-form",disabled:E,schema:B,uiSchema:D,formData:y,formContext:{setFormData:C},templates:qt,widgets:Sn,validator:lt.Ay,onError:T,onChange:N,onSubmit:A},o.createElement(El,{id:e,formRef:d,loading:E,errors:S,openUserConfig:b})))):o.createElement(Ze.A,{title:"Loading form...",background:"modalBackground"})},Cl=e=>{let{id:t,node:n,children:l}=e;const{setFormData:r}=K(),{loaded:a,value:i,hasError:s,error:c,refresh:d}=(0,O.SW)({id:t,node:n});return(0,o.useEffect)((()=>{a&&!s&&r(i)}),[a,s,r,i]),a?s?o.createElement(vl,{id:t,error:c}):o.Children.map(l,(e=>o.isValidElement(e)?o.cloneElement(e,{id:t,node:n,data:{loaded:a,value:i,hasError:s,refresh:d}}):e)):null},xl=e=>{let{formData:t={},children:n}=e;const{formData:l}=K();return o.Children.map(n,(e=>o.isValidElement(e)?o.cloneElement(e,{data:{...k.gh,value:{...t,...l}}}):e))},wl=e=>{let{id:t,formData:n,...r}=e;const{node:a}=H(),{isNewItem:i}=K(),s=(0,O.Nj)({id:t,node:a}),c=(0,O.xS)({id:t,node:a});return i?o.createElement(xl,{formData:n},o.createElement(yl,(0,l.A)({id:t,node:a,isNewItem:i,submitMethod:s},r))):o.createElement(Cl,{id:t,node:a},o.createElement(yl,(0,l.A)({submitMethod:c},r)))},kl=e=>{var t,n;let{entries:r=[],rowHeight:a=k.FL,level:i=1}=e;const s=(0,o.useRef)(),{node:c,path:d,containerRef:u}=H(),[m,p]=(0,O._F)({node:c,path:d}),g=null===(t=u.current)||void 0===t||null===(t=t.getBoundingClientRect())||void 0===t?void 0:t.bottom,h=null===(n=s.current)||void 0===n||null===(n=n.getBoundingClientRect())||void 0===n?void 0:n.top,f=g&&h?g-h:500,b=Math.floor(f/a),E=r.length>b,v=(0,tt.Te)({count:r.length,getScrollElement:()=>s.current,enableSmoothScroll:!0,estimateSize:()=>a,overscan:5}),y=(0,o.useCallback)((0,et.s)(300,(e=>{p(e.target.scrollTop)})),[p]);return(0,o.useEffect)((()=>{s.current&&(s.current.scrollTop=m)}),[]),E?o.createElement("div",{ref:s,style:{height:"".concat(f,"px"),overflow:"auto"},onScroll:y},o.createElement("div",{style:{minHeight:"".concat(v.getTotalSize(),"px"),width:"100%",position:"relative"}},v.getVirtualItems().map((e=>{const[t,n]=r[e.index];return o.createElement("div",{className:"dyncnf-virtual-row",key:e.key,style:{position:"absolute",top:0,left:0,width:"100%",transform:"translateY(".concat(e.start,"px)"),overflow:"hidden"},ref:v.measureElement,"data-index":e.index,"data-key":t},o.createElement(nt,{virtualIndex:e.index,virtualRowStart:e.start,entryKey:t,entityProps:(0,S.bn)(n),configItemLevel:i},o.createElement(wl,(0,l.A)({id:t},n))))})))):r.map((e=>{let[t,n]=e;return o.createElement(nt,{key:t,entryKey:t,entityProps:(0,S.bn)(n),configItemLevel:i},o.createElement(wl,(0,l.A)({id:t},n)))}))},Sl=e=>{let{entries:t=[],level:n=0}=e;const{testString:r,testProps:a}=f();return t.map((e=>{let[t,i]=e;const{templateChildren:s}=i||{},c=(0,S.bn)(i);if(s){const e=Object.entries(s).filter((e=>{let[t,n]=e;return r(t)&&a(n)}));return o.createElement(nt,{key:t,flavour:"template",entryKey:t,entityProps:c,configItemLevel:n,isOpen:!0},o.createElement(kl,{entries:e,level:n}))}return o.createElement(nt,{key:t,entryKey:t,entityProps:c,configItemLevel:n},o.createElement(wl,(0,l.A)({id:t},c)))}))},Il=(0,o.memo)(Sl),Al=function(){let{tree:e={},level:t=1,isVirtual:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{testString:l,testProps:r}=f();return n?o.createElement(Il,{entries:Object.entries(e),level:t}):Object.entries(e).map((e=>{let[n,a]=e;const i=n.match(/\/[^/]+/g),s=Object.keys(a).filter((e=>{const{templateChildren:t={}}=a[e],o=Object.values(t).some((e=>r(e)));return!(!r(a[e])&&!o)&&(l(n)||l(e)||Object.keys(t).some((e=>l(e))))})).reduce(((e,t)=>({...e,[t]:a[t]})),{});if(1==i.length)return o.createElement(Xe,{key:n,title:i[0],level:t,isOpen:!0},o.createElement(Al,{tree:s,level:t+1,isVirtual:!0}));const c=i.slice(1).join("");return o.createElement(Xe,{key:c,title:i[0],level:t,isOpen:!0},o.createElement(Al,{tree:{[c]:s},level:t+1}))}))},Tl=(0,o.memo)(Al),Fl=()=>o.createElement(r.Flex,null,o.createElement(r.TextBigger,null,"No available configuration found.")),Bl=()=>{const{node:e,path:t}=H(),n=(0,O.sh)({node:e,path:t}),{entityProps:r,...a}=n||{};return n?o.createElement(Xe,{flavour:"entity",title:"".concat(n.template,":placeholder"),entityProps:{...r,...a},isNewItem:!0},o.createElement(wl,(0,l.A)({id:n.template,formData:n.formData},r))):null};var Dl,Nl=n(37618);const Pl="dyncfg-edit-alet-warning-dismiss-".concat(null===(Dl=window.envSettings)||void 0===Dl?void 0:Dl.visitor),_l={lineHeight:1.6},Ll=e=>{let{alertName:t,nodeName:n}=e;const l=localStorage.getItem(Pl),[a,,,i]=(0,L.A)(!l),[s,c]=(0,o.useState)(),d=(0,o.useCallback)((e=>{c(e)}),[c]),u=(0,o.useCallback)((()=>{s&&localStorage.setItem(Pl,!0),i()}),[s,i]);return a?o.createElement(r.Modal,{backdropProps:{backdropBlur:!0}},o.createElement(r.ModalContent,null,o.createElement(r.ModalHeader,null,o.createElement(r.H4,null,"Editing Alerts")),o.createElement(r.ModalBody,null,o.createElement(r.Flex,{column:!0,gap:2,width:{max:120}},o.createElement(r.TextBig,_l,"You are about to edit the alert ",o.createElement(r.TextBig,{color:"primary"},t),n?o.createElement(o.Fragment,null," ","on node ",o.createElement(r.TextBig,{color:"primary"},n)):null,"."),o.createElement(r.TextBig,_l,'Keep in mind that alerts in Netdata are templates that are applied to all instances of the same kind (e.g. editing a disk alert, means you are changing the alerts for all disks on that node). If you want to overwrite the rules for a single instance, do not change the current rules. Instead add a new rule and select "Apply to a specific instance" for that rule, matching the instance you want to overwrite.'),Nl.Ay?o.createElement(r.TextBig,_l,'To apply an alert on all your currently connected nodes, edit it and select "Submit to Multiple Nodes".'):o.createElement(r.TextBig,_l,'When having parents and you have connected both parents and children to Netdata Cloud, the alert needs to be altered on both Netdata parents and children, otherwise one of the two will be using the old version. To apply an alert on multiple nodes, edit it and select "Submit to Multiple Nodes".'))),o.createElement(r.ModalFooter,{justifyContent:"between"},o.createElement(r.Flex,{gap:2,alignItems:"center"},o.createElement(r.Checkbox,{checked:s,onChange:d}),o.createElement(r.TextBig,null,"Do not show this again")),o.createElement(r.Button,{type:"button",flavour:"hollow",label:"OK",textTransform:"uppercase",onClick:u})))):null},Ml={alertName:{itemTitlePrefix:k.DR,treeEntryKey:k.$7}},Ol=e=>{var t;let{tree:n}=e;const{state:r}=(0,O.L5)(),{alertName:a,nodeId:i}=r||{},c=(0,s.xY)(i,"name"),{itemTitlePrefix:d,treeEntryKey:u}=Ml.alertName,m=a?"".concat(d).concat(a):null,p=n&&m?null===(t=n[u])||void 0===t?void 0:t[m]:null;return a?o.createElement(o.Fragment,null,o.createElement(Xe,{flavour:"entity",title:m,entityProps:p,isOpen:!0,isEditFromState:!0},o.createElement(wl,(0,l.A)({id:m},p))),o.createElement(Ll,{alertName:a,nodeName:c})):null},Rl=(0,j.A)((()=>n.e(4414).then(n.bind(n,74414))),"DyncfgStyles"),jl=e=>{let{node:t,nodes:n,path:l,tree:a,inModal:i}=e;const s=(0,o.useRef)();return o.createElement(U.Provider,{value:{node:t,nodes:n,path:l,inModal:i,containerRef:s}},o.createElement(o.Suspense,{fallback:""},o.createElement(Rl,null)),o.createElement(r.Flex,{ref:s,width:"100%",padding:[0,2],column:!0},o.createElement(r.Flex,{column:!0},Object.keys(a).length?o.createElement(Tl,{tree:(0,Y.m8)(a)}):o.createElement(Fl,null)),o.createElement(Bl,null),o.createElement(Ol,{tree:a})))};var zl=n(98496);const Hl={ErrForbidden:{title:"No permissions",Content:()=>o.createElement(o.Fragment,null,o.createElement(r.Text,null,"You don't have permissions to view the configurations."),o.createElement(r.Text,null,"Please contact the Space administrators if this is unexpected."))},ErrNoConfigurableNodes:{title:"No configurable nodes found",Content:()=>o.createElement(r.Text,null,"We couldn't find any node that can be configured from the UI.")},default:{title:"Error",Content:()=>o.createElement(o.Fragment,null,o.createElement(r.Text,null,"Something went wrong, please check again later."),o.createElement(r.Text,null,"If the problem persists feel free to contact us with a"," ",o.createElement(rt.A,{href:"https://github.com/netdata/netdata-cloud/issues/new/choose",target:"_blank",rel:"noopener noreferrer"},"ticket")))}},Ul=function(){let{error:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{errorMsgKey:t}=e||{},{title:n,Content:l}=Hl[t]||Hl.default;return o.createElement(Jn.DL,{feature:"DyncfgMainTabs",errorMsgKey:t},o.createElement(zl.A,{title:n},o.createElement(r.Flex,{column:!0,gap:1},o.createElement(l,null))))},Wl=e=>{let{node:t}=e;const n=(0,o.useRef)(),{state:l}=(0,O.L5)(),{isAlert:r}=l||{},{loaded:a,value:i,hasError:s}=(0,O.wd)({node:t}),c=a&&i&&!s?Object.keys(i.tree||{}).reduce(((e,t)=>{t.startsWith("/")||(t="/".concat(t));const n=t.match(/\/[^/]+/g);if(n.length){const t=n[0],l=(0,Q.Zr)(t.replace(/^\/?/,""));e.find((e=>e.value==t))||e.push({value:t,label:l})}return e}),[]):[],[d,u]=(0,o.useState)(0);return(0,o.useEffect)((()=>{if(c.length&&r&&!n.current){const e=c.map((e=>{let{value:t}=e;return t})).indexOf("/health");u(e),n.current=!0}}),[r,c,u,n.current]),{loaded:a,tabs:c,selectedTab:d,setSelectedTab:u}},Vl=e=>{var t;let{flavour:n,inModal:l,selectedNode:a,setNode:i,options:s}=e;const{loaded:c,tabs:d,selectedTab:u,setSelectedTab:m}=Wl({node:a}),{loaded:g,value:h,hasError:f,error:v}=(0,O.wd)({node:a,path:null===d||void 0===d||null===(t=d[u])||void 0===t?void 0:t.value}),{tree:y}=h||{},C=l?"60px":"110px",x=(0,o.useMemo)((()=>({height:"settings"==n?"calc(100% - ".concat(C,")"):"100%",padding:[4,0],border:{side:"top",color:"border"},overflow:{vertical:"auto"}})),[]);return s.length?o.createElement(b,null,o.createElement(r.Flex,{column:!0,height:"100%",gap:4},o.createElement(r.Flex,{alignItems:"center",justifyContent:"between"},o.createElement(r.Flex,{alignItems:"center",gap:4},o.createElement(p,{node:a,setNode:i,options:s}),o.createElement(E,null)),o.createElement(r.Flex,{alignItems:"center",gap:3},o.createElement(M,{tree:y}),o.createElement(R,null))),c?d.length?o.createElement(r.Tabs,{height:"100%",selected:u,onChange:m},d.map((e=>{let{label:t,value:n}=e;return o.createElement(r.Tab,{key:n,label:t},o.createElement(r.Flex,x,g?f?o.createElement(r.TextBigger,null,"Something went wrong"):y?o.createElement(jl,{key:JSON.stringify({value:n,selectedNode:a}),node:a,nodes:s,path:n,tree:y,inModal:l}):o.createElement(Ul,null):o.createElement(Ze.A,{height:"calc(100% - ".concat(C,")"),title:"Loading..."})))}))):o.createElement(Ul,{error:v}):o.createElement(Ze.A,{height:"100%",title:"Loading..."}))):o.createElement(r.TextBigger,null,"There are no available nodes.")};var Kl=n(20378),ql=n(78459),Yl=n(15255),$l=n(68741),Gl=n(40982);const Jl=e=>{let{message:t,title:n,footer:a,...i}=e;const s=(null===i||void 0===i?void 0:i["data-testid"])||"dyncnfError";return o.createElement(r.Flex,(0,l.A)({alignItems:"center",column:!0,"data-testid":s,flex:!0,gap:3,justifyContent:"center",padding:[0,20]},i),o.createElement(r.H3,{"data-testid":"".concat(s,"-title")},n),o.createElement(r.TextBig,{color:"textDescription","data-testid":"".concat(s,"-message")},t),a)},Ql=e=>{let{flavour:t,inModal:n,node:l,nodes:r}=e;const{options:a,node:i,setNode:s}=d({selectedNode:l,nodes:r});return null!==i&&void 0!==i&&i.value?o.createElement(Vl,{flavour:t,inModal:n,selectedNode:i,setNode:s,options:a}):o.createElement(Ul,{error:{errorMsgKey:"ErrNoConfigurableNodes"}})},Zl=e=>{const t=(0,i.eO)({extraKey:"nodesView",merge:!1,scoped:!0,roomSlug:e.isVirtual?Nl.gB:null});return o.createElement(Ql,(0,l.A)({},e,{nodes:t}))},Xl=e=>{const{nodes:t}=(0,c.A)({polling:!1});return o.createElement(Ql,(0,l.A)({},e,{nodes:t}))},eo=e=>{const t=(0,ql.OS)();return o.createElement(r.Button,(0,l.A)({label:"Get a fresh agent token",onClick:t},e))},to="Configurations expose sensitive information about your systems and applications. To protect your privacy, Netdata exposes this information only to logged-in users and claimed agents. When viewing Configurations directly on a Netdata Agent UI, this information is sent directly from the Netdata Agent to your web browser, without exposing it to any third parties.",no={notLoggedIn:{title:"Sign in to Netdata to use Configurations",description:to,footer:o.createElement($l.A,null)},notClaimed:{title:"Connect this agent to Netdata to use Configurations",description:to,footer:o.createElement(Gl.A,null)},noAccess:{title:"This agent belongs to a Netdata Space you are not member of",description:to,footer:o.createElement(r.TextBig,{color:"textDescription"},"Ask for an invitation from the administrators of the Netdata Space of the agent to use configurations.")},bearerError:{title:"You are not authorized to use Configurations",description:to,footer:o.createElement(eo,null)}},lo=e=>{let{flavour:t="settings",node:n,inModal:r}=e;const i=(0,_n.dg)(),c=(0,a.JT)("agent:ReadDynCfg"),{state:d}=(0,O.L5)(),{nodeId:u}=d||{},m=(0,s.xY)(u),p={flavour:t,node:u?m:n,inModal:r},[g]=(0,Kl.Q8)(),[{bearerProtection:h,error:f}]=(0,ql.f7)(),[{canBeClaimed:b,cloudStatus:E}]=(0,Yl.RJ)();if(i&&f&&h){const{title:e,description:t,footer:n}=(e=>{let{userStatus:t,userNodeStatus:n,accessError:l,canBeClaimed:o}=e;return no[t]?no[t]:l?no.notLoggedIn:o?no.notClaimed:no[n]?no[n]:no.bearerError})({...g,bearerError:f,canBeClaimed:b,cloudStatus:E});return o.createElement(Jl,{title:e,message:t,footer:n})}return c?i?o.createElement(Zl,(0,l.A)({isVirtual:i},p)):o.createElement(Xl,p):o.createElement(Ul,{error:{errorMsgKey:"ErrForbidden"}})}}}]);