Files
hx-ki.com2/grafana/plugins/grafana-lokiexplore-app/217.js
2026-03-06 15:22:40 +00:00

3 lines
564 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 217.js.LICENSE.txt */
(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[217],{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,{AITextArea:()=>$t,AITextInput:()=>Vt,ASSISTANT_PLUGIN_ID:()=>U,ASSISTANT_PLUGIN_TITLE:()=>W,CALLBACK_EXTENSION_POINT:()=>F,ComponentNodeData:()=>E,DashboardNodeData:()=>k,DatasourceNodeData:()=>O,EntityNodeData:()=>A,FolderNodeData:()=>R,LabelNameNodeData:()=>D,LabelValueNodeData:()=>I,OpenAssistantButton:()=>wt,OpenAssistantSplitButton:()=>Et,StructuredNodeData:()=>o,closeAssistant:()=>X,createAssistantContextItem:()=>L,ensureInlineAssistantInitialized:()=>It,getExposeAssistantFunctionsConfig:()=>z,getInlineAssistantFactory:()=>Tt,isAssistantAvailable:()=>H,newFunctionNamespace:()=>j,openAssistant:()=>Y,provideComponents:()=>C,providePageContext:()=>b,provideQuestions:()=>M,setInlineAssistantFactory:()=>At,setInlineAssistantInitializer:()=>Dt,toggleAssistant:()=>Z,useAssistant:()=>J,useInlineAssistant:()=>Pt,usePageComponents:()=>_,usePageContext:()=>w,useProvidePageContext:()=>y,useProvideQuestions:()=>V,useQuestions:()=>N});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="__grafanaAssistantPageContextRegistry__",d="grafana-assistant:page-context-registry-changed",p="grafana-assistant:page-context-update",h="grafana-assistant:page-context-remove",f="grafana-assistant:page-context-sync";function m(){return window[c]}function g(e,t=!1){window[c]=e,window.dispatchEvent(new CustomEvent(d)),t||window.dispatchEvent(new CustomEvent(f,{detail:{registry:e}}))}window[c]||(window[c]=[]);let v=!1;function b(e,t){const n={id:S(),urlPattern:e,context:[...t]};g([...m(),n]),window.dispatchEvent(new CustomEvent(p,{detail:n}));const r=e=>{const t=m(),r=t.findIndex(e=>e.id===n.id);if(-1!==r){const n=[...t];n[r]={...n[r],context:[...e]},g(n),window.dispatchEvent(new CustomEvent(p,{detail:n[r]}))}};return r.unregister=()=>{const e=m(),t=e.findIndex(e=>e.id===n.id);-1!==t&&(g(e.filter((e,n)=>n!==t)),window.dispatchEvent(new CustomEvent(h,{detail:{id:n.id}})))},r}function y(e,t=[]){const n=(0,l.useRef)(void 0),r=(0,l.useRef)(t);return r.current=t,(0,l.useEffect)(()=>(n.current=b(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 w(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){if(!e)return[];const t=[],n=m();for(const r of n)x(e,r.urlPattern)&&t.push(...r.context);return t}(r.getLocation().pathname);n(e)},t=()=>{e()},i=r.getLocationObservable().subscribe(t=>{const n=t.pathname;n!==a.current&&(a.current=n,e())});return window.addEventListener(d,t),window.addEventListener(p,t),window.addEventListener(h,t),window.addEventListener(f,t),e(),()=>{i.unsubscribe(),window.removeEventListener(d,t),window.removeEventListener(p,t),window.removeEventListener(h,t),window.removeEventListener(f,t)}},[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 S(e="page-context"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function x(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}v||(v=!0,window.addEventListener(p,e=>{const t=e.detail;if(!t||!t.id)return;const n=m(),r=n.findIndex(e=>e.id===t.id);if(-1!==r){const e=[...n];e[r]=t,g(e,!0)}else g([...n,t],!0)}),window.addEventListener(h,e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.id;if(!n)return;const r=m(),a=r.findIndex(e=>e.id===n);-1!==a&&g(r.filter((e,t)=>t!==a),!0)}),window.addEventListener(f,e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.registry;if(!Array.isArray(n))return;const r=m(),a=new Set(r.map(e=>e.id)),i=n.filter(e=>!a.has(e.id));i.length>0&&g([...r,...i],!0)}));class E 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 _(){const e=w({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)&&Object.keys(n.components).length>0){const e=n.namespace||n.name||"components";Object.entries(n.components).forEach(([n,r])=>{t[`${e}_${n}`]=r})}}),t},[e])}function C(e,t,n,r=/.*/){if((a=r)instanceof RegExp?".*"===a.source&&""===a.flags:".*"===a||"/.*/"===a){const r=b(/.*/,[L("component",{components:n,prompt:e,namespace:t})]),a=(e,n)=>{r([L("component",{components:e,prompt:n,namespace:t})])};return a.unregister=r.unregister,a}var a;const i=b(/.*/,[L("component",{components:n,prompt:"",namespace:t})]),o=b(r,[L("component",{components:{},prompt:e,namespace:t})]),s=(e,n)=>{i([L("component",{components:e,prompt:"",namespace:t})]),o([L("component",{components:{},prompt:n,namespace:t})])};return s.unregister=()=>{i.unregister(),o.unregister()},s}class k 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 R 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 O 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 A 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 D 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 I 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 T(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 P={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 L(e,t){var n,r,a;const s=function(e,t){switch(e){case"datasource":return new O({...t,...T(t.datasourceUid)});case"label_name":return new D({...t,...T(t.datasourceUid)});case"label_value":return new I({...t,...T(t.datasourceUid)});case"dashboard":return new k(t);case"dashboard_folder":return new R(t);case"structured":return new o(t);case"component":return new E({...t,hidden:!0});case"entity":return new A(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:P[e],navigable:!1,selectable:!0,data:s},occurrences:[]}}function M(e,t){const n=S("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=b(e,r(t)),i=e=>{a(r(e))};return i.unregister=a.unregister,i}function V(e,t=[]){const n=(0,l.useMemo)(()=>S("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=y(e,r(t));return e=>{a(r(e))}}function N(){const e=w({allowQuestions:!0,allowComponents:!1});return $(e)}const $=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)||[]}}),F="grafana-assistant-app/callback/v0-alpha";function j(e,t){return{namespace:e,functions:t}}function z(e){return{title:"callback",targets:[F],fn:()=>e.map(e=>({namespace:e.namespace,functions:e.functions}))}}const B=n(1269),U="grafana-assistant-app",W="Grafana Assistant";function H(){return s.getObservablePluginLinks?(0,s.getObservablePluginLinks)({extensionPointId:"grafana/extension-sidebar/v0-alpha"}).pipe((0,B.map)(e=>e.some(e=>e.pluginId===U&&e.title===W))):(0,B.of)(!1)}const q=n(7781);class G extends q.BusEventWithPayload{}G.type="open-extension-sidebar";class Q extends q.BusEventBase{}Q.type="close-extension-sidebar";class K extends q.BusEventWithPayload{}function Y(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 G({pluginId:e,componentTitle:t,props:n});(0,s.getAppEvents)().publish(r)}(U,W,{initialPrompt:e.prompt,initialContext:e.context,initialAutoSend:null===(n=e.autoSend)||void 0===n||n,origin:e.origin,initialMode:e.mode})}function X(){!function(){const e=new Q;(0,s.getAppEvents)().publish(e)}()}function Z(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 K({pluginId:e,componentTitle:t,props:n});(0,s.getAppEvents)().publish(r)}(U,W,{initialPrompt:e.prompt,initialContext:e.context,initialAutoSend:null===(n=e.autoSend)||void 0===n||n,origin:e.origin,initialMode:e.mode})}function J(){const[e,t]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{const e=H().subscribe(e=>t(e));return()=>{e.unsubscribe()}},[]),{isAvailable:e,openAssistant:e?Y:void 0,closeAssistant:e?X:void 0,toggleAssistant:e?Z:void 0}}K.type="toggle-extension-sidebar";const ee=n(2007);var te=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}(),ne=Math.abs,re=String.fromCharCode,ae=Object.assign;function ie(e){return e.trim()}function oe(e,t,n){return e.replace(t,n)}function se(e,t){return e.indexOf(t)}function le(e,t){return 0|e.charCodeAt(t)}function ue(e,t,n){return e.slice(t,n)}function ce(e){return e.length}function de(e){return e.length}function pe(e,t){return t.push(e),e}var he=1,fe=1,me=0,ge=0,ve=0,be="";function ye(e,t,n,r,a,i,o){return{value:e,root:t,parent:n,type:r,props:a,children:i,line:he,column:fe,length:o,return:""}}function we(e,t){return ae(ye("",null,null,"",null,null,0),e,{length:-e.length},t)}function Se(){return ve=ge>0?le(be,--ge):0,fe--,10===ve&&(fe=1,he--),ve}function xe(){return ve=ge<me?le(be,ge++):0,fe++,10===ve&&(fe=1,he++),ve}function Ee(){return le(be,ge)}function _e(){return ge}function Ce(e,t){return ue(be,e,t)}function ke(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 Re(e){return he=fe=1,me=ce(be=e),ge=0,[]}function Oe(e){return be="",e}function Ae(e){return ie(Ce(ge-1,Te(91===e?e+2:40===e?e+1:e)))}function De(e){for(;(ve=Ee())&&ve<33;)xe();return ke(e)>2||ke(ve)>3?"":" "}function Ie(e,t){for(;--t&&xe()&&!(ve<48||ve>102||ve>57&&ve<65||ve>70&&ve<97););return Ce(e,_e()+(t<6&&32==Ee()&&32==xe()))}function Te(e){for(;xe();)switch(ve){case e:return ge;case 34:case 39:34!==e&&39!==e&&Te(ve);break;case 40:41===e&&Te(e);break;case 92:xe()}return ge}function Pe(e,t){for(;xe()&&e+ve!==57&&(e+ve!==84||47!==Ee()););return"/*"+Ce(t,ge-1)+"*"+re(47===e?e:xe())}function Le(e){for(;!ke(Ee());)xe();return Ce(e,ge)}var Me="-ms-",Ve="-moz-",Ne="-webkit-",$e="comm",Fe="rule",je="decl",ze="@keyframes";function Be(e,t){for(var n="",r=de(e),a=0;a<r;a++)n+=t(e[a],a,e,t)||"";return n}function Ue(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case je:return e.return=e.return||e.value;case $e:return"";case ze:return e.return=e.value+"{"+Be(e.children,r)+"}";case Fe:e.value=e.props.join(",")}return ce(n=Be(e.children,r))?e.return=e.value+"{"+n+"}":""}function We(e){return Oe(He("",null,null,null,[""],e=Re(e),0,[0],e))}function He(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=xe()){case 40:if(108!=f&&58==le(E,d-1)){-1!=se(E+=oe(Ae(b),"&","&\f"),"&\f")&&(v=-1);break}case 34:case 39:case 91:E+=Ae(b);break;case 9:case 10:case 13:case 32:E+=De(f);break;case 92:E+=Ie(_e()-1,7);continue;case 47:switch(Ee()){case 42:case 47:pe(Ge(Pe(xe(),_e()),t,n),l);break;default:E+="/"}break;case 123*m:s[u++]=ce(E)*v;case 125*m:case 59:case 0:switch(b){case 0:case 125:g=0;case 59+c:-1==v&&(E=oe(E,/\f/g,"")),h>0&&ce(E)-d&&pe(h>32?Qe(E+";",r,n,d-1):Qe(oe(E," ","")+";",r,n,d-2),l);break;case 59:E+=";";default:if(pe(x=qe(E,t,n,u,c,a,s,y,w=[],S=[],d),i),123===b)if(0===c)He(E,t,x,x,w,i,d,s,S);else switch(99===p&&110===le(E,3)?100:p){case 100:case 108:case 109:case 115:He(e,x,x,r&&pe(qe(e,x,x,0,0,a,s,y,a,w=[],d),S),a,S,d,s,r?w:S);break;default:He(E,x,x,x,[""],S,0,s,S)}}u=c=h=0,m=v=1,y=E="",d=o;break;case 58:d=1+ce(E),h=f;default:if(m<1)if(123==b)--m;else if(125==b&&0==m++&&125==Se())continue;switch(E+=re(b),b*m){case 38:v=c>0?1:(E+="\f",-1);break;case 44:s[u++]=(ce(E)-1)*v,v=1;break;case 64:45===Ee()&&(E+=Ae(xe())),p=Ee(),c=d=ce(y=E+=Le(_e())),b++;break;case 45:45===f&&2==ce(E)&&(m=0)}}return i}function qe(e,t,n,r,a,i,o,s,l,u,c){for(var d=a-1,p=0===a?i:[""],h=de(p),f=0,m=0,g=0;f<r;++f)for(var v=0,b=ue(e,d+1,d=ne(m=o[f])),y=e;v<h;++v)(y=ie(m>0?p[v]+" "+b:oe(b,/&\f/g,p[v])))&&(l[g++]=y);return ye(e,t,n,0===a?Fe:s,l,u,c)}function Ge(e,t,n){return ye(e,t,n,$e,re(ve),ue(e,2,-2),0)}function Qe(e,t,n,r){return ye(e,t,n,je,ue(e,0,r),ue(e,r+1,-1),r)}var Ke=function(e,t,n){for(var r=0,a=0;r=a,a=Ee(),38===r&&12===a&&(t[n]=1),!ke(a);)xe();return Ce(e,ge)},Ye=new WeakMap,Xe=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)||Ye.get(n))&&!r){Ye.set(e,!0);for(var a=[],i=function(e,t){return Oe(function(e,t){var n=-1,r=44;do{switch(ke(r)){case 0:38===r&&12===Ee()&&(t[n]=1),e[n]+=Ke(ge-1,t,n);break;case 2:e[n]+=Ae(r);break;case 4:if(44===r){e[++n]=58===Ee()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=re(r)}}while(r=xe());return e}(Re(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]}}},Ze=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Je(e,t){switch(function(e,t){return 45^le(e,0)?(((t<<2^le(e,0))<<2^le(e,1))<<2^le(e,2))<<2^le(e,3):0}(e,t)){case 5103:return Ne+"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 Ne+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ne+e+Ve+e+Me+e+e;case 6828:case 4268:return Ne+e+Me+e+e;case 6165:return Ne+e+Me+"flex-"+e+e;case 5187:return Ne+e+oe(e,/(\w+).+(:[^]+)/,Ne+"box-$1$2"+Me+"flex-$1$2")+e;case 5443:return Ne+e+Me+"flex-item-"+oe(e,/flex-|-self/,"")+e;case 4675:return Ne+e+Me+"flex-line-pack"+oe(e,/align-content|flex-|-self/,"")+e;case 5548:return Ne+e+Me+oe(e,"shrink","negative")+e;case 5292:return Ne+e+Me+oe(e,"basis","preferred-size")+e;case 6060:return Ne+"box-"+oe(e,"-grow","")+Ne+e+Me+oe(e,"grow","positive")+e;case 4554:return Ne+oe(e,/([^-])(transform)/g,"$1"+Ne+"$2")+e;case 6187:return oe(oe(oe(e,/(zoom-|grab)/,Ne+"$1"),/(image-set)/,Ne+"$1"),e,"")+e;case 5495:case 3959:return oe(e,/(image-set\([^]*)/,Ne+"$1$`$1");case 4968:return oe(oe(e,/(.+:)(flex-)?(.*)/,Ne+"box-pack:$3"+Me+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ne+e+e;case 4095:case 3583:case 4068:case 2532:return oe(e,/(.+)-inline(.+)/,Ne+"$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(ce(e)-1-t>6)switch(le(e,t+1)){case 109:if(45!==le(e,t+4))break;case 102:return oe(e,/(.+:)(.+)-([^]+)/,"$1"+Ne+"$2-$3$1"+Ve+(108==le(e,t+3)?"$3":"$2-$3"))+e;case 115:return~se(e,"stretch")?Je(oe(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==le(e,t+1))break;case 6444:switch(le(e,ce(e)-3-(~se(e,"!important")&&10))){case 107:return oe(e,":",":"+Ne)+e;case 101:return oe(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ne+(45===le(e,14)?"inline-":"")+"box$3$1"+Ne+"$2$3$1"+Me+"$2box$3")+e}break;case 5936:switch(le(e,t+11)){case 114:return Ne+e+Me+oe(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ne+e+Me+oe(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ne+e+Me+oe(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ne+e+Me+e+e}return e}var et=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case je:e.return=Je(e.value,e.length);break;case ze:return Be([we(e,{value:oe(e.value,"@","@"+Ne)})],r);case Fe: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 Be([we(e,{props:[oe(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return Be([we(e,{props:[oe(t,/:(plac\w+)/,":"+Ne+"input-$1")]}),we(e,{props:[oe(t,/:(plac\w+)/,":-moz-$1")]}),we(e,{props:[oe(t,/:(plac\w+)/,Me+"input-$1")]})],r)}return""})}}],tt={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 nt=/[A-Z]|^ms/g,rt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,at=function(e){return 45===e.charCodeAt(1)},it=function(e){return null!=e&&"boolean"!=typeof e},ot=function(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}(function(e){return at(e)?e:e.replace(nt,"-$&").toLowerCase()}),st=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(rt,function(e,t,n){return ut={name:t,styles:n,next:ut},t})}return 1===tt[e]||at(e)||"number"!=typeof t||0===t?t:t+"px"};function lt(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 ut={name:a.name,styles:a.styles,next:ut},a.name;var i=n;if(void 0!==i.styles){var o=i.next;if(void 0!==o)for(;void 0!==o;)ut={name:o.name,styles:o.styles,next:ut},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+=lt(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]+"}":it(s)&&(r+=ot(i)+":"+st(i,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=t&&void 0!==t[o[0]]){var l=lt(e,t,o);switch(i){case"animation":case"animationName":r+=ot(i)+":"+l+";";break;default:r+=i+"{"+l+"}"}}else for(var u=0;u<o.length;u++)it(o[u])&&(r+=ot(i)+":"+st(i,o[u])+";")}return r}(e,t,n);case"function":if(void 0!==e){var s=ut,l=n(e);return ut=s,lt(e,t,l)}}var u=n;if(null==t)return u;var c=t[u];return void 0!==c?c:u}var ut,ct=/label:\s*([^\s;{]+)\s*(;|$)/g;function dt(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="";ut=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,a+=lt(n,t,i)):a+=i[0];for(var o=1;o<e.length;o++)a+=lt(n,t,e[o]),r&&(a+=i[o]);ct.lastIndex=0;for(var s,l="";null!==(s=ct.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:ut}}function pt(e,t,n){var r="";return n.split(" ").forEach(function(n){void 0!==e[n]?t.push(e[n]+";"):n&&(r+=n+" ")}),r}function ht(e,t){if(void 0===e.inserted[t.name])return e.insert("",t,e.sheet,!0)}function ft(e,t,n){var r=[],a=pt(e,r,n);return r.length<2?n:a+t(r)}var mt=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},gt=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||et,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=[Ue,(d=function(e){l.insert(e)},function(e){e.root||(e=e.return)&&d(e)})],h=(u=[Xe,Ze].concat(i,p),c=de(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,Be(We(e?e+"{"+t.styles+"}":t.styles),h),r&&(f.inserted[t.name]=!0)};var f={key:t,sheet:new te({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=dt(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 ft(e.registered,t,mt(r))},injectGlobal:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=dt(n,e.registered);ht(e,a)},keyframes:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=dt(n,e.registered),i="animation-"+a.name;return ht(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:pt.bind(null,e.registered),merge:ft.bind(null,e.registered,t)}}(),vt=(gt.flush,gt.hydrate,gt.cx),bt=(gt.merge,gt.getRegisteredStyles,gt.injectGlobal,gt.keyframes),yt=gt.css;function wt(e){const{isAvailable:t,openAssistant:n}=J();return t&&n?u().createElement(St,{...e,openAssistant:n}):null}function St({prompt:e,origin:t,context:n,autoSend:r=!0,title:a="Analyze with Assistant",size:i="sm",iconOnlyButton:o=!1,openAssistant:c,onClick:d}){const p=(0,ee.useStyles2)(xt);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(ee.IconButton,{name:"ai-sparkle",onClick:()=>{null==d||d(),c({prompt:e,context:n,autoSend:r,origin:t})},variant:"secondary",size:i,"aria-label":a,className:p.icon,tooltip:a,"data-testid":"assistant-icon-button"}):u().createElement(ee.Button,{icon:"ai-sparkle",onClick:()=>{null==d||d(),c({prompt:e,context:n,autoSend:r,origin:t})},variant:"secondary",fill:"solid",size:i,title:a,"aria-label":a,className:p.button,"data-testid":"assistant-button"},a))}gt.sheet,gt.cache;const xt=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:yt({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:yt({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}`}})}};function Et(e){const{isAvailable:t,openAssistant:n}=J();return t&&n?u().createElement(_t,{...e,openAssistant:n}):null}function _t({prompt:e,origin:t,context:n,autoSend:r=!0,title:a="Chat with Assistant",size:i="sm",onClick:o,menuItems:c,tooltip:d,openAssistant:p}){const h=(0,ee.useStyles2)(Ct);(0,l.useEffect)(()=>{(0,s.reportInteraction)("grafana_assistant_app_open_sidebar_split_button_displayed",{from:t})},[t]);const f=u().createElement("div",{className:h.wrapper},u().createElement(ee.ButtonGroup,{className:h.buttonGroup},u().createElement(ee.Button,{icon:"ai-sparkle",onClick:()=>{null==o||o(),p({prompt:e,context:n,autoSend:r,origin:t})},variant:"secondary",fill:"solid",size:i,"aria-label":a,"data-testid":"assistant-split-button-main"},a),c&&u().createElement(ee.Dropdown,{overlay:c},u().createElement(ee.Button,{variant:"secondary",icon:"angle-down",size:i,"aria-label":"More AI actions",className:h.dropdownButton,"data-testid":"assistant-split-button-dropdown"}))));return d?u().createElement(ee.Tooltip,{content:d},f):f}const Ct=e=>{const t=e.colors.secondary.main,n=e.colors.emphasize(t,.05),r=e.colors.background.canvas,a=e.shape.radius.default;return{wrapper:yt({label:"assistant-split-button-wrapper",position:"relative",isolation:"isolate",display:"inline-block","&::before":{content:'""',position:"absolute",inset:0,borderRadius:a,background:"linear-gradient(90deg, rgb(168, 85, 247), rgb(249, 115, 22))",zIndex:-1,pointerEvents:"none"},"&::after":{content:'""',position:"absolute",inset:"1px",borderRadius:`max(calc(${a} - 1px), 1px)`,background:`linear-gradient(${t}, ${t}), ${r}`,zIndex:-1,pointerEvents:"none"},"&:hover::after":{background:`linear-gradient(${n}, ${n}), ${r}`}}),buttonGroup:yt({label:"assistant-split-button-group",gap:0,position:"relative",zIndex:1,"& button":{border:"none",background:"transparent !important","&:hover":{background:"transparent !important"}}}),dropdownButton:yt({padding:"0 6px"})}},kt="__grafanaAssistantInlineFactory__",Rt="__grafanaAssistantInlineInitializer__",Ot="__grafanaAssistantInlineInitPromise__";function At(e){const t=window[kt];t&&t!==e?console.warn("InlineAssistant factory already set; ignoring subsequent setInlineAssistantFactory call"):t||(window[kt]=e)}function Dt(e){const t=window[Rt];t&&t!==e?console.warn("InlineAssistant initializer already set; ignoring subsequent setInlineAssistantInitializer call"):t||(window[Rt]=e)}async function It(){if(window[kt])return;const e=window[Rt];if(!e)throw new Error("InlineAssistant not initialized. Make sure the Grafana Assistant plugin is loaded and initialized.");const t=window[Ot];if(t)return t;const n=(async()=>{try{await e()}catch(e){throw window[Ot]=null,e}})();return window[Ot]=n,n}function Tt(){const e=window[kt];if(!e)throw new Error("InlineAssistant factory not initialized. Make sure the Grafana Assistant plugin is loaded.");return e}function Pt(){const[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(""),[a,i]=(0,l.useState)(null),o=(0,l.useRef)(null),s=(0,l.useCallback)(()=>{i(null),r("")},[]),u=(0,l.useCallback)(()=>{o.current&&o.current.cancel(),t(!1)},[]),c=(0,l.useCallback)(async e=>{var n;i(null),r(""),t(!0);try{await It();const n=Tt();o.current||(o.current=await n(e.origin)),await o.current.sendPrompt({prompt:e.prompt,systemPrompt:e.systemPrompt,onStart:()=>{t(!0)},onDelta:t=>{var n;r(e=>e+t),null===(n=e.onDelta)||void 0===n||n.call(e,t)},onComplete:n=>{var a;r(n),t(!1),null===(a=e.onComplete)||void 0===a||a.call(e,n)},onError:n=>{var r;i(n),t(!1),null===(r=e.onError)||void 0===r||r.call(e,n)}})}catch(r){const a=r instanceof Error?r:new Error(String(r));i(a),t(!1),null===(n=e.onError)||void 0===n||n.call(e,a)}},[]);return(0,l.useEffect)(()=>()=>{o.current&&(o.current.cancel(),o.current.dispose(),o.current=null)},[]),{generate:c,isGenerating:e,content:n,error:a,cancel:u,reset:s}}const Lt=e=>{const t=["rgb(168, 85, 247)","rgb(249, 115, 22)"];if("dark"===e.name.toLowerCase()||"light"===e.name.toLowerCase())return t;const n=e.colors.gradients.brandHorizontal.match(/#[0-9A-Fa-f]{6}/g);return!n||n.length<2?t:[n[0],n[1]]},Mt=(e,t,n,r)=>{const a=Array.from({length:101},(e,t)=>t),i={},[o,s]=Lt(e),l=null!=n?n:o,u=null!=r?r:s;return a.forEach(e=>{i[`${e}%`]={backgroundImage:`\n linear-gradient(${t}, ${t}),\n conic-gradient(from ${3.6*e}deg, transparent 60%, ${l} 80%, ${u} 100%, transparent 15%)\n `}}),i};function Vt({value:e,onChange:t,placeholder:n,origin:r,systemPrompt:a,onComplete:i,onError:o,onDelta:s,disabled:l=!1,className:c,"data-testid":d}){const{generate:p,isGenerating:h,error:f,reset:m}=Pt(),g=!e.trim()||l||h,v=(0,ee.useStyles2)(Nt),b=async()=>{if(g)return;const t=e.trim();m(),await p({prompt:t,origin:r,systemPrompt:a,onComplete:e=>{null==i||i(e)},onError:e=>{null==o||o(e)},onDelta:e=>{null==s||s(e)}})},y=u().createElement(ee.IconButton,{name:"ai-sparkle",onClick:b,disabled:g,tooltip:g?"Enter text to generate":"Generate with AI","data-testid":d?`${d}-send`:void 0});return u().createElement("div",{className:vt(v.wrapper,{[v.animatedWrapper]:h},c),"data-testid":d},u().createElement(ee.Input,{value:e,onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},onChange:e=>t(e.currentTarget.value),placeholder:null!=n?n:"Ask AI to generate...",disabled:l||h,suffix:y,invalid:!!f,"data-testid":d?`${d}-input`:void 0}))}const Nt=e=>{const t=e.colors.background.primary,n=bt({label:"ai-input-border-animation",...Mt(e,t)}),[r,a]=Lt(e);return{wrapper:yt({label:"ai-text-input-wrapper",position:"relative",borderRadius:e.shape.radius.default}),animatedWrapper:yt({label:"ai-text-input-animated",border:"1px solid transparent",backgroundImage:`\n linear-gradient(${t}, ${t}),\n conic-gradient(from 0deg, transparent 60%, ${r} 80%, ${a} 100%, transparent 15%)\n `,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",animation:`${n} 2s linear infinite`,"& input":{border:"none !important"}})}};function $t({value:e,onChange:t,placeholder:n,origin:r,systemPrompt:a,onComplete:i,onError:o,onDelta:s,disabled:l=!1,rows:c=4,className:d,"data-testid":p}){const{generate:h,isGenerating:f,error:m,reset:g}=Pt(),v=!e.trim()||l||f,b=(0,ee.useStyles2)(Ft),y=async()=>{if(v)return;const t=e.trim();g(),await h({prompt:t,origin:r,systemPrompt:a,onComplete:e=>{null==i||i(e)},onError:e=>{null==o||o(e)},onDelta:e=>{null==s||s(e)}})};return u().createElement("div",{className:vt(b.textareaWrapper,{[b.animatedWrapper]:f},d),"data-testid":p},u().createElement(ee.TextArea,{value:e,onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},onChange:e=>t(e.currentTarget.value),placeholder:null!=n?n:"Ask AI to generate... (Cmd/Ctrl+Enter to send)",disabled:l||f,rows:c,className:b.textarea,invalid:!!m,"data-testid":p?`${p}-textarea`:void 0}),u().createElement(ee.IconButton,{name:"ai-sparkle",onClick:y,disabled:v,className:b.sendButton,"aria-label":"Generate with AI",tooltip:v?"Enter text to generate":"Generate with AI (Cmd/Ctrl+Enter)","data-testid":p?`${p}-send`:void 0}))}const Ft=e=>{const t=e.colors.background.primary,n=bt({label:"ai-textarea-border-animation",...Mt(e,t)}),[r,a]=Lt(e);return{textareaWrapper:yt({label:"ai-textarea-wrapper",position:"relative",borderRadius:e.shape.radius.default}),animatedWrapper:yt({label:"ai-textarea-animated",border:"1px solid transparent",backgroundImage:`\n linear-gradient(${t}, ${t}),\n conic-gradient(from 0deg, transparent 60%, ${r} 80%, ${a} 100%, transparent 15%)\n `,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",animation:`${n} 2s linear infinite`,"& textarea":{border:"none !important"}}),textarea:yt({label:"ai-textarea",paddingRight:e.spacing(4),scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),sendButton:yt({label:"ai-textarea-send",position:"absolute",right:e.spacing(1),top:e.spacing(1)})}};e.exports=r})()},1106:(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(8029),{safeRe:o,t:s}=n(2728),l=n(7685),u=n(5906),c=n(9534),d=n(6293)},6293:(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,D(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=>A(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(I(this.set[t],e,this.options))return!0;return!1}}e.exports=a;const i=new(n(4940)),o=n(8029),s=n(1106),l=n(5906),u=n(9534),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:h,caretTrimReplace:f}=n(2728),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:g}=n(6484),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)=>(e=e.replace(c[d.BUILD],""),l("comp",e,t),e=_(e,t),l("caret",e),e=x(e,t),l("tildes",e),e=k(e,t),l("xrange",e),e=O(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})},k=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>R(e,t)).join(" ")),R=(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})},O=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),A=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),D=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(),I=(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}},9534:(e,t,n)=>{"use strict";const r=n(5906),{MAX_LENGTH:a,MAX_SAFE_INTEGER:i}=n(6484),{safeRe:o,t:s}=n(2728),l=n(8029),{compareIdentifiers:u}=n(410);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)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}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},8968:(e,t,n)=>{"use strict";const r=n(7237);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},7685:(e,t,n)=>{"use strict";const r=n(6175),a=n(6877),i=n(7574),o=n(3039),s=n(5161),l=n(1178);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}`)}}},7192:(e,t,n)=>{"use strict";const r=n(9534),a=n(7237),{safeRe:i,t:o}=n(2728);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)}},6879:(e,t,n)=>{"use strict";const r=n(9534);e.exports=(e,t,n)=>{const a=new r(e,n),i=new r(t,n);return a.compare(i)||a.compareBuild(i)}},4693:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t)=>r(e,t,!0)},5566:(e,t,n)=>{"use strict";const r=n(9534);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},7278:(e,t,n)=>{"use strict";const r=n(7237);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"}},6175:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>0===r(e,t,n)},7574:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>r(e,t,n)>0},3039:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>r(e,t,n)>=0},2969:(e,t,n)=>{"use strict";const r=n(9534);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}}},5161:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>r(e,t,n)<0},1178:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>r(e,t,n)<=0},8992:(e,t,n)=>{"use strict";const r=n(9534);e.exports=(e,t)=>new r(e,t).major},1180:(e,t,n)=>{"use strict";const r=n(9534);e.exports=(e,t)=>new r(e,t).minor},6877:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>0!==r(e,t,n)},7237:(e,t,n)=>{"use strict";const r=n(9534);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}}},6339:(e,t,n)=>{"use strict";const r=n(9534);e.exports=(e,t)=>new r(e,t).patch},3731:(e,t,n)=>{"use strict";const r=n(7237);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},6264:(e,t,n)=>{"use strict";const r=n(5566);e.exports=(e,t,n)=>r(t,e,n)},959:(e,t,n)=>{"use strict";const r=n(6879);e.exports=(e,t)=>e.sort((e,n)=>r(n,e,t))},4120:(e,t,n)=>{"use strict";const r=n(6293);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},6657:(e,t,n)=>{"use strict";const r=n(6879);e.exports=(e,t)=>e.sort((e,n)=>r(e,n,t))},5991:(e,t,n)=>{"use strict";const r=n(7237);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},1559:(e,t,n)=>{"use strict";const r=n(2728),a=n(6484),i=n(9534),o=n(410),s=n(7237),l=n(5991),u=n(8968),c=n(2969),d=n(7278),p=n(8992),h=n(1180),f=n(6339),m=n(3731),g=n(5566),v=n(6264),b=n(4693),y=n(6879),w=n(6657),S=n(959),x=n(7574),E=n(5161),_=n(6175),C=n(6877),k=n(3039),R=n(1178),O=n(7685),A=n(7192),D=n(1106),I=n(6293),T=n(4120),P=n(1173),L=n(4922),M=n(8752),V=n(3931),N=n(1772),$=n(4473),F=n(4129),j=n(6184),z=n(5362),B=n(7287),U=n(3910);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:k,lte:R,cmp:O,coerce:A,Comparator:D,Range:I,satisfies:T,toComparators:P,maxSatisfying:L,minSatisfying:M,minVersion:V,validRange:N,outside:$,gtr:F,ltr:j,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}},6484: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}},5906: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},410:e=>{"use strict";const t=/^[0-9]+$/,n=(e,n)=>{if("number"==typeof e&&"number"==typeof n)return e===n?0:e<n?-1:1;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)}},4940: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}}},8029:e=>{"use strict";const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},2728:(e,t,n)=>{"use strict";const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:a,MAX_LENGTH:i}=n(6484),o=n(5906),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*$")},4129:(e,t,n)=>{"use strict";const r=n(4473);e.exports=(e,t,n)=>r(e,t,">",n)},5362:(e,t,n)=>{"use strict";const r=n(6293);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t,n))},6184:(e,t,n)=>{"use strict";const r=n(4473);e.exports=(e,t,n)=>r(e,t,"<",n)},4922:(e,t,n)=>{"use strict";const r=n(9534),a=n(6293);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}},8752:(e,t,n)=>{"use strict";const r=n(9534),a=n(6293);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}},3931:(e,t,n)=>{"use strict";const r=n(9534),a=n(6293),i=n(7574);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}},4473:(e,t,n)=>{"use strict";const r=n(9534),a=n(1106),{ANY:i}=a,o=n(6293),s=n(4120),l=n(7574),u=n(5161),c=n(1178),d=n(3039);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}},7287:(e,t,n)=>{"use strict";const r=n(4120),a=n(5566);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}},3910:(e,t,n)=>{"use strict";const r=n(6293),a=n(1106),{ANY:i}=a,o=n(4120),s=n(5566),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}},1173:(e,t,n)=>{"use strict";const r=n(6293);e.exports=(e,t)=>new r(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},1772:(e,t,n)=>{"use strict";const r=n(6293);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},9618:(e,t,n)=>{"use strict";n.d(t,{H9:()=>Vs,Zx:()=>er,yP:()=>Ju,mI:()=>tc,P1:()=>wc,OS:()=>mp,No:()=>yp,WY:()=>Kt,n8:()=>Ne,d0:()=>bp,UU:()=>O,Oh:()=>gd,jD:()=>Dd,xK:()=>ud,gF:()=>ld,N0:()=>ad,Zv:()=>U,Es:()=>Kn,vA:()=>od,G1:()=>id,Bs:()=>E,So:()=>H,dt:()=>Gs,dM:()=>wd,WM:()=>Kc,KE:()=>Uc,JZ:()=>re,Pj:()=>Yu,oh:()=>ue,$L:()=>yc,Sh:()=>hl,Lp:()=>qu,Eb:()=>Yn,Lw:()=>xc,Gg:()=>r,jh:()=>Fl,Go:()=>wp,TG:()=>yd});var r={};n.r(r),n.d(r,{K2:()=>jn});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=R(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 k=n(3241);function R(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,k.cloneDeep)(e)):t.push(e);n[e]=t}else n[e]="object"==typeof r?(0,k.cloneDeep)(r):r}return n}class O 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 A=new Map;const D=["from","to","timezone"];class I{constructor(e){this.index=new Map,this.options={namespace:(null==e?void 0:e.namespace)||"",excludeFromNamespace:(null==e?void 0:e.excludeFromNamespace)||D}}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(let t=0;t<e.length;t++){T(e[t])&&(e.splice(t,1),t--)}}(r,t.getRoot()),r.push(t),a=r.length-1),a>0?`${n}-${a+1}`:n}clear(){this.index.clear()}}function T(e,t){if(!e.parent)return!1;let n=!1;return e.parent.forEachChild(t=>{if(t===e)return n=!0,!1}),!n||T(e.parent)}function P(e,t){const n=new I(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 L(e,t,n,r){r||M(e,t,n),e.forEachChild(e=>{M(e,t,n)}),e.forEachChild(e=>L(e,t,n,!0))}function M(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];V(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 V(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,k.isEqual)(e,t):t===e[0])}function N(e,t){const n=t.state.$variables;if(!n)return t.parent?N(e,t.parent):null;const r=n.getByName(e);return r||(t.parent?N(e,t.parent):null)}function $(e,t,...n){let r=!1;"undefined"!=typeof window&&(r="true"===localStorage.getItem("grafana.debug.scenes"))}function F(e){return"isQueryController"in e}function j(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(F(e))return e;t=t.parent}}new WeakMap,new WeakMap;var z=n(1625);z.ob.Auto;var B=(e=>(e.NotStarted="NotStarted",e.Loading="Loading",e.Streaming="Streaming",e.Done="Done",e.Error="Error",e))(B||{});class U extends E{constructor(e){super({data:W,...e})}getResultsStream(){const e={origin:this,data:this.state.data};return(0,h.of)(e)}}const W={state:B.Done,series:[],timeRange:(0,i.getDefaultTimeRange)()};class H{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 q(e,t){let n,r=e;for(;r&&!n;)n=t(r),r=r.parent;return n}const G=/^\d+[yYmMsSwWhHdD]$/;function Q(e){if("string"!=typeof e)return null;if(-1!==e.indexOf("now"))return e;if(G.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 K(e,t,n,r,a,o){const s=a&&"now"===t,l=Date.now();o&&function(e){e!==Y&&(Y=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 Y;function X(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()}const Z="refresh",J="filter_removed",ee="filter_changed",te="variable_value_changed",ne="groupby_dimensions";class re extends E{constructor(e={}){var t;const n=e.from&&X(e.from)?e.from:"now-6h",r=e.to&&X(e.to)?e.to:"now",a=ae(e.timeZone);super({from:n,to:r,timeZone:a,value:K(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 H(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=K(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=j(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=ae(e))?t:z.vp,r=K(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=q(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=K(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&&ae(this.state.timeZone))return this.state.timeZone;const e=this.getTimeZoneSource();return e!==this&&ae(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=Q(e.from),s=Q(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&&X(t.from)&&(o=t.from),t.to&&X(t.to)&&(s=t.to)}if(o&&X(o)&&(a.from=o),s&&X(s)&&(a.to=s),"string"==typeof e.timezone&&(a.timeZone=""!==e.timezone?e.timezone:void 0),0!==Object.keys(a).length)return a.value=K(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 ae(e){if(void 0!==e)return(0,k.isEmpty)(e)?o.config.bootData.user.timezone:e===z.vp||(0,i.getZone)(e)?e:void $()}const ie=new U,oe=new re;const se=new class extends E{constructor(){super({variables:[]})}getByName(e){}isVariableLoadingOrWaitingToUpdate(e){return!1}};function le(e){var t;return null!=(t=q(e,e=>e.state.$timeRange))?t:oe}class ue extends i.BusEventWithPayload{}function ce(e){return"object"==typeof e&&"formatter"in e}ue.type="scene-variable-changed-value";let de,pe={};function he(e){const t=pe[e];return t||(pe[e]=(0,k.property)(e))}class fe{constructor(e,t){this.state={name:e,value:t,type:"scopedvar"}}getValue(e){let{value:t}=this.state,n=t.value;return n=e?he(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 me=n(5591);const ge=new i.Registry(()=>{const e=[{id:z.$m.Lucene,name:"Lucene",description:"Values are lucene escaped and multi-valued variables generate an OR expression",formatter:e=>{if("string"==typeof e)return ve(e);if(Array.isArray(e)){if(0===e.length)return"__empty__";return"("+(0,k.map)(e,e=>'"'+ve(e)+'"').join(" OR ")+")"}return ve(`${e}`)}},{id:z.$m.Raw,name:"raw",description:(0,me.t)("grafana-scenes.variables.format-registry.formats.description.keep-value-as-is","Keep value as is"),formatter:e=>String(e)},{id:z.$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:z.$m.Pipe,name:"Pipe",description:(0,me.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:z.$m.Distributed,name:"Distributed",description:(0,me.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,k.map)(e,(e,t)=>0!==t?n.state.name+"="+e:e),e.join(",")):`${e}`},{id:z.$m.CSV,name:"Csv",description:(0,me.t)("grafana-scenes.variables.format-registry.formats.description.commaseparated-values","Comma-separated values"),formatter:e=>"string"==typeof e?e:(0,k.isArray)(e)?e.join(","):String(e)},{id:z.$m.HTML,name:"HTML",description:(0,me.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,k.isArray)(e)?i.textUtil.escapeHtml(e.join(", ")):i.textUtil.escapeHtml(String(e))},{id:z.$m.JSON,name:"JSON",description:(0,me.t)("grafana-scenes.variables.format-registry.formats.description.json-stringify-value","JSON stringify value"),formatter:e=>"string"==typeof e?e:JSON.stringify(e)},{id:z.$m.PercentEncode,name:"Percent encode",description:(0,me.t)("grafana-scenes.variables.format-registry.formats.description.useful-for-url-escaping-values","Useful for URL escaping values"),formatter:e=>(0,k.isArray)(e)?be("{"+e.join(",")+"}"):be(e)},{id:z.$m.SingleQuote,name:"Single quote",description:(0,me.t)("grafana-scenes.variables.format-registry.formats.description.single-quoted-values","Single quoted values"),formatter:e=>{const t=new RegExp("'","g");if((0,k.isArray)(e))return(0,k.map)(e,e=>`'${(0,k.replace)(e,t,"\\'")}'`).join(",");let n="string"==typeof e?e:String(e);return`'${(0,k.replace)(n,t,"\\'")}'`}},{id:z.$m.DoubleQuote,name:"Double quote",description:(0,me.t)("grafana-scenes.variables.format-registry.formats.description.double-quoted-values","Double quoted values"),formatter:e=>{const t=new RegExp('"',"g");if((0,k.isArray)(e))return(0,k.map)(e,e=>`"${(0,k.replace)(e,t,'\\"')}"`).join(",");let n="string"==typeof e?e:String(e);return`"${(0,k.replace)(n,t,'\\"')}"`}},{id:z.$m.SQLString,name:"SQL string",description:"SQL string quoting and commas for use in IN statements and other scenarios",formatter:_e},{id:"join",name:"Join",description:"Join values with a comma",formatter:(e,t)=>{var n;if((0,k.isArray)(e)){const r=null!=(n=t[0])?n:",";return e.join(r)}return String(e)}},{id:z.$m.Date,name:"Date",description:(0,me.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:z.$m.Glob,name:"Glob",description:(0,me.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,k.isArray)(e)&&e.length>1?"{"+e.join(",")+"}":String(e)},{id:z.$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:z.$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=>Se(n.state.name,e)).join("&"):Se(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=be(t[0]||n.state.name),a=be(t[1]||"");return Array.isArray(e)?e.map(e=>xe(r,e,a)).join("&"):xe(r,e,a)}},{id:z.$m.UriEncode,name:"Percent encode as URI",description:(0,me.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,k.isArray)(e)?ye("{"+e.join(",")+"}"):ye(e)}];return e});function ve(e){return!1===isNaN(+e)?e:e.replace(/([\!\*\+\-\=<>\s\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g,"\\$1")}function be(e){return"object"==typeof e&&(e=String(e)),we(encodeURIComponent(e))}const ye=e=>we(encodeURI(String(e))),we=e=>e.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase());function Se(e,t){return`var-${e}=${be(t)}`}function xe(e,t,n=""){return`${e}=${n}${be(t)}`}const Ee={"'":"''",'"':'\\"'};function _e(e){const t=new RegExp("'|\"","g");if((0,k.isArray)(e))return(0,k.map)(e,e=>`'${(0,k.replace)(e,t,e=>{var t;return null!=(t=Ee[e])?t:""})}'`).join(",");let n="string"==typeof e?e:String(e);return`'${(0,k.replace)(n,t,e=>{var t;return null!=(t=Ee[e])?t:""})}'`}const Ce="All",ke="$__all",Re="$__auto",Oe=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,Ae="__searchFilter",De="__scopes";class Ie{constructor(e){this._value=e}formatter(){return this._value}}class Te{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=le(this._sceneObject);return"__from"===this.state.name?e.state.value.from.valueOf():e.state.value.to.valueOf()}getValueText(){const e=le(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 Pe{constructor(e,t,n){this.state={name:e,type:"time_macro",match:n},this._sceneObject=t}getValue(){var e;const t=Ll(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 Le(e,t){e.setState(t)}function Me(){return o.useLocationService?(0,o.useLocationService)():o.locationService}function Ve(e){let t=e;do{if("repeatSourceKey"in t.state&&t.state.repeatSourceKey)return!0;t=t.parent}while(t);return!1}class Ne extends E{constructor(){super(...arguments),this._urlSync=new $e(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,k.isEqual)(e,r))&&this.publishEvent(new ue(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=ke,r.text=Ce):this.state.isMulti?(r.value=[],r.text=[]):(r.value="",r.text=""),r;if(this.hasAllValue())return this.state.includeAll?r.text=Ce:(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,k.isEqual)(a,t)||(r.value=a),(0,k.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===ke&&this.state.text===Ce;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 Fe(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()?Ce:Array.isArray(this.state.text)?this.state.text.join(" + "):String(this.state.text)}hasAllValue(){const e=this.state.value;return e===ke||Array.isArray(e)&&e[0]===ke}getDefaultMultiState(e){return this.state.defaultToAll?{value:[ke],text:[Ce]}:e.length>0?{value:[e[0].value],text:[e[0].label]}:{value:[],text:[]}}getDefaultSingleState(e){return this.state.defaultToAll?{value:ke,text:Ce}: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]===ke?(e=[ke],t=[Ce]):e[0]===ke&&e.length>1&&(e.shift(),Array.isArray(t)&&t.shift())}if((0,k.isEqual)(e,this.state.value)&&(0,k.isEqual)(t,this.state.text))return;const i=()=>this.setStateHelper({value:e,text:t,loading:!1});if(n){const e=j(this);null==e||e.startProfile(te),null==(a=(r=this._urlSync).performBrowserHistoryAction)||a.call(r,i)}else i();this.publishEvent(new ue(this),!0)}findLabelTextForValue(e){if(e===ke)return Ce;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){Le(this,e)}getOptionsForSelect(e=!0){let t=this.state.options;if(this.state.includeAll&&(t=[{value:ke,label:Ce},...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 $e{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,k.isArray)(e)&&e[0]===Ce)return[ke];if(e===Ce)return ke;return e}(t)),this._sceneObject.state.allValue&&this._sceneObject.state.allValue===t&&(t=ke),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 Fe{constructor(e,t){this._value=e,this._variable=t}formatter(e){return e===z.$m.Text?Ce:e===z.$m.PercentEncode?ge.get(z.$m.PercentEncode).formatter(this._value,[],this._variable):e===z.$m.QueryParam?ge.get(z.$m.QueryParam).formatter(Ce,[],this._variable):this._value}}function je(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&&je(e.parent,t),t}const ze=(0,i.getDisplayProcessor)();class Be{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 Ue=new Map([[i.DataLinkBuiltInVars.includeVars,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){const e=je(this._sceneObject),t=ge.get(z.$m.QueryParam),n=[];for(const r of Object.keys(e)){const a=e[r];if(a instanceof Ne&&a.hasAllValue()&&!a.state.allValue){n.push(t.formatter(ke,[],a));continue}const i=a.getValue();i&&(ce(i)?n.push(i.formatter(z.$m.QueryParam)):n.push(t.formatter(i,[],a)))}return new Ie(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=le(this._sceneObject).urlSync)?void 0:e.getUrlState();return new Ie(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:ze)(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=he(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=he(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 Be(n.search);case"path":return r+n.pathname;default:return r+n.pathname+n.search}}getValueText(){return""}}],["__from",Te],["__to",Te],["__timezone",class{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=le(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",Pe],["__interval_ms",Pe]]);function We(e,t,n,r,a){return t&&"string"==typeof t?(Oe.lastIndex=0,t.replace(Oe,(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 de?(de.state.name=e,de.state.value=t):de=new fe(e,t),de}(e,t)}const a=N(e,r);if(a)return a;const i=Ue.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(ce(n))return We(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=z.$m.Glob;let i=ge.getIfExists(r);i||(console.error(`Variable format ${r} not found. Using glob format as fallback.`),i=ge.get(z.$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 He(e){return void 0!==e.useState}function qe(e){return"enrichDataRequest"in e}function Ge(e){return"isDataLayer"in e}function Qe(e="op"){if("undefined"!=typeof crypto&&crypto.randomUUID){return`${e}-${crypto.randomUUID()}`}return`${e}-${Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}`}const Ke=class e{constructor(){this.observers=[]}static getInstance(){return e.instance||(e.instance=new e),e.instance}addObserver(e){return this.observers.push(e),()=>{const t=this.observers.indexOf(e);t>-1&&this.observers.splice(t,1)}}clearObservers(){this.observers=[]}getObserverCount(){return this.observers.length}notifyObservers(e,t,n){this.observers.forEach(r=>{try{const n=r[e];null==n||n(t)}catch(e){console.warn(`Error in ${n} observer:`,e)}})}notifyDashboardInteractionStart(e){this.notifyObservers("onDashboardInteractionStart",e,"dashboard interaction start")}notifyDashboardInteractionMilestone(e){this.notifyObservers("onDashboardInteractionMilestone",e,"dashboard interaction milestone")}notifyDashboardInteractionComplete(e){this.notifyObservers("onDashboardInteractionComplete",e,"dashboard interaction complete")}notifyPanelOperationStart(e){this.notifyObservers("onPanelOperationStart",e,"panel operation start")}notifyPanelOperationComplete(e){this.notifyObservers("onPanelOperationComplete",e,"panel operation complete")}notifyQueryStart(e){this.notifyObservers("onQueryStart",e,"query start")}notifyQueryComplete(e){this.notifyObservers("onQueryComplete",e,"query complete")}};Ke.instance=null;let Ye=Ke;function Xe(){return Ye.getInstance()}function Ze(e,t){return n=>{const r=Fl.getQueryController(e.origin);return r?new h.Observable(a=>{var i;e.cancel||(e.cancel=()=>a.complete());const o=(null==(i=e.request)?void 0:i.requestId)||`${e.type}-${Math.floor(performance.now()).toString(36)}`,s=performance.now();let l=null;if(t)l=t.onQueryStarted(s,e,o);else{const t=Qe("query");Xe().notifyQueryStart({operationId:t,queryId:o,queryType:e.type,origin:e.origin.constructor.name,timestamp:s}),l=(n,r)=>{Xe().notifyQueryComplete({operationId:t,queryId:o,queryType:e.type,origin:e.origin.constructor.name,timestamp:n,duration:n-s,error:r?(null==r?void 0:r.message)||String(r)||"Unknown error":void 0})}}r.queryStarted(e);let u=!1;const c=n.subscribe({next:t=>{u||t.state===B.Loading||(u=!0,r.queryCompleted(e),null==l||l(performance.now())),a.next(t)},error:t=>{u||(u=!0,r.queryCompleted(e),null==l||l(performance.now(),t)),a.error(t)},complete:()=>{a.complete()}});return()=>{c.unsubscribe(),u||(r.queryCompleted(e),null==l||l(performance.now()))}}):n}}function Je(e){return new h.Observable(t=>{t.next({state:B.Loading});(0,h.from)(e).pipe((0,h.map)(()=>({state:B.Done})),(0,h.catchError)(()=>(t.next({state:B.Error}),[]))).subscribe({next:e=>t.next(e),complete:()=>t.complete()})})}async function et(e,t){var n;if(null==e?void 0:e.uid){const t=A.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=Fl.getQueryController(t.__sceneObject.value.valueOf());a&&a.state.enableProfiling&&Je(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 tt{constructor(){this._values=new Map}recordCurrentDependencyValuesForSceneObject(e){if(this.clearValues(),e.variableDependency)for(const t of e.variableDependency.getNames()){const n=Fl.lookupVariable(t,e);n&&this._values.set(n.state.name,n.getValue())}}cloneAndRecordCurrentValuesForSceneObject(e){const t=new tt;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(!Ys(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=Fl.lookupVariable(t,e);if(!n)continue;const r=n.state.name;if(n&&this._values.has(r)){if(!Ys(this._values.get(r),n.getValue()))return!0}}return!1}}function nt(e){return"object"==typeof e&&"getExtraQueries"in e}const rt=(e,t)=>(0,h.of)(t),at=0;function it(e){const t=e.getRoot();return qe(t)?t.enrichDataRequest(e):null}const ot=new Set;var st=n(2007),lt=n(1559);function ut(e,t="latest"){return ct(e,t.replace(/\-.*/,""))}function ct(e,t){const n={};for(const[r,a]of Object.entries(e))dt(a)?n[r]=ct(a,t):(ht(a,r),n[r]=pt(a,t));return n}function dt(e){if("object"==typeof e){const[t]=Object.keys(e);return!(0,lt.valid)(t)}return!1}function pt(e,t){let n,r=Object.keys(e).sort(lt.compare);if("latest"===t)return e[r[r.length-1]];for(const e of r)(0,lt.gte)(t,e)&&(n=e);return n||(n=r[r.length-1]),e[n]}function ht(e,t){if(!Object.keys(e).every(e=>(0,lt.valid)(e)))throw new Error(`Invalid semver version: '${t}'`)}const ft="8.5.0",mt={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:{[ft]:"data-testid TimePicker Open Button"},overlayContent:{"10.2.3":"data-testid TimePicker Overlay Content"},fromField:{"10.2.3":"data-testid Time Range from field",[ft]:"Time Range from field"},toField:{"10.2.3":"data-testid Time Range to field",[ft]:"Time Range to field"},applyTimeRange:{[ft]:"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",[ft]:"Time Range calendar"},openButton:{"10.2.3":"data-testid Open time range calendar",[ft]:"Open time range calendar"},closeButton:{"10.2.3":"data-testid Close time range Calendar",[ft]:"Close time range Calendar"}},absoluteTimeRangeTitle:{[ft]:"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:{[ft]:"Test Data Query scenario select container"},scenarioSelect:{[ft]:"Test Data Query scenario select"},max:{[ft]:"TestData max"},min:{[ft]:"TestData min"},noise:{[ft]:"TestData noise"},seriesCount:{[ft]:"TestData series count"},spread:{[ft]:"TestData spread"},startValue:{[ft]:"TestData start value"},drop:{[ft]:"TestData drop values"}}},DataSourceHttpSettings:{urlInput:{"10.4.0":"data-testid Datasource HTTP settings url",[ft]:"Datasource HTTP settings url"}},Jaeger:{traceIDInput:{[ft]:"Trace ID"}},Prometheus:{configPage:{connectionSettings:{[ft]:"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",[ft]:"Add exemplar config button"},internalLinkSwitch:{"10.3.0":"data-testid Internal link switch",[ft]:"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",[ft]:"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:{[ft]:e=>`${e} menu`},MenuGroup:{[ft]:e=>`${e} menu group`},MenuItem:{[ft]:e=>`${e} menu item`},SubMenu:{container:{"10.3.0":"data-testid SubMenu container",[ft]:"SubMenu container"},icon:{"10.3.0":"data-testid SubMenu icon",[ft]:"SubMenu icon"}}},Panels:{Panel:{title:{[ft]: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:{[ft]:e=>`${e} panel`},headerCornerInfo:{[ft]:e=>`Panel header ${e}`},status:{"10.2.0":e=>`data-testid Panel status ${e}`,[ft]:e=>"Panel status"},loadingBar:{"10.0.0":()=>"Panel loading bar"},HoverWidget:{container:{"10.1.0":"data-testid hover-header-container",[ft]:"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:{[ft]:"Legend section"}},Legend:{legendItemAlias:{[ft]:e=>`gpl alias ${e}`},showLegendSwitch:{[ft]:"gpl show legend"}},xAxis:{labels:{[ft]:()=>"div.flot-x-axis > div.flot-tick-label"}}},BarGauge:{valueV2:{[ft]:"data-testid Bar gauge value"}},PieChart:{svgSlice:{"10.3.0":"data testid Pie Chart Slice"}},Text:{container:{[ft]:()=>".markdown-html"}},Table:{header:{[ft]:"table header"},footer:{[ft]:"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:{[ft]:e=>`Drawer title ${e}`},expand:{[ft]:"Drawer expand"},contract:{[ft]:"Drawer contract"},close:{"10.3.0":"data-testid Drawer close",[ft]:"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",[ft]:"Panel editor option pane content"},select:{[ft]:"Panel editor option pane select"},fieldLabel:{[ft]: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",[ft]:"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",[ft]:"toggle-viz-options"},toggleTableView:{"11.1.0":"data-testid toggle-table-view",[ft]:"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:{[ft]:"Panel inspector Data content"}},Stats:{content:{[ft]:"Panel inspector Stats content"}},Json:{content:{"11.1.0":"data-testid Panel inspector Json content",[ft]:"Panel inspector Json content"}},Query:{content:{[ft]:"Panel inspector Query content"},refreshButton:{[ft]:"Panel inspector Query refresh button"},jsonObjectKeys:{[ft]:()=>".json-formatter-key"}}},Tab:{title:{"11.2.0":e=>`data-testid Tab ${e}`},active:{[ft]:()=>'[class*="-activeTabStyle"]'}},RefreshPicker:{runButtonV2:{[ft]:"data-testid RefreshPicker run button"},intervalButtonV2:{[ft]:"data-testid RefreshPicker interval button"}},QueryTab:{content:{[ft]:"Query editor tab content"},queryInspectorButton:{[ft]:"Query inspector button"},queryHistoryButton:{"10.2.0":"data-testid query-history-button",[ft]:"query-history-button"},addQuery:{"10.2.0":"data-testid query-tab-add-query",[ft]:"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:{[ft]:"Query editor row"}},QueryEditorRow:{actionButton:{"10.4.0":e=>`data-testid ${e}`},title:{[ft]:e=>`Query editor row title ${e}`},container:{[ft]:e=>`Query editor row ${e}`}},AlertTab:{content:{"10.2.3":"data-testid Alert editor tab content",[ft]:"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:{[ft]:e=>`data-testid Alert ${e}`}},TransformTab:{content:{"10.1.0":"data-testid Transform editor tab content",[ft]:"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",[ft]:"Transform mode label"},calculationsLabel:{"10.2.3":"data-testid Transform calculations label",[ft]:"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",[ft]:"search transformations"},noTransformationsMessage:{"10.2.3":"data-testid no transformations message"},addTransformationButton:{"10.1.0":"data-testid add transformation button",[ft]:"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",[ft]:"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:{[ft]:()=>".page-toolbar"},item:{[ft]:e=>`${e}`},itemButton:{"9.5.0":e=>`data-testid ${e}`}},QueryEditorToolbarItem:{button:{[ft]:e=>`QueryEditor toolbar item button ${e}`}},BackButton:{backArrow:{"10.3.0":"data-testid Go Back",[ft]:"Go Back"}},OptionsGroup:{group:{"11.1.0":e=>e?`data-testid Options group ${e}`:"data-testid Options group",[ft]:e=>e?`Options group ${e}`:"Options group"},toggle:{"11.1.0":e=>e?`data-testid Options group ${e} toggle`:"data-testid Options group toggle",[ft]:e=>e?`Options group ${e} toggle`:"Options group toggle"}},PluginVisualization:{item:{[ft]:e=>`Plugin visualization item ${e}`},current:{[ft]:()=>'[class*="-currentVisualizationItem"]'}},Select:{menu:{"11.5.0":"data-testid Select menu",[ft]:"Select options menu"},option:{"11.1.0":"data-testid Select option",[ft]:"Select option"},toggleAllOptions:{"11.3.0":"data-testid toggle all options"},input:{[ft]:()=>'input[id*="time-options-input"]'},singleValue:{[ft]:()=>'div[class*="-singleValue"]'}},FieldConfigEditor:{content:{[ft]:"Field config editor content"}},OverridesConfigEditor:{content:{[ft]:"Field overrides editor content"}},FolderPicker:{containerV2:{[ft]:"data-testid Folder picker select container"},input:{"10.4.0":"data-testid folder-picker-input"}},ReadonlyFolderPicker:{container:{[ft]:"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",[ft]:"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:{[ft]:"data-testid Time zone picker select container"},changeTimeSettingsButton:{"11.0.0":"data-testid Time zone picker Change time settings button"}},WeekStartPicker:{containerV2:{[ft]:"data-testid Choose starting day of the week"},placeholder:{[ft]:"Choose starting day of the week"}},TraceViewer:{spanBar:{"9.0.0":"data-testid SpanBar--wrapper"}},QueryField:{container:{"10.3.0":"data-testid Query field",[ft]:"Query field"}},QueryBuilder:{queryPatterns:{"10.3.0":"data-testid Query patterns",[ft]:"Query patterns"},labelSelect:{"10.3.0":"data-testid Select label",[ft]:"Select label"},inputSelect:{"11.1.0":"data-testid Select label-input"},valueSelect:{"10.3.0":"data-testid Select value",[ft]:"Select value"},matchOperatorSelect:{"10.3.0":"data-testid Select match operator",[ft]:"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:{[ft]:"data-testid Search section"},itemsV2:{[ft]:"data-testid Search items"},cards:{[ft]:"data-testid Search cards"},collapseFolder:{[ft]:e=>`data-testid Collapse folder ${e}`},expandFolder:{[ft]:e=>`data-testid Expand folder ${e}`},dashboardItem:{[ft]:e=>`data-testid Dashboard search item ${e}`},dashboardCard:{[ft]: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:{[ft]:"data-testid Dashboard search item"}},DashboardLinks:{container:{[ft]:"data-testid Dashboard link container"},dropDown:{[ft]:"data-testid Dashboard link dropdown"},link:{[ft]:"data-testid Dashboard link"}},LoadingIndicator:{icon:{"10.4.0":"data-testid Loading indicator",[ft]:"Loading indicator"}},CallToActionCard:{buttonV2:{[ft]:e=>`data-testid Call to action button ${e}`}},DataLinksContextMenu:{singleLink:{"10.3.0":"data-testid Data link",[ft]:"Data link"}},DataLinksActionsTooltip:{tooltipWrapper:{"12.1.0":"data-testid Data links actions tooltip wrapper"}},CodeEditor:{container:{"10.2.3":"data-testid Code editor container",[ft]:"Code editor container"}},ReactMonacoEditor:{editorLazy:{"11.1.0":"data-testid ReactMonacoEditor editorLazy"}},DashboardImportPage:{textarea:{[ft]:"data-testid-import-dashboard-textarea"},submit:{[ft]:"data-testid-load-dashboard"}},ImportDashboardForm:{name:{[ft]:"data-testid-import-dashboard-title"},submit:{[ft]:"data-testid-import-dashboard-submit"}},PanelAlertTabContent:{content:{"10.2.3":"data-testid Unified alert editor tab content",[ft]:"Unified alert editor tab content"}},VisualizationPreview:{card:{[ft]:e=>`data-testid suggestion-${e}`}},ColorSwatch:{name:{[ft]:"data-testid-colorswatch"}},DashboardRow:{title:{[ft]:e=>`data-testid dashboard-row-title-${e}`},wrapper:{"12.1.0":e=>`data-testid dashboard-row-wrapper-for-${e}`}},UserProfile:{profileSaveButton:{[ft]:"data-testid-user-profile-save"},preferencesSaveButton:{[ft]:"data-testid-shared-prefs-save"},orgsTable:{[ft]:"data-testid-user-orgs-table"},sessionsTable:{[ft]:"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",[ft]:"annotations-type-input"},annotationsChoosePanelInput:{"11.1.0":"data-testid choose-panels-input",[ft]:"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"}}}}},gt={pages:ut({Alerting:{AddAlertRule:{url:{"10.1.0":"/alerting/new/alerting",[ft]:"/alerting/new"}},EditAlertRule:{url:{[ft]:e=>`alerting/${e}/edit`}}},Login:{url:{[ft]:"/login"},username:{"10.2.3":"data-testid Username input field",[ft]:"Username input field"},password:{"10.2.3":"data-testid Password input field",[ft]:"Password input field"},submit:{"10.2.3":"data-testid Login button",[ft]:"Login button"},skip:{"10.2.3":"data-testid Skip change password button"}},PasswordlessLogin:{url:{[ft]:"/login/passwordless/authenticate"},email:{"10.2.3":"data-testid Email input field",[ft]:"Email input field"},submit:{"10.2.3":"data-testid PasswordlessLogin button",[ft]:"PasswordlessLogin button"}},Home:{url:{[ft]:"/"}},DataSource:{name:{"10.3.0":"data-testid Data source settings page name input field",[ft]:"Data source settings page name input field"},delete:{[ft]:"Data source settings page Delete button"},readOnly:{"10.3.0":"data-testid Data source settings page read only message",[ft]:"Data source settings page read only message"},saveAndTest:{"10.0.0":"data-testid Data source settings page Save and Test button",[ft]:"Data source settings page Save and Test button"},alert:{"10.3.0":"data-testid Data source settings page Alert",[ft]:"Data source settings page Alert"}},DataSources:{url:{[ft]:"/datasources"},dataSources:{[ft]: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:{[ft]:"/datasources/new"},dataSourcePluginsV2:{"9.3.1":e=>`Add new data source ${e}`,[ft]:e=>`Data source plugin item ${e}`}},ConfirmModal:{delete:{"10.0.0":"data-testid Confirm Modal Danger Button",[ft]:"Confirm Modal Danger Button"},input:{"12.2.0":"data-testid Confirm Modal Input"}},SecretsManagement:{SecretForm:{"12.2.0":"data-testid Secret Form"}},AddDashboard:{url:{[ft]:"/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",[ft]:"Add new panel"},itemButtonAddViz:{[ft]:"Add new visualization menu item"},addNewRow:{"11.1.0":"data-testid Add new row",[ft]:"Add new row"},addNewPanelLibrary:{"11.1.0":"data-testid Add new panel from panel library",[ft]:"Add new panel from panel library"},Settings:{Annotations:{List:{url:{[ft]:"/dashboard/new?orgId=1&editview=annotations"}},Edit:{url:{[ft]:e=>`/dashboard/new?editview=annotations&editIndex=${e}`}}},Variables:{List:{url:{"11.3.0":"/dashboard/new?orgId=1&editview=variables",[ft]:"/dashboard/new?orgId=1&editview=templating"}},Edit:{url:{"11.3.0":e=>`/dashboard/new?orgId=1&editview=variables&editIndex=${e}`,[ft]:e=>`/dashboard/new?orgId=1&editview=templating&editIndex=${e}`}}}}},ImportDashboard:{url:{[ft]:"/dashboard/import"}},Dashboard:{url:{[ft]:e=>`/d/${e}`},DashNav:{nav:{[ft]:"Dashboard navigation"},navV2:{[ft]:"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:{[ft]:"Dashboard submenu"},submenuItem:{[ft]:"data-testid template variable"},submenuItemLabels:{[ft]:e=>`data-testid Dashboard template variables submenu Label ${e}`},submenuItemValueDropDownValueLinkTexts:{[ft]:e=>`data-testid Dashboard template variables Variable Value DropDown value link text ${e}`},submenuItemValueDropDownDropDown:{[ft]:"Variable options"},submenuItemValueDropDownOptionTexts:{[ft]: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:{[ft]:e=>`Dashboard settings section item ${e}`},saveDashBoard:{[ft]:"Dashboard settings aside actions Save button"},saveAsDashBoard:{[ft]:"Dashboard settings aside actions Save As button"},title:{"11.2.0":"General"}},Annotations:{Edit:{urlParams:{[ft]:e=>`editview=annotations&editIndex=${e}`}},List:{url:{[ft]:e=>`/d/${e}?editview=annotations`},addAnnotationCTAV2:{[ft]:"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",[ft]:"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`,[ft]:e=>`/d/${e}?editview=templating`},addVariableCTAV2:{[ft]:"data-testid Call to action button Add variable"},newButton:{[ft]:"Variable editor New variable button"},table:{[ft]:"Variable editor Table"},tableRowNameFields:{[ft]:e=>`Variable editor Table Name field ${e}`},tableRowDefinitionFields:{"10.1.0":e=>`Variable editor Table Definition field ${e}`},tableRowArrowUpButtons:{[ft]:e=>`Variable editor Table ArrowUp button ${e}`},tableRowArrowDownButtons:{[ft]:e=>`Variable editor Table ArrowDown button ${e}`},tableRowDuplicateButtons:{[ft]:e=>`Variable editor Table Duplicate button ${e}`},tableRowRemoveButtons:{[ft]:e=>`Variable editor Table Remove button ${e}`}},Edit:{urlParams:{"11.3.0":e=>`editview=variables&editIndex=${e}`,[ft]:e=>`editview=templating&editIndex=${e}`},General:{headerLink:{[ft]:"Variable editor Header link"},modeLabelNew:{[ft]:"Variable editor Header mode New"},modeLabelEdit:{[ft]:"Variable editor Header mode Edit"},generalNameInput:{[ft]:"Variable editor Form Name field"},generalNameInputV2:{[ft]:"data-testid Variable editor Form Name field"},generalTypeSelect:{[ft]:"Variable editor Form Type select"},generalTypeSelectV2:{[ft]:"data-testid Variable editor Form Type select"},generalLabelInput:{[ft]:"Variable editor Form Label field"},generalLabelInputV2:{[ft]:"data-testid Variable editor Form Label field"},generalHideSelect:{[ft]:"Variable editor Form Hide select"},generalHideSelectV2:{[ft]:"data-testid Variable editor Form Hide select"},selectionOptionsAllowCustomValueSwitch:{[ft]:"data-testid Variable editor Form Allow Custom Value switch"},selectionOptionsMultiSwitch:{"10.4.0":"data-testid Variable editor Form Multi switch",[ft]:"Variable editor Form Multi switch"},selectionOptionsIncludeAllSwitch:{"10.4.0":"data-testid Variable editor Form IncludeAll switch",[ft]:"Variable editor Form IncludeAll switch"},selectionOptionsCustomAllInput:{"10.4.0":"data-testid Variable editor Form IncludeAll field",[ft]:"Variable editor Form IncludeAll field"},previewOfValuesOption:{"10.4.0":"data-testid Variable editor Preview of Values option",[ft]:"Variable editor Preview of Values option"},submitButton:{"10.4.0":"data-testid Variable editor Run Query button",[ft]:"Variable editor Submit button"},applyButton:{"9.3.0":"data-testid Variable editor Apply button"}},QueryVariable:{closeButton:{[ft]:"data-testid Query Variable editor close button"},editor:{[ft]:"data-testid Query Variable editor"},previewButton:{[ft]:"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",[ft]:"Data source picker select container"},queryOptionsOpenButton:{[ft]:"data-testid Query Variable editor open button"},queryOptionsRefreshSelect:{[ft]:"Variable editor Form Query Refresh select"},queryOptionsRefreshSelectV2:{[ft]:"data-testid Variable editor Form Query Refresh select"},queryOptionsRegExInput:{[ft]:"Variable editor Form Query RegEx field"},queryOptionsRegExInputV2:{[ft]:"data-testid Variable editor Form Query RegEx field"},queryOptionsSortSelect:{[ft]:"Variable editor Form Query Sort select"},queryOptionsSortSelectV2:{[ft]:"data-testid Variable editor Form Query Sort select"},queryOptionsQueryInput:{"10.4.0":"data-testid Variable editor Form Default Variable Query Editor textarea"},queryOptionsStaticOptionsRow:{[ft]:"Variable editor Form Query Static Options row"},queryOptionsStaticOptionsToggle:{[ft]:"Variable editor Form Query Static Options toggle"},queryOptionsStaticOptionsLabelInput:{[ft]:"Variable editor Form Query Static Options Label input"},queryOptionsStaticOptionsValueInput:{[ft]:"Variable editor Form Query Static Options Value input"},queryOptionsStaticOptionsDeleteButton:{[ft]:"Variable editor Form Query Static Options Delete button"},queryOptionsStaticOptionsAddButton:{[ft]:"Variable editor Form Query Static Options Add button"},queryOptionsStaticOptionsOrderDropdown:{[ft]:"Variable editor Form Query Static Options Order dropdown"},valueGroupsTagsEnabledSwitch:{[ft]:"Variable editor Form Query UseTags switch"},valueGroupsTagsTagsQueryInput:{[ft]:"Variable editor Form Query TagsQuery field"},valueGroupsTagsTagsValuesQueryInput:{[ft]:"Variable editor Form Query TagsValuesQuery field"}},ConstantVariable:{constantOptionsQueryInput:{[ft]:"Variable editor Form Constant Query field"},constantOptionsQueryInputV2:{[ft]:"data-testid Variable editor Form Constant Query field"}},DatasourceVariable:{datasourceSelect:{[ft]:"data-testid datasource variable datasource type"},nameFilter:{[ft]:"data-testid datasource variable datasource name filter"}},TextBoxVariable:{textBoxOptionsQueryInput:{[ft]:"Variable editor Form TextBox Query field"},textBoxOptionsQueryInputV2:{[ft]:"data-testid Variable editor Form TextBox Query field"}},CustomVariable:{customValueInput:{[ft]:"data-testid custom-variable-input"}},IntervalVariable:{intervalsValueInput:{[ft]:"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:{[ft]:"/dashboards"},dashboards:{"10.2.0":e=>`Dashboard search item ${e}`},toggleView:{[ft]:"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:{[ft]:"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:{[ft]:"/explore"},General:{container:{[ft]:"data-testid Explore"},graph:{[ft]:"Explore Graph"},table:{[ft]:"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:{[ft]:e=>`/d-solo/${e}`}},PluginsList:{page:{[ft]:"Plugins list page"},list:{[ft]:"Plugins list"},listItem:{[ft]:"Plugins list item"},signatureErrorNotice:{"10.3.0":"data-testid Unsigned plugins notice",[ft]:"Unsigned plugins notice"}},PluginPage:{page:{[ft]:"Plugin page"},signatureInfo:{"10.3.0":"data-testid Plugin signature info",[ft]:"Plugin signature info"},disabledInfo:{"10.3.0":"data-testid Plugin disabled info",[ft]:"Plugin disabled info"}},PlaylistForm:{name:{[ft]:"Playlist name"},interval:{[ft]:"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:{[ft]:e=>`/plugins/${e}`}},MigrateToCloud:{url:{"11.2.0":"/admin/migrate-to-cloud"}}}),components:ut(mt)};var vt=n(6089);const bt=(e,t)=>e>t?1:e<t?-1:0,yt=1/0,wt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),St="eexxaacctt",xt=/\p{P}/gu,Et=["en",{numeric:!0,sensitivity:"base"}],_t=(e,t,n)=>e.replace("A-Z",t).replace("a-z",n),Ct={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:yt,intraChars:"[a-z\\d']",intraIns:null,intraContr:"'[a-z]{1,2}\\b",intraMode:0,intraSlice:[1,yt],intraSub:null,intraTrn:null,intraDel:null,intraFilt:(e,t,n)=>!0,toUpper:e=>e.toLocaleUpperCase(),toLower:e=>e.toLocaleLowerCase(),compare:null,sort:(e,t,n,r=bt)=>{let{idx:a,chars:i,terms:o,interLft2:s,interLft1:l,start:u,intraIns:c,interIns:d,cases:p}=e;return a.map((e,t)=>t).sort((e,n)=>i[n]-i[e]||c[e]-c[n]||o[n]+s[n]+.5*l[n]-(o[e]+s[e]+.5*l[e])||d[e]-d[n]||u[e]-u[n]||p[n]-p[e]||r(t[a[e]],t[a[n]]))}},kt=(e,t)=>0==t?"":1==t?e+"??":t==yt?e+"*?":e+`{0,${t}}?`,Rt="(?:\\b|_)";function Ot(e){e=Object.assign({},Ct,e);let{unicode:t,interLft:n,interRgt:r,intraMode:a,intraSlice:i,intraIns:o,intraSub:s,intraTrn:l,intraDel:u,intraContr:c,intraSplit:d,interSplit:p,intraBound:h,interBound:f,intraChars:m,toUpper:g,toLower:v,compare:b}=e;o??=a,s??=a,l??=a,u??=a,b??="undefined"==typeof Intl?bt:new Intl.Collator(...Et).compare;let y=e.letters??e.alpha;if(null!=y){let e=g(y),t=v(y);p=_t(p,e,t),d=_t(d,e,t),f=_t(f,e,t),h=_t(h,e,t),m=_t(m,e,t),c=_t(c,e,t)}let w=t?"u":"";const S='".+?"',x=new RegExp(S,"gi"+w),E=new RegExp(`(?:\\s+|^)-(?:${m}+|${S})`,"gi"+w);let{intraRules:_}=e;null==_&&(_=e=>{let t=Ct.intraSlice,n=0,r=0,a=0,c=0;if(/[^\d]/.test(e)){let d=e.length;d<=4?d>=3&&(a=Math.min(l,1),4==d&&(n=Math.min(o,1))):(t=i,n=o,r=s,a=l,c=u)}return{intraSlice:t,intraIns:n,intraSub:r,intraTrn:a,intraDel:c}});let C=!!d,k=new RegExp(d,"g"+w),R=new RegExp(p,"g"+w),O=new RegExp("^"+p+"|"+p+"$","g"+w),A=new RegExp(c,"gi"+w);const D=(e,t=!1)=>{let n=[];e=(e=e.replace(x,e=>(n.push(e),St))).replace(O,""),t||(e=v(e)),C&&(e=e.replace(k,e=>e[0]+" "+e[1]));let r=0;return e.split(R).filter(e=>""!=e).map(e=>e===St?n[r++]:e)},I=/[^\d]+|\d+/g,T=(t,i=0,s=!1)=>{let l=D(t);if(0==l.length)return[];let u,c=Array(l.length).fill("");if(l=l.map((e,t)=>e.replace(A,e=>(c[t]=e,""))),1==a)u=l.map((e,t)=>{if('"'===e[0])return wt(e.slice(1,-1));let n="";for(let r of e.matchAll(I)){let e=r[0],{intraSlice:a,intraIns:i,intraSub:o,intraTrn:s,intraDel:l}=_(e);if(i+o+s+l==0)n+=e+c[t];else{let[r,u]=a,d=e.slice(0,r),p=e.slice(u),h=e.slice(r,u);1==i&&1==d.length&&d!=h[0]&&(d+="(?!"+d+")");let f=h.length,g=[e];if(o)for(let e=0;e<f;e++)g.push(d+h.slice(0,e)+m+h.slice(e+1)+p);if(s)for(let e=0;e<f-1;e++)h[e]!=h[e+1]&&g.push(d+h.slice(0,e)+h[e+1]+h[e]+h.slice(e+2)+p);if(l)for(let e=0;e<f;e++)g.push(d+h.slice(0,e+1)+"?"+h.slice(e+1)+p);if(i){let e=kt(m,1);for(let t=0;t<f;t++)g.push(d+h.slice(0,t)+e+h.slice(t)+p)}n+="(?:"+g.join("|")+")"+c[t]}}return n});else{let e=kt(m,o);2==i&&o>0&&(e=")("+e+")("),u=l.map((t,n)=>'"'===t[0]?wt(t.slice(1,-1)):t.split("").map((e,t,n)=>(1==o&&0==t&&n.length>1&&e!=n[t+1]&&(e+="(?!"+e+")"),e)).join(e)+c[n])}let d=2==n?Rt:"",p=2==r?Rt:"",h=p+kt(e.interChars,e.interIns)+d;return i>0?s?u=d+"("+u.join(")"+p+"|"+d+"(")+")"+p:(u="("+u.join(")("+h+")(")+")",u="(.??"+d+")"+u+"("+p+".*)"):(u=u.join(h),u=d+u+p),[new RegExp(u,"i"+w),l,c]},P=(e,t,n)=>{let[r]=T(t);if(null==r)return null;let a=[];if(null!=n)for(let t=0;t<n.length;t++){let i=n[t];r.test(e[i])&&a.push(i)}else for(let t=0;t<e.length;t++)r.test(e[t])&&a.push(t);return a};let L=!!h,M=new RegExp(f,w),V=new RegExp(h,w);const N=(t,a,i)=>{let[o,s,l]=T(i,1),u=D(i,!0),[c]=T(i,2),d=s.length,p=Array(d),h=Array(d);for(let e=0;e<d;e++){let t=s[e],n=u[e],r='"'==t[0]?t.slice(1,-1):t+l[e],a='"'==n[0]?n.slice(1,-1):n+l[e];p[e]=r,h[e]=a}let f=t.length,m=Array(f).fill(0),g={idx:Array(f),start:m.slice(),chars:m.slice(),cases:m.slice(),terms:m.slice(),interIns:m.slice(),intraIns:m.slice(),interLft2:m.slice(),interRgt2:m.slice(),interLft1:m.slice(),interRgt1:m.slice(),ranges:Array(f)},b=1==n||1==r,y=0;for(let i=0;i<t.length;i++){let s=a[t[i]],l=s.match(o),u=l.index+l[1].length,f=u,m=!1,S=0,x=0,E=0,_=0,C=0,k=0,R=0,O=0,A=0,D=[];for(let t=0,a=2;t<d;t++,a+=2){let i=v(l[a]),o=p[t],c=h[t],g=o.length,y=i.length,I=i==o;if(l[a]==c&&R++,!I&&l[a+1].length>=g){let e=v(l[a+1]).indexOf(o);e>-1&&(D.push(f,y,e,g),f+=$(l,a,e,g),i=o,y=g,I=!0,0==t&&(u=f))}if(b||I){let e=f-1,c=f+y,d=!1,p=!1;if(-1==e||M.test(s[e]))I&&S++,d=!0;else{if(2==n){m=!0;break}if(L&&V.test(s[e]+s[e+1]))I&&x++,d=!0;else if(1==n){let e=l[a+1],n=f+y;if(e.length>=g){let r,c=0,p=!1,h=new RegExp(o,"ig"+w);for(;r=h.exec(e);){c=r.index;let e=n+c,t=e-1;if(-1==t||M.test(s[t])){S++,p=!0;break}if(V.test(s[t]+s[e])){x++,p=!0;break}}p&&(d=!0,D.push(f,y,c,g),f+=$(l,a,c,g),i=o,y=g,I=!0,0==t&&(u=f))}if(!d){m=!0;break}}}if(c==s.length||M.test(s[c]))I&&E++,p=!0;else{if(2==r){m=!0;break}if(L&&V.test(s[c-1]+s[c]))I&&_++,p=!0;else if(1==r){m=!0;break}}I&&(C+=g,d&&p&&k++)}if(y>g&&(A+=y-g),t>0&&(O+=l[a-1].length),!e.intraFilt(o,i,f)){m=!0;break}t<d-1&&(f+=y+l[a+1].length)}if(!m){g.idx[y]=t[i],g.interLft2[y]=S,g.interLft1[y]=x,g.interRgt2[y]=E,g.interRgt1[y]=_,g.chars[y]=C,g.terms[y]=k,g.cases[y]=R,g.interIns[y]=O,g.intraIns[y]=A,g.start[y]=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+=$(e,t,i,o),a+=4}else n+=r,t++}n=e.index+e[1].length;let l=g.ranges[y]=[],d=n,p=n;for(let t=2;t<e.length;t++){let r=e[t].length;n+=r,t%2==0?p=n:r>0&&(l.push(d,p),d=p=n)}p>d&&l.push(d,p),y++}}if(y<t.length)for(let e in g)g[e]=g[e].slice(0,y);return g},$=(e,t,n,r)=>{let a=e[t]+e[t+1].slice(0,n);return e[t-1]+=a,e[t]=e[t+1].slice(n,n+r),e[t+1]=e[t+1].slice(n+r),a.length};return{search:(...t)=>{let n=((t,n,r,a=1e3,i)=>{r=r?!0===r?5:r:0;let o=null,s=null,l=[];n=n.replace(E,e=>{let t=e.trim().slice(1);return t='"'===t[0]?wt(t.slice(1,-1)):t.replace(xt,""),""!=t&&l.push(t),""});let u,c=D(n);if(l.length>0){if(u=new RegExp(l.join("|"),"i"+w),0==c.length){let e=[];for(let n=0;n<t.length;n++)u.test(t[n])||e.push(n);return[e,null,null]}}else if(0==c.length)return[null,null,null];if(r>0){let e=D(n);if(e.length>1){let n=e.slice().sort((e,t)=>t.length-e.length);for(let e=0;e<n.length;e++){if(0==i?.length)return[[],null,null];i=P(t,n[e],i)}if(e.length>r)return[i,null,null];o=Dt(e).map(e=>e.join(" ")),s=[];let a=new Set;for(let e=0;e<o.length;e++)if(a.size<i.length){let n=i.filter(e=>!a.has(e)),r=P(t,o[e],n);for(let e=0;e<r.length;e++)a.add(r[e]);s.push(r)}else s.push([])}}null==o&&(o=[n],s=[i?.length>0?i:P(t,n)]);let d=null,p=null;if(l.length>0&&(s=s.map(e=>e.filter(e=>!u.test(t[e])))),s.reduce((e,t)=>e+t.length,0)<=a){d={},p=[];for(let n=0;n<s.length;n++){let r=s[n];if(null==r||0==r.length)continue;let a=o[n],i=N(r,t,a),l=e.sort(i,t,a,b);if(n>0)for(let e=0;e<l.length;e++)l[e]+=p.length;for(let e in i)d[e]=(d[e]??[]).concat(i[e]);p=p.concat(l)}}return[[].concat(...s),d,p]})(...t);return n},split:D,filter:P,info:N,sort:e.sort}}const At=(()=>{let e={A:"ÁÀÃÂÄĄĂÅ",a:"áàãâäąăå",E:"ÉÈÊËĖĚ",e:"éèêëęě",I:"ÍÌÎÏĮİ",i:"íìîïįı",O:"ÓÒÔÕÖ",o:"óòôõö",U:"ÚÙÛÜŪŲŮŰ",u:"úùûüūųůű",C:"ÇČĆ",c:"çčć",D:"Ď",d:"ď",G:"Ğ",g:"ğ",L:"Ł",l:"ł",N:"ÑŃŇ",n:"ñńň",S:"ŠŚȘŞ",s:"šśșş",T:"ŢȚŤ",t:"ţțť",Y:"Ý",y:"ý",Z:"ŻŹŽ",z:"żźž"},t={},n="";for(let r in e)e[r].split("").forEach(e=>{n+=e,t[e]=r});let r=new RegExp(`[${n}]`,"g"),a=e=>t[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 Dt(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 It=(e,t)=>t?`<mark>${e}</mark>`:e,Tt=(e,t)=>e+t;Ot.latinize=At,Ot.permute=e=>Dt([...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])),Ot.highlight=function(e,t,n=It,r="",a=Tt){r=a(r,n(e.substring(0,t[0]),!1))??r;for(let i=0;i<t.length;i+=2){let o=t[i],s=t[i+1];r=a(r,n(e.substring(o,s),!0))??r,i<t.length-3&&(r=a(r,n(e.substring(t[i+1],t[i+2]),!1))??r)}return r=a(r,n(e.substring(t[t.length-1]),!1))??r};const Pt=/[^ -~]/m,Lt=/^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+$/m,Mt=5,Vt=25,Nt=5,$t=1e4,Ft=new Ot({intraMode:1});function jt(e,t,n){let r=[];if(""===n)r=e;else if(Pt.test(n)||Lt.test(n)||n.length>Vt||Ft.split(n).length>Nt)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,Mt,$t);(null==a?void 0:a.length)&&(r=i&&o?o.map(t=>e[i.idx[t]]):a.map(t=>e[t]))}return r}function zt(e,t=!1){let n=e;t&&(n=[{value:ke,label:Ce},...n]);const r=n.map(e=>e.label);return e=>jt(n,r,e)}const Bt=()=>!0,Ut=e=>"$__all"!==e.value,Wt=(e,t)=>e.length===t.filter(Ut).length?st.ToggleAllState.allSelected:0===e.length||1===e.length&&e[0]&&"$__all"===e[0].value?st.ToggleAllState.noneSelected:st.ToggleAllState.indeterminate;function Ht({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=Fl.getQueryController(e),v=(0,c.useMemo)(()=>zt(i,o),[i,o])(u);return p().createElement(st.Select,{id:a,isValidNewOption:e=>e.trim().length>0,placeholder:(0,me.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:Bt,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":gt.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${n}`),onChange:t=>{e.changeValueTo(t.value,t.label,!0),null==g||g.startProfile(te),h!==t.__isNew__&&f(t.__isNew__)}})}function qt({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,k.isArray)(n)?n:[n],[n]),[h,f]=(0,c.useState)(d),[m,g]=(0,c.useState)(""),v=(0,c.useMemo)(()=>zt(r,s),[r,s]);(0,c.useEffect)(()=>{f(d)},[d]);const b=r.length>0?"Select value":"",y=v(m);return p().createElement(st.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:Ut,determineToggleAllState:Wt},options:y,closeMenuOnSelect:!1,components:{Option:Gt},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:Bt,"data-testid":gt.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${h}`),onChange:(t,n)=>{"clear"===n.action&&o&&e.changeValueTo([],void 0,!0),f(t.map(e=>e.value))}})}const Gt=({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,st.useTheme2)(),f=(0,st.getSelectStyles)(h),m=(0,st.useStyles2)(Qt);return p().createElement("div",{ref:r,className:(0,vt.cx)(f.option,a&&f.optionFocused),...d,"data-testid":"data-testid Select option",title:t.title},p().createElement("div",{className:m.checkbox},p().createElement(st.Checkbox,{indeterminate:o,value:i})),p().createElement("div",{className:f.optionBody,"data-testid":gt.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(null!=(l=t.label)?l:String(t.value))},p().createElement("span",null,e)))};Gt.displayName="SelectMenuOptions";const Qt=e=>({checkbox:(0,vt.css)({marginRight:e.spacing(2)})});function Kt({model:e}){const t=e.useState();return t.isMulti?p().createElement(qt,{model:e,state:t}):p().createElement(Ht,{model:e,state:t})}class Yt{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?[""]:Xt(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(ol(n)),e.texts.push(ol(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 Xt(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),sl(e,r)})}function Zt(e){const t=e.getRoot();return"enrichFiltersRequest"in t?t.enrichFiltersRequest(e):null}var Jt,en=e=>{throw TypeError(e)},tn=(e,t,n)=>t.has(e)||en("Cannot "+n);class nn{constructor(e){((e,t,n)=>{t.has(e)?en("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n)})(this,Jt),this.text="__sceneObject",this.valueOf=()=>{return tn(e=this,t=Jt,"read from private field"),n?n.call(e):t.get(e);var e,t,n},((e,t,n)=>{tn(e,t,"write to private field"),t.set(e,n)})(this,Jt,e)}toString(){}get value(){return this}}function rn(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 nn(e):{value:e,text:"__sceneObject"}}function an(e){const{model:t}=e,n=(0,st.useTheme2)(),r=on(n),a=(0,st.getInputStyles)({theme:n,invalid:!1}),i=(0,k.isArray)(t.state.value)?t.state.value:t.state.value?[t.state.value]:[];let o=[];return i&&i.length&&o.push(p().createElement(st.IconButton,{"aria-label":(0,me.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(st.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,me.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(st.Tooltip,{key:"tooltip",content:(0,me.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(st.Icon,{name:"info-circle",size:"md"}))),p().createElement("div",{onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},className:(0,vt.cx)(a.suffix,(0,vt.css)({position:"relative"}))},o)}Jt=new WeakMap;const on=e=>({clearIcon:(0,vt.css)({color:e.colors.action.disabledText,cursor:"pointer","&:hover:before":{backgroundColor:"transparent"},"&:hover":{color:e.colors.text.primary}})}),sn=({keysApplicability:e,children:t})=>{var n,r;const a=(0,st.useTheme2)(),i=(0,st.getSelectStyles)(a),{disabledPill:o,strikethrough:s}=dl(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,vt.cx)(i.multiValueContainer,!u&&(0,vt.cx)(o,s))},t)};function ln(e){return"isInteractionTracker"in e}function un(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(ln(e))return e;t=t.parent}}class cn extends Ne{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 Yt(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(ll(null!=(r=null==a?void 0:a.values)?r:[]));if(!e.getTagKeys)return[];const i=nl(this),o=this.state.baseFilters||[],s=Fl.getTimeRange(this).state.value,l=await e.getTagKeys({filters:o,queries:i,timeRange:s,scopes:Fl.getScopes(this),...Zt(this)});ul(l)&&this.setState({error:l.error.message});let u=ll(l);a&&(u=u.concat(ll(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(()=>(ot.add(this),()=>ot.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)(et(this.state.datasource,{__sceneObject:rn(this)})).pipe((0,h.mergeMap)(e=>(0,h.from)(this._getKeys(e)).pipe((0,h.tap)(e=>{ul(e)&&this.setState({error:e.error.message})}),(0,h.map)(e=>ll(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,k.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 et(this.state.datasource,{__sceneObject:rn(this)});if(!e.getDrilldownsApplicability)return;const t=nl(this),n=Fl.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:Fl.getScopes(this),...Zt(this)});(0,k.isEqual)(a,this.state.keysApplicability)||(this.setState({keysApplicability:null!=a?a:void 0}),this.publishEvent(new ue(this),!0))}checkIfRestorable(e){var t,n,r,a;const i=(0,k.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,k.isArray)(e)?e:[e];return o.length!==i.length||!(0,k.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:[]}}}cn.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,k.isArray)(t)?t:[t],r=(0,k.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)(()=>zt(s,l),[s,l]),C=void 0!==d;(0,c.useEffect)(()=>{E(m)},[m]);const R=(t,{action:n})=>"input-change"===n?(S(t),e.onSearchChange&&e.onSearchChange(t),t):"input-blur"===n?(S(""),""):w,O=(0,c.useMemo)(()=>cl(_(w).map(pn)),[_,w]);return a?p().createElement(st.MultiSelect,{"aria-label":(0,me.t)("grafana-scenes.variables.group-by-variable-renderer.aria-label-group-by-selector","Group by selector"),"data-testid":`GroupBySelect-${r}`,id:r,placeholder:(0,me.t)("grafana-scenes.variables.group-by-variable-renderer.placeholder-group-by-label","Group by label"),width:"auto",allowCustomValue:u,inputValue:w,value:x,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,options:O,filterOption:dn,closeMenuOnSelect:!1,isOpen:b,isClearable:!0,hideSelectedOptions:!1,isLoading:g,components:{Option:Gt,...C?{IndicatorsContainer:()=>p().createElement(an,{model:e})}:{},MultiValueContainer:({innerProps:e,children:t})=>p().createElement(sn,{innerProps:e,keysApplicability:f},t)},onInputChange:R,onBlur:()=>{e.changeValueTo(x.map(e=>e.value),x.map(e=>e.label),!0);const t=e.checkIfRestorable(x.map(e=>e.value));t!==e.state.restorable&&e.setState({restorable:t}),e._verifyApplicability()},onChange:(t,n)=>{"clear"===n.action&&o&&e.changeValueTo([],void 0,!0),E(t)},onOpenMenu:async()=>{const t=un(e);null==t||t.startInteraction(ne),v(!0),await(0,h.lastValueFrom)(e.validateAndUpdate()),v(!1),y(!0),null==t||t.stopInteraction()},onCloseMenu:()=>{y(!1)}}):p().createElement(st.Select,{"aria-label":(0,me.t)("grafana-scenes.variables.group-by-variable-renderer.aria-label-group-by-selector","Group by selector"),"data-testid":`GroupBySelect-${r}`,id:r,placeholder:(0,me.t)("grafana-scenes.variables.group-by-variable-renderer.placeholder-group-by-label","Group by label"),width:"auto",inputValue:w,value:x&&x.length>0?x:null,allowCustomValue:u,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,options:O,filterOption:dn,closeMenuOnSelect:!0,isOpen:b,isClearable:!0,hideSelectedOptions:!1,noValueOnClear:!0,isLoading:g,onInputChange:R,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=un(e);null==t||t.startInteraction(ne),v(!0),await(0,h.lastValueFrom)(e.validateAndUpdate()),v(!1),y(!0),null==t||t.stopInteraction()},onCloseMenu:()=>{y(!1)}})};const dn=()=>!0;function pn(e){const{label:t,value:n,group:r}=e,a={label:t,value:n};return r&&(a.group=r),a}var hn=function(){};var fn="undefined"!=typeof window;const mn=fn?c.useLayoutEffect:c.useEffect;var gn={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const vn=fn&&void 0!==window.ResizeObserver?function(){var e=(0,c.useState)(null),t=e[0],n=e[1],r=(0,c.useState)(gn),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 mn(function(){if(t)return o.observe(t),function(){o.disconnect()}},[t]),[n,a]}:function(){return[hn,gn]};function bn({data:e,showAll:t,seriesLimit:n,onShowAllSeries:r}){const a=(0,st.useStyles2)(yn),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(st.Icon,{title:(0,me.t)("grafana-scenes.components.viz-panel-series-limit.warning-message","Showing only {{seriesLimit}} series",{seriesLimit:n}),name:"exclamation-triangle","aria-hidden":"true"})),p().createElement(st.Tooltip,{content:(0,me.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(st.Button,{variant:"secondary",size:"sm",onClick:r},o)))}const yn=e=>({timeSeriesDisclaimer:(0,vt.css)({label:"time-series-disclaimer",display:"flex",alignItems:"center",gap:e.spacing(1)}),warningMessage:(0,vt.css)({display:"flex",alignItems:"center",gap:e.spacing(.5),color:e.colors.warning.main,fontSize:e.typography.bodySmall.fontSize})});const wn=function(e){(0,c.useEffect)(e,[])};function Sn(){const e=(0,c.useRef)(void 0);return null!=e.current||(e.current=(0,k.uniqueId)()),e.current}const xn=p().forwardRef(({children:e,onLoad:t,onChange:n,className:r,...a},i)=>{const o=Sn(),{hideEmpty:s}=(0,st.useStyles2)(En),[l,u]=(0,c.useState)(!1),[d,h]=(0,c.useState)(!1),f=(0,c.useRef)(null);return(0,c.useImperativeHandle)(i,()=>f.current),wn(()=>{xn.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&&xn.observer.observe(e),()=>{e&&xn.observer.unobserve(e),delete xn.callbacks[o],0===Object.keys(xn.callbacks).length&&xn.observer.disconnect()}}),p().createElement("div",{id:o,ref:f,className:`${s} ${r}`,...a},l?p().createElement(_n.Provider,{value:d},e):(0,me.t)("grafana-scenes.components.lazy-loader.placeholder"," "))});function En(){return{hideEmpty:(0,vt.css)({"&:empty":{display:"none"}})}}xn.displayName="LazyLoader",xn.callbacks={},xn.addCallback=(e,t)=>xn.callbacks[e]=t,xn.observer=new IntersectionObserver(e=>{for(const t of e)"function"==typeof xn.callbacks[t.target.id]&&xn.callbacks[t.target.id](t)},{rootMargin:"100px"});const _n=p().createContext(!0);function Cn(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 kn=(0,vt.css)({position:"relative",width:"100%",height:"100%"}),Rn=(0,vt.css)({position:"absolute",width:"100%",height:"100%"}),On=e=>({ok:(0,vt.css)({color:e.colors.success.text}),pending:(0,vt.css)({color:e.colors.warning.text}),alerting:(0,vt.css)({color:e.colors.error.text})}),An="hideSeriesFrom",Dn=(0,i.isSystemOverrideWithRef)(An);function In(e,t=i.ByNamesMatcherMode.exclude,n){return n=null!=n?n:{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!0}},{__systemRef:An,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 Tn=(e,t,n=i.ByNamesMatcherMode.exclude)=>{const r=e.properties.find(e=>"custom.hideFrom"===e.id),a=Pn(e),o=a.findIndex(e=>e===t);return o<0?a.push(t):a.splice(o,1),In(a,n,r)},Pn=e=>{var t;const n=null==(t=e.matcher.options)?void 0:t.names;return Array.isArray(n)?[...n]:[]},Ln=(e,t)=>Pn(e).length===Mn(t).length,Mn=(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)},Vn=(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},Nn=(e,t)=>({matcher:{id:i.FieldMatcherID.byName,options:e},properties:[$n(t)]}),$n=e=>({id:"color",value:{mode:i.FieldColorModeId.Fixed,fixedColor:e}});var Fn=n(6145);class jn extends E{constructor(e){super({...e,sync:e.sync||Fn.yV.Off}),this.getEventsBus=e=>{if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return new zn(this.parent,e)}}getEventsScope(){if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return this.state.key}}class zn{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")}}const Bn=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=Fl.findAllObjects(this.getRoot(),e=>e instanceof Yn);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}};Bn.REFRESH_RATE=100;let Un,Wn=Bn;class Hn extends E{constructor(e={}){super({...e}),this._isTracking=!1,this._activeQueries=new Map,this.addActivationHandler(()=>this._onActivate())}_onActivate(){var e,t;let n;try{n=Fl.getAncestor(this,Yn)}catch(e){return void $(0,0)}if(!n)return void $();if(!n.state.key)return void $();this._panelKey=n.state.key,this._panelId=String(n.getLegacyPanelId()),this._pluginId=n.state.pluginId;const r=n.getPlugin();return this._pluginVersion=null==(t=null==(e=null==r?void 0:r.meta)?void 0:e.info)?void 0:t.version,this._subs.add(n.subscribeToState((e,t)=>{this._handlePanelStateChange(n,e,t)})),()=>{this._cleanup()}}_handlePanelStateChange(e,t,n){t.pluginId!==n.pluginId&&this._onPluginChange(e,t.pluginId)}onQueryStarted(e,t,n){if(!this._panelKey)return null;this._activeQueries.set(n,{entry:t,startTime:e});const r=Qe("query");return Xe().notifyPanelOperationStart({operationId:r,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,pluginVersion:this._pluginVersion,operation:"query",timestamp:e,metadata:{queryId:n,queryType:t.type}}),(e,a)=>{if(!this._panelKey)return;const i=this._activeQueries.get(n);if(!i)return;const o=e-i.startTime;this._activeQueries.delete(n),Xe().notifyPanelOperationComplete({operationId:r,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,pluginVersion:this._pluginVersion,operation:"query",timestamp:e,duration:o,metadata:{queryId:n,queryType:t.type},error:a?(null==a?void 0:a.message)||String(a)||"Unknown error":void 0})}}onPluginLoadStart(e){if(!this._panelKey){let t;try{t=Fl.getAncestor(this,Yn)}catch(e){return null}t&&!this._panelKey&&t.state.key&&(this._panelKey=t.state.key,this._panelId=String(t.getLegacyPanelId()),this._pluginId=e)}if(!this._panelKey)return null;this._isTracking||this._startTracking(),this._loadPluginStartTime=performance.now();const t=Qe("pluginLoad");return Xe().notifyPanelOperationStart({operationId:t,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,operation:"plugin-load",timestamp:this._loadPluginStartTime,metadata:{pluginId:e}}),(e,n=!1)=>{if(!this._panelKey||!this._loadPluginStartTime)return;const r=performance.now()-this._loadPluginStartTime;Xe().notifyPanelOperationComplete({operationId:t,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,operation:"plugin-load",timestamp:performance.now(),duration:r,metadata:{pluginId:this._pluginId,fromCache:n,pluginLoadTime:r}}),this._loadPluginStartTime=void 0}}onFieldConfigStart(e){if(!this._panelKey)return null;this._applyFieldConfigStartTime=e;const t=Qe("fieldConfig");return Xe().notifyPanelOperationStart({operationId:t,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,operation:"fieldConfig",timestamp:this._applyFieldConfigStartTime,metadata:{}}),(e,n,r)=>{if(!this._panelKey||!this._applyFieldConfigStartTime)return;const a=e-this._applyFieldConfigStartTime;Xe().notifyPanelOperationComplete({operationId:t,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,operation:"fieldConfig",timestamp:e,duration:a,metadata:{}}),this._applyFieldConfigStartTime=void 0}}_getPanelInfo(){let e;try{e=Fl.getAncestor(this,Yn)}catch(e){}let t=(null==e?void 0:e.state.title)||this._panelKey||"No-key panel";return t.length>30&&(t=t.substring(0,27)+"..."),`VizPanelRenderProfiler [${t}]`}onSimpleRenderStart(e){if(!this._panelKey)return;const t=Qe("render");return Xe().notifyPanelOperationStart({operationId:t,panelId:this._panelId||"unknown",panelKey:this._panelKey,pluginId:this._pluginId||"unknown",pluginVersion:this._pluginVersion,operation:"render",timestamp:e,metadata:{}}),(e,n)=>{this._panelKey&&Xe().notifyPanelOperationComplete({operationId:t,panelId:this._panelId||"unknown",panelKey:this._panelKey,pluginId:this._pluginId||"unknown",pluginVersion:this._pluginVersion,operation:"render",duration:n,timestamp:e,metadata:{}})}}_onPluginChange(e,t){var n,r;this._pluginId=t;const a=e.getPlugin();this._pluginVersion=null==(r=null==(n=null==a?void 0:a.meta)?void 0:n.info)?void 0:r.version,$(this._getPanelInfo())}_startTracking(){this._panelKey&&this._pluginId&&!this._isTracking&&(this._isTracking=!0)}_cleanup(){this._activeQueries.clear(),this._isTracking=!1,$(this._getPanelInfo())}onDataTransformStart(e,t,n){if(!this._panelKey)return null;const r=Qe("transform");return Xe().notifyPanelOperationStart({operationId:r,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,operation:"transform",timestamp:e,metadata:{transformationId:t,transformationCount:n.transformationCount,seriesTransformationCount:n.seriesTransformationCount,annotationTransformationCount:n.annotationTransformationCount}}),(e,a,i,o)=>{this._panelKey&&Xe().notifyPanelOperationComplete({operationId:r,panelId:this._panelId,panelKey:this._panelKey,pluginId:this._pluginId,operation:"transform",timestamp:e,duration:a,metadata:{transformationId:t,transformationCount:n.transformationCount,seriesTransformationCount:n.seriesTransformationCount,annotationTransformationCount:n.annotationTransformationCount,success:i,error:(null==o?void 0:o.error)||(i?void 0:"Transform operation failed")}})}}}class qn{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 Gn extends E{constructor(){super(...arguments),this.isDataLayer=!0,this._results=new h.ReplaySubject(1),this._dataLayersMerger=new qn}subscribeToAllLayers(e){e.length>0?this.querySub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayerUpdateReceived.bind(this)):(this._results.next({origin:this,data:W}),this.setStateHelper({data:W}))}_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={...W,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){Le(this,e)}}class Qn extends Gn{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()}}}Qn.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 Kn extends E{constructor(e){super(e),this._results=new h.ReplaySubject(1),this._variableDependency=new hl(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 Qn)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 Fl.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)}_calculateTransformationMetrics(e,t){return{transformationCount:t.length,seriesTransformationCount:t.filter(e=>!("options"in e)&&!("topic"in e)||(null==e.topic||e.topic===i.DataTopic.Series)).length,annotationTransformationCount:t.filter(e=>("options"in e||"topic"in e)&&e.topic===i.DataTopic.Annotations).length}}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;const r=performance.now(),a=Xn(this),s=performance.now();let l,u=null;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;if(a){l=this.state.transformations.map(e=>"id"in e?e.id:"customTransformation").join("+")||"no-transforms";const t=this._calculateTransformationMetrics(e,this.state.transformations);u=a.onDataTransformStart(r,l,t)}const c=this._interpolateVariablesInTransformationConfigs(e),d=this._filterAndPrepareTransformationsByTopic(c,e=>!("options"in e)&&!("topic"in e)||(null==e.topic||e.topic===i.DataTopic.Series)),p=this._filterAndPrepareTransformationsByTopic(c,e=>("options"in e||"topic"in e)&&e.topic===i.DataTopic.Annotations);this._transformSub&&this._transformSub.unsubscribe();const f={interpolate:(t,n)=>{var r;return Fl.interpolate(this,t,{...null==(r=e.request)?void 0:r.scopedVars,...n})}},m=(0,i.transformDataFrame)(d,e.series,f),g=(0,i.transformDataFrame)(p,null!=(n=e.annotations)?n:[]);let v=[],b=[];this._transformSub=(0,h.forkJoin)([m,g]).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?b.push(n):v.push(n)}),{...e,series:v,annotations:b})),(0,h.catchError)(t=>{var n;const r=performance.now();u&&u(r,r-s,!1,{error:t.message||t}),console.error("Error transforming data: ",t);const a=(null==(n=this.getSourceData().state.data)?void 0:n.errors)||[],l=(0,o.toDataQueryError)(t);l.message=`Error transforming data: ${l.message}`;const c={...e,state:i.LoadingState.Error,errors:[...a,l]};return(0,h.of)(c)})).subscribe(t=>{var n;const r=performance.now();u&&u(r,r-s,!0,{outputSeriesCount:t.series.length,outputAnnotationsCount:(null==(n=t.annotations)?void 0:n.length)||0}),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(Fl.interpolate(this,JSON.stringify(n),null==(t=e.request)?void 0:t.scopedVars)):n.map(t=>{var n;return"object"==typeof t?JSON.parse(Fl.interpolate(this,JSON.stringify(t),null==(n=e.request)?void 0:n.scopedVars)):t})}_filterAndPrepareTransformationsByTopic(e,t){return e.filter(t).map(e=>"operator"in e?e.operator:e)}}class Yn extends E{constructor(e){var t;super({options:{},fieldConfig:{defaults:{},overrides:[]},title:(0,me.t)("grafana-scenes.components.viz-panel.title.title","Title"),pluginId:"timeseries",_renderCounter:0,...e}),this._variableDependency=new hl(this,{statePaths:["title","options","fieldConfig"]}),this._structureRev=0,this.onTimeRangeChange=e=>{Fl.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=Fl.findObject(this,e=>e instanceof Wn),n=Fl.getTimeRange(this);if(t instanceof Wn&&t.isEnabled)return K(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,k.mergeWith)((0,k.cloneDeep)(o),e,(e,t,n,r)=>{if((0,k.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,k.merge)((0,k.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)=>Fl.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=Fl.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,Nn(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,$n(t)]},{...n,overrides:o};const u=Array.from(s.properties);return u[l]=$n(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(Dn);if(o<0){if(t===st.SeriesVisibilityChangeMode.ToggleSelection){const e=In([i,...Vn(a,r)]);return{...n,overrides:[...n.overrides,e]}}const e=In(Mn(r,i));return{...n,overrides:[...n.overrides,e]}}const s=Array.from(a),[l]=s.splice(o,1);if(t===st.SeriesVisibilityChangeMode.ToggleSelection){let e=Pn(l);const t=Vn(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=In([i,...t]);return{...n,overrides:[...s,a]}}const u=Tn(l,i);return Ln(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)})}getProfiler(){if(this.state.$behaviors)for(const e of this.state.$behaviors)if(e instanceof Hn)return e}_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=this.getProfiler(),s=function(e){var t;const{getPanelPluginFromCache:n}=(0,o.getPluginImportUtils)();return null!=(t=n(e))?t:u.get(e)}(e);if(s){const i=null==a?void 0:a.onPluginLoadStart(e);null==i||i(s,!0),this._pluginLoaded(s,t,n,r)}else{const{importPanelPlugin:s}=(0,o.getPluginImportUtils)();try{const i=null==a?void 0:a.onPluginLoadStart(e),o=s(e),l=Fl.getQueryController(this);l&&l.state.enableProfiling&&Je(o).pipe(Ze({type:`VizPanel/loadPlugin/${e}`,origin:this})).subscribe(()=>{});const u=await o;null==i||i(u,!1),this._pluginLoaded(u,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 Bl(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 Kn?f.setState({transformations:d.transformations}):f instanceof Gs&&(f.clearParent(),f=new Kn({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=Fl.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,k.isEmpty)(c)&&this.onOptionsChange(c,!0,!0)}clearFieldConfigCache(){this._dataWithFieldConfig=void 0}applyFieldConfig(e){var t,n,r,a;const s=performance.now(),l=this._plugin,u=this.getProfiler();if(!l||l.meta.skipDataQuery||!e)return W;if(this._prevData===e&&this._dataWithFieldConfig)return this._dataWithFieldConfig;const c=null==u?void 0:u.onFieldConfigStart(s),d=l.dataSupport||{alertStates:!1,annotations:!1},p=l.fieldConfigRegistry,h=null!=(n=null==(t=this._dataWithFieldConfig)?void 0:t.series)?n:[],f=(0,i.applyFieldOverrides)({data:e.series,fieldConfig:this.state.fieldConfig,fieldConfigRegistry:p,replaceVariables:this.interpolate,theme:o.config.theme2,timeZone:null==(r=e.request)?void 0:r.timezone});return(0,i.compareArrayValues)(f,h,i.compareDataFrameStructures)||this._structureRev++,this._dataWithFieldConfig={...e,structureRev:this._structureRev,series:f},this._dataWithFieldConfig.annotations&&(this._dataWithFieldConfig.annotations=(0,i.applyFieldOverrides)({data:this._dataWithFieldConfig.annotations,fieldConfig:{defaults:{},overrides:[]},fieldConfigRegistry:p,replaceVariables:this.interpolate,theme:o.config.theme2,timeZone:null==(a=e.request)?void 0:a.timezone})),d.alertStates||(this._dataWithFieldConfig.alertState=void 0),d.annotations||(this._dataWithFieldConfig.annotations=void 0),this._prevData=e,u&&(null==c||c(performance.now())),this._dataWithFieldConfig}clone(e){return super.clone({_pluginInstanceState:void 0,_pluginLoadError:void 0,...e})}buildPanelContext(){const e=(t=this,Fl.findObject(t,e=>e instanceof jn));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}}function Xn(e){try{const t=Fl.getAncestor(e,Yn);if(t){return(t.state.$behaviors||[]).find(e=>e instanceof Hn)}}catch(e){}}Yn.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}]=vn(),R=(0,c.useMemo)(()=>(0,o.getAppEvents)(),[]),O=(0,c.useCallback)(()=>{e.state.key&&R.publish(new i.SetPanelAttentionEvent({panelId:e.getPathId()}))},[e,R]),A=(0,c.useMemo)(()=>(0,k.debounce)(O,100,{leading:!0,trailing:!1}),[O]),D=(0,c.useMemo)(()=>e.getProfiler(),[e]),I=performance.now(),T=p().useRef(null);(0,c.useLayoutEffect)(()=>{if(D){const e=D.onSimpleRenderStart(I);T.current=e||null}}),(0,c.useEffect)(()=>{if(T.current){const e=performance.now(),t=e-I;T.current(e,t),T.current=null}});const P=e.getPlugin(),{dragClass:L,dragClassCancel:M}=function(e){var t,n;const r=Fl.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),V=function(e){var t,n;const r=Fl.getLayout(e);return null!=(n=null==(t=null==r?void 0:r.getDragHooks)?void 0:t.call(r))?n:{}}(e),N=Fl.getData(e),$=N.useState(),F=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])}($.data,v,b),j=e.applyFieldConfig(F),z=Fl.getTimeRange(e).getTimeZone(),B=e.getTimeRange(j),U=p().useContext(_n);(0,c.useEffect)(()=>{N.isInViewChanged&&N.isInViewChanged(U)},[U,N]);const W=e.interpolate(n,void 0,"text"),H=(0,st.useStyles2)(On);if(!P)return p().createElement("div",null,p().createElement(me.x6,{i18nKey:"grafana-scenes.components.viz-panel-renderer.loading-plugin-panel"},"Loading plugin panel..."));if(!P.panel)return p().createElement("div",null,p().createElement(me.x6,{i18nKey:"grafana-scenes.components.viz-panel-renderer.panel-plugin-has-no-panel-component"},"Panel plugin has no panel component"));const q=P.panel;N&&N.setContainerWidth&&N.setContainerWidth(Math.round(_));let G,Q,K=[];g&&(Array.isArray(g)?K=K.concat(g.map(e=>p().createElement(e.Component,{model:e,key:`${e.state.key}`}))):He(g)?K.push(p().createElement(g.Component,{model:g})):K.push(g)),v&&K.push(p().createElement(bn,{key:"series-limit",data:$.data,seriesLimit:v,showAll:b,onShowAllSeries:()=>e.setState({seriesLimitShowAll:!b})})),e.state.$timeRange&&K.push(p().createElement(e.state.$timeRange.Component,{model:e.state.$timeRange,key:e.state.key})),j.alertState&&K.push(p().createElement(st.Tooltip,{content:null!=(t=j.alertState.state)?t:"unknown",key:`alert-states-icon-${e.state.key}`},p().createElement(st.PanelChrome.TitleItem,{className:(0,vt.cx)({[H.ok]:j.alertState.state===i.AlertState.OK,[H.pending]:j.alertState.state===i.AlertState.Pending,[H.alerting]:j.alertState.state===i.AlertState.Alerting})},p().createElement(st.Icon,{name:"alerting"===j.alertState.state?"heart-break":"heart",className:"panel-alert-icon",size:"md"})))),f&&(G=p().createElement(f.Component,{model:f})),m&&(Q=Array.isArray(m)?p().createElement(p().Fragment,null,m.map(e=>p().createElement(e.Component,{model:e,key:`${e.state.key}`}))):He(m)?p().createElement(m.Component,{model:m}):m);const Y=j,X=!N.isDataReadyToDisplay||N.isDataReadyToDisplay(),Z=e.getPanelContext(),J=e.getLegacyPanelId();return p().createElement("div",{className:kn},p().createElement("div",{ref:E,className:Rn,"data-viz-panel-key":e.state.key},_>0&&C>0&&p().createElement(st.PanelChrome,{title:W,description:(null==y?void 0:y.trim())?e.getDescription:void 0,loadingState:Y.state,statusMessage:Cn(Y,s),statusMessageOnClick:e.onStatusMessageClick,width:_,height:C,selectionId:e.state.key,displayMode:l,titleItems:K,dragClass:L,actions:Q,dragClassCancel:M,padding:P.noPadding?"none":"md",menu:G,onCancelQuery:e.onCancelQuery,onFocus:O,onMouseEnter:O,onMouseMove:A,onDragStart:t=>{var n;null==(n=V.onDragStart)||n.call(V,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(st.ErrorBoundaryAlert,{dependencies:[P,Y]},p().createElement(i.PluginContextProvider,{meta:P.meta},p().createElement(st.PanelContextProvider,{value:Z},X&&p().createElement(q,{id:J,data:Y,title:n,timeRange:B,timeZone:z,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:Z.eventBus}))))))))};const Zn=new Set;function Jn(e){return p().createElement(st.Tooltip,{content:(0,me.t)("grafana-scenes.utils.loading-indicator.content-cancel-query","Cancel query")},p().createElement(st.Icon,{className:"spin-clockwise",name:"sync",size:"xs",role:"button",onMouseDown:t=>{e.onCancel(t)}}))}function er(e){const t=(0,st.useStyles2)(tr),n=(0,st.useTheme2)(),r="vertical"===e.layout,a=Boolean(e.isLoading)?p().createElement("div",{style:{marginLeft:n.spacing(1),marginTop:"-1px"},"aria-label":gt.components.LoadingIndicator.icon},p().createElement(Jn,{onCancel:t=>{var n;t.preventDefault(),t.stopPropagation(),null==(n=e.onCancel)||n.call(e)}})):null;let i=null;e.error&&(i=p().createElement(st.Tooltip,{content:e.error,placement:"bottom"},p().createElement(st.Icon,{className:t.errorIcon,name:"exclamation-triangle"})));let o=null;e.description&&(o=p().createElement(st.Tooltip,{content:e.description,placement:r?"top":"bottom"},p().createElement(st.Icon,{className:t.normalIcon,name:"info-circle"})));const s="string"==typeof e.label?gt.pages.Dashboard.SubMenu.submenuItemLabels(e.label):"";let l;return l=r?p().createElement("label",{className:(0,vt.cx)(t.verticalLabel,e.className),"data-testid":s,htmlFor:e.htmlFor},e.prefix,e.label,o,i,e.icon&&p().createElement(st.Icon,{name:e.icon,className:t.normalIcon}),a,e.onRemove&&p().createElement(st.IconButton,{variant:"secondary",size:"xs",name:"times",onClick:e.onRemove,tooltip:(0,me.t)("grafana-scenes.utils.controls-label.tooltip-remove","Remove")}),e.suffix):p().createElement("label",{className:(0,vt.cx)(t.horizontalLabel,e.className),"data-testid":s,htmlFor:e.htmlFor},e.prefix,i,e.icon&&p().createElement(st.Icon,{name:e.icon,className:t.normalIcon}),e.label,o,a,e.suffix),l}const tr=e=>({horizontalLabel:(0,vt.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,vt.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,vt.css)({color:e.colors.error.text}),normalIcon:(0,vt.css)({color:e.colors.text.secondary})});function nr(e){const t=e.map(e=>{var t;return null!=(t=e.label)?t:String(e.value)});return n=>jt(e,t,n)}function rr(e,t){return""!==e?{value:e,label:t||e}:null}const ar=()=>!0;function ir({filter:e,model:t}){var n,r,a,i,o;const s=(0,st.useStyles2)(or),[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)(""),[k,R]=(0,c.useState)(!1),[O,A]=(0,c.useState)(e.values?e.values.map((t,n)=>{var r;return rr(t,null==(r=e.valueLabels)?void 0:r[n])}):[]),D=Us(e.operator),I=rr(e.key,e.keyLabel),T=rr(e.value,null==(n=e.valueLabels)?void 0:n[0]),P=(0,c.useMemo)(()=>nr(d),[d]),L=t.state.onAddCustomValue,M=(0,c.useMemo)(()=>cl(P(_)),[P,_]),V={isMulti:!0,value:O,components:{Option:Gt},hideSelectedOptions:!1,closeMenuOnSelect:!1,openMenuOnFocus:!1,onChange:e=>{A(e),e.some(e=>e.__isNew__)&&C("")},onBlur:()=>{var n,r;t._updateFilter(e,{value:null!=(r=null==(n=O[0])?void 0:n.value)?r:"",values:O.map(e=>e.value),valueLabels:O.map(e=>e.label)})}},N=Ms.find(t=>e.operator===t.value),$=p().createElement(st.Select,{virtualized:!0,allowCustomValue:null==(r=t.state.allowCustomValue)||r,createOptionPosition:(null==N?void 0:N.isRegex)?"first":"last",isValidNewOption:e=>e.trim().length>0,allowCreateWhileLoading:!0,formatCreateLabel:e=>`Use custom value: ${e}`,disabled:t.state.readOnly,className:(0,vt.cx)(s.value,w?s.widthWhenOpen:void 0),width:"auto",value:T,filterOption:ar,placeholder:(0,me.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]}),k!==n.__isNew__&&R(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),k&&C(null!=(n=null==T?void 0:T.label)?n:"")},onCloseMenu:()=>{S(!1),C("")},...D&&V}),F=p().createElement(st.Select,{key:""+(g?"loading":"loaded"),disabled:t.state.readOnly,className:(0,vt.cx)(s.key,b?s.widthWhenOpen:void 0),width:"auto",allowCustomValue:null==(a=t.state.allowCustomValue)||a,createOptionPosition:(null==N?void 0:N.isRegex)?"first":"last",value:I,placeholder:(0,me.t)("grafana-scenes.variables.ad-hoc-filter-renderer.key-select.placeholder-select-label","Select label"),options:cl(l),onChange:n=>{t._updateFilter(e,{key:n.value,keyLabel:n.label,value:"",valueLabels:[""],values:void 0}),A([])},autoFocus:""===e.key,isOpen:b&&!f,isLoading:f,onOpenMenu:async()=>{y(!0),m(!0);const n=await t._getKeys(e.key);m(!1),u(n)},onCloseMenu:()=>{y(!1)},onBlur:()=>{""===e.key&&t._removeFilter(e)},openMenuOnFocus:!0}),j=p().createElement(st.Select,{className:(0,vt.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};Us(i)&&!Us(o)?(s.value="",s.valueLabels=[""],s.values=void 0,A([])):!Us(i)&&Us(o)&&e.value&&(s.values=[e.value],A([{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(er,{layout:"vertical",label:null!=(i=e.key)?i:"",onRemove:()=>t._removeFilter(e)});return p().createElement(st.Field,{label:n,"data-testid":`AdHocFilter-${e.key}`,className:s.field},p().createElement("div",{className:s.wrapper},j,$))}return p().createElement(st.Field,{label:(0,me.t)("grafana-scenes.variables.ad-hoc-filter-renderer.label-select-label","Select label"),"data-testid":`AdHocFilter-${e.key}`,className:s.field},F)}return p().createElement("div",{className:s.wrapper,"data-testid":`AdHocFilter-${e.key}`},F,j,$,p().createElement(st.Button,{variant:"secondary","aria-label":(0,me.t)("grafana-scenes.variables.ad-hoc-filter-renderer.aria-label-remove-filter","Remove filter"),title:(0,me.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 or=e=>({field:(0,vt.css)({marginBottom:0}),wrapper:(0,vt.css)({display:"flex","&:first-child":{"> :first-child":{borderBottomLeftRadius:0,borderTopLeftRadius:0}},"> *":{"&: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,vt.css)({minWidth:e.spacing(16)}),value:(0,vt.css)({flexBasis:"content",flexShrink:1,minWidth:"90px"}),key:(0,vt.css)({flexBasis:"content",minWidth:"90px",flexShrink:1}),operator:(0,vt.css)({flexShrink:0,flexBasis:"content"}),removeButton:(0,vt.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 sr({model:e,addFilterButtonText:t}){const{_wip:n}=e.useState(),r=(0,st.useStyles2)(lr);return n?p().createElement(ir,{filter:n,model:e}):p().createElement(st.Button,{variant:"secondary",icon:"plus",title:(0,me.t)("grafana-scenes.variables.ad-hoc-filter-builder.title-add-filter","Add filter"),"aria-label":(0,me.t)("grafana-scenes.variables.ad-hoc-filter-builder.aria-label-add-filter","Add filter"),"data-testid":"AdHocFilter-add",onClick:()=>e._addWip(),className:r.addButton},t)}const lr=e=>({addButton:(0,vt.css)({"&:first-child":{borderBottomLeftRadius:0,borderTopLeftRadius:0}})});class ur{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(zs).filter(e=>!e.hidden).map(e=>cr(e).map(il).join("|"))),(null==t?void 0:t.length)&&n.push(...null==t?void 0:t.filter(zs).filter(e=>!e.hidden&&e.origin&&e.restorable).map(e=>cr(e).map(il).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(dr).filter(pr)}const t=dr(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?(js(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 cr(e){var t;const n=[sl(e.key,e.keyLabel),e.operator];return Us(e.operator)?e.values.forEach((t,r)=>{var a;n.push(sl(t,null==(a=e.valueLabels)?void 0:a[r]))}):n.push(sl(e.value,null==(t=e.valueLabels)?void 0:t[0])),n}function dr(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(ol);return{key:a,keyLabel:i,operator:o,value:l[0],values:Us(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 pr(e){return null!==e&&"string"==typeof e.key&&"string"==typeof e.value}function hr(){return"undefined"!=typeof window}function fr(e){return vr(e)?(e.nodeName||"").toLowerCase():"#document"}function mr(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function gr(e){var t;return null==(t=(vr(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function vr(e){return!!hr()&&(e instanceof Node||e instanceof mr(e).Node)}function br(e){return!!hr()&&(e instanceof Element||e instanceof mr(e).Element)}function yr(e){return!!hr()&&(e instanceof HTMLElement||e instanceof mr(e).HTMLElement)}function wr(e){return!(!hr()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof mr(e).ShadowRoot)}const Sr=new Set(["inline","contents"]);function xr(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Lr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Sr.has(a)}const Er=new Set(["table","td","th"]);function _r(e){return Er.has(fr(e))}const Cr=[":popover-open",":modal"];function kr(e){return Cr.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Rr=["transform","translate","scale","rotate","perspective"],Or=["transform","translate","scale","rotate","perspective","filter"],Ar=["paint","layout","strict","content"];function Dr(e){const t=Ir(),n=br(e)?Lr(e):e;return Rr.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Or.some(e=>(n.willChange||"").includes(e))||Ar.some(e=>(n.contain||"").includes(e))}function Ir(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Tr=new Set(["html","body","#document"]);function Pr(e){return Tr.has(fr(e))}function Lr(e){return mr(e).getComputedStyle(e)}function Mr(e){return br(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vr(e){if("html"===fr(e))return e;const t=e.assignedSlot||e.parentNode||wr(e)&&e.host||gr(e);return wr(t)?t.host:t}function Nr(e){const t=Vr(e);return Pr(t)?e.ownerDocument?e.ownerDocument.body:e.body:yr(t)&&xr(t)?t:Nr(t)}function $r(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const a=Nr(e),i=a===(null==(r=e.ownerDocument)?void 0:r.body),o=mr(a);if(i){const e=Fr(o);return t.concat(o,o.visualViewport||[],xr(a)?a:[],e&&n?$r(e):[])}return t.concat(a,$r(a,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jr(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 zr(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&wr(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Br(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function Ur(){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 Wr(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Gr()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function Hr(e){return!Ur().includes("jsdom/")&&(!Gr()&&0===e.width&&0===e.height||Gr()&&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 qr(){return/apple/i.test(navigator.vendor)}function Gr(){const e=/android/i;return e.test(Br())||e.test(Ur())}function Qr(e){return(null==e?void 0:e.ownerDocument)||document}function Kr(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 Yr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Xr(e){e.preventDefault(),e.stopPropagation()}function Zr(e){return!!e&&("combobox"===e.getAttribute("role")&&function(e){return yr(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}(e))}const Jr=Math.min,ea=Math.max,ta=Math.round,na=Math.floor,ra=e=>({x:e,y:e}),aa={left:"right",right:"left",bottom:"top",top:"bottom"},ia={start:"end",end:"start"};function oa(e,t){return"function"==typeof e?e(t):e}function sa(e){return e.split("-")[0]}function la(e){return e.split("-")[1]}function ua(e){return"y"===e?"height":"width"}const ca=new Set(["top","bottom"]);function da(e){return ca.has(sa(e))?"y":"x"}function pa(e){return"x"===da(e)?"y":"x"}function ha(e){return e.replace(/start|end/g,e=>ia[e])}const fa=["left","right"],ma=["right","left"],ga=["top","bottom"],va=["bottom","top"];function ba(e,t,n,r){const a=la(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?ma:fa:t?fa:ma;case"left":case"right":return t?ga:va;default:return[]}}(sa(e),"start"===n,r);return a&&(i=i.map(e=>e+"-"+a),t&&(i=i.concat(i.map(ha)))),i}function ya(e){return e.replace(/left|right|bottom|top/g,e=>aa[e])}function wa(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 Sa=["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])"],xa=Sa.join(","),Ea="undefined"==typeof Element,_a=Ea?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ca=!Ea&&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},ka=function(e,t){var n;void 0===t&&(t=!0);var r=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===r||"true"===r||t&&e&&ka(e.parentNode)},Ra=function(e,t,n){if(ka(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(xa));return t&&_a.call(e,xa)&&r.unshift(e),r=r.filter(n)},Oa=function(e,t,n){for(var r=[],a=Array.from(e);a.length;){var i=a.shift();if(!ka(i,!1))if("SLOT"===i.tagName){var o=i.assignedElements(),s=o.length?o:i.children,l=Oa(s,!0,n);n.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{_a.call(i,xa)&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var u=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),c=!ka(u,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(u&&c){var d=Oa(!0===u?i.children:u.children,!0,n);n.flatten?r.push.apply(r,d):r.push({scopeParent:i,candidates:d})}else a.unshift.apply(a,i.children)}}return r},Aa=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Da=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))&&!Aa(e)?0:e.tabIndex},Ia=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ta=function(e){return"INPUT"===e.tagName},Pa=function(e){return function(e){return Ta(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Ca(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)},La=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ma=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var a=_a.call(e,"details>summary:first-of-type")?e.parentElement:e;if(_a.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return La(e)}else{if("function"==typeof r){for(var i=e;e;){var o=e.parentElement,s=Ca(e);if(o&&!o.shadowRoot&&!0===r(o))return La(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&&Ca(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=Ca(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},Va=function(e,t){return!(t.disabled||ka(t)||function(e){return Ta(e)&&"hidden"===e.type}(t)||Ma(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!!_a.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Na=function(e,t){return!(Pa(t)||Da(t)<0||!Va(e,t))},$a=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Fa=function(e){var t=[],n=[];return e.forEach(function(e,r){var a=!!e.scopeParent,i=a?e.scopeParent:e,o=function(e,t){var n=Da(e);return n<0&&t&&!Aa(e)?0:n}(i,a),s=a?Fa(e.candidates):i;0===o?a?t.push.apply(t,s):t.push(i):n.push({documentOrder:r,tabIndex:o,item:e,isScope:a,content:s})}),n.sort(Ia).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},ja=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Oa([e],t.includeContainer,{filter:Na.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:$a}):Ra(e,t.includeContainer,Na.bind(null,t)),Fa(n)},za=n(8398);function Ba(e,t,n){let{reference:r,floating:a}=e;const i=da(t),o=pa(t),s=ua(o),l=sa(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(la(t)){case"start":h[o]-=p*(n&&u?-1:1);break;case"end":h[o]+=p*(n&&u?-1:1)}return h}async function Ua(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}=oa(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=wa(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=wa(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 Wa=new Set(["left","top"]);function Ha(e){const t=Lr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=yr(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,s=ta(n)!==i||ta(r)!==o;return s&&(n=i,r=o),{width:n,height:r,$:s}}function qa(e){return br(e)?e:e.contextElement}function Ga(e){const t=qa(e);if(!yr(t))return ra(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=Ha(t);let o=(i?ta(n.width):n.width)/r,s=(i?ta(n.height):n.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}const Qa=ra(0);function Ka(e){const t=mr(e);return Ir()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Qa}function Ya(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const a=e.getBoundingClientRect(),i=qa(e);let o=ra(1);t&&(r?br(r)&&(o=Ga(r)):o=Ga(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==mr(e))&&t}(i,n,r)?Ka(i):ra(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=mr(i),t=r&&br(r)?mr(r):r;let n=e,a=Fr(n);for(;a&&r&&t!==n;){const e=Ga(a),t=a.getBoundingClientRect(),r=Lr(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=mr(a),a=Fr(n)}}return wa({width:c,height:d,x:l,y:u})}function Xa(e,t){const n=Mr(e).scrollLeft;return t?t.left+n:Ya(gr(e)).left+n}function Za(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Xa(e,n),y:n.top+t.scrollTop}}const Ja=new Set(["absolute","fixed"]);function ei(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=mr(e),r=gr(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=Ir();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}const u=Xa(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=gr(e),n=Mr(e),r=e.ownerDocument.body,a=ea(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ea(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Xa(e);const s=-n.scrollTop;return"rtl"===Lr(r).direction&&(o+=ea(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:s}}(gr(e));else if(br(t))r=function(e,t){const n=Ya(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=yr(e)?Ga(e):ra(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=Ka(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wa(r)}function ti(e,t){const n=Vr(e);return!(n===t||!br(n)||Pr(n))&&("fixed"===Lr(n).position||ti(n,t))}function ni(e,t,n){const r=yr(t),a=gr(t),i="fixed"===n,o=Ya(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=ra(0);function u(){l.x=Xa(a)}if(r||!r&&!i)if(("body"!==fr(t)||xr(a))&&(s=Mr(t)),r){const e=Ya(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?ra(0):Za(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 ri(e){return"static"===Lr(e).position}function ai(e,t){if(!yr(e)||"fixed"===Lr(e).position)return null;if(t)return t(e);let n=e.offsetParent;return gr(e)===n&&(n=n.ownerDocument.body),n}function ii(e,t){const n=mr(e);if(kr(e))return n;if(!yr(e)){let t=Vr(e);for(;t&&!Pr(t);){if(br(t)&&!ri(t))return t;t=Vr(t)}return n}let r=ai(e,t);for(;r&&_r(r)&&ri(r);)r=ai(r,t);return r&&Pr(r)&&ri(r)&&!Dr(r)?n:r||function(e){let t=Vr(e);for(;yr(t)&&!Pr(t);){if(Dr(t))return t;if(kr(t))return null;t=Vr(t)}return null}(e)||n}const oi={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i="fixed"===a,o=gr(r),s=!!t&&kr(t.floating);if(r===o||s&&i)return n;let l={scrollLeft:0,scrollTop:0},u=ra(1);const c=ra(0),d=yr(r);if((d||!d&&!i)&&(("body"!==fr(r)||xr(o))&&(l=Mr(r)),yr(r))){const e=Ya(r);u=Ga(r),c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}const p=!o||d||i?ra(0):Za(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:gr,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const i=[..."clippingAncestors"===n?kr(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=$r(e,[],!1).filter(e=>br(e)&&"body"!==fr(e)),a=null;const i="fixed"===Lr(e).position;let o=i?Vr(e):e;for(;br(o)&&!Pr(o);){const t=Lr(o),n=Dr(o);n||"fixed"!==t.position||(a=null),(i?!n&&!a:!n&&"static"===t.position&&a&&Ja.has(a.position)||xr(o)&&!n&&ti(e,o))?r=r.filter(e=>e!==o):a=t,o=Vr(o)}return t.set(e,r),r}(t,this._c):[].concat(n),r],o=i[0],s=i.reduce((e,n)=>{const r=ei(t,n,a);return e.top=ea(r.top,e.top),e.right=Jr(r.right,e.right),e.bottom=Jr(r.bottom,e.bottom),e.left=ea(r.left,e.left),e},ei(t,o,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:ii,getElementRects:async function(e){const t=this.getOffsetParent||ii,n=this.getDimensions,r=await n(e.floating);return{reference:ni(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}=Ha(e);return{width:t,height:n}},getScale:Ga,isElement:br,isRTL:function(e){return"rtl"===Lr(e).direction}};function si(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function li(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=qa(e),c=a||i?[...u?$r(u):[],...$r(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=gr(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:-na(d)+"px "+-na(a.clientWidth-(c+p))+"px "+-na(a.clientHeight-(d+h))+"px "+-na(c)+"px",threshold:ea(0,Jr(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||si(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?Ya(e):null;return l&&function t(){const r=Ya(e);m&&!si(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 ui=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=sa(n),s=la(n),l="y"===da(n),u=Wa.has(o)?-1:1,c=i&&l?-1:1,d=oa(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}}}}},ci=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}=oa(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=sa(a),b=da(s),y=sa(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(u.floating)),S=p||(y||!m?[ya(s)]:function(e){const t=ya(e);return[ha(e),t,ha(t)]}(s)),x="none"!==f;!p&&x&&S.push(...ba(s,m,f,w));const E=[s,...S],_=await Ua(t,g),C=[];let k=(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=la(e),a=pa(e),i=ua(a);let o="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ya(o)),[o,ya(o)]}(a,o,w);C.push(_[e[0]],_[e[1]])}if(k=[...k,{placement:a,overflows:C}],!C.every(e=>e<=0)){var R,O;const e=((null==(R=i.flip)?void 0:R.index)||0)+1,t=E[e];if(t){if(!("alignment"===d&&b!==da(t))||k.every(e=>da(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:k},reset:{placement:t}}}let n=null==(O=k.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:O.placement;if(!n)switch(h){case"bestFit":{var A;const e=null==(A=k.filter(e=>{if(x){const t=da(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:A[0];e&&(n=e);break}case"initialPlacement":n=s}if(a!==n)return{reset:{placement:n}}}return{}}}},di=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}=oa(e,t),c=await Ua(t,u),d=sa(a),p=la(a),h="y"===da(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=Jr(m-c[g],b),S=Jr(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=ea(c.left,0),t=ea(c.right,0),n=ea(c.top,0),r=ea(c.bottom,0);h?_=f-2*(0!==e||0!==t?e+t:ea(c.left,c.right)):E=m-2*(0!==n||0!==r?n+r:ea(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}}:{}}}},pi=(e,t,n)=>{const r=new Map,a={platform:oi,...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}=Ba(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}=Ba(u,p,l))),n=-1)}return{x:c,y:d,placement:p,strategy:a,middlewareData:h}})(e,t,{...a,platform:i})};var hi="undefined"!=typeof document?c.useLayoutEffect:function(){};function fi(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(!fi(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)&&!fi(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function mi(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gi(e,t){const n=mi(e);return Math.round(t*n)/n}function vi(e){const t=c.useRef(e);return hi(()=>{t.current=e}),t}const bi=(e,t)=>({...ci(e),options:[e,t]}),yi=(e,t)=>({...di(e),options:[e,t]});const wi={...d},Si=wi.useInsertionEffect||(e=>e());function xi(e){const t=c.useRef(()=>{0});return Si(()=>{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 Ei="ArrowUp",_i="ArrowDown",Ci="ArrowLeft",ki="ArrowRight";function Ri(e,t,n){return Math.floor(e/t)!==n}function Oi(e,t){return t<0||t>=e.current.length}function Ai(e,t){return Ii(e,{disabledIndices:t})}function Di(e,t){return Ii(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ii(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&&Vi(o,s,a));return s}function Ti(e,t){let{event:n,orientation:r,loop:a,rtl:i,cols:o,disabledIndices:s,minIndex:l,maxIndex:u,prevIndex:c,stopEvent:d=!1}=t,p=c;if(n.key===Ei){if(d&&Xr(n),-1===c)p=u;else if(p=Ii(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}Oi(e,p)&&(p=c)}if(n.key===_i&&(d&&Xr(n),-1===c?p=l:(p=Ii(e,{startingIndex:c,amount:o,disabledIndices:s}),a&&c+o>u&&(p=Ii(e,{startingIndex:c%o-o,amount:o,disabledIndices:s}))),Oi(e,p)&&(p=c)),"both"===r){const t=na(c/o);n.key===(i?Ci:ki)&&(d&&Xr(n),c%o!==o-1?(p=Ii(e,{startingIndex:c,disabledIndices:s}),a&&Ri(p,o,t)&&(p=Ii(e,{startingIndex:c-c%o-1,disabledIndices:s}))):a&&(p=Ii(e,{startingIndex:c-c%o-1,disabledIndices:s})),Ri(p,o,t)&&(p=c)),n.key===(i?ki:Ci)&&(d&&Xr(n),c%o!==0?(p=Ii(e,{startingIndex:c,decrement:!0,disabledIndices:s}),a&&Ri(p,o,t)&&(p=Ii(e,{startingIndex:c+(o-c%o),decrement:!0,disabledIndices:s}))):a&&(p=Ii(e,{startingIndex:c+(o-c%o),decrement:!0,disabledIndices:s})),Ri(p,o,t)&&(p=c));const r=na(u/o)===t;Oi(e,p)&&(p=a&&r?n.key===(i?ki:Ci)?u:Ii(e,{startingIndex:c-c%o-1,disabledIndices:s}):c)}return p}function Pi(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 Li(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 Mi(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Vi(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 Ni="undefined"!=typeof document?c.useLayoutEffect:c.useEffect;const $i=[Ci,ki],Fi=[Ei,_i];function ji(){return ji=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},ji.apply(this,arguments)}let zi=!1,Bi=0;const Ui=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Bi++;const Wi=wi.useId||function(){const[e,t]=c.useState(()=>zi?Ui():void 0);return Ni(()=>{null==e&&t(Ui())},[]),c.useEffect(()=>{zi=!0},[]),e};function Hi(){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 qi=c.createContext(null),Gi=c.createContext(null),Qi=()=>{var e;return(null==(e=c.useContext(qi))?void 0:e.id)||null},Ki=()=>c.useContext(Gi);function Yi(e){return"data-floating-ui-"+e}function Xi(e){const t=(0,c.useRef)(e);return Ni(()=>{t.current=e}),t}let Zi=0;function Ji(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:a=!1}=t;r&&cancelAnimationFrame(Zi);const i=()=>null==e?void 0:e.focus({preventScroll:n});a?i():Zi=requestAnimationFrame(i)}function eo(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 to=new WeakMap,no=new WeakSet,ro={},ao=0;const io=e=>e&&(e.host||io(e.parentNode));function oo(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=io(e);return s.contains(t)?t:null}).filter(e=>null!=e));var s;const l=new Set,u=new Set(o),c=[];ro[a]||(ro[a]=new WeakMap);const d=ro[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"!==fr(t))if(l.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=(to.get(t)||0)+1,o=(d.get(t)||0)+1;to.set(t,r),d.set(t,o),c.push(t),1===r&&n&&no.add(t),1===o&&t.setAttribute(a,""),!n&&i&&t.setAttribute(i,"true")}})}(t),l.clear(),ao++,()=>{c.forEach(e=>{const t=(to.get(e)||0)-1,n=(d.get(e)||0)-1;to.set(e,t),d.set(e,n),t||(!no.has(e)&&i&&e.removeAttribute(i),no.delete(e)),n||e.removeAttribute(a)}),ao--,ao||(to=new WeakMap,to=new WeakMap,no=new WeakSet,ro={})}}function so(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=Qr(e[0]).body;return oo(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const lo=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function uo(e,t){const n=ja(e,lo());"prev"===t&&n.reverse();const r=n.indexOf(jr(Qr(e)));return n.slice(r+1)[0]}function co(){return uo(document.body,"next")}function po(){return uo(document.body,"prev")}function ho(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!zr(n,r)}function fo(e){ja(e,lo()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function mo(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 go={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 vo(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const bo=c.forwardRef(function(e,t){const[n,r]=c.useState();Ni(()=>(qr()&&r("button"),document.addEventListener("keydown",vo),()=>{document.removeEventListener("keydown",vo)}),[]);const a={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Yi("focus-guard")]:"",style:go};return c.createElement("span",ji({},e,a))}),yo=c.createContext(null),wo=Yi("portal");function So(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=Wi(),a=xo(),[i,o]=c.useState(null),s=c.useRef(null);return Ni(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{s.current=null})},[i]),Ni(()=>{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(wo,""),e.appendChild(n),s.current=n,o(n)},[t,r]),Ni(()=>{if(null===n)return;if(!r)return;if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!br(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(wo,""),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&&ho(e)){("focusin"===e.type?mo:fo)(i)}}},[i,a,h]),c.useEffect(()=>{i&&(f||mo(i))},[f,i]),c.createElement(yo.Provider,{value:c.useMemo(()=>({preserveTabOrder:a,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:p,portalNode:i,setFocusManagerState:s}),[a,i])},m&&i&&c.createElement(bo,{"data-type":"outside",ref:l,onFocus:e=>{if(ho(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=po()||(null==o?void 0:o.refs.domReference.current);null==e||e.focus()}}}),m&&i&&c.createElement("span",{"aria-owns":i.id,style:go}),i&&za.createPortal(t,i),m&&i&&c.createElement(bo,{"data-type":"outside",ref:u,onFocus:e=>{if(ho(e,i)){var t;null==(t=p.current)||t.focus()}else{const t=co()||(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 xo=()=>c.useContext(yo),Eo="data-floating-ui-focusable";function _o(e){return e?e.hasAttribute(Eo)?e:e.querySelector("["+Eo+"]")||e:null}let Co=[];function ko(e){Co=Co.filter(e=>e.isConnected);let t=e;if(t&&"body"!==fr(t)){if(!function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==_a.call(e,xa)&&Na(t,e)}(t,lo())){const e=ja(t,lo())[0];e&&(t=e)}Co.push(t),Co.length>20&&(Co=Co.slice(-20))}}function Ro(){return Co.slice().reverse().find(e=>e.isConnected)}const Oo=c.forwardRef(function(e,t){return c.createElement("button",ji({},e,{type:"button",ref:t,tabIndex:-1,style:go}))});function Ao(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=Zr(w)&&x,_="undefined"==typeof HTMLElement||!("inert"in HTMLElement.prototype)||i,C=Xi(a),k=Xi(o),R=Xi(s),O=Ki(),A=xo(),D=c.useRef(null),I=c.useRef(null),T=c.useRef(!1),P=c.useRef(!1),L=c.useRef(-1),M=null!=A,V=_o(S),N=xi(function(e){return void 0===e&&(e=V),e?ja(e,lo()):[]}),$=xi(e=>{const t=N(e);return C.current.map(e=>w&&"reference"===e?w:V&&"floating"===e?V:t).filter(Boolean).flat()});function F(e){return!r&&d&&u?c.createElement(Oo,{ref:"start"===e?D:I,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){zr(V,jr(Qr(V)))&&0===N().length&&!E&&Xr(e);const t=$(),n=Yr(e);"reference"===C.current[0]&&n===w&&(Xr(e),e.shiftKey?Ji(t[t.length-1]):Ji(t[1])),"floating"===C.current[1]&&n===V&&e.shiftKey&&(Xr(e),Ji(t[0]))}}const t=Qr(V);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,w,V,u,C,E,N,$]),c.useEffect(()=>{if(!r&&S)return S.addEventListener("focusin",e),()=>{S.removeEventListener("focusin",e)};function e(e){const t=Yr(e),n=N().indexOf(t);-1!==n&&(L.current=n)}},[r,S,N]),c.useEffect(()=>{if(!r&&p)return S&&yr(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=!(zr(w,t)||zr(S,t)||zr(t,S)||zr(null==A?void 0:A.portalNode,t)||null!=t&&t.hasAttribute(Yi("focus-guard"))||O&&(eo(O.nodesRef.current,m).find(e=>{var n,r;return zr(null==(n=e.context)?void 0:n.elements.floating,t)||zr(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}(O.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&&jr(Qr(V))===Qr(V).body){yr(V)&&V.focus();const e=L.current,t=N(),n=t[e]||t[t.length-1]||V;yr(n)&&n.focus()}!E&&u||!t||!n||P.current||t===Ro()||(T.current=!0,g(!1,e,"focus-out"))})}},[r,w,S,V,u,m,O,A,g,p,l,N,E]),c.useEffect(()=>{var e;if(r)return;const t=Array.from((null==A||null==(e=A.portalNode)?void 0:e.querySelectorAll("["+Yi("portal")+"]"))||[]);if(S){const e=[S,...t,D.current,I.current,C.current.includes("reference")||E?w:null].filter(e=>null!=e),n=u||E?so(e,_,!_):so(e);return()=>{n()}}},[r,w,S,u,C,A,E,_]),Ni(()=>{if(r||!yr(V))return;const e=jr(Qr(V));queueMicrotask(()=>{const t=$(V),n=k.current,r=("number"==typeof n?t[n]:n.current)||V,a=zr(V,e);x||a||!h||Ji(r,{preventScroll:r===V})})},[r,h,V,x,$,k]),Ni(()=>{if(r||!V)return;let e=!1;const t=Qr(V),n=jr(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&&ko(f.domReference.current),"hover"===r&&"mouseleave"===i.type&&(T.current=!0),"outside-press"===r&&(o?(T.current=!1,e=!0):T.current=!(Wr(i)||Hr(i)))}ko(n),v.on("openchange",i);const o=t.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,go),M&&w&&w.insertAdjacentElement("afterend",o),()=>{v.off("openchange",i);const n=jr(t),r=zr(S,n)||O&&eo(O.nodesRef.current,m).some(e=>{var t;return zr(null==(t=e.context)?void 0:t.elements.floating,n)});(r||a&&["click","mousedown"].includes(a.type))&&f.domReference.current&&ko(f.domReference.current);const s="boolean"==typeof R.current?Ro()||o:R.current.current||o;queueMicrotask(()=>{R.current&&!T.current&&yr(s)&&(s===n||n===t.body||r)&&s.focus({preventScroll:e}),o.remove()})}},[r,S,V,R,b,f,v,O,m,M,w]),c.useEffect(()=>{queueMicrotask(()=>{T.current=!1})},[r]),Ni(()=>{if(!r&&A)return A.setFocusManagerState({modal:u,closeOnFocusOut:p,open:h,onOpenChange:g,refs:f}),()=>{A.setFocusManagerState(null)}},[r,A,u,h,g,f,p]),Ni(()=>{if(r)return;if(!V)return;if("function"!=typeof MutationObserver)return;if(x)return;const e=()=>{const e=V.getAttribute("tabindex"),t=N(),n=jr(Qr(S)),r=t.indexOf(n);-1!==r&&(L.current=r),C.current.includes("floating")||n!==f.domReference.current&&0===t.length?"0"!==e&&V.setAttribute("tabindex","0"):"-1"!==e&&V.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(V,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}},[r,S,V,f,C,N,x]);const j=!r&&_&&(!u||!E)&&(M||u);return c.createElement(c.Fragment,null,j&&c.createElement(bo,{"data-type":"inside",ref:null==A?void 0:A.beforeInsideRef,onFocus:e=>{if(u){const e=$();Ji("reference"===a[0]?e[0]:e[e.length-1])}else if(null!=A&&A.preserveTabOrder&&A.portalNode)if(T.current=!1,ho(e,A.portalNode)){const e=co()||w;null==e||e.focus()}else{var t;null==(t=A.beforeOutsideRef.current)||t.focus()}}}),!E&&F("start"),n,F("end"),j&&c.createElement(bo,{"data-type":"inside",ref:null==A?void 0:A.afterInsideRef,onFocus:e=>{if(u)Ji($()[0]);else if(null!=A&&A.preserveTabOrder&&A.portalNode)if(p&&(T.current=!0),ho(e,A.portalNode)){const e=po()||w;null==e||e.focus()}else{var t;null==(t=A.afterOutsideRef.current)||t.focus()}}}))}const Do={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Io={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},To=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function Po(e){void 0===e&&(e={});const{nodeId:t}=e,n=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,a=Wi(),i=c.useRef({}),[o]=c.useState(()=>Hi()),s=null!=Qi(),[l,u]=c.useState(r.reference),d=xi((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=Ki();Ni(()=>{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);fi(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),k=null!=l,R=vi(l),O=vi(a),A=vi(u),D=c.useCallback(()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:h};O.current&&(e.platform=O.current),pi(E.current,_.current,e).then(e=>{const t={...e,isPositioned:!1!==A.current};I.current&&!fi(C.current,t)&&(C.current=t,za.flushSync(()=>{p(t)}))})},[h,t,n,O,A]);hi(()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const I=c.useRef(!1);hi(()=>(I.current=!0,()=>{I.current=!1}),[]),hi(()=>{if(S&&(E.current=S),x&&(_.current=x),S&&x){if(R.current)return R.current(S,x,D);D()}},[S,x,D,R,k]);const T=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=gi(P.floating,d.x),r=gi(P.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...mi(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:D,refs:T,elements:P,floatingStyles:L}),[d,D,T,P,L])}({...e,elements:{...a,...s&&{reference:s}}}),f=c.useCallback(e=>{const t=br(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l(t),h.refs.setReference(t)},[h.refs]),m=c.useCallback(e=>{(br(e)||null===e)&&(d.current=e,o(e)),(br(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!br(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 Ni(()=>{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 Lo="active",Mo="selected";function Vo(e,t,n){const r=new Map,a="item"===n;let i=e;if(a&&e){const{[Lo]:t,[Mo]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[Eo]:""},...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&&[Lo,Mo].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 No=!1;function $o(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Fo(e,t){return $o(t,e===Ei||e===_i,e===Ci||e===ki)}function jo(e,t,n){return $o(t,e===_i,n?e===Ci:e===ki)||"Enter"===e||" "===e||""===e}function zo(e,t,n){return $o(t,n?e===ki:e===Ci,e===Ei)}function Bo(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 k=Xi(_o(a.floating)),R=Qi(),O=Ki(),A=xi(s),D=Zr(a.domReference),I=c.useRef(g),T=c.useRef(null!=u?u:-1),P=c.useRef(null),L=c.useRef(!0),M=c.useRef(A),V=c.useRef(!!a.floating),N=c.useRef(n),$=c.useRef(!1),F=c.useRef(!1),j=Xi(y),z=Xi(n),B=Xi(x),U=Xi(u),[W,H]=c.useState(),[q,G]=c.useState(),Q=xi(function(e,t,n){function r(e){m?(H(e.id),null==O||O.events.emit("virtualfocus",e),E&&(E.current=e)):Ji(e,{preventScroll:!0,sync:!(!Br().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!qr())&&(No||$.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))})});Ni(()=>{document.createElement("div").focus({get preventScroll(){return No=!0,!1}})},[]),Ni(()=>{l&&(n&&a.floating?I.current&&null!=u&&(F.current=!0,T.current=u,A(u)):V.current&&(T.current=-1,M.current(null)))},[l,n,a.floating,u,A]),Ni(()=>{if(l&&n&&a.floating)if(null==o){if($.current=!1,null!=U.current)return;if(V.current&&(T.current=-1,Q(i,T)),(!N.current||!V.current)&&I.current&&(null!=P.current||!0===I.current&&null==P.current)){let e=0;const t=()=>{if(null==i.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else T.current=null==P.current||jo(P.current,w,f)||h?Ai(i,j.current):Di(i,j.current),P.current=null,A(T.current)};t()}}else Oi(i,o)||(T.current=o,Q(i,T,F.current),F.current=!1)},[l,n,a.floating,o,U,h,i,w,f,A,Q,j]),Ni(()=>{var e;if(!l||a.floating||!O||m||!V.current)return;const t=O.nodesRef.current,n=null==(e=t.find(e=>e.id===R))||null==(e=e.context)?void 0:e.elements.floating,r=jr(Qr(a.floating)),i=t.some(e=>e.context&&zr(e.context.elements.floating,r));n&&!i&&L.current&&n.focus({preventScroll:!0})},[l,a.floating,O,R,m]),Ni(()=>{if(l&&O&&m&&!R)return O.events.on("virtualfocus",e),()=>{O.events.off("virtualfocus",e)};function e(e){G(e.id),E&&(E.current=e)}},[l,O,m,R,E]),Ni(()=>{M.current=A,V.current=!!a.floating}),Ni(()=>{n||(P.current=null)},[n]),Ni(()=>{N.current=n},[n]);const K=null!=o,Y=c.useMemo(()=>{function e(e){if(!n)return;const t=i.current.indexOf(e);-1!==t&&A(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&&(T.current=-1,Q(i,T),A(null),m||Ji(k.current,{preventScroll:!0}))}}};return t},[n,k,Q,v,i,A,m]),X=xi(e=>{if(L.current=!1,$.current=!0,229===e.which)return;if(!z.current&&e.currentTarget===k.current)return;if(h&&zo(e.key,w,f))return Xr(e),r(!1,e.nativeEvent,"list-navigation"),void(yr(a.domReference)&&(m?null==O||O.events.emit("virtualfocus",a.domReference):a.domReference.focus()));const t=T.current,o=Ai(i,y),s=Di(i,y);if(D||("Home"===e.key&&(Xr(e),T.current=o,A(T.current)),"End"===e.key&&(Xr(e),T.current=s,A(T.current))),S>1){const t=_||Array.from({length:i.current.length},()=>({width:1,height:1})),n=Pi(t,S,C),r=n.findIndex(e=>null!=e&&!Vi(i.current,e,y)),a=n.reduce((e,t,n)=>null==t||Vi(i.current,t,y)?e:n,-1),l=n[Ti({current:n.map(e=>null!=e?i.current[e]:null)},{event:e,orientation:w,loop:p,rtl:f,cols:S,disabledIndices:Mi([...y||i.current.map((e,t)=>Vi(i.current,t)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:Li(T.current>s?o:T.current,t,n,S,e.key===_i?"bl":e.key===(f?Ci:ki)?"tr":"tl"),stopEvent:!0})];if(null!=l&&(T.current=l,A(T.current)),"both"===w)return}if(Fo(e.key,w)){if(Xr(e),n&&!m&&jr(e.currentTarget.ownerDocument)===e.currentTarget)return T.current=jo(e.key,w,f)?o:s,void A(T.current);jo(e.key,w,f)?T.current=p?t>=s?d&&t!==i.current.length?-1:o:Ii(i,{startingIndex:t,disabledIndices:y}):Math.min(s,Ii(i,{startingIndex:t,disabledIndices:y})):T.current=p?t<=o?d&&-1!==t?i.current.length:s:Ii(i,{startingIndex:t,decrement:!0,disabledIndices:y}):Math.max(o,Ii(i,{startingIndex:t,decrement:!0,disabledIndices:y})),Oi(i,T.current)?A(null):A(T.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,...!Zr(a.domReference)&&Z,onKeyDown:X,onPointerMove(){L.current=!0}}),[Z,X,a.domReference,w]),ee=c.useMemo(()=>{function e(e){"auto"===g&&Wr(e.nativeEvent)&&(I.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 $o(t,n?e===Ci:e===ki,e===_i)}(e.key,w,f),l=zo(e.key,w,f),c=Fo(e.key,w),d=(h?s:c)||"Enter"===e.key||""===e.key.trim();if(m&&n){const t=null==O?void 0:O.nodesRef.current.find(e=>null==e.parentId),n=O&&t?function(e,t){let n,r=-1;return function t(a,i){i>r&&(n=a,r=i),eo(e,a).forEach(e=>{t(e.id,i+1)})}(t,0),e.find(e=>e.id===n)}(O.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&&(Xr(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 Xr(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&&(Xr(e),n?(T.current=Ai(i,j.current),A(T.current)):r(!0,e.nativeEvent,"list-navigation")):c&&(null!=u&&(T.current=u),Xr(e),!n&&b?r(!0,e.nativeEvent,"list-navigation"):X(e),n&&A(T.current)))},onFocus(){n&&!m&&A(null)},onPointerDown:function(e){I.current=g,"auto"===g&&Hr(e.nativeEvent)&&(I.current=!0)},onMouseDown:e,onClick:e}},[W,Z,X,j,g,i,h,A,r,n,b,w,f,u,O,m,E]);return c.useMemo(()=>l?{reference:ee,floating:J,item:Y}:{},[l,ee,J,Y])}const Uo=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Wo(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 Ho(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}const qo=(e,t,n)=>{let r;return function(...a){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,a),n)}},Go=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Qo=e=>e,Ko=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},Yo=(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(Go(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(Go(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},Xo={passive:!0},Zo="undefined"==typeof window||"onscrollend"in window,Jo=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let a=0;const i=e.options.useScrollendEvent&&Zo?()=>{}:qo(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,Xo);const u=e.options.useScrollendEvent&&Zo;return u&&n.addEventListener("scrollend",l,Xo),()=>{n.removeEventListener("scroll",s),u&&n.removeEventListener("scrollend",l)}},es=(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"]},ts=(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 ns{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:Qo,rangeExtractor:Ko,onChange:()=>{},measureElement:es,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=Wo(()=>(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=Wo(()=>[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=Wo(()=>[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=Wo(()=>[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=rs(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=Wo(()=>{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=Wo(()=>[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 Ho(t[rs(0,t.length-1,e=>Ho(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 rs=(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 as="undefined"!=typeof document?c.useLayoutEffect:c.useEffect;function is(e){const t=c.useReducer(()=>({}),{})[1],n={...e,onChange:(n,r)=>{var a;r?(0,za.flushSync)(t):t(),null==(a=e.onChange)||a.call(e,n,r)}},[r]=c.useState(()=>new ns(n));return r.setOptions(n),as(()=>r._didMount(),[]),as(()=>r._willUpdate()),r}const os=(0,c.forwardRef)(function({children:e,active:t,addGroupBottomBorder:n,isMultiValueEdit:r,checked:a,...i},o){const s=(0,st.useStyles2)(ss),l=(0,c.useId)();return p().createElement("div",{ref:o,role:"option",id:l,"aria-selected":t,className:(0,vt.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(st.Checkbox,{tabIndex:-1,checked:a,className:s.checkbox}):null,e)))}),ss=e=>({option:(0,vt.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,vt.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,vt.css)({label:"grafana-select-option-body",display:"flex",fontWeight:e.typography.fontWeightMedium,flexDirection:"column",flexGrow:1}),groupBottomBorder:(0,vt.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),checkbox:(0,vt.css)({paddingRight:e.spacing(.5)}),multiValueApplyWrapper:(0,vt.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)}`})}),ls=()=>p().createElement(os,{onClick:e=>e.stopPropagation()},p().createElement(me.x6,{i18nKey:"grafana-scenes.variables.loading-options-placeholder.loading-options"},"Loading options...")),us=()=>p().createElement(os,{onClick:e=>e.stopPropagation()},p().createElement(me.x6,{i18nKey:"grafana-scenes.variables.no-options-placeholder.no-options-found"},"No options found")),cs=({handleFetchOptions:e})=>p().createElement(os,{onClick:e},p().createElement(me.x6,{i18nKey:"grafana-scenes.variables.options-error-placeholder.error-occurred-fetching-labels-click-retry"},"An error has occurred fetching labels. Click to retry")),ds=({onApply:e,floatingElement:t,maxOptionWidth:n,menuHeight:r})=>{const a=(0,st.useStyles2)(ss),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(st.Button,{onClick:e,size:"sm",tabIndex:-1},p().createElement(me.x6,{i18nKey:"grafana-scenes.variables.multi-value-apply-button.apply"},"Apply")))},ps={key:"operator",operator:"value",value:"key"},hs=(e,t,n,r,a)=>fs(ps[e],t,"value"===e?n:void 0,r,a),fs=(e,t,n,r,a)=>{t(e),null==n||n(void 0,a),setTimeout(()=>null==r?void 0:r.focus())},ms=({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(Us(n.operator)&&!Us(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(Us(t.value)&&!Us(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}},gs="Filter by label values",vs=(e,t,n,r,a)=>{var i;return"key"===t?a||gs:"value"===t?n?"Edit values":(null==(i=e.valueLabels)?void 0:i[0])||"":e[t]&&!r?`${e[t]}`:a||gs},bs=({populateInputOnEdit:e,item:t,filterInputType:n,setInputValue:r,filter:a})=>{var i,o,s;e&&!Us(t.value||"")&&"value"===ps[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("")},ys=({open:e,onOpenChange:t,activeIndex:n,setActiveIndex:r,outsidePressIdsToIgnore:a,listRef:i,disabledIndicesRef:o})=>{const{refs:s,floatingStyles:l,context:u}=Po({whileElementsMounted:li,open:e,onOpenChange:t,placement:"bottom-start",middleware:[(d=10,{...ui(d),options:[d,p]}),bi({padding:10}),yi({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=Uo.get(o))?n:o,l=Wi(),u=null!=Qi(),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=Ki(),v=xi("function"==typeof l?l:()=>!1),b="function"==typeof l?v:l,y=c.useRef(!1),w=c.useRef(!1),{escapeKey:S,outsidePress:x}=To(f),{escapeKey:E,outsidePress:_}=To(m),C=c.useRef(!1),k=xi(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?eo(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")}),R=xi(e=>{var t;const n=()=>{var t;k(e),null==(t=Yr(e))||t.removeEventListener("keydown",n)};null==(t=Yr(e))||t.addEventListener("keydown",n)}),O=xi(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=Yr(e),l="["+Yi("inert")+"]",c=Qr(a.floating).querySelectorAll(l);let d=br(s)?s:null;for(;d&&!Pr(d);){const e=Vr(d);if(Pr(e)||!br(e))break;d=e}if(c.length&&br(s)&&!s.matches("html,body")&&!zr(s,a.floating)&&Array.from(c).every(e=>!zr(d,e)))return;if(yr(s)&&I){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"===Lr(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&&eo(g.nodesRef.current,p).some(t=>{var n;return Kr(e,null==(n=t.context)?void 0:n.elements.floating)});if(Kr(e,a.floating)||Kr(e,a.domReference)||h)return;const f=g?eo(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")}),A=xi(e=>{var t;const n=()=>{var t;O(e),null==(t=Yr(e))||t.removeEventListener(u,n)};null==(t=Yr(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},Ir()?5:0)}const d=Qr(a.floating);s&&(d.addEventListener("keydown",E?R:k,E),d.addEventListener("compositionstart",l),d.addEventListener("compositionend",c)),b&&d.addEventListener(u,_?A:O,_);let p=[];return h&&(br(a.domReference)&&(p=$r(a.domReference)),br(a.floating)&&(p=p.concat($r(a.floating))),!br(a.reference)&&a.reference&&a.reference.contextElement&&(p=p.concat($r(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?R:k,E),d.removeEventListener("compositionstart",l),d.removeEventListener("compositionend",c)),b&&d.removeEventListener(u,_?A:O,_),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,a,s,b,u,n,r,h,o,S,x,k,E,R,O,_,A]),c.useEffect(()=>{y.current=!1},[b,u]);const D=c.useMemo(()=>({onKeyDown:k,[Do[p]]:e=>{d&&r(!1,e.nativeEvent,"reference-press")}}),[k,r,d,p]),I=c.useMemo(()=>({onKeyDown:k,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[Io[u]]:()=>{y.current=!0}}),[k,u]);return c.useMemo(()=>o?{reference:D,floating:I}:{},[o,D,I])}(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=Bo(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=>Vo(t,e,"reference"),t),i=c.useCallback(t=>Vo(t,e,"floating"),n),o=c.useCallback(t=>Vo(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}},ws=({item:e,handleRemoveMultiValue:t,index:n,handleEditMultiValuePill:r})=>{var a,i;const o=(0,st.useStyles2)(Ss),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,vt.cx)(o.basePill,o.valuePill),onClick:s,onKeyDown:l,tabIndex:0,id:`${e.value}-${n}`},null!=(a=e.label)?a:e.value,p().createElement(st.Button,{onClick:u,onKeyDownCapture:d,fill:"text",size:"sm",variant:"secondary",className:o.removeButton,tooltip:(0,me.t)("grafana-scenes.components.adhoc-filters-combobox.remove-filter-value","Remove filter value - {{itemLabel}}",{itemLabel:null!=(i=e.label)?i:e.value})},p().createElement(st.Icon,{name:"times",size:"md",id:`${e.value}-${n}-close-icon`})))},Ss=e=>({basePill:(0,vt.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,vt.css)({background:e.colors.action.selected,padding:e.spacing(.125,0,.125,1)}),removeButton:(0,vt.css)({marginInline:e.spacing(.5),height:"100%",padding:0,cursor:"pointer","&:hover":{color:e.colors.text.primary}})}),xs=(0,c.forwardRef)(function({filter:e,controller:t,isAlwaysWip:n,handleChangeViewMode:r,focusOnWipInputRef:a,populateInputOnEdit:i},o){var s,l,u;const[d,h]=(0,c.useState)(!1),[f,m]=(0,c.useState)([]),[g,v]=(0,c.useState)(!1),[b,y]=(0,c.useState)(!1),[w,S]=(0,c.useState)(""),[x,E]=(0,c.useState)(null),[_,C]=(0,c.useState)(n?"key":"value"),[k,R]=(0,c.useState)(!n&&"value"===_),O=(0,st.useStyles2)(Es),[A,D]=(0,c.useState)([]),[I,T]=(0,c.useState)({}),{allowCustomValue:P=!0,onAddCustomValue:L,filters:M,inputPlaceholder:V}=t.useState(),N=(0,c.useRef)(null),$=Us((null==e?void 0:e.operator)||""),F=$&&"value"===_,j=(0,c.useId)(),z=(0,c.useRef)([]),B=(0,c.useRef)([]),U=(0,c.useRef)(n?"key":"value"),W=(0,c.useMemo)(()=>nr(f),[f]),H=(0,c.useMemo)(()=>!n&&M.at(-1)===e,[e,n,M]),q=(0,c.useCallback)(()=>{n&&(t.addWip(),C("key"),S(""))},[t,n]),G=(0,c.useCallback)((e,t,n,r)=>{var a;if(!n.length&&t.origin&&e.updateToMatchAll(t),n.length){const r=[],i=[];n.forEach(e=>{var t;r.push(null!=(t=e.label)?t:e.value),i.push(e.value)});let o=!0;Array.isArray(t.values)&&t.values.length===i.length&&(o=!t.values.every((e,t)=>e===i[t])),o&&(null==(a=e.startProfile)||a.call(e,ee)),e.updateFilter(t,{valueLabels:r,values:i,value:i[0]}),D([])}r||setTimeout(()=>{var e;return null==(e=X.domReference.current)?void 0:e.focus()})},[]),Q=(0,c.useCallback)(e=>{D(t=>t.some(t=>t.value===e.value)?t.filter(t=>t.value!==e.value):[...t,e])},[]),K=(0,c.useCallback)((n,a,i)=>{h(n),i&&["outside-press","escape-key"].includes(i)&&(F?G(t,e,A):e&&e.origin&&""===w&&t.updateToMatchAll(e),q(),null==r||r())},[e,A,r,G,q,w,F,t]),Y=(0,c.useMemo)(()=>[j,...A.reduce((e,t,n)=>[...e,`${t.value}-${n}`,`${t.value}-${n}-close-icon`],[])],[j,A]),{refs:X,floatingStyles:Z,context:te,getReferenceProps:ne,getFloatingProps:re,getItemProps:ae}=ys({open:d,onOpenChange:K,activeIndex:x,setActiveIndex:E,outsidePressIdsToIgnore:Y,listRef:z,disabledIndicesRef:B});(0,c.useImperativeHandle)(o,()=>()=>{var e;return null==(e=X.domReference.current)?void 0:e.focus()},[X.domReference]);const ie=(0,c.useCallback)(e=>{D(t=>t.filter(t=>t.value!==e.value)),setTimeout(()=>{var e;return null==(e=X.domReference.current)?void 0:e.focus()})},[X.domReference]),oe=(e=>e.flatMap(e=>e.options?[e,...e.options]:[e]))(cl(W(k?"":w)));if(P&&"operator"!==_&&w){const t=Ms.find(t=>(null==e?void 0:e.operator)===t.value),n={value:w.trim(),label:w.trim(),isCustom:!0};(null==t?void 0:t.isRegex)?oe.unshift(n):oe.push(n)}const 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})(oe,z,B),le=(0,c.useCallback)(async n=>{var r,a,i,o;const s="key"===n?"adhoc_keys_dropdown":"adhoc_values_dropdown";"operator"!==n&&(null==(r=t.startInteraction)||r.call(t,s)),y(!1),v(!0),m([]);let l=[];try{if("key"===n?l=await t.getKeys(null):"operator"===n?l=t.getOperators():"value"===n&&(l=await t.getValuesFor(e)),U.current!==n)return void(null==(a=t.stopInteraction)||a.call(t));m(l),(null==(i=l[0])?void 0:i.group)?E(1):E(0)}catch(e){y(!0)}v(!1),null==(o=t.stopInteraction)||o.call(t)},[e,t]),ue=function(e){return is({observeElementRect:Yo,observeElementOffset:Jo,scrollToFn:ts,...e})}({count:oe.length,getScrollElement:()=>X.floating.current,estimateSize:e=>oe[e].description?60:38,overscan:5}),ce=(0,c.useCallback)((r,i)=>{var o;if("Backspace"===r.key&&!w){if("value"===_){if(i&&A.length)return void D(e=>{const t=[...e];return t.splice(-1,1),t});if(null==e?void 0:e.origin)return;return void C("operator")}null==a||a(),zs(e)&&(null==(o=t.startProfile)||o.call(t,J)),t.handleComboboxBackspace(e),n&&q()}},[w,_,t,e,n,A.length,q,a]),de=(0,c.useCallback)((n,a)=>{var i;"Tab"!==n.key||n.shiftKey||(a&&(n.preventDefault(),G(t,e,A),null==(i=X.domReference.current)||i.focus()),null==r||r(),q())},[e,A,r,G,q,t,X.domReference]),pe=(0,c.useCallback)((n,a)=>{"Tab"===n.key&&n.shiftKey&&(a&&(n.preventDefault(),G(t,e,A,!0)),null==r||r(),q())},[e,A,r,G,q,t]),he=(0,c.useCallback)((n,o)=>{var s;if("Enter"===n.key&&null!=x){if(!oe[x])return;const n=oe[x];if(o)Q(n),S("");else{const o=ms({filterInputType:_,item:n,filter:e,setFilterMultiValues:D,onAddCustomValue:L});"value"===_&&o.value!==(null==e?void 0:e.value)&&(null==(s=t.startProfile)||s.call(t,ee)),t.updateFilter(e,o),bs({populateInputOnEdit:i,item:n,filterInputType:_,setInputValue:S,filter:e}),hs(_,C,r,X.domReference.current,!H&&void 0),E(null),H&&(null==a||a())}}},[x,oe,Q,t,e,_,i,r,X.domReference,H,a,L]),fe=(0,c.useCallback)(e=>{var t;const n=e.label||e.value;D(t=>t.filter(t=>t.value!==e.value)),R(!0),S(n),null==(t=X.domReference.current)||t.focus(),setTimeout(()=>{var e;null==(e=X.domReference.current)||e.select()})},[X.domReference]);(0,c.useEffect)(()=>{d&&le(_)},[d,_]),(0,c.useEffect)(()=>{var t,r,a,o;if(!n){if($&&(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}]},[]);D(t)}!$&&i&&(S(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=X.domReference.current)||e.select()})),null==(o=X.domReference.current)||o.focus()}},[]),(0,c.useEffect)(()=>{F&&A&&setTimeout(()=>T({}))},[A,F]),(0,c.useLayoutEffect)(()=>{U.current&&(U.current=_)},[_]),(0,c.useLayoutEffect)(()=>{var e,t;null!==x&&ue.range&&(x>(null==(e=ue.range)?void 0:e.endIndex)||x<(null==(t=ue.range)?void 0:t.startIndex))&&ue.scrollToIndex(x)},[x,ue]);const ge=null!=(s=null==e?void 0:e.keyLabel)?s:null==e?void 0:e.key;return p().createElement("div",{className:O.comboboxWrapper},e?p().createElement("div",{className:O.pillWrapper},(null==e?void 0:e.key)?p().createElement("div",{className:(0,vt.cx)(O.basePill,O.keyPill)},ge):null,(null==e?void 0:e.key)&&(null==e?void 0:e.operator)&&"operator"!==_?p().createElement("div",{id:j,className:(0,vt.cx)(O.basePill,!e.origin&&O.operatorPill,e.origin&&O.keyPill,j),"aria-label":(0,me.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(),S(""),fs("operator",C,void 0,X.domReference.current))},onKeyDown:t=>{e.origin||(pe(t,$),"Enter"===t.key&&(S(""),fs("operator",C,void 0,X.domReference.current)))},...!e.origin&&{role:"button"}},e.operator):null,p().createElement("div",{ref:N}),F?A.map((e,t)=>p().createElement(ws,{key:`${e.value}-${t}`,item:e,index:t,handleRemoveMultiValue:ie,handleEditMultiValuePill:fe})):null):null,p().createElement("input",{...ne({ref:X.setReference,onChange:function(e){const t=e.target.value;S(t),E(0),k&&R(!1)},value:w,placeholder:vs(e,_,F,n,V),"aria-autocomplete":"list",onKeyDown(e){d?("operator"===_&&pe(e),ce(e,F),de(e,F),he(e,F)):h(!0)}}),className:(0,vt.cx)(O.inputStyle,{[O.loadingInputPadding]:!g}),onClick:e=>{e.stopPropagation(),h(!0)},onFocus:()=>{h(!0)}}),g?p().createElement(st.Spinner,{className:O.loadingIndicator,inline:!0}):null,p().createElement(So,null,d&&p().createElement(Ao,{context:te,initialFocus:-1,visuallyHiddenDismiss:!0,modal:!0},p().createElement(p().Fragment,null,p().createElement("div",{style:{...Z,width:`${b?366:se}px`,transform:F?`translate(${(null==(l=N.current)?void 0:l.getBoundingClientRect().left)||0}px, ${((null==(u=X.domReference.current)?void 0:u.getBoundingClientRect().bottom)||0)+10}px )`:Z.transform},ref:X.setFloating,className:O.dropdownWrapper,tabIndex:-1},p().createElement("div",{style:{height:`${ue.getTotalSize()||38}px`},...re(),tabIndex:-1},g?p().createElement(ls,null):b?p().createElement(cs,{handleFetchOptions:()=>le(_)}):oe.length||P&&"operator"!==_&&w?ue.getVirtualItems().map(n=>{var a;const o=oe[n.index],s=n.index;if(o.options)return p().createElement("div",{key:`${o.label}+${s}`,className:(0,vt.cx)(O.optionGroupLabel,O.groupTopBorder),style:{height:`${n.size}px`,transform:`translateY(${n.start}px)`}},p().createElement(st.Text,{weight:"bold",variant:"bodySmall",color:"secondary"},o.label));const l=oe[n.index+1],u=l&&!l.group&&!l.options&&o.group,c=null!=(a=o.label)?a:o.value;return p().createElement(os,{...ae({key:`${o.value}-${s}`,ref(e){z.current[s]=e},onClick(n){var a,s;if("value"!==_&&n.stopPropagation(),F)n.preventDefault(),n.stopPropagation(),Q(o),S(""),null==(a=X.domReference.current)||a.focus();else{const n=ms({filterInputType:_,item:o,filter:e,setFilterMultiValues:D,onAddCustomValue:L});"value"===_&&n.value!==(null==e?void 0:e.value)&&(null==(s=t.startProfile)||s.call(t,ee)),t.updateFilter(e,n),bs({populateInputOnEdit:i,item:o,filterInputType:_,setInputValue:S,filter:e}),hs(_,C,r,X.domReference.current,!1)}}}),active:x===s,addGroupBottomBorder:u,style:{height:`${n.size}px`,transform:`translateY(${n.start}px)`},"aria-setsize":oe.length,"aria-posinset":n.index+1,isMultiValueEdit:F,checked:A.some(e=>e.value===o.value)},p().createElement("span",null,o.isCustom?(0,me.t)("grafana-scenes.components.adhoc-filters-combobox.use-custom-value","Use custom value: {{itemLabel}}",{itemLabel:c}):c),o.description?p().createElement("div",{className:O.descriptionText},o.description):null)}):p().createElement(us,null))),F&&!g&&!b&&oe.length?p().createElement(ds,{onApply:()=>{G(t,e,A)},floatingElement:X.floating.current,maxOptionWidth:se,menuHeight:Math.min(ue.getTotalSize(),300)}):null))))}),Es=e=>({comboboxWrapper:(0,vt.css)({display:"flex",flexWrap:"wrap"}),pillWrapper:(0,vt.css)({display:"flex",alignItems:"center",flexWrap:"wrap"}),basePill:(0,vt.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,vt.css)({fontWeight:e.typography.fontWeightBold,cursor:"default"}),operatorPill:(0,vt.css)({"&:hover":{background:e.colors.action.hover}}),dropdownWrapper:(0,vt.css)({backgroundColor:e.colors.background.primary,color:e.colors.text.primary,boxShadow:e.shadows.z2,overflowY:"auto",zIndex:e.zIndex.portal}),inputStyle:(0,vt.css)({paddingBlock:0,"&:focus":{outline:"none"}}),loadingIndicator:(0,vt.css)({color:e.colors.text.secondary,marginLeft:e.spacing(.5)}),loadingInputPadding:(0,vt.css)({paddingRight:e.spacing(2.5)}),optionGroupLabel:(0,vt.css)({padding:e.spacing(1),position:"absolute",top:0,left:0,width:"100%"}),groupTopBorder:(0,vt.css)({"&:not(:first-child)":{borderTop:`1px solid ${e.colors.border.weak}`}}),descriptionText:(0,vt.css)({...e.typography.bodySmall,color:e.colors.text.secondary,paddingTop:e.spacing(.5)})});function _s({filter:e,controller:t,readOnly:n,focusOnWipInputRef:r}){var a,i,o,s;const l=(0,st.useStyles2)(Cs),[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,vt.cx)(l.pillText,e.nonApplicable&&l.strikethrough)},a);return p().createElement("div",{className:(0,vt.cx)(l.combinedFilterPill,n&&l.readOnlyCombinedFilter,(js(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,me.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(st.Tooltip,{content:p().createElement("div",{className:l.tooltipText},a),placement:"top"},i),n||e.matchAllFilter||e.origin&&"dashboard"!==e.origin?null:p().createElement(st.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,vt.cx)(l.pillIcon,e.nonApplicable&&l.disabledPillIcon),tooltip:(0,me.t)("grafana-scenes.components.adhoc-filter-pill.remove-filter-with-key","Remove filter with key {{keyLabel}}",{keyLabel:b})}),e.origin&&e.readOnly&&p().createElement(st.Tooltip,{content:(0,me.t)("grafana-scenes.components.adhoc-filter-pill.managed-filter","{{origin}} managed filter",{origin:e.origin}),placement:"bottom"},p().createElement(st.Icon,{name:"lock",size:"md",className:l.readOnlyPillIcon})),e.origin&&x&&p().createElement(st.Tooltip,{content:S(e.origin).info,placement:"bottom"},p().createElement(st.Icon,{name:"info-circle",size:"md",className:l.infoPillIcon})),e.origin&&e.restorable&&!e.readOnly&&p().createElement(st.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:js(e)?l.matchAllPillIcon:l.pillIcon,tooltip:S(e.origin).restore}),e.nonApplicable&&p().createElement(st.Tooltip,{content:null!=(s=e.nonApplicableReason)?s:(0,me.t)("grafana-scenes.components.adhoc-filter-pill.non-applicable","Filter is not applicable"),placement:"bottom"},p().createElement(st.Icon,{name:"info-circle",size:"md",className:l.infoPillIcon})))}return p().createElement(xs,{filter:e,controller:t,handleChangeViewMode:w,focusOnWipInputRef:r,populateInputOnEdit:g})}const Cs=e=>({combinedFilterPill:(0,vt.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,vt.css)({paddingRight:e.spacing(1),cursor:"text","&:hover":{background:e.colors.action.selected}}),filterReadOnly:(0,vt.css)({background:e.colors.background.canvas,cursor:"text","&:hover":{background:e.colors.background.canvas}}),pillIcon:(0,vt.css)({marginInline:e.spacing(.5),cursor:"pointer","&:hover":{color:e.colors.text.primary}}),pillText:(0,vt.css)({maxWidth:"200px",width:"100%",textOverflow:"ellipsis",overflow:"hidden"}),tooltipText:(0,vt.css)({textAlign:"center"}),infoPillIcon:(0,vt.css)({marginInline:e.spacing(.5),cursor:"pointer"}),readOnlyPillIcon:(0,vt.css)({marginInline:e.spacing(.5)}),matchAllPillIcon:(0,vt.css)({marginInline:e.spacing(.5),cursor:"pointer",color:e.colors.text.disabled}),disabledPillIcon:(0,vt.css)({marginInline:e.spacing(.5),cursor:"pointer",color:e.colors.text.disabled,"&:hover":{color:e.colors.text.disabled}}),...dl(e)}),ks=(0,c.forwardRef)(function({controller:e},t){const{wip:n}=e.useState();return(0,c.useLayoutEffect)(()=>{n||e.addWip()},[n]),p().createElement(xs,{controller:e,filter:n,isAlwaysWip:!0,ref:t})}),Rs=(0,c.memo)(function({controller:e}){const{originFilters:t,filters:n,readOnly:r}=e.useState(),a=(0,st.useStyles2)(Os),i=(0,c.useRef)();return p().createElement("div",{className:(0,vt.cx)(a.comboboxWrapper,{[a.comboboxFocusOutline]:!r}),onClick:()=>{var e;null==(e=i.current)||e.call(i)}},p().createElement(st.Icon,{name:"filter",className:a.filterIcon,size:"lg"}),null==t?void 0:t.map((t,n)=>t.origin?p().createElement(_s,{key:`${n}-${t.key}`,filter:t,controller:e,focusOnWipInputRef:i.current}):null),n.filter(e=>!e.hidden).map((t,n)=>p().createElement(_s,{key:`${n}-${t.key}`,filter:t,controller:e,readOnly:r||t.readOnly,focusOnWipInputRef:i.current})),r?null:p().createElement(ks,{controller:e,ref:i}))}),Os=e=>({comboboxWrapper:(0,vt.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,vt.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,vt.css)({color:e.colors.text.secondary,alignSelf:"center"})}),As=Object.fromEntries(Object.entries(i.scopeFilterOperatorMap).map(([e,t])=>[t,e]));function Ds(e){return new Set(["equals","not-equals","one-of","not-one-of"]).has(e)}function Is(e){return new Set(["regex-match","regex-not-match"]).has(e)}function Ts(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(!Ds(n)||!Ds(t))return!1;return Ps(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===As.equals?e.operator=As["one-of"]:"not-equals"===t.operator&&e.operator===As["not-equals"]&&(e.operator=As["not-one-of"])}(o,n):o&&function(e,t){const n=i.scopeFilterOperatorMap[e];if(!Is(n)||!Is(t))return!1;return Ps(n,t)}(o.operator,n.operator)?(o.value+=`|${n.value}`,o.values=[o.value]):o?t.push({key:n.key,operator:As[n.operator],value:n.value,values:null!=(a=n.values)?a:[n.value],origin:"scope"}):e.set(n.key,{key:n.key,operator:As[n.operator],value:n.value,values:null!=(r=n.values)?r:[n.value],origin:"scope"})}function Ps(e,t){return!(e.includes("not")&&!t.includes("not")||!e.includes("not")&&t.includes("not"))}class Ls{constructor(e){this.model=e}useState(){const e=this.model.useState();return{filters:e.filters,originFilters:e.originFilters,readOnly:e.readOnly,allowCustomValue:e.allowCustomValue,supportsMultiValueOperators:e.supportsMultiValueOperators,onAddCustomValue:e.onAddCustomValue,wip:e._wip}}async getKeys(e){return this.model._getKeys(e)}async getValuesFor(e){return this.model._getValuesFor(e)}getOperators(){return this.model._getOperators()}updateFilter(e,t){this.model._updateFilter(e,t)}updateToMatchAll(e){this.model.updateToMatchAll(e)}removeFilter(e){this.model._removeFilter(e)}removeLastFilter(){this.model._removeLastFilter()}handleComboboxBackspace(e){this.model._handleComboboxBackspace(e)}addWip(){this.model._addWip()}restoreOriginalFilter(e){this.model.restoreOriginalFilter(e)}startProfile(e){const t=j(this.model);null==t||t.startProfile(e)}startInteraction(e){const t=un(this.model);null==t||t.startInteraction(e)}stopInteraction(){const e=un(this.model);null==e||e.stopInteraction()}}const Ms=[{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 Vs 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:Ns(e.expressionBuilder,[...null!=(n=e.originFilters)?n:[],...null!=(r=e.filters)?r:[]]),...e}),this._scopedVars={__sceneObject:rn(this)},this._dataSourceSrv=(0,o.getDataSourceSrv)(),this._originalValues=new Map,this._prevScopes=[],this._variableDependency=new hl(this,{dependsOnScopes:!0,onReferencedVariableValueChanged:()=>this._updateScopesFilters()}),this._urlSync=new ur(this),this._debouncedVerifyApplicability=(0,k.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(()=>(Zn.add(e),()=>Zn.delete(e))),Un)return;const t=(0,o.getTemplateSrv)();(null==t?void 0:t.getAdhocFilters)&&(Un=t.getAdhocFilters,t.getAdhocFilters=function(e){var n;if(0===Zn.size)return Un.call(t,e);const r=(0,o.getDataSourceSrv)().getInstanceSettings(e);if(!r)return[];for(const e of Zn.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=Fl.getScopes(this);if(!n||!n.length)return void this.setState({originFilters:null==(e=this.state.originFilters)?void 0:e.filter(e=>"scope"!==e.origin)});const r=function(e){const t=new Map,n=[],r=e.flatMap(e=>e.spec.filters);for(const e of r)Ts(t,n,e);return[...t.values(),...n]}(n);if(!r.length)return;let a=r;const i=[],o=[];if(a.forEach(e=>{var t;this._originalValues.set(`${e.key}-${e.origin}`,{value:null!=(t=e.values)?t:[e.value],operator:e.operator})}),null==(t=this.state.originFilters)||t.forEach(e=>{"scope"===e.origin?i.push(e):o.push(e)}),this._prevScopes.length)return this.setState({originFilters:[...a,...o]}),this._prevScopes=n,void this._debouncedVerifyApplicability();const s=i.filter(e=>e.restorable),l=s.map(e=>e.key),u=r.map(e=>e.key);a=[...s.filter(e=>u.includes(e.key)),...r.filter(e=>!l.includes(e.key))],this.setState({originFilters:[...a,...o]}),this._prevScopes=n,this._debouncedVerifyApplicability()}setState(e){var t,n;let r=!1;if((e.filters&&e.filters!==this.state.filters||e.originFilters&&e.originFilters!==this.state.originFilters)&&!e.filterExpression){const a=null!=(t=e.filters)?t:this.state.filters,i=null!=(n=e.originFilters)?n:this.state.originFilters;e.filterExpression=Ns(this.state.expressionBuilder,[...null!=i?i:[],...a]),r=e.filterExpression!==this.state.filterExpression}super.setState(e),r&&this.publishEvent(new ue(this),!0)}updateFilters(e,t){var n;let r,a=!1;e&&e!==this.state.filters&&(r=Ns(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 ue(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=j(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,k.isEqual)(i,null==a?void 0:a.value)||t.operator&&t.operator!==(null==a?void 0:a.operator)?t.restorable=!0:i&&(0,k.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=j(this);null==t||t.startProfile(J),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=Fl.getTimeRange(this).state.value,o=this.state.useQueriesAsFilterForOptions?nl(this):void 0,s=await a.getDrilldownsApplicability({filters:r,queries:o,timeRange:i,scopes:Fl.getScopes(this),...Zt(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 ll(o.values).map(Fs);if(this.state.defaultKeys)return this.state.defaultKeys.map(Fs);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=Fl.getTimeRange(this).state.value,d=this.state.useQueriesAsFilterForOptions?nl(this):void 0,p=await s.getTagKeys({filters:u,queries:d,timeRange:c,scopes:Fl.getScopes(this),...Zt(this)});ul(p)&&this.setState({error:p.error.message});let h=ll(p);o&&(h=h.concat(ll(o.values)));const f=this.state.tagKeyRegexFilter;return f&&(h=h.filter(e=>e.text.match(f))),h.map(Fs)}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 ll(i.values).map(Fs);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=Fl.getTimeRange(this).state.value,c=this.state.useQueriesAsFilterForOptions?nl(this):void 0;let d=Fl.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,...Zt(this)});ul(p)&&this.setState({error:p.error.message});let h=ll(p);return i&&(h=h.concat(ll(i.values))),h.map(Fs)}_addWip(){this.setState({_wip:{key:"",value:"",operator:"=",condition:""}})}_getOperators(){const{supportsMultiValueOperators:e,allowCustomValue:t=!0}=this.state;return Ms.filter(({isMulti:n,isRegex:r})=>!(!e&&n)&&!(!t&&r)).map(({value:e,description:t})=>({label:e,value:e,description:t}))}}function Ns(e,t){var n;return(null!=e?e:Zs)(null!=(n=null==t?void 0:t.filter(e=>Bs(e)))?n:[])}Vs.Component=function({model:e}){const{filters:t,readOnly:n,addFilterButtonText:r}=e.useState(),a=(0,st.useStyles2)($s),i=(0,c.useMemo)(()=>"combobox"===e.state.layout?new Ls(e):void 0,[e]);if(i)return p().createElement(Rs,{controller:i});return p().createElement("div",{className:a.wrapper},t.filter(e=>!e.hidden).map((t,n)=>p().createElement(p().Fragment,{key:n},p().createElement(ir,{filter:t,model:e}))),!n&&p().createElement(sr,{model:e,key:"'builder",addFilterButtonText:r}))};const $s=e=>({wrapper:(0,vt.css)({display:"flex",flexWrap:"wrap",alignItems:"flex-end",columnGap:e.spacing(2),rowGap:e.spacing(1)})});function Fs(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 js(e){return"=~"===e.operator&&".*"===e.value}function zs(e){return""!==e.key&&""!==e.operator&&""!==e.value}function Bs(e){return!e.nonApplicable}function Us(e){const t=Ms.find(t=>t.value===e);return!!t&&Boolean(t.isMulti)}class Ws{constructor(e){this._variableDependency=e}findAndSubscribeToDrilldowns(e){const t=function(e){var t;for(const n of Zn.values())if(Ml(n,null==(t=n.state.datasource)?void 0:t.uid)===e)return n}(e),n=function(e){var t;for(const n of ot.values())if(Ml(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=>zs(e)&&Bs(e)):void 0}getGroupByKeys(){return this._groupByVar?this._groupByVar.getApplicableKeys():void 0}cleanup(){this._adhocFiltersVar=void 0,this._groupByVar=void 0}}let Hs=100;function qs(){return"SQR"+Hs++}class Gs extends E{constructor(e){super(e),this._dataLayersMerger=new qn,this._variableValueRecorder=new tt,this._results=new h.ReplaySubject(1),this._scopedVars={__sceneObject:rn(this)},this._isInView=!0,this._bypassIsInView=!1,this._queryNotExecutedWhenOutOfView=!1,this._variableDependency=new hl(this,{statePaths:["queries","datasource","minInterval"],onVariableUpdateCompleted:this.onVariableUpdatesCompleted.bind(this),onAnyVariableChanged:this.onAnyVariableChanged.bind(this),dependsOnScopes:!0}),this._drilldownDependenciesManager=new Ws(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===B.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=Fl.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=Fl.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=Fl.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,at].includes(s.values[e]));const r=l.values[e].filter;if(r){const e=[...null!=(n=r.ids)?n:[],at].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(Ks(c)&&Ks(this._layerAnnotations)&&(0,k.isEqual)(u,null==(r=this.state.data)?void 0:r.alertState))return;this._layerAnnotations=c;const p=this.state.data?this.state.data:{...W,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 Vs&&this._isRelevantAutoVariable(e)&&this.runQueries(),e instanceof cn&&this._isRelevantAutoVariable(e)&&this.runQueries())}_isRelevantAutoVariable(e){var t,n;const r=null!=(t=this.state.datasource)?t:Qs(this.state.queries);return"auto"===e.state.applyMode&&(null==r?void 0:r.uid)===(null==(n=e.state.datasource)?void 0:n.uid)}shouldRunQueriesOnActivate(){return this._variableValueRecorder.hasDependenciesChanged(this)?($(),!0):!this.state.data||!!this._isDataTimeRangeStale(this.state.data)}_isDataTimeRangeStale(e){const t=Fl.getTimeRange(this).state.value,n=e.timeRange;return(t.from.unix()!==n.from.unix()||t.to.unix()!==n.to.unix())&&($(),!0)}_onDeactivate(){var e;this._querySub&&(this._querySub.unsubscribe(),this._querySub=void 0),this._dataLayersSub&&(this._dataLayersSub.unsubscribe(),this._dataLayersSub=void 0),null==(e=this._timeSub)||e.unsubscribe(),this._timeSub=void 0,this._timeSubRange=void 0,this._drilldownDependenciesManager.cleanup()}setContainerWidth(e){!this._containerWidth&&e>0?(this._containerWidth=e,this.state.maxDataPointsFromWidth&&!this.state.maxDataPoints&&setTimeout(()=>{this.isActive&&!this.state._hasFetchedData&&this.runQueries()},0)):e>0&&(this._containerWidth=e)}isDataReadyToDisplay(){return Boolean(this.state._hasFetchedData)}subscribeToTimeRangeChanges(e){this._timeSubRange!==e&&(this._timeSub&&this._timeSub.unsubscribe(),this._timeSubRange=e,this._timeSub=e.subscribeToState(()=>{this.runWithTimeRange(e)}))}runQueries(){const e=Fl.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:B.Done}})}async runWithTimeRange(e){var t,n,r;if(!this.state.maxDataPoints&&this.state.maxDataPointsFromWidth&&!this._containerWidth)return;if(this.isQueryModeAuto()&&!this._isInView&&!this._bypassIsInView)return void(this._queryNotExecutedWhenOutOfView=!0);if(this._queryNotExecutedWhenOutOfView=!1,this._dataLayersSub||this._handleDataLayers(),null==(t=this._querySub)||t.unsubscribe(),this._variableDependency.hasDependencyInLoadingState())return $(),void this.setState({data:{...null!=(n=this.state.data)?n:W,state:B.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:Qs(a),n=await et(t,this._scopedVars);this._drilldownDependenciesManager.findAndSubscribeToDrilldowns(n.uid);const i=(0,o.getRunRequest)(),{primary:s,secondaries:l,processors:u}=this.prepareRequests(e,n);$(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)}const d=Xn(this);c=c.pipe(Ze({type:"SceneQueryRunner/runQueries",request:s,origin:this,cancel:()=>this.cancelQuery()},d)),this._querySub=c.subscribe(this.onDataReceived)}catch(e){console.error("PanelQueryRunner Error",e),this.onDataReceived({...W,...this.state.data,state:B.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:W}),n}prepareRequests(e,t){var n;const{minInterval:r,queries:a}=this.state;let s={app:"scenes",requestId:qs(),timezone:e.getTimeZone(),range:e.state.value,interval:"1s",intervalMs:1e3,targets:(0,k.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:Fl.getScopes(this),...it(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?Ml(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=qs();h.push({...t,requestId:e}),f.set(e,null!=n?n:rt)}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!==W&&this.setState({data:W})}getClosestExtraQueryProviders(){const e=new Map;return this.parent?(q(this.parent,t=>(nt(t)&&!e.has(t.constructor)&&e.set(t.constructor,t),t.forEachChild(t=>{nt(t)&&!e.has(t.constructor)&&e.set(t.constructor,t)}),null)),Array.from(e.values())):[]}isQueryModeAuto(){var e;return"auto"===(null!=(e=this.state.runQueriesMode)?e:"auto")}isInViewChanged(e){$(0,0,this.state.key),this._isInView=e,e&&this._queryNotExecutedWhenOutOfView&&this.runQueries()}bypassIsInViewChanged(e){$(0,0,this.state.key),this._bypassIsInView=e,e&&this._queryNotExecutedWhenOutOfView&&this.runQueries()}}function Qs(e){var t,n;return null!=(n=null==(t=e.find(e=>null!==e.datasource))?void 0:t.datasource)?n:void 0}function Ks(e){if(!e)return!0;for(let t=0;t<e.length;t++)if(e[t].length>0)return!1;return!0}function Ys(e,t){return e===t||(0,k.isEqual)(e,t)}function Xs(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 Zs(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(el).join("|")):"!=|"===a?(a="!~",r=null==(n=e.values)?void 0:n.map(el).join("|")):r="=~"===a||"!~"===a?el(e.value):Js(e.value);return`${e.key}${a}"${r}"`}(e)).join(",")}function Js(e){return e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function el(e){return Js(e.replace(tl,"\\$&"))}const tl=/[*+?()|\\.\[\]{}^$]/g;function nl(e){var t;const n=Fl.findAllObjects(e.getRoot(),e=>e instanceof Gs),r=Fl.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 Fl.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 Fl.interpolate(e,t.datasource.uid)===r}))}),i}function rl(e){return null==e?"":/\|/g[Symbol.replace](e,"__gfp__")}function al(e){return null==e?"":/,/g[Symbol.replace](e,"__gfc__")}function il(e){return function(e){return null==e?"":/#/g[Symbol.replace](e,"__gfh__")}(rl(e))}function ol(e){return null==e?"":(e=/__gfp__/g[Symbol.replace](e,"|"),e=/__gfc__/g[Symbol.replace](e,","),e=/__gfh__/g[Symbol.replace](e,"#"))}function sl(e,t){return t&&e!==t?[e,t].map(al).join(","):al(e)}function ll(e){return Array.isArray(e)?e:e.data}function ul(e){return!Array.isArray(e)&&Boolean(e.error)}function cl(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 dl(e){return{disabledPill:(0,vt.css)({background:e.colors.action.selected,color:e.colors.text.disabled,border:0,"&:hover":{background:e.colors.action.selected}}),strikethrough:(0,vt.css)({textDecoration:"line-through"})}}class pl extends E{constructor(e){super({type:"constant",value:"",name:"",...e,skipUrlSync:!0}),this._variableDependency=new hl(this,{statePaths:["value"]}),this._prevValue=""}validateAndUpdate(){const e=this.getValue();return this._prevValue!==e&&(this._prevValue=e,this.publishEvent(new ue(this),!0)),(0,h.of)({})}getValue(){return"string"==typeof this.state.value?Fl.interpolate(this,this.state.value):this.state.value}}class hl{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;$(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=Fl.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(De),this._statePaths)for(const t of this._statePaths){if("*"===t){this.extractVariablesFrom(e);break}{const n=e[t];n&&this.extractVariablesFrom(n)}}}extractVariablesFrom(e){Oe.lastIndex=0;const t=("string"!=typeof e?Xs(e):e).matchAll(Oe);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=Fl.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 pl({name:"__from",value:e.from});this.variableUpdateCompleted(t,!0)}else if(a){const t=new pl({name:"__to",value:e.to});this.variableUpdateCompleted(t,!0)}if(e.timeZone!==t.timeZone&&i){const t=new pl({name:"__timezone",value:e.timeZone});this.variableUpdateCompleted(t,!0)}});return()=>e.unsubscribe()})}}const fl=e=>Boolean(e.metricFindQuery)&&!Boolean(e.variables),ml=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)},gl=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)},vl=e=>!!e.variables&&e.variables.getType()===i.VariableSupportType.Datasource;class bl{constructor(e,t=(0,o.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(ml(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 ml(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):xl()}}class yl{constructor(e){this.datasource=e}getTarget(e){if(fl(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({variable:e,searchFilter:t},n){return fl(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 xl();const t=e;return(0,h.of)({series:t,state:i.LoadingState.Done,timeRange:n.range})})):xl()}}class wl{constructor(e,t=(0,o.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(gl(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return gl(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):xl()}}class Sl{constructor(e,t=(0,o.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){var t;if(vl(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 vl(this.datasource)?this._runRequest(this.datasource,t):xl()}}function xl(){return(0,h.of)({state:i.LoadingState.Done,series:[],timeRange:(0,i.getDefaultTimeRange)()})}let El=function(e){if(ml(e))return new bl(e,(0,o.getRunRequest)());if(fl(e))return new yl(e);if(gl(e))return new wl(e);if(vl(e))return new Sl(e);throw new Error(`Couldn't create a query runner for datasource ${e.type}`)};const _l=(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},Cl=(e,t)=>{if(t===i.VariableSort.disabled)return e;switch(t){case i.VariableSort.alphabeticalAsc:e=(0,k.sortBy)(e,"label");break;case i.VariableSort.alphabeticalDesc:e=(0,k.sortBy)(e,"label").reverse();break;case i.VariableSort.numericalAsc:e=(0,k.sortBy)(e,kl);break;case i.VariableSort.numericalDesc:e=(e=(0,k.sortBy)(e,kl)).reverse();break;case i.VariableSort.alphabeticalCaseInsensitiveAsc:e=(0,k.sortBy)(e,e=>(0,k.toLower)(e.label));break;case i.VariableSort.alphabeticalCaseInsensitiveDesc:e=(e=(0,k.sortBy)(e,e=>(0,k.toLower)(e.label))).reverse();break;case i.VariableSort.naturalAsc||7:e=Ol(e);break;case i.VariableSort.naturalDesc||8:e=(e=Ol(e)).reverse()}return e};function kl(e){if(!e.label)return-1;const t=e.label.match(/.*?(\d+).*/);return!t||t.length<2?-1:parseInt(t[1],10)}const Rl=new Intl.Collator(void 0,{sensitivity:"accent",numeric:!0});function Ol(e){return e.slice().sort((e,t)=>Rl.compare(e.label,t.label))}function Al(){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 Dl extends Ne{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 hl(this,{statePaths:["regex","query","datasource"]}),this.onSearchChange=e=>{Xs(this.state.query).indexOf(Ae)>-1&&this._updateOptionsBasedOnSearchFilter(e)},this._updateOptionsBasedOnSearchFilter=(0,k.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)(et(this.state.datasource,{__sceneObject:rn(this)})).pipe((0,h.mergeMap)(t=>{const n=El(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)),Al(),(0,h.mergeMap)(e=>{let t="";this.state.regex&&(t=Fl.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,k.isNumber)(g)&&(g=g.toString()),(0,k.isNumber)(i)&&(i=i.toString()),f){const e=_l(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,k.uniqBy)(m,"value"),Cl(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=Cl(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:rn(this)};t&&(n.__searchFilter={value:t,text:t});const r=Fl.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()}}}Dl.Component=({model:e})=>p().createElement(Kt,{model:e});var Il=n(2245);class Tl extends E{constructor(e){super({skipUrlSync:!0,loading:!0,scopes:[],...e,type:"system",name:De,hide:Il.zL.hideVariable}),this._renderBeforeActivation=!0,this.UNSAFE_renderAsHidden=!0}getValue(){var e;const t=null!=(e=this.state.scopes)?e:[];return new Pl(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,k.isEqual)(n,r);if(t||!a&&0!==r.length)this.setState({loading:t});else{const n=j(this);null==n||n.startProfile("scopes_changed"),this.setState({scopes:e.value,loading:t}),this.publishEvent(new ue(this),!0)}}}Tl.Component=function({model:e}){const t=(0,c.useContext)(o.ScopesContext);return(0,c.useEffect)(()=>e.setContext(t),[t,e]),null};class Pl{constructor(e){this._value=e}formatter(e){return e===z.$m.QueryParam?this._value.map(e=>`scope=${encodeURIComponent(e)}`).join("&"):this._value.join(", ")}}function Ll(e){var t;return null!=(t=q(e,e=>e.state.$data))?t:ie}function Ml(e,t,n,r,a){return""===t||null==t?"":We(e,t,n,r,a)}function Vl(e,t,n,r){if(t(e))return e;let a=null;return e.forEachChild(e=>{if(e===n)return;let r=Vl(e,t);return r?(a=r,!1):void 0}),a||(r&&e.parent?Vl(e.parent,t,e,!0):null)}function Nl(e,t){return Vl(e,t,void 0,!0)}function $l(e,t){const n=[];return e.forEachChild(e=>{t(e)&&n.push(e),n.push(...$l(e,t))}),n}const Fl={getVariables:function(e){var t;return null!=(t=q(e,e=>e.state.$variables))?t:se},getData:Ll,getTimeRange:le,getLayout:function(e){const t=q(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(Ge(e)?r=r.concat(e):e.state.$data&&Ge(e.state.$data)&&(r=r.concat(e.state.$data)),t&&r.length>0)break;n=n.parent}else n=n.parent}return r},interpolate:Ml,lookupVariable:N,hasVariableDependencyInLoadingState:function(e){if(!e.variableDependency)return!1;for(const t of e.variableDependency.getNames()){if(e instanceof Dl&&e.state.name===t){console.warn("Query variable is referencing itself");continue}const n=N(t,e);if(!n)continue;if(n.parent.isVariableLoadingOrWaitingToUpdate(n))return!0}return!1},findByKey:function(e,t){const n=Nl(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=Nl(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:Nl,findAllObjects:$l,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:j,findDescendents:function(e,t){function n(e){return e instanceof t}return $l(e,n).filter(n)},getScopes:function(e){const t=N(De,e);if(t instanceof Tl)return t.state.scopes}};class jl 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=Fl.getVariables(n),a=Fl.lookupVariable(this.state.name,n);return!(!r||!a)&&r.isVariableLoadingOrWaitingToUpdate(a)}}const zl="$";function Bl(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 jl&&(n=`${e.state.value}${zl}${n}`,t=e.state.name)}),r=r.parent}return n}new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;function Ul(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)}new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;class Wl extends E{constructor(e,t=[]){super({isEnabled:!0,...e}),this._results=new h.ReplaySubject(1),this.isDataLayer=!0,this._variableValueRecorder=new tt,this._variableDependency=new hl(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:W}),this.setStateHelper({data:W})),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(W))}publishResults(e){this.state.isEnabled&&(this._results.next({origin:this,data:e}),this.setStateHelper({data:e}))}getResultsStream(){return this._results}shouldRunLayerOnActivate(){return!!this.state.isEnabled&&(this._variableValueRecorder.hasDependenciesChanged(this)?($(),!0):!this.state.data)}setStateHelper(e){Le(this,e)}}function Hl(e){return"function"==typeof e}function ql(e){return function(t){if(function(e){return Hl(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 Gl=function(e,t){return Gl=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])},Gl(e,t)};function Ql(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}Gl(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 Yl(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 Xl(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 Zl(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 Jl(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 eu(e){return this instanceof eu?(this.v=e,this):new eu(e)}function tu(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 eu?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 nu(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Xl(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 ru,au=((ru=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),ru.prototype.constructor=ru,ru);function iu(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ou=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=Xl(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(Hl(l))try{l()}catch(e){a=e instanceof au?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var c=Xl(u),d=c.next();!d.done;d=c.next()){var p=d.value;try{lu(p)}catch(e){a=null!=a?a:[],e instanceof au?a=Jl(Jl([],Zl(a)),Zl(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 au(a)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)lu(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)&&iu(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&iu(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();ou.EMPTY;function su(e){return e instanceof ou||e&&"closed"in e&&Hl(e.remove)&&Hl(e.add)&&Hl(e.unsubscribe)}function lu(e){Hl(e)?e():e.unsubscribe()}var uu={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},cu={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var a=cu.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,Jl([e,t],Zl(n))):setTimeout.apply(void 0,Jl([e,t],Zl(n)))},clearTimeout:function(e){var t=cu.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function du(e){cu.setTimeout(function(){var t=uu.onUnhandledError;if(!t)throw e;t(e)})}function pu(){}var hu=fu("C",void 0,void 0);function fu(e,t,n){return{kind:e,value:t,error:n}}var mu=null;var gu=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,su(t)&&t.add(n)):n.destination=Eu,n}return Ql(t,e),t.create=function(e,t,n){return new wu(e,t,n)},t.prototype.next=function(e){this.isStopped?xu(function(e){return fu("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?xu(function(e){return fu("E",void 0,e)}(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?xu(hu,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}(ou),vu=Function.prototype.bind;function bu(e,t){return vu.call(e,t)}var yu=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){Su(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Su(e)}else Su(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Su(e)}},e}(),wu=function(e){function t(t,n,r){var a,i,o=e.call(this)||this;Hl(t)||!t?a={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:o&&uu.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},a={next:t.next&&bu(t.next,i),error:t.error&&bu(t.error,i),complete:t.complete&&bu(t.complete,i)}):a=t;return o.destination=new yu(a),o}return Ql(t,e),t}(gu);function Su(e){var t;uu.useDeprecatedSynchronousErrorHandling?(t=e,uu.useDeprecatedSynchronousErrorHandling&&mu&&(mu.errorThrown=!0,mu.error=t)):du(e)}function xu(e,t){var n=uu.onStoppedNotification;n&&cu.setTimeout(function(){return n(e,t)})}var Eu={closed:!0,next:pu,error:function(e){throw e},complete:pu};function _u(e,t,n,r,a){return new Cu(e,t,n,r,a)}var Cu=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 Ql(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}(gu);function ku(e,t){return ql(function(n,r){var a=0;n.subscribe(_u(r,function(n){r.next(e.call(t,n,a++))}))})}var Ru="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ou(e){return e}function Au(e){return 0===e.length?Ou:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var Du=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 gu||function(e){return e&&Hl(e.next)&&Hl(e.error)&&Hl(e.complete)}(r)&&su(r)?e:new wu(e,t,n);return function(e){if(uu.useDeprecatedSynchronousErrorHandling){var t=!mu;if(t&&(mu={errorThrown:!1,error:null}),e(),t){var n=mu,r=n.errorThrown,a=n.error;if(mu=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=Iu(t))(function(t,r){var a=new wu({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[Ru]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Au(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=Iu(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 Iu(e){var t;return null!==(t=null!=e?e:uu.Promise)&&void 0!==t?t:Promise}var Tu="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Pu(e){if(e instanceof Du)return e;if(null!=e){if(function(e){return Hl(e[Ru])}(e))return o=e,new Du(function(e){var t=o[Ru]();if(Hl(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 Du(function(e){for(var t=0;t<a.length&&!e.closed;t++)e.next(a[t]);e.complete()});if(Hl(null==(r=e)?void 0:r.then))return n=e,new Du(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,du)});if(function(e){return Symbol.asyncIterator&&Hl(null==e?void 0:e[Symbol.asyncIterator])}(e))return Lu(e);if(function(e){return Hl(null==e?void 0:e[Tu])}(e))return t=e,new Du(function(e){var n,r;try{for(var a=Xl(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 Hl(null==e?void 0:e.getReader)}(e))return Lu(function(e){return tu(this,arguments,function(){var t,n,r;return Yl(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,eu(t.read())];case 3:return n=a.sent(),r=n.value,n.done?[4,eu(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,eu(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 Lu(e){return new Du(function(t){(function(e,t){var n,r,a,i;return Kl(this,void 0,void 0,function(){var o,s;return Yl(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=nu(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 Mu(e,t,n){return void 0===n&&(n=1/0),Hl(t)?Mu(function(n,r){return ku(function(e,a){return t(n,e,r,a)})(Pu(e(n,r)))},n):("number"==typeof t&&(n=t),ql(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(_u(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(_u(t,h,function(){d=!0,p()})),function(){null==s||s()}}(t,r,e,n)}))}const Vu={prepareAnnotation:e=>{if((0,k.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(Mu(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),ku(e=>e[0]))})),ku(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 $u){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 Nu=[{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"}],$u=[...o.config.publicDashboardAccessToken?[{key:"color"},{key:"isRegion"},{key:"source"}]:[],...Nu,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];const Fu=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];let ju=100;function zu(e,t,n,r,a,s){var l;if(e.annotationQuery&&function(e){const{type:t}=e;return!e.annotations||Fu.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(ku(e=>({state:B.Done,events:e})));const u={...Vu,...e.annotations},c={...null==(l=u.getDefaultQuery)?void 0:l.call(u),...n},d=u.prepareAnnotation(c);if(!d)return(0,h.of)({state:B.Done,events:[]});const p=u.prepareQuery(d);if(!p)return(0,h.of)({state:B.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:rn(r)},v={startTime:Date.now(),requestId:"AQ"+ju++,range:t.state.value,maxDataPoints:f,scopedVars:g,...m,app:i.CoreApp.Dashboard,timezone:t.getTimeZone(),targets:[{...p,refId:"Anno"}],scopes:Fl.getScopes(r),filters:a,groupByKeys:s,...it(r)};return(0,o.getRunRequest)()(e,v).pipe(Mu(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(ku(t=>({state:e.state,events:t||[]})))):(0,h.of)({state:e.state,events:[]})}))}function Bu(e){return"panel-alert"===e.eventType}(class extends Wl{constructor(e){super({isEnabled:!0,...e},["query"]),this._scopedVars={__sceneObject:rn(this)},this._drilldownDependenciesManager=new Ws(this._variableDependency)}onEnable(){this.publishEvent(new o.RefreshEvent,!0);const e=Fl.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(){$();const e=Fl.getTimeRange(this);this.runWithTimeRange(e)}async runWithTimeRange(e){var t;const{query:n}=this.state;if(n.enable)if(this._drilldownDependenciesManager.findAndSubscribeToDrilldowns(null==(t=n.datasource)?void 0:t.uid),this.querySub&&this.querySub.unsubscribe(),this._variableDependency.hasDependencyInLoadingState())$();else try{let t=zu(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({...W,state:B.Error,errors:[{message:Ul(e)}]}),console.error("AnnotationsDataLayer error",e)}}async resolveDataSource(e){return await et(e.datasource||void 0,this._scopedVars)}processEvents(e,t){let n=(r=e,a=t.events||[],r.snapshotData&&delete(r=(0,k.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,k.partition)(e,"id"),r=(0,k.groupBy)(n[0],"id");return t=(0,k.map)(r,e=>e.length>1&&!(0,k.every)(e,Bu)?(0,k.find)(e,e=>"panel-alert"!==e.eventType):(0,k.head)(e)),t=(0,k.concat)(t,n[1]),t}(n);const s={...W,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{isEnabled:t,isHidden:n}=e.useState(),r=`data-layer-${e.state.key}`;if(n)return null;return p().createElement(st.InlineSwitch,{className:Uu,id:r,value:t,onChange:()=>e.setState({isEnabled:!t})})};const Uu=(0,vt.css)({borderBottomLeftRadius:0,borderTopLeftRadius:0});function Wu({layer:e}){var t,n;const r=`data-layer-${e.state.key}`,{data:a,isHidden:i}=e.useState(),o=Boolean(a&&a.state===B.Loading);return i?null:p().createElement("div",{className:Hu},p().createElement(er,{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(e.Component,{model:e}))}(class extends E{constructor(){super({})}}).Component=function({model:e}){const t=Fl.getDataLayers(e,!0);if(0===t.length)return null;return p().createElement(p().Fragment,null,t.map(e=>p().createElement(Wu,{layer:e,key:e.state.key})))};const Hu=(0,vt.css)({display:"flex"});function qu({variable:e,layout:t,showAlways:n,hideLabel:r}){return _(e,{shouldActivateOrKeepAlive:!0}).hide!==i.VariableHide.hideVariable||n?"vertical"===t?p().createElement("div",{className:Ku,"data-testid":gt.pages.Dashboard.SubMenu.submenuItem},p().createElement(Gu,{variable:e,layout:t,hideLabel:r}),p().createElement(e.Component,{model:e})):p().createElement("div",{className:Qu,"data-testid":gt.pages.Dashboard.SubMenu.submenuItem},p().createElement(Gu,{variable:e,hideLabel:r}),p().createElement(e.Component,{model:e})):e.UNSAFE_renderAsHidden?p().createElement(e.Component,{model:e}):null}function Gu({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(er,{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=Fl.getVariables(e).useState();return p().createElement(p().Fragment,null,t.variables.map(t=>p().createElement(qu,{key:t.state.key,variable:t,layout:e.state.layout})))};const Qu=(0,vt.css)({display:"flex","> :nth-child(2)":(0,vt.css)({borderTopLeftRadius:0,borderBottomLeftRadius:0})}),Ku=(0,vt.css)({display:"flex",flexDirection:"column"});(class extends E{}).Component=function({model:e}){const t=Fl.lookupVariable(e.state.variableName,e);if(!t)return null;return p().createElement(qu,{key:t.state.key,variable:t,layout:e.state.layout,showAlways:!0})};class Yu extends E{constructor(e){super(e),this._variablesToUpdate=new Set,this._updating=new Map,this._variableValueRecorder=new tt,this._variableDependency=new Zu(this._handleParentVariableUpdatesCompleted.bind(this)),this._onActivate=()=>{const e=Fl.getTimeRange(this);this._subs.add(this.subscribeToEvent(ue,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)&&(Xu(e,"Changed while in-active"),this._addDependentVariablesToUpdateQueue(e))}_variableNeedsUpdate(e){return!e.isLazy&&(!!e.validateAndUpdate&&(!this._variableValueRecorder.hasRecordedValue(e)||(Xu(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(Fl.hasVariableDependencyInLoadingState(e))continue;const t={variable:e};this._updating.set(e,t),Xu(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),Xu(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),Xu(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)&&(Xu(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))||Fl.hasVariableDependencyInLoadingState(e)))}}function Xu(e,t,n){$(0,e.state.name)}class Zu{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 Ju extends Ne{constructor(e){super({type:"custom",query:"",value:"",text:"",options:[],name:"",...e}),this._variableDependency=new hl(this,{statePaths:["query"]})}transformCsvStringToOptions(e,t=!0){var n;return(null!=(n=(e=t?Fl.interpolate(this,e):e).match(/(?:\\,|[^,])+/g))?n:[]).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()}})}getValueOptions(e){const t=this.transformCsvStringToOptions(this.state.query);return t.length||(this.skipNextValidation=!0),(0,h.of)(t)}}Ju.Component=({model:e})=>p().createElement(Kt,{model:e});function ec(e){return{container:(0,vt.css)({display:"flex",alignItems:"center",padding:e.spacing(0,1),height:e.spacing(e.components.height.md),borderRadius:e.shape.radius.default,border:`1px solid ${e.components.input.borderColor}`,background:e.colors.background.primary})}}(class extends E{constructor(e){super({type:"switch",value:"false",enabledValue:"true",disabledValue:"false",name:"",...e}),this._prevValue="",this._urlSync=new H(this,{keys:()=>this.getKeys()})}validateAndUpdate(){const e=this.getValue();return this._prevValue!==e&&(this._prevValue=e,this.publishEvent(new ue(this),!0)),(0,h.of)({})}setValue(e){this.getValue()!==e&&([this.state.enabledValue,this.state.disabledValue].includes(e)?(this.setState({value:e}),this.publishEvent(new ue(this),!0)):console.error(`Invalid value for switch variable: "${e}". Valid values are: "${this.state.enabledValue}" and "${this.state.disabledValue}".`))}getValue(){return this.state.value}isEnabled(){return this.state.value===this.state.enabledValue}isDisabled(){return this.state.value===this.state.disabledValue}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=function({model:e}){const t=e.useState(),n=(0,st.useStyles2)(ec);return p().createElement("div",{className:n.container},p().createElement(st.Switch,{value:t.value===t.enabledValue,onChange:n=>{e.setValue(n.currentTarget.checked?t.enabledValue:t.disabledValue)}}))};class tc extends Ne{constructor(e){super({type:"datasource",value:"",text:"",options:[],name:"",regex:"",pluginId:"",...e}),this._variableDependency=new hl(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=Fl.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];nc(a,n)&&r.push({label:a.name,value:a.uid}),this.state.defaultOptionEnabled&&rc(a,n)&&r.push({label:(0,me.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 nc(e,t){return!t||t.exec(e.name)}function rc(e,t){return!!e.isDefault&&(!t||t.exec("default"))}function ac(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:ac(n,t+1)})}return r}function ic(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(ic([r],t,n+1)))}else r.name===e&&(a=a.concat(ic(r.children,t,n+1)));return a}function oc(e){if(0===e.indexOf("value"))return[{name:e,children:[]}];return ic(ac("",0),e.split("."),0)}tc.Component=({model:e})=>p().createElement(Kt,{model:e});function sc({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(st.AutoSizeInput,{id:n,placeholder:(0,me.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 Ne{constructor(e,t=!1){super({type:"custom",name:"Test",value:"Value",text:(0,me.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 hl(this,{statePaths:["query"]}),this.isLazy=t}getValueOptions(e){const{delayMs:t}=this.state;this.getValueOptionsCount+=1;const n=Fl.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=Fl.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=q(this,e=>e instanceof Yu?e:void 0);null==e||e.cancel(this)}getOptions(e){return this.state.optionsToReturn?this.state.optionsToReturn:oc(e).map(e=>({label:e.name,value:e.name}))}signalUpdateCompleted(){this.completeUpdate.next(1)}}).Component=({model:e})=>p().createElement(Kt,{model:e});(class extends E{constructor(e){super({type:"textbox",value:"",name:"",...e}),this._urlSync=new H(this,{keys:()=>this.getKeys()})}getValue(){return this.state.value}setValue(e){e!==this.state.value&&(this.setState({value:e}),this.publishEvent(new ue(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(sc,{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:Fn.CO.onTimeRangeChanged,...e}),this._onChange=e=>{this.setState({value:e.value}),this.publishEvent(new ue(this),!0)},this._urlSync=new H(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=Re: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:Re,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===Re?this.getAutoRefreshInteval(t,n):e}getAutoRefreshInteval(e,t){const n=Fl.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===Re)n=!0;else if(!e&&t.length>0){const e=t[0];this.setState({value:e}),n=!0}return n&&this.publishEvent(new ue(this),!0),(0,h.of)({})}}).Component=({model:e})=>{const{key:t,value:n}=e.useState();return p().createElement(st.Select,{id:t,placeholder:(0,me.t)("grafana-scenes.variables.interval-variable.placeholder-select-value","Select value"),width:"auto",value:n,tabSelectsValue:!1,options:e.getOptionsForSelect(),onChange:e._onChange})};var lc,uc,cc=e=>{throw TypeError(e)},dc=(e,t,n)=>t.has(e)||cc("Cannot "+n),pc=(e,t,n)=>(dc(e,t,"read from private field"),n?n.call(e):t.get(e)),hc=(e,t,n)=>t.has(e)?cc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),fc=(e,t,n,r)=>(dc(e,t,"write to private field"),t.set(e,n),n);class mc extends i.BusEventWithPayload{}mc.type="new-scene-object-added";class gc{constructor(e={},t=o.locationService){this._options=e,this._locationService=t,this._paramsCache=new vc(t),this._urlKeyMapper=new I({namespace:e.namespace,excludeFromNamespace:e.excludeFromNamespace})}initSync(e){var t;if(this._subs&&($(0,0,null==(t=this._sceneRoot)||t.state.key),this._subs.unsubscribe()),$(0,0,e.state.key),this._sceneRoot=e,this._subs=new h.Subscription,this._subs.add(e.subscribeToEvent(v,e=>{this.handleSceneObjectStateChanged(e.payload.changedObject)})),this._subs.add(e.subscribeToEvent(mc,e=>{this.handleNewObject(e.payload)})),this._urlKeyMapper.clear(),this._lastLocation=this._locationService.getLocation(),this.handleNewObject(this._sceneRoot),this._options.updateUrlOnInit){const t=P(e,this._urlKeyMapper.getOptions());(function(e,t){for(let n in e)if(!V(t.getAll(n),e[n]))return!0;return!1})(t,this._paramsCache.getParams())&&this._locationService.partial(t,!0)}}cleanUp(e){this._sceneRoot===e&&($(),this._subs&&(this._subs.unsubscribe(),this._subs=void 0,$(0,0,(this._sceneRoot.state.key,e.state.key))),this._sceneRoot=void 0,this._lastLocation=void 0)}handleNewLocation(e){this._sceneRoot&&this._lastLocation!==e&&($(),this._lastLocation=e,L(this._sceneRoot,this._paramsCache.getParams(),this._urlKeyMapper))}handleNewObject(e){this._sceneRoot&&L(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);V(a.getAll(r),n)||(i[r]=n)}if(Object.keys(i).length>0){const a=!0!==(null==(n=(t=e.urlSync).shouldCreateHistoryStep)?void 0:n.call(t,r));$(),this._locationService.partial(i,a),this._lastLocation=this._locationService.getLocation()}}getUrlState(e){return P(e,this._urlKeyMapper.getOptions())}}class vc{constructor(e){this.locationService=e,hc(this,lc),hc(this,uc)}getParams(){const e=this.locationService.getLocation();return pc(this,uc)===e||(fc(this,uc,e),fc(this,lc,new URLSearchParams(e.search))),pc(this,lc)}}function bc(e,t={}){const n=(0,a.useLocation)(),r=Me(),[i,o]=(0,c.useState)(!1),s=function(e,t){return(0,c.useMemo)(()=>new gc({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&&$(),s.handleNewLocation(t)},[e,s,n,r]),i}function yc({children:e,scene:t,updateUrlOnInit:n,createBrowserHistorySteps:r,namespace:a,excludeFromNamespace:i}){return bc(t,{updateUrlOnInit:n,createBrowserHistorySteps:r,namespace:a,excludeFromNamespace:i})?e:null}lc=new WeakMap,uc=new WeakMap;class wc extends E{constructor(e){super(e),this.addActivationHandler(()=>{const e=function(e){const t=window.__grafanaSceneContext;return $(),window.__grafanaSceneContext=e,()=>{window.__grafanaSceneContext===e&&($(),window.__grafanaSceneContext=t)}}(this);return()=>{e()}})}}wc.Component=function({model:e}){const{body:t,controls:n}=e.useState(),r=(0,st.useStyles2)(Sc);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 Sc=e=>({container:(0,vt.css)({flexGrow:1,display:"flex",gap:e.spacing(2),minHeight:"100%",flexDirection:"column"}),body:(0,vt.css)({flexGrow:1,display:"flex",gap:e.spacing(1)}),controls:(0,vt.css)({display:"flex",gap:e.spacing(2),alignItems:"flex-end",flexWrap:"wrap"})});class xc extends E{addItem(e){this.setState({items:this.state.items?[...this.state.items,e]:[e]})}setItems(e){this.setState({items:e})}}xc.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(st.Menu.Divider,{key:e.text});case"group":return p().createElement(st.Menu.Group,{key:e.text,label:e.text},e.subMenu?r(e.subMenu):void 0);default:return p().createElement(st.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:gt.components.Panels.Panel.menuItems(e.text)})}});return p().createElement(st.Menu,{ref:n},r(t))};var Ec=function(){return Ec=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},Ec.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function _c(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 Ec(Ec({},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}=Fl.getData(e).useState(),{from:r,to:a}=Fl.getTimeRange(e).useState(),{value:i}=function(e,t){void 0===t&&(t=[]);var n=_c(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:rn(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(st.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(me.x6,{i18nKey:"grafana-scenes.components.viz-panel-explore-button.explore"},"Explore"));return null};function Cc(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 Mc))&&!Cc(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 kc=n(2548),Rc=n.n(kc);const Oc=(0,vt.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(xn,{...h,key:f.state.key,"data-griditem-key":f.state.key,className:(0,vt.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,vt.cx)(m,e.className),style:l},g,d)});function Dc(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(()=>Dc(e,t,!0),50)}Ac.displayName="GridItemWrapper";const Ic=p().forwardRef(({handleAxis:e,...t},n)=>{const r=(0,st.useStyles2)(Tc);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 Tc(e){return(0,vt.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"}})}Ic.displayName="ResizeHandle";class Pc extends i.BusEventWithPayload{}Pc.type="scene-grid-layout-drag-start";const Lc=class e extends E{constructor(e){super({...e,children:Nc(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};Vc(e.state,n)||e.setState({...n})}this.setState({children:Nc(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=$c(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&&Ve(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:Nc(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 Pc({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),Cc(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){const t=e.state;let n=Number.isFinite(Number(t.x))?Number(t.x):0,r=Number.isFinite(Number(t.y))?Number(t.y):0;const a=Number.isFinite(Number(t.width))?Number(t.width):4,i=Number.isFinite(Number(t.height))?Number(t.height):4;let o=e.state.isDraggable,s=e.state.isResizable;return e instanceof Fc&&(o=!!e.state.isCollapsed,s=!1),Ve(e)&&(o=!1,s=!1),{i:e.state.key,x:n,y:r,h:i,w:a,isResizable:s,isDraggable:o}}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=$c(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)}};Lc.Component=function({model:e}){const{children:t,isLazy:n,isDraggable:r,isResizable:a}=e.useState(),[i,{width:o,height:s}]=vn(),l=(0,c.useRef)(null);return(0,c.useEffect)(()=>{Dc(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:Oc},((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(Rc(),{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(Ic,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 Mc=Lc;function Vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Nc(e){return e.forEach(e=>{e instanceof Fc&&e.setState({children:Nc(e.state.children)})}),[...e].sort((e,t)=>e.state.y-t.state.y||e.state.x-t.state.x)}function $c(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 hl(this,{statePaths:["title"],handleTimeMacros:!0}),this.onCollapseToggle=()=>{this.state.isCollapsible&&this.getGridLayout().toggleRow(this)}}getGridLayout(){const e=this.parent;if(!(e&&e instanceof Mc))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,st.useStyles2)(jc),{isCollapsible:n,isCollapsed:r,title:a,actions:i,children:o}=e.useState(),s=e.getGridLayout(),l=s.getDragClass(),u=s.isDraggable()&&!Ve(e),c=e.getPanelCount(o),d=1===c?"panel":"panels";return p().createElement("div",{className:(0,vt.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,me.t)("grafana-scenes.components.scene-grid-row.expand-row","Expand row"):(0,me.t)("grafana-scenes.components.scene-grid-row.collapse-row","Collapse row"),"data-testid":gt.components.DashboardRow.title(Fl.interpolate(e,a,void 0,"text"))},n&&p().createElement(st.Icon,{name:r?"angle-right":"angle-down"}),p().createElement("span",{className:t.rowTitle,role:"heading"},Fl.interpolate(e,a,void 0,"text"))),p().createElement("span",{className:(0,vt.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,vt.cx)(t.dragHandle,l)},p().createElement(st.Icon,{name:"draggabledots"})))};const jc=e=>({row:(0,vt.css)({width:"100%",height:"30px",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowTitleButton:(0,vt.css)({display:"flex",alignItems:"center",cursor:"pointer",background:"transparent",border:"none",minWidth:0,gap:e.spacing(1)}),rowCollapsed:(0,vt.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),rowTitle:(0,vt.css)({fontSize:e.typography.h5.fontSize,fontWeight:e.typography.fontWeightMedium,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",flexGrow:1,minWidth:0}),collapsedInfo:(0,vt.css)({fontSize:e.typography.bodySmall.fontSize,color:e.colors.text.secondary,display:"flex",alignItems:"center",flexGrow:1}),rowTitleAndActionsGroup:(0,vt.css)({display:"flex",minWidth:0,"&:hover, &:focus-within":{"& > div":{opacity:1}}}),rowActions:(0,vt.css)({display:"flex",whiteSpace:"nowrap",opacity:0,transition:"200ms opacity ease-in 200ms","&:hover, &:focus-within":{opacity:1}}),dragHandle:(0,vt.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,vt.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,vt.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,st.useStyles2)(jc),l=(0,st.useStyles2)(zc),u=(null!=o?o:[]).map(e=>p().createElement(e.Component,{key:e.state.key,model:e}));a&&u.push(p().createElement(st.ToolbarButton,{icon:"times",variant:"default",onClick:e.onRemove,key:"remove-button","aria-label":(0,me.t)("grafana-scenes.components.nested-scene-renderer.remove-button-label","Remove scene")}));return p().createElement("div",{className:l.wrapper},p().createElement("div",{className:(0,vt.cx)(l.row,n&&l.rowCollapsed)},p().createElement("button",{onClick:e.onToggle,className:s.rowTitleButton,"aria-label":n?(0,me.t)("grafana-scenes.components.nested-scene-renderer.expand-button-label","Expand scene"):(0,me.t)("grafana-scenes.components.nested-scene-renderer.collapse-button-label","Collapse scene")},r&&p().createElement(st.Icon,{name:n?"angle-right":"angle-down"}),p().createElement("span",{className:s.rowTitle,role:"heading"},Fl.interpolate(e,t,void 0,"text"))),p().createElement("div",{className:l.actions},u)),!n&&p().createElement(i.Component,{model:i}))};const zc=e=>({wrapper:(0,vt.css)({display:"flex",flexDirection:"column",flexGrow:1,gap:e.spacing(1)}),row:(0,vt.css)({width:"100%",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowCollapsed:(0,vt.css)({borderBottom:`1px solid ${e.colors.border.weak}`,paddingBottom:e.spacing(1)}),actions:(0,vt.css)({display:"flex",alignItems:"center",gap:e.spacing(1),justifyContent:"flex-end",flexGrow:1})});(class extends E{constructor(){super(...arguments),this._variableDependency=new hl(this,{statePaths:["text"]})}}).Component=function({model:e}){const{text:t,fontSize:n=20,align:r="left",key:a,spacing:i}=e.useState(),o=(0,st.useTheme2)(),s=(0,vt.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},Fl.interpolate(e,t))};(class extends E{}).Component=({model:e})=>{const t=e.useState();return p().createElement(st.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(er,{label:t.label}),p().createElement(st.Input,{defaultValue:t.value,width:8,onBlur:t=>{e.state.onChange(parseInt(t.currentTarget.value,10))}}))};const Bc=function(e,t,n){if(!fn)return[t,hn,hn];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 Uc extends E{constructor(){super(...arguments),this.onZoom=()=>{const e=Fl.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=>{Fl.getTimeRange(this).setState({fiscalYearStartMonth:e})},this.toAbsolute=()=>{const e=Fl.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=Fl.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(Wc(0,t))},this.onMoveForward=()=>{const e=Fl.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(Wc(1,t,Date.now()))}}}function Wc(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}}}Uc.Component=function({model:e}){const{hidePicker:t,isOnCanvas:n,quickRanges:r,defaultQuickRanges:a}=e.useState(),o=Fl.getTimeRange(e),s=o.getTimeZone(),l=o.useState(),[u,c]=Bc(Hc,[],{raw:!1,serializer:Gc,deserializer:qc});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(st.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,me.t)("grafana-scenes.components.time-picker.move-forward-tooltip","Move {{moveForwardDuration}} forward",{moveForwardDuration:m}):void 0,moveBackwardTooltip:(0,me.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 Hc="grafana.dashboard.timepicker.history";function qc(e){return JSON.parse(e).map(e=>i.rangeUtil.convertRawToRange(e,"utc",void 0,"YYYY-MM-DD HH:mm:ss"))}function Gc(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,k.uniqBy)(t,e=>e.from+e.to).slice(0,4)));var t}const Qc=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"];class Kc 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:Qc).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 H(this,{keys:["refresh"]}),this._autoRefreshBlocked=!1,this.onRefresh=()=>{const e=Fl.getQueryController(this);if(null==e?void 0:e.state.isRunning)return e.cancelAll(),void e.cancelProfile();null==e||e.startProfile(Z);const t=Fl.getTimeRange(this);this._intervalTimer&&clearInterval(this._intervalTimer),t.onRefresh(),this.setupIntervalTimer()},this.onIntervalChanged=e=>{this.setState({refresh:e}),this.setupIntervalTimer()},this.setupAutoTimeRangeListener=()=>Fl.getTimeRange(this).subscribeToState((e,t)=>{e.from===t.from&&e.to===t.to||this.setupIntervalTimer()}),this.calculateAutoRefreshInterval=()=>{var e;const t=Fl.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=Fl.getTimeRange(this),{refresh:n,intervals:r}=this.state;if((this._intervalTimer||""===n)&&clearInterval(this._intervalTimer),""===n)return;if(n!==st.RefreshPicker.autoOption.value&&r&&!r.includes(n))return;let a;if(null==(e=this._autoTimeRangeListener)||e.unsubscribe(),n===st.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=Fl.getQueryController(this);(null==e?void 0:e.state.isRunning)&&e.cancelProfile(),null==e||e.startProfile(Z),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}}Kc.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=Fl.getQueryController(e);if(!t)return!1;return t.useState().isRunning}(e);let c,d,h=n===(null==(t=st.RefreshPicker.autoOption)?void 0:t.value)?i:l?(0,me.t)("grafana-scenes.components.scene-refresh-picker.text-refresh","Refresh"):void 0;u&&(c=(0,me.t)("grafana-scenes.components.scene-refresh-picker.tooltip-cancel","Cancel all queries"),l&&(h=(0,me.t)("grafana-scenes.components.scene-refresh-picker.text-cancel","Cancel")));l&&(d="96px");return p().createElement(st.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 Yc=e=>`${e}-compare`,Xc="__previousPeriod",Zc="__noPeriod",Jc={label:"Previous period",value:Xc},ed={label:"None",value:Zc},td=[{label:"Day before",value:"24h"},{label:"Week before",value:"1w"},{label:"Month before",value:"1M"}];(class extends E{constructor(e){super({compareOptions:td,...e}),this._urlSync=new H(this,{keys:["compareWith"]}),this._onActivate=()=>{const e=Fl.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=Xc),this.setState(n)}))},this.getCompareOptions=e=>{const t=Math.ceil(e.to.diff(e.from)),n=td.findIndex(({value:e})=>i.rangeUtil.intervalToMs(e)>=t);return[ed,Jc,...td.slice(n).map(({label:e,value:t})=>({label:e,value:t}))]},this.onCompareWithChanged=e=>{e===Zc?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:nd}),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===Xc){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=Q(e.compareWith);if(t){this.getCompareOptions(Fl.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,st.useStyles2)(rd),{compareWith:r,compareOptions:a,hideCheckbox:i}=e.useState(),[o,s]=p().useState(r),l=null!=(t=a.find(({value:e})=>e===o))?t:Jc,u=a.find(({value:e})=>e===r),c=Boolean(u),d=()=>{c?(s(r),e.onClearCompare()):c||e.onCompareWithChanged(l.value)},h=i&&!r?ed:u,f=i||c,m=i&&h?{...h,label:`Comparison: ${h.label}`}:h;return p().createElement(st.ButtonGroup,null,!i&&p().createElement(st.ToolbarButton,{variant:"canvas",tooltip:(0,me.t)("grafana-scenes.components.scene-time-range-compare-renderer.button-tooltip","Enable time frame comparison"),onClick:e=>{e.stopPropagation(),e.preventDefault(),d()}},p().createElement(st.Checkbox,{label:" ",value:c,onClick:d}),p().createElement(me.x6,{i18nKey:"grafana-scenes.components.scene-time-range-compare-renderer.button-label"},"Comparison")),f?p().createElement(st.ButtonSelect,{variant:"canvas",value:m,options:a,onChange:t=>{e.onCompareWithChanged(t.value)}}):p().createElement(st.ToolbarButton,{className:n.previewButton,disabled:!0,variant:"canvas",isOpen:!1},l.label))};const nd=(e,t)=>{const n=t.timeRange.from.diff(e.timeRange.from);return t.series.forEach(e=>{e.refId=Yc(e.refId||""),e.meta={...e.meta,timeCompare:{diffMs:n,isTimeShiftQuery:!0}}}),(0,h.of)(t)};function rd(e){return{previewButton:(0,vt.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=Fl.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 hl(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler(()=>this.performRepeat())}performRepeat(){if(this._variableDependency.hasDependencyInLoadingState())return;const e=Fl.lookupVariable(this.state.variableName,this);if(!(e instanceof Ne))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 ad extends E{constructor(){super({}),this._renderBeforeActivation=!0}}ad.Component=e=>p().createElement("div",{style:{flexGrow:1}});class id extends E{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}id.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?sd(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,vt.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 od extends E{}function sd(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}od.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=sd({},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,vt.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 ld 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}}ld.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,vt.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(xn,{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 ud extends E{}ud.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,vt.css)(e)},[i]));var i;if(!n||r)return null;return p().createElement("div",{className:a},p().createElement(n.Component,{model:n}))};const cd=new Set(["ArrowUp","ArrowDown"]),dd=new Set(["ArrowLeft","ArrowRight"]),pd={row:{dim:"width",axis:"clientX",min:"minWidth",max:"maxWidth"},column:{dim:"height",axis:"clientY",min:"minHeight",max:"maxHeight"}};function hd({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=pd[e].dim,y=pd[e].axis,w=pd[e].min,S=pd[e].max;!function(e,t,n=0,r){const a=(0,k.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=md(u.current);l.current.ariaValueNow=`${(0,k.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=md(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,k.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,k.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]),R=(0,c.useRef)(new Set),O=(0,c.useRef)(null),A=(0,c.useCallback)(n=>{var r;if(0===R.current.size)return void(O.current=null);if("1fr"===m.current)return;const a=.3*(n-(null!=(r=O.current)?r:n));let i=0;"row"===e?(R.current.has("ArrowLeft")&&(i-=a),R.current.has("ArrowRight")&&(i+=a)):(R.current.has("ArrowUp")&&(i-=a),R.current.has("ArrowDown")&&(i+=a));const o=g.current,s=u.current.getBoundingClientRect()[b],c=(0,k.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,k.clamp)(h,0,100)}`,O.current=n,window.requestAnimationFrame(A)},[e,t,w,S,b]),D=(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=md(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=md(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&&cd.has(n.key)||"row"===e&&dd.has(n.key))||R.current.has(n.key))return;v.current=void 0,n.preventDefault(),n.stopPropagation(),m.current=u.current.getBoundingClientRect()[b],f.current=h.current.getBoundingClientRect()[b],g.current=md(u.current);if(!R.current.has(n.key)){const e=0===R.current.size;R.current.add(n.key),e&&window.requestAnimationFrame(A)}},[e,A,t,S,b,w]),I=(0,c.useCallback)(t=>{"row"===e&&!dd.has(t.key)||"column"===e&&!cd.has(t.key)||(R.current.delete(t.key),null==i||i(parseFloat(u.current.style.flexGrow)))},[e,i]),T=(0,c.useCallback)(()=>{u.current.style.flexGrow="0.5",d.current.style.flexGrow="0.5";const e=md(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)(()=>{R.current.size>0&&(R.current.clear(),x.current=null,null==i||i(parseFloat(u.current.style.flexGrow)))},[i]),L=(0,st.useStyles2)(fd),M=Sn(),V=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,k.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,vt.cx)(L.handle,{[L.handleHorizontal]:"column"===e}),onPointerUp:C,onPointerDown:E,onPointerMove:_,onKeyDown:D,onKeyUp:I,onDoubleClick:T,onBlur:P,role:"separator","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":50,"aria-controls":`start-panel-${M}`,"aria-label":(0,me.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,k.clamp)(1-n,0,1),[w]:"min-content",visibility:`${V}`,...a},id:`end-panel-${M}`},s[1])))}function fd(e){return{handle:(0,vt.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,vt.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,vt.css)({display:"flex",width:"100%",flexGrow:1,overflow:"hidden"}),panel:(0,vt.css)({display:"flex",position:"relative",flexBasis:0})}}function md(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(hd,{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 gd extends E{constructor(){super(...arguments),this._renderBeforeActivation=!0}enrichDataRequest(){return{app:this.state.name||"app"}}}gd.Component=({model:e})=>{const{pages:t}=e.useState();return p().createElement(p().Fragment,null,p().createElement(vd.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 vd=(0,c.createContext)(null),bd=new Map;function yd(e){const t=bd.get(e);if(t)return t;const n=e();return bd.set(e,n),n}class wd extends E{}function Sd({node:e}){const t=e.useState(),n=(0,st.useStyles2)(xd);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(st.Input,{type:"number",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.valueAsNumber})});case"string":return p().createElement(st.Input,{type:"text",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.value})});case"object":return He(t)?t.constructor.name:(0,k.isPlainObject)(t)||(0,k.isArray)(t)?p().createElement(st.JSONFormatter,{json:t,open:0}):String(t);default:return typeof t}}(r,t[r],e)))))}function xd(e){return{container:(0,vt.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),row:(0,vt.css)({display:"flex",gap:e.spacing(2)}),keyName:(0,vt.css)({display:"flex",flexGrow:"0",width:120,alignItems:"center",height:e.spacing(e.components.height.md)}),value:(0,vt.css)({flexGrow:1,minHeight:e.spacing(e.components.height.md),display:"flex",alignItems:"center"})}}function Ed({node:e,selectedObject:t,onSelect:n}){const r=(0,st.useStyles2)(_d),a=[],i=e===t;return e.forEachChild(e=>{a.push(p().createElement(Ed,{node:e,key:e.state.key,selectedObject:t,onSelect:n}))}),p().createElement("div",{className:r.container},p().createElement("div",{className:(0,vt.cx)(r.name,i&&r.selected),onClick:()=>n(e)},e.constructor.name),p().createElement("div",{className:r.children},a))}function _d(e){return{container:(0,vt.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),name:(0,vt.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,vt.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,vt.css)({flexGrow:1,display:"flex",flexDirection:"column",paddingLeft:e.spacing(1)})}}function Cd({scene:e}){const t=(0,st.useStyles2)(kd),[n,r]=(0,c.useState)(!1),[a,i]=(0,c.useState)();return p().createElement(p().Fragment,null,p().createElement(st.ToolbarButton,{variant:"canvas",icon:"bug",onClick:()=>r(!0)}),n&&p().createElement(st.Drawer,{title:(0,me.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(me.x6,{i18nKey:"grafana-scenes.components.scene-debugger.scene-graph"},"Scene graph")),p().createElement(st.CustomScrollbar,{autoHeightMin:"100%"},p().createElement("div",{className:t.treeWrapper},p().createElement(Ed,{node:e,selectedObject:a,onSelect:i})))),p().createElement("div",{className:t.pane2},p().createElement("div",{className:t.paneHeading},p().createElement(me.x6,{i18nKey:"grafana-scenes.components.scene-debugger.object-details"},"Object details")),a&&p().createElement(Sd,{node:a})))))}function kd(e){return{panes:(0,vt.css)({flexGrow:1,display:"flex",height:"100%",flexDirection:"row",marginTop:e.spacing(-2)}),pane1:(0,vt.css)({flexGrow:0,display:"flex",height:"100%",flexDirection:"column",borderRight:`1px solid ${e.colors.border.weak}`}),pane2:(0,vt.css)({flexGrow:1,display:"flex",minHeight:"100%",flexDirection:"column",paddingLeft:e.spacing(2)}),treeWrapper:(0,vt.css)({paddingRight:e.spacing(2),height:"100%",marginLeft:e.spacing(-1)}),paneHeading:(0,vt.css)({padding:e.spacing(1,0),fontWeight:e.typography.fontWeightMedium})}}function Rd({page:e}){const t=l(e.state.url),n=function(e){if(e.parent instanceof Dd)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)(vd),h=r.initializedScene===u,{layout:f}=e.state,m=Me();(0,c.useLayoutEffect)(()=>{h||n.initializeScene(u)},[u,n,h]),(0,c.useEffect)(()=>()=>n.setState({initializedScene:void 0}),[n]);const g=bc(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:Od(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(Cd,{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 Od(e,t,n){if(e instanceof Dd)return{text:e.state.title,url:s(e.state.url,n,e.state.preserveUrlKeys),hideFromBreadcrumbs:e.state.hideFromBreadcrumbs,parentItem:Od(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})}wd.Component=({model:e})=>{const{component:t,props:n,reactNode:r}=e.useState();return t?p().createElement(t,{...n}):r||null};class Dd 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 qe(t)?t.enrichDataRequest(e):null}}Dd.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(Rd,{page:null!=(r=null==(n=(t=e.state).getFallbackPage)?void 0:n.call(t))?r:new Dd({url:"",title:(0,me.t)("grafana-scenes.components.fallback-page.title","Not found"),subTitle:(0,me.t)("grafana-scenes.components.fallback-page.subTitle","The url did not match any page"),routePath:"*",getScene:()=>new wc({body:new id({direction:"column",children:[new od({body:new wd({component:()=>p().createElement("div",{"data-testid":"default-fallback-content"},p().createElement(me.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(Rd,{page:e})}));return p().createElement(a.Routes,null,r)};var Id=(e=>(e.Always="always",e.Auto="auto",e.Never="never",e))(Id||{}),Td=(e=>(e.Hue="hue",e.None="none",e.Opacity="opacity",e.Scheme="scheme",e))(Td||{}),Pd=(e=>(e.None="none",e.Normal="normal",e.Percent="percent",e))(Pd||{});var Ld=(e=>(e.Auto="auto",e.Horizontal="horizontal",e.Vertical="vertical",e))(Ld||{});var Md=(e=>(e.Background="background",e.BackgroundSolid="background_solid",e.None="none",e.Value="value",e))(Md||{}),Vd=(e=>(e.Area="area",e.Line="line",e.None="none",e))(Vd||{}),Nd=(e=>(e.Auto="auto",e.Center="center",e))(Nd||{}),$d=(e=>(e.Auto="auto",e.Name="name",e.None="none",e.Value="value",e.ValueAndName="value_and_name",e))($d||{}),Fd=(e=>(e.Inverted="inverted",e.SameAsValue="same_as_value",e.Standard="standard",e))(Fd||{}),jd=(e=>(e.Multi="multi",e.None="none",e.Single="single",e))(jd||{});var zd=(e=>(e.Basic="basic",e.Gradient="gradient",e.Lcd="lcd",e))(zd||{}),Bd=(e=>(e.Color="color",e.Hidden="hidden",e.Text="text",e))(Bd||{}),Ud=(e=>(e.Auto="auto",e.Hidden="hidden",e.Left="left",e.Top="top",e))(Ud||{}),Wd=(e=>(e.Auto="auto",e.Manual="manual",e))(Wd||{}),Hd=(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))(Hd||{}),qd=(e=>(e.Auto="auto",e.Lg="lg",e.Md="md",e.Sm="sm",e))(qd||{});Hd.Auto;const Gd={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:Ld.Auto,showValue:Id.Auto,stacking:Pd.None,xTickLabelRotation:0,xTickLabelSpacing:0},Qd={fillOpacity:80,gradientMode:Td.None,lineWidth:1},Kd={displayMode:zd.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:Ud.Auto,showUnfilled:!0,sizing:Wd.Auto,valueMode:Bd.Color},Yd={selectedSeries:0},Xd={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:Wd.Auto},Zd={layers:[]};const Jd={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:Id.Auto,tooltip:{mode:jd.Single,yHistogram:!1,showColorScale:!1}},ep={bucketCount:30,bucketOffset:0},tp={fillOpacity:80,gradientMode:Td.None,lineWidth:1},np={showImage:!0};const rp={displayLabels:[]},ap={colorMode:Md.Value,graphMode:Vd.Area,justifyMode:Nd.Auto,percentChangeColorMode:Fd.Standard,showPercentChange:!1,textMode:$d.Auto,wideLayout:!0},ip={alignValue:"left",mergeValues:!0,perPage:20,rowHeight:.9,showValue:Id.Auto},op={fillOpacity:70,lineWidth:0},sp={colWidth:.9,perPage:20,rowHeight:.9,showValue:Id.Auto},lp={fillOpacity:70,lineWidth:1},up={cellHeight:qd.Sm,frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]};const cp={content:"# Title\n\nFor markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)",mode:"markdown"};const dp={fillOpacity:50,show:"points"},pp={series:[]};class hp{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 fp extends hp{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(Yc(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 mp{constructor(e){this.defaultFieldConfig=e,this._fieldConfig={defaults:{},overrides:[]},this._overridesBuilder=new fp,this.setDefaults()}setDefaults(){const e={defaults:{custom:this.defaultFieldConfig?(0,k.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,k.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 gp{constructor(e){this.defaultOptions=e,this._options={},this.setDefaults()}setDefaults(){this._options=this.defaultOptions?(0,k.cloneDeep)(this.defaultOptions()):{}}setOption(e,t){return this._options=(0,k.merge)(this._options,{[e]:t}),this}build(){return this._options}}class vp{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 mp(r),this._panelOptionsBuilder=new gp(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 Yn({...this._state,options:this._panelOptionsBuilder.build(),fieldConfig:this._fieldConfigBuilder.build()})}}const bp={barchart:()=>new vp("barchart","10.0.0",()=>Gd,()=>Qd),bargauge:()=>new vp("bargauge","10.0.0",()=>Kd),datagrid:()=>new vp("datagrid","10.0.0",()=>Yd),flamegraph:()=>new vp("flamegraph","10.0.0"),gauge:()=>new vp("gauge","10.0.0",()=>Xd),geomap:()=>new vp("geomap","10.0.0",()=>Zd),heatmap:()=>new vp("heatmap","10.0.0",()=>Jd),histogram:()=>new vp("histogram","10.0.0",()=>ep,()=>tp),logs:()=>new vp("logs","10.0.0"),news:()=>new vp("news","10.0.0",()=>np),nodegraph:()=>new vp("nodeGraph","10.0.0"),piechart:()=>new vp("piechart","10.0.0",()=>rp),stat:()=>new vp("stat","10.0.0",()=>ap),statetimeline:()=>new vp("state-timeline","10.0.0",()=>ip,()=>op),statushistory:()=>new vp("status-history","10.0.0",()=>sp,()=>lp),table:()=>new vp("table","10.0.0",()=>up),text:()=>new vp("text","10.0.0",()=>cp),timeseries:()=>new vp("timeseries","10.0.0"),trend:()=>new vp("trend","10.0.0"),traces:()=>new vp("traces","10.0.0"),xychart:()=>new vp("xychart","10.0.0",()=>pp,()=>dp)};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 yp={barchart:()=>new mp(()=>Qd),bargauge:()=>new mp,datagrid:()=>new mp,flamegraph:()=>new mp,gauge:()=>new mp,geomap:()=>new mp,heatmap:()=>new mp,histogram:()=>new mp(()=>tp),logs:()=>new mp,news:()=>new mp,nodegraph:()=>new mp,piechart:()=>new mp,stat:()=>new mp,statetimeline:()=>new mp(()=>op),statushistory:()=>new mp(()=>lp),table:()=>new mp,text:()=>new mp,timeseries:()=>new mp,trend:()=>new mp,traces:()=>new mp,xychart:()=>new mp(()=>dp)},wp={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(A.has(e.uid))throw new Error(`A runtime data source with uid ${e.uid} has already been registered`);A.set(e.uid,e)},registerVariableMacro:function(e,t,n=!1){if(!n&&Ue.get(e))throw new Error(`Macro already registered ${e}`);return Ue.set(e,t),()=>{if(n)throw new Error("Replaced macros can not be unregistered. They need to be restored manually.");Ue.delete(e)}},cloneSceneObjectState:R,syncStateFromSearchParams:function(e,t,n){L(e,t,new I(n))},getUrlState:P,renderPrometheusLabelFilters:Zs,escapeLabelValueInRegexSelector:el,escapeLabelValueInExactSelector:Js,escapeURLDelimiters:function(e){return al(rl(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},isSwitchVariable:function(e){return"switch"===e.state.type},isRepeatCloneOrChildOf:Ve,buildPathIdFor:Bl}},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,k="object"==typeof self&&self&&self.Object===Object&&self,R=C||k||Function("return this")(),O=t&&!t.nodeType&&t,A=O&&e&&!e.nodeType&&e,D=A&&A.exports===O,I=D&&C.process,T=function(){try{return I&&I.binding&&I.binding("util")}catch(e){}}(),P=T&&T.isTypedArray;function L(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function M(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function V(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var N,$,F,j=Array.prototype,z=Function.prototype,B=Object.prototype,U=R["__core-js_shared__"],W=z.toString,H=B.hasOwnProperty,q=(N=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"",G=B.toString,Q=RegExp("^"+W.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),K=D?R.Buffer:void 0,Y=R.Symbol,X=R.Uint8Array,Z=B.propertyIsEnumerable,J=j.splice,ee=Y?Y.toStringTag:void 0,te=Object.getOwnPropertySymbols,ne=K?K.isBuffer:void 0,re=($=Object.keys,F=Object,function(e){return $(F(e))}),ae=Te(R,"DataView"),ie=Te(R,"Map"),oe=Te(R,"Promise"),se=Te(R,"Set"),le=Te(R,"WeakMap"),ue=Te(Object,"create"),ce=Ve(ae),de=Ve(ie),pe=Ve(oe),he=Ve(se),fe=Ve(le),me=Y?Y.prototype:void 0,ge=me?me.valueOf:void 0;function ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function be(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ye(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function we(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ye;++t<n;)this.add(e[t])}function Se(e){var t=this.__data__=new be(e);this.size=t.size}function xe(e,t){var n=Fe(e),r=!n&&$e(e),a=!n&&!r&&je(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(Ne(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 ke(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=Fe(e),y=Fe(t),x=f?o:Le(e),E=y?o:Le(t),_=(x=x==i?h:x)==h,C=(E=E==i?h:E)==h,k=x==E;if(k&&je(e)){if(!je(t))return!1;f=!0,_=!1}if(k&&!_)return c||(c=new Se),f||He(e)?Ae(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 Ne(+e,+t);case u:return e.name==t.name&&e.message==t.message;case m:case v:return e==t+"";case d:var c=M;case g:var h=1&r;if(c||(c=V),e.size!=t.size&&!h)return!1;var f=o.get(e);if(f)return f==t;r|=2,o.set(e,t);var y=Ae(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 R=_&&H.call(e,"__wrapped__"),O=C&&H.call(t,"__wrapped__");if(R||O){var A=R?e.value():e,D=O?t.value():t;return c||(c=new Se),a(A,D,n,r,c)}}if(!k)return!1;return c||(c=new Se),function(e,t,n,r,a,i){var o=1&n,s=De(e),l=s.length,u=De(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,ke,a))}function Re(e){return!(!Ue(e)||function(e){return!!q&&q in e}(e))&&(ze(e)?Q:x).test(Ve(e))}function Oe(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 Ae(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 De(e){return function(e,t,n){var r=t(e);return Fe(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 Ie(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 Te(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Re(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=Ie(this,e).delete(e);return this.size-=t?1:0,t},ye.prototype.get=function(e){return Ie(this,e).get(e)},ye.prototype.has=function(e){return Ie(this,e).has(e)},ye.prototype.set=function(e,t){var n=Ie(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 Ve(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ne(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?Ve(n):"";if(r)switch(r){case ce:return S;case de:return d;case pe:return f;case he:return g;case fe:return y}return t});var $e=Ce(function(){return arguments}())?Ce:function(e){return We(e)&&H.call(e,"callee")&&!Z.call(e,"callee")},Fe=Array.isArray;var je=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):Oe(e);var t}e.exports=function(e,t){return ke(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}},5380:(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(5380),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 k=(0,u.calcXY)(g,s,l,h,f),R=k.x,O=k.y;return o.call(b(e),p,R,O,{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",k=!1;try{k=/firefox/i.test(navigator.userAgent)}catch(e){}var R=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(),k&&(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,R=_.left,O=_.top;(R!=S||O!=x)&&e.setState({droppingPosition:E})}}else{var A={cols:u,margin:s,maxRows:d,rowHeight:c,containerWidth:p,containerPadding:f||s},D=(0,l.calcXY)(A,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:D.x,y:D.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,k="boolean"==typeof n.isResizable?n.isResizable:!n.static&&f,R=n.resizeHandles||w,O=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:k,isBounded:O,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:R,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=R,_(R,"displayName","ReactGridLayout"),_(R,"propTypes",c.default),_(R,"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=k,t.moveElementAwayFromCollision=R,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=O,t.sortLayoutItemsByColRow=D,t.sortLayoutItemsByRowCol=A,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||I([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=I,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=O(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 k(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;T("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=O(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 T("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];T("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?R(e,v,t,a,o,s):R(e,t,v,a,o,s))}return e}function R(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 T("Doing reverse collision on ".concat(n.i," up to [").concat(u.x,",").concat(u.y,"].")),k(e,n,o?u.x:void 0,s?u.y:void 0,r,l,a,i)}return k(e,n,o?n.x+1:void 0,s?n.y+1:void 0,r,l,a,i)}function O(e,t){return"horizontal"===t?D(e):"vertical"===t?A(e):e}function A(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 D(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 I(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 T(){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},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:k,toLower:R,compare:O}=e;g??=h,v??=h,b??=h,y??=h,O??="undefined"==typeof Intl?r:new Intl.Collator(...l).compare;let A=e.letters??e.alpha;if(null!=A){let e=k(A),t=R(A);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 D=t?"u":"";const I='".+?"',T=new RegExp(I,"gi"+D),P=new RegExp(`(?:\\s+|^)-(?:${C}+|${I})`,"gi"+D);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,V=new RegExp(S,"g"+D),N=new RegExp(x,"g"+D),$=new RegExp("^"+x+"|"+x+"$","g"+D),F=new RegExp(w,"gi"+D);const j=(e,t=!1)=>{let n=[];e=(e=e.replace(T,e=>(n.push(e),o))).replace($,""),t||(e=R(e)),M&&(e=e.replace(V,e=>e[0]+" "+e[1]));let r=0;return e.split(N).filter(e=>""!=e).map(e=>e===o?n[r++]:e)},z=/[^\d]+|\d+/g,B=(t,r=0,o=!1)=>{let s=j(t);if(0==s.length)return[];let l,u=Array(s.length).fill("");if(s=s.map((e,t)=>e.replace(F,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"+D),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(_,D),q=new RegExp(E,D);const G=(t,r,i)=>{let[o,s,l]=B(i,1),u=j(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,k=0,O=0,A=[];for(let t=0,r=2;t<d;t++,r+=2){let i=R(l[r]),o=p[t],c=h[t],g=o.length,b=i.length,I=i==o;if(l[r]==c&&C++,!I&&l[r+1].length>=g){let e=R(l[r+1]).indexOf(o);e>-1&&(A.push(f,b,e,g),f+=Q(l,r,e,g),i=o,b=g,I=!0,0==t&&(u=f))}if(v||I){let e=f-1,c=f+b,d=!1,p=!1;if(-1==e||H.test(s[e]))I&&y++,d=!0;else{if(2==n){m=!0;break}if(W&&q.test(s[e]+s[e+1]))I&&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"+D);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,A.push(f,b,c,g),f+=Q(l,r,c,g),i=o,b=g,I=!0,0==t&&(u=f))}if(!d){m=!0;break}}}if(c==s.length||H.test(s[c]))I&&S++,p=!0;else{if(2==a){m=!0;break}if(W&&q.test(s[c-1]+s[c]))I&&x++,p=!0;else if(1==a){m=!0;break}}I&&(E+=g,d&&p&&_++)}if(b>g&&(O+=b-g),t>0&&(k+=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]=k,g.intraIns[b]=O,g.start[b]=u;let e=s.match(c),n=e.index+e[1].length,r=A.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&&A[a]==n){let r=A[a+1],i=A[a+2],o=A[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=j(n);if(c.length>0){if(d=new RegExp(c.join("|"),"i"+D),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=j(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,O);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:j,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:()=>k});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:k,status:R}=y,O=x(e),A=x(y),D=(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)),I=(0,r.useRef)(!1),T=(0,r.useRef)(!1),P=(0,r.useCallback)(e=>{I.current&&(S({status:"Browser does not support SVG"===e.message?f.UNSUPPORTED:f.FAILED}),l?.(e))},[l]),L=(0,r.useCallback)((e,t=!1)=>{I.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]),V=(0,r.useCallback)(()=>{try{const t=u(E({...e,handleError:P,hash:D.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]),N=(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()=>{I.current&&S({content:"",element:null,isCached:!1,status:f.LOADING})},[]);(0,r.useEffect)(()=>{if(I.current=!0,g()&&!T.current){try{if(R===f.IDLE){if(!v())throw new Error("Browser does not support SVG");if(!d)throw new Error("Missing src");$()}}catch(e){P(e)}return T.current=!0,()=>{I.current=!1}}},[]),(0,r.useEffect)(()=>{if(g()&&O&&O.src!==d){if(!d)return void P(new Error("Missing src"));$()}},[P,$,O,d]),(0,r.useEffect)(()=>{R===f.LOADED&&V()},[R,V]),(0,r.useEffect)(()=>{g()&&O&&O.src===d&&(O.title===p&&O.description===a||V())},[a,V,O,d,p]),(0,r.useEffect)(()=>{if(A)switch(R){case f.LOADING:A.status!==f.LOADING&&N();break;case f.LOADED:A.status!==f.LOADED&&V();break;case f.READY:A.status!==f.READY&&c?.(d,k)}},[N,V,k,c,A,d,R]);const F=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,...F}):[f.UNSUPPORTED,f.FAILED].includes(R)?n:s:s}function k(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=217.js.map?_cache=4231b6407cfa15e86348