(window.webpackJsonp=window.webpackJsonp||[]).push([[74],{"0H9l":function(e,t,s){"use strict";s("q1tI");var n=s("kDLi"),i=s("dRu9"),o=s("nKUr");function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const a=e=>{const t={transition:`opacity ${e.duration}ms linear`,opacity:0},s={exited:{opacity:0,display:"none"},entering:{opacity:0},entered:{opacity:1},exiting:{opacity:0}};return Object(o.jsx)(i.a,{in:e.in,timeout:e.duration,unmountOnExit:e.unmountOnExit||!1,onExited:e.onExited,children:n=>Object(o.jsx)("div",{style:r({},t,s[n]),children:e.children})})};var c=s("vF1F");s.d(t,"a",(function(){return l}));const l=e=>{var t;const{queryError:s}=e,i=Object(n.useTheme2)(),r=!!s,l=r?100:10,d=s?"Query error":"Unknown error",u=(null==s?void 0:s.message)||(null==s||null===(t=s.data)||void 0===t?void 0:t.message)||null,h=c.css`
    margin-top: ${i.spacing(2)};
  `;return Object(o.jsx)(a,{in:r,duration:l,children:Object(o.jsx)(n.Alert,{severity:"error",title:d,className:h,children:u})})}},"3F0C":function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));var n=s("Obii"),i=s("kDLi");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const r=Object(n.isSystemOverrideWithRef)("hideSeriesFrom");function a(e,t,s,n){const{overrides:a}=s,p=e,g=a.findIndex(r);if(g<0){if(t===i.SeriesVisibilityChangeMode.ToggleSelection){const e=c([p]);return o({},s,{overrides:[...s.overrides,e]})}const e=c(h(n,p));return o({},s,{overrides:[...s.overrides,e]})}const b=Array.from(a),[m]=b.splice(g,1);if(t===i.SeriesVisibilityChangeMode.ToggleSelection){const e=d(m);if(e[0]===p&&1===e.length)return o({},s,{overrides:b});const t=c([p]);return o({},s,{overrides:[...b,t]})}const f=l(m,p);return u(f,n)?o({},s,{overrides:b}):o({},s,{overrides:[...b,f]})}function c(e,t=n.ByNamesMatcherMode.exclude,s){var i;return s=null!==(i=s)&&void 0!==i?i:{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!1}},{__systemRef:"hideSeriesFrom",matcher:{id:n.FieldMatcherID.byNames,options:{mode:t,names:e,prefix:t===n.ByNamesMatcherMode.exclude?"All except:":void 0,readOnly:!0}},properties:[o({},s,{value:{viz:!0,legend:!1,tooltip:!1}})]}}const l=(e,t,s=n.ByNamesMatcherMode.exclude)=>{const i=e.properties.find(e=>"custom.hideFrom"===e.id),o=d(e),r=o.findIndex(e=>e===t);return r<0?o.push(t):o.splice(r,1),c(o,s,i)},d=e=>{var t;const s=null===(t=e.matcher.options)||void 0===t?void 0:t.names;return Array.isArray(s)?s:[]},u=(e,t)=>d(e).length===h(t).length,h=(e,t)=>{const s=new Set;for(const i of e)for(const o of i.fields){if(o.type!==n.FieldType.number)continue;const r=Object(n.getFieldDisplayName)(o,i,e);r!==t&&s.add(r)}return Array.from(s)}},"5BoW":function(e,t,s){"use strict";s.d(t,"a",(function(){return i}));var n=s("GQ3c");const i=e=>Boolean(e.explore[n.g.left]&&e.explore[n.g.right])},"6Pa6":function(e,t,s){"use strict";var n=s("q1tI"),i=s("w9yp"),o=s("SMGL"),r=s("kDLi"),a=s("vF1F"),c=s("Xmxp"),l=s("xAj+"),d=s("iODs"),u=s("3SGO"),h=s("UvM7"),p=s("nKUr");const g=Object(r.stylesFactory)(e=>({container:a.css`
      padding-left: ${e.spacing.sm};
      font-size: ${e.typography.size.sm};
      .space-between {
        margin-bottom: ${e.spacing.lg};
      }
    `,input:a.css`
      max-width: 200px;
    `,switch:a.css`
      display: flex;
      align-items: center;
    `,label:a.css`
      margin-left: ${e.spacing.md};
    `})),b=[{value:2,label:"2 days"},{value:5,label:"5 days"},{value:7,label:"1 week"},{value:14,label:"2 weeks"}];function m(e){const{retentionPeriod:t,starredTabAsFirstTab:s,activeDatasourceOnly:n,onChangeRetentionPeriod:i,toggleStarredTabAsFirstTab:o,toggleactiveDatasourceOnly:m,deleteRichHistory:f}=e,j=Object(r.useTheme)(),x=g(j),v=b.find(e=>e.value===t);return Object(p.jsxs)("div",{className:x.container,children:[Object(p.jsx)(r.Field,{label:"History time span",description:"Select the period of time for which Grafana will save your query history",className:"space-between",children:Object(p.jsx)("div",{className:x.input,children:Object(p.jsx)(r.Select,{menuShouldPortal:!0,value:v,options:b,onChange:i})})}),Object(p.jsx)(r.Field,{label:"Default active tab",description:" ",className:"space-between",children:Object(p.jsxs)("div",{className:x.switch,children:[Object(p.jsx)(r.Switch,{value:s,onChange:o}),Object(p.jsx)("div",{className:x.label,children:"Change the default active tab from “Query history” to “Starred”"})]})}),Object(p.jsx)(r.Field,{label:"Data source behaviour",description:" ",className:"space-between",children:Object(p.jsxs)("div",{className:x.switch,children:[Object(p.jsx)(r.Switch,{value:n,onChange:m}),Object(p.jsx)("div",{className:x.label,children:"Only show queries for data source currently active in Explore"})]})}),Object(p.jsx)("div",{className:a.css`
          font-weight: ${j.typography.weight.bold};
        `,children:"Clear query history"}),Object(p.jsx)("div",{className:a.css`
          margin-bottom: ${j.spacing.sm};
        `,children:"Delete all of your query history, permanently."}),Object(p.jsx)(r.Button,{variant:"destructive",onClick:()=>{c.b.publish(new l.ShowConfirmModalEvent({title:"Delete",text:"Are you sure you want to permanently delete your query history?",yesText:"Delete",icon:"trash-alt",onConfirm:()=>{f(),Object(d.a)(Object(u.b)(Object(h.b)("Query history deleted")))}}))},children:"Clear query history"})]})}var f,j=s("LvDl"),x=s("vGfD"),v=s("EKT6"),y=s("rYwU");const O=Object(r.stylesFactory)((e,t)=>{const s=e.isLight?e.palette.gray5:e.palette.dark4,n=t-180+"px";return{container:a.css`
      display: flex;
      .label-slider {
        font-size: ${e.typography.size.sm};
        &:last-of-type {
          margin-top: ${e.spacing.lg};
        }
        &:first-of-type {
          font-weight: ${e.typography.weight.semibold};
          margin-bottom: ${e.spacing.md};
        }
      }
    `,containerContent:a.css`
      width: calc(${"100% - 134px"});
    `,containerSlider:a.css`
      width: 129px;
      margin-right: ${e.spacing.sm};
      .slider {
        bottom: 10px;
        height: ${n};
        width: 129px;
        padding: ${e.spacing.sm} 0;
      }
    `,slider:a.css`
      position: fixed;
    `,selectors:a.css`
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
    `,filterInput:a.css`
      margin-bottom: ${e.spacing.sm};
    `,multiselect:a.css`
      width: 100%;
      margin-bottom: ${e.spacing.sm};
      .gf-form-select-box__multi-value {
        background-color: ${s};
        padding: ${e.spacing.xxs} ${e.spacing.xs} ${e.spacing.xxs} ${e.spacing.sm};
        border-radius: ${e.border.radius.sm};
      }
    `,sort:a.css`
      width: 170px;
    `,sessionName:a.css`
      display: flex;
      align-items: flex-start;
      justify-content: flex-start;
      margin-top: ${e.spacing.lg};
      h4 {
        margin: 0 10px 0 0;
      }
    `,heading:a.css`
      font-size: ${e.typography.heading.h4};
      margin: ${e.spacing.md} ${e.spacing.xxs} ${e.spacing.sm} ${e.spacing.xxs};
    `,footer:a.css`
      height: 60px;
      margin-top: ${e.spacing.lg};
      display: flex;
      justify-content: center;
      font-weight: ${e.typography.weight.light};
      font-size: ${e.typography.size.sm};
      a {
        font-weight: ${e.typography.weight.semibold};
        margin-left: ${e.spacing.xxs};
      }
    `,queries:a.css`
      font-size: ${e.typography.size.sm};
      font-weight: ${e.typography.weight.regular};
      margin-left: ${e.spacing.xs};
    `}});function w(e){const{datasourceFilters:t,onSelectDatasourceFilters:s,queries:o,onChangeSortOrder:a,sortOrder:c,activeDatasourceOnly:l,retentionPeriod:d,exploreId:u,height:h}=e,[g,b]=Object(n.useState)([0,d]),[m,w]=Object(n.useState)([]),[S,C]=Object(n.useState)(""),[T,R]=Object(n.useState)(""),k=Object(r.useTheme)(),F=O(k,h),L=Object(j.uniqBy)(o,"datasourceName").map(e=>e.datasourceName),D=Object(i.d)(L);Object(y.a)(()=>{R(S)},300,[S]),Object(n.useEffect)(()=>{w(Object(i.i)(o,c,t.map(e=>e.value),T,g))},[g,o,c,t,T]);const N=Object(i.l)(m,c);return Object(p.jsxs)("div",{className:F.container,children:[Object(p.jsx)("div",{className:F.containerSlider,children:Object(p.jsxs)("div",{className:F.slider,children:[f||(f=Object(p.jsx)("div",{className:"label-slider",children:"Filter history"})),Object(p.jsx)("div",{className:"label-slider",children:Object(i.k)(g[0])}),Object(p.jsx)("div",{className:"slider",children:Object(p.jsx)(r.RangeSlider,{tooltipAlwaysVisible:!1,min:0,max:d,value:g,orientation:"vertical",formatTooltipResult:i.k,reverse:!0,onAfterChange:b})}),Object(p.jsx)("div",{className:"label-slider",children:Object(i.k)(g[1])})]})}),Object(p.jsxs)("div",{className:F.containerContent,children:[Object(p.jsxs)("div",{className:F.selectors,children:[!l&&Object(p.jsx)("div",{"aria-label":"Filter datasources",className:F.multiselect,children:Object(p.jsx)(r.MultiSelect,{menuShouldPortal:!0,options:D,value:t,placeholder:"Filter queries for data sources(s)",onChange:s})}),Object(p.jsx)("div",{className:F.filterInput,children:Object(p.jsx)(v.a,{placeholder:"Search queries",value:S,onChange:e=>{C(e)}})}),Object(p.jsx)("div",{"aria-label":"Sort queries",className:F.sort,children:Object(p.jsx)(r.Select,{menuShouldPortal:!0,value:I.filter(e=>e.value===c),options:I,placeholder:"Sort queries by",onChange:e=>a(e.value)})})]}),Object.keys(N).map(e=>Object(p.jsxs)("div",{children:[Object(p.jsxs)("div",{className:F.heading,children:[e," ",Object(p.jsxs)("span",{className:F.queries,children:[N[e].length," queries"]})]}),N[e].map(e=>{const t=D.findIndex(t=>t.label===e.datasourceName);return Object(p.jsx)(x.a,{query:e,exploreId:u,dsImg:D[t].imgUrl,isRemoved:D[t].isRemoved},e.ts)})]},e)),Object(p.jsx)("div",{className:F.footer,children:"The history is local to your browser and is not shared with others."})]})]})}const S=Object(r.stylesFactory)(e=>{const t=e.isLight?e.palette.gray5:e.palette.dark4;return{container:a.css`
      display: flex;
    `,containerContent:a.css`
      width: 100%;
    `,selectors:a.css`
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
    `,multiselect:a.css`
      width: 100%;
      margin-bottom: ${e.spacing.sm};
      .gf-form-select-box__multi-value {
        background-color: ${t};
        padding: ${e.spacing.xxs} ${e.spacing.xs} ${e.spacing.xxs} ${e.spacing.sm};
        border-radius: ${e.border.radius.sm};
      }
    `,filterInput:a.css`
      margin-bottom: ${e.spacing.sm};
    `,sort:a.css`
      width: 170px;
    `,footer:a.css`
      height: 60px;
      margin-top: ${e.spacing.lg};
      display: flex;
      justify-content: center;
      font-weight: ${e.typography.weight.light};
      font-size: ${e.typography.size.sm};
      a {
        font-weight: ${e.typography.weight.semibold};
        margin-left: ${e.spacing.xxs};
      }
    `}});function C(e){const{datasourceFilters:t,onSelectDatasourceFilters:s,queries:o,onChangeSortOrder:a,sortOrder:c,activeDatasourceOnly:l,exploreId:d}=e,[u,h]=Object(n.useState)([]),[g,b]=Object(n.useState)(""),[m,f]=Object(n.useState)(""),O=Object(r.useTheme)(),w=S(O),C=Object(j.uniqBy)(o,"datasourceName").map(e=>e.datasourceName),T=Object(i.d)(C);return Object(y.a)(()=>{f(g)},300,[g]),Object(n.useEffect)(()=>{const e=o.filter(e=>!0===e.starred);h(Object(i.i)(e,c,t.map(e=>e.value),m))},[o,c,t,m]),Object(p.jsx)("div",{className:w.container,children:Object(p.jsxs)("div",{className:w.containerContent,children:[Object(p.jsxs)("div",{className:w.selectors,children:[!l&&Object(p.jsx)("div",{"aria-label":"Filter datasources",className:w.multiselect,children:Object(p.jsx)(r.MultiSelect,{menuShouldPortal:!0,options:T,value:t,placeholder:"Filter queries for specific data sources(s)",onChange:s})}),Object(p.jsx)("div",{className:w.filterInput,children:Object(p.jsx)(v.a,{placeholder:"Search queries",value:g,onChange:e=>{b(e)}})}),Object(p.jsx)("div",{"aria-label":"Sort queries",className:w.sort,children:Object(p.jsx)(r.Select,{menuShouldPortal:!0,options:I,value:I.filter(e=>e.value===c),placeholder:"Sort queries by",onChange:e=>a(e.value)})})]}),u.map(e=>{const t=T.findIndex(t=>t.label===e.datasourceName);return Object(p.jsx)(x.a,{query:e,exploreId:d,dsImg:T[t].imgUrl,isRemoved:T[t].isRemoved},e.ts)}),Object(p.jsx)("div",{className:w.footer,children:"The history is local to your browser and is not shared with others."})]})})}function T(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}let R;s.d(t,"b",(function(){return R})),s.d(t,"c",(function(){return I})),s.d(t,"a",(function(){return F})),function(e){e.RichHistory="Query history",e.Starred="Starred",e.Settings="Settings"}(R||(R={}));const I=[{label:"Newest first",value:i.b.Descending},{label:"Oldest first",value:i.b.Ascending},{label:"Data source A-Z",value:i.b.DatasourceAZ},{label:"Data source Z-A",value:i.b.DatasourceZA}];class k extends n.PureComponent{constructor(e){super(e),T(this,"onChangeRetentionPeriod",e=>{this.setState({retentionPeriod:e.value}),o.a.set(i.a.retentionPeriod,e.value)}),T(this,"toggleStarredTabAsFirstTab",()=>{const e=!this.state.starredTabAsFirstTab;this.setState({starredTabAsFirstTab:e}),o.a.set(i.a.starredTabAsFirstTab,e)}),T(this,"toggleActiveDatasourceOnly",()=>{const e=!this.state.activeDatasourceOnly;this.setState({activeDatasourceOnly:e}),o.a.set(i.a.activeDatasourceOnly,e)}),T(this,"onSelectDatasourceFilters",e=>{try{o.a.setObject(i.a.datasourceFilters,e)}catch(e){console.error(e)}this.setState({datasourceFilters:e})}),T(this,"onChangeSortOrder",e=>this.setState({sortOrder:e})),this.state={sortOrder:i.b.Descending,datasourceFilters:o.a.getObject(i.a.datasourceFilters,[]),retentionPeriod:o.a.getObject(i.a.retentionPeriod,7),starredTabAsFirstTab:o.a.getBool(i.a.starredTabAsFirstTab,!1),activeDatasourceOnly:o.a.getBool(i.a.activeDatasourceOnly,!0)}}updateFilters(){this.state.activeDatasourceOnly&&this.props.activeDatasourceInstance?this.onSelectDatasourceFilters([{label:this.props.activeDatasourceInstance,value:this.props.activeDatasourceInstance}]):this.onSelectDatasourceFilters(this.state.datasourceFilters)}componentDidMount(){this.updateFilters()}componentDidUpdate(e,t){this.props.activeDatasourceInstance===e.activeDatasourceInstance&&this.state.activeDatasourceOnly===t.activeDatasourceOnly||this.updateFilters()}render(){const{datasourceFilters:e,sortOrder:t,activeDatasourceOnly:s,retentionPeriod:n}=this.state,{richHistory:i,height:o,exploreId:a,deleteRichHistory:c,onClose:l,firstTab:d}=this.props;let u=[{label:"Query history",value:R.RichHistory,content:Object(p.jsx)(w,{queries:i,sortOrder:t,datasourceFilters:e,activeDatasourceOnly:s,retentionPeriod:n,onChangeSortOrder:this.onChangeSortOrder,onSelectDatasourceFilters:this.onSelectDatasourceFilters,exploreId:a,height:o}),icon:"history"},{label:"Starred",value:R.Starred,content:Object(p.jsx)(C,{queries:i,sortOrder:t,datasourceFilters:e,activeDatasourceOnly:s,onChangeSortOrder:this.onChangeSortOrder,onSelectDatasourceFilters:this.onSelectDatasourceFilters,exploreId:a}),icon:"star"},{label:"Settings",value:R.Settings,content:Object(p.jsx)(m,{retentionPeriod:this.state.retentionPeriod,starredTabAsFirstTab:this.state.starredTabAsFirstTab,activeDatasourceOnly:this.state.activeDatasourceOnly,onChangeRetentionPeriod:this.onChangeRetentionPeriod,toggleStarredTabAsFirstTab:this.toggleStarredTabAsFirstTab,toggleactiveDatasourceOnly:this.toggleActiveDatasourceOnly,deleteRichHistory:c}),icon:"sliders-v-alt"}];return Object(p.jsx)(r.TabbedContainer,{tabs:u,onClose:l,defaultTab:d,closeIconTooltip:"Close query history"})}}const F=Object(r.withTheme)(k)},"6dfA":function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var n=s("kDLi"),i=s("vF1F"),o=s("q1tI"),r=s("nKUr");const a=Object(n.stylesFactory)(e=>({infoBox:i.css`
    margin-top: ${e.spacing.xs};
  `})),c=({children:e})=>{const[t,s]=Object(o.useState)(!1),c=Object(n.useTheme)(),l=a(c);return Object(r.jsxs)(r.Fragment,{children:[Object(r.jsxs)("button",{className:"gf-form-label query-keyword pointer",onClick:e=>s(!t),children:["Help",Object(r.jsx)(n.Icon,{name:t?"angle-down":"angle-right"})]}),t&&Object(r.jsx)(n.InfoBox,{className:Object(i.cx)(l.infoBox),children:e})]})}},"75pU":function(e,t){function s(e,t,s,n){var i,o=null==(i=n)||"number"==typeof i||"boolean"==typeof i?n:s(n),r=t.get(o);return void 0===r&&(r=e.call(this,n),t.set(o,r)),r}function n(e,t,s){var n=Array.prototype.slice.call(arguments,3),i=s(n),o=t.get(i);return void 0===o&&(o=e.apply(this,n),t.set(i,o)),o}function i(e,t,s,n,i){return s.bind(t,e,n,i)}function o(e,t){return i(e,this,1===e.length?s:n,t.cache.create(),t.serializer)}function r(){return JSON.stringify(arguments)}function a(){this.cache=Object.create(null)}a.prototype.has=function(e){return e in this.cache},a.prototype.get=function(e){return this.cache[e]},a.prototype.set=function(e,t){this.cache[e]=t};var c={create:function(){return new a}};e.exports=function(e,t){var s=t&&t.cache?t.cache:c,n=t&&t.serializer?t.serializer:r;return(t&&t.strategy?t.strategy:o)(e,{cache:s,serializer:n})},e.exports.strategies={variadic:function(e,t){return i(e,this,n,t.cache.create(),t.serializer)},monadic:function(e,t){return i(e,this,s,t.cache.create(),t.serializer)}}},"8Vg1":function(e,t,s){"use strict";s("q1tI");var n,i=s("/MKj"),o=s("kDLi"),r=s("Obii"),a=s("PbtU"),c=s("ZFWI"),l=s("p+Sq"),d=s("KyLG"),u=s("5BoW"),h=s("t8hP"),p=s("umNM"),g=s("nKUr");const b={setDashboardQueriesToUpdateOnLoad:d.m},m=Object(i.connect)((function(e,{exploreId:t}){const s=e.explore,n=Object(u.a)(e),{datasourceInstance:i,queries:o,originPanelId:r}=s[t],a=["Editor","Admin"];return c.b.viewersCanEdit&&a.push("Viewer"),{exploreId:t,datasourceInstance:i,queries:o,originPanelId:r,splitted:n,canEdit:a.some(e=>p.a.hasRole(e))}}),b);t.a=m(({originPanelId:e,setDashboardQueriesToUpdateOnLoad:t,queries:s,splitted:i,canEdit:c})=>{const d=e&&Number.isInteger(e);if(i||!d)return null;const u=e=>e.map(e=>(delete e.context,delete e.key,e)),p=async({withChanges:n=!1}={})=>{const i=Object(l.a)().getCurrent();if(!i)return;const o=a.a.slugifyForUrl(i.title);n&&t({panelId:e,queries:u(s)});const c={};n||i.panelInEdit?c.editPanel=e:i.panelInView&&(c.viewPanel=e),h.locationService.push(r.urlUtil.renderUrl(`/d/${i.uid}/:${o}`,c))};return Object(g.jsxs)(o.ButtonGroup,{children:[Object(g.jsx)(o.Tooltip,{content:"Return to panel",placement:"bottom",children:Object(g.jsx)(o.ToolbarButton,{"data-testid":"returnButton",title:"Return to panel",onClick:()=>p(),children:n||(n=Object(g.jsx)(o.Icon,{name:"arrow-left"}))})}),c&&Object(g.jsx)(o.ButtonSelect,{"data-testid":"returnButtonWithChanges",options:[{label:"Return to panel with changes",value:""}],onChange:()=>p({withChanges:!0})})]})})},"9BUi":function(e,t,s){"use strict";(function(e){var n=s("q1tI"),i=s("LvDl"),o=s("0cfB"),r=s("/MKj"),a=s("y2tl"),c=s("kYjj"),l=s("Obii"),d=s("Csm0"),u=s("CJUB"),h=s("0H9l"),p=s("VVW4"),g=s("6dfA"),b=s("nKUr");function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}function f(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const j=()=>{};class x extends n.PureComponent{constructor(...e){super(...e),f(this,"state",{textEditModeEnabled:!1}),f(this,"onRunQuery",()=>{const{exploreId:e}=this.props;this.props.runQueries(e)}),f(this,"onChange",(e,t)=>{const{datasourceInstance:s,exploreId:n,index:i}=this.props;this.props.changeQuery(n,e,i,t),e&&!t&&null!=s&&s.getHighlighterExpression&&0===i&&this.updateLogsHighlights(e)}),f(this,"onClickToggleDisabled",()=>{const{exploreId:e,index:t,query:s}=this.props,n=m({},s,{hide:!s.hide});this.props.changeQuery(e,n,t,!0)}),f(this,"onClickRemoveButton",()=>{const{exploreId:e,index:t}=this.props;this.props.removeQueryRowAction({exploreId:e,index:t}),this.props.runQueries(e)}),f(this,"onClickToggleEditorMode",()=>{this.setState({textEditModeEnabled:!this.state.textEditModeEnabled})}),f(this,"setReactQueryEditor",e=>{var t,s,n;let i;if(null!==(t=e.components)&&void 0!==t&&t.ExploreMetricsQueryField)i=e.components.ExploreMetricsQueryField;else if(null!==(s=e.components)&&void 0!==s&&s.ExploreLogsQueryField)i=e.components.ExploreLogsQueryField;else if(null!==(n=e.components)&&void 0!==n&&n.ExploreQueryField)i=e.components.ExploreQueryField;else{var o;i=null===(o=e.components)||void 0===o?void 0:o.QueryEditor}return i}),f(this,"renderQueryEditor",e=>{var t;const{history:s,query:n,exploreEvents:i,range:o,queryResponse:r,exploreId:c}=this.props,l=r.error&&r.error.refId===n.refId?[r.error]:[],d=this.setReactQueryEditor(e);let u;u=d?Object(b.jsx)(d,{datasource:e,query:n,history:s,onRunQuery:this.onRunQuery,onBlur:j,onChange:this.onChange,data:r,range:o,exploreId:c}):Object(b.jsx)(a.a,{error:l,datasource:e,onQueryChange:this.onChange,onExecuteQuery:this.onRunQuery,initialQuery:n,exploreEvents:i,range:o,textEditModeEnabled:this.state.textEditModeEnabled});const h=null===(t=e.components)||void 0===t?void 0:t.QueryEditorHelp;return Object(b.jsxs)(b.Fragment,{children:[u,h&&Object(b.jsx)(g.a,{children:Object(b.jsx)(h,{onClickExample:e=>this.onChange(e),datasource:e})})]})}),f(this,"updateLogsHighlights",Object(i.debounce)(e=>{const{datasourceInstance:t}=this.props;if(null!=t&&t.getHighlighterExpression){const{exploreId:s}=this.props,n=t.getHighlighterExpression(e);this.props.highlightLogsExpressionAction({exploreId:s,expressions:n})}},500))}render(){const{datasourceInstance:e,query:t,queryResponse:s,latency:n}=this.props;if(!e)return Object(b.jsx)(b.Fragment,{children:"Loading data source"});const o=Object(i.has)(e,"components.QueryCtrl.prototype.toggleEditorMode"),r=s.state===l.LoadingState.NotStarted,a=s.error&&s.error.refId===t.refId?[s.error]:[];return Object(b.jsxs)(b.Fragment,{children:[Object(b.jsxs)("div",{className:"query-row","aria-label":d.a.components.QueryEditorRows.rows,children:[Object(b.jsx)("div",{className:"query-row-field flex-shrink-1",children:this.renderQueryEditor(e)}),Object(b.jsx)(c.a,{canToggleEditorModes:o,isDisabled:t.hide,isNotStarted:r,latency:n,onClickToggleEditorMode:this.onClickToggleEditorMode,onClickToggleDisabled:this.onClickToggleDisabled,onClickRemoveButton:this.onClickRemoveButton})]}),a.length>0&&Object(b.jsx)(h.a,{queryError:a[0]})]})}}const v={changeQuery:p.d,highlightLogsExpressionAction:u.b,modifyQueries:p.h,removeQueryRowAction:p.j,runQueries:p.k},y=Object(r.connect)((function(e,{exploreId:t,index:s}){const n=e.explore[t],{datasourceInstance:i,history:o,queries:r,range:a,absoluteRange:c,queryResponse:l,latency:d,eventBridge:u}=n;return{datasourceInstance:i,history:o,query:r[s],range:a,absoluteRange:c,queryResponse:l,latency:d,exploreEvents:u}}),v);t.a=Object(o.hot)(e)(y(x))}).call(this,s("3UD+")(e))},Bdd1:function(e,t,s){"use strict";var n=s("q1tI"),i=s.n(n),o=s("vF1F"),r=s("Zss7"),a=s.n(r),c=s("kDLi"),l=s("Obii"),d=function(e,t){var s=Object(n.useRef)((function(){}));Object(n.useEffect)((function(){s.current=e})),Object(n.useEffect)((function(){if(null!==t){var e=setInterval((function(){return s.current()}),t||0);return function(){return clearInterval(e)}}}),[t])},u=s("nKUr");const h=({timeInMs:e,className:t,humanize:s})=>Object(u.jsx)("span",{className:"elapsed-time "+t,children:p(e,s)}),p=(e,t=!1)=>{const s=e/1e3;if(!t)return s.toFixed(1)+"s";const n=Object(l.toDuration)(s,"seconds"),i=n.hours(),o=n.minutes(),r=n.seconds();return i?`${i}h ${o}m ${r}s`:o?`${o}m ${r}s`:r+"s"},g=({resetKey:e,humanize:t,className:s})=>{const[i,o]=Object(n.useState)(0);return d(()=>o(i+150),150),Object(n.useEffect)(()=>o(0),[e]),Object(u.jsx)(h,{timeInMs:i,className:s,humanize:t})};var b;function m(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s.d(t,"a",(function(){return j}));class f extends n.PureComponent{constructor(e){super(e),m(this,"liveEndDiv",null),m(this,"scrollContainerRef",i.a.createRef()),m(this,"onScroll",e=>{const{isPaused:t,onPause:s}=this.props,{scrollTop:n,clientHeight:i,scrollHeight:o}=e.currentTarget;o-(n+i)>=5&&!t&&s()}),m(this,"rowsToRender",()=>{const{isPaused:e}=this.props;let{logRowsToRender:t=[]}=this.state;return e||(t=t.slice(-100)),t}),this.state={logRowsToRender:e.logRows}}static getDerivedStateFromProps(e,t){return e.isPaused?null:{logRowsToRender:e.logRows}}render(){const{theme:e,timeZone:t,onPause:s,onResume:n,isPaused:i}=this.props,r=(e=>({logsRowsLive:o.css`
    label: logs-rows-live;
    font-family: ${e.typography.fontFamily.monospace};
    font-size: ${e.typography.size.sm};
    display: flex;
    flex-flow: column nowrap;
    height: 60vh;
    overflow-y: scroll;
    :first-child {
      margin-top: auto !important;
    }
  `,logsRowFade:o.css`
    label: logs-row-fresh;
    color: ${e.colors.text};
    background-color: ${a()(e.palette.blue95).setAlpha(.25).toString()};
    animation: fade 1s ease-out 1s 1 normal forwards;
    @keyframes fade {
      from {
        background-color: ${a()(e.palette.blue95).setAlpha(.25).toString()};
      }
      to {
        background-color: transparent;
      }
    }
  `,logsRowsIndicator:o.css`
    font-size: ${e.typography.size.md};
    padding-top: ${e.spacing.sm};
    display: flex;
    align-items: center;
  `,button:o.css`
    margin-right: ${e.spacing.sm};
  `,fullWidth:o.css`
    width: 100%;
  `}))(e),{logsRow:d,logsRowLocalTime:h,logsRowMessage:p}=Object(c.getLogRowStyles)(e);return Object(u.jsxs)("div",{children:[Object(u.jsx)("table",{className:r.fullWidth,children:Object(u.jsxs)("tbody",{onScroll:i?void 0:this.onScroll,className:Object(o.cx)(["logs-rows",r.logsRowsLive]),ref:this.scrollContainerRef,children:[this.rowsToRender().map(e=>Object(u.jsxs)("tr",{className:Object(o.cx)(d,r.logsRowFade),children:[Object(u.jsx)("td",{className:Object(o.cx)(h),children:Object(l.dateTimeFormat)(e.timeEpochMs,{timeZone:t})}),Object(u.jsx)("td",{className:Object(o.cx)(p),children:e.hasAnsi?Object(u.jsx)(c.LogMessageAnsi,{value:e.raw}):e.entry})]},e.uid)),Object(u.jsx)("tr",{ref:e=>{var t;(this.liveEndDiv=e,this.liveEndDiv&&!i)&&(null===(t=this.scrollContainerRef.current)||void 0===t||t.scrollTo(0,this.scrollContainerRef.current.scrollHeight))}})]})}),Object(u.jsxs)("div",{className:r.logsRowsIndicator,children:[Object(u.jsxs)(c.Button,{variant:"secondary",onClick:i?n:s,className:r.button,children:[Object(u.jsx)(c.Icon,{name:i?"play":"pause"})," ",i?"Resume":"Pause"]}),Object(u.jsxs)(c.Button,{variant:"secondary",onClick:this.props.stopLive,className:r.button,children:[b||(b=Object(u.jsx)(c.Icon,{name:"square-shape",size:"lg",type:"mono"})),"  Exit live mode"]}),i||Object(u.jsxs)("span",{children:["Last line received: ",Object(u.jsx)(g,{resetKey:this.props.logRows,humanize:!0})," ago"]})]})]})}}const j=Object(c.withTheme)(f)},JW4h:function(e,t,s){"use strict";(function(e){var n=s("q1tI"),i=s("/MKj"),o=s("0cfB"),r=s("SMGL"),a=s("w9yp"),c=s("6Pa6"),l=s("7oGG"),d=s("x7/r"),u=s("nKUr");const h={deleteRichHistory:l.a};t.a=Object(o.hot)(e)(Object(i.connect)((function(e,{exploreId:t}){const s=e.explore,n=s[t],{datasourceInstance:i}=n,o=r.a.getBool(a.a.starredTabAsFirstTab,!1)?c.b.Starred:c.b.RichHistory,{richHistory:l}=s;return{richHistory:l,firstTab:o,activeDatasourceInstance:null==i?void 0:i.name}}),h)((function(e){const[t,s]=Object(n.useState)(400),{richHistory:i,width:o,firstTab:r,activeDatasourceInstance:a,exploreId:l,deleteRichHistory:h,onClose:p}=e;return Object(u.jsx)(d.a,{width:o,onResize:(e,t,n)=>{s(Number(n.style.height.slice(0,-2)))},children:Object(u.jsx)(c.a,{richHistory:i,firstTab:r,activeDatasourceInstance:a,exploreId:l,deleteRichHistory:h,onClose:p,height:t})})})))}).call(this,s("3UD+")(e))},Mmix:function(e,t,s){"use strict";(function(e){s("q1tI");var n=s("kDLi"),i=s("VVW4"),o=s("0cfB"),r=s("/MKj"),a=s("x7/r"),c=s("HgkN"),l=s("LInY"),d=s("SVrL"),u=s("6PW0"),h=s("qGIo"),p=s("nKUr");const g={runQueries:i.k},b=Object(r.connect)((function(e,{exploreId:t}){const s=e.explore[t],{loading:n,queryResponse:i}=s;return{loading:n,queryResponse:i}}),g);t.a=Object(o.hot)(e)(b((function(e){var t;const{loading:s,width:i,onClose:o,queryResponse:r}=e,g=(null==r?void 0:r.series)||[],b=null==r?void 0:r.error,m={label:"Stats",value:"stats",icon:"chart-line",content:Object(p.jsx)(d.a,{data:r,timeZone:null==r||null===(t=r.request)||void 0===t?void 0:t.timezone})},f={label:"JSON",value:"json",icon:"brackets-curly",content:Object(p.jsx)(c.a,{data:r,onClose:o})},j={label:"Data",value:"data",icon:"database",content:Object(p.jsx)(u.a,{data:g,isLoading:s,options:{withTransforms:!1,withFieldConfig:!1}})},x=[m,{label:"Query",value:"query",icon:"info-circle",content:Object(p.jsx)(l.a,{data:g,onRefreshQuery:()=>e.runQueries(e.exploreId)})},f,j];if(b){const e={label:"Error",value:"error",icon:"exclamation-triangle",content:Object(p.jsx)(h.a,{error:b})};x.push(e)}return Object(p.jsx)(a.a,{width:i,onResize:()=>{},children:Object(p.jsx)(n.TabbedContainer,{tabs:x,onClose:o,closeIconTooltip:"Close query inspector"})})})))}).call(this,s("3UD+")(e))},Nxm2:function(e,t,s){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(e,t)},function(e,t){function s(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var i in t=arguments[s])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var a=r(s("q1tI")),c={top:{width:"100%",height:"10px",top:"-5px",left:"0px",cursor:"row-resize"},right:{width:"10px",height:"100%",top:"0px",right:"-5px",cursor:"col-resize"},bottom:{width:"100%",height:"10px",bottom:"-5px",left:"0px",cursor:"row-resize"},left:{width:"10px",height:"100%",top:"0px",left:"-5px",cursor:"col-resize"},topRight:{width:"20px",height:"20px",position:"absolute",right:"-10px",top:"-10px",cursor:"ne-resize"},bottomRight:{width:"20px",height:"20px",position:"absolute",right:"-10px",bottom:"-10px",cursor:"se-resize"},bottomLeft:{width:"20px",height:"20px",position:"absolute",left:"-10px",bottom:"-10px",cursor:"sw-resize"},topLeft:{width:"20px",height:"20px",position:"absolute",left:"-10px",top:"-10px",cursor:"nw-resize"}},l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseDown=function(e){t.props.onResizeStart(e,t.props.direction)},t.onTouchStart=function(e){t.props.onResizeStart(e,t.props.direction)},t}return i(t,e),t.prototype.render=function(){return a.createElement("div",{className:this.props.className||"",style:o(o({position:"absolute",userSelect:"none"},c[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(a.PureComponent);t.Resizer=l},OxIB:function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var n=s("q1tI"),i=s("/MKj"),o=s("kDLi"),r=s("vExC"),a=s("VVW4");function c(e){const t=function(e){const t=Object(i.useDispatch)(),s=Object(n.useCallback)(()=>{t(Object(a.n)({exploreId:e,isPaused:!0}))},[e,t]),c=Object(n.useCallback)(()=>{t(Object(a.n)({exploreId:e,isPaused:!1}))},[e,t]),l=Object(n.useCallback)(()=>{s(),t(Object(r.a)(e,o.RefreshPicker.offOption.value)),t(Object(a.k)(e))},[e,t,s]),d=Object(n.useCallback)(()=>{t(Object(r.a)(e,o.RefreshPicker.liveOption.value))},[e,t]);return{pause:s,resume:c,stop:l,start:d}}(e.exploreId);return e.children(t)}},QX5N:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));s("q1tI");var n=s("/MKj"),i=s("Obii"),o=s("0H9l"),r=s("nKUr");function a(e){const t=Object(n.useSelector)(t=>{var s;return null===(s=t.explore[e.exploreId])||void 0===s?void 0:s.queryResponse}),s=(null==t?void 0:t.state)===i.LoadingState.Error&&null!=t&&t.error&&!t.error.refId?t.error:void 0;return Object(r.jsx)(o.a,{queryError:s})}},TUgz:function(e,t,s){"use strict";s.d(t,"a",(function(){return l}));s("q1tI");var n,i,o,r=s("vF1F"),a=s("kDLi"),c=s("nKUr");const l=()=>{const e=Object(a.useTheme)(),t=Object(c.jsxs)(c.Fragment,{children:[n||(n=Object(c.jsx)(a.Icon,{name:"rocket"})),Object(c.jsx)(c.Fragment,{children:" ProTip: You can also define data sources through configuration files. "}),i||(i=Object(c.jsx)("a",{href:"http://docs.grafana.org/administration/provisioning/#datasources?utm_source=explore",target:"_blank",rel:"noreferrer",className:"text-link",children:"Learn more"}))]}),s=o||(o=Object(c.jsx)(a.LinkButton,{size:"lg",href:"datasources/new",icon:"database",children:"Add data source"})),l=r.css`
    max-width: ${e.breakpoints.lg};
    margin-top: ${e.spacing.md};
    align-self: center;
  `;return Object(c.jsx)(a.CallToActionCard,{callToActionElement:s,className:l,footer:t,message:"Explore requires at least one data source. Once you have added a data source, you can query it here."})}},UpVK:function(e,t,s){"use strict";var n,i=s("q1tI"),o=s.n(i),r=s("kDLi"),a=s("Obii"),c=s("QNYp"),l=s("WnbS"),d=s("1LJY"),u=s("/MKj"),h=s("t8hP"),p=s("nKUr");const g=["cluster","hostname","namespace","pod"];function b(e,t){const s=null!=t&&t.length?t:g;return`{${[...e.process.tags,...e.tags].reduce((e,t)=>(s.includes(t.key)&&e.push(`${t.key}="${t.value}"`),e),[]).join(", ")}}`}function m(e,t){const s=null!=t&&t.spanStartTimeShift?Math.floor(e.startTime/1e3+a.rangeUtil.intervalToMs(t.spanStartTimeShift)):Math.floor(e.startTime/1e3),n=Object(a.dateTime)(s),i=(e.startTime+e.duration)/1e3;let o=null!=t&&t.spanEndTimeShift?Math.floor(i+a.rangeUtil.intervalToMs(t.spanEndTimeShift)):Math.floor(i);s===o&&o++;const r=Object(a.dateTime)(o);return{from:n,to:r,raw:{from:n,to:r}}}var f=s("TSYQ"),j=s.n(f),x=s("vF1F");function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const y={Popover({children:e,content:t,overlayClassName:s}){const n=Object(i.useRef)(null);return Object(p.jsx)(r.PopoverController,{content:t,hideAfter:300,children:(t,i,a)=>Object(p.jsxs)(p.Fragment,{children:[n.current&&Object(p.jsx)(r.Popover,v({},a,{referenceElement:n.current,wrapperClassName:s,onMouseLeave:i,onMouseEnter:t})),o.a.cloneElement(e,{ref:n,onMouseEnter:t,onMouseLeave:i})]})})},Tooltip:({children:e,title:t})=>Object(p.jsx)(r.Tooltip,{content:t,children:e}),Icon:()=>null,Dropdown:()=>null,Menu:()=>null,MenuItem:()=>null,Button:({onClick:e,children:t,className:s})=>Object(p.jsx)(r.Button,{variant:"secondary",onClick:e,className:s,children:t}),Divider:function({className:e}){const t=O(Object(r.useTheme)());return Object(p.jsx)("div",{style:{},className:j()(t.Divider,e)})},Input:e=>Object(p.jsx)(r.Input,v({},e)),InputGroup:({children:e,className:t,style:s})=>Object(p.jsx)("span",{className:t,style:s,children:e})},O=Object(r.stylesFactory)(e=>({Divider:x.css`
      display: inline-block;
      background: ${e.isDark?"#242424":"#e8e8e8"};
      width: 1px;
      height: 0.9em;
      margin: 0 8px;
      vertical-align: middle;
    `}));function w(e,t){return e.filter(e=>e.hasChildren).length===t.size}function S(e,t,s){return n=>{const i=t.get(n);if(!i)return;let o;o="tags"===e?i.toggleTags():"process"===e?i.toggleProcess():"warnings"===e?i.toggleWarnings():"references"===e?i.toggleReferences():"stackTraces"===e?i.toggleStackTraces():i.toggleLogs();const r=new Map(t);r.set(n,o),s(r)}}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}function T(){return(T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}function R(){return{}}function I(e){var t,s,o;const{expandOne:g,collapseOne:f,childrenToggle:j,collapseAll:x,childrenHiddenIDs:v,expandAll:O}=function(){const[e,t]=Object(i.useState)(new Set),s=Object(i.useCallback)((function(s){if(0===e.size)return;let n=-1,i=!0;const o=s.reduce((e,t)=>(t.depth<=n&&(i=!0),i&&e.has(t.spanID)&&(e.delete(t.spanID),i=!1,n=t.depth),e),new Set(e));t(o)}),[e]),n=Object(i.useCallback)((function(s){if(w(s,e))return;let n;const i=s.reduce((e,t)=>(n&&t.depth<=n.depth?(e.add(n.spanID),t.hasChildren&&(n=t)):t.hasChildren&&!e.has(t.spanID)&&(n=t),e),new Set(e));n&&i.add(n.spanID),t(i)}),[e]),o=Object(i.useCallback)((function(){t(new Set)}),[]),r=Object(i.useCallback)((function(s){if(w(s,e))return;const n=s.reduce((e,t)=>(t.hasChildren&&e.add(t.spanID),e),new Set);t(n)}),[e]),a=Object(i.useCallback)((function(s){const n=new Set(e);e.has(s)?n.delete(s):n.add(s),t(n)}),[e]);return{childrenHiddenIDs:e,expandOne:s,collapseOne:n,expandAll:o,collapseAll:r,childrenToggle:a}}(),{detailStates:I,toggleDetail:k,detailLogItemToggle:F,detailLogsToggle:L,detailProcessToggle:D,detailReferencesToggle:N,detailTagsToggle:E,detailWarningsToggle:z,detailStackTracesToggle:M}=function(){const[e,t]=Object(i.useState)(new Map),s=Object(i.useCallback)((function(s){const n=new Map(e);n.has(s)?n.delete(s):n.set(s,new c.a),t(n)}),[e]),n=Object(i.useCallback)((function(s,n){const i=e.get(s);if(!i)return;const o=i.toggleLogItem(n),r=new Map(e);return r.set(s,o),t(r)}),[e]);return{detailStates:e,toggleDetail:s,detailLogItemToggle:n,detailLogsToggle:Object(i.useCallback)(s=>S("logs",e,t)(s),[e]),detailWarningsToggle:Object(i.useCallback)(s=>S("warnings",e,t)(s),[e]),detailStackTracesToggle:Object(i.useCallback)(s=>S("stackTraces",e,t)(s),[e]),detailReferencesToggle:Object(i.useCallback)(s=>S("references",e,t)(s),[e]),detailProcessToggle:Object(i.useCallback)(s=>S("process",e,t)(s),[e]),detailTagsToggle:Object(i.useCallback)(s=>S("tags",e,t)(s),[e])}}(),{removeHoverIndentGuideId:B,addHoverIndentGuideId:$,hoverIndentGuideIds:q}=function(){const[e,t]=Object(i.useState)(new Set);return{hoverIndentGuideIds:e,addHoverIndentGuideId:Object(i.useCallback)((function(e){t(t=>{const s=new Set(t);return s.add(e),s})}),[]),removeHoverIndentGuideId:Object(i.useCallback)((function(e){t(t=>{const s=new Set(t);return s.delete(e),s})}),[])}}(),{viewRange:P,updateViewRangeTime:A,updateNextViewRangeTime:Q}=function(){const[e,t]=Object(i.useState)({time:{current:[0,1]}}),s=Object(i.useCallback)((function(e){t(t=>{const s=C({},t.time,e);return C({},t,{time:s})})}),[]);return{viewRange:e,updateViewRangeTime:Object(i.useCallback)((function(e,s){const n={current:[e,s]};t(e=>C({},e,{time:n}))}),[]),updateNextViewRangeTime:s}}(),[H,U]=Object(i.useState)(.25),[W,_]=Object(i.useState)(!1),K=Object(i.useMemo)(()=>function(e){const t=e[0];if(!t)return null;let s=1===t.fields.length?t.fields[0].values.get(0):function(e){const t=new a.DataFrameView(e),s={};for(let e=0;e<t.length;e++){const n=t.get(e);s[n.serviceName]||(s[n.serviceName]={serviceName:n.serviceName,tags:n.serviceTags})}return{traceID:t.get(0).traceID,processes:s,spans:t.toArray().map(e=>{var t;return T({},e,{duration:1e3*e.duration,startTime:1e3*e.startTime,processID:e.serviceName,flags:0,references:e.parentSpanID?[{refType:"CHILD_OF",spanID:e.parentSpanID,traceID:e.traceID}]:void 0,logs:(null===(t=e.logs)||void 0===t?void 0:t.map(e=>T({},e,{timestamp:1e3*e.timestamp})))||[]})})}}(t);return Object(c.m)(s)}(e.dataFrames),[e.dataFrames]),{search:V,setSearch:G,spanFindMatches:Z}=function(e){const[t,s]=Object(i.useState)(""),n=Object(i.useMemo)(()=>t&&e?Object(c.l)(t,e):void 0,[t,e]);return{search:t,setSearch:s,spanFindMatches:n}}(null==K?void 0:K.spans),Y=Object(u.useSelector)(t=>{var s,n;return null===(s=t.explore[e.exploreId])||void 0===s||null===(n=s.datasourceInstance)||void 0===n?void 0:n.name}),J=null===(t=Object(l.a)().getInstanceSettings(Y))||void 0===t||null===(s=t.jsonData)||void 0===s?void 0:s.tracesToLogs,X=Object(u.useSelector)(e=>Object(d.a)(e.user)),ee=Object(r.useTheme)(),te=Object(i.useMemo)(()=>({type:ee.isDark?c.c.Dark:c.c.Light,servicesColorPalette:r.colors,components:{TraceName:{fontSize:ee.typography.size.lg}}}),[ee]),se=Object(i.useMemo)(()=>({childrenHiddenIDs:v,detailStates:I,hoverIndentGuideIds:q,shouldScrollToFirstUiFindMatch:!1,spanNameColumnWidth:H,traceID:null==K?void 0:K.traceID}),[v,I,q,H,null==K?void 0:K.traceID]),ne=Object(i.useMemo)(()=>function(e,t){if(null==t||!t.datasourceUid)return;const s=Object(l.a)().getInstanceSettings(t.datasourceUid);return s?function(i){const o={title:s.name,url:"",internal:{datasourceUid:s.uid,datasourceName:s.name,query:{expr:b(i,t.tags),refId:""}}},c=Object(a.mapInternalLinkToExplore)({link:o,internalLink:o.internal,scopedVars:{},range:m(i,t),field:{},onClickFn:e,replaceVariables:Object(h.getTemplateSrv)().replace.bind(Object(h.getTemplateSrv)())});return{href:c.href,onClick:c.onClick,content:n||(n=Object(p.jsx)(r.Icon,{name:"gf-logs",title:"Explore the logs for this in split view"}))}}:void 0}(e.splitOpenFn,J),[e.splitOpenFn,J]),ie=document.getElementsByClassName("scrollbar-view")[0],oe=Object(i.useCallback)(()=>_(!W),[W]);return null!==(o=e.dataFrames)&&void 0!==o&&o.length&&K?Object(p.jsx)(c.b,{value:te,children:Object(p.jsxs)(c.h.Provider,{value:y,children:[Object(p.jsx)(c.d,{canCollapse:!1,clearSearch:R,focusUiFindMatches:R,hideMap:!1,hideSummary:!1,nextResult:R,onSlimViewClicked:oe,onTraceGraphViewClicked:R,prevResult:R,resultCount:0,slimView:W,textFilter:null,trace:K,traceGraphView:!1,updateNextViewRangeTime:Q,updateViewRangeTime:A,viewRange:P,searchValue:V,onSearchValueChange:G,hideSearchButtons:!0,timeZone:X}),Object(p.jsx)(c.e,{registerAccessors:R,scrollToFirstVisibleSpan:R,findMatchesIDs:Z,trace:K,traceTimeline:se,updateNextViewRangeTime:Q,updateViewRangeTime:A,viewRange:P,focusSpan:R,createLinkToExternalSpan:R,setSpanNameColumnWidth:U,collapseAll:x,collapseOne:f,expandAll:O,expandOne:g,childrenToggle:j,clearShouldScrollToFirstUiFindMatch:R,detailLogItemToggle:F,detailLogsToggle:L,detailWarningsToggle:z,detailStackTracesToggle:M,detailReferencesToggle:N,detailProcessToggle:D,detailTagsToggle:E,detailToggle:k,setTrace:R,addHoverIndentGuideId:$,removeHoverIndentGuideId:B,linksGetter:R,uiFind:V,createSpanLink:ne,scrollElement:ie})]})}):null}function k(e){const{dataFrames:t,splitOpenFn:s,exploreId:n}=e;return Object(p.jsx)(r.Collapse,{label:"Trace View",isOpen:!0,children:Object(p.jsx)(I,{exploreId:n,dataFrames:t,splitOpenFn:s})})}s.d(t,"a",(function(){return k}))},WGjm:function(e,t,s){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var s in t)t.hasOwnProperty(s)&&(e[s]=t[s])})(e,t)},function(e,t){function s(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(s.prototype=t.prototype,new s)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var i in t=arguments[s])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)Object.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t.default=e,t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var c=r(s("q1tI")),l=s("Nxm2"),d=a(s("75pU")),u={width:"auto",height:"auto"},h=d.default((function(e,t,s){return Math.max(Math.min(e,s),t)})),p=d.default((function(e,t){return Math.round(e/t)*t})),g=d.default((function(e,t){return new RegExp(e,"i").test(t)})),b=d.default((function(e,t,s){void 0===s&&(s=0);var n=t.reduce((function(s,n,i){return Math.abs(n-e)<Math.abs(t[s]-e)?i:s}),0),i=Math.abs(t[n]-e);return 0===s||i<s?t[n]:e})),m=d.default((function(e,t){return e.substr(e.length-t.length,t.length)===t})),f=d.default((function(e){return"auto"===(e=e.toString())||m(e,"px")||m(e,"%")||m(e,"vh")||m(e,"vw")||m(e,"vmax")||m(e,"vmin")?e:e+"px"})),j=function(e,t){if(e&&"string"==typeof e){if(m(e,"%"))return t*(s=Number(e.replace("%",""))/100);if(m(e,"vw")){var s=Number(e.replace("vw",""))/100;return window.innerWidth*s}if(m(e,"vh")){s=Number(e.replace("vh",""))/100;return window.innerHeight*s}}return e},x=d.default((function(e,t,s,n,i){return t=j(t,e.width),s=j(s,e.height),n=j(n,e.width),i=j(i,e.height),{maxWidth:void 0===t?void 0:Number(t),maxHeight:void 0===s?void 0:Number(s),minWidth:void 0===n?void 0:Number(n),minHeight:void 0===i?void 0:Number(i)}})),v=["style","className","grid","snap","bounds","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],y=function(e){function t(t){var s=e.call(this,t)||this;return s.ratio=1,s.resizable=null,s.parentLeft=0,s.parentTop=0,s.resizableLeft=0,s.resizableTop=0,s.targetLeft=0,s.targetTop=0,s.ref=function(e){e&&(s.resizable=e)},s.state={isResizing:!1,width:void 0===(s.propsSize&&s.propsSize.width)?"auto":s.propsSize&&s.propsSize.width,height:void 0===(s.propsSize&&s.propsSize.height)?"auto":s.propsSize&&s.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"}},s.onResizeStart=s.onResizeStart.bind(s),s.onMouseMove=s.onMouseMove.bind(s),s.onMouseUp=s.onMouseUp.bind(s),s}return i(t,e),Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||u},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"base",{get:function(){var e=this.parentNode;if(e)for(var t=0,s=[].slice.call(e.children);t<s.length;t++){var n=s[t];if(n instanceof HTMLElement&&n.classList.contains("__resizable_base__"))return n}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,t=0;if("undefined"!=typeof window&&this.resizable){var s=this.resizable.offsetWidth,n=this.resizable.offsetHeight,i=this.resizable.style.position;"relative"!==i&&(this.resizable.style.position="relative"),e="auto"!==this.resizable.style.width?this.resizable.offsetWidth:s,t="auto"!==this.resizable.style.height?this.resizable.offsetHeight:n,this.resizable.style.position=i}return{width:e,height:t}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,t=this.props.size,s=function(t){if(void 0===e.state[t]||"auto"===e.state[t])return"auto";if(e.propsSize&&e.propsSize[t]&&m(e.propsSize[t].toString(),"%")){if(m(e.state[t].toString(),"%"))return e.state[t].toString();var s=e.getParentSize();return Number(e.state[t].toString().replace("px",""))/s[t]*100+"%"}return f(e.state[t])};return{width:t&&void 0!==t.width&&!this.state.isResizing?f(t.width):s("width"),height:t&&void 0!==t.height&&!this.state.isResizing?f(t.height):s("height")}},enumerable:!0,configurable:!0}),t.prototype.getParentSize=function(){if(!this.base||!this.parentNode)return{width:window.innerWidth,height:window.innerHeight};var e=!1,t=this.parentNode.style.flexWrap,s=this.base.style.minWidth;"wrap"!==t&&(e=!0,this.parentNode.style.flexWrap="wrap"),this.base.style.position="relative",this.base.style.minWidth="100%";var n={width:this.base.offsetWidth,height:this.base.offsetHeight};return this.base.style.position="absolute",e&&(this.parentNode.style.flexWrap=t),this.base.style.minWidth=s,n},t.prototype.bindEvents=function(){"undefined"!=typeof window&&(window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseleave",this.onMouseUp),window.addEventListener("touchmove",this.onMouseMove),window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){"undefined"!=typeof window&&(window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseleave",this.onMouseUp),window.removeEventListener("touchmove",this.onMouseMove),window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(this.resizable){var e=window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:"auto"!==e.flexBasis?e.flexBasis:void 0});var t=this.parentNode;if(t instanceof HTMLElement&&!this.base){var s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0",s.classList?s.classList.add("__resizable_base__"):s.className+="__resizable_base__",t.appendChild(s)}}},t.prototype.componentWillUnmount=function(){if("undefined"!=typeof window){this.unbindEvents();var e=this.parentNode;if(!this.base||!e)return;if(!(e instanceof HTMLElement&&this.base instanceof Node))return;e.removeChild(this.base)}},t.prototype.createSizeForCssProperty=function(e,t){var s=this.propsSize&&this.propsSize[t];return"auto"!==this.state[t]||this.state.original[t]!==e||void 0!==s&&"auto"!==s?e:"auto"},t.prototype.calculateNewMaxFromBoundary=function(e,t){if("parent"===this.props.bounds){var s=this.parentNode;if(s instanceof HTMLElement){var n=s.offsetWidth+(this.parentLeft-this.resizableLeft),i=s.offsetHeight+(this.parentTop-this.resizableTop);e=e&&e<n?e:n,t=t&&t<i?t:i}}else if("window"===this.props.bounds){if("undefined"!=typeof window){n=window.innerWidth-this.resizableLeft,i=window.innerHeight-this.resizableTop;e=e&&e<n?e:n,t=t&&t<i?t:i}}else if(this.props.bounds instanceof HTMLElement){n=this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),i=this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop);e=e&&e<n?e:n,t=t&&t<i?t:i}return{maxWidth:e,maxHeight:t}},t.prototype.calculateNewSizeFromDirection=function(e,t){var s=this.props.scale||1,n=this.props.resizeRatio||1,i=this.state,o=i.direction,r=i.original,a=this.props,c=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,d=a.lockAspectRatioExtraWidth,u=r.width,h=r.height,p=l||0,b=d||0;return g("right",o)&&(u=r.width+(e-r.x)*n/s,c&&(h=(u-b)/this.ratio+p)),g("left",o)&&(u=r.width-(e-r.x)*n/s,c&&(h=(u-b)/this.ratio+p)),g("bottom",o)&&(h=r.height+(t-r.y)*n/s,c&&(u=(h-p)*this.ratio+b)),g("top",o)&&(h=r.height-(t-r.y)*n/s,c&&(u=(h-p)*this.ratio+b)),{newWidth:u,newHeight:h}},t.prototype.calculateNewSizeFromAspectRatio=function(e,t,s,n){var i=this.props,o=i.lockAspectRatio,r=i.lockAspectRatioExtraHeight,a=i.lockAspectRatioExtraWidth,c=void 0===n.width?10:n.width,l=void 0===s.width||s.width<0?e:s.width,d=void 0===n.height?10:n.height,u=void 0===s.height||s.height<0?t:s.height,p=r||0,g=a||0;if(o){var b=(d-p)*this.ratio+g,m=(u-p)*this.ratio+g,f=(c-g)/this.ratio+p,j=(l-g)/this.ratio+p,x=Math.max(c,b),v=Math.min(l,m),y=Math.max(d,f),O=Math.min(u,j);e=h(e,x,v),t=h(t,y,O)}else e=h(e,c,l),t=h(t,d,u);return{newWidth:e,newHeight:t}},t.prototype.setBoundingClientRect=function(){if("parent"===this.props.bounds){var e=this.parentNode;if(e instanceof HTMLElement){var t=e.getBoundingClientRect();this.parentLeft=t.left,this.parentTop=t.top}}if(this.props.bounds instanceof HTMLElement){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left,this.targetTop=s.top}if(this.resizable){var n=this.resizable.getBoundingClientRect(),i=n.left,o=n.top;this.resizableLeft=i,this.resizableTop=o}},t.prototype.onResizeStart=function(e,t){if(this.resizable){var s,n=0,i=0;if(e.nativeEvent instanceof MouseEvent){if(n=e.nativeEvent.clientX,i=e.nativeEvent.clientY,3===e.nativeEvent.which)return}else e.nativeEvent instanceof TouchEvent&&(n=e.nativeEvent.touches[0].clientX,i=e.nativeEvent.touches[0].clientY);if(this.props.onResizeStart)if(this.resizable)if(!1===this.props.onResizeStart(e,t,this.resizable))return;this.props.size&&(void 0!==this.props.size.height&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),void 0!==this.props.size.width&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio="number"==typeof this.props.lockAspectRatio?this.props.lockAspectRatio:this.size.width/this.size.height;var r=window.getComputedStyle(this.resizable);if("auto"!==r.flexBasis){var a=this.parentNode;if(a){var c=window.getComputedStyle(a).flexDirection;this.flexDir=c.startsWith("row")?"row":"column",s=r.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var l={original:{x:n,y:i,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:o(o({},this.state.backgroundStyle),{cursor:window.getComputedStyle(e.target).cursor||"auto"}),direction:t,flexBasis:s};this.setState(l)}},t.prototype.onMouseMove=function(e){if(this.state.isResizing&&this.resizable){var t=this.props,s=t.maxWidth,n=t.maxHeight,i=t.minWidth,o=t.minHeight,r=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,a=e instanceof MouseEvent?e.clientY:e.touches[0].clientY,c=this.state,l=c.direction,d=c.original,u=c.width,h=c.height,g=this.getParentSize(),f=x(g,s,n,i,o);s=f.maxWidth,n=f.maxHeight,i=f.minWidth,o=f.minHeight;var j=this.calculateNewSizeFromDirection(r,a),v=j.newHeight,y=j.newWidth,O=this.calculateNewMaxFromBoundary(s,n),w=this.calculateNewSizeFromAspectRatio(y,v,{width:O.maxWidth,height:O.maxHeight},{width:i,height:o});if(y=w.newWidth,v=w.newHeight,this.props.grid){var S=p(y,this.props.grid[0]),C=p(v,this.props.grid[1]),T=this.props.snapGap||0;y=0===T||Math.abs(S-y)<=T?S:y,v=0===T||Math.abs(C-v)<=T?C:v}this.props.snap&&this.props.snap.x&&(y=b(y,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(v=b(v,this.props.snap.y,this.props.snapGap));var R={width:y-d.width,height:v-d.height};if(u&&"string"==typeof u)if(m(u,"%"))y=y/g.width*100+"%";else if(m(u,"vw")){y=y/window.innerWidth*100+"vw"}else if(m(u,"vh")){y=y/window.innerHeight*100+"vh"}if(h&&"string"==typeof h)if(m(h,"%"))v=v/g.height*100+"%";else if(m(h,"vw")){v=v/window.innerWidth*100+"vw"}else if(m(h,"vh")){v=v/window.innerHeight*100+"vh"}var I={width:this.createSizeForCssProperty(y,"width"),height:this.createSizeForCssProperty(v,"height")};"row"===this.flexDir?I.flexBasis=I.width:"column"===this.flexDir&&(I.flexBasis=I.height),this.setState(I),this.props.onResize&&this.props.onResize(e,l,this.resizable,R)}},t.prototype.onMouseUp=function(e){var t=this.state,s=t.isResizing,n=t.direction,i=t.original;if(s&&this.resizable){var r={width:this.size.width-i.width,height:this.size.height-i.height};this.props.onResizeStop&&this.props.onResizeStop(e,n,this.resizable,r),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:o(o({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(e){this.setState({width:e.width,height:e.height})},t.prototype.renderResizer=function(){var e=this,t=this.props,s=t.enable,n=t.handleStyles,i=t.handleClasses,o=t.handleWrapperStyle,r=t.handleWrapperClass,a=t.handleComponent;if(!s)return null;var d=Object.keys(s).map((function(t){return!1!==s[t]?c.createElement(l.Resizer,{key:t,direction:t,onResizeStart:e.onResizeStart,replaceStyles:n&&n[t],className:i&&i[t]},a&&a[t]?a[t]:null):null}));return c.createElement("span",{className:r,style:o},d)},t.prototype.render=function(){var e=this,t=Object.keys(this.props).reduce((function(t,s){return-1!==v.indexOf(s)||(t[s]=e.props[s]),t}),{}),s=o(o(o({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});return this.state.flexBasis&&(s.flexBasis=this.state.flexBasis),c.createElement("div",o({ref:this.ref,style:s,className:this.props.className},t),this.state.isResizing&&c.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(c.PureComponent);t.Resizable=y},WnTU:function(e,t,s){"use strict";s.d(t,"a",(function(){return m}));var n=s("Obii"),i=s("kDLi"),o=s("C6if"),r=s("sA6q"),a=s("W/v1"),c=s("vF1F"),l=s("q1tI"),d=s("Xc1M"),u=s("tLXD"),h=s("Xmxp"),p=s("3F0C"),g=s("LvDl"),b=s("nKUr");function m({data:e,height:t,width:s,timeZone:m,absoluteRange:j,onUpdateTimeRange:x,annotations:v,tooltipDisplayMode:y,splitOpenFn:O,onHiddenSeriesChanged:w}){const S=Object(i.useTheme2)(),[C,T]=Object(l.useState)(!1),[R,I]=Object(l.useState)(1),k=Object(u.a)(e),F=Object(l.useRef)(0);e&&k&&!Object(n.compareArrayValues)(k,e,n.compareDataFrameStructures)&&F.current++;const L=R+F.current,[D,N]=Object(l.useState)({defaults:{color:{mode:n.FieldColorModeId.PaletteClassic},custom:{drawStyle:i.DrawStyle.Line,fillOpacity:0,pointSize:5}},overrides:[]}),E=Object(i.useStyles)(f),z={from:Object(n.dateTime)(j.from),to:Object(n.dateTime)(j.to),raw:{from:Object(n.dateTime)(j.from),to:Object(n.dateTime)(j.to)}},M=Object(l.useMemo)(()=>{const t=Object(n.createFieldConfigRegistry)(Object(o.b)(o.a),"Explore");return Object(n.applyFieldOverrides)({fieldConfig:D,data:e,timeZone:m,replaceVariables:e=>e,theme:S,fieldConfigRegistry:t})},[D,e,m,S]);Object(l.useEffect)(()=>{if(w){const e=[];M.forEach(t=>{t.fields.map(e=>{var t,s,n;return null===(t=e.config)||void 0===t||null===(s=t.custom)||void 0===s||null===(n=s.hideFrom)||void 0===n?void 0:n.viz}).every(g.identity)&&e.push(Object(n.getFrameDisplayName)(t))}),w(e)}},[M,w]);const B=C?M:M.slice(0,20),$=(e,t)=>Object(d.a)({field:e,rowIndex:t,splitOpenFn:O,range:z}),q={eventBus:h.b,onToggleSeriesVisibility(t,s){I(e=>e+1),N(Object(p.a)(t,s,D,e))}};return Object(b.jsxs)(i.PanelContextProvider,{value:q,children:[M.length>20&&!C&&Object(b.jsxs)("div",{className:Object(c.cx)([E.timeSeriesDisclaimer]),children:[Object(b.jsx)(i.Icon,{className:E.disclaimerIcon,name:"exclamation-triangle"}),"Showing only 20 time series. ",Object(b.jsx)("span",{className:Object(c.cx)([E.showAllTimeSeries]),onClick:()=>{F.current++,T(!0)},children:"Show all "+M.length})]}),Object(b.jsx)(i.TimeSeries,{frames:B,structureRev:L,width:s,height:t,timeRange:z,legend:{displayMode:i.LegendDisplayMode.List,placement:"bottom",calcs:[]},timeZone:m,children:(e,t)=>Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)(i.ZoomPlugin,{config:e,onZoom:x}),Object(b.jsx)(i.TooltipPlugin,{config:e,data:t,mode:y,timeZone:m}),Object(b.jsx)(r.a,{config:e,data:t,timeZone:m}),v&&Object(b.jsx)(a.a,{config:e,exemplars:v,timeZone:m,getFieldLinks:$})]})})]})}const f=e=>({timeSeriesDisclaimer:c.css`
    label: time-series-disclaimer;
    width: 300px;
    margin: ${e.spacing.sm} auto;
    padding: 10px 0;
    border-radius: ${e.border.radius.md};
    text-align: center;
    background-color: ${e.colors.bg1};
  `,disclaimerIcon:c.css`
    label: disclaimer-icon;
    color: ${e.palette.yellow};
    margin-right: ${e.spacing.xs};
  `,showAllTimeSeries:c.css`
    label: show-all-time-series;
    cursor: pointer;
    color: ${e.colors.linkExternal};
  `})},ajrG:function(e,t,s){"use strict";(function(e){var n=s("q1tI"),i=s("0cfB"),o=s("/MKj"),r=s("kDDq"),a=s("kDLi"),c=s("sQ2H"),l=s("VVW4"),d=s("vExC"),u=s("1LJY"),h=s("Bdd1"),p=s("gmR8"),g=s("lMcC"),b=s("OxIB"),m=s("Xc1M"),f=s("nKUr");function j(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class x extends n.PureComponent{constructor(...e){super(...e),j(this,"onChangeTime",e=>{const{exploreId:t,updateTimeRange:s}=this.props;s({exploreId:t,absoluteRange:e})}),j(this,"getLogRowContext",async(e,t)=>{const{datasourceInstance:s}=this.props;return null!=s&&s.getLogRowContext?s.getLogRowContext(e,t):[]}),j(this,"showContextToggle",e=>{const{datasourceInstance:t}=this.props;return!(null==t||!t.showContextToggle)&&t.showContextToggle(e)}),j(this,"getFieldLinks",(e,t)=>{const{splitOpen:s,range:n}=this.props;return Object(m.a)({field:e,rowIndex:t,splitOpenFn:s,range:n})})}render(){const{loading:e,logsHighlighterExpressions:t,logRows:s,logsMeta:n,logsSeries:i,logsQueries:o,onClickFilterLabel:c,onClickFilterOutLabel:l,onStartScanning:d,onStopScanning:u,absoluteRange:m,timeZone:j,visibleRange:x,scanning:v,range:y,width:O,isLive:w,exploreId:S,addResultsToCache:C,clearCache:T}=this.props;if(!s)return null;const R=r.css`
      & > div {
        overflow: visible;
        & > div {
          overflow: visible;
        }
      }
    `;return Object(f.jsxs)(f.Fragment,{children:[Object(f.jsx)(g.a,{visible:w,children:Object(f.jsx)(a.Collapse,{label:"Logs",loading:!1,isOpen:!0,children:Object(f.jsx)(b.a,{exploreId:S,children:e=>Object(f.jsx)(h.a,{logRows:s,timeZone:j,stopLive:e.stop,isPaused:this.props.isPaused,onPause:e.pause,onResume:e.resume})})})}),Object(f.jsx)(g.a,{visible:!w,children:Object(f.jsx)(a.Collapse,{label:"Logs",loading:e,isOpen:!0,className:R,children:Object(f.jsx)(p.a,{logRows:s,logsMeta:n,logsSeries:i,logsQueries:o,width:O,highlighterExpressions:t,loading:e,onChangeTime:this.onChangeTime,onClickFilterLabel:c,onClickFilterOutLabel:l,onStartScanning:d,onStopScanning:u,absoluteRange:m,visibleRange:x,timeZone:j,scanning:v,scanRange:y.raw,showContextToggle:this.showContextToggle,getRowContext:this.getLogRowContext,getFieldLinks:this.getFieldLinks,addResultsToCache:()=>C(S),clearCache:()=>T(S)})})})]})}}const v={updateTimeRange:d.e,splitOpen:c.h,addResultsToCache:l.b,clearCache:l.e},y=Object(o.connect)((function(e,{exploreId:t}){const s=e.explore[t],{logsHighlighterExpressions:n,logsResult:i,loading:o,scanning:r,datasourceInstance:a,isLive:c,isPaused:l,range:d,absoluteRange:h}=s,p=Object(u.a)(e.user);return{loading:o,logsHighlighterExpressions:n,logRows:null==i?void 0:i.rows,logsMeta:null==i?void 0:i.meta,logsSeries:null==i?void 0:i.series,logsQueries:null==i?void 0:i.queries,visibleRange:null==i?void 0:i.visibleRange,scanning:r,timeZone:p,datasourceInstance:a,isLive:c,isPaused:l,range:d,absoluteRange:h}}),v);t.a=Object(i.hot)(e)(y(x))}).call(this,s("3UD+")(e))},bkob:function(e,t,s){"use strict";(function(e){s.d(t,"a",(function(){return k}));var n=s("q1tI"),i=s("/MKj"),o=s("0cfB"),r=s("TSYQ"),a=s.n(r),c=s("vF1F"),l=s("kDLi"),d=s("t8hP"),u=s("ljRM"),h=s("fD97"),p=s("sQ2H"),g=s("vExC"),b=s("1LJY"),m=s("Gqk0"),f=s("kd/b"),j=s("sQnn"),x=s("nmUH"),v=s("OxIB"),y=s("VVW4"),O=s("8Vg1"),w=s("5BoW"),S=s("nKUr");function C(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class T extends n.PureComponent{constructor(...e){super(...e),C(this,"onChangeDatasource",async e=>{this.props.changeDatasource(this.props.exploreId,e.name,{importQueries:!0})}),C(this,"onClearAll",()=>{this.props.clearAll(this.props.exploreId)}),C(this,"onRunQuery",(e=!1)=>{const{runQueries:t,cancelQueries:s,exploreId:n}=this.props;return e?s(n):t(n)}),C(this,"onChangeRefreshInterval",e=>{const{changeRefreshInterval:t,exploreId:s}=this.props;t(s,e)}),C(this,"onChangeTimeSync",()=>{const{syncTimes:e,exploreId:t}=this.props;e(t)})}render(){const{datasourceMissing:e,closeSplit:t,exploreId:s,loading:n,range:i,timeZone:o,splitted:r,syncedTimes:h,refreshInterval:p,onChangeTime:g,split:b,hasLiveOption:m,isLive:y,isPaused:w,containerWidth:C,onChangeTimeZone:T}=this.props,R=(r?C<700:C<800)||!1,I=r||C<1210;return Object(S.jsxs)("div",{className:r?"explore-toolbar splitted":"explore-toolbar",children:[Object(S.jsx)("div",{className:"explore-toolbar-item",children:Object(S.jsxs)("div",{className:"explore-toolbar-header",children:[Object(S.jsx)("div",{className:"explore-toolbar-header-title",children:"left"===s&&Object(S.jsxs)("span",{className:"navbar-page-btn",children:[Object(S.jsx)(l.Icon,{name:"compass",size:"lg",className:c.css`
                      margin-right: 6px;
                      margin-bottom: 3px;
                    `}),"Explore"]})}),r&&Object(S.jsx)(l.IconButton,{title:"Close split pane",className:"explore-toolbar-header-close",onClick:()=>t(s),name:"times"})]})}),Object(S.jsx)("div",{className:"explore-toolbar-item",children:Object(S.jsxs)("div",{className:"explore-toolbar-content",children:[e?null:Object(S.jsx)("div",{className:"explore-toolbar-content-item",children:Object(S.jsx)("div",{className:a()("explore-ds-picker",R?"explore-ds-picker--small":""),children:Object(S.jsx)(d.DataSourcePicker,{onChange:this.onChangeDatasource,current:this.props.datasourceName,hideTextValue:R})})}),Object(S.jsxs)(l.ToolbarButtonRow,{children:[Object(S.jsx)(O.a,{exploreId:s}),"left"!==s||r?null:Object(S.jsx)(l.ToolbarButton,{iconOnly:r,title:"Split",onClick:()=>b(),icon:"columns",disabled:y,children:"Split"}),Object(S.jsx)(l.Tooltip,{content:"Copy shortened link to the executed query",placement:"bottom",children:Object(S.jsx)(l.ToolbarButton,{icon:"share-alt",onClick:()=>Object(u.a)(window.location.href)})}),!y&&Object(S.jsx)(f.a,{exploreId:s,range:i,timeZone:o,onChangeTime:g,splitted:r,syncedTimes:h,onChangeTimeSync:this.onChangeTimeSync,hideText:I,onChangeTimeZone:T}),!y&&Object(S.jsx)(l.ToolbarButton,{title:"Clear all",onClick:this.onClearAll,icon:"trash-alt",iconOnly:r,children:"Clear all"}),Object(S.jsx)(x.a,{refreshInterval:p,onChangeRefreshInterval:this.onChangeRefreshInterval,isSmall:r||I,isLive:y,loading:n||y&&!w,onRun:this.onRunQuery,showDropdown:!y}),p&&Object(S.jsx)(l.SetInterval,{func:this.onRunQuery,interval:p,loading:n}),m&&Object(S.jsx)(v.a,{exploreId:s,children:e=>Object(S.jsx)(j.a,{splitted:r,isLive:y,isPaused:w,start:e.start,pause:e.pause,resume:e.resume,stop:e.stop})})]})]})})]})}}const R={changeDatasource:h.a,changeRefreshInterval:g.a,clearAll:y.f,cancelQueries:y.c,runQueries:y.k,closeSplit:p.g,split:p.h,syncTimes:g.b,onChangeTimeZone:m.i},I=Object(i.connect)((e,{exploreId:t})=>{var s;const n=e.explore.syncedTimes,i=e.explore[t],{datasourceInstance:o,datasourceMissing:r,range:a,refreshInterval:c,loading:l,isLive:d,isPaused:u,containerWidth:h}=i,p=!(null==o||null===(s=o.meta)||void 0===s||!s.streaming);return{datasourceMissing:r,datasourceName:null==o?void 0:o.name,loading:l,range:a,timeZone:Object(b.a)(e.user),splitted:Object(w.a)(e),refreshInterval:c,hasLiveOption:p,isLive:d,isPaused:u,syncedTimes:n,containerWidth:h}},R),k=Object(o.hot)(e)(I(T))}).call(this,s("3UD+")(e))},cAtN:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var n=s("q1tI"),i=s("9BUi"),o=s("nKUr");class r extends n.PureComponent{render(){const{className:e="",exploreId:t,queryKeys:s}=this.props;return Object(o.jsx)("div",{className:e,children:s.map((e,s)=>Object(o.jsx)(i.a,{exploreId:t,index:s},e))})}}},eX1b:function(e,t,s){"use strict";s.r(t);var n=s("q1tI"),i=s.n(n),o=s("/MKj"),r=s("sBLX"),a=s("kDLi"),c=s("sQ2H"),l=s("w9yp"),d=s("Wwog"),u=s("Obii"),h=s("Csm0"),p=s("SMGL"),g=s("CJUB"),b=s("m257"),m=s("1LJY"),f=s("sguS"),j=s("nKUr");function x(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class v extends i.a.PureComponent{constructor(e){super(e),x(this,"el",void 0),x(this,"exploreEvents",void 0),x(this,"refreshExplore",e=>{const{exploreId:t,urlQuery:s}=this.props;s!==e&&s!==c.c[t]&&this.props.refreshExplore(t,s)}),x(this,"getRef",e=>{this.el=e}),this.exploreEvents=new u.EventBusSrv,this.state={openDrawer:void 0}}componentDidMount(){var e,t;const{initialized:s,exploreId:n,initialDatasource:i,initialQueries:o,initialRange:r,originPanelId:a}=this.props,c=null!==(e=null===(t=this.el)||void 0===t?void 0:t.offsetWidth)&&void 0!==e?e:0;s||this.props.initializeExplore(n,i,o,r,c,this.exploreEvents,a)}componentWillUnmount(){this.exploreEvents.removeAllListeners(),this.props.cleanupPaneAction({exploreId:this.props.exploreId})}componentDidUpdate(e){this.refreshExplore(e.urlQuery)}render(){const e=this.props.split?"explore explore-split":"explore";return Object(j.jsx)("div",{className:e,ref:this.getRef,"data-testid":h.a.pages.Explore.General.container,children:this.props.initialized&&Object(j.jsx)(f.a,{exploreId:this.props.exploreId})})}}const y=Object(d.default)(b.f),O=Object(d.default)(b.l);const w={initializeExplore:g.c,refreshExplore:g.e,cleanupPaneAction:c.a},S=Object(o.connect)((function(e,t){var s;const n=Object(b.o)(t.urlQuery),i=Object(m.a)(e.user),{datasource:o,queries:r,range:a,originPanelId:c}=n||{},l=o||p.a.get(Object(b.n)(e.user.orgId)),d=y(r),u=a?O(a,i):Object(b.k)(i,b.a);return{initialized:null===(s=e.explore[t.exploreId])||void 0===s?void 0:s.initialized,initialDatasource:l,initialQueries:d,initialRange:u,originPanelId:c}}),w)(v);var C=s("ibPz"),T=s("lzJ5");const R={resetExploreAction:c.e,richHistoryUpdatedAction:c.f},I=Object(o.connect)(e=>({navModel:Object(T.a)(e.navIndex,"explore"),exploreState:e.explore}),R);class k extends n.PureComponent{componentWillUnmount(){this.props.resetExploreAction({})}componentDidMount(){c.c.left=void 0,c.c.right=void 0;const e=Object(l.j)();this.props.richHistoryUpdatedAction({richHistory:e})}componentDidUpdate(){var e,t,s,n;const{left:i,right:o}=this.props.queryParams,r=Boolean(i)&&Boolean(o)?`${null===(e=this.props.exploreState.left.datasourceInstance)||void 0===e?void 0:e.name} | ${null===(t=this.props.exploreState.right)||void 0===t||null===(s=t.datasourceInstance)||void 0===s?void 0:s.name}`:""+(null===(n=this.props.exploreState.left.datasourceInstance)||void 0===n?void 0:n.name),a=`${this.props.navModel.main.text} - ${r} - ${C.a.AppTitle}`;document.title=a}render(){const{left:e,right:t}=this.props.queryParams,s=Boolean(e)&&Boolean(t);return Object(j.jsx)("div",{className:"page-scrollbar-wrapper",children:Object(j.jsxs)("div",{className:"explore-wrapper",children:[Object(j.jsx)(a.ErrorBoundaryAlert,{style:"page",children:Object(j.jsx)(S,{split:s,exploreId:r.a.left,urlQuery:e})}),s&&Object(j.jsx)(a.ErrorBoundaryAlert,{style:"page",children:Object(j.jsx)(S,{split:s,exploreId:r.a.right,urlQuery:t})})]})})}}const F=I(k);t.default=F},gmR8:function(e,t,s){"use strict";var n,i=s("q1tI"),o=s.n(i),r=s("vF1F"),a=s("LvDl"),c=s("Wwog"),l=s("Obii"),d=s("kDLi"),u=s("SMGL"),h=s("QJHg"),p=s("o3yI"),g=s("h1VQ"),b=s("nKUr");const m=o.a.memo(({meta:e,dedupStrategy:t,dedupCount:s,showDetectedFields:i,clearDetectedFields:o,hasUnescapedContent:r,forceEscape:a,onEscapeNewlines:c,logRows:u})=>{const h=[...e];return t!==l.LogsDedupStrategy.none&&h.push({label:"Dedup count",value:s,kind:l.LogsMetaKind.Number}),u.some(e=>e.entry.length>p.b)&&h.push({label:"Info",value:"Logs with more than 100,000 characters could not be parsed and highlighted",kind:l.LogsMetaKind.String}),(null==i?void 0:i.length)>0&&h.push({label:"Showing only detected fields",value:f(i,l.LogsMetaKind.LabelsMap)},{label:"",value:Object(b.jsx)(d.Button,{variant:"secondary",size:"sm",onClick:o,children:"Show all detected fields"})}),r&&h.push({label:"Your logs might have incorrectly escaped content",value:Object(b.jsx)(d.Tooltip,{content:"We suggest to try to fix the escaping of your log lines first. This is an experimental feature, your logs might not be correctly escaped.",placement:"right",children:Object(b.jsxs)(d.Button,{variant:"secondary",size:"sm",onClick:c,children:[Object(b.jsxs)("span",{children:[a?"Remove escaping":"Escape newlines"," "]}),n||(n=Object(b.jsx)(d.Icon,{name:"exclamation-triangle",className:"muted",size:"sm"}))]})})}),Object(b.jsx)(b.Fragment,{children:h&&Object(b.jsx)(g.a,{metaItems:h.map(e=>({label:e.label,value:"kind"in e?f(e.value,e.kind):e.value}))})})});function f(e,t){return t===l.LogsMetaKind.LabelsMap?Object(b.jsx)("span",{className:"logs-meta-item__labels",children:Object(b.jsx)(d.LogLabels,{labels:e})}):t===l.LogsMetaKind.Error?Object(b.jsx)("span",{className:"logs-meta-item__error",children:e}):e}m.displayName="LogsMetaRow";var j,x=s("kDDq");function v({pages:e,currentPageIndex:t,oldestLogsFirst:s,timeZone:n,loading:i,changeTime:o}){const r=e=>""+Object(l.dateTimeFormat)(e,{format:l.systemDateFormats.interval.second,timeZone:n}),a=(e,n)=>{if(t===n&&i)return j||(j=Object(b.jsx)(d.Spinner,{}));return`${r(s?e.logsRange.from:e.logsRange.to)} — ${r(s?e.logsRange.to:e.logsRange.from)}`},c=Object(d.useTheme)(),u=y(c,i);return Object(b.jsx)(d.CustomScrollbar,{autoHide:!0,children:Object(b.jsx)("div",{className:u.pagesWrapper,"data-testid":"logsNavigationPages",children:Object(b.jsx)("div",{className:u.pagesContainer,children:e.map((e,s)=>Object(b.jsxs)("div",{"data-testid":"page"+(s+1),className:u.page,onClick:()=>!i&&o({from:e.queryRange.from,to:e.queryRange.to}),children:[Object(b.jsx)("div",{className:Object(x.cx)(u.line,{selectedBg:t===s})}),Object(b.jsx)("div",{className:Object(x.cx)(u.time,{selectedText:t===s}),children:a(e,s)})]},e.queryRange.to))})})})}const y=Object(d.stylesFactory)((e,t)=>({pagesWrapper:x.css`
      height: 100%;
      padding-left: ${e.spacing.xs};
      display: flex;
      flex-direction: column;
      overflow-y: scroll;
      &::after {
        content: '';
        display: block;
        background: repeating-linear-gradient(
          135deg,
          ${e.colors.bg1},
          ${e.colors.bg1} 5px,
          ${e.colors.bg2} 5px,
          ${e.colors.bg2} 15px
        );
        width: 3px;
        height: inherit;
        margin-bottom: 8px;
      }
    `,pagesContainer:x.css`
      display: flex;
      padding: 0;
      flex-direction: column;
    `,page:x.css`
      display: flex;
      margin: ${e.spacing.md} 0;
      cursor: ${t?"auto":"pointer"};
      white-space: normal;
      .selectedBg {
        background: ${e.colors.bgBlue2};
      }
      .selectedText {
        color: ${e.colors.bgBlue2};
      }
    `,line:x.css`
      width: 3px;
      height: 100%;
      align-items: center;
      background: ${e.colors.textWeak};
    `,time:x.css`
      width: 60px;
      min-height: 80px;
      font-size: ${e.typography.size.sm};
      padding-left: ${e.spacing.xs};
      display: flex;
      align-items: center;
    `}));var O,w,S;function C({absoluteRange:e,logsSortOrder:t,timeZone:s,loading:n,onChangeTime:o,scrollToTopLogs:r,visibleRange:c,queries:u,clearCache:h,addResultsToCache:p}){const[g,m]=Object(i.useState)([]),[f,j]=Object(i.useState)(0),x=Object(i.useRef)(),y=Object(i.useRef)(),C=Object(i.useRef)(0),T=t===l.LogsSortOrder.Ascending,I=0===f,k=f===g.length-1,F=Object(d.useTheme)(),L=R(F,T,n);Object(i.useEffect)(()=>{const s={logsRange:c,queryRange:e};let n=[];if(Object(a.isEqual)(y.current,e)&&Object(a.isEqual)(x.current,u)){m(e=>(n=e.filter(e=>!Object(a.isEqual)(s.queryRange,e.queryRange)),n=[...n,s].sort((e,s)=>N(e,s,t)),n));const i=n.findIndex(t=>t.queryRange.to===e.to);j(i)}else h(),m([s]),j(0),x.current=u,C.current=e.to-e.from;p()},[c,e,t,u,h,p]),Object(i.useEffect)(()=>()=>h(),[]);const D=({from:e,to:t})=>{y.current={from:e,to:t},o({from:e,to:t})},N=(e,t,s)=>s===l.LogsSortOrder.Ascending?e.queryRange.to>t.queryRange.to?1:-1:e.queryRange.to>t.queryRange.to?-1:1,E=Object(b.jsx)(d.Button,{"data-testid":"olderLogsButton",className:L.navButton,variant:"secondary",onClick:()=>{D(k?{from:c.from-C.current,to:c.from}:{from:g[f+1].queryRange.from,to:g[f+1].queryRange.to})},disabled:n,children:Object(b.jsxs)("div",{className:L.navButtonContent,children:[n?O||(O=Object(b.jsx)(d.Spinner,{})):Object(b.jsx)(d.Icon,{name:T?"angle-up":"angle-down",size:"lg"}),"Older logs"]})}),z=Object(b.jsx)(d.Button,{"data-testid":"newerLogsButton",className:L.navButton,variant:"secondary",onClick:()=>{I||D({from:g[f-1].queryRange.from,to:g[f-1].queryRange.to})},disabled:n||I,children:Object(b.jsxs)("div",{className:L.navButtonContent,children:[n&&(w||(w=Object(b.jsx)(d.Spinner,{}))),I||n?null:Object(b.jsx)(d.Icon,{name:T?"angle-down":"angle-up",size:"lg"}),I?"Start of range":"Newer logs"]})});return Object(b.jsxs)("div",{className:L.navContainer,children:[T?E:z,Object(b.jsx)(v,{pages:g,currentPageIndex:f,oldestLogsFirst:T,timeZone:s,loading:n,changeTime:D}),T?z:E,Object(b.jsx)(d.Button,{"data-testid":"scrollToTop",className:L.scrollToTopButton,variant:"secondary",onClick:r,title:"Scroll to top",children:S||(S=Object(b.jsx)(d.Icon,{name:"arrow-up",size:"lg"}))})]})}var T=Object(i.memo)(C);const R=Object(d.stylesFactory)((e,t,s)=>({navContainer:x.css`
      max-height: 95vh;
      display: flex;
      flex-direction: column;
      justify-content: ${t?"flex-start":"space-between"};
      position: sticky;
      top: ${e.spacing.md};
      right: 0;
    `,navButton:x.css`
      width: 58px;
      height: 68px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      line-height: 1;
    `,navButtonContent:x.css`
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 100%;
      height: 100%;
      white-space: normal;
    `,scrollToTopButton:x.css`
      width: 40px;
      height: 40px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      margin-top: ${e.spacing.sm};
    `}));var I=s("WnTU");function k(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s.d(t,"a",(function(){return z}));const F="grafana.explore.logs.showLabels",L="grafana.explore.logs.showTime",D="grafana.explore.logs.wrapLogMessage",N="grafana.explore.logs.prettifyLogMessage";class E extends i.PureComponent{constructor(...e){super(...e),k(this,"flipOrderTimer",void 0),k(this,"cancelFlippingTimer",void 0),k(this,"topLogsRef",Object(i.createRef)()),k(this,"state",{showLabels:u.a.getBool(F,!1),showTime:u.a.getBool(L,!0),wrapLogMessage:u.a.getBool(D,!0),prettifyLogMessage:u.a.getBool(N,!1),dedupStrategy:l.LogsDedupStrategy.none,hiddenLogLevels:[],logsSortOrder:null,isFlipping:!1,showDetectedFields:[],forceEscape:!1}),k(this,"onChangeLogsSortOrder",()=>{this.setState({isFlipping:!0}),this.flipOrderTimer=window.setTimeout(()=>{this.setState(e=>null===e.logsSortOrder||e.logsSortOrder===l.LogsSortOrder.Descending?{logsSortOrder:l.LogsSortOrder.Ascending}:{logsSortOrder:l.LogsSortOrder.Descending})},0),this.cancelFlippingTimer=window.setTimeout(()=>this.setState({isFlipping:!1}),1e3)}),k(this,"onEscapeNewlines",()=>{this.setState(e=>({forceEscape:!e.forceEscape}))}),k(this,"onChangeDedup",e=>{this.setState({dedupStrategy:e})}),k(this,"onChangeLabels",e=>{const t=e&&e.target;if(t){const e=t.checked;this.setState({showLabels:e}),u.a.set(F,e)}}),k(this,"onChangeTime",e=>{const t=e&&e.target;if(t){const e=t.checked;this.setState({showTime:e}),u.a.set(L,e)}}),k(this,"onChangewrapLogMessage",e=>{const t=e&&e.target;if(t){const e=t.checked;this.setState({wrapLogMessage:e}),u.a.set(D,e)}}),k(this,"onChangePrettifyLogMessage",e=>{const t=e&&e.target;if(t){const e=t.checked;this.setState({prettifyLogMessage:e}),u.a.set(N,e)}}),k(this,"onToggleLogLevel",e=>{const t=e.map(e=>l.LogLevel[e]);this.setState({hiddenLogLevels:t})}),k(this,"onClickScan",e=>{e.preventDefault(),this.props.onStartScanning&&this.props.onStartScanning()}),k(this,"onClickStopScan",e=>{e.preventDefault(),this.props.onStopScanning&&this.props.onStopScanning()}),k(this,"showDetectedField",e=>{-1===this.state.showDetectedFields.indexOf(e)&&this.setState(t=>({showDetectedFields:t.showDetectedFields.concat(e)}))}),k(this,"hideDetectedField",e=>{this.state.showDetectedFields.indexOf(e)>-1&&this.setState(t=>({showDetectedFields:t.showDetectedFields.filter(t=>e!==t)}))}),k(this,"clearDetectedFields",()=>{this.setState(e=>({showDetectedFields:[]}))}),k(this,"checkUnescapedContent",Object(c.default)(e=>!!e.some(e=>e.hasUnescapedContent))),k(this,"dedupRows",Object(c.default)((e,t)=>{const s=Object(h.c)(e,t),n=s.reduce((e,t)=>t.duplicates?e+t.duplicates:e,0);return{dedupedRows:s,dedupCount:n}})),k(this,"filterRows",Object(c.default)((e,t)=>Object(h.d)(e,new Set(t)))),k(this,"scrollToTopLogs",()=>{var e;return null===(e=this.topLogsRef.current)||void 0===e?void 0:e.scrollIntoView()})}componentWillUnmount(){this.flipOrderTimer&&window.clearTimeout(this.flipOrderTimer),this.cancelFlippingTimer&&window.clearTimeout(this.cancelFlippingTimer)}render(){const{width:e,logRows:t,logsMeta:s,logsSeries:n,visibleRange:i,highlighterExpressions:o,loading:r=!1,onClickFilterLabel:c,onClickFilterOutLabel:u,timeZone:h,scanning:p,scanRange:g,showContextToggle:f,absoluteRange:j,onChangeTime:x,getFieldLinks:v,theme:y,logsQueries:O,clearCache:w,addResultsToCache:S}=this.props,{showLabels:C,showTime:R,wrapLogMessage:k,prettifyLogMessage:F,dedupStrategy:L,hiddenLogLevels:D,logsSortOrder:N,isFlipping:E,showDetectedFields:z,forceEscape:B}=this.state,$=M(y,k),q=t&&t.length>0,P=this.checkUnescapedContent(t),A=this.filterRows(t,D),{dedupedRows:Q,dedupCount:H}=this.dedupRows(A,L),U=g?"Scanning "+l.rangeUtil.describeTimeRange(g):"Scanning...";return Object(b.jsxs)(b.Fragment,{children:[Object(b.jsx)("div",{className:$.infoText,children:"This datasource does not support full-range histograms. The graph is based on the logs seen in the response."}),n&&n.length?Object(b.jsx)(I.a,{data:n,height:150,width:e,tooltipDisplayMode:d.TooltipDisplayMode.Multi,absoluteRange:i||j,timeZone:h,onUpdateTimeRange:x,onHiddenSeriesChanged:this.onToggleLogLevel}):void 0,Object(b.jsxs)("div",{className:$.logOptions,ref:this.topLogsRef,children:[Object(b.jsxs)(d.InlineFieldRow,{children:[Object(b.jsx)(d.InlineField,{label:"Time",transparent:!0,children:Object(b.jsx)(d.InlineSwitch,{value:R,onChange:this.onChangeTime,transparent:!0})}),Object(b.jsx)(d.InlineField,{label:"Unique labels",transparent:!0,children:Object(b.jsx)(d.InlineSwitch,{value:C,onChange:this.onChangeLabels,transparent:!0})}),Object(b.jsx)(d.InlineField,{label:"Wrap lines",transparent:!0,children:Object(b.jsx)(d.InlineSwitch,{value:k,onChange:this.onChangewrapLogMessage,transparent:!0})}),Object(b.jsx)(d.InlineField,{label:"Prettify JSON",transparent:!0,children:Object(b.jsx)(d.InlineSwitch,{value:F,onChange:this.onChangePrettifyLogMessage,transparent:!0})}),Object(b.jsx)(d.InlineField,{label:"Dedup",transparent:!0,children:Object(b.jsx)(d.RadioButtonGroup,{options:Object.values(l.LogsDedupStrategy).map(e=>({label:Object(a.capitalize)(e),value:e,description:l.LogsDedupDescription[e]})),value:L,onChange:this.onChangeDedup,className:$.radioButtons})})]}),Object(b.jsx)(d.Button,{variant:"secondary",disabled:E,title:N===l.LogsSortOrder.Ascending?"Change to newest first":"Change to oldest first","aria-label":"Flip results order",className:$.flipButton,onClick:this.onChangeLogsSortOrder,children:E?"Flipping...":"Flip results order"})]}),Object(b.jsx)(m,{logRows:t,meta:s||[],dedupStrategy:L,dedupCount:H,hasUnescapedContent:P,forceEscape:B,showDetectedFields:z,onEscapeNewlines:this.onEscapeNewlines,clearDetectedFields:this.clearDetectedFields}),Object(b.jsxs)("div",{className:$.logsSection,children:[Object(b.jsx)("div",{className:$.logRows,children:Object(b.jsx)(d.LogRows,{logRows:t,deduplicatedRows:Q,dedupStrategy:L,getRowContext:this.props.getRowContext,highlighterExpressions:o,onClickFilterLabel:c,onClickFilterOutLabel:u,showContextToggle:f,showLabels:C,showTime:R,enableLogDetails:!0,forceEscape:B,wrapLogMessage:k,prettifyLogMessage:F,timeZone:h,getFieldLinks:v,logsSortOrder:N,showDetectedFields:z,onClickShowDetectedField:this.showDetectedField,onClickHideDetectedField:this.hideDetectedField})}),Object(b.jsx)(T,{logsSortOrder:N,visibleRange:null!=i?i:j,absoluteRange:j,timeZone:h,onChangeTime:x,loading:r,queries:null!=O?O:[],scrollToTopLogs:this.scrollToTopLogs,addResultsToCache:S,clearCache:w})]}),!r&&!q&&!p&&Object(b.jsxs)("div",{className:$.noData,children:["No logs found.",Object(b.jsx)(d.Button,{size:"xs",fill:"text",onClick:this.onClickScan,children:"Scan for older logs"})]}),p&&Object(b.jsxs)("div",{className:$.noData,children:[Object(b.jsx)("span",{children:U}),Object(b.jsx)(d.Button,{size:"xs",fill:"text",onClick:this.onClickStopScan,children:"Stop scan"})]})]})}}const z=Object(d.withTheme)(E),M=Object(d.stylesFactory)((e,t)=>({noData:r.css`
      > * {
        margin-left: 0.5em;
      }
    `,logOptions:r.css`
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      flex-wrap: wrap;
      background-color: ${e.colors.bg1};
      padding: ${e.spacing.sm} ${e.spacing.md};
      border-radius: ${e.border.radius.md};
      margin: ${e.spacing.md} 0 ${e.spacing.sm};
      border: 1px solid ${e.colors.border2};
    `,flipButton:r.css`
      margin: ${e.spacing.xs} 0 0 ${e.spacing.sm};
    `,radioButtons:r.css`
      margin: 0 ${e.spacing.sm};
    `,logsSection:r.css`
      display: flex;
      flex-direction: row;
      justify-content: space-between;
    `,logRows:r.css`
      overflow-x: ${t?"unset":"scroll"};
      overflow-y: visible;
      width: 100%;
    `,infoText:r.css`
      font-size: ${e.typography.size.sm};
      color: ${e.colors.textWeak};
    `}))},h1VQ:function(e,t,s){"use strict";s.d(t,"a",(function(){return l}));var n=s("q1tI"),i=s("vF1F"),o=s("kDLi"),r=s("nKUr");const a=e=>({metaContainer:i.css`
    flex: 1;
    color: ${e.colors.textWeak};
    margin-bottom: ${e.spacing.d};
    min-width: 30%;
    display: flex;
    flex-wrap: wrap;
  `,metaItem:i.css`
    margin-right: ${e.spacing.d};
    margin-top: ${e.spacing.xs};
    display: flex;
    align-items: baseline;

    .logs-meta-item__error {
      color: ${e.palette.red};
    }
  `,metaLabel:i.css`
    margin-right: calc(${e.spacing.d} / 2);
    font-size: ${e.typography.size.sm};
    font-weight: ${e.typography.weight.semibold};
  `,metaValue:i.css`
    font-family: ${e.typography.fontFamily.monospace};
    font-size: ${e.typography.size.sm};
  `}),c=Object(n.memo)((function(e){const t=Object(o.useStyles)(a),{label:s,value:n}=e;return Object(r.jsxs)("div",{className:t.metaItem,children:[s&&Object(r.jsxs)("span",{className:t.metaLabel,children:[s,":"]}),Object(r.jsx)("span",{className:t.metaValue,children:n})]})})),l=Object(n.memo)((function(e){const t=Object(o.useStyles)(a),{metaItems:s}=e;return Object(r.jsx)("div",{className:t.metaContainer,children:s.map((e,t)=>Object(r.jsx)(c,{label:e.label,value:e.value},`${t}-${e.label}`))})}))},"ir/c":function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));s("q1tI");var n=s("vF1F"),i=s("kDLi"),o=s("nKUr");const r=Object(i.stylesFactory)(e=>({containerMargin:n.css`
      margin-top: ${e.spacing.md};
    `}));function a(e){const t=Object(i.useTheme)(),s=r(t);return Object(o.jsx)("div",{className:s.containerMargin,children:Object(o.jsxs)(i.HorizontalGroup,{children:[!e.addQueryRowButtonHidden&&Object(o.jsx)(i.Button,{variant:"secondary","aria-label":"Add row button",onClick:e.onClickAddQueryRowButton,disabled:e.addQueryRowButtonDisabled,icon:"plus",children:"Add query"}),Object(o.jsx)(i.Button,{variant:"secondary","aria-label":"Rich history button",className:Object(n.cx)({"explore-active-button":e.richHistoryButtonActive}),onClick:e.onClickRichHistoryButton,icon:"history",children:"Query history"}),Object(o.jsx)(i.Button,{variant:"secondary","aria-label":"Query inspector button",className:Object(n.cx)({"explore-active-button":e.queryInspectorButtonActive}),onClick:e.onClickQueryInspectorButton,icon:"info-circle",children:"Inspector"})]})})}},kYjj:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));s("q1tI");var n,i,o=s("kDLi"),r=s("nKUr");function a(e){const{canToggleEditorModes:t,onClickToggleEditorMode:s,onClickToggleDisabled:a,onClickRemoveButton:c,isDisabled:l,isNotStarted:d,latency:u}=e;return Object(r.jsxs)("div",{className:"gf-form-inline flex-shrink-0",children:[t&&Object(r.jsx)("div",{className:"gf-form",children:Object(r.jsx)("button",{"aria-label":"Edit mode button",className:"gf-form-label gf-form-label--btn",onClick:s,children:n||(n=Object(r.jsx)(o.Icon,{name:"pen"}))})}),Object(r.jsx)("div",{className:"gf-form",children:Object(r.jsx)("button",{disabled:!0,className:"gf-form-label",title:"Query row latency",children:(h=u,(h/1e3).toFixed(1)+"s")})}),Object(r.jsx)("div",{className:"gf-form",children:Object(r.jsx)("button",{disabled:d,className:"gf-form-label gf-form-label--btn",onClick:a,title:l?"Enable query":"Disable query",children:Object(r.jsx)(o.Icon,{name:l?"eye-slash":"eye"})})}),Object(r.jsx)("div",{className:"gf-form",children:Object(r.jsx)("button",{className:"gf-form-label gf-form-label--btn",onClick:c,title:"Remove query",children:i||(i=Object(r.jsx)(o.Icon,{name:"minus"}))})})]});var h}},"kd/b":function(e,t,s){"use strict";var n=s("q1tI"),i=s("Obii"),o=s("kDLi"),r=s("nKUr");function a(e){const{onClick:t,isSynced:s}=e;return Object(r.jsx)(o.Tooltip,{content:()=>{const{isSynced:t}=e,s=t?"Unsync all views":"Sync all views to this time range";return Object(r.jsx)(r.Fragment,{children:s})},placement:"bottom",children:Object(r.jsx)(o.ToolbarButton,{icon:"link",variant:s?"active":"default","aria-label":s?"Synced times":"Unsynced times",onClick:t})})}var c=s("3Tvq"),l=s("LCjV");function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}function u(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}s.d(t,"a",(function(){return h}));class h extends n.Component{constructor(...e){super(...e),u(this,"onMoveTimePicker",e=>{const{range:t,onChangeTime:s,timeZone:n}=this.props,{from:o,to:r}=Object(l.a)(e,t);s({from:Object(i.dateTimeForTimeZone)(n,o),to:Object(i.dateTimeForTimeZone)(n,r)})}),u(this,"onMoveForward",()=>this.onMoveTimePicker(1)),u(this,"onMoveBack",()=>this.onMoveTimePicker(-1)),u(this,"onChangeTimePicker",e=>{const t=i.dateMath.isMathString(e.raw.from)?e.raw.from:e.from,s=i.dateMath.isMathString(e.raw.to)?e.raw.to:e.to;this.props.onChangeTime({from:t,to:s})}),u(this,"onZoom",()=>{const{range:e,onChangeTime:t,timeZone:s}=this.props,{from:n,to:o}=Object(l.b)(e,2);t({from:Object(i.dateTimeForTimeZone)(s,n),to:Object(i.dateTimeForTimeZone)(s,o)})})}render(){const{range:e,timeZone:t,splitted:s,syncedTimes:n,onChangeTimeSync:i,hideText:o,onChangeTimeZone:l}=this.props,u=s?Object(r.jsx)(a,{onClick:i,isSynced:n}):void 0,h={value:e,timeZone:t,onMoveBackward:this.onMoveBack,onMoveForward:this.onMoveForward,onZoom:this.onZoom,hideText:o};return Object(r.jsx)(c.a,d({},h,{timeSyncButton:u,isSynced:n,onChange:this.onChangeTimePicker,onChangeTimeZone:l}))}}},lMcC:function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));s("q1tI");var n=s("Wwog"),i=s("vF1F"),o=s("pQ8y"),r=s("nKUr");const a=Object(n.default)(()=>({logsEnter:i.css`
      label: logsEnter;
      position: absolute;
      opacity: 0;
      height: auto;
      width: 100%;
    `,logsEnterActive:i.css`
      label: logsEnterActive;
      opacity: 1;
      transition: opacity ${500}ms ease-out ${100}ms;
    `,logsExit:i.css`
      label: logsExit;
      position: absolute;
      opacity: 1;
      height: auto;
      width: 100%;
    `,logsExitActive:i.css`
      label: logsExitActive;
      opacity: 0;
      transition: opacity ${500}ms ease-out ${100}ms;
    `}));function c(e){const{visible:t,children:s}=e,n=a();return Object(r.jsx)(o.a,{in:t,mountOnEnter:!0,unmountOnExit:!0,timeout:600,classNames:{enter:n.logsEnter,enterActive:n.logsEnterActive,exit:n.logsExit,exitActive:n.logsExitActive},children:s})}},lz6F:function(e,t,s){"use strict";s("q1tI");var n,i=s("6y2Z"),o=s("kDLi"),r=s("Obii"),a=s("vF1F"),c=s("sQ2H"),l=s("/MKj"),d=s("Xc1M"),u=s("fSYD"),h=s("Jf/B"),p=s("nKUr");s.d(t,"a",(function(){return m}));const g=e=>({warningText:a.css`
    label: warningText;
    font-size: ${e.typography.bodySmall.fontSize};
    color: ${e.colors.text.secondary};
  `});const b={splitOpen:c.h},m=Object(l.connect)((function(e,{exploreId:t}){return{range:e.explore[t].range}}),b)((function(e){var t;const{dataFrames:s,range:a,splitOpen:c,withTraceView:l}=e,b=Object(d.b)(a,c),m=Object(o.useTheme2)(),f=Object(o.useStyles2)(g),j=Object(r.applyFieldOverrides)({fieldConfig:{defaults:{},overrides:[]},data:s,replaceVariables:e=>e,theme:m}),{nodes:x}=Object(h.a)(j),[v,y]=Object(i.a)(!1),O=l&&(null===(t=x[0])||void 0===t?void 0:t.length)>1e3?Object(p.jsxs)("span",{className:f.warningText,children:[" (",x[0].length," nodes, can be slow to load)"]}):null;return Object(p.jsx)(o.Collapse,{label:Object(p.jsxs)("span",{children:["Node graph",O," ",n||(n=Object(p.jsx)(o.Badge,{text:"Beta",color:"blue",icon:"rocket",tooltip:"This visualization is in beta"}))]}),collapsible:l,isOpen:!l||v,onToggle:l?()=>y():void 0,children:Object(p.jsx)("div",{style:{height:l?500:600},children:Object(p.jsx)(u.a,{dataFrames:j,getLinks:b})})})}))},nmUH:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));s("q1tI");var n=s("kDLi"),i=s("NPB1"),o=s("nKUr");function r(e){const{isSmall:t,loading:s,onRun:r,onChangeRefreshInterval:a,refreshInterval:c,showDropdown:l,isLive:d}=e,u=Object(i.a)().getValidIntervals(n.defaultIntervals);let h;return d?null:(t||(h=s?"Cancel":"Run query"),Object(o.jsx)(n.RefreshPicker,{onIntervalChanged:a,value:c,isLoading:s,text:h,intervals:u,isLive:d,onRefresh:()=>r(s),noIntervalPicker:!l,primary:!0}))}},sQnn:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));s("q1tI");var n=s("vF1F"),i=s("pQ8y"),o=s("kDLi"),r=s("nKUr");function a(e){const{start:t,pause:s,resume:n,isLive:a,isPaused:l,stop:d,splitted:u}=e,h=Object(o.useTheme)(),p=c(h),g=a&&!l?"active":"default",b=a?l?n:s:t;return Object(r.jsxs)(o.ButtonGroup,{children:[Object(r.jsx)(o.Tooltip,{content:a&&!l?Object(r.jsx)(r.Fragment,{children:"Pause the live stream"}):Object(r.jsx)(r.Fragment,{children:"Start live stream your logs"}),placement:"bottom",children:Object(r.jsx)(o.ToolbarButton,{iconOnly:u,variant:g,icon:!a||l?"play":"pause",onClick:b,children:a&&l?"Paused":"Live"})}),Object(r.jsx)(i.a,{mountOnEnter:!0,unmountOnExit:!0,timeout:100,in:a,classNames:{enter:p.stopButtonEnter,enterActive:p.stopButtonEnterActive,exit:p.stopButtonExit,exitActive:p.stopButtonExitActive},children:Object(r.jsx)(o.Tooltip,{content:Object(r.jsx)(r.Fragment,{children:"Stop and exit the live stream"}),placement:"bottom",children:Object(r.jsx)(o.ToolbarButton,{variant:g,onClick:d,icon:"square-shape"})})})]})}const c=Object(o.stylesFactory)(e=>({stopButtonEnter:n.css`
      label: stopButtonEnter;
      width: 0;
      opacity: 0;
      overflow: hidden;
    `,stopButtonEnterActive:n.css`
      label: stopButtonEnterActive;
      opacity: 1;
      width: 32px;
    `,stopButtonExit:n.css`
      label: stopButtonExit;
      width: 32px;
      opacity: 1;
      overflow: hidden;
    `,stopButtonExitActive:n.css`
      label: stopButtonExitActive;
      opacity: 0;
      width: 0;
    `}))},sguS:function(e,t,s){"use strict";(function(e){var n,i=s("q1tI"),o=s.n(i),r=s("0cfB"),a=s("vF1F"),c=s("ANjH"),l=s("/MKj"),d=s("jYz7"),u=s("Wwog"),h=s("Csm0"),p=s("kDLi"),g=s("Obii"),b=s("ajrG"),m=s("cAtN"),f=s("zLRG"),j=s("JW4h"),x=s("Mmix"),v=s("sQ2H"),y=s("CJUB"),O=s("vExC"),w=s("VVW4"),S=s("bkob"),C=s("TUgz"),T=s("1LJY"),R=s("ir/c"),I=s("aWEf"),k=s("WnTU"),F=s("lz6F"),L=s("QX5N"),D=s("UpVK"),N=s("nKUr");function E(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const z=Object(p.stylesFactory)(e=>({exploreMain:a.css`
      label: exploreMain;
      // Is needed for some transition animations to work.
      position: relative;
      margin-top: 21px;
    `,button:a.css`
      label: button;
      margin: 1em 4px 0 0;
    `,queryContainer:a.css`
      label: queryContainer;
      // Need to override normal css class and don't want to count on ordering of the classes in html.
      height: auto !important;
      flex: unset !important;
      padding: ${e.panelPadding}px;
    `}));var M;!function(e){e[e.RichHistory=0]="RichHistory",e[e.QueryInspector=1]="QueryInspector"}(M||(M={}));class B extends o.a.PureComponent{constructor(e){super(e),E(this,"onChangeTime",e=>{const{updateTimeRange:t,exploreId:s}=this.props;t({exploreId:s,rawRange:e})}),E(this,"onClickExample",e=>{this.props.setQueries(this.props.exploreId,[e])}),E(this,"onCellFilterAdded",e=>{const{value:t,key:s,operator:n}=e;n===I.a&&this.onClickFilterLabel(s,t),n===I.b&&this.onClickFilterOutLabel(s,t)}),E(this,"onClickFilterLabel",(e,t)=>{this.onModifyQueries({type:"ADD_FILTER",key:e,value:t})}),E(this,"onClickFilterOutLabel",(e,t)=>{this.onModifyQueries({type:"ADD_FILTER_OUT",key:e,value:t})}),E(this,"onClickAddQueryRowButton",()=>{const{exploreId:e,queryKeys:t}=this.props;this.props.addQueryRow(e,t.length)}),E(this,"onModifyQueries",(e,t)=>{const{datasourceInstance:s}=this.props;if(null!=s&&s.modifyQuery){const n=(e,t)=>s.modifyQuery(e,t);this.props.modifyQueries(this.props.exploreId,e,n,t)}}),E(this,"onResize",e=>{this.props.changeSize(this.props.exploreId,e)}),E(this,"onStartScanning",()=>{this.props.scanStart(this.props.exploreId)}),E(this,"onStopScanning",()=>{this.props.scanStopAction({exploreId:this.props.exploreId})}),E(this,"onUpdateTimeRange",e=>{const{exploreId:t,updateTimeRange:s}=this.props;s({exploreId:t,absoluteRange:e})}),E(this,"toggleShowRichHistory",()=>{this.setState(e=>({openDrawer:e.openDrawer===M.RichHistory?void 0:M.RichHistory}))}),E(this,"toggleShowQueryInspector",()=>{this.setState(e=>({openDrawer:e.openDrawer===M.QueryInspector?void 0:M.QueryInspector}))}),E(this,"getNodeGraphDataFrames",Object(u.default)(e=>e.filter(e=>{var t;return"nodeGraph"===(null===(t=e.meta)||void 0===t?void 0:t.preferredVisualisationType)}))),this.state={openDrawer:void 0}}renderEmptyState(){return n||(n=Object(N.jsx)("div",{className:"explore-container",children:Object(N.jsx)(C.a,{})}))}renderGraphPanel(e){const{graphResult:t,absoluteRange:s,timeZone:n,splitOpen:i,queryResponse:o,loading:r,theme:a}=this.props;return Object(N.jsx)(p.Collapse,{label:"Graph",loading:r,isOpen:!0,children:Object(N.jsx)(k.a,{data:t,height:400,width:e-2*a.panelPadding,tooltipDisplayMode:p.TooltipDisplayMode.Single,absoluteRange:s,timeZone:n,onUpdateTimeRange:this.onUpdateTimeRange,annotations:o.annotations,splitOpenFn:i})})}renderTablePanel(e){const{exploreId:t,datasourceInstance:s}=this.props;return Object(N.jsx)(f.a,{ariaLabel:h.a.pages.Explore.General.table,width:e,exploreId:t,onCellFilterAdded:null!=s&&s.modifyQuery?this.onCellFilterAdded:void 0})}renderLogsPanel(e){const{exploreId:t,syncedTimes:s,theme:n}=this.props;return Object(N.jsx)(b.a,{exploreId:t,syncedTimes:s,width:e-2*n.panelPadding,onClickFilterLabel:this.onClickFilterLabel,onClickFilterOutLabel:this.onClickFilterOutLabel,onStartScanning:this.onStartScanning,onStopScanning:this.onStopScanning})}renderNodeGraphPanel(){const{exploreId:e,showTrace:t,queryResponse:s}=this.props;return Object(N.jsx)(F.a,{dataFrames:this.getNodeGraphDataFrames(s.series),exploreId:e,withTraceView:t})}renderTraceViewPanel(){const{queryResponse:e,splitOpen:t,exploreId:s}=this.props,n=e.series.filter(e=>{var t;return"trace"===(null===(t=e.meta)||void 0===t?void 0:t.preferredVisualisationType)});return n.length&&Object(N.jsx)(D.a,{exploreId:s,dataFrames:n,splitOpenFn:t})}render(){const{datasourceInstance:e,datasourceMissing:t,exploreId:s,queryKeys:n,graphResult:i,queryResponse:o,isLive:r,theme:c,showMetrics:l,showTable:u,showLogs:h,showTrace:b,showNodeGraph:f}=this.props,{openDrawer:v}=this.state,y=z(c),O=o&&o.state!==g.LoadingState.NotStarted,w=v===M.RichHistory,C=v===M.QueryInspector;return Object(N.jsxs)(p.CustomScrollbar,{autoHeightMin:"100%",children:[Object(N.jsx)(S.a,{exploreId:s,onChangeTime:this.onChangeTime}),t?this.renderEmptyState():null,e&&Object(N.jsxs)("div",{className:"explore-container",children:[Object(N.jsxs)("div",{className:Object(a.cx)("panel-container",y.queryContainer),children:[Object(N.jsx)(m.a,{exploreId:s,queryKeys:n}),Object(N.jsx)(R.a,{addQueryRowButtonDisabled:r,addQueryRowButtonHidden:!1,richHistoryButtonActive:w,queryInspectorButtonActive:C,onClickAddQueryRowButton:this.onClickAddQueryRowButton,onClickRichHistoryButton:this.toggleShowRichHistory,onClickQueryInspectorButton:this.toggleShowQueryInspector}),Object(N.jsx)(L.a,{exploreId:s})]}),Object(N.jsx)(d.a,{onResize:this.onResize,disableHeight:!0,children:({width:e})=>0===e?null:Object(N.jsx)("main",{className:Object(a.cx)(y.exploreMain),style:{width:e},children:Object(N.jsxs)(p.ErrorBoundaryAlert,{children:[O&&Object(N.jsxs)(N.Fragment,{children:[l&&i&&Object(N.jsx)(p.ErrorBoundaryAlert,{children:this.renderGraphPanel(e)}),u&&Object(N.jsx)(p.ErrorBoundaryAlert,{children:this.renderTablePanel(e)}),h&&Object(N.jsx)(p.ErrorBoundaryAlert,{children:this.renderLogsPanel(e)}),f&&Object(N.jsx)(p.ErrorBoundaryAlert,{children:this.renderNodeGraphPanel()}),b&&Object(N.jsx)(p.ErrorBoundaryAlert,{children:this.renderTraceViewPanel()})]}),w&&Object(N.jsx)(j.a,{width:e,exploreId:s,onClose:this.toggleShowRichHistory}),C&&Object(N.jsx)(x.a,{exploreId:s,width:e,onClose:this.toggleShowQueryInspector})]})})})]})]})}}const $={changeSize:y.a,modifyQueries:w.h,scanStart:w.l,scanStopAction:w.m,setQueries:w.o,updateTimeRange:O.e,addQueryRow:w.a,splitOpen:v.h},q=Object(l.connect)((function(e,{exploreId:t}){const s=e.explore,{syncedTimes:n}=s,i=s[t],o=Object(T.a)(e.user),{datasourceInstance:r,datasourceMissing:a,queryKeys:c,isLive:l,graphResult:d,logsResult:u,showLogs:h,showMetrics:p,showTable:g,showTrace:b,absoluteRange:m,queryResponse:f,showNodeGraph:j,loading:x}=i;return{datasourceInstance:r,datasourceMissing:a,queryKeys:c,isLive:l,graphResult:d,logsResult:null!=u?u:void 0,absoluteRange:m,queryResponse:f,syncedTimes:n,timeZone:o,showLogs:h,showMetrics:p,showTable:g,showTrace:b,showNodeGraph:j,loading:x}}),$);t.a=Object(c.compose)(Object(r.hot)(e),q,p.withTheme)(B)}).call(this,s("3UD+")(e))},tLXD:function(e,t,s){"use strict";var n=s("q1tI");t.a=function(e){var t=Object(n.useRef)();return Object(n.useEffect)((function(){t.current=e})),t.current}},vGfD:function(e,t,s){"use strict";(function(e){var n=s("q1tI"),i=s("/MKj"),o=s("0cfB"),r=s("vF1F"),a=s("kDLi"),c=s("t8hP"),l=s("w9yp"),d=s("ljRM"),u=s("m257"),h=s("Xmxp"),p=s("iODs"),g=s("3SGO"),b=s("UvM7"),m=s("7oGG"),f=s("fD97"),j=s("VVW4"),x=s("xAj+"),v=s("nKUr");const y=Object(a.stylesFactory)((e,t)=>{const s=e.colors.bg2;return{queryCard:r.css`
      display: flex;
      flex-direction: column;
      border: 1px solid ${e.colors.border1};
      margin: ${e.spacing.sm} 0;
      background-color: ${s};
      border-radius: ${e.border.radius.sm};
      .starred {
        color: ${e.palette.orange};
      }
    `,cardRow:r.css`
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: ${e.spacing.sm};
      border-bottom: none;
      :first-of-type {
        border-bottom: 1px solid ${e.colors.border1};
        padding: ${e.spacing.xs} ${e.spacing.sm};
      }
      img {
        height: ${e.typography.size.base};
        max-width: ${e.typography.size.base};
        margin-right: ${e.spacing.sm};
      }
    `,datasourceContainer:r.css`
      display: flex;
      align-items: center;
      font-size: ${e.typography.size.sm};
      font-weight: ${e.typography.weight.semibold};
    `,queryActionButtons:r.css`
      max-width: ${"170px"};
      display: flex;
      justify-content: flex-end;
      font-size: ${e.typography.size.base};
      button {
        margin-left: ${e.spacing.sm};
      }
    `,queryContainer:r.css`
      font-weight: ${e.typography.weight.semibold};
      width: calc(100% - ${"240px"});
    `,queryRow:r.css`
      border-top: 1px solid ${e.colors.border1};
      word-break: break-all;
      padding: 4px 2px;
      :first-child {
        border-top: none;
        padding: 0 0 4px 0;
      }
    `,updateCommentContainer:r.css`
      width: calc(100% + ${"240px"});
      margin-top: ${e.spacing.sm};
    `,comment:r.css`
      overflow-wrap: break-word;
      font-size: ${e.typography.size.sm};
      font-weight: ${e.typography.weight.regular};
      margin-top: ${e.spacing.xs};
    `,commentButtonRow:r.css`
      > * {
        margin-right: ${e.spacing.sm};
      }
    `,textArea:r.css`
      width: 100%;
    `,runButton:r.css`
      max-width: ${"170px"};
      display: flex;
      justify-content: flex-end;
      button {
        height: auto;
        padding: ${e.spacing.xs} ${e.spacing.md};
        line-height: 1.4;
        span {
          white-space: normal !important;
        }
      }
    `}});const O={changeDatasource:f.a,updateRichHistory:m.d,setQueries:j.o};t.a=Object(o.hot)(e)(Object(i.connect)((function(e,{exploreId:t}){const s=e.explore,{datasourceInstance:n}=s[t];return{exploreId:t,datasourceInstance:n}}),O)((function(e){var t;const{query:s,dsImg:i,isRemoved:o,updateRichHistory:m,changeDatasource:f,exploreId:j,datasourceInstance:O,setQueries:w}=e,[S,C]=Object(n.useState)(!1),[T,R]=Object(n.useState)(s.comment),[I,k]=Object(n.useState)(void 0);Object(n.useEffect)(()=>{(async()=>{const e=await Object(c.getDataSourceSrv)().get(s.datasourceName);k(e)})()},[s.datasourceName]);const F=Object(a.useTheme)(),L=y(F,o),D=()=>{m(s.ts,"comment",T),C(!1)},N=()=>{C(!1),R(s.comment)},E=Object(v.jsxs)("div",{className:L.updateCommentContainer,"aria-label":T?"Update comment form":"Add comment form",children:[Object(v.jsx)(a.TextArea,{value:T,placeholder:T?void 0:"An optional description of what the query does.",onChange:e=>R(e.currentTarget.value),className:L.textArea}),Object(v.jsxs)("div",{className:L.commentButtonRow,children:[Object(v.jsx)(a.Button,{onClick:D,"aria-label":"Submit button",children:"Save comment"}),Object(v.jsx)(a.Button,{variant:"secondary",onClick:N,children:"Cancel"})]})]}),z=Object(v.jsxs)("div",{className:L.queryActionButtons,children:[Object(v.jsx)(a.IconButton,{name:"comment-alt",onClick:()=>C(!S),title:(null===(t=s.comment)||void 0===t?void 0:t.length)>0?"Edit comment":"Add comment"}),Object(v.jsx)(a.IconButton,{name:"copy",onClick:()=>{const e=s.queries.map(e=>Object(l.e)(e,I)).join("\n");Object(u.e)(e),Object(p.a)(Object(g.b)(Object(b.b)("Query copied to clipboard")))},title:"Copy query to clipboard"}),!o&&Object(v.jsx)(a.IconButton,{name:"share-alt",onClick:async()=>{const e=Object(l.f)(s);await Object(d.a)(e)},title:"Copy shortened link to clipboard"}),Object(v.jsx)(a.IconButton,{name:"trash-alt",title:"Delete query",onClick:()=>{s.starred?h.b.publish(new x.ShowConfirmModalEvent({title:"Delete",text:"Are you sure you want to permanently delete your starred query?",yesText:"Delete",icon:"trash-alt",onConfirm:()=>{m(s.ts,"delete"),Object(p.a)(Object(g.b)(Object(b.b)("Query deleted")))}})):(m(s.ts,"delete"),Object(p.a)(Object(g.b)(Object(b.b)("Query deleted"))))}}),Object(v.jsx)(a.IconButton,{name:s.starred?"favorite":"star",iconType:s.starred?"mono":"default",onClick:()=>{m(s.ts,"starred")},title:s.starred?"Unstar query":"Star query"})]});return Object(v.jsxs)("div",{className:L.queryCard,onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||e.ctrlKey)&&D(),"Escape"===e.key&&N()},children:[Object(v.jsxs)("div",{className:L.cardRow,children:[Object(v.jsxs)("div",{className:L.datasourceContainer,children:[Object(v.jsx)("img",{src:i,"aria-label":"Data source icon"}),Object(v.jsx)("div",{"aria-label":"Data source name",children:o?"Data source does not exist anymore":s.datasourceName})]}),z]}),Object(v.jsxs)("div",{className:Object(r.cx)(L.cardRow),children:[Object(v.jsxs)("div",{className:L.queryContainer,children:[s.queries.map((e,t)=>{const s=Object(l.e)(e,I);return Object(v.jsx)("div",{"aria-label":"Query text",className:L.queryRow,children:s},`${e}-${t}`)}),!S&&s.comment&&Object(v.jsx)("div",{"aria-label":"Query comment",className:L.comment,children:s.comment}),S&&E]}),!S&&Object(v.jsx)("div",{className:L.runButton,children:Object(v.jsx)(a.Button,{variant:"secondary",onClick:async()=>{const e=s.queries;s.datasourceName!==(null==O?void 0:O.name)?(await f(j,s.datasourceName,{importQueries:!0}),w(j,e)):w(j,e)},disabled:o,children:(null==O?void 0:O.name)===s.datasourceName?"Run query":"Switch data source and run query"})})]})]})})))}).call(this,s("3UD+")(e))},"x7/r":function(e,t,s){"use strict";s.d(t,"a",(function(){return l}));s("q1tI");var n=s("WGjm"),i=s("vF1F"),o=s("kDLi"),r=s("nKUr");const a=i.keyframes`
  0% {
    transform: translateY(400px);
  }

  100% {
    transform: translateY(0px);
  }
`,c=Object(o.stylesFactory)(e=>({container:i.css`
      position: fixed !important;
      bottom: 0;
      background: ${e.colors.background.primary};
      border-top: 1px solid ${e.colors.border.weak};
      margin: ${e.spacing(0,-2,0,-2)};
      box-shadow: ${e.shadows.z3};
      z-index: ${e.zIndex.sidemenu};
    `,drawerActive:i.css`
      opacity: 1;
      animation: 0.5s ease-out ${a};
    `,rzHandle:i.css`
      background: ${e.colors.secondary.main};
      transition: 0.3s background ease-in-out;
      position: relative;
      width: 200px !important;
      height: 7px !important;
      left: calc(50% - 100px) !important;
      top: -4px !important;
      cursor: grab;
      border-radius: 4px;
      &:hover {
        background: ${e.colors.secondary.shade};
      }
    `}));function l(e){const{width:t,children:s,onResize:a}=e,l=Object(o.useTheme2)(),d=c(l),u=t+31.5+"px";return Object(r.jsx)(n.Resizable,{className:Object(i.cx)(d.container,d.drawerActive),defaultSize:{width:u,height:"400px"},handleClasses:{top:d.rzHandle},enable:{top:!0,right:!1,bottom:!1,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},maxHeight:"100vh",maxWidth:u,minWidth:u,onResize:a,children:s})}},y2tl:function(e,t,s){"use strict";s.d(t,"a",(function(){return c}));var n=s("q1tI"),i=s("t8hP"),o=(s("Vw/f"),s("nKUr"));function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}function a(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class c extends n.PureComponent{constructor(...e){super(...e),a(this,"element",void 0),a(this,"component",void 0),a(this,"angularScope",void 0)}async componentDidMount(){if(!this.element)return;const{datasource:e,initialQuery:t,exploreEvents:s,range:n}=this.props,o=Object(i.getAngularLoader)(),a=r({datasource:e.name},t),c={ctrl:{datasource:e,target:a,range:n,refresh:()=>{setTimeout(()=>{var e,t,s,n;a.hide!==this.props.initialQuery.hide&&(a.hide=this.props.initialQuery.hide),null===(e=(t=this.props).onQueryChange)||void 0===e||e.call(t,a),null===(s=(n=this.props).onExecuteQuery)||void 0===s||s.call(n)},1)},onQueryChange:()=>{setTimeout(()=>{var e,t;null===(e=(t=this.props).onQueryChange)||void 0===e||e.call(t,a)},1)},events:s,panel:{datasource:e,targets:[a]},dashboard:{}}};this.component=o.load(this.element,c,'<plugin-component type="query-ctrl"> </plugin-component>'),this.angularScope=c.ctrl,setTimeout(()=>{var e,t,s,n;null===(e=(t=this.props).onQueryChange)||void 0===e||e.call(t,a),null===(s=(n=this.props).onExecuteQuery)||void 0===s||s.call(n)},1)}componentDidUpdate(e){const t=e.textEditModeEnabled!==this.props.textEditModeEnabled,s=e.error!==this.props.error;this.component&&(t&&this.angularScope&&this.angularScope.toggleEditorMode&&this.angularScope.toggleEditorMode(),this.angularScope&&(this.angularScope.range=this.props.range),(s||t)&&setTimeout(this.component.digest))}componentWillUnmount(){this.component&&this.component.destroy()}render(){return Object(o.jsx)("div",{className:"gf-form-query",ref:e=>this.element=e,style:{width:"100%"}})}}},zLRG:function(e,t,s){"use strict";(function(e){var n=s("q1tI"),i=s("0cfB"),o=s("/MKj"),r=s("kDLi"),a=s("sQ2H"),c=s("ZFWI"),l=s("eXZ6"),d=s("h1VQ"),u=s("Xc1M"),h=s("nKUr");const p={splitOpen:a.h},g=Object(o.connect)((function(e,{exploreId:t}){const s=e.explore[t],{loading:n,tableResult:i,range:o}=s;return{loading:!(i&&i.length>0)&&n,tableResult:i,range:o}}),p);class b extends n.PureComponent{getTableHeight(){const{tableResult:e}=this.props;return e&&0!==e.length?Math.max(Math.min(600,35*e.length)+35):200}render(){const{loading:e,onCellFilterAdded:t,tableResult:s,width:n,splitOpen:i,range:o,ariaLabel:a}=this.props,p=this.getTableHeight(),g=n-2*c.a.theme.panelPadding-l.j,b=null==s?void 0:s.length;if(s&&s.length)for(const e of s.fields)e.getLinks=t=>Object(u.a)({field:e,rowIndex:t.valueRowIndex,splitOpenFn:i,range:o});return Object(h.jsx)(r.Collapse,{label:"Table",loading:e,isOpen:!0,children:b?Object(h.jsx)(r.Table,{ariaLabel:a,data:s,width:g,height:p,onCellFilterAdded:t}):Object(h.jsx)(d.a,{metaItems:[{value:"0 series returned"}]})})}}t.a=Object(i.hot)(e)(g(b))}).call(this,s("3UD+")(e))}}]);
//# sourceMappingURL=explore.4bfd7b0ee99616560b7a.js.map