"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849],{17189(g,u,t){t.d(u,{$:()=>l});var n=t(35770);function l({children:i,scene:m,updateUrlOnInit:h,createBrowserHistorySteps:S,namespace:y,excludeFromNamespace:P}){return(0,n.Y)(m,{updateUrlOnInit:h,createBrowserHistorySteps:S,namespace:y,excludeFromNamespace:P})?i:null}},54368(g,u,t){t.r(u),t.d(u,{SoloPanelPage:()=>b,SoloPanelRenderer:()=>I,default:()=>R});var n=t(74848),l=t(22803),i=t(96540),m=t(54148),h=t(92745),S=t(17189),y=t(31286),P=t(34999),v=t(63142),z=t(11098),H=t(1506),D=t(6262),A=t(78102),$=t(96691),N=t(12326),F=t(71542);function O(e){if(e==null)return!1;if(e===!0)return!0;if(e===!1)return!1;const s=(Array.isArray(e)?String(e[0]??""):String(e)).trim().toLowerCase();return s!=="false"&&s!=="0"}function U({containerRef:e,isHovered:o,hideLogo:s}){const c=O(s),[a,d]=(0,i.useState)(1),r=(0,v.of)(L),C=(0,v.$j)().isDark?F:N;return(0,i.useEffect)(()=>{const p=()=>{if(!e.current)return;const{width:x,height:M}=e.current.getBoundingClientRect(),E=Math.min(x,M),K=Math.max(.6,Math.min(1,.6+(E-200)/600)),T=Math.max(.6,Math.min(1,.6+(x-200)/800)),k=Math.min(1,(K+T)/2);d(k)};p();const f=new ResizeObserver(p);return e.current&&f.observe(e.current),()=>{f.disconnect()}},[e]),c?null:(0,n.jsxs)("div",{className:(0,l.cx)(r.logoContainer,o&&r.logoHidden),style:{fontSize:`${a*100}%`,top:`${8*a}px`,right:`${8*a}px`,padding:`${8*a}px ${8*a}px`},children:[(0,n.jsx)("span",{className:r.text,children:(0,n.jsx)(h.x6,{i18nKey:"embedded-panel.powered-by",children:"Powered by"})}),(0,n.jsx)("img",{src:C,alt:"Grafana",className:r.logo,style:{height:`${16*a}px`,marginLeft:"0.25em"}})]})}const L=e=>{const o=(0,l.css)({position:"absolute",backgroundColor:e.colors.background.primary,borderRadius:e.shape.radius.default,opacity:.9,pointerEvents:"none",zIndex:1e3,display:"flex",alignItems:"center",boxShadow:e.shadows.z3,border:`1px solid ${e.colors.border.weak}`,fontSize:e.typography.body.fontSize,lineHeight:1.2,[e.transitions.handleMotion("no-preference","reduce")]:{transition:"opacity 0.2s ease-in-out"}}),s=(0,l.css)({opacity:0}),c=(0,l.css)({color:e.colors.text.secondary,lineHeight:1.2,display:"block"}),a=(0,l.css)({display:"block",flexShrink:0});return{logoContainer:o,logoHidden:s,text:c,logo:a}};function b({queryParams:e}){const o=(0,A.sP)(),{dashboard:s,loadError:c}=o.useState(),{uid:a="",type:d,slug:r}=(0,m.g)();return(0,i.useEffect)(()=>(o.loadDashboard({uid:a,type:d,slug:r,route:D.Z4.Embedded}),()=>o.clearState()),[o,a,d,r]),e.panelId?c?(0,n.jsx)(y.a,{justifyContent:"center",alignItems:"center",display:"flex",height:"100%",children:(0,n.jsx)(P.F,{severity:"error",title:(0,h.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:c.message})}):s?(0,n.jsx)(S.$,{scene:s,updateUrlOnInit:!0,children:(0,n.jsx)(I,{dashboard:s,panelId:e.panelId,hideLogo:e.hideLogo})}):(0,n.jsx)(z.A,{}):(0,n.jsx)(H.L,{entity:"Panel"})}const R=b;function I({dashboard:e,panelId:o,hideLogo:s,children:c}){const{controls:a,body:d}=e.useState(),r=a?.useState()?.refreshPicker,j=(0,v.of)(W),C=(0,$.XF)(o),[p,f]=(0,i.useState)(!1),x=(0,i.useRef)(null);return(0,i.useEffect)(()=>{const M=e.activate(),E=r?.activate();return()=>{M(),E?.()}},[e,r]),(0,n.jsxs)("div",{ref:x,className:j.container,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[(0,n.jsx)(U,{containerRef:x,isHovered:p,hideLogo:s}),B(e),(0,n.jsx)("div",{className:j.panelWrapper,children:(0,n.jsxs)($.Ob,{value:C,dashboard:e,singleMatch:!0,children:[(0,n.jsx)(d.Component,{model:d}),c]})})]})}function B(e){if(!e.state.$variables)return null;const o=e.state.$variables.state.variables;return(0,n.jsx)(n.Fragment,{children:o.map(s=>s.UNSAFE_renderAsHidden?(0,n.jsx)(s.Component,{model:s},s.state.key):null)})}const W=e=>{const o=(0,l.css)({width:"100%",height:"100%"});return{container:(0,l.css)({position:"fixed",bottom:0,right:0,margin:0,left:0,top:0,width:"100%",height:"100%"}),panelWrapper:o}}},12326(g,u,t){g.exports=t.p+"static/img/grafana_text_logo_dark.70a1e5ee.svg"},71542(g,u,t){g.exports=t.p+"static/img/grafana_text_logo_light.467e047c.svg"}}]);

//# sourceMappingURL=SoloPanelPage.5b6898788af9af901685.js.map