"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849],{60918(B,u,e){e.r(u),e.d(u,{SoloPanelPage:()=>P,SoloPanelRenderer:()=>S,default:()=>T});var s=e(74848),x=e(22803),i=e(96540),m=e(54148),v=e(26620),y=e(90231),g=e(37e3),j=e(29675),E=e(20968),R=e(20337),C=e(22961),L=e(11817),p=e(61491),D=e(44172),F=e(93300),M=e(9964),h=e(2044);function A(t,n){const[a,o]=(0,i.useState)(),[l,r]=(0,i.useState)();return(0,i.useEffect)(()=>{new v.g5().initSync(t);const z=t.activate();let f=null;try{f=(0,h.vL)(t,n)}catch{}return f?(I(f),o(f)):(0,M.ag)(n)?N(t,n).then(d=>{d?o(d):r("Panel not found")}):r("Panel not found"),z},[t,n]),[a,l]}function I(t){let n=t.parent;for(;n&&!n.isActive;)n.activate(),n=n.parent}function N(t,n){return new Promise(a=>{t.subscribeToEvent(F.d,()=>{const o=(0,h.vL)(t,n);o?a(o):t.state.body.activateRepeaters?.()}),t.state.body.activateRepeaters?.()})}function P({queryParams:t}){const n=(0,D.sP)(),{dashboard:a,loadError:o}=n.useState(),{uid:l="",type:r,slug:c}=(0,m.g)();return(0,i.useEffect)(()=>(n.loadDashboard({uid:l,type:r,slug:c,route:p.DashboardRoutes.Embedded}),()=>n.clearState()),[n,t,l,r,c]),t.panelId?o?(0,s.jsx)(y.a,{justifyContent:"center",alignItems:"center",display:"flex",height:"100%",children:(0,s.jsx)(g.F,{severity:"error",title:(0,L.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:o.message})}):a?(0,s.jsx)(v.$L,{scene:a,updateUrlOnInit:!0,children:(0,s.jsx)(S,{dashboard:a,panelId:t.panelId})}):(0,s.jsx)(R.A,{}):(0,s.jsx)(C.L,{entity:"Panel"})}const T=P;function S({dashboard:t,panelId:n}){const[a,o]=A(t,n),{controls:l}=t.useState(),r=l?.useState()?.refreshPicker,c=(0,j.of)(U);return(0,i.useEffect)(()=>r?.activate(),[r]),o?(0,s.jsx)(g.F,{title:o}):a?(0,s.jsx)("div",{className:c.container,children:(0,s.jsx)(a.Component,{model:a})}):(0,s.jsxs)("span",{children:["Loading ",(0,s.jsx)(E.y,{})]})}const U=t=>({container:(0,x.css)({position:"fixed",bottom:0,right:0,margin:0,left:0,top:0,width:"100%",height:"100%"})})}}]);

//# sourceMappingURL=SoloPanelPage.f2ee031c38e34591073f.js.map