!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]="4c4444fc-a2ae-4dd7-a82e-f2eeee2a30f0",e._sentryDebugIdIdentifier="sentry-dbid-4c4444fc-a2ae-4dd7-a82e-f2eeee2a30f0")}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([[8239],{16607:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(58168),r=n(96540),a=n(83199),d=n(29217);const l=e=>t=>{let{tooltip:n,onClick:l,...i}=t;const c=(0,r.useRef)(),s=(0,r.useCallback)((e=>{var t,n;null===l||void 0===l||l(e),null===(t=c.current)||void 0===t||null===(n=t.blur)||void 0===n||n.call(t)}),[l,c.current]),u=(0,r.useMemo)((()=>({...i,...l?{onClick:s}:{}})),[s,i]);return r.createElement(d.A,{align:"bottom",content:n},r.createElement(a.Box,null,r.createElement(e,(0,o.A)({ref:c},u))))}},70895:(e,t,n)=>{n.d(t,{A:()=>g,j:()=>h});var o=n(58168),r=(n(3064),n(98992),n(72577),n(62953),n(96540)),a=n(83199),d=n(3914),l=n(20378),i=n(46741),c=n(19673);const s={Business:!0,Pro:!0,Homelab:!0,Community:!1},u=()=>{const{loaded:e,value:t}=(0,c.JN)();return{loaded:e,isPaid:e&&s[null===t||void 0===t?void 0:t.class]}};const f=(0,n(16607).A)(a.Button),p=["Business","Pro","Homelab"],h=e=>{let{view:t,edit:n,ifForbidden:o="disabled",tooltip:a,disabled:c}=e;const s=(0,d.dg)(),f=(0,i.JT)("agent:ReadDynCfg"),h=(0,i.JT)("agent:EditDynCfg"),g=(0,i.JT)("billing:Manage"),b=(0,d.UV)("ids"),m=(0,d.jw)(b),[v]=(0,l.Q8)(),{userStatus:y,spaceId:k}=v||{},C=s&&"loggedIn"==y,_=!!k&&function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e)return!1;const{plan:n}=t.find((t=>{let{id:n}=t;return n==e}))||{};for(let o=0;o<=p.length;o++)if(n.startsWith(p[o]))return!0;return!1}(k,m),A=C?_:n?h:!t||f,{loaded:P,isPaid:w}=u();return{hidden:"hide"===o&&!A,isDisabled:"disabled"===o&&!A||c,tooltipText:(0,r.useMemo)((()=>A?a:P?w||s?"User does not have sufficient permissions to perform this action. Please contact your admin to grant access.":"Upgrade your plan to use this feature.":null),[P,w,A,a]),showUpgradeButton:g&&!A&&!w,hasPermission:A}},g=(0,r.forwardRef)(((e,t)=>{let{view:n,edit:a,ifForbidden:d,tooltip:l,disabled:i,...c}=e;const{hidden:s,isDisabled:u,tooltipText:p}=h({view:n,edit:a,ifForbidden:d,tooltip:l,disabled:i});return s?null:r.createElement(f,(0,o.A)({ref:t,disabled:u,tooltip:p},c))}))},94390:(e,t,n)=>{n.d(t,{$7:()=>r,D9:()=>f,DR:()=>d,FL:()=>o,Fn:()=>p,Sd:()=>a,T_:()=>h,V6:()=>s,V8:()=>g,bM:()=>c,g7:()=>i,gh:()=>u,lp:()=>b,q4:()=>l,zy:()=>m});const o=51,r="/health/alerts/prototypes",a="health:alert:prototype",d="".concat(a,":"),l="dyncfg",i={template:{color:"success"},default:{color:"text"}},c={accepted:{label:"Accepted",color:"success",icon:"checkmark_s"},disabled:{label:"Disabled",color:["neutral","grey100"],icon:"none_selected"},failed:{label:"Failed",color:["red","red100"],icon:"warning_triangle"},orphan:{label:"Orphan",color:["neutral","grey90"],icon:"checkmark_partial_s"},incomplete:{label:"Incomplete",color:["yellow","yellow100"],icon:"incindent_manager"},running:{label:"Running",color:"success",icon:"checkmark_s"}},s={internal:{icon:"internalConfig"},stock:{icon:"stockConfig"},user:{icon:"userConfig"},discovered:{icon:"discoveredConfig"},dyncfg:{icon:"dynamicConfig"}},u={loaded:!0,value:{},hasError:!1},f="__unsaved__",p="Something went wrong",h={accepted:{label:"Accepted",color:"border",searchCondition:{status:"accepted"}},disabled:{label:"Disabled",color:"border",searchCondition:{status:"disabled"}},failed:{label:"Failed",color:"border",searchCondition:{status:"failed"}},orphan:{label:"Orphan",color:"border",searchCondition:{status:"orphan"}},incomplete:{label:"Incomplete",color:"border",searchCondition:{status:"incomplete"}},running:{label:"Running",color:"border",searchCondition:{status:"running"}}},g={internal:{label:"Internal",color:"border",searchCondition:{source_type:"internal"}},stock:{label:"Stock",color:"border",searchCondition:{source_type:"stock"}},user:{label:"User",color:"border",searchCondition:{source_type:"user"}},discovered:{label:"Discovered",color:"border",searchCondition:{source_type:"discovered"}},dyncfg:{label:"Dynamic configuration",color:"border",searchCondition:{source_type:"dyncfg"}}},b={restartRequired:{label:"Restart required",color:"border",searchCondition:{restart_required:!0}},pluginRejected:{label:"Plugin rejected",color:"border",searchCondition:{plugin_rejected:!0}}},m=["restartRequired","pluginRejected","failed","incomplete"]},8239:(e,t,n)=>{n.d(t,{Nj:()=>K,hp:()=>J,SW:()=>T,Hj:()=>z,t8:()=>O,wd:()=>L,L5:()=>$,OD:()=>B,_O:()=>Y,QH:()=>N,sh:()=>F,IP:()=>G,OU:()=>H,ZN:()=>M,SD:()=>Q,EZ:()=>V,DP:()=>x,O_:()=>W,xS:()=>q,y8:()=>Z,MQ:()=>X,_F:()=>D});n(96167),n(17333),n(9920),n(41393),n(98992),n(54520),n(3949),n(81454),n(62953);var o=n(96540),r=n(47444),a=(n(48408),n(26655)),d=n(37618),l=n(49286);const i=e=>({...e,attention:(0,l.bn)(e.attention)}),c={tree:a.A.get,schema:a.A.get,get:a.A.get,enable:a.A.get,disable:a.A.get,restart:a.A.get,remove:a.A.get,add:a.A.post,update:a.A.post,test:a.A.post,userconfig:a.A.post,default:a.A.get},s=function(){let{node:e={},searchParams:t={},payload:n={},...o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.entries(e);if(!t.length)return"";const n=new URLSearchParams;return t.forEach((e=>{let[t,o]=e;o&&n.append(t,o)})),"?".concat(n.toString())}(t),{action:l}=t,s=c[l]||c.default,u={..."tree"==l?{transform:i,...o}:{...o},...d.Ay?{baseURL:window.envSettings.agentApiUrl,...o}:{...o}},f=s==a.A.get?[u]:[n,u];if(d.Ay){const{value:t,isParent:n}=e,o=n?"":"/host/".concat(t);return s("".concat(o,"/api/v1/config").concat(r),...f)}return s("/api/v2/nodes/".concat(null===e||void 0===e?void 0:e.value,"/config").concat(r),...f)},u=e=>{let{node:t,path:n,id:o}=e;return s({node:t,searchParams:{action:"tree",path:n,id:o},allow401:!0})},f=e=>{let{id:t,node:n}=e;return s({node:n,searchParams:{action:"enable",id:t}})},p=e=>{let{id:t,node:n}=e;return s({node:n,searchParams:{action:"disable",id:t}})},h=e=>{let{id:t,name:n,node:o,payload:r}=e;return s({node:o,searchParams:{action:"add",name:n,id:t},payload:r})},g=e=>{let{id:t,node:n,payload:o}=e;return s({node:n,searchParams:{action:"update",id:t},payload:o})},b=(0,r.eU)({key:"newConfigurationItemAtom",default:null}),m=(0,r.eU)({key:"dyncnfModalAtom",default:null}),v=(0,r.eU)({key:"dyncnfKeyAtom",default:0}),y=(0,r.Iz)({key:"dyncnfVirtualListScrollPosition",default:0}),k=(0,r.eU)({key:"dyncnfOpenItems",default:[]}),C=(0,r.Iz)({key:"dyncnfItemTree",default:null}),_=(0,r.eU)({key:"dyncfgAlertNavigationAtom",default:{}}),A={value:"",error:null},P=(0,r.eU)({key:"dyncfgUserConfig",default:A});var w=n(70895),E=n(81198),S=n(94390);const U=(0,r.K0)({key:"configurationsTree",get:e=>{let{node:t,path:n}=e;return e=>{let{get:o}=e;return o(v),u({node:t,path:n})}},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),j=(0,r.K0)({key:"configurationsSchema",get:e=>{let{id:t,node:n}=e;return e=>{let{get:o}=e;return o(v),(e=>{let{id:t,node:n}=e;return s({node:n,searchParams:{action:"schema",id:t}})})({id:t,node:n})}},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),I=(0,r.K0)({key:"configurationsData",get:e=>{let{id:t,node:n}=e;return e=>{let{get:o}=e;return o(v),(e=>{let{id:t,node:n}=e;return s({node:n,searchParams:{action:"get",id:t}})})({id:t,node:n})}},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),R=(0,r.K0)({key:"virtualListScrollPositionSelector",get:e=>{let{node:t,path:n}=e;return e=>{let{get:o}=e;return o(y({node:t,path:n}))}},set:e=>{let{node:t,path:n}=e;return(e,o)=>{let{set:r}=e;r(y({node:t,path:n}),o)}},cachePolicy_UNSTABLE:{eviction:"most-recent"}}),D=e=>{let{node:t,path:n}=e;return(0,r.L4)(R({node:t,path:n}))},L=function(){var e,t;let{node:n,path:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=(0,r.xf)(U({node:n,path:o})),d="hasError"===a.state;return{loaded:"loading"!==a.state,value:null===(e=a.contents)||void 0===e?void 0:e.data,hasError:d,error:(null===(t=a.contents)||void 0===t||null===(t=t.response)||void 0===t?void 0:t.data)||(d?S.Fn:null)}},O=function(){var e,t;let{id:n,node:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=(0,r.xf)(j({id:n,node:o})),d=(0,r.RH)(j({id:n,node:o})),l="hasError"===a.state;return{loaded:"loading"!==a.state,value:null===(e=a.contents)||void 0===e?void 0:e.data,hasError:l,error:(null===(t=a.contents)||void 0===t||null===(t=t.response)||void 0===t?void 0:t.data)||(l?S.Fn:null),refresh:d}},T=function(){var e,t;let{id:n,node:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=(0,r.xf)(I({id:n,node:o})),d=(0,r.RH)(I({id:n,node:o})),l="hasError"===a.state;return{loaded:"loading"!==a.state,value:null===(e=a.contents)||void 0===e?void 0:e.data,hasError:l,error:(null===(t=a.contents)||void 0===t||null===(t=t.response)||void 0===t?void 0:t.data)||(l?S.Fn:null),refresh:d}},F=()=>(0,r.vc)(b),N=()=>(0,r.L4)(b),B=()=>(0,r.L4)(m),x=e=>{let{id:t,node:n}=e;return e=>(e?f:p)({id:t,node:n})},M=e=>{let{id:t,node:n}=e;return()=>(e=>{let{id:t,node:n}=e;return s({node:n,searchParams:{action:"restart",id:t}})})({id:t,node:n})},H=e=>{let{id:t,node:n}=e;return()=>(e=>{let{id:t,node:n}=e;return s({node:n,searchParams:{action:"remove",id:t}})})({id:t,node:n})},q=e=>{let{id:t,node:n}=e;return e=>g({id:t,node:n,payload:e})},J=e=>{let{id:t,isNewItem:n}=e;const r=(0,o.useMemo)((()=>n?h:g),[n]);return(0,o.useCallback)((function(){let{nodes:e=[],payload:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=n?o.name:void 0,d=e.map((e=>r({id:t,node:e,name:a,payload:o})));return Promise.allSettled(d)}),[t,r,n])},K=e=>{let{id:t,node:n}=e;return e=>{let{name:o,...r}=e;return h({id:t,name:o,node:n,payload:r})}},V=e=>{let{id:t,node:n}=e;return e=>{let{name:o,payload:r}=e;return(e=>{let{id:t,name:n,node:o,payload:r}=e;return s({node:o,searchParams:{action:"test",name:n,id:t},payload:r})})({id:t,name:o,node:n,payload:r})}},Z=e=>{let{id:t,node:n}=e;const r=(0,o.useRef)(),{hasPermission:a}=(0,w.j)({edit:!0});return function(){let{name:e="test",payload:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a?(r.current&&r.current.cancel(),r.current=(e=>{let{id:t,name:n,node:o,payload:r}=e;return s({node:o,searchParams:{action:"userconfig",name:n,id:t},payload:r,noResponseParsing:!0})})({id:t,name:e,node:n,payload:o}),r.current):Promise.resolve({data:""})}},z=()=>{const e=(0,r.lZ)(v),[,t]=N();return()=>{e((e=>e+1)),t(null)}},Q=e=>{let{node:t,path:n,isNewItem:r}=e;const{loaded:a,value:d,hasError:l}=L({node:t,path:n});return(0,o.useCallback)((e=>{var t;if(!a||l)return null;const{tree:n}=d||{},o=(0,E.dG)(n);return r?o[e]:o[null===(t=o[e])||void 0===t?void 0:t.template]}),[a,l,d,r])},G=()=>{const[e,t]=(0,r.L4)(k),n=(0,o.useCallback)((e=>{t((t=>t.filter((t=>t!=e))))}),[t]);return{openItems:e,toggle:(0,o.useCallback)(((e,o)=>{o?t((t=>[...t,e])):n(e)}),[t,n]),close:n}},W=e=>{let{node:t,id:n}=e;return(0,r.Zs)((e=>{let{set:o}=e;return async()=>{u({node:t,id:n}).then((e=>{let{data:n}=e;const{tree:r}=n||{};if(r){const e=Object.values(r)[0];e&&Object.entries(e).forEach((e=>{let[n,r]=e;o(C({node:t,id:n}),(0,l.bn)(r))}))}})).catch((()=>{}))}}),[t,n])},Y=e=>{let{node:t,id:n}=e;return(0,r.vc)(C({node:t,id:n}))},$=()=>{const[e,t]=(0,r.L4)(_),n=(0,o.useCallback)((()=>t({})),[t]);return{state:e,setState:t,refresh:n}},X=()=>{const[{value:e,error:t},n]=(0,r.L4)(P),a=(0,o.useCallback)((e=>t=>{n({...A,[e]:t})}),[n]);return{value:e,error:t,setValue:a("value"),setError:a("error"),refresh:(0,o.useCallback)((()=>n(A)),[n])}}},81198:(e,t,n)=>{n.d(t,{J3:()=>o,UE:()=>r,dG:()=>a,m8:()=>d});n(25440),n(17333),n(14905),n(98992),n(54520),n(8872),n(62953);const o=e=>{const t=null===e||void 0===e?void 0:e.split(":");return t?t[t.length-1]:""},r=e=>null===e||void 0===e?void 0:e.split(":").slice(0,-1).join(":"),a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.entries(e).reduce(((e,t)=>{let[n,o]=t;return n.match(/\/[^/]+/g)?{...e,...o}:o}),{})},d=function(){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.entries(e).reduce(((e,t)=>{let[n,o]=t;return{...e,[n.replace(/^\/[^/]+/,"")]:o}}),{})}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return Object.entries(e).reduce(((e,t)=>{let[n,o]=t;return{...e,[n]:Object.entries(o).reduce(((e,t)=>{let[n,r]=t;if(["template","single"].includes(r.type)&&(e[n]={...r}),"template"==r.type){const t=Object.entries(o).filter((e=>{let[,{template:t}]=e;return t==n})).reduce(((e,t)=>{let[n,o]=t;return{...e,[n]:o}}),{});Object.keys(t).length&&(e[n].templateChildren=t)}return e}),{})}}),{})}}}]);