"use strict";(self.webpackChunk_splunk_ucc_ui_lib=self.webpackChunk_splunk_ucc_ui_lib||[]).push([[772],{6772:(e,n,t)=>{t.r(n),t.d(n,{default:()=>U});var a,r=t(885),l=t(168),c=t(7294),o=t(6219),i=t(2672),u=t.n(i),s=t(1946),m=t.n(s),p=t(1569),d=t.n(p),b=t(2788),f=t(4893),g=t(4255),y=t(1263),E=t(5496),v=t(1581),h=t.n(v),O=t(6416),k=t.n(O),Z=t(5414),j=t.n(Z),S=t(5464),_=t(2297),w=t(6549),N=t(6070),P=t(4843),C=b.default.div(a||(a=(0,l.Z)(["\n    margin-left: 270px !important;\n    width: 150px;\n\n    .save_btn {\n        width: 100%;\n    }\n"])));function T(e){var n=e.serviceName,t=(0,c.useRef)(),a=(0,c.useState)(null),l=(0,r.Z)(a,2),i=l[0],u=l[1],s=(0,c.useState)(!1),m=(0,r.Z)(s,2),p=m[0],d=m[1],b=(0,c.useState)({}),f=(0,r.Z)(b,2),g=f[0],y=f[1];if((0,c.useEffect)((function(){(0,_.L)({serviceName:"settings/".concat(n),handleError:!0,callbackOnError:function(e){e.uccErrorCode="ERR0005",u(e)}}).then((function(e){y(e.data.entry[0].content)}))}),[n]),null!=i&&i.uccErrorCode)throw i;return Object.keys(g).length?c.createElement(c.Fragment,null,c.createElement(S.Z,{ref:t,page:P.y,stanzaName:n,serviceName:"settings",mode:w.DE,currentServiceState:g,handleFormSubmit:function(e){d(e)}}),c.createElement(C,null,c.createElement(k(),{className:"saveBtn",appearance:"primary",label:p?c.createElement(j(),null):(0,o._)("Save"),onClick:function(){t.current.handleSubmit()},disabled:p}))):c.createElement(N.XE,null)}T.propTypes={serviceName:h().string.isRequired};const R=T;var x=t(4942),L=t(6057),D=t(7588),I=t(5792),q=t(3649),z=t(9881);function F(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function A(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?F(Object(t),!0).forEach((function(n){(0,x.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):F(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function B(e){var n=e.selectedTab,t=e.updateIsPageOpen,a=(0,c.useState)({open:!1}),l=(0,r.Z)(a,2),o=l[0],i=l[1],u=n.style===z.G;return c.createElement(L.W,{value:null},u&&o.open?(t(!0),c.createElement(q.Z,{open:o.open,handleRequestClose:function(){i(A(A({},o),{},{open:!1})),t(!1)},serviceName:n.name,stanzaName:o.stanzaName,mode:o.mode,formLabel:o.formLabel,page:P.y})):null,u&&o.open?null:c.createElement(D.Z,{page:P.y,serviceName:n.name,handleRequestModalOpen:function(){i(A(A({},o),{},{open:!0,mode:w.jg,formLabel:"Add ".concat(n.title)}))},handleOpenPageStyleDialog:function(e,t){i(A(A({},o),{},{open:!0,stanzaName:e.name,formLabel:t===w.Oh?"Clone ".concat(n.title):"Update ".concat(n.title),mode:t}))}}),!u&&o.open?c.createElement(I.Z,{page:P.y,open:o.open,handleRequestClose:function(){i(A(A({},o),{},{open:!1}))},serviceName:n.name,mode:w.jg,formLabel:o.formLabel}):null)}B.propTypes={selectedTab:h().object,updateIsPageOpen:h().func};const G=(0,c.memo)(B);var K,M=(0,b.default)(d().Row)(K||(K=(0,l.Z)(["\n    padding: 5px 0px;\n\n    .dropdown {\n        text-align: right;\n    }\n\n    .input_button {\n        text-align: right;\n        margin-right: 0px;\n    }\n"])));const U=function(){var e=(0,g.YK)().pages.configuration,n=e.title,t=e.description,a=e.tabs,l=a.map((function(e){return e.name})),i=(0,c.useState)(a[0].name),s=(0,r.Z)(i,2),p=s[0],b=s[1],v=(0,c.useState)(!1),h=(0,r.Z)(v,2),O=h[0],k=h[1],Z=(0,f.Z)();(0,c.useEffect)((function(){Z&&l.includes(Z.get("tab"))&&Z.get("tab")!==p&&b(Z.get("tab"))}),[]);var j=(0,c.useCallback)((function(e,n){var t=n.selectedTabId;b(t),k(!1)}),[p]),S=function(e){k(e)};return c.createElement(E.Z,null,c.createElement("div",{style:O?{display:"none"}:{display:"block"}},c.createElement(d(),{gutter:8},c.createElement(M,null,c.createElement(d().Column,{span:9},c.createElement(y.r3,null,(0,o._)(n)),c.createElement(y.pZ,null,(0,o._)(t||""))))),c.createElement(u(),{activeTabId:p,onChange:j},a.map((function(e){return c.createElement(u().Tab,{key:e.name,label:(0,o._)(e.title),tabId:e.name})})))),a.map((function(e){return e.table?c.createElement("div",{key:e.name,style:e.name!==p?{display:"none"}:{display:"block"},id:"".concat(e.name,"Tab")},c.createElement(G,{key:e.name,selectedTab:e,updateIsPageOpen:S})):c.createElement("div",{key:e.name,style:e.name!==p?{display:"none"}:{display:"block"},id:"".concat(e.name,"Tab")},c.createElement(R,{key:e.name,serviceName:e.name}))})),c.createElement(m(),{position:"top-right"}))}}}]);