"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849],{35463(K,v,e){e.r(v),e.d(v,{SoloPanelPage:()=>S,SoloPanelRenderer:()=>x,default:()=>T});var s=e(74848),y=e(22803),i=e(96540),j=e(54148),u=e(92745),g=e(36674),m=e(31286),h=e(34999),E=e(63142),p=e(68079),C=e(11098),L=e(1506),R=e(6262),F=e(41644),M=e(39765),A=e(3371),P=e(8285);function D(t,n){const[a,o]=(0,i.useState)(),[l,r]=(0,i.useState)();return(0,i.useEffect)(()=>{new g.g5().initSync(t);const B=t.activate();let d=null;try{d=(0,P.vL)(t,n)}catch{}return d?(I(d),o(d)):(0,A.ag)(n)?N(t,n).then(f=>{f?o(f):r("Panel not found")}):r("Panel not found"),B},[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(M.d,()=>{const o=(0,P.vL)(t,n);o?a(o):t.state.body.activateRepeaters?.()}),t.state.body.activateRepeaters?.()})}function S({queryParams:t}){const n=(0,F.sP)(),{dashboard:a,loadError:o}=n.useState(),{uid:l="",type:r,slug:c}=(0,j.g)();return(0,i.useEffect)(()=>(n.loadDashboard({uid:l,type:r,slug:c,route:R.Z4.Embedded}),()=>n.clearState()),[n,t,l,r,c]),t.panelId?o?(0,s.jsx)(m.a,{justifyContent:"center",alignItems:"center",display:"flex",height:"100%",children:(0,s.jsx)(h.F,{severity:"error",title:(0,u.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:o.message})}):a?(0,s.jsx)(g.$L,{scene:a,updateUrlOnInit:!0,children:(0,s.jsx)(x,{dashboard:a,panelId:t.panelId})}):(0,s.jsx)(C.A,{}):(0,s.jsx)(L.L,{entity:"Panel"})}const T=S;function x({dashboard:t,panelId:n}){const[a,o]=D(t,n),{controls:l}=t.useState(),r=l?.useState()?.refreshPicker,c=(0,E.of)(U);return(0,i.useEffect)(()=>r?.activate(),[r]),o?(0,s.jsx)(h.F,{title:o}):a?(0,s.jsx)("div",{className:c.container,children:(0,s.jsx)(a.Component,{model:a})}):(0,s.jsxs)("span",{children:[(0,s.jsx)(u.x6,{i18nKey:"dashboard-scene.solo-panel-page.loading",children:"Loading"})," ",(0,s.jsx)(p.y,{})]})}const U=t=>({container:(0,y.css)({position:"fixed",bottom:0,right:0,margin:0,left:0,top:0,width:"100%",height:"100%"})})}}]);

//# sourceMappingURL=SoloPanelPage.52ca363ea5e6022feb11.js.map