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]="72afe0cd-51b9-407f-b4b6-27de2cbc0138",e._sentryDebugIdIdentifier="sentry-dbid-72afe0cd-51b9-407f-b4b6-27de2cbc0138")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"0c0a7a41a0e7ecb4870dbce38dbd7d5e0913bb7f"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[9768],{39768:function(e,t,n){n.r(t),n.d(t,{default:function(){return C}});var r=n(45987),o=n(29439),a=(n(92222),n(9170),n(66992),n(41539),n(88674),n(34668),n(78783),n(33948),n(21249),n(57640),n(9924),n(69826),n(31672),n(2490),n(59461),n(26699),n(32023),n(74916),n(64765),n(15306),n(67294)),i=n(89250),c=n(17563),u=n(26398),s=n(62200),d=n(13477),f=n(25819),l=n(93017),g=n(76201),p=n(74059),w=n(6308),v=n(4942);n(47941),n(82526),n(57327),n(88449),n(59849),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070);function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){(0,v.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=function(){var e=(0,d.Iy)("id"),t=(0,d.Iy)("name"),n=(0,d.Iy)("email"),r=(0,d.Iy)("createdAt"),i=(0,d.Iy)("verifiedEmail"),c=(0,d.Iy)("avatarUrl"),u=(0,p.GM)("loaded"),s=(0,p.GM)("ids"),f=(0,w.Z)(),l=(0,o.Z)(f,3),g=l[1],v=l[2];(0,a.useEffect)((function(){e&&u&&!g&&function(e){var t=e.avatar,n=e.createdAt,r=e.email,o=e.id,a=e.name,i=e.spacesCount,c=e.verifiedEmail,u=e.maxNodesCount;if(window.envSettings.tracking&&(!r||!r.includes("@netdata.msdc.co"))&&(!o||"00000000-0000-0000-0000-000000000000"!==o)&&(!r||!r.includes("anonymous@netdata.cloud"))){var s,d=new Date,f=d.toISOString(),l=new Date(n),g=Math.floor((d-l)/864e5);window.dataLayer&&(window.dataLayer.push({event:"UserInfoAvailable",user_id:o,userIdentifier:o,userName:a,userEmail:r,userAccountCreatedAt:n,userAccountCreatedDaysAgo:g,userAvatarURL:t,userEmailVerified:c,spacesCount:i}),window.gtag&&window.gtag("config","G-J69Z2JCTFB",{user_id:o}),null!==(s=window.posthog)&&void 0!==s&&s.__loaded&&(window.posthog.identify(o),window.posthog.people.set({email:r||"unknown email",name:a,netdata_cloud_account_created_at:n,netdata_cloud_account_created_days_ago:g,spacesCount:i,maxNodesCount:u}),window.posthog.register(m({netdata_cloud_account_created_days_ago:g},window.localNetdataRegistry?m(m({},window.localNetdataRegistry.pg?{netdata_registry_person_guid:window.localNetdataRegistry.pg}:{}),window.localNetdataRegistry.mg?{netdata_registry_machine_guid:window.localNetdataRegistry.mg}:{}):{})),window.posthog.register_once({event_source:"cloud",netdata_cloud_account_created_at:n,netdata_cloud_account_email:r||"unknown email",netdata_cloud_account_id:o,netdata_cloud_signed_in_at:f})))}}({avatar:c,createdAt:r,email:n,id:e,name:t,spacesCount:s.length,verifiedEmail:i,maxNodesCount:v})}),[e,u,g]),(0,a.useEffect)((function(){var e;if(null!==(e=window.posthog)&&void 0!==e&&e.__loaded)try{window.posthog.onFeatureFlags((function(){window.posthog.isFeatureEnabled&&window.posthog.isFeatureEnabled("user-age-less-than-7d")&&window.posthog.startSessionRecording()}))}catch(t){}}),[])},b=function(){var e;if(null!==(e=window.posthog)&&void 0!==e&&e.__loaded){var t=(new Date).toISOString();window.posthog.register_once({event_source:"cloud",posthog_first_seen_at:t,posthog_first_distinct_id:"get_distinct_id"in window.posthog&&window.posthog.get_distinct_id()})}},_=function(){return(0,a.useEffect)(b,[])},k=n(7335),E=n(18761),O=n(64358),P=n(32950),I=n(78710),S=n(28721),j=n(16294),Z=["cloudRoute","redirect_uri"],x=function(e){var t=e.errorRetry,n=e.token,r=e.redirectUri,o=c.parseUrl(decodeURIComponent(t)),i=o.url,u=o.query.redirect_uri,s=(0,a.useRef)(!1);return s.current||(s.current=!0,window.location="".concat(i,"?token=").concat(n,"&redirect_uri=").concat(u||r)),null},C=function(){var e=(0,d.Iy)("isLoaded"),t=(0,d.Iy)("isAnonymous");(0,g.Z)(),_(),y(),(0,a.useEffect)((function(){if(!I.ZP){var e=window.localStorage.getItem(j.uf.visitor);if(e)window.envSettings.visitor=e;else{var t=(0,S.Z)();window.localStorage.setItem(j.uf.visitor,t),window.envSettings.visitor=t}}}),[]),(0,a.useEffect)((function(){sessionStorage.getItem(j.Hw.session)||sessionStorage.setItem(j.Hw.session,(0,S.Z)())}),[]);var n=(0,i.bS)("/sign-in/mobile-app/*"),p=(0,i.bS)("/sign-in/*"),w=(0,i.bS)("/sign-up/*"),v=!!p||!!w,h=function(){var e=(0,l.Z)(),t=(0,o.Z)(e,2)[1],n=(0,k.DH)();return(0,a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.origin,o=e.id,a=e.name;if(r){var i=decodeURIComponent(o),c=decodeURIComponent(r);(0,E.kq)(o).then((function(e){var r=e.data,o=void 0===r?[]:r;return n(i,c,a),o.length?u.Z.get(s.MC).then((function(e){var t=e.data;return Promise.any(t.map((function(e){return u.Z.get((0,O.W)({spaceId:e.id})).then((function(t){var n=t.data;return Promise.any(n.map((function(t){return(0,f.Fz)({roomId:t.id,spaceId:e.id}).then((function(n){var r=n.nodes.find((function(e){var t=e.id;return o.includes(t)}));if(!r)throw new Error("can't find matching node");var a=window.location,i=a.protocol,c=a.host;return"".concat(i,"//").concat(c,"/spaces/").concat(e.slug,"/rooms/").concat(t.slug,"/nodes/").concat(r.id)}))})))}))})))})).catch((function(){})):(0,E.YZ)(i).then((function(e){var n=e.data.claimed;throw t(n?{errorMsgKey:"ErrForbidden",errorMessage:"You tried to access this Node on Netdata and you don't have access to it. Please contact your Space admin to give you access to it."}:{errorMsgKey:"ErrForbidden",errorMessage:"This Node isn't connected to Netdata. Please connect it, if you have permission for it, or contact your Space admin."}),"no access"}))})).then((function(e){e&&setTimeout(location.assign(e))})).catch((function(){}))}}),[])}(),m=(0,P.Z)();if(!e||m.isFetching||m.hasAccess&&!v||n)return null;var b=window.location,C=b.pathname,D=b.search,R=b.hash,A=c.parse(R),N=A.error_retry,F=A.token,U=c.parse(D),T=U.cloudRoute,z=U.redirect_uri,M=(0,r.Z)(U,Z);if(!t&&N)return a.createElement(x,{errorRetry:N,token:F,redirectUri:z});if(!t&&v){if(T){var L=T.includes("join-callback")?decodeURI(T):T,G=Array.isArray(L)?L[0]:L;return a.createElement(i.Fg,{replace:!0,to:G})}return z?(h(M),window.location.replace(decodeURIComponent(z)),null):a.createElement(i.Fg,{replace:!0,to:"/spaces"})}if(I.ZP)return null;if(t&&!v){var H=R.includes("join-callback")?R:encodeURIComponent(R),J="".concat(D).concat(D?"&":"?","cloudRoute=").concat(C);return a.createElement(i.Fg,{replace:!0,to:{pathname:"/sign-in",search:J,hash:H}})}return null}},7335:function(e,t,n){n.d(t,{aG:function(){return E},H3:function(){return b},XU:function(){return O},DH:function(){return k},z2:function(){return y},lL:function(){return _}});var r=n(29439),o=n(93433),a=n(15861),i=n(4942),c=n(64687),u=n.n(c),s=(n(21249),n(57640),n(9924),n(85827),n(41539),n(25387),n(2490),n(72608),n(57327),n(88449),n(59849),n(26699),n(32023),n(92222),n(66992),n(70189),n(78783),n(88921),n(96248),n(13599),n(11477),n(64362),n(15389),n(90401),n(45164),n(91238),n(54837),n(87485),n(56767),n(76651),n(61437),n(35285),n(39865),n(33948),n(69826),n(31672),n(59461),n(2707),n(47941),n(82526),n(38880),n(15581),n(34514),n(54747),n(49337),n(33321),n(69070),n(67294)),d=n(4480),f=n(89250),l=n(13477),g=(0,d.xu)({key:"visitedNodes",default:function(){return[]}}),p=n(97945),w=n(18761);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){(0,i.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var m=(0,d.CG)({key:"visitedNodeIdsValue",get:function(e){return function(t){return(0,t.get)(g(e)).map((function(e){return e.id}))}}}),y=function(){var e=(0,l.jr)(),t=(0,d.sJ)(g(e)),n=(0,d._8)((function(e){var t=e.set;return function(e){t(p.Jz,{values:e.reduce((function(e,t){return h(h({},e),{},(0,i.Z)({},t.id,h(h({},t),{},{loaded:!0})))}),{}),merge:!0})}}),[]);return(0,s.useEffect)((function(){n(t)}),[t]),(0,d.sJ)(m(e))},b=function(e){var t=(0,l.jr)(),n=(0,d.sJ)(g(t)),r=(0,s.useMemo)((function(){return e?n.filter((function(t){return t.name.toUpperCase().includes(e.toUpperCase())})):n}),[n,e]);return(0,s.useMemo)((function(){return r.map((function(e){return e.id}))}),[r])},_=function(){return(0,d._8)((function(e){var t=e.snapshot,n=e.set;return function(){var e=(0,a.Z)(u().mark((function e(r,o){var a,i,c,s,d;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getPromise((0,l.KL)("id"));case 2:return a=e.sent,e.next=5,t.getPromise((0,p.zP)({id:r}));case 5:return i=e.sent,c=i.urls,s=i.name,d=c.filter((function(e){return e!==o})),n((0,p.zP)({id:r,key:"urls"}),d),d.length||n(g(a),(function(e){return e.filter((function(e){return e.id!==r}))})),e.prev=11,e.next=14,d.length?(0,w.RX)(a,r,s,d):(0,w.Sd)(a,[r]);case 14:(0,w.Wy)(a,r).catch((function(){})),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(11),n((0,p.zP)({id:r,key:"urls"}),c);case 20:case"end":return e.stop()}}),e,null,[[11,17]])})));return function(t,n){return e.apply(this,arguments)}}()}),[])},k=function(){var e=(0,f.TH)().pathname,t=(0,l.jr)(),n=E(t,{autoFetch:!1});return(0,d._8)((function(e){var t=e.snapshot,r=e.set;return function(){var e=(0,a.Z)(u().mark((function e(a,i,c){var s,d,f,v,m,y;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getPromise((0,l.KL)("isAnonymous"));case 2:if(!e.sent){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,t.getPromise((0,l.KL)("id"));case 7:return s=e.sent,e.next=10,t.getPromise((0,p.zP)({id:a}));case 10:if(d=e.sent,f=d.urls,v=d.name,m=i?[i].concat((0,o.Z)(f)):f,m=(0,o.Z)(new Set([window.location.href].concat((0,o.Z)(m)))),y=m.length!==f.length,e.prev=16,r((0,p.zP)({id:a,key:"urls"}),m),r(g(s),(function(e){var t=e.find((function(e){return e.id===a})),n=e.filter((function(e){return e.id!==a}));return t?[h(h({},t),{},{accessCount:t.accessCount+1,lastAccessTime:(new Date).toISOString()})].concat((0,o.Z)(n)):[{accessCount:1,id:a,lastAccessTime:(new Date).toISOString(),urls:m,name:c}].concat((0,o.Z)(n))})),!y){e.next=22;break}return e.next=22,(0,w.RX)(s,a,c||v,m);case 22:return n(),e.next=25,(0,w.Wy)(s,a);case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(16),r((0,p.zP)({id:a,key:"urls"}),f);case 30:case"end":return e.stop()}}),e,null,[[16,27]])})));return function(t,n,r){return e.apply(this,arguments)}}()}),[n,e,t])},E=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).autoFetch,n=void 0===t||t,o=(0,d.FV)(g(e)),a=(0,r.Z)(o,2)[1],i=(0,s.useState)(0),c=(0,r.Z)(i,2),u=c[0],f=c[1],l=(0,s.useCallback)((function(){f((function(e){return e+1}))}),[f]);return(0,s.useEffect)((function(){e&&(n||u)&&(0,w.Fz)(e).then((function(e){if(e){var t=e.data.results.sort((function(e,t){return new Date(t.lastAccessTime)-new Date(e.lastAccessTime)}));a(t)}}))}),[n,u,e]),l},O=function(){var e=(0,l.jr)(),t=g(e);return(0,d._8)((function(e){var n=e.snapshot,r=e.set;return function(){var e=(0,a.Z)(u().mark((function e(o){var a,i,c,s;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getPromise((0,p.$E)(o));case 2:return a=e.sent,i=a.map((function(e){return e.machineGUID})),e.next=6,n.getPromise(t);case 6:c=e.sent,(s=c.filter((function(e){return!i.includes(e.id)}))).length!==c.length&&r(t,s);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[e])}},11060:function(e,t,n){var r=n(1702),o=Error,a=r("".replace),i=String(new o("zxcasd").stack),c=/\n\s*at [^:]*:[^\n]*/,u=c.test(i);e.exports=function(e,t){if(u&&"string"==typeof e&&!o.prepareStackTrace)for(;t--;)e=a(e,c,"");return e}},5392:function(e,t,n){var r=n(68880),o=n(11060),a=n(22914),i=Error.captureStackTrace;e.exports=function(e,t,n,c){a&&(i?i(e,t):r(e,"stack",o(n,c)))}},22914:function(e,t,n){var r=n(47293),o=n(79114);e.exports=!r((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",o(1,7)),7!==e.stack)}))},58340:function(e,t,n){var r=n(70111),o=n(68880);e.exports=function(e,t){r(t)&&"cause"in t&&o(e,"cause",t.cause)}},56277:function(e,t,n){var r=n(41340);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},56967:function(e,t,n){var r=n(82109),o=n(47976),a=n(79518),i=n(27674),c=n(99920),u=n(70030),s=n(68880),d=n(79114),f=n(58340),l=n(5392),g=n(20408),p=n(56277),w=n(5112)("toStringTag"),v=Error,h=[].push,m=function(e,t){var n,r=o(y,this);i?n=i(new v,r?a(this):y):(n=r?this:u(y),s(n,w,"Error")),void 0!==t&&s(n,"message",p(t)),l(n,m,n.stack,1),arguments.length>2&&f(n,arguments[2]);var c=[];return g(e,h,{that:c}),s(n,"errors",c),n};i?i(m,v):c(m,v,{name:!0});var y=m.prototype=u(v.prototype,{constructor:d(1,m),message:d(1,""),name:d(1,"AggregateError")});r({global:!0,constructor:!0,arity:2},{AggregateError:m})},9170:function(e,t,n){n(56967)},34668:function(e,t,n){var r=n(82109),o=n(46916),a=n(19662),i=n(35005),c=n(78523),u=n(12534),s=n(20408),d=n(80612),f="No one promise resolved";r({target:"Promise",stat:!0,forced:d},{any:function(e){var t=this,n=i("AggregateError"),r=c.f(t),d=r.resolve,l=r.reject,g=u((function(){var r=a(t.resolve),i=[],c=0,u=1,g=!1;s(e,(function(e){var a=c++,s=!1;u++,o(r,t,e).then((function(e){s||g||(g=!0,d(e))}),(function(e){s||g||(s=!0,i[a]=e,--u||l(new n(i,f)))}))})),--u||l(new n(i,f))}));return g.error&&l(g.value),r.promise}})}}]);
|