summaryrefslogtreecommitdiffstats
path: root/web/gui/v2/296.debf8c655d29ffce5deb.chunk.js
blob: 194073453588662f37681da96aee0fe8538c928c (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]="3207107d-ed1d-4cbb-9c97-77e772d75e24",e._sentryDebugIdIdentifier="sentry-dbid-3207107d-ed1d-4cbb-9c97-77e772d75e24")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"068845a823c962888381794c354a8f6b6e263031"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[296],{88296:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Re}});var a=n(29439),o=n(67294),r=n(15557),l=n(33937),c=n(87462),i=(n(21249),n(57640),n(9924),n(60677)),s=n(46189),u=n(46667),d=n(27622),m=n(45987),p=(n(92222),n(89250)),g=n(82351),f=n(74059),h=["active","spaceId","testIdPrefix","local"],v=[],E=(0,i.default)(r.Flex).attrs((function(e){return{width:7,height:7,background:e.active?"selected":"elementBackground",justifyContent:"center",alignItems:"center",round:.5}})).withConfig({displayName:"spaceLabel__SpaceBox",componentId:"sc-1e67mnq-0"})(["cursor:pointer;"]),b=function(e){var t=e.active,n=e.spaceId,l=e.testIdPrefix,i=e.local,s=void 0!==i&&i,u=(0,m.Z)(e,h),d=(0,p.s0)(),b=(0,f.vu)(n),w=function(e){if(!e)return v;var t=e.split(" "),n=(0,a.Z)(t,2),o=n[0],r=n[1];return[o[0],r?r[0]:""]}(b.name),x=(0,a.Z)(w,2),C=x[0],k=x[1],I=(0,o.useCallback)((function(){return d(s?"/overview":"/spaces/".concat(b.slug))}),[b.slug,s]);return o.createElement(g.Z,{content:b.name,align:"right",isBasic:!0},o.createElement(E,(0,c.Z)({active:t,"data-testid":"".concat(l||"spaceLabel-space","-").concat(b.slug),onClick:I},u),s?o.createElement(r.Icon,{name:"node",color:t?"main":"textLite"}):o.createElement(o.Fragment,null,o.createElement(r.TextSmall,{strong:!0,color:t?"main":"textLite"},C),o.createElement(r.TextSmall,{strong:!0,color:t?"textLite":"textDescription"},k))))},w=n(36459),x=(n(19601),n(93033)),C=n(15418),k=function(e){var t=Object.assign({},((0,w.Z)(e),e)),n=(0,x.Z)(),a=(0,f.Q6)();return o.createElement(C.Z,{permission:"space:ReadSettings"},(function(e){return o.createElement(g.Z,{content:e?"Space settings":a?"You are viewing a local agent. Connect the agent to a space on cloud to be able to view and change the settings":"Only admins can view space settings"},o.createElement(r.Flex,{opacity:e?null:"weak",padding:[0,1]},o.createElement(r.Button,(0,c.Z)({disabled:!e,flavour:"borderless",icon:"gear",neutral:!0,onClick:n,small:!0,"data-ga":"left-sidebar::click-space-settings::global-view","data-testid":"workspaceBar-manageSpace"},t))))}))},I=n(83732),y=n(62200),Z=n(16645),S=n(7693),F=n(92903),T=(n(24603),n(74916),n(88386),n(39714),n(77601),n(46585)),D=n(30688),R=new RegExp(/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|[!@#$%^&*()_+=\-])/),_=(0,D.A)([function(e){var t=e.length>=T.Pf;return(0,D.f)(t,"Please enter a name for the Space that is at least 5 characters.")},function(e){var t=e.length<=T.Qy;return(0,D.f)(t,"A Space's name can't exceed 20 characters.")},function(e){return R.test(e)?{isValid:!1,message:"There's an unexpected character in the Space's name. Use only alphanumberic characters (A-Z, a-z, 0-9) and spaces."}:{isValid:!0}}]),B=function(e){var t=e.value,n=e.isValid,l=e.setIsValid,c=e.charsIndicator,i=e.isDirty,s=e.handleChange,u=e.validationMessage,d=e.setValidationMessage,m=e.onKeyDown,p=(0,r.useTouchedState)({}),g=(0,a.Z)(p,2),f=g[0],h=g[1];return(0,o.useEffect)((function(){var e=_(t),a=e.isValid,o=e.messages&&e.messages.length?e.messages[0]:void 0;!n&&a?l(!0):n&&!a&&l(!1),o&&d(o)}),[n,t,f,l,d]),o.createElement(r.TextInput,{label:"Space name",name:"createWorkspace",placeholder:"Enter your Space's name",fieldMessage:"Give your Space a name that's between 5-20 characters. This cannot change.",fieldIndicator:c,value:t,touched:f,onBlur:h,onChange:s,success:n,error:!n&&u,instantFeedback:"positiveFirst",isDirty:i,onKeyDown:m})},P=function(e){var t=e.onClose,n=(0,p.s0)(),l=(0,o.useState)(!1),c=(0,a.Z)(l,2),i=c[0],s=c[1],u=(0,o.useState)(!1),d=(0,a.Z)(u,2),m=d[0],g=d[1],f=(0,r.useInputValue)({maxChars:T.Qy}),h=(0,a.Z)(f,4),v=h[0],E=h[1],b=h[2],w=h[3],x=(0,o.useState)(""),C=(0,a.Z)(x,2),k=C[0],D=C[1],R=(0,o.useCallback)((function(e){var a=e.slug;g(!1),t(),n("/spaces/".concat(a))}),[t]),_=(0,I.Z)({onSuccess:R,onError:function(){return g(!1)}}),P=(0,o.useCallback)((function(){i&&(g(!0),_({name:v}))}),[v,i]);return o.createElement(Z.u6,{right:!0,closeOnEsc:!0,closeOnOverlayClick:!0,onClose:t},o.createElement(S.x,{onClose:t,title:"Create Space"},o.createElement(r.Button,{disabled:!i,isLoading:m,loadingLabel:"Creating",label:"Save",onClick:P})),o.createElement(F.B,null,"Create a new Space"),o.createElement(Z.TZ,null,o.createElement(B,{isDirty:w,isValid:i,setIsValid:s,value:v,handleChange:E,charsIndicator:b,validationMessage:k,setValidationMessage:D,onKeyDown:function(e){e.keyCode===y.DV&&i&&P()}})))},L=n(15257),N=n(92432),V=n(14428),W=n(97346),M=n(62289),O=n(3528),A=function(){var e=(0,O.hd)("email"),t=(0,M.Z)().handleOpenProfileModal;return"loading"===e.state||e.state.hasError?null:o.createElement(r.IconButton,{flavour:"borderless","data-testid":"open-email-notification",cursor:"pointer",width:"20px",height:"20px",onClick:function(){return t("notifications")},icon:e.contents.email?"notification_shortcut_enabled":"notification_shortcut_disabled",tooltip:"Email Notifications","data-ga":"left-sidebar::click-user-notification-settings::global-view",iconColor:"iconColor"})},z=(0,o.memo)(A),j=i.default.div.withConfig({displayName:"spaces__Separator",componentId:"sc-8de8pq-0"})(["height:1px;width:",";background:",";"],(0,r.getSizeBy)(3),(0,r.getColor)("border")),U=(0,i.default)(r.Button).withConfig({displayName:"spaces__DocButton",componentId:"sc-8de8pq-1"})(["&&{> .button-icon{width:20px;height:20px;}}"]),q=(0,i.default)(r.Button).withConfig({displayName:"spaces__ExpandButton",componentId:"sc-8de8pq-2"})(["&&{> .button-icon{width:6px;height:9px;}}"]),H={onClickOut:function(){return(0,N.L)("header-help","click-out-modal","global-view")},onCloseClick:function(){return(0,N.L)("header-help","click-close","global-view")},onOpenIssueClick:function(){return(0,N.L)("header-help","click-\u03bfpen-issue","global-view")},onContributeClick:function(){return(0,N.L)("header-help","click-contribute","global-view")},onOpenBugClick:function(){return(0,N.L)("header-help","click-bug","global-view")},onSupportClick:function(){return(0,N.L)("header-help","click-support","global-view")},onVisitDocumentClick:function(){return(0,N.L)("header-help","click-visit-doc","global-view")},onGoToDemoClick:function(){return(0,N.L)("header-help","click-go-to-demo","global-view")}},Q=function(e){var t=e.spacePanelCollapsed,n=e.toggleSpacePanel,l=(0,f.Iw)(),i=(0,f.th)(),m=(0,u.Z)(),p=(0,a.Z)(m,4),h=p[0],v=p[2],E=p[3];return o.createElement(r.Flex,{background:"sideBarMini","data-testid":"workspaceBar",padding:[3,2],column:!0,alignItems:"center",gap:6,height:"100vh",justifyContent:"between"},o.createElement(r.Flex,{column:!0,"data-testid":"workspaceBar-spaces-list",gap:4,alignItems:"center",overflow:"hidden"},o.createElement(d.Z,{"data-testid":"workspaceBar-netdataLogo"}),t&&o.createElement(q,{"data-testid":"workspaceBar-expandButton",onClick:n,icon:"chevron_right_s",neutral:!0,flavour:"borderless",small:!0}),o.createElement(r.Flex,{column:!0,"data-testid":"workspaceBar-spacesList",gap:4,overflow:{vertical:"auto"}},l.map((function(e){return o.createElement(b,{testIdPrefix:"workspaceBar-space",key:e,spaceId:e,active:e===i})}))),o.createElement(W.Z,{permission:"user:CreateSpace"},o.createElement(j,{"data-testid":"workspaceBar-separator"})),o.createElement(g.Z,{content:"Create a new Space",align:"right"},o.createElement(V.Z,{permission:"user:CreateSpace",ifForbidden:"hide",icon:"plus",onClick:v,"data-testid":"workspaceBar-addSpace-button"}))),o.createElement(r.Flex,{column:!0,"data-testid":"workspaceBar-actionsList",gap:4,alignItems:"center"},o.createElement(r.Flex,{column:!0,gap:1,alignItems:"center"},o.createElement(W.Z,{permission:"user:ChangeSpaceRoomNotifications"},o.createElement(z,null)),o.createElement(r.Documentation,(0,c.Z)({app:"cloud",demoUrl:s.Z.demoUrl},H),(function(e){return o.createElement(g.Z,{content:"Read documentation, engage with the community and let us know about features and bugs for the Agent or the Cloud",align:"right"},o.createElement(U,{neutral:!0,flavour:"borderless",icon:"question",onClick:e,"data-ga":"header-help::click-help::global-view","data-testid":"documentation-button",title:"Need help?"}))})),o.createElement(k,null)),o.createElement(L.Z,null)),h&&o.createElement(P,{onClose:E}))},Y=n(15861),G=n(64687),$=n.n(G),K=(n(9170),n(66992),n(41539),n(88674),n(34668),n(78783),n(33948),n(69826),n(31672),n(2490),n(59461),n(26699),n(32023),n(57327),n(88449),n(59849),n(15306),n(27856)),J=n(26398),X=n(18761),ee=n(97945),te=n(7335),ne=n(25819),ae=n(67622),oe=n(61458),re=n(92501),le=n(37689),ce=n(64358),ie=(0,i.default)(r.Icon).withConfig({displayName:"styled__TrashIcon",componentId:"sc-1hr9uxl-0"})(["&:hover{fill:",";opacity:0.6;}"],(0,r.getColor)("textFocus")),se=(0,i.default)(r.TextSmall).withConfig({displayName:"styled__UrlWrapper",componentId:"sc-1hr9uxl-1"})(["overflow-wrap:anywhere;"]),ue=(0,i.default)(r.Icon).withConfig({displayName:"styled__StyledIcon",componentId:"sc-1hr9uxl-2"})(["transform:",";"],(function(e){return e.right?"rotate(0)":"rotate(180deg)"})),de=function(){var e=(0,Y.Z)($().mark((function e(t,n){var a,o,r,l,c,i,s;return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.spaces,o=void 0===a?[]:a,r=n.id,e.next=3,(0,X.kq)(r);case 3:if(l=e.sent,!(c=l.data).length){e.next=9;break}return e.next=8,Promise.any(o.map((function(e){return J.Z.get((0,ce.W)({spaceId:e.id})).then((function(t){var n=t.data;return Promise.any(n.map((function(t){return(0,ne.Fz)({roomId:t.id,spaceId:e.id}).then((function(n){var a=n.data.find((function(e){var t=e.id;return c.includes(t)}));if(!a)throw new Error("can't find matching node");var o=window.location,r=o.protocol,l=o.host;return"".concat(r,"//").concat(l,"/spaces/").concat(e.slug,"/rooms/").concat(t.slug,"/nodes/").concat(a.id)}))})))}))}))).then((function(e){return e})).catch((function(){}));case 8:i=e.sent;case 9:if(!i){e.next=11;break}return e.abrupt("return",i);case 11:if(!(s=t.filter((function(e){return!/netdata\.cloud\//.test(e)}))).length){e.next=16;break}return e.next=15,Promise.any(s.map((function(e){var t=/^https?:\/\//.test(e)?e:"http://".concat(e);return t=t.replace(/\/+$/,""),J.Z.get("".concat(t,"/api/v1/info")).then((function(){return t}))}))).then((function(e){return e})).catch((function(){}));case 15:return e.abrupt("return",e.sent);case 16:return e.abrupt("return");case 17:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),me=function(e){/https?:\/\//.test(e)||(e="http://".concat(e)),/netdata\.cloud\//.test(e)?location.assign(e):window.open(e,"_blank")},pe=function(e){var t=e.id,n=e.selectedId,l=e.setSelectedId,c=(0,ee.bV)(t,"name"),i=(0,u.Z)(),s=(0,a.Z)(i,4),d=s[0],m=s[2],p=s[3],g=(0,te.lL)(),h=(0,ee.bV)(t,"urls"),v=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.openList,r=n.setSelectedId,l=(0,o.useRef)(),c=(0,f.GM)("ids"),i=(0,f.Zu)(c);return(0,o.useCallback)((0,Y.Z)($().mark((function n(){return $().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r(e),l.current){n.next=5;break}return n.next=4,de(t,{spaces:i,id:e});case 4:l.current=n.sent;case 5:if(r(),l.current){n.next=8;break}return n.abrupt("return",a());case 8:me(l.current);case 9:case"end":return n.stop()}}),n)}))),[t,i])}(t,h,{openList:m,setSelectedId:l}),E=(0,o.useCallback)((function(){d?p():v()}),[d,v]),b=n===t;return o.createElement(o.Fragment,null,o.createElement(ae.Z,{onClick:E,isSidebar:!0,padding:[1,2,1,4],testid:"visitedNodes-".concat(c),disabled:!!n&&!b,selected:b,loading:b,iconColor:"menuItem",textColor:"menuItem",Wrapper:r.TextSmall},c),d&&o.createElement(r.Flex,{column:!0,margin:[1,3],padding:[2],border:{side:"all",color:"separator"},round:2},o.createElement(r.Text,{textAlign:"center"},"We couldn't connect to any of your instances, here is the list:"),h.map((function(e){return o.createElement(ae.Z,{key:e,onClick:function(){return me(e)},isSidebar:!0,testid:"visitedNodes-node-".concat(e),actions:o.createElement(r.Flex,{flex:!1,margin:[0,0,0,1]},o.createElement(ie,{name:"trashcan",size:"small",color:"menuItem",onClick:function(n){n.stopPropagation(),g(t,e)},width:"16px",height:"16px"})),padding:[2],Wrapper:se,iconColor:"menuItem",textColor:"menuItem"},e)}))))},ge=function(){var e=(0,te.z2)(),t=(0,u.Z)(e.length>0),n=(0,a.Z)(t,2),l=n[0],c=n[1];(0,o.useEffect)((function(){l||c()}),[e.length]);var i=(0,o.useState)(""),s=(0,a.Z)(i,2),d=s[0],m=s[1],p=(0,te.H3)(d),g=(0,o.useCallback)((0,K.D)(300,(function(e){return m(e.target.value)})),[]),f=(0,o.useState)(),h=(0,a.Z)(f,2),v=h[0],E=h[1];return e.length?o.createElement(oe.Z,{isOpen:l,toggleOpen:c,label:o.createElement(r.Flex,{padding:[1,0],flex:!0,justifyContent:"between",alignItems:"center"},o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(r.Icon,{name:"node_hollow",color:"menuItem",width:"14px",height:"14px"}),o.createElement(r.TextSmall,{color:"menuItem"},"Visited Nodes")),o.createElement(ue,{right:!l,name:"chevron_down",size:"small",color:"menuItem"})),headerTestId:"visitedNodes"},e.length>3&&o.createElement(r.Flex,{padding:[1,2,2,4]},o.createElement(le.Z,{"data-testid":"search-visited-nodes-input",onChange:g,size:"tiny"})),o.createElement(r.Flex,{padding:[0,0,2],column:!0},p.length?p.map((function(e){return o.createElement(pe,{key:e,id:e,selectedId:v,setSelectedId:E})})):o.createElement(r.Text,{padding:[3,5]},"No nodes match your search"))):null},fe=(0,o.memo)((function(){return o.createElement(re.ZP,{fallback:""},o.createElement(o.Suspense,{fallback:""},o.createElement(ge,null)))})),he=n(56662),ve=n(55917),Ee=n(33335),be=function(e){return function(t){var n=(0,f.th)();return o.createElement(e,(0,c.Z)({},t,{key:n}))}},we=n(37931),xe={isSidebar:!0,padding:[1,2,1,4],textColor:"menuItem",Wrapper:r.TextSmall},Ce=be((function(){var e=(0,Ee.gI)("room:Create"),t=(0,Ee.gI)("room:Read"),n=(0,u.Z)(t),l=(0,a.Z)(n,2),c=l[0],i=l[1],s=(0,u.Z)(!1),d=(0,a.Z)(s,4),m=d[0],p=d[2],f=d[3],h=(0,o.useCallback)((function(t){t.stopPropagation(),e&&p()}),[e]);return o.createElement(o.Fragment,null,o.createElement(oe.Z,{"data-testid":"workspaceRooms-menuList",disabled:!t,headerTestId:"workspaceRooms-warRooms",isOpen:c,label:o.createElement(r.Flex,{padding:[1,0],margin:[0,0,1,0],flex:!0,justifyContent:"between",alignItems:"center",height:"24px"},o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(r.Icon,{name:"space_new",color:"menuItem",width:"14px",height:"14px"}),o.createElement(r.TextSmall,{color:"menuItem"},"Rooms")),o.createElement(r.Flex,{alignItems:"center",gap:2},o.createElement(g.Z,{content:"Create a new room",align:"right"},o.createElement(V.Z,{permission:"room:Create",tiny:!0,icon:"plus",onClick:h,"data-testid":"workspaceRooms-addWarRoom-button"})),o.createElement(ve.x,{right:!c,name:"chevron_down",size:"small",color:"menuItem"}))),toggleOpen:i},o.createElement(r.Flex,{column:!0,"data-testid":"workspaceRooms-warRoomsList",padding:[0,0,1]},o.createElement(we.Z,xe))),m&&o.createElement(he.U,{onClose:f,isSubmodal:!1}))})),ke=n(61152),Ie=(0,i.default)(r.Flex).attrs({alignItems:"center",justifyContent:"center",width:10,height:4,round:.5,background:"sideBarMini"}).withConfig({displayName:"styled__AdminPill",componentId:"sc-1ps23b1-0"})(["opacity:0;",":hover &{opacity:1;}"],ae.z),ye=function(e){var t=e.children,n=e.onToggle;return o.createElement(r.Flex,{justifyContent:"between",alignItems:"center"},o.createElement(r.Flex,{alignItems:"center"},t),o.createElement(r.Button,{onClick:n,icon:"chevron_left",neutral:!0,flavour:"hollow",small:!0}))},Ze=n(5795),Se=(0,i.default)(oe.g).attrs({padding:[2],color:"textLite"}).withConfig({displayName:"spacePanel__ListHeader",componentId:"sc-1275zgk-0"})([""]),Fe=function(e){return o.createElement(r.Flex,(0,c.Z)({alignItems:"center",gap:2},e),o.createElement(Ie,null,o.createElement(r.TextFemto,{strong:!0,color:"text"},"ADMIN")),o.createElement(r.Flex,{opacity:"medium"},o.createElement(r.Icon,{name:"padlock",size:"small",width:"18px",height:"18px",color:"text"})))},Te=function(e){var t=e.toggleSpacePanel,n=(0,f.OS)(),l=(0,u.Z)(),c=(0,a.Z)(l,4),i=c[0],s=c[2],d=c[3],m=(0,ke.Z)("manageInvitations"),p=(0,a.Z)(m,2)[1],g=(0,f.Q6)();return o.createElement(o.Fragment,null,i&&o.createElement(Ze.Z,{onClose:d}),o.createElement(oe.Z,{"data-testid":"spacesPanel",isOpen:!0,label:o.createElement(ye,{onToggle:t},n.name),headerTestId:"spacesPanel-activeSpaceHeader",Header:Se},o.createElement(r.Flex,{column:!0,padding:[2,0,1],"data-testid":"spacesPanel-menuList"},g?null:o.createElement(o.Fragment,null,o.createElement(C.Z,{permission:"node:Create"},(function(e){return o.createElement(ae.Z,{actions:e?null:o.createElement(Fe,{"data-testid":"adminWarning-notAdmin"}),disabled:!e,onClick:s,testid:"spacesPanel-claimNodes",icon:"nodes_hollow",iconWidth:"14px",iconHeight:"14px",padding:[1,2],gap:2,isSidebar:!0,textColor:"menuItem",iconColor:"menuItem",Wrapper:r.TextSmall},"Connect Nodes")})),o.createElement(C.Z,{permission:"space:InviteUser"},(function(e){return o.createElement(ae.Z,{actions:e?null:o.createElement(Fe,{"data-testid":"adminWarning-cannotInvite"}),disabled:!e,onClick:p,testid:"spacesPanel-inviteUsers",icon:"user",iconWidth:"14px",iconHeight:"14px",padding:[1,2],gap:2,isSidebar:!0,textColor:"menuItem",iconColor:"menuItem",Wrapper:r.TextSmall},"Invite Users")}))))))},De=function(e){var t=e.spacePanelCollapsed,n=e.toggleSpacePanel;return o.createElement(r.Collapsible,{width:56,background:"sideBar",open:!t,direction:"horizontal"},o.createElement(r.Flex,{flex:!0,width:56,column:!0,overflow:{vertical:"hidden"},padding:[2,0]},o.createElement(Te,{toggleSpacePanel:n}),o.createElement(r.Flex,{overflow:{vertical:"auto"},flex:!0,column:!0},o.createElement(Ce,null),o.createElement(fe,null))))},Re=(0,o.memo)((function(){var e=(0,l.k)("spacePanelCollapsed"),t=(0,a.Z)(e,2),n=t[0],c=t[1],i=(0,o.useCallback)((function(){return c(!n)}),[n]);return(0,o.useLayoutEffect)((function(){var e=setTimeout((function(){return window.dispatchEvent(new Event("resize"))}),400);return function(){return clearTimeout(e)}}),[n]),o.createElement(r.Flex,null,o.createElement(Q,{spacePanelCollapsed:n,toggleSpacePanel:i}),o.createElement(De,{spacePanelCollapsed:n,toggleSpacePanel:i}))}))},56662:function(e,t,n){"use strict";n.d(t,{U:function(){return p}});var a=n(29439),o=n(67294),r=n(89250),l=n(12599),c=n(15557),i=n(97323),s=n(74059),u=n(37518),d=n(16645),m=n(7693),p=function(e){var t=e.onClose,n=e.isSubmodal,p=void 0===n||n,g=(0,s.th)(),f=(0,o.useState)(""),h=(0,a.Z)(f,2),v=h[0],E=h[1],b=(0,c.useInputValue)({maxChars:255,value:""}),w=(0,a.Z)(b,3),x=w[0],C=w[1],k=w[2],I=function(e){var t=(0,r.s0)(),n=(0,s.uk)();return(0,o.useMemo)((function(){return function(a){var o=a.slug,r=(0,l.Gn)("/spaces/:spaceSlug/rooms/:roomSlug",{spaceSlug:n,roomSlug:o});e(),t(r)}}),[n])}(t),y=(0,u.Dq)(g,{onSuccess:I}),Z=(0,o.useCallback)((function(){y({name:v,description:x})}),[v,x]);return o.createElement(d.u6,{right:!0,closeOnEsc:!0,closeOnOverlayClick:!0,onClose:t},o.createElement(m.x,{onClose:t,isSubmodal:p,title:"Create a new room"},o.createElement(c.Button,{label:"Add",onClick:Z,disabled:!v})),o.createElement(d.TZ,null,o.createElement(i.Q,{roomName:v,setRoomName:E,roomDescription:x,charsDescIndicator:k,setRoomDescription:C,isCreateForm:!0})))}},7724:function(e,t,n){"use strict";n.d(t,{CE:function(){return u},M5:function(){return m},R4:function(){return d}});var a=n(29439),o=(n(92222),n(67294)),r=n(15557),l=n(74059),c=n(46667),i=n(37518),s=n(33335),u=function(e){var t=1===e;return"Delete ".concat(e," ").concat(t?"room":"rooms")},d=function(e){return"Delete ".concat(e," room")},m=function(e){var t=e.name,n=e.roomsLength,a=e.spaceName,r=t||"".concat(n,1===n?" room":" rooms");return o.createElement(o.Fragment,null,"You are about to delete ",o.createElement("strong",null,r)," from ",o.createElement("strong",null,a)," space.",o.createElement("br",null),"This cannot be undone. Are you sure you want to continue?")};t.ZP=function(e){var t=e.id,n=e.name,u=e.navigateToParent,p=(0,l.OS)("name"),g=(0,i.tE)(t,"untouchable"),f=(0,s.gI)("room:Delete")&&!g,h=(0,i.IX)(t,{onSuccess:u}),v=(0,c.Z)(),E=(0,a.Z)(v,4),b=E[0],w=E[2],x=E[3];return f?o.createElement(o.Fragment,null,o.createElement(r.Button,{"data-testid":"manageWarRoom-delete",flavour:"hollow",onClick:w,label:"Delete room",danger:!0}),b&&o.createElement(r.ConfirmationDialog,{confirmLabel:"Yes, delete","data-ga":"delete-war-room-dialog","data-testid":"deleteWarRoomDialog",handleConfirm:h,handleDecline:x,message:o.createElement(m,{name:n,spaceName:p}),title:d(n)})):null}},97323:function(e,t,n){"use strict";n.d(t,{Q:function(){return I}});var a=n(87462),o=n(29439),r=n(45987),l=(n(24603),n(74916),n(88386),n(39714),n(82526),n(41817),n(77601),n(67294)),c=n(15557),i=n(62200),s=n(95383),u=n(37518),d=n(33335),m=n(1229),p=n(46667),g="leave-war-room-dialog",f="leaveWarRoomDialog",h=function(e){var t=e.id,n=e.name,r=e.navigateToParent,i=(0,m.IT)(t,"ids"),s=(0,u.iC)(t,{onSuccess:r}),d=(0,u.tE)(t,"untouchable"),h=(0,p.Z)(),v=(0,o.Z)(h,4),E=v[0],b=v[2],w=v[3],x=1===i.length&&!d?{"data-ga":"".concat(g,"-last-member"),"data-testid":"".concat(f,"LastMember"),message:l.createElement(l.Fragment,null,"If you leave, ",l.createElement("strong",null,n)," room will be deleted immediately.",l.createElement("br",null),"Are you sure you want to continue?"),title:"Leave and delete ".concat(n," room")}:{"data-ga":g,"data-testid":f,message:l.createElement(l.Fragment,null,"You are about to leave ",l.createElement("strong",null,n)," room.",l.createElement("br",null),"Are you sure you want to continue?"),title:"Leave ".concat(n," room")};return l.createElement(l.Fragment,null,l.createElement(c.Button,{"data-ga":"manage-war-room-tab::click-leave-war-room::manage-war-room-modal","data-testid":"manageWarRoom-leave",icon:"switch_off",flavour:"borderless",label:"Leave room",neutral:!0,padding:[0],width:"fit-content",onClick:b}),E&&l.createElement(c.ConfirmationDialog,(0,a.Z)({confirmLabel:"Yes, leave",handleConfirm:s,handleDecline:w},x)))},v=n(7724),E=n(30688),b=["charsIndicator","isDisabled","isValid","handleChange","setIsValid","setValidationMessage","validationMessage","value"],w=(0,E.A)([function(e){var t=e.length>=1;return(0,E.f)(t,"Give your room a name that's at least one character.")},function(e){var t=e.length<=20;return(0,E.f)(t,"A room's name can't exceed 20 characters.")}]),x=function(e){var t=e.charsIndicator,n=e.isDisabled,i=e.isValid,s=e.handleChange,u=e.setIsValid,d=e.setValidationMessage,m=e.validationMessage,p=e.value,g=(0,r.Z)(e,b),f=(0,c.useTouchedState)({}),h=(0,o.Z)(f,2),v=h[0],E=h[1];return(0,l.useEffect)((function(){var e=w(p),t=e.isValid,n=e.messages&&e.messages.length?e.messages[0]:void 0;!i&&t?u(!0):i&&!t&&u(!1),n&&d(n)}),[i,u,p,v,d]),l.createElement(c.TextInput,(0,a.Z)({"data-testid":"warRoomOptions-warRoomNameInput",label:"Room name",name:"createRoom",placeholder:"Enter your room's name",fieldMessage:"Tip: Use rooms to group your Nodes by their service, purpose, or location.",fieldIndicator:t,value:p,touched:v,onBlur:E,onChange:s,success:i,error:!i&&m,instantFeedback:"all",disabled:n,autoFocus:!0},g))},C=["id","navigateToParent","isCreateForm","roomName","setRoomName","roomDescription","setRoomDescription","charsDescIndicator","onSaveClick"],k=new RegExp(/^[\w\s\d]*?$/),I=function(e){var t=e.id,n=e.navigateToParent,m=e.isCreateForm,p=e.roomName,g=e.setRoomName,f=e.roomDescription,E=e.setRoomDescription,b=e.charsDescIndicator,w=e.onSaveClick,I=(0,r.Z)(e,C),y=(0,u.tE)(t),Z=(0,s.J7)(),S=(0,l.useState)(!1),F=(0,o.Z)(S,2),T=F[0],D=F[1],R=(0,l.useState)(""),_=(0,o.Z)(R,2),B=_[0],P=_[1],L=(0,l.useState)(""),N=(0,o.Z)(L,2),V=N[0],W=N[1],M=(0,c.useInputValue)({maxChars:i.v$}),O=(0,o.Z)(M,1)[0],A=(0,l.useCallback)((function(e){return g(e.target.value)}),[g]),z=!!t,j=((0,d.gI)("room:LeaveAllNodes")||!y.untouchable)&&Z.length>1&&y.isMember,U=(0,c.useTouchedState)({defaultState:!0}),q=(0,o.Z)(U,2),H=q[0],Q=q[1],Y=!y.name||p===y.name&&f===y.description;return(0,l.useEffect)((function(){W(k.test(f)&&H?"":"The description can only contain digits, letters, and spaces.")}),[H,f]),l.createElement(c.Flex,(0,a.Z)({column:!0,"data-testid":"manageWarRoom",flex:"grow",justifyContent:"between",height:"100%"},I),l.createElement(c.Flex,{column:!0,"data-testid":"manageWarRoom-settings",gap:2},l.createElement(c.Box,{"data-testid":"manageWarRoom-createRoomInputBox"},l.createElement(x,{"data-testid":"manageWarRoom-createRoomInput",value:p,handleChange:A,charsIndicator:O,validationMessage:B,setValidationMessage:P,isValid:T,setIsValid:D,isDisabled:z&&y.untouchable})),l.createElement(c.Box,{"data-testid":"manageWarRoom-descriptionInputBox"},l.createElement(c.TextInput,{"data-testid":"manageWarRoom-descriptionInput",label:"Description",name:"roomDescription",placeholder:"A room description...",instantFeedback:"positiveFirst",touched:H,onBlur:Q,fieldIndicator:b,error:""!==V&&V,success:""===V,value:f,onChange:E}))),l.createElement(c.Flex,{"data-testid":"manageWarRoom-actions"},l.createElement(c.Flex,{"data-testid":"manageWarRoom-deleteLeaveActions",gap:4},z&&j&&l.createElement(h,{id:t,name:y.name,navigateToParent:n}),z&&l.createElement(v.ZP,{id:t,name:p,navigateToParent:n})),!m&&l.createElement(c.Button,{"data-ga":"manage-war-room-tab::click-save::manage-war-room-modal","data-testid":"manageRoom-saveButton",label:"Save",onClick:w,disabled:Y,margin:[0,0,0,"auto"]})))}},61152:function(e,t,n){"use strict";var a=n(65351);t.Z=function(e,t){var n=(0,a.Z)(e,t),o=n.isModalOpen,r=n.handleOpenModal,l=n.handleCloseModal;return[o,o?l:r,r,l,n.params]}},11060:function(e,t,n){var a=n(1702),o=Error,r=a("".replace),l=String(o("zxcasd").stack),c=/\n\s*at [^:]*:[^\n]*/,i=c.test(l);e.exports=function(e,t){if(i&&"string"==typeof e&&!o.prepareStackTrace)for(;t--;)e=r(e,c,"");return e}},5392:function(e,t,n){var a=n(68880),o=n(11060),r=n(22914),l=Error.captureStackTrace;e.exports=function(e,t,n,c){r&&(l?l(e,t):a(e,"stack",o(n,c)))}},22914:function(e,t,n){var a=n(47293),o=n(79114);e.exports=!a((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",o(1,7)),7!==e.stack)}))},58340:function(e,t,n){var a=n(70111),o=n(68880);e.exports=function(e,t){a(t)&&"cause"in t&&o(e,"cause",t.cause)}},56277:function(e,t,n){var a=n(41340);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:a(e)}},56967:function(e,t,n){"use strict";var a=n(82109),o=n(47976),r=n(79518),l=n(27674),c=n(99920),i=n(70030),s=n(68880),u=n(79114),d=n(58340),m=n(5392),p=n(20408),g=n(56277),f=n(5112)("toStringTag"),h=Error,v=[].push,E=function(e,t){var n,a=o(b,this);l?n=l(h(),a?r(this):b):(n=a?this:i(b),s(n,f,"Error")),void 0!==t&&s(n,"message",g(t)),m(n,E,n.stack,1),arguments.length>2&&d(n,arguments[2]);var c=[];return p(e,v,{that:c}),s(n,"errors",c),n};l?l(E,h):c(E,h,{name:!0});var b=E.prototype=i(h.prototype,{constructor:u(1,E),message:u(1,""),name:u(1,"AggregateError")});a({global:!0,constructor:!0,arity:2},{AggregateError:E})},9170:function(e,t,n){n(56967)},34668:function(e,t,n){"use strict";var a=n(82109),o=n(46916),r=n(19662),l=n(35005),c=n(78523),i=n(12534),s=n(20408),u=n(80612),d="No one promise resolved";a({target:"Promise",stat:!0,forced:u},{any:function(e){var t=this,n=l("AggregateError"),a=c.f(t),u=a.resolve,m=a.reject,p=i((function(){var a=r(t.resolve),l=[],c=0,i=1,p=!1;s(e,(function(e){var r=c++,s=!1;i++,o(a,t,e).then((function(e){s||p||(p=!0,u(e))}),(function(e){s||p||(s=!0,l[r]=e,--i||m(new n(l,d)))}))})),--i||m(new n(l,d))}));return p.error&&m(p.value),a.promise}})}}]);