"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7849],{56550(f,x,t){t.r(x),t.d(x,{SoloPanelPage:()=>C,SoloPanelRenderer:()=>M,default:()=>B});var n=t(74848),i=t(22803),d=t(96540),$=t(54148),P=t(52358),b=t(17189),H=t(5195),E=t(33100),v=t(49439),z=t(25021),I=t(51389),N=t(82311),A=t(46333),D=t(74352),j=t(67068),F=t(12326),L=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 R({containerRef:e,isHovered:o,hideLogo:s}){const l=O(s),[a,c]=(0,d.useState)(1),r=(0,v.of)(U),m=(0,v.$j)().isDark?L:F;return(0,d.useEffect)(()=>{const h=()=>{if(!e.current)return;const{width:g,height:S}=e.current.getBoundingClientRect(),y=Math.min(g,S),G=Math.max(.6,Math.min(1,.6+(y-200)/600)),K=Math.max(.6,Math.min(1,.6+(g-200)/800)),T=Math.min(1,(G+K)/2);c(T)};h();const u=new ResizeObserver(h);return e.current&&u.observe(e.current),()=>{u.disconnect()}},[e]),l?null:(0,n.jsxs)("div",{className:(0,i.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)(P.x6,{i18nKey:"embedded-panel.powered-by",children:"Powered by"})}),(0,n.jsx)("img",{src:m,alt:"Grafana",className:r.logo,style:{height:`${16*a}px`,marginLeft:"0.25em"}})]})}const U=e=>{const o=(0,i.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,i.css)({opacity:0}),l=(0,i.css)({color:e.colors.text.secondary,lineHeight:1.2,display:"block"}),a=(0,i.css)({display:"block",flexShrink:0});return{logoContainer:o,logoHidden:s,text:l,logo:a}};function C({queryParams:e}){const o=(0,A.sP)(),{dashboard:s,loadError:l}=o.useState(),{uid:a="",type:c,slug:r}=(0,$.g)();return(0,D.kt)(),(0,d.useEffect)(()=>(o.loadDashboard({uid:a,type:c,slug:r,route:N.Z4.Embedded}),()=>o.clearState()),[o,a,c,r]),e.panelId?l?(0,n.jsx)(H.a,{justifyContent:"center",alignItems:"center",display:"flex",height:"100%",children:(0,n.jsx)(E.F,{severity:"error",title:(0,P.t)("dashboard.errors.failed-to-load","Failed to load dashboard"),children:l.message})}):s?(0,n.jsx)(b.$,{scene:s,updateUrlOnInit:!0,children:(0,n.jsx)(M,{dashboard:s,panelId:e.panelId,hideLogo:e.hideLogo})}):(0,n.jsx)(z.A,{}):(0,n.jsx)(I.L,{entity:"Panel"})}const B=C;function M({dashboard:e,panelId:o,hideLogo:s,children:l}){const{controls:a,body:c}=e.useState(),r=a?.useState()?.refreshPicker,p=(0,v.of)(k),m=(0,j.XF)(o),[h,u]=(0,d.useState)(!1),g=(0,d.useRef)(null);return(0,d.useEffect)(()=>{const S=e.activate(),y=r?.activate();return()=>{S(),y?.()}},[e,r]),(0,n.jsxs)("div",{ref:g,className:p.container,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[(0,n.jsx)(R,{containerRef:g,isHovered:h,hideLogo:s}),W(e),(0,n.jsx)("div",{className:p.panelWrapper,children:(0,n.jsxs)(j.Ob,{value:m,dashboard:e,singleMatch:!0,children:[(0,n.jsx)(c.Component,{model:c}),l]})})]})}function W(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 k=e=>{const o=(0,i.css)({width:"100%",height:"100%"});return{container:(0,i.css)({position:"fixed",bottom:0,right:0,margin:0,left:0,top:0,width:"100%",height:"100%"}),panelWrapper:o}}},12326(f,x,t){f.exports=t.p+"static/img/grafana_text_logo_dark.70a1e5ee.svg"},71542(f,x,t){f.exports=t.p+"static/img/grafana_text_logo_light.467e047c.svg"}}]);

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