/* [create-plugin] version: 5.26.9 */ /* [create-plugin] plugin: grafana-metricsdrilldown-app@1.0.24 */ define(["i18next","react-router","rxjs","module","@grafana/ui","lodash","react","@emotion/css","@grafana/data","react-dom","@grafana/runtime"],(e,t,i,n,r,s,o,a,l,u,c)=>(()=>{var d,h,f,p,g={211:t=>{"use strict";t.exports=e},782:(e,t,i)=>{"use strict";i.d(t,{U1:()=>x});var n=i(7203);class r{constructor(e,t,i,n,r,s,o,a,l,u=0,c){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=u,this.parent=c}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let n=e.parser.context;return new r(e,[],t,i,i,0,[],0,n?new s(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,n=65535&e,{parser:r}=this.p,s=this.reducePos=2e3&&!(null===(t=this.p.parser.nodeSet.types[n])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,t,i,n=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[n-4]&&e.buffer[n-1]>-1){if(t==i)return;if(e.buffer[n-2]>=t)return void(e.buffer[n-2]=i)}}if(r&&this.pos!=i){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let e=!1;for(let t=r;t>0&&this.buffer[t-2]>i;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;r>0&&this.buffer[r-2]>i;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,n>4&&(n-=4)}this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=i,this.buffer[r+3]=n}else this.buffer.push(e,t,i,n)}shift(e,t,i,n){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4);else{let r=e,{parser:s}=this.p;(n>this.pos||t<=s.maxNode)&&(this.pos=n,s.stateFlag(r,1)||(this.reducePos=n)),this.pushState(r,i),this.shiftContext(t,i),t<=s.maxNode&&this.buffer.push(t,i,n,4)}}apply(e,t,i,n){65536&e?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new r(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new o(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==i)return!1;if(!(65536&i))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let n,r=0;r1&t&&e==n)||i.push(t[e],n)}t=i}let i=[];for(let e=0;e>19,n=65535&t,r=this.stack.length-3*i;if(r<0||e.getGoto(this.stack[r],n,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,r)=>{if(!t.includes(n))return t.push(n),e.allActions(n,t=>{if(393216&t);else if(65536&t){let i=(t>>19)-r;if(i>1){let n=65535&t,r=this.stack.length-3*i;if(r>=0&&e.getGoto(this.stack[r],n,!1)>=0)return i<<19|65536|n}}else{let e=i(t,r+1);if(null!=e)return e}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class s{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class o{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,i=e>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class a{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new a(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new a(this.stack,this.pos,this.index)}}function l(e,t=Uint16Array){if("string"!=typeof e)return e;let i=null;for(let n=0,r=0;n=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,i=!0),s+=r,i)break;s*=46}i?i[r++]=s:i=new t(s)}return i}class u{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const c=new u;class d{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=c,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(n==this.ranges.length-1)return null;let e=this.ranges[++n];r+=e.from-i.to,i=e}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,i,n=this.chunkOff+e;if(n>=0&&n=this.chunk2Pos&&tn.to&&(this.chunk2=this.chunk2.slice(0,n.to-t)),i=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),i}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(null==i||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=c,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}}class h{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;f(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;h.prototype.fallback=h.prototype.extend=!1;function f(e,t,i,n,r,s){let o=0,a=1<0){let i=e[n];if(l.allows(i)&&(-1==t.token.value||t.token.value==i||g(i,t.token.value,r,s))){t.acceptToken(i);break}}let n=t.next,u=0,c=e[o+2];if(!(t.next<0&&c>u&&65535==e[i+3*c-3])){for(;u>1,s=i+r+(r<<1),a=e[s],l=e[s+1]||65536;if(n=l)){o=e[s+2],t.advance();continue e}u=r+1}}break}o=e[i+3*c-1]}}function p(e,t,i){for(let n,r=t;65535!=(n=e[r]);r++)if(n==i)return r-t;return-1}function g(e,t,i,n){let r=p(i,n,t);return r<0||p(i,n,e)t)&&!r.type.isError)return i<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(i<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return i<0?0:e.length}}class O{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?v(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?v(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof n.PH){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class w{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new u)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:r}=n,s=n.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let n=0;nu.end+25&&(a=Math.max(u.lookAhead,a)),0!=u.value)){let n=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!l.extend&&(i=u,t>n))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),i||e.pos!=this.stream.end||(i=new u,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new u,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:t}=i.p;for(let n=0;n=0&&i.p.parser.dialect.allows(r>>1)){1&r?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let t=0;t4*e.bufferLength?new O(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,i=this.stacks,n=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[e]=i;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;sn)r.push(o);else{if(this.advanceStack(o,r,i))continue;{e||(e=[],t=[]),e.push(o);let i=this.tokens.getMainToken(o);t.push(i.value,i.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let i of e){let e=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=e&&i.pos>e)&&i.p.parser.stateFlag(i.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,r);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort((e,t)=>t.score-e.score);r.length>e;)r.pop();r.some(e=>e.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let e=0;e500&&n.buffer.length>500){if(!((t.score-n.score||t.buffer.length-n.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(i--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let e=1;ethis.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,i=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?s.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(n.uY.contextHash)||0)==i))return e.useNode(o,r),!0;if(!(o instanceof n.PH)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof n.PH&&0==o.positions[0]))break;o=a}}let o=s.stateSlot(e.state,4);if(o>0)return e.reduce(o),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let n=0;nr?t.push(c):i.push(c)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return $(e,t),!0}}runRecovery(e,t,i){let n=null,r=!1;for(let s=0;s ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),this.advanceFully(o,i))continue}let c=o.split(),d=u;for(let e=0;c.forceReduce()&&e<10;e++){if(this.advanceFully(c,i))break;m&&(d=this.stackID(c)+" -> ")}for(let e of o.recoverByInsert(a))this.advanceFully(e,i);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),$(o,i)):(!n||n.scoree.topRules[t][1]),r=[];for(let e=0;e=0)s(n,e,t[i++]);else{let r=t[i+-n];for(let o=-n;o>0;o--)s(t[i++],e,r);i++}}}this.nodeSet=new n.fI(t.map((t,s)=>n.Z6.define({name:s>=this.minRepeatTerm?void 0:t,id:s,props:r[s],top:i.indexOf(s)>-1,error:0==s,skipped:e.skippedNodes&&e.skippedNodes.indexOf(s)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=n.cF;let o=l(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new h(o,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new y(this,e,t,i);for(let r of this.wrappers)n=r(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let r=n[t+1];;){let t=n[r++],s=1&t,o=n[r++];if(s&&i)return o;for(let i=r+(t>>1);r0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let i=this.stateSlot(e,1);null==n;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=k(this.data,i+2)}n=t(k(this.data,i+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=k(this.data,i+2)}if(!(1&this.data[i+2])){let e=this.data[i+1];t.some((t,i)=>1&i&&t==e)||t.push(this.data[i],e)}}return t}configure(e){let t=Object.assign(Object.create(x.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let i=e.tokenizers.find(e=>e.from==t);return i?i.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,n)=>{let r=e.specializers.find(e=>e.from==i.external);if(!r)return i;let s=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[n]=P(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let n of e.split(" ")){let e=t.indexOf(n);e>=0&&(i[e]=!0)}let n=null;for(let e=0;ee.external(i,n)<<1|t}return e.get}},1159:e=>{"use strict";e.exports=t},1269:e=>{"use strict";e.exports=i},1308:e=>{"use strict";e.exports=n},2007:e=>{"use strict";e.exports=r},2533:e=>{"use strict";e.exports=JSON.parse('{"id":"grafana-metricsdrilldown-app"}')},3241:e=>{"use strict";e.exports=s},3498:(e,t,i)=>{"use strict";i.d(t,{b:()=>n});const n={Trail:"trail",Drilldown:"drilldown"}},3781:(e,t,i)=>{"use strict";i.d(t,{I8:()=>y,kY:()=>$,Rk:()=>w,Ge:()=>p,$9:()=>m});var n=i(7781),r=i(8531);function s(e=[],t){if(!t.multi&&!t.includeAll)return function(e){if("string"!=typeof e)return e;if(r.config.featureToggles.prometheusSpecialCharsInLabelValues)return/^\w+(=|!=|=~|!~)".*"$/.test(e)?e:e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return e.replace(/\\/g,"\\\\").replace(/'/g,"\\\\'")}(e);if("string"==typeof e)return o(e);const i=e.map(e=>o(e));return 1===i.length?i[0]:"("+i.join("|")+")"}function o(e){return"string"!=typeof e?e:r.config.featureToggles.prometheusSpecialCharsInLabelValues?e.replace(/\\/g,"\\\\\\\\").replace(/"/g,'\\\\\\"').replace(/[$^*{}\[\]\'+?.()|]/g,"\\\\$&"):e.replace(/\\/g,"\\\\\\\\").replace(/[$^*{}\[\]+?.()|]/g,"\\\\$&")}var a=i(9851),l=i(8943),u=i(3498),c=i(8705);const d=new RegExp("([a-zA-Z_]\\w*)(>|<|!~|=~|!=|=)(.+)");var h=i(6538);const f="Grafana Metrics Drilldown",p=[{title:`Open in ${f}`,description:`Open current query in the ${f} view`,category:"metrics-drilldown",icon:"gf-prometheus",path:w(u.b.Drilldown),targets:[n.PluginExtensionPoints.DashboardPanelMenu,n.PluginExtensionPoints.ExploreToolbarAction,"grafana/alerting/alertingrule/queryeditor","grafana-assistant-app/navigateToDrilldown/v1"],configure:function(e){if(void 0===e)return;if("pluginId"in e&&"timeseries"!==e.pluginId)return;if(!e.targets.filter(S).length)return;return{path:g(e)||w(u.b.Drilldown)}}},{targets:["grafana-metricsdrilldown-app/grafana-assistant-app/navigateToDrilldown/v0-alpha"],title:"Navigate to metrics drilldown",description:"Build a url path to the metrics drilldown",path:w(u.b.Drilldown),configure:e=>{if(void 0===e)return;const{navigateToMetrics:t,datasource_uid:i,label_filters:n,metric:r,start:s,end:o}=e,a=function(e){if(!e)return[];return e.map(e=>{const t=function(e){const[,t,i,n]=e.match(d)||[,"","",""];return{key:t.trim(),value:n.replace(/['" ]/g,""),operator:i.trim()}}(e);return{label:t.key,op:t.operator,value:t.value}})}(n),l=v(i,a,r,s,o),c=t?O(l):void 0;return{path:w(u.b.Drilldown,c)}}}];function g(e){var t;if(void 0===e)return null;if("pluginId"in e&&"timeseries"!==e.pluginId)return null;const i=e.targets.filter(S);if(!i.length)return null;const n=i[0],o=(0,r.getTemplateSrv)(),a=o.replace(null===(t=n.datasource)||void 0===t?void 0:t.uid,e.scopedVars);if(!n.expr)return w(u.b.Drilldown);const l=o.replace(n.expr,e.scopedVars,s);try{const{metric:t,labels:i,hasErrors:n,errors:r}=m(l);n&&c.v.warn(`PromQL query has parsing errors: ${r.join(", ")}`);const s="timeRange"in e&&"object"==typeof e.timeRange&&null!=e.timeRange&&"from"in e.timeRange&&"to"in e.timeRange?e.timeRange:void 0,o=O(v(a,i,t,null==s?void 0:s.from,null==s?void 0:s.to));return w(u.b.Drilldown,o)}catch(e){return c.v.error(new Error(`[Metrics Drilldown] Error parsing PromQL query: ${e}`)),w(u.b.Drilldown)}}function m(e){const t=a.K3.parse(e);let i="";const n=[];let r=!1;const s=[];return t.iterate({enter:t=>{var o;if(t.type.isError||"⚠"===t.name){r=!0;const i=e.slice(t.from,t.to),n=i?`Parse error at position ${t.from}-${t.to}: "${i}"`:`Parse error at position ${t.from}`;s.push(n)}i||"Identifier"!==t.name||"VectorSelector"!==(null===(o=t.node.parent)||void 0===o?void 0:o.type.name)||(i=e.slice(t.from,t.to));const a=(0,h.W)(t,e);a&&n.push(a)}}),{metric:i,labels:n,hasErrors:r,errors:s}}function b(e){return[y.Filters,`${e.label}|${e.op}|${x(e.value)}`]}function v(e,t,i,n,r){return{datasource_uid:e,label_filters:null!=t?t:[],metric:i,start:n,end:r}}function O(e){const{metric:t,start:i,end:n,datasource_uid:r,label_filters:s}=e,o=null!=s?s:[];return $([[y.Metric,t],[y.TimeRangeFrom,i],[y.TimeRangeTo,n],[y.DatasourceId,r],...o.map(b)])}function w(e,t){const i=t?`?${t.toString()}`:"";return`${l.G}/${e}${i}`}const y={TimeRangeFrom:"from",TimeRangeTo:"to",Metric:"metric",DatasourceId:"var-ds",Filters:"var-filters"};function $(e,t){const i=new URLSearchParams(null==t?void 0:t.toString());return e.forEach(([e,t])=>{t&&i.append(e,t)}),i}function S(e){const{datasource:t}=e;return"prometheus"===(null==t?void 0:t.type)}function x(e){return null==e?"":/\|/g[Symbol.replace](e,"__gfp__")}},4440:(e,t,i)=>{"use strict";i.d(t,{UO:()=>u,aQ:()=>d,tS:()=>p});var n=i(8531),r=i(8705);function s(e,t,i,n,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,r)}function o(e){return function(){var t=this,i=arguments;return new Promise(function(n,r){var o=e.apply(t,i);function a(e){s(o,n,r,a,l,"next",e)}function l(e){s(o,n,r,a,l,"throw",e)}a(void 0)})}}function a(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const l=3e3,u=3..toFixed(0),c=/^grafana-[0-9a-z]+prometheus-datasource$/;function d(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&("prometheus"===e.type||c.test(e.type))&&"uid"in e&&"string"==typeof e.uid}class h{getHealthyDataSources(e,t=15){return o(function*(){const i=this.cache.get(e);if(null==i?void 0:i.length)return i;let n=this.pendingRequests.get(e);n||(n=this.fetchHealthyDataSources(e,t).finally(()=>{this.pendingRequests.delete(e)}),this.pendingRequests.set(e,n));const r=yield n;return this.cache.set(e,r),r}).call(this)}fetchHealthyDataSources(e,t){return o(function*(){const i=[...(0,n.getDataSourceSrv)().getList({logs:!0,type:e,filter:e=>"grafana"!==e.uid})].sort((e,t)=>e.isDefault&&!t.isDefault?-1:!e.isDefault&&t.isDefault?1:0).slice(0,t),s=[],a=[];return yield Promise.all(i.map(e=>o(function*(){try{const t=yield this.performHealthCheckWithTimeout(e.uid);"OK"===(null==t?void 0:t.status)?s.push(e):"TIMEOUT"!==(null==t?void 0:t.status)&&a.push(e)}catch(t){a.push(e)}}).call(this))),a.length>0&&r.v.warn(`Found ${a.length} unhealthy ${e} data sources: ${a.map(e=>e.name).join(", ")}`),s}).call(this)}performHealthCheckWithTimeout(e){return o(function*(){const t=new AbortController,i=setTimeout(()=>{t.abort()},l);try{const r=yield(0,n.getBackendSrv)().get(`/api/datasources/uid/${e}/health`,void 0,void 0,{showSuccessAlert:!1,showErrorAlert:!1,abortSignal:t.signal});return clearTimeout(i),r}catch(e){if(clearTimeout(i),e instanceof DOMException&&"AbortError"===e.name)return{status:"TIMEOUT"};throw e}})()}constructor(){a(this,"pendingRequests",new Map),a(this,"cache",new Map)}}let f;function p(){return f||(f=new h),f}},4696:(e,t,i)=>{"use strict";i.d(t,{u:()=>r});const n=[{regExp:/localhost/,environment:"local"},{regExp:/grafana-dev\.net/,environment:"dev"},{regExp:/grafana-ops\.net/,environment:"ops"},{regExp:/grafana\.net/,environment:"prod"}];function r(){var e,t;if(!(null===(t=window)||void 0===t||null===(e=t.location)||void 0===e?void 0:e.host))return null;const i=n.find(({regExp:e})=>e.test(window.location.host));return i?i.environment:null}},5176:(e,t,i)=>{"use strict";i.d(t,{t:()=>n});const n="cfd64bbd5e9f80228e546af4708b23bd6db18816"},5438:(e,t,i)=>{"use strict";var n;i.d(t,{$b:()=>n,HT:()=>s,Ic:()=>r}),function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.LOG="log",e.WARN="warn",e.ERROR="error"}(n||(n={}));const r=n.LOG,s=[n.TRACE,n.DEBUG,n.INFO,n.LOG,n.WARN,n.ERROR]},5959:e=>{"use strict";e.exports=o},6089:e=>{"use strict";e.exports=a},6538:(e,t,i)=>{"use strict";i.d(t,{M:()=>r,W:()=>o});var n=i(9851);function r(e){const t=n.K3.parse(e),i=new Set,r=t.cursor();do{if(r.type.is("VectorSelector")&&r.firstChild()){do{r.type.is("Identifier")&&s(e,r,i)}while(r.nextSibling());r.parent()}}while(r.next());return Array.from(i)}function s(e,t,i){const n=e.slice(t.from,t.to);n&&i.add(n)}function o(e,t){if("UnquotedLabelMatcher"!==e.name)return null;let i="",n="",r="";for(let s=e.node.firstChild;s;s=s.nextSibling)"LabelName"===s.type.name?i=t.slice(s.from,s.to):"MatchOp"===s.type.name?n=t.slice(s.from,s.to):"StringLiteral"===s.type.name&&(r=t.slice(s.from+1,s.to-1));return i&&n?{label:i,op:n,value:r}:null}},6660:function(e,t,i){var n;!function(r,s){"use strict";var o="function",a="undefined",l="object",u="string",c="major",d="model",h="name",f="type",p="vendor",g="version",m="architecture",b="console",v="mobile",O="tablet",w="smarttv",y="wearable",$="embedded",S="Amazon",x="Apple",k="ASUS",P="BlackBerry",T="Browser",E="Chrome",z="Firefox",A="Google",_="Huawei",Q="LG",U="Microsoft",I="Motorola",C="Opera",R="Samsung",X="Sharp",N="Sony",D="Xiaomi",L="Zebra",j="Facebook",M="Chromium OS",q="Mac OS",H=" Browser",F=function(e){for(var t={},i=0;i0?2===a.length?typeof a[1]==o?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:3===a.length?typeof a[1]!==o||a[1].exec&&a[1].test?this[a[0]]=c?c.replace(a[1],a[2]):s:this[a[0]]=c?a[1].call(this,c,a[2]):s:4===a.length&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):s):this[a]=c||s;d+=2}},Z=function(e,t){for(var i in t)if(typeof t[i]===l&&t[i].length>0){for(var n=0;n2&&(e[d]="iPad",e[f]=O),e},this.getEngine=function(){var e={};return e[h]=s,e[g]=s,Y.call(e,n,w.engine),e},this.getOS=function(){var e={};return e[h]=s,e[g]=s,Y.call(e,n,w.os),y&&!e[h]&&b&&b.platform&&"Unknown"!=b.platform&&(e[h]=b.platform.replace(/chrome os/i,M).replace(/macos/i,q)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===u&&e.length>500?W(e,500):e,this},this.setUA(n),this};J.VERSION="1.0.40",J.BROWSER=F([h,g,c]),J.CPU=F([m]),J.DEVICE=F([d,p,f,b,v,w,O,y,$]),J.ENGINE=J.OS=F([h,g]),typeof t!==a?(e.exports&&(t=e.exports=J),t.UAParser=J):i.amdO?(n=function(){return J}.call(t,i,t,e))===s||(e.exports=n):typeof r!==a&&(r.UAParser=J);var ee=typeof r!==a&&(r.jQuery||r.Zepto);if(ee&&!ee.ua){var te=new J;ee.ua=te.getResult(),ee.ua.get=function(){return te.getUA()},ee.ua.set=function(e){te.setUA(e);var t=te.getResult();for(var i in t)ee.ua[i]=t[i]}}}("object"==typeof window?window:this)},7203:(e,t,i)=>{"use strict";i.d(t,{PH:()=>p,Qj:()=>f,Z6:()=>u,cF:()=>n,fI:()=>c,iX:()=>Q,uY:()=>o});const n=1024;let r=0;class s{constructor(e,t){this.from=e,this.to=t}}class o{constructor(e={}){this.id=r++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=u.match(e)),t=>{let i=e(t);return void 0===i?null:[this,i]}}}o.closedBy=new o({deserialize:e=>e.split(" ")}),o.openedBy=new o({deserialize:e=>e.split(" ")}),o.group=new o({deserialize:e=>e.split(" ")}),o.isolate=new o({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),o.contextHash=new o({perNode:!0}),o.lookAhead=new o({perNode:!0}),o.mounted=new o({perNode:!0});class a{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[o.mounted.id]}}const l=Object.create(null);class u{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):l,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new u(e.name||"",t,e.id,i);if(e.props)for(let i of e.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[i[0].id]=i[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(o.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return e=>{for(let i=e.prop(o.group),n=-1;n<(i?i.length:0);n++){let r=t[n<0?e.name:i[n]];if(r)return r}}}}u.none=new u("",Object.create(null),0,8);class c{constructor(e){this.types=e;for(let t=0;t=t){let o=new w(s.tree,s.overlay[0].from+e.from,-1,e);(r||(r=[n])).push(v(o,t,i,!1))}}return r?k(r):n}(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:r=this.length}=e,s=e.mode||0,o=(s&f.IncludeAnonymous)>0;for(let e=this.cursor(s|f.IncludeAnonymous);;){let s=!1;if(e.from<=r&&e.to>=n&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&i&&(o||!e.type.isAnonymous)&&i(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:_(u.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,i)=>new p(this.type,e,t,i,this.propValues),e.makeTree||((e,t,i)=>new p(u.none,e,t,i)))}static build(e){return function(e){var t;let{buffer:i,nodeSet:r,maxBufferLength:s=n,reused:a=[],minRepeatType:l=r.types.length}=e,u=Array.isArray(i)?new g(i,i.length):i,c=r.types,d=0,h=0;function f(e,t,i,n,o,p){let{id:g,start:S,end:x,size:k}=u,P=h,T=d;if(k<0){if(u.next(),-1==k){let t=a[g];return i.push(t),void n.push(S-e)}if(-3==k)return void(d=g);if(-4==k)return void(h=g);throw new RangeError(`Unrecognized record size: ${k}`)}let E,z,A=c[g],Q=S-e;if(x-S<=s&&(z=y(u.pos-t,o))){let t=new Uint16Array(z.size-z.skip),i=u.pos-z.size,n=t.length;for(;u.pos>i;)n=$(z.start,t,n);E=new m(t,x-z.start,r),Q=z.start-e}else{let e=u.pos-k;u.next();let t=[],i=[],n=g>=l?g:-1,r=0,o=x;for(;u.pos>e;)n>=0&&u.id==n&&u.size>=0?(u.end<=o-s&&(O(t,i,S,r,u.end,o,n,P,T),r=t.length,o=u.end),u.next()):p>2500?b(S,e,t,i):f(S,e,t,i,n,p+1);if(n>=0&&r>0&&r-1&&r>0){let e=v(A,T);E=_(A,t,i,0,t.length,0,x-S,e,e)}else E=w(A,t,i,x-S,P-x,T)}i.push(E),n.push(Q)}function b(e,t,i,n){let o=[],a=0,l=-1;for(;u.pos>t;){let{id:e,start:t,end:i,size:n}=u;if(n>4)u.next();else{if(l>-1&&t=0;e-=3)t[i++]=o[e],t[i++]=o[e+1]-s,t[i++]=o[e+2]-s,t[i++]=i;i.push(new m(t,o[2]-s,r)),n.push(s-e)}}function v(e,t){return(i,n,r)=>{let s,a,l=0,u=i.length-1;if(u>=0&&(s=i[u])instanceof p){if(!u&&s.type==e&&s.length==r)return s;(a=s.prop(o.lookAhead))&&(l=n[u]+s.length+a)}return w(e,i,n,r,l,t)}}function O(e,t,i,n,s,o,a,l,u){let c=[],d=[];for(;e.length>n;)c.push(e.pop()),d.push(t.pop()+i-s);e.push(w(r.types[a],c,d,o-s,l-o,u)),t.push(s-i)}function w(e,t,i,n,r,s,a){if(s){let e=[o.contextHash,s];a=a?[e].concat(a):[e]}if(r>25){let e=[o.lookAhead,r];a=a?[e].concat(a):[e]}return new p(e,t,i,n,a)}function y(e,t){let i=u.fork(),n=0,r=0,o=0,a=i.end-s,c={size:0,start:0,skip:0};e:for(let s=i.pos-e;i.pos>s;){let e=i.size;if(i.id==t&&e>=0){c.size=n,c.start=r,c.skip=o,o+=4,n+=4,i.next();continue}let u=i.pos-e;if(e<0||u=l?4:0,h=i.start;for(i.next();i.pos>u;){if(i.size<0){if(-3!=i.size)break e;d+=4}else i.id>=l&&(d+=4);i.next()}r=h,n+=e,o+=d}return(t<0||n==e)&&(c.size=n,c.start=r,c.skip=o),c.size>4?c:void 0}function $(e,t,i){let{id:n,start:r,end:s,size:o}=u;if(u.next(),o>=0&&n4){let n=u.pos-(o-4);for(;u.pos>n;)i=$(e,t,i)}t[--i]=a,t[--i]=s-e,t[--i]=r-e,t[--i]=n}else-3==o?d=n:-4==o&&(h=n);return i}let S=[],x=[];for(;u.pos>0;)f(e.start||0,e.bufferStart||0,S,x,-1,0);let k=null!==(t=e.length)&&void 0!==t?t:S.length?x[0]+S[0].length:0;return new p(c[e.topID],S.reverse(),x.reverse(),k)}(e)}}p.empty=new p(u.none,[],[],0);class g{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new g(this.buffer,this.index)}}class m{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return u.none}toString(){let e=[];for(let t=0;t0));a=s[a+3]);return o}slice(e,t,i){let n=this.buffer,r=new Uint16Array(t-e),s=0;for(let o=e,a=0;o=t&&it;case 1:return i<=t&&n>t;case 2:return n>t;case 4:return!0}}function v(e,t,i,n){for(var r;e.from==e.to||(i<1?e.from>=t:e.from>t)||(i>-1?e.to<=t:e.to0?o.length:-1;e!=u;e+=t){let u=o[e],c=l[e]+s.from;if(b(n,i,c,c+u.length))if(u instanceof m){if(r&f.ExcludeBuffers)continue;let o=u.findChild(0,u.buffer.length,t,i-c,n);if(o>-1)return new x(new S(s,u,e,c),null,o)}else if(r&f.IncludeAnonymous||!u.type.isAnonymous||E(u)){let o;if(!(r&f.IgnoreMounts)&&(o=a.get(u))&&!o.overlay)return new w(o.tree,c,e,s);let l=new w(u,c,e,s);return r&f.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?u.children.length-1:0,t,i,n)}}if(r&f.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let n;if(!(i&f.IgnoreOverlays)&&(n=a.get(this._tree))&&n.overlay){let i=e-this.from;for(let{from:e,to:r}of n.overlay)if((t>0?e<=i:e=i:r>i))return new w(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function y(e,t,i,n){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(null!=i)for(let e=!1;!e;)if(e=r.type.is(i),!r.nextSibling())return s;for(;;){if(null!=n&&r.type.is(n))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return null==n?s:[]}}function $(e,t,i=t.length-1){for(let n=e;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[i]&&t[i]!=n.name)return!1;i--}}return!0}class S{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class x extends O{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new x(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&f.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new x(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new x(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new x(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let s=i.buffer[this.index+1];e.push(i.slice(n,r,s)),t.push(0)}return new p(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function k(e){if(!e.length)return null;let t=0,i=e[0];for(let n=1;ni.from||r.to0){if(this.index-1)for(let n=t+e,r=e<0?-1:i._tree.children.length;n!=r;n+=e){let e=i._tree.children[n];if(this.mode&f.IncludeAnonymous||e instanceof m||!e.type.isAnonymous||E(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,i=r+1;break e}n=this.stack[--r]}for(let e=i;e=0;r--){if(r<0)return $(this._tree,e,n);let s=i[t.buffer[this.stack[r]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function E(e){return e.children.some(e=>e instanceof m||!e.type.isAnonymous||E(e))}const z=new WeakMap;function A(e,t){if(!e.isAnonymous||t instanceof m||t.type!=e)return 1;let i=z.get(t);if(null==i){i=1;for(let n of t.children){if(n.type!=e||!(n instanceof p)){i=1;break}i+=A(e,n)}z.set(t,i)}return i}function _(e,t,i,n,r,s,o,a,l){let u=0;for(let i=n;i=c)break;p+=t}if(u==r+1){if(p>c){let e=i[r];t(e.children,e.positions,0,e.children.length,n[r]+a);continue}d.push(i[r])}else{let t=n[u-1]+i[u-1].length-f;d.push(_(e,i,n,r,u,f,t,null,l))}h.push(f+a-s)}}(t,i,n,r,0),(a||l)(d,h,o)}class Q{startParse(e,t,i){return"string"==typeof e&&(e=new U(e)),i=i?i.length?i.map(e=>new s(e.from,e.to)):[new s(0,0)]:[new s(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let e=n.advance();if(e)return e}}}class U{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new o({perNode:!0})},7781:e=>{"use strict";e.exports=l},8398:e=>{"use strict";e.exports=u},8531:e=>{"use strict";e.exports=c},8705:(e,t,i)=>{"use strict";i.d(t,{v:()=>f});var n=i(5438),r=i(9914),s=i(4696);function o(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function a(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function l(e,t,i){return function(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}(e,a(e,t,"set"),i),i}function u(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}var c=new WeakMap,d=new WeakSet;function h(e,t){var i;"prod"!==function(e,t){return t.get?t.get.call(e):t.value}(i=this,a(i,c,"get"))&&console[e](...t)}const f=new class{trace(){var e;u(this,d,h).call(this,"trace",[]),null===(e=(0,r.n1)())||void 0===e||e.api.pushLog([],{level:n.$b.TRACE})}debug(...e){var t;u(this,d,h).call(this,"debug",e),null===(t=(0,r.n1)())||void 0===t||t.api.pushLog(e,{level:n.$b.DEBUG})}info(...e){var t;u(this,d,h).call(this,"info",e),null===(t=(0,r.n1)())||void 0===t||t.api.pushLog(e,{level:n.$b.INFO})}log(...e){var t;u(this,d,h).call(this,"log",e),null===(t=(0,r.n1)())||void 0===t||t.api.pushLog(e,{level:n.$b.LOG})}warn(...e){var t;u(this,d,h).call(this,"warn",e),null===(t=(0,r.n1)())||void 0===t||t.api.pushLog(e,{level:n.$b.WARN})}error(e,t){var i;u(this,d,h).call(this,"error",[e]),t&&u(this,d,h).call(this,"error",["Error context",t]),null===(i=(0,r.n1)())||void 0===i||i.api.pushError(e,{context:t})}constructor(){var e,t;o(e=this,t=d),t.add(e),function(e,t,i){o(e,t),t.set(e,i)}(this,c,{writable:!0,value:void 0}),l(this,c,(0,s.u)())}}},8943:(e,t,i)=>{"use strict";i.d(t,{G:()=>s,s:()=>r});var n=i(2533);const r=n.id,s=`/a/${n.id}`},9851:(e,t,i)=>{"use strict";i.d(t,{K3:()=>U});var n=i(782),r=i(7203);let s=0;class o{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=s++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i="string"==typeof e?e:"?";if(e instanceof o&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let n=new o(i,[],null,[]);if(n.set.push(n),t)for(let e of t.set)n.set.push(e);return n}static defineModifier(e){let t=new l(e);return e=>e.modified.indexOf(t)>-1?e:l.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let a=0;class l{constructor(e){this.name=e,this.instances=[],this.id=a++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(i=>{return i.base==e&&(n=t,r=i.modified,n.length==r.length&&n.every((e,t)=>e==r[t]));var n,r});if(i)return i;let n=[],r=new o(e.name,n,e,t);for(let e of t)e.instances.push(r);let s=function(e){let t=[[]];for(let i=0;it.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)n.push(l.get(t,e));return r}}const u=new r.uY;class c{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depthT[e.toLowerCase()]||-1,z={avg:8,atan2:7,bottomk:9,count:10,count_values:11,group:12,max:13,min:14,quantile:15,limitk:16,limit_ratio:17,stddev:18,stdvar:19,sum:20,topk:21,by:22,without:23,and:24,or:25,unless:26,start:27,end:28},A=(e,t)=>z[e.toLowerCase()]||-1,_=function(e){let t=Object.create(null);for(let i in e){let n=e[i];Array.isArray(n)||(n=[n]);for(let e of i.split(" "))if(e){let i=[],r=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){r=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!n)throw new RangeError("Invalid path: "+e);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),t+=n[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);s=e.slice(t)}let o=i.length-1,a=i[o];if(!a)throw new RangeError("Invalid path: "+e);let l=new c(n,r,o>0?i.slice(0,o):null);t[a]=l.sort(t[a])}}return u.add(t)}({LineComment:P.comment,LabelName:P.labelName,StringLiteral:P.string,NumberDurationLiteral:P.number,NumberDurationLiteralInDurationContext:P.number,Identifier:P.variableName,"Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramAvg HistogramCount HistogramFraction HistogramQuantile HistogramSum DoubleExponentialSmoothing Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year":P.function(P.variableName),"Avg Bottomk Count Count_values Group LimitK LimitRatio Max Min Quantile Stddev Stdvar Sum Topk":P.operatorKeyword,"By Without Bool On Ignoring GroupLeft GroupRight Offset Start End":P.modifier,"And Unless Or":P.logicOperator,"Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At":P.operator,UnaryOp:P.arithmeticOperator,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,"⚠":P.invalid}),Q={__proto__:null,absent_over_time:341,absent:343,abs:345,acos:347,acosh:349,asin:351,asinh:353,atan:355,atanh:357,avg_over_time:359,ceil:361,changes:363,clamp:365,clamp_max:367,clamp_min:369,cos:371,cosh:373,count_over_time:375,days_in_month:377,day_of_month:379,day_of_week:381,day_of_year:383,deg:385,delta:387,deriv:389,exp:391,floor:393,histogram_count:395,histogram_fraction:397,histogram_quantile:399,histogram_stddev:401,histogram_stdvar:403,histogram_sum:405,histogram_avg:407,double_exponential_smoothing:409,hour:411,idelta:413,increase:415,info:417,irate:419,label_replace:421,label_join:423,last_over_time:425,ln:427,log10:429,log2:431,mad_over_time:433,max_over_time:435,min_over_time:437,ts_of_max_over_time:439,ts_of_min_over_time:441,ts_of_last_over_time:443,minute:445,month:447,pi:449,predict_linear:451,present_over_time:453,quantile_over_time:455,rad:457,rate:459,resets:461,round:463,scalar:465,sgn:467,sin:469,sinh:471,sort:473,sort_desc:475,sort_by_label:477,sort_by_label_desc:479,sqrt:481,stddev_over_time:483,stdvar_over_time:485,sum_over_time:487,tan:489,tanh:491,timestamp:493,time:495,vector:497,year:499},U=n.U1.deserialize({version:14,states:"9tOYQPOOO'}QPOOOOQO'#C|'#C|O(SQPO'#C{Q(_QQOOOOQO'#De'#DeO(YQPO'#DdOOQO'#F]'#F]O)lQPO'#FbOYQPO'#F_OYQPO'#FaO0jQSO'#FdO0uQQO'#FcOOQO'#Fc'#FcOOQO'#Fw'#FwOOQO'#Df'#DfOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOOQO'#Dm'#DmOOQO'#Dn'#DnOOQO'#Do'#DoOOQO'#Dp'#DpOOQO'#Dq'#DqOOQO'#Dr'#DrOOQO'#Ds'#DsOOQO'#Dt'#DtOOQO'#Du'#DuOOQO'#Dv'#DvOOQO'#Dw'#DwOOQO'#Dx'#DxOOQO'#Dy'#DyOOQO'#Dz'#DzOOQO'#D{'#D{OOQO'#D|'#D|OOQO'#D}'#D}OOQO'#EO'#EOOOQO'#EP'#EPOOQO'#EQ'#EQOOQO'#ER'#EROOQO'#ES'#ESOOQO'#ET'#ETOOQO'#EU'#EUOOQO'#EV'#EVOOQO'#EW'#EWOOQO'#EX'#EXOOQO'#EY'#EYOOQO'#EZ'#EZOOQO'#E['#E[OOQO'#E]'#E]OOQO'#E^'#E^OOQO'#E_'#E_OOQO'#E`'#E`OOQO'#Ea'#EaOOQO'#Eb'#EbOOQO'#Ec'#EcOOQO'#Ed'#EdOOQO'#Ee'#EeOOQO'#Ef'#EfOOQO'#Eg'#EgOOQO'#Eh'#EhOOQO'#Ei'#EiOOQO'#Ej'#EjOOQO'#Ek'#EkOOQO'#El'#ElOOQO'#Em'#EmOOQO'#En'#EnOOQO'#Eo'#EoOOQO'#Ep'#EpOOQO'#Eq'#EqOOQO'#Er'#ErOOQO'#Es'#EsOOQO'#Et'#EtOOQO'#Eu'#EuOOQO'#Ev'#EvOOQO'#Ew'#EwOOQO'#Ex'#ExOOQO'#Ey'#EyOOQO'#Ez'#EzOOQO'#E{'#E{OOQO'#E|'#E|OOQO'#E}'#E}OOQO'#FO'#FOOOQO'#FP'#FPOOQO'#FQ'#FQOOQO'#FR'#FROOQO'#FS'#FSOOQO'#FT'#FTOOQO'#FU'#FUOOQO'#FV'#FVOOQO'#FW'#FWOOQO'#FX'#FXOOQO'#FY'#FYQOQPOOO2`QPO'#C}O2eQPO'#DSO(YQPO,59gO2lQQO,59gO4YQPO,59oO4YQPO,59oO4YQPO,59oO4YQPO,59oO4YQPO,59oO;WQPO,5;uO;WQPO,5;xO;iQPO,5ZQPO,5cQSO'#DOOOQO,59i,59iOOQO,59n,59nO>nQQO,59nOOQO1G/R1G/ROOQO'#DV'#DVO2`QPO'#DWOOQO'#F{'#F{O>xQPO'#F{OYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOYQPO1G/ZOOQO'#F['#F[OEsQPO'#F[OFOQSO1G1aOOQO1G1d1G1dOFWQPO'#F]OOQO'#Fm'#FmOOQO1G1q1G1qOFcQPO1G1qOOQO1G1e1G1eOOQO'#Ff'#FfOFhQPO,5E(e)<<1,external:E},{term:57,get:(e,t)=>A(e)<<1|1,external:A,extend:!0},{term:57,get:e=>Q[e]||-1}],tokenPrec:0})},9914:(e,t,i)=>{"use strict";var n;i.d(t,{n1:()=>Sn,Js:()=>En,gu:()=>Tn}),function(e){e.EXCEPTION="exception",e.LOG="log",e.MEASUREMENT="measurement",e.TRACE="trace",e.EVENT="event"}(n||(n={}));const r={[n.EXCEPTION]:"exceptions",[n.LOG]:"logs",[n.MEASUREMENT]:"measurements",[n.TRACE]:"traces",[n.EVENT]:"events"};function s(e,t){return typeof e===t}function o(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function a(e,t){try{return e instanceof t}catch(e){return!1}}const l=e=>s(e,"null"),u=e=>s(e,"string"),c=e=>s(e,"number")&&!isNaN(e)||s(e,"bigint"),d=e=>s(e,"boolean"),h=e=>!l(e)&&s(e,"object"),f=e=>s(e,"function"),p=e=>o(e,"Array"),g="undefined"!=typeof Event,m="undefined"!=typeof Error,b=e=>m&&a(e,Error);function v(e){return null==e||(p(e)||u(e)?0===e.length:!!h(e)&&0===Object.keys(e).length)}function O(e={}){return JSON.stringify(null!=e?e:{},function(){const e=new WeakSet;return function(t,i){if(h(i)&&null!==i){if(e.has(i))return null;e.add(i)}return i}}())}function w(e={}){const t={};for(const[i,n]of Object.entries(e))t[i]=h(n)&&null!==n?O(n):String(n);return t}function y(){return Date.now()}function $(){return(new Date).toISOString()}function S(e){return new Date(e).toISOString()}function x(e,t){if(e===t)return!0;if(s(e,"number")&&isNaN(e))return s(t,"number")&&isNaN(t);const i=p(e),n=p(t);if(i!==n)return!1;if(i&&n){const i=e.length;if(i!==t.length)return!1;for(let n=i;0!==n--;)if(!x(e[n],t[n]))return!1;return!0}const r=h(e),o=h(t);if(r!==o)return!1;if(e&&t&&r&&o){const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(let e of i)if(!n.includes(e))return!1;for(let n of i)if(!x(e[n],t[n]))return!1;return!0}return!1}class k{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t!==e)}notify(e){this.subscribers.forEach(t=>t(e))}first(){const e=new k,t=t=>{e.notify(t),i.unsubscribe()},i=this.subscribe(t),n=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,n,t)}takeWhile(e){const t=new k,i=n=>{e(n)?t.notify(n):t.unsubscribe(i)};this.subscribe(i);const n=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,n,i)}filter(e){const t=new k,i=i=>{e(i)&&t.notify(i)};this.subscribe(i);const n=t.unsubscribe.bind(t);return this.withUnsubscribeOverride(t,n,i)}merge(...e){const t=new k,i=[];e.forEach(e=>{const n=e.subscribe(e=>{t.notify(e)});i.push(n)});const n=t.unsubscribeAll.bind(t);return t.unsubscribe=()=>{i.forEach(e=>e.unsubscribe()),n()},t}withUnsubscribeOverride(e,t,i){return e.unsubscribe=e=>{t(e),this.unsubscribe(i)},e}unsubscribeAll(){this.subscribers=[]}}const P="faroApiCall",T="user_action_start",E={Normal:"normal",Critical:"critical"};var z;!function(e){e[e.Started=0]="Started",e[e.Halted=1]="Halted",e[e.Cancelled=2]="Cancelled",e[e.Ended=3]="Ended"}(z||(z={}));const A="undefined"!=typeof globalThis?globalThis:void 0!==i.g?i.g:"undefined"!=typeof self?self:void 0;const _="_faroInternal";let Q={};function U(e,t,i,n,r,s,o){return t.debug("Initializing Faro"),Q={api:s,config:i,instrumentations:o,internalLogger:t,metas:n,pause:r.pause,transports:r,unpatchedConsole:e,unpause:r.unpause},function(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(A,_,{configurable:!1,enumerable:!1,writable:!1,value:e}))}(Q),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in A)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(A,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(Q),Q}const I="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function C(e=10){return Array.from(Array(e)).map(()=>I[Math.floor(59*Math.random())]).join("")}class R{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(f(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}class X extends k{constructor({name:e,parentId:t,trigger:i,transports:n,attributes:r,trackUserActionsExcludeItem:s,importance:o=E.Normal}){super(),this.name=e,this.attributes=r,this.id=C(),this.trigger=i,this.parentId=null!=t?t:this.id,this.trackUserActionsExcludeItem=s,this.importance=o,this._itemBuffer=new R,this._transports=n,this._state=z.Started,this._start()}addItem(e){return this._state===z.Started&&(this._itemBuffer.addItem(e),!0)}_start(){this._state=z.Started,this._state===z.Started&&(this.startTime=y())}halt(){this._state===z.Started&&(this._state=z.Halted,this.notify(this._state))}cancel(){this._state===z.Started&&this._itemBuffer.flushBuffer(),this._state=z.Cancelled,this.notify(this._state)}end(){if(this._state===z.Cancelled)return;const e=y(),t=e-this.startTime;this._state=z.Ended,this._itemBuffer.flushBuffer(e=>{if(function(e,t){return(null==t?void 0:t(e))||e.type===n.MEASUREMENT&&"web-vitals"===e.payload.type}(e,this.trackUserActionsExcludeItem))return void this._transports.execute(e);const t=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{action:{parentId:this.id,name:this.name}})});this._transports.execute(t)}),this._state=z.Ended,this.notify(this._state),Q.api.pushEvent("faro.user.action",Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:e.toString(),userActionDuration:t.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},w(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:e=>(e.action={id:this.id,name:this.name},e)})}getState(){return this._state}}const N=new k;function D(e,t){if(!e)return!1;return(null==e?void 0:e.getState())===z.Started&&(e.addItem(t),!0)}const L="Error",j=e=>e.map(e=>h(e)?O(e):String(e)).join(" ");let M;function q({internalLogger:e,config:t,metas:i,transports:r,tracesApi:s,userActionsApi:o}){var a;e.debug("Initializing exceptions API");let c=null;M=null!==(a=t.parseStacktrace)&&void 0!==a?a:M;const d=t=>{e.debug("Changing stacktrace parser"),M=null!=t?t:M},{ignoreErrors:f=[],preserveOriginalError:g}=t;return d(t.parseStacktrace),{changeStacktraceParser:d,getStacktraceParser:()=>M,pushError:(a,{skipDedupe:d,stackFrames:m,type:y,context:k,spanContext:P,timestampOverwriteMs:T,originalError:E}={})=>{if(!function(e,t){const{message:i,name:n,stack:r}=t;return s=e,o=i+" "+n+" "+r,s.some(e=>u(e)?o.includes(e):!!o.match(e));var s,o}(f,null!=E?E:a))try{const u=w(Object.assign(Object.assign({},function(e){let t=e.cause;b(t)?t=e.cause.toString():null!==t&&(h(e.cause)||p(e.cause))?t=O(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(null!=E?E:a)),null!=k?k:{})),f={meta:i.value,payload:Object.assign(Object.assign({type:y||a.name||L,value:a.message,timestamp:T?S(T):$(),trace:P?{trace_id:P.traceId,span_id:P.spanId}:s.getTraceContext()},v(u)?{}:{context:u}),g?{originalError:E}:{}),type:n.EXCEPTION};(null==(m=null!=m?m:a.stack?null==M?void 0:M(a).frames:void 0)?void 0:m.length)&&(f.payload.stacktrace={frames:m});const z={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};if(!d&&t.dedupe&&!l(c)&&x(z,c))return void e.debug("Skipping error push because it is the same as the last one\n",f.payload);c=z,e.debug("Pushing exception\n",f),D(o.getActiveUserAction(),f)||r.execute(f)}catch(t){e.error("Error pushing event",t)}}}}var H=i(5438);const F=e=>e.map(e=>{try{return String(e)}catch(e){return""}}).join(" ");function B(e,t,i,r,s){t.debug("Initializing API");const o=function({transports:e,internalLogger:t,config:i}){var n;const r=null===(n=i.userActionsInstrumentation)||void 0===n?void 0:n.excludeItem;let s;const o=()=>s,a={startUserAction:(i,n,a)=>{if(void 0===o()){const t=new X({name:i,transports:e,attributes:n,trigger:(null==a?void 0:a.triggerName)||P,importance:(null==a?void 0:a.importance)||E.Normal,trackUserActionsExcludeItem:r});return t.filter(e=>[z.Ended,z.Cancelled].includes(e)).first().subscribe(()=>{s=void 0}),N.notify({type:T,userAction:t}),s=t,s}t.error("Attempted to create a new user action while one is already running. This is not possible.")},getActiveUserAction:o};return a}({transports:s,config:i,internalLogger:t}),a=function(e,t,i,r,s){let o;return t.debug("Initializing traces API"),{getOTEL:()=>o,getTraceContext:()=>{const e=null==o?void 0:o.trace.getSpanContext(o.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,i)=>{t.debug("Initializing OpenTelemetry"),o={trace:e,context:i}},isOTELInitialized:()=>!!o,pushTraces:e=>{try{const i={type:n.TRACE,payload:e,meta:r.value};t.debug("Pushing trace\n",i),s.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,s),c={unpatchedConsole:e,internalLogger:t,userActionsApi:o,config:i,metas:r,transports:s,tracesApi:a};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),q(c)),function({internalLogger:e,metas:t}){let i,n,r,s;e.debug("Initializing meta API");const o=e=>{n&&t.remove(n),n={user:e},t.add(n)},a=(e,n)=>{var r;const s=null==n?void 0:n.overrides,o=s?{overrides:Object.assign(Object.assign({},null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.overrides),s)}:{};i&&t.remove(i),i={session:Object.assign(Object.assign({},v(e)?void 0:e),o)},t.add(i)},l=()=>t.value.session,c=()=>t.value.page;return{setUser:o,resetUser:o,setSession:a,resetSession:a,getSession:l,setView:(e,i)=>{var n;if((null==i?void 0:i.overrides)&&a(l(),{overrides:i.overrides}),(null===(n=null==r?void 0:r.view)||void 0===n?void 0:n.name)===(null==e?void 0:e.name))return;const s=r;r={view:e},t.add(r),s&&t.remove(s)},getView:()=>t.value.view,setPage:e=>{var i;const n=u(e)?Object.assign(Object.assign({},null!==(i=null==s?void 0:s.page)&&void 0!==i?i:c()),{id:e}):e;s&&t.remove(s),s={page:n},t.add(s)},getPage:c}}(c)),function({internalLogger:e,config:t,metas:i,transports:r,tracesApi:s,userActionsApi:o}){var a;e.debug("Initializing logs API");let u=null;const c=null!==(a=t.logArgsSerializer)&&void 0!==a?a:F;return{pushLog:(a,{context:d,level:h,skipDedupe:f,spanContext:p,timestampOverwriteMs:g}={})=>{try{const m=w(d),b={type:n.LOG,payload:{message:c(a),level:null!=h?h:H.Ic,context:v(m)?void 0:m,timestamp:g?S(g):$(),trace:p?{trace_id:p.traceId,span_id:p.spanId}:s.getTraceContext()},meta:i.value},O={message:b.payload.message,level:b.payload.level,context:b.payload.context};if(!f&&t.dedupe&&!l(u)&&x(O,u))return void e.debug("Skipping log push because it is the same as the last one\n",b.payload);u=O,e.debug("Pushing log\n",b),D(o.getActiveUserAction(),b)||r.execute(b)}catch(t){e.error("Error pushing log\n",t)}}}}(c)),function({internalLogger:e,config:t,metas:i,transports:r,tracesApi:s,userActionsApi:o}){e.debug("Initializing measurements API");let a=null;return{pushMeasurement:(u,{skipDedupe:c,context:d,spanContext:h,timestampOverwriteMs:f}={})=>{try{const p=w(d),g={type:n.MEASUREMENT,payload:Object.assign(Object.assign({},u),{trace:h?{trace_id:h.traceId,span_id:h.spanId}:s.getTraceContext(),timestamp:f?S(f):$(),context:v(p)?void 0:p}),meta:i.value},m={type:g.payload.type,values:g.payload.values,context:g.payload.context};if(!c&&t.dedupe&&!l(a)&&x(m,a))return void e.debug("Skipping measurement push because it is the same as the last one\n",g.payload);a=m,e.debug("Pushing measurement\n",g),D(o.getActiveUserAction(),g)||r.execute(g)}catch(t){e.error("Error pushing measurement\n",t)}}}}(c)),function({internalLogger:e,config:t,metas:i,transports:r,tracesApi:s,userActionsApi:o}){let a=null;return{pushEvent:(u,c,d,{skipDedupe:h,spanContext:f,timestampOverwriteMs:p,customPayloadTransformer:g=e=>e}={})=>{try{const m=w(c),b={meta:i.value,payload:g({name:u,domain:null!=d?d:t.eventDomain,attributes:v(m)?void 0:m,timestamp:p?S(p):$(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:s.getTraceContext()}),type:n.EVENT},O={name:b.payload.name,attributes:b.payload.attributes,domain:b.payload.domain};if(!h&&t.dedupe&&!l(a)&&x(O,a))return void e.debug("Skipping event push because it is the same as the last one\n",b.payload);a=O,e.debug("Pushing event\n",b),D(o.getActiveUserAction(),b)||r.execute(b)}catch(t){e.error("Error pushing event",t)}}}}(c)),o)}function V(){}var W;!function(e){e[e.OFF=0]="OFF",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE"}(W||(W={}));const Y={debug:V,error:V,info:V,prefix:"Faro",warn:V},Z=W.ERROR,G=Object.assign({},console);function K(e=G,t=Z){const i=Y;return t>W.OFF&&(i.error=t>=W.ERROR?function(...t){e.error(`${i.prefix}\n`,...t)}:V,i.warn=t>=W.WARN?function(...t){e.warn(`${i.prefix}\n`,...t)}:V,i.info=t>=W.INFO?function(...t){e.info(`${i.prefix}\n`,...t)}:V,i.debug=t>=W.VERBOSE?function(...t){e.debug(`${i.prefix}\n`,...t)}:V),i}let J=Y;function ee(e,t){return J=K(e,t.internalLoggerLevel),J}const te="2.0.2";class ie{constructor(e,t){var i,n;this.signalBuffer=[],this.itemLimit=null!==(i=null==t?void 0:t.itemLimit)&&void 0!==i?i:50,this.sendTimeout=null!==(n=null==t?void 0:t.sendTimeout)&&void 0!==n?n:250,this.paused=(null==t?void 0:t.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.flush()})}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval(()=>this.flush(),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const t=new Map;return e.forEach(e=>{const i=JSON.stringify(e.meta);let n=t.get(i);n=void 0===n?[e]:[...n,e],t.set(i,n)}),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}function ne(e,t,i,n){var r;t.debug("Initializing transports");const s=[];let o=i.paused,a=[];const l=e=>{let t=e;for(const e of a){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=re(n,i)}return t},u=e=>{const i=l(e);if(0!==i.length)for(const e of s)t.debug(`Transporting item using ${e.name}\n`,i),e.isBatched()&&e.send(i)};let c;(null===(r=i.batching)||void 0===r?void 0:r.enabled)&&(c=new ie(u,{sendTimeout:i.batching.sendTimeout,itemLimit:i.batching.itemLimit,paused:o}));return{add:(...r)=>{t.debug("Adding transports"),r.forEach(r=>{t.debug(`Adding "${r.name}" transport`);s.some(e=>e===r)?t.warn(`Transport ${r.name} is already added`):(r.unpatchedConsole=e,r.internalLogger=t,r.config=i,r.metas=n,s.push(r))})},addBeforeSendHooks:(...e)=>{t.debug("Adding beforeSendHooks\n",a),e.forEach(e=>{e&&a.push(e)})},getBeforeSendHooks:()=>[...a],execute:e=>{var n;o||((null===(n=i.batching)||void 0===n?void 0:n.enabled)&&(null==c||c.addItem(e)),(e=>{var n,r;if((null===(n=i.batching)||void 0===n?void 0:n.enabled)&&s.every(e=>e.isBatched()))return;const[o]=l([e]);if(void 0!==o)for(const e of s)t.debug(`Transporting item using ${e.name}\n`,o),e.isBatched()?(null===(r=i.batching)||void 0===r?void 0:r.enabled)||e.send([o]):e.send(o)})(e))},isPaused:()=>o,pause:()=>{t.debug("Pausing transports"),null==c||c.pause(),o=!0},remove:(...e)=>{t.debug("Removing transports"),e.forEach(e=>{t.debug(`Removing "${e.name}" transport`);const i=s.indexOf(e);-1!==i?s.splice(i,1):t.warn(`Transport "${e.name}" is not added`)})},removeBeforeSendHooks:(...e)=>{a.filter(t=>!e.includes(t))},get transports(){return[...s]},unpause:()=>{t.debug("Unpausing transports"),null==c||c.start(),o=!1}}}function re(e,t){if(t.preserveOriginalError)for(const t of e)t.type===n.EXCEPTION&&delete t.payload.originalError;return e}let se=G;function oe(e){var t;return se=null!==(t=e.unpatchedConsole)&&void 0!==t?t:se,se}function ae(e){const t=oe(e),i=ee(t,e);if(_ in A&&!e.isolate)return void i.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');i.debug("Initializing");const n=function(e,t){let i=[],n=[];const r=()=>i.reduce((e,t)=>Object.assign(e,f(t)?t():t),{}),s=()=>{if(n.length){const e=r();n.forEach(t=>t(e))}};return{add:(...e)=>{t.debug("Adding metas\n",e),i.push(...e),s()},remove:(...e)=>{t.debug("Removing metas\n",e),i=i.filter(t=>!e.includes(t)),s()},addListener:e=>{t.debug("Adding metas listener\n",e),n.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),n=n.filter(t=>t!==e)},get value(){return r()}}}(0,i),r=ne(t,i,e,n),s=B(t,i,e,n,r),o=function(e,t,i,n,r,s){t.debug("Initializing instrumentations");const o=[];return{add:(...a)=>{t.debug("Adding instrumentations"),a.forEach(a=>{t.debug(`Adding "${a.name}" instrumentation`),o.some(e=>e.name===a.name)?t.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=t,a.config=i,a.metas=n,a.transports=r,a.api=s,o.push(a),a.initialize())})},get instrumentations(){return[...o]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach(e=>{var i,n;t.debug(`Removing "${e.name}" instrumentation`);const r=o.reduce((t,i,n)=>null===t&&i.name===e.name?n:null,null);null!==r?(null===(n=(i=o[r]).destroy)||void 0===n||n.call(i),o.splice(r,1)):t.warn(`Instrumentation "${e.name}" is not added`)})}}}(t,i,e,n,r,s),a=U(t,i,e,n,r,s,o);return function(e){var t,i;const n={sdk:{version:te},app:{bundleId:e.config.app.name&&(r=e.config.app.name,null==A?void 0:A[`__faroBundleId_${r}`])}};var r;const s=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;s&&e.api.setSession(s),e.config.app&&(n.app=Object.assign(Object.assign({},e.config.app),n.app)),e.config.user&&(n.user=e.config.user),e.config.view&&(n.view=e.config.view),e.metas.add(n,...null!==(i=e.config.metas)&&void 0!==i?i:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}const le="faro",ue={enabled:!0,sendTimeout:250,itemLimit:50},ce="browser",de="\n",he="eval",fe="?",pe="@",ge=/^\s*at (?:(?![a-z]+:\/\/)([^(]+?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,me=/\((\S*)(?::(\d+))(?::(\d+))\)/,be="eval",ve="address at ",Oe=ve.length,we=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ye=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$e=" > eval",Se="safari-extension",xe="safari-web-extension",ke=/Minified React error #\d+;/i;function Pe(e,t,i,n){const r={filename:e||document.location.href,function:t||fe};return void 0!==i&&(r.lineno=i),void 0!==n&&(r.colno=n),r}function Te(e,t){const i=null==e?void 0:e.includes(Se),n=!i&&(null==e?void 0:e.includes(xe));return i||n?[(null==e?void 0:e.includes(pe))?e.split(pe)[0]:e,i?`${Se}:${t}`:`${xe}:${t}`]:[e,t]}function Ee(e){let t=[];e.stacktrace?t=e.stacktrace.split(de).filter((e,t)=>t%2==0):e.stack&&(t=e.stack.split(de));const i=t.reduce((t,i,n)=>{let r,s,o,a,l;if(r=ge.exec(i)){if(s=r[1],o=r[2],a=r[3],l=r[4],null==o?void 0:o.startsWith(be)){const e=me.exec(o);e&&(o=e[1],a=e[2],l=e[3])}o=(null==o?void 0:o.startsWith(ve))?o.substring(Oe):o,[s,o]=Te(s,o)}else if(r=we.exec(i)){if(s=r[1],o=r[3],a=r[4],l=r[5],o&&o.includes($e)){const e=ye.exec(o);e&&(s=s||he,o=e[1],a=e[2])}else 0===n&&!l&&c(e.columnNumber)&&(l=String(e.columnNumber+1));[s,o]=Te(s,o)}return(o||s)&&t.push(Pe(o,s,a?Number(a):void 0,l?Number(l):void 0)),t},[]);return ke.test(e.message)?i.slice(1):i}function ze(e){return{frames:Ee(e)}}const Ae="com.grafana.faro.session",_e=9e5,Qe={enabled:!0,persistent:!1,maxSessionPersistenceTime:_e},Ue="data-faro-user-action-name";var Ie=i(6660);const Ce="unknown",Re=()=>{const e=new Ie.UAParser,{name:t,version:i}=e.getBrowser(),{name:n,version:r}=e.getOS(),s=e.getUA(),o=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!t||!i)return;if("userAgentData"in navigator&&navigator.userAgentData)return navigator.userAgentData.brands;return}();return{browser:{name:null!=t?t:Ce,version:null!=i?i:Ce,os:`${null!=n?n:Ce} ${null!=r?r:Ce}`,userAgent:null!=s?s:Ce,language:null!=o?o:Ce,mobile:a,brands:null!=l?l:Ce,viewportWidth:`${window.innerWidth}`,viewportHeight:`${window.innerHeight}`}}},Xe=()=>{const e=window.k6;return{k6:Object.assign({isK6Browser:!0},(null==e?void 0:e.testRunId)&&{testRunId:null==e?void 0:e.testRunId})}};let Ne,De;function Le({generatePageId:e,initialPageMeta:t}={}){return()=>{const i=location.href;return f(e)&&Ne!==i&&(Ne=i,De=e(location)),{page:Object.assign(Object.assign({url:i},De?{id:De}:{}),t)}}}class je{constructor(){this.unpatchedConsole=G,this.internalLogger=Y,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class Me extends je{isBatched(){return!1}getIgnoreUrls(){return[]}}function qe(e,t){var i,n;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const r=null===(i=e.resourceSpans)||void 0===i?void 0:i[0];if(void 0===r)return e;const s=(null==r?void 0:r.scopeSpans)||[],o=(null===(n=null==t?void 0:t[0])||void 0===n?void 0:n.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},r),{scopeSpans:[...s,...o]})]})}function He(e,t){let i,n=!1;const r=()=>{null!=i?(e(...i),i=null,setTimeout(r,t)):n=!1};return(...s)=>{n?i=s:(e(...s),n=!0,setTimeout(r,t))}}const Fe="sessionStorage",Be="localStorage";function Ve(e){var t;try{let t;t=window[e];const i="__faro_storage_test__";return t.setItem(i,i),t.removeItem(i),!0}catch(i){return null===(t=Q.internalLogger)||void 0===t||t.info(`Web storage of type ${e} is not available. Reason: ${i}`),!1}}function We(e,t){return Je(t)?window[t].getItem(e):null}function Ye(e,t,i){if(Je(i))try{window[i].setItem(e,t)}catch(e){}}function Ze(e,t){Je(t)&&window[t].removeItem(e)}const Ge=Ve(Be),Ke=Ve(Fe);function Je(e){return e===Be?Ge:e===Fe&&Ke}const et="session_start",tt="session_resume",it="service_name_override";function nt(){var e,t,i;const n=Q.config.sessionTracking;let r=null!==(i=null!==(t=null===(e=null==n?void 0:n.sampler)||void 0===e?void 0:e.call(n,{metas:Q.metas.value}))&&void 0!==t?t:null==n?void 0:n.samplingRate)&&void 0!==i?i:1;if("number"!=typeof r){r=0}return Math.random()this.updateUserSession(),1e3),this.updateUserSession=ot({fetchUserSession:ut.fetchUserSession,storeUserSession:ut.storeUserSession}),this.init()}static removeUserSession(){Ze(Ae,ut.storageTypeLocal)}static storeUserSession(e){Ye(Ae,O(e),ut.storageTypeLocal)}static fetchUserSession(){const e=We(Ae,ut.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&this.updateSession()}),Q.metas.addListener(lt({fetchUserSession:ut.fetchUserSession,storeUserSession:ut.storeUserSession}))}}ut.storageTypeLocal=Be;class ct{constructor(){this.updateSession=He(()=>this.updateUserSession(),1e3),this.updateUserSession=ot({fetchUserSession:ct.fetchUserSession,storeUserSession:ct.storeUserSession}),this.init()}static removeUserSession(){Ze(Ae,ct.storageTypeSession)}static storeUserSession(e){Ye(Ae,O(e),ct.storageTypeSession)}static fetchUserSession(){const e=We(Ae,ct.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",()=>{"visible"===document.visibilityState&&this.updateSession()}),Q.metas.addListener(lt({fetchUserSession:ct.fetchUserSession,storeUserSession:ct.storeUserSession}))}}function dt(e){return(null==e?void 0:e.persistent)?ut:ct}ct.storageTypeSession=Fe;var ht=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},ft=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);rDate.now(),this.promiseBuffer=function(e){const{size:t,concurrency:i}=e,n=[];let r=0;const s=()=>{if(r{r--,s(),t(e)},e=>{r--,s(),i(e)})}};return{add:e=>{if(n.length+r>=t)throw new Error("Task buffer full");return new Promise((t,i)=>{n.push({producer:e,resolve:t,reject:i}),s()})}}}({size:null!==(n=e.bufferSize)&&void 0!==n?n:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return ht(this,void 0,void 0,function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add(()=>{const t=JSON.stringify(function(e){let t={meta:{}};return void 0!==e[0]&&(t.meta=e[0].meta),e.forEach(e=>{switch(e.type){case n.LOG:case n.EVENT:case n.EXCEPTION:case n.MEASUREMENT:{const i=r[e.type],n=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===n?[e.payload]:[...n,e.payload]});break}case n.TRACE:t=Object.assign(Object.assign({},t),{traces:qe(t.traces,e.payload.resourceSpans)})}}),t}(e)),{url:i,requestOptions:s,apiKey:o}=this.options,a=null!=s?s:{},{headers:l}=a,u=ft(a,["headers"]);let c;const d=this.metas.value.session;return null!=d&&(c=d.id),fetch(i,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=l?l:{}),o?{"x-api-key":o}:{}),c?{"x-faro-session-id":c}:{}),body:t,keepalive:t.length<=6e4},null!=u?u:{})).then(e=>ht(this,void 0,void 0,function*(){if(202===e.status){"invalid"===e.headers.get("X-Faro-Session-Status")&&this.extendFaroSession(this.config,this.logDebug)}return 429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(V),e})).catch(e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(t),e)})})}catch(e){this.logError(e)}})}getIgnoreUrls(){var e;return[this.options.url].concat(null!==(e=this.config.ignoreUrls)&&void 0!==e?e:[])}isBatched(){return!0}getRetryAfterDate(e){const t=this.getNow(),i=e.headers.get("Retry-After");if(i){const e=Number(i);if(!isNaN(e))return new Date(1e3*e+t);const n=Date.parse(i);if(!isNaN(n))return new Date(n)}return new Date(t+this.rateLimitBackoffMs)}extendFaroSession(e,t){const i="Session expired",n=e.sessionTracking;if(null==n?void 0:n.enabled){const{fetchUserSession:e,storeUserSession:r}=dt(n);ot({fetchUserSession:e,storeUserSession:r})({forceSessionExtend:!0}),t(`${i} created new session.`)}else t(`${i}.`)}}class gt extends je{constructor(){super(...arguments),this.api={},this.transports={}}}const mt="http-request-start",bt="http-request-end";let vt,Ot;function wt(){return vt||(vt=new k),Ot||(Ot=new MutationObserver((e,t)=>{vt.notify({type:"dom-mutation"})}),Ot.observe(document,{attributes:!0,childList:!0,subtree:!0,characterData:!0})),vt}function yt(e=""){return Q.transports.transports.flatMap(e=>e.getIgnoreUrls()).some(t=>e&&null!=e.match(t))}const $t="fetch",St="xhr";let xt,kt,Pt,Tt=!1;function Et(){if(xt)return xt;function e(e){xt.notify({type:mt,request:e})}function t(e){xt.notify({type:bt,request:e})}return xt=new k,Tt||(!function({onRequestEnd:e,onRequestStart:t}){Pt||(Pt=window.fetch);window.fetch=function(){var i,n;const r=null!==(i=u(s=arguments[0])?s:s instanceof URL?s.href:!v(s)&&f(null==s?void 0:s.toString)?s.toString():void 0)&&void 0!==i?i:"";var s;const o=yt(r),a=(null!==(n=arguments[1])&&void 0!==n?n:{}).method,l=C();return o||t({url:r,method:a,requestId:l,apiType:$t}),Pt.apply(this,arguments).then(t=>(o||e({url:r,method:a,requestId:l,apiType:$t}),t)).catch(t=>{throw o||e({url:r,method:a,requestId:l,apiType:$t}),t})}}({onRequestStart:e,onRequestEnd:t}),function({onRequestStart:e,onRequestEnd:t}){kt||(kt=XMLHttpRequest.prototype.open);XMLHttpRequest.prototype.open=function(){const i=arguments[1],n=yt(i),r=arguments[0],s=C();this.addEventListener("loadstart",function(){n||e({url:i,method:r,requestId:s,apiType:St})}),this.addEventListener("load",function(){n||t({url:i,method:r,requestId:s,apiType:St})}),this.addEventListener("error",function(){n||t({url:i,method:r,requestId:s,apiType:St})}),this.addEventListener("abort",function(){n||t({url:i,method:r,requestId:s,apiType:St})}),kt.apply(this,arguments)}}({onRequestStart:e,onRequestEnd:t}),Tt=!0),xt}const zt="com.grafana.faro.lastNavigationId",At="resource",_t=/^00-[a-f0-9]{32}-[a-f0-9]{16}-[0-9]{1,2}$/;function Qt(e=[]){for(const t of e)if("traceparent"===t.name){if(!_t.test(t.description))continue;const[,e,i]=t.description.split("-");if(null!=e&&null!=i)return{traceId:e,spanId:i};break}}function Ut(e,t={}){for(const[i,n]of Object.entries(t)){const t=e[i];return null!=t&&(p(n)?n.includes(t):t===n)}return!0}function It(e){const{connectEnd:t,connectStart:i,decodedBodySize:n,domainLookupEnd:r,domainLookupStart:s,duration:o,encodedBodySize:a,fetchStart:l,initiatorType:u,name:c,nextHopProtocol:d,redirectEnd:h,redirectStart:f,renderBlockingStatus:p,requestStart:g,responseEnd:m,responseStart:b,responseStatus:v,secureConnectionStart:O,transferSize:w,workerStart:y}=e;return{name:c,duration:Rt(o),tcpHandshakeTime:Rt(t-i),dnsLookupTime:Rt(r-s),tlsNegotiationTime:Rt(t-O),responseStatus:Rt(v),redirectTime:Rt(h-f),requestTime:Rt(b-g),responseTime:Rt(m-b),fetchTime:Rt(m-l),serviceWorkerTime:Rt(l-y),decodedBodySize:Rt(n),encodedBodySize:Rt(a),cacheHitStatus:function(){let e="fullLoad";0===w?n>0&&(e="cache"):null!=v?304===v&&(e="conditionalFetch"):a>0&&w0?e:0).toString():e.toString()}const Xt={initiatorType:["xmlhttprequest","fetch"]};var Nt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};const Dt=new k;class Lt extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-performance",this.version=te}initialize(){"PerformanceObserver"in window?function(e){if("complete"===document.readyState)e();else{const t=()=>{"complete"===document.readyState&&(e(),document.removeEventListener("readystatechange",t))};document.addEventListener("readystatechange",t)}}(()=>Nt(this,void 0,void 0,function*(){const e=this.api.pushEvent,{faroNavigationId:t}=yield function(e){let t;const i=new Promise(e=>{t=e});return new PerformanceObserver(i=>{var n;const[r]=i.getEntries();if(null==r||yt(r.name))return;const s=r.toJSON();let o=Qt(null==s?void 0:s.serverTiming);const a=null!==(n=We(zt,Fe))&&void 0!==n?n:Ce,l=Object.assign(Object.assign({},Ct(s)),{faroNavigationId:C(),faroPreviousNavigationId:a});Ye(zt,l.faroNavigationId,Fe),e("faro.performance.navigation",l,void 0,{spanContext:o,timestampOverwriteMs:performance.timeOrigin+s.startTime}),t(l)}).observe({type:"navigation",buffered:!0}),i}(e);null!=t&&function(e,t,i){const n=Q.config.trackResources;new PerformanceObserver(r=>{const s=r.getEntries();for(const r of s){if(yt(r.name))continue;null==i||i.notify({type:At});const s=r.toJSON();let o=Qt(null==s?void 0:s.serverTiming);if(null==n&&Ut(s,Xt)||n){const i=Object.assign(Object.assign({},It(s)),{faroNavigationId:e,faroResourceId:C()});t("faro.performance.resource",i,void 0,{spanContext:o,timestampOverwriteMs:performance.timeOrigin+s.startTime})}}}).observe({type:At,buffered:!0})}(t,e,Dt)})):this.logDebug("performance observer not supported. Disable performance instrumentation.")}}let jt,Mt,qt=!1;function Ht(e){return e.type===bt}class Ft{constructor(e){this.userAction=e,this.http=Et(),this.dom=wt(),this.perf=(jt||(jt=new k),qt||(Mt=Dt.subscribe(e=>{e.type===At&&jt.notify({type:"resource-entry"})}),qt=!0),jt),this.isValid=!1,this.runningRequests=new Map}attach(){this.allMonitorsSub=(new k).merge(this.http,this.dom,this.perf).takeWhile(()=>[z.Started,z.Halted].includes(this.userAction.getState())).filter(e=>!!(this.userAction.getState()!==z.Halted||Ht(e)&&this.runningRequests.has(e.request.requestId))).subscribe(e=>{(function(e){return e.type===mt})(e)&&this.runningRequests.set(e.request.requestId,e.request),Ht(e)&&this.runningRequests.delete(e.request.requestId),Ht(e)?this.userAction.getState()===z.Halted&&0===this.runningRequests.size&&this.endAction():(this.isValid||(this.isValid=!0),this.scheduleFollowUp())}),this.stateSub=this.userAction.filter(e=>[z.Ended,z.Cancelled].includes(e)).first().subscribe(()=>this.cleanup()),this.scheduleFollowUp()}scheduleFollowUp(){this.clearTimer(this.followUpTid),this.followUpTid=setTimeout(()=>{this.userAction.getState()===z.Started&&this.runningRequests.size>0?this.haltAction():this.isValid?this.endAction():this.cancelAction()},100)}haltAction(){this.userAction.getState()===z.Started&&(this.userAction.halt(),this.startHaltTimeout())}startHaltTimeout(){var e,t,i;this.clearTimer(this.haltTid),this.haltTid=(e=this.haltTid,t=()=>{this.userAction.getState()===z.Halted&&this.endAction()},i=1e4,e&&clearTimeout(e),setTimeout(()=>{t()},i))}endAction(){this.userAction.end(),this.cleanup()}cancelAction(){this.userAction.cancel(),this.cleanup()}cleanup(){var e,t;this.clearTimer(this.followUpTid),this.clearTimer(this.haltTid),null===(e=this.allMonitorsSub)||void 0===e||e.unsubscribe(),null===(t=this.stateSub)||void 0===t||t.unsubscribe(),this.allMonitorsSub=void 0,this.stateSub=void 0,this.runningRequests.clear()}clearTimer(e){e&&clearTimeout(e)}}function Bt(e){const{api:t,config:i}=e;function n(e){new Ft(e).attach()}return{processUserEvent:function(e){var r,s;const o=function(e,t){const i=function(e){const t=e.split("data-")[1],i=null==t?void 0:t.replace(/-(.)/g,(e,t)=>t.toUpperCase());return null==i?void 0:i.replace(/-/g,"")}(t),n=e.dataset;for(const e in n)if(e===i)return n[e];return}(e.target,null!==(s=null===(r=i.userActionsInstrumentation)||void 0===r?void 0:r.dataAttributeName)&&void 0!==s?s:"faroUserActionName");if(!o)return;const a=t.startUserAction(o,{},{triggerName:e.type});a&&n(a)},processUserActionStarted:n}}class Vt extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-user-action",this.version=te}initialize(){const{processUserEvent:e,processUserActionStarted:t}=Bt(Q);window.addEventListener("pointerdown",e),window.addEventListener("keydown",t=>{[" ","Enter"].includes(t.key)&&e(t)}),this._userActionSub=N.subscribe(({type:e,userAction:i})=>{"user_action_start"===e&&t(i)})}destroy(){var e;null===(e=this._userActionSub)||void 0===e||e.unsubscribe()}}const Wt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Yt(e){let t,i,n,r,s=[];if((e=>o(e,"ErrorEvent"))(e)&&e.error)t=e.error.message,i=e.error.name,s=Ee(e.error);else if((n=(e=>o(e,"DOMError"))(e))||(e=>o(e,"DOMException"))(e)){const{name:r,message:s}=e;i=null!=r?r:n?"DOMError":"DOMException",t=s?`${i}: ${s}`:i}else b(e)?(t=e.message,s=Ee(e)):(h(e)||(r=(e=>g&&a(e,Event))(e)))&&(i=r?e.constructor.name:void 0,t=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[t,i,s]}function Zt(e){const[t,i,n,r,s]=e;let o,a,l=[];const c=u(t),d=Pe(i,"?",n,r);return s||!c?([o,a,l]=Yt(null!=s?s:t),0===l.length&&(l=[d])):c&&([o,a]=function(e){var t,i;const n=e.match(Wt),r=null!==(t=null==n?void 0:n[1])&&void 0!==t?t:L;return[null!==(i=null==n?void 0:n[2])&&void 0!==i?i:e,r]}(t),l=[d]),{value:o,type:a,stackFrames:l}}function Gt(e,t){return b(e[0])?Zt(e):{value:t(e)}}function Kt(e){window.addEventListener("unhandledrejection",t=>{var i,n;let r,s,o=t;o.reason?o=t.reason:(null===(i=t.detail)||void 0===i?void 0:i.reason)&&(o=null===(n=t.detail)||void 0===n?void 0:n.reason);let a=[];(e=>!h(e)&&!f(e))(o)?(r=`Non-Error promise rejection captured with value: ${String(o)}`,s="UnhandledRejection"):[r,s,a]=Yt(o),r&&e.pushError(new Error(r),{type:s,stackFrames:a})})}class Jt extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=te}initialize(){this.logDebug("Initializing"),function(e){const t=window.onerror;window.onerror=(...i)=>{try{const{value:t,type:n,stackFrames:r}=Zt(i),s=i[4];if(t){const i={type:n,stackFrames:r};null!=s&&(i.originalError=s),e.pushError(new Error(t),i)}}finally{null==t||t.apply(window,i)}}}(this.api),Kt(this.api)}}class ei{t;o=0;i=[];u(e){if(e.hadRecentInput)return;const t=this.i[0],i=this.i.at(-1);this.o&&t&&i&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),this.t?.(e)}}const ti=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart{if("loading"===document.readyState)return"loading";{const t=ti();if(t){if(e{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},ri=e=>{let t="";try{for(;9!==e?.nodeType;){const i=e,n=i.id?"#"+i.id:[ni(i),...Array.from(i.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,i.id)break;e=i.parentNode}}catch{}return t},si=new WeakMap;function oi(e,t){return si.get(e)||si.set(e,new t),si.get(e)}let ai=-1;const li=()=>ai,ui=e=>{addEventListener("pageshow",t=>{t.persisted&&(ai=t.timeStamp,e(t))},!0)},ci=(e,t,i,n)=>{let r,s;return o=>{t.value>=0&&(o||n)&&(s=t.value-(r??0),(s||void 0===r)&&(r=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},di=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},hi=()=>{const e=ti();return e?.activationStart??0},fi=(e,t=-1)=>{const i=ti();let n="navigate";return li()>=0?n="back-forward-cache":i&&(document.prerendering||hi()>0?n="prerender":document.wasDiscarded?n="restore":i.type&&(n=i.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},pi=(e,t,i={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...i}),n}}catch{}},gi=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let mi=-1;const bi=new Set,vi=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Oi=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of bi)e();isFinite(mi)||(mi="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Oi,!0))}},wi=()=>{if(mi<0){const e=hi(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;mi=t??vi(),addEventListener("visibilitychange",Oi,!0),addEventListener("prerenderingchange",Oi,!0),ui(()=>{setTimeout(()=>{mi=vi()})})}return{get firstHiddenTime(){return mi},onHidden(e){bi.add(e)}}},yi=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},$i=[1800,3e3],Si=(e,t={})=>{yi(()=>{const i=wi();let n,r=fi("FCP");const s=pi("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime{r=fi("FCP"),n=ci(e,r,$i,t.reportAllChanges),di(()=>{r.value=performance.now()-i.timeStamp,n(!0)})}))})},xi=[.1,.25],ki=e=>e.find(e=>1===e.node?.nodeType)||e[0];let Pi=0,Ti=1/0,Ei=0;const zi=e=>{for(const t of e)t.interactionId&&(Ti=Math.min(Ti,t.interactionId),Ei=Math.max(Ei,t.interactionId),Pi=Ei?(Ei-Ti)/7+1:0)};let Ai;const _i=()=>Ai?Pi:performance.interactionCount??0;let Qi=0;class Ui{l=[];h=new Map;m;p;v(){Qi=_i(),this.l.length=0,this.h.clear()}M(){const e=Math.min(this.l.length-1,Math.floor((_i()-Qi)/50));return this.l[e]}u(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.l.at(-1);let i=this.h.get(e.interactionId);if(i||this.l.length<10||e.duration>t.T){if(i?e.duration>i.T?(i.entries=[e],i.T=e.duration):e.duration===i.T&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(i={id:e.interactionId,entries:[e],T:e.duration},this.h.set(i.id,i),this.l.push(i)),this.l.sort((e,t)=>t.T-e.T),this.l.length>10){const e=this.l.splice(10);for(const t of e)this.h.delete(t.id)}this.p?.(i)}}}const Ii=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=gi(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},Ci=[200,500],Ri=(e,t={})=>{const i=oi(t=Object.assign({},t),Ui);let n=[],r=[],s=0;const o=new WeakMap,a=new WeakMap;let l=!1;const u=()=>{l||(Ii(c),l=!0)},c=()=>{const e=i.l.map(e=>o.get(e.entries[0])),t=r.length-50;r=r.filter((i,n)=>n>=t||e.includes(i));const a=new Set;for(const e of r){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}const u=n.length-1-50;n=n.filter((e,t)=>e.startTime>s&&t>u||a.has(e)),l=!1};i.m=e=>{const t=e.startTime+e.duration;let i;s=Math.max(s,e.processingEnd);for(let n=r.length-1;n>=0;n--){const s=r[n];if(Math.abs(t-s.renderTime)<=8){i=s,i.startTime=Math.min(e.startTime,i.startTime),i.processingStart=Math.min(e.processingStart,i.processingStart),i.processingEnd=Math.max(e.processingEnd,i.processingEnd),i.entries.push(e);break}}i||(i={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:t,entries:[e]},r.push(i)),(e.interactionId||"first-input"===e.entryType)&&o.set(e,i),u()},i.p=e=>{if(!a.get(e)){const i=e.entries[0].target;if(i){const n=t.generateTarget?.(i)??ri(i);a.set(e,n)}}};const d=(e,t)=>{const i=[];for(const r of n)if(!(r.startTime+r.durationt)break;i.push(r)}return i},h=e=>{const t=e.entries[0],n=o.get(t),r=t.processingStart,s=Math.max(t.startTime+t.duration,r),l=Math.min(n.processingEnd,s),u=n.entries.sort((e,t)=>e.processingStart-t.processingStart),c=d(t.startTime,l),h=i.h.get(t.interactionId),f={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:s,processedEventEntries:u,longAnimationFrameEntries:c,inputDelay:r-t.startTime,processingDuration:l-r,presentationDelay:s-l,loadState:ii(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{if(!e.longAnimationFrameEntries?.length)return;const t=e.interactionTime,i=e.inputDelay,n=e.processingDuration;let r,s,o=0,a=0,l=0,u=0;for(const l of e.longAnimationFrameEntries){a=a+l.startTime+l.duration-l.styleAndLayoutStart;for(const e of l.scripts){const l=e.startTime+e.duration;if(lu&&(s=e.startTime=t+i+n?"presentation-delay":"processing-duration",r=e,u=c)}}const c=e.longAnimationFrameEntries.at(-1),d=c?c.startTime+c.duration:0;d>=t+i+n&&(l=e.nextPaintTime-d),r&&s&&(e.longestScript={entry:r,subpart:s,intersectingDuration:u}),e.totalScriptDuration=o,e.totalStyleAndLayoutDuration=a,e.totalPaintDuration=l,e.totalUnattributedDuration=e.nextPaintTime-t-o-a-l})(f),Object.assign(e,{attribution:f})};pi("long-animation-frame",e=>{n=n.concat(e),u()}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=wi();yi(()=>{"interactionCount"in performance||Ai||(Ai=pi("event",zi,{type:"event",buffered:!0,durationThreshold:0}));let n,r=fi("INP");const s=oi(t,Ui),o=e=>{Ii(()=>{for(const t of e)s.u(t);const t=s.M();t&&t.T!==r.value&&(r.value=t.T,r.entries=t.entries,n())})},a=pi("event",o,{durationThreshold:t.durationThreshold??40});n=ci(e,r,Ci,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{o(a.takeRecords()),n(!0)}),ui(()=>{s.v(),r=fi("INP"),n=ci(e,r,Ci,t.reportAllChanges)}))})})(t=>{const i=h(t);e(i)},t)};class Xi{m;u(e){this.m?.(e)}}const Ni=[2500,4e3],Di=[800,1800],Li=e=>{document.prerendering?yi(()=>Li(e)):"complete"!==document.readyState?addEventListener("load",()=>Li(e),!0):setTimeout(e)},ji="load_state",Mi="time_to_first_byte";class qi{constructor(e,t){this.corePushMeasurement=e,this.webVitalConfig=t}initialize(){this.measureCLS(),this.measureFCP(),this.measureINP(),this.measureLCP(),this.measureTTFB()}measureCLS(){var e;((e,t={})=>{const i=oi(t=Object.assign({},t),ei),n=new WeakMap;i.t=e=>{if(e?.sources?.length){const i=ki(e.sources),r=i?.node;if(r){const e=t.generateTarget?.(r)??ri(r);n.set(i,e)}}},((e,t={})=>{const i=wi();Si(gi(()=>{let n,r=fi("CLS",0);const s=oi(t,ei),o=e=>{for(const t of e)s.u(t);s.o>r.value&&(r.value=s.o,r.entries=s.i,n())},a=pi("layout-shift",o);a&&(n=ci(e,r,xi,t.reportAllChanges),i.onHidden(()=>{o(a.takeRecords()),n(!0)}),ui(()=>{s.o=0,r=fi("CLS",0),n=ci(e,r,xi,t.reportAllChanges),di(()=>n())}),setTimeout(n))}))})(t=>{const i=(e=>{let t={};if(e.entries.length){const i=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(i?.sources?.length){const e=ki(i.sources);e&&(t={largestShiftTarget:n.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:ii(i.startTime)})}}return Object.assign(e,{attribution:t})})(t);e(i)},t)})(e=>{const{loadState:t,largestShiftValue:i,largestShiftTime:n,largestShiftTarget:r}=e.attribution,s=this.buildInitialValues(e);this.addIfPresent(s,"largest_shift_value",i),this.addIfPresent(s,"largest_shift_time",n);const o=this.buildInitialContext(e);this.addIfPresent(o,ji,t),this.addIfPresent(o,"largest_shift_target",r),this.pushMeasurement(s,o)},{reportAllChanges:null===(e=this.webVitalConfig)||void 0===e?void 0:e.reportAllChanges})}measureFCP(){var e;((e,t={})=>{Si(t=>{const i=(e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:ii(li())};if(e.entries.length){const i=ti(),n=e.entries.at(-1);if(i){const r=i.activationStart||0,s=Math.max(0,i.responseStart-r);t={timeToFirstByte:s,firstByteToFCP:e.value-s,loadState:ii(e.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}return Object.assign(e,{attribution:t})})(t);e(i)},t)})(e=>{const{firstByteToFCP:t,timeToFirstByte:i,loadState:n}=e.attribution,r=this.buildInitialValues(e);this.addIfPresent(r,"first_byte_to_fcp",t),this.addIfPresent(r,Mi,i);const s=this.buildInitialContext(e);this.addIfPresent(s,ji,n),this.pushMeasurement(r,s)},{reportAllChanges:null===(e=this.webVitalConfig)||void 0===e?void 0:e.reportAllChanges})}measureINP(){var e;Ri(e=>{const{interactionTime:t,presentationDelay:i,inputDelay:n,processingDuration:r,nextPaintTime:s,loadState:o,interactionTarget:a,interactionType:l}=e.attribution,u=this.buildInitialValues(e);this.addIfPresent(u,"interaction_time",t),this.addIfPresent(u,"presentation_delay",i),this.addIfPresent(u,"input_delay",n),this.addIfPresent(u,"processing_duration",r),this.addIfPresent(u,"next_paint_time",s);const c=this.buildInitialContext(e);this.addIfPresent(c,ji,o),this.addIfPresent(c,"interaction_target",a),this.addIfPresent(c,"interaction_type",l),this.pushMeasurement(u,c)},{reportAllChanges:null===(e=this.webVitalConfig)||void 0===e?void 0:e.reportAllChanges})}measureLCP(){var e;((e,t={})=>{const i=oi(t=Object.assign({},t),Xi),n=new WeakMap;i.m=e=>{const i=e.element;if(i){const r=t.generateTarget?.(i)??ri(i);n.set(e,r)}},((e,t={})=>{yi(()=>{const i=wi();let n,r=fi("LCP");const s=oi(t,Xi),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)s.u(t),t.startTime{o(a.takeRecords()),a.disconnect(),n(!0)}),s=e=>{e.isTrusted&&(Ii(i),removeEventListener(e.type,s,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,s,{capture:!0});ui(i=>{r=fi("LCP"),n=ci(e,r,Ni,t.reportAllChanges),di(()=>{r.value=performance.now()-i.timeStamp,n(!0)})})}})})(t=>{const i=(e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){const i=ti();if(i){const r=i.activationStart||0,s=e.entries.at(-1),o=s.url&&performance.getEntriesByType("resource").filter(e=>e.name===s.url)[0],a=Math.max(0,i.responseStart-r),l=Math.max(a,o?(o.requestStart||o.startTime)-r:0),u=Math.min(e.value,Math.max(l,o?o.responseEnd-r:0));t={target:n.get(s),timeToFirstByte:a,resourceLoadDelay:l-a,resourceLoadDuration:u-l,elementRenderDelay:e.value-u,navigationEntry:i,lcpEntry:s},s.url&&(t.url=s.url),o&&(t.lcpResourceEntry=o)}}return Object.assign(e,{attribution:t})})(t);e(i)},t)})(e=>{const{elementRenderDelay:t,resourceLoadDelay:i,resourceLoadDuration:n,timeToFirstByte:r,target:s}=e.attribution,o=this.buildInitialValues(e);this.addIfPresent(o,"element_render_delay",t),this.addIfPresent(o,"resource_load_delay",i),this.addIfPresent(o,"resource_load_duration",n),this.addIfPresent(o,Mi,r);const a=this.buildInitialContext(e);this.addIfPresent(a,"element",s),this.pushMeasurement(o,a)},{reportAllChanges:null===(e=this.webVitalConfig)||void 0===e?void 0:e.reportAllChanges})}measureTTFB(){var e;((e,t={})=>{((e,t={})=>{let i=fi("TTFB"),n=ci(e,i,Di,t.reportAllChanges);Li(()=>{const r=ti();r&&(i.value=Math.max(r.responseStart-hi(),0),i.entries=[r],n(!0),ui(()=>{i=fi("TTFB",0),n=ci(e,i,Di,t.reportAllChanges),n(!0)}))})})(t=>{const i=(e=>{let t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){const i=e.entries[0],n=i.activationStart||0,r=Math.max((i.workerStart||i.fetchStart)-n,0),s=Math.max(i.domainLookupStart-n,0),o=Math.max(i.connectStart-n,0),a=Math.max(i.connectEnd-n,0);t={waitingDuration:r,cacheDuration:s-r,dnsDuration:o-s,connectionDuration:a-o,requestDuration:e.value-a,navigationEntry:i}}return Object.assign(e,{attribution:t})})(t);e(i)},t)})(e=>{const{dnsDuration:t,connectionDuration:i,requestDuration:n,waitingDuration:r,cacheDuration:s}=e.attribution,o=this.buildInitialValues(e);this.addIfPresent(o,"dns_duration",t),this.addIfPresent(o,"connection_duration",i),this.addIfPresent(o,"request_duration",n),this.addIfPresent(o,"waiting_duration",r),this.addIfPresent(o,"cache_duration",s);const a=this.buildInitialContext(e);this.pushMeasurement(o,a)},{reportAllChanges:null===(e=this.webVitalConfig)||void 0===e?void 0:e.reportAllChanges})}buildInitialValues(e){const t=e.name.toLowerCase();return{[t]:e.value,delta:e.delta}}buildInitialContext(e){var t;const i=null!==(t=We(zt,Fe))&&void 0!==t?t:Ce;return{id:e.id,rating:e.rating,navigation_type:e.navigationType,navigation_entry_id:i}}pushMeasurement(e,t){this.corePushMeasurement({type:"web-vitals",values:e},{context:t})}addIfPresent(e,t,i){i&&(e[t]=i)}}class Hi extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=te}initialize(){this.logDebug("Initializing");new qi(this.api.pushMeasurement,this.config.webVitalsInstrumentation).initialize()}}class Fi extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=te}sendSessionStartEvent(e){var t,i;const n=e.session;if(n&&n.id!==(null===(t=this.notifiedSession)||void 0===t?void 0:t.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(i=n.attributes)||void 0===i?void 0:i.previousSession))return this.api.pushEvent("session_extend",{},void 0,{skipDedupe:!0}),void(this.notifiedSession=n);this.notifiedSession=n,this.api.pushEvent(et,{},void 0,{skipDedupe:!0})}}createInitialSession(e,t){var i,n,r,s,o,a;let l,u,c=e.fetchUserSession();if(t.persistent&&t.maxSessionPersistenceTime&&c){const e=y();c.lastActivity{var t,n,r;i();const s=null===(t=e.meta.session)||void 0===t?void 0:t.attributes;if(s&&"true"===(null==s?void 0:s.isSampled)){let t=JSON.parse(JSON.stringify(e));const i=null===(n=t.meta.session)||void 0===n?void 0:n.attributes;return null==i||delete i.isSampled,0===Object.keys(null!=i?i:{}).length&&(null===(r=t.meta.session)||void 0===r||delete r.attributes),t}return null})}initialize(){this.logDebug("init session instrumentation");const e=this.config.sessionTracking;if(null==e?void 0:e.enabled){const t=dt(e);this.registerBeforeSendHook(t);const{initialSession:i,lifecycleType:n}=this.createInitialSession(t,e);t.storeUserSession(i);const r=i.sessionMeta;this.notifiedSession=r,this.api.setSession(r),n===et&&this.api.pushEvent(et,{},void 0,{skipDedupe:!0}),n===tt&&this.api.pushEvent(tt,{},void 0,{skipDedupe:!0})}this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class Bi extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=te}sendViewChangedEvent(e){var t,i,n,r;const s=e.view;s&&s.name!==(null===(t=this.notifiedView)||void 0===t?void 0:t.name)&&(this.api.pushEvent("view_changed",{fromView:null!==(n=null===(i=this.notifiedView)||void 0===i?void 0:i.name)&&void 0!==n?n:Ce,toView:null!==(r=s.name)&&void 0!==r?r:Ce},void 0,{skipDedupe:!0}),this.notifiedView=s)}initialize(){this.metas.addListener(this.sendViewChangedEvent.bind(this))}}class Vi extends k{constructor(e,t){var i,n,r,s;super(),this._tracking=!1,this.eventsObservable=e,this._options={inactivityMs:null!==(i=null==t?void 0:t.inactivityMs)&&void 0!==i?i:100,drainTimeoutMs:null!==(n=null==t?void 0:t.drainTimeoutMs)&&void 0!==n?n:1e4,isOperationStart:null!==(r=null==t?void 0:t.isOperationStart)&&void 0!==r?r:()=>{},isOperationEnd:null!==(s=null==t?void 0:t.isOperationEnd)&&void 0!==s?s:()=>{}},this._initialize()}_initialize(){this.eventsObservable.filter(()=>this._tracking).subscribe(e=>{var t,i,n;this._lastEventTime=Date.now(),null===(t=this._currentEvents)||void 0===t||t.push(e);const r=this._options.isOperationStart(e);r&&(null===(i=this._activeOperations)||void 0===i||i.set(r,!0));const s=this._options.isOperationEnd(e);s&&(null===(n=this._activeOperations)||void 0===n||n.delete(s)),this._scheduleInactivityCheck()})}startTracking(){this._tracking||(this._tracking=!0,this._startTime=Date.now(),this._lastEventTime=Date.now(),this.notify({message:"tracking-started"}),this._currentEvents=[],this._activeOperations=new Map,this._scheduleInactivityCheck())}stopTracking(){this._tracking=!1,this._clearTimer(this._inactivityTid),this._clearTimer(this._drainTid);let e=0;e=this.hasActiveOperations()?Date.now()-this._startTime:this._lastEventTime?this._lastEventTime-this._startTime:0,this.notify({message:"tracking-ended",events:this._currentEvents,duration:e})}_scheduleInactivityCheck(){this._inactivityTid=Wi(this._inactivityTid,()=>{this.hasActiveOperations()?this._startDrainTimeout():this.stopTracking()},this._options.inactivityMs)}_startDrainTimeout(){this._drainTid=Wi(this._drainTid,()=>{this.stopTracking()},this._options.drainTimeoutMs)}hasActiveOperations(){return!!this._activeOperations&&this._activeOperations.size>0}_clearTimer(e){e&&clearTimeout(e)}}function Wi(e,t,i){return e&&clearTimeout(e),e=setTimeout(()=>{t()},i)}let Yi;const Zi=new Set,Gi=new Map;let Ki,Ji,en,tn,nn,rn,sn,on,an=!1;class ln extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-navigation",this.version=te}initialize(){const e=Et(),t=wt(),i=function(){function e(e,t){const i=null!=t?t:location.href;i!==Ji&&(Ki.notify({type:"url-change",from:Ji,to:i,trigger:e}),Ji=i)}if(Ki||(Ki=new k,Ji=location.href),!an)if("navigation"in window&&"NavigateEvent"in window){sn=t=>{try{const i=null==t?void 0:t.destination;(null==i?void 0:i.sameDocument)&&"string"==typeof i.url&&e("navigate",i.url)}catch(e){}},window.navigation.addEventListener("navigate",sn);const t=window.NavigateEvent;t&&t.prototype&&"function"==typeof t.prototype.intercept&&(on||(on=t.prototype.intercept),t.prototype.intercept=function(t){try{const t=!!(null==this?void 0:this.canIntercept),i=null==this?void 0:this.destination;t&&i&&!1===i.sameDocument&&"string"==typeof i.url&&e("navigate-intercept",i.url)}catch(e){}return on.call(this,t)}),an=!0}else en||(en=window.history.pushState),window.history.pushState=function(...t){const i=en.apply(window.history,t);return e("pushState"),i},tn||(tn=window.history.replaceState),window.history.replaceState=function(...t){const i=tn.apply(window.history,t);return e("replaceState"),i},nn=()=>e("popstate"),rn=()=>e("hashchange"),window.addEventListener("popstate",nn),window.addEventListener("hashchange",rn),an=!0;return Ki}(),n=(r=["pointerdown","keydown"],Yi||(Yi=new k),r.forEach(e=>{if(!Zi.has(e)){const t=()=>{Yi.notify({type:"interaction",name:e})};window.addEventListener(e,t),Zi.add(e),Gi.set(e,t)}}),Yi);var r;const s=new Vi((new k).merge(e,t,i),{inactivityMs:100,drainTimeoutMs:1e4,isOperationStart:e=>function(e){return e.type===mt}(e)?e.request.requestId:void 0,isOperationEnd:e=>function(e){return e.type===bt}(e)?e.request.requestId:void 0});s.filter(e=>"tracking-ended"===e.message).subscribe(e=>{var t,i,n;if((null===(t=e.events)||void 0===t?void 0:t.some(e=>"url-change"===e.type))&&(null===(i=e.events)||void 0===i?void 0:i.some(e=>"dom-mutation"===e.type))){const t=null===(n=e.events)||void 0===n?void 0:n.find(e=>"url-change"===e.type);Q.api.pushEvent("faro.navigation",{fromUrl:null==t?void 0:t.from,toUrl:null==t?void 0:t.to,sameDocument:String(!0),duration:e.duration})}}),n.subscribe(()=>{s.startTracking()})}}class un extends gt{constructor(){super(),this.name="@grafana/faro-web-sdk:instrumentation-csp",this.version=te}initialize(){document.addEventListener("securitypolicyviolation",this.securitypolicyviolationHandler.bind(this))}destroy(){document.removeEventListener("securitypolicyviolation",this.securitypolicyviolationHandler)}securitypolicyviolationHandler(e){this.api.pushEvent("securitypolicyviolation",w(e))}}class cn extends gt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=te,this.errorSerializer=F}initialize(){var e;const t=this.config.consoleInstrumentation,i=(null==t?void 0:t.serializeErrors)||!!(null==t?void 0:t.errorSerializer);this.errorSerializer=i?null!==(e=null==t?void 0:t.errorSerializer)&&void 0!==e?e:j:F,H.HT.filter(e=>{var i;return!(null!==(i=null==t?void 0:t.disabledLevels)&&void 0!==i?i:cn.defaultDisabledLevels).includes(e)}).forEach(e=>{console[e]=(...i)=>{try{if(e!==H.$b.ERROR||(null==t?void 0:t.consoleErrorAsLog))if(e===H.$b.ERROR&&(null==t?void 0:t.consoleErrorAsLog)){const{value:t,type:n,stackFrames:r}=Gt(i,this.errorSerializer);this.api.pushLog(t?[cn.consoleErrorPrefix+t]:i,{level:e,context:{value:null!=t?t:"",type:null!=n?n:"",stackFrames:(null==r?void 0:r.length)?j(r):""}})}else this.api.pushLog(i,{level:e});else{const{value:e,type:t,stackFrames:n}=Gt(i,this.errorSerializer);if(e&&!t&&!n)return void this.api.pushError(new Error(cn.consoleErrorPrefix+e));this.api.pushError(new Error(cn.consoleErrorPrefix+e),{type:t,stackFrames:n})}}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...i)}}})}}function dn(e={}){const t=[new Vt,new Jt,new Hi,new Fi,new Bi,new ln];return!1!==e.enablePerformanceInstrumentation&&t.unshift(new Lt),!1!==e.enableContentSecurityPolicyInstrumentation&&t.push(new un),!1!==e.captureConsole&&t.push(new cn),t}cn.defaultDisabledLevels=[H.$b.DEBUG,H.$b.TRACE,H.$b.LOG],cn.consoleErrorPrefix="console.error: ";var hn=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r!("@grafana/faro-web-sdk:instrumentation-navigation"===e.name&&!n))}function pn(e){var t,i;const{page:n,generatePageId:r}=null!==(t=null==e?void 0:e.pageTracking)&&void 0!==t?t:{},s=[Re,Le({generatePageId:r,initialPageMeta:n}),...null!==(i=e.metas)&&void 0!==i?i:[]];return h(null===window||void 0===window?void 0:window.k6)?[...s,Xe]:s}function gn({trackGeolocation:e,sessionTracking:t}){var i;const n={};return d(e)&&(n.geoLocationTrackingEnabled=e),v(n)?{}:{session:Object.assign(Object.assign({},null!==(i=null==t?void 0:t.session)&&void 0!==i?i:{}),{overrides:n})}}function mn(e){const t=function(e){var t,i,n,r,s;const o=[],a=K(e.unpatchedConsole,e.internalLoggerLevel);e.transports?((e.url||e.apiKey)&&a.error('if "transports" is defined, "url" and "apiKey" should not be defined'),o.push(...e.transports)):e.url?o.push(new pt({url:e.url,apiKey:e.apiKey})):a.error('either "url" or "transports" must be defined');const{dedupe:l=!0,eventDomain:u=ce,globalObjectKey:c=le,instrumentations:d=dn(),internalLoggerLevel:h=Z,isolate:f=!1,logArgsSerializer:p=F,metas:g=pn(e),paused:m=!1,preventGlobalExposure:b=!1,unpatchedConsole:v=G,url:O,experimental:w}=e,y=hn(e,["dedupe","eventDomain","globalObjectKey","instrumentations","internalLoggerLevel","isolate","logArgsSerializer","metas","paused","preventGlobalExposure","unpatchedConsole","url","experimental"]),$=null!==(t=null==w?void 0:w.trackNavigation)&&void 0!==t&&t,S={dataAttributeName:null!==(n=null===(i=e.userActionsInstrumentation)||void 0===i?void 0:i.dataAttributeName)&&void 0!==n?n:Ue,excludeItem:null===(r=e.userActionsInstrumentation)||void 0===r?void 0:r.excludeItem};return Object.assign(Object.assign({},y),{batching:Object.assign(Object.assign({},ue),e.batching),dedupe:l,globalObjectKey:c,instrumentations:fn(d,e),internalLoggerLevel:h,isolate:f,logArgsSerializer:p,metas:g,parseStacktrace:ze,paused:m,preventGlobalExposure:b,transports:o,unpatchedConsole:v,eventDomain:u,ignoreUrls:[...null!==(s=e.ignoreUrls)&&void 0!==s?s:[],...O?[O]:[],/\/collect(?:\/[\w]*)?$/],sessionTracking:Object.assign(Object.assign(Object.assign({},Qe),e.sessionTracking),gn({trackGeolocation:e.trackGeolocation,sessionTracking:e.sessionTracking})),userActionsInstrumentation:S,experimental:{trackNavigation:$}})}(e);if(t)return ae(t)}var bn=i(8531),vn=i(4696);const On=new Map([["dev",{environment:"dev",appName:"grafana-metricsdrilldown-app-dev",faroUrl:"https://faro-collector-ops-eu-south-0.grafana-ops.net/collect/8c57b32175ba39d35dfaccee7cd793c7"}],["ops",{environment:"ops",appName:"grafana-metricsdrilldown-app-ops",faroUrl:"https://faro-collector-ops-eu-south-0.grafana-ops.net/collect/d65ab91eb9c5e8c51b474d9313ba28f4"}],["prod",{environment:"prod",appName:"grafana-metricsdrilldown-app-prod",faroUrl:"https://faro-collector-ops-eu-south-0.grafana-ops.net/collect/0f4f1bbc97c9e2db4fa85ef75a559885"}]]);var wn=i(5176),yn=i(8943);let $n=null;const Sn=()=>$n,xn=e=>$n=e,kn=["ResizeObserver loop limit exceeded","ResizeObserver loop completed","Non-Error exception captured with keys","Failed sending payload to the receiver"],Pn=new Set(kn),Tn=e=>Pn.has(e);function En(){if(Sn())return;const e=function(){const e=(0,vn.u)();if(e&&On.has(e))return On.get(e)}();if(!e)return;const{environment:t,faroUrl:i,appName:n}=e,{apps:r,bootData:s}=bn.config,o=r[yn.s].version,a=s.user.email;xn(mn({url:i,app:{name:n,release:o,version:wn.t,environment:t},user:{email:a},ignoreErrors:kn,instrumentations:[...dn({captureConsole:!1})],isolate:!0,beforeSend:e=>{var t,i;return(null!==(i=null===(t=e.meta.page)||void 0===t?void 0:t.url)&&void 0!==i?i:"").includes(yn.G)?e:null}}))}}},m={};function b(e){var t=m[e];if(void 0!==t)return t.exports;var i=m[e]={id:e,loaded:!1,exports:{}};return g[e].call(i.exports,i,i.exports,b),i.loaded=!0,i.exports}b.m=g,b.amdO={},b.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return b.d(t,{a:t}),t},h=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,b.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var i=Object.create(null);b.r(i);var n={};d=d||[null,h({}),h([]),h(h)];for(var r=2&t&&e;("object"==typeof r||"function"==typeof r)&&!~d.indexOf(r);r=h(r))Object.getOwnPropertyNames(r).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,b.d(i,n),i},b.d=(e,t)=>{for(var i in t)b.o(t,i)&&!b.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},b.f={},b.e=e=>Promise.all(Object.keys(b.f).reduce((t,i)=>(b.f[i](e,t),t),[])),b.u=e=>e+".js?_cache="+{2:"7101916049f818d58037",14:"07f6f78ab45cabb01bf7",64:"bfff71b84c3b67cff0fb",70:"2d1e37c1233024806300",74:"6a6cf4493168a4c4b2a0",150:"a9eae9ab36b5aa3a2e33",156:"dcd383229c5404d776bf",190:"a6f6d81aca619dd3f85e",206:"130901d6a2dcaa8e3dfe",220:"f2309b411f0ae9855b9a",290:"c655a966d0d783478b54",327:"62ce92e00bf3f37cfb9f",341:"8f9cffe8b5fc06dedcdc",353:"00ac2f1a6a55baf37ac5",377:"b7919a00c12d0f18f72b",494:"c08c93e5cce9bf750560",503:"201b25c5f9822f473e7d",509:"5219bd37cc1302880d7d",549:"79f2b0fd3610c8ad03b7",582:"a1556b2a2a05b8e0497f",591:"72d8c50f59d75a36ab7e",605:"24613abfb844135b3c7f",614:"c8daf176bb4a9973ba24",644:"14d38f9a6e5a99fbf61f",660:"b143f478b19fd3cf5886",697:"d2ab3d5c44c5aa5add66",767:"b4f9d973b92b7eab01ca",792:"79c48dbde1c722d712fa",876:"1a7696652a5f03389ba7",944:"5da0375876db943a6756",980:"655996be379e3e595023"}[e],b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f={},p="grafana-metricsdrilldown-app:",b.l=(e,t,i,n)=>{if(f[e])f[e].push(t);else{var r,s;if(void 0!==i)for(var o=document.getElementsByTagName("script"),a=0;a{r.onerror=r.onload=null,clearTimeout(c);var n=f[e];if(delete f[e],r.parentNode&&r.parentNode.removeChild(r),n&&n.forEach(e=>e(i)),t)return t(i)},c=setTimeout(u.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=u.bind(null,r.onerror),r.onload=u.bind(null,r.onload),s&&document.head.appendChild(r)}},b.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),b.p="public/plugins/grafana-metricsdrilldown-app/",b.sriHashes={2:"sha256-HkcJZErouD3WL+1stzs18OPSMsSF4QWoOp955TmukbM=",14:"sha256-xP4SqO1X6qC9HXMMDr2hxNXpv0ci5FyEBSaohoBAQWY=",64:"sha256-+eS4ibapvl/wQIEzXmJ+plgMZyGFc61E0tfUHJLojSg=",70:"sha256-GaO4d6yeP+YB+9WyDAkUHHIJbSHxKfm7bwH09jrS8y8=",74:"sha256-SQr33/MDfoRAIyaGFvwvmFiatOFS+WCGRjvJlIrxRkk=",150:"sha256-9tz72qsU48mgerjaxGJNDp7uWJVhYs0SStgPNw9HDYM=",156:"sha256-Bo5PyLaQ8sgO6yPS4FhAlVlpOscfzI0pWdsqBDuIX20=",190:"sha256-12aRaPJrfy9ZI3DpnLCelye64bR7P1GdTfG6ANaqQPU=",206:"sha256-gyUOFb+pbvMAsycBxAf4skP8MwlrWjwB39sLAXevptY=",220:"sha256-duXi/YNmlUSXYMogjs+hFWHIlg1xeMxhY+/bIWhN17U=",290:"sha256-tE/RC2PUE2/DO9bo8SQsYsBgP4/ZK8EBhaI08gDgm3s=",327:"sha256-K+kGzqXTSt1SmcvkrsIUOGFoVUwmxIZO84r0AzdhWj8=",341:"sha256-s4GbMhRpxmQwojCT+aM3qGDneWHezQj2pZakPoFYSZo=",353:"sha256-MkI5qRIuIcYI1RkPnv4wr6CLe6N2y8AI0jLJY48CdsY=",377:"sha256-LX/wuJHRIA1n2cgOFByMFo2iifqw4rNJLun1ZO+ROcw=",494:"sha256-0g8AceNKKf/qoqPgdmDpsjGAGz745WSGfBBo9rrxu7w=",503:"sha256-ic4QpZSNLDJPDkPFyjZX7zqHIVjblVoZZ+mtxL15G3Y=",509:"sha256-L2vesL2i6Z2cfOc+6VEUVSXCx4CQ4tV+MVsc06JAgm4=",549:"sha256-zQex0nYwO7K6coUcUY9hJPiv/a/m7WSAEoFkKgrZD0M=",582:"sha256-ma5aIvogv/1lzEb7gT15yy1a2RIrGjJw1lzDuM1cbX8=",591:"sha256-aFeKURcdDlRpmIAImf0xoFCaEkdixTyfviao544ElvY=",605:"sha256-f/7f3xSDqL45kdZQLWcnUDVT8zThV3DT6i3DGnf5jXc=",614:"sha256-q+uMNGpUGD6GZk15fK/7olCwzgCo1wSG48JCkbkeMh8=",644:"sha256-PSQxRXZiHRv2/UODxWqRoa3VK6GMjbSFZ5NkiBp/BvU=",660:"sha256-g6vlB8R7evXe2yFwTPWlRD8KU4t4elZAD8Nv4NKvi9M=",697:"sha256-qm318cH6+mW9IIRUnmJdaZAQ+KWSpnAxZoIq5EqcIwA=",767:"sha256-n7PgmQw9FZEgqDgNgUg8D55Ub9UoOW7M/p4+brJKQpM=",792:"sha256-n9glSvUoslqv4tg53t94pHnbLrTU+AZ5rQm88Td1s2I=",876:"sha256-CF4WCyKMUQ1b3Vg/29Y4tOR9PMVwY2LBcH66r1eX33U=",944:"sha256-yhcd2tTsl4eyyVcdVbjqYyqQOmjkJ2NhaVW+Azyq0Io=",980:"sha256-hZBLmPqKcZ77U0udmW/Es1zyFtjLhND/jL80SJV0rqY="},(()=>{b.b="undefined"!=typeof document&&document.baseURI||self.location.href;var e={231:0};b.f.j=(t,i)=>{var n=b.o(e,t)?e[t]:void 0;if(0!==n)if(n)i.push(n[2]);else{var r=new Promise((i,r)=>n=e[t]=[i,r]);i.push(n[2]=r);var s=b.p+b.u(t),o=new Error;b.l(s,i=>{if(b.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var r=i&&("load"===i.type?"missing":i.type),s=i&&i.target&&i.target.src;o.message="Loading chunk "+t+" failed.\n("+r+": "+s+")",o.name="ChunkLoadError",o.type=r,o.request=s,n[1](o)}},"chunk-"+t,t)}};var t=(t,i)=>{var n,r,[s,o,a]=i,l=0;if(s.some(t=>0!==e[t])){for(n in o)b.o(o,n)&&(b.m[n]=o[n]);if(a)a(b)}for(t&&t(i);l{"use strict";b.r(v),b.d(v,{plugin:()=>O});var e=b(1308),t=b.n(e);b.p=t()&&t().uri?t().uri.slice(0,t().uri.lastIndexOf("/")+1):"public/plugins/grafana-metricsdrilldown-app/";var i=b(7781),n=b(2007),r=b(5959),s=b.n(r);const o=(0,r.lazy)(()=>Promise.all([b.e(944),b.e(591),b.e(14),b.e(614),b.e(605),b.e(377)]).then(b.bind(b,2377)));const a=[{id:`${b(2533).id}/label-breakdown-component/v1`,title:"Label Breakdown",description:"A metrics label breakdown view from the Metrics Drilldown app.",component:e=>s().createElement(r.Suspense,{fallback:s().createElement("div",null,"Loading...")},s().createElement(o,e))}];var l=b(3781),u=b(3498),c=b(4440);function d(e,t=u.b.Drilldown){const i=(0,l.kY)([[l.I8.DatasourceId,e]]);return(0,l.Rk)(t,i)}const h="Browse metrics in Grafana Metrics Drilldown",f=[{title:"Open in Metrics Drilldown",description:h,targets:[i.PluginExtensionPoints.DataSourceConfigActions,i.PluginExtensionPoints.DataSourceConfigStatus],icon:"drilldown",category:"metrics-drilldown",path:(0,l.Rk)(u.b.Drilldown),configure:e=>{var t,i;if((null==e||null===(t=e.dataSource)||void 0===t?void 0:t.type)&&(null==e||null===(i=e.dataSource)||void 0===i?void 0:i.uid)&&(0,c.aQ)(e.dataSource))return{path:d(e.dataSource.uid),description:h}}}];var p=b(8705);function g(e,t,i,n,r,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,r)}const m=(0,r.lazy)(()=>{return(e=function*(){const{initPluginTranslations:e}=yield Promise.all([b.e(591),b.e(503)]).then(b.bind(b,5503)),{loadResources:t}=yield Promise.all([b.e(591),b.e(14)]).then(b.bind(b,3014));yield e("grafana-scenes",[t]);const{wasmSupported:i}=yield Promise.all([b.e(944),b.e(290)]).then(b.bind(b,2290)),{default:n}=yield b.e(944).then(b.bind(b,6944));if(i())try{yield n()}catch(e){p.v.error(e,{message:"Error while initializing outlier detection"})}else p.v.warn("WASM not supported, outlier detection will not work");return Promise.all([b.e(944),b.e(591),b.e(14),b.e(614),b.e(792),b.e(605),b.e(509)]).then(b.bind(b,4509))},function(){var t=this,i=arguments;return new Promise(function(n,r){var s=e.apply(t,i);function o(e){g(s,n,r,o,a,"next",e)}function a(e){g(s,n,r,o,a,"throw",e)}o(void 0)})})();var e}),O=(new i.AppPlugin).setRootPage(e=>s().createElement(r.Suspense,{fallback:s().createElement(n.LoadingPlaceholder,{text:""})},s().createElement(m,e)));for(const e of[...l.Ge,...f])O.addLink(e);for(const e of a)O.exposeComponent(e)})(),v})()); //# sourceMappingURL=module.js.map