"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849],{60918:(U,v,e)=>{e.r(v),e.d(v,{SoloPanelPage:()=>P,SoloPanelRenderer:()=>S,default:()=>z});var s=e(74848),x=e(22803),i=e(96540),m=e(54148),u=e(26620),y=e(90231),g=e(37e3),j=e(29675),E=e(20968),R=e(20337),C=e(22961),L=e(11817),D=e(61491),F=e(44172),M=e(93300),p=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 u.g5().initSync(t);const I=t.activate();let f=null;try{f=(0,h.vL)(t,n)}catch{}return f?(N(f),o(f)):(0,p.ag)(n)?T(t,n).then(d=>{d?o(d):r("Panel not found")}):r("Panel not found"),I},[t,n]),[a,l]}function N(t){let n=t.parent;for(;n&&!n.isActive;)n.activate(),n=n.parent}function T(t,n){return new Promise(a=>{t.subscribeToEvent(M.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,F.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:D.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)(u.$L,{scene:a,children:(0,s.jsx)(S,{dashboard:a,panelId:t.panelId})}):(0,s.jsx)(R.A,{}):(0,s.jsx)(C.L,{entity:"Panel"})}const z=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)(B);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 B=t=>({container:(0,x.css)({position:"fixed",bottom:0,right:0,margin:0,left:0,top:0,width:"100%",height:"100%"})})}}]);

//# sourceMappingURL=SoloPanelPage.4c20c56451c2e6866df9.js.map