/*! For license information please see DashboardPage.4bfd7b0ee99616560b7a.js.LICENSE.txt */
(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{"3ISj":function(e,t,n){"use strict";var r=n("q1tI"),o=n("/MKj"),i=n("p1x6"),a=n("kDLi"),s=n("aWce"),l=n("NXk7"),c=n("GkHB"),d=n("Csm0"),u=n("Y8YH"),p=n("vF1F"),h=n("nKUr");const f=["link","children"];function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const g=e=>{const{link:t,linkInfo:n}=e,o=Object(r.useRef)(null),[i,s]=Object(r.useState)("invisible"),[l,c]=Object(r.useState)(0),u=y(e,l),f=Object(a.useStyles2)(e=>p.css`
        color: ${e.colors.text.primary};
      `);return Object(r.useLayoutEffect)(()=>{s(function(e){if(!e)return"invisible";const t=e.parentElement.getBoundingClientRect(),n=e.getBoundingClientRect();if(0===n.width)return"invisible";return t.left+n.width+10>window.innerWidth?"pull-left":"pull-right"}(o.current))},[u]),t.asDropdown?Object(h.jsx)(m,{link:t,"data-testid":d.a.components.DashboardLinks.dropDown,children:Object(h.jsxs)(h.Fragment,{children:[Object(h.jsxs)(a.ToolbarButton,{onClick:()=>c(Date.now()),className:Object(p.cx)("gf-form-label gf-form-label--dashlink",f),"data-placement":"bottom","data-toggle":"dropdown","aria-expanded":!!l,"aria-controls":"dropdown-list","aria-haspopup":"menu",children:[Object(h.jsx)(a.Icon,{"aria-hidden":!0,name:"bars",style:{marginRight:"4px"}}),Object(h.jsx)("span",{children:n.title})]}),Object(h.jsx)("ul",{id:"dropdown-list",className:"dropdown-menu "+i,role:"menu",ref:o,children:u.length>0&&u.map((e,n)=>Object(h.jsx)("li",{role:"none",children:Object(h.jsx)("a",{role:"menuitem",href:e.url,target:t.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":d.a.components.DashboardLinks.link,"aria-label":e.title+" dashboard",children:e.title})},`dashlinks-dropdown-item-${e.id}-${n}`))})]})},"dashlinks-dropdown"):Object(h.jsx)(h.Fragment,{children:u.length>0&&u.map((e,n)=>Object(h.jsx)(m,{link:t,"data-testid":d.a.components.DashboardLinks.container,children:Object(h.jsxs)("a",{className:"gf-form-label gf-form-label--dashlink",href:e.url,target:t.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":d.a.components.DashboardLinks.link,"aria-label":e.title+" dashboard",children:[Object(h.jsx)(a.Icon,{"aria-hidden":!0,name:"apps",style:{marginRight:"4px"}}),Object(h.jsx)("span",{children:e.title})]})},`dashlinks-list-item-${e.id}-${n}`))})},m=e=>{const{link:t,children:n}=e,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,f);return Object(h.jsxs)("div",b({},r,{className:"gf-form",children:[t.tooltip&&Object(h.jsx)(a.Tooltip,{content:t.tooltip,children:n}),!t.tooltip&&Object(h.jsx)(h.Fragment,{children:n})]}))},y=({link:e,dashboardId:t},n)=>{const{tags:r}=e,o=Object(u.a)(()=>async function(e,t={getBackendSrv:l.c}){return await t.getBackendSrv().search({tag:e,limit:100})}(r),[r,n]);return o.value?function(e,t,n,r={getLinkSrv:c.b,sanitize:s.c,sanitizeUrl:s.d}){return n.filter(t=>t.id!==e).map(e=>{const n=e.id,o=r.sanitize(e.title),i=r.getLinkSrv().getLinkUrl(b({},t,{url:e.url}));return{id:n,title:o,url:r.sanitizeUrl(i)}})}(t,e,o.value):[]};var O=n("+toN"),v=n("Zcyb"),j=n("xAj+");const S=({dashboard:e,links:t})=>{const n=Object(a.useForceUpdate)();return Object(v.a)(()=>{const t=e.events.subscribe(j.TimeRangeUpdatedEvent,n);return()=>t.unsubscribe()}),t.length?Object(h.jsx)(h.Fragment,{children:t.map((t,n)=>{const r=Object(c.b)().getAnchorInfo(t),o=`${t.title}-$${n}`;if("dashboards"===t.type)return Object(h.jsx)(g,{link:t,linkInfo:r,dashboardId:e.id},o);const i=Object(h.jsxs)("a",{className:"gf-form-label gf-form-label--dashlink",href:Object(s.d)(r.href),target:t.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":d.a.components.DashboardLinks.link,children:[Object(h.jsx)(a.Icon,{"aria-hidden":!0,name:O.b[t.icon],style:{marginRight:"4px"}}),Object(h.jsx)("span",{children:r.title})]});return Object(h.jsx)("div",{className:"gf-form","data-testid":d.a.components.DashboardLinks.container,children:t.tooltip?Object(h.jsx)(a.Tooltip,{content:r.tooltip,children:i}):i},o)})}):null};var x=n("Uuh2"),M=n("W22M");const w=({annotation:e,events:t,onEnabledChanged:n})=>{const[o,i]=Object(r.useState)(!1),s=Object(a.useStyles2)(k);return Object(r.useEffect)(()=>{const n=t.getStream(j.AnnotationQueryStarted).subscribe({next:t=>{t.payload===e&&i(!0)}}),r=t.getStream(j.AnnotationQueryFinished).subscribe({next:t=>{t.payload===e&&i(!1)}});return()=>{n.unsubscribe(),r.unsubscribe()}}),Object(h.jsx)("div",{className:s.annotation,children:Object(h.jsx)(a.InlineField,{label:e.name,disabled:o,children:Object(h.jsxs)(h.Fragment,{children:[Object(h.jsx)(a.InlineSwitch,{value:e.enable,onChange:()=>n(e),disabled:o}),Object(h.jsx)("div",{className:s.indicator,children:Object(h.jsx)(M.a,{loading:o,onCancel:()=>Object(x.b)().cancel(e)})})]})})},e.name)};function k(e){return{annotation:p.css`
      display: inline-block;
      margin-right: ${e.spacing(1)};

      .fa-caret-down {
        font-size: 75%;
        padding-left: ${e.spacing(1)};
      }

      .gf-form-inline .gf-form {
        margin-bottom: 0;
      }
    `,indicator:p.css`
      align-self: center;
      padding: 0 ${e.spacing(.5)};
    `}}const C=({annotations:e,onAnnotationChanged:t,events:n})=>{const[o,i]=Object(r.useState)([]);return Object(r.useEffect)(()=>{i(e.filter(e=>!0!==e.hide))},[e]),0===o.length?null:Object(h.jsx)(h.Fragment,{children:o.map(e=>Object(h.jsx)(w,{events:n,annotation:e,onEnabledChanged:t},e.name))})};var P,z,D=n("VBuW");n.d(t,"a",(function(){return B}));class R extends r.PureComponent{constructor(...e){var t,n,r;super(...e),r=e=>{for(let t=0;t<this.props.dashboard.annotations.list.length;t++){const n=this.props.dashboard.annotations.list[t];if(n.name===e.name){n.enable=!n.enable;break}}this.props.dashboard.startRefresh(),this.forceUpdate()},(n="onAnnotationStateChanged")in(t=this)?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r}render(){const{dashboard:e,variables:t,links:n,annotations:r}=this.props;return e.isSubMenuVisible()?Object(h.jsxs)("div",{className:"submenu-controls",children:[Object(h.jsx)("form",{"aria-label":"Template variables",className:T,children:Object(h.jsx)(D.a,{variables:t})}),Object(h.jsx)(C,{annotations:r,onAnnotationChanged:this.onAnnotationStateChanged,events:e.events}),P||(P=Object(h.jsx)("div",{className:"gf-form gf-form--grow"})),e&&Object(h.jsx)(S,{dashboard:e,links:n}),z||(z=Object(h.jsx)("div",{className:"clearfix"}))]}):null}}const T=p.css`
  display: flex;
  flex-wrap: wrap;
  display: contents;
`,B=Object(o.connect)(e=>({variables:Object(i.d)(e.templating.variables)}))(R);B.displayName="SubMenu"},"6iOD":function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}o.default=e,n&&n.set(e,o);return o}(n("q1tI")),i=d(n("17x9")),a=d(n("XaGS")),s=n("T0XP"),l=n("Qgwu"),c=d(n("fEyB"));function d(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function h(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=S(e);if(t){var o=S(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return v(this,n)}}function v(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?j(e):t}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=function(e){return Object.prototype.toString.call(e)};function w(e,t){return null==e?null:Array.isArray(e)?e:e[t]}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(d,e);var t,n,r,i=O(d);function d(){var e;g(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return x(j(e=i.call.apply(i,[this].concat(n))),"state",e.generateInitialState()),x(j(e),"onLayoutChange",(function(t){e.props.onLayoutChange(t,b(b({},e.props.layouts),{},x({},e.state.breakpoint,t)))})),e}return t=d,r=[{key:"getDerivedStateFromProps",value:function(e,t){if(!(0,a.default)(e.layouts,t.layouts)){var n=t.breakpoint,r=t.cols;return{layout:(0,l.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,n,n,r,e.compactType),layouts:e.layouts}}return null}}],(n=[{key:"generateInitialState",value:function(){var e=this.props,t=e.width,n=e.breakpoints,r=e.layouts,o=e.cols,i=(0,l.getBreakpointFromWidth)(n,t),a=(0,l.getColsFromBreakpoint)(i,o),s=!1===this.props.verticalCompact?null:this.props.compactType;return{layout:(0,l.findOrGenerateResponsiveLayout)(r,n,i,i,a,s),breakpoint:i,cols:a}}},{key:"componentDidUpdate",value:function(e){this.props.width==e.width&&this.props.breakpoint===e.breakpoint&&(0,a.default)(this.props.breakpoints,e.breakpoints)&&(0,a.default)(this.props.cols,e.cols)||this.onWidthChange(e)}},{key:"onWidthChange",value:function(e){var t=this.props,n=t.breakpoints,r=t.cols,o=t.layouts,i=t.compactType,a=this.props.breakpoint||(0,l.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,d=(0,l.getColsFromBreakpoint)(a,r),u=b({},o);if(c!==a||e.breakpoints!==n||e.cols!==r){c in u||(u[c]=(0,s.cloneLayout)(this.state.layout));var p=(0,l.findOrGenerateResponsiveLayout)(u,n,a,c,d,i);p=(0,s.synchronizeLayoutWithChildren)(p,this.props.children,d,i),u[a]=p,this.props.onLayoutChange(p,u),this.props.onBreakpointChange(a,d),this.setState({breakpoint:a,layout:p,cols:d})}var h=w(this.props.margin,a),f=w(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,h,d,f)}},{key:"render",value:function(){var e=this.props,t=(e.breakpoint,e.breakpoints,e.cols,e.layouts,e.margin),n=e.containerPadding,r=(e.onBreakpointChange,e.onLayoutChange,e.onWidthChange,h(e,["breakpoint","breakpoints","cols","layouts","margin","containerPadding","onBreakpointChange","onLayoutChange","onWidthChange"]));return o.createElement(c.default,p({},r,{margin:w(t,this.state.breakpoint),containerPadding:w(n,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}])&&m(t.prototype,n),r&&m(t,r),d}(o.Component);t.default=k,x(k,"propTypes",{breakpoint:i.default.string,breakpoints:i.default.object,cols:i.default.object,margin:i.default.oneOfType([i.default.array,i.default.object]),containerPadding:i.default.oneOfType([i.default.array,i.default.object]),layouts:function(e,t){if("[object Object]"!==M(e[t]))throw new Error("Layout property must be an object. Received: "+M(e[t]));Object.keys(e[t]).forEach((function(t){if(!(t in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,s.validateLayout)(e.layouts[t],"layouts."+t)}))},width:i.default.number.isRequired,onBreakpointChange:i.default.func,onLayoutChange:i.default.func,onWidthChange:i.default.func}),x(k,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],onBreakpointChange:s.noop,onLayoutChange:s.noop,onWidthChange:s.noop})},"8N4D":function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.matchesSelector=u,t.matchesSelectorAndParentsTo=function(e,t,n){var r=e;do{if(u(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1},t.addEvent=function(e,t,n,r){if(!e)return;var o=l({capture:!0},r);e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},t.removeEvent=function(e,t,n,r){if(!e)return;var o=l({capture:!0},r);e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},t.outerHeight=function(e){var t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,o.int)(n.borderTopWidth),t+=(0,o.int)(n.borderBottomWidth)},t.outerWidth=function(e){var t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,o.int)(n.borderLeftWidth),t+=(0,o.int)(n.borderRightWidth)},t.innerHeight=function(e){var t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,o.int)(n.paddingTop),t-=(0,o.int)(n.paddingBottom)},t.innerWidth=function(e){var t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,o.int)(n.paddingLeft),t-=(0,o.int)(n.paddingRight)},t.offsetXYFromParent=function(e,t,n){var r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-r.left)/n,i=(e.clientY+t.scrollTop-r.top)/n;return{x:o,y:i}},t.createCSSTransform=function(e,t){var n=p(e,t,"px");return c({},(0,i.browserPrefixToKey)("transform",i.default),n)},t.createSVGTransform=function(e,t){return p(e,t,"")},t.getTranslation=p,t.getTouch=function(e,t){return e.targetTouches&&(0,o.findInArray)(e.targetTouches,(function(e){return t===e.identifier}))||e.changedTouches&&(0,o.findInArray)(e.changedTouches,(function(e){return t===e.identifier}))},t.getTouchIdentifier=function(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier},t.addUserSelectStyles=function(e){if(!e)return;var t=e.getElementById("react-draggable-style-el");t||((t=e.createElement("style")).type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t));e.body&&h(e.body,"react-draggable-transparent-selection")},t.removeUserSelectStyles=function(e){if(!e)return;try{if(e.body&&f(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{var t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}},t.addClassName=h,t.removeClassName=f;var o=n("gbW8"),i=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=e[i]}n.default=e,t&&t.set(e,n);return n}(n("Ga4A"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d="";function u(e,t){return d||(d=(0,o.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],(function(t){return(0,o.isFunction)(e[t])}))),!!(0,o.isFunction)(e[d])&&e[d](t)}function p(e,t,n){var r=e.x,o=e.y,i="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){var a="".concat("string"==typeof t.x?t.x:t.x+n),s="".concat("string"==typeof t.y?t.y:t.y+n);i="translate(".concat(a,", ").concat(s,")")+i}return i}function h(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function f(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}},ChGz:function(e,t,n){e.exports=n("fEyB").default,e.exports.utils=n("T0XP"),e.exports.Responsive=n("6iOD").default,e.exports.Responsive.utils=n("Qgwu"),e.exports.WidthProvider=n("NmA4").default},"E5+Z":function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var r,o,i,a=n("q1tI"),s=n("kDLi"),l=n("Y8YH"),c=n("rYwU"),d=n("oWI4"),u=n("V8VS"),p=n("KO1d"),h=n("nKUr");const f=({panel:e,folderId:t,isUnsavedPrompt:n,onDismiss:f,onConfirm:b,onDiscard:g})=>{const[m,y]=Object(a.useState)(""),O=Object(l.a)(async()=>{const t=await Object(u.c)(e.libraryPanel.uid);return t.length>0?t.map(e=>e.title):[]},[e.libraryPanel.uid]),[v,j]=Object(a.useState)([]);Object(c.a)(()=>O.value?j(O.value.filter(e=>e.toLowerCase().includes(m.toLowerCase()))):j([]),300,[O.value,m]);const{saveLibraryPanel:S}=Object(d.a)(),x=Object(s.useStyles)(p.a),M=Object(a.useCallback)(()=>{g()},[g]),w=n?"Unsaved library panel changes":"Save library panel";return Object(h.jsx)(s.Modal,{title:w,icon:"save",onDismiss:f,isOpen:!0,children:Object(h.jsxs)("div",{children:[Object(h.jsxs)("p",{className:x.textInfo,children:["This update will affect ",Object(h.jsxs)("strong",{children:[e.libraryPanel.meta.connectedDashboards," ",1===e.libraryPanel.meta.connectedDashboards?"dashboard":"dashboards","."]}),"The following dashboards using the panel will be affected:"]}),Object(h.jsx)(s.Input,{className:x.dashboardSearch,prefix:r||(r=Object(h.jsx)(s.Icon,{name:"search"})),placeholder:"Search affected dashboards",value:m,onChange:e=>y(e.currentTarget.value)}),O.loading?o||(o=Object(h.jsx)("p",{children:"Loading connected dashboards..."})):Object(h.jsxs)("table",{className:x.myTable,children:[i||(i=Object(h.jsx)("thead",{children:Object(h.jsx)("tr",{children:Object(h.jsx)("th",{children:"Dashboard name"})})})),Object(h.jsx)("tbody",{children:v.map((e,t)=>Object(h.jsx)("tr",{children:Object(h.jsx)("td",{children:e})},"dashrow-"+t))})]}),Object(h.jsxs)(s.Modal.ButtonRow,{children:[Object(h.jsx)(s.Button,{variant:"secondary",onClick:f,fill:"outline",children:"Cancel"}),n&&Object(h.jsx)(s.Button,{variant:"destructive",onClick:M,children:"Discard"}),Object(h.jsx)(s.Button,{onClick:()=>{S(e,t).then(()=>{b()})},children:"Update all"})]})]})})}},"E56+":function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,n&&n.set(e,r);return r}(n("q1tI")),o=l(n("17x9")),i=l(n("jqYm")),a=n("H4m+"),s=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(e){var t,n;function o(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={width:t.props.width,height:t.props.height,propsWidth:t.props.width,propsHeight:t.props.height},t.onResize=function(e,n){var r=n.size;t.props.onResize?(null==e.persist||e.persist(),t.setState(r,(function(){return t.props.onResize&&t.props.onResize(e,n)}))):t.setState(r)},t}return n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,f(t,n),o.getDerivedStateFromProps=function(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null},o.prototype.render=function(){var e=this.props,t=e.handle,n=e.handleSize,o=(e.onResize,e.onResizeStart),a=e.onResizeStop,l=e.draggableOpts,c=e.minConstraints,u=e.maxConstraints,h=e.lockAspectRatio,f=e.axis,b=(e.width,e.height,e.resizeHandles),g=e.style,m=e.transformScale,y=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,s);return r.createElement(i.default,{axis:f,draggableOpts:l,handle:t,handleSize:n,height:this.state.height,lockAspectRatio:h,maxConstraints:u,minConstraints:c,onResizeStart:o,onResize:this.onResize,onResizeStop:a,resizeHandles:b,transformScale:m,width:this.state.width},r.createElement("div",d({},y,{style:p(p({},g),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},o}(r.Component);t.default=b,b.propTypes=p(p({},a.resizableProps),{},{children:o.default.element})},Fxvz:function(e,t){e.exports=["alignContent","MozAlignContent","WebkitAlignContent","MSAlignContent","OAlignContent","alignItems","MozAlignItems","WebkitAlignItems","MSAlignItems","OAlignItems","alignSelf","MozAlignSelf","WebkitAlignSelf","MSAlignSelf","OAlignSelf","all","MozAll","WebkitAll","MSAll","OAll","animation","MozAnimation","WebkitAnimation","MSAnimation","OAnimation","animationDelay","MozAnimationDelay","WebkitAnimationDelay","MSAnimationDelay","OAnimationDelay","animationDirection","MozAnimationDirection","WebkitAnimationDirection","MSAnimationDirection","OAnimationDirection","animationDuration","MozAnimationDuration","WebkitAnimationDuration","MSAnimationDuration","OAnimationDuration","animationFillMode","MozAnimationFillMode","WebkitAnimationFillMode","MSAnimationFillMode","OAnimationFillMode","animationIterationCount","MozAnimationIterationCount","WebkitAnimationIterationCount","MSAnimationIterationCount","OAnimationIterationCount","animationName","MozAnimationName","WebkitAnimationName","MSAnimationName","OAnimationName","animationPlayState","MozAnimationPlayState","WebkitAnimationPlayState","MSAnimationPlayState","OAnimationPlayState","animationTimingFunction","MozAnimationTimingFunction","WebkitAnimationTimingFunction","MSAnimationTimingFunction","OAnimationTimingFunction","backfaceVisibility","MozBackfaceVisibility","WebkitBackfaceVisibility","MSBackfaceVisibility","OBackfaceVisibility","background","MozBackground","WebkitBackground","MSBackground","OBackground","backgroundAttachment","MozBackgroundAttachment","WebkitBackgroundAttachment","MSBackgroundAttachment","OBackgroundAttachment","backgroundBlendMode","MozBackgroundBlendMode","WebkitBackgroundBlendMode","MSBackgroundBlendMode","OBackgroundBlendMode","backgroundClip","MozBackgroundClip","WebkitBackgroundClip","MSBackgroundClip","OBackgroundClip","backgroundColor","MozBackgroundColor","WebkitBackgroundColor","MSBackgroundColor","OBackgroundColor","backgroundImage","MozBackgroundImage","WebkitBackgroundImage","MSBackgroundImage","OBackgroundImage","backgroundOrigin","MozBackgroundOrigin","WebkitBackgroundOrigin","MSBackgroundOrigin","OBackgroundOrigin","backgroundPosition","MozBackgroundPosition","WebkitBackgroundPosition","MSBackgroundPosition","OBackgroundPosition","backgroundRepeat","MozBackgroundRepeat","WebkitBackgroundRepeat","MSBackgroundRepeat","OBackgroundRepeat","backgroundSize","MozBackgroundSize","WebkitBackgroundSize","MSBackgroundSize","OBackgroundSize","blockSize","MozBlockSize","WebkitBlockSize","MSBlockSize","OBlockSize","border","MozBorder","WebkitBorder","MSBorder","OBorder","borderBlockEnd","MozBorderBlockEnd","WebkitBorderBlockEnd","MSBorderBlockEnd","OBorderBlockEnd","borderBlockEndColor","MozBorderBlockEndColor","WebkitBorderBlockEndColor","MSBorderBlockEndColor","OBorderBlockEndColor","borderBlockEndStyle","MozBorderBlockEndStyle","WebkitBorderBlockEndStyle","MSBorderBlockEndStyle","OBorderBlockEndStyle","borderBlockEndWidth","MozBorderBlockEndWidth","WebkitBorderBlockEndWidth","MSBorderBlockEndWidth","OBorderBlockEndWidth","borderBlockStart","MozBorderBlockStart","WebkitBorderBlockStart","MSBorderBlockStart","OBorderBlockStart","borderBlockStartColor","MozBorderBlockStartColor","WebkitBorderBlockStartColor","MSBorderBlockStartColor","OBorderBlockStartColor","borderBlockStartStyle","MozBorderBlockStartStyle","WebkitBorderBlockStartStyle","MSBorderBlockStartStyle","OBorderBlockStartStyle","borderBlockStartWidth","MozBorderBlockStartWidth","WebkitBorderBlockStartWidth","MSBorderBlockStartWidth","OBorderBlockStartWidth","borderBottom","MozBorderBottom","WebkitBorderBottom","MSBorderBottom","OBorderBottom","borderBottomColor","MozBorderBottomColor","WebkitBorderBottomColor","MSBorderBottomColor","OBorderBottomColor","borderBottomLeftRadius","MozBorderBottomLeftRadius","WebkitBorderBottomLeftRadius","MSBorderBottomLeftRadius","OBorderBottomLeftRadius","borderBottomRightRadius","MozBorderBottomRightRadius","WebkitBorderBottomRightRadius","MSBorderBottomRightRadius","OBorderBottomRightRadius","borderBottomStyle","MozBorderBottomStyle","WebkitBorderBottomStyle","MSBorderBottomStyle","OBorderBottomStyle","borderBottomWidth","MozBorderBottomWidth","WebkitBorderBottomWidth","MSBorderBottomWidth","OBorderBottomWidth","borderCollapse","MozBorderCollapse","WebkitBorderCollapse","MSBorderCollapse","OBorderCollapse","borderColor","MozBorderColor","WebkitBorderColor","MSBorderColor","OBorderColor","borderImage","MozBorderImage","WebkitBorderImage","MSBorderImage","OBorderImage","borderImageOutset","MozBorderImageOutset","WebkitBorderImageOutset","MSBorderImageOutset","OBorderImageOutset","borderImageRepeat","MozBorderImageRepeat","WebkitBorderImageRepeat","MSBorderImageRepeat","OBorderImageRepeat","borderImageSlice","MozBorderImageSlice","WebkitBorderImageSlice","MSBorderImageSlice","OBorderImageSlice","borderImageSource","MozBorderImageSource","WebkitBorderImageSource","MSBorderImageSource","OBorderImageSource","borderImageWidth","MozBorderImageWidth","WebkitBorderImageWidth","MSBorderImageWidth","OBorderImageWidth","borderInlineEnd","MozBorderInlineEnd","WebkitBorderInlineEnd","MSBorderInlineEnd","OBorderInlineEnd","borderInlineEndColor","MozBorderInlineEndColor","WebkitBorderInlineEndColor","MSBorderInlineEndColor","OBorderInlineEndColor","borderInlineEndStyle","MozBorderInlineEndStyle","WebkitBorderInlineEndStyle","MSBorderInlineEndStyle","OBorderInlineEndStyle","borderInlineEndWidth","MozBorderInlineEndWidth","WebkitBorderInlineEndWidth","MSBorderInlineEndWidth","OBorderInlineEndWidth","borderInlineStart","MozBorderInlineStart","WebkitBorderInlineStart","MSBorderInlineStart","OBorderInlineStart","borderInlineStartColor","MozBorderInlineStartColor","WebkitBorderInlineStartColor","MSBorderInlineStartColor","OBorderInlineStartColor","borderInlineStartStyle","MozBorderInlineStartStyle","WebkitBorderInlineStartStyle","MSBorderInlineStartStyle","OBorderInlineStartStyle","borderInlineStartWidth","MozBorderInlineStartWidth","WebkitBorderInlineStartWidth","MSBorderInlineStartWidth","OBorderInlineStartWidth","borderLeft","MozBorderLeft","WebkitBorderLeft","MSBorderLeft","OBorderLeft","borderLeftColor","MozBorderLeftColor","WebkitBorderLeftColor","MSBorderLeftColor","OBorderLeftColor","borderLeftStyle","MozBorderLeftStyle","WebkitBorderLeftStyle","MSBorderLeftStyle","OBorderLeftStyle","borderLeftWidth","MozBorderLeftWidth","WebkitBorderLeftWidth","MSBorderLeftWidth","OBorderLeftWidth","borderRadius","MozBorderRadius","WebkitBorderRadius","MSBorderRadius","OBorderRadius","borderRight","MozBorderRight","WebkitBorderRight","MSBorderRight","OBorderRight","borderRightColor","MozBorderRightColor","WebkitBorderRightColor","MSBorderRightColor","OBorderRightColor","borderRightStyle","MozBorderRightStyle","WebkitBorderRightStyle","MSBorderRightStyle","OBorderRightStyle","borderRightWidth","MozBorderRightWidth","WebkitBorderRightWidth","MSBorderRightWidth","OBorderRightWidth","borderSpacing","MozBorderSpacing","WebkitBorderSpacing","MSBorderSpacing","OBorderSpacing","borderStyle","MozBorderStyle","WebkitBorderStyle","MSBorderStyle","OBorderStyle","borderTop","MozBorderTop","WebkitBorderTop","MSBorderTop","OBorderTop","borderTopColor","MozBorderTopColor","WebkitBorderTopColor","MSBorderTopColor","OBorderTopColor","borderTopLeftRadius","MozBorderTopLeftRadius","WebkitBorderTopLeftRadius","MSBorderTopLeftRadius","OBorderTopLeftRadius","borderTopRightRadius","MozBorderTopRightRadius","WebkitBorderTopRightRadius","MSBorderTopRightRadius","OBorderTopRightRadius","borderTopStyle","MozBorderTopStyle","WebkitBorderTopStyle","MSBorderTopStyle","OBorderTopStyle","borderTopWidth","MozBorderTopWidth","WebkitBorderTopWidth","MSBorderTopWidth","OBorderTopWidth","borderWidth","MozBorderWidth","WebkitBorderWidth","MSBorderWidth","OBorderWidth","bottom","MozBottom","WebkitBottom","MSBottom","OBottom","boxDecorationBreak","MozBoxDecorationBreak","WebkitBoxDecorationBreak","MSBoxDecorationBreak","OBoxDecorationBreak","boxShadow","MozBoxShadow","WebkitBoxShadow","MSBoxShadow","OBoxShadow","boxSizing","MozBoxSizing","WebkitBoxSizing","MSBoxSizing","OBoxSizing","breakAfter","MozBreakAfter","WebkitBreakAfter","MSBreakAfter","OBreakAfter","breakBefore","MozBreakBefore","WebkitBreakBefore","MSBreakBefore","OBreakBefore","breakInside","MozBreakInside","WebkitBreakInside","MSBreakInside","OBreakInside","captionSide","MozCaptionSide","WebkitCaptionSide","MSCaptionSide","OCaptionSide","caretColor","MozCaretColor","WebkitCaretColor","MSCaretColor","OCaretColor","ch","MozCh","WebkitCh","MSCh","OCh","clear","MozClear","WebkitClear","MSClear","OClear","clip","MozClip","WebkitClip","MSClip","OClip","clipPath","MozClipPath","WebkitClipPath","MSClipPath","OClipPath","cm","MozCm","WebkitCm","MSCm","OCm","color","MozColor","WebkitColor","MSColor","OColor","columnCount","MozColumnCount","WebkitColumnCount","MSColumnCount","OColumnCount","columnFill","MozColumnFill","WebkitColumnFill","MSColumnFill","OColumnFill","columnGap","MozColumnGap","WebkitColumnGap","MSColumnGap","OColumnGap","columnRule","MozColumnRule","WebkitColumnRule","MSColumnRule","OColumnRule","columnRuleColor","MozColumnRuleColor","WebkitColumnRuleColor","MSColumnRuleColor","OColumnRuleColor","columnRuleStyle","MozColumnRuleStyle","WebkitColumnRuleStyle","MSColumnRuleStyle","OColumnRuleStyle","columnRuleWidth","MozColumnRuleWidth","WebkitColumnRuleWidth","MSColumnRuleWidth","OColumnRuleWidth","columnSpan","MozColumnSpan","WebkitColumnSpan","MSColumnSpan","OColumnSpan","columnWidth","MozColumnWidth","WebkitColumnWidth","MSColumnWidth","OColumnWidth","columns","MozColumns","WebkitColumns","MSColumns","OColumns","content","MozContent","WebkitContent","MSContent","OContent","counterIncrement","MozCounterIncrement","WebkitCounterIncrement","MSCounterIncrement","OCounterIncrement","counterReset","MozCounterReset","WebkitCounterReset","MSCounterReset","OCounterReset","cursor","MozCursor","WebkitCursor","MSCursor","OCursor","deg","MozDeg","WebkitDeg","MSDeg","ODeg","direction","MozDirection","WebkitDirection","MSDirection","ODirection","display","MozDisplay","WebkitDisplay","MSDisplay","ODisplay","dpcm","MozDpcm","WebkitDpcm","MSDpcm","ODpcm","dpi","MozDpi","WebkitDpi","MSDpi","ODpi","dppx","MozDppx","WebkitDppx","MSDppx","ODppx","em","MozEm","WebkitEm","MSEm","OEm","emptyCells","MozEmptyCells","WebkitEmptyCells","MSEmptyCells","OEmptyCells","ex","MozEx","WebkitEx","MSEx","OEx","filter","MozFilter","WebkitFilter","MSFilter","OFilter","flexBasis","MozFlexBasis","WebkitFlexBasis","MSFlexBasis","OFlexBasis","flexDirection","MozFlexDirection","WebkitFlexDirection","MSFlexDirection","OFlexDirection","flexFlow","MozFlexFlow","WebkitFlexFlow","MSFlexFlow","OFlexFlow","flexGrow","MozFlexGrow","WebkitFlexGrow","MSFlexGrow","OFlexGrow","flexShrink","MozFlexShrink","WebkitFlexShrink","MSFlexShrink","OFlexShrink","flexWrap","MozFlexWrap","WebkitFlexWrap","MSFlexWrap","OFlexWrap","float","MozFloat","WebkitFloat","MSFloat","OFloat","font","MozFont","WebkitFont","MSFont","OFont","fontFamily","MozFontFamily","WebkitFontFamily","MSFontFamily","OFontFamily","fontFeatureSettings","MozFontFeatureSettings","WebkitFontFeatureSettings","MSFontFeatureSettings","OFontFeatureSettings","fontKerning","MozFontKerning","WebkitFontKerning","MSFontKerning","OFontKerning","fontLanguageOverride","MozFontLanguageOverride","WebkitFontLanguageOverride","MSFontLanguageOverride","OFontLanguageOverride","fontSize","MozFontSize","WebkitFontSize","MSFontSize","OFontSize","fontSizeAdjust","MozFontSizeAdjust","WebkitFontSizeAdjust","MSFontSizeAdjust","OFontSizeAdjust","fontStretch","MozFontStretch","WebkitFontStretch","MSFontStretch","OFontStretch","fontStyle","MozFontStyle","WebkitFontStyle","MSFontStyle","OFontStyle","fontSynthesis","MozFontSynthesis","WebkitFontSynthesis","MSFontSynthesis","OFontSynthesis","fontVariant","MozFontVariant","WebkitFontVariant","MSFontVariant","OFontVariant","fontVariantAlternates","MozFontVariantAlternates","WebkitFontVariantAlternates","MSFontVariantAlternates","OFontVariantAlternates","fontVariantCaps","MozFontVariantCaps","WebkitFontVariantCaps","MSFontVariantCaps","OFontVariantCaps","fontVariantEastAsian","MozFontVariantEastAsian","WebkitFontVariantEastAsian","MSFontVariantEastAsian","OFontVariantEastAsian","fontVariantLigatures","MozFontVariantLigatures","WebkitFontVariantLigatures","MSFontVariantLigatures","OFontVariantLigatures","fontVariantNumeric","MozFontVariantNumeric","WebkitFontVariantNumeric","MSFontVariantNumeric","OFontVariantNumeric","fontVariantPosition","MozFontVariantPosition","WebkitFontVariantPosition","MSFontVariantPosition","OFontVariantPosition","fontWeight","MozFontWeight","WebkitFontWeight","MSFontWeight","OFontWeight","fr","MozFr","WebkitFr","MSFr","OFr","grad","MozGrad","WebkitGrad","MSGrad","OGrad","grid","MozGrid","WebkitGrid","MSGrid","OGrid","gridArea","MozGridArea","WebkitGridArea","MSGridArea","OGridArea","gridAutoColumns","MozGridAutoColumns","WebkitGridAutoColumns","MSGridAutoColumns","OGridAutoColumns","gridAutoFlow","MozGridAutoFlow","WebkitGridAutoFlow","MSGridAutoFlow","OGridAutoFlow","gridAutoRows","MozGridAutoRows","WebkitGridAutoRows","MSGridAutoRows","OGridAutoRows","gridColumn","MozGridColumn","WebkitGridColumn","MSGridColumn","OGridColumn","gridColumnEnd","MozGridColumnEnd","WebkitGridColumnEnd","MSGridColumnEnd","OGridColumnEnd","gridColumnGap","MozGridColumnGap","WebkitGridColumnGap","MSGridColumnGap","OGridColumnGap","gridColumnStart","MozGridColumnStart","WebkitGridColumnStart","MSGridColumnStart","OGridColumnStart","gridGap","MozGridGap","WebkitGridGap","MSGridGap","OGridGap","gridRow","MozGridRow","WebkitGridRow","MSGridRow","OGridRow","gridRowEnd","MozGridRowEnd","WebkitGridRowEnd","MSGridRowEnd","OGridRowEnd","gridRowGap","MozGridRowGap","WebkitGridRowGap","MSGridRowGap","OGridRowGap","gridRowStart","MozGridRowStart","WebkitGridRowStart","MSGridRowStart","OGridRowStart","gridTemplate","MozGridTemplate","WebkitGridTemplate","MSGridTemplate","OGridTemplate","gridTemplateAreas","MozGridTemplateAreas","WebkitGridTemplateAreas","MSGridTemplateAreas","OGridTemplateAreas","gridTemplateColumns","MozGridTemplateColumns","WebkitGridTemplateColumns","MSGridTemplateColumns","OGridTemplateColumns","gridTemplateRows","MozGridTemplateRows","WebkitGridTemplateRows","MSGridTemplateRows","OGridTemplateRows","height","MozHeight","WebkitHeight","MSHeight","OHeight","hyphens","MozHyphens","WebkitHyphens","MSHyphens","OHyphens","hz","MozHz","WebkitHz","MSHz","OHz","imageOrientation","MozImageOrientation","WebkitImageOrientation","MSImageOrientation","OImageOrientation","imageRendering","MozImageRendering","WebkitImageRendering","MSImageRendering","OImageRendering","imageResolution","MozImageResolution","WebkitImageResolution","MSImageResolution","OImageResolution","imeMode","MozImeMode","WebkitImeMode","MSImeMode","OImeMode","in","MozIn","WebkitIn","MSIn","OIn","inherit","MozInherit","WebkitInherit","MSInherit","OInherit","initial","MozInitial","WebkitInitial","MSInitial","OInitial","inlineSize","MozInlineSize","WebkitInlineSize","MSInlineSize","OInlineSize","isolation","MozIsolation","WebkitIsolation","MSIsolation","OIsolation","justifyContent","MozJustifyContent","WebkitJustifyContent","MSJustifyContent","OJustifyContent","khz","MozKhz","WebkitKhz","MSKhz","OKhz","left","MozLeft","WebkitLeft","MSLeft","OLeft","letterSpacing","MozLetterSpacing","WebkitLetterSpacing","MSLetterSpacing","OLetterSpacing","lineBreak","MozLineBreak","WebkitLineBreak","MSLineBreak","OLineBreak","lineHeight","MozLineHeight","WebkitLineHeight","MSLineHeight","OLineHeight","listStyle","MozListStyle","WebkitListStyle","MSListStyle","OListStyle","listStyleImage","MozListStyleImage","WebkitListStyleImage","MSListStyleImage","OListStyleImage","listStylePosition","MozListStylePosition","WebkitListStylePosition","MSListStylePosition","OListStylePosition","listStyleType","MozListStyleType","WebkitListStyleType","MSListStyleType","OListStyleType","margin","MozMargin","WebkitMargin","MSMargin","OMargin","marginBlockEnd","MozMarginBlockEnd","WebkitMarginBlockEnd","MSMarginBlockEnd","OMarginBlockEnd","marginBlockStart","MozMarginBlockStart","WebkitMarginBlockStart","MSMarginBlockStart","OMarginBlockStart","marginBottom","MozMarginBottom","WebkitMarginBottom","MSMarginBottom","OMarginBottom","marginInlineEnd","MozMarginInlineEnd","WebkitMarginInlineEnd","MSMarginInlineEnd","OMarginInlineEnd","marginInlineStart","MozMarginInlineStart","WebkitMarginInlineStart","MSMarginInlineStart","OMarginInlineStart","marginLeft","MozMarginLeft","WebkitMarginLeft","MSMarginLeft","OMarginLeft","marginRight","MozMarginRight","WebkitMarginRight","MSMarginRight","OMarginRight","marginTop","MozMarginTop","WebkitMarginTop","MSMarginTop","OMarginTop","mask","MozMask","WebkitMask","MSMask","OMask","maskClip","MozMaskClip","WebkitMaskClip","MSMaskClip","OMaskClip","maskComposite","MozMaskComposite","WebkitMaskComposite","MSMaskComposite","OMaskComposite","maskImage","MozMaskImage","WebkitMaskImage","MSMaskImage","OMaskImage","maskMode","MozMaskMode","WebkitMaskMode","MSMaskMode","OMaskMode","maskOrigin","MozMaskOrigin","WebkitMaskOrigin","MSMaskOrigin","OMaskOrigin","maskPosition","MozMaskPosition","WebkitMaskPosition","MSMaskPosition","OMaskPosition","maskRepeat","MozMaskRepeat","WebkitMaskRepeat","MSMaskRepeat","OMaskRepeat","maskSize","MozMaskSize","WebkitMaskSize","MSMaskSize","OMaskSize","maskType","MozMaskType","WebkitMaskType","MSMaskType","OMaskType","maxHeight","MozMaxHeight","WebkitMaxHeight","MSMaxHeight","OMaxHeight","maxWidth","MozMaxWidth","WebkitMaxWidth","MSMaxWidth","OMaxWidth","minBlockSize","MozMinBlockSize","WebkitMinBlockSize","MSMinBlockSize","OMinBlockSize","minHeight","MozMinHeight","WebkitMinHeight","MSMinHeight","OMinHeight","minInlineSize","MozMinInlineSize","WebkitMinInlineSize","MSMinInlineSize","OMinInlineSize","minWidth","MozMinWidth","WebkitMinWidth","MSMinWidth","OMinWidth","mixBlendMode","MozMixBlendMode","WebkitMixBlendMode","MSMixBlendMode","OMixBlendMode","mm","MozMm","WebkitMm","MSMm","OMm","ms","MozMs","WebkitMs","MSMs","OMs","objectFit","MozObjectFit","WebkitObjectFit","MSObjectFit","OObjectFit","objectPosition","MozObjectPosition","WebkitObjectPosition","MSObjectPosition","OObjectPosition","offsetBlockEnd","MozOffsetBlockEnd","WebkitOffsetBlockEnd","MSOffsetBlockEnd","OOffsetBlockEnd","offsetBlockStart","MozOffsetBlockStart","WebkitOffsetBlockStart","MSOffsetBlockStart","OOffsetBlockStart","offsetInlineEnd","MozOffsetInlineEnd","WebkitOffsetInlineEnd","MSOffsetInlineEnd","OOffsetInlineEnd","offsetInlineStart","MozOffsetInlineStart","WebkitOffsetInlineStart","MSOffsetInlineStart","OOffsetInlineStart","opacity","MozOpacity","WebkitOpacity","MSOpacity","OOpacity","order","MozOrder","WebkitOrder","MSOrder","OOrder","orphans","MozOrphans","WebkitOrphans","MSOrphans","OOrphans","outline","MozOutline","WebkitOutline","MSOutline","OOutline","outlineColor","MozOutlineColor","WebkitOutlineColor","MSOutlineColor","OOutlineColor","outlineOffset","MozOutlineOffset","WebkitOutlineOffset","MSOutlineOffset","OOutlineOffset","outlineStyle","MozOutlineStyle","WebkitOutlineStyle","MSOutlineStyle","OOutlineStyle","outlineWidth","MozOutlineWidth","WebkitOutlineWidth","MSOutlineWidth","OOutlineWidth","overflow","MozOverflow","WebkitOverflow","MSOverflow","OOverflow","overflowWrap","MozOverflowWrap","WebkitOverflowWrap","MSOverflowWrap","OOverflowWrap","overflowX","MozOverflowX","WebkitOverflowX","MSOverflowX","OOverflowX","overflowY","MozOverflowY","WebkitOverflowY","MSOverflowY","OOverflowY","padding","MozPadding","WebkitPadding","MSPadding","OPadding","paddingBlockEnd","MozPaddingBlockEnd","WebkitPaddingBlockEnd","MSPaddingBlockEnd","OPaddingBlockEnd","paddingBlockStart","MozPaddingBlockStart","WebkitPaddingBlockStart","MSPaddingBlockStart","OPaddingBlockStart","paddingBottom","MozPaddingBottom","WebkitPaddingBottom","MSPaddingBottom","OPaddingBottom","paddingInlineEnd","MozPaddingInlineEnd","WebkitPaddingInlineEnd","MSPaddingInlineEnd","OPaddingInlineEnd","paddingInlineStart","MozPaddingInlineStart","WebkitPaddingInlineStart","MSPaddingInlineStart","OPaddingInlineStart","paddingLeft","MozPaddingLeft","WebkitPaddingLeft","MSPaddingLeft","OPaddingLeft","paddingRight","MozPaddingRight","WebkitPaddingRight","MSPaddingRight","OPaddingRight","paddingTop","MozPaddingTop","WebkitPaddingTop","MSPaddingTop","OPaddingTop","pageBreakAfter","MozPageBreakAfter","WebkitPageBreakAfter","MSPageBreakAfter","OPageBreakAfter","pageBreakBefore","MozPageBreakBefore","WebkitPageBreakBefore","MSPageBreakBefore","OPageBreakBefore","pageBreakInside","MozPageBreakInside","WebkitPageBreakInside","MSPageBreakInside","OPageBreakInside","pc","MozPc","WebkitPc","MSPc","OPc","perspective","MozPerspective","WebkitPerspective","MSPerspective","OPerspective","perspectiveOrigin","MozPerspectiveOrigin","WebkitPerspectiveOrigin","MSPerspectiveOrigin","OPerspectiveOrigin","pointerEvents","MozPointerEvents","WebkitPointerEvents","MSPointerEvents","OPointerEvents","position","MozPosition","WebkitPosition","MSPosition","OPosition","pt","MozPt","WebkitPt","MSPt","OPt","px","MozPx","WebkitPx","MSPx","OPx","q","MozQ","WebkitQ","MSQ","OQ","quotes","MozQuotes","WebkitQuotes","MSQuotes","OQuotes","rad","MozRad","WebkitRad","MSRad","ORad","rem","MozRem","WebkitRem","MSRem","ORem","resize","MozResize","WebkitResize","MSResize","OResize","revert","MozRevert","WebkitRevert","MSRevert","ORevert","right","MozRight","WebkitRight","MSRight","ORight","rubyAlign","MozRubyAlign","WebkitRubyAlign","MSRubyAlign","ORubyAlign","rubyMerge","MozRubyMerge","WebkitRubyMerge","MSRubyMerge","ORubyMerge","rubyPosition","MozRubyPosition","WebkitRubyPosition","MSRubyPosition","ORubyPosition","s","MozS","WebkitS","MSS","OS","scrollBehavior","MozScrollBehavior","WebkitScrollBehavior","MSScrollBehavior","OScrollBehavior","scrollSnapCoordinate","MozScrollSnapCoordinate","WebkitScrollSnapCoordinate","MSScrollSnapCoordinate","OScrollSnapCoordinate","scrollSnapDestination","MozScrollSnapDestination","WebkitScrollSnapDestination","MSScrollSnapDestination","OScrollSnapDestination","scrollSnapType","MozScrollSnapType","WebkitScrollSnapType","MSScrollSnapType","OScrollSnapType","shapeImageThreshold","MozShapeImageThreshold","WebkitShapeImageThreshold","MSShapeImageThreshold","OShapeImageThreshold","shapeMargin","MozShapeMargin","WebkitShapeMargin","MSShapeMargin","OShapeMargin","shapeOutside","MozShapeOutside","WebkitShapeOutside","MSShapeOutside","OShapeOutside","tabSize","MozTabSize","WebkitTabSize","MSTabSize","OTabSize","tableLayout","MozTableLayout","WebkitTableLayout","MSTableLayout","OTableLayout","textAlign","MozTextAlign","WebkitTextAlign","MSTextAlign","OTextAlign","textAlignLast","MozTextAlignLast","WebkitTextAlignLast","MSTextAlignLast","OTextAlignLast","textCombineUpright","MozTextCombineUpright","WebkitTextCombineUpright","MSTextCombineUpright","OTextCombineUpright","textDecoration","MozTextDecoration","WebkitTextDecoration","MSTextDecoration","OTextDecoration","textDecorationColor","MozTextDecorationColor","WebkitTextDecorationColor","MSTextDecorationColor","OTextDecorationColor","textDecorationLine","MozTextDecorationLine","WebkitTextDecorationLine","MSTextDecorationLine","OTextDecorationLine","textDecorationStyle","MozTextDecorationStyle","WebkitTextDecorationStyle","MSTextDecorationStyle","OTextDecorationStyle","textEmphasis","MozTextEmphasis","WebkitTextEmphasis","MSTextEmphasis","OTextEmphasis","textEmphasisColor","MozTextEmphasisColor","WebkitTextEmphasisColor","MSTextEmphasisColor","OTextEmphasisColor","textEmphasisPosition","MozTextEmphasisPosition","WebkitTextEmphasisPosition","MSTextEmphasisPosition","OTextEmphasisPosition","textEmphasisStyle","MozTextEmphasisStyle","WebkitTextEmphasisStyle","MSTextEmphasisStyle","OTextEmphasisStyle","textIndent","MozTextIndent","WebkitTextIndent","MSTextIndent","OTextIndent","textOrientation","MozTextOrientation","WebkitTextOrientation","MSTextOrientation","OTextOrientation","textOverflow","MozTextOverflow","WebkitTextOverflow","MSTextOverflow","OTextOverflow","textRendering","MozTextRendering","WebkitTextRendering","MSTextRendering","OTextRendering","textShadow","MozTextShadow","WebkitTextShadow","MSTextShadow","OTextShadow","textTransform","MozTextTransform","WebkitTextTransform","MSTextTransform","OTextTransform","textUnderlinePosition","MozTextUnderlinePosition","WebkitTextUnderlinePosition","MSTextUnderlinePosition","OTextUnderlinePosition","top","MozTop","WebkitTop","MSTop","OTop","touchAction","MozTouchAction","WebkitTouchAction","MSTouchAction","OTouchAction","transform","MozTransform","WebkitTransform","msTransform","OTransform","transformBox","MozTransformBox","WebkitTransformBox","MSTransformBox","OTransformBox","transformOrigin","MozTransformOrigin","WebkitTransformOrigin","MSTransformOrigin","OTransformOrigin","transformStyle","MozTransformStyle","WebkitTransformStyle","MSTransformStyle","OTransformStyle","transition","MozTransition","WebkitTransition","MSTransition","OTransition","transitionDelay","MozTransitionDelay","WebkitTransitionDelay","MSTransitionDelay","OTransitionDelay","transitionDuration","MozTransitionDuration","WebkitTransitionDuration","MSTransitionDuration","OTransitionDuration","transitionProperty","MozTransitionProperty","WebkitTransitionProperty","MSTransitionProperty","OTransitionProperty","transitionTimingFunction","MozTransitionTimingFunction","WebkitTransitionTimingFunction","MSTransitionTimingFunction","OTransitionTimingFunction","turn","MozTurn","WebkitTurn","MSTurn","OTurn","unicodeBidi","MozUnicodeBidi","WebkitUnicodeBidi","MSUnicodeBidi","OUnicodeBidi","unset","MozUnset","WebkitUnset","MSUnset","OUnset","verticalAlign","MozVerticalAlign","WebkitVerticalAlign","MSVerticalAlign","OVerticalAlign","vh","MozVh","WebkitVh","MSVh","OVh","visibility","MozVisibility","WebkitVisibility","MSVisibility","OVisibility","vmax","MozVmax","WebkitVmax","MSVmax","OVmax","vmin","MozVmin","WebkitVmin","MSVmin","OVmin","vw","MozVw","WebkitVw","MSVw","OVw","whiteSpace","MozWhiteSpace","WebkitWhiteSpace","MSWhiteSpace","OWhiteSpace","widows","MozWidows","WebkitWidows","MSWidows","OWidows","width","MozWidth","WebkitWidth","MSWidth","OWidth","willChange","MozWillChange","WebkitWillChange","MSWillChange","OWillChange","wordBreak","MozWordBreak","WebkitWordBreak","MSWordBreak","OWordBreak","wordSpacing","MozWordSpacing","WebkitWordSpacing","MSWordSpacing","OWordSpacing","wordWrap","MozWordWrap","WebkitWordWrap","MSWordWrap","OWordWrap","writingMode","MozWritingMode","WebkitWritingMode","MSWritingMode","OWritingMode","zIndex","MozZIndex","WebkitZIndex","MSZIndex","OZIndex","fontSize","MozFontSize","WebkitFontSize","MSFontSize","OFontSize","flex","MozFlex","WebkitFlex","MSFlex","OFlex","fr","MozFr","WebkitFr","MSFr","OFr","overflowScrolling","MozOverflowScrolling","WebkitOverflowScrolling","MSOverflowScrolling","OOverflowScrolling","userSelect","MozUserSelect","WebkitUserSelect","MSUserSelect","OUserSelect"]},Ga4A:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPrefix=o,t.browserPrefixToKey=i,t.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},t.default=void 0;var r=["Moz","Webkit","O","ms"];function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window||void 0===window.document)return"";var t=window.document.documentElement.style;if(e in t)return"";for(var n=0;n<r.length;n++)if(i(e,r[n])in t)return r[n];return""}function i(e,t){return t?"".concat(t).concat(function(e){for(var t="",n=!0,r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)):e}var a=o();t.default=a},Gh8y:function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var s in r)n.call(r,s)&&r[s]&&e.push(s);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},"H4m+":function(e,t,n){"use strict";t.__esModule=!0,t.resizableProps=void 0;var r,o=(r=n("17x9"))&&r.__esModule?r:{default:r};n("doQp");var i={axis:o.default.oneOf(["both","x","y","none"]),className:o.default.string,children:o.default.element.isRequired,draggableOpts:o.default.shape({allowAnyClick:o.default.bool,cancel:o.default.string,children:o.default.node,disabled:o.default.bool,enableUserSelectHack:o.default.bool,offsetParent:o.default.node,grid:o.default.arrayOf(o.default.number),handle:o.default.string,nodeRef:o.default.object,onStart:o.default.func,onDrag:o.default.func,onStop:o.default.func,onMouseDown:o.default.func,scale:o.default.number}),height:o.default.number.isRequired,handle:o.default.oneOfType([o.default.node,o.default.func]),handleSize:o.default.arrayOf(o.default.number),lockAspectRatio:o.default.bool,maxConstraints:o.default.arrayOf(o.default.number),minConstraints:o.default.arrayOf(o.default.number),onResizeStop:o.default.func,onResizeStart:o.default.func,onResize:o.default.func,resizeHandles:o.default.arrayOf(o.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:o.default.number,width:o.default.number.isRequired};t.resizableProps=i},LvXN:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=p(n("q1tI")),i=p(n("17x9")),a=n("doQp"),s=n("bNWW"),l=n("T0XP"),c=n("q78g"),d=n("TNBa"),u=p(n("Gh8y"));function p(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return O(this,n)}}function O(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(d,e);var t,n,r,i=y(d);function d(){var e;b(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return S(v(e=i.call.apply(i,[this].concat(n))),"state",{resizing:null,dragging:null,className:""}),S(v(e),"elementRef",o.default.createRef()),S(v(e),"onDragStart",(function(t,n){var r=n.node,o=e.props,i=o.onDragStart,a=o.transformScale;if(i){var s={top:0,left:0},l=r.offsetParent;if(l){var d=l.getBoundingClientRect(),u=r.getBoundingClientRect(),p=u.left/a,h=d.left/a,f=u.top/a,b=d.top/a;s.left=p-h+l.scrollLeft,s.top=f-b+l.scrollTop,e.setState({dragging:s});var g=(0,c.calcXY)(e.getPositionParams(),s.top,s.left,e.props.w,e.props.h),m=g.x,y=g.y;return i.call(v(e),e.props.i,m,y,{e:t,node:r,newPosition:s})}}})),S(v(e),"onDrag",(function(t,n){var r=n.node,o=n.deltaX,i=n.deltaY,a=e.props.onDrag;if(a){if(!e.state.dragging)throw new Error("onDrag called before onDragStart.");var s=e.state.dragging.top+i,l=e.state.dragging.left+o,d=e.props,u=d.isBounded,p=d.i,h=d.w,f=d.h,b=d.containerWidth,g=e.getPositionParams();if(u){var m=r.offsetParent;if(m){var y=e.props,O=y.margin,j=y.rowHeight,S=m.clientHeight-(0,c.calcGridItemWHPx)(f,j,O[1]);s=(0,c.clamp)(s,0,S);var x=(0,c.calcGridColWidth)(g),M=b-(0,c.calcGridItemWHPx)(h,x,O[0]);l=(0,c.clamp)(l,0,M)}}var w={top:s,left:l};e.setState({dragging:w});var k=(0,c.calcXY)(g,s,l,h,f),C=k.x,P=k.y;return a.call(v(e),p,C,P,{e:t,node:r,newPosition:w})}})),S(v(e),"onDragStop",(function(t,n){var r=n.node,o=e.props.onDragStop;if(o){if(!e.state.dragging)throw new Error("onDragEnd called before onDragStart.");var i=e.props,a=i.w,s=i.h,l=i.i,d=e.state.dragging,u=d.left,p=d.top,h={top:p,left:u};e.setState({dragging:null});var f=(0,c.calcXY)(e.getPositionParams(),p,u,a,s),b=f.x,g=f.y;return o.call(v(e),l,b,g,{e:t,node:r,newPosition:h})}})),S(v(e),"onResizeStop",(function(t,n){e.onResizeHandler(t,n,"onResizeStop")})),S(v(e),"onResizeStart",(function(t,n){e.onResizeHandler(t,n,"onResizeStart")})),S(v(e),"onResize",(function(t,n){e.onResizeHandler(t,n,"onResize")})),e}return t=d,(n=[{key:"shouldComponentUpdate",value:function(e,t){if(this.props.children!==e.children)return!0;if(this.props.droppingPosition!==e.droppingPosition)return!0;var n=(0,c.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,c.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,t);return!(0,l.fastPositionEqual)(n,r)||this.props.useCSSTransforms!==e.useCSSTransforms}},{key:"componentDidMount",value:function(){this.moveDroppingItem({})}},{key:"componentDidUpdate",value:function(e){this.moveDroppingItem(e)}},{key:"moveDroppingItem",value:function(e){var t=this.props.droppingPosition;if(t){var n=this.elementRef.current;if(n){var r=e.droppingPosition||{left:0,top:0},o=this.state.dragging,i=o&&t.left!==r.left||t.top!==r.top;if(o){if(i){var a=t.left-o.left,s=t.top-o.top;this.onDrag(t.e,{node:n,deltaX:a,deltaY:s})}}else this.onDragStart(t.e,{node:n,deltaX:t.left,deltaY:t.top})}}}},{key:"getPositionParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}},{key:"createStyle",value:function(e){var t,n=this.props,r=n.usePercentages,o=n.containerWidth;return n.useCSSTransforms?t=(0,l.setTransform)(e):(t=(0,l.setTopLeft)(e),r&&(t.left=(0,l.perc)(e.left/o),t.width=(0,l.perc)(e.width/o))),t}},{key:"mixinDraggable",value:function(e,t){return o.default.createElement(a.DraggableCore,{disabled:!t,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}},{key:"mixinResizable",value:function(e,t,n){var r=this.props,i=r.cols,a=r.x,l=r.minW,d=r.minH,u=r.maxW,p=r.maxH,h=r.transformScale,f=r.resizeHandles,b=r.resizeHandle,g=this.getPositionParams(),m=(0,c.calcGridItemPosition)(g,0,0,i-a,0).width,y=(0,c.calcGridItemPosition)(g,0,0,l,d),O=(0,c.calcGridItemPosition)(g,0,0,u,p),v=[y.width,y.height],j=[Math.min(O.width,m),Math.min(O.height,1/0)];return o.default.createElement(s.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:t.width,height:t.height,minConstraints:v,maxConstraints:j,onResizeStop:this.onResizeStop,onResizeStart:this.onResizeStart,onResize:this.onResize,transformScale:h,resizeHandles:f,handle:b},e)}},{key:"onResizeHandler",value:function(e,t,n){var r=t.node,o=t.size,i=this.props[n];if(i){var a=this.props,s=a.cols,l=a.x,d=a.y,u=a.i,p=a.maxH,h=a.minH,f=this.props,b=f.minW,g=f.maxW,m=(0,c.calcWH)(this.getPositionParams(),o.width,o.height,l,d),y=m.w,O=m.h;b=Math.max(b,1),g=Math.min(g,s-l),y=(0,c.clamp)(y,b,g),O=(0,c.clamp)(O,h,p),this.setState({resizing:"onResizeStop"===n?null:o}),i.call(this,u,y,O,{e:e,node:r,size:o})}}},{key:"render",value:function(){var e=this.props,t=e.x,n=e.y,r=e.w,i=e.h,a=e.isDraggable,s=e.isResizable,l=e.droppingPosition,d=e.useCSSTransforms,p=(0,c.calcGridItemPosition)(this.getPositionParams(),t,n,r,i,this.state),h=o.default.Children.only(this.props.children),b=o.default.cloneElement(h,{ref:this.elementRef,className:(0,u.default)("react-grid-item",h.props.className,this.props.className,{static:this.props.static,resizing:Boolean(this.state.resizing),"react-draggable":a,"react-draggable-dragging":Boolean(this.state.dragging),dropping:Boolean(l),cssTransforms:d}),style:f(f(f({},this.props.style),h.props.style),this.createStyle(p))});return b=this.mixinResizable(b,p,s),b=this.mixinDraggable(b,a)}}])&&g(t.prototype,n),r&&g(t,r),d}(o.default.Component);t.default=x,S(x,"propTypes",{children:i.default.element,cols:i.default.number.isRequired,containerWidth:i.default.number.isRequired,rowHeight:i.default.number.isRequired,margin:i.default.array.isRequired,maxRows:i.default.number.isRequired,containerPadding:i.default.array.isRequired,x:i.default.number.isRequired,y:i.default.number.isRequired,w:i.default.number.isRequired,h:i.default.number.isRequired,minW:function(e,t){var n=e[t];return"number"!=typeof n?new Error("minWidth not Number"):n>e.w||n>e.maxW?new Error("minWidth larger than item width/maxWidth"):void 0},maxW:function(e,t){var n=e[t];return"number"!=typeof n?new Error("maxWidth not Number"):n<e.w||n<e.minW?new Error("maxWidth smaller than item width/minWidth"):void 0},minH:function(e,t){var n=e[t];return"number"!=typeof n?new Error("minHeight not Number"):n>e.h||n>e.maxH?new Error("minHeight larger than item height/maxHeight"):void 0},maxH:function(e,t){var n=e[t];return"number"!=typeof n?new Error("maxHeight not Number"):n<e.h||n<e.minH?new Error("maxHeight smaller than item height/minHeight"):void 0},i:i.default.string.isRequired,resizeHandles:d.resizeHandleAxesType,resizeHandle:d.resizeHandleType,onDragStop:i.default.func,onDragStart:i.default.func,onDrag:i.default.func,onResizeStop:i.default.func,onResizeStart:i.default.func,onResize:i.default.func,isDraggable:i.default.bool.isRequired,isResizable:i.default.bool.isRequired,isBounded:i.default.bool.isRequired,static:i.default.bool,useCSSTransforms:i.default.bool.isRequired,transformScale:i.default.number,className:i.default.string,handle:i.default.string,cancel:i.default.string,droppingPosition:i.default.shape({e:i.default.object.isRequired,left:i.default.number.isRequired,top:i.default.number.isRequired})}),S(x,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1})},NmA4:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,n;return n=t=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(s,t);var n,r,i=(n=s,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=b(n);if(r){var o=b(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return h(this,e)});function s(){var e;d(this,s);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return g(f(e=i.call.apply(i,[this].concat(n))),"state",{width:1280}),g(f(e),"elementRef",o.createRef()),g(f(e),"mounted",!1),g(f(e),"onWindowResize",(function(){if(e.mounted){var t=e.elementRef.current;t instanceof HTMLElement&&t.offsetWidth&&e.setState({width:t.offsetWidth})}})),e}return function(e,t,n){t&&u(e.prototype,t);n&&u(e,n)}(s,[{key:"componentDidMount",value:function(){this.mounted=!0,window.addEventListener("resize",this.onWindowResize),this.onWindowResize()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,window.removeEventListener("resize",this.onWindowResize)}},{key:"render",value:function(){var t=this.props,n=t.measureBeforeMount,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["measureBeforeMount"]);return n&&!this.mounted?o.createElement("div",{className:(0,a.default)(this.props.className,"react-grid-layout"),style:this.props.style,ref:this.elementRef}):o.createElement(e,c({innerRef:this.elementRef},r,this.state))}}]),s}(o.Component),g(t,"defaultProps",{measureBeforeMount:!1}),g(t,"propTypes",{measureBeforeMount:i.default.bool}),n};var o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}o.default=e,n&&n.set(e,o);return o}(n("q1tI")),i=s(n("17x9")),a=s(n("Gh8y"));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?f(e):t}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},PkIl:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n("Csm0"),o=n("kDLi"),i=(n("q1tI"),n("WG1l")),a=n.n(i),s=n("nKUr");class l{constructor(e){var t,n,r;r=void 0,(n="parent")in(t=this)?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,this.props=e}getLabel(e){const{title:t,description:n}=this.props;if(!e)return this.parent.props.title===t?null:t;const r=[];return this.parent.parent&&r.push(this.highlightWord(this.parent.parent.props.title,e)),this.parent.props.title!==t&&r.push(this.highlightWord(this.parent.props.title,e)),Object(s.jsx)(o.Label,{description:n&&this.highlightWord(n,e),category:r,children:this.highlightWord(t,e)})}highlightWord(e,t){return Object(s.jsx)(a.a,{textToHighlight:e,searchWords:[t],highlightClassName:"search-fragment-highlight"})}render(e){const{title:t,description:n,render:i,showIf:a,skipField:l}=this.props,c=`${this.parent.props.id} ${t}`;return a&&!a()?null:l?i():Object(s.jsx)(o.Field,{label:this.getLabel(e),description:n,"aria-label":r.a.components.PanelEditor.OptionsPane.fieldLabel(c),children:i()},c)}}},QGdL:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n("vF1F"),o=n("kDLi"),i=(n("q1tI"),n("wDOy")),a=n("nKUr");const s=["renderExpandedContent"];function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const c=e=>{let{renderExpandedContent:t}=e,n=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,s);const c=Object(o.useStyles2)(d);return Object(a.jsx)(i.a,l({renderExpandedContent:t?(e,n,o)=>Object(a.jsxs)(a.Fragment,{children:[!(n===o.length-1)&&Object(a.jsx)("div",{className:Object(r.cx)(c.contentGuideline,c.guideline)}),t(e,n,o)]}):void 0,renderPrefixHeader:()=>Object(a.jsx)("div",{className:c.relative,children:Object(a.jsx)("div",{className:Object(r.cx)(c.headerGuideline,c.guideline)})}),renderPrefixCell:(e,t,n)=>Object(a.jsxs)("div",{className:c.relative,children:[Object(a.jsx)("div",{className:Object(r.cx)(c.topGuideline,c.guideline)}),!(t===n.length-1)&&Object(a.jsx)("div",{className:Object(r.cx)(c.bottomGuideline,c.guideline)})]})},n))},d=e=>({relative:r.css`
    position: relative;
    height: 100%;
  `,guideline:r.css`
    left: -19px;
    border-left: 1px solid ${e.colors.border.medium};
    position: absolute;

    ${e.breakpoints.down("md")} {
      display: none;
    }
  `,topGuideline:r.css`
    width: 18px;
    border-bottom: 1px solid ${e.colors.border.medium};
    top: 0;
    bottom: 50%;
  `,bottomGuideline:r.css`
    top: 50%;
    bottom: 0;
  `,contentGuideline:r.css`
    top: 0;
    bottom: 0;
    left: -49px !important;
  `,headerGuideline:r.css`
    top: -25px;
    bottom: 0;
  `})},Qgwu:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBreakpointFromWidth=function(e,t){for(var n=o(e),r=n[0],i=1,a=n.length;i<a;i++){var s=n[i];t>e[s]&&(r=s)}return r},t.getColsFromBreakpoint=function(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]},t.findOrGenerateResponsiveLayout=function(e,t,n,i,a,s){if(e[n])return(0,r.cloneLayout)(e[n]);for(var l=e[i],c=o(t),d=c.slice(c.indexOf(n)),u=0,p=d.length;u<p;u++){var h=d[u];if(e[h]){l=e[h];break}}return l=(0,r.cloneLayout)(l||[]),(0,r.compact)((0,r.correctBounds)(l,{cols:a}),s,a)},t.sortBreakpoints=o;var r=n("T0XP");function o(e){return Object.keys(e).sort((function(t,n){return e[t]-e[n]}))}},R155:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==p(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(n("q1tI")),o=d(n("17x9")),i=d(n("i8i4")),a=n("8N4D"),s=n("fJi3"),l=n("gbW8"),c=d(n("sS6v"));function d(e){return e&&e.__esModule?e:{default:e}}function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return O(this,n)}}function O(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x={start:"touchstart",move:"touchmove",stop:"touchend"},M={start:"mousedown",move:"mousemove",stop:"mouseup"},w=M,k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(d,e);var t,n,o,l=y(d);function d(){var e;b(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return S(v(e=l.call.apply(l,[this].concat(n))),"state",{dragging:!1,lastX:NaN,lastY:NaN,touchIdentifier:null}),S(v(e),"mounted",!1),S(v(e),"handleDragStart",(function(t){if(e.props.onMouseDown(t),!e.props.allowAnyClick&&"number"==typeof t.button&&0!==t.button)return!1;var n=e.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");var r=n.ownerDocument;if(!(e.props.disabled||!(t.target instanceof r.defaultView.Node)||e.props.handle&&!(0,a.matchesSelectorAndParentsTo)(t.target,e.props.handle,n)||e.props.cancel&&(0,a.matchesSelectorAndParentsTo)(t.target,e.props.cancel,n))){"touchstart"===t.type&&t.preventDefault();var o=(0,a.getTouchIdentifier)(t);e.setState({touchIdentifier:o});var i=(0,s.getControlPosition)(t,o,v(e));if(null!=i){var l=i.x,d=i.y,u=(0,s.createCoreData)(v(e),l,d);(0,c.default)("DraggableCore: handleDragStart: %j",u),(0,c.default)("calling",e.props.onStart),!1!==e.props.onStart(t,u)&&!1!==e.mounted&&(e.props.enableUserSelectHack&&(0,a.addUserSelectStyles)(r),e.setState({dragging:!0,lastX:l,lastY:d}),(0,a.addEvent)(r,w.move,e.handleDrag),(0,a.addEvent)(r,w.stop,e.handleDragStop))}}})),S(v(e),"handleDrag",(function(t){var n=(0,s.getControlPosition)(t,e.state.touchIdentifier,v(e));if(null!=n){var r=n.x,o=n.y;if(Array.isArray(e.props.grid)){var i=r-e.state.lastX,a=o-e.state.lastY,l=h((0,s.snapToGrid)(e.props.grid,i,a),2);if(i=l[0],a=l[1],!i&&!a)return;r=e.state.lastX+i,o=e.state.lastY+a}var d=(0,s.createCoreData)(v(e),r,o);if((0,c.default)("DraggableCore: handleDrag: %j",d),!1!==e.props.onDrag(t,d)&&!1!==e.mounted)e.setState({lastX:r,lastY:o});else try{e.handleDragStop(new MouseEvent("mouseup"))}catch(t){var u=document.createEvent("MouseEvents");u.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),e.handleDragStop(u)}}})),S(v(e),"handleDragStop",(function(t){if(e.state.dragging){var n=(0,s.getControlPosition)(t,e.state.touchIdentifier,v(e));if(null!=n){var r=n.x,o=n.y,i=(0,s.createCoreData)(v(e),r,o);if(!1===e.props.onStop(t,i)||!1===e.mounted)return!1;var l=e.findDOMNode();l&&e.props.enableUserSelectHack&&(0,a.removeUserSelectStyles)(l.ownerDocument),(0,c.default)("DraggableCore: handleDragStop: %j",i),e.setState({dragging:!1,lastX:NaN,lastY:NaN}),l&&((0,c.default)("DraggableCore: Removing handlers"),(0,a.removeEvent)(l.ownerDocument,w.move,e.handleDrag),(0,a.removeEvent)(l.ownerDocument,w.stop,e.handleDragStop))}}})),S(v(e),"onMouseDown",(function(t){return w=M,e.handleDragStart(t)})),S(v(e),"onMouseUp",(function(t){return w=M,e.handleDragStop(t)})),S(v(e),"onTouchStart",(function(t){return w=x,e.handleDragStart(t)})),S(v(e),"onTouchEnd",(function(t){return w=x,e.handleDragStop(t)})),e}return t=d,(n=[{key:"componentDidMount",value:function(){this.mounted=!0;var e=this.findDOMNode();e&&(0,a.addEvent)(e,x.start,this.onTouchStart,{passive:!1})}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var e=this.findDOMNode();if(e){var t=e.ownerDocument;(0,a.removeEvent)(t,M.move,this.handleDrag),(0,a.removeEvent)(t,x.move,this.handleDrag),(0,a.removeEvent)(t,M.stop,this.handleDragStop),(0,a.removeEvent)(t,x.stop,this.handleDragStop),(0,a.removeEvent)(e,x.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,a.removeUserSelectStyles)(t)}}},{key:"findDOMNode",value:function(){return this.props.nodeRef?this.props.nodeRef.current:i.default.findDOMNode(this)}},{key:"render",value:function(){return r.cloneElement(r.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}])&&g(t.prototype,n),o&&g(t,o),d}(r.Component);t.default=k,S(k,"displayName","DraggableCore"),S(k,"propTypes",{allowAnyClick:o.default.bool,disabled:o.default.bool,enableUserSelectHack:o.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:o.default.arrayOf(o.default.number),handle:o.default.string,cancel:o.default.string,nodeRef:o.default.object,onStart:o.default.func,onDrag:o.default.func,onStop:o.default.func,onMouseDown:o.default.func,scale:o.default.number,className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),S(k,"defaultProps",{allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,offsetParent:null,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},RLby:function(e,t,n){"use strict";var r=n("kDLi"),o=n("q1tI"),i=n("vF1F"),a=n("CBrm"),s=n("dVib"),l=n("cLaa"),c=n("vmN6"),d=n("epYg"),u=n("CBn2"),p=n("yZbJ"),h=n("nKUr");const f=({rule:e})=>{const t=Object(r.useStyles2)(b),{promRule:n,namespace:{rulesSource:o}}=e,i=Object.entries(e.annotations).filter(([e,t])=>!!t.trim());return Object(h.jsxs)("div",{children:[Object(h.jsx)(l.a,{rule:e,rulesSource:o}),Object(h.jsxs)("div",{className:t.wrapper,children:[Object(h.jsxs)("div",{className:t.leftSide,children:[!!e.labels&&!!Object.keys(e.labels).length&&Object(h.jsx)(s.a,{label:"Labels",horizontal:!0,children:Object(h.jsx)(a.a,{labels:e.labels})}),Object(h.jsx)(u.a,{rulesSource:o,rule:e,annotations:i}),Object(h.jsx)(p.a,{annotations:i})]}),Object(h.jsx)("div",{className:t.rightSide,children:Object(h.jsx)(c.a,{rulesSource:o,rule:e})})]}),Object(h.jsx)(d.a,{promRule:n})]})},b=e=>({wrapper:i.css`
    display: flex;
    flex-direction: row;
    ${e.breakpoints.down("md")} {
      flex-direction: column;
    }
  `,leftSide:i.css`
    flex: 1;
  `,rightSide:i.css`
    ${e.breakpoints.up("md")} {
      padding-left: 90px;
      width: 300px;
    }
  `});var g=n("Jzaf"),m=n("xsuF"),y=n("d6cI"),O=n("xVL3"),v=n("7G0q"),j=n("wDOy"),S=n("QGdL");n.d(t,"a",(function(){return x}));const x=({rules:e,className:t,showGuidelines:n=!1,emptyMessage:a="No rules found.",showGroupColumn:s=!1,showSummaryColumn:l=!1})=>{const c=Object(r.useStyles2)(M),d=Object(i.cx)(c.wrapper,t,{[c.wrapperMargin]:n}),u=Object(o.useMemo)(()=>{const t=[];return e.map((e,n)=>{var r;let o=JSON.stringify([null===(r=e.promRule)||void 0===r?void 0:r.type,e.labels,e.query,e.name,e.annotations]);return t.includes(o)&&(o+="-"+n),t.push(o),{id:o,data:e}})},[e]),p=function(e,t){const n=Object(m.a)();return Object(o.useMemo)(()=>{const r=[{id:"state",label:"State",renderCell:({data:e})=>{const{namespace:t}=e,{rulesSource:r}=t,{promRule:o,rulerRule:i}=e,a=!(!n(r)||!o||i),s=!(!n(r)||!i||o);return Object(h.jsx)(O.a,{rule:e,isDeleting:a,isCreating:s})},size:"165px"},{id:"name",label:"Name",renderCell:({data:e})=>e.name,size:5},{id:"health",label:"Health",renderCell:({data:{promRule:e}})=>e?Object(h.jsx)(v.a,{rule:e}):null,size:"75px"}];return e&&r.push({id:"summary",label:"Summary",renderCell:({data:e})=>{var t;return null!==(t=e.annotations[y.c.summary])&&void 0!==t?t:""},size:5}),t&&r.push({id:"group",label:"Group",renderCell:({data:e})=>{const{namespace:t,group:n}=e,{rulesSource:r}=t;return Object(g.j)(r)?`${t.name} > ${n.name}`:t.name},size:5}),r},[n,e,t])}(l,s);if(!e.length)return Object(h.jsx)("div",{className:Object(i.cx)(d,c.emptyMessage),children:a});const b=n?S.a:j.a;return Object(h.jsx)("div",{className:d,"data-testid":"rules-table",children:Object(h.jsx)(b,{cols:p,isExpandable:!0,items:u,renderExpandedContent:({data:e})=>Object(h.jsx)(f,{rule:e})})})},M=e=>({wrapperMargin:i.css`
    ${e.breakpoints.up("md")} {
      margin-left: 36px;
    }
  `,emptyMessage:i.css`
    padding: ${e.spacing(1)};
  `,wrapper:i.css`
    width: auto;
    background-color: ${e.colors.background.secondary};
    border-radius: ${e.shape.borderRadius()};
  `,table:i.css`
    width: 100%;
    border-radius: ${e.shape.borderRadius()};
    border: solid 1px ${e.colors.border.weak};
    background-color: ${e.colors.background.secondary};

    th {
      padding: ${e.spacing(1)};
    }

    td + td {
      padding: ${e.spacing(0,1)};
    }

    tr {
      height: 38px;
    }
  `,evenRow:i.css`
    background-color: ${e.colors.background.primary};
  `,state:i.css`
    width: 110px;
  `})},T0XP:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bottom=c,t.cloneLayout=function(e){for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=u(e[n]);return t},t.modifyLayout=d,t.withLayoutItem=function(e,t,n){var r=O(e,t);return r?(r=n(u(r)),[e=d(e,r),r]):[e,null]},t.cloneLayoutItem=u,t.childrenEqual=function(e,t){return(0,r.default)(o.default.Children.map(e,(function(e){return e.key})),o.default.Children.map(t,(function(e){return e.key})))},t.fastPositionEqual=function(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height},t.collides=h,t.compact=f,t.compactItem=m,t.correctBounds=y,t.getLayoutItem=O,t.getFirstCollision=v,t.getAllCollisions=j,t.getStatics=S,t.moveElement=x,t.moveElementAwayFromCollision=M,t.perc=function(e){return 100*e+"%"},t.setTransform=function(e){var t=e.top,n=e.left,r=e.width,o=e.height,i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}},t.setTopLeft=function(e){var t=e.top,n=e.left,r=e.width,o=e.height;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}},t.sortLayoutItems=w,t.sortLayoutItemsByRowCol=k,t.sortLayoutItemsByColRow=C,t.synchronizeLayoutWithChildren=function(e,t,n,r){e=e||[];var i=[];return o.default.Children.forEach(t,(function(t,n){var r=O(e,String(t.key));if(r)i[n]=u(r);else{0;var o=t.props["data-grid"]||t.props._grid;i[n]=u(o?s(s({},o),{},{i:t.key}):{w:1,h:1,x:0,y:c(i),i:String(t.key)})}})),f(y(i,{cols:n}),r,n)},t.validateLayout=P,t.compactType=function(e){var t=e||{},n=t.verticalCompact,r=t.compactType;return!1===n?null:r},t.autoBindHandlers=function(e,t){t.forEach((function(t){return e[t]=e[t].bind(e)}))},t.noop=t.fastRGLPropsEqual=void 0;var r=i(n("XaGS")),o=i(n("q1tI"));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){for(var t,n=0,r=0,o=e.length;r<o;r++)(t=e[r].y+e[r].h)>n&&(n=t);return n}function d(e,t){for(var n=Array(e.length),r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function u(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:Boolean(e.moved),static:Boolean(e.static),isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}var p=n("b06y");function h(e,t){return e.i!==t.i&&(!(e.x+e.w<=t.x)&&(!(e.x>=t.x+t.w)&&(!(e.y+e.h<=t.y)&&!(e.y>=t.y+t.h))))}function f(e,t,n){for(var r=S(e),o=w(e,t),i=Array(e.length),a=0,s=o.length;a<s;a++){var l=u(o[a]);l.static||(l=m(r,l,t,n,o),r.push(l)),i[e.indexOf(o[a])]=l,l.moved=!1}return i}t.fastRGLPropsEqual=p;var b={x:"w",y:"h"};function g(e,t,n,r){var o=b[r];t[r]+=1;for(var i=e.map((function(e){return e.i})).indexOf(t.i)+1;i<e.length;i++){var a=e[i];if(!a.static){if(a.y>t.y+t.h)break;h(t,a)&&g(e,a,n+t[o],r)}}t[r]=n}function m(e,t,n,r,o){var i,a="horizontal"===n;if("vertical"===n)for(t.y=Math.min(c(e),t.y);t.y>0&&!v(e,t);)t.y--;else if(a)for(;t.x>0&&!v(e,t);)t.x--;for(;i=v(e,t);)a?g(o,t,i.x+i.w,"x"):g(o,t,i.y+i.h,"y"),a&&t.x+t.w>r&&(t.x=r-t.w,t.y++);return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function y(e,t){for(var n=S(e),r=0,o=e.length;r<o;r++){var i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),i.static)for(;v(n,i);)i.y++;else n.push(i)}return e}function O(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function v(e,t){for(var n=0,r=e.length;n<r;n++)if(h(e[n],t))return e[n]}function j(e,t){return e.filter((function(e){return h(e,t)}))}function S(e){return e.filter((function(e){return e.static}))}function x(e,t,n,r,o,i,a,s){if(t.static&&!0!==t.isDraggable)return e;if(t.y===r&&t.x===n)return e;z("Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]"));var l=t.x,c=t.y;"number"==typeof n&&(t.x=n),"number"==typeof r&&(t.y=r),t.moved=!0;var d=w(e,a);("vertical"===a&&"number"==typeof r?c>=r:"horizontal"===a&&"number"==typeof n&&l>=n)&&(d=d.reverse());var u=j(d,t);if(i&&u.length)return z("Collision prevented on ".concat(t.i,", reverting.")),t.x=l,t.y=c,t.moved=!1,e;for(var p=0,h=u.length;p<h;p++){var f=u[p];z("Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(f.i," at [").concat(f.x,",").concat(f.y,"]")),f.moved||(e=f.static?M(e,f,t,o,a,s):M(e,t,f,o,a,s))}return e}function M(e,t,n,r,o,i){var a="horizontal"===o,s="horizontal"!==o,l=t.static;if(r){r=!1;var c={x:a?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"};if(!v(e,c))return z("Doing reverse collision on ".concat(n.i," up to [").concat(c.x,",").concat(c.y,"].")),x(e,n,a?c.x:void 0,s?c.y:void 0,r,l,o,i)}return x(e,n,a?n.x+1:void 0,s?n.y+1:void 0,r,l,o,i)}function w(e,t){return"horizontal"===t?C(e):k(e)}function k(e){return e.slice(0).sort((function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1}))}function C(e){return e.slice(0).sort((function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1}))}function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Layout",n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(var r=0,o=e.length;r<o;r++){for(var i=e[r],a=0;a<n.length;a++)if("number"!=typeof i[n[a]])throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[a]+" must be a number!");if(i.i&&"string"!=typeof i.i)throw new Error("ReactGridLayout: "+t+"["+r+"].i must be a string!");if(void 0!==i.static&&"boolean"!=typeof i.static)throw new Error("ReactGridLayout: "+t+"["+r+"].static must be a boolean!")}}function z(){}t.noop=function(){}},TNBa:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.resizeHandleType=t.resizeHandleAxesType=void 0;var r=i(n("17x9")),o=i(n("q1tI"));function i(e){return e&&e.__esModule?e:{default:e}}var a=r.default.arrayOf(r.default.oneOf(["s","w","e","n","sw","nw","se","ne"]));t.resizeHandleAxesType=a;var s=r.default.oneOfType([r.default.node,r.default.func]);t.resizeHandleType=s;var l={className:r.default.string,style:r.default.object,width:r.default.number,autoSize:r.default.bool,cols:r.default.number,draggableCancel:r.default.string,draggableHandle:r.default.string,verticalCompact:function(e){e.verticalCompact,0},compactType:r.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;void 0!==t&&n("T0XP").validateLayout(t,"layout")},margin:r.default.arrayOf(r.default.number),containerPadding:r.default.arrayOf(r.default.number),rowHeight:r.default.number,maxRows:r.default.number,isBounded:r.default.bool,isDraggable:r.default.bool,isResizable:r.default.bool,preventCollision:r.default.bool,useCSSTransforms:r.default.bool,transformScale:r.default.number,isDroppable:r.default.bool,resizeHandles:a,resizeHandle:s,onLayoutChange:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onDragStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,onResizeStop:r.default.func,onDrop:r.default.func,droppingItem:r.default.shape({i:r.default.string.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired}),children:function(e,t){var n=e[t],r={};o.default.Children.forEach(n,(function(e){if(r[e.key])throw new Error('Duplicate child key "'+e.key+'" found! This will cause problems in ReactGridLayout.');r[e.key]=!0}))},innerRef:r.default.any};t.default=l},UlFs:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n("Obii"),o=n("q1tI");const i=(e,t,n)=>{const i=Object(o.useRef)(),[a,s]=Object(o.useState)();return Object(o.useEffect)(()=>{let r=-1,o=0;return i.current=e.getQueryRunner().getData(t).subscribe({next:e=>{if(n){var t;if(r===e.structureRev){const e=Date.now();if(e-o<1e4)return;o=e}r=null!==(t=e.structureRev)&&void 0!==t?t:-1}s(e)}}),()=>{i.current&&i.current.unsubscribe()}},[e,t.withFieldConfig,t.withTransforms]),{data:a,error:a&&a.error,isLoading:!a||a.state===r.LoadingState.Loading,hasSeries:!!a&&!!a.series}}},VBuW:function(e,t,n){"use strict";var r,o=n("q1tI"),i=n("bcUi"),a=n("Csm0"),s=n("Algx"),l=n("kDLi"),c=n("nKUr");const d=e=>{const t=Object(o.useMemo)(()=>s.b.get(e.variable.type).picker,[e.variable]);return e.variable?Object(c.jsxs)("div",{className:"gf-form",children:[Object(c.jsx)(u,{variable:e.variable}),e.variable.hide!==i.a.hideVariable&&t&&Object(c.jsx)(t,{variable:e.variable})]}):r||(r=Object(c.jsx)("div",{children:"Couldn't load variable"}))};function u({variable:e}){const t=Object(o.useMemo)(()=>e.label||e.name,[e]);return e.hide!==i.a.dontHide?null:e.description?Object(c.jsx)(l.Tooltip,{content:e.description,placement:"bottom",children:Object(c.jsx)("label",{className:"gf-form-label gf-form-label--variable","data-testid":a.a.pages.Dashboard.SubMenu.submenuItemLabels(t),htmlFor:e.id,children:t})}):Object(c.jsx)("label",{className:"gf-form-label gf-form-label--variable","data-testid":a.a.pages.Dashboard.SubMenu.submenuItemLabels(t),htmlFor:e.id,children:t})}n.d(t,"a",(function(){return p}));const p=({variables:e})=>{const[t,n]=Object(o.useState)([]);return Object(o.useEffect)(()=>{n(e.filter(e=>e.hide!==i.a.hideVariable))},[e]),0===t.length?null:Object(c.jsx)(c.Fragment,{children:t.map(e=>Object(c.jsx)("div",{className:"submenu-item gf-form-inline","data-testid":a.a.pages.Dashboard.SubMenu.submenuItem,children:Object(c.jsx)(d,{variable:e})},e.id))})}},VzO5:function(e,t,n){"use strict";t.__esModule=!0,t.cloneElement=function(e,t){t.style&&e.props.style&&(t.style=a(a({},e.props.style),t.style));t.className&&e.props.className&&(t.className=e.props.className+" "+t.className);return o.default.cloneElement(e,t)};var r,o=(r=n("q1tI"))&&r.__esModule?r:{default:r};function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},XaGS:function(e,t,n){(function(e,n){var r="[object Arguments]",o="[object Map]",i="[object Object]",a="[object Set]",s=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,c={};c["[object Float32Array]"]=c["[object Float64Array]"]=c["[object Int8Array]"]=c["[object Int16Array]"]=c["[object Int32Array]"]=c["[object Uint8Array]"]=c["[object Uint8ClampedArray]"]=c["[object Uint16Array]"]=c["[object Uint32Array]"]=!0,c[r]=c["[object Array]"]=c["[object ArrayBuffer]"]=c["[object Boolean]"]=c["[object DataView]"]=c["[object Date]"]=c["[object Error]"]=c["[object Function]"]=c[o]=c["[object Number]"]=c[i]=c["[object RegExp]"]=c[a]=c["[object String]"]=c["[object WeakMap]"]=!1;var d="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,p=d||u||Function("return this")(),h=t&&!t.nodeType&&t,f=h&&"object"==typeof n&&n&&!n.nodeType&&n,b=f&&f.exports===h,g=b&&d.process,m=function(){try{return g&&g.binding&&g.binding("util")}catch(e){}}(),y=m&&m.isTypedArray;function O(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function v(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function j(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var S,x,M,w=Array.prototype,k=Function.prototype,C=Object.prototype,P=p["__core-js_shared__"],z=k.toString,D=C.hasOwnProperty,R=(S=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+S:"",T=C.toString,B=RegExp("^"+z.call(D).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W=b?p.Buffer:void 0,I=p.Symbol,E=p.Uint8Array,A=C.propertyIsEnumerable,N=w.splice,F=I?I.toStringTag:void 0,L=Object.getOwnPropertySymbols,_=W?W.isBuffer:void 0,H=(x=Object.keys,M=Object,function(e){return x(M(e))}),G=me(p,"DataView"),$=me(p,"Map"),V=me(p,"Promise"),U=me(p,"Set"),q=me(p,"WeakMap"),Q=me(Object,"create"),Y=je(G),X=je($),K=je(V),J=je(U),Z=je(q),ee=I?I.prototype:void 0,te=ee?ee.valueOf:void 0;function ne(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function re(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function oe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ie(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new oe;++t<n;)this.add(e[t])}function ae(e){var t=this.__data__=new re(e);this.size=t.size}function se(e,t){var n=Me(e),r=!n&&xe(e),o=!n&&!r&&we(e),i=!n&&!r&&!o&&De(e),a=n||r||o||i,s=a?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],l=s.length;for(var c in e)!t&&!D.call(e,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ve(c,l))||s.push(c);return s}function le(e,t){for(var n=e.length;n--;)if(Se(e[n][0],t))return n;return-1}function ce(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":F&&F in Object(e)?function(e){var t=D.call(e,F),n=e[F];try{e[F]=void 0;var r=!0}catch(e){}var o=T.call(e);r&&(t?e[F]=n:delete e[F]);return o}(e):function(e){return T.call(e)}(e)}function de(e){return ze(e)&&ce(e)==r}function ue(e,t,n,s,l){return e===t||(null==e||null==t||!ze(e)&&!ze(t)?e!=e&&t!=t:function(e,t,n,s,l,c){var d=Me(e),u=Me(t),p=d?"[object Array]":Oe(e),h=u?"[object Array]":Oe(t),f=(p=p==r?i:p)==i,b=(h=h==r?i:h)==i,g=p==h;if(g&&we(e)){if(!we(t))return!1;d=!0,f=!1}if(g&&!f)return c||(c=new ae),d||De(e)?fe(e,t,n,s,l,c):function(e,t,n,r,i,s,l){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new E(e),new E(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Se(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case o:var c=v;case a:var d=1&r;if(c||(c=j),e.size!=t.size&&!d)return!1;var u=l.get(e);if(u)return u==t;r|=2,l.set(e,t);var p=fe(c(e),c(t),r,i,s,l);return l.delete(e),p;case"[object Symbol]":if(te)return te.call(e)==te.call(t)}return!1}(e,t,p,n,s,l,c);if(!(1&n)){var m=f&&D.call(e,"__wrapped__"),y=b&&D.call(t,"__wrapped__");if(m||y){var O=m?e.value():e,S=y?t.value():t;return c||(c=new ae),l(O,S,n,s,c)}}if(!g)return!1;return c||(c=new ae),function(e,t,n,r,o,i){var a=1&n,s=be(e),l=s.length,c=be(t).length;if(l!=c&&!a)return!1;var d=l;for(;d--;){var u=s[d];if(!(a?u in t:D.call(t,u)))return!1}var p=i.get(e);if(p&&i.get(t))return p==t;var h=!0;i.set(e,t),i.set(t,e);var f=a;for(;++d<l;){u=s[d];var b=e[u],g=t[u];if(r)var m=a?r(g,b,u,t,e,i):r(b,g,u,e,t,i);if(!(void 0===m?b===g||o(b,g,n,r,i):m)){h=!1;break}f||(f="constructor"==u)}if(h&&!f){var y=e.constructor,O=t.constructor;y==O||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof O&&O instanceof O||(h=!1)}return i.delete(e),i.delete(t),h}(e,t,n,s,l,c)}(e,t,n,s,ue,l))}function pe(e){return!(!Pe(e)||function(e){return!!R&&R in e}(e))&&(ke(e)?B:s).test(je(e))}function he(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||C,t!==r)return H(e);var t,n,r,o=[];for(var i in Object(e))D.call(e,i)&&"constructor"!=i&&o.push(i);return o}function fe(e,t,n,r,o,i){var a=1&n,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var c=i.get(e);if(c&&i.get(t))return c==t;var d=-1,u=!0,p=2&n?new ie:void 0;for(i.set(e,t),i.set(t,e);++d<s;){var h=e[d],f=t[d];if(r)var b=a?r(f,h,d,t,e,i):r(h,f,d,e,t,i);if(void 0!==b){if(b)continue;u=!1;break}if(p){if(!O(t,(function(e,t){if(a=t,!p.has(a)&&(h===e||o(h,e,n,r,i)))return p.push(t);var a}))){u=!1;break}}else if(h!==f&&!o(h,f,n,r,i)){u=!1;break}}return i.delete(e),i.delete(t),u}function be(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Re,ye)}function ge(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function me(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return pe(n)?n:void 0}ne.prototype.clear=function(){this.__data__=Q?Q(null):{},this.size=0},ne.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne.prototype.get=function(e){var t=this.__data__;if(Q){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return D.call(t,e)?t[e]:void 0},ne.prototype.has=function(e){var t=this.__data__;return Q?void 0!==t[e]:D.call(t,e)},ne.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Q&&void 0===t?"__lodash_hash_undefined__":t,this},re.prototype.clear=function(){this.__data__=[],this.size=0},re.prototype.delete=function(e){var t=this.__data__,n=le(t,e);return!(n<0)&&(n==t.length-1?t.pop():N.call(t,n,1),--this.size,!0)},re.prototype.get=function(e){var t=this.__data__,n=le(t,e);return n<0?void 0:t[n][1]},re.prototype.has=function(e){return le(this.__data__,e)>-1},re.prototype.set=function(e,t){var n=this.__data__,r=le(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},oe.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new($||re),string:new ne}},oe.prototype.delete=function(e){var t=ge(this,e).delete(e);return this.size-=t?1:0,t},oe.prototype.get=function(e){return ge(this,e).get(e)},oe.prototype.has=function(e){return ge(this,e).has(e)},oe.prototype.set=function(e,t){var n=ge(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},ie.prototype.add=ie.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ie.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.clear=function(){this.__data__=new re,this.size=0},ae.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ae.prototype.get=function(e){return this.__data__.get(e)},ae.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.set=function(e,t){var n=this.__data__;if(n instanceof re){var r=n.__data__;if(!$||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new oe(r)}return n.set(e,t),this.size=n.size,this};var ye=L?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}(L(e),(function(t){return A.call(e,t)})))}:function(){return[]},Oe=ce;function ve(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||l.test(e))&&e>-1&&e%1==0&&e<t}function je(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Se(e,t){return e===t||e!=e&&t!=t}(G&&"[object DataView]"!=Oe(new G(new ArrayBuffer(1)))||$&&Oe(new $)!=o||V&&"[object Promise]"!=Oe(V.resolve())||U&&Oe(new U)!=a||q&&"[object WeakMap]"!=Oe(new q))&&(Oe=function(e){var t=ce(e),n=t==i?e.constructor:void 0,r=n?je(n):"";if(r)switch(r){case Y:return"[object DataView]";case X:return o;case K:return"[object Promise]";case J:return a;case Z:return"[object WeakMap]"}return t});var xe=de(function(){return arguments}())?de:function(e){return ze(e)&&D.call(e,"callee")&&!A.call(e,"callee")},Me=Array.isArray;var we=_||function(){return!1};function ke(e){if(!Pe(e))return!1;var t=ce(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ce(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Pe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ze(e){return null!=e&&"object"==typeof e}var De=y?function(e){return function(t){return e(t)}}(y):function(e){return ze(e)&&Ce(e.length)&&!!c[ce(e)]};function Re(e){return null!=(t=e)&&Ce(t.length)&&!ke(t)?se(e):he(e);var t}n.exports=function(e,t){return ue(e,t)}}).call(this,n("yLpj"),n("YuTi")(e))},"Zu+4":function(e,t,n){"use strict";var r,o=n("t8hP"),i=n("HJRA"),a=n("umNM"),s=n("q1tI"),l=n.n(s),c=n("Ty5D"),d=n("rd46"),u=n("LvDl"),p=n("KHwQ"),h=n.n(p),f=n("kDLi"),b=n("N9j+"),g=n("vF1F"),m=n("nKUr");const y=({dashboard:e,onSaveSuccess:t,onDiscard:n,onDismiss:o})=>Object(m.jsxs)(f.Modal,{isOpen:!0,title:"Unsaved changes",onDismiss:o,icon:"exclamation-triangle",className:g.css`
        width: 500px;
      `,children:[r||(r=Object(m.jsx)("h5",{children:"Do you want to save your changes?"})),Object(m.jsxs)(f.Modal.ButtonRow,{children:[Object(m.jsx)(f.Button,{variant:"secondary",onClick:o,fill:"outline",children:"Cancel"}),Object(m.jsx)(f.Button,{variant:"destructive",onClick:n,children:"Discard"}),Object(m.jsx)(b.b,{dashboard:e,onSaveSuccess:t})]})]});var O,v=n("E5+Z"),j=n("/MKj"),S=n("waAV"),x=n("xAj+");function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return w})),function(e){e[e.UnsavedChangesModal=0]="UnsavedChangesModal",e[e.SaveLibraryPanelModal=1]="SaveLibraryPanelModal"}(O||(O={}));const w=l.a.memo(({dashboard:e})=>{const[t,n]=Object(s.useState)({original:null,modal:null}),r=Object(j.useDispatch)(),{original:a,originalPath:l,blockedLocation:d,modal:u}=t;Object(s.useEffect)(()=>{const t=setTimeout(()=>{const t=o.locationService.getLocation().pathname,r=e.getSaveModelClone();n({originalPath:t,original:r,modal:null})},1e3);return()=>{clearTimeout(t)}},[e]),Object(s.useEffect)(()=>{const t=t=>{C(e,a)||z(e,a)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[e,a]),Object(s.useEffect)(()=>{const t=i.a.subscribe(x.DashboardSavedEvent,()=>{const t=e.getSaveModelClone(),r=o.locationService.getLocation().pathname;n({originalPath:r,original:t,modal:null}),d&&k(d)});return()=>t.unsubscribe()},[e,d]);return Object(m.jsxs)(m.Fragment,{children:[Object(m.jsx)(c.b,{when:!0,message:o=>{const i=e.panelInEdit,s=new URLSearchParams(o.search);return i&&i.libraryPanel&&i.hasChanged&&!s.has("editPanel")?(n(M({},t,{modal:O.SaveLibraryPanelModal,blockedLocation:o})),!1):l!==o.pathname&&a?!!C(e,a)||(!z(e,a)||(n(M({},t,{modal:O.UnsavedChangesModal,blockedLocation:o})),!1)):(i&&!s.has("editPanel")&&r(Object(S.b)()),!0)}}),u===O.UnsavedChangesModal&&Object(m.jsx)(y,{dashboard:e,onSaveSuccess:()=>{},onDiscard:()=>{n(M({},t,{original:null,modal:null})),k(d)},onDismiss:()=>{n(M({},t,{modal:null,blockedLocation:null}))}}),u===O.SaveLibraryPanelModal&&Object(m.jsx)(v.a,{isUnsavedPrompt:!0,panel:e.panelInEdit,folderId:e.meta.folderId,onConfirm:()=>{n(M({},t,{modal:null})),k(d)},onDiscard:()=>{r(Object(S.a)()),n(M({},t,{modal:null})),k(d)},onDismiss:()=>{n(M({},t,{modal:null,blockedLocation:null}))}})]})});function k(e){e&&setTimeout(()=>o.locationService.push(e),10)}function C(e,t){if(!t)return!0;if(!a.a.isSignedIn)return!0;if(!e||!e.meta)return!0;const{canSave:n,fromScript:r,fromFile:o}=e.meta;return!a.a.isEditor&&!n||(!n||r||o)}function P(e){const t=new d.a(e);t.expandRows();const n=t.getSaveModelClone();return n.time=0,n.refresh=0,n.schemaVersion=0,n.timezone=0,delete n.iteration,n.panels=Object(u.filter)(n.panels,e=>!e.repeatPanelId&&(e.scopedVars=void 0,e.legend&&(delete e.legend.sort,delete e.legend.sortDesc),!0)),Object(u.each)(n.getVariables(),e=>{e.current=null,e.options=null,e.filters=null}),n}function z(e,t){const n=P(e.getSaveModelClone()),r=P(t),o=Object(u.find)(n.nav,{type:"timepicker"}),i=Object(u.find)(r.nav,{type:"timepicker"});o&&i&&(o.now=i.now);return h.a.toJson(n)!==h.a.toJson(r)}},"aq+K":function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));n("q1tI");var r=n("kDDq"),o=n("kDLi"),i=n("GQ3c"),a=n("v4Fa"),s=n("nKUr");const l=({initError:e})=>{const t=Object(o.useStyles)(c);return e?Object(s.jsx)("div",{className:t.dashboardLoading,children:Object(s.jsx)(o.Alert,{severity:i.b.Error,title:e.message,children:Object(a.a)(e.error)})}):null},c=e=>({dashboardLoading:r.css`
      height: 60vh;
      display: flex;
      align-items: center;
      justify-content: center;
    `})},b06y:function(e,t){e.exports=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)}},"b2S+":function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));n("q1tI");var r=n("rshM"),o=n("nKUr");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class s{constructor(e){a(this,"items",[]),a(this,"categories",[]),a(this,"parent",void 0),this.props=e}addItem(e){return e.parent=this,this.items.push(e),this}addCategory(e){return e.props.isNested=!0,e.parent=this,this.categories.push(e),this}render(e){return this.props.customRender?this.props.customRender():Object(o.jsxs)(r.a,i({},this.props,{children:[this.items.map(e=>e.render()),this.categories.map(e=>e.render())]}),this.props.title)}}},bNWW:function(e,t,n){"use strict";e.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},e.exports.Resizable=n("jqYm").default,e.exports.ResizableBox=n("E56+").default},doQp:function(e,t,n){"use strict";var r=n("pzsr"),o=r.default,i=r.DraggableCore;e.exports=o,e.exports.default=o,e.exports.DraggableCore=i},fEyB:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}o.default=e,n&&n.set(e,o);return o}(n("q1tI")),i=u(n("XaGS")),a=u(n("Gh8y")),s=n("T0XP"),l=n("q78g"),c=u(n("LvXN")),d=u(n("TNBa"));function u(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=M(e);if(t){var o=M(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return S(this,n)}}function S(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?x(e):t}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var k=!1;try{k=/firefox/i.test(navigator.userAgent)}catch(e){}var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(u,e);var t,n,r,d=j(u);function u(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),w(x(n=d.call(this,e,t)),"state",{activeDrag:null,layout:(0,s.synchronizeLayoutWithChildren)(n.props.layout,n.props.children,n.props.cols,(0,s.compactType)(n.props)),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,droppingDOMNode:null,children:[]}),w(x(n),"dragEnterCounter",0),w(x(n),"onDragOver",(function(e){var t;if(k&&(null===(t=e.nativeEvent.target)||void 0===t||!t.classList.contains("react-grid-layout")))return e.preventDefault(),!1;var r=n.props,i=r.droppingItem,a=r.margin,s=r.cols,c=r.rowHeight,d=r.maxRows,u=r.width,p=r.containerPadding,h=n.state.layout,f=e.nativeEvent,m=f.layerX,y=f.layerY,O={left:m,top:y,e:e};if(n.state.droppingDOMNode){if(n.state.droppingPosition){var v=n.state.droppingPosition,j=v.left,S=v.top;(j!=m||S!=y)&&n.setState({droppingPosition:O})}}else{var x={cols:s,margin:a,maxRows:d,rowHeight:c,containerWidth:u,containerPadding:p||a},M=(0,l.calcXY)(x,y,m,i.w,i.h);n.setState({droppingDOMNode:o.createElement("div",{key:i.i}),droppingPosition:O,layout:[].concat(g(h),[b(b({},i),{},{x:M.x,y:M.y,static:!1,isDraggable:!0})])})}e.stopPropagation(),e.preventDefault()})),w(x(n),"removeDroppingPlaceholder",(function(){var e=n.props,t=e.droppingItem,r=e.cols,o=n.state.layout,i=(0,s.compact)(o.filter((function(e){return e.i!==t.i})),(0,s.compactType)(n.props),r);n.setState({layout:i,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})})),w(x(n),"onDragLeave",(function(){n.dragEnterCounter--,0===n.dragEnterCounter&&n.removeDroppingPlaceholder()})),w(x(n),"onDragEnter",(function(){n.dragEnterCounter++})),w(x(n),"onDrop",(function(e){var t=n.props.droppingItem,r=n.state.layout,o=r.find((function(e){return e.i===t.i}));n.dragEnterCounter=0,n.removeDroppingPlaceholder(),n.props.onDrop(r,o,e)})),(0,s.autoBindHandlers)(x(n),["onDragStart","onDrag","onDragStop","onResizeStart","onResize","onResizeStop"]),n}return t=u,r=[{key:"getDerivedStateFromProps",value:function(e,t){var n;return t.activeDrag?null:((0,i.default)(e.layout,t.propsLayout)&&e.compactType===t.compactType?(0,s.childrenEqual)(e.children,t.children)||(n=t.layout):n=e.layout,n?{layout:(0,s.synchronizeLayoutWithChildren)(n,e.children,e.cols,(0,s.compactType)(e)),compactType:e.compactType,children:e.children,propsLayout:e.layout}:null)}}],(n=[{key:"componentDidMount",value:function(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}},{key:"shouldComponentUpdate",value:function(e,t){return this.props.children!==e.children||!(0,s.fastRGLPropsEqual)(this.props,e,i.default)||this.state.activeDrag!==t.activeDrag||this.state.mounted!==t.mounted||this.state.droppingPosition!==t.droppingPosition}},{key:"componentDidUpdate",value:function(e,t){if(!this.state.activeDrag){var n=this.state.layout,r=t.layout;this.onLayoutMaybeChanged(n,r)}}},{key:"containerHeight",value:function(){if(this.props.autoSize){var e=(0,s.bottom)(this.state.layout),t=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+2*t+"px"}}},{key:"onDragStart",value:function(e,t,n,r){var o=r.e,i=r.node,a=this.state.layout,l=(0,s.getLayoutItem)(a,e);if(l)return this.setState({oldDragItem:(0,s.cloneLayoutItem)(l),oldLayout:this.state.layout}),this.props.onDragStart(a,l,l,null,o,i)}},{key:"onDrag",value:function(e,t,n,r){var o=r.e,i=r.node,a=this.state.oldDragItem,l=this.state.layout,c=this.props.cols,d=(0,s.getLayoutItem)(l,e);if(d){var u={w:d.w,h:d.h,x:d.x,y:d.y,placeholder:!0,i:e};l=(0,s.moveElement)(l,d,t,n,!0,this.props.preventCollision,(0,s.compactType)(this.props),c),this.props.onDrag(l,a,d,u,o,i),this.setState({layout:(0,s.compact)(l,(0,s.compactType)(this.props),c),activeDrag:u})}}},{key:"onDragStop",value:function(e,t,n,r){var o=r.e,i=r.node;if(this.state.activeDrag){var a=this.state.oldDragItem,l=this.state.layout,c=this.props,d=c.cols,u=c.preventCollision,p=(0,s.getLayoutItem)(l,e);if(p){l=(0,s.moveElement)(l,p,t,n,!0,u,(0,s.compactType)(this.props),d),this.props.onDragStop(l,a,p,null,o,i);var h=(0,s.compact)(l,(0,s.compactType)(this.props),d),f=this.state.oldLayout;this.setState({activeDrag:null,layout:h,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(h,f)}}}},{key:"onLayoutMaybeChanged",value:function(e,t){t||(t=this.state.layout),(0,i.default)(t,e)||this.props.onLayoutChange(e)}},{key:"onResizeStart",value:function(e,t,n,r){var o=r.e,i=r.node,a=this.state.layout,l=(0,s.getLayoutItem)(a,e);l&&(this.setState({oldResizeItem:(0,s.cloneLayoutItem)(l),oldLayout:this.state.layout}),this.props.onResizeStart(a,l,l,null,o,i))}},{key:"onResize",value:function(e,t,n,r){var o=r.e,i=r.node,a=this.state,l=a.layout,c=a.oldResizeItem,d=this.props,u=d.cols,p=d.preventCollision,f=h((0,s.withLayoutItem)(l,e,(function(e){var r;if(p){var o=(0,s.getAllCollisions)(l,b(b({},e),{},{w:t,h:n})).filter((function(t){return t.i!==e.i}));if(r=o.length>0){var i=1/0,a=1/0;o.forEach((function(t){t.x>e.x&&(i=Math.min(i,t.x)),t.y>e.y&&(a=Math.min(a,t.y))})),Number.isFinite(i)&&(e.w=i-e.x),Number.isFinite(a)&&(e.h=a-e.y)}}return r||(e.w=t,e.h=n),e})),2),g=f[0],m=f[1];if(m){var y={w:m.w,h:m.h,x:m.x,y:m.y,static:!0,i:e};this.props.onResize(g,c,m,y,o,i),this.setState({layout:(0,s.compact)(g,(0,s.compactType)(this.props),u),activeDrag:y})}}},{key:"onResizeStop",value:function(e,t,n,r){var o=r.e,i=r.node,a=this.state,l=a.layout,c=a.oldResizeItem,d=this.props.cols,u=(0,s.getLayoutItem)(l,e);this.props.onResizeStop(l,c,u,null,o,i);var p=(0,s.compact)(l,(0,s.compactType)(this.props),d),h=this.state.oldLayout;this.setState({activeDrag:null,layout:p,oldResizeItem:null,oldLayout:null}),this.onLayoutMaybeChanged(p,h)}},{key:"placeholder",value:function(){var e=this.state.activeDrag;if(!e)return null;var t=this.props,n=t.width,r=t.cols,i=t.margin,a=t.containerPadding,s=t.rowHeight,l=t.maxRows,d=t.useCSSTransforms,u=t.transformScale;return o.createElement(c.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:"react-grid-placeholder",containerWidth:n,cols:r,margin:i,containerPadding:a||i,maxRows:l,rowHeight:s,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:d,transformScale:u},o.createElement("div",null))}},{key:"processGridItem",value:function(e,t){if(e&&e.key){var n=(0,s.getLayoutItem)(this.state.layout,String(e.key));if(!n)return null;var r=this.props,i=r.width,a=r.cols,l=r.margin,d=r.containerPadding,u=r.rowHeight,p=r.maxRows,h=r.isDraggable,f=r.isResizable,b=r.isBounded,g=r.useCSSTransforms,m=r.transformScale,y=r.draggableCancel,O=r.draggableHandle,v=r.resizeHandles,j=r.resizeHandle,S=this.state,x=S.mounted,M=S.droppingPosition,w="boolean"==typeof n.isDraggable?n.isDraggable:!n.static&&h,k="boolean"==typeof n.isResizable?n.isResizable:!n.static&&f,C=n.resizeHandles||v,P=w&&b&&!1!==n.isBounded;return o.createElement(c.default,{containerWidth:i,cols:a,margin:l,containerPadding:d||l,maxRows:p,rowHeight:u,cancel:y,handle:O,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:w,isResizable:k,isBounded:P,useCSSTransforms:g&&x,usePercentages:!x,transformScale:m,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:t?M:void 0,resizeHandles:C,resizeHandle:j},e)}}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,r=t.style,i=t.isDroppable,l=t.innerRef,c=(0,a.default)("react-grid-layout",n),d=b({height:this.containerHeight()},r);return o.createElement("div",{ref:l,className:c,style:d,onDrop:i?this.onDrop:s.noop,onDragLeave:i?this.onDragLeave:s.noop,onDragEnter:i?this.onDragEnter:s.noop,onDragOver:i?this.onDragOver:s.noop},o.Children.map(this.props.children,(function(t){return e.processGridItem(t)})),i&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}])&&O(t.prototype,n),r&&O(t,r),u}(o.Component);t.default=C,w(C,"displayName","ReactGridLayout"),w(C,"propTypes",d.default),w(C,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:s.noop,onDragStart:s.noop,onDrag:s.noop,onDragStop:s.noop,onResizeStart:s.noop,onResize:s.noop,onResizeStop:s.noop,onDrop:s.noop})},fJi3:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBoundPosition=function(e,t,n){if(!e.props.bounds)return[t,n];var a=e.props.bounds;a="string"==typeof a?a:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(a);var s=i(e);if("string"==typeof a){var l,c=s.ownerDocument,d=c.defaultView;if(!((l="parent"===a?s.parentNode:c.querySelector(a))instanceof d.HTMLElement))throw new Error('Bounds selector "'+a+'" could not find an element.');var u=d.getComputedStyle(s),p=d.getComputedStyle(l);a={left:-s.offsetLeft+(0,r.int)(p.paddingLeft)+(0,r.int)(u.marginLeft),top:-s.offsetTop+(0,r.int)(p.paddingTop)+(0,r.int)(u.marginTop),right:(0,o.innerWidth)(l)-(0,o.outerWidth)(s)-s.offsetLeft+(0,r.int)(p.paddingRight)-(0,r.int)(u.marginRight),bottom:(0,o.innerHeight)(l)-(0,o.outerHeight)(s)-s.offsetTop+(0,r.int)(p.paddingBottom)-(0,r.int)(u.marginBottom)}}(0,r.isNum)(a.right)&&(t=Math.min(t,a.right));(0,r.isNum)(a.bottom)&&(n=Math.min(n,a.bottom));(0,r.isNum)(a.left)&&(t=Math.max(t,a.left));(0,r.isNum)(a.top)&&(n=Math.max(n,a.top));return[t,n]},t.snapToGrid=function(e,t,n){var r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]},t.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},t.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},t.getControlPosition=function(e,t,n){var r="number"==typeof t?(0,o.getTouch)(e,t):null;if("number"==typeof t&&!r)return null;var a=i(n),s=n.props.offsetParent||a.offsetParent||a.ownerDocument.body;return(0,o.offsetXYFromParent)(r||e,s,n.props.scale)},t.createCoreData=function(e,t,n){var o=e.state,a=!(0,r.isNum)(o.lastX),s=i(e);return a?{node:s,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:s,deltaX:t-o.lastX,deltaY:n-o.lastY,lastX:o.lastX,lastY:o.lastY,x:t,y:n}},t.createDraggableData=function(e,t){var n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}};var r=n("gbW8"),o=n("8N4D");function i(e){var t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}},gR9h:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n("q1tI"),o=n("/MKj"),i=n("kDLi"),a=n("p1x6"),s=n("nKUr");const l=({repeat:e,onChange:t})=>{const n=Object(o.useSelector)(e=>Object(a.g)(e)),l=Object(r.useMemo)(()=>{const e=n.map(e=>({label:e.name,value:e.name}));return 0===e.length&&e.unshift({label:"No template variables found",value:null}),e.unshift({label:"Disable repeating",value:null}),e},[n]),c=Object(r.useCallback)(e=>t(e.value),[t]);return Object(s.jsx)(i.Select,{menuShouldPortal:!0,value:e,onChange:c,options:l})}},gbW8:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findInArray=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},t.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},t.isNum=function(e){return"number"==typeof e&&!isNaN(e)},t.int=function(e){return parseInt(e,10)},t.dontSetMe=function(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))}},ihjy:function(e,t,n){var r=n("Fxvz"),o=n("17x9");e.exports=function(e,t,n){var o=e[t];if(o){var i=[];if(Object.keys(o).forEach((function(e){-1===r.indexOf(e)&&i.push(e)})),i.length)throw new Error("Prop "+t+" passed to "+n+". Has invalid keys "+i.join(", "))}},e.exports.isRequired=function(t,n,r){if(!t[n])throw new Error("Prop "+n+" passed to "+r+" is required");return e.exports(t,n,r)},e.exports.supportingArrays=o.oneOfType([o.arrayOf(e.exports),e.exports])},jqYm:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(r,i,a):r[i]=e[i]}r.default=e,n&&n.set(e,r);return r}(n("q1tI")),o=n("doQp"),i=n("VzO5"),a=n("H4m+"),s=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=function(e){var t,n;function a(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).handleRefs={},t.lastHandleRect=null,t.slack=null,t}n=e,(t=a).prototype=Object.create(n.prototype),t.prototype.constructor=t,h(t,n);var l=a.prototype;return l.componentWillUnmount=function(){this.resetData()},l.resetData=function(){this.lastHandleRect=this.slack=null},l.runConstraints=function(e,t){var n=this.props,r=n.minConstraints,o=n.maxConstraints,i=n.lockAspectRatio;if(!r&&!o&&!i)return[e,t];if(i){var a=this.props.width/this.props.height,s=e-this.props.width,l=t-this.props.height;Math.abs(s)>Math.abs(l*a)?t=e/a:e=t*a}var c=e,d=t,u=this.slack||[0,0],p=u[0],h=u[1];return e+=p,t+=h,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),o&&(e=Math.min(o[0],e),t=Math.min(o[1],t)),this.slack=[p+(c-e),h+(d-t)],[e,t]},l.resizeHandler=function(e,t){var n=this;return function(r,o){var i=o.node,a=o.deltaX,s=o.deltaY;"onResizeStart"===e&&n.resetData();var l=("both"===n.props.axis||"x"===n.props.axis)&&"n"!==t&&"s"!==t,c=("both"===n.props.axis||"y"===n.props.axis)&&"e"!==t&&"w"!==t;if(l||c){var d=t[0],u=t[t.length-1],p=i.getBoundingClientRect();if(null!=n.lastHandleRect){if("w"===u)a+=p.left-n.lastHandleRect.left;if("n"===d)s+=p.top-n.lastHandleRect.top}n.lastHandleRect=p,"w"===u&&(a=-a),"n"===d&&(s=-s);var h=n.props.width+(l?a/n.props.transformScale:0),f=n.props.height+(c?s/n.props.transformScale:0),b=n.runConstraints(h,f);h=b[0],f=b[1];var g=h!==n.props.width||f!==n.props.height,m="function"==typeof n.props[e]?n.props[e]:null;m&&!("onResize"===e&&!g)&&(null==r.persist||r.persist(),m(r,{node:i,size:{width:h,height:f},handle:t})),"onResizeStop"===e&&n.resetData()}}},l.renderResizeHandle=function(e,t){var n=this.props.handle;if(!n)return r.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+e,ref:t});if("function"==typeof n)return n(e,t);var o=u({ref:t},"string"==typeof n.type?{}:{handleAxis:e});return r.cloneElement(n,o)},l.render=function(){var e=this,t=this.props,n=t.children,a=t.className,l=t.draggableOpts,d=(t.width,t.height,t.handle,t.handleSize,t.lockAspectRatio,t.axis,t.minConstraints,t.maxConstraints,t.onResize,t.onResizeStop,t.onResizeStart,t.resizeHandles),p=(t.transformScale,function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,s));return(0,i.cloneElement)(n,u(u({},p),{},{className:(a?a+" ":"")+"react-resizable",children:[].concat(n.props.children,d.map((function(t){var n,i=null!=(n=e.handleRefs[t])?n:e.handleRefs[t]=r.createRef();return r.createElement(o.DraggableCore,c({},l,{nodeRef:i,key:"resizableHandle-"+t,onStop:e.resizeHandler("onResizeStop",t),onStart:e.resizeHandler("onResizeStart",t),onDrag:e.resizeHandler("onResize",t)}),e.renderResizeHandle(t,i))})))}))},a}(r.Component);t.default=f,f.propTypes=a.resizableProps,f.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}},kt0J:function(e,t,n){"use strict";var r,o=n("q1tI"),i=n("/MKj"),a=n("t8hP"),s=n("UlFs"),l=n("kDLi"),c=n("Hi79"),d=n("nKUr");const u=({data:e,metadataDatasource:t})=>{var n;return t&&null!==(n=t.components)&&void 0!==n&&n.MetadataInspector?Object(d.jsx)(t.components.MetadataInspector,{datasource:t,data:e.series}):r||(r=Object(d.jsx)("div",{children:"No Metadata Inspector"}))};var p=n("vF1F"),h=n("Obii");const f=({tab:e,tabs:t,onSelectTab:n,data:r})=>{const o=Object(l.useTheme)(),i=b(o);return Object(d.jsxs)(d.Fragment,{children:[r&&Object(d.jsx)("div",{className:"muted",children:g(r)}),Object(d.jsx)(l.TabsBar,{className:i.tabsBar,children:t.map((t,r)=>Object(d.jsx)(l.Tab,{label:t.label,active:t.value===e,onChangeTab:()=>n(t)},`${t.value}-${r}`))})]})},b=Object(l.stylesFactory)(e=>({tabsBar:p.css`
      padding-left: ${e.spacing.md};
      margin: ${e.spacing.lg} -${e.spacing.sm} -${e.spacing.lg} -${e.spacing.lg};
    `}));function g(e){const{request:t}=e;if(!t)return"";const n=t.targets.length,r=t.endTime?t.endTime-t.startTime:0;return`${n} queries with total query time of ${Object(h.formattedValueToString)(Object(h.getValueFormat)("ms")(r))}`}var m,y,O=n("HgkN"),v=n("LInY"),j=n("SVrL"),S=n("qGIo"),x=n("6PW0"),M=n("/e1h");const w=({panel:e,data:t})=>{const n=window.grafanaPanelInspectActionSupplier;if(!n)return m||(m=Object(d.jsx)("div",{children:"Missing actions"}));const r=n.getActions(e);return null!=r&&r.length?Object(d.jsx)("div",{children:r.map((n,r)=>Object(d.jsxs)("div",{children:[Object(d.jsx)("h2",{children:n.title}),Object(d.jsx)("span",{children:n.description}),Object(d.jsx)(n.component,{panel:e,data:t})]},r))}):y||(y=Object(d.jsx)("div",{children:"No actions avaliable"}))},k=({panel:e,plugin:t,dashboard:n,tabs:r,data:i,isDataLoading:s,dataOptions:p,metadataDatasource:h,defaultTab:b,onDataOptionsChange:g,onClose:m})=>{const[y,k]=Object(o.useState)(null!=b?b:M.a.Data);if(!t)return null;const C=Object(c.a)(),P=null==i?void 0:i.error;let z=y;r.find(e=>e.value===y)||(z=M.a.JSON);const D=Object(a.getTemplateSrv)().replace(e.title,e.scopedVars,"text");return Object(d.jsxs)(l.Drawer,{title:"Inspect: "+(D||"Panel"),subtitle:Object(d.jsx)(f,{tabs:r,tab:z,data:i,onSelectTab:e=>k(e.value||M.a.Data)}),width:"50%",onClose:m,expandable:!0,children:[z===M.a.Data&&Object(d.jsx)(x.a,{panel:e,data:i&&i.series,isLoading:s,options:p,onOptionsChange:g}),Object(d.jsx)(l.CustomScrollbar,{autoHeightMin:"100%",children:Object(d.jsxs)(l.TabContent,{className:C.tabContent,children:[i&&z===M.a.Meta&&Object(d.jsx)(u,{data:i,metadataDatasource:h}),z===M.a.JSON&&Object(d.jsx)(O.a,{panel:e,dashboard:n,data:i,onClose:m}),z===M.a.Error&&Object(d.jsx)(S.a,{error:P}),i&&z===M.a.Stats&&Object(d.jsx)(j.a,{data:i,timeZone:n.getTimezone()}),i&&z===M.a.Query&&Object(d.jsx)(v.a,{panel:e,data:i.series,onRefreshQuery:()=>e.refresh()}),z===M.a.Actions&&Object(d.jsx)(w,{panel:e,data:i})]})})]})};var C=n("aBYM"),P=n.n(C),z=n("sCrc");var D=n("Ty5D");n.d(t,"a",(function(){return R}));const R=Object(i.connect)((e,t)=>{const n=e.dashboard.panels[t.panel.id];return n?{plugin:n.plugin}:{plugin:null}})(({panel:e,dashboard:t,plugin:n})=>{const[r,i]=Object(o.useState)({withTransforms:!1,withFieldConfig:!0}),l=Object(D.l)(),{data:c,isLoading:u,error:p}=Object(s.a)(e,r,!0),h=(e=>P()(async()=>{var t;const n=(null==e||null===(t=e.request)||void 0===t?void 0:t.targets)||[];if(e&&e.series&&n.length)for(const t of e.series)if(t.meta&&t.meta.custom){var r;const e=await Object(a.getDataSourceSrv)().get(n[0].datasource);if(e&&null!==(r=e.components)&&void 0!==r&&r.MetadataInspector)return e}},[e]).value)(c),f=((e,t,n,r,i)=>Object(o.useMemo)(()=>{const o=[];Object(z.c)(n)&&(o.push({label:"Data",value:M.a.Data}),o.push({label:"Stats",value:M.a.Stats})),i&&o.push({label:"Meta Data",value:M.a.Meta}),o.push({label:"JSON",value:M.a.JSON}),r&&r.message&&o.push({label:"Error",value:M.a.Error});const a=window.grafanaPanelInspectActionSupplier;return a&&a.getActions(e)&&o.push({label:"Actions",value:M.a.Actions}),t.meta.canEdit&&Object(z.c)(n)&&o.push({label:"Query",value:M.a.Query}),o},[e,n,i,t,r]))(e,t,n,p,h),b=new URLSearchParams(l.search).get("inspectTab");return n?Object(d.jsx)(k,{dashboard:t,panel:e,plugin:n,defaultTab:b,tabs:f,data:c,isDataLoading:u,dataOptions:r,onDataOptionsChange:i,metadataDatasource:h,onClose:()=>{a.locationService.partial({inspect:null,inspectTab:null})}}):null})},lEZL:function(e,t,n){"use strict";var r=n("q1tI"),o=n.n(r),i=n("/MKj"),a=n("jYz7"),s=n("vF1F"),l=n("pugT"),c=n("Csm0"),d=n("kDLi"),u=n("ZFWI"),p=n("HJRA"),h=n("sCrc"),f=n("Obii");const b={[f.DocsId.Transformations]:"https://grafana.com/docs/grafana/latest/panels/transformations",[f.DocsId.FieldConfig]:"https://grafana.com/docs/grafana/latest/panels/field-configuration-options/",[f.DocsId.FieldConfigOverrides]:"https://grafana.com/docs/grafana/latest/panels/field-configuration-options/#override-a-field"};var g,m=n("ngQI"),y=n("psW0"),O=n("nKUr");function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const j=({debugMode:e,index:t,data:n,uiConfig:i,configs:a,onChange:s})=>{const l=Object(d.useStyles)(S),[u,p]=Object(r.useState)([]),[h,b]=Object(r.useState)([]),m=Object(r.useMemo)(()=>a[t],[a,t]);Object(r.useEffect)(()=>{const e=a.slice(0,t).map(e=>e.transformation),r=a.slice(t,t+1).map(e=>e.transformation),o=Object(f.transformDataFrame)(e,n).subscribe(p),i=Object(f.transformDataFrame)(e,n).pipe(Object(y.b)(e=>Object(f.transformDataFrame)(r,e))).subscribe(b);return function(){o.unsubscribe(),i.unsubscribe()}},[t,n,a]);const j=Object(r.useMemo)(()=>o.a.createElement(i.editor,{options:v({},i.transformation.defaultOptions,m.transformation.options),input:u,onChange:e=>{s(t,{id:m.transformation.id,options:e})}}),[i.editor,i.transformation.defaultOptions,m.transformation.options,m.transformation.id,u,s,t]);return Object(O.jsxs)("div",{className:l.editor,"aria-label":c.a.components.TransformTab.transformationEditor(i.name),children:[j,e&&Object(O.jsxs)("div",{className:l.debugWrapper,"aria-label":c.a.components.TransformTab.transformationEditorDebugger(i.name),children:[Object(O.jsxs)("div",{className:l.debug,children:[Object(O.jsx)("div",{className:l.debugTitle,children:"Transformation input data"}),Object(O.jsx)("div",{className:l.debugJson,children:Object(O.jsx)(d.JSONFormatter,{json:u})})]}),Object(O.jsx)("div",{className:l.debugSeparator,children:g||(g=Object(O.jsx)(d.Icon,{name:"arrow-right"}))}),Object(O.jsxs)("div",{className:l.debug,children:[Object(O.jsx)("div",{className:l.debugTitle,children:"Transformation output data"}),Object(O.jsx)("div",{className:l.debugJson,children:h&&Object(O.jsx)(d.JSONFormatter,{json:h})})]})]})]})},S=e=>{const t=e.isLight?e.palette.gray85:e.palette.gray15;return{title:s.css`
      display: flex;
      padding: 4px 8px 4px 8px;
      position: relative;
      height: 35px;
      border-radius: 4px 4px 0 0;
      flex-wrap: nowrap;
      justify-content: space-between;
      align-items: center;
    `,name:s.css`
      font-weight: ${e.typography.weight.semibold};
      color: ${e.colors.textBlue};
    `,iconRow:s.css`
      display: flex;
    `,icon:s.css`
      background: transparent;
      border: none;
      box-shadow: none;
      cursor: pointer;
      color: ${e.colors.textWeak};
      margin-left: ${e.spacing.sm};
      &:hover {
        color: ${e.colors.text};
      }
    `,editor:s.css``,debugWrapper:s.css`
      display: flex;
      flex-direction: row;
    `,debugSeparator:s.css`
      width: 48px;
      min-height: 300px;
      display: flex;
      align-items: center;
      align-self: stretch;
      justify-content: center;
      margin: 0 ${e.spacing.xs};
      color: ${e.colors.textBlue};
    `,debugTitle:s.css`
      padding: ${e.spacing.sm} ${e.spacing.xxs};
      font-family: ${e.typography.fontFamily.monospace};
      font-size: ${e.typography.size.sm};
      color: ${e.colors.text};
      border-bottom: 1px solid ${t};
      flex-grow: 0;
      flex-shrink: 1;
    `,debug:s.css`
      margin-top: ${e.spacing.sm};
      padding: 0 ${e.spacing.sm} ${e.spacing.sm} ${e.spacing.sm};
      border: 1px solid ${t};
      background: ${e.isLight?e.palette.white:e.palette.gray05};
      border-radius: ${e.border.radius.sm};
      width: 100%;
      min-height: 300px;
      display: flex;
      flex-direction: column;
      align-self: stretch;
    `,debugJson:s.css`
      flex-grow: 1;
      height: 100%;
      overflow: hidden;
      padding: ${e.spacing.xs};
    `}};var x=n("lcF4"),M=n("s51j"),w=n("7iUX"),k=n("6y2Z"),C=n("JnXr");function P(){return(P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const z=({onRemove:e,index:t,id:n,data:o,configs:i,uiConfig:a,onChange:s})=>{var l;const[c,u]=Object(k.a)(!1),[p,h]=Object(k.a)(!1),f=i[t].transformation.disabled,b=Object(r.useCallback)(e=>{const t=i[e].transformation;s(e,P({},t,{disabled:!t.disabled||void 0}))},[s,i]);return Object(O.jsxs)(x.a,{id:n,index:t,title:a.name,draggable:!0,actions:({isOpen:n})=>Object(O.jsxs)(d.HorizontalGroup,{align:"center",width:"auto",children:[a.state&&Object(O.jsx)(w.a,{state:a.state}),l||(l=Object(O.jsx)(M.a,{title:"Show/hide transform help",icon:"info-circle",onClick:h,active:p})),Object(O.jsx)(M.a,{title:"Debug",disabled:!n,icon:"bug",onClick:u,active:c}),Object(O.jsx)(M.a,{title:"Disable/Enable transformation",icon:f?"eye-slash":"eye",onClick:()=>b(t),active:f}),Object(O.jsx)(M.a,{title:"Remove",icon:"trash-alt",onClick:()=>e(t)})]}),disabled:f,children:[p&&Object(O.jsx)(C.a,{markdown:D(a)}),Object(O.jsx)(j,{debugMode:c,index:t,data:o,configs:i,uiConfig:a,onChange:s})]})};function D(e){var t;return`\n${null!==(t=e.help)&&void 0!==t?t:e.description}\n\nGo the <a href="https://grafana.com/docs/grafana/latest/panels/transformations/?utm_source=grafana" target="_blank" rel="noreferrer">\ntransformation documentation\n</a> for more.\n`}const R=({data:e,onChange:t,onRemove:n,configs:r})=>Object(O.jsx)(O.Fragment,{children:r.map((o,i)=>{const a=f.standardTransformersRegistry.getIfExists(o.transformation.id);return a?Object(O.jsx)(z,{index:i,id:""+o.id,data:e,configs:r,uiConfig:a,onRemove:n,onChange:t},""+o.id):null})});var T=n("bfds"),B=n("eLz+"),W=n("t8hP");const I=({message:e,dispatch:t})=>{let n=Object(i.useDispatch)();n=null!=t?t:n;const o=Object(r.useCallback)(()=>{W.locationService.partial({tab:B.b.Query})},[]);return Object(O.jsx)(T.c,{justify:"center",style:{marginTop:"100px"},children:Object(O.jsxs)(d.VerticalGroup,{spacing:"md",children:[Object(O.jsx)("h2",{children:e}),Object(O.jsx)("div",{children:Object(O.jsx)(d.Button,{size:"md",variant:"secondary",icon:"arrow-left",onClick:o,children:"Go back to Queries"})})]})})};var E,A,N=n("GQ3c"),F=n("mtHS");function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class H extends o.a.PureComponent{constructor(e){super(e),_(this,"subscription",void 0),_(this,"onSearchChange",e=>{this.setState({search:e.target.value})}),_(this,"onSearchKeyDown",e=>{if("Enter"===e.key){const{search:e}=this.state;if(e){const t=e.toLowerCase(),n=f.standardTransformersRegistry.list().filter(e=>(e.name+e.description).toLowerCase().indexOf(t)>=0);n.length>0&&this.onTransformationAdd({value:n[0].id})}}else 27===e.keyCode&&(this.setState({search:"",showPicker:!1}),e.stopPropagation())}),_(this,"getTransformationNextId",e=>{const{transformations:t}=this.state;let n=0;const r=t.filter(t=>t.id.startsWith(e)).map(e=>e.id);return 0!==r.length&&(n=Math.max(...r.map(e=>parseInt(e.match(/\d+/)[0],10)))+1),`${e}-${n}`}),_(this,"onTransformationAdd",e=>{const{transformations:t}=this.state,n=this.getTransformationNextId(e.value);this.setState({search:"",showPicker:!1}),this.onChange([...t,{id:n,transformation:{id:e.value,options:{}}}])}),_(this,"onTransformationChange",(e,t)=>{const{transformations:n}=this.state,r=Array.from(n);r[e].transformation=t,this.onChange(r)}),_(this,"onTransformationRemove",e=>{const{transformations:t}=this.state,n=Array.from(t);n.splice(e,1),this.onChange(n)}),_(this,"onDragEnd",e=>{const{transformations:t}=this.state;if(!e||!e.destination)return;const n=e.source.index,r=e.destination.index;if(n===r)return;const o=Array.from(t),[i]=o.splice(n,1);o.splice(r,0,i),this.onChange(o)}),_(this,"renderTransformationEditors",()=>{const{data:e,transformations:t}=this.state;return Object(O.jsx)(m.a,{onDragEnd:this.onDragEnd,children:Object(O.jsx)(m.c,{droppableId:"transformations-list",direction:"vertical",children:n=>Object(O.jsxs)("div",L({ref:n.innerRef},n.droppableProps,{children:[Object(O.jsx)(R,{configs:t,data:e,onRemove:this.onTransformationRemove,onChange:this.onTransformationChange}),n.placeholder]}))})})});const t=e.panel.transformations||[],n=this.buildTransformationIds(t);this.state={transformations:t.map((e,t)=>({transformation:e,id:n[t]})),data:[],search:""}}buildTransformationIds(e){const t={},n=[];for(let r=0;r<e.length;r++){const o=e[r];void 0===t[o.id]?t[o.id]=0:t[o.id]+=1,n.push(`${e[r].id}-${t[e[r].id]}`)}return n}componentDidMount(){this.subscription=this.props.panel.getQueryRunner().getData({withTransforms:!1,withFieldConfig:!1}).subscribe({next:e=>this.setState({data:e.series})})}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}onChange(e){this.setState({transformations:e}),this.props.panel.setTransformations(e.map(e=>e.transformation))}renderTransformsPicker(){const{transformations:e,search:t}=this.state;let n=null,r=f.standardTransformersRegistry.list().sort((e,t)=>e.name>t.name?1:t.name>e.name?-1:0);if(t){const e=t.toLowerCase(),o=r.filter(t=>(t.name+t.description).toLowerCase().indexOf(e)>=0);n=Object(O.jsxs)(O.Fragment,{children:[o.length," / ",r.length,"   ",Object(O.jsx)(d.IconButton,{name:"times",surface:"header",onClick:()=>{this.setState({search:""})}})]}),r=o}const o=!(null!=e&&e.length),i=o||this.state.showPicker;return n||!i||o||(n=Object(O.jsx)(d.IconButton,{name:"times",surface:"header",onClick:()=>{this.setState({showPicker:!1})}})),Object(O.jsxs)(O.Fragment,{children:[o&&Object(O.jsx)(d.Container,{grow:1,children:Object(O.jsx)(F.a,{storageKey:"dashboard.components.TransformationEditor.featureInfoBox.isDismissed",defaultValue:!1,children:(e,t)=>{return e?null:Object(O.jsxs)(d.Alert,{title:"Transformations",severity:"info",onRemove:()=>{t(!0)},children:[E||(E=Object(O.jsxs)("p",{children:["Transformations allow you to join, calculate, re-order, hide, and rename your query results before they are visualized. ",Object(O.jsx)("br",{}),"Many transforms are not suitable if you're using the Graph visualization, as it currently only supports time series data. ",Object(O.jsx)("br",{}),"It can help to switch to the Table visualization to understand what a transformation is doing."," "]})),Object(O.jsx)("a",{href:(n=f.DocsId.Transformations,b[n]),className:"external-link",target:"_blank",rel:"noreferrer",children:"Read more"})]});var n}})}),i?Object(O.jsxs)(d.VerticalGroup,{children:[Object(O.jsx)(d.Input,{"aria-label":c.a.components.Transforms.searchInput,value:null!=t?t:"",autoFocus:!o,placeholder:"Add transformation",onChange:this.onSearchChange,onKeyDown:this.onSearchKeyDown,suffix:n}),r.map(e=>Object(O.jsx)(G,{transform:e,onClick:()=>{this.onTransformationAdd({value:e.id})}},e.name))]}):Object(O.jsx)(d.Button,{icon:"plus",variant:"secondary",onClick:()=>{this.setState({showPicker:!0})},children:"Add transformation"})]})}render(){const{panel:{alert:e}}=this.props,{transformations:t}=this.state,n=t.length>0;return!n&&e?A||(A=Object(O.jsx)(I,{message:"Transformations can't be used on a panel with existing alerts"})):Object(O.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",children:Object(O.jsx)(d.Container,{padding:"md",children:Object(O.jsxs)("div",{"aria-label":c.a.components.TransformTab.content,children:[n&&e?Object(O.jsx)(d.Alert,{severity:N.b.Error,title:"Transformations can't be used on a panel with alerts"}):null,n&&this.renderTransformationEditors(),this.renderTransformsPicker()]})})})}}function G({transform:e,onClick:t}){const n=Object(d.useStyles2)($);return Object(O.jsxs)(d.Card,{className:n.card,heading:e.name,"aria-label":c.a.components.TransformTab.newTransform(e.name),onClick:t,children:[Object(O.jsx)(d.Card.Meta,{children:e.description}),e.state&&Object(O.jsx)(d.Card.Tags,{children:Object(O.jsx)(w.a,{state:e.state})})]})}const $=e=>({card:s.css`
      margin: 0;

      > div {
        padding: ${e.spacing(1)};
      }
    `}),V=Object(d.withTheme)(H);var U=n("xAj+"),q=n("DcPX");function Q(){return(Q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class X extends r.PureComponent{constructor(...e){super(...e),Y(this,"onRemoveQuery",e=>{this.props.onQueriesChange(this.props.queries.filter(t=>t!==e))}),Y(this,"onDragEnd",e=>{const{queries:t,onQueriesChange:n}=this.props;if(!e||!e.destination)return;const r=e.source.index,o=e.destination.index;if(r===o)return;const i=Array.from(t),[a]=i.splice(r,1);i.splice(o,0,a),n(i)})}onChangeQuery(e,t){const{queries:n,onQueriesChange:r}=this.props;r(n.map((n,r)=>r===t?e:n))}onDataSourceChange(e,t){const{queries:n,onQueriesChange:r}=this.props;r(n.map((n,r)=>{if(r!==t)return n;if(n.datasource){const t=Object(W.getDataSourceSrv)().getInstanceSettings(n.datasource);if((null==t?void 0:t.type)===e.type)return Q({},n,{datasource:e.name})}return{refId:n.refId,hide:n.hide,datasource:e.name}}))}render(){const{dsSettings:e,data:t,queries:n}=this.props;return Object(O.jsx)(m.a,{onDragEnd:this.onDragEnd,children:Object(O.jsx)(m.c,{droppableId:"transformations-list",direction:"vertical",children:r=>Object(O.jsxs)("div",Q({ref:r.innerRef},r.droppableProps,{children:[n.map((r,o)=>{const i=K(r,e),a=e.meta.mixed?e=>this.onDataSourceChange(e,o):void 0;return Object(O.jsx)(q.a,{id:r.refId,index:o,data:t,query:r,dataSource:i,onChangeDataSource:a,onChange:e=>this.onChangeQuery(e,o),onRemoveQuery:this.onRemoveQuery,onAddQuery:this.props.onAddQuery,onRunQuery:this.props.onRunQueries,queries:n},r.refId)}),r.placeholder]}))})})}}const K=(e,t)=>{if(!e.datasource)return t;return Object(W.getDataSourceSrv)().getInstanceSettings(e.datasource)||t};var J,Z,ee,te,ne,re,oe,ie,ae,se=n("NXk7"),le=n("OG+f"),ce=n("bMS5"),de=n("exx3");function ue(){return(ue=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class he extends r.PureComponent{constructor(e){var t,n,r,o;super(e),pe(this,"onRelativeTimeChange",e=>{this.setState({timeRangeFrom:e.target.value})}),pe(this,"onTimeShiftChange",e=>{this.setState({timeRangeShift:e.target.value})}),pe(this,"onOverrideTime",e=>{var t;const{options:n,onChange:r}=this.props,o=be(e.target.value),i=fe(o);var a;i&&(null===(t=n.timeRange)||void 0===t?void 0:t.from)!==o&&r(ue({},n,{timeRange:ue({},null!==(a=n.timeRange)&&void 0!==a?a:{},{from:o})}));this.setState({relativeTimeIsValid:i})}),pe(this,"onTimeShift",e=>{var t;const{options:n,onChange:r}=this.props,o=be(e.target.value),i=fe(o);var a;i&&(null===(t=n.timeRange)||void 0===t?void 0:t.shift)!==o&&r(ue({},n,{timeRange:ue({},null!==(a=n.timeRange)&&void 0!==a?a:{},{shift:o})}));this.setState({timeShiftIsValid:i})}),pe(this,"onToggleTimeOverride",()=>{const{onChange:e,options:t}=this.props;this.setState({timeRangeHide:!this.state.timeRangeHide},()=>{var n;e(ue({},t,{timeRange:ue({},null!==(n=t.timeRange)&&void 0!==n?n:{},{hide:this.state.timeRangeHide})}))})}),pe(this,"onCacheTimeoutBlur",e=>{const{options:t,onChange:n}=this.props;n(ue({},t,{cacheTimeout:be(e.target.value)}))}),pe(this,"onMaxDataPointsBlur",e=>{const{options:t,onChange:n}=this.props;let r=parseInt(e.target.value,10);(isNaN(r)||0===r)&&(r=null),r!==t.maxDataPoints&&n(ue({},t,{maxDataPoints:r}))}),pe(this,"onMinIntervalBlur",e=>{const{options:t,onChange:n}=this.props,r=be(e.target.value);r!==t.minInterval&&n(ue({},t,{minInterval:r}))}),pe(this,"onOpenOptions",()=>{this.setState({isOpen:!0})}),pe(this,"onCloseOptions",()=>{this.setState({isOpen:!1})});const{options:i}=e;this.state={timeRangeFrom:(null===(t=i.timeRange)||void 0===t?void 0:t.from)||"",timeRangeShift:(null===(n=i.timeRange)||void 0===n?void 0:n.shift)||"",timeRangeHide:null!==(r=null===(o=i.timeRange)||void 0===o?void 0:o.hide)&&void 0!==r&&r,isOpen:!1,relativeTimeIsValid:!0,timeShiftIsValid:!0}}renderCacheTimeoutOption(){var e,t;const{dataSource:n,options:r}=this.props;return null!==(e=n.meta.queryOptions)&&void 0!==e&&e.cacheTimeout?Object(O.jsx)("div",{className:"gf-form-inline",children:Object(O.jsxs)("div",{className:"gf-form",children:[Object(O.jsx)(d.InlineFormLabel,{width:9,tooltip:"If your time series store has a query cache this option can override the default cache timeout. Specify a\n    numeric value in seconds.",children:"Cache timeout"}),Object(O.jsx)(d.Input,{type:"text",className:"width-6",placeholder:"60",spellCheck:!1,onBlur:this.onCacheTimeoutBlur,defaultValue:null!==(t=r.cacheTimeout)&&void 0!==t?t:""})]})}):null}renderMaxDataPointsOption(){var e,t;const{data:n,options:r}=this.props,o=null===(e=n.request)||void 0===e?void 0:e.maxDataPoints,i=null!==(t=r.maxDataPoints)&&void 0!==t?t:"",a=""===i;return Object(O.jsx)("div",{className:"gf-form-inline",children:Object(O.jsxs)("div",{className:"gf-form",children:[J||(J=Object(O.jsx)(d.InlineFormLabel,{width:9,tooltip:Object(O.jsx)(O.Fragment,{children:"The maximum data points per series. Used directly by some data sources and used in calculation of auto interval. With streaming data this value is used for the rolling buffer."}),children:"Max data points"})),Object(O.jsx)(d.Input,{type:"number",className:"width-6",placeholder:""+o,spellCheck:!1,onBlur:this.onMaxDataPointsBlur,defaultValue:i}),a&&Object(O.jsxs)(O.Fragment,{children:[Z||(Z=Object(O.jsx)("div",{className:"gf-form-label query-segment-operator",children:"="})),ee||(ee=Object(O.jsx)("div",{className:"gf-form-label",children:"Width of panel"}))]})]})})}renderIntervalOption(){var e,t,n;const{data:r,dataSource:o,options:i}=this.props,a=null===(e=r.request)||void 0===e?void 0:e.interval,s=null!==(t=o.interval)&&void 0!==t?t:"No limit";return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("div",{className:"gf-form-inline",children:Object(O.jsxs)("div",{className:"gf-form",children:[te||(te=Object(O.jsx)(d.InlineFormLabel,{width:9,tooltip:Object(O.jsxs)(O.Fragment,{children:["A lower limit for the interval. Recommended to be set to write frequency, for example ",Object(O.jsx)("code",{children:"1m"})," ","if your data is written every minute. Default value can be set in data source settings for most data sources."]}),children:"Min interval"})),Object(O.jsx)(d.Input,{type:"text",className:"width-6",placeholder:""+s,spellCheck:!1,onBlur:this.onMinIntervalBlur,defaultValue:null!==(n=i.minInterval)&&void 0!==n?n:""})]})}),Object(O.jsx)("div",{className:"gf-form-inline",children:Object(O.jsxs)("div",{className:"gf-form",children:[ne||(ne=Object(O.jsx)(d.InlineFormLabel,{width:9,tooltip:Object(O.jsxs)(O.Fragment,{children:["The evaluated interval that is sent to data source and is used in ",Object(O.jsx)("code",{children:"$__interval"})," and"," ",Object(O.jsx)("code",{children:"$__interval_ms"})]}),children:"Interval"})),Object(O.jsx)(d.InlineFormLabel,{width:6,children:a}),re||(re=Object(O.jsx)("div",{className:"gf-form-label query-segment-operator",children:"="})),oe||(oe=Object(O.jsx)("div",{className:"gf-form-label",children:"Time range / max data points"}))]})})]})}renderCollapsedText(e){var t;const{data:n,options:r}=this.props,{isOpen:o}=this.state;if(o)return;let i=null!==(t=r.maxDataPoints)&&void 0!==t?t:"";""===i&&n.request&&(i="auto = "+n.request.maxDataPoints);let a=r.minInterval;return n.request&&(a=""+n.request.interval),Object(O.jsxs)(O.Fragment,{children:[Object(O.jsxs)("div",{className:e.collapsedText,children:["MD = ",i]}),Object(O.jsxs)("div",{className:e.collapsedText,children:["Interval = ",a]})]})}render(){const{timeRangeHide:e,relativeTimeIsValid:t,timeShiftIsValid:n}=this.state,{timeRangeFrom:r,timeRangeShift:o,isOpen:i}=this.state,a=ge();return Object(O.jsxs)(x.a,{id:"Query options",index:0,title:"Query options",headerElement:this.renderCollapsedText(a),isOpen:i,onOpen:this.onOpenOptions,onClose:this.onCloseOptions,children:[this.renderMaxDataPointsOption(),this.renderIntervalOption(),this.renderCacheTimeoutOption(),Object(O.jsxs)("div",{className:"gf-form",children:[ie||(ie=Object(O.jsx)(d.InlineFormLabel,{width:9,children:"Relative time"})),Object(O.jsx)(d.Input,{type:"text",className:"width-6",placeholder:"1h",onChange:this.onRelativeTimeChange,onBlur:this.onOverrideTime,invalid:!t,value:r})]}),Object(O.jsxs)("div",{className:"gf-form",children:[ae||(ae=Object(O.jsx)("span",{className:"gf-form-label width-9",children:"Time shift"})),Object(O.jsx)(d.Input,{type:"text",className:"width-6",placeholder:"1h",onChange:this.onTimeShiftChange,onBlur:this.onTimeShift,invalid:!n,value:o})]}),(o||r)&&Object(O.jsx)("div",{className:"gf-form-inline",children:Object(O.jsx)(d.InlineField,{label:"Hide time info",labelWidth:18,children:Object(O.jsx)(d.Switch,{value:e,onChange:this.onToggleTimeOverride})})})]})}}const fe=e=>!e||f.rangeUtil.isValidTimeSpan(e),be=e=>""===e?null:e,ge=Object(d.stylesFactory)(()=>{const{theme:e}=u.a;return{collapsedText:s.css`
      margin-left: ${e.spacing.md};
      font-size: ${e.typography.size.sm};
      color: ${e.colors.textWeak};
    `}});var me,ye,Oe,ve=n("4RCQ");function je(){return(je=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class xe extends r.PureComponent{constructor(...e){super(...e),Se(this,"backendSrv",se.b),Se(this,"dataSourceSrv",Object(W.getDataSourceSrv)()),Se(this,"querySubscription",null),Se(this,"state",{isLoadingHelp:!1,helpContent:null,isPickerOpen:!1,isAddingMixed:!1,isHelpOpen:!1,scrollTop:0,data:{state:f.LoadingState.NotStarted,series:[],timeRange:Object(f.getDefaultTimeRange)()}}),Se(this,"onChangeDataSource",async e=>{let{queries:t}=this.props.options;const{dsSettings:n}=this.state;if(e.meta.mixed)for(const e of t)e.datasource!==de.a&&(e.datasource=null==n?void 0:n.name,e.datasource||(e.datasource=u.b.defaultDatasource));else if(n)if(n.meta.mixed)for(const e of t)e.datasource!==de.a&&delete e.datasource;else n.meta.id!==e.meta.id&&(t=[{refId:"A"}]);const r=await this.dataSourceSrv.get(e.name);this.onChange({queries:t,dataSource:{name:e.name,uid:e.uid,default:e.isDefault}}),this.setState({dataSource:r,dsSettings:e})}),Se(this,"onAddQueryClick",()=>{const{options:e}=this.props;this.onChange({queries:Object(ce.a)(e.queries,this.newQuery())}),this.onScrollBottom()}),Se(this,"onAddExpressionClick",()=>{this.onChange({queries:Object(ce.a)(this.props.options.queries,de.c.newQuery())}),this.onScrollBottom()}),Se(this,"onScrollBottom",()=>{this.setState({scrollTop:1e3})}),Se(this,"onUpdateAndRun",e=>{this.props.onOptionsChange(e),this.props.onRunQueries()}),Se(this,"onOpenHelp",()=>{this.setState({isHelpOpen:!0})}),Se(this,"onCloseHelp",()=>{this.setState({isHelpOpen:!1})}),Se(this,"renderMixedPicker",()=>Object(O.jsx)(W.DataSourcePicker,{mixed:!1,onChange:this.onAddMixedQuery,current:null,autoFocus:!0,variables:!0,onBlur:this.onMixedPickerBlur,openMenuOnFocus:!0})),Se(this,"onAddMixedQuery",e=>{this.onAddQuery({datasource:e.name}),this.setState({isAddingMixed:!1,scrollTop:this.state.scrollTop+1e4})}),Se(this,"onMixedPickerBlur",()=>{this.setState({isAddingMixed:!1})}),Se(this,"onAddQuery",e=>{const{queries:t}=this.props.options;this.onChange({queries:Object(ce.a)(t,e)}),this.onScrollBottom()}),Se(this,"setScrollTop",({scrollTop:e})=>{this.setState({scrollTop:e})}),Se(this,"onQueriesChange",e=>{this.onChange({queries:e})})}async componentDidMount(){const{queryRunner:e,options:t}=this.props;this.querySubscription=e.getData({withTransforms:!1,withFieldConfig:!1}).subscribe({next:e=>this.onPanelDataUpdate(e)});try{const e=await this.dataSourceSrv.get(t.dataSource.name),n=this.dataSourceSrv.getInstanceSettings(t.dataSource.name),r=await this.dataSourceSrv.get();this.setState({dataSource:e,dsSettings:n,defaultDataSource:r})}catch(e){console.log("failed to load data source",e)}}componentWillUnmount(){this.querySubscription&&(this.querySubscription.unsubscribe(),this.querySubscription=null)}onPanelDataUpdate(e){this.setState({data:e})}newQuery(){const{dsSettings:e,defaultDataSource:t}=this.state;return null!=e&&e.meta.mixed?{datasource:null==t?void 0:t.name}:{}}onChange(e){this.props.onOptionsChange(je({},this.props.options,e))}renderTopSection(e){const{onOpenQueryInspector:t,options:n}=this.props,{dataSource:r,data:o}=this.state;return Object(O.jsx)("div",{children:Object(O.jsxs)("div",{className:e.dataSourceRow,children:[me||(me=Object(O.jsx)(d.InlineFormLabel,{width:"auto",children:"Data source"})),Object(O.jsx)("div",{className:e.dataSourceRowItem,children:Object(O.jsx)(W.DataSourcePicker,{onChange:this.onChangeDataSource,current:n.dataSource.name,metrics:!0,mixed:!0,dashboard:!0,variables:!0})}),r&&Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("div",{className:e.dataSourceRowItem,children:Object(O.jsx)(d.Button,{variant:"secondary",icon:"question-circle",title:"Open data source help",onClick:this.onOpenHelp})}),Object(O.jsx)("div",{className:e.dataSourceRowItemOptions,children:Object(O.jsx)(he,{options:n,dataSource:r,data:o,onChange:this.onUpdateAndRun})}),t&&Object(O.jsx)("div",{className:e.dataSourceRowItem,children:Object(O.jsx)(d.Button,{variant:"secondary",onClick:t,"aria-label":c.a.components.QueryTab.queryInspectorButton,children:"Query inspector"})})]})]})})}renderQueries(e){const{options:t,onRunQueries:n}=this.props,{data:r}=this.state;return Object(ve.b)(e.name)?Object(O.jsx)(ve.a,{queries:t.queries,panelData:r,onChange:this.onQueriesChange,onRunQueries:n}):Object(O.jsx)("div",{"aria-label":c.a.components.QueryTab.content,children:Object(O.jsx)(X,{queries:t.queries,dsSettings:e,onQueriesChange:this.onQueriesChange,onAddQuery:this.onAddQuery,onRunQueries:n,data:r})})}isExpressionsSupported(e){return!0===(e.meta.alerting||e.meta.mixed)}renderAddQueryRow(e,t){const{isAddingMixed:n}=this.state,r=!(n||Object(ve.b)(e.name));return Object(O.jsxs)(d.HorizontalGroup,{spacing:"md",align:"flex-start",children:[r&&Object(O.jsx)(d.Button,{icon:"plus",onClick:this.onAddQueryClick,variant:"secondary","aria-label":c.a.components.QueryTab.addQuery,children:"Query"}),u.b.expressionsEnabled&&this.isExpressionsSupported(e)&&Object(O.jsx)(d.Tooltip,{content:"Beta feature: queries could stop working in next version",placement:"right",children:Object(O.jsxs)(d.Button,{icon:"plus",onClick:this.onAddExpressionClick,variant:"secondary",className:t.expressionButton,children:[ye||(ye=Object(O.jsx)("span",{children:"Expression "})),Oe||(Oe=Object(O.jsx)(d.Icon,{name:"exclamation-triangle",className:"muted",size:"sm"}))]})})]})}render(){const{scrollTop:e,isHelpOpen:t,dsSettings:n}=this.state,r=Me();return Object(O.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",scrollTop:e,setScrollTop:this.setScrollTop,children:Object(O.jsxs)("div",{className:r.innerWrapper,children:[this.renderTopSection(r),n&&Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("div",{className:r.queriesWrapper,children:this.renderQueries(n)}),this.renderAddQueryRow(n,r),t&&Object(O.jsx)(d.Modal,{title:"Data source help",isOpen:!0,onDismiss:this.onCloseHelp,children:Object(O.jsx)(le.a,{plugin:n.meta,type:"query_help"})})]})]})})}}const Me=Object(d.stylesFactory)(()=>{const{theme:e}=u.b;return{innerWrapper:s.css`
      display: flex;
      flex-direction: column;
      height: 100%;
      padding: ${e.spacing.md};
    `,dataSourceRow:s.css`
      display: flex;
      margin-bottom: ${e.spacing.md};
    `,dataSourceRowItem:s.css`
      margin-right: ${e.spacing.inlineFormMargin};
    `,dataSourceRowItemOptions:s.css`
      flex-grow: 1;
      margin-right: ${e.spacing.inlineFormMargin};
    `,queriesWrapper:s.css`
      padding-bottom: 16px;
    `,expressionWrapper:s.css``,expressionButton:s.css`
      margin-right: ${e.spacing.sm};
    `}});function we(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ke extends r.PureComponent{constructor(e){super(e),we(this,"onRunQueries",()=>{this.props.panel.refresh()}),we(this,"onOpenQueryInspector",()=>{Object(W.getLocationSrv)().update({query:{inspect:this.props.panel.id,inspectTab:"query"},partial:!0})}),we(this,"onOptionsChange",e=>{const{panel:t}=this.props,n=(e.dataSource.default?null:e.dataSource.name)!==t.datasource;t.updateQueries(e),n&&setTimeout(this.onRunQueries,10),this.forceUpdate()})}buildQueryOptions(e){return{dataSource:{name:e.datasource},queries:e.targets,maxDataPoints:e.maxDataPoints,minInterval:e.interval,timeRange:{from:e.timeFrom,shift:e.timeShift,hide:e.hideTimeOverride}}}render(){const{panel:e}=this.props,t=this.buildQueryOptions(e);return Object(O.jsx)(xe,{options:t,queryRunner:e.getQueryRunner(),onRunQueries:this.onRunQueries,onOpenQueryInspector:this.onOpenQueryInspector,onOptionsChange:this.onOptionsChange})}}var Ce,Pe,ze=n("2nhE"),De=n("QQVG"),Re=n("3ulR");function Te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Be extends r.PureComponent{constructor(...e){super(...e),Te(this,"state",{stateHistoryItems:[]}),Te(this,"clearHistory",async()=>{const{dashboard:e,panelId:t,onRefresh:n}=this.props;await Object(W.getBackendSrv)().post("/api/annotations/mass-delete",{dashboardId:e.id,panelId:t}),this.setState({stateHistoryItems:[]}),n()})}componentDidMount(){const{dashboard:e,panelId:t}=this.props;Object(W.getBackendSrv)().get(`/api/annotations?dashboardId=${e.id}&panelId=${t}&limit=50&type=alert`,{},`state-history-${e.id}-${t}`).then(t=>{const n=t.map(t=>({stateModel:Re.b.getStateDisplayModel(t.newState),time:e.formatDate(t.time,"MMM D, YYYY HH:mm:ss"),info:Re.b.getAlertAnnotationInfo(t)}));this.setState({stateHistoryItems:n})})}render(){const{stateHistoryItems:e}=this.state;return Object(O.jsxs)("div",{children:[e.length>0&&Object(O.jsxs)("div",{className:"p-b-1",children:[Ce||(Ce=Object(O.jsx)("span",{className:"muted",children:"Last 50 state changes"})),Object(O.jsx)(d.ConfirmButton,{onConfirm:this.clearHistory,confirmVariant:"destructive",confirmText:"Clear",children:Object(O.jsx)(d.Button,{className:s.css`
                  direction: ltr;
                `,variant:"destructive",icon:"trash-alt",children:"Clear history"})})]}),Object(O.jsx)("ol",{className:"alert-rule-list",children:e.length>0?e.map((e,t)=>Object(O.jsxs)("li",{className:"alert-rule-item",children:[Object(O.jsx)("div",{className:"alert-rule-item__icon "+e.stateModel.stateClass,children:Object(O.jsx)(d.Icon,{name:e.stateModel.iconClass,size:"xl"})}),Object(O.jsxs)("div",{className:"alert-rule-item__body",children:[Object(O.jsxs)("div",{className:"alert-rule-item__header",children:[Object(O.jsx)("p",{className:"alert-rule-item__name",children:e.alertName}),Object(O.jsx)("div",{className:"alert-rule-item__text",children:Object(O.jsx)("span",{className:""+e.stateModel.stateClass,children:e.stateModel.text})})]}),e.info]}),Object(O.jsx)("div",{className:"alert-rule-item__time",children:e.time})]},`${e.time}-${t}`)):Pe||(Pe=Object(O.jsx)("i",{children:"No state changes recorded"}))})]})}}var We,Ie,Ee,Ae,Ne,Fe=Be,Le=(n("eK0o"),n("Xmxp")),_e=n("ttS0");function He(){return(He=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class $e extends r.PureComponent{constructor(...e){super(...e),Ge(this,"state",{isLoading:!1,allNodesExpanded:null,testRuleResponse:{}}),Ge(this,"formattedJson",void 0),Ge(this,"clipboard",void 0),Ge(this,"setFormattedJson",e=>{this.formattedJson=e}),Ge(this,"getTextForClipboard",()=>JSON.stringify(this.formattedJson,null,2)),Ge(this,"onClipboardSuccess",()=>{Le.b.emit(f.AppEvents.alertSuccess,["Content copied to clipboard"])}),Ge(this,"onToggleExpand",()=>{this.setState(e=>He({},e,{allNodesExpanded:!this.state.allNodesExpanded}))}),Ge(this,"getNrOfOpenNodes",()=>null===this.state.allNodesExpanded?3:this.state.allNodesExpanded?20:1),Ge(this,"renderExpandCollapse",()=>{const{allNodesExpanded:e}=this.state,t=Object(O.jsxs)(O.Fragment,{children:[We||(We=Object(O.jsx)(d.Icon,{name:"minus-circle"}))," Collapse All"]}),n=Object(O.jsxs)(O.Fragment,{children:[Ie||(Ie=Object(O.jsx)(d.Icon,{name:"plus-circle"}))," Expand All"]});return e?t:n})}componentDidMount(){this.testRule()}async testRule(){const{dashboard:e,panel:t}=this.props,n=e.getSaveModelClone();n.panels=n.panels.map(e=>e.id===t.editSourceId?t.getSaveModel():e);const r={dashboard:n,panelId:t.id};this.setState({isLoading:!0});const o=await Object(W.getBackendSrv)().post("/api/alerts/test",r);this.setState({isLoading:!1,testRuleResponse:o})}render(){const{testRuleResponse:e,isLoading:t}=this.state;if(!0===t)return Ee||(Ee=Object(O.jsx)(d.LoadingPlaceholder,{text:"Evaluating rule"}));const n=this.getNrOfOpenNodes();return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("div",{className:"pull-right",children:Object(O.jsxs)(d.HorizontalGroup,{spacing:"md",children:[Object(O.jsx)("div",{onClick:this.onToggleExpand,children:this.renderExpandCollapse()}),Object(O.jsxs)(_e.a,{elType:"div",text:this.getTextForClipboard,onSuccess:this.onClipboardSuccess,children:[Ae||(Ae=Object(O.jsx)(d.Icon,{name:"copy"}))," Copy to Clipboard"]})]})}),Object(O.jsx)(d.JSONFormatter,{json:e,open:n,onDidRender:this.setFormattedJson})]})}}function Ve(){return(Ve=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class qe extends r.PureComponent{constructor(...e){super(...e),Ue(this,"element",void 0),Ue(this,"component",void 0),Ue(this,"panelCtrl",void 0),Ue(this,"state",{validationMessage:"",showStateHistory:!1,showDeleteConfirmation:!1,showTestRule:!1}),Ue(this,"onAngularPanelUpdated",()=>{this.forceUpdate()}),Ue(this,"onAddAlert",()=>{var e,t;null===(e=this.panelCtrl)||void 0===e||e._enableAlert(),null===(t=this.component)||void 0===t||t.digest(),this.forceUpdate()}),Ue(this,"onToggleModal",e=>{const t=this.state[e];this.setState(Ve({},this.state,{[e]:!t}))}),Ue(this,"renderTestRule",()=>{if(!this.state.showTestRule)return null;const{panel:e,dashboard:t}=this.props,n=()=>this.onToggleModal("showTestRule");return Object(O.jsx)(d.Modal,{isOpen:!0,icon:"bug",title:"Testing rule",onDismiss:n,onClickBackdrop:n,children:Object(O.jsx)($e,{panel:e,dashboard:t})})}),Ue(this,"renderDeleteConfirmation",()=>{if(!this.state.showDeleteConfirmation)return null;const{panel:e}=this.props,t=()=>this.onToggleModal("showDeleteConfirmation");return Object(O.jsx)(d.ConfirmModal,{isOpen:!0,icon:"trash-alt",title:"Delete",body:Ne||(Ne=Object(O.jsxs)("div",{children:["Are you sure you want to delete this alert rule?",Object(O.jsx)("br",{}),Object(O.jsx)("small",{children:"You need to save dashboard for the delete to take effect."})]})),confirmText:"Delete alert",onDismiss:t,onConfirm:()=>{var n;delete e.alert,e.thresholds=[],this.panelCtrl&&(this.panelCtrl.alertState=null,this.panelCtrl.render()),null===(n=this.component)||void 0===n||n.digest(),t()}})}),Ue(this,"renderStateHistory",()=>{var e;if(!this.state.showStateHistory)return null;const{panel:t,dashboard:n}=this.props,r=()=>this.onToggleModal("showStateHistory");return Object(O.jsx)(d.Modal,{isOpen:!0,icon:"history",title:"State history",onDismiss:r,onClickBackdrop:r,children:Object(O.jsx)(Fe,{dashboard:n,panelId:null!==(e=t.editSourceId)&&void 0!==e?e:t.id,onRefresh:()=>{var e;return null===(e=this.panelCtrl)||void 0===e?void 0:e.refresh()}})})})}componentDidMount(){this.loadAlertTab()}componentDidUpdate(e){this.loadAlertTab()}componentWillUnmount(){this.component&&this.component.destroy()}async loadAlertTab(){const{panel:e,angularPanelComponent:t}=this.props;if(!this.element||this.component)return;if(t){const e=t.getScope();if(!e.$$childHead)return void setTimeout(()=>{this.forceUpdate()});this.panelCtrl=e.$$childHead.ctrl}else this.panelCtrl=this.getReactAlertPanelCtrl();const n=Object(W.getAngularLoader)(),r={ctrl:this.panelCtrl};this.component=n.load(this.element,r,"<alert-tab />");const o=await Object(ze.a)(e.transformations,e.targets,Object(W.getDataSourceSrv)(),e.datasource);o&&this.setState({validationMessage:o})}getReactAlertPanelCtrl(){return{panel:this.props.panel,events:new f.EventBusSrv,render:()=>{this.props.panel.render()}}}render(){const{alert:e,transformations:t}=this.props.panel,{validationMessage:n}=this.state,r=t&&t.length>0;if(!e&&n)return Object(O.jsx)(I,{message:n});const o={title:"Panel has no alert rule defined",buttonIcon:"bell",onClick:this.onAddAlert,buttonTitle:"Create Alert"};return Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",children:Object(O.jsx)(d.Container,{padding:"md",children:Object(O.jsxs)("div",{"aria-label":c.a.components.AlertTab.content,children:[e&&r&&Object(O.jsx)(d.Alert,{severity:N.b.Error,title:"Transformations are not supported in alert queries"}),Object(O.jsx)("div",{ref:e=>this.element=e}),e&&Object(O.jsxs)(d.HorizontalGroup,{children:[Object(O.jsx)(d.Button,{onClick:()=>this.onToggleModal("showStateHistory"),variant:"secondary",children:"State history"}),Object(O.jsx)(d.Button,{onClick:()=>this.onToggleModal("showTestRule"),variant:"secondary",children:"Test rule"}),Object(O.jsx)(d.Button,{onClick:()=>this.onToggleModal("showDeleteConfirmation"),variant:"destructive",children:"Delete"})]}),!e&&!n&&Object(O.jsx)(De.a,Ve({},o))]})})}),this.renderTestRule(),this.renderDeleteConfirmation(),this.renderStateHistory()]})}}const Qe=Object(i.connect)((e,t)=>({angularPanelComponent:e.dashboard.panels[t.panel.id].angularComponent}),{})(qe);var Ye,Xe=n("R6rR"),Ke=n("Ty5D");const Je=({dashboard:e,panel:t,className:n})=>{const r=Object(Xe.e)(t,e),o=Object(Ke.l)();if(!r)return Ye||(Ye=Object(O.jsx)(d.Alert,{severity:"info",title:"No alerting capable query found",children:"Cannot create alerts from this panel because no query to an alerting capable datasource is found."}));const i=f.urlUtil.renderUrl("alerting/new",{defaults:JSON.stringify(r),returnTo:o.pathname+o.search});return Object(O.jsx)(d.LinkButton,{icon:"bell",href:i,className:n,children:"Create alert rule from this panel"})};var Ze,et,tt,nt=n("RLby"),rt=n("4Yfp"),ot=n("d6cI"),it=n("Jzaf"),at=n("fXZ9"),st=n("O6qV"),lt=n("w+lj");function ct({dashboard:e,panel:t,poll:n=!1}){var o,a;const s=Object(i.useDispatch)(),l=null!==(o=Object(lt.a)(e=>e.promRules[it.b]))&&void 0!==o?o:at.c,c=null!==(a=Object(lt.a)(e=>e.rulerRules[it.b]))&&void 0!==a?a:at.c;Object(r.useEffect)(()=>{const e=()=>{s(Object(rt.q)(it.b)),s(Object(rt.r)(it.b))};if(e(),n){const t=setInterval(e,ot.f);return()=>{clearInterval(t)}}return()=>{}},[s,n]);const d=l.loading||c.loading,u=[l.error,c.error].filter(e=>!!e),p=Object(st.a)(it.b);return{rules:Object(r.useMemo)(()=>p.flatMap(e=>e.groups).flatMap(e=>e.rules).filter(n=>n.annotations[ot.c.dashboardUID]===e.uid&&n.annotations[ot.c.panelID]===String(t.editSourceId)),[p,e,t]),errors:u,loading:d}}const dt=e=>({newButton:s.css`
    margin-top: ${e.spacing(3)};
  `,innerWrapper:s.css`
    padding: ${e.spacing(2)};
  `,noRulesWrapper:s.css`
    margin: ${e.spacing(2)};
    background-color: ${e.colors.background.secondary};
    padding: ${e.spacing(3)};
  `});var ut=W.config.featureToggles.ngalert?({dashboard:e,panel:t})=>{var n;const r=Object(d.useStyles2)(dt),{errors:o,loading:i,rules:a}=ct({dashboard:e,panel:t,poll:!0}),s=o.length?Object(O.jsx)(d.Alert,{title:"Errors loading rules",severity:"error",children:o.map((e,t)=>Object(O.jsxs)("div",{children:["Failed to load Grafana rules state: ",e.message||"Unknown error."]},t))}):null;return i&&!a.length?Object(O.jsxs)("div",{className:r.innerWrapper,children:[s,Ze||(Ze=Object(O.jsx)(d.LoadingPlaceholder,{text:"Loading rules..."}))]}):a.length?Object(O.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",children:Object(O.jsxs)("div",{className:r.innerWrapper,children:[s,n||(n=Object(O.jsx)(nt.a,{rules:a})),!!e.meta.canSave&&Object(O.jsx)(Je,{className:r.newButton,panel:t,dashboard:e})]})}):Object(O.jsxs)("div",{className:r.noRulesWrapper,children:[s,!!e.uid&&Object(O.jsxs)(O.Fragment,{children:[et||(et=Object(O.jsx)("p",{children:"There are no alert rules linked to this panel."})),!!e.meta.canSave&&Object(O.jsx)(Je,{panel:t,dashboard:e})]}),!e.uid&&!!e.meta.canSave&&(tt||(tt=Object(O.jsx)(d.Alert,{severity:"info",title:"Dashboard not saved",children:"Dashboard must be saved before alerts can be added."})))]})}:Qe,pt=n("cYXP");const ht=["panel","dashboard"];function ft(){return(ft=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const bt=e=>{let{panel:t,dashboard:n}=e,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,ht);const{rules:o,loading:i}=ct({panel:t,dashboard:n});return Object(O.jsx)(pt.a,ft({},r,{counter:i?null:o.length}))},gt=o.a.memo(({panel:e,dashboard:t,tabs:n,onChangeTab:o})=>{const i=Object(d.useForceUpdate)(),a=Object(d.useStyles2)(yt);Object(r.useEffect)(()=>{const t=new l.a;return t.add(e.events.subscribe(U.PanelQueriesChangedEvent,i)),t.add(e.events.subscribe(U.PanelTransformationsChangedEvent,i)),()=>t.unsubscribe()},[e,i]);const s=n.find(e=>e.active);return 0===n.length?null:Object(O.jsxs)("div",{className:a.wrapper,children:[Object(O.jsx)(d.TabsBar,{className:a.tabBar,children:n.map(n=>W.config.featureToggles.ngalert&&n.id===B.b.Alert?Object(O.jsx)(bt,{label:n.text,active:n.active,onChangeTab:()=>o(n),icon:n.icon,panel:e,dashboard:t},n.id):Object(O.jsx)(d.Tab,{label:n.text,active:n.active,onChangeTab:()=>o(n),icon:n.icon,counter:mt(e,n)},n.id))}),Object(O.jsxs)(d.TabContent,{className:a.tabContent,children:[s.id===B.b.Query&&Object(O.jsx)(ke,{panel:e,queries:e.targets}),s.id===B.b.Alert&&Object(O.jsx)(ut,{panel:e,dashboard:t}),s.id===B.b.Transform&&Object(O.jsx)(V,{panel:e})]})]})});function mt(e,t){var n;switch(t.id){case B.b.Query:return e.targets.length;case B.b.Alert:return e.alert?1:0;case B.b.Transform:return(null!==(n=e.getTransformations())&&void 0!==n?n:[]).length}return null}gt.displayName="PanelEditorTabs";const yt=e=>({wrapper:s.css`
      display: flex;
      flex-direction: column;
      height: 100%;
    `,tabBar:s.css`
      padding-left: ${e.spacing(2)};
    `,tabContent:s.css`
      padding: 0;
      display: flex;
      flex-direction: column;
      flex-grow: 1;
      min-height: 0;
      background: ${e.colors.background.primary};
      border-right: 1px solid ${e.components.panel.borderColor};
    `});var Ot=n("maUf"),vt=n("tEy8"),jt=n("pWAG");const St=e=>t=>t.plugins.panels[e]||Object(jt.b)(`Panel plugin not found (${e})`,!0),xt=({panel:e})=>{const t=Object(d.useStyles)(Mt),n=Object(i.useDispatch)(),r=Object(i.useSelector)(St(e.type)),o=Object(i.useSelector)(e=>e.panelEditor.ui.isPanelOptionsVisible),a=Object(i.useSelector)(e=>e.panelEditor.isVizPickerOpen);return r?Object(O.jsx)("div",{className:t.wrapper,children:Object(O.jsxs)(d.ButtonGroup,{children:[Object(O.jsx)(d.ToolbarButton,{className:t.vizButton,tooltip:"Click to change visualization",imgSrc:r.meta.info.logos.small,isOpen:a,onClick:()=>{n(Object(vt.g)(!a))},"aria-label":c.a.components.PanelEditor.toggleVizPicker,fullWidth:!0,children:r.meta.name}),Object(O.jsx)(d.ToolbarButton,{tooltip:o?"Close options pane":"Show options pane",icon:o?"angle-right":"angle-left",onClick:()=>{n(Object(vt.e)({isPanelOptionsVisible:!o}))},"aria-label":c.a.components.PanelEditor.toggleVizOptions})]})}):null};xt.displayName="VisualizationTab";const Mt=e=>({wrapper:s.css`
      display: flex;
      flex-direction: column;
    `,vizButton:s.css`
      text-align: left;
    `});var wt,kt=n("GkHB"),Ct=n("gR9h"),Pt=n("PkIl"),zt=n("b2S+"),Dt=n("Mk6Z");const Rt=({panel:e,formatDate:t})=>{var n;const r=Object(d.useStyles)(Tt);return Object(Dt.a)(e)?Object(O.jsx)(O.Fragment,{children:Object(O.jsxs)("p",{className:r.libraryPanelInfo,children:[`Used on ${e.libraryPanel.meta.connectedDashboards} `,1===e.libraryPanel.meta.connectedDashboards?"dashboard":"dashboards",wt||(wt=Object(O.jsx)("br",{})),"Last edited on ",null!==(n=null==t?void 0:t(e.libraryPanel.meta.updated,"L"))&&void 0!==n?n:e.libraryPanel.meta.updated," by",e.libraryPanel.meta.updatedBy.avatarUrl&&Object(O.jsx)("img",{width:"22",height:"22",className:r.userAvatar,src:e.libraryPanel.meta.updatedBy.avatarUrl,alt:"Avatar for "+e.libraryPanel.meta.updatedBy.name}),e.libraryPanel.meta.updatedBy.name]})}):null},Tt=e=>({libraryPanelInfo:s.css`
      color: ${e.colors.textSemiWeak};
      font-size: ${e.typography.size.sm};
      margin-left: ${e.spacing.xxs};
    `,userAvatar:s.css`
      border-radius: 50%;
      box-sizing: content-box;
      width: 22px;
      height: 22px;
      padding-left: ${e.spacing.sm};
      padding-right: ${e.spacing.sm};
    `});function Bt(e){var t;const{panel:n,onPanelConfigChange:r,dashboard:o}=e,i=new zt.a({title:"Panel options",id:"Panel options",isOpenDefault:!0});return Object(Dt.a)(n)&&i.addItem(new Pt.a({title:"Library panel information",render:function(){return Object(O.jsx)(Rt,{panel:n,formatDate:o.formatDate})}})),i.addItem(new Pt.a({title:"Title",value:n.title,popularRank:1,render:function(){return Object(O.jsx)(d.Input,{id:"PanelFrameTitle",defaultValue:n.title,onBlur:e=>r("title",e.currentTarget.value)})}})).addItem(new Pt.a({title:"Description",description:n.description,value:n.description,render:function(){return Object(O.jsx)(d.TextArea,{defaultValue:n.description,onBlur:e=>r("description",e.currentTarget.value)})}})).addItem(new Pt.a({title:"Transparent background",render:function(){return Object(O.jsx)(d.Switch,{value:n.transparent,id:"Transparent background",onChange:e=>r("transparent",e.currentTarget.checked)})}})).addCategory(new zt.a({title:"Panel links",id:"Panel links",isOpenDefault:!1,itemsCount:null===(t=n.links)||void 0===t?void 0:t.length}).addItem(new Pt.a({title:"Panel links",render:function(){return Object(O.jsx)(d.DataLinksInlineEditor,{links:n.links,onChange:e=>r("links",e),getSuggestions:kt.c,data:[]})}}))).addCategory(new zt.a({title:"Repeat options",id:"Repeat options",isOpenDefault:!1}).addItem(new Pt.a({title:"Repeat by variable",description:"Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.",render:function(){return Object(O.jsx)(Ct.a,{repeat:n.repeat,onChange:e=>{r("repeat",e)}})}})).addItem(new Pt.a({title:"Repeat direction",showIf:()=>!!n.repeat,render:function(){return Object(O.jsx)(d.RadioButtonGroup,{options:[{label:"Horizontal",value:"h"},{label:"Vertical",value:"v"}],value:n.repeatDirection||"h",onChange:e=>r("repeatDirection",e)})}})).addItem(new Pt.a({title:"Max per row",showIf:()=>Boolean(n.repeat&&"h"===n.repeatDirection),render:function(){const e=[2,3,4,6,8,12].map(e=>({label:e.toString(),value:e}));return Object(O.jsx)(d.Select,{menuShouldPortal:!0,options:e,value:n.maxPerRow,onChange:e=>r("maxPerRow",e.value)})}})))}var Wt=n("qK5g"),It=n("EKT6"),Et=n("rshM"),At=n("LvDl");const Nt=({property:e,context:t,registry:n,onChange:r,onRemove:o,isSystemOverride:i})=>{var a,l;const c=Object(d.useTheme)(),u=Ft(c),p=null==n?void 0:n.getIfExists(e.id);if(!p)return null;const h=Array.isArray(e.value)||e.id===f.FieldConfigProperty.Thresholds||e.id===f.FieldConfigProperty.Links||e.id===f.FieldConfigProperty.Mappings,b=null===(a=p.category)||void 0===a?void 0:a.filter(e=>e!==p.name);let g;const m=(t=!0,n=!1)=>(r=!1)=>Object(O.jsxs)(d.HorizontalGroup,{justify:"space-between",children:[Object(O.jsxs)(d.Label,{category:b,description:t?p.description:void 0,children:[p.name,!r&&n&&p.getItemsCount&&Object(O.jsx)(d.Counter,{value:p.getItemsCount(e.value)})]}),!i&&(l||(l=Object(O.jsx)("div",{children:Object(O.jsx)(d.IconButton,{name:"times",onClick:o})})))]});return g=h?Object(O.jsx)(Et.a,{id:p.name,renderTitle:m(!1,!0),className:s.css`
          padding-left: 0;
          padding-right: 0;
        `,isNested:!0,isOpenDefault:void 0!==e.value,children:Object(O.jsx)(p.override,{value:e.value,onChange:e=>{r(e)},item:p,context:t})}):Object(O.jsx)("div",{children:Object(O.jsx)(d.Field,{label:m()(),description:p.description,children:Object(O.jsx)(p.override,{value:e.value,onChange:e=>{r(e)},item:p,context:t})})}),Object(O.jsx)("div",{className:Object(s.cx)(h&&u.collapsibleOverrideEditor,!h&&"dynamicConfigValueEditor--nonCollapsible"),children:g})},Ft=Object(d.stylesFactory)(e=>({collapsibleOverrideEditor:s.css`
      label: collapsibleOverrideEditor;
      & + .dynamicConfigValueEditor--nonCollapsible {
        margin-top: ${e.spacing.formSpacingBase}px;
      }
    `}));var Lt;const _t=({isExpanded:e,registry:t,matcherUi:n,overrideName:r,override:o,onOverrideRemove:i})=>{const a=Object(d.useStyles)(Ht),s=o.properties.map(e=>t.getIfExists(e.id)).filter(e=>!!e).map(e=>null==e?void 0:e.name).join(", "),l=n.optionsToLabel(o.matcher.options);return Object(O.jsxs)("div",{children:[Object(O.jsxs)(d.HorizontalGroup,{justify:"space-between",children:[Object(O.jsx)("div",{children:r}),e&&Object(O.jsx)(d.IconButton,{name:"trash-alt",onClick:i,title:"Remove override"})]}),!e&&Object(O.jsx)("div",{className:a.overrideDetails,children:Object(O.jsxs)("div",{className:a.options,title:l,children:[l," ",Lt||(Lt=Object(O.jsx)(d.Icon,{name:"angle-right"}))," ",s]})})]})};_t.displayName="OverrideTitle";const Ht=e=>({matcherUi:s.css`
      padding: ${e.spacing.sm};
    `,propertyPickerWrapper:s.css`
      margin-top: ${2*e.spacing.formSpacingBase}px;
    `,overrideDetails:s.css`
      font-size: ${e.typography.size.sm};
      color: ${e.colors.textWeak};
      font-weight: ${e.typography.weight.regular};
    `,options:s.css`
      overflow: hidden;
      padding-right: ${e.spacing.xl};
    `,unknownLabel:s.css`
      margin-bottom: 0;
    `});function Gt(){return(Gt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function $t(e){var t,n;const r=[],o=e.panel.fieldConfig,i=e.plugin.fieldConfigRegistry,a=null!==(t=null===(n=e.data)||void 0===n?void 0:n.series)&&void 0!==t?t:[];if(i.isEmpty())return[];const s=(t,n)=>{let r=Object(At.cloneDeep)(o.overrides);r[t]=n,e.onFieldConfigsChange(Gt({},o,{overrides:r}))},l=t=>{let n=Object(At.cloneDeep)(o.overrides);n.splice(t,1),e.onFieldConfigsChange(Gt({},o,{overrides:n}))},c={data:a,getSuggestions:e=>Object(kt.a)(a,e),isOverride:!0};for(let t=0;t<o.overrides.length;t++){const n=o.overrides[t],a="Override "+(t+1),u=d.fieldMatchersUI.get(n.matcher.id),p=Vt(i),h=Object(f.isSystemOverride)(n),b=0===n.properties.length?1:0,g=new zt.a({title:a,id:a,forceOpen:b,renderTitle:function(e){return Object(O.jsx)(_t,{override:n,isExpanded:e,registry:i,overrideName:a,matcherUi:u,onOverrideRemove:()=>l(t)})}}),m=e=>{n.matcher.options=e,s(t,n)},y=(e,r)=>{const o=i.get(r.value),a={id:o.id,value:o.defaultValue};n.properties?e.properties.push(a):e.properties=[a],s(t,e)};g.addItem(new Pt.a({title:u.name,render:function(){var t,r;return Object(O.jsx)(u.component,{matcher:u.matcher,data:null!==(t=null===(r=e.data)||void 0===r?void 0:r.series)&&void 0!==t?t:[],options:n.matcher.options,onChange:m})}}));for(let e=0;e<n.properties.length;e++){const r=n.properties[e],o=i.getIfExists(r.id);if(!o)continue;const a=r=>{n.properties[e].value=r,s(t,n)},l=()=>{n.properties.splice(e,1),s(t,n)};g.addItem(new Pt.a({title:o.name,skipField:!0,render:function(){return Object(O.jsx)(Nt,{isSystemOverride:h,onChange:a,onRemove:l,property:r,registry:i,context:c},`${r.id}/${e}`)}}))}!h&&n.matcher.options&&g.addItem(new Pt.a({title:"----------",skipField:!0,render:function(){return Object(O.jsx)(d.ValuePicker,{label:"Add override property",variant:"secondary",isFullWidth:!0,icon:"plus",menuPlacement:"auto",options:p,onChange:e=>y(n,e)},"Add override property")}})),r.push(g)}return r.push(new zt.a({title:"add button",id:"add button",customRender:function(){return Object(O.jsx)(Ut,{children:Object(O.jsx)(d.ValuePicker,{icon:"plus",label:"Add field override",variant:"secondary",menuPlacement:"auto",isFullWidth:!0,size:"md",options:d.fieldMatchersUI.list().filter(e=>!e.excludeFromPicker).map(e=>({label:e.name,value:e.id,description:e.description})),onChange:t=>(t=>{e.onFieldConfigsChange(Gt({},o,{overrides:[...o.overrides,{matcher:{id:t.value},properties:[]}]}))})(t)})},"Add override")}})),r}function Vt(e){return e.list().filter(e=>!e.hideFromOverrides).map(e=>{let t=e.name;return e.category&&(t=[...e.category,e.name].join(" > ")),{label:t,value:e.id,description:e.description}})}function Ut({children:e}){const t=Object(d.useStyles2)(qt);return Object(O.jsx)("div",{className:t,children:e})}function qt(e){return Object(s.css)({borderTop:"1px solid "+e.colors.border.weak,padding:""+e.spacing(2)})}class Qt{constructor(e,t){this.categories=e,this.overrides=t}search(e){const t=new RegExp(e,"i"),n=this.collectHits(this.categories,t,[]).sort(Yt).map(e=>e.item),r=this.collectHits(this.overrides,t,[]).sort(Yt).map(e=>e.item);return{optionHits:n,overrideHits:this.buildOverrideHitCategories(r),totalCount:this.getAllOptionsCount(this.categories)}}collectHits(e,t,n){for(const r of e){const e=t.test(r.props.title);for(const o of r.items)t.test(o.props.title)?n.push({item:o,rank:1}):o.props.description&&t.test(o.props.description)?n.push({item:o,rank:2}):e&&n.push({item:o,rank:3});r.categories.length>0&&this.collectHits(r.categories,t,n)}return n}getAllOptionsCount(e){var t=0;for(const n of e)t+=n.items.length,n.categories.length>0&&(t+=this.getAllOptionsCount(n.categories));return t}buildOverrideHitCategories(e){const t={};for(const n of e){let e=t[n.parent.props.title];e||(e=t[n.parent.props.title]=new zt.a(n.parent.props),e.addItem(n.parent.items[0])),e.items[0].props.title!==n.props.title&&e.addItem(n)}return Object.values(t)}}function Yt(e,t){return e.rank-t.rank}var Xt=n("J4KJ"),Kt=n("SMGL");function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Zt=(e,t)=>({angularPanelComponent:e.dashboard.panels[t.panel.id].angularComponent}),en={changePanelPlugin:Xt.b};Object(i.connect)(Zt,en);class tn extends r.PureComponent{constructor(e){super(e),Jt(this,"element",void 0),Jt(this,"angularOptions",void 0)}componentDidMount(){this.loadAngularOptions()}componentDidUpdate(e){this.props.plugin!==e.plugin&&this.cleanUpAngularOptions(),this.loadAngularOptions()}componentWillUnmount(){this.cleanUpAngularOptions()}cleanUpAngularOptions(){this.angularOptions&&(this.angularOptions.destroy(),this.angularOptions=null)}loadAngularOptions(){const{panel:e,angularPanelComponent:t,changePanelPlugin:n}=this.props;if(!this.element||!t||this.angularOptions)return;const r=t.getScope();if(!r.$$childHead)return void setTimeout(()=>{this.forceUpdate()});const o=r.$$childHead.ctrl;o.initEditMode(),o.onPluginTypeChange=t=>{n(e,t.id)};let i="";for(let e=0;e<o.editorTabs.length;e++){const t=o.editorTabs[e];t.isOpen=(a=t.title,s=0===e,Kt.a.getBool("panel-edit-section-"+a,s)),i+=`\n      <div class="panel-options-group" ng-cloak>\n        <div class="panel-options-group__header" ng-click="toggleOptionGroup(${e})" aria-label="${t.title} section">\n          <div class="panel-options-group__icon">\n            <icon name="ctrl.editorTabs[${e}].isOpen ? 'angle-down' : 'angle-right'"></icon>\n          </div>\n          <div class="panel-options-group__title">${t.title}</div>\n        </div>\n        <div class="panel-options-group__body" ng-if="ctrl.editorTabs[${e}].isOpen">\n          <panel-editor-tab editor-tab="ctrl.editorTabs[${e}]" ctrl="ctrl"></panel-editor-tab>\n        </div>\n      </div>\n      `}var a,s;const l=Object(W.getAngularLoader)(),c={ctrl:o,toggleOptionGroup:e=>{const t=o.editorTabs[e];t.isOpen=!t.isOpen,function(e,t){Kt.a.set("panel-edit-section-"+e,t?"true":"false")}(t.title,t.isOpen)}};this.angularOptions=l.load(this.element,c,i),this.angularOptions.digest()}render(){return Object(O.jsx)("div",{ref:e=>this.element=e})}}const nn=Object(i.connect)(Zt,en)(tn);function rn(e){const t=[];for(const n of e)for(const e of n.items)"Unit"===e.props.title&&(e.props.popularRank=2),"Min"===e.props.title&&(e.props.popularRank=3),"Max"===e.props.title&&(e.props.popularRank=4),"Display name"===e.props.title&&(e.props.popularRank=5),e.props.popularRank&&t.push(e);return t.sort((e,t)=>e.props.popularRank-t.props.popularRank)}const on=e=>{const{plugin:t,dashboard:n,panel:o}=e,[i,a]=Object(r.useState)(""),[s,l]=Object(r.useState)(sn.All),c=Object(d.useStyles2)(ln),[u,p,h]=Object(r.useMemo)(()=>[Bt(e),Object(Wt.b)(e),$t(e)],[o.configRev,e.data]),f=[],b=i.length>0,g=Object(r.useMemo)(an,[]),m=[u,...p];if(b)f.push(function(e,t,n){const r=new Qt(e,t),{optionHits:o,totalCount:i,overrideHits:a}=r.search(n);return Object(O.jsxs)("div",{children:[Object(O.jsx)(Et.a,{id:"Found options",title:`Matched ${o.length}/${i} options`,forceOpen:1,children:o.map(e=>e.render(n))},"Normal options"),a.map(e=>e.render(n))]},"search results")}(m,h,i)),e.plugin.angularPanelCtrl&&f.push(Object(O.jsx)("div",{className:c.searchNotice,children:"This is an old visualization type that does not support searching all options."},"Search notice"));else switch(s){case sn.All:f.push(u.render()),e.plugin.angularPanelCtrl&&f.push(Object(O.jsx)(nn,{plugin:t,dashboard:n,panel:o},"AngularOptions"));for(const e of p)f.push(e.render());for(const e of h)f.push(e.render());break;case sn.Overrides:for(const e of h)f.push(e.render());break;case sn.Recent:f.push(Object(O.jsx)(Et.a,{id:"Recent options",title:"Recent options",forceOpen:1,children:rn(m).map(e=>e.render())},"Recent options"))}const y=!b&&!t.fieldConfigRegistry.isEmpty();return Object(O.jsxs)("div",{className:c.wrapper,children:[Object(O.jsxs)("div",{className:c.formBox,children:[Object(O.jsx)("div",{className:c.formRow,children:Object(O.jsx)(It.a,{width:0,value:i,onChange:a,placeholder:"Search options"})}),y&&Object(O.jsx)("div",{className:c.formRow,children:Object(O.jsx)(d.RadioButtonGroup,{options:g,value:s,fullWidth:!0,onChange:l})})]}),Object(O.jsx)("div",{className:c.scrollWrapper,children:Object(O.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",children:Object(O.jsx)("div",{className:c.mainBox,children:f})})})]})};function an(){return[{label:sn.All,value:sn.All},{label:sn.Overrides,value:sn.Overrides}]}let sn;!function(e){e.All="All",e.Overrides="Overrides",e.Recent="Recent"}(sn||(sn={}));const ln=e=>({wrapper:s.css`
    height: 100%;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;

    .search-fragment-highlight {
      color: ${e.colors.warning.text};
      background: transparent;
    }
  `,searchBox:s.css`
    display: flex;
    flex-direction: column;
    min-height: 0;
  `,formRow:s.css`
    margin-bottom: ${e.spacing(1)};
  `,formBox:s.css`
    padding: ${e.spacing(1)};
    background: ${e.colors.background.primary};
    border: 1px solid ${e.components.panel.borderColor};
    border-bottom: none;
  `,closeButton:s.css`
    margin-left: ${e.spacing(1)};
  `,searchHits:s.css`
    padding: ${e.spacing(1,1,0,1)};
  `,scrollWrapper:s.css`
    flex-grow: 1;
    min-height: 0;
  `,searchNotice:s.css`
    font-size: ${e.typography.size.sm};
    color: ${e.colors.text.secondary};
    padding: ${e.spacing(1)};
    text-align: center;
  `,mainBox:s.css`
    background: ${e.colors.background.primary};
    border: 1px solid ${e.components.panel.borderColor};
    border-top: none;
    flex-grow: 1;
  `});var cn=n("1S9k"),dn=n("DR0N"),un=n("c3cd"),pn=n("ZAQQ"),hn=n("K0rs"),fn=n("p+Sq");const bn=({onConfirm:e,onDismiss:t,panel:n})=>{const r=Object(Dt.a)(n),o=(r?"Changing":"Replace with")+" library panel",i=(r?"Changing":"Replacing with a")+" library panel will remove any changes since last save.";return Object(O.jsx)(d.ConfirmModal,{onConfirm:e,onDismiss:t,confirmText:r?"Change":"Replace",title:o,body:i,dismissText:"Cancel",isOpen:!0})};var gn=n("uC62");function mn(){return(mn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const yn=({panel:e,searchQuery:t})=>{var n;const o=Object(d.useStyles2)(On),[a,s]=Object(r.useState)(!1),[l,c]=Object(r.useState)(void 0),[u,p]=Object(r.useState)([]),h=Object(r.useCallback)(e=>{p(e.map(e=>e.id))},[p]),f=Object(fn.a)().getCurrent(),b=Object(i.useDispatch)();return Object(O.jsxs)(d.VerticalGroup,{spacing:"md",children:[!e.libraryPanel&&Object(O.jsx)(d.VerticalGroup,{align:"center",children:Object(O.jsx)(d.Button,{icon:"plus",onClick:()=>{s(!0)},variant:"secondary",fullWidth:!0,children:"Create new library panel"})}),Object(O.jsx)(gn.a,{onChange:h}),Object(O.jsx)("div",{className:o.libraryPanelsView,children:Object(O.jsx)(pn.a,{currentPanelId:null===(n=e.libraryPanel)||void 0===n?void 0:n.uid,searchString:t,panelFilter:u,onClickCard:e=>{c(e)},showSecondaryActions:!0})}),a&&Object(O.jsx)(un.b,{panel:e,onDismiss:()=>s(!1),initialFolderId:null==f?void 0:f.meta.folderId,isOpen:a}),l&&Object(O.jsx)(bn,{panel:e,onDismiss:()=>{c(void 0)},onConfirm:async()=>{if(!l)return;c(void 0);e.type!==l.model.type&&await b(Object(Xt.b)(e,l.model.type)),e.restoreModel(mn({},l.model,{gridPos:e.gridPos,id:e.id,libraryPanel:Object(hn.d)(l)})),e.configRev=0,e.refresh();const t=e.events.subscribe(U.PanelDirectiveReadyEvent,()=>{e.refresh(),t.unsubscribe()});e.events.publish(U.PanelQueriesChangedEvent),e.events.publish(U.PanelOptionsChangedEvent)}})]})},On=e=>({libraryPanelsView:s.css`
      width: 100%;
    `});var vn;const jn=({panel:e})=>{const t=Object(i.useSelector)(St(e.type)),[n,o]=Object(r.useState)(""),[a,s]=Object(r.useState)(Sn.Visualizations),l=Object(i.useDispatch)(),u=Object(d.useStyles)(xn),p=Object(r.useRef)(null),h=Object(r.useCallback)((n,r)=>{n.id!==t.meta.id&&l(Object(Xt.b)(e,n.id)),r||l(Object(vt.g)(!1))},[l,e,t.meta.id]);Object(r.useEffect)(()=>{p.current&&p.current.focus()},[a]);const f=Object(r.useCallback)(e=>{if("Enter"===e.key){const n=e.currentTarget.value,r=Object(cn.c)(),o=Object(cn.b)(r,n,t.meta);o&&o.length&&h(o[0],!1)}},[h,t.meta]),b=""!==n?Object(O.jsx)(d.Button,{icon:"times",fill:"text",size:"sm",onClick:()=>o(""),children:"Clear"}):null;if(!t)return null;const g=[{label:"Visualizations",value:Sn.Visualizations},{label:"Library panels",value:Sn.LibraryPanels,description:"Reusable panels you can share between multiple dashboards."}];return Object(O.jsxs)("div",{className:u.openWrapper,children:[Object(O.jsxs)("div",{className:u.formBox,children:[Object(O.jsxs)("div",{className:u.searchRow,children:[Object(O.jsx)(d.Input,{value:n,onChange:e=>o(e.currentTarget.value),onKeyPress:f,prefix:vn||(vn=Object(O.jsx)(d.Icon,{name:"search"})),suffix:b,ref:p,placeholder:"Search for..."}),Object(O.jsx)(d.Button,{title:"Close",variant:"secondary",icon:"angle-up",className:u.closeButton,"aria-label":c.a.components.PanelEditor.toggleVizPicker,onClick:()=>{l(Object(vt.g)(!1))}})]}),Object(O.jsx)(dn.a,{className:u.customFieldMargin,children:Object(O.jsx)(d.RadioButtonGroup,{options:g,value:a,onChange:s,fullWidth:!0})})]}),Object(O.jsx)("div",{className:u.scrollWrapper,children:Object(O.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",children:Object(O.jsxs)("div",{className:u.scrollContent,children:[a===Sn.Visualizations&&Object(O.jsx)(cn.a,{current:t.meta,onTypeChange:h,searchQuery:n,onClose:()=>{}}),a===Sn.LibraryPanels&&Object(O.jsx)(yn,{searchQuery:n,panel:e},"Panel Library")]})})})]})};var Sn;!function(e){e[e.Visualizations=0]="Visualizations",e[e.LibraryPanels=1]="LibraryPanels"}(Sn||(Sn={})),jn.displayName="VisualizationSelectPane";const xn=e=>({icon:s.css`
      color: ${e.palette.gray33};
    `,wrapper:s.css`
      display: flex;
      flex-direction: column;
      flex: 1 1 0;
      height: 100%;
    `,vizButton:s.css`
      text-align: left;
    `,scrollWrapper:s.css`
      flex-grow: 1;
      min-height: 0;
    `,scrollContent:s.css`
      padding: ${e.spacing.sm};
    `,openWrapper:s.css`
      display: flex;
      flex-direction: column;
      flex: 1 1 100%;
      height: 100%;
      background: ${e.colors.bg1};
      border: 1px solid ${e.colors.border1};
    `,searchRow:s.css`
      display: flex;
      margin-bottom: ${e.spacing.sm};
    `,closeButton:s.css`
      margin-left: ${e.spacing.sm};
    `,customFieldMargin:s.css`
      margin-bottom: ${e.spacing.sm};
    `,formBox:s.css`
      padding: ${e.spacing.sm};
      padding-bottom: 0;
    `});var Mn=n("UlFs");const wn=({plugin:e,panel:t,width:n,onFieldConfigsChange:r,onPanelOptionsChanged:o,onPanelConfigChange:a,dashboard:s})=>{const l=Object(d.useStyles)(kn),u=Object(i.useSelector)(e=>e.panelEditor.isVizPickerOpen),{data:p}=Object(Mn.a)(t,{withTransforms:!0,withFieldConfig:!1},!0);return Object(O.jsxs)("div",{className:l.wrapper,"aria-label":c.a.components.PanelEditor.OptionsPane.content,children:[!u&&Object(O.jsxs)(O.Fragment,{children:[Object(O.jsx)("div",{className:l.vizButtonWrapper,children:Object(O.jsx)(xt,{panel:t})}),Object(O.jsx)("div",{className:l.optionsWrapper,children:Object(O.jsx)(on,{panel:t,dashboard:s,plugin:e,data:p,onFieldConfigsChange:r,onPanelOptionsChanged:o,onPanelConfigChange:a})})]}),u&&Object(O.jsx)(jn,{panel:t})]})},kn=e=>({wrapper:s.css`
      height: 100%;
      width: 100%;
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      padding: 0;
    `,optionsWrapper:s.css`
      flex-grow: 1;
      min-height: 0;
    `,vizButtonWrapper:s.css`
      padding: 0 ${e.spacing.md} ${e.spacing.md} 0;
    `,legacyOptions:s.css`
      label: legacy-options;
      .panel-options-grid {
        display: flex;
        flex-direction: column;
      }
      .panel-options-group {
        margin-bottom: 0;
      }
      .panel-options-group__body {
        padding: ${e.spacing.md} 0;
      }

      .section {
        display: block;
        margin: ${e.spacing.md} 0;

        &:first-child {
          margin-top: 0;
        }
      }
    `});var Cn=n("VBuW"),Pn=n("17x9"),zn=n.n(Pn),Dn=n("ihjy"),Rn=n.n(Dn),Tn=n("VCL8");function Bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function In(e,t,n){return t&&Wn(e.prototype,t),n&&Wn(e,n),e}function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function An(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){En(e,t,n[t])}))}return e}function Nn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ln(e,t)}function Fn(e){return(Fn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ln(e,t){return(Ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_n(e):t}var Gn=function(e){function t(){return Bn(this,t),Hn(this,Fn(t).apply(this,arguments))}return Nn(t,e),In(t,[{key:"render",value:function(){var e=this.props,t=e.children,n=e.className,r=e.split,i=e.style,a=e.size,s=e.eleRef,l=["Pane",r,n],c={flex:1,position:"relative",outline:"none"};return void 0!==a&&("vertical"===r?c.width=a:(c.height=a,c.display="flex"),c.flex="none"),c=Object.assign({},c,i||{}),o.a.createElement("div",{ref:s,className:l.join(" "),style:c},t)}}]),t}(o.a.PureComponent);Gn.propTypes={className:zn.a.string.isRequired,children:zn.a.node.isRequired,size:zn.a.oneOfType([zn.a.string,zn.a.number]),split:zn.a.oneOf(["vertical","horizontal"]),style:Rn.a,eleRef:zn.a.func},Gn.defaultProps={};var $n=function(e){function t(){return Bn(this,t),Hn(this,Fn(t).apply(this,arguments))}return Nn(t,e),In(t,[{key:"render",value:function(){var e=this.props,t=e.className,n=e.onClick,r=e.onDoubleClick,i=e.onMouseDown,a=e.onTouchEnd,s=e.onTouchStart,l=e.resizerClassName,c=e.split,d=e.style,u=[l,c,t];return o.a.createElement("span",{role:"presentation",className:u.join(" "),style:d,onMouseDown:function(e){return i(e)},onTouchStart:function(e){e.preventDefault(),s(e)},onTouchEnd:function(e){e.preventDefault(),a(e)},onClick:function(e){n&&(e.preventDefault(),n(e))},onDoubleClick:function(e){r&&(e.preventDefault(),r(e))}})}}]),t}(o.a.Component);function Vn(e,t){if(e.selection)e.selection.empty();else try{t.getSelection().removeAllRanges()}catch(e){}}function Un(e,t,n,r){if("number"==typeof r){var o="number"==typeof t?t:0,i="number"==typeof n&&n>=0?n:1/0;return Math.max(o,Math.min(i,r))}return void 0!==e?e:t}$n.propTypes={className:zn.a.string.isRequired,onClick:zn.a.func,onDoubleClick:zn.a.func,onMouseDown:zn.a.func.isRequired,onTouchStart:zn.a.func.isRequired,onTouchEnd:zn.a.func.isRequired,split:zn.a.oneOf(["vertical","horizontal"]),style:Rn.a,resizerClassName:zn.a.string.isRequired},$n.defaultProps={resizerClassName:"Resizer"};var qn=function(e){function t(e){var n;Bn(this,t),(n=Hn(this,Fn(t).call(this,e))).onMouseDown=n.onMouseDown.bind(_n(_n(n))),n.onTouchStart=n.onTouchStart.bind(_n(_n(n))),n.onMouseMove=n.onMouseMove.bind(_n(_n(n))),n.onTouchMove=n.onTouchMove.bind(_n(_n(n))),n.onMouseUp=n.onMouseUp.bind(_n(_n(n)));var r=e.size,o=e.defaultSize,i=e.minSize,a=e.maxSize,s=e.primary,l=void 0!==r?r:Un(o,i,a,null);return n.state={active:!1,resized:!1,pane1Size:"first"===s?l:void 0,pane2Size:"second"===s?l:void 0,instanceProps:{size:r}},n}return Nn(t,e),In(t,[{key:"componentDidMount",value:function(){document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("touchmove",this.onTouchMove),this.setState(t.getSizeUpdate(this.props,this.state))}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("touchmove",this.onTouchMove)}},{key:"onMouseDown",value:function(e){var t=Object.assign({},e,{touches:[{clientX:e.clientX,clientY:e.clientY}]});this.onTouchStart(t)}},{key:"onTouchStart",value:function(e){var t=this.props,n=t.allowResize,r=t.onDragStarted,o=t.split;if(n){Vn(document,window);var i="vertical"===o?e.touches[0].clientX:e.touches[0].clientY;"function"==typeof r&&r(),this.setState({active:!0,position:i})}}},{key:"onMouseMove",value:function(e){var t=Object.assign({},e,{touches:[{clientX:e.clientX,clientY:e.clientY}]});this.onTouchMove(t)}},{key:"onTouchMove",value:function(e){var t=this.props,n=t.allowResize,r=t.maxSize,o=t.minSize,i=t.onChange,a=t.split,s=t.step,l=this.state,c=l.active,d=l.position;if(n&&c){Vn(document,window);var u="first"===this.props.primary,p=u?this.pane1:this.pane2,h=u?this.pane2:this.pane1;if(p){var f=p,b=h;if(f.getBoundingClientRect){var g=f.getBoundingClientRect().width,m=f.getBoundingClientRect().height,y="vertical"===a?g:m,O=d-("vertical"===a?e.touches[0].clientX:e.touches[0].clientY);if(s){if(Math.abs(O)<s)return;O=~~(O/s)*s}var v=u?O:-O;parseInt(window.getComputedStyle(f).order)>parseInt(window.getComputedStyle(b).order)&&(v=-v);var j=r;if(void 0!==r&&r<=0){var S=this.splitPane;j="vertical"===a?S.getBoundingClientRect().width+r:S.getBoundingClientRect().height+r}var x=y-v,M=d-O;x<o?x=o:void 0!==r&&x>j?x=j:this.setState({position:M,resized:!0}),i&&i(x),this.setState(En({draggedSize:x},u?"pane1Size":"pane2Size",x))}}}}},{key:"onMouseUp",value:function(){var e=this.props,t=e.allowResize,n=e.onDragFinished,r=this.state,o=r.active,i=r.draggedSize;t&&o&&("function"==typeof n&&n(i),this.setState({active:!1}))}},{key:"render",value:function(){var e=this,t=this.props,n=t.allowResize,r=t.children,i=t.className,a=t.onResizerClick,s=t.onResizerDoubleClick,l=t.paneClassName,c=t.pane1ClassName,d=t.pane2ClassName,u=t.paneStyle,p=t.pane1Style,h=t.pane2Style,f=t.resizerClassName,b=t.resizerStyle,g=t.split,m=t.style,y=this.state,O=y.pane1Size,v=y.pane2Size,j=n?"":"disabled",S=f?"".concat(f," ").concat("Resizer"):f,x=function(e){return o.a.Children.toArray(e).filter((function(e){return e}))}(r),M=An({display:"flex",flex:1,height:"100%",position:"absolute",outline:"none",overflow:"hidden",MozUserSelect:"text",WebkitUserSelect:"text",msUserSelect:"text",userSelect:"text"},m);"vertical"===g?Object.assign(M,{flexDirection:"row",left:0,right:0}):Object.assign(M,{bottom:0,flexDirection:"column",minHeight:"100%",top:0,width:"100%"});var w=["SplitPane",i,g,j],k=An({},u,p),C=An({},u,h),P=["Pane1",l,c].join(" "),z=["Pane2",l,d].join(" ");return o.a.createElement("div",{className:w.join(" "),ref:function(t){e.splitPane=t},style:M},o.a.createElement(Gn,{className:P,key:"pane1",eleRef:function(t){e.pane1=t},size:O,split:g,style:k},x[0]),o.a.createElement($n,{className:j,onClick:a,onDoubleClick:s,onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onTouchEnd:this.onMouseUp,key:"resizer",resizerClassName:S,split:g,style:b||{}}),o.a.createElement(Gn,{className:z,key:"pane2",eleRef:function(t){e.pane2=t},size:v,split:g,style:C},x[1]))}}],[{key:"getDerivedStateFromProps",value:function(e,n){return t.getSizeUpdate(e,n)}},{key:"getSizeUpdate",value:function(e,t){var n={};if(t.instanceProps.size===e.size&&void 0!==e.size)return{};var r=void 0!==e.size?e.size:Un(e.defaultSize,e.minSize,e.maxSize,t.draggedSize);void 0!==e.size&&(n.draggedSize=r);var o="first"===e.primary;return n[o?"pane1Size":"pane2Size"]=r,n[o?"pane2Size":"pane1Size"]=void 0,n.instanceProps={size:e.size},n}}]),t}(o.a.Component);qn.propTypes={allowResize:zn.a.bool,children:zn.a.arrayOf(zn.a.node).isRequired,className:zn.a.string,primary:zn.a.oneOf(["first","second"]),minSize:zn.a.oneOfType([zn.a.string,zn.a.number]),maxSize:zn.a.oneOfType([zn.a.string,zn.a.number]),defaultSize:zn.a.oneOfType([zn.a.string,zn.a.number]),size:zn.a.oneOfType([zn.a.string,zn.a.number]),split:zn.a.oneOf(["vertical","horizontal"]),onDragStarted:zn.a.func,onDragFinished:zn.a.func,onChange:zn.a.func,onResizerClick:zn.a.func,onResizerDoubleClick:zn.a.func,style:Rn.a,resizerStyle:Rn.a,paneClassName:zn.a.string,pane1ClassName:zn.a.string,pane2ClassName:zn.a.string,paneStyle:Rn.a,pane1Style:Rn.a,pane2Style:Rn.a,resizerClassName:zn.a.string,step:zn.a.number},qn.defaultProps={allowResize:!0,minSize:50,primary:"first",split:"vertical",paneClassName:"",pane1ClassName:"",pane2ClassName:""},Object(Tn.polyfill)(qn);var Qn,Yn,Xn=qn;function Kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(Yn=Qn||(Qn={}))[Yn.Right=0]="Right",Yn[Yn.Top=1]="Top";class Jn extends r.PureComponent{constructor(...e){super(...e),Kn(this,"rafToken",Object(r.createRef)()),Kn(this,"updateSplitPaneSize",()=>{void 0!==this.rafToken.current&&window.cancelAnimationFrame(this.rafToken.current),this.rafToken.current=window.requestAnimationFrame(()=>{this.forceUpdate()})}),Kn(this,"onDragFinished",(e,t)=>{if(document.body.style.cursor="auto",!t)return;const{updateUiState:n}=this.props;e===Qn.Top?n({topPaneSize:t/window.innerHeight}):n({rightPaneSize:t/window.innerWidth})}),Kn(this,"onDragStarted",()=>{document.body.style.cursor="row-resize"})}componentDidMount(){window.addEventListener("resize",this.updateSplitPaneSize)}componentWillUnmount(){window.removeEventListener("resize",this.updateSplitPaneSize)}renderHorizontalSplit(){const{leftPaneComponents:e,uiState:t}=this.props,n=Zn(u.a.theme),r=t.topPaneSize>=1?t.topPaneSize:t.topPaneSize*window.innerHeight;return Array.isArray(e)?Object(O.jsx)(Xn,{split:"horizontal",maxSize:-200,primary:"first",size:r,pane2Style:{minHeight:0},resizerClassName:n.resizerH,onDragStarted:this.onDragStarted,onDragFinished:e=>this.onDragFinished(Qn.Top,e),children:e}):e}render(){const{rightPaneVisible:e,rightPaneComponents:t,uiState:n}=this.props,r=Zn(u.a.theme),o=n.rightPaneSize<=1?n.rightPaneSize*window.innerWidth:n.rightPaneSize;return e?Object(O.jsxs)(Xn,{split:"vertical",maxSize:-300,size:o,primary:"second",resizerClassName:r.resizerV,onDragStarted:()=>document.body.style.cursor="col-resize",onDragFinished:e=>this.onDragFinished(Qn.Right,e),children:[this.renderHorizontalSplit(),t]}):this.renderHorizontalSplit()}}Kn(Jn,"defaultProps",{rightPaneVisible:!0});const Zn=Object(d.stylesFactory)(e=>{const t=e.palette.blue95,n=e.spacing.md,r=s.css`
    font-style: italic;
    background: transparent;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-color: transparent;
    border-style: solid;
    transition: 0.2s border-color ease-in-out;

    &:hover {
      border-color: ${t};
    }
  `;return{resizerV:Object(s.cx)(r,s.css`
        cursor: col-resize;
        width: ${n};
        border-right-width: 1px;
        margin-top: 18px;
      `),resizerH:Object(s.cx)(r,s.css`
        height: ${n};
        cursor: row-resize;
        position: relative;
        top: 0px;
        z-index: 1;
        border-top-width: 1px;
        margin-left: ${n};
      `)}});var er=n("KODV"),tr=n("Yuww"),nr=n("waAV"),rr=n("Gqk0"),or=n("Wwog");const ir=Object(or.default)((e,t)=>{var n;const r=[];if(!t)return r;let o=B.b.Visualize;if(t.meta.skipDataQuery)return[];t.meta.skipDataQuery||(o=B.b.Query,r.push({id:B.b.Query,text:"Query",icon:"database",active:!1}),r.push({id:B.b.Transform,text:"Transform",icon:"process",active:!1})),(Object(u.c)().alertingEnabled&&"graph"===t.meta.id||"timeseries"===t.meta.id)&&r.push({id:B.b.Alert,text:"Alert",icon:"bell",active:!1});return(null!==(n=r.find(t=>t.id===(e||o)))&&void 0!==n?n:r[0]).active=!0,r});var ar,sr=n("p1x6"),lr=n("FyDh"),cr=n("E5+Z"),dr=n("V8VS"),ur=n("3SGO"),pr=n("U+pZ"),hr=n("+JUD"),fr=n("NPB1");function br({width:e,height:t,panel:n,dashboard:o}){const{data:i}=Object(Mn.a)(n,{withTransforms:!0,withFieldConfig:!1},!1),[a,s]=Object(r.useState)({frameIndex:0,showHeader:!0});return Object(r.useEffect)(()=>{const t=Object(fr.a)(),r=Object(hr.b)(n,t.timeRange()),i=n.events.subscribe(U.RefreshEvent,()=>{n.runAllPanelQueries(o.id,o.getTimezone(),r,e)});return()=>{i.unsubscribe()}},[n,o,e]),i?Object(O.jsx)(d.PanelChrome,{width:e,height:t,padding:"none",children:(e,t)=>Object(O.jsx)(pr.a,{title:"Raw data",pluginId:"table",width:e,height:t,data:i,options:a,onOptionsChange:s})}):null}function gr(){return(gr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function mr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return jr}));const yr={initPanelEditor:nr.c,discardPanelChanges:nr.a,updatePanelEditorUIState:nr.d,updateTimeZoneForSession:rr.i,toggleTableView:vt.f,notifyApp:ur.b},Or=Object(i.connect)(e=>{const t=e.panelEditor.getPanel(),{plugin:n}=function(e,t){var n;return t&&null!==(n=e.panels[t])&&void 0!==n?n:{}}(e.dashboard,t.id);return{plugin:n,panel:t,initDone:e.panelEditor.initDone,uiState:e.panelEditor.ui,tableViewEnabled:e.panelEditor.tableViewEnabled,variables:Object(sr.g)(e)}},yr);class vr extends r.PureComponent{constructor(...e){super(...e),mr(this,"eventSubs",void 0),mr(this,"state",{showSaveLibraryPanelModal:!1}),mr(this,"triggerForceUpdate",()=>{this.forceUpdate()}),mr(this,"onBack",()=>{W.locationService.partial({editPanel:null,tab:null})}),mr(this,"onDiscard",()=>{this.props.discardPanelChanges(),this.onBack()}),mr(this,"onOpenDashboardSettings",()=>{W.locationService.partial({editview:"settings"})}),mr(this,"onSaveDashboard",()=>{p.a.publish(new U.ShowModalReactEvent({component:er.a,props:{dashboard:this.props.dashboard}}))}),mr(this,"onSaveLibraryPanel",async()=>{if(!Object(Dt.a)(this.props.panel))return;const e=await Object(dr.e)(this.props.panel.libraryPanel.uid);if(0===e.length||1===e.length&&e.includes(this.props.dashboard.id))try{await Object(hn.c)(this.props.panel,this.props.dashboard.meta.folderId),this.props.notifyApp(Object(hn.b)("Library panel saved"))}catch(e){this.props.notifyApp(Object(hn.a)(`Error saving library panel: "${e.statusText}"`))}else this.setState({showSaveLibraryPanelModal:!0})}),mr(this,"onChangeTab",e=>{W.locationService.partial({tab:e.id})}),mr(this,"onFieldConfigChange",e=>{this.props.panel.updateFieldConfig(gr({},e))}),mr(this,"onPanelOptionsChanged",e=>{this.props.panel.updateOptions(e)}),mr(this,"onPanelConfigChanged",(e,t)=>{this.props.panel.setProperty(e,t),this.props.panel.render(),this.forceUpdate()}),mr(this,"onDisplayModeChange",e=>{const{updatePanelEditorUIState:t}=this.props;this.props.tableViewEnabled&&this.props.toggleTableView(),t({mode:e})}),mr(this,"onToggleTableView",()=>{this.props.toggleTableView()}),mr(this,"onTogglePanelOptions",()=>{const{uiState:e,updatePanelEditorUIState:t}=this.props;t({isPanelOptionsVisible:!e.isPanelOptionsVisible})}),mr(this,"onGoBackToDashboard",()=>{W.locationService.partial({editPanel:null,tab:null})}),mr(this,"onConfirmAndDismissLibarayPanelModel",()=>{this.setState({showSaveLibraryPanelModal:!1})})}componentDidMount(){this.props.initPanelEditor(this.props.sourcePanel,this.props.dashboard)}componentDidUpdate(){const{panel:e,initDone:t}=this.props;t&&!this.eventSubs&&(this.eventSubs=new l.a,this.eventSubs.add(e.events.subscribe(U.PanelOptionsChangedEvent,this.triggerForceUpdate)))}componentWillUnmount(){var e;null===(e=this.eventSubs)||void 0===e||e.unsubscribe()}renderPanel(e,t){const{dashboard:n,panel:r,uiState:o,tableViewEnabled:i}=this.props;return Object(O.jsxs)("div",{className:e.mainPaneWrapper,children:[this.renderPanelToolbar(e),Object(O.jsx)("div",{className:e.panelWrapper,children:Object(O.jsx)(a.a,{children:({width:a,height:s})=>{if(a<3||s<3)return null;if(t&&(s-=2*u.b.theme2.spacing.gridSize),i)return Object(O.jsx)(br,{width:a,height:s,panel:r,dashboard:n});const l=Object(h.a)(o.mode,a,s,r);return Object(O.jsx)("div",{className:e.centeringContainer,style:{width:a,height:s},children:Object(O.jsx)("div",{style:l,"data-panelid":r.editSourceId,children:Object(O.jsx)(tr.a,{dashboard:n,panel:r,isEditing:!0,isViewing:!1,isInView:!0,width:l.width,height:l.height})})})}})})]},"panel")}renderPanelAndEditor(e){const{panel:t,dashboard:n,plugin:r,tab:o}=this.props,i=ir(o,r);return i.length>0?[this.renderPanel(e,!1),Object(O.jsx)("div",{className:e.tabsWrapper,"aria-label":c.a.components.PanelEditor.DataPane.content,children:Object(O.jsx)(gt,{panel:t,dashboard:n,tabs:i,onChangeTab:this.onChangeTab})},"panel-editor-tabs")]:this.renderPanel(e,!0)}renderTemplateVariables(e){const{variables:t}=this.props;return t.length?Object(O.jsx)("div",{className:e.variablesWrapper,children:Object(O.jsx)(Cn.a,{variables:t})}):null}renderPanelToolbar(e){const{dashboard:t,uiState:n,variables:r,updateTimeZoneForSession:o,panel:i,tableViewEnabled:a}=this.props;return Object(O.jsx)("div",{className:e.panelToolbar,children:Object(O.jsxs)(d.HorizontalGroup,{justify:r.length>0?"space-between":"flex-end",align:"flex-start",children:[this.renderTemplateVariables(e),Object(O.jsxs)(d.HorizontalGroup,{children:[Object(O.jsx)(d.InlineSwitch,{label:"Table view",showLabel:!0,id:"table-view",value:a,onClick:this.onToggleTableView,"aria-label":c.a.components.PanelEditor.toggleTableView}),Object(O.jsx)(d.RadioButtonGroup,{value:n.mode,options:B.c,onChange:this.onDisplayModeChange}),Object(O.jsx)(Ot.a,{dashboard:t,onChangeTimeZone:o}),!n.isPanelOptionsVisible&&Object(O.jsx)(xt,{panel:i})]})]})})}renderEditorActions(){let e=[Object(O.jsx)(d.ToolbarButton,{icon:"cog",onClick:this.onOpenDashboardSettings,title:"Open dashboard settings"},"settings"),Object(O.jsx)(d.ToolbarButton,{onClick:this.onDiscard,title:"Undo all changes",children:"Discard"},"discard"),this.props.panel.libraryPanel?Object(O.jsx)(d.ToolbarButton,{onClick:this.onSaveLibraryPanel,variant:"primary",title:"Apply changes and save library panel",children:"Save library panel"},"save-panel"):Object(O.jsx)(d.ToolbarButton,{onClick:this.onSaveDashboard,title:"Apply changes and save dashboard",children:"Save"},"save"),Object(O.jsx)(d.ToolbarButton,{onClick:this.onBack,variant:"primary",title:"Apply changes and go back to dashboard","aria-label":c.a.components.PanelEditor.applyButton,children:"Apply"},"apply")];return this.props.panel.libraryPanel&&(e.splice(1,0,Object(O.jsx)(d.ModalsController,{children:({showModal:e,hideModal:t})=>Object(O.jsx)(d.ToolbarButton,{onClick:()=>{e(lr.a,{onConfirm:()=>{delete this.props.panel.libraryPanel,this.props.panel.render(),this.forceUpdate()},onDismiss:t,isOpen:!0})},title:"Disconnects this panel from the library panel so that you can edit it regularly.",children:"Unlink"},"unlink")},"unlink-controller")),e.pop()),e}renderOptionsPane(){const{plugin:e,dashboard:t,panel:n,uiState:r}=this.props,o=r.rightPaneSize<=1?r.rightPaneSize*window.innerWidth:r.rightPaneSize;return e?Object(O.jsx)(wn,{plugin:e,dashboard:t,panel:n,width:o,onFieldConfigsChange:this.onFieldConfigChange,onPanelOptionsChanged:this.onPanelOptionsChanged,onPanelConfigChange:this.onPanelConfigChanged}):ar||(ar=Object(O.jsx)("div",{}))}render(){const{dashboard:e,initDone:t,updatePanelEditorUIState:n,uiState:r}=this.props,o=Sr(u.b.theme,this.props);return t?Object(O.jsxs)("div",{className:o.wrapper,"aria-label":c.a.components.PanelEditor.General.content,children:[Object(O.jsx)(d.PageToolbar,{title:e.title+" / Edit Panel",onGoBack:this.onGoBackToDashboard,children:this.renderEditorActions()}),Object(O.jsx)("div",{className:o.verticalSplitPanesWrapper,children:Object(O.jsx)(Jn,{leftPaneComponents:this.renderPanelAndEditor(o),rightPaneComponents:this.renderOptionsPane(),uiState:r,updateUiState:n,rightPaneVisible:r.isPanelOptionsVisible})}),this.state.showSaveLibraryPanelModal&&Object(O.jsx)(cr.a,{panel:this.props.panel,folderId:this.props.dashboard.meta.folderId,onConfirm:this.onConfirmAndDismissLibarayPanelModel,onDiscard:this.onDiscard,onDismiss:this.onConfirmAndDismissLibarayPanelModel})]}):null}}const jr=Or(vr),Sr=Object(d.stylesFactory)((e,t)=>{const{uiState:n}=t,r=e.spacing.md;return{wrapper:s.css`
      width: 100%;
      height: 100%;
      position: fixed;
      z-index: ${e.zIndex.sidemenu};
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: ${e.colors.dashboardBg};
      display: flex;
      flex-direction: column;
    `,verticalSplitPanesWrapper:s.css`
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;
      position: relative;
    `,mainPaneWrapper:s.css`
      display: flex;
      flex-direction: column;
      height: 100%;
      width: 100%;
      padding-right: ${n.isPanelOptionsVisible?0:r};
    `,variablesWrapper:s.css`
      label: variablesWrapper;
      display: flex;
      flex-grow: 1;
      flex-wrap: wrap;
    `,panelWrapper:s.css`
      flex: 1 1 0;
      min-height: 0;
      width: 100%;
      padding-left: ${r};
      padding-right: 2px;
    `,tabsWrapper:s.css`
      height: 100%;
      width: 100%;
    `,panelToolbar:s.css`
      display: flex;
      padding: 0 0 ${r} ${r};
      justify-content: space-between;
      flex-wrap: wrap;
    `,toolbarLeft:s.css`
      padding-left: ${e.spacing.sm};
    `,centeringContainer:s.css`
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
    `}})},lIMf:function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"UnthemedDashboardPage",(function(){return E})),n.d(t,"mapStateToProps",(function(){return A})),n.d(t,"getStyles",(function(){return F})),n.d(t,"DashboardPage",(function(){return L}));var r,o=n("q1tI"),i=n("kDDq"),a=n("0cfB"),s=n("/MKj"),l=n("t8hP"),c=n("Csm0"),d=n("kDLi"),u=n("UvM7"),p=n("ibPz"),h=n("nU/Z"),f=n("hfOi"),b=n("2t1j"),g=n("lEZL"),m=n("8M//"),y=n("3SGO"),O=n("GQ3c"),v=n("kt0J"),j=n("3ISj"),S=n("J4KJ"),x=n("50r9"),M=n("+JjO"),w=n("HH2e"),k=n("NPB1"),C=n("DTq7"),P=n("p6vy"),z=n("aq+K"),D=n("Zu+4"),R=n("TSYQ"),T=n.n(R),B=n("nKUr");function W(){return(W=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class E extends o.PureComponent{constructor(...e){super(...e),I(this,"forceRouteReloadCounter",0),I(this,"state",this.getCleanState()),I(this,"setScrollTop",({scrollTop:e})=>{this.setState({scrollTop:e,updateScrollTop:void 0})}),I(this,"onAddPanel",()=>{const{dashboard:e}=this.props;e&&(e.panels.length>0&&"add-panel"===e.panels[0].type||(e.addPanel({type:"add-panel",gridPos:{x:0,y:0,w:12,h:8},title:"Panel Title"}),this.setState({updateScrollTop:0})))})}getCleanState(){return{editPanel:null,viewPanel:null,showLoadingState:!1,scrollTop:0,rememberScrollTop:0,panelNotFound:!1,editPanelAccessDenied:!1}}componentDidMount(){var e;this.initDashboard(),this.forceRouteReloadCounter=(null===(e=this.props.history.location.state)||void 0===e?void 0:e.routeReloadCounter)||0}componentWillUnmount(){this.closeDashboard()}closeDashboard(){this.props.cleanUpDashboardAndVariables(),this.setState(this.getCleanState())}initDashboard(){const{dashboard:e,match:t,queryParams:n}=this.props;e&&this.closeDashboard(),this.props.initDashboard({urlSlug:t.params.slug,urlUid:t.params.uid,urlType:t.params.type,urlFolderId:n.folderId,routeName:this.props.route.routeName,fixUrl:!0})}componentDidUpdate(e,t){var n;const{dashboard:r,match:o,templateVarsChangedInUrl:i}=this.props,a=null===(n=this.props.history.location.state)||void 0===n?void 0:n.routeReloadCounter;if(r){if(e.dashboard!==r&&(document.title=r.title+" - "+p.a.AppTitle),e.match.params.uid!==o.params.uid||void 0!==a&&this.forceRouteReloadCounter!==a)return this.initDashboard(),void(this.forceRouteReloadCounter=a);if(e.location.search!==this.props.location.search){const t=e.queryParams,n=this.props.queryParams;(null==n?void 0:n.from)===(null==t?void 0:t.from)&&(null==n?void 0:n.to)===(null==t?void 0:t.to)||Object(k.a)().updateTimeRangeFromUrl(),null!=t&&t.refresh||null==n||!n.refresh||Object(k.a)().setAutoRefresh(n.refresh);const r=Object(M.d)(this.props.queryParams,e.queryParams);r&&i(r)}this.state.editPanel&&!t.editPanel&&w.a.setEditingState(!0),!this.state.editPanel&&t.editPanel&&w.a.setEditingState(!1),this.state.editPanelAccessDenied&&(this.props.notifyApp(Object(u.a)("Permission to edit panel denied")),l.locationService.partial({editPanel:null})),this.state.panelNotFound&&(this.props.notifyApp(Object(u.a)("Panel not found")),l.locationService.partial({editPanel:null,viewPanel:null}))}}static getDerivedStateFromProps(e,t){const{dashboard:n,queryParams:r}=e,o=r.editPanel,i=r.viewPanel;if(!n)return t;if(!t.editPanel&&o){const e=n.getPanelByUrlId(o);return e?n.canEditPanel(e)?W({},t,{editPanel:e}):W({},t,{editPanelAccessDenied:!0}):W({},t,{panelNotFound:!0})}if(t.editPanel&&!o)return W({},t,{editPanel:null});if(!t.viewPanel&&i){const e=n.getPanelByUrlId(i);return e?(n.initViewPanel(e),W({},t,{viewPanel:e,rememberScrollTop:t.scrollTop,updateScrollTop:0})):W({},t,{panelNotFound:o})}return t.viewPanel&&!i?(n.exitViewPanel(t.viewPanel),W({},t,{viewPanel:null,updateScrollTop:t.rememberScrollTop})):t.panelNotFound||t.editPanelAccessDenied&&!o?W({},t,{panelNotFound:!1,editPanelAccessDenied:!1}):t}getInspectPanel(){const{dashboard:e,queryParams:t}=this.props,n=t.inspect;if(!e||!n)return null;const r=e.getPanelById(parseInt(n,10));return r||null}render(){const{dashboard:e,isInitSlow:t,initError:n,queryParams:o,theme:i}=this.props,{editPanel:a,viewPanel:s,scrollTop:l,updateScrollTop:u}=this.state,p=Object(C.b)(o.kiosk),m=F(i,p);if(!e)return t?Object(B.jsx)(P.a,{initPhase:this.props.initPhase}):null;const y=25*Math.round(l/25),S=this.getInspectPanel(),x=T()(m.dashboardContainer,{"panel-in-fullscreen":s});return Object(B.jsxs)("div",{className:x,children:[p!==O.h.Full&&Object(B.jsx)("header",{"aria-label":c.a.pages.Dashboard.DashNav.nav,children:Object(B.jsx)(f.a,{dashboard:e,title:e.title,folderTitle:e.meta.folderTitle,isFullscreen:!!s,onAddPanel:this.onAddPanel,kioskMode:p,hideTimePicker:e.timepicker.hidden})}),Object(B.jsx)(D.a,{dashboard:e}),Object(B.jsx)("div",{className:m.dashboardScroll,children:Object(B.jsx)(d.CustomScrollbar,{autoHeightMin:"100%",setScrollTop:this.setScrollTop,scrollTop:u,hideHorizontalTrack:!0,updateAfterMountMs:500,children:Object(B.jsxs)("div",{className:m.dashboardContent,children:[n&&(r||(r=Object(B.jsx)(z.a,{}))),!a&&p===O.h.Off&&Object(B.jsx)("section",{"aria-label":c.a.pages.Dashboard.SubMenu.submenu,children:Object(B.jsx)(j.a,{dashboard:e,annotations:e.annotations.list,links:e.links})}),Object(B.jsx)(h.a,{dashboard:e,viewPanel:s,editPanel:a,scrollTop:y})]})})}),S&&Object(B.jsx)(v.a,{dashboard:e,panel:S}),a&&Object(B.jsx)(g.a,{dashboard:e,sourcePanel:a,tab:this.props.queryParams.tab}),o.editview&&Object(B.jsx)(b.a,{dashboard:e,editview:o.editview})]})}}const A=e=>({initPhase:e.dashboard.initPhase,isInitSlow:e.dashboard.isInitSlow,initError:e.dashboard.initError,dashboard:e.dashboard.getModel()}),N={initDashboard:m.a,cleanUpDashboardAndVariables:S.c,notifyApp:y.b,cancelVariables:x.a,templateVarsChangedInUrl:x.g},F=Object(d.stylesFactory)((e,t)=>{const n=t!==O.h.Full?e.spacing(0,2,2):e.spacing(2);return{dashboardContainer:i.css`
      position: absolute;
      top: 0;
      bottom: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
    `,dashboardScroll:i.css`
      width: 100%;
      flex-grow: 1;
      min-height: 0;
      display: flex;
    `,dashboardContent:i.css`
      padding: ${n};
      flex-basis: 100%;
      flex-grow: 1;
    `}}),L=Object(d.withTheme2)(E);L.displayName="DashboardPage",t.default=Object(a.hot)(e)(Object(s.connect)(A,N)(L))}.call(this,n("3UD+")(e))},"nU/Z":function(e,t,n){"use strict";var r,o,i,a,s,l,c=n("q1tI"),d=n.n(c),u=n("ChGz"),p=n.n(u),h=n("TSYQ"),f=n.n(h),b=n("jYz7"),g=n("/MKj"),m=n("vF1F"),y=n("LvDl"),O=n("Zss7"),v=n.n(O),j=n("t8hP"),S=n("kDLi"),x=n("Csm0"),M=n("ZFWI"),w=n("SMGL"),k=n("KyLG"),C=n("eXZ6"),P=n("K0rs"),z=n("orvP"),D=n("nKUr");function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const T={addPanel:k.a},B=Object(g.connect)(void 0,T)(({panel:e,dashboard:t})=>{const[n,s]=Object(c.useState)(!1),l=Object(S.useStyles)(I),d=Object(c.useMemo)(()=>(()=>{const e=Object(y.chain)(M.b.panels).filter({hideFromList:!1}).map(e=>e).value(),t=[],n=w.a.get(C.h);if(n){const r=JSON.parse(n),o=Object(y.find)(e,{id:r.type});if(o){const e=Object(y.cloneDeep)(o);e.name=r.title,e.sort=-1,e.defaults=r,t.push(e)}}return Object(y.sortBy)(t,"sort")})(),[]);return Object(D.jsx)("div",{className:l.wrapper,children:Object(D.jsxs)("div",{className:Object(m.cx)("panel-container",l.callToAction),children:[Object(D.jsx)(W,{onCancel:n=>{n.preventDefault(),t.removePanel(e)},onBack:n?()=>{s(!1)}:void 0,styles:l,children:n?"Add panel from panel library":"Add panel"}),n?Object(D.jsx)(z.a,{onClick:n=>{const{gridPos:r}=e,o=R({},n.model,{gridPos:r,libraryPanel:Object(P.d)(n)});t.addPanel(o),t.removePanel(e)},variant:z.b.Tight,showPanelFilter:!0}):Object(D.jsxs)("div",{className:l.actionsWrapper,children:[Object(D.jsxs)("div",{className:Object(m.cx)(l.actionsRow,l.columnGap),children:[Object(D.jsxs)("div",{onClick:()=>{Object(j.reportInteraction)("Create new panel"),(()=>{const{gridPos:n}=e,r={type:"timeseries",title:"Panel Title",gridPos:{x:n.x,y:n.y,w:n.w,h:n.h}};t.addPanel(r),t.removePanel(e),j.locationService.partial({editPanel:r.id})})()},"aria-label":x.a.pages.AddDashboard.addNewPanel,children:[r||(r=Object(D.jsx)(S.Icon,{name:"file-blank",size:"xl"})),"Add an empty panel"]}),Object(D.jsxs)("div",{className:l.rowGap,onClick:()=>{Object(j.reportInteraction)("Create new row"),t.addPanel({type:"row",title:"Row title",gridPos:{x:0,y:0}}),t.removePanel(e)},"aria-label":x.a.pages.AddDashboard.addNewRow,children:[o||(o=Object(D.jsx)(S.Icon,{name:"wrap-text",size:"xl"})),"Add a new row"]})]}),Object(D.jsxs)("div",{className:l.actionsRow,children:[Object(D.jsxs)("div",{onClick:()=>{Object(j.reportInteraction)("Add a panel from the panel library"),s(!0)},"aria-label":x.a.pages.AddDashboard.addNewPanelLibrary,children:[i||(i=Object(D.jsx)(S.Icon,{name:"book-open",size:"xl"})),"Add a panel from the panel library"]}),1===d.length&&Object(D.jsxs)("div",{className:l.rowGap,onClick:()=>{Object(j.reportInteraction)("Paste panel from clipboard"),(n=>{const{gridPos:r}=e,o={type:n.id,title:"Panel Title",gridPos:{x:r.x,y:r.y,w:n.defaults.gridPos.w,h:n.defaults.gridPos.h}};n.defaults&&(Object(y.defaults)(o,n.defaults),o.title=n.defaults.title,w.a.delete(C.h)),t.addPanel(o),t.removePanel(e)})(d[0])},children:[a||(a=Object(D.jsx)(S.Icon,{name:"clipboard-alt",size:"xl"})),"Paste panel from clipboard"]})]})]})]})})}),W=({children:e,onBack:t,onCancel:n,styles:r})=>Object(D.jsxs)("div",{className:Object(m.cx)(r.headerRow,"grid-drag-handle"),children:[t&&Object(D.jsx)("div",{className:r.backButton,children:Object(D.jsx)(S.IconButton,{name:"arrow-left",onClick:t,surface:"header",size:"xl"})}),!t&&Object(D.jsx)("div",{className:r.backButton,children:s||(s=Object(D.jsx)(S.Icon,{name:"panel-add",size:"md"}))}),e&&Object(D.jsx)("span",{children:e}),l||(l=Object(D.jsx)("div",{className:"flex-grow-1"})),Object(D.jsx)(S.IconButton,{name:"times",onClick:n,surface:"header"})]}),I=e=>{const t=m.keyframes`
    0% {box-shadow: 0 0 0 2px ${e.colors.bodyBg}, 0 0 0px 4px ${e.colors.formFocusOutline};}
    50% {box-shadow: 0 0 0 2px ${e.colors.bodyBg}, 0 0 0px 4px ${v()(e.colors.formFocusOutline).darken(20).toHexString()};}
    100% {box-shadow: 0 0 0 2px ${e.colors.bodyBg}, 0 0 0px 4px  ${e.colors.formFocusOutline};}
  `;return{wrapper:m.css`
      height: 100%;
      padding-top: ${e.spacing.xs};
    `,callToAction:m.css`
      overflow: hidden;
      outline: 2px dotted transparent;
      outline-offset: 2px;
      box-shadow: 0 0 0 2px black, 0 0 0px 4px #1f60c4;
      animation: ${t} 2s ease infinite;
    `,rowGap:m.css`
      margin-left: ${e.spacing.sm};
    `,columnGap:m.css`
      margin-bottom: ${e.spacing.sm};
    `,actionsRow:m.css`
      display: flex;
      flex-direction: row;
      height: 100%;

      > div {
        justify-self: center;
        cursor: pointer;
        background: ${e.colors.bg2};
        border-radius: ${e.border.radius.sm};
        color: ${e.colors.text};
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;

        &:hover {
          background: ${S.styleMixins.hoverColor(e.colors.bg2,e)};
        }

        &:hover > #book-icon {
          background: linear-gradient(#f05a28 30%, #fbca0a 99%);
        }
      }
    `,actionsWrapper:m.css`
      display: flex;
      flex-direction: column;
      padding: 0 ${e.spacing.sm} ${e.spacing.sm} ${e.spacing.sm};
      height: 100%;
    `,headerRow:m.css`
      display: flex;
      align-items: center;
      height: 38px;
      flex-shrink: 0;
      width: 100%;
      font-size: ${e.typography.size.md};
      font-weight: ${e.typography.weight.semibold};
      padding-left: ${e.spacing.sm};
      transition: background-color 0.1s ease-in-out;
      cursor: move;

      &:hover {
        background: ${e.colors.bg2};
      }
    `,backButton:m.css`
      display: flex;
      align-items: center;
      cursor: pointer;
      padding-left: ${e.spacing.xs};
      width: ${e.spacing.xl};
    `,noMargin:m.css`
      margin: 0;
    `}};var E,A=n("Xmxp"),N=n("gR9h");function F(){return(F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const L=({repeat:e,title:t,onUpdate:n,onCancel:r})=>{var o,i;const[a,s]=Object(c.useState)(e),l=Object(c.useCallback)(e=>s(e),[s]);return Object(D.jsx)(S.Form,{defaultValues:{title:t},onSubmit:e=>{n(e.title,a)},children:({register:e})=>Object(D.jsxs)(D.Fragment,{children:[Object(D.jsx)(S.Field,{label:"Title",children:Object(D.jsx)(S.Input,F({},e("title"),{type:"text"}))}),o||(o=Object(D.jsx)(S.Field,{label:"Repeat for",children:Object(D.jsx)(N.a,{repeat:a,onChange:l})})),i||(i=Object(D.jsxs)(S.Modal.ButtonRow,{children:[Object(D.jsx)(S.Button,{type:"button",variant:"secondary",onClick:r,fill:"outline",children:"Cancel"}),E||(E=Object(D.jsx)(S.Button,{type:"submit",children:"Update"}))]}))]})})},_=({repeat:e,title:t,onDismiss:n,onUpdate:r})=>{const o=H();return Object(D.jsx)(S.Modal,{isOpen:!0,title:"Row options",icon:"copy",onDismiss:n,className:o.modal,children:Object(D.jsx)(L,{repeat:e,title:t,onCancel:n,onUpdate:r})})},H=Object(S.stylesFactory)(()=>({modal:m.css`
      label: RowOptionsModal;
      width: 500px;
    `}));var G;const $=({repeat:e,title:t,onUpdate:n})=>{const r=e=>(t,r)=>{n(t,r),e()};return Object(D.jsx)(S.ModalsController,{children:({showModal:n,hideModal:o})=>Object(D.jsx)("a",{className:"pointer",onClick:()=>{n(_,{title:t,repeat:e,onDismiss:o,onUpdate:r(o)})},children:G||(G=Object(D.jsx)(S.Icon,{name:"cog"}))})})};$.displayName="RowOptionsButton";var V,U,q=n("xAj+");function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Y extends d.a.Component{constructor(e){super(e),Q(this,"sub",void 0),Q(this,"onVariableUpdated",()=>{this.forceUpdate()}),Q(this,"onToggle",()=>{this.props.dashboard.toggleRow(this.props.panel),this.setState(e=>({collapsed:!e.collapsed}))}),Q(this,"onUpdate",(e,t)=>{this.props.panel.title=e,this.props.panel.repeat=null!=t?t:void 0,this.props.panel.render(),this.props.dashboard.processRepeats(),this.forceUpdate()}),Q(this,"onDelete",()=>{A.b.publish(new q.ShowConfirmModalEvent({title:"Delete row",text:"Are you sure you want to remove this row and all its panels?",altActionText:"Delete row only",icon:"trash-alt",onConfirm:()=>{this.props.dashboard.removeRow(this.props.panel,!0)},onAltAction:()=>{this.props.dashboard.removeRow(this.props.panel,!1)}}))}),this.state={collapsed:this.props.panel.collapsed}}componentDidMount(){this.sub=this.props.dashboard.events.subscribe(q.RefreshEvent,this.onVariableUpdated)}componentWillUnmount(){this.sub&&this.sub.unsubscribe()}render(){const e=f()({"dashboard-row":!0,"dashboard-row--collapsed":this.state.collapsed}),t=Object(j.getTemplateSrv)().replace(this.props.panel.title,this.props.panel.scopedVars,"text"),n=this.props.panel.panels?this.props.panel.panels.length:0,r=1===n?"panel":"panels",o=!0===this.props.dashboard.meta.canEdit;return Object(D.jsxs)("div",{className:e,children:[Object(D.jsxs)("a",{className:"dashboard-row__title pointer",onClick:this.onToggle,children:[Object(D.jsx)(S.Icon,{name:this.state.collapsed?"angle-right":"angle-down"}),t,Object(D.jsxs)("span",{className:"dashboard-row__panel_count",children:["(",n," ",r,")"]})]}),o&&Object(D.jsxs)("div",{className:"dashboard-row__actions",children:[Object(D.jsx)($,{title:this.props.panel.title,repeat:this.props.panel.repeat,onUpdate:this.onUpdate}),Object(D.jsx)("a",{className:"pointer",onClick:this.onDelete,children:V||(V=Object(D.jsx)(S.Icon,{name:"trash-alt"}))})]}),!0===this.state.collapsed&&Object(D.jsx)("div",{className:"dashboard-row__toggle-target",onClick:this.onToggle,children:" "}),o&&(U||(U=Object(D.jsx)("div",{className:"dashboard-row__drag grid-drag-handle"})))]})}}var X=n("Yuww"),K=n("pugT");n.d(t,"a",(function(){return te}));const J=["gridWidth","gridPos","isViewing","windowHeight","windowWidth"];function Z(){return(Z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class te extends c.PureComponent{constructor(e){super(e),ee(this,"panelMap",{}),ee(this,"eventSubs",new K.a),ee(this,"windowHeight",1200),ee(this,"windowWidth",1920),ee(this,"gridWidth",0),ee(this,"onLayoutChange",e=>{for(const t of e)this.panelMap[t.i].updateGridPos(t);this.props.dashboard.sortPanelsByGridPos(),this.state.isLayoutInitialized||this.setState({isLayoutInitialized:!0})}),ee(this,"triggerForceUpdate",()=>{this.forceUpdate()}),ee(this,"updateGridPos",(e,t)=>{this.panelMap[e.i].updateGridPos(e)}),ee(this,"onResize",(e,t,n)=>{this.panelMap[n.i].updateGridPos(n)}),ee(this,"onResizeStop",(e,t,n)=>{this.updateGridPos(n,e)}),ee(this,"onDragStop",(e,t,n)=>{this.updateGridPos(n,e)}),this.state={isLayoutInitialized:!1}}componentDidMount(){const{dashboard:e}=this.props;this.eventSubs.add(e.events.subscribe(q.DashboardPanelsChangedEvent,this.triggerForceUpdate))}componentWillUnmount(){this.eventSubs.unsubscribe()}buildLayout(){const e=[];this.panelMap={};for(const t of this.props.dashboard.panels){const n=t.id.toString();if(this.panelMap[n]=t,!t.gridPos){console.log("panel without gridpos");continue}const r={i:n,x:t.gridPos.x,y:t.gridPos.y,w:t.gridPos.w,h:t.gridPos.h};"row"===t.type&&(r.w=C.g,r.h=1,r.isResizable=!1,r.isDraggable=t.collapsed),e.push(r)}return e}isInView(e){if(e.isViewing||e.isEditing)return!0;const t=this.props.scrollTop,n=e.gridPos.y*(C.e+C.f);if(t>n+e.gridPos.h*(C.e+C.f)-C.f+100)return!1;return!(n>t+this.windowHeight+100)&&!this.props.dashboard.otherPanelInFullscreen(e)}renderPanels(e){const t=[];var n;this.gridWidth!==e&&(this.windowHeight=null!==(n=window.innerHeight)&&void 0!==n?n:1e3,this.windowWidth=window.innerWidth,this.gridWidth=e);for(const n of this.props.dashboard.panels){const r=f()({"react-grid-item--fullscreen":n.isViewing}),o=n.id.toString();n.isInView=this.isInView(n),t.push(Object(D.jsx)(ne,{className:r,"data-panelid":o,gridPos:n.gridPos,gridWidth:e,windowHeight:this.windowHeight,windowWidth:this.windowWidth,isViewing:n.isViewing,children:(e,t)=>this.renderPanel(n,e,t,o)},o))}return t}renderPanel(e,t,n,r){return"row"===e.type?Object(D.jsx)(Y,{panel:e,dashboard:this.props.dashboard},r):"add-panel"===e.type?Object(D.jsx)(B,{panel:e,dashboard:this.props.dashboard},r):Object(D.jsx)(X.a,{panel:e,dashboard:this.props.dashboard,isEditing:e.isEditing,isViewing:e.isViewing,isInView:e.isInView,width:t,height:n},r)}render(){const{dashboard:e}=this.props;return Object(D.jsx)(b.a,{style:{width:"100%",height:"100%"},disableHeight:!0,children:({width:t})=>{if(0===t)return null;const n=!(t<=769)&&e.meta.canEdit;return Object(D.jsx)(p.a,{width:t,isDraggable:n,isResizable:e.meta.canEdit,containerPadding:[0,0],useCSSTransforms:!1,margin:[C.f,C.f],cols:C.g,rowHeight:C.e,draggableHandle:".grid-drag-handle",layout:this.buildLayout(),onDragStop:this.onDragStop,onResize:this.onResize,onResizeStop:this.onResizeStop,onLayoutChange:this.onLayoutChange,children:this.renderPanels(t)})}})}}const ne=d.a.forwardRef((e,t)=>{var n;const r=j.config.theme2;let o=100,i=100;const{gridWidth:a,isViewing:s,windowHeight:l,windowWidth:c}=e,d=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,J),u=null!==(n=e.style)&&void 0!==n?n:{};return s?(o=a,i=.85*l,u.height=i,u.width="100%"):c<r.breakpoints.values.md?(o=e.gridWidth,i=e.gridPos.h*(C.e+C.f)-C.f,u.height=i,u.width="100%"):(o=parseFloat(e.style.width),i=parseFloat(e.style.height)),Object(D.jsx)("div",Z({},d,{ref:t,children:[e.children[0](o,i),e.children.slice(1)]}))});ne.displayName="GridItemWithDimensions"},p6vy:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));n("q1tI");var r,o=n("kDDq"),i=n("kDLi"),a=n("t8hP"),s=n("nKUr");const l=({initPhase:e})=>{const t=Object(i.useStyles)(c);return Object(s.jsx)("div",{className:t.dashboardLoading,children:Object(s.jsx)("div",{className:t.dashboardLoadingText,children:Object(s.jsxs)(i.VerticalGroup,{spacing:"md",children:[Object(s.jsxs)(i.HorizontalGroup,{align:"center",justify:"center",spacing:"xs",children:[r||(r=Object(s.jsx)(i.Spinner,{inline:!0}))," ",e]})," ",Object(s.jsx)(i.HorizontalGroup,{align:"center",justify:"center",children:Object(s.jsx)(i.Button,{variant:"secondary",size:"md",icon:"repeat",onClick:()=>{a.locationService.push("/")},children:"Cancel loading dashboard"})})]})})})},c=e=>({dashboardLoading:o.css`
      height: 60vh;
      display: flex;
      align-items: center;
      justify-content: center;
    `,dashboardLoadingText:o.css`
      font-size: ${e.typography.size.lg};
    `})},pzsr:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return d.default}}),t.default=void 0;var r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==f(e)&&"function"!=typeof e)return{default:e};var t=h();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=r?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(n("q1tI")),o=p(n("17x9")),i=p(n("i8i4")),a=p(n("TSYQ")),s=n("8N4D"),l=n("fJi3"),c=n("gbW8"),d=p(n("R155")),u=p(n("sS6v"));function p(e){return e&&e.__esModule?e:{default:e}}function h(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return h=function(){return e},e}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function g(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function S(e,t,n){return t&&j(e.prototype,t),n&&j(e,n),e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=C(e);if(t){var o=C(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?k(e):t}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(n,e);var t=M(n);function n(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),P(k(r=t.call(this,e)),"onDragStart",(function(e,t){if((0,u.default)("Draggable: onDragStart: %j",t),!1===r.props.onStart(e,(0,l.createDraggableData)(k(r),t)))return!1;r.setState({dragging:!0,dragged:!0})})),P(k(r),"onDrag",(function(e,t){if(!r.state.dragging)return!1;(0,u.default)("Draggable: onDrag: %j",t);var n=(0,l.createDraggableData)(k(r),t),o={x:n.x,y:n.y};if(r.props.bounds){var i=o.x,a=o.y;o.x+=r.state.slackX,o.y+=r.state.slackY;var s=m((0,l.getBoundPosition)(k(r),o.x,o.y),2),c=s[0],d=s[1];o.x=c,o.y=d,o.slackX=r.state.slackX+(i-o.x),o.slackY=r.state.slackY+(a-o.y),n.x=o.x,n.y=o.y,n.deltaX=o.x-r.state.x,n.deltaY=o.y-r.state.y}if(!1===r.props.onDrag(e,n))return!1;r.setState(o)})),P(k(r),"onDragStop",(function(e,t){if(!r.state.dragging)return!1;if(!1===r.props.onStop(e,(0,l.createDraggableData)(k(r),t)))return!1;(0,u.default)("Draggable: onDragStop: %j",t);var n={dragging:!1,slackX:0,slackY:0};if(Boolean(r.props.position)){var o=r.props.position,i=o.x,a=o.y;n.x=i,n.y=a}r.setState(n)})),r.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:v({},e.position),slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),r}return S(n,null,[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.position,r=t.prevPropsPosition;return!n||r&&n.x===r.x&&n.y===r.y?null:((0,u.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:v({},n)})}}]),S(n,[{key:"componentDidMount",value:function(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"findDOMNode",value:function(){return this.props.nodeRef?this.props.nodeRef.current:i.default.findDOMNode(this)}},{key:"render",value:function(){var e,t=this.props,n=(t.axis,t.bounds,t.children),o=t.defaultPosition,i=t.defaultClassName,c=t.defaultClassNameDragging,u=t.defaultClassNameDragged,p=t.position,h=t.positionOffset,f=(t.scale,g(t,["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"])),m={},y=null,O=!Boolean(p)||this.state.dragging,j=p||o,S={x:(0,l.canDragX)(this)&&O?this.state.x:j.x,y:(0,l.canDragY)(this)&&O?this.state.y:j.y};this.state.isElementSVG?y=(0,s.createSVGTransform)(S,h):m=(0,s.createCSSTransform)(S,h);var x=(0,a.default)(n.props.className||"",i,(P(e={},c,this.state.dragging),P(e,u,this.state.dragged),e));return r.createElement(d.default,b({},f,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),r.cloneElement(r.Children.only(n),{className:x,style:v(v({},n.props.style),m),transform:y}))}}]),n}(r.Component);t.default=z,P(z,"displayName","Draggable"),P(z,"propTypes",v(v({},d.default.propTypes),{},{axis:o.default.oneOf(["both","x","y","none"]),bounds:o.default.oneOfType([o.default.shape({left:o.default.number,right:o.default.number,top:o.default.number,bottom:o.default.number}),o.default.string,o.default.oneOf([!1])]),defaultClassName:o.default.string,defaultClassNameDragging:o.default.string,defaultClassNameDragged:o.default.string,defaultPosition:o.default.shape({x:o.default.number,y:o.default.number}),positionOffset:o.default.shape({x:o.default.oneOfType([o.default.number,o.default.string]),y:o.default.oneOfType([o.default.number,o.default.string])}),position:o.default.shape({x:o.default.number,y:o.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe})),P(z,"defaultProps",v(v({},d.default.defaultProps),{},{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},position:null,scale:1}))},q78g:function(e,t,n){"use strict";function r(e){var t=e.margin,n=e.containerPadding,r=e.containerWidth,o=e.cols;return(r-t[0]*(o-1)-2*n[0])/o}function o(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function i(e,t,n){return Math.max(Math.min(e,n),t)}Object.defineProperty(t,"__esModule",{value:!0}),t.calcGridColWidth=r,t.calcGridItemWHPx=o,t.calcGridItemPosition=function(e,t,n,i,a,s){var l=e.margin,c=e.containerPadding,d=e.rowHeight,u=r(e),p={};s&&s.resizing?(p.width=Math.round(s.resizing.width),p.height=Math.round(s.resizing.height)):(p.width=o(i,u,l[0]),p.height=o(a,d,l[1]));s&&s.dragging?(p.top=Math.round(s.dragging.top),p.left=Math.round(s.dragging.left)):(p.top=Math.round((d+l[1])*n+c[1]),p.left=Math.round((u+l[0])*t+c[0]));return p},t.calcXY=function(e,t,n,o,a){var s=e.margin,l=e.cols,c=e.rowHeight,d=e.maxRows,u=r(e),p=Math.round((n-s[0])/(u+s[0])),h=Math.round((t-s[1])/(c+s[1]));return p=i(p,0,l-o),h=i(h,0,d-a),{x:p,y:h}},t.calcWH=function(e,t,n,o,a){var s=e.margin,l=e.maxRows,c=e.cols,d=e.rowHeight,u=r(e),p=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(d+s[1]));return p=i(p,0,c-o),h=i(h,0,l-a),{w:p,h:h}},t.clamp=i},qK5g:function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return d}));n("q1tI");var r=n("LvDl"),o=n("GkHB"),i=n("sCrc"),a=n("PkIl"),s=n("b2S+"),l=n("nKUr");function c(e){const{plugin:t,panel:n,onPanelOptionsChanged:c,onFieldConfigsChange:u,data:p,dashboard:h}=e,f=n.getOptions(),b=n.fieldConfig,g={},m={data:(null==p?void 0:p.series)||[],replaceVariables:n.replaceVariables,options:f,eventBus:h.events,getSuggestions:e=>p?Object(o.a)(p.series,e):[]},y=e=>{var n;const r=null!==(n=e&&e[0])&&void 0!==n?n:""+t.meta.name,o=g[r];return o||(g[r]=new s.a({title:r,id:r}))};d(t.optionEditors.list(),y,(e,t)=>{const n=Object(i.b)(m.options,e,t);c(n)},m);for(const e of t.fieldConfigRegistry.list()){if(e.isCustom&&e.showIf&&!e.showIf(b.defaults.custom,null==p?void 0:p.series))continue;if(e.hideFromDefaults)continue;const t=y(e.category),n=e.editor,o=b.defaults,s=e.isCustom?o.custom?Object(r.get)(o.custom,e.path):void 0:Object(r.get)(o,e.path);e.getItemsCount&&(t.props.itemsCount=e.getItemsCount(s)),t.addItem(new a.a({title:e.name,description:e.description,render:function(){return Object(l.jsx)(n,{value:s,onChange:t=>{u(Object(i.d)(b,e.path,t,e.isCustom))},item:e,context:m})}}))}return Object.values(g)}function d(e,t,n,o){for(const i of e){if(i.showIf&&!i.showIf(o.options,o.data))continue;const e=t(i.category),s=i.editor;e.addItem(new a.a({title:i.name,description:i.description,render:function(){return Object(l.jsx)(s,{value:Object(r.get)(o.options,i.path),onChange:e=>{n(i.path,e)},item:i,context:o})}}))}}},rshM:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n("q1tI"),o=n.n(r),i=n("vF1F"),a=n("kDLi"),s=n("tEy8"),l=n("EnUn"),c=n("Csm0"),d=n("nKUr");const u=o.a.memo(({id:e,title:t,children:n,forceOpen:o,isOpenDefault:s,renderTitle:u,className:f,itemsCount:b,isNested:g=!1})=>{var m;const[y,O]=Object(l.a)(h(e),{isExpanded:!1!==s}),[v,j]=Object(r.useState)(y.isExpanded),S=Object(a.useStyles2)(p);Object(r.useEffect)(()=>{!v&&o&&o>0&&j(!0)},[o,v]);const x=Object(r.useCallback)(()=>{O({isExpanded:!v}),j(!v)},[O,j,v]);u||(u=function(e){return e||void 0===b||0===b?t:m||(m=Object(d.jsxs)("span",{children:[t," ",Object(d.jsx)(a.Counter,{value:b})]}))});const M=Object(i.cx)({[S.box]:!0,[S.boxNestedExpanded]:g&&v},f,"options-group"),w=Object(i.cx)(S.header,{[S.headerExpanded]:v,[S.headerNested]:g}),k=Object(i.cx)(S.body,{[S.bodyNested]:g});return Object(d.jsxs)("div",{className:M,"data-testid":"options-category","aria-label":c.a.components.OptionsGroup.group(e),children:[Object(d.jsxs)("div",{className:w,onClick:x,"aria-label":c.a.components.OptionsGroup.toggle(e),children:[Object(d.jsx)("div",{className:Object(i.cx)(S.toggle,"editor-options-group-toggle"),children:Object(d.jsx)(a.Icon,{name:v?"angle-down":"angle-right"})}),Object(d.jsx)("div",{className:S.title,role:"heading",children:u(v)})]}),v&&Object(d.jsx)("div",{className:k,children:n})]})}),p=e=>({box:i.css`
      border-top: 1px solid ${e.colors.border.weak};
    `,boxNestedExpanded:i.css`
      margin-bottom: ${e.spacing(2)};
    `,toggle:i.css`
      color: ${e.colors.text.secondary};
      margin-right: ${e.spacing(1)};
    `,title:i.css`
      flex-grow: 1;
      overflow: hidden;
    `,header:i.css`
      display: flex;
      cursor: pointer;
      align-items: baseline;
      padding: ${e.spacing(1)};
      color: ${e.colors.text.primary};
      font-weight: ${e.typography.fontWeightMedium};

      &:hover {
        background: ${e.colors.emphasize(e.colors.background.primary,.03)};
      }
    `,headerExpanded:i.css`
      color: ${e.colors.text.primary};
    `,headerNested:i.css`
      padding: ${e.spacing(.5,0,.5,0)};
    `,body:i.css`
      padding: ${e.spacing(1,2,1,4)};
    `,bodyNested:i.css`
      position: relative;
      padding-right: 0;
      &:before {
        content: '';
        position: absolute;
        top: 0;
        left: 8px;
        width: 1px;
        height: 100%;
        background: ${e.colors.border.weak};
      }
    `}),h=e=>`${s.a}.optionGroup[${e}]`},sS6v:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){void 0}},waAV:function(e,t,n){"use strict";n.d(t,"c",(function(){return l})),n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return u})),n.d(t,"d",(function(){return p}));var r=n("tEy8"),o=n("KyLG"),i=n("SMGL"),a=n("LvDl");function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t){return n=>{const o=t.initEditPanel(e);n(Object(r.h)({panel:o,sourcePanel:e}))}}function c(){return async(e,t)=>{const{getPanel:n}=t().panelEditor;n().configRev=0,e(Object(r.d)(!0))}}function d(e,t){var n;return(null===(n=t.libraryPanel)||void 0===n?void 0:n.uid)!==e.libraryPanel.uid||(!(!t.id||t.id!==e.editSourceId)||!!t.repeatPanelId)}function u(){return async(e,t)=>{const n=t().dashboard.getModel(),{getPanel:i,getSourcePanel:l,shouldDiscardChanges:c}=t().panelEditor;if(!c){const t=i(),r=t.getSaveModel(),c=l(),u=c.type!==t.type;e(function(e,t){return n=>{var r;if(void 0===(null===(r=e.libraryPanel)||void 0===r?void 0:r.uid)||!t)return;const i=e.getSaveModel();for(const r of t.panels){var l,c;if(d(e,r))continue;r.restoreModel(s({},i,Object(a.pick)(r,"gridPos","id")));const t=(null===(l=r.plugin)||void 0===l?void 0:l.meta.id)!==(null===(c=e.plugin)||void 0===c?void 0:c.meta.id);r.plugin=e.plugin,r.configRev++,t&&n(Object(o.l)({panelId:r.id,plugin:r.plugin})),setTimeout(()=>{r.getQueryRunner().useLastResultFrom(e.getQueryRunner())},20)}e.repeat&&setTimeout(()=>t.processRepeats(),20)}}(t,n)),r.id=c.id,c.restoreModel(r),c.configRev++,c.plugin=t.plugin,u&&await e(Object(o.l)({panelId:c.id,plugin:t.plugin})),setTimeout(()=>{c.getQueryRunner().useLastResultFrom(t.getQueryRunner()),c.render()},20)}n&&n.exitPanelEditor(),e(Object(r.b)()),e(Object(o.c)())}}function p(e){return(t,n)=>{const o=s({},n().panelEditor.ui,e);t(Object(r.e)(o));try{i.a.setObject(r.a,o)}catch(e){console.error(e)}}}},xsuF:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n("q1tI"),o=n("Jzaf"),i=n("w+lj");function a(){const e=Object(i.a)(e=>e.rulerRules);return Object(r.useCallback)(t=>{var n;const r="string"==typeof t?t:t.name;return r===o.b||!(null===(n=e[r])||void 0===n||!n.result)},[e])}}}]);
//# sourceMappingURL=DashboardPage.4bfd7b0ee99616560b7a.js.map