Files
server/opt/monitoring/grafana/plugins/grafana-lokiexplore-app/489.js
2025-12-22 11:03:43 +00:00

3 lines
535 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 489.js.LICENSE.txt */
(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[489],{219:(e,t,n)=>{(()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};function a(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return(t>>>0).toString(16)}t.r(r),t.d(r,{ASSISTANT_PLUGIN_ID:()=>z,ASSISTANT_PLUGIN_TITLE:()=>B,CALLBACK_EXTENSION_POINT:()=>V,ComponentNodeData:()=>S,DashboardNodeData:()=>_,DatasourceNodeData:()=>R,EntityNodeData:()=>O,FolderNodeData:()=>C,LabelNameNodeData:()=>k,LabelValueNodeData:()=>D,OpenAssistantButton:()=>gt,StructuredNodeData:()=>o,closeAssistant:()=>K,createAssistantContextItem:()=>I,getExposeAssistantFunctionsConfig:()=>j,isAssistantAvailable:()=>U,newFunctionNamespace:()=>$,openAssistant:()=>Q,provideComponents:()=>E,providePageContext:()=>g,provideQuestions:()=>P,toggleAssistant:()=>Y,useAssistant:()=>X,usePageComponents:()=>x,usePageContext:()=>b,useProvidePageContext:()=>v,useProvideQuestions:()=>L,useQuestions:()=>M});class i{constructor(e){this.params=e,this.text="",this.id=a(e.id),this.type=e.type}formatForLLM(e){var t,n;return{type:this.type,codeElementIds:e,data:{name:null!==(t=this.params.text)&&void 0!==t?t:"",text:null!==(n=this.params.text)&&void 0!==n?n:""}}}equals(e){return e instanceof i&&this.id===e.id&&this.type===e.type}}class o extends i{constructor(e){super({...e,id:a(JSON.stringify(e.data)),type:"structured"}),this.data=e.data}formatForLLM(e){return{type:this.type,codeElementIds:e,data:this.data}}}const s=n(8531),l=n(5959);var u=t.n(l);const c=[],d="grafana-assistant:page-context-sync",p="grafana-assistant:page-context-update",h="grafana-assistant:page-context-remove",f="grafana-assistant:location-changed";let m=!1;function g(e,t){const n={id:y(),urlPattern:e,context:[...t]};c.push(n),window.dispatchEvent(new CustomEvent(p,{detail:n})),window.dispatchEvent(new CustomEvent(d,{detail:{registry:c}}));const r=e=>{const t=c.findIndex(e=>e.id===n.id);-1!==t&&(c[t].context=[...e],window.dispatchEvent(new CustomEvent(p,{detail:c[t]})))};return r.unregister=()=>{const e=c.findIndex(e=>e.id===n.id);-1!==e&&(c.splice(e,1),window.dispatchEvent(new CustomEvent(h,{detail:{id:n.id}})))},r}function v(e,t=[]){const n=(0,l.useRef)(void 0),r=(0,l.useRef)(t);return r.current=t,(0,l.useEffect)(()=>(n.current=g(e,r.current),()=>{var e;null===(e=n.current)||void 0===e||e.unregister()}),[e]),(0,l.useEffect)(()=>{n.current&&n.current(t)},[t]),(0,l.useCallback)(e=>{var t;null===(t=n.current)||void 0===t||t.call(n,e)},[])}function b(e={allowQuestions:!1,allowComponents:!1}){const[t,n]=(0,l.useState)([]),r=(0,s.useLocationService)(),a=(0,l.useRef)("");(0,l.useEffect)(()=>{const e=()=>{const e=function(e,t){if(!e)return[];const n=[];for(const r of t)w(e,r.urlPattern)&&n.push(...r.context);return n}(r.getLocation().pathname,c);n(e)},t=()=>{e()},i=t=>{var n;const a=null===(n=t.detail)||void 0===n?void 0:n.pathname;a&&a===r.getLocation().pathname&&e()},o=r.getLocationObservable().subscribe(t=>{const n=t.pathname;n!==a.current&&(a.current=n,function(e){window.dispatchEvent(new CustomEvent(f,{detail:{pathname:e}}))}(n),e())});return e(),window.addEventListener(d,t),window.addEventListener(p,t),window.addEventListener(h,t),window.addEventListener(f,i),()=>{o.unsubscribe(),window.removeEventListener(d,t),window.removeEventListener(p,t),window.removeEventListener(h,t),window.removeEventListener(f,i)}},[r]);let i=t;return e.allowQuestions||(i=i.filter(e=>{var t;return"question"!==(null===(t=e.node.data)||void 0===t?void 0:t.type)})),e.allowComponents||(i=i.filter(e=>{var t;return"component"!==(null===(t=e.node.data)||void 0===t?void 0:t.type)})),i}function y(e="page-context"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function w(e,t){if(t instanceof RegExp)return t.test(e);if("string"==typeof t){const n=t.replace(/\*\*/g,"\0DOUBLE_STAR\0").replace(/\*/g,"[^/]*").replace(/\u0000DOUBLE_STAR\u0000/g,".*").replace(/\?/g,".");return new RegExp(`^${n}$`).test(e)}return!1}m||(window.addEventListener(d,e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.registry;if(n){const e=new Set(c.map(e=>e.id)),t=n.filter(t=>!e.has(t.id));c.push(...t)}}),window.addEventListener(p,e=>{const t=e.detail;if(t){const e=c.findIndex(e=>e.id===t.id);-1!==e?c[e]=t:c.push(t)}}),window.addEventListener(h,e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.id;if(n){const e=c.findIndex(e=>e.id===n);-1!==e&&c.splice(e,1)}}),m=!0);class S extends i{constructor(e){const t=e.namespace||"components";super({...e,id:`${t}-${Object.keys(e.components).join("-")}`,type:"component"}),this.components=e.components,this.prompt=e.prompt,this.namespace=t}formatForLLM(e){return{type:this.type,codeElementIds:e,data:{name:`${this.namespace} components`,prompt:this.prompt,namespace:this.namespace}}}}function x(){const e=b({allowComponents:!0,allowQuestions:!1});return(0,l.useMemo)(()=>{const t={};return e.filter(e=>{var t;return null===(t=e.node.data)||void 0===t?void 0:t.components}).forEach(e=>{const n=e.node.data;if(null==n?void 0:n.components){const e=n.namespace||n.name||"components";Object.entries(n.components).forEach(([n,r])=>{t[`${e}_${n}`]=r})}}),t},[e])}function E(e,t,n,r=/.*/){return g(r,[I("component",{components:n,prompt:e,namespace:t})])}class _ extends i{constructor(e){super({...e,id:e.dashboardUid,type:"dashboard"}),this.dashboardUid=e.dashboardUid,this.dashboardTitle=e.dashboardTitle,this.folderUid=e.folderUid,this.folderTitle=e.folderTitle,this.text=e.dashboardTitle}formatForLLM(e){return{type:this.type,codeElementIds:e,data:{name:this.dashboardTitle,dashboardUid:this.dashboardUid,dashboardTitle:this.dashboardTitle,folderUid:this.folderUid,folderTitle:this.folderTitle,text:this.text}}}}class C extends i{constructor(e){super({...e,id:e.folderUid,type:"dashboard_folder"}),this.text="",this.folderUid=e.folderUid,this.folderTitle=e.folderTitle,this.text=e.folderTitle}formatForLLM(e){return{type:this.type,codeElementIds:e,data:{name:this.folderTitle,folderUid:this.folderUid,folderTitle:this.folderTitle,text:this.text}}}}class R extends i{constructor(e){super({...e,id:e.datasourceUid,type:"datasource"}),this.datasourceUid=e.datasourceUid,this.datasourceType=e.datasourceType,this.datasourceName=e.datasourceName,this.img=e.img,this.text=e.datasourceName}formatForLLM(e){return{type:this.type,codeElementIds:e,data:{name:this.datasourceName,uid:this.datasourceUid,type:this.datasourceType,text:this.text,img:this.img}}}}class O extends i{constructor(e){var t,n,r;super({id:`${e.type}-${e.name}-${[null===(t=e.scope)||void 0===t?void 0:t.env,null===(n=e.scope)||void 0===n?void 0:n.site,null===(r=e.scope)||void 0===r?void 0:r.namespace].filter(Boolean).join("-")}`,type:"entity",title:e.title,hidden:e.hidden,img:e.img,icon:e.icon,text:e.name}),this.entityType=e.type,this.name=e.name,this.scope=e.scope,this.properties=e.properties,this.text=e.name}formatForLLM(e){return{type:"entity",codeElementIds:e,data:{name:this.name,text:this.text,type:this.entityType,scope:this.scope,properties:this.properties}}}}class k extends i{constructor(e){super({...e,id:`${e.datasourceUid}-${e.labelName}`,type:"label_name"}),this.datasourceUid=e.datasourceUid,this.datasourceType=e.datasourceType,this.datasourceName=e.datasourceName,this.labelName=e.labelName,this.text=e.labelName,this.img=e.img}formatForLLM(e){return{type:this.type,codeElementIds:e,data:{name:this.labelName,datasourceUid:this.datasourceUid,datasourceType:this.datasourceType,datasourceName:this.datasourceName,labelName:this.labelName,img:this.img,text:this.text}}}}class D extends i{constructor(e){super({...e,id:`${e.datasourceUid}-${e.labelName}-${e.labelValue}`,type:"label_value"}),this.datasourceUid=e.datasourceUid,this.datasourceType=e.datasourceType,this.datasourceName=e.datasourceName,this.labelName=e.labelName,this.labelValue=e.labelValue,this.text=e.labelValue,this.img=e.img}formatForLLM(e){return{type:this.type,codeElementIds:e,data:{name:this.labelValue,datasourceUid:this.datasourceUid,datasourceType:this.datasourceType,datasourceName:this.datasourceName,labelName:this.labelName,labelValue:this.labelValue,text:this.text,img:this.img}}}}function A(e){var t,n,r,a,i;const o=(0,s.getDataSourceSrv)().getInstanceSettings(e);return{datasourceType:null!==(t=null==o?void 0:o.type)&&void 0!==t?t:"unknown",datasourceName:null!==(n=null==o?void 0:o.name)&&void 0!==n?n:e,img:null===(i=null===(a=null===(r=null==o?void 0:o.meta)||void 0===r?void 0:r.info)||void 0===a?void 0:a.logos)||void 0===i?void 0:i.small}}const T={datasource:"database",label_name:"database",label_value:"database",dashboard:"dashboard",dashboard_folder:"folder",unknown:"circle-mono",structured:"gf-grid",component:"gf-grid",entity:"asserts"};function I(e,t){var n,r,a;const s=function(e,t){switch(e){case"datasource":return new R({...t,...A(t.datasourceUid)});case"label_name":return new k({...t,...A(t.datasourceUid)});case"label_value":return new D({...t,...A(t.datasourceUid)});case"dashboard":return new _(t);case"dashboard_folder":return new C(t);case"structured":return new o(t);case"component":return new S({...t,hidden:!0});case"entity":return new O(t);case"unknown":return new i(t);default:return console.error(`Unknown context type: ${e}`),new i(t)}}(e,t),l=null!==(n=t.title)&&void 0!==n?n:function(e){var t;return e instanceof o?e.formatForLLM().data.name:null!==(t=e.text)&&void 0!==t?t:"Given Context"}(s),u=null!==(r=t.img)&&void 0!==r?r:function(e){if("img"in e)return e.img}(s);return{node:{id:s.id,name:l,img:u,icon:null!==(a=t.icon)&&void 0!==a?a:T[e],navigable:!1,selectable:!0,data:s},occurrences:[]}}function P(e,t){const n=y("question"),r=e=>e.map((e,t)=>({node:{id:`question-${n}-${t}`,name:e.prompt,navigable:!1,selectable:!0,icon:"question-circle",data:{type:"question",prompt:e.prompt,context:e.context||[]}},occurrences:[]})),a=g(e,r(t)),i=e=>{a(r(e))};return i.unregister=a.unregister,i}function L(e,t=[]){const n=(0,l.useMemo)(()=>y("question"),[]),r=e=>e.map((e,t)=>({node:{id:`question-${n}-${t}`,name:e.prompt,navigable:!1,selectable:!0,icon:"question-circle",data:{type:"question",prompt:e.prompt,context:e.context||[]}},occurrences:[]})),a=v(e,r(t));return e=>{a(r(e))}}function M(){const e=b({allowQuestions:!0,allowComponents:!1});return N(e)}const N=e=>e.filter(e=>{var t;return"question"===(null===(t=e.node.data)||void 0===t?void 0:t.type)}).map(e=>{var t,n;return{prompt:(null===(t=e.node.data)||void 0===t?void 0:t.prompt)||e.node.name,context:(null===(n=e.node.data)||void 0===n?void 0:n.context)||[]}}),V="grafana-assistant-app/callback/v0-alpha";function $(e,t){return{namespace:e,functions:t}}function j(e){return{title:"callback",targets:[V],fn:()=>e.map(e=>({namespace:e.namespace,functions:e.functions}))}}const F=n(1269),z="grafana-assistant-app",B="Grafana Assistant";function U(){return s.getObservablePluginLinks?(0,s.getObservablePluginLinks)({extensionPointId:"grafana/extension-sidebar/v0-alpha"}).pipe((0,F.map)(e=>e.some(e=>e.pluginId===z&&e.title===B))):(0,F.of)(!1)}const W=n(7781);class H extends W.BusEventWithPayload{}H.type="open-extension-sidebar";class q extends W.BusEventBase{}q.type="close-extension-sidebar";class G extends W.BusEventWithPayload{}function Q(e){var t,n;(0,s.reportInteraction)("grafana_assistant_app_opened_sidebar",{from:e.origin,prompt:null!==(t=e.prompt)&&void 0!==t?t:""}),function(e,t,n){const r=new H({pluginId:e,componentTitle:t,props:n});(0,s.getAppEvents)().publish(r)}(z,B,{initialPrompt:e.prompt,initialContext:e.context,initialAutoSend:null===(n=e.autoSend)||void 0===n||n,origin:e.origin})}function K(){!function(){const e=new q;(0,s.getAppEvents)().publish(e)}()}function Y(e){var t,n;(0,s.reportInteraction)("grafana_assistant_app_toggled_sidebar",{from:e.origin,prompt:null!==(t=e.prompt)&&void 0!==t?t:""}),function(e,t,n){const r=new G({pluginId:e,componentTitle:t,props:n});(0,s.getAppEvents)().publish(r)}(z,B,{initialPrompt:e.prompt,initialContext:e.context,initialAutoSend:null===(n=e.autoSend)||void 0===n||n,origin:e.origin})}function X(){const[e,t]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{const e=U().subscribe(e=>t(e));return()=>{e.unsubscribe()}},[]),{isAvailable:e,openAssistant:e?Q:void 0,closeAssistant:e?K:void 0,toggleAssistant:e?Y:void 0}}G.type="toggle-extension-sidebar";const Z=n(2007);var J=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},e}(),ee=Math.abs,te=String.fromCharCode,ne=Object.assign;function re(e){return e.trim()}function ae(e,t,n){return e.replace(t,n)}function ie(e,t){return e.indexOf(t)}function oe(e,t){return 0|e.charCodeAt(t)}function se(e,t,n){return e.slice(t,n)}function le(e){return e.length}function ue(e){return e.length}function ce(e,t){return t.push(e),e}var de=1,pe=1,he=0,fe=0,me=0,ge="";function ve(e,t,n,r,a,i,o){return{value:e,root:t,parent:n,type:r,props:a,children:i,line:de,column:pe,length:o,return:""}}function be(e,t){return ne(ve("",null,null,"",null,null,0),e,{length:-e.length},t)}function ye(){return me=fe>0?oe(ge,--fe):0,pe--,10===me&&(pe=1,de--),me}function we(){return me=fe<he?oe(ge,fe++):0,pe++,10===me&&(pe=1,de++),me}function Se(){return oe(ge,fe)}function xe(){return fe}function Ee(e,t){return se(ge,e,t)}function _e(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ce(e){return de=pe=1,he=le(ge=e),fe=0,[]}function Re(e){return ge="",e}function Oe(e){return re(Ee(fe-1,Ae(91===e?e+2:40===e?e+1:e)))}function ke(e){for(;(me=Se())&&me<33;)we();return _e(e)>2||_e(me)>3?"":" "}function De(e,t){for(;--t&&we()&&!(me<48||me>102||me>57&&me<65||me>70&&me<97););return Ee(e,xe()+(t<6&&32==Se()&&32==we()))}function Ae(e){for(;we();)switch(me){case e:return fe;case 34:case 39:34!==e&&39!==e&&Ae(me);break;case 40:41===e&&Ae(e);break;case 92:we()}return fe}function Te(e,t){for(;we()&&e+me!==57&&(e+me!==84||47!==Se()););return"/*"+Ee(t,fe-1)+"*"+te(47===e?e:we())}function Ie(e){for(;!_e(Se());)we();return Ee(e,fe)}var Pe="-ms-",Le="-moz-",Me="-webkit-",Ne="comm",Ve="rule",$e="decl",je="@keyframes";function Fe(e,t){for(var n="",r=ue(e),a=0;a<r;a++)n+=t(e[a],a,e,t)||"";return n}function ze(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case $e:return e.return=e.return||e.value;case Ne:return"";case je:return e.return=e.value+"{"+Fe(e.children,r)+"}";case Ve:e.value=e.props.join(",")}return le(n=Fe(e.children,r))?e.return=e.value+"{"+n+"}":""}function Be(e){return Re(Ue("",null,null,null,[""],e=Ce(e),0,[0],e))}function Ue(e,t,n,r,a,i,o,s,l){for(var u=0,c=0,d=o,p=0,h=0,f=0,m=1,g=1,v=1,b=0,y="",w=a,S=i,x=r,E=y;g;)switch(f=b,b=we()){case 40:if(108!=f&&58==oe(E,d-1)){-1!=ie(E+=ae(Oe(b),"&","&\f"),"&\f")&&(v=-1);break}case 34:case 39:case 91:E+=Oe(b);break;case 9:case 10:case 13:case 32:E+=ke(f);break;case 92:E+=De(xe()-1,7);continue;case 47:switch(Se()){case 42:case 47:ce(He(Te(we(),xe()),t,n),l);break;default:E+="/"}break;case 123*m:s[u++]=le(E)*v;case 125*m:case 59:case 0:switch(b){case 0:case 125:g=0;case 59+c:-1==v&&(E=ae(E,/\f/g,"")),h>0&&le(E)-d&&ce(h>32?qe(E+";",r,n,d-1):qe(ae(E," ","")+";",r,n,d-2),l);break;case 59:E+=";";default:if(ce(x=We(E,t,n,u,c,a,s,y,w=[],S=[],d),i),123===b)if(0===c)Ue(E,t,x,x,w,i,d,s,S);else switch(99===p&&110===oe(E,3)?100:p){case 100:case 108:case 109:case 115:Ue(e,x,x,r&&ce(We(e,x,x,0,0,a,s,y,a,w=[],d),S),a,S,d,s,r?w:S);break;default:Ue(E,x,x,x,[""],S,0,s,S)}}u=c=h=0,m=v=1,y=E="",d=o;break;case 58:d=1+le(E),h=f;default:if(m<1)if(123==b)--m;else if(125==b&&0==m++&&125==ye())continue;switch(E+=te(b),b*m){case 38:v=c>0?1:(E+="\f",-1);break;case 44:s[u++]=(le(E)-1)*v,v=1;break;case 64:45===Se()&&(E+=Oe(we())),p=Se(),c=d=le(y=E+=Ie(xe())),b++;break;case 45:45===f&&2==le(E)&&(m=0)}}return i}function We(e,t,n,r,a,i,o,s,l,u,c){for(var d=a-1,p=0===a?i:[""],h=ue(p),f=0,m=0,g=0;f<r;++f)for(var v=0,b=se(e,d+1,d=ee(m=o[f])),y=e;v<h;++v)(y=re(m>0?p[v]+" "+b:ae(b,/&\f/g,p[v])))&&(l[g++]=y);return ve(e,t,n,0===a?Ve:s,l,u,c)}function He(e,t,n){return ve(e,t,n,Ne,te(me),se(e,2,-2),0)}function qe(e,t,n,r){return ve(e,t,n,$e,se(e,0,r),se(e,r+1,-1),r)}var Ge=function(e,t,n){for(var r=0,a=0;r=a,a=Se(),38===r&&12===a&&(t[n]=1),!_e(a);)we();return Ee(e,fe)},Qe=new WeakMap,Ke=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Qe.get(n))&&!r){Qe.set(e,!0);for(var a=[],i=function(e,t){return Re(function(e,t){var n=-1,r=44;do{switch(_e(r)){case 0:38===r&&12===Se()&&(t[n]=1),e[n]+=Ge(fe-1,t,n);break;case 2:e[n]+=Oe(r);break;case 4:if(44===r){e[++n]=58===Se()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=te(r)}}while(r=we());return e}(Ce(e),t))}(t,a),o=n.props,s=0,l=0;s<i.length;s++)for(var u=0;u<o.length;u++,l++)e.props[l]=a[s]?i[s].replace(/&\f/g,o[u]):o[u]+" "+i[s]}}},Ye=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Xe(e,t){switch(function(e,t){return 45^oe(e,0)?(((t<<2^oe(e,0))<<2^oe(e,1))<<2^oe(e,2))<<2^oe(e,3):0}(e,t)){case 5103:return Me+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Me+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Me+e+Le+e+Pe+e+e;case 6828:case 4268:return Me+e+Pe+e+e;case 6165:return Me+e+Pe+"flex-"+e+e;case 5187:return Me+e+ae(e,/(\w+).+(:[^]+)/,Me+"box-$1$2"+Pe+"flex-$1$2")+e;case 5443:return Me+e+Pe+"flex-item-"+ae(e,/flex-|-self/,"")+e;case 4675:return Me+e+Pe+"flex-line-pack"+ae(e,/align-content|flex-|-self/,"")+e;case 5548:return Me+e+Pe+ae(e,"shrink","negative")+e;case 5292:return Me+e+Pe+ae(e,"basis","preferred-size")+e;case 6060:return Me+"box-"+ae(e,"-grow","")+Me+e+Pe+ae(e,"grow","positive")+e;case 4554:return Me+ae(e,/([^-])(transform)/g,"$1"+Me+"$2")+e;case 6187:return ae(ae(ae(e,/(zoom-|grab)/,Me+"$1"),/(image-set)/,Me+"$1"),e,"")+e;case 5495:case 3959:return ae(e,/(image-set\([^]*)/,Me+"$1$`$1");case 4968:return ae(ae(e,/(.+:)(flex-)?(.*)/,Me+"box-pack:$3"+Pe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Me+e+e;case 4095:case 3583:case 4068:case 2532:return ae(e,/(.+)-inline(.+)/,Me+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(le(e)-1-t>6)switch(oe(e,t+1)){case 109:if(45!==oe(e,t+4))break;case 102:return ae(e,/(.+:)(.+)-([^]+)/,"$1"+Me+"$2-$3$1"+Le+(108==oe(e,t+3)?"$3":"$2-$3"))+e;case 115:return~ie(e,"stretch")?Xe(ae(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==oe(e,t+1))break;case 6444:switch(oe(e,le(e)-3-(~ie(e,"!important")&&10))){case 107:return ae(e,":",":"+Me)+e;case 101:return ae(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Me+(45===oe(e,14)?"inline-":"")+"box$3$1"+Me+"$2$3$1"+Pe+"$2box$3")+e}break;case 5936:switch(oe(e,t+11)){case 114:return Me+e+Pe+ae(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Me+e+Pe+ae(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Me+e+Pe+ae(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Me+e+Pe+e+e}return e}var Ze=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case $e:e.return=Xe(e.value,e.length);break;case je:return Fe([be(e,{value:ae(e.value,"@","@"+Me)})],r);case Ve:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,function(t){switch(function(e){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return Fe([be(e,{props:[ae(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Fe([be(e,{props:[ae(t,/:(plac\w+)/,":"+Me+"input-$1")]}),be(e,{props:[ae(t,/:(plac\w+)/,":-moz-$1")]}),be(e,{props:[ae(t,/:(plac\w+)/,Pe+"input-$1")]})],r)}return""})}}],Je={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var et=/[A-Z]|^ms/g,tt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,nt=function(e){return 45===e.charCodeAt(1)},rt=function(e){return null!=e&&"boolean"!=typeof e},at=function(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}(function(e){return nt(e)?e:e.replace(et,"-$&").toLowerCase()}),it=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(tt,function(e,t,n){return st={name:t,styles:n,next:st},t})}return 1===Je[e]||nt(e)||"number"!=typeof t||0===t?t:t+"px"};function ot(e,t,n){if(null==n)return"";var r=n;if(void 0!==r.__emotion_styles)return r;switch(typeof n){case"boolean":return"";case"object":var a=n;if(1===a.anim)return st={name:a.name,styles:a.styles,next:st},a.name;var i=n;if(void 0!==i.styles){var o=i.next;if(void 0!==o)for(;void 0!==o;)st={name:o.name,styles:o.styles,next:st},o=o.next;return i.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var a=0;a<n.length;a++)r+=ot(e,t,n[a])+";";else for(var i in n){var o=n[i];if("object"!=typeof o){var s=o;null!=t&&void 0!==t[s]?r+=i+"{"+t[s]+"}":rt(s)&&(r+=at(i)+":"+it(i,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=t&&void 0!==t[o[0]]){var l=ot(e,t,o);switch(i){case"animation":case"animationName":r+=at(i)+":"+l+";";break;default:r+=i+"{"+l+"}"}}else for(var u=0;u<o.length;u++)rt(o[u])&&(r+=at(i)+":"+it(i,o[u])+";")}return r}(e,t,n);case"function":if(void 0!==e){var s=st,l=n(e);return st=s,ot(e,t,l)}}var u=n;if(null==t)return u;var c=t[u];return void 0!==c?c:u}var st,lt=/label:\s*([^\s;{]+)\s*(;|$)/g;function ut(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,a="";st=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,a+=ot(n,t,i)):a+=i[0];for(var o=1;o<e.length;o++)a+=ot(n,t,e[o]),r&&(a+=i[o]);lt.lastIndex=0;for(var s,l="";null!==(s=lt.exec(a));)l+="-"+s[1];var u=function(e){for(var t,n=0,r=0,a=e.length;a>=4;++r,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+l;return{name:u,styles:a,next:st}}function ct(e,t,n){var r="";return n.split(" ").forEach(function(n){void 0!==e[n]?t.push(e[n]+";"):n&&(r+=n+" ")}),r}function dt(e,t){if(void 0===e.inserted[t.name])return e.insert("",t,e.sheet,!0)}function pt(e,t,n){var r=[],a=ct(e,r,n);return r.length<2?n:a+t(r)}var ht=function e(t){for(var n="",r=0;r<t.length;r++){var a=t[r];if(null!=a){var i=void 0;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=e(a);else for(var o in i="",a)a[o]&&o&&(i&&(i+=" "),i+=o);break;default:i=a}i&&(n&&(n+=" "),n+=i)}}return n},ft=function(){var e=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var r,a,i=e.stylisPlugins||Ze,o={},s=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)o[t[n]]=!0;s.push(e)});var l,u,c,d,p=[ze,(d=function(e){l.insert(e)},function(e){e.root||(e=e.return)&&d(e)})],h=(u=[Ke,Ye].concat(i,p),c=ue(u),function(e,t,n,r){for(var a="",i=0;i<c;i++)a+=u[i](e,t,n,r)||"";return a});a=function(e,t,n,r){l=n,Fe(Be(e?e+"{"+t.styles+"}":t.styles),h),r&&(f.inserted[t.name]=!0)};var f={key:t,sheet:new J({key:t,container:r,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:o,registered:{},insert:a};return f.sheet.hydrate(s),f}({key:"css"});e.sheet.speedy=function(e){this.isSpeedy=e},e.compat=!0;var t=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=ut(n,e.registered,void 0);return function(e,t){!function(e,t){var n=e.key+"-"+t.name;void 0===e.registered[n]&&(e.registered[n]=t.styles)}(e,t);var n=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var r=t;do{e.insert(t===r?"."+n:"",r,e.sheet,!0),r=r.next}while(void 0!==r)}}(e,a),e.key+"-"+a.name};return{css:t,cx:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pt(e.registered,t,ht(r))},injectGlobal:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=ut(n,e.registered);dt(e,a)},keyframes:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=ut(n,e.registered),i="animation-"+a.name;return dt(e,{name:a.name,styles:"@keyframes "+i+"{"+a.styles+"}"}),i},hydrate:function(t){t.forEach(function(t){e.inserted[t]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:ct.bind(null,e.registered),merge:pt.bind(null,e.registered,t)}}(),mt=(ft.flush,ft.hydrate,ft.cx,ft.merge,ft.getRegisteredStyles,ft.injectGlobal,ft.keyframes,ft.css);function gt(e){const{isAvailable:t,openAssistant:n}=X();return t&&n?u().createElement(vt,{...e,openAssistant:n}):null}function vt({prompt:e,origin:t,context:n,autoSend:r=!0,title:a="Analyze with Assistant",size:i="sm",iconOnlyButton:o=!1,openAssistant:c}){const d=(0,Z.useStyles2)(bt);return(0,l.useEffect)(()=>{(0,s.reportInteraction)("grafana_assistant_app_open_sidebar_button_displayed",{from:t})},[t]),u().createElement(u().Fragment,null,o?u().createElement(Z.IconButton,{name:"ai-sparkle",onClick:()=>c({prompt:e,context:n,autoSend:r,origin:t}),variant:"secondary",size:i,"aria-label":a,className:d.icon,tooltip:a,"data-testid":"assistant-icon-button"}):u().createElement(Z.Button,{icon:"ai-sparkle",onClick:()=>c({prompt:e,context:n,autoSend:r,origin:t}),variant:"secondary",fill:"solid",size:i,title:a,"aria-label":a,className:d.button,"data-testid":"assistant-button"},a))}ft.sheet,ft.cache;const bt=e=>{const t=e.colors.secondary.main,n=e.colors.emphasize(t,.05),r=e.colors.background.canvas,a=e.shape.radius.default,i=`max(calc(${a} - 1px), 1px)`,o={content:'""',position:"absolute",inset:0,borderRadius:a,background:"linear-gradient(90deg, rgb(168, 85, 247), rgb(249, 115, 22))",zIndex:-2,pointerEvents:"none"},s=e=>({content:'""',position:"absolute",inset:"1px",borderRadius:i,background:`linear-gradient(${e}, ${e}), ${r}`,zIndex:-1,transition:"none",pointerEvents:"none"});return{button:mt({label:"assistant-button",position:"relative",isolation:"isolate",border:"none",transition:"none !important","&::before":o,"&::after":{...s(t),transition:"none"},"&:hover":{transition:"none !important"},"&:hover::after":{background:`linear-gradient(${n}, ${n}), ${r}`}}),icon:mt({label:"assistant-icon",position:"relative",isolation:"isolate",border:"none",background:"none",padding:e.spacing(.5),"&::before":{...o,transition:"background 0.1s ease"},"&:hover::after":{...s(t),background:`linear-gradient(${n}, ${n}), ${r}`}})}};e.exports=r})()},5366:(e,t,n)=>{"use strict";n.d(t,{H9:()=>Co,Zx:()=>Wt,yP:()=>Du,mI:()=>Au,P1:()=>Ku,OS:()=>Wd,No:()=>Qd,WY:()=>_t,n8:()=>Ae,d0:()=>Gd,UU:()=>k,Oh:()=>Hc,jD:()=>id,xK:()=>$c,gF:()=>Vc,N0:()=>Pc,Zv:()=>N,Es:()=>gl,vA:()=>Mc,G1:()=>Lc,Bs:()=>E,So:()=>$,dt:()=>Vo,dM:()=>Kc,WM:()=>_c,KE:()=>bc,JZ:()=>Y,Pj:()=>Ru,oh:()=>ne,$L:()=>Qu,Sh:()=>rs,Lp:()=>xu,Eb:()=>vl,Lw:()=>Xu,Gg:()=>r,jh:()=>Ds,Go:()=>Kd,TG:()=>Qc});var r={};n.r(r),n.d(r,{K2:()=>Fs});var a=n(1159),i=n(7781),o=n(8531);function s(e,t,n){const r={...t};if(n)for(const e of Object.keys(r))n.includes(e)||delete r[e];return i.urlUtil.renderUrl(i.locationUtil.assureBaseUrl(e),r)}function l(e){const t=(0,a.useParams)(),n=(0,a.useLocation)();return{params:t,isExact:null!==(0,a.matchPath)({path:e,caseSensitive:!1,end:!0},n.pathname),path:n.pathname,url:n.pathname}}const u=new Map;var c=n(5959),d=n.t(c,2),p=n.n(c),h=n(1269),f=n(5745);const m=p().memo(function({model:e,...t}){var n;const r=null!=(n=e.constructor.Component)?n:g,[a,i]=(0,c.useState)(0);return(0,c.useEffect)(()=>{const t=e.activate();return i(e=>e+1),t},[e]),e.isActive||e.renderBeforeActivation?p().createElement(r,{...t,model:e}):null});function g(e){return null}class v extends i.BusEventWithPayload{}v.type="scene-object-state-change";class b extends i.BusEventWithPayload{}b.type="scene-object-user-action";var y,w=e=>{throw TypeError(e)},S=(e,t,n)=>t.has(e)||w("Cannot "+n);class x{constructor(e){var t,n,r;t=this,(n=y).has(t)?w("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,r),((e,t,n)=>{S(e,t,"write to private field"),t.set(e,n)})(this,y,e)}resolve(){return S(e=this,t=y,"read from private field"),n?n.call(e):t.get(e);var e,t,n}}y=new WeakMap;class E{constructor(e){this._isActive=!1,this._activationHandlers=[],this._deactivationHandlers=new Map,this._subs=new h.Subscription,this._refCount=0,this._renderBeforeActivation=!1,e.key||(e.key=(0,f.A)()),this._events=new i.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 m}_setParent(e){C(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(v,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 v({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 E)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 h.Subscription}useState(){return _(this)}forceRender(){this.setState({})}clone(e){return function(e,t){const n=O(e.state,t);return new e.constructor(n)}(this,e)}addActivationHandler(e){this._activationHandlers.push(e)}forEachChild(e){C(this.state,e)}getRef(){return this._ref||(this._ref=new x(this)),this._ref}toJSON(){return{type:Object.getPrototypeOf(this).constructor.name,isActive:this.isActive,state:this.state}}}function _(e,t){var n;const[r,a]=(0,c.useState)(e.state),i=e.state,o=null!=(n=null==t?void 0:t.shouldActivateOrKeepAlive)&&n;return(0,c.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 C(e,t){for(const n of Object.values(e)){if(n instanceof E){if(!1===t(n))break}if(Array.isArray(n)){let e=!1;for(const r of n)if(r instanceof E){if(!1===t(r)){e=!0;break}}if(e)break}}}var R=n(3241);function O(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 x)console.warn("Cloning object with SceneObjectRef");else if(r instanceof E)n[e]=r.clone();else if(Array.isArray(r)){const t=[];for(const e of r)e instanceof E?t.push(e.clone()):"object"==typeof e?t.push((0,R.cloneDeep)(e)):t.push(e);n[e]=t}else n[e]="object"==typeof r?(0,R.cloneDeep)(r):r}return n}class k extends i.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:i.PluginType.datasource,info:{author:{name:""},description:"",links:[],logos:{large:"",small:""},screenshots:[],updated:"",version:""},module:"",baseUrl:""}})}testDatasource(){return Promise.resolve({})}}const D=new Map;function A(e,t){const n=t.state.$variables;if(!n)return t.parent?A(e,t.parent):null;const r=n.getByName(e);return r||(t.parent?A(e,t.parent):null)}function T(e,t,...n){let r=!1;"undefined"!=typeof window&&(r="true"===localStorage.getItem("grafana.debug.scenes"))}function I(e){return"isQueryController"in e}function P(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(I(e))return e;t=t.parent}}new WeakMap,new WeakMap;var L=n(1625);L.ob.Auto;var M=(e=>(e.NotStarted="NotStarted",e.Loading="Loading",e.Streaming="Streaming",e.Done="Done",e.Error="Error",e))(M||{});class N extends E{constructor(e){super({data:V,...e})}getResultsStream(){const e={origin:this,data:this.state.data};return(0,h.of)(e)}}const V={state:M.Done,series:[],timeRange:(0,i.getDefaultTimeRange)()};class ${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 j(e,t){let n,r=e;for(;r&&!n;)n=t(r),r=r.parent;return n}const F=/^\d+[yYmMsSwWhHdD]$/;function z(e){if("string"!=typeof e)return null;if(-1!==e.indexOf("now"))return e;if(F.test(e))return e;if(8===e.length){const t=(0,i.toUtc)(e,"YYYYMMDD");if(t.isValid())return t.toISOString()}else if(15===e.length){const t=(0,i.toUtc)(e,"YYYYMMDDTHHmmss");if(t.isValid())return t.toISOString()}else if(19===e.length){const t=(0,i.toUtc)(e,"YYYY-MM-DD HH:mm:ss");if(t.isValid())return t.toISOString()}else if(24===e.length){return(0,i.toUtc)(e).toISOString()}const t=parseInt(e,10);return isNaN(t)?null:(0,i.toUtc)(t).toISOString()}function B(e,t,n,r,a,o){const s=a&&"now"===t,l=Date.now();o&&function(e){e!==U&&(U=e,(0,i.setWeekStart)(e))}(o);const u=(e,t)=>i.dateMath.toDateTime?i.dateMath.toDateTime(e,t):i.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 U;function W(e,t,n){if((0,i.isDateTime)(e))return e.isValid();if(i.dateMath.isMathString(e))return i.dateMath.isValid(e);return(0,i.dateTimeParse)(e,{roundUp:t,timeZone:n}).isValid()}new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;const H="refresh",q="filter_removed",G="filter_changed",Q="variable_value_changed",K="groupby_dimensions";class Y extends E{constructor(e={}){var t;const n=e.from&&W(e.from)?e.from:"now-6h",r=e.to&&W(e.to)?e.to:"now",a=X(e.timeZone);super({from:n,to:r,timeZone:a,value:B(n,r,a||(0,i.getTimeZone)(),e.fiscalYearStartMonth,e.UNSAFE_nowDelay,e.weekStart),refreshOnActivate:null!=(t=e.refreshOnActivate)?t:{percent:10},...e}),this._urlSync=new $(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=B(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=P(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=X(e))?t:L.vp,r=B(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 o.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 i.rangeUtil.isRelativeTimeRange(this.state.value.raw)&&this.refreshIfStale(),()=>{this.state.weekStart&&(0,i.setWeekStart)(o.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=j(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=B(this.state.from,this.state.to,null!=(t=this.state.timeZone)?t:(0,i.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&&X(this.state.timeZone))return this.state.timeZone;const e=this.getTimeZoneSource();return e!==this&&X(e.state.timeZone)?e.state.timeZone:(0,i.getTimeZone)()}getUrlState(){const e=o.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 o=z(e.from),s=z(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):i.rangeUtil.intervalToMs(t);return{from:(0,i.toUtc)(n-r/2).toISOString(),to:(0,i.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&&W(t.from)&&(o=t.from),t.to&&W(t.to)&&(s=t.to)}if(o&&W(o)&&(a.from=o),s&&W(s)&&(a.to=s),"string"==typeof e.timezone&&(a.timeZone=""!==e.timezone?e.timezone:void 0),0!==Object.keys(a).length)return a.value=B(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 X(e){if(void 0!==e)return(0,R.isEmpty)(e)?o.config.bootData.user.timezone:e===L.vp||(0,i.getZone)(e)?e:void T()}const Z=new N,J=new Y;const ee=new class extends E{constructor(){super({variables:[]})}getByName(e){}isVariableLoadingOrWaitingToUpdate(e){return!1}};function te(e){var t;return null!=(t=j(e,e=>e.state.$timeRange))?t:J}class ne extends i.BusEventWithPayload{}function re(e){return"object"==typeof e&&"formatter"in e}ne.type="scene-variable-changed-value";let ae,ie={};function oe(e){const t=ie[e];return t||(ie[e]=(0,R.property)(e))}class se{constructor(e,t){this.state={name:e,value:t,type:"scopedvar"}}getValue(e){let{value:t}=this.state,n=t.value;return n=e?oe(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 le=n(5591);const ue=new i.Registry(()=>{const e=[{id:L.$m.Lucene,name:"Lucene",description:"Values are lucene escaped and multi-valued variables generate an OR expression",formatter:e=>{if("string"==typeof e)return ce(e);if(Array.isArray(e)){if(0===e.length)return"__empty__";return"("+(0,R.map)(e,e=>'"'+ce(e)+'"').join(" OR ")+")"}return ce(`${e}`)}},{id:L.$m.Raw,name:"raw",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.keep-value-as-is","Keep value as is"),formatter:e=>String(e)},{id:L.$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,i.escapeRegex)(e);if(Array.isArray(e)){const t=e.map(e=>"string"==typeof e?(0,i.escapeRegex)(e):(0,i.escapeRegex)(String(e)));return 1===t.length?t[0]:"("+t.join("|")+")"}return(0,i.escapeRegex)(`${e}`)}},{id:L.$m.Pipe,name:"Pipe",description:(0,le.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:L.$m.Distributed,name:"Distributed",description:(0,le.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,R.map)(e,(e,t)=>0!==t?n.state.name+"="+e:e),e.join(",")):`${e}`},{id:L.$m.CSV,name:"Csv",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.commaseparated-values","Comma-separated values"),formatter:e=>"string"==typeof e?e:(0,R.isArray)(e)?e.join(","):String(e)},{id:L.$m.HTML,name:"HTML",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.html-escaping-of-values","HTML escaping of values"),formatter:e=>"string"==typeof e?i.textUtil.escapeHtml(e):(0,R.isArray)(e)?i.textUtil.escapeHtml(e.join(", ")):i.textUtil.escapeHtml(String(e))},{id:L.$m.JSON,name:"JSON",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.json-stringify-value","JSON stringify value"),formatter:e=>"string"==typeof e?e:JSON.stringify(e)},{id:L.$m.PercentEncode,name:"Percent encode",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.useful-for-url-escaping-values","Useful for URL escaping values"),formatter:e=>(0,R.isArray)(e)?de("{"+e.join(",")+"}"):de(e)},{id:L.$m.SingleQuote,name:"Single quote",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.single-quoted-values","Single quoted values"),formatter:e=>{const t=new RegExp("'","g");if((0,R.isArray)(e))return(0,R.map)(e,e=>`'${(0,R.replace)(e,t,"\\'")}'`).join(",");let n="string"==typeof e?e:String(e);return`'${(0,R.replace)(n,t,"\\'")}'`}},{id:L.$m.DoubleQuote,name:"Double quote",description:(0,le.t)("grafana-scenes.variables.format-registry.formats.description.double-quoted-values","Double quoted values"),formatter:e=>{const t=new RegExp('"',"g");if((0,R.isArray)(e))return(0,R.map)(e,e=>`"${(0,R.replace)(e,t,'\\"')}"`).join(",");let n="string"==typeof e?e:String(e);return`"${(0,R.replace)(n,t,'\\"')}"`}},{id:L.$m.SQLString,name:"SQL string",description:"SQL string quoting and commas for use in IN statements and other scenarios",formatter:ve},{id:"join",name:"Join",description:"Join values with a comma",formatter:(e,t)=>{var n;if((0,R.isArray)(e)){const r=null!=(n=t[0])?n:",";return e.join(r)}return String(e)}},{id:L.$m.Date,name:"Date",description:(0,le.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,i.dateTime)(r).toISOString();default:return(t||[]).length>1?(0,i.dateTime)(r).format(t.join(":")):(0,i.dateTime)(r).format(a)}}},{id:L.$m.Glob,name:"Glob",description:(0,le.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,R.isArray)(e)&&e.length>1?"{"+e.join(",")+"}":String(e)},{id:L.$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:L.$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 i.urlUtil.toUrlParams(e)}return Array.isArray(e)?e.map(e=>fe(n.state.name,e)).join("&"):fe(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=de(t[0]||n.state.name),a=de(t[1]||"");return Array.isArray(e)?e.map(e=>me(r,e,a)).join("&"):me(r,e,a)}},{id:L.$m.UriEncode,name:"Percent encode as URI",description:(0,le.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,R.isArray)(e)?pe("{"+e.join(",")+"}"):pe(e)}];return e});function ce(e){return!1===isNaN(+e)?e:e.replace(/([\!\*\+\-\=<>\s\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g,"\\$1")}function de(e){return"object"==typeof e&&(e=String(e)),he(encodeURIComponent(e))}const pe=e=>he(encodeURI(String(e))),he=e=>e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase());function fe(e,t){return`var-${e}=${de(t)}`}function me(e,t,n=""){return`${e}=${n}${de(t)}`}const ge={"'":"''",'"':'\\"'};function ve(e){const t=new RegExp("'|\"","g");if((0,R.isArray)(e))return(0,R.map)(e,e=>`'${(0,R.replace)(e,t,e=>{var t;return null!=(t=ge[e])?t:""})}'`).join(",");let n="string"==typeof e?e:String(e);return`'${(0,R.replace)(n,t,e=>{var t;return null!=(t=ge[e])?t:""})}'`}const be="All",ye="$__all",we="$__auto",Se=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,xe="__searchFilter",Ee="__scopes";class _e{constructor(e){this._value=e}formatter(){return this._value}}class Ce{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=te(this._sceneObject);return"__from"===this.state.name?e.state.value.from.valueOf():e.state.value.to.valueOf()}getValueText(){const e=te(this._sceneObject);return"__from"===this.state.name?(0,i.dateTimeFormat)(e.state.value.from,{timeZone:e.getTimeZone()}):(0,i.dateTimeFormat)(e.state.value.to,{timeZone:e.getTimeZone()})}}class Re{constructor(e,t,n){this.state={name:e,type:"time_macro",match:n},this._sceneObject=t}getValue(){var e;const t=_s(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 Oe(e,t){e.setState(t)}function ke(){return o.useLocationService?(0,o.useLocationService)():o.locationService}function De(e){let t=e;do{if("repeatSourceKey"in t.state&&t.state.repeatSourceKey)return!0;t=t.parent}while(t);return!1}class Ae extends E{constructor(){super(...arguments),this._urlSync=new Te(this)}validateAndUpdate(){return this.getValueOptions({}).pipe((0,h.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,R.isEqual)(e,r))&&this.publishEvent(new ne(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=ye,r.text=be):this.state.isMulti?(r.value=[],r.text=[]):(r.value="",r.text=""),r;if(this.hasAllValue())return this.state.includeAll?r.text=be:(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,R.isEqual)(a,t)||(r.value=a),(0,R.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===ye&&this.state.text===be;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 Ie(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()?be:Array.isArray(this.state.text)?this.state.text.join(" + "):String(this.state.text)}hasAllValue(){const e=this.state.value;return e===ye||Array.isArray(e)&&e[0]===ye}getDefaultMultiState(e){return this.state.defaultToAll?{value:[ye],text:[be]}:e.length>0?{value:[e[0].value],text:[e[0].label]}:{value:[],text:[]}}getDefaultSingleState(e){return this.state.defaultToAll?{value:ye,text:be}: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]===ye?(e=[ye],t=[be]):e[0]===ye&&e.length>1&&(e.shift(),Array.isArray(t)&&t.shift())}if((0,R.isEqual)(e,this.state.value)&&(0,R.isEqual)(t,this.state.text))return;const i=()=>this.setStateHelper({value:e,text:t,loading:!1});if(n){const e=P(this);null==e||e.startProfile(Q),null==(a=(r=this._urlSync).performBrowserHistoryAction)||a.call(r,i)}else i();this.publishEvent(new ne(this),!0)}findLabelTextForValue(e){if(e===ye)return be;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){Oe(this,e)}getOptionsForSelect(e=!0){let t=this.state.options;if(this.state.includeAll&&(t=[{value:ye,label:be},...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 Te{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,R.isArray)(e)&&e[0]===be)return[ye];if(e===be)return ye;return e}(t)),this._sceneObject.state.allValue&&this._sceneObject.state.allValue===t&&(t=ye),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 Ie{constructor(e,t){this._value=e,this._variable=t}formatter(e){return e===L.$m.Text?be:e===L.$m.PercentEncode?ue.get(L.$m.PercentEncode).formatter(this._value,[],this._variable):e===L.$m.QueryParam?ue.get(L.$m.QueryParam).formatter(be,[],this._variable):this._value}}function Pe(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&&Pe(e.parent,t),t}const Le=(0,i.getDisplayProcessor)();class Me{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 Ne=new Map([[i.DataLinkBuiltInVars.includeVars,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){const e=Pe(this._sceneObject),t=ue.get(L.$m.QueryParam),n=[];for(const r of Object.keys(e)){const a=e[r];if(a instanceof Ae&&a.hasAllValue()&&!a.state.allValue){n.push(t.formatter(ye,[],a));continue}const i=a.getValue();i&&(re(i)?n.push(i.formatter(L.$m.QueryParam)):n.push(t.formatter(i,[],a)))}return new _e(n.join("&"))}getValueText(){return""}}],[i.DataLinkBuiltInVars.keepTime,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){var e;const t=null==(e=te(this._sceneObject).urlSync)?void 0:e.getUrlState();return"browser"===(null==t?void 0:t.timezone)&&(t.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone),new _e(i.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:o,field:s,calculatedValue:l}=r.value;if(l)switch(e){case"numeric":case"raw":return l.numeric;case"time":return"";default:return(0,i.formattedValueToString)(l)}if(null==o)return this._match;if("time"===e){const e=a.fields.find(e=>e.type===i.FieldType.time);return e?e.values.get(o):void 0}if(!s)return this._match;const u=s.values.get(o);if("raw"===e)return u;const c=(null!=(n=s.display)?n:Le)(u);return"numeric"===e?c.numeric:(0,i.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:o}=r.value;if(void 0===o||void 0===e)return this._match;const s={name:a.name,refId:a.refId,fields:(0,i.getFieldDisplayValuesProxy)({frame:a,rowIndex:o})};return null!=(n=oe(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,i.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:o,data:s}=r.value,l=function(e,t,n){return new Proxy({},{get:(r,a)=>"name"===a?e.name:"displayName"===a?(0,i.getFieldDisplayName)(e,t,n):"labels"===a||"formattedLabels"===a?e.labels?{...e.labels,__values:Object.values(e.labels).sort().join(", "),toString:()=>(0,i.formatLabels)(e.labels,"",!0)}:"":void 0})}(o,a,s);return null!=(n=oe(e)(l))?n:""}getValueText(){return""}}],["__url",class{constructor(e,t){this.state={name:e,type:"url_macro"}}getValue(e){var t;const n=o.locationService.getLocation(),r=null!=(t=o.config.appSubUrl)?t:"";switch(null!=e?e:""){case"params":return new Me(n.search);case"path":return r+n.pathname;default:return r+n.pathname+n.search}}getValueText(){return""}}],["__from",Ce],["__to",Ce],["__timezone",class{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=te(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=o.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=o.config.bootData.user;return"name"===e?t.orgName:String(t.orgId)}getValueText(){return""}}],["__interval",Re],["__interval_ms",Re]]);function Ve(e,t,n,r,a){return t&&"string"==typeof t?(Se.lastIndex=0,t.replace(Se,(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 ae?(ae.state.name=e,ae.state.value=t):ae=new se(e,t),ae}(e,t)}const a=A(e,r);if(a)return a;const i=Ne.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(re(n))return Ve(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=L.$m.Glob;let i=ue.getIfExists(r);i||(console.error(`Variable format ${r} not found. Using glob format as fallback.`),i=ue.get(L.$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 $e(e){return void 0!==e.useState}function je(e){return"enrichDataRequest"in e}function Fe(e){return"isDataLayer"in e}function ze(e){return t=>{const n=Ds.getQueryController(e.origin);return n?new h.Observable(r=>{e.cancel||(e.cancel=()=>r.complete()),n.queryStarted(e);let a=!1;const i=t.subscribe({next:t=>{a||t.state===M.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 Be(e){return new h.Observable(t=>{t.next({state:M.Loading});(0,h.from)(e).pipe((0,h.map)(()=>({state:M.Done})),(0,h.catchError)(()=>(t.next({state:M.Error}),[]))).subscribe({next:e=>t.next(e),complete:()=>t.complete()})})}async function Ue(e,t){var n;if(null==e?void 0:e.uid){const t=D.get(e.uid);if(t)return t}if(e&&e.query)return e;const r=(0,o.getDataSourceSrv)().get(e,t);if(t.__sceneObject&&t.__sceneObject.value.valueOf()){const a=Ds.getQueryController(t.__sceneObject.value.valueOf());a&&a.state.enableProfiling&&Be(r).pipe(ze({type:`getDataSource/${null!=(n=null==e?void 0:e.type)?n:"unknown"}`,origin:t.__sceneObject.value.valueOf()})).subscribe(()=>{})}return await r}class We{constructor(){this._values=new Map}recordCurrentDependencyValuesForSceneObject(e){if(this.clearValues(),e.variableDependency)for(const t of e.variableDependency.getNames()){const n=Ds.lookupVariable(t,e);n&&this._values.set(n.state.name,n.getValue())}}cloneAndRecordCurrentValuesForSceneObject(e){const t=new We;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(!Fo(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=Ds.lookupVariable(t,e);if(!n)continue;const r=n.state.name;if(n&&this._values.has(r)){if(!Fo(this._values.get(r),n.getValue()))return!0}}return!1}}function He(e){return"object"==typeof e&&"getExtraQueries"in e}const qe=(e,t)=>(0,h.of)(t),Ge=0;function Qe(e){const t=e.getRoot();return je(t)?t.enrichDataRequest(e):null}const Ke=new Set;var Ye=n(2007),Xe=n(8449);function Ze(e,t="latest"){return Je(e,t.replace(/\-.*/,""))}function Je(e,t){const n={};for(const[r,a]of Object.entries(e))et(a)?n[r]=Je(a,t):(nt(a,r),n[r]=tt(a,t));return n}function et(e){if("object"==typeof e){const[t]=Object.keys(e);return!(0,Xe.valid)(t)}return!1}function tt(e,t){let n,r=Object.keys(e).sort(Xe.compare);if("latest"===t)return e[r[r.length-1]];for(const e of r)(0,Xe.gte)(t,e)&&(n=e);return n||(n=r[r.length-1]),e[n]}function nt(e,t){if(!Object.keys(e).every(e=>(0,Xe.valid)(e)))throw new Error(`Invalid semver version: '${t}'`)}const rt="8.5.0",at={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:{[rt]:"data-testid TimePicker Open Button"},overlayContent:{"10.2.3":"data-testid TimePicker Overlay Content"},fromField:{"10.2.3":"data-testid Time Range from field",[rt]:"Time Range from field"},toField:{"10.2.3":"data-testid Time Range to field",[rt]:"Time Range to field"},applyTimeRange:{[rt]:"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",[rt]:"Time Range calendar"},openButton:{"10.2.3":"data-testid Open time range calendar",[rt]:"Open time range calendar"},closeButton:{"10.2.3":"data-testid Close time range Calendar",[rt]:"Close time range Calendar"}},absoluteTimeRangeTitle:{[rt]:"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:{[rt]:"Test Data Query scenario select container"},scenarioSelect:{[rt]:"Test Data Query scenario select"},max:{[rt]:"TestData max"},min:{[rt]:"TestData min"},noise:{[rt]:"TestData noise"},seriesCount:{[rt]:"TestData series count"},spread:{[rt]:"TestData spread"},startValue:{[rt]:"TestData start value"},drop:{[rt]:"TestData drop values"}}},DataSourceHttpSettings:{urlInput:{"10.4.0":"data-testid Datasource HTTP settings url",[rt]:"Datasource HTTP settings url"}},Jaeger:{traceIDInput:{[rt]:"Trace ID"}},Prometheus:{configPage:{connectionSettings:{[rt]:"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",[rt]:"Add exemplar config button"},internalLinkSwitch:{"10.3.0":"data-testid Internal link switch",[rt]:"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",[rt]:"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:{[rt]:e=>`${e} menu`},MenuGroup:{[rt]:e=>`${e} menu group`},MenuItem:{[rt]:e=>`${e} menu item`},SubMenu:{container:{"10.3.0":"data-testid SubMenu container",[rt]:"SubMenu container"},icon:{"10.3.0":"data-testid SubMenu icon",[rt]:"SubMenu icon"}}},Panels:{Panel:{title:{[rt]: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:{[rt]:e=>`${e} panel`},headerCornerInfo:{[rt]:e=>`Panel header ${e}`},status:{"10.2.0":e=>`data-testid Panel status ${e}`,[rt]:e=>"Panel status"},loadingBar:{"10.0.0":()=>"Panel loading bar"},HoverWidget:{container:{"10.1.0":"data-testid hover-header-container",[rt]:"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:{[rt]:"Legend section"}},Legend:{legendItemAlias:{[rt]:e=>`gpl alias ${e}`},showLegendSwitch:{[rt]:"gpl show legend"}},xAxis:{labels:{[rt]:()=>"div.flot-x-axis > div.flot-tick-label"}}},BarGauge:{valueV2:{[rt]:"data-testid Bar gauge value"}},PieChart:{svgSlice:{"10.3.0":"data testid Pie Chart Slice"}},Text:{container:{[rt]:()=>".markdown-html"}},Table:{header:{[rt]:"table header"},footer:{[rt]:"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:{[rt]:e=>`Drawer title ${e}`},expand:{[rt]:"Drawer expand"},contract:{[rt]:"Drawer contract"},close:{"10.3.0":"data-testid Drawer close",[rt]:"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",[rt]:"Panel editor option pane content"},select:{[rt]:"Panel editor option pane select"},fieldLabel:{[rt]: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",[rt]:"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",[rt]:"toggle-viz-options"},toggleTableView:{"11.1.0":"data-testid toggle-table-view",[rt]:"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:{[rt]:"Panel inspector Data content"}},Stats:{content:{[rt]:"Panel inspector Stats content"}},Json:{content:{"11.1.0":"data-testid Panel inspector Json content",[rt]:"Panel inspector Json content"}},Query:{content:{[rt]:"Panel inspector Query content"},refreshButton:{[rt]:"Panel inspector Query refresh button"},jsonObjectKeys:{[rt]:()=>".json-formatter-key"}}},Tab:{title:{"11.2.0":e=>`data-testid Tab ${e}`},active:{[rt]:()=>'[class*="-activeTabStyle"]'}},RefreshPicker:{runButtonV2:{[rt]:"data-testid RefreshPicker run button"},intervalButtonV2:{[rt]:"data-testid RefreshPicker interval button"}},QueryTab:{content:{[rt]:"Query editor tab content"},queryInspectorButton:{[rt]:"Query inspector button"},queryHistoryButton:{"10.2.0":"data-testid query-history-button",[rt]:"query-history-button"},addQuery:{"10.2.0":"data-testid query-tab-add-query",[rt]:"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:{[rt]:"Query editor row"}},QueryEditorRow:{actionButton:{"10.4.0":e=>`data-testid ${e}`},title:{[rt]:e=>`Query editor row title ${e}`},container:{[rt]:e=>`Query editor row ${e}`}},AlertTab:{content:{"10.2.3":"data-testid Alert editor tab content",[rt]:"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:{[rt]:e=>`data-testid Alert ${e}`}},TransformTab:{content:{"10.1.0":"data-testid Transform editor tab content",[rt]:"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",[rt]:"Transform mode label"},calculationsLabel:{"10.2.3":"data-testid Transform calculations label",[rt]:"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",[rt]:"search transformations"},noTransformationsMessage:{"10.2.3":"data-testid no transformations message"},addTransformationButton:{"10.1.0":"data-testid add transformation button",[rt]:"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",[rt]:"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:{[rt]:()=>".page-toolbar"},item:{[rt]:e=>`${e}`},itemButton:{"9.5.0":e=>`data-testid ${e}`}},QueryEditorToolbarItem:{button:{[rt]:e=>`QueryEditor toolbar item button ${e}`}},BackButton:{backArrow:{"10.3.0":"data-testid Go Back",[rt]:"Go Back"}},OptionsGroup:{group:{"11.1.0":e=>e?`data-testid Options group ${e}`:"data-testid Options group",[rt]:e=>e?`Options group ${e}`:"Options group"},toggle:{"11.1.0":e=>e?`data-testid Options group ${e} toggle`:"data-testid Options group toggle",[rt]:e=>e?`Options group ${e} toggle`:"Options group toggle"}},PluginVisualization:{item:{[rt]:e=>`Plugin visualization item ${e}`},current:{[rt]:()=>'[class*="-currentVisualizationItem"]'}},Select:{menu:{"11.5.0":"data-testid Select menu",[rt]:"Select options menu"},option:{"11.1.0":"data-testid Select option",[rt]:"Select option"},toggleAllOptions:{"11.3.0":"data-testid toggle all options"},input:{[rt]:()=>'input[id*="time-options-input"]'},singleValue:{[rt]:()=>'div[class*="-singleValue"]'}},FieldConfigEditor:{content:{[rt]:"Field config editor content"}},OverridesConfigEditor:{content:{[rt]:"Field overrides editor content"}},FolderPicker:{containerV2:{[rt]:"data-testid Folder picker select container"},input:{"10.4.0":"data-testid folder-picker-input"}},ReadonlyFolderPicker:{container:{[rt]:"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",[rt]:"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:{[rt]:"data-testid Time zone picker select container"},changeTimeSettingsButton:{"11.0.0":"data-testid Time zone picker Change time settings button"}},WeekStartPicker:{containerV2:{[rt]:"data-testid Choose starting day of the week"},placeholder:{[rt]:"Choose starting day of the week"}},TraceViewer:{spanBar:{"9.0.0":"data-testid SpanBar--wrapper"}},QueryField:{container:{"10.3.0":"data-testid Query field",[rt]:"Query field"}},QueryBuilder:{queryPatterns:{"10.3.0":"data-testid Query patterns",[rt]:"Query patterns"},labelSelect:{"10.3.0":"data-testid Select label",[rt]:"Select label"},inputSelect:{"11.1.0":"data-testid Select label-input"},valueSelect:{"10.3.0":"data-testid Select value",[rt]:"Select value"},matchOperatorSelect:{"10.3.0":"data-testid Select match operator",[rt]:"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:{[rt]:"data-testid Search section"},itemsV2:{[rt]:"data-testid Search items"},cards:{[rt]:"data-testid Search cards"},collapseFolder:{[rt]:e=>`data-testid Collapse folder ${e}`},expandFolder:{[rt]:e=>`data-testid Expand folder ${e}`},dashboardItem:{[rt]:e=>`data-testid Dashboard search item ${e}`},dashboardCard:{[rt]: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:{[rt]:"data-testid Dashboard search item"}},DashboardLinks:{container:{[rt]:"data-testid Dashboard link container"},dropDown:{[rt]:"data-testid Dashboard link dropdown"},link:{[rt]:"data-testid Dashboard link"}},LoadingIndicator:{icon:{"10.4.0":"data-testid Loading indicator",[rt]:"Loading indicator"}},CallToActionCard:{buttonV2:{[rt]:e=>`data-testid Call to action button ${e}`}},DataLinksContextMenu:{singleLink:{"10.3.0":"data-testid Data link",[rt]:"Data link"}},DataLinksActionsTooltip:{tooltipWrapper:{"12.1.0":"data-testid Data links actions tooltip wrapper"}},CodeEditor:{container:{"10.2.3":"data-testid Code editor container",[rt]:"Code editor container"}},ReactMonacoEditor:{editorLazy:{"11.1.0":"data-testid ReactMonacoEditor editorLazy"}},DashboardImportPage:{textarea:{[rt]:"data-testid-import-dashboard-textarea"},submit:{[rt]:"data-testid-load-dashboard"}},ImportDashboardForm:{name:{[rt]:"data-testid-import-dashboard-title"},submit:{[rt]:"data-testid-import-dashboard-submit"}},PanelAlertTabContent:{content:{"10.2.3":"data-testid Unified alert editor tab content",[rt]:"Unified alert editor tab content"}},VisualizationPreview:{card:{[rt]:e=>`data-testid suggestion-${e}`}},ColorSwatch:{name:{[rt]:"data-testid-colorswatch"}},DashboardRow:{title:{[rt]:e=>`data-testid dashboard-row-title-${e}`},wrapper:{"12.1.0":e=>`data-testid dashboard-row-wrapper-for-${e}`}},UserProfile:{profileSaveButton:{[rt]:"data-testid-user-profile-save"},preferencesSaveButton:{[rt]:"data-testid-shared-prefs-save"},orgsTable:{[rt]:"data-testid-user-orgs-table"},sessionsTable:{[rt]:"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",[rt]:"annotations-type-input"},annotationsChoosePanelInput:{"11.1.0":"data-testid choose-panels-input",[rt]:"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"}}}}},it={pages:Ze({Alerting:{AddAlertRule:{url:{"10.1.0":"/alerting/new/alerting",[rt]:"/alerting/new"}},EditAlertRule:{url:{[rt]:e=>`alerting/${e}/edit`}}},Login:{url:{[rt]:"/login"},username:{"10.2.3":"data-testid Username input field",[rt]:"Username input field"},password:{"10.2.3":"data-testid Password input field",[rt]:"Password input field"},submit:{"10.2.3":"data-testid Login button",[rt]:"Login button"},skip:{"10.2.3":"data-testid Skip change password button"}},PasswordlessLogin:{url:{[rt]:"/login/passwordless/authenticate"},email:{"10.2.3":"data-testid Email input field",[rt]:"Email input field"},submit:{"10.2.3":"data-testid PasswordlessLogin button",[rt]:"PasswordlessLogin button"}},Home:{url:{[rt]:"/"}},DataSource:{name:{"10.3.0":"data-testid Data source settings page name input field",[rt]:"Data source settings page name input field"},delete:{[rt]:"Data source settings page Delete button"},readOnly:{"10.3.0":"data-testid Data source settings page read only message",[rt]:"Data source settings page read only message"},saveAndTest:{"10.0.0":"data-testid Data source settings page Save and Test button",[rt]:"Data source settings page Save and Test button"},alert:{"10.3.0":"data-testid Data source settings page Alert",[rt]:"Data source settings page Alert"}},DataSources:{url:{[rt]:"/datasources"},dataSources:{[rt]: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:{[rt]:"/datasources/new"},dataSourcePluginsV2:{"9.3.1":e=>`Add new data source ${e}`,[rt]:e=>`Data source plugin item ${e}`}},ConfirmModal:{delete:{"10.0.0":"data-testid Confirm Modal Danger Button",[rt]:"Confirm Modal Danger Button"},input:{"12.2.0":"data-testid Confirm Modal Input"}},SecretsManagement:{SecretForm:{"12.2.0":"data-testid Secret Form"}},AddDashboard:{url:{[rt]:"/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",[rt]:"Add new panel"},itemButtonAddViz:{[rt]:"Add new visualization menu item"},addNewRow:{"11.1.0":"data-testid Add new row",[rt]:"Add new row"},addNewPanelLibrary:{"11.1.0":"data-testid Add new panel from panel library",[rt]:"Add new panel from panel library"},Settings:{Annotations:{List:{url:{[rt]:"/dashboard/new?orgId=1&editview=annotations"}},Edit:{url:{[rt]:e=>`/dashboard/new?editview=annotations&editIndex=${e}`}}},Variables:{List:{url:{"11.3.0":"/dashboard/new?orgId=1&editview=variables",[rt]:"/dashboard/new?orgId=1&editview=templating"}},Edit:{url:{"11.3.0":e=>`/dashboard/new?orgId=1&editview=variables&editIndex=${e}`,[rt]:e=>`/dashboard/new?orgId=1&editview=templating&editIndex=${e}`}}}}},ImportDashboard:{url:{[rt]:"/dashboard/import"}},Dashboard:{url:{[rt]:e=>`/d/${e}`},DashNav:{nav:{[rt]:"Dashboard navigation"},navV2:{[rt]:"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:{[rt]:"Dashboard submenu"},submenuItem:{[rt]:"data-testid template variable"},submenuItemLabels:{[rt]:e=>`data-testid Dashboard template variables submenu Label ${e}`},submenuItemValueDropDownValueLinkTexts:{[rt]:e=>`data-testid Dashboard template variables Variable Value DropDown value link text ${e}`},submenuItemValueDropDownDropDown:{[rt]:"Variable options"},submenuItemValueDropDownOptionTexts:{[rt]: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:{[rt]:e=>`Dashboard settings section item ${e}`},saveDashBoard:{[rt]:"Dashboard settings aside actions Save button"},saveAsDashBoard:{[rt]:"Dashboard settings aside actions Save As button"},title:{"11.2.0":"General"}},Annotations:{Edit:{urlParams:{[rt]:e=>`editview=annotations&editIndex=${e}`}},List:{url:{[rt]:e=>`/d/${e}?editview=annotations`},addAnnotationCTAV2:{[rt]:"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",[rt]:"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`,[rt]:e=>`/d/${e}?editview=templating`},addVariableCTAV2:{[rt]:"data-testid Call to action button Add variable"},newButton:{[rt]:"Variable editor New variable button"},table:{[rt]:"Variable editor Table"},tableRowNameFields:{[rt]:e=>`Variable editor Table Name field ${e}`},tableRowDefinitionFields:{"10.1.0":e=>`Variable editor Table Definition field ${e}`},tableRowArrowUpButtons:{[rt]:e=>`Variable editor Table ArrowUp button ${e}`},tableRowArrowDownButtons:{[rt]:e=>`Variable editor Table ArrowDown button ${e}`},tableRowDuplicateButtons:{[rt]:e=>`Variable editor Table Duplicate button ${e}`},tableRowRemoveButtons:{[rt]:e=>`Variable editor Table Remove button ${e}`}},Edit:{urlParams:{"11.3.0":e=>`editview=variables&editIndex=${e}`,[rt]:e=>`editview=templating&editIndex=${e}`},General:{headerLink:{[rt]:"Variable editor Header link"},modeLabelNew:{[rt]:"Variable editor Header mode New"},modeLabelEdit:{[rt]:"Variable editor Header mode Edit"},generalNameInput:{[rt]:"Variable editor Form Name field"},generalNameInputV2:{[rt]:"data-testid Variable editor Form Name field"},generalTypeSelect:{[rt]:"Variable editor Form Type select"},generalTypeSelectV2:{[rt]:"data-testid Variable editor Form Type select"},generalLabelInput:{[rt]:"Variable editor Form Label field"},generalLabelInputV2:{[rt]:"data-testid Variable editor Form Label field"},generalHideSelect:{[rt]:"Variable editor Form Hide select"},generalHideSelectV2:{[rt]:"data-testid Variable editor Form Hide select"},selectionOptionsAllowCustomValueSwitch:{[rt]:"data-testid Variable editor Form Allow Custom Value switch"},selectionOptionsMultiSwitch:{"10.4.0":"data-testid Variable editor Form Multi switch",[rt]:"Variable editor Form Multi switch"},selectionOptionsIncludeAllSwitch:{"10.4.0":"data-testid Variable editor Form IncludeAll switch",[rt]:"Variable editor Form IncludeAll switch"},selectionOptionsCustomAllInput:{"10.4.0":"data-testid Variable editor Form IncludeAll field",[rt]:"Variable editor Form IncludeAll field"},previewOfValuesOption:{"10.4.0":"data-testid Variable editor Preview of Values option",[rt]:"Variable editor Preview of Values option"},submitButton:{"10.4.0":"data-testid Variable editor Run Query button",[rt]:"Variable editor Submit button"},applyButton:{"9.3.0":"data-testid Variable editor Apply button"}},QueryVariable:{closeButton:{[rt]:"data-testid Query Variable editor close button"},editor:{[rt]:"data-testid Query Variable editor"},previewButton:{[rt]:"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",[rt]:"Data source picker select container"},queryOptionsOpenButton:{[rt]:"data-testid Query Variable editor open button"},queryOptionsRefreshSelect:{[rt]:"Variable editor Form Query Refresh select"},queryOptionsRefreshSelectV2:{[rt]:"data-testid Variable editor Form Query Refresh select"},queryOptionsRegExInput:{[rt]:"Variable editor Form Query RegEx field"},queryOptionsRegExInputV2:{[rt]:"data-testid Variable editor Form Query RegEx field"},queryOptionsSortSelect:{[rt]:"Variable editor Form Query Sort select"},queryOptionsSortSelectV2:{[rt]:"data-testid Variable editor Form Query Sort select"},queryOptionsQueryInput:{"10.4.0":"data-testid Variable editor Form Default Variable Query Editor textarea"},queryOptionsStaticOptionsRow:{[rt]:"Variable editor Form Query Static Options row"},queryOptionsStaticOptionsToggle:{[rt]:"Variable editor Form Query Static Options toggle"},queryOptionsStaticOptionsLabelInput:{[rt]:"Variable editor Form Query Static Options Label input"},queryOptionsStaticOptionsValueInput:{[rt]:"Variable editor Form Query Static Options Value input"},queryOptionsStaticOptionsDeleteButton:{[rt]:"Variable editor Form Query Static Options Delete button"},queryOptionsStaticOptionsAddButton:{[rt]:"Variable editor Form Query Static Options Add button"},queryOptionsStaticOptionsOrderDropdown:{[rt]:"Variable editor Form Query Static Options Order dropdown"},valueGroupsTagsEnabledSwitch:{[rt]:"Variable editor Form Query UseTags switch"},valueGroupsTagsTagsQueryInput:{[rt]:"Variable editor Form Query TagsQuery field"},valueGroupsTagsTagsValuesQueryInput:{[rt]:"Variable editor Form Query TagsValuesQuery field"}},ConstantVariable:{constantOptionsQueryInput:{[rt]:"Variable editor Form Constant Query field"},constantOptionsQueryInputV2:{[rt]:"data-testid Variable editor Form Constant Query field"}},DatasourceVariable:{datasourceSelect:{[rt]:"data-testid datasource variable datasource type"},nameFilter:{[rt]:"data-testid datasource variable datasource name filter"}},TextBoxVariable:{textBoxOptionsQueryInput:{[rt]:"Variable editor Form TextBox Query field"},textBoxOptionsQueryInputV2:{[rt]:"data-testid Variable editor Form TextBox Query field"}},CustomVariable:{customValueInput:{[rt]:"data-testid custom-variable-input"}},IntervalVariable:{intervalsValueInput:{[rt]:"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:{[rt]:"/dashboards"},dashboards:{"10.2.0":e=>`Dashboard search item ${e}`},toggleView:{[rt]:"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:{[rt]:"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:{[rt]:"/explore"},General:{container:{[rt]:"data-testid Explore"},graph:{[rt]:"Explore Graph"},table:{[rt]:"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:{[rt]:e=>`/d-solo/${e}`}},PluginsList:{page:{[rt]:"Plugins list page"},list:{[rt]:"Plugins list"},listItem:{[rt]:"Plugins list item"},signatureErrorNotice:{"10.3.0":"data-testid Unsigned plugins notice",[rt]:"Unsigned plugins notice"}},PluginPage:{page:{[rt]:"Plugin page"},signatureInfo:{"10.3.0":"data-testid Plugin signature info",[rt]:"Plugin signature info"},disabledInfo:{"10.3.0":"data-testid Plugin disabled info",[rt]:"Plugin disabled info"}},PlaylistForm:{name:{[rt]:"Playlist name"},interval:{[rt]:"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:{[rt]:e=>`/plugins/${e}`}},MigrateToCloud:{url:{"11.2.0":"/admin/migrate-to-cloud"}}}),components:Ze(at)};var ot=n(6089),st=n(7993);const lt=/[^ -~]/m,ut=/^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+$/m,ct=5,dt=25,pt=5,ht=1e4,ft=new st.A({intraMode:1});function mt(e,t,n){let r=[];if(""===n)r=e;else if(lt.test(n)||ut.test(n)||n.length>dt||ft.split(n).length>pt)for(let a=0;a<t.length;a++){t[a].includes(n)&&r.push(e[a])}else{const[a,i,o]=ft.search(t,n,ct,ht);(null==a?void 0:a.length)&&(r=i&&o?o.map(t=>e[i.idx[t]]):a.map(t=>e[t]))}return r}function gt(e,t=!1){let n=e;t&&(n=[{value:ye,label:be},...n]);const r=n.map(e=>e.label);return e=>mt(n,r,e)}const vt=()=>!0,bt=e=>"$__all"!==e.value,yt=(e,t)=>e.length===t.filter(bt).length?Ye.ToggleAllState.allSelected:0===e.length||1===e.length&&e[0]&&"$__all"===e[0].value?Ye.ToggleAllState.noneSelected:Ye.ToggleAllState.indeterminate;function wt({model:e,state:t}){const{value:n,text:r,key:a,options:i,includeAll:o,isReadOnly:s,allowCustomValue:l=!0}=t,[u,d]=(0,c.useState)(""),[h,f]=(0,c.useState)(!1),m=function(e,t){return{value:e,label:null!=t?t:String(e)}}(n,String(r)),g=Ds.getQueryController(e),v=(0,c.useMemo)(()=>gt(i,o),[i,o])(u);return p().createElement(Ye.Select,{id:a,isValidNewOption:e=>e.trim().length>0,placeholder:(0,le.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:vt,tabSelectsValue:!1,onInputChange:(t,{action:n})=>"input-change"===n?(d(t),e.onSearchChange&&e.onSearchChange(t),t):t,onOpenMenu:()=>{h&&d(String(r))},onCloseMenu:()=>{d("")},options:v,"data-testid":it.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${n}`),onChange:t=>{e.changeValueTo(t.value,t.label,!0),null==g||g.startProfile(Q),h!==t.__isNew__&&f(t.__isNew__)}})}function St({model:e,state:t}){const{value:n,options:r,key:a,maxVisibleValues:i,noValueOnClear:o,includeAll:s,isReadOnly:l,allowCustomValue:u=!0}=t,d=(0,c.useMemo)(()=>(0,R.isArray)(n)?n:[n],[n]),[h,f]=(0,c.useState)(d),[m,g]=(0,c.useState)(""),v=(0,c.useMemo)(()=>gt(r,s),[r,s]);(0,c.useEffect)(()=>{f(d)},[d]);const b=r.length>0?"Select value":"",y=v(m);return p().createElement(Ye.MultiSelect,{id:a,placeholder:b,width:"auto",inputValue:m,disabled:l,value:h,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,allowCustomValue:u,toggleAllOptions:{enabled:!0,optionsFilter:bt,determineToggleAllState:yt},options:y,closeMenuOnSelect:!1,components:{Option:xt},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(h,void 0,!0)},filterOption:vt,"data-testid":it.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${h}`),onChange:(t,n)=>{"clear"===n.action&&o&&e.changeValueTo([],void 0,!0),f(t.map(e=>e.value))}})}const xt=({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,h=(0,Ye.useTheme2)(),f=(0,Ye.getSelectStyles)(h),m=(0,Ye.useStyles2)(Et);return p().createElement("div",{ref:r,className:(0,ot.cx)(f.option,a&&f.optionFocused),...d,"data-testid":"data-testid Select option",title:t.title},p().createElement("div",{className:m.checkbox},p().createElement(Ye.Checkbox,{indeterminate:o,value:i})),p().createElement("div",{className:f.optionBody,"data-testid":it.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(null!=(l=t.label)?l:String(t.value))},p().createElement("span",null,e)))};xt.displayName="SelectMenuOptions";const Et=e=>({checkbox:(0,ot.css)({marginRight:e.spacing(2)})});function _t({model:e}){const t=e.useState();return t.isMulti?p().createElement(St,{model:e,state:t}):p().createElement(wt,{model:e,state:t})}class Ct{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?[""]:Rt(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(Yo(n)),e.texts.push(Yo(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 Rt(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),Xo(e,r)})}function Ot(e){const t=e.getRoot();return"enrichFiltersRequest"in t?t.enrichFiltersRequest(e):null}var kt,Dt=e=>{throw TypeError(e)},At=(e,t,n)=>t.has(e)||Dt("Cannot "+n);class Tt{constructor(e){((e,t,n)=>{t.has(e)?Dt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n)})(this,kt),this.text="__sceneObject",this.valueOf=()=>{return At(e=this,t=kt,"read from private field"),n?n.call(e):t.get(e);var e,t,n},((e,t,n)=>{At(e,t,"write to private field"),t.set(e,n)})(this,kt,e)}toString(){}get value(){return this}}function It(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}(o.config.buildInfo.version)?new Tt(e):{value:e,text:"__sceneObject"}}function Pt(e){const{model:t}=e,n=(0,Ye.useTheme2)(),r=Lt(n),a=(0,Ye.getInputStyles)({theme:n,invalid:!1}),i=(0,R.isArray)(t.state.value)?t.state.value:t.state.value?[t.state.value]:[];let o=[];return i&&i.length&&o.push(p().createElement(Ye.IconButton,{"aria-label":(0,le.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(p().createElement(Ye.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,le.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(p().createElement(Ye.Tooltip,{key:"tooltip",content:(0,le.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"},p().createElement(Ye.Icon,{name:"info-circle",size:"md"}))),p().createElement("div",{onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},className:(0,ot.cx)(a.suffix,(0,ot.css)({position:"relative"}))},o)}kt=new WeakMap;const Lt=e=>({clearIcon:(0,ot.css)({color:e.colors.action.disabledText,cursor:"pointer","&:hover:before":{backgroundColor:"transparent"},"&:hover":{color:e.colors.text.primary}})}),Mt=({keysApplicability:e,children:t})=>{var n,r;const a=(0,Ye.useTheme2)(),i=(0,Ye.getSelectStyles)(a),{disabledPill:o,strikethrough:s}=ts(a),l=p().Children.toArray(t)[0];let u=!0;if(p().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 p().createElement("div",{className:(0,ot.cx)(i.multiValueContainer,!u&&(0,ot.cx)(o,s))},t)};function Nt(e){return"isInteractionTracker"in e}function Vt(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(Nt(e))return e;t=t.parent}}class $t extends Ae{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 Ct(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(Zo(null!=(r=null==a?void 0:a.values)?r:[]));if(!e.getTagKeys)return[];const i=qo(this),o=this.state.baseFilters||[],s=Ds.getTimeRange(this).state.value,l=await e.getTagKeys({filters:o,queries:i,timeRange:s,scopes:Ds.getScopes(this),...Ot(this)});Jo(l)&&this.setState({error:l.error.message});let u=Zo(l);a&&(u=u.concat(Zo(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(()=>(Ke.add(this),()=>Ke.delete(this))),this.addActivationHandler(this._activationHandler)}validateAndUpdate(){return this.getValueOptions({}).pipe((0,h.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,h.of)(this.state.defaultOptions.map(e=>({label:e.text,value:String(e.value),group:e.group}))):(this.setState({loading:!0,error:null}),(0,h.from)(Ue(this.state.datasource,{__sceneObject:It(this)})).pipe((0,h.mergeMap)(e=>(0,h.from)(this._getKeys(e)).pipe((0,h.tap)(e=>{Jo(e)&&this.setState({error:e.error.message})}),(0,h.map)(e=>Zo(e)),(0,h.take)(1),(0,h.mergeMap)(e=>{const t=e.map(e=>({label:e.text,value:e.value?String(e.value):e.text,group:e.group}));return(0,h.of)(t)})))))}getApplicableKeys(){const{value:e,keysApplicability:t}=this.state,n=(0,R.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 Ue(this.state.datasource,{__sceneObject:It(this)});if(!e.getDrilldownsApplicability)return;const t=qo(this),n=Ds.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:Ds.getScopes(this),...Ot(this)});(0,R.isEqual)(a,this.state.keysApplicability)||(this.setState({keysApplicability:null!=a?a:void 0}),this.publishEvent(new ne(this),!0))}checkIfRestorable(e){var t,n,r,a;const i=(0,R.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,R.isArray)(e)?e:[e];return o.length!==i.length||!(0,R.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:[]}}}$t.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:d,keysApplicability:f}=e.useState(),m=(0,c.useMemo)(()=>{const e=(0,R.isArray)(t)?t:[t],r=(0,R.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,c.useState)(!1),[b,y]=(0,c.useState)(!1),[w,S]=(0,c.useState)(""),[x,E]=(0,c.useState)(m),_=(0,c.useMemo)(()=>gt(s,l),[s,l]),C=void 0!==d;(0,c.useEffect)(()=>{E(m)},[m]);const O=(t,{action:n})=>"input-change"===n?(S(t),e.onSearchChange&&e.onSearchChange(t),t):"input-blur"===n?(S(""),""):w,k=(0,c.useMemo)(()=>es(_(w).map(Ft)),[_,w]);return a?p().createElement(Ye.MultiSelect,{"aria-label":(0,le.t)("grafana-scenes.variables.group-by-variable-renderer.aria-label-group-by-selector","Group by selector"),"data-testid":`GroupBySelect-${r}`,id:r,placeholder:(0,le.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:k,filterOption:jt,closeMenuOnSelect:!1,isOpen:b,isClearable:!0,hideSelectedOptions:!1,isLoading:g,components:{Option:xt,...C?{IndicatorsContainer:()=>p().createElement(Pt,{model:e})}:{},MultiValueContainer:({innerProps:e,children:t})=>p().createElement(Mt,{innerProps:e,keysApplicability:f},t)},onInputChange:O,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),E(t)},onOpenMenu:async()=>{const t=Vt(e);null==t||t.startInteraction(K),v(!0),await(0,h.lastValueFrom)(e.validateAndUpdate()),v(!1),y(!0),null==t||t.stopInteraction()},onCloseMenu:()=>{y(!1)}}):p().createElement(Ye.Select,{"aria-label":(0,le.t)("grafana-scenes.variables.group-by-variable-renderer.aria-label-group-by-selector","Group by selector"),"data-testid":`GroupBySelect-${r}`,id:r,placeholder:(0,le.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:k,filterOption:jt,closeMenuOnSelect:!0,isOpen:b,isClearable:!0,hideSelectedOptions:!1,noValueOnClear:!0,isLoading:g,onInputChange:O,onChange:(t,n)=>{if("clear"===n.action)return E([]),void(o&&e.changeValueTo([]));(null==t?void 0:t.value)&&(E([t]),e.changeValueTo([t.value],t.label?[t.label]:void 0))},onOpenMenu:async()=>{const t=Vt(e);null==t||t.startInteraction(K),v(!0),await(0,h.lastValueFrom)(e.validateAndUpdate()),v(!1),y(!0),null==t||t.stopInteraction()},onCloseMenu:()=>{y(!1)}})};const jt=()=>!0;function Ft(e){const{label:t,value:n,group:r}=e,a={label:t,value:n};return r&&(a.group=r),a}let zt;const Bt=new Set;function Ut(e){return p().createElement(Ye.Tooltip,{content:(0,le.t)("grafana-scenes.utils.loading-indicator.content-cancel-query","Cancel query")},p().createElement(Ye.Icon,{className:"spin-clockwise",name:"sync",size:"xs",role:"button",onMouseDown:t=>{e.onCancel(t)}}))}function Wt(e){const t=(0,Ye.useStyles2)(Ht),n=(0,Ye.useTheme2)(),r="vertical"===e.layout,a=Boolean(e.isLoading)?p().createElement("div",{style:{marginLeft:n.spacing(1),marginTop:"-1px"},"aria-label":it.components.LoadingIndicator.icon},p().createElement(Ut,{onCancel:t=>{var n;t.preventDefault(),t.stopPropagation(),null==(n=e.onCancel)||n.call(e)}})):null;let i=null;e.error&&(i=p().createElement(Ye.Tooltip,{content:e.error,placement:"bottom"},p().createElement(Ye.Icon,{className:t.errorIcon,name:"exclamation-triangle"})));let o=null;e.description&&(o=p().createElement(Ye.Tooltip,{content:e.description,placement:r?"top":"bottom"},p().createElement(Ye.Icon,{className:t.normalIcon,name:"info-circle"})));const s="string"==typeof e.label?it.pages.Dashboard.SubMenu.submenuItemLabels(e.label):"";let l;return l=r?p().createElement("label",{className:(0,ot.cx)(t.verticalLabel,e.className),"data-testid":s,htmlFor:e.htmlFor},e.prefix,e.label,o,i,e.icon&&p().createElement(Ye.Icon,{name:e.icon,className:t.normalIcon}),a,e.onRemove&&p().createElement(Ye.IconButton,{variant:"secondary",size:"xs",name:"times",onClick:e.onRemove,tooltip:(0,le.t)("grafana-scenes.utils.controls-label.tooltip-remove","Remove")}),e.suffix):p().createElement("label",{className:(0,ot.cx)(t.horizontalLabel,e.className),"data-testid":s,htmlFor:e.htmlFor},e.prefix,i,e.icon&&p().createElement(Ye.Icon,{name:e.icon,className:t.normalIcon}),e.label,o,a,e.suffix),l}const Ht=e=>({horizontalLabel:(0,ot.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,ot.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,ot.css)({color:e.colors.error.text}),normalIcon:(0,ot.css)({color:e.colors.text.secondary})});function qt(e){const t=e.map(e=>{var t;return null!=(t=e.label)?t:String(e.value)});return n=>mt(e,t,n)}function Gt(e,t){return""!==e?{value:e,label:t||e}:null}const Qt=()=>!0;function Kt({filter:e,model:t}){var n,r,a,i,o;const s=(0,Ye.useStyles2)(Yt),[l,u]=(0,c.useState)([]),[d,h]=(0,c.useState)([]),[f,m]=(0,c.useState)(!1),[g,v]=(0,c.useState)(!1),[b,y]=(0,c.useState)(!1),[w,S]=(0,c.useState)(!1),[x,E]=(0,c.useState)(!1),[_,C]=(0,c.useState)(""),[R,O]=(0,c.useState)(!1),[k,D]=(0,c.useState)(e.values?e.values.map((t,n)=>{var r;return Gt(t,null==(r=e.valueLabels)?void 0:r[n])}):[]),A=Io(e.operator),T=Gt(e.key,e.keyLabel),I=Gt(e.value,null==(n=e.valueLabels)?void 0:n[0]),P=(0,c.useMemo)(()=>qt(d),[d]),L=t.state.onAddCustomValue,M=(0,c.useMemo)(()=>es(P(_)),[P,_]),N={isMulti:!0,value:k,components:{Option:xt},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=k[0])?void 0:n.value)?r:"",values:k.map(e=>e.value),valueLabels:k.map(e=>e.label)})}},V=_o.find(t=>e.operator===t.value),$=p().createElement(Ye.Select,{virtualized:!0,allowCustomValue:null==(r=t.state.allowCustomValue)||r,createOptionPosition:(null==V?void 0:V.isRegex)?"first":"last",isValidNewOption:e=>e.trim().length>0,allowCreateWhileLoading:!0,formatCreateLabel:e=>`Use custom value: ${e}`,disabled:t.state.readOnly,className:(0,ot.cx)(s.value,w?s.widthWhenOpen:void 0),width:"auto",value:I,filterOption:Qt,placeholder:(0,le.t)("grafana-scenes.variables.ad-hoc-filter-renderer.value-select.placeholder-select-value","Select value"),options:M,inputValue:_,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),h(r),R&&C(null!=(n=null==I?void 0:I.label)?n:"")},onCloseMenu:()=>{S(!1),C("")},...A&&N}),j=p().createElement(Ye.Select,{key:""+(g?"loading":"loaded"),disabled:t.state.readOnly,className:(0,ot.cx)(s.key,b?s.widthWhenOpen:void 0),width:"auto",allowCustomValue:null==(a=t.state.allowCustomValue)||a,createOptionPosition:(null==V?void 0:V.isRegex)?"first":"last",value:T,placeholder:(0,le.t)("grafana-scenes.variables.ad-hoc-filter-renderer.key-select.placeholder-select-label","Select label"),options:es(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}),F=p().createElement(Ye.Select,{className:(0,ot.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};Io(i)&&!Io(o)?(s.value="",s.valueLabels=[""],s.values=void 0,D([])):!Io(i)&&Io(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:()=>{E(!0)},onCloseMenu:()=>{E(!1)}});if("vertical"===t.state.layout){if(e.key){const n=p().createElement(Wt,{layout:"vertical",label:null!=(i=e.key)?i:"",onRemove:()=>t._removeFilter(e)});return p().createElement(Ye.Field,{label:n,"data-testid":`AdHocFilter-${e.key}`,className:s.field},p().createElement("div",{className:s.wrapper},F,$))}return p().createElement(Ye.Field,{label:(0,le.t)("grafana-scenes.variables.ad-hoc-filter-renderer.label-select-label","Select label"),"data-testid":`AdHocFilter-${e.key}`,className:s.field},j)}return p().createElement("div",{className:s.wrapper,"data-testid":`AdHocFilter-${e.key}`},j,F,$,p().createElement(Ye.Button,{variant:"secondary","aria-label":(0,le.t)("grafana-scenes.variables.ad-hoc-filter-renderer.aria-label-remove-filter","Remove filter"),title:(0,le.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 Yt=e=>({field:(0,ot.css)({marginBottom:0}),wrapper:(0,ot.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,ot.css)({minWidth:e.spacing(16)}),value:(0,ot.css)({flexBasis:"content",flexShrink:1,minWidth:"90px"}),key:(0,ot.css)({flexBasis:"content",minWidth:"90px",flexShrink:1}),operator:(0,ot.css)({flexShrink:0,flexBasis:"content"}),removeButton:(0,ot.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 Xt({model:e,addFilterButtonText:t}){const{_wip:n}=e.useState();return n?p().createElement(Kt,{filter:n,model:e}):p().createElement(Ye.Button,{variant:"secondary",icon:"plus",title:(0,le.t)("grafana-scenes.variables.ad-hoc-filter-builder.title-add-filter","Add filter"),"aria-label":(0,le.t)("grafana-scenes.variables.ad-hoc-filter-builder.aria-label-add-filter","Add filter"),"data-testid":"AdHocFilter-add",onClick:()=>e._addWip()},t)}class Zt{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(Ao).filter(e=>!e.hidden).map(e=>Jt(e).map(Ko).join("|"))),(null==t?void 0:t.length)&&n.push(...null==t?void 0:t.filter(Ao).filter(e=>!e.hidden&&e.origin&&e.restorable).map(e=>Jt(e).map(Ko).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(en).filter(tn)}const t=en(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?(Do(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 Jt(e){var t;const n=[Xo(e.key,e.keyLabel),e.operator];return Io(e.operator)?e.values.forEach((t,r)=>{var a;n.push(Xo(t,null==(a=e.valueLabels)?void 0:a[r]))}):n.push(Xo(e.value,null==(t=e.valueLabels)?void 0:t[0])),n}function en(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(Yo);return{key:a,keyLabel:i,operator:o,value:l[0],values:Io(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 tn(e){return null!==e&&"string"==typeof e.key&&"string"==typeof e.value}function nn(){return"undefined"!=typeof window}function rn(e){return sn(e)?(e.nodeName||"").toLowerCase():"#document"}function an(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function on(e){var t;return null==(t=(sn(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function sn(e){return!!nn()&&(e instanceof Node||e instanceof an(e).Node)}function ln(e){return!!nn()&&(e instanceof Element||e instanceof an(e).Element)}function un(e){return!!nn()&&(e instanceof HTMLElement||e instanceof an(e).HTMLElement)}function cn(e){return!(!nn()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof an(e).ShadowRoot)}const dn=new Set(["inline","contents"]);function pn(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=_n(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!dn.has(a)}const hn=new Set(["table","td","th"]);function fn(e){return hn.has(rn(e))}const mn=[":popover-open",":modal"];function gn(e){return mn.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const vn=["transform","translate","scale","rotate","perspective"],bn=["transform","translate","scale","rotate","perspective","filter"],yn=["paint","layout","strict","content"];function wn(e){const t=Sn(),n=ln(e)?_n(e):e;return vn.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||bn.some(e=>(n.willChange||"").includes(e))||yn.some(e=>(n.contain||"").includes(e))}function Sn(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const xn=new Set(["html","body","#document"]);function En(e){return xn.has(rn(e))}function _n(e){return an(e).getComputedStyle(e)}function Cn(e){return ln(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rn(e){if("html"===rn(e))return e;const t=e.assignedSlot||e.parentNode||cn(e)&&e.host||on(e);return cn(t)?t.host:t}function On(e){const t=Rn(e);return En(t)?e.ownerDocument?e.ownerDocument.body:e.body:un(t)&&pn(t)?t:On(t)}function kn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const a=On(e),i=a===(null==(r=e.ownerDocument)?void 0:r.body),o=an(a);if(i){const e=Dn(o);return t.concat(o,o.visualViewport||[],pn(a)?a:[],e&&n?kn(e):[])}return t.concat(a,kn(a,[],n))}function Dn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function An(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 Tn(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&cn(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function In(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function Pn(){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 Ln(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Vn()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function Mn(e){return!Pn().includes("jsdom/")&&(!Vn()&&0===e.width&&0===e.height||Vn()&&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 Nn(){return/apple/i.test(navigator.vendor)}function Vn(){const e=/android/i;return e.test(In())||e.test(Pn())}function $n(e){return(null==e?void 0:e.ownerDocument)||document}function jn(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 Fn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function zn(e){e.preventDefault(),e.stopPropagation()}function Bn(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return un(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}const Un=Math.min,Wn=Math.max,Hn=Math.round,qn=Math.floor,Gn=e=>({x:e,y:e}),Qn={left:"right",right:"left",bottom:"top",top:"bottom"},Kn={start:"end",end:"start"};function Yn(e,t){return"function"==typeof e?e(t):e}function Xn(e){return e.split("-")[0]}function Zn(e){return e.split("-")[1]}function Jn(e){return"y"===e?"height":"width"}const er=new Set(["top","bottom"]);function tr(e){return er.has(Xn(e))?"y":"x"}function nr(e){return"x"===tr(e)?"y":"x"}function rr(e){return e.replace(/start|end/g,e=>Kn[e])}const ar=["left","right"],ir=["right","left"],or=["top","bottom"],sr=["bottom","top"];function lr(e,t,n,r){const a=Zn(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?ir:ar:t?ar:ir;case"left":case"right":return t?or:sr;default:return[]}}(Xn(e),"start"===n,r);return a&&(i=i.map(e=>e+"-"+a),t&&(i=i.concat(i.map(rr)))),i}function ur(e){return e.replace(/left|right|bottom|top/g,e=>Qn[e])}function cr(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 dr=["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])"],pr=dr.join(","),hr="undefined"==typeof Element,fr=hr?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,mr=!hr&&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},gr=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)},vr=function(e,t,n){if(gr(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(pr));return t&&fr.call(e,pr)&&r.unshift(e),r=r.filter(n)},br=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var o=i.shift();if(!gr(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{fr.call(o,pr)&&r.filter(o)&&(n||!t.includes(o))&&a.push(o);var u=o.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(o),c=!gr(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},yr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},wr=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))&&!yr(e)?0:e.tabIndex},Sr=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},xr=function(e){return"INPUT"===e.tagName},Er=function(e){return function(e){return xr(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||mr(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)},_r=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Cr=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var a=fr.call(e,"details>summary:first-of-type")?e.parentElement:e;if(fr.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return _r(e)}else{if("function"==typeof r){for(var i=e;e;){var o=e.parentElement,s=mr(e);if(o&&!o.shadowRoot&&!0===r(o))return _r(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&&mr(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=mr(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},Rr=function(e,t){return!(t.disabled||gr(t)||function(e){return xr(e)&&"hidden"===e.type}(t)||Cr(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!!fr.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Or=function(e,t){return!(Er(t)||wr(t)<0||!Rr(e,t))},kr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Dr=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=wr(e);return n<0&&t&&!yr(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(Sr).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(n)},Ar=function(e,t){var n;return n=(t=t||{}).getShadowRoot?br([e],t.includeContainer,{filter:Or.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:kr}):vr(e,t.includeContainer,Or.bind(null,t)),Dr(n)},Tr=n(8398);function Ir(e,t,n){let{reference:r,floating:a}=e;const i=tr(t),o=nr(t),s=Jn(o),l=Xn(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(Zn(t)){case"start":h[o]-=p*(n&&u?-1:1);break;case"end":h[o]+=p*(n&&u?-1:1)}return h}async function Pr(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}=Yn(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=cr(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=cr(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 Lr=new Set(["left","top"]);function Mr(e){const t=_n(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=un(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,s=Hn(n)!==i||Hn(r)!==o;return s&&(n=i,r=o),{width:n,height:r,$:s}}function Nr(e){return ln(e)?e:e.contextElement}function Vr(e){const t=Nr(e);if(!un(t))return Gn(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=Mr(t);let o=(i?Hn(n.width):n.width)/r,s=(i?Hn(n.height):n.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}const $r=Gn(0);function jr(e){const t=an(e);return Sn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:$r}function Fr(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const a=e.getBoundingClientRect(),i=Nr(e);let o=Gn(1);t&&(r?ln(r)&&(o=Vr(r)):o=Vr(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==an(e))&&t}(i,n,r)?jr(i):Gn(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=an(i),t=r&&ln(r)?an(r):r;let n=e,a=Dn(n);for(;a&&r&&t!==n;){const e=Vr(a),t=a.getBoundingClientRect(),r=_n(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=an(a),a=Dn(n)}}return cr({width:c,height:d,x:l,y:u})}function zr(e,t){const n=Cn(e).scrollLeft;return t?t.left+n:Fr(on(e)).left+n}function Br(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-zr(e,n),y:n.top+t.scrollTop}}const Ur=new Set(["absolute","fixed"]);function Wr(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=an(e),r=on(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=Sn();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}const u=zr(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=on(e),n=Cn(e),r=e.ownerDocument.body,a=Wn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Wn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+zr(e);const s=-n.scrollTop;return"rtl"===_n(r).direction&&(o+=Wn(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:s}}(on(e));else if(ln(t))r=function(e,t){const n=Fr(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=un(e)?Vr(e):Gn(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=jr(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return cr(r)}function Hr(e,t){const n=Rn(e);return!(n===t||!ln(n)||En(n))&&("fixed"===_n(n).position||Hr(n,t))}function qr(e,t,n){const r=un(t),a=on(t),i="fixed"===n,o=Fr(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Gn(0);function u(){l.x=zr(a)}if(r||!r&&!i)if(("body"!==rn(t)||pn(a))&&(s=Cn(t)),r){const e=Fr(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?Gn(0):Br(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 Gr(e){return"static"===_n(e).position}function Qr(e,t){if(!un(e)||"fixed"===_n(e).position)return null;if(t)return t(e);let n=e.offsetParent;return on(e)===n&&(n=n.ownerDocument.body),n}function Kr(e,t){const n=an(e);if(gn(e))return n;if(!un(e)){let t=Rn(e);for(;t&&!En(t);){if(ln(t)&&!Gr(t))return t;t=Rn(t)}return n}let r=Qr(e,t);for(;r&&fn(r)&&Gr(r);)r=Qr(r,t);return r&&En(r)&&Gr(r)&&!wn(r)?n:r||function(e){let t=Rn(e);for(;un(t)&&!En(t);){if(wn(t))return t;if(gn(t))return null;t=Rn(t)}return null}(e)||n}const Yr={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i="fixed"===a,o=on(r),s=!!t&&gn(t.floating);if(r===o||s&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Gn(1);const c=Gn(0),d=un(r);if((d||!d&&!i)&&(("body"!==rn(r)||pn(o))&&(l=Cn(r)),un(r))){const e=Fr(r);u=Vr(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}const p=!o||d||i?Gn(0):Br(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:on,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const i=[..."clippingAncestors"===n?gn(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=kn(e,[],!1).filter(e=>ln(e)&&"body"!==rn(e)),a=null;const i="fixed"===_n(e).position;let o=i?Rn(e):e;for(;ln(o)&&!En(o);){const t=_n(o),n=wn(o);n||"fixed"!==t.position||(a=null),(i?!n&&!a:!n&&"static"===t.position&&a&&Ur.has(a.position)||pn(o)&&!n&&Hr(e,o))?r=r.filter(e=>e!==o):a=t,o=Rn(o)}return t.set(e,r),r}(t,this._c):[].concat(n),r],o=i[0],s=i.reduce((e,n)=>{const r=Wr(t,n,a);return e.top=Wn(r.top,e.top),e.right=Un(r.right,e.right),e.bottom=Un(r.bottom,e.bottom),e.left=Wn(r.left,e.left),e},Wr(t,o,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Kr,getElementRects:async function(e){const t=this.getOffsetParent||Kr,n=this.getDimensions,r=await n(e.floating);return{reference:qr(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}=Mr(e);return{width:t,height:n}},getScale:Vr,isElement:ln,isRTL:function(e){return"rtl"===_n(e).direction}};function Xr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zr(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=Nr(e),c=a||i?[...u?kn(u):[],...kn(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=on(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:-qn(d)+"px "+-qn(a.clientWidth-(c+p))+"px "+-qn(a.clientHeight-(d+h))+"px "+-qn(c)+"px",threshold:Wn(0,Un(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||Xr(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?Fr(e):null;return l&&function t(){const r=Fr(e);m&&!Xr(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 Jr=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=Xn(n),s=Zn(n),l="y"===tr(n),u=Lr.has(o)?-1:1,c=i&&l?-1:1,d=Yn(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}}}}},ea=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}=Yn(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Xn(a),b=tr(s),y=Xn(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(u.floating)),S=p||(y||!m?[ur(s)]:function(e){const t=ur(e);return[rr(e),t,rr(t)]}(s)),x="none"!==f;!p&&x&&S.push(...lr(s,m,f,w));const E=[s,...S],_=await Pr(t,g),C=[];let R=(null==(r=i.flip)?void 0:r.overflows)||[];if(c&&C.push(_[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Zn(e),a=nr(e),i=Jn(a);let o="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ur(o)),[o,ur(o)]}(a,o,w);C.push(_[e[0]],_[e[1]])}if(R=[...R,{placement:a,overflows:C}],!C.every(e=>e<=0)){var O,k;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=E[e];if(t){if(!("alignment"===d&&b!==tr(t))||R.every(e=>tr(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:R},reset:{placement:t}}}let n=null==(k=R.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!n)switch(h){case"bestFit":{var D;const e=null==(D=R.filter(e=>{if(x){const t=tr(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{}}}},ta=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}=Yn(e,t),c=await Pr(t,u),d=Xn(a),p=Zn(a),h="y"===tr(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=Un(m-c[g],b),S=Un(f-c[v],y),x=!t.middlewareData.shift;let E=w,_=S;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(_=y),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(E=b),x&&!p){const e=Wn(c.left,0),t=Wn(c.right,0),n=Wn(c.top,0),r=Wn(c.bottom,0);h?_=f-2*(0!==e||0!==t?e+t:Wn(c.left,c.right)):E=m-2*(0!==n||0!==r?n+r:Wn(c.top,c.bottom))}await l({...t,availableWidth:_,availableHeight:E});const C=await o.getDimensions(s.floating);return f!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},na=(e,t,n)=>{const r=new Map,a={platform:Yr,...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}=Ir(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}=Ir(u,p,l))),n=-1)}return{x:c,y:d,placement:p,strategy:a,middlewareData:h}})(e,t,{...a,platform:i})};var ra="undefined"!=typeof document?c.useLayoutEffect:function(){};function aa(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(!aa(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)&&!aa(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ia(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oa(e,t){const n=ia(e);return Math.round(t*n)/n}function sa(e){const t=c.useRef(e);return ra(()=>{t.current=e}),t}const la=(e,t)=>({...ea(e),options:[e,t]}),ua=(e,t)=>({...ta(e),options:[e,t]});const ca={...d},da=ca.useInsertionEffect||(e=>e());function pa(e){const t=c.useRef(()=>{0});return da(()=>{t.current=e}),c.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 ha="ArrowUp",fa="ArrowDown",ma="ArrowLeft",ga="ArrowRight";function va(e,t,n){return Math.floor(e/t)!==n}function ba(e,t){return t<0||t>=e.current.length}function ya(e,t){return Sa(e,{disabledIndices:t})}function wa(e,t){return Sa(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Sa(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&&Ra(o,s,a));return s}function xa(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===ha){if(d&&zn(n),-1===c)p=u;else if(p=Sa(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}ba(e,p)&&(p=c)}if(n.key===fa&&(d&&zn(n),-1===c?p=l:(p=Sa(e,{startingIndex:c,amount:o,disabledIndices:s}),a&&c+o>u&&(p=Sa(e,{startingIndex:c%o-o,amount:o,disabledIndices:s}))),ba(e,p)&&(p=c)),"both"===r){const t=qn(c/o);n.key===(i?ma:ga)&&(d&&zn(n),c%o!==o-1?(p=Sa(e,{startingIndex:c,disabledIndices:s}),a&&va(p,o,t)&&(p=Sa(e,{startingIndex:c-c%o-1,disabledIndices:s}))):a&&(p=Sa(e,{startingIndex:c-c%o-1,disabledIndices:s})),va(p,o,t)&&(p=c)),n.key===(i?ga:ma)&&(d&&zn(n),c%o!==0?(p=Sa(e,{startingIndex:c,decrement:!0,disabledIndices:s}),a&&va(p,o,t)&&(p=Sa(e,{startingIndex:c+(o-c%o),decrement:!0,disabledIndices:s}))):a&&(p=Sa(e,{startingIndex:c+(o-c%o),decrement:!0,disabledIndices:s})),va(p,o,t)&&(p=c));const r=qn(u/o)===t;ba(e,p)&&(p=a&&r?n.key===(i?ga:ma)?u:Sa(e,{startingIndex:c-c%o-1,disabledIndices:s}):c)}return p}function Ea(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 _a(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 Ca(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Ra(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 Oa="undefined"!=typeof document?c.useLayoutEffect:c.useEffect;const ka=[ma,ga],Da=[ha,fa];function Aa(){return Aa=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},Aa.apply(this,arguments)}let Ta=!1,Ia=0;const Pa=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ia++;const La=ca.useId||function(){const[e,t]=c.useState(()=>Ta?Pa():void 0);return Oa(()=>{null==e&&t(Pa())},[]),c.useEffect(()=>{Ta=!0},[]),e};function Ma(){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 Na=c.createContext(null),Va=c.createContext(null),$a=()=>{var e;return(null==(e=c.useContext(Na))?void 0:e.id)||null},ja=()=>c.useContext(Va);function Fa(e){return"data-floating-ui-"+e}function za(e){const t=(0,c.useRef)(e);return Oa(()=>{t.current=e}),t}let Ba=0;function Ua(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:a=!1}=t;r&&cancelAnimationFrame(Ba);const i=()=>null==e?void 0:e.focus({preventScroll:n});a?i():Ba=requestAnimationFrame(i)}function Wa(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 Ha=new WeakMap,qa=new WeakSet,Ga={},Qa=0;const Ka=e=>e&&(e.host||Ka(e.parentNode));function Ya(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=Ka(e);return s.contains(t)?t:null}).filter(e=>null!=e));var s;const l=new Set,u=new Set(o),c=[];Ga[a]||(Ga[a]=new WeakMap);const d=Ga[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"!==rn(t))if(l.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(Ha.get(t)||0)+1,o=(d.get(t)||0)+1;Ha.set(t,r),d.set(t,o),c.push(t),1===r&&n&&qa.add(t),1===o&&t.setAttribute(a,""),!n&&i&&t.setAttribute(i,"true")}})}(t),l.clear(),Qa++,()=>{c.forEach(e=>{const t=(Ha.get(e)||0)-1,n=(d.get(e)||0)-1;Ha.set(e,t),d.set(e,n),t||(!qa.has(e)&&i&&e.removeAttribute(i),qa.delete(e)),n||e.removeAttribute(a)}),Qa--,Qa||(Ha=new WeakMap,Ha=new WeakMap,qa=new WeakSet,Ga={})}}function Xa(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=$n(e[0]).body;return Ya(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Za=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ja(e,t){const n=Ar(e,Za());"prev"===t&&n.reverse();const r=n.indexOf(An($n(e)));return n.slice(r+1)[0]}function ei(){return Ja(document.body,"next")}function ti(){return Ja(document.body,"prev")}function ni(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Tn(n,r)}function ri(e){Ar(e,Za()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function ai(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 ii={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 oi(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const si=c.forwardRef(function(e,t){const[n,r]=c.useState();Oa(()=>(Nn()&&r("button"),document.addEventListener("keydown",oi),()=>{document.removeEventListener("keydown",oi)}),[]);const a={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Fa("focus-guard")]:"",style:ii};return c.createElement("span",Aa({},e,a))}),li=c.createContext(null),ui=Fa("portal");function ci(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=La(),a=di(),[i,o]=c.useState(null),s=c.useRef(null);return Oa(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{s.current=null})},[i]),Oa(()=>{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(ui,""),e.appendChild(n),s.current=n,o(n)},[t,r]),Oa(()=>{if(null===n)return;if(!r)return;if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!ln(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(ui,""),e=i||e,e.appendChild(l),s.current=l,o(l)},[t,n,r,a]),i}({id:n,root:r}),[o,s]=c.useState(null),l=c.useRef(null),u=c.useRef(null),d=c.useRef(null),p=c.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 c.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&&ni(e)){("focusin"===e.type?ai:ri)(i)}}},[i,a,h]),c.useEffect(()=>{i&&(f||ai(i))},[f,i]),c.createElement(li.Provider,{value:c.useMemo(()=>({preserveTabOrder:a,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:p,portalNode:i,setFocusManagerState:s}),[a,i])},m&&i&&c.createElement(si,{"data-type":"outside",ref:l,onFocus:e=>{if(ni(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=ti()||(null==o?void 0:o.refs.domReference.current);null==e||e.focus()}}}),m&&i&&c.createElement("span",{"aria-owns":i.id,style:ii}),i&&Tr.createPortal(t,i),m&&i&&c.createElement(si,{"data-type":"outside",ref:u,onFocus:e=>{if(ni(e,i)){var t;null==(t=p.current)||t.focus()}else{const t=ei()||(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 di=()=>c.useContext(li),pi="data-floating-ui-focusable";function hi(e){return e?e.hasAttribute(pi)?e:e.querySelector("["+pi+"]")||e:null}let fi=[];function mi(e){fi=fi.filter(e=>e.isConnected);let t=e;if(t&&"body"!==rn(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==fr.call(e,pr)&&Or(t,e)}(t,Za())){const e=Ar(t,Za())[0];e&&(t=e)}fi.push(t),fi.length>20&&(fi=fi.slice(-20))}}function gi(){return fi.slice().reverse().find(e=>e.isConnected)}const vi=c.forwardRef(function(e,t){return c.createElement("button",Aa({},e,{type:"button",ref:t,tabIndex:-1,style:ii}))});function bi(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:d=!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,E=Bn(w)&&x,_="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||i,C=za(a),R=za(o),O=za(s),k=ja(),D=di(),A=c.useRef(null),T=c.useRef(null),I=c.useRef(!1),P=c.useRef(!1),L=c.useRef(-1),M=null!=D,N=hi(S),V=pa(function(e){return void 0===e&&(e=N),e?Ar(e,Za()):[]}),$=pa(e=>{const t=V(e);return C.current.map(e=>w&&"reference"===e?w:N&&"floating"===e?N:t).filter(Boolean).flat()});function j(e){return!r&&d&&u?c.createElement(vi,{ref:"start"===e?A:T,onClick:e=>g(!1,e.nativeEvent)},"string"==typeof d?d:"Dismiss"):null}c.useEffect(()=>{if(r)return;if(!u)return;function e(e){if("Tab"===e.key){Tn(N,An($n(N)))&&0===V().length&&!E&&zn(e);const t=$(),n=Fn(e);"reference"===C.current[0]&&n===w&&(zn(e),e.shiftKey?Ua(t[t.length-1]):Ua(t[1])),"floating"===C.current[1]&&n===N&&e.shiftKey&&(zn(e),Ua(t[0]))}}const t=$n(N);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,w,N,u,C,E,V,$]),c.useEffect(()=>{if(!r&&S)return S.addEventListener("focusin",e),()=>{S.removeEventListener("focusin",e)};function e(e){const t=Fn(e),n=V().indexOf(t);-1!==n&&(L.current=n)}},[r,S,V]),c.useEffect(()=>{if(!r&&p)return S&&un(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(){P.current=!0,setTimeout(()=>{P.current=!1})}function t(e){const t=e.relatedTarget;queueMicrotask(()=>{const n=!(Tn(w,t)||Tn(S,t)||Tn(t,S)||Tn(null==D?void 0:D.portalNode,t)||null!=t&&t.hasAttribute(Fa("focus-guard"))||k&&(Wa(k.nodesRef.current,m).find(e=>{var n,r;return Tn(null==(n=e.context)?void 0:n.elements.floating,t)||Tn(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}(k.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&&An($n(N))===$n(N).body){un(N)&&N.focus();const e=L.current,t=V(),n=t[e]||t[t.length-1]||N;un(n)&&n.focus()}!E&&u||!t||!n||P.current||t===gi()||(I.current=!0,g(!1,e,"focus-out"))})}},[r,w,S,N,u,m,k,D,g,p,l,V,E]),c.useEffect(()=>{var e;if(r)return;const t=Array.from((null==D||null==(e=D.portalNode)?void 0:e.querySelectorAll("["+Fa("portal")+"]"))||[]);if(S){const e=[S,...t,A.current,T.current,C.current.includes("reference")||E?w:null].filter(e=>null!=e),n=u||E?Xa(e,_,!_):Xa(e);return()=>{n()}}},[r,w,S,u,C,D,E,_]),Oa(()=>{if(r||!un(N))return;const e=An($n(N));queueMicrotask(()=>{const t=$(N),n=R.current,r=("number"==typeof n?t[n]:n.current)||N,a=Tn(N,e);x||a||!h||Ua(r,{preventScroll:r===N})})},[r,h,N,x,$,R]),Oa(()=>{if(r||!N)return;let e=!1;const t=$n(N),n=An(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&&mi(f.domReference.current),"hover"===r&&"mouseleave"===i.type&&(I.current=!0),"outside-press"===r&&(o?(I.current=!1,e=!0):I.current=!(Ln(i)||Mn(i)))}mi(n),v.on("openchange",i);const o=t.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,ii),M&&w&&w.insertAdjacentElement("afterend",o),()=>{v.off("openchange",i);const n=An(t),r=Tn(S,n)||k&&Wa(k.nodesRef.current,m).some(e=>{var t;return Tn(null==(t=e.context)?void 0:t.elements.floating,n)});(r||a&&["click","mousedown"].includes(a.type))&&f.domReference.current&&mi(f.domReference.current);const s="boolean"==typeof O.current?gi()||o:O.current.current||o;queueMicrotask(()=>{O.current&&!I.current&&un(s)&&(s===n||n===t.body||r)&&s.focus({preventScroll:e}),o.remove()})}},[r,S,N,O,b,f,v,k,m,M,w]),c.useEffect(()=>{queueMicrotask(()=>{I.current=!1})},[r]),Oa(()=>{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]),Oa(()=>{if(r)return;if(!N)return;if("function"!=typeof MutationObserver)return;if(x)return;const e=()=>{const e=N.getAttribute("tabindex"),t=V(),n=An($n(S)),r=t.indexOf(n);-1!==r&&(L.current=r),C.current.includes("floating")||n!==f.domReference.current&&0===t.length?"0"!==e&&N.setAttribute("tabindex","0"):"-1"!==e&&N.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(N,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,S,N,f,C,V,x]);const F=!r&&_&&(!u||!E)&&(M||u);return c.createElement(c.Fragment,null,F&&c.createElement(si,{"data-type":"inside",ref:null==D?void 0:D.beforeInsideRef,onFocus:e=>{if(u){const e=$();Ua("reference"===a[0]?e[0]:e[e.length-1])}else if(null!=D&&D.preserveTabOrder&&D.portalNode)if(I.current=!1,ni(e,D.portalNode)){const e=ei()||w;null==e||e.focus()}else{var t;null==(t=D.beforeOutsideRef.current)||t.focus()}}}),!E&&j("start"),n,j("end"),F&&c.createElement(si,{"data-type":"inside",ref:null==D?void 0:D.afterInsideRef,onFocus:e=>{if(u)Ua($()[0]);else if(null!=D&&D.preserveTabOrder&&D.portalNode)if(p&&(I.current=!0),ni(e,D.portalNode)){const e=ti()||w;null==e||e.focus()}else{var t;null==(t=D.afterOutsideRef.current)||t.focus()}}}))}const yi={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},wi={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Si=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 xi(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,a=La(),i=c.useRef({}),[o]=c.useState(()=>Ma()),s=null!=$a(),[l,u]=c.useState(r.reference),d=pa((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=c.useMemo(()=>({setPositionReference:u}),[]),h=c.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return c.useMemo(()=>({dataRef:i,open:t,onOpenChange:d,elements:h,events:o,floatingId:a,refs:p}),[t,d,h,o,a,p])}({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,a=r.elements,[i,o]=c.useState(null),[s,l]=c.useState(null),u=(null==a?void 0:a.domReference)||i,d=c.useRef(null),p=ja();Oa(()=>{u&&(d.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,[d,p]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=c.useState(r);aa(h,r)||f(r);const[m,g]=c.useState(null),[v,b]=c.useState(null),y=c.useCallback(e=>{e!==E.current&&(E.current=e,g(e))},[]),w=c.useCallback(e=>{e!==_.current&&(_.current=e,b(e))},[]),S=i||m,x=o||v,E=c.useRef(null),_=c.useRef(null),C=c.useRef(d),R=null!=l,O=sa(l),k=sa(a),D=sa(u),A=c.useCallback(()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:h};k.current&&(e.platform=k.current),na(E.current,_.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};T.current&&!aa(C.current,t)&&(C.current=t,Tr.flushSync(()=>{p(t)}))})},[h,t,n,k,D]);ra(()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const T=c.useRef(!1);ra(()=>(T.current=!0,()=>{T.current=!1}),[]),ra(()=>{if(S&&(E.current=S),x&&(_.current=x),S&&x){if(O.current)return O.current(S,x,A);A()}},[S,x,A,O,R]);const I=c.useMemo(()=>({reference:E,floating:_,setReference:y,setFloating:w}),[y,w]),P=c.useMemo(()=>({reference:S,floating:x}),[S,x]),L=c.useMemo(()=>{const e={position:n,left:0,top:0};if(!P.floating)return e;const t=oa(P.floating,d.x),r=oa(P.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...ia(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,s,P.floating,d.x,d.y]);return c.useMemo(()=>({...d,update:A,refs:I,elements:P,floatingStyles:L}),[d,A,I,P,L])}({...e,elements:{...a,...s&&{reference:s}}}),f=c.useCallback(e=>{const t=ln(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l(t),h.refs.setReference(t)},[h.refs]),m=c.useCallback(e=>{(ln(e)||null===e)&&(d.current=e,o(e)),(ln(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!ln(e))&&h.refs.setReference(e)},[h.refs]),g=c.useMemo(()=>({...h.refs,setReference:m,setPositionReference:f,domReference:d}),[h.refs,m,f]),v=c.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),b=c.useMemo(()=>({...h,...r,refs:g,elements:v,nodeId:t}),[h,g,v,t,r]);return Oa(()=>{r.dataRef.current.floatingContext=b;const e=null==p?void 0:p.nodesRef.current.find(e=>e.id===t);e&&(e.context=b)}),c.useMemo(()=>({...h,context:b,refs:g,elements:v}),[h,g,v,b])}const Ei="active",_i="selected";function Ci(e,t,n){const r=new Map,a="item"===n;let i=e;if(a&&e){const{[Ei]:t,[_i]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[pi]:""},...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&&[Ei,_i].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 Ri=!1;function Oi(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ki(e,t){return Oi(t,e===ha||e===fa,e===ma||e===ga)}function Di(e,t,n){return Oi(t,e===fa,n?e===ma:e===ga)||"Enter"===e||" "===e||""===e}function Ai(e,t,n){return Oi(t,n?e===ga:e===ma,e===ha)}function Ti(e,t){const{open:n,onOpenChange:r,elements:a}=e,{listRef:i,activeIndex:o,onNavigate:s=()=>{},enabled:l=!0,selectedIndex:u=null,allowEscape:d=!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:E,itemSizes:_,dense:C=!1}=t;const R=za(hi(a.floating)),O=$a(),k=ja(),D=pa(s),A=Bn(a.domReference),T=c.useRef(g),I=c.useRef(null!=u?u:-1),P=c.useRef(null),L=c.useRef(!0),M=c.useRef(D),N=c.useRef(!!a.floating),V=c.useRef(n),$=c.useRef(!1),j=c.useRef(!1),F=za(y),z=za(n),B=za(x),U=za(u),[W,H]=c.useState(),[q,G]=c.useState(),Q=pa(function(e,t,n){function r(e){m?(H(e.id),null==k||k.events.emit("virtualfocus",e),E&&(E.current=e)):Ua(e,{preventScroll:!0,sync:!(!In().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!Nn())&&(Ri||$.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=B.current;o&&Y&&(n||!L.current)&&(null==i.scrollIntoView||i.scrollIntoView("boolean"==typeof o?{block:"nearest",inline:"nearest"}:o))})});Oa(()=>{document.createElement("div").focus({get preventScroll(){return Ri=!0,!1}})},[]),Oa(()=>{l&&(n&&a.floating?T.current&&null!=u&&(j.current=!0,I.current=u,D(u)):N.current&&(I.current=-1,M.current(null)))},[l,n,a.floating,u,D]),Oa(()=>{if(l&&n&&a.floating)if(null==o){if($.current=!1,null!=U.current)return;if(N.current&&(I.current=-1,Q(i,I)),(!V.current||!N.current)&&T.current&&(null!=P.current||!0===T.current&&null==P.current)){let e=0;const t=()=>{if(null==i.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else I.current=null==P.current||Di(P.current,w,f)||h?ya(i,F.current):wa(i,F.current),P.current=null,D(I.current)};t()}}else ba(i,o)||(I.current=o,Q(i,I,j.current),j.current=!1)},[l,n,a.floating,o,U,h,i,w,f,D,Q,F]),Oa(()=>{var e;if(!l||a.floating||!k||m||!N.current)return;const t=k.nodesRef.current,n=null==(e=t.find(e=>e.id===O))||null==(e=e.context)?void 0:e.elements.floating,r=An($n(a.floating)),i=t.some(e=>e.context&&Tn(e.context.elements.floating,r));n&&!i&&L.current&&n.focus({preventScroll:!0})},[l,a.floating,k,O,m]),Oa(()=>{if(l&&k&&m&&!O)return k.events.on("virtualfocus",e),()=>{k.events.off("virtualfocus",e)};function e(e){G(e.id),E&&(E.current=e)}},[l,k,m,O,E]),Oa(()=>{M.current=D,N.current=!!a.floating}),Oa(()=>{n||(P.current=null)},[n]),Oa(()=>{V.current=n},[n]);const K=null!=o,Y=c.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&&(I.current=-1,Q(i,I),D(null),m||Ua(R.current,{preventScroll:!0}))}}};return t},[n,R,Q,v,i,D,m]),X=pa(e=>{if(L.current=!1,$.current=!0,229===e.which)return;if(!z.current&&e.currentTarget===R.current)return;if(h&&Ai(e.key,w,f))return zn(e),r(!1,e.nativeEvent,"list-navigation"),void(un(a.domReference)&&(m?null==k||k.events.emit("virtualfocus",a.domReference):a.domReference.focus()));const t=I.current,o=ya(i,y),s=wa(i,y);if(A||("Home"===e.key&&(zn(e),I.current=o,D(I.current)),"End"===e.key&&(zn(e),I.current=s,D(I.current))),S>1){const t=_||Array.from({length:i.current.length},()=>({width:1,height:1})),n=Ea(t,S,C),r=n.findIndex(e=>null!=e&&!Ra(i.current,e,y)),a=n.reduce((e,t,n)=>null==t||Ra(i.current,t,y)?e:n,-1),l=n[xa({current:n.map(e=>null!=e?i.current[e]:null)},{event:e,orientation:w,loop:p,rtl:f,cols:S,disabledIndices:Ca([...y||i.current.map((e,t)=>Ra(i.current,t)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:_a(I.current>s?o:I.current,t,n,S,e.key===fa?"bl":e.key===(f?ma:ga)?"tr":"tl"),stopEvent:!0})];if(null!=l&&(I.current=l,D(I.current)),"both"===w)return}if(ki(e.key,w)){if(zn(e),n&&!m&&An(e.currentTarget.ownerDocument)===e.currentTarget)return I.current=Di(e.key,w,f)?o:s,void D(I.current);Di(e.key,w,f)?I.current=p?t>=s?d&&t!==i.current.length?-1:o:Sa(i,{startingIndex:t,disabledIndices:y}):Math.min(s,Sa(i,{startingIndex:t,disabledIndices:y})):I.current=p?t<=o?d&&-1!==t?i.current.length:s:Sa(i,{startingIndex:t,decrement:!0,disabledIndices:y}):Math.max(o,Sa(i,{startingIndex:t,decrement:!0,disabledIndices:y})),ba(i,I.current)?D(null):D(I.current)}}),Z=c.useMemo(()=>m&&n&&K&&{"aria-activedescendant":q||W},[m,n,K,q,W]),J=c.useMemo(()=>({"aria-orientation":"both"===w?void 0:w,...!Bn(a.domReference)&&Z,onKeyDown:X,onPointerMove(){L.current=!0}}),[Z,X,a.domReference,w]),ee=c.useMemo(()=>{function e(e){"auto"===g&&Ln(e.nativeEvent)&&(T.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 Oi(t,n?e===ma:e===ga,e===fa)}(e.key,w,f),l=Ai(e.key,w,f),c=ki(e.key,w),d=(h?s:c)||"Enter"===e.key||""===e.key.trim();if(m&&n){const t=null==k?void 0:k.nodesRef.current.find(e=>null==e.parentId),n=k&&t?function(e,t){let n,r=-1;return function t(a,i){i>r&&(n=a,r=i),Wa(e,a).forEach(e=>{t(e.id,i+1)})}(t,0),e.find(e=>e.id===n)}(k.nodesRef.current,t.id):null;if(o&&n&&E){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)===W):null;a&&(zn(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 zn(e),void(null==(v=n.context.elements.domReference)||v.dispatchEvent(t))}return X(e)}(n||b||!t)&&(d&&(P.current=h&&c?null:e.key),h?s&&(zn(e),n?(I.current=ya(i,F.current),D(I.current)):r(!0,e.nativeEvent,"list-navigation")):c&&(null!=u&&(I.current=u),zn(e),!n&&b?r(!0,e.nativeEvent,"list-navigation"):X(e),n&&D(I.current)))},onFocus(){n&&!m&&D(null)},onPointerDown:function(e){T.current=g,"auto"===g&&Mn(e.nativeEvent)&&(T.current=!0)},onMouseDown:e,onClick:e}},[W,Z,X,F,g,i,h,D,r,n,b,w,f,u,k,m,E]);return c.useMemo(()=>l?{reference:ee,floating:J,item:Y}:{},[l,ee,J,Y])}const Ii=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Pi(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 Li(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const Mi=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,a),n)}},Ni=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Vi=e=>e,$i=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},ji=(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(Ni(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(Ni(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Fi={passive:!0},zi="undefined"==typeof window||"onscrollend"in window,Bi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&zi?()=>{}:Mi(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,Fi);const u=e.options.useScrollendEvent&&zi;return u&&n.addEventListener("scrollend",l,Fi),()=>{n.removeEventListener("scroll",s),u&&n.removeEventListener("scrollend",l)}},Ui=(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"]},Wi=(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 Hi{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:Vi,rangeExtractor:$i,onChange:()=>{},measureElement:Ui,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=Pi(()=>(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=Pi(()=>[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=Pi(()=>[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=Pi(()=>[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=qi(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=Pi(()=>{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=Pi(()=>[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 Li(t[qi(0,t.length-1,e=>Li(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 qi=(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 Gi="undefined"!=typeof document?c.useLayoutEffect:c.useEffect;function Qi(e){const t=c.useReducer(()=>({}),{})[1],n={...e,onChange:(n,r)=>{var a;r?(0,Tr.flushSync)(t):t(),null==(a=e.onChange)||a.call(e,n,r)}},[r]=c.useState(()=>new Hi(n));return r.setOptions(n),Gi(()=>r._didMount(),[]),Gi(()=>r._willUpdate()),r}const Ki=(0,c.forwardRef)(function({children:e,active:t,addGroupBottomBorder:n,isMultiValueEdit:r,checked:a,...i},o){const s=(0,Ye.useStyles2)(Yi),l=(0,c.useId)();return p().createElement("div",{ref:o,role:"option",id:l,"aria-selected":t,className:(0,ot.cx)(s.option,t&&s.optionFocused,n&&s.groupBottomBorder),...i},p().createElement("div",{className:s.optionBody,"data-testid":`data-testid ad hoc filter option value ${e}`},p().createElement("span",null,r?p().createElement(Ye.Checkbox,{tabIndex:-1,checked:a,className:s.checkbox}):null,e)))}),Yi=e=>({option:(0,ot.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,ot.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,ot.css)({label:"grafana-select-option-body",display:"flex",fontWeight:e.typography.fontWeightMedium,flexDirection:"column",flexGrow:1}),groupBottomBorder:(0,ot.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),checkbox:(0,ot.css)({paddingRight:e.spacing(.5)}),multiValueApplyWrapper:(0,ot.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)}`})}),Xi=()=>p().createElement(Ki,{onClick:e=>e.stopPropagation()},p().createElement(le.x6,{i18nKey:"grafana-scenes.variables.loading-options-placeholder.loading-options"},"Loading options...")),Zi=()=>p().createElement(Ki,{onClick:e=>e.stopPropagation()},p().createElement(le.x6,{i18nKey:"grafana-scenes.variables.no-options-placeholder.no-options-found"},"No options found")),Ji=({handleFetchOptions:e})=>p().createElement(Ki,{onClick:e},p().createElement(le.x6,{i18nKey:"grafana-scenes.variables.options-error-placeholder.error-occurred-fetching-labels-click-retry"},"An error has occurred fetching labels. Click to retry")),eo=({onApply:e,floatingElement:t,maxOptionWidth:n,menuHeight:r})=>{const a=(0,Ye.useStyles2)(Yi),i=null==t?void 0:t.getBoundingClientRect();return p().createElement("div",{className:a.multiValueApplyWrapper,style:{width:`${n}px`,transform:`translate(${null==i?void 0:i.left}px,${i?i.top+r:0}px)`}},p().createElement(Ye.Button,{onClick:e,size:"sm",tabIndex:-1},p().createElement(le.x6,{i18nKey:"grafana-scenes.variables.multi-value-apply-button.apply"},"Apply")))},to={key:"operator",operator:"value",value:"key"},no=(e,t,n,r,a)=>ro(to[e],t,"value"===e?n:void 0,r,a),ro=(e,t,n,r,a)=>{t(e),null==n||n(void 0,a),setTimeout(()=>null==r?void 0:r.focus())},ao=({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(Io(n.operator)&&!Io(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(Io(t.value)&&!Io(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}},io="Filter by label values",oo=(e,t,n,r)=>{var a;return"key"===t?io:"value"===t?n?"Edit values":(null==(a=e.valueLabels)?void 0:a[0])||"":e[t]&&!r?`${e[t]}`:io},so=({populateInputOnEdit:e,item:t,filterInputType:n,setInputValue:r,filter:a})=>{var i,o,s;e&&!Io(t.value||"")&&"value"===to[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("")},lo=({open:e,onOpenChange:t,activeIndex:n,setActiveIndex:r,outsidePressIdsToIgnore:a,listRef:i,disabledIndicesRef:o})=>{const{refs:s,floatingStyles:l,context:u}=xi({whileElementsMounted:Zr,open:e,onOpenChange:t,placement:"bottom-start",middleware:[(d=10,{...Jr(d),options:[d,p]}),la({padding:10}),ua({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 d,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=Ii.get(o))?n:o,l=La(),u=null!=$a(),d=c.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=c.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=c.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 c.useMemo(()=>i?{reference:d,floating:p,item:h}:{},[i,d,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:d=!1,referencePressEvent:p="pointerdown",ancestorScroll:h=!1,bubbles:f,capture:m}=t,g=ja(),v=pa("function"==typeof l?l:()=>!1),b="function"==typeof l?v:l,y=c.useRef(!1),w=c.useRef(!1),{escapeKey:S,outsidePress:x}=Si(f),{escapeKey:E,outsidePress:_}=Si(m),C=c.useRef(!1),R=pa(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?Wa(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=pa(e=>{var t;const n=()=>{var t;R(e),null==(t=Fn(e))||t.removeEventListener("keydown",n)};null==(t=Fn(e))||t.addEventListener("keydown",n)}),k=pa(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=Fn(e),l="["+Fa("inert")+"]",c=$n(a.floating).querySelectorAll(l);let d=ln(s)?s:null;for(;d&&!En(d);){const e=Rn(d);if(En(e)||!ln(e))break;d=e}if(c.length&&ln(s)&&!s.matches("html,body")&&!Tn(s,a.floating)&&Array.from(c).every(e=>!Tn(d,e)))return;if(un(s)&&T){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"===_n(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&&Wa(g.nodesRef.current,p).some(t=>{var n;return jn(e,null==(n=t.context)?void 0:n.elements.floating)});if(jn(e,a.floating)||jn(e,a.domReference)||h)return;const f=g?Wa(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=pa(e=>{var t;const n=()=>{var t;k(e),null==(t=Fn(e))||t.removeEventListener(u,n)};null==(t=Fn(e))||t.addEventListener(u,n)});c.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},Sn()?5:0)}const d=$n(a.floating);s&&(d.addEventListener("keydown",E?O:R,E),d.addEventListener("compositionstart",l),d.addEventListener("compositionend",c)),b&&d.addEventListener(u,_?D:k,_);let p=[];return h&&(ln(a.domReference)&&(p=kn(a.domReference)),ln(a.floating)&&(p=p.concat(kn(a.floating))),!ln(a.reference)&&a.reference&&a.reference.contextElement&&(p=p.concat(kn(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",E?O:R,E),d.removeEventListener("compositionstart",l),d.removeEventListener("compositionend",c)),b&&d.removeEventListener(u,_?D:k,_),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,a,s,b,u,n,r,h,o,S,x,R,E,O,k,_,D]),c.useEffect(()=>{y.current=!1},[b,u]);const A=c.useMemo(()=>({onKeyDown:R,[yi[p]]:e=>{d&&r(!1,e.nativeEvent,"reference-press")}}),[R,r,d,p]),T=c.useMemo(()=>({onKeyDown:R,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[wi[u]]:()=>{y.current=!0}}),[R,u]);return c.useMemo(()=>o?{reference:A,floating:T}:{},[o,A,T])}(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=Ti(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=c.useCallback(t=>Ci(t,e,"reference"),t),i=c.useCallback(t=>Ci(t,e,"floating"),n),o=c.useCallback(t=>Ci(t,e,"item"),r);return c.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}},uo=({item:e,handleRemoveMultiValue:t,index:n,handleEditMultiValuePill:r})=>{var a,i;const o=(0,Ye.useStyles2)(co),s=(0,c.useCallback)(t=>{t.stopPropagation(),t.preventDefault(),r(e)},[r,e]),l=(0,c.useCallback)(e=>{"Enter"===e.key&&s(e)},[s]),u=(0,c.useCallback)(n=>{n.stopPropagation(),n.preventDefault(),t(e)},[t,e]),d=(0,c.useCallback)(e=>{"Enter"===e.key&&u(e)},[u]);return p().createElement("div",{className:(0,ot.cx)(o.basePill,o.valuePill),onClick:s,onKeyDown:l,tabIndex:0,id:`${e.value}-${n}`},null!=(a=e.label)?a:e.value,p().createElement(Ye.Button,{onClick:u,onKeyDownCapture:d,fill:"text",size:"sm",variant:"secondary",className:o.removeButton,tooltip:(0,le.t)("grafana-scenes.components.adhoc-filters-combobox.remove-filter-value","Remove filter value - {{itemLabel}}",{itemLabel:null!=(i=e.label)?i:e.value})},p().createElement(Ye.Icon,{name:"times",size:"md",id:`${e.value}-${n}-close-icon`})))},co=e=>({basePill:(0,ot.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,ot.css)({background:e.colors.action.selected,padding:e.spacing(.125,0,.125,1)}),removeButton:(0,ot.css)({marginInline:e.spacing(.5),height:"100%",padding:0,cursor:"pointer","&:hover":{color:e.colors.text.primary}})}),po=(0,c.forwardRef)(function({filter:e,model:t,isAlwaysWip:n,handleChangeViewMode:r,focusOnWipInputRef:a,populateInputOnEdit:i},o){var s,l,u,d;const[h,f]=(0,c.useState)(!1),[m,g]=(0,c.useState)([]),[v,b]=(0,c.useState)(!1),[y,w]=(0,c.useState)(!1),[S,x]=(0,c.useState)(""),[E,_]=(0,c.useState)(null),[C,R]=(0,c.useState)(n?"key":"value"),[O,k]=(0,c.useState)(!n&&"value"===C),D=(0,Ye.useStyles2)(ho),[A,T]=(0,c.useState)([]),[I,L]=(0,c.useState)({}),M=null==(s=t.state.allowCustomValue)||s,N=(0,c.useRef)(null),V=Io((null==e?void 0:e.operator)||""),$=V&&"value"===C,j=(0,c.useId)(),F=(0,c.useRef)([]),z=(0,c.useRef)([]),B=(0,c.useRef)(n?"key":"value"),U=(0,c.useMemo)(()=>qt(m),[m]),W=(0,c.useMemo)(()=>!n&&t.state.filters.at(-1)===e,[e,n,t.state.filters]),H=(0,c.useCallback)(()=>{n&&(t._addWip(),R("key"),x(""))},[t,n]),Q=(0,c.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=P(e);null==t||t.startProfile(G)}e._updateFilter(t,{valueLabels:r,values:a,value:a[0]}),T([])}r||setTimeout(()=>{var e;return null==(e=Z.domReference.current)?void 0:e.focus()})},[]),K=(0,c.useCallback)(e=>{T(t=>t.some(t=>t.value===e.value)?t.filter(t=>t.value!==e.value):[...t,e])},[]),Y=(0,c.useCallback)((n,a,i)=>{f(n),i&&["outside-press","escape-key"].includes(i)&&($?Q(t,e,A):e&&e.origin&&""===S&&t.updateToMatchAll(e),H(),null==r||r())},[e,A,r,Q,H,S,$,t]),X=(0,c.useMemo)(()=>[j,...A.reduce((e,t,n)=>[...e,`${t.value}-${n}`,`${t.value}-${n}-close-icon`],[])],[j,A]),{refs:Z,floatingStyles:J,context:ee,getReferenceProps:te,getFloatingProps:ne,getItemProps:re}=lo({open:h,onOpenChange:Y,activeIndex:E,setActiveIndex:_,outsidePressIdsToIgnore:X,listRef:F,disabledIndicesRef:z});(0,c.useImperativeHandle)(o,()=>()=>{var e;return null==(e=Z.domReference.current)?void 0:e.focus()},[Z.domReference]);const ae=(0,c.useCallback)(e=>{T(t=>t.filter(t=>t.value!==e.value)),setTimeout(()=>{var e;return null==(e=Z.domReference.current)?void 0:e.focus()})},[Z.domReference]),ie=(e=>e.flatMap(e=>e.options?[e,...e.options]:[e]))(es(U(O?"":S)));if(M&&"operator"!==C&&S){const t=_o.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)?ie.unshift(n):ie.push(n)}const oe=t.state.onAddCustomValue,se=((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})(ie,F,z),ue=(0,c.useCallback)(async n=>{var r;const a=Vt(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)?_(1):_(0)}catch(e){w(!0)}b(!1),null==a||a.stopInteraction()},[e,t]),ce=function(e){return Qi({observeElementRect:ji,observeElementOffset:Bi,scrollToFn:Wi,...e})}({count:ie.length,getScrollElement:()=>Z.floating.current,estimateSize:e=>ie[e].description?60:38,overscan:5}),de=(0,c.useCallback)((r,i)=>{if("Backspace"===r.key&&!S){if("value"===C){if(i&&A.length)return void T(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(),Ao(e)){const e=P(t);null==e||e.startProfile(q)}t._handleComboboxBackspace(e),n&&H()}},[S,C,t,e,n,A.length,H,a]),pe=(0,c.useCallback)((n,a)=>{var i;"Tab"!==n.key||n.shiftKey||(a&&(n.preventDefault(),Q(t,e,A),null==(i=Z.domReference.current)||i.focus()),null==r||r(),H())},[e,A,r,Q,H,t,Z.domReference]),he=(0,c.useCallback)((n,a)=>{"Tab"===n.key&&n.shiftKey&&(a&&(n.preventDefault(),Q(t,e,A,!0)),null==r||r(),H())},[e,A,r,Q,H,t]),fe=(0,c.useCallback)((n,o)=>{if("Enter"===n.key&&null!=E){if(!ie[E])return;const n=ie[E];if(o)K(n),x("");else{const o=ao({filterInputType:C,item:n,filter:e,setFilterMultiValues:T,onAddCustomValue:oe});if("value"===C&&o.value!==(null==e?void 0:e.value)){const e=P(t);null==e||e.startProfile(G)}t._updateFilter(e,o),so({populateInputOnEdit:i,item:n,filterInputType:C,setInputValue:x,filter:e}),no(C,R,r,Z.domReference.current,!W&&void 0),_(null),W&&(null==a||a())}}},[E,ie,K,t,e,C,i,r,Z.domReference,W,a,oe]),me=(0,c.useCallback)(e=>{var t;const n=e.label||e.value;T(t=>t.filter(t=>t.value!==e.value)),k(!0),x(n),null==(t=Z.domReference.current)||t.focus(),setTimeout(()=>{var e;null==(e=Z.domReference.current)||e.select()})},[Z.domReference]);(0,c.useEffect)(()=>{h&&ue(C)},[h,C]),(0,c.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}]},[]);T(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=Z.domReference.current)||e.select()})),null==(o=Z.domReference.current)||o.focus()}},[]),(0,c.useEffect)(()=>{$&&A&&setTimeout(()=>L({}))},[A,$]),(0,c.useLayoutEffect)(()=>{B.current&&(B.current=C)},[C]),(0,c.useLayoutEffect)(()=>{var e,t;null!==E&&ce.range&&(E>(null==(e=ce.range)?void 0:e.endIndex)||E<(null==(t=ce.range)?void 0:t.startIndex))&&ce.scrollToIndex(E)},[E,ce]);const ge=null!=(l=null==e?void 0:e.keyLabel)?l:null==e?void 0:e.key;return p().createElement("div",{className:D.comboboxWrapper},e?p().createElement("div",{className:D.pillWrapper},(null==e?void 0:e.key)?p().createElement("div",{className:(0,ot.cx)(D.basePill,D.keyPill)},ge):null,(null==e?void 0:e.key)&&(null==e?void 0:e.operator)&&"operator"!==C?p().createElement("div",{id:j,className:(0,ot.cx)(D.basePill,!e.origin&&D.operatorPill,e.origin&&D.keyPill,j),"aria-label":(0,le.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(""),ro("operator",R,void 0,Z.domReference.current))},onKeyDown:t=>{e.origin||(he(t,V),"Enter"===t.key&&(x(""),ro("operator",R,void 0,Z.domReference.current)))},...!e.origin&&{role:"button"}},e.operator):null,p().createElement("div",{ref:N}),$?A.map((e,t)=>p().createElement(uo,{key:`${e.value}-${t}`,item:e,index:t,handleRemoveMultiValue:ae,handleEditMultiValuePill:me})):null):null,p().createElement("input",{...te({ref:Z.setReference,onChange:function(e){const t=e.target.value;x(t),_(0),O&&k(!1)},value:S,placeholder:oo(e,C,$,n),"aria-autocomplete":"list",onKeyDown(e){h?("operator"===C&&he(e),de(e,$),pe(e,$),fe(e,$)):f(!0)}}),className:(0,ot.cx)(D.inputStyle,{[D.loadingInputPadding]:!v}),onClick:e=>{e.stopPropagation(),f(!0)},onFocus:()=>{f(!0)}}),v?p().createElement(Ye.Spinner,{className:D.loadingIndicator,inline:!0}):null,p().createElement(ci,null,h&&p().createElement(bi,{context:ee,initialFocus:-1,visuallyHiddenDismiss:!0,modal:!1},p().createElement(p().Fragment,null,p().createElement("div",{style:{...J,width:`${y?366:se}px`,transform:$?`translate(${(null==(u=N.current)?void 0:u.getBoundingClientRect().left)||0}px, ${((null==(d=Z.domReference.current)?void 0:d.getBoundingClientRect().bottom)||0)+10}px )`:J.transform},ref:Z.setFloating,className:D.dropdownWrapper,tabIndex:-1},p().createElement("div",{style:{height:`${ce.getTotalSize()||38}px`},...ne(),tabIndex:-1},v?p().createElement(Xi,null):y?p().createElement(Ji,{handleFetchOptions:()=>ue(C)}):ie.length||M&&"operator"!==C&&S?ce.getVirtualItems().map(n=>{var a;const o=ie[n.index],s=n.index;if(o.options)return p().createElement("div",{key:`${o.label}+${s}`,className:(0,ot.cx)(D.optionGroupLabel,D.groupTopBorder),style:{height:`${n.size}px`,transform:`translateY(${n.start}px)`}},p().createElement(Ye.Text,{weight:"bold",variant:"bodySmall",color:"secondary"},o.label));const l=ie[n.index+1],u=l&&!l.group&&!l.options&&o.group,c=null!=(a=o.label)?a:o.value;return p().createElement(Ki,{...re({key:`${o.value}-${s}`,ref(e){F.current[s]=e},onClick(n){var a;if("value"!==C&&n.stopPropagation(),$)n.preventDefault(),n.stopPropagation(),K(o),x(""),null==(a=Z.domReference.current)||a.focus();else{const n=ao({filterInputType:C,item:o,filter:e,setFilterMultiValues:T,onAddCustomValue:oe});if("value"===C&&n.value!==(null==e?void 0:e.value)){const e=P(t);null==e||e.startProfile(G)}t._updateFilter(e,n),so({populateInputOnEdit:i,item:o,filterInputType:C,setInputValue:x,filter:e}),no(C,R,r,Z.domReference.current,!1)}}}),active:E===s,addGroupBottomBorder:u,style:{height:`${n.size}px`,transform:`translateY(${n.start}px)`},"aria-setsize":ie.length,"aria-posinset":n.index+1,isMultiValueEdit:$,checked:A.some(e=>e.value===o.value)},p().createElement("span",null,o.isCustom?(0,le.t)("grafana-scenes.components.adhoc-filters-combobox.use-custom-value","Use custom value: {{itemLabel}}",{itemLabel:c}):c),o.description?p().createElement("div",{className:D.descriptionText},o.description):null)}):p().createElement(Zi,null))),$&&!v&&!y&&ie.length?p().createElement(eo,{onApply:()=>{Q(t,e,A)},floatingElement:Z.floating.current,maxOptionWidth:se,menuHeight:Math.min(ce.getTotalSize(),300)}):null))))}),ho=e=>({comboboxWrapper:(0,ot.css)({display:"flex",flexWrap:"wrap"}),pillWrapper:(0,ot.css)({display:"flex",alignItems:"center",flexWrap:"wrap"}),basePill:(0,ot.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,ot.css)({fontWeight:e.typography.fontWeightBold,cursor:"default"}),operatorPill:(0,ot.css)({"&:hover":{background:e.colors.action.hover}}),dropdownWrapper:(0,ot.css)({backgroundColor:e.colors.background.primary,color:e.colors.text.primary,boxShadow:e.shadows.z2,overflowY:"auto",zIndex:e.zIndex.portal}),inputStyle:(0,ot.css)({paddingBlock:0,"&:focus":{outline:"none"}}),loadingIndicator:(0,ot.css)({color:e.colors.text.secondary,marginLeft:e.spacing(.5)}),loadingInputPadding:(0,ot.css)({paddingRight:e.spacing(2.5)}),optionGroupLabel:(0,ot.css)({padding:e.spacing(1),position:"absolute",top:0,left:0,width:"100%"}),groupTopBorder:(0,ot.css)({"&:not(:first-child)":{borderTop:`1px solid ${e.colors.border.weak}`}}),descriptionText:(0,ot.css)({...e.typography.bodySmall,color:e.colors.text.secondary,paddingTop:e.spacing(.5)})});function fo({filter:e,model:t,readOnly:n,focusOnWipInputRef:r}){var a,i,o,s;const l=(0,Ye.useStyles2)(mo),[u,d]=(0,c.useState)(!0),[h,f]=(0,c.useState)(!1),m=(0,c.useRef)(null),[g,v]=(0,c.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,c.useCallback)((e,t)=>{null==e||e.stopPropagation(),n||(f(null!=t?t:!u),d(!u))},[n,u]);(0,c.useEffect)(()=>{var e;h&&(null==(e=m.current)||e.focus(),f(!1))},[h]),(0,c.useEffect)(()=>{e.forceEdit&&u&&(d(!1),t._updateFilter(e,{forceEdit:void 0}))},[e,t,u]),(0,c.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=p().createElement("span",{className:(0,ot.cx)(l.pillText,e.nonApplicable&&l.strikethrough)},a);return p().createElement("div",{className:(0,ot.cx)(l.combinedFilterPill,n&&l.readOnlyCombinedFilter,(Do(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,le.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:p().createElement(Ye.Tooltip,{content:p().createElement("div",{className:l.tooltipText},a),placement:"top"},i),n||e.matchAllFilter||e.origin&&"dashboard"!==e.origin?null:p().createElement(Ye.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,ot.cx)(l.pillIcon,e.nonApplicable&&l.disabledPillIcon),tooltip:(0,le.t)("grafana-scenes.components.adhoc-filter-pill.remove-filter-with-key","Remove filter with key {{keyLabel}}",{keyLabel:b})}),e.origin&&e.readOnly&&p().createElement(Ye.Tooltip,{content:(0,le.t)("grafana-scenes.components.adhoc-filter-pill.managed-filter","{{origin}} managed filter",{origin:e.origin}),placement:"bottom"},p().createElement(Ye.Icon,{name:"lock",size:"md",className:l.readOnlyPillIcon})),e.origin&&x&&p().createElement(Ye.Tooltip,{content:S(e.origin).info,placement:"bottom"},p().createElement(Ye.Icon,{name:"info-circle",size:"md",className:l.infoPillIcon})),e.origin&&e.restorable&&!e.readOnly&&p().createElement(Ye.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:Do(e)?l.matchAllPillIcon:l.pillIcon,tooltip:S(e.origin).restore}),e.nonApplicable&&p().createElement(Ye.Tooltip,{content:null!=(s=e.nonApplicableReason)?s:(0,le.t)("grafana-scenes.components.adhoc-filter-pill.non-applicable","Filter is not applicable"),placement:"bottom"},p().createElement(Ye.Icon,{name:"info-circle",size:"md",className:l.infoPillIcon})))}return p().createElement(po,{filter:e,model:t,handleChangeViewMode:w,focusOnWipInputRef:r,populateInputOnEdit:g})}const mo=e=>({combinedFilterPill:(0,ot.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,ot.css)({paddingRight:e.spacing(1),cursor:"text","&:hover":{background:e.colors.action.selected}}),filterReadOnly:(0,ot.css)({background:e.colors.background.canvas,cursor:"text","&:hover":{background:e.colors.background.canvas}}),pillIcon:(0,ot.css)({marginInline:e.spacing(.5),cursor:"pointer","&:hover":{color:e.colors.text.primary}}),pillText:(0,ot.css)({maxWidth:"200px",width:"100%",textOverflow:"ellipsis",overflow:"hidden"}),tooltipText:(0,ot.css)({textAlign:"center"}),infoPillIcon:(0,ot.css)({marginInline:e.spacing(.5),cursor:"pointer"}),readOnlyPillIcon:(0,ot.css)({marginInline:e.spacing(.5)}),matchAllPillIcon:(0,ot.css)({marginInline:e.spacing(.5),cursor:"pointer",color:e.colors.text.disabled}),disabledPillIcon:(0,ot.css)({marginInline:e.spacing(.5),cursor:"pointer",color:e.colors.text.disabled,"&:hover":{color:e.colors.text.disabled}}),...ts(e)}),go=(0,c.forwardRef)(function({model:e},t){const{_wip:n}=e.useState();return(0,c.useLayoutEffect)(()=>{n||e._addWip()},[n]),p().createElement(po,{model:e,filter:n,isAlwaysWip:!0,ref:t})}),vo=(0,c.memo)(function({model:e}){const{originFilters:t,filters:n,readOnly:r}=e.useState(),a=(0,Ye.useStyles2)(bo),i=(0,c.useRef)();return p().createElement("div",{className:(0,ot.cx)(a.comboboxWrapper,{[a.comboboxFocusOutline]:!r}),onClick:()=>{var e;null==(e=i.current)||e.call(i)}},p().createElement(Ye.Icon,{name:"filter",className:a.filterIcon,size:"lg"}),null==t?void 0:t.map((t,n)=>t.origin?p().createElement(fo,{key:`${n}-${t.key}`,filter:t,model:e,focusOnWipInputRef:i.current}):null),n.filter(e=>!e.hidden).map((t,n)=>p().createElement(fo,{key:`${n}-${t.key}`,filter:t,model:e,readOnly:r||t.readOnly,focusOnWipInputRef:i.current})),r?null:p().createElement(go,{model:e,ref:i}))}),bo=e=>({comboboxWrapper:(0,ot.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,ot.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,ot.css)({color:e.colors.text.secondary,alignSelf:"center"})}),yo=Object.fromEntries(Object.entries(i.scopeFilterOperatorMap).map(([e,t])=>[t,e]));function wo(e){return new Set(["equals","not-equals","one-of","not-one-of"]).has(e)}function So(e){return new Set(["regex-match","regex-not-match"]).has(e)}function xo(e,t,n){var r,a;if(!n)return;const o=e.get(n.key);o&&function(e,t){const n=i.scopeFilterOperatorMap[e];if(!wo(n)||!wo(t))return!1;return Eo(n,t)}(o.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===yo.equals?e.operator=yo["one-of"]:"not-equals"===t.operator&&e.operator===yo["not-equals"]&&(e.operator=yo["not-one-of"])}(o,n):o&&function(e,t){const n=i.scopeFilterOperatorMap[e];if(!So(n)||!So(t))return!1;return Eo(n,t)}(o.operator,n.operator)?(o.value+=`|${n.value}`,o.values=[o.value]):o?t.push({key:n.key,operator:yo[n.operator],value:n.value,values:null!=(a=n.values)?a:[n.value],origin:"scope"}):e.set(n.key,{key:n.key,operator:yo[n.operator],value:n.value,values:null!=(r=n.values)?r:[n.value],origin:"scope"})}function Eo(e,t){return!(e.includes("not")&&!t.includes("not")||!e.includes("not")&&t.includes("not"))}const _o=[{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 Co extends E{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:Ro(e.expressionBuilder,[...null!=(n=e.originFilters)?n:[],...null!=(r=e.filters)?r:[]]),...e}),this._scopedVars={__sceneObject:It(this)},this._dataSourceSrv=(0,o.getDataSourceSrv)(),this._originalValues=new Map,this._prevScopes=[],this._variableDependency=new rs(this,{dependsOnScopes:!0,onReferencedVariableValueChanged:()=>this._updateScopesFilters()}),this._urlSync=new Zt(this),this._debouncedVerifyApplicability=(0,R.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(()=>(Bt.add(e),()=>Bt.delete(e))),zt)return;const t=(0,o.getTemplateSrv)();(null==t?void 0:t.getAdhocFilters)&&(zt=t.getAdhocFilters,t.getAdhocFilters=function(e){var n;if(0===Bt.size)return zt.call(t,e);const r=(0,o.getDataSourceSrv)().getInstanceSettings(e);if(!r)return[];for(const e of Bt.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=Ds.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)xo(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=Ro(this.state.expressionBuilder,[...null!=i?i:[],...a]),r=e.filterExpression!==this.state.filterExpression}super.setState(e),r&&this.publishEvent(new ne(this),!0)}updateFilters(e,t){var n;let r,a=!1;e&&e!==this.state.filters&&(r=Ro(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 ne(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=P(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,R.isEqual)(i,null==a?void 0:a.value)||t.operator&&t.operator!==(null==a?void 0:a.operator)?t.restorable=!0:i&&(0,R.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=P(this);null==t||t.startProfile(q),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=Ds.getTimeRange(this).state.value,o=this.state.useQueriesAsFilterForOptions?qo(this):void 0,s=await a.getDrilldownsApplicability({filters:r,queries:o,timeRange:i,scopes:Ds.getScopes(this),...Ot(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 Zo(o.values).map(ko);if(this.state.defaultKeys)return this.state.defaultKeys.map(ko);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=Ds.getTimeRange(this).state.value,d=this.state.useQueriesAsFilterForOptions?qo(this):void 0,p=await s.getTagKeys({filters:u,queries:d,timeRange:c,scopes:Ds.getScopes(this),...Ot(this)});Jo(p)&&this.setState({error:p.error.message});let h=Zo(p);o&&(h=h.concat(Zo(o.values)));const f=this.state.tagKeyRegexFilter;return f&&(h=h.filter(e=>e.text.match(f))),h.map(ko)}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 Zo(i.values).map(ko);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=Ds.getTimeRange(this).state.value,c=this.state.useQueriesAsFilterForOptions?qo(this):void 0;let d=Ds.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,...Ot(this)});Jo(p)&&this.setState({error:p.error.message});let h=Zo(p);return i&&(h=h.concat(Zo(i.values))),h.map(ko)}_addWip(){this.setState({_wip:{key:"",value:"",operator:"=",condition:""}})}_getOperators(){const{supportsMultiValueOperators:e,allowCustomValue:t=!0}=this.state;return _o.filter(({isMulti:n,isRegex:r})=>!(!e&&n)&&!(!t&&r)).map(({value:e,description:t})=>({label:e,value:e,description:t}))}}function Ro(e,t){var n;return(null!=e?e:Bo)(null!=(n=null==t?void 0:t.filter(e=>To(e)))?n:[])}Co.Component=function({model:e}){const{filters:t,readOnly:n,addFilterButtonText:r}=e.useState(),a=(0,Ye.useStyles2)(Oo);if("combobox"===e.state.layout)return p().createElement(vo,{model:e});return p().createElement("div",{className:a.wrapper},t.filter(e=>!e.hidden).map((t,n)=>p().createElement(p().Fragment,{key:n},p().createElement(Kt,{filter:t,model:e}))),!n&&p().createElement(Xt,{model:e,key:"'builder",addFilterButtonText:r}))};const Oo=e=>({wrapper:(0,ot.css)({display:"flex",flexWrap:"wrap",alignItems:"flex-end",columnGap:e.spacing(2),rowGap:e.spacing(1)})});function ko(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 Do(e){return"=~"===e.operator&&".*"===e.value}function Ao(e){return""!==e.key&&""!==e.operator&&""!==e.value}function To(e){return!e.nonApplicable}function Io(e){const t=_o.find(t=>t.value===e);return!!t&&Boolean(t.isMulti)}class Po{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,h.merge)(t).pipe((0,h.mergeAll)(),(0,h.filter)(e=>this._resultsMap.get(e.origin.state.key)!==e),(0,h.map)(e=>(this._resultsMap.set(e.origin.state.key,e),this._resultsMap.values())),(0,h.finalize)(()=>{n.forEach(e=>e())}))}}class Lo{constructor(e){this._variableDependency=e}findAndSubscribeToDrilldowns(e){const t=function(e){var t;for(const n of Bt.values())if(Cs(n,null==(t=n.state.datasource)?void 0:t.uid)===e)return n}(e),n=function(e){var t;for(const n of Ke.values())if(Cs(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=>Ao(e)&&To(e)):void 0}getGroupByKeys(){return this._groupByVar?this._groupByVar.getApplicableKeys():void 0}cleanup(){this._adhocFiltersVar=void 0,this._groupByVar=void 0}}let Mo=100;function No(){return"SQR"+Mo++}class Vo extends E{constructor(e){super(e),this._dataLayersMerger=new Po,this._variableValueRecorder=new We,this._results=new h.ReplaySubject(1),this._scopedVars={__sceneObject:It(this)},this._isInView=!0,this._bypassIsInView=!1,this._queryNotExecutedWhenOutOfView=!1,this._variableDependency=new rs(this,{statePaths:["queries","datasource","minInterval"],onVariableUpdateCompleted:this.onVariableUpdatesCompleted.bind(this),onAnyVariableChanged:this.onAnyVariableChanged.bind(this),dependsOnScopes:!0}),this._drilldownDependenciesManager=new Lo(this._variableDependency),this.onDataReceived=e=>{const t=(0,i.preProcessPanelData)(e,this.state.data);this._resultAnnotations=e.annotations;const n=this._combineDataLayers(t);let r=this.state._hasFetchedData;r||t.state===M.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=Ds.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=Ds.getDataLayers(this);0!==e.length&&(this._dataLayersSub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayersReceived.bind(this)))}_onLayersReceived(e){var t,n,r,a,o;const s=Ds.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)===i.DataTopic.Annotations&&(c=c.concat(e)),(null==(n=e.meta)?void 0:n.dataTopic)===i.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,Ge].includes(s.values[e]));const r=l.values[e].filter;if(r){const e=[...null!=(n=r.ids)?n:[],Ge].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 i.DataFrameView(e);for(const e of t)if(e.panelId===l.panelId){u=e;break}}if(jo(c)&&jo(this._layerAnnotations)&&(0,R.isEqual)(u,null==(r=this.state.data)?void 0:r.alertState))return;this._layerAnnotations=c;const p=this.state.data?this.state.data:{...V,timeRange:s.state.value};this.setState({data:{...p,annotations:[...null!=(a=this._resultAnnotations)?a:[],...c],alertState:null!=u?u:null==(o=this.state.data)?void 0:o.alertState}})}onVariableUpdatesCompleted(){this.isQueryModeAuto()&&this.runQueries()}onAnyVariableChanged(e){this._drilldownDependenciesManager.adHocFiltersVar!==e&&this._drilldownDependenciesManager.groupByVar!==e&&this.isQueryModeAuto()&&(e instanceof Co&&this._isRelevantAutoVariable(e)&&this.runQueries(),e instanceof $t&&this._isRelevantAutoVariable(e)&&this.runQueries())}_isRelevantAutoVariable(e){var t,n;const r=null!=(t=this.state.datasource)?t:$o(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)?(T(),!0):!this.state.data||!!this._isDataTimeRangeStale(this.state.data)}_isDataTimeRangeStale(e){const t=Ds.getTimeRange(this).state.value,n=e.timeRange;return(t.from.unix()!==n.from.unix()||t.to.unix()!==n.to.unix())&&(T(),!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=Ds.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:M.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 T(),void this.setState({data:{...null!=(n=this.state.data)?n:V,state:M.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:$o(a),n=await Ue(t,this._scopedVars);this._drilldownDependenciesManager.findAndSubscribeToDrilldowns(n.uid);const i=(0,o.getRunRequest)(),{primary:s,secondaries:l,processors:u}=this.prepareRequests(e,n);T(0,0,this.state.key);let c=i(n,s);if(l.length>0){const e=l.map(e=>i(n,e)),t=(e=>t=>t.pipe((0,h.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,h.of)(n)});return(0,h.forkJoin)([(0,h.of)(t),...r])}),(0,h.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,h.forkJoin)([c,...e]).pipe(t)}c=c.pipe(ze({type:"SceneQueryRunner/runQueries",request:s,origin:this,cancel:()=>this.cancelQuery()})),this._querySub=c.subscribe(this.onDataReceived)}catch(e){console.error("PanelQueryRunner Error",e),this.onDataReceived({...V,...this.state.data,state:M.Error,errors:[(0,o.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:V}),n}prepareRequests(e,t){var n;const{minInterval:r,queries:a}=this.state;let s={app:"scenes",requestId:No(),timezone:e.getTimeZone(),range:e.state.value,interval:"1s",intervalMs:1e3,targets:(0,R.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:Ds.getScopes(this),...Qe(this)};const l=this._drilldownDependenciesManager.getFilters(),u=this._drilldownDependenciesManager.getGroupByKeys();l&&(s.filters=l),u&&(s.groupByKeys=u),s.targets=s.targets.map(e=>{var n;return e.datasource&&(e.datasource.uid===t.uid||(null==(n=t.meta)?void 0:n.mixed)||!o.isExpressionReference||(0,o.isExpressionReference)(e.datasource))||(e.datasource=t.getRef()),e});const c=r?Cs(this,r):t.interval,d=i.rangeUtil.calculateInterval(e.state.value,s.maxDataPoints,c);s.scopedVars=Object.assign({},s.scopedVars,{__interval:{text:d.interval,value:d.interval},__interval_ms:{text:d.intervalMs.toString(),value:d.intervalMs}}),s.interval=d.interval,s.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(s)){const e=No();h.push({...t,requestId:e}),f.set(e,null!=n?n:qe)}return s.range=p,{primary:s,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!==V&&this.setState({data:V})}getClosestExtraQueryProviders(){const e=new Map;return this.parent?(j(this.parent,t=>(He(t)&&!e.has(t.constructor)&&e.set(t.constructor,t),t.forEachChild(t=>{He(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){T(0,0,this.state.key),this._isInView=e,e&&this._queryNotExecutedWhenOutOfView&&this.runQueries()}bypassIsInViewChanged(e){T(0,0,this.state.key),this._bypassIsInView=e,e&&this._queryNotExecutedWhenOutOfView&&this.runQueries()}}function $o(e){var t,n;return null!=(n=null==(t=e.find(e=>null!==e.datasource))?void 0:t.datasource)?n:void 0}function jo(e){if(!e)return!0;for(let t=0;t<e.length;t++)if(e[t].length>0)return!1;return!0}function Fo(e,t){return e===t||(0,R.isEqual)(e,t)}function zo(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 Bo(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(Wo).join("|")):"!=|"===a?(a="!~",r=null==(n=e.values)?void 0:n.map(Wo).join("|")):r="=~"===a||"!~"===a?Wo(e.value):Uo(e.value);return`${e.key}${a}"${r}"`}(e)).join(",")}function Uo(e){return e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function Wo(e){return Uo(e.replace(Ho,"\\$&"))}const Ho=/[*+?()|\\.\[\]{}^$]/g;function qo(e){var t;const n=Ds.findAllObjects(e.getRoot(),e=>e instanceof Vo),r=Ds.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 Ds.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 Ds.interpolate(e,t.datasource.uid)===r}))}),i}function Go(e){return null==e?"":/\|/g[Symbol.replace](e,"__gfp__")}function Qo(e){return null==e?"":/,/g[Symbol.replace](e,"__gfc__")}function Ko(e){return function(e){return null==e?"":/#/g[Symbol.replace](e,"__gfh__")}(Go(e))}function Yo(e){return null==e?"":(e=/__gfp__/g[Symbol.replace](e,"|"),e=/__gfc__/g[Symbol.replace](e,","),e=/__gfh__/g[Symbol.replace](e,"#"))}function Xo(e,t){return t&&e!==t?[e,t].map(Qo).join(","):Qo(e)}function Zo(e){return Array.isArray(e)?e:e.data}function Jo(e){return!Array.isArray(e)&&Boolean(e.error)}function es(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 ts(e){return{disabledPill:(0,ot.css)({background:e.colors.action.selected,color:e.colors.text.disabled,border:0,"&:hover":{background:e.colors.action.selected}}),strikethrough:(0,ot.css)({textDecoration:"line-through"})}}class ns extends E{constructor(e){super({type:"constant",value:"",name:"",...e,skipUrlSync:!0}),this._variableDependency=new rs(this,{statePaths:["value"]}),this._prevValue=""}validateAndUpdate(){const e=this.getValue();return this._prevValue!==e&&(this._prevValue=e,this.publishEvent(new ne(this),!0)),(0,h.of)({})}getValue(){return"string"==typeof this.state.value?Ds.interpolate(this,this.state.value):this.state.value}}class rs{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,o;const s=this.getNames(),l=(s.has(e.state.name)||s.has(i.DataLinkBuiltInVars.includeVars))&&t;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==(o=(a=this._options).onReferencedVariableValueChanged)||o.call(a,e),this._options.onReferencedVariableValueChanged||this._options.onVariableUpdateCompleted||this._sceneObject.forceRender())}hasDependencyInLoadingState(){return this._isWaitingForVariables=Ds.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(Ee),this._statePaths)for(const t of this._statePaths){if("*"===t){this.extractVariablesFrom(e);break}{const n=e[t];n&&this.extractVariablesFrom(n)}}}extractVariablesFrom(e){Se.lastIndex=0;const t=("string"!=typeof e?zo(e):e).matchAll(Se);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=Ds.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 ns({name:"__from",value:e.from});this.variableUpdateCompleted(t,!0)}else if(a){const t=new ns({name:"__to",value:e.to});this.variableUpdateCompleted(t,!0)}if(e.timeZone!==t.timeZone&&i){const t=new ns({name:"__timezone",value:e.timeZone});this.variableUpdateCompleted(t,!0)}});return()=>e.unsubscribe()})}}const as=e=>Boolean(e.metricFindQuery)&&!Boolean(e.variables),is=e=>{if(!e.variables)return!1;if(e.variables.getType()!==i.VariableSupportType.Standard)return!1;const t=e.variables;return"toDataQuery"in t&&Boolean(t.toDataQuery)},os=e=>{if(!e.variables)return!1;if(e.variables.getType()!==i.VariableSupportType.Custom)return!1;const t=e.variables;return"query"in t&&"editor"in t&&Boolean(t.query)&&Boolean(t.editor)},ss=e=>!!e.variables&&e.variables.getType()===i.VariableSupportType.Datasource;class ls{constructor(e,t=(0,o.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(is(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 is(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):ps()}}class us{constructor(e){this.datasource=e}getTarget(e){if(as(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({variable:e,searchFilter:t},n){return as(this.datasource)?(0,h.from)(this.datasource.metricFindQuery(e.state.query,{...n,variable:{name:e.state.name,type:e.state.type},searchFilter:t})).pipe((0,h.mergeMap)(e=>{if(!e||!e.length)return ps();const t=e;return(0,h.of)({series:t,state:i.LoadingState.Done,timeRange:n.range})})):ps()}}class cs{constructor(e,t=(0,o.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(os(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return os(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):ps()}}class ds{constructor(e,t=(0,o.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){var t;if(ss(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 ss(this.datasource)?this._runRequest(this.datasource,t):ps()}}function ps(){return(0,h.of)({state:i.LoadingState.Done,series:[],timeRange:(0,i.getDefaultTimeRange)()})}let hs=function(e){if(is(e))return new ls(e,(0,o.getRunRequest)());if(as(e))return new us(e);if(os(e))return new cs(e);if(ss(e))return new ds(e);throw new Error(`Couldn't create a query runner for datasource ${e.type}`)};const fs=(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},ms=(e,t)=>{if(t===i.VariableSort.disabled)return e;switch(t){case i.VariableSort.alphabeticalAsc:e=(0,R.sortBy)(e,"label");break;case i.VariableSort.alphabeticalDesc:e=(0,R.sortBy)(e,"label").reverse();break;case i.VariableSort.numericalAsc:e=(0,R.sortBy)(e,gs);break;case i.VariableSort.numericalDesc:e=(e=(0,R.sortBy)(e,gs)).reverse();break;case i.VariableSort.alphabeticalCaseInsensitiveAsc:e=(0,R.sortBy)(e,e=>(0,R.toLower)(e.label));break;case i.VariableSort.alphabeticalCaseInsensitiveDesc:e=(e=(0,R.sortBy)(e,e=>(0,R.toLower)(e.label))).reverse();break;case i.VariableSort.naturalAsc||7:e=bs(e);break;case i.VariableSort.naturalDesc||8:e=(e=bs(e)).reverse()}return e};function gs(e){if(!e.label)return-1;const t=e.label.match(/.*?(\d+).*/);return!t||t.length<2?-1:parseInt(t[1],10)}const vs=new Intl.Collator(void 0,{sensitivity:"accent",numeric:!0});function bs(e){return e.slice().sort((e,t)=>vs.compare(e.label,t.label))}function ys(){return e=>e.pipe((0,h.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,i.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,i.getProcessedDataFrames)(t),r=[];let a=-1,o=-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,i.getFieldDisplayName)(r,e,t).toLowerCase();r.type===i.FieldType.string&&-1===s&&(s=n),"text"===u&&r.type===i.FieldType.string&&-1===o&&(o=n),"value"===u&&r.type===i.FieldType.string&&-1===a&&(a=n),"expandable"!==u||r.type!==i.FieldType.boolean&&r.type!==i.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,i=e.fields[s].values.get(t),u=-1!==o?e.fields[o].values.get(t):"",c=-1!==a?e.fields[a].values.get(t):"";-1!==a||-1!==o?-1!==a||-1===o?-1===a||-1!==o?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:i,value:i,expandable:n})}return r}))}class ws extends Ae{constructor(e){super({type:"query",name:"",value:"",text:"",options:[],datasource:null,regex:"",query:"",refresh:i.VariableRefresh.onDashboardLoad,sort:i.VariableSort.disabled,...e}),this._variableDependency=new rs(this,{statePaths:["regex","query","datasource"]}),this.onSearchChange=e=>{zo(this.state.query).indexOf(xe)>-1&&this._updateOptionsBasedOnSearchFilter(e)},this._updateOptionsBasedOnSearchFilter=(0,R.debounce)(async e=>{const t=await(0,h.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,h.from)(Ue(this.state.datasource,{__sceneObject:It(this)})).pipe((0,h.mergeMap)(t=>{const n=hs(t),r=n.getTarget(this),a=this.getRequest(r,e.searchFilter);return n.runRequest({variable:this,searchFilter:e.searchFilter},a).pipe(ze({type:"QueryVariable/getValueOptions",request:a,origin:this}),(0,h.filter)(e=>e.state===i.LoadingState.Done||e.state===i.LoadingState.Error),(0,h.take)(1),(0,h.mergeMap)(e=>e.state===i.LoadingState.Error?(0,h.throwError)(()=>e.error):(0,h.of)(e)),ys(),(0,h.mergeMap)(e=>{let t="";this.state.regex&&(t=Ds.interpolate(this,this.state.regex,void 0,"regex"));let n=function(e,t,n){var r,a,o,s,l,u,c,d,p,h;let f,m=[];e&&(f=(0,i.stringToJsRegex)(e));for(let e=0;e<n.length;e++){const t=n[e];let i=null!=(a=null!=(r=t.text)?r:t.value)?a:"",g=null!=(s=null!=(o=t.value)?o:t.text)?s:"";if((0,R.isNumber)(g)&&(g=g.toString()),(0,R.isNumber)(i)&&(i=i.toString()),f){const e=fs(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,i=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&&(i=r[1],g=r[1])}}m.push({label:i,value:g})}return m=(0,R.uniqBy)(m,"value"),ms(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=ms(n.concat(e),this.state.sort):n.unshift(...e)}return(0,h.of)(n)}),(0,h.catchError)(e=>e.cancelled?(0,h.of)([]):(0,h.throwError)(()=>e)))}))):(0,h.of)([])}getRequest(e,t){const n={__sceneObject:It(this)};t&&(n.__searchFilter={value:t,text:t});const r=Ds.getTimeRange(this).state.value;return{app:i.CoreApp.Dashboard,requestId:(0,f.A)(),timezone:"",range:r,interval:"",intervalMs:0,targets:[e],scopedVars:n,startTime:Date.now()}}}ws.Component=({model:e})=>p().createElement(_t,{model:e});var Ss=n(2245);class xs extends E{constructor(e){super({skipUrlSync:!0,loading:!0,scopes:[],...e,type:"system",name:Ee,hide:Ss.zL.hideVariable}),this._renderBeforeActivation=!0,this.UNSAFE_renderAsHidden=!0}getValue(){var e;const t=null!=(e=this.state.scopes)?e:[];return new Es(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,R.isEqual)(n,r);if(t||!a&&0!==r.length)this.setState({loading:t});else{const n=P(this);null==n||n.startProfile("scopes_changed"),this.setState({scopes:e.value,loading:t}),this.publishEvent(new ne(this),!0)}}}xs.Component=function({model:e}){const t=(0,c.useContext)(o.ScopesContext);return(0,c.useEffect)(()=>e.setContext(t),[t,e]),null};class Es{constructor(e){this._value=e}formatter(e){return e===L.$m.QueryParam?this._value.map(e=>`scope=${encodeURIComponent(e)}`).join("&"):this._value.join(", ")}}function _s(e){var t;return null!=(t=j(e,e=>e.state.$data))?t:Z}function Cs(e,t,n,r,a){return""===t||null==t?"":Ve(e,t,n,r,a)}function Rs(e,t,n,r){if(t(e))return e;let a=null;return e.forEachChild(e=>{if(e===n)return;let r=Rs(e,t);return r?(a=r,!1):void 0}),a||(r&&e.parent?Rs(e.parent,t,e,!0):null)}function Os(e,t){return Rs(e,t,void 0,!0)}function ks(e,t){const n=[];return e.forEachChild(e=>{t(e)&&n.push(e),n.push(...ks(e,t))}),n}const Ds={getVariables:function(e){var t;return null!=(t=j(e,e=>e.state.$variables))?t:ee},getData:_s,getTimeRange:te,getLayout:function(e){const t=j(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(Fe(e)?r=r.concat(e):e.state.$data&&Fe(e.state.$data)&&(r=r.concat(e.state.$data)),t&&r.length>0)break;n=n.parent}else n=n.parent}return r},interpolate:Cs,lookupVariable:A,hasVariableDependencyInLoadingState:function(e){if(!e.variableDependency)return!1;for(const t of e.variableDependency.getNames()){if(e instanceof ws&&e.state.name===t){console.warn("Query variable is referencing itself");continue}const n=A(t,e);if(!n)continue;if(n.parent.isVariableLoadingOrWaitingToUpdate(n))return!0}return!1},findByKey:function(e,t){const n=Os(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=Os(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:Os,findAllObjects:ks,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:P,findDescendents:function(e,t){function n(e){return e instanceof t}return ks(e,n).filter(n)},getScopes:function(e){const t=A(Ee,e);if(t instanceof xs)return t.state.scopes}},As=["from","to","timezone"];class Ts{constructor(e){this.index=new Map,this.options={namespace:(null==e?void 0:e.namespace)||"",excludeFromNamespace:(null==e?void 0:e.excludeFromNamespace)||As}}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(Is(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 Is(e){const t=e.getRoot();return!Ds.findObject(t,t=>t===e)}function Ps(e,t){const n=new Ts(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 Ls(e,t,n,r){r||Ms(e,t,n),e.forEachChild(e=>{Ms(e,t,n)}),e.forEachChild(e=>Ls(e,t,n,!0))}function Ms(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];Ns(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 Ns(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,R.isEqual)(e,t):t===e[0])}class Vs extends E{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=Ds.getVariables(n),a=Ds.lookupVariable(this.state.name,n);return!(!r||!a)&&r.isVariableLoadingOrWaitingToUpdate(a)}}function $s(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 Vs&&(n=`${e.state.value}$${n}`,t=e.state.name)}),r=r.parent}return n}var js=n(6145);class Fs extends E{constructor(e){super({...e,sync:e.sync||js.yV.Off}),this.getEventsBus=e=>{if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return new zs(this.parent,e)}}getEventsScope(){if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return this.state.key}}class zs{constructor(e,t){this._source=e,this._eventsOrigin=t}publish(e){e.origin=this,this._eventsOrigin.publishEvent(e,!0)}getStream(e){return new h.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 Bs=function(){};var Us="undefined"!=typeof window;const Ws=Us?c.useLayoutEffect:c.useEffect;var Hs={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const qs=Us&&void 0!==window.ResizeObserver?function(){var e=(0,c.useState)(null),t=e[0],n=e[1],r=(0,c.useState)(Hs),a=r[0],i=r[1],o=(0,c.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 Ws(function(){if(t)return o.observe(t),function(){o.disconnect()}},[t]),[n,a]}:function(){return[Bs,Hs]};function Gs({data:e,showAll:t,seriesLimit:n,onShowAllSeries:r}){const a=(0,Ye.useStyles2)(Qs),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 p().createElement("div",{className:a.timeSeriesDisclaimer},!t&&p().createElement("span",{className:a.warningMessage},p().createElement(Ye.Icon,{title:(0,le.t)("grafana-scenes.components.viz-panel-series-limit.warning-message","Showing only {{seriesLimit}} series",{seriesLimit:n}),name:"exclamation-triangle","aria-hidden":"true"})),p().createElement(Ye.Tooltip,{content:(0,le.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.")},p().createElement(Ye.Button,{variant:"secondary",size:"sm",onClick:r},o)))}const Qs=e=>({timeSeriesDisclaimer:(0,ot.css)({label:"time-series-disclaimer",display:"flex",alignItems:"center",gap:e.spacing(1)}),warningMessage:(0,ot.css)({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.colors.warning.main,fontSize:e.typography.bodySmall.fontSize})});const Ks=function(e){(0,c.useEffect)(e,[])};function Ys(){const e=(0,c.useRef)(void 0);return null!=e.current||(e.current=(0,R.uniqueId)()),e.current}const Xs=p().forwardRef(({children:e,onLoad:t,onChange:n,className:r,...a},i)=>{const o=Ys(),{hideEmpty:s}=(0,Ye.useStyles2)(Zs),[l,u]=(0,c.useState)(!1),[d,h]=(0,c.useState)(!1),f=(0,c.useRef)(null);return(0,c.useImperativeHandle)(i,()=>f.current),Ks(()=>{Xs.addCallback(o,e=>{!l&&e.isIntersecting&&(u(!0),null==t||t()),h(e.isIntersecting),null==n||n(e.isIntersecting)});const e=f.current;return e&&Xs.observer.observe(e),()=>{e&&Xs.observer.unobserve(e),delete Xs.callbacks[o],0===Object.keys(Xs.callbacks).length&&Xs.observer.disconnect()}}),p().createElement("div",{id:o,ref:f,className:`${s} ${r}`,...a},l?p().createElement(Js.Provider,{value:d},e):(0,le.t)("grafana-scenes.components.lazy-loader.placeholder"," "))});function Zs(){return{hideEmpty:(0,ot.css)({"&:empty":{display:"none"}})}}Xs.displayName="LazyLoader",Xs.callbacks={},Xs.addCallback=(e,t)=>Xs.callbacks[e]=t,Xs.observer=new IntersectionObserver(e=>{for(const t of e)"function"==typeof Xs.callbacks[t.target.id]&&Xs.callbacks[t.target.id](t)},{rootMargin:"100px"});const Js=p().createContext(!0);function el(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 tl=(0,ot.css)({position:"relative",width:"100%",height:"100%"}),nl=(0,ot.css)({position:"absolute",width:"100%",height:"100%"}),rl=e=>({ok:(0,ot.css)({color:e.colors.success.text}),pending:(0,ot.css)({color:e.colors.warning.text}),alerting:(0,ot.css)({color:e.colors.error.text})}),al="hideSeriesFrom",il=(0,i.isSystemOverrideWithRef)(al);function ol(e,t=i.ByNamesMatcherMode.exclude,n){return n=null!=n?n:{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!0}},{__systemRef:al,matcher:{id:i.FieldMatcherID.byNames,options:{mode:t,names:e,prefix:t===i.ByNamesMatcherMode.exclude?"All except:":void 0,readOnly:!0}},properties:[{...n,value:{viz:!0,legend:!1,tooltip:!0}}]}}const sl=(e,t,n=i.ByNamesMatcherMode.exclude)=>{const r=e.properties.find(e=>"custom.hideFrom"===e.id),a=ll(e),o=a.findIndex(e=>e===t);return o<0?a.push(t):a.splice(o,1),ol(a,n,r)},ll=e=>{var t;const n=null==(t=e.matcher.options)?void 0:t.names;return Array.isArray(n)?[...n]:[]},ul=(e,t)=>ll(e).length===cl(t).length,cl=(e,t)=>{const n=new Set;for(const r of e)for(const a of r.fields){if(a.type!==i.FieldType.number)continue;const o=(0,i.getFieldDisplayName)(a,r,e);o!==t&&n.add(o)}return Array.from(n)},dl=(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=i.fieldMatchers.get(a.matcher.id).get(a.matcher.options);for(const n of t)for(const a of n.fields){if(a.type!==i.FieldType.number)continue;const o=(0,i.getFieldDisplayName)(a,n,t);e(a,n,t)&&r.push(o)}}}return r},pl=(e,t)=>({matcher:{id:i.FieldMatcherID.byName,options:e},properties:[hl(t)]}),hl=e=>({id:"color",value:{mode:i.FieldColorModeId.Fixed,fixedColor:e}});class fl extends E{constructor(){super(...arguments),this.isDataLayer=!0,this._results=new h.ReplaySubject(1),this._dataLayersMerger=new Po}subscribeToAllLayers(e){e.length>0?this.querySub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayerUpdateReceived.bind(this)):(this._results.next({origin:this,data:V}),this.setStateHelper({data:V}))}_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={...V,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){Oe(this,e)}}class ml extends fl{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()}}}ml.Component=({model:e})=>{const{layers:t}=e.useState();return p().createElement(p().Fragment,null,t.map(e=>p().createElement(e.Component,{model:e,key:e.state.key})))};class gl extends E{constructor(e){super(e),this._results=new h.ReplaySubject(1),this._variableDependency=new rs(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 ml)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 Ds.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===i.DataTopic.Series)).map(e=>"operator"in e?e.operator:e),s=r.filter(e=>("options"in e||"topic"in e)&&e.topic===i.DataTopic.Annotations).map(e=>"operator"in e?e.operator:e);this._transformSub&&this._transformSub.unsubscribe();const l={interpolate:(t,n)=>{var r;return Ds.interpolate(this,t,{...null==(r=e.request)?void 0:r.scopedVars,...n})}};let u=[(0,i.transformDataFrame)(a,e.series,l)];e.annotations&&e.annotations.length>0&&s.length>0&&u.push((0,i.transformDataFrame)(s,null!=(n=e.annotations)?n:[]));let c=[],d=[];this._transformSub=(0,h.forkJoin)(u).pipe((0,h.map)(t=>(t.forEach(e=>{var t;for(const n of e)(null==(t=n.meta)?void 0:t.dataTopic)===i.DataTopic.Annotations?d.push(n):c.push(n)}),{...e,series:c,annotations:d})),(0,h.catchError)(t=>{var n;console.error("Error transforming data: ",t);const r=(null==(n=this.getSourceData().state.data)?void 0:n.errors)||[],a=(0,o.toDataQueryError)(t);a.message=`Error transforming data: ${a.message}`;const s={...e,state:i.LoadingState.Error,errors:[...r,a]};return(0,h.of)(s)})).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(Ds.interpolate(this,JSON.stringify(n),null==(t=e.request)?void 0:t.scopedVars)):n.map(t=>{var n;return"object"==typeof t?JSON.parse(Ds.interpolate(this,JSON.stringify(t),null==(n=e.request)?void 0:n.scopedVars)):t})}}class vl extends E{constructor(e){var t;super({options:{},fieldConfig:{defaults:{},overrides:[]},title:(0,le.t)("grafana-scenes.components.viz-panel.title.title","Title"),pluginId:"timeseries",_renderCounter:0,...e}),this._variableDependency=new rs(this,{statePaths:["title","options","fieldConfig"]}),this._structureRev=0,this.onTimeRangeChange=e=>{Ds.getTimeRange(this).onTimeRangeChange({raw:{from:(0,i.toUtc)(e.from),to:(0,i.toUtc)(e.to)},from:(0,i.toUtc)(e.from),to:(0,i.toUtc)(e.to)})},this.getTimeRange=e=>{const t=Ds.findObject(this,e=>e instanceof yl),n=Ds.getTimeRange(this);if(t instanceof yl&&t.isEnabled)return B(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:o}=this.state,s=t?e:(0,R.mergeWith)((0,R.cloneDeep)(o),e,(e,t,n,r)=>{if((0,R.isArray)(t))return t;e===t||void 0!==t||(r[n]=t)}),l=(0,i.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,R.merge)((0,R.cloneDeep)(n),e),o=(0,i.getPanelOptionsWithDefaults)({plugin:this._plugin,currentOptions:r,currentFieldConfig:a,isAfterPluginChange:!1});this._dataWithFieldConfig=void 0,this.setState({fieldConfig:o.fieldConfig})},this.interpolate=(e,t,n)=>Ds.interpolate(this,e,t,n),this.getDescription=()=>{this.publishEvent(new b({origin:this,interaction:"panel-description-shown"}),!0);const{description:e}=this.state;if(e){const t=this.interpolate(e);return(0,i.renderMarkdown)(t)}return""},this.onCancelQuery=()=>{var e;this.publishEvent(new b({origin:this,interaction:"panel-cancel-query-clicked"}),!0);const t=Ds.getData(this);null==(e=t.cancelQuery)||e.call(t)},this.onStatusMessageClick=()=>{this.publishEvent(new b({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===i.FieldMatcherID.byName&&t.matcher.options===e);if(a<0)return{...n,overrides:[...n.overrides,pl(e,t)]};const o=Array.from(r),s=o[a],l=s.properties.findIndex(e=>"color"===e.id);if(l<0)return o[a]={...s,properties:[...s.properties,hl(t)]},{...n,overrides:o};const u=Array.from(s.properties);return u[l]=hl(t),o[a]={...s,properties:u},{...n,overrides:o}})(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(il);if(o<0){if(t===Ye.SeriesVisibilityChangeMode.ToggleSelection){const e=ol([i,...dl(a,r)]);return{...n,overrides:[...n.overrides,e]}}const e=ol(cl(r,i));return{...n,overrides:[...n.overrides,e]}}const s=Array.from(a),[l]=s.splice(o,1);if(t===Ye.SeriesVisibilityChangeMode.ToggleSelection){let e=ll(l);const t=dl(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=ol([i,...t]);return{...n,overrides:[...s,a]}}const u=sl(l,i);return ul(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 b({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,o.getPluginImportUtils)();return null!=(t=n(e))?t:u.get(e)}(e);if(a)this._pluginLoaded(a,t,n,r);else{const{importPanelPlugin:a}=(0,o.getPluginImportUtils)();try{const i=a(e),o=Ds.getQueryController(this);o&&o.state.enableProfiling&&Be(i).pipe(ze({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 i.PanelPlugin(()=>null);return t.meta={id:e,name:e,sort:100,type:i.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 $s(this)}async _pluginLoaded(e,t,n,r){var a;const{options:o,fieldConfig:s,title:l,pluginVersion:u,_UNSAFE_customMigrationHandler:c}=this.state,d={title:l,options:o,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 gl?f.setState({transformations:d.transformations}):f instanceof Vo&&(f.clearParent(),f=new gl({transformations:d.transformations,$data:f})));const m=(0,i.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=Ds.getTimeRange(this);this._subs.add(e.subscribeToState(()=>this.forceRender()))}}_getPluginVersion(e){return e&&e.meta.info.version?e.meta.info.version:o.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,R.isEmpty)(c)&&this.onOptionsChange(c,!0,!0)}clearFieldConfigCache(){this._dataWithFieldConfig=void 0}applyFieldConfig(e){var t,n,r,a;const s=this._plugin;if(!s||s.meta.skipDataQuery||!e)return V;if(this._prevData===e&&this._dataWithFieldConfig)return this._dataWithFieldConfig;const l=s.dataSupport||{alertStates:!1,annotations:!1},u=s.fieldConfigRegistry,c=null!=(n=null==(t=this._dataWithFieldConfig)?void 0:t.series)?n:[],d=(0,i.applyFieldOverrides)({data:e.series,fieldConfig:this.state.fieldConfig,fieldConfigRegistry:u,replaceVariables:this.interpolate,theme:o.config.theme2,timeZone:null==(r=e.request)?void 0:r.timezone});return(0,i.compareArrayValues)(d,c,i.compareDataFrameStructures)||this._structureRev++,this._dataWithFieldConfig={...e,structureRev:this._structureRev,series:d},this._dataWithFieldConfig.annotations&&(this._dataWithFieldConfig.annotations=(0,i.applyFieldOverrides)({data:this._dataWithFieldConfig.annotations,fieldConfig:{defaults:{},overrides:[]},fieldConfigRegistry:u,replaceVariables:this.interpolate,theme:o.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,Ds.findObject(t,e=>e instanceof Fs));var t;const n={eventsScope:e?e.getEventsScope():"__global_",eventBus:e?e.getEventsBus(this):(0,o.getAppEvents)(),app:i.CoreApp.Unknown,sync:()=>e?e.state.sync:i.DashboardCursorSync.Off,onSeriesColorChange:this._onSeriesColorChange,onToggleSeriesVisibility:this._onSeriesVisibilityChange,onToggleLegendSort:this._onToggleLegendSort,onInstanceStateChange:this._onInstanceStateChange};return this.state.extendPanelContext&&this.state.extendPanelContext(this,n),n}}vl.Component=function({model:e}){var t;const{title:n,options:r,fieldConfig:a,_pluginLoadError:s,displayMode:l,hoverHeader:u,showMenuAlways:d,hoverHeaderOffset:h,menu:f,headerActions:m,titleItems:g,seriesLimit:v,seriesLimitShowAll:b,description:y,collapsible:w,collapsed:S,_renderCounter:x=0}=e.useState(),[E,{width:_,height:C}]=qs(),O=(0,c.useMemo)(()=>(0,o.getAppEvents)(),[]),k=(0,c.useCallback)(()=>{e.state.key&&O.publish(new i.SetPanelAttentionEvent({panelId:e.getPathId()}))},[e,O]),D=(0,c.useMemo)(()=>(0,R.debounce)(k,100,{leading:!0,trailing:!1}),[k]),A=e.getPlugin(),{dragClass:T,dragClassCancel:I}=function(e){var t,n;const r=Ds.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=Ds.getLayout(e);return null!=(n=null==(t=null==r?void 0:r.getDragHooks)?void 0:t.call(r))?n:{}}(e),L=Ds.getData(e),M=L.useState(),N=function(e,t,n){return(0,c.useMemo)(()=>(null==e?void 0:e.series)&&t&&!n?{...e,series:e.series.slice(0,t)}:e,[e,t,n])}(M.data,v,b),V=e.applyFieldConfig(N),$=Ds.getTimeRange(e).getTimeZone(),j=e.getTimeRange(V),F=p().useContext(Js);(0,c.useEffect)(()=>{L.isInViewChanged&&L.isInViewChanged(F)},[F,L]);const z=e.interpolate(n,void 0,"text"),B=(0,Ye.useStyles2)(rl);if(!A)return p().createElement("div",null,p().createElement(le.x6,{i18nKey:"grafana-scenes.components.viz-panel-renderer.loading-plugin-panel"},"Loading plugin panel..."));if(!A.panel)return p().createElement("div",null,p().createElement(le.x6,{i18nKey:"grafana-scenes.components.viz-panel-renderer.panel-plugin-has-no-panel-component"},"Panel plugin has no panel component"));const U=A.panel;L&&L.setContainerWidth&&L.setContainerWidth(Math.round(_));let W,H,q=[];g&&(Array.isArray(g)?q=q.concat(g.map(e=>p().createElement(e.Component,{model:e,key:`${e.state.key}`}))):$e(g)?q.push(p().createElement(g.Component,{model:g})):q.push(g)),v&&q.push(p().createElement(Gs,{key:"series-limit",data:M.data,seriesLimit:v,showAll:b,onShowAllSeries:()=>e.setState({seriesLimitShowAll:!b})})),e.state.$timeRange&&q.push(p().createElement(e.state.$timeRange.Component,{model:e.state.$timeRange,key:e.state.key})),V.alertState&&q.push(p().createElement(Ye.Tooltip,{content:null!=(t=V.alertState.state)?t:"unknown",key:`alert-states-icon-${e.state.key}`},p().createElement(Ye.PanelChrome.TitleItem,{className:(0,ot.cx)({[B.ok]:V.alertState.state===i.AlertState.OK,[B.pending]:V.alertState.state===i.AlertState.Pending,[B.alerting]:V.alertState.state===i.AlertState.Alerting})},p().createElement(Ye.Icon,{name:"alerting"===V.alertState.state?"heart-break":"heart",className:"panel-alert-icon",size:"md"})))),f&&(W=p().createElement(f.Component,{model:f})),m&&(H=Array.isArray(m)?p().createElement(p().Fragment,null,m.map(e=>p().createElement(e.Component,{model:e,key:`${e.state.key}`}))):$e(m)?p().createElement(m.Component,{model:m}):m);const G=V,Q=!L.isDataReadyToDisplay||L.isDataReadyToDisplay(),K=e.getPanelContext(),Y=e.getLegacyPanelId();return p().createElement("div",{className:tl},p().createElement("div",{ref:E,className:nl,"data-viz-panel-key":e.state.key},_>0&&C>0&&p().createElement(Ye.PanelChrome,{title:z,description:(null==y?void 0:y.trim())?e.getDescription:void 0,loadingState:G.state,statusMessage:el(G,s),statusMessageOnClick:e.onStatusMessageClick,width:_,height:C,selectionId:e.state.key,displayMode:l,titleItems:q,dragClass:T,actions:H,dragClassCancel:I,padding:A.noPadding?"none":"md",menu:W,onCancelQuery:e.onCancelQuery,onFocus:k,onMouseEnter:k,onMouseMove:D,onDragStart:t=>{var n;null==(n=P.onDragStart)||n.call(P,t,e)},showMenuAlways:d,...w?{collapsible:Boolean(w),collapsed:S,onToggleCollapse:e.onToggleCollapse}:{hoverHeader:u,hoverHeaderOffset:h}},(t,o)=>p().createElement(p().Fragment,null,p().createElement(Ye.ErrorBoundaryAlert,{dependencies:[A,G]},p().createElement(i.PluginContextProvider,{meta:A.meta},p().createElement(Ye.PanelContextProvider,{value:K},Q&&p().createElement(U,{id:Y,data:G,title:n,timeRange:j,timeZone:$,options:r,fieldConfig:a,transparent:"transparent"===l,width:t,height:o,renderCounter:x,replaceVariables:e.interpolate,onOptionsChange:e.onOptionsChange,onFieldConfigChange:e.onFieldConfigChange,onChangeTimeRange:e.onTimeRangeChange,eventBus:K.eventBus}))))))))};const bl=class e extends E{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=Ds.findAllObjects(this.getRoot(),e=>e instanceof vl);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}};bl.REFRESH_RATE=100;let yl=bl;function wl(e){if("string"==typeof e)return e;if(e){if(e instanceof Error)return e.message;if((0,o.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 Sl extends E{constructor(e,t=[]){super({isEnabled:!0,...e}),this._results=new h.ReplaySubject(1),this.isDataLayer=!0,this._variableValueRecorder=new We,this._variableDependency=new rs(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:V}),this.setStateHelper({data:V})),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(V))}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)?(T(),!0):!this.state.data)}setStateHelper(e){Oe(this,e)}}function xl({layer:e}){var t,n;const r=`data-layer-${e.state.key}`,{data:a,isEnabled:i}=e.useState(),o=Boolean(a&&a.state===M.Loading);return p().createElement("div",{className:El},p().createElement(Wt,{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}),p().createElement(Ye.InlineSwitch,{id:r,value:i,onChange:()=>e.setState({isEnabled:!i})}))}(class extends E{constructor(){super({})}}).Component=function({model:e}){const t=Ds.getDataLayers(e,!0);if(0===t.length)return null;return p().createElement(p().Fragment,null,t.map(e=>p().createElement(e.Component,{model:e,key:e.state.key})))};const El=(0,ot.css)({display:"flex"});function _l(e){return"function"==typeof e}function Cl(e){return function(t){if(function(e){return _l(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 Rl=function(e,t){return Rl=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])},Rl(e,t)};function Ol(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}Rl(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function kl(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 Dl(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 Al(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 Tl(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 Il(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 Pl(e){return this instanceof Pl?(this.v=e,this):new Pl(e)}function Ll(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 Pl?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 Ml(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Al(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 Nl,Vl=((Nl=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),Nl.prototype.constructor=Nl,Nl);function $l(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var jl=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=Al(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(_l(l))try{l()}catch(e){a=e instanceof Vl?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var c=Al(u),d=c.next();!d.done;d=c.next()){var p=d.value;try{zl(p)}catch(e){a=null!=a?a:[],e instanceof Vl?a=Il(Il([],Tl(a)),Tl(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 Vl(a)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)zl(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)&&$l(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&$l(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();jl.EMPTY;function Fl(e){return e instanceof jl||e&&"closed"in e&&_l(e.remove)&&_l(e.add)&&_l(e.unsubscribe)}function zl(e){_l(e)?e():e.unsubscribe()}var Bl={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Ul={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=Ul.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,Il([e,t],Tl(n))):setTimeout.apply(void 0,Il([e,t],Tl(n)))},clearTimeout:function(e){var t=Ul.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Wl(e){Ul.setTimeout(function(){var t=Bl.onUnhandledError;if(!t)throw e;t(e)})}function Hl(){}var ql=Gl("C",void 0,void 0);function Gl(e,t,n){return{kind:e,value:t,error:n}}var Ql=null;var Kl=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Fl(t)&&t.add(n)):n.destination=nu,n}return Ol(t,e),t.create=function(e,t,n){return new Jl(e,t,n)},t.prototype.next=function(e){this.isStopped?tu(function(e){return Gl("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?tu(function(e){return Gl("E",void 0,e)}(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?tu(ql,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}(jl),Yl=Function.prototype.bind;function Xl(e,t){return Yl.call(e,t)}var Zl=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){eu(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){eu(e)}else eu(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){eu(e)}},e}(),Jl=function(e){function t(t,n,r){var a,i,o=e.call(this)||this;_l(t)||!t?a={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:o&&Bl.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},a={next:t.next&&Xl(t.next,i),error:t.error&&Xl(t.error,i),complete:t.complete&&Xl(t.complete,i)}):a=t;return o.destination=new Zl(a),o}return Ol(t,e),t}(Kl);function eu(e){var t;Bl.useDeprecatedSynchronousErrorHandling?(t=e,Bl.useDeprecatedSynchronousErrorHandling&&Ql&&(Ql.errorThrown=!0,Ql.error=t)):Wl(e)}function tu(e,t){var n=Bl.onStoppedNotification;n&&Ul.setTimeout(function(){return n(e,t)})}var nu={closed:!0,next:Hl,error:function(e){throw e},complete:Hl};function ru(e,t,n,r,a){return new au(e,t,n,r,a)}var au=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 Ol(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}(Kl);function iu(e,t){return Cl(function(n,r){var a=0;n.subscribe(ru(r,function(n){r.next(e.call(t,n,a++))}))})}var ou="function"==typeof Symbol&&Symbol.observable||"@@observable";function su(e){return e}function lu(e){return 0===e.length?su:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var uu=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 Kl||function(e){return e&&_l(e.next)&&_l(e.error)&&_l(e.complete)}(r)&&Fl(r)?e:new Jl(e,t,n);return function(e){if(Bl.useDeprecatedSynchronousErrorHandling){var t=!Ql;if(t&&(Ql={errorThrown:!1,error:null}),e(),t){var n=Ql,r=n.errorThrown,a=n.error;if(Ql=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=cu(t))(function(t,r){var a=new Jl({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[ou]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return lu(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=cu(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 cu(e){var t;return null!==(t=null!=e?e:Bl.Promise)&&void 0!==t?t:Promise}var du="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function pu(e){if(e instanceof uu)return e;if(null!=e){if(function(e){return _l(e[ou])}(e))return o=e,new uu(function(e){var t=o[ou]();if(_l(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 uu(function(e){for(var t=0;t<a.length&&!e.closed;t++)e.next(a[t]);e.complete()});if(_l(null==(r=e)?void 0:r.then))return n=e,new uu(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Wl)});if(function(e){return Symbol.asyncIterator&&_l(null==e?void 0:e[Symbol.asyncIterator])}(e))return hu(e);if(function(e){return _l(null==e?void 0:e[du])}(e))return t=e,new uu(function(e){var n,r;try{for(var a=Al(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 _l(null==e?void 0:e.getReader)}(e))return hu(function(e){return Ll(this,arguments,function(){var t,n,r;return Dl(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,Pl(t.read())];case 3:return n=a.sent(),r=n.value,n.done?[4,Pl(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Pl(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 hu(e){return new uu(function(t){(function(e,t){var n,r,a,i;return kl(this,void 0,void 0,function(){var o,s;return Dl(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=Ml(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 fu(e,t,n){return void 0===n&&(n=1/0),_l(t)?fu(function(n,r){return iu(function(e,a){return t(n,e,r,a)})(pu(e(n,r)))},n):("number"==typeof t&&(n=t),Cl(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;pu(n(e,c++)).subscribe(ru(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(ru(t,h,function(){d=!0,p()})),function(){null==s||s()}}(t,r,e,n)}))}const mu={prepareAnnotation:e=>{if((0,R.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,h.of)(e).pipe(e=>e.pipe(fu(e=>{if(!(null==e?void 0:e.length))return(0,h.of)(void 0);if(1===e.length)return(0,h.of)(e[0]);const t={interpolate:e=>e};return(0,h.of)(e).pipe(i.standardTransformers.mergeTransformer.operator({},t),iu(e=>e[0]))})),iu(e=>{if(!(null==e?void 0:e.length))return[];let n=!1,r=!1;const a={};for(const t of e.fields){a[(0,i.getFieldDisplayName)(t,e).toLowerCase()]=t}t||(t={});const o=[];for(const s of vu){const l=t[s.key]||{};if(l.source===i.AnnotationEventFieldSource.Skip)continue;const u={key:s.key,split:s.split};if(l.source===i.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)&&(o.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 o){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 gu=[{key:"time",field:e=>e.fields.find(e=>e.type===i.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===i.FieldType.string),placeholder:"text, or the first text field"},{key:"tags",split:",",help:"The results will be split on comma (,)"},{key:"id"}],vu=[...o.config.publicDashboardAccessToken?[{key:"color"},{key:"isRegion"},{key:"source"}]:[],...gu,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];const bu=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];let yu=100;function wu(e,t,n,r,a,s){var l;if(e.annotationQuery&&function(e){const{type:t}=e;return!e.annotations||bu.includes(t)}(e))return console.warn("Using deprecated annotationQuery method, please upgrade your datasource"),(0,h.from)(e.annotationQuery({range:t.state.value,rangeRaw:t.state.value.raw,annotation:n,dashboard:{getVariables:(0,o.getTemplateSrv)().getVariables}})).pipe(iu(e=>({state:M.Done,events:e})));const u={...mu,...e.annotations},c={...null==(l=u.getDefaultQuery)?void 0:l.call(u),...n},d=u.prepareAnnotation(c);if(!d)return(0,h.of)({state:M.Done,events:[]});const p=u.prepareQuery(d);if(!p)return(0,h.of)({state:M.Done,events:[]});const f=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,m=i.rangeUtil.calculateInterval(t.state.value,f,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:It(r)},v={startTime:Date.now(),requestId:"AQ"+yu++,range:t.state.value,maxDataPoints:f,scopedVars:g,...m,app:i.CoreApp.Dashboard,timezone:t.getTimeZone(),targets:[{...p,refId:"Anno"}],scopes:Ds.getScopes(r),filters:a,groupByKeys:s,...Qe(r)};return(0,o.getRunRequest)()(e,v).pipe(fu(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:i.DataTopic.Annotations})}),u.processEvents(d,t).pipe(iu(t=>({state:e.state,events:t||[]})))):(0,h.of)({state:e.state,events:[]})}))}function Su(e){return"panel-alert"===e.eventType}(class extends Sl{constructor(e){super({isEnabled:!0,...e},["query"]),this._scopedVars={__sceneObject:It(this)},this._drilldownDependenciesManager=new Lo(this._variableDependency)}onEnable(){this.publishEvent(new o.RefreshEvent,!0);const e=Ds.getTimeRange(this);this.setState({query:{...this.state.query,enable:!0}}),this._timeRangeSub=e.subscribeToState(()=>{this.runWithTimeRange(e)})}onDisable(){var e;this.publishEvent(new o.RefreshEvent,!0),this.setState({query:{...this.state.query,enable:!1}}),null==(e=this._timeRangeSub)||e.unsubscribe()}runLayer(){T();const e=Ds.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())T();else try{let t=wu(await this.resolveDataSource(n),e,n,this,this._drilldownDependenciesManager.getFilters(),this._drilldownDependenciesManager.getGroupByKeys()).pipe(ze({type:"AnnotationsDataLayer/annotationsLoading",origin:this,cancel:()=>this.cancelQuery()}),(0,h.map)(e=>this.processEvents(n,e)));this.querySub=t.subscribe(e=>{this.publishResults(e)})}catch(e){this.publishResults({...V,state:M.Error,errors:[{message:wl(e)}]}),console.error("AnnotationsDataLayer error",e)}}async resolveDataSource(e){return await Ue(e.datasource||void 0,this._scopedVars)}processEvents(e,t){let n=(r=e,a=t.events||[],r.snapshotData&&delete(r=(0,R.cloneDeep)(r)).snapshotData,a.map(e=>{var t;const n={...e};switch(n.source=r,n.color=o.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,R.partition)(e,"id"),r=(0,R.groupBy)(n[0],"id");return t=(0,R.map)(r,e=>e.length>1&&!(0,R.every)(e,Su)?(0,R.find)(e,e=>"panel-alert"!==e.eventType):(0,R.head)(e)),t=(0,R.concat)(t,n[1]),t}(n);const s={...V,state:t.state},l=(0,i.arrayToDataFrame)(n);return l.meta={...l.meta,dataTopic:i.DataTopic.Annotations},s.series=[l],s}}).Component=function({model:e}){const{isHidden:t}=e.useState();if(t)return null;return p().createElement(xl,{layer:e})};function xu({variable:e,layout:t,showAlways:n,hideLabel:r}){return _(e,{shouldActivateOrKeepAlive:!0}).hide!==i.VariableHide.hideVariable||n?"vertical"===t?p().createElement("div",{className:Cu,"data-testid":it.pages.Dashboard.SubMenu.submenuItem},p().createElement(Eu,{variable:e,layout:t,hideLabel:r}),p().createElement(e.Component,{model:e})):p().createElement("div",{className:_u,"data-testid":it.pages.Dashboard.SubMenu.submenuItem},p().createElement(Eu,{variable:e,hideLabel:r}),p().createElement(e.Component,{model:e})):e.UNSAFE_renderAsHidden?p().createElement(e.Component,{model:e}):null}function Eu({variable:e,layout:t,hideLabel:n}){var r;const{state:a}=e;if(e.state.hide===i.VariableHide.hideLabel||n)return null;const o=`var-${a.key}`,s=a.label||a.name;return p().createElement(Wt,{htmlFor:o,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})}(class extends E{}).Component=function({model:e}){const t=Ds.getVariables(e).useState();return p().createElement(p().Fragment,null,t.variables.map(t=>p().createElement(xu,{key:t.state.key,variable:t,layout:e.state.layout})))};const _u=(0,ot.css)({display:"flex","> :nth-child(2)":(0,ot.css)({borderTopLeftRadius:0,borderBottomLeftRadius:0})}),Cu=(0,ot.css)({display:"flex",flexDirection:"column"});(class extends E{}).Component=function({model:e}){const t=Ds.lookupVariable(e.state.variableName,e);if(!t)return null;return p().createElement(xu,{key:t.state.key,variable:t,layout:e.state.layout,showAlways:!0})};class Ru extends E{constructor(e){super(e),this._variablesToUpdate=new Set,this._updating=new Map,this._variableValueRecorder=new We,this._variableDependency=new ku(this._handleParentVariableUpdatesCompleted.bind(this)),this._onActivate=()=>{const e=Ds.getTimeRange(this);this._subs.add(this.subscribeToEvent(ne,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===i.VariableRefresh.onTimeRangeChanged&&this._variablesToUpdate.add(e);this._updateNextBatch()}_checkForVariablesThatChangedWhileInactive(){if(this._variableValueRecorder.hasValues())for(const e of this.state.variables)this._variableValueRecorder.hasValueChanged(e)&&(Ou(e,"Changed while in-active"),this._addDependentVariablesToUpdateQueue(e))}_variableNeedsUpdate(e){return!e.isLazy&&(!!e.validateAndUpdate&&(!this._variableValueRecorder.hasRecordedValue(e)||(Ou(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(Ds.hasVariableDependencyInLoadingState(e))continue;const t={variable:e};this._updating.set(e,t),Ou(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),Ou(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),Ou(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)&&(Ou(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))||Ds.hasVariableDependencyInLoadingState(e)))}}function Ou(e,t,n){T(0,e.state.name)}class ku{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 Du extends Ae{constructor(e){super({type:"custom",query:"",value:"",text:"",options:[],name:"",...e}),this._variableDependency=new rs(this,{statePaths:["query"]})}getValueOptions(e){var t;const n=(null!=(t=Ds.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,h.of)(n)}}Du.Component=({model:e})=>p().createElement(_t,{model:e});class Au extends Ae{constructor(e){super({type:"datasource",value:"",text:"",options:[],name:"",regex:"",pluginId:"",...e}),this._variableDependency=new rs(this,{statePaths:["regex"]})}getValueOptions(e){if(!this.state.pluginId)return(0,h.of)([]);const t=(0,o.getDataSourceSrv)().getList({metrics:!0,variables:!1,pluginId:this.state.pluginId});let n;if(this.state.regex){const e=Ds.interpolate(this,this.state.regex,void 0,"regex");n=(0,i.stringToJsRegex)(e)}const r=[];for(let e=0;e<t.length;e++){const a=t[e];Tu(a,n)&&r.push({label:a.name,value:a.uid}),this.state.defaultOptionEnabled&&Iu(a,n)&&r.push({label:(0,le.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,h.of)(r)}}function Tu(e,t){return!t||t.exec(e.name)}function Iu(e,t){return!!e.isDefault&&(!t||t.exec("default"))}function Pu(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:Pu(n,t+1)})}return r}function Lu(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(Lu([r],t,n+1)))}else r.name===e&&(a=a.concat(Lu(r.children,t,n+1)));return a}function Mu(e){if(0===e.indexOf("value"))return[{name:e,children:[]}];return Lu(Pu("",0),e.split("."),0)}Au.Component=({model:e})=>p().createElement(_t,{model:e});function Nu({model:e}){const{value:t,key:n,loading:r}=e.useState(),a=(0,c.useCallback)(t=>{e.setValue(t.currentTarget.value)},[e]),i=(0,c.useCallback)(t=>{"Enter"===t.key&&e.setValue(t.currentTarget.value)},[e]);return p().createElement(Ye.AutoSizeInput,{id:n,placeholder:(0,le.t)("grafana-scenes.variables.variable-value-input.placeholder-enter-value","Enter value"),minWidth:15,maxWidth:30,value:t,loading:r,onBlur:a,onKeyDown:i})}(class extends Ae{constructor(e,t=!1){super({type:"custom",name:"Test",value:"Value",text:(0,le.t)("grafana-scenes.variables.test-variable.text.text","Text"),query:"Query",options:[],refresh:i.VariableRefresh.onDashboardLoad,updateOptions:!0,...e}),this.completeUpdate=new h.Subject,this.isGettingValues=!0,this.getValueOptionsCount=0,this.isLazy=!1,this._variableDependency=new rs(this,{statePaths:["query"]}),this.isLazy=t}getValueOptions(e){const{delayMs:t}=this.state;this.getValueOptionsCount+=1;const n=Ds.getQueryController(this);return new h.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=Ds.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=j(this,e=>e instanceof Ru?e:void 0);null==e||e.cancel(this)}getOptions(e){return this.state.optionsToReturn?this.state.optionsToReturn:Mu(e).map(e=>({label:e.name,value:e.name}))}signalUpdateCompleted(){this.completeUpdate.next(1)}}).Component=({model:e})=>p().createElement(_t,{model:e});(class extends E{constructor(e){super({type:"textbox",value:"",name:"",...e}),this._urlSync=new $(this,{keys:()=>this.getKeys()})}getValue(){return this.state.value}setValue(e){e!==this.state.value&&(this.setState({value:e}),this.publishEvent(new ne(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)}}).Component=({model:e})=>p().createElement(Nu,{model:e});(class extends E{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:js.CO.onTimeRangeChanged,...e}),this._onChange=e=>{this.setState({value:e.value}),this.publishEvent(new ne(this),!0)},this._urlSync=new $(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=we: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:we,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===we?this.getAutoRefreshInteval(t,n):e}getAutoRefreshInteval(e,t){const n=Ds.getTimeRange(this).state.value;return i.rangeUtil.calculateInterval(n,e,t).interval}validateAndUpdate(){const{value:e,intervals:t}=this.state;let n=!1;if(e===we)n=!0;else if(!e&&t.length>0){const e=t[0];this.setState({value:e}),n=!0}return n&&this.publishEvent(new ne(this),!0),(0,h.of)({})}}).Component=({model:e})=>{const{key:t,value:n}=e.useState();return p().createElement(Ye.Select,{id:t,placeholder:(0,le.t)("grafana-scenes.variables.interval-variable.placeholder-select-value","Select value"),width:"auto",value:n,tabSelectsValue:!1,options:e.getOptionsForSelect(),onChange:e._onChange})};var Vu,$u,ju=e=>{throw TypeError(e)},Fu=(e,t,n)=>t.has(e)||ju("Cannot "+n),zu=(e,t,n)=>(Fu(e,t,"read from private field"),n?n.call(e):t.get(e)),Bu=(e,t,n)=>t.has(e)?ju("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Uu=(e,t,n,r)=>(Fu(e,t,"write to private field"),t.set(e,n),n);class Wu extends i.BusEventWithPayload{}Wu.type="new-scene-object-added";class Hu{constructor(e={},t=o.locationService){this._options=e,this._locationService=t,this._paramsCache=new qu(t),this._urlKeyMapper=new Ts({namespace:e.namespace,excludeFromNamespace:e.excludeFromNamespace})}initSync(e){var t;if(this._subs&&(T(0,0,null==(t=this._sceneRoot)||t.state.key),this._subs.unsubscribe()),T(0,0,e.state.key),this._sceneRoot=e,this._subs=new h.Subscription,this._subs.add(e.subscribeToEvent(v,e=>{this.handleSceneObjectStateChanged(e.payload.changedObject)})),this._subs.add(e.subscribeToEvent(Wu,e=>{this.handleNewObject(e.payload)})),this._urlKeyMapper.clear(),this._lastLocation=this._locationService.getLocation(),this.handleNewObject(this._sceneRoot),this._options.updateUrlOnInit){const t=Ps(e,this._urlKeyMapper.getOptions());(function(e,t){for(let n in e)if(!Ns(t.getAll(n),e[n]))return!0;return!1})(t,this._paramsCache.getParams())&&this._locationService.partial(t,!0)}}cleanUp(e){this._sceneRoot===e&&(T(),this._subs&&(this._subs.unsubscribe(),this._subs=void 0,T(0,0,(this._sceneRoot.state.key,e.state.key))),this._sceneRoot=void 0,this._lastLocation=void 0)}handleNewLocation(e){this._sceneRoot&&this._lastLocation!==e&&(T(),this._lastLocation=e,Ls(this._sceneRoot,this._paramsCache.getParams(),this._urlKeyMapper))}handleNewObject(e){this._sceneRoot&&Ls(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);Ns(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));T(),this._locationService.partial(i,a),this._lastLocation=this._locationService.getLocation()}}getUrlState(e){return Ps(e,this._urlKeyMapper.getOptions())}}class qu{constructor(e){this.locationService=e,Bu(this,Vu),Bu(this,$u)}getParams(){const e=this.locationService.getLocation();return zu(this,$u)===e||(Uu(this,$u,e),Uu(this,Vu,new URLSearchParams(e.search))),zu(this,Vu)}}function Gu(e,t={}){const n=(0,a.useLocation)(),r=ke(),[i,o]=(0,c.useState)(!1),s=function(e,t){return(0,c.useMemo)(()=>new Hu({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,c.useEffect)(()=>(s.initSync(e),o(!0),()=>s.cleanUp(e)),[e,s]),(0,c.useEffect)(()=>{const e=r.getLocation(),t=e!==n?e:n;e!==n&&T(),s.handleNewLocation(t)},[e,s,n,r]),i}function Qu({children:e,scene:t,updateUrlOnInit:n,createBrowserHistorySteps:r,namespace:a,excludeFromNamespace:i}){return Gu(t,{updateUrlOnInit:n,createBrowserHistorySteps:r,namespace:a,excludeFromNamespace:i})?e:null}Vu=new WeakMap,$u=new WeakMap;class Ku extends E{constructor(e){super(e),this.addActivationHandler(()=>{const e=function(e){const t=window.__grafanaSceneContext;return T(),window.__grafanaSceneContext=e,()=>{window.__grafanaSceneContext===e&&(T(),window.__grafanaSceneContext=t)}}(this);return()=>{e()}})}}Ku.Component=function({model:e}){const{body:t,controls:n}=e.useState(),r=(0,Ye.useStyles2)(Yu);return p().createElement("div",{className:r.container},n&&p().createElement("div",{className:r.controls},n.map(e=>p().createElement(e.Component,{key:e.state.key,model:e}))),p().createElement("div",{className:r.body},p().createElement(t.Component,{model:t})))};const Yu=e=>({container:(0,ot.css)({flexGrow:1,display:"flex",gap:e.spacing(2),minHeight:"100%",flexDirection:"column"}),body:(0,ot.css)({flexGrow:1,display:"flex",gap:e.spacing(1)}),controls:(0,ot.css)({display:"flex",gap:e.spacing(2),alignItems:"flex-end",flexWrap:"wrap"})});class Xu extends E{addItem(e){this.setState({items:this.state.items?[...this.state.items,e]:[e]})}setItems(e){this.setState({items:e})}}Xu.Component=function({model:e}){const{items:t=[]}=e.useState(),n=p().useRef(null);(0,c.useEffect)(()=>{n.current&&n.current.focus()},[]);const r=e=>e.map(e=>{switch(e.type){case"divider":return p().createElement(Ye.Menu.Divider,{key:e.text});case"group":return p().createElement(Ye.Menu.Group,{key:e.text,label:e.text},e.subMenu?r(e.subMenu):void 0);default:return p().createElement(Ye.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:it.components.Panels.Panel.menuItems(e.text)})}});return p().createElement(Ye.Menu,{ref:n},r(t))};var Zu=function(){return Zu=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},Zu.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function Ju(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={loading:!1});var r,a,i=(0,c.useRef)(0),o=(r=(0,c.useRef)(!1),a=(0,c.useCallback)(function(){return r.current},[]),(0,c.useEffect)(function(){return r.current=!0,function(){r.current=!1}},[]),a),s=(0,c.useState)(n),l=s[0],u=s[1],d=(0,c.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 Zu(Zu({},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,d]}(class extends E{constructor(e={}){super({options:e})}}).Component=function({model:e}){const{options:t}=e.useState(),{data:n}=Ds.getData(e).useState(),{from:r,to:a}=Ds.getTimeRange(e).useState(),{value:i}=function(e,t){void 0===t&&(t=[]);var n=Ju(e,t,{loading:!0}),r=n[0],a=n[1];return(0,c.useEffect)(function(){a()},[a]),r}(async()=>n?async function(e,t,n,r){var a,i,s,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:It(t)},f=(await Promise.allSettled(u.map(async e=>{var t;const n=await(0,o.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==(s=m.find(e=>{var t;return!!(null==(t=e.datasource)?void 0:t.uid)}))?void 0:s.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""}(n,e,{from:r,to:a},t.transform):"",[n,e,r,a]),s=(0,o.useReturnToPrevious)();if(i)return p().createElement(Ye.LinkButton,{key:"explore",icon:"compass",size:"sm",variant:"secondary",href:i,onClick:()=>{var e;t.returnToPrevious&&s(t.returnToPrevious.title,t.returnToPrevious.href),null==(e=t.onClick)||e.call(t)}},p().createElement(le.x6,{i18nKey:"grafana-scenes.components.viz-panel-explore-button.explore"},"Explore"));return null};function ec(e){return e instanceof fc}(class extends E{}).Component=function({model:e}){const{body:t}=e.useState(),n=e.parent;if(n&&(r=n,!(r instanceof cc))&&!ec(n))throw new Error("SceneGridItem must be a child of SceneGridLayout or SceneGridRow");var r;if(!t)return null;return p().createElement(t.Component,{model:t})};var tc=n(2548),nc=n.n(tc);const rc=(0,ot.css)({flex:"1 1 auto",position:"relative",zIndex:1,width:"100%"}),ac=p().forwardRef((e,t)=>{var n;const{grid:r,layoutItem:a,index:i,totalCount:o,isLazy:s,style:l,onLoad:u,onChange:c,children:d,...h}=e,f=r.getSceneLayoutChild(a.i),m=null==(n=f.getClassName)?void 0:n.call(f),g=p().createElement(f.Component,{model:f,key:f.state.key});return s?p().createElement(Xs,{...h,key:f.state.key,"data-griditem-key":f.state.key,className:(0,ot.cx)(m,e.className),style:l,ref:t},g,d):p().createElement("div",{...h,ref:t,key:f.state.key,"data-griditem-key":f.state.key,className:(0,ot.cx)(m,e.className),style:l},g,d)});function ic(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(()=>ic(e,t,!0),50)}ac.displayName="GridItemWrapper";const oc=p().forwardRef(({handleAxis:e,...t},n)=>{const r=(0,Ye.useStyles2)(sc);return p().createElement("div",{ref:n,...t,className:`${r} scene-resize-handle`},p().createElement("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p().createElement("path",{d:"M21 15L15 21M21 8L8 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})))});function sc(e){return(0,ot.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"}})}oc.displayName="ResizeHandle";class lc extends i.BusEventWithPayload{}lc.type="scene-grid-layout-drag-start";const uc=class e extends E{constructor(e){super({...e,children:pc(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};dc(e.state,n)||e.setState({...n})}this.setState({children:pc(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=hc(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 fc&&De(i)&&(this._loadOldLayout=!0),r instanceof fc&&i instanceof fc&&(this.isRowDropValid(e,n,a)||(this._loadOldLayout=!0),i=this),i===r.parent||this._loadOldLayout||(o=this.moveChildTo(r,i)),this.setState({children:pc(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 lc({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 fc)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),ec(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 fc)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 fc)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 fc||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 fc){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 fc){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 fc&&(l=!!e.state.isCollapsed,u=!1),De(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 fc&&!e.state.isCollapsed)for(const t of e.state.children)n.push(this.toGridCell(t));return n=hc(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)}};uc.Component=function({model:e}){const{children:t,isLazy:n,isDraggable:r,isResizable:a}=e.useState(),[i,{width:o,height:s}]=qs(),l=(0,c.useRef)(null);return(0,c.useEffect)(()=>{ic(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),p().createElement("div",{ref:i,className:rc},((t,i)=>{if(!t||!i)return null;const o=e.buildGridLayout(t,i);return p().createElement("div",{ref:l,style:{width:`${t}px`,height:"100%"},className:"react-grid-layout"},p().createElement(nc(),{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:p().createElement(oc,null)},o.map((t,r)=>p().createElement(ac,{key:t.i,grid:e,layoutItem:t,index:r,isLazy:n,totalCount:o.length}))))})(o,s))};let cc=uc;function dc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pc(e){return e.forEach(e=>{e instanceof fc&&e.setState({children:pc(e.state.children)})}),[...e].sort((e,t)=>e.state.y-t.state.y||e.state.x-t.state.x)}function hc(e){return[...e].sort((e,t)=>e.y-t.y||e.x-t.x)}class fc extends E{constructor(e){super({children:e.children||[],isCollapsible:e.isCollapsible||!0,title:e.title||"",...e,x:0,height:1,width:24}),this._variableDependency=new rs(this,{statePaths:["title"],handleTimeMacros:!0}),this.onCollapseToggle=()=>{this.state.isCollapsible&&this.getGridLayout().toggleRow(this)}}getGridLayout(){const e=this.parent;if(!(e&&e instanceof cc))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}}fc.Component=function({model:e}){const t=(0,Ye.useStyles2)(mc),{isCollapsible:n,isCollapsed:r,title:a,actions:i,children:o}=e.useState(),s=e.getGridLayout(),l=s.getDragClass(),u=s.isDraggable()&&!De(e),c=e.getPanelCount(o),d=1===c?"panel":"panels";return p().createElement("div",{className:(0,ot.cx)(t.row,r&&t.rowCollapsed)},p().createElement("div",{className:t.rowTitleAndActionsGroup},p().createElement("button",{onClick:e.onCollapseToggle,className:t.rowTitleButton,"aria-label":r?(0,le.t)("grafana-scenes.components.scene-grid-row.expand-row","Expand row"):(0,le.t)("grafana-scenes.components.scene-grid-row.collapse-row","Collapse row"),"data-testid":it.components.DashboardRow.title(Ds.interpolate(e,a,void 0,"text"))},n&&p().createElement(Ye.Icon,{name:r?"angle-right":"angle-down"}),p().createElement("span",{className:t.rowTitle,role:"heading"},Ds.interpolate(e,a,void 0,"text"))),p().createElement("span",{className:(0,ot.cx)(t.panelCount,r&&t.panelCountCollapsed)},"(",c," ",d,")"),i&&p().createElement("div",{className:t.rowActions},p().createElement(i.Component,{model:i}))),u&&r&&p().createElement("div",{className:(0,ot.cx)(t.dragHandle,l)},p().createElement(Ye.Icon,{name:"draggabledots"})))};const mc=e=>({row:(0,ot.css)({width:"100%",height:"30px",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowTitleButton:(0,ot.css)({display:"flex",alignItems:"center",cursor:"pointer",background:"transparent",border:"none",minWidth:0,gap:e.spacing(1)}),rowCollapsed:(0,ot.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),rowTitle:(0,ot.css)({fontSize:e.typography.h5.fontSize,fontWeight:e.typography.fontWeightMedium,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",flexGrow:1,minWidth:0}),collapsedInfo:(0,ot.css)({fontSize:e.typography.bodySmall.fontSize,color:e.colors.text.secondary,display:"flex",alignItems:"center",flexGrow:1}),rowTitleAndActionsGroup:(0,ot.css)({display:"flex",minWidth:0,"&:hover, &:focus-within":{"& > div":{opacity:1}}}),rowActions:(0,ot.css)({display:"flex",whiteSpace:"nowrap",opacity:0,transition:"200ms opacity ease-in 200ms","&:hover, &:focus-within":{opacity:1}}),dragHandle:(0,ot.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,ot.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,ot.css)({display:"inline-block"})});(class extends E{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})}}}).Component=function({model:e}){const{title:t,isCollapsed:n,canCollapse:r,canRemove:a,body:i,controls:o}=e.useState(),s=(0,Ye.useStyles2)(mc),l=(0,Ye.useStyles2)(gc),u=(null!=o?o:[]).map(e=>p().createElement(e.Component,{key:e.state.key,model:e}));a&&u.push(p().createElement(Ye.ToolbarButton,{icon:"times",variant:"default",onClick:e.onRemove,key:"remove-button","aria-label":(0,le.t)("grafana-scenes.components.nested-scene-renderer.remove-button-label","Remove scene")}));return p().createElement("div",{className:l.wrapper},p().createElement("div",{className:(0,ot.cx)(l.row,n&&l.rowCollapsed)},p().createElement("button",{onClick:e.onToggle,className:s.rowTitleButton,"aria-label":n?(0,le.t)("grafana-scenes.components.nested-scene-renderer.expand-button-label","Expand scene"):(0,le.t)("grafana-scenes.components.nested-scene-renderer.collapse-button-label","Collapse scene")},r&&p().createElement(Ye.Icon,{name:n?"angle-right":"angle-down"}),p().createElement("span",{className:s.rowTitle,role:"heading"},Ds.interpolate(e,t,void 0,"text"))),p().createElement("div",{className:l.actions},u)),!n&&p().createElement(i.Component,{model:i}))};const gc=e=>({wrapper:(0,ot.css)({display:"flex",flexDirection:"column",flexGrow:1,gap:e.spacing(1)}),row:(0,ot.css)({width:"100%",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowCollapsed:(0,ot.css)({borderBottom:`1px solid ${e.colors.border.weak}`,paddingBottom:e.spacing(1)}),actions:(0,ot.css)({display:"flex",alignItems:"center",gap:e.spacing(1),justifyContent:"flex-end",flexGrow:1})});(class extends E{constructor(){super(...arguments),this._variableDependency=new rs(this,{statePaths:["text"]})}}).Component=function({model:e}){const{text:t,fontSize:n=20,align:r="left",key:a,spacing:i}=e.useState(),o=(0,Ye.useTheme2)(),s=(0,ot.css)({fontSize:n,display:"flex",flexGrow:1,alignItems:"center",padding:i?o.spacing(i,0):void 0,justifyContent:r});return p().createElement("div",{className:s,"data-testid":a},Ds.interpolate(e,t))};(class extends E{}).Component=({model:e})=>{const t=e.useState();return p().createElement(Ye.ToolbarButton,{onClick:t.onClick,icon:t.icon})};(class extends E{}).Component=({model:e})=>{const t=e.useState();return p().createElement("div",{style:{display:"flex"}},t.label&&p().createElement(Wt,{label:t.label}),p().createElement(Ye.Input,{defaultValue:t.value,width:8,onBlur:t=>{e.state.onChange(parseInt(t.currentTarget.value,10))}}))};const vc=function(e,t,n){if(!Us)return[t,Bs,Bs];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,c.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,c.useState)(function(){return a.current(e)}),o=i[0],s=i[1];(0,c.useLayoutEffect)(function(){return s(a.current(e))},[e]);var l=(0,c.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,c.useCallback)(function(){try{localStorage.removeItem(e),s(void 0)}catch(e){}},[e,s]);return[o,l,u]};class bc extends E{constructor(){super(...arguments),this.onZoom=()=>{const e=Ds.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,o=r+a/2,s=r-a/2;return{from:(0,i.toUtc)(s),to:(0,i.toUtc)(o),raw:{from:(0,i.toUtc)(s),to:(0,i.toUtc)(o)}}}(e.state.value,2);e.onTimeRangeChange(t)},this.onChangeFiscalYearStartMonth=e=>{Ds.getTimeRange(this).setState({fiscalYearStartMonth:e})},this.toAbsolute=()=>{const e=Ds.getTimeRange(this),t=e.state.value,n=(0,i.toUtc)(t.from),r=(0,i.toUtc)(t.to);e.onTimeRangeChange({from:n,to:r,raw:{from:n,to:r}})},this.onMoveBackward=()=>{const e=Ds.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(yc(0,t))},this.onMoveForward=()=>{const e=Ds.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(yc(1,t,Date.now()))}}}function yc(e,t,n){const r=t.to.valueOf(),a=t.from.valueOf(),o=(r-a)/2;let s,l;0===e?(s=a-o,l=r-o):(s=a+o,l=r+o,void 0!==n&&l>n&&r<n&&(l=n,s=a));const u=(0,i.toUtc)(s),c=(0,i.toUtc)(l);return{from:u,to:c,raw:{from:u,to:c}}}bc.Component=function({model:e}){const{hidePicker:t,isOnCanvas:n,quickRanges:r,defaultQuickRanges:a}=e.useState(),o=Ds.getTimeRange(e),s=o.getTimeZone(),l=o.useState(),[u,c]=vc(wc,[],{raw:!1,serializer:xc,deserializer:Sc});if(t)return null;const d=r||a,h=(l.value.to.valueOf()-l.value.from.valueOf())/2,f=(0,i.intervalToAbbreviatedDurationString)({start:new Date(l.value.from.valueOf()),end:new Date(l.value.from.valueOf()+h)}),m=l.value.to.valueOf()+h<=Date.now()?f:void 0;return p().createElement(Ye.TimeRangePicker,{isOnCanvas:null==n||n,value:l.value,onChange:e=>{var t;t=e,((0,i.isDateTime)(t.raw.from)||(0,i.isDateTime)(t.raw.to))&&c([e,...null!=u?u:[]]),o.onTimeRangeChange(e)},timeZone:s,fiscalYearStartMonth:l.fiscalYearStartMonth,onMoveBackward:e.onMoveBackward,onMoveForward:e.onMoveForward,moveForwardTooltip:m?(0,le.t)("grafana-scenes.components.time-picker.move-forward-tooltip","Move {{moveForwardDuration}} forward",{moveForwardDuration:m}):void 0,moveBackwardTooltip:(0,le.t)("grafana-scenes.components.time-picker.move-backward-tooltip","Move {{moveBackwardDuration}} backward",{moveBackwardDuration:f}),onZoom:e.onZoom,onChangeTimeZone:o.onTimeZoneChange,onChangeFiscalYearStartMonth:e.onChangeFiscalYearStartMonth,weekStart:l.weekStart,history:u,quickRanges:d})};const wc="grafana.dashboard.timepicker.history";function Sc(e){return JSON.parse(e).map(e=>i.rangeUtil.convertRawToRange(e,"utc",void 0,"YYYY-MM-DD HH:mm:ss"))}function xc(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,R.uniqBy)(t,e=>e.from+e.to).slice(0,4)));var t}const Ec=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"];class _c extends E{constructor(e){var t,n,r;super({refresh:"",...e,autoValue:void 0,autoEnabled:null==(t=e.autoEnabled)||t,autoMinInterval:null!=(n=e.autoMinInterval)?n:o.config.minRefreshInterval,intervals:(null!=(r=e.intervals)?r:Ec).filter(t=>{var n;const r=null!=(n=e.minRefreshInterval)?n:o.config.minRefreshInterval;try{return!r||i.rangeUtil.intervalToMs(t)>=i.rangeUtil.intervalToMs(r)}catch(e){return!1}})}),this._urlSync=new $(this,{keys:["refresh"]}),this._autoRefreshBlocked=!1,this.onRefresh=()=>{const e=Ds.getQueryController(this);if(null==e?void 0:e.state.isRunning)return e.cancelAll(),void e.cancelProfile();null==e||e.startProfile(H);const t=Ds.getTimeRange(this);this._intervalTimer&&clearInterval(this._intervalTimer),t.onRefresh(),this.setupIntervalTimer()},this.onIntervalChanged=e=>{this.setState({refresh:e}),this.setupIntervalTimer()},this.setupAutoTimeRangeListener=()=>Ds.getTimeRange(this).subscribeToState((e,t)=>{e.from===t.from&&e.to===t.to||this.setupIntervalTimer()}),this.calculateAutoRefreshInterval=()=>{var e;const t=Ds.getTimeRange(this),n=null!=(e=null==window?void 0:window.innerWidth)?e:2e3;return i.rangeUtil.calculateInterval(t.state.value,n,this.state.autoMinInterval)},this.setupIntervalTimer=()=>{var e;const t=Ds.getTimeRange(this),{refresh:n,intervals:r}=this.state;if((this._intervalTimer||""===n)&&clearInterval(this._intervalTimer),""===n)return;if(n!==Ye.RefreshPicker.autoOption.value&&r&&!r.includes(n))return;let a;if(null==(e=this._autoTimeRangeListener)||e.unsubscribe(),n===Ye.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=i.rangeUtil.intervalToMs(n);this._intervalTimer=setInterval(()=>{if(this.isTabVisible()){const e=Ds.getQueryController(this);(null==e?void 0:e.state.isRunning)&&e.cancelProfile(),null==e||e.startProfile(H),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 i.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}}_c.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=Ds.getQueryController(e);if(!t)return!1;return t.useState().isRunning}(e);let c,d,h=n===(null==(t=Ye.RefreshPicker.autoOption)?void 0:t.value)?i:l?"Refresh":void 0;u&&(c="Cancel all queries",l&&(h="Cancel"));l&&(d="96px");return p().createElement(Ye.RefreshPicker,{showAutoInterval:a,value:n,intervals:r,tooltip:c,width:d,text:h,onRefresh:()=>{e.onRefresh()},primary:s,onIntervalChanged:e.onIntervalChanged,isLoading:u,isOnCanvas:null==o||o})};const Cc=e=>`${e}-compare`,Rc="__previousPeriod",Oc="__noPeriod",kc={label:"Previous period",value:Rc},Dc={label:"None",value:Oc},Ac=[{label:"Day before",value:"24h"},{label:"Week before",value:"1w"},{label:"Month before",value:"1M"}];(class extends E{constructor(e){super({compareOptions:Ac,...e}),this._urlSync=new $(this,{keys:["compareWith"]}),this._onActivate=()=>{const e=Ds.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=Rc),this.setState(n)}))},this.getCompareOptions=e=>{const t=Math.ceil(e.to.diff(e.from)),n=Ac.findIndex(({value:e})=>i.rangeUtil.intervalToMs(e)>=t);return[Dc,kc,...Ac.slice(n).map(({label:e,value:t})=>({label:e,value:t}))]},this.onCompareWithChanged=e=>{e===Oc?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:Tc}),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===Rc){const r=e.to.diff(e.from);t=(0,i.dateTime)(e.from).subtract(r),n=(0,i.dateTime)(e.to).subtract(r)}else t=(0,i.dateTime)(e.from).subtract(i.rangeUtil.intervalToMs(this.state.compareWith)),n=(0,i.dateTime)(e.to).subtract(i.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=z(e.compareWith);if(t){this.getCompareOptions(Ds.getTimeRange(this).state.value).find(({value:e})=>e===t)?this.setState({compareWith:t}):this.setState({compareWith:"__previousPeriod"})}}}).Component=function({model:e}){var t;const n=(0,Ye.useStyles2)(Ic),{compareWith:r,compareOptions:a,hideCheckbox:i}=e.useState(),[o,s]=p().useState(r),l=null!=(t=a.find(({value:e})=>e===o))?t:kc,u=a.find(({value:e})=>e===r),c=Boolean(u),d=()=>{c?(s(r),e.onClearCompare()):c||e.onCompareWithChanged(l.value)},h=i&&!r?Dc:u,f=i||c,m=i&&h?{...h,label:`Comparison: ${h.label}`}:h;return p().createElement(Ye.ButtonGroup,null,!i&&p().createElement(Ye.ToolbarButton,{variant:"canvas",tooltip:(0,le.t)("grafana-scenes.components.scene-time-range-compare-renderer.button-tooltip","Enable time frame comparison"),onClick:e=>{e.stopPropagation(),e.preventDefault(),d()}},p().createElement(Ye.Checkbox,{label:" ",value:c,onClick:d}),p().createElement(le.x6,{i18nKey:"grafana-scenes.components.scene-time-range-compare-renderer.button-label"},"Comparison")),f?p().createElement(Ye.ButtonSelect,{variant:"canvas",value:m,options:a,onChange:t=>{e.onCompareWithChanged(t.value)}}):p().createElement(Ye.ToolbarButton,{className:n.previewButton,disabled:!0,variant:"canvas",isOpen:!1},l.label))};const Tc=(e,t)=>{const n=t.timeRange.from.diff(e.timeRange.from);return t.series.forEach(e=>{e.refId=Cc(e.refId||""),e.meta={...e.meta,timeCompare:{diffMs:n,isTimeShiftQuery:!0}}}),(0,h.of)(t)};function Ic(e){return{previewButton:(0,ot.css)({"&:disabled":{border:`1px solid ${e.colors.secondary.border}`,color:e.colors.text.disabled,opacity:1}})}}(class extends E{constructor(e){super(e),this.addActivationHandler(()=>{const e=Ds.getData(this);this._subs.add(e.subscribeToState(e=>{var t;(null==(t=e.data)?void 0:t.state)===i.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})}}).Component=({model:e})=>{const{body:t}=e.useState();return p().createElement(t.Component,{model:t})};(class extends E{constructor(e){super(e),this._variableDependency=new rs(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler(()=>this.performRepeat())}performRepeat(){if(this._variableDependency.hasDependencyInLoadingState())return;const e=Ds.lookupVariable(this.state.variableName,this);if(!(e instanceof Ae))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})}}).Component=({model:e})=>{const{body:t}=e.useState();return p().createElement(t.Component,{model:t})};class Pc extends E{constructor(){super({}),this._renderBeforeActivation=!0}}Pc.Component=e=>p().createElement("div",{style:{flexGrow:1}});class Lc extends E{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}Lc.Component=function({model:e,parentState:t}){const{children:n,isHidden:r}=e.useState(),a=function(e,t){return(0,c.useMemo)(()=>{var n,r,a,i,s,l,u,c,d,p;const{direction:h="row",wrap:f}=e,m=o.config.theme2,g={};return t?Nc(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==(s=e.md)?void 0:s.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,ot.css)(g)},[t,e])}(e.state,t);if(r)return null;return p().createElement("div",{className:a},n.map(t=>{const n=t.Component;return p().createElement(n,{key:t.state.key,model:t,parentState:e.state})}))};class Mc extends E{}function Nc(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}Mc.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,c.useMemo)(()=>{var n,r,a,i,s,l,u,c,d,p;const h=o.config.theme2,f=Nc({},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==(s=e.md)?void 0:s.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,ot.css)(f)},[e,t])}(e.state,t);if(!n||r)return null;return p().createElement("div",{className:a},p().createElement(n.Component,{model:n}))};class Vc extends E{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}}Vc.Component=function({model:e}){const{children:t,isHidden:n,isLazy:r}=e.useState(),a=(i=e.state,(0,c.useMemo)(()=>{var e,t,n,r,a,s,l,u,c,d,p;const h={},f=o.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!=(s=null==(a=i.md)?void 0:a.rowGap)?s: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,ot.css)(h)},[i]));var i;if(n)return null;return p().createElement("div",{className:a},t.map(t=>{const n=t.Component;return r?p().createElement(Xs,{key:t.state.key,className:a},p().createElement(n,{key:t.state.key,model:t,parentState:e.state})):p().createElement(n,{key:t.state.key,model:t,parentState:e.state})}))};class $c extends E{}$c.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,c.useMemo)(()=>{const e={};return e.gridColumn=i.gridColumn||"unset",e.gridRow=i.gridRow||"unset",e.position="relative",(0,ot.css)(e)},[i]));var i;if(!n||r)return null;return p().createElement("div",{className:a},p().createElement(n.Component,{model:n}))};const jc=new Set(["ArrowUp","ArrowDown"]),Fc=new Set(["ArrowLeft","ArrowRight"]),zc={row:{dim:"width",axis:"clientX",min:"minWidth",max:"maxWidth"},column:{dim:"height",axis:"clientY",min:"minHeight",max:"maxHeight"}};function Bc({direction:e="row",handleSize:t=32,initialSize:n="auto",primaryPaneStyles:r,secondaryPaneStyles:a,onDragFinished:i,children:o}){const s=p().Children.toArray(o),l=(0,c.useRef)(null),u=(0,c.useRef)(null),d=(0,c.useRef)(null),h=(0,c.useRef)(null),f=(0,c.useRef)(null),m=(0,c.useRef)("1fr"),g=(0,c.useRef)(void 0),v=(0,c.useRef)(void 0),b=zc[e].dim,y=zc[e].axis,w=zc[e].min,S=zc[e].max;!function(e,t,n=0,r){const a=(0,R.throttle)(t,n);(0,c.useLayoutEffect)(()=>{if(!e)return;const t=new ResizeObserver(a);return t.observe(e,{box:"device-pixel-content-box"}),()=>t.disconnect()},r)}(h.current,e=>{for(const t of e){if(!t.target.isSameNode(h.current))return;const e=u.current.getBoundingClientRect()[b],n=Wc(u.current);l.current.ariaValueNow=`${(0,R.clamp)((e-n[w])/(n[S]-n[w])*100,0,100)}`}},500,[S,w,e,b]);const x=(0,c.useRef)(null),E=(0,c.useCallback)(e=>{m.current=u.current.getBoundingClientRect()[b],f.current=h.current.getBoundingClientRect()[b],x.current=e[y],l.current.setPointerCapture(e.pointerId),g.current=Wc(u.current),v.current=void 0},[b,y]),_=(0,c.useCallback)(e=>{if(null!==x.current&&"1fr"!==m.current){const n=e[y]-x.current,r=g.current,a=(0,R.clamp)(m.current+n,r[w],r[S]),i=a/(f.current-t);u.current.style.flexGrow=`${i}`,d.current.style.flexGrow=""+(1-i);const o=(0,R.clamp)((a-r[w])/(r[S]-r[w])*100,0,100);l.current.ariaValueNow=`${o}`}},[t,y,w,S]),C=(0,c.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),l.current.releasePointerCapture(e.pointerId),x.current=null,null==i||i(parseFloat(u.current.style.flexGrow))},[i]),O=(0,c.useRef)(new Set),k=(0,c.useRef)(null),D=(0,c.useCallback)(n=>{var r;if(0===O.current.size)return void(k.current=null);if("1fr"===m.current)return;const a=.3*(n-(null!=(r=k.current)?r:n));let i=0;"row"===e?(O.current.has("ArrowLeft")&&(i-=a),O.current.has("ArrowRight")&&(i+=a)):(O.current.has("ArrowUp")&&(i-=a),O.current.has("ArrowDown")&&(i+=a));const o=g.current,s=u.current.getBoundingClientRect()[b],c=(0,R.clamp)(s+i,o[w],o[S]),p=c/(f.current-t);u.current.style.flexGrow=`${p}`,d.current.style.flexGrow=""+(1-p);const h=(c-o[w])/(o[S]-o[w])*100;l.current.ariaValueNow=`${(0,R.clamp)(h,0,100)}`,k.current=n,window.requestAnimationFrame(D)},[e,t,w,S,b]),A=(0,c.useCallback)(n=>{if("Enter"===n.key)return void(void 0===v.current?(v.current=u.current.style.flexGrow,u.current.style.flexGrow="0",d.current.style.flexGrow="1"):(u.current.style.flexGrow=v.current,d.current.style.flexGrow=""+(1-parseFloat(v.current)),v.current=void 0));if("Home"===n.key){g.current=Wc(u.current),f.current=h.current.getBoundingClientRect()[b];const e=g.current[w]/(f.current-t);return u.current.style.flexGrow=`${e}`,d.current.style.flexGrow=""+(1-e),void(l.current.ariaValueNow="0")}if("End"===n.key){g.current=Wc(u.current),f.current=h.current.getBoundingClientRect()[b];const e=g.current[S]/(f.current-t);return u.current.style.flexGrow=`${e}`,d.current.style.flexGrow=""+(1-e),void(l.current.ariaValueNow="100")}if(!("column"===e&&jc.has(n.key)||"row"===e&&Fc.has(n.key))||O.current.has(n.key))return;v.current=void 0,n.preventDefault(),n.stopPropagation(),m.current=u.current.getBoundingClientRect()[b],f.current=h.current.getBoundingClientRect()[b],g.current=Wc(u.current);if(!O.current.has(n.key)){const e=0===O.current.size;O.current.add(n.key),e&&window.requestAnimationFrame(D)}},[e,D,t,S,b,w]),T=(0,c.useCallback)(t=>{"row"===e&&!Fc.has(t.key)||"column"===e&&!jc.has(t.key)||(O.current.delete(t.key),null==i||i(parseFloat(u.current.style.flexGrow)))},[e,i]),I=(0,c.useCallback)(()=>{u.current.style.flexGrow="0.5",d.current.style.flexGrow="0.5";const e=Wc(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,c.useCallback)(()=>{O.current.size>0&&(O.current.clear(),x.current=null,null==i||i(parseFloat(u.current.style.flexGrow)))},[i]),L=(0,Ye.useStyles2)(Uc),M=Ys(),N=2===s.length?"visible":"hidden";return p().createElement("div",{ref:h,className:L.container,style:{flexDirection:e}},p().createElement("div",{ref:u,className:L.panel,style:{flexGrow:"auto"===n?.5:(0,R.clamp)(n,0,1),[w]:"min-content",...r},id:`start-panel-${M}`},s[0]),s[1]&&p().createElement(p().Fragment,null,p().createElement("div",{ref:l,style:{[b]:`${t}px`},className:(0,ot.cx)(L.handle,{[L.handleHorizontal]:"column"===e}),onPointerUp:C,onPointerDown:E,onPointerMove:_,onKeyDown:A,onKeyUp:T,onDoubleClick:I,onBlur:P,role:"separator","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":50,"aria-controls":`start-panel-${M}`,"aria-label":(0,le.t)("grafana-scenes.components.splitter.aria-label-pane-resize-widget","Pane resize widget"),tabIndex:0}),p().createElement("div",{ref:d,className:L.panel,style:{flexGrow:"auto"===n?.5:(0,R.clamp)(1-n,0,1),[w]:"min-content",visibility:`${N}`,...a},id:`end-panel-${M}`},s[1])))}function Uc(e){return{handle:(0,ot.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,ot.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,ot.css)({display:"flex",width:"100%",flexGrow:1,overflow:"hidden"}),panel:(0,ot.css)({display:"flex",position:"relative",flexBasis:0})}}function Wc(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 extends E{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}).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 p().createElement(Bc,{direction:r,initialSize:null!=c?c:.5,primaryPaneStyles:o,secondaryPaneStyles:s},p().createElement(l,{key:t.state.key,model:t,parentState:e.state}),u&&n&&p().createElement(u,{key:n.state.key,model:n,parentState:e.state}))};class Hc extends E{constructor(){super(...arguments),this._renderBeforeActivation=!0}enrichDataRequest(){return{app:this.state.name||"app"}}}Hc.Component=({model:e})=>{const{pages:t}=e.useState();return p().createElement(p().Fragment,null,p().createElement(qc.Provider,{value:e},p().createElement(a.Routes,null,t.map(e=>p().createElement(a.Route,{key:e.state.url,path:e.state.routePath,element:p().createElement(e.Component,{model:e})})))))};const qc=(0,c.createContext)(null),Gc=new Map;function Qc(e){const t=Gc.get(e);if(t)return t;const n=e();return Gc.set(e,n),n}class Kc extends E{}function Yc({node:e}){const t=e.useState(),n=(0,Ye.useStyles2)(Xc);return p().createElement("div",{className:n.container},Object.keys(t).map(r=>p().createElement("div",{className:n.row,key:r},p().createElement("div",{className:n.keyName},r),p().createElement("div",{className:n.value},function(e,t,n){if(null===t)return"null";switch(typeof t){case"number":return p().createElement(Ye.Input,{type:"number",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.valueAsNumber})});case"string":return p().createElement(Ye.Input,{type:"text",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.value})});case"object":return $e(t)?t.constructor.name:(0,R.isPlainObject)(t)||(0,R.isArray)(t)?p().createElement(Ye.JSONFormatter,{json:t,open:0}):String(t);default:return typeof t}}(r,t[r],e)))))}function Xc(e){return{container:(0,ot.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),row:(0,ot.css)({display:"flex",gap:e.spacing(2)}),keyName:(0,ot.css)({display:"flex",flexGrow:"0",width:120,alignItems:"center",height:e.spacing(e.components.height.md)}),value:(0,ot.css)({flexGrow:1,minHeight:e.spacing(e.components.height.md),display:"flex",alignItems:"center"})}}function Zc({node:e,selectedObject:t,onSelect:n}){const r=(0,Ye.useStyles2)(Jc),a=[],i=e===t;return e.forEachChild(e=>{a.push(p().createElement(Zc,{node:e,key:e.state.key,selectedObject:t,onSelect:n}))}),p().createElement("div",{className:r.container},p().createElement("div",{className:(0,ot.cx)(r.name,i&&r.selected),onClick:()=>n(e)},e.constructor.name),p().createElement("div",{className:r.children},a))}function Jc(e){return{container:(0,ot.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),name:(0,ot.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,ot.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,ot.css)({flexGrow:1,display:"flex",flexDirection:"column",paddingLeft:e.spacing(1)})}}function ed({scene:e}){const t=(0,Ye.useStyles2)(td),[n,r]=(0,c.useState)(!1),[a,i]=(0,c.useState)();return p().createElement(p().Fragment,null,p().createElement(Ye.ToolbarButton,{variant:"canvas",icon:"bug",onClick:()=>r(!0)}),n&&p().createElement(Ye.Drawer,{title:(0,le.t)("grafana-scenes.components.scene-debugger.title-scene-debugger","Scene debugger"),onClose:()=>r(!1),size:"lg"},p().createElement("div",{className:t.panes},p().createElement("div",{className:t.pane1},p().createElement("div",{className:t.paneHeading},p().createElement(le.x6,{i18nKey:"grafana-scenes.components.scene-debugger.scene-graph"},"Scene graph")),p().createElement(Ye.CustomScrollbar,{autoHeightMin:"100%"},p().createElement("div",{className:t.treeWrapper},p().createElement(Zc,{node:e,selectedObject:a,onSelect:i})))),p().createElement("div",{className:t.pane2},p().createElement("div",{className:t.paneHeading},p().createElement(le.x6,{i18nKey:"grafana-scenes.components.scene-debugger.object-details"},"Object details")),a&&p().createElement(Yc,{node:a})))))}function td(e){return{panes:(0,ot.css)({flexGrow:1,display:"flex",height:"100%",flexDirection:"row",marginTop:e.spacing(-2)}),pane1:(0,ot.css)({flexGrow:0,display:"flex",height:"100%",flexDirection:"column",borderRight:`1px solid ${e.colors.border.weak}`}),pane2:(0,ot.css)({flexGrow:1,display:"flex",minHeight:"100%",flexDirection:"column",paddingLeft:e.spacing(2)}),treeWrapper:(0,ot.css)({paddingRight:e.spacing(2),height:"100%",marginLeft:e.spacing(-1)}),paneHeading:(0,ot.css)({padding:e.spacing(1,0),fontWeight:e.typography.fontWeightMedium})}}function nd({page:e}){const t=l(e.state.url),n=function(e){if(e.parent instanceof id)return e.parent;return e}(e),r=n.useState(),i=function(){const e=(0,a.useLocation)();return(0,o.locationSearchToObject)(e.search||"")}(),u=e.getScene(t),d=(0,c.useContext)(qc),h=r.initializedScene===u,{layout:f}=e.state,m=ke();(0,c.useLayoutEffect)(()=>{h||n.initializeScene(u)},[u,n,h]),(0,c.useEffect)(()=>()=>n.setState({initializedScene:void 0}),[n]);const g=Gu(n,null==d?void 0:d.state.urlSyncOptions);if(!h&&!g)return null;const v={text:r.title,img:r.titleImg,icon:r.titleIcon,url:s(r.url,m.getSearchObject(),r.preserveUrlKeys),hideFromBreadcrumbs:r.hideFromBreadcrumbs,parentItem:rd(r.getParentPage?r.getParentPage():n.parent,i,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:s(t.state.url,m.getSearchObject(),t.state.preserveUrlKeys),parentItem:v})));let b=[];return r.controls&&(b=r.controls.map(e=>p().createElement(e.Component,{model:e,key:e.state.key}))),i["scene-debugger"]&&b.push(p().createElement(ed,{scene:n,key:"scene-debugger"})),p().createElement(o.PluginPage,{layout:f,pageNav:v,actions:b,renderTitle:r.renderTitle,subTitle:r.subTitle},p().createElement(u.Component,{model:u}))}function rd(e,t,n){if(e instanceof id)return{text:e.state.title,url:s(e.state.url,n,e.state.preserveUrlKeys),hideFromBreadcrumbs:e.state.hideFromBreadcrumbs,parentItem:rd(e.state.getParentPage?e.state.getParentPage():e.parent,t,n)}}function ad({drilldown:e,parent:t}){const n=l(e.routePath),r=t.getDrilldownPage(e,n);return p().createElement(r.Component,{model:r})}Kc.Component=({model:e})=>{const{component:t,props:n,reactNode:r}=e.useState();return t?p().createElement(t,{...n}):r||null};class id extends E{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 je(t)?t.enrichDataRequest(e):null}}id.Component=function({model:e}){const{tabs:t,drilldowns:n}=e.useState(),r=[];if(r.push(function(e){var t,n,r;return p().createElement(a.Route,{key:"fallback route",path:"*",element:p().createElement(nd,{page:null!=(r=null==(n=(t=e.state).getFallbackPage)?void 0:n.call(t))?r:new id({url:"",title:(0,le.t)("grafana-scenes.components.fallback-page.title","Not found"),subTitle:(0,le.t)("grafana-scenes.components.fallback-page.subTitle","The url did not match any page"),routePath:"*",getScene:()=>new Ku({body:new Lc({direction:"column",children:[new Mc({body:new Kc({component:()=>p().createElement("div",{"data-testid":"default-fallback-content"},p().createElement(le.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 i=t[n];if(0===n&&r.push(p().createElement(a.Route,{key:e.state.routePath,path:"",element:p().createElement(i.Component,{model:i})})),r.push(p().createElement(a.Route,{key:i.state.url,path:i.state.routePath,element:p().createElement(i.Component,{model:i})})),i.state.drilldowns)for(const e of i.state.drilldowns)r.push(p().createElement(a.Route,{key:e.routePath,path:e.routePath,element:p().createElement(ad,{drilldown:e,parent:i})}))}if(n)for(const t of n)r.push(p().createElement(a.Route,{key:t.routePath,path:t.routePath,Component:()=>p().createElement(ad,{drilldown:t,parent:e})}));t||r.push(p().createElement(a.Route,{key:"home route",path:"/",element:p().createElement(nd,{page:e})}));return p().createElement(a.Routes,null,r)};var od=(e=>(e.Always="always",e.Auto="auto",e.Never="never",e))(od||{}),sd=(e=>(e.Hue="hue",e.None="none",e.Opacity="opacity",e.Scheme="scheme",e))(sd||{}),ld=(e=>(e.None="none",e.Normal="normal",e.Percent="percent",e))(ld||{});var ud=(e=>(e.Auto="auto",e.Horizontal="horizontal",e.Vertical="vertical",e))(ud||{});var cd=(e=>(e.Background="background",e.BackgroundSolid="background_solid",e.None="none",e.Value="value",e))(cd||{}),dd=(e=>(e.Area="area",e.Line="line",e.None="none",e))(dd||{}),pd=(e=>(e.Auto="auto",e.Center="center",e))(pd||{}),hd=(e=>(e.Auto="auto",e.Name="name",e.None="none",e.Value="value",e.ValueAndName="value_and_name",e))(hd||{}),fd=(e=>(e.Inverted="inverted",e.SameAsValue="same_as_value",e.Standard="standard",e))(fd||{}),md=(e=>(e.Multi="multi",e.None="none",e.Single="single",e))(md||{});var gd=(e=>(e.Basic="basic",e.Gradient="gradient",e.Lcd="lcd",e))(gd||{}),vd=(e=>(e.Color="color",e.Hidden="hidden",e.Text="text",e))(vd||{}),bd=(e=>(e.Auto="auto",e.Hidden="hidden",e.Left="left",e.Top="top",e))(bd||{}),yd=(e=>(e.Auto="auto",e.Manual="manual",e))(yd||{}),wd=(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))(wd||{}),Sd=(e=>(e.Auto="auto",e.Lg="lg",e.Md="md",e.Sm="sm",e))(Sd||{});wd.Auto;const xd={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:ud.Auto,showValue:od.Auto,stacking:ld.None,xTickLabelRotation:0,xTickLabelSpacing:0},Ed={fillOpacity:80,gradientMode:sd.None,lineWidth:1},_d={displayMode:gd.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:bd.Auto,showUnfilled:!0,sizing:yd.Auto,valueMode:vd.Color},Cd={selectedSeries:0},Rd={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:yd.Auto},Od={layers:[]};const kd={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:od.Auto,tooltip:{mode:md.Single,yHistogram:!1,showColorScale:!1}},Dd={bucketCount:30,bucketOffset:0},Ad={fillOpacity:80,gradientMode:sd.None,lineWidth:1},Td={showImage:!0};const Id={displayLabels:[]},Pd={colorMode:cd.Value,graphMode:dd.Area,justifyMode:pd.Auto,percentChangeColorMode:fd.Standard,showPercentChange:!1,textMode:hd.Auto,wideLayout:!0},Ld={alignValue:"left",mergeValues:!0,perPage:20,rowHeight:.9,showValue:od.Auto},Md={fillOpacity:70,lineWidth:0},Nd={colWidth:.9,perPage:20,rowHeight:.9,showValue:od.Auto},Vd={fillOpacity:70,lineWidth:1},$d={cellHeight:Sd.Sm,frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]};const jd={content:"# Title\n\nFor markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)",mode:"markdown"};const Fd={fillOpacity:50,show:"points"},zd={series:[]};class Bd{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 Ud extends Bd{match(e){return this._overrides.push({matcher:e,properties:[]}),this}matchFieldsWithName(e){return this._overrides.push({matcher:{id:i.FieldMatcherID.byName,options:e},properties:[]}),this}matchFieldsWithNameByRegex(e){return this._overrides.push({matcher:{id:i.FieldMatcherID.byRegexp,options:e},properties:[]}),this}matchFieldsByType(e){return this._overrides.push({matcher:{id:i.FieldMatcherID.byType,options:e},properties:[]}),this}matchFieldsByQuery(e){return this._overrides.push({matcher:{id:i.FieldMatcherID.byFrameRefID,options:e},properties:[]}),this}matchFieldsByValue(e){return this._overrides.push({matcher:{id:i.FieldMatcherID.byValue,options:e},properties:[]}),this}matchComparisonQuery(e){return this.matchFieldsByQuery(Cc(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 Wd{constructor(e){this.defaultFieldConfig=e,this._fieldConfig={defaults:{},overrides:[]},this._overridesBuilder=new Ud,this.setDefaults()}setDefaults(){const e={defaults:{custom:this.defaultFieldConfig?(0,R.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,R.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 Hd{constructor(e){this.defaultOptions=e,this._options={},this.setDefaults()}setDefaults(){this._options=this.defaultOptions?(0,R.cloneDeep)(this.defaultOptions()):{}}setOption(e,t){return this._options=(0,R.merge)(this._options,{[e]:t}),this}build(){return this._options}}class qd{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 Wd(r),this._panelOptionsBuilder=new Hd(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 vl({...this._state,options:this._panelOptionsBuilder.build(),fieldConfig:this._fieldConfigBuilder.build()})}}const Gd={barchart:()=>new qd("barchart","10.0.0",()=>xd,()=>Ed),bargauge:()=>new qd("bargauge","10.0.0",()=>_d),datagrid:()=>new qd("datagrid","10.0.0",()=>Cd),flamegraph:()=>new qd("flamegraph","10.0.0"),gauge:()=>new qd("gauge","10.0.0",()=>Rd),geomap:()=>new qd("geomap","10.0.0",()=>Od),heatmap:()=>new qd("heatmap","10.0.0",()=>kd),histogram:()=>new qd("histogram","10.0.0",()=>Dd,()=>Ad),logs:()=>new qd("logs","10.0.0"),news:()=>new qd("news","10.0.0",()=>Td),nodegraph:()=>new qd("nodeGraph","10.0.0"),piechart:()=>new qd("piechart","10.0.0",()=>Id),stat:()=>new qd("stat","10.0.0",()=>Pd),statetimeline:()=>new qd("state-timeline","10.0.0",()=>Ld,()=>Md),statushistory:()=>new qd("status-history","10.0.0",()=>Nd,()=>Vd),table:()=>new qd("table","10.0.0",()=>$d),text:()=>new qd("text","10.0.0",()=>jd),timeseries:()=>new qd("timeseries","10.0.0"),trend:()=>new qd("trend","10.0.0"),traces:()=>new qd("traces","10.0.0"),xychart:()=>new qd("xychart","10.0.0",()=>zd,()=>Fd)};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,6660));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),{});const Qd={barchart:()=>new Wd(()=>Ed),bargauge:()=>new Wd,datagrid:()=>new Wd,flamegraph:()=>new Wd,gauge:()=>new Wd,geomap:()=>new Wd,heatmap:()=>new Wd,histogram:()=>new Wd(()=>Ad),logs:()=>new Wd,news:()=>new Wd,nodegraph:()=>new Wd,piechart:()=>new Wd,stat:()=>new Wd,statetimeline:()=>new Wd(()=>Md),statushistory:()=>new Wd(()=>Vd),table:()=>new Wd,text:()=>new Wd,timeseries:()=>new Wd,trend:()=>new Wd,traces:()=>new Wd,xychart:()=>new Wd(()=>Fd)},Kd={getUrlWithAppState:s,registerRuntimePanelPlugin:function({pluginId:e,plugin:t}){if(u.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:""}},u.set(e,t)},registerRuntimeDataSource:function({dataSource:e}){if(D.has(e.uid))throw new Error(`A runtime data source with uid ${e.uid} has already been registered`);D.set(e.uid,e)},registerVariableMacro:function(e,t,n=!1){if(!n&&Ne.get(e))throw new Error(`Macro already registered ${e}`);return Ne.set(e,t),()=>{if(n)throw new Error("Replaced macros can not be unregistered. They need to be restored manually.");Ne.delete(e)}},cloneSceneObjectState:O,syncStateFromSearchParams:function(e,t,n){Ls(e,t,new Ts(n))},getUrlState:Ps,renderPrometheusLabelFilters:Bo,escapeLabelValueInRegexSelector:Wo,escapeLabelValueInExactSelector:Uo,escapeURLDelimiters:function(e){return Qo(Go(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:De,buildPathIdFor:$s}},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},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\]$/,E=/^(?:0|[1-9]\d*)$/,_={};_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_[i]=_[o]=_[w]=_[s]=_[S]=_[l]=_[u]=_[c]=_[d]=_[p]=_[h]=_[m]=_[g]=_[v]=_[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")(),k=t&&!t.nodeType&&t,D=k&&e&&!e.nodeType&&e,A=D&&D.exports===k,T=A&&C.process,I=function(){try{return T&&T.binding&&T.binding("util")}catch(e){}}(),P=I&&I.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 N(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var V,$,j,F=Array.prototype,z=Function.prototype,B=Object.prototype,U=O["__core-js_shared__"],W=z.toString,H=B.hasOwnProperty,q=(V=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",G=B.toString,Q=RegExp("^"+W.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),K=A?O.Buffer:void 0,Y=O.Symbol,X=O.Uint8Array,Z=B.propertyIsEnumerable,J=F.splice,ee=Y?Y.toStringTag:void 0,te=Object.getOwnPropertySymbols,ne=K?K.isBuffer:void 0,re=($=Object.keys,j=Object,function(e){return $(j(e))}),ae=Ie(O,"DataView"),ie=Ie(O,"Map"),oe=Ie(O,"Promise"),se=Ie(O,"Set"),le=Ie(O,"WeakMap"),ue=Ie(Object,"create"),ce=Ne(ae),de=Ne(ie),pe=Ne(oe),he=Ne(se),fe=Ne(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=je(e),r=!n&&$e(e),a=!n&&!r&&Fe(e),i=!n&&!r&&!a&&He(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&&!H.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 Ee(e,t){for(var n=e.length;n--;)if(Ve(e[n][0],t))return n;return-1}function _e(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ee&&ee in Object(e)?function(e){var t=H.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 We(e)&&_e(e)==i}function Re(e,t,n,r,a){return e===t||(null==e||null==t||!We(e)&&!We(t)?e!=e&&t!=t:function(e,t,n,r,a,c){var f=je(e),y=je(t),x=f?o:Le(e),E=y?o:Le(t),_=(x=x==i?h:x)==h,C=(E=E==i?h:E)==h,R=x==E;if(R&&Fe(e)){if(!Fe(t))return!1;f=!0,_=!1}if(R&&!_)return c||(c=new Se),f||He(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 Ve(+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=N),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=_&&H.call(e,"__wrapped__"),k=C&&H.call(t,"__wrapped__");if(O||k){var D=O?e.value():e,A=k?t.value():t;return c||(c=new Se),a(D,A,n,r,c)}}if(!R)return!1;return c||(c=new Se),function(e,t,n,r,a,i){var o=1&n,s=Ae(e),l=s.length,u=Ae(t),c=u.length;if(l!=c&&!o)return!1;var d=l;for(;d--;){var p=s[d];if(!(o?p in t:H.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!(!Ue(e)||function(e){return!!q&&q in e}(e))&&(ze(e)?Q:x).test(Ne(e))}function ke(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||B,t!==r)return re(e);var t,n,r,a=[];for(var i in Object(e))H.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 Ae(e){return function(e,t,n){var r=t(e);return je(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,Pe)}function Te(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 Ie(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 H.call(t,e)?t[e]:void 0},ve.prototype.has=function(e){var t=this.__data__;return ue?void 0!==t[e]:H.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=Ee(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=Ee(t,e);return n<0?void 0:t[n][1]},be.prototype.has=function(e){return Ee(this.__data__,e)>-1},be.prototype.set=function(e,t){var n=this.__data__,r=Ee(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=Te(this,e).delete(e);return this.size-=t?1:0,t},ye.prototype.get=function(e){return Te(this,e).get(e)},ye.prototype.has=function(e){return Te(this,e).has(e)},ye.prototype.set=function(e,t){var n=Te(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 Pe=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=_e;function Me(e,t){return!!(t=null==t?a:t)&&("number"==typeof e||E.test(e))&&e>-1&&e%1==0&&e<t}function Ne(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ve(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=_e(e),n=t==h?e.constructor:void 0,r=n?Ne(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 $e=Ce(function(){return arguments}())?Ce:function(e){return We(e)&&H.call(e,"callee")&&!Z.call(e,"callee")},je=Array.isArray;var Fe=ne||function(){return!1};function ze(e){if(!Ue(e))return!1;var t=_e(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function Ue(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function We(e){return null!=e&&"object"==typeof e}var He=P?function(e){return function(t){return e(t)}}(P):function(e){return We(e)&&Be(e.length)&&!!_[_e(e)]};function qe(e){return null!=(t=e)&&Be(t.length)&&!ze(t)?xe(e):ke(e);var t}e.exports=function(e,t){return Re(e,t)}},5162:(e,t,n)=>{var r=n(1433).Symbol;e.exports=r},7148:(e,t,n)=>{var r=n(5162),a=n(7903),i=n(1738),o=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?a(e):i(e)}},8812:(e,t,n)=>{var r=n(2140),a=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(a,""):e}},2999:(e,t,n)=>{var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;e.exports=r},7903:(e,t,n)=>{var r=n(5162),a=Object.prototype,i=a.hasOwnProperty,o=a.toString,s=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var a=o.call(e);return r&&(t?e[s]=n:delete e[s]),a}},1738:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},1433:(e,t,n)=>{var r=n(2999),a="object"==typeof self&&self&&self.Object===Object&&self,i=r||a||Function("return this")();e.exports=i},2140:e=>{var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},6177:(e,t,n)=>{var r=n(8953),a=n(3664),i=n(5378),o=Math.max,s=Math.min;e.exports=function(e,t,n){var l,u,c,d,p,h,f=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var n=l,r=u;return l=u=void 0,f=t,d=e.apply(r,n)}function y(e){var n=e-h;return void 0===h||n>=t||n<0||g&&e-f>=c}function w(){var e=a();if(y(e))return S(e);p=setTimeout(w,function(e){var n=t-(e-h);return g?s(n,c-(e-f)):n}(e))}function S(e){return p=void 0,v&&l?b(e):(l=u=void 0,d)}function x(){var e=a(),n=y(e);if(l=arguments,u=this,h=e,n){if(void 0===p)return function(e){return f=e,p=setTimeout(w,t),m?b(e):d}(h);if(g)return clearTimeout(p),p=setTimeout(w,t),b(h)}return void 0===p&&(p=setTimeout(w,t)),d}return t=i(t)||0,r(n)&&(m=!!n.leading,c=(g="maxWait"in n)?o(i(n.maxWait)||0,t):c,v="trailing"in n?!!n.trailing:v),x.cancel=function(){void 0!==p&&clearTimeout(p),f=0,l=h=u=p=void 0},x.flush=function(){return void 0===p?d:S(a())},x}},8953:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},2934:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},5414:(e,t,n)=>{var r=n(7148),a=n(2934);e.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==r(e)}},3664:(e,t,n)=>{var r=n(1433);e.exports=function(){return r.Date.now()}},5378:(e,t,n)=>{var r=n(8812),a=n(8953),i=n(5414),o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,l=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=s.test(e);return n||l.test(e)?u(e.slice(2),n?2:8):o.test(e)?NaN:+e}},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}},2688:(e,t,n)=>{e.exports=n(362)()},6441:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},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})},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})},8230:(e,t,n)=>{"use strict";const{default:r,DraggableCore:a}=n(9111);e.exports=r,e.exports.default=r,e.exports.DraggableCore=a},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"),"")}},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()},7988:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){0}},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}},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)}},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 E=(0,u.calcGridColWidth)(g),_=m-(0,u.calcGridItemWHPx)(h,E,w[0]);l=(0,u.clamp)(l,0,_)}}var C={top:s,left:l};e.setState({dragging:C});var R=(0,u.calcXY)(g,s,l,h,f),O=R.x,k=R.y;return o.call(b(e),p,O,k,{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})},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,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(e);if(t){var i=E(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(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function _(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 _(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:[]}),_(x(e),"dragEnterCounter",0),_(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)}),_(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})}}),_(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)}}}),_(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))}),_(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})}}),_(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)}),_(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,E={left:S/g,top:x/g,e:t};if(e.state.droppingDOMNode){if(e.state.droppingPosition){var _=e.state.droppingPosition,O=_.left,k=_.top;(O!=S||k!=x)&&e.setState({droppingPosition:E})}}else{var D={cols:u,margin:s,maxRows:d,rowHeight:c,containerWidth:p,containerPadding:f||s},A=(0,l.calcXY)(D,x,S,b.w,b.h);e.setState({droppingDOMNode:a.createElement("div",{key:b.i}),droppingPosition:E,layout:[].concat(h(y),[m(m({},b),{},{x:A.x,y:A.y,static:!1,isDraggable:!0})])})}}),_(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})}),_(x(e),"onDragLeave",function(t){t.preventDefault(),t.stopPropagation(),e.dragEnterCounter--,0===e.dragEnterCounter&&e.removeDroppingPlaceholder()}),_(x(e),"onDragEnter",function(t){t.preventDefault(),t.stopPropagation(),e.dragEnterCounter++}),_(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,E=x.mounted,_=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,k=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:k,useCSSTransforms:g&&E,usePercentages:!E,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?_: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,_(O,"displayName","ReactGridLayout"),_(O,"propTypes",c.default),_(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})},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},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 E=function(e){return Object.prototype.toString.call(e)};function _(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=_(this.props.margin,o),f=_(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:_(t,this.state.breakpoint),containerPadding:_(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(e[t]))throw new Error("Layout property must be an object. Received: "+E(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})},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},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"},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)}},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]})}},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=_,t.getFirstCollision=E,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=k,t.sortLayoutItemsByColRow=A,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||T([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=T,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=k(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(e,t);)t.y--;else if(o)for(;t.x>0&&!E(e,t);)t.x--;for(;i=E(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(;E(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(e,t){for(var n=0,r=e.length;n<r;n++)if(g(e[n],t))return e[n]}function _(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;I("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=k(e,o);("vertical"===o&&"number"==typeof r?c>=r:"horizontal"===o&&"number"==typeof n&&u>=n)&&(d=d.reverse());var h=_(d,t),f=h.length>0;if(f&&l)return p(e);if(f&&i)return I("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];I("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(e,u))return I("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 k(e,t){return"horizontal"===t?A(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 A(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 T(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 I(){var e;c&&(e=console).log.apply(e,arguments)}t.noop=function(){}},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},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},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}},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})},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},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}},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},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)},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,A(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(T(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,t),l("caret",e),e=x(e,t),l("tildes",e),e=R(e,t),l("xrange",e),e=k(e,t),l("stars",e),e),S=e=>!e||"x"===e.toLowerCase()||"*"===e,x=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(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,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})},k=(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],"")),A=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(),T=(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}},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},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}},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}`)}}},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)}},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)}},7023:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t)=>r(e,t,!0)},5380:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},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"}},6909:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>0===r(e,t,n)},144:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)>0},2077:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)>=0},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}}},599:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)<0},7092:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(e,t,n)<=0},2966:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t)=>new r(e,t).major},5986:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t)=>new r(e,t).minor},7659:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>0!==r(e,t,n)},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}}},1617:(e,t,n)=>{"use strict";const r=n(7944);e.exports=(e,t)=>new r(e,t).patch},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}},2862:(e,t,n)=>{"use strict";const r=n(5380);e.exports=(e,t,n)=>r(t,e,n)},6033:(e,t,n)=>{"use strict";const r=n(2801);e.exports=(e,t)=>e.sort((e,n)=>r(n,e,t))},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)}},603:(e,t,n)=>{"use strict";const r=n(2801);e.exports=(e,t)=>e.sort((e,n)=>r(e,n,t))},7645:(e,t,n)=>{"use strict";const r=n(5860);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},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),E=n(599),_=n(6909),C=n(7659),R=n(2077),O=n(7092),k=n(3811),D=n(5334),A=n(9524),T=n(8395),I=n(1722),P=n(651),L=n(7840),M=n(7930),N=n(3489),V=n(7494),$=n(5463),j=n(7871),F=n(4266),z=n(1112),B=n(1465),U=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:E,eq:_,neq:C,gte:R,lte:O,cmp:k,coerce:D,Comparator:A,Range:T,satisfies:I,toComparators:P,maxSatisfying:L,minSatisfying:M,minVersion:N,validRange:V,outside:$,gtr:j,ltr:F,intersects:z,simplifyRange:B,subset:U,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}},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},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)}},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}}},7095:e=>{"use strict";const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},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*$")},7871:(e,t,n)=>{"use strict";const r=n(5463);e.exports=(e,t,n)=>r(e,t,">",n)},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))},4266:(e,t,n)=>{"use strict";const r=n(5463);e.exports=(e,t,n)=>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}},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}},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}},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}},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}},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}},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(" "))},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}}},5745:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});const r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};var a,i=new Uint8Array(16);function o(){if(!a&&!(a="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return a(i)}for(var s=[],l=0;l<256;++l)s.push((l+256).toString(16).slice(1));function u(e,t=0){return(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase()}const c=function(e,t,n){if(r.randomUUID&&!t&&!e)return r.randomUUID();var a=(e=e||{}).random||(e.rng||o)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=a[i];return t}return u(a)}},1625:(e,t,n)=>{"use strict";n.d(t,{$m:()=>i,fY:()=>o,ob:()=>a,qM:()=>s,uH:()=>r,vp:()=>l});var r=(e=>(e.Ascending="Ascending",e.Descending="Descending",e))(r||{});var a=(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))(a||{}),i=(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))(i||{}),o=(e=>(e.exact="exact",e.none="none",e.numbers="numbers",e.signature="signature",e))(o||{}),s=(e=>(e.Auto="auto",e.Lg="lg",e.Md="md",e.Sm="sm",e))(s||{});const l="browser"},6145:(e,t,n)=>{"use strict";n.d(t,{CO:()=>a,rw:()=>r,yV:()=>i});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[e.Crosshair=1]="Crosshair",e[e.Off=0]="Off",e[e.Tooltip=2]="Tooltip",e))(i||{})},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},7993:(e,t,n)=>{"use strict";n.d(t,{A:()=>h});const r=(e,t)=>e>t?1:e<t?-1:0,a=1/0,i=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o="eexxaacctt",s=/\p{P}/gu,l=["en",{numeric:!0,sensitivity:"base"}],u=(e,t,n)=>e.replace("A-Z",t).replace("a-z",n),c={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:a,intraChars:"[a-z\\d']",intraIns:null,intraContr:"'[a-z]{1,2}\\b",intraMode:0,intraSlice:[1,a],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,a=r)=>{let{idx:i,chars:o,terms:s,interLft2:l,interLft1:u,start:c,intraIns:d,interIns:p,cases:h}=e;return i.map((e,t)=>t).sort((e,n)=>o[n]-o[e]||d[e]-d[n]||s[n]+l[n]+.5*u[n]-(s[e]+l[e]+.5*u[e])||p[e]-p[n]||c[e]-c[n]||h[n]-h[e]||a(t[i[e]],t[i[n]]))}},d=(e,t)=>0==t?"":1==t?e+"??":t==a?e+"*?":e+`{0,${t}}?`,p="(?:\\b|_)";function h(e){e=Object.assign({},c,e);let{unicode:t,interLft:n,interRgt:a,intraMode:h,intraSlice:f,intraIns:g,intraSub:v,intraTrn:b,intraDel:y,intraContr:w,intraSplit:S,interSplit:x,intraBound:E,interBound:_,intraChars:C,toUpper:R,toLower:O,compare:k}=e;g??=h,v??=h,b??=h,y??=h,k??="undefined"==typeof Intl?r:new Intl.Collator(...l).compare;let D=e.letters??e.alpha;if(null!=D){let e=R(D),t=O(D);x=u(x,e,t),S=u(S,e,t),_=u(_,e,t),E=u(E,e,t),C=u(C,e,t),w=u(w,e,t)}let A=t?"u":"";const T='".+?"',I=new RegExp(T,"gi"+A),P=new RegExp(`(?:\\s+|^)-(?:${C}+|${T})`,"gi"+A);let{intraRules:L}=e;null==L&&(L=e=>{let t=c.intraSlice,n=0,r=0,a=0,i=0;if(/[^\d]/.test(e)){let o=e.length;o<=4?o>=3&&(a=Math.min(b,1),4==o&&(n=Math.min(g,1))):(t=f,n=g,r=v,a=b,i=y)}return{intraSlice:t,intraIns:n,intraSub:r,intraTrn:a,intraDel:i}});let M=!!S,N=new RegExp(S,"g"+A),V=new RegExp(x,"g"+A),$=new RegExp("^"+x+"|"+x+"$","g"+A),j=new RegExp(w,"gi"+A);const F=(e,t=!1)=>{let n=[];e=(e=e.replace(I,e=>(n.push(e),o))).replace($,""),t||(e=O(e)),M&&(e=e.replace(N,e=>e[0]+" "+e[1]));let r=0;return e.split(V).filter(e=>""!=e).map(e=>e===o?n[r++]:e)},z=/[^\d]+|\d+/g,B=(t,r=0,o=!1)=>{let s=F(t);if(0==s.length)return[];let l,u=Array(s.length).fill("");if(s=s.map((e,t)=>e.replace(j,e=>(u[t]=e,""))),1==h)l=s.map((e,t)=>{if('"'===e[0])return i(e.slice(1,-1));let n="";for(let r of e.matchAll(z)){let e=r[0],{intraSlice:a,intraIns:i,intraSub:o,intraTrn:s,intraDel:l}=L(e);if(i+o+s+l==0)n+=e+u[t];else{let[r,c]=a,p=e.slice(0,r),h=e.slice(c),f=e.slice(r,c);1==i&&1==p.length&&p!=f[0]&&(p+="(?!"+p+")");let m=f.length,g=[e];if(o)for(let e=0;e<m;e++)g.push(p+f.slice(0,e)+C+f.slice(e+1)+h);if(s)for(let e=0;e<m-1;e++)f[e]!=f[e+1]&&g.push(p+f.slice(0,e)+f[e+1]+f[e]+f.slice(e+2)+h);if(l)for(let e=0;e<m;e++)g.push(p+f.slice(0,e+1)+"?"+f.slice(e+1)+h);if(i){let e=d(C,1);for(let t=0;t<m;t++)g.push(p+f.slice(0,t)+e+f.slice(t)+h)}n+="(?:"+g.join("|")+")"+u[t]}}return n});else{let e=d(C,g);2==r&&g>0&&(e=")("+e+")("),l=s.map((t,n)=>'"'===t[0]?i(t.slice(1,-1)):t.split("").map((e,t,n)=>(1==g&&0==t&&n.length>1&&e!=n[t+1]&&(e+="(?!"+e+")"),e)).join(e)+u[n])}let c=2==n?p:"",f=2==a?p:"",m=f+d(e.interChars,e.interIns)+c;return r>0?o?l=c+"("+l.join(")"+f+"|"+c+"(")+")"+f:(l="("+l.join(")("+m+")(")+")",l="(.??"+c+")"+l+"("+f+".*)"):(l=l.join(m),l=c+l+f),[new RegExp(l,"i"+A),s,u]},U=(e,t,n)=>{let[r]=B(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 W=!!E,H=new RegExp(_,A),q=new RegExp(E,A);const G=(t,r,i)=>{let[o,s,l]=B(i,1),u=F(i,!0),[c]=B(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)},v=1==n||1==a,b=0;for(let i=0;i<t.length;i++){let s=r[t[i]],l=s.match(o),u=l.index+l[1].length,f=u,m=!1,y=0,w=0,S=0,x=0,E=0,_=0,C=0,R=0,k=0,D=[];for(let t=0,r=2;t<d;t++,r+=2){let i=O(l[r]),o=p[t],c=h[t],g=o.length,b=i.length,T=i==o;if(l[r]==c&&C++,!T&&l[r+1].length>=g){let e=O(l[r+1]).indexOf(o);e>-1&&(D.push(f,b,e,g),f+=Q(l,r,e,g),i=o,b=g,T=!0,0==t&&(u=f))}if(v||T){let e=f-1,c=f+b,d=!1,p=!1;if(-1==e||H.test(s[e]))T&&y++,d=!0;else{if(2==n){m=!0;break}if(W&&q.test(s[e]+s[e+1]))T&&w++,d=!0;else if(1==n){let e=l[r+1],n=f+b;if(e.length>=g){let a,c=0,p=!1,h=new RegExp(o,"ig"+A);for(;a=h.exec(e);){c=a.index;let e=n+c,t=e-1;if(-1==t||H.test(s[t])){y++,p=!0;break}if(q.test(s[t]+s[e])){w++,p=!0;break}}p&&(d=!0,D.push(f,b,c,g),f+=Q(l,r,c,g),i=o,b=g,T=!0,0==t&&(u=f))}if(!d){m=!0;break}}}if(c==s.length||H.test(s[c]))T&&S++,p=!0;else{if(2==a){m=!0;break}if(W&&q.test(s[c-1]+s[c]))T&&x++,p=!0;else if(1==a){m=!0;break}}T&&(E+=g,d&&p&&_++)}if(b>g&&(k+=b-g),t>0&&(R+=l[r-1].length),!e.intraFilt(o,i,f)){m=!0;break}t<d-1&&(f+=b+l[r+1].length)}if(!m){g.idx[b]=t[i],g.interLft2[b]=y,g.interLft1[b]=w,g.interRgt2[b]=S,g.interRgt1[b]=x,g.chars[b]=E,g.terms[b]=_,g.cases[b]=C,g.interIns[b]=R,g.intraIns[b]=k,g.start[b]=u;let e=s.match(c),n=e.index+e[1].length,r=D.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&&D[a]==n){let r=D[a+1],i=D[a+2],o=D[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+=Q(e,t,i,o),a+=4}else n+=r,t++}n=e.index+e[1].length;let l=g.ranges[b]=[],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),b++}}if(b<t.length)for(let e in g)g[e]=g[e].slice(0,b);return g},Q=(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)=>((t,n,r,a=1e3,o)=>{r=r?!0===r?5:r:0;let l=null,u=null,c=[];n=n.replace(P,e=>{let t=e.trim().slice(1);return t='"'===t[0]?i(t.slice(1,-1)):t.replace(s,""),""!=t&&c.push(t),""});let d,p=F(n);if(c.length>0){if(d=new RegExp(c.join("|"),"i"+A),0==p.length){let e=[];for(let n=0;n<t.length;n++)d.test(t[n])||e.push(n);return[e,null,null]}}else if(0==p.length)return[null,null,null];if(r>0){let e=F(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==o?.length)return[[],null,null];o=U(t,n[e],o)}if(e.length>r)return[o,null,null];l=m(e).map(e=>e.join(" ")),u=[];let a=new Set;for(let e=0;e<l.length;e++)if(a.size<o.length){let n=o.filter(e=>!a.has(e)),r=U(t,l[e],n);for(let e=0;e<r.length;e++)a.add(r[e]);u.push(r)}else u.push([])}}null==l&&(l=[n],u=[o?.length>0?o:U(t,n)]);let h=null,f=null;if(c.length>0&&(u=u.map(e=>e.filter(e=>!d.test(t[e])))),u.reduce((e,t)=>e+t.length,0)<=a){h={},f=[];for(let n=0;n<u.length;n++){let r=u[n];if(null==r||0==r.length)continue;let a=l[n],i=G(r,t,a),o=e.sort(i,t,a,k);if(n>0)for(let e=0;e<o.length;e++)o[e]+=f.length;for(let e in i)h[e]=(h[e]??[]).concat(i[e]);f=f.concat(o)}}return[[].concat(...u),h,f]})(...t),split:F,filter:U,info:G,sort:e.sort}}const f=(()=>{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 m(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 g=(e,t)=>t?`<mark>${e}</mark>`:e,v=(e,t)=>e+t;h.latinize=f,h.permute=e=>m([...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])),h.highlight=function(e,t,n=g,r="",a=v){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}},1792:(e,t,n)=>{"use strict";n.d(t,{A:()=>R});var r=n(5959),a=e=>"string"!=typeof e?{}:e.split(/ ?; ?/).reduce((e,t)=>{const[n,r]=t.split(/ ?: ?/).map((e,t)=>0===t?e.replace(/\s+/g,""):e.trim());if(n&&r){const t=n.replace(/(\w)-(\w)/g,(e,t,n)=>`${t}${n.toUpperCase()}`);let a=r.trim();Number.isNaN(Number(r))||(a=Number(r)),e[n.startsWith("-")?n:t]=a}return e},{});var i=["br","col","colgroup","dl","hr","iframe","img","input","link","menuitem","meta","ol","param","select","table","tbody","tfoot","thead","tr","ul","wbr"],o={"accept-charset":"acceptCharset",acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autocorrect:"autoCorrect",autofocus:"autoFocus",autoplay:"autoPlay",autosave:"autoSave",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classID",classname:"className",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",controlslist:"controlsList",crossorigin:"crossOrigin",dangerouslysetinnerhtml:"dangerouslySetInnerHTML",datetime:"dateTime",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",enctype:"encType",for:"htmlFor",formmethod:"formMethod",formaction:"formAction",formenctype:"formEncType",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",htmlfor:"htmlFor",httpequiv:"httpEquiv","http-equiv":"httpEquiv",icon:"icon",innerhtml:"innerHTML",inputmode:"inputMode",itemid:"itemID",itemprop:"itemProp",itemref:"itemRef",itemscope:"itemScope",itemtype:"itemType",keyparams:"keyParams",keytype:"keyType",marginwidth:"marginWidth",marginheight:"marginHeight",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",nomodule:"noModule",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",typemustmatch:"typeMustMatch",usemap:"useMap",accentheight:"accentHeight","accent-height":"accentHeight",alignmentbaseline:"alignmentBaseline","alignment-baseline":"alignmentBaseline",allowreorder:"allowReorder",arabicform:"arabicForm","arabic-form":"arabicForm",attributename:"attributeName",attributetype:"attributeType",autoreverse:"autoReverse",basefrequency:"baseFrequency",baselineshift:"baselineShift","baseline-shift":"baselineShift",baseprofile:"baseProfile",calcmode:"calcMode",capheight:"capHeight","cap-height":"capHeight",clippath:"clipPath","clip-path":"clipPath",clippathunits:"clipPathUnits",cliprule:"clipRule","clip-rule":"clipRule",colorinterpolation:"colorInterpolation","color-interpolation":"colorInterpolation",colorinterpolationfilters:"colorInterpolationFilters","color-interpolation-filters":"colorInterpolationFilters",colorprofile:"colorProfile","color-profile":"colorProfile",colorrendering:"colorRendering","color-rendering":"colorRendering",contentscripttype:"contentScriptType",contentstyletype:"contentStyleType",diffuseconstant:"diffuseConstant",dominantbaseline:"dominantBaseline","dominant-baseline":"dominantBaseline",edgemode:"edgeMode",enablebackground:"enableBackground","enable-background":"enableBackground",externalresourcesrequired:"externalResourcesRequired",fillopacity:"fillOpacity","fill-opacity":"fillOpacity",fillrule:"fillRule","fill-rule":"fillRule",filterres:"filterRes",filterunits:"filterUnits",floodopacity:"floodOpacity","flood-opacity":"floodOpacity",floodcolor:"floodColor","flood-color":"floodColor",fontfamily:"fontFamily","font-family":"fontFamily",fontsize:"fontSize","font-size":"fontSize",fontsizeadjust:"fontSizeAdjust","font-size-adjust":"fontSizeAdjust",fontstretch:"fontStretch","font-stretch":"fontStretch",fontstyle:"fontStyle","font-style":"fontStyle",fontvariant:"fontVariant","font-variant":"fontVariant",fontweight:"fontWeight","font-weight":"fontWeight",glyphname:"glyphName","glyph-name":"glyphName",glyphorientationhorizontal:"glyphOrientationHorizontal","glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphorientationvertical:"glyphOrientationVertical","glyph-orientation-vertical":"glyphOrientationVertical",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",horizadvx:"horizAdvX","horiz-adv-x":"horizAdvX",horizoriginx:"horizOriginX","horiz-origin-x":"horizOriginX",imagerendering:"imageRendering","image-rendering":"imageRendering",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",letterspacing:"letterSpacing","letter-spacing":"letterSpacing",lightingcolor:"lightingColor","lighting-color":"lightingColor",limitingconeangle:"limitingConeAngle",markerend:"markerEnd","marker-end":"markerEnd",markerheight:"markerHeight",markermid:"markerMid","marker-mid":"markerMid",markerstart:"markerStart","marker-start":"markerStart",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",overlineposition:"overlinePosition","overline-position":"overlinePosition",overlinethickness:"overlineThickness","overline-thickness":"overlineThickness",paintorder:"paintOrder","paint-order":"paintOrder","panose-1":"panose1",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointerevents:"pointerEvents","pointer-events":"pointerEvents",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",renderingintent:"renderingIntent","rendering-intent":"renderingIntent",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",shaperendering:"shapeRendering","shape-rendering":"shapeRendering",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",stopcolor:"stopColor","stop-color":"stopColor",stopopacity:"stopOpacity","stop-opacity":"stopOpacity",strikethroughposition:"strikethroughPosition","strikethrough-position":"strikethroughPosition",strikethroughthickness:"strikethroughThickness","strikethrough-thickness":"strikethroughThickness",strokedasharray:"strokeDasharray","stroke-dasharray":"strokeDasharray",strokedashoffset:"strokeDashoffset","stroke-dashoffset":"strokeDashoffset",strokelinecap:"strokeLinecap","stroke-linecap":"strokeLinecap",strokelinejoin:"strokeLinejoin","stroke-linejoin":"strokeLinejoin",strokemiterlimit:"strokeMiterlimit","stroke-miterlimit":"strokeMiterlimit",strokewidth:"strokeWidth","stroke-width":"strokeWidth",strokeopacity:"strokeOpacity","stroke-opacity":"strokeOpacity",suppresscontenteditablewarning:"suppressContentEditableWarning",suppresshydrationwarning:"suppressHydrationWarning",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textanchor:"textAnchor","text-anchor":"textAnchor",textdecoration:"textDecoration","text-decoration":"textDecoration",textlength:"textLength",textrendering:"textRendering","text-rendering":"textRendering",underlineposition:"underlinePosition","underline-position":"underlinePosition",underlinethickness:"underlineThickness","underline-thickness":"underlineThickness",unicodebidi:"unicodeBidi","unicode-bidi":"unicodeBidi",unicoderange:"unicodeRange","unicode-range":"unicodeRange",unitsperem:"unitsPerEm","units-per-em":"unitsPerEm",unselectable:"unselectable",valphabetic:"vAlphabetic","v-alphabetic":"vAlphabetic",vectoreffect:"vectorEffect","vector-effect":"vectorEffect",vertadvy:"vertAdvY","vert-adv-y":"vertAdvY",vertoriginx:"vertOriginX","vert-origin-x":"vertOriginX",vertoriginy:"vertOriginY","vert-origin-y":"vertOriginY",vhanging:"vHanging","v-hanging":"vHanging",videographic:"vIdeographic","v-ideographic":"vIdeographic",viewbox:"viewBox",viewtarget:"viewTarget",vmathematical:"vMathematical","v-mathematical":"vMathematical",wordspacing:"wordSpacing","word-spacing":"wordSpacing",writingmode:"writingMode","writing-mode":"writingMode",xchannelselector:"xChannelSelector",xheight:"xHeight","x-height":"xHeight",xlinkactuate:"xlinkActuate","xlink:actuate":"xlinkActuate",xlinkarcrole:"xlinkArcrole","xlink:arcrole":"xlinkArcrole",xlinkhref:"xlinkHref","xlink:href":"xlinkHref",xlinkrole:"xlinkRole","xlink:role":"xlinkRole",xlinkshow:"xlinkShow","xlink:show":"xlinkShow",xlinktitle:"xlinkTitle","xlink:title":"xlinkTitle",xlinktype:"xlinkType","xlink:type":"xlinkType",xmlbase:"xmlBase","xml:base":"xmlBase",xmllang:"xmlLang","xml:lang":"xmlLang","xml:space":"xmlSpace",xmlnsxlink:"xmlnsXlink","xmlns:xlink":"xmlnsXlink",xmlspace:"xmlSpace",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan",onblur:"onBlur",onchange:"onChange",onclick:"onClick",oncontextmenu:"onContextMenu",ondoubleclick:"onDoubleClick",ondrag:"onDrag",ondragend:"onDragEnd",ondragenter:"onDragEnter",ondragexit:"onDragExit",ondragleave:"onDragLeave",ondragover:"onDragOver",ondragstart:"onDragStart",ondrop:"onDrop",onerror:"onError",onfocus:"onFocus",oninput:"onInput",oninvalid:"onInvalid",onkeydown:"onKeyDown",onkeypress:"onKeyPress",onkeyup:"onKeyUp",onload:"onLoad",onmousedown:"onMouseDown",onmouseenter:"onMouseEnter",onmouseleave:"onMouseLeave",onmousemove:"onMouseMove",onmouseout:"onMouseOut",onmouseover:"onMouseOver",onmouseup:"onMouseUp",onscroll:"onScroll",onsubmit:"onSubmit",ontouchcancel:"onTouchCancel",ontouchend:"onTouchEnd",ontouchmove:"onTouchMove",ontouchstart:"onTouchStart",onwheel:"onWheel"};function s(e,t){const{key:n,level:s,...u}=t;switch(e.nodeType){case 1:return r.createElement(function(e){if(/[a-z]+[A-Z]+[a-z]+/.test(e))return e;return e.toLowerCase()}(e.nodeName),function(e,t){const n={key:t};if(e instanceof Element){const t=e.getAttribute("class");t&&(n.className=t),[...e.attributes].forEach(e=>{switch(e.name){case"class":break;case"style":n[e.name]=a(e.value);break;case"allowfullscreen":case"allowpaymentrequest":case"async":case"autofocus":case"autoplay":case"checked":case"controls":case"default":case"defer":case"disabled":case"formnovalidate":case"hidden":case"ismap":case"itemscope":case"loop":case"multiple":case"muted":case"nomodule":case"novalidate":case"open":case"readonly":case"required":case"reversed":case"selected":case"typemustmatch":n[o[e.name]||e.name]=!0;break;default:n[o[e.name]||e.name]=e.value}})}return n}(e,n),l(e.childNodes,s,u));case 3:{const t=e.nodeValue?.toString()??"";if(!u.allowWhiteSpaces&&/^\s+$/.test(t)&&!/[\u00A0\u202F]/.test(t))return null;if(!e.parentNode)return t;const n=e.parentNode.nodeName.toLowerCase();return i.includes(n)?(/\S/.test(t)&&console.warn(`A textNode is not allowed inside '${n}'. Your text "${t}" will be ignored`),null):t}case 8:default:return null;case 11:return l(e.childNodes,s,t)}}function l(e,t,n){const r=[...e].map((e,r)=>c(e,{...n,index:r,level:t+1})).filter(Boolean);return r.length?r:null}function u(e,t={}){return"string"==typeof e?function(e,t={}){if(!e||"string"!=typeof e)return null;const{includeAllNodes:n=!1,nodeOnly:r=!1,selector:a="body > *",type:i="text/html"}=t;try{const o=(new DOMParser).parseFromString(e,i);if(n){const{childNodes:e}=o.body;return r?e:[...e].map(e=>c(e,t))}const s=o.querySelector(a)||o.body.childNodes[0];if(!(s instanceof Node))throw new TypeError("Error parsing input");return r?s:c(s,t)}catch(e){0}return null}(e,t):e instanceof Node?c(e,t):null}function c(e,t={}){if(!(e&&e instanceof Node))return null;const{actions:n=[],index:r=0,level:a=0,randomKey:i}=t;let o=e,l=`${a}-${r}`;const u=[];return i&&0===a&&(l=`${function(e=6){const t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let n="";for(let r=e;r>0;--r)n+=t[Math.round(61*Math.random())];return n}()}-${l}`),Array.isArray(n)&&n.forEach(t=>{t.condition(o,l,a)&&("function"==typeof t.pre&&(o=t.pre(o,l,a),o instanceof Node||(o=e)),"function"==typeof t.post&&u.push(t.post(o,l,a)))}),u.length?u:s(o,{key:l,level:a,...t})}var d=Object.defineProperty,p=(e,t,n)=>((e,t,n)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),h="react-inlinesvg",f={IDLE:"idle",LOADING:"loading",LOADED:"loaded",FAILED:"failed",READY:"ready",UNSUPPORTED:"unsupported"};function m(e){return e[Math.floor(Math.random()*e.length)]}function g(){return!("undefined"==typeof window||!window.document?.createElement)}function v(){return function(){if(!document)return!1;const e=document.createElement("div");e.innerHTML="<svg />";const t=e.firstChild;return!!t&&"http://www.w3.org/2000/svg"===t.namespaceURI}()&&"undefined"!=typeof window&&null!==window}async function b(e,t){const n=await fetch(e,t),r=n.headers.get("content-type"),[a]=(r??"").split(/ ?; ?/);if(n.status>299)throw new Error("Not found");if(!["image/svg+xml","text/plain"].some(e=>a.includes(e)))throw new Error(`Content type isn't valid: ${a}`);return n.text()}function y(e=1){return new Promise(t=>{setTimeout(t,1e3*e)})}var w,S=class{constructor(){p(this,"cacheApi"),p(this,"cacheStore"),p(this,"subscribers",[]),p(this,"isReady",!1),this.cacheStore=new Map;let e=h,t=!1;g()&&(e=window.REACT_INLINESVG_CACHE_NAME??h,t=!!window.REACT_INLINESVG_PERSISTENT_CACHE&&"caches"in window),t?caches.open(e).then(e=>{this.cacheApi=e}).catch(e=>{console.error(`Failed to open cache: ${e.message}`),this.cacheApi=void 0}).finally(()=>{this.isReady=!0;const e=[...this.subscribers];this.subscribers.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`Error in CacheStore subscriber callback: ${e.message}`)}})}):this.isReady=!0}onReady(e){this.isReady?e():this.subscribers.push(e)}async get(e,t){return await(this.cacheApi?this.fetchAndAddToPersistentCache(e,t):this.fetchAndAddToInternalCache(e,t)),this.cacheStore.get(e)?.content??""}set(e,t){this.cacheStore.set(e,t)}isCached(e){return this.cacheStore.get(e)?.status===f.LOADED}async fetchAndAddToInternalCache(e,t){const n=this.cacheStore.get(e);if(n?.status!==f.LOADING){if(!n?.content){this.cacheStore.set(e,{content:"",status:f.LOADING});try{const n=await b(e,t);this.cacheStore.set(e,{content:n,status:f.LOADED})}catch(t){throw this.cacheStore.set(e,{content:"",status:f.FAILED}),t}}}else await this.handleLoading(e,async()=>{this.cacheStore.set(e,{content:"",status:f.IDLE}),await this.fetchAndAddToInternalCache(e,t)})}async fetchAndAddToPersistentCache(e,t){const n=this.cacheStore.get(e);if(n?.status===f.LOADED)return;if(n?.status===f.LOADING)return void await this.handleLoading(e,async()=>{this.cacheStore.set(e,{content:"",status:f.IDLE}),await this.fetchAndAddToPersistentCache(e,t)});this.cacheStore.set(e,{content:"",status:f.LOADING});const r=await(this.cacheApi?.match(e));if(r){const t=await r.text();return void this.cacheStore.set(e,{content:t,status:f.LOADED})}try{await(this.cacheApi?.add(new Request(e,t)));const n=await(this.cacheApi?.match(e)),r=await(n?.text())??"";this.cacheStore.set(e,{content:r,status:f.LOADED})}catch(t){throw this.cacheStore.set(e,{content:"",status:f.FAILED}),t}}async handleLoading(e,t){for(let t=0;t<10;t++){if(this.cacheStore.get(e)?.status!==f.LOADING)return;await y(.1)}await t()}keys(){return[...this.cacheStore.keys()]}data(){return[...this.cacheStore.entries()].map(([e,t])=>({[e]:t}))}async delete(e){this.cacheApi&&await this.cacheApi.delete(e),this.cacheStore.delete(e)}async clear(){if(this.cacheApi){const e=await this.cacheApi.keys();await Promise.allSettled(e.map(e=>this.cacheApi.delete(e)))}this.cacheStore.clear()}};function x(e){const t=(0,r.useRef)(void 0);return(0,r.useEffect)(()=>{t.current=e}),t.current}function E(e){const{baseURL:t,content:n,description:r,handleError:a,hash:i,preProcessor:o,title:s,uniquifyIDs:l=!1}=e;try{const e=function(e,t){if(t)return t(e);return e}(n,o),a=u(e,{nodeOnly:!0});if(!(a&&a instanceof SVGSVGElement))throw new Error("Could not convert the src to a DOM Node");const c=_(a,{baseURL:t,hash:i,uniquifyIDs:l});if(r){const e=c.querySelector("desc");e?.parentNode&&e.parentNode.removeChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","desc");t.innerHTML=r,c.prepend(t)}if(void 0!==s){const e=c.querySelector("title");if(e?.parentNode&&e.parentNode.removeChild(e),s){const e=document.createElementNS("http://www.w3.org/2000/svg","title");e.innerHTML=s,c.prepend(e)}}return c}catch(e){return a(e)}}function _(e,t){const{baseURL:n="",hash:r,uniquifyIDs:a}=t,i=["id","href","xlink:href","xlink:role","xlink:arcrole"],o=["href","xlink:href"];return a?([...e.children].forEach(e=>{if(e.attributes?.length){const t=Object.values(e.attributes).map(e=>{const t=e,a=/url\((.*?)\)/.exec(e.value);return a?.[1]&&(t.value=e.value.replace(a[0],`url(${n}${a[1]}__${r})`)),t});i.forEach(e=>{const n=t.find(t=>t.name===e);var a,i;n&&(a=e,i=n.value,!o.includes(a)||!i||i.includes("#"))&&(n.value=`${n.value}__${r}`)})}return e.children.length?_(e,t):e}),e):e}function C(e){const{cacheRequests:t=!0,children:n=null,description:a,fetchOptions:i,innerRef:o,loader:s=null,onError:l,onLoad:c,src:d,title:p,uniqueHash:h}=e,[y,S]=(0,r.useReducer)((e,t)=>({...e,...t}),{content:"",element:null,isCached:t&&w.isCached(e.src),status:f.IDLE}),{content:_,element:C,isCached:R,status:O}=y,k=x(e),D=x(y),A=(0,r.useRef)(h??function(e){const t="abcdefghijklmnopqrstuvwxyz",n=`${t}${t.toUpperCase()}1234567890`;let r="";for(let t=0;t<e;t++)r+=m(n);return r}(8)),T=(0,r.useRef)(!1),I=(0,r.useRef)(!1),P=(0,r.useCallback)(e=>{T.current&&(S({status:"Browser does not support SVG"===e.message?f.UNSUPPORTED:f.FAILED}),l?.(e))},[l]),L=(0,r.useCallback)((e,t=!1)=>{T.current&&S({content:e,isCached:t,status:f.LOADED})},[]),M=(0,r.useCallback)(async()=>{const e=await b(d,i);L(e)},[i,L,d]),N=(0,r.useCallback)(()=>{try{const t=u(E({...e,handleError:P,hash:A.current,content:_}));if(!t||!(0,r.isValidElement)(t))throw new Error("Could not convert the src to a React element");S({element:t,status:f.READY})}catch(e){P(e)}},[_,P,e]),V=(0,r.useCallback)(async()=>{const e=/^data:image\/svg[^,]*?(;base64)?,(.*)/u.exec(d);let n;if(e?n=e[1]?window.atob(e[2]):decodeURIComponent(e[2]):d.includes("<svg")&&(n=d),n)L(n);else try{if(t){const e=await w.get(d,i);L(e,!0)}else await M()}catch(e){P(e)}},[t,M,i,P,L,d]),$=(0,r.useCallback)(async()=>{T.current&&S({content:"",element:null,isCached:!1,status:f.LOADING})},[]);(0,r.useEffect)(()=>{if(T.current=!0,g()&&!I.current){try{if(O===f.IDLE){if(!v())throw new Error("Browser does not support SVG");if(!d)throw new Error("Missing src");$()}}catch(e){P(e)}return I.current=!0,()=>{T.current=!1}}},[]),(0,r.useEffect)(()=>{if(g()&&k&&k.src!==d){if(!d)return void P(new Error("Missing src"));$()}},[P,$,k,d]),(0,r.useEffect)(()=>{O===f.LOADED&&N()},[O,N]),(0,r.useEffect)(()=>{g()&&k&&k.src===d&&(k.title===p&&k.description===a||N())},[a,N,k,d,p]),(0,r.useEffect)(()=>{if(D)switch(O){case f.LOADING:D.status!==f.LOADING&&V();break;case f.LOADED:D.status!==f.LOADED&&N();break;case f.READY:D.status!==f.READY&&c?.(d,R)}},[V,N,R,c,D,d,O]);const j=function(e,...t){const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}(e,"baseURL","cacheRequests","children","description","fetchOptions","innerRef","loader","onError","onLoad","preProcessor","src","title","uniqueHash","uniquifyIDs");return g()?C?(0,r.cloneElement)(C,{ref:o,...j}):[f.UNSUPPORTED,f.FAILED].includes(O)?n:s:s}function R(e){w||(w=new S);const{loader:t}=e,[n,a]=(0,r.useState)(w.isReady);return(0,r.useEffect)(()=>{n||w.onReady(()=>{a(!0)})},[n]),n?r.createElement(C,{...e}):t}}}]);
//# sourceMappingURL=489.js.map?_cache=f595b5ee90729da480b1