(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8138],{6191:(I,x,s)=>{"use strict";s.d(x,{X:()=>M});var H=s(32196),R=s(96540),F=s(40845);const M=({children:c})=>{const h=(0,F.of)(j);return R.createElement("div",{className:h.root},c)},j=c=>({root:(0,H.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:c.spacing(3),minHeight:c.spacing(4)})})},31347:(I,x,s)=>{"use strict";s.d(x,{Z:()=>R});var H=s(96540);const R=({grow:F,shrink:M})=>H.createElement("div",{style:{display:"block",flexGrow:F,flexShrink:M}})},22354:(I,x,s)=>{"use strict";s.d(x,{W:()=>B});var H=s(32196),R=s(96540),F=s(40845),M=s(88323),j=s(4603),c=Object.defineProperty,h=Object.defineProperties,v=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,ce=(te,O,z)=>O in te?c(te,O,{enumerable:!0,configurable:!0,writable:!0,value:z}):te[O]=z,se=(te,O)=>{for(var z in O||(O={}))L.call(O,z)&&ce(te,z,O[z]);if(d)for(var z of d(O))T.call(O,z)&&ce(te,z,O[z]);return te},Z=(te,O)=>h(te,v(O)),ee=(te,O)=>{var z={};for(var ae in te)L.call(te,ae)&&O.indexOf(ae)<0&&(z[ae]=te[ae]);if(te!=null&&d)for(var ae of d(te))O.indexOf(ae)<0&&T.call(te,ae)&&(z[ae]=te[ae]);return z};function B(te){var O=te,{label:z}=O,ae=ee(O,["label"]);const C=(0,F.of)(oe),[de]=(0,R.useState)(()=>Math.random().toString(16).slice(2)),l={SelectContainer:Q,ValueContainer:g,SingleValue:g};return R.createElement("div",{className:C.root},z&&R.createElement("label",{className:C.label,htmlFor:de},z,":","\xA0"),R.createElement(M.l6,Z(se({openMenuOnFocus:!0,inputId:de},ae),{components:l})))}const Q=te=>{const{children:O}=te,z=(0,F.of)(oe);return R.createElement(j.K,Z(se({},te),{className:(0,H.cx)(te.className,z.container)}),O)},g=te=>{const{className:O,children:z}=te,ae=(0,F.of)(oe);return R.createElement("div",{className:(0,H.cx)(O,ae.valueContainer)},z)},oe=te=>({root:(0,H.css)({display:"flex",fontSize:12,alignItems:"center"}),label:(0,H.css)({color:te.colors.text.secondary,whiteSpace:"nowrap"}),container:(0,H.css)({background:"none",borderColor:"transparent"}),valueContainer:(0,H.css)({display:"flex",alignItems:"center",flex:"initial",color:te.colors.text.secondary,fontSize:12})})},74526:()=>{(function(){"use strict";/**
 * Bindonce - Zero watches binding for AngularJs
 * @version v0.3.1
 * @link https://github.com/Pasvaz/bindonce
 * @author Pasquale Vazzana <pasqualevazzana@gmail.com>
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */var I=angular.module("pasvaz.bindonce",[]);I.directive("bindonce",function(){var x=function(R){if(R&&R.length!==0){var F=angular.lowercase(""+R);R=!(F==="f"||F==="0"||F==="false"||F==="no"||F==="n"||F==="[]")}else R=!1;return R},s=parseInt((/msie (\d+)/.exec(angular.lowercase(navigator.userAgent))||[])[1],10);isNaN(s)&&(s=parseInt((/trident\/.*; rv:(\d+)/.exec(angular.lowercase(navigator.userAgent))||[])[1],10));var H={restrict:"AM",controller:["$scope","$element","$attrs","$interpolate",function(R,F,M,j){var c=function(d,L,T){var ce=L==="show"?"":"none",se=L==="hide"?"":"none";d.css("display",x(T)?ce:se)},h=function(d,L){if(angular.isObject(L)&&!angular.isArray(L)){var T=[];angular.forEach(L,function(ce,se){ce&&T.push(se)}),L=T}L&&d.addClass(angular.isArray(L)?L.join(" "):L)},v={watcherRemover:void 0,binders:[],group:M.boName,element:F,ran:!1,addBinder:function(d){this.binders.push(d),this.ran&&this.runBinders()},setupWatcher:function(d){var L=this;this.watcherRemover=R.$watch(d,function(T){T!==void 0&&(L.removeWatcher(),L.runBinders())},!0)},removeWatcher:function(){this.watcherRemover!==void 0&&(this.watcherRemover(),this.watcherRemover=void 0)},runBinders:function(){for(;this.binders.length>0;){var d=this.binders.shift();if(!(this.group&&this.group!=d.group)){var L=d.scope.$eval(d.interpolate?j(d.value):d.value);switch(d.attr){case"boIf":x(L)&&d.transclude(d.scope.$new(),function(Z){var ee=d.element.parent(),B=d.element&&d.element[d.element.length-1],Q=ee&&ee[0]||B&&B.parentNode,g=B&&B.nextSibling||null;angular.forEach(Z,function(oe){Q.insertBefore(oe,g)})});break;case"boSwitch":var T,ce=d.controller[0];(T=ce.cases["!"+L]||ce.cases["?"])&&(d.scope.$eval(d.attrs.change),angular.forEach(T,function(Z){Z.transclude(d.scope.$new(),function(ee){var B=Z.element.parent(),Q=Z.element&&Z.element[Z.element.length-1],g=B&&B[0]||Q&&Q.parentNode,oe=Q&&Q.nextSibling||null;angular.forEach(ee,function(te){g.insertBefore(te,oe)})})}));break;case"boSwitchWhen":var se=d.controller[0];se.cases["!"+d.attrs.boSwitchWhen]=se.cases["!"+d.attrs.boSwitchWhen]||[],se.cases["!"+d.attrs.boSwitchWhen].push({transclude:d.transclude,element:d.element});break;case"boSwitchDefault":var se=d.controller[0];se.cases["?"]=se.cases["?"]||[],se.cases["?"].push({transclude:d.transclude,element:d.element});break;case"hide":case"show":c(d.element,d.attr,L);break;case"class":h(d.element,L);break;case"text":d.element.text(L);break;case"html":d.element.html(L);break;case"style":d.element.css(L);break;case"src":d.element.attr(d.attr,L),s&&d.element.prop("src",L);break;case"attr":angular.forEach(d.attrs,function(Z,ee){var B,Q;ee.match(/^boAttr./)&&d.attrs[ee]&&(B=ee.replace(/^boAttr/,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),Q=d.scope.$eval(d.attrs[ee]),d.element.attr(B,Q))});break;case"href":case"alt":case"title":case"id":case"value":d.element.attr(d.attr,L);break}}}this.ran=!0}};return v}],link:function(R,F,M,j){var c=M.bindonce?R.$eval(M.bindonce):!0;c!==void 0?j.runBinders():(j.setupWatcher(M.bindonce),F.bind("$destroy",j.removeWatcher))}};return H}),angular.forEach([{directiveName:"boShow",attribute:"show"},{directiveName:"boHide",attribute:"hide"},{directiveName:"boClass",attribute:"class"},{directiveName:"boText",attribute:"text"},{directiveName:"boBind",attribute:"text"},{directiveName:"boHtml",attribute:"html"},{directiveName:"boSrcI",attribute:"src",interpolate:!0},{directiveName:"boSrc",attribute:"src"},{directiveName:"boHrefI",attribute:"href",interpolate:!0},{directiveName:"boHref",attribute:"href"},{directiveName:"boAlt",attribute:"alt"},{directiveName:"boTitle",attribute:"title"},{directiveName:"boId",attribute:"id"},{directiveName:"boStyle",attribute:"style"},{directiveName:"boValue",attribute:"value"},{directiveName:"boAttr",attribute:"attr"},{directiveName:"boIf",transclude:"element",terminal:!0,priority:1e3},{directiveName:"boSwitch",require:"boSwitch",controller:function(){this.cases={}}},{directiveName:"boSwitchWhen",transclude:"element",priority:800,require:"^boSwitch"},{directiveName:"boSwitchDefault",transclude:"element",priority:800,require:"^boSwitch"}],function(x){var s=200;return I.directive(x.directiveName,function(){var H={priority:x.priority||s,transclude:x.transclude||!1,terminal:x.terminal||!1,require:["^bindonce"].concat(x.require||[]),controller:x.controller,compile:function(R,F,M){return function(j,c,h,v){var d=v[0],L=h.boParent;if(L&&d.group!==L){var T=d.element.parent();d=void 0;for(var ce;T[0].nodeType!==9&&T.length;){if((ce=T.data("$bindonceController"))&&ce.group===L){d=ce;break}T=T.parent()}if(!d)throw new Error("No bindonce controller: "+L)}d.addBinder({element:c,attr:x.attribute||x.directiveName,attrs:h,value:h[x.directiveName],interpolate:x.interpolate,group:L,transclude:M,controller:v.slice(1),scope:j})}}};return H})})})()},32747:()=>{/**
 * @license AngularJS v1.8.3
 * (c) 2010-2020 Google LLC. http://angularjs.org
 * License: MIT
 */(function(I,x){"use strict";function s(Z,ee){if(R(Z)){ee=ee||[];for(var B=0,Q=Z.length;B<Q;B++)ee[B]=Z[B]}else if(F(Z)){ee=ee||{};for(var g in Z)g.charAt(0)==="$"&&g.charAt(1)==="$"||(ee[g]=Z[g])}return ee||Z}function H(Z,ee){var B=[],Q=Z.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(g,oe,te,O){var z=O==="?"||O==="*?",ae=O==="*"||O==="*?";return B.push({name:te,optional:z}),oe=oe||"",(z?"(?:"+oe:oe+"(?:")+(ae?"(.+?)":"([^/]+)")+(z?"?)?":")")}).replace(/([/$*])/g,"\\$1");return ee.ignoreTrailingSlashes&&(Q=Q.replace(/\/+$/,"")+"/*"),{keys:B,regexp:new RegExp("^"+Q+"(?:[?#]|$)",ee.caseInsensitiveMatch?"i":"")}}var R,F,M,j,c=x.module("ngRoute",[]).info({angularVersion:"1.8.3"}).provider("$route",d).run(L),h=x.$$minErr("ngRoute"),v;function d(){R=x.isArray,F=x.isObject,M=x.isDefined,j=x.noop;function Z(B,Q){return x.extend(Object.create(B),Q)}var ee={};this.when=function(B,Q){var g=s(Q);if(x.isUndefined(g.reloadOnUrl)&&(g.reloadOnUrl=!0),x.isUndefined(g.reloadOnSearch)&&(g.reloadOnSearch=!0),x.isUndefined(g.caseInsensitiveMatch)&&(g.caseInsensitiveMatch=this.caseInsensitiveMatch),ee[B]=x.extend(g,{originalPath:B},B&&H(B,g)),B){var oe=B[B.length-1]==="/"?B.substr(0,B.length-1):B+"/";ee[oe]=x.extend({originalPath:B,redirectTo:B},H(oe,g))}return this},this.caseInsensitiveMatch=!1,this.otherwise=function(B){return typeof B=="string"&&(B={redirectTo:B}),this.when(null,B),this},v=!0,this.eagerInstantiationEnabled=function(Q){return M(Q)?(v=Q,this):v},this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","$browser",function(B,Q,g,oe,te,O,z,ae){var C=!1,de,l,me={routes:ee,reload:function(){C=!0;var G={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0,C=!1}};B.$evalAsync(function(){le(G),G.defaultPrevented||re()})},updateParams:function(G){if(this.current&&this.current.$$route)G=x.extend({},this.current.params,G),Q.path(Me(this.current.$$route.originalPath,G)),Q.search(G);else throw h("norout","Tried updating route with no current route")}};return B.$on("$locationChangeStart",le),B.$on("$locationChangeSuccess",re),me;function A(G,V){var N=V.keys,Y={};if(!V.regexp)return null;var X=V.regexp.exec(G);if(!X)return null;for(var ie=1,ne=X.length;ie<ne;++ie){var ye=N[ie-1],U=X[ie];ye&&U&&(Y[ye.name]=U)}return Y}function le(G){var V=me.current;de=we(),l=De(de,V),!l&&(V||de)&&B.$broadcast("$routeChangeStart",de,V).defaultPrevented&&G&&G.preventDefault()}function re(){var G=me.current,V=de;if(l)G.params=V.params,x.copy(G.params,g),B.$broadcast("$routeUpdate",G);else if(V||G){C=!1,me.current=V;var N=oe.resolve(V);ae.$$incOutstandingRequestCount("$route"),N.then(K).then(q).then(function(Y){return Y&&N.then(Te).then(function(X){V===me.current&&(V&&(V.locals=X,x.copy(V.params,g)),B.$broadcast("$routeChangeSuccess",V,G))})}).catch(function(Y){V===me.current&&B.$broadcast("$routeChangeError",V,G,Y)}).finally(function(){ae.$$completeOutstandingRequest(j,"$route")})}}function K(G){var V={route:G,hasRedirection:!1};if(G){if(G.redirectTo)if(x.isString(G.redirectTo))V.path=Me(G.redirectTo,G.params),V.search=G.params,V.hasRedirection=!0;else{var N=Q.path(),Y=Q.search(),X=G.redirectTo(G.pathParams,N,Y);x.isDefined(X)&&(V.url=X,V.hasRedirection=!0)}else if(G.resolveRedirectTo)return oe.resolve(te.invoke(G.resolveRedirectTo)).then(function(ie){return x.isDefined(ie)&&(V.url=ie,V.hasRedirection=!0),V})}return V}function q(G){var V=!0;if(G.route!==me.current)V=!1;else if(G.hasRedirection){var N=Q.url(),Y=G.url;Y?Q.url(Y).replace():Y=Q.path(G.path).search(G.search).replace().url(),Y!==N&&(V=!1)}return V}function Te(G){if(G){var V=x.extend({},G.resolve);x.forEach(V,function(Y,X){V[X]=x.isString(Y)?te.get(Y):te.invoke(Y,null,null,X)});var N=ge(G);return x.isDefined(N)&&(V.$template=N),oe.all(V)}}function ge(G){var V,N;return x.isDefined(V=G.template)?x.isFunction(V)&&(V=V(G.params)):x.isDefined(N=G.templateUrl)&&(x.isFunction(N)&&(N=N(G.params)),x.isDefined(N)&&(G.loadedTemplateUrl=z.valueOf(N),V=O(N))),V}function we(){var G,V;return x.forEach(ee,function(N,Y){!V&&(G=A(Q.path(),N))&&(V=Z(N,{params:x.extend({},Q.search(),G),pathParams:G}),V.$$route=N)}),V||ee[null]&&Z(ee[null],{params:{},pathParams:{}})}function De(G,V){return!C&&G&&V&&G.$$route===V.$$route&&(!G.reloadOnUrl||!G.reloadOnSearch&&x.equals(G.pathParams,V.pathParams))}function Me(G,V){var N=[];return x.forEach((G||"").split(":"),function(Y,X){if(X===0)N.push(Y);else{var ie=Y.match(/(\w+)(?:[?*])?(.*)/),ne=ie[1];N.push(V[ne]),N.push(ie[2]||""),delete V[ne]}}),N.join("")}}]}L.$inject=["$injector"];function L(Z){v&&Z.get("$route")}c.provider("$routeParams",T);function T(){this.$get=function(){return{}}}c.directive("ngView",ce),c.directive("ngView",se),ce.$inject=["$route","$anchorScroll","$animate"];function ce(Z,ee,B){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(Q,g,oe,te,O){var z,ae,C,de=oe.autoscroll,l=oe.onload||"";Q.$on("$routeChangeSuccess",A),A();function me(){C&&(B.cancel(C),C=null),z&&(z.$destroy(),z=null),ae&&(C=B.leave(ae),C.done(function(le){le!==!1&&(C=null)}),ae=null)}function A(){var le=Z.current&&Z.current.locals,re=le&&le.$template;if(x.isDefined(re)){var K=Q.$new(),q=Z.current,Te=O(K,function(ge){B.enter(ge,null,ae||g).done(function(De){De!==!1&&x.isDefined(de)&&(!de||Q.$eval(de))&&ee()}),me()});ae=Te,z=q.scope=K,z.$emit("$viewContentLoaded"),z.$eval(l)}else me()}}}}se.$inject=["$compile","$controller","$route"];function se(Z,ee,B){return{restrict:"ECA",priority:-400,link:function(Q,g){var oe=B.current,te=oe.locals;g.html(te.$template);var O=Z(g.contents());if(oe.controller){te.$scope=Q;var z=ee(oe.controller,te);oe.controllerAs&&(Q[oe.controllerAs]=z),g.data("$ngControllerController",z),g.children().data("$ngControllerController",z)}Q[oe.resolveAs||"$resolve"]=te,O(Q)}}}})(window,window.angular)},23345:(I,x,s)=>{s(32747),I.exports="ngRoute"},81221:()=>{/**
 * @license AngularJS v1.8.3
 * (c) 2010-2020 Google LLC. http://angularjs.org
 * License: MIT
 */(function(I,x){"use strict";var s=x.$$minErr("$sanitize"),H,R,F,M,j,c,h,v,d,L;function T(){var se=!1,Z=!1;this.$get=["$$sanitizeUri",function(N){return se=!0,Z&&R(de,ae),function(Y){var X=[];return d(Y,L(X,function(ie,ne){return!/^unsafe:/.test(N(ie,ne))})),X.join("")}}],this.enableSvg=function(N){return j(N)?(Z=N,this):Z},this.addValidElements=function(N){return se||(M(N)&&(N={htmlElements:N}),q(ae,N.svgElements),q(Q,N.htmlVoidElements),q(de,N.htmlVoidElements),q(de,N.htmlElements)),this},this.addValidAttrs=function(N){return se||R(le,K(N,!0)),this},H=x.bind,R=x.extend,F=x.forEach,M=x.isArray,j=x.isDefined,c=x.$$lowercase,h=x.noop,d=ge,L=Me,v=I.Node.prototype.contains||function(N){return!!(this.compareDocumentPosition(N)&16)};var ee=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,B=/([^#-~ |!])/g,Q=re("area,br,col,hr,img,wbr"),g=re("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),oe=re("rp,rt"),te=R({},oe,g),O=R({},g,re("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),z=R({},oe,re("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),ae=re("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),C=re("script,style"),de=R({},Q,O,z,te),l=re("background,cite,href,longdesc,src,xlink:href,xml:base"),me=re("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),A=re("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",!0),le=R({},l,A,me);function re(N,Y){return K(N.split(","),Y)}function K(N,Y){var X={},ie;for(ie=0;ie<N.length;ie++)X[Y?c(N[ie]):N[ie]]=!0;return X}function q(N,Y){Y&&Y.length&&R(N,K(Y))}var Te=function(N,Y){if(ne())return ye;if(!Y||!Y.implementation)throw s("noinert","Can't create an inert html document");var X=Y.implementation.createHTMLDocument("inert"),ie=(X.documentElement||X.getDocumentElement()).querySelector("body");return U;function ne(){try{return!!ye("")}catch{return!1}}function ye(he){he="<remove></remove>"+he;try{var D=new N.DOMParser().parseFromString(he,"text/html").body;return D.firstChild.remove(),D}catch{return}}function U(he){return ie.innerHTML=he,Y.documentMode&&G(ie),ie}}(I,I.document);function ge(N,Y){N==null?N="":typeof N!="string"&&(N=""+N);var X=Te(N);if(!X)return"";var ie=5;do{if(ie===0)throw s("uinput","Failed to sanitize html because the input is unstable");ie--,N=X.innerHTML,X=Te(N)}while(N!==X.innerHTML);for(var ne=X.firstChild;ne;){switch(ne.nodeType){case 1:Y.start(ne.nodeName.toLowerCase(),we(ne.attributes));break;case 3:Y.chars(ne.textContent);break}var ye;if(!(ye=ne.firstChild)&&(ne.nodeType===1&&Y.end(ne.nodeName.toLowerCase()),ye=V("nextSibling",ne),!ye))for(;ye==null&&(ne=V("parentNode",ne),ne!==X);)ye=V("nextSibling",ne),ne.nodeType===1&&Y.end(ne.nodeName.toLowerCase());ne=ye}for(;ne=X.firstChild;)X.removeChild(ne)}function we(N){for(var Y={},X=0,ie=N.length;X<ie;X++){var ne=N[X];Y[ne.name]=ne.value}return Y}function De(N){return N.replace(/&/g,"&amp;").replace(ee,function(Y){var X=Y.charCodeAt(0),ie=Y.charCodeAt(1);return"&#"+((X-55296)*1024+(ie-56320)+65536)+";"}).replace(B,function(Y){return"&#"+Y.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Me(N,Y){var X=!1,ie=H(N,N.push);return{start:function(ne,ye){ne=c(ne),!X&&C[ne]&&(X=ne),!X&&de[ne]===!0&&(ie("<"),ie(ne),F(ye,function(U,he){var D=c(he),Re=ne==="img"&&D==="src"||D==="background";le[D]===!0&&(l[D]!==!0||Y(U,Re))&&(ie(" "),ie(he),ie('="'),ie(De(U)),ie('"'))}),ie(">"))},end:function(ne){ne=c(ne),!X&&de[ne]===!0&&Q[ne]!==!0&&(ie("</"),ie(ne),ie(">")),ne==X&&(X=!1)},chars:function(ne){X||ie(De(ne))}}}function G(N){for(;N;){if(N.nodeType===I.Node.ELEMENT_NODE)for(var Y=N.attributes,X=0,ie=Y.length;X<ie;X++){var ne=Y[X],ye=ne.name.toLowerCase();(ye==="xmlns:ns1"||ye.lastIndexOf("ns1:",0)===0)&&(N.removeAttributeNode(ne),X--,ie--)}var U=N.firstChild;U&&G(U),N=V("nextSibling",N)}}function V(N,Y){var X=Y[N];if(X&&v.call(Y,X))throw s("elclob","Failed to sanitize html because the element is clobbered: {0}",Y.outerHTML||Y.outerText);return X}}function ce(se){var Z=[],ee=L(Z,h);return ee.chars(se),Z.join("")}x.module("ngSanitize",[]).provider("$sanitize",T).info({angularVersion:"1.8.3"}),x.module("ngSanitize").filter("linky",["$sanitize",function(se){var Z=/((s?ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,ee=/^mailto:/i,B=x.$$minErr("linky"),Q=x.isDefined,g=x.isFunction,oe=x.isObject,te=x.isString;return function(O,z,ae){if(O==null||O==="")return O;if(!te(O))throw B("notstring","Expected string but received: {0}",O);for(var C=g(ae)?ae:oe(ae)?function(){return ae}:function(){return{}},de,l=O,me=[],A,le;de=l.match(Z);)A=de[0],!de[2]&&!de[4]&&(A=(de[3]?"http://":"mailto:")+A),le=de.index,re(l.substr(0,le)),K(A,de[0].replace(ee,"")),l=l.substring(le+de[0].length);return re(l),se(me.join(""));function re(q){q&&me.push(ce(q))}function K(q,Te){var ge,we=C(q);me.push("<a ");for(ge in we)me.push(ge+'="'+we[ge]+'" ');Q(z)&&!("target"in we)&&me.push('target="',z,'" '),me.push('href="',q.replace(/"/g,"&quot;"),'">'),re(Te),me.push("</a>")}}}])})(window,window.angular)},26415:(I,x,s)=>{s(81221),I.exports="ngSanitize"},12582:I=>{"use strict";function x(s){var H=this,R;if(this._au)return;function F(){H.root[H.origin.offset]?j():M()}function M(){R||(R=setInterval(function(){H.root[H.origin.offset]&&(j(),H.update())},300))}function j(){clearInterval(R),R=null}var c=H._debounce(function(){H.update()},300);this._observer=new s(function(){F(),H.update(),c()}),this.on("init",function(){H._observer.observe(H.root,{childList:!0,subtree:!0,characterData:!0}),F()}),this.on("dispose",function(){H._observer.disconnect(),j(),delete H._observer}),this._au=!0}I.exports=function(H){var R=H.MutationObserver||H.WebKitMutationObserver||H.MozMutationObserver||null;return function(){return R?(x.call(this,R),this):this}}},69786:(I,x,s)=>{"use strict";var H=s(69079).qs;I.exports=function(F){var M,j,c,h,v=this,d;h=F.screen||.9,F.forward&&(M=H(F.forward,this.clipper),d={element:M,handler:function(){var L=v.pos()+(F.delta||30);v.pos(L)},type:"click"},this._eventHandlers.push(d),this.event(d.element,d.type,d.handler,"on")),F.backward&&(j=H(F.backward,this.clipper),d={element:j,handler:function(){var L=v.pos()-(F.delta||30);v.pos(L)},type:"click"},this._eventHandlers.push(d),this.event(d.element,d.type,d.handler,"on")),F.track&&(F.track===!0?c=this.track:c=H(F.track,this.clipper),c&&(d={element:c,handler:function(L){if(L.target==c){var T=L["offset"+v.origin.x],ce=v.bar[v.origin.offsetPos],se=0;T<ce?se=-1:T>ce+v.bar[v.origin.offset]&&(se=1);var Z=v.pos()+se*h*v.scroller[v.origin.client];v.pos(Z)}},type:"mousedown"},this._eventHandlers.push(d),this.event(d.element,d.type,d.handler,"on")))}},92747:(I,x,s)=>{"use strict";var H=function(){return this||(0,eval)("this")}(),R=H&&H.window||H,F=s(69079).f0,M=s(69079).AH,j=s(69079).WQ,c=s(69079).zy,h=s(69079).rm,v=s(69079).o8,d=s(69079).qs,L=O,T=["left","top","right","bottom","width","height"],ce=[],se={v:{x:"Y",pos:T[1],oppos:T[3],crossPos:T[0],crossOpPos:T[2],size:T[5],crossSize:T[4],crossMinSize:"min-"+T[4],crossMaxSize:"max-"+T[4],client:"clientHeight",crossClient:"clientWidth",scrollEdge:"scrollLeft",offset:"offsetHeight",crossOffset:"offsetWidth",offsetPos:"offsetTop",scroll:"scrollTop",scrollSize:"scrollHeight"},h:{x:"X",pos:T[0],oppos:T[2],crossPos:T[1],crossOpPos:T[3],size:T[4],crossSize:T[5],crossMinSize:"min-"+T[5],crossMaxSize:"max-"+T[5],client:"clientWidth",crossClient:"clientHeight",scrollEdge:"scrollTop",offset:"offsetWidth",crossOffset:"offsetHeight",offsetPos:"offsetLeft",scroll:"scrollLeft",scrollSize:"scrollWidth"}},Z=17,ee=15,B=/[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/,Q=B.test(R.navigator&&R.navigator.userAgent),g,oe,te;function O(A){var le=!!A,re=A&&A[0]||A,K=typeof A=="string"||re instanceof HTMLElement,q=K?{root:A}:v(A),Te,ge,we={direction:"v",barOnCls:"_scrollbar",resizeDebounce:0,event:F,cssGuru:!1,impact:"scroller",position:"static"};q=q||{};for(var De in we)q[De]==null&&(q[De]=we[De]);Te=this&&this instanceof R.jQuery,q._chain?ge=q.root:Te?q.root=ge=this[0]:ge=d(q.root||q.scroller);var Me=de(ge,q.direction),G=+Me;if(q.index=G,G==G&&Me!==null&&ce[G])return ce[G];q.root&&q.scroller?q.scroller=d(q.scroller,ge):q.scroller=ge,q.root=ge;var V=l(q);return V.autoUpdate&&V.autoUpdate(),V}function z(A,le){var re=0,K=A;for((K.length===void 0||K===R)&&(K=[K]);K[re];)le.call(this,K[re],re),re++}function ae(){return new Date().getTime()}function C(A,le,re){A._eventHandlers=A._eventHandlers||[{element:A.scroller,handler:function(K){A.scroll(K)},type:"scroll"},{element:A.root,handler:function(){A.update()},type:"transitionend animationend"},{element:A.scroller,handler:function(){A.update()},type:"keyup"},{element:A.bar,handler:function(K){K.preventDefault(),A.selection(),A.drag.now=1,A.draggingCls&&j(A.root,A.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){A.selection(1),A.drag.now=0,A.draggingCls&&h(A.root,A.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(K){K.button!=2&&A._pos0(K)},type:"touchstart mousedown"},{element:document,handler:function(K){A.drag.now&&A.drag(K)},type:"mousemove touchmove"},{element:R,handler:function(){A.update()},type:"resize"},{element:A.root,handler:function(){A.update()},type:"sizeChange"},{element:A.clipper,handler:function(){A.clipperOnScroll()},type:"scroll"}],z(A._eventHandlers,function(K){if(K.element)if(K.element.length&&K.element!==R)for(var q=0;q<K.element.length;q++)le(K.element[q],K.type,K.handler,re);else le(K.element,K.type,K.handler,re)})}function de(A,le,re,K){var q="data-baron-"+le+"-id";return re=="on"?A.setAttribute(q,K):re=="off"&&A.removeAttribute(q),A.getAttribute(q)}function l(A){var le=new O.prototype.constructor(A);return C(le,A.event,"on"),de(le.root,A.direction,"on",ce.length),ce.push(le),le.update(),le}function me(A){if(this.events&&this.events[A])for(var le=0;le<this.events[A].length;le++){var re=Array.prototype.slice.call(arguments,1);this.events[A][le].apply(this,re)}}O.prototype={_debounce:function(A,le){var re=this,K,q,Te=function(){if(re._disposed){clearTimeout(K),K=re=null;return}var ge=ae()-q;ge<le&&ge>=0?K=setTimeout(Te,le-ge):(K=null,A())};return function(){q=ae(),K||(K=setTimeout(Te,le))}},constructor:function(A){var le,re,K,q,Te,ge,we;ge=ae(),this.params=A,this.event=A.event,this.events={},this.root=A.root,this.scroller=d(A.scroller),this.bar=d(A.bar,this.root),K=this.track=d(A.track,this.root),!this.track&&this.bar&&(K=this.bar.parentNode),this.clipper=this.scroller.parentNode,this.direction=A.direction,this.rtl=A.rtl,this.origin=se[this.direction],this.barOnCls=A.barOnCls,this.scrollingCls=A.scrollingCls,this.draggingCls=A.draggingCls,this.impact=A.impact,this.position=A.position,this.rtl=A.rtl,this.barTopLimit=0,this.resizeDebounce=A.resizeDebounce;function De(U){var he=this.barMinSize||20,D=U;D>0&&D<he&&(D=he),this.bar&&M(this.bar,this.origin.size,parseInt(D,10)+"px")}function Me(U){if(this.bar){var he=M(this.bar,this.origin.pos),D=+U+"px";D&&D!=he&&M(this.bar,this.origin.pos,D)}}function G(){return K[this.origin.client]-this.barTopLimit-this.bar[this.origin.offset]}function V(U){return U*G.call(this)+this.barTopLimit}function N(U){return(U-this.barTopLimit)/G.call(this)}this.cursor=function(U){return U["client"+this.origin.x]||(((U.originalEvent||U).touches||{})[0]||{})["page"+this.origin.x]};function Y(){return!1}if(this.pos=function(U){var he="page"+this.origin.x+"Offset",D=this.scroller[he]?he:this.origin.scroll;return U!==void 0&&(this.scroller[D]=U),this.scroller[D]},this.rpos=function(U){var he=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client],D;return U?D=this.pos(U*he):D=this.pos(),D/(he||1)},this.barOn=function(U){if(this.barOnCls){var he=this.scroller[this.origin.client]>=this.scroller[this.origin.scrollSize];U||he?c(this.root,this.barOnCls)&&h(this.root,this.barOnCls):c(this.root,this.barOnCls)||j(this.root,this.barOnCls)}},this._pos0=function(U){re=this.cursor(U)-le},this.drag=function(U){var he=N.call(this,this.cursor(U)-re),D=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=he*D},this.selection=function(U){this.event(document,"selectpos selectstart",Y,U?"off":"on")},this.resize=function(){var U=this,he=U.resizeDebounce===void 0?300:U.resizeDebounce,D=0;ae()-ge<he&&(clearTimeout(q),D=he);function Re(){var Fe=U.scroller[U.origin.crossOffset],xe=U.scroller[U.origin.crossClient],qe=0,Ke,Ve;if(Q?qe=ee:xe>0&&Fe===0&&(Fe=xe+Z),Fe)if(U.barOn(),U.impact=="scroller"){var _e=Fe-xe+qe;if(U.position=="static")Ke=M(U.scroller,U.origin.crossSize),Ve=U.clipper[U.origin.crossClient]+_e+"px",Ke!=Ve&&U._setCrossSizes(U.scroller,Ve);else{var et={},tt=U.rtl?"Left":"Right";U.direction=="h"&&(tt="Bottom"),et["padding"+tt]=_e+"px",M(U.scroller,et)}}else Ke=M(U.clipper,U.origin.crossSize),Ve=xe+"px",Ke!=Ve&&U._setCrossSizes(U.clipper,Ve);Array.prototype.unshift.call(arguments,"resize"),me.apply(U,arguments),ge=ae()}D?q=setTimeout(Re,D):Re()},this.updatePositions=function(U){var he,D=this;D.bar&&(he=(K[D.origin.client]-D.barTopLimit)*D.scroller[D.origin.client]/D.scroller[D.origin.scrollSize],(U||parseInt(we,10)!=parseInt(he,10))&&(De.call(D,he),we=he),le=V.call(D,D.rpos()),Me.call(D,le)),Array.prototype.unshift.call(arguments,"scroll"),me.apply(D,arguments)},this.scroll=function(){var U=this;U.updatePositions(),U.scrollingCls&&(Te||j(U.root,U.scrollingCls),clearTimeout(Te),Te=setTimeout(function(){h(U.root,U.scrollingCls),Te=void 0},300))},this.clipperOnScroll=function(){this.rtl?this.clipper[this.origin.scrollEdge]=this.clipper[this.origin.scrollSize]:this.clipper[this.origin.scrollEdge]=0},this._setCrossSizes=function(U,he){var D={};D[this.origin.crossSize]=he,D[this.origin.crossMinSize]=he,D[this.origin.crossMaxSize]=he,M(U,D)},this._dumbCss=function(U){if(!A.cssGuru){var he=U?"hidden":null,D=U?"none":null;M(this.clipper,{overflow:he,msOverflowStyle:D,position:this.position=="static"?"":"relative"});var Re=U?"scroll":null,Fe=this.direction=="v"?"y":"x",xe={};xe["overflow-"+Fe]=Re,xe["box-sizing"]="border-box",xe.margin="0",xe.border="0",this.position=="absolute"&&(xe.position="absolute",xe.top="0",this.direction=="h"?xe.left=xe.right="0":(xe.bottom="0",xe.right=this.rtl?"0":"",xe.left=this.rtl?"":"0")),M(this.scroller,xe)}},this._dumbCss(!0),Q){var X="paddingRight",ie={},ne=R.getComputedStyle(this.scroller)[[X]];A.direction=="h"?X="paddingBottom":A.rtl&&(X="paddingLeft");var ye=parseInt(ne,10);ye!=ye&&(ye=0),ie[X]=ee+ye+"px",M(this.scroller,ie)}return this},update:function(A){return me.call(this,"upd",A),this.resize(1),this.updatePositions(1),this},dispose:function(){C(this,this.event,"off"),de(this.root,this.params.direction,"off"),this.params.direction=="v"?this._setCrossSizes(this.scroller,""):this._setCrossSizes(this.clipper,""),this._dumbCss(!1),this.barOn(!0),me.call(this,"dispose"),ce[this.params.index]=null,this.params=null,this._disposed=!0},on:function(A,le,re){for(var K=A.split(" "),q=0;q<K.length;q++)K[q]=="init"?le.call(this,re):(this.events[K[q]]=this.events[K[q]]||[],this.events[K[q]].push(function(Te){le.call(this,Te||re)}))},baron:function(A){return A.root=this.params.root,A.scroller=this.params.scroller,A.direction=this.params.direction=="v"?"h":"v",A._chain=!0,O(A)}},O.prototype.constructor.prototype=O.prototype,O.noConflict=function(){return R.baron=L,O},O.version="3.0.1",O.prototype.autoUpdate=s(12582)(R),O.prototype.fix=s(41197),O.prototype.controls=s(69786),I.exports=O},41197:(I,x,s)=>{"use strict";var H=s(37420),R=s(69079).AH,F=s(69079).WQ,M=s(69079).rm;I.exports=function(c){var h,v,d={outside:"",inside:"",before:"",after:"",past:"",future:"",radius:0,minView:0},L=[],T=[],ce=[],se=this.scroller,Z=this.event,ee=this;function B(O,z,ae){var C=z,de=ae==1?"pos":"oppos";v<(d.minView||0)&&(C=void 0),R(h[O],this.origin.pos,""),R(h[O],this.origin.oppos,""),M(h[O],d.outside),C!==void 0&&(C+="px",R(h[O],this.origin[de],C),F(h[O],d.outside))}function Q(O){try{var z=document.createEvent("WheelEvent");z.initWebKitWheelEvent(O.originalEvent.wheelDeltaX,O.originalEvent.wheelDeltaY),se.dispatchEvent(z),O.preventDefault()}catch{}}function g(O){var z;for(var ae in O)d[ae]=O[ae];if(d.elements instanceof HTMLElement?h=[d.elements]:typeof d.elements=="string"?h=this.scroller.querySelectorAll(d.elements):d.elements&&d.elements[0]instanceof HTMLElement&&(h=d.elements),h){v=this.scroller[this.origin.client];for(var C=0;C<h.length;C++)z={},z[this.origin.size]=h[C][this.origin.offset]+"px",h[C].parentNode!==this.scroller&&R(h[C].parentNode,z),z={},z[this.origin.crossSize]=h[C].parentNode[this.origin.crossClient]+"px",R(h[C],z),v-=h[C][this.origin.offset],ce[C]=h[C].parentNode[this.origin.offsetPos],L[C]=L[C-1]||0,T[C]=T[C-1]||Math.min(ce[C],0),h[C-1]&&(L[C]+=h[C-1][this.origin.offset],T[C]+=h[C-1][this.origin.offset]),C==0&&ce[C]==0||(this.event(h[C],"mousewheel",Q,"off"),this.event(h[C],"mousewheel",Q));d.limiter&&h[0]&&(this.track&&this.track!=this.scroller?(z={},z[this.origin.pos]=h[0].parentNode[this.origin.offset]+"px",R(this.track,z)):this.barTopLimit=h[0].parentNode[this.origin.offset],this.scroll()),d.limiter===!1&&(this.barTopLimit=0)}var de={element:h,handler:function(){for(var me=this.parentNode,A=me.offsetTop,le,re=0;re<h.length;re++)h[re]===this&&(le=re);var K=A-L[le];d.scroll?d.scroll({x1:ee.scroller.scrollTop,x2:K}):ee.scroller.scrollTop=K},type:"click"};if(d.clickable){this._eventHandlers.push(de);for(var l=0;l<de.element.length;l++)Z(de.element[l],de.type,de.handler,"on")}}this.on("init",g,c);var oe=[],te=[];return this.on("init scroll",function(){var O,z,ae,C;if(h){var de;for(C=0;C<h.length;C++)O=0,ce[C]-this.pos()<T[C]+d.radius?(O=1,z=L[C]):ce[C]-this.pos()>T[C]+v-d.radius?(O=2,z=this.scroller[this.origin.client]-h[C][this.origin.offset]-L[C]-v):(O=3,z=void 0),ae=!1,(ce[C]-this.pos()<T[C]||ce[C]-this.pos()>T[C]+v)&&(ae=!0),(O!=oe[C]||ae!=te[C])&&(B.call(this,C,z,O),oe[C]=O,te[C]=ae,de=!0);if(de)for(C=0;C<h.length;C++)oe[C]==1&&d.past&&(F(h[C],d.past),M(h[C],d.future)),oe[C]==2&&d.future&&(F(h[C],d.future),M(h[C],d.past)),oe[C]==3&&(M(h[C],d.past),M(h[C],d.future),F(h[C],d.inside)),oe[C]!=oe[C+1]&&oe[C]==1?(F(h[C],d.before),M(h[C],d.after)):oe[C]!=oe[C-1]&&oe[C]==2?(F(h[C],d.after),M(h[C],d.before)):(M(h[C],d.before),M(h[C],d.after)),d.grad&&(te[C]?F(h[C],d.grad):M(h[C],d.grad))}}),this.on("resize upd",function(O){g.call(this,O&&O.fix)}),this}},37420:I=>{I.exports=function(s,H,R){var F=console[s]||console.log,M=["Baron: "+H,R];Function.prototype.apply.call(F,console,M)}},69079:I=>{"use strict";var x,s=!1;try{var H=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("test",null,H)}catch{}I.exports.f0=function(M,j,c,h){var v=j.split(" "),d=h=="on"?"add":"remove";v.forEach(function(L){var T=!1;["scroll","touchstart","touchmove"].indexOf(L)!=-1&&s&&(T={passive:!0}),M[d+"EventListener"](L,c,T)})};function R(F,M){for(var j in F)F.hasOwnProperty(j)&&M(j,F[j])}I.exports.AH=function(M,j,c){var h;if(c===void 0){if(typeof j=="string")return M.style[j];h=j}else h={},h[j]=c;R(h,function(v,d){M.style[v]=d})},I.exports.WQ=function(M,j){j&&M.classList.add(j)},I.exports.rm=function(M,j){j&&M.classList.remove(j)},I.exports.zy=function(M,j){return j?M.classList.contains(j):!1},I.exports.o8=function(M){var j={},c=M||{};return R(c,function(h,v){j[h]=v}),j},I.exports.qs=function(M,j){if(M instanceof HTMLElement)return M;var c=j||document;return c.querySelector(M)},x=R},88138:(I,x,s)=>{"use strict";s.d(x,{AngularApp:()=>Qi});var H=s(92747),R=s.n(H),F=s(64423),M=s(26272),j=s(3591),c=s(67982),h=s(28444);const v=`
  <ng-transclude class="panel-height-helper"></ng-transclude>
`;c.m7.directive("grafanaPanel",["$timeout",t=>({restrict:"E",template:v,transclude:!0,scope:{ctrl:"="},link:(e,r)=>{const n=e.ctrl,i=e.ctrl.panel,a=new F.yU;let o;function u(){o&&o.update()}n.events.on(M.ee.componentDidMount,()=>{if(n.__proto__.constructor.scrollable){const m="baron baron__root baron__clipper panel-content--scrollable",E="baron__scroller",p=`
            <div class="baron__track">
              <div class="baron__bar"></div>
            </div>
          `,S=r,b=r.find(":first").find(":first");S.addClass(m),$(p).appendTo(S),b.addClass(E),o=R()({root:S[0],scroller:b[0],bar:".baron__bar",barOnCls:"_scrollbar",scrollingCls:"_scrolling"}),o.scroll()}});function f(){n.height=e.$parent.$parent.size.height,n.width=e.$parent.$parent.size.width}f(),a.add(i.events.subscribe(j._,()=>{f(),n.events.emit("refresh")})),a.add(i.events.subscribe(h.XM,m=>{m.payload?.fromAngular||(f(),t(()=>{u(),n.events.emit("render")}))})),a.add(n.events.subscribe(h.XM,m=>{m.payload&&(m.payload.fromAngular=!0,i.events.publish(m))})),e.$on("$destroy",()=>{r.off(),a.unsubscribe(),n.events.emit(M.ee.panelTeardown),n.events.removeAllListeners(),o&&o.dispose()}),i.events.publish(h.vk)}})]);var d=s(59559),L=s(7025),T=s.n(L);const ce=T().module("grafana.directives"),se={};ce.directive("panelEditorTab",["dynamicDirectiveSrv",Z]);function Z(t){return t.create({scope:{ctrl:"=",editorTab:"="},directive:e=>{const r=e.ctrl.pluginId,n=e.editorTab.title.toLowerCase().replace(" ","-").replace("&","").replace(" ","").replace(" ","-");if(se[r]){if(se[r][n])return se[r][n]}else se[r]=[];const i={fn:()=>e.editorTab.directiveFn(),name:`panel-editor-tab-${r}${n}`};return se[r][n]=i,i}})}class ee{constructor(){this.hasTextEditMode=!1}$onInit(){this.panelCtrl=this.queryCtrl.panelCtrl,this.target=this.queryCtrl.target,this.panel=this.panelCtrl.panel,this.hasTextEditMode&&this.queryCtrl.toggleEditorMode&&(this.panelCtrl.toggleEditorMode=this.queryCtrl.toggleEditorMode.bind(this.queryCtrl)),this.queryCtrl.getCollapsedText&&(this.panelCtrl.getCollapsedText=this.queryCtrl.getCollapsedText.bind(this.queryCtrl))}}c.m7.directive("queryEditorRow",B);function B(){return{restrict:"E",controller:ee,bindToController:!0,controllerAs:"ctrl",templateUrl:"public/app/angular/panel/partials/query_editor_row.html",transclude:!0,scope:{queryCtrl:"=",canCollapse:"=",hasTextEditMode:"="}}}var Q=s(50410),g=s(2543),oe=s.n(g),te=s(47232),O=s(23989);c.Ay.filter("stringSort",()=>t=>t.sort()),c.Ay.filter("slice",()=>(t,e,r)=>(0,g.isUndefined)(t)?t:t.slice(e,r)),c.Ay.filter("stringify",()=>t=>(0,g.isObject)(t)&&!(0,g.isArray)(t)?T().toJson(t):(0,g.isNull)(t)?null:t.toString()),c.Ay.filter("moment",()=>(t,e)=>{switch(e){case"ago":return(0,te.KQ)(t).fromNow()}return(0,te.KQ)(t).fromNow()});function z(t=(0,O.w)()){const e=(r,n)=>{let i;return n.ctrl?i=(n.ctrl.panel||n.ctrl.row).scopedVars:i=n.row.scopedVars,t.replaceWithText(r,i)};return e.$stateful=!0,e}c.Ay.filter("interpolateTemplateVars",z);const ae={};class C{constructor(){}set(){console.warn("old deprecated alert srv being used")}}c.Ay.service("alertSrv",C);class de{constructor(e){this.$compile=e}static{this.$inject=["$compile"]}addDirective(e,r,n){const i=T().element(document.createElement(r));this.$compile(i)(n),e.empty(),e.append(i)}link(e,r,n,i){const a=i.directive(e);if(!a||!a.fn){r.empty();return}a.fn.registered||(c.Ay.directive(n.$normalize(a.name),a.fn),a.fn.registered=!0),this.addDirective(r,a.name,e)}create(e){return{restrict:"E",scope:e.scope,link:(n,i,a)=>{if(e.watchPath){let o=null;n.$watch(e.watchPath,()=>{o&&o.$destroy(),o=n.$new(),this.link(o,i,a,e)})}else this.link(n,i,a,e)}}}}c.Ay.service("dynamicDirectiveSrv",de);var l=s(96540),me=s(5338);function A(t,e){if(T().isFunction(t))return t;if(!t)throw new Error("ReactComponent name attribute must be specified");let r;try{r=e.get(t)}catch{}if(!r)try{r=t.split(".").reduce((n,i)=>n[i],window)}catch{}if(!r)throw Error("Cannot find react component "+t);return r}function le(t,e){if(t.wrappedInApply)return t;const r=function(){const n=arguments,i=e.$root.$$phase;return i==="$apply"||i==="$digest"?t.apply(null,n):e.$apply(()=>t.apply(null,n))};return r.wrappedInApply=!0,r}function re(t,e,r){return Object.keys(t||{}).reduce((n,i)=>{const a=t[i],o=(r||{})[i]||{};return n[i]=T().isFunction(a)&&o.wrapApply!==!1?le(a,e):a,n},{})}function K(t,e,r,n){const i=T().isFunction(e.$watchCollection),a=T().isFunction(e.$watchGroup),o=[];for(const u of r){const f=we(u),m=Me(t,u);!f||f.match(/\(.*\)/)||m==="one-time"||(m==="collection"&&i?e.$watchCollection(f,n):m==="reference"&&a?o.push(f):e.$watch(f,n,m!=="reference"))}t==="one-time"&&n(),o.length&&e.$watchGroup(o,n)}function q(t,e,r,n){r.$evalAsync(()=>{n.render(l.createElement(t,e))})}function Te(t){return Array.isArray(t)?t[0]:t}function ge(t){return Array.isArray(t)?t[1]:{}}function we(t){return Array.isArray(t)?t[0]:t}function De(t,e){const r=Object.keys(t).find(n=>n.toLowerCase()===e.toLowerCase()||(0,g.kebabCase)(n)===(0,g.kebabCase)(e));return t[r]}function Me(t,e){return Array.isArray(e)&&T().isObject(e[1])&&e[1].watchDepth||t}const G=t=>({restrict:"E",replace:!0,link:function(e,r,n){const i=A(n.name,t),a=(0,me.H)(r[0]),o=()=>{const u=e.$eval(n.props),f=re(u,e);q(i,f,e,a)};n.props?K(n.watchDepth,e,[n.props],o):o(),e.$on("$destroy",()=>{n.onScopeDestroy?e.$eval(n.onScopeDestroy,{unmountComponent:a.unmount.bind(this)}):a.unmount()})}}),V=t=>(e,r,n,i)=>{const a={restrict:"E",replace:!0,link:function(o,u,f){const m=A(e,t),E=(0,me.H)(u[0]);r=r||Object.keys(m.propTypes||{});const p=()=>{let b={};const k={};r.forEach(pe=>{const w=Te(pe);b[w]=o.$eval(De(f,w)),k[w]=ge(pe)}),b=re(b,o,k),b=T().extend({},b,i),q(m,b,o,E)},S=r.map(b=>Array.isArray(b)?[De(f,b[0]),ge(b)]:De(f,b));r.length?K(f.watchDepth,o,S,p):p(),o.$on("$destroy",()=>{f.onScopeDestroy?o.$eval(f.onScopeDestroy,{unmountComponent:E.unmount.bind(this)}):E.unmount()})}};return T().extend(a,n)},N=T().module("react",[]);N.directive("reactComponent",["$injector",G]),N.factory("reactDirective",["$injector",V]),c.Ay.service("uiSegmentSrv",["$sce","templateSrv",Y]);function Y(t,e){const r=this;class n{constructor(a){if(a==="*"||a.value==="*"){this.value="*",this.html=t.trustAsHtml('<i class="fa fa-asterisk"><i>'),this.type=a.type,this.expandable=!0;return}if((0,g.isString)(a)){this.value=a,this.html=t.trustAsHtml(e.highlightVariablesAsHtml(this.value));return}this.text=a.value,this.cssClass=a.cssClass,this.custom=a.custom,this.type=a.type,this.fake=a.fake,this.value=a.value,this.selectMode=a.selectMode,this.expandable=a.expandable,this.html=a.html||t.trustAsHtml(e.highlightVariablesAsHtml(this.value))}}this.getSegmentForValue=function(i,a){return i?this.newSegment(i):this.newSegment({value:a,fake:!0})},this.newSelectMeasurement=()=>new n({value:"select measurement",fake:!0}),this.newFake=(i,a,o)=>new n({value:i,fake:!0,type:a,cssClass:o}),this.newSegment=i=>new n(i),this.newKey=i=>new n({value:i,type:"key",cssClass:"query-segment-key"}),this.newKeyValue=i=>new n({value:i,type:"value",cssClass:"query-segment-value"}),this.newCondition=i=>new n({value:i,type:"condition",cssClass:"query-keyword"}),this.newOperator=i=>new n({value:i,type:"operator",cssClass:"query-segment-operator"}),this.newOperators=i=>(0,g.map)(i,a=>new n({value:a,type:"operator",cssClass:"query-segment-operator"})),this.transformToSegments=(i,a)=>o=>{const u=(0,g.map)(o,f=>r.newSegment({value:f.text,expandable:f.expandable}));return i&&(0,g.each)(e.getVariables(),f=>{(a===void 0||a===f.type)&&u.unshift(r.newSegment({type:"value",value:"$"+f.name,expandable:!0}))}),u},this.newSelectMetric=()=>new n({value:"select metric",fake:!0}),this.newPlusButton=()=>new n({fake:!0,html:'<i class="fa fa-plus "></i>',type:"plus-button",cssClass:"query-part"})}var X=s(66899),ie=s.n(X);c.Ay.service("popoverSrv",["$compile","$rootScope","$timeout",ne]);function ne(t,e,r){let n=null;this.close=()=>{n&&n.close()},this.show=i=>{n&&(n.close(),n=null);const a=(0,g.extend)(e.$new(!0),i.model);let o;const u=()=>{setTimeout(()=>{a.$destroy(),o.tether&&o.destroy(),i.onClose&&i.onClose()}),n=null};a.dismiss=()=>{o.close()};const f=document.createElement("div");return f.innerHTML=i.template,t(f)(a),r(()=>{o=new(ie())({target:i.element,content:f,position:i.position,classes:i.classNames||"drop-popover",openOn:i.openOn,hoverCloseDelay:200,tetherOptions:{constraints:[{to:"scrollParent",attachment:"together"}]}}),o.on("close",()=>{u()}),n=o,n.open()},100),()=>{o&&o.close()}}}class ye{constructor(e){this.$timeout=e,this.timers=[]}static{this.$inject=["$timeout"]}register(e){return this.timers.push(e),e}cancel(e){this.timers=(0,g.without)(this.timers,e),this.$timeout.cancel(e)}cancelAll(){(0,g.each)(this.timers,e=>{this.$timeout.cancel(e)}),this.timers=[]}}c.Ay.service("timer",ye);class U{constructor(e,r){this.$compile=e,this.$rootScope=r}static{this.$inject=["$compile","$rootScope"]}load(e,r,n){const i=this.$rootScope.$new();(0,g.assign)(i,r);const a=this.$compile(n)(i);return T().element(e).append(a),{destroy:()=>{i.$destroy(),a.remove()},digest:()=>{i.$$phase||i.$digest()},getScope:()=>i}}}c.Ay.service("angularLoader",U);var he=s(34796),D=s.n(he);const Re=D()(window);D().fn.place_tt=(()=>{const t={offset:5};return function(e,r,n){return n=D().extend(!0,{},t,n),this.each(()=>{const i=D()(this);let a,o;i.addClass("grafana-tooltip"),D()("#tooltip").remove(),i.appendTo(document.body),n.compile&&T().element(document).injector().invoke(["$compile","$rootScope",(m,E)=>{const p=E.$new(!0);(0,g.extend)(p,n.scopeData),m(i)(p),p.$digest(),p.$destroy()}]),a=i.outerWidth(!0),o=i.outerHeight(!0);const u=e+n.offset+a>Re.width()?e-n.offset-a:e+n.offset,f=r+n.offset+o>Re.height()?r-n.offset-o:r+n.offset;i.css("left",u>0?u:0),i.css("top",f>0?f:0)})}})();function Fe(t){const e='<input type="text" class="gf-form-input input-medium tight-form-input" spellcheck="false" style="display:none"></input>',r='<a class="gf-form-label tight-form-func dropdown-toggle" tabindex="1" gf-dropdown="menuItems" data-toggle="dropdown" ><i class="fa fa-plus"></i></a>';return{scope:{menuItems:"=dropdownTypeahead",dropdownTypeaheadOnSelect:"&dropdownTypeaheadOnSelect",model:"=ngModel"},link:(n,i,a)=>{const o=D()(e),u=D()(r);o.appendTo(i),u.appendTo(i),a.linkText&&u.html(a.linkText),a.ngModel&&n.$watch("model",E=>{(0,g.each)(n.menuItems,p=>{(0,g.each)(p.submenu,S=>{S.value===E&&u.html(S.text)})})});const f=(0,g.reduce)(n.menuItems,(E,p,S)=>(p.submenu?(0,g.each)(p.submenu,(b,k)=>{b.click="menuItemSelected("+S+","+k+")",E.push(p.text+" "+b.text)}):(p.click="menuItemSelected("+S+")",E.push(p.text)),E),[]),m=()=>{o.hide(),o.val(""),u.show(),u.focus(),i.removeClass("open")};n.menuItemSelected=(E,p)=>{const S=n.menuItems[E],b={$item:S};S.submenu&&p!==void 0&&(b.$subItem=S.submenu[p]),n.dropdownTypeaheadOnSelect(b),m()},o.attr("data-provide","typeahead"),o.typeahead({source:f,minLength:1,items:10,updater:E=>{const p={};return(0,g.each)(n.menuItems,S=>{(0,g.each)(S.submenu,b=>{E===S.text+" "+b.text&&(p.$subItem=b,p.$item=S)})}),p.$item&&n.$apply(()=>{n.dropdownTypeaheadOnSelect(p)}),o.trigger("blur"),""}}),u.click(()=>{u.hide(),o.show(),o.focus()}),o.keyup(()=>{i.toggleClass("open",o.val()==="")}),i.mousedown(E=>{E.preventDefault()}),o.blur(()=>{o.hide(),o.val(""),u.show(),u.focus(),setTimeout(()=>{i.removeClass("open")},200)}),t(i.contents())(n)}}}function xe(t){const e='<input type="text" class="gf-form-input" spellcheck="false" style="display:none"></input>',r='<a class="{{buttonTemplateClass}} dropdown-toggle" tabindex="1" gf-dropdown="menuItems" data-toggle="dropdown" ><i class="fa fa-plus"></i></a>';return{scope:{menuItems:"=dropdownTypeahead2",dropdownTypeaheadOnSelect:"&dropdownTypeaheadOnSelect",model:"=ngModel",buttonTemplateClass:"@"},link:(n,i,a)=>{const o=D()(e);n.buttonTemplateClass||(n.buttonTemplateClass="gf-form-input");const u=D()(r),f={blur:null};o.appendTo(i),u.appendTo(i),a.linkText&&u.html(a.linkText),a.ngModel&&n.$watch("model",p=>{(0,g.each)(n.menuItems,S=>{(0,g.each)(S.submenu,b=>{b.value===p&&u.html(b.text)})})});const m=(0,g.reduce)(n.menuItems,(p,S,b)=>(S.submenu?(0,g.each)(S.submenu,(k,pe)=>{k.click="menuItemSelected("+b+","+pe+")",p.push(S.text+" "+k.text)}):(S.click="menuItemSelected("+b+")",p.push(S.text)),p),[]),E=()=>{o.hide(),o.val(""),u.show(),u.focus(),i.removeClass("open")};n.menuItemSelected=(p,S)=>{const b=n.menuItems[p],k={$item:b};b.submenu&&S!==void 0&&(k.$subItem=b.submenu[S]),n.dropdownTypeaheadOnSelect(k),E()},o.attr("data-provide","typeahead"),o.typeahead({source:m,minLength:1,items:10,updater:p=>{const S={};return(0,g.each)(n.menuItems,b=>{(0,g.each)(b.submenu,k=>{p===b.text+" "+k.text&&(S.$subItem=k,S.$item=b)})}),S.$item&&n.$apply(()=>{n.dropdownTypeaheadOnSelect(S)}),o.trigger("blur"),""}}),u.click(()=>{u.hide(),o.show(),o.focus()}),o.keyup(()=>{i.toggleClass("open",o.val()==="")}),i.mousedown(p=>{p.preventDefault(),f.blur=null}),o.blur(()=>{f.blur=setTimeout(()=>{E()},1)}),t(i.contents())(n)}}}c.Ay.directive("dropdownTypeahead",["$compile",Fe]),c.Ay.directive("dropdownTypeahead2",["$compile",xe]);function qe(t){return{link:(e,r)=>{const n=r[0],i=()=>{const o=new Event("change");return n.dispatchEvent(o)},a=({animationName:o})=>{switch(o){case"onAutoFillStart":return i();case"onAutoFillCancel":return i()}return null};n.addEventListener("animationstart",a),e.$on("$destroy",()=>{n.removeEventListener("animationstart",a)})}}}c.Ay.directive("autofillEventFix",["$compile",qe]);function Ke(t,e,r){const n='<input type="text" data-provide="typeahead"  class="gf-form-input input-medium" spellcheck="false" style="display:none"></input>',i='<a class="gf-form-label" ng-class="segment.cssClass" tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>',a='<a class="gf-form-input gf-form-input--dropdown" ng-class="segment.cssClass" tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>';return{scope:{segment:"=",getOptions:"&",onChange:"&",debounce:"@"},link:(o,u)=>{const f=D()(n),m=o.segment,E=D()(m.selectMode?a:i);let p=null,S=null,b=!0;const k=o.debounce;f.appendTo(u),E.appendTo(u),o.updateVariableValue=w=>{w===""||m.value===w||o.$apply(()=>{const W=(0,g.find)(o.altSegments,{value:w});W?(m.value=W.value,m.html=W.html||e.trustAsHtml(r.highlightVariablesAsHtml(W.value)),m.fake=!1,m.expandable=W.expandable,W.type&&(m.type=W.type)):m.custom!=="false"&&(m.value=w,m.html=e.trustAsHtml(r.highlightVariablesAsHtml(w)),m.expandable=!0,m.fake=!1),o.onChange()})},o.switchToLink=w=>{b&&!w||(clearTimeout(S),S=null,b=!0,f.hide(),E.show(),o.updateVariableValue(f.val()))},o.inputBlur=()=>{S=setTimeout(o.switchToLink,200)},o.source=(w,W)=>{o.$apply(()=>{o.getOptions({$query:w}).then(J=>{o.altSegments=J,p=(0,g.map)(o.altSegments,_=>(0,g.escape)(_.value)),m.custom!=="false"&&!m.fake&&(0,g.indexOf)(p,m.value)===-1&&p.unshift((0,g.escape)(m.value)),W(p)})})},o.updater=w=>(w=(0,g.unescape)(w),w===m.value?(clearTimeout(S),f.focus(),w):(f.val(w),o.switchToLink(!0),w)),o.matcher=function(w){if(b)return!1;let W=this.query;W[0]==="/"&&(W=W.substring(1)),W[W.length-1]==="/"&&(W=W.substring(0,W.length-1));try{return w.toLowerCase().match(W.toLowerCase())}catch{return!1}},f.attr("data-provide","typeahead"),f.typeahead({source:o.source,minLength:0,items:1e4,updater:o.updater,matcher:o.matcher});const pe=f.data("typeahead");pe.lookup=function(){this.query=this.$element.val()||"";const w=this.source(this.query,D().proxy(this.process,this));return w&&this.process(w)},k&&(pe.lookup=(0,g.debounce)(pe.lookup,500,{leading:!0})),E.keydown(w=>{(w.keyCode===40||w.keyCode===13)&&E.click()}),E.click(()=>{p=null,f.css("width",Math.max(E.width(),80)+16+"px"),E.hide(),f.show(),f.focus(),b=!1;const w=f.data("typeahead");w&&(f.val(""),w.lookup())}),f.blur(o.inputBlur),t(u.contents())(o)}}}function Ve(t){return{template:'<metric-segment segment="segment" get-options="getOptionsInternal()" on-change="onSegmentChange()"></metric-segment>',restrict:"E",scope:{property:"=",options:"=",getOptions:"&",onChange:"&"},link:{pre:function(r,n,i){let a;r.valueToSegment=o=>{const u=(0,g.find)(r.options,{value:o}),f={cssClass:i.cssClass,custom:i.custom,value:u?u.text:o,selectMode:i.selectMode};return t.newSegment(f)},r.getOptionsInternal=()=>r.options?(a=r.options,Promise.resolve((0,g.map)(r.options,o=>({value:o.text})))):r.getOptions().then(o=>(a=o,(0,g.map)(o,u=>u.html?u:{value:u.text}))),r.onSegmentChange=()=>{if(a){const o=(0,g.find)(a,{text:r.segment.value});o&&o.value!==r.property?r.property=o.value:i.custom!=="false"&&(r.property=r.segment.value)}else r.property=r.segment.value;r.$$postDigest(()=>{r.$apply(()=>{r.onChange()})})},r.segment=r.valueToSegment(r.property)}}}}c.Ay.directive("metricSegment",["$compile","$sce","templateSrv",Ke]),c.Ay.directive("metricSegmentModel",["uiSegmentSrv",Ve]),c.Ay.directive("tip",["$compile",_e]);function _e(t){return{restrict:"E",link:(e,r,n)=>{let i='<i class="grafana-tip fa fa-'+(n.icon||"question-circle")+`" bs-tooltip="'`+r.text().replace(/[\'\"\\{}<>&]/g,a=>"&amp;#"+a.charCodeAt(0)+";")+`'"></i>`;r.replaceWith(t(T().element(i))(e))}}}c.Ay.directive("compile",["$compile",et]);function et(t){return{restrict:"A",link:(e,r,n)=>{e.$watch(i=>i.$eval(n.compile),i=>{r.html(i),t(r.contents())(e)})}}}c.Ay.directive("watchChange",tt);function tt(){return{scope:{onchange:"&watchChange"},link:(t,e)=>{e.on("input",()=>{t.$apply(()=>{t.onchange({inputValue:e.val()})})})}}}c.Ay.directive("editorOptBool",["$compile",Ht]);function Ht(t){return{restrict:"E",link:(e,r,n)=>{const i=n.change?' ng-change="'+n.change+'"':"",a=n.tip?" <tip>"+n.tip+"</tip>":"",u='<div class="editor-option gf-form-checkbox text-center"'+(n.showIf?' ng-show="'+n.showIf+'" ':"")+'> <label for="'+n.model+'" class="small">'+n.text+a+'</label><input class="cr1" id="'+n.model+'" type="checkbox"        ng-model="'+n.model+'"'+i+'       ng-checked="'+n.model+'"></input> <label for="'+n.model+'" class="cr1"></label>';r.replaceWith(t(T().element(u))(e))}}}c.Ay.directive("editorCheckbox",["$compile, $interpolate",Kt]);function Kt(t,e){return{restrict:"E",link:(r,n,i)=>{const a=e(i.text)(r),o=e(i.model)(r),u=i.change?' ng-change="'+i.change+'"':"",f=i.tip?" <tip>"+i.tip+"</tip>":"",m='<label for="'+r.$id+o+'" class="checkbox-label">'+a+f+"</label>";let E='<input class="cr1" id="'+r.$id+o+'" type="checkbox"        ng-model="'+o+'"'+u+'       ng-checked="'+o+'"></input> <label for="'+r.$id+o+'" class="cr1"></label>';E=E+m,n.addClass("gf-form-checkbox"),n.html(t(T().element(E))(r))}}}c.Ay.directive("gfDropdown",["$parse","$compile","$timeout",Wt]);function Wt(t,e,r){function n(i,a){const u=['<ul class="dropdown-menu '+(a==="top"?"dropup":"")+'" role="menu" aria-labelledby="drop1">',"</ul>"];for(let f=0;f<i.length;f++){const m=i[f];if(m.divider){u.splice(f+1,0,'<li class="divider"></li>');continue}let E="<li"+(m.submenu&&m.submenu.length?' class="dropdown-submenu"':"")+'><a tabindex="-1" ng-href="'+(m.href||"")+'"'+(m.click?' ng-click="'+m.click+'"':"")+(m.target?' target="'+m.target+'"':"")+(m.method?' data-method="'+m.method+'"':"")+">"+(m.text||"")+"</a>";m.submenu&&m.submenu.length&&(E+=n(m.submenu).join(`
`)),E+="</li>",u.splice(f+1,0,E)}return u}return{restrict:"EA",scope:!0,link:function(a,o,u){const f=t(u.gfDropdown),m=f(a);r(()=>{const E=o.data("placement");T().element(n(m,E).join("")).insertAfter(o),e(o.next("ul.dropdown-menu"))(a)}),o.addClass("dropdown-toggle").attr("data-toggle","dropdown")}}}c.Ay.directive("bsTooltip",["$parse","$compile",function(t,e){return{restrict:"A",scope:!0,link:function(n,i,a){let o=t(a.bsTooltip),u=o(n);n.$watch(a.bsTooltip,function(m,E){m!==E&&(u=m)}),i.on("show",function(m){D()(".tooltip.in").each(function(){const E=D()(this),p=E.data("tooltip");p&&!p.$element.is(i)&&E.tooltip("hide")})}),i.tooltip({title:function(){return T().isFunction(u)?u.apply(null,arguments):u},html:!0,container:"body"});const f=i.data("tooltip");f.show=function(){const m=D().fn.tooltip.Constructor.prototype.show.apply(this,arguments);return this.tip().data("tooltip",this),m},n._tooltip=function(m){i.tooltip(m)},n.hide=function(){i.tooltip("hide")},n.show=function(){i.tooltip("show")},n.dismiss=n.hide}}}]),c.Ay.directive("bsTypeahead",["$parse",function(t){return{restrict:"A",require:"?ngModel",link:function(r,n,i,a){let o=t(i.bsTypeahead),u=o(r);r.$watch(i.bsTypeahead,function(m,E){m!==E&&(u=m)}),n.attr("data-provide","typeahead"),n.typeahead({source:function(){return T().isFunction(u)?u.apply(null,arguments):u},minLength:i.minLength||1,items:i.item,updater:function(m){return a&&r.$apply(function(){a.$setViewValue(m)}),r.$emit("typeahead-updated",m),m}});const f=n.data("typeahead");f.lookup=function(){let m;return this.query=this.$element.val()||"",this.query.length<this.options.minLength?this.shown?this.hide():this:(m=(0,g.isFunction)(this.source)?this.source(this.query,D().proxy(this.process,this)):this.source,m?this.process(m):this)},i.matchAll&&(f.matcher=function(){return!0}),i.minLength==="0"&&setTimeout(function(){n.on("focus",function(){n.val().length===0&&setTimeout(n.typeahead.bind(n,"lookup"),200)})})}}}]);var vt=s(65879);function Qt(){return{restrict:"A",priority:1,require:"ngModel",link:(t,e,r,n)=>{r.type==="radio"||r.type==="checkbox"||(e.off("input keydown change"),e.bind("blur",()=>{t.$apply(()=>{n.$setViewValue(e.val())})}))}}}function Yt(){return{restrict:"A",require:"ngModel",link:(t,e,r,n)=>{n.$parsers.push(i=>i===""?null:i)}}}function Xt(){return{require:"ngModel",link:(t,e,r,n)=>{n.$validators.integer=(i,a)=>n.$isEmpty(i)||a.indexOf("$")===0||a.indexOf("+$")===0?!0:vt.describeTextRange(a).invalid!==!0}}}c.Ay.directive("ngModelOnblur",Qt),c.Ay.directive("emptyToNull",Yt),c.Ay.directive("validTimeSpan",Xt);var Jt=s(69613),qi=s(42346);function Et(t,e){const{color:r,borderColor:n}=(0,Jt.MC)(t);e.css("background-color",r),e.css("border-color",n)}function Zt(){return{scope:{tagColorFromName:"="},link:(t,e)=>{Et(t.tagColorFromName,e)}}}function qt(){function t(e,r){if(r)return T().isFunction(e.$parent[r])?e.$parent[r]:n=>n[r]}return{restrict:"EA",scope:{model:"=ngModel",onTagsUpdated:"&"},template:"<select multiple></select>",replace:!1,link:function(e,r,n){T().isArray(e.model)||(e.model=[]);const i=D()("select",r);n.placeholder&&i.attr("placeholder",n.placeholder),i.tagsinput({typeahead:{source:T().isFunction(e.$parent[n.typeaheadSource])?e.$parent[n.typeaheadSource]:null},widthClass:n.widthClass,itemValue:t(e,n.itemvalue),itemText:t(e,n.itemtext),tagClass:T().isFunction(e.$parent[n.tagclass])?e.$parent[n.tagclass]:()=>n.tagclass}),i.on("itemAdded",a=>{e.model.indexOf(a.item)===-1&&(e.model.push(a.item),e.onTagsUpdated&&e.onTagsUpdated());const o=i.next().children("span").filter(()=>D()(this).text()===a.item);Et(a.item,o)}),i.on("itemRemoved",a=>{const o=e.model.indexOf(a.item);o!==-1&&(e.model.splice(o,1),e.onTagsUpdated&&e.onTagsUpdated())}),e.$watch("model",()=>{T().isArray(e.model)||(e.model=[]),i.tagsinput("removeAll");for(let a=0;a<e.model.length;a++)i.tagsinput("add",e.model[a])},!0)}}}c.Ay.directive("tagColorFromName",Zt),c.Ay.directive("bootstrapTagsinput",qt);function _t(t){let e=t[0];const r=t[t.length-1];let n;e=e.nextSibling;for(let i=1;e!==r&&e;i++)(n||t[i]!==e)&&(n||(n=D()([].slice.call(t,0,i))),n.push(e)),e=e.nextSibling;return n||t}c.Ay.directive("rebuildOnChange",["$animate",en]);function en(t){return{multiElement:!0,terminal:!0,transclude:!0,priority:600,restrict:"E",link:(e,r,n,i,a)=>{let o,u,f;function m(){f&&(f.remove(),f=null),u&&(u.$destroy(),u=null),o&&(f=_t(o.clone),t.leave(f).then(()=>{f=null}),o=null)}e.$watch(n.property,function(p,S){u&&p!==S&&m(),!u&&(p||n.showNull)?a((b,k)=>{u=k,b[b.length++]=document.createComment(" end rebuild on change "),o={clone:b},t.enter(b,r.parent(),r)}):m()})}}}c.Ay.directive("giveFocus",()=>(t,e,r)=>{e.click(n=>{n.stopPropagation()}),t.$watch(r.giveFocus,n=>{n&&setTimeout(()=>{e.focus();const i=e[0];if(i.setSelectionRange){const a=e.val().length*2;i.setSelectionRange(a,a)}},200)},!0)});const _i={};class tn{constructor(){const e=()=>{};this.observer=new MutationObserver(e);const r={attributes:!0,attributeFilter:["class"],characterData:!1,childList:!0,subtree:!1};this.observer.observe(T().element(".delta-html")[0],r)}$onDestroy(){this.observer.disconnect()}}function nn(){return{controller:tn,replace:!1,restrict:"A"}}c.Ay.directive("diffDelta",nn);class rn{constructor(e,r,n){this.$scope=e,this.$rootScope=r,this.$anchorScroll=n}static{this.$inject=["$scope","$rootScope","$anchorScroll"]}goToLine(e){let r;const n=()=>{this.$anchorScroll(`l${e}`),r()};this.$scope.switchView().then(()=>{r=this.$rootScope.$on("json-diff-ready",n.bind(this))})}}function an(){return{controller:rn,controllerAs:"ctrl",replace:!0,restrict:"E",scope:{line:"@lineDisplay",link:"@lineLink",switchView:"&"},template:'<a class="diff-linenum btn btn-inverse btn-small" ng-click="ctrl.goToLine(link)">Line {{ line }}</a>'}}c.Ay.directive("diffLinkJson",an);function on(){"use strict";return{restrict:"A",require:"ngModel",link:(t,e,r,n)=>{function i(o){return(o||"").split(",")}function a(o){return(0,g.isArray)(o)?(o||"").join(","):o}n.$parsers.push(i),n.$formatters.push(a)}}}c.Ay.directive("arrayJoin",on);var sn=s(94333),Xe=s(14578),ln=s(62930),cn=s(83598),un=s(70104),dn=s(2056),pn=s(33083),hn=s(64919),fn=s(91409),mn=s(10534),gn=s(32264),vn=s(96378);function Ie(t,e,r){c.Ay.directive(t,["reactDirective",n=>n((0,vn.e)(e,gn.$.theme2),r)])}var En=s(85242),yn=s(75590),lt=s(50877),bn=s(43127),yt=s(71087),Tn=s(96374),Ae=(t=>(t.ANNOTATION="annotation",t.PROMQL="promQL",t.SLO="slo",t.TIME_SERIES_LIST="timeSeriesList",t.TIME_SERIES_QUERY="timeSeriesQuery",t))(Ae||{});const ea={filters:[],groupBys:[],secondaryGroupBys:[]};var je=(t=>(t.Delta="delta",t.None="none",t.Rate="rate",t))(je||{});const ta={filters:[],groupBys:[]};var P=(t=>(t.CUMULATIVE="CUMULATIVE",t.DELTA="DELTA",t.GAUGE="GAUGE",t.METRIC_KIND_UNSPECIFIED="METRIC_KIND_UNSPECIFIED",t))(P||{}),y=(t=>(t.BOOL="BOOL",t.DISTRIBUTION="DISTRIBUTION",t.DOUBLE="DOUBLE",t.INT64="INT64",t.MONEY="MONEY",t.STRING="STRING",t.VALUE_TYPE_UNSPECIFIED="VALUE_TYPE_UNSPECIFIED",t))(y||{}),Je=(t=>(t.ALIGN_COUNT="ALIGN_COUNT",t.ALIGN_COUNT_FALSE="ALIGN_COUNT_FALSE",t.ALIGN_COUNT_TRUE="ALIGN_COUNT_TRUE",t.ALIGN_DELTA="ALIGN_DELTA",t.ALIGN_FRACTION_TRUE="ALIGN_FRACTION_TRUE",t.ALIGN_INTERPOLATE="ALIGN_INTERPOLATE",t.ALIGN_MAX="ALIGN_MAX",t.ALIGN_MEAN="ALIGN_MEAN",t.ALIGN_MIN="ALIGN_MIN",t.ALIGN_NEXT_OLDER="ALIGN_NEXT_OLDER",t.ALIGN_NONE="ALIGN_NONE",t.ALIGN_PERCENTILE_05="ALIGN_PERCENTILE_05",t.ALIGN_PERCENTILE_50="ALIGN_PERCENTILE_50",t.ALIGN_PERCENTILE_95="ALIGN_PERCENTILE_95",t.ALIGN_PERCENTILE_99="ALIGN_PERCENTILE_99",t.ALIGN_PERCENT_CHANGE="ALIGN_PERCENT_CHANGE",t.ALIGN_RATE="ALIGN_RATE",t.ALIGN_STDDEV="ALIGN_STDDEV",t.ALIGN_SUM="ALIGN_SUM",t))(Je||{});const na={filters:[]};var Cn=(t=>(t.Aggregations="aggregations",t.Aligners="aligners",t.AlignmentPeriods="alignmentPeriods",t.DefaultProject="defaultProject",t.LabelKeys="labelKeys",t.LabelValues="labelValues",t.MetricTypes="metricTypes",t.Projects="projects",t.ResourceTypes="resourceTypes",t.SLO="slo",t.SLOServices="sloServices",t.Selectors="selectors",t.Services="services",t))(Cn||{}),An=s(46819),Ne=s(81580),bt=s(10354);const ct=({refId:t,value:e="",onChange:r})=>{const[n,i]=(0,l.useState)(e??""),a=(0,g.debounce)(r,1e3),o=u=>{i(u.currentTarget.value),a(u.currentTarget.value)};return l.createElement(Ne.c,{label:"Alias by"},l.createElement(bt.p,{id:`${t}-alias-by`,value:n,onChange:o}))};var We=s(9e4),Tt=s(66864),Sn=s(15292);const ra=71,ia=19,aa=14,oa=28,Ct=[{text:"none",value:"ALIGN_NONE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.STRING,y.VALUE_TYPE_UNSPECIFIED,y.BOOL],metricKinds:[P.GAUGE]},{text:"delta",value:"ALIGN_DELTA",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.CUMULATIVE,P.DELTA]},{text:"rate",value:"ALIGN_RATE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.CUMULATIVE,P.DELTA]},{text:"interpolate",value:"ALIGN_INTERPOLATE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE]},{text:"next older",value:"ALIGN_NEXT_OLDER",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.STRING,y.VALUE_TYPE_UNSPECIFIED,y.BOOL],metricKinds:[P.GAUGE]},{text:"min",value:"ALIGN_MIN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA]},{text:"max",value:"ALIGN_MAX",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA]},{text:"mean",value:"ALIGN_MEAN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA]},{text:"count",value:"ALIGN_COUNT",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.BOOL],metricKinds:[P.GAUGE,P.DELTA]},{text:"sum",value:"ALIGN_SUM",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA]},{text:"stddev",value:"ALIGN_STDDEV",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA]},{text:"count true",value:"ALIGN_COUNT_TRUE",valueTypes:[y.BOOL],metricKinds:[P.GAUGE]},{text:"count false",value:"ALIGN_COUNT_FALSE",valueTypes:[y.BOOL],metricKinds:[P.GAUGE]},{text:"fraction true",value:"ALIGN_FRACTION_TRUE",valueTypes:[y.BOOL],metricKinds:[P.GAUGE]},{text:"percentile 99",value:"ALIGN_PERCENTILE_99",valueTypes:[y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA]},{text:"percentile 95",value:"ALIGN_PERCENTILE_95",valueTypes:[y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA]},{text:"percentile 50",value:"ALIGN_PERCENTILE_50",valueTypes:[y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA]},{text:"percentile 05",value:"ALIGN_PERCENTILE_05",valueTypes:[y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA]},{text:"percent change",value:"ALIGN_PERCENT_CHANGE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA]}],xn=[{text:"none",value:"REDUCE_NONE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.BOOL,y.STRING],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE,P.METRIC_KIND_UNSPECIFIED]},{text:"mean",value:"REDUCE_MEAN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE]},{text:"min",value:"REDUCE_MIN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE,P.METRIC_KIND_UNSPECIFIED]},{text:"max",value:"REDUCE_MAX",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE,P.METRIC_KIND_UNSPECIFIED]},{text:"sum",value:"REDUCE_SUM",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE,P.METRIC_KIND_UNSPECIFIED]},{text:"std. dev.",value:"REDUCE_STDDEV",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE,P.METRIC_KIND_UNSPECIFIED]},{text:"count",value:"REDUCE_COUNT",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.BOOL,y.STRING],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE]},{text:"count true",value:"REDUCE_COUNT_TRUE",valueTypes:[y.BOOL],metricKinds:[P.GAUGE,P.DELTA]},{text:"count false",value:"REDUCE_COUNT_FALSE",valueTypes:[y.BOOL],metricKinds:[P.GAUGE,P.DELTA]},{text:"99th percentile",value:"REDUCE_PERCENTILE_99",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE]},{text:"95th percentile",value:"REDUCE_PERCENTILE_95",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE]},{text:"50th percentile",value:"REDUCE_PERCENTILE_50",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE]},{text:"5th percentile",value:"REDUCE_PERCENTILE_05",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[P.GAUGE,P.DELTA,P.CUMULATIVE]}],At=[{text:"grafana auto",value:"grafana-auto"},{text:"stackdriver auto",value:"stackdriver-auto",hidden:!0},{text:"cloud monitoring auto",value:"cloud-monitoring-auto"},{text:"1m",value:"+60s"},{text:"2m",value:"+120s"},{text:"5m",value:"+300s"},{text:"10m",value:"+600s"},{text:"30m",value:"+1800s"},{text:"1h",value:"+3600s"},{text:"3h",value:"+7200s"},{text:"6h",value:"+21600s"},{text:"1d",value:"+86400s"},{text:"3d",value:"+259200s"},{text:"1w",value:"+604800s"}],In=[{text:"auto",value:"auto"},{text:"1m",value:"1m"},{text:"2m",value:"2m"},{text:"5m",value:"5m"},{text:"10m",value:"10m"},{text:"30m",value:"30m"},{text:"1h",value:"1h"},{text:"3h",value:"3h"},{text:"6h",value:"6h"},{text:"1d",value:"1d"},{text:"3d",value:"3d"},{text:"1w",value:"1w"}],Ln=[{text:"1m",value:"1m"},{text:"2m",value:"2m"},{text:"5m",value:"5m"},{text:"10m",value:"10m"},{text:"30m",value:"30m"},{text:"1h",value:"1h"},{text:"3h",value:"3h"},{text:"6h",value:"6h"},{text:"24h",value:"24h"},{text:"72h",value:"72h"}],Nn=["metadata.system_labels.cloud_account","metadata.system_labels.name","metadata.system_labels.region","metadata.system_labels.state","metadata.system_labels.instance_group","metadata.system_labels.node_name","metadata.system_labels.service_name","metadata.system_labels.top_level_controller_type","metadata.system_labels.top_level_controller_name","metadata.system_labels.container_image"],St="select_slo_burn_rate",xt=[{label:"SLI Value",value:"select_slo_health"},{label:"SLO Compliance",value:"select_slo_compliance"},{label:"SLO Error Budget Remaining",value:"select_slo_budget_fraction"},{label:"SLO Burn Rate",value:St}],wn=[{label:"Builder",value:Ae.TIME_SERIES_LIST},{label:"MQL",value:Ae.TIME_SERIES_QUERY},{label:"Service Level Objectives (SLO)",value:Ae.SLO},{label:"PromQL",value:Ae.PROMQL}];var Oe=s(88323);function nt({refId:t,projectName:e,datasource:r,onChange:n,templateVariableOptions:i}){const[a,o]=(0,l.useState)([]);(0,l.useEffect)(()=>{r.getProjects().then(f=>o(f))},[r]);const u=(0,l.useMemo)(()=>[{label:"Template Variables",options:i},...a],[a,i]);return l.createElement(Ne.c,{label:"Project"},l.createElement(Oe.l6,{width:"auto",allowCustomValue:!0,formatCreateLabel:f=>`Use project: ${f}`,onChange:({value:f})=>n(f),options:u,value:{value:e,label:e},placeholder:"Select Project",inputId:`${t}-project`}))}var rt=s(97801),It=s(72574);const sa=t=>uniqBy(t,"service"),Dn=(t,e)=>t.filter(r=>r.service===e),la=(t,e,r,n)=>{const i=Dn(t,n).map(f=>({value:f.type,name:f.displayName})),a=i.some(f=>f.value===r),o=i.length?i[0].value:"";return{metricTypes:i,selectedMetricType:a?e:o}},On=(t,e,r)=>(r&&r===je.Rate&&(e=P.GAUGE),t?Ct.filter(n=>n.valueTypes.indexOf(t)!==-1&&n.metricKinds.indexOf(e)!==-1):[]),Mn=(t,e)=>e?xn.filter(r=>r.valueTypes.indexOf(t)!==-1&&r.metricKinds.indexOf(e)!==-1):[],ca=async(t,e,r)=>{const i=await t.getLabels(e,"handleLabelKeysQuery",r);return[...Object.keys(i),...SYSTEM_LABELS]},ut=(t=y.DOUBLE,e=P.GAUGE,r=Je.ALIGN_MEAN,n)=>{const i=(0,It.w)(),a=On(t,e,n).map(o=>({...o,label:o.text}));return a.some(o=>o.value===i.replace(r))||(r=a.length>0?a[0].value:Je.ALIGN_MEAN),{alignOptions:a,perSeriesAligner:r}},Lt=t=>{const e=t.reduce((r,n)=>{const i=n.split(".").map(g.startCase),a=(i.length===2?i:(0,g.initial)(i)).join(" "),o={value:n,label:n};return r[a]?r[a]=[...r[a],o]:r[a]=[o],r},{});return Object.entries(e).map(([r,n])=>({label:r,options:n,expanded:!0}),[])},Pn=t=>(0,g.chunk)(t,4).map(([e,r,n,i="AND"])=>({key:e,operator:r,value:n,condition:i})),Nt=(t,e)=>{const{perSeriesAligner:r,alignmentPeriod:n}=t;if(!n||!r)return"";const i=Ct.find(u=>u.value===e.templateSrv.replace(r)),a=parseInt(n,10);return`${vt.secondsToHms(a)} interval (${i?.text??""})`},Rn=t=>{const e=t?.filters?.findIndex(n=>n==="metric.type");return t?.filters?.[e+2]||""},Un=(t,e)=>{if(!t.filters)return t.filters=["metric.type","=",e],t;const r=t?.filters?.findIndex(n=>n==="metric.type");return r===-1?t.filters.push("metric.type","=",e):t.filters[r+2]=e,t},$n=t=>{const e=kn(t),r=Bn(e,t);return l.createElement(Ne.c,{label:"Group by function","data-testid":"cloud-monitoring-aggregation"},l.createElement(Oe.l6,{width:"auto",onChange:({value:n})=>t.onChange(n),value:r,options:[{label:"Template Variables",options:t.templateVariableOptions},{label:"Aggregations",expanded:!0,options:e}],placeholder:"Select Reducer",inputId:`${t.refId}-group-by-function`,menuPlacement:"top"}))},kn=({metricDescriptor:t})=>{const e=t?.valueType,r=t?.metricKind;return(0,l.useMemo)(()=>!e||!r?[]:Mn(e,r).map(n=>({...n,label:n.text})),[e,r])},Bn=(t,e)=>(0,l.useMemo)(()=>[...t,...e.templateVariableOptions].find(n=>n.value===e.crossSeriesReducer),[t,e.crossSeriesReducer,e.templateVariableOptions]),Gn=({refId:t,labels:e=[],query:r,onChange:n,variableOptionGroup:i,metricDescriptor:a})=>{const o=(0,l.useMemo)(()=>[i,...Lt([...e,...Nn])],[e,i]);return l.createElement(rt.B,null,l.createElement(Ne.c,{label:"Group by",tooltip:"You can reduce the amount of data returned for a metric by combining different time series. To combine multiple time series, you can specify a grouping and a function. Grouping is done on the basis of labels. The grouping function is used to combine the time series in the group into a single time series."},l.createElement(Oe.KF,{inputId:`${t}-group-by`,width:"auto",placeholder:"Choose label",options:o,value:r.groupBys??[],onChange:u=>{n({...r,groupBys:u.map(f=>f.value)})},menuPlacement:"top"})),l.createElement($n,{metricDescriptor:a,templateVariableOptions:i.options,crossSeriesReducer:r.crossSeriesReducer,groupBys:r.groupBys??[],onChange:u=>n({...r,crossSeriesReducer:u}),refId:t}))},Fn=({inputId:t,query:e,templateVariableOptions:r,onChange:n,metricDescriptor:i,preprocessor:a})=>{const{perSeriesAligner:o}=e;let{valueType:u,metricKind:f}=i||{};const{perSeriesAligner:m,alignOptions:E}=(0,l.useMemo)(()=>ut(u,f,o,a),[u,f,o,a]);return l.createElement(Oe.l6,{onChange:({value:p})=>n({...e,perSeriesAligner:p}),value:[...E,...r].find(p=>p.value===m),options:[{label:"Template Variables",options:r},{label:"Alignment options",expanded:!0,options:E}],placeholder:"Select Alignment",inputId:t,menuPlacement:"top"})};function dt({inputId:t,templateVariableOptions:e,onChange:r,current:n,disabled:i,aligmentPeriods:a}){const o=(0,l.useMemo)(()=>a.map(f=>({...f,label:f.text})),[a]),u=(0,l.useMemo)(()=>o.filter(f=>!f.hidden),[o]);return l.createElement(Oe.l6,{width:"auto",onChange:({value:f})=>r(f),value:[...o,...e].find(f=>f.value===n),options:[{label:"Template Variables",options:e},{label:"Aggregations",expanded:!0,options:u}],placeholder:"Select Period",inputId:t,disabled:i,allowCustomValue:!0,menuPlacement:"top"})}const Vn=({refId:t,templateVariableOptions:e,onChange:r,query:n,customMetaData:i,datasource:a,metricDescriptor:o,preprocessor:u})=>{const f=(0,l.useMemo)(()=>Nt(i,a),[i,a]);return l.createElement(rt.B,null,l.createElement(Ne.c,{label:"Alignment function",tooltip:"The process of alignment consists of collecting all data points received in a fixed length of time, applying a function to combine those data points, and assigning a timestamp to the result."},l.createElement(Fn,{inputId:`${t}-alignment-function`,templateVariableOptions:e,query:n,onChange:m=>r({...n,...m}),metricDescriptor:o,preprocessor:u})),l.createElement(Ne.c,{label:"Alignment period",tooltip:f},l.createElement(dt,{inputId:`${t}-alignment-period`,templateVariableOptions:e,current:n.alignmentPeriod,onChange:m=>r({...n,alignmentPeriod:m}),aligmentPeriods:At})))};var jn=s(3721),zn=s(7650);const pt="=",wt="AND",Hn=t=>t.flatMap(({key:e,operator:r,value:n,condition:i})=>[e,r,n,i]).slice(0,-1),Kn=["=","!=","=~","!=~"].map(lt.z),Dt=["metric.type"],Wn=({labels:t={},filters:e,onChange:r,variableOptionGroup:n})=>{const i=Pn(e),a=i.filter(({key:p})=>!Dt.includes(p)),o=i.filter(({key:p})=>Dt.includes(p)),u=(0,l.useMemo)(()=>[n,...Lt(Object.keys(t))],[t,n]),f=({key:p="",value:S=""})=>{u.some(w=>w.options?u.some(W=>W.label===p):w.label===p)||u.push({label:p,value:p});const k=t.hasOwnProperty(p)?[n,...t[p].map(lt.z)]:[n];return k.some(w=>w.label===S)||k.push({label:S,value:S}),{options:u,valueOptions:k}},m=p=>{const S=p.concat(o).map(({key:b,operator:k,value:pe,condition:w})=>({key:b||"",operator:k||pt,value:pe||"",condition:w||wt}));r(Hn(S))},E=(p,S,b)=>{const{key:k="",operator:pe=pt,value:w="",condition:W=wt}=p,{options:J,valueOptions:_}=f(p);return l.createElement(Tt.Gy,{spacing:"xs",width:"auto"},l.createElement(Oe.l6,{"aria-label":"Filter label key",formatCreateLabel:ue=>`Use label key: ${ue}`,allowCustomValue:!0,value:k,options:J,onChange:({value:ue=""})=>S({key:ue,operator:pe,value:w,condition:W})}),l.createElement(Oe.l6,{value:pe,options:Kn,onChange:({value:ue=pt})=>S({key:k,operator:ue,value:w,condition:W})}),l.createElement(Oe.l6,{"aria-label":"Filter label value",placeholder:"add filter value",formatCreateLabel:ue=>`Use label value: ${ue}`,allowCustomValue:!0,value:w,options:_,onChange:({value:ue=""})=>S({key:k,operator:pe,value:ue,condition:W})}),l.createElement(jn.Z,{"aria-label":"Remove",icon:"times",variant:"secondary",onClick:b,type:"button"}))};return l.createElement(We.U,null,l.createElement(Ne.c,{label:"Filter",tooltip:"To reduce the amount of data charted, apply a filter. A filter has three components: a label, a comparison, and a value. The comparison can be an equality, inequality, or regular expression."},l.createElement(zn.o,{items:a,renderItem:E,onChange:m})))},ua=()=>React.createElement("div",{className:"grafana-info-box alert-info"},React.createElement("div",null,React.createElement("h5",null,"Annotation Query Format"),React.createElement("p",null,"An annotation is an event that is overlaid on top of graphs. Annotation rendering is expensive so it is important to limit the number of rows returned."," "),React.createElement("p",null,"The Title and Text fields support templating and can use data returned from the query. For example, the Title field could have the following text:"),React.createElement("code",null,"{{metric.type}}"," has value: ","{{metric.value}}"),React.createElement("p",null,"Example Result: ",React.createElement("code",null,"monitoring.googleapis.com/uptime_check/http_status has this value: 502")),React.createElement("span",null,"Patterns:"),React.createElement("p",null,React.createElement("code",null,"{{metric.value}}")," = value of the metric/point"),React.createElement("p",null,React.createElement("code",null,"{{metric.type}}")," = metric type e.g. compute.googleapis.com/instance/cpu/usage_time"),React.createElement("p",null,React.createElement("code",null,"{{metric.name}}")," = name part of metric e.g. instance/cpu/usage_time"),React.createElement("p",null,React.createElement("code",null,"{{metric.service}}")," = service part of metric e.g. compute"),React.createElement("p",null,React.createElement("code",null,"{{metric.label.label_name}}")," = Metric label metadata e.g. metric.label.instance_name"),React.createElement("p",null,React.createElement("code",null,"{{resource.label.label_name}}")," = Resource label metadata e.g. resource.label.zone"))),Qn=({refId:t,current:e,templateVariableOptions:r,onChange:n})=>{const i=Ln.map(o=>({...o,label:o.text}));e&&!i.find(o=>o.value===e)&&i.push({label:e,text:e,value:e,hidden:!1});const a=i.filter(o=>!o.hidden);return l.createElement(Ne.c,{label:"Lookback period",htmlFor:`${t}-lookback-period`},l.createElement(Oe.l6,{inputId:`${t}-lookback-period`,width:"auto",allowCustomValue:!0,value:[...i,...r].find(o=>o.value===e),options:[{label:"Template Variables",options:r},{label:"Predefined periods",expanded:!0,options:a}],onChange:({value:o})=>n(o)}))},Yn=({refId:t,query:e,templateVariableOptions:r,onChange:n,datasource:i})=>{const[a,o]=(0,l.useState)([]),{projectName:u,serviceId:f}=e;return(0,l.useEffect)(()=>{!u||!f||i.getServiceLevelObjectives(u,f).then(m=>{o([{label:"Template Variables",options:r},...m])})},[i,u,f,r]),l.createElement(Ne.c,{label:"SLO"},l.createElement(Oe.l6,{inputId:`${t}-slo`,width:"auto",allowCustomValue:!0,value:e?.sloId&&{value:e?.sloId,label:e?.sloName||e?.sloId},placeholder:"Select SLO",options:a,onChange:async({value:m="",label:E=""})=>{const S=(await i.getServiceLevelObjectives(u,f)).find(({value:b})=>b===i.templateSrv.replace(m));n({...e,sloId:m,sloName:E,goal:S?.goal})}}))},Xn=({refId:t,query:e,templateVariableOptions:r,onChange:n,datasource:i})=>l.createElement(Ne.c,{label:"Selector",htmlFor:`${t}-slo-selector`},l.createElement(Oe.l6,{inputId:`${t}-slo-selector`,width:"auto",allowCustomValue:!0,value:[...xt,...r].find(a=>a.value===e?.selectorName),options:[{label:"Template Variables",options:r},...xt],onChange:({value:a})=>n({...e,selectorName:a??""})})),Jn=({refId:t,query:e,templateVariableOptions:r,onChange:n,datasource:i})=>{const[a,o]=(0,l.useState)([]),{projectName:u}=e;return(0,l.useEffect)(()=>{u&&i.getSLOServices(u).then(f=>{o([{label:"Template Variables",options:r},...f])})},[i,u,r]),l.createElement(Ne.c,{label:"Service"},l.createElement(Oe.l6,{inputId:`${t}-slo-service`,width:"auto",allowCustomValue:!0,value:e?.serviceId&&{value:e?.serviceId,label:e?.serviceName||e?.serviceId},placeholder:"Select service",options:a,onChange:({value:f="",label:m=""})=>n({...e,serviceId:f,serviceName:m,sloId:""})}))},Zn=t=>({projectName:t.getDefaultProject(),alignmentPeriod:"cloud-monitoring-auto",perSeriesAligner:Je.ALIGN_MEAN,aliasBy:"",selectorName:"select_slo_health",serviceId:"",serviceName:"",sloId:"",sloName:"",lookbackPeriod:""});function qn({refId:t,query:e,datasource:r,onChange:n,variableOptionGroup:i,customMetaData:a,aliasBy:o,onChangeAliasBy:u}){const f=(0,l.useMemo)(()=>Nt(a,r),[a,r]);return l.createElement(l.Fragment,null,l.createElement(We.U,null,l.createElement(nt,{refId:t,templateVariableOptions:i.options,projectName:e.projectName,datasource:r,onChange:m=>n({...e,projectName:m})}),l.createElement(Jn,{refId:t,datasource:r,templateVariableOptions:i.options,query:e,onChange:n}),l.createElement(Yn,{refId:t,datasource:r,templateVariableOptions:i.options,query:e,onChange:n}),l.createElement(Xn,{refId:t,datasource:r,templateVariableOptions:i.options,query:e,onChange:n}),e.selectorName===St&&l.createElement(Qn,{refId:t,onChange:m=>n({...e,lookbackPeriod:m}),current:e.lookbackPeriod,templateVariableOptions:i.options}),l.createElement(rt.B,null,l.createElement(Ne.c,{label:"Alignment period",tooltip:f},l.createElement(dt,{inputId:`${t}-alignment-period`,templateVariableOptions:i.options,current:e.alignmentPeriod,onChange:m=>n({...e,alignmentPeriod:m}),aligmentPeriods:At}))),l.createElement(ct,{refId:t,value:o,onChange:u})))}var Ot=s(21744);function _n({query:t,onChange:e,onRunQuery:r}){const n=i=>{i.key==="Enter"&&(i.shiftKey||i.ctrlKey)&&(i.preventDefault(),r())};return l.createElement(l.Fragment,null,l.createElement(Ot.f,{name:"Query",className:"slate-query-field",value:t,rows:10,placeholder:"Enter a Cloud Monitoring MQL query (Run with Shift+Enter)",onBlur:r,onChange:i=>e(i.currentTarget.value),onKeyDown:n}))}const da=({label:t,onChange:e,value:r,options:n,allowCustomValue:i=!1})=>React.createElement(Field,{label:t},React.createElement(Select,{width:25,allowCustomValue:i,value:r,onChange:({value:a})=>e(a),options:n}));var Be=s(32196),er=s(76459),tr=s.n(er),nr=s(14110),it=s(40845),rr=s(88824),ir=s(94354);const Mt={label:"None",value:je.None},ar=({query:t,metricDescriptor:e,onChange:r})=>{const n=or(e);return l.createElement(Ne.c,{label:"Pre-processing",tooltip:"Preprocessing options are displayed when the selected metric has a metric kind of delta or cumulative. The specific options available are determined by the metric's value type. If you select 'Rate', data points are aligned and converted to a rate per time series. If you select 'Delta', data points are aligned by their delta (difference) per time series"},l.createElement(ir.z,{onChange:i=>{const{perSeriesAligner:a}=t,{valueType:o,metricKind:u}=e??{},{perSeriesAligner:f}=ut(o,u,a,i);r({...t,preprocessor:i,perSeriesAligner:f})},value:t.preprocessor??je.None,options:n}))},or=t=>{const e=t?.metricKind,r=t?.valueType;return(0,l.useMemo)(()=>{if(!e||e===P.GAUGE||r===y.DISTRIBUTION)return[Mt];const n=[Mt,{label:"Rate",value:je.Rate,description:"Data points are aligned and converted to a rate per time series"}];return e===P.CUMULATIVE?[...n,{label:"Delta",value:je.Delta,description:"Data points are aligned by their delta (difference) per time series"}]:n},[e,r])};function sr({refId:t,onChange:e,datasource:r,query:n,variableOptionGroup:i,customMetaData:a,aliasBy:o,onChangeAliasBy:u,range:f}){const[m,E]=(0,l.useState)({}),[p,S]=(0,l.useState)([]),[b,k]=(0,l.useState)(),[pe,w]=(0,l.useState)([]),[W,J]=(0,l.useState)([]),[_,ue]=(0,l.useState)(""),[ve,Le]=(0,l.useState)({...f});(Ee=>{ve!==null&&(ve.raw.from.toString()!==Ee.raw.from.toString()||ve.raw.to.toString()!==Ee.raw.to.toString())&&Le({...Ee})})(f);const Ge=(0,it.$j)(),fe=(0,rr.J)(Ge),$e=(0,it.of)(lr),{projectName:ke,groupBys:Vt,crossSeriesReducer:jt}=n,ze=Rn(n),{templateSrv:at}=r,ot=(0,l.useCallback)((Ee,Ce)=>Ee.find(be=>be.type===at.replace(Ce)),[at]);(0,l.useEffect)(()=>{ke&&ze&&r.getLabels(ze,t,ke,{groupBys:Vt,crossSeriesReducer:jt},ve).then(Ee=>E(Ee))},[r,Vt,ze,ke,t,jt,ve]),(0,l.useEffect)(()=>{(async()=>{if(ke){const Ce=await r.getMetricTypes(ke);(0,nr.rR)("cloud-monitoring-metric-descriptors-loaded",{count:Ce.length});const be=Xi(Ce);S(Ce),J(be)}})()},[r,ke,$e,fe.optionDescription]),(0,l.useEffect)(()=>{const Ce=(Ye=>{const st=ot(Ye,ze);return st?Ye.filter(He=>He.service===st.service).map(He=>({service:He.service,value:He.type,label:He.displayName,component:function(){return l.createElement("div",null,l.createElement("div",{className:$e},He.type),l.createElement("div",{className:fe.optionDescription},He.description))}})):[]})(p),be=Ce.length>0?Ce[0].service:"",Pe=ot(p,ze);k(Pe),w(Ce),ue(be)},[p,ot,ze,$e,fe.optionDescription]);const Yi=({value:Ee})=>{const Ce=p.filter(be=>be.service===at.replace(Ee)).map(be=>({service:be.service,value:be.type,label:be.displayName,description:be.description}));n.filters=[],Ce.length>0&&!Ce.some(be=>be.value===at.replace(ze))?(zt(Ce[0]),ue(Ee),w(Ce)):(ue(Ee),w(Ce))},Xi=Ee=>{const Ce=Ee.map(be=>({value:be.service,label:(0,g.startCase)(be.serviceShortName)}));return Ce.length>0?(0,g.uniqBy)(Ce,be=>be.value):[]},Ji=async Ee=>{const be=(await r.filterMetricsByType(ke,_)).filter(Pe=>Pe.type.includes(Ee.toLowerCase())).map(Pe=>({value:Pe.type,label:Pe.displayName,component:function(){return l.createElement("div",null,l.createElement("div",{className:$e},Pe.type),l.createElement("div",{className:fe.optionDescription},Pe.description))}}));return[{label:"Template Variables",options:i.options},...be]},Zi=tr()(Ji,400),zt=({value:Ee})=>{const Ce=ot(p,Ee);k(Ce);const{metricKind:be,valueType:Pe}=Ce,Ye=be===P.GAUGE||Pe===y.DISTRIBUTION?je.None:je.Rate,{perSeriesAligner:st}=ut(Pe,be,n.perSeriesAligner,Ye);Object.assign(n,{...ht(r),projectName:n.projectName,filters:n.filters}),e({...Un({...n,perSeriesAligner:st},Ee),preprocessor:Ye})};return l.createElement(l.Fragment,null,l.createElement(We.U,null,l.createElement(rt.B,null,l.createElement(nt,{refId:t,templateVariableOptions:i.options,projectName:ke,datasource:r,onChange:Ee=>{e({...n,projectName:Ee})}}),l.createElement(Ne.c,{label:"Service",width:"auto"},l.createElement(Oe.l6,{width:"auto",onChange:Yi,isLoading:W.length===0,value:[...W,...i.options].find(Ee=>Ee.value===_),options:[{label:"Template Variables",options:i.options},...W],placeholder:"Select Services",inputId:`${t}-service`})),l.createElement(Ne.c,{label:"Metric name",width:"auto",htmlFor:`${t}-select-metric`},l.createElement("span",{title:_===""?"Select a service first":"Type to search metrics"},l.createElement(Oe.DW,{width:"auto",onChange:zt,value:[...pe,...i.options].find(Ee=>Ee.value===ze),loadOptions:Zi,defaultOptions:[{label:"Template Variables",options:i.options},...pe.slice(0,100)],placeholder:"Select Metric",inputId:`${t}-select-metric`,disabled:_===""}))))),l.createElement(l.Fragment,null,l.createElement(Wn,{labels:m,filters:n.filters,onChange:Ee=>e({...n,filters:Ee}),variableOptionGroup:i}),l.createElement(We.U,null,l.createElement(ar,{metricDescriptor:b,query:n,onChange:e}),l.createElement(Gn,{refId:t,labels:Object.keys(m),query:n,onChange:e,variableOptionGroup:i,metricDescriptor:b}),l.createElement(Vn,{refId:t,datasource:r,templateVariableOptions:i.options,query:n,customMetaData:a,onChange:e,metricDescriptor:b,preprocessor:n.preprocessor}),l.createElement(ct,{refId:t,value:o,onChange:u}))))}const lr=t=>(0,Be.css)`
  label: grafana-select-option-description;
  font-weight: normal;
  font-style: italic;
  color: ${t.colors.text.secondary};
`,cr=l.memo(sr),ur=({refId:t,onChange:e,graphPeriod:r,variableOptionGroup:n})=>l.createElement(We.U,null,l.createElement(Ne.c,{label:"Graph period",htmlFor:`${t}-graph-period`,tooltip:l.createElement(l.Fragment,null,"Set ",l.createElement("code",null,"graph_period")," which forces a preferred period between points. Automatically set to the current interval if left blank.")},l.createElement(Tt.Gy,null,l.createElement(Sn.d,{"data-testid":`${t}-switch-graph-period`,value:r!=="disabled",onChange:i=>e(i.currentTarget.checked?"":"disabled")}),l.createElement(dt,{inputId:`${t}-graph-period`,templateVariableOptions:n.options,current:r,onChange:e,disabled:r==="disabled",aligmentPeriods:In})))),ht=t=>({projectName:t.getDefaultProject(),crossSeriesReducer:"REDUCE_NONE",alignmentPeriod:"cloud-monitoring-auto",perSeriesAligner:Je.ALIGN_MEAN,groupBys:[],filters:[]}),Pt=t=>({projectName:t.getDefaultProject(),query:""});function dr({refId:t,query:e,datasource:r,onChange:n,onRunQuery:i,customMetaData:a,variableOptionGroup:o,range:u}){const f=(0,l.useCallback)(E=>{let p=!0;if(E?.filters&&E.filters.length>0){for(const S of E.filters)if(S===""){p=!1;break}}n({...e,timeSeriesList:E}),p&&i()},[n,i,e]),m=(0,l.useCallback)(E=>{n({...e,timeSeriesQuery:E}),i()},[n,i,e]);return(0,l.useEffect)(()=>{e.queryType===Ae.TIME_SERIES_LIST&&!e.timeSeriesList&&n({refId:e.refId,datasource:e.datasource,queryType:Ae.TIME_SERIES_LIST,timeSeriesList:ht(r),aliasBy:e.aliasBy}),e.queryType===Ae.TIME_SERIES_QUERY&&!e.timeSeriesQuery&&n({refId:e.refId,datasource:e.datasource,queryType:Ae.TIME_SERIES_QUERY,timeSeriesQuery:Pt(r),aliasBy:e.aliasBy})},[n,e,r]),l.createElement(yt.D,null,(e.queryType===Ae.ANNOTATION||e.queryType===Ae.TIME_SERIES_LIST)&&e.timeSeriesList&&l.createElement(cr,{refId:t,variableOptionGroup:o,customMetaData:a,onChange:f,datasource:r,query:e.timeSeriesList,aliasBy:e.aliasBy,onChangeAliasBy:E=>n({...e,aliasBy:E}),range:u}),e.queryType===Ae.TIME_SERIES_QUERY&&e.timeSeriesQuery&&l.createElement(l.Fragment,null,l.createElement(An.B,{gap:1,direction:"row"},l.createElement(nt,{refId:t,datasource:r,onChange:E=>m({...e.timeSeriesQuery,projectName:E}),templateVariableOptions:o.options,projectName:e.timeSeriesQuery.projectName}),l.createElement(ct,{refId:t,value:e.aliasBy,onChange:E=>n({...e,aliasBy:E})})),l.createElement(_n,{onChange:E=>m({...e.timeSeriesQuery,query:E}),onRunQuery:i,query:e.timeSeriesQuery.query}),l.createElement(ur,{onChange:E=>m({...e.timeSeriesQuery,graphPeriod:E}),graphPeriod:e.timeSeriesQuery.graphPeriod,refId:t,variableOptionGroup:o})))}const pr=l.memo(dr),pa=t=>({projectName:t.getDefaultProject(),expr:"",step:"10s"});function hr({refId:t,query:e,datasource:r,onChange:n,variableOptionGroup:i,onRunQuery:a}){function o(u){u.key==="Enter"&&u.shiftKey&&(a(),u.preventDefault(),u.stopPropagation())}return l.createElement(l.Fragment,null,l.createElement(We.U,null,l.createElement(nt,{refId:t,templateVariableOptions:i.options,projectName:e.projectName,datasource:r,onChange:u=>n({...e,projectName:u})}),l.createElement(Ot.f,{name:"Query",className:"slate-query-field",value:e.expr,rows:10,placeholder:"Enter a Cloud Monitoring Prometheus query (Run with Shift+Enter)",onBlur:a,onKeyDown:o,onChange:u=>n({...e,expr:u.currentTarget.value})}),l.createElement(Ne.c,{label:"Min step",tooltip:"Time units and built-in variables can be used here, for example: $__interval, $__rate_interval, 5s, 1m, 3h, 1d, 1y (Default if no unit is specified: 10s)"},l.createElement(bt.p,{type:"string",placeholder:"auto",onChange:u=>n({...e,step:u.currentTarget.value}),onKeyDown:o,value:e.step??""}))))}var fr=s(6191),mr=s(22354),gr=s(31347);const vr=t=>{const{query:e,onChange:r,onRunQuery:n}=t,{queryType:i}=e;return l.createElement(fr.X,null,l.createElement(mr.W,{label:"Query type",options:wn,value:i,onChange:({value:a})=>{r({...e,queryType:a}),n()}}),l.createElement(gr.Z,{grow:1}))},Er=t=>{const{datasource:e,query:r,onRunQuery:n,onChange:i,range:a}=t,[o,u]=(0,l.useState)(!1),[f,m]=(0,l.useState)(),E=(0,l.useMemo)(()=>{if(!f){const fe=e.migrateQuery(r);return m(fe),i({...fe}),fe}return f||r},[r,e,i,f]),[p,S]=(0,l.useState)(E),[b,k]=(0,l.useState)(!1),pe={...Zn(e),...E.sloQuery},w=fe=>{i({...E,sloQuery:fe}),n()},W={projectName:e.getDefaultProject(),expr:"",step:"10s",...E.promQLQuery},J=fe=>{i({...E,promQLQuery:fe})},_=fe=>{(fe.queryType===Ae.TIME_SERIES_LIST&&!(0,g.isEqual)(fe.timeSeriesList,ht(e))||fe.queryType===Ae.TIME_SERIES_QUERY&&!(0,g.isEqual)(fe.timeSeriesQuery,Pt(e)))&&k(!0),i(fe)},ve=(t.data?.series.length?t.data?.series[0].meta:{})?.custom??{},Le={label:"Template Variables",expanded:!1,options:e.getVariables().map(lt.z)};(0,l.useEffect)(()=>{(!E.queryType||!Object.values(Ae).includes(E.queryType))&&i({...E,queryType:Ae.TIME_SERIES_LIST})});const Se=E.queryType,Ge=fe=>{b&&(p.queryType===Ae.TIME_SERIES_LIST||p.queryType===Ae.TIME_SERIES_QUERY)?p.queryType!==fe.queryType&&u(!0):i(fe),S(fe)};return l.createElement(yt.D,null,l.createElement(Tn.u,{"data-testid":"switch-query-type-modal",title:"Warning",body:"By switching your query type, your current query will be lost.",isOpen:o,onConfirm:()=>{u(!1),i(p),k(!1)},confirmText:"Confirm",onDismiss:()=>{u(!1),S(E)}}),l.createElement(vr,{query:E,onChange:Ge,onRunQuery:n}),Se===Ae.PROMQL&&l.createElement(hr,{refId:E.refId,variableOptionGroup:Le,onChange:J,onRunQuery:n,datasource:e,query:W}),Se!==Ae.SLO&&l.createElement(pr,{refId:E.refId,variableOptionGroup:Le,customMetaData:ve,onChange:_,onRunQuery:n,datasource:e,query:E,range:a||(0,bn.E2)()}),Se===Ae.SLO&&l.createElement(qn,{refId:E.refId,variableOptionGroup:Le,customMetaData:ve,onChange:w,onRunQuery:n,datasource:e,query:pe,aliasBy:E.aliasBy,onChangeAliasBy:fe=>i({...E,aliasBy:fe})}))};var yr=s(7521),br=s(38645),Tr=s(63021),Cr=s(40675),Rt=s(8984),Ut=s(13544);const Ar=t=>{const[e,r]=(0,l.useState)(null),n=t.type==="submenu",i=(0,it.of)(xr),a=t.iconClassName?(0,Rt.toIconName)(t.iconClassName):void 0;switch(t.type){case"divider":return l.createElement("li",{className:"divider"});case"group":return l.createElement("li",null,l.createElement("span",{className:i.groupLabel},t.text));default:return l.createElement("li",{className:n?`dropdown-submenu ${Sr(e)}`:void 0,ref:r,"data-testid":Ut.Tp.components.Panels.Panel.menuItems(t.text)},l.createElement("a",{onClick:t.onClick,href:t.href,role:"menuitem"},a&&l.createElement(Xe.I,{name:a,className:i.menuIconClassName}),l.createElement("span",{className:"dropdown-item-text","data-testid":Ut.Tp.components.Panels.Panel.headerItems(t.text)},t.text,n&&l.createElement(Xe.I,{name:"angle-right",className:i.shortcutIconClassName})),t.shortcut&&l.createElement("span",{className:"dropdown-menu-item-shortcut"},l.createElement(Xe.I,{name:"keyboard",className:i.menuIconClassName})," ",t.shortcut)),t.children)}};function Sr(t){if(!t)return"invisible";const e=t.parentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return r.width===0?"invisible":e.right+r.width+10>window.innerWidth?"pull-left":"pull-right"}function xr(t){return{menuIconClassName:(0,Be.css)({marginRight:t.spacing(1),"a::after":{display:"none"}}),shortcutIconClassName:(0,Be.css)({position:"absolute",top:"7px",right:t.spacing(.5),color:t.colors.text.secondary}),groupLabel:(0,Be.css)({color:t.colors.text.secondary,fontSize:t.typography.size.sm,padding:t.spacing(.5,1)})}}var Ir=s(13773),Lr=s(76323);const Nr=({children:t,customCss:e})=>{if(!t||t.length===0)return null;const r=t.find(n=>n.active===!0);return l.createElement("div",{className:`gf-form-select-wrapper width-20 ${e}`},l.createElement("div",{className:"dropdown"},l.createElement("button",{type:"button",className:"gf-form-input dropdown-toggle","data-toggle":"dropdown",style:{textAlign:"left"}},r?.text),l.createElement("ul",{role:"menu",className:"dropdown-menu dropdown-menu--menu"},t.map(n=>n.hideFromTabs?null:l.createElement(Ar,{key:n.url,iconClassName:n.icon,text:n.text,href:n.url})))))},wr=({children:t})=>!t||t.length===0?null:l.createElement("nav",null,l.createElement(Nr,{customCss:"page-header__select-nav"},t),l.createElement(Tr.U,{className:"page-header__tabs",hideBorder:!0},t.map((e,r)=>!e.hideFromTabs&&l.createElement(Cr.o,{label:e.text,active:e.active,key:`${e.url}-${r}`,icon:e.icon,href:e.url,suffix:e.tabSuffix})))),Dr=({navItem:t,renderTitle:e,actions:r,info:n,subTitle:i})=>{const a=(0,it.of)(Mr);if(!t)return null;const o=u=>{const f=u.icon==="grafana"?12:14,m=u.icon&&(0,Rt.toIconName)(u.icon),E=i??u.subTitle;return l.createElement("div",{className:"page-header__inner"},l.createElement("span",{className:"page-header__logo"},m&&l.createElement(Xe.I,{name:m,size:"xxxl",style:{marginTop:f}}),u.img&&l.createElement("img",{className:"page-header__img",src:u.img,alt:""})),l.createElement("div",{className:(0,Be.cx)("page-header__info-block",a.headerText)},e?e(u.text):Or(u.text,u.highlightText),n&&l.createElement(Ir.Q,{info:n}),E&&l.createElement("div",{className:"page-header__sub-title"},E),r&&l.createElement("div",{className:a.actions},r)))};return l.createElement("div",{className:a.headerCanvas},l.createElement("div",{className:"page-container"},l.createElement("div",{className:"page-header"},o(t),t.children&&t.children.length>0&&l.createElement(wr,null,t.children))))};function Or(t,e){return t?l.createElement("h1",{className:"page-header__title"},t,e&&l.createElement(Lr.J,{text:e,className:(0,Be.css)`
            vertical-align: middle;
          `})):null}const Mr=t=>({actions:(0,Be.css)({display:"flex",flexDirection:"row",gap:t.spacing(1)}),headerText:(0,Be.css)({display:"flex",flexDirection:"column",gap:t.spacing(1)}),headerCanvas:(0,Be.css)`
    background: ${t.colors.background.canvas};
  `}),Pr=t=>{const{value:e,placeholder:r,className:n,isSearchable:i,onChange:a}=t,o=Rr(t),u=Ur(o,e),f=(0,l.useCallback)(m=>a(m.value),[a]);return l.createElement(Oe.l6,{className:n,isMulti:!1,isClearable:!1,backspaceRemovesValue:!1,onChange:f,options:o,isSearchable:i,maxMenuHeight:500,placeholder:r,noOptionsMessage:"No options found",value:u})},Rr=({variables:t=[],options:e})=>(0,l.useMemo)(()=>!Array.isArray(t)||t.length===0?e:[{label:"Template Variables",options:t.map(({name:r})=>({label:`$${r}`,value:`$${r}`}))},...e],[t,e]),Ur=(t,e)=>(0,l.useMemo)(()=>(t.every(n=>n.options)?(0,g.flatten)(t.map(n=>n.options)):t).find(n=>n.value===e),[t,e]);var $r=s(99818),kr=s(93522);const{SecretFormField:Br}=sn.LegacyForms;function Gr(){Ie("footer",br.wi,[]),Ie("icon",Xe.I,["name","size","type",["onClick",{watchDepth:"reference",wrapApply:!0}]]),Ie("spinner",ln.y,["inline"]),Ie("helpModal",kr.N,[]),Ie("pageHeader",Dr,["model","noTabs"]),Ie("emptyListCta",yr.A,["title","buttonIcon","buttonLink","buttonTitle",["onClick",{watchDepth:"reference",wrapApply:!0}],"proTip","proTipLink","proTipLinkTitle","proTipTarget","infoBox","infoBoxTitle"]),Ie("tagFilter",$r.$,["tags",["onChange",{watchDepth:"reference"}],["tagOptions",{watchDepth:"reference"}]]),Ie("colorPicker",cn.sk,["color",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("seriesColorPickerPopover",un.t,["color","series","onColorChange","onToggleAxis"]),Ie("unitPicker",dn.p,["value","width",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("metricSelect",Pr,["options","onChange","value","isSearchable","className","placeholder",["variables",{watchDepth:"reference"}]]),Ie("cloudMonitoringQueryEditor",Er,["target","onQueryChange","onExecuteQuery",["events",{watchDepth:"reference"}],["datasource",{watchDepth:"reference"}],["templateSrv",{watchDepth:"reference"}]]),Ie("secretFormField",Br,["value","isConfigured","inputWidth","labelWidth","aria-label",["onReset",{watchDepth:"reference",wrapApply:!0}],["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("graphContextMenu",pn.H,["x","y","itemsGroup",["onClose",{watchDepth:"reference",wrapApply:!0}],["getContextMenuSource",{watchDepth:"reference",wrapApply:!0}],["timeZone",{watchDepth:"reference",wrapApply:!0}]]),Ie("drilldownLinksEditor",hn.e,["value","links","suggestions",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("datasourceHttpSettingsNext",fn.t,["defaultUrl","showAccessOptions","dataSourceConfig","showForwardOAuthIdentityOption",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("folderPicker",En.sR,["labelClass","rootName","enableCreateNew","enableReset","initialTitle","initialFolderId","dashboardId","onCreateFolder",["enterFolderCreation",{watchDepth:"reference",wrapApply:!0}],["exitFolderCreation",{watchDepth:"reference",wrapApply:!0}],["onLoad",{watchDepth:"reference",wrapApply:!0}],["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("timePickerSettings",yn.p,["renderCount","refreshIntervals","timePickerHidden","nowDelay","timezone",["onTimeZoneChange",{watchDepth:"reference",wrapApply:!0}],["onRefreshIntervalChange",{watchDepth:"reference",wrapApply:!0}],["onNowDelayChange",{watchDepth:"reference",wrapApply:!0}],["onHideTimePickerChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("clipboardButton",mn.b,[["getText",{watchDepth:"reference",wrapApply:!0}]])}const ft=t=>e=>e.finally(t.$evalAsync),Fr=`
<div class="dropdown cascade-open">
<a ng-click="showActionsMenu()" class="query-part-name pointer dropdown-toggle" data-toggle="dropdown">{{part.def.type}}</a>
<span>(</span><span class="query-part-parameters"></span><span>)</span>
<ul class="dropdown-menu">
  <li ng-repeat="action in partActions">
    <a ng-click="triggerPartAction(action)">{{action.text}}</a>
  </li>
</ul>
`;c.Ay.directive("queryPartEditor",["templateSrv",Vr]);function Vr(t){const e='<input type="text" class="hide input-mini tight-form-func-param"></input>';return{restrict:"E",template:Fr,scope:{part:"=",handleEvent:"&",debounce:"@"},link:function(n,i){const a=n.part,o=a.def,u=i.find(".query-part-parameters"),f=n.debounce;n.partActions=[];function m(w){const W=D()(this),J=W.next();J.val(a.params[w]),J.css("width",W.width()+16+"px"),W.hide(),J.show(),J.focus(),J.select();const _=J.data("typeahead");_&&(J.val(""),_.lookup())}function E(w){const W=D()(this),J=W.prev(),_=W.val();(_!==""||a.def.params[w].optional)&&(J.html(t.highlightVariablesAsHtml(_)),a.updateParam(W.val(),w),n.$apply(()=>{n.handleEvent({$event:{name:"part-param-changed"}})})),W.hide(),J.show()}function p(w,W){W.which===13&&E.call(this,w)}function S(){this.style.width=(3+this.value.length)*8+"px"}function b(w,W,J){if(!W.options&&!W.dynamicLookup)return;const _=(ve,Le)=>{if(W.options){let Se=W.options;return W.type==="int"&&(Se=(0,g.map)(Se,Ge=>Ge.toString())),Se}n.$apply(()=>{n.handleEvent({$event:{name:"get-param-options"}}).then(Se=>{const Ge=(0,g.map)(Se,fe=>(0,g.escape)(fe.value));Le(Ge)})})};w.attr("data-provide","typeahead"),w.typeahead({source:_,minLength:0,items:1e3,updater:ve=>(ve=(0,g.unescape)(ve),setTimeout(()=>{E.call(w[0],J)},0),ve)});const ue=w.data("typeahead");ue.lookup=function(){this.query=this.$element.val()||"";const ve=this.source(this.query,D().proxy(this.process,this));return ve&&this.process(ve)},f&&(ue.lookup=(0,g.debounce)(ue.lookup,500,{leading:!0}))}n.showActionsMenu=()=>{ft(n)(n.handleEvent({$event:{name:"get-part-actions"}}).then(w=>{n.partActions=w}))},n.triggerPartAction=w=>{n.handleEvent({$event:{name:"action",action:w}})};function k(){(0,g.each)(o.params,(w,W)=>{if(w.optional&&a.params.length<=W)return;W>0&&D()("<span>, </span>").appendTo(u);const J=t.highlightVariablesAsHtml(a.params[W]),_=D()('<a class="graphite-func-param-link pointer">'+J+"</a>"),ue=D()(e);_.appendTo(u),ue.appendTo(u),ue.blur((0,g.partial)(E,W)),ue.keyup(S),ue.keypress((0,g.partial)(p,W)),_.click((0,g.partial)(m,W)),b(ue,w,W)})}function pe(){u.empty(),k()}pe()}}}function jr(t){let e=this.query;return e===""?!0:(e[0]==="/"&&(e=e.substring(1)),e[e.length-1]==="/"&&(e=e.substring(0,e.length-1)),t.toLowerCase().match(e.toLowerCase()))}class zr{constructor(e,r,n,i){this.$scope=e,this.$sce=n,this.templateSrv=i,this.inputElement=r.find("input").first(),this.linkElement=r.find("a").first(),this.linkMode=!0,this.cancelBlur=null,this.labelMode=!1,this.lookupText=!1,this.debounce=!1,e.$watch("ctrl.model",this.modelChanged.bind(this))}static{this.$inject=["$scope","$element","$sce","templateSrv"]}$onInit(){this.labelMode?this.cssClasses="gf-form-label "+this.cssClass:this.cssClasses="gf-form-input gf-form-input--dropdown "+this.cssClass,this.placeholder&&this.inputElement.attr("placeholder",this.placeholder),this.inputElement.attr("data-provide","typeahead"),this.inputElement.typeahead({source:this.typeaheadSource.bind(this),minLength:0,items:1e4,updater:this.typeaheadUpdater.bind(this),matcher:jr});const e=this.inputElement.data("typeahead");e.lookup=function(){this.query=this.$element.val()||"",this.source(this.query,this.process.bind(this))},this.debounce&&(e.lookup=(0,g.debounce)(e.lookup,500,{leading:!0})),this.linkElement.keydown(r=>{(r.keyCode===40||r.keyCode===13)&&this.linkElement.click()}),this.inputElement.keydown(r=>{r.keyCode===13&&setTimeout(()=>{this.inputElement.blur()},300)}),this.inputElement.blur(this.inputBlur.bind(this)),this.startOpen&&setTimeout(this.open.bind(this),0)}getOptionsInternal(e){return ft(this.$scope)(Promise.resolve(this.getOptions({$query:e})))}isPromiseLike(e){return e&&typeof e.then=="function"}modelChanged(){(0,g.isObject)(this.model)?this.updateDisplay(this.model.text):this.lookupText?this.getOptionsInternal("").then(e=>{const r=(0,g.find)(e,{value:this.model});this.updateDisplay(r?r.text:this.model)}):this.updateDisplay(this.model)}typeaheadSource(e,r){this.getOptionsInternal(e).then(n=>{this.optionCache=n;const i=(0,g.map)(n,a=>(0,g.escape)(a.text));this.allowCustom&&this.text!==""&&(0,g.indexOf)(i,this.text)===-1&&i.unshift(this.text),r(i)})}typeaheadUpdater(e){return e===this.text?(clearTimeout(this.cancelBlur),this.inputElement.focus(),e):(this.inputElement.val(e),this.switchToLink(!0),e)}switchToLink(e){this.linkMode&&!e||(clearTimeout(this.cancelBlur),this.cancelBlur=null,this.linkMode=!0,this.inputElement.hide(),this.linkElement.show(),this.updateValue(this.inputElement.val()))}inputBlur(){this.cancelBlur=setTimeout(this.switchToLink.bind(this),200)}updateValue(e){e=(0,g.unescape)(e),!(e===""||this.text===e)&&this.$scope.$apply(()=>{const r=(0,g.find)(this.optionCache,{text:e});r?((0,g.isObject)(this.model)?this.model=r:this.model=r.value,this.text=r.text):this.allowCustom&&((0,g.isObject)(this.model)?this.model.text=this.model.value=e:this.model=e,this.text=e),this.$scope.$$postDigest(()=>{this.$scope.$apply(()=>{this.onChange({$option:r})})})})}updateDisplay(e){this.text=e,this.display=this.$sce.trustAsHtml(this.templateSrv.highlightVariablesAsHtml(e))}open(){this.inputElement.css("width",Math.max(this.linkElement.width(),80)+16+"px"),this.inputElement.show(),this.inputElement.focus(),this.linkElement.hide(),this.linkMode=!1;const e=this.inputElement.data("typeahead");e&&(this.inputElement.val(""),e.lookup())}}const Hr=`
<input type="text"
  data-provide="typeahead"
  class="gf-form-input"
  spellcheck="false"
  style="display:none">
</input>
<a ng-class="ctrl.cssClasses"
   tabindex="1"
   ng-click="ctrl.open()"
   give-focus="ctrl.focus"
   ng-bind-html="ctrl.display || '&nbsp;'">
</a>
`;function Kr(){return{restrict:"E",template:Hr,controller:zr,bindToController:!0,controllerAs:"ctrl",scope:{model:"=",getOptions:"&",onChange:"&",cssClass:"@",allowCustom:"@",labelMode:"@",lookupText:"@",placeholder:"@",startOpen:"@",debounce:"@"}}}c.Ay.directive("gfFormDropdown",Kr);const Wr=`
<div class="baron__track">
  <div class="baron__bar"></div>
</div>
`,Qr="baron baron__root",Yr="baron__scroller";function Xr(){return{restrict:"A",link:(t,e,r)=>{let n=e.parent();const i=e;r.grafanaScrollbar&&r.grafanaScrollbar==="scrollonroot"&&(n=i),n.addClass(Qr),D()(Wr).appendTo(n),e.addClass(Yr);const a={root:n[0],scroller:i[0],bar:".baron__bar",barOnCls:"_scrollbar",scrollingCls:"_scrolling",track:".baron__track",direction:"v"},o=R()(a);t.$on("$destroy",()=>{o.dispose()})}}}c.Ay.directive("grafanaScrollbar",Xr);var Jr=s(44533);c.Ay.directive("jsonTree",[function(){return{restrict:"E",scope:{object:"=",startExpanded:"@",rootName:"@"},link:(e,r)=>{let n=e.startExpanded;e.startExpanded==="true"?n=2:e.startExpanded==="false"&&(n=1);const i={[e.rootName]:e.object},o=new Jr.O(i,n,{animateOpen:!0}).render(!0);r.append(o)}}}]);const Zr=`
<label for="check-{{ctrl.id}}" class="gf-form-switch-container">
  <div class="gf-form-label {{ctrl.labelClass}}" ng-show="ctrl.label">
    {{ctrl.label}}
    <info-popover mode="right-normal" ng-if="ctrl.tooltip" position="top center">
      {{ctrl.tooltip}}
    </info-popover>
  </div>
  <div class="gf-form-switch {{ctrl.switchClass}}" ng-if="ctrl.show">
    <input id="check-{{ctrl.id}}" type="checkbox" ng-model="ctrl.checked" ng-change="ctrl.internalOnChange()">
    <span class="gf-form-switch__slider"></span>
  </div>
</label>
`,qr=`
<label for="check-{{ctrl.id}}" class="gf-form-switch-container">
   <div class="gf-form-label {{ctrl.labelClass}}" ng-show="ctrl.label">
    {{ctrl.label}}
    <info-popover mode="right-normal" ng-if="ctrl.tooltip" position="top center">
      {{ctrl.tooltip}}
    </info-popover>
  </div>
  <div class="gf-form-checkbox {{ctrl.switchClass}}" ng-if="ctrl.show">
    <input id="check-{{ctrl.id}}" type="checkbox" ng-model="ctrl.checked" ng-change="ctrl.internalOnChange()">
    <span class="gf-form-switch__checkbox"></span>
  </div>
</label>
`;class $t{constructor(e,r){this.$timeout=r,this.show=!0,this.id=e.$id}static{this.$inject=["$scope","$timeout"]}internalOnChange(){return this.$timeout(()=>this.onChange())}}function _r(){return{restrict:"E",controller:$t,controllerAs:"ctrl",bindToController:!0,scope:{checked:"=",label:"@",labelClass:"@",tooltip:"@",switchClass:"@",onChange:"&"},template:Zr}}function ei(){return{restrict:"E",controller:$t,controllerAs:"ctrl",bindToController:!0,scope:{checked:"=",label:"@",labelClass:"@",tooltip:"@",switchClass:"@",onChange:"&"},template:qr}}c.Ay.directive("gfFormSwitch",_r),c.Ay.directive("gfFormCheckbox",ei);function ti(){return{restrict:"E",template:`<icon name="'info-circle'" style="margin-left: 10px;" size="'xs'"></icon>`,transclude:!0,link:(t,e,r,n,i)=>{const a=r.offset||"0 -10px",o=r.position||"right middle";let u="drop-help drop-hide-out-of-bounds";const f="hover";e.addClass("gf-form-help-icon"),r.wide&&(u+=" drop-wide"),r.mode&&e.addClass("gf-form-help-icon--"+r.mode),i((m,E)=>{const p=document.createElement("div");p.className="markdown-html",(0,g.each)(m,b=>{p.appendChild(b)});const S={target:e[0],content:p,position:o,classes:u,openOn:f,hoverOpenDelay:400,tetherOptions:{offset:a,constraints:[{to:"window",attachment:"together",pin:!0}]}};t.$applyAsync(()=>{const b=new(ie())(S),k=t.$on("$destroy",()=>{b.destroy(),k()})})})}}}c.Ay.directive("infoPopover",ti),c.Ay.directive("spectrumPicker",ni);function ni(){return{restrict:"E",require:"ngModel",scope:!0,replace:!0,template:'<color-picker color="ngModel.$viewValue" on-change="onColorChange"></color-picker>',link:(t,e,r,n)=>{t.ngModel=n,t.onColorChange=i=>{n.$setViewValue(i)}}}}var Qe=s(2913);const ri="ace/theme/grafana-dark",ii="ace/theme/textmate",ai="text",oi=10,si=2,li=!0,ci=!0,ui="<div></div>";async function di(t,e,r){const n=r.mode||ai,i=r.maxLines||oi,a=r.showGutter!==void 0,o=r.tabSize||si,u=r.behavioursEnabled?r.behavioursEnabled==="true":li,f=r.snippetsEnabled?r.snippetsEnabled==="true":ci,m=e.get(0),{default:E}=await s.e(3832).then(s.t.bind(s,47496,23));await s.e(6464).then(s.t.bind(s,6464,23)),await s.e(2694).then(s.t.bind(s,52694,23)),await s.e(7391).then(s.t.bind(s,57391,23)),await s.e(2228).then(s.t.bind(s,32228,23)),await s.e(2514).then(s.t.bind(s,32514,23)),await s.e(7515).then(s.t.bind(s,17515,23)),await s.e(4289).then(s.t.bind(s,54289,23)),await s.e(1708).then(s.t.bind(s,11708,23)),await s.e(7613).then(s.t.bind(s,7613,23)),await s.e(8730).then(s.t.bind(s,98730,23)),await s.e(9118).then(s.t.bind(s,59118,23)),await s.e(5277).then(s.t.bind(s,45277,23)),await s.e(9384).then(s.t.bind(s,69384,23));const p=E.edit(m),S=p.getSession(),b={maxLines:i,showGutter:a,tabSize:o,behavioursEnabled:u,highlightActiveLine:!1,showPrintMargin:!1,autoScrollEditorIntoView:!0};p.setOptions(b),p.$blockScrolling=1/0,p.renderer.setScrollMargin(10,10),p.renderer.setPadding(10),w(),pe(n),W(t.content),e.addClass("gf-code-editor");const k=e.find("textarea");k.addClass("gf-form-input"),k.attr("aria-label",r.textareaLabel),t.codeEditorFocus&&setTimeout(()=>{k.focus();const J=k[0];if(J.setSelectionRange){const _=k.val().length*2;J.setSelectionRange(_,_)}},100),S.on("change",J=>{t.$apply(()=>{const _=p.getValue();t.content=_})}),t.$watch("content",(J,_)=>{const ue=p.getValue();J!==ue&&J!==_&&t.$$postDigest(()=>{W(J)})}),p.on("blur",()=>{t.onChange()}),t.$on("$destroy",()=>{p.destroy()}),p.commands.addCommand({name:"executeQuery",bindKey:{win:"Ctrl-Enter",mac:"Command-Enter"},exec:()=>{t.onChange()}});function pe(J){if(E.acequire("ace/ext/language_tools"),p.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:f}),t.getCompleter()){const ue=p;ue.completers=ue.completers.slice(),ue.completers.push(t.getCompleter())}const _=`ace/mode/${J}`;S.setMode(_)}function w(){let J=ri;Qe.Ay.bootData.user.lightTheme&&(J=ii),p.setTheme(J)}function W(J){p.setValue(J),p.clearSelection()}}function pi(){return{restrict:"E",template:ui,scope:{content:"=",datasource:"=",codeEditorFocus:"<",onChange:"&",getCompleter:"&"},link:di}}c.Ay.directive("codeEditor",pi);const hi=`
<div class="dropdown cascade-open">
<a ng-click="showActionsMenu()" class="query-part-name pointer dropdown-toggle" data-toggle="dropdown">{{part.label}}</a>
<span>{{part.def.wrapOpen}}</span><span class="query-part-parameters"></span><span>{{part.def.wrapClose}}</span>
<ul class="dropdown-menu">
  <li ng-repeat="action in partActions">
    <a ng-click="triggerPartAction(action)">{{action.text}}</a>
  </li>
</ul>
`;c.Ay.directive("sqlPartEditor",["templateSrv",fi]);function fi(t){const e='<input type="text" class="hide input-mini"></input>';return{restrict:"E",template:hi,scope:{part:"=",handleEvent:"&",debounce:"@"},link:function(n,i){const a=n.part,o=a.def,u=i.find(".query-part-parameters"),f=n.debounce;let m=null;n.partActions=[];function E(J){const _=D()(this),ue=_.next();ue.val(a.params[J]),ue.css("width",_.width()+16+"px"),_.hide(),ue.show(),ue.focus(),ue.select();const ve=ue.data("typeahead");ve&&(ue.val(""),ve.lookup())}function p(J,_){m=setTimeout(()=>{S(J,_)},200)}function S(J,_){const ue=J.prev(),ve=J.val();(ve!==""||a.def.params[_].optional)&&(ue.html(t.highlightVariablesAsHtml(ve)),a.updateParam(J.val(),_),n.$apply(()=>{n.handleEvent({$event:{name:"part-param-changed"}})})),J.hide(),ue.show()}function b(J,_){_.which===13&&S(D()(this),J)}function k(){this.style.width=(3+this.value.length)*8+"px"}function pe(J,_,ue){if(!_.options&&!_.dynamicLookup)return;const ve=(Se,Ge)=>{if(_.options){let fe=_.options;return _.type==="int"&&(fe=(0,g.map)(fe,$e=>$e.toString())),fe}n.$apply(()=>{n.handleEvent({$event:{name:"get-param-options",param:_}}).then(fe=>{const $e=(0,g.map)(fe,ke=>(0,g.escape)(ke.value));(0,g.indexOf)($e,a.params[ue])===-1&&$e.unshift((0,g.escape)(a.params[ue])),Ge($e)})})};J.attr("data-provide","typeahead"),J.typeahead({source:ve,minLength:0,items:1e3,updater:Se=>(Se=(0,g.unescape)(Se),Se===a.params[ue]&&(clearTimeout(m),J.focus()),Se)});const Le=J.data("typeahead");Le.lookup=function(){this.query=this.$element.val()||"";const Se=this.source(this.query,D().proxy(this.process,this));return Se&&this.process(Se)},f&&(Le.lookup=(0,g.debounce)(Le.lookup,500,{leading:!0}))}n.showActionsMenu=()=>{n.handleEvent({$event:{name:"get-part-actions"}}).then(J=>{n.partActions=J})},n.triggerPartAction=J=>{n.handleEvent({$event:{name:"action",action:J}})};function w(){(0,g.each)(o.params,(J,_)=>{if(J.optional&&a.params.length<=_)return;_>0&&D()("<span>"+o.separator+"</span>").appendTo(u);const ue=t.highlightVariablesAsHtml(a.params[_]),ve=D()('<a class="query-part__link">'+ue+"</a>"),Le=D()(e);ve.appendTo(u),Le.appendTo(u),Le.blur((0,g.partial)(p,Le,_)),Le.keyup(k),Le.keypress((0,g.partial)(b,_)),ve.click((0,g.partial)(E,_)),pe(Le,J,_)})}function W(){u.empty(),w()}W()}}}c.m7.directive("datasourceHttpSettings",()=>({scope:{current:"=",suggestUrl:"@",noDirectAccess:"@",showForwardOAuthIdentityOption:"@"},templateUrl:"public/app/angular/partials/http_settings_next.html",link:{pre:t=>{t.showAccessOption=t.noDirectAccess!=="true",t.onChange=e=>{t.current=e}}}})),c.m7.directive("datasourceTlsAuthSettings",()=>({scope:{current:"="},templateUrl:"public/app/angular/partials/tls_auth_settings.html"}));var kt=s(15162),mt=s(22854);c.Ay.directive("pluginComponent",["$compile","$http","$templateCache","$location",mi]);function mi(t,e,r,n){function i(p){if(p.template)return Promise.resolve(p.template);const S=r.get(p.templateUrl);return S?Promise.resolve(S):e.get(p.templateUrl).then(b=>b.data)}function a(p,S){if(p)return p.indexOf("public")===0?p:S+"/"+p}function o(p){return p.Component.templateUrl=a(p.Component.templateUrl,p.baseUrl),()=>({templateUrl:p.Component.templateUrl,template:p.Component.template,restrict:"E",controller:p.Component,controllerAs:"ctrl",bindToController:!0,scope:p.bindings,link:(S,b,k,pe)=>{pe.link&&pe.link(S,b,k,pe),pe.init&&pe.init()}})}function u(p,S){const b={name:"panel-plugin-"+p.panel.type,bindings:{dashboard:"=",panel:"=",row:"="},attrs:{dashboard:"dashboard",panel:"panel",class:"panel-height-helper"}},k=Qe.Ay.panels[p.panel.type];return(0,kt.TV)(k.id).then(pe=>{const w=pe.angularPanelCtrl;return b.Component=w,!w||w.registered?b:w.templatePromise?w.templatePromise.then(W=>b):(k&&(w.templateUrl=a(w.templateUrl,k.baseUrl)),w.templatePromise=i(w).then(W=>(w.templateUrl=null,w.template=`<grafana-panel ctrl="ctrl" class="panel-height-helper">${W}</grafana-panel>`,{...b,baseUrl:k.baseUrl})),w.templatePromise)})}function f(p,S){switch(S.type){case"query-ctrl":{const b=p.ctrl.datasource;return Promise.resolve({baseUrl:b.meta.baseUrl,name:"query-ctrl-"+b.meta.id,bindings:{target:"=",panelCtrl:"=",datasource:"="},attrs:{target:"ctrl.target","panel-ctrl":"ctrl",datasource:"ctrl.datasource"},Component:b.components.QueryCtrl})}case"annotations-query-ctrl":{const b=p.ctrl.currentDatasource.meta.baseUrl,k=p.ctrl.currentDatasource.meta.id;return(0,mt.cS)(p.ctrl.currentDatasource.meta).then(pe=>({baseUrl:b,name:"annotations-query-ctrl-"+k,bindings:{annotation:"=",datasource:"="},attrs:{annotation:"ctrl.currentAnnotation",datasource:"ctrl.currentDatasource"},Component:pe.components.AnnotationsQueryCtrl}))}case"datasource-config-ctrl":{const b=p.ctrl.datasourceMeta,k=n.url();return(0,mt.cS)(b).then(pe=>(p.$watch("ctrl.current",()=>{k===n.url()&&p.onModelChanged(p.ctrl.current)},!0),{baseUrl:b.baseUrl,name:"ds-config-"+b.id,bindings:{meta:"=",current:"="},attrs:{meta:"ctrl.datasourceMeta",current:"ctrl.current"},Component:pe.angularConfigCtrl}))}case"app-config-ctrl":{const b=p.ctrl.model;return(0,mt.ui)(b).then(k=>({baseUrl:b.baseUrl,name:"app-config-"+b.id,bindings:{appModel:"=",appEditCtrl:"="},attrs:{"app-model":"ctrl.model","app-edit-ctrl":"ctrl"},Component:k.angularConfigCtrl}))}case"panel":return u(p,S);default:return Promise.reject({message:"Could not find component type: "+S.type})}}function m(p,S,b){const k=T().element(document.createElement(b.name));(0,g.each)(b.attrs,(pe,w)=>{k.attr(w,pe)}),t(k)(p),S.empty(),setTimeout(()=>{p.$applyAsync(()=>{S.append(k),setTimeout(()=>{p.$applyAsync(()=>{p.$broadcast(M.ee.componentDidMount.name)})})})})}function E(p,S,b,k){if(k.notFound){S.empty();return}if(!k.Component)throw{message:"Failed to find exported plugin component for "+k.name};if(!k.Component.registered){const pe=b.$normalize(k.name),w=o(k);c.Ay.directive(pe,w),k.Component.registered=!0}m(p,S,k)}return{restrict:"E",link:(p,S,b)=>{f(p,b).then(k=>{E(p,S,b,k)}).catch(k=>{console.error("Plugin component error",k)})}}}var Bt=s(7376),gi=s(81634),vi=s(24284),Ze=s(28138);class Ei{static{this.$inject=["$scope","utilSrv","$rootScope","contextSrv","angularLoader","$injector"]}constructor(e,r,n,i,a,o){(0,Bt.w)(a),(0,gi.j)(o),e.init=()=>{e.contextSrv=i,e.appSubUrl=Qe.Ay.appSubUrl,e._=oe(),r.init()},n.colors=vi.Tj,n.onAppEvent=function(u,f,m){let E;typeof u=="string"?E=n.$on(u,f):E=n.$on(u.name,f);let p=this;p.$id===1&&!m&&console.warn("warning rootScope onAppEvent called without localscope"),m&&(p=m),p.$on("$destroy",E)},n.appEvent=(u,f)=>{typeof u=="string"?(n.$emit(u,f),Ze.A.emit(u,f)):(n.$emit(u.name,f),Ze.A.emit(u,f))},e.init()}}function yi(){return{restrict:"E",controller:Ei,link:(t,e)=>{const r=D()("body");D().fn.modal.Constructor.prototype.enforceFocus=()=>{};let n=new Date().getTime(),i=!0;const a=60*5e3;function o(){i&&r.hasClass("page-dashboard")&&new Date().getTime()-n>a&&(i=!1,r.addClass("view-mode--inactive"))}function u(){n=new Date().getTime(),i||(i=!0,r.removeClass("view-mode--inactive"))}r.mousemove(u),r.keydown(u),document.addEventListener("wheel",u,{capture:!0,passive:!0}),document.addEventListener("visibilitychange",u),setInterval(o,2e3),r.click(f=>{const m=D()(f.target);if(m.parents().length===0)return;r.find(".dropdown-menu-open").removeClass("dropdown-menu-open");const E=m.closest("[data-click-hide]");if(E.length){const S=E.parent();E.detach(),setTimeout(()=>{S.append(E)},100)}const p=e.find(".popover");p.length>0&&m.parents(".graph-legend").length===0&&p.hide()})}}}c.Ay.directive("grafanaApp",yi);var ha=s(23345),fa=s(26415),ma=s(74526),bi=s(16233),Ti=s(17493),Ci=s(74856),Ai=s(63770),Si=s(94429),xi=s(5808),Gt=s(12131);class Ii{constructor(){this.$get=()=>{},(0,Gt.Lc)("Patch angular",!1,"RouteParamsProvider")}}class Li{constructor(){(0,Gt.Lc)("Patch angular",!1,"RouteProvider")}$get(){return this}}var Ni=s(4244);const wi=()=>{c.m7.config(["$provide",t=>{t.decorator("$browser",["$delegate",e=>(e.onUrlChange=()=>{},e.url=()=>"",e)])}])},Di=()=>{c.m7.config(["$provide",t=>{t.decorator("$location",["$delegate",e=>(e=new Ni.b,e)])}]),c.m7.provider("$route",Li),c.m7.provider("$routeParams",Ii)};function Oi(){wi(),Di()}function Mi(t){t.oldInvoke=t.invoke,t.invoke=(e,r,n,i)=>{const a=n?.$scope?.$parent;return a&&(a.panel&&(r.panel=a.panel),a.dashboard&&(r.dashboard=a.dashboard),a.ctrl?.target&&(r.panelCtrl=a.ctrl,r.datasource=a.ctrl.datasource,r.target=a.ctrl.target),a.ctrl?.datasourceMeta&&(r.meta=a.ctrl.datasourceMeta,r.current=a.ctrl.current),a.ctrl?.currentAnnotation&&(r.annotation=a.ctrl.currentAnnotation,r.datasource=a.ctrl.currentDatasource),a.isAppConfigCtrl&&(r.appEditCtrl=a.ctrl,r.appModel=a.ctrl.model),a.$parent?.$parent?.ctrl?.appModel&&(r.appModel=a.$parent?.$parent?.ctrl?.appModel)),t.oldInvoke(e,r,n,i)}}var Pi=s(39741),Ri=s(18226),Ft=s(14792);function Ui(t){return function(r){const n=(0,l.useRef)(null),i=(0,l.useRef)(),a=(0,l.useRef)();return(0,l.useEffect)(()=>{if(!n.current)return;const o=(0,Bt.E)(),u='<plugin-component type="panel" class="panel-height-helper"></plugin-component>',f=new ki,m=new $i(t,r,f);i.current={panel:m,dashboard:(0,Ft.UA)().getCurrent(),size:{width:r.width,height:r.height},queryRunner:f},a.current=o.load(n.current,i.current,u)},[]),(0,l.useEffect)(()=>{a.current&&(i.current.size.height=r.height,i.current.size.width=r.width,i.current.panel.events.publish(new h.XM))},[r.width,r.height]),(0,l.useEffect)(()=>{i.current?.panel&&i.current.queryRunner.forwardNewData(r.data)},[r.data]),l.createElement("div",{ref:n,className:"panel-height-helper"})}}class $i{constructor(e,r,n){r.options.angularOptions&&Object.assign(this,r.options.angularOptions),this.id=r.id,this.type=e.meta.id,this.title=r.title,this.fieldConfig=r.fieldConfig,this.options=r.options,this.plugin=e,this.events=new Ri.o,this.queryRunner=n}refresh(){this.events.publish(new j._)}render(){this.events.publish(new h.XM)}getQueryRunner(){return this.queryRunner}}class ki{constructor(){this.subject=new Pi.m(1)}getData(e){return this.subject}forwardNewData(e){this.subject.next(e)}run(){}}var Bi=s(17172),Gi=s(19347),Fi=s(10096),Vi=s(71500),ji=s(6923),Ue=s(95344);class zi{constructor(){}init(){Ze.l.subscribe(h.Ps,e=>this.showModal(e.payload)),Ze.l.subscribe(h.aP,this.hideModal.bind(this))}hideModal(){(0,Ue.l)("UtilSrv","hideModal",""),this.modalScope&&this.modalScope.dismiss&&this.modalScope.dismiss()}showModal(e){(0,Ue.l)("UtilSrv","showModal","publish ShowModalReactEvent")}}var gt=s(10154);class Hi{clearPromiseCaches(){(0,Ue.l)("annotations_srv.ts","clearPromiseCaches","DashboardQueryRunner")}getAnnotations(e){return(0,Ue.l)("annotations_srv.ts","getAnnotations","DashboardQueryRunner.getResult"),Promise.resolve({annotations:[],alertState:void 0})}getAlertStates(e){return(0,Ue.l)("annotations_srv.ts","getAlertStates","DashboardQueryRunner.getResult"),Promise.resolve(void 0)}getGlobalAnnotations(e){return(0,Ue.l)("annotations_srv.ts","getGlobalAnnotations","DashboardQueryRunner.getResult"),Promise.resolve([])}saveAnnotationEvent(e){return(0,Ue.l)("annotations_srv.ts","saveAnnotationEvent","api/saveAnnotation"),(0,gt.vJ)(e)}updateAnnotationEvent(e){return(0,Ue.l)("annotations_srv.ts","updateAnnotationEvent","api/updateAnnotation"),(0,gt.rJ)(e)}deleteAnnotationEvent(e){return(0,Ue.l)("annotations_srv.ts","deleteAnnotationEvent","api/deleteAnnotation"),(0,gt.Xm)(e)}translateQueryResult(e,r){(0,Ue.l)("annotations_srv.ts","translateQueryResult","DashboardQueryRunner/utils/translateQueryResult"),e.snapshotData&&(e=(0,g.cloneDeep)(e),delete e.snapshotData);for(const n of r)n.source=e,n.color=e.iconColor,n.type=e.name,n.isRegion=n.timeEnd&&n.time!==n.timeEnd;return r}}function Ki(){c.Ay.factory("backendSrv",()=>(0,Bi.AI)()),c.Ay.factory("contextSrv",()=>Fi.TP),c.Ay.factory("dashboardSrv",()=>(0,Ft.UA)()),c.Ay.factory("datasourceSrv",()=>(0,Gi.l)()),c.Ay.factory("linkSrv",()=>(0,ji.mQ)()),c.Ay.factory("validationSrv",()=>Vi.P),c.Ay.service("annotationsSrv",Hi),c.Ay.service("utilSrv",zi)}const Wi={angular:{...T(),default:T()},"app/core/core_module":{default:c.m7,__useDefault:!0},"app/core/core":{appEvents:Ze.A,contextSrv:bi.TP,coreModule:c.m7},"app/plugins/sdk":xi,"app/core/utils/promiseToDigest":{promiseToDigest:ft}};class Qi{constructor(){this.preBootModules=[],this.ngModuleDependencies=[],this.registerFunctions={}}init(){const e=T().module("grafana",[]);(0,kt.f7)(Ui),e.config(["$controllerProvider","$compileProvider","$filterProvider","$httpProvider","$provide","$sceDelegateProvider",(n,i,a,o,u,f)=>{Qe.config.buildInfo.env!=="development"&&i.debugInfoEnabled(!1),o.useApplyAsync(!0),Qe.config.pluginsCDNBaseURL&&f.trustedResourceUrlList(["self",`${Qe.config.pluginsCDNBaseURL}/**`]),this.registerFunctions.controller=n.register,this.registerFunctions.directive=i.directive,this.registerFunctions.factory=u.factory,this.registerFunctions.service=u.service,this.registerFunctions.filter=a.register,u.decorator("$http",["$delegate","$templateCache",(m,E)=>{const p=m.get;return m.get=(S,b)=>(S.match(/\.html$/)&&(E.get(S)||(S+="?v="+new Date().getTime())),p(S,b)),m}])}]),this.ngModuleDependencies=["grafana.core","ngSanitize","grafana","pasvaz.bindonce","react"],c.yF.forEach(n=>{this.useModule(n)}),T().module("grafana.services").service("dashboardLoaderSrv",Ti.Fu),c.m7.factory("timeSrv",()=>(0,Ci.jG)()),c.m7.factory("templateSrv",()=>(0,It.w)()),Gr(),Ki(),Oi();const r=(0,Si.kB)(Wi);Ai.z.addImportMap({imports:r}),$.fn.tooltip.defaults.animation=!1}useModule(e){return this.preBootModules?this.preBootModules.push(e):(0,g.extend)(e,this.registerFunctions),this.ngModuleDependencies.push(e.name),e}bootstrap(){const e=T().bootstrap(document.getElementById("ngRoot"),this.ngModuleDependencies);return Mi(e),e.invoke(()=>(this.preBootModules.forEach(r=>{(0,g.extend)(r,this.registerFunctions)}),()=>{})),e}}},59559:(I,x,s)=>{"use strict";s.d(x,{a:()=>F});var H=s(2543),R=s.n(H);class F{constructor(j,c){this.$scope=j,this.$injector=c,this.panelCtrl=this.panelCtrl??j.ctrl.panelCtrl,this.target=this.target??j.ctrl.target,this.datasource=this.datasource??j.ctrl.datasource,this.panel=this.panelCtrl?.panel??j.ctrl.panelCtrl.panel,this.isLastQuery=(0,H.indexOf)(this.panel.targets,this.target)===this.panel.targets.length-1}refresh(){this.panelCtrl.refresh()}}},50410:(I,x,s)=>{"use strict";let H=s(12631);H.keys().forEach(R=>{H(R)})},5808:(I,x,s)=>{"use strict";s.r(x),s.d(x,{MetricsPanelCtrl:()=>h,PanelCtrl:()=>c,QueryCtrl:()=>v,loadPluginCss:()=>R.PL});var H=s(92341),R=s(89191),F=s(75519),M=s(70225),j=s(59559);const c=(0,H.Y)(M.y),h=(0,H.Y)(F.F),v=(0,H.Y)(j.a)},42346:()=>{(function(I){"use strict";var x={tagClass:function(c){return"label label-info"},itemValue:function(c){return c&&c.toString()},itemText:function(c){return this.itemValue(c)},freeInput:!0,maxTags:void 0,confirmKeys:[13],onTagExists:function(c,h){h.hide().fadeIn()}};function s(c,h){this.itemsArray=[],this.$element=I(c),this.$element.hide(),this.widthClass=h.widthClass||"width-9",this.isSelect=c.tagName==="SELECT",this.multiple=this.isSelect&&c.hasAttribute("multiple"),this.objectItems=h&&h.itemValue,this.placeholderText=c.hasAttribute("placeholder")?this.$element.attr("placeholder"):"",this.$container=I('<div class="bootstrap-tagsinput"></div>'),this.$input=I('<input class="gf-form-input '+this.widthClass+'" type="text" placeholder="'+this.placeholderText+'"/>').appendTo(this.$container),this.$element.after(this.$container),this.build(h)}s.prototype={constructor:s,add:function(c,h){var v=this;if(!(v.options.maxTags&&v.itemsArray.length>=v.options.maxTags)&&!(c!==!1&&!c)){if(typeof c=="object"&&!v.objectItems)throw"Can't add objects when itemValue option is not set";if(!c.toString().match(/^\s*$/)){if(v.isSelect&&!v.multiple&&v.itemsArray.length>0&&v.remove(v.itemsArray[0]),typeof c=="string"&&this.$element[0].tagName==="INPUT"){var d=c.split(",");if(d.length>1){for(var L=0;L<d.length;L++)this.add(d[L],!0);h||v.pushVal();return}}var T=v.options.itemValue(c),ce=v.options.itemText(c),se=v.options.tagClass(c),Z=I.grep(v.itemsArray,function(g){return v.options.itemValue(g)===T})[0];if(Z){if(v.options.onTagExists){var ee=I(".tag",v.$container).filter(function(){return I(this).data("item")===Z});v.options.onTagExists(c,ee)}return}v.itemsArray.push(c);var B=I('<span class="tag '+M(se)+'">'+M(ce)+'<span data-role="remove"></span></span>');if(B.data("item",c),v.findInputWrapper().before(B),B.after(" "),v.isSelect&&!I('option[value="'+escape(T)+'"]',v.$element)[0]){var Q=I("<option selected>"+M(ce)+"</option>");Q.data("item",c),Q.attr("value",T),v.$element.append(Q)}h||v.pushVal(),v.options.maxTags===v.itemsArray.length&&v.$container.addClass("bootstrap-tagsinput-max"),v.$element.trigger(I.Event("itemAdded",{item:c}))}}},remove:function(c,h){var v=this;v.objectItems&&(typeof c=="object"?c=I.grep(v.itemsArray,function(d){return v.options.itemValue(d)==v.options.itemValue(c)})[0]:c=I.grep(v.itemsArray,function(d){return v.options.itemValue(d)==c})[0]),c&&(I(".tag",v.$container).filter(function(){return I(this).data("item")===c}).remove(),I("option",v.$element).filter(function(){return I(this).data("item")===c}).remove(),v.itemsArray.splice(I.inArray(c,v.itemsArray),1)),h||v.pushVal(),v.options.maxTags>v.itemsArray.length&&v.$container.removeClass("bootstrap-tagsinput-max"),v.$element.trigger(I.Event("itemRemoved",{item:c}))},removeAll:function(){var c=this;for(I(".tag",c.$container).remove(),I("option",c.$element).remove();c.itemsArray.length>0;)c.itemsArray.pop();c.pushVal(),c.options.maxTags&&!this.isEnabled()&&this.enable()},refresh:function(){var c=this;I(".tag",c.$container).each(function(){var h=I(this),v=h.data("item"),d=c.options.itemValue(v),L=c.options.itemText(v),T=c.options.tagClass(v);if(h.attr("class",null),h.addClass("tag "+M(T)),h.contents().filter(function(){return this.nodeType==3})[0].nodeValue=M(L),c.isSelect){var ce=I("option",c.$element).filter(function(){return I(this).data("item")===v});ce.attr("value",d)}})},items:function(){return this.itemsArray},pushVal:function(){var c=this,h=I.map(c.items(),function(v){return c.options.itemValue(v).toString()});c.$element.val(h,!0).trigger("change")},build:function(c){var h=this;h.options=I.extend({},x,c);var v=h.options.typeahead||{};h.objectItems&&(h.options.freeInput=!1),H(h.options,"itemValue"),H(h.options,"itemText"),H(h.options,"tagClass"),h.options.source&&(v.source=h.options.source),v.source&&I.fn.typeahead&&(R(v,"source"),h.$input.typeahead({source:function(d,L){function T(Z){for(var ee=[],B=0;B<Z.length;B++){var Q=h.options.itemText(Z[B]);ce[Q]=Z[B],ee.push(Q)}L(ee)}this.map={};var ce=this.map,se=v.source(d);I.isFunction(se.success)?se.success(T):I.when(se).then(T)},updater:function(d){h.add(this.map[d])},matcher:function(d){return d.toLowerCase().indexOf(this.query.trim().toLowerCase())!==-1},sorter:function(d){return d.sort()},highlighter:function(d){var L=new RegExp("("+this.query+")","gi");return d.replace(L,"<strong>$1</strong>")}})),h.$container.on("click",I.proxy(function(d){h.$input.focus()},h)),h.$container.on("blur","input",I.proxy(function(d){var L=I(d.target);h.add(L.val()),L.val(""),d.preventDefault()},h)),h.$container.on("keydown","input",I.proxy(function(d){var L=I(d.target),T=h.findInputWrapper();switch(d.which){case 8:if(j(L[0])===0){var ce=T.prev();ce&&h.remove(ce.data("item"))}break;case 46:if(j(L[0])===0){var se=T.next();se&&h.remove(se.data("item"))}break;case 37:var Z=T.prev();L.val().length===0&&Z[0]&&(Z.before(T),L.focus());break;case 39:var ee=T.next();L.val().length===0&&ee[0]&&(ee.after(T),L.focus());break;default:h.options.freeInput&&I.inArray(d.which,h.options.confirmKeys)>=0&&(h.add(L.val()),L.val(""),d.preventDefault())}L.attr("size",Math.max(this.inputSize,L.val().length))},h)),h.$container.on("click","[data-role=remove]",I.proxy(function(d){h.remove(I(d.target).closest(".tag").data("item")),d.stopPropagation()},h)),h.options.itemValue===x.itemValue&&(h.$element[0].tagName==="INPUT"?h.add(h.$element.val()):I("option",h.$element).each(function(){h.add(I(this).attr("value"),!0)}))},destroy:function(){var c=this;c.$container.off("keypress","input"),c.$container.off("click","[role=remove]"),c.$container.remove(),c.$element.removeData("tagsinput"),c.$element.show()},focus:function(){this.$input.focus()},input:function(){return this.$input},findInputWrapper:function(){for(var c=this.$input[0],h=this.$container[0];c&&c.parentNode!==h;)c=c.parentNode;return I(c)}},I.fn.tagsinput=function(c,h){var v=[];return this.each(function(){var d=I(this).data("tagsinput");if(!d)d=new s(this,c),I(this).data("tagsinput",d),v.push(d),this.tagName==="SELECT"&&I("option",I(this)).attr("selected","selected"),I(this).val(I(this).val());else{var L=d[c](h);L!==void 0&&v.push(L)}}),typeof c=="string"?v.length>1?v:v[0]:v},I.fn.tagsinput.Constructor=s;function H(c,h){if(typeof c[h]!="function"){var v=c[h];c[h]=function(d){return d[v]}}}function R(c,h){if(typeof c[h]!="function"){var v=c[h];c[h]=function(){return v}}}var F=I("<div />");function M(c){return c?F.text(c).html():""}function j(c){var h=0;if(document.selection){c.focus();var v=document.selection.createRange();v.moveStart("character",-c.value.length),h=v.text.length}else(c.selectionStart||c.selectionStart=="0")&&(h=c.selectionStart);return h}I(function(){I("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput()})})(window.jQuery)}}]);

//# sourceMappingURL=8138.d56ba0c4ca9d26e99f59.js.map