"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[4770],{59447:function(e,n,t){var a=t(93433),r=t(29439),l=t(72791),i=t(26181),o=t.n(i),c=t(29945),u=t(80184);n.Z=function(e){var n=e.elements,t=e.name,i=e.label,s=e.tooltip,f=void 0===s?"":s,d=e.commonPlaceholder,v=void 0===d?"":d,h=e.onChange,m=e.withBorder,p=void 0!==m&&m,x=(0,l.useState)([""]),g=(0,r.Z)(x,2),j=g[0],b=g[1],y=(0,l.createRef)();(0,l.useEffect)((function(){if(1===j.length&&""===j[0]&&n&&""!==n){var e=n.split(",");e.push(""),b(e)}}),[n,j]),(0,l.useEffect)((function(){if(j.length>1){var e=y.current;e&&e.scrollIntoView(!1)}}),[j,y]);var w=(0,l.useCallback)((function(e){h(e)}),[h]),k=(0,l.useRef)(!0);(0,l.useEffect)((function(){if(k.current)k.current=!1;else{var e=j.filter((function(e){return""!==e.trim()})).join(",");w(e)}}),[j]);var C=function(e){e.persist();var n=(0,a.Z)(j),t=o()(e.target,"dataset.index","0");n[parseInt(t)]=e.target.value,b(n)},Z=j.map((function(e,n){return(0,u.jsx)(c.Wzg,{id:"".concat(t,"-").concat(n.toString()),label:"",name:"".concat(t,"-").concat(n.toString()),value:j[n],onChange:C,index:n,placeholder:v,overlayIcon:n===j.length-1?(0,u.jsx)(c.dtP,{}):null,overlayAction:function(){!function(e){if(""!==e[e.length-1].trim()){var n=(0,a.Z)(e);n.push(""),b(n)}}(j)}},"csv-multi-".concat(t,"-").concat(n.toString()))}));return(0,u.jsx)(l.Fragment,{children:(0,u.jsxs)(c.xuv,{sx:{display:"flex"},className:"inputItem",children:[(0,u.jsxs)(c.AZs,{sx:{alignItems:"flex-start"},children:[(0,u.jsx)("span",{children:i}),""!==f&&(0,u.jsx)(c.xuv,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,u.jsx)(c.ua7,{tooltip:f,placement:"top",children:(0,u.jsx)(c.xuv,{className:f,children:(0,u.jsx)(c.byK,{})})})})]}),(0,u.jsxs)(c.xuv,{withBorders:p,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[Z,(0,u.jsx)("div",{ref:y})]})]})})}},94770:function(e,n,t){t.r(n),t.d(n,{valueDef:function(){return u}});var a=t(93433),r=t(29439),l=t(72791),i=t(29945),o=t(59447),c=t(80184),u=function(e,n,t){var a="on|off"===n?"off":"";if(t.length>0){var r=t.find((function(n){return n.key===e}));r&&(a=r.value||"")}return a};n.default=function(e){var n=e.onChange,t=e.fields,s=e.defaultVals,f=e.overrideEnv,d=(0,l.useState)([]),v=(0,r.Z)(d,2),h=v[0],m=v[1],p=t||[],x=s||[];(0,l.useEffect)((function(){var e=t.map((function(e){return{key:e.name,value:u(e.name,e.type,x)}}));m(e)}),[t,s]),(0,l.useEffect)((function(){n(h)}),[h]);var g=function(e,n,t){var r=(0,a.Z)(h);n=n.trim(),r[t]={key:e,value:n},m(r)},j=function(e,n){var t=h[n];if(t){var a=null===f||void 0===f?void 0:f["".concat(t.key)];if(a)return(0,c.jsx)(i.bSr,{label:e.label,actionButton:(0,c.jsx)(i.rjZ,{item:!0,sx:{display:"flex",justifyContent:"flex-end",paddingRight:"10px"},children:(0,c.jsx)(i.ua7,{tooltip:"This value is set from the ".concat(a.overrideEnv," environment variable"),placement:"left",children:(0,c.jsx)(i.zD0,{style:{width:20}})})}),sx:{width:"100%"},children:a.value})}switch(e.type){case"on|off":var r=t?t.value:"off";return(0,c.jsx)(i.rsf,{onChange:function(t){var a=t.target.checked?"on":"off";g(e.name,a,n)},id:e.name,name:e.name,label:e.label,value:"switch_on",tooltip:e.tooltip,checked:"on"===r});case"csv":return(0,c.jsx)(o.Z,{elements:t?t.value:"",label:e.label,name:e.name,onChange:function(t){var a="";a=Array.isArray(t)?t.join(","):t,g(e.name,a,n)},tooltip:e.tooltip,commonPlaceholder:e.placeholder,withBorder:!0});case"comment":return(0,c.jsx)(i.q5m,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:t?t.value:"",onChange:function(t){return g(e.name,t.target.value,n)},placeholder:e.placeholder});default:return(0,c.jsx)(i.Wzg,{id:e.name,name:e.name,label:e.label,tooltip:e.tooltip,value:t?t.value:"",onChange:function(t){return g(e.name,t.target.value,n)},placeholder:e.placeholder})}};return(0,c.jsx)(i.ltY,{withBorders:!1,containerPadding:!1,children:p.map((function(e,n){return(0,c.jsx)(l.Fragment,{children:j(e,n)},e.name)}))})}}}]);
//# sourceMappingURL=4770.08d9efec.chunk.js.map