"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1034],{62033:(e,t,n)=>{n.r(t),n.d(t,{SoloPanel:()=>g,SoloPanelPage:()=>f,default:()=>m});var r,o=n(76687),s=n(30415),i=n(65677),a=n(74692),d=n(11276),l=n(99183),c=n(52010);function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const p={initDashboard:l.mV},h=(0,s.connect)((e=>({dashboard:e.dashboard.getModel()})),p);class f extends o.Component{constructor(){super(...arguments),u(this,"state",{panel:null,notFound:!1})}componentDidMount(){const{match:e,route:t}=this.props;this.props.initDashboard({urlSlug:e.params.slug,urlUid:e.params.uid,urlType:e.params.type,routeName:t.routeName,fixUrl:!1,keybindingSrv:this.context.keybindings})}getPanelId(){var e;return parseInt(null!==(e=this.props.queryParams.panelId)&&void 0!==e?e:"0",10)}componentDidUpdate(e){const{dashboard:t}=this.props;if(t&&(!e.dashboard||e.dashboard.uid!==t.uid)){const e=t.getPanelByUrlId(this.props.queryParams.panelId);if(!e)return void this.setState({notFound:!0});this.setState({panel:e})}}render(){return(0,c.jsx)(g,{dashboard:this.props.dashboard,notFound:this.state.notFound,panel:this.state.panel,panelId:this.getPanelId()})}}u(f,"contextType",a.h);const g=e=>{let{dashboard:t,notFound:n,panel:o,panelId:s}=e;return n?(0,c.jsxs)("div",{className:"alert alert-error",children:["Panel with id ",s," not found"]}):o&&t?(0,c.jsx)("div",{className:"panel-solo",children:(0,c.jsx)(i.Z,{children:e=>{let{width:n,height:r}=e;return 0===n?null:(0,c.jsx)(d.l,{stateKey:o.key,width:n,height:r,dashboard:t,panel:o,isEditing:!1,isViewing:!1,lazy:!1})}})}):r||(r=(0,c.jsx)("div",{children:"Loading & initializing dashboard"}))},m=h(f)},67880:(e,t,n)=>{n.d(t,{N:()=>p});var r=n(78755),o=n(55998),s=n(40840),i=n(72671),a=n(20202),d=n(95466),l=n(24219);const c="hideSeriesFrom",u=(0,r.Y4)(c);function p(e,t,n,r){const{overrides:o}=n,s=e,i=o.findIndex(u);if(i<0){if(t===l.R.ToggleSelection){const e=h([s,...b(o,r)]);return Object.assign({},n,{overrides:[...n.overrides,e]})}const e=h(v(r,s));return Object.assign({},n,{overrides:[...n.overrides,e]})}const a=Array.from(o),[d]=a.splice(i,1);if(t===l.R.ToggleSelection){let e=g(d);const t=b(a,r);if(t.length>0&&(e=e.filter((e=>t.indexOf(e)<0))),e[0]===s&&1===e.length)return Object.assign({},n,{overrides:a});const o=h([s,...t]);return Object.assign({},n,{overrides:[...a,o]})}const c=f(d,s);return m(c,r)?Object.assign({},n,{overrides:a}):Object.assign({},n,{overrides:[...a,c]})}function h(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Ys.exclude,r=arguments.length>2?arguments[2]:void 0;return r=null!==(t=r)&&void 0!==t?t:{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!1}},{__systemRef:c,matcher:{id:s.mi.byNames,options:{mode:n,names:e,prefix:n===o.Ys.exclude?"All except:":void 0,readOnly:!0}},properties:[Object.assign({},r,{value:{viz:!0,legend:!1,tooltip:!1}})]}}const f=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.Ys.exclude;const r=e.properties.find((e=>"custom.hideFrom"===e.id)),s=g(e),i=s.findIndex((e=>e===t));return i<0?s.push(t):s.splice(i,1),h(s,n,r)},g=e=>{var t;const n=null===(t=e.matcher.options)||void 0===t?void 0:t.names;return Array.isArray(n)?[...n]:[]},m=(e,t)=>g(e).length===v(t).length,v=(e,t)=>{const n=new Set;for(const r of e)for(const o of r.fields){if(o.type!==i.fS.number)continue;const s=(0,a.C)(o,r,e);s!==t&&n.add(s)}return Array.from(n)},b=(e,t)=>{let n=[];for(const o of e){var r;const e=o.properties.find((e=>"custom.hideFrom"===e.id));if(void 0!==e&&!0===(null===(r=e.value)||void 0===r?void 0:r.legend)){const e=d.Ls.get(o.matcher.id).get(o.matcher.options);for(const r of t)for(const o of r.fields){if(o.type!==i.fS.number)continue;const s=(0,a.C)(o,r,t);e(o,r,t)&&n.push(s)}}}return n}},34753:(e,t,n)=>{let r;n.d(t,{q:()=>r}),function(e){e.Data="data",e.Meta="meta",e.Error="error",e.Stats="stats",e.JSON="json",e.Query="query",e.Actions="actions",e.Help="help"}(r||(r={}))}}]);
//# sourceMappingURL=SoloPanelPage.ee8bf08b7c2d7b323703.js.map