Files
server/opt/monitoring/grafana/plugins/grafana-metricsdrilldown-app/751.js
2026-01-07 20:52:11 +01:00

3 lines
503 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see 751.js.LICENSE.txt */
(self.webpackChunkgrafana_metricsdrilldown_app=self.webpackChunkgrafana_metricsdrilldown_app||[]).push([[751],{144:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)>0},362:(e,t,n)=>{"use strict";var r=n(6441);function a(){}function i(){}i.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,i,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:a};return n.PropTypes=n,n}},402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),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.createCoreData=function(e,t,n){const a=!(0,r.isNum)(e.lastX),o=i(e);return a?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}},t.createDraggableData=function(e,t){const 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}},t.getBoundPosition=function(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:o}=e.props;o="string"==typeof o?o:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(o);const s=i(e);if("string"==typeof o){const{ownerDocument:e}=s,t=e.defaultView;let n;if("parent"===o)n=s.parentNode;else{n=s.getRootNode().querySelector(o)}if(!(n instanceof t.HTMLElement))throw new Error('Bounds selector "'+o+'" could not find an element.');const i=n,l=t.getComputedStyle(s),u=t.getComputedStyle(i);o={left:-s.offsetLeft+(0,r.int)(u.paddingLeft)+(0,r.int)(l.marginLeft),top:-s.offsetTop+(0,r.int)(u.paddingTop)+(0,r.int)(l.marginTop),right:(0,a.innerWidth)(i)-(0,a.outerWidth)(s)-s.offsetLeft+(0,r.int)(u.paddingRight)-(0,r.int)(l.marginRight),bottom:(0,a.innerHeight)(i)-(0,a.outerHeight)(s)-s.offsetTop+(0,r.int)(u.paddingBottom)-(0,r.int)(l.marginBottom)}}(0,r.isNum)(o.right)&&(t=Math.min(t,o.right));(0,r.isNum)(o.bottom)&&(n=Math.min(n,o.bottom));(0,r.isNum)(o.left)&&(t=Math.max(t,o.left));(0,r.isNum)(o.top)&&(n=Math.max(n,o.top));return[t,n]},t.getControlPosition=function(e,t,n){const r="number"==typeof t?(0,a.getTouch)(e,t):null;if("number"==typeof t&&!r)return null;const o=i(n),s=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,a.offsetXYFromParent)(r||e,s,n.props.scale)},t.snapToGrid=function(e,t,n){const r=Math.round(t/e[0])*e[0],a=Math.round(n/e[1])*e[1];return[r,a]};var r=n(6732),a=n(2837);function i(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}},414:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bottom=d,t.childrenEqual=function(e,t){return(0,r.default)(a.default.Children.map(e,function(e){return null==e?void 0:e.key}),a.default.Children.map(t,function(e){return null==e?void 0:e.key}))},t.cloneLayout=p,t.cloneLayoutItem=f,t.collides=g,t.compact=v,t.compactItem=w,t.compactType=function(e){var t=e||{},n=t.verticalCompact,r=t.compactType;return!1===n?null:r},t.correctBounds=S,t.fastPositionEqual=function(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height},t.fastRGLPropsEqual=void 0,t.getAllCollisions=E,t.getFirstCollision=_,t.getLayoutItem=x,t.getStatics=C,t.modifyLayout=h,t.moveElement=R,t.moveElementAwayFromCollision=O,t.noop=void 0,t.perc=function(e){return 100*e+"%"},t.setTopLeft=function(e){var t=e.top,n=e.left,r=e.width,a=e.height;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(a,"px"),position:"absolute"}},t.setTransform=function(e){var t=e.top,n=e.left,r=e.width,a=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(a,"px"),position:"absolute"}},t.sortLayoutItems=T,t.sortLayoutItemsByColRow=k,t.sortLayoutItemsByRowCol=D,t.synchronizeLayoutWithChildren=function(e,t,n,r,i){e=e||[];var o=[];a.default.Children.forEach(t,function(t){if(null!=(null==t?void 0:t.key)){var n=x(e,String(t.key));if(n)o.push(f(n));else{!u&&t.props._grid&&console.warn("`_grid` properties on children have been deprecated as of React 15.2. Please use `data-grid` or add your properties directly to the `layout`.");var r=t.props["data-grid"]||t.props._grid;r?(u||A([r],"ReactGridLayout.children"),o.push(f(s(s({},r),{},{i:t.key})))):o.push(f({w:1,h:1,x:0,y:d(o),i:String(t.key)}))}}});var l=S(o,{cols:n});return i?l:v(l,r,n)},t.validateLayout=A,t.withLayoutItem=function(e,t,n){var r=x(e,t);return r?(r=n(f(r)),[e=h(e,r),r]):[e,null]};var r=i(n(7842)),a=i(n(5959));function i(e){return e&&e.__esModule?e:{default:e}}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 s(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){l(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 l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=!0,c=!1;function d(e){for(var t,n=0,r=0,a=e.length;r<a;r++)(t=e[r].y+e[r].h)>n&&(n=t);return n}function p(e){for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=f(e[n]);return t}function h(e,t){for(var n=Array(e.length),r=0,a=e.length;r<a;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function f(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 m=n(7434);function g(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 v(e,t,n){for(var r=C(e),a=T(e,t),i=Array(e.length),o=0,s=a.length;o<s;o++){var l=f(a[o]);l.static||(l=w(r,l,t,n,a),r.push(l)),i[e.indexOf(a[o])]=l,l.moved=!1}return i}t.fastRGLPropsEqual=m;var b={x:"w",y:"h"};function y(e,t,n,r){var a=b[r];t[r]+=1;for(var i=e.map(function(e){return e.i}).indexOf(t.i)+1;i<e.length;i++){var o=e[i];if(!o.static){if(o.y>t.y+t.h)break;g(t,o)&&y(e,o,n+t[a],r)}}t[r]=n}function w(e,t,n,r,a){var i,o="horizontal"===n;if("vertical"===n)for(t.y=Math.min(d(e),t.y);t.y>0&&!_(e,t);)t.y--;else if(o)for(;t.x>0&&!_(e,t);)t.x--;for(;i=_(e,t);)o?y(a,t,i.x+i.w,"x"):y(a,t,i.y+i.h,"y"),o&&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 S(e,t){for(var n=C(e),r=0,a=e.length;r<a;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(;_(n,i);)i.y++;else n.push(i)}return e}function x(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function _(e,t){for(var n=0,r=e.length;n<r;n++)if(g(e[n],t))return e[n]}function E(e,t){return e.filter(function(e){return g(e,t)})}function C(e){return e.filter(function(e){return e.static})}function R(e,t,n,r,a,i,o,s,l){if(t.static&&!0!==t.isDraggable)return e;if(t.y===r&&t.x===n)return e;P("Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]"));var u=t.x,c=t.y;"number"==typeof n&&(t.x=n),"number"==typeof r&&(t.y=r),t.moved=!0;var d=T(e,o);("vertical"===o&&"number"==typeof r?c>=r:"horizontal"===o&&"number"==typeof n&&u>=n)&&(d=d.reverse());var h=E(d,t),f=h.length>0;if(f&&l)return p(e);if(f&&i)return P("Collision prevented on ".concat(t.i,", reverting.")),t.x=u,t.y=c,t.moved=!1,e;for(var m=0,g=h.length;m<g;m++){var v=h[m];P("Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(v.i," at [").concat(v.x,",").concat(v.y,"]")),v.moved||(e=v.static?O(e,v,t,a,o,s):O(e,t,v,a,o,s))}return e}function O(e,t,n,r,a,i){var o="horizontal"===a,s="horizontal"!==a,l=t.static;if(r){r=!1;var u={x:o?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(!_(e,u))return P("Doing reverse collision on ".concat(n.i," up to [").concat(u.x,",").concat(u.y,"].")),R(e,n,o?u.x:void 0,s?u.y:void 0,r,l,a,i)}return R(e,n,o?n.x+1:void 0,s?n.y+1:void 0,r,l,a,i)}function T(e,t){return"horizontal"===t?k(e):"vertical"===t?D(e):e}function D(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 k(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 A(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,a=e.length;r<a;r++)for(var i=e[r],o=0;o<n.length;o++)if("number"!=typeof i[n[o]])throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[o]+" must be a number!")}function P(){var e;c&&(e=console).log.apply(e,arguments)}t.noop=function(){}},544:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findOrGenerateResponsiveLayout=function(e,t,n,i,o,s){if(e[n])return(0,r.cloneLayout)(e[n]);for(var l=e[i],u=a(t),c=u.slice(u.indexOf(n)),d=0,p=c.length;d<p;d++){var h=c[d];if(e[h]){l=e[h];break}}return l=(0,r.cloneLayout)(l||[]),(0,r.compact)((0,r.correctBounds)(l,{cols:o}),s,o)},t.getBreakpointFromWidth=function(e,t){for(var n=a(e),r=n[0],i=1,o=n.length;i<o;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.sortBreakpoints=a;var r=n(414);function a(e){return Object.keys(e).sort(function(t,n){return e[t]-e[n]})}},599:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)<0},603:(e,t,n)=>{"use strict";const r=n(2801);e.exports=(e,t)=>e.sort((e,n)=>r(e,n,t))},651:(e,t,n)=>{"use strict";const r=n(8395);e.exports=(e,t)=>new r(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},660:(e,t,n)=>{"use strict";const r=n(5860);e.exports=(e,t)=>{const n=r(e,null,!0),a=r(t,null,!0),i=n.compare(a);if(0===i)return null;const o=i>0,s=o?n:a,l=o?a:n,u=!!s.prerelease.length;if(!!l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(s))return l.minor&&!l.patch?"minor":"patch"}const c=u?"pre":"";return n.major!==a.major?c+"major":n.minor!==a.minor?c+"minor":n.patch!==a.patch?c+"patch":"prerelease"}},906:(e,t)=>{"use strict";function n(e){var t=e.margin,n=e.containerPadding,r=e.containerWidth,a=e.cols;return(r-t[0]*(a-1)-2*n[0])/a}function r(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function a(e,t,n){return Math.max(Math.min(e,n),t)}Object.defineProperty(t,"__esModule",{value:!0}),t.calcGridColWidth=n,t.calcGridItemPosition=function(e,t,a,i,o,s){var l=e.margin,u=e.containerPadding,c=e.rowHeight,d=n(e),p={};s&&s.resizing?(p.width=Math.round(s.resizing.width),p.height=Math.round(s.resizing.height)):(p.width=r(i,d,l[0]),p.height=r(o,c,l[1]));s&&s.dragging?(p.top=Math.round(s.dragging.top),p.left=Math.round(s.dragging.left)):(p.top=Math.round((c+l[1])*a+u[1]),p.left=Math.round((d+l[0])*t+u[0]));return p},t.calcGridItemWHPx=r,t.calcWH=function(e,t,r,i,o){var s=e.margin,l=e.maxRows,u=e.cols,c=e.rowHeight,d=n(e),p=Math.round((t+s[0])/(d+s[0])),h=Math.round((r+s[1])/(c+s[1]));return p=a(p,0,u-i),h=a(h,0,l-o),{w:p,h}},t.calcXY=function(e,t,r,i,o){var s=e.margin,l=e.cols,u=e.rowHeight,c=e.maxRows,d=n(e),p=Math.round((r-s[0])/(d+s[0])),h=Math.round((t-s[1])/(u+s[1]));return p=a(p,0,l-i),h=a(h,0,c-o),{x:p,y:h}},t.clamp=a},936:(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(1794).default,e.exports.ResizableBox=n(6609).default},1060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var a,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(a=t?r:n){if(a.has(e))return a.get(e);a.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?a(o,t,i):o[t]=e[t]);return o}(e,t)}(n(5959)),a=c(n(2688)),i=c(n(8398)),o=n(2837),s=n(402),l=n(6732),u=c(n(7988));function c(e){return e&&e.__esModule?e:{default:e}}function d(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const p={start:"touchstart",move:"touchmove",stop:"touchend"},h={start:"mousedown",move:"mousemove",stop:"mouseup"};let f=h;class m extends r.Component{constructor(){super(...arguments),d(this,"dragging",!1),d(this,"lastX",NaN),d(this,"lastY",NaN),d(this,"touchIdentifier",null),d(this,"mounted",!1),d(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,o.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,o.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"!==e.type||this.props.allowMobileScroll||e.preventDefault();const r=(0,o.getTouchIdentifier)(e);this.touchIdentifier=r;const a=(0,s.getControlPosition)(e,r,this);if(null==a)return;const{x:i,y:l}=a,c=(0,s.createCoreData)(this,i,l);(0,u.default)("DraggableCore: handleDragStart: %j",c),(0,u.default)("calling",this.props.onStart);!1!==this.props.onStart(e,c)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,o.addUserSelectStyles)(n),this.dragging=!0,this.lastX=i,this.lastY=l,(0,o.addEvent)(n,f.move,this.handleDrag),(0,o.addEvent)(n,f.stop,this.handleDragStop))}),d(this,"handleDrag",e=>{const t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=(0,s.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}const a=(0,s.createCoreData)(this,n,r);(0,u.default)("DraggableCore: handleDrag: %j",a);if(!1!==this.props.onDrag(e,a)&&!1!==this.mounted)this.lastX=n,this.lastY=r;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch(e){const t=document.createEvent("MouseEvents");t.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(t)}}),d(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=(0,s.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}const a=(0,s.createCoreData)(this,n,r);if(!1===this.props.onStop(e,a)||!1===this.mounted)return!1;const i=this.findDOMNode();i&&this.props.enableUserSelectHack&&(0,o.scheduleRemoveUserSelectStyles)(i.ownerDocument),(0,u.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,i&&((0,u.default)("DraggableCore: Removing handlers"),(0,o.removeEvent)(i.ownerDocument,f.move,this.handleDrag),(0,o.removeEvent)(i.ownerDocument,f.stop,this.handleDragStop))}),d(this,"onMouseDown",e=>(f=h,this.handleDragStart(e))),d(this,"onMouseUp",e=>(f=h,this.handleDragStop(e))),d(this,"onTouchStart",e=>(f=p,this.handleDragStart(e))),d(this,"onTouchEnd",e=>(f=p,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,o.addEvent)(e,p.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,o.removeEvent)(t,h.move,this.handleDrag),(0,o.removeEvent)(t,p.move,this.handleDrag),(0,o.removeEvent)(t,h.stop,this.handleDragStop),(0,o.removeEvent)(t,p.stop,this.handleDragStop),(0,o.removeEvent)(e,p.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,o.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:i.default.findDOMNode(this)}render(){return r.cloneElement(r.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}t.default=m,d(m,"displayName","DraggableCore"),d(m,"propTypes",{allowAnyClick:a.default.bool,allowMobileScroll:a.default.bool,children:a.default.node.isRequired,disabled:a.default.bool,enableUserSelectHack:a.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:a.default.arrayOf(a.default.number),handle:a.default.string,cancel:a.default.string,nodeRef:a.default.object,onStart:a.default.func,onDrag:a.default.func,onStop:a.default.func,onMouseDown:a.default.func,scale:a.default.number,className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),d(m,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},1112:(e,t,n)=>{"use strict";const r=n(8395);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t,n))},1158:e=>{"use strict";e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},1465:(e,t,n)=>{"use strict";const r=n(1722),a=n(5380);e.exports=(e,t,n)=>{const i=[];let o=null,s=null;const l=e.sort((e,t)=>a(e,t,n));for(const e of l){r(e,t,n)?(s=e,o||(o=e)):(s&&i.push([o,s]),s=null,o=null)}o&&i.push([o,null]);const u=[];for(const[e,t]of i)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},1617:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t)=>new r(e,t).patch},1625:(e,t,n)=>{"use strict";n.d(t,{$N:()=>a,$m:()=>s,ob:()=>o,vp:()=>l,xB:()=>i,yL:()=>r});var r=(e=>(e.Always="always",e.Auto="auto",e.Never="never",e))(r||{});var a=(e=>(e.Multi="multi",e.None="none",e.Single="single",e))(a||{}),i=(e=>(e.Ascending="asc",e.Descending="desc",e.None="none",e))(i||{});var o=(e=>(e.Actions="actions",e.Auto="auto",e.BasicGauge="basic",e.ColorBackground="color-background",e.ColorBackgroundSolid="color-background-solid",e.ColorText="color-text",e.Custom="custom",e.DataLinks="data-links",e.Gauge="gauge",e.Geo="geo",e.GradientGauge="gradient-gauge",e.Image="image",e.JSONView="json-view",e.LcdGauge="lcd-gauge",e.Markdown="markdown",e.Pill="pill",e.Sparkline="sparkline",e))(o||{}),s=(e=>(e.CSV="csv",e.CustomQueryParam="customqueryparam",e.Date="date",e.Distributed="distributed",e.DoubleQuote="doublequote",e.Glob="glob",e.HTML="html",e.JSON="json",e.Join="join",e.Lucene="lucene",e.PercentEncode="percentencode",e.Pipe="pipe",e.QueryParam="queryparam",e.Raw="raw",e.Regex="regex",e.SQLString="sqlstring",e.SingleQuote="singlequote",e.Text="text",e.UriEncode="uriencode",e))(s||{});const l="browser"},1722:(e,t,n)=>{"use strict";const r=n(8395);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},1794:(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={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=a?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(r,i,o):r[i]=e[i]}r.default=e,n&&n.set(e,r);return r}(n(5959)),a=n(8230),i=n(9954),o=n(6333),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 u(){return u=Object.assign?Object.assign.bind():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},u.apply(this,arguments)}function c(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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(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?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}var f=function(e){var t,n;function o(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return(t=e.call.apply(e,[this].concat(r))||this).handleRefs={},t.lastHandleRect=null,t.slack=null,t}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,h(t,n);var l=o.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,a=n.maxConstraints,i=n.lockAspectRatio;if(!r&&!a&&!i)return[e,t];if(i){var o=this.props.width/this.props.height,s=e-this.props.width,l=t-this.props.height;Math.abs(s)>Math.abs(l*o)?t=e/o:e=t*o}var u=e,c=t,d=this.slack||[0,0],p=d[0],h=d[1];return e+=p,t+=h,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),a&&(e=Math.min(a[0],e),t=Math.min(a[1],t)),this.slack=[p+(u-e),h+(c-t)],[e,t]},l.resizeHandler=function(e,t){var n=this;return function(r,a){var i=a.node,o=a.deltaX,s=a.deltaY;"onResizeStart"===e&&n.resetData();var l=("both"===n.props.axis||"x"===n.props.axis)&&"n"!==t&&"s"!==t,u=("both"===n.props.axis||"y"===n.props.axis)&&"e"!==t&&"w"!==t;if(l||u){var c=t[0],d=t[t.length-1],p=i.getBoundingClientRect();if(null!=n.lastHandleRect){if("w"===d)o+=p.left-n.lastHandleRect.left;if("n"===c)s+=p.top-n.lastHandleRect.top}n.lastHandleRect=p,"w"===d&&(o=-o),"n"===c&&(s=-s);var h=n.props.width+(l?o/n.props.transformScale:0),f=n.props.height+(u?s/n.props.transformScale:0),m=n.runConstraints(h,f);h=m[0],f=m[1];var g=h!==n.props.width||f!==n.props.height,v="function"==typeof n.props[e]?n.props[e]:null;v&&!("onResize"===e&&!g)&&(null==r.persist||r.persist(),v(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 a=d({ref:t},"string"==typeof n.type?{}:{handleAxis:e});return r.cloneElement(n,a)},l.render=function(){var e=this,t=this.props,n=t.children,o=t.className,l=t.draggableOpts,c=(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,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(t,s));return(0,i.cloneElement)(n,d(d({},p),{},{className:(o?o+" ":"")+"react-resizable",children:[].concat(n.props.children,c.map(function(t){var n,i=null!=(n=e.handleRefs[t])?n:e.handleRefs[t]=r.createRef();return r.createElement(a.DraggableCore,u({},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))}))}))},o}(r.Component);t.default=f,f.propTypes=o.resizableProps,f.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}},2077:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)>=0},2245:(e,t,n)=>{"use strict";n.d(t,{zL:()=>a});var r=n(6145),a=(e=>(e[e.dontHide=0]="dontHide",e[e.hideLabel=1]="hideLabel",e[e.hideVariable=2]="hideVariable",e[e.inControlsMenu=3]="inControlsMenu",e))(a||{});r.rw},2548:(e,t,n)=>{e.exports=n(9482).default,e.exports.utils=n(414),e.exports.Responsive=n(4636).default,e.exports.Responsive.utils=n(544),e.exports.WidthProvider=n(6805).default},2688:(e,t,n)=>{e.exports=n(362)()},2801:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t,n)=>{const a=new r(e,n),i=new r(t,n);return a.compare(i)||a.compareBuild(i)}},2837:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addClassName=u,t.addEvent=function(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,a):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},t.addUserSelectStyles=function(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.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&&u(e.body,"react-draggable-transparent-selection")},t.createCSSTransform=function(e,t){const n=s(e,t,"px");return{[(0,a.browserPrefixToKey)("transform",a.default)]:n}},t.createSVGTransform=function(e,t){return s(e,t,"")},t.getTouch=function(e,t){return e.targetTouches&&(0,r.findInArray)(e.targetTouches,e=>t===e.identifier)||e.changedTouches&&(0,r.findInArray)(e.changedTouches,e=>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.getTranslation=s,t.innerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,r.int)(n.paddingTop),t-=(0,r.int)(n.paddingBottom),t},t.innerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,r.int)(n.paddingLeft),t-=(0,r.int)(n.paddingRight),t},t.matchesSelector=o,t.matchesSelectorAndParentsTo=function(e,t,n){let r=e;do{if(o(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1},t.offsetXYFromParent=function(e,t,n){const r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),a=(e.clientX+t.scrollLeft-r.left)/n,i=(e.clientY+t.scrollTop-r.top)/n;return{x:a,y:i}},t.outerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,r.int)(n.borderTopWidth),t+=(0,r.int)(n.borderBottomWidth),t},t.outerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,r.int)(n.borderLeftWidth),t+=(0,r.int)(n.borderRightWidth),t},t.removeClassName=c,t.removeEvent=function(e,t,n,r){if(!e)return;const a={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,a):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},t.scheduleRemoveUserSelectStyles=function(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{l(e)}):l(e)};var r=n(6732),a=function(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var a,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(a=t?r:n){if(a.has(e))return a.get(e);a.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?a(o,t,i):o[t]=e[t]);return o}(e,t)}(n(7350));let i="";function o(e,t){return i||(i=(0,r.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,r.isFunction)(e[t])})),!!(0,r.isFunction)(e[i])&&e[i](t)}function s(e,t,n){let{x:r,y:a}=e,i=`translate(${r}${n},${a}${n})`;if(t){i=`translate(${`${"string"==typeof t.x?t.x:t.x+n}`}, ${`${"string"==typeof t.y?t.y:t.y+n}`})`+i}return i}function l(e){if(e)try{if(e.body&&c(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}}function u(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function c(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g"),"")}},2862:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(t,e,n)},2966:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t)=>new r(e,t).major},3489:(e,t,n)=>{"use strict";const r=n(7944),a=n(8395),i=n(144);e.exports=(e,t)=>{e=new a(e,t);let n=new r("0.0.0");if(e.test(n))return n;if(n=new r("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t<e.set.length;++t){const a=e.set[t];let o=null;a.forEach(e=>{const t=new r(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!i(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!o||n&&!i(n,o)||(n=o)}return n&&e.test(n)?n:null}},3811:(e,t,n)=>{"use strict";const r=n(6909),a=n(7659),i=n(144),o=n(2077),s=n(599),l=n(7092);e.exports=(e,t,n,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return r(e,n,u);case"!=":return a(e,n,u);case">":return i(e,n,u);case">=":return o(e,n,u);case"<":return s(e,n,u);case"<=":return l(e,n,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},4031:e=>{"use strict";const t=/^[0-9]+$/,n=(e,n)=>{const r=t.test(e),a=t.test(n);return r&&a&&(e=+e,n=+n),e===n?0:r&&!a?-1:a&&!r?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},4266:(e,t,n)=>{"use strict";const r=n(5463);e.exports=(e,t,n)=>r(e,t,"<",n)},4290:(e,t,n)=>{"use strict";n.d(t,{B:()=>c,G:()=>a,P:()=>d,S:()=>i,T:()=>b,V:()=>r,a:()=>u,b:()=>l,c:()=>s,d:()=>p,e:()=>g,f:()=>f,g:()=>m,h:()=>h,i:()=>o});var r=(e=>(e.Always="always",e.Auto="auto",e.Never="never",e))(r||{}),a=(e=>(e.Hue="hue",e.None="none",e.Opacity="opacity",e.Scheme="scheme",e))(a||{}),i=(e=>(e.None="none",e.Normal="normal",e.Percent="percent",e))(i||{});var o=(e=>(e.Auto="auto",e.Horizontal="horizontal",e.Vertical="vertical",e))(o||{});var s=(e=>(e.Background="background",e.BackgroundSolid="background_solid",e.None="none",e.Value="value",e))(s||{}),l=(e=>(e.Area="area",e.Line="line",e.None="none",e))(l||{}),u=(e=>(e.Auto="auto",e.Center="center",e))(u||{}),c=(e=>(e.Auto="auto",e.Name="name",e.None="none",e.Value="value",e.ValueAndName="value_and_name",e))(c||{}),d=(e=>(e.Inverted="inverted",e.SameAsValue="same_as_value",e.Standard="standard",e))(d||{}),p=(e=>(e.Multi="multi",e.None="none",e.Single="single",e))(p||{});var h=(e=>(e.Basic="basic",e.Gradient="gradient",e.Lcd="lcd",e))(h||{}),f=(e=>(e.Color="color",e.Hidden="hidden",e.Text="text",e))(f||{}),m=(e=>(e.Auto="auto",e.Hidden="hidden",e.Left="left",e.Top="top",e))(m||{}),g=(e=>(e.Auto="auto",e.Manual="manual",e))(g||{}),v=(e=>(e.Actions="actions",e.Auto="auto",e.BasicGauge="basic",e.ColorBackground="color-background",e.ColorBackgroundSolid="color-background-solid",e.ColorText="color-text",e.Custom="custom",e.DataLinks="data-links",e.Gauge="gauge",e.Geo="geo",e.GradientGauge="gradient-gauge",e.Image="image",e.JSONView="json-view",e.LcdGauge="lcd-gauge",e.Markdown="markdown",e.Pill="pill",e.Sparkline="sparkline",e))(v||{}),b=(e=>(e.Auto="auto",e.Lg="lg",e.Md="md",e.Sm="sm",e))(b||{});v.Auto},4636:(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},r(e)}t.default=void 0;var a=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 a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}a.default=e,n&&n.set(e,a);return a}(n(5959)),i=d(n(2688)),o=d(n(7842)),s=n(414),l=n(544),u=d(n(9482)),c=["breakpoint","breakpoints","cols","layouts","margin","containerPadding","onBreakpointChange","onLayoutChange","onWidthChange"];function d(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(){return h=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},h.apply(this,arguments)}function f(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(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)&&(a[n]=e[n])}return a}function m(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 g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(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 b(e,t){return b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},b(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,a=S(e);if(t){var i=S(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return w(e)}(this,n)}}function w(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)},S(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 _=function(e){return Object.prototype.toString.call(e)};function E(e,t){return null==e?null:Array.isArray(e)?e:e[t]}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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(d,e);var t,n,r,i=y(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return x(w(e=i.call.apply(i,[this].concat(n))),"state",e.generateInitialState()),x(w(e),"onLayoutChange",function(t){e.props.onLayoutChange(t,g(g({},e.props.layouts),{},x({},e.state.breakpoint,t)))}),e}return t=d,r=[{key:"getDerivedStateFromProps",value:function(e,t){if(!(0,o.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,a=e.cols,i=(0,l.getBreakpointFromWidth)(n,t),o=(0,l.getColsFromBreakpoint)(i,a),s=!1===this.props.verticalCompact?null:this.props.compactType;return{layout:(0,l.findOrGenerateResponsiveLayout)(r,n,i,i,o,s),breakpoint:i,cols:o}}},{key:"componentDidUpdate",value:function(e){this.props.width==e.width&&this.props.breakpoint===e.breakpoint&&(0,o.default)(this.props.breakpoints,e.breakpoints)&&(0,o.default)(this.props.cols,e.cols)||this.onWidthChange(e)}},{key:"onWidthChange",value:function(e){var t=this.props,n=t.breakpoints,r=t.cols,a=t.layouts,i=t.compactType,o=this.props.breakpoint||(0,l.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),u=this.state.breakpoint,c=(0,l.getColsFromBreakpoint)(o,r),d=g({},a);if(u!==o||e.breakpoints!==n||e.cols!==r){u in d||(d[u]=(0,s.cloneLayout)(this.state.layout));var p=(0,l.findOrGenerateResponsiveLayout)(d,n,o,u,c,i);p=(0,s.synchronizeLayoutWithChildren)(p,this.props.children,c,i,this.props.allowOverlap),d[o]=p,this.props.onLayoutChange(p,d),this.props.onBreakpointChange(o,c),this.setState({breakpoint:o,layout:p,cols:c})}var h=E(this.props.margin,o),f=E(this.props.containerPadding,o);this.props.onWidthChange(this.props.width,h,c,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,f(e,c));return a.createElement(u.default,h({},r,{margin:E(t,this.state.breakpoint),containerPadding:E(n,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}])&&v(t.prototype,n),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),d}(a.Component);t.default=C,x(C,"propTypes",{breakpoint:i.default.string,breakpoints:i.default.object,allowOverlap:i.default.bool,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]"!==_(e[t]))throw new Error("Layout property must be an object. Received: "+_(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(C,"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],allowOverlap:!1,onBreakpointChange:s.noop,onLayoutChange:s.noop,onWidthChange:s.noop})},5334:(e,t,n)=>{"use strict";const r=n(7944),a=n(5860),{safeRe:i,t:o}=n(6850);e.exports=(e,t)=>{if(e instanceof r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){const r=t.includePrerelease?i[o.COERCERTLFULL]:i[o.COERCERTL];let a;for(;(a=r.exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&a.index+a[0].length===n.index+n[0].length||(n=a),r.lastIndex=a.index+a[1].length+a[2].length;r.lastIndex=-1}else n=e.match(t.includePrerelease?i[o.COERCEFULL]:i[o.COERCE]);if(null===n)return null;const s=n[2],l=n[3]||"0",u=n[4]||"0",c=t.includePrerelease&&n[5]?`-${n[5]}`:"",d=t.includePrerelease&&n[6]?`+${n[6]}`:"";return a(`${s}.${l}.${u}${c}${d}`,t)}},5380:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},5463:(e,t,n)=>{"use strict";const r=n(7944),a=n(9524),{ANY:i}=a,o=n(8395),s=n(1722),l=n(144),u=n(599),c=n(7092),d=n(2077);e.exports=(e,t,n,p)=>{let h,f,m,g,v;switch(e=new r(e,p),t=new o(t,p),n){case">":h=l,f=c,m=u,g=">",v=">=";break;case"<":h=u,f=d,m=l,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(e,t,p))return!1;for(let n=0;n<t.set.length;++n){const r=t.set[n];let o=null,s=null;if(r.forEach(e=>{e.semver===i&&(e=new a(">=0.0.0")),o=o||e,s=s||e,h(e.semver,o.semver,p)?o=e:m(e.semver,s.semver,p)&&(s=e)}),o.operator===g||o.operator===v)return!1;if((!s.operator||s.operator===g)&&f(e,s.semver))return!1;if(s.operator===v&&m(e,s.semver))return!1}return!0}},5860:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t,n=!1)=>{if(e instanceof r)return e;try{return new r(e,t)}catch(e){if(!n)return null;throw e}}},5938:(e,t,n)=>{"use strict";n.d(t,{KQ:()=>i,P7:()=>a});var r=n(4290);var a=(e=>(e.Opacity="opacity",e.Scheme="scheme",e))(a||{});const i={calculate:!1,cellGap:1,cellValues:{},color:{scheme:"Oranges",fill:"dark-orange",reverse:!1,exponent:.5,steps:64},exemplars:{color:"rgba(255,0,255,0.7)"},filterValues:{le:1e-9},legend:{show:!0},selectionMode:"x",showValue:r.V.Auto,tooltip:{mode:r.d.Single,yHistogram:!1,showColorScale:!1}}},5955:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t,n,a,i)=>{"string"==typeof n&&(i=a,a=n,n=void 0);try{return new r(e instanceof r?e.version:e,n).inc(t,a,i).version}catch(e){return null}}},5986:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t)=>new r(e,t).minor},6033:(e,t,n)=>{"use strict";const r=n(2801);e.exports=(e,t)=>e.sort((e,n)=>r(n,e,t))},6145:(e,t,n)=>{"use strict";n.d(t,{CO:()=>a,dM:()=>i,rw:()=>r,yV:()=>o});const r={allowCustomValue:!0,includeAll:!1,multi:!1,options:[],skipUrlSync:!1,staticOptions:[]};var a=(e=>(e[e.never=0]="never",e[e.onDashboardLoad=1]="onDashboardLoad",e[e.onTimeRangeChanged=2]="onTimeRangeChanged",e))(a||{});var i=(e=>(e.RangeToText="range",e.RegexToText="regex",e.SpecialValue="special",e.ValueToText="value",e))(i||{});var o=(e=>(e[e.Crosshair=1]="Crosshair",e[e.Off=0]="Off",e[e.Tooltip=2]="Tooltip",e))(o||{})},6333:(e,t,n)=>{"use strict";t.__esModule=!0,t.resizableProps=void 0;var r,a=(r=n(2688))&&r.__esModule?r:{default:r};n(8230);var i={axis:a.default.oneOf(["both","x","y","none"]),className:a.default.string,children:a.default.element.isRequired,draggableOpts:a.default.shape({allowAnyClick:a.default.bool,cancel:a.default.string,children:a.default.node,disabled:a.default.bool,enableUserSelectHack:a.default.bool,offsetParent:a.default.node,grid:a.default.arrayOf(a.default.number),handle:a.default.string,nodeRef:a.default.object,onStart:a.default.func,onDrag:a.default.func,onStop:a.default.func,onMouseDown:a.default.func,scale:a.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=t[0];return"both"===i.axis||"y"===i.axis?(r=a.default.number).isRequired.apply(r,t):a.default.number.apply(a.default,t)},handle:a.default.oneOfType([a.default.node,a.default.func]),handleSize:a.default.arrayOf(a.default.number),lockAspectRatio:a.default.bool,maxConstraints:a.default.arrayOf(a.default.number),minConstraints:a.default.arrayOf(a.default.number),onResizeStop:a.default.func,onResizeStart:a.default.func,onResize:a.default.func,resizeHandles:a.default.arrayOf(a.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:a.default.number,width:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=t[0];return"both"===i.axis||"x"===i.axis?(r=a.default.number).isRequired.apply(r,t):a.default.number.apply(a.default,t)}};t.resizableProps=i},6441:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},6609:(e,t,n)=>{"use strict";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=u(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=a?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(r,i,o):r[i]=e[i]}r.default=e,n&&n.set(e,r);return r}(n(5959)),a=l(n(2688)),i=l(n(1794)),o=n(6333),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 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 c(){return c=Object.assign?Object.assign.bind():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},c.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 p(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){h(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 h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(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?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var m=function(e){var t,n;function a(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];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=a).prototype=Object.create(n.prototype),t.prototype.constructor=t,f(t,n),a.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},a.prototype.render=function(){var e=this.props,t=e.handle,n=e.handleSize,a=(e.onResize,e.onResizeStart),o=e.onResizeStop,l=e.draggableOpts,u=e.minConstraints,d=e.maxConstraints,h=e.lockAspectRatio,f=e.axis,m=(e.width,e.height,e.resizeHandles),g=e.style,v=e.transformScale,b=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,s);return r.createElement(i.default,{axis:f,draggableOpts:l,handle:t,handleSize:n,height:this.state.height,lockAspectRatio:h,maxConstraints:d,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:o,resizeHandles:m,transformScale:v,width:this.state.width},r.createElement("div",c({},b,{style:p(p({},g),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},a}(r.Component);t.default=m,m.propTypes=p(p({},o.resizableProps),{},{children:a.default.element})},6732:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dontSetMe=function(e,t,n){if(e[t])return new Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)},t.findInArray=function(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},t.int=function(e){return parseInt(e,10)},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)}},6751:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AdHocFiltersVariable:()=>As,ConstantVariable:()=>ll,ControlsLabel:()=>Xn,CustomVariable:()=>Uc,DataProviderProxy:()=>Mc,DataSourceVariable:()=>qc,EmbeddedScene:()=>fd,FieldConfigBuilder:()=>ah,FieldConfigBuilders:()=>hh,FieldConfigOverridesBuilder:()=>rh,GroupByVariable:()=>Un,IntervalVariable:()=>td,LazyLoader:()=>iu,LocalValueVariable:()=>Wl,MultiOrSingleValueSelect:()=>kn,MultiValueVariable:()=>wt,NestedScene:()=>Fd,NewSceneObjectAddedEvent:()=>ud,PATH_ID_SEPARATOR:()=>Hl,PanelBuilders:()=>sh,PanelOptionsBuilders:()=>ph,QueryVariable:()=>Rl,RuntimeDataSource:()=>M,SafeSerializableSceneObject:()=>Fn,SceneApp:()=>wp,SceneAppPage:()=>Lp,SceneByFrameRepeater:()=>ip,SceneByVariableRepeater:()=>op,SceneCSSGridItem:()=>pp,SceneCSSGridLayout:()=>dp,SceneCanvasText:()=>$d,SceneControlsSpacer:()=>sp,SceneDataLayerBase:()=>Du,SceneDataLayerControls:()=>ku,SceneDataLayerSet:()=>_u,SceneDataLayerSetBase:()=>xu,SceneDataNode:()=>Z,SceneDataTransformer:()=>Eu,SceneDebugger:()=>Dp,SceneFlexItem:()=>up,SceneFlexLayout:()=>lp,SceneGridItem:()=>wd,SceneGridLayout:()=>Ad,SceneGridLayoutDragStartEvent:()=>Dd,SceneGridRow:()=>Md,SceneObjectBase:()=>k,SceneObjectRef:()=>D,SceneObjectStateChangedEvent:()=>E,SceneObjectUrlSyncConfig:()=>ee,SceneQueryRunner:()=>Ws,SceneReactObject:()=>Ep,SceneRefreshPicker:()=>Kd,SceneRenderProfiler:()=>Ie,SceneTimePicker:()=>Wd,SceneTimeRange:()=>je,SceneTimeRangeCompare:()=>np,SceneTimeRangeTransformerBase:()=>Ic,SceneTimeZoneOverride:()=>Lc,SceneToolbarButton:()=>jd,SceneToolbarInput:()=>Bd,SceneVariableSet:()=>zc,SceneVariableValueChangedEvent:()=>qe,ScopesVariable:()=>Tl,SplitLayout:()=>yp,TestVariable:()=>Zc,TextBoxVariable:()=>ed,UrlSyncContextProvider:()=>hd,UrlSyncManager:()=>cd,UserActionEvent:()=>C,VariableDependencyConfig:()=>ul,VariableValueControl:()=>Bc,VariableValueSelectWrapper:()=>Fc,VariableValueSelectors:()=>Vc,VizConfigBuilder:()=>lh,VizConfigBuilders:()=>uh,VizPanel:()=>Cu,VizPanelBuilder:()=>oh,VizPanelExploreButton:()=>yd,VizPanelMenu:()=>gd,behaviors:()=>r,dataLayers:()=>a,escapeUrlPipeDelimiters:()=>Js,formatRegistry:()=>Je,getExploreURL:()=>bd,isCustomVariableValue:()=>Ge,isDataLayer:()=>At,isDataRequestEnricher:()=>Dt,isFiltersRequestEnricher:()=>kt,isSceneObject:()=>Tt,loadResources:()=>dh,registerQueryWithController:()=>Pt,registerRuntimeDataSource:()=>F,sceneGraph:()=>Ml,sceneUtils:()=>fh,useSceneApp:()=>_p,useSceneObjectState:()=>A,useUrlSync:()=>pd});var r={};n.r(r),n.d(r,{ActWhenVariableChanged:()=>ql,CursorSync:()=>Ql,LiveNowTimer:()=>Ou,SceneInteractionTracker:()=>Wn,SceneQueryController:()=>Q});var a={};n.r(a),n.d(a,{AnnotationsDataLayer:()=>Pc});var i=n(1159),o=n(7781),s=n(8531);function l(e,t,n){const r={...t};if(n)for(const e of Object.keys(r))n.includes(e)||delete r[e];return o.urlUtil.renderUrl(o.locationUtil.assureBaseUrl(e),r)}function u(e){const t=(0,i.useParams)(),n=(0,i.useLocation)();return{params:t,isExact:null!==(0,i.matchPath)({path:e,caseSensitive:!1,end:!0},n.pathname),path:n.pathname,url:n.pathname}}const c=new Map;var d=n(5959),p=n.t(d,2),h=n.n(d),f=n(1269);const m={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let g;const v=new Uint8Array(16);function b(){if(!g&&(g="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!g))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return g(v)}const y=[];for(let e=0;e<256;++e)y.push((e+256).toString(16).slice(1));function w(e,t=0){return y[e[t+0]]+y[e[t+1]]+y[e[t+2]]+y[e[t+3]]+"-"+y[e[t+4]]+y[e[t+5]]+"-"+y[e[t+6]]+y[e[t+7]]+"-"+y[e[t+8]]+y[e[t+9]]+"-"+y[e[t+10]]+y[e[t+11]]+y[e[t+12]]+y[e[t+13]]+y[e[t+14]]+y[e[t+15]]}const S=function(e,t,n){if(m.randomUUID&&!t&&!e)return m.randomUUID();const r=(e=e||{}).random||(e.rng||b)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return w(r)};const x=h().memo(function({model:e,...t}){var n;const r=null!=(n=e.constructor.Component)?n:_,[a,i]=(0,d.useState)(0);return(0,d.useEffect)(()=>{const t=e.activate();return i(e=>e+1),t},[e]),e.isActive||e.renderBeforeActivation?h().createElement(r,{...t,model:e}):null});function _(e){return null}class E extends o.BusEventWithPayload{}E.type="scene-object-state-change";class C extends o.BusEventWithPayload{}C.type="scene-object-user-action";var R,O=e=>{throw TypeError(e)},T=(e,t,n)=>t.has(e)||O("Cannot "+n);class D{constructor(e){var t,n,r;t=this,(n=R).has(t)?O("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,r),((e,t,n)=>{T(e,t,"write to private field"),t.set(e,n)})(this,R,e)}resolve(){return T(e=this,t=R,"read from private field"),n?n.call(e):t.get(e);var e,t,n}}R=new WeakMap;class k{constructor(e){this._isActive=!1,this._activationHandlers=[],this._deactivationHandlers=new Map,this._subs=new f.Subscription,this._refCount=0,this._renderBeforeActivation=!1,e.key||(e.key=S()),this._events=new o.EventBusSrv,this._state=Object.freeze(e),this._setParent(this._state)}get state(){return this._state}get isActive(){return this._isActive}get renderBeforeActivation(){return this._renderBeforeActivation}get parent(){return this._parent}get variableDependency(){return this._variableDependency}get urlSync(){return this._urlSync}get Component(){return x}_setParent(e){P(e,e=>{e._parent&&e._parent!==this&&console.warn("SceneObject already has a parent set that is different from the new parent. You cannot share the same SceneObject instance in multiple scenes or in multiple different places of the same scene graph. Use SceneObject.clone() to duplicate a SceneObject or store a state key reference and use sceneGraph.findObject to locate it.",e,this),e._parent=this})}clearParent(){this._parent=void 0}subscribeToState(e){return this._events.subscribe(E,t=>{t.payload.changedObject===this&&e(t.payload.newState,t.payload.prevState)})}subscribeToEvent(e,t){return this._events.subscribe(e,t)}setState(e){const t=this._state,n={...this._state,...e};this._state=Object.freeze(n),this._setParent(e),this._handleActivationOfChangedStateProps(t,n),this.publishEvent(new E({prevState:t,newState:n,partialUpdate:e,changedObject:this}),!0)}_handleActivationOfChangedStateProps(e,t){this.isActive&&(e.$behaviors!==t.$behaviors&&this._handleChangedBehaviors(e.$behaviors,t.$behaviors),e.$data!==t.$data&&this._handleChangedStateActivation(e.$data,t.$data),e.$variables!==t.$variables&&this._handleChangedStateActivation(e.$variables,t.$variables),e.$timeRange!==t.$timeRange&&this._handleChangedStateActivation(e.$timeRange,t.$timeRange))}_handleChangedStateActivation(e,t){if(e){const t=this._deactivationHandlers.get(e);t&&(t(),this._deactivationHandlers.delete(e))}t&&this._deactivationHandlers.set(t,t.activate())}_handleChangedBehaviors(e,t){if(e)for(const n of e)if(!t||!t.includes(n)){const e=this._deactivationHandlers.get(n);e&&(e(),this._deactivationHandlers.delete(n))}if(t)for(const n of t)e&&e.includes(n)||this._activateBehavior(n)}publishEvent(e,t){this._events.publish(e),t&&this.parent&&this.parent.publishEvent(e,t)}getRoot(){return this._parent?this._parent.getRoot():this}_internalActivate(){this._isActive=!0;const{$data:e,$variables:t,$timeRange:n,$behaviors:r}=this.state;if(this._activationHandlers.forEach(e=>{const t=e();t&&this._deactivationHandlers.set(t,t)}),n&&!n.isActive&&this._deactivationHandlers.set(n,n.activate()),t&&!t.isActive&&this._deactivationHandlers.set(t,t.activate()),e&&!e.isActive&&this._deactivationHandlers.set(e,e.activate()),r)for(const e of r)this._activateBehavior(e)}_activateBehavior(e){if(e instanceof k)this._deactivationHandlers.set(e,e.activate());else if("function"==typeof e){const t=e(this);t&&this._deactivationHandlers.set(e,t)}}activate(){this.isActive||this._internalActivate(),this._refCount++;let e=!1;return()=>{if(this._refCount--,e){throw new Error("SceneObject cancelation handler returned by activate() called a second time")}e=!0,0===this._refCount&&this._internalDeactivate()}}_internalDeactivate(){this._isActive=!1;for(let e of this._deactivationHandlers.values())e();this._deactivationHandlers.clear(),this._events.removeAllListeners(),this._subs.unsubscribe(),this._subs=new f.Subscription}useState(){return A(this)}forceRender(){this.setState({})}clone(e){return function(e,t){const n=L(e.state,t);return new e.constructor(n)}(this,e)}addActivationHandler(e){this._activationHandlers.push(e)}forEachChild(e){P(this.state,e)}getRef(){return this._ref||(this._ref=new D(this)),this._ref}toJSON(){return{type:Object.getPrototypeOf(this).constructor.name,isActive:this.isActive,state:this.state}}}function A(e,t){var n;const[r,a]=(0,d.useState)(e.state),i=e.state,o=null!=(n=null==t?void 0:t.shouldActivateOrKeepAlive)&&n;return(0,d.useEffect)(()=>{let t;o&&(t=e.activate());const n=e.subscribeToState(e=>{a(e)});return e.state!==i&&a(e.state),()=>{n.unsubscribe(),t&&t()}},[e,o]),e.state}function P(e,t){for(const n of Object.values(e)){if(n instanceof k){if(!1===t(n))break}if(Array.isArray(n)){let e=!1;for(const r of n)if(r instanceof k){if(!1===t(r)){e=!0;break}}if(e)break}}}var I=n(3241);function L(e,t){const n={...e};Object.assign(n,t);for(const e in n){if(t&&void 0!==t[e])continue;const r=n[e];if(r instanceof D)console.warn("Cloning object with SceneObjectRef");else if(r instanceof k)n[e]=r.clone();else if(Array.isArray(r)){const t=[];for(const e of r)e instanceof k?t.push(e.clone()):"object"==typeof e?t.push((0,I.cloneDeep)(e)):t.push(e);n[e]=t}else n[e]="object"==typeof r?(0,I.cloneDeep)(r):r}return n}class M extends o.DataSourceApi{constructor(e,t){super({name:"RuntimeDataSource-"+e,uid:t,type:e,id:1,readOnly:!0,jsonData:{},access:"direct",meta:{id:e,name:"RuntimeDataSource-"+e,type:o.PluginType.datasource,info:{author:{name:""},description:"",links:[],logos:{large:"",small:""},screenshots:[],updated:"",version:""},module:"",baseUrl:""}})}testDatasource(){return Promise.resolve({})}}const V=new Map;function F({dataSource:e}){if(V.has(e.uid))throw new Error(`A runtime data source with uid ${e.uid} has already been registered`);V.set(e.uid,e)}function N(e,t){const n=t.state.$variables;if(!n)return t.parent?N(e,t.parent):null;const r=n.getByName(e);return r||(t.parent?N(e,t.parent):null)}function $(e,t,...n){let r=!1;"undefined"!=typeof window&&(r="true"===localStorage.getItem("grafana.debug.scenes"))}function j(e,t,n,...r){let a=!1;"undefined"!=typeof window&&(a="true"===localStorage.getItem("grafana.debug.scenes"))}var B,z,W=e=>{throw TypeError(e)},H=(e,t,n)=>t.has(e)||W("Cannot "+n),U=(e,t,n)=>(H(e,t,"read from private field"),n?n.call(e):t.get(e)),q=(e,t,n)=>t.has(e)?W("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);function G(e){return"isQueryController"in e}class Q extends k{constructor(e={},t){super({...e,isRunning:!1}),this.profiler=t,this.isQueryController=!0,q(this,B,new Set),q(this,z,null),this.runningQueriesCount=()=>U(this,B).size,t&&(this.profiler=t,t.setQueryController(this)),this.addActivationHandler(()=>{var e;return null==(e=this.profiler)||e.setQueryController(this),()=>U(this,B).clear()})}startProfile(e){var t;this.state.enableProfiling&&(null==(t=this.profiler)||t.startProfile(e))}cancelProfile(){var e;null==(e=this.profiler)||e.cancelProfile()}queryStarted(e){U(this,B).add(e),this.changeRunningQueryCount(1,e),this.state.isRunning||this.setState({isRunning:!0})}queryCompleted(e){U(this,B).has(e)&&(U(this,B).delete(e),this.changeRunningQueryCount(-1),0===U(this,B).size&&this.setState({isRunning:!1}))}changeRunningQueryCount(e,t){var n,r,a,i,o,s,l;window.__grafanaRunningQueryCount=(null!=(n=window.__grafanaRunningQueryCount)?n:0)+e,1===e&&this.state.enableProfiling&&(t&&(null==(r=this.profiler)||r.addCrumb(`${t.type}`)),(null==(a=this.profiler)?void 0:a.isTailRecording())&&($(),null==(i=this.profiler)||i.cancelTailRecording())),this.state.enableProfiling&&(U(this,z)&&cancelAnimationFrame(U(this,z)),o=this,s=z,l=requestAnimationFrame(()=>{var e;null==(e=this.profiler)||e.tryCompletingProfile()}),H(o,s,"write to private field"),s.set(o,l))}cancelAll(){var e;for(const t of U(this,B).values())null==(e=t.cancel)||e.call(t)}}function K(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(G(e))return e;t=t.parent}}B=new WeakMap,z=new WeakMap;var Y=n(1625);Y.ob.Auto;var X=(e=>(e.NotStarted="NotStarted",e.Loading="Loading",e.Streaming="Streaming",e.Done="Done",e.Error="Error",e))(X||{});class Z extends k{constructor(e){super({data:J,...e})}getResultsStream(){const e={origin:this,data:this.state.data};return(0,f.of)(e)}}const J={state:X.Done,series:[],timeRange:(0,o.getDefaultTimeRange)()};class ee{constructor(e,t){this._sceneObject=e,this._nextChangeShouldAddHistoryStep=!1,this._keys=t.keys}getKeys(){return"function"==typeof this._keys?this._keys():this._keys}getUrlState(){return this._sceneObject.getUrlState()}updateFromUrl(e){this._sceneObject.updateFromUrl(e)}shouldCreateHistoryStep(e){return this._nextChangeShouldAddHistoryStep}performBrowserHistoryAction(e){this._nextChangeShouldAddHistoryStep=!0,e(),this._nextChangeShouldAddHistoryStep=!1}}function te(e,t){let n,r=e;for(;r&&!n;)n=t(r),r=r.parent;return n}const ne=/^\d+[yYmMsSwWhHdD]$/;function re(e){if("string"!=typeof e)return null;if(-1!==e.indexOf("now"))return e;if(ne.test(e))return e;if(8===e.length){const t=(0,o.toUtc)(e,"YYYYMMDD");if(t.isValid())return t.toISOString()}else if(15===e.length){const t=(0,o.toUtc)(e,"YYYYMMDDTHHmmss");if(t.isValid())return t.toISOString()}else if(19===e.length){const t=(0,o.toUtc)(e,"YYYY-MM-DD HH:mm:ss");if(t.isValid())return t.toISOString()}else if(24===e.length){return(0,o.toUtc)(e).toISOString()}const t=parseInt(e,10);return isNaN(t)?null:(0,o.toUtc)(t).toISOString()}function ae(e,t,n,r,a,i){const s=a&&"now"===t,l=Date.now();i&&function(e){e!==ie&&(ie=e,(0,o.setWeekStart)(e))}(i);const u=(e,t)=>o.dateMath.toDateTime?o.dateMath.toDateTime(e,t):o.dateMath.parse(e,t.roundUp,t.timezone,t.fiscalYearStartMonth);return{to:u(s?"now-"+a:t,{roundUp:!0,timezone:n,fiscalYearStartMonth:r,now:l}),from:u(e,{roundUp:!1,timezone:n,fiscalYearStartMonth:r,now:l}),raw:{from:e,to:t}}}let ie;function oe(e,t,n){if((0,o.isDateTime)(e))return e.isValid();if(o.dateMath.isMathString(e))return o.dateMath.isValid(e);return(0,o.dateTimeParse)(e,{roundUp:t,timeZone:n}).isValid()}var se,le,ue,ce,de,pe=e=>{throw TypeError(e)},he=(e,t,n)=>t.has(e)||pe("Cannot "+n),fe=(e,t,n)=>(he(e,t,"read from private field"),n?n.call(e):t.get(e)),me=(e,t,n)=>t.has(e)?pe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ge=(e,t,n,r)=>(he(e,t,"write to private field"),t.set(e,n),n);class ve{constructor(){me(this,se,!1),me(this,le,null),me(this,ue,null),me(this,ce,0),me(this,de,null),this.measureFrames=()=>{if(!fe(this,se))return;const e=performance.now(),t=e-fe(this,ce);if(t>50){const n={duration:t,timestamp:e,method:"manual"};if(fe(this,le)&&fe(this,le).call(this,n),"undefined"!=typeof performance&&performance.mark&&performance.measure){const n=`long-frame-manual-${e.toFixed(0)}`,r=`${n}-start`,a=`${n}-end`,i=`Long Frame (Manual): ${t.toFixed(1)}ms`;try{performance.mark(r,{startTime:e-t}),performance.mark(a,{startTime:e}),performance.measure(i,r,a)}catch(e){performance.mark(i)}}$()}ge(this,ce,e),fe(this,se)&&ge(this,ue,requestAnimationFrame(this.measureFrames))}}isLoAFAvailable(){return"undefined"!=typeof PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")}start(e){fe(this,se)&&($(),this.stop()),ge(this,le,e),ge(this,se,!0),this.isLoAFAvailable()?this.startLoAFTracking():this.startManualFrameTracking(),$(0,this.isLoAFAvailable())}stop(){fe(this,se)&&(ge(this,se,!1),ge(this,le,null),this.stopLoAFTracking(),this.stopManualFrameTracking())}isTracking(){return fe(this,se)}startLoAFTracking(){if(!this.isLoAFAvailable())return $(),void this.startManualFrameTracking();try{ge(this,de,new PerformanceObserver(e=>{for(const t of e.getEntries()){const e={duration:t.duration,timestamp:t.startTime,method:"loaf"};if(fe(this,le)&&fe(this,le).call(this,e),"undefined"!=typeof performance&&performance.mark&&performance.measure){const e=`long-frame-${t.startTime.toFixed(0)}`,n=`${e}-start`,r=`${e}-end`,a=`Long Frame (LoAF): ${t.duration.toFixed(1)}ms`;try{performance.mark(n,{startTime:t.startTime}),performance.mark(r,{startTime:t.startTime+t.duration}),performance.measure(a,n,r)}catch(e){performance.mark(a)}}$(0,(t.duration,t.startTime))}})),fe(this,de).observe({type:"long-animation-frame",buffered:!1})}catch(e){$(0,0),this.startManualFrameTracking()}}stopLoAFTracking(){fe(this,de)&&(fe(this,de).disconnect(),ge(this,de,null),$())}startManualFrameTracking(){ge(this,ce,performance.now()),ge(this,ue,requestAnimationFrame(()=>this.measureFrames()))}stopManualFrameTracking(){fe(this,ue)&&(cancelAnimationFrame(fe(this,ue)),ge(this,ue,null),$())}}se=new WeakMap,le=new WeakMap,ue=new WeakMap,ce=new WeakMap,de=new WeakMap;var be,ye,we,Se,xe,_e,Ee,Ce,Re,Oe,Te=e=>{throw TypeError(e)},De=(e,t,n)=>t.has(e)||Te("Cannot "+n),ke=(e,t,n)=>(De(e,t,"read from private field"),n?n.call(e):t.get(e)),Ae=(e,t,n)=>t.has(e)?Te("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pe=(e,t,n,r)=>(De(e,t,"write to private field"),t.set(e,n),n);class Ie{constructor(e){this.queryController=e,Ae(this,be,null),Ae(this,ye,null),Ae(this,we,null),Ae(this,Se,null),Ae(this,xe,[]),Ae(this,_e),Ae(this,Ee,0),Ae(this,Ce,0),Ae(this,Re,null),Ae(this,Oe,null),this.measureTrailingFrames=(e,t,n)=>{var r,a,i,o;const s=performance.now(),l=s-t;if(l>1e3)return $(),void this.cancelProfile();if(ke(this,xe).push(l),s-e<2e3)ke(this,be)&&Pe(this,Se,requestAnimationFrame(()=>this.measureTrailingFrames(e,s,n)));else{const t=function(e){for(let t=e.length-1;t>=0;t--)if(e[t]>30)return e.slice(0,t+1);return[e[0]]}(ke(this,xe)),s=t.reduce((e,t)=>e+t,0);$(0,(s.toFixed(1),t.length)),$(0,null==(r=ke(this,be))||r.origin),$(0,0,null==(a=ke(this,be))||a.crumbs),Pe(this,xe,[]);const l=e-n;if("undefined"!=typeof performance&&performance.mark){const e=(null==(i=ke(this,be))?void 0:i.origin)||"unknown",n=l+s;performance.mark(`Dashboard Profile End: ${e}`);const r=`Dashboard Profile Start: ${e}`;try{performance.measure(`Dashboard Profile: ${e} (${n.toFixed(1)}ms)`,r,`Dashboard Profile End: ${e}`)}catch(t){performance.mark(`Dashboard Profile Complete: ${e} (${n.toFixed(1)}ms)`)}if(t.length>0){const e=`Slow Frames Summary: ${t.length} frames (${s.toFixed(1)}ms)`;performance.mark(e),t.forEach((e,n)=>{if(e>16)try{const r=ke(this,we)+l+(n>0?t.slice(0,n).reduce((e,t)=>e+t,0):0),a=`slow-frame-${n}`,i=`${a}-start`,o=`${a}-end`;performance.mark(i,{startTime:r}),performance.mark(o,{startTime:r+e}),performance.measure(`Slow Frame ${n+1}: ${e.toFixed(1)}ms`,i,o)}catch(t){performance.mark(`Slow Frame ${n+1}: ${e.toFixed(1)}ms`)}})}}const u=performance.now();$(),$(0,u.toFixed(1)),$(0,(l+s).toFixed(1)),$(0,t.length),$(0,(ke(this,Ce),ke(this,Ee))),ke(this,_e).stop(),j(0,u.toFixed(1)),Pe(this,Se,null);const c=n+l+s;if(!ke(this,be))return;performance.measure(`DashboardInteraction ${ke(this,be).origin}`,{start:n,end:c});const d=Le(n,c);(null==(o=this.queryController)?void 0:o.state.onProfileComplete)&&ke(this,be)&&(this.queryController.state.onProfileComplete({origin:ke(this,be).origin,crumbs:ke(this,be).crumbs,duration:l+s,networkDuration:d,startTs:n,endTs:c,longFramesCount:ke(this,Ee),longFramesTotalTime:ke(this,Ce),jsHeapSizeLimit:performance.memory?performance.memory.jsHeapSizeLimit:0,usedJSHeapSize:performance.memory?performance.memory.usedJSHeapSize:0,totalJSHeapSize:performance.memory?performance.memory.totalJSHeapSize:0}),Pe(this,be,null),Pe(this,Se,null)),window.__runs?window.__runs+=`${Date.now()}, ${l+s}\n`:window.__runs=`${Date.now()}, ${l+s}\n`}},Pe(this,_e,new ve),this.setupVisibilityChangeHandler(),Pe(this,ye,null)}setQueryController(e){this.queryController=e}setInteractionCompleteHandler(e){Pe(this,Oe,null!=e?e:null)}setupVisibilityChangeHandler(){ke(this,Re)||(Pe(this,Re,()=>{document.hidden&&ke(this,be)&&($(),this.cancelProfile())}),"undefined"!=typeof document&&document.addEventListener("visibilitychange",ke(this,Re)))}cleanup(){ke(this,Re)&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",ke(this,Re)),Pe(this,Re,null)),ke(this,_e).stop(),this.cancelProfile()}startProfile(e){document.hidden?$(0,0):ke(this,be)?ke(this,Se)?(this.cancelProfile(),this._startNewProfile(e,!0)):this.addCrumb(e):this._startNewProfile(e)}startInteraction(e){ke(this,ye)&&($(0,0,ke(this,ye)),Pe(this,ye,null)),Pe(this,ye,{interaction:e,startTs:performance.now()}),$(0,0)}stopInteraction(){if(!ke(this,ye))return;const e=performance.now(),t=e-ke(this,ye).startTs,n=Le(ke(this,ye).startTs,e);$(),$(0,t.toFixed(1)),$(0,n.toFixed(1)),$(0,ke(this,ye).startTs.toFixed(1)),$(0,e.toFixed(1)),ke(this,Oe)&&ke(this,be)&&ke(this,Oe).call(this,{origin:ke(this,ye).interaction,duration:t,networkDuration:n,startTs:ke(this,ye).startTs,endTs:e}),performance.mark(`${ke(this,ye).interaction}_start`,{startTime:ke(this,ye).startTs}),performance.mark(`${ke(this,ye).interaction}_end`,{startTime:e}),performance.measure(`Interaction_${ke(this,ye).interaction}`,`${ke(this,ye).interaction}_start`,`${ke(this,ye).interaction}_end`),Pe(this,ye,null)}getCurrentInteraction(){var e,t;return null!=(t=null==(e=ke(this,ye))?void 0:e.interaction)?t:null}_startNewProfile(e,t=!1){var n;if(Pe(this,be,{origin:e,crumbs:[]}),Pe(this,we,performance.now()),Pe(this,Ee,0),Pe(this,Ce,0),"undefined"!=typeof performance&&performance.mark){const t=`Dashboard Profile Start: ${e}`;performance.mark(t)}j(),$(0,null==(n=ke(this,be))||n.origin),$(0,ke(this,we).toFixed(1)),ke(this,_e).start(e=>{var t,n,r;ke(this,be)&&ke(this,we)&&(e.timestamp<ke(this,we)||((t=this,n=Ee,{set _(e){Pe(t,n,e)},get _(){return ke(t,n,r)}})._++,Pe(this,Ce,ke(this,Ce)+e.duration)))})}recordProfileTail(e,t){Pe(this,Se,requestAnimationFrame(()=>this.measureTrailingFrames(e,e,t)))}tryCompletingProfile(){var e;ke(this,be)&&($(0,0,ke(this,be)),0===(null==(e=this.queryController)?void 0:e.runningQueriesCount())&&ke(this,be)&&($(),this.recordProfileTail(performance.now(),ke(this,we))))}isTailRecording(){return Boolean(ke(this,Se))}cancelTailRecording(){ke(this,Se)&&(cancelAnimationFrame(ke(this,Se)),Pe(this,Se,null),$())}cancelProfile(){ke(this,be)&&($(0,0,ke(this,be)),Pe(this,be,null),ke(this,Se)&&(cancelAnimationFrame(ke(this,Se)),Pe(this,Se,null)),ke(this,_e).stop(),$(),Pe(this,xe,[]),Pe(this,Ee,0),Pe(this,Ce,0))}addCrumb(e){ke(this,be)&&($(0,0),ke(this,be).crumbs.push(e))}}function Le(e,t){const n=performance.getEntriesByType("resource");performance.clearResourceTimings();const r=n.filter(n=>n.startTime>=e&&n.startTime<=t&&n.responseEnd>=e&&n.responseEnd<=t);for(const e of r)performance.measure("Network entry "+e.name,{start:e.startTime,end:e.responseEnd});return function(e){if(0===e.length)return 0;e.sort((e,t)=>e.startTime-t.startTime);let t=0,n=e[0].startTime,r=e[0].responseEnd;for(let a=1;a<e.length;a++)e[a].startTime<=r?r=Math.max(r,e[a].responseEnd):(t+=r-n,n=e[a].startTime,r=e[a].responseEnd);return t+=r-n,t}(r)}be=new WeakMap,ye=new WeakMap,we=new WeakMap,Se=new WeakMap,xe=new WeakMap,_e=new WeakMap,Ee=new WeakMap,Ce=new WeakMap,Re=new WeakMap,Oe=new WeakMap;const Me="refresh",Ve="filter_removed",Fe="filter_changed",Ne="variable_value_changed",$e="groupby_dimensions";class je extends k{constructor(e={}){var t;const n=e.from&&oe(e.from)?e.from:"now-6h",r=e.to&&oe(e.to)?e.to:"now",a=Be(e.timeZone);super({from:n,to:r,timeZone:a,value:ae(n,r,a||(0,o.getTimeZone)(),e.fiscalYearStartMonth,e.UNSAFE_nowDelay,e.weekStart),refreshOnActivate:null!=(t=e.refreshOnActivate)?t:{percent:10},...e}),this._urlSync=new ee(this,{keys:["from","to","timezone","time","time.window"]}),this.onTimeRangeChange=e=>{const t={};if("string"==typeof e.raw.from?t.from=e.raw.from:t.from=e.raw.from.toISOString(),"string"==typeof e.raw.to?t.to=e.raw.to:t.to=e.raw.to.toISOString(),t.value=ae(t.from,t.to,this.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay,this.state.weekStart),t.from!==this.state.from||t.to!==this.state.to){const e=K(this);null==e||e.startProfile("time_range_change"),this._urlSync.performBrowserHistoryAction(()=>{this.setState(t)})}},this.onTimeZoneChange=e=>{this._urlSync.performBrowserHistoryAction(()=>{var t;const n=null!=(t=Be(e))?t:Y.vp,r=ae(this.state.from,this.state.to,n,this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay,this.state.weekStart);this.setState({timeZone:n,value:r})})},this.onRefresh=()=>{this.refreshRange(0),this.publishEvent(new s.RefreshEvent,!0)},this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){if(!this.state.timeZone){const e=this.getTimeZoneSource();e!==this&&this._subs.add(e.subscribeToState((e,t)=>{void 0!==e.timeZone&&e.timeZone!==t.timeZone&&this.refreshRange(0)}))}return o.rangeUtil.isRelativeTimeRange(this.state.value.raw)&&this.refreshIfStale(),()=>{this.state.weekStart&&(0,o.setWeekStart)(s.config.bootData.user.weekStart)}}refreshIfStale(){var e,t,n,r;let a;void 0!==(null==(t=null==(e=this.state)?void 0:e.refreshOnActivate)?void 0:t.percent)&&(a=this.calculatePercentOfInterval(this.state.refreshOnActivate.percent)),void 0!==(null==(r=null==(n=this.state)?void 0:n.refreshOnActivate)?void 0:r.afterMs)&&(a=Math.min(this.state.refreshOnActivate.afterMs,null!=a?a:1/0)),void 0!==a&&this.refreshRange(a)}getTimeZoneSource(){if(!this.parent||!this.parent.parent)return this;const e=te(this.parent.parent,e=>{if(e.state.$timeRange&&e.state.$timeRange.state.timeZone)return e.state.$timeRange});return e||this}refreshRange(e){var t;const n=ae(this.state.from,this.state.to,null!=(t=this.state.timeZone)?t:(0,o.getTimeZone)(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay,this.state.weekStart);n.to.diff(this.state.value.to,"milliseconds")>=e&&this.setState({value:n})}calculatePercentOfInterval(e){const t=this.state.value.to.diff(this.state.value.from,"milliseconds");return Math.ceil(t/100*e)}getTimeZone(){if(this.state.timeZone&&Be(this.state.timeZone))return this.state.timeZone;const e=this.getTimeZoneSource();return e!==this&&Be(e.state.timeZone)?e.state.timeZone:(0,o.getTimeZone)()}getUrlState(){const e=s.locationService.getSearchObject(),t={from:this.state.from,to:this.state.to,timezone:this.getTimeZone()};return e.time&&e["time.window"]&&(t.time=null,t["time.window"]=null),t}updateFromUrl(e){var t,n,r;const a={};let i=re(e.from),s=re(e.to);if(e.time&&e["time.window"]){const t=function(e,t){const n=isNaN(Date.parse(e))?parseInt(e,10):Date.parse(e);let r;r=t.match(/^\d+$/)&&parseInt(t,10)?parseInt(t,10):o.rangeUtil.intervalToMs(t);return{from:(0,o.toUtc)(n-r/2).toISOString(),to:(0,o.toUtc)(n+r/2).toISOString()}}(Array.isArray(e.time)?e.time[0]:e.time,Array.isArray(e["time.window"])?e["time.window"][0]:e["time.window"]);t.from&&oe(t.from)&&(i=t.from),t.to&&oe(t.to)&&(s=t.to)}if(i&&oe(i)&&(a.from=i),s&&oe(s)&&(a.to=s),"string"==typeof e.timezone&&(a.timeZone=""!==e.timezone?e.timezone:void 0),0!==Object.keys(a).length)return a.value=ae(null!=(t=a.from)?t:this.state.from,null!=(n=a.to)?n:this.state.to,null!=(r=a.timeZone)?r:this.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay,this.state.weekStart),this.setState(a)}}function Be(e){if(void 0!==e)return(0,I.isEmpty)(e)?s.config.bootData.user.timezone:e===Y.vp||(0,o.getZone)(e)?e:void $()}const ze=new Z,We=new je;const He=new class extends k{constructor(){super({variables:[]})}getByName(e){}isVariableLoadingOrWaitingToUpdate(e){return!1}};function Ue(e){var t;return null!=(t=te(e,e=>e.state.$timeRange))?t:We}class qe extends o.BusEventWithPayload{}function Ge(e){return"object"==typeof e&&"formatter"in e}qe.type="scene-variable-changed-value";let Qe,Ke={};function Ye(e){const t=Ke[e];return t||(Ke[e]=(0,I.property)(e))}class Xe{constructor(e,t){this.state={name:e,value:t,type:"scopedvar"}}getValue(e){let{value:t}=this.state,n=t.value;return n=e?Ye(e)(t.value):t.value,"string"===n||"number"===n||"boolean"===n?n:String(n)}getValueText(){const{value:e}=this.state;return null!=e.text?String(e.text):String(e)}}var Ze=n(5591);const Je=new o.Registry(()=>{const e=[{id:Y.$m.Lucene,name:"Lucene",description:"Values are lucene escaped and multi-valued variables generate an OR expression",formatter:e=>{if("string"==typeof e)return et(e);if(Array.isArray(e)){if(0===e.length)return"__empty__";return"("+(0,I.map)(e,e=>'"'+et(e)+'"').join(" OR ")+")"}return et(`${e}`)}},{id:Y.$m.Raw,name:"raw",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.keep-value-as-is","Keep value as is"),formatter:e=>String(e)},{id:Y.$m.Regex,name:"Regex",description:"Values are regex escaped and multi-valued variables generate a (<value>|<value>) expression",formatter:e=>{if("string"==typeof e)return(0,o.escapeRegex)(e);if(Array.isArray(e)){const t=e.map(e=>"string"==typeof e?(0,o.escapeRegex)(e):(0,o.escapeRegex)(String(e)));return 1===t.length?t[0]:"("+t.join("|")+")"}return(0,o.escapeRegex)(`${e}`)}},{id:Y.$m.Pipe,name:"Pipe",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.values-are-separated-by-character","Values are separated by | character"),formatter:e=>"string"==typeof e?e:Array.isArray(e)?e.join("|"):`${e}`},{id:Y.$m.Distributed,name:"Distributed",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.multiple-values-are-formatted-like-variablevalue","Multiple values are formatted like variable=value"),formatter:(e,t,n)=>"string"==typeof e?e:Array.isArray(e)?(e=(0,I.map)(e,(e,t)=>0!==t?n.state.name+"="+e:e),e.join(",")):`${e}`},{id:Y.$m.CSV,name:"Csv",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.commaseparated-values","Comma-separated values"),formatter:e=>"string"==typeof e?e:(0,I.isArray)(e)?e.join(","):String(e)},{id:Y.$m.HTML,name:"HTML",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.html-escaping-of-values","HTML escaping of values"),formatter:e=>"string"==typeof e?o.textUtil.escapeHtml(e):(0,I.isArray)(e)?o.textUtil.escapeHtml(e.join(", ")):o.textUtil.escapeHtml(String(e))},{id:Y.$m.JSON,name:"JSON",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.json-stringify-value","JSON stringify value"),formatter:e=>"string"==typeof e?e:JSON.stringify(e)},{id:Y.$m.PercentEncode,name:"Percent encode",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.useful-for-url-escaping-values","Useful for URL escaping values"),formatter:e=>(0,I.isArray)(e)?tt("{"+e.join(",")+"}"):tt(e)},{id:Y.$m.SingleQuote,name:"Single quote",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.single-quoted-values","Single quoted values"),formatter:e=>{const t=new RegExp("'","g");if((0,I.isArray)(e))return(0,I.map)(e,e=>`'${(0,I.replace)(e,t,"\\'")}'`).join(",");let n="string"==typeof e?e:String(e);return`'${(0,I.replace)(n,t,"\\'")}'`}},{id:Y.$m.DoubleQuote,name:"Double quote",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.double-quoted-values","Double quoted values"),formatter:e=>{const t=new RegExp('"',"g");if((0,I.isArray)(e))return(0,I.map)(e,e=>`"${(0,I.replace)(e,t,'\\"')}"`).join(",");let n="string"==typeof e?e:String(e);return`"${(0,I.replace)(n,t,'\\"')}"`}},{id:Y.$m.SQLString,name:"SQL string",description:"SQL string quoting and commas for use in IN statements and other scenarios",formatter:st},{id:"join",name:"Join",description:"Join values with a comma",formatter:(e,t)=>{var n;if((0,I.isArray)(e)){const r=null!=(n=t[0])?n:",";return e.join(r)}return String(e)}},{id:Y.$m.Date,name:"Date",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.format-date-in-different-ways","Format date in different ways"),formatter:(e,t)=>{var n;let r=NaN;if("number"==typeof e?r=e:"string"==typeof e&&(r=parseInt(e,10)),isNaN(r))return"NaN";const a=null!=(n=t[0])?n:"iso";switch(a){case"ms":return String(e);case"seconds":return`${Math.round(r/1e3)}`;case"iso":return(0,o.dateTime)(r).toISOString();default:return(t||[]).length>1?(0,o.dateTime)(r).format(t.join(":")):(0,o.dateTime)(r).format(a)}}},{id:Y.$m.Glob,name:"Glob",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.format-multivalued-variables-using-syntax-example","Format multi-valued variables using glob syntax, example {value1,value2}"),formatter:e=>(0,I.isArray)(e)&&e.length>1?"{"+e.join(",")+"}":String(e)},{id:Y.$m.Text,name:"Text",description:"Format variables in their text representation. Example in multi-variable scenario A + B + C.",formatter:(e,t,n)=>n.getValueText?n.getValueText():String(e)},{id:Y.$m.QueryParam,name:"Query parameter",description:"Format variables as URL parameters. Example in multi-variable scenario A + B + C => var-foo=A&var-foo=B&var-foo=C.",formatter:(e,t,n)=>{if(n.urlSync){const e=n.urlSync.getUrlState();return o.urlUtil.toUrlParams(e)}return Array.isArray(e)?e.map(e=>at(n.state.name,e)).join("&"):at(n.state.name,e)}},{id:"customqueryparam",name:"Custom query parameter",description:"Format variables as URL parameters with custom name and value prefix. Example in multi-variable scenario A + B + C => p-foo=x-A&p-foo=x-B&p-foo=x-C.",formatter:(e,t,n)=>{const r=tt(t[0]||n.state.name),a=tt(t[1]||"");return Array.isArray(e)?e.map(e=>it(r,e,a)).join("&"):it(r,e,a)}},{id:Y.$m.UriEncode,name:"Percent encode as URI",description:(0,Ze.t)("grafana-scenes.variables.format-registry.formats.description.useful-escaping-values-taking-syntax-characters","Useful for URL escaping values, taking into URI syntax characters"),formatter:e=>(0,I.isArray)(e)?nt("{"+e.join(",")+"}"):nt(e)}];return e});function et(e){return!1===isNaN(+e)?e:e.replace(/([\!\*\+\-\=<>\s\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g,"\\$1")}function tt(e){return"object"==typeof e&&(e=String(e)),rt(encodeURIComponent(e))}const nt=e=>rt(encodeURI(String(e))),rt=e=>e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase());function at(e,t){return`var-${e}=${tt(t)}`}function it(e,t,n=""){return`${e}=${n}${tt(t)}`}const ot={"'":"''",'"':'\\"'};function st(e){const t=new RegExp("'|\"","g");if((0,I.isArray)(e))return(0,I.map)(e,e=>`'${(0,I.replace)(e,t,e=>{var t;return null!=(t=ot[e])?t:""})}'`).join(",");let n="string"==typeof e?e:String(e);return`'${(0,I.replace)(n,t,e=>{var t;return null!=(t=ot[e])?t:""})}'`}const lt="All",ut="$__all",ct="$__auto",dt=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,pt="__searchFilter",ht="__scopes";class ft{constructor(e){this._value=e}formatter(){return this._value}}class mt{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=Ue(this._sceneObject);return"__from"===this.state.name?e.state.value.from.valueOf():e.state.value.to.valueOf()}getValueText(){const e=Ue(this._sceneObject);return"__from"===this.state.name?(0,o.dateTimeFormat)(e.state.value.from,{timeZone:e.getTimeZone()}):(0,o.dateTimeFormat)(e.state.value.to,{timeZone:e.getTimeZone()})}}class gt{constructor(e,t,n){this.state={name:e,type:"time_macro",match:n},this._sceneObject=t}getValue(){var e;const t=kl(this._sceneObject);if(t){const n=null==(e=t.state.data)?void 0:e.request;return n?"__interval_ms"===this.state.name?n.intervalMs:n.interval:this.state.match}return this.state.match}}function vt(e,t){e.setState(t)}function bt(){return s.useLocationService?(0,s.useLocationService)():s.locationService}function yt(e){let t=e;do{if("repeatSourceKey"in t.state&&t.state.repeatSourceKey)return!0;t=t.parent}while(t);return!1}class wt extends k{constructor(){super(...arguments),this._urlSync=new St(this)}validateAndUpdate(){return this.getValueOptions({}).pipe((0,f.map)(e=>(this.updateValueGivenNewOptions(e),{})))}onCancel(){this.setStateHelper({loading:!1});const e=this.parent;null==e||e.cancel(this)}updateValueGivenNewOptions(e){const{value:t,text:n,options:r}=this.state,a=this.getStateUpdateGivenNewOptions(e,t,n);this.interceptStateUpdateAfterValidation(a),this.setStateHelper(a),(a.value!==t||a.text!==n||this.hasAllValue()&&!(0,I.isEqual)(e,r))&&this.publishEvent(new qe(this),!0)}getStateUpdateGivenNewOptions(e,t,n){const r={options:e,loading:!1,value:t,text:n};if(0===e.length)return this.state.defaultToAll||this.state.includeAll?(r.value=ut,r.text=lt):this.state.isMulti?(r.value=[],r.text=[]):(r.value="",r.text=""),r;if(this.hasAllValue())return this.state.includeAll?r.text=lt:(r.value=e[0].value,r.text=e[0].label,this.state.isMulti&&(r.value=[r.value],r.text=[r.text])),r;if(this.state.isMulti){const a=(Array.isArray(t)?t:[t]).filter(t=>e.find(e=>e.value===t)),i=a.map(t=>e.find(e=>e.value===t).label);if(0===a.length){const t=this.getDefaultMultiState(e);r.value=t.value,r.text=t.text}else(0,I.isEqual)(a,t)||(r.value=a),(0,I.isEqual)(i,n)||(r.text=i);return r}let a=function(e,t,n){let r;for(const a of n){if(a.value===e)return a;a.label===t&&(r=a)}return r}(t,n,e);if(a)r.text=a.label,r.value=a.value;else{const t=this.getDefaultSingleState(e);r.value=t.value,r.text=t.text}return r}interceptStateUpdateAfterValidation(e){const t=e.value===ut&&this.state.text===lt;this.skipNextValidation&&e.value!==this.state.value&&e.text!==this.state.text&&!t&&(e.value=this.state.value,e.text=this.state.text),this.skipNextValidation=!1}getValue(e){let t=this.state.value;if(this.hasAllValue()){if(this.state.allValue)return new xt(this.state.allValue,this);t=this.state.options.map(e=>e.value)}if(null!=e&&Array.isArray(t)){const n=parseInt(e,10);if(!isNaN(n)&&n>=0&&n<t.length)return t[n]}return t}getValueText(){return this.hasAllValue()?lt:Array.isArray(this.state.text)?this.state.text.join(" + "):String(this.state.text)}hasAllValue(){const e=this.state.value;return e===ut||Array.isArray(e)&&e[0]===ut}getDefaultMultiState(e){return this.state.defaultToAll?{value:[ut],text:[lt]}:e.length>0?{value:[e[0].value],text:[e[0].label]}:{value:[],text:[]}}getDefaultSingleState(e){return this.state.defaultToAll?{value:ut,text:lt}:e.length>0?{value:e[0].value,text:e[0].label}:{value:"",text:""}}changeValueTo(e,t,n=!1){var r,a;if(e===this.state.value&&t===this.state.text)return;if(t||(t=Array.isArray(e)?e.map(e=>this.findLabelTextForValue(e)):this.findLabelTextForValue(e)),Array.isArray(e)){if(0===e.length){const n=this.getDefaultMultiState(this.state.options);e=n.value,t=n.text}e[e.length-1]===ut?(e=[ut],t=[lt]):e[0]===ut&&e.length>1&&(e.shift(),Array.isArray(t)&&t.shift())}if((0,I.isEqual)(e,this.state.value)&&(0,I.isEqual)(t,this.state.text))return;const i=()=>this.setStateHelper({value:e,text:t,loading:!1});if(n){const e=K(this);null==e||e.startProfile(Ne),null==(a=(r=this._urlSync).performBrowserHistoryAction)||a.call(r,i)}else i();this.publishEvent(new qe(this),!0)}findLabelTextForValue(e){if(e===ut)return lt;const t=this.state.options.find(t=>t.value===e);if(t)return t.label;const n=this.state.options.find(t=>t.label===e);return n?n.label:e}setStateHelper(e){vt(this,e)}getOptionsForSelect(e=!0){let t=this.state.options;if(this.state.includeAll&&(t=[{value:ut,label:lt},...t]),e&&!Array.isArray(this.state.value)){t.find(e=>e.value===this.state.value)||(t=[{value:this.state.value,label:String(this.state.text)},...t])}return t}refreshOptions(){this.getValueOptions({}).subscribe(e=>{this.updateValueGivenNewOptions(e)})}}class St{constructor(e){this._sceneObject=e,this._nextChangeShouldAddHistoryStep=!1}getKey(){return`var-${this._sceneObject.state.name}`}getKeys(){return this._sceneObject.state.skipUrlSync?[]:[this.getKey()]}getUrlState(){if(this._sceneObject.state.skipUrlSync)return{};let e=null,t=this._sceneObject.state.value;return e=Array.isArray(t)?t.map(String):this._sceneObject.state.isMulti?[String(t)]:String(t),{[this.getKey()]:e}}updateFromUrl(e){let t=e[this.getKey()];null!=t&&(this._sceneObject.state.includeAll&&(t=function(e){if((0,I.isArray)(e)&&e[0]===lt)return[ut];if(e===lt)return ut;return e}(t)),this._sceneObject.state.allValue&&this._sceneObject.state.allValue===t&&(t=ut),this._sceneObject.isActive||(this._sceneObject.skipNextValidation=!0),this._sceneObject.changeValueTo(t))}performBrowserHistoryAction(e){this._nextChangeShouldAddHistoryStep=!0,e(),this._nextChangeShouldAddHistoryStep=!1}shouldCreateHistoryStep(e){return this._nextChangeShouldAddHistoryStep}}class xt{constructor(e,t){this._value=e,this._variable=t}formatter(e){return e===Y.$m.Text?lt:e===Y.$m.PercentEncode?Je.get(Y.$m.PercentEncode).formatter(this._value,[],this._variable):e===Y.$m.QueryParam?Je.get(Y.$m.QueryParam).formatter(lt,[],this._variable):this._value}}function _t(e,t={}){if(e.state.$variables)for(const n of e.state.$variables.state.variables)n.state.skipUrlSync||t[n.state.name]||(t[n.state.name]=n);return e.parent&&_t(e.parent,t),t}const Et=(0,o.getDisplayProcessor)();class Ct{constructor(e){this._urlQueryParams=e}formatter(e){if(!e)return this._urlQueryParams;const t=e.split(":");if("exclude"===t[0]&&t.length>1){const e=new URLSearchParams(this._urlQueryParams);for(const n of t[1].split(","))e.delete(n);return`?${e}`}if("include"===t[0]&&t.length>1){const e=new URLSearchParams(this._urlQueryParams),n=t[1].split(",");for(const t of e.keys())n.includes(t)||e.delete(t);return`?${e}`}return this._urlQueryParams}}const Rt=new Map([[o.DataLinkBuiltInVars.includeVars,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){const e=_t(this._sceneObject),t=Je.get(Y.$m.QueryParam),n=[];for(const r of Object.keys(e)){const a=e[r];if(a instanceof wt&&a.hasAllValue()&&!a.state.allValue){n.push(t.formatter(ut,[],a));continue}const i=a.getValue();i&&(Ge(i)?n.push(i.formatter(Y.$m.QueryParam)):n.push(t.formatter(i,[],a)))}return new ft(n.join("&"))}getValueText(){return""}}],[o.DataLinkBuiltInVars.keepTime,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){var e;const t=null==(e=Ue(this._sceneObject).urlSync)?void 0:e.getUrlState();return"browser"===(null==t?void 0:t.timezone)&&(t.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone),new ft(o.urlUtil.toUrlParams(t))}getValueText(){return""}}],["__value",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__value"}}getValue(e){var t,n;const r=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!r)return this._match;const{frame:a,rowIndex:i,field:s,calculatedValue:l}=r.value;if(l)switch(e){case"numeric":case"raw":return l.numeric;case"time":return"";default:return(0,o.formattedValueToString)(l)}if(null==i)return this._match;if("time"===e){const e=a.fields.find(e=>e.type===o.FieldType.time);return e?e.values.get(i):void 0}if(!s)return this._match;const u=s.values.get(i);if("raw"===e)return u;const c=(null!=(n=s.display)?n:Et)(u);return"numeric"===e?c.numeric:(0,o.formattedValueToString)(c)}getValueText(){return""}}],["__data",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__data"}}getValue(e){var t,n;const r=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!r||!e)return this._match;const{frame:a,rowIndex:i}=r.value;if(void 0===i||void 0===e)return this._match;const s={name:a.name,refId:a.refId,fields:(0,o.getFieldDisplayValuesProxy)({frame:a,rowIndex:i})};return null!=(n=Ye(e)(s))?n:""}getValueText(){return""}}],["__series",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__series"}}getValue(e){var t;const n=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!n||!e)return this._match;if("name"!==e)return this._match;const{frame:r,frameIndex:a}=n.value;return(0,o.getFrameDisplayName)(r,a)}getValueText(){return""}}],["__field",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__field"}}getValue(e){var t,n;const r=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!r||!e)return this._match;if(void 0===e||""===e)return this._match;const{frame:a,field:i,data:s}=r.value,l=function(e,t,n){return new Proxy({},{get:(r,a)=>"name"===a?e.name:"displayName"===a?(0,o.getFieldDisplayName)(e,t,n):"labels"===a||"formattedLabels"===a?e.labels?{...e.labels,__values:Object.values(e.labels).sort().join(", "),toString:()=>(0,o.formatLabels)(e.labels,"",!0)}:"":void 0})}(i,a,s);return null!=(n=Ye(e)(l))?n:""}getValueText(){return""}}],["__url",class{constructor(e,t){this.state={name:e,type:"url_macro"}}getValue(e){var t;const n=s.locationService.getLocation(),r=null!=(t=s.config.appSubUrl)?t:"";switch(null!=e?e:""){case"params":return new Ct(n.search);case"path":return r+n.pathname;default:return r+n.pathname+n.search}}getValueText(){return""}}],["__from",mt],["__to",mt],["__timezone",class{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=Ue(this._sceneObject).getTimeZone();return"browser"===e?Intl.DateTimeFormat().resolvedOptions().timeZone:e}getValueText(){return this.getValue()}}],["__user",class{constructor(e,t){this.state={name:e,type:"user_macro"}}getValue(e){const t=s.config.bootData.user;switch(e){case"login":return t.login;case"email":return t.email;default:return String(t.id)}}getValueText(){return""}}],["__org",class{constructor(e,t){this.state={name:e,type:"org_macro"}}getValue(e){const t=s.config.bootData.user;return"name"===e?t.orgName:String(t.orgId)}getValueText(){return""}}],["__interval",gt],["__interval_ms",gt]]);function Ot(e,t,n,r,a){return t&&"string"==typeof t?(dt.lastIndex=0,t.replace(dt,(t,i,o,s,l,u,c)=>{const d=i||o||l,p=s||c||r,h=function(e,t,n,r){if(n&&n.hasOwnProperty(e)){const t=n[e];if(t)return function(e,t){return Qe?(Qe.state.name=e,Qe.state.value=t):Qe=new Xe(e,t),Qe}(e,t)}const a=N(e,r);if(a)return a;const i=Rt.get(e);if(i)return new i(e,r,t,n);return null}(d,t,n,e);if(!h)return a&&a.push({match:t,variableName:d,fieldPath:u,format:p,value:t,found:!1}),t;const f=function(e,t,n,r){if(null==n)return"";if(Ge(n))return Ot(e,n.formatter(r));Array.isArray(n)||"object"!=typeof n||(n=`${n}`);if("function"==typeof r)return r(n,{name:t.state.name,type:t.state.type,multi:t.state.isMulti,includeAll:t.state.includeAll});let a=[];r?(a=r.split(":"),a.length>1?(r=a[0],a=a.slice(1)):a=[]):r=Y.$m.Glob;let i=Je.getIfExists(r);i||(console.error(`Variable format ${r} not found. Using glob format as fallback.`),i=Je.get(Y.$m.Glob));return i.formatter(n,a,t)}(e,h,h.getValue(u),p);return a&&a.push({match:t,variableName:d,fieldPath:u,format:p,value:f,found:f!==t}),f})):null!=t?t:""}function Tt(e){return void 0!==e.useState}function Dt(e){return"enrichDataRequest"in e}function kt(e){return"enrichFiltersRequest"in e}function At(e){return"isDataLayer"in e}function Pt(e){return t=>{const n=Ml.getQueryController(e.origin);return n?new f.Observable(r=>{e.cancel||(e.cancel=()=>r.complete()),n.queryStarted(e);let a=!1;const i=t.subscribe({next:t=>{a||t.state===X.Loading||(a=!0,n.queryCompleted(e)),r.next(t)},error:e=>r.error(e),complete:()=>{r.complete()}});return()=>{i.unsubscribe(),a||n.queryCompleted(e)}}):t}}function It(e){return new f.Observable(t=>{t.next({state:X.Loading});(0,f.from)(e).pipe((0,f.map)(()=>({state:X.Done})),(0,f.catchError)(()=>(t.next({state:X.Error}),[]))).subscribe({next:e=>t.next(e),complete:()=>t.complete()})})}async function Lt(e,t){var n;if(null==e?void 0:e.uid){const t=V.get(e.uid);if(t)return t}if(e&&e.query)return e;const r=(0,s.getDataSourceSrv)().get(e,t);if(t.__sceneObject&&t.__sceneObject.value.valueOf()){const a=Ml.getQueryController(t.__sceneObject.value.valueOf());a&&a.state.enableProfiling&&It(r).pipe(Pt({type:`getDataSource/${null!=(n=null==e?void 0:e.type)?n:"unknown"}`,origin:t.__sceneObject.value.valueOf()})).subscribe(()=>{})}return await r}class Mt{constructor(){this._values=new Map}recordCurrentDependencyValuesForSceneObject(e){if(this.clearValues(),e.variableDependency)for(const t of e.variableDependency.getNames()){const n=Ml.lookupVariable(t,e);n&&this._values.set(n.state.name,n.getValue())}}cloneAndRecordCurrentValuesForSceneObject(e){const t=new Mt;return t.recordCurrentDependencyValuesForSceneObject(e),t}clearValues(){this._values.clear()}hasValues(){return!!this._values}recordCurrentValue(e){this._values.set(e.state.name,e.getValue())}hasRecordedValue(e){return this._values.has(e.state.name)}hasValueChanged(e){if(this._values.has(e.state.name)){if(!qs(this._values.get(e.state.name),e.getValue()))return!0}return!1}hasDependenciesChanged(e){if(!this._values)return!1;if(!e.variableDependency)return!1;for(const t of e.variableDependency.getNames()){const n=Ml.lookupVariable(t,e);if(!n)continue;const r=n.state.name;if(n&&this._values.has(r)){if(!qs(this._values.get(r),n.getValue()))return!0}}return!1}}function Vt(e){return"object"==typeof e&&"getExtraQueries"in e}const Ft=(e,t)=>(0,f.of)(t),Nt=0;function $t(e){const t=e.getRoot();return Dt(t)?t.enrichDataRequest(e):null}const jt=new Set;var Bt=n(2007),zt=n(8449);function Wt(e,t="latest"){return Ht(e,t.replace(/\-.*/,""))}function Ht(e,t){const n={};for(const[r,a]of Object.entries(e))Ut(a)?n[r]=Ht(a,t):(Gt(a,r),n[r]=qt(a,t));return n}function Ut(e){if("object"==typeof e){const[t]=Object.keys(e);return!(0,zt.valid)(t)}return!1}function qt(e,t){let n,r=Object.keys(e).sort(zt.compare);if("latest"===t)return e[r[r.length-1]];for(const e of r)(0,zt.gte)(t,e)&&(n=e);return n||(n=r[r.length-1]),e[n]}function Gt(e,t){if(!Object.keys(e).every(e=>(0,zt.valid)(e)))throw new Error(`Invalid semver version: '${t}'`)}const Qt="8.5.0",Kt={RadioButton:{container:{"10.2.3":"data-testid radio-button"}},Breadcrumbs:{breadcrumb:{"9.4.0":e=>`data-testid ${e} breadcrumb`}},CanvasGridAddActions:{addPanel:{"12.1.0":"data-testid CanvasGridAddActions add-panel"},groupPanels:{"12.1.0":"data-testid CanvasGridAddActions group-panels"},ungroup:{"12.1.0":"data-testid CanvasGridAddActions ungroup"},addRow:{"12.1.0":"data-testid CanvasGridAddActions add-row"},pasteRow:{"12.1.0":"data-testid CanvasGridAddActions paste-row"},addTab:{"12.1.0":"data-testid CanvasGridAddActions add-tab"},pasteTab:{"12.1.0":"data-testid CanvasGridAddActions paste-tab"}},DashboardEditPaneSplitter:{primaryBody:{"12.1.0":"data-testid DashboardEditPaneSplitter primary body"}},EditPaneHeader:{deleteButton:{"12.1.0":"data-testid EditPaneHeader delete panel"},copyDropdown:{"12.1.0":"data-testid EditPaneHeader copy dropdown"},copy:{"12.1.0":"data-testid EditPaneHeader copy"},duplicate:{"12.1.0":"data-testid EditPaneHeader duplicate"},backButton:{"12.1.0":"data-testid EditPaneHeader back"}},TimePicker:{openButton:{[Qt]:"data-testid TimePicker Open Button"},overlayContent:{"10.2.3":"data-testid TimePicker Overlay Content"},fromField:{"10.2.3":"data-testid Time Range from field",[Qt]:"Time Range from field"},toField:{"10.2.3":"data-testid Time Range to field",[Qt]:"Time Range to field"},applyTimeRange:{[Qt]:"data-testid TimePicker submit button"},copyTimeRange:{"10.4.0":"data-testid TimePicker copy button"},pasteTimeRange:{"10.4.0":"data-testid TimePicker paste button"},calendar:{label:{"10.2.3":"data-testid Time Range calendar",[Qt]:"Time Range calendar"},openButton:{"10.2.3":"data-testid Open time range calendar",[Qt]:"Open time range calendar"},closeButton:{"10.2.3":"data-testid Close time range Calendar",[Qt]:"Close time range Calendar"}},absoluteTimeRangeTitle:{[Qt]:"data-testid-absolute-time-range-narrow"}},DataSourcePermissions:{form:{"9.5.0":()=>'form[name="addPermission"]'},roleType:{"9.5.0":"Role to add new permission to"},rolePicker:{"9.5.0":"Built-in role picker"},permissionLevel:{"12.0.0":"Permission level","9.5.0":"Permission Level"}},DateTimePicker:{input:{"10.2.3":"data-testid date-time-input"}},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:{[Qt]:"Test Data Query scenario select container"},scenarioSelect:{[Qt]:"Test Data Query scenario select"},max:{[Qt]:"TestData max"},min:{[Qt]:"TestData min"},noise:{[Qt]:"TestData noise"},seriesCount:{[Qt]:"TestData series count"},spread:{[Qt]:"TestData spread"},startValue:{[Qt]:"TestData start value"},drop:{[Qt]:"TestData drop values"}}},DataSourceHttpSettings:{urlInput:{"10.4.0":"data-testid Datasource HTTP settings url",[Qt]:"Datasource HTTP settings url"}},Jaeger:{traceIDInput:{[Qt]:"Trace ID"}},Prometheus:{configPage:{connectionSettings:{[Qt]:"Data source connection URL"},manageAlerts:{"10.4.0":"prometheus-alerts-manager"},allowAsRecordingRulesTarget:{"12.1.0":"prometheus-recording-rules-target"},scrapeInterval:{"10.4.0":"data-testid scrape interval"},queryTimeout:{"10.4.0":"data-testid query timeout"},defaultEditor:{"10.4.0":"data-testid default editor"},disableMetricLookup:{"10.4.0":"disable-metric-lookup"},prometheusType:{"10.4.0":"data-testid prometheus type"},prometheusVersion:{"10.4.0":"data-testid prometheus version"},cacheLevel:{"10.4.0":"data-testid cache level"},incrementalQuerying:{"10.4.0":"prometheus-incremental-querying"},queryOverlapWindow:{"10.4.0":"data-testid query overlap window"},disableRecordingRules:{"10.4.0":"disable-recording-rules"},customQueryParameters:{"10.4.0":"data-testid custom query parameters"},httpMethod:{"10.4.0":"data-testid http method"},exemplarsAddButton:{"10.3.0":"data-testid Add exemplar config button",[Qt]:"Add exemplar config button"},internalLinkSwitch:{"10.3.0":"data-testid Internal link switch",[Qt]:"Internal link switch"},codeModeMetricNamesSuggestionLimit:{"11.1.0":"data-testid code mode metric names suggestion limit"},seriesLimit:{"12.0.2":"data-testid maximum series limit"}},queryEditor:{explain:{"10.4.0":"data-testid prometheus explain switch wrapper"},editorToggle:{"10.4.0":"data-testid QueryEditorModeToggle"},options:{"10.4.0":"data-testid prometheus options"},legend:{"10.4.0":"data-testid prometheus legend wrapper"},format:{"10.4.0":"data-testid prometheus format"},step:{"10.4.0":"data-testid prometheus-step"},type:{"10.4.0":"data-testid prometheus type"},exemplars:{"10.4.0":"data-testid prometheus-exemplars"},builder:{metricSelect:{"10.4.0":"data-testid metric select"},hints:{"10.4.0":"data-testid prometheus hints"},metricsExplorer:{"10.4.0":"data-testid metrics explorer"},queryAdvisor:{"10.4.0":"data-testid query advisor"}},code:{queryField:{"10.4.0":"data-testid prometheus query field"},metricsCountInfo:{"11.1.0":"data-testid metrics count disclaimer"},metricsBrowser:{openButton:{"10.4.0":"data-testid open metrics browser"},selectMetric:{"10.4.0":"data-testid select a metric"},seriesLimit:{"10.3.1":"data-testid series limit"},metricList:{"10.4.0":"data-testid metric list"},labelNamesFilter:{"10.4.0":"data-testid label names filter"},labelValuesFilter:{"10.4.0":"data-testid label values filter"},useQuery:{"10.4.0":"data-testid use query"},useAsRateQuery:{"10.4.0":"data-testid use as rate query"},validateSelector:{"10.4.0":"data-testid validate selector"},clear:{"10.4.0":"data-testid clear"}}}},exemplarMarker:{"10.3.0":"data-testid Exemplar marker",[Qt]:"Exemplar marker"},variableQueryEditor:{queryType:{"10.4.0":"data-testid query type"},labelnames:{metricRegex:{"10.4.0":"data-testid label names metric regex"}},labelValues:{labelSelect:{"10.4.0":"data-testid label values label select"}},metricNames:{metricRegex:{"10.4.0":"data-testid metric names metric regex"}},varQueryResult:{"10.4.0":"data-testid variable query result"},seriesQuery:{"10.4.0":"data-testid prometheus series query"},classicQuery:{"10.4.0":"data-testid prometheus classic query"}},annotations:{minStep:{"10.4.0":"data-testid prometheus-annotation-min-step"},title:{"10.4.0":"data-testid prometheus annotation title"},tags:{"10.4.0":"data-testid prometheus annotation tags"},text:{"10.4.0":"data-testid prometheus annotation text"},seriesValueAsTimestamp:{"10.4.0":"data-testid prometheus annotation series value as timestamp"}}}},Menu:{MenuComponent:{[Qt]:e=>`${e} menu`},MenuGroup:{[Qt]:e=>`${e} menu group`},MenuItem:{[Qt]:e=>`${e} menu item`},SubMenu:{container:{"10.3.0":"data-testid SubMenu container",[Qt]:"SubMenu container"},icon:{"10.3.0":"data-testid SubMenu icon",[Qt]:"SubMenu icon"}}},Panels:{Panel:{title:{[Qt]:e=>`data-testid Panel header ${e}`},content:{"11.1.0":"data-testid panel content"},headerContainer:{"9.5.0":"data-testid header-container"},headerItems:{"10.2.0":e=>`data-testid Panel header item ${e}`},menuItems:{"9.5.0":e=>`data-testid Panel menu item ${e}`},menu:{"9.5.0":e=>`data-testid Panel menu ${e}`},containerByTitle:{[Qt]:e=>`${e} panel`},headerCornerInfo:{[Qt]:e=>`Panel header ${e}`},status:{"10.2.0":e=>`data-testid Panel status ${e}`,[Qt]:e=>"Panel status"},loadingBar:{"10.0.0":()=>"Panel loading bar"},HoverWidget:{container:{"10.1.0":"data-testid hover-header-container",[Qt]:"hover-header-container"},dragIcon:{"10.0.0":"data-testid drag-icon"}},PanelDataErrorMessage:{"10.4.0":"data-testid Panel data error message"}},Visualization:{Graph:{container:{"9.5.0":"Graph container"},VisualizationTab:{legendSection:{[Qt]:"Legend section"}},Legend:{legendItemAlias:{[Qt]:e=>`gpl alias ${e}`},showLegendSwitch:{[Qt]:"gpl show legend"}},xAxis:{labels:{[Qt]:()=>"div.flot-x-axis > div.flot-tick-label"}}},BarGauge:{valueV2:{[Qt]:"data-testid Bar gauge value"}},PieChart:{svgSlice:{"10.3.0":"data testid Pie Chart Slice"}},Text:{container:{[Qt]:()=>".markdown-html"}},Table:{header:{[Qt]:"table header"},footer:{[Qt]:"table-footer"},body:{"10.2.0":"data-testid table body"}},TableNG:{Filters:{HeaderButton:{"12.1.0":"data-testid tableng header filter"},Container:{"12.1.0":"data-testid tablenf filter container"},SelectAll:{"12.1.0":"data-testid tableng filter select-all"}},Tooltip:{Wrapper:{"12.2.0":"data-testid tableng tooltip wrapper"},Caret:{"12.2.0":"data-testid tableng tooltip caret"}},Footer:{ReducerLabel:{"12.2.0":"data-testid tableng footer reducer-label"},Value:{"12.2.0":"data-testid tableng footer value"}}}}},VizLegend:{seriesName:{"10.3.0":e=>`data-testid VizLegend series ${e}`}},Drawer:{General:{title:{[Qt]:e=>`Drawer title ${e}`},expand:{[Qt]:"Drawer expand"},contract:{[Qt]:"Drawer contract"},close:{"10.3.0":"data-testid Drawer close",[Qt]:"Drawer close"},rcContentWrapper:{"9.4.0":()=>".rc-drawer-content-wrapper"},subtitle:{"10.4.0":"data-testid drawer subtitle"}},DashboardSaveDrawer:{saveButton:{"11.1.0":"data-testid Save dashboard drawer button"},saveAsButton:{"11.1.0":"data-testid Save as dashboard drawer button"},saveAsTitleInput:{"11.1.0":"Save dashboard title field"}}},PanelEditor:{General:{content:{"11.1.0":"data-testid Panel editor content","8.0.0":"Panel editor content"}},OptionsPane:{content:{"11.1.0":"data-testid Panel editor option pane content",[Qt]:"Panel editor option pane content"},select:{[Qt]:"Panel editor option pane select"},fieldLabel:{[Qt]:e=>`${e} field property editor`},fieldInput:{"11.0.0":e=>`data-testid Panel editor option pane field input ${e}`}},DataPane:{content:{"11.1.0":"data-testid Panel editor data pane content",[Qt]:"Panel editor data pane content"}},applyButton:{"9.2.0":"data-testid Apply changes and go back to dashboard","9.1.0":"Apply changes and go back to dashboard","8.0.0":"panel editor apply"},toggleVizPicker:{"10.0.0":"data-testid toggle-viz-picker","8.0.0":"toggle-viz-picker"},toggleVizOptions:{"10.1.0":"data-testid toggle-viz-options",[Qt]:"toggle-viz-options"},toggleTableView:{"11.1.0":"data-testid toggle-table-view",[Qt]:"toggle-table-view"},showZoomField:{"10.2.0":"Map controls Show zoom control field property editor"},showAttributionField:{"10.2.0":"Map controls Show attribution field property editor"},showScaleField:{"10.2.0":"Map controls Show scale field property editor"},showMeasureField:{"10.2.0":"Map controls Show measure tools field property editor"},showDebugField:{"10.2.0":"Map controls Show debug field property editor"},measureButton:{"12.1.0":"data-testid panel-editor-measure-button","9.2.0":"show measure tools"},Outline:{section:{"12.0.0":"data-testid Outline section"},node:{"12.0.0":e=>`data-testid outline node ${e}`},item:{"12.0.0":e=>`data-testid outline item ${e}`}},ElementEditPane:{variableType:{"12.0.0":e=>`data-testid variable type ${e}`},addVariableButton:{"12.0.0":"data-testid add variable button"},variableNameInput:{"12.0.0":"data-testid variable name input"},variableLabelInput:{"12.0.0":"data-testid variable label input"},AutoGridLayout:{minColumnWidth:{"12.1.0":"data-testid min column width selector"},customMinColumnWidth:{"12.1.0":"data-testid custom min column width input"},clearCustomMinColumnWidth:{"12.1.0":"data-testid clear custom min column width input"},maxColumns:{"12.1.0":"data-testid max columns selector"},rowHeight:{"12.1.0":"data-testid row height selector"},customRowHeight:{"12.1.0":"data-testid custom row height input"},clearCustomRowHeight:{"12.1.0":"data-testid clear custom row height input"},fillScreen:{"12.1.0":"data-testid fill screen switch"}}}},PanelInspector:{Data:{content:{[Qt]:"Panel inspector Data content"}},Stats:{content:{[Qt]:"Panel inspector Stats content"}},Json:{content:{"11.1.0":"data-testid Panel inspector Json content",[Qt]:"Panel inspector Json content"}},Query:{content:{[Qt]:"Panel inspector Query content"},refreshButton:{[Qt]:"Panel inspector Query refresh button"},jsonObjectKeys:{[Qt]:()=>".json-formatter-key"}}},Tab:{title:{"11.2.0":e=>`data-testid Tab ${e}`},active:{[Qt]:()=>'[class*="-activeTabStyle"]'}},RefreshPicker:{runButtonV2:{[Qt]:"data-testid RefreshPicker run button"},intervalButtonV2:{[Qt]:"data-testid RefreshPicker interval button"}},QueryTab:{content:{[Qt]:"Query editor tab content"},queryInspectorButton:{[Qt]:"Query inspector button"},queryHistoryButton:{"10.2.0":"data-testid query-history-button",[Qt]:"query-history-button"},addQuery:{"10.2.0":"data-testid query-tab-add-query",[Qt]:"Query editor add query button"},addQueryFromLibrary:{"11.5.0":"data-testid query-tab-add-query-from-library"},queryGroupTopSection:{"11.2.0":"data-testid query group top section"},addExpression:{"11.2.0":"data-testid query-tab-add-expression"}},QueryHistory:{queryText:{"9.0.0":"Query text"}},QueryEditorRows:{rows:{[Qt]:"Query editor row"}},QueryEditorRow:{actionButton:{"10.4.0":e=>`data-testid ${e}`},title:{[Qt]:e=>`Query editor row title ${e}`},container:{[Qt]:e=>`Query editor row ${e}`}},AlertTab:{content:{"10.2.3":"data-testid Alert editor tab content",[Qt]:"Alert editor tab content"}},AlertRules:{groupToggle:{"11.0.0":"data-testid group-collapse-toggle"},toggle:{"11.0.0":"data-testid collapse-toggle"},expandedContent:{"11.0.0":"data-testid expanded-content"},previewButton:{"11.1.0":"data-testid alert-rule preview-button"},ruleNameField:{"11.1.0":"data-testid alert-rule name-field"},newFolderButton:{"11.1.0":"data-testid alert-rule new-folder-button"},newFolderNameField:{"11.1.0":"data-testid alert-rule name-folder-name-field"},newFolderNameCreateButton:{"11.1.0":"data-testid alert-rule name-folder-name-create-button"},newEvaluationGroupButton:{"11.1.0":"data-testid alert-rule new-evaluation-group-button"},newEvaluationGroupName:{"11.1.0":"data-testid alert-rule new-evaluation-group-name"},newEvaluationGroupInterval:{"11.1.0":"data-testid alert-rule new-evaluation-group-interval"},newEvaluationGroupCreate:{"11.1.0":"data-testid alert-rule new-evaluation-group-create-button"},step:{"11.5.0":e=>`data-testid alert-rule step-${e}`},stepAdvancedModeSwitch:{"11.5.0":e=>`data-testid advanced-mode-switch step-${e}`}},Alert:{alertV2:{[Qt]:e=>`data-testid Alert ${e}`}},TransformTab:{content:{"10.1.0":"data-testid Transform editor tab content",[Qt]:"Transform editor tab content"},newTransform:{"10.1.0":e=>`data-testid New transform ${e}`},transformationEditor:{"10.1.0":e=>`data-testid Transformation editor ${e}`},transformationEditorDebugger:{"10.1.0":e=>`data-testid Transformation editor debugger ${e}`}},Transforms:{card:{"10.1.0":e=>`data-testid New transform ${e}`},disableTransformationButton:{"10.4.0":"data-testid Disable transformation button"},Reduce:{modeLabel:{"10.2.3":"data-testid Transform mode label",[Qt]:"Transform mode label"},calculationsLabel:{"10.2.3":"data-testid Transform calculations label",[Qt]:"Transform calculations label"}},SpatialOperations:{actionLabel:{"9.1.2":"root Action field property editor"},locationLabel:{"10.2.0":"root Location Mode field property editor"},location:{autoOption:{"9.1.2":"Auto location option"},coords:{option:{"9.1.2":"Coords location option"},latitudeFieldLabel:{"9.1.2":"root Latitude field field property editor"},longitudeFieldLabel:{"9.1.2":"root Longitude field field property editor"}},geohash:{option:{"9.1.2":"Geohash location option"},geohashFieldLabel:{"9.1.2":"root Geohash field field property editor"}},lookup:{option:{"9.1.2":"Lookup location option"},lookupFieldLabel:{"9.1.2":"root Lookup field field property editor"},gazetteerFieldLabel:{"9.1.2":"root Gazetteer field property editor"}}}},searchInput:{"10.2.3":"data-testid search transformations",[Qt]:"search transformations"},noTransformationsMessage:{"10.2.3":"data-testid no transformations message"},addTransformationButton:{"10.1.0":"data-testid add transformation button",[Qt]:"add transformation button"},removeAllTransformationsButton:{"10.4.0":"data-testid remove all transformations button"}},NavBar:{Configuration:{button:{"9.5.0":"Configuration"}},Toggle:{button:{"10.2.3":"data-testid Toggle menu",[Qt]:"Toggle menu"}},Reporting:{button:{"9.5.0":"Reporting"}}},NavMenu:{Menu:{"10.2.3":"data-testid navigation mega-menu"},item:{"9.5.0":"data-testid Nav menu item"}},NavToolbar:{container:{"9.4.0":"data-testid Nav toolbar"},commandPaletteTrigger:{"11.5.0":"data-testid Command palette trigger"},shareDashboard:{"11.1.0":"data-testid Share dashboard"},markAsFavorite:{"11.1.0":"data-testid Mark as favorite"},editDashboard:{editButton:{"11.1.0":"data-testid Edit dashboard button"},saveButton:{"11.1.0":"data-testid Save dashboard button"},exitButton:{"11.1.0":"data-testid Exit edit mode button"},settingsButton:{"11.1.0":"data-testid Dashboard settings"},addRowButton:{"11.1.0":"data-testid Add row button"},addLibraryPanelButton:{"11.1.0":"data-testid Add a panel from the panel library button"},addVisualizationButton:{"11.1.0":"data-testid Add new visualization menu item"},pastePanelButton:{"11.1.0":"data-testid Paste panel button"},discardChangesButton:{"11.1.0":"data-testid Discard changes button"},discardLibraryPanelButton:{"11.1.0":"data-testid Discard library panel button"},unlinkLibraryPanelButton:{"11.1.0":"data-testid Unlink library panel button"},saveLibraryPanelButton:{"11.1.0":"data-testid Save library panel button"},backToDashboardButton:{"11.1.0":"data-testid Back to dashboard button"}}},PageToolbar:{container:{[Qt]:()=>".page-toolbar"},item:{[Qt]:e=>`${e}`},itemButton:{"9.5.0":e=>`data-testid ${e}`}},QueryEditorToolbarItem:{button:{[Qt]:e=>`QueryEditor toolbar item button ${e}`}},BackButton:{backArrow:{"10.3.0":"data-testid Go Back",[Qt]:"Go Back"}},OptionsGroup:{group:{"11.1.0":e=>e?`data-testid Options group ${e}`:"data-testid Options group",[Qt]:e=>e?`Options group ${e}`:"Options group"},toggle:{"11.1.0":e=>e?`data-testid Options group ${e} toggle`:"data-testid Options group toggle",[Qt]:e=>e?`Options group ${e} toggle`:"Options group toggle"}},PluginVisualization:{item:{[Qt]:e=>`Plugin visualization item ${e}`},current:{[Qt]:()=>'[class*="-currentVisualizationItem"]'}},Select:{menu:{"11.5.0":"data-testid Select menu",[Qt]:"Select options menu"},option:{"11.1.0":"data-testid Select option",[Qt]:"Select option"},toggleAllOptions:{"11.3.0":"data-testid toggle all options"},input:{[Qt]:()=>'input[id*="time-options-input"]'},singleValue:{[Qt]:()=>'div[class*="-singleValue"]'}},FieldConfigEditor:{content:{[Qt]:"Field config editor content"}},OverridesConfigEditor:{content:{[Qt]:"Field overrides editor content"}},FolderPicker:{containerV2:{[Qt]:"data-testid Folder picker select container"},input:{"10.4.0":"data-testid folder-picker-input"}},ReadonlyFolderPicker:{container:{[Qt]:"data-testid Readonly folder picker select container"}},DataSourcePicker:{container:{"10.0.0":"data-testid Data source picker select container","8.0.0":"Data source picker select container"},inputV2:{"10.1.0":"data-testid Select a data source",[Qt]:"Select a data source"},dataSourceList:{"10.4.0":"data-testid Data source list dropdown"},advancedModal:{dataSourceList:{"10.4.0":"data-testid Data source list"},builtInDataSourceList:{"10.4.0":"data-testid Built in data source list"}}},TimeZonePicker:{containerV2:{[Qt]:"data-testid Time zone picker select container"},changeTimeSettingsButton:{"11.0.0":"data-testid Time zone picker Change time settings button"}},WeekStartPicker:{containerV2:{[Qt]:"data-testid Choose starting day of the week"},placeholder:{[Qt]:"Choose starting day of the week"}},TraceViewer:{spanBar:{"9.0.0":"data-testid SpanBar--wrapper"}},QueryField:{container:{"10.3.0":"data-testid Query field",[Qt]:"Query field"}},QueryBuilder:{queryPatterns:{"10.3.0":"data-testid Query patterns",[Qt]:"Query patterns"},labelSelect:{"10.3.0":"data-testid Select label",[Qt]:"Select label"},inputSelect:{"11.1.0":"data-testid Select label-input"},valueSelect:{"10.3.0":"data-testid Select value",[Qt]:"Select value"},matchOperatorSelect:{"10.3.0":"data-testid Select match operator",[Qt]:"Select match operator"}},ValuePicker:{button:{"10.3.0":e=>`data-testid Value picker button ${e}`},select:{"10.3.0":e=>`data-testid Value picker select ${e}`}},Search:{sectionV2:{[Qt]:"data-testid Search section"},itemsV2:{[Qt]:"data-testid Search items"},cards:{[Qt]:"data-testid Search cards"},collapseFolder:{[Qt]:e=>`data-testid Collapse folder ${e}`},expandFolder:{[Qt]:e=>`data-testid Expand folder ${e}`},dashboardItem:{[Qt]:e=>`data-testid Dashboard search item ${e}`},dashboardCard:{[Qt]:e=>`data-testid Search card ${e}`},folderHeader:{"9.3.0":e=>`data-testid Folder header ${e}`},folderContent:{"9.3.0":e=>`data-testid Folder content ${e}`},dashboardItems:{[Qt]:"data-testid Dashboard search item"}},DashboardLinks:{container:{[Qt]:"data-testid Dashboard link container"},dropDown:{[Qt]:"data-testid Dashboard link dropdown"},link:{[Qt]:"data-testid Dashboard link"}},LoadingIndicator:{icon:{"10.4.0":"data-testid Loading indicator",[Qt]:"Loading indicator"}},CallToActionCard:{buttonV2:{[Qt]:e=>`data-testid Call to action button ${e}`}},DataLinksContextMenu:{singleLink:{"10.3.0":"data-testid Data link",[Qt]:"Data link"}},DataLinksActionsTooltip:{tooltipWrapper:{"12.1.0":"data-testid Data links actions tooltip wrapper"}},CodeEditor:{container:{"10.2.3":"data-testid Code editor container",[Qt]:"Code editor container"}},ReactMonacoEditor:{editorLazy:{"11.1.0":"data-testid ReactMonacoEditor editorLazy"}},DashboardImportPage:{textarea:{[Qt]:"data-testid-import-dashboard-textarea"},submit:{[Qt]:"data-testid-load-dashboard"}},ImportDashboardForm:{name:{[Qt]:"data-testid-import-dashboard-title"},submit:{[Qt]:"data-testid-import-dashboard-submit"}},PanelAlertTabContent:{content:{"10.2.3":"data-testid Unified alert editor tab content",[Qt]:"Unified alert editor tab content"}},VisualizationPreview:{card:{[Qt]:e=>`data-testid suggestion-${e}`}},ColorSwatch:{name:{[Qt]:"data-testid-colorswatch"}},DashboardRow:{title:{[Qt]:e=>`data-testid dashboard-row-title-${e}`},wrapper:{"12.1.0":e=>`data-testid dashboard-row-wrapper-for-${e}`}},UserProfile:{profileSaveButton:{[Qt]:"data-testid-user-profile-save"},preferencesSaveButton:{[Qt]:"data-testid-shared-prefs-save"},orgsTable:{[Qt]:"data-testid-user-orgs-table"},sessionsTable:{[Qt]:"data-testid-user-sessions-table"},extensionPointTabs:{"10.2.3":"data-testid-extension-point-tabs"},extensionPointTab:{"10.2.3":e=>`data-testid-extension-point-tab-${e}`}},FileUpload:{inputField:{"9.0.0":"data-testid-file-upload-input-field"},fileNameSpan:{"9.0.0":"data-testid-file-upload-file-name"}},DebugOverlay:{wrapper:{"9.2.0":"debug-overlay"}},OrgRolePicker:{input:{"9.5.0":"Role"}},AnalyticsToolbarButton:{button:{"9.5.0":"Dashboard insights"}},Variables:{variableOption:{"9.5.0":"data-testid variable-option"},variableLinkWrapper:{"11.1.1":"data-testid variable-link-wrapper"}},Annotations:{annotationsTypeInput:{"11.1.0":"data-testid annotations-type-input",[Qt]:"annotations-type-input"},annotationsChoosePanelInput:{"11.1.0":"data-testid choose-panels-input",[Qt]:"choose-panels-input"},editor:{testButton:{"11.0.0":"data-testid annotations-test-button"},resultContainer:{"11.0.0":"data-testid annotations-query-result-container"}}},Tooltip:{container:{"10.2.0":"data-testid tooltip"}},ReturnToPrevious:{buttonGroup:{"11.0.0":"data-testid dismissable button group"},backButton:{"11.0.0":"data-testid back"},dismissButton:{"11.0.0":"data-testid dismiss"}},SQLQueryEditor:{selectColumn:{"11.0.0":"data-testid select-column"},selectColumnInput:{"11.0.0":"data-testid select-column-input"},selectFunctionParameter:{"11.0.0":e=>`data-testid select-function-parameter-${e}`},selectAggregation:{"11.0.0":"data-testid select-aggregation"},selectAggregationInput:{"11.0.0":"data-testid select-aggregation-input"},selectAlias:{"11.0.0":"data-testid select-alias"},selectAliasInput:{"11.0.0":"data-testid select-alias-input"},selectInputParameter:{"11.0.0":"data-testid select-input-parameter"},filterConjunction:{"11.0.0":"data-testid filter-conjunction"},filterField:{"11.0.0":"data-testid filter-field"},filterOperator:{"11.0.0":"data-testid filter-operator"},headerTableSelector:{"11.0.0":"data-testid header-table-selector"},headerFilterSwitch:{"11.0.0":"data-testid header-filter-switch"},headerGroupSwitch:{"11.0.0":"data-testid header-group-switch"},headerOrderSwitch:{"11.0.0":"data-testid header-order-switch"},headerPreviewSwitch:{"11.0.0":"data-testid header-preview-switch"}},EntityNotFound:{container:{"11.2.0":"data-testid entity-not-found"}},Portal:{container:{"11.5.0":"data-testid portal-container"}},ExportImage:{formatOptions:{container:{"12.1.0":"data-testid export-image-format-options"},png:{"12.1.0":"data-testid export-image-format-png"},jpg:{"12.1.0":"data-testid export-image-format-jpg"}},rendererAlert:{container:{"12.1.0":"data-testid export-image-renderer-alert"},title:{"12.1.0":"data-testid export-image-renderer-alert-title"},description:{"12.1.0":"data-testid export-image-renderer-alert-description"}},buttons:{generate:{"12.1.0":"data-testid export-image-generate-button"},download:{"12.1.0":"data-testid export-image-download-button"},cancel:{"12.1.0":"data-testid export-image-cancel-button"}},preview:{container:{"12.1.0":"data-testid export-image-preview-container"},loading:{"12.1.0":"data-testid export-image-preview-loading"},image:{"12.1.0":"data-testid export-image-preview"},error:{container:{"12.1.0":"data-testid export-image-error"},title:{"12.1.0":"data-testid export-image-error-title"},message:{"12.1.0":"data-testid export-image-error-message"}}}}},Yt={pages:Wt({Alerting:{AddAlertRule:{url:{"10.1.0":"/alerting/new/alerting",[Qt]:"/alerting/new"}},EditAlertRule:{url:{[Qt]:e=>`alerting/${e}/edit`}}},Login:{url:{[Qt]:"/login"},username:{"10.2.3":"data-testid Username input field",[Qt]:"Username input field"},password:{"10.2.3":"data-testid Password input field",[Qt]:"Password input field"},submit:{"10.2.3":"data-testid Login button",[Qt]:"Login button"},skip:{"10.2.3":"data-testid Skip change password button"}},PasswordlessLogin:{url:{[Qt]:"/login/passwordless/authenticate"},email:{"10.2.3":"data-testid Email input field",[Qt]:"Email input field"},submit:{"10.2.3":"data-testid PasswordlessLogin button",[Qt]:"PasswordlessLogin button"}},Home:{url:{[Qt]:"/"}},DataSource:{name:{"10.3.0":"data-testid Data source settings page name input field",[Qt]:"Data source settings page name input field"},delete:{[Qt]:"Data source settings page Delete button"},readOnly:{"10.3.0":"data-testid Data source settings page read only message",[Qt]:"Data source settings page read only message"},saveAndTest:{"10.0.0":"data-testid Data source settings page Save and Test button",[Qt]:"Data source settings page Save and Test button"},alert:{"10.3.0":"data-testid Data source settings page Alert",[Qt]:"Data source settings page Alert"}},DataSources:{url:{[Qt]:"/datasources"},dataSources:{[Qt]:e=>`Data source list item ${e}`}},EditDataSource:{url:{"9.5.0":e=>`/datasources/edit/${e}`},settings:{"9.5.0":"Datasource settings page basic settings"}},AddDataSource:{url:{[Qt]:"/datasources/new"},dataSourcePluginsV2:{"9.3.1":e=>`Add new data source ${e}`,[Qt]:e=>`Data source plugin item ${e}`}},ConfirmModal:{delete:{"10.0.0":"data-testid Confirm Modal Danger Button",[Qt]:"Confirm Modal Danger Button"},input:{"12.2.0":"data-testid Confirm Modal Input"}},SecretsManagement:{SecretForm:{"12.2.0":"data-testid Secret Form"}},AddDashboard:{url:{[Qt]:"/dashboard/new"},itemButton:{"9.5.0":e=>`data-testid ${e}`},addNewPanel:{"11.1.0":"data-testid Add new panel","8.0.0":"Add new panel",[Qt]:"Add new panel"},itemButtonAddViz:{[Qt]:"Add new visualization menu item"},addNewRow:{"11.1.0":"data-testid Add new row",[Qt]:"Add new row"},addNewPanelLibrary:{"11.1.0":"data-testid Add new panel from panel library",[Qt]:"Add new panel from panel library"},Settings:{Annotations:{List:{url:{[Qt]:"/dashboard/new?orgId=1&editview=annotations"}},Edit:{url:{[Qt]:e=>`/dashboard/new?editview=annotations&editIndex=${e}`}}},Variables:{List:{url:{"11.3.0":"/dashboard/new?orgId=1&editview=variables",[Qt]:"/dashboard/new?orgId=1&editview=templating"}},Edit:{url:{"11.3.0":e=>`/dashboard/new?orgId=1&editview=variables&editIndex=${e}`,[Qt]:e=>`/dashboard/new?orgId=1&editview=templating&editIndex=${e}`}}}}},ImportDashboard:{url:{[Qt]:"/dashboard/import"}},Dashboard:{url:{[Qt]:e=>`/d/${e}`},DashNav:{nav:{[Qt]:"Dashboard navigation"},navV2:{[Qt]:"data-testid Dashboard navigation"},publicDashboardTag:{"9.1.0":"data-testid public dashboard tag"},shareButton:{"10.4.0":"data-testid share-button"},scrollContainer:{"11.1.0":"data-testid Dashboard canvas scroll container"},newShareButton:{container:{"11.1.0":"data-testid new share button"},shareLink:{"11.1.0":"data-testid new share link-button"},arrowMenu:{"11.1.0":"data-testid new share button arrow menu"},menu:{container:{"11.1.0":"data-testid new share button menu"},shareInternally:{"11.1.0":"data-testid new share button share internally"},shareExternally:{"11.1.1":"data-testid new share button share externally"},shareSnapshot:{"11.2.0":"data-testid new share button share snapshot"}}},NewExportButton:{container:{"11.2.0":"data-testid new export button"},arrowMenu:{"11.2.0":"data-testid new export button arrow menu"},Menu:{container:{"11.2.0":"data-testid new export button menu"},exportAsJson:{"11.2.0":"data-testid new export button export as json"},exportAsImage:{"12.1.0":"data-testid new export button export as image"}}},playlistControls:{prev:{"11.0.0":"data-testid playlist previous dashboard button"},stop:{"11.0.0":"data-testid playlist stop dashboard button"},next:{"11.0.0":"data-testid playlist next dashboard button"}}},Controls:{"11.1.0":"data-testid dashboard controls"},SubMenu:{submenu:{[Qt]:"Dashboard submenu"},submenuItem:{[Qt]:"data-testid template variable"},submenuItemLabels:{[Qt]:e=>`data-testid Dashboard template variables submenu Label ${e}`},submenuItemValueDropDownValueLinkTexts:{[Qt]:e=>`data-testid Dashboard template variables Variable Value DropDown value link text ${e}`},submenuItemValueDropDownDropDown:{[Qt]:"Variable options"},submenuItemValueDropDownOptionTexts:{[Qt]:e=>`data-testid Dashboard template variables Variable Value DropDown option text ${e}`},Annotations:{annotationsWrapper:{"10.0.0":"data-testid annotation-wrapper"},annotationLabel:{"10.0.0":e=>`data-testid Dashboard annotations submenu Label ${e}`},annotationToggle:{"10.0.0":e=>`data-testid Dashboard annotations submenu Toggle ${e}`}}},Settings:{Actions:{close:{"9.5.0":"data-testid dashboard-settings-close"}},General:{deleteDashBoard:{"11.1.0":"data-testid Dashboard settings page delete dashboard button"},sectionItems:{[Qt]:e=>`Dashboard settings section item ${e}`},saveDashBoard:{[Qt]:"Dashboard settings aside actions Save button"},saveAsDashBoard:{[Qt]:"Dashboard settings aside actions Save As button"},title:{"11.2.0":"General"}},Annotations:{Edit:{urlParams:{[Qt]:e=>`editview=annotations&editIndex=${e}`}},List:{url:{[Qt]:e=>`/d/${e}?editview=annotations`},addAnnotationCTAV2:{[Qt]:"data-testid Call to action button Add annotation query"},annotations:{"10.4.0":"data-testid list-annotations"}},Settings:{name:{"11.1.0":"data-testid Annotations settings name input",[Qt]:"Annotations settings name input"}},NewAnnotation:{panelFilterSelect:{"10.0.0":"data-testid annotations-panel-filter"},showInLabel:{"11.1.0":"data-testid show-in-label"},previewInDashboard:{"10.0.0":"data-testid annotations-preview"},delete:{"10.4.0":"data-testid annotations-delete"},apply:{"10.4.0":"data-testid annotations-apply"},enable:{"10.4.0":"data-testid annotation-enable"},hide:{"10.4.0":"data-testid annotation-hide"}}},Variables:{List:{url:{"11.3.0":e=>`/d/${e}?editview=variables`,[Qt]:e=>`/d/${e}?editview=templating`},addVariableCTAV2:{[Qt]:"data-testid Call to action button Add variable"},newButton:{[Qt]:"Variable editor New variable button"},table:{[Qt]:"Variable editor Table"},tableRowNameFields:{[Qt]:e=>`Variable editor Table Name field ${e}`},tableRowDefinitionFields:{"10.1.0":e=>`Variable editor Table Definition field ${e}`},tableRowArrowUpButtons:{[Qt]:e=>`Variable editor Table ArrowUp button ${e}`},tableRowArrowDownButtons:{[Qt]:e=>`Variable editor Table ArrowDown button ${e}`},tableRowDuplicateButtons:{[Qt]:e=>`Variable editor Table Duplicate button ${e}`},tableRowRemoveButtons:{[Qt]:e=>`Variable editor Table Remove button ${e}`}},Edit:{urlParams:{"11.3.0":e=>`editview=variables&editIndex=${e}`,[Qt]:e=>`editview=templating&editIndex=${e}`},General:{headerLink:{[Qt]:"Variable editor Header link"},modeLabelNew:{[Qt]:"Variable editor Header mode New"},modeLabelEdit:{[Qt]:"Variable editor Header mode Edit"},generalNameInput:{[Qt]:"Variable editor Form Name field"},generalNameInputV2:{[Qt]:"data-testid Variable editor Form Name field"},generalTypeSelect:{[Qt]:"Variable editor Form Type select"},generalTypeSelectV2:{[Qt]:"data-testid Variable editor Form Type select"},generalLabelInput:{[Qt]:"Variable editor Form Label field"},generalLabelInputV2:{[Qt]:"data-testid Variable editor Form Label field"},generalHideSelect:{[Qt]:"Variable editor Form Hide select"},generalHideSelectV2:{[Qt]:"data-testid Variable editor Form Hide select"},selectionOptionsAllowCustomValueSwitch:{[Qt]:"data-testid Variable editor Form Allow Custom Value switch"},selectionOptionsMultiSwitch:{"10.4.0":"data-testid Variable editor Form Multi switch",[Qt]:"Variable editor Form Multi switch"},selectionOptionsIncludeAllSwitch:{"10.4.0":"data-testid Variable editor Form IncludeAll switch",[Qt]:"Variable editor Form IncludeAll switch"},selectionOptionsCustomAllInput:{"10.4.0":"data-testid Variable editor Form IncludeAll field",[Qt]:"Variable editor Form IncludeAll field"},previewOfValuesOption:{"10.4.0":"data-testid Variable editor Preview of Values option",[Qt]:"Variable editor Preview of Values option"},submitButton:{"10.4.0":"data-testid Variable editor Run Query button",[Qt]:"Variable editor Submit button"},applyButton:{"9.3.0":"data-testid Variable editor Apply button"}},QueryVariable:{closeButton:{[Qt]:"data-testid Query Variable editor close button"},editor:{[Qt]:"data-testid Query Variable editor"},previewButton:{[Qt]:"data-testid Query Variable editor preview button"},queryOptionsDataSourceSelect:{"10.4.0":"data-testid Select a data source","10.0.0":"data-testid Data source picker select container",[Qt]:"Data source picker select container"},queryOptionsOpenButton:{[Qt]:"data-testid Query Variable editor open button"},queryOptionsRefreshSelect:{[Qt]:"Variable editor Form Query Refresh select"},queryOptionsRefreshSelectV2:{[Qt]:"data-testid Variable editor Form Query Refresh select"},queryOptionsRegExInput:{[Qt]:"Variable editor Form Query RegEx field"},queryOptionsRegExInputV2:{[Qt]:"data-testid Variable editor Form Query RegEx field"},queryOptionsSortSelect:{[Qt]:"Variable editor Form Query Sort select"},queryOptionsSortSelectV2:{[Qt]:"data-testid Variable editor Form Query Sort select"},queryOptionsQueryInput:{"10.4.0":"data-testid Variable editor Form Default Variable Query Editor textarea"},queryOptionsStaticOptionsRow:{[Qt]:"Variable editor Form Query Static Options row"},queryOptionsStaticOptionsToggle:{[Qt]:"Variable editor Form Query Static Options toggle"},queryOptionsStaticOptionsLabelInput:{[Qt]:"Variable editor Form Query Static Options Label input"},queryOptionsStaticOptionsValueInput:{[Qt]:"Variable editor Form Query Static Options Value input"},queryOptionsStaticOptionsDeleteButton:{[Qt]:"Variable editor Form Query Static Options Delete button"},queryOptionsStaticOptionsAddButton:{[Qt]:"Variable editor Form Query Static Options Add button"},queryOptionsStaticOptionsOrderDropdown:{[Qt]:"Variable editor Form Query Static Options Order dropdown"},valueGroupsTagsEnabledSwitch:{[Qt]:"Variable editor Form Query UseTags switch"},valueGroupsTagsTagsQueryInput:{[Qt]:"Variable editor Form Query TagsQuery field"},valueGroupsTagsTagsValuesQueryInput:{[Qt]:"Variable editor Form Query TagsValuesQuery field"}},ConstantVariable:{constantOptionsQueryInput:{[Qt]:"Variable editor Form Constant Query field"},constantOptionsQueryInputV2:{[Qt]:"data-testid Variable editor Form Constant Query field"}},DatasourceVariable:{datasourceSelect:{[Qt]:"data-testid datasource variable datasource type"},nameFilter:{[Qt]:"data-testid datasource variable datasource name filter"}},TextBoxVariable:{textBoxOptionsQueryInput:{[Qt]:"Variable editor Form TextBox Query field"},textBoxOptionsQueryInputV2:{[Qt]:"data-testid Variable editor Form TextBox Query field"}},CustomVariable:{customValueInput:{[Qt]:"data-testid custom-variable-input"}},IntervalVariable:{intervalsValueInput:{[Qt]:"data-testid interval variable intervals input"},autoEnabledCheckbox:{"10.4.0":"data-testid interval variable auto value checkbox"},stepCountIntervalSelect:{"10.4.0":"data-testid interval variable step count input"},minIntervalInput:{"10.4.0":"data-testid interval variable mininum interval input"}},GroupByVariable:{dataSourceSelect:{"10.4.0":"data-testid Select a data source"},infoText:{"10.4.0":"data-testid group by variable info text"},modeToggle:{"10.4.0":"data-testid group by variable mode toggle"}},AdHocFiltersVariable:{datasourceSelect:{"10.4.0":"data-testid Select a data source"},infoText:{"10.4.0":"data-testid ad-hoc filters variable info text"},modeToggle:{"11.0.0":"data-testid ad-hoc filters variable mode toggle"}}}}},Annotations:{marker:{"10.0.0":"data-testid annotation-marker"}},Rows:{Repeated:{ConfigSection:{warningMessage:{"10.2.0":"data-testid Repeated rows warning message"}}}}},Dashboards:{url:{[Qt]:"/dashboards"},dashboards:{"10.2.0":e=>`Dashboard search item ${e}`},toggleView:{[Qt]:"data-testid radio-button"}},SaveDashboardAsModal:{newName:{"10.2.0":"Save dashboard title field"},save:{"10.2.0":"Save dashboard button"}},SaveDashboardModal:{save:{"10.2.0":"Dashboard settings Save Dashboard Modal Save button"},saveVariables:{"10.2.0":"Dashboard settings Save Dashboard Modal Save variables checkbox"},saveTimerange:{"10.2.0":"Dashboard settings Save Dashboard Modal Save timerange checkbox"},saveRefresh:{"11.1.0":"Dashboard settings Save Dashboard Modal Save refresh checkbox"},variablesWarningAlert:{"12.2.0":"Dashboard settings Save Dashboard Modal Save variables Variables With Errors Warning Alert"}},SharePanelModal:{linkToRenderedImage:{[Qt]:"Link to rendered image"}},ShareDashboardModal:{PublicDashboard:{WillBePublicCheckbox:{"9.1.0":"data-testid public dashboard will be public checkbox"},LimitedDSCheckbox:{"9.1.0":"data-testid public dashboard limited datasources checkbox"},CostIncreaseCheckbox:{"9.1.0":"data-testid public dashboard cost may increase checkbox"},PauseSwitch:{"9.5.0":"data-testid public dashboard pause switch"},EnableAnnotationsSwitch:{"9.3.0":"data-testid public dashboard on off switch for annotations"},CreateButton:{"9.5.0":"data-testid public dashboard create button"},DeleteButton:{"9.3.0":"data-testid public dashboard delete button"},CopyUrlInput:{"9.1.0":"data-testid public dashboard copy url input"},CopyUrlButton:{"9.1.0":"data-testid public dashboard copy url button"},SettingsDropdown:{"10.1.0":"data-testid public dashboard settings dropdown"},TemplateVariablesWarningAlert:{"9.1.0":"data-testid public dashboard disabled template variables alert"},UnsupportedDataSourcesWarningAlert:{"9.5.0":"data-testid public dashboard unsupported data sources alert"},NoUpsertPermissionsWarningAlert:{"9.5.0":"data-testid public dashboard no upsert permissions alert"},EnableTimeRangeSwitch:{"9.4.0":"data-testid public dashboard on off switch for time range"},EmailSharingConfiguration:{Container:{"9.5.0":"data-testid email sharing config container"},ShareType:{"9.5.0":"data-testid public dashboard share type"},EmailSharingInput:{"9.5.0":"data-testid public dashboard email sharing input"},EmailSharingInviteButton:{"9.5.0":"data-testid public dashboard email sharing invite button"},EmailSharingList:{"9.5.0":"data-testid public dashboard email sharing list"},DeleteEmail:{"9.5.0":"data-testid public dashboard delete email button"},ReshareLink:{"9.5.0":"data-testid public dashboard reshare link button"}}},SnapshotScene:{url:{"11.1.0":e=>`/dashboard/snapshot/${e}`},PublishSnapshot:{"11.1.0":"data-testid publish snapshot button"},CopyUrlButton:{"11.1.0":"data-testid snapshot copy url button"},CopyUrlInput:{"11.1.0":"data-testid snapshot copy url input"}}},ShareDashboardDrawer:{ShareInternally:{container:{"11.3.0":"data-testid share internally drawer container"},lockTimeRangeSwitch:{"11.3.0":"data-testid share internally lock time range switch"},shortenUrlSwitch:{"11.3.0":"data-testid share internally shorten url switch"},copyUrlButton:{"11.3.0":"data-testid share internally copy url button"},SharePanel:{preview:{"11.5.0":"data-testid share panel internally image generation preview"},widthInput:{"11.5.0":"data-testid share panel internally width input"},heightInput:{"11.5.0":"data-testid share panel internally height input"},scaleFactorInput:{"11.5.0":"data-testid share panel internally scale factor input"},generateImageButton:{"11.5.0":"data-testid share panel internally generate image button"},downloadImageButton:{"11.5.0":"data-testid share panel internally download image button"}}},ShareExternally:{container:{"11.3.0":"data-testid share externally drawer container"},publicAlert:{"11.3.0":"data-testid public share alert"},emailSharingAlert:{"11.3.0":"data-testid email share alert"},shareTypeSelect:{"11.3.0":"data-testid share externally share type select"},Creation:{PublicShare:{createButton:{"11.3.0":"data-testid public share dashboard create button"},cancelButton:{"11.3.0":"data-testid public share dashboard cancel button"}},EmailShare:{createButton:{"11.3.0":"data-testid email share dashboard create button"},cancelButton:{"11.3.0":"data-testid email share dashboard cancel button"}},willBePublicCheckbox:{"11.3.0":"data-testid share dashboard will be public checkbox"}},Configuration:{enableTimeRangeSwitch:{"11.3.0":"data-testid share externally enable time range switch"},enableAnnotationsSwitch:{"11.3.0":"data-testid share externally enable annotations switch"},copyUrlButton:{"11.3.0":"data-testid share externally copy url button"},revokeAccessButton:{"11.3.0":"data-testid share externally revoke access button"},toggleAccessButton:{"11.3.0":"data-testid share externally pause or resume access button"}}},ShareSnapshot:{url:{"11.3.0":e=>`/dashboard/snapshot/${e}`},container:{"11.3.0":"data-testid share snapshot drawer container"},publishSnapshot:{"11.3.0":"data-testid share snapshot publish button"},copyUrlButton:{"11.3.0":"data-testid share snapshot copy url button"}}},ExportDashboardDrawer:{ExportAsJson:{container:{"11.3.0":"data-testid export as json drawer container"},codeEditor:{"11.3.0":"data-testid export as json code editor"},exportExternallyToggle:{"11.3.0":"data-testid export as json externally switch"},saveToFileButton:{"11.3.0":"data-testid export as json save to file button"},copyToClipboardButton:{"11.3.0":"data-testid export as json copy to clipboard button"},cancelButton:{"11.3.0":"data-testid export as json cancel button"}}},PublicDashboard:{page:{"9.5.0":"public-dashboard-page"},NotAvailable:{container:{"9.5.0":"public-dashboard-not-available"},title:{"9.5.0":"public-dashboard-title"},pausedDescription:{"9.5.0":"public-dashboard-paused-description"}},footer:{"11.0.0":"public-dashboard-footer"}},PublicDashboardScene:{loadingPage:{"11.0.0":"public-dashboard-scene-loading-page"},page:{"11.0.0":"public-dashboard-scene-page"},controls:{"11.0.0":"public-dashboard-controls"}},RequestViewAccess:{form:{"9.5.0":"request-view-access-form"},recipientInput:{"9.5.0":"request-view-access-recipient-input"},submitButton:{"9.5.0":"request-view-access-submit-button"}},PublicDashboardConfirmAccess:{submitButton:{"10.2.0":"data-testid confirm-access-submit-button"}},Explore:{url:{[Qt]:"/explore"},General:{container:{[Qt]:"data-testid Explore"},graph:{[Qt]:"Explore Graph"},table:{[Qt]:"Explore Table"},scrollView:{"9.0.0":"data-testid explorer scroll view"},addFromQueryLibrary:{"11.5.0":"data-testid explore add from query library button"}},QueryHistory:{container:{"11.1.0":"data-testid QueryHistory"}}},SoloPanel:{url:{[Qt]:e=>`/d-solo/${e}`}},PluginsList:{page:{[Qt]:"Plugins list page"},list:{[Qt]:"Plugins list"},listItem:{[Qt]:"Plugins list item"},signatureErrorNotice:{"10.3.0":"data-testid Unsigned plugins notice",[Qt]:"Unsigned plugins notice"}},PluginPage:{page:{[Qt]:"Plugin page"},signatureInfo:{"10.3.0":"data-testid Plugin signature info",[Qt]:"Plugin signature info"},disabledInfo:{"10.3.0":"data-testid Plugin disabled info",[Qt]:"Plugin disabled info"}},PlaylistForm:{name:{[Qt]:"Playlist name"},interval:{[Qt]:"Playlist interval"},itemDelete:{"10.2.0":"data-testid playlist-form-delete-item"}},BrowseDashboards:{table:{body:{"10.2.0":"data-testid browse-dashboards-table"},row:{"10.2.0":e=>`data-testid browse dashboards row ${e}`},checkbox:{"10.0.0":e=>`data-testid ${e} checkbox`}},NewFolderForm:{form:{"10.2.0":"data-testid new folder form"},nameInput:{"10.2.0":"data-testid new-folder-name-input"},createButton:{"10.2.0":"data-testid new-folder-create-button"}}},SearchDashboards:{table:{"10.2.0":"Search results table"}},Search:{url:{"9.3.0":"/?search=openn"},FolderView:{url:{"9.3.0":"/?search=open&layout=folders"}}},PublicDashboards:{ListItem:{linkButton:{"9.3.0":"public-dashboard-link-button"},configButton:{"9.3.0":"public-dashboard-configuration-button"},trashcanButton:{"9.3.0":"public-dashboard-remove-button"},pauseSwitch:{"10.1.0":"data-testid public dashboard pause switch"}}},UserListPage:{tabs:{allUsers:{"10.0.0":"data-testid all-users-tab"},orgUsers:{"10.0.0":"data-testid org-users-tab"},anonUserDevices:{"10.2.3":"data-testid anon-user-devices-tab"},publicDashboardsUsers:{"10.0.0":"data-testid public-dashboards-users-tab"},users:{"10.0.0":"data-testid users-tab"}},org:{url:{"10.2.0":"/admin/users","9.5.0":"/org/users"}},admin:{url:{"9.5.0":"/admin/users"}},publicDashboards:{container:{"11.1.0":"data-testid public-dashboards-users-list"}},UserListAdminPage:{container:{"10.0.0":"data-testid user-list-admin-page"}},UsersListPage:{container:{"10.0.0":"data-testid users-list-page"}},UserAnonListPage:{container:{"10.4.0":"data-testid user-anon-list-page"}},UsersListPublicDashboardsPage:{container:{"10.0.0":"data-testid users-list-public-dashboards-page"},DashboardsListModal:{listItem:{"10.0.0":e=>`data-testid dashboards-list-item-${e}`}}}},ProfilePage:{url:{"10.2.0":"/profile"}},Plugin:{url:{[Qt]:e=>`/plugins/${e}`}},MigrateToCloud:{url:{"11.2.0":"/admin/migrate-to-cloud"}}}),components:Wt(Kt)};var Xt=n(6089);const Zt=(e,t)=>e>t?1:e<t?-1:0,Jt=1/0,en=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),tn="eexxaacctt",nn=/\p{P}/gu,rn=["en",{numeric:!0,sensitivity:"base"}],an=(e,t,n)=>e.replace("A-Z",t).replace("a-z",n),on={unicode:!1,alpha:null,interSplit:"[^A-Za-z\\d']+",intraSplit:"[a-z][A-Z]",interBound:"[^A-Za-z\\d]",intraBound:"[A-Za-z]\\d|\\d[A-Za-z]|[a-z][A-Z]",interLft:0,interRgt:0,interChars:".",interIns:Jt,intraChars:"[a-z\\d']",intraIns:null,intraContr:"'[a-z]{1,2}\\b",intraMode:0,intraSlice:[1,Jt],intraSub:null,intraTrn:null,intraDel:null,intraFilt:(e,t,n)=>!0,toUpper:e=>e.toLocaleUpperCase(),toLower:e=>e.toLocaleLowerCase(),compare:null,sort:(e,t,n,r=Zt)=>{let{idx:a,chars:i,terms:o,interLft2:s,interLft1:l,start:u,intraIns:c,interIns:d,cases:p}=e;return a.map((e,t)=>t).sort((e,n)=>i[n]-i[e]||c[e]-c[n]||o[n]+s[n]+.5*l[n]-(o[e]+s[e]+.5*l[e])||d[e]-d[n]||u[e]-u[n]||p[n]-p[e]||r(t[a[e]],t[a[n]]))}},sn=(e,t)=>0==t?"":1==t?e+"??":t==Jt?e+"*?":e+`{0,${t}}?`,ln="(?:\\b|_)";function un(e){e=Object.assign({},on,e);let{unicode:t,interLft:n,interRgt:r,intraMode:a,intraSlice:i,intraIns:o,intraSub:s,intraTrn:l,intraDel:u,intraContr:c,intraSplit:d,interSplit:p,intraBound:h,interBound:f,intraChars:m,toUpper:g,toLower:v,compare:b}=e;o??=a,s??=a,l??=a,u??=a,b??="undefined"==typeof Intl?Zt:new Intl.Collator(...rn).compare;let y=e.letters??e.alpha;if(null!=y){let e=g(y),t=v(y);p=an(p,e,t),d=an(d,e,t),f=an(f,e,t),h=an(h,e,t),m=an(m,e,t),c=an(c,e,t)}let w=t?"u":"";const S='".+?"',x=new RegExp(S,"gi"+w),_=new RegExp(`(?:\\s+|^)-(?:${m}+|${S})`,"gi"+w);let{intraRules:E}=e;null==E&&(E=e=>{let t=on.intraSlice,n=0,r=0,a=0,c=0;if(/[^\d]/.test(e)){let d=e.length;d<=4?d>=3&&(a=Math.min(l,1),4==d&&(n=Math.min(o,1))):(t=i,n=o,r=s,a=l,c=u)}return{intraSlice:t,intraIns:n,intraSub:r,intraTrn:a,intraDel:c}});let C=!!d,R=new RegExp(d,"g"+w),O=new RegExp(p,"g"+w),T=new RegExp("^"+p+"|"+p+"$","g"+w),D=new RegExp(c,"gi"+w);const k=(e,t=!1)=>{let n=[];e=(e=e.replace(x,e=>(n.push(e),tn))).replace(T,""),t||(e=v(e)),C&&(e=e.replace(R,e=>e[0]+" "+e[1]));let r=0;return e.split(O).filter(e=>""!=e).map(e=>e===tn?n[r++]:e)},A=/[^\d]+|\d+/g,P=(t,i=0,s=!1)=>{let l=k(t);if(0==l.length)return[];let u,c=Array(l.length).fill("");if(l=l.map((e,t)=>e.replace(D,e=>(c[t]=e,""))),1==a)u=l.map((e,t)=>{if('"'===e[0])return en(e.slice(1,-1));let n="";for(let r of e.matchAll(A)){let e=r[0],{intraSlice:a,intraIns:i,intraSub:o,intraTrn:s,intraDel:l}=E(e);if(i+o+s+l==0)n+=e+c[t];else{let[r,u]=a,d=e.slice(0,r),p=e.slice(u),h=e.slice(r,u);1==i&&1==d.length&&d!=h[0]&&(d+="(?!"+d+")");let f=h.length,g=[e];if(o)for(let e=0;e<f;e++)g.push(d+h.slice(0,e)+m+h.slice(e+1)+p);if(s)for(let e=0;e<f-1;e++)h[e]!=h[e+1]&&g.push(d+h.slice(0,e)+h[e+1]+h[e]+h.slice(e+2)+p);if(l)for(let e=0;e<f;e++)g.push(d+h.slice(0,e+1)+"?"+h.slice(e+1)+p);if(i){let e=sn(m,1);for(let t=0;t<f;t++)g.push(d+h.slice(0,t)+e+h.slice(t)+p)}n+="(?:"+g.join("|")+")"+c[t]}}return n});else{let e=sn(m,o);2==i&&o>0&&(e=")("+e+")("),u=l.map((t,n)=>'"'===t[0]?en(t.slice(1,-1)):t.split("").map((e,t,n)=>(1==o&&0==t&&n.length>1&&e!=n[t+1]&&(e+="(?!"+e+")"),e)).join(e)+c[n])}let d=2==n?ln:"",p=2==r?ln:"",h=p+sn(e.interChars,e.interIns)+d;return i>0?s?u=d+"("+u.join(")"+p+"|"+d+"(")+")"+p:(u="("+u.join(")("+h+")(")+")",u="(.??"+d+")"+u+"("+p+".*)"):(u=u.join(h),u=d+u+p),[new RegExp(u,"i"+w),l,c]},I=(e,t,n)=>{let[r]=P(t);if(null==r)return null;let a=[];if(null!=n)for(let t=0;t<n.length;t++){let i=n[t];r.test(e[i])&&a.push(i)}else for(let t=0;t<e.length;t++)r.test(e[t])&&a.push(t);return a};let L=!!h,M=new RegExp(f,w),V=new RegExp(h,w);const F=(t,a,i)=>{let[o,s,l]=P(i,1),u=k(i,!0),[c]=P(i,2),d=s.length,p=Array(d),h=Array(d);for(let e=0;e<d;e++){let t=s[e],n=u[e],r='"'==t[0]?t.slice(1,-1):t+l[e],a='"'==n[0]?n.slice(1,-1):n+l[e];p[e]=r,h[e]=a}let f=t.length,m=Array(f).fill(0),g={idx:Array(f),start:m.slice(),chars:m.slice(),cases:m.slice(),terms:m.slice(),interIns:m.slice(),intraIns:m.slice(),interLft2:m.slice(),interRgt2:m.slice(),interLft1:m.slice(),interRgt1:m.slice(),ranges:Array(f)},b=1==n||1==r,y=0;for(let i=0;i<t.length;i++){let s=a[t[i]],l=s.match(o),u=l.index+l[1].length,f=u,m=!1,S=0,x=0,_=0,E=0,C=0,R=0,O=0,T=0,D=0,k=[];for(let t=0,a=2;t<d;t++,a+=2){let i=v(l[a]),o=p[t],c=h[t],g=o.length,y=i.length,A=i==o;if(l[a]==c&&O++,!A&&l[a+1].length>=g){let e=v(l[a+1]).indexOf(o);e>-1&&(k.push(f,y,e,g),f+=N(l,a,e,g),i=o,y=g,A=!0,0==t&&(u=f))}if(b||A){let e=f-1,c=f+y,d=!1,p=!1;if(-1==e||M.test(s[e]))A&&S++,d=!0;else{if(2==n){m=!0;break}if(L&&V.test(s[e]+s[e+1]))A&&x++,d=!0;else if(1==n){let e=l[a+1],n=f+y;if(e.length>=g){let r,c=0,p=!1,h=new RegExp(o,"ig"+w);for(;r=h.exec(e);){c=r.index;let e=n+c,t=e-1;if(-1==t||M.test(s[t])){S++,p=!0;break}if(V.test(s[t]+s[e])){x++,p=!0;break}}p&&(d=!0,k.push(f,y,c,g),f+=N(l,a,c,g),i=o,y=g,A=!0,0==t&&(u=f))}if(!d){m=!0;break}}}if(c==s.length||M.test(s[c]))A&&_++,p=!0;else{if(2==r){m=!0;break}if(L&&V.test(s[c-1]+s[c]))A&&E++,p=!0;else if(1==r){m=!0;break}}A&&(C+=g,d&&p&&R++)}if(y>g&&(D+=y-g),t>0&&(T+=l[a-1].length),!e.intraFilt(o,i,f)){m=!0;break}t<d-1&&(f+=y+l[a+1].length)}if(!m){g.idx[y]=t[i],g.interLft2[y]=S,g.interLft1[y]=x,g.interRgt2[y]=_,g.interRgt1[y]=E,g.chars[y]=C,g.terms[y]=R,g.cases[y]=O,g.interIns[y]=T,g.intraIns[y]=D,g.start[y]=u;let e=s.match(c),n=e.index+e[1].length,r=k.length,a=r>0?0:1/0,o=r-4;for(let t=2;t<e.length;){let r=e[t].length;if(a<=o&&k[a]==n){let r=k[a+1],i=k[a+2],o=k[a+3],s=t,l="";for(let t=0;t<r;s++)l+=e[s],t+=e[s].length;e.splice(t,s-t,l),n+=N(e,t,i,o),a+=4}else n+=r,t++}n=e.index+e[1].length;let l=g.ranges[y]=[],d=n,p=n;for(let t=2;t<e.length;t++){let r=e[t].length;n+=r,t%2==0?p=n:r>0&&(l.push(d,p),d=p=n)}p>d&&l.push(d,p),y++}}if(y<t.length)for(let e in g)g[e]=g[e].slice(0,y);return g},N=(e,t,n,r)=>{let a=e[t]+e[t+1].slice(0,n);return e[t-1]+=a,e[t]=e[t+1].slice(n,n+r),e[t+1]=e[t+1].slice(n+r),a.length};return{search:(...t)=>{let n=((t,n,r,a=1e3,i)=>{r=r?!0===r?5:r:0;let o=null,s=null,l=[];n=n.replace(_,e=>{let t=e.trim().slice(1);return t='"'===t[0]?en(t.slice(1,-1)):t.replace(nn,""),""!=t&&l.push(t),""});let u,c=k(n);if(l.length>0){if(u=new RegExp(l.join("|"),"i"+w),0==c.length){let e=[];for(let n=0;n<t.length;n++)u.test(t[n])||e.push(n);return[e,null,null]}}else if(0==c.length)return[null,null,null];if(r>0){let e=k(n);if(e.length>1){let n=e.slice().sort((e,t)=>t.length-e.length);for(let e=0;e<n.length;e++){if(0==i?.length)return[[],null,null];i=I(t,n[e],i)}if(e.length>r)return[i,null,null];o=dn(e).map(e=>e.join(" ")),s=[];let a=new Set;for(let e=0;e<o.length;e++)if(a.size<i.length){let n=i.filter(e=>!a.has(e)),r=I(t,o[e],n);for(let e=0;e<r.length;e++)a.add(r[e]);s.push(r)}else s.push([])}}null==o&&(o=[n],s=[i?.length>0?i:I(t,n)]);let d=null,p=null;if(l.length>0&&(s=s.map(e=>e.filter(e=>!u.test(t[e])))),s.reduce((e,t)=>e+t.length,0)<=a){d={},p=[];for(let n=0;n<s.length;n++){let r=s[n];if(null==r||0==r.length)continue;let a=o[n],i=F(r,t,a),l=e.sort(i,t,a,b);if(n>0)for(let e=0;e<l.length;e++)l[e]+=p.length;for(let e in i)d[e]=(d[e]??[]).concat(i[e]);p=p.concat(l)}}return[[].concat(...s),d,p]})(...t);return n},split:k,filter:I,info:F,sort:e.sort}}const cn=(()=>{let e={A:"ÁÀÃÂÄĄ",a:"áàãâäą",E:"ÉÈÊËĖ",e:"éèêëę",I:"ÍÌÎÏĮ",i:"íìîïį",O:"ÓÒÔÕÖ",o:"óòôõö",U:"ÚÙÛÜŪŲ",u:"úùûüūų",C:"ÇČĆ",c:"çčć",L:"Ł",l:"ł",N:"ÑŃ",n:"ñń",S:"ŠŚ",s:"šś",Z:"ŻŹ",z:"żź"},t=new Map,n="";for(let r in e)e[r].split("").forEach(e=>{n+=e,t.set(e,r)});let r=new RegExp(`[${n}]`,"g"),a=e=>t.get(e);return e=>{if("string"==typeof e)return e.replace(r,a);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n].replace(r,a);return t}})();function dn(e){let t,n,r=(e=e.slice()).length,a=[e.slice()],i=new Array(r).fill(0),o=1;for(;o<r;)i[o]<o?(t=o%2&&i[o],n=e[o],e[o]=e[t],e[t]=n,++i[o],o=1,a.push(e.slice())):(i[o]=0,++o);return a}const pn=(e,t)=>t?`<mark>${e}</mark>`:e,hn=(e,t)=>e+t;un.latinize=cn,un.permute=e=>dn([...Array(e.length).keys()]).sort((e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!=t[n])return e[n]-t[n];return 0}).map(t=>t.map(t=>e[t])),un.highlight=function(e,t,n=pn,r="",a=hn){r=a(r,n(e.substring(0,t[0]),!1))??r;for(let i=0;i<t.length;i+=2){let o=t[i],s=t[i+1];r=a(r,n(e.substring(o,s),!0))??r,i<t.length-3&&(r=a(r,n(e.substring(t[i+1],t[i+2]),!1))??r)}return r=a(r,n(e.substring(t[t.length-1]),!1))??r};const fn=/[^ -~]/m,mn=/^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+$/m,gn=5,vn=25,bn=5,yn=1e4,wn=new un({intraMode:1});function Sn(e,t,n){let r=[];if(""===n)r=e;else if(fn.test(n)||mn.test(n)||n.length>vn||wn.split(n).length>bn)for(let a=0;a<t.length;a++){t[a].includes(n)&&r.push(e[a])}else{const[a,i,o]=wn.search(t,n,gn,yn);(null==a?void 0:a.length)&&(r=i&&o?o.map(t=>e[i.idx[t]]):a.map(t=>e[t]))}return r}function xn(e,t=!1){let n=e;t&&(n=[{value:ut,label:lt},...n]);const r=n.map(e=>e.label);return e=>Sn(n,r,e)}const _n=()=>!0,En=e=>"$__all"!==e.value,Cn=(e,t)=>e.length===t.filter(En).length?Bt.ToggleAllState.allSelected:0===e.length||1===e.length&&e[0]&&"$__all"===e[0].value?Bt.ToggleAllState.noneSelected:Bt.ToggleAllState.indeterminate;function Rn({model:e,state:t}){const{value:n,text:r,key:a,options:i,includeAll:o,isReadOnly:s,allowCustomValue:l=!0}=t,[u,c]=(0,d.useState)(""),[p,f]=(0,d.useState)(!1),m=function(e,t){return{value:e,label:null!=t?t:String(e)}}(n,String(r)),g=Ml.getQueryController(e),v=(0,d.useMemo)(()=>xn(i,o),[i,o])(u);return h().createElement(Bt.Select,{id:a,isValidNewOption:e=>e.trim().length>0,placeholder:(0,Ze.t)("grafana-scenes.variables.variable-value-select.placeholder-select-value","Select value"),width:"auto",disabled:s,value:m,inputValue:u,allowCustomValue:l,virtualized:!0,filterOption:_n,tabSelectsValue:!1,onInputChange:(t,{action:n})=>"input-change"===n?(c(t),e.onSearchChange&&e.onSearchChange(t),t):t,onOpenMenu:()=>{p&&c(String(r))},onCloseMenu:()=>{c("")},options:v,"data-testid":Yt.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${n}`),onChange:t=>{e.changeValueTo(t.value,t.label,!0),null==g||g.startProfile(Ne),p!==t.__isNew__&&f(t.__isNew__)}})}function On({model:e,state:t}){const{value:n,options:r,key:a,maxVisibleValues:i,noValueOnClear:o,includeAll:s,isReadOnly:l,allowCustomValue:u=!0}=t,c=(0,d.useMemo)(()=>(0,I.isArray)(n)?n:[n],[n]),[p,f]=(0,d.useState)(c),[m,g]=(0,d.useState)(""),v=(0,d.useMemo)(()=>xn(r,s),[r,s]);(0,d.useEffect)(()=>{f(c)},[c]);const b=r.length>0?"Select value":"",y=v(m);return h().createElement(Bt.MultiSelect,{id:a,placeholder:b,width:"auto",inputValue:m,disabled:l,value:p,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,allowCustomValue:u,toggleAllOptions:{enabled:!0,optionsFilter:En,determineToggleAllState:Cn},options:y,closeMenuOnSelect:!1,components:{Option:Tn},isClearable:!0,hideSelectedOptions:!1,onInputChange:(t,{action:n})=>"input-change"===n?(g(t),e.onSearchChange&&e.onSearchChange(t),t):"input-blur"===n?(g(""),""):m,onBlur:()=>{e.changeValueTo(p,void 0,!0)},filterOption:_n,"data-testid":Yt.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${p}`),onChange:(t,n)=>{"clear"===n.action&&o&&e.changeValueTo([],void 0,!0),f(t.map(e=>e.value))}})}const Tn=({children:e,data:t,innerProps:n,innerRef:r,isFocused:a,isSelected:i,indeterminate:o,renderOptionLabel:s})=>{var l;const{onMouseMove:u,onMouseOver:c,...d}=n,p=(0,Bt.useTheme2)(),f=(0,Bt.getSelectStyles)(p),m=(0,Bt.useStyles2)(Dn);return h().createElement("div",{ref:r,className:(0,Xt.cx)(f.option,a&&f.optionFocused),...d,"data-testid":"data-testid Select option",title:t.title},h().createElement("div",{className:m.checkbox},h().createElement(Bt.Checkbox,{indeterminate:o,value:i})),h().createElement("div",{className:f.optionBody,"data-testid":Yt.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(null!=(l=t.label)?l:String(t.value))},h().createElement("span",null,e)))};Tn.displayName="SelectMenuOptions";const Dn=e=>({checkbox:(0,Xt.css)({marginRight:e.spacing(2)})});function kn({model:e}){const t=e.useState();return t.isMulti?h().createElement(On,{model:e,state:t}):h().createElement(Rn,{model:e,state:t})}class An{constructor(e){this._sceneObject=e,this._nextChangeShouldAddHistoryStep=!1}getRestorableKey(){return`restorable-var-${this._sceneObject.state.name}`}getKey(){return`var-${this._sceneObject.state.name}`}getKeys(){return this._sceneObject.state.skipUrlSync?[]:[this.getKey(),this.getRestorableKey()]}getUrlState(){return this._sceneObject.state.skipUrlSync?{}:{[this.getKey()]:this._sceneObject.state.defaultValue&&!this._sceneObject.state.restorable?[""]:Pn(this._sceneObject.state.value,this._sceneObject.state.text),[this.getRestorableKey()]:this._sceneObject.state.defaultValue?this._sceneObject.state.restorable?"true":"false":null}}updateFromUrl(e){let t=e[this.getKey()],n=e[this.getRestorableKey()];if(null!=t){this._sceneObject.isActive||(this._sceneObject.skipNextValidation=!0);const{values:e,texts:a}=(r=t,(r=Array.isArray(r)?r:[r]).reduce((e,t)=>{const[n,r]=(null!=t?t:"").split(",");return e.values.push(nl(n)),e.texts.push(nl(null!=r?r:n)),e},{values:[],texts:[]}));if(this._sceneObject.state.defaultValue&&("false"===n||void 0===n))return;if("false"===n)return void this._sceneObject.changeValueTo([],[],!1);this._sceneObject.changeValueTo(e,a)}var r}performBrowserHistoryAction(e){this._nextChangeShouldAddHistoryStep=!0,e(),this._nextChangeShouldAddHistoryStep=!1}shouldCreateHistoryStep(e){return this._nextChangeShouldAddHistoryStep}}function Pn(e,t){return e=Array.isArray(e)?e:[e],t=Array.isArray(t)?t:[t],e.map((e,n)=>{if(null==e)return"";e=String(e);let r=t[n];return r=null==r?e:String(r),rl(e,r)})}function In(e){const t=e.getRoot();return kt(t)?t.enrichFiltersRequest(e):null}var Ln,Mn=e=>{throw TypeError(e)},Vn=(e,t,n)=>t.has(e)||Mn("Cannot "+n);class Fn{constructor(e){((e,t,n)=>{t.has(e)?Mn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n)})(this,Ln),this.text="__sceneObject",this.valueOf=()=>{return Vn(e=this,t=Ln,"read from private field"),n?n.call(e):t.get(e);var e,t,n},((e,t,n)=>{Vn(e,t,"write to private field"),t.set(e,n)})(this,Ln,e)}toString(){}get value(){return this}}function Nn(e){return function(e){const t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(!t)return!1;const n=parseInt(t[1],10),r=parseInt(t[2],10),a=parseInt(t[3],10);return 11===n?0===r&&a>=4||1===r&&a>=2||r>1:10===n?4===r&&a>=8||r>=5:n>11}(s.config.buildInfo.version)?new Fn(e):{value:e,text:"__sceneObject"}}function $n(e){const{model:t}=e,n=(0,Bt.useTheme2)(),r=jn(n),a=(0,Bt.getInputStyles)({theme:n,invalid:!1}),i=(0,I.isArray)(t.state.value)?t.state.value:t.state.value?[t.state.value]:[];let o=[];return i&&i.length&&o.push(h().createElement(Bt.IconButton,{"aria-label":(0,Ze.t)("grafana-scenes.variables.default-group-by-custom-indicator-container.aria-label-clear","clear"),key:"clear",name:"times",size:"md",className:r.clearIcon,onClick:e=>{t.changeValueTo([],void 0,!0),t.checkIfRestorable([])&&t.setState({restorable:!0})}})),t.state.restorable&&o.push(h().createElement(Bt.IconButton,{onClick:t=>{e.model.restoreDefaultValues()},onKeyDownCapture:t=>{"Enter"===t.key&&e.model.restoreDefaultValues()},key:"restore",name:"history",size:"md",className:r.clearIcon,tooltip:(0,Ze.t)("grafana-scenes.variables.default-group-by-custom-indicator-container.tooltip-restore-groupby-set-by-this-dashboard","Restore groupby set by this dashboard.")})),t.state.restorable||o.push(h().createElement(Bt.Tooltip,{key:"tooltip",content:(0,Ze.t)("grafana-scenes.variables.default-group-by-custom-indicator-container.tooltip","Applied by default in this dashboard. If edited, it carries over to other dashboards."),placement:"bottom"},h().createElement(Bt.Icon,{name:"info-circle",size:"md"}))),h().createElement("div",{onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},className:(0,Xt.cx)(a.suffix,(0,Xt.css)({position:"relative"}))},o)}Ln=new WeakMap;const jn=e=>({clearIcon:(0,Xt.css)({color:e.colors.action.disabledText,cursor:"pointer","&:hover:before":{backgroundColor:"transparent"},"&:hover":{color:e.colors.text.primary}})}),Bn=({keysApplicability:e,children:t})=>{var n,r;const a=(0,Bt.useTheme2)(),i=(0,Bt.getSelectStyles)(a),{disabledPill:o,strikethrough:s}=sl(a),l=h().Children.toArray(t)[0];let u=!0;if(h().isValidElement(l)&&(null==(r=null==(n=l.props)?void 0:n.data)?void 0:r.value)){const t=l.props.data.value,n=null==e?void 0:e.find(e=>e.key===t);n&&!n.applicable&&(u=!1)}return h().createElement("div",{className:(0,Xt.cx)(i.multiValueContainer,!u&&(0,Xt.cx)(o,s))},t)};function zn(e){return"isInteractionTracker"in e}class Wn extends k{constructor(e={},t){super(e),this.renderProfiler=t,this.isInteractionTracker=!0,t&&(this.renderProfiler=t,this.renderProfiler.setInteractionCompleteHandler(e.onInteractionComplete))}startInteraction(e){var t;this.state.enableInteractionTracking&&(null==(t=this.renderProfiler)||t.startInteraction(e))}stopInteraction(){var e;null==(e=this.renderProfiler)||e.stopInteraction()}}function Hn(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(zn(e))return e;t=t.parent}}class Un extends wt{constructor(e){super({isMulti:!0,name:"",value:[],text:[],options:[],datasource:null,baseFilters:[],applyMode:"auto",layout:"horizontal",type:"groupby",...e,noValueOnClear:!0}),this.isLazy=!0,this._urlSync=new An(this),this._activationHandler=()=>(this._verifyApplicability(),this.state.defaultValue&&this.checkIfRestorable(this.state.value)&&this.setState({restorable:!0}),()=>{this.state.defaultValue&&this.restoreDefaultValues()}),this._getKeys=async e=>{var t,n,r;const a=await(null==(n=(t=this.state).getTagKeysProvider)?void 0:n.call(t,this,null));if(a&&a.replace)return a.values;if(this.state.defaultOptions)return this.state.defaultOptions.concat(al(null!=(r=null==a?void 0:a.values)?r:[]));if(!e.getTagKeys)return[];const i=Zs(this),o=this.state.baseFilters||[],s=Ml.getTimeRange(this).state.value,l=await e.getTagKeys({filters:o,queries:i,timeRange:s,scopes:Ml.getScopes(this),...In(this)});il(l)&&this.setState({error:l.error.message});let u=al(l);a&&(u=u.concat(al(a.values)));const c=this.state.tagKeyRegexFilter;return c&&(u=u.filter(e=>e.text.match(c))),u},this.state.defaultValue&&this.changeValueTo(this.state.defaultValue.value,this.state.defaultValue.text,!1),"auto"===this.state.applyMode&&this.addActivationHandler(()=>(jt.add(this),()=>jt.delete(this))),this.addActivationHandler(this._activationHandler)}validateAndUpdate(){return this.getValueOptions({}).pipe((0,f.map)(e=>(this._updateValueGivenNewOptions(e),{})))}_updateValueGivenNewOptions(e){const{value:t,text:n}=this.state,r={options:e,loading:!1,value:null!=t?t:[],text:null!=n?n:[]};this.setState(r)}getValueOptions(e){return this.state.defaultOptions?(0,f.of)(this.state.defaultOptions.map(e=>({label:e.text,value:String(e.value),group:e.group}))):(this.setState({loading:!0,error:null}),(0,f.from)(Lt(this.state.datasource,{__sceneObject:Nn(this)})).pipe((0,f.mergeMap)(e=>(0,f.from)(this._getKeys(e)).pipe((0,f.tap)(e=>{il(e)&&this.setState({error:e.error.message})}),(0,f.map)(e=>al(e)),(0,f.take)(1),(0,f.mergeMap)(e=>{const t=e.map(e=>({label:e.text,value:e.value?String(e.value):e.text,group:e.group}));return(0,f.of)(t)})))))}getApplicableKeys(){const{value:e,keysApplicability:t}=this.state,n=(0,I.isArray)(e)?e:e?[e]:[];if(!t||0===t.length)return n;return n.filter(e=>{const n=t.find(t=>t.key===e);return!n||!1!==n.applicable})}async _verifyApplicability(){const e=await Lt(this.state.datasource,{__sceneObject:Nn(this)});if(!e.getDrilldownsApplicability)return;const t=Zs(this),n=Ml.getTimeRange(this).state.value,r=this.state.value,a=await e.getDrilldownsApplicability({groupByKeys:Array.isArray(r)?r.map(e=>String(e)):r?[String(r)]:[],queries:t,timeRange:n,scopes:Ml.getScopes(this),...In(this)});(0,I.isEqual)(a,this.state.keysApplicability)||(this.setState({keysApplicability:null!=a?a:void 0}),this.publishEvent(new qe(this),!0))}checkIfRestorable(e){var t,n,r,a;const i=(0,I.isArray)(null==(t=this.state.defaultValue)?void 0:t.value)?null==(n=this.state.defaultValue)?void 0:n.value:(null==(r=this.state.defaultValue)?void 0:r.value)?[null==(a=this.state.defaultValue)?void 0:a.value]:[],o=(0,I.isArray)(e)?e:[e];return o.length!==i.length||!(0,I.isEqual)(o,i)}restoreDefaultValues(){this.setState({restorable:!1}),this.state.defaultValue&&this.changeValueTo(this.state.defaultValue.value,this.state.defaultValue.text,!0)}getDefaultMultiState(e){return{value:[],text:[]}}}Un.Component=function({model:e}){const{value:t,text:n,key:r,isMulti:a=!0,maxVisibleValues:i,noValueOnClear:o,options:s,includeAll:l,allowCustomValue:u=!0,defaultValue:c,keysApplicability:p}=e.useState(),m=(0,d.useMemo)(()=>{const e=(0,I.isArray)(t)?t:[t],r=(0,I.isArray)(n)?n:[n];return e.map((e,t)=>{var n;return{value:e,label:String(null!=(n=r[t])?n:e)}})},[t,n]),[g,v]=(0,d.useState)(!1),[b,y]=(0,d.useState)(!1),[w,S]=(0,d.useState)(""),[x,_]=(0,d.useState)(m),E=(0,d.useMemo)(()=>xn(s,l),[s,l]),C=void 0!==c;(0,d.useEffect)(()=>{_(m)},[m]);const R=(t,{action:n})=>"input-change"===n?(S(t),e.onSearchChange&&e.onSearchChange(t),t):"input-blur"===n?(S(""),""):w,O=(0,d.useMemo)(()=>ol(E(w).map(Gn)),[E,w]);return a?h().createElement(Bt.MultiSelect,{"aria-label":(0,Ze.t)("grafana-scenes.variables.group-by-variable-renderer.aria-label-group-by-selector","Group by selector"),"data-testid":`GroupBySelect-${r}`,id:r,placeholder:(0,Ze.t)("grafana-scenes.variables.group-by-variable-renderer.placeholder-group-by-label","Group by label"),width:"auto",allowCustomValue:u,inputValue:w,value:x,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,options:O,filterOption:qn,closeMenuOnSelect:!1,isOpen:b,isClearable:!0,hideSelectedOptions:!1,isLoading:g,components:{Option:Tn,...C?{IndicatorsContainer:()=>h().createElement($n,{model:e})}:{},MultiValueContainer:({innerProps:e,children:t})=>h().createElement(Bn,{innerProps:e,keysApplicability:p},t)},onInputChange:R,onBlur:()=>{e.changeValueTo(x.map(e=>e.value),x.map(e=>e.label),!0);const t=e.checkIfRestorable(x.map(e=>e.value));t!==e.state.restorable&&e.setState({restorable:t}),e._verifyApplicability()},onChange:(t,n)=>{"clear"===n.action&&o&&e.changeValueTo([],void 0,!0),_(t)},onOpenMenu:async()=>{const t=Hn(e);null==t||t.startInteraction($e),v(!0),await(0,f.lastValueFrom)(e.validateAndUpdate()),v(!1),y(!0),null==t||t.stopInteraction()},onCloseMenu:()=>{y(!1)}}):h().createElement(Bt.Select,{"aria-label":(0,Ze.t)("grafana-scenes.variables.group-by-variable-renderer.aria-label-group-by-selector","Group by selector"),"data-testid":`GroupBySelect-${r}`,id:r,placeholder:(0,Ze.t)("grafana-scenes.variables.group-by-variable-renderer.placeholder-group-by-label","Group by label"),width:"auto",inputValue:w,value:x&&x.length>0?x:null,allowCustomValue:u,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,options:O,filterOption:qn,closeMenuOnSelect:!0,isOpen:b,isClearable:!0,hideSelectedOptions:!1,noValueOnClear:!0,isLoading:g,onInputChange:R,onChange:(t,n)=>{if("clear"===n.action)return _([]),void(o&&e.changeValueTo([]));(null==t?void 0:t.value)&&(_([t]),e.changeValueTo([t.value],t.label?[t.label]:void 0))},onOpenMenu:async()=>{const t=Hn(e);null==t||t.startInteraction($e),v(!0),await(0,f.lastValueFrom)(e.validateAndUpdate()),v(!1),y(!0),null==t||t.stopInteraction()},onCloseMenu:()=>{y(!1)}})};const qn=()=>!0;function Gn(e){const{label:t,value:n,group:r}=e,a={label:t,value:n};return r&&(a.group=r),a}let Qn;const Kn=new Set;function Yn(e){return h().createElement(Bt.Tooltip,{content:(0,Ze.t)("grafana-scenes.utils.loading-indicator.content-cancel-query","Cancel query")},h().createElement(Bt.Icon,{className:"spin-clockwise",name:"sync",size:"xs",role:"button",onMouseDown:t=>{e.onCancel(t)}}))}function Xn(e){const t=(0,Bt.useStyles2)(Zn),n=(0,Bt.useTheme2)(),r="vertical"===e.layout,a=Boolean(e.isLoading)?h().createElement("div",{style:{marginLeft:n.spacing(1),marginTop:"-1px"},"aria-label":Yt.components.LoadingIndicator.icon},h().createElement(Yn,{onCancel:t=>{var n;t.preventDefault(),t.stopPropagation(),null==(n=e.onCancel)||n.call(e)}})):null;let i=null;e.error&&(i=h().createElement(Bt.Tooltip,{content:e.error,placement:"bottom"},h().createElement(Bt.Icon,{className:t.errorIcon,name:"exclamation-triangle"})));let o=null;e.description&&(o=h().createElement(Bt.Tooltip,{content:e.description,placement:r?"top":"bottom"},h().createElement(Bt.Icon,{className:t.normalIcon,name:"info-circle"})));const s="string"==typeof e.label?Yt.pages.Dashboard.SubMenu.submenuItemLabels(e.label):"";let l;return l=r?h().createElement("label",{className:(0,Xt.cx)(t.verticalLabel,e.className),"data-testid":s,htmlFor:e.htmlFor},e.prefix,e.label,o,i,e.icon&&h().createElement(Bt.Icon,{name:e.icon,className:t.normalIcon}),a,e.onRemove&&h().createElement(Bt.IconButton,{variant:"secondary",size:"xs",name:"times",onClick:e.onRemove,tooltip:(0,Ze.t)("grafana-scenes.utils.controls-label.tooltip-remove","Remove")}),e.suffix):h().createElement("label",{className:(0,Xt.cx)(t.horizontalLabel,e.className),"data-testid":s,htmlFor:e.htmlFor},e.prefix,i,e.icon&&h().createElement(Bt.Icon,{name:e.icon,className:t.normalIcon}),e.label,o,a,e.suffix),l}const Zn=e=>({horizontalLabel:(0,Xt.css)({background:e.isDark?e.colors.background.primary:e.colors.background.secondary,display:"flex",alignItems:"center",padding:e.spacing(0,1),fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.bodySmall.fontSize,height:e.spacing(e.components.height.md),lineHeight:e.spacing(e.components.height.md),borderRadius:`${e.shape.radius.default} 0 0 ${e.shape.radius.default}`,border:`1px solid ${e.components.input.borderColor}`,position:"relative",right:-1,whiteSpace:"nowrap",gap:e.spacing(.5)}),verticalLabel:(0,Xt.css)({display:"flex",alignItems:"center",fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.bodySmall.fontSize,lineHeight:e.typography.bodySmall.lineHeight,whiteSpace:"nowrap",marginBottom:e.spacing(.5),gap:e.spacing(1)}),errorIcon:(0,Xt.css)({color:e.colors.error.text}),normalIcon:(0,Xt.css)({color:e.colors.text.secondary})});function Jn(e){const t=e.map(e=>{var t;return null!=(t=e.label)?t:String(e.value)});return n=>Sn(e,t,n)}function er(e,t){return""!==e?{value:e,label:t||e}:null}const tr=()=>!0;function nr({filter:e,model:t}){var n,r,a,i,o;const s=(0,Bt.useStyles2)(rr),[l,u]=(0,d.useState)([]),[c,p]=(0,d.useState)([]),[f,m]=(0,d.useState)(!1),[g,v]=(0,d.useState)(!1),[b,y]=(0,d.useState)(!1),[w,S]=(0,d.useState)(!1),[x,_]=(0,d.useState)(!1),[E,C]=(0,d.useState)(""),[R,O]=(0,d.useState)(!1),[T,D]=(0,d.useState)(e.values?e.values.map((t,n)=>{var r;return er(t,null==(r=e.valueLabels)?void 0:r[n])}):[]),k=Ns(e.operator),A=er(e.key,e.keyLabel),P=er(e.value,null==(n=e.valueLabels)?void 0:n[0]),I=(0,d.useMemo)(()=>Jn(c),[c]),L=t.state.onAddCustomValue,M=(0,d.useMemo)(()=>ol(I(E)),[I,E]),V={isMulti:!0,value:T,components:{Option:Tn},hideSelectedOptions:!1,closeMenuOnSelect:!1,openMenuOnFocus:!1,onChange:e=>{D(e),e.some(e=>e.__isNew__)&&C("")},onBlur:()=>{var n,r;t._updateFilter(e,{value:null!=(r=null==(n=T[0])?void 0:n.value)?r:"",values:T.map(e=>e.value),valueLabels:T.map(e=>e.label)})}},F=ks.find(t=>e.operator===t.value),N=h().createElement(Bt.Select,{virtualized:!0,allowCustomValue:null==(r=t.state.allowCustomValue)||r,createOptionPosition:(null==F?void 0:F.isRegex)?"first":"last",isValidNewOption:e=>e.trim().length>0,allowCreateWhileLoading:!0,formatCreateLabel:e=>`Use custom value: ${e}`,disabled:t.state.readOnly,className:(0,Xt.cx)(s.value,w?s.widthWhenOpen:void 0),width:"auto",value:P,filterOption:tr,placeholder:(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-renderer.value-select.placeholder-select-value","Select value"),options:M,inputValue:E,onInputChange:(e,{action:t})=>("input-change"===t&&C(e),e),onChange:n=>{L&&n.__isNew__?t._updateFilter(e,L(n,e)):t._updateFilter(e,{value:n.value,valueLabels:n.label?[n.label]:[n.value]}),R!==n.__isNew__&&O(n.__isNew__)},isOpen:w&&!g,isLoading:g,openMenuOnFocus:!0,onOpenMenu:async()=>{var n;v(!0),S(!0);const r=await t._getValuesFor(e);v(!1),p(r),R&&C(null!=(n=null==P?void 0:P.label)?n:"")},onCloseMenu:()=>{S(!1),C("")},...k&&V}),$=h().createElement(Bt.Select,{key:""+(g?"loading":"loaded"),disabled:t.state.readOnly,className:(0,Xt.cx)(s.key,b?s.widthWhenOpen:void 0),width:"auto",allowCustomValue:null==(a=t.state.allowCustomValue)||a,createOptionPosition:(null==F?void 0:F.isRegex)?"first":"last",value:A,placeholder:(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-renderer.key-select.placeholder-select-label","Select label"),options:ol(l),onChange:n=>{t._updateFilter(e,{key:n.value,keyLabel:n.label,value:"",valueLabels:[""],values:void 0}),D([])},autoFocus:""===e.key,isOpen:b&&!f,isLoading:f,onOpenMenu:async()=>{y(!0),m(!0);const n=await t._getKeys(e.key);m(!1),u(n)},onCloseMenu:()=>{y(!1)},onBlur:()=>{""===e.key&&t._removeFilter(e)},openMenuOnFocus:!0}),j=h().createElement(Bt.Select,{className:(0,Xt.cx)(s.operator,{[s.widthWhenOpen]:x}),value:e.operator,disabled:t.state.readOnly,options:t._getOperators(),onChange:n=>{var r,a;const i=e.operator,o=n.value,s={operator:o};Ns(i)&&!Ns(o)?(s.value="",s.valueLabels=[""],s.values=void 0,D([])):!Ns(i)&&Ns(o)&&e.value&&(s.values=[e.value],D([{value:e.value,label:null!=(a=null==(r=e.valueLabels)?void 0:r[0])?a:e.value}])),t._updateFilter(e,s)},onOpenMenu:()=>{_(!0)},onCloseMenu:()=>{_(!1)}});if("vertical"===t.state.layout){if(e.key){const n=h().createElement(Xn,{layout:"vertical",label:null!=(i=e.key)?i:"",onRemove:()=>t._removeFilter(e)});return h().createElement(Bt.Field,{label:n,"data-testid":`AdHocFilter-${e.key}`,className:s.field},h().createElement("div",{className:s.wrapper},j,N))}return h().createElement(Bt.Field,{label:(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-renderer.label-select-label","Select label"),"data-testid":`AdHocFilter-${e.key}`,className:s.field},$)}return h().createElement("div",{className:s.wrapper,"data-testid":`AdHocFilter-${e.key}`},$,j,N,h().createElement(Bt.Button,{variant:"secondary","aria-label":(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-renderer.aria-label-remove-filter","Remove filter"),title:(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-renderer.title-remove-filter","Remove filter"),className:s.removeButton,icon:"times","data-testid":`AdHocFilter-remove-${null!=(o=e.key)?o:""}`,onClick:()=>t._removeFilter(e)}))}const rr=e=>({field:(0,Xt.css)({marginBottom:0}),wrapper:(0,Xt.css)({display:"flex","> *":{"&:not(:first-child)":{marginLeft:-1},"&:first-child":{borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-child":{borderTopLeftRadius:0,borderBottomLeftRadius:0},"&:not(:first-child):not(:last-child)":{borderRadius:0},position:"relative",zIndex:0,"&:hover":{zIndex:1},"&:focus-within":{zIndex:2}}}),widthWhenOpen:(0,Xt.css)({minWidth:e.spacing(16)}),value:(0,Xt.css)({flexBasis:"content",flexShrink:1,minWidth:"90px"}),key:(0,Xt.css)({flexBasis:"content",minWidth:"90px",flexShrink:1}),operator:(0,Xt.css)({flexShrink:0,flexBasis:"content"}),removeButton:(0,Xt.css)({paddingLeft:e.spacing(1.5),paddingRight:e.spacing(1.5),borderLeft:"none",width:e.spacing(3),marginRight:e.spacing(1),boxSizing:"border-box",position:"relative",left:"1px"})});function ar({model:e,addFilterButtonText:t}){const{_wip:n}=e.useState();return n?h().createElement(nr,{filter:n,model:e}):h().createElement(Bt.Button,{variant:"secondary",icon:"plus",title:(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-builder.title-add-filter","Add filter"),"aria-label":(0,Ze.t)("grafana-scenes.variables.ad-hoc-filter-builder.aria-label-add-filter","Add filter"),"data-testid":"AdHocFilter-add",onClick:()=>e._addWip()},t)}class ir{constructor(e){this._variable=e}getKey(){return`var-${this._variable.state.name}`}getKeys(){return[this.getKey()]}getUrlState(){const e=this._variable.state.filters,t=this._variable.state.originFilters;let n=[];return 0===e.length&&0===(null==t?void 0:t.length)?{[this.getKey()]:[""]}:(e.length&&n.push(...e.filter(Vs).filter(e=>!e.hidden).map(e=>or(e).map(tl).join("|"))),(null==t?void 0:t.length)&&n.push(...null==t?void 0:t.filter(Vs).filter(e=>!e.hidden&&e.origin&&e.restorable).map(e=>or(e).map(tl).join("|").concat(`#${e.origin}#restorable`))),{[this.getKey()]:n.length?n:[""]})}updateFromUrl(e){const t=e[this.getKey()];if(null==t)return;const n=function(e){if(Array.isArray(e)){return e.map(sr).filter(lr)}const t=sr(e);return null===t?[]:[t]}(t),r=function(e,t){const n=[...e];for(let r=0;r<t.length;r++){const a=e.findIndex(e=>e.key===t[r].key);a>-1&&t[r].origin===e[a].origin?(Ms(t[r])&&(t[r].matchAllFilter=!0),n[a]=t[r]):"dashboard"===t[r].origin?(delete t[r].origin,delete t[r].restorable):-1===a&&"scope"===t[r].origin&&t[r].restorable&&n.push(t[r])}return n}([...this._variable.state.originFilters||[]],n);this._variable.setState({filters:n.filter(e=>!e.origin),originFilters:r})}}function or(e){var t;const n=[rl(e.key,e.keyLabel),e.operator];return Ns(e.operator)?e.values.forEach((t,r)=>{var a;n.push(rl(t,null==(a=e.valueLabels)?void 0:a[r]))}):n.push(rl(e.value,null==(t=e.valueLabels)?void 0:t[0])),n}function sr(e){if("string"!=typeof e||0===e.length)return null;const[t,n,r]=e.split("#"),[a,i,o,s,...l]=t.split("|").reduce((e,t)=>{const[n,r]=t.split(",");return e.push(n,null!=r?r:n),e},[]).map(nl);return{key:a,keyLabel:i,operator:o,value:l[0],values:Ns(o)?l.filter((e,t)=>t%2==0):void 0,valueLabels:l.filter((e,t)=>t%2==1),condition:"",...(u=n,("scope"===u||"dashboard"===u)&&{origin:n}),...!!r&&{restorable:!0}};var u}function lr(e){return null!==e&&"string"==typeof e.key&&"string"==typeof e.value}function ur(){return"undefined"!=typeof window}function cr(e){return hr(e)?(e.nodeName||"").toLowerCase():"#document"}function dr(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function pr(e){var t;return null==(t=(hr(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function hr(e){return!!ur()&&(e instanceof Node||e instanceof dr(e).Node)}function fr(e){return!!ur()&&(e instanceof Element||e instanceof dr(e).Element)}function mr(e){return!!ur()&&(e instanceof HTMLElement||e instanceof dr(e).HTMLElement)}function gr(e){return!(!ur()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof dr(e).ShadowRoot)}const vr=new Set(["inline","contents"]);function br(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=kr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!vr.has(a)}const yr=new Set(["table","td","th"]);function wr(e){return yr.has(cr(e))}const Sr=[":popover-open",":modal"];function xr(e){return Sr.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const _r=["transform","translate","scale","rotate","perspective"],Er=["transform","translate","scale","rotate","perspective","filter"],Cr=["paint","layout","strict","content"];function Rr(e){const t=Or(),n=fr(e)?kr(e):e;return _r.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Er.some(e=>(n.willChange||"").includes(e))||Cr.some(e=>(n.contain||"").includes(e))}function Or(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Tr=new Set(["html","body","#document"]);function Dr(e){return Tr.has(cr(e))}function kr(e){return dr(e).getComputedStyle(e)}function Ar(e){return fr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pr(e){if("html"===cr(e))return e;const t=e.assignedSlot||e.parentNode||gr(e)&&e.host||pr(e);return gr(t)?t.host:t}function Ir(e){const t=Pr(e);return Dr(t)?e.ownerDocument?e.ownerDocument.body:e.body:mr(t)&&br(t)?t:Ir(t)}function Lr(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const a=Ir(e),i=a===(null==(r=e.ownerDocument)?void 0:r.body),o=dr(a);if(i){const e=Mr(o);return t.concat(o,o.visualViewport||[],br(a)?a:[],e&&n?Lr(e):[])}return t.concat(a,Lr(a,[],n))}function Mr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Vr(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function Fr(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&gr(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Nr(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function $r(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent}function jr(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Wr()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function Br(e){return!$r().includes("jsdom/")&&(!Wr()&&0===e.width&&0===e.height||Wr()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function zr(){return/apple/i.test(navigator.vendor)}function Wr(){const e=/android/i;return e.test(Nr())||e.test($r())}function Hr(e){return(null==e?void 0:e.ownerDocument)||document}function Ur(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function qr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gr(e){e.preventDefault(),e.stopPropagation()}function Qr(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return mr(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}const Kr=Math.min,Yr=Math.max,Xr=Math.round,Zr=Math.floor,Jr=e=>({x:e,y:e}),ea={left:"right",right:"left",bottom:"top",top:"bottom"},ta={start:"end",end:"start"};function na(e,t){return"function"==typeof e?e(t):e}function ra(e){return e.split("-")[0]}function aa(e){return e.split("-")[1]}function ia(e){return"y"===e?"height":"width"}const oa=new Set(["top","bottom"]);function sa(e){return oa.has(ra(e))?"y":"x"}function la(e){return"x"===sa(e)?"y":"x"}function ua(e){return e.replace(/start|end/g,e=>ta[e])}const ca=["left","right"],da=["right","left"],pa=["top","bottom"],ha=["bottom","top"];function fa(e,t,n,r){const a=aa(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?da:ca:t?ca:da;case"left":case"right":return t?pa:ha;default:return[]}}(ra(e),"start"===n,r);return a&&(i=i.map(e=>e+"-"+a),t&&(i=i.concat(i.map(ua)))),i}function ma(e){return e.replace(/left|right|bottom|top/g,e=>ea[e])}function ga(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}var va=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ba=va.join(","),ya="undefined"==typeof Element,wa=ya?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Sa=!ya&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},xa=function e(t,n){var r;void 0===n&&(n=!0);var a=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===a||"true"===a||n&&t&&e(t.parentNode)},_a=function(e,t,n){if(xa(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ba));return t&&wa.call(e,ba)&&r.unshift(e),r=r.filter(n)},Ea=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var o=i.shift();if(!xa(o,!1))if("SLOT"===o.tagName){var s=o.assignedElements(),l=e(s.length?s:o.children,!0,r);r.flatten?a.push.apply(a,l):a.push({scopeParent:o,candidates:l})}else{wa.call(o,ba)&&r.filter(o)&&(n||!t.includes(o))&&a.push(o);var u=o.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(o),c=!xa(u,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(u&&c){var d=e(!0===u?o.children:u.children,!0,r);r.flatten?a.push.apply(a,d):a.push({scopeParent:o,candidates:d})}else i.unshift.apply(i,o.children)}}return a},Ca=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ra=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Ca(e)?0:e.tabIndex},Oa=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ta=function(e){return"INPUT"===e.tagName},Da=function(e){return function(e){return Ta(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Sa(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var a=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!a||a===e}(e)},ka=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Aa=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var a=wa.call(e,"details>summary:first-of-type")?e.parentElement:e;if(wa.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return ka(e)}else{if("function"==typeof r){for(var i=e;e;){var o=e.parentElement,s=Sa(e);if(o&&!o.shadowRoot&&!0===r(o))return ka(e);e=e.assignedSlot?e.assignedSlot:o||s===e.ownerDocument?o:s.host}e=i}if(function(e){var t,n,r,a,i=e&&Sa(e),o=null===(t=i)||void 0===t?void 0:t.host,s=!1;if(i&&i!==e)for(s=!!(null!==(n=o)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(o)||null!=e&&null!==(a=e.ownerDocument)&&void 0!==a&&a.contains(e));!s&&o;){var l,u,c;s=!(null===(u=o=null===(l=i=Sa(o))||void 0===l?void 0:l.host)||void 0===u||null===(c=u.ownerDocument)||void 0===c||!c.contains(o))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Pa=function(e,t){return!(t.disabled||xa(t)||function(e){return Ta(e)&&"hidden"===e.type}(t)||Aa(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some(function(e){return"SUMMARY"===e.tagName})}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!wa.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ia=function(e,t){return!(Da(t)||Ra(t)<0||!Pa(e,t))},La=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ma=function e(t){var n=[],r=[];return t.forEach(function(t,a){var i=!!t.scopeParent,o=i?t.scopeParent:t,s=function(e,t){var n=Ra(e);return n<0&&t&&!Ca(e)?0:n}(o,i),l=i?e(t.candidates):o;0===s?i?n.push.apply(n,l):n.push(o):r.push({documentOrder:a,tabIndex:s,item:t,isScope:i,content:l})}),r.sort(Oa).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(n)},Va=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Ea([e],t.includeContainer,{filter:Ia.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:La}):_a(e,t.includeContainer,Ia.bind(null,t)),Ma(n)},Fa=n(8398);function Na(e,t,n){let{reference:r,floating:a}=e;const i=sa(t),o=la(t),s=ia(o),l=ra(t),u="y"===i,c=r.x+r.width/2-a.width/2,d=r.y+r.height/2-a.height/2,p=r[s]/2-a[s]/2;let h;switch(l){case"top":h={x:c,y:r.y-a.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-a.width,y:d};break;default:h={x:r.x,y:r.y}}switch(aa(t)){case"start":h[o]-=p*(n&&u?-1:1);break;case"end":h[o]+=p*(n&&u?-1:1)}return h}async function $a(e,t){var n;void 0===t&&(t={});const{x:r,y:a,platform:i,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=na(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(h),m=s[p?"floating"===d?"reference":"floating":d],g=ga(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),v="floating"===d?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=ga(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:b,strategy:l}):v);return{top:(g.top-w.top+f.top)/y.y,bottom:(w.bottom-g.bottom+f.bottom)/y.y,left:(g.left-w.left+f.left)/y.x,right:(w.right-g.right+f.right)/y.x}}const ja=new Set(["left","top"]);function Ba(e){const t=kr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=mr(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,s=Xr(n)!==i||Xr(r)!==o;return s&&(n=i,r=o),{width:n,height:r,$:s}}function za(e){return fr(e)?e:e.contextElement}function Wa(e){const t=za(e);if(!mr(t))return Jr(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=Ba(t);let o=(i?Xr(n.width):n.width)/r,s=(i?Xr(n.height):n.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}const Ha=Jr(0);function Ua(e){const t=dr(e);return Or()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Ha}function qa(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const a=e.getBoundingClientRect(),i=za(e);let o=Jr(1);t&&(r?fr(r)&&(o=Wa(r)):o=Wa(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==dr(e))&&t}(i,n,r)?Ua(i):Jr(0);let l=(a.left+s.x)/o.x,u=(a.top+s.y)/o.y,c=a.width/o.x,d=a.height/o.y;if(i){const e=dr(i),t=r&&fr(r)?dr(r):r;let n=e,a=Mr(n);for(;a&&r&&t!==n;){const e=Wa(a),t=a.getBoundingClientRect(),r=kr(a),i=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,c*=e.x,d*=e.y,l+=i,u+=o,n=dr(a),a=Mr(n)}}return ga({width:c,height:d,x:l,y:u})}function Ga(e,t){const n=Ar(e).scrollLeft;return t?t.left+n:qa(pr(e)).left+n}function Qa(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ga(e,n),y:n.top+t.scrollTop}}const Ka=new Set(["absolute","fixed"]);function Ya(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=dr(e),r=pr(e),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,s=0,l=0;if(a){i=a.width,o=a.height;const e=Or();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}const u=Ga(r);if(u<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-a);o<=25&&(i-=o)}else u<=25&&(i+=u);return{width:i,height:o,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=pr(e),n=Ar(e),r=e.ownerDocument.body,a=Yr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Yr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ga(e);const s=-n.scrollTop;return"rtl"===kr(r).direction&&(o+=Yr(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:s}}(pr(e));else if(fr(t))r=function(e,t){const n=qa(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=mr(e)?Wa(e):Jr(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:a*i.x,y:r*i.y}}(t,n);else{const n=Ua(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ga(r)}function Xa(e,t){const n=Pr(e);return!(n===t||!fr(n)||Dr(n))&&("fixed"===kr(n).position||Xa(n,t))}function Za(e,t,n){const r=mr(t),a=pr(t),i="fixed"===n,o=qa(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Jr(0);function u(){l.x=Ga(a)}if(r||!r&&!i)if(("body"!==cr(t)||br(a))&&(s=Ar(t)),r){const e=qa(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&u();i&&!r&&a&&u();const c=!a||r||i?Jr(0):Qa(a,s);return{x:o.left+s.scrollLeft-l.x-c.x,y:o.top+s.scrollTop-l.y-c.y,width:o.width,height:o.height}}function Ja(e){return"static"===kr(e).position}function ei(e,t){if(!mr(e)||"fixed"===kr(e).position)return null;if(t)return t(e);let n=e.offsetParent;return pr(e)===n&&(n=n.ownerDocument.body),n}function ti(e,t){const n=dr(e);if(xr(e))return n;if(!mr(e)){let t=Pr(e);for(;t&&!Dr(t);){if(fr(t)&&!Ja(t))return t;t=Pr(t)}return n}let r=ei(e,t);for(;r&&wr(r)&&Ja(r);)r=ei(r,t);return r&&Dr(r)&&Ja(r)&&!Rr(r)?n:r||function(e){let t=Pr(e);for(;mr(t)&&!Dr(t);){if(Rr(t))return t;if(xr(t))return null;t=Pr(t)}return null}(e)||n}const ni={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i="fixed"===a,o=pr(r),s=!!t&&xr(t.floating);if(r===o||s&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Jr(1);const c=Jr(0),d=mr(r);if((d||!d&&!i)&&(("body"!==cr(r)||br(o))&&(l=Ar(r)),mr(r))){const e=qa(r);u=Wa(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}const p=!o||d||i?Jr(0):Qa(o,l);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+p.x,y:n.y*u.y-l.scrollTop*u.y+c.y+p.y}},getDocumentElement:pr,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const i=[..."clippingAncestors"===n?xr(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Lr(e,[],!1).filter(e=>fr(e)&&"body"!==cr(e)),a=null;const i="fixed"===kr(e).position;let o=i?Pr(e):e;for(;fr(o)&&!Dr(o);){const t=kr(o),n=Rr(o);n||"fixed"!==t.position||(a=null),(i?!n&&!a:!n&&"static"===t.position&&a&&Ka.has(a.position)||br(o)&&!n&&Xa(e,o))?r=r.filter(e=>e!==o):a=t,o=Pr(o)}return t.set(e,r),r}(t,this._c):[].concat(n),r],o=i[0],s=i.reduce((e,n)=>{const r=Ya(t,n,a);return e.top=Yr(r.top,e.top),e.right=Kr(r.right,e.right),e.bottom=Kr(r.bottom,e.bottom),e.left=Yr(r.left,e.left),e},Ya(t,o,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:ti,getElementRects:async function(e){const t=this.getOffsetParent||ti,n=this.getDimensions,r=await n(e.floating);return{reference:Za(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ba(e);return{width:t,height:n}},getScale:Wa,isElement:fr,isRTL:function(e){return"rtl"===kr(e).direction}};function ri(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ai(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,u=za(e),c=a||i?[...u?Lr(u):[],...Lr(t)]:[];c.forEach(e=>{a&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const d=u&&s?function(e,t){let n,r=null;const a=pr(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const u=e.getBoundingClientRect(),{left:c,top:d,width:p,height:h}=u;if(s||t(),!p||!h)return;const f={rootMargin:-Zr(d)+"px "+-Zr(a.clientWidth-(c+p))+"px "+-Zr(a.clientHeight-(d+h))+"px "+-Zr(c)+"px",threshold:Yr(0,Kr(1,l))||1};let m=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!m)return o();r?o(!1,r):n=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==r||ri(u,e.getBoundingClientRect())||o(),m=!1}try{r=new IntersectionObserver(g,{...f,root:a.ownerDocument})}catch(e){r=new IntersectionObserver(g,f)}r.observe(e)}(!0),i}(u,n):null;let p,h=-1,f=null;o&&(f=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),n()}),u&&!l&&f.observe(u),f.observe(t));let m=l?qa(e):null;return l&&function t(){const r=qa(e);m&&!ri(m,r)&&n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;c.forEach(e=>{a&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const ii=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:o,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:a}=e,i=await(null==r.isRTL?void 0:r.isRTL(a.floating)),o=ra(n),s=aa(n),l="y"===sa(n),u=ja.has(o)?-1:1,c=i&&l?-1:1,d=na(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:f}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof f&&(h="end"===s?-1*f:f),l?{x:h*c,y:p*u}:{x:p*u,y:h*c}}(t,e);return o===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:a+l.x,y:i+l.y,data:{...l,placement:o}}}}},oi=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:s,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=na(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=ra(a),b=sa(s),y=ra(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(u.floating)),S=p||(y||!m?[ma(s)]:function(e){const t=ma(e);return[ua(e),t,ua(t)]}(s)),x="none"!==f;!p&&x&&S.push(...fa(s,m,f,w));const _=[s,...S],E=await $a(t,g),C=[];let R=(null==(r=i.flip)?void 0:r.overflows)||[];if(c&&C.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=aa(e),a=la(e),i=ia(a);let o="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ma(o)),[o,ma(o)]}(a,o,w);C.push(E[e[0]],E[e[1]])}if(R=[...R,{placement:a,overflows:C}],!C.every(e=>e<=0)){var O,T;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=_[e];if(t){if(!("alignment"===d&&b!==sa(t))||R.every(e=>sa(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:R},reset:{placement:t}}}let n=null==(T=R.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:T.placement;if(!n)switch(h){case"bestFit":{var D;const e=null==(D=R.filter(e=>{if(x){const t=sa(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:D[0];e&&(n=e);break}case"initialPlacement":n=s}if(a!==n)return{reset:{placement:n}}}return{}}}},si=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:o,elements:s}=t,{apply:l=()=>{},...u}=na(e,t),c=await $a(t,u),d=ra(a),p=aa(a),h="y"===sa(a),{width:f,height:m}=i.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=p===(await(null==o.isRTL?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(v=d,g="end"===p?"top":"bottom");const b=m-c.top-c.bottom,y=f-c.left-c.right,w=Kr(m-c[g],b),S=Kr(f-c[v],y),x=!t.middlewareData.shift;let _=w,E=S;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(E=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(_=b),x&&!p){const e=Yr(c.left,0),t=Yr(c.right,0),n=Yr(c.top,0),r=Yr(c.bottom,0);h?E=f-2*(0!==e||0!==t?e+t:Yr(c.left,c.right)):_=m-2*(0!==n||0!==r?n+r:Yr(c.top,c.bottom))}await l({...t,availableWidth:E,availableHeight:_});const C=await o.getDimensions(s.floating);return f!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},li=(e,t,n)=>{const r=new Map,a={platform:ni,...n},i={...a.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,s=i.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:c,y:d}=Na(u,r,l),p=r,h={},f=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:g,y:v,data:b,reset:y}=await m({x:c,y:d,initialPlacement:r,placement:p,strategy:a,middlewareData:h,rects:u,platform:o,elements:{reference:e,floating:t}});c=null!=g?g:c,d=null!=v?v:d,h={...h,[i]:{...h[i],...b}},y&&f<=50&&(f++,"object"==typeof y&&(y.placement&&(p=y.placement),y.rects&&(u=!0===y.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:c,y:d}=Na(u,p,l))),n=-1)}return{x:c,y:d,placement:p,strategy:a,middlewareData:h}})(e,t,{...a,platform:i})};var ui="undefined"!=typeof document?d.useLayoutEffect:function(){};function ci(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!ci(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!==r--;){const n=a[r];if(("_owner"!==n||!e.$$typeof)&&!ci(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function di(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pi(e,t){const n=di(e);return Math.round(t*n)/n}function hi(e){const t=d.useRef(e);return ui(()=>{t.current=e}),t}const fi=(e,t)=>({...oi(e),options:[e,t]}),mi=(e,t)=>({...si(e),options:[e,t]});const gi={...p},vi=gi.useInsertionEffect||(e=>e());function bi(e){const t=d.useRef(()=>{0});return vi(()=>{t.current=e}),d.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}const yi="ArrowUp",wi="ArrowDown",Si="ArrowLeft",xi="ArrowRight";function _i(e,t,n){return Math.floor(e/t)!==n}function Ei(e,t){return t<0||t>=e.current.length}function Ci(e,t){return Oi(e,{disabledIndices:t})}function Ri(e,t){return Oi(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Oi(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:a,amount:i=1}=void 0===t?{}:t;const o=e.current;let s=n;do{s+=r?-i:i}while(s>=0&&s<=o.length-1&&Pi(o,s,a));return s}function Ti(e,t){let{event:n,orientation:r,loop:a,rtl:i,cols:o,disabledIndices:s,minIndex:l,maxIndex:u,prevIndex:c,stopEvent:d=!1}=t,p=c;if(n.key===yi){if(d&&Gr(n),-1===c)p=u;else if(p=Oi(e,{startingIndex:p,amount:o,decrement:!0,disabledIndices:s}),a&&(c-o<l||p<0)){const e=c%o,t=u%o,n=u-(t-e);p=t===e?u:t>e?n:n-o}Ei(e,p)&&(p=c)}if(n.key===wi&&(d&&Gr(n),-1===c?p=l:(p=Oi(e,{startingIndex:c,amount:o,disabledIndices:s}),a&&c+o>u&&(p=Oi(e,{startingIndex:c%o-o,amount:o,disabledIndices:s}))),Ei(e,p)&&(p=c)),"both"===r){const t=Zr(c/o);n.key===(i?Si:xi)&&(d&&Gr(n),c%o!==o-1?(p=Oi(e,{startingIndex:c,disabledIndices:s}),a&&_i(p,o,t)&&(p=Oi(e,{startingIndex:c-c%o-1,disabledIndices:s}))):a&&(p=Oi(e,{startingIndex:c-c%o-1,disabledIndices:s})),_i(p,o,t)&&(p=c)),n.key===(i?xi:Si)&&(d&&Gr(n),c%o!==0?(p=Oi(e,{startingIndex:c,decrement:!0,disabledIndices:s}),a&&_i(p,o,t)&&(p=Oi(e,{startingIndex:c+(o-c%o),decrement:!0,disabledIndices:s}))):a&&(p=Oi(e,{startingIndex:c+(o-c%o),decrement:!0,disabledIndices:s})),_i(p,o,t)&&(p=c));const r=Zr(u/o)===t;Ei(e,p)&&(p=a&&r?n.key===(i?xi:Si)?u:Oi(e,{startingIndex:c-c%o-1,disabledIndices:s}):c)}return p}function Di(e,t,n){const r=[];let a=0;return e.forEach((e,i)=>{let{width:o,height:s}=e,l=!1;for(n&&(a=0);!l;){const e=[];for(let n=0;n<o;n++)for(let r=0;r<s;r++)e.push(a+n+r*t);a%t+o<=t&&e.every(e=>null==r[e])?(e.forEach(e=>{r[e]=i}),l=!0):a++}}),[...r]}function ki(e,t,n,r,a){if(-1===e)return-1;const i=n.indexOf(e),o=t[e];switch(a){case"tl":return i;case"tr":return o?i+o.width-1:i;case"bl":return o?i+(o.height-1)*r:i;case"br":return n.lastIndexOf(e)}}function Ai(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Pi(e,t,n){if(n)return n.includes(t);const r=e[t];return null==r||r.hasAttribute("disabled")||"true"===r.getAttribute("aria-disabled")}var Ii="undefined"!=typeof document?d.useLayoutEffect:d.useEffect;const Li=[Si,xi],Mi=[yi,wi];function Vi(){return Vi=Object.assign?Object.assign.bind():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},Vi.apply(this,arguments)}let Fi=!1,Ni=0;const $i=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ni++;const ji=gi.useId||function(){const[e,t]=d.useState(()=>Fi?$i():void 0);return Ii(()=>{null==e&&t($i())},[]),d.useEffect(()=>{Fi=!0},[]),e};function Bi(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}const zi=d.createContext(null),Wi=d.createContext(null),Hi=()=>{var e;return(null==(e=d.useContext(zi))?void 0:e.id)||null},Ui=()=>d.useContext(Wi);function qi(e){return"data-floating-ui-"+e}function Gi(e){const t=(0,d.useRef)(e);return Ii(()=>{t.current=e}),t}let Qi=0;function Ki(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:a=!1}=t;r&&cancelAnimationFrame(Qi);const i=()=>null==e?void 0:e.focus({preventScroll:n});a?i():Qi=requestAnimationFrame(i)}function Yi(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}let Xi=new WeakMap,Zi=new WeakSet,Ji={},eo=0;const to=e=>e&&(e.host||to(e.parentNode));function no(e,t,n,r){const a="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,o=(s=t,e.map(e=>{if(s.contains(e))return e;const t=to(e);return s.contains(t)?t:null}).filter(e=>null!=e));var s;const l=new Set,u=new Set(o),c=[];Ji[a]||(Ji[a]=new WeakMap);const d=Ji[a];return o.forEach(function e(t){if(!t||l.has(t))return;l.add(t),t.parentNode&&e(t.parentNode)}),function e(t){if(!t||u.has(t))return;[].forEach.call(t.children,t=>{if("script"!==cr(t))if(l.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(Xi.get(t)||0)+1,o=(d.get(t)||0)+1;Xi.set(t,r),d.set(t,o),c.push(t),1===r&&n&&Zi.add(t),1===o&&t.setAttribute(a,""),!n&&i&&t.setAttribute(i,"true")}})}(t),l.clear(),eo++,()=>{c.forEach(e=>{const t=(Xi.get(e)||0)-1,n=(d.get(e)||0)-1;Xi.set(e,t),d.set(e,n),t||(!Zi.has(e)&&i&&e.removeAttribute(i),Zi.delete(e)),n||e.removeAttribute(a)}),eo--,eo||(Xi=new WeakMap,Xi=new WeakMap,Zi=new WeakSet,Ji={})}}function ro(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=Hr(e[0]).body;return no(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const ao=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function io(e,t){const n=Va(e,ao());"prev"===t&&n.reverse();const r=n.indexOf(Vr(Hr(e)));return n.slice(r+1)[0]}function oo(){return io(document.body,"next")}function so(){return io(document.body,"prev")}function lo(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Fr(n,r)}function uo(e){Va(e,ao()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function co(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}const po={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ho(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const fo=d.forwardRef(function(e,t){const[n,r]=d.useState();Ii(()=>(zr()&&r("button"),document.addEventListener("keydown",ho),()=>{document.removeEventListener("keydown",ho)}),[]);const a={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[qi("focus-guard")]:"",style:po};return d.createElement("span",Vi({},e,a))}),mo=d.createContext(null),go=qi("portal");function vo(e){const{children:t,id:n,root:r,preserveTabOrder:a=!0}=e,i=function(e){void 0===e&&(e={});const{id:t,root:n}=e,r=ji(),a=bo(),[i,o]=d.useState(null),s=d.useRef(null);return Ii(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{s.current=null})},[i]),Ii(()=>{if(!r)return;if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(go,""),e.appendChild(n),s.current=n,o(n)},[t,r]),Ii(()=>{if(null===n)return;if(!r)return;if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!fr(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const l=document.createElement("div");l.id=r,l.setAttribute(go,""),e=i||e,e.appendChild(l),s.current=l,o(l)},[t,n,r,a]),i}({id:n,root:r}),[o,s]=d.useState(null),l=d.useRef(null),u=d.useRef(null),c=d.useRef(null),p=d.useRef(null),h=null==o?void 0:o.modal,f=null==o?void 0:o.open,m=!!o&&!o.modal&&o.open&&a&&!(!r&&!i);return d.useEffect(()=>{if(i&&a&&!h)return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&lo(e)){("focusin"===e.type?co:uo)(i)}}},[i,a,h]),d.useEffect(()=>{i&&(f||co(i))},[f,i]),d.createElement(mo.Provider,{value:d.useMemo(()=>({preserveTabOrder:a,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:p,portalNode:i,setFocusManagerState:s}),[a,i])},m&&i&&d.createElement(fo,{"data-type":"outside",ref:l,onFocus:e=>{if(lo(e,i)){var t;null==(t=c.current)||t.focus()}else{const e=so()||(null==o?void 0:o.refs.domReference.current);null==e||e.focus()}}}),m&&i&&d.createElement("span",{"aria-owns":i.id,style:po}),i&&Fa.createPortal(t,i),m&&i&&d.createElement(fo,{"data-type":"outside",ref:u,onFocus:e=>{if(lo(e,i)){var t;null==(t=p.current)||t.focus()}else{const t=oo()||(null==o?void 0:o.refs.domReference.current);null==t||t.focus(),(null==o?void 0:o.closeOnFocusOut)&&(null==o||o.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const bo=()=>d.useContext(mo),yo="data-floating-ui-focusable";function wo(e){return e?e.hasAttribute(yo)?e:e.querySelector("["+yo+"]")||e:null}let So=[];function xo(e){So=So.filter(e=>e.isConnected);let t=e;if(t&&"body"!==cr(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==wa.call(e,ba)&&Ia(t,e)}(t,ao())){const e=Va(t,ao())[0];e&&(t=e)}So.push(t),So.length>20&&(So=So.slice(-20))}}function _o(){return So.slice().reverse().find(e=>e.isConnected)}const Eo=d.forwardRef(function(e,t){return d.createElement("button",Vi({},e,{type:"button",ref:t,tabIndex:-1,style:po}))});function Co(e){const{context:t,children:n,disabled:r=!1,order:a=["content"],guards:i=!0,initialFocus:o=0,returnFocus:s=!0,restoreFocus:l=!1,modal:u=!0,visuallyHiddenDismiss:c=!1,closeOnFocusOut:p=!0}=e,{open:h,refs:f,nodeId:m,onOpenChange:g,events:v,dataRef:b,floatingId:y,elements:{domReference:w,floating:S}}=t,x="number"==typeof o&&o<0,_=Qr(w)&&x,E="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||i,C=Gi(a),R=Gi(o),O=Gi(s),T=Ui(),D=bo(),k=d.useRef(null),A=d.useRef(null),P=d.useRef(!1),I=d.useRef(!1),L=d.useRef(-1),M=null!=D,V=wo(S),F=bi(function(e){return void 0===e&&(e=V),e?Va(e,ao()):[]}),N=bi(e=>{const t=F(e);return C.current.map(e=>w&&"reference"===e?w:V&&"floating"===e?V:t).filter(Boolean).flat()});function $(e){return!r&&c&&u?d.createElement(Eo,{ref:"start"===e?k:A,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof c?c:"Dismiss"):null}d.useEffect(()=>{if(r)return;if(!u)return;function e(e){if("Tab"===e.key){Fr(V,Vr(Hr(V)))&&0===F().length&&!_&&Gr(e);const t=N(),n=qr(e);"reference"===C.current[0]&&n===w&&(Gr(e),e.shiftKey?Ki(t[t.length-1]):Ki(t[1])),"floating"===C.current[1]&&n===V&&e.shiftKey&&(Gr(e),Ki(t[0]))}}const t=Hr(V);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,w,V,u,C,_,F,N]),d.useEffect(()=>{if(!r&&S)return S.addEventListener("focusin",e),()=>{S.removeEventListener("focusin",e)};function e(e){const t=qr(e),n=F().indexOf(t);-1!==n&&(L.current=n)}},[r,S,F]),d.useEffect(()=>{if(!r&&p)return S&&mr(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),S.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),S.removeEventListener("focusout",t)}):void 0;function e(){I.current=!0,setTimeout(()=>{I.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(Fr(w,t)||Fr(S,t)||Fr(t,S)||Fr(null==D?void 0:D.portalNode,t)||null!=t&&t.hasAttribute(qi("focus-guard"))||T&&(Yi(T.nodesRef.current,m).find(e=>{var n,r;return Fr(null==(n=e.context)?void 0:n.elements.floating,t)||Fr(null==(r=e.context)?void 0:r.elements.domReference,t)})||function(e,t){var n;let r=[],a=null==(n=e.find(e=>e.id===t))?void 0:n.parentId;for(;a;){const t=e.find(e=>e.id===a);a=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(T.nodesRef.current,m).find(e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t})));if(l&&n&&Vr(Hr(V))===Hr(V).body){mr(V)&&V.focus();const e=L.current,t=F(),n=t[e]||t[t.length-1]||V;mr(n)&&n.focus()}!_&&u||!t||!n||I.current||t===_o()||(P.current=!0,g(!1,e,"focus-out"))})}},[r,w,S,V,u,m,T,D,g,p,l,F,_]),d.useEffect(()=>{var e;if(r)return;const t=Array.from((null==D||null==(e=D.portalNode)?void 0:e.querySelectorAll("["+qi("portal")+"]"))||[]);if(S){const e=[S,...t,k.current,A.current,C.current.includes("reference")||_?w:null].filter(e=>null!=e),n=u||_?ro(e,E,!E):ro(e);return()=>{n()}}},[r,w,S,u,C,D,_,E]),Ii(()=>{if(r||!mr(V))return;const e=Vr(Hr(V));queueMicrotask(()=>{const t=N(V),n=R.current,r=("number"==typeof n?t[n]:n.current)||V,a=Fr(V,e);x||a||!h||Ki(r,{preventScroll:r===V})})},[r,h,V,x,N,R]),Ii(()=>{if(r||!V)return;let e=!1;const t=Hr(V),n=Vr(t);let a=b.current.openEvent;function i(t){let{open:n,reason:r,event:i,nested:o}=t;n&&(a=i),"escape-key"===r&&f.domReference.current&&xo(f.domReference.current),"hover"===r&&"mouseleave"===i.type&&(P.current=!0),"outside-press"===r&&(o?(P.current=!1,e=!0):P.current=!(jr(i)||Br(i)))}xo(n),v.on("openchange",i);const o=t.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,po),M&&w&&w.insertAdjacentElement("afterend",o),()=>{v.off("openchange",i);const n=Vr(t),r=Fr(S,n)||T&&Yi(T.nodesRef.current,m).some(e=>{var t;return Fr(null==(t=e.context)?void 0:t.elements.floating,n)});(r||a&&["click","mousedown"].includes(a.type))&&f.domReference.current&&xo(f.domReference.current);const s="boolean"==typeof O.current?_o()||o:O.current.current||o;queueMicrotask(()=>{O.current&&!P.current&&mr(s)&&(s===n||n===t.body||r)&&s.focus({preventScroll:e}),o.remove()})}},[r,S,V,O,b,f,v,T,m,M,w]),d.useEffect(()=>{queueMicrotask(()=>{P.current=!1})},[r]),Ii(()=>{if(!r&&D)return D.setFocusManagerState({modal:u,closeOnFocusOut:p,open:h,onOpenChange:g,refs:f}),()=>{D.setFocusManagerState(null)}},[r,D,u,h,g,f,p]),Ii(()=>{if(r)return;if(!V)return;if("function"!=typeof MutationObserver)return;if(x)return;const e=()=>{const e=V.getAttribute("tabindex"),t=F(),n=Vr(Hr(S)),r=t.indexOf(n);-1!==r&&(L.current=r),C.current.includes("floating")||n!==f.domReference.current&&0===t.length?"0"!==e&&V.setAttribute("tabindex","0"):"-1"!==e&&V.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(V,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,S,V,f,C,F,x]);const j=!r&&E&&(!u||!_)&&(M||u);return d.createElement(d.Fragment,null,j&&d.createElement(fo,{"data-type":"inside",ref:null==D?void 0:D.beforeInsideRef,onFocus:e=>{if(u){const e=N();Ki("reference"===a[0]?e[0]:e[e.length-1])}else if(null!=D&&D.preserveTabOrder&&D.portalNode)if(P.current=!1,lo(e,D.portalNode)){const e=oo()||w;null==e||e.focus()}else{var t;null==(t=D.beforeOutsideRef.current)||t.focus()}}}),!_&&$("start"),n,$("end"),j&&d.createElement(fo,{"data-type":"inside",ref:null==D?void 0:D.afterInsideRef,onFocus:e=>{if(u)Ki(N()[0]);else if(null!=D&&D.preserveTabOrder&&D.portalNode)if(p&&(P.current=!0),lo(e,D.portalNode)){const e=so()||w;null==e||e.focus()}else{var t;null==(t=D.afterOutsideRef.current)||t.focus()}}}))}const Ro={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Oo={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},To=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function Do(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,a=ji(),i=d.useRef({}),[o]=d.useState(()=>Bi()),s=null!=Hi(),[l,u]=d.useState(r.reference),c=bi((e,t,r)=>{i.current.openEvent=e?t:void 0,o.emit("openchange",{open:e,event:t,reason:r,nested:s}),null==n||n(e,t,r)}),p=d.useMemo(()=>({setPositionReference:u}),[]),h=d.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return d.useMemo(()=>({dataRef:i,open:t,onOpenChange:c,elements:h,events:o,floatingId:a,refs:p}),[t,c,h,o,a,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,a=r.elements,[i,o]=d.useState(null),[s,l]=d.useState(null),u=(null==a?void 0:a.domReference)||i,c=d.useRef(null),p=Ui();Ii(()=>{u&&(c.current=u)},[u]);const h=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[c,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=d.useState(r);ci(h,r)||f(r);const[m,g]=d.useState(null),[v,b]=d.useState(null),y=d.useCallback(e=>{e!==_.current&&(_.current=e,g(e))},[]),w=d.useCallback(e=>{e!==E.current&&(E.current=e,b(e))},[]),S=i||m,x=o||v,_=d.useRef(null),E=d.useRef(null),C=d.useRef(c),R=null!=l,O=hi(l),T=hi(a),D=hi(u),k=d.useCallback(()=>{if(!_.current||!E.current)return;const e={placement:t,strategy:n,middleware:h};T.current&&(e.platform=T.current),li(_.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};A.current&&!ci(C.current,t)&&(C.current=t,Fa.flushSync(()=>{p(t)}))})},[h,t,n,T,D]);ui(()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const A=d.useRef(!1);ui(()=>(A.current=!0,()=>{A.current=!1}),[]),ui(()=>{if(S&&(_.current=S),x&&(E.current=x),S&&x){if(O.current)return O.current(S,x,k);k()}},[S,x,k,O,R]);const P=d.useMemo(()=>({reference:_,floating:E,setReference:y,setFloating:w}),[y,w]),I=d.useMemo(()=>({reference:S,floating:x}),[S,x]),L=d.useMemo(()=>{const e={position:n,left:0,top:0};if(!I.floating)return e;const t=pi(I.floating,c.x),r=pi(I.floating,c.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...di(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,s,I.floating,c.x,c.y]);return d.useMemo(()=>({...c,update:k,refs:P,elements:I,floatingStyles:L}),[c,k,P,I,L])}({...e,elements:{...a,...s&&{reference:s}}}),f=d.useCallback(e=>{const t=fr(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l(t),h.refs.setReference(t)},[h.refs]),m=d.useCallback(e=>{(fr(e)||null===e)&&(c.current=e,o(e)),(fr(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!fr(e))&&h.refs.setReference(e)},[h.refs]),g=d.useMemo(()=>({...h.refs,setReference:m,setPositionReference:f,domReference:c}),[h.refs,m,f]),v=d.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),b=d.useMemo(()=>({...h,...r,refs:g,elements:v,nodeId:t}),[h,g,v,t,r]);return Ii(()=>{r.dataRef.current.floatingContext=b;const e=null==p?void 0:p.nodesRef.current.find(e=>e.id===t);e&&(e.context=b)}),d.useMemo(()=>({...h,context:b,refs:g,elements:v}),[h,g,v,b])}const ko="active",Ao="selected";function Po(e,t,n){const r=new Map,a="item"===n;let i=e;if(a&&e){const{[ko]:t,[Ao]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[yo]:""},...i,...t.map(t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var o;a&&[ko,Ao].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(o=r.get(n))||o.push(i),e[n]=function(){for(var e,t=arguments.length,a=new Array(t),i=0;i<t;i++)a[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...a)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}let Io=!1;function Lo(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Mo(e,t){return Lo(t,e===yi||e===wi,e===Si||e===xi)}function Vo(e,t,n){return Lo(t,e===wi,n?e===Si:e===xi)||"Enter"===e||" "===e||""===e}function Fo(e,t,n){return Lo(t,n?e===xi:e===Si,e===yi)}function No(e,t){const{open:n,onOpenChange:r,elements:a}=e,{listRef:i,activeIndex:o,onNavigate:s=()=>{},enabled:l=!0,selectedIndex:u=null,allowEscape:c=!1,loop:p=!1,nested:h=!1,rtl:f=!1,virtual:m=!1,focusItemOnOpen:g="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:b=!0,disabledIndices:y,orientation:w="vertical",cols:S=1,scrollItemIntoView:x=!0,virtualItemRef:_,itemSizes:E,dense:C=!1}=t;const R=Gi(wo(a.floating)),O=Hi(),T=Ui(),D=bi(s),k=Qr(a.domReference),A=d.useRef(g),P=d.useRef(null!=u?u:-1),I=d.useRef(null),L=d.useRef(!0),M=d.useRef(D),V=d.useRef(!!a.floating),F=d.useRef(n),N=d.useRef(!1),$=d.useRef(!1),j=Gi(y),B=Gi(n),z=Gi(x),W=Gi(u),[H,U]=d.useState(),[q,G]=d.useState(),Q=bi(function(e,t,n){function r(e){m?(U(e.id),null==T||T.events.emit("virtualfocus",e),_&&(_.current=e)):Ki(e,{preventScroll:!0,sync:!(!Nr().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!zr())&&(Io||N.current)})}void 0===n&&(n=!1);const a=e.current[t.current];a&&r(a),requestAnimationFrame(()=>{const i=e.current[t.current]||a;if(!i)return;a||r(i);const o=z.current;o&&Y&&(n||!L.current)&&(null==i.scrollIntoView||i.scrollIntoView("boolean"==typeof o?{block:"nearest",inline:"nearest"}:o))})});Ii(()=>{document.createElement("div").focus({get preventScroll(){return Io=!0,!1}})},[]),Ii(()=>{l&&(n&&a.floating?A.current&&null!=u&&($.current=!0,P.current=u,D(u)):V.current&&(P.current=-1,M.current(null)))},[l,n,a.floating,u,D]),Ii(()=>{if(l&&n&&a.floating)if(null==o){if(N.current=!1,null!=W.current)return;if(V.current&&(P.current=-1,Q(i,P)),(!F.current||!V.current)&&A.current&&(null!=I.current||!0===A.current&&null==I.current)){let e=0;const t=()=>{if(null==i.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else P.current=null==I.current||Vo(I.current,w,f)||h?Ci(i,j.current):Ri(i,j.current),I.current=null,D(P.current)};t()}}else Ei(i,o)||(P.current=o,Q(i,P,$.current),$.current=!1)},[l,n,a.floating,o,W,h,i,w,f,D,Q,j]),Ii(()=>{var e;if(!l||a.floating||!T||m||!V.current)return;const t=T.nodesRef.current,n=null==(e=t.find(e=>e.id===O))||null==(e=e.context)?void 0:e.elements.floating,r=Vr(Hr(a.floating)),i=t.some(e=>e.context&&Fr(e.context.elements.floating,r));n&&!i&&L.current&&n.focus({preventScroll:!0})},[l,a.floating,T,O,m]),Ii(()=>{if(l&&T&&m&&!O)return T.events.on("virtualfocus",e),()=>{T.events.off("virtualfocus",e)};function e(e){G(e.id),_&&(_.current=e)}},[l,T,m,O,_]),Ii(()=>{M.current=D,V.current=!!a.floating}),Ii(()=>{n||(I.current=null)},[n]),Ii(()=>{F.current=n},[n]);const K=null!=o,Y=d.useMemo(()=>{function e(e){if(!n)return;const t=i.current.indexOf(e);-1!==t&&D(t)}const t={onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...v&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;L.current&&"touch"!==t&&(P.current=-1,Q(i,P),D(null),m||Ki(R.current,{preventScroll:!0}))}}};return t},[n,R,Q,v,i,D,m]),X=bi(e=>{if(L.current=!1,N.current=!0,229===e.which)return;if(!B.current&&e.currentTarget===R.current)return;if(h&&Fo(e.key,w,f))return Gr(e),r(!1,e.nativeEvent,"list-navigation"),void(mr(a.domReference)&&(m?null==T||T.events.emit("virtualfocus",a.domReference):a.domReference.focus()));const t=P.current,o=Ci(i,y),s=Ri(i,y);if(k||("Home"===e.key&&(Gr(e),P.current=o,D(P.current)),"End"===e.key&&(Gr(e),P.current=s,D(P.current))),S>1){const t=E||Array.from({length:i.current.length},()=>({width:1,height:1})),n=Di(t,S,C),r=n.findIndex(e=>null!=e&&!Pi(i.current,e,y)),a=n.reduce((e,t,n)=>null==t||Pi(i.current,t,y)?e:n,-1),l=n[Ti({current:n.map(e=>null!=e?i.current[e]:null)},{event:e,orientation:w,loop:p,rtl:f,cols:S,disabledIndices:Ai([...y||i.current.map((e,t)=>Pi(i.current,t)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:ki(P.current>s?o:P.current,t,n,S,e.key===wi?"bl":e.key===(f?Si:xi)?"tr":"tl"),stopEvent:!0})];if(null!=l&&(P.current=l,D(P.current)),"both"===w)return}if(Mo(e.key,w)){if(Gr(e),n&&!m&&Vr(e.currentTarget.ownerDocument)===e.currentTarget)return P.current=Vo(e.key,w,f)?o:s,void D(P.current);Vo(e.key,w,f)?P.current=p?t>=s?c&&t!==i.current.length?-1:o:Oi(i,{startingIndex:t,disabledIndices:y}):Math.min(s,Oi(i,{startingIndex:t,disabledIndices:y})):P.current=p?t<=o?c&&-1!==t?i.current.length:s:Oi(i,{startingIndex:t,decrement:!0,disabledIndices:y}):Math.max(o,Oi(i,{startingIndex:t,decrement:!0,disabledIndices:y})),Ei(i,P.current)?D(null):D(P.current)}}),Z=d.useMemo(()=>m&&n&&K&&{"aria-activedescendant":q||H},[m,n,K,q,H]),J=d.useMemo(()=>({"aria-orientation":"both"===w?void 0:w,...!Qr(a.domReference)&&Z,onKeyDown:X,onPointerMove(){L.current=!0}}),[Z,X,a.domReference,w]),ee=d.useMemo(()=>{function e(e){"auto"===g&&jr(e.nativeEvent)&&(A.current=!0)}return{...Z,onKeyDown(e){L.current=!1;const t=e.key.startsWith("Arrow"),a=["Home","End"].includes(e.key),o=t||a,s=function(e,t,n){return Lo(t,n?e===Si:e===xi,e===wi)}(e.key,w,f),l=Fo(e.key,w,f),c=Mo(e.key,w),d=(h?s:c)||"Enter"===e.key||""===e.key.trim();if(m&&n){const t=null==T?void 0:T.nodesRef.current.find(e=>null==e.parentId),n=T&&t?function(e,t){let n,r=-1;return function t(a,i){i>r&&(n=a,r=i),Yi(e,a).forEach(e=>{t(e.id,i+1)})}(t,0),e.find(e=>e.id===n)}(T.nodesRef.current,t.id):null;if(o&&n&&_){const t=new KeyboardEvent("keydown",{key:e.key,bubbles:!0});if(s||l){var p,g;const r=(null==(p=n.context)?void 0:p.elements.domReference)===e.currentTarget,a=l&&!r?null==(g=n.context)?void 0:g.elements.domReference:s?i.current.find(e=>(null==e?void 0:e.id)===H):null;a&&(Gr(e),a.dispatchEvent(t),G(void 0))}var v;if((c||a)&&n.context)if(n.context.open&&n.parentId&&e.currentTarget!==n.context.elements.domReference)return Gr(e),void(null==(v=n.context.elements.domReference)||v.dispatchEvent(t))}return X(e)}(n||b||!t)&&(d&&(I.current=h&&c?null:e.key),h?s&&(Gr(e),n?(P.current=Ci(i,j.current),D(P.current)):r(!0,e.nativeEvent,"list-navigation")):c&&(null!=u&&(P.current=u),Gr(e),!n&&b?r(!0,e.nativeEvent,"list-navigation"):X(e),n&&D(P.current)))},onFocus(){n&&!m&&D(null)},onPointerDown:function(e){A.current=g,"auto"===g&&Br(e.nativeEvent)&&(A.current=!0)},onMouseDown:e,onClick:e}},[H,Z,X,j,g,i,h,D,r,n,b,w,f,u,T,m,_]);return d.useMemo(()=>l?{reference:ee,floating:J,item:Y}:{},[l,ee,J,Y])}const $o=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function jo(e,t,n){let r,a=n.initialDeps??[];function i(){var i,o,s,l;let u;n.key&&(null==(i=n.debug)?void 0:i.call(n))&&(u=Date.now());const c=e(),d=c.length!==a.length||c.some((e,t)=>a[t]!==e);if(!d)return r;let p;if(a=c,n.key&&(null==(o=n.debug)?void 0:o.call(n))&&(p=Date.now()),r=t(...c),n.key&&(null==(s=n.debug)?void 0:s.call(n))){Math.round(100*(Date.now()-u)),Math.round(100*(Date.now()-p))}return null==(l=null==n?void 0:n.onChange)||l.call(n,r),r}return i.updateDeps=e=>{a=e},i}function Bo(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const zo=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,a),n)}},Wo=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Ho=e=>e,Uo=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},qo=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const a=e=>{const{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(a(Wo(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(t=>{const r=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void a({width:t.inlineSize,height:t.blockSize})}a(Wo(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Go={passive:!0},Qo="undefined"==typeof window||"onscrollend"in window,Ko=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&Qo?()=>{}:zo(r,()=>{t(a,!1)},e.options.isScrollingResetDelay),o=r=>()=>{const{horizontal:o,isRtl:s}=e.options;a=o?n.scrollLeft*(s?-1:1):n.scrollTop,i(),t(a,r)},s=o(!0),l=o(!1);l(),n.addEventListener("scroll",s,Go);const u=e.options.useScrollendEvent&&Qo;return u&&n.addEventListener("scrollend",l,Go),()=>{n.removeEventListener("scroll",s),u&&n.removeEventListener("scrollend",l)}},Yo=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e){return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Xo=(e,{adjustments:t=0,behavior:n},r)=>{var a,i;const o=e+t;null==(i=null==(a=r.scrollElement)?void 0:a.scrollTo)||i.call(a,{[r.options.horizontal?"left":"top"]:o,behavior:n})};class Zo{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{const t=()=>{this._measureElement(e.target,e)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{void 0===n&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ho,rangeExtractor:Uo,onChange:()=>{},measureElement:Yo,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=jo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{const n=new Map,r=new Map;for(let a=t-1;a>=0;a--){const t=e[a];if(n.has(t.lane))continue;const i=r.get(t.lane);if(null==i||t.end>i.end?r.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=jo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,t,n,r,a)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a}),{key:!1}),this.getMeasurements=jo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:a},i)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];0===this.measurementsCache.length&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));const o=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const s=this.measurementsCache.slice(0,o);for(let a=o;a<e;a++){const e=r(a),o=1===this.options.lanes?s[a-1]:this.getFurthestMeasurement(s,a),l=o?o.end+this.options.gap:t+n,u=i.get(e),c="number"==typeof u?u:this.options.estimateSize(a),d=l+c,p=o?o.lane:a%this.options.lanes;s[a]={index:a,start:l,size:c,end:d,key:e,lane:p}}return this.measurementsCache=s,s},{key:!1,debug:()=>this.options.debug}),this.calculateRange=jo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const a=e.length-1,i=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:a};let o=Jo(0,a,i,n),s=o;if(1===r)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){const i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){const t=e[s];i[t.lane]=t.end,s++}const l=Array(r).fill(n+t);for(;o>=0&&l.some(e=>e>=n);){const t=e[o];l[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=jo(()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,a)=>null===r||null===a?[]:e({startIndex:r,endIndex:a,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const n=this.indexFromElement(e),r=this.measurementsCache[n];if(!r)return;const a=r.key,i=this.elementsCache.get(a);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(a,e)),e.isConnected&&this.resizeItem(n,this.options.measureElement(e,t,this))},this.resizeItem=(e,t)=>{const n=this.measurementsCache[e];if(!n)return;const r=t-(this.itemSizeCache.get(n.key)??n.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this):n.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.measureElement=e=>{e?this._measureElement(e,void 0):this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))})},this.getVirtualItems=jo(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const n=[];for(let r=0,a=e.length;r<a;r++){const a=t[e[r]];n.push(a)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0!==t.length)return Bo(t[Jo(0,t.length-1,e=>Bo(t[e]).start,e)])},this.getOffsetForAlignment=(e,t,n=0)=>{const r=this.getSize(),a=this.getScrollOffset();"auto"===t&&(t=e>=a+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r);const i=this.getTotalSize()+this.options.scrollMargin-r;return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.measurementsCache[e];if(!n)return;const r=this.getSize(),a=this.getScrollOffset();if("auto"===t)if(n.end>=a+r-this.options.scrollPaddingEnd)t="end";else{if(!(n.start<=a+this.options.scrollPaddingStart))return[a,t];t="start"}const i="end"===t?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,n.size),t]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:t="start",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:t="auto",behavior:n}={})=>{"smooth"===n&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let r=0;const a=t=>{if(!this.targetWindow)return;const r=this.getOffsetForIndex(e,t);if(!r)return void console.warn("Failed to get offset for index:",e);const[a,o]=r;this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.targetWindow.requestAnimationFrame(()=>{const t=this.getScrollOffset(),n=this.getOffsetForIndex(e,o);var r,a;n?(r=n[0],a=t,Math.abs(r-a)<1.01||i(o)):console.warn("Failed to get offset for index:",e)})},i=t=>{this.targetWindow&&(r++,r<10?this.targetWindow.requestAnimationFrame(()=>a(t)):console.warn(`Failed to scroll to index ${e} after 10 attempts.`))};a(t)},this.scrollBy=(e,{behavior:t}={})=>{"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let n;if(0===t.length)n=this.options.paddingStart;else if(1===this.options.lanes)n=(null==(e=t[t.length-1])?void 0:e.end)??0;else{const e=Array(this.options.lanes).fill(null);let r=t.length-1;for(;r>=0&&e.some(e=>null===e);){const n=t[r];null===e[n.lane]&&(e[n.lane]=n.end),r--}n=Math.max(...e.filter(e=>null!==e))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const Jo=(e,t,n,r)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<r)e=a+1;else{if(!(i>r))return a;t=a-1}}return e>0?e-1:0};const es="undefined"!=typeof document?d.useLayoutEffect:d.useEffect;function ts(e){const t=d.useReducer(()=>({}),{})[1],n={...e,onChange:(n,r)=>{var a;r?(0,Fa.flushSync)(t):t(),null==(a=e.onChange)||a.call(e,n,r)}},[r]=d.useState(()=>new Zo(n));return r.setOptions(n),es(()=>r._didMount(),[]),es(()=>r._willUpdate()),r}const ns=(0,d.forwardRef)(function({children:e,active:t,addGroupBottomBorder:n,isMultiValueEdit:r,checked:a,...i},o){const s=(0,Bt.useStyles2)(rs),l=(0,d.useId)();return h().createElement("div",{ref:o,role:"option",id:l,"aria-selected":t,className:(0,Xt.cx)(s.option,t&&s.optionFocused,n&&s.groupBottomBorder),...i},h().createElement("div",{className:s.optionBody,"data-testid":`data-testid ad hoc filter option value ${e}`},h().createElement("span",null,r?h().createElement(Bt.Checkbox,{tabIndex:-1,checked:a,className:s.checkbox}):null,e)))}),rs=e=>({option:(0,Xt.css)({label:"grafana-select-option",top:0,left:0,width:"100%",position:"absolute",padding:e.spacing(1),display:"flex",alignItems:"center",flexDirection:"row",flexShrink:0,whiteSpace:"nowrap",cursor:"pointer","&:hover":{background:e.colors.action.hover,"@media (forced-colors: active), (prefers-contrast: more)":{border:`1px solid ${e.colors.primary.border}`}}}),optionFocused:(0,Xt.css)({label:"grafana-select-option-focused",background:e.colors.action.focus,"@media (forced-colors: active), (prefers-contrast: more)":{border:`1px solid ${e.colors.primary.border}`}}),optionBody:(0,Xt.css)({label:"grafana-select-option-body",display:"flex",fontWeight:e.typography.fontWeightMedium,flexDirection:"column",flexGrow:1}),groupBottomBorder:(0,Xt.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),checkbox:(0,Xt.css)({paddingRight:e.spacing(.5)}),multiValueApplyWrapper:(0,Xt.css)({position:"fixed",top:0,left:0,display:"flex",backgroundColor:e.colors.background.primary,color:e.colors.text.primary,boxShadow:e.shadows.z2,overflowY:"auto",zIndex:e.zIndex.dropdown,gap:e.spacing(1.5),padding:`${e.spacing(1.5)} ${e.spacing(1)}`})}),as=()=>h().createElement(ns,{onClick:e=>e.stopPropagation()},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.variables.loading-options-placeholder.loading-options"},"Loading options...")),is=()=>h().createElement(ns,{onClick:e=>e.stopPropagation()},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.variables.no-options-placeholder.no-options-found"},"No options found")),os=({handleFetchOptions:e})=>h().createElement(ns,{onClick:e},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.variables.options-error-placeholder.error-occurred-fetching-labels-click-retry"},"An error has occurred fetching labels. Click to retry")),ss=({onApply:e,floatingElement:t,maxOptionWidth:n,menuHeight:r})=>{const a=(0,Bt.useStyles2)(rs),i=null==t?void 0:t.getBoundingClientRect();return h().createElement("div",{className:a.multiValueApplyWrapper,style:{width:`${n}px`,transform:`translate(${null==i?void 0:i.left}px,${i?i.top+r:0}px)`}},h().createElement(Bt.Button,{onClick:e,size:"sm",tabIndex:-1},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.variables.multi-value-apply-button.apply"},"Apply")))},ls={key:"operator",operator:"value",value:"key"},us=(e,t,n,r,a)=>cs(ls[e],t,"value"===e?n:void 0,r,a),cs=(e,t,n,r,a)=>{t(e),null==n||n(void 0,a),setTimeout(()=>null==r?void 0:r.focus())},ds=({filterInputType:e,item:t,filter:n,setFilterMultiValues:r,onAddCustomValue:a})=>{var i,o,s,l,u;if("key"===e)return{key:t.value,keyLabel:t.label?t.label:t.value,meta:null==t?void 0:t.meta};if("value"===e)return t.isCustom&&a?a(t,n):{value:t.value,valueLabels:[t.label?t.label:t.value]};if("operator"===e){if(Ns(n.operator)&&!Ns(t.value))return r([]),{operator:t.value,valueLabels:[(null==(i=n.valueLabels)?void 0:i[0])||(null==(o=n.values)?void 0:o[0])||n.value],values:void 0};if(Ns(t.value)&&!Ns(n.operator)){const e=[(null==(s=n.valueLabels)?void 0:s[0])||(null==(l=n.values)?void 0:l[0])||n.value],a=[n.value];return a[0]&&r([{value:a[0],label:null!=(u=null==e?void 0:e[0])?u:a[0]}]),{operator:t.value,valueLabels:e,values:a}}}return{[e]:t.value}},ps="Filter by label values",hs=(e,t,n,r)=>{var a;return"key"===t?ps:"value"===t?n?"Edit values":(null==(a=e.valueLabels)?void 0:a[0])||"":e[t]&&!r?`${e[t]}`:ps},fs=({populateInputOnEdit:e,item:t,filterInputType:n,setInputValue:r,filter:a})=>{var i,o,s;e&&!Ns(t.value||"")&&"value"===ls[n]?r(null!=(s=null!=(o=null==(i=null==a?void 0:a.valueLabels)?void 0:i[0])?o:null==a?void 0:a.value)?s:""):r("")},ms=({open:e,onOpenChange:t,activeIndex:n,setActiveIndex:r,outsidePressIdsToIgnore:a,listRef:i,disabledIndicesRef:o})=>{const{refs:s,floatingStyles:l,context:u}=Do({whileElementsMounted:ai,open:e,onOpenChange:t,placement:"bottom-start",middleware:[(c=10,{...ii(c),options:[c,p]}),fi({padding:10}),mi({apply({availableHeight:e,availableWidth:t,elements:n}){n.floating.style.maxHeight=`${Math.min(300,e)}px`,n.floating.style.maxWidth=`${t}px`},padding:10})],strategy:"fixed"});var c,p;const h=function(e,t){var n;void 0===t&&(t={});const{open:r,floatingId:a}=e,{enabled:i=!0,role:o="dialog"}=t,s=null!=(n=$o.get(o))?n:o,l=ji(),u=null!=Hi(),c=d.useMemo(()=>"tooltip"===s||"label"===o?{["aria-"+("label"===o?"labelledby":"describedby")]:r?a:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===s?"dialog":s,"aria-controls":r?a:void 0,..."listbox"===s&&{role:"combobox"},..."menu"===s&&{id:l},..."menu"===s&&u&&{role:"menuitem"},..."select"===o&&{"aria-autocomplete":"none"},..."combobox"===o&&{"aria-autocomplete":"list"}},[s,a,u,r,l,o]),p=d.useMemo(()=>{const e={id:a,...s&&{role:s}};return"tooltip"===s||"label"===o?e:{...e,..."menu"===s&&{"aria-labelledby":l}}},[s,a,l,o]),h=d.useCallback(e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:a+"-option"}};switch(o){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}},[a,o]);return d.useMemo(()=>i?{reference:c,floating:p,item:h}:{},[i,c,p,h])}(u,{role:"listbox"}),f=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:a,dataRef:i}=e,{enabled:o=!0,escapeKey:s=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:p="pointerdown",ancestorScroll:h=!1,bubbles:f,capture:m}=t,g=Ui(),v=bi("function"==typeof l?l:()=>!1),b="function"==typeof l?v:l,y=d.useRef(!1),w=d.useRef(!1),{escapeKey:S,outsidePress:x}=To(f),{escapeKey:_,outsidePress:E}=To(m),C=d.useRef(!1),R=bi(e=>{var t;if(!n||!o||!s||"Escape"!==e.key)return;if(C.current)return;const a=null==(t=i.current.floatingContext)?void 0:t.nodeId,l=g?Yi(g.nodesRef.current,a):[];if(!S&&(e.stopPropagation(),l.length>0)){let e=!0;if(l.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),O=bi(e=>{var t;const n=()=>{var t;R(e),null==(t=qr(e))||t.removeEventListener("keydown",n)};null==(t=qr(e))||t.addEventListener("keydown",n)}),T=bi(e=>{var t;const n=y.current;y.current=!1;const o=w.current;if(w.current=!1,"click"===u&&o)return;if(n)return;if("function"==typeof b&&!b(e))return;const s=qr(e),l="["+qi("inert")+"]",c=Hr(a.floating).querySelectorAll(l);let d=fr(s)?s:null;for(;d&&!Dr(d);){const e=Pr(d);if(Dr(e)||!fr(e))break;d=e}if(c.length&&fr(s)&&!s.matches("html,body")&&!Fr(s,a.floating)&&Array.from(c).every(e=>!Fr(d,e)))return;if(mr(s)&&A){const t=s.clientWidth>0&&s.scrollWidth>s.clientWidth,n=s.clientHeight>0&&s.scrollHeight>s.clientHeight;let r=n&&e.offsetX>s.clientWidth;if(n&&"rtl"===kr(s).direction&&(r=e.offsetX<=s.offsetWidth-s.clientWidth),r||t&&e.offsetY>s.clientHeight)return}const p=null==(t=i.current.floatingContext)?void 0:t.nodeId,h=g&&Yi(g.nodesRef.current,p).some(t=>{var n;return Ur(e,null==(n=t.context)?void 0:n.elements.floating)});if(Ur(e,a.floating)||Ur(e,a.domReference)||h)return;const f=g?Yi(g.nodesRef.current,p):[];if(f.length>0){let e=!0;if(f.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),D=bi(e=>{var t;const n=()=>{var t;T(e),null==(t=qr(e))||t.removeEventListener(u,n)};null==(t=qr(e))||t.addEventListener(u,n)});d.useEffect(()=>{if(!n||!o)return;i.current.__escapeKeyBubbles=S,i.current.__outsidePressBubbles=x;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function l(){window.clearTimeout(e),C.current=!0}function c(){e=window.setTimeout(()=>{C.current=!1},Or()?5:0)}const d=Hr(a.floating);s&&(d.addEventListener("keydown",_?O:R,_),d.addEventListener("compositionstart",l),d.addEventListener("compositionend",c)),b&&d.addEventListener(u,E?D:T,E);let p=[];return h&&(fr(a.domReference)&&(p=Lr(a.domReference)),fr(a.floating)&&(p=p.concat(Lr(a.floating))),!fr(a.reference)&&a.reference&&a.reference.contextElement&&(p=p.concat(Lr(a.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{s&&(d.removeEventListener("keydown",_?O:R,_),d.removeEventListener("compositionstart",l),d.removeEventListener("compositionend",c)),b&&d.removeEventListener(u,E?D:T,E),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,a,s,b,u,n,r,h,o,S,x,R,_,O,T,E,D]),d.useEffect(()=>{y.current=!1},[b,u]);const k=d.useMemo(()=>({onKeyDown:R,[Ro[p]]:e=>{c&&r(!1,e.nativeEvent,"reference-press")}}),[R,r,c,p]),A=d.useMemo(()=>({onKeyDown:R,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[Oo[u]]:()=>{y.current=!0}}),[R,u]);return d.useMemo(()=>o?{reference:k,floating:A}:{},[o,k,A])}(u,{outsidePress:e=>{var t;if(e.currentTarget instanceof Element){const n=e.currentTarget;let r=n.id;if("path"===n.nodeName&&(r=(null==(t=n.parentElement)?void 0:t.id)||""),a.includes(r))return!1}return!0}}),m=No(u,{listRef:i,activeIndex:n,onNavigate:r,virtual:!0,loop:!0,disabledIndices:o.current}),{getReferenceProps:g,getFloatingProps:v,getItemProps:b}=function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),a=d.useCallback(t=>Po(t,e,"reference"),t),i=d.useCallback(t=>Po(t,e,"floating"),n),o=d.useCallback(t=>Po(t,e,"item"),r);return d.useMemo(()=>({getReferenceProps:a,getFloatingProps:i,getItemProps:o}),[a,i,o])}([h,f,m]);return{refs:s,floatingStyles:l,context:u,getReferenceProps:g,getFloatingProps:v,getItemProps:b}},gs=({item:e,handleRemoveMultiValue:t,index:n,handleEditMultiValuePill:r})=>{var a,i;const o=(0,Bt.useStyles2)(vs),s=(0,d.useCallback)(t=>{t.stopPropagation(),t.preventDefault(),r(e)},[r,e]),l=(0,d.useCallback)(e=>{"Enter"===e.key&&s(e)},[s]),u=(0,d.useCallback)(n=>{n.stopPropagation(),n.preventDefault(),t(e)},[t,e]),c=(0,d.useCallback)(e=>{"Enter"===e.key&&u(e)},[u]);return h().createElement("div",{className:(0,Xt.cx)(o.basePill,o.valuePill),onClick:s,onKeyDown:l,tabIndex:0,id:`${e.value}-${n}`},null!=(a=e.label)?a:e.value,h().createElement(Bt.Button,{onClick:u,onKeyDownCapture:c,fill:"text",size:"sm",variant:"secondary",className:o.removeButton,tooltip:(0,Ze.t)("grafana-scenes.components.adhoc-filters-combobox.remove-filter-value","Remove filter value - {{itemLabel}}",{itemLabel:null!=(i=e.label)?i:e.value})},h().createElement(Bt.Icon,{name:"times",size:"md",id:`${e.value}-${n}-close-icon`})))},vs=e=>({basePill:(0,Xt.css)({display:"flex",alignItems:"center",background:e.colors.action.disabledBackground,border:`1px solid ${e.colors.border.weak}`,padding:e.spacing(.125,1,.125,1),color:e.colors.text.primary,overflow:"hidden",whiteSpace:"nowrap",minHeight:e.spacing(2.75),...e.typography.bodySmall,cursor:"pointer"}),valuePill:(0,Xt.css)({background:e.colors.action.selected,padding:e.spacing(.125,0,.125,1)}),removeButton:(0,Xt.css)({marginInline:e.spacing(.5),height:"100%",padding:0,cursor:"pointer","&:hover":{color:e.colors.text.primary}})}),bs=(0,d.forwardRef)(function({filter:e,model:t,isAlwaysWip:n,handleChangeViewMode:r,focusOnWipInputRef:a,populateInputOnEdit:i},o){var s,l,u,c;const[p,f]=(0,d.useState)(!1),[m,g]=(0,d.useState)([]),[v,b]=(0,d.useState)(!1),[y,w]=(0,d.useState)(!1),[S,x]=(0,d.useState)(""),[_,E]=(0,d.useState)(null),[C,R]=(0,d.useState)(n?"key":"value"),[O,T]=(0,d.useState)(!n&&"value"===C),D=(0,Bt.useStyles2)(ys),[k,A]=(0,d.useState)([]),[P,I]=(0,d.useState)({}),L=null==(s=t.state.allowCustomValue)||s,M=(0,d.useRef)(null),V=Ns((null==e?void 0:e.operator)||""),F=V&&"value"===C,N=(0,d.useId)(),$=(0,d.useRef)([]),j=(0,d.useRef)([]),B=(0,d.useRef)(n?"key":"value"),z=(0,d.useMemo)(()=>Jn(m),[m]),W=(0,d.useMemo)(()=>!n&&t.state.filters.at(-1)===e,[e,n,t.state.filters]),H=(0,d.useCallback)(()=>{n&&(t._addWip(),R("key"),x(""))},[t,n]),U=(0,d.useCallback)((e,t,n,r)=>{if(!n.length&&t.origin&&e.updateToMatchAll(t),n.length){const r=[],a=[];n.forEach(e=>{var t;r.push(null!=(t=e.label)?t:e.value),a.push(e.value)});let i=!0;if(Array.isArray(t.values)&&t.values.length===a.length&&(i=!t.values.every((e,t)=>e===a[t])),i){const t=K(e);null==t||t.startProfile(Fe)}e._updateFilter(t,{valueLabels:r,values:a,value:a[0]}),A([])}r||setTimeout(()=>{var e;return null==(e=Y.domReference.current)?void 0:e.focus()})},[]),q=(0,d.useCallback)(e=>{A(t=>t.some(t=>t.value===e.value)?t.filter(t=>t.value!==e.value):[...t,e])},[]),G=(0,d.useCallback)((n,a,i)=>{f(n),i&&["outside-press","escape-key"].includes(i)&&(F?U(t,e,k):e&&e.origin&&""===S&&t.updateToMatchAll(e),H(),null==r||r())},[e,k,r,U,H,S,F,t]),Q=(0,d.useMemo)(()=>[N,...k.reduce((e,t,n)=>[...e,`${t.value}-${n}`,`${t.value}-${n}-close-icon`],[])],[N,k]),{refs:Y,floatingStyles:X,context:Z,getReferenceProps:J,getFloatingProps:ee,getItemProps:te}=ms({open:p,onOpenChange:G,activeIndex:_,setActiveIndex:E,outsidePressIdsToIgnore:Q,listRef:$,disabledIndicesRef:j});(0,d.useImperativeHandle)(o,()=>()=>{var e;return null==(e=Y.domReference.current)?void 0:e.focus()},[Y.domReference]);const ne=(0,d.useCallback)(e=>{A(t=>t.filter(t=>t.value!==e.value)),setTimeout(()=>{var e;return null==(e=Y.domReference.current)?void 0:e.focus()})},[Y.domReference]),re=(e=>e.flatMap(e=>e.options?[e,...e.options]:[e]))(ol(z(O?"":S)));if(L&&"operator"!==C&&S){const t=ks.find(t=>(null==e?void 0:e.operator)===t.value),n={value:S.trim(),label:S.trim(),isCustom:!0};(null==t?void 0:t.isRegex)?re.unshift(n):re.push(n)}const ae=t.state.onAddCustomValue,ie=((e,t,n)=>{var r,a,i,o;let s=182;const l=[],u=[];for(let t=0;t<e.length;t++){l.push(null),(null==(r=e[t])?void 0:r.options)&&u.push(t);let n=null!=(i=null!=(a=e[t].label)?a:e[t].value)?i:"",c=8;8*n.length<6*((null==(o=e[t].description)?void 0:o.length)||0)&&(n=e[t].description,c=6);const d=(e[t].isCustom?n.length+18:n.length)*c+16;d>s&&(s=d)}return t.current=[...l],n.current=[...u],s})(re,$,j),oe=(0,d.useCallback)(async n=>{var r;const a=Hn(t),i="key"===n?"adhoc_keys_dropdown":"adhoc_values_dropdown";"operator"!==n&&(null==a||a.startInteraction(i)),w(!1),b(!0),g([]);let o=[];try{if("key"===n?o=await t._getKeys(null):"operator"===n?o=t._getOperators():"value"===n&&(o=await t._getValuesFor(e)),B.current!==n)return void(null==a||a.stopInteraction());g(o),(null==(r=o[0])?void 0:r.group)?E(1):E(0)}catch(e){w(!0)}b(!1),null==a||a.stopInteraction()},[e,t]),se=function(e){return ts({observeElementRect:qo,observeElementOffset:Ko,scrollToFn:Xo,...e})}({count:re.length,getScrollElement:()=>Y.floating.current,estimateSize:e=>re[e].description?60:38,overscan:5}),le=(0,d.useCallback)((r,i)=>{if("Backspace"===r.key&&!S){if("value"===C){if(i&&k.length)return void A(e=>{const t=[...e];return t.splice(-1,1),t});if(null==e?void 0:e.origin)return;return void R("operator")}if(null==a||a(),Vs(e)){const e=K(t);null==e||e.startProfile(Ve)}t._handleComboboxBackspace(e),n&&H()}},[S,C,t,e,n,k.length,H,a]),ue=(0,d.useCallback)((n,a)=>{var i;"Tab"!==n.key||n.shiftKey||(a&&(n.preventDefault(),U(t,e,k),null==(i=Y.domReference.current)||i.focus()),null==r||r(),H())},[e,k,r,U,H,t,Y.domReference]),ce=(0,d.useCallback)((n,a)=>{"Tab"===n.key&&n.shiftKey&&(a&&(n.preventDefault(),U(t,e,k,!0)),null==r||r(),H())},[e,k,r,U,H,t]),de=(0,d.useCallback)((n,o)=>{if("Enter"===n.key&&null!=_){if(!re[_])return;const n=re[_];if(o)q(n),x("");else{const o=ds({filterInputType:C,item:n,filter:e,setFilterMultiValues:A,onAddCustomValue:ae});if("value"===C&&o.value!==(null==e?void 0:e.value)){const e=K(t);null==e||e.startProfile(Fe)}t._updateFilter(e,o),fs({populateInputOnEdit:i,item:n,filterInputType:C,setInputValue:x,filter:e}),us(C,R,r,Y.domReference.current,!W&&void 0),E(null),W&&(null==a||a())}}},[_,re,q,t,e,C,i,r,Y.domReference,W,a,ae]),pe=(0,d.useCallback)(e=>{var t;const n=e.label||e.value;A(t=>t.filter(t=>t.value!==e.value)),T(!0),x(n),null==(t=Y.domReference.current)||t.focus(),setTimeout(()=>{var e;null==(e=Y.domReference.current)||e.select()})},[Y.domReference]);(0,d.useEffect)(()=>{p&&oe(C)},[p,C]),(0,d.useEffect)(()=>{var t,r,a,o;if(!n){if(V&&(null==(t=null==e?void 0:e.values)?void 0:t.length)){const t=e.values.reduce((t,n,r)=>{var a;return[...t,{label:(null==(a=e.valueLabels)?void 0:a[r])||n,value:n}]},[]);A(t)}!V&&i&&(x(null!=(a=null==(r=null==e?void 0:e.valueLabels)?void 0:r[0])?a:(null==e?void 0:e.value)||""),setTimeout(()=>{var e;null==(e=Y.domReference.current)||e.select()})),null==(o=Y.domReference.current)||o.focus()}},[]),(0,d.useEffect)(()=>{F&&k&&setTimeout(()=>I({}))},[k,F]),(0,d.useLayoutEffect)(()=>{B.current&&(B.current=C)},[C]),(0,d.useLayoutEffect)(()=>{var e,t;null!==_&&se.range&&(_>(null==(e=se.range)?void 0:e.endIndex)||_<(null==(t=se.range)?void 0:t.startIndex))&&se.scrollToIndex(_)},[_,se]);const he=null!=(l=null==e?void 0:e.keyLabel)?l:null==e?void 0:e.key;return h().createElement("div",{className:D.comboboxWrapper},e?h().createElement("div",{className:D.pillWrapper},(null==e?void 0:e.key)?h().createElement("div",{className:(0,Xt.cx)(D.basePill,D.keyPill)},he):null,(null==e?void 0:e.key)&&(null==e?void 0:e.operator)&&"operator"!==C?h().createElement("div",{id:N,className:(0,Xt.cx)(D.basePill,!e.origin&&D.operatorPill,e.origin&&D.keyPill,N),"aria-label":(0,Ze.t)("grafana-scenes.variables.ad-hoc-combobox.aria-label-edit-filter-operator","Edit filter operator"),tabIndex:e.origin?-1:0,onClick:t=>{e.origin?null==r||r():(t.stopPropagation(),x(""),cs("operator",R,void 0,Y.domReference.current))},onKeyDown:t=>{e.origin||(ce(t,V),"Enter"===t.key&&(x(""),cs("operator",R,void 0,Y.domReference.current)))},...!e.origin&&{role:"button"}},e.operator):null,h().createElement("div",{ref:M}),F?k.map((e,t)=>h().createElement(gs,{key:`${e.value}-${t}`,item:e,index:t,handleRemoveMultiValue:ne,handleEditMultiValuePill:pe})):null):null,h().createElement("input",{...J({ref:Y.setReference,onChange:function(e){const t=e.target.value;x(t),E(0),O&&T(!1)},value:S,placeholder:hs(e,C,F,n),"aria-autocomplete":"list",onKeyDown(e){p?("operator"===C&&ce(e),le(e,F),ue(e,F),de(e,F)):f(!0)}}),className:(0,Xt.cx)(D.inputStyle,{[D.loadingInputPadding]:!v}),onClick:e=>{e.stopPropagation(),f(!0)},onFocus:()=>{f(!0)}}),v?h().createElement(Bt.Spinner,{className:D.loadingIndicator,inline:!0}):null,h().createElement(vo,null,p&&h().createElement(Co,{context:Z,initialFocus:-1,visuallyHiddenDismiss:!0,modal:!1},h().createElement(h().Fragment,null,h().createElement("div",{style:{...X,width:`${y?366:ie}px`,transform:F?`translate(${(null==(u=M.current)?void 0:u.getBoundingClientRect().left)||0}px, ${((null==(c=Y.domReference.current)?void 0:c.getBoundingClientRect().bottom)||0)+10}px )`:X.transform},ref:Y.setFloating,className:D.dropdownWrapper,tabIndex:-1},h().createElement("div",{style:{height:`${se.getTotalSize()||38}px`},...ee(),tabIndex:-1},v?h().createElement(as,null):y?h().createElement(os,{handleFetchOptions:()=>oe(C)}):re.length||L&&"operator"!==C&&S?se.getVirtualItems().map(n=>{var a;const o=re[n.index],s=n.index;if(o.options)return h().createElement("div",{key:`${o.label}+${s}`,className:(0,Xt.cx)(D.optionGroupLabel,D.groupTopBorder),style:{height:`${n.size}px`,transform:`translateY(${n.start}px)`}},h().createElement(Bt.Text,{weight:"bold",variant:"bodySmall",color:"secondary"},o.label));const l=re[n.index+1],u=l&&!l.group&&!l.options&&o.group,c=null!=(a=o.label)?a:o.value;return h().createElement(ns,{...te({key:`${o.value}-${s}`,ref(e){$.current[s]=e},onClick(n){var a;if("value"!==C&&n.stopPropagation(),F)n.preventDefault(),n.stopPropagation(),q(o),x(""),null==(a=Y.domReference.current)||a.focus();else{const n=ds({filterInputType:C,item:o,filter:e,setFilterMultiValues:A,onAddCustomValue:ae});if("value"===C&&n.value!==(null==e?void 0:e.value)){const e=K(t);null==e||e.startProfile(Fe)}t._updateFilter(e,n),fs({populateInputOnEdit:i,item:o,filterInputType:C,setInputValue:x,filter:e}),us(C,R,r,Y.domReference.current,!1)}}}),active:_===s,addGroupBottomBorder:u,style:{height:`${n.size}px`,transform:`translateY(${n.start}px)`},"aria-setsize":re.length,"aria-posinset":n.index+1,isMultiValueEdit:F,checked:k.some(e=>e.value===o.value)},h().createElement("span",null,o.isCustom?(0,Ze.t)("grafana-scenes.components.adhoc-filters-combobox.use-custom-value","Use custom value: {{itemLabel}}",{itemLabel:c}):c),o.description?h().createElement("div",{className:D.descriptionText},o.description):null)}):h().createElement(is,null))),F&&!v&&!y&&re.length?h().createElement(ss,{onApply:()=>{U(t,e,k)},floatingElement:Y.floating.current,maxOptionWidth:ie,menuHeight:Math.min(se.getTotalSize(),300)}):null))))}),ys=e=>({comboboxWrapper:(0,Xt.css)({display:"flex",flexWrap:"wrap"}),pillWrapper:(0,Xt.css)({display:"flex",alignItems:"center",flexWrap:"wrap"}),basePill:(0,Xt.css)({display:"flex",alignItems:"center",background:e.colors.action.disabledBackground,border:`1px solid ${e.colors.border.weak}`,padding:e.spacing(.125,1,.125,1),color:e.colors.text.primary,overflow:"hidden",whiteSpace:"nowrap",minHeight:e.spacing(2.75),...e.typography.bodySmall,cursor:"pointer"}),keyPill:(0,Xt.css)({fontWeight:e.typography.fontWeightBold,cursor:"default"}),operatorPill:(0,Xt.css)({"&:hover":{background:e.colors.action.hover}}),dropdownWrapper:(0,Xt.css)({backgroundColor:e.colors.background.primary,color:e.colors.text.primary,boxShadow:e.shadows.z2,overflowY:"auto",zIndex:e.zIndex.portal}),inputStyle:(0,Xt.css)({paddingBlock:0,"&:focus":{outline:"none"}}),loadingIndicator:(0,Xt.css)({color:e.colors.text.secondary,marginLeft:e.spacing(.5)}),loadingInputPadding:(0,Xt.css)({paddingRight:e.spacing(2.5)}),optionGroupLabel:(0,Xt.css)({padding:e.spacing(1),position:"absolute",top:0,left:0,width:"100%"}),groupTopBorder:(0,Xt.css)({"&:not(:first-child)":{borderTop:`1px solid ${e.colors.border.weak}`}}),descriptionText:(0,Xt.css)({...e.typography.bodySmall,color:e.colors.text.secondary,paddingTop:e.spacing(.5)})});function ws({filter:e,model:t,readOnly:n,focusOnWipInputRef:r}){var a,i,o,s;const l=(0,Bt.useStyles2)(Ss),[u,c]=(0,d.useState)(!0),[p,f]=(0,d.useState)(!1),m=(0,d.useRef)(null),[g,v]=(0,d.useState)(!1),b=null!=(a=e.keyLabel)?a:e.key,y=(null==(i=e.valueLabels)?void 0:i.join(", "))||(null==(o=e.values)?void 0:o.join(", "))||e.value,w=(0,d.useCallback)((e,t)=>{null==e||e.stopPropagation(),n||(f(null!=t?t:!u),c(!u))},[n,u]);(0,d.useEffect)(()=>{var e;p&&(null==(e=m.current)||e.focus(),f(!1))},[p]),(0,d.useEffect)(()=>{e.forceEdit&&u&&(c(!1),t._updateFilter(e,{forceEdit:void 0}))},[e,t,u]),(0,d.useEffect)(()=>{u&&v(e=>!e&&e)},[u]);const S=e=>"dashboard"===e?{info:"Applied by default in this dashboard. If edited, it carries over to other dashboards.",restore:"Restore the value set by this dashboard."}:"scope"===e?{info:"Applied automatically from your selected scope.",restore:"Restore the value set by your selected scope."}:{info:`This is a ${e} injected filter.`,restore:"Restore filter to its original value."},x=!e.restorable&&!e.readOnly&&!e.nonApplicable;if(u){const a=`${b} ${e.operator} ${y}`,i=h().createElement("span",{className:(0,Xt.cx)(l.pillText,e.nonApplicable&&l.strikethrough)},a);return h().createElement("div",{className:(0,Xt.cx)(l.combinedFilterPill,n&&l.readOnlyCombinedFilter,(Ms(e)||e.nonApplicable)&&l.disabledPill,e.readOnly&&l.filterReadOnly),onClick:e=>{e.stopPropagation(),v(!0),w()},onKeyDown:e=>{"Enter"===e.key&&(v(!0),w())},role:n?void 0:"button","aria-label":(0,Ze.t)("grafana-scenes.components.adhoc-filter-pill.edit-filter-with-key","Edit filter with key {{keyLabel}}",{keyLabel:b}),tabIndex:0,ref:m},a.length<20?i:h().createElement(Bt.Tooltip,{content:h().createElement("div",{className:l.tooltipText},a),placement:"top"},i),n||e.matchAllFilter||e.origin&&"dashboard"!==e.origin?null:h().createElement(Bt.IconButton,{onClick:n=>{n.stopPropagation(),e.origin&&"dashboard"===e.origin?t.updateToMatchAll(e):t._removeFilter(e),setTimeout(()=>null==r?void 0:r())},onKeyDownCapture:n=>{"Enter"===n.key&&(n.preventDefault(),n.stopPropagation(),e.origin&&"dashboard"===e.origin?t.updateToMatchAll(e):t._removeFilter(e),setTimeout(()=>null==r?void 0:r()))},name:"times",size:"md",className:(0,Xt.cx)(l.pillIcon,e.nonApplicable&&l.disabledPillIcon),tooltip:(0,Ze.t)("grafana-scenes.components.adhoc-filter-pill.remove-filter-with-key","Remove filter with key {{keyLabel}}",{keyLabel:b})}),e.origin&&e.readOnly&&h().createElement(Bt.Tooltip,{content:(0,Ze.t)("grafana-scenes.components.adhoc-filter-pill.managed-filter","{{origin}} managed filter",{origin:e.origin}),placement:"bottom"},h().createElement(Bt.Icon,{name:"lock",size:"md",className:l.readOnlyPillIcon})),e.origin&&x&&h().createElement(Bt.Tooltip,{content:S(e.origin).info,placement:"bottom"},h().createElement(Bt.Icon,{name:"info-circle",size:"md",className:l.infoPillIcon})),e.origin&&e.restorable&&!e.readOnly&&h().createElement(Bt.IconButton,{onClick:n=>{n.stopPropagation(),t.restoreOriginalFilter(e)},onKeyDownCapture:n=>{"Enter"===n.key&&(n.preventDefault(),n.stopPropagation(),t.restoreOriginalFilter(e))},name:"history",size:"md",className:Ms(e)?l.matchAllPillIcon:l.pillIcon,tooltip:S(e.origin).restore}),e.nonApplicable&&h().createElement(Bt.Tooltip,{content:null!=(s=e.nonApplicableReason)?s:(0,Ze.t)("grafana-scenes.components.adhoc-filter-pill.non-applicable","Filter is not applicable"),placement:"bottom"},h().createElement(Bt.Icon,{name:"info-circle",size:"md",className:l.infoPillIcon})))}return h().createElement(bs,{filter:e,model:t,handleChangeViewMode:w,focusOnWipInputRef:r,populateInputOnEdit:g})}const Ss=e=>({combinedFilterPill:(0,Xt.css)({display:"flex",alignItems:"center",background:e.colors.action.selected,borderRadius:e.shape.radius.default,border:`1px solid ${e.colors.border.weak}`,padding:e.spacing(.125,0,.125,1),color:e.colors.text.primary,overflow:"hidden",whiteSpace:"nowrap",minHeight:e.spacing(2.75),...e.typography.bodySmall,fontWeight:e.typography.fontWeightBold,cursor:"pointer","&:hover":{background:e.colors.action.hover}}),readOnlyCombinedFilter:(0,Xt.css)({paddingRight:e.spacing(1),cursor:"text","&:hover":{background:e.colors.action.selected}}),filterReadOnly:(0,Xt.css)({background:e.colors.background.canvas,cursor:"text","&:hover":{background:e.colors.background.canvas}}),pillIcon:(0,Xt.css)({marginInline:e.spacing(.5),cursor:"pointer","&:hover":{color:e.colors.text.primary}}),pillText:(0,Xt.css)({maxWidth:"200px",width:"100%",textOverflow:"ellipsis",overflow:"hidden"}),tooltipText:(0,Xt.css)({textAlign:"center"}),infoPillIcon:(0,Xt.css)({marginInline:e.spacing(.5),cursor:"pointer"}),readOnlyPillIcon:(0,Xt.css)({marginInline:e.spacing(.5)}),matchAllPillIcon:(0,Xt.css)({marginInline:e.spacing(.5),cursor:"pointer",color:e.colors.text.disabled}),disabledPillIcon:(0,Xt.css)({marginInline:e.spacing(.5),cursor:"pointer",color:e.colors.text.disabled,"&:hover":{color:e.colors.text.disabled}}),...sl(e)}),xs=(0,d.forwardRef)(function({model:e},t){const{_wip:n}=e.useState();return(0,d.useLayoutEffect)(()=>{n||e._addWip()},[n]),h().createElement(bs,{model:e,filter:n,isAlwaysWip:!0,ref:t})}),_s=(0,d.memo)(function({model:e}){const{originFilters:t,filters:n,readOnly:r}=e.useState(),a=(0,Bt.useStyles2)(Es),i=(0,d.useRef)();return h().createElement("div",{className:(0,Xt.cx)(a.comboboxWrapper,{[a.comboboxFocusOutline]:!r}),onClick:()=>{var e;null==(e=i.current)||e.call(i)}},h().createElement(Bt.Icon,{name:"filter",className:a.filterIcon,size:"lg"}),null==t?void 0:t.map((t,n)=>t.origin?h().createElement(ws,{key:`${n}-${t.key}`,filter:t,model:e,focusOnWipInputRef:i.current}):null),n.filter(e=>!e.hidden).map((t,n)=>h().createElement(ws,{key:`${n}-${t.key}`,filter:t,model:e,readOnly:r||t.readOnly,focusOnWipInputRef:i.current})),r?null:h().createElement(xs,{model:e,ref:i}))}),Es=e=>({comboboxWrapper:(0,Xt.css)({display:"flex",flexWrap:"wrap",alignItems:"center",columnGap:e.spacing(1),rowGap:e.spacing(.5),minHeight:e.spacing(4),backgroundColor:e.components.input.background,border:`1px solid ${e.colors.border.strong}`,borderRadius:e.shape.radius.default,paddingInline:e.spacing(1),paddingBlock:e.spacing(.5),flexGrow:1}),comboboxFocusOutline:(0,Xt.css)({"&:focus-within":{outline:"2px dotted transparent",outlineOffset:"2px",boxShadow:`0 0 0 2px ${e.colors.background.canvas}, 0 0 0px 4px ${e.colors.primary.main}`,transitionTimingFunction:"cubic-bezier(0.19, 1, 0.22, 1)",transitionDuration:"0.2s",transitionProperty:"outline, outline-offset, box-shadow",zIndex:2}}),filterIcon:(0,Xt.css)({color:e.colors.text.secondary,alignSelf:"center"})}),Cs=Object.fromEntries(Object.entries(o.scopeFilterOperatorMap).map(([e,t])=>[t,e]));function Rs(e){return new Set(["equals","not-equals","one-of","not-one-of"]).has(e)}function Os(e){return new Set(["regex-match","regex-not-match"]).has(e)}function Ts(e,t,n){var r,a;if(!n)return;const i=e.get(n.key);i&&function(e,t){const n=o.scopeFilterOperatorMap[e];if(!Rs(n)||!Rs(t))return!1;return Ds(n,t)}(i.operator,n.operator)?function(e,t){var n,r,a,i;const o=null!=(n=t.values)?n:[t.value];for(const t of o)(null==(r=e.values)?void 0:r.includes(t))||null==(a=e.values)||a.push(t);if(1===(null==(i=e.values)?void 0:i.length))return;"equals"===t.operator&&e.operator===Cs.equals?e.operator=Cs["one-of"]:"not-equals"===t.operator&&e.operator===Cs["not-equals"]&&(e.operator=Cs["not-one-of"])}(i,n):i&&function(e,t){const n=o.scopeFilterOperatorMap[e];if(!Os(n)||!Os(t))return!1;return Ds(n,t)}(i.operator,n.operator)?(i.value+=`|${n.value}`,i.values=[i.value]):i?t.push({key:n.key,operator:Cs[n.operator],value:n.value,values:null!=(a=n.values)?a:[n.value],origin:"scope"}):e.set(n.key,{key:n.key,operator:Cs[n.operator],value:n.value,values:null!=(r=n.values)?r:[n.value],origin:"scope"})}function Ds(e,t){return!(e.includes("not")&&!t.includes("not")||!e.includes("not")&&t.includes("not"))}const ks=[{value:"=",description:"Equals"},{value:"!=",description:"Not equal"},{value:"=|",description:"One of. Use to filter on multiple values.",isMulti:!0},{value:"!=|",description:"Not one of. Use to exclude multiple values.",isMulti:!0},{value:"=~",description:"Matches regex",isRegex:!0},{value:"!~",description:"Does not match regex",isRegex:!0},{value:"<",description:"Less than"},{value:"<=",description:"Less than or equal to"},{value:">",description:"Greater than"},{value:">=",description:"Greater than or equal to"}];class As extends k{constructor(e){var t,n,r,a,i;super({type:"adhoc",name:null!=(t=e.name)?t:"Filters",filters:[],datasource:null,applyMode:"auto",filterExpression:null!=(a=e.filterExpression)?a:Ps(e.expressionBuilder,[...null!=(n=e.originFilters)?n:[],...null!=(r=e.filters)?r:[]]),...e}),this._scopedVars={__sceneObject:Nn(this)},this._dataSourceSrv=(0,s.getDataSourceSrv)(),this._originalValues=new Map,this._prevScopes=[],this._variableDependency=new ul(this,{dependsOnScopes:!0,onReferencedVariableValueChanged:()=>this._updateScopesFilters()}),this._urlSync=new ir(this),this._debouncedVerifyApplicability=(0,I.debounce)(this._verifyApplicability,100),this._activationHandler=()=>(this._debouncedVerifyApplicability(),()=>{var e;null==(e=this.state.originFilters)||e.forEach(e=>{e.restorable&&this.restoreOriginalFilter(e)})}),"auto"===this.state.applyMode&&function(e){if(e.addActivationHandler(()=>(Kn.add(e),()=>Kn.delete(e))),Qn)return;const t=(0,s.getTemplateSrv)();(null==t?void 0:t.getAdhocFilters)&&(Qn=t.getAdhocFilters,t.getAdhocFilters=function(e){var n;if(0===Kn.size)return Qn.call(t,e);const r=(0,s.getDataSourceSrv)().getInstanceSettings(e);if(!r)return[];for(const e of Kn.values())if((null==(n=e.state.datasource)?void 0:n.uid)===r.uid)return e.state.filters;return[]}.bind(t))}(this),null==(i=this.state.originFilters)||i.forEach(e=>{var t;this._originalValues.set(`${e.key}-${e.origin}`,{operator:e.operator,value:null!=(t=e.values)?t:[e.value]})}),this.addActivationHandler(this._activationHandler)}_updateScopesFilters(){var e,t;const n=Ml.getScopes(this);if(!n||!n.length)return void this.setState({originFilters:null==(e=this.state.originFilters)?void 0:e.filter(e=>"scope"!==e.origin)});const r=function(e){const t=new Map,n=[],r=e.flatMap(e=>e.spec.filters);for(const e of r)Ts(t,n,e);return[...t.values(),...n]}(n);if(!r.length)return;let a=r;const i=[],o=[];if(a.forEach(e=>{var t;this._originalValues.set(`${e.key}-${e.origin}`,{value:null!=(t=e.values)?t:[e.value],operator:e.operator})}),null==(t=this.state.originFilters)||t.forEach(e=>{"scope"===e.origin?i.push(e):o.push(e)}),this._prevScopes.length)return this.setState({originFilters:[...a,...o]}),this._prevScopes=n,void this._debouncedVerifyApplicability();const s=i.filter(e=>e.restorable),l=s.map(e=>e.key),u=r.map(e=>e.key);a=[...s.filter(e=>u.includes(e.key)),...r.filter(e=>!l.includes(e.key))],this.setState({originFilters:[...a,...o]}),this._prevScopes=n,this._debouncedVerifyApplicability()}setState(e){var t,n;let r=!1;if((e.filters&&e.filters!==this.state.filters||e.originFilters&&e.originFilters!==this.state.originFilters)&&!e.filterExpression){const a=null!=(t=e.filters)?t:this.state.filters,i=null!=(n=e.originFilters)?n:this.state.originFilters;e.filterExpression=Ps(this.state.expressionBuilder,[...null!=i?i:[],...a]),r=e.filterExpression!==this.state.filterExpression}super.setState(e),r&&this.publishEvent(new qe(this),!0)}updateFilters(e,t){var n;let r,a=!1;e&&e!==this.state.filters&&(r=Ps(this.state.expressionBuilder,[...null!=(n=this.state.originFilters)?n:[],...e]),a=r!==this.state.filterExpression),super.setState({filters:e,filterExpression:r}),(a&&!0!==(null==t?void 0:t.skipPublish)||(null==t?void 0:t.forcePublish))&&this.publishEvent(new qe(this),!0)}restoreOriginalFilter(e){const t={matchAllFilter:!1,restorable:!1};if(e.restorable){const n=this._originalValues.get(`${e.key}-${e.origin}`);if(!n)return;t.value=null==n?void 0:n.value[0],t.values=null==n?void 0:n.value,t.valueLabels=null==n?void 0:n.value,t.operator=null==n?void 0:n.operator,t.nonApplicable=null==n?void 0:n.nonApplicable;const r=K(this);null==r||r.startProfile("filter_restored"),this._updateFilter(e,t)}}getValue(){return this.state.filterExpression}_updateFilter(e,t){var n;const{originFilters:r,filters:a,_wip:i}=this.state;if(e.origin){const a=this._originalValues.get(`${e.key}-${e.origin}`),i=t.values||(t.value?[t.value]:void 0);i&&!(0,I.isEqual)(i,null==a?void 0:a.value)||t.operator&&t.operator!==(null==a?void 0:a.operator)?t.restorable=!0:i&&(0,I.isEqual)(i,null==a?void 0:a.value)&&(t.restorable=!1);const o=null!=(n=null==r?void 0:r.map(n=>n===e?{...n,...t}:n))?n:[];return void this.setState({originFilters:o})}if(e===i)return void("value"in t&&""!==t.value?(this.setState({filters:[...a,{...i,...t}],_wip:void 0}),this._debouncedVerifyApplicability()):this.setState({_wip:{...e,...t}}));const o=this.state.filters.map(n=>n===e?{...n,...t}:n);this.setState({filters:o})}updateToMatchAll(e){this._updateFilter(e,{operator:"=~",value:".*",values:[".*"],valueLabels:["All"],matchAllFilter:!0,nonApplicable:!1,restorable:!0})}_removeFilter(e){if(e===this.state._wip)return void this.setState({_wip:void 0});const t=K(this);null==t||t.startProfile(Ve),this.setState({filters:this.state.filters.filter(t=>t!==e)}),this._debouncedVerifyApplicability()}_removeLastFilter(){const e=this.state.filters.at(-1);e&&this._removeFilter(e)}_handleComboboxBackspace(e){var t;if(this.state.filters.length){let t=this.state.filters.length-1;e!==this.state._wip&&(t=-1),this.setState({filters:this.state.filters.reduce((n,r,a)=>a!==t||r.readOnly?r===e?n:[...n,r]:[...n,{...r,forceEdit:!0}],[])})}else if(null==(t=this.state.originFilters)?void 0:t.length){let t=this.state.originFilters.length-1;e!==this.state._wip&&(t=-1),this.setState({originFilters:this.state.originFilters.reduce((n,r,a)=>a!==t||r.readOnly?r===e?n:[...n,r]:[...n,{...r,forceEdit:!0}],[])})}}async _verifyApplicability(){var e,t,n;const r=[...this.state.filters,...null!=(e=this.state.originFilters)?e:[]],a=await this._dataSourceSrv.get(this.state.datasource,this._scopedVars);if(!a||!a.getDrilldownsApplicability)return;if(!r)return;const i=Ml.getTimeRange(this).state.value,o=this.state.useQueriesAsFilterForOptions?Zs(this):void 0,s=await a.getDrilldownsApplicability({filters:r,queries:o,timeRange:i,scopes:Ml.getScopes(this),...In(this)}),l=new Map;s.forEach(e=>{l.set(`${e.key}${e.origin?`-${e.origin}`:""}`,e)});const u={filters:[...this.state.filters],originFilters:[...null!=(t=this.state.originFilters)?t:[]]};u.filters.forEach(e=>{const t=l.get(e.key);t&&(e.nonApplicable=!t.applicable,e.nonApplicableReason=t.reason)}),null==(n=u.originFilters)||n.forEach(e=>{const t=l.get(`${e.key}-${e.origin}`);if(t){e.matchAllFilter||(e.nonApplicable=!t.applicable,e.nonApplicableReason=t.reason);const n=this._originalValues.get(`${e.key}-${e.origin}`);n&&(n.nonApplicable=!t.applicable,n.nonApplicableReason=null==t?void 0:t.reason)}}),this.setState(u)}async _getKeys(e){var t,n,r,a,i;const o=await(null==(n=(t=this.state).getTagKeysProvider)?void 0:n.call(t,this,e));if(o&&o.replace)return al(o.values).map(Ls);if(this.state.defaultKeys)return this.state.defaultKeys.map(Ls);const s=await this._dataSourceSrv.get(this.state.datasource,this._scopedVars);if(!s||!s.getTagKeys)return[];const l=null!=(a=null==(r=this.state.originFilters)?void 0:r.filter(e=>!e.nonApplicable))?a:[],u=this.state.filters.filter(t=>t.key!==e&&!t.nonApplicable).concat(null!=(i=this.state.baseFilters)?i:[]).concat(l),c=Ml.getTimeRange(this).state.value,d=this.state.useQueriesAsFilterForOptions?Zs(this):void 0,p=await s.getTagKeys({filters:u,queries:d,timeRange:c,scopes:Ml.getScopes(this),...In(this)});il(p)&&this.setState({error:p.error.message});let h=al(p);o&&(h=h.concat(al(o.values)));const f=this.state.tagKeyRegexFilter;return f&&(h=h.filter(e=>e.text.match(f))),h.map(Ls)}async _getValuesFor(e){var t,n,r,a;const i=await(null==(n=(t=this.state).getTagValuesProvider)?void 0:n.call(t,this,e));if(i&&i.replace)return al(i.values).map(Ls);const o=await this._dataSourceSrv.get(this.state.datasource,this._scopedVars);if(!o||!o.getTagValues)return[];const s=null!=(a=null==(r=this.state.originFilters)?void 0:r.filter(t=>t.key!==e.key))?a:[],l=this.state.filters.filter(t=>t.key!==e.key).concat(s),u=Ml.getTimeRange(this).state.value,c=this.state.useQueriesAsFilterForOptions?Zs(this):void 0;let d=Ml.getScopes(this);"scope"===e.origin&&(d=null==d?void 0:d.map(t=>({...t,spec:{...t.spec,filters:t.spec.filters.filter(t=>t.key!==e.key)}})));const p=await o.getTagValues({key:e.key,filters:l,timeRange:u,queries:c,scopes:d,...In(this)});il(p)&&this.setState({error:p.error.message});let h=al(p);return i&&(h=h.concat(al(i.values))),h.map(Ls)}_addWip(){this.setState({_wip:{key:"",value:"",operator:"=",condition:""}})}_getOperators(){const{supportsMultiValueOperators:e,allowCustomValue:t=!0}=this.state;return ks.filter(({isMulti:n,isRegex:r})=>!(!e&&n)&&!(!t&&r)).map(({value:e,description:t})=>({label:e,value:e,description:t}))}}function Ps(e,t){var n;return(null!=e?e:Qs)(null!=(n=null==t?void 0:t.filter(e=>Fs(e)))?n:[])}As.Component=function({model:e}){const{filters:t,readOnly:n,addFilterButtonText:r}=e.useState(),a=(0,Bt.useStyles2)(Is);if("combobox"===e.state.layout)return h().createElement(_s,{model:e});return h().createElement("div",{className:a.wrapper},t.filter(e=>!e.hidden).map((t,n)=>h().createElement(h().Fragment,{key:n},h().createElement(nr,{filter:t,model:e}))),!n&&h().createElement(ar,{model:e,key:"'builder",addFilterButtonText:r}))};const Is=e=>({wrapper:(0,Xt.css)({display:"flex",flexWrap:"wrap",alignItems:"flex-end",columnGap:e.spacing(2),rowGap:e.spacing(1)})});function Ls(e){const{text:t,value:n}=e,r={label:String(t),value:String(null!=n?n:t)};return"group"in e&&(r.group=e.group),"meta"in e&&(r.meta=e.meta),r}function Ms(e){return"=~"===e.operator&&".*"===e.value}function Vs(e){return""!==e.key&&""!==e.operator&&""!==e.value}function Fs(e){return!e.nonApplicable}function Ns(e){const t=ks.find(t=>t.value===e);return!!t&&Boolean(t.isMulti)}class $s{constructor(){this._resultsMap=new Map,this._prevLayers=[]}getMergedStream(e){(function(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1})(e,this._prevLayers)&&(this._resultsMap=new Map,this._prevLayers=e);const t=e.map(e=>e.getResultsStream()),n=[];for(const t of e)n.push(t.activate());return(0,f.merge)(t).pipe((0,f.mergeAll)(),(0,f.filter)(e=>this._resultsMap.get(e.origin.state.key)!==e),(0,f.map)(e=>(this._resultsMap.set(e.origin.state.key,e),this._resultsMap.values())),(0,f.finalize)(()=>{n.forEach(e=>e())}))}}class js{constructor(e){this._variableDependency=e}findAndSubscribeToDrilldowns(e){const t=function(e){var t;for(const n of Kn.values())if(Al(n,null==(t=n.state.datasource)?void 0:t.uid)===e)return n}(e),n=function(e){var t;for(const n of jt.values())if(Al(n,null==(t=n.state.datasource)?void 0:t.uid)===e)return n}(e);let r=!1;this._adhocFiltersVar!==t&&(this._adhocFiltersVar=t,r=!0),this._groupByVar!==n&&(this._groupByVar=n,r=!0),r&&this._updateExplicitDrilldownVariableDependencies()}_updateExplicitDrilldownVariableDependencies(){const e=[];this._adhocFiltersVar&&e.push(this._adhocFiltersVar.state.name),this._groupByVar&&e.push(this._groupByVar.state.name),this._variableDependency.setVariableNames(e)}get adHocFiltersVar(){return this._adhocFiltersVar}get groupByVar(){return this._groupByVar}getFilters(){var e;return this._adhocFiltersVar?[...null!=(e=this._adhocFiltersVar.state.originFilters)?e:[],...this._adhocFiltersVar.state.filters].filter(e=>Vs(e)&&Fs(e)):void 0}getGroupByKeys(){return this._groupByVar?this._groupByVar.getApplicableKeys():void 0}cleanup(){this._adhocFiltersVar=void 0,this._groupByVar=void 0}}let Bs=100;function zs(){return"SQR"+Bs++}class Ws extends k{constructor(e){super(e),this._dataLayersMerger=new $s,this._variableValueRecorder=new Mt,this._results=new f.ReplaySubject(1),this._scopedVars={__sceneObject:Nn(this)},this._isInView=!0,this._bypassIsInView=!1,this._queryNotExecutedWhenOutOfView=!1,this._variableDependency=new ul(this,{statePaths:["queries","datasource","minInterval"],onVariableUpdateCompleted:this.onVariableUpdatesCompleted.bind(this),onAnyVariableChanged:this.onAnyVariableChanged.bind(this),dependsOnScopes:!0}),this._drilldownDependenciesManager=new js(this._variableDependency),this.onDataReceived=e=>{const t=(0,o.preProcessPanelData)(e,this.state.data);this._resultAnnotations=e.annotations;const n=this._combineDataLayers(t);let r=this.state._hasFetchedData;r||t.state===X.Loading||(r=!0),this.setState({data:n,_hasFetchedData:r}),this._results.next({origin:this,data:n})},this.addActivationHandler(()=>this._onActivate())}getResultsStream(){return this._results}_onActivate(){if(this.isQueryModeAuto()){const e=Ml.getTimeRange(this),t=this.getClosestExtraQueryProviders();for(const e of t)this._subs.add(e.subscribeToState((t,n)=>{e.shouldRerun(n,t,this.state.queries)&&this.runQueries()}));this.subscribeToTimeRangeChanges(e),this.shouldRunQueriesOnActivate()&&this.runQueries()}return this._dataLayersSub||this._handleDataLayers(),()=>this._onDeactivate()}_handleDataLayers(){const e=Ml.getDataLayers(this);0!==e.length&&(this._dataLayersSub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayersReceived.bind(this)))}_onLayersReceived(e){var t,n,r,a,i;const s=Ml.getTimeRange(this),{dataLayerFilter:l}=this.state;let u,c=[],d=[];for(const r of e)for(let e of r.data.series)(null==(t=e.meta)?void 0:t.dataTopic)===o.DataTopic.Annotations&&(c=c.concat(e)),(null==(n=e.meta)?void 0:n.dataTopic)===o.DataTopic.AlertStates&&(d=d.concat(e));if((null==l?void 0:l.panelId)&&(c.length>0&&(c=function(e,t){var n;if(!Array.isArray(e)||0===e.length)return e;const r=Array.from({length:e.length},()=>new Set);let a=0;for(const i of e){for(let e=0;e<i.length;e++){if(r[a].has(e))continue;let o=!0;const s=i.fields.find(e=>"panelId"===e.name),l=i.fields.find(e=>"source"===e.name);if(l){s&&"dashboard"===l.values[e].type&&(o=[t.panelId,Nt].includes(s.values[e]));const r=l.values[e].filter;if(r){const e=[...null!=(n=r.ids)?n:[],Nt].includes(t.panelId);r.exclude?e&&(o=!1):e||(o=!1)}}o&&r[a].add(e)}a++}const i=[];a=0;for(const t of e){const e=r[a].size,n=[];for(const e of t.fields){const i=[];for(let n=0;n<t.length;n++)r[a].has(n)&&i.push(e.values[n]);n.push({...e,values:i})}i.push({...t,fields:n,length:e}),a++}return i}(c,l)),d.length>0))for(const e of d){const t=new o.DataFrameView(e);for(const e of t)if(e.panelId===l.panelId){u=e;break}}if(Us(c)&&Us(this._layerAnnotations)&&(0,I.isEqual)(u,null==(r=this.state.data)?void 0:r.alertState))return;this._layerAnnotations=c;const p=this.state.data?this.state.data:{...J,timeRange:s.state.value};this.setState({data:{...p,annotations:[...null!=(a=this._resultAnnotations)?a:[],...c],alertState:null!=u?u:null==(i=this.state.data)?void 0:i.alertState}})}onVariableUpdatesCompleted(){this.isQueryModeAuto()&&this.runQueries()}onAnyVariableChanged(e){this._drilldownDependenciesManager.adHocFiltersVar!==e&&this._drilldownDependenciesManager.groupByVar!==e&&this.isQueryModeAuto()&&(e instanceof As&&this._isRelevantAutoVariable(e)&&this.runQueries(),e instanceof Un&&this._isRelevantAutoVariable(e)&&this.runQueries())}_isRelevantAutoVariable(e){var t,n;const r=null!=(t=this.state.datasource)?t:Hs(this.state.queries);return"auto"===e.state.applyMode&&(null==r?void 0:r.uid)===(null==(n=e.state.datasource)?void 0:n.uid)}shouldRunQueriesOnActivate(){return this._variableValueRecorder.hasDependenciesChanged(this)?($(),!0):!this.state.data||!!this._isDataTimeRangeStale(this.state.data)}_isDataTimeRangeStale(e){const t=Ml.getTimeRange(this).state.value,n=e.timeRange;return(t.from.unix()!==n.from.unix()||t.to.unix()!==n.to.unix())&&($(),!0)}_onDeactivate(){var e;this._querySub&&(this._querySub.unsubscribe(),this._querySub=void 0),this._dataLayersSub&&(this._dataLayersSub.unsubscribe(),this._dataLayersSub=void 0),null==(e=this._timeSub)||e.unsubscribe(),this._timeSub=void 0,this._timeSubRange=void 0,this._drilldownDependenciesManager.cleanup()}setContainerWidth(e){!this._containerWidth&&e>0?(this._containerWidth=e,this.state.maxDataPointsFromWidth&&!this.state.maxDataPoints&&setTimeout(()=>{this.isActive&&!this.state._hasFetchedData&&this.runQueries()},0)):e>0&&(this._containerWidth=e)}isDataReadyToDisplay(){return Boolean(this.state._hasFetchedData)}subscribeToTimeRangeChanges(e){this._timeSubRange!==e&&(this._timeSub&&this._timeSub.unsubscribe(),this._timeSubRange=e,this._timeSub=e.subscribeToState(()=>{this.runWithTimeRange(e)}))}runQueries(){const e=Ml.getTimeRange(this);this.isQueryModeAuto()&&this.subscribeToTimeRangeChanges(e),this.runWithTimeRange(e)}getMaxDataPoints(){var e;return this.state.maxDataPoints?this.state.maxDataPoints:this.state.maxDataPointsFromWidth&&null!=(e=this._containerWidth)?e:500}cancelQuery(){var e;null==(e=this._querySub)||e.unsubscribe(),this._dataLayersSub&&(this._dataLayersSub.unsubscribe(),this._dataLayersSub=void 0),this.setState({data:{...this.state.data,state:X.Done}})}async runWithTimeRange(e){var t,n,r;if(!this.state.maxDataPoints&&this.state.maxDataPointsFromWidth&&!this._containerWidth)return;if(this.isQueryModeAuto()&&!this._isInView&&!this._bypassIsInView)return void(this._queryNotExecutedWhenOutOfView=!0);if(this._queryNotExecutedWhenOutOfView=!1,this._dataLayersSub||this._handleDataLayers(),null==(t=this._querySub)||t.unsubscribe(),this._variableDependency.hasDependencyInLoadingState())return $(),void this.setState({data:{...null!=(n=this.state.data)?n:J,state:X.Loading}});this._variableValueRecorder.recordCurrentDependencyValuesForSceneObject(this);const{queries:a}=this.state;if(null==a?void 0:a.length)try{const t=null!=(r=this.state.datasource)?r:Hs(a),n=await Lt(t,this._scopedVars);this._drilldownDependenciesManager.findAndSubscribeToDrilldowns(n.uid);const i=(0,s.getRunRequest)(),{primary:o,secondaries:l,processors:u}=this.prepareRequests(e,n);$(0,0,this.state.key);let c=i(n,o);if(l.length>0){const e=l.map(e=>i(n,e)),t=(e=>t=>t.pipe((0,f.mergeMap)(([t,...n])=>{const r=n.flatMap(n=>{var r,a;return null!=(a=null==(r=e.get(n.request.requestId))?void 0:r(t,n))?a:(0,f.of)(n)});return(0,f.forkJoin)([(0,f.of)(t),...r])}),(0,f.map)(([e,...t])=>{var n;return{...e,series:[...e.series,...t.flatMap(e=>e.series)],annotations:[...null!=(n=e.annotations)?n:[],...t.flatMap(e=>{var t;return null!=(t=e.annotations)?t:[]})]}})))(u);c=(0,f.forkJoin)([c,...e]).pipe(t)}c=c.pipe(Pt({type:"SceneQueryRunner/runQueries",request:o,origin:this,cancel:()=>this.cancelQuery()})),this._querySub=c.subscribe(this.onDataReceived)}catch(e){console.error("PanelQueryRunner Error",e),this.onDataReceived({...J,...this.state.data,state:X.Error,errors:[(0,s.toDataQueryError)(e)]})}else this._setNoDataState()}clone(e){var t;const n=super.clone(e);return this._resultAnnotations&&(n._resultAnnotations=this._resultAnnotations.map(e=>({...e}))),this._layerAnnotations&&(n._layerAnnotations=this._layerAnnotations.map(e=>({...e}))),n._variableValueRecorder=this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this),n._containerWidth=this._containerWidth,n._results.next({origin:this,data:null!=(t=this.state.data)?t:J}),n}prepareRequests(e,t){var n;const{minInterval:r,queries:a}=this.state;let i={app:"scenes",requestId:zs(),timezone:e.getTimeZone(),range:e.state.value,interval:"1s",intervalMs:1e3,targets:(0,I.cloneDeep)(a),maxDataPoints:this.getMaxDataPoints(),scopedVars:this._scopedVars,startTime:Date.now(),liveStreaming:this.state.liveStreaming,rangeRaw:{from:e.state.from,to:e.state.to},cacheTimeout:this.state.cacheTimeout,queryCachingTTL:this.state.queryCachingTTL,scopes:Ml.getScopes(this),...$t(this)};const l=this._drilldownDependenciesManager.getFilters(),u=this._drilldownDependenciesManager.getGroupByKeys();l&&(i.filters=l),u&&(i.groupByKeys=u),i.targets=i.targets.map(e=>{var n;return e.datasource&&(e.datasource.uid===t.uid||(null==(n=t.meta)?void 0:n.mixed)||!s.isExpressionReference||(0,s.isExpressionReference)(e.datasource))||(e.datasource=t.getRef()),e});const c=r?Al(this,r):t.interval,d=o.rangeUtil.calculateInterval(e.state.value,i.maxDataPoints,c);i.scopedVars=Object.assign({},i.scopedVars,{__interval:{text:d.interval,value:d.interval},__interval_ms:{text:d.intervalMs.toString(),value:d.intervalMs}}),i.interval=d.interval,i.intervalMs=d.intervalMs;const p=e.state.value;let h=[],f=new Map;for(const e of null!=(n=this.getClosestExtraQueryProviders())?n:[])for(const{req:t,processor:n}of e.getExtraQueries(i)){const e=zs();h.push({...t,requestId:e}),f.set(e,null!=n?n:Ft)}return i.range=p,{primary:i,secondaries:h,processors:f}}_combineDataLayers(e){return this._layerAnnotations&&this._layerAnnotations.length>0&&(e.annotations=(e.annotations||[]).concat(this._layerAnnotations)),this.state.data&&this.state.data.alertState&&(e.alertState=this.state.data.alertState),e}_setNoDataState(){this.state.data!==J&&this.setState({data:J})}getClosestExtraQueryProviders(){const e=new Map;return this.parent?(te(this.parent,t=>(Vt(t)&&!e.has(t.constructor)&&e.set(t.constructor,t),t.forEachChild(t=>{Vt(t)&&!e.has(t.constructor)&&e.set(t.constructor,t)}),null)),Array.from(e.values())):[]}isQueryModeAuto(){var e;return"auto"===(null!=(e=this.state.runQueriesMode)?e:"auto")}isInViewChanged(e){$(0,0,this.state.key),this._isInView=e,e&&this._queryNotExecutedWhenOutOfView&&this.runQueries()}bypassIsInViewChanged(e){$(0,0,this.state.key),this._bypassIsInView=e,e&&this._queryNotExecutedWhenOutOfView&&this.runQueries()}}function Hs(e){var t,n;return null!=(n=null==(t=e.find(e=>null!==e.datasource))?void 0:t.datasource)?n:void 0}function Us(e){if(!e)return!0;for(let t=0;t<e.length;t++)if(e[t].length>0)return!1;return!0}function qs(e,t){return e===t||(0,I.isEqual)(e,t)}function Gs(e){try{return JSON.stringify(e,(()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}})())}catch(e){console.error(e)}return""}function Qs(e){return e.map(e=>function(e){var t,n;let r="",a=e.operator;"=|"===a?(a="=~",r=null==(t=e.values)?void 0:t.map(Ys).join("|")):"!=|"===a?(a="!~",r=null==(n=e.values)?void 0:n.map(Ys).join("|")):r="=~"===a||"!~"===a?Ys(e.value):Ks(e.value);return`${e.key}${a}"${r}"`}(e)).join(",")}function Ks(e){return e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function Ys(e){return Ks(e.replace(Xs,"\\$&"))}const Xs=/[*+?()|\\.\[\]{}^$]/g;function Zs(e){var t;const n=Ml.findAllObjects(e.getRoot(),e=>e instanceof Ws),r=Ml.interpolate(e,null==(t=e.state.datasource)?void 0:t.uid),a=function(e){const t={};for(const n of e)n.state.key&&(n.state.key in t||(t[n.state.key]=[]),t[n.state.key].push(n));return Object.values(t).flatMap(e=>{const t=e.filter(e=>e.isActive);return 0===t.length&&1===e.length?e:t})}(n).filter(t=>{var n;return Ml.interpolate(e,null==(n=t.state.datasource)?void 0:n.uid)===r});if(0===a.length)return[];const i=[];return a.forEach(t=>{i.push(...t.state.queries.filter(t=>{if(!t.datasource||!t.datasource.uid)return!0;return Ml.interpolate(e,t.datasource.uid)===r}))}),i}function Js(e){return null==e?"":/\|/g[Symbol.replace](e,"__gfp__")}function el(e){return null==e?"":/,/g[Symbol.replace](e,"__gfc__")}function tl(e){return function(e){return null==e?"":/#/g[Symbol.replace](e,"__gfh__")}(Js(e))}function nl(e){return null==e?"":(e=/__gfp__/g[Symbol.replace](e,"|"),e=/__gfc__/g[Symbol.replace](e,","),e=/__gfh__/g[Symbol.replace](e,"#"))}function rl(e,t){return t&&e!==t?[e,t].map(el).join(","):el(e)}function al(e){return Array.isArray(e)?e:e.data}function il(e){return!Array.isArray(e)&&Boolean(e.error)}function ol(e){const t=[],n=new Map;for(const r of e){const e=r.group;if(e){let a=n.get(e);a||(a=[],n.set(e,a),t.push({label:e,options:a})),a.push(r)}else t.push(r)}return t}function sl(e){return{disabledPill:(0,Xt.css)({background:e.colors.action.selected,color:e.colors.text.disabled,border:0,"&:hover":{background:e.colors.action.selected}}),strikethrough:(0,Xt.css)({textDecoration:"line-through"})}}class ll extends k{constructor(e){super({type:"constant",value:"",name:"",...e,skipUrlSync:!0}),this._variableDependency=new ul(this,{statePaths:["value"]}),this._prevValue=""}validateAndUpdate(){const e=this.getValue();return this._prevValue!==e&&(this._prevValue=e,this.publishEvent(new qe(this),!0)),(0,f.of)({})}getValue(){return"string"==typeof this.state.value?Ml.interpolate(this,this.state.value):this.state.value}}class ul{constructor(e,t){this._sceneObject=e,this._options=t,this._dependencies=new Set,this._isWaitingForVariables=!1,this.scanCount=0,this._statePaths=t.statePaths,this._options.handleTimeMacros&&this.handleTimeMacros()}hasDependencyOn(e){return this.getNames().has(e)}variableUpdateCompleted(e,t){var n,r,a,i;const s=this.getNames(),l=(s.has(e.state.name)||s.has(o.DataLinkBuiltInVars.includeVars))&&t;$(0,0,e.state.name,this._isWaitingForVariables),null==(r=(n=this._options).onAnyVariableChanged)||r.call(n,e),this._options.onVariableUpdateCompleted&&(this._isWaitingForVariables||l)&&this._options.onVariableUpdateCompleted(),l&&(null==(i=(a=this._options).onReferencedVariableValueChanged)||i.call(a,e),this._options.onReferencedVariableValueChanged||this._options.onVariableUpdateCompleted||this._sceneObject.forceRender())}hasDependencyInLoadingState(){return this._isWaitingForVariables=Ml.hasVariableDependencyInLoadingState(this._sceneObject),this._isWaitingForVariables}getNames(){const e=this._state,t=this._state=this._sceneObject.state;return(!e||t!==e&&(!this._statePaths||this._statePaths.some(n=>"*"===n||t[n]!==e[n])))&&this.scanStateForDependencies(t),this._dependencies}setVariableNames(e){this._options.variableNames=e,this.scanStateForDependencies(this._state)}setPaths(e){this._statePaths=e}scanStateForDependencies(e){if(this._dependencies.clear(),this.scanCount++,this._options.variableNames)for(const e of this._options.variableNames)this._dependencies.add(e);if(this._options.dependsOnScopes&&this._dependencies.add(ht),this._statePaths)for(const t of this._statePaths){if("*"===t){this.extractVariablesFrom(e);break}{const n=e[t];n&&this.extractVariablesFrom(n)}}}extractVariablesFrom(e){dt.lastIndex=0;const t=("string"!=typeof e?Gs(e):e).matchAll(dt);if(t)for(const e of t){const[,t,n,,r]=e,a=t||n||r;this._dependencies.add(a)}}handleTimeMacros(){this._sceneObject.addActivationHandler(()=>{const e=Ml.getTimeRange(this._sceneObject).subscribeToState((e,t)=>{const n=this.getNames(),r=n.has("__from"),a=n.has("__to"),i=n.has("__timezone");if(e.value!==t.value)if(r){const t=new ll({name:"__from",value:e.from});this.variableUpdateCompleted(t,!0)}else if(a){const t=new ll({name:"__to",value:e.to});this.variableUpdateCompleted(t,!0)}if(e.timeZone!==t.timeZone&&i){const t=new ll({name:"__timezone",value:e.timeZone});this.variableUpdateCompleted(t,!0)}});return()=>e.unsubscribe()})}}const cl=e=>Boolean(e.metricFindQuery)&&!Boolean(e.variables),dl=e=>{if(!e.variables)return!1;if(e.variables.getType()!==o.VariableSupportType.Standard)return!1;const t=e.variables;return"toDataQuery"in t&&Boolean(t.toDataQuery)},pl=e=>{if(!e.variables)return!1;if(e.variables.getType()!==o.VariableSupportType.Custom)return!1;const t=e.variables;return"query"in t&&"editor"in t&&Boolean(t.query)&&Boolean(t.editor)},hl=e=>!!e.variables&&e.variables.getType()===o.VariableSupportType.Datasource;class fl{constructor(e,t=(0,s.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(dl(this.datasource))return this.datasource.variables.toDataQuery(function(e){var t;const n=null!=(t=e.state.query)?t:"";if("string"==typeof n)return{query:n,refId:`variable-${e.state.name}`};if(null==n.refId)return{...n,refId:`variable-${e.state.name}`};return e.state.query}(e));throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return dl(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):bl()}}class ml{constructor(e){this.datasource=e}getTarget(e){if(cl(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({variable:e,searchFilter:t},n){return cl(this.datasource)?(0,f.from)(this.datasource.metricFindQuery(e.state.query,{...n,variable:{name:e.state.name,type:e.state.type},searchFilter:t})).pipe((0,f.mergeMap)(e=>{if(!e||!e.length)return bl();const t=e;return(0,f.of)({series:t,state:o.LoadingState.Done,timeRange:n.range})})):bl()}}class gl{constructor(e,t=(0,s.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(pl(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return pl(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):bl()}}class vl{constructor(e,t=(0,s.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){var t;if(hl(this.datasource))return"string"==typeof e.state.query?e.state.query:{...e.state.query,refId:null!=(t=e.state.query.refId)?t:"variable-query"};throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return hl(this.datasource)?this._runRequest(this.datasource,t):bl()}}function bl(){return(0,f.of)({state:o.LoadingState.Done,series:[],timeRange:(0,o.getDefaultTimeRange)()})}let yl=function(e){if(dl(e))return new fl(e,(0,s.getRunRequest)());if(cl(e))return new ml(e);if(pl(e))return new gl(e);if(hl(e))return new vl(e);throw new Error(`Couldn't create a query runner for datasource ${e.type}`)};const wl=(e,t)=>{const n=[];let r=null;t.lastIndex=0;do{r=t.exec(e),r&&n.push(r)}while(t.global&&r&&""!==r[0]&&void 0!==r[0]);return n},Sl=(e,t)=>{if(t===o.VariableSort.disabled)return e;switch(t){case o.VariableSort.alphabeticalAsc:e=(0,I.sortBy)(e,"label");break;case o.VariableSort.alphabeticalDesc:e=(0,I.sortBy)(e,"label").reverse();break;case o.VariableSort.numericalAsc:e=(0,I.sortBy)(e,xl);break;case o.VariableSort.numericalDesc:e=(e=(0,I.sortBy)(e,xl)).reverse();break;case o.VariableSort.alphabeticalCaseInsensitiveAsc:e=(0,I.sortBy)(e,e=>(0,I.toLower)(e.label));break;case o.VariableSort.alphabeticalCaseInsensitiveDesc:e=(e=(0,I.sortBy)(e,e=>(0,I.toLower)(e.label))).reverse();break;case o.VariableSort.naturalAsc||7:e=El(e);break;case o.VariableSort.naturalDesc||8:e=(e=El(e)).reverse()}return e};function xl(e){if(!e.label)return-1;const t=e.label.match(/.*?(\d+).*/);return!t||t.length<2?-1:parseInt(t[1],10)}const _l=new Intl.Collator(void 0,{sensitivity:"accent",numeric:!0});function El(e){return e.slice().sort((e,t)=>_l.compare(e.label,t.label))}function Cl(){return e=>e.pipe((0,f.map)(e=>{const t=e.series;if(!t||!t.length)return[];if(function(e){if(!e)return!1;if(!e.length)return!0;const t=e[0];if((0,o.isDataFrame)(t))return!1;for(const e in t){if(!t.hasOwnProperty(e))continue;if(null!==t[e]&&"string"!=typeof t[e]&&"number"!=typeof t[e])continue;const n=e.toLowerCase();if("text"===n||"value"===n)return!0}return!1}(t))return t;if(0===t[0].fields.length)return[];const n=(0,o.getProcessedDataFrames)(t),r=[];let a=-1,i=-1,s=-1,l=-1;for(const e of n)for(let n=0;n<e.fields.length;n++){const r=e.fields[n],u=(0,o.getFieldDisplayName)(r,e,t).toLowerCase();r.type===o.FieldType.string&&-1===s&&(s=n),"text"===u&&r.type===o.FieldType.string&&-1===i&&(i=n),"value"===u&&r.type===o.FieldType.string&&-1===a&&(a=n),"expandable"!==u||r.type!==o.FieldType.boolean&&r.type!==o.FieldType.number||-1!==l||(l=n)}if(-1===s)throw new Error("Couldn't find any field of type string in the results.");for(const e of t)for(let t=0;t<e.length;t++){const n=-1!==l?e.fields[l].values.get(t):void 0,o=e.fields[s].values.get(t),u=-1!==i?e.fields[i].values.get(t):"",c=-1!==a?e.fields[a].values.get(t):"";-1!==a||-1!==i?-1!==a||-1===i?-1===a||-1!==i?r.push({text:u,value:c,expandable:n}):r.push({text:c,value:c,expandable:n}):r.push({text:u,value:u,expandable:n}):r.push({text:o,value:o,expandable:n})}return r}))}class Rl extends wt{constructor(e){super({type:"query",name:"",value:"",text:"",options:[],datasource:null,regex:"",query:"",refresh:o.VariableRefresh.onDashboardLoad,sort:o.VariableSort.disabled,...e}),this._variableDependency=new ul(this,{statePaths:["regex","query","datasource"]}),this.onSearchChange=e=>{Gs(this.state.query).indexOf(pt)>-1&&this._updateOptionsBasedOnSearchFilter(e)},this._updateOptionsBasedOnSearchFilter=(0,I.debounce)(async e=>{const t=await(0,f.lastValueFrom)(this.getValueOptions({searchFilter:e}));this.setState({options:t,loading:!1})},400)}getValueOptions(e){return this.state.query?(this.setState({loading:!0,error:null}),(0,f.from)(Lt(this.state.datasource,{__sceneObject:Nn(this)})).pipe((0,f.mergeMap)(t=>{const n=yl(t),r=n.getTarget(this),a=this.getRequest(r,e.searchFilter);return n.runRequest({variable:this,searchFilter:e.searchFilter},a).pipe(Pt({type:"QueryVariable/getValueOptions",request:a,origin:this}),(0,f.filter)(e=>e.state===o.LoadingState.Done||e.state===o.LoadingState.Error),(0,f.take)(1),(0,f.mergeMap)(e=>e.state===o.LoadingState.Error?(0,f.throwError)(()=>e.error):(0,f.of)(e)),Cl(),(0,f.mergeMap)(e=>{let t="";this.state.regex&&(t=Ml.interpolate(this,this.state.regex,void 0,"regex"));let n=function(e,t,n){var r,a,i,s,l,u,c,d,p,h;let f,m=[];e&&(f=(0,o.stringToJsRegex)(e));for(let e=0;e<n.length;e++){const t=n[e];let o=null!=(a=null!=(r=t.text)?r:t.value)?a:"",g=null!=(s=null!=(i=t.value)?i:t.text)?s:"";if((0,I.isNumber)(g)&&(g=g.toString()),(0,I.isNumber)(o)&&(o=o.toString()),f){const e=wl(g,f);if(!e.length)continue;const t=e.find(e=>e.groups&&e.groups.value),n=e.find(e=>e.groups&&e.groups.text),r=e.find(e=>e.length>1),a=e.length>1&&r;if(t||n)g=null!=(c=null==(l=null==t?void 0:t.groups)?void 0:l.value)?c:null==(u=null==n?void 0:n.groups)?void 0:u.text,o=null!=(h=null==(d=null==n?void 0:n.groups)?void 0:d.text)?h:null==(p=null==t?void 0:t.groups)?void 0:p.value;else{if(a){for(let t=0;t<e.length;t++){const n=e[t];m.push({label:n[1],value:n[1]})}continue}r&&(o=r[1],g=r[1])}}m.push({label:o,value:g})}return m=(0,I.uniqBy)(m,"value"),Sl(m,t)}(t,this.state.sort,e);if(this.state.staticOptions){const e=this.state.staticOptions;n=n.filter(t=>!e.find(e=>e.value===t.value)),"after"===this.state.staticOptionsOrder?n.push(...e):"sorted"===this.state.staticOptionsOrder?n=Sl(n.concat(e),this.state.sort):n.unshift(...e)}return(0,f.of)(n)}),(0,f.catchError)(e=>e.cancelled?(0,f.of)([]):(0,f.throwError)(()=>e)))}))):(0,f.of)([])}getRequest(e,t){const n={__sceneObject:Nn(this)};t&&(n.__searchFilter={value:t,text:t});const r=Ml.getTimeRange(this).state.value;return{app:o.CoreApp.Dashboard,requestId:S(),timezone:"",range:r,interval:"",intervalMs:0,targets:[e],scopedVars:n,startTime:Date.now()}}}Rl.Component=({model:e})=>h().createElement(kn,{model:e});var Ol=n(2245);class Tl extends k{constructor(e){super({skipUrlSync:!0,loading:!0,scopes:[],...e,type:"system",name:ht,hide:Ol.zL.hideVariable}),this._renderBeforeActivation=!0,this.UNSAFE_renderAsHidden=!0}getValue(){var e;const t=null!=(e=this.state.scopes)?e:[];return new Dl(t.map(e=>e.metadata.name))}getScopes(){return this.state.scopes}setContext(e){if(!e)return;this._context=e;const t=e.state;null!=this.state.enable&&e.setEnabled(this.state.enable);const n=e.stateObservable.subscribe(e=>{this.updateStateFromContext(e)});return()=>{n.unsubscribe(),null!=this.state.enable&&e.setEnabled(t.enabled)}}updateStateFromContext(e){const t=0!==e.value.length&&e.loading,n=this.state.scopes.map(e=>e.metadata.name),r=e.value.map(e=>e.metadata.name),a=!(0,I.isEqual)(n,r);if(t||!a&&0!==r.length)this.setState({loading:t});else{const n=K(this);null==n||n.startProfile("scopes_changed"),this.setState({scopes:e.value,loading:t}),this.publishEvent(new qe(this),!0)}}}Tl.Component=function({model:e}){const t=(0,d.useContext)(s.ScopesContext);return(0,d.useEffect)(()=>e.setContext(t),[t,e]),null};class Dl{constructor(e){this._value=e}formatter(e){return e===Y.$m.QueryParam?this._value.map(e=>`scope=${encodeURIComponent(e)}`).join("&"):this._value.join(", ")}}function kl(e){var t;return null!=(t=te(e,e=>e.state.$data))?t:ze}function Al(e,t,n,r,a){return""===t||null==t?"":Ot(e,t,n,r,a)}function Pl(e,t,n,r){if(t(e))return e;let a=null;return e.forEachChild(e=>{if(e===n)return;let r=Pl(e,t);return r?(a=r,!1):void 0}),a||(r&&e.parent?Pl(e.parent,t,e,!0):null)}function Il(e,t){return Pl(e,t,void 0,!0)}function Ll(e,t){const n=[];return e.forEachChild(e=>{t(e)&&n.push(e),n.push(...Ll(e,t))}),n}const Ml={getVariables:function(e){var t;return null!=(t=te(e,e=>e.state.$variables))?t:He},getData:kl,getTimeRange:Ue,getLayout:function(e){const t=te(e,e=>function(e){return"isDraggable"in e}(e)?e:void 0);return t||null},getDataLayers:function(e,t=!1){let n=e,r=[];for(;n;){const e=n.state.$data;if(e){if(At(e)?r=r.concat(e):e.state.$data&&At(e.state.$data)&&(r=r.concat(e.state.$data)),t&&r.length>0)break;n=n.parent}else n=n.parent}return r},interpolate:Al,lookupVariable:N,hasVariableDependencyInLoadingState:function(e){if(!e.variableDependency)return!1;for(const t of e.variableDependency.getNames()){if(e instanceof Rl&&e.state.name===t){console.warn("Query variable is referencing itself");continue}const n=N(t,e);if(!n)continue;if(n.parent.isVariableLoadingOrWaitingToUpdate(n))return!0}return!1},findByKey:function(e,t){const n=Il(e,e=>e.state.key===t);if(!n)throw new Error("Unable to find scene with key "+t);return n},findByKeyAndType:function(e,t,n){const r=Il(e,e=>e.state.key===t);if(!r)throw new Error("Unable to find scene with key "+t);if(!(r instanceof n))throw new Error(`Found scene object with key ${t} does not match type ${n.name}`);return r},findObject:Il,findAllObjects:Ll,getAncestor:function(e,t){let n=e;for(;n;){if(n instanceof t)return n;n=n.parent}if(!n)throw new Error("Unable to find parent of type "+t.name);return n},getQueryController:K,findDescendents:function(e,t){function n(e){return e instanceof t}return Ll(e,n).filter(n)},getScopes:function(e){const t=N(ht,e);if(t instanceof Tl)return t.state.scopes}},Vl=["from","to","timezone"];class Fl{constructor(e){this.index=new Map,this.options={namespace:(null==e?void 0:e.namespace)||"",excludeFromNamespace:(null==e?void 0:e.excludeFromNamespace)||Vl}}getOptions(){return this.options}getNamespacedKey(e){return this.options.namespace&&!this.options.excludeFromNamespace.includes(e)?`${this.options.namespace}-${e}`:e}getUniqueKey(e,t){const n=this.getNamespacedKey(e),r=this.index.get(n);if(!r)return this.index.set(n,[t]),n;let a=r.findIndex(e=>e===t);return-1===a&&(!function(e){for(const t of e)if(Nl(t)){const n=e.indexOf(t);e.splice(n,1)}}(r),r.push(t),a=r.length-1),a>0?`${n}-${a+1}`:n}clear(){this.index.clear()}}function Nl(e){const t=e.getRoot();return!Ml.findObject(t,t=>t===e)}function $l(e,t){const n=new Fl(t),r={},a=e=>{if(e.urlSync){const t=e.urlSync.getUrlState();for(const[a,i]of Object.entries(t))if(null!=i){const t=n.getUniqueKey(a,e);r[t]=i}}e.forEachChild(a)};return a(e),r}function jl(e,t,n,r){r||Bl(e,t,n),e.forEachChild(e=>{Bl(e,t,n)}),e.forEachChild(e=>jl(e,t,n,!0))}function Bl(e,t,n){if(e.urlSync){const r={},a=e.urlSync.getUrlState();for(const i of e.urlSync.getKeys()){const o=n.getUniqueKey(i,e),s=t.getAll(o),l=a[i];zl(s,l)||(s.length>0?Array.isArray(l)?r[i]=s:r[i]=s[0]:r[i]=null)}Object.keys(r).length>0&&e.urlSync.updateFromUrl(r)}}function zl(e,t){return 0===e.length&&null==t||(Array.isArray(t)||1!==(null==e?void 0:e.length)?0===(null==t?void 0:t.length)&&null===e||(0,I.isEqual)(e,t):t===e[0])}class Wl extends k{constructor(e){super({type:"system",value:"",text:"",name:"",...e,skipUrlSync:!0})}getValue(){return this.state.value}getValueText(){return this.state.text.toString()}isAncestorLoading(){var e,t;const n=null==(t=null==(e=this.parent)?void 0:e.parent)?void 0:t.parent;if(!n)throw new Error("LocalValueVariable requires a parent SceneVariableSet that has an ancestor SceneVariableSet");const r=Ml.getVariables(n),a=Ml.lookupVariable(this.state.name,n);return!(!r||!a)&&r.isVariableLoadingOrWaitingToUpdate(a)}}const Hl="$";function Ul(e){let t,n=`panel-${e.getLegacyPanelId()}`,r=e;for(;r;){const e=r.state.$variables;e&&e.state.variables.forEach(e=>{e.state.name!==t&&e instanceof Wl&&(n=`${e.state.value}${Hl}${n}`,t=e.state.name)}),r=r.parent}return n}class ql extends k{constructor(){super(...arguments),this._runningEffect=null,this._variableDependency=new ul(this,{variableNames:[this.state.variableName],onReferencedVariableValueChanged:this._onVariableChanged.bind(this)})}_onVariableChanged(e){const t=this.state.onChange;this._runningEffect&&(this._runningEffect(),this._runningEffect=null);const n=t(e,this);n&&(this._runningEffect=n)}}var Gl=n(6145);class Ql extends k{constructor(e){super({...e,sync:e.sync||Gl.yV.Off}),this.getEventsBus=e=>{if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return new Kl(this.parent,e)}}getEventsScope(){if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return this.state.key}}class Kl{constructor(e,t){this._source=e,this._eventsOrigin=t}publish(e){e.origin=this,this._eventsOrigin.publishEvent(e,!0)}getStream(e){return new f.Observable(t=>{const n=this._source.subscribeToEvent(e,e=>{t.next(e)});return()=>n.unsubscribe()})}subscribe(e,t){return this.getStream(e).pipe().subscribe(t)}removeAllListeners(){}newScopedBus(e,t){throw new Error("For internal use only")}}var Yl=function(){};var Xl="undefined"!=typeof window;const Zl=Xl?d.useLayoutEffect:d.useEffect;var Jl={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const eu=Xl&&void 0!==window.ResizeObserver?function(){var e=(0,d.useState)(null),t=e[0],n=e[1],r=(0,d.useState)(Jl),a=r[0],i=r[1],o=(0,d.useMemo)(function(){return new window.ResizeObserver(function(e){if(e[0]){var t=e[0].contentRect,n=t.x,r=t.y,a=t.width,o=t.height,s=t.top,l=t.left,u=t.bottom,c=t.right;i({x:n,y:r,width:a,height:o,top:s,left:l,bottom:u,right:c})}})},[]);return Zl(function(){if(t)return o.observe(t),function(){o.disconnect()}},[t]),[n,a]}:function(){return[Yl,Jl]};function tu({data:e,showAll:t,seriesLimit:n,onShowAllSeries:r}){const a=(0,Bt.useStyles2)(nu),i=null==e?void 0:e.series.length;if(void 0===i||i<n)return null;const o=t?"Restore limit":`Show all ${i}`;return h().createElement("div",{className:a.timeSeriesDisclaimer},!t&&h().createElement("span",{className:a.warningMessage},h().createElement(Bt.Icon,{title:(0,Ze.t)("grafana-scenes.components.viz-panel-series-limit.warning-message","Showing only {{seriesLimit}} series",{seriesLimit:n}),name:"exclamation-triangle","aria-hidden":"true"})),h().createElement(Bt.Tooltip,{content:(0,Ze.t)("grafana-scenes.components.viz-panel-series-limit.content-rendering-series-single-panel-impact-performance","Rendering too many series in a single panel may impact performance and make data harder to read.")},h().createElement(Bt.Button,{variant:"secondary",size:"sm",onClick:r},o)))}const nu=e=>({timeSeriesDisclaimer:(0,Xt.css)({label:"time-series-disclaimer",display:"flex",alignItems:"center",gap:e.spacing(1)}),warningMessage:(0,Xt.css)({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.colors.warning.main,fontSize:e.typography.bodySmall.fontSize})});const ru=function(e){(0,d.useEffect)(e,[])};function au(){const e=(0,d.useRef)(void 0);return null!=e.current||(e.current=(0,I.uniqueId)()),e.current}const iu=h().forwardRef(({children:e,onLoad:t,onChange:n,className:r,...a},i)=>{const o=au(),{hideEmpty:s}=(0,Bt.useStyles2)(ou),[l,u]=(0,d.useState)(!1),[c,p]=(0,d.useState)(!1),f=(0,d.useRef)(null);return(0,d.useImperativeHandle)(i,()=>f.current),ru(()=>{iu.addCallback(o,e=>{!l&&e.isIntersecting&&(u(!0),null==t||t()),p(e.isIntersecting),null==n||n(e.isIntersecting)});const e=f.current;return e&&iu.observer.observe(e),()=>{e&&iu.observer.unobserve(e),delete iu.callbacks[o],0===Object.keys(iu.callbacks).length&&iu.observer.disconnect()}}),h().createElement("div",{id:o,ref:f,className:`${s} ${r}`,...a},l?h().createElement(su.Provider,{value:c},e):(0,Ze.t)("grafana-scenes.components.lazy-loader.placeholder"," "))});function ou(){return{hideEmpty:(0,Xt.css)({"&:empty":{display:"none"}})}}iu.displayName="LazyLoader",iu.callbacks={},iu.addCallback=(e,t)=>iu.callbacks[e]=t,iu.observer=new IntersectionObserver(e=>{for(const t of e)"function"==typeof iu.callbacks[t.target.id]&&iu.callbacks[t.target.id](t)},{rootMargin:"100px"});const su=h().createContext(!0);function lu(e,t){if(t)return t;let n=e.error?e.error.message:void 0;return e.errors&&(n=e.errors.map(e=>e.message).join(", ")),n}const uu=(0,Xt.css)({position:"relative",width:"100%",height:"100%"}),cu=(0,Xt.css)({position:"absolute",width:"100%",height:"100%"}),du=e=>({ok:(0,Xt.css)({color:e.colors.success.text}),pending:(0,Xt.css)({color:e.colors.warning.text}),alerting:(0,Xt.css)({color:e.colors.error.text})}),pu="hideSeriesFrom",hu=(0,o.isSystemOverrideWithRef)(pu);function fu(e,t=o.ByNamesMatcherMode.exclude,n){return n=null!=n?n:{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!0}},{__systemRef:pu,matcher:{id:o.FieldMatcherID.byNames,options:{mode:t,names:e,prefix:t===o.ByNamesMatcherMode.exclude?"All except:":void 0,readOnly:!0}},properties:[{...n,value:{viz:!0,legend:!1,tooltip:!0}}]}}const mu=(e,t,n=o.ByNamesMatcherMode.exclude)=>{const r=e.properties.find(e=>"custom.hideFrom"===e.id),a=gu(e),i=a.findIndex(e=>e===t);return i<0?a.push(t):a.splice(i,1),fu(a,n,r)},gu=e=>{var t;const n=null==(t=e.matcher.options)?void 0:t.names;return Array.isArray(n)?[...n]:[]},vu=(e,t)=>gu(e).length===bu(t).length,bu=(e,t)=>{const n=new Set;for(const r of e)for(const a of r.fields){if(a.type!==o.FieldType.number)continue;const i=(0,o.getFieldDisplayName)(a,r,e);i!==t&&n.add(i)}return Array.from(n)},yu=(e,t)=>{var n;let r=[];for(const a of e){const e=a.properties.find(e=>"custom.hideFrom"===e.id);if(void 0!==e&&!0===(null==(n=e.value)?void 0:n.legend)){const e=o.fieldMatchers.get(a.matcher.id).get(a.matcher.options);for(const n of t)for(const a of n.fields){if(a.type!==o.FieldType.number)continue;const i=(0,o.getFieldDisplayName)(a,n,t);e(a,n,t)&&r.push(i)}}}return r},wu=(e,t)=>({matcher:{id:o.FieldMatcherID.byName,options:e},properties:[Su(t)]}),Su=e=>({id:"color",value:{mode:o.FieldColorModeId.Fixed,fixedColor:e}});class xu extends k{constructor(){super(...arguments),this.isDataLayer=!0,this._results=new f.ReplaySubject(1),this._dataLayersMerger=new $s}subscribeToAllLayers(e){e.length>0?this.querySub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayerUpdateReceived.bind(this)):(this._results.next({origin:this,data:J}),this.setStateHelper({data:J}))}_onLayerUpdateReceived(e){var t;let n=[];for(const r of e)(null==(t=r.data)?void 0:t.series)&&(n=n.concat(r.data.series));const r={...J,series:n};this._results.next({origin:this,data:r}),this.setStateHelper({data:r})}getResultsStream(){return this._results}cancelQuery(){var e;null==(e=this.querySub)||e.unsubscribe()}setStateHelper(e){vt(this,e)}}class _u extends xu{constructor(e){var t,n;super({name:null!=(t=e.name)?t:"Data layers",layers:null!=(n=e.layers)?n:[]}),this.addActivationHandler(()=>this._onActivate())}_onActivate(){return this._subs.add(this.subscribeToState((e,t)=>{var n;e.layers!==t.layers&&(null==(n=this.querySub)||n.unsubscribe(),this.subscribeToAllLayers(e.layers))})),this.subscribeToAllLayers(this.state.layers),()=>{var e;null==(e=this.querySub)||e.unsubscribe()}}}_u.Component=({model:e})=>{const{layers:t}=e.useState();return h().createElement(h().Fragment,null,t.map(e=>h().createElement(e.Component,{model:e,key:e.state.key})))};class Eu extends k{constructor(e){super(e),this._results=new f.ReplaySubject(1),this._variableDependency=new ul(this,{statePaths:["transformations"],onReferencedVariableValueChanged:()=>this.reprocessTransformations()}),this.addActivationHandler(()=>this.activationHandler())}activationHandler(){const e=this.getSourceData();return this._subs.add(e.subscribeToState(e=>this.transform(e.data))),e.state.data&&this.transform(e.state.data),()=>{this._transformSub&&this._transformSub.unsubscribe()}}getSourceData(){if(this.state.$data){if(this.state.$data instanceof _u)throw new Error("SceneDataLayerSet can not be used as data provider for SceneDataTransformer.");return this.state.$data}if(!this.parent||!this.parent.parent)throw new Error("SceneDataTransformer must either have $data set on it or have a parent.parent with $data");return Ml.getData(this.parent.parent)}setContainerWidth(e){this.state.$data&&this.state.$data.setContainerWidth&&this.state.$data.setContainerWidth(e)}isDataReadyToDisplay(){const e=this.getSourceData();return!e.isDataReadyToDisplay||e.isDataReadyToDisplay()}reprocessTransformations(){this.transform(this.getSourceData().state.data,!0)}cancelQuery(){var e,t;null==(t=(e=this.getSourceData()).cancelQuery)||t.call(e)}getResultsStream(){return this._results}clone(e){const t=super.clone(e);return this._prevDataFromSource&&(t._prevDataFromSource=this._prevDataFromSource),t}isInViewChanged(e){var t,n;null==(n=null==(t=this.state.$data)?void 0:t.isInViewChanged)||n.call(t,e)}bypassIsInViewChanged(e){var t,n;null==(n=null==(t=this.state.$data)?void 0:t.bypassIsInViewChanged)||n.call(t,e)}haveAlreadyTransformedData(e){if(!this._prevDataFromSource)return!1;if(e===this._prevDataFromSource)return!0;const{series:t,annotations:n}=this._prevDataFromSource;return e.series===t&&e.annotations===n&&(this.state.data&&e.state!==this.state.data.state&&this.setState({data:{...this.state.data,state:e.state}}),!0)}transform(e,t=!1){var n;if(0===this.state.transformations.length||!e)return this._prevDataFromSource=e,this.setState({data:e}),void(e&&this._results.next({origin:this,data:e}));if(!t&&this.haveAlreadyTransformedData(e))return;let r=this._interpolateVariablesInTransformationConfigs(e);const a=r.filter(e=>!("options"in e)&&!("topic"in e)||(null==e.topic||e.topic===o.DataTopic.Series)).map(e=>"operator"in e?e.operator:e),i=r.filter(e=>("options"in e||"topic"in e)&&e.topic===o.DataTopic.Annotations).map(e=>"operator"in e?e.operator:e);this._transformSub&&this._transformSub.unsubscribe();const l={interpolate:(t,n)=>{var r;return Ml.interpolate(this,t,{...null==(r=e.request)?void 0:r.scopedVars,...n})}};let u=[(0,o.transformDataFrame)(a,e.series,l)];e.annotations&&e.annotations.length>0&&i.length>0&&u.push((0,o.transformDataFrame)(i,null!=(n=e.annotations)?n:[]));let c=[],d=[];this._transformSub=(0,f.forkJoin)(u).pipe((0,f.map)(t=>(t.forEach(e=>{var t;for(const n of e)(null==(t=n.meta)?void 0:t.dataTopic)===o.DataTopic.Annotations?d.push(n):c.push(n)}),{...e,series:c,annotations:d})),(0,f.catchError)(t=>{var n;console.error("Error transforming data: ",t);const r=(null==(n=this.getSourceData().state.data)?void 0:n.errors)||[],a=(0,s.toDataQueryError)(t);a.message=`Error transforming data: ${a.message}`;const i={...e,state:o.LoadingState.Error,errors:[...r,a]};return(0,f.of)(i)})).subscribe(t=>{this.setState({data:t}),this._results.next({origin:this,data:t}),this._prevDataFromSource=e})}_interpolateVariablesInTransformationConfigs(e){var t;const n=this.state.transformations;if(0===this._variableDependency.getNames().size)return n;return n.every(e=>"object"==typeof e)?JSON.parse(Ml.interpolate(this,JSON.stringify(n),null==(t=e.request)?void 0:t.scopedVars)):n.map(t=>{var n;return"object"==typeof t?JSON.parse(Ml.interpolate(this,JSON.stringify(t),null==(n=e.request)?void 0:n.scopedVars)):t})}}class Cu extends k{constructor(e){var t;super({options:{},fieldConfig:{defaults:{},overrides:[]},title:(0,Ze.t)("grafana-scenes.components.viz-panel.title.title","Title"),pluginId:"timeseries",_renderCounter:0,...e}),this._variableDependency=new ul(this,{statePaths:["title","options","fieldConfig"]}),this._structureRev=0,this.onTimeRangeChange=e=>{Ml.getTimeRange(this).onTimeRangeChange({raw:{from:(0,o.toUtc)(e.from),to:(0,o.toUtc)(e.to)},from:(0,o.toUtc)(e.from),to:(0,o.toUtc)(e.to)})},this.getTimeRange=e=>{const t=Ml.findObject(this,e=>e instanceof Ou),n=Ml.getTimeRange(this);if(t instanceof Ou&&t.isEnabled)return ae(n.state.from,n.state.to,n.getTimeZone(),n.state.fiscalYearStartMonth,n.state.UNSAFE_nowDelay,n.state.weekStart);const r=this.getPlugin();return r&&!r.meta.skipDataQuery&&e&&e.timeRange?e.timeRange:n.state.value},this.onTitleChange=e=>{this.setState({title:e})},this.onDescriptionChange=e=>{this.setState({description:e})},this.onDisplayModeChange=e=>{this.setState({displayMode:e})},this.onToggleCollapse=e=>{this.setState({collapsed:e})},this.onOptionsChange=(e,t=!1,n=!1)=>{var r;const{fieldConfig:a,options:i}=this.state,s=t?e:(0,I.mergeWith)((0,I.cloneDeep)(i),e,(e,t,n,r)=>{if((0,I.isArray)(t))return t;e===t||void 0!==t||(r[n]=t)}),l=(0,o.getPanelOptionsWithDefaults)({plugin:this._plugin,currentOptions:s,currentFieldConfig:a,isAfterPluginChange:n});this.setState({options:l.options,_renderCounter:(null!=(r=this.state._renderCounter)?r:0)+1})},this.onFieldConfigChange=(e,t)=>{const{fieldConfig:n,options:r}=this.state,a=t?e:(0,I.merge)((0,I.cloneDeep)(n),e),i=(0,o.getPanelOptionsWithDefaults)({plugin:this._plugin,currentOptions:r,currentFieldConfig:a,isAfterPluginChange:!1});this._dataWithFieldConfig=void 0,this.setState({fieldConfig:i.fieldConfig})},this.interpolate=(e,t,n)=>Ml.interpolate(this,e,t,n),this.getDescription=()=>{this.publishEvent(new C({origin:this,interaction:"panel-description-shown"}),!0);const{description:e}=this.state;if(e){const t=this.interpolate(e);return(0,o.renderMarkdown)(t)}return""},this.onCancelQuery=()=>{var e;this.publishEvent(new C({origin:this,interaction:"panel-cancel-query-clicked"}),!0);const t=Ml.getData(this);null==(e=t.cancelQuery)||e.call(t)},this.onStatusMessageClick=()=>{this.publishEvent(new C({origin:this,interaction:"panel-status-message-clicked"}),!0)},this._onSeriesColorChange=(e,t)=>{this.onFieldConfigChange(((e,t,n)=>{const{overrides:r}=n,a=n.overrides.findIndex(t=>t.matcher.id===o.FieldMatcherID.byName&&t.matcher.options===e);if(a<0)return{...n,overrides:[...n.overrides,wu(e,t)]};const i=Array.from(r),s=i[a],l=s.properties.findIndex(e=>"color"===e.id);if(l<0)return i[a]={...s,properties:[...s.properties,Su(t)]},{...n,overrides:i};const u=Array.from(s.properties);return u[l]=Su(t),i[a]={...s,properties:u},{...n,overrides:i}})(e,t,this.state.fieldConfig))},this._onSeriesVisibilityChange=(e,t)=>{this._dataWithFieldConfig&&this.onFieldConfigChange(function(e,t,n,r){const{overrides:a}=n,i=e,o=a.findIndex(hu);if(o<0){if(t===Bt.SeriesVisibilityChangeMode.ToggleSelection){const e=fu([i,...yu(a,r)]);return{...n,overrides:[...n.overrides,e]}}const e=fu(bu(r,i));return{...n,overrides:[...n.overrides,e]}}const s=Array.from(a),[l]=s.splice(o,1);if(t===Bt.SeriesVisibilityChangeMode.ToggleSelection){let e=gu(l);const t=yu(s,r);if(t.length>0&&(e=e.filter(e=>t.indexOf(e)<0)),e[0]===i&&1===e.length)return{...n,overrides:s};const a=fu([i,...t]);return{...n,overrides:[...s,a]}}const u=mu(l,i);return vu(u,r)?{...n,overrides:s}:{...n,overrides:[...s,u]}}(e,t,this.state.fieldConfig,this._dataWithFieldConfig.series),!0)},this._onInstanceStateChange=e=>{this._panelContext&&(this._panelContext={...this._panelContext,instanceState:e}),this.setState({_pluginInstanceState:e})},this._onToggleLegendSort=e=>{const t=this.state.options.legend;if(!t)return;let n=t.sortDesc,r=t.sortBy;e!==r&&(n=void 0),!1===n?(r=void 0,n=void 0):(n=!n,r=e),this.onOptionsChange({...this.state.options,legend:{...t,sortBy:r,sortDesc:n}},!0)},this.addActivationHandler(()=>{this._onActivate()}),null==(t=e.menu)||t.addActivationHandler(()=>{this.publishEvent(new C({origin:this,interaction:"panel-menu-shown"}),!0)})}_onActivate(){this._plugin||this._loadPlugin(this.state.pluginId)}forceRender(){var e;this.setState({_renderCounter:(null!=(e=this.state._renderCounter)?e:0)+1})}async _loadPlugin(e,t,n,r){const a=function(e){var t;const{getPanelPluginFromCache:n}=(0,s.getPluginImportUtils)();return null!=(t=n(e))?t:c.get(e)}(e);if(a)this._pluginLoaded(a,t,n,r);else{const{importPanelPlugin:a}=(0,s.getPluginImportUtils)();try{const i=a(e),o=Ml.getQueryController(this);o&&o.state.enableProfiling&&It(i).pipe(Pt({type:`VizPanel/loadPlugin/${e}`,origin:this})).subscribe(()=>{});const s=await i;this._pluginLoaded(s,t,n,r)}catch(t){this._pluginLoaded(function(e){const t=new o.PanelPlugin(()=>null);return t.meta={id:e,name:e,sort:100,type:o.PluginType.panel,module:"",baseUrl:"",info:{author:{name:""},description:"",links:[],logos:{large:"",small:"public/img/grafana_icon.svg"},screenshots:[],updated:"",version:""}},t}(e)),t instanceof Error&&this.setState({_pluginLoadError:t.message})}}}getLegacyPanelId(){var e,t;const n=null!=(t=null==(e=this.state.key)?void 0:e.split("/"))?t:[];if(0===n.length)return 0;const r=n[n.length-1],a=parseInt(r.replace("panel-",""),10);return isNaN(a)?0:a}getPathId(){return Ul(this)}async _pluginLoaded(e,t,n,r){var a;const{options:i,fieldConfig:s,title:l,pluginVersion:u,_UNSAFE_customMigrationHandler:c}=this.state,d={title:l,options:i,fieldConfig:s,id:this.getLegacyPanelId(),type:e.meta.id,pluginVersion:u};t&&(d.options=t),n&&(d.fieldConfig=n);const p=this._getPluginVersion(e);null==c||c(d,e);const h=p!==u||(null==(a=e.shouldMigrate)?void 0:a.call(e,d));e.onPanelMigration&&h&&!r&&(d.options=await e.onPanelMigration(d));let f=this.state.$data;d.transformations&&f&&(f instanceof Eu?f.setState({transformations:d.transformations}):f instanceof Ws&&(f.clearParent(),f=new Eu({transformations:d.transformations,$data:f})));const m=(0,o.getPanelOptionsWithDefaults)({plugin:e,currentOptions:d.options,currentFieldConfig:d.fieldConfig,isAfterPluginChange:null!=r&&r});if(this._plugin=e,this.setState({$data:f,options:m.options,fieldConfig:m.fieldConfig,pluginVersion:p,pluginId:e.meta.id}),e.meta.skipDataQuery){const e=Ml.getTimeRange(this);this._subs.add(e.subscribeToState(()=>this.forceRender()))}}_getPluginVersion(e){return e&&e.meta.info.version?e.meta.info.version:s.config.buildInfo.version}getPlugin(){return this._plugin}getPanelContext(){return null!=this._panelContext||(this._panelContext=this.buildPanelContext()),this._panelContext}async changePluginType(e,t,n){var r,a;const{options:i,fieldConfig:o,pluginId:s}=this.state;this._dataWithFieldConfig=void 0;const l=this.state.pluginId!==e;await this._loadPlugin(e,null!=t?t:{},n,l);const u={title:this.state.title,options:this.state.options,fieldConfig:this.state.fieldConfig,id:1,type:e},c=null==(a=null==(r=this._plugin)?void 0:r.onPanelTypeChanged)?void 0:a.call(r,u,s,i,o);c&&!(0,I.isEmpty)(c)&&this.onOptionsChange(c,!0,!0)}clearFieldConfigCache(){this._dataWithFieldConfig=void 0}applyFieldConfig(e){var t,n,r,a;const i=this._plugin;if(!i||i.meta.skipDataQuery||!e)return J;if(this._prevData===e&&this._dataWithFieldConfig)return this._dataWithFieldConfig;const l=i.dataSupport||{alertStates:!1,annotations:!1},u=i.fieldConfigRegistry,c=null!=(n=null==(t=this._dataWithFieldConfig)?void 0:t.series)?n:[],d=(0,o.applyFieldOverrides)({data:e.series,fieldConfig:this.state.fieldConfig,fieldConfigRegistry:u,replaceVariables:this.interpolate,theme:s.config.theme2,timeZone:null==(r=e.request)?void 0:r.timezone});return(0,o.compareArrayValues)(d,c,o.compareDataFrameStructures)||this._structureRev++,this._dataWithFieldConfig={...e,structureRev:this._structureRev,series:d},this._dataWithFieldConfig.annotations&&(this._dataWithFieldConfig.annotations=(0,o.applyFieldOverrides)({data:this._dataWithFieldConfig.annotations,fieldConfig:{defaults:{},overrides:[]},fieldConfigRegistry:u,replaceVariables:this.interpolate,theme:s.config.theme2,timeZone:null==(a=e.request)?void 0:a.timezone})),l.alertStates||(this._dataWithFieldConfig.alertState=void 0),l.annotations||(this._dataWithFieldConfig.annotations=void 0),this._prevData=e,this._dataWithFieldConfig}clone(e){return super.clone({_pluginInstanceState:void 0,_pluginLoadError:void 0,...e})}buildPanelContext(){const e=(t=this,Ml.findObject(t,e=>e instanceof Ql));var t;const n={eventsScope:e?e.getEventsScope():"__global_",eventBus:e?e.getEventsBus(this):(0,s.getAppEvents)(),app:o.CoreApp.Unknown,sync:()=>e?e.state.sync:o.DashboardCursorSync.Off,onSeriesColorChange:this._onSeriesColorChange,onToggleSeriesVisibility:this._onSeriesVisibilityChange,onToggleLegendSort:this._onToggleLegendSort,onInstanceStateChange:this._onInstanceStateChange};return this.state.extendPanelContext&&this.state.extendPanelContext(this,n),n}}Cu.Component=function({model:e}){var t;const{title:n,options:r,fieldConfig:a,_pluginLoadError:i,displayMode:l,hoverHeader:u,showMenuAlways:c,hoverHeaderOffset:p,menu:f,headerActions:m,titleItems:g,seriesLimit:v,seriesLimitShowAll:b,description:y,collapsible:w,collapsed:S,_renderCounter:x=0}=e.useState(),[_,{width:E,height:C}]=eu(),R=(0,d.useMemo)(()=>(0,s.getAppEvents)(),[]),O=(0,d.useCallback)(()=>{e.state.key&&R.publish(new o.SetPanelAttentionEvent({panelId:e.getPathId()}))},[e,R]),T=(0,d.useMemo)(()=>(0,I.debounce)(O,100,{leading:!0,trailing:!1}),[O]),D=e.getPlugin(),{dragClass:k,dragClassCancel:A}=function(e){var t,n;const r=Ml.getLayout(e),a=null==r?void 0:r.isDraggable();if(!r||!a||function(e,t){let n=e;for(;n&&n!==t;){if("isDraggable"in n.state&&!1===n.state.isDraggable)return!0;if("repeatSourceKey"in n.state&&n.state.repeatSourceKey)return!0;n=n.parent}return!1}(e,r))return{dragClass:"",dragClassCancel:""};return{dragClass:null==(t=r.getDragClass)?void 0:t.call(r),dragClassCancel:null==(n=null==r?void 0:r.getDragClassCancel)?void 0:n.call(r)}}(e),P=function(e){var t,n;const r=Ml.getLayout(e);return null!=(n=null==(t=null==r?void 0:r.getDragHooks)?void 0:t.call(r))?n:{}}(e),L=Ml.getData(e),M=L.useState(),V=function(e,t,n){return(0,d.useMemo)(()=>(null==e?void 0:e.series)&&t&&!n?{...e,series:e.series.slice(0,t)}:e,[e,t,n])}(M.data,v,b),F=e.applyFieldConfig(V),N=Ml.getTimeRange(e).getTimeZone(),$=e.getTimeRange(F),j=h().useContext(su);(0,d.useEffect)(()=>{L.isInViewChanged&&L.isInViewChanged(j)},[j,L]);const B=e.interpolate(n,void 0,"text"),z=(0,Bt.useStyles2)(du);if(!D)return h().createElement("div",null,h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.viz-panel-renderer.loading-plugin-panel"},"Loading plugin panel..."));if(!D.panel)return h().createElement("div",null,h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.viz-panel-renderer.panel-plugin-has-no-panel-component"},"Panel plugin has no panel component"));const W=D.panel;L&&L.setContainerWidth&&L.setContainerWidth(Math.round(E));let H,U,q=[];g&&(Array.isArray(g)?q=q.concat(g.map(e=>h().createElement(e.Component,{model:e,key:`${e.state.key}`}))):Tt(g)?q.push(h().createElement(g.Component,{model:g})):q.push(g)),v&&q.push(h().createElement(tu,{key:"series-limit",data:M.data,seriesLimit:v,showAll:b,onShowAllSeries:()=>e.setState({seriesLimitShowAll:!b})})),e.state.$timeRange&&q.push(h().createElement(e.state.$timeRange.Component,{model:e.state.$timeRange,key:e.state.key})),F.alertState&&q.push(h().createElement(Bt.Tooltip,{content:null!=(t=F.alertState.state)?t:"unknown",key:`alert-states-icon-${e.state.key}`},h().createElement(Bt.PanelChrome.TitleItem,{className:(0,Xt.cx)({[z.ok]:F.alertState.state===o.AlertState.OK,[z.pending]:F.alertState.state===o.AlertState.Pending,[z.alerting]:F.alertState.state===o.AlertState.Alerting})},h().createElement(Bt.Icon,{name:"alerting"===F.alertState.state?"heart-break":"heart",className:"panel-alert-icon",size:"md"})))),f&&(H=h().createElement(f.Component,{model:f})),m&&(U=Array.isArray(m)?h().createElement(h().Fragment,null,m.map(e=>h().createElement(e.Component,{model:e,key:`${e.state.key}`}))):Tt(m)?h().createElement(m.Component,{model:m}):m);const G=F,Q=!L.isDataReadyToDisplay||L.isDataReadyToDisplay(),K=e.getPanelContext(),Y=e.getLegacyPanelId();return h().createElement("div",{className:uu},h().createElement("div",{ref:_,className:cu,"data-viz-panel-key":e.state.key},E>0&&C>0&&h().createElement(Bt.PanelChrome,{title:B,description:(null==y?void 0:y.trim())?e.getDescription:void 0,loadingState:G.state,statusMessage:lu(G,i),statusMessageOnClick:e.onStatusMessageClick,width:E,height:C,selectionId:e.state.key,displayMode:l,titleItems:q,dragClass:k,actions:U,dragClassCancel:A,padding:D.noPadding?"none":"md",menu:H,onCancelQuery:e.onCancelQuery,onFocus:O,onMouseEnter:O,onMouseMove:T,onDragStart:t=>{var n;null==(n=P.onDragStart)||n.call(P,t,e)},showMenuAlways:c,...w?{collapsible:Boolean(w),collapsed:S,onToggleCollapse:e.onToggleCollapse}:{hoverHeader:u,hoverHeaderOffset:p}},(t,i)=>h().createElement(h().Fragment,null,h().createElement(Bt.ErrorBoundaryAlert,{dependencies:[D,G]},h().createElement(o.PluginContextProvider,{meta:D.meta},h().createElement(Bt.PanelContextProvider,{value:K},Q&&h().createElement(W,{id:Y,data:G,title:n,timeRange:$,timeZone:N,options:r,fieldConfig:a,transparent:"transparent"===l,width:t,height:i,renderCounter:x,replaceVariables:e.interpolate,onOptionsChange:e.onOptionsChange,onFieldConfigChange:e.onFieldConfigChange,onChangeTimeRange:e.onTimeRangeChange,eventBus:K.eventBus}))))))))};const Ru=class e extends k{constructor({enabled:e=!1}){super({enabled:e}),this.timerId=void 0,this._activationHandler=()=>(this.state.enabled&&this.enable(),()=>{window.clearInterval(this.timerId),this.timerId=void 0}),this.addActivationHandler(this._activationHandler)}enable(){window.clearInterval(this.timerId),this.timerId=void 0,this.timerId=window.setInterval(()=>{const e=Ml.findAllObjects(this.getRoot(),e=>e instanceof Cu);for(const t of e)t.forceRender()},e.REFRESH_RATE),this.setState({enabled:!0})}disable(){window.clearInterval(this.timerId),this.timerId=void 0,this.setState({enabled:!1})}get isEnabled(){return this.state.enabled}};Ru.REFRESH_RATE=100;let Ou=Ru;function Tu(e){if("string"==typeof e)return e;if(e){if(e instanceof Error)return e.message;if((0,s.isFetchError)(e)){if(e.data&&e.data.message)return e.data.message;if(e.statusText)return e.statusText}else if(e.hasOwnProperty("message"))return e.message}return JSON.stringify(e)}class Du extends k{constructor(e,t=[]){super({isEnabled:!0,...e}),this._results=new f.ReplaySubject(1),this.isDataLayer=!0,this._variableValueRecorder=new Mt,this._variableDependency=new ul(this,{onVariableUpdateCompleted:this.onVariableUpdateCompleted.bind(this),dependsOnScopes:!0}),this._variableDependency.setPaths(t),this.addActivationHandler(()=>this.onActivate())}onActivate(){return this.state.isEnabled&&this.onEnable(),this.shouldRunLayerOnActivate()&&this.runLayer(),this.subscribeToState((e,t)=>{!e.isEnabled&&this.querySub&&(this.querySub.unsubscribe(),this.querySub=void 0,this.onDisable(),this._results.next({origin:this,data:J}),this.setStateHelper({data:J})),e.isEnabled&&!t.isEnabled&&(this.onEnable(),this.runLayer())}),()=>{this.onDeactivate()}}onDeactivate(){this.querySub&&(this.querySub.unsubscribe(),this.querySub=void 0),this.onDisable(),this._variableValueRecorder.recordCurrentDependencyValuesForSceneObject(this)}onVariableUpdateCompleted(){this.runLayer()}cancelQuery(){this.querySub&&(this.querySub.unsubscribe(),this.querySub=void 0,this.publishResults(J))}publishResults(e){this.state.isEnabled&&(this._results.next({origin:this,data:e}),this.setStateHelper({data:e}))}getResultsStream(){return this._results}shouldRunLayerOnActivate(){return!!this.state.isEnabled&&(this._variableValueRecorder.hasDependenciesChanged(this)?($(),!0):!this.state.data)}setStateHelper(e){vt(this,e)}}class ku extends k{constructor(){super({})}}function Au({layer:e}){var t,n;const r=`data-layer-${e.state.key}`,{data:a,isEnabled:i}=e.useState(),o=Boolean(a&&a.state===X.Loading);return h().createElement("div",{className:Pu},h().createElement(Xn,{htmlFor:r,isLoading:o,onCancel:()=>{var t;return null==(t=e.cancelQuery)?void 0:t.call(e)},label:e.state.name,description:e.state.description,error:null==(n=null==(t=e.state.data)?void 0:t.errors)?void 0:n[0].message}),h().createElement(Bt.InlineSwitch,{id:r,value:i,onChange:()=>e.setState({isEnabled:!i})}))}ku.Component=function({model:e}){const t=Ml.getDataLayers(e,!0);if(0===t.length)return null;return h().createElement(h().Fragment,null,t.map(e=>h().createElement(e.Component,{model:e,key:e.state.key})))};const Pu=(0,Xt.css)({display:"flex"});function Iu(e){return"function"==typeof e}function Lu(e){return function(t){if(function(e){return Iu(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}var Mu=function(e,t){return Mu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Mu(e,t)};function Vu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Mu(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Fu=function(){return Fu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Fu.apply(this,arguments)};function Nu(e,t,n,r){return new(n||(n=Promise))(function(a,i){function o(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((r=r.apply(e,t||[])).next())})}function $u(e,t){var n,r,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create;function ju(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bu(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function zu(e,t,n){if(n||2===arguments.length)for(var r,a=0,i=t.length;a<i;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}function Wu(e){return this instanceof Wu?(this.v=e,this):new Wu(e)}function Hu(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){a[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{(n=a[e](t)).value instanceof Wu?Promise.resolve(n.value.v).then(l,u):c(i[0][2],n)}catch(e){c(i[0][3],e)}var n}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Uu(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ju(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,a,(t=e[n](t)).done,t.value)})}}}Object.create;"function"==typeof SuppressedError&&SuppressedError;var qu,Gu=((qu=function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}(function(e){Error.call(e),e.stack=(new Error).stack})).prototype=Object.create(Error.prototype),qu.prototype.constructor=qu,qu);function Qu(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ku=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,a;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var o=ju(i),s=o.next();!s.done;s=o.next()){s.value.remove(this)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else i.remove(this);var l=this.initialTeardown;if(Iu(l))try{l()}catch(e){a=e instanceof Gu?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var c=ju(u),d=c.next();!d.done;d=c.next()){var p=d.value;try{Xu(p)}catch(e){a=null!=a?a:[],e instanceof Gu?a=zu(zu([],Bu(a)),Bu(e.errors)):a.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}if(a)throw new Gu(a)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Xu(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Qu(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Qu(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();Ku.EMPTY;function Yu(e){return e instanceof Ku||e&&"closed"in e&&Iu(e.remove)&&Iu(e.add)&&Iu(e.unsubscribe)}function Xu(e){Iu(e)?e():e.unsubscribe()}var Zu={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Ju={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=Ju.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,zu([e,t],Bu(n))):setTimeout.apply(void 0,zu([e,t],Bu(n)))},clearTimeout:function(e){var t=Ju.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function ec(e){Ju.setTimeout(function(){var t=Zu.onUnhandledError;if(!t)throw e;t(e)})}function tc(){}var nc=rc("C",void 0,void 0);function rc(e,t,n){return{kind:e,value:t,error:n}}var ac=null;var ic=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Yu(t)&&t.add(n)):n.destination=pc,n}return Vu(t,e),t.create=function(e,t,n){return new uc(e,t,n)},t.prototype.next=function(e){this.isStopped?dc(function(e){return rc("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?dc(function(e){return rc("E",void 0,e)}(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?dc(nc,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ku),oc=Function.prototype.bind;function sc(e,t){return oc.call(e,t)}var lc=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){cc(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){cc(e)}else cc(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){cc(e)}},e}(),uc=function(e){function t(t,n,r){var a,i,o=e.call(this)||this;Iu(t)||!t?a={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:o&&Zu.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},a={next:t.next&&sc(t.next,i),error:t.error&&sc(t.error,i),complete:t.complete&&sc(t.complete,i)}):a=t;return o.destination=new lc(a),o}return Vu(t,e),t}(ic);function cc(e){var t;Zu.useDeprecatedSynchronousErrorHandling?(t=e,Zu.useDeprecatedSynchronousErrorHandling&&ac&&(ac.errorThrown=!0,ac.error=t)):ec(e)}function dc(e,t){var n=Zu.onStoppedNotification;n&&Ju.setTimeout(function(){return n(e,t)})}var pc={closed:!0,next:tc,error:function(e){throw e},complete:tc};function hc(e,t,n,r,a){return new fc(e,t,n,r,a)}var fc=function(e){function t(t,n,r,a,i,o){var s=e.call(this,t)||this;return s.onFinalize=i,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=a?function(e){try{a(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return Vu(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(ic);function mc(e,t){return Lu(function(n,r){var a=0;n.subscribe(hc(r,function(n){r.next(e.call(t,n,a++))}))})}var gc="function"==typeof Symbol&&Symbol.observable||"@@observable";function vc(e){return e}function bc(e){return 0===e.length?vc:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var yc=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,a=this,i=(r=e)&&r instanceof ic||function(e){return e&&Iu(e.next)&&Iu(e.error)&&Iu(e.complete)}(r)&&Yu(r)?e:new uc(e,t,n);return function(e){if(Zu.useDeprecatedSynchronousErrorHandling){var t=!ac;if(t&&(ac={errorThrown:!1,error:null}),e(),t){var n=ac,r=n.errorThrown,a=n.error;if(ac=null,r)throw a}}else e()}(function(){var e=a,t=e.operator,n=e.source;i.add(t?t.call(i,n):n?a._subscribe(i):a._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=wc(t))(function(t,r){var a=new uc({next:function(t){try{e(t)}catch(e){r(e),a.unsubscribe()}},error:r,complete:t});n.subscribe(a)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[gc]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return bc(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=wc(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function wc(e){var t;return null!==(t=null!=e?e:Zu.Promise)&&void 0!==t?t:Promise}var Sc="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function xc(e){if(e instanceof yc)return e;if(null!=e){if(function(e){return Iu(e[gc])}(e))return o=e,new yc(function(e){var t=o[gc]();if(Iu(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if((i=e)&&"number"==typeof i.length&&"function"!=typeof i)return a=e,new yc(function(e){for(var t=0;t<a.length&&!e.closed;t++)e.next(a[t]);e.complete()});if(Iu(null==(r=e)?void 0:r.then))return n=e,new yc(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,ec)});if(function(e){return Symbol.asyncIterator&&Iu(null==e?void 0:e[Symbol.asyncIterator])}(e))return _c(e);if(function(e){return Iu(null==e?void 0:e[Sc])}(e))return t=e,new yc(function(e){var n,r;try{for(var a=ju(t),i=a.next();!i.done;i=a.next()){var o=i.value;if(e.next(o),e.closed)return}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}e.complete()});if(function(e){return Iu(null==e?void 0:e.getReader)}(e))return _c(function(e){return Hu(this,arguments,function(){var t,n,r;return $u(this,function(a){switch(a.label){case 0:t=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Wu(t.read())];case 3:return n=a.sent(),r=n.value,n.done?[4,Wu(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Wu(r)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}(e))}var t,n,r,a,i,o;throw function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(e)}function _c(e){return new yc(function(t){(function(e,t){var n,r,a,i;return Nu(this,void 0,void 0,function(){var o,s;return $u(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=Uu(e),l.label=1;case 1:return[4,n.next()];case 2:if((r=l.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),a={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function Ec(e,t,n){return void 0===n&&(n=1/0),Iu(t)?Ec(function(n,r){return mc(function(e,a){return t(n,e,r,a)})(xc(e(n,r)))},n):("number"==typeof t&&(n=t),Lu(function(t,r){return function(e,t,n,r,a,i,o,s){var l=[],u=0,c=0,d=!1,p=function(){!d||l.length||u||t.complete()},h=function(e){return u<r?f(e):l.push(e)},f=function(e){i&&t.next(e),u++;var s=!1;xc(n(e,c++)).subscribe(hc(t,function(e){null==a||a(e),i?h(e):t.next(e)},function(){s=!0},void 0,function(){if(s)try{u--;for(var e=function(){var e=l.shift();o?function(e,t,n,r,a){void 0===r&&(r=0),void 0===a&&(a=!1);var i=t.schedule(function(){n(),a?e.add(this.schedule(null,r)):this.unsubscribe()},r);e.add(i)}(t,o,function(){return f(e)}):f(e)};l.length&&u<r;)e();p()}catch(e){t.error(e)}}))};return e.subscribe(hc(t,h,function(){d=!0,p()})),function(){null==s||s()}}(t,r,e,n)}))}const Cc={prepareAnnotation:e=>{if((0,I.isString)(null==e?void 0:e.query)){const{query:t,...n}=e;return{...n,target:{refId:"annotation_query",query:t},mappings:{}}}return e},prepareQuery:e=>e.target,processEvents:(e,t)=>function(e,t){return(0,f.of)(e).pipe(e=>e.pipe(Ec(e=>{if(!(null==e?void 0:e.length))return(0,f.of)(void 0);if(1===e.length)return(0,f.of)(e[0]);const t={interpolate:e=>e};return(0,f.of)(e).pipe(o.standardTransformers.mergeTransformer.operator({},t),mc(e=>e[0]))})),mc(e=>{if(!(null==e?void 0:e.length))return[];let n=!1,r=!1;const a={};for(const t of e.fields){a[(0,o.getFieldDisplayName)(t,e).toLowerCase()]=t}t||(t={});const i=[];for(const s of Oc){const l=t[s.key]||{};if(l.source===o.AnnotationEventFieldSource.Skip)continue;const u={key:s.key,split:s.split};if(l.source===o.AnnotationEventFieldSource.Text)u.text=l.value;else{const t=(l.value||s.key).toLowerCase();u.field=a[t],!u.field&&s.field&&(u.field=s.field(e))}(u.field||u.text)&&(i.push(u),"time"===u.key?n=!0:"text"===u.key&&(r=!0))}if(!n||!r)return console.error("Cannot process annotation fields. No time or text present."),[];const s=[];for(let t=0;t<e.length;t++){const e={type:"default",color:"red"};for(const n of i){let r;if(n.text)r=n.text;else if(n.field&&(r=n.field.values.get(t),void 0!==r&&n.regex)){const e=n.regex.exec(r);e&&(r=e[1]?e[1]:e[0])}null!=r&&(n.split&&"string"==typeof r&&(r=r.split(",")),e[n.key]=r)}s.push(e)}return s}))}(t,e.mappings)};const Rc=[{key:"time",field:e=>e.fields.find(e=>e.type===o.FieldType.time),placeholder:"time, or the first time field"},{key:"timeEnd",help:"When this field is defined, the annotation will be treated as a range"},{key:"title"},{key:"text",field:e=>e.fields.find(e=>e.type===o.FieldType.string),placeholder:"text, or the first text field"},{key:"tags",split:",",help:"The results will be split on comma (,)"},{key:"id"}],Oc=[...s.config.publicDashboardAccessToken?[{key:"color"},{key:"isRegion"},{key:"source"}]:[],...Rc,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];const Tc=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];let Dc=100;function kc(e,t,n,r,a,i){var l;if(e.annotationQuery&&function(e){const{type:t}=e;return!e.annotations||Tc.includes(t)}(e))return console.warn("Using deprecated annotationQuery method, please upgrade your datasource"),(0,f.from)(e.annotationQuery({range:t.state.value,rangeRaw:t.state.value.raw,annotation:n,dashboard:{getVariables:(0,s.getTemplateSrv)().getVariables}})).pipe(mc(e=>({state:X.Done,events:e})));const u={...Cc,...e.annotations},c={...null==(l=u.getDefaultQuery)?void 0:l.call(u),...n},d=u.prepareAnnotation(c);if(!d)return(0,f.of)({state:X.Done,events:[]});const p=u.prepareQuery(d);if(!p)return(0,f.of)({state:X.Done,events:[]});const h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,m=o.rangeUtil.calculateInterval(t.state.value,h,e.interval),g={__interval:{text:m.interval,value:m.interval},__interval_ms:{text:m.intervalMs.toString(),value:m.intervalMs},__annotation:{text:d.name,value:d},__sceneObject:Nn(r)},v={startTime:Date.now(),requestId:"AQ"+Dc++,range:t.state.value,maxDataPoints:h,scopedVars:g,...m,app:o.CoreApp.Dashboard,timezone:t.getTimeZone(),targets:[{...p,refId:"Anno"}],scopes:Ml.getScopes(r),filters:a,groupByKeys:i,...$t(r)};return(0,s.getRunRequest)()(e,v).pipe(Ec(e=>{const t=(null==e?void 0:e.series.length)?e.series:e.annotations;return(null==t?void 0:t.length)?(t.forEach(e=>{var t;(null==(t=e.meta)?void 0:t.dataTopic)||(e.meta={...e.meta||{},dataTopic:o.DataTopic.Annotations})}),u.processEvents(d,t).pipe(mc(t=>({state:e.state,events:t||[]})))):(0,f.of)({state:e.state,events:[]})}))}function Ac(e){return"panel-alert"===e.eventType}class Pc extends Du{constructor(e){super({isEnabled:!0,...e},["query"]),this._scopedVars={__sceneObject:Nn(this)},this._drilldownDependenciesManager=new js(this._variableDependency)}onEnable(){this.publishEvent(new s.RefreshEvent,!0);const e=Ml.getTimeRange(this);this.setState({query:{...this.state.query,enable:!0}}),this._timeRangeSub=e.subscribeToState(()=>{this.runWithTimeRange(e)})}onDisable(){var e;this.publishEvent(new s.RefreshEvent,!0),this.setState({query:{...this.state.query,enable:!1}}),null==(e=this._timeRangeSub)||e.unsubscribe()}runLayer(){$();const e=Ml.getTimeRange(this);this.runWithTimeRange(e)}async runWithTimeRange(e){var t;const{query:n}=this.state;if(n.enable)if(this._drilldownDependenciesManager.findAndSubscribeToDrilldowns(null==(t=n.datasource)?void 0:t.uid),this.querySub&&this.querySub.unsubscribe(),this._variableDependency.hasDependencyInLoadingState())$();else try{let t=kc(await this.resolveDataSource(n),e,n,this,this._drilldownDependenciesManager.getFilters(),this._drilldownDependenciesManager.getGroupByKeys()).pipe(Pt({type:"AnnotationsDataLayer/annotationsLoading",origin:this,cancel:()=>this.cancelQuery()}),(0,f.map)(e=>this.processEvents(n,e)));this.querySub=t.subscribe(e=>{this.publishResults(e)})}catch(e){this.publishResults({...J,state:X.Error,errors:[{message:Tu(e)}]}),console.error("AnnotationsDataLayer error",e)}}async resolveDataSource(e){return await Lt(e.datasource||void 0,this._scopedVars)}processEvents(e,t){let n=(r=e,a=t.events||[],r.snapshotData&&delete(r=(0,I.cloneDeep)(r)).snapshotData,a.map(e=>{var t;const n={...e};switch(n.source=r,n.color=s.config.theme2.visualization.getColorByName(r.iconColor),n.type=r.name,n.isRegion=Boolean(n.timeEnd&&n.time!==n.timeEnd),null==(t=n.newState)?void 0:t.toLowerCase()){case"pending":n.color="yellow";break;case"alerting":n.color="red";break;case"ok":case"normal":n.color="green";break;case"no_data":case"nodata":n.color="gray"}return n}));var r,a;n=function(e){let t=[];const n=(0,I.partition)(e,"id"),r=(0,I.groupBy)(n[0],"id");return t=(0,I.map)(r,e=>e.length>1&&!(0,I.every)(e,Ac)?(0,I.find)(e,e=>"panel-alert"!==e.eventType):(0,I.head)(e)),t=(0,I.concat)(t,n[1]),t}(n);const i={...J,state:t.state},l=(0,o.arrayToDataFrame)(n);return l.meta={...l.meta,dataTopic:o.DataTopic.Annotations},i.series=[l],i}}Pc.Component=function({model:e}){const{isHidden:t}=e.useState();if(t)return null;return h().createElement(Au,{layer:e})};class Ic extends k{constructor(e){super(e),this._activationHandler=()=>{const e=this.getAncestorTimeRange();this.ancestorTimeRangeChanged(e.state),this._subs.add(e.subscribeToState(e=>this.ancestorTimeRangeChanged(e)))},this.addActivationHandler(this._activationHandler)}getAncestorTimeRange(){if(!this.parent||!this.parent.parent)throw new Error(typeof this+" must be used within $timeRange scope");return Ml.getTimeRange(this.parent.parent)}getTimeZone(){return this.getAncestorTimeRange().getTimeZone()}onTimeRangeChange(e){this.getAncestorTimeRange().onTimeRangeChange(e)}onTimeZoneChange(e){this.getAncestorTimeRange().onTimeZoneChange(e)}onRefresh(){this.getAncestorTimeRange().onRefresh()}}class Lc extends Ic{constructor(e){super({...e,timeZone:e.timeZone,from:"now-6h",to:"now",value:(0,o.getDefaultTimeRange)()})}ancestorTimeRangeChanged(e){this.setState({...e,timeZone:this.state.timeZone,value:ae(e.from,e.to,this.state.timeZone,e.fiscalYearStartMonth,e.UNSAFE_nowDelay,e.weekStart)})}getTimeZone(){return this.state.timeZone}onTimeZoneChange(e){const t=this.getAncestorTimeRange();this.setState({timeZone:e,value:ae(t.state.from,t.state.to,e,t.state.fiscalYearStartMonth,t.state.UNSAFE_nowDelay,t.state.weekStart)})}}class Mc extends k{constructor(e){super({source:e.source,data:e.source.resolve().state.data}),this.addActivationHandler(()=>{this._subs.add(this.state.source.resolve().subscribeToState((e,t)=>{e.data!==t.data&&this.setState({data:e.data})}))})}setContainerWidth(e){var t,n;null==(n=(t=this.state.source.resolve()).setContainerWidth)||n.call(t,e)}isDataReadyToDisplay(){var e,t,n;return null==(n=null==(t=(e=this.state.source.resolve()).isDataReadyToDisplay)?void 0:t.call(e))||n}cancelQuery(){var e,t;null==(t=(e=this.state.source.resolve()).cancelQuery)||t.call(e)}getResultsStream(){return this.state.source.resolve().getResultsStream()}}class Vc extends k{}function Fc({variable:e,layout:t,showAlways:n,hideLabel:r}){return A(e,{shouldActivateOrKeepAlive:!0}).hide!==o.VariableHide.hideVariable||n?"vertical"===t?h().createElement("div",{className:jc,"data-testid":Yt.pages.Dashboard.SubMenu.submenuItem},h().createElement(Nc,{variable:e,layout:t,hideLabel:r}),h().createElement(e.Component,{model:e})):h().createElement("div",{className:$c,"data-testid":Yt.pages.Dashboard.SubMenu.submenuItem},h().createElement(Nc,{variable:e,hideLabel:r}),h().createElement(e.Component,{model:e})):e.UNSAFE_renderAsHidden?h().createElement(e.Component,{model:e}):null}function Nc({variable:e,layout:t,hideLabel:n}){var r;const{state:a}=e;if(e.state.hide===o.VariableHide.hideLabel||n)return null;const i=`var-${a.key}`,s=a.label||a.name;return h().createElement(Xn,{htmlFor:i,isLoading:a.loading,onCancel:()=>{var t;return null==(t=e.onCancel)?void 0:t.call(e)},label:s,error:a.error,layout:t,description:null!=(r=a.description)?r:void 0})}Vc.Component=function({model:e}){const t=Ml.getVariables(e).useState();return h().createElement(h().Fragment,null,t.variables.map(t=>h().createElement(Fc,{key:t.state.key,variable:t,layout:e.state.layout})))};const $c=(0,Xt.css)({display:"flex","> :nth-child(2)":(0,Xt.css)({borderTopLeftRadius:0,borderBottomLeftRadius:0})}),jc=(0,Xt.css)({display:"flex",flexDirection:"column"});class Bc extends k{}Bc.Component=function({model:e}){const t=Ml.lookupVariable(e.state.variableName,e);if(!t)return null;return h().createElement(Fc,{key:t.state.key,variable:t,layout:e.state.layout,showAlways:!0})};class zc extends k{constructor(e){super(e),this._variablesToUpdate=new Set,this._updating=new Map,this._variableValueRecorder=new Mt,this._variableDependency=new Hc(this._handleParentVariableUpdatesCompleted.bind(this)),this._onActivate=()=>{const e=Ml.getTimeRange(this);this._subs.add(this.subscribeToEvent(qe,e=>this._handleVariableValueChanged(e.payload))),this._subs.add(e.subscribeToState(()=>{this._refreshTimeRangeBasedVariables()})),this._subs.add(this.subscribeToState(this._onStateChanged)),this._checkForVariablesThatChangedWhileInactive();for(const e of this.state.variables)this._variableNeedsUpdate(e)&&this._variablesToUpdate.add(e);return this._updateNextBatch(),this._onDeactivate},this._onDeactivate=()=>{var e;for(const t of this._updating.values())null==(e=t.subscription)||e.unsubscribe();for(const e of this.state.variables)this._variablesToUpdate.has(e)||this._updating.has(e)||this._variableValueRecorder.recordCurrentValue(e);this._variablesToUpdate.clear(),this._updating.clear()},this._onStateChanged=(e,t)=>{const n=this._variablesToUpdate.size;for(const n of t.variables)if(!e.variables.includes(n)){const e=this._updating.get(n);(null==e?void 0:e.subscription)&&e.subscription.unsubscribe(),this._updating.delete(n),this._variablesToUpdate.delete(n)}for(const n of e.variables)t.variables.includes(n)||this._variableNeedsUpdate(n)&&this._variablesToUpdate.add(n);0===n&&this._variablesToUpdate.size>0&&this._updateNextBatch()},this.addActivationHandler(this._onActivate)}getByName(e){return this.state.variables.find(t=>t.state.name===e)}_refreshTimeRangeBasedVariables(){for(const e of this.state.variables)"refresh"in e.state&&e.state.refresh===o.VariableRefresh.onTimeRangeChanged&&this._variablesToUpdate.add(e);this._updateNextBatch()}_checkForVariablesThatChangedWhileInactive(){if(this._variableValueRecorder.hasValues())for(const e of this.state.variables)this._variableValueRecorder.hasValueChanged(e)&&(Wc(e,"Changed while in-active"),this._addDependentVariablesToUpdateQueue(e))}_variableNeedsUpdate(e){return!e.isLazy&&(!!e.validateAndUpdate&&(!this._variableValueRecorder.hasRecordedValue(e)||(Wc(e,"Skipping updateAndValidate current value valid"),!1)))}_updateNextBatch(){for(const e of this._variablesToUpdate){if(!e.validateAndUpdate){console.error("Variable added to variablesToUpdate but does not have validateAndUpdate");continue}if(this._updating.has(e))continue;if(Ml.hasVariableDependencyInLoadingState(e))continue;const t={variable:e};this._updating.set(e,t),Wc(e,"updateAndValidate started"),t.subscription=e.validateAndUpdate().subscribe({next:()=>this._validateAndUpdateCompleted(e),complete:()=>this._validateAndUpdateCompleted(e),error:t=>this._handleVariableError(e,t)})}}_validateAndUpdateCompleted(e){var t;if(!this._updating.has(e))return;const n=this._updating.get(e);null==(t=null==n?void 0:n.subscription)||t.unsubscribe(),this._updating.delete(e),this._variablesToUpdate.delete(e),Wc(e,"updateAndValidate completed"),this._notifyDependentSceneObjects(e),this._updateNextBatch()}cancel(e){var t;const n=this._updating.get(e);null==(t=null==n?void 0:n.subscription)||t.unsubscribe(),this._updating.delete(e),this._variablesToUpdate.delete(e)}_handleVariableError(e,t){var n;const r=this._updating.get(e);null==(n=null==r?void 0:r.subscription)||n.unsubscribe(),this._updating.delete(e),this._variablesToUpdate.delete(e),e.setState({loading:!1,error:t.message}),console.error("SceneVariableSet updateAndValidate error",t),Wc(e,"updateAndValidate error",t),this._notifyDependentSceneObjects(e),this._updateNextBatch()}_handleVariableValueChanged(e){this._addDependentVariablesToUpdateQueue(e),this._updating.has(e)||(this._updateNextBatch(),this._notifyDependentSceneObjects(e))}_handleParentVariableUpdatesCompleted(e,t){t&&this._addDependentVariablesToUpdateQueue(e),this._variablesToUpdate.size>0&&0===this._updating.size&&this._updateNextBatch()}_addDependentVariablesToUpdateQueue(e){for(const t of this.state.variables)t.variableDependency&&t.variableDependency.hasDependencyOn(e.state.name)&&(Wc(t,"Added to update queue, dependant variable value changed"),this._updating.has(t)&&t.onCancel&&t.onCancel(),t.validateAndUpdate&&this._variablesToUpdate.add(t),t.variableDependency.variableUpdateCompleted(e,!0))}_notifyDependentSceneObjects(e){this.parent&&this._traverseSceneAndNotify(this.parent,e,!0)}_traverseSceneAndNotify(e,t,n){if(this!==e&&e.isActive){if(e.state.$variables&&e.state.$variables!==this){const n=e.state.$variables.getByName(t.state.name);if(null==n?void 0:n.isAncestorLoading)t=n;else if(n)return}e.variableDependency&&e.variableDependency.variableUpdateCompleted(t,n),e.forEachChild(e=>this._traverseSceneAndNotify(e,t,n))}}isVariableLoadingOrWaitingToUpdate(e){return!!e.state.loading||(!(!e.isAncestorLoading||!e.isAncestorLoading())||(!(!this._variablesToUpdate.has(e)&&!this._updating.has(e))||Ml.hasVariableDependencyInLoadingState(e)))}}function Wc(e,t,n){$(0,e.state.name)}class Hc{constructor(e){this._variableUpdatesCompleted=e,this._emptySet=new Set}getNames(){return this._emptySet}hasDependencyOn(e){return!1}variableUpdateCompleted(e,t){this._variableUpdatesCompleted(e,t)}}class Uc extends wt{constructor(e){super({type:"custom",query:"",value:"",text:"",options:[],name:"",...e}),this._variableDependency=new ul(this,{statePaths:["query"]})}getValueOptions(e){var t;const n=(null!=(t=Ml.interpolate(this,this.state.query).match(/(?:\\,|[^,])+/g))?t:[]).map(e=>{var t;e=e.replace(/\\,/g,",");const n=null!=(t=/^\s*(.+)\s:\s(.+)$/g.exec(e))?t:[];if(3===n.length){const[,e,t]=n;return{label:e.trim(),value:t.trim()}}return{label:e.trim(),value:e.trim()}});return n.length||(this.skipNextValidation=!0),(0,f.of)(n)}}Uc.Component=({model:e})=>h().createElement(kn,{model:e});class qc extends wt{constructor(e){super({type:"datasource",value:"",text:"",options:[],name:"",regex:"",pluginId:"",...e}),this._variableDependency=new ul(this,{statePaths:["regex"]})}getValueOptions(e){if(!this.state.pluginId)return(0,f.of)([]);const t=(0,s.getDataSourceSrv)().getList({metrics:!0,variables:!1,pluginId:this.state.pluginId});let n;if(this.state.regex){const e=Ml.interpolate(this,this.state.regex,void 0,"regex");n=(0,o.stringToJsRegex)(e)}const r=[];for(let e=0;e<t.length;e++){const a=t[e];Gc(a,n)&&r.push({label:a.name,value:a.uid}),this.state.defaultOptionEnabled&&Qc(a,n)&&r.push({label:(0,Ze.t)("grafana-scenes.variables.data-source-variable.label.default","default"),value:"default"})}return 0===r.length?this.setState({error:"No data sources found"}):this.state.error&&this.setState({error:null}),(0,f.of)(r)}}function Gc(e,t){return!t||t.exec(e.name)}function Qc(e,t){return!!e.isDefault&&(!t||t.exec("default"))}function Kc(e,t){const n=["A","B","C","D","E","F","G","H"],r=[];if(t>5)return[];for(const a of n){const n=`${e}${a}`;r.push({name:n,children:Kc(n,t+1)})}return r}function Yc(e,t,n){if(n>=t.length)return e;if("*"===t[n])return e;const r=t[n];let a=[],i=[r];r.startsWith("{")&&(i=r.replace(/\{|\}/g,"").split(","));for(const r of e)for(const e of i)if(-1!==e.indexOf("*")){const i=e.replace("*","");new RegExp(`^${i}.*`,"gi").test(r.name)&&(a=a.concat(Yc([r],t,n+1)))}else r.name===e&&(a=a.concat(Yc(r.children,t,n+1)));return a}function Xc(e){if(0===e.indexOf("value"))return[{name:e,children:[]}];return Yc(Kc("",0),e.split("."),0)}qc.Component=({model:e})=>h().createElement(kn,{model:e});class Zc extends wt{constructor(e,t=!1){super({type:"custom",name:"Test",value:"Value",text:(0,Ze.t)("grafana-scenes.variables.test-variable.text.text","Text"),query:"Query",options:[],refresh:o.VariableRefresh.onDashboardLoad,updateOptions:!0,...e}),this.completeUpdate=new f.Subject,this.isGettingValues=!0,this.getValueOptionsCount=0,this.isLazy=!1,this._variableDependency=new ul(this,{statePaths:["query"]}),this.isLazy=t}getValueOptions(e){const{delayMs:t}=this.state;this.getValueOptionsCount+=1;const n=Ml.getQueryController(this);return new f.Observable(e=>{const r={type:"variable",origin:this,cancel:()=>e.complete()};if(n&&n.queryStarted(r),this.setState({loading:!0}),this.state.throwError)throw new Error(this.state.throwError);const a=Ml.interpolate(this,this.state.query),i=this.getOptions(a),o=this.completeUpdate.subscribe({next:()=>{const t={issuedQuery:a,loading:!1};this.state.updateOptions&&(t.options=i),this.setState(t),e.next(i),e.complete()}});let s;return t?s=window.setTimeout(()=>this.signalUpdateCompleted(),t):0===t&&this.signalUpdateCompleted(),this.isGettingValues=!0,()=>{o.unsubscribe(),window.clearTimeout(s),this.isGettingValues=!1,this.state.loading&&this.setState({loading:!1}),n&&n.queryCompleted(r)}})}cancel(){const e=te(this,e=>e instanceof zc?e:void 0);null==e||e.cancel(this)}getOptions(e){return this.state.optionsToReturn?this.state.optionsToReturn:Xc(e).map(e=>({label:e.name,value:e.name}))}signalUpdateCompleted(){this.completeUpdate.next(1)}}function Jc({model:e}){const{value:t,key:n,loading:r}=e.useState(),a=(0,d.useCallback)(t=>{e.setValue(t.currentTarget.value)},[e]),i=(0,d.useCallback)(t=>{"Enter"===t.key&&e.setValue(t.currentTarget.value)},[e]);return h().createElement(Bt.AutoSizeInput,{id:n,placeholder:(0,Ze.t)("grafana-scenes.variables.variable-value-input.placeholder-enter-value","Enter value"),minWidth:15,maxWidth:30,value:t,loading:r,onBlur:a,onKeyDown:i})}Zc.Component=({model:e})=>h().createElement(kn,{model:e});class ed extends k{constructor(e){super({type:"textbox",value:"",name:"",...e}),this._urlSync=new ee(this,{keys:()=>this.getKeys()})}getValue(){return this.state.value}setValue(e){e!==this.state.value&&(this.setState({value:e}),this.publishEvent(new qe(this),!0))}getKey(){return`var-${this.state.name}`}getKeys(){return this.state.skipUrlSync?[]:[this.getKey()]}getUrlState(){return this.state.skipUrlSync?{}:{[this.getKey()]:this.state.value}}updateFromUrl(e){const t=e[this.getKey()];"string"==typeof t&&this.setValue(t)}}ed.Component=({model:e})=>h().createElement(Jc,{model:e});class td extends k{constructor(e){super({type:"interval",value:"",intervals:["1m","10m","30m","1h","6h","12h","1d","7d","14d","30d"],name:"",autoStepCount:30,autoMinInterval:"10s",autoEnabled:!1,refresh:Gl.CO.onTimeRangeChanged,...e}),this._onChange=e=>{this.setState({value:e.value}),this.publishEvent(new qe(this),!0)},this._urlSync=new ee(this,{keys:()=>[this.getKey()]})}getKey(){return`var-${this.state.name}`}getUrlState(){return{[this.getKey()]:this.state.value}}updateFromUrl(e){const t={},n=e[this.getKey()];"string"==typeof n&&(n.startsWith("$__auto_interval_")?t.value=ct:t.value=n),this.setState(t)}getOptionsForSelect(){const{value:e,intervals:t,autoEnabled:n}=this.state;let r=t.map(e=>({value:e,label:e}));return n&&(r=[{value:ct,label:"Auto"},...r]),e&&!r.some(t=>t.value===e)&&r.push({value:e,label:e}),r}getValue(){const{value:e,autoStepCount:t,autoMinInterval:n}=this.state;return e===ct?this.getAutoRefreshInteval(t,n):e}getAutoRefreshInteval(e,t){const n=Ml.getTimeRange(this).state.value;return o.rangeUtil.calculateInterval(n,e,t).interval}validateAndUpdate(){const{value:e,intervals:t}=this.state;let n=!1;if(e===ct)n=!0;else if(!e&&t.length>0){const e=t[0];this.setState({value:e}),n=!0}return n&&this.publishEvent(new qe(this),!0),(0,f.of)({})}}td.Component=({model:e})=>{const{key:t,value:n}=e.useState();return h().createElement(Bt.Select,{id:t,placeholder:(0,Ze.t)("grafana-scenes.variables.interval-variable.placeholder-select-value","Select value"),width:"auto",value:n,tabSelectsValue:!1,options:e.getOptionsForSelect(),onChange:e._onChange})};var nd,rd,ad=e=>{throw TypeError(e)},id=(e,t,n)=>t.has(e)||ad("Cannot "+n),od=(e,t,n)=>(id(e,t,"read from private field"),n?n.call(e):t.get(e)),sd=(e,t,n)=>t.has(e)?ad("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ld=(e,t,n,r)=>(id(e,t,"write to private field"),t.set(e,n),n);class ud extends o.BusEventWithPayload{}ud.type="new-scene-object-added";class cd{constructor(e={},t=s.locationService){this._options=e,this._locationService=t,this._paramsCache=new dd(t),this._urlKeyMapper=new Fl({namespace:e.namespace,excludeFromNamespace:e.excludeFromNamespace})}initSync(e){var t;if(this._subs&&($(0,0,null==(t=this._sceneRoot)||t.state.key),this._subs.unsubscribe()),$(0,0,e.state.key),this._sceneRoot=e,this._subs=new f.Subscription,this._subs.add(e.subscribeToEvent(E,e=>{this.handleSceneObjectStateChanged(e.payload.changedObject)})),this._subs.add(e.subscribeToEvent(ud,e=>{this.handleNewObject(e.payload)})),this._urlKeyMapper.clear(),this._lastLocation=this._locationService.getLocation(),this.handleNewObject(this._sceneRoot),this._options.updateUrlOnInit){const t=$l(e,this._urlKeyMapper.getOptions());(function(e,t){for(let n in e)if(!zl(t.getAll(n),e[n]))return!0;return!1})(t,this._paramsCache.getParams())&&this._locationService.partial(t,!0)}}cleanUp(e){this._sceneRoot===e&&($(),this._subs&&(this._subs.unsubscribe(),this._subs=void 0,$(0,0,(this._sceneRoot.state.key,e.state.key))),this._sceneRoot=void 0,this._lastLocation=void 0)}handleNewLocation(e){this._sceneRoot&&this._lastLocation!==e&&($(),this._lastLocation=e,jl(this._sceneRoot,this._paramsCache.getParams(),this._urlKeyMapper))}handleNewObject(e){this._sceneRoot&&jl(e,this._paramsCache.getParams(),this._urlKeyMapper)}handleSceneObjectStateChanged(e){var t,n;if(!e.urlSync)return;const r=e.urlSync.getUrlState(),a=this._locationService.getSearch(),i={};for(const[t,n]of Object.entries(r)){const r=this._urlKeyMapper.getUniqueKey(t,e);zl(a.getAll(r),n)||(i[r]=n)}if(Object.keys(i).length>0){const a=!0!==(null==(n=(t=e.urlSync).shouldCreateHistoryStep)?void 0:n.call(t,r));$(),this._locationService.partial(i,a),this._lastLocation=this._locationService.getLocation()}}getUrlState(e){return $l(e,this._urlKeyMapper.getOptions())}}class dd{constructor(e){this.locationService=e,sd(this,nd),sd(this,rd)}getParams(){const e=this.locationService.getLocation();return od(this,rd)===e||(ld(this,rd,e),ld(this,nd,new URLSearchParams(e.search))),od(this,nd)}}function pd(e,t={}){const n=(0,i.useLocation)(),r=bt(),[a,o]=(0,d.useState)(!1),s=function(e,t){return(0,d.useMemo)(()=>new cd({updateUrlOnInit:e.updateUrlOnInit,createBrowserHistorySteps:e.createBrowserHistorySteps,namespace:e.namespace,excludeFromNamespace:e.excludeFromNamespace},t),[e.updateUrlOnInit,e.createBrowserHistorySteps,e.namespace,e.excludeFromNamespace,t])}(t,r);return(0,d.useEffect)(()=>(s.initSync(e),o(!0),()=>s.cleanUp(e)),[e,s]),(0,d.useEffect)(()=>{const e=r.getLocation(),t=e!==n?e:n;e!==n&&$(),s.handleNewLocation(t)},[e,s,n,r]),a}function hd({children:e,scene:t,updateUrlOnInit:n,createBrowserHistorySteps:r,namespace:a,excludeFromNamespace:i}){return pd(t,{updateUrlOnInit:n,createBrowserHistorySteps:r,namespace:a,excludeFromNamespace:i})?e:null}nd=new WeakMap,rd=new WeakMap;class fd extends k{constructor(e){super(e),this.addActivationHandler(()=>{const e=function(e){const t=window.__grafanaSceneContext;return $(),window.__grafanaSceneContext=e,()=>{window.__grafanaSceneContext===e&&($(),window.__grafanaSceneContext=t)}}(this);return()=>{e()}})}}fd.Component=function({model:e}){const{body:t,controls:n}=e.useState(),r=(0,Bt.useStyles2)(md);return h().createElement("div",{className:r.container},n&&h().createElement("div",{className:r.controls},n.map(e=>h().createElement(e.Component,{key:e.state.key,model:e}))),h().createElement("div",{className:r.body},h().createElement(t.Component,{model:t})))};const md=e=>({container:(0,Xt.css)({flexGrow:1,display:"flex",gap:e.spacing(2),minHeight:"100%",flexDirection:"column"}),body:(0,Xt.css)({flexGrow:1,display:"flex",gap:e.spacing(1)}),controls:(0,Xt.css)({display:"flex",gap:e.spacing(2),alignItems:"flex-end",flexWrap:"wrap"})});class gd extends k{addItem(e){this.setState({items:this.state.items?[...this.state.items,e]:[e]})}setItems(e){this.setState({items:e})}}function vd(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={loading:!1});var r,a,i=(0,d.useRef)(0),o=(r=(0,d.useRef)(!1),a=(0,d.useCallback)(function(){return r.current},[]),(0,d.useEffect)(function(){return r.current=!0,function(){r.current=!1}},[]),a),s=(0,d.useState)(n),l=s[0],u=s[1],c=(0,d.useCallback)(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=++i.current;return l.loading||u(function(e){return Fu(Fu({},e),{loading:!0})}),e.apply(void 0,t).then(function(e){return o()&&r===i.current&&u({value:e,loading:!1}),e},function(e){return o()&&r===i.current&&u({error:e,loading:!1}),e})},t);return[l,c]}async function bd(e,t,n,r){var a,i,o,l;const u=null==(a=e.request)?void 0:a.targets;if(!u)return"";const{from:c,to:d}=n,p=null==(i=e.request)?void 0:i.filters,h={__sceneObject:Nn(t)},f=(await Promise.allSettled(u.map(async e=>{var t;const n=await(0,s.getDataSourceSrv)().get(e.datasource);return(null==(t=n.interpolateVariablesInQueries)?void 0:t.call(n,[e],null!=h?h:{},p)[0])||e}))).filter(e=>"fulfilled"===e.status).map(e=>e.value).map(e=>{var t;return null!=(t=null==r?void 0:r(e))?t:e}),m=null!=f?f:[];let g=new Set(m.map(e=>{var t;return null==(t=e.datasource)?void 0:t.uid})).size>1?"-- Mixed --":null==(l=null==(o=m.find(e=>{var t;return!!(null==(t=e.datasource)?void 0:t.uid)}))?void 0:o.datasource)?void 0:l.uid;if((null==m?void 0:m.length)&&g&&c&&d){return`/explore?left=${encodeURIComponent(JSON.stringify({datasource:g,queries:m,range:{from:c,to:d}}))}`}return""}gd.Component=function({model:e}){const{items:t=[]}=e.useState(),n=h().useRef(null);(0,d.useEffect)(()=>{n.current&&n.current.focus()},[]);const r=e=>e.map(e=>{switch(e.type){case"divider":return h().createElement(Bt.Menu.Divider,{key:e.text});case"group":return h().createElement(Bt.Menu.Group,{key:e.text,label:e.text},e.subMenu?r(e.subMenu):void 0);default:return h().createElement(Bt.Menu.Item,{key:e.text,role:"menuitem",label:e.text,icon:e.iconClassName,childItems:e.subMenu?r(e.subMenu):void 0,url:e.href,onClick:e.onClick,shortcut:e.shortcut,testId:Yt.components.Panels.Panel.menuItems(e.text)})}});return h().createElement(Bt.Menu,{ref:n},r(t))};class yd extends k{constructor(e={}){super({options:e})}}yd.Component=function({model:e}){const{options:t}=e.useState(),{data:n}=Ml.getData(e).useState(),{from:r,to:a}=Ml.getTimeRange(e).useState(),{value:i}=function(e,t){void 0===t&&(t=[]);var n=vd(e,t,{loading:!0}),r=n[0],a=n[1];return(0,d.useEffect)(function(){a()},[a]),r}(async()=>n?bd(n,e,{from:r,to:a},t.transform):"",[n,e,r,a]),o=(0,s.useReturnToPrevious)();if(i)return h().createElement(Bt.LinkButton,{key:"explore",icon:"compass",size:"sm",variant:"secondary",href:i,onClick:()=>{var e;t.returnToPrevious&&o(t.returnToPrevious.title,t.returnToPrevious.href),null==(e=t.onClick)||e.call(t)}},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.viz-panel-explore-button.explore"},"Explore"));return null};class wd extends k{}function Sd(e){return e instanceof Md}wd.Component=function({model:e}){const{body:t}=e.useState(),n=e.parent;if(n&&(r=n,!(r instanceof Ad))&&!Sd(n))throw new Error("SceneGridItem must be a child of SceneGridLayout or SceneGridRow");var r;if(!t)return null;return h().createElement(t.Component,{model:t})};var xd=n(2548),_d=n.n(xd);const Ed=(0,Xt.css)({flex:"1 1 auto",position:"relative",zIndex:1,width:"100%"}),Cd=h().forwardRef((e,t)=>{var n;const{grid:r,layoutItem:a,index:i,totalCount:o,isLazy:s,style:l,onLoad:u,onChange:c,children:d,...p}=e,f=r.getSceneLayoutChild(a.i),m=null==(n=f.getClassName)?void 0:n.call(f),g=h().createElement(f.Component,{model:f,key:f.state.key});return s?h().createElement(iu,{...p,key:f.state.key,"data-griditem-key":f.state.key,className:(0,Xt.cx)(m,e.className),style:l,ref:t},g,d):h().createElement("div",{...p,ref:t,key:f.state.key,"data-griditem-key":f.state.key,className:(0,Xt.cx)(m,e.className),style:l},g,d)});function Rd(e,t,n){e.current?t?e.current.classList.add("react-grid-layout--enable-move-animations"):e.current.classList.remove("react-grid-layout--enable-move-animations"):n||setTimeout(()=>Rd(e,t,!0),50)}Cd.displayName="GridItemWrapper";const Od=h().forwardRef(({handleAxis:e,...t},n)=>{const r=(0,Bt.useStyles2)(Td);return h().createElement("div",{ref:n,...t,className:`${r} scene-resize-handle`},h().createElement("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h().createElement("path",{d:"M21 15L15 21M21 8L8 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})))});function Td(e){return(0,Xt.css)({position:"absolute",bottom:0,right:0,zIndex:999,padding:e.spacing(1.5,0,0,1.5),color:e.colors.border.strong,cursor:"se-resize","&:hover":{color:e.colors.text.link},svg:{display:"block"},".react-resizable-hide &":{display:"none"}})}Od.displayName="ResizeHandle";class Dd extends o.BusEventWithPayload{}Dd.type="scene-grid-layout-drag-start";const kd=class e extends k{constructor(e){super({...e,children:Id(e.children)}),this._skipOnLayoutChange=!1,this._oldLayout=[],this._loadOldLayout=!1,this.onLayoutChange=e=>{if(this._skipOnLayoutChange)this._skipOnLayoutChange=!1;else{this._loadOldLayout&&(e=[...this._oldLayout],this._loadOldLayout=!1);for(const t of e){const e=this.getSceneLayoutChild(t.i),n={x:t.x,y:t.y,width:t.w,height:t.h};Pd(e.state,n)||e.setState({...n})}this.setState({children:Id(this.state.children)})}},this.onResizeStop=(e,t,n)=>{this.getSceneLayoutChild(n.i).setState({width:n.w,height:n.h})},this.onDragStart=e=>{this._oldLayout=[...e]},this.onDragStop=(e,t,n)=>{const r=this.getSceneLayoutChild(n.i),a=(e=Ld(e)).findIndex(e=>e.i===n.i);let i=this.findGridItemSceneParent(e,a-1),o=this.state.children;for(let t=0;t<e.length;t++){const n=e[t],r=this.getSceneLayoutChild(n.i),a=r.state;(null==a?void 0:a.x)===n.x&&(null==a?void 0:a.y)===n.y||r.setState({x:n.x,y:n.y})}i instanceof Md&&yt(i)&&(this._loadOldLayout=!0),r instanceof Md&&i instanceof Md&&(this.isRowDropValid(e,n,a)||(this._loadOldLayout=!0),i=this),i===r.parent||this._loadOldLayout||(o=this.moveChildTo(r,i)),this.setState({children:Id(o)}),this._skipOnLayoutChange=!0}}isDraggable(){var e;return null!=(e=this.state.isDraggable)&&e}getDragClass(){return`grid-drag-handle-${this.state.key}`}getDragClassCancel(){return"grid-drag-cancel"}getDragHooks(){return{onDragStart:(e,t)=>{this.publishEvent(new Dd({evt:e,panel:t}),!0)}}}adjustYPositions(e,t){for(const n of this.state.children)if(n.state.y>e&&n.setState({y:n.state.y+t}),n instanceof Md)for(const r of n.state.children)r.state.y>e&&r.setState({y:r.state.y+t})}toggleRow(e){var t,n;if(!e.state.isCollapsed)return e.setState({isCollapsed:!0}),void this.setState({});const r=e.state.children;if(0===r.length)return e.setState({isCollapsed:!1}),void this.setState({});const a=e.state.y,i=(null!=(t=r[0].state.y)?t:a)-(a+1);let o=a;for(const e of r){const t={...e.state};t.y=null!=(n=t.y)?n:a,t.y-=i,t.y!==e.state.y&&e.setState(t),o=Math.max(o,Number(t.y)+Number(t.height))}const s=o-a-1;for(const t of this.state.children)if(t.state.y>a&&this.pushChildDown(t,s),Sd(t)&&t!==e)for(const e of t.state.children)e.state.y>a&&this.pushChildDown(e,s);e.setState({isCollapsed:!1}),this.setState({})}ignoreLayoutChange(e){this._skipOnLayoutChange=e}getSceneLayoutChild(e){for(const t of this.state.children){if(t.state.key===e)return t;if(t instanceof Md)for(const n of t.state.children)if(n.state.key===e)return n}throw new Error("Scene layout child not found for GridItem")}pushChildDown(e,t){e.setState({y:e.state.y+t})}findGridItemSceneParent(e,t){for(let n=t;n>=0;n--){const t=e[n],r=this.getSceneLayoutChild(t.i);if(r instanceof Md)return r.state.isCollapsed?this:r}return this}isRowDropValid(t,n,r){if(t[t.length-1].i===n.i)return!0;const a=this.getSceneLayoutChild(t[r+1].i);return a instanceof Md||a.parent instanceof e}moveChildTo(t,n){const r=t.parent;let a=this.state.children;const i=t.clone({key:t.state.key});if(r instanceof Md){const e=r.clone();if(e.setState({children:e.state.children.filter(e=>e.state.key!==t.state.key)}),a=a.map(t=>t===r?e:t),n instanceof Md){const e=n.clone();e.setState({children:[...e.state.children,i]}),a=a.map(t=>t===n?e:t)}else a=[...a,i]}else if(!(n instanceof e)){a=a.filter(e=>e.state.key!==t.state.key);const e=n.clone();e.setState({children:[...e.state.children,i]}),a=a.map(t=>t===n?e:t)}return a}toGridCell(e){var t,n;const r=e.state;let a=null!=(t=r.x)?t:0,i=null!=(n=r.y)?n:0;const o=Number.isInteger(Number(r.width))?Number(r.width):4,s=Number.isInteger(Number(r.height))?Number(r.height):4;let l=e.state.isDraggable,u=e.state.isResizable;return e instanceof Md&&(l=!!e.state.isCollapsed,u=!1),yt(e)&&(l=!1,u=!1),{i:e.state.key,x:a,y:i,h:s,w:o,isResizable:u,isDraggable:l}}buildGridLayout(e,t){let n=[];for(const e of this.state.children)if(n.push(this.toGridCell(e)),e instanceof Md&&!e.state.isCollapsed)for(const t of e.state.children)n.push(this.toGridCell(t));return n=Ld(n),this.state.UNSAFE_fitPanels&&(n=function(e,t){const n=t-32,r=Math.max(...e.map(e=>e.h+e.y))/Math.floor(n/38);return e.map(e=>({...e,y:Math.round(e.y/r)||0,h:Math.round(e.h/r)||1}))}(n,t)),e<768?(this._skipOnLayoutChange=!0,n.map(e=>({...e,w:24}))):(this._skipOnLayoutChange=!1,n)}};kd.Component=function({model:e}){const{children:t,isLazy:n,isDraggable:r,isResizable:a}=e.useState(),[i,{width:o,height:s}]=eu(),l=(0,d.useRef)(null);return(0,d.useEffect)(()=>{Rd(l,!!r)},[r]),function(e){if(e.some(e=>void 0===e.state.height||void 0===e.state.width||void 0===e.state.x||void 0===e.state.y))throw new Error("All children must have a size specified")}(t),h().createElement("div",{ref:i,className:Ed},((t,i)=>{if(!t||!i)return null;const o=e.buildGridLayout(t,i);return h().createElement("div",{ref:l,style:{width:`${t}px`,height:"100%"},className:"react-grid-layout"},h().createElement(_d(),{width:t,isDraggable:r&&t>768,isResizable:null!=a&&a,containerPadding:[0,0],useCSSTransforms:!0,margin:[8,8],cols:24,rowHeight:30,draggableHandle:`.grid-drag-handle-${e.state.key}`,draggableCancel:".grid-drag-cancel",layout:o,onDragStart:e.onDragStart,onDragStop:e.onDragStop,onResizeStop:e.onResizeStop,onLayoutChange:e.onLayoutChange,isBounded:!1,resizeHandle:h().createElement(Od,null)},o.map((t,r)=>h().createElement(Cd,{key:t.i,grid:e,layoutItem:t,index:r,isLazy:n,totalCount:o.length}))))})(o,s))};let Ad=kd;function Pd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Id(e){return e.forEach(e=>{e instanceof Md&&e.setState({children:Id(e.state.children)})}),[...e].sort((e,t)=>e.state.y-t.state.y||e.state.x-t.state.x)}function Ld(e){return[...e].sort((e,t)=>e.y-t.y||e.x-t.x)}class Md extends k{constructor(e){super({children:e.children||[],isCollapsible:e.isCollapsible||!0,title:e.title||"",...e,x:0,height:1,width:24}),this._variableDependency=new ul(this,{statePaths:["title"],handleTimeMacros:!0}),this.onCollapseToggle=()=>{this.state.isCollapsible&&this.getGridLayout().toggleRow(this)}}getGridLayout(){const e=this.parent;if(!(e&&e instanceof Ad))throw new Error("SceneGridRow must be a child of SceneGridLayout");return e}getUrlState(){return{rowc:this.state.isCollapsed?"1":"0"}}updateFromUrl(e){null!=e.rowc&&e.rowc!==this.getUrlState().rowc&&this.onCollapseToggle()}getPanelCount(e){var t;let n=0;for(const r of e)n+=(null==(t=r.getChildCount)?void 0:t.call(r))||1;return n}}Md.Component=function({model:e}){const t=(0,Bt.useStyles2)(Vd),{isCollapsible:n,isCollapsed:r,title:a,actions:i,children:o}=e.useState(),s=e.getGridLayout(),l=s.getDragClass(),u=s.isDraggable()&&!yt(e),c=e.getPanelCount(o),d=1===c?"panel":"panels";return h().createElement("div",{className:(0,Xt.cx)(t.row,r&&t.rowCollapsed)},h().createElement("div",{className:t.rowTitleAndActionsGroup},h().createElement("button",{onClick:e.onCollapseToggle,className:t.rowTitleButton,"aria-label":r?(0,Ze.t)("grafana-scenes.components.scene-grid-row.expand-row","Expand row"):(0,Ze.t)("grafana-scenes.components.scene-grid-row.collapse-row","Collapse row"),"data-testid":Yt.components.DashboardRow.title(Ml.interpolate(e,a,void 0,"text"))},n&&h().createElement(Bt.Icon,{name:r?"angle-right":"angle-down"}),h().createElement("span",{className:t.rowTitle,role:"heading"},Ml.interpolate(e,a,void 0,"text"))),h().createElement("span",{className:(0,Xt.cx)(t.panelCount,r&&t.panelCountCollapsed)},"(",c," ",d,")"),i&&h().createElement("div",{className:t.rowActions},h().createElement(i.Component,{model:i}))),u&&r&&h().createElement("div",{className:(0,Xt.cx)(t.dragHandle,l)},h().createElement(Bt.Icon,{name:"draggabledots"})))};const Vd=e=>({row:(0,Xt.css)({width:"100%",height:"30px",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowTitleButton:(0,Xt.css)({display:"flex",alignItems:"center",cursor:"pointer",background:"transparent",border:"none",minWidth:0,gap:e.spacing(1)}),rowCollapsed:(0,Xt.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),rowTitle:(0,Xt.css)({fontSize:e.typography.h5.fontSize,fontWeight:e.typography.fontWeightMedium,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",flexGrow:1,minWidth:0}),collapsedInfo:(0,Xt.css)({fontSize:e.typography.bodySmall.fontSize,color:e.colors.text.secondary,display:"flex",alignItems:"center",flexGrow:1}),rowTitleAndActionsGroup:(0,Xt.css)({display:"flex",minWidth:0,"&:hover, &:focus-within":{"& > div":{opacity:1}}}),rowActions:(0,Xt.css)({display:"flex",whiteSpace:"nowrap",opacity:0,transition:"200ms opacity ease-in 200ms","&:hover, &:focus-within":{opacity:1}}),dragHandle:(0,Xt.css)({display:"flex",padding:e.spacing(0,1),alignItems:"center",justifyContent:"flex-end",cursor:"move",color:e.colors.text.secondary,"&:hover":{color:e.colors.text.primary}}),panelCount:(0,Xt.css)({whiteSpace:"nowrap",paddingLeft:e.spacing(2),color:e.colors.text.secondary,fontStyle:"italic",fontSize:e.typography.size.sm,fontWeight:"normal",display:"none",lineHeight:"30px"}),panelCountCollapsed:(0,Xt.css)({display:"inline-block"})});class Fd extends k{constructor(){super(...arguments),this.onToggle=()=>{this.setState({isCollapsed:!this.state.isCollapsed})},this.onRemove=()=>{const e=this.parent;"body"in e.state&&e.setState({body:void 0})}}}Fd.Component=function({model:e}){const{title:t,isCollapsed:n,canCollapse:r,canRemove:a,body:i,controls:o}=e.useState(),s=(0,Bt.useStyles2)(Vd),l=(0,Bt.useStyles2)(Nd),u=(null!=o?o:[]).map(e=>h().createElement(e.Component,{key:e.state.key,model:e}));a&&u.push(h().createElement(Bt.ToolbarButton,{icon:"times",variant:"default",onClick:e.onRemove,key:"remove-button","aria-label":(0,Ze.t)("grafana-scenes.components.nested-scene-renderer.remove-button-label","Remove scene")}));return h().createElement("div",{className:l.wrapper},h().createElement("div",{className:(0,Xt.cx)(l.row,n&&l.rowCollapsed)},h().createElement("button",{onClick:e.onToggle,className:s.rowTitleButton,"aria-label":n?(0,Ze.t)("grafana-scenes.components.nested-scene-renderer.expand-button-label","Expand scene"):(0,Ze.t)("grafana-scenes.components.nested-scene-renderer.collapse-button-label","Collapse scene")},r&&h().createElement(Bt.Icon,{name:n?"angle-right":"angle-down"}),h().createElement("span",{className:s.rowTitle,role:"heading"},Ml.interpolate(e,t,void 0,"text"))),h().createElement("div",{className:l.actions},u)),!n&&h().createElement(i.Component,{model:i}))};const Nd=e=>({wrapper:(0,Xt.css)({display:"flex",flexDirection:"column",flexGrow:1,gap:e.spacing(1)}),row:(0,Xt.css)({width:"100%",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowCollapsed:(0,Xt.css)({borderBottom:`1px solid ${e.colors.border.weak}`,paddingBottom:e.spacing(1)}),actions:(0,Xt.css)({display:"flex",alignItems:"center",gap:e.spacing(1),justifyContent:"flex-end",flexGrow:1})});class $d extends k{constructor(){super(...arguments),this._variableDependency=new ul(this,{statePaths:["text"]})}}$d.Component=function({model:e}){const{text:t,fontSize:n=20,align:r="left",key:a,spacing:i}=e.useState(),o=(0,Bt.useTheme2)(),s=(0,Xt.css)({fontSize:n,display:"flex",flexGrow:1,alignItems:"center",padding:i?o.spacing(i,0):void 0,justifyContent:r});return h().createElement("div",{className:s,"data-testid":a},Ml.interpolate(e,t))};class jd extends k{}jd.Component=({model:e})=>{const t=e.useState();return h().createElement(Bt.ToolbarButton,{onClick:t.onClick,icon:t.icon})};class Bd extends k{}Bd.Component=({model:e})=>{const t=e.useState();return h().createElement("div",{style:{display:"flex"}},t.label&&h().createElement(Xn,{label:t.label}),h().createElement(Bt.Input,{defaultValue:t.value,width:8,onBlur:t=>{e.state.onChange(parseInt(t.currentTarget.value,10))}}))};const zd=function(e,t,n){if(!Xl)return[t,Yl,Yl];if(!e)throw new Error("useLocalStorage key may not be falsy");var r=n?n.raw?function(e){return e}:n.deserializer:JSON.parse,a=(0,d.useRef)(function(e){try{var a=n?n.raw?String:n.serializer:JSON.stringify,i=localStorage.getItem(e);return null!==i?r(i):(t&&localStorage.setItem(e,a(t)),t)}catch(e){return t}}),i=(0,d.useState)(function(){return a.current(e)}),o=i[0],s=i[1];(0,d.useLayoutEffect)(function(){return s(a.current(e))},[e]);var l=(0,d.useCallback)(function(t){try{var a="function"==typeof t?t(o):t;if(void 0===a)return;var i=void 0;i=n?n.raw?"string"==typeof a?a:JSON.stringify(a):n.serializer?n.serializer(a):JSON.stringify(a):JSON.stringify(a),localStorage.setItem(e,i),s(r(i))}catch(e){}},[e,s]),u=(0,d.useCallback)(function(){try{localStorage.removeItem(e),s(void 0)}catch(e){}},[e,s]);return[o,l,u]};class Wd extends k{constructor(){super(...arguments),this.onZoom=()=>{const e=Ml.getTimeRange(this),t=function(e,t){const n=e.to.valueOf()-e.from.valueOf(),r=e.to.valueOf()-n/2,a=0===n?3e4:n*t,i=r+a/2,s=r-a/2;return{from:(0,o.toUtc)(s),to:(0,o.toUtc)(i),raw:{from:(0,o.toUtc)(s),to:(0,o.toUtc)(i)}}}(e.state.value,2);e.onTimeRangeChange(t)},this.onChangeFiscalYearStartMonth=e=>{Ml.getTimeRange(this).setState({fiscalYearStartMonth:e})},this.toAbsolute=()=>{const e=Ml.getTimeRange(this),t=e.state.value,n=(0,o.toUtc)(t.from),r=(0,o.toUtc)(t.to);e.onTimeRangeChange({from:n,to:r,raw:{from:n,to:r}})},this.onMoveBackward=()=>{const e=Ml.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(Hd(0,t))},this.onMoveForward=()=>{const e=Ml.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(Hd(1,t,Date.now()))}}}function Hd(e,t,n){const r=t.to.valueOf(),a=t.from.valueOf(),i=(r-a)/2;let s,l;0===e?(s=a-i,l=r-i):(s=a+i,l=r+i,void 0!==n&&l>n&&r<n&&(l=n,s=a));const u=(0,o.toUtc)(s),c=(0,o.toUtc)(l);return{from:u,to:c,raw:{from:u,to:c}}}Wd.Component=function({model:e}){const{hidePicker:t,isOnCanvas:n,quickRanges:r,defaultQuickRanges:a}=e.useState(),i=Ml.getTimeRange(e),s=i.getTimeZone(),l=i.useState(),[u,c]=zd(Ud,[],{raw:!1,serializer:Gd,deserializer:qd});if(t)return null;const d=r||a,p=(l.value.to.valueOf()-l.value.from.valueOf())/2,f=(0,o.intervalToAbbreviatedDurationString)({start:new Date(l.value.from.valueOf()),end:new Date(l.value.from.valueOf()+p)}),m=l.value.to.valueOf()+p<=Date.now()?f:void 0;return h().createElement(Bt.TimeRangePicker,{isOnCanvas:null==n||n,value:l.value,onChange:e=>{var t;t=e,((0,o.isDateTime)(t.raw.from)||(0,o.isDateTime)(t.raw.to))&&c([e,...null!=u?u:[]]),i.onTimeRangeChange(e)},timeZone:s,fiscalYearStartMonth:l.fiscalYearStartMonth,onMoveBackward:e.onMoveBackward,onMoveForward:e.onMoveForward,moveForwardTooltip:m?(0,Ze.t)("grafana-scenes.components.time-picker.move-forward-tooltip","Move {{moveForwardDuration}} forward",{moveForwardDuration:m}):void 0,moveBackwardTooltip:(0,Ze.t)("grafana-scenes.components.time-picker.move-backward-tooltip","Move {{moveBackwardDuration}} backward",{moveBackwardDuration:f}),onZoom:e.onZoom,onChangeTimeZone:i.onTimeZoneChange,onChangeFiscalYearStartMonth:e.onChangeFiscalYearStartMonth,weekStart:l.weekStart,history:u,quickRanges:d})};const Ud="grafana.dashboard.timepicker.history";function qd(e){return JSON.parse(e).map(e=>o.rangeUtil.convertRawToRange(e,"utc",void 0,"YYYY-MM-DD HH:mm:ss"))}function Gd(e){return JSON.stringify((t=e.map(e=>({from:"string"==typeof e.raw.from?e.raw.from:e.raw.from.toISOString(),to:"string"==typeof e.raw.to?e.raw.to:e.raw.to.toISOString()})),(0,I.uniqBy)(t,e=>e.from+e.to).slice(0,4)));var t}const Qd=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"];class Kd extends k{constructor(e){var t,n,r;super({refresh:"",...e,autoValue:void 0,autoEnabled:null==(t=e.autoEnabled)||t,autoMinInterval:null!=(n=e.autoMinInterval)?n:s.config.minRefreshInterval,intervals:(null!=(r=e.intervals)?r:Qd).filter(t=>{var n;const r=null!=(n=e.minRefreshInterval)?n:s.config.minRefreshInterval;try{return!r||o.rangeUtil.intervalToMs(t)>=o.rangeUtil.intervalToMs(r)}catch(e){return!1}})}),this._urlSync=new ee(this,{keys:["refresh"]}),this._autoRefreshBlocked=!1,this.onRefresh=()=>{const e=Ml.getQueryController(this);if(null==e?void 0:e.state.isRunning)return e.cancelAll(),void e.cancelProfile();null==e||e.startProfile(Me);const t=Ml.getTimeRange(this);this._intervalTimer&&clearInterval(this._intervalTimer),t.onRefresh(),this.setupIntervalTimer()},this.onIntervalChanged=e=>{this.setState({refresh:e}),this.setupIntervalTimer()},this.setupAutoTimeRangeListener=()=>Ml.getTimeRange(this).subscribeToState((e,t)=>{e.from===t.from&&e.to===t.to||this.setupIntervalTimer()}),this.calculateAutoRefreshInterval=()=>{var e;const t=Ml.getTimeRange(this),n=null!=(e=null==window?void 0:window.innerWidth)?e:2e3;return o.rangeUtil.calculateInterval(t.state.value,n,this.state.autoMinInterval)},this.setupIntervalTimer=()=>{var e;const t=Ml.getTimeRange(this),{refresh:n,intervals:r}=this.state;if((this._intervalTimer||""===n)&&clearInterval(this._intervalTimer),""===n)return;if(n!==Bt.RefreshPicker.autoOption.value&&r&&!r.includes(n))return;let a;if(null==(e=this._autoTimeRangeListener)||e.unsubscribe(),n===Bt.RefreshPicker.autoOption.value){const e=this.calculateAutoRefreshInterval();a=e.intervalMs,this._autoTimeRangeListener=this.setupAutoTimeRangeListener(),e.interval!==this.state.autoValue&&this.setState({autoValue:e.interval})}else a=o.rangeUtil.intervalToMs(n);this._intervalTimer=setInterval(()=>{if(this.isTabVisible()){const e=Ml.getQueryController(this);(null==e?void 0:e.state.isRunning)&&e.cancelProfile(),null==e||e.startProfile(Me),t.onRefresh()}else this._autoRefreshBlocked=!0},a)},this.addActivationHandler(()=>{this.setupIntervalTimer();const e=()=>{this._autoRefreshBlocked&&"visible"===document.visibilityState&&(this._autoRefreshBlocked=!1,this.onRefresh())};return document.addEventListener("visibilitychange",e),()=>{var t;this._intervalTimer&&clearInterval(this._intervalTimer),document.removeEventListener("visibilitychange",e),null==(t=this._autoTimeRangeListener)||t.unsubscribe()}})}getUrlState(){let e=this.state.refresh;return"string"==typeof e&&0!==e.length||(e=void 0),{refresh:e}}updateFromUrl(e){const{intervals:t}=this.state;let n=e.refresh;"string"==typeof n&&function(e){try{return o.rangeUtil.describeInterval(e).count>0}catch(e){return!1}}(n)&&((null==t?void 0:t.includes(n))?this.setState({refresh:n}):this.setState({refresh:t?t[0]:void 0}))}isTabVisible(){return void 0===document.visibilityState||"visible"===document.visibilityState}}Kd.Component=function({model:e}){var t;const{refresh:n,intervals:r,autoEnabled:a,autoValue:i,isOnCanvas:o,primary:s,withText:l}=e.useState(),u=function(e){const t=Ml.getQueryController(e);if(!t)return!1;return t.useState().isRunning}(e);let c,d,p=n===(null==(t=Bt.RefreshPicker.autoOption)?void 0:t.value)?i:l?"Refresh":void 0;u&&(c="Cancel all queries",l&&(p="Cancel"));l&&(d="96px");return h().createElement(Bt.RefreshPicker,{showAutoInterval:a,value:n,intervals:r,tooltip:c,width:d,text:p,onRefresh:()=>{e.onRefresh()},primary:s,onIntervalChanged:e.onIntervalChanged,isLoading:u,isOnCanvas:null==o||o})};const Yd=e=>`${e}-compare`,Xd="__previousPeriod",Zd="__noPeriod",Jd={label:"Previous period",value:Xd},ep={label:"None",value:Zd},tp=[{label:"Day before",value:"24h"},{label:"Week before",value:"1w"},{label:"Month before",value:"1M"}];class np extends k{constructor(e){super({compareOptions:tp,...e}),this._urlSync=new ee(this,{keys:["compareWith"]}),this._onActivate=()=>{const e=Ml.getTimeRange(this);this.setState({compareOptions:this.getCompareOptions(e.state.value)}),this._subs.add(e.subscribeToState(e=>{const t=this.getCompareOptions(e.value),n={compareOptions:t};Boolean(this.state.compareWith)&&!t.find(({value:e})=>e===this.state.compareWith)&&(n.compareWith=Xd),this.setState(n)}))},this.getCompareOptions=e=>{const t=Math.ceil(e.to.diff(e.from)),n=tp.findIndex(({value:e})=>o.rangeUtil.intervalToMs(e)>=t);return[ep,Jd,...tp.slice(n).map(({label:e,value:t})=>({label:e,value:t}))]},this.onCompareWithChanged=e=>{e===Zd?this.onClearCompare():this.setState({compareWith:e})},this.onClearCompare=()=>{this.setState({compareWith:void 0})},this.addActivationHandler(this._onActivate)}getExtraQueries(e){const t=[],n=this.getCompareTimeRange(e.range);if(!n)return t;const r=e.targets.filter(e=>!1!==e.timeRangeCompare);return r.length&&t.push({req:{...e,targets:r,range:n},processor:rp}),t}shouldRerun(e,t,n){return e.compareWith!==t.compareWith&&void 0!==n.find(e=>!1!==e.timeRangeCompare)}getCompareTimeRange(e){let t,n;if(this.state.compareWith){if(this.state.compareWith===Xd){const r=e.to.diff(e.from);t=(0,o.dateTime)(e.from).subtract(r),n=(0,o.dateTime)(e.to).subtract(r)}else t=(0,o.dateTime)(e.from).subtract(o.rangeUtil.intervalToMs(this.state.compareWith)),n=(0,o.dateTime)(e.to).subtract(o.rangeUtil.intervalToMs(this.state.compareWith));return{from:t,to:n,raw:{from:t,to:n}}}}getUrlState(){return{compareWith:this.state.compareWith}}updateFromUrl(e){if(!e.compareWith)return;const t=re(e.compareWith);if(t){this.getCompareOptions(Ml.getTimeRange(this).state.value).find(({value:e})=>e===t)?this.setState({compareWith:t}):this.setState({compareWith:"__previousPeriod"})}}}np.Component=function({model:e}){var t;const n=(0,Bt.useStyles2)(ap),{compareWith:r,compareOptions:a,hideCheckbox:i}=e.useState(),[o,s]=h().useState(r),l=null!=(t=a.find(({value:e})=>e===o))?t:Jd,u=a.find(({value:e})=>e===r),c=Boolean(u),d=()=>{c?(s(r),e.onClearCompare()):c||e.onCompareWithChanged(l.value)},p=i&&!r?ep:u,f=i||c,m=i&&p?{...p,label:`Comparison: ${p.label}`}:p;return h().createElement(Bt.ButtonGroup,null,!i&&h().createElement(Bt.ToolbarButton,{variant:"canvas",tooltip:(0,Ze.t)("grafana-scenes.components.scene-time-range-compare-renderer.button-tooltip","Enable time frame comparison"),onClick:e=>{e.stopPropagation(),e.preventDefault(),d()}},h().createElement(Bt.Checkbox,{label:" ",value:c,onClick:d}),h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.scene-time-range-compare-renderer.button-label"},"Comparison")),f?h().createElement(Bt.ButtonSelect,{variant:"canvas",value:m,options:a,onChange:t=>{e.onCompareWithChanged(t.value)}}):h().createElement(Bt.ToolbarButton,{className:n.previewButton,disabled:!0,variant:"canvas",isOpen:!1},l.label))};const rp=(e,t)=>{const n=t.timeRange.from.diff(e.timeRange.from);return t.series.forEach(e=>{e.refId=Yd(e.refId||""),e.meta={...e.meta,timeCompare:{diffMs:n,isTimeShiftQuery:!0}}}),(0,f.of)(t)};function ap(e){return{previewButton:(0,Xt.css)({"&:disabled":{border:`1px solid ${e.colors.secondary.border}`,color:e.colors.text.disabled,opacity:1}})}}class ip extends k{constructor(e){super(e),this.addActivationHandler(()=>{const e=Ml.getData(this);this._subs.add(e.subscribeToState(e=>{var t;(null==(t=e.data)?void 0:t.state)===o.LoadingState.Done&&this.performRepeat(e.data)})),e.state.data&&this.performRepeat(e.state.data)})}performRepeat(e){const t=[];for(let n=0;n<e.series.length;n++){const r=this.state.getLayoutChild(e,e.series[n],n);t.push(r)}this.state.body.setState({children:t})}}ip.Component=({model:e})=>{const{body:t}=e.useState();return h().createElement(t.Component,{model:t})};class op extends k{constructor(e){super(e),this._variableDependency=new ul(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler(()=>this.performRepeat())}performRepeat(){if(this._variableDependency.hasDependencyInLoadingState())return;const e=Ml.lookupVariable(this.state.variableName,this);if(!(e instanceof wt))return void console.error("SceneByVariableRepeater: variable is not a MultiValueVariable");const t=function(e){const{value:t,text:n,options:r}=e.state;if(e.hasAllValue())return r;if(Array.isArray(t)&&Array.isArray(n))return t.map((e,t)=>({value:e,label:n[t]}));return[{value:t,label:n}]}(e),n=[];for(const e of t){const t=this.state.getLayoutChild(e);n.push(t)}this.state.body.setState({children:n})}}op.Component=({model:e})=>{const{body:t}=e.useState();return h().createElement(t.Component,{model:t})};class sp extends k{constructor(){super({}),this._renderBeforeActivation=!0}}sp.Component=e=>h().createElement("div",{style:{flexGrow:1}});class lp extends k{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}lp.Component=function({model:e,parentState:t}){const{children:n,isHidden:r}=e.useState(),a=function(e,t){return(0,d.useMemo)(()=>{var n,r,a,i,o,l,u,c,d,p;const{direction:h="row",wrap:f}=e,m=s.config.theme2,g={};return t?cp(g,e,t):(g.display="flex",g.flexGrow=1,g.minWidth=e.minWidth,g.minHeight=e.minHeight),g.flexDirection=h,g.gap="8px",g.flexWrap=f||"nowrap",g.alignContent="baseline",g.minWidth=g.minWidth||0,g.minHeight=g.minHeight||0,g[m.breakpoints.down("md")]={flexDirection:null!=(r=null==(n=e.md)?void 0:n.direction)?r:"column",maxWidth:null!=(i=null==(a=e.md)?void 0:a.maxWidth)?i:"unset",maxHeight:null!=(l=null==(o=e.md)?void 0:o.maxHeight)?l:"unset",height:null!=(c=null==(u=e.md)?void 0:u.height)?c:"unset",width:null!=(p=null==(d=e.md)?void 0:d.width)?p:"unset"},(0,Xt.css)(g)},[t,e])}(e.state,t);if(r)return null;return h().createElement("div",{className:a},n.map(t=>{const n=t.Component;return h().createElement(n,{key:t.state.key,model:t,parentState:e.state})}))};class up extends k{}function cp(e,t,n){var r,a,i;const o=null!=(r=n.direction)?r:"row",{xSizing:s="fill",ySizing:l="fill"}=t;return e.display="flex",e.position="relative",e.flexDirection=o,"column"===o?(t.height?e.height=t.height:e.flexGrow="fill"===l?1:0,t.width?e.width=t.width:e.alignSelf="fill"===s?"stretch":"flex-start"):(t.height?e.height=t.height:e.alignSelf="fill"===l?"stretch":"flex-start",t.width?e.width=t.width:e.flexGrow="fill"===s?1:0,t.wrap&&(e.flexWrap=t.wrap,"nowrap"!==t.wrap&&("row"===o?e.rowGap="8px":e.columnGap="8px"))),e.minWidth=t.minWidth,e.maxWidth=t.maxWidth,e.maxHeight=t.maxHeight,e.minHeight=null!=(a=t.minHeight)?a:n.minHeight,e.height=null!=(i=t.height)?i:n.height,e}up.Component=function({model:e,parentState:t}){if(!t)throw new Error("SceneFlexItem must be a child of SceneFlexLayout");const{body:n,isHidden:r}=e.useState(),a=function(e,t){return(0,d.useMemo)(()=>{var n,r,a,i,o,l,u,c,d,p;const h=s.config.theme2,f=cp({},e,t);return f[h.breakpoints.down("md")]={maxWidth:null!=(r=null==(n=e.md)?void 0:n.maxWidth)?r:"unset",maxHeight:null!=(i=null==(a=e.md)?void 0:a.maxHeight)?i:"unset",height:null!=(u=null==(o=e.md)?void 0:o.height)?u:null==(l=t.md)?void 0:l.height,width:null!=(p=null==(c=e.md)?void 0:c.width)?p:null==(d=t.md)?void 0:d.width},(0,Xt.css)(f)},[e,t])}(e.state,t);if(!n||r)return null;return h().createElement("div",{className:a},h().createElement(n.Component,{model:n}))};class dp extends k{constructor(e){var t,n;super({rowGap:1,columnGap:1,templateColumns:"repeat(auto-fit, minmax(400px, 1fr))",autoRows:null!=(t=e.autoRows)?t:"320px",children:null!=(n=e.children)?n:[],...e})}isDraggable(){return!1}}dp.Component=function({model:e}){const{children:t,isHidden:n,isLazy:r}=e.useState(),a=(i=e.state,(0,d.useMemo)(()=>{var e,t,n,r,a,o,l,u,c,d,p;const h={},f=s.config.theme2;return h.display="grid",h.gridTemplateColumns=i.templateColumns,h.gridTemplateRows=i.templateRows||"unset",h.gridAutoRows=i.autoRows||"unset",h.rowGap=f.spacing(null!=(e=i.rowGap)?e:1),h.columnGap=f.spacing(null!=(t=i.columnGap)?t:1),h.justifyItems=i.justifyItems||"unset",h.alignItems=i.alignItems||"unset",h.justifyContent=i.justifyContent||"unset",h.flexGrow=1,i.md&&(h[f.breakpoints.down("md")]={gridTemplateRows:null==(n=i.md)?void 0:n.templateRows,gridTemplateColumns:null==(r=i.md)?void 0:r.templateColumns,rowGap:i.md.rowGap?f.spacing(null!=(o=null==(a=i.md)?void 0:a.rowGap)?o:1):void 0,columnGap:i.md.columnGap?f.spacing(null!=(u=null==(l=i.md)?void 0:l.rowGap)?u:1):void 0,justifyItems:null==(c=i.md)?void 0:c.justifyItems,alignItems:null==(d=i.md)?void 0:d.alignItems,justifyContent:null==(p=i.md)?void 0:p.justifyContent}),(0,Xt.css)(h)},[i]));var i;if(n)return null;return h().createElement("div",{className:a},t.map(t=>{const n=t.Component;return r?h().createElement(iu,{key:t.state.key,className:a},h().createElement(n,{key:t.state.key,model:t,parentState:e.state})):h().createElement(n,{key:t.state.key,model:t,parentState:e.state})}))};class pp extends k{}pp.Component=function({model:e,parentState:t}){if(!t)throw new Error("SceneCSSGridItem must be a child of SceneCSSGridLayout");const{body:n,isHidden:r}=e.useState(),a=(i=e.state,(0,d.useMemo)(()=>{const e={};return e.gridColumn=i.gridColumn||"unset",e.gridRow=i.gridRow||"unset",e.position="relative",(0,Xt.css)(e)},[i]));var i;if(!n||r)return null;return h().createElement("div",{className:a},h().createElement(n.Component,{model:n}))};const hp=new Set(["ArrowUp","ArrowDown"]),fp=new Set(["ArrowLeft","ArrowRight"]),mp={row:{dim:"width",axis:"clientX",min:"minWidth",max:"maxWidth"},column:{dim:"height",axis:"clientY",min:"minHeight",max:"maxHeight"}};function gp({direction:e="row",handleSize:t=32,initialSize:n="auto",primaryPaneStyles:r,secondaryPaneStyles:a,onDragFinished:i,children:o}){const s=h().Children.toArray(o),l=(0,d.useRef)(null),u=(0,d.useRef)(null),c=(0,d.useRef)(null),p=(0,d.useRef)(null),f=(0,d.useRef)(null),m=(0,d.useRef)("1fr"),g=(0,d.useRef)(void 0),v=(0,d.useRef)(void 0),b=mp[e].dim,y=mp[e].axis,w=mp[e].min,S=mp[e].max;!function(e,t,n=0,r){const a=(0,I.throttle)(t,n);(0,d.useLayoutEffect)(()=>{if(!e)return;const t=new ResizeObserver(a);return t.observe(e,{box:"device-pixel-content-box"}),()=>t.disconnect()},r)}(p.current,e=>{for(const t of e){if(!t.target.isSameNode(p.current))return;const e=u.current.getBoundingClientRect()[b],n=bp(u.current);l.current.ariaValueNow=`${(0,I.clamp)((e-n[w])/(n[S]-n[w])*100,0,100)}`}},500,[S,w,e,b]);const x=(0,d.useRef)(null),_=(0,d.useCallback)(e=>{m.current=u.current.getBoundingClientRect()[b],f.current=p.current.getBoundingClientRect()[b],x.current=e[y],l.current.setPointerCapture(e.pointerId),g.current=bp(u.current),v.current=void 0},[b,y]),E=(0,d.useCallback)(e=>{if(null!==x.current&&"1fr"!==m.current){const n=e[y]-x.current,r=g.current,a=(0,I.clamp)(m.current+n,r[w],r[S]),i=a/(f.current-t);u.current.style.flexGrow=`${i}`,c.current.style.flexGrow=""+(1-i);const o=(0,I.clamp)((a-r[w])/(r[S]-r[w])*100,0,100);l.current.ariaValueNow=`${o}`}},[t,y,w,S]),C=(0,d.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),l.current.releasePointerCapture(e.pointerId),x.current=null,null==i||i(parseFloat(u.current.style.flexGrow))},[i]),R=(0,d.useRef)(new Set),O=(0,d.useRef)(null),T=(0,d.useCallback)(n=>{var r;if(0===R.current.size)return void(O.current=null);if("1fr"===m.current)return;const a=.3*(n-(null!=(r=O.current)?r:n));let i=0;"row"===e?(R.current.has("ArrowLeft")&&(i-=a),R.current.has("ArrowRight")&&(i+=a)):(R.current.has("ArrowUp")&&(i-=a),R.current.has("ArrowDown")&&(i+=a));const o=g.current,s=u.current.getBoundingClientRect()[b],d=(0,I.clamp)(s+i,o[w],o[S]),p=d/(f.current-t);u.current.style.flexGrow=`${p}`,c.current.style.flexGrow=""+(1-p);const h=(d-o[w])/(o[S]-o[w])*100;l.current.ariaValueNow=`${(0,I.clamp)(h,0,100)}`,O.current=n,window.requestAnimationFrame(T)},[e,t,w,S,b]),D=(0,d.useCallback)(n=>{if("Enter"===n.key)return void(void 0===v.current?(v.current=u.current.style.flexGrow,u.current.style.flexGrow="0",c.current.style.flexGrow="1"):(u.current.style.flexGrow=v.current,c.current.style.flexGrow=""+(1-parseFloat(v.current)),v.current=void 0));if("Home"===n.key){g.current=bp(u.current),f.current=p.current.getBoundingClientRect()[b];const e=g.current[w]/(f.current-t);return u.current.style.flexGrow=`${e}`,c.current.style.flexGrow=""+(1-e),void(l.current.ariaValueNow="0")}if("End"===n.key){g.current=bp(u.current),f.current=p.current.getBoundingClientRect()[b];const e=g.current[S]/(f.current-t);return u.current.style.flexGrow=`${e}`,c.current.style.flexGrow=""+(1-e),void(l.current.ariaValueNow="100")}if(!("column"===e&&hp.has(n.key)||"row"===e&&fp.has(n.key))||R.current.has(n.key))return;v.current=void 0,n.preventDefault(),n.stopPropagation(),m.current=u.current.getBoundingClientRect()[b],f.current=p.current.getBoundingClientRect()[b],g.current=bp(u.current);if(!R.current.has(n.key)){const e=0===R.current.size;R.current.add(n.key),e&&window.requestAnimationFrame(T)}},[e,T,t,S,b,w]),k=(0,d.useCallback)(t=>{"row"===e&&!fp.has(t.key)||"column"===e&&!hp.has(t.key)||(R.current.delete(t.key),null==i||i(parseFloat(u.current.style.flexGrow)))},[e,i]),A=(0,d.useCallback)(()=>{u.current.style.flexGrow="0.5",c.current.style.flexGrow="0.5";const e=bp(u.current);g.current=e,m.current=u.current.getBoundingClientRect()[b],l.current.ariaValueNow=""+(m.current-e[w])/(e[S]-e[w])*100},[S,b,w]),P=(0,d.useCallback)(()=>{R.current.size>0&&(R.current.clear(),x.current=null,null==i||i(parseFloat(u.current.style.flexGrow)))},[i]),L=(0,Bt.useStyles2)(vp),M=au(),V=2===s.length?"visible":"hidden";return h().createElement("div",{ref:p,className:L.container,style:{flexDirection:e}},h().createElement("div",{ref:u,className:L.panel,style:{flexGrow:"auto"===n?.5:(0,I.clamp)(n,0,1),[w]:"min-content",...r},id:`start-panel-${M}`},s[0]),s[1]&&h().createElement(h().Fragment,null,h().createElement("div",{ref:l,style:{[b]:`${t}px`},className:(0,Xt.cx)(L.handle,{[L.handleHorizontal]:"column"===e}),onPointerUp:C,onPointerDown:_,onPointerMove:E,onKeyDown:D,onKeyUp:k,onDoubleClick:A,onBlur:P,role:"separator","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":50,"aria-controls":`start-panel-${M}`,"aria-label":(0,Ze.t)("grafana-scenes.components.splitter.aria-label-pane-resize-widget","Pane resize widget"),tabIndex:0}),h().createElement("div",{ref:c,className:L.panel,style:{flexGrow:"auto"===n?.5:(0,I.clamp)(1-n,0,1),[w]:"min-content",visibility:`${V}`,...a},id:`end-panel-${M}`},s[1])))}function vp(e){return{handle:(0,Xt.css)({cursor:"col-resize",position:"relative",flexShrink:0,userSelect:"none","&::before":{content:'""',position:"absolute",backgroundColor:e.colors.primary.main,left:"50%",transform:"translate(-50%)",top:0,height:"100%",width:"1px",opacity:0,transition:"opacity ease-in-out 0.2s"},"&::after":{content:'""',width:"4px",borderRadius:"4px",backgroundColor:e.colors.border.weak,transition:"background-color ease-in-out 0.2s",height:"50%",top:"calc(50% - (50%) / 2)",transform:"translateX(-50%)",position:"absolute",left:"50%"},"&:hover, &:focus-visible":{outline:"none","&::before":{opacity:1},"&::after":{backgroundColor:e.colors.primary.main}}}),handleHorizontal:(0,Xt.css)({cursor:"row-resize","&::before":{left:"inherit",transform:"translateY(-50%)",top:"50%",height:"1px",width:"100%"},"&::after":{width:"50%",height:"4px",top:"50%",transform:"translateY(-50%)",left:"calc(50% - (50%) / 2)"}}),container:(0,Xt.css)({display:"flex",width:"100%",flexGrow:1,overflow:"hidden"}),panel:(0,Xt.css)({display:"flex",position:"relative",flexBasis:0})}}function bp(e){if(null===e)return;const t=document.body.style.overflow,n=e.style.width,r=e.style.height,a=e.style.flexGrow;document.body.style.overflow="hidden",e.style.flexGrow="0";const{width:i,height:o}=e.getBoundingClientRect();e.style.flexGrow="100";const{width:s,height:l}=e.getBoundingClientRect();return document.body.style.overflow=t,e.style.width=n,e.style.height=r,e.style.flexGrow=a,{minWidth:i,maxWidth:s,minHeight:o,maxHeight:l}}class yp extends k{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}yp.Component=function({model:e}){const{primary:t,secondary:n,direction:r,isHidden:a,initialSize:i,primaryPaneStyles:o,secondaryPaneStyles:s}=e.useState();if(a)return null;const l=t.Component,u=null==n?void 0:n.Component;let c=n?i:1;return h().createElement(gp,{direction:r,initialSize:null!=c?c:.5,primaryPaneStyles:o,secondaryPaneStyles:s},h().createElement(l,{key:t.state.key,model:t,parentState:e.state}),u&&n&&h().createElement(u,{key:n.state.key,model:n,parentState:e.state}))};class wp extends k{constructor(){super(...arguments),this._renderBeforeActivation=!0}enrichDataRequest(){return{app:this.state.name||"app"}}}wp.Component=({model:e})=>{const{pages:t}=e.useState();return h().createElement(h().Fragment,null,h().createElement(Sp.Provider,{value:e},h().createElement(i.Routes,null,t.map(e=>h().createElement(i.Route,{key:e.state.url,path:e.state.routePath,element:h().createElement(e.Component,{model:e})})))))};const Sp=(0,d.createContext)(null),xp=new Map;function _p(e){const t=xp.get(e);if(t)return t;const n=e();return xp.set(e,n),n}class Ep extends k{}function Cp({node:e}){const t=e.useState(),n=(0,Bt.useStyles2)(Rp);return h().createElement("div",{className:n.container},Object.keys(t).map(r=>h().createElement("div",{className:n.row,key:r},h().createElement("div",{className:n.keyName},r),h().createElement("div",{className:n.value},function(e,t,n){if(null===t)return"null";switch(typeof t){case"number":return h().createElement(Bt.Input,{type:"number",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.valueAsNumber})});case"string":return h().createElement(Bt.Input,{type:"text",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.value})});case"object":return Tt(t)?t.constructor.name:(0,I.isPlainObject)(t)||(0,I.isArray)(t)?h().createElement(Bt.JSONFormatter,{json:t,open:0}):String(t);default:return typeof t}}(r,t[r],e)))))}function Rp(e){return{container:(0,Xt.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),row:(0,Xt.css)({display:"flex",gap:e.spacing(2)}),keyName:(0,Xt.css)({display:"flex",flexGrow:"0",width:120,alignItems:"center",height:e.spacing(e.components.height.md)}),value:(0,Xt.css)({flexGrow:1,minHeight:e.spacing(e.components.height.md),display:"flex",alignItems:"center"})}}function Op({node:e,selectedObject:t,onSelect:n}){const r=(0,Bt.useStyles2)(Tp),a=[],i=e===t;return e.forEachChild(e=>{a.push(h().createElement(Op,{node:e,key:e.state.key,selectedObject:t,onSelect:n}))}),h().createElement("div",{className:r.container},h().createElement("div",{className:(0,Xt.cx)(r.name,i&&r.selected),onClick:()=>n(e)},e.constructor.name),h().createElement("div",{className:r.children},a))}function Tp(e){return{container:(0,Xt.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),name:(0,Xt.css)({flexGrow:1,display:"flex",gap:e.spacing(1),fontSize:e.typography.bodySmall.fontSize,cursor:"pointer",padding:e.spacing(0,1),borderRadius:e.shape.borderRadius(2),position:"relative","&:hover":{background:e.colors.background.secondary}}),selected:(0,Xt.css)({"&::before":{display:"block",content:"' '",position:"absolute",left:0,width:4,bottom:2,top:2,borderRadius:e.shape.radius.default,backgroundImage:e.colors.gradients.brandVertical}}),children:(0,Xt.css)({flexGrow:1,display:"flex",flexDirection:"column",paddingLeft:e.spacing(1)})}}function Dp({scene:e}){const t=(0,Bt.useStyles2)(kp),[n,r]=(0,d.useState)(!1),[a,i]=(0,d.useState)();return h().createElement(h().Fragment,null,h().createElement(Bt.ToolbarButton,{variant:"canvas",icon:"bug",onClick:()=>r(!0)}),n&&h().createElement(Bt.Drawer,{title:(0,Ze.t)("grafana-scenes.components.scene-debugger.title-scene-debugger","Scene debugger"),onClose:()=>r(!1),size:"lg"},h().createElement("div",{className:t.panes},h().createElement("div",{className:t.pane1},h().createElement("div",{className:t.paneHeading},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.scene-debugger.scene-graph"},"Scene graph")),h().createElement(Bt.CustomScrollbar,{autoHeightMin:"100%"},h().createElement("div",{className:t.treeWrapper},h().createElement(Op,{node:e,selectedObject:a,onSelect:i})))),h().createElement("div",{className:t.pane2},h().createElement("div",{className:t.paneHeading},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.scene-debugger.object-details"},"Object details")),a&&h().createElement(Cp,{node:a})))))}function kp(e){return{panes:(0,Xt.css)({flexGrow:1,display:"flex",height:"100%",flexDirection:"row",marginTop:e.spacing(-2)}),pane1:(0,Xt.css)({flexGrow:0,display:"flex",height:"100%",flexDirection:"column",borderRight:`1px solid ${e.colors.border.weak}`}),pane2:(0,Xt.css)({flexGrow:1,display:"flex",minHeight:"100%",flexDirection:"column",paddingLeft:e.spacing(2)}),treeWrapper:(0,Xt.css)({paddingRight:e.spacing(2),height:"100%",marginLeft:e.spacing(-1)}),paneHeading:(0,Xt.css)({padding:e.spacing(1,0),fontWeight:e.typography.fontWeightMedium})}}function Ap({page:e}){const t=u(e.state.url),n=function(e){if(e.parent instanceof Lp)return e.parent;return e}(e),r=n.useState(),a=function(){const e=(0,i.useLocation)();return(0,s.locationSearchToObject)(e.search||"")}(),o=e.getScene(t),c=(0,d.useContext)(Sp),p=r.initializedScene===o,{layout:f}=e.state,m=bt();(0,d.useLayoutEffect)(()=>{p||n.initializeScene(o)},[o,n,p]),(0,d.useEffect)(()=>()=>n.setState({initializedScene:void 0}),[n]);const g=pd(n,null==c?void 0:c.state.urlSyncOptions);if(!p&&!g)return null;const v={text:r.title,img:r.titleImg,icon:r.titleIcon,url:l(r.url,m.getSearchObject(),r.preserveUrlKeys),hideFromBreadcrumbs:r.hideFromBreadcrumbs,parentItem:Pp(r.getParentPage?r.getParentPage():n.parent,a,m.getSearchObject())};r.tabs&&(v.children=r.tabs.map(t=>({text:t.state.title,icon:t.state.titleIcon,tabSuffix:t.state.tabSuffix,active:e===t,url:l(t.state.url,m.getSearchObject(),t.state.preserveUrlKeys),parentItem:v})));let b=[];return r.controls&&(b=r.controls.map(e=>h().createElement(e.Component,{model:e,key:e.state.key}))),a["scene-debugger"]&&b.push(h().createElement(Dp,{scene:n,key:"scene-debugger"})),h().createElement(s.PluginPage,{layout:f,pageNav:v,actions:b,renderTitle:r.renderTitle,subTitle:r.subTitle},h().createElement(o.Component,{model:o}))}function Pp(e,t,n){if(e instanceof Lp)return{text:e.state.title,url:l(e.state.url,n,e.state.preserveUrlKeys),hideFromBreadcrumbs:e.state.hideFromBreadcrumbs,parentItem:Pp(e.state.getParentPage?e.state.getParentPage():e.parent,t,n)}}function Ip({drilldown:e,parent:t}){const n=u(e.routePath),r=t.getDrilldownPage(e,n);return h().createElement(r.Component,{model:r})}Ep.Component=({model:e})=>{const{component:t,props:n,reactNode:r}=e.useState();return t?h().createElement(t,{...n}):r||null};class Lp extends k{constructor(){super(...arguments),this._sceneCache=new Map,this._drilldownCache=new Map}initializeScene(e){this.setState({initializedScene:e})}getScene(e){let t=this._sceneCache.get(e.url);if(t)return t;if(!this.state.getScene)throw new Error("Missing getScene on SceneAppPage "+this.state.title);return t=this.state.getScene(e),this._sceneCache.set(e.url,t),t}getDrilldownPage(e,t){let n=this._drilldownCache.get(t.url);return n||(n=e.getPage(t,this),this._drilldownCache.set(t.url,n),n)}enrichDataRequest(e){if(this.state.getParentPage)return this.state.getParentPage().enrichDataRequest(e);if(!this.parent)return null;const t=this.getRoot();return Dt(t)?t.enrichDataRequest(e):null}}Lp.Component=function({model:e}){const{tabs:t,drilldowns:n}=e.useState(),r=[];if(r.push(function(e){var t,n,r;return h().createElement(i.Route,{key:"fallback route",path:"*",element:h().createElement(Ap,{page:null!=(r=null==(n=(t=e.state).getFallbackPage)?void 0:n.call(t))?r:new Lp({url:"",title:(0,Ze.t)("grafana-scenes.components.fallback-page.title","Not found"),subTitle:(0,Ze.t)("grafana-scenes.components.fallback-page.subTitle","The url did not match any page"),routePath:"*",getScene:()=>new fd({body:new lp({direction:"column",children:[new up({body:new Ep({component:()=>h().createElement("div",{"data-testid":"default-fallback-content"},h().createElement(Ze.x6,{i18nKey:"grafana-scenes.components.fallback-page.content"},"If you found your way here using a link then there might be a bug in this application."))})})]})})})})})}(e)),t&&t.length>0)for(let n=0;n<t.length;n++){const a=t[n];if(0===n&&r.push(h().createElement(i.Route,{key:e.state.routePath,path:"",element:h().createElement(a.Component,{model:a})})),r.push(h().createElement(i.Route,{key:a.state.url,path:a.state.routePath,element:h().createElement(a.Component,{model:a})})),a.state.drilldowns)for(const e of a.state.drilldowns)r.push(h().createElement(i.Route,{key:e.routePath,path:e.routePath,element:h().createElement(Ip,{drilldown:e,parent:a})}))}if(n)for(const t of n)r.push(h().createElement(i.Route,{key:t.routePath,path:t.routePath,Component:()=>h().createElement(Ip,{drilldown:t,parent:e})}));t||r.push(h().createElement(i.Route,{key:"home route",path:"/",element:h().createElement(Ap,{page:e})}));return h().createElement(i.Routes,null,r)};var Mp=n(4290);const Vp={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:Mp.i.Auto,showValue:Mp.V.Auto,stacking:Mp.S.None,xTickLabelRotation:0,xTickLabelSpacing:0},Fp={fillOpacity:80,gradientMode:Mp.G.None,lineWidth:1},Np={displayMode:Mp.h.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:Mp.g.Auto,showUnfilled:!0,sizing:Mp.e.Auto,valueMode:Mp.f.Color},$p={selectedSeries:0},jp={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:Mp.e.Auto},Bp={layers:[]};var zp=n(5938);const Wp={bucketCount:30,bucketOffset:0},Hp={fillOpacity:80,gradientMode:Mp.G.None,lineWidth:1},Up={showImage:!0};const qp={displayLabels:[]},Gp={colorMode:Mp.c.Value,graphMode:Mp.b.Area,justifyMode:Mp.a.Auto,percentChangeColorMode:Mp.P.Standard,showPercentChange:!1,textMode:Mp.B.Auto,wideLayout:!0},Qp={alignValue:"left",mergeValues:!0,perPage:20,rowHeight:.9,showValue:Mp.V.Auto},Kp={fillOpacity:70,lineWidth:0},Yp={colWidth:.9,perPage:20,rowHeight:.9,showValue:Mp.V.Auto},Xp={fillOpacity:70,lineWidth:1},Zp={cellHeight:Mp.T.Sm,frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]};const Jp={content:"# Title\n\nFor markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)",mode:"markdown"};const eh={fillOpacity:50,show:"points"},th={series:[]};class nh{constructor(){this._overrides=[]}overrideColor(e){return this._overrides[this._overrides.length-1].properties.push({id:"color",value:e}),this}overrideDecimals(e){return this._overrides[this._overrides.length-1].properties.push({id:"decimals",value:e}),this}overrideDisplayName(e){return this._overrides[this._overrides.length-1].properties.push({id:"displayName",value:e}),this}overrideFilterable(e){return this._overrides[this._overrides.length-1].properties.push({id:"filterable",value:e}),this}overrideLinks(e){return this._overrides[this._overrides.length-1].properties.push({id:"links",value:e}),this}overrideMappings(e){return this._overrides[this._overrides.length-1].properties.push({id:"mappings",value:e}),this}overrideMax(e){return this._overrides[this._overrides.length-1].properties.push({id:"max",value:e}),this}overrideMin(e){return this._overrides[this._overrides.length-1].properties.push({id:"min",value:e}),this}overrideNoValue(e){return this._overrides[this._overrides.length-1].properties.push({id:"noValue",value:e}),this}overrideThresholds(e){return this._overrides[this._overrides.length-1].properties.push({id:"thresholds",value:e}),this}overrideUnit(e){return this._overrides[this._overrides.length-1].properties.push({id:"unit",value:e}),this}}class rh extends nh{match(e){return this._overrides.push({matcher:e,properties:[]}),this}matchFieldsWithName(e){return this._overrides.push({matcher:{id:o.FieldMatcherID.byName,options:e},properties:[]}),this}matchFieldsWithNameByRegex(e){return this._overrides.push({matcher:{id:o.FieldMatcherID.byRegexp,options:e},properties:[]}),this}matchFieldsByType(e){return this._overrides.push({matcher:{id:o.FieldMatcherID.byType,options:e},properties:[]}),this}matchFieldsByQuery(e){return this._overrides.push({matcher:{id:o.FieldMatcherID.byFrameRefID,options:e},properties:[]}),this}matchFieldsByValue(e){return this._overrides.push({matcher:{id:o.FieldMatcherID.byValue,options:e},properties:[]}),this}matchComparisonQuery(e){return this.matchFieldsByQuery(Yd(e))}overrideCustomFieldConfig(e,t){const n=`custom.${String(e)}`;return this._overrides[this._overrides.length-1].properties.push({id:n,value:t}),this}build(){return this._overrides}}class ah{constructor(e){this.defaultFieldConfig=e,this._fieldConfig={defaults:{},overrides:[]},this._overridesBuilder=new rh,this.setDefaults()}setDefaults(){const e={defaults:{custom:this.defaultFieldConfig?(0,I.cloneDeep)(this.defaultFieldConfig()):{}},overrides:[]};this._fieldConfig=e}setColor(e){return this.setFieldConfigDefaults("color",e)}setDecimals(e){return this.setFieldConfigDefaults("decimals",e)}setDisplayName(e){return this.setFieldConfigDefaults("displayName",e)}setFilterable(e){return this.setFieldConfigDefaults("filterable",e)}setLinks(e){return this.setFieldConfigDefaults("links",e)}setMappings(e){return this.setFieldConfigDefaults("mappings",e)}setMax(e){return this.setFieldConfigDefaults("max",e)}setMin(e){return this.setFieldConfigDefaults("min",e)}setNoValue(e){return this.setFieldConfigDefaults("noValue",e)}setThresholds(e){return this.setFieldConfigDefaults("thresholds",e)}setUnit(e){return this.setFieldConfigDefaults("unit",e)}setCustomFieldConfig(e,t){return this._fieldConfig.defaults={...this._fieldConfig.defaults,custom:(0,I.merge)(this._fieldConfig.defaults.custom,{[e]:t})},this}setOverrides(e){return e(this._overridesBuilder),this}setFieldConfigDefaults(e,t){return this._fieldConfig.defaults={...this._fieldConfig.defaults,[e]:t},this}build(){return{defaults:this._fieldConfig.defaults,overrides:this._overridesBuilder.build()}}}class ih{constructor(e){this.defaultOptions=e,this._options={},this.setDefaults()}setDefaults(){this._options=this.defaultOptions?(0,I.cloneDeep)(this.defaultOptions()):{}}setOption(e,t){return this._options=(0,I.merge)(this._options,{[e]:t}),this}build(){return this._options}}class oh{constructor(e,t,n,r){this._state={},this._state.title="",this._state.description="",this._state.displayMode="default",this._state.hoverHeader=!1,this._state.pluginId=e,this._state.pluginVersion=t,this._fieldConfigBuilder=new ah(r),this._panelOptionsBuilder=new ih(n)}setTitle(e){return this._state.title=e,this}setDescription(e){return this._state.description=e,this}setDisplayMode(e){return this._state.displayMode=e,this}setHoverHeader(e){return this._state.hoverHeader=e,this}setShowMenuAlways(e){return this._state.showMenuAlways=e,this}setMenu(e){return this._state.menu=e,this}setHeaderActions(e){return this._state.headerActions=e,this}setCollapsible(e){return this._state.collapsible=e,this}setCollapsed(e){return this._state.collapsed=e,this}setColor(e){return this._fieldConfigBuilder.setColor(e),this}setDecimals(e){return this._fieldConfigBuilder.setDecimals(e),this}setDisplayName(e){return this._fieldConfigBuilder.setDisplayName(e),this}setFilterable(e){return this._fieldConfigBuilder.setFilterable(e),this}setLinks(e){return this._fieldConfigBuilder.setLinks(e),this}setMappings(e){return this._fieldConfigBuilder.setMappings(e),this}setMax(e){return this._fieldConfigBuilder.setMax(e),this}setMin(e){return this._fieldConfigBuilder.setMin(e),this}setNoValue(e){return this._fieldConfigBuilder.setNoValue(e),this}setThresholds(e){return this._fieldConfigBuilder.setThresholds(e),this}setUnit(e){return this._fieldConfigBuilder.setUnit(e),this}setCustomFieldConfig(e,t){return this._fieldConfigBuilder.setCustomFieldConfig(e,t),this}setOverrides(e){return this._fieldConfigBuilder.setOverrides(e),this}setOption(e,t){return this._panelOptionsBuilder.setOption(e,t),this}setData(e){return this._state.$data=e,this}setTimeRange(e){return this._state.$timeRange=e,this}setVariables(e){return this._state.$variables=e,this}setBehaviors(e){return this._state.$behaviors=e,this}setSeriesLimit(e){return this._state.seriesLimit=e,this}applyMixin(e){return e(this),this}build(){return new Cu({...this._state,options:this._panelOptionsBuilder.build(),fieldConfig:this._fieldConfigBuilder.build()})}}const sh={barchart:()=>new oh("barchart","10.0.0",()=>Vp,()=>Fp),bargauge:()=>new oh("bargauge","10.0.0",()=>Np),datagrid:()=>new oh("datagrid","10.0.0",()=>$p),flamegraph:()=>new oh("flamegraph","10.0.0"),gauge:()=>new oh("gauge","10.0.0",()=>jp),geomap:()=>new oh("geomap","10.0.0",()=>Bp),heatmap:()=>new oh("heatmap","10.0.0",()=>zp.KQ),histogram:()=>new oh("histogram","10.0.0",()=>Wp,()=>Hp),logs:()=>new oh("logs","10.0.0"),news:()=>new oh("news","10.0.0",()=>Up),nodegraph:()=>new oh("nodeGraph","10.0.0"),piechart:()=>new oh("piechart","10.0.0",()=>qp),stat:()=>new oh("stat","10.0.0",()=>Gp),statetimeline:()=>new oh("state-timeline","10.0.0",()=>Qp,()=>Kp),statushistory:()=>new oh("status-history","10.0.0",()=>Yp,()=>Xp),table:()=>new oh("table","10.0.0",()=>Zp),text:()=>new oh("text","10.0.0",()=>Jp),timeseries:()=>new oh("timeseries","10.0.0"),trend:()=>new oh("trend","10.0.0"),traces:()=>new oh("traces","10.0.0"),xychart:()=>new oh("xychart","10.0.0",()=>th,()=>eh)};class lh{constructor(e,t,n,r){this._pluginId=e,this._pluginVersion=t,this._fieldConfigBuilder=new ah(r),this._panelOptionsBuilder=new ih(n)}setColor(e){return this._fieldConfigBuilder.setColor(e),this}setDecimals(e){return this._fieldConfigBuilder.setDecimals(e),this}setDisplayName(e){return this._fieldConfigBuilder.setDisplayName(e),this}setFilterable(e){return this._fieldConfigBuilder.setFilterable(e),this}setLinks(e){return this._fieldConfigBuilder.setLinks(e),this}setMappings(e){return this._fieldConfigBuilder.setMappings(e),this}setMax(e){return this._fieldConfigBuilder.setMax(e),this}setMin(e){return this._fieldConfigBuilder.setMin(e),this}setNoValue(e){return this._fieldConfigBuilder.setNoValue(e),this}setThresholds(e){return this._fieldConfigBuilder.setThresholds(e),this}setUnit(e){return this._fieldConfigBuilder.setUnit(e),this}setCustomFieldConfig(e,t){return this._fieldConfigBuilder.setCustomFieldConfig(e,t),this}setOverrides(e){return this._fieldConfigBuilder.setOverrides(e),this}setOption(e,t){return this._panelOptionsBuilder.setOption(e,t),this}build(){return{pluginId:this._pluginId,pluginVersion:this._pluginVersion,options:this._panelOptionsBuilder.build(),fieldConfig:this._fieldConfigBuilder.build()}}}const uh={barchart:()=>new lh("barchart","10.0.0",()=>Vp,()=>Fp),bargauge:()=>new lh("bargauge","10.0.0",()=>Np),datagrid:()=>new lh("datagrid","10.0.0",()=>$p),flamegraph:()=>new lh("flamegraph","10.0.0"),gauge:()=>new lh("gauge","10.0.0",()=>jp),geomap:()=>new lh("geomap","10.0.0",()=>Bp),heatmap:()=>new lh("heatmap","10.0.0",()=>zp.KQ),histogram:()=>new lh("histogram","10.0.0",()=>Wp,()=>Hp),logs:()=>new lh("logs","10.0.0"),news:()=>new lh("news","10.0.0",()=>Up),nodegraph:()=>new lh("nodeGraph","10.0.0"),piechart:()=>new lh("piechart","10.0.0",()=>qp),stat:()=>new lh("stat","10.0.0",()=>Gp),statetimeline:()=>new lh("state-timeline","10.0.0",()=>Qp,()=>Kp),statushistory:()=>new lh("status-history","10.0.0",()=>Yp,()=>Xp),table:()=>new lh("table","10.0.0",()=>Zp),text:()=>new lh("text","10.0.0",()=>Jp),timeseries:()=>new lh("timeseries","10.0.0"),trend:()=>new lh("trend","10.0.0"),traces:()=>new lh("traces","10.0.0"),xychart:()=>new lh("xychart","10.0.0",()=>th,()=>eh)};const ch=n(5730).Y.reduce((e,t)=>(e[t.code]=async()=>await function(e){switch(e){case"../locales/cs-CZ/grafana-scenes.json":return n.e(549).then(n.bind(n,4549));case"../locales/de-DE/grafana-scenes.json":return n.e(876).then(n.bind(n,876));case"../locales/en-US/grafana-scenes.json":return n.e(767).then(n.bind(n,4767));case"../locales/es-ES/grafana-scenes.json":return n.e(190).then(n.bind(n,2190));case"../locales/fr-FR/grafana-scenes.json":return n.e(2).then(n.bind(n,6002));case"../locales/hu-HU/grafana-scenes.json":return n.e(220).then(n.bind(n,8220));case"../locales/id-ID/grafana-scenes.json":return n.e(980).then(n.bind(n,7980));case"../locales/it-IT/grafana-scenes.json":return n.e(644).then(n.bind(n,5644));case"../locales/ja-JP/grafana-scenes.json":return n.e(327).then(n.bind(n,4327));case"../locales/ko-KR/grafana-scenes.json":return n.e(353).then(n.bind(n,7353));case"../locales/nl-NL/grafana-scenes.json":return n.e(74).then(n.bind(n,6074));case"../locales/pl-PL/grafana-scenes.json":return n.e(582).then(n.bind(n,3582));case"../locales/pt-BR/grafana-scenes.json":return n.e(150).then(n.bind(n,5150));case"../locales/pt-PT/grafana-scenes.json":return n.e(206).then(n.bind(n,6206));case"../locales/ru-RU/grafana-scenes.json":return n.e(64).then(n.bind(n,6064));case"../locales/sv-SE/grafana-scenes.json":return n.e(697).then(n.bind(n,5697));case"../locales/tr-TR/grafana-scenes.json":return n.e(70).then(n.bind(n,5070));case"../locales/zh-Hans/grafana-scenes.json":return n.e(660).then(n.bind(n,4279));case"../locales/zh-Hant/grafana-scenes.json":return n.e(341).then(n.bind(n,9341));default:return new Promise(function(t,n){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+e)))})}}(`../locales/${t.code}/grafana-scenes.json`),e),{}),dh=async e=>(await ch[e]()).default,ph={barchart:()=>new ih(()=>Vp),bargauge:()=>new ih(()=>Np),datagrid:()=>new ih(()=>$p),flamegraph:()=>new ih,gauge:()=>new ih(()=>jp),geomap:()=>new ih(()=>Bp),heatmap:()=>new ih(()=>zp.KQ),histogram:()=>new ih(()=>Wp),logs:()=>new ih,news:()=>new ih(()=>Up),nodegraph:()=>new ih,piechart:()=>new ih(()=>qp),stat:()=>new ih(()=>Gp),statetimeline:()=>new ih(()=>Qp),statushistory:()=>new ih(()=>Yp),table:()=>new ih(()=>Zp),text:()=>new ih(()=>Jp),timeseries:()=>new ih,trend:()=>new ih,traces:()=>new ih,xychart:()=>new ih(()=>th)},hh={barchart:()=>new ah(()=>Fp),bargauge:()=>new ah,datagrid:()=>new ah,flamegraph:()=>new ah,gauge:()=>new ah,geomap:()=>new ah,heatmap:()=>new ah,histogram:()=>new ah(()=>Hp),logs:()=>new ah,news:()=>new ah,nodegraph:()=>new ah,piechart:()=>new ah,stat:()=>new ah,statetimeline:()=>new ah(()=>Kp),statushistory:()=>new ah(()=>Xp),table:()=>new ah,text:()=>new ah,timeseries:()=>new ah,trend:()=>new ah,traces:()=>new ah,xychart:()=>new ah(()=>eh)},fh={getUrlWithAppState:l,registerRuntimePanelPlugin:function({pluginId:e,plugin:t}){if(c.has(e))throw new Error(`A runtime panel plugin with id ${e} has already been registered`);t.meta={...t.meta,id:e,name:e,module:"runtime plugin",baseUrl:"runtime plugin",info:{author:{name:"Runtime plugin "+e},description:"",links:[],logos:{large:"",small:""},screenshots:[],updated:"",version:""}},c.set(e,t)},registerRuntimeDataSource:F,registerVariableMacro:function(e,t,n=!1){if(!n&&Rt.get(e))throw new Error(`Macro already registered ${e}`);return Rt.set(e,t),()=>{if(n)throw new Error("Replaced macros can not be unregistered. They need to be restored manually.");Rt.delete(e)}},cloneSceneObjectState:L,syncStateFromSearchParams:function(e,t,n){jl(e,t,new Fl(n))},getUrlState:$l,renderPrometheusLabelFilters:Qs,escapeLabelValueInRegexSelector:Ys,escapeLabelValueInExactSelector:Ks,escapeURLDelimiters:function(e){return el(Js(e))},isAdHocVariable:function(e){return"adhoc"===e.state.type},isConstantVariable:function(e){return"constant"===e.state.type},isCustomVariable:function(e){return"custom"===e.state.type},isDataSourceVariable:function(e){return"datasource"===e.state.type},isIntervalVariable:function(e){return"interval"===e.state.type},isQueryVariable:function(e){return"query"===e.state.type},isTextBoxVariable:function(e){return"textbox"===e.state.type},isGroupByVariable:function(e){return"groupby"===e.state.type},isRepeatCloneOrChildOf:yt,buildPathIdFor:Ul}},6805:(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},r(e)}t.default=function(e){var t;return 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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(u,t);var n,i,l=(n=u,i=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=f(n);if(i){var a=f(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}(this,e)});function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return m(h(e=l.call.apply(l,[this].concat(n))),"state",{width:1280}),m(h(e),"elementRef",a.createRef()),m(h(e),"mounted",!1),m(h(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&&d(e.prototype,t);n&&d(e,n);Object.defineProperty(e,"prototype",{writable:!1})}(u,[{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,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(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)&&(a[n]=e[n])}return a}(t,s);return n&&!this.mounted?a.createElement("div",{className:(0,o.default)(this.props.className,g),style:this.props.style,ref:this.elementRef}):a.createElement(e,c({innerRef:this.elementRef},r,this.state))}}]),u}(a.Component),m(t,"defaultProps",{measureBeforeMount:!1}),m(t,"propTypes",{measureBeforeMount:i.default.bool}),t};var a=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 a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}a.default=e,n&&n.set(e,a);return a}(n(5959)),i=l(n(2688)),o=l(n(7256)),s=["measureBeforeMount"];function l(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 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},c.apply(this,arguments)}function d(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},p(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g="react-grid-layout"},6850:(e,t,n)=>{"use strict";const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:a,MAX_LENGTH:i}=n(9630),o=n(9796),s=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={};let p=0;const h="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",i],[h,a]],m=(e,t,n)=>{const r=(e=>{for(const[t,n]of f)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),a=p++;o(e,a,t),d[e]=a,u[a]=t,c[a]=r,s[a]=new RegExp(t,n?"g":void 0),l[a]=new RegExp(r,n?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${h}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?(?:$|[^\\d])`),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},6909:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>0===r(e,t,n)},7023:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t)=>r(e,t,!0)},7092:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)<=0},7095:e=>{"use strict";const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},7222:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeHandleType=t.resizeHandleAxesType=t.default=void 0;var r=i(n(2688)),a=i(n(5959));function i(e){return e&&e.__esModule?e:{default:e}}var o=r.default.arrayOf(r.default.oneOf(["s","w","e","n","sw","nw","se","ne"]));t.resizeHandleAxesType=o;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(414).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,allowOverlap:r.default.bool,preventCollision:r.default.bool,useCSSTransforms:r.default.bool,transformScale:r.default.number,isDroppable:r.default.bool,resizeHandles:o,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={};a.default.Children.forEach(n,function(e){if(null!=(null==e?void 0:e.key)){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},7256:(e,t,n)=>{"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(a&&(a+=" "),a+=n);else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}function a(){for(var e,t,n=0,a="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(a&&(a+=" "),a+=t);return a}n.r(t),n.d(t,{clsx:()=>a,default:()=>i});const i=a},7350:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.browserPrefixToKey=a,t.browserPrefixToStyle=function(e,t){return t?`-${t.toLowerCase()}-${e}`:e},t.default=void 0,t.getPrefix=r;const n=["Moz","Webkit","O","ms"];function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const t=window.document?.documentElement?.style;if(!t)return"";if(e in t)return"";for(let r=0;r<n.length;r++)if(a(e,n[r])in t)return n[r];return""}function a(e,t){return t?`${t}${function(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)}`:e}t.default=r()},7434:e=>{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.allowOverlap===t.allowOverlap&&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)}},7494:(e,t,n)=>{"use strict";const r=n(8395);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},7645:(e,t,n)=>{"use strict";const r=n(5860);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},7659:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>0!==r(e,t,n)},7840:(e,t,n)=>{"use strict";const r=n(7944),a=n(8395);e.exports=(e,t,n)=>{let i=null,o=null,s=null;try{s=new a(t,n)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&-1!==o.compare(e)||(i=e,o=new r(i,n)))}),i}},7842:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",a=9007199254740991,i="[object Arguments]",o="[object Array]",s="[object Boolean]",l="[object Date]",u="[object Error]",c="[object Function]",d="[object Map]",p="[object Number]",h="[object Object]",f="[object Promise]",m="[object RegExp]",g="[object Set]",v="[object String]",b="[object Symbol]",y="[object WeakMap]",w="[object ArrayBuffer]",S="[object DataView]",x=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[i]=E[o]=E[w]=E[s]=E[S]=E[l]=E[u]=E[c]=E[d]=E[p]=E[h]=E[m]=E[g]=E[v]=E[y]=!1;var C="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,R="object"==typeof self&&self&&self.Object===Object&&self,O=C||R||Function("return this")(),T=t&&!t.nodeType&&t,D=T&&e&&!e.nodeType&&e,k=D&&D.exports===T,A=k&&C.process,P=function(){try{return A&&A.binding&&A.binding("util")}catch(e){}}(),I=P&&P.isTypedArray;function L(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 M(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function V(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var F,N,$,j=Array.prototype,B=Function.prototype,z=Object.prototype,W=O["__core-js_shared__"],H=B.toString,U=z.hasOwnProperty,q=(F=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"",G=z.toString,Q=RegExp("^"+H.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),K=k?O.Buffer:void 0,Y=O.Symbol,X=O.Uint8Array,Z=z.propertyIsEnumerable,J=j.splice,ee=Y?Y.toStringTag:void 0,te=Object.getOwnPropertySymbols,ne=K?K.isBuffer:void 0,re=(N=Object.keys,$=Object,function(e){return N($(e))}),ae=Pe(O,"DataView"),ie=Pe(O,"Map"),oe=Pe(O,"Promise"),se=Pe(O,"Set"),le=Pe(O,"WeakMap"),ue=Pe(Object,"create"),ce=Ve(ae),de=Ve(ie),pe=Ve(oe),he=Ve(se),fe=Ve(le),me=Y?Y.prototype:void 0,ge=me?me.valueOf:void 0;function ve(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 be(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 ye(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 we(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ye;++t<n;)this.add(e[t])}function Se(e){var t=this.__data__=new be(e);this.size=t.size}function xe(e,t){var n=$e(e),r=!n&&Ne(e),a=!n&&!r&&je(e),i=!n&&!r&&!a&&Ue(e),o=n||r||a||i,s=o?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 u in e)!t&&!U.call(e,u)||o&&("length"==u||a&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Me(u,l))||s.push(u);return s}function _e(e,t){for(var n=e.length;n--;)if(Fe(e[n][0],t))return n;return-1}function Ee(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ee&&ee in Object(e)?function(e){var t=U.call(e,ee),n=e[ee];try{e[ee]=void 0;var r=!0}catch(e){}var a=G.call(e);r&&(t?e[ee]=n:delete e[ee]);return a}(e):function(e){return G.call(e)}(e)}function Ce(e){return He(e)&&Ee(e)==i}function Re(e,t,n,r,a){return e===t||(null==e||null==t||!He(e)&&!He(t)?e!=e&&t!=t:function(e,t,n,r,a,c){var f=$e(e),y=$e(t),x=f?o:Le(e),_=y?o:Le(t),E=(x=x==i?h:x)==h,C=(_=_==i?h:_)==h,R=x==_;if(R&&je(e)){if(!je(t))return!1;f=!0,E=!1}if(R&&!E)return c||(c=new Se),f||Ue(e)?De(e,t,n,r,a,c):function(e,t,n,r,a,i,o){switch(n){case S:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case w:return!(e.byteLength!=t.byteLength||!i(new X(e),new X(t)));case s:case l:case p:return Fe(+e,+t);case u:return e.name==t.name&&e.message==t.message;case m:case v:return e==t+"";case d:var c=M;case g:var h=1&r;if(c||(c=V),e.size!=t.size&&!h)return!1;var f=o.get(e);if(f)return f==t;r|=2,o.set(e,t);var y=De(c(e),c(t),r,a,i,o);return o.delete(e),y;case b:if(ge)return ge.call(e)==ge.call(t)}return!1}(e,t,x,n,r,a,c);if(!(1&n)){var O=E&&U.call(e,"__wrapped__"),T=C&&U.call(t,"__wrapped__");if(O||T){var D=O?e.value():e,k=T?t.value():t;return c||(c=new Se),a(D,k,n,r,c)}}if(!R)return!1;return c||(c=new Se),function(e,t,n,r,a,i){var o=1&n,s=ke(e),l=s.length,u=ke(t),c=u.length;if(l!=c&&!o)return!1;var d=l;for(;d--;){var p=s[d];if(!(o?p in t:U.call(t,p)))return!1}var h=i.get(e);if(h&&i.get(t))return h==t;var f=!0;i.set(e,t),i.set(t,e);var m=o;for(;++d<l;){var g=e[p=s[d]],v=t[p];if(r)var b=o?r(v,g,p,t,e,i):r(g,v,p,e,t,i);if(!(void 0===b?g===v||a(g,v,n,r,i):b)){f=!1;break}m||(m="constructor"==p)}if(f&&!m){var y=e.constructor,w=t.constructor;y==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w||(f=!1)}return i.delete(e),i.delete(t),f}(e,t,n,r,a,c)}(e,t,n,r,Re,a))}function Oe(e){return!(!We(e)||function(e){return!!q&&q in e}(e))&&(Be(e)?Q:x).test(Ve(e))}function Te(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||z,t!==r)return re(e);var t,n,r,a=[];for(var i in Object(e))U.call(e,i)&&"constructor"!=i&&a.push(i);return a}function De(e,t,n,r,a,i){var o=1&n,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=i.get(e);if(u&&i.get(t))return u==t;var c=-1,d=!0,p=2&n?new we:void 0;for(i.set(e,t),i.set(t,e);++c<s;){var h=e[c],f=t[c];if(r)var m=o?r(f,h,c,t,e,i):r(h,f,c,e,t,i);if(void 0!==m){if(m)continue;d=!1;break}if(p){if(!L(t,function(e,t){if(o=t,!p.has(o)&&(h===e||a(h,e,n,r,i)))return p.push(t);var o})){d=!1;break}}else if(h!==f&&!a(h,f,n,r,i)){d=!1;break}}return i.delete(e),i.delete(t),d}function ke(e){return function(e,t,n){var r=t(e);return $e(e)?r:function(e,t){for(var n=-1,r=t.length,a=e.length;++n<r;)e[a+n]=t[n];return e}(r,n(e))}(e,qe,Ie)}function Ae(e,t){var n,r,a=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function Pe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Oe(n)?n:void 0}ve.prototype.clear=function(){this.__data__=ue?ue(null):{},this.size=0},ve.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ve.prototype.get=function(e){var t=this.__data__;if(ue){var n=t[e];return n===r?void 0:n}return U.call(t,e)?t[e]:void 0},ve.prototype.has=function(e){var t=this.__data__;return ue?void 0!==t[e]:U.call(t,e)},ve.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ue&&void 0===t?r:t,this},be.prototype.clear=function(){this.__data__=[],this.size=0},be.prototype.delete=function(e){var t=this.__data__,n=_e(t,e);return!(n<0)&&(n==t.length-1?t.pop():J.call(t,n,1),--this.size,!0)},be.prototype.get=function(e){var t=this.__data__,n=_e(t,e);return n<0?void 0:t[n][1]},be.prototype.has=function(e){return _e(this.__data__,e)>-1},be.prototype.set=function(e,t){var n=this.__data__,r=_e(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ye.prototype.clear=function(){this.size=0,this.__data__={hash:new ve,map:new(ie||be),string:new ve}},ye.prototype.delete=function(e){var t=Ae(this,e).delete(e);return this.size-=t?1:0,t},ye.prototype.get=function(e){return Ae(this,e).get(e)},ye.prototype.has=function(e){return Ae(this,e).has(e)},ye.prototype.set=function(e,t){var n=Ae(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},we.prototype.add=we.prototype.push=function(e){return this.__data__.set(e,r),this},we.prototype.has=function(e){return this.__data__.has(e)},Se.prototype.clear=function(){this.__data__=new be,this.size=0},Se.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Se.prototype.get=function(e){return this.__data__.get(e)},Se.prototype.has=function(e){return this.__data__.has(e)},Se.prototype.set=function(e,t){var n=this.__data__;if(n instanceof be){var r=n.__data__;if(!ie||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ye(r)}return n.set(e,t),this.size=n.size,this};var Ie=te?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,a=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}(te(e),function(t){return Z.call(e,t)}))}:function(){return[]},Le=Ee;function Me(e,t){return!!(t=null==t?a:t)&&("number"==typeof e||_.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){if(null!=e){try{return H.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Fe(e,t){return e===t||e!=e&&t!=t}(ae&&Le(new ae(new ArrayBuffer(1)))!=S||ie&&Le(new ie)!=d||oe&&Le(oe.resolve())!=f||se&&Le(new se)!=g||le&&Le(new le)!=y)&&(Le=function(e){var t=Ee(e),n=t==h?e.constructor:void 0,r=n?Ve(n):"";if(r)switch(r){case ce:return S;case de:return d;case pe:return f;case he:return g;case fe:return y}return t});var Ne=Ce(function(){return arguments}())?Ce:function(e){return He(e)&&U.call(e,"callee")&&!Z.call(e,"callee")},$e=Array.isArray;var je=ne||function(){return!1};function Be(e){if(!We(e))return!1;var t=Ee(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ze(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function We(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function He(e){return null!=e&&"object"==typeof e}var Ue=I?function(e){return function(t){return e(t)}}(I):function(e){return He(e)&&ze(e.length)&&!!E[Ee(e)]};function qe(e){return null!=(t=e)&&ze(t.length)&&!Be(t)?xe(e):Te(e);var t}e.exports=function(e,t){return Re(e,t)}},7871:(e,t,n)=>{"use strict";const r=n(5463);e.exports=(e,t,n)=>r(e,t,">",n)},7930:(e,t,n)=>{"use strict";const r=n(7944),a=n(8395);e.exports=(e,t,n)=>{let i=null,o=null,s=null;try{s=new a(t,n)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&1!==o.compare(e)||(i=e,o=new r(i,n)))}),i}},7944:(e,t,n)=>{"use strict";const r=n(9796),{MAX_LENGTH:a,MAX_SAFE_INTEGER:i}=n(9630),{safeRe:o,t:s}=n(6850),l=n(7095),{compareIdentifiers:u}=n(4031);class c{constructor(e,t){if(t=l(t),e instanceof c){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>a)throw new TypeError(`version is longer than ${a} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?o[s.LOOSE]:o[s.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof c||(e=new c(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],a=e.prerelease[t];if(r("prerelease compare",t,n,a),void 0===n&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===n)return-1;if(n!==a)return u(n,a)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{const n=this.build[t],a=e.build[t];if(r("build compare",t,n,a),void 0===n&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===n)return-1;if(n!==a)return u(n,a)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?o[s.PRERELEASELOOSE]:o[s.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=c},7988:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){0}},7994:(e,t,n)=>{"use strict";const r=n(5860);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},8100:(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},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=p(n(5959)),i=p(n(2688)),o=n(8230),s=n(936),l=n(414),u=n(906),c=n(7222),d=p(n(7256));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){w(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 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 g(e,t){return g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},g(e,t)}function v(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,a=y(e);if(t){var i=y(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}(this,n)}}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(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 S=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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(c,e);var t,n,r,i=v(c);function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return w(b(e=i.call.apply(i,[this].concat(n))),"state",{resizing:null,dragging:null,className:""}),w(b(e),"elementRef",a.default.createRef()),w(b(e),"onDragStart",function(t,n){var r=n.node,a=e.props,i=a.onDragStart,o=a.transformScale;if(i){var s={top:0,left:0},l=r.offsetParent;if(l){var c=l.getBoundingClientRect(),d=r.getBoundingClientRect(),p=d.left/o,h=c.left/o,f=d.top/o,m=c.top/o;s.left=p-h+l.scrollLeft,s.top=f-m+l.scrollTop,e.setState({dragging:s});var g=(0,u.calcXY)(e.getPositionParams(),s.top,s.left,e.props.w,e.props.h),v=g.x,y=g.y;return i.call(b(e),e.props.i,v,y,{e:t,node:r,newPosition:s})}}}),w(b(e),"onDrag",function(t,n){var r=n.node,a=n.deltaX,i=n.deltaY,o=e.props.onDrag;if(o){if(!e.state.dragging)throw new Error("onDrag called before onDragStart.");var s=e.state.dragging.top+i,l=e.state.dragging.left+a,c=e.props,d=c.isBounded,p=c.i,h=c.w,f=c.h,m=c.containerWidth,g=e.getPositionParams();if(d){var v=r.offsetParent;if(v){var y=e.props,w=y.margin,S=y.rowHeight,x=v.clientHeight-(0,u.calcGridItemWHPx)(f,S,w[1]);s=(0,u.clamp)(s,0,x);var _=(0,u.calcGridColWidth)(g),E=m-(0,u.calcGridItemWHPx)(h,_,w[0]);l=(0,u.clamp)(l,0,E)}}var C={top:s,left:l};e.setState({dragging:C});var R=(0,u.calcXY)(g,s,l,h,f),O=R.x,T=R.y;return o.call(b(e),p,O,T,{e:t,node:r,newPosition:C})}}),w(b(e),"onDragStop",function(t,n){var r=n.node,a=e.props.onDragStop;if(a){if(!e.state.dragging)throw new Error("onDragEnd called before onDragStart.");var i=e.props,o=i.w,s=i.h,l=i.i,c=e.state.dragging,d=c.left,p=c.top,h={top:p,left:d};e.setState({dragging:null});var f=(0,u.calcXY)(e.getPositionParams(),p,d,o,s),m=f.x,g=f.y;return a.call(b(e),l,m,g,{e:t,node:r,newPosition:h})}}),w(b(e),"onResizeStop",function(t,n){e.onResizeHandler(t,n,"onResizeStop")}),w(b(e),"onResizeStart",function(t,n){e.onResizeHandler(t,n,"onResizeStart")}),w(b(e),"onResize",function(t,n){e.onResizeHandler(t,n,"onResize")}),e}return t=c,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,u.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,u.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},a=this.state.dragging,i=a&&t.left!==r.left||t.top!==r.top;if(a){if(i){var o=t.left-a.left,s=t.top-a.top;this.onDrag(t.e,{node:n,deltaX:o,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,a=n.containerWidth;return n.useCSSTransforms?t=(0,l.setTransform)(e):(t=(0,l.setTopLeft)(e),r&&(t.left=(0,l.perc)(e.left/a),t.width=(0,l.perc)(e.width/a))),t}},{key:"mixinDraggable",value:function(e,t){return a.default.createElement(o.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,o=r.x,l=r.minW,c=r.minH,d=r.maxW,p=r.maxH,h=r.transformScale,f=r.resizeHandles,m=r.resizeHandle,g=this.getPositionParams(),v=(0,u.calcGridItemPosition)(g,0,0,i-o,0).width,b=(0,u.calcGridItemPosition)(g,0,0,l,c),y=(0,u.calcGridItemPosition)(g,0,0,d,p),w=[b.width,b.height],S=[Math.min(y.width,v),Math.min(y.height,1/0)];return a.default.createElement(s.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:t.width,height:t.height,minConstraints:w,maxConstraints:S,onResizeStop:this.onResizeStop,onResizeStart:this.onResizeStart,onResize:this.onResize,transformScale:h,resizeHandles:f,handle:m},e)}},{key:"onResizeHandler",value:function(e,t,n){var r=t.node,a=t.size,i=this.props[n];if(i){var o=this.props,s=o.cols,l=o.x,c=o.y,d=o.i,p=o.maxH,h=o.minH,f=this.props,m=f.minW,g=f.maxW,v=(0,u.calcWH)(this.getPositionParams(),a.width,a.height,l,c),b=v.w,y=v.h;m=Math.max(m,1),g=Math.min(g,s-l),b=(0,u.clamp)(b,m,g),y=(0,u.clamp)(y,h,p),this.setState({resizing:"onResizeStop"===n?null:a}),i.call(this,d,b,y,{e,node:r,size:a})}}},{key:"render",value:function(){var e=this.props,t=e.x,n=e.y,r=e.w,i=e.h,o=e.isDraggable,s=e.isResizable,l=e.droppingPosition,c=e.useCSSTransforms,p=(0,u.calcGridItemPosition)(this.getPositionParams(),t,n,r,i,this.state),h=a.default.Children.only(this.props.children),m=a.default.cloneElement(h,{ref:this.elementRef,className:(0,d.default)("react-grid-item",h.props.className,this.props.className,{static:this.props.static,resizing:Boolean(this.state.resizing),"react-draggable":o,"react-draggable-dragging":Boolean(this.state.dragging),dropping:Boolean(l),cssTransforms:c}),style:f(f(f({},this.props.style),h.props.style),this.createStyle(p))});return m=this.mixinResizable(m,p,s),m=this.mixinDraggable(m,o)}}],n&&m(t.prototype,n),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),c}(a.default.Component);t.default=S,w(S,"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:c.resizeHandleAxesType,resizeHandle:c.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})}),w(S,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1})},8230:(e,t,n)=>{"use strict";const{default:r,DraggableCore:a}=n(9111);e.exports=r,e.exports.default=r,e.exports.DraggableCore=a},8395:(e,t,n)=>{"use strict";const r=/\s+/g;class a{constructor(e,t){if(t=o(t),e instanceof a)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new a(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(r," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!v(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&b(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&m)|(this.options.loose&&g))+":"+e,n=i.get(t);if(n)return n;const r=this.options.loose,a=r?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];e=e.replace(a,k(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(c[d.COMPARATORTRIM],p),l("comparator trim",e),e=e.replace(c[d.TILDETRIM],h),l("tilde trim",e),e=e.replace(c[d.CARETTRIM],f),l("caret trim",e);let o=e.split(" ").map(e=>w(e,this.options)).join(" ").split(/\s+/).map(e=>D(e,this.options));r&&(o=o.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",o);const u=new Map,b=o.map(e=>new s(e,this.options));for(const e of b){if(v(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");const y=[...u.values()];return i.set(t,y),y}intersects(e,t){if(!(e instanceof a))throw new TypeError("a Range is required");return this.set.some(n=>y(n,t)&&e.set.some(e=>y(e,t)&&n.every(n=>e.every(e=>n.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(A(this.set[t],e,this.options))return!0;return!1}}e.exports=a;const i=new(n(1158)),o=n(7095),s=n(9524),l=n(9796),u=n(7944),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:h,caretTrimReplace:f}=n(6850),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:g}=n(9630),v=e=>"<0.0.0-0"===e.value,b=e=>""===e.value,y=(e,t)=>{let n=!0;const r=e.slice();let a=r.pop();for(;n&&r.length;)n=r.every(e=>a.intersects(e,t)),a=r.pop();return n},w=(e,t)=>(l("comp",e,t),e=E(e,t),l("caret",e),e=x(e,t),l("tildes",e),e=R(e,t),l("xrange",e),e=T(e,t),l("stars",e),e),S=e=>!e||"x"===e.toLowerCase()||"*"===e,x=(e,t)=>e.trim().split(/\s+/).map(e=>_(e,t)).join(" "),_=(e,t)=>{const n=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(n,(t,n,r,a,i)=>{let o;return l("tilde",e,t,n,r,a,i),S(n)?o="":S(r)?o=`>=${n}.0.0 <${+n+1}.0.0-0`:S(a)?o=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:i?(l("replaceTilde pr",i),o=`>=${n}.${r}.${a}-${i} <${n}.${+r+1}.0-0`):o=`>=${n}.${r}.${a} <${n}.${+r+1}.0-0`,l("tilde return",o),o})},E=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(" "),C=(e,t)=>{l("caret",e,t);const n=t.loose?c[d.CARETLOOSE]:c[d.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,(t,n,a,i,o)=>{let s;return l("caret",e,t,n,a,i,o),S(n)?s="":S(a)?s=`>=${n}.0.0${r} <${+n+1}.0.0-0`:S(i)?s="0"===n?`>=${n}.${a}.0${r} <${n}.${+a+1}.0-0`:`>=${n}.${a}.0${r} <${+n+1}.0.0-0`:o?(l("replaceCaret pr",o),s="0"===n?"0"===a?`>=${n}.${a}.${i}-${o} <${n}.${a}.${+i+1}-0`:`>=${n}.${a}.${i}-${o} <${n}.${+a+1}.0-0`:`>=${n}.${a}.${i}-${o} <${+n+1}.0.0-0`):(l("no pr"),s="0"===n?"0"===a?`>=${n}.${a}.${i}${r} <${n}.${a}.${+i+1}-0`:`>=${n}.${a}.${i}${r} <${n}.${+a+1}.0-0`:`>=${n}.${a}.${i} <${+n+1}.0.0-0`),l("caret return",s),s})},R=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>O(e,t)).join(" ")),O=(e,t)=>{e=e.trim();const n=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(n,(n,r,a,i,o,s)=>{l("xRange",e,n,r,a,i,o,s);const u=S(a),c=u||S(i),d=c||S(o),p=d;return"="===r&&p&&(r=""),s=t.includePrerelease?"-0":"",u?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&p?(c&&(i=0),o=0,">"===r?(r=">=",c?(a=+a+1,i=0,o=0):(i=+i+1,o=0)):"<="===r&&(r="<",c?a=+a+1:i=+i+1),"<"===r&&(s="-0"),n=`${r+a}.${i}.${o}${s}`):c?n=`>=${a}.0.0${s} <${+a+1}.0.0-0`:d&&(n=`>=${a}.${i}.0${s} <${a}.${+i+1}.0-0`),l("xRange return",n),n})},T=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),D=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),k=e=>(t,n,r,a,i,o,s,l,u,c,d,p)=>`${n=S(r)?"":S(a)?`>=${r}.0.0${e?"-0":""}`:S(i)?`>=${r}.${a}.0${e?"-0":""}`:o?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=S(u)?"":S(c)?`<${+u+1}.0.0-0`:S(d)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${d}-${p}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`}`.trim(),A=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(l(e[n].semver),e[n].semver!==s.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}},8449:(e,t,n)=>{"use strict";const r=n(6850),a=n(9630),i=n(7944),o=n(4031),s=n(5860),l=n(7645),u=n(7994),c=n(5955),d=n(660),p=n(2966),h=n(5986),f=n(1617),m=n(9613),g=n(5380),v=n(2862),b=n(7023),y=n(2801),w=n(603),S=n(6033),x=n(144),_=n(599),E=n(6909),C=n(7659),R=n(2077),O=n(7092),T=n(3811),D=n(5334),k=n(9524),A=n(8395),P=n(1722),I=n(651),L=n(7840),M=n(7930),V=n(3489),F=n(7494),N=n(5463),$=n(7871),j=n(4266),B=n(1112),z=n(1465),W=n(9252);e.exports={parse:s,valid:l,clean:u,inc:c,diff:d,major:p,minor:h,patch:f,prerelease:m,compare:g,rcompare:v,compareLoose:b,compareBuild:y,sort:w,rsort:S,gt:x,lt:_,eq:E,neq:C,gte:R,lte:O,cmp:T,coerce:D,Comparator:k,Range:A,satisfies:P,toComparators:I,maxSatisfying:L,minSatisfying:M,minVersion:V,validRange:F,outside:N,gtr:$,ltr:j,intersects:B,simplifyRange:z,subset:W,SemVer:i,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:a.SEMVER_SPEC_VERSION,RELEASE_TYPES:a.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},8784:e=>{function t(e){var n,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(n=0;n<i;n++)e[n]&&(r=t(e[n]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function n(){for(var e,n,r=0,a="",i=arguments.length;r<i;r++)(e=arguments[r])&&(n=t(e))&&(a&&(a+=" "),a+=n);return a}e.exports=n,e.exports.clsx=n},9111:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return c.default}}),t.default=void 0;var r=function(e,t){if("function"==typeof WeakMap)var n=new WeakMap,r=new WeakMap;return function(e,t){if(!t&&e&&e.__esModule)return e;var a,i,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(a=t?r:n){if(a.has(e))return a.get(e);a.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?a(o,t,i):o[t]=e[t]);return o}(e,t)}(n(5959)),a=p(n(2688)),i=p(n(8398)),o=n(8784),s=n(2837),l=n(402),u=n(6732),c=p(n(1060)),d=p(n(7988));function p(e){return e&&e.__esModule?e:{default:e}}function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h.apply(null,arguments)}function f(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class m extends r.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return!n||r&&n.x===r.x&&n.y===r.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}})}constructor(e){super(e),f(this,"onDragStart",(e,t)=>{(0,d.default)("Draggable: onDragStart: %j",t);if(!1===this.props.onStart(e,(0,l.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})}),f(this,"onDrag",(e,t)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",t);const n=(0,l.createDraggableData)(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){const{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;const[a,i]=(0,l.getBoundPosition)(this,r.x,r.y);r.x=a,r.y=i,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(r)}),f(this,"onDragStop",(e,t)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(e,(0,l.createDraggableData)(this,t)))return!1;(0,d.default)("Draggable: onDragStop: %j",t);const n={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){const{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)}),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...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.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??i.default.findDOMNode(this)}render(){const{axis:e,bounds:t,children:n,defaultPosition:a,defaultClassName:i,defaultClassNameDragging:u,defaultClassNameDragged:d,position:p,positionOffset:f,scale:m,...g}=this.props;let v={},b=null;const y=!Boolean(p)||this.state.dragging,w=p||a,S={x:(0,l.canDragX)(this)&&y?this.state.x:w.x,y:(0,l.canDragY)(this)&&y?this.state.y:w.y};this.state.isElementSVG?b=(0,s.createSVGTransform)(S,f):v=(0,s.createCSSTransform)(S,f);const x=(0,o.clsx)(n.props.className||"",i,{[u]:this.state.dragging,[d]:this.state.dragged});return r.createElement(c.default,h({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),r.cloneElement(r.Children.only(n),{className:x,style:{...n.props.style,...v},transform:b}))}}t.default=m,f(m,"displayName","Draggable"),f(m,"propTypes",{...c.default.propTypes,axis:a.default.oneOf(["both","x","y","none"]),bounds:a.default.oneOfType([a.default.shape({left:a.default.number,right:a.default.number,top:a.default.number,bottom:a.default.number}),a.default.string,a.default.oneOf([!1])]),defaultClassName:a.default.string,defaultClassNameDragging:a.default.string,defaultClassNameDragged:a.default.string,defaultPosition:a.default.shape({x:a.default.number,y:a.default.number}),positionOffset:a.default.shape({x:a.default.oneOfType([a.default.number,a.default.string]),y:a.default.oneOfType([a.default.number,a.default.string])}),position:a.default.shape({x:a.default.number,y:a.default.number}),className:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),f(m,"defaultProps",{...c.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})},9252:(e,t,n)=>{"use strict";const r=n(8395),a=n(9524),{ANY:i}=a,o=n(1722),s=n(5380),l=[new a(">=0.0.0-0")],u=[new a(">=0.0.0")],c=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===i){if(1===t.length&&t[0].semver===i)return!0;e=n.includePrerelease?l:u}if(1===t.length&&t[0].semver===i){if(n.includePrerelease)return!0;t=u}const r=new Set;let a,c,h,f,m,g,v;for(const t of e)">"===t.operator||">="===t.operator?a=d(a,t,n):"<"===t.operator||"<="===t.operator?c=p(c,t,n):r.add(t.semver);if(r.size>1)return null;if(a&&c){if(h=s(a.semver,c.semver,n),h>0)return null;if(0===h&&(">="!==a.operator||"<="!==c.operator))return null}for(const e of r){if(a&&!o(e,String(a),n))return null;if(c&&!o(e,String(c),n))return null;for(const r of t)if(!o(e,String(r),n))return!1;return!0}let b=!(!c||n.includePrerelease||!c.semver.prerelease.length)&&c.semver,y=!(!a||n.includePrerelease||!a.semver.prerelease.length)&&a.semver;b&&1===b.prerelease.length&&"<"===c.operator&&0===b.prerelease[0]&&(b=!1);for(const e of t){if(v=v||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,a)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),">"===e.operator||">="===e.operator){if(f=d(a,e,n),f===e&&f!==a)return!1}else if(">="===a.operator&&!o(a.semver,String(e),n))return!1;if(c)if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),"<"===e.operator||"<="===e.operator){if(m=p(c,e,n),m===e&&m!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),n))return!1;if(!e.operator&&(c||a)&&0!==h)return!1}return!(a&&g&&!c&&0!==h)&&(!(c&&v&&!a&&0!==h)&&(!y&&!b))},d=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new r(e,n),t=new r(t,n);let a=!1;e:for(const r of e.set){for(const e of t.set){const t=c(r,e,n);if(a=a||null!==t,t)continue e}if(a)return!1}return!0}},9482:(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},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=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 a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(a,o,s):a[o]=e[o]}a.default=e,n&&n.set(e,a);return a}(n(5959)),i=d(n(7842)),o=d(n(7256)),s=n(414),l=n(906),u=d(n(8100)),c=d(n(7222));function d(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){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(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 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 m(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){E(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){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,i=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){s=!0,a=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw a}}return i}(e,t)||v(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 v(e,t){if(e){if("string"==typeof e)return b(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)?b(e,t):void 0}}function b(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 y(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 w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function S(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,a=_(e);if(t){var i=_(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}(this,n)}}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C="react-grid-layout",R=!1;try{R=/firefox/i.test(navigator.userAgent)}catch(e){}var O=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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(d,e);var t,n,r,c=S(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return E(x(e=c.call.apply(c,[this].concat(n))),"state",{activeDrag:null,layout:(0,s.synchronizeLayoutWithChildren)(e.props.layout,e.props.children,e.props.cols,(0,s.compactType)(e.props),e.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,droppingDOMNode:null,children:[]}),E(x(e),"dragEnterCounter",0),E(x(e),"onDragStart",function(t,n,r,a){var i=a.e,o=a.node,l=e.state.layout,u=(0,s.getLayoutItem)(l,t);if(u)return e.setState({oldDragItem:(0,s.cloneLayoutItem)(u),oldLayout:l}),e.props.onDragStart(l,u,u,null,i,o)}),E(x(e),"onDrag",function(t,n,r,a){var i=a.e,o=a.node,l=e.state.oldDragItem,u=e.state.layout,c=e.props,d=c.cols,p=c.allowOverlap,h=c.preventCollision,f=(0,s.getLayoutItem)(u,t);if(f){var m={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:t};u=(0,s.moveElement)(u,f,n,r,!0,h,(0,s.compactType)(e.props),d,p),e.props.onDrag(u,l,f,m,i,o),e.setState({layout:p?u:(0,s.compact)(u,(0,s.compactType)(e.props),d),activeDrag:m})}}),E(x(e),"onDragStop",function(t,n,r,a){var i=a.e,o=a.node;if(e.state.activeDrag){var l=e.state.oldDragItem,u=e.state.layout,c=e.props,d=c.cols,p=c.preventCollision,h=c.allowOverlap,f=(0,s.getLayoutItem)(u,t);if(f){u=(0,s.moveElement)(u,f,n,r,!0,p,(0,s.compactType)(e.props),d,h),e.props.onDragStop(u,l,f,null,i,o);var m=h?u:(0,s.compact)(u,(0,s.compactType)(e.props),d),g=e.state.oldLayout;e.setState({activeDrag:null,layout:m,oldDragItem:null,oldLayout:null}),e.onLayoutMaybeChanged(m,g)}}}),E(x(e),"onResizeStart",function(t,n,r,a){var i=a.e,o=a.node,l=e.state.layout,u=(0,s.getLayoutItem)(l,t);u&&(e.setState({oldResizeItem:(0,s.cloneLayoutItem)(u),oldLayout:e.state.layout}),e.props.onResizeStart(l,u,u,null,i,o))}),E(x(e),"onResize",function(t,n,r,a){var i=a.e,o=a.node,l=e.state,u=l.layout,c=l.oldResizeItem,d=e.props,p=d.cols,h=d.preventCollision,f=d.allowOverlap,v=(0,s.withLayoutItem)(u,t,function(e){var t;if(h&&!f){var a=(0,s.getAllCollisions)(u,m(m({},e),{},{w:n,h:r})).filter(function(t){return t.i!==e.i});if(t=a.length>0){var i=1/0,o=1/0;a.forEach(function(t){t.x>e.x&&(i=Math.min(i,t.x)),t.y>e.y&&(o=Math.min(o,t.y))}),Number.isFinite(i)&&(e.w=i-e.x),Number.isFinite(o)&&(e.h=o-e.y)}}return t||(e.w=n,e.h=r),e}),b=g(v,2),y=b[0],w=b[1];if(w){var S={w:w.w,h:w.h,x:w.x,y:w.y,static:!0,i:t};e.props.onResize(y,c,w,S,i,o),e.setState({layout:f?y:(0,s.compact)(y,(0,s.compactType)(e.props),p),activeDrag:S})}}),E(x(e),"onResizeStop",function(t,n,r,a){var i=a.e,o=a.node,l=e.state,u=l.layout,c=l.oldResizeItem,d=e.props,p=d.cols,h=d.allowOverlap,f=(0,s.getLayoutItem)(u,t);e.props.onResizeStop(u,c,f,null,i,o);var m=h?u:(0,s.compact)(u,(0,s.compactType)(e.props),p),g=e.state.oldLayout;e.setState({activeDrag:null,layout:m,oldResizeItem:null,oldLayout:null}),e.onLayoutMaybeChanged(m,g)}),E(x(e),"onDragOver",function(t){var n;if(t.preventDefault(),t.stopPropagation(),R&&(null===(n=t.nativeEvent.target)||void 0===n||!n.classList.contains(C)))return!1;var r=e.props,i=r.droppingItem,o=r.onDropDragOver,s=r.margin,u=r.cols,c=r.rowHeight,d=r.maxRows,p=r.width,f=r.containerPadding,g=r.transformScale,v=null==o?void 0:o(t);if(!1===v)return e.state.droppingDOMNode&&e.removeDroppingPlaceholder(),!1;var b=m(m({},i),v),y=e.state.layout,w=t.nativeEvent,S=w.layerX,x=w.layerY,_={left:S/g,top:x/g,e:t};if(e.state.droppingDOMNode){if(e.state.droppingPosition){var E=e.state.droppingPosition,O=E.left,T=E.top;(O!=S||T!=x)&&e.setState({droppingPosition:_})}}else{var D={cols:u,margin:s,maxRows:d,rowHeight:c,containerWidth:p,containerPadding:f||s},k=(0,l.calcXY)(D,x,S,b.w,b.h);e.setState({droppingDOMNode:a.createElement("div",{key:b.i}),droppingPosition:_,layout:[].concat(h(y),[m(m({},b),{},{x:k.x,y:k.y,static:!1,isDraggable:!0})])})}}),E(x(e),"removeDroppingPlaceholder",function(){var t=e.props,n=t.droppingItem,r=t.cols,a=e.state.layout,i=(0,s.compact)(a.filter(function(e){return e.i!==n.i}),(0,s.compactType)(e.props),r);e.setState({layout:i,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),E(x(e),"onDragLeave",function(t){t.preventDefault(),t.stopPropagation(),e.dragEnterCounter--,0===e.dragEnterCounter&&e.removeDroppingPlaceholder()}),E(x(e),"onDragEnter",function(t){t.preventDefault(),t.stopPropagation(),e.dragEnterCounter++}),E(x(e),"onDrop",function(t){t.preventDefault(),t.stopPropagation();var n=e.props.droppingItem,r=e.state.layout,a=r.find(function(e){return e.i===n.i});e.dragEnterCounter=0,e.removeDroppingPlaceholder(),e.props.onDrop(r,a,t)}),e}return t=d,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),e.allowOverlap),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:"onLayoutMaybeChanged",value:function(e,t){t||(t=this.state.layout),(0,i.default)(t,e)||this.props.onLayoutChange(e)}},{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,o=t.containerPadding,s=t.rowHeight,l=t.maxRows,c=t.useCSSTransforms,d=t.transformScale;return a.createElement(u.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:o||i,maxRows:l,rowHeight:s,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:c,transformScale:d},a.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,o=r.cols,l=r.margin,c=r.containerPadding,d=r.rowHeight,p=r.maxRows,h=r.isDraggable,f=r.isResizable,m=r.isBounded,g=r.useCSSTransforms,v=r.transformScale,b=r.draggableCancel,y=r.draggableHandle,w=r.resizeHandles,S=r.resizeHandle,x=this.state,_=x.mounted,E=x.droppingPosition,C="boolean"==typeof n.isDraggable?n.isDraggable:!n.static&&h,R="boolean"==typeof n.isResizable?n.isResizable:!n.static&&f,O=n.resizeHandles||w,T=C&&m&&!1!==n.isBounded;return a.createElement(u.default,{containerWidth:i,cols:o,margin:l,containerPadding:c||l,maxRows:p,rowHeight:d,cancel:b,handle:y,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:C,isResizable:R,isBounded:T,useCSSTransforms:g&&_,usePercentages:!_,transformScale:v,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?E:void 0,resizeHandles:O,resizeHandle:S},e)}}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,r=t.style,i=t.isDroppable,l=t.innerRef,u=(0,o.default)(C,n),c=m({height:this.containerHeight()},r);return a.createElement("div",{ref:l,className:u,style:c,onDrop:i?this.onDrop:s.noop,onDragLeave:i?this.onDragLeave:s.noop,onDragEnter:i?this.onDragEnter:s.noop,onDragOver:i?this.onDragOver:s.noop},a.Children.map(this.props.children,function(t){return e.processGridItem(t)}),i&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}])&&y(t.prototype,n),r&&y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),d}(a.Component);t.default=O,E(O,"displayName","ReactGridLayout"),E(O,"propTypes",c.default),E(O,"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,allowOverlap:!1,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,onDropDragOver:s.noop})},9524:(e,t,n)=>{"use strict";const r=Symbol("SemVer ANY");class a{static get ANY(){return r}constructor(e,t){if(t=i(t),e instanceof a){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?o[s.COMPARATORLOOSE]:o[s.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new c(n[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof a))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):(!(t=i(t)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}e.exports=a;const i=n(7095),{safeRe:o,t:s}=n(6850),l=n(3811),u=n(9796),c=n(7944),d=n(8395)},9613:(e,t,n)=>{"use strict";const r=n(5860);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},9630:e=>{"use strict";const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},9796:e=>{"use strict";const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},9954:(e,t,n)=>{"use strict";t.__esModule=!0,t.cloneElement=function(e,t){t.style&&e.props.style&&(t.style=o(o({},e.props.style),t.style));t.className&&e.props.className&&(t.className=e.props.className+" "+t.className);return a.default.cloneElement(e,t)};var r,a=(r=n(5959))&&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 o(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=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}}}]);
//# sourceMappingURL=751.js.map?_cache=62c0e08c8d3642ab137d