Files
var-monorepo/grafana/plugins/grafana-pyroscope-app/module.js

940 lines
1.1 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see module.js.LICENSE.txt */
/* [create-plugin] version: 5.11.1 */
define(["@emotion/css","@grafana/data","@grafana/runtime","@grafana/ui","d3","lodash","module","react","react-dom","react-router","rxjs"],((__WEBPACK_EXTERNAL_MODULE__6089__,__WEBPACK_EXTERNAL_MODULE__7781__,__WEBPACK_EXTERNAL_MODULE__8531__,__WEBPACK_EXTERNAL_MODULE__2007__,__WEBPACK_EXTERNAL_MODULE__4201__,__WEBPACK_EXTERNAL_MODULE__3241__,__WEBPACK_EXTERNAL_MODULE__1308__,__WEBPACK_EXTERNAL_MODULE__5959__,__WEBPACK_EXTERNAL_MODULE__8398__,__WEBPACK_EXTERNAL_MODULE__1159__,__WEBPACK_EXTERNAL_MODULE__1269__)=>(()=>{var __webpack_modules__={404:(e,t,n)=>{const r=Symbol("SemVer ANY");class i{static get ANY(){return r}constructor(e,t){if(t=a(t),e instanceof i){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),c("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(e){const t=this.options.loose?o[s.COMPARATORLOOSE]:o[s.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new u(n[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(c("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):(!(t=a(t)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}e.exports=i;const a=n(9287),{safeRe:o,t:s}=n(978),l=n(6323),c=n(116),u=n(8152),d=n(1451)},1451:(e,t,n)=>{const r=/\s+/g;class i{constructor(e,t){if(t=o(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(r," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!y(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&b(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&m)|(this.options.loose&&g))+":"+e,n=a.get(t);if(n)return n;const r=this.options.loose,i=r?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];e=e.replace(i,A(this.options.includePrerelease)),l("hyphen replace",e),e=e.replace(u[d.COMPARATORTRIM],p),l("comparator trim",e),e=e.replace(u[d.TILDETRIM],h),l("tilde trim",e),e=e.replace(u[d.CARETTRIM],f),l("caret trim",e);let o=e.split(" ").map((e=>w(e,this.options))).join(" ").split(/\s+/).map((e=>P(e,this.options)));r&&(o=o.filter((e=>(l("loose invalid filter",e,this.options),!!e.match(u[d.COMPARATORLOOSE]))))),l("range list",o);const c=new Map,b=o.map((e=>new s(e,this.options)));for(const e of b){if(y(e))return[e];c.set(e.value,e)}c.size>1&&c.has("")&&c.delete("");const v=[...c.values()];return a.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some((n=>v(n,t)&&e.set.some((e=>v(e,t)&&n.every((n=>e.every((e=>n.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(R(this.set[t],e,this.options))return!0;return!1}}e.exports=i;const a=new(n(3974)),o=n(9287),s=n(404),l=n(116),c=n(8152),{safeRe:u,t:d,comparatorTrimReplace:p,tildeTrimReplace:h,caretTrimReplace:f}=n(978),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:g}=n(3486),y=e=>"<0.0.0-0"===e.value,b=e=>""===e.value,v=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every((e=>i.intersects(e,t))),i=r.pop();return n},w=(e,t)=>(l("comp",e,t),e=O(e,t),l("caret",e),e=E(e,t),l("tildes",e),e=T(e,t),l("xrange",e),e=k(e,t),l("stars",e),e),S=e=>!e||"x"===e.toLowerCase()||"*"===e,E=(e,t)=>e.trim().split(/\s+/).map((e=>x(e,t))).join(" "),x=(e,t)=>{const n=t.loose?u[d.TILDELOOSE]:u[d.TILDE];return e.replace(n,((t,n,r,i,a)=>{let o;return l("tilde",e,t,n,r,i,a),S(n)?o="":S(r)?o=`>=${n}.0.0 <${+n+1}.0.0-0`:S(i)?o=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(l("replaceTilde pr",a),o=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):o=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,l("tilde return",o),o}))},O=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{l("caret",e,t);const n=t.loose?u[d.CARETLOOSE]:u[d.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,i,a,o)=>{let s;return l("caret",e,t,n,i,a,o),S(n)?s="":S(i)?s=`>=${n}.0.0${r} <${+n+1}.0.0-0`:S(a)?s="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:o?(l("replaceCaret pr",o),s="0"===n?"0"===i?`>=${n}.${i}.${a}-${o} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${o} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${o} <${+n+1}.0.0-0`):(l("no pr"),s="0"===n?"0"===i?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),l("caret return",s),s}))},T=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map((e=>C(e,t))).join(" ")),C=(e,t)=>{e=e.trim();const n=t.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return e.replace(n,((n,r,i,a,o,s)=>{l("xRange",e,n,r,i,a,o,s);const c=S(i),u=c||S(a),d=u||S(o),p=d;return"="===r&&p&&(r=""),s=t.includePrerelease?"-0":"",c?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&p?(u&&(a=0),o=0,">"===r?(r=">=",u?(i=+i+1,a=0,o=0):(a=+a+1,o=0)):"<="===r&&(r="<",u?i=+i+1:a=+a+1),"<"===r&&(s="-0"),n=`${r+i}.${a}.${o}${s}`):u?n=`>=${i}.0.0${s} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${s} <${i}.${+a+1}.0-0`),l("xRange return",n),n}))},k=(e,t)=>(l("replaceStars",e,t),e.trim().replace(u[d.STAR],"")),P=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),A=e=>(t,n,r,i,a,o,s,l,c,u,d,p)=>`${n=S(r)?"":S(i)?`>=${r}.0.0${e?"-0":""}`:S(a)?`>=${r}.${i}.0${e?"-0":""}`:o?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=S(c)?"":S(u)?`<${+c+1}.0.0-0`:S(d)?`<${c}.${+u+1}.0-0`:p?`<=${c}.${u}.${d}-${p}`:e?`<${c}.${u}.${+d+1}-0`:`<=${l}`}`.trim(),R=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(l(e[n].semver),e[n].semver!==s.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}},8152:(e,t,n)=>{const r=n(116),{MAX_LENGTH:i,MAX_SAFE_INTEGER:a}=n(3486),{safeRe:o,safeSrc:s,t:l}=n(978),c=n(9287),{compareIdentifiers:u}=n(175);class d{constructor(e,t){if(t=c(t),e instanceof d){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>i)throw new TypeError(`version is longer than ${i} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?o[l.LOOSE]:o[l.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<a)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof d)){if("string"==typeof e&&e===this.version)return 0;e=new d(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof d||(e=new d(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof d||(e=new d(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],i=e.prerelease[t];if(r("prerelease compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return u(n,i)}while(++t)}compareBuild(e){e instanceof d||(e=new d(e,this.options));let t=0;do{const n=this.build[t],i=e.build[t];if(r("build compare",t,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return u(n,i)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=new RegExp(`^${this.options.loose?s[l.PRERELEASELOOSE]:s[l.PRERELEASE]}$`),n=`-${t}`.match(e);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=d},5466:(e,t,n)=>{const r=n(8948);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},6323:(e,t,n)=>{const r=n(957),i=n(6619),a=n(1888),o=n(4333),s=n(4647),l=n(5428);e.exports=(e,t,n,c)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return r(e,n,c);case"!=":return i(e,n,c);case">":return a(e,n,c);case">=":return o(e,n,c);case"<":return s(e,n,c);case"<=":return l(e,n,c);default:throw new TypeError(`Invalid operator: ${t}`)}}},3494:(e,t,n)=>{const r=n(8152),i=n(8948),{safeRe:a,t:o}=n(978);e.exports=(e,t)=>{if(e instanceof r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){const r=t.includePrerelease?a[o.COERCERTLFULL]:a[o.COERCERTL];let i;for(;(i=r.exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&i.index+i[0].length===n.index+n[0].length||(n=i),r.lastIndex=i.index+i[1].length+i[2].length;r.lastIndex=-1}else n=e.match(t.includePrerelease?a[o.COERCEFULL]:a[o.COERCE]);if(null===n)return null;const s=n[2],l=n[3]||"0",c=n[4]||"0",u=t.includePrerelease&&n[5]?`-${n[5]}`:"",d=t.includePrerelease&&n[6]?`+${n[6]}`:"";return i(`${s}.${l}.${c}${u}${d}`,t)}},9329:(e,t,n)=>{const r=n(8152);e.exports=(e,t,n)=>{const i=new r(e,n),a=new r(t,n);return i.compare(a)||i.compareBuild(a)}},6175:(e,t,n)=>{const r=n(7956);e.exports=(e,t)=>r(e,t,!0)},7956:(e,t,n)=>{const r=n(8152);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},5316:(e,t,n)=>{const r=n(8948);e.exports=(e,t)=>{const n=r(e,null,!0),i=r(t,null,!0),a=n.compare(i);if(0===a)return null;const o=a>0,s=o?n:i,l=o?i:n,c=!!s.prerelease.length;if(!!l.prerelease.length&&!c){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(s))return l.minor&&!l.patch?"minor":"patch"}const u=c?"pre":"";return n.major!==i.major?u+"major":n.minor!==i.minor?u+"minor":n.patch!==i.patch?u+"patch":"prerelease"}},957:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>0===r(e,t,n)},1888:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>r(e,t,n)>0},4333:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>r(e,t,n)>=0},643:(e,t,n)=>{const r=n(8152);e.exports=(e,t,n,i,a)=>{"string"==typeof n&&(a=i,i=n,n=void 0);try{return new r(e instanceof r?e.version:e,n).inc(t,i,a).version}catch(e){return null}}},4647:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>r(e,t,n)<0},5428:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>r(e,t,n)<=0},6038:(e,t,n)=>{const r=n(8152);e.exports=(e,t)=>new r(e,t).major},9922:(e,t,n)=>{const r=n(8152);e.exports=(e,t)=>new r(e,t).minor},6619:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>0!==r(e,t,n)},8948:(e,t,n)=>{const r=n(8152);e.exports=(e,t,n=!1)=>{if(e instanceof r)return e;try{return new r(e,t)}catch(e){if(!n)return null;throw e}}},2481:(e,t,n)=>{const r=n(8152);e.exports=(e,t)=>new r(e,t).patch},6877:(e,t,n)=>{const r=n(8948);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},2862:(e,t,n)=>{const r=n(7956);e.exports=(e,t,n)=>r(t,e,n)},5601:(e,t,n)=>{const r=n(9329);e.exports=(e,t)=>e.sort(((e,n)=>r(n,e,t)))},5034:(e,t,n)=>{const r=n(1451);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},987:(e,t,n)=>{const r=n(9329);e.exports=(e,t)=>e.sort(((e,n)=>r(e,n,t)))},4109:(e,t,n)=>{const r=n(8948);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},6977:(e,t,n)=>{const r=n(978),i=n(3486),a=n(8152),o=n(175),s=n(8948),l=n(4109),c=n(5466),u=n(643),d=n(5316),p=n(6038),h=n(9922),f=n(2481),m=n(6877),g=n(7956),y=n(2862),b=n(6175),v=n(9329),w=n(987),S=n(5601),E=n(1888),x=n(4647),O=n(957),_=n(6619),T=n(4333),C=n(5428),k=n(6323),P=n(3494),A=n(404),R=n(1451),D=n(5034),j=n(8427),I=n(2432),N=n(5210),L=n(1505),M=n(6950),F=n(6055),$=n(3519),B=n(9914),V=n(344),U=n(8921),z=n(1428);e.exports={parse:s,valid:l,clean:c,inc:u,diff:d,major:p,minor:h,patch:f,prerelease:m,compare:g,rcompare:y,compareLoose:b,compareBuild:v,sort:w,rsort:S,gt:E,lt:x,eq:O,neq:_,gte:T,lte:C,cmp:k,coerce:P,Comparator:A,Range:R,satisfies:D,toComparators:j,maxSatisfying:I,minSatisfying:N,minVersion:L,validRange:M,outside:F,gtr:$,ltr:B,intersects:V,simplifyRange:U,subset:z,SemVer:a,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:o.compareIdentifiers,rcompareIdentifiers:o.rcompareIdentifiers}},3486:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},116:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},175:e=>{const t=/^[0-9]+$/,n=(e,n)=>{const r=t.test(e),i=t.test(n);return r&&i&&(e=+e,n=+n),e===n?0:r&&!i?-1:i&&!r?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},3974:e=>{e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},9287:e=>{const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},978:(e,t,n)=>{const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:a}=n(3486),o=n(116),s=(t=e.exports={}).re=[],l=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],d=t.t={};let p=0;const h="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",a],[h,i]],m=(e,t,n)=>{const r=(e=>{for(const[t,n]of f)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=p++;o(e,i,t),d[e]=i,c[i]=t,u[i]=r,s[i]=new RegExp(t,n?"g":void 0),l[i]=new RegExp(r,n?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),m("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${c[d.NUMERICIDENTIFIER]}|${c[d.NONNUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NUMERICIDENTIFIERLOOSE]}|${c[d.NONNUMERICIDENTIFIER]})`),m("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${h}+`),m("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),m("FULL",`^${c[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),m("LOOSE",`^${c[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),m("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),m("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?`+`(?:${c[d.BUILD]})?(?:$|[^\\d])`),m("COERCERTL",c[d.COERCE],!0),m("COERCERTLFULL",c[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},3519:(e,t,n)=>{const r=n(6055);e.exports=(e,t,n)=>r(e,t,">",n)},344:(e,t,n)=>{const r=n(1451);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t,n))},9914:(e,t,n)=>{const r=n(6055);e.exports=(e,t,n)=>r(e,t,"<",n)},2432:(e,t,n)=>{const r=n(8152),i=n(1451);e.exports=(e,t,n)=>{let a=null,o=null,s=null;try{s=new i(t,n)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(a&&-1!==o.compare(e)||(a=e,o=new r(a,n)))})),a}},5210:(e,t,n)=>{const r=n(8152),i=n(1451);e.exports=(e,t,n)=>{let a=null,o=null,s=null;try{s=new i(t,n)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(a&&1!==o.compare(e)||(a=e,o=new r(a,n)))})),a}},1505:(e,t,n)=>{const r=n(8152),i=n(1451),a=n(1888);e.exports=(e,t)=>{e=new i(e,t);let n=new r("0.0.0");if(e.test(n))return n;if(n=new r("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let o=null;i.forEach((e=>{const t=new r(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!a(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||n&&!a(n,o)||(n=o)}return n&&e.test(n)?n:null}},6055:(e,t,n)=>{const r=n(8152),i=n(404),{ANY:a}=i,o=n(1451),s=n(5034),l=n(1888),c=n(4647),u=n(5428),d=n(4333);e.exports=(e,t,n,p)=>{let h,f,m,g,y;switch(e=new r(e,p),t=new o(t,p),n){case">":h=l,f=u,m=c,g=">",y=">=";break;case"<":h=c,f=d,m=l,g="<",y="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(e,t,p))return!1;for(let n=0;n<t.set.length;++n){const r=t.set[n];let o=null,s=null;if(r.forEach((e=>{e.semver===a&&(e=new i(">=0.0.0")),o=o||e,s=s||e,h(e.semver,o.semver,p)?o=e:m(e.semver,s.semver,p)&&(s=e)})),o.operator===g||o.operator===y)return!1;if((!s.operator||s.operator===g)&&f(e,s.semver))return!1;if(s.operator===y&&m(e,s.semver))return!1}return!0}},8921:(e,t,n)=>{const r=n(5034),i=n(7956);e.exports=(e,t,n)=>{const a=[];let o=null,s=null;const l=e.sort(((e,t)=>i(e,t,n)));for(const e of l){r(e,t,n)?(s=e,o||(o=e)):(s&&a.push([o,s]),s=null,o=null)}o&&a.push([o,null]);const c=[];for(const[e,t]of a)e===t?c.push(e):t||e!==l[0]?t?e===l[0]?c.push(`<=${t}`):c.push(`${e} - ${t}`):c.push(`>=${e}`):c.push("*");const u=c.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return u.length<d.length?u:t}},1428:(e,t,n)=>{const r=n(1451),i=n(404),{ANY:a}=i,o=n(5034),s=n(7956),l=[new i(">=0.0.0-0")],c=[new i(">=0.0.0")],u=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===a){if(1===t.length&&t[0].semver===a)return!0;e=n.includePrerelease?l:c}if(1===t.length&&t[0].semver===a){if(n.includePrerelease)return!0;t=c}const r=new Set;let i,u,h,f,m,g,y;for(const t of e)">"===t.operator||">="===t.operator?i=d(i,t,n):"<"===t.operator||"<="===t.operator?u=p(u,t,n):r.add(t.semver);if(r.size>1)return null;if(i&&u){if(h=s(i.semver,u.semver,n),h>0)return null;if(0===h&&(">="!==i.operator||"<="!==u.operator))return null}for(const e of r){if(i&&!o(e,String(i),n))return null;if(u&&!o(e,String(u),n))return null;for(const r of t)if(!o(e,String(r),n))return!1;return!0}let b=!(!u||n.includePrerelease||!u.semver.prerelease.length)&&u.semver,v=!(!i||n.includePrerelease||!i.semver.prerelease.length)&&i.semver;b&&1===b.prerelease.length&&"<"===u.operator&&0===b.prerelease[0]&&(b=!1);for(const e of t){if(y=y||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,i)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),">"===e.operator||">="===e.operator){if(f=d(i,e,n),f===e&&f!==i)return!1}else if(">="===i.operator&&!o(i.semver,String(e),n))return!1;if(u)if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),"<"===e.operator||"<="===e.operator){if(m=p(u,e,n),m===e&&m!==u)return!1}else if("<="===u.operator&&!o(u.semver,String(e),n))return!1;if(!e.operator&&(u||i)&&0!==h)return!1}return!(i&&g&&!u&&0!==h)&&(!(u&&y&&!i&&0!==h)&&(!v&&!b))},d=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new r(e,n),t=new r(t,n);let i=!1;e:for(const r of e.set){for(const e of t.set){const t=u(r,e,n);if(i=i||null!==t,t)continue e}if(i)return!1}return!0}},8427:(e,t,n)=>{const r=n(1451);e.exports=(e,t)=>new r(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},6950:(e,t,n)=>{const r=n(1451);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},6233:e=>{"use strict";e.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,a=!0;for(;i<arguments.length;)n[r++]=arguments[i++];return new Promise((function(i,o){n[r]=function(e){if(a)if(a=!1,e)o(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(e){a&&(a=!1,o(e))}}))}},1979:(e,t)=>{"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),a=0;a<64;)i[r[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;n.encode=function(e,t,n){for(var i,a=null,o=[],s=0,l=0;t<n;){var c=e[t++];switch(l){case 0:o[s++]=r[c>>2],i=(3&c)<<4,l=1;break;case 1:o[s++]=r[i|c>>4],i=(15&c)<<2,l=2;break;case 2:o[s++]=r[i|c>>6],o[s++]=r[63&c],l=0}s>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,o)),s=0)}return l&&(o[s++]=r[i],o[s++]=61,1===l&&(o[s++]=61)),a?(s&&a.push(String.fromCharCode.apply(String,o.slice(0,s))),a.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var o="invalid encoding";n.decode=function(e,t,n){for(var r,a=n,s=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&s>1)break;if(void 0===(c=i[c]))throw Error(o);switch(s){case 0:r=c,s=1;break;case 1:t[n++]=r<<2|(48&c)>>4,r=c,s=2;break;case 2:t[n++]=(15&r)<<4|(60&c)>>2,r=c,s=3;break;case 3:t[n++]=(3&r)<<6|c,s=0}}if(1===s)throw Error(o);return n-a},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},7669:e=>{"use strict";function t(e,n){"string"==typeof e&&(n=e,e=void 0);var r=[];function i(e){if("string"!=typeof e){var n=a();if(t.verbose,n="return "+n,e){for(var o=Object.keys(e),s=new Array(o.length+1),l=new Array(o.length),c=0;c<o.length;)s[c]=o[c],l[c]=e[o[c++]];return s[c]=n,Function.apply(null,s).apply(null,l)}return Function(n)()}for(var u=new Array(arguments.length-1),d=0;d<u.length;)u[d]=arguments[++d];if(d=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var n=u[d++];switch(t){case"d":case"f":return String(Number(n));case"i":return String(Math.floor(n));case"j":return JSON.stringify(n);case"s":return String(n)}return"%"})),d!==u.length)throw Error("parameter count mismatch");return r.push(e),i}function a(t){return"function "+(t||n||"")+"("+(e&&e.join(",")||"")+"){\n "+r.join("\n ")+"\n}"}return i.toString=a,i}e.exports=t,t.verbose=!1},3474:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},9240:(e,t,n)=>{"use strict";e.exports=a;var r=n(6233),i=n(1925)("fs");function a(e,t,n){return"function"==typeof t?(n=t,t={}):t||(t={}),n?!t.xhr&&i&&i.readFile?i.readFile(e,(function(r,i){return r&&"undefined"!=typeof XMLHttpRequest?a.xhr(e,t,n):r?n(r):n(null,t.binary?i:i.toString("utf8"))})):a.xhr(e,t,n):r(a,this,e,t)}a.xhr=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState){if(0!==r.status&&200!==r.status)return n(Error("status "+r.status));if(t.binary){var e=r.response;if(!e){e=[];for(var i=0;i<r.responseText.length;++i)e.push(255&r.responseText.charCodeAt(i))}return n(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return n(null,r.responseText)}},t.binary&&("overrideMimeType"in r&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.responseType="arraybuffer"),r.open("GET",e),r.send()}},5750:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function a(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function o(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function s(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:a,e.writeFloatBE=r?a:i,e.readFloatLE=r?o:s,e.readFloatBE=r?s:o}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);else{var a=Math.floor(Math.log(t)/Math.LN2);e((i<<31|a+127<<23|8388607&Math.round(t*Math.pow(2,-a)*8388608))>>>0,n,r)}}function o(e,t,n){var r=e(t,n),i=2*(r>>31)+1,a=r>>>23&255,o=8388607&r;return 255===a?o?NaN:i*(1/0):0===a?1401298464324817e-60*i*o:i*Math.pow(2,a-150)*(o+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=o.bind(null,i),e.readFloatBE=o.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function a(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function o(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function s(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:a,e.writeDoubleBE=r?a:i,e.readDoubleLE=r?o:s,e.readDoubleBE=r?s:o}():function(){function t(e,t,n,r,i,a){var o=r<0?1:0;if(o&&(r=-r),0===r)e(0,i,a+t),e(1/r>0?0:2147483648,i,a+n);else if(isNaN(r))e(0,i,a+t),e(2146959360,i,a+n);else if(r>17976931348623157e292)e(0,i,a+t),e((o<<31|2146435072)>>>0,i,a+n);else{var s;if(r<22250738585072014e-324)e((s=r/5e-324)>>>0,i,a+t),e((o<<31|s/4294967296)>>>0,i,a+n);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(s=r*Math.pow(2,-l))>>>0,i,a+t),e((o<<31|l+1023<<20|1048576*s&1048575)>>>0,i,a+n)}}}function o(e,t,n,r,i){var a=e(r,i+t),o=e(r,i+n),s=2*(o>>31)+1,l=o>>>20&2047,c=4294967296*(1048575&o)+a;return 2047===l?c?NaN:s*(1/0):0===l?5e-324*s*c:s*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=o.bind(null,i,0,4),e.readDoubleBE=o.bind(null,a,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},1925:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},2459:(e,t)=>{"use strict";var n=t,r=n.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=n.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),i="";n&&(i=t.shift()+"/");for(var a=0;a<t.length;)".."===t[a]?a>0&&".."!==t[a-1]?t.splice(--a,2):n?t.splice(a,1):++a:"."===t[a]?t.splice(a,1):++a;return i+t.join("/")};n.resolve=function(e,t,n){return n||(t=i(t)),r(t)?t:(n||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},4226:e=>{"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,a=null,o=r;return function(n){if(n<1||n>i)return e(n);o+n>r&&(a=e(r),o=0);var s=t.call(a,o,o+=n);return 7&o&&(o=1+(7|o)),s}}},2971:(e,t)=>{"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,a=[],o=0;t<n;)(r=e[t++])<128?a[o++]=r:r>191&&r<224?a[o++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a[o++]=55296+(r>>10),a[o++]=56320+(1023&r)):a[o++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,a.slice(0,o))),i.join("")):String.fromCharCode.apply(String,a.slice(0,o))},n.write=function(e,t,n){for(var r,i,a=n,o=0;o<e.length;++o)(r=e.charCodeAt(o))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=e.charCodeAt(o+1)))?(r=65536+((1023&r)<<10)+(1023&i),++o,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-a}},7951:(e,t,n)=>{const r=n(2880),i={};for(const e of Object.keys(r))i[r[e]]=e;const a={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=a;for(const e of Object.keys(a)){if(!("channels"in a[e]))throw new Error("missing channels property: "+e);if(!("labels"in a[e]))throw new Error("missing channel labels property: "+e);if(a[e].labels.length!==a[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=a[e];delete a[e].channels,delete a[e].labels,Object.defineProperty(a[e],"channels",{value:t}),Object.defineProperty(a[e],"labels",{value:n})}a.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i;let s,l;a===i?s=0:t===a?s=(n-r)/o:n===a?s=2+(r-t)/o:r===a&&(s=4+(t-n)/o),s=Math.min(60*s,360),s<0&&(s+=360);const c=(i+a)/2;return l=a===i?0:c<=.5?o/(a+i):o/(2-a-i),[s,100*l,100*c]},a.rgb.hsv=function(e){let t,n,r,i,a;const o=e[0]/255,s=e[1]/255,l=e[2]/255,c=Math.max(o,s,l),u=c-Math.min(o,s,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(i=0,a=0):(a=u/c,t=d(o),n=d(s),r=d(l),o===c?i=r-n:s===c?i=1/3+t-r:l===c&&(i=2/3+n-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*a,100*c]},a.rgb.hwb=function(e){const t=e[0],n=e[1];let r=e[2];const i=a.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,100*o,100*r]},a.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r);return[100*((1-t-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*i]},a.rgb.keyword=function(e){const t=i[e];if(t)return t;let n,a=1/0;for(const t of Object.keys(r)){const i=r[t],l=(s=i,((o=e)[0]-s[0])**2+(o[1]-s[1])**2+(o[2]-s[2])**2);l<a&&(a=l,n=t)}var o,s;return n},a.keyword.rgb=function(e){return r[e]},a.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;return[100*(.4124*t+.3576*n+.1805*r),100*(.2126*t+.7152*n+.0722*r),100*(.0193*t+.1192*n+.9505*r)]},a.rgb.lab=function(e){const t=a.rgb.xyz(e);let n=t[0],r=t[1],i=t[2];n/=95.047,r/=100,i/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*r-16,500*(n-r),200*(r-i)]},a.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;let i,a,o;if(0===n)return o=255*r,[o,o,o];i=r<.5?r*(1+n):r+n-r*n;const s=2*r-i,l=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,o=6*a<1?s+6*(i-s)*a:2*a<1?i:3*a<2?s+(i-s)*(2/3-a)*6:s,l[e]=255*o;return l},a.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,r=e[2]/100,i=n;const a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;return[t,100*(0===r?2*i/(a+i):2*n/(r+n)),100*((r+n)/2)]},a.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let r=e[2]/100;const i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),l=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,l,o];case 1:return[s,r,o];case 2:return[o,r,l];case 3:return[o,s,r];case 4:return[l,o,r];case 5:return[r,o,s]}},a.hsv.hsl=function(e){const t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01);let a,o;o=(2-n)*r;const s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a=a||0,o/=2,[t,100*a,100*o]},a.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,r=e[2]/100;const i=n+r;let a;i>1&&(n/=i,r/=i);const o=Math.floor(6*t),s=1-r;a=6*t-o,1&o&&(a=1-a);const l=n+a*(s-n);let c,u,d;switch(o){default:case 6:case 0:c=s,u=l,d=n;break;case 1:c=l,u=s,d=n;break;case 2:c=n,u=s,d=l;break;case 3:c=n,u=l,d=s;break;case 4:c=l,u=n,d=s;break;case 5:c=s,u=n,d=l}return[255*c,255*u,255*d]},a.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},a.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100;let i,a,o;return i=3.2406*t+-1.5372*n+-.4986*r,a=-.9689*t+1.8758*n+.0415*r,o=.0557*t+-.204*n+1.057*r,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[255*i,255*a,255*o]},a.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;return[116*n-16,500*(t-n),200*(n-r)]},a.lab.xyz=function(e){let t,n,r;n=(e[0]+16)/116,t=e[1]/500+n,r=n-e[2]/200;const i=n**3,a=t**3,o=r**3;return n=i>.008856?i:(n-16/116)/7.787,t=a>.008856?a:(t-16/116)/7.787,r=o>.008856?o:(r-16/116)/7.787,t*=95.047,n*=100,r*=108.883,[t,n,r]},a.lab.lch=function(e){const t=e[0],n=e[1],r=e[2];let i;i=360*Math.atan2(r,n)/2/Math.PI,i<0&&(i+=360);return[t,Math.sqrt(n*n+r*r),i]},a.lch.lab=function(e){const t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},a.rgb.ansi16=function(e,t=null){const[n,r,i]=e;let o=null===t?a.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),0===o)return 30;let s=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return 2===o&&(s+=60),s},a.hsv.ansi16=function(e){return a.rgb.ansi16(a.hsv.rgb(e),e[2])},a.rgb.ansi256=function(e){const t=e[0],n=e[1],r=e[2];if(t===n&&n===r)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},a.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},a.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},a.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},a.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];3===t[0].length&&(n=n.split("").map((e=>e+e)).join(""));const r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},a.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a;let s,l;return s=o<1?a/(1-o):0,l=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,l/=6,l%=1,[360*l,100*o,100*s]},a.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n);let i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],100*r,100*i]},a.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=t*n;let i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],100*r,100*i]},a.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;if(0===n)return[255*r,255*r,255*r];const i=[0,0,0],a=t%1*6,o=a%1,s=1-o;let l=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return l=(1-n)*r,[255*(n*i[0]+l),255*(n*i[1]+l),255*(n*i[2]+l)]},a.hcg.hsv=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);let r=0;return n>0&&(r=t/n),[e[0],100*r,100*n]},a.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],100*r,100*n]},a.hcg.hwb=function(e){const t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},a.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,r=n-t;let i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],100*r,100*i]},a.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},a.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},a.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},a.gray.hsl=function(e){return[0,0,e[0]]},a.gray.hsv=a.gray.hsl,a.gray.hwb=function(e){return[0,100,e[0]]},a.gray.cmyk=function(e){return[0,0,0,e[0]]},a.gray.lab=function(e){return[e[0],0,0]},a.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},a.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},8666:(e,t,n)=>{const r=n(7951),i=n(1247),a={};Object.keys(r).forEach((e=>{a[e]={},Object.defineProperty(a[e],"channels",{value:r[e].channels}),Object.defineProperty(a[e],"labels",{value:r[e].labels});const t=i(e);Object.keys(t).forEach((n=>{const r=t[n];a[e][n]=function(e){const t=function(...t){const n=t[0];if(null==n)return n;n.length>1&&(t=n);const r=e(t);if("object"==typeof r)for(let e=r.length,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return"conversion"in e&&(t.conversion=e.conversion),t}(r),a[e][n].raw=function(e){const t=function(...t){const n=t[0];return null==n?n:(n.length>1&&(t=n),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(r)}))})),e.exports=a},1247:(e,t,n)=>{const r=n(7951);function i(e){const t=function(){const e={},t=Object.keys(r);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}(),n=[e];for(t[e].distance=0;n.length;){const e=n.pop(),i=Object.keys(r[e]);for(let r=i.length,a=0;a<r;a++){const r=i[a],o=t[r];-1===o.distance&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(r))}}return t}function a(e,t){return function(n){return t(e(n))}}function o(e,t){const n=[t[e].parent,e];let i=r[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)n.unshift(t[o].parent),i=a(r[t[o].parent][o],i),o=t[o].parent;return i.conversion=n,i}e.exports=function(e){const t=i(e),n={},r=Object.keys(t);for(let e=r.length,i=0;i<e;i++){const e=r[i];null!==t[e].parent&&(n[e]=o(e,t))}return n}},2880:e=>{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},6250:(e,t,n)=>{var r=n(2880),i=n(6852),a=Object.hasOwnProperty,o=Object.create(null);for(var s in r)a.call(r,s)&&(o[r[s]]=s);var l=e.exports={to:{},get:{}};function c(e,t,n){return Math.min(Math.max(t,e),n)}function u(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}l.get=function(e){var t,n;switch(e.substring(0,3).toLowerCase()){case"hsl":t=l.get.hsl(e),n="hsl";break;case"hwb":t=l.get.hwb(e),n="hwb";break;default:t=l.get.rgb(e),n="rgb"}return t?{model:n,value:t}:null},l.get.rgb=function(e){if(!e)return null;var t,n,i,o=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(i=t[2],t=t[1],n=0;n<3;n++){var s=2*n;o[n]=parseInt(t.slice(s,s+2),16)}i&&(o[3]=parseInt(i,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(i=(t=t[1])[3],n=0;n<3;n++)o[n]=parseInt(t[n]+t[n],16);i&&(o[3]=parseInt(i+i,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)o[n]=parseInt(t[n+1],0);t[4]&&(t[5]?o[3]=.01*parseFloat(t[4]):o[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:a.call(r,t[1])?((o=r[t[1]])[3]=1,o):null:null;for(n=0;n<3;n++)o[n]=Math.round(2.55*parseFloat(t[n+1]));t[4]&&(t[5]?o[3]=.01*parseFloat(t[4]):o[3]=parseFloat(t[4]))}for(n=0;n<3;n++)o[n]=c(o[n],0,255);return o[3]=c(o[3],0,1),o},l.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,c(parseFloat(t[2]),0,100),c(parseFloat(t[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},l.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,c(parseFloat(t[2]),0,100),c(parseFloat(t[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},l.to.hex=function(){var e=i(arguments);return"#"+u(e[0])+u(e[1])+u(e[2])+(e[3]<1?u(Math.round(255*e[3])):"")},l.to.rgb=function(){var e=i(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},l.to.rgb.percent=function(){var e=i(arguments),t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+n+"%, "+r+"%)":"rgba("+t+"%, "+n+"%, "+r+"%, "+e[3]+")"},l.to.hsl=function(){var e=i(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},l.to.hwb=function(){var e=i(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},l.to.keyword=function(e){return o[e.slice(0,3)]}},4308:(e,t,n)=>{const r=n(6250),i=n(8666),a=["keyword","gray","hex"],o={};for(const e of Object.keys(i))o[[...i[e].labels].sort().join("")]=e;const s={};function l(e,t){if(!(this instanceof l))return new l(e,t);if(t&&t in a&&(t=null),t&&!(t in i))throw new Error("Unknown model: "+t);let n,c;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof l)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=r.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,c=i[this.model].channels,this.color=t.value.slice(0,c),this.valpha="number"==typeof t.value[c]?t.value[c]:1}else if(e.length>0){this.model=t||"rgb",c=i[this.model].channels;const n=Array.prototype.slice.call(e,0,c);this.color=p(n,c),this.valpha="number"==typeof e[c]?e[c]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const r=t.sort().join("");if(!(r in o))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=o[r];const{labels:a}=i[this.model],s=[];for(n=0;n<a.length;n++)s.push(e[a[n]]);this.color=p(s)}if(s[this.model])for(c=i[this.model].channels,n=0;n<c;n++){const e=s[this.model][n];e&&(this.color[n]=e(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}l.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in r.to?this:this.rgb();t=t.round("number"==typeof e?e:1);const n=1===t.valpha?t.color:[...t.color,this.valpha];return r.to[t.model](n)},percentString(e){const t=this.rgb().round("number"==typeof e?e:1),n=1===t.valpha?t.color:[...t.color,this.valpha];return r.to.rgb.percent(n)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=i[this.model],{labels:n}=i[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new l([...this.color.map(c(e)),this.valpha],this.model)},alpha(e){return void 0!==e?new l([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:u("rgb",0,d(255)),green:u("rgb",1,d(255)),blue:u("rgb",2,d(255)),hue:u(["hsl","hsv","hsl","hwb","hcg"],0,(e=>(e%360+360)%360)),saturationl:u("hsl",1,d(100)),lightness:u("hsl",2,d(100)),saturationv:u("hsv",1,d(100)),value:u("hsv",2,d(100)),chroma:u("hcg",1,d(100)),gray:u("hcg",2,d(100)),white:u("hwb",1,d(100)),wblack:u("hwb",2,d(100)),cyan:u("cmyk",0,d(100)),magenta:u("cmyk",1,d(100)),yellow:u("cmyk",2,d(100)),black:u("cmyk",3,d(100)),x:u("xyz",0,d(95.047)),y:u("xyz",1,d(100)),z:u("xyz",2,d(108.833)),l:u("lab",0,d(100)),a:u("lab",1),b:u("lab",2),keyword(e){return void 0!==e?new l(e):i[this.model].keyword(this.color)},hex(e){return void 0!==e?new l(e):r.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new l(e);const t=this.rgb().round().color;let n=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===n.length&&(n="0"+n),r.to.hex(t)+n},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[n,r]of e.entries()){const e=r/255;t[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return l.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const n=e.rgb(),r=this.rgb(),i=void 0===t?.5:t,a=2*i-1,o=n.alpha()-r.alpha(),s=((a*o==-1?a:(a+o)/(1+a*o))+1)/2,c=1-s;return l.rgb(s*n.red()+c*r.red(),s*n.green()+c*r.green(),s*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(const e of Object.keys(i)){if(a.includes(e))continue;const{channels:t}=i[e];l.prototype[e]=function(...t){return this.model===e?new l(this):t.length>0?new l(t,e):new l([...(n=i[this.model][e].raw(this.color),Array.isArray(n)?n:[n]),this.valpha],e);var n},l[e]=function(...n){let r=n[0];return"number"==typeof r&&(r=p(n,t)),new l(r,e)}}function c(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}function u(e,t,n){e=Array.isArray(e)?e:[e];for(const r of e)(s[r]||(s[r]=[]))[t]=n;return e=e[0],function(r){let i;return void 0!==r?(n&&(r=n(r)),i=this[e](),i.color[t]=r,i):(i=this[e]().color[t],n&&(i=n(i)),i)}}function d(e){return function(t){return Math.max(0,Math.min(e,t))}}function p(e,t){for(let n=0;n<t;n++)"number"!=typeof e[n]&&(e[n]=0);return e}e.exports=l},2249:function(e,t,n){var r,i,a;i=[],void 0===(a="function"==typeof(r=function(){"use strict";function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function r(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){l(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function i(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,s=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!s?function(e,t,n){var s=o.URL||o.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?a(l):i(l.href)?r(e,t,n):a(l,l.target="_blank")):(l.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(l.href)}),4e4),setTimeout((function(){a(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,n,o){if(n=n||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,o),n);else if(i(e))r(e,n,o);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){a(s)}))}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var a="application/octet-stream"===e.type,l=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||s)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var d=o.URL||o.webkitURL,p=d.createObjectURL(e);i?i.location=p:location.href=p,i=null,setTimeout((function(){d.revokeObjectURL(p)}),4e4)}});o.saveAs=l.saveAs=l,e.exports=l})?r.apply(t,i):r)||(e.exports=a)},7842:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",i=1,a=2,o=9007199254740991,s="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",p="[object Error]",h="[object Function]",f="[object GeneratorFunction]",m="[object Map]",g="[object Number]",y="[object Null]",b="[object Object]",v="[object Promise]",w="[object Proxy]",S="[object RegExp]",E="[object Set]",x="[object String]",O="[object Symbol]",_="[object Undefined]",T="[object WeakMap]",C="[object ArrayBuffer]",k="[object DataView]",P=/^\[object .+?Constructor\]$/,A=/^(?:0|[1-9]\d*)$/,R={};R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R[s]=R[l]=R[C]=R[u]=R[k]=R[d]=R[p]=R[h]=R[m]=R[g]=R[b]=R[S]=R[E]=R[x]=R[T]=!1;var D="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,j="object"==typeof self&&self&&self.Object===Object&&self,I=D||j||Function("return this")(),N=t&&!t.nodeType&&t,L=N&&e&&!e.nodeType&&e,M=L&&L.exports===N,F=M&&D.process,$=function(){try{return F&&F.binding&&F.binding("util")}catch(e){}}(),B=$&&$.isTypedArray;function V(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function U(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function z(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var q,H,G,W=Array.prototype,Q=Function.prototype,K=Object.prototype,Y=I["__core-js_shared__"],X=Q.toString,J=K.hasOwnProperty,Z=(q=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"",ee=K.toString,te=RegExp("^"+X.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=M?I.Buffer:void 0,re=I.Symbol,ie=I.Uint8Array,ae=K.propertyIsEnumerable,oe=W.splice,se=re?re.toStringTag:void 0,le=Object.getOwnPropertySymbols,ce=ne?ne.isBuffer:void 0,ue=(H=Object.keys,G=Object,function(e){return H(G(e))}),de=$e(I,"DataView"),pe=$e(I,"Map"),he=$e(I,"Promise"),fe=$e(I,"Set"),me=$e(I,"WeakMap"),ge=$e(Object,"create"),ye=ze(de),be=ze(pe),ve=ze(he),we=ze(fe),Se=ze(me),Ee=re?re.prototype:void 0,xe=Ee?Ee.valueOf:void 0;function Oe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Te(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Te;++t<n;)this.add(e[t])}function ke(e){var t=this.__data__=new _e(e);this.size=t.size}function Pe(e,t){var n=Ge(e),r=!n&&He(e),i=!n&&!r&&We(e),a=!n&&!r&&!i&&Je(e),o=n||r||i||a,s=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],l=s.length;for(var c in e)!t&&!J.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ue(c,l))||s.push(c);return s}function Ae(e,t){for(var n=e.length;n--;)if(qe(e[n][0],t))return n;return-1}function Re(e){return null==e?void 0===e?_:y:se&&se in Object(e)?function(e){var t=J.call(e,se),n=e[se];try{e[se]=void 0;var r=!0}catch(e){}var i=ee.call(e);r&&(t?e[se]=n:delete e[se]);return i}(e):function(e){return ee.call(e)}(e)}function De(e){return Xe(e)&&Re(e)==s}function je(e,t,n,r,o){return e===t||(null==e||null==t||!Xe(e)&&!Xe(t)?e!=e&&t!=t:function(e,t,n,r,o,c){var h=Ge(e),f=Ge(t),y=h?l:Ve(e),v=f?l:Ve(t),w=(y=y==s?b:y)==b,_=(v=v==s?b:v)==b,T=y==v;if(T&&We(e)){if(!We(t))return!1;h=!0,w=!1}if(T&&!w)return c||(c=new ke),h||Je(e)?Le(e,t,n,r,o,c):function(e,t,n,r,o,s,l){switch(n){case k:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case C:return!(e.byteLength!=t.byteLength||!s(new ie(e),new ie(t)));case u:case d:case g:return qe(+e,+t);case p:return e.name==t.name&&e.message==t.message;case S:case x:return e==t+"";case m:var c=U;case E:var h=r&i;if(c||(c=z),e.size!=t.size&&!h)return!1;var f=l.get(e);if(f)return f==t;r|=a,l.set(e,t);var y=Le(c(e),c(t),r,o,s,l);return l.delete(e),y;case O:if(xe)return xe.call(e)==xe.call(t)}return!1}(e,t,y,n,r,o,c);if(!(n&i)){var P=w&&J.call(e,"__wrapped__"),A=_&&J.call(t,"__wrapped__");if(P||A){var R=P?e.value():e,D=A?t.value():t;return c||(c=new ke),o(R,D,n,r,c)}}if(!T)return!1;return c||(c=new ke),function(e,t,n,r,a,o){var s=n&i,l=Me(e),c=l.length,u=Me(t),d=u.length;if(c!=d&&!s)return!1;var p=c;for(;p--;){var h=l[p];if(!(s?h in t:J.call(t,h)))return!1}var f=o.get(e);if(f&&o.get(t))return f==t;var m=!0;o.set(e,t),o.set(t,e);var g=s;for(;++p<c;){var y=e[h=l[p]],b=t[h];if(r)var v=s?r(b,y,h,t,e,o):r(y,b,h,e,t,o);if(!(void 0===v?y===b||a(y,b,n,r,o):v)){m=!1;break}g||(g="constructor"==h)}if(m&&!g){var w=e.constructor,S=t.constructor;w==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof S&&S instanceof S||(m=!1)}return o.delete(e),o.delete(t),m}(e,t,n,r,o,c)}(e,t,n,r,je,o))}function Ie(e){return!(!Ye(e)||function(e){return!!Z&&Z in e}(e))&&(Qe(e)?te:P).test(ze(e))}function Ne(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||K,t!==r)return ue(e);var t,n,r,i=[];for(var a in Object(e))J.call(e,a)&&"constructor"!=a&&i.push(a);return i}function Le(e,t,n,r,o,s){var l=n&i,c=e.length,u=t.length;if(c!=u&&!(l&&u>c))return!1;var d=s.get(e);if(d&&s.get(t))return d==t;var p=-1,h=!0,f=n&a?new Ce:void 0;for(s.set(e,t),s.set(t,e);++p<c;){var m=e[p],g=t[p];if(r)var y=l?r(g,m,p,t,e,s):r(m,g,p,e,t,s);if(void 0!==y){if(y)continue;h=!1;break}if(f){if(!V(t,(function(e,t){if(i=t,!f.has(i)&&(m===e||o(m,e,n,r,s)))return f.push(t);var i}))){h=!1;break}}else if(m!==g&&!o(m,g,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Me(e){return function(e,t,n){var r=t(e);return Ge(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,Ze,Be)}function Fe(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function $e(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ie(n)?n:void 0}Oe.prototype.clear=function(){this.__data__=ge?ge(null):{},this.size=0},Oe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Oe.prototype.get=function(e){var t=this.__data__;if(ge){var n=t[e];return n===r?void 0:n}return J.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ge?void 0!==t[e]:J.call(t,e)},Oe.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ge&&void 0===t?r:t,this},_e.prototype.clear=function(){this.__data__=[],this.size=0},_e.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():oe.call(t,n,1),--this.size,!0)},_e.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},_e.prototype.has=function(e){return Ae(this.__data__,e)>-1},_e.prototype.set=function(e,t){var n=this.__data__,r=Ae(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Te.prototype.clear=function(){this.size=0,this.__data__={hash:new Oe,map:new(pe||_e),string:new Oe}},Te.prototype.delete=function(e){var t=Fe(this,e).delete(e);return this.size-=t?1:0,t},Te.prototype.get=function(e){return Fe(this,e).get(e)},Te.prototype.has=function(e){return Fe(this,e).has(e)},Te.prototype.set=function(e,t){var n=Fe(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Ce.prototype.add=Ce.prototype.push=function(e){return this.__data__.set(e,r),this},Ce.prototype.has=function(e){return this.__data__.has(e)},ke.prototype.clear=function(){this.__data__=new _e,this.size=0},ke.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ke.prototype.get=function(e){return this.__data__.get(e)},ke.prototype.has=function(e){return this.__data__.has(e)},ke.prototype.set=function(e,t){var n=this.__data__;if(n instanceof _e){var r=n.__data__;if(!pe||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Te(r)}return n.set(e,t),this.size=n.size,this};var Be=le?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}(le(e),(function(t){return ae.call(e,t)})))}:function(){return[]},Ve=Re;function Ue(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||A.test(e))&&e>-1&&e%1==0&&e<t}function ze(e){if(null!=e){try{return X.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function qe(e,t){return e===t||e!=e&&t!=t}(de&&Ve(new de(new ArrayBuffer(1)))!=k||pe&&Ve(new pe)!=m||he&&Ve(he.resolve())!=v||fe&&Ve(new fe)!=E||me&&Ve(new me)!=T)&&(Ve=function(e){var t=Re(e),n=t==b?e.constructor:void 0,r=n?ze(n):"";if(r)switch(r){case ye:return k;case be:return m;case ve:return v;case we:return E;case Se:return T}return t});var He=De(function(){return arguments}())?De:function(e){return Xe(e)&&J.call(e,"callee")&&!ae.call(e,"callee")},Ge=Array.isArray;var We=ce||function(){return!1};function Qe(e){if(!Ye(e))return!1;var t=Re(e);return t==h||t==f||t==c||t==w}function Ke(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function Ye(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Xe(e){return null!=e&&"object"==typeof e}var Je=B?function(e){return function(t){return e(t)}}(B):function(e){return Xe(e)&&Ke(e.length)&&!!R[Re(e)]};function Ze(e){return null!=(t=e)&&Ke(t.length)&&!Qe(t)?Pe(e):Ne(e);var t}e.exports=function(e,t){return je(e,t)}},1664:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var a,o,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var c in a=Object(arguments[l]))n.call(a,c)&&(s[c]=a[c]);if(t){o=t(a);for(var u=0;u<o.length;u++)r.call(a,o[u])&&(s[o[u]]=a[o[u]])}}return s}},362:(e,t,n)=>{"use strict";var r=n(6441);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,a,o){if(o!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},2688:(e,t,n)=>{e.exports=n(362)()},6441:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},585:(e,t,n)=>{"use strict";e.exports=n(5481)},3804:(e,t,n)=>{"use strict";var r=t,i=n(2775),a=n(6866);function o(e,t,n,r){var a=!1;if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",r);for(var o=t.resolvedType.values,s=Object.keys(o),l=0;l<s.length;++l)o[s[l]]!==t.typeDefault||a||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',r,r,r),t.repeated||e("break"),a=!0),e("case%j:",s[l])("case %i:",o[s[l]])("m%s=%j",r,o[s[l]])("break");e("}")}else e('if(typeof d%s!=="object")',r)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",r,n,r);else{var c=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",r,r);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",r,r,c)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length >= 0)",r)("m%s=d%s",r,r);break;case"string":e("m%s=String(d%s)",r,r);break;case"bool":e("m%s=Boolean(d%s)",r,r)}}return e}function s(e,t,n,r){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",r,n,r,r,n,r,r):e("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var a=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":a=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,r,r,r,a?"true":"",r);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,r,r,r,r);break;default:e("d%s=m%s",r,r)}}return e}r.fromObject=function(e){var t=e.fieldsArray,n=a.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r<t.length;++r){var s=t[r].resolve(),l=a.safeProp(s.name);s.map?(n("if(d%s){",l)('if(typeof d%s!=="object")',l)("throw TypeError(%j)",s.fullName+": object expected")("m%s={}",l)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",l),o(n,s,r,l+"[ks[i]]")("}")("}")):s.repeated?(n("if(d%s){",l)("if(!Array.isArray(d%s))",l)("throw TypeError(%j)",s.fullName+": array expected")("m%s=[]",l)("for(var i=0;i<d%s.length;++i){",l),o(n,s,r,l+"[i]")("}")("}")):(s.resolvedType instanceof i||n("if(d%s!=null){",l),o(n,s,r,l),s.resolvedType instanceof i||n("}"))}return n("return m")},r.toObject=function(e){var t=e.fieldsArray.slice().sort(a.compareFieldsById);if(!t.length)return a.codegen()("return {}");for(var n=a.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],o=[],l=[],c=0;c<t.length;++c)t[c].partOf||(t[c].resolve().repeated?r:t[c].map?o:l).push(t[c]);if(r.length){for(n("if(o.arrays||o.defaults){"),c=0;c<r.length;++c)n("d%s=[]",a.safeProp(r[c].name));n("}")}if(o.length){for(n("if(o.objects||o.defaults){"),c=0;c<o.length;++c)n("d%s={}",a.safeProp(o[c].name));n("}")}if(l.length){for(n("if(o.defaults){"),c=0;c<l.length;++c){var u=l[c],d=a.safeProp(u.name);if(u.resolvedType instanceof i)n("d%s=o.enums===String?%j:%j",d,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",d)("}else")("d%s=o.longs===String?%j:%i",d,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var p="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";n("if(o.bytes===String)d%s=%j",d,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",d,p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",d,d)("}")}else n("d%s=%j",d,u.typeDefault)}n("}")}var h=!1;for(c=0;c<t.length;++c){u=t[c];var f=e._fieldsArray.indexOf(u);d=a.safeProp(u.name);u.map?(h||(h=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",d,d)("d%s={}",d)("for(var j=0;j<ks2.length;++j){"),s(n,u,f,d+"[ks2[j]]")("}")):u.repeated?(n("if(m%s&&m%s.length){",d,d)("d%s=[]",d)("for(var j=0;j<m%s.length;++j){",d),s(n,u,f,d+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",d,u.name),s(n,u,f,d),u.partOf&&n("if(o.oneofs)")("d%s=%j",a.safeProp(u.partOf.name),u.name)),n("}")}return n("return d")}},9980:(e,t,n)=>{"use strict";e.exports=function(e){var t=a.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var n=0;n<e.fieldsArray.length;++n){var s=e._fieldsArray[n].resolve(),l=s.resolvedType instanceof r?"int32":s.type,c="m"+a.safeProp(s.name);t("case %i: {",s.id),s.map?(t("if(%s===util.emptyObject)",c)("%s={}",c)("var c2 = r.uint32()+r.pos"),void 0!==i.defaults[s.keyType]?t("k=%j",i.defaults[s.keyType]):t("k=null"),void 0!==i.defaults[l]?t("value=%j",i.defaults[l]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",s.keyType)("case 2:"),void 0===i.basic[l]?t("value=types[%i].decode(r,r.uint32())",n):t("value=r.%s()",l),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[s.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',c):t("%s[k]=value",c)):s.repeated?(t("if(!(%s&&%s.length))",c,c)("%s=[]",c),void 0!==i.packed[l]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",c,l)("}else"),void 0===i.basic[l]?t(s.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",c,n):t("%s.push(r.%s())",c,l)):void 0===i.basic[l]?t(s.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",c,n):t("%s=r.%s()",c,l),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),n=0;n<e._fieldsArray.length;++n){var u=e._fieldsArray[n];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",o(u))}return t("return m")};var r=n(2775),i=n(1517),a=n(6866);function o(e){return"missing required '"+e.name+"'"}},8852:(e,t,n)=>{"use strict";e.exports=function(e){for(var t,n=a.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),s=e.fieldsArray.slice().sort(a.compareFieldsById),l=0;l<s.length;++l){var c=s[l].resolve(),u=e._fieldsArray.indexOf(c),d=c.resolvedType instanceof r?"int32":c.type,p=i.basic[d];t="m"+a.safeProp(c.name),c.map?(n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,c.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(c.id<<3|2)>>>0,8|i.mapKey[c.keyType],c.keyType),void 0===p?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|p,d,t),n("}")("}")):c.repeated?(n("if(%s!=null&&%s.length){",t,t),c.packed&&void 0!==i.packed[d]?n("w.uint32(%i).fork()",(c.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",d,t)("w.ldelim()"):(n("for(var i=0;i<%s.length;++i)",t),void 0===p?o(n,c,u,t+"[i]"):n("w.uint32(%i).%s(%s[i])",(c.id<<3|p)>>>0,d,t)),n("}")):(c.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,c.name),void 0===p?o(n,c,u,t):n("w.uint32(%i).%s(%s)",(c.id<<3|p)>>>0,d,t))}return n("return w")};var r=n(2775),i=n(1517),a=n(6866);function o(e,t,n,r){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(t.id<<3|2)>>>0)}},2775:(e,t,n)=>{"use strict";e.exports=o;var r=n(4349);((o.prototype=Object.create(r.prototype)).constructor=o).className="Enum";var i=n(2815),a=n(6866);function o(e,t,n,i,a,o){if(r.call(this,e,n),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=a||{},this.valuesOptions=o,this.reserved=void 0,t)for(var s=Object.keys(t),l=0;l<s.length;++l)"number"==typeof t[s[l]]&&(this.valuesById[this.values[s[l]]=t[s[l]]]=s[l])}o.fromJSON=function(e,t){var n=new o(e,t.values,t.options,t.comment,t.comments);return n.reserved=t.reserved,n},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,n,r){if(!a.isString(e))throw TypeError("name must be a string");if(!a.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return r&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=r||null),this.comments[e]=n||null,this},o.prototype.remove=function(e){if(!a.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},o.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},3796:(e,t,n)=>{"use strict";e.exports=c;var r=n(4349);((c.prototype=Object.create(r.prototype)).constructor=c).className="Field";var i,a=n(2775),o=n(1517),s=n(6866),l=/^required|optional|repeated$/;function c(e,t,n,i,a,c,u){if(s.isObject(i)?(u=a,c=i,i=a=void 0):s.isObject(a)&&(u=c,c=a,a=void 0),r.call(this,e,c),!s.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!s.isString(n))throw TypeError("type must be a string");if(void 0!==i&&!l.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==a&&!s.isString(a))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=n,this.id=t,this.extend=a||void 0,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!s.Long&&void 0!==o.long[n],this.bytes="bytes"===n,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}c.fromJSON=function(e,t){return new c(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(c.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),c.prototype.setOption=function(e,t,n){return"packed"===e&&(this._packed=null),r.prototype.setOption.call(this,e,t,n)},c.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof a&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof a)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=s.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;s.base64.test(this.typeDefault)?s.base64.decode(this.typeDefault,e=s.newBuffer(s.base64.length(this.typeDefault)),0):s.utf8.write(this.typeDefault,e=s.newBuffer(s.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=s.emptyObject:this.repeated?this.defaultValue=s.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),r.prototype.resolve.call(this)},c.d=function(e,t,n,r){return"function"==typeof t?t=s.decorateType(t).name:t&&"object"==typeof t&&(t=s.decorateEnum(t).name),function(i,a){s.decorateType(i.constructor).add(new c(a,e,t,n,{default:r}))}},c._configure=function(e){i=e}},5481:(e,t,n)=>{"use strict";var r=e.exports=n(7134);r.build="light",r.load=function(e,t,n){return"function"==typeof t?(n=t,t=new r.Root):t||(t=new r.Root),t.load(e,n)},r.loadSync=function(e,t){return t||(t=new r.Root),t.loadSync(e)},r.encoder=n(8852),r.decoder=n(9980),r.verifier=n(3040),r.converter=n(3804),r.ReflectionObject=n(4349),r.Namespace=n(2815),r.Root=n(8038),r.Enum=n(2775),r.Type=n(6),r.Field=n(3796),r.OneOf=n(8957),r.MapField=n(9504),r.Service=n(6467),r.Method=n(3055),r.Message=n(9e3),r.wrappers=n(6942),r.types=n(1517),r.util=n(6866),r.ReflectionObject._configure(r.Root),r.Namespace._configure(r.Type,r.Service,r.Enum),r.Root._configure(r.Type),r.Field._configure(r.Type)},7134:(e,t,n)=>{"use strict";var r=t;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(4301),r.BufferWriter=n(8422),r.Reader=n(1137),r.BufferReader=n(4010),r.util=n(5382),r.rpc=n(9691),r.roots=n(381),r.configure=i,i()},9504:(e,t,n)=>{"use strict";e.exports=o;var r=n(3796);((o.prototype=Object.create(r.prototype)).constructor=o).className="MapField";var i=n(1517),a=n(6866);function o(e,t,n,i,o,s){if(r.call(this,e,t,i,void 0,void 0,o,s),!a.isString(n))throw TypeError("keyType must be a string");this.keyType=n,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return r.prototype.resolve.call(this)},o.d=function(e,t,n){return"function"==typeof n?n=a.decorateType(n).name:n&&"object"==typeof n&&(n=a.decorateEnum(n).name),function(r,i){a.decorateType(r.constructor).add(new o(i,e,t,n))}}},9e3:(e,t,n)=>{"use strict";e.exports=i;var r=n(5382);function i(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)this[t[n]]=e[t[n]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,r.toJSONOptions)}},3055:(e,t,n)=>{"use strict";e.exports=a;var r=n(4349);((a.prototype=Object.create(r.prototype)).constructor=a).className="Method";var i=n(6866);function a(e,t,n,a,o,s,l,c,u){if(i.isObject(o)?(l=o,o=s=void 0):i.isObject(s)&&(l=s,s=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(n))throw TypeError("requestType must be a string");if(!i.isString(a))throw TypeError("responseType must be a string");r.call(this,e,l),this.type=t||"rpc",this.requestType=n,this.requestStream=!!o||void 0,this.responseType=a,this.responseStream=!!s||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=c,this.parsedOptions=u}a.fromJSON=function(e,t){return new a(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},a.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},a.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),r.prototype.resolve.call(this))}},2815:(e,t,n)=>{"use strict";e.exports=d;var r=n(4349);((d.prototype=Object.create(r.prototype)).constructor=d).className="Namespace";var i,a,o,s=n(3796),l=n(6866),c=n(8957);function u(e,t){if(e&&e.length){for(var n={},r=0;r<e.length;++r)n[e[r].name]=e[r].toJSON(t);return n}}function d(e,t){r.call(this,e,t),this.nested=void 0,this._nestedArray=null}function p(e){return e._nestedArray=null,e}d.fromJSON=function(e,t){return new d(e,t.options).addJSON(t.nested)},d.arrayToJSON=u,d.isReservedId=function(e,t){if(e)for(var n=0;n<e.length;++n)if("string"!=typeof e[n]&&e[n][0]<=t&&e[n][1]>t)return!0;return!1},d.isReservedName=function(e,t){if(e)for(var n=0;n<e.length;++n)if(e[n]===t)return!0;return!1},Object.defineProperty(d.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=l.toArray(this.nested))}}),d.prototype.toJSON=function(e){return l.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},d.prototype.addJSON=function(e){if(e)for(var t,n=Object.keys(e),r=0;r<n.length;++r)t=e[n[r]],this.add((void 0!==t.fields?i.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?a.fromJSON:void 0!==t.id?s.fromJSON:d.fromJSON)(n[r],t));return this},d.prototype.get=function(e){return this.nested&&this.nested[e]||null},d.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},d.prototype.add=function(e){if(!(e instanceof s&&void 0!==e.extend||e instanceof i||e instanceof c||e instanceof o||e instanceof a||e instanceof d))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof d&&e instanceof d)||t instanceof i||t instanceof a)throw Error("duplicate name '"+e.name+"' in "+this);for(var n=t.nestedArray,r=0;r<n.length;++r)e.add(n[r]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),p(this)},d.prototype.remove=function(e){if(!(e instanceof r))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),p(this)},d.prototype.define=function(e,t){if(l.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var n=this;e.length>0;){var r=e.shift();if(n.nested&&n.nested[r]){if(!((n=n.nested[r])instanceof d))throw Error("path conflicts with non-namespace objects")}else n.add(n=new d(r))}return t&&n.addJSON(t),n},d.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof d?e[t++].resolveAll():e[t++].resolve();return this.resolve()},d.prototype.lookup=function(e,t,n){if("boolean"==typeof t?(n=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),l.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var r=this.get(e[0]);if(r){if(1===e.length){if(!t||t.indexOf(r.constructor)>-1)return r}else if(r instanceof d&&(r=r.lookup(e.slice(1),t,!0)))return r}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof d&&(r=this._nestedArray[i].lookup(e,t,!0)))return r;return null===this.parent||n?null:this.parent.lookup(e,t)},d.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},d.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},d.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},d.prototype.lookupService=function(e){var t=this.lookup(e,[a]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},d._configure=function(e,t,n){i=e,a=t,o=n}},4349:(e,t,n)=>{"use strict";e.exports=a,a.className="ReflectionObject";var r,i=n(6866);function a(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(a.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),a.prototype.toJSON=function(){throw Error()},a.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof r&&t._handleAdd(this)},a.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},a.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},a.prototype.getOption=function(e){if(this.options)return this.options[e]},a.prototype.setOption=function(e,t,n){return n&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},a.prototype.setParsedOption=function(e,t,n){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(n){var a=r.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(a){var o=a[e];i.setProperty(o,n,t)}else(a={})[e]=i.setProperty({},n,t),r.push(a)}else{var s={};s[e]=t,r.push(s)}return this},a.prototype.setOptions=function(e,t){if(e)for(var n=Object.keys(e),r=0;r<n.length;++r)this.setOption(n[r],e[n[r]],t);return this},a.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},a._configure=function(e){r=e}},8957:(e,t,n)=>{"use strict";e.exports=o;var r=n(4349);((o.prototype=Object.create(r.prototype)).constructor=o).className="OneOf";var i=n(3796),a=n(6866);function o(e,t,n,i){if(Array.isArray(t)||(n=t,t=void 0),r.call(this,e,n),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function s(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,s(this),this},o.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){r.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var n=e.get(this.oneof[t]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}s(this)},o.prototype.onRemove=function(e){for(var t,n=0;n<this.fieldsArray.length;++n)(t=this.fieldsArray[n]).parent&&t.parent.remove(t);r.prototype.onRemove.call(this,e)},o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,n){a.decorateType(t.constructor).add(new o(n,e)),Object.defineProperty(t,n,{get:a.oneOfGetter(e),set:a.oneOfSetter(e)})}}},1137:(e,t,n)=>{"use strict";e.exports=l;var r,i=n(5382),a=i.LongBits,o=i.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},d=function(){return i.Buffer?function(e){return(l.create=function(e){return i.Buffer.isBuffer(e)?new r(e):u(e)})(e)}:u};function p(){var e=new a(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw s(this,8);return new a(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}l.create=d(),l.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return h(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|h(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw s(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,n);if(t===n){var r=i.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,n)},l.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},l.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},l._configure=function(e){r=e,l.create=d(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(l.prototype,{int64:function(){return p.call(this)[t](!1)},uint64:function(){return p.call(this)[t](!0)},sint64:function(){return p.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},4010:(e,t,n)=>{"use strict";e.exports=a;var r=n(1137);(a.prototype=Object.create(r.prototype)).constructor=a;var i=n(5382);function a(e){r.call(this,e)}a._configure=function(){i.Buffer&&(a.prototype._slice=i.Buffer.prototype.slice)},a.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},a._configure()},8038:(e,t,n)=>{"use strict";e.exports=d;var r=n(2815);((d.prototype=Object.create(r.prototype)).constructor=d).className="Root";var i,a,o,s=n(3796),l=n(2775),c=n(8957),u=n(6866);function d(e){r.call(this,"",e),this.deferred=[],this.files=[]}function p(){}d.fromJSON=function(e,t){return t||(t=new d),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},d.prototype.resolvePath=u.path.resolve,d.prototype.fetch=u.fetch,d.prototype.load=function e(t,n,r){"function"==typeof n&&(r=n,n=void 0);var i=this;if(!r)return u.asPromise(e,i,t,n);var s=r===p;function l(e,t){if(r){if(s)throw e;var n=r;r=null,n(e,t)}}function c(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var n=e.substring(t);if(n in o)return n}return null}function d(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){a.filename=e;var r,o=a(t,i,n),d=0;if(o.imports)for(;d<o.imports.length;++d)(r=c(o.imports[d])||i.resolvePath(e,o.imports[d]))&&h(r);if(o.weakImports)for(d=0;d<o.weakImports.length;++d)(r=c(o.weakImports[d])||i.resolvePath(e,o.weakImports[d]))&&h(r,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(e){l(e)}s||f||l(null,i)}function h(e,t){if(e=c(e)||e,!(i.files.indexOf(e)>-1))if(i.files.push(e),e in o)s?d(e,o[e]):(++f,setTimeout((function(){--f,d(e,o[e])})));else if(s){var n;try{n=u.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||l(e))}d(e,n)}else++f,i.fetch(e,(function(n,a){--f,r&&(n?t?f||l(null,i):l(n):d(e,a))}))}var f=0;u.isString(t)&&(t=[t]);for(var m,g=0;g<t.length;++g)(m=i.resolvePath("",t[g]))&&h(m);if(s)return i;f||l(null,i)},d.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,p)},d.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return r.prototype.resolveAll.call(this)};var h=/^[A-Z]/;function f(e,t){var n=t.parent.lookup(t.extend);if(n){var r=new s(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.get(r.name)||(r.declaringField=t,t.extensionField=r,n.add(r)),!0}return!1}d.prototype._handleAdd=function(e){if(e instanceof s)void 0===e.extend||e.extensionField||f(0,e)||this.deferred.push(e);else if(e instanceof l)h.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof c)){if(e instanceof i)for(var t=0;t<this.deferred.length;)f(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);h.test(e.name)&&(e.parent[e.name]=e)}},d.prototype._handleRemove=function(e){if(e instanceof s){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof l)h.test(e.name)&&delete e.parent[e.name];else if(e instanceof r){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);h.test(e.name)&&delete e.parent[e.name]}},d._configure=function(e,t,n){i=e,a=t,o=n}},381:e=>{"use strict";e.exports={}},9691:(e,t,n)=>{"use strict";t.Service=n(4447)},4447:(e,t,n)=>{"use strict";e.exports=i;var r=n(5382);function i(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,a,o){if(!a)throw TypeError("request must be specified");var s=this;if(!o)return r.asPromise(e,s,t,n,i,a);if(s.rpcImpl)try{return s.rpcImpl(t,n[s.requestDelimited?"encodeDelimited":"encode"](a).finish(),(function(e,n){if(e)return s.emit("error",e,t),o(e);if(null!==n){if(!(n instanceof i))try{n=i[s.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return s.emit("error",e,t),o(e)}return s.emit("data",n,t),o(null,n)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){o(e)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},6467:(e,t,n)=>{"use strict";e.exports=s;var r=n(2815);((s.prototype=Object.create(r.prototype)).constructor=s).className="Service";var i=n(3055),a=n(6866),o=n(9691);function s(e,t){r.call(this,e,t),this.methods={},this._methodsArray=null}function l(e){return e._methodsArray=null,e}s.fromJSON=function(e,t){var n=new s(e,t.options);if(t.methods)for(var r=Object.keys(t.methods),a=0;a<r.length;++a)n.add(i.fromJSON(r[a],t.methods[r[a]]));return t.nested&&n.addJSON(t.nested),n.comment=t.comment,n},s.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return a.toObject(["options",t&&t.options||void 0,"methods",r.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",n?this.comment:void 0])},Object.defineProperty(s.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=a.toArray(this.methods))}}),s.prototype.get=function(e){return this.methods[e]||r.prototype.get.call(this,e)},s.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return r.prototype.resolve.call(this)},s.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,l(this)):r.prototype.add.call(this,e)},s.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,l(this)}return r.prototype.remove.call(this,e)},s.prototype.create=function(e,t,n){for(var r,i=new o.Service(e,t,n),s=0;s<this.methodsArray.length;++s){var l=a.lcFirst((r=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");i[l]=a.codegen(["r","c"],a.isReserved(l)?l+"_":l)("return this.rpcCall(m,q,s,r,c)")({m:r,q:r.resolvedRequestType.ctor,s:r.resolvedResponseType.ctor})}return i}},6:(e,t,n)=>{"use strict";e.exports=b;var r=n(2815);((b.prototype=Object.create(r.prototype)).constructor=b).className="Type";var i=n(2775),a=n(8957),o=n(3796),s=n(9504),l=n(6467),c=n(9e3),u=n(1137),d=n(4301),p=n(6866),h=n(8852),f=n(9980),m=n(3040),g=n(3804),y=n(6942);function b(e,t){r.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function v(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var n=this.fields[e[t]],r=n.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=n}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=p.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=p.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=b.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof c||((e.prototype=new c).constructor=e,p.merge(e.prototype,t)),e.$type=e.prototype.$type=this,p.merge(e,c,!0),this._ctor=e;for(var n=0;n<this.fieldsArray.length;++n)this._fieldsArray[n].resolve();var r={};for(n=0;n<this.oneofsArray.length;++n)r[this._oneofsArray[n].resolve().name]={get:p.oneOfGetter(this._oneofsArray[n].oneof),set:p.oneOfSetter(this._oneofsArray[n].oneof)};n&&Object.defineProperties(e.prototype,r)}}}),b.generateConstructor=function(e){for(var t,n=p.codegen(["p"],e.name),r=0;r<e.fieldsArray.length;++r)(t=e._fieldsArray[r]).map?n("this%s={}",p.safeProp(t.name)):t.repeated&&n("this%s=[]",p.safeProp(t.name));return n("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},b.fromJSON=function(e,t){var n=new b(e,t.options);n.extensions=t.extensions,n.reserved=t.reserved;for(var c=Object.keys(t.fields),u=0;u<c.length;++u)n.add((void 0!==t.fields[c[u]].keyType?s.fromJSON:o.fromJSON)(c[u],t.fields[c[u]]));if(t.oneofs)for(c=Object.keys(t.oneofs),u=0;u<c.length;++u)n.add(a.fromJSON(c[u],t.oneofs[c[u]]));if(t.nested)for(c=Object.keys(t.nested),u=0;u<c.length;++u){var d=t.nested[c[u]];n.add((void 0!==d.id?o.fromJSON:void 0!==d.fields?b.fromJSON:void 0!==d.values?i.fromJSON:void 0!==d.methods?l.fromJSON:r.fromJSON)(c[u],d))}return t.extensions&&t.extensions.length&&(n.extensions=t.extensions),t.reserved&&t.reserved.length&&(n.reserved=t.reserved),t.group&&(n.group=!0),t.comment&&(n.comment=t.comment),n},b.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return p.toObject(["options",t&&t.options||void 0,"oneofs",r.arrayToJSON(this.oneofsArray,e),"fields",r.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",n?this.comment:void 0])},b.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var n=this.oneofsArray;for(t=0;t<n.length;)n[t++].resolve();return r.prototype.resolveAll.call(this)},b.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},b.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),v(this)}return e instanceof a?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),v(this)):r.prototype.add.call(this,e)},b.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),v(this)}if(e instanceof a){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),v(this)}return r.prototype.remove.call(this,e)},b.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},b.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)},b.prototype.create=function(e){return new this.ctor(e)},b.prototype.setup=function(){for(var e=this.fullName,t=[],n=0;n<this.fieldsArray.length;++n)t.push(this._fieldsArray[n].resolve().resolvedType);this.encode=h(this)({Writer:d,types:t,util:p}),this.decode=f(this)({Reader:u,types:t,util:p}),this.verify=m(this)({types:t,util:p}),this.fromObject=g.fromObject(this)({types:t,util:p}),this.toObject=g.toObject(this)({types:t,util:p});var r=y[e];if(r){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=r.fromObject.bind(i),i.toObject=this.toObject,this.toObject=r.toObject.bind(i)}return this},b.prototype.encode=function(e,t){return this.setup().encode(e,t)},b.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},b.prototype.decode=function(e,t){return this.setup().decode(e,t)},b.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},b.prototype.verify=function(e){return this.setup().verify(e)},b.prototype.fromObject=function(e){return this.setup().fromObject(e)},b.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},b.d=function(e){return function(t){p.decorateType(t,e)}}},1517:(e,t,n)=>{"use strict";var r=t,i=n(6866),a=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var n=0,r={};for(t|=0;n<e.length;)r[a[n+t]]=e[n++];return r}r.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),r.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),r.long=o([0,0,0,1,1],7),r.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),r.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},6866:(e,t,n)=>{"use strict";var r,i,a=e.exports=n(5382),o=n(381);a.codegen=n(7669),a.fetch=n(9240),a.path=n(2459),a.fs=a.inquire("fs"),a.toArray=function(e){if(e){for(var t=Object.keys(e),n=new Array(t.length),r=0;r<t.length;)n[r]=e[t[r++]];return n}return[]},a.toObject=function(e){for(var t={},n=0;n<e.length;){var r=e[n++],i=e[n++];void 0!==i&&(t[r]=i)}return t};var s=/\\/g,l=/"/g;a.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},a.safeProp=function(e){return!/^[$\w_]+$/.test(e)||a.isReserved(e)?'["'+e.replace(s,"\\\\").replace(l,'\\"')+'"]':"."+e},a.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var c=/_([a-z])/g;a.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(c,(function(e,t){return t.toUpperCase()}))},a.compareFieldsById=function(e,t){return e.id-t.id},a.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(a.decorateRoot.remove(e.$type),e.$type.name=t,a.decorateRoot.add(e.$type)),e.$type;r||(r=n(6));var i=new r(t||e.name);return a.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var u=0;a.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=n(2775));var t=new i("Enum"+u++,e);return a.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},a.setProperty=function(e,t,n){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,n,r){var i=n.shift();if("__proto__"===i||"prototype"===i)return t;if(n.length>0)t[i]=e(t[i]||{},n,r);else{var a=t[i];a&&(r=[].concat(a).concat(r)),t[i]=r}return t}(e,t=t.split("."),n)},Object.defineProperty(a,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(n(8038)))}})},5003:(e,t,n)=>{"use strict";e.exports=i;var r=n(5382);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var a=i.zero=new i(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return a;var t=e<0;t&&(e=-e);var n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):a},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?a:new i((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},5382:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function a(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}r.asPromise=n(6233),r.base64=n(1979),r.EventEmitter=n(3474),r.float=n(5750),r.inquire=n(1925),r.utf8=n(2971),r.pool=n(4226),r.LongBits=n(5003),r.isNode=Boolean(void 0!==n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=a,r.ProtocolError=a("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},3040:(e,t,n)=>{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),n=e.oneofsArray,r={};n.length&&t("var p={}");for(var l=0;l<e.fieldsArray.length;++l){var c=e._fieldsArray[l].resolve(),u="m"+i.safeProp(c.name);if(c.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,c.name),c.map)t("if(!util.isObject(%s))",u)("return%j",a(c,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),s(t,c,"k[i]"),o(t,c,l,u+"[k[i]]")("}");else if(c.repeated)t("if(!Array.isArray(%s))",u)("return%j",a(c,"array"))("for(var i=0;i<%s.length;++i){",u),o(t,c,l,u+"[i]")("}");else{if(c.partOf){var d=i.safeProp(c.partOf.name);1===r[c.partOf.name]&&t("if(p%s===1)",d)("return%j",c.partOf.name+": multiple values"),r[c.partOf.name]=1,t("p%s=1",d)}o(t,c,l,u)}c.optional&&t("}")}return t("return null")};var r=n(2775),i=n(6866);function a(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,n,i){if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(%s){",i)("default:")("return%j",a(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),s=0;s<o.length;++s)e("case %i:",t.resolvedType.values[o[s]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",n,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",a(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",a(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",a(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",a(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",a(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",a(t,"buffer"))}return e}function s(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",a(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",a(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",a(t,"boolean key"))}return e}},6942:(e,t,n)=>{"use strict";var r=t,i=n(9e3);r[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),n=this.lookup(t);if(n){var r="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===r.indexOf("/")&&(r="/"+r),this.create({type_url:r,value:n.encode(n.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",r="";if(t&&t.json&&e.type_url&&e.value){r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var a=this.lookup(r);a&&(e=a.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var o=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),r=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=r,o}return this.toObject(e,t)}}},4301:(e,t,n)=>{"use strict";e.exports=d;var r,i=n(5382),a=i.LongBits,o=i.base64,s=i.utf8;function l(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function c(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var p=function(){return i.Buffer?function(){return(d.create=function(){return new r})()}:function(){return new d}};function h(e,t,n){t[n]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function m(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}d.create=p(),d.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(d.alloc=i.pool(d.alloc,i.Array.prototype.subarray)),d.prototype._push=function(e,t,n){return this.tail=this.tail.next=new l(e,t,n),this.len+=t,this},f.prototype=Object.create(l.prototype),f.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this._push(m,10,a.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=a.from(e);return this._push(m,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=a.from(e).zzEncode();return this._push(m,t.length(),t)},d.prototype.bool=function(e){return this._push(h,1,e?1:0)},d.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=a.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var y=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(h,1,0);if(i.isString(e)){var n=d.alloc(t=o.length(e));o.decode(e,n,0),e=n}return this.uint32(t)._push(y,t,e)},d.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t)._push(s.write,t,e):this._push(h,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new l(c,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},d.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},d._configure=function(e){r=e,d.create=p(),r._configure()}},8422:(e,t,n)=>{"use strict";e.exports=a;var r=n(4301);(a.prototype=Object.create(r.prototype)).constructor=a;var i=n(5382);function a(){r.call(this)}function o(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}a._configure=function(){a.alloc=i._Buffer_allocUnsafe,a.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},a.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(a.writeBytesBuffer,t,e),this},a.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},a._configure()},9111:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return u.default}}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(5959)),i=p(n(2688)),a=p(n(8398)),o=p(n(8262)),s=n(2837),l=n(402),c=n(6732),u=p(n(1060)),d=p(n(7988));function p(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function m(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class g extends r.Component{static getDerivedStateFromProps(e,t){let{position:n}=e,{prevPropsPosition:r}=t;return!n||r&&n.x===r.x&&n.y===r.y?null:((0,d.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:{...n}})}constructor(e){super(e),m(this,"onDragStart",((e,t)=>{(0,d.default)("Draggable: onDragStart: %j",t);if(!1===this.props.onStart(e,(0,l.createDraggableData)(this,t)))return!1;this.setState({dragging:!0,dragged:!0})})),m(this,"onDrag",((e,t)=>{if(!this.state.dragging)return!1;(0,d.default)("Draggable: onDrag: %j",t);const n=(0,l.createDraggableData)(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){const{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;const[i,a]=(0,l.getBoundPosition)(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(!1===this.props.onDrag(e,n))return!1;this.setState(r)})),m(this,"onDragStop",((e,t)=>{if(!this.state.dragging)return!1;if(!1===this.props.onStop(e,(0,l.createDraggableData)(this,t)))return!1;(0,d.default)("Draggable: onDragStop: %j",t);const n={dragging:!1,slackX:0,slackY:0};if(Boolean(this.props.position)){const{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)})),this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var e,t;return null!==(e=null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current)&&void 0!==e?e:a.default.findDOMNode(this)}render(){const{axis:e,bounds:t,children:n,defaultPosition:i,defaultClassName:a,defaultClassNameDragging:c,defaultClassNameDragged:d,position:p,positionOffset:h,scale:m,...g}=this.props;let y={},b=null;const v=!Boolean(p)||this.state.dragging,w=p||i,S={x:(0,l.canDragX)(this)&&v?this.state.x:w.x,y:(0,l.canDragY)(this)&&v?this.state.y:w.y};this.state.isElementSVG?b=(0,s.createSVGTransform)(S,h):y=(0,s.createCSSTransform)(S,h);const E=(0,o.default)(n.props.className||"",a,{[c]:this.state.dragging,[d]:this.state.dragged});return r.createElement(u.default,f({},g,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),r.cloneElement(r.Children.only(n),{className:E,style:{...n.props.style,...y},transform:b}))}}t.default=g,m(g,"displayName","Draggable"),m(g,"propTypes",{...u.default.propTypes,axis:i.default.oneOf(["both","x","y","none"]),bounds:i.default.oneOfType([i.default.shape({left:i.default.number,right:i.default.number,top:i.default.number,bottom:i.default.number}),i.default.string,i.default.oneOf([!1])]),defaultClassName:i.default.string,defaultClassNameDragging:i.default.string,defaultClassNameDragged:i.default.string,defaultPosition:i.default.shape({x:i.default.number,y:i.default.number}),positionOffset:i.default.shape({x:i.default.oneOfType([i.default.number,i.default.string]),y:i.default.oneOfType([i.default.number,i.default.string])}),position:i.default.shape({x:i.default.number,y:i.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe}),m(g,"defaultProps",{...u.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})},1060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=d(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(5959)),i=u(n(2688)),a=u(n(8398)),o=n(2837),s=n(402),l=n(6732),c=u(n(7988));function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(d=function(e){return e?n:t})(e)}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const h={start:"touchstart",move:"touchmove",stop:"touchend"},f={start:"mousedown",move:"mousemove",stop:"mouseup"};let m=f;class g extends r.Component{constructor(){super(...arguments),p(this,"dragging",!1),p(this,"lastX",NaN),p(this,"lastY",NaN),p(this,"touchIdentifier",null),p(this,"mounted",!1),p(this,"handleDragStart",(e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!(0,o.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,o.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;"touchstart"===e.type&&e.preventDefault();const r=(0,o.getTouchIdentifier)(e);this.touchIdentifier=r;const i=(0,s.getControlPosition)(e,r,this);if(null==i)return;const{x:a,y:l}=i,u=(0,s.createCoreData)(this,a,l);(0,c.default)("DraggableCore: handleDragStart: %j",u),(0,c.default)("calling",this.props.onStart);!1!==this.props.onStart(e,u)&&!1!==this.mounted&&(this.props.enableUserSelectHack&&(0,o.addUserSelectStyles)(n),this.dragging=!0,this.lastX=a,this.lastY=l,(0,o.addEvent)(n,m.move,this.handleDrag),(0,o.addEvent)(n,m.stop,this.handleDragStop))})),p(this,"handleDrag",(e=>{const t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=(0,s.snapToGrid)(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}const i=(0,s.createCoreData)(this,n,r);(0,c.default)("DraggableCore: handleDrag: %j",i);if(!1!==this.props.onDrag(e,i)&&!1!==this.mounted)this.lastX=n,this.lastY=r;else try{this.handleDragStop(new MouseEvent("mouseup"))}catch(e){const t=document.createEvent("MouseEvents");t.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(t)}})),p(this,"handleDragStop",(e=>{if(!this.dragging)return;const t=(0,s.getControlPosition)(e,this.touchIdentifier,this);if(null==t)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=(0,s.snapToGrid)(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}const i=(0,s.createCoreData)(this,n,r);if(!1===this.props.onStop(e,i)||!1===this.mounted)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,o.removeUserSelectStyles)(a.ownerDocument),(0,c.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,c.default)("DraggableCore: Removing handlers"),(0,o.removeEvent)(a.ownerDocument,m.move,this.handleDrag),(0,o.removeEvent)(a.ownerDocument,m.stop,this.handleDragStop))})),p(this,"onMouseDown",(e=>(m=f,this.handleDragStart(e)))),p(this,"onMouseUp",(e=>(m=f,this.handleDragStop(e)))),p(this,"onTouchStart",(e=>(m=h,this.handleDragStart(e)))),p(this,"onTouchEnd",(e=>(m=h,this.handleDragStop(e))))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,o.addEvent)(e,h.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,o.removeEvent)(t,f.move,this.handleDrag),(0,o.removeEvent)(t,h.move,this.handleDrag),(0,o.removeEvent)(t,f.stop,this.handleDragStop),(0,o.removeEvent)(t,h.stop,this.handleDragStop),(0,o.removeEvent)(e,h.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,o.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return null!==(e=this.props)&&void 0!==e&&e.nodeRef?null===(t=this.props)||void 0===t||null===(t=t.nodeRef)||void 0===t?void 0:t.current:a.default.findDOMNode(this)}render(){return r.cloneElement(r.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}t.default=g,p(g,"displayName","DraggableCore"),p(g,"propTypes",{allowAnyClick:i.default.bool,children:i.default.node.isRequired,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:i.default.arrayOf(i.default.number),handle:i.default.string,cancel:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number,className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(g,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1})},8230:(e,t,n)=>{"use strict";const{default:r,DraggableCore:i}=n(9111);e.exports=r,e.exports.default=r,e.exports.DraggableCore=i},2837:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addClassName=c,t.addEvent=function(e,t,n,r){if(!e)return;const i={capture:!0,...r};e.addEventListener?e.addEventListener(t,n,i):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},t.addUserSelectStyles=function(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t));e.body&&c(e.body,"react-draggable-transparent-selection")},t.createCSSTransform=function(e,t){const n=l(e,t,"px");return{[(0,i.browserPrefixToKey)("transform",i.default)]:n}},t.createSVGTransform=function(e,t){return l(e,t,"")},t.getTouch=function(e,t){return e.targetTouches&&(0,r.findInArray)(e.targetTouches,(e=>t===e.identifier))||e.changedTouches&&(0,r.findInArray)(e.changedTouches,(e=>t===e.identifier))},t.getTouchIdentifier=function(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier},t.getTranslation=l,t.innerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,r.int)(n.paddingTop),t-=(0,r.int)(n.paddingBottom),t},t.innerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,r.int)(n.paddingLeft),t-=(0,r.int)(n.paddingRight),t},t.matchesSelector=s,t.matchesSelectorAndParentsTo=function(e,t,n){let r=e;do{if(s(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1},t.offsetXYFromParent=function(e,t,n){const r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),i=(e.clientX+t.scrollLeft-r.left)/n,a=(e.clientY+t.scrollTop-r.top)/n;return{x:i,y:a}},t.outerHeight=function(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,r.int)(n.borderTopWidth),t+=(0,r.int)(n.borderBottomWidth),t},t.outerWidth=function(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,r.int)(n.borderLeftWidth),t+=(0,r.int)(n.borderRightWidth),t},t.removeClassName=u,t.removeEvent=function(e,t,n,r){if(!e)return;const i={capture:!0,...r};e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},t.removeUserSelectStyles=function(e){if(!e)return;try{if(e.body&&u(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(e){}};var r=n(6732),i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=a(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}r.default=e,n&&n.set(e,r);return r}(n(7350));function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(a=function(e){return e?n:t})(e)}let o="";function s(e,t){return o||(o=(0,r.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],(function(t){return(0,r.isFunction)(e[t])}))),!!(0,r.isFunction)(e[o])&&e[o](t)}function l(e,t,n){let{x:r,y:i}=e,a="translate(".concat(r).concat(n,",").concat(i).concat(n,")");if(t){const e="".concat("string"==typeof t.x?t.x:t.x+n),r="".concat("string"==typeof t.y?t.y:t.y+n);a="translate(".concat(e,", ").concat(r,")")+a}return a}function c(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function u(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}},7350:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.browserPrefixToKey=i,t.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},t.default=void 0,t.getPrefix=r;const n=["Moz","Webkit","O","ms"];function r(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";const r=null===(e=window.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.style;if(!r)return"";if(t in r)return"";for(let e=0;e<n.length;e++)if(i(t,n[e])in r)return n[e];return""}function i(e,t){return t?"".concat(t).concat(function(e){let t="",n=!0;for(let r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)):e}t.default=r()},7988:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){0}},402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},t.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},t.createCoreData=function(e,t,n){const i=!(0,r.isNum)(e.lastX),o=a(e);return i?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:o,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}},t.createDraggableData=function(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}},t.getBoundPosition=function(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:o}=e.props;o="string"==typeof o?o:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(o);const s=a(e);if("string"==typeof o){const{ownerDocument:e}=s,t=e.defaultView;let n;if(n="parent"===o?s.parentNode:e.querySelector(o),!(n instanceof t.HTMLElement))throw new Error('Bounds selector "'+o+'" could not find an element.');const a=n,l=t.getComputedStyle(s),c=t.getComputedStyle(a);o={left:-s.offsetLeft+(0,r.int)(c.paddingLeft)+(0,r.int)(l.marginLeft),top:-s.offsetTop+(0,r.int)(c.paddingTop)+(0,r.int)(l.marginTop),right:(0,i.innerWidth)(a)-(0,i.outerWidth)(s)-s.offsetLeft+(0,r.int)(c.paddingRight)-(0,r.int)(l.marginRight),bottom:(0,i.innerHeight)(a)-(0,i.outerHeight)(s)-s.offsetTop+(0,r.int)(c.paddingBottom)-(0,r.int)(l.marginBottom)}}(0,r.isNum)(o.right)&&(t=Math.min(t,o.right));(0,r.isNum)(o.bottom)&&(n=Math.min(n,o.bottom));(0,r.isNum)(o.left)&&(t=Math.max(t,o.left));(0,r.isNum)(o.top)&&(n=Math.max(n,o.top));return[t,n]},t.getControlPosition=function(e,t,n){const r="number"==typeof t?(0,i.getTouch)(e,t):null;if("number"==typeof t&&!r)return null;const o=a(n),s=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,i.offsetXYFromParent)(r||e,s,n.props.scale)},t.snapToGrid=function(e,t,n){const r=Math.round(t/e[0])*e[0],i=Math.round(n/e[1])*e[1];return[r,i]};var r=n(6732),i=n(2837);function a(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}},6732:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dontSetMe=function(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))},t.findInArray=function(e,t){for(let n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},t.int=function(e){return parseInt(e,10)},t.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},t.isNum=function(e){return"number"==typeof e&&!isNaN(e)}},8262:(e,t,n)=>{"use strict";function r(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function i(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(i&&(i+=" "),i+=t);return i}n.r(t),n.d(t,{clsx:()=>i,default:()=>a});const a=i},7383:e=>{var t="undefined"!=typeof Element,n="function"==typeof Map,r="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(e,o){if(e===o)return!0;if(e&&o&&"object"==typeof e&&"object"==typeof o){if(e.constructor!==o.constructor)return!1;var s,l,c,u;if(Array.isArray(e)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(!a(e[l],o[l]))return!1;return!0}if(n&&e instanceof Map&&o instanceof Map){if(e.size!==o.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!o.has(l.value[0]))return!1;for(u=e.entries();!(l=u.next()).done;)if(!a(l.value[1],o.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&o instanceof Set){if(e.size!==o.size)return!1;for(u=e.entries();!(l=u.next()).done;)if(!o.has(l.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(o)){if((s=e.length)!=o.length)return!1;for(l=s;0!=l--;)if(e[l]!==o[l])return!1;return!0}if(e.constructor===RegExp)return e.source===o.source&&e.flags===o.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof o.valueOf)return e.valueOf()===o.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof o.toString)return e.toString()===o.toString();if((s=(c=Object.keys(e)).length)!==Object.keys(o).length)return!1;for(l=s;0!=l--;)if(!Object.prototype.hasOwnProperty.call(o,c[l]))return!1;if(t&&e instanceof Element)return!1;for(l=s;0!=l--;)if(("_owner"!==c[l]&&"__v"!==c[l]&&"__o"!==c[l]||!e.$$typeof)&&!a(e[c[l]],o[c[l]]))return!1;return!0}return e!=e&&o!=o}e.exports=function(e,t){try{return a(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},8100:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=p(n(5959)),a=p(n(2688)),o=n(8230),s=n(936),l=n(414),c=n(906),u=n(7222),d=p(n(7256));function p(e){return e&&e.__esModule?e:{default:e}}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},g(e,t)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=v(e);if(t){var a=v(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}(this,n)}}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(u,e);var t,n,r,a=y(u);function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return w(b(e=a.call.apply(a,[this].concat(n))),"state",{resizing:null,dragging:null,className:""}),w(b(e),"elementRef",i.default.createRef()),w(b(e),"onDragStart",(function(t,n){var r=n.node,i=e.props,a=i.onDragStart,o=i.transformScale;if(a){var s={top:0,left:0},l=r.offsetParent;if(l){var u=l.getBoundingClientRect(),d=r.getBoundingClientRect(),p=d.left/o,h=u.left/o,f=d.top/o,m=u.top/o;s.left=p-h+l.scrollLeft,s.top=f-m+l.scrollTop,e.setState({dragging:s});var g=(0,c.calcXY)(e.getPositionParams(),s.top,s.left,e.props.w,e.props.h),y=g.x,v=g.y;return a.call(b(e),e.props.i,y,v,{e:t,node:r,newPosition:s})}}})),w(b(e),"onDrag",(function(t,n){var r=n.node,i=n.deltaX,a=n.deltaY,o=e.props.onDrag;if(o){if(!e.state.dragging)throw new Error("onDrag called before onDragStart.");var s=e.state.dragging.top+a,l=e.state.dragging.left+i,u=e.props,d=u.isBounded,p=u.i,h=u.w,f=u.h,m=u.containerWidth,g=e.getPositionParams();if(d){var y=r.offsetParent;if(y){var v=e.props,w=v.margin,S=v.rowHeight,E=y.clientHeight-(0,c.calcGridItemWHPx)(f,S,w[1]);s=(0,c.clamp)(s,0,E);var x=(0,c.calcGridColWidth)(g),O=m-(0,c.calcGridItemWHPx)(h,x,w[0]);l=(0,c.clamp)(l,0,O)}}var _={top:s,left:l};e.setState({dragging:_});var T=(0,c.calcXY)(g,s,l,h,f),C=T.x,k=T.y;return o.call(b(e),p,C,k,{e:t,node:r,newPosition:_})}})),w(b(e),"onDragStop",(function(t,n){var r=n.node,i=e.props.onDragStop;if(i){if(!e.state.dragging)throw new Error("onDragEnd called before onDragStart.");var a=e.props,o=a.w,s=a.h,l=a.i,u=e.state.dragging,d=u.left,p=u.top,h={top:p,left:d};e.setState({dragging:null});var f=(0,c.calcXY)(e.getPositionParams(),p,d,o,s),m=f.x,g=f.y;return i.call(b(e),l,m,g,{e:t,node:r,newPosition:h})}})),w(b(e),"onResizeStop",(function(t,n){e.onResizeHandler(t,n,"onResizeStop")})),w(b(e),"onResizeStart",(function(t,n){e.onResizeHandler(t,n,"onResizeStart")})),w(b(e),"onResize",(function(t,n){e.onResizeHandler(t,n,"onResize")})),e}return t=u,n=[{key:"shouldComponentUpdate",value:function(e,t){if(this.props.children!==e.children)return!0;if(this.props.droppingPosition!==e.droppingPosition)return!0;var n=(0,c.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,c.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,t);return!(0,l.fastPositionEqual)(n,r)||this.props.useCSSTransforms!==e.useCSSTransforms}},{key:"componentDidMount",value:function(){this.moveDroppingItem({})}},{key:"componentDidUpdate",value:function(e){this.moveDroppingItem(e)}},{key:"moveDroppingItem",value:function(e){var t=this.props.droppingPosition;if(t){var n=this.elementRef.current;if(n){var r=e.droppingPosition||{left:0,top:0},i=this.state.dragging,a=i&&t.left!==r.left||t.top!==r.top;if(i){if(a){var o=t.left-i.left,s=t.top-i.top;this.onDrag(t.e,{node:n,deltaX:o,deltaY:s})}}else this.onDragStart(t.e,{node:n,deltaX:t.left,deltaY:t.top})}}}},{key:"getPositionParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}},{key:"createStyle",value:function(e){var t,n=this.props,r=n.usePercentages,i=n.containerWidth;return n.useCSSTransforms?t=(0,l.setTransform)(e):(t=(0,l.setTopLeft)(e),r&&(t.left=(0,l.perc)(e.left/i),t.width=(0,l.perc)(e.width/i))),t}},{key:"mixinDraggable",value:function(e,t){return i.default.createElement(o.DraggableCore,{disabled:!t,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}},{key:"mixinResizable",value:function(e,t,n){var r=this.props,a=r.cols,o=r.x,l=r.minW,u=r.minH,d=r.maxW,p=r.maxH,h=r.transformScale,f=r.resizeHandles,m=r.resizeHandle,g=this.getPositionParams(),y=(0,c.calcGridItemPosition)(g,0,0,a-o,0).width,b=(0,c.calcGridItemPosition)(g,0,0,l,u),v=(0,c.calcGridItemPosition)(g,0,0,d,p),w=[b.width,b.height],S=[Math.min(v.width,y),Math.min(v.height,1/0)];return i.default.createElement(s.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:t.width,height:t.height,minConstraints:w,maxConstraints:S,onResizeStop:this.onResizeStop,onResizeStart:this.onResizeStart,onResize:this.onResize,transformScale:h,resizeHandles:f,handle:m},e)}},{key:"onResizeHandler",value:function(e,t,n){var r=t.node,i=t.size,a=this.props[n];if(a){var o=this.props,s=o.cols,l=o.x,u=o.y,d=o.i,p=o.maxH,h=o.minH,f=this.props,m=f.minW,g=f.maxW,y=(0,c.calcWH)(this.getPositionParams(),i.width,i.height,l,u),b=y.w,v=y.h;m=Math.max(m,1),g=Math.min(g,s-l),b=(0,c.clamp)(b,m,g),v=(0,c.clamp)(v,h,p),this.setState({resizing:"onResizeStop"===n?null:i}),a.call(this,d,b,v,{e,node:r,size:i})}}},{key:"render",value:function(){var e=this.props,t=e.x,n=e.y,r=e.w,a=e.h,o=e.isDraggable,s=e.isResizable,l=e.droppingPosition,u=e.useCSSTransforms,p=(0,c.calcGridItemPosition)(this.getPositionParams(),t,n,r,a,this.state),h=i.default.Children.only(this.props.children),m=i.default.cloneElement(h,{ref:this.elementRef,className:(0,d.default)("react-grid-item",h.props.className,this.props.className,{static:this.props.static,resizing:Boolean(this.state.resizing),"react-draggable":o,"react-draggable-dragging":Boolean(this.state.dragging),dropping:Boolean(l),cssTransforms:u}),style:f(f(f({},this.props.style),h.props.style),this.createStyle(p))});return m=this.mixinResizable(m,p,s),m=this.mixinDraggable(m,o)}}],n&&m(t.prototype,n),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(i.default.Component);t.default=S,w(S,"propTypes",{children:a.default.element,cols:a.default.number.isRequired,containerWidth:a.default.number.isRequired,rowHeight:a.default.number.isRequired,margin:a.default.array.isRequired,maxRows:a.default.number.isRequired,containerPadding:a.default.array.isRequired,x:a.default.number.isRequired,y:a.default.number.isRequired,w:a.default.number.isRequired,h:a.default.number.isRequired,minW:function(e,t){var n=e[t];return"number"!=typeof n?new Error("minWidth not Number"):n>e.w||n>e.maxW?new Error("minWidth larger than item width/maxWidth"):void 0},maxW:function(e,t){var n=e[t];return"number"!=typeof n?new Error("maxWidth not Number"):n<e.w||n<e.minW?new Error("maxWidth smaller than item width/minWidth"):void 0},minH:function(e,t){var n=e[t];return"number"!=typeof n?new Error("minHeight not Number"):n>e.h||n>e.maxH?new Error("minHeight larger than item height/maxHeight"):void 0},maxH:function(e,t){var n=e[t];return"number"!=typeof n?new Error("maxHeight not Number"):n<e.h||n<e.minH?new Error("maxHeight smaller than item height/minHeight"):void 0},i:a.default.string.isRequired,resizeHandles:u.resizeHandleAxesType,resizeHandle:u.resizeHandleType,onDragStop:a.default.func,onDragStart:a.default.func,onDrag:a.default.func,onResizeStop:a.default.func,onResizeStart:a.default.func,onResize:a.default.func,isDraggable:a.default.bool.isRequired,isResizable:a.default.bool.isRequired,isBounded:a.default.bool.isRequired,static:a.default.bool,useCSSTransforms:a.default.bool.isRequired,transformScale:a.default.number,className:a.default.string,handle:a.default.string,cancel:a.default.string,droppingPosition:a.default.shape({e:a.default.object.isRequired,left:a.default.number.isRequired,top:a.default.number.isRequired})}),w(S,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1})},9482:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(i,o,s):i[o]=e[o]}i.default=e,n&&n.set(e,i);return i}(n(5959)),a=d(n(7842)),o=d(n(7256)),s=n(414),l=n(906),c=d(n(8100)),u=d(n(7222));function d(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){O(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e,t){return w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},w(e,t)}function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=x(e);if(t){var a=x(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return E(e)}(this,n)}}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _="react-grid-layout",T=!1;try{T=/firefox/i.test(navigator.userAgent)}catch(e){}var C=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(d,e);var t,n,r,u=S(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return O(E(e=u.call.apply(u,[this].concat(n))),"state",{activeDrag:null,layout:(0,s.synchronizeLayoutWithChildren)(e.props.layout,e.props.children,e.props.cols,(0,s.compactType)(e.props),e.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,droppingDOMNode:null,children:[]}),O(E(e),"dragEnterCounter",0),O(E(e),"onDragStart",(function(t,n,r,i){var a=i.e,o=i.node,l=e.state.layout,c=(0,s.getLayoutItem)(l,t);if(c)return e.setState({oldDragItem:(0,s.cloneLayoutItem)(c),oldLayout:l}),e.props.onDragStart(l,c,c,null,a,o)})),O(E(e),"onDrag",(function(t,n,r,i){var a=i.e,o=i.node,l=e.state.oldDragItem,c=e.state.layout,u=e.props,d=u.cols,p=u.allowOverlap,h=u.preventCollision,f=(0,s.getLayoutItem)(c,t);if(f){var m={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:t};c=(0,s.moveElement)(c,f,n,r,!0,h,(0,s.compactType)(e.props),d,p),e.props.onDrag(c,l,f,m,a,o),e.setState({layout:p?c:(0,s.compact)(c,(0,s.compactType)(e.props),d),activeDrag:m})}})),O(E(e),"onDragStop",(function(t,n,r,i){var a=i.e,o=i.node;if(e.state.activeDrag){var l=e.state.oldDragItem,c=e.state.layout,u=e.props,d=u.cols,p=u.preventCollision,h=u.allowOverlap,f=(0,s.getLayoutItem)(c,t);if(f){c=(0,s.moveElement)(c,f,n,r,!0,p,(0,s.compactType)(e.props),d,h),e.props.onDragStop(c,l,f,null,a,o);var m=h?c:(0,s.compact)(c,(0,s.compactType)(e.props),d),g=e.state.oldLayout;e.setState({activeDrag:null,layout:m,oldDragItem:null,oldLayout:null}),e.onLayoutMaybeChanged(m,g)}}})),O(E(e),"onResizeStart",(function(t,n,r,i){var a=i.e,o=i.node,l=e.state.layout,c=(0,s.getLayoutItem)(l,t);c&&(e.setState({oldResizeItem:(0,s.cloneLayoutItem)(c),oldLayout:e.state.layout}),e.props.onResizeStart(l,c,c,null,a,o))})),O(E(e),"onResize",(function(t,n,r,i){var a=i.e,o=i.node,l=e.state,c=l.layout,u=l.oldResizeItem,d=e.props,p=d.cols,h=d.preventCollision,f=d.allowOverlap,y=(0,s.withLayoutItem)(c,t,(function(e){var t;if(h&&!f){var i=(0,s.getAllCollisions)(c,m(m({},e),{},{w:n,h:r})).filter((function(t){return t.i!==e.i}));if(t=i.length>0){var a=1/0,o=1/0;i.forEach((function(t){t.x>e.x&&(a=Math.min(a,t.x)),t.y>e.y&&(o=Math.min(o,t.y))})),Number.isFinite(a)&&(e.w=a-e.x),Number.isFinite(o)&&(e.h=o-e.y)}}return t||(e.w=n,e.h=r),e})),b=g(y,2),v=b[0],w=b[1];if(w){var S={w:w.w,h:w.h,x:w.x,y:w.y,static:!0,i:t};e.props.onResize(v,u,w,S,a,o),e.setState({layout:f?v:(0,s.compact)(v,(0,s.compactType)(e.props),p),activeDrag:S})}})),O(E(e),"onResizeStop",(function(t,n,r,i){var a=i.e,o=i.node,l=e.state,c=l.layout,u=l.oldResizeItem,d=e.props,p=d.cols,h=d.allowOverlap,f=(0,s.getLayoutItem)(c,t);e.props.onResizeStop(c,u,f,null,a,o);var m=h?c:(0,s.compact)(c,(0,s.compactType)(e.props),p),g=e.state.oldLayout;e.setState({activeDrag:null,layout:m,oldResizeItem:null,oldLayout:null}),e.onLayoutMaybeChanged(m,g)})),O(E(e),"onDragOver",(function(t){var n;if(t.preventDefault(),t.stopPropagation(),T&&(null===(n=t.nativeEvent.target)||void 0===n||!n.classList.contains(_)))return!1;var r=e.props,a=r.droppingItem,o=r.onDropDragOver,s=r.margin,c=r.cols,u=r.rowHeight,d=r.maxRows,p=r.width,f=r.containerPadding,g=r.transformScale,y=null==o?void 0:o(t);if(!1===y)return e.state.droppingDOMNode&&e.removeDroppingPlaceholder(),!1;var b=m(m({},a),y),v=e.state.layout,w=t.nativeEvent,S=w.layerX,E=w.layerY,x={left:S/g,top:E/g,e:t};if(e.state.droppingDOMNode){if(e.state.droppingPosition){var O=e.state.droppingPosition,C=O.left,k=O.top;(C!=S||k!=E)&&e.setState({droppingPosition:x})}}else{var P={cols:c,margin:s,maxRows:d,rowHeight:u,containerWidth:p,containerPadding:f||s},A=(0,l.calcXY)(P,E,S,b.w,b.h);e.setState({droppingDOMNode:i.createElement("div",{key:b.i}),droppingPosition:x,layout:[].concat(h(v),[m(m({},b),{},{x:A.x,y:A.y,static:!1,isDraggable:!0})])})}})),O(E(e),"removeDroppingPlaceholder",(function(){var t=e.props,n=t.droppingItem,r=t.cols,i=e.state.layout,a=(0,s.compact)(i.filter((function(e){return e.i!==n.i})),(0,s.compactType)(e.props),r);e.setState({layout:a,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})})),O(E(e),"onDragLeave",(function(t){t.preventDefault(),t.stopPropagation(),e.dragEnterCounter--,0===e.dragEnterCounter&&e.removeDroppingPlaceholder()})),O(E(e),"onDragEnter",(function(t){t.preventDefault(),t.stopPropagation(),e.dragEnterCounter++})),O(E(e),"onDrop",(function(t){t.preventDefault(),t.stopPropagation();var n=e.props.droppingItem,r=e.state.layout,i=r.find((function(e){return e.i===n.i}));e.dragEnterCounter=0,e.removeDroppingPlaceholder(),e.props.onDrop(r,i,t)})),e}return t=d,r=[{key:"getDerivedStateFromProps",value:function(e,t){var n;return t.activeDrag?null:((0,a.default)(e.layout,t.propsLayout)&&e.compactType===t.compactType?(0,s.childrenEqual)(e.children,t.children)||(n=t.layout):n=e.layout,n?{layout:(0,s.synchronizeLayoutWithChildren)(n,e.children,e.cols,(0,s.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}:null)}}],(n=[{key:"componentDidMount",value:function(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}},{key:"shouldComponentUpdate",value:function(e,t){return this.props.children!==e.children||!(0,s.fastRGLPropsEqual)(this.props,e,a.default)||this.state.activeDrag!==t.activeDrag||this.state.mounted!==t.mounted||this.state.droppingPosition!==t.droppingPosition}},{key:"componentDidUpdate",value:function(e,t){if(!this.state.activeDrag){var n=this.state.layout,r=t.layout;this.onLayoutMaybeChanged(n,r)}}},{key:"containerHeight",value:function(){if(this.props.autoSize){var e=(0,s.bottom)(this.state.layout),t=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+2*t+"px"}}},{key:"onLayoutMaybeChanged",value:function(e,t){t||(t=this.state.layout),(0,a.default)(t,e)||this.props.onLayoutChange(e)}},{key:"placeholder",value:function(){var e=this.state.activeDrag;if(!e)return null;var t=this.props,n=t.width,r=t.cols,a=t.margin,o=t.containerPadding,s=t.rowHeight,l=t.maxRows,u=t.useCSSTransforms,d=t.transformScale;return i.createElement(c.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:"react-grid-placeholder",containerWidth:n,cols:r,margin:a,containerPadding:o||a,maxRows:l,rowHeight:s,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:u,transformScale:d},i.createElement("div",null))}},{key:"processGridItem",value:function(e,t){if(e&&e.key){var n=(0,s.getLayoutItem)(this.state.layout,String(e.key));if(!n)return null;var r=this.props,a=r.width,o=r.cols,l=r.margin,u=r.containerPadding,d=r.rowHeight,p=r.maxRows,h=r.isDraggable,f=r.isResizable,m=r.isBounded,g=r.useCSSTransforms,y=r.transformScale,b=r.draggableCancel,v=r.draggableHandle,w=r.resizeHandles,S=r.resizeHandle,E=this.state,x=E.mounted,O=E.droppingPosition,_="boolean"==typeof n.isDraggable?n.isDraggable:!n.static&&h,T="boolean"==typeof n.isResizable?n.isResizable:!n.static&&f,C=n.resizeHandles||w,k=_&&m&&!1!==n.isBounded;return i.createElement(c.default,{containerWidth:a,cols:o,margin:l,containerPadding:u||l,maxRows:p,rowHeight:d,cancel:b,handle:v,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:_,isResizable:T,isBounded:k,useCSSTransforms:g&&x,usePercentages:!x,transformScale:y,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:t?O:void 0,resizeHandles:C,resizeHandle:S},e)}}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,r=t.style,a=t.isDroppable,l=t.innerRef,c=(0,o.default)(_,n),u=m({height:this.containerHeight()},r);return i.createElement("div",{ref:l,className:c,style:u,onDrop:a?this.onDrop:s.noop,onDragLeave:a?this.onDragLeave:s.noop,onDragEnter:a?this.onDragEnter:s.noop,onDragOver:a?this.onDragOver:s.noop},i.Children.map(this.props.children,(function(t){return e.processGridItem(t)})),a&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}}])&&v(t.prototype,n),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),d}(i.Component);t.default=C,O(C,"displayName","ReactGridLayout"),O(C,"propTypes",u.default),O(C,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:s.noop,onDragStart:s.noop,onDrag:s.noop,onDragStop:s.noop,onResizeStart:s.noop,onResize:s.noop,onResizeStop:s.noop,onDrop:s.noop,onDropDragOver:s.noop})},7222:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resizeHandleType=t.resizeHandleAxesType=t.default=void 0;var r=a(n(2688)),i=a(n(5959));function a(e){return e&&e.__esModule?e:{default:e}}var o=r.default.arrayOf(r.default.oneOf(["s","w","e","n","sw","nw","se","ne"]));t.resizeHandleAxesType=o;var s=r.default.oneOfType([r.default.node,r.default.func]);t.resizeHandleType=s;var l={className:r.default.string,style:r.default.object,width:r.default.number,autoSize:r.default.bool,cols:r.default.number,draggableCancel:r.default.string,draggableHandle:r.default.string,verticalCompact:function(e){e.verticalCompact,0},compactType:r.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;void 0!==t&&n(414).validateLayout(t,"layout")},margin:r.default.arrayOf(r.default.number),containerPadding:r.default.arrayOf(r.default.number),rowHeight:r.default.number,maxRows:r.default.number,isBounded:r.default.bool,isDraggable:r.default.bool,isResizable:r.default.bool,allowOverlap:r.default.bool,preventCollision:r.default.bool,useCSSTransforms:r.default.bool,transformScale:r.default.number,isDroppable:r.default.bool,resizeHandles:o,resizeHandle:s,onLayoutChange:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onDragStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,onResizeStop:r.default.func,onDrop:r.default.func,droppingItem:r.default.shape({i:r.default.string.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired}),children:function(e,t){var n=e[t],r={};i.default.Children.forEach(n,(function(e){if(null!=(null==e?void 0:e.key)){if(r[e.key])throw new Error('Duplicate child key "'+e.key+'" found! This will cause problems in ReactGridLayout.');r[e.key]=!0}}))},innerRef:r.default.any};t.default=l},4636:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}t.default=void 0;var i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(i,o,s):i[o]=e[o]}i.default=e,n&&n.set(e,i);return i}(n(5959)),a=d(n(2688)),o=d(n(7842)),s=n(414),l=n(544),c=d(n(9482)),u=["breakpoint","breakpoints","cols","layouts","margin","containerPadding","onBreakpointChange","onLayoutChange","onWidthChange"];function d(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function h(){return h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h.apply(this,arguments)}function f(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){E(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},b(e,t)}function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=S(e);if(t){var a=S(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return w(e)}(this,n)}}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){return Object.prototype.toString.call(e)};function O(e,t){return null==e?null:Array.isArray(e)?e:e[t]}var _=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(d,e);var t,n,r,a=v(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return E(w(e=a.call.apply(a,[this].concat(n))),"state",e.generateInitialState()),E(w(e),"onLayoutChange",(function(t){e.props.onLayoutChange(t,g(g({},e.props.layouts),{},E({},e.state.breakpoint,t)))})),e}return t=d,r=[{key:"getDerivedStateFromProps",value:function(e,t){if(!(0,o.default)(e.layouts,t.layouts)){var n=t.breakpoint,r=t.cols;return{layout:(0,l.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,n,n,r,e.compactType),layouts:e.layouts}}return null}}],(n=[{key:"generateInitialState",value:function(){var e=this.props,t=e.width,n=e.breakpoints,r=e.layouts,i=e.cols,a=(0,l.getBreakpointFromWidth)(n,t),o=(0,l.getColsFromBreakpoint)(a,i),s=!1===this.props.verticalCompact?null:this.props.compactType;return{layout:(0,l.findOrGenerateResponsiveLayout)(r,n,a,a,o,s),breakpoint:a,cols:o}}},{key:"componentDidUpdate",value:function(e){this.props.width==e.width&&this.props.breakpoint===e.breakpoint&&(0,o.default)(this.props.breakpoints,e.breakpoints)&&(0,o.default)(this.props.cols,e.cols)||this.onWidthChange(e)}},{key:"onWidthChange",value:function(e){var t=this.props,n=t.breakpoints,r=t.cols,i=t.layouts,a=t.compactType,o=this.props.breakpoint||(0,l.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),c=this.state.breakpoint,u=(0,l.getColsFromBreakpoint)(o,r),d=g({},i);if(c!==o||e.breakpoints!==n||e.cols!==r){c in d||(d[c]=(0,s.cloneLayout)(this.state.layout));var p=(0,l.findOrGenerateResponsiveLayout)(d,n,o,c,u,a);p=(0,s.synchronizeLayoutWithChildren)(p,this.props.children,u,a,this.props.allowOverlap),d[o]=p,this.props.onLayoutChange(p,d),this.props.onBreakpointChange(o,u),this.setState({breakpoint:o,layout:p,cols:u})}var h=O(this.props.margin,o),f=O(this.props.containerPadding,o);this.props.onWidthChange(this.props.width,h,u,f)}},{key:"render",value:function(){var e=this.props,t=(e.breakpoint,e.breakpoints,e.cols,e.layouts,e.margin),n=e.containerPadding,r=(e.onBreakpointChange,e.onLayoutChange,e.onWidthChange,f(e,u));return i.createElement(c.default,h({},r,{margin:O(t,this.state.breakpoint),containerPadding:O(n,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}])&&y(t.prototype,n),r&&y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),d}(i.Component);t.default=_,E(_,"propTypes",{breakpoint:a.default.string,breakpoints:a.default.object,allowOverlap:a.default.bool,cols:a.default.object,margin:a.default.oneOfType([a.default.array,a.default.object]),containerPadding:a.default.oneOfType([a.default.array,a.default.object]),layouts:function(e,t){if("[object Object]"!==x(e[t]))throw new Error("Layout property must be an object. Received: "+x(e[t]));Object.keys(e[t]).forEach((function(t){if(!(t in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,s.validateLayout)(e.layouts[t],"layouts."+t)}))},width:a.default.number.isRequired,onBreakpointChange:a.default.func,onLayoutChange:a.default.func,onWidthChange:a.default.func}),E(_,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:s.noop,onLayoutChange:s.noop,onWidthChange:s.noop})},906:(e,t)=>{"use strict";function n(e){var t=e.margin,n=e.containerPadding,r=e.containerWidth,i=e.cols;return(r-t[0]*(i-1)-2*n[0])/i}function r(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function i(e,t,n){return Math.max(Math.min(e,n),t)}Object.defineProperty(t,"__esModule",{value:!0}),t.calcGridColWidth=n,t.calcGridItemPosition=function(e,t,i,a,o,s){var l=e.margin,c=e.containerPadding,u=e.rowHeight,d=n(e),p={};s&&s.resizing?(p.width=Math.round(s.resizing.width),p.height=Math.round(s.resizing.height)):(p.width=r(a,d,l[0]),p.height=r(o,u,l[1]));s&&s.dragging?(p.top=Math.round(s.dragging.top),p.left=Math.round(s.dragging.left)):(p.top=Math.round((u+l[1])*i+c[1]),p.left=Math.round((d+l[0])*t+c[0]));return p},t.calcGridItemWHPx=r,t.calcWH=function(e,t,r,a,o){var s=e.margin,l=e.maxRows,c=e.cols,u=e.rowHeight,d=n(e),p=Math.round((t+s[0])/(d+s[0])),h=Math.round((r+s[1])/(u+s[1]));return p=i(p,0,c-a),h=i(h,0,l-o),{w:p,h}},t.calcXY=function(e,t,r,a,o){var s=e.margin,l=e.cols,c=e.rowHeight,u=e.maxRows,d=n(e),p=Math.round((r-s[0])/(d+s[0])),h=Math.round((t-s[1])/(c+s[1]));return p=i(p,0,l-a),h=i(h,0,u-o),{x:p,y:h}},t.clamp=i},6805:(e,t,n)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}t.default=function(e){var t;return t=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(c,t);var n,a,l=(n=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=f(n);if(a){var i=f(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}(this,e)});function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return m(h(e=l.call.apply(l,[this].concat(n))),"state",{width:1280}),m(h(e),"elementRef",i.createRef()),m(h(e),"mounted",!1),m(h(e),"onWindowResize",(function(){if(e.mounted){var t=e.elementRef.current;t instanceof HTMLElement&&t.offsetWidth&&e.setState({width:t.offsetWidth})}})),e}return function(e,t,n){t&&d(e.prototype,t);n&&d(e,n);Object.defineProperty(e,"prototype",{writable:!1})}(c,[{key:"componentDidMount",value:function(){this.mounted=!0,window.addEventListener("resize",this.onWindowResize),this.onWindowResize()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,window.removeEventListener("resize",this.onWindowResize)}},{key:"render",value:function(){var t=this.props,n=t.measureBeforeMount,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,s);return n&&!this.mounted?i.createElement("div",{className:(0,o.default)(this.props.className,g),style:this.props.style,ref:this.elementRef}):i.createElement(e,u({innerRef:this.elementRef},r,this.state))}}]),c}(i.Component),m(t,"defaultProps",{measureBeforeMount:!1}),m(t,"propTypes",{measureBeforeMount:a.default.bool}),t};var i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(i,o,s):i[o]=e[o]}i.default=e,n&&n.set(e,i);return i}(n(5959)),a=l(n(2688)),o=l(n(7256)),s=["measureBeforeMount"];function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(this,arguments)}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g="react-grid-layout"},7434:e=>{e.exports=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.allowOverlap===t.allowOverlap&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)}},544:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findOrGenerateResponsiveLayout=function(e,t,n,a,o,s){if(e[n])return(0,r.cloneLayout)(e[n]);for(var l=e[a],c=i(t),u=c.slice(c.indexOf(n)),d=0,p=u.length;d<p;d++){var h=u[d];if(e[h]){l=e[h];break}}return l=(0,r.cloneLayout)(l||[]),(0,r.compact)((0,r.correctBounds)(l,{cols:o}),s,o)},t.getBreakpointFromWidth=function(e,t){for(var n=i(e),r=n[0],a=1,o=n.length;a<o;a++){var s=n[a];t>e[s]&&(r=s)}return r},t.getColsFromBreakpoint=function(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]},t.sortBreakpoints=i;var r=n(414);function i(e){return Object.keys(e).sort((function(t,n){return e[t]-e[n]}))}},414:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bottom=d,t.childrenEqual=function(e,t){return(0,r.default)(i.default.Children.map(e,(function(e){return null==e?void 0:e.key})),i.default.Children.map(t,(function(e){return null==e?void 0:e.key})))},t.cloneLayout=p,t.cloneLayoutItem=f,t.collides=g,t.compact=y,t.compactItem=w,t.compactType=function(e){var t=e||{},n=t.verticalCompact,r=t.compactType;return!1===n?null:r},t.correctBounds=S,t.fastPositionEqual=function(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height},t.fastRGLPropsEqual=void 0,t.getAllCollisions=O,t.getFirstCollision=x,t.getLayoutItem=E,t.getStatics=_,t.modifyLayout=h,t.moveElement=T,t.moveElementAwayFromCollision=C,t.noop=void 0,t.perc=function(e){return 100*e+"%"},t.setTopLeft=function(e){var t=e.top,n=e.left,r=e.width,i=e.height;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}},t.setTransform=function(e){var t=e.top,n=e.left,r=e.width,i=e.height,a="translate(".concat(n,"px,").concat(t,"px)");return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}},t.sortLayoutItems=k,t.sortLayoutItemsByColRow=A,t.sortLayoutItemsByRowCol=P,t.synchronizeLayoutWithChildren=function(e,t,n,r,a){e=e||[];var o=[];i.default.Children.forEach(t,(function(t){if(null!=(null==t?void 0:t.key)){var n=E(e,String(t.key));if(n)o.push(f(n));else{!c&&t.props._grid&&console.warn("`_grid` properties on children have been deprecated as of React 15.2. Please use `data-grid` or add your properties directly to the `layout`.");var r=t.props["data-grid"]||t.props._grid;r?(c||R([r],"ReactGridLayout.children"),o.push(f(s(s({},r),{},{i:t.key})))):o.push(f({w:1,h:1,x:0,y:d(o),i:String(t.key)}))}}}));var l=S(o,{cols:n});return a?l:y(l,r,n)},t.validateLayout=R,t.withLayoutItem=function(e,t,n){var r=E(e,t);return r?(r=n(f(r)),[e=h(e,r),r]):[e,null]};var r=a(n(7842)),i=a(n(5959));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=!0,u=!1;function d(e){for(var t,n=0,r=0,i=e.length;r<i;r++)(t=e[r].y+e[r].h)>n&&(n=t);return n}function p(e){for(var t=Array(e.length),n=0,r=e.length;n<r;n++)t[n]=f(e[n]);return t}function h(e,t){for(var n=Array(e.length),r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function f(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:Boolean(e.moved),static:Boolean(e.static),isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}var m=n(7434);function g(e,t){return e.i!==t.i&&(!(e.x+e.w<=t.x)&&(!(e.x>=t.x+t.w)&&(!(e.y+e.h<=t.y)&&!(e.y>=t.y+t.h))))}function y(e,t,n){for(var r=_(e),i=k(e,t),a=Array(e.length),o=0,s=i.length;o<s;o++){var l=f(i[o]);l.static||(l=w(r,l,t,n,i),r.push(l)),a[e.indexOf(i[o])]=l,l.moved=!1}return a}t.fastRGLPropsEqual=m;var b={x:"w",y:"h"};function v(e,t,n,r){var i=b[r];t[r]+=1;for(var a=e.map((function(e){return e.i})).indexOf(t.i)+1;a<e.length;a++){var o=e[a];if(!o.static){if(o.y>t.y+t.h)break;g(t,o)&&v(e,o,n+t[i],r)}}t[r]=n}function w(e,t,n,r,i){var a,o="horizontal"===n;if("vertical"===n)for(t.y=Math.min(d(e),t.y);t.y>0&&!x(e,t);)t.y--;else if(o)for(;t.x>0&&!x(e,t);)t.x--;for(;a=x(e,t);)o?v(i,t,a.x+a.w,"x"):v(i,t,a.y+a.h,"y"),o&&t.x+t.w>r&&(t.x=r-t.w,t.y++);return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function S(e,t){for(var n=_(e),r=0,i=e.length;r<i;r++){var a=e[r];if(a.x+a.w>t.cols&&(a.x=t.cols-a.w),a.x<0&&(a.x=0,a.w=t.cols),a.static)for(;x(n,a);)a.y++;else n.push(a)}return e}function E(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function x(e,t){for(var n=0,r=e.length;n<r;n++)if(g(e[n],t))return e[n]}function O(e,t){return e.filter((function(e){return g(e,t)}))}function _(e){return e.filter((function(e){return e.static}))}function T(e,t,n,r,i,a,o,s,l){if(t.static&&!0!==t.isDraggable)return e;if(t.y===r&&t.x===n)return e;D("Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]"));var c=t.x,u=t.y;"number"==typeof n&&(t.x=n),"number"==typeof r&&(t.y=r),t.moved=!0;var d=k(e,o);("vertical"===o&&"number"==typeof r?u>=r:"horizontal"===o&&"number"==typeof n&&c>=n)&&(d=d.reverse());var h=O(d,t),f=h.length>0;if(f&&l)return p(e);if(f&&a)return D("Collision prevented on ".concat(t.i,", reverting.")),t.x=c,t.y=u,t.moved=!1,e;for(var m=0,g=h.length;m<g;m++){var y=h[m];D("Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(y.i," at [").concat(y.x,",").concat(y.y,"]")),y.moved||(e=y.static?C(e,y,t,i,o,s):C(e,t,y,i,o,s))}return e}function C(e,t,n,r,i,a){var o="horizontal"===i,s="horizontal"!==i,l=t.static;if(r){r=!1;var c={x:o?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"};if(!x(e,c))return D("Doing reverse collision on ".concat(n.i," up to [").concat(c.x,",").concat(c.y,"].")),T(e,n,o?c.x:void 0,s?c.y:void 0,r,l,i,a)}return T(e,n,o?n.x+1:void 0,s?n.y+1:void 0,r,l,i,a)}function k(e,t){return"horizontal"===t?A(e):"vertical"===t?P(e):e}function P(e){return e.slice(0).sort((function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1}))}function A(e){return e.slice(0).sort((function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1}))}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Layout",n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(var r=0,i=e.length;r<i;r++)for(var a=e[r],o=0;o<n.length;o++)if("number"!=typeof a[n[o]])throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[o]+" must be a number!")}function D(){var e;u&&(e=console).log.apply(e,arguments)}t.noop=function(){}},2548:(e,t,n)=>{e.exports=n(9482).default,e.exports.utils=n(414),e.exports.Responsive=n(4636).default,e.exports.Responsive.utils=n(544),e.exports.WidthProvider=n(6805).default},7256:(e,t,n)=>{"use strict";function r(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(i&&(i+=" "),i+=n);else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function i(){for(var e,t,n=0,i="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(i&&(i+=" "),i+=t);return i}n.r(t),n.d(t,{clsx:()=>i,default:()=>a});const a=i},1794:(e,t,n)=>{"use strict";t.__esModule=!0,t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(5959)),i=n(8230),a=n(9954),o=n(6333),s=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}var f=function(e){var t,n;function o(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).handleRefs={},t.lastHandleRect=null,t.slack=null,t}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,h(t,n);var l=o.prototype;return l.componentWillUnmount=function(){this.resetData()},l.resetData=function(){this.lastHandleRect=this.slack=null},l.runConstraints=function(e,t){var n=this.props,r=n.minConstraints,i=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!i&&!a)return[e,t];if(a){var o=this.props.width/this.props.height,s=e-this.props.width,l=t-this.props.height;Math.abs(s)>Math.abs(l*o)?t=e/o:e=t*o}var c=e,u=t,d=this.slack||[0,0],p=d[0],h=d[1];return e+=p,t+=h,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[p+(c-e),h+(u-t)],[e,t]},l.resizeHandler=function(e,t){var n=this;return function(r,i){var a=i.node,o=i.deltaX,s=i.deltaY;"onResizeStart"===e&&n.resetData();var l=("both"===n.props.axis||"x"===n.props.axis)&&"n"!==t&&"s"!==t,c=("both"===n.props.axis||"y"===n.props.axis)&&"e"!==t&&"w"!==t;if(l||c){var u=t[0],d=t[t.length-1],p=a.getBoundingClientRect();if(null!=n.lastHandleRect){if("w"===d)o+=p.left-n.lastHandleRect.left;if("n"===u)s+=p.top-n.lastHandleRect.top}n.lastHandleRect=p,"w"===d&&(o=-o),"n"===u&&(s=-s);var h=n.props.width+(l?o/n.props.transformScale:0),f=n.props.height+(c?s/n.props.transformScale:0),m=n.runConstraints(h,f);h=m[0],f=m[1];var g=h!==n.props.width||f!==n.props.height,y="function"==typeof n.props[e]?n.props[e]:null;y&&!("onResize"===e&&!g)&&(null==r.persist||r.persist(),y(r,{node:a,size:{width:h,height:f},handle:t})),"onResizeStop"===e&&n.resetData()}}},l.renderResizeHandle=function(e,t){var n=this.props.handle;if(!n)return r.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+e,ref:t});if("function"==typeof n)return n(e,t);var i=d({ref:t},"string"==typeof n.type?{}:{handleAxis:e});return r.cloneElement(n,i)},l.render=function(){var e=this,t=this.props,n=t.children,o=t.className,l=t.draggableOpts,u=(t.width,t.height,t.handle,t.handleSize,t.lockAspectRatio,t.axis,t.minConstraints,t.maxConstraints,t.onResize,t.onResizeStop,t.onResizeStart,t.resizeHandles),p=(t.transformScale,function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(t,s));return(0,a.cloneElement)(n,d(d({},p),{},{className:(o?o+" ":"")+"react-resizable",children:[].concat(n.props.children,u.map((function(t){var n,a=null!=(n=e.handleRefs[t])?n:e.handleRefs[t]=r.createRef();return r.createElement(i.DraggableCore,c({},l,{nodeRef:a,key:"resizableHandle-"+t,onStop:e.resizeHandler("onResizeStop",t),onStart:e.resizeHandler("onResizeStart",t),onDrag:e.resizeHandler("onResize",t)}),e.renderResizeHandle(t,a))})))}))},o}(r.Component);t.default=f,f.propTypes=o.resizableProps,f.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1}},6609:(e,t,n)=>{"use strict";t.default=void 0;var r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(5959)),i=l(n(2688)),a=l(n(1794)),o=n(6333),s=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function l(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(this,arguments)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function h(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}var m=function(e){var t,n;function i(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={width:t.props.width,height:t.props.height,propsWidth:t.props.width,propsHeight:t.props.height},t.onResize=function(e,n){var r=n.size;t.props.onResize?(null==e.persist||e.persist(),t.setState(r,(function(){return t.props.onResize&&t.props.onResize(e,n)}))):t.setState(r)},t}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,f(t,n),i.getDerivedStateFromProps=function(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null},i.prototype.render=function(){var e=this.props,t=e.handle,n=e.handleSize,i=(e.onResize,e.onResizeStart),o=e.onResizeStop,l=e.draggableOpts,c=e.minConstraints,d=e.maxConstraints,h=e.lockAspectRatio,f=e.axis,m=(e.width,e.height,e.resizeHandles),g=e.style,y=e.transformScale,b=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,s);return r.createElement(a.default,{axis:f,draggableOpts:l,handle:t,handleSize:n,height:this.state.height,lockAspectRatio:h,maxConstraints:d,minConstraints:c,onResizeStart:i,onResize:this.onResize,onResizeStop:o,resizeHandles:m,transformScale:y,width:this.state.width},r.createElement("div",u({},b,{style:p(p({},g),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},i}(r.Component);t.default=m,m.propTypes=p(p({},o.resizableProps),{},{children:i.default.element})},6333:(e,t,n)=>{"use strict";t.__esModule=!0,t.resizableProps=void 0;var r,i=(r=n(2688))&&r.__esModule?r:{default:r};n(8230);var a={axis:i.default.oneOf(["both","x","y","none"]),className:i.default.string,children:i.default.element.isRequired,draggableOpts:i.default.shape({allowAnyClick:i.default.bool,cancel:i.default.string,children:i.default.node,disabled:i.default.bool,enableUserSelectHack:i.default.bool,offsetParent:i.default.node,grid:i.default.arrayOf(i.default.number),handle:i.default.string,nodeRef:i.default.object,onStart:i.default.func,onDrag:i.default.func,onStop:i.default.func,onMouseDown:i.default.func,scale:i.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,a=t[0];return"both"===a.axis||"y"===a.axis?(r=i.default.number).isRequired.apply(r,t):i.default.number.apply(i.default,t)},handle:i.default.oneOfType([i.default.node,i.default.func]),handleSize:i.default.arrayOf(i.default.number),lockAspectRatio:i.default.bool,maxConstraints:i.default.arrayOf(i.default.number),minConstraints:i.default.arrayOf(i.default.number),onResizeStop:i.default.func,onResizeStart:i.default.func,onResize:i.default.func,resizeHandles:i.default.arrayOf(i.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:i.default.number,width:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,a=t[0];return"both"===a.axis||"x"===a.axis?(r=i.default.number).isRequired.apply(r,t):i.default.number.apply(i.default,t)}};t.resizableProps=a},9954:(e,t,n)=>{"use strict";t.__esModule=!0,t.cloneElement=function(e,t){t.style&&e.props.style&&(t.style=o(o({},e.props.style),t.style));t.className&&e.props.className&&(t.className=e.props.className+" "+t.className);return i.default.cloneElement(e,t)};var r,i=(r=n(5959))&&r.__esModule?r:{default:r};function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},936:(e,t,n)=>{"use strict";e.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},e.exports.Resizable=n(1794).default,e.exports.ResizableBox=n(6609).default},9406:(e,t,n)=>{"use strict";var r,i=n(5959),a=(r=i)&&"object"==typeof r&&"default"in r?r.default:r;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=!("undefined"==typeof window||!window.document||!window.document.createElement);e.exports=function(e,t,n){if("function"!=typeof e)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof t)throw new Error("Expected handleStateChangeOnClient to be a function.");if(void 0!==n&&"function"!=typeof n)throw new Error("Expected mapStateOnServer to either be undefined or a function.");return function(r){if("function"!=typeof r)throw new Error("Expected WrappedComponent to be a React component.");var l,c=[];function u(){l=e(c.map((function(e){return e.props}))),d.canUseDOM?t(l):n&&(l=n(l))}var d=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.peek=function(){return l},i.rewind=function(){if(i.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var e=l;return l=void 0,c=[],e};var o=i.prototype;return o.UNSAFE_componentWillMount=function(){c.push(this),u()},o.componentDidUpdate=function(){u()},o.componentWillUnmount=function(){var e=c.indexOf(this);c.splice(e,1),u()},o.render=function(){return a.createElement(r,this.props)},i}(i.PureComponent);return o(d,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(r)+")"),o(d,"canUseDOM",s),d}}},4386:(e,t,n)=>{"use strict";var r=n(6212),i=n(5959),a=r.__importDefault(n(5690));t.A=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=[]);var r=a.default(e,t),o=r[0],s=r[1],l=r[2];return i.useEffect(l,n),[o,s]}},1336:(e,t,n)=>{"use strict";var r=n(5959);t.A=function(e){var t=r.useRef();return r.useEffect((function(){t.current=e})),t.current}},5690:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5959);t.default=function(e,t){void 0===t&&(t=0);var n=r.useRef(!1),i=r.useRef(),a=r.useRef(e),o=r.useCallback((function(){return n.current}),[]),s=r.useCallback((function(){n.current=!1,i.current&&clearTimeout(i.current),i.current=setTimeout((function(){n.current=!0,a.current()}),t)}),[t]),l=r.useCallback((function(){n.current=null,i.current&&clearTimeout(i.current)}),[]);return r.useEffect((function(){a.current=e}),[e]),r.useEffect((function(){return s(),l}),[t]),[o,l,s]}},2192:(e,t,n)=>{"use strict";var r=n(5959),i=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,a={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,r)&&!l.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:i,type:e,key:c,ref:u,props:a,_owner:s.current}}t.Fragment=a,t.jsx=c,t.jsxs=c},2540:(e,t,n)=>{"use strict";e.exports=n(2192)},6852:(e,t,n)=>{"use strict";var r=n(8036),i=Array.prototype.concat,a=Array.prototype.slice,o=e.exports=function(e){for(var t=[],n=0,o=e.length;n<o;n++){var s=e[n];r(s)?t=i.call(t,a.call(s)):t.push(s)}return t};o.wrap=function(e){return function(){return e(o(arguments))}}},8036:e=>{e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},6660:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",l="object",c="string",u="major",d="model",p="name",h="type",f="vendor",m="version",g="architecture",y="console",b="mobile",v="tablet",w="smarttv",S="wearable",E="embedded",x="Amazon",O="Apple",_="ASUS",T="BlackBerry",C="Browser",k="Chrome",P="Firefox",A="Google",R="Huawei",D="LG",j="Microsoft",I="Motorola",N="Opera",L="Samsung",M="Sharp",F="Sony",$="Xiaomi",B="Zebra",V="Facebook",U="Chromium OS",z="Mac OS",q=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},H=function(e,t){return typeof e===c&&-1!==G(t).indexOf(G(e))},G=function(e){return e.toLowerCase()},W=function(e,t){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof t===s?e:e.substring(0,500)},Q=function(e,t){for(var n,r,i,s,c,u,d=0;d<t.length&&!c;){var p=t[d],h=t[d+1];for(n=r=0;n<p.length&&!c&&p[n];)if(c=p[n++].exec(e))for(i=0;i<h.length;i++)u=c[++r],typeof(s=h[i])===l&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=u?u.replace(s[1],s[2]):a:this[s[0]]=u?s[1].call(this,u,s[2]):a:4===s.length&&(this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):a):this[s]=u||a;d+=2}},K=function(e,t){for(var n in t)if(typeof t[n]===l&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(H(t[n][r],e))return"?"===n?a:n}else if(H(t[n],e))return"?"===n?a:n;return e},Y={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[m,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[m,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,m],[/opios[\/ ]+([\w\.]+)/i],[m,[p,N+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[m,[p,N+" GX"]],[/\bopr\/([\w\.]+)/i],[m,[p,N]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[m,[p,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,m],[/\bddg\/([\w\.]+)/i],[m,[p,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[m,[p,"UC"+C]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[m,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[m,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[m,[p,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[m,[p,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[m,[p,"Smart Lenovo "+C]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+C],m],[/\bfocus\/([\w\.]+)/i],[m,[p,P+" Focus"]],[/\bopt\/([\w\.]+)/i],[m,[p,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[m,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[m,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[m,[p,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[m,[p,"MIUI "+C]],[/fxios\/([-\w\.]+)/i],[m,[p,P]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+C]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 "+C],m],[/samsungbrowser\/([\w\.]+)/i],[m,[p,L+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],m],[/metasr[\/ ]?([\d\.]+)/i],[m,[p,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[p,"Sogou Mobile"],m],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[p,m],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,V],m],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[p,m],[/\bgsa\/([\w\.]+) .*safari\//i],[m,[p,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[m,[p,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[m,[p,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,k+" WebView"],m],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[m,[p,"Android "+C]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,m],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[m,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[m,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[m,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,m],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],m],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[m,[p,P+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[p,m],[/(cobalt)\/([\w\.]+)/i],[p,[m,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,G]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",G]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,G]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[f,L],[h,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[f,L],[h,b]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[f,O],[h,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[f,O],[h,v]],[/(macintosh);/i],[d,[f,O]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[f,M],[h,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[f,R],[h,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[f,R],[h,b]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[f,$],[h,b]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[f,$],[h,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[f,"OPPO"],[h,b]],[/\b(opd2\d{3}a?) bui/i],[d,[f,"OPPO"],[h,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[f,"Vivo"],[h,b]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[d,[f,"Realme"],[h,b]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[f,I],[h,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[f,I],[h,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[f,D],[h,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[f,D],[h,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[f,"Lenovo"],[h,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[f,"Nokia"],[h,b]],[/(pixel c)\b/i],[d,[f,A],[h,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[f,A],[h,b]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[f,F],[h,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[f,F],[h,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[f,"OnePlus"],[h,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[f,x],[h,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[f,x],[h,b]],[/(playbook);[-\w\),; ]+(rim)/i],[d,f,[h,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[f,T],[h,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[f,_],[h,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[f,_],[h,b]],[/(nexus 9)/i],[d,[f,"HTC"],[h,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[d,/_/g," "],[h,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[f,"Acer"],[h,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[f,"Meizu"],[h,b]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[d,[f,"Ulefone"],[h,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,d,[h,b]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,d,[h,v]],[/(surface duo)/i],[d,[f,j],[h,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[f,"Fairphone"],[h,b]],[/(u304aa)/i],[d,[f,"AT&T"],[h,b]],[/\bsie-(\w*)/i],[d,[f,"Siemens"],[h,b]],[/\b(rct\w+) b/i],[d,[f,"RCA"],[h,v]],[/\b(venue[\d ]{2,7}) b/i],[d,[f,"Dell"],[h,v]],[/\b(q(?:mv|ta)\w+) b/i],[d,[f,"Verizon"],[h,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[f,"Barnes & Noble"],[h,v]],[/\b(tm\d{3}\w+) b/i],[d,[f,"NuVision"],[h,v]],[/\b(k88) b/i],[d,[f,"ZTE"],[h,v]],[/\b(nx\d{3}j) b/i],[d,[f,"ZTE"],[h,b]],[/\b(gen\d{3}) b.+49h/i],[d,[f,"Swiss"],[h,b]],[/\b(zur\d{3}) b/i],[d,[f,"Swiss"],[h,v]],[/\b((zeki)?tb.*\b) b/i],[d,[f,"Zeki"],[h,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],d,[h,v]],[/\b(ns-?\w{0,9}) b/i],[d,[f,"Insignia"],[h,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[f,"NextBook"],[h,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],d,[h,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],d,[h,b]],[/\b(ph-1) /i],[d,[f,"Essential"],[h,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[f,"Envizen"],[h,v]],[/\b(trio[-\w\. ]+) b/i],[d,[f,"MachSpeed"],[h,v]],[/\btu_(1491) b/i],[d,[f,"Rotor"],[h,v]],[/(shield[\w ]+) b/i],[d,[f,"Nvidia"],[h,v]],[/(sprint) (\w+)/i],[f,d,[h,b]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[f,j],[h,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[f,B],[h,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[f,B],[h,b]],[/smart-tv.+(samsung)/i],[f,[h,w]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[f,L],[h,w]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,D],[h,w]],[/(apple) ?tv/i],[f,[d,O+" TV"],[h,w]],[/crkey/i],[[d,k+"cast"],[f,A],[h,w]],[/droid.+aft(\w+)( bui|\))/i],[d,[f,x],[h,w]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[f,M],[h,w]],[/(bravia[\w ]+)( bui|\))/i],[d,[f,F],[h,w]],[/(mitv-\w{5}) bui/i],[d,[f,$],[h,w]],[/Hbbtv.*(technisat) (.*);/i],[f,d,[h,w]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[f,W],[d,W],[h,w]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,w]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,d,[h,y]],[/droid.+; (shield) bui/i],[d,[f,"Nvidia"],[h,y]],[/(playstation [345portablevi]+)/i],[d,[f,F],[h,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[f,j],[h,y]],[/((pebble))app/i],[f,d,[h,S]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[f,O],[h,S]],[/droid.+; (glass) \d/i],[d,[f,A],[h,S]],[/droid.+; (wt63?0{2,3})\)/i],[d,[f,B],[h,S]],[/(quest( \d| pro)?)/i],[d,[f,V],[h,S]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[h,E]],[/(aeobc)\b/i],[d,[f,x],[h,E]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[d,[h,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[h,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,b]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[m,[p,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[m,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,m],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[m,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,m],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[p,[m,K,Y]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[m,K,Y],[p,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[m,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,z],[m,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[m,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,m],[/\(bb(10);/i],[m,[p,T]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[m,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[m,[p,P+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[m,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[m,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[m,[p,k+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,U],m],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,m],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],m],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,m]]},J=function(e,t){if(typeof e===l&&(t=e,e=a),!(this instanceof J))return new J(e,t).getResult();var n=typeof i!==s&&i.navigator?i.navigator:a,r=e||(n&&n.userAgent?n.userAgent:""),y=n&&n.userAgentData?n.userAgentData:a,w=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(X,t):X,S=n&&n.userAgent==r;return this.getBrowser=function(){var e,t={};return t[p]=a,t[m]=a,Q.call(t,r,w.browser),t[u]=typeof(e=t[m])===c?e.replace(/[^\d\.]/g,"").split(".")[0]:a,S&&n&&n.brave&&typeof n.brave.isBrave==o&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=a,Q.call(e,r,w.cpu),e},this.getDevice=function(){var e={};return e[f]=a,e[d]=a,e[h]=a,Q.call(e,r,w.device),S&&!e[h]&&y&&y.mobile&&(e[h]=b),S&&"Macintosh"==e[d]&&n&&typeof n.standalone!==s&&n.maxTouchPoints&&n.maxTouchPoints>2&&(e[d]="iPad",e[h]=v),e},this.getEngine=function(){var e={};return e[p]=a,e[m]=a,Q.call(e,r,w.engine),e},this.getOS=function(){var e={};return e[p]=a,e[m]=a,Q.call(e,r,w.os),S&&!e[p]&&y&&y.platform&&"Unknown"!=y.platform&&(e[p]=y.platform.replace(/chrome os/i,U).replace(/macos/i,z)),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 r},this.setUA=function(e){return r=typeof e===c&&e.length>500?W(e,500):e,this},this.setUA(r),this};J.VERSION="1.0.38",J.BROWSER=q([p,m,u]),J.CPU=q([g]),J.DEVICE=q([d,f,h,y,b,w,v,S,E]),J.ENGINE=J.OS=q([p,m]),typeof t!==s?(e.exports&&(t=e.exports=J),t.UAParser=J):n.amdO?(r=function(){return J}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=J);var Z=typeof i!==s&&(i.jQuery||i.Zepto);if(Z&&!Z.ua){var ee=new J;Z.ua=ee.getResult(),Z.ua.get=function(){return ee.getUA()},Z.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var n in t)Z.ua[n]=t[n]}}}("object"==typeof window?window:this)},6089:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__6089__},7781:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__7781__},8531:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8531__},2007:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__2007__},4201:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__4201__},3241:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__3241__},1308:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__1308__},5959:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__5959__},8398:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8398__},1159:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__1159__},1269:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__1269__},6212:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__addDisposableResource:()=>I,__assign:()=>a,__asyncDelegator:()=>_,__asyncGenerator:()=>O,__asyncValues:()=>T,__await:()=>x,__awaiter:()=>f,__classPrivateFieldGet:()=>R,__classPrivateFieldIn:()=>j,__classPrivateFieldSet:()=>D,__createBinding:()=>g,__decorate:()=>s,__disposeResources:()=>L,__esDecorate:()=>c,__exportStar:()=>y,__extends:()=>i,__generator:()=>m,__importDefault:()=>A,__importStar:()=>P,__makeTemplateObject:()=>C,__metadata:()=>h,__param:()=>l,__propKey:()=>d,__read:()=>v,__rest:()=>o,__runInitializers:()=>u,__setFunctionName:()=>p,__spread:()=>w,__spreadArray:()=>E,__spreadArrays:()=>S,__values:()=>b,default:()=>M});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)};function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}function l(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,i,a){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),p=!1,h=n.length-1;h>=0;h--){var f={};for(var m in r)f[m]="access"===m?{}:r[m];for(var m in r.access)f.access[m]=r.access[m];f.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(e||null))};var g=(0,n[h])("accessor"===l?{get:d.get,set:d.set}:d[c],f);if("accessor"===l){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(s=o(g.get))&&(d.get=s),(s=o(g.set))&&(d.set=s),(s=o(g.init))&&i.unshift(s)}else(s=o(g))&&("field"===l?i.unshift(s):d[c]=s)}u&&Object.defineProperty(u,r.name,d),p=!0}function u(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function p(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}function m(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var g=Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function y(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||g(t,e,n)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}function S(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function E(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function x(e){return this instanceof x?(this.v=e,this):new x(e)}function O(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),a=[];return r={},o("next"),o("throw"),o("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||s(e,t)}))},t&&(r[e]=t(r[e])))}function s(e,t){try{(n=i[e](t)).value instanceof x?Promise.resolve(n.value.v).then(l,c):u(a[0][2],n)}catch(e){u(a[0][3],e)}var n}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function _(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:x(e[r](t)),done:!1}:i?i(t):t}:i}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=b(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function C(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var k=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function P(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&g(t,e,n);return k(t,e),t}function A(e){return e&&e.__esModule?e:{default:e}}function R(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function D(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function j(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function I(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r,i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],n&&(i=r)}if("function"!=typeof r)throw new TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var N="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function L(e){function t(t){e.error=e.hasError?new N(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var i=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(i).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const M={__extends:i,__assign:a,__rest:o,__decorate:s,__param:l,__metadata:h,__awaiter:f,__generator:m,__createBinding:g,__exportStar:y,__values:b,__read:v,__spread:w,__spreadArrays:S,__spreadArray:E,__await:x,__asyncGenerator:O,__asyncDelegator:_,__asyncValues:T,__makeTemplateObject:C,__importStar:P,__importDefault:A,__classPrivateFieldGet:R,__classPrivateFieldSet:D,__classPrivateFieldIn:j,__addDisposableResource:I,__disposeResources:L}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.amdO={},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),__webpack_require__.p="public/plugins/grafana-pyroscope-app/";var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{plugin:()=>BV});var e={};__webpack_require__.r(e);var t=__webpack_require__(1308),n=__webpack_require__.n(t);__webpack_require__.p=n()&&n().uri?n().uri.slice(0,n().uri.lastIndexOf("/")+1):"public/plugins/grafana-pyroscope-app/";var r=__webpack_require__(7781),i=__webpack_require__(6089),a=__webpack_require__(8531),o=__webpack_require__(2007),s="undefined"==typeof window||"Deno"in globalThis;function l(){}function c(e){return"number"==typeof e&&e>=0&&e!==1/0}function u(e,t){return Math.max(e+(t||0)-Date.now(),0)}function d(e,t){return"function"==typeof e?e(t):e}function p(e,t){return"function"==typeof e?e(t):e}function h(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o)if(r){if(t.queryHash!==m(o,t.options))return!1}else if(!y(t.queryKey,o))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return("boolean"!=typeof s||t.isStale()===s)&&((!i||i===t.state.fetchStatus)&&!(a&&!a(t)))}function f(e,t){const{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(g(t.options.mutationKey)!==g(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return(!r||t.state.status===r)&&!(i&&!i(t))}function m(e,t){return(t?.queryKeyHashFn||g)(e)}function g(e){return JSON.stringify(e,((e,t)=>S(t)?Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}):t))}function y(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&!Object.keys(t).some((n=>!y(e[n],t[n]))))}function b(e,t){if(e===t)return e;const n=w(e)&&w(t);if(n||S(e)&&S(t)){const r=n?e:Object.keys(e),i=r.length,a=n?t:Object.keys(t),o=a.length,s=n?[]:{};let l=0;for(let i=0;i<o;i++){const o=n?i:a[i];(!n&&r.includes(o)||n)&&void 0===e[o]&&void 0===t[o]?(s[o]=void 0,l++):(s[o]=b(e[o],t[o]),s[o]===e[o]&&void 0!==e[o]&&l++)}return i===o&&l===i?e:s}return t}function v(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function S(e){if(!E(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!E(n)&&(!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype)}function E(e){return"[object Object]"===Object.prototype.toString.call(e)}function x(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?b(e,t):t}function O(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function _(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var T=Symbol(),C=(e,t)=>!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==T?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`));var k=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=e=>setTimeout(e,0);const a=r=>{t?e.push(r):i((()=>{n(r)}))},o=()=>{const t=e;e=[],t.length&&i((()=>{r((()=>{t.forEach((e=>{n(e)}))}))}))};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a((()=>{e(...t)}))},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}(),P=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},A=new class extends P{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!s&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e((e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach((t=>{t(e)}))}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},R=new class extends P{#r=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!s&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#r!==e&&(this.#r=e,this.listeners.forEach((t=>{t(e)})))}isOnline(){return this.#r}};function D(e){return Math.min(1e3*2**e,3e4)}function j(e){return"online"!==(e??"online")||R.isOnline()}var I=class{constructor(e){this.revert=e?.revert,this.silent=e?.silent}};function N(e){return e instanceof I}function L(e){let t,n,r,i=!1,a=0,o=!1;const l=new Promise(((e,t)=>{n=e,r=t})),c=()=>A.isFocused()&&("always"===e.networkMode||R.isOnline())&&e.canRun(),u=()=>j(e.networkMode)&&e.canRun(),d=r=>{o||(o=!0,e.onSuccess?.(r),t?.(),n(r))},p=n=>{o||(o=!0,e.onError?.(n),t?.(),r(n))},h=()=>new Promise((n=>{t=e=>{(o||c())&&n(e)},e.onPause?.()})).then((()=>{t=void 0,o||e.onContinue?.()})),f=()=>{if(o)return;let t;const n=0===a?e.initialPromise:void 0;try{t=n??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(d).catch((t=>{if(o)return;const n=e.retry??(s?0:3),r=e.retryDelay??D,l="function"==typeof r?r(a,t):r,u=!0===n||"number"==typeof n&&a<n||"function"==typeof n&&n(a,t);var d;!i&&u?(a++,e.onFail?.(a,t),(d=l,new Promise((e=>{setTimeout(e,d)}))).then((()=>c()?void 0:h())).then((()=>{i?p(t):f()}))):p(t)}))};return{promise:l,cancel:t=>{o||(p(new I(t)),e.abort?.())},continue:()=>(t?.(),l),cancelRetry:()=>{i=!0},continueRetry:()=>{i=!1},canStart:u,start:()=>(u()?f():h().then(f),l)}}var M=class{#i;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),c(this.gcTime)&&(this.#i=setTimeout((()=>{this.optionalRemove()}),this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(s?1/0:3e5))}clearGcTimeout(){this.#i&&(clearTimeout(this.#i),this.#i=void 0)}},F=class extends M{#a;#o;#s;#l;#c;#u;constructor(e){super(),this.#u=!1,this.#c=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#a=e.state||function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=this.#a,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(e){this.options={...this.#c,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#s.remove(this)}setData(e,t){const n=x(this.state.data,e,this.options);return this.#d({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#d({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#l?.promise;return this.#l?.cancel(e),t?t.then(l).catch(l):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#a)}isActive(){return this.observers.some((e=>!1!==p(e.options.enabled,this)))}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some((e=>e.getCurrentResult().isStale)):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!u(this.state.dataUpdatedAt,e)}onFocus(){const e=this.observers.find((e=>e.shouldFetchOnWindowFocus()));e?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){const e=this.observers.find((e=>e.shouldFetchOnReconnect()));e?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter((t=>t!==e)),this.observers.length||(this.#l&&(this.#u?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#d({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find((e=>e.options.queryFn));e&&this.setOptions(e.options)}const n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#u=!0,n.signal)})},i={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{const e=C(this.options,t),n={queryKey:this.queryKey,meta:this.meta};return r(n),this.#u=!1,this.options.persister?this.options.persister(e,n,this):e(n)}};r(i),this.options.behavior?.onFetch(i,this),this.#o=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===i.fetchOptions?.meta||this.#d({type:"fetch",meta:i.fetchOptions?.meta});const a=e=>{N(e)&&e.silent||this.#d({type:"error",error:e}),N(e)||(this.#s.config.onError?.(e,this),this.#s.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#l=L({initialPromise:t?.initialPromise,fn:i.fetchFn,abort:n.abort.bind(n),onSuccess:e=>{void 0!==e?(this.setData(e),this.#s.config.onSuccess?.(e,this),this.#s.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1):a(new Error(`${this.queryHash} data is undefined`))},onError:a,onFail:(e,t)=>{this.#d({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#d({type:"pause"})},onContinue:()=>{this.#d({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}),this.#l.start()}#d(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...$(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return N(n)&&n.revert&&this.#o?{...this.#o,fetchStatus:"idle"}:{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),k.batch((()=>{this.observers.forEach((e=>{e.onQueryUpdate()})),this.#s.notify({query:this,type:"updated",action:e})}))}};function $(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:j(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var B=class extends P{constructor(e={}){super(),this.config=e,this.#p=new Map}#p;build(e,t,n){const r=t.queryKey,i=t.queryHash??m(r,t);let a=this.get(i);return a||(a=new F({cache:this,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#p.has(e.queryHash)||(this.#p.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#p.get(e.queryHash);t&&(e.destroy(),t===e&&this.#p.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){k.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}get(e){return this.#p.get(e)}getAll(){return[...this.#p.values()]}find(e){const t={exact:!0,...e};return this.getAll().find((e=>h(t,e)))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter((t=>h(e,t))):t}notify(e){k.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}onFocus(){k.batch((()=>{this.getAll().forEach((e=>{e.onFocus()}))}))}onOnline(){k.batch((()=>{this.getAll().forEach((e=>{e.onOnline()}))}))}},V=class extends M{#h;#f;#l;constructor(e){super(),this.mutationId=e.mutationId,this.#f=e.mutationCache,this.#h=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#h.includes(e)||(this.#h.push(e),this.clearGcTimeout(),this.#f.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#h=this.#h.filter((t=>t!==e)),this.scheduleGc(),this.#f.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#h.length||("pending"===this.state.status?this.scheduleGc():this.#f.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(e){this.#l=L({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#d({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#d({type:"pause"})},onContinue:()=>{this.#d({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#f.canRun(this)});const t="pending"===this.state.status,n=!this.#l.canStart();try{if(!t){this.#d({type:"pending",variables:e,isPaused:n}),await(this.#f.config.onMutate?.(e,this));const t=await(this.options.onMutate?.(e));t!==this.state.context&&this.#d({type:"pending",context:t,variables:e,isPaused:n})}const r=await this.#l.start();return await(this.#f.config.onSuccess?.(r,e,this.state.context,this)),await(this.options.onSuccess?.(r,e,this.state.context)),await(this.#f.config.onSettled?.(r,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(r,null,e,this.state.context)),this.#d({type:"success",data:r}),r}catch(t){try{throw await(this.#f.config.onError?.(t,e,this.state.context,this)),await(this.options.onError?.(t,e,this.state.context)),await(this.#f.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,t,e,this.state.context)),t}finally{this.#d({type:"error",error:t})}}finally{this.#f.runNext(this)}}#d(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),k.batch((()=>{this.#h.forEach((t=>{t.onMutationUpdate(e)})),this.#f.notify({mutation:this,type:"updated",action:e})}))}};var U=class extends P{constructor(e={}){super(),this.config=e,this.#m=new Map,this.#g=Date.now()}#m;#g;build(e,t,n){const r=new V({mutationCache:this,mutationId:++this.#g,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){const t=z(e),n=this.#m.get(t)??[];n.push(e),this.#m.set(t,n),this.notify({type:"added",mutation:e})}remove(e){const t=z(e);if(this.#m.has(t)){const n=this.#m.get(t)?.filter((t=>t!==e));n&&(0===n.length?this.#m.delete(t):this.#m.set(t,n))}this.notify({type:"removed",mutation:e})}canRun(e){const t=this.#m.get(z(e))?.find((e=>"pending"===e.state.status));return!t||t===e}runNext(e){const t=this.#m.get(z(e))?.find((t=>t!==e&&t.state.isPaused));return t?.continue()??Promise.resolve()}clear(){k.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}getAll(){return[...this.#m.values()].flat()}find(e){const t={exact:!0,...e};return this.getAll().find((e=>f(t,e)))}findAll(e={}){return this.getAll().filter((t=>f(e,t)))}notify(e){k.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}resumePausedMutations(){const e=this.getAll().filter((e=>e.state.isPaused));return k.batch((()=>Promise.all(e.map((e=>e.continue().catch(l))))))}};function z(e){return e.options.scope?.id??String(e.mutationId)}function q(e){return{onFetch:(t,n)=>{const r=async()=>{const n=t.options,r=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[],o={pages:[],pageParams:[]};let s=!1;const l=C(t.options,t.fetchOptions),c=async(e,n,r)=>{if(s)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);const i={queryKey:t.queryKey,pageParam:n,direction:r?"backward":"forward",meta:t.options.meta};var a;a=i,Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(t.signal.aborted?s=!0:t.signal.addEventListener("abort",(()=>{s=!0})),t.signal)});const o=await l(i),{maxPages:c}=t.options,u=r?_:O;return{pages:u(e.pages,o,c),pageParams:u(e.pageParams,n,c)}};let u;if(r&&i.length){const e="backward"===r,t={pages:i,pageParams:a},o=(e?G:H)(n,t);u=await c(t,o,e)}else{u=await c(o,a[0]??n.initialPageParam);const t=e??i.length;for(let e=1;e<t;e++){const e=H(n,u);u=await c(u,e)}}return u};t.options.persister?t.fetchFn=()=>t.options.persister?.(r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=r}}}function H(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function G(e,{pages:t,pageParams:n}){return e.getPreviousPageParam?.(t[0],t,n[0],n)}const W=new class{#y;#f;#c;#b;#v;#w;#S;#E;constructor(e={}){this.#y=e.queryCache||new B,this.#f=e.mutationCache||new U,this.#c=e.defaultOptions||{},this.#b=new Map,this.#v=new Map,this.#w=0}mount(){this.#w++,1===this.#w&&(this.#S=A.subscribe((async e=>{e&&(await this.resumePausedMutations(),this.#y.onFocus())})),this.#E=R.subscribe((async e=>{e&&(await this.resumePausedMutations(),this.#y.onOnline())})))}unmount(){this.#w--,0===this.#w&&(this.#S?.(),this.#S=void 0,this.#E?.(),this.#E=void 0)}isFetching(e){return this.#y.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#f.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#y.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(void 0===t)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=this.#y.build(this,n);return e.revalidateIfStale&&r.isStaleByTime(d(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return this.#y.findAll(e).map((({queryKey:e,state:t})=>[e,t.data]))}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#y.get(r.queryHash),a=i?.state.data,o=function(e,t){return"function"==typeof e?e(t):e}(t,a);if(void 0!==o)return this.#y.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return k.batch((()=>this.#y.findAll(e).map((({queryKey:e})=>[e,this.setQueryData(e,t,n)]))))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#y.get(t.queryHash)?.state}removeQueries(e){const t=this.#y;k.batch((()=>{t.findAll(e).forEach((e=>{t.remove(e)}))}))}resetQueries(e,t){const n=this.#y,r={type:"active",...e};return k.batch((()=>(n.findAll(e).forEach((e=>{e.reset()})),this.refetchQueries(r,t))))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=k.batch((()=>this.#y.findAll(e).map((e=>e.cancel(n)))));return Promise.all(r).then(l).catch(l)}invalidateQueries(e={},t={}){return k.batch((()=>{if(this.#y.findAll(e).forEach((e=>{e.invalidate()})),"none"===e.refetchType)return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)}))}refetchQueries(e={},t){const n={...t,cancelRefetch:t?.cancelRefetch??!0},r=k.batch((()=>this.#y.findAll(e).filter((e=>!e.isDisabled())).map((e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(l)),"paused"===e.state.fetchStatus?Promise.resolve():t}))));return Promise.all(r).then(l)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#y.build(this,t);return n.isStaleByTime(d(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(l).catch(l)}fetchInfiniteQuery(e){return e.behavior=q(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(l).catch(l)}resumePausedMutations(){return R.isOnline()?this.#f.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#y}getMutationCache(){return this.#f}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#b.set(g(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#b.values()];let n={};return t.forEach((t=>{y(e,t.queryKey)&&(n={...n,...t.defaultOptions})})),n}setMutationDefaults(e,t){this.#v.set(g(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#v.values()];let n={};return t.forEach((t=>{y(e,t.mutationKey)&&(n={...n,...t.defaultOptions})})),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=m(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===T&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#y.clear(),this.#f.clear()}}({defaultOptions:{queries:{networkMode:"always",retry:!1,refetchOnWindowFocus:!1}}});var Q;!function(e){e.EXCEPTION="exception",e.LOG="log",e.MEASUREMENT="measurement",e.TRACE="trace",e.EVENT="event"}(Q||(Q={}));const K={[Q.EXCEPTION]:"exceptions",[Q.LOG]:"logs",[Q.MEASUREMENT]:"measurements",[Q.TRACE]:"traces",[Q.EVENT]:"events"};function Y(){return Date.now()}function X(){return(new Date).toISOString()}function J(e){return new Date(e).toISOString()}function Z(e,t){return typeof e===t}function ee(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function te(e,t){try{return e instanceof t}catch(e){return!1}}const ne=e=>Z(e,"null"),re=e=>Z(e,"string"),ie=e=>Z(e,"number")&&!isNaN(e)||Z(e,"bigint"),ae=e=>!ne(e)&&Z(e,"object"),oe=e=>Z(e,"function"),se=e=>ee(e,"Array"),le="undefined"!=typeof Event,ce=e=>le&&te(e,Event),ue="undefined"!=typeof Error,de=e=>ue&&te(e,Error),pe=e=>ee(e,"ErrorEvent"),he=e=>ee(e,"DOMError"),fe=e=>ee(e,"DOMException");function me(e,t){if(e===t)return!0;if(Z(e,"number")&&isNaN(e))return Z(t,"number")&&isNaN(t);const n=se(e),r=se(t);if(n!==r)return!1;if(n&&r){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!me(e[r],t[r]))return!1;return!0}const i=ae(e),a=ae(t);if(i!==a)return!1;if(e&&t&&i&&a){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;for(let r of n)if(!me(e[r],t[r]))return!1;return!0}return!1}const ge="Error";let ye;var be;!function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.LOG="log",e.WARN="warn",e.ERROR="error"}(be||(be={}));const ve=be.LOG,we=[be.TRACE,be.DEBUG,be.INFO,be.LOG,be.WARN,be.ERROR],Se=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");function Ee(e,t,n,r,i){t.debug("Initializing API");const a=function(e,t,n,r,i){let a;return t.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),a={trace:e,context:n}},isOTELInitialized:()=>!!a,pushTraces:e=>{try{const n={type:Q.TRACE,payload:e,meta:r.value};t.debug("Pushing trace\n",n),i.execute(n)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,i);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(e,t,n,r,i,a){var o;t.debug("Initializing exceptions API");let s=null;ye=null!==(o=n.parseStacktrace)&&void 0!==o?o:ye;const l=e=>{t.debug("Changing stacktrace parser"),ye=null!=e?e:ye};return l(n.parseStacktrace),{changeStacktraceParser:l,getStacktraceParser:()=>ye,pushError:(e,{skipDedupe:o,stackFrames:l,type:c,context:u,spanContext:d,timestampOverwriteMs:p}={})=>{c=c||e.name||ge;const h={meta:r.value,payload:{type:c,value:e.message,timestamp:p?J(p):X(),trace:d?{trace_id:d.traceId,span_id:d.spanId}:a.getTraceContext(),context:null!=u?u:{}},type:Q.EXCEPTION};(null==(l=null!=l?l:e.stack?null==ye?void 0:ye(e).frames:void 0)?void 0:l.length)&&(h.payload.stacktrace={frames:l});const f={type:h.payload.type,value:h.payload.value,stackTrace:h.payload.stacktrace,context:h.payload.context};o||!n.dedupe||ne(s)||!me(f,s)?(s=f,t.debug("Pushing exception\n",h),i.execute(h)):t.debug("Skipping error push because it is the same as the last one\n",h.payload)}}}(0,t,n,r,i,a)),function(e,t,n,r,i){let a,o,s;t.debug("Initializing meta API");const l=e=>{o&&r.remove(o),o={user:e},r.add(o)},c=e=>{a&&r.remove(a),a={session:e},r.add(a)};return{setUser:l,resetUser:l,setSession:c,resetSession:c,getSession:()=>r.value.session,setView:e=>{var t;if((null===(t=null==s?void 0:s.view)||void 0===t?void 0:t.name)===(null==e?void 0:e.name))return;const n=s;s={view:e},r.add(s),n&&r.remove(n)},getView:()=>r.value.view}}(0,t,0,r)),function(e,t,n,r,i,a){var o;t.debug("Initializing logs API");let s=null;const l=null!==(o=n.logArgsSerializer)&&void 0!==o?o:Se;return{pushLog:(e,{context:o,level:c,skipDedupe:u,spanContext:d,timestampOverwriteMs:p}={})=>{try{const h={type:Q.LOG,payload:{message:l(e),level:null!=c?c:ve,context:null!=o?o:{},timestamp:p?J(p):X(),trace:d?{trace_id:d.traceId,span_id:d.spanId}:a.getTraceContext()},meta:r.value},f={message:h.payload.message,level:h.payload.level,context:h.payload.context};if(!u&&n.dedupe&&!ne(s)&&me(f,s))return void t.debug("Skipping log push because it is the same as the last one\n",h.payload);s=f,t.debug("Pushing log\n",h),i.execute(h)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,n,r,i,a)),function(e,t,n,r,i,a){t.debug("Initializing measurements API");let o=null;return{pushMeasurement:(e,{skipDedupe:s,context:l,spanContext:c,timestampOverwriteMs:u}={})=>{try{const d={type:Q.MEASUREMENT,payload:Object.assign(Object.assign({},e),{trace:c?{trace_id:c.traceId,span_id:c.spanId}:a.getTraceContext(),timestamp:u?J(u):X(),context:null!=l?l:{}}),meta:r.value},p={type:d.payload.type,values:d.payload.values,context:d.payload.context};if(!s&&n.dedupe&&!ne(o)&&me(p,o))return void t.debug("Skipping measurement push because it is the same as the last one\n",d.payload);o=p,t.debug("Pushing measurement\n",d),i.execute(d)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,n,r,i,a)),function(e,t,n,r,i,a){let o=null;return{pushEvent:(e,s,l,{skipDedupe:c,spanContext:u,timestampOverwriteMs:d}={})=>{try{const p={meta:r.value,payload:{name:e,domain:null!=l?l:n.eventDomain,attributes:s,timestamp:d?J(d):X(),trace:u?{trace_id:u.traceId,span_id:u.spanId}:a.getTraceContext()},type:Q.EVENT},h={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!c&&n.dedupe&&!ne(o)&&me(h,o))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);o=h,t.debug("Pushing event\n",p),i.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,n,r,i,a))}function xe(){}var Oe;!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"}(Oe||(Oe={}));const _e={debug:xe,error:xe,info:xe,prefix:"Faro",warn:xe},Te=Oe.ERROR,Ce=Object.assign({},console);function ke(e=Ce,t=Te){const n=_e;return t>Oe.OFF&&(n.error=t>=Oe.ERROR?function(...t){e.error(`${n.prefix}\n`,...t)}:xe,n.warn=t>=Oe.WARN?function(...t){e.warn(`${n.prefix}\n`,...t)}:xe,n.info=t>=Oe.INFO?function(...t){e.info(`${n.prefix}\n`,...t)}:xe,n.debug=t>=Oe.VERBOSE?function(...t){e.debug(`${n.prefix}\n`,...t)}:xe),n}let Pe=_e;function Ae(e,t){return Pe=ke(e,t.internalLoggerLevel),Pe}const Re="undefined"!=typeof globalThis?globalThis:void 0!==__webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self?self:void 0;const De="1.10.0";const je="_faroInternal";let Ie={};function Ne(e,t,n,r,i,a,o){return t.debug("Initializing Faro"),Ie={api:a,config:n,instrumentations:o,internalLogger:t,metas:r,pause:i.pause,transports:i,unpatchedConsole:e,unpause:i.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(Re,je,{configurable:!1,enumerable:!1,writable:!1,value:e}))}(Ie),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 Re)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(Re,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(Ie),Ie}class Le{constructor(e,t){var n,r;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(r=null==t?void 0:t.sendTimeout)&&void 0!==r?r: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 n=JSON.stringify(e.meta);let r=t.get(n);r=void 0===r?[e]:[...r,e],t.set(n,r)})),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}function Me(e){return t=>{if(t.type===Q.EXCEPTION&&t.payload){const n=t.payload,r=`${n.type}: ${n.value}`;if(function(e,t){return e.some((e=>re(e)?t.includes(e):!!t.match(e)))}(e,r))return null}return t}}function Fe(e,t,n,r){var i;t.debug("Initializing transports");const a=[];let o=n.paused,s=[];const l=e=>{let t=e;for(const e of s){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=n}return t},c=e=>{const n=l(e);if(0!==n.length)for(const e of a)t.debug(`Transporting item using ${e.name}\n`,n),e.isBatched()&&e.send(n)};let u;(null===(i=n.batching)||void 0===i?void 0:i.enabled)&&(u=new Le(c,{sendTimeout:n.batching.sendTimeout,itemLimit:n.batching.itemLimit,paused:o}));return{add:(...i)=>{t.debug("Adding transports"),i.forEach((i=>{t.debug(`Adding "${i.name}" transport`);a.some((e=>e===i))?t.warn(`Transport ${i.name} is already added`):(i.unpatchedConsole=e,i.internalLogger=t,i.config=n,i.metas=r,a.push(i))}))},addBeforeSendHooks:(...e)=>{t.debug("Adding beforeSendHooks\n",s),e.forEach((e=>{e&&s.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{t.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&s.push(Me(e))}))},getBeforeSendHooks:()=>[...s],execute:e=>{var r;o||((null===(r=n.batching)||void 0===r?void 0:r.enabled)&&(null==u||u.addItem(e)),(e=>{var r,i;if((null===(r=n.batching)||void 0===r?void 0:r.enabled)&&a.every((e=>e.isBatched())))return;const[o]=l([e]);if(void 0!==o)for(const e of a)t.debug(`Transporting item using ${e.name}\n`,o),e.isBatched()?(null===(i=n.batching)||void 0===i?void 0:i.enabled)||e.send([o]):e.send(o)})(e))},isPaused:()=>o,pause:()=>{t.debug("Pausing transports"),null==u||u.pause(),o=!0},remove:(...e)=>{t.debug("Removing transports"),e.forEach((e=>{t.debug(`Removing "${e.name}" transport`);const n=a.indexOf(e);-1!==n?a.splice(n,1):t.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{s.filter((t=>!e.includes(t)))},get transports(){return[...a]},unpause:()=>{t.debug("Unpausing transports"),null==u||u.start(),o=!1}}}let $e=Ce;function Be(e){var t;return $e=null!==(t=e.unpatchedConsole)&&void 0!==t?t:$e,$e}function Ve(e){const t=Be(e),n=Ae(t,e);if(je in Re&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const r=function(e,t,n){let r=[],i=[];const a=()=>r.reduce(((e,t)=>Object.assign(e,oe(t)?t():t)),{}),o=()=>{if(i.length){const e=a();i.forEach((t=>t(e)))}};return{add:(...e)=>{t.debug("Adding metas\n",e),r.push(...e),o()},remove:(...e)=>{t.debug("Removing metas\n",e),r=r.filter((t=>!e.includes(t))),o()},addListener:e=>{t.debug("Adding metas listener\n",e),i.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),i=i.filter((t=>t!==e))},get value(){return a()}}}(0,n),i=Fe(t,n,e,r),a=Ee(0,n,e,r,i),o=function(e,t,n,r,i,a){t.debug("Initializing instrumentations");const o=[];return{add:(...s)=>{t.debug("Adding instrumentations"),s.forEach((s=>{t.debug(`Adding "${s.name}" instrumentation`),o.some((e=>e.name===s.name))?t.warn(`Instrumentation ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=t,s.config=n,s.metas=r,s.transports=i,s.api=a,o.push(s),s.initialize())}))},get instrumentations(){return[...o]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach((e=>{var n,r;t.debug(`Removing "${e.name}" instrumentation`);const i=o.reduce(((t,n,r)=>null===t&&n.name===e.name?r:null),null);i?(null===(r=(n=o[i]).destroy)||void 0===r||r.call(n),o.splice(i,1)):t.warn(`Instrumentation "${e.name}" is not added`)}))}}}(t,n,e,r,i,a),s=Ne(t,n,e,r,i,a,o);return function(e){var t,n;const r={sdk:{version:De},app:{bundleId:e.config.app.name&&(i=e.config.app.name,null==Re?void 0:Re[`__faroBundleId_${i}`])}};var i;const a=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;a&&e.api.setSession(a),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(s),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(s),function(e){e.instrumentations.add(...e.config.instrumentations)}(s),s}const Ue="faro",ze={enabled:!0,sendTimeout:250,itemLimit:50},qe="browser",He="\n",Ge="eval",We="?",Qe="@",Ke=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ye=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xe="eval",Je="address at ",Ze=Je.length,et=/^\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,tt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nt=" > eval",rt="safari-extension",it="safari-web-extension",at=/Minified React error #\d+;/i;function ot(e,t,n,r){const i={filename:e||document.location.href,function:t||We};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}function st(e,t){const n=null==e?void 0:e.includes(rt),r=!n&&(null==e?void 0:e.includes(it));return n||r?[(null==e?void 0:e.includes(Qe))?e.split(Qe)[0]:e,n?`${rt}:${t}`:`${it}:${t}`]:[e,t]}function lt(e){let t=[];e.stacktrace?t=e.stacktrace.split(He).filter(((e,t)=>t%2==0)):e.stack&&(t=e.stack.split(He));const n=t.reduce(((t,n,r)=>{let i,a,o,s,l;if(i=Ke.exec(n)){if(a=i[1],o=i[2],s=i[3],l=i[4],null==o?void 0:o.startsWith(Xe)){const e=Ye.exec(o);e&&(o=e[1],s=e[2],l=e[3])}o=(null==o?void 0:o.startsWith(Je))?o.substring(Ze):o,[a,o]=st(a,o)}else if(i=et.exec(n)){if(a=i[1],o=i[3],s=i[4],l=i[5],o&&o.includes(nt)){const e=tt.exec(o);e&&(a=a||Ge,o=e[1],s=e[2])}else 0===r&&!l&&ie(e.columnNumber)&&(l=String(e.columnNumber+1));[a,o]=st(a,o)}return(o||a)&&t.push(ot(o,a,s?Number(s):void 0,l?Number(l):void 0)),t}),[]);return at.test(e.message)?n.slice(1):n}function ct(e){return{frames:lt(e)}}const ut="com.grafana.faro.session",dt=144e5,pt=9e5,ht={enabled:!0,persistent:!1,maxSessionPersistenceTime:pt};var ft=__webpack_require__(6660);const mt="unknown",gt=[()=>{const e=new ft.UAParser,{name:t,version:n}=e.getBrowser(),{name:r,version:i}=e.getOS(),a=e.getUA(),o=navigator.language,s=navigator.userAgent.includes("Mobi"),l=function(){if(!t||!n)return;if("userAgentData"in navigator&&navigator.userAgentData)return navigator.userAgentData.brands;return}();return{browser:{name:null!=t?t:mt,version:null!=n?n:mt,os:`${null!=r?r:mt} ${null!=i?i:mt}`,userAgent:null!=a?a:mt,language:null!=o?o:mt,mobile:s,brands:null!=l?l:mt,viewportWidth:`${window.innerWidth}`,viewportHeight:`${window.innerHeight}`}}},()=>({page:{url:location.href}})],yt=()=>{const e=window.k6;return{k6:Object.assign({isK6Browser:!0},(null==e?void 0:e.testRunId)&&{testRunId:null==e?void 0:e.testRunId})}};class bt{constructor(){this.unpatchedConsole=Ce,this.internalLogger=_e,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 vt extends bt{isBatched(){return!1}getIgnoreUrls(){return[]}}function wt(e,t){var n,r;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const i=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===i)return e;const a=(null==i?void 0:i.scopeSpans)||[],o=(null===(r=null==t?void 0:t[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},i),{scopeSpans:[...a,...o]})]})}function St(e,t){let n,r=!1;const i=()=>{null!=n?(e(...n),n=null,setTimeout(i,t)):r=!1};return(...a)=>{r?n=a:(e(...a),r=!0,setTimeout(i,t))}}const Et={session:"sessionStorage",local:"localStorage"};function xt(e){var t;try{let t;t=window[e];const n="__faro_storage_test__";return t.setItem(n,n),t.removeItem(n),!0}catch(n){return null===(t=Ie.internalLogger)||void 0===t||t.info(`Web storage of type ${e} is not available. Reason: ${n}`),!1}}function Ot(e,t){return Pt(t)?window[t].getItem(e):null}function _t(e,t,n){if(Pt(n))try{window[n].setItem(e,t)}catch(e){}}function Tt(e,t){Pt(t)&&window[t].removeItem(e)}const Ct=xt(Et.local),kt=xt(Et.session);function Pt(e){return e===Et.local?Ct:e===Et.session&&kt}function At(){var e,t,n;const r=Ie.config.sessionTracking;let i=null!==(n=null!==(t=null===(e=null==r?void 0:r.sampler)||void 0===e?void 0:e.call(r,{metas:Ie.metas.value}))&&void 0!==t?t:null==r?void 0:r.samplingRate)&&void 0!==n?n:1;if("number"!=typeof i){i=0}return Math.random()<i}const Rt="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function Dt(e=10){return Array.from(Array(e)).map((()=>Rt[Math.floor(Math.random()*Rt.length)])).join("")}function jt({sessionId:e,started:t,lastActivity:n,isSampled:r=!0}={}){var i,a;const o=Y(),s=null===(a=null===(i=Ie.config)||void 0===i?void 0:i.sessionTracking)||void 0===a?void 0:a.generateSessionId;return null==e&&(e="function"==typeof s?s():Dt()),{sessionId:e,lastActivity:null!=n?n:o,started:null!=t?t:o,isSampled:r}}function It(e){if(null==e)return!1;const t=Y();if(!(t-e.started<dt))return!1;return t-e.lastActivity<pt}function Nt({fetchUserSession:e,storeUserSession:t}){return function({forceSessionExtend:n}={forceSessionExtend:!1}){var r,i,a;if(!e||!t)return;const o=Ie.config.sessionTracking,s=null==o?void 0:o.persistent;if(s&&!Ct||!s&&!kt)return;const l=e();if(!1===n&&It(l))t(Object.assign(Object.assign({},l),{lastActivity:Y()}));else{let e=Lt(jt({isSampled:At()}),l);t(e),null===(r=Ie.api)||void 0===r||r.setSession(e.sessionMeta),null===(i=null==o?void 0:o.onSessionChange)||void 0===i||i.call(o,null!==(a=null==l?void 0:l.sessionMeta)&&void 0!==a?a:null,e.sessionMeta)}}}function Lt(e,t){var n,r,i,a;return Object.assign(Object.assign({},e),{sessionMeta:{id:e.sessionId,attributes:Object.assign(Object.assign(Object.assign(Object.assign({},null===(r=null===(n=Ie.config.sessionTracking)||void 0===n?void 0:n.session)||void 0===r?void 0:r.attributes),null!==(a=null===(i=Ie.metas.value.session)||void 0===i?void 0:i.attributes)&&void 0!==a?a:{}),null!=t?{previousSession:t.sessionId}:{}),{isSampled:e.isSampled.toString()})}})}class Mt{constructor(){this.updateSession=St((()=>this.updateUserSession()),1e3),this.updateUserSession=Nt({fetchUserSession:Mt.fetchUserSession,storeUserSession:Mt.storeUserSession}),this.init()}static removeUserSession(){Tt(ut,Mt.storageTypeLocal)}static storeUserSession(e){_t(ut,JSON.stringify(e),Mt.storageTypeLocal)}static fetchUserSession(){const e=Ot(ut,Mt.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),Ie.metas.addListener((function(e){const t=e.session,n=Mt.fetchUserSession();if(t&&t.id!==(null==n?void 0:n.sessionId)){const e=Lt(jt({sessionId:t.id,isSampled:At()}),n);Mt.storeUserSession(e),Ie.api.setSession(e.sessionMeta)}}))}}Mt.storageTypeLocal=Et.local;class Ft{constructor(){this.updateSession=St((()=>this.updateUserSession()),1e3),this.updateUserSession=Nt({fetchUserSession:Ft.fetchUserSession,storeUserSession:Ft.storeUserSession}),this.init()}static removeUserSession(){Tt(ut,Ft.storageTypeSession)}static storeUserSession(e){_t(ut,JSON.stringify(e),Ft.storageTypeSession)}static fetchUserSession(){const e=Ot(ut,Ft.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),Ie.metas.addListener((function(e){const t=e.session,n=Ft.fetchUserSession();if(t&&t.id!==(null==n?void 0:n.sessionId)){const e=Lt(jt({sessionId:t.id,isSampled:At()}),n);Ft.storeUserSession(e),Ie.api.setSession(e.sessionMeta)}}))}}function $t(e){return(null==e?void 0:e.persistent)?Mt:Ft}Ft.storageTypeSession=Et.session;var Bt=function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))},Vt=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};class Ut extends vt{constructor(e){var t,n,r,i;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=De,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(t=e.defaultRateLimitBackoffMs)&&void 0!==t?t:5e3,this.getNow=null!==(n=e.getNow)&&void 0!==n?n:()=>Date.now(),this.promiseBuffer=function(e){const{size:t,concurrency:n}=e,r=[];let i=0;const a=()=>{if(i<n&&r.length){const{producer:e,resolve:t,reject:n}=r.shift();i++,e().then((e=>{i--,a(),t(e)}),(e=>{i--,a(),n(e)}))}};return{add:e=>{if(r.length+i>=t)throw new Error("Task buffer full");return new Promise(((t,n)=>{r.push({producer:e,resolve:t,reject:n}),a()}))}}}({size:null!==(r=e.bufferSize)&&void 0!==r?r:30,concurrency:null!==(i=e.concurrency)&&void 0!==i?i:5})}send(e){return Bt(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 Q.LOG:case Q.EVENT:case Q.EXCEPTION:case Q.MEASUREMENT:const n=K[e.type],r=t[n];t=Object.assign(Object.assign({},t),{[n]:void 0===r?[e.payload]:[...r,e.payload]});break;case Q.TRACE:t=Object.assign(Object.assign({},t),{traces:wt(t.traces,e.payload.resourceSpans)})}})),t}(e)),{url:n,requestOptions:r,apiKey:i}=this.options,a=null!=r?r:{},{headers:o}=a,s=Vt(a,["headers"]);let l;const c=this.metas.value.session;return null!=c&&(l=c.id),fetch(n,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=o?o:{}),i?{"x-api-key":i}:{}),l?{"x-faro-session-id":l}:{}),body:t,keepalive:t.length<=6e4},null!=s?s:{})).then((e=>Bt(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(xe),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(),n=e.headers.get("Retry-After");if(n){const e=Number(n);if(!isNaN(e))return new Date(1e3*e+t);const r=Date.parse(n);if(!isNaN(r))return new Date(r)}return new Date(t+this.rateLimitBackoffMs)}extendFaroSession(e,t){const n="Session expired",r=e.sessionTracking;if(null==r?void 0:r.enabled){const{fetchUserSession:e,storeUserSession:i}=$t(r);Nt({fetchUserSession:e,storeUserSession:i})({forceSessionExtend:!0}),t(`${n} created new session.`)}else t(`${n}.`)}}class zt extends bt{constructor(){super(...arguments),this.api={},this.transports={}}}const qt="DOMError",Ht="DOMException",Gt="Non-Error exception captured with keys:",Wt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Qt(e){let t,n,r,i,a=[];if(pe(e)&&e.error)t=e.error.message,n=e.error.name,a=lt(e.error);else if((r=he(e))||fe(e)){const{name:i,message:a}=e;n=null!=i?i:r?qt:Ht,t=a?`${n}: ${a}`:n}else de(e)?(t=e.message,a=lt(e)):(ae(e)||(i=ce(e)))&&(n=i?e.constructor.name:void 0,t=`${Gt} ${Object.keys(e)}`);return[t,n,a]}function Kt(e){const t=window.onerror;window.onerror=(...n)=>{try{const[t,r,i,a,o]=n;let s,l,c=[];const u=re(t),d=ot(r,"?",i,a);o||!u?([s,l,c]=Qt(null!=o?o:t),0===c.length&&(c=[d])):u&&([s,l]=function(e){var t,n;const r=e.match(Wt),i=null!==(t=null==r?void 0:r[1])&&void 0!==t?t:ge;return[null!==(n=null==r?void 0:r[2])&&void 0!==n?n:e,i]}(t),c=[d]),s&&e.pushError(new Error(s),{type:l,stackFrames:c})}finally{null==t||t.apply(window,n)}}}function Yt(e){window.addEventListener("unhandledrejection",(t=>{var n,r;let i,a,o=t;o.reason?o=t.reason:(null===(n=t.detail)||void 0===n?void 0:n.reason)&&(o=null===(r=t.detail)||void 0===r?void 0:r.reason);let s=[];(e=>!ae(e)&&!oe(e))(o)?(i=`Non-Error promise rejection captured with value: ${String(o)}`,a="UnhandledRejection"):[i,a,s]=Qt(o),i&&e.pushError(new Error(i),{type:a,stackFrames:s})}))}class Xt extends zt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=De}initialize(){this.logDebug("Initializing"),Kt(this.api),Yt(this.api)}}var Jt,Zt,en,tn,nn,rn=-1,an=function(e){addEventListener("pageshow",(function(t){t.persisted&&(rn=t.timeStamp,e(t))}),!0)},on=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},sn=function(){var e=on();return e&&e.activationStart||0},ln=function(e,t){var n=on(),r="navigate";return rn>=0?r="back-forward-cache":n&&(document.prerendering||sn()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},cn=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},un=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},dn=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},pn=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},hn=function(e){var t=!1;return function(){t||(e(),t=!0)}},fn=-1,mn=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},gn=function(e){"hidden"===document.visibilityState&&fn>-1&&(fn="visibilitychange"===e.type?e.timeStamp:0,bn())},yn=function(){addEventListener("visibilitychange",gn,!0),addEventListener("prerenderingchange",gn,!0)},bn=function(){removeEventListener("visibilitychange",gn,!0),removeEventListener("prerenderingchange",gn,!0)},vn=function(){return fn<0&&(fn=mn(),yn(),an((function(){setTimeout((function(){fn=mn(),yn()}),0)}))),{get firstHiddenTime(){return fn}}},wn=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Sn=[1800,3e3],En=function(e,t){t=t||{},wn((function(){var n,r=vn(),i=ln("FCP"),a=cn("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-sn(),0),i.entries.push(e),n(!0)))}))}));a&&(n=un(e,i,Sn,t.reportAllChanges),an((function(r){i=ln("FCP"),n=un(e,i,Sn,t.reportAllChanges),dn((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))},xn=[.1,.25],On=0,_n=1/0,Tn=0,Cn=function(e){e.forEach((function(e){e.interactionId&&(_n=Math.min(_n,e.interactionId),Tn=Math.max(Tn,e.interactionId),On=Tn?(Tn-_n)/7+1:0)}))},kn=function(){"interactionCount"in performance||Jt||(Jt=cn("event",Cn,{type:"event",buffered:!0,durationThreshold:0}))},Pn=[],An=new Map,Rn=0,Dn=function(){return(Jt?On:performance.interactionCount||0)-Rn},jn=[],In=function(e){if(jn.forEach((function(t){return t(e)})),e.interactionId||"first-input"===e.entryType){var t=Pn[Pn.length-1],n=An.get(e.interactionId);if(n||Pn.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};An.set(r.id,r),Pn.push(r)}Pn.sort((function(e,t){return t.latency-e.latency})),Pn.length>10&&Pn.splice(10).forEach((function(e){return An.delete(e.id)}))}}},Nn=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=hn(e),"hidden"===document.visibilityState?e():(n=t(e),pn(e)),n},Ln=[200,500],Mn=[2500,4e3],Fn={},$n=[800,1800],Bn=function e(t){document.prerendering?wn((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},Vn={passive:!0,capture:!0},Un=new Date,zn=function(e,t){Zt||(Zt=t,en=e,tn=new Date,Gn(removeEventListener),qn())},qn=function(){if(en>=0&&en<tn-Un){var e={entryType:"first-input",name:Zt.type,target:Zt.target,cancelable:Zt.cancelable,startTime:Zt.timeStamp,processingStart:Zt.timeStamp+en};nn.forEach((function(t){t(e)})),nn=[]}},Hn=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){zn(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,Vn),removeEventListener("pointercancel",r,Vn)};addEventListener("pointerup",n,Vn),addEventListener("pointercancel",r,Vn)}(t,e):zn(t,e)}},Gn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,Hn,Vn)}))},Wn=[100,300];class Qn{constructor(e){this.pushMeasurement=e}initialize(){Object.entries(Qn.mapping).forEach((([e,t])=>{t((t=>{this.pushMeasurement({type:"web-vitals",values:{[e]:t.value}})}))}))}}Qn.mapping={cls:function(e,t){t=t||{},En(hn((function(){var n,r=ln("CLS",0),i=0,a=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=a[0],n=a[a.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,a.push(e)):(i=e.value,a=[e])}})),i>r.value&&(r.value=i,r.entries=a,n())},s=cn("layout-shift",o);s&&(n=un(e,r,xn,t.reportAllChanges),pn((function(){o(s.takeRecords()),n(!0)})),an((function(){i=0,r=ln("CLS",0),n=un(e,r,xn,t.reportAllChanges),dn((function(){return n()}))})),setTimeout(n,0))})))},fcp:En,fid:function(e,t){t=t||{},wn((function(){var n,r=vn(),i=ln("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(i.value=e.processingStart-e.startTime,i.entries.push(e),n(!0))},o=function(e){e.forEach(a)},s=cn("first-input",o);n=un(e,i,Wn,t.reportAllChanges),s&&(pn(hn((function(){o(s.takeRecords()),s.disconnect()}))),an((function(){var r;i=ln("FID"),n=un(e,i,Wn,t.reportAllChanges),nn=[],en=-1,Zt=null,Gn(addEventListener),r=a,nn.push(r),qn()})))}))},inp:function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},wn((function(){var n;kn();var r,i=ln("INP"),a=function(e){Nn((function(){e.forEach(In);var t,n=(t=Math.min(Pn.length-1,Math.floor(Dn()/50)),Pn[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())}))},o=cn("event",a,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=un(e,i,Ln,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),pn((function(){a(o.takeRecords()),r(!0)})),an((function(){Rn=0,Pn.length=0,An.clear(),i=ln("INP"),r=un(e,i,Ln,t.reportAllChanges)})))})))},lcp:function(e,t){t=t||{},wn((function(){var n,r=vn(),i=ln("LCP"),a=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-sn(),0),i.entries=[e],n())}))},o=cn("largest-contentful-paint",a);if(o){n=un(e,i,Mn,t.reportAllChanges);var s=hn((function(){Fn[i.id]||(a(o.takeRecords()),o.disconnect(),Fn[i.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return Nn(s)}),!0)})),pn(s),an((function(r){i=ln("LCP"),n=un(e,i,Mn,t.reportAllChanges),dn((function(){i.value=performance.now()-r.timeStamp,Fn[i.id]=!0,n(!0)}))}))}}))},ttfb:function(e,t){t=t||{};var n=ln("TTFB"),r=un(e,n,$n,t.reportAllChanges);Bn((function(){var i=on();i&&(n.value=Math.max(i.responseStart-sn(),0),n.entries=[i],r(!0),an((function(){n=ln("TTFB",0),(r=un(e,n,$n,t.reportAllChanges))(!0)})))}))}};var Kn,Yn,Xn,Jn=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Zn=function(e){if("loading"===document.readyState)return"loading";var t=Jn();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},er=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},tr=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:er(r)+(r.classList&&r.classList.value&&r.classList.value.trim()&&r.classList.value.trim().length?"."+r.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},nr=-1,rr=function(){return nr},ir=function(e){addEventListener("pageshow",(function(t){t.persisted&&(nr=t.timeStamp,e(t))}),!0)},ar=function(){var e=Jn();return e&&e.activationStart||0},or=function(e,t){var n=Jn(),r="navigate";return rr()>=0?r="back-forward-cache":n&&(document.prerendering||ar()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},sr=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},lr=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},cr=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ur=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},dr=function(e){var t=!1;return function(){t||(e(),t=!0)}},pr=-1,hr=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},fr=function(e){"hidden"===document.visibilityState&&pr>-1&&(pr="visibilitychange"===e.type?e.timeStamp:0,gr())},mr=function(){addEventListener("visibilitychange",fr,!0),addEventListener("prerenderingchange",fr,!0)},gr=function(){removeEventListener("visibilitychange",fr,!0),removeEventListener("prerenderingchange",fr,!0)},yr=function(){return pr<0&&(pr=hr(),mr(),ir((function(){setTimeout((function(){pr=hr(),mr()}),0)}))),{get firstHiddenTime(){return pr}}},br=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},vr=[1800,3e3],wr=function(e,t){t=t||{},br((function(){var n,r=yr(),i=or("FCP"),a=sr("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-ar(),0),i.entries.push(e),n(!0)))}))}));a&&(n=lr(e,i,vr,t.reportAllChanges),ir((function(r){i=or("FCP"),n=lr(e,i,vr,t.reportAllChanges),cr((function(){i.value=performance.now()-r.timeStamp,n(!0)}))})))}))},Sr=[.1,.25],Er=0,xr=1/0,Or=0,_r=function(e){e.forEach((function(e){e.interactionId&&(xr=Math.min(xr,e.interactionId),Or=Math.max(Or,e.interactionId),Er=Or?(Or-xr)/7+1:0)}))},Tr=[],Cr=new Map,kr=0,Pr=[],Ar=function(e){if(Pr.forEach((function(t){return t(e)})),e.interactionId||"first-input"===e.entryType){var t=Tr[Tr.length-1],n=Cr.get(e.interactionId);if(n||Tr.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};Cr.set(r.id,r),Tr.push(r)}Tr.sort((function(e,t){return t.latency-e.latency})),Tr.length>10&&Tr.splice(10).forEach((function(e){return Cr.delete(e.id)}))}}},Rr=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=dr(e),"hidden"===document.visibilityState?e():(n=t(e),ur(e)),n},Dr=[200,500],jr=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},br((function(){var n;"interactionCount"in performance||Kn||(Kn=sr("event",_r,{type:"event",buffered:!0,durationThreshold:0}));var r,i=or("INP"),a=function(e){Rr((function(){e.forEach(Ar);var t,n=(t=Math.min(Tr.length-1,Math.floor(((Kn?Er:performance.interactionCount||0)-kr)/50)),Tr[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())}))},o=sr("event",a,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=lr(e,i,Dr,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),ur((function(){a(o.takeRecords()),r(!0)})),ir((function(){kr=0,Tr.length=0,Cr.clear(),i=or("INP"),r=lr(e,i,Dr,t.reportAllChanges)})))})))},Ir=[],Nr=[],Lr=new WeakMap,Mr=new Map,Fr=-1,$r=function(e){Ir=Ir.concat(e),Br()},Br=function(){Fr<0&&(Fr=Rr(Vr))},Vr=function(){Mr.size>10&&Mr.forEach((function(e,t){Cr.has(t)||Mr.delete(t)}));var e=Tr.map((function(e){return Lr.get(e.entries[0])})),t=Nr.length-50;Nr=Nr.filter((function(n,r){return r>=t||e.includes(n)}));for(var n=new Set,r=0;r<Nr.length;r++){var i=Nr[r];Gr(i.startTime,i.processingEnd).forEach((function(e){n.add(e)}))}for(var a=0;a<50;a++){var o=Ir[Ir.length-1-a];if(!o||o.startTime<Xn)break;n.add(o)}Ir=Array.from(n),Fr=-1};Pr.push((function(e){e.interactionId&&e.target&&!Mr.has(e.interactionId)&&Mr.set(e.interactionId,e.target)}),(function(e){var t,n=e.startTime+e.duration;Xn=Math.max(Xn,e.processingEnd);for(var r=Nr.length-1;r>=0;r--){var i=Nr[r];if(Math.abs(n-i.renderTime)<=8){(t=i).startTime=Math.min(e.startTime,t.startTime),t.processingStart=Math.min(e.processingStart,t.processingStart),t.processingEnd=Math.max(e.processingEnd,t.processingEnd),t.entries.push(e);break}}t||(t={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:[e]},Nr.push(t)),(e.interactionId||"first-input"===e.entryType)&&Lr.set(e,t),Br()}));var Ur,zr,qr,Hr,Gr=function(e,t){for(var n,r=[],i=0;n=Ir[i];i++)if(!(n.startTime+n.duration<e)){if(n.startTime>t)break;r.push(n)}return r},Wr=[2500,4e3],Qr={},Kr=[800,1800],Yr=function e(t){document.prerendering?br((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},Xr=function(e,t){t=t||{};var n=or("TTFB"),r=lr(e,n,Kr,t.reportAllChanges);Yr((function(){var i=Jn();i&&(n.value=Math.max(i.responseStart-ar(),0),n.entries=[i],r(!0),ir((function(){n=or("TTFB",0),(r=lr(e,n,Kr,t.reportAllChanges))(!0)})))}))},Jr={passive:!0,capture:!0},Zr=new Date,ei=function(e,t){Ur||(Ur=t,zr=e,qr=new Date,ri(removeEventListener),ti())},ti=function(){if(zr>=0&&zr<qr-Zr){var e={entryType:"first-input",name:Ur.type,target:Ur.target,cancelable:Ur.cancelable,startTime:Ur.timeStamp,processingStart:Ur.timeStamp+zr};Hr.forEach((function(t){t(e)})),Hr=[]}},ni=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){ei(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,Jr),removeEventListener("pointercancel",r,Jr)};addEventListener("pointerup",n,Jr),addEventListener("pointercancel",r,Jr)}(t,e):ei(t,e)}},ri=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,ni,Jr)}))},ii=[100,300],ai=function(e,t){!function(e,t){t=t||{},br((function(){var n,r=yr(),i=or("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(i.value=e.processingStart-e.startTime,i.entries.push(e),n(!0))},o=function(e){e.forEach(a)},s=sr("first-input",o);n=lr(e,i,ii,t.reportAllChanges),s&&(ur(dr((function(){o(s.takeRecords()),s.disconnect()}))),ir((function(){var r;i=or("FID"),n=lr(e,i,ii,t.reportAllChanges),Hr=[],zr=-1,Ur=null,ri(addEventListener),r=a,Hr.push(r),ti()})))}))}((function(t){var n=function(e){var t=e.entries[0],n={eventTarget:tr(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:Zn(t.startTime)};return Object.assign(e,{attribution:n})}(t);e(n)}),t)};const oi="com.grafana.faro.lastNavigationId",si="load_state",li="time_to_first_byte";class ci{constructor(e){this.corePushMeasurement=e}initialize(){this.measureCLS(),this.measureFCP(),this.measureFID(),this.measureINP(),this.measureLCP(),this.measureTTFB()}measureCLS(){!function(e,t){!function(e,t){t=t||{},wr(dr((function(){var n,r=or("CLS",0),i=0,a=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=a[0],n=a[a.length-1];i&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(i+=e.value,a.push(e)):(i=e.value,a=[e])}})),i>r.value&&(r.value=i,r.entries=a,n())},s=sr("layout-shift",o);s&&(n=lr(e,r,Sr,t.reportAllChanges),ur((function(){o(s.takeRecords()),n(!0)})),ir((function(){i=0,r=or("CLS",0),n=lr(e,r,Sr,t.reportAllChanges),cr((function(){return n()}))})),setTimeout(n,0))})))}((function(t){var n=function(e){var t,n={};if(e.entries.length){var r=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(r&&r.sources&&r.sources.length){var i=(t=r.sources).find((function(e){return e.node&&1===e.node.nodeType}))||t[0];i&&(n={largestShiftTarget:tr(i.node),largestShiftTime:r.startTime,largestShiftValue:r.value,largestShiftSource:i,largestShiftEntry:r,loadState:Zn(r.startTime)})}}return Object.assign(e,{attribution:n})}(t);e(n)}),t)}((e=>{const{loadState:t,largestShiftValue:n,largestShiftTime:r,largestShiftTarget:i}=e.attribution,a=this.buildInitialValues(e);this.addIfPresent(a,"largest_shift_value",n),this.addIfPresent(a,"largest_shift_time",r);const o=this.buildInitialContext(e);this.addIfPresent(o,si,t),this.addIfPresent(o,"largest_shift_target",i),this.pushMeasurement(a,o)}))}measureFCP(){!function(e,t){wr((function(t){var n=function(e){var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Zn(rr())};if(e.entries.length){var n=Jn(),r=e.entries[e.entries.length-1];if(n){var i=n.activationStart||0,a=Math.max(0,n.responseStart-i);t={timeToFirstByte:a,firstByteToFCP:e.value-a,loadState:Zn(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})}(t);e(n)}),t)}((e=>{const{firstByteToFCP:t,timeToFirstByte:n,loadState:r}=e.attribution,i=this.buildInitialValues(e);this.addIfPresent(i,"first_byte_to_fcp",t),this.addIfPresent(i,li,n);const a=this.buildInitialContext(e);this.addIfPresent(a,si,r),this.pushMeasurement(i,a)}))}measureFID(){ai((e=>{const{eventTime:t,eventTarget:n,eventType:r,loadState:i}=e.attribution,a=this.buildInitialValues(e);this.addIfPresent(a,"event_time",t);const o=this.buildInitialContext(e);this.addIfPresent(o,"event_target",n),this.addIfPresent(o,"event_type",r),this.addIfPresent(o,si,i),this.pushMeasurement(a,o)}))}measureINP(){!function(e,t){Yn||(Yn=sr("long-animation-frame",$r)),jr((function(t){var n=function(e){var t=e.entries[0],n=Lr.get(t),r=t.processingStart,i=n.processingEnd,a=n.entries.sort((function(e,t){return e.processingStart-t.processingStart})),o=Gr(t.startTime,i),s=e.entries.find((function(e){return e.target})),l=s&&s.target||Mr.get(t.interactionId),c=[t.startTime+t.duration,i].concat(o.map((function(e){return e.startTime+e.duration}))),u=Math.max.apply(Math,c),d={interactionTarget:tr(l),interactionTargetElement:l,interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:u,processedEventEntries:a,longAnimationFrameEntries:o,inputDelay:r-t.startTime,processingDuration:i-r,presentationDelay:Math.max(u-i,0),loadState:Zn(t.startTime)};return Object.assign(e,{attribution:d})}(t);e(n)}),t)}((e=>{const{interactionTime:t,presentationDelay:n,inputDelay:r,processingDuration:i,nextPaintTime:a,loadState:o,interactionTarget:s,interactionType:l}=e.attribution,c=this.buildInitialValues(e);this.addIfPresent(c,"interaction_time",t),this.addIfPresent(c,"presentation_delay",n),this.addIfPresent(c,"input_delay",r),this.addIfPresent(c,"processing_duration",i),this.addIfPresent(c,"next_paint_time",a);const u=this.buildInitialContext(e);this.addIfPresent(u,si,o),this.addIfPresent(u,"interaction_target",s),this.addIfPresent(u,"interaction_type",l),this.pushMeasurement(c,u)}))}measureLCP(){!function(e,t){!function(e,t){t=t||{},br((function(){var n,r=yr(),i=or("LCP"),a=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-ar(),0),i.entries=[e],n())}))},o=sr("largest-contentful-paint",a);if(o){n=lr(e,i,Wr,t.reportAllChanges);var s=dr((function(){Qr[i.id]||(a(o.takeRecords()),o.disconnect(),Qr[i.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return Rr(s)}),!0)})),ur(s),ir((function(r){i=or("LCP"),n=lr(e,i,Wr,t.reportAllChanges),cr((function(){i.value=performance.now()-r.timeStamp,Qr[i.id]=!0,n(!0)}))}))}}))}((function(t){var n=function(e){var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n=Jn();if(n){var r=n.activationStart||0,i=e.entries[e.entries.length-1],a=i.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===i.url}))[0],o=Math.max(0,n.responseStart-r),s=Math.max(o,a?(a.requestStart||a.startTime)-r:0),l=Math.max(s,a?a.responseEnd-r:0),c=Math.max(l,i.startTime-r);t={element:tr(i.element),timeToFirstByte:o,resourceLoadDelay:s-o,resourceLoadDuration:l-s,elementRenderDelay:c-l,navigationEntry:n,lcpEntry:i},i.url&&(t.url=i.url),a&&(t.lcpResourceEntry=a)}}return Object.assign(e,{attribution:t})}(t);e(n)}),t)}((e=>{const{elementRenderDelay:t,resourceLoadDelay:n,resourceLoadDuration:r,timeToFirstByte:i,element:a}=e.attribution,o=this.buildInitialValues(e);this.addIfPresent(o,"element_render_delay",t),this.addIfPresent(o,"resource_load_delay",n),this.addIfPresent(o,"resource_load_duration",r),this.addIfPresent(o,li,i);const s=this.buildInitialContext(e);this.addIfPresent(s,"element",a),this.pushMeasurement(o,s)}))}measureTTFB(){!function(e,t){Xr((function(t){var n=function(e){var t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){var n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),s=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:n}}return Object.assign(e,{attribution:t})}(t);e(n)}),t)}((e=>{const{dnsDuration:t,connectionDuration:n,requestDuration:r,waitingDuration:i,cacheDuration:a}=e.attribution,o=this.buildInitialValues(e);this.addIfPresent(o,"dns_duration",t),this.addIfPresent(o,"connection_duration",n),this.addIfPresent(o,"request_duration",r),this.addIfPresent(o,"waiting_duration",i),this.addIfPresent(o,"cache_duration",a);const s=this.buildInitialContext(e);this.pushMeasurement(o,s)}))}buildInitialValues(e){const t=e.name.toLowerCase();return{[t]:e.value,delta:e.delta}}buildInitialContext(e){var t;const n=null!==(t=Ot(oi,Et.session))&&void 0!==t?t:mt;return{id:e.id,rating:e.rating,navigation_type:e.navigationType,navigation_entry_id:n}}pushMeasurement(e,t){this.corePushMeasurement({type:"web-vitals",values:e},{context:t})}addIfPresent(e,t,n){n&&(e[t]=n)}}class ui extends zt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=De}initialize(){this.logDebug("Initializing");this.intializeWebVitalsInstrumentation().initialize()}intializeWebVitalsInstrumentation(){return this.config.trackWebVitalsAttribution?new ci(this.api.pushMeasurement):new Qn(this.api.pushMeasurement)}}const di="session_start",pi="session_resume";class hi extends zt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=De}sendSessionStartEvent(e){var t,n;const r=e.session;if(r&&r.id!==(null===(t=this.notifiedSession)||void 0===t?void 0:t.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(n=r.attributes)||void 0===n?void 0:n.previousSession))return this.api.pushEvent("session_extend",{},void 0,{skipDedupe:!0}),void(this.notifiedSession=r);this.notifiedSession=r,this.api.pushEvent(di,{},void 0,{skipDedupe:!0})}}createInitialSession(e,t){var n,r,i,a,o;let s,l,c=e.fetchUserSession();if(t.persistent&&t.maxSessionPersistenceTime&&c){const e=Y();c.lastActivity<e-t.maxSessionPersistenceTime&&(Mt.removeUserSession(),c=null)}if(It(c)){const e=null==c?void 0:c.sessionId;l=jt({sessionId:e,isSampled:c.isSampled||!1,started:null==c?void 0:c.started}),l.sessionMeta={id:e,attributes:Object.assign(Object.assign(Object.assign({},null===(n=t.session)||void 0===n?void 0:n.attributes),null===(r=null==c?void 0:c.sessionMeta)||void 0===r?void 0:r.attributes),{isSampled:l.isSampled.toString()})},s=pi}else{const e=null!==(a=null===(i=t.session)||void 0===i?void 0:i.id)&&void 0!==a?a:function(e){var t,n,r,i;return{id:null!==(i=null===(r=null===(n=null===(t=Ie.config)||void 0===t?void 0:t.sessionTracking)||void 0===n?void 0:n.generateSessionId)||void 0===r?void 0:r.call(n))&&void 0!==i?i:Dt(),attributes:e}}().id;l=jt({sessionId:e,isSampled:At()}),l.sessionMeta={id:e,attributes:Object.assign({isSampled:l.isSampled.toString()},null===(o=t.session)||void 0===o?void 0:o.attributes)},s=di}return{initialSession:l,lifecycleType:s}}registerBeforeSendHook(e){var t;const{updateSession:n}=new e;null===(t=this.transports)||void 0===t||t.addBeforeSendHooks((e=>{var t,r,i;n();const a=null===(t=e.meta.session)||void 0===t?void 0:t.attributes;if(a&&"true"===(null==a?void 0:a.isSampled)){let t=JSON.parse(JSON.stringify(e));const n=null===(r=t.meta.session)||void 0===r?void 0:r.attributes;return null==n||delete n.isSampled,0===Object.keys(null!=n?n:{}).length&&(null===(i=t.meta.session)||void 0===i||delete i.attributes),t}return null}))}initialize(){this.logDebug("init session instrumentation");const e=this.config.sessionTracking;if(null==e?void 0:e.enabled){const t=$t(e);this.registerBeforeSendHook(t);const{initialSession:n,lifecycleType:r}=this.createInitialSession(t,e);t.storeUserSession(n);const i=n.sessionMeta;this.notifiedSession=i,this.api.setSession(i),r===di&&this.api.pushEvent(di,{},void 0,{skipDedupe:!0}),r===pi&&this.api.pushEvent(pi,{},void 0,{skipDedupe:!0})}this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class fi extends zt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=De}sendViewChangedEvent(e){var t,n,r,i;const a=e.view;a&&a.name!==(null===(t=this.notifiedView)||void 0===t?void 0:t.name)&&(this.api.pushEvent("view_changed",{fromView:null!==(r=null===(n=this.notifiedView)||void 0===n?void 0:n.name)&&void 0!==r?r:mt,toView:null!==(i=a.name)&&void 0!==i?i:mt},void 0,{skipDedupe:!0}),this.notifiedView=a)}initialize(){this.metas.addListener(this.sendViewChangedEvent.bind(this))}}const mi=/^00-[a-f0-9]{32}-[a-f0-9]{16}-[0-9]{1,2}$/;function gi(e=[]){for(const t of e)if("traceparent"===t.name){if(!mi.test(t.description))continue;const[,e,n]=t.description.split("-");if(null!=e&&null!=n)return{traceId:e,spanId:n};break}}function yi(e=[],t){return e.some((e=>e&&null!=t.match(e)))}function bi(e,t={}){for(const[n,r]of Object.entries(t)){const t=e[n];return null!=t&&(se(r)?r.includes(t):t===r)}return!0}function vi(e){const{connectEnd:t,connectStart:n,decodedBodySize:r,domainLookupEnd:i,domainLookupStart:a,duration:o,encodedBodySize:s,fetchStart:l,initiatorType:c,name:u,nextHopProtocol:d,redirectEnd:p,redirectStart:h,renderBlockingStatus:f,requestStart:m,responseEnd:g,responseStart:y,responseStatus:b,secureConnectionStart:v,transferSize:w,workerStart:S}=e;return{name:u,duration:Si(o),tcpHandshakeTime:Si(t-n),dnsLookupTime:Si(i-a),tlsNegotiationTime:Si(m-v),responseStatus:Si(b),redirectTime:Si(p-h),requestTime:Si(y-m),responseTime:Si(g-y),fetchTime:Si(g-l),serviceWorkerTime:Si(l-S),decodedBodySize:Si(r),encodedBodySize:Si(s),cacheHitStatus:function(){let e="fullLoad";0===w?r>0&&(e="cache"):null!=b?304===b&&(e="conditionalFetch"):s>0&&w<s&&(e="conditionalFetch");return e}(),renderBlockingStatus:Si(f),protocol:d,initiatorType:c}}function wi(e){const{activationStart:t,domComplete:n,domContentLoadedEventEnd:r,domContentLoadedEventStart:i,domInteractive:a,fetchStart:o,loadEventEnd:s,loadEventStart:l,responseStart:c,type:u}=e,d=function(){var e;if(null!=(null===(e=performance.timing)||void 0===e?void 0:e.domLoading))return performance.timing.domLoading-performance.timeOrigin;return null}();return Object.assign({visibilityState:document.visibilityState,pageLoadTime:Si(n-o),documentParsingTime:Si(d?a-d:null),domProcessingTime:Si(n-a),domContentLoadHandlerTime:Si(r-i),onLoadTime:Si(s-l),ttfb:Si(Math.max(c-(null!=t?t:0),0)),type:u},vi(e))}function Si(e){return null==e?mt:"number"==typeof e?Math.round(e).toString():e.toString()}const Ei={initiatorType:["xmlhttprequest","fetch"]};var xi=function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};class Oi extends zt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-performance",this.version=De}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)}}((()=>xi(this,void 0,void 0,(function*(){const e=this.api.pushEvent,t=this.getIgnoreUrls(),{faroNavigationId:n}=yield function(e,t){let n;const r=new Promise((e=>{n=e})),i=new PerformanceObserver((r=>{var i;const[a]=r.getEntries();if(null==a||yi(t,a.name))return;const o=a.toJSON();let s=gi(null==o?void 0:o.serverTiming);const l=null!==(i=Ot(oi,Et.session))&&void 0!==i?i:mt,c=Object.assign(Object.assign({},wi(o)),{faroNavigationId:Dt(),faroPreviousNavigationId:l});_t(oi,c.faroNavigationId,Et.session),e("faro.performance.navigation",c,void 0,{spanContext:s,timestampOverwriteMs:performance.timeOrigin+o.startTime}),n(c)}));return i.observe({type:"navigation",buffered:!0}),r}(e,t);null!=n&&function(e,t,n){const r=Ie.config.trackResources;new PerformanceObserver((i=>{const a=i.getEntries();for(const i of a){if(yi(n,i.name))return;const a=i.toJSON();let o=gi(null==a?void 0:a.serverTiming);if(null==r&&bi(a,Ei)||r){const n=Object.assign(Object.assign({},vi(a)),{faroNavigationId:e,faroResourceId:Dt()});t("faro.performance.resource",n,void 0,{spanContext:o,timestampOverwriteMs:performance.timeOrigin+a.startTime})}}})).observe({type:"resource",buffered:!0})}(n,e,t)})))):this.logDebug("performance observer not supported. Disable performance instrumentation.")}getIgnoreUrls(){var e;return null===(e=this.transports.transports)||void 0===e?void 0:e.flatMap((e=>e.getIgnoreUrls()))}}class _i extends zt{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=De}initialize(){this.logDebug("Initializing\n",this.options),we.filter((e=>{var t;return!(null!==(t=this.options.disabledLevels)&&void 0!==t?t:_i.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...t)=>{try{this.api.pushLog(t,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...t)}}}))}}function Ti(e={}){const t=[new Xt,new ui,new hi,new fi];return!1!==e.enablePerformanceInstrumentation&&t.unshift(new Oi),!1!==e.captureConsole&&t.push(new _i({disabledLevels:e.captureConsoleDisabledLevels})),t}function Ci(e){const t=function(e){var t,n,r,i,a,o,s,l,c;const u=[],d=ke(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&d.error('if "transports" is defined, "url" and "apiKey" should not be defined'),u.push(...e.transports)):e.url?u.push(new Ut({url:e.url,apiKey:e.apiKey})):d.error('either "url" or "transports" must be defined'),{app:e.app,batching:Object.assign(Object.assign({},ze),e.batching),dedupe:null===(t=e.dedupe)||void 0===t||t,globalObjectKey:e.globalObjectKey||Ue,instrumentations:null!==(n=e.instrumentations)&&void 0!==n?n:Ti(),internalLoggerLevel:null!==(r=e.internalLoggerLevel)&&void 0!==r?r:Te,isolate:null!==(i=e.isolate)&&void 0!==i&&i,logArgsSerializer:null!==(a=e.logArgsSerializer)&&void 0!==a?a:Se,metas:function(){const t=gt;return e.metas&&t.push(...e.metas),ae(window.k6)?[...t,yt]:t}(),parseStacktrace:ct,paused:null!==(o=e.paused)&&void 0!==o&&o,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:u,unpatchedConsole:null!==(l=e.unpatchedConsole)&&void 0!==l?l:Ce,beforeSend:e.beforeSend,eventDomain:null!==(c=e.eventDomain)&&void 0!==c?c:qe,ignoreErrors:e.ignoreErrors,ignoreUrls:e.ignoreUrls,sessionTracking:Object.assign(Object.assign({},ht),e.sessionTracking),user:e.user,view:e.view,trackResources:e.trackResources,trackWebVitalsAttribution:e.trackWebVitalsAttribution}}(e);if(t)return Ve(t)}_i.defaultDisabledLevels=[be.DEBUG,be.TRACE,be.LOG];const ki=JSON.parse('{"id":"grafana-pyroscope-app"}'),Pi=ki.id,Ai=`/a/${Pi}`;var Ri=function(e){return e.EXPLORE="/explore",e.ADHOC="/ad-hoc",e.SETTINGS="/settings",e.RECORDING_RULES="/recording-rules",e}({});const Di="2a141802547a6486f16ba2a7451bb12e9e435df0",ji=[{regExp:/localhost/,environment:"local"},{regExp:/grafana-dev\.net/,environment:"dev"},{regExp:/grafana-ops\.net/,environment:"ops"},{regExp:/grafana\.net/,environment:"prod"}];function Ii(){var e,t;if(!(null===(t=window)||void 0===t||null===(e=t.location)||void 0===e?void 0:e.host))return null;const n=ji.find((({regExp:e})=>e.test(window.location.host)));return n?n.environment:null}const Ni=new Map([["dev",{environment:"dev",appName:"grafana-pyroscope-dev",faroUrl:"https://faro-collector-ops-eu-south-0.grafana-ops.net/collect/48e03a2647389f2f6494af7f975b4084"}],["ops",{environment:"ops",appName:"grafana-pyroscope-ops",faroUrl:"https://faro-collector-ops-eu-south-0.grafana-ops.net/collect/b5cfd5eeb412cf5e74bd828b4ddd17ff"}],["prod",{environment:"prod",appName:"grafana-pyroscope-prod",faroUrl:"https://faro-collector-ops-eu-south-0.grafana-ops.net/collect/6cbe17b3af4b72ce5936bf4d15a5c393"}]]);let Li=null;const Mi=()=>Li;var Fi=__webpack_require__(5959),$i=__webpack_require__.n(Fi),Bi=__webpack_require__(2540),Vi=Fi.createContext(void 0),Ui=e=>{const t=Fi.useContext(Vi);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zi=({client:e,children:t})=>(Fi.useEffect((()=>(e.mount(),()=>{e.unmount()})),[e]),(0,Bi.jsx)(Vi.Provider,{value:e,children:t}));function qi(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Hi(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function Gi(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,Hi(e,t,"set"),n),n}function Wi(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}var Qi=new WeakMap,Ki=new WeakSet;function Yi(e,t){var n;"prod"!==function(e,t){return t.get?t.get.call(e):t.value}(n=this,Hi(n,Qi,"get"))&&console[e](...t)}const Xi=new class{trace(){var e;Wi(this,Ki,Yi).call(this,"trace",[]),null===(e=Mi())||void 0===e||e.api.pushLog([],{level:be.TRACE})}debug(...e){var t;Wi(this,Ki,Yi).call(this,"debug",e),null===(t=Mi())||void 0===t||t.api.pushLog(e,{level:be.DEBUG})}info(...e){var t;Wi(this,Ki,Yi).call(this,"info",e),null===(t=Mi())||void 0===t||t.api.pushLog(e,{level:be.INFO})}log(...e){var t;Wi(this,Ki,Yi).call(this,"log",e),null===(t=Mi())||void 0===t||t.api.pushLog(e,{level:be.LOG})}warn(...e){var t;Wi(this,Ki,Yi).call(this,"warn",e),null===(t=Mi())||void 0===t||t.api.pushLog(e,{level:be.WARN})}error(e,t){var n;Wi(this,Ki,Yi).call(this,"error",[e]),t&&Wi(this,Ki,Yi).call(this,"error",["Error context",t]),null===(n=Mi())||void 0===n||n.api.pushError(e,{context:t})}constructor(){var e,t;qi(e=this,t=Ki),t.add(e),function(e,t,n){qi(e,t),t.set(e,n)}(this,Qi,{writable:!0,value:void 0}),Gi(this,Qi,Ii())}};function Ji(e,t){var n=function(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}(e,t,"get");return function(e,t){return t.get?t.get.call(e):t.value}(e,n)}function Zi(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}var ea=new WeakMap;const ta=new class{has(e){return Ji(this,ea).hasOwnProperty(e)}get(e){if(!this.has(e))return null;try{return JSON.parse(Ji(this,ea).getItem(e))}catch(t){return Xi.error(t,{info:`Error parsing JSON for storage item "${e}"!`}),null}}set(e,t){try{Ji(this,ea).setItem(e,JSON.stringify(t))}catch(t){Xi.error(t,{info:`Error setting storage item "${e}"!`})}}constructor(){var e,t,n;Zi(this,ea,{writable:!0,value:window.localStorage}),e=this,t="KEYS",n={SETTINGS:`${ki.id}.userSettings`,GITHUB_INTEGRATION:`${ki.id}.gitHubIntegration`,PROFILES_EXPLORER:`${ki.id}.profilesExplorer`},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}},na=()=>{};function ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ia extends Error{constructor(e,t){let n=`HTTP ${e.status} (${e.statusText||"?"})`;(null==t?void 0:t.message)&&(n=`${n} → ${t.message}`),super(n),ra(this,"response",void 0),ra(this,"reason",void 0),this.response=e}}function aa(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function oa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){oa(e,t,n[t])}))}return e}function la(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}class ca{fetch(e,t){var n,r=this;return(n=function*(){r.abortController=new AbortController;const{signal:n}=r.abortController,i=`${r.baseUrl}${e}`,a=sa({},r.defaultHeaders,null==t?void 0:t.headers),o=la(sa({signal:n},t),{headers:a});let s;try{if(s=yield fetch(i,o),!s.ok)throw new ia(s,yield s.json().catch(na))}catch(e){var l;throw r.isAbortError(e)&&(e.reason=(null==t||null===(l=t.signal)||void 0===l?void 0:l.reason)||n.reason),e}finally{r.abortController=null}return s},function(){var e=this,t=arguments;return new Promise((function(r,i){var a=n.apply(e,t);function o(e){aa(a,r,i,o,s,"next",e)}function s(e){aa(a,r,i,o,s,"throw",e)}o(void 0)}))})()}abort(e){this.abortController&&this.abortController.abort(e)}isAbortError(e){return e instanceof DOMException&&"AbortError"===e.name}constructor(e,t={}){oa(this,"baseUrl",""),oa(this,"defaultHeaders",{}),oa(this,"abortController",null),this.baseUrl=e,this.defaultHeaders=Object.freeze(t)}}class ua extends ca{static getPyroscopeDataSources(){return Object.values(a.config.datasources).filter((e=>"grafana-pyroscope-datasource"===e.type))}static selectDefaultDataSource(){var e;const t=ua.getPyroscopeDataSources(),n=new URL(window.location.href).searchParams.get("var-dataSource"),r=null===(e=ta.get(ta.KEYS.PROFILES_EXPLORER))||void 0===e?void 0:e.dataSource,i=t.find((e=>e.uid===n))||t.find((e=>e.uid===r))||t.find((e=>e.jsonData.overridesDefault))||t.find((e=>e.isDefault))||t[0];return i||(Xi.warn("Cannot find any Pyroscope data source! Please add and configure a Pyroscope data source to your Grafana instance."),{uid:"no-data-source-configured"})}static getBaseUrl(){const e=ua.selectDefaultDataSource();let t=a.config.appSubUrl||"";return"/"!==t.at(-1)&&(t+="/"),`${t}api/datasources/proxy/uid/${e.uid}`}constructor(){var e,t;super(ua.getBaseUrl().toString(),{"content-type":"application/json","X-Grafana-Org-Id":String((null===(t=a.config.bootData)||void 0===t||null===(e=t.user)||void 0===e?void 0:e.orgId)||"")})}}var da=class extends P{constructor(e,t){super(),this.options=t,this.#x=e,this.#O=null,this.bindMethods(),this.setOptions(t)}#x;#_=void 0;#T=void 0;#C=void 0;#k;#P;#O;#A;#R;#D;#j;#I;#N;#L=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#_.addObserver(this),pa(this.#_,this.options)?this.#M():this.updateResult(),this.#F())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ha(this.#_,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ha(this.#_,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#$(),this.#B(),this.#_.removeObserver(this)}setOptions(e,t){const n=this.options,r=this.#_;if(this.options=this.#x.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof p(this.options.enabled,this.#_))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#V(),this.#_.setOptions(this.options),n._defaulted&&!v(this.options,n)&&this.#x.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#_,observer:this});const i=this.hasListeners();i&&fa(this.#_,r,this.options,n)&&this.#M(),this.updateResult(t),!i||this.#_===r&&p(this.options.enabled,this.#_)===p(n.enabled,this.#_)&&d(this.options.staleTime,this.#_)===d(n.staleTime,this.#_)||this.#U();const a=this.#z();!i||this.#_===r&&p(this.options.enabled,this.#_)===p(n.enabled,this.#_)&&a===this.#N||this.#q(a)}getOptimisticResult(e){const t=this.#x.getQueryCache().build(this.#x,e),n=this.createResult(t,e);return function(e,t){if(!v(e.getCurrentResult(),t))return!0;return!1}(this,n)&&(this.#C=n,this.#P=this.options,this.#k=this.#_.state),n}getCurrentResult(){return this.#C}trackResult(e,t){const n={};return Object.keys(e).forEach((r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t?.(r),e[r])})})),n}trackProp(e){this.#L.add(e)}getCurrentQuery(){return this.#_}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#x.defaultQueryOptions(e),n=this.#x.getQueryCache().build(this.#x,t);return n.isFetchingOptimistic=!0,n.fetch().then((()=>this.createResult(n,t)))}fetch(e){return this.#M({...e,cancelRefetch:e.cancelRefetch??!0}).then((()=>(this.updateResult(),this.#C)))}#M(e){this.#V();let t=this.#_.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l)),t}#U(){this.#$();const e=d(this.options.staleTime,this.#_);if(s||this.#C.isStale||!c(e))return;const t=u(this.#C.dataUpdatedAt,e)+1;this.#j=setTimeout((()=>{this.#C.isStale||this.updateResult()}),t)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#_):this.options.refetchInterval)??!1}#q(e){this.#B(),this.#N=e,!s&&!1!==p(this.options.enabled,this.#_)&&c(this.#N)&&0!==this.#N&&(this.#I=setInterval((()=>{(this.options.refetchIntervalInBackground||A.isFocused())&&this.#M()}),this.#N))}#F(){this.#U(),this.#q(this.#z())}#$(){this.#j&&(clearTimeout(this.#j),this.#j=void 0)}#B(){this.#I&&(clearInterval(this.#I),this.#I=void 0)}createResult(e,t){const n=this.#_,r=this.options,i=this.#C,a=this.#k,o=this.#P,s=e!==n?e.state:this.#T,{state:l}=e;let c,u={...l},d=!1;if(t._optimisticResults){const i=this.hasListeners(),a=!i&&pa(e,t),o=i&&fa(e,n,t,r);(a||o)&&(u={...u,...$(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:h,status:f}=u;if(t.select&&void 0!==u.data)if(i&&u.data===a?.data&&t.select===this.#A)c=this.#R;else try{this.#A=t.select,c=t.select(u.data),c=x(i?.data,c,t),this.#R=c,this.#O=null}catch(e){this.#O=e}else c=u.data;if(void 0!==t.placeholderData&&void 0===c&&"pending"===f){let e;if(i?.isPlaceholderData&&t.placeholderData===o?.placeholderData)e=i.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#D?.state.data,this.#D):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#O=null}catch(e){this.#O=e}void 0!==e&&(f="success",c=x(i?.data,e,t),d=!0)}this.#O&&(p=this.#O,c=this.#R,h=Date.now(),f="error");const m="fetching"===u.fetchStatus,g="pending"===f,y="error"===f,b=g&&m,v=void 0!==c;return{status:f,fetchStatus:u.fetchStatus,isPending:g,isSuccess:"success"===f,isError:y,isInitialLoading:b,isLoading:b,data:c,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>s.dataUpdateCount||u.errorUpdateCount>s.errorUpdateCount,isFetching:m,isRefetching:m&&!g,isLoadingError:y&&!v,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:y&&v,isStale:ma(e,t),refetch:this.refetch}}updateResult(e){const t=this.#C,n=this.createResult(this.#_,this.options);if(this.#k=this.#_.state,this.#P=this.options,void 0!==this.#k.data&&(this.#D=this.#_),v(n,t))return;this.#C=n;const r={};!1!==e?.listeners&&(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,n="function"==typeof e?e():e;if("all"===n||!n&&!this.#L.size)return!0;const r=new Set(n??this.#L);return this.options.throwOnError&&r.add("error"),Object.keys(this.#C).some((e=>{const n=e;return this.#C[n]!==t[n]&&r.has(n)}))})()&&(r.listeners=!0),this.#H({...r,...e})}#V(){const e=this.#x.getQueryCache().build(this.#x,this.options);if(e===this.#_)return;const t=this.#_;this.#_=e,this.#T=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#F()}#H(e){k.batch((()=>{e.listeners&&this.listeners.forEach((e=>{e(this.#C)})),this.#x.getQueryCache().notify({query:this.#_,type:"observerResultsUpdated"})}))}};function pa(e,t){return function(e,t){return!1!==p(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&ha(e,t,t.refetchOnMount)}function ha(e,t,n){if(!1!==p(t.enabled,e)){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&ma(e,t)}return!1}function fa(e,t,n,r){return(e!==t||!1===p(r.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&ma(e,n)}function ma(e,t){return!1!==p(t.enabled,e)&&e.isStaleByTime(d(t.staleTime,e))}function ga(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ya=Fi.createContext(ga()),ba=()=>Fi.useContext(ya),va=Fi.createContext(!1),wa=()=>Fi.useContext(va);va.Provider;function Sa(e,t){return"function"==typeof e?e(...t):!!e}function Ea(){}var xa=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},Oa=e=>{Fi.useEffect((()=>{e.clearReset()}),[e])},_a=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Sa(n,[e.error,r]),Ta=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},Ca=(e,t)=>e?.suspense&&t.isPending,ka=(e,t,n)=>t.fetchOptimistic(e).catch((()=>{n.clearReset()}));function Pa(e,t){return function(e,t,n){const r=Ui(n),i=wa(),a=ba(),o=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=i?"isRestoring":"optimistic",Ta(o),xa(o,a),Oa(a);const[s]=Fi.useState((()=>new t(r,o))),l=s.getOptimisticResult(o);if(Fi.useSyncExternalStore(Fi.useCallback((e=>{const t=i?()=>{}:s.subscribe(k.batchCalls(e));return s.updateResult(),t}),[s,i]),(()=>s.getCurrentResult()),(()=>s.getCurrentResult())),Fi.useEffect((()=>{s.setOptions(o,{listeners:!1})}),[o,s]),Ca(o,l))throw ka(o,s,a);if(_a({result:l,errorResetBoundary:a,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash)}))throw l.error;return r.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.notifyOnChangeProps?l:s.trackResult(l)}(e,da,t)}function Aa(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}const Ra=new class extends ua{get(){var e,t=this;return(e=function*(){const e=yield t.fetch("/querier.v1.QuerierService/GetProfileStats",{method:"POST",body:JSON.stringify({})}),n=yield e.json();return{hasIngestedData:n.dataIngested,oldestProfileTime:Number(n.oldestProfileTime),newestProfileTime:Number(n.newestProfileTime)}},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Aa(a,r,i,o,s,"next",e)}function s(e){Aa(a,r,i,o,s,"throw",e)}o(void 0)}))})()}};function Da(){const[e,t]=(0,Fi.useState)(!1),n=ua.getPyroscopeDataSources().length,{isFetching:r,error:i,stats:a}=function({enabled:e}){const{isFetching:t,error:n,data:r,refetch:i}=Pa({enabled:e,placeholderData:()=>({hasIngestedData:!0,oldestProfileTime:0,newestProfileTime:0}),queryKey:["tenant-stats"],queryFn:()=>(Ra.abort(),Ra.get())});return{isFetching:t,error:Ra.isAbortError(n)?null:n,stats:r,refetch:i}}({enabled:n>0}),o=!r&&!(null==a?void 0:a.hasIngestedData);return{data:{shouldShowLoadingPage:!i&&r,shouldShowOnboardingPage:(i||!n||o)&&!e,shouldShowNoDataSourceBanner:!n},actions:{closeModal(){t(!0)}}}}const ja=e=>({row:(0,i.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start"}),headerColumn:(0,i.css)({display:"flex",flexDirection:"column",minWidth:"120px",alignItems:"start"}),column:(0,i.css)({display:"flex",flexDirection:"column",minWidth:"120px",alignItems:"end"}),tooltip:(0,i.css)({display:"flex",color:e.colors.text.secondary,fontSize:e.typography.bodySmall.fontSize}),contentWithIcon:(0,i.css)({display:"none",[`@media ${o.styleMixins.mediaUp(e.v1.breakpoints.sm)}`]:{display:"block"}})}),Ia=e=>(0,r.formattedValueToString)((0,r.getValueFormat)("decbytes")(e)),Na=e=>(0,r.formattedValueToString)((0,r.getValueFormat)("short")(e));function La(e){const t=(0,o.useStyles2)(ja),{data:n}=e,r=Ia(n.queryImpact.totalBytesInTimeRange),i=(0,Fi.useMemo)((()=>$i().createElement("div",{"data-testid":"queryAnalysis-popup"},$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Data in time range"),$i().createElement("div",{className:t.column},r),$i().createElement("div",{className:t.column}," ")),void 0!==n.queryImpact.totalQueriedSeries&&$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Series in query"),$i().createElement("div",{className:t.column},Na(n.queryImpact.totalQueriedSeries)),$i().createElement("div",{className:t.column}," ")),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Deduplication"),$i().createElement("div",{className:t.column},n.queryImpact.deduplicationNeeded?"yes":"no"),$i().createElement("div",{className:t.column}," ")),$i().createElement(o.Divider,null),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn}," "),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},$i().createElement("strong",null,e.componentType))))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Replicas"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},e.componentCount||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Blocks"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Na(e.blockCount)||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Series"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Na(e.seriesCount)||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Profiles"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Na(e.profileCount)||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Samples"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Na(e.sampleCount)||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn}," "),$i().createElement("div",{className:t.column}," "),$i().createElement("div",{className:t.column}," ")),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Index Store"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Ia(e.indexBytes)||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Profiles Store"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Ia(e.profileBytes)||"/")))),$i().createElement("div",{className:t.row},$i().createElement("div",{className:t.headerColumn},"Symbols Store"),n.queryScopes.map(((e,n)=>$i().createElement("div",{key:n,className:t.column},Ia(e.symbolBytes)||"/")))))),[n,t,r]);return $i().createElement($i().Fragment,null,void 0!==n.queryImpact.totalBytesInTimeRange?$i().createElement(o.Toggletip,{content:i,fitContent:!0},$i().createElement("div",{className:t.tooltip,"data-testid":"queryAnalysis-tooltip"},$i().createElement("span",{className:t.contentWithIcon},"Stored data in time range: ",r)," ",$i().createElement(o.IconButton,{name:"database","aria-label":"Query info"}))):null)}var Ma,Fa,$a,Ba,Va=__webpack_require__(2688),Ua=__webpack_require__.n(Va),za=__webpack_require__(9406),qa=__webpack_require__.n(za),Ha=__webpack_require__(7383),Ga=__webpack_require__.n(Ha),Wa=__webpack_require__(1664),Qa=__webpack_require__.n(Wa),Ka="bodyAttributes",Ya="htmlAttributes",Xa="titleAttributes",Ja={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"},Za=(Object.keys(Ja).map((function(e){return Ja[e]})),"charset"),eo="cssText",to="href",no="http-equiv",ro="innerHTML",io="itemprop",ao="name",oo="property",so="rel",lo="src",co="target",uo={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},po="defaultTitle",ho="defer",fo="encodeSpecialCharacters",mo="onChangeClientState",go="titleTemplate",yo=Object.keys(uo).reduce((function(e,t){return e[uo[t]]=t,e}),{}),bo=[Ja.NOSCRIPT,Ja.SCRIPT,Ja.STYLE],vo="data-react-helmet",wo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},So=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Eo=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xo=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},Oo=function(e){return!1===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])?String(e):String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")},_o=function(e){var t=Ao(e,Ja.TITLE),n=Ao(e,go);if(n&&t)return n.replace(/%s/g,(function(){return Array.isArray(t)?t.join(""):t}));var r=Ao(e,po);return t||r||void 0},To=function(e){return Ao(e,mo)||function(){}},Co=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return Eo({},e,t)}),{})},ko=function(e,t){return t.filter((function(e){return void 0!==e[Ja.BASE]})).map((function(e){return e[Ja.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),i=0;i<r.length;i++){var a=r[i].toLowerCase();if(-1!==e.indexOf(a)&&n[a])return t.concat(n)}return t}),[])},Po=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&No("Helmet: "+e+' should be of type "Array". Instead found type "'+wo(t[e])+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var i={};n.filter((function(e){for(var n=void 0,a=Object.keys(e),o=0;o<a.length;o++){var s=a[o],l=s.toLowerCase();-1===t.indexOf(l)||n===so&&"canonical"===e[n].toLowerCase()||l===so&&"stylesheet"===e[l].toLowerCase()||(n=l),-1===t.indexOf(s)||s!==ro&&s!==eo&&s!==io||(n=s)}if(!n||!e[n])return!1;var c=e[n].toLowerCase();return r[n]||(r[n]={}),i[n]||(i[n]={}),!r[n][c]&&(i[n][c]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=Qa()({},r[s],i[s]);r[s]=l}return e}),[]).reverse()},Ao=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.hasOwnProperty(t))return r[t]}return null},Ro=(Ma=Date.now(),function(e){var t=Date.now();t-Ma>16?(Ma=t,e(t)):setTimeout((function(){Ro(e)}),0)}),Do=function(e){return clearTimeout(e)},jo="undefined"!=typeof window?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||Ro:__webpack_require__.g.requestAnimationFrame||Ro,Io="undefined"!=typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||Do:__webpack_require__.g.cancelAnimationFrame||Do,No=function(e){return console&&"function"==typeof console.warn&&console.warn(e)},Lo=null,Mo=function(e,t){var n=e.baseTag,r=e.bodyAttributes,i=e.htmlAttributes,a=e.linkTags,o=e.metaTags,s=e.noscriptTags,l=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,d=e.title,p=e.titleAttributes;Bo(Ja.BODY,r),Bo(Ja.HTML,i),$o(d,p);var h={baseTag:Vo(Ja.BASE,n),linkTags:Vo(Ja.LINK,a),metaTags:Vo(Ja.META,o),noscriptTags:Vo(Ja.NOSCRIPT,s),scriptTags:Vo(Ja.SCRIPT,c),styleTags:Vo(Ja.STYLE,u)},f={},m={};Object.keys(h).forEach((function(e){var t=h[e],n=t.newTags,r=t.oldTags;n.length&&(f[e]=n),r.length&&(m[e]=h[e].oldTags)})),t&&t(),l(e,f,m)},Fo=function(e){return Array.isArray(e)?e.join(""):e},$o=function(e,t){void 0!==e&&document.title!==e&&(document.title=Fo(e)),Bo(Ja.TITLE,t)},Bo=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute(vo),i=r?r.split(","):[],a=[].concat(i),o=Object.keys(t),s=0;s<o.length;s++){var l=o[s],c=t[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),-1===i.indexOf(l)&&i.push(l);var u=a.indexOf(l);-1!==u&&a.splice(u,1)}for(var d=a.length-1;d>=0;d--)n.removeAttribute(a[d]);i.length===a.length?n.removeAttribute(vo):n.getAttribute(vo)!==o.join(",")&&n.setAttribute(vo,o.join(","))}},Vo=function(e,t){var n=document.head||document.querySelector(Ja.HEAD),r=n.querySelectorAll(e+"["+vo+"]"),i=Array.prototype.slice.call(r),a=[],o=void 0;return t&&t.length&&t.forEach((function(t){var n=document.createElement(e);for(var r in t)if(t.hasOwnProperty(r))if(r===ro)n.innerHTML=t.innerHTML;else if(r===eo)n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText));else{var s=void 0===t[r]?"":t[r];n.setAttribute(r,s)}n.setAttribute(vo,"true"),i.some((function(e,t){return o=t,n.isEqualNode(e)}))?i.splice(o,1):a.push(n)})),i.forEach((function(e){return e.parentNode.removeChild(e)})),a.forEach((function(e){return n.appendChild(e)})),{oldTags:i,newTags:a}},Uo=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},zo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).reduce((function(t,n){return t[uo[n]||n]=e[n],t}),t)},qo=function(e,t,n){switch(e){case Ja.TITLE:return{toComponent:function(){return e=t.title,n=t.titleAttributes,(r={key:e})[vo]=!0,i=zo(n,r),[$i().createElement(Ja.TITLE,i,e)];var e,n,r,i},toString:function(){return function(e,t,n,r){var i=Uo(n),a=Fo(t);return i?"<"+e+" "+vo+'="true" '+i+">"+Oo(a,r)+"</"+e+">":"<"+e+" "+vo+'="true">'+Oo(a,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case Ka:case Ya:return{toComponent:function(){return zo(t)},toString:function(){return Uo(t)}};default:return{toComponent:function(){return function(e,t){return t.map((function(t,n){var r,i=((r={key:n})[vo]=!0,r);return Object.keys(t).forEach((function(e){var n=uo[e]||e;if(n===ro||n===eo){var r=t.innerHTML||t.cssText;i.dangerouslySetInnerHTML={__html:r}}else i[n]=t[e]})),$i().createElement(e,i)}))}(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var i=Object.keys(r).filter((function(e){return!(e===ro||e===eo)})).reduce((function(e,t){var i=void 0===r[t]?t:t+'="'+Oo(r[t],n)+'"';return e?e+" "+i:i}),""),a=r.innerHTML||r.cssText||"",o=-1===bo.indexOf(e);return t+"<"+e+" "+vo+'="true" '+i+(o?"/>":">"+a+"</"+e+">")}),"")}(e,t,n)}}}},Ho=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,i=e.htmlAttributes,a=e.linkTags,o=e.metaTags,s=e.noscriptTags,l=e.scriptTags,c=e.styleTags,u=e.title,d=void 0===u?"":u,p=e.titleAttributes;return{base:qo(Ja.BASE,t,r),bodyAttributes:qo(Ka,n,r),htmlAttributes:qo(Ya,i,r),link:qo(Ja.LINK,a,r),meta:qo(Ja.META,o,r),noscript:qo(Ja.NOSCRIPT,s,r),script:qo(Ja.SCRIPT,l,r),style:qo(Ja.STYLE,c,r),title:qo(Ja.TITLE,{title:d,titleAttributes:p},r)}},Go=qa()((function(e){return{baseTag:ko([to,co],e),bodyAttributes:Co(Ka,e),defer:Ao(e,ho),encode:Ao(e,fo),htmlAttributes:Co(Ya,e),linkTags:Po(Ja.LINK,[so,to],e),metaTags:Po(Ja.META,[ao,Za,no,oo,io],e),noscriptTags:Po(Ja.NOSCRIPT,[ro],e),onChangeClientState:To(e),scriptTags:Po(Ja.SCRIPT,[lo,ro],e),styleTags:Po(Ja.STYLE,[eo],e),title:_o(e),titleAttributes:Co(Xa,e)}}),(function(e){Lo&&Io(Lo),e.defer?Lo=jo((function(){Mo(e,(function(){Lo=null}))})):(Mo(e),Lo=null)}),Ho)((function(){return null})),Wo=(Fa=Go,Ba=$a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.shouldComponentUpdate=function(e){return!Ga()(this.props,e)},t.prototype.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case Ja.SCRIPT:case Ja.NOSCRIPT:return{innerHTML:t};case Ja.STYLE:return{cssText:t}}throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},t.prototype.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren,i=e.newChildProps,a=e.nestedChildren;return Eo({},r,((t={})[n.type]=[].concat(r[n.type]||[],[Eo({},i,this.mapNestedChildrenToProps(n,a))]),t))},t.prototype.mapObjectTypeChildren=function(e){var t,n,r=e.child,i=e.newProps,a=e.newChildProps,o=e.nestedChildren;switch(r.type){case Ja.TITLE:return Eo({},i,((t={})[r.type]=o,t.titleAttributes=Eo({},a),t));case Ja.BODY:return Eo({},i,{bodyAttributes:Eo({},a)});case Ja.HTML:return Eo({},i,{htmlAttributes:Eo({},a)})}return Eo({},i,((n={})[r.type]=Eo({},a),n))},t.prototype.mapArrayTypeChildrenToProps=function(e,t){var n=Eo({},t);return Object.keys(e).forEach((function(t){var r;n=Eo({},n,((r={})[t]=e[t],r))})),n},t.prototype.warnOnInvalidChildren=function(e,t){return!0},t.prototype.mapChildrenToProps=function(e,t){var n=this,r={};return $i().Children.forEach(e,(function(e){if(e&&e.props){var i=e.props,a=i.children,o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).reduce((function(t,n){return t[yo[n]||n]=e[n],t}),t)}(xo(i,["children"]));switch(n.warnOnInvalidChildren(e,a),e.type){case Ja.LINK:case Ja.META:case Ja.NOSCRIPT:case Ja.SCRIPT:case Ja.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:o,nestedChildren:a});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:o,nestedChildren:a})}}})),t=this.mapArrayTypeChildrenToProps(r,t)},t.prototype.render=function(){var e=this.props,t=e.children,n=xo(e,["children"]),r=Eo({},n);return t&&(r=this.mapChildrenToProps(t,r)),$i().createElement(Fa,r)},So(t,null,[{key:"canUseDOM",set:function(e){Fa.canUseDOM=e}}]),t}($i().Component),$a.propTypes={base:Ua().object,bodyAttributes:Ua().object,children:Ua().oneOfType([Ua().arrayOf(Ua().node),Ua().node]),defaultTitle:Ua().string,defer:Ua().bool,encodeSpecialCharacters:Ua().bool,htmlAttributes:Ua().object,link:Ua().arrayOf(Ua().object),meta:Ua().arrayOf(Ua().object),noscript:Ua().arrayOf(Ua().object),onChangeClientState:Ua().func,script:Ua().arrayOf(Ua().object),style:Ua().arrayOf(Ua().object),title:Ua().string,titleAttributes:Ua().object,titleTemplate:Ua().string},$a.defaultProps={defer:!0,encodeSpecialCharacters:!0},$a.peek=Fa.peek,$a.rewind=function(){var e=Fa.rewind();return e||(e=Ho({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),e},Ba);Wo.renderStatic=Wo.rewind;function Qo({size:e}){const t=(0,o.useStyles2)(Yo);return $i().createElement("img",{className:(0,i.cx)(t.logo,e),src:"public/plugins/grafana-pyroscope-app/img/logo.svg"})}const Ko=$i().memo(Qo),Yo=()=>({logo:i.css`
&.small {
width: 16px;
height: 16px;
margin-right: 4px;
position: relative;
top: -2px;
}
&.large {
width: 40px;
height: 40px;
}
`}),Xo=Di,Jo=`https://github.com/grafana/explore-profiles/commit/${Xo}`,{buildInfo:Zo}=a.config;function es(){const e=(0,o.useStyles2)(rs),{meta:{info:{version:t,updated:n}}}=(0,r.usePluginContext)()||{meta:{info:{version:"?.?.?",updated:"?"}}};return $i().createElement("div",{className:e.menuHeader},$i().createElement("h5",null,$i().createElement(Ko,{size:"small"}),"Grafana Profiles Drilldown v",t),$i().createElement("div",{className:e.subTitle},"Last update: ",n))}function ts(){const e="dev"===Xo,t=e?Xo:Xo.slice(0,8);return $i().createElement(o.Menu,{header:$i().createElement(es,null)},$i().createElement(o.Menu.Item,{label:`Commit SHA: ${t}`,icon:"github",onClick:()=>window.open(Jo),disabled:e}),$i().createElement(o.Menu.Item,{label:"Changelog",icon:"list-ul",onClick:()=>window.open("https://github.com/grafana/explore-profiles/blob/main/CHANGELOG.md")}),$i().createElement(o.Menu.Item,{label:"Contribute",icon:"external-link-alt",onClick:()=>window.open("https://github.com/grafana/explore-profiles/blob/main/docs/CONTRIBUTING.md")}),$i().createElement(o.Menu.Item,{label:"Documentation",icon:"document-info",onClick:()=>window.open("https://grafana.com/docs/grafana/latest/explore/simplified-exploration/profiles")}),$i().createElement(o.Menu.Item,{label:"Report an issue",icon:"bug",onClick:()=>window.open("https://github.com/grafana/explore-profiles/issues/new?template=bug_report.md")}),$i().createElement(o.Menu.Divider,null),$i().createElement(o.Menu.Item,{label:`Grafana ${Zo.edition} v${Zo.version} (${Zo.env})`,icon:"github",onClick:()=>window.open(`https://github.com/grafana/grafana/commit/${Zo.commit}`)}))}function ns(){return $i().createElement(o.Dropdown,{overlay:()=>$i().createElement(ts,null),placement:"bottom-end"},$i().createElement(o.IconButton,{name:"info-circle","aria-label":"Plugin info",title:"Plugin info"}))}const rs=e=>({menuHeader:i.css`
padding: ${e.spacing(.5,1)};
white-space: nowrap;
`,subTitle:i.css`
color: ${e.colors.text.secondary};
font-size: ${e.typography.bodySmall.fontSize};
`});function is({title:e,queryAnalysis:t}){const n=(0,o.useStyles2)(as),r="string"==typeof e?`${e} | Pyroscope`:"Pyroscope";return $i().createElement($i().Fragment,null,$i().createElement(Wo,null,$i().createElement("title",null,r)),$i().createElement("div",{className:n.titleContainer},$i().createElement(o.Stack,{justifyContent:"space-between"},$i().createElement("div",null,$i().createElement(Ko,{size:"large"}),$i().createElement("h1",{className:n.title,"data-testid":"page-title"},e)),$i().createElement("div",{className:n.infoArea},$i().createElement(ns,null),t?$i().createElement(La,{data:t}):null))))}const as=e=>({titleContainer:i.css`
height: ${e.spacing(5)};
line-height: ${e.spacing(5)};
margin-bottom: ${e.spacing(3)};
`,title:i.css`
font-size: ${e.typography.h2.fontSize};
display: inline-block;
margin: 0;
position: relative;
top: 10px;
left: ${e.spacing(1)};
`,infoArea:i.css`
align-self: end;
margin-bottom: 0;
line-height: 20px;
text-align: right;
`}),os=(0,Fi.memo)(is);function ss(){return $i().createElement(a.PluginPage,{layout:r.PageLayoutType.Canvas},$i().createElement(os,{title:$i().createElement("span",null,"Loading... ",$i().createElement(o.Icon,{name:"fa fa-spinner"}))}))}const ls=e=>({link:i.css`
color: ${e.colors.text.link};
&:hover {
text-decoration: underline;
}
`});function cs({href:e,children:t}){const n=(0,o.useStyles2)(ls);return $i().createElement("a",{className:n.link,href:e,target:"_blank",rel:"noreferrer"},t," ",$i().createElement(o.Icon,{name:"external-link-alt"}))}function us(){return $i().createElement(a.PluginPage,{layout:r.PageLayoutType.Canvas},$i().createElement(os,{title:"Grafana Profiles Drilldown"}),$i().createElement(o.Alert,{severity:"error",title:"Missing Pyroscope data source!"},"This plugin requires a Pyroscope data source. Please"," ",$i().createElement(cs,{href:"/connections/datasources/new"},"add and configure a Pyroscope data source")," to your Grafana instance."))}const ds="public/plugins/grafana-pyroscope-app/img/61b4cf746a6f58780f27.png",ps="public/plugins/grafana-pyroscope-app/img/58f0b0e1cfa063e4b662.png",hs="public/plugins/grafana-pyroscope-app/img/9c9cdd5175734d579007.png",fs="public/plugins/grafana-pyroscope-app/img/bafee50693eb02088442.png";function ms(){const{instances:e}=function(){const{isFetching:e,error:t,data:n}=Pa({queryKey:["instances"],queryFn:()=>fetch("/api/plugin-proxy/cloud-home-app/grafanacom-api/instances").then((e=>e.json()))});return{isFetching:e,error:t,instances:n}}(),[t,n]=(0,Fi.useState)("https://grafana.com/auth/sign-in/"),r=/grafana(-dev|-ops)?\.net/.test(window.location.host);if(e&&e.orgSlug&&e.hpInstanceId){const r=`https://grafana.com/orgs/${e.orgSlug}/hosted-profiles/${e.hpInstanceId}`;t!==r&&n(r)}return{data:{settingsUrl:t,isCloud:r},actions:{}}}const gs=e=>({onboardingRow:i.css`
background: ${e.colors.background.secondary};
display: flex;
margin-top: 16px;
gap: 20px;
padding: 20px;
margin-bottom: 2.5rem;
`,onboardingParagraph:i.css`
padding: 20px 64px;
text-align: center;
line-height: 2;
flex: 1;
margin: 0;
`,onboardingPanel:i.css`
flex: 1;
display: flex;
flex-flow: column wrap;
-webkit-box-align: center;
align-items: center;
margin-top: 16px;
text-align: center;
`,onboardingPanelHeader:i.css`
line-height: 1.5;
margin-bottom: 1em;
`,onboardingPanelImage:i.css`
width: 5rem;
margin-bottom: 1em;
`,hero:i.css`
display: flex;
flex-direction: row;
`,heroTitles:i.css`
flex: 1;
`,heroImage:i.css`
width: 40%;
margin-left: 16px;
margin-top: 16px;
margin-bottom: 16px;
border-radius: 3px;
`,onboardingPanelNumber:i.css`
color: rgb(236, 109, 19);
text-align: center;
display: grid;
place-items: center;
background-image: linear-gradient(135deg, currentcolor, 75%, rgb(204, 204, 220));
border-radius: 100%;
font-size: 2.5rem;
line-height: 5rem;
height: 5rem;
width: 5rem;
margin-bottom: 1em;
`,color2:i.css`
color: rgb(190, 85, 190);
`,color3:i.css`
color: rgb(126, 108, 218);
`,onboardingPanelNumberSpan:i.css`
color: rgb(220, 220, 220);
`,onboardingPanelDescription:i.css`
text-align: justify;
text-align: center;
line-height: 1.66;
margin-top: 0;
`,title:i.css`
margin-bottom: 0.5em;
line-height: 1.5;
`,subtitle:i.css`
margin-bottom: 1em;
line-height: 1.5;
font-size: 1.25rem;
`});function ys(){const e=(0,o.useStyles2)(gs),{data:t}=ms();return $i().createElement("div",{"data-testid":"onboarding-modal"},$i().createElement("div",{className:e.hero,"data-testid":"hero"},$i().createElement("div",{className:e.heroTitles},$i().createElement("h1",{className:e.title},"Welcome to Grafana Profiles Drilldown"),$i().createElement("h2",{className:e.subtitle},"Optimize infrastructure spend, simplify debugging, and enhance application performance")),$i().createElement("img",{src:ps,className:e.heroImage})),$i().createElement("div",{"data-testid":"what-you-can-do"},$i().createElement("h3",null,"What You Can Do"),$i().createElement("div",{className:e.onboardingRow},$i().createElement("div",{className:e.onboardingPanel},$i().createElement("img",{className:e.onboardingPanelImage,src:hs}),$i().createElement("h3",{className:e.onboardingPanelHeader},"Reduce Costs"),$i().createElement("p",{className:e.onboardingPanelDescription},"Spot CPU spikes, memory leaks, and other inefficiencies with code-level visibility into resource usage. Teams can then optimize their code and lower infrastructure costs.")),$i().createElement("div",{className:e.onboardingPanel},$i().createElement("img",{className:e.onboardingPanelImage,src:ds}),$i().createElement("h3",{className:e.onboardingPanelHeader},"Decrease Latency"),$i().createElement("p",{className:e.onboardingPanelDescription},"Maintain high speed and efficiency and improve application performance. In a competitive digital world, decreasing latency translates to increasing revenue.")),$i().createElement("div",{className:e.onboardingPanel},$i().createElement("img",{className:e.onboardingPanelImage,src:fs}),$i().createElement("h3",{className:e.onboardingPanelHeader},"Resolve Incidents Faster"),$i().createElement("p",{className:e.onboardingPanelDescription},"Cut down the mean time to resolution (MTTR) by correlating continuous profiling data with metrics, logs, and traces to quickly identify the root cause of any issue.")))),$i().createElement("div",{"data-testid":"how-to-get-started"},$i().createElement("h3",null,"How to Get Started"),$i().createElement("div",{className:e.onboardingRow},t.isCloud?$i().createElement($i().Fragment,null,$i().createElement("div",{className:e.onboardingPanel},$i().createElement("div",{className:e.onboardingPanelNumber},$i().createElement("span",{className:e.onboardingPanelNumberSpan},"1")),$i().createElement("h3",{className:e.onboardingPanelHeader},"Add Profiling to Your Application"),$i().createElement("p",{className:e.onboardingPanelDescription},"Use"," ",$i().createElement(cs,{href:"https://grafana.com/docs/pyroscope/latest/configure-client/grafana-alloy/"},"Grafana Alloy")," ","or"," ",$i().createElement(cs,{href:"https://grafana.com/docs/pyroscope/next/configure-client/language-sdks/"},"Pyroscope SDKs")," ","to push profiles from your applications to Grafana Cloud.")),$i().createElement("div",{className:e.onboardingPanel},$i().createElement("div",{className:(0,i.cx)(e.onboardingPanelNumber,e.color2)},$i().createElement("span",{className:e.onboardingPanelNumberSpan},"2")),$i().createElement("h3",{className:e.onboardingPanelHeader},"Configure Your Applications"),$i().createElement("p",{className:e.onboardingPanelDescription},"Go to ",$i().createElement(cs,{href:t.settingsUrl},"Grafana Cloud Stack settings")," to find your Grafana Cloud Credentials.")),$i().createElement("div",{className:e.onboardingPanel},$i().createElement("div",{className:(0,i.cx)(e.onboardingPanelNumber,e.color3)},$i().createElement("span",{className:e.onboardingPanelNumberSpan},"3")),$i().createElement("h3",{className:e.onboardingPanelHeader},"Start Getting Performance Insights"),$i().createElement("p",{className:e.onboardingPanelDescription},"Once you're done with initial setup, refresh this page to see your profiling data."))):$i().createElement($i().Fragment,null,$i().createElement("div",{className:e.onboardingPanel},$i().createElement("div",{className:e.onboardingPanelNumber},$i().createElement("span",{className:e.onboardingPanelNumberSpan},"1")),$i().createElement("h3",{className:e.onboardingPanelHeader},"Set Up Your Pyroscope Server"),$i().createElement("p",{className:e.onboardingPanelDescription},"Install ",$i().createElement(cs,{href:"https://grafana.com/docs/pyroscope/latest/"},"Pyroscope Server")," on your infrastructure. Or if you want to use a hosted service, go to"," ",$i().createElement(cs,{href:t.settingsUrl},"Grafana Cloud Stack settings")," to find your Grafana Cloud Credentials.")),$i().createElement("div",{className:e.onboardingPanel},$i().createElement("div",{className:(0,i.cx)(e.onboardingPanelNumber,e.color2)},$i().createElement("span",{className:e.onboardingPanelNumberSpan},"2")),$i().createElement("h3",{className:e.onboardingPanelHeader},"Configure Grafana"),$i().createElement("p",{className:e.onboardingPanelDescription},"Add a new ",$i().createElement(cs,{href:"/connections/datasources/new"},"Pyroscope datasource"),". Use your Pyroscope server URL and appropriate security credentials if you use Grafana Cloud Profiles.")),$i().createElement("div",{className:e.onboardingPanel},$i().createElement("div",{className:(0,i.cx)(e.onboardingPanelNumber,e.color3)},$i().createElement("span",{className:e.onboardingPanelNumberSpan},"3")),$i().createElement("h3",{className:e.onboardingPanelHeader},"Add Profiling to Your Application"),$i().createElement("p",{className:e.onboardingPanelDescription},"Use"," ",$i().createElement(cs,{href:"https://grafana.com/docs/pyroscope/latest/configure-client/grafana-alloy/"},"Grafana Alloy")," ","or"," ",$i().createElement(cs,{href:"https://grafana.com/docs/pyroscope/next/configure-client/language-sdks/"},"Pyroscope SDKs")," ","to push profiles from your applications to Grafana Cloud."))))),t.isCloud&&$i().createElement("div",{"data-testid":"how-billing-works"},$i().createElement("h3",null,"How Billing Works"),$i().createElement("div",{className:e.onboardingRow},$i().createElement("p",{className:e.onboardingParagraph},"Usage of Grafana Cloud Profiles is subject to"," ",$i().createElement(cs,{href:"https://grafana.com/pricing/"},"Grafana Cloud Pricing")," for Profiles.",$i().createElement("br",null),"For additional information, read the announcement ",$i().createElement(cs,{href:"https://grafana.com/blog/2023/08/09/grafana-cloud-profiles-for-continuous-profiling/"},"blog post"),"."))))}const bs=e=>({onboardingPage:i.css`
padding: 16px;
margin: 64px;
position: relative;
background-color: ${e.colors.background.primary};
`,closeButton:i.css`
position: absolute;
top: -30px;
opacity: 0.8;
right: -32px;
border: none;
border-radius: 50%;
width: 40px;
height: 40px;
line-height: 40px;
display: block;
padding: 0;
margin: 0;
font-size: 22px;
`}),vs={text:"Onboarding"};function ws({onCloseModal:e}){const t=(0,o.useStyles2)(bs);return $i().createElement(a.PluginPage,{pageNav:vs,layout:r.PageLayoutType.Custom},$i().createElement("div",{className:t.onboardingPage},$i().createElement("button",{className:t.closeButton,onClick:e,title:"Close","data-testid":"close-onboarding-modal"},"×"),$i().createElement(ys,null)))}function Ss({children:e}){const{data:t,actions:n}=Da();return t.shouldShowLoadingPage?$i().createElement(ss,null):t.shouldShowOnboardingPage?$i().createElement(ws,{onCloseModal:n.closeModal}):t.shouldShowNoDataSourceBanner?$i().createElement(us,null):$i().createElement($i().Fragment,null,e)}var Es=__webpack_require__(1159);function xs({onClick:e}){const t=e||(()=>history.back());return $i().createElement(o.Button,{variant:"secondary",onClick:t,"aria-label":"Back to Profiles Drilldown"},"Back to Profiles Drilldown")}const Os=Ri.EXPLORE.slice(1);function _s(){const{pathname:e}=new URL(window.location.toString());return e.split("/").pop()||""}function Ts(){const e={appRelease:a.config.apps[Pi].version,appVersion:Di,page:_s()};return e.page===Os&&(e.view=new URLSearchParams(window.location.search).get("explorationType")||""),e}function Cs(e,t){(0,a.reportInteraction)(e,{props:t,meta:Ts()})}function ks(e){const[t,n]=(0,Fi.useState)(!1);(0,Fi.useEffect)((()=>{t||(n(!0),Cs("g_pyroscope_app_page_initialized",{page:e}))}),[e,t])}const Ps=e=>({container:i.css`
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: ${e.spacing(1)};
width: 100%;
`,column:i.css`
width: 50%;
`});function As({left:e,right:t}){const n=(0,o.useStyles2)(Ps);return $i().createElement("div",{className:n.container},$i().createElement("div",{className:n.column},e),$i().createElement("div",{className:n.column},t))}function Rs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ds(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function js(e,t){const n=t.reduce(((e,t,n)=>Ds(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Rs(e,t,n[t])}))}return e}({},e),{[`info${n+1}`]:t})),{handheldBy:"displayError"});Xi.error(e,n),(0,a.getAppEvents)().publish({type:r.AppEvents.alertError.name,payload:t})}function Is(e){Xi.warn(e),(0,a.getAppEvents)().publish({type:r.AppEvents.alertWarning.name,payload:e})}function Ns(e){(0,a.getAppEvents)().publish({type:r.AppEvents.alertSuccess.name,payload:e})}function Ls(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Ms(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Ls(a,r,i,o,s,"next",e)}function s(e){Ls(a,r,i,o,s,"throw",e)}o(void 0)}))}}const Fs=new class extends ua{get(e,t){var n=this;return Ms((function*(){const r=yield n.fetch("/adhocprofiles.v1.AdHocProfileService/Get",{method:"POST",body:JSON.stringify({id:e,profile_type:t})}),i=yield r.json();return{id:i.id,name:i.name,profileTypes:i.profileTypes,profile:JSON.parse(i.flamebearerProfile)}}))()}uploadSingle(e){var t=this;return Ms((function*(){const n=yield t._readProfileFile(e),r=yield t.fetch("/adhocprofiles.v1.AdHocProfileService/Upload",{method:"POST",body:JSON.stringify({name:e.name,profile:n})}),i=yield r.json();return{id:i.id,name:e.name,profileTypes:i.profileTypes,profile:JSON.parse(i.flamebearerProfile)}}))()}uploadDiff(){return Ms((function*(){return{id:"?",name:"??",profileTypes:[],profile:null}}))()}_readProfileFile(e){return Ms((function*(){return new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(()=>{try{t(function(e){const[,t]=e.split(";base64,");if(!t)throw new Error("No content after stripping the base64 prefix.");if(e===t)throw new Error("No base64 prefix?!");return t}(r.result))}catch(e){n(e)}})),r.addEventListener("error",(()=>{n(new Error(`Error while reading file "${e.name}"!`))})),r.readAsDataURL(e)}))}))()}};function $s(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Bs(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){$s(a,r,i,o,s,"next",e)}function s(e){$s(a,r,i,o,s,"throw",e)}o(void 0)}))}}function Vs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Us(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Vs(e,t,n[t])}))}return e}function zs(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const qs={id:"",name:"",profileTypes:[],profile:null};function Hs(){const[e,t]=(0,Fi.useState)(!1),[n,r]=(0,Fi.useState)(qs);(0,Fi.useEffect)((()=>()=>{Fs.abort()}),[]);const i=(0,Fi.useCallback)((()=>{Fs.abort(),t(!1),r(qs)}),[]),a=(0,Fi.useCallback)(function(){var e=Bs((function*(e){i();try{t(!0);const n=yield Fs.uploadSingle(e);r(n)}catch(e){r(qs),Fs.isAbortError(e)||js(e,["Error while uploading profile!",e.message])}t(!1)}));return function(t){return e.apply(this,arguments)}}(),[i]),o=(0,Fi.useCallback)(function(){var e=Bs((function*(e){const i=e.value;if(i&&n.id&&n.profileTypes.includes(i)){Fs.abort(),t(!1),r((e=>zs(Us({},e),{profile:null}))),t(!0);try{const e=yield Fs.get(n.id,i);r((t=>zs(Us({},t),{profile:e.profile})))}catch(e){Fs.isAbortError(e)||js(e,["Error while fetching profile!",e.message])}t(!1)}}));return function(t){return e.apply(this,arguments)}}(),[n.id,n.profileTypes]);return{processFile:a,profileTypes:n.profileTypes,selectProfileType:o,profile:n.profile,removeFile:i,isLoading:e}}function Gs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ws(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Gs(e,t,n[t])}))}return e}function Qs(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ks={accept:{"application/gzip":[".gz"],"application/json":[".json"],"application/proto":[".pb",".pprof"]},multiple:!1,onError(e){js(e,["Error while uploading file!",e.toString()])}};function Ys({onFileDropped:e,onFileRemove:t}){const n=(0,Fi.useCallback)((function(t){e(t[0])}),[e]);return $i().createElement(o.FileDropzone,{options:Qs(Ws({},Ks),{onDropAccepted:n}),onFileRemove:t})}const Xs=(e,t)=>e>t?1:e<t?-1:0,Js=1/0,Zs=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),el="eexxaacctt",tl=/\p{P}/gu,nl=["en",{numeric:!0,sensitivity:"base"}],rl=(e,t,n)=>e.replace("A-Z",t).replace("a-z",n),il={unicode:!1,alpha:null,interSplit:"[^A-Za-z\\d']+",intraSplit:"[a-z][A-Z]",interBound:"[^A-Za-z\\d]",intraBound:"[A-Za-z]\\d|\\d[A-Za-z]|[a-z][A-Z]",interLft:0,interRgt:0,interChars:".",interIns:Js,intraChars:"[a-z\\d']",intraIns:null,intraContr:"'[a-z]{1,2}\\b",intraMode:0,intraSlice:[1,Js],intraSub:null,intraTrn:null,intraDel:null,intraFilt:(e,t,n)=>!0,toUpper:e=>e.toLocaleUpperCase(),toLower:e=>e.toLocaleLowerCase(),compare:null,sort:(e,t,n,r=Xs)=>{let{idx:i,chars:a,terms:o,interLft2:s,interLft1:l,start:c,intraIns:u,interIns:d,cases:p}=e;return i.map(((e,t)=>t)).sort(((e,n)=>a[n]-a[e]||u[e]-u[n]||o[n]+s[n]+.5*l[n]-(o[e]+s[e]+.5*l[e])||d[e]-d[n]||c[e]-c[n]||p[n]-p[e]||r(t[i[e]],t[i[n]])))}},al=(e,t)=>0==t?"":1==t?e+"??":t==Js?e+"*?":e+`{0,${t}}?`,ol="(?:\\b|_)";function sl(e){e=Object.assign({},il,e);let{unicode:t,interLft:n,interRgt:r,intraMode:i,intraSlice:a,intraIns:o,intraSub:s,intraTrn:l,intraDel:c,intraContr:u,intraSplit:d,interSplit:p,intraBound:h,interBound:f,intraChars:m,toUpper:g,toLower:y,compare:b}=e;o??=i,s??=i,l??=i,c??=i,b??="undefined"==typeof Intl?Xs:new Intl.Collator(...nl).compare;let v=e.letters??e.alpha;if(null!=v){let e=g(v),t=y(v);p=rl(p,e,t),d=rl(d,e,t),f=rl(f,e,t),h=rl(h,e,t),m=rl(m,e,t),u=rl(u,e,t)}let w=t?"u":"";const S='".+?"',E=new RegExp(S,"gi"+w),x=new RegExp(`(?:\\s+|^)-(?:${m}+|${S})`,"gi"+w);let{intraRules:O}=e;null==O&&(O=e=>{let t=il.intraSlice,n=0,r=0,i=0,u=0;if(/[^\d]/.test(e)){let d=e.length;d<=4?d>=3&&(i=Math.min(l,1),4==d&&(n=Math.min(o,1))):(t=a,n=o,r=s,i=l,u=c)}return{intraSlice:t,intraIns:n,intraSub:r,intraTrn:i,intraDel:u}});let _=!!d,T=new RegExp(d,"g"+w),C=new RegExp(p,"g"+w),k=new RegExp("^"+p+"|"+p+"$","g"+w),P=new RegExp(u,"gi"+w);const A=(e,t=!1)=>{let n=[];e=e.replace(E,(e=>(n.push(e),el))),e=e.replace(k,""),t||(e=y(e)),_&&(e=e.replace(T,(e=>e[0]+" "+e[1])));let r=0;return e.split(C).filter((e=>""!=e)).map((e=>e===el?n[r++]:e))},R=/[^\d]+|\d+/g,D=(t,a=0,s=!1)=>{let l=A(t);if(0==l.length)return[];let c,u=Array(l.length).fill("");if(l=l.map(((e,t)=>e.replace(P,(e=>(u[t]=e,""))))),1==i)c=l.map(((e,t)=>{if('"'===e[0])return Zs(e.slice(1,-1));let n="";for(let r of e.matchAll(R)){let e=r[0],{intraSlice:i,intraIns:a,intraSub:o,intraTrn:s,intraDel:l}=O(e);if(a+o+s+l==0)n+=e+u[t];else{let[r,c]=i,d=e.slice(0,r),p=e.slice(c),h=e.slice(r,c);1==a&&1==d.length&&d!=h[0]&&(d+="(?!"+d+")");let f=h.length,g=[e];if(o)for(let e=0;e<f;e++)g.push(d+h.slice(0,e)+m+h.slice(e+1)+p);if(s)for(let e=0;e<f-1;e++)h[e]!=h[e+1]&&g.push(d+h.slice(0,e)+h[e+1]+h[e]+h.slice(e+2)+p);if(l)for(let e=0;e<f;e++)g.push(d+h.slice(0,e+1)+"?"+h.slice(e+1)+p);if(a){let e=al(m,1);for(let t=0;t<f;t++)g.push(d+h.slice(0,t)+e+h.slice(t)+p)}n+="(?:"+g.join("|")+")"+u[t]}}return n}));else{let e=al(m,o);2==a&&o>0&&(e=")("+e+")("),c=l.map(((t,n)=>'"'===t[0]?Zs(t.slice(1,-1)):t.split("").map(((e,t,n)=>(1==o&&0==t&&n.length>1&&e!=n[t+1]&&(e+="(?!"+e+")"),e))).join(e)+u[n]))}let d=2==n?ol:"",p=2==r?ol:"",h=p+al(e.interChars,e.interIns)+d;return a>0?s?c=d+"("+c.join(")"+p+"|"+d+"(")+")"+p:(c="("+c.join(")("+h+")(")+")",c="(.??"+d+")"+c+"("+p+".*)"):(c=c.join(h),c=d+c+p),[new RegExp(c,"i"+w),l,u]},j=(e,t,n)=>{let[r]=D(t);if(null==r)return null;let i=[];if(null!=n)for(let t=0;t<n.length;t++){let a=n[t];r.test(e[a])&&i.push(a)}else for(let t=0;t<e.length;t++)r.test(e[t])&&i.push(t);return i};let I=!!h,N=new RegExp(f,w),L=new RegExp(h,w);const M=(t,i,a)=>{let[o,s,l]=D(a,1),c=A(a,!0),[u]=D(a,2),d=s.length,p=Array(d),h=Array(d);for(let e=0;e<d;e++){let t=s[e],n=c[e],r='"'==t[0]?t.slice(1,-1):t+l[e],i='"'==n[0]?n.slice(1,-1):n+l[e];p[e]=r,h[e]=i}let f=t.length,m=Array(f).fill(0),g={idx:Array(f),start:m.slice(),chars:m.slice(),cases:m.slice(),terms:m.slice(),interIns:m.slice(),intraIns:m.slice(),interLft2:m.slice(),interRgt2:m.slice(),interLft1:m.slice(),interRgt1:m.slice(),ranges:Array(f)},b=1==n||1==r,v=0;for(let a=0;a<t.length;a++){let s=i[t[a]],l=s.match(o),c=l.index+l[1].length,f=c,m=!1,S=0,E=0,x=0,O=0,_=0,T=0,C=0,k=0,P=0,A=[];for(let t=0,i=2;t<d;t++,i+=2){let a=y(l[i]),o=p[t],u=h[t],g=o.length,v=a.length,R=a==o;if(l[i]==u&&C++,!R&&l[i+1].length>=g){let e=y(l[i+1]).indexOf(o);e>-1&&(A.push(f,v,e,g),f+=F(l,i,e,g),a=o,v=g,R=!0,0==t&&(c=f))}if(b||R){let e=f-1,u=f+v,d=!1,p=!1;if(-1==e||N.test(s[e]))R&&S++,d=!0;else{if(2==n){m=!0;break}if(I&&L.test(s[e]+s[e+1]))R&&E++,d=!0;else if(1==n){let e=l[i+1],n=f+v;if(e.length>=g){let r,u=0,p=!1,h=new RegExp(o,"ig"+w);for(;r=h.exec(e);){u=r.index;let e=n+u,t=e-1;if(-1==t||N.test(s[t])){S++,p=!0;break}if(L.test(s[t]+s[e])){E++,p=!0;break}}p&&(d=!0,A.push(f,v,u,g),f+=F(l,i,u,g),a=o,v=g,R=!0,0==t&&(c=f))}if(!d){m=!0;break}}}if(u==s.length||N.test(s[u]))R&&x++,p=!0;else{if(2==r){m=!0;break}if(I&&L.test(s[u-1]+s[u]))R&&O++,p=!0;else if(1==r){m=!0;break}}R&&(_+=g,d&&p&&T++)}if(v>g&&(P+=v-g),t>0&&(k+=l[i-1].length),!e.intraFilt(o,a,f)){m=!0;break}t<d-1&&(f+=v+l[i+1].length)}if(!m){g.idx[v]=t[a],g.interLft2[v]=S,g.interLft1[v]=E,g.interRgt2[v]=x,g.interRgt1[v]=O,g.chars[v]=_,g.terms[v]=T,g.cases[v]=C,g.interIns[v]=k,g.intraIns[v]=P,g.start[v]=c;let e=s.match(u),n=e.index+e[1].length,r=A.length,i=r>0?0:1/0,o=r-4;for(let t=2;t<e.length;){let r=e[t].length;if(i<=o&&A[i]==n){let r=A[i+1],a=A[i+2],o=A[i+3],s=t,l="";for(let t=0;t<r;s++)l+=e[s],t+=e[s].length;e.splice(t,s-t,l),n+=F(e,t,a,o),i+=4}else n+=r,t++}n=e.index+e[1].length;let l=g.ranges[v]=[],d=n,p=n;for(let t=2;t<e.length;t++){let r=e[t].length;n+=r,t%2==0?p=n:r>0&&(l.push(d,p),d=p=n)}p>d&&l.push(d,p),v++}}if(v<t.length)for(let e in g)g[e]=g[e].slice(0,v);return g},F=(e,t,n,r)=>{let i=e[t]+e[t+1].slice(0,n);return e[t-1]+=i,e[t]=e[t+1].slice(n,n+r),e[t+1]=e[t+1].slice(n+r),i.length};return{search:(...t)=>{let n=((t,n,r,i=1e3,a)=>{r=r?!0===r?5:r:0;let o=null,s=null,l=[];n=n.replace(x,(e=>{let t=e.trim().slice(1);return t='"'===t[0]?Zs(t.slice(1,-1)):t.replace(tl,""),""!=t&&l.push(t),""}));let c,u=A(n);if(l.length>0){if(c=new RegExp(l.join("|"),"i"+w),0==u.length){let e=[];for(let n=0;n<t.length;n++)c.test(t[n])||e.push(n);return[e,null,null]}}else if(0==u.length)return[null,null,null];if(r>0){let e=A(n);if(e.length>1){let n=e.slice().sort(((e,t)=>t.length-e.length));for(let e=0;e<n.length;e++){if(0==a?.length)return[[],null,null];a=j(t,n[e],a)}if(e.length>r)return[a,null,null];o=cl(e).map((e=>e.join(" "))),s=[];let i=new Set;for(let e=0;e<o.length;e++)if(i.size<a.length){let n=a.filter((e=>!i.has(e))),r=j(t,o[e],n);for(let e=0;e<r.length;e++)i.add(r[e]);s.push(r)}else s.push([])}}null==o&&(o=[n],s=[a?.length>0?a:j(t,n)]);let d=null,p=null;if(l.length>0&&(s=s.map((e=>e.filter((e=>!c.test(t[e])))))),s.reduce(((e,t)=>e+t.length),0)<=i){d={},p=[];for(let n=0;n<s.length;n++){let r=s[n];if(null==r||0==r.length)continue;let i=o[n],a=M(r,t,i),l=e.sort(a,t,i,b);if(n>0)for(let e=0;e<l.length;e++)l[e]+=p.length;for(let e in a)d[e]=(d[e]??[]).concat(a[e]);p=p.concat(l)}}return[[].concat(...s),d,p]})(...t);return n},split:A,filter:j,info:M,sort:e.sort}}const ll=(()=>{let e={A:"ÁÀÃÂÄĄ",a:"áàãâäą",E:"ÉÈÊËĖ",e:"éèêëę",I:"ÍÌÎÏĮ",i:"íìîïį",O:"ÓÒÔÕÖ",o:"óòôõö",U:"ÚÙÛÜŪŲ",u:"úùûüūų",C:"ÇČĆ",c:"çčć",L:"Ł",l:"ł",N:"ÑŃ",n:"ñń",S:"ŠŚ",s:"šś",Z:"ŻŹ",z:"żź"},t=new Map,n="";for(let r in e)e[r].split("").forEach((e=>{n+=e,t.set(e,r)}));let r=new RegExp(`[${n}]`,"g"),i=e=>t.get(e);return e=>{if("string"==typeof e)return e.replace(r,i);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n].replace(r,i);return t}})();function cl(e){let t,n,r=(e=e.slice()).length,i=[e.slice()],a=new Array(r).fill(0),o=1;for(;o<r;)a[o]<o?(t=o%2&&a[o],n=e[o],e[o]=e[t],e[t]=n,++a[o],o=1,i.push(e.slice())):(a[o]=0,++o);return i}const ul=(e,t)=>t?`<mark>${e}</mark>`:e,dl=(e,t)=>e+t;sl.latinize=ll,sl.permute=e=>{let t=cl([...Array(e.length).keys()]).sort(((e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!=t[n])return e[n]-t[n];return 0}));return t.map((t=>t.map((t=>e[t]))))},sl.highlight=function(e,t,n=ul,r="",i=dl){r=i(r,n(e.substring(0,t[0]),!1))??r;for(let a=0;a<t.length;a+=2){let o=t[a],s=t[a+1];r=i(r,n(e.substring(o,s),!0))??r,a<t.length-3&&(r=i(r,n(e.substring(t[a+1],t[a+2]),!1))??r)}return r=i(r,n(e.substring(t[t.length-1]),!1))??r};var pl=function(){};var hl="undefined"!=typeof window;const fl=hl?Fi.useLayoutEffect:Fi.useEffect;var ml={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const gl=hl&&void 0!==window.ResizeObserver?function(){var e=(0,Fi.useState)(null),t=e[0],n=e[1],r=(0,Fi.useState)(ml),i=r[0],a=r[1],o=(0,Fi.useMemo)((function(){return new window.ResizeObserver((function(e){if(e[0]){var t=e[0].contentRect,n=t.x,r=t.y,i=t.width,o=t.height,s=t.top,l=t.left,c=t.bottom,u=t.right;a({x:n,y:r,width:i,height:o,top:s,left:l,bottom:c,right:u})}}))}),[]);return fl((function(){if(t)return o.observe(t),function(){o.disconnect()}}),[t]),[n,i]}:function(){return[pl,ml]},yl=22*window.devicePixelRatio,bl=10*window.devicePixelRatio,vl=.5*window.devicePixelRatio,wl=20*window.devicePixelRatio,Sl=.5*window.devicePixelRatio,El=4*window.devicePixelRatio,xl=3*window.devicePixelRatio,Ol=3*window.devicePixelRatio,_l=4*window.devicePixelRatio,Tl=2*window.devicePixelRatio,Cl=120,kl=({data:e,itemData:t,onMenuItemClick:n,onItemFocus:r,onSandwich:i,collapseConfig:a,onExpandGroup:s,onCollapseGroup:l,onExpandAllGroups:c,onCollapseAllGroups:u,getExtraContextMenuButtons:d,collapsing:p,allGroupsExpanded:h,allGroupsCollapsed:f,selectedView:m,search:g})=>(0,Bi.jsx)("div",{"data-testid":"contextMenu",children:(0,Bi.jsx)(o.ContextMenu,{renderMenuItems:function(){const y=(null==d?void 0:d(t,e.data,{selectedView:m,isDiff:e.isDiffFlamegraph(),search:g,collapseConfig:a}))||[];return(0,Bi.jsxs)(Bi.Fragment,{children:[(0,Bi.jsx)(o.MenuItem,{label:"Focus block",icon:"eye",onClick:()=>{r(),n()}}),(0,Bi.jsx)(o.MenuItem,{label:"Copy function name",icon:"copy",onClick:()=>{navigator.clipboard.writeText(t.label).then((()=>{n()}))}}),(0,Bi.jsx)(o.MenuItem,{label:"Sandwich view",icon:"gf-show-context",onClick:()=>{i(),n()}}),y.map((({label:e,icon:t,onClick:n})=>(0,Bi.jsx)(o.MenuItem,{label:e,icon:t,onClick:()=>n()},e))),p&&(0,Bi.jsxs)(o.MenuGroup,{label:"Grouping",children:[a?a.collapsed?(0,Bi.jsx)(o.MenuItem,{label:"Expand group",icon:"angle-double-down",onClick:()=>{s(),n()}}):(0,Bi.jsx)(o.MenuItem,{label:"Collapse group",icon:"angle-double-up",onClick:()=>{l(),n()}}):null,!h&&(0,Bi.jsx)(o.MenuItem,{label:"Expand all groups",icon:"angle-double-down",onClick:()=>{c(),n()}}),!f&&(0,Bi.jsx)(o.MenuItem,{label:"Collapse all groups",icon:"angle-double-up",onClick:()=>{u(),n()}})]})]})},x:t.posX+10,y:t.posY,focusOnOpen:!1})}),Pl=({data:e,item:t,totalTicks:n,position:r,collapseConfig:i})=>{const a=(0,o.useStyles2)(jl);if(!t||!r)return null;let s;if(e.isDiffFlamegraph()){const r=Rl(e,t,n);s=(0,Bi.jsx)(o.InteractiveTable,{className:a.tooltipTable,columns:[{id:"label",header:""},{id:"baseline",header:"Baseline"},{id:"comparison",header:"Comparison"},{id:"diff",header:"Diff"}],data:r,getRowId:e=>e.rowId})}else{const r=Al(e,t,n);s=(0,Bi.jsxs)("p",{className:a.lastParagraph,children:[r.unitTitle,(0,Bi.jsx)("br",{}),"Total: ",(0,Bi.jsx)("b",{children:r.unitValue})," (",r.percentValue,"%)",(0,Bi.jsx)("br",{}),"Self: ",(0,Bi.jsx)("b",{children:r.unitSelf})," (",r.percentSelf,"%)",(0,Bi.jsx)("br",{}),"Samples: ",(0,Bi.jsx)("b",{children:r.samples})]})}return(0,Bi.jsx)(o.Portal,{children:(0,Bi.jsx)(o.VizTooltipContainer,{className:a.tooltipContainer,position:r,offset:{x:15,y:0},children:(0,Bi.jsxs)("div",{className:a.tooltipContent,children:[(0,Bi.jsxs)("p",{className:a.tooltipName,children:[e.getLabel(t.itemIndexes[0]),i&&i.collapsed?(0,Bi.jsxs)("span",{children:[(0,Bi.jsx)("br",{}),"and ",i.items.length," similar items"]}):""]}),s]})})})},Al=(e,t,n)=>{const r=e.valueDisplayProcessor(t.value),i=e.getSelfDisplay(t.itemIndexes),a=Math.round(r.numeric/n*1e4)/100,o=Math.round(i.numeric/n*1e4)/100;let s=r.text+r.suffix,l=i.text+i.suffix;const c=e.getUnitTitle();return"Count"===c&&(r.suffix||(s=r.text),i.suffix||(l=i.text)),{percentValue:a,percentSelf:o,unitTitle:c,unitValue:s,unitSelf:l,samples:r.numeric.toLocaleString()}},Rl=(e,t,n)=>{const i=e.getLevels()[0][0].valueRight,a=n-i,o=t.value-t.valueRight,s=Math.round(1e4*o/a)/100,l=Math.round(1e4*t.valueRight/i)/100,c=(l-s)/s*100,u=Dl(e,e.valueDisplayProcessor(o)),d=Dl(e,e.valueDisplayProcessor(t.valueRight)),p=(0,r.getValueFormat)("short");return[{rowId:"1",label:"% of total",baseline:s+"%",comparison:l+"%",diff:p(c).text+"%"},{rowId:"2",label:"Value",baseline:u,comparison:d,diff:Dl(e,e.valueDisplayProcessor(t.valueRight-o))},{rowId:"3",label:"Samples",baseline:p(o).text,comparison:p(t.valueRight).text,diff:p(t.valueRight-o).text}]};function Dl(e,t){let n=t.text+t.suffix;return"Count"===e.getUnitTitle()&&(t.suffix||(n=t.text)),n}const jl=e=>({tooltipContainer:(0,i.css)({title:"tooltipContainer",overflow:"hidden"}),tooltipContent:(0,i.css)({title:"tooltipContent",fontSize:e.typography.bodySmall.fontSize,width:"100%"}),tooltipName:(0,i.css)({title:"tooltipName",marginTop:0,wordBreak:"break-all"}),lastParagraph:(0,i.css)({title:"lastParagraph",marginBottom:0}),name:(0,i.css)({title:"name",marginBottom:"10px"}),tooltipTable:(0,i.css)({title:"tooltipTable",maxWidth:"400px"})});function Il(e){return Il="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Il(e)}var Nl=/^\s+/,Ll=/\s+$/;function Ml(e,t){if(t=t||{},(e=e||"")instanceof Ml)return e;if(!(this instanceof Ml))return new Ml(e,t);var n=function(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;"string"==typeof e&&(e=function(e){e=e.replace(Nl,"").replace(Ll,"").toLowerCase();var t,n=!1;if(ec[e])e=ec[e],n=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=hc.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=hc.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=hc.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=hc.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=hc.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=hc.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=hc.hex8.exec(e))return{r:ac(t[1]),g:ac(t[2]),b:ac(t[3]),a:cc(t[4]),format:n?"name":"hex8"};if(t=hc.hex6.exec(e))return{r:ac(t[1]),g:ac(t[2]),b:ac(t[3]),format:n?"name":"hex"};if(t=hc.hex4.exec(e))return{r:ac(t[1]+""+t[1]),g:ac(t[2]+""+t[2]),b:ac(t[3]+""+t[3]),a:cc(t[4]+""+t[4]),format:n?"name":"hex8"};if(t=hc.hex3.exec(e))return{r:ac(t[1]+""+t[1]),g:ac(t[2]+""+t[2]),b:ac(t[3]+""+t[3]),format:n?"name":"hex"};return!1}(e));"object"==Il(e)&&(fc(e.r)&&fc(e.g)&&fc(e.b)?(t=function(e,t,n){return{r:255*rc(e,255),g:255*rc(t,255),b:255*rc(n,255)}}(e.r,e.g,e.b),o=!0,s="%"===String(e.r).substr(-1)?"prgb":"rgb"):fc(e.h)&&fc(e.s)&&fc(e.v)?(r=sc(e.s),i=sc(e.v),t=function(e,t,n){e=6*rc(e,360),t=rc(t,100),n=rc(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),l=r%6,c=[n,o,a,a,s,n][l],u=[s,n,n,o,a,a][l],d=[a,a,s,n,n,o][l];return{r:255*c,g:255*u,b:255*d}}(e.h,r,i),o=!0,s="hsv"):fc(e.h)&&fc(e.s)&&fc(e.l)&&(r=sc(e.s),a=sc(e.l),t=function(e,t,n){var r,i,a;function o(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(e=rc(e,360),t=rc(t,100),n=rc(n,100),0===t)r=i=a=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=o(l,s,e+1/3),i=o(l,s,e),a=o(l,s,e-1/3)}return{r:255*r,g:255*i,b:255*a}}(e.h,r,a),o=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a));return n=nc(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}function Fl(e,t,n){e=rc(e,255),t=rc(t,255),n=rc(n,255);var r,i,a=Math.max(e,t,n),o=Math.min(e,t,n),s=(a+o)/2;if(a==o)r=i=0;else{var l=a-o;switch(i=s>.5?l/(2-a-o):l/(a+o),a){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return{h:r,s:i,l:s}}function $l(e,t,n){e=rc(e,255),t=rc(t,255),n=rc(n,255);var r,i,a=Math.max(e,t,n),o=Math.min(e,t,n),s=a,l=a-o;if(i=0===a?0:l/a,a==o)r=0;else{switch(a){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return{h:r,s:i,v:s}}function Bl(e,t,n,r){var i=[oc(Math.round(e).toString(16)),oc(Math.round(t).toString(16)),oc(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function Vl(e,t,n,r){return[oc(lc(r)),oc(Math.round(e).toString(16)),oc(Math.round(t).toString(16)),oc(Math.round(n).toString(16))].join("")}function Ul(e,t){t=0===t?0:t||10;var n=Ml(e).toHsl();return n.s-=t/100,n.s=ic(n.s),Ml(n)}function zl(e,t){t=0===t?0:t||10;var n=Ml(e).toHsl();return n.s+=t/100,n.s=ic(n.s),Ml(n)}function ql(e){return Ml(e).desaturate(100)}function Hl(e,t){t=0===t?0:t||10;var n=Ml(e).toHsl();return n.l+=t/100,n.l=ic(n.l),Ml(n)}function Gl(e,t){t=0===t?0:t||10;var n=Ml(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(-t/100*255))),n.g=Math.max(0,Math.min(255,n.g-Math.round(-t/100*255))),n.b=Math.max(0,Math.min(255,n.b-Math.round(-t/100*255))),Ml(n)}function Wl(e,t){t=0===t?0:t||10;var n=Ml(e).toHsl();return n.l-=t/100,n.l=ic(n.l),Ml(n)}function Ql(e,t){var n=Ml(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,Ml(n)}function Kl(e){var t=Ml(e).toHsl();return t.h=(t.h+180)%360,Ml(t)}function Yl(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=Ml(e).toHsl(),r=[Ml(e)],i=360/t,a=1;a<t;a++)r.push(Ml({h:(n.h+a*i)%360,s:n.s,l:n.l}));return r}function Xl(e){var t=Ml(e).toHsl(),n=t.h;return[Ml(e),Ml({h:(n+72)%360,s:t.s,l:t.l}),Ml({h:(n+216)%360,s:t.s,l:t.l})]}function Jl(e,t,n){t=t||6,n=n||30;var r=Ml(e).toHsl(),i=360/n,a=[Ml(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(Ml(r));return a}function Zl(e,t){t=t||6;for(var n=Ml(e).toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(Ml({h:r,s:i,v:a})),a=(a+s)%1;return o}Ml.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,n,r=this.toRgb();return e=r.r/255,t=r.g/255,n=r.b/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=nc(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=$l(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=$l(this._r,this._g,this._b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=Fl(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=Fl(this._r,this._g,this._b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return Bl(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,n,r,i){var a=[oc(Math.round(e).toString(16)),oc(Math.round(t).toString(16)),oc(Math.round(n).toString(16)),oc(lc(r))];if(i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*rc(this._r,255))+"%",g:Math.round(100*rc(this._g,255))+"%",b:Math.round(100*rc(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*rc(this._r,255))+"%, "+Math.round(100*rc(this._g,255))+"%, "+Math.round(100*rc(this._b,255))+"%)":"rgba("+Math.round(100*rc(this._r,255))+"%, "+Math.round(100*rc(this._g,255))+"%, "+Math.round(100*rc(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(tc[Bl(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+Vl(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var i=Ml(e);n="#"+Vl(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return Ml(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(Hl,arguments)},brighten:function(){return this._applyModification(Gl,arguments)},darken:function(){return this._applyModification(Wl,arguments)},desaturate:function(){return this._applyModification(Ul,arguments)},saturate:function(){return this._applyModification(zl,arguments)},greyscale:function(){return this._applyModification(ql,arguments)},spin:function(){return this._applyModification(Ql,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Jl,arguments)},complement:function(){return this._applyCombination(Kl,arguments)},monochromatic:function(){return this._applyCombination(Zl,arguments)},splitcomplement:function(){return this._applyCombination(Xl,arguments)},triad:function(){return this._applyCombination(Yl,[3])},tetrad:function(){return this._applyCombination(Yl,[4])}},Ml.fromRatio=function(e,t){if("object"==Il(e)){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:sc(e[r]));e=n}return Ml(e,t)},Ml.equals=function(e,t){return!(!e||!t)&&Ml(e).toRgbString()==Ml(t).toRgbString()},Ml.random=function(){return Ml.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},Ml.mix=function(e,t,n){n=0===n?0:n||50;var r=Ml(e).toRgb(),i=Ml(t).toRgb(),a=n/100;return Ml({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},Ml.readability=function(e,t){var n=Ml(e),r=Ml(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},Ml.isReadable=function(e,t,n){var r,i,a=Ml.readability(e,t);switch(i=!1,(r=function(e){var t,n;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==n&&"large"!==n&&(n="small");return{level:t,size:n}}(n)).level+r.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},Ml.mostReadable=function(e,t,n){var r,i,a,o,s=null,l=0;i=(n=n||{}).includeFallbackColors,a=n.level,o=n.size;for(var c=0;c<t.length;c++)(r=Ml.readability(e,t[c]))>l&&(l=r,s=Ml(t[c]));return Ml.isReadable(e,s,{level:a,size:o})||!i?s:(n.includeFallbackColors=!1,Ml.mostReadable(e,["#fff","#000"],n))};var ec=Ml.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},tc=Ml.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(ec);function nc(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function rc(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function ic(e){return Math.min(1,Math.max(0,e))}function ac(e){return parseInt(e,16)}function oc(e){return 1==e.length?"0"+e:""+e}function sc(e){return e<=1&&(e=100*e+"%"),e}function lc(e){return Math.round(255*parseFloat(e)).toString(16)}function cc(e){return ac(e)/255}var uc,dc,pc,hc=(dc="[\\s|\\(]+("+(uc="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+uc+")[,|\\s]+("+uc+")\\s*\\)?",pc="[\\s|\\(]+("+uc+")[,|\\s]+("+uc+")[,|\\s]+("+uc+")[,|\\s]+("+uc+")\\s*\\)?",{CSS_UNIT:new RegExp(uc),rgb:new RegExp("rgb"+dc),rgba:new RegExp("rgba"+pc),hsl:new RegExp("hsl"+dc),hsla:new RegExp("hsla"+pc),hsv:new RegExp("hsv"+dc),hsva:new RegExp("hsva"+pc),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function fc(e){return!!hc.CSS_UNIT.exec(e)}var mc=(e=>(e.Bytes="bytes",e.Short="short",e.Nanoseconds="ns",e))(mc||{}),gc=(e=>(e.TopTable="topTable",e.FlameGraph="flameGraph",e.Both="both",e))(gc||{}),yc=(e=>(e.ValueBased="valueBased",e.PackageBased="packageBased",e))(yc||{}),bc=(e=>(e.Default="default",e.DiffColorBlind="diffColorBlind",e))(bc||{}),vc=__webpack_require__(4201);const wc=[Ml({h:24,s:69,l:60}),Ml({h:34,s:65,l:65}),Ml({h:194,s:52,l:61}),Ml({h:163,s:45,l:55}),Ml({h:211,s:48,l:60}),Ml({h:246,s:40,l:65}),Ml({h:305,s:63,l:79}),Ml({h:47,s:100,l:73}),Ml({r:183,g:219,b:171}),Ml({r:244,g:213,b:152}),Ml({r:78,g:146,b:249}),Ml({r:249,g:186,b:143}),Ml({r:242,g:145,b:145}),Ml({r:130,g:181,b:216}),Ml({r:229,g:168,b:226}),Ml({r:174,g:162,b:224}),Ml({r:154,g:196,b:138}),Ml({r:242,g:201,b:109}),Ml({r:101,g:197,b:219}),Ml({r:249,g:147,b:78}),Ml({r:234,g:100,b:96}),Ml({r:81,g:149,b:206}),Ml({r:214,g:131,b:206}),Ml({r:128,g:110,b:183})],Sc=`linear-gradient(90deg, ${xc(1,100,0,1)} 0%, ${xc(100,100,0,1)} 100%)`,Ec=`linear-gradient(90deg, ${wc[0]} 0%, ${wc[2]} 30%, ${wc[6]} 50%, ${wc[7]} 70%, ${wc[8]} 100%)`;function xc(e,t,n,r){const i=Math.min(1,e/t/(r-n));return Ml({h:50-50*i,s:100,l:65+7*i})}function Oc(e,t){const n=function(e){var t;for(const[n,r]of Pc){const n=e.match(r);if(n)return(null==(t=n.groups)?void 0:t.packageName)||""}return}(e),r=function(e,t=0){let n,r,i,a,o,s,l,c;for(n=3&e.length,r=e.length-n,i=t,o=3432918353,s=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,i^=l,i=i<<13|i>>>19,a=5*(65535&i)+((5*(i>>>16)&65535)<<16)&4294967295,i=27492+(65535&a)+((58964+(a>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:l^=255&e.charCodeAt(c);default:l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,i^=l}return i^=e.length,i^=i>>>16,i=2246822507*(65535&i)+((2246822507*(i>>>16)&65535)<<16)&4294967295,i^=i>>>13,i=3266489909*(65535&i)+((3266489909*(i>>>16)&65535)<<16)&4294967295,i^=i>>>16,i>>>0}(n||"",0),i=r%wc.length;let a=wc[i].clone();return t.isLight&&(a=a.brighten(15)),a}const _c=["rgb(0, 170, 0)","rgb(148, 142, 142)","rgb(200, 0, 0)"],Tc=`linear-gradient(90deg, ${_c[0]} 0%, ${_c[1]} 50%, ${_c[2]} 100%)`,Cc=["rgb(26, 133, 255)","rgb(148, 142, 142)","rgb(220, 50, 32)"],kc=`linear-gradient(90deg, ${Cc[0]} 0%, ${Cc[1]} 50%, ${Cc[2]} 100%)`;const Pc=[["phpspy",/^(?<packageName>([^\/]*\/)*)(?<filename>.*\.php+)(?<line_info>.*)$/],["pyspy",/^(?<packageName>([^\/]*\/)*)(?<filename>.*\.py+)(?<line_info>.*)$/],["rbspy",/^(?<packageName>([^\/]*\/)*)(?<filename>.*\.rb+)(?<line_info>.*)$/],["nodespy",/^(\.\/node_modules\/)?(?<packageName>[^/]*)(?<filename>.*\.?(jsx?|tsx?)?):(?<functionName>.*):(?<line_info>.*)$/],["gospy",/^(?<packageName>.*?\/.*?\.|.*?\.|.+)(?<functionName>.*)$/],["javaspy",/^(?<packageName>.+\/)(?<filename>.+\.)(?<functionName>.+)$/],["dotnetspy",/^(?<packageName>.+)\.(.+)\.(.+)\(.*\)$/],["tracing",/^(?<packageName>.+?):.*$/],["pyroscope-rs",/^(?<packageName>[^::]+)/],["ebpfspy",/^(?<packageName>.+)$/],["unknown",/^(?<packageName>.+)$/]];function Ac(e){const{canvasRef:t,data:n,root:r,depth:i,direction:a,wrapperWidth:s,rangeMin:l,rangeMax:c,matchedLabels:u,textAlign:d,totalViewTicks:p,totalColorTicks:h,totalTicksRight:f,colorScheme:m,focusedItemData:g,collapsedMap:y}=e,b=function(e,t,n){const[r,i]=(0,Fi.useState)();return(0,Fi.useEffect)((()=>{if(!n||!e.current)return;const r=e.current.getContext("2d"),a=yl*n;e.current.width=Math.round(t*window.devicePixelRatio),e.current.height=Math.round(a),e.current.style.width=`${t}px`,e.current.style.height=a/window.devicePixelRatio+"px",r.textBaseline="middle",r.font=12*window.devicePixelRatio+"px monospace",r.strokeStyle="white",i(r)}),[e,i,t,n]),r}(t,s,i),v=(0,o.useTheme2)(),w=(0,Fi.useMemo)((()=>{const e=Ml(v.colors.background.secondary);return v.isLight?e.darken(10).toHexString():e.lighten(10).toHexString()}),[v]),S=function(e,t,n,r,i,a,o,s,l){return(0,Fi.useCallback)((function(c,u,d){if(d&&!s)return i;const p=void 0===c.valueRight||n!==bc.Default&&n!==bc.DiffColorBlind?n===yc.ValueBased?xc(c.value,e,a,o):Oc(u,r):function(e,t,n,r,i){const a=i===bc.Default?_c:Cc,o=(0,vc.scaleLinear)().domain([-100,0,100]).range(a),s=e-t,l=n-r;if(0===r||0===l)return Ml(o(0));const c=Math.round(1e4*s/l)/100;return Ml(o((Math.round(1e4*t/r)/100-c)/c*100))}(c.value,c.valueRight,e,t,n);return s?s.has(u)?p.toHslString():i:c.level>l-1?p.toHslString():p.lighten(15).toHslString()}),[e,t,n,r,a,o,s,l,i])}(h,f,m,v,w,l,c,u,g?g.item.level:0),E=function(e,t,n,r,i){return(0,Fi.useMemo)((()=>{if(!e)return()=>{};const a=(a,o,s,l,c,u)=>{e.beginPath(),e.rect(o+Sl,s,l,c),e.fillStyle=n(a,u,!1),e.stroke(),e.fill();const d=i.get(a);let p=u;if(d&&d.collapsed){p=`(${d.items.length}) `+u}l>=wl&&(d?(Rc(e,t,p,a,l,"left"===r?o+_l+Tl:o,s,r),function(e,t,n,r,i,a){const o=t+_l;e.beginPath(),e.rect(t,n,o-t+xl+Ol,r),e.fill(),e.beginPath(),a.collapsed?e.rect(o,n+r/4,xl,r/2):a.items[0]===i?e.rect(o,n+r/2,xl,r/2):a.items[a.items.length-1]===i?e.rect(o,n,xl,r/2):e.rect(o,n,xl,r);e.fillStyle="#666",e.fill()}(e,o,s,c,a,d)):Rc(e,t,p,a,l,o,s,r))};return a}),[e,n,r,t,i])}(b,n,S,d,y);(0,Fi.useEffect)((()=>{if(!b)return;b.clearRect(0,0,b.canvas.width,b.canvas.height);const e=new Path2D;!function(e,t,n,r,i,a,o,s,l){const c=[];c.push({item:e,levelOffset:0});const u=o*window.devicePixelRatio/r/(a-i);let d;for(;c.length>0;){const{item:e,levelOffset:a}=c.shift();let o=e.value;const p=o*u<=bl,h=o*u-(p?0:2*Sl),f=yl;if(h<vl)continue;let m=0,g=!1;const y=s.get(e),b=y&&y.collapsed;if(b&&d===y.items[0]?(m="children"===t?-1:1,g=!0):d=void 0,!g){b&&(d=e),l(e,Dc(e.start,r,i,u),(e.level+a)*yl,h,f,n.getLabel(e.itemIndexes[0]),p)}const v="children"===t?e.children:e.parents;v&&c.unshift(...v.map((e=>({item:e,levelOffset:a+m}))))}}(r,a,n,p,l,c,s,y,((t,n,r,i,a,o,s)=>{s?e.rect(n,r,i,a):E(t,n,r,i,a,o)})),b.fillStyle=w,b.fill(e)}),[b,n,r,s,l,c,p,a,E,y,w])}function Rc(e,t,n,r,i,a,o,s){e.save(),e.clip(),e.fillStyle="#222";const l=t.valueDisplayProcessor(r.value),c=l.suffix?l.text+l.suffix:l.text,u=e.measureText(n),d=i-El;let p=`${n} (${c})`,h=Math.max(a,0)+El;u.width>d&&(e.textAlign=s,"right"===s&&(p=n,h=a+i-El)),e.fillText(p,h,o+yl/2+2),e.restore()}function Dc(e,t,n,r){return(e-t*n)*r}const jc=({data:e,rangeMin:t,rangeMax:n,matchedLabels:r,setRangeMin:i,setRangeMax:a,onItemFocused:o,focusedItemData:s,textAlign:l,onSandwich:c,colorScheme:u,totalProfileTicks:d,totalProfileTicksRight:p,totalViewTicks:h,root:f,direction:m,depth:g,showFlameGraphOnly:y,collapsedMap:b,setCollapsedMap:v,collapsing:w,getExtraContextMenuButtons:S,selectedView:E,search:x})=>{const O=Ic(),[_,{width:T}]=gl(),C=(0,Fi.useRef)(null),[k,P]=(0,Fi.useState)(),[A,R]=(0,Fi.useState)();Ac({canvasRef:C,colorScheme:u,data:e,focusedItemData:s,root:f,direction:m,depth:g,rangeMax:n,rangeMin:t,matchedLabels:r,textAlign:l,totalViewTicks:h,totalColorTicks:e.isDiffFlamegraph()?d:h,totalTicksRight:p,wrapperWidth:T,collapsedMap:b});const D=(0,Fi.useCallback)((r=>{P(void 0);const i=C.current.clientWidth/h/(n-t),a=Nc({x:r.nativeEvent.offsetX,y:r.nativeEvent.offsetY},f,m,g,i,h,t,b);R(a?{posY:r.clientY,posX:r.clientX,item:a,label:e.getLabel(a.itemIndexes[0])}:void 0)}),[e,t,n,h,f,m,g,b]),[j,I]=(0,Fi.useState)(),N=(0,Fi.useCallback)((e=>{if(void 0===A){P(void 0),I(void 0);const r=C.current.clientWidth/h/(n-t),i=Nc({x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},f,m,g,r,h,t,b);i&&(I({x:e.clientX,y:e.clientY}),P(i))}}),[t,n,h,A,I,f,m,g,b]),L=(0,Fi.useCallback)((()=>{P(void 0)}),[]);return(0,Fi.useEffect)((()=>{const e=e=>{var t;e.target instanceof HTMLElement&&"flameGraphCanvasContainer_clickOutsideCheck"!==(null==(t=e.target.parentElement)?void 0:t.id)&&R(void 0)};return window.addEventListener("click",e),()=>window.removeEventListener("click",e)}),[R]),(0,Bi.jsxs)("div",{className:O.graph,children:[(0,Bi.jsx)("div",{className:O.canvasWrapper,id:"flameGraphCanvasContainer_clickOutsideCheck",ref:_,children:(0,Bi.jsx)("canvas",{ref:C,"data-testid":"flameGraph",onClick:D,onMouseMove:N,onMouseLeave:L})}),(0,Bi.jsx)(Pl,{position:j,item:k,data:e,totalTicks:h,collapseConfig:k?b.get(k):void 0}),!y&&A&&(0,Bi.jsx)(kl,{data:e,itemData:A,collapsing:w,collapseConfig:b.get(A.item),onMenuItemClick:()=>{R(void 0)},onItemFocus:()=>{i(A.item.start/h),a((A.item.start+A.item.value)/h),o(A)},onSandwich:()=>{c(e.getLabel(A.item.itemIndexes[0]))},onExpandGroup:()=>{v(b.setCollapsedStatus(A.item,!1))},onCollapseGroup:()=>{v(b.setCollapsedStatus(A.item,!0))},onExpandAllGroups:()=>{v(b.setAllCollapsedStatus(!1))},onCollapseAllGroups:()=>{v(b.setAllCollapsedStatus(!0))},allGroupsCollapsed:Array.from(b.values()).every((e=>e.collapsed)),allGroupsExpanded:Array.from(b.values()).every((e=>!e.collapsed)),getExtraContextMenuButtons:S,selectedView:E,search:x})]})},Ic=()=>({graph:(0,i.css)({label:"graph",overflow:"auto",flexGrow:1,flexBasis:"50%"}),canvasContainer:(0,i.css)({label:"canvasContainer",display:"flex"}),canvasWrapper:(0,i.css)({label:"canvasWrapper",cursor:"pointer",flex:1,overflow:"hidden"}),sandwichMarker:(0,i.css)({label:"sandwichMarker",writingMode:"vertical-lr",transform:"rotate(180deg)",overflow:"hidden",whiteSpace:"nowrap"}),sandwichMarkerIcon:(0,i.css)({label:"sandwichMarkerIcon",verticalAlign:"baseline"})}),Nc=(e,t,n,r,i,a,o,s)=>{let l=t,c="children"===n?0:r-1;const u=Math.floor(e.y/(yl/window.devicePixelRatio));let d;for(;l;){const t=l;if(l=void 0,c===u){d=t;break}const r="children"===n?t.children:t.parents||[];for(const t of r){const r=Dc(t.start,a,o,i),u=Dc(t.start+t.value,a,o,i);if(r<=e.x&&e.x<u){l=t;const e=s.get(t);e&&e.collapsed&&e.items[0]!==t||(c+="children"===n?1:-1);break}}}return d},Lc=(0,Fi.memo)((({data:e,focusedItem:t,totalTicks:n,sandwichedLabel:i,onFocusPillClick:a,onSandwichPillClick:s})=>{const l=(0,o.useStyles2)(Mc),c=[],u=(0,r.getValueFormat)("short")(n),d=e.valueDisplayProcessor(n);let p=d.text+d.suffix;const h=e.getUnitTitle();if("Count"===h&&(d.suffix||(p=d.text)),c.push((0,Bi.jsxs)("div",{className:l.metadataPill,children:[p," | ",u.text,u.suffix," samples (",h,")"]},"default")),i&&c.push((0,Bi.jsx)(o.Tooltip,{content:i,placement:"top",children:(0,Bi.jsxs)("div",{children:[(0,Bi.jsx)(o.Icon,{size:"sm",name:"angle-right"}),(0,Bi.jsxs)("div",{className:l.metadataPill,children:[(0,Bi.jsx)(o.Icon,{size:"sm",name:"gf-show-context"})," ",(0,Bi.jsx)("span",{className:l.metadataPillName,children:i.substring(i.lastIndexOf("/")+1)}),(0,Bi.jsx)(o.IconButton,{className:l.pillCloseButton,name:"times",size:"sm",onClick:s,tooltip:"Remove sandwich view","aria-label":"Remove sandwich view"})]})]})},"sandwich")),t){const e=n>0?Math.round(t.item.value/n*1e4)/100:0,r=e>0?"eye":"exclamation-circle";c.push((0,Bi.jsx)(o.Tooltip,{content:t.label,placement:"top",children:(0,Bi.jsxs)("div",{children:[(0,Bi.jsx)(o.Icon,{size:"sm",name:"angle-right"}),(0,Bi.jsxs)("div",{className:l.metadataPill,children:[(0,Bi.jsx)(o.Icon,{size:"sm",name:r})," ",e,"% of total",(0,Bi.jsx)(o.IconButton,{className:l.pillCloseButton,name:"times",size:"sm",onClick:a,tooltip:"Remove focus","aria-label":"Remove focus"})]})]})},"focus"))}return(0,Bi.jsx)("div",{className:l.metadata,children:c})}));Lc.displayName="FlameGraphMetadata";const Mc=e=>({metadataPill:(0,i.css)({label:"metadataPill",display:"inline-flex",alignItems:"center",background:e.colors.background.secondary,borderRadius:e.shape.borderRadius(8),padding:e.spacing(.5,1),fontSize:e.typography.bodySmall.fontSize,fontWeight:e.typography.fontWeightMedium,lineHeight:e.typography.bodySmall.lineHeight,color:e.colors.text.secondary}),pillCloseButton:(0,i.css)({label:"pillCloseButton",verticalAlign:"text-bottom",margin:e.spacing(0,.5)}),metadata:(0,i.css)({display:"flex",alignItems:"center",justifyContent:"center",margin:"8px 0"}),metadataPillName:(0,i.css)({label:"metadataPillName",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginLeft:e.spacing(.5)})}),Fc=({data:e,rangeMin:t,rangeMax:n,matchedLabels:r,setRangeMin:a,setRangeMax:s,onItemFocused:l,focusedItemData:c,textAlign:u,onSandwich:d,sandwichItem:p,onFocusPillClick:h,onSandwichPillClick:f,colorScheme:m,showFlameGraphOnly:g,getExtraContextMenuButtons:y,collapsing:b,selectedView:v,search:w,collapsedMap:S,setCollapsedMap:E})=>{const x=$c(),[O,_]=(0,Fi.useState)(),[T,C]=(0,Fi.useState)(),[k,P]=(0,Fi.useState)(0),[A,R]=(0,Fi.useState)(),[D,j]=(0,Fi.useState)(0);if((0,Fi.useEffect)((()=>{var t,n,r;if(e){let i,a=e.getLevels(),o=a.length?a[0][0].value:0,s=a.length?a[0][0].valueRight:void 0,l=o;if(p){const[o,s]=e.getSandwichLevels(p);a=s,i=o,l=null!=(r=null==(n=null==(t=s[0])?void 0:t[0])?void 0:n.value)?r:0}_(a),C(i),P(o),R(s),j(l)}}),[e,p]),!O)return null;const I={data:e,rangeMin:t,rangeMax:n,matchedLabels:r,setRangeMin:a,setRangeMax:s,onItemFocused:l,focusedItemData:c,textAlign:u,onSandwich:d,colorScheme:m,totalProfileTicks:k,totalProfileTicksRight:A,totalViewTicks:D,showFlameGraphOnly:g,collapsedMap:S,setCollapsedMap:E,getExtraContextMenuButtons:y,collapsing:b,search:w,selectedView:v};let N=null;return(null==T?void 0:T.length)?N=(0,Bi.jsxs)(Bi.Fragment,{children:[(0,Bi.jsxs)("div",{className:x.sandwichCanvasWrapper,children:[(0,Bi.jsxs)("div",{className:x.sandwichMarker,children:["Callers",(0,Bi.jsx)(o.Icon,{className:x.sandwichMarkerIcon,name:"arrow-down"})]}),(0,Bi.jsx)(jc,{...I,root:T[T.length-1][0],depth:T.length,direction:"parents",collapsing:!1})]}),(0,Bi.jsxs)("div",{className:x.sandwichCanvasWrapper,children:[(0,Bi.jsxs)("div",{className:(0,i.cx)(x.sandwichMarker,x.sandwichMarkerCalees),children:[(0,Bi.jsx)(o.Icon,{className:x.sandwichMarkerIcon,name:"arrow-up"}),"Callees"]}),(0,Bi.jsx)(jc,{...I,root:O[0][0],depth:O.length,direction:"children",collapsing:!1})]})]}):(null==O?void 0:O.length)&&(N=(0,Bi.jsx)(jc,{...I,root:O[0][0],depth:O.length,direction:"children"})),(0,Bi.jsxs)("div",{className:x.graph,children:[(0,Bi.jsx)(Lc,{data:e,focusedItem:c,sandwichedLabel:p,totalTicks:D,onFocusPillClick:h,onSandwichPillClick:f}),N]})},$c=()=>({graph:(0,i.css)({label:"graph",overflow:"auto",flexGrow:1,flexBasis:"50%"}),sandwichCanvasWrapper:(0,i.css)({label:"sandwichCanvasWrapper",display:"flex",marginBottom:yl/window.devicePixelRatio+"px"}),sandwichMarker:(0,i.css)({label:"sandwichMarker",writingMode:"vertical-lr",transform:"rotate(180deg)",overflow:"hidden",whiteSpace:"nowrap"}),sandwichMarkerCalees:(0,i.css)({label:"sandwichMarkerCalees",textAlign:"right"}),sandwichMarkerIcon:(0,i.css)({label:"sandwichMarkerIcon",verticalAlign:"baseline"})});var Bc=__webpack_require__(3241);function Vc(e,t,n="children"){var r;const i="parents"===n?"children":"parents",a=[],o=[{previous:void 0,items:e,level:0}];for(;o.length;){const e=o.shift(),s=e.items.flatMap((e=>e.itemIndexes)),l={value:e.items.reduce(((e,t)=>e+t.value),0),itemIndexes:s,children:[],parents:[],start:0,level:e.level};if(a[e.level]=a[e.level]||[],a[e.level].push(l),e.previous){l[i]=[e.previous];const t=(null==(r=e.previous[n])?void 0:r.reduce(((e,t)=>e+t.value),0))||0;l.start=e.previous.start+t,e.previous[n].push(l)}const c=e.items.flatMap((e=>e[n]||[])),u=(0,Bc.groupBy)(c,(e=>t.getLabel(e.itemIndexes[0])));for(const t of Object.values(u))o.push({previous:l,items:t,level:e.level+1})}return"parents"===n&&(a.reverse(),a.forEach(((e,t)=>{e.forEach((e=>{e.level=t}))}))),a}class Uc{constructor(e){this.map=new Map,this.map=e||new Map}get(e){return this.map.get(e)}keys(){return this.map.keys()}values(){return this.map.values()}size(){return this.map.size}setCollapsedStatus(e,t){const n=new Map(this.map),r=this.map.get(e),i={...r,collapsed:t};for(const e of r.items)n.set(e,i);return new Uc(n)}setAllCollapsedStatus(e){const t=new Map(this.map);for(const n of this.map.keys()){const r={...this.map.get(n),collapsed:e};t.set(n,r)}return new Uc(t)}}class zc{constructor(e){this.map=new Map,this.threshold=.99,void 0!==e&&(this.threshold=e)}addTree(e){var t;const n=[e];for(;n.length;){const e=n.shift();(null==(t=e.parents)?void 0:t.length)&&this.addItem(e,e.parents[0]),e.children.length&&n.unshift(...e.children)}}addItem(e,t){if(t&&e.value>t.value*this.threshold&&1===t.children.length)if(this.map.has(t)){const n=this.map.get(t);this.map.set(e,n),n.items.push(e)}else{const n={items:[t,e],collapsed:!0};this.map.set(t,n),this.map.set(e,n)}}getCollapsedMap(){return new Uc(this.map)}}class qc{constructor(e,t,n=(0,r.createTheme)()){var i,a,o;this.data=e,this.options=t;const s=function(e){const t=[["label",[r.FieldType.string,r.FieldType.enum]],["level",[r.FieldType.number]],["value",[r.FieldType.number]],["self",[r.FieldType.number]]],n=[],i=[];for(const r of t){const[t,a]=r,o=null==e?void 0:e.fields.find((e=>e.name===t));o?a.includes(o.type)||i.push({name:t,expectedTypes:a,type:o.type}):n.push(t)}if(n.length>0||i.length>0)return{wrongTypeFields:i,missingFields:n}}(e);if(s)throw new Error(function(e){return e.missingFields.length?`Data is missing fields: ${e.missingFields.join(", ")}`:e.wrongTypeFields.length?`Data has fields of wrong type: ${e.wrongTypeFields.map((e=>`${e.name} has type ${e.type} but should be ${e.expectedTypes.join(" or ")}`)).join(", ")}`:""}(s));if(this.labelField=e.fields.find((e=>"label"===e.name)),this.levelField=e.fields.find((e=>"level"===e.name)),this.valueField=e.fields.find((e=>"value"===e.name)),this.selfField=e.fields.find((e=>"self"===e.name)),this.valueRightField=e.fields.find((e=>"valueRight"===e.name)),this.selfRightField=e.fields.find((e=>"selfRight"===e.name)),(this.valueField||this.selfField)&&(!this.valueField||!this.selfField))throw new Error("Malformed dataFrame: both valueRight and selfRight has to be present if one of them is present.");const l=null==(o=null==(a=null==(i=this.labelField)?void 0:i.config)?void 0:a.type)?void 0:o.enum;l?(this.labelDisplayProcessor=(0,r.getDisplayProcessor)({field:this.labelField,theme:n}),this.uniqueLabels=l.text||[]):(this.labelDisplayProcessor=e=>({text:e+"",numeric:0}),this.uniqueLabels=[...new Set(this.labelField.values)]),this.valueDisplayProcessor=(0,r.getDisplayProcessor)({field:this.valueField,theme:n})}isDiffFlamegraph(){return Boolean(this.valueRightField&&this.selfRightField)}getLabel(e){return this.labelDisplayProcessor(this.labelField.values[e]).text}getLevel(e){return this.levelField.values[e]}getValue(e){return Hc(this.valueField,e)}getValueRight(e){return Hc(this.valueRightField,e)}getSelf(e){return Hc(this.selfField,e)}getSelfRight(e){return Hc(this.selfRightField,e)}getSelfDisplay(e){return this.valueDisplayProcessor(this.getSelf(e))}getUniqueLabels(){return this.uniqueLabels}getUnitTitle(){switch(this.valueField.config.unit){case mc.Bytes:return"RAM";case mc.Nanoseconds:return"Time"}return"Count"}getLevels(){return this.initLevels(),this.levels}getSandwichLevels(e){const t=this.getNodesWithLabel(e);if(!(null==t?void 0:t.length))return[[],[]];const n=function(e,t){const n=function(e){return e.map((e=>{var t,n;if(!(null==(t=e.parents)?void 0:t.length))return e;const r={...e,children:[]},i=[{child:r,parent:e.parents[0]}];for(;i.length;){const e=i.shift(),t={...e.parent,children:e.child?[e.child]:[],parents:[]};e.child&&(t.value=e.child.value,e.child.parents=[t]),(null==(n=e.parent.parents)?void 0:n.length)&&i.push({child:t,parent:e.parent.parents[0]})}return r}))}(e);return Vc(n,t,"parents")}(t,this);return[n,Vc(t,this)]}getNodesWithLabel(e){return this.initLevels(),this.uniqueLabelsMap[e]}getCollapsedMap(){return this.initLevels(),this.collapsedMap}initLevels(){if(!this.levels){const[e,t,n]=function(e,t){const n=[];let r,i=0;const a={};for(let t=0;t<e.data.length;t++){const o=e.getLevel(t),s=t>0?e.getLevel(t-1):void 0;if(n[o]=n[o]||[],s&&s>=o){const t=n[o][n[o].length-1];i=t.start+e.getValue(t.itemIndexes[0])+e.getValueRight(t.itemIndexes[0]),r=t.parents[0]}const l={itemIndexes:[t],value:e.getValue(t)+e.getValueRight(t),valueRight:e.isDiffFlamegraph()?e.getValueRight(t):void 0,start:i,parents:r&&[r],children:[],level:o};a[e.getLabel(t)]?a[e.getLabel(t)].push(l):a[e.getLabel(t)]=[l],r&&r.children.push(l),r=l,n[o].push(l)}const o=new zc(null==t?void 0:t.collapsingThreshold);return(null==t?void 0:t.collapsing)&&o.addTree(n[0][0]),[n,a,o.getCollapsedMap()]}(this,this.options);this.levels=e,this.uniqueLabelsMap=t,this.collapsedMap=n}}}function Hc(e,t){if(!e)return 0;return("number"==typeof t?[t]:t).reduce(((t,n)=>t+e.values[n]),0)}var Gc=__webpack_require__(4386),Wc=__webpack_require__(1336);const Qc=({search:e,setSearch:t,selectedView:n,setSelectedView:r,containerWidth:a,onReset:s,textAlign:l,onTextAlignChange:c,showResetButton:u,colorScheme:d,onColorSchemeChange:p,stickyHeader:h,extraHeaderElements:f,vertical:m,isDiffMode:g,setCollapsedMap:y,collapsedMap:b})=>{const v=(0,o.useStyles2)(Jc),[w,S]=function(e,t){const[n,r]=(0,Fi.useState)(e),i=(0,Wc.A)(e);return(0,Gc.A)((()=>{t(n)}),250,[n]),(0,Fi.useEffect)((()=>{i!==e&&e!==n&&r(e)}),[e,i,n]),[n,r]}(e,t),E=""!==w?(0,Bi.jsx)(o.Button,{icon:"times",fill:"text",size:"sm",onClick:()=>{t(""),S("")},children:"Clear"}):null;return(0,Bi.jsxs)("div",{className:(0,i.cx)(v.header,{[v.stickyHeader]:h}),children:[(0,Bi.jsx)("div",{className:v.inputContainer,children:(0,Bi.jsx)(o.Input,{value:w||"",onChange:e=>{S(e.currentTarget.value)},placeholder:"Search...",suffix:E})}),(0,Bi.jsxs)("div",{className:v.rightContainer,children:[u&&(0,Bi.jsx)(o.Button,{variant:"secondary",fill:"outline",size:"sm",icon:"history-alt",tooltip:"Reset focus and sandwich state",onClick:()=>{s()},className:v.buttonSpacing,"aria-label":"Reset focus and sandwich state"}),(0,Bi.jsx)(Kc,{value:d,onChange:p,isDiffMode:g}),(0,Bi.jsxs)(o.ButtonGroup,{className:v.buttonSpacing,children:[(0,Bi.jsx)(o.Button,{variant:"secondary",fill:"outline",size:"sm",tooltip:"Expand all groups",onClick:()=>{y(b.setAllCollapsedStatus(!1))},"aria-label":"Expand all groups",icon:"angle-double-down",disabled:n===gc.TopTable}),(0,Bi.jsx)(o.Button,{variant:"secondary",fill:"outline",size:"sm",tooltip:"Collapse all groups",onClick:()=>{y(b.setAllCollapsedStatus(!0))},"aria-label":"Collapse all groups",icon:"angle-double-up",disabled:n===gc.TopTable})]}),(0,Bi.jsx)(o.RadioButtonGroup,{size:"sm",disabled:n===gc.TopTable,options:Yc,value:l,onChange:c,className:v.buttonSpacing}),(0,Bi.jsx)(o.RadioButtonGroup,{size:"sm",options:Xc(a,m),value:n,onChange:r}),f&&(0,Bi.jsx)("div",{className:v.extraElements,children:f})]})]})};function Kc(e){const t=(0,o.useStyles2)(Jc);let n=(0,Bi.jsxs)(o.Menu,{children:[(0,Bi.jsx)(o.Menu.Item,{label:"By package name",onClick:()=>e.onChange(yc.PackageBased)}),(0,Bi.jsx)(o.Menu.Item,{label:"By value",onClick:()=>e.onChange(yc.ValueBased)})]});const r={[yc.ValueBased]:t.colorDotByValue,[yc.PackageBased]:t.colorDotByPackage,[bc.DiffColorBlind]:t.colorDotDiffColorBlind,[bc.Default]:t.colorDotDiffDefault}[e.value]||t.colorDotByValue;let a=(0,Bi.jsx)("span",{className:(0,i.cx)(t.colorDot,r)});return e.isDiffMode&&(n=(0,Bi.jsxs)(o.Menu,{children:[(0,Bi.jsx)(o.Menu.Item,{label:"Default (green to red)",onClick:()=>e.onChange(bc.Default)}),(0,Bi.jsx)(o.Menu.Item,{label:"Color blind (blue to red)",onClick:()=>e.onChange(bc.DiffColorBlind)})]}),a=(0,Bi.jsxs)("div",{className:(0,i.cx)(t.colorDotDiff,r),children:[(0,Bi.jsx)("div",{children:"-100% (removed)"}),(0,Bi.jsx)("div",{children:"0%"}),(0,Bi.jsx)("div",{children:"+100% (added)"})]})),(0,Bi.jsx)(o.Dropdown,{overlay:n,children:(0,Bi.jsx)(o.Button,{variant:"secondary",fill:"outline",size:"sm",tooltip:"Change color scheme",onClick:()=>{},className:t.buttonSpacing,"aria-label":"Change color scheme",children:a})})}const Yc=[{value:"left",description:"Align text left",icon:"align-left"},{value:"right",description:"Align text right",icon:"align-right"}];function Xc(e,t){let n=[{value:gc.TopTable,label:"Top Table",description:"Only show top table"},{value:gc.FlameGraph,label:"Flame Graph",description:"Only show flame graph"}];return(e>=800||t)&&n.push({value:gc.Both,label:"Both",description:"Show both the top table and flame graph"}),n}const Jc=e=>({header:(0,i.css)({label:"header",display:"flex",flexWrap:"wrap",justifyContent:"space-between",width:"100%",top:0,gap:e.spacing(1),marginTop:e.spacing(1)}),stickyHeader:(0,i.css)({zIndex:e.zIndex.navbarFixed,position:"sticky",background:e.colors.background.primary}),inputContainer:(0,i.css)({label:"inputContainer",flexGrow:1,minWidth:"150px",maxWidth:"350px"}),rightContainer:(0,i.css)({label:"rightContainer",display:"flex",alignItems:"flex-start",flexWrap:"wrap"}),buttonSpacing:(0,i.css)({label:"buttonSpacing",marginRight:e.spacing(1)}),resetButton:(0,i.css)({label:"resetButton",display:"flex",marginRight:e.spacing(2)}),resetButtonIconWrapper:(0,i.css)({label:"resetButtonIcon",padding:"0 5px",color:e.colors.text.disabled}),colorDot:(0,i.css)({label:"colorDot",display:"inline-block",width:"10px",height:"10px",borderRadius:"50%"}),colorDotDiff:(0,i.css)({label:"colorDotDiff",display:"flex",width:"200px",height:"12px",color:"white",fontSize:9,lineHeight:1.3,fontWeight:300,justifyContent:"space-between",padding:"0 2px",borderRadius:"2px"}),colorDotByValue:(0,i.css)({label:"colorDotByValue",background:Sc}),colorDotByPackage:(0,i.css)({label:"colorDotByPackage",background:Ec}),colorDotDiffDefault:(0,i.css)({label:"colorDotDiffDefault",background:Tc}),colorDotDiffColorBlind:(0,i.css)({label:"colorDotDiffColorBlind",background:kc}),extraElements:(0,i.css)({label:"extraElements",marginLeft:e.spacing(1)})});let Zc;Zc="undefined"!=typeof window?window:"undefined"!=typeof self?self:__webpack_require__.g;let eu=null,tu=null;const nu=Zc.clearTimeout,ru=Zc.setTimeout,iu=Zc.cancelAnimationFrame||Zc.mozCancelAnimationFrame||Zc.webkitCancelAnimationFrame,au=Zc.requestAnimationFrame||Zc.mozRequestAnimationFrame||Zc.webkitRequestAnimationFrame;function ou(e){let t,n,r,i,a,o,s;const l="undefined"!=typeof document&&document.attachEvent;if(!l){o=function(e){const t=e.__resizeTriggers__,n=t.firstElementChild,r=t.lastElementChild,i=n.firstElementChild;r.scrollLeft=r.scrollWidth,r.scrollTop=r.scrollHeight,i.style.width=n.offsetWidth+1+"px",i.style.height=n.offsetHeight+1+"px",n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight},a=function(e){return e.offsetWidth!==e.__resizeLast__.width||e.offsetHeight!==e.__resizeLast__.height},s=function(e){if(e.target.className&&"function"==typeof e.target.className.indexOf&&e.target.className.indexOf("contract-trigger")<0&&e.target.className.indexOf("expand-trigger")<0)return;const t=this;o(this),this.__resizeRAF__&&eu(this.__resizeRAF__),this.__resizeRAF__=tu((function(){a(t)&&(t.__resizeLast__.width=t.offsetWidth,t.__resizeLast__.height=t.offsetHeight,t.__resizeListeners__.forEach((function(n){n.call(t,e)})))}))};let e=!1,l="";r="animationstart";const c="Webkit Moz O ms".split(" ");let u="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),d="";{const t=document.createElement("fakeelement");if(void 0!==t.style.animationName&&(e=!0),!1===e)for(let n=0;n<c.length;n++)if(void 0!==t.style[c[n]+"AnimationName"]){d=c[n],l="-"+d.toLowerCase()+"-",r=u[n],e=!0;break}}n="resizeanim",t="@"+l+"keyframes "+n+" { from { opacity: 0; } to { opacity: 0; } } ",i=l+"animation: 1ms "+n+"; "}return{addResizeListener:function(a,c){if(l)a.attachEvent("onresize",c);else{if(!a.__resizeTriggers__){const l=a.ownerDocument,c=Zc.getComputedStyle(a);c&&"static"===c.position&&(a.style.position="relative"),function(n){if(!n.getElementById("detectElementResize")){const r=(t||"")+".resize-triggers { "+(i||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',a=n.head||n.getElementsByTagName("head")[0],o=n.createElement("style");o.id="detectElementResize",o.type="text/css",null!=e&&o.setAttribute("nonce",e),o.styleSheet?o.styleSheet.cssText=r:o.appendChild(n.createTextNode(r)),a.appendChild(o)}}(l),a.__resizeLast__={},a.__resizeListeners__=[],(a.__resizeTriggers__=l.createElement("div")).className="resize-triggers";const u=l.createElement("div");u.className="expand-trigger",u.appendChild(l.createElement("div"));const d=l.createElement("div");d.className="contract-trigger",a.__resizeTriggers__.appendChild(u),a.__resizeTriggers__.appendChild(d),a.appendChild(a.__resizeTriggers__),o(a),a.addEventListener("scroll",s,!0),r&&(a.__resizeTriggers__.__animationListener__=function(e){e.animationName===n&&o(a)},a.__resizeTriggers__.addEventListener(r,a.__resizeTriggers__.__animationListener__))}a.__resizeListeners__.push(c)}},removeResizeListener:function(e,t){if(l)e.detachEvent("onresize",t);else if(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),!e.__resizeListeners__.length){e.removeEventListener("scroll",s,!0),e.__resizeTriggers__.__animationListener__&&(e.__resizeTriggers__.removeEventListener(r,e.__resizeTriggers__.__animationListener__),e.__resizeTriggers__.__animationListener__=null);try{e.__resizeTriggers__=!e.removeChild(e.__resizeTriggers__)}catch(e){}}}}}null==iu||null==au?(eu=nu,tu=function(e){return ru(e,20)}):(eu=function([e,t]){iu(e),nu(t)},tu=function(e){const t=au((function(){nu(n),e()})),n=ru((function(){iu(t),e()}),20);return[t,n]});class su extends Fi.Component{constructor(...e){super(...e),this.state={height:this.props.defaultHeight||0,scaledHeight:this.props.defaultHeight||0,scaledWidth:this.props.defaultWidth||0,width:this.props.defaultWidth||0},this._autoSizer=null,this._detectElementResize=null,this._parentNode=null,this._resizeObserver=null,this._timeoutId=null,this._onResize=()=>{this._timeoutId=null;const{disableHeight:e,disableWidth:t,onResize:n}=this.props;if(this._parentNode){const r=window.getComputedStyle(this._parentNode)||{},i=parseFloat(r.paddingLeft||"0"),a=parseFloat(r.paddingRight||"0"),o=parseFloat(r.paddingTop||"0"),s=parseFloat(r.paddingBottom||"0"),l=this._parentNode.getBoundingClientRect(),c=l.height-o-s,u=l.width-i-a,d=this._parentNode.offsetHeight-o-s,p=this._parentNode.offsetWidth-i-a;(e||this.state.height===d&&this.state.scaledHeight===c)&&(t||this.state.width===p&&this.state.scaledWidth===u)||(this.setState({height:d,width:p,scaledHeight:c,scaledWidth:u}),"function"==typeof n&&n({height:d,scaledHeight:c,scaledWidth:u,width:p}))}},this._setRef=e=>{this._autoSizer=e}}componentDidMount(){const{nonce:e}=this.props,t=this._autoSizer?this._autoSizer.parentNode:null;if(null!=t&&t.ownerDocument&&t.ownerDocument.defaultView&&t instanceof t.ownerDocument.defaultView.HTMLElement){this._parentNode=t;const n=t.ownerDocument.defaultView.ResizeObserver;null!=n?(this._resizeObserver=new n((()=>{this._timeoutId=setTimeout(this._onResize,0)})),this._resizeObserver.observe(t)):(this._detectElementResize=ou(e),this._detectElementResize.addResizeListener(t,this._onResize)),this._onResize()}}componentWillUnmount(){this._parentNode&&(this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize),null!==this._timeoutId&&clearTimeout(this._timeoutId),this._resizeObserver&&this._resizeObserver.disconnect())}render(){const{children:e,defaultHeight:t,defaultWidth:n,disableHeight:r=!1,disableWidth:i=!1,doNotBailOutOnEmptyChildren:a=!1,nonce:o,onResize:s,style:l={},tagName:c="div",...u}=this.props,{height:d,scaledHeight:p,scaledWidth:h,width:f}=this.state,m={overflow:"visible"},g={};let y=!1;return r||(0===d&&(y=!0),m.height=0,g.height=d,g.scaledHeight=p),i||(0===f&&(y=!0),m.width=0,g.width=f,g.scaledWidth=h),a&&(y=!1),(0,Fi.createElement)(c,{ref:this._setRef,style:{...m,...l},...u},!y&&e(g))}}const lu=(0,Fi.memo)((({data:e,onSymbolClick:t,search:n,matchedLabels:i,onSearch:a,sandwichItem:s,onSandwich:l,onTableSort:c,colorScheme:u})=>{const d=(0,Fi.useMemo)((()=>{let t={};for(let n=0;n<e.data.length;n++){const r=e.getValue(n),a=e.getValueRight(n),o=e.getSelf(n),s=e.getLabel(n);i&&!i.has(s)||(t[s]=t[s]||{},t[s].self=t[s].self?t[s].self+o:o,t[s].total=t[s].total?t[s].total+r:r,t[s].totalRight=t[s].totalRight?t[s].totalRight+a:a)}return t}),[e,i]),p=(0,o.useStyles2)(pu),h=(0,o.useTheme2)(),[f,m]=(0,Fi.useState)([{displayName:"Self",desc:!0}]);return(0,Bi.jsx)("div",{className:p.topTableContainer,"data-testid":"topTable",children:(0,Bi.jsx)(su,{style:{width:"100%"},children:({width:i,height:p})=>{if(i<3||p<3)return null;const g=function(e,t,n,i,a,s,l,c,u,d){const p=function(e,t,n,i){const a={type:o.TableCellDisplayMode.Custom,cellComponent:r=>(0,Bi.jsx)(du,{frame:r.frame,onSandwich:e,onSearch:t,search:n,sandwichItem:i,rowIndex:r.rowIndex})},s={filterable:!1,width:uu,hideHeader:!0,inspect:!1,align:"auto",cellOptions:a};return{type:r.FieldType.number,name:"actions",values:[],config:{custom:s}}}(s,a,u,d),h={type:r.FieldType.string,name:"Symbol",values:[],config:{custom:{width:n-uu-2*Cl},links:[{title:"Highlight symbol",url:"",onClick:e=>{const t=e.origin.field.values[e.origin.rowIndex];i(t)}}]}};let f;if(e.isDiffFlamegraph()){h.config.custom.width=n-uu-3*Cl;const i=cu("Baseline","percent"),a=cu("Comparison","percent"),s=cu("Diff","percent");s.config.custom.cellOptions.type=o.TableCellDisplayMode.ColorText;const[l,u]=c===bc.DiffColorBlind?[Cc[0],Cc[2]]:[_c[0],_c[2]];s.config.mappings=[{type:r.MappingType.ValueToText,options:{[1/0]:{text:"new",color:u}}},{type:r.MappingType.ValueToText,options:{[-100]:{text:"removed",color:l}}},{type:r.MappingType.RangeToText,options:{from:0,to:1/0,result:{color:u}}},{type:r.MappingType.RangeToText,options:{from:-1/0,to:0,result:{color:l}}}];const d=e.getLevels(),m=d.length?d[0][0].value:0,g=d.length?d[0][0].valueRight:void 0;for(let e in t){p.values.push(null),h.values.push(e);const n=t[e].total,r=t[e].totalRight,o=m-g,l=Math.round(1e4*n/o)/100,c=Math.round(1e4*r/g)/100,u=(c-l)/l*100;s.values.push(u),i.values.push(l),a.values.push(c)}f={fields:[p,h,i,a,s],length:h.values.length}}else{const n=cu("Self",e.selfField.config.unit),r=cu("Total",e.valueField.config.unit);for(let e in t)p.values.push(null),h.values.push(e),n.values.push(t[e].self),r.values.push(t[e].total);f={fields:[p,h,n,r],length:h.values.length}}const m=(0,r.applyFieldOverrides)({data:[f],fieldConfig:{defaults:{},overrides:[]},replaceVariables:e=>e,theme:l});return m[0]}(e,d,i,t,a,l,h,u,n,s);return(0,Bi.jsx)(o.Table,{initialSortBy:f,onSortByChange:e=>{e&&e.length&&(null==c||c(e[0].displayName+"_"+(e[0].desc?"desc":"asc"))),m(e)},data:g,width:i,height:p})}})})}));function cu(e,t){const n={width:Cl,align:"auto",inspect:!1,cellOptions:{type:o.TableCellDisplayMode.Auto}};return{type:r.FieldType.number,name:e,values:[],config:{unit:t,custom:n}}}lu.displayName="FlameGraphTopTableContainer";const uu=61;function du(e){var t;const n=hu(),r=null==(t=e.frame.fields.find((e=>"Symbol"===e.name)))?void 0:t.values[e.rowIndex],i=e.search===r,a=e.sandwichItem===r;return(0,Bi.jsxs)("div",{className:n.actionCellWrapper,children:[(0,Bi.jsx)(o.IconButton,{className:n.actionCellButton,name:"search",variant:i?"primary":"secondary",tooltip:i?"Clear from search":"Search for symbol","aria-label":i?"Clear from search":"Search for symbol",onClick:()=>{e.onSearch(i?"":r)}}),(0,Bi.jsx)(o.IconButton,{className:n.actionCellButton,name:"gf-show-context",tooltip:a?"Remove from sandwich view":"Show in sandwich view",variant:a?"primary":"secondary","aria-label":a?"Remove from sandwich view":"Show in sandwich view",onClick:()=>{e.onSandwich(a?void 0:r)}})]})}const pu=e=>({topTableContainer:(0,i.css)({label:"topTableContainer",padding:e.spacing(1),backgroundColor:e.colors.background.secondary,height:"100%"})}),hu=()=>({actionCellWrapper:(0,i.css)({label:"actionCellWrapper",display:"flex",height:"24px"}),actionCellButton:(0,i.css)({label:"actionCellButton",marginRight:0,width:"24px"})}),fu=new sl,mu=({data:e,onTableSymbolClick:t,onViewSelected:n,onTextAlignSelected:r,onTableSort:a,getTheme:s,stickyHeader:l,extraHeaderElements:c,vertical:u,showFlameGraphOnly:d,disableCollapsing:p,keepFocusOnDataChange:h,getExtraContextMenuButtons:f})=>{const[m,g]=(0,Fi.useState)(),[y,b]=(0,Fi.useState)(0),[v,w]=(0,Fi.useState)(1),[S,E]=(0,Fi.useState)(""),[x,O]=(0,Fi.useState)(gc.Both),[_,{width:T}]=gl(),[C,k]=(0,Fi.useState)("left"),[P,A]=(0,Fi.useState)(),[R,D]=(0,Fi.useState)(new Uc),j=(0,Fi.useMemo)((()=>s()),[s]),I=(0,Fi.useMemo)((()=>{if(!e)return;const t=new qc(e,{collapsing:!p},j);return D(t.getCollapsedMap()),t}),[e,j,p]),[N,L]=function(e){const t=(null==e?void 0:e.isDiffFlamegraph())?bc.Default:yc.PackageBased,[n,r]=(0,Fi.useState)(t);return(0,Fi.useEffect)((()=>{r(t)}),[t]),[n,r]}(I),M=function(e){return{container:(0,i.css)({label:"container",overflow:"auto",height:"100%",display:"flex",flex:"1 1 0",flexDirection:"column",minHeight:0,gap:e.spacing(1)}),body:(0,i.css)({label:"body",flexGrow:1}),tableContainer:(0,i.css)({height:800}),horizontalContainer:(0,i.css)({label:"horizontalContainer",display:"flex",minHeight:0,flexDirection:"row",columnGap:e.spacing(1),width:"100%"}),horizontalGraphContainer:(0,i.css)({flexBasis:"50%"}),horizontalTableContainer:(0,i.css)({flexBasis:"50%",maxHeight:800}),verticalGraphContainer:(0,i.css)({marginBottom:e.spacing(1)}),verticalTableContainer:(0,i.css)({height:800})}}(j),F=function(e,t){return(0,Fi.useMemo)((()=>{if(e&&t){const n=new Set;let r=fu.filter(t.getUniqueLabels(),e);if(r)for(let e of r)n.add(t.getUniqueLabels()[e]);return n}}),[e,t])}(S,I);(0,Fi.useEffect)((()=>{T>0&&T<800&&x===gc.Both&&!u&&O(gc.FlameGraph)}),[x,O,T,u]);const $=(0,Fi.useCallback)((()=>{g(void 0),b(0),w(1)}),[g,w,b]),B=(0,Fi.useCallback)((()=>{A(void 0)}),[A]);(0,Fi.useEffect)((()=>{var e;if(!h)return $(),void B();if(I&&m){const t=null==(e=I.getNodesWithLabel(m.label))?void 0:e[0];if(t){g({...m,item:t});const e=I.getLevels(),n=e.length?e[0][0].value:0;b(t.start/n),w((t.start+t.value)/n)}else g({...m,item:{start:0,value:0,itemIndexes:[],children:[],level:0}}),b(0),w(1)}}),[I,h]);const V=(0,Fi.useCallback)((e=>{S===e?E(""):(null==t||t(e),E(e),$())}),[E,$,t,S]);if(!I)return null;const U=(0,Bi.jsx)(Fc,{data:I,rangeMin:y,rangeMax:v,matchedLabels:F,setRangeMin:b,setRangeMax:w,onItemFocused:e=>g(e),focusedItemData:m,textAlign:C,sandwichItem:P,onSandwich:e=>{$(),A(e)},onFocusPillClick:$,onSandwichPillClick:B,colorScheme:N,showFlameGraphOnly:d,collapsing:!p,getExtraContextMenuButtons:f,selectedView:x,search:S,collapsedMap:R,setCollapsedMap:D}),z=(0,Bi.jsx)(lu,{data:I,onSymbolClick:V,search:S,matchedLabels:F,sandwichItem:P,onSandwich:A,onSearch:E,onTableSort:a,colorScheme:N});let q;return d||x===gc.FlameGraph?q=U:x===gc.TopTable?q=(0,Bi.jsx)("div",{className:M.tableContainer,children:z}):x===gc.Both&&(q=u?(0,Bi.jsxs)("div",{children:[(0,Bi.jsx)("div",{className:M.verticalGraphContainer,children:U}),(0,Bi.jsx)("div",{className:M.verticalTableContainer,children:z})]}):(0,Bi.jsxs)("div",{className:M.horizontalContainer,children:[(0,Bi.jsx)("div",{className:M.horizontalTableContainer,children:z}),(0,Bi.jsx)("div",{className:M.horizontalGraphContainer,children:U})]})),(0,Bi.jsx)(o.ThemeContext.Provider,{value:j,children:(0,Bi.jsxs)("div",{ref:_,className:M.container,children:[!d&&(0,Bi.jsx)(Qc,{search:S,setSearch:E,selectedView:x,setSelectedView:e=>{O(e),null==n||n(e)},containerWidth:T,onReset:()=>{$(),B()},textAlign:C,onTextAlignChange:e=>{k(e),null==r||r(e)},showResetButton:Boolean(m||P),colorScheme:N,onColorSchemeChange:L,stickyHeader:Boolean(l),extraHeaderElements:c,vertical:u,isDiffMode:I.isDiffFlamegraph(),setCollapsedMap:D,collapsedMap:R}),(0,Bi.jsx)("div",{className:M.body,children:q})]})})};var gu={},yu=Uint8Array,bu=Uint16Array,vu=Int32Array,wu=new yu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Su=new yu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Eu=new yu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xu=function(e,t){for(var n=new bu(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new vu(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Ou=xu(wu,2),_u=Ou.b,Tu=Ou.r;_u[28]=258,Tu[258]=28;for(var Cu=xu(Su,0),ku=Cu.b,Pu=Cu.r,Au=new bu(32768),Ru=0;Ru<32768;++Ru){var Du=(43690&Ru)>>1|(21845&Ru)<<1;Du=(61680&(Du=(52428&Du)>>2|(13107&Du)<<2))>>4|(3855&Du)<<4,Au[Ru]=((65280&Du)>>8|(255&Du)<<8)>>1}var ju=function(e,t,n){for(var r=e.length,i=0,a=new bu(t);i<r;++i)e[i]&&++a[e[i]-1];var o,s=new bu(t);for(i=1;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new bu(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,p=d|(1<<u)-1;d<=p;++d)o[Au[d]>>l]=c}else for(o=new bu(r),i=0;i<r;++i)e[i]&&(o[i]=Au[s[e[i]-1]++]>>15-e[i]);return o},Iu=new yu(288);for(Ru=0;Ru<144;++Ru)Iu[Ru]=8;for(Ru=144;Ru<256;++Ru)Iu[Ru]=9;for(Ru=256;Ru<280;++Ru)Iu[Ru]=7;for(Ru=280;Ru<288;++Ru)Iu[Ru]=8;var Nu=new yu(32);for(Ru=0;Ru<32;++Ru)Nu[Ru]=5;var Lu=ju(Iu,9,0),Mu=ju(Iu,9,1),Fu=ju(Nu,5,0),$u=ju(Nu,5,1),Bu=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Vu=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},Uu=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},zu=function(e){return(e+7)/8|0},qu=function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new yu(e.subarray(t,n))},Hu=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Gu=function(e,t,n){var r=new Error(t||Hu[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Gu),!n)throw r;return r},Wu=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new yu(0);var o=!n,s=o||2!=t.i,l=t.i;o&&(n=new yu(3*i));var c=function(e){var t=n.length;if(e>t){var r=new yu(Math.max(2*t,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,p=t.b||0,h=t.l,f=t.d,m=t.m,g=t.n,y=8*i;do{if(!h){u=Vu(e,d,1);var b=Vu(e,d+1,3);if(d+=3,!b){var v=e[(A=zu(d)+4)-4]|e[A-3]<<8,w=A+v;if(w>i){l&&Gu(0);break}s&&c(p+v),n.set(e.subarray(A,w),p),t.b=p+=v,t.p=d=8*w,t.f=u;continue}if(1==b)h=Mu,f=$u,m=9,g=5;else if(2==b){var S=Vu(e,d,31)+257,E=Vu(e,d+10,15)+4,x=S+Vu(e,d+5,31)+1;d+=14;for(var O=new yu(x),_=new yu(19),T=0;T<E;++T)_[Eu[T]]=Vu(e,d+3*T,7);d+=3*E;var C=Bu(_),k=(1<<C)-1,P=ju(_,C,1);for(T=0;T<x;){var A,R=P[Vu(e,d,k)];if(d+=15&R,(A=R>>4)<16)O[T++]=A;else{var D=0,j=0;for(16==A?(j=3+Vu(e,d,3),d+=2,D=O[T-1]):17==A?(j=3+Vu(e,d,7),d+=3):18==A&&(j=11+Vu(e,d,127),d+=7);j--;)O[T++]=D}}var I=O.subarray(0,S),N=O.subarray(S);m=Bu(I),g=Bu(N),h=ju(I,m,1),f=ju(N,g,1)}else Gu(1);if(d>y){l&&Gu(0);break}}s&&c(p+131072);for(var L=(1<<m)-1,M=(1<<g)-1,F=d;;F=d){var $=(D=h[Uu(e,d)&L])>>4;if((d+=15&D)>y){l&&Gu(0);break}if(D||Gu(2),$<256)n[p++]=$;else{if(256==$){F=d,h=null;break}var B=$-254;if($>264){var V=wu[T=$-257];B=Vu(e,d,(1<<V)-1)+_u[T],d+=V}var U=f[Uu(e,d)&M],z=U>>4;U||Gu(3),d+=15&U;N=ku[z];if(z>3){V=Su[z];N+=Uu(e,d)&(1<<V)-1,d+=V}if(d>y){l&&Gu(0);break}s&&c(p+131072);var q=p+B;if(p<N){var H=a-N,G=Math.min(N,q);for(H+p<0&&Gu(3);p<G;++p)n[p]=r[H+p]}for(;p<q;++p)n[p]=n[p-N]}}t.l=h,t.p=F,t.b=p,t.f=u,h&&(u=1,t.m=m,t.d=f,t.n=g)}while(!u);return p!=n.length&&o?qu(n,0,p):n.subarray(0,p)},Qu=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Ku=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Yu=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:rd,l:0};if(1==i){var o=new yu(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:s.f+l.f,l:s,r:l};u!=i-1;)s=n[n[c].f<n[d].f?c++:d++],l=n[c!=u&&n[c].f<n[d].f?c++:d++],n[u++]={s:-1,f:s.f+l.f,l:s,r:l};var p=a[0].s;for(r=1;r<i;++r)a[r].s>p&&(p=a[r].s);var h=new bu(p+1),f=Xu(n[u-1],h,0);if(f>t){r=0;var m=0,g=f-t,y=1<<g;for(a.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r<i;++r){var b=a[r].s;if(!(h[b]>t))break;m+=y-(1<<f-h[b]),h[b]=t}for(m>>=g;m>0;){var v=a[r].s;h[v]<t?m-=1<<t-h[v]++-1:++r}for(;r>=0&&m;--r){var w=a[r].s;h[w]==t&&(--h[w],++m)}f=t}return{t:new yu(h),l:f}},Xu=function(e,t,n){return-1==e.s?Math.max(Xu(e.l,t,n+1),Xu(e.r,t,n+1)):t[e.s]=n},Ju=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new bu(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Zu=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},ed=function(e,t,n){var r=n.length,i=zu(t+2);e[i]=255&r,e[i+1]=r>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},td=function(e,t,n,r,i,a,o,s,l,c,u){Qu(t,u++,n),++i[256];for(var d=Yu(i,15),p=d.t,h=d.l,f=Yu(a,15),m=f.t,g=f.l,y=Ju(p),b=y.c,v=y.n,w=Ju(m),S=w.c,E=w.n,x=new bu(19),O=0;O<b.length;++O)++x[31&b[O]];for(O=0;O<S.length;++O)++x[31&S[O]];for(var _=Yu(x,7),T=_.t,C=_.l,k=19;k>4&&!T[Eu[k-1]];--k);var P,A,R,D,j=c+5<<3,I=Zu(i,Iu)+Zu(a,Nu)+o,N=Zu(i,p)+Zu(a,m)+o+14+3*k+Zu(x,T)+2*x[16]+3*x[17]+7*x[18];if(l>=0&&j<=I&&j<=N)return ed(t,u,e.subarray(l,l+c));if(Qu(t,u,1+(N<I)),u+=2,N<I){P=ju(p,h,0),A=p,R=ju(m,g,0),D=m;var L=ju(T,C,0);Qu(t,u,v-257),Qu(t,u+5,E-1),Qu(t,u+10,k-4),u+=14;for(O=0;O<k;++O)Qu(t,u+3*O,T[Eu[O]]);u+=3*k;for(var M=[b,S],F=0;F<2;++F){var $=M[F];for(O=0;O<$.length;++O){var B=31&$[O];Qu(t,u,L[B]),u+=T[B],B>15&&(Qu(t,u,$[O]>>5&127),u+=$[O]>>12)}}}else P=Lu,A=Iu,R=Fu,D=Nu;for(O=0;O<s;++O){var V=r[O];if(V>255){Ku(t,u,P[(B=V>>18&31)+257]),u+=A[B+257],B>7&&(Qu(t,u,V>>23&31),u+=wu[B]);var U=31&V;Ku(t,u,R[U]),u+=D[U],U>3&&(Ku(t,u,V>>5&8191),u+=Su[U])}else Ku(t,u,P[V]),u+=A[V]}return Ku(t,u,P[256]),u+A[256]},nd=new vu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rd=new yu(0),id=function(e,t,n,r,i,a){var o=a.z||e.length,s=new yu(r+o+5*(1+Math.ceil(o/7e3))+i),l=s.subarray(r,s.length-i),c=a.l,u=7&(a.r||0);if(t){u&&(l[0]=a.r>>3);for(var d=nd[t-1],p=d>>13,h=8191&d,f=(1<<n)-1,m=a.p||new bu(32768),g=a.h||new bu(f+1),y=Math.ceil(n/3),b=2*y,v=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&f},w=new vu(25e3),S=new bu(288),E=new bu(32),x=0,O=0,_=a.i||0,T=0,C=a.w||0,k=0;_+2<o;++_){var P=v(_),A=32767&_,R=g[P];if(m[A]=R,g[P]=A,C<=_){var D=o-_;if((x>7e3||T>24576)&&(D>423||!c)){u=td(e,l,0,w,S,E,O,T,k,_-k,u),T=x=O=0,k=_;for(var j=0;j<286;++j)S[j]=0;for(j=0;j<30;++j)E[j]=0}var I=2,N=0,L=h,M=A-R&32767;if(D>2&&P==v(_-M))for(var F=Math.min(p,D)-1,$=Math.min(32767,_),B=Math.min(258,D);M<=$&&--L&&A!=R;){if(e[_+I]==e[_+I-M]){for(var V=0;V<B&&e[_+V]==e[_+V-M];++V);if(V>I){if(I=V,N=M,V>F)break;var U=Math.min(M,V-2),z=0;for(j=0;j<U;++j){var q=_-M+j&32767,H=q-m[q]&32767;H>z&&(z=H,R=q)}}}M+=(A=R)-(R=m[A])&32767}if(N){w[T++]=268435456|Tu[I]<<18|Pu[N];var G=31&Tu[I],W=31&Pu[N];O+=wu[G]+Su[W],++S[257+G],++E[W],C=_+I,++x}else w[T++]=e[_],++S[e[_]]}}for(_=Math.max(_,C);_<o;++_)w[T++]=e[_],++S[e[_]];u=td(e,l,c,w,S,E,O,T,k,_-k,u),c||(a.r=7&u|l[u/8|0]<<3,u-=7,a.h=g,a.p=m,a.i=_,a.w=C)}else{for(_=a.w||0;_<o+c;_+=65535){var Q=_+65535;Q>=o&&(l[u/8|0]=c,Q=o),u=ed(l,u+1,e.subarray(_,Q))}a.i=o}return qu(s,0,r+zu(u)+i)},ad=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),od=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ad[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},sd=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=0|n.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return(255&(e%=65521))<<24|(65280&e)<<8|(255&(t%=65521))<<8|t>>8}}},ld=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new yu(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return id(e,null==t.level?6:t.level,null==t.mem?i.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,n,r,i)},cd=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ud=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<r.length;++o){var s=r[o],l=a[o];if("function"==typeof s){t+=";"+l+"=";var c=s.toString();if(s.prototype)if(-1!=c.indexOf("[native code]")){var u=c.indexOf(" ",8)+1;t+=c.slice(u,c.indexOf("(",u))}else for(var d in t+=c,s.prototype)t+=";"+l+".prototype."+d+"="+s.prototype[d].toString();else t+=c}else n[l]=s}return t},dd=[],pd=function(e,t,n,r){if(!dd[n]){for(var i="",a={},o=e.length-1,s=0;s<o;++s)i=ud(e[s],i,a);dd[n]={c:ud(e[o],i,a),e:a}}var l=cd({},dd[n].e);return function(e,t,n,r,i){var a=new Worker(gu[t]||(gu[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=new Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}(dd[n].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,l,function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t}(l),r)},hd=function(){return[yu,bu,vu,wu,Su,Eu,_u,ku,Mu,$u,Au,Hu,ju,Bu,Vu,Uu,zu,qu,Gu,Wu,Ld,vd,wd]},fd=function(){return[yu,bu,vu,wu,Su,Eu,Tu,Pu,Lu,Iu,Fu,Nu,Au,nd,rd,ju,Qu,Ku,Yu,Xu,Ju,Zu,ed,td,zu,qu,id,ld,jd,vd]},md=function(){return[Od,Cd,xd,od,ad]},gd=function(){return[_d,Td]},yd=function(){return[kd,xd,sd]},bd=function(){return[Pd]},vd=function(e){return postMessage(e,[e.buffer])},wd=function(e){return e&&{out:e.size&&new yu(e.size),dictionary:e.dictionary}},Sd=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data.length?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush()}},Ed=function(e,t,n,r,i,a,o){var s,l=pd(e,r,i,(function(e,n){e?(l.terminate(),t.ondata.call(t,e)):Array.isArray(n)?1==n.length?(t.queuedSize-=n[0],t.ondrain&&t.ondrain(n[0])):(n[1]&&l.terminate(),t.ondata.call(t,e,n[0],n[1])):o(n)}));l.postMessage(n),t.queuedSize=0,t.push=function(e,n){t.ondata||Gu(5),s&&t.ondata(Gu(4,0,1),null,!!n),t.queuedSize+=e.length,l.postMessage([e,s=n],[e.buffer])},t.terminate=function(){l.terminate()},a&&(t.flush=function(){l.postMessage([])})},xd=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Od=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&xd(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},_d=function(e){31==e[0]&&139==e[1]&&8==e[2]||Gu(6,"invalid gzip data");var t=e[3],n=10;4&t&&(n+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)},Td=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Cd=function(e){return 10+(e.filename?e.filename.length+1:0)},kd=function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=sd();i.p(t.dictionary),xd(e,2,i.d())}},Pd=function(e,t){return(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Gu(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&Gu(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)};function Ad(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var Rd=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new yu(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(ld(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||Gu(5),this.s.l&&Gu(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var r=new yu(-32768&n);r.set(this.b.subarray(0,this.s.z)),this.b=r}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||Gu(5),this.s.l&&Gu(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),Dd=function(){return function(e,t){Ed([fd,function(){return[Sd,Rd]}],this,Ad.call(this,e,t),(function(e){var t=new Rd(e.data);onmessage=Sd(t)}),6,1)}}();function jd(e,t){return ld(e,t||{},0,0)}var Id=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new yu(32768),this.p=new yu(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||Gu(5),this.d&&Gu(4),this.p.length){if(e.length){var t=new yu(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=Wu(this.p,this.s,this.o);this.ondata(qu(n,t,this.s.b),this.d),this.o=qu(n,this.s.b-32768),this.s.b=this.o.length,this.p=qu(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Nd=function(){return function(e,t){Ed([hd,function(){return[Sd,Id]}],this,Ad.call(this,e,t),(function(e){var t=new Id(e.data);onmessage=Sd(t)}),7,0)}}();function Ld(e,t){return Wu(e,{i:2},t&&t.out,t&&t.dictionary)}var Md=function(){function e(e,t){this.c=od(),this.l=0,this.v=1,Rd.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Rd.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=ld(e,this.o,this.v&&Cd(this.o),t&&8,this.s);this.v&&(Od(n,this.o),this.v=0),t&&(xd(n,n.length-8,this.c.d()),xd(n,n.length-4,this.l)),this.ondata(n,t)},e.prototype.flush=function(){Rd.prototype.flush.call(this)},e}(),Fd=function(){return function(e,t){Ed([fd,md,function(){return[Sd,Rd,Md]}],this,Ad.call(this,e,t),(function(e){var t=new Md(e.data);onmessage=Sd(t)}),8,1)}}();var $d=function(){function e(e,t){this.v=1,this.r=0,Id.call(this,e,t)}return e.prototype.push=function(e,t){if(Id.prototype.e.call(this,e),this.r+=e.length,this.v){var n=this.p.subarray(this.v-1),r=n.length>3?_d(n):4;if(r>n.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-n.length);this.p=n.subarray(r),this.v=0}Id.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=zu(this.s.p)+9,this.s={i:0},this.o=new yu(0),this.push(new yu(0),t))},e}(),Bd=function(){return function(e,t){var n=this;Ed([hd,gd,function(){return[Sd,Id,$d]}],this,Ad.call(this,e,t),(function(e){var t=new $d(e.data);t.onmember=function(e){return postMessage(e)},onmessage=Sd(t)}),9,0,(function(e){return n.onmember&&n.onmember(e)}))}}();var Vd=function(){function e(e,t){this.c=sd(),this.v=1,Rd.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Rd.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var n=ld(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(kd(n,this.o),this.v=0),t&&xd(n,n.length-4,this.c.d()),this.ondata(n,t)},e.prototype.flush=function(){Rd.prototype.flush.call(this)},e}(),Ud=function(){return function(e,t){Ed([fd,yd,function(){return[Sd,Rd,Vd]}],this,Ad.call(this,e,t),(function(e){var t=new Vd(e.data);onmessage=Sd(t)}),10,1)}}();var zd=function(){function e(e,t){Id.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Id.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(Pd(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&Gu(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Id.prototype.c.call(this,t)},e}(),qd=function(){return function(e,t){Ed([hd,bd,function(){return[Sd,Id,zd]}],this,Ad.call(this,e,t),(function(e){var t=new zd(e.data);onmessage=Sd(t)}),11,0)}}();var Hd="undefined"!=typeof TextDecoder&&new TextDecoder;try{Hd.decode(rd,{stream:!0}),1}catch(Jt){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout;const Gd=e=>class{constructor(){this.i=new e,this.i.ondata=(e,t)=>{this.ondata(null,e,t)}}push(e,t){try{this.queuedSize+=e.length,this.i.push(e,t),this.queuedSize-=e.length,this.ondrain&&this.ondrain(e.length)}catch(e){this.ondata(e,null,t||!1)}}};let Wd=1;try{(new Dd).terminate()}catch(Gu){Wd=0}const Qd=Wd?{gzip:Fd,deflate:Ud,"deflate-raw":Dd}:{gzip:Gd(Md),deflate:Gd(Vd),"deflate-raw":Gd(Rd)},Kd=Wd?{gzip:Bd,deflate:qd,"deflate-raw":Nd}:{gzip:Gd($d),deflate:Gd(zd),"deflate-raw":Gd(Id)},Yd=(e,t,n)=>class extends e{constructor(e){if(!arguments.length)throw new TypeError(`Failed to construct '${n}': 1 argument required, but only 0 present.`);const r=t[e];if(!r)throw new TypeError(`Failed to construct '${n}': Unsupported compression format: '${e}'`);let i,a=new r;super({start:e=>{a.ondata=(t,n,r)=>{t?e.error(t):n&&(e.enqueue(n),r&&(i?i():e.terminate()))}},transform:e=>{if(e instanceof ArrayBuffer)e=new Uint8Array(e);else{if(!ArrayBuffer.isView(e))throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}if(a.push(e),a.queuedSize>=32768)return new Promise((e=>{a.ondrain=()=>{a.queuedSize<32768&&e()}}))},flush:()=>new Promise((e=>{i=e,a.push(new Uint8Array(0),!0)}))},{size:e=>0|e.byteLength,highWaterMark:65536},{size:e=>0|e.byteLength,highWaterMark:65536})}};const Xd="undefined"==typeof globalThis?"undefined"==typeof self?"undefined"==typeof global?{}:global:self:globalThis;var Jd;void 0===Xd.CompressionStream&&(Xd.CompressionStream=(Jd=TransformStream,Yd(Jd,Qd,"CompressionStream"))),void 0===Xd.DecompressionStream&&(Xd.DecompressionStream=function(e){return Yd(e,Kd,"DecompressionStream")}(TransformStream));var Zd=__webpack_require__(2249),ep=__webpack_require__.n(Zd);function tp(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}const np=new class extends ca{upload(e,t){var n,r=this;return(n=function*(){const n=yield r.fetch("/upload/v1",{method:"POST",body:JSON.stringify({name:e,profile:btoa(JSON.stringify(t)),fileTypeData:{units:t.metadata.units,spyName:t.metadata.spyName},type:"json"})});return yield n.json()},function(){var e=this,t=arguments;return new Promise((function(r,i){var a=n.apply(e,t);function o(e){tp(a,r,i,o,s,"next",e)}function s(e){tp(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(){super("https://flamegraph.com/api",{"content-type":"application/json"})}};var rp=function(e){return e.BASELINE="baseline",e.COMPARISON="comparison",e}({});const ip=new Intl.DateTimeFormat("fr-CA",{year:"numeric",month:"2-digit",day:"2-digit",hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});function ap(e){const t=ip.formatToParts(e).reduce(((e,{type:t,value:n})=>(e[t]=n,e)),{});return`${t.year}-${t.month}-${t.day}_${t.hour}${t.minute}`}function op(e){const t=new Date(Math.round(1e3*e.from.unix())),n=new Date(Math.round(1e3*e.to.unix()));return`${ap(t)}-to-${ap(n)}`}function sp(e){const[t,n]=e===rp.BASELINE?["diffFrom","diffTo"]:["diffFrom-2","diffTo-2"],i=new URLSearchParams(window.location.search),a=i.get(t),o=i.get(n);return{raw:{from:a,to:o},from:(0,r.dateTimeParse)(a),to:(0,r.dateTimeParse)(o)}}function lp(e){const t=["baseline",op(sp(rp.BASELINE)),"comparison",op(sp(rp.COMPARISON))];return e?[e,...t].join("_"):["flamegraph",...t].join("_")}function cp(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function up({profile:e,enableFlameGraphDotComExport:t}){const n=function(){var t,n=(t=function*(){Cs("g_pyroscope_app_export_profile",{format:"flamegraph.com"});const t=lp(e.metadata.appName);let n;try{n=yield np.upload(t,e)}catch(e){return void js(e,["Failed to export to flamegraph.com!",e.message])}const r=document.createElement("a");r.target="_blank",r.href=n.url,document.body.appendChild(r),r.click(),document.body.removeChild(r)},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){cp(a,r,i,o,s,"next",e)}function s(e){cp(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(){return n.apply(this,arguments)}}();return{data:{shouldDisplayFlamegraphDotCom:Boolean(t)},actions:{downloadPng:()=>{Cs("g_pyroscope_app_export_profile",{format:"png"});const t=`${lp(e.metadata.appName)}.png`;document.querySelector('canvas[data-testid="flameGraph"]').toBlob((e=>{if(e)ep()(e,t);else{const e=new Error("No Blob, the image cannot be created.");js(e,["Failed to export to png!",e.message])}}),"image/png")},downloadJson:()=>{Cs("g_pyroscope_app_export_profile",{format:"json"});const t=`${lp(e.metadata.appName)}.json`,n=`data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(e))}`;try{ep()(n,t)}catch(e){return void js(e,["Failed to export to JSON!",e.message])}},uploadToFlamegraphDotCom:n}}}function dp(e){const{actions:t}=up(e);return $i().createElement(o.Menu,null,$i().createElement(o.Menu.Item,{label:"png",onClick:t.downloadPng}),$i().createElement(o.Menu.Item,{label:"json",onClick:t.downloadJson}))}function pp(e){const{profile:t,enableFlameGraphDotComExport:n}=e;return $i().createElement(o.Dropdown,{overlay:$i().createElement(dp,{profile:t,enableFlameGraphDotComExport:n})},$i().createElement(o.Button,{icon:"download-alt",size:"sm",variant:"secondary",fill:"outline","aria-label":"Export profile data",tooltip:"Export profile data"}))}const hp=(0,Fi.memo)(pp);function fp(e,t,n){const r=[],i=n?7:4;for(let a=0;a<e.length;a+=i)r.push({level:0,label:n?t[e[a+6]]:t[e[a+3]],offset:e[a],val:e[a+1],self:e[a+2],selfRight:n?e[a+5]:0,valRight:n?e[a+4]:0,valTotal:n?e[a+1]+e[a+4]:e[a+1],offsetRight:n?e[a+3]:0,offsetTotal:n?e[a]+e[a+3]:e[a],children:[]});return r}function mp({profile:e,diff:t,vertical:n,enableFlameGraphDotComExport:i,collapsedFlamegraphs:a,getExtraContextMenuButtons:s}){const{isLight:l}=(0,o.useTheme2)(),c=(0,Fi.useMemo)((()=>function(e,t,n,i){if(!e.length)return;const a=[];for(let n=0;n<e.length;n++){a[n]=[];for(const r of fp(e[n],t,i))if(r.level=n,a[n].push(r),n>0){const e=a[n].slice(0,-1).reduce(((e,t)=>t.offsetTotal+t.valTotal+e),0)+r.offsetTotal,t=a[n-1];let i=0;for(const n of t){const t=i+n.offsetTotal,a=t+n.valTotal;if(t<=e&&a>e){n.children.push(r);break}i+=n.offsetTotal+n.valTotal}}}const o=[a[0][0]],s=[],l=[],c=[],u=[],d=[],p=[];for(;o.length;){const e=o.shift();s.push(e.label),l.push(e.level),c.push(e.self),u.push(e.val),d.push(e.selfRight),p.push(e.valRight),o.unshift(...e.children)}let h="short";switch(n){case"samples":case"trace_samples":case"lock_nanoseconds":case"nanoseconds":h="ns";break;case"bytes":h="bytes"}const f=[{name:"level",values:l},{name:"label",values:s,type:r.FieldType.string},{name:"self",values:c,config:{unit:h}},{name:"value",values:u,config:{unit:h}}];i&&f.push({name:"selfRight",values:d,config:{unit:h}},{name:"valueRight",values:p,config:{unit:h}});const m={name:"response",meta:{preferredVisualisationType:"flamegraph"},fields:f};return(0,r.createDataFrame)(m)}(e.flamebearer.levels,e.flamebearer.names,e.metadata.units,Boolean(t))),[e,t]);return $i().createElement(mu,{data:c,disableCollapsing:!a,extraHeaderElements:$i().createElement(hp,{profile:e,enableFlameGraphDotComExport:i}),vertical:n,getTheme:()=>(0,r.createTheme)({colors:{mode:l?"light":"dark"}}),getExtraContextMenuButtons:s,keepFocusOnDataChange:!0})}const gp=(0,Fi.memo)(mp),yp=e=>({flamegraph:i.css`
margin-top: ${e.spacing(2)};
`});function bp({profile:e,diff:t}){const n=(0,o.useStyles2)(yp);return $i().createElement("div",{className:n.flamegraph,"data-testid":"flamegraph"},$i().createElement(gp,{profile:e,diff:t}))}const vp=e=>({selectorContainer:i.css`
display: flex;
justify-content: center;
margin-bottom: ${e.spacing(2)};
`});function wp({profileTypes:e,onChange:t}){const n=(0,o.useStyles2)(vp),r=(0,Fi.useMemo)((()=>e.map((e=>({value:e,label:e})))),[e]),[i,a]=(0,Fi.useState)(),s=(0,Fi.useCallback)((e=>{a(e),t(e)}),[t]);return(0,Fi.useEffect)((()=>{a(r[0])}),[r]),$i().createElement("div",{className:n.selectorContainer},$i().createElement(o.InlineFieldRow,null,$i().createElement(o.InlineField,{label:"Profile",disabled:!r.length,"data-testid":"profile-types-dropdown"},$i().createElement(o.Select,{key:null==i?void 0:i.value,value:i,options:r,onChange:s,width:16}))))}const Sp=e=>({spinner:i.css`
text-align: center;
margin-top: ${e.spacing(2)};
`});function Ep(){const e=(0,o.useStyles2)(Sp);return $i().createElement("div",{className:e.spinner},$i().createElement(o.Spinner,{size:36}))}function xp(){const{processFile:e,profileTypes:t,selectProfileType:n,profile:r,removeFile:i,isLoading:a}=Hs();return $i().createElement("div",null,$i().createElement(wp,{profileTypes:t,onChange:e=>{Cs("g_pyroscope_app_ad_hoc_profile_metric_selected"),n(e)}}),$i().createElement(Ys,{onFileDropped:t=>{Cs("g_pyroscope_app_ad_hoc_file_dropped",{fileType:t.type}),e(t)},onFileRemove:()=>{Cs("g_pyroscope_app_ad_hoc_file_removed"),i()}}),a&&!r?$i().createElement(Ep,null):null,r&&$i().createElement(bp,{profile:r}))}const Op=(0,Fi.memo)(xp);function _p(){return $i().createElement(As,{left:$i().createElement(Op,null),right:$i().createElement(Op,null)})}const Tp=e=>({tabContent:i.css`
padding: ${e.spacing(2)};
margin: ${e.spacing(2)};
`});function Cp(){const e=(0,o.useStyles2)(Tp),[t,n]=(0,Fi.useState)(0);return $i().createElement("div",null,$i().createElement(o.TabsBar,null,$i().createElement(o.Tab,{label:" Single view",active:0===t,onChangeTab:()=>n(0)}),$i().createElement(o.Tab,{label:" Comparison view",active:1===t,onChangeTab:()=>n(1)})),$i().createElement(o.TabContent,{className:e.tabContent},0===t&&$i().createElement(Op,null),1===t&&$i().createElement(_p,null)))}function kp(){return ks("ad_hoc"),$i().createElement($i().Fragment,null,$i().createElement(os,{title:"Ad hoc view"}),$i().createElement(Cp,null),$i().createElement(xs,null))}var Pp=Object.defineProperty,Ap=Object.getOwnPropertySymbols,Rp=Object.prototype.hasOwnProperty,Dp=Object.prototype.propertyIsEnumerable,jp=(e,t,n)=>t in e?Pp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ip=(e,t)=>{for(var n in t||(t={}))Rp.call(t,n)&&jp(e,n,t[n]);if(Ap)for(var n of Ap(t))Dp.call(t,n)&&jp(e,n,t[n]);return e};function Np(e,t){const n=Ip({},a.locationService.getSearchObject());if(t)for(const e of Object.keys(n))t.includes(e)||delete n[e];return r.urlUtil.renderUrl(r.locationUtil.assureBaseUrl(e),n)}function Lp(e,t){return $i().createElement(e.Component,{model:e,routeProps:t})}var Mp=Object.defineProperty,Fp=Object.defineProperties,$p=Object.getOwnPropertyDescriptors,Bp=Object.getOwnPropertySymbols,Vp=Object.prototype.hasOwnProperty,Up=Object.prototype.propertyIsEnumerable,zp=(e,t,n)=>t in e?Mp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const qp=new Map;var Hp=__webpack_require__(1269);const Gp={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Wp;const Qp=new Uint8Array(16);function Kp(){if(!Wp&&(Wp="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Wp))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Wp(Qp)}const Yp=[];for(let e=0;e<256;++e)Yp.push((e+256).toString(16).slice(1));function Xp(e,t=0){return Yp[e[t+0]]+Yp[e[t+1]]+Yp[e[t+2]]+Yp[e[t+3]]+"-"+Yp[e[t+4]]+Yp[e[t+5]]+"-"+Yp[e[t+6]]+Yp[e[t+7]]+"-"+Yp[e[t+8]]+Yp[e[t+9]]+"-"+Yp[e[t+10]]+Yp[e[t+11]]+Yp[e[t+12]]+Yp[e[t+13]]+Yp[e[t+14]]+Yp[e[t+15]]}const Jp=function(e,t,n){if(Gp.randomUUID&&!t&&!e)return Gp.randomUUID();const r=(e=e||{}).random||(e.rng||Kp)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Xp(r)};var Zp=Object.defineProperty,eh=Object.defineProperties,th=Object.getOwnPropertyDescriptors,nh=Object.getOwnPropertySymbols,rh=Object.prototype.hasOwnProperty,ih=Object.prototype.propertyIsEnumerable,ah=(e,t,n)=>t in e?Zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const oh=$i().memo((function(e){var t,n=e,{model:r}=n,i=((e,t)=>{var n={};for(var r in e)rh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&nh)for(var r of nh(e))t.indexOf(r)<0&&ih.call(e,r)&&(n[r]=e[r]);return n})(n,["model"]);const a=null!=(t=r.constructor.Component)?t:sh,[o,s]=(0,Fi.useState)(0);return(0,Fi.useEffect)((()=>{const e=r.activate();return s((e=>e+1)),e}),[r]),r.isActive?$i().createElement(a,((e,t)=>eh(e,th(t)))(((e,t)=>{for(var n in t||(t={}))rh.call(t,n)&&ah(e,n,t[n]);if(nh)for(var n of nh(t))ih.call(t,n)&&ah(e,n,t[n]);return e})({},i),{model:r})):null}));function sh(e){return null}class lh extends r.BusEventWithPayload{}lh.type="scene-object-state-change";class ch extends r.BusEventWithPayload{}ch.type="scene-object-user-action";var uh,dh=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};class ph{constructor(e){var t,n,r,i;((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)})(this,uh,void 0),r=e,dh(t=this,n=uh,"write to private field"),i?i.call(t,r):n.set(t,r)}resolve(){return dh(e=this,t=uh,"read from private field"),n?n.call(e):t.get(e);var e,t,n}}uh=new WeakMap;var hh=Object.defineProperty,fh=Object.getOwnPropertySymbols,mh=Object.prototype.hasOwnProperty,gh=Object.prototype.propertyIsEnumerable,yh=(e,t,n)=>t in e?hh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bh=(e,t)=>{for(var n in t||(t={}))mh.call(t,n)&&yh(e,n,t[n]);if(fh)for(var n of fh(t))gh.call(t,n)&&yh(e,n,t[n]);return e};class vh{constructor(e){this._isActive=!1,this._activationHandlers=[],this._deactivationHandlers=new Map,this._subs=new Hp.Subscription,this._refCount=0,e.key||(e.key=Jp()),this._events=new r.EventBusSrv,this._state=Object.freeze(e),this._setParent(this._state)}get state(){return this._state}get isActive(){return this._isActive}get parent(){return this._parent}get variableDependency(){return this._variableDependency}get urlSync(){return this._urlSync}get Component(){return oh}_setParent(e){Sh(e,(e=>{e._parent&&e._parent!==this&&console.warn("SceneObject already has a parent set that is different from the new parent. You cannot share the same SceneObject instance in multiple scenes or in multiple different places of the same scene graph. Use SceneObject.clone() to duplicate a SceneObject or store a state key reference and use sceneGraph.findObject to locate it.",e,this),e._parent=this}))}subscribeToState(e){return this._events.subscribe(lh,(t=>{t.payload.changedObject===this&&e(t.payload.newState,t.payload.prevState)}))}subscribeToEvent(e,t){return this._events.subscribe(e,t)}setState(e){const t=this._state,n=bh(bh({},this._state),e);this._state=Object.freeze(n),this._setParent(e),this._handleActivationOfChangedStateProps(t,n),this.publishEvent(new lh({prevState:t,newState:n,partialUpdate:e,changedObject:this}),!0)}_handleActivationOfChangedStateProps(e,t){this.isActive&&(e.$behaviors!==t.$behaviors&&this._handleChangedBehaviors(e.$behaviors,t.$behaviors),e.$data!==t.$data&&this._handleChangedStateActivation(e.$data,t.$data),e.$variables!==t.$variables&&this._handleChangedStateActivation(e.$variables,t.$variables),e.$timeRange!==t.$timeRange&&this._handleChangedStateActivation(e.$timeRange,t.$timeRange))}_handleChangedStateActivation(e,t){if(e){const t=this._deactivationHandlers.get(e);t&&(t(),this._deactivationHandlers.delete(e))}t&&this._deactivationHandlers.set(t,t.activate())}_handleChangedBehaviors(e,t){if(e)for(const n of e)if(!t||!t.includes(n)){const e=this._deactivationHandlers.get(n);e&&(e(),this._deactivationHandlers.delete(n))}if(t)for(const n of t)e&&e.includes(n)||this._activateBehavior(n)}publishEvent(e,t){this._events.publish(e),t&&this.parent&&this.parent.publishEvent(e,t)}getRoot(){return this._parent?this._parent.getRoot():this}_internalActivate(){this._isActive=!0;const{$data:e,$variables:t,$timeRange:n,$behaviors:r}=this.state;if(this._activationHandlers.forEach((e=>{const t=e();t&&this._deactivationHandlers.set(t,t)})),n&&!n.isActive&&this._deactivationHandlers.set(n,n.activate()),t&&!t.isActive&&this._deactivationHandlers.set(t,t.activate()),e&&!e.isActive&&this._deactivationHandlers.set(e,e.activate()),r)for(const e of r)this._activateBehavior(e)}_activateBehavior(e){if(e instanceof vh)this._deactivationHandlers.set(e,e.activate());else if("function"==typeof e){const t=e(this);t&&this._deactivationHandlers.set(e,t)}}activate(){this.isActive||this._internalActivate(),this._refCount++;let e=!1;return()=>{if(this._refCount--,e){throw new Error("SceneObject cancelation handler returned by activate() called a second time")}e=!0,0===this._refCount&&this._internalDeactivate()}}_internalDeactivate(){this._isActive=!1;for(let e of this._deactivationHandlers.values())e();this._deactivationHandlers.clear(),this._events.removeAllListeners(),this._subs.unsubscribe(),this._subs=new Hp.Subscription}useState(){return wh(this)}forceRender(){this.setState({})}clone(e){return function(e,t){const n=kh(e.state,t);return new e.constructor(n)}(this,e)}addActivationHandler(e){this._activationHandlers.push(e)}forEachChild(e){Sh(this.state,e)}getRef(){return this._ref||(this._ref=new ph(this)),this._ref}}function wh(e,t){var n;const[r,i]=(0,Fi.useState)(e.state),a=e.state,o=null!=(n=null==t?void 0:t.shouldActivateOrKeepAlive)&&n;return(0,Fi.useEffect)((()=>{let t;o&&(t=e.activate());const n=e.subscribeToState((e=>{i(e)}));return e.state!==a&&i(e.state),()=>{n.unsubscribe(),t&&t()}}),[e,o]),e.state}function Sh(e,t){for(const n of Object.values(e))if(n instanceof vh&&t(n),Array.isArray(n))for(const e of n)e instanceof vh&&t(e)}var Eh=Object.defineProperty,xh=Object.getOwnPropertySymbols,Oh=Object.prototype.hasOwnProperty,_h=Object.prototype.propertyIsEnumerable,Th=(e,t,n)=>t in e?Eh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ch=(e,t)=>{for(var n in t||(t={}))Oh.call(t,n)&&Th(e,n,t[n]);if(xh)for(var n of xh(t))_h.call(t,n)&&Th(e,n,t[n]);return e};function kh(e,t){const n=Ch({},e);for(const e in n){const t=n[e];if(t instanceof vh&&(n[e]=t.clone()),t instanceof ph)throw new Error("Cannot clone a SceneObject with a SceneObjectRef in state");if(Array.isArray(t)){const r=[];for(const e of t)e instanceof vh?r.push(e.clone()):r.push(e);n[e]=r}}return Object.assign(n,t),n}function Ph(e,t){let n,r=e;for(;r&&!n;)n=t(r),r=r.parent;return n}class Ah extends r.DataSourceApi{constructor(e,t){super({name:"RuntimeDataSource-"+e,uid:t,type:e,id:1,readOnly:!0,jsonData:{},access:"direct",meta:{id:e,name:"RuntimeDataSource-"+e,type:r.PluginType.datasource,info:{author:{name:""},description:"",links:[],logos:{large:"",small:""},screenshots:[],updated:"",version:""},module:"",baseUrl:""}})}testDatasource(){return Promise.resolve({})}}const Rh=new Map;class Dh{constructor(){this.index=new Map}getUniqueKey(e,t){const n=this.index.get(e);if(!n)throw new Error("Cannot find any scene object that uses the key '"+e+"'");const r=n.findIndex((e=>e.sceneObject===t));return r>0?`${e}-${r+1}`:e}rebuildIndex(e){this.index.clear(),this.buildIndex(e,0)}buildIndex(e,t){if(e.urlSync)for(const n of e.urlSync.getKeys()){const r=this.index.get(n);r?(r.push({sceneObject:e,depth:t}),r.sort(((e,t)=>e.depth-t.depth))):this.index.set(n,[{sceneObject:e,depth:t}])}e.forEachChild((e=>this.buildIndex(e,t+1)))}}function jh(e){const t=new Dh;t.rebuildIndex(e);const n={},r=e=>{if(e.urlSync){const r=e.urlSync.getUrlState();for(const[i,a]of Object.entries(r))if(null!=a){const r=t.getUniqueKey(i,e);n[r]=a}}e.forEachChild(r)};return r(e),n}function Ih(e,t,n){if(e.urlSync){const r={},i=e.urlSync.getUrlState();for(const a of e.urlSync.getKeys()){const o=n.getUniqueKey(a,e),s=t.getAll(o),l=i[a];Nh(s,l)||(s.length>0?Array.isArray(l)?r[a]=s:r[a]=s[0]:r[a]=null)}Object.keys(r).length>0&&e.urlSync.updateFromUrl(r)}e.forEachChild((e=>Ih(e,t,n)))}function Nh(e,t){return 0===e.length&&null==t||(Array.isArray(t)||1!==(null==e?void 0:e.length)?0===(null==t?void 0:t.length)&&null===e||(0,Bc.isEqual)(e,t):t===e[0])}var Lh=(e=>(e.Linear="linear",e.Log="log",e.Ordinal="ordinal",e.Symlog="symlog",e))(Lh||{}),Mh=(e=>(e.Hue="hue",e.None="none",e.Opacity="opacity",e.Scheme="scheme",e))(Mh||{});var Fh=(e=>(e.Ascending="asc",e.Descending="desc",e.None="none",e))(Fh||{});var $h=(e=>(e.Basic="basic",e.Gradient="gradient",e.Lcd="lcd",e))($h||{}),Bh=(e=>(e.Color="color",e.Hidden="hidden",e.Text="text",e))(Bh||{}),Vh=(e=>(e.Auto="auto",e.Hidden="hidden",e.Left="left",e.Top="top",e))(Vh||{}),Uh=(e=>(e.Auto="auto",e.Manual="manual",e))(Uh||{}),zh=(e=>(e.Actions="actions",e.Auto="auto",e.BasicGauge="basic",e.ColorBackground="color-background",e.ColorBackgroundSolid="color-background-solid",e.ColorText="color-text",e.Custom="custom",e.DataLinks="data-links",e.Gauge="gauge",e.GradientGauge="gradient-gauge",e.Image="image",e.JSONView="json-view",e.LcdGauge="lcd-gauge",e.Sparkline="sparkline",e))(zh||{});var qh=(e=>(e.CSV="csv",e.Date="date",e.Distributed="distributed",e.DoubleQuote="doublequote",e.Glob="glob",e.HTML="html",e.JSON="json",e.Lucene="lucene",e.PercentEncode="percentencode",e.Pipe="pipe",e.QueryParam="queryparam",e.Raw="raw",e.Regex="regex",e.SQLString="sqlstring",e.SingleQuote="singlequote",e.Text="text",e.UriEncode="uriencode",e))(qh||{});zh.Auto;var Hh=(e=>(e.NotStarted="NotStarted",e.Loading="Loading",e.Streaming="Streaming",e.Done="Done",e.Error="Error",e))(Hh||{}),Gh=Object.defineProperty,Wh=Object.getOwnPropertySymbols,Qh=Object.prototype.hasOwnProperty,Kh=Object.prototype.propertyIsEnumerable,Yh=(e,t,n)=>t in e?Gh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const Xh={state:Hh.Done,series:[],timeRange:(0,r.getDefaultTimeRange)()};class Jh{constructor(e,t){this._sceneObject=e,this._keys=t.keys}getKeys(){return"function"==typeof this._keys?this._keys():this._keys}getUrlState(){return this._sceneObject.getUrlState()}updateFromUrl(e){this._sceneObject.updateFromUrl(e)}}const Zh=/^\d+[yYmMsSwWhHdD]$/;function ef(e){if("string"!=typeof e)return null;if(-1!==e.indexOf("now"))return e;if(Zh.test(e))return e;if(8===e.length){const t=(0,r.toUtc)(e,"YYYYMMDD");if(t.isValid())return t.toISOString()}else if(15===e.length){const t=(0,r.toUtc)(e,"YYYYMMDDTHHmmss");if(t.isValid())return t.toISOString()}else if(24===e.length){return(0,r.toUtc)(e).toISOString()}const t=parseInt(e,10);return isNaN(t)?null:(0,r.toUtc)(t).toISOString()}function tf(e,t,n,i,a){const o=a&&"now"===t;return{from:r.dateMath.parse(e,!1,n,i),to:r.dateMath.parse(o?"now-"+a:t,!0,n,i),raw:{from:e,to:t}}}var nf=Object.defineProperty,rf=Object.getOwnPropertySymbols,af=Object.prototype.hasOwnProperty,of=Object.prototype.propertyIsEnumerable,sf=(e,t,n)=>t in e?nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class lf extends vh{constructor(e={}){var t,n;const i=null!=(t=e.from)?t:"now-6h",a=null!=(n=e.to)?n:"now",o=e.timeZone;super(((e,t)=>{for(var n in t||(t={}))af.call(t,n)&&sf(e,n,t[n]);if(rf)for(var n of rf(t))of.call(t,n)&&sf(e,n,t[n]);return e})({from:i,to:a,timeZone:o,value:tf(i,a,o||(0,r.getTimeZone)(),e.fiscalYearStartMonth,e.UNSAFE_nowDelay)},e)),this._urlSync=new Jh(this,{keys:["from","to","timezone"]}),this.onTimeRangeChange=e=>{const t={},n={};"string"==typeof e.raw.from?(t.from=e.raw.from,n.from=e.raw.from):(t.from=e.raw.from.toISOString(),n.from=e.raw.from.toISOString(!0)),"string"==typeof e.raw.to?(t.to=e.raw.to,n.to=e.raw.to):(t.to=e.raw.to.toISOString(),n.to=e.raw.to.toISOString(!0)),t.value=tf(n.from,n.to,this.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay),t.from===this.state.from&&t.to===this.state.to||this.setState(t)},this.onTimeZoneChange=e=>{this.setState({timeZone:e})},this.onRefresh=()=>{this.setState({value:tf(this.state.from,this.state.to,this.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay)})},this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){if(!this.state.timeZone){const e=this.getTimeZoneSource();e!==this&&this._subs.add(e.subscribeToState(((t,n)=>{void 0!==t.timeZone&&t.timeZone!==n.timeZone&&this.setState({value:tf(this.state.from,this.state.to,e.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay)})})))}return this.state.weekStart&&(0,r.setWeekStart)(this.state.weekStart),()=>{this.state.weekStart&&(0,r.setWeekStart)(a.config.bootData.user.weekStart)}}getTimeZoneSource(){if(!this.parent||!this.parent.parent)return this;const e=Ph(this.parent.parent,(e=>{if(e.state.$timeRange&&e.state.$timeRange.state.timeZone)return e.state.$timeRange}));return e||this}getTimeZone(){if(this.state.timeZone)return this.state.timeZone;const e=this.getTimeZoneSource();return e!==this?e.state.timeZone:(0,r.getTimeZone)()}getUrlState(){const e={from:this.state.from,to:this.state.to};return this.state.timeZone&&(e.timezone=this.state.timeZone),e}updateFromUrl(e){var t,n,r;if(!e.to&&!e.from)return;const i={},a=ef(e.from);a&&(i.from=a);const o=ef(e.to);o&&(i.to=o),"string"==typeof e.timezone&&(i.timeZone=""!==e.timezone?e.timezone:void 0),i.value=tf(null!=(t=i.from)?t:this.state.from,null!=(n=i.to)?n:this.state.to,null!=(r=i.timeZone)?r:this.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay),this.setState(i)}}const cf=new class extends vh{constructor(e){super(((e,t)=>{for(var n in t||(t={}))Qh.call(t,n)&&Yh(e,n,t[n]);if(Wh)for(var n of Wh(t))Kh.call(t,n)&&Yh(e,n,t[n]);return e})({data:Xh},e))}getResultsStream(){const e={origin:this,data:this.state.data};return(0,Hp.of)(e)}},uf=new lf;const df=new class extends vh{constructor(){super({variables:[]})}getByName(e){}isVariableLoadingOrWaitingToUpdate(e){return!1}};function pf(e){var t;return null!=(t=Ph(e,(e=>e.state.$timeRange)))?t:uf}class hf extends r.BusEventWithPayload{}function ff(e){return"object"==typeof e&&"formatter"in e}hf.type="scene-variable-changed-value";let mf,gf={};function yf(e){const t=gf[e];return t||(gf[e]=(0,Bc.property)(e))}class bf{constructor(e,t){this.state={name:e,value:t,type:"scopedvar"}}getValue(e){let{value:t}=this.state,n=t.value;return n=e?yf(e)(t.value):t.value,"string"===n||"number"===n||"boolean"===n?n:String(n)}getValueText(){const{value:e}=this.state;return null!=e.text?String(e.text):String(e)}}const vf=new r.Registry((()=>{const e=[{id:qh.Lucene,name:"Lucene",description:"Values are lucene escaped and multi-valued variables generate an OR expression",formatter:e=>{if("string"==typeof e)return wf(e);if(Array.isArray(e)){if(0===e.length)return"__empty__";return"("+(0,Bc.map)(e,(e=>'"'+wf(e)+'"')).join(" OR ")+")"}return wf(`${e}`)}},{id:qh.Raw,name:"raw",description:"Keep value as is",formatter:e=>String(e)},{id:qh.Regex,name:"Regex",description:"Values are regex escaped and multi-valued variables generate a (<value>|<value>) expression",formatter:e=>{if("string"==typeof e)return(0,r.escapeRegex)(e);if(Array.isArray(e)){const t=e.map((e=>"string"==typeof e?(0,r.escapeRegex)(e):(0,r.escapeRegex)(String(e))));return 1===t.length?t[0]:"("+t.join("|")+")"}return(0,r.escapeRegex)(`${e}`)}},{id:qh.Pipe,name:"Pipe",description:"Values are separated by | character",formatter:e=>"string"==typeof e?e:Array.isArray(e)?e.join("|"):`${e}`},{id:qh.Distributed,name:"Distributed",description:"Multiple values are formatted like variable=value",formatter:(e,t,n)=>"string"==typeof e?e:Array.isArray(e)?(e=(0,Bc.map)(e,((e,t)=>0!==t?n.state.name+"="+e:e))).join(","):`${e}`},{id:qh.CSV,name:"Csv",description:"Comma-separated values",formatter:e=>"string"==typeof e?e:(0,Bc.isArray)(e)?e.join(","):String(e)},{id:qh.HTML,name:"HTML",description:"HTML escaping of values",formatter:e=>"string"==typeof e?r.textUtil.escapeHtml(e):(0,Bc.isArray)(e)?r.textUtil.escapeHtml(e.join(", ")):r.textUtil.escapeHtml(String(e))},{id:qh.JSON,name:"JSON",description:"JSON stringify value",formatter:e=>"string"==typeof e?e:JSON.stringify(e)},{id:qh.PercentEncode,name:"Percent encode",description:"Useful for URL escaping values",formatter:e=>(0,Bc.isArray)(e)?Sf("{"+e.join(",")+"}"):Sf(e)},{id:qh.SingleQuote,name:"Single quote",description:"Single quoted values",formatter:e=>{const t=new RegExp("'","g");if((0,Bc.isArray)(e))return(0,Bc.map)(e,(e=>`'${(0,Bc.replace)(e,t,"\\'")}'`)).join(",");let n="string"==typeof e?e:String(e);return`'${(0,Bc.replace)(n,t,"\\'")}'`}},{id:qh.DoubleQuote,name:"Double quote",description:"Double quoted values",formatter:e=>{const t=new RegExp('"',"g");if((0,Bc.isArray)(e))return(0,Bc.map)(e,(e=>`"${(0,Bc.replace)(e,t,'\\"')}"`)).join(",");let n="string"==typeof e?e:String(e);return`"${(0,Bc.replace)(n,t,'\\"')}"`}},{id:qh.SQLString,name:"SQL string",description:"SQL string quoting and commas for use in IN statements and other scenarios",formatter:Tf},{id:qh.Date,name:"Date",description:"Format date in different ways",formatter:(e,t)=>{var n;let i=NaN;if("number"==typeof e?i=e:"string"==typeof e&&(i=parseInt(e,10)),isNaN(i))return"NaN";const a=null!=(n=t[0])?n:"iso";switch(a){case"ms":return String(e);case"seconds":return`${Math.round(i/1e3)}`;case"iso":return(0,r.dateTime)(i).toISOString();default:return(t||[]).length>1?(0,r.dateTime)(i).format(t.join(":")):(0,r.dateTime)(i).format(a)}}},{id:qh.Glob,name:"Glob",description:"Format multi-valued variables using glob syntax, example {value1,value2}",formatter:e=>(0,Bc.isArray)(e)&&e.length>1?"{"+e.join(",")+"}":String(e)},{id:qh.Text,name:"Text",description:"Format variables in their text representation. Example in multi-variable scenario A + B + C.",formatter:(e,t,n)=>n.getValueText?n.getValueText():String(e)},{id:qh.QueryParam,name:"Query parameter",description:"Format variables as URL parameters. Example in multi-variable scenario A + B + C => var-foo=A&var-foo=B&var-foo=C.",formatter:(e,t,n)=>Array.isArray(e)?e.map((e=>Of(n.state.name,e))).join("&"):Of(n.state.name,e)},{id:qh.UriEncode,name:"Percent encode as URI",description:"Useful for URL escaping values, taking into URI syntax characters",formatter:e=>(0,Bc.isArray)(e)?Ef("{"+e.join(",")+"}"):Ef(e)}];return e}));function wf(e){return!1===isNaN(+e)?e:e.replace(/([\!\*\+\-\=<>\s\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g,"\\$1")}function Sf(e){return"object"==typeof e&&(e=String(e)),xf(encodeURIComponent(e))}const Ef=e=>xf(encodeURI(String(e))),xf=e=>e.replace(/[!'()*]/g,(e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()));function Of(e,t){return`var-${e}=${Sf(t)}`}const _f={"'":"''",'"':'\\"'};function Tf(e){const t=new RegExp("'|\"","g");if((0,Bc.isArray)(e))return(0,Bc.map)(e,(e=>`'${(0,Bc.replace)(e,t,(e=>{var t;return null!=(t=_f[e])?t:""}))}'`)).join(",");let n="string"==typeof e?e:String(e);return`'${(0,Bc.replace)(n,t,(e=>{var t;return null!=(t=_f[e])?t:""}))}'`}const Cf="All",kf="$__all",Pf="$__auto",Af=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,Rf="__searchFilter";function Df(e,t){const n=t.state.$variables;if(!n)return t.parent?Df(e,t.parent):null;const r=n.getByName(e);return r||(t.parent?Df(e,t.parent):null)}function jf(e,t,n,r,i){return t?(Af.lastIndex=0,t.replace(Af,((t,a,o,s,l,c,u)=>{const d=a||o||l,p=s||u||r,h=function(e,t,n,r){if(n&&n.hasOwnProperty(e)){const t=n[e];if(t)return function(e,t){return mf?(mf.state.name=e,mf.state.value=t):mf=new bf(e,t),mf}(e,t)}const i=Df(e,r);if(i)return i;const a=tm.get(e);if(a)return new a(e,r,t,n);return null}(d,t,n,e);if(!h)return i&&i.push({match:t,variableName:d,fieldPath:c,format:p,value:t,found:!1}),t;const f=function(e,t,n,r){if(null==n)return"";if(ff(n))return jf(e,n.formatter(r));Array.isArray(n)||"object"!=typeof n||(n=`${n}`);if("function"==typeof r)return r(n,{name:t.state.name,type:t.state.type,multi:t.state.isMulti,includeAll:t.state.includeAll});let i=[];r?(i=r.split(":"),i.length>1?(r=i[0],i=i.slice(1)):i=[]):r=qh.Glob;let a=vf.getIfExists(r);a||(console.error(`Variable format ${r} not found. Using glob format as fallback.`),a=vf.get(qh.Glob));return a.formatter(n,i,t)}(e,h,h.getValue(c),p);return i&&i.push({match:t,variableName:d,fieldPath:c,format:p,value:f,found:f!==t}),f}))):null!=t?t:""}function If(e){return void 0!==e.useState}function Nf(e){return"enrichDataRequest"in e}function Lf(e){return"isDataLayer"in e}function Mf(e){return"isQueryController"in e}function Ff(e){var t;return null!=(t=Ph(e,(e=>e.state.$data)))?t:cf}function $f(e,t,n,r){if(t(e))return e;let i=null;return e.forEachChild((e=>{if(e===n)return;let r=$f(e,t);r&&(i=r)})),i||(r&&e.parent?$f(e.parent,t,e,!0):null)}function Bf(e,t){return $f(e,t,void 0,!0)}new WeakMap;class Vf{constructor(e){this._value=e}formatter(){return this._value}}class Uf{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=pf(this._sceneObject);return"__from"===this.state.name?e.state.value.from.valueOf():e.state.value.to.valueOf()}getValueText(){const e=pf(this._sceneObject);return"__from"===this.state.name?(0,r.dateTimeFormat)(e.state.value.from,{timeZone:e.getTimeZone()}):(0,r.dateTimeFormat)(e.state.value.to,{timeZone:e.getTimeZone()})}}class zf{constructor(e,t,n){this.state={name:e,type:"time_macro",match:n},this._sceneObject=t}getValue(){var e;const t=Ff(this._sceneObject);if(t){const n=null==(e=t.state.data)?void 0:e.request;return n?"__interval_ms"===this.state.name?n.intervalMs:n.interval:this.state.match}return this.state.match}}function qf(e,t={}){if(e.state.$variables)for(const n of e.state.$variables.state.variables)n.state.skipUrlSync||t[n.state.name]||(t[n.state.name]=n);return e.parent&&qf(e.parent,t),t}var Hf=Object.defineProperty,Gf=Object.defineProperties,Wf=Object.getOwnPropertyDescriptors,Qf=Object.getOwnPropertySymbols,Kf=Object.prototype.hasOwnProperty,Yf=Object.prototype.propertyIsEnumerable,Xf=(e,t,n)=>t in e?Hf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function Jf(e,t,n){return new Proxy({},{get:(i,a)=>"name"===a?e.name:"displayName"===a?(0,r.getFieldDisplayName)(e,t,n):"labels"===a||"formattedLabels"===a?e.labels?((e,t)=>Gf(e,Wf(t)))(((e,t)=>{for(var n in t||(t={}))Kf.call(t,n)&&Xf(e,n,t[n]);if(Qf)for(var n of Qf(t))Yf.call(t,n)&&Xf(e,n,t[n]);return e})({},e.labels),{__values:Object.values(e.labels).sort().join(", "),toString:()=>(0,r.formatLabels)(e.labels,"",!0)}):"":void 0})}const Zf=(0,r.getDisplayProcessor)();class em{constructor(e){this._urlQueryParams=e}formatter(e){if(!e)return this._urlQueryParams;const t=e.split(":");if("exclude"===t[0]&&t.length>1){const e=new URLSearchParams(this._urlQueryParams);for(const n of t[1].split(","))e.delete(n);return`?${e}`}if("include"===t[0]&&t.length>1){const e=new URLSearchParams(this._urlQueryParams),n=t[1].split(",");for(const t of e.keys())n.includes(t)||e.delete(t);return`?${e}`}return this._urlQueryParams}}const tm=new Map([[r.DataLinkBuiltInVars.includeVars,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){const e=qf(this._sceneObject),t=vf.get(qh.QueryParam),n=[];for(const r of Object.keys(e)){const i=e[r],a=i.getValue();a&&(ff(a)?n.push(a.formatter(qh.QueryParam)):n.push(t.formatter(a,[],i)))}return new Vf(n.join("&"))}getValueText(){return""}}],[r.DataLinkBuiltInVars.keepTime,class{constructor(e,t){this.state={name:e,type:"url_variable"},this._sceneObject=t}getValue(){var e;const t=null==(e=pf(this._sceneObject).urlSync)?void 0:e.getUrlState();return new Vf(r.urlUtil.toUrlParams(t))}getValueText(){return""}}],["__value",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__value"}}getValue(e){var t,n;const i=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!i)return this._match;const{frame:a,rowIndex:o,field:s,calculatedValue:l}=i.value;if(l)switch(e){case"numeric":case"raw":return l.numeric;case"time":return"";default:return(0,r.formattedValueToString)(l)}if(null==o)return this._match;if("time"===e){const e=a.fields.find((e=>e.type===r.FieldType.time));return e?e.values.get(o):void 0}if(!s)return this._match;const c=s.values.get(o);if("raw"===e)return c;const u=(null!=(n=s.display)?n:Zf)(c);return"numeric"===e?u.numeric:(0,r.formattedValueToString)(u)}getValueText(){return""}}],["__data",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__data"}}getValue(e){var t,n;const i=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!i||!e)return this._match;const{frame:a,rowIndex:o}=i.value;if(void 0===o||void 0===e)return this._match;const s={name:a.name,refId:a.refId,fields:(0,r.getFieldDisplayValuesProxy)({frame:a,rowIndex:o})};return null!=(n=yf(e)(s))?n:""}getValueText(){return""}}],["__series",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__series"}}getValue(e){var t;const n=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!n||!e)return this._match;if("name"!==e)return this._match;const{frame:i,frameIndex:a}=n.value;return(0,r.getFrameDisplayName)(i,a)}getValueText(){return""}}],["__field",class{constructor(e,t,n,r){this._match=n,this._scopedVars=r,this.state={name:e,type:"__field"}}getValue(e){var t,n;const r=null==(t=this._scopedVars)?void 0:t.__dataContext;if(!r||!e)return this._match;if(void 0===e||""===e)return this._match;const{frame:i,field:a,data:o}=r.value,s=Jf(a,i,o);return null!=(n=yf(e)(s))?n:""}getValueText(){return""}}],["__url",class{constructor(e,t){this.state={name:e,type:"url_macro"}}getValue(e){var t;const n=a.locationService.getLocation(),r=null!=(t=a.config.appSubUrl)?t:"";switch(null!=e?e:""){case"params":return new em(n.search);case"path":return r+n.pathname;default:return r+n.pathname+n.search}}getValueText(){return""}}],["__from",Uf],["__to",Uf],["__timezone",class{constructor(e,t){this.state={name:e,type:"time_macro"},this._sceneObject=t}getValue(){const e=pf(this._sceneObject).getTimeZone();return"browser"===e?Intl.DateTimeFormat().resolvedOptions().timeZone:e}getValueText(){return this.getValue()}}],["__user",class{constructor(e,t){this.state={name:e,type:"user_macro"}}getValue(e){const t=a.config.bootData.user;switch(e){case"login":return t.login;case"email":return t.email;default:return String(t.id)}}getValueText(){return""}}],["__org",class{constructor(e,t){this.state={name:e,type:"org_macro"}}getValue(e){const t=a.config.bootData.user;return"name"===e?t.orgName:String(t.orgId)}getValueText(){return""}}],["__interval",zf],["__interval_ms",zf]]);const nm={getVariables:function(e){var t;return null!=(t=Ph(e,(e=>e.state.$variables)))?t:df},getData:Ff,getTimeRange:pf,getLayout:function(e){const t=Ph(e,(e=>function(e){return"isDraggable"in e}(e)?e:void 0));return t||null},getDataLayers:function(e,t=!1){let n=e,r=[];for(;n;){const e=n.state.$data;if(e){if(Lf(e)?r=r.concat(e):e.state.$data&&Lf(e.state.$data)&&(r=r.concat(e.state.$data)),t&&r.length>0)break;n=n.parent}else n=n.parent}return r},interpolate:function(e,t,n,r,i){return""===t||null==t?"":jf(e,t,n,r,i)},lookupVariable:Df,hasVariableDependencyInLoadingState:function(e){if(!e.variableDependency)return!1;for(const t of e.variableDependency.getNames()){const n=Df(t,e);if(!n)continue;if(n.parent.isVariableLoadingOrWaitingToUpdate(n))return!0}return!1},findByKey:function(e,t){const n=Bf(e,(e=>e.state.key===t));if(!n)throw new Error("Unable to find scene with key "+t);return n},findByKeyAndType:function(e,t,n){const r=Bf(e,(e=>e.state.key===t));if(!r)throw new Error("Unable to find scene with key "+t);if(!(r instanceof n))throw new Error(`Found scene object with key ${t} does not match type ${n.name}`);return r},findObject:Bf,findAllObjects:function e(t,n){const r=[];return t.forEachChild((t=>{n(t)&&r.push(t),r.push(...e(t,n))})),r},getAncestor:function(e,t){let n=e;for(;n;){if(n instanceof t)return n;n=n.parent}if(!n)throw new Error("Unable to find parent of type "+t.name);return n},getQueryController:function(e){let t=e;for(;t;){if(t.state.$behaviors)for(const e of t.state.$behaviors)if(Mf(e))return e;t=t.parent}}};async function rm(e,t){if(null==e?void 0:e.uid){const t=Rh.get(e.uid);if(t)return t}return e&&e.query?e:await(0,a.getDataSourceSrv)().get(e,t)}function im(e,t,...n){let r=!1;"undefined"!=typeof window&&(r="true"===localStorage.getItem("grafana.debug.scenes"))}class am{constructor(e,t){this._sceneObject=e,this._options=t,this._dependencies=new Set,this._isWaitingForVariables=!1,this.scanCount=0,this._statePaths=t.statePaths}hasDependencyOn(e){return this.getNames().has(e)}variableUpdateCompleted(e,t){const n=this.getNames();let i=!1;(n.has(e.state.name)||n.has(r.DataLinkBuiltInVars.includeVars))&&t&&(i=!0),im(0,0,e.state.name,this._isWaitingForVariables),this._options.onAnyVariableChanged&&this._options.onAnyVariableChanged(e),this._options.onVariableUpdateCompleted&&(this._isWaitingForVariables||i)&&this._options.onVariableUpdateCompleted(),i&&(this._options.onReferencedVariableValueChanged&&this._options.onReferencedVariableValueChanged(e),this._options.onReferencedVariableValueChanged||this._options.onVariableUpdateCompleted||this._sceneObject.forceRender())}hasDependencyInLoadingState(){return nm.hasVariableDependencyInLoadingState(this._sceneObject)?(this._isWaitingForVariables=!0,!0):(this._isWaitingForVariables=!1,!1)}getNames(){const e=this._state,t=this._state=this._sceneObject.state;if(!e)return this.scanStateForDependencies(this._state),this._dependencies;if(t!==e)if(this._statePaths){for(const n of this._statePaths)if("*"===n||t[n]!==e[n]){this.scanStateForDependencies(t);break}}else this.scanStateForDependencies(t);return this._dependencies}setVariableNames(e){this._options.variableNames=e,this.scanStateForDependencies(this._state)}setPaths(e){this._statePaths=e}scanStateForDependencies(e){if(this._dependencies.clear(),this.scanCount+=1,this._options.variableNames)for(const e of this._options.variableNames)this._dependencies.add(e);if(this._statePaths)for(const t of this._statePaths){if("*"===t){this.extractVariablesFrom(e);break}{const n=e[t];n&&this.extractVariablesFrom(n)}}}extractVariablesFrom(e){Af.lastIndex=0;const t=("string"!=typeof e?ey(e):e).matchAll(Af);if(t)for(const e of t){const[,t,n,,r]=e,i=t||n||r;this._dependencies.add(i)}}}class om{constructor(){this._values=new Map}recordCurrentDependencyValuesForSceneObject(e){if(this.clearValues(),e.variableDependency)for(const t of e.variableDependency.getNames()){const n=nm.lookupVariable(t,e);n&&this._values.set(n.state.name,n.getValue())}}cloneAndRecordCurrentValuesForSceneObject(e){const t=new om;return t.recordCurrentDependencyValuesForSceneObject(e),t}clearValues(){this._values.clear()}hasValues(){return!!this._values}recordCurrentValue(e){this._values.set(e.state.name,e.getValue())}hasRecordedValue(e){return this._values.has(e.state.name)}hasValueChanged(e){if(this._values.has(e.state.name)){if(!Zg(this._values.get(e.state.name),e.getValue()))return!0}return!1}hasDependenciesChanged(e){if(!this._values)return!1;if(!e.variableDependency)return!1;for(const t of e.variableDependency.getNames()){const n=nm.lookupVariable(t,e);if(!n)continue;const r=n.state.name;if(n&&this._values.has(r)){if(!Zg(this._values.get(r),n.getValue()))return!0}}return!1}}function sm(e){return"object"==typeof e&&"getExtraQueries"in e}var lm=Object.defineProperty,cm=Object.defineProperties,um=Object.getOwnPropertyDescriptors,dm=Object.getOwnPropertySymbols,pm=Object.prototype.hasOwnProperty,hm=Object.prototype.propertyIsEnumerable,fm=(e,t,n)=>t in e?lm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const mm=(e,t)=>(0,Hp.of)(t),gm=e=>t=>t.pipe((0,Hp.mergeMap)((([t,...n])=>{const r=n.flatMap((n=>{var r,i;return null!=(i=null==(r=e.get(n.request.requestId))?void 0:r(t,n))?i:(0,Hp.of)(n)}));return(0,Hp.forkJoin)([(0,Hp.of)(t),...r])})),(0,Hp.map)((([e,...t])=>{var n;return((e,t)=>cm(e,um(t)))(((e,t)=>{for(var n in t||(t={}))pm.call(t,n)&&fm(e,n,t[n]);if(dm)for(var n of dm(t))hm.call(t,n)&&fm(e,n,t[n]);return e})({},e),{series:[...e.series,...t.flatMap((e=>e.series))],annotations:[...null!=(n=e.annotations)?n:[],...t.flatMap((e=>{var t;return null!=(t=e.annotations)?t:[]}))]})})));var ym=Object.defineProperty,bm=Object.defineProperties,vm=Object.getOwnPropertyDescriptors,wm=Object.getOwnPropertySymbols,Sm=Object.prototype.hasOwnProperty,Em=Object.prototype.propertyIsEnumerable,xm=(e,t,n)=>t in e?ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Om=(e,t)=>{for(var n in t||(t={}))Sm.call(t,n)&&xm(e,n,t[n]);if(wm)for(var n of wm(t))Em.call(t,n)&&xm(e,n,t[n]);return e},_m=(e,t)=>bm(e,vm(t));function Tm(e){const t=e.getRoot();return Nf(t)?t.enrichDataRequest(e):null}let Cm,km=new Set;function Pm(e){return t=>{const n=nm.getQueryController(e.origin);return n?new Hp.Observable((r=>{e.cancel||(e.cancel=()=>r.complete()),n.queryStarted(e);let i=!1;const a=t.subscribe({next:t=>{i||t.state===Hh.Loading||(i=!0,n.queryCompleted(e)),r.next(t)},error:e=>r.error(e),complete:()=>{r.complete()}});return()=>{a.unsubscribe(),i||n.queryCompleted(e)}})):t}}const Am=new Set;function Rm(e,t){e.setState(t)}class Dm extends vh{constructor(){super(...arguments),this._urlSync=new jm(this)}validateAndUpdate(){return this.getValueOptions({}).pipe((0,Hp.map)((e=>(this.updateValueGivenNewOptions(e),{}))))}onCancel(){this.setStateHelper({loading:!1});const e=this.parent;null==e||e.cancel(this)}updateValueGivenNewOptions(e){const{value:t,text:n}=this.state,r=this.getStateUpdateGivenNewOptions(e,t,n);this.interceptStateUpdateAfterValidation(r),this.setStateHelper(r),(r.value!==t||r.text!==n||this.hasAllValue())&&this.publishEvent(new hf(this),!0)}getStateUpdateGivenNewOptions(e,t,n){const r={options:e,loading:!1,value:t,text:n};if(0===e.length)return this.state.defaultToAll||this.state.includeAll?(r.value=kf,r.text=Cf):this.state.isMulti?(r.value=[],r.text=[]):(r.value="",r.text=""),r;if(this.hasAllValue())return this.state.includeAll||(r.value=e[0].value,r.text=e[0].label,this.state.isMulti&&(r.value=[r.value],r.text=[r.text])),r;if(this.state.isMulti){const i=(Array.isArray(t)?t:[t]).filter((t=>e.find((e=>e.value===t)))),a=i.map((t=>e.find((e=>e.value===t)).label));if(0===i.length){const t=this.getDefaultMultiState(e);r.value=t.value,r.text=t.text}else(0,Bc.isEqual)(i,t)||(r.value=i),(0,Bc.isEqual)(a,n)||(r.text=a);return r}let i=function(e,t,n){let r;for(const i of n){if(i.value===e)return i;i.label===t&&(r=i)}return r}(t,n,e);return i?(r.text=i.label,r.value=i.value):this.state.defaultToAll?(r.value=kf,r.text=Cf):(r.value=e[0].value,r.text=e[0].label),r}interceptStateUpdateAfterValidation(e){const t=e.value===kf&&this.state.text===Cf;this.skipNextValidation&&e.value!==this.state.value&&!t&&(e.value=this.state.value,e.text=this.state.text),this.skipNextValidation=!1}getValue(){return this.hasAllValue()?this.state.allValue?new Im(this.state.allValue,this):this.state.options.map((e=>e.value)):this.state.value}getValueText(){return this.hasAllValue()?Cf:Array.isArray(this.state.text)?this.state.text.join(" + "):String(this.state.text)}hasAllValue(){const e=this.state.value;return e===kf||Array.isArray(e)&&e[0]===kf}getDefaultMultiState(e){return this.state.defaultToAll?{value:[kf],text:[Cf]}:e.length>0?{value:[e[0].value],text:[e[0].label]}:{value:[],text:[]}}changeValueTo(e,t){if(e!==this.state.value||t!==this.state.text){if(t||(t=Array.isArray(e)?e.map((e=>this.findLabelTextForValue(e))):this.findLabelTextForValue(e)),Array.isArray(e)){if(0===e.length){const n=this.getDefaultMultiState(this.state.options);e=n.value,t=n.text}e[e.length-1]===kf?(e=[kf],t=[Cf]):e[0]===kf&&e.length>1&&(e.shift(),Array.isArray(t)&&t.shift())}(0,Bc.isEqual)(e,this.state.value)&&(0,Bc.isEqual)(t,this.state.text)||(this.setStateHelper({value:e,text:t,loading:!1}),this.publishEvent(new hf(this),!0))}}findLabelTextForValue(e){if(e===kf)return Cf;const t=this.state.options.find((t=>t.value===e));if(t)return t.label;const n=this.state.options.find((t=>t.label===e));return n?n.label:e}setStateHelper(e){Rm(this,e)}getOptionsForSelect(){let e=this.state.options;if(this.state.includeAll&&(e=[{value:kf,label:Cf},...e]),!Array.isArray(this.state.value)){const t=e.find((e=>e.value===this.state.value));t||(e=[{value:this.state.value,label:String(this.state.text)},...e])}return e}}class jm{constructor(e){this._sceneObject=e}getKey(){return`var-${this._sceneObject.state.name}`}getKeys(){return this._sceneObject.state.skipUrlSync?[]:[this.getKey()]}getUrlState(){if(this._sceneObject.state.skipUrlSync)return{};let e=null,t=this._sceneObject.state.value;return e=Array.isArray(t)?t.map(String):this._sceneObject.state.isMulti?[String(t)]:String(t),{[this.getKey()]:e}}updateFromUrl(e){let t=e[this.getKey()];null!=t&&(this._sceneObject.state.includeAll&&(t=function(e){if((0,Bc.isArray)(e)&&e[0]===Cf)return[kf];if(e===Cf)return kf;return e}(t)),this._sceneObject.state.allValue&&this._sceneObject.state.allValue===t&&(t=kf),this._sceneObject.isActive||(this._sceneObject.skipNextValidation=!0),this._sceneObject.changeValueTo(t))}}class Im{constructor(e,t){this._value=e,this._variable=t}formatter(e){return e===qh.Text?Cf:e===qh.PercentEncode?vf.get(qh.PercentEncode).formatter(this._value,[],this._variable):e===qh.QueryParam?vf.get(qh.QueryParam).formatter(Cf,[],this._variable):this._value}}const Nm={RadioButton:{container:"data-testid radio-button"},Breadcrumbs:{breadcrumb:e=>`data-testid ${e} breadcrumb`},TimePicker:{openButton:"data-testid TimePicker Open Button",overlayContent:"data-testid TimePicker Overlay Content",fromField:"data-testid Time Range from field",toField:"data-testid Time Range to field",applyTimeRange:"data-testid TimePicker submit button",copyTimeRange:"data-testid TimePicker copy button",pasteTimeRange:"data-testid TimePicker paste button",calendar:{label:"data-testid Time Range calendar",openButton:"data-testid Open time range calendar",closeButton:"data-testid Close time range Calendar"},absoluteTimeRangeTitle:"data-testid-absolute-time-range-narrow"},DataSourcePermissions:{form:()=>'form[name="addPermission"]',roleType:"Role to add new permission to",rolePicker:"Built-in role picker",permissionLevel:"Permission Level"},DateTimePicker:{input:"data-testid date-time-input"},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:"Test Data Query scenario select container",scenarioSelect:"Test Data Query scenario select",max:"TestData max",min:"TestData min",noise:"TestData noise",seriesCount:"TestData series count",spread:"TestData spread",startValue:"TestData start value",drop:"TestData drop values"}},DataSourceHttpSettings:{urlInput:"data-testid Datasource HTTP settings url"},Jaeger:{traceIDInput:"Trace ID"},Prometheus:{configPage:{connectionSettings:"Data source connection URL",manageAlerts:"prometheus-alerts-manager",scrapeInterval:"data-testid scrape interval",queryTimeout:"data-testid query timeout",defaultEditor:"data-testid default editor",disableMetricLookup:"disable-metric-lookup",prometheusType:"data-testid prometheus type",prometheusVersion:"data-testid prometheus version",cacheLevel:"data-testid cache level",incrementalQuerying:"prometheus-incremental-querying",queryOverlapWindow:"data-testid query overlap window",disableRecordingRules:"disable-recording-rules",customQueryParameters:"data-testid custom query parameters",httpMethod:"data-testid http method",exemplarsAddButton:"data-testid Add exemplar config button",internalLinkSwitch:"data-testid Internal link switch",codeModeMetricNamesSuggestionLimit:"data-testid code mode metric names suggestion limit"},queryEditor:{explain:"data-testid prometheus explain switch wrapper",editorToggle:"data-testid QueryEditorModeToggle",options:"data-testid prometheus options",legend:"data-testid prometheus legend wrapper",format:"data-testid prometheus format",step:"prometheus-step",type:"data-testid prometheus type",exemplars:"prometheus-exemplars",builder:{metricSelect:"data-testid metric select",hints:"data-testid prometheus hints",metricsExplorer:"data-testid metrics explorer",queryAdvisor:"data-testid query advisor"},code:{queryField:"data-testid prometheus query field",metricsCountInfo:"data-testid metrics count disclaimer",metricsBrowser:{openButton:"data-testid open metrics browser",selectMetric:"data-testid select a metric",seriesLimit:"data-testid series limit",metricList:"data-testid metric list",labelNamesFilter:"data-testid label names filter",labelValuesFilter:"data-testid label values filter",useQuery:"data-testid use query",useAsRateQuery:"data-testid use as rate query",validateSelector:"data-testid validate selector",clear:"data-testid clear"}}},exemplarMarker:"data-testid Exemplar marker",variableQueryEditor:{queryType:"data-testid query type",labelnames:{metricRegex:"data-testid label names metric regex"},labelValues:{labelSelect:"data-testid label values label select"},metricNames:{metricRegex:"data-testid metric names metric regex"},varQueryResult:"data-testid variable query result",seriesQuery:"data-testid prometheus series query",classicQuery:"data-testid prometheus classic query"},annotations:{minStep:"prometheus-annotation-min-step",title:"data-testid prometheus annotation title",tags:"data-testid prometheus annotation tags",text:"data-testid prometheus annotation text",seriesValueAsTimestamp:"data-testid prometheus annotation series value as timestamp"}}},Menu:{MenuComponent:e=>`${e} menu`,MenuGroup:e=>`${e} menu group`,MenuItem:e=>`${e} menu item`,SubMenu:{container:"data-testid SubMenu container",icon:"data-testid SubMenu icon"}},Panels:{Panel:{title:e=>`data-testid Panel header ${e}`,content:"data-testid panel content",headerItems:e=>`data-testid Panel header item ${e}`,menuItems:e=>`data-testid Panel menu item ${e}`,menu:e=>`data-testid Panel menu ${e}`,containerByTitle:e=>`${e} panel`,headerCornerInfo:e=>`Panel header ${e}`,status:e=>`data-testid Panel status ${e}`,loadingBar:()=>"Panel loading bar",HoverWidget:{container:"data-testid hover-header-container",dragIcon:"data-testid drag-icon"},PanelDataErrorMessage:"data-testid Panel data error message"},Visualization:{Graph:{container:"Graph container",VisualizationTab:{legendSection:"Legend section"},Legend:{legendItemAlias:e=>`gpl alias ${e}`,showLegendSwitch:"gpl show legend"},xAxis:{labels:()=>"div.flot-x-axis > div.flot-tick-label"}},BarGauge:{value:"Bar gauge value",valueV2:"data-testid Bar gauge value"},PieChart:{svgSlice:"data testid Pie Chart Slice"},Text:{container:()=>".markdown-html"},Table:{header:"table header",footer:"table-footer",body:"data-testid table body"}}},VizLegend:{seriesName:e=>`data-testid VizLegend series ${e}`},Drawer:{General:{title:e=>`Drawer title ${e}`,expand:"Drawer expand",contract:"Drawer contract",close:"data-testid Drawer close",rcContentWrapper:()=>".rc-drawer-content-wrapper",subtitle:"data-testid drawer subtitle"},DashboardSaveDrawer:{saveButton:"data-testid Save dashboard drawer button",saveAsButton:"data-testid Save as dashboard drawer button",saveAsTitleInput:"Save dashboard title field"}},PanelEditor:{General:{content:"data-testid Panel editor content"},OptionsPane:{content:"data-testid Panel editor option pane content",select:"Panel editor option pane select",fieldLabel:e=>`${e} field property editor`,fieldInput:e=>`data-testid Panel editor option pane field input ${e}`},DataPane:{content:"data-testid Panel editor data pane content"},applyButton:"data-testid Apply changes and go back to dashboard",toggleVizPicker:"data-testid toggle-viz-picker",toggleVizOptions:"data-testid toggle-viz-options",toggleTableView:"data-testid toggle-table-view",showZoomField:"Map controls Show zoom control field property editor",showAttributionField:"Map controls Show attribution field property editor",showScaleField:"Map controls Show scale field property editor",showMeasureField:"Map controls Show measure tools field property editor",showDebugField:"Map controls Show debug field property editor",measureButton:"show measure tools"},PanelInspector:{Data:{content:"Panel inspector Data content"},Stats:{content:"Panel inspector Stats content"},Json:{content:"data-testid Panel inspector Json content"},Query:{content:"Panel inspector Query content",refreshButton:"Panel inspector Query refresh button",jsonObjectKeys:()=>".json-formatter-key"}},Tab:{title:e=>`data-testid Tab ${e}`,active:()=>'[class*="-activeTabStyle"]'},RefreshPicker:{runButton:"RefreshPicker run button",intervalButton:"RefreshPicker interval button",runButtonV2:"data-testid RefreshPicker run button",intervalButtonV2:"data-testid RefreshPicker interval button"},QueryTab:{content:"Query editor tab content",queryInspectorButton:"Query inspector button",queryHistoryButton:"data-testid query-history-button",addQuery:"data-testid query-tab-add-query",queryGroupTopSection:"data-testid query group top section",addExpression:"data-testid query-tab-add-expression"},QueryHistory:{queryText:"Query text"},QueryEditorRows:{rows:"Query editor row"},QueryEditorRow:{actionButton:e=>`data-testid ${e}`,title:e=>`Query editor row title ${e}`,container:e=>`Query editor row ${e}`},AlertTab:{content:"data-testid Alert editor tab content"},AlertRules:{groupToggle:"data-testid group-collapse-toggle",toggle:"data-testid collapse-toggle",expandedContent:"data-testid expanded-content",previewButton:"data-testid alert-rule preview-button",ruleNameField:"data-testid alert-rule name-field",newFolderButton:"data-testid alert-rule new-folder-button",newFolderNameField:"data-testid alert-rule name-folder-name-field",newFolderNameCreateButton:"data-testid alert-rule name-folder-name-create-button",newEvaluationGroupButton:"data-testid alert-rule new-evaluation-group-button",newEvaluationGroupName:"data-testid alert-rule new-evaluation-group-name",newEvaluationGroupInterval:"data-testid alert-rule new-evaluation-group-interval",newEvaluationGroupCreate:"data-testid alert-rule new-evaluation-group-create-button"},Alert:{alert:e=>`Alert ${e}`,alertV2:e=>`data-testid Alert ${e}`},TransformTab:{content:"data-testid Transform editor tab content",newTransform:e=>`data-testid New transform ${e}`,transformationEditor:e=>`data-testid Transformation editor ${e}`,transformationEditorDebugger:e=>`data-testid Transformation editor debugger ${e}`},Transforms:{card:e=>`data-testid New transform ${e}`,disableTransformationButton:"data-testid Disable transformation button",Reduce:{modeLabel:"data-testid Transform mode label",calculationsLabel:"data-testid Transform calculations label"},SpatialOperations:{actionLabel:"root Action field property editor",locationLabel:"root Location Mode field property editor",location:{autoOption:"Auto location option",coords:{option:"Coords location option",latitudeFieldLabel:"root Latitude field field property editor",longitudeFieldLabel:"root Longitude field field property editor"},geohash:{option:"Geohash location option",geohashFieldLabel:"root Geohash field field property editor"},lookup:{option:"Lookup location option",lookupFieldLabel:"root Lookup field field property editor",gazetteerFieldLabel:"root Gazetteer field property editor"}}},searchInput:"data-testid search transformations",noTransformationsMessage:"data-testid no transformations message",addTransformationButton:"data-testid add transformation button",removeAllTransformationsButton:"data-testid remove all transformations button"},NavBar:{Configuration:{button:"Configuration"},Toggle:{button:"data-testid Toggle menu"},Reporting:{button:"Reporting"}},NavMenu:{Menu:"data-testid navigation mega-menu",item:"data-testid Nav menu item"},NavToolbar:{container:"data-testid Nav toolbar",shareDashboard:"data-testid Share dashboard",markAsFavorite:"data-testid Mark as favorite",editDashboard:{editButton:"data-testid Edit dashboard button",saveButton:"data-testid Save dashboard button",exitButton:"data-testid Exit edit mode button",settingsButton:"data-testid Dashboard settings",addRowButton:"data-testid Add row button",addLibraryPanelButton:"data-testid Add a panel from the panel library button",addVisualizationButton:"data-testid Add new visualization menu item",pastePanelButton:"data-testid Paste panel button",discardChangesButton:"data-testid Discard changes button",discardLibraryPanelButton:"data-testid Discard library panel button",unlinkLibraryPanelButton:"data-testid Unlink library panel button",saveLibraryPanelButton:"data-testid Save library panel button",backToDashboardButton:"data-testid Back to dashboard button"}},PageToolbar:{container:()=>".page-toolbar",item:e=>`${e}`,itemButton:e=>`data-testid ${e}`},QueryEditorToolbarItem:{button:e=>`QueryEditor toolbar item button ${e}`},BackButton:{backArrow:"data-testid Go Back"},OptionsGroup:{group:e=>e?`data-testid Options group ${e}`:"data-testid Options group",toggle:e=>e?`data-testid Options group ${e} toggle`:"data-testid Options group toggle"},PluginVisualization:{item:e=>`Plugin visualization item ${e}`,current:()=>'[class*="-currentVisualizationItem"]'},Select:{option:"data-testid Select option",toggleAllOptions:"data-testid toggle all options",input:()=>'input[id*="time-options-input"]',singleValue:()=>'div[class*="-singleValue"]'},FieldConfigEditor:{content:"Field config editor content"},OverridesConfigEditor:{content:"Field overrides editor content"},FolderPicker:{container:"Folder picker select container",containerV2:"data-testid Folder picker select container",input:"data-testid folder-picker-input"},ReadonlyFolderPicker:{container:"data-testid Readonly folder picker select container"},DataSourcePicker:{container:"data-testid Data source picker select container",input:()=>'input[id="data-source-picker"]',inputV2:"data-testid Select a data source",dataSourceList:"data-testid Data source list dropdown",advancedModal:{dataSourceList:"data-testid Data source list",builtInDataSourceList:"data-testid Built in data source list"}},TimeZonePicker:{container:"Time zone picker select container",containerV2:"data-testid Time zone picker select container",changeTimeSettingsButton:"data-testid Time zone picker Change time settings button"},WeekStartPicker:{container:"Choose starting day of the week",containerV2:"data-testid Choose starting day of the week",placeholder:"Choose starting day of the week"},TraceViewer:{spanBar:"data-testid SpanBar--wrapper"},QueryField:{container:"data-testid Query field"},QueryBuilder:{queryPatterns:"data-testid Query patterns",labelSelect:"data-testid Select label",inputSelect:"data-testid Select label-input",valueSelect:"data-testid Select value",matchOperatorSelect:"data-testid Select match operator"},ValuePicker:{button:e=>`data-testid Value picker button ${e}`,select:e=>`data-testid Value picker select ${e}`},Search:{section:"Search section",sectionV2:"data-testid Search section",items:"Search items",itemsV2:"data-testid Search items",cards:"data-testid Search cards",collapseFolder:e=>`data-testid Collapse folder ${e}`,expandFolder:e=>`data-testid Expand folder ${e}`,dashboardItem:e=>`${Nm.Search.dashboardItems} ${e}`,dashboardCard:e=>`data-testid Search card ${e}`,folderHeader:e=>`data-testid Folder header ${e}`,folderContent:e=>`data-testid Folder content ${e}`,dashboardItems:"data-testid Dashboard search item"},DashboardLinks:{container:"data-testid Dashboard link container",dropDown:"data-testid Dashboard link dropdown",link:"data-testid Dashboard link"},LoadingIndicator:{icon:"data-testid Loading indicator"},CallToActionCard:{button:e=>`Call to action button ${e}`,buttonV2:e=>`data-testid Call to action button ${e}`},DataLinksContextMenu:{singleLink:"data-testid Data link"},CodeEditor:{container:"data-testid Code editor container"},ReactMonacoEditor:{editorLazy:"data-testid ReactMonacoEditor editorLazy"},DashboardImportPage:{textarea:"data-testid-import-dashboard-textarea",submit:"data-testid-load-dashboard"},ImportDashboardForm:{name:"data-testid-import-dashboard-title",submit:"data-testid-import-dashboard-submit"},PanelAlertTabContent:{content:"data-testid Unified alert editor tab content"},VisualizationPreview:{card:e=>`data-testid suggestion-${e}`},ColorSwatch:{name:"data-testid-colorswatch"},DashboardRow:{title:e=>`data-testid dashboard-row-title-${e}`},UserProfile:{profileSaveButton:"data-testid-user-profile-save",preferencesSaveButton:"data-testid-shared-prefs-save",orgsTable:"data-testid-user-orgs-table",sessionsTable:"data-testid-user-sessions-table",extensionPointTabs:"data-testid-extension-point-tabs",extensionPointTab:e=>`data-testid-extension-point-tab-${e}`},FileUpload:{inputField:"data-testid-file-upload-input-field",fileNameSpan:"data-testid-file-upload-file-name"},DebugOverlay:{wrapper:"debug-overlay"},OrgRolePicker:{input:"Role"},AnalyticsToolbarButton:{button:"Dashboard insights"},Variables:{variableOption:"data-testid variable-option",variableLinkWrapper:"data-testid variable-link-wrapper"},Annotations:{annotationsTypeInput:"data-testid annotations-type-input",annotationsChoosePanelInput:"data-testid choose-panels-input",editor:{testButton:"data-testid annotations-test-button",resultContainer:"data-testid annotations-query-result-container"}},Tooltip:{container:"data-testid tooltip"},ReturnToPrevious:{buttonGroup:"data-testid dismissable button group",backButton:"data-testid back",dismissButton:"data-testid dismiss"},SQLQueryEditor:{selectColumn:"data-testid select-column",selectAggregation:"data-testid select-aggregation",selectAlias:"data-testid select-alias",filterConjunction:"data-testid filter-conjunction",filterField:"data-testid filter-field",filterOperator:"data-testid filter-operator",headerTableSelector:"data-testid header-table-selector",headerFilterSwitch:"data-testid header-filter-switch",headerGroupSwitch:"data-testid header-group-switch",headerOrderSwitch:"data-testid header-order-switch",headerPreviewSwitch:"data-testid header-preview-switch"},EntityNotFound:{container:"data-testid entity-not-found"}},Lm={Login:{url:"/login",username:"data-testid Username input field",password:"data-testid Password input field",submit:"data-testid Login button",skip:"data-testid Skip change password button"},Home:{url:"/"},DataSource:{name:"data-testid Data source settings page name input field",delete:"Data source settings page Delete button",readOnly:"data-testid Data source settings page read only message",saveAndTest:"data-testid Data source settings page Save and Test button",alert:"data-testid Data source settings page Alert"},DataSources:{url:"/datasources",dataSources:e=>`Data source list item ${e}`},EditDataSource:{url:e=>`/datasources/edit/${e}`,settings:"Datasource settings page basic settings"},AddDataSource:{url:"/datasources/new",dataSourcePlugins:e=>`Data source plugin item ${e}`,dataSourcePluginsV2:e=>`Add new data source ${e}`},ConfirmModal:{delete:"data-testid Confirm Modal Danger Button"},AddDashboard:{url:"/dashboard/new",itemButton:e=>`data-testid ${e}`,addNewPanel:"data-testid Add new panel",addNewRow:"data-testid Add new row",addNewPanelLibrary:"data-testid Add new panel from panel library"},Dashboard:{url:e=>`/d/${e}`,DashNav:{nav:"Dashboard navigation",navV2:"data-testid Dashboard navigation",publicDashboardTag:"data-testid public dashboard tag",shareButton:"data-testid share-button",scrollContainer:"data-testid Dashboard canvas scroll container",newShareButton:{container:"data-testid new share button",shareLink:"data-testid new share link-button",arrowMenu:"data-testid new share button arrow menu",menu:{container:"data-testid new share button menu",shareInternally:"data-testid new share button share internally",shareExternally:"data-testid new share button share externally",shareSnapshot:"data-testid new share button share snapshot"}},NewExportButton:{container:"data-testid new export button",arrowMenu:"data-testid new export button arrow menu",Menu:{container:"data-testid new export button menu",exportAsJson:"data-testid new export button export as json"}},playlistControls:{prev:"data-testid playlist previous dashboard button",stop:"data-testid playlist stop dashboard button",next:"data-testid playlist next dashboard button"}},Controls:"data-testid dashboard controls",SubMenu:{submenu:"Dashboard submenu",submenuItem:"data-testid template variable",submenuItemLabels:e=>`data-testid Dashboard template variables submenu Label ${e}`,submenuItemValueDropDownValueLinkTexts:e=>`data-testid Dashboard template variables Variable Value DropDown value link text ${e}`,submenuItemValueDropDownDropDown:"Variable options",submenuItemValueDropDownOptionTexts:e=>`data-testid Dashboard template variables Variable Value DropDown option text ${e}`,Annotations:{annotationsWrapper:"data-testid annotation-wrapper",annotationLabel:e=>`data-testid Dashboard annotations submenu Label ${e}`,annotationToggle:e=>`data-testid Dashboard annotations submenu Toggle ${e}`}},Settings:{Actions:{close:"data-testid dashboard-settings-close"},General:{deleteDashBoard:"data-testid Dashboard settings page delete dashboard button",sectionItems:e=>`Dashboard settings section item ${e}`,saveDashBoard:"Dashboard settings aside actions Save button",saveAsDashBoard:"Dashboard settings aside actions Save As button",timezone:"Time zone picker select container",title:"General"},Annotations:{List:{addAnnotationCTA:Nm.CallToActionCard.button("Add annotation query"),addAnnotationCTAV2:Nm.CallToActionCard.buttonV2("Add annotation query"),annotations:"data-testid list-annotations"},Settings:{name:"data-testid Annotations settings name input"},NewAnnotation:{panelFilterSelect:"data-testid annotations-panel-filter",showInLabel:"data-testid show-in-label",previewInDashboard:"data-testid annotations-preview",delete:"data-testid annotations-delete",apply:"data-testid annotations-apply",enable:"data-testid annotation-enable",hide:"data-testid annotation-hide"}},Variables:{List:{addVariableCTA:Nm.CallToActionCard.button("Add variable"),addVariableCTAV2:Nm.CallToActionCard.buttonV2("Add variable"),newButton:"Variable editor New variable button",table:"Variable editor Table",tableRowNameFields:e=>`Variable editor Table Name field ${e}`,tableRowDefinitionFields:e=>`Variable editor Table Definition field ${e}`,tableRowArrowUpButtons:e=>`Variable editor Table ArrowUp button ${e}`,tableRowArrowDownButtons:e=>`Variable editor Table ArrowDown button ${e}`,tableRowDuplicateButtons:e=>`Variable editor Table Duplicate button ${e}`,tableRowRemoveButtons:e=>`Variable editor Table Remove button ${e}`},Edit:{General:{headerLink:"Variable editor Header link",modeLabelNew:"Variable editor Header mode New",modeLabelEdit:"Variable editor Header mode Edit",generalNameInput:"Variable editor Form Name field",generalNameInputV2:"data-testid Variable editor Form Name field",generalTypeSelect:"Variable editor Form Type select",generalTypeSelectV2:"data-testid Variable editor Form Type select",generalLabelInput:"Variable editor Form Label field",generalLabelInputV2:"data-testid Variable editor Form Label field",generalHideSelect:"Variable editor Form Hide select",generalHideSelectV2:"data-testid Variable editor Form Hide select",selectionOptionsMultiSwitch:"data-testid Variable editor Form Multi switch",selectionOptionsIncludeAllSwitch:"data-testid Variable editor Form IncludeAll switch",selectionOptionsCustomAllInput:"data-testid Variable editor Form IncludeAll field",previewOfValuesOption:"data-testid Variable editor Preview of Values option",submitButton:"data-testid Variable editor Run Query button",applyButton:"data-testid Variable editor Apply button"},QueryVariable:{queryOptionsDataSourceSelect:Nm.DataSourcePicker.inputV2,queryOptionsRefreshSelect:"Variable editor Form Query Refresh select",queryOptionsRefreshSelectV2:"data-testid Variable editor Form Query Refresh select",queryOptionsRegExInput:"Variable editor Form Query RegEx field",queryOptionsRegExInputV2:"data-testid Variable editor Form Query RegEx field",queryOptionsSortSelect:"Variable editor Form Query Sort select",queryOptionsSortSelectV2:"data-testid Variable editor Form Query Sort select",queryOptionsQueryInput:"data-testid Variable editor Form Default Variable Query Editor textarea",valueGroupsTagsEnabledSwitch:"Variable editor Form Query UseTags switch",valueGroupsTagsTagsQueryInput:"Variable editor Form Query TagsQuery field",valueGroupsTagsTagsValuesQueryInput:"Variable editor Form Query TagsValuesQuery field"},ConstantVariable:{constantOptionsQueryInput:"Variable editor Form Constant Query field",constantOptionsQueryInputV2:"data-testid Variable editor Form Constant Query field"},DatasourceVariable:{datasourceSelect:"data-testid datasource variable datasource type"},TextBoxVariable:{textBoxOptionsQueryInput:"Variable editor Form TextBox Query field",textBoxOptionsQueryInputV2:"data-testid Variable editor Form TextBox Query field"},CustomVariable:{customValueInput:"data-testid custom-variable-input"},IntervalVariable:{intervalsValueInput:"data-testid interval variable intervals input",autoEnabledCheckbox:"data-testid interval variable auto value checkbox",stepCountIntervalSelect:"data-testid interval variable step count input",minIntervalInput:"data-testid interval variable mininum interval input"},GroupByVariable:{dataSourceSelect:Nm.DataSourcePicker.inputV2,infoText:"data-testid group by variable info text",modeToggle:"data-testid group by variable mode toggle"},AdHocFiltersVariable:{datasourceSelect:Nm.DataSourcePicker.inputV2,infoText:"data-testid ad-hoc filters variable info text",modeToggle:"data-testid ad-hoc filters variable mode toggle"}}}},Annotations:{marker:"data-testid annotation-marker"},Rows:{Repeated:{ConfigSection:{warningMessage:"data-testid Repeated rows warning message"}}}},Dashboards:{url:"/dashboards",dashboards:e=>`Dashboard search item ${e}`},SaveDashboardAsModal:{newName:"Save dashboard title field",save:"Save dashboard button"},SaveDashboardModal:{save:"Dashboard settings Save Dashboard Modal Save button",saveVariables:"Dashboard settings Save Dashboard Modal Save variables checkbox",saveTimerange:"Dashboard settings Save Dashboard Modal Save timerange checkbox",saveRefresh:"Dashboard settings Save Dashboard Modal Save refresh checkbox"},SharePanelModal:{linkToRenderedImage:"Link to rendered image"},ShareDashboardModal:{PublicDashboard:{WillBePublicCheckbox:"data-testid public dashboard will be public checkbox",LimitedDSCheckbox:"data-testid public dashboard limited datasources checkbox",CostIncreaseCheckbox:"data-testid public dashboard cost may increase checkbox",PauseSwitch:"data-testid public dashboard pause switch",EnableAnnotationsSwitch:"data-testid public dashboard on off switch for annotations",CreateButton:"data-testid public dashboard create button",DeleteButton:"data-testid public dashboard delete button",CopyUrlInput:"data-testid public dashboard copy url input",CopyUrlButton:"data-testid public dashboard copy url button",SettingsDropdown:"data-testid public dashboard settings dropdown",TemplateVariablesWarningAlert:"data-testid public dashboard disabled template variables alert",UnsupportedDataSourcesWarningAlert:"data-testid public dashboard unsupported data sources alert",NoUpsertPermissionsWarningAlert:"data-testid public dashboard no upsert permissions alert",EnableTimeRangeSwitch:"data-testid public dashboard on off switch for time range",EmailSharingConfiguration:{Container:"data-testid email sharing config container",ShareType:"data-testid public dashboard share type",EmailSharingInput:"data-testid public dashboard email sharing input",EmailSharingInviteButton:"data-testid public dashboard email sharing invite button",EmailSharingList:"data-testid public dashboard email sharing list",DeleteEmail:"data-testid public dashboard delete email button",ReshareLink:"data-testid public dashboard reshare link button"}},SnapshotScene:{url:e=>`/dashboard/snapshot/${e}`,PublishSnapshot:"data-testid publish snapshot button",CopyUrlButton:"data-testid snapshot copy url button",CopyUrlInput:"data-testid snapshot copy url input"}},ShareDashboardDrawer:{ShareInternally:{container:"data-testid share internally drawer container",lockTimeRangeSwitch:"data-testid share internally lock time range switch",shortenUrlSwitch:"data-testid share internally shorten url switch",copyUrlButton:"data-testid share internally copy url button"},ShareExternally:{container:"data-testid share externally drawer container",publicAlert:"data-testid public share alert",emailSharingAlert:"data-testid email share alert",shareTypeSelect:"data-testid share externally share type select",Creation:{PublicShare:{createButton:"data-testid public share dashboard create button",cancelButton:"data-testid public share dashboard cancel button"},EmailShare:{createButton:"data-testid email share dashboard create button",cancelButton:"data-testid email share dashboard cancel button"},willBePublicCheckbox:"data-testid share dashboard will be public checkbox"},Configuration:{enableTimeRangeSwitch:"data-testid share externally enable time range switch",enableAnnotationsSwitch:"data-testid share externally enable annotations switch",copyUrlButton:"data-testid share externally copy url button",revokeAccessButton:"data-testid share externally revoke access button",toggleAccessButton:"data-testid share externally pause or resume access button"}},ShareSnapshot:{url:e=>`/dashboard/snapshot/${e}`,container:"data-testid share snapshot drawer container",publishSnapshot:"data-testid share snapshot publish button",copyUrlButton:"data-testid share snapshot copy url button"}},ExportDashboardDrawer:{ExportAsJson:{container:"data-testid export as json drawer container",codeEditor:"data-testid export as json code editor",exportExternallyToggle:"data-testid export as json externally switch",saveToFileButton:"data-testid export as json save to file button",copyToClipboardButton:"data-testid export as json copy to clipboard button",cancelButton:"data-testid export as json cancel button"}},PublicDashboard:{page:"public-dashboard-page",NotAvailable:{container:"public-dashboard-not-available",title:"public-dashboard-title",pausedDescription:"public-dashboard-paused-description"},footer:"public-dashboard-footer"},PublicDashboardScene:{loadingPage:"public-dashboard-scene-loading-page",page:"public-dashboard-scene-page",controls:"public-dashboard-controls"},RequestViewAccess:{form:"request-view-access-form",recipientInput:"request-view-access-recipient-input",submitButton:"request-view-access-submit-button"},PublicDashboardConfirmAccess:{submitButton:"data-testid confirm-access-submit-button"},Explore:{url:"/explore",General:{container:"data-testid Explore",graph:"Explore Graph",table:"Explore Table",scrollView:"data-testid explorer scroll view"},QueryHistory:{container:"data-testid QueryHistory"}},SoloPanel:{url:e=>`/d-solo/${e}`},PluginsList:{page:"Plugins list page",list:"Plugins list",listItem:"Plugins list item",signatureErrorNotice:"data-testid Unsigned plugins notice"},PluginPage:{page:"Plugin page",signatureInfo:"data-testid Plugin signature info",disabledInfo:"data-testid Plugin disabled info"},PlaylistForm:{name:"Playlist name",interval:"Playlist interval",itemDelete:"data-testid playlist-form-delete-item"},BrowseDashboards:{table:{body:"data-testid browse-dashboards-table",row:e=>`data-testid browse dashboards row ${e}`,checkbox:e=>`data-testid ${e} checkbox`},NewFolderForm:{form:"data-testid new folder form",nameInput:"data-testid new-folder-name-input",createButton:"data-testid new-folder-create-button"}},Search:{url:"/?search=openn",FolderView:{url:"/?search=open&layout=folders"}},PublicDashboards:{ListItem:{linkButton:"public-dashboard-link-button",configButton:"public-dashboard-configuration-button",trashcanButton:"public-dashboard-remove-button",pauseSwitch:"data-testid public dashboard pause switch"}},UserListPage:{tabs:{allUsers:"data-testid all-users-tab",orgUsers:"data-testid org-users-tab",anonUserDevices:"data-testid anon-user-devices-tab",publicDashboardsUsers:"data-testid public-dashboards-users-tab",users:"data-testid users-tab"},org:{url:"/org/users"},admin:{url:"/admin/users"},publicDashboards:{container:"data-testid public-dashboards-users-list"},UserListAdminPage:{container:"data-testid user-list-admin-page"},UsersListPage:{container:"data-testid users-list-page"},UserAnonListPage:{container:"data-testid user-anon-list-page"},UsersListPublicDashboardsPage:{container:"data-testid users-list-public-dashboards-page",DashboardsListModal:{listItem:e=>`data-testid dashboards-list-item-${e}`}}},ProfilePage:{url:"/profile"}},Mm={pages:Lm,components:Nm};function Fm(e,t){const n=new sl;let r=e;const i=[],a=1e4;return t&&(r=[{value:kf,label:Cf},...r]),e=>{if(""===e)return r.length>a?r.slice(0,a):r;if(0===i.length)for(let e=0;e<r.length;e++)i.push(r[e].label);const t=n.filter(i,e),o=[];if(t){for(let e=0;e<t.length;e++)if(o.push(r[t[e]]),o.length>a)return o;return o}return r.length>a?r.slice(0,a):r}}var $m=Object.defineProperty,Bm=Object.defineProperties,Vm=Object.getOwnPropertyDescriptors,Um=Object.getOwnPropertySymbols,zm=Object.prototype.hasOwnProperty,qm=Object.prototype.propertyIsEnumerable,Hm=(e,t,n)=>t in e?$m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const Gm=()=>!0;function Wm({model:e}){const{value:t,text:n,key:r,options:i,includeAll:a,isReadOnly:s}=e.useState(),[l,c]=(0,Fi.useState)(""),[u,d]=(0,Fi.useState)(!1),p=function(e,t){return{value:e,label:null!=t?t:String(e)}}(t,String(n)),h=(0,Fi.useMemo)((()=>Fm(i,a)),[i,a])(l);return $i().createElement(o.Select,{id:r,isValidNewOption:e=>e.trim().length>0,placeholder:"Select value",width:"auto",disabled:s,value:p,inputValue:l,allowCustomValue:!0,virtualized:!0,filterOption:Gm,tabSelectsValue:!1,onInputChange:(t,{action:n})=>"input-change"===n?(c(t),e.onSearchChange&&e.onSearchChange(t),t):t,onOpenMenu:()=>{u&&c(String(n))},onCloseMenu:()=>{c("")},options:h,"data-testid":Mm.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${t}`),onChange:t=>{e.changeValueTo(t.value,t.label),u!==t.__isNew__&&d(t.__isNew__)}})}function Qm({model:e}){const{value:t,options:n,key:r,maxVisibleValues:i,noValueOnClear:a,includeAll:s,isReadOnly:l}=e.useState(),c=(0,Fi.useMemo)((()=>(0,Bc.isArray)(t)?t:[t]),[t]),[u,d]=(0,Fi.useState)(c),[p,h]=(0,Fi.useState)(""),f=(0,Fi.useMemo)((()=>Fm(n,s)),[n,s]);(0,Fi.useEffect)((()=>{d(c)}),[c]);const m=n.length>0?"Select value":"",g=f(p);return $i().createElement(o.MultiSelect,{id:r,placeholder:m,width:"auto",inputValue:p,disabled:l,value:u,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,allowCustomValue:!0,options:g,closeMenuOnSelect:!1,components:{Option:Km},isClearable:!0,hideSelectedOptions:!1,onInputChange:(t,{action:n})=>"input-change"===n?(h(t),e.onSearchChange&&e.onSearchChange(t),t):"input-blur"===n?(h(""),""):p,onBlur:()=>{e.changeValueTo(u)},filterOption:Gm,"data-testid":Mm.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${u}`),onChange:(t,n)=>{"clear"===n.action&&a&&e.changeValueTo([]),d(t.map((e=>e.value)))}})}const Km=({children:e,data:t,innerProps:n,innerRef:r,isFocused:a,isSelected:s,renderOptionLabel:l})=>{var c;const u=((e,t)=>{var n={};for(var r in e)zm.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&Um)for(var r of Um(e))t.indexOf(r)<0&&qm.call(e,r)&&(n[r]=e[r]);return n})(n,["onMouseMove","onMouseOver"]),d=(0,o.useTheme2)(),p=(0,o.getSelectStyles)(d),h=(0,o.useStyles2)(Ym);return $i().createElement("div",((e,t)=>Bm(e,Vm(t)))(((e,t)=>{for(var n in t||(t={}))zm.call(t,n)&&Hm(e,n,t[n]);if(Um)for(var n of Um(t))qm.call(t,n)&&Hm(e,n,t[n]);return e})({ref:r,className:(0,i.cx)(p.option,a&&p.optionFocused)},u),{"data-testid":Mm.components.Select.option,title:t.title}),$i().createElement("div",{className:h.checkbox},$i().createElement(o.Checkbox,{value:s})),$i().createElement("div",{className:p.optionBody,"data-testid":Mm.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(null!=(c=t.label)?c:String(t.value))},$i().createElement("span",null,e)))};Km.displayName="SelectMenuOptions";const Ym=e=>({checkbox:(0,i.css)({marginRight:e.spacing(2)})});function Xm(e){return e.state.isMulti?$i().createElement(Qm,{model:e}):$i().createElement(Wm,{model:e})}class Jm{constructor(e){this._sceneObject=e}getKey(){return`var-${this._sceneObject.state.name}`}getKeys(){return this._sceneObject.state.skipUrlSync?[]:[this.getKey()]}getUrlState(){return this._sceneObject.state.skipUrlSync?{}:{[this.getKey()]:Zm(this._sceneObject.state.value,this._sceneObject.state.text)}}updateFromUrl(e){let t=e[this.getKey()];if(null!=t){this._sceneObject.isActive||(this._sceneObject.skipNextValidation=!0);const{values:e,texts:r}=(n=t,(n=Array.isArray(n)?n:[n]).reduce(((e,t)=>{const[n,r]=(null!=t?t:"").split(",");return e.values.push(sy(n)),e.texts.push(sy(null!=r?r:n)),e}),{values:[],texts:[]}));this._sceneObject.changeValueTo(e,r)}var n}}function Zm(e,t){return e=Array.isArray(e)?e:[e],t=Array.isArray(t)?t:[t],e.map(((e,n)=>{if(null==e)return"";e=String(e);let r=t[n];return r=null==r?e:String(r),ly(e,r)}))}function eg(e){const t=e.getRoot();return"enrichFiltersRequest"in t?t.enrichFiltersRequest(e):null}var tg=Object.defineProperty,ng=Object.defineProperties,rg=Object.getOwnPropertyDescriptors,ig=Object.getOwnPropertySymbols,ag=Object.prototype.hasOwnProperty,og=Object.prototype.propertyIsEnumerable,sg=(e,t,n)=>t in e?tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lg=(e,t)=>{for(var n in t||(t={}))ag.call(t,n)&&sg(e,n,t[n]);if(ig)for(var n of ig(t))og.call(t,n)&&sg(e,n,t[n]);return e};class cg extends Dm{constructor(e){super(((e,t)=>ng(e,rg(t)))(lg({isMulti:!0,name:"",value:[],text:[],options:[],datasource:null,baseFilters:[],applyMode:"auto",layout:"horizontal",type:"groupby"},e),{noValueOnClear:!0})),this.isLazy=!0,this._urlSync=new Jm(this),this._getKeys=async e=>{var t,n,r;const i=await(null==(n=(t=this.state).getTagKeysProvider)?void 0:n.call(t,this,null));if(i&&i.replace)return i.values;if(this.state.defaultOptions)return this.state.defaultOptions.concat(null!=(r=null==i?void 0:i.values)?r:[]);if(!e.getTagKeys)return[];const a=iy(this),o=this.state.baseFilters||[],s=nm.getTimeRange(this).state.value;let l=await e.getTagKeys(lg({filters:o,queries:a,timeRange:s},eg(this)));i&&(l=l.concat(i.values));const c=this.state.tagKeyRegexFilter;return c&&(l=l.filter((e=>e.text.match(c)))),l},this.addActivationHandler((()=>(Am.add(this),()=>Am.delete(this))))}validateAndUpdate(){return this.getValueOptions({}).pipe((0,Hp.map)((e=>(this._updateValueGivenNewOptions(e),{}))))}_updateValueGivenNewOptions(e){const{value:t,text:n}=this.state,r={options:e,loading:!1,value:null!=t?t:[],text:null!=n?n:[]};this.setState(r)}getValueOptions(e){return this.state.defaultOptions?(0,Hp.of)(this.state.defaultOptions.map((e=>({label:e.text,value:String(e.value)})))):(this.setState({loading:!0,error:null}),(0,Hp.from)(rm(this.state.datasource,{__sceneObject:{text:"__sceneObject",value:this}})).pipe((0,Hp.mergeMap)((e=>(0,Hp.from)(this._getKeys(e)).pipe((0,Hp.take)(1),(0,Hp.mergeMap)((e=>{const t=e.map((e=>({label:e.text,value:e.value?String(e.value):e.text})));return(0,Hp.of)(t)})))))))}getDefaultMultiState(e){return{value:[],text:[]}}}cg.Component=function({model:e}){const{value:t,text:n,key:r,maxVisibleValues:i,noValueOnClear:a,options:s,includeAll:l}=e.useState(),c=(0,Fi.useMemo)((()=>{const e=(0,Bc.isArray)(t)?t:[t],r=(0,Bc.isArray)(n)?n:[n];return e.map(((e,t)=>{var n;return{value:e,label:String(null!=(n=r[t])?n:e)}}))}),[t,n]),[u,d]=(0,Fi.useState)(!1),[p,h]=(0,Fi.useState)(!1),[f,m]=(0,Fi.useState)(""),[g,y]=(0,Fi.useState)(c),b=(0,Fi.useMemo)((()=>Fm(s,l)),[s,l]);(0,Fi.useEffect)((()=>{y(c)}),[c]);const v=b(f);return $i().createElement(o.MultiSelect,{"data-testid":`GroupBySelect-${r}`,id:r,placeholder:"Select value",width:"auto",inputValue:f,value:g,noMultiValueWrap:!0,maxVisibleValues:null!=i?i:5,tabSelectsValue:!1,virtualized:!0,options:v,filterOption:ug,closeMenuOnSelect:!1,isOpen:p,isClearable:!0,hideSelectedOptions:!1,isLoading:u,components:{Option:Km},onInputChange:(t,{action:n})=>"input-change"===n?(m(t),e.onSearchChange&&e.onSearchChange(t),t):"input-blur"===n?(m(""),""):f,onBlur:()=>{e.changeValueTo(g.map((e=>e.value)),g.map((e=>e.label)))},onChange:(t,n)=>{"clear"===n.action&&a&&e.changeValueTo([]),y(t)},onOpenMenu:async()=>{d(!0),await(0,Hp.lastValueFrom)(e.validateAndUpdate()),d(!1),h(!0)},onCloseMenu:()=>{h(!1)}})};const ug=()=>!0;function dg(e){return $i().createElement(o.Tooltip,{content:"Cancel query"},$i().createElement(o.Icon,{className:"spin-clockwise",name:"sync",size:"xs",role:"button",onMouseDown:t=>{e.onCancel(t)}}))}function pg(e){const t=(0,o.useStyles2)(hg),n=(0,o.useTheme2)(),r="vertical"===e.layout,i=Boolean(e.isLoading)?$i().createElement("div",{style:{marginLeft:n.spacing(1),marginTop:"-1px"},"aria-label":Mm.components.LoadingIndicator.icon},$i().createElement(dg,{onCancel:t=>{var n;t.preventDefault(),t.stopPropagation(),null==(n=e.onCancel)||n.call(e)}})):null;let a=null;e.error&&(a=$i().createElement(o.Tooltip,{content:e.error,placement:"bottom"},$i().createElement(o.Icon,{className:t.errorIcon,name:"exclamation-triangle"})));let s=null;e.description&&(s=$i().createElement(o.Tooltip,{content:e.description,placement:r?"top":"bottom"},$i().createElement(o.Icon,{className:t.normalIcon,name:"info-circle"})));const l="string"==typeof e.label?Mm.pages.Dashboard.SubMenu.submenuItemLabels(e.label):"";let c;return c=r?$i().createElement("label",{className:t.verticalLabel,"data-testid":l,htmlFor:e.htmlFor},e.label,s,a,e.icon&&$i().createElement(o.Icon,{name:e.icon,className:t.normalIcon}),i,e.onRemove&&$i().createElement(o.IconButton,{variant:"secondary",size:"xs",name:"times",onClick:e.onRemove,tooltip:"Remove"})):$i().createElement("label",{className:t.horizontalLabel,"data-testid":l,htmlFor:e.htmlFor},a,e.icon&&$i().createElement(o.Icon,{name:e.icon,className:t.normalIcon}),e.label,s,i),c}const hg=e=>({horizontalLabel:(0,i.css)({background:e.isDark?e.colors.background.primary:e.colors.background.secondary,display:"flex",alignItems:"center",padding:e.spacing(0,1),fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.bodySmall.fontSize,height:e.spacing(e.components.height.md),lineHeight:e.spacing(e.components.height.md),borderRadius:e.shape.borderRadius(1),border:`1px solid ${e.components.input.borderColor}`,position:"relative",right:-1,whiteSpace:"nowrap",gap:e.spacing(.5)}),verticalLabel:(0,i.css)({display:"flex",alignItems:"center",fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.bodySmall.fontSize,lineHeight:e.typography.bodySmall.lineHeight,whiteSpace:"nowrap",marginBottom:e.spacing(.5),gap:e.spacing(1)}),errorIcon:(0,i.css)({color:e.colors.error.text}),normalIcon:(0,i.css)({color:e.colors.text.secondary})});function fg(e){var t;return{label:null!=(t=e.label)?t:String(e.value),value:e.value}}function mg(e,t){return""!==e?{value:e,label:t||e}:null}const gg=()=>!0;function yg({filter:e,model:t}){var n,r;const a=(0,o.useStyles2)(bg),[s,l]=(0,Fi.useState)([]),[c,u]=(0,Fi.useState)([]),[d,p]=(0,Fi.useState)(!1),[h,f]=(0,Fi.useState)(!1),[m,g]=(0,Fi.useState)(!1),[y,b]=(0,Fi.useState)(!1),[v,w]=(0,Fi.useState)(""),[S,E]=(0,Fi.useState)(!1),x=mg(e.key,e.keyLabel),O=mg(e.value,e.valueLabel),_=(0,Fi.useMemo)((()=>Fm(c.map(fg),void 0)),[c])(v),T=$i().createElement(o.Select,{virtualized:!0,allowCustomValue:!0,isValidNewOption:e=>e.trim().length>0,allowCreateWhileLoading:!0,formatCreateLabel:e=>`Use custom value: ${e}`,disabled:t.state.readOnly,className:(0,i.cx)(a.value,m?a.widthWhenOpen:void 0),width:"auto",value:O,filterOption:gg,placeholder:"Select value",options:_,inputValue:v,onInputChange:(e,{action:t})=>("input-change"===t&&w(e),e),onChange:n=>{t._updateFilter(e,"value",n),S!==n.__isNew__&&E(n.__isNew__)},isOpen:y&&!h,isLoading:h,autoFocus:""!==e.key&&""===e.value,openMenuOnFocus:!0,onOpenMenu:async()=>{var n;f(!0),b(!0);const r=await t._getValuesFor(e);f(!1),u(r),S&&w(null!=(n=null==O?void 0:O.label)?n:"")},onCloseMenu:()=>{b(!1),w("")}}),C=$i().createElement(o.Select,{key:""+(h?"loading":"loaded"),disabled:t.state.readOnly,className:(0,i.cx)(a.key,m?a.widthWhenOpen:void 0),width:"auto",value:x,placeholder:"Select label",options:s,onChange:n=>t._updateFilter(e,"key",n),autoFocus:""===e.key,isOpen:m&&!d,isLoading:d,onOpenMenu:async()=>{g(!0),p(!0);const n=await t._getKeys(e.key);p(!1),l(n)},onCloseMenu:()=>{g(!1)},onBlur:()=>{""===e.key&&t._removeFilter(e)},openMenuOnFocus:!0});if("vertical"===t.state.layout){if(e.key){const r=$i().createElement(pg,{layout:"vertical",label:null!=(n=e.key)?n:"",onRemove:()=>t._removeFilter(e)});return $i().createElement(o.Field,{label:r,"data-testid":`AdHocFilter-${e.key}`,className:a.field},$i().createElement("div",{className:a.wrapper},$i().createElement(o.Select,{className:a.operator,value:e.operator,disabled:t.state.readOnly,options:t._getOperators(),width:"auto",onChange:n=>t._updateFilter(e,"operator",n)}),T))}return $i().createElement(o.Field,{label:"Select label","data-testid":`AdHocFilter-${e.key}`,className:a.field},C)}return $i().createElement("div",{className:a.wrapper,"data-testid":`AdHocFilter-${e.key}`},C,$i().createElement(o.Select,{className:a.operator,value:e.operator,disabled:t.state.readOnly,options:t._getOperators(),width:"auto",onChange:n=>t._updateFilter(e,"operator",n)}),T,$i().createElement(o.Button,{variant:"secondary","aria-label":"Remove filter",title:"Remove filter",className:a.removeButton,icon:"times","data-testid":`AdHocFilter-remove-${null!=(r=e.key)?r:""}`,onClick:()=>t._removeFilter(e)}))}const bg=e=>({field:(0,i.css)({marginBottom:0}),wrapper:(0,i.css)({display:"flex","> *":{"&:not(:first-child)":{marginLeft:-1},"&:first-child":{borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-child":{borderTopLeftRadius:0,borderBottomLeftRadius:0},"&:not(:first-child):not(:last-child)":{borderRadius:0},position:"relative",zIndex:0,"&:hover":{zIndex:1},"&:focus-within":{zIndex:2}}}),widthWhenOpen:(0,i.css)({minWidth:e.spacing(16)}),value:(0,i.css)({flexShrink:1}),key:(0,i.css)({minWidth:"90px",flexShrink:1}),operator:(0,i.css)({flexShrink:0}),removeButton:(0,i.css)({paddingLeft:e.spacing(1.5),paddingRight:e.spacing(1.5),borderLeft:"none",width:e.spacing(3),marginRight:e.spacing(1),boxSizing:"border-box",position:"relative",left:"1px"})});function vg({model:e,addFilterButtonText:t}){const{_wip:n}=e.useState();return n?$i().createElement(yg,{filter:n,model:e}):$i().createElement(o.Button,{variant:"secondary",icon:"plus",title:"Add filter","aria-label":"Add filter","data-testid":"AdHocFilter-add",onClick:()=>e._addWip()},t)}class wg{constructor(e){this._variable=e}getKey(){return`var-${this._variable.state.name}`}getKeys(){return[this.getKey()]}getUrlState(){const e=this._variable.state.filters;if(0===e.length)return{[this.getKey()]:[""]};const t=e.filter(Lg).map((e=>function(e){return[ly(e.key,e.keyLabel),e.operator,ly(e.value,e.valueLabel)]}(e).map(ay).join("|")));return{[this.getKey()]:t}}updateFromUrl(e){const t=e[this.getKey()];if(null==t)return;const n=function(e){if(Array.isArray(e)){return e.map(Sg).filter(Eg)}const t=Sg(e);return null===t?[]:[t]}(t);this._variable.setState({filters:n})}}function Sg(e){if("string"!=typeof e||0===e.length)return null;const[t,n,r,i,a,o]=e.split("|").reduce(((e,t)=>{const[n,r]=t.split(",");return e.push(n,null!=r?r:n),e}),[]).map(sy);return{key:t,keyLabel:n,operator:r,value:a,valueLabel:o,condition:""}}function Eg(e){return null!==e&&"string"==typeof e.key&&"string"==typeof e.value}var xg=Object.defineProperty,Og=Object.defineProperties,_g=Object.getOwnPropertyDescriptors,Tg=Object.getOwnPropertySymbols,Cg=Object.prototype.hasOwnProperty,kg=Object.prototype.propertyIsEnumerable,Pg=(e,t,n)=>t in e?xg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ag=(e,t)=>{for(var n in t||(t={}))Cg.call(t,n)&&Pg(e,n,t[n]);if(Tg)for(var n of Tg(t))kg.call(t,n)&&Pg(e,n,t[n]);return e},Rg=(e,t)=>Og(e,_g(t));class Dg extends vh{constructor(e){var t,n;super(Ag({type:"adhoc",name:null!=(t=e.name)?t:"Filters",filters:[],datasource:null,applyMode:"auto",filterExpression:null!=(n=e.filterExpression)?n:jg(e.expressionBuilder,e.filters)},e)),this._scopedVars={__sceneObject:{value:this}},this._dataSourceSrv=(0,a.getDataSourceSrv)(),this._urlSync=new wg(this),"auto"===this.state.applyMode&&function(e){if(e.addActivationHandler((()=>(km.add(e),()=>km.delete(e)))),Cm)return;const t=(0,a.getTemplateSrv)();(null==t?void 0:t.getAdhocFilters)&&(Cm=t.getAdhocFilters,t.getAdhocFilters=function(e){var n;if(0===km.size)return Cm.call(t);const r=(0,a.getDataSourceSrv)().getInstanceSettings(e);if(!r)return[];for(const e of km.values())if((null==(n=e.state.datasource)?void 0:n.uid)===r.uid)return e.state.filters;return[]}.bind(t))}(this)}setState(e){let t=!1;e.filters&&e.filters!==this.state.filters&&!e.filterExpression&&(e.filterExpression=jg(this.state.expressionBuilder,e.filters),t=e.filterExpression!==this.state.filterExpression),super.setState(e),t&&this.publishEvent(new hf(this),!0)}getValue(){return this.state.filterExpression}_updateFilter(e,t,{value:n,label:r}){if(null==n)return;const{filters:i,_wip:a}=this.state,o=`${t}Label`;if(e===a)return void("value"===t?this.setState({filters:[...i,Rg(Ag({},a),{[t]:n,[o]:r})],_wip:void 0}):this.setState({_wip:Rg(Ag({},e),{[t]:n,[o]:r})}));const s=this.state.filters.map((i=>{if(i===e){const a=Rg(Ag({},i),{[t]:n,[o]:r});return"key"===t&&e[t]!==n&&(a.value="",a.valueLabel=""),a}return i}));this.setState({filters:s})}_removeFilter(e){e!==this.state._wip?this.setState({filters:this.state.filters.filter((t=>t!==e))}):this.setState({_wip:void 0})}async _getKeys(e){var t,n,r;const i=await(null==(n=(t=this.state).getTagKeysProvider)?void 0:n.call(t,this,e));if(i&&i.replace)return i.values.map(Ng);if(this.state.defaultKeys)return this.state.defaultKeys.map(Ng);const a=await this._dataSourceSrv.get(this.state.datasource,this._scopedVars);if(!a||!a.getTagKeys)return[];const o=this.state.filters.filter((t=>t.key!==e)).concat(null!=(r=this.state.baseFilters)?r:[]),s=nm.getTimeRange(this).state.value,l=this.state.useQueriesAsFilterForOptions?iy(this):void 0;let c=await a.getTagKeys(Ag({filters:o,queries:l,timeRange:s},eg(this)));i&&(c=c.concat(i.values));const u=this.state.tagKeyRegexFilter;return u&&(c=c.filter((e=>e.text.match(u)))),c.map(Ng)}async _getValuesFor(e){var t,n,r;const i=await(null==(n=(t=this.state).getTagValuesProvider)?void 0:n.call(t,this,e));if(i&&i.replace)return Mg(i.values);const a=await this._dataSourceSrv.get(this.state.datasource,this._scopedVars);if(!a||!a.getTagValues)return[];const o=this.state.filters.filter((t=>t.key!==e.key)).concat(null!=(r=this.state.baseFilters)?r:[]),s=nm.getTimeRange(this).state.value,l=this.state.useQueriesAsFilterForOptions?iy(this):void 0;let c=await a.getTagValues(Ag({key:e.key,filters:o,timeRange:s,queries:l},eg(this)));return i&&(c=c.concat(i.values)),Mg(c)}_addWip(){this.setState({_wip:{key:"",keyLabel:"",value:"",valueLabel:"",operator:"=",condition:""}})}_getOperators(){return["=","!=","<",">","=~","!~"].map((e=>({label:e,value:e})))}}function jg(e,t){return(null!=e?e:ty)(null!=t?t:[])}Dg.Component=function({model:e}){const{filters:t,readOnly:n,addFilterButtonText:r}=e.useState(),i=(0,o.useStyles2)(Ig);return $i().createElement("div",{className:i.wrapper},t.map(((t,n)=>$i().createElement($i().Fragment,{key:n},$i().createElement(yg,{filter:t,model:e})))),!n&&$i().createElement(vg,{model:e,key:"'builder",addFilterButtonText:r}))};const Ig=e=>({wrapper:(0,i.css)({display:"flex",flexWrap:"wrap",alignItems:"flex-end",columnGap:e.spacing(2),rowGap:e.spacing(1)}),filterIcon:(0,i.css)({color:e.colors.text.secondary,paddingRight:e.spacing(.5)})});function Ng({text:e,value:t}){return{label:e,value:String(null!=t?t:e)}}function Lg(e){return""!==e.key&&""!==e.operator&&""!==e.value}function Mg(e){const t=[],n=new Map;for(const r of e){const e=r.group;if(e){let i=n.get(e);i||(i=[],n.set(e,i),t.push({label:e,options:i})),i.push(Ng(r))}else t.push(Ng(r))}return t}class Fg{constructor(){this._resultsMap=new Map,this._prevLayers=[]}getMergedStream(e){(function(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1})(e,this._prevLayers)&&(this._resultsMap=new Map,this._prevLayers=e);const t=e.map((e=>e.getResultsStream())),n=[];for(const t of e)n.push(t.activate());return(0,Hp.merge)(t).pipe((0,Hp.mergeAll)(),(0,Hp.filter)((e=>this._resultsMap.get(e.origin.state.key)!==e)),(0,Hp.map)((e=>(this._resultsMap.set(e.origin.state.key,e),this._resultsMap.values()))),(0,Hp.finalize)((()=>{n.forEach((e=>e()))})))}}var $g=Object.defineProperty,Bg=Object.defineProperties,Vg=Object.getOwnPropertyDescriptors,Ug=Object.getOwnPropertySymbols,zg=Object.prototype.hasOwnProperty,qg=Object.prototype.propertyIsEnumerable,Hg=(e,t,n)=>t in e?$g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gg=(e,t)=>{for(var n in t||(t={}))zg.call(t,n)&&Hg(e,n,t[n]);if(Ug)for(var n of Ug(t))qg.call(t,n)&&Hg(e,n,t[n]);return e},Wg=(e,t)=>Bg(e,Vg(t));let Qg=100;function Kg(){return"SQR"+Qg++}class Yg extends vh{constructor(e){super(e),this._dataLayersMerger=new Fg,this._variableValueRecorder=new om,this._results=new Hp.ReplaySubject(1),this._scopedVars={__sceneObject:{value:this,text:"__sceneObject"}},this._variableDependency=new am(this,{statePaths:["queries","datasource"],onVariableUpdateCompleted:this.onVariableUpdatesCompleted.bind(this),onAnyVariableChanged:this.onAnyVariableChanged.bind(this)}),this.onDataReceived=e=>{const t=(0,r.preProcessPanelData)(e,this.state.data);this._resultAnnotations=e.annotations;const n=this._combineDataLayers(t);let i=this.state._hasFetchedData;i||t.state===Hh.Loading||(i=!0),this.setState({data:n,_hasFetchedData:i}),this._results.next({origin:this,data:n})},this.addActivationHandler((()=>this._onActivate()))}getResultsStream(){return this._results}_onActivate(){const e=nm.getTimeRange(this),t=this.getClosestExtraQueryProviders();for(const e of t)this._subs.add(e.subscribeToState(((t,n)=>{e.shouldRerun(n,t)&&this.runQueries()})));return this.subscribeToTimeRangeChanges(e),this.shouldRunQueriesOnActivate()&&this.runQueries(),this._dataLayersSub||this._handleDataLayers(),()=>this._onDeactivate()}_handleDataLayers(){const e=nm.getDataLayers(this);0!==e.length&&(this._dataLayersSub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayersReceived.bind(this)))}_onLayersReceived(e){var t,n,i,a,o;const s=nm.getTimeRange(this),{dataLayerFilter:l}=this.state;let c,u=[],d=[];for(const i of e)for(let e of i.data.series)(null==(t=e.meta)?void 0:t.dataTopic)===r.DataTopic.Annotations&&(u=u.concat(e)),(null==(n=e.meta)?void 0:n.dataTopic)===r.DataTopic.AlertStates&&(d=d.concat(e));if((null==l?void 0:l.panelId)&&(u.length>0&&(u=function(e,t){var n;if(!Array.isArray(e)||0===e.length)return e;const r=Array.from({length:e.length},(()=>new Set));let i=0;for(const a of e){for(let e=0;e<a.length;e++){if(r[i].has(e))continue;let o=!0;const s=a.fields.find((e=>"panelId"===e.name)),l=a.fields.find((e=>"source"===e.name));if(l){s&&"dashboard"===l.values[e].type&&(o=s.values[e]===t.panelId);const r=l.values[e].filter;if(r){const e=(null!=(n=r.ids)?n:[]).includes(t.panelId);r.exclude?e&&(o=!1):e||(o=!1)}}o&&r[i].add(e)}i++}const a=[];i=0;for(const t of e){const e=r[i].size,n=[];for(const e of t.fields){const a=[];for(let n=0;n<t.length;n++)r[i].has(n)&&a.push(e.values[n]);n.push(_m(Om({},e),{values:a}))}a.push(_m(Om({},t),{fields:n,length:e})),i++}return a}(u,l)),d.length>0))for(const e of d){const t=new r.DataFrameView(e);for(const e of t)if(e.panelId===l.panelId){c=e;break}}if(Jg(u)&&Jg(this._layerAnnotations)&&(0,Bc.isEqual)(c,null==(i=this.state.data)?void 0:i.alertState))return;this._layerAnnotations=u;const p=this.state.data?this.state.data:Wg(Gg({},Xh),{timeRange:s.state.value});this.setState({data:Wg(Gg({},p),{annotations:[...null!=(a=this._resultAnnotations)?a:[],...u],alertState:null!=c?c:null==(o=this.state.data)?void 0:o.alertState})})}onVariableUpdatesCompleted(){this.runQueries()}onAnyVariableChanged(e){this._adhocFiltersVar!==e&&this._groupByVar!==e&&(e instanceof Dg&&this._isRelevantAutoVariable(e)&&this.runQueries(),e instanceof cg&&this._isRelevantAutoVariable(e)&&this.runQueries())}_isRelevantAutoVariable(e){var t,n;const r=null!=(t=this.state.datasource)?t:Xg(this.state.queries);return"auto"===e.state.applyMode&&(null==r?void 0:r.uid)===(null==(n=e.state.datasource)?void 0:n.uid)}shouldRunQueriesOnActivate(){return this._variableValueRecorder.hasDependenciesChanged(this)?(im(),!0):!this.state.data||!!this._isDataTimeRangeStale(this.state.data)}_isDataTimeRangeStale(e){const t=nm.getTimeRange(this).state.value,n=e.timeRange;return(t.from.unix()!==n.from.unix()||t.to.unix()!==n.to.unix())&&(im(),!0)}_onDeactivate(){var e;this._querySub&&(this._querySub.unsubscribe(),this._querySub=void 0),this._dataLayersSub&&(this._dataLayersSub.unsubscribe(),this._dataLayersSub=void 0),null==(e=this._timeSub)||e.unsubscribe(),this._timeSub=void 0,this._timeSubRange=void 0,this._adhocFiltersVar=void 0,this._groupByVar=void 0,this._variableValueRecorder.recordCurrentDependencyValuesForSceneObject(this)}setContainerWidth(e){!this._containerWidth&&e>0?(this._containerWidth=e,this.state.maxDataPointsFromWidth&&!this.state.maxDataPoints&&setTimeout((()=>{this.isActive&&!this.state._hasFetchedData&&this.runQueries()}),0)):e>0&&(this._containerWidth=e)}isDataReadyToDisplay(){return Boolean(this.state._hasFetchedData)}subscribeToTimeRangeChanges(e){this._timeSubRange!==e&&(this._timeSub&&this._timeSub.unsubscribe(),this._timeSubRange=e,this._timeSub=e.subscribeToState((()=>{this.runWithTimeRange(e)})))}runQueries(){const e=nm.getTimeRange(this);this.subscribeToTimeRangeChanges(e),this.runWithTimeRange(e)}getMaxDataPoints(){var e;return this.state.maxDataPoints?this.state.maxDataPoints:this.state.maxDataPointsFromWidth&&null!=(e=this._containerWidth)?e:500}cancelQuery(){var e;null==(e=this._querySub)||e.unsubscribe(),this._dataLayersSub&&(this._dataLayersSub.unsubscribe(),this._dataLayersSub=void 0),this.setState({data:Wg(Gg({},this.state.data),{state:Hh.Done})})}async runWithTimeRange(e){var t,n;if(!this.state.maxDataPoints&&this.state.maxDataPointsFromWidth&&!this._containerWidth)return;if(this._dataLayersSub||this._handleDataLayers(),null==(t=this._querySub)||t.unsubscribe(),this._variableDependency.hasDependencyInLoadingState())return im(),void this.setState({data:Wg(Gg({},this.state.data),{state:Hh.Loading})});const{queries:r}=this.state;if(null==r?void 0:r.length)try{const t=null!=(n=this.state.datasource)?n:Xg(r),i=await rm(t,this._scopedVars);this.findAndSubscribeToAdHocFilters(null==t?void 0:t.uid);const o=(0,a.getRunRequest)(),{primary:s,secondaries:l,processors:c}=this.prepareRequests(e,i);im(0,0,this.state.key);let u=o(i,s);if(l.length>0){const e=l.map((e=>o(i,e))),t=gm(c);u=(0,Hp.forkJoin)([u,...e]).pipe(t)}u=u.pipe(Pm({type:"data",request:s,origin:this,cancel:()=>this.cancelQuery()})),this._querySub=u.subscribe(this.onDataReceived)}catch(e){console.error("PanelQueryRunner Error",e),this.onDataReceived(Wg(Gg(Gg({},Xh),this.state.data),{state:Hh.Error,errors:[(0,a.toDataQueryError)(e)]}))}else this._setNoDataState()}clone(e){var t;const n=super.clone(e);return this._resultAnnotations&&(n._resultAnnotations=this._resultAnnotations.map((e=>Gg({},e)))),this._layerAnnotations&&(n._layerAnnotations=this._layerAnnotations.map((e=>Gg({},e)))),n._variableValueRecorder=this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this),n._containerWidth=this._containerWidth,n._results.next({origin:this,data:null!=(t=this.state.data)?t:Xh}),n}prepareRequests(e,t){var n;const{minInterval:i,queries:o}=this.state;let s=Gg({app:"scenes",requestId:Kg(),timezone:e.getTimeZone(),range:e.state.value,interval:"1s",intervalMs:1e3,targets:(0,Bc.cloneDeep)(o),maxDataPoints:this.getMaxDataPoints(),scopedVars:this._scopedVars,startTime:Date.now(),liveStreaming:this.state.liveStreaming,rangeRaw:{from:e.state.from,to:e.state.to},cacheTimeout:this.state.cacheTimeout,queryCachingTTL:this.state.queryCachingTTL},Tm(this));this._adhocFiltersVar&&(s.filters=this._adhocFiltersVar.state.filters.filter(Lg)),this._groupByVar&&(s.groupByKeys=this._groupByVar.state.value),s.targets=s.targets.map((e=>{var n;return e.datasource&&(e.datasource.uid===t.uid||(null==(n=t.meta)?void 0:n.mixed)||!a.isExpressionReference||(0,a.isExpressionReference)(e.datasource))||(e.datasource=t.getRef()),e}));const l=i||t.interval,c=r.rangeUtil.calculateInterval(e.state.value,s.maxDataPoints,l);s.scopedVars=Object.assign({},s.scopedVars,{__interval:{text:c.interval,value:c.interval},__interval_ms:{text:c.intervalMs.toString(),value:c.intervalMs}}),s.interval=c.interval,s.intervalMs=c.intervalMs;const u=e.state.value;let d=[],p=new Map;for(const e of null!=(n=this.getClosestExtraQueryProviders())?n:[])for(const{req:t,processor:n}of e.getExtraQueries(s)){const e=Kg();d.push(Wg(Gg({},t),{requestId:e})),p.set(e,null!=n?n:mm)}return s.range=u,{primary:s,secondaries:d,processors:p}}_combineDataLayers(e){return this._layerAnnotations&&this._layerAnnotations.length>0&&(e.annotations=(e.annotations||[]).concat(this._layerAnnotations)),this.state.data&&this.state.data.alertState&&(e.alertState=this.state.data.alertState),e}_setNoDataState(){this.state.data!==Xh&&this.setState({data:Xh})}getClosestExtraQueryProviders(){const e=new Map;return this.parent?(Ph(this.parent,(t=>(sm(t)&&!e.has(t.constructor)&&e.set(t.constructor,t),t.forEachChild((t=>{sm(t)&&!e.has(t.constructor)&&e.set(t.constructor,t)})),null))),Array.from(e.values())):[]}findAndSubscribeToAdHocFilters(e){const t=function(e){var t;for(const n of km.values())if((null==(t=n.state.datasource)?void 0:t.uid)===e)return n}(e);this._adhocFiltersVar!==t&&(this._adhocFiltersVar=t,this._updateExplicitVariableDependencies());const n=function(e){var t;for(const n of Am.values())if((null==(t=n.state.datasource)?void 0:t.uid)===e)return n}(e);this._groupByVar!==n&&(this._groupByVar=n,this._updateExplicitVariableDependencies())}_updateExplicitVariableDependencies(){const e=[];this._adhocFiltersVar&&e.push(this._adhocFiltersVar.state.name),this._groupByVar&&e.push(this._groupByVar.state.name),this._variableDependency.setVariableNames(e)}}function Xg(e){var t,n;return null!=(n=null==(t=e.find((e=>null!==e.datasource)))?void 0:t.datasource)?n:void 0}function Jg(e){if(!e)return!0;for(let t=0;t<e.length;t++)if(e[t].length>0)return!1;return!0}function Zg(e,t){return e===t||(0,Bc.isEqual)(e,t)}function ey(e){try{return JSON.stringify(e,(()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}})())}catch(e){console.error(e)}return""}function ty(e){return e.map((e=>function(e){let t="";t="=~"===e.operator||"!~¨"===e.operator?ny(function(e){return e.replace(ry,"\\$&")}(e.value)):ny(e.value);return`${e.key}${e.operator}"${t}"`}(e))).join(",")}function ny(e){return e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}const ry=/[*+?()|\\.\[\]{}^$]/g;function iy(e){const t=nm.findAllObjects(e.getRoot(),(e=>e instanceof Yg)),n=function(e){const t={};for(const n of e)n.state.key&&(n.state.key in t||(t[n.state.key]=[]),t[n.state.key].push(n));return Object.values(t).flatMap((e=>{const t=e.filter((e=>e.isActive));return 0===t.length&&1===e.length?e:t}))}(t).filter((t=>{var n,r;return(null==(n=t.state.datasource)?void 0:n.uid)===(null==(r=e.state.datasource)?void 0:r.uid)}));if(0===n.length)return[];const r=[];return n.forEach((e=>{r.push(...e.state.queries)})),r}function ay(e){return null==e?"":/\|/g[Symbol.replace](e,"__gfp__")}function oy(e){return null==e?"":/,/g[Symbol.replace](e,"__gfc__")}function sy(e){return null==e?"":(e=/__gfp__/g[Symbol.replace](e,"|"),e=/__gfc__/g[Symbol.replace](e,","))}function ly(e,t){return t&&e!==t?[e,t].map(oy).join(","):oy(e)}var cy=(e=>(e[e.never=0]="never",e[e.onDashboardLoad=1]="onDashboardLoad",e[e.onTimeRangeChanged=2]="onTimeRangeChanged",e))(cy||{});var uy=(e=>(e[e.Crosshair=1]="Crosshair",e[e.Off=0]="Off",e[e.Tooltip=2]="Tooltip",e))(uy||{});var dy=Object.defineProperty,py=Object.defineProperties,hy=Object.getOwnPropertyDescriptors,fy=Object.getOwnPropertySymbols,my=Object.prototype.hasOwnProperty,gy=Object.prototype.propertyIsEnumerable,yy=(e,t,n)=>t in e?dy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class by extends vh{constructor(e){super(((e,t)=>py(e,hy(t)))(((e,t)=>{for(var n in t||(t={}))my.call(t,n)&&yy(e,n,t[n]);if(fy)for(var n of fy(t))gy.call(t,n)&&yy(e,n,t[n]);return e})({},e),{sync:e.sync||uy.Off})),this.getEventsBus=e=>{if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return new vy(this.parent,e)}}getEventsScope(){if(!this.parent)throw new Error("EnableCursorSync cannot be used as a standalone scene object");return this.state.key}}class vy{constructor(e,t){this._source=e,this._eventsOrigin=t}publish(e){e.origin=this,this._eventsOrigin.publishEvent(e,!0)}getStream(e){return new Hp.Observable((t=>{const n=this._source.subscribeToEvent(e,(e=>{t.next(e)}));return()=>n.unsubscribe()}))}subscribe(e,t){return this.getStream(e).pipe().subscribe(t)}removeAllListeners(){}newScopedBus(e,t){throw new Error("For internal use only")}}var wy=function(){};var Sy="undefined"!=typeof window;const Ey=Sy?Fi.useLayoutEffect:Fi.useEffect;var xy={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const Oy=Sy&&void 0!==window.ResizeObserver?function(){var e=(0,Fi.useState)(null),t=e[0],n=e[1],r=(0,Fi.useState)(xy),i=r[0],a=r[1],o=(0,Fi.useMemo)((function(){return new window.ResizeObserver((function(e){if(e[0]){var t=e[0].contentRect,n=t.x,r=t.y,i=t.width,o=t.height,s=t.top,l=t.left,c=t.bottom,u=t.right;a({x:n,y:r,width:i,height:o,top:s,left:l,bottom:c,right:u})}}))}),[]);return Ey((function(){if(t)return o.observe(t),function(){o.disconnect()}}),[t]),[n,i]}:function(){return[wy,xy]};function _y(e,t){if(t)return t;let n=e.error?e.error.message:void 0;return e.errors&&(n=e.errors.map((e=>e.message)).join(", ")),n}const Ty=(0,i.css)({position:"relative",width:"100%",height:"100%"}),Cy=(0,i.css)({position:"absolute",width:"100%",height:"100%"}),ky=e=>({ok:(0,i.css)({color:e.colors.success.text}),pending:(0,i.css)({color:e.colors.warning.text}),alerting:(0,i.css)({color:e.colors.error.text})});var Py=Object.defineProperty,Ay=Object.defineProperties,Ry=Object.getOwnPropertyDescriptors,Dy=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,Iy=Object.prototype.propertyIsEnumerable,Ny=(e,t,n)=>t in e?Py(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ly=(e,t)=>{for(var n in t||(t={}))jy.call(t,n)&&Ny(e,n,t[n]);if(Dy)for(var n of Dy(t))Iy.call(t,n)&&Ny(e,n,t[n]);return e},My=(e,t)=>Ay(e,Ry(t));const Fy="hideSeriesFrom",$y=(0,r.isSystemOverrideWithRef)(Fy);function By(e,t=r.ByNamesMatcherMode.exclude,n){return n=null!=n?n:{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!1}},{__systemRef:Fy,matcher:{id:r.FieldMatcherID.byNames,options:{mode:t,names:e,prefix:t===r.ByNamesMatcherMode.exclude?"All except:":void 0,readOnly:!0}},properties:[My(Ly({},n),{value:{viz:!0,legend:!1,tooltip:!1}})]}}const Vy=(e,t,n=r.ByNamesMatcherMode.exclude)=>{const i=e.properties.find((e=>"custom.hideFrom"===e.id)),a=Uy(e),o=a.findIndex((e=>e===t));return o<0?a.push(t):a.splice(o,1),By(a,n,i)},Uy=e=>{var t;const n=null==(t=e.matcher.options)?void 0:t.names;return Array.isArray(n)?[...n]:[]},zy=(e,t)=>Uy(e).length===qy(t).length,qy=(e,t)=>{const n=new Set;for(const i of e)for(const a of i.fields){if(a.type!==r.FieldType.number)continue;const o=(0,r.getFieldDisplayName)(a,i,e);o!==t&&n.add(o)}return Array.from(n)},Hy=(e,t)=>{var n;let i=[];for(const a of e){const e=a.properties.find((e=>"custom.hideFrom"===e.id));if(void 0!==e&&!0===(null==(n=e.value)?void 0:n.legend)){const e=r.fieldMatchers.get(a.matcher.id).get(a.matcher.options);for(const n of t)for(const a of n.fields){if(a.type!==r.FieldType.number)continue;const o=(0,r.getFieldDisplayName)(a,n,t);e(a,n,t)&&i.push(o)}}}return i};var Gy=Object.defineProperty,Wy=Object.defineProperties,Qy=Object.getOwnPropertyDescriptors,Ky=Object.getOwnPropertySymbols,Yy=Object.prototype.hasOwnProperty,Xy=Object.prototype.propertyIsEnumerable,Jy=(e,t,n)=>t in e?Gy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zy=(e,t)=>{for(var n in t||(t={}))Yy.call(t,n)&&Jy(e,n,t[n]);if(Ky)for(var n of Ky(t))Xy.call(t,n)&&Jy(e,n,t[n]);return e},eb=(e,t)=>Wy(e,Qy(t));const tb=(e,t)=>({matcher:{id:r.FieldMatcherID.byName,options:e},properties:[nb(t)]}),nb=e=>({id:"color",value:{mode:r.FieldColorModeId.Fixed,fixedColor:e}});var rb=Object.defineProperty,ib=Object.defineProperties,ab=Object.getOwnPropertyDescriptors,ob=Object.getOwnPropertySymbols,sb=Object.prototype.hasOwnProperty,lb=Object.prototype.propertyIsEnumerable,cb=(e,t,n)=>t in e?rb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ub=(e,t)=>{for(var n in t||(t={}))sb.call(t,n)&&cb(e,n,t[n]);if(ob)for(var n of ob(t))lb.call(t,n)&&cb(e,n,t[n]);return e},db=(e,t)=>ib(e,ab(t));class pb extends vh{constructor(e){var t;super(ub({options:{},fieldConfig:{defaults:{},overrides:[]},title:"Title",pluginId:"timeseries"},e)),this._variableDependency=new am(this,{statePaths:["title","options","fieldConfig"]}),this._structureRev=0,this.onTimeRangeChange=e=>{nm.getTimeRange(this).onTimeRangeChange({raw:{from:(0,r.toUtc)(e.from),to:(0,r.toUtc)(e.to)},from:(0,r.toUtc)(e.from),to:(0,r.toUtc)(e.to)})},this.getTimeRange=e=>{const t=nm.findObject(this,(e=>e instanceof fb)),n=nm.getTimeRange(this);if(t instanceof fb&&t.isEnabled)return tf(n.state.from,n.state.to,n.getTimeZone(),n.state.fiscalYearStartMonth,n.state.UNSAFE_nowDelay);const r=this.getPlugin();return r&&!r.meta.skipDataQuery&&e&&e.timeRange?e.timeRange:n.state.value},this.onTitleChange=e=>{this.setState({title:e})},this.onDescriptionChange=e=>{this.setState({description:e})},this.onDisplayModeChange=e=>{this.setState({displayMode:e})},this.onOptionsChange=(e,t=!1)=>{const{fieldConfig:n,options:i}=this.state,a=t?e:(0,Bc.mergeWith)((0,Bc.cloneDeep)(i),e,((e,t)=>{if((0,Bc.isArray)(t))return t})),o=(0,r.getPanelOptionsWithDefaults)({plugin:this._plugin,currentOptions:a,currentFieldConfig:n,isAfterPluginChange:!1});this.setState({options:o.options})},this.onFieldConfigChange=(e,t)=>{const{fieldConfig:n,options:i}=this.state,a=t?e:(0,Bc.merge)((0,Bc.cloneDeep)(n),e),o=(0,r.getPanelOptionsWithDefaults)({plugin:this._plugin,currentOptions:i,currentFieldConfig:a,isAfterPluginChange:!1});this._dataWithFieldConfig=void 0,this.setState({fieldConfig:o.fieldConfig})},this.interpolate=(e,t,n)=>nm.interpolate(this,e,t,n),this.getDescription=()=>{this.publishEvent(new ch({origin:this,interaction:"panel-description-shown"}),!0);const{description:e}=this.state;if(e){const t=this.interpolate(e);return(0,r.renderMarkdown)(t)}return""},this.onCancelQuery=()=>{var e;this.publishEvent(new ch({origin:this,interaction:"panel-cancel-query-clicked"}),!0);const t=nm.getData(this);null==(e=t.cancelQuery)||e.call(t)},this.onStatusMessageClick=()=>{this.publishEvent(new ch({origin:this,interaction:"panel-status-message-clicked"}),!0)},this._onSeriesColorChange=(e,t)=>{this.onFieldConfigChange(((e,t,n)=>{const{overrides:i}=n,a=n.overrides.findIndex((t=>t.matcher.id===r.FieldMatcherID.byName&&t.matcher.options===e));if(a<0)return eb(Zy({},n),{overrides:[...n.overrides,tb(e,t)]});const o=Array.from(i),s=o[a],l=s.properties.findIndex((e=>"color"===e.id));if(l<0)return o[a]=eb(Zy({},s),{properties:[...s.properties,nb(t)]}),eb(Zy({},n),{overrides:o});const c=Array.from(s.properties);return c[l]=nb(t),o[a]=eb(Zy({},s),{properties:c}),eb(Zy({},n),{overrides:o})})(e,t,this.state.fieldConfig))},this._onSeriesVisibilityChange=(e,t)=>{this._dataWithFieldConfig&&this.onFieldConfigChange(function(e,t,n,r){const{overrides:i}=n,a=e,s=i.findIndex($y);if(s<0){if(t===o.SeriesVisibilityChangeMode.ToggleSelection){const e=By([a,...Hy(i,r)]);return My(Ly({},n),{overrides:[...n.overrides,e]})}const e=By(qy(r,a));return My(Ly({},n),{overrides:[...n.overrides,e]})}const l=Array.from(i),[c]=l.splice(s,1);if(t===o.SeriesVisibilityChangeMode.ToggleSelection){let e=Uy(c);const t=Hy(l,r);if(t.length>0&&(e=e.filter((e=>t.indexOf(e)<0))),e[0]===a&&1===e.length)return My(Ly({},n),{overrides:l});const i=By([a,...t]);return My(Ly({},n),{overrides:[...l,i]})}const u=Vy(c,a);return zy(u,r)?My(Ly({},n),{overrides:l}):My(Ly({},n),{overrides:[...l,u]})}(e,t,this.state.fieldConfig,this._dataWithFieldConfig.series),!0)},this._onInstanceStateChange=e=>{this._panelContext&&(this._panelContext=db(ub({},this._panelContext),{instanceState:e})),this.setState({_pluginInstanceState:e})},this._onToggleLegendSort=e=>{const t=this.state.options.legend;if(!t)return;let n=t.sortDesc,r=t.sortBy;e!==r&&(n=void 0),!1===n?(r=void 0,n=void 0):(n=!n,r=e),this.onOptionsChange(db(ub({},this.state.options),{legend:db(ub({},t),{sortBy:r,sortDesc:n})}),!0)},this.addActivationHandler((()=>{this._onActivate()})),null==(t=e.menu)||t.addActivationHandler((()=>{this.publishEvent(new ch({origin:this,interaction:"panel-menu-shown"}),!0)}))}_onActivate(){this._plugin||this._loadPlugin(this.state.pluginId)}async _loadPlugin(e){const t=function(e){var t;const{getPanelPluginFromCache:n}=(0,a.getPluginImportUtils)();return null!=(t=n(e))?t:qp.get(e)}(e);if(t)this._pluginLoaded(t);else{const{importPanelPlugin:t}=(0,a.getPluginImportUtils)();try{const n=await t(e);this._pluginLoaded(n)}catch(t){this._pluginLoaded(function(e){const t=new r.PanelPlugin((()=>null));return t.meta={id:e,name:e,sort:100,type:r.PluginType.panel,module:"",baseUrl:"",info:{author:{name:""},description:"",links:[],logos:{large:"",small:"public/img/grafana_icon.svg"},screenshots:[],updated:"",version:""}},t}(e)),t instanceof Error&&this.setState({_pluginLoadError:t.message})}}}getLegacyPanelId(){const e=parseInt(this.state.key.replace("panel-",""),10);return isNaN(e)?0:e}async _pluginLoaded(e){const{options:t,fieldConfig:n,title:i,pluginVersion:a,_UNSAFE_customMigrationHandler:o}=this.state,s={title:i,options:t,fieldConfig:n,id:this.getLegacyPanelId(),type:e.meta.id,pluginVersion:a},l=this._getPluginVersion(e);null==o||o(s,e),e.onPanelMigration&&l!==this.state.pluginVersion&&(s.options=await e.onPanelMigration(s));const c=(0,r.getPanelOptionsWithDefaults)({plugin:e,currentOptions:s.options,currentFieldConfig:s.fieldConfig,isAfterPluginChange:!1});if(this._plugin=e,this.setState({options:c.options,fieldConfig:c.fieldConfig,pluginVersion:l}),e.meta.skipDataQuery){const e=nm.getTimeRange(this);this._subs.add(e.subscribeToState((()=>this.forceRender())))}}_getPluginVersion(e){return e&&e.meta.info.version?e.meta.info.version:a.config.buildInfo.version}getPlugin(){return this._plugin}getPanelContext(){return null!=this._panelContext||(this._panelContext=this.buildPanelContext()),this._panelContext}clearFieldConfigCache(){this._dataWithFieldConfig=void 0}applyFieldConfig(e){var t,n,i,o;const s=this._plugin;if(!s||s.meta.skipDataQuery||!e)return Xh;if(this._prevData===e&&this._dataWithFieldConfig)return this._dataWithFieldConfig;const l=s.dataSupport||{alertStates:!1,annotations:!1},c=s.fieldConfigRegistry,u=null!=(n=null==(t=this._dataWithFieldConfig)?void 0:t.series)?n:[],d=(0,r.applyFieldOverrides)({data:e.series,fieldConfig:this.state.fieldConfig,fieldConfigRegistry:c,replaceVariables:this.interpolate,theme:a.config.theme2,timeZone:null==(i=e.request)?void 0:i.timezone});return(0,r.compareArrayValues)(d,u,r.compareDataFrameStructures)||this._structureRev++,this._dataWithFieldConfig=db(ub({},e),{structureRev:this._structureRev,series:d}),this._dataWithFieldConfig.annotations&&(this._dataWithFieldConfig.annotations=(0,r.applyFieldOverrides)({data:this._dataWithFieldConfig.annotations,fieldConfig:{defaults:{},overrides:[]},fieldConfigRegistry:c,replaceVariables:this.interpolate,theme:a.config.theme2,timeZone:null==(o=e.request)?void 0:o.timezone})),l.alertStates||(this._dataWithFieldConfig.alertState=void 0),l.annotations||(this._dataWithFieldConfig.annotations=void 0),this._prevData=e,this._dataWithFieldConfig}buildPanelContext(){const e=(t=this,nm.findObject(t,(e=>e instanceof by)));var t;const n={eventsScope:e?e.getEventsScope():"__global_",eventBus:e?e.getEventsBus(this):(0,a.getAppEvents)(),app:r.CoreApp.Unknown,sync:()=>e?e.state.sync:r.DashboardCursorSync.Off,onSeriesColorChange:this._onSeriesColorChange,onToggleSeriesVisibility:this._onSeriesVisibilityChange,onToggleLegendSort:this._onToggleLegendSort,onInstanceStateChange:this._onInstanceStateChange};return this.state.extendPanelContext&&this.state.extendPanelContext(this,n),n}}pb.Component=function({model:e}){var t;const{title:n,options:s,fieldConfig:l,_pluginLoadError:c,displayMode:u,hoverHeader:d,hoverHeaderOffset:p,menu:h,headerActions:f,titleItems:m,description:g}=e.useState(),[y,{width:b,height:v}]=Oy(),w=(0,Fi.useMemo)((()=>(0,a.getAppEvents)()),[]),S=(0,Fi.useCallback)((()=>w.publish(new r.SetPanelAttentionEvent({panelId:e.state.key}))),[e.state.key,w]),E=(0,Fi.useMemo)((()=>(0,Bc.debounce)(S,100)),[S]),x=e.getPlugin(),{dragClass:O,dragClassCancel:_}=function(e){var t,n;const r=nm.getLayout(e),i=null==r?void 0:r.isDraggable();if(!r||!i||function(e,t){let n=e.parent;for(;n&&n!==t;){if("isDraggable"in n.state&&!1===n.state.isDraggable)return!0;n=n.parent}return!1}(e,r))return{dragClass:"",dragClassCancel:""};return{dragClass:null==(t=r.getDragClass)?void 0:t.call(r),dragClassCancel:null==(n=null==r?void 0:r.getDragClassCancel)?void 0:n.call(r)}}(e),T=nm.getData(e),C=T.useState(),k=e.applyFieldConfig(C.data),P=nm.getTimeRange(e).getTimeZone(),A=e.getTimeRange(k),R=e.interpolate(n,void 0,"text"),D=(0,o.useStyles2)(ky);if(!x)return $i().createElement("div",null,"Loading plugin panel...");if(!x.panel)return $i().createElement("div",null,"Panel plugin has no panel component");const j=x.panel;T&&T.setContainerWidth&&T.setContainerWidth(Math.round(b));let I,N,L=[];m&&(Array.isArray(m)?L=L.concat(m.map((e=>$i().createElement(e.Component,{model:e,key:`${e.state.key}`})))):If(m)?L.push($i().createElement(m.Component,{model:m})):L.push(m)),e.state.$timeRange&&L.push($i().createElement(e.state.$timeRange.Component,{model:e.state.$timeRange,key:e.state.key})),k.alertState&&L.push($i().createElement(o.Tooltip,{content:null!=(t=k.alertState.state)?t:"unknown",key:`alert-states-icon-${e.state.key}`},$i().createElement(o.PanelChrome.TitleItem,{className:(0,i.cx)({[D.ok]:k.alertState.state===r.AlertState.OK,[D.pending]:k.alertState.state===r.AlertState.Pending,[D.alerting]:k.alertState.state===r.AlertState.Alerting})},$i().createElement(o.Icon,{name:"alerting"===k.alertState.state?"heart-break":"heart",className:"panel-alert-icon",size:"md"})))),h&&(I=$i().createElement(h.Component,{model:h})),f&&(N=Array.isArray(f)?$i().createElement($i().Fragment,null,f.map((e=>$i().createElement(e.Component,{model:e,key:`${e.state.key}`})))):If(f)?$i().createElement(f.Component,{model:f}):f);const M=k,F=!T.isDataReadyToDisplay||T.isDataReadyToDisplay(),$=e.getPanelContext(),B=e.getLegacyPanelId();return $i().createElement("div",{className:Ty},$i().createElement("div",{ref:y,className:Cy,"data-viz-panel-key":e.state.key},b>0&&v>0&&$i().createElement(o.PanelChrome,{title:R,description:(null==g?void 0:g.trim())?e.getDescription:void 0,loadingState:M.state,statusMessage:_y(M,c),statusMessageOnClick:e.onStatusMessageClick,width:b,height:v,displayMode:u,hoverHeader:d,hoverHeaderOffset:p,titleItems:L,dragClass:O,actions:N,dragClassCancel:_,padding:x.noPadding?"none":"md",menu:I,onCancelQuery:e.onCancelQuery,onFocus:S,onMouseMove:E},((t,i)=>$i().createElement($i().Fragment,null,$i().createElement(o.ErrorBoundaryAlert,{dependencies:[x,M]},$i().createElement(r.PluginContextProvider,{meta:x.meta},$i().createElement(o.PanelContextProvider,{value:$},F&&$i().createElement(j,{id:B,data:M,title:n,timeRange:A,timeZone:P,options:s,fieldConfig:l,transparent:!1,width:t,height:i,renderCounter:0,replaceVariables:e.interpolate,onOptionsChange:e.onOptionsChange,onFieldConfigChange:e.onFieldConfigChange,onChangeTimeRange:e.onTimeRangeChange,eventBus:w})))))))))};const hb=class extends vh{constructor({enabled:e=!1}){super({enabled:e}),this.timerId=void 0,this._activationHandler=()=>(this.state.enabled&&this.enable(),()=>{window.clearInterval(this.timerId),this.timerId=void 0}),this.addActivationHandler(this._activationHandler)}enable(){window.clearInterval(this.timerId),this.timerId=void 0,this.timerId=window.setInterval((()=>{const e=nm.findAllObjects(this.getRoot(),(e=>e instanceof pb));for(const t of e)t.forceRender()}),hb.REFRESH_RATE),this.setState({enabled:!0})}disable(){window.clearInterval(this.timerId),this.timerId=void 0,this.setState({enabled:!1})}get isEnabled(){return this.state.enabled}};let fb=hb;function mb(e){if("string"==typeof e)return e;if(e){if(e instanceof Error)return e.message;if((0,a.isFetchError)(e)){if(e.data&&e.data.message)return e.data.message;if(e.statusText)return e.statusText}else if(e.hasOwnProperty("message"))return e.message}return JSON.stringify(e)}fb.REFRESH_RATE=100;var gb=Object.defineProperty,yb=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,vb=Object.prototype.propertyIsEnumerable,wb=(e,t,n)=>t in e?gb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class Sb extends vh{constructor(e,t=[]){super(((e,t)=>{for(var n in t||(t={}))bb.call(t,n)&&wb(e,n,t[n]);if(yb)for(var n of yb(t))vb.call(t,n)&&wb(e,n,t[n]);return e})({isEnabled:!0},e)),this._results=new Hp.ReplaySubject(1),this.isDataLayer=!0,this._variableValueRecorder=new om,this._variableDependency=new am(this,{onVariableUpdateCompleted:this.onVariableUpdateCompleted.bind(this)}),this._variableDependency.setPaths(t),this.addActivationHandler((()=>this.onActivate()))}onActivate(){return this.state.isEnabled&&this.onEnable(),this.shouldRunLayerOnActivate()&&this.runLayer(),this.subscribeToState(((e,t)=>{!e.isEnabled&&this.querySub&&(this.querySub.unsubscribe(),this.querySub=void 0,this.onDisable(),this._results.next({origin:this,data:Xh}),this.setStateHelper({data:Xh})),e.isEnabled&&!t.isEnabled&&(this.onEnable(),this.runLayer())})),()=>{this.onDeactivate()}}onDeactivate(){this.querySub&&(this.querySub.unsubscribe(),this.querySub=void 0),this.onDisable(),this._variableValueRecorder.recordCurrentDependencyValuesForSceneObject(this)}onVariableUpdateCompleted(){this.runLayer()}cancelQuery(){this.querySub&&(this.querySub.unsubscribe(),this.querySub=void 0,this.publishResults(Xh))}publishResults(e){this.state.isEnabled&&(this._results.next({origin:this,data:e}),this.setStateHelper({data:e}))}getResultsStream(){return this._results}shouldRunLayerOnActivate(){return this._variableValueRecorder.hasDependenciesChanged(this)?(im(),!0):!this.state.data}setStateHelper(e){Rm(this,e)}}function Eb({layer:e}){var t,n;const r=`data-layer-${e.state.key}`,{data:i,isEnabled:a}=e.useState(),s=Boolean(i&&i.state===Hh.Loading);return $i().createElement("div",{className:xb},$i().createElement(pg,{htmlFor:r,isLoading:s,onCancel:()=>{var t;return null==(t=e.cancelQuery)?void 0:t.call(e)},label:e.state.name,description:e.state.description,error:null==(n=null==(t=e.state.data)?void 0:t.errors)?void 0:n[0].message}),$i().createElement(o.InlineSwitch,{id:r,value:a,onChange:()=>e.setState({isEnabled:!a})}))}(class extends vh{constructor(){super({})}}).Component=function({model:e}){const t=nm.getDataLayers(e,!0);if(0===t.length)return null;return $i().createElement($i().Fragment,null,t.map((e=>$i().createElement(e.Component,{model:e,key:e.state.key}))))};const xb=(0,i.css)({display:"flex"});function Ob(e){return"function"==typeof e}function _b(e){return function(t){if(function(e){return Ob(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}var Tb=function(e,t){return Tb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Tb(e,t)};function Cb(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Tb(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function kb(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}function Pb(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}Object.create;function Ab(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rb(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function Db(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function jb(e){return this instanceof jb?(this.v=e,this):new jb(e)}function Ib(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),a=[];return r={},o("next"),o("throw"),o("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||s(e,t)}))},t&&(r[e]=t(r[e])))}function s(e,t){try{!function(e){e.value instanceof jb?Promise.resolve(e.value.v).then(l,c):u(a[0][2],e)}(i[e](t))}catch(e){u(a[0][3],e)}}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Nb(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Ab(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}Object.create;"function"==typeof SuppressedError&&SuppressedError;var Lb,Mb,Fb=(Lb=function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}},(Mb=Lb((function(e){Error.call(e),e.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),Mb.prototype.constructor=Mb,Mb);function $b(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Bb=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=Ab(a),s=o.next();!s.done;s=o.next()){s.value.remove(this)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(Ob(l))try{l()}catch(e){i=e instanceof Fb?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=Ab(c),d=u.next();!d.done;d=u.next()){var p=d.value;try{Ub(p)}catch(e){i=null!=i?i:[],e instanceof Fb?i=Db(Db([],Rb(i)),Rb(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new Fb(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Ub(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&$b(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&$b(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}();Bb.EMPTY;function Vb(e){return e instanceof Bb||e&&"closed"in e&&Ob(e.remove)&&Ob(e.add)&&Ob(e.unsubscribe)}function Ub(e){Ob(e)?e():e.unsubscribe()}var zb={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},qb={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=qb.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,Db([e,t],Rb(n))):setTimeout.apply(void 0,Db([e,t],Rb(n)))},clearTimeout:function(e){var t=qb.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function Hb(e){qb.setTimeout((function(){var t=zb.onUnhandledError;if(!t)throw e;t(e)}))}function Gb(){}var Wb=Qb("C",void 0,void 0);function Qb(e,t,n){return{kind:e,value:t,error:n}}var Kb=null;var Yb=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Vb(t)&&t.add(n)):n.destination=rv,n}return Cb(t,e),t.create=function(e,t,n){return new ev(e,t,n)},t.prototype.next=function(e){this.isStopped?nv(function(e){return Qb("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?nv(function(e){return Qb("E",void 0,e)}(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?nv(Wb,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Bb),Xb=Function.prototype.bind;function Jb(e,t){return Xb.call(e,t)}var Zb=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){tv(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){tv(e)}else tv(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){tv(e)}},e}(),ev=function(e){function t(t,n,r){var i,a,o=e.call(this)||this;Ob(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:o&&zb.useDeprecatedNextContext?((a=Object.create(t)).unsubscribe=function(){return o.unsubscribe()},i={next:t.next&&Jb(t.next,a),error:t.error&&Jb(t.error,a),complete:t.complete&&Jb(t.complete,a)}):i=t;return o.destination=new Zb(i),o}return Cb(t,e),t}(Yb);function tv(e){zb.useDeprecatedSynchronousErrorHandling?function(e){zb.useDeprecatedSynchronousErrorHandling&&Kb&&(Kb.errorThrown=!0,Kb.error=e)}(e):Hb(e)}function nv(e,t){var n=zb.onStoppedNotification;n&&qb.setTimeout((function(){return n(e,t)}))}var rv={closed:!0,next:Gb,error:function(e){throw e},complete:Gb};function iv(e,t,n,r,i){return new av(e,t,n,r,i)}var av=function(e){function t(t,n,r,i,a,o){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=o,s._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return Cb(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Yb);function ov(e,t){return _b((function(n,r){var i=0;n.subscribe(iv(r,(function(n){r.next(e.call(t,n,i++))})))}))}var sv=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};var lv="function"==typeof Symbol&&Symbol.observable||"@@observable";function cv(e){return e}function uv(e){return 0===e.length?cv:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var dv=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,a=(r=e)&&r instanceof Yb||function(e){return e&&Ob(e.next)&&Ob(e.error)&&Ob(e.complete)}(r)&&Vb(r)?e:new ev(e,t,n);return function(e){if(zb.useDeprecatedSynchronousErrorHandling){var t=!Kb;if(t&&(Kb={errorThrown:!1,error:null}),e(),t){var n=Kb,r=n.errorThrown,i=n.error;if(Kb=null,r)throw i}}else e()}((function(){var e=i,t=e.operator,n=e.source;a.add(t?t.call(a,n):n?i._subscribe(a):i._trySubscribe(a))})),a},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=pv(t))((function(t,r){var i=new ev({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[lv]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return uv(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=pv(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function pv(e){var t;return null!==(t=null!=e?e:zb.Promise)&&void 0!==t?t:Promise}var hv="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function fv(e){if(e instanceof dv)return e;if(null!=e){if(function(e){return Ob(e[lv])}(e))return a=e,new dv((function(e){var t=a[lv]();if(Ob(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(sv(e))return i=e,new dv((function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()}));if(Ob(null==(r=e)?void 0:r.then))return n=e,new dv((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Hb)}));if(function(e){return Symbol.asyncIterator&&Ob(null==e?void 0:e[Symbol.asyncIterator])}(e))return mv(e);if(function(e){return Ob(null==e?void 0:e[hv])}(e))return t=e,new dv((function(e){var n,r;try{for(var i=Ab(t),a=i.next();!a.done;a=i.next()){var o=a.value;if(e.next(o),e.closed)return}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(function(e){return Ob(null==e?void 0:e.getReader)}(e))return mv(function(e){return Ib(this,arguments,(function(){var t,n,r;return Pb(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,jb(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,jb(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,jb(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e))}var t,n,r,i,a;throw function(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(e)}function mv(e){return new dv((function(t){(function(e,t){var n,r,i,a;return kb(this,void 0,void 0,(function(){var o,s;return Pb(this,(function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=Nb(e),l.label=1;case 1:return[4,n.next()];case 2:if((r=l.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),i={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(a=n.return)?[4,a.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function gv(e,t,n){return void 0===n&&(n=1/0),Ob(t)?gv((function(n,r){return ov((function(e,i){return t(n,e,r,i)}))(fv(e(n,r)))}),n):("number"==typeof t&&(n=t),_b((function(t,r){return function(e,t,n,r,i,a,o,s){var l=[],c=0,u=0,d=!1,p=function(){!d||l.length||c||t.complete()},h=function(e){return c<r?f(e):l.push(e)},f=function(e){a&&t.next(e),c++;var s=!1;fv(n(e,u++)).subscribe(iv(t,(function(e){null==i||i(e),a?h(e):t.next(e)}),(function(){s=!0}),void 0,(function(){if(s)try{c--;for(var e=function(){var e=l.shift();o?function(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var a=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);e.add(a)}(t,o,(function(){return f(e)})):f(e)};l.length&&c<r;)e();p()}catch(e){t.error(e)}})))};return e.subscribe(iv(t,h,(function(){d=!0,p()}))),function(){null==s||s()}}(t,r,e,n)})))}var yv=Object.defineProperty,bv=Object.defineProperties,vv=Object.getOwnPropertyDescriptors,wv=Object.getOwnPropertySymbols,Sv=Object.prototype.hasOwnProperty,Ev=Object.prototype.propertyIsEnumerable,xv=(e,t,n)=>t in e?yv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const Ov={prepareAnnotation:e=>{if((0,Bc.isString)(null==e?void 0:e.query)){const t=e,{query:n}=t;return((e,t)=>bv(e,vv(t)))(((e,t)=>{for(var n in t||(t={}))Sv.call(t,n)&&xv(e,n,t[n]);if(wv)for(var n of wv(t))Ev.call(t,n)&&xv(e,n,t[n]);return e})({},((e,t)=>{var n={};for(var r in e)Sv.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&wv)for(var r of wv(e))t.indexOf(r)<0&&Ev.call(e,r)&&(n[r]=e[r]);return n})(t,["query"])),{target:{refId:"annotation_query",query:n},mappings:{}})}return e},prepareQuery:e=>e.target,processEvents:(e,t)=>function(e,t){return(0,Hp.of)(e).pipe((e=>e.pipe(gv((e=>{if(!(null==e?void 0:e.length))return(0,Hp.of)(void 0);if(1===e.length)return(0,Hp.of)(e[0]);const t={interpolate:e=>e};return(0,Hp.of)(e).pipe(r.standardTransformers.mergeTransformer.operator({},t),ov((e=>e[0])))})))),ov((e=>{if(!(null==e?void 0:e.length))return[];let n=!1,i=!1;const a={};for(const t of e.fields){a[(0,r.getFieldDisplayName)(t,e).toLowerCase()]=t}t||(t={});const o=[];for(const s of Tv){const l=t[s.key]||{};if(l.source===r.AnnotationEventFieldSource.Skip)continue;const c={key:s.key,split:s.split};if(l.source===r.AnnotationEventFieldSource.Text)c.text=l.value;else{const t=(l.value||s.key).toLowerCase();c.field=a[t],!c.field&&s.field&&(c.field=s.field(e))}(c.field||c.text)&&(o.push(c),"time"===c.key?n=!0:"text"===c.key&&(i=!0))}if(!n||!i)return console.error("Cannot process annotation fields. No time or text present."),[];const s=[];for(let t=0;t<e.length;t++){const e={type:"default",color:"red"};for(const n of o){let r;if(n.text)r=n.text;else if(n.field&&(r=n.field.values.get(t),void 0!==r&&n.regex)){const e=n.regex.exec(r);e&&(r=e[1]?e[1]:e[0])}null!=r&&(n.split&&"string"==typeof r&&(r=r.split(",")),e[n.key]=r)}s.push(e)}return s})))}(t,e.mappings)};const _v=[{key:"time",field:e=>e.fields.find((e=>e.type===r.FieldType.time)),placeholder:"time, or the first time field"},{key:"timeEnd",help:"When this field is defined, the annotation will be treated as a range"},{key:"title"},{key:"text",field:e=>e.fields.find((e=>e.type===r.FieldType.string)),placeholder:"text, or the first text field"},{key:"tags",split:",",help:"The results will be split on comma (,)"},{key:"id"}],Tv=[...a.config.publicDashboardAccessToken?[{key:"color"},{key:"isRegion"},{key:"source"}]:[],..._v,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];const Cv=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];var kv=Object.defineProperty,Pv=Object.defineProperties,Av=Object.getOwnPropertyDescriptors,Rv=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,jv=Object.prototype.propertyIsEnumerable,Iv=(e,t,n)=>t in e?kv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nv=(e,t)=>{for(var n in t||(t={}))Dv.call(t,n)&&Iv(e,n,t[n]);if(Rv)for(var n of Rv(t))jv.call(t,n)&&Iv(e,n,t[n]);return e},Lv=(e,t)=>Pv(e,Av(t));let Mv=100;function Fv(e,t,n,i){var o;if(e.annotationQuery&&function(e){const{type:t}=e;return!e.annotations||Cv.includes(t)}(e))return console.warn("Using deprecated annotationQuery method, please upgrade your datasource"),(0,Hp.from)(e.annotationQuery({range:t.state.value,rangeRaw:t.state.value.raw,annotation:n,dashboard:{}})).pipe(ov((e=>({state:Hh.Done,events:e}))));const s=Nv(Nv({},Ov),e.annotations),l=Nv(Nv({},null==(o=s.getDefaultQuery)?void 0:o.call(s)),n),c=s.prepareAnnotation(l);if(!c)return(0,Hp.of)({state:Hh.Done,events:[]});const u=s.prepareQuery(c);if(!u)return(0,Hp.of)({state:Hh.Done,events:[]});const d=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,p=r.rangeUtil.calculateInterval(t.state.value,d,e.interval),h={__interval:{text:p.interval,value:p.interval},__interval_ms:{text:p.intervalMs.toString(),value:p.intervalMs},__annotation:{text:c.name,value:c},__sceneObject:{text:"__sceneObject",value:i}},f=Nv(Lv(Nv({startTime:Date.now(),requestId:"AQ"+Mv++,range:t.state.value,maxDataPoints:d,scopedVars:h},p),{app:r.CoreApp.Dashboard,timezone:t.getTimeZone(),targets:[Lv(Nv({},u),{refId:"Anno"})]}),Tm(i));return(0,a.getRunRequest)()(e,f).pipe(gv((e=>{const t=(null==e?void 0:e.series.length)?e.series:e.annotations;return(null==t?void 0:t.length)?(t.forEach((e=>{var t;(null==(t=e.meta)?void 0:t.dataTopic)||(e.meta=Lv(Nv({},e.meta||{}),{dataTopic:r.DataTopic.Annotations}))})),s.processEvents(c,t).pipe(ov((t=>({state:e.state,events:t||[]}))))):(0,Hp.of)({state:e.state,events:[]})})))}var $v=Object.defineProperty,Bv=Object.getOwnPropertySymbols,Vv=Object.prototype.hasOwnProperty,Uv=Object.prototype.propertyIsEnumerable,zv=(e,t,n)=>t in e?$v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function qv(e,t){e.snapshotData&&delete(e=(0,Bc.cloneDeep)(e)).snapshotData;const n=t.map((t=>{var n;const r=((e,t)=>{for(var n in t||(t={}))Vv.call(t,n)&&zv(e,n,t[n]);if(Bv)for(var n of Bv(t))Uv.call(t,n)&&zv(e,n,t[n]);return e})({},t);switch(r.source=e,r.color=a.config.theme2.visualization.getColorByName(e.iconColor),r.type=e.name,r.isRegion=Boolean(r.timeEnd&&r.time!==r.timeEnd),null==(n=r.newState)?void 0:n.toLowerCase()){case"pending":r.color="yellow";break;case"alerting":r.color="red";break;case"ok":case"normal":r.color="green";break;case"no_data":case"nodata":r.color="gray"}return r}));return n}function Hv(e){return"panel-alert"===e.eventType}var Gv=Object.defineProperty,Wv=Object.defineProperties,Qv=Object.getOwnPropertyDescriptors,Kv=Object.getOwnPropertySymbols,Yv=Object.prototype.hasOwnProperty,Xv=Object.prototype.propertyIsEnumerable,Jv=(e,t,n)=>t in e?Gv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zv=(e,t)=>{for(var n in t||(t={}))Yv.call(t,n)&&Jv(e,n,t[n]);if(Kv)for(var n of Kv(t))Xv.call(t,n)&&Jv(e,n,t[n]);return e},ew=(e,t)=>Wv(e,Qv(t));(class extends Sb{constructor(e){super(Zv({isEnabled:!0},e),["query"]),this._scopedVars={__sceneObject:{value:this,text:"__sceneObject"}}}onEnable(){const e=nm.getTimeRange(this);this._timeRangeSub=e.subscribeToState((()=>{this.runWithTimeRange(e)}))}onDisable(){var e;null==(e=this._timeRangeSub)||e.unsubscribe()}runLayer(){im();const e=nm.getTimeRange(this);this.runWithTimeRange(e)}async runWithTimeRange(e){const{query:t}=this.state;if(this.querySub&&this.querySub.unsubscribe(),this._variableDependency.hasDependencyInLoadingState())im();else try{let n=Fv(await this.resolveDataSource(t),e,t,this).pipe(Pm({type:"annotations",origin:this,cancel:()=>this.cancelQuery()}),(0,Hp.map)((e=>this.processEvents(t,e))));this.querySub=n.subscribe((e=>{this.publishResults(e)}))}catch(e){this.publishResults(ew(Zv({},Xh),{state:Hh.Error,errors:[{message:mb(e)}]})),console.error("AnnotationsDataLayer error",e)}}async resolveDataSource(e){return await rm(e.datasource||void 0,this._scopedVars)}processEvents(e,t){let n=qv(e,t.events||[]);n=function(e){let t=[];const n=(0,Bc.partition)(e,"id"),r=(0,Bc.groupBy)(n[0],"id");return t=(0,Bc.map)(r,(e=>e.length>1&&!(0,Bc.every)(e,Hv)?(0,Bc.find)(e,(e=>"panel-alert"!==e.eventType)):(0,Bc.head)(e))),t=(0,Bc.concat)(t,n[1]),t}(n);const i=ew(Zv({},Xh),{state:t.state}),a=(0,r.arrayToDataFrame)(n);return a.meta=ew(Zv({},a.meta),{dataTopic:r.DataTopic.Annotations}),i.series=[a],i}}).Component=function({model:e}){const{isHidden:t}=e.useState();if(t)return null;return $i().createElement(Eb,{layer:e})};Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var tw=Object.defineProperty,nw=Object.defineProperties,rw=Object.getOwnPropertyDescriptors,iw=Object.getOwnPropertySymbols,aw=Object.prototype.hasOwnProperty,ow=Object.prototype.propertyIsEnumerable,sw=(e,t,n)=>t in e?tw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class lw extends vh{constructor(){super(...arguments),this.isDataLayer=!0,this._results=new Hp.ReplaySubject(1),this._dataLayersMerger=new Fg}subscribeToAllLayers(e){e.length>0?this.querySub=this._dataLayersMerger.getMergedStream(e).subscribe(this._onLayerUpdateReceived.bind(this)):(this._results.next({origin:this,data:Xh}),this.setStateHelper({data:Xh}))}_onLayerUpdateReceived(e){var t;let n=[];for(const r of e)(null==(t=r.data)?void 0:t.series)&&(n=n.concat(r.data.series));const r=((e,t)=>nw(e,rw(t)))(((e,t)=>{for(var n in t||(t={}))aw.call(t,n)&&sw(e,n,t[n]);if(iw)for(var n of iw(t))ow.call(t,n)&&sw(e,n,t[n]);return e})({},Xh),{series:n});this._results.next({origin:this,data:r}),this.setStateHelper({data:r})}getResultsStream(){return this._results}cancelQuery(){var e;null==(e=this.querySub)||e.unsubscribe()}setStateHelper(e){Rm(this,e)}}class cw extends lw{constructor(e){var t,n;super({name:null!=(t=e.name)?t:"Data layers",layers:null!=(n=e.layers)?n:[]}),this.addActivationHandler((()=>this._onActivate()))}_onActivate(){return this._subs.add(this.subscribeToState(((e,t)=>{var n;e.layers!==t.layers&&(null==(n=this.querySub)||n.unsubscribe(),this.subscribeToAllLayers(e.layers))}))),this.subscribeToAllLayers(this.state.layers),()=>{var e;null==(e=this.querySub)||e.unsubscribe()}}}cw.Component=({model:e})=>{const{layers:t}=e.useState();return $i().createElement($i().Fragment,null,t.map((e=>$i().createElement(e.Component,{model:e,key:e.state.key}))))};var uw=Object.defineProperty,dw=Object.defineProperties,pw=Object.getOwnPropertyDescriptors,hw=Object.getOwnPropertySymbols,fw=Object.prototype.hasOwnProperty,mw=Object.prototype.propertyIsEnumerable,gw=(e,t,n)=>t in e?uw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yw=(e,t)=>{for(var n in t||(t={}))fw.call(t,n)&&gw(e,n,t[n]);if(hw)for(var n of hw(t))mw.call(t,n)&&gw(e,n,t[n]);return e},bw=(e,t)=>dw(e,pw(t));class vw extends vh{constructor(e){super(e),this._results=new Hp.ReplaySubject(1),this._variableDependency=new am(this,{statePaths:["transformations"],onReferencedVariableValueChanged:()=>this.reprocessTransformations()}),this.addActivationHandler((()=>this.activationHandler()))}activationHandler(){const e=this.getSourceData();return this._subs.add(e.subscribeToState((e=>this.transform(e.data)))),e.state.data&&this.transform(e.state.data),()=>{this._transformSub&&this._transformSub.unsubscribe()}}getSourceData(){if(this.state.$data){if(this.state.$data instanceof cw)throw new Error("SceneDataLayerSet can not be used as data provider for SceneDataTransformer.");return this.state.$data}if(!this.parent||!this.parent.parent)throw new Error("SceneDataTransformer must either have $data set on it or have a parent.parent with $data");return nm.getData(this.parent.parent)}setContainerWidth(e){this.state.$data&&this.state.$data.setContainerWidth&&this.state.$data.setContainerWidth(e)}isDataReadyToDisplay(){const e=this.getSourceData();return!e.isDataReadyToDisplay||e.isDataReadyToDisplay()}reprocessTransformations(){this.transform(this.getSourceData().state.data,!0)}cancelQuery(){var e,t;null==(t=(e=this.getSourceData()).cancelQuery)||t.call(e)}getResultsStream(){return this._results}clone(e){const t=super.clone(e);return this._prevDataFromSource&&(t._prevDataFromSource=this._prevDataFromSource),t}haveAlreadyTransformedData(e){if(!this._prevDataFromSource)return!1;if(e===this._prevDataFromSource)return!0;const{series:t,annotations:n}=this._prevDataFromSource;return e.series===t&&e.annotations===n&&(this.state.data&&e.state!==this.state.data.state&&this.setState({data:bw(yw({},this.state.data),{state:e.state})}),!0)}transform(e,t=!1){var n;if(0===this.state.transformations.length||!e)return this._prevDataFromSource=e,this.setState({data:e}),void(e&&this._results.next({origin:this,data:e}));if(!t&&this.haveAlreadyTransformedData(e))return;const i=this.state.transformations.filter((e=>!("options"in e)&&!("topic"in e)||(null==e.topic||e.topic===r.DataTopic.Series))).map((e=>"operator"in e?e.operator:e)),o=this.state.transformations.filter((e=>("options"in e||"topic"in e)&&e.topic===r.DataTopic.Annotations)).map((e=>"operator"in e?e.operator:e));this._transformSub&&this._transformSub.unsubscribe();const s={interpolate:t=>{var n;return nm.interpolate(this,t,null==(n=e.request)?void 0:n.scopedVars)}};let l=[(0,r.transformDataFrame)(i,e.series,s)];e.annotations&&e.annotations.length>0&&o.length>0&&l.push((0,r.transformDataFrame)(o,null!=(n=e.annotations)?n:[])),this._transformSub=(0,Hp.forkJoin)(l).pipe((0,Hp.map)((t=>{const n=t[0],r=t[1];return bw(yw({},e),{series:n,annotations:null!=r?r:e.annotations})})),(0,Hp.catchError)((t=>{var n;console.error("Error transforming data: ",t);const i=(null==(n=this.getSourceData().state.data)?void 0:n.errors)||[],o=(0,a.toDataQueryError)(t);o.message=`Error transforming data: ${o.message}`;const s=bw(yw({},e),{state:r.LoadingState.Error,errors:[...i,o]});return(0,Hp.of)(s)}))).subscribe((t=>{this.setState({data:t}),this._results.next({origin:this,data:t}),this._prevDataFromSource=e}))}}function ww({variable:e,layout:t,showAlways:n,hideLabel:i}){return wh(e,{shouldActivateOrKeepAlive:!0}).hide!==r.VariableHide.hideVariable||n?"vertical"===t?$i().createElement("div",{className:xw,"data-testid":Mm.pages.Dashboard.SubMenu.submenuItem},$i().createElement(Sw,{variable:e,layout:t,hideLabel:i}),$i().createElement(e.Component,{model:e})):$i().createElement("div",{className:Ew,"data-testid":Mm.pages.Dashboard.SubMenu.submenuItem},$i().createElement(Sw,{variable:e,hideLabel:i}),$i().createElement(e.Component,{model:e})):null}function Sw({variable:e,layout:t,hideLabel:n}){var i,a;const{state:o}=e;if(e.state.hide===r.VariableHide.hideLabel||n)return null;const s=`var-${o.key}`,l=null!=(i=o.label)?i:o.name;return $i().createElement(pg,{htmlFor:s,isLoading:o.loading,onCancel:()=>{var t;return null==(t=e.onCancel)?void 0:t.call(e)},label:l,error:o.error,layout:t,description:null!=(a=o.description)?a:void 0})}(class extends vh{}).Component=function({model:e}){const t=nm.getVariables(e).useState();return $i().createElement($i().Fragment,null,t.variables.map((t=>$i().createElement(ww,{key:t.state.key,variable:t,layout:e.state.layout}))))};const Ew=(0,i.css)({display:"flex"}),xw=(0,i.css)({display:"flex",flexDirection:"column"});(class extends vh{}).Component=function({model:e}){const t=nm.lookupVariable(e.state.variableName,e);if(!t)return null;return $i().createElement(ww,{key:t.state.key,variable:t,layout:e.state.layout,showAlways:!0})};class Ow extends vh{constructor(e){super(e),this._variablesThatHaveChanged=new Set,this._variablesToUpdate=new Set,this._updating=new Map,this._variableValueRecorder=new om,this._variableDependency=new Tw(this._handleParentVariableUpdatesCompleted.bind(this)),this._onActivate=()=>{const e=nm.getTimeRange(this);this._subs.add(this.subscribeToEvent(hf,(e=>this._handleVariableValueChanged(e.payload)))),this._subs.add(e.subscribeToState((()=>{this._refreshTimeRangeBasedVariables()}))),this._subs.add(this.subscribeToState(this._onStateChanged)),this._checkForVariablesThatChangedWhileInactive();for(const e of this.state.variables)this._variableNeedsUpdate(e)&&this._variablesToUpdate.add(e);return this._updateNextBatch(),this._onDeactivate},this._onDeactivate=()=>{var e;for(const t of this._updating.values())null==(e=t.subscription)||e.unsubscribe();for(const e of this.state.variables)this._variablesToUpdate.has(e)||this._updating.has(e)||this._variableValueRecorder.recordCurrentValue(e);this._variablesToUpdate.clear(),this._updating.clear()},this._onStateChanged=(e,t)=>{const n=this._variablesToUpdate.size;for(const n of t.variables)if(!e.variables.includes(n)){const e=this._updating.get(n);(null==e?void 0:e.subscription)&&e.subscription.unsubscribe(),this._updating.delete(n),this._variablesToUpdate.delete(n)}for(const n of e.variables)t.variables.includes(n)||this._variableNeedsUpdate(n)&&this._variablesToUpdate.add(n);0===n&&this._variablesToUpdate.size>0&&this._updateNextBatch()},this.addActivationHandler(this._onActivate)}getByName(e){return this.state.variables.find((t=>t.state.name===e))}_refreshTimeRangeBasedVariables(){for(const e of this.state.variables)"refresh"in e.state&&e.state.refresh===r.VariableRefresh.onTimeRangeChanged&&this._variablesToUpdate.add(e);this._updateNextBatch()}_checkForVariablesThatChangedWhileInactive(){if(this._variableValueRecorder.hasValues())for(const e of this.state.variables)this._variableValueRecorder.hasValueChanged(e)&&(_w(e,"Changed while in-active"),this._addDependentVariablesToUpdateQueue(e))}_variableNeedsUpdate(e){return!e.isLazy&&(!!e.validateAndUpdate&&(!this._variableValueRecorder.hasRecordedValue(e)||(_w(e,"Skipping updateAndValidate current value valid"),!1)))}_updateNextBatch(){for(const e of this._variablesToUpdate){if(!e.validateAndUpdate)throw new Error("Variable added to variablesToUpdate but does not have validateAndUpdate");if(this._updating.has(e))continue;if(nm.hasVariableDependencyInLoadingState(e))continue;const t={variable:e};this._updating.set(e,t),_w(e,"updateAndValidate started"),t.subscription=e.validateAndUpdate().subscribe({next:()=>this._validateAndUpdateCompleted(e),complete:()=>this._validateAndUpdateCompleted(e),error:t=>this._handleVariableError(e,t)})}}_validateAndUpdateCompleted(e){var t;if(!this._updating.has(e))return;const n=this._updating.get(e);null==(t=null==n?void 0:n.subscription)||t.unsubscribe(),this._updating.delete(e),this._variablesToUpdate.delete(e),_w(e,"updateAndValidate completed"),this._notifyDependentSceneObjects(e),this._updateNextBatch()}cancel(e){var t;const n=this._updating.get(e);null==(t=null==n?void 0:n.subscription)||t.unsubscribe(),this._updating.delete(e),this._variablesToUpdate.delete(e)}_handleVariableError(e,t){var n;const r=this._updating.get(e);null==(n=null==r?void 0:r.subscription)||n.unsubscribe(),this._updating.delete(e),this._variablesToUpdate.delete(e),e.setState({loading:!1,error:t.message}),console.error("SceneVariableSet updateAndValidate error",t),_w(e,"updateAndValidate error",t)}_handleVariableValueChanged(e){this._variablesThatHaveChanged.add(e),this._addDependentVariablesToUpdateQueue(e),this._updating.has(e)||(this._updateNextBatch(),this._notifyDependentSceneObjects(e))}_handleParentVariableUpdatesCompleted(e,t){t&&this._addDependentVariablesToUpdateQueue(e),this._variablesToUpdate.size>0&&0===this._updating.size&&this._updateNextBatch()}_addDependentVariablesToUpdateQueue(e){for(const t of this.state.variables)t.variableDependency&&t.variableDependency.hasDependencyOn(e.state.name)&&(_w(t,"Added to update queue, dependant variable value changed"),this._updating.has(t)&&t.onCancel&&t.onCancel(),this._variablesToUpdate.add(t))}_notifyDependentSceneObjects(e){this.parent&&(this._traverseSceneAndNotify(this.parent,e,this._variablesThatHaveChanged.has(e)),this._variablesThatHaveChanged.delete(e))}_traverseSceneAndNotify(e,t,n){if(this!==e&&e.isActive){if(e.state.$variables&&e.state.$variables!==this){if(e.state.$variables.getByName(t.state.name))return}e.variableDependency&&e.variableDependency.variableUpdateCompleted(t,n),e.forEachChild((e=>this._traverseSceneAndNotify(e,t,n)))}}isVariableLoadingOrWaitingToUpdate(e){return!(!e.isAncestorLoading||!e.isAncestorLoading())||(!(!this._variablesToUpdate.has(e)&&!this._updating.has(e))||nm.hasVariableDependencyInLoadingState(e))}}function _w(e,t,n){im(0,e.state.name)}class Tw{constructor(e){this._variableUpdatesCompleted=e,this._emptySet=new Set}getNames(){return this._emptySet}hasDependencyOn(e){return!1}variableUpdateCompleted(e,t){this._variableUpdatesCompleted(e,t)}}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var Cw=Object.defineProperty,kw=Object.getOwnPropertySymbols,Pw=Object.prototype.hasOwnProperty,Aw=Object.prototype.propertyIsEnumerable,Rw=(e,t,n)=>t in e?Cw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class Dw extends Dm{constructor(e){super(((e,t)=>{for(var n in t||(t={}))Pw.call(t,n)&&Rw(e,n,t[n]);if(kw)for(var n of kw(t))Aw.call(t,n)&&Rw(e,n,t[n]);return e})({type:"custom",query:"",value:"",text:"",options:[],name:""},e)),this._variableDependency=new am(this,{statePaths:["query"]})}getValueOptions(e){var t;const n=(null!=(t=nm.interpolate(this,this.state.query).match(/(?:\\,|[^,])+/g))?t:[]).map((e=>{var t;e=e.replace(/\\,/g,",");const n=null!=(t=/^(.+)\s:\s(.+)$/g.exec(e))?t:[];if(3===n.length){const[,e,t]=n;return{label:e.trim(),value:t.trim()}}return{label:e.trim(),value:e.trim()}}));return(0,Hp.of)(n)}}Dw.Component=({model:e})=>Xm(e);var jw=Object.defineProperty,Iw=Object.getOwnPropertySymbols,Nw=Object.prototype.hasOwnProperty,Lw=Object.prototype.propertyIsEnumerable,Mw=(e,t,n)=>t in e?jw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class Fw extends Dm{constructor(e){super(((e,t)=>{for(var n in t||(t={}))Nw.call(t,n)&&Mw(e,n,t[n]);if(Iw)for(var n of Iw(t))Lw.call(t,n)&&Mw(e,n,t[n]);return e})({type:"datasource",value:"",text:"",options:[],name:"",regex:"",pluginId:""},e)),this._variableDependency=new am(this,{statePaths:["regex"]})}getValueOptions(e){if(!this.state.pluginId)return(0,Hp.of)([]);const t=(0,a.getDataSourceSrv)().getList({metrics:!0,variables:!1,pluginId:this.state.pluginId});let n;if(this.state.regex){const e=nm.interpolate(this,this.state.regex,void 0,"regex");n=(0,r.stringToJsRegex)(e)}const i=[];for(let e=0;e<t.length;e++){const r=t[e];$w(r,n)&&i.push({label:r.name,value:r.uid}),this.state.defaultOptionEnabled&&Bw(r,n)&&i.push({label:"default",value:"default"})}return 0===i.length?this.setState({error:"No data sources found"}):this.state.error&&this.setState({error:null}),(0,Hp.of)(i)}}function $w(e,t){return!t||t.exec(e.name)}function Bw(e,t){return!!e.isDefault&&(!t||t.exec("default"))}Fw.Component=({model:e})=>Xm(e);const Vw=e=>Boolean(e.metricFindQuery)&&!Boolean(e.variables),Uw=e=>{if(!e.variables)return!1;if(e.variables.getType()!==r.VariableSupportType.Standard)return!1;const t=e.variables;return"toDataQuery"in t&&Boolean(t.toDataQuery)},zw=e=>{if(!e.variables)return!1;if(e.variables.getType()!==r.VariableSupportType.Custom)return!1;const t=e.variables;return"query"in t&&"editor"in t&&Boolean(t.query)&&Boolean(t.editor)};var qw=Object.defineProperty,Hw=Object.defineProperties,Gw=Object.getOwnPropertyDescriptors,Ww=Object.getOwnPropertySymbols,Qw=Object.prototype.hasOwnProperty,Kw=Object.prototype.propertyIsEnumerable,Yw=(e,t,n)=>t in e?qw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xw=(e,t)=>{for(var n in t||(t={}))Qw.call(t,n)&&Yw(e,n,t[n]);if(Ww)for(var n of Ww(t))Kw.call(t,n)&&Yw(e,n,t[n]);return e},Jw=(e,t)=>Hw(e,Gw(t));class Zw{constructor(e,t=(0,a.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(Uw(this.datasource))return this.datasource.variables.toDataQuery(function(e){var t;const n=null!=(t=e.state.query)?t:"";if("string"==typeof n)return{query:n,refId:`variable-${e.state.name}`};if(null==n.refId)return Jw(Xw({},n),{refId:`variable-${e.state.name}`});return e.state.query}(e));throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return Uw(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):nS()}}class eS{constructor(e){this.datasource=e}getTarget(e){if(Vw(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({variable:e,searchFilter:t},n){return Vw(this.datasource)?(0,Hp.from)(this.datasource.metricFindQuery(e.state.query,Jw(Xw({},n),{variable:{name:e.state.name,type:e.state.type},searchFilter:t}))).pipe((0,Hp.mergeMap)((e=>{if(!e||!e.length)return nS();const t=e;return(0,Hp.of)({series:t,state:r.LoadingState.Done,timeRange:n.range})}))):nS()}}class tS{constructor(e,t=(0,a.getRunRequest)()){this.datasource=e,this._runRequest=t}getTarget(e){if(zw(this.datasource))return e.state.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest(e,t){return zw(this.datasource)?this.datasource.variables.query?this._runRequest(this.datasource,t,this.datasource.variables.query.bind(this.datasource.variables)):this._runRequest(this.datasource,t):nS()}}function nS(){return(0,Hp.of)({state:r.LoadingState.Done,series:[],timeRange:(0,r.getDefaultTimeRange)()})}let rS=function(e){if(Uw(e))return new Zw(e,(0,a.getRunRequest)());if(Vw(e))return new eS(e);if(zw(e))return new tS(e);throw new Error(`Couldn't create a query runner for datasource ${e.type}`)};const iS=(e,t)=>{const n=[];let r=null;t.lastIndex=0;do{r=t.exec(e),r&&n.push(r)}while(t.global&&r&&""!==r[0]&&void 0!==r[0]);return n},aS=(e,t)=>{if(t===r.VariableSort.disabled)return e;const n=e=>{if(!e.text)return-1;const t=e.text.match(/.*?(\d+).*/);return!t||t.length<2?-1:parseInt(t[1],10)},i=e=>e.sort(((e,t)=>e.text?t.text?e.text.localeCompare(t.text,void 0,{numeric:!0}):1:-1));switch(t){case r.VariableSort.alphabeticalAsc:e=(0,Bc.sortBy)(e,"label");break;case r.VariableSort.alphabeticalDesc:e=(0,Bc.sortBy)(e,"label").reverse();break;case r.VariableSort.numericalAsc:e=(0,Bc.sortBy)(e,n);break;case r.VariableSort.numericalDesc:e=(e=(0,Bc.sortBy)(e,n)).reverse();break;case r.VariableSort.alphabeticalCaseInsensitiveAsc:e=(0,Bc.sortBy)(e,(e=>(0,Bc.toLower)(e.label)));break;case r.VariableSort.alphabeticalCaseInsensitiveDesc:e=(e=(0,Bc.sortBy)(e,(e=>(0,Bc.toLower)(e.label)))).reverse();break;case r.VariableSort.naturalAsc||7:e=i(e);break;case r.VariableSort.naturalDesc||8:e=(e=i(e)).reverse()}return e};function oS(){return e=>e.pipe((0,Hp.map)((e=>{const t=e.series;if(!t||!t.length)return[];if(function(e){if(!e)return!1;if(!e.length)return!0;const t=e[0];if((0,r.isDataFrame)(t))return!1;for(const e in t){if(!t.hasOwnProperty(e))continue;if(null!==t[e]&&"string"!=typeof t[e]&&"number"!=typeof t[e])continue;const n=e.toLowerCase();if("text"===n||"value"===n)return!0}return!1}(t))return t;if(0===t[0].fields.length)return[];const n=(0,r.getProcessedDataFrames)(t),i=[];let a=-1,o=-1,s=-1,l=-1;for(const e of n)for(let n=0;n<e.fields.length;n++){const i=e.fields[n],c=(0,r.getFieldDisplayName)(i,e,t).toLowerCase();i.type===r.FieldType.string&&-1===s&&(s=n),"text"===c&&i.type===r.FieldType.string&&-1===o&&(o=n),"value"===c&&i.type===r.FieldType.string&&-1===a&&(a=n),"expandable"!==c||i.type!==r.FieldType.boolean&&i.type!==r.FieldType.number||-1!==l||(l=n)}if(-1===s)throw new Error("Couldn't find any field of type string in the results.");for(const e of t)for(let t=0;t<e.length;t++){const n=-1!==l?e.fields[l].values.get(t):void 0,r=e.fields[s].values.get(t),c=-1!==o?e.fields[o].values.get(t):null,u=-1!==a?e.fields[a].values.get(t):null;-1!==a||-1!==o?-1!==a||-1===o?-1===a||-1!==o?i.push({text:c,value:u,expandable:n}):i.push({text:u,value:u,expandable:n}):i.push({text:c,value:c,expandable:n}):i.push({text:r,value:r,expandable:n})}return i})))}var sS=Object.defineProperty,lS=Object.getOwnPropertySymbols,cS=Object.prototype.hasOwnProperty,uS=Object.prototype.propertyIsEnumerable,dS=(e,t,n)=>t in e?sS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class pS extends Dm{constructor(e){super(((e,t)=>{for(var n in t||(t={}))cS.call(t,n)&&dS(e,n,t[n]);if(lS)for(var n of lS(t))uS.call(t,n)&&dS(e,n,t[n]);return e})({type:"query",name:"",value:"",text:"",options:[],datasource:null,regex:"",query:{refId:"A"},refresh:r.VariableRefresh.onDashboardLoad,sort:r.VariableSort.disabled},e)),this._variableDependency=new am(this,{statePaths:["regex","query","datasource"]}),this.onSearchChange=e=>{ey(this.state.query).indexOf(Rf)>-1&&this._updateOptionsBasedOnSearchFilter(e)},this._updateOptionsBasedOnSearchFilter=(0,Bc.debounce)((async e=>{const t=await(0,Hp.lastValueFrom)(this.getValueOptions({searchFilter:e}));this.setState({options:t,loading:!1})}),400)}getValueOptions(e){return this.state.query?(this.setState({loading:!0,error:null}),(0,Hp.from)(rm(this.state.datasource,{__sceneObject:{text:"__sceneObject",value:this}})).pipe((0,Hp.mergeMap)((t=>{const n=rS(t),i=n.getTarget(this),a=this.getRequest(i,e.searchFilter);return n.runRequest({variable:this,searchFilter:e.searchFilter},a).pipe(Pm({type:"variable",request:a,origin:this}),(0,Hp.filter)((e=>e.state===r.LoadingState.Done||e.state===r.LoadingState.Error)),(0,Hp.take)(1),(0,Hp.mergeMap)((e=>e.state===r.LoadingState.Error?(0,Hp.throwError)((()=>e.error)):(0,Hp.of)(e))),oS(),(0,Hp.mergeMap)((e=>{let t="";return this.state.regex&&(t=nm.interpolate(this,this.state.regex,void 0,"regex")),(0,Hp.of)(((e,t,n)=>{var i,a,o,s,l,c;let u,d=[];e&&(u=(0,r.stringToJsRegex)(e));for(let e=0;e<n.length;e++){const t=n[e];let r=void 0===t.text||null===t.text?t.value:t.text,p=void 0===t.value||null===t.value?t.text:t.value;if((0,Bc.isNumber)(p)&&(p=p.toString()),(0,Bc.isNumber)(r)&&(r=r.toString()),u){const e=iS(p,u);if(!e.length)continue;const t=e.find((e=>e.groups&&e.groups.value)),n=e.find((e=>e.groups&&e.groups.text)),h=e.find((e=>e.length>1)),f=e.length>1&&h;if(t||n)p=null!=(o=null==(i=null==t?void 0:t.groups)?void 0:i.value)?o:null==(a=null==n?void 0:n.groups)?void 0:a.text,r=null!=(c=null==(s=null==n?void 0:n.groups)?void 0:s.text)?c:null==(l=null==t?void 0:t.groups)?void 0:l.value;else{if(f){for(let t=0;t<e.length;t++){const n=e[t];d.push({label:n[1],value:n[1]})}continue}h&&(r=h[1],p=h[1])}}d.push({label:r,value:p})}return d=(0,Bc.uniqBy)(d,"value"),aS(d,t)})(t,this.state.sort,e))})),(0,Hp.catchError)((e=>e.cancelled?(0,Hp.of)([]):(0,Hp.throwError)((()=>e)))))})))):(0,Hp.of)([])}getRequest(e,t){const n={__sceneObject:{text:"__sceneObject",value:this}};t&&(n.__searchFilter={value:t,text:t});const i=nm.getTimeRange(this).state.value;return{app:r.CoreApp.Dashboard,requestId:Jp(),timezone:"",range:i,interval:"",intervalMs:0,targets:[e],scopedVars:n,startTime:Date.now()}}}function hS(e,t){const n=["A","B","C","D","E","F","G","H"],r=[];if(t>5)return[];for(const i of n){const n=`${e}${i}`;r.push({name:n,children:hS(n,t+1)})}return r}function fS(e,t,n){if(n>=t.length)return e;if("*"===t[n])return e;const r=t[n];let i=[],a=[r];r.startsWith("{")&&(a=r.replace(/\{|\}/g,"").split(","));for(const r of e)for(const e of a)if(-1!==e.indexOf("*")){const a=e.replace("*","");new RegExp(`^${a}.*`,"gi").test(r.name)&&(i=i.concat(fS([r],t,n+1)))}else r.name===e&&(i=i.concat(fS(r.children,t,n+1)));return i}function mS(e){if(0===e.indexOf("value"))return[{name:e,children:[]}];return fS(hS("",0),e.split("."),0)}pS.Component=({model:e})=>Xm(e);var gS=Object.defineProperty,yS=Object.getOwnPropertySymbols,bS=Object.prototype.hasOwnProperty,vS=Object.prototype.propertyIsEnumerable,wS=(e,t,n)=>t in e?gS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function SS({model:e}){const{value:t,key:n,loading:r}=e.useState(),i=(0,Fi.useCallback)((t=>{e.setValue(t.currentTarget.value)}),[e]),a=(0,Fi.useCallback)((t=>{"Enter"===t.key&&e.setValue(t.currentTarget.value)}),[e]);return $i().createElement(o.AutoSizeInput,{id:n,placeholder:"Enter value",minWidth:15,defaultValue:t,loading:r,onBlur:i,onKeyDown:a})}(class extends Dm{constructor(e,t=!1){super(((e,t)=>{for(var n in t||(t={}))bS.call(t,n)&&wS(e,n,t[n]);if(yS)for(var n of yS(t))vS.call(t,n)&&wS(e,n,t[n]);return e})({type:"custom",name:"Test",value:"Value",text:"Text",query:"Query",options:[],refresh:r.VariableRefresh.onDashboardLoad},e)),this.completeUpdate=new Hp.Subject,this.isGettingValues=!0,this.getValueOptionsCount=0,this.isLazy=!1,this._variableDependency=new am(this,{statePaths:["query"]}),this.isLazy=t}getValueOptions(e){const{delayMs:t}=this.state;this.getValueOptionsCount+=1;const n=nm.getQueryController(this);return new Hp.Observable((e=>{const r={type:"variable",origin:this,cancel:()=>e.complete()};if(n&&n.queryStarted(r),this.setState({loading:!0}),this.state.throwError)throw new Error(this.state.throwError);const i=nm.interpolate(this,this.state.query),a=this.getOptions(i),o=this.completeUpdate.subscribe({next:()=>{this.setState({issuedQuery:i,options:a,loading:!1}),e.next(a),e.complete()}});let s;return t?s=window.setTimeout((()=>this.signalUpdateCompleted()),t):0===t&&this.signalUpdateCompleted(),this.isGettingValues=!0,()=>{o.unsubscribe(),window.clearTimeout(s),this.isGettingValues=!1,this.state.loading&&this.setState({loading:!1}),n&&n.queryCompleted(r)}}))}cancel(){const e=Ph(this,(e=>e instanceof Ow?e:void 0));null==e||e.cancel(this)}getOptions(e){return this.state.optionsToReturn?this.state.optionsToReturn:mS(e).map((e=>({label:e.name,value:e.name})))}signalUpdateCompleted(){this.completeUpdate.next(1)}}).Component=({model:e})=>Xm(e);var ES=Object.defineProperty,xS=Object.getOwnPropertySymbols,OS=Object.prototype.hasOwnProperty,_S=Object.prototype.propertyIsEnumerable,TS=(e,t,n)=>t in e?ES(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;(class extends vh{constructor(e){super(((e,t)=>{for(var n in t||(t={}))OS.call(t,n)&&TS(e,n,t[n]);if(xS)for(var n of xS(t))_S.call(t,n)&&TS(e,n,t[n]);return e})({type:"textbox",value:"",name:""},e)),this._urlSync=new Jh(this,{keys:()=>[this.getKey()]})}getValue(){return this.state.value}setValue(e){e!==this.state.value&&(this.setState({value:e}),this.publishEvent(new hf(this),!0))}getKey(){return`var-${this.state.name}`}getUrlState(){return{[this.getKey()]:this.state.value}}updateFromUrl(e){const t={},n=e[this.getKey()];"string"==typeof n&&(t.value=n),this.setState(t)}}).Component=({model:e})=>$i().createElement(SS,{model:e});Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var CS=Object.defineProperty,kS=Object.getOwnPropertySymbols,PS=Object.prototype.hasOwnProperty,AS=Object.prototype.propertyIsEnumerable,RS=(e,t,n)=>t in e?CS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;(class extends vh{constructor(e){super(((e,t)=>{for(var n in t||(t={}))PS.call(t,n)&&RS(e,n,t[n]);if(kS)for(var n of kS(t))AS.call(t,n)&&RS(e,n,t[n]);return e})({type:"interval",value:"",intervals:["1m","10m","30m","1h","6h","12h","1d","7d","14d","30d"],name:"",autoStepCount:30,autoMinInterval:"10s",autoEnabled:!1,refresh:cy.onTimeRangeChanged},e)),this._onChange=e=>{this.setState({value:e.value}),this.publishEvent(new hf(this),!0)},this._urlSync=new Jh(this,{keys:()=>[this.getKey()]})}getKey(){return`var-${this.state.name}`}getUrlState(){return{[this.getKey()]:this.state.value}}updateFromUrl(e){const t={},n=e[this.getKey()];"string"==typeof n&&(n.startsWith("$__auto_interval_")?t.value=Pf:t.value=n),this.setState(t)}getOptionsForSelect(){const{value:e,intervals:t,autoEnabled:n}=this.state;let r=t.map((e=>({value:e,label:e})));return n&&(r=[{value:Pf,label:"Auto"},...r]),e&&!r.some((t=>t.value===e))&&r.push({value:e,label:e}),r}getValue(){const{value:e,autoStepCount:t,autoMinInterval:n}=this.state;return e===Pf?this.getAutoRefreshInteval(t,n):e}getAutoRefreshInteval(e,t){const n=nm.getTimeRange(this).state.value;return r.rangeUtil.calculateInterval(n,e,t).interval}validateAndUpdate(){const{value:e,intervals:t}=this.state;let n=!1;if(e===Pf)n=!0;else if(!e&&t.length>0){const e=t[0];this.setState({value:e}),n=!0}return n&&this.publishEvent(new hf(this),!0),(0,Hp.of)({})}}).Component=({model:e})=>{const{key:t,value:n}=e.useState();return $i().createElement(o.Select,{id:t,placeholder:"Select value",width:"auto",value:n,tabSelectsValue:!1,options:e.getOptionsForSelect(),onChange:e._onChange})};class DS{constructor(){this._urlKeyMapper=new Dh,this._stateSub=null,this._locationSub=null,this._ignoreNextLocationUpdate=!1,this._onLocationUpdate=e=>{if(this._ignoreNextLocationUpdate)return void(this._ignoreNextLocationUpdate=!1);if(this._lastPath!==e.pathname)return;const t=new URLSearchParams(e.search);this._urlKeyMapper.rebuildIndex(this._sceneRoot),Ih(this._sceneRoot,t,this._urlKeyMapper),this._lastPath=e.pathname},this._onStateChanged=({payload:e})=>{const t=e.changedObject;if(t.urlSync){const e=t.urlSync.getUrlState(),n=a.locationService.getSearch(),r={};this._urlKeyMapper.rebuildIndex(this._sceneRoot);for(const[i,a]of Object.entries(e)){const e=this._urlKeyMapper.getUniqueKey(i,t);Nh(n.getAll(e),a)||(r[e]=a)}Object.keys(r).length>0&&(this._ignoreNextLocationUpdate=!0,a.locationService.partial(r,!0))}}}initSync(e){this._locationSub||(im(),this._locationSub=a.locationService.getHistory().listen(this._onLocationUpdate)),this._stateSub&&(im(0,0,this._sceneRoot.state.key),this._stateSub.unsubscribe()),this._sceneRoot=e,this._lastPath=a.locationService.getLocation().pathname,this._stateSub=e.subscribeToEvent(lh,this._onStateChanged),this.syncFrom(this._sceneRoot)}cleanUp(e){this._sceneRoot===e&&(im(),this._locationSub&&(this._locationSub(),im(),this._locationSub=null),this._stateSub&&(this._stateSub.unsubscribe(),this._stateSub=null,im(0,0,(this._sceneRoot.state.key,e.state.key))))}syncFrom(e){const t=a.locationService.getSearch();this._urlKeyMapper.rebuildIndex(this._sceneRoot),Ih(e,t,this._urlKeyMapper)}getUrlState(e){return jh(e)}}let jS;function IS(){return jS||(jS=new DS),jS}class NS extends vh{constructor(e){super(e),this.addActivationHandler((()=>{const e=function(e){const t=window.__grafanaSceneContext;return im(),window.__grafanaSceneContext=e,()=>{window.__grafanaSceneContext===e&&(im(),window.__grafanaSceneContext=t)}}(this);return()=>{e(),IS().cleanUp(this)}}))}initUrlSync(){IS().initSync(this)}}NS.Component=function({model:e}){const{body:t,controls:n}=e.useState(),r=(0,o.useStyles2)(LS);return $i().createElement("div",{className:r.container},n&&$i().createElement("div",{className:r.controls},n.map((e=>$i().createElement(e.Component,{key:e.state.key,model:e})))),$i().createElement("div",{className:r.body},$i().createElement(t.Component,{model:t})))};const LS=e=>({container:(0,i.css)({flexGrow:1,display:"flex",gap:e.spacing(2),minHeight:"100%",flexDirection:"column"}),body:(0,i.css)({flexGrow:1,display:"flex",gap:e.spacing(1)}),controls:(0,i.css)({display:"flex",gap:e.spacing(2),alignItems:"flex-end",flexWrap:"wrap"})});class MS extends vh{addItem(e){this.setState({items:this.state.items?[...this.state.items,e]:[e]})}setItems(e){this.setState({items:e})}}MS.Component=function({model:e}){const{items:t=[]}=e.useState(),n=$i().useRef(null);(0,Fi.useEffect)((()=>{n.current&&n.current.focus()}),[]);const r=e=>e.map((e=>{switch(e.type){case"divider":return $i().createElement(o.Menu.Divider,{key:e.text});case"group":return $i().createElement(o.Menu.Group,{key:e.text,label:e.text},e.subMenu?r(e.subMenu):void 0);default:return $i().createElement(o.Menu.Item,{key:e.text,label:e.text,icon:e.iconClassName,childItems:e.subMenu?r(e.subMenu):void 0,url:e.href,onClick:e.onClick,shortcut:e.shortcut,testId:Mm.components.Panels.Panel.menuItems(e.text)})}}));return $i().createElement(o.Menu,{ref:n},r(t))};function FS(e){return e instanceof JE}(class extends vh{}).Component=function({model:e}){const{body:t}=e.useState(),n=e.parent;if(n&&(r=n,!(r instanceof VE))&&!FS(n))throw new Error("SceneGridItem must be a child of SceneGridLayout or SceneGridRow");var r;if(!t)return null;return $i().createElement(t.Component,{model:t})};var $S=__webpack_require__(2548),BS=__webpack_require__.n($S),VS=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),US=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zS=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},qS=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},HS=void 0;HS="undefined"!=typeof window?window:"undefined"!=typeof self?self:__webpack_require__.g;var GS=null,WS=null,QS=HS.clearTimeout,KS=HS.setTimeout,YS=HS.cancelAnimationFrame||HS.mozCancelAnimationFrame||HS.webkitCancelAnimationFrame,XS=HS.requestAnimationFrame||HS.mozRequestAnimationFrame||HS.webkitRequestAnimationFrame;function JS(e){var t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l="undefined"!=typeof document&&document.attachEvent;if(!l){o=function(e){var t=e.__resizeTriggers__,n=t.firstElementChild,r=t.lastElementChild,i=n.firstElementChild;r.scrollLeft=r.scrollWidth,r.scrollTop=r.scrollHeight,i.style.width=n.offsetWidth+1+"px",i.style.height=n.offsetHeight+1+"px",n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight},a=function(e){return e.offsetWidth!==e.__resizeLast__.width||e.offsetHeight!==e.__resizeLast__.height},s=function(e){if(!(e.target.className&&"function"==typeof e.target.className.indexOf&&e.target.className.indexOf("contract-trigger")<0&&e.target.className.indexOf("expand-trigger")<0)){var t=this;o(this),this.__resizeRAF__&&GS(this.__resizeRAF__),this.__resizeRAF__=WS((function(){a(t)&&(t.__resizeLast__.width=t.offsetWidth,t.__resizeLast__.height=t.offsetHeight,t.__resizeListeners__.forEach((function(n){n.call(t,e)})))}))}};var c=!1,u="";r="animationstart";var d="Webkit Moz O ms".split(" "),p="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),h=document.createElement("fakeelement");if(void 0!==h.style.animationName&&(c=!0),!1===c)for(var f=0;f<d.length;f++)if(void 0!==h.style[d[f]+"AnimationName"]){u="-"+d[f].toLowerCase()+"-",r=p[f],c=!0;break}t="@"+u+"keyframes "+(n="resizeanim")+" { from { opacity: 0; } to { opacity: 0; } } ",i=u+"animation: 1ms "+n+"; "}return{addResizeListener:function(a,c){if(l)a.attachEvent("onresize",c);else{if(!a.__resizeTriggers__){var u=a.ownerDocument,d=HS.getComputedStyle(a);d&&"static"===d.position&&(a.style.position="relative"),function(n){if(!n.getElementById("detectElementResize")){var r=(t||"")+".resize-triggers { "+(i||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',a=n.head||n.getElementsByTagName("head")[0],o=n.createElement("style");o.id="detectElementResize",o.type="text/css",null!=e&&o.setAttribute("nonce",e),o.styleSheet?o.styleSheet.cssText=r:o.appendChild(n.createTextNode(r)),a.appendChild(o)}}(u),a.__resizeLast__={},a.__resizeListeners__=[],(a.__resizeTriggers__=u.createElement("div")).className="resize-triggers";var p=u.createElement("div");p.className="expand-trigger",p.appendChild(u.createElement("div"));var h=u.createElement("div");h.className="contract-trigger",a.__resizeTriggers__.appendChild(p),a.__resizeTriggers__.appendChild(h),a.appendChild(a.__resizeTriggers__),o(a),a.addEventListener("scroll",s,!0),r&&(a.__resizeTriggers__.__animationListener__=function(e){e.animationName===n&&o(a)},a.__resizeTriggers__.addEventListener(r,a.__resizeTriggers__.__animationListener__))}a.__resizeListeners__.push(c)}},removeResizeListener:function(e,t){if(l)e.detachEvent("onresize",t);else if(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t),1),!e.__resizeListeners__.length){e.removeEventListener("scroll",s,!0),e.__resizeTriggers__.__animationListener__&&(e.__resizeTriggers__.removeEventListener(r,e.__resizeTriggers__.__animationListener__),e.__resizeTriggers__.__animationListener__=null);try{e.__resizeTriggers__=!e.removeChild(e.__resizeTriggers__)}catch(e){}}}}}null==YS||null==XS?(GS=QS,WS=function(e){return KS(e,20)}):(GS=function(e){var t=qS(e,2),n=t[0],r=t[1];YS(n),QS(r)},WS=function(e){var t=XS((function(){QS(n),e()})),n=KS((function(){YS(t),e()}),20);return[t,n]});var ZS=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,a=Array(i),o=0;o<i;o++)a[o]=arguments[o];return n=r=zS(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.state={height:r.props.defaultHeight||0,width:r.props.defaultWidth||0},r._onResize=function(){var e=r.props,t=e.disableHeight,n=e.disableWidth,i=e.onResize;if(r._parentNode){var a=r._parentNode.offsetHeight||0,o=r._parentNode.offsetWidth||0,s=window.getComputedStyle(r._parentNode)||{},l=parseInt(s.paddingLeft,10)||0,c=parseInt(s.paddingRight,10)||0,u=parseInt(s.paddingTop,10)||0,d=parseInt(s.paddingBottom,10)||0,p=a-u-d,h=o-l-c;(!t&&r.state.height!==p||!n&&r.state.width!==h)&&(r.setState({height:a-u-d,width:o-l-c}),i({height:a,width:o}))}},r._setRef=function(e){r._autoSizer=e},zS(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),VS(t,[{key:"componentDidMount",value:function(){var e=this.props.nonce;this._autoSizer&&this._autoSizer.parentNode&&this._autoSizer.parentNode.ownerDocument&&this._autoSizer.parentNode.ownerDocument.defaultView&&this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement&&(this._parentNode=this._autoSizer.parentNode,this._detectElementResize=JS(e),this._detectElementResize.addResizeListener(this._parentNode,this._onResize),this._onResize())}},{key:"componentWillUnmount",value:function(){this._detectElementResize&&this._parentNode&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize)}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.className,r=e.disableHeight,i=e.disableWidth,a=e.style,o=this.state,s=o.height,l=o.width,c={overflow:"visible"},u={},d=!1;return r||(0===s&&(d=!0),c.height=0,u.height=s),i||(0===l&&(d=!0),c.width=0,u.width=l),(0,Fi.createElement)("div",{className:n,ref:this._setRef,style:US({},c,a)},!d&&t(u))}}]),t}(Fi.PureComponent);ZS.defaultProps={onResize:function(){},disableHeight:!1,disableWidth:!1,style:{}};const eE=ZS;const tE=function(e){(0,Fi.useEffect)(e,[])};var nE=Object.defineProperty,rE=Object.getOwnPropertySymbols,iE=Object.prototype.hasOwnProperty,aE=Object.prototype.propertyIsEnumerable,oE=(e,t,n)=>t in e?nE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function sE(){const e=(0,Fi.useRef)(void 0);return null!=e.current||(e.current=(0,Bc.uniqueId)()),e.current}const lE=$i().forwardRef(((e,t)=>{var n=e,{children:r,onLoad:i,onChange:a}=n,o=((e,t)=>{var n={};for(var r in e)iE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&rE)for(var r of rE(e))t.indexOf(r)<0&&aE.call(e,r)&&(n[r]=e[r]);return n})(n,["children","onLoad","onChange"]);const s=sE(),[l,c]=(0,Fi.useState)(!1),[u,d]=(0,Fi.useState)(!1),p=(0,Fi.useRef)(null);return(0,Fi.useImperativeHandle)(t,(()=>p.current)),tE((()=>{lE.addCallback(s,(e=>{!l&&e.isIntersecting&&(c(!0),null==i||i()),d(e.isIntersecting),null==a||a(e.isIntersecting)}));const e=p.current;return e&&lE.observer.observe(e),()=>{delete lE.callbacks[s],e&&lE.observer.unobserve(e),0===Object.keys(lE.callbacks).length&&lE.observer.disconnect()}})),$i().createElement("div",((e,t)=>{for(var n in t||(t={}))iE.call(t,n)&&oE(e,n,t[n]);if(rE)for(var n of rE(t))aE.call(t,n)&&oE(e,n,t[n]);return e})({id:s,ref:p},o),l&&("function"==typeof r?r({isInView:u}):r))}));lE.displayName="LazyLoader",lE.callbacks={},lE.addCallback=(e,t)=>lE.callbacks[e]=t,lE.observer=new IntersectionObserver((e=>{for(const t of e)lE.callbacks[t.target.id](t)}),{rootMargin:"100px"});var cE=Object.defineProperty,uE=Object.defineProperties,dE=Object.getOwnPropertyDescriptors,pE=Object.getOwnPropertySymbols,hE=Object.prototype.hasOwnProperty,fE=Object.prototype.propertyIsEnumerable,mE=(e,t,n)=>t in e?cE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gE=(e,t)=>{for(var n in t||(t={}))hE.call(t,n)&&mE(e,n,t[n]);if(pE)for(var n of pE(t))fE.call(t,n)&&mE(e,n,t[n]);return e},yE=(e,t)=>uE(e,dE(t)),bE=(e,t)=>{var n={};for(var r in e)hE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&pE)for(var r of pE(e))t.indexOf(r)<0&&fE.call(e,r)&&(n[r]=e[r]);return n};const vE=$i().forwardRef(((e,t)=>{var n;const r=e,{grid:a,layoutItem:o,index:s,totalCount:l,isLazy:c,style:u,onLoad:d,onChange:p,children:h}=r,f=bE(r,["grid","layoutItem","index","totalCount","isLazy","style","onLoad","onChange","children"]),m=a.getSceneLayoutChild(o.i),g=null==(n=m.getClassName)?void 0:n.call(m),y=$i().createElement(m.Component,{model:m,key:m.state.key});return c?$i().createElement(lE,yE(gE({},f),{key:m.state.key,"data-griditem-key":m.state.key,className:(0,i.cx)(g,e.className),style:u,ref:t}),y,h):$i().createElement("div",yE(gE({},f),{ref:t,key:m.state.key,"data-griditem-key":m.state.key,className:(0,i.cx)(g,e.className),style:u}),y,h)}));function wE(e,t,n){e.current?t?e.current.classList.add("react-grid-layout--enable-move-animations"):e.current.classList.remove("react-grid-layout--enable-move-animations"):n||setTimeout((()=>wE(e,t,!0)),50)}vE.displayName="GridItemWrapper";const SE=$i().forwardRef(((e,t)=>{var n=bE(e,["handleAxis"]);const r=(0,o.useStyles2)(EE);return $i().createElement("div",yE(gE({ref:t},n),{className:`${r} scene-resize-handle`}),$i().createElement("svg",{width:"16px",height:"16px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$i().createElement("path",{d:"M21 15L15 21M21 8L8 21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})))}));function EE(e){return(0,i.css)({position:"absolute",bottom:0,right:0,zIndex:999,padding:e.spacing(1.5,0,0,1.5),color:e.colors.border.strong,cursor:"se-resize","&:hover":{color:e.colors.text.link},svg:{display:"block"},".react-resizable-hide &":{display:"none"}})}SE.displayName="ResizeHandle";var xE=Object.defineProperty,OE=Object.defineProperties,_E=Object.getOwnPropertyDescriptors,TE=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,PE=(e,t,n)=>t in e?xE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function AE(e,t){const n=t-32,r=Math.max(...e.map((e=>e.h+e.y)))/Math.floor(n/38);return e.map((e=>((e,t)=>OE(e,_E(t)))(((e,t)=>{for(var n in t||(t={}))CE.call(t,n)&&PE(e,n,t[n]);if(TE)for(var n of TE(t))kE.call(t,n)&&PE(e,n,t[n]);return e})({},e),{y:Math.round(e.y/r)||0,h:Math.round(e.h/r)||1})))}var RE=Object.defineProperty,DE=Object.defineProperties,jE=Object.getOwnPropertyDescriptors,IE=Object.getOwnPropertySymbols,NE=Object.prototype.hasOwnProperty,LE=Object.prototype.propertyIsEnumerable,ME=(e,t,n)=>t in e?RE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FE=(e,t)=>{for(var n in t||(t={}))NE.call(t,n)&&ME(e,n,t[n]);if(IE)for(var n of IE(t))LE.call(t,n)&&ME(e,n,t[n]);return e},$E=(e,t)=>DE(e,jE(t));const BE=class extends vh{constructor(e){super($E(FE({},e),{children:zE(e.children)})),this._skipOnLayoutChange=!1,this._oldLayout=[],this._loadOldLayout=!1,this.onLayoutChange=e=>{if(this._skipOnLayoutChange)this._skipOnLayoutChange=!1;else{this._loadOldLayout&&(e=[...this._oldLayout],this._loadOldLayout=!1);for(const t of e){const e=this.getSceneLayoutChild(t.i),n={x:t.x,y:t.y,width:t.w,height:t.h};UE(e.state,n)||e.setState(FE({},n))}this.setState({children:zE(this.state.children)})}},this.onResizeStop=(e,t,n)=>{this.getSceneLayoutChild(n.i).setState({width:n.w,height:n.h})},this.onDragStart=e=>{this._oldLayout=[...e]},this.onDragStop=(e,t,n)=>{const r=this.getSceneLayoutChild(n.i);e=qE(e);for(let t=0;t<e.length;t++){const n=e[t],r=this.getSceneLayoutChild(n.i),i=r.state;(null==i?void 0:i.x)===n.x&&(null==i?void 0:i.y)===n.y||r.setState({x:n.x,y:n.y})}const i=e.findIndex((e=>e.i===n.i));let a=this.findGridItemSceneParent(e,i-1),o=this.state.children;r instanceof JE&&a instanceof JE&&(this.isRowDropValid(e,n,i)||(this._loadOldLayout=!0),a=this),a!==r.parent&&(o=this.moveChildTo(r,a)),this.setState({children:zE(o)}),this._skipOnLayoutChange=!0}}isDraggable(){var e;return null!=(e=this.state.isDraggable)&&e}getDragClass(){return`grid-drag-handle-${this.state.key}`}getDragClassCancel(){return"grid-drag-cancel"}toggleRow(e){var t,n;if(!e.state.isCollapsed)return e.setState({isCollapsed:!0}),void this.setState({});const r=e.state.children;if(0===r.length)return e.setState({isCollapsed:!1}),void this.setState({});const i=e.state.y,a=(null!=(t=r[0].state.y)?t:i)-(i+1);let o=i;for(const e of r){const t=FE({},e.state);t.y=null!=(n=t.y)?n:i,t.y-=a,t.y!==e.state.y&&e.setState(t),o=Math.max(o,Number(t.y)+Number(t.height))}const s=o-i-1;for(const t of this.state.children)if(t.state.y>i&&this.pushChildDown(t,s),FS(t)&&t!==e)for(const e of t.state.children)e.state.y>i&&this.pushChildDown(e,s);e.setState({isCollapsed:!1}),this.setState({})}getSceneLayoutChild(e){for(const t of this.state.children){if(t.state.key===e)return t;if(t instanceof JE)for(const n of t.state.children)if(n.state.key===e)return n}throw new Error("Scene layout child not found for GridItem")}pushChildDown(e,t){e.setState({y:e.state.y+t})}findGridItemSceneParent(e,t){for(let n=t;n>=0;n--){const t=e[n],r=this.getSceneLayoutChild(t.i);if(r instanceof JE)return r.state.isCollapsed?this:r}return this}isRowDropValid(e,t,n){if(e[e.length-1].i===t.i)return!0;const r=this.getSceneLayoutChild(e[n+1].i);return r instanceof JE||r.parent instanceof BE}moveChildTo(e,t){const n=e.parent;let r=this.state.children;const i=e.clone({key:e.state.key});if(n instanceof JE){const a=n.clone();if(a.setState({children:a.state.children.filter((t=>t.state.key!==e.state.key))}),r=r.map((e=>e===n?a:e)),t instanceof JE){const e=t.clone();e.setState({children:[...e.state.children,i]}),r=r.map((n=>n===t?e:n))}else r=[...r,i]}else if(!(t instanceof BE)){r=r.filter((t=>t.state.key!==e.state.key));const n=t.clone();n.setState({children:[...n.state.children,i]}),r=r.map((e=>e===t?n:e))}return r}toGridCell(e){var t,n;const r=e.state;let i=null!=(t=r.x)?t:0,a=null!=(n=r.y)?n:0;const o=Number.isInteger(Number(r.width))?Number(r.width):4,s=Number.isInteger(Number(r.height))?Number(r.height):4;let l=e.state.isDraggable,c=e.state.isResizable;return e instanceof JE&&(l=!!e.state.isCollapsed,c=!1),{i:e.state.key,x:i,y:a,h:s,w:o,isResizable:c,isDraggable:l}}buildGridLayout(e,t){let n=[];for(const e of this.state.children)if(n.push(this.toGridCell(e)),e instanceof JE&&!e.state.isCollapsed)for(const t of e.state.children)n.push(this.toGridCell(t));return n=qE(n),this.state.UNSAFE_fitPanels&&(n=AE(n,t)),e<768?(this._skipOnLayoutChange=!0,n.map((e=>$E(FE({},e),{w:24})))):(this._skipOnLayoutChange=!1,n)}};let VE=BE;function UE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zE(e){return e.forEach((e=>{e instanceof JE&&e.setState({children:zE(e.state.children)})})),[...e].sort(((e,t)=>e.state.y-t.state.y||e.state.x-t.state.x))}function qE(e){return[...e].sort(((e,t)=>e.y-t.y||e.x-t.x))}VE.Component=function({model:e}){const{children:t,isLazy:n,isDraggable:r,isResizable:i}=e.useState(),a=(0,Fi.useRef)(null);return(0,Fi.useEffect)((()=>{wE(a,!!r)}),[r]),function(e){if(e.some((e=>void 0===e.state.height||void 0===e.state.width||void 0===e.state.x||void 0===e.state.y)))throw new Error("All children must have a size specified")}(t),$i().createElement(eE,null,(({width:t,height:o})=>{if(0===t)return null;const s=e.buildGridLayout(t,o);return $i().createElement("div",{ref:a,style:{width:`${t}px`,height:"100%",position:"relative",zIndex:1},className:"react-grid-layout"},$i().createElement(BS(),{width:t,isDraggable:r&&t>768,isResizable:null!=i&&i,containerPadding:[0,0],useCSSTransforms:!0,margin:[8,8],cols:24,rowHeight:30,draggableHandle:`.grid-drag-handle-${e.state.key}`,draggableCancel:".grid-drag-cancel",layout:s,onDragStart:e.onDragStart,onDragStop:e.onDragStop,onResizeStop:e.onResizeStop,onLayoutChange:e.onLayoutChange,isBounded:!1,resizeHandle:$i().createElement(SE,null)},s.map(((t,r)=>$i().createElement(vE,{key:t.i,grid:e,layoutItem:t,index:r,isLazy:n,totalCount:s.length})))))}))};var HE=Object.defineProperty,GE=Object.defineProperties,WE=Object.getOwnPropertyDescriptors,QE=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,XE=(e,t,n)=>t in e?HE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class JE extends vh{constructor(e){super(((e,t)=>GE(e,WE(t)))(((e,t)=>{for(var n in t||(t={}))KE.call(t,n)&&XE(e,n,t[n]);if(QE)for(var n of QE(t))YE.call(t,n)&&XE(e,n,t[n]);return e})({children:e.children||[],isCollapsible:e.isCollapsible||!0,title:e.title||""},e),{x:0,height:1,width:24})),this.onCollapseToggle=()=>{this.state.isCollapsible&&this.getGridLayout().toggleRow(this)}}getGridLayout(){const e=this.parent;if(!(e&&e instanceof VE))throw new Error("SceneGridRow must be a child of SceneGridLayout");return e}getUrlState(){return{rowc:this.state.isCollapsed?"1":"0"}}updateFromUrl(e){null!=e.rowc&&e.rowc!==this.getUrlState().rowc&&this.onCollapseToggle()}}JE.Component=function({model:e}){const t=(0,o.useStyles2)(ZE),{isCollapsible:n,isCollapsed:r,title:a,actions:s,children:l}=e.useState(),c=e.getGridLayout(),u=c.getDragClass(),d=c.isDraggable(),p=l?l.length:0,h=1===p?"panel":"panels";return $i().createElement("div",{className:(0,i.cx)(t.row,r&&t.rowCollapsed)},$i().createElement("div",{className:t.rowTitleAndActionsGroup},$i().createElement("button",{onClick:e.onCollapseToggle,className:t.rowTitleButton,"aria-label":r?"Expand row":"Collapse row","data-testid":Mm.components.DashboardRow.title(nm.interpolate(e,a,void 0,"text"))},n&&$i().createElement(o.Icon,{name:r?"angle-right":"angle-down"}),$i().createElement("span",{className:t.rowTitle,role:"heading"},nm.interpolate(e,a,void 0,"text"))),$i().createElement("span",{className:(0,i.cx)(t.panelCount,r&&t.panelCountCollapsed)},"(",p," ",h,")"),s&&$i().createElement("div",{className:t.rowActions},$i().createElement(s.Component,{model:s}))),d&&r&&$i().createElement("div",{className:(0,i.cx)(t.dragHandle,u)},$i().createElement(o.Icon,{name:"draggabledots"})))};const ZE=e=>({row:(0,i.css)({width:"100%",height:"30px",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowTitleButton:(0,i.css)({display:"flex",alignItems:"center",cursor:"pointer",background:"transparent",border:"none",gap:e.spacing(1)}),rowCollapsed:(0,i.css)({borderBottom:`1px solid ${e.colors.border.weak}`}),rowTitle:(0,i.css)({fontSize:e.typography.h5.fontSize,fontWeight:e.typography.fontWeightMedium}),collapsedInfo:(0,i.css)({fontSize:e.typography.bodySmall.fontSize,color:e.colors.text.secondary,display:"flex",alignItems:"center",flexGrow:1}),rowTitleAndActionsGroup:(0,i.css)({display:"flex","&:hover, &:focus-within":{"& > div":{opacity:1}}}),rowActions:(0,i.css)({display:"flex",opacity:0,transition:"200ms opacity ease-in 200ms","&:hover, &:focus-within":{opacity:1}}),dragHandle:(0,i.css)({display:"flex",padding:e.spacing(0,1),alignItems:"center",justifyContent:"flex-end",cursor:"move",color:e.colors.text.secondary,"&:hover":{color:e.colors.text.primary}}),panelCount:(0,i.css)({paddingLeft:e.spacing(2),color:e.colors.text.secondary,fontStyle:"italic",fontSize:e.typography.size.sm,fontWeight:"normal",display:"none",lineHeight:"30px"}),panelCountCollapsed:(0,i.css)({display:"inline-block"})});(class extends vh{constructor(){super(...arguments),this.onToggle=()=>{this.setState({isCollapsed:!this.state.isCollapsed})},this.onRemove=()=>{const e=this.parent;(function(e){return"body"in e.state})(e)&&e.setState({body:void 0})}}}).Component=function({model:e}){const{title:t,isCollapsed:n,canCollapse:r,canRemove:a,body:s,controls:l}=e.useState(),c=(0,o.useStyles2)(ZE),u=(0,o.useStyles2)(ex),d=(null!=l?l:[]).map((e=>$i().createElement(e.Component,{key:e.state.key,model:e})));a&&d.push($i().createElement(o.ToolbarButton,{icon:"times",variant:"default",onClick:e.onRemove,key:"remove-button","aria-label":"Remove scene"}));return $i().createElement("div",{className:u.wrapper},$i().createElement("div",{className:(0,i.cx)(u.row,n&&u.rowCollapsed)},$i().createElement("button",{onClick:e.onToggle,className:c.rowTitleButton,"aria-label":n?"Expand scene":"Collapse scene"},r&&$i().createElement(o.Icon,{name:n?"angle-right":"angle-down"}),$i().createElement("span",{className:c.rowTitle,role:"heading"},nm.interpolate(e,t,void 0,"text"))),$i().createElement("div",{className:u.actions},d)),!n&&$i().createElement(s.Component,{model:s}))};const ex=e=>({wrapper:(0,i.css)({display:"flex",flexDirection:"column",flexGrow:1,gap:e.spacing(1)}),row:(0,i.css)({width:"100%",display:"flex",justifyContent:"space-between",gap:e.spacing(1)}),rowCollapsed:(0,i.css)({borderBottom:`1px solid ${e.colors.border.weak}`,paddingBottom:e.spacing(1)}),actions:(0,i.css)({display:"flex",alignItems:"center",gap:e.spacing(1),justifyContent:"flex-end",flexGrow:1})});(class extends vh{constructor(){super(...arguments),this._variableDependency=new am(this,{statePaths:["text"]})}}).Component=({model:e})=>{const{text:t,fontSize:n=20,align:r="left",key:a,spacing:s}=e.useState(),l=(0,o.useTheme2)(),c=(0,i.css)({fontSize:n,display:"flex",flexGrow:1,alignItems:"center",padding:s?l.spacing(s,0):void 0,justifyContent:r});return $i().createElement("div",{className:c,"data-testid":a},nm.interpolate(e,t))};(class extends vh{}).Component=({model:e})=>{const t=e.useState();return $i().createElement(o.ToolbarButton,{onClick:t.onClick,icon:t.icon})};(class extends vh{}).Component=({model:e})=>{const t=e.useState();return $i().createElement("div",{style:{display:"flex"}},t.label&&$i().createElement(pg,{label:t.label}),$i().createElement(o.Input,{defaultValue:t.value,width:8,onBlur:t=>{e.state.onChange(parseInt(t.currentTarget.value,10))}}))};class tx extends vh{constructor(){super(...arguments),this.onZoom=()=>{const e=nm.getTimeRange(this),t=function(e,t){const n=e.to.valueOf()-e.from.valueOf(),i=e.to.valueOf()-n/2,a=0===n?3e4:n*t,o=i+a/2,s=i-a/2;return{from:(0,r.toUtc)(s),to:(0,r.toUtc)(o),raw:{from:(0,r.toUtc)(s),to:(0,r.toUtc)(o)}}}(e.state.value,2);e.onTimeRangeChange(t)},this.onChangeFiscalYearStartMonth=e=>{nm.getTimeRange(this).setState({fiscalYearStartMonth:e})},this.onMoveBackward=()=>{const e=nm.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(rx(nx.Backward,t,Date.now()))},this.onMoveForward=()=>{const e=nm.getTimeRange(this),{state:{value:t}}=e;e.onTimeRangeChange(rx(nx.Forward,t,Date.now()))}}}tx.Component=function({model:e}){const{hidePicker:t,isOnCanvas:n}=e.useState(),r=nm.getTimeRange(e),i=r.getTimeZone(),a=r.useState();if(t)return null;return $i().createElement(o.TimeRangePicker,{isOnCanvas:null==n||n,value:a.value,onChange:r.onTimeRangeChange,timeZone:i,fiscalYearStartMonth:a.fiscalYearStartMonth,onMoveBackward:e.onMoveBackward,onMoveForward:e.onMoveForward,onZoom:e.onZoom,onChangeTimeZone:r.onTimeZoneChange,onChangeFiscalYearStartMonth:e.onChangeFiscalYearStartMonth})};var nx=(e=>(e[e.Backward=0]="Backward",e[e.Forward=1]="Forward",e))(nx||{});function rx(e,t,n){const i=t.to.valueOf(),a=t.from.valueOf(),o=(i-a)/2;let s,l;0===e?(s=a-o,l=i-o):(s=a+o,l=i+o,l>n&&i<n&&(l=n,s=a));const c=(0,r.toUtc)(s),u=(0,r.toUtc)(l);return{from:c,to:u,raw:{from:c,to:u}}}var ix=Object.defineProperty,ax=Object.defineProperties,ox=Object.getOwnPropertyDescriptors,sx=Object.getOwnPropertySymbols,lx=Object.prototype.hasOwnProperty,cx=Object.prototype.propertyIsEnumerable,ux=(e,t,n)=>t in e?ix(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const dx=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"];class px extends vh{constructor(e){var t,n,i;super(((e,t)=>ax(e,ox(t)))(((e,t)=>{for(var n in t||(t={}))lx.call(t,n)&&ux(e,n,t[n]);if(sx)for(var n of sx(t))cx.call(t,n)&&ux(e,n,t[n]);return e})({refresh:""},e),{autoValue:void 0,autoEnabled:null==(t=e.autoEnabled)||t,autoMinInterval:null!=(n=e.autoMinInterval)?n:a.config.minRefreshInterval,intervals:null!=(i=e.intervals)?i:dx})),this._urlSync=new Jh(this,{keys:["refresh"]}),this.onRefresh=()=>{const e=nm.getQueryController(this);if(null==e?void 0:e.state.isRunning)return void e.cancelAll();const t=nm.getTimeRange(this);this._intervalTimer&&clearInterval(this._intervalTimer),t.onRefresh(),this.setupIntervalTimer()},this.onIntervalChanged=e=>{this.setState({refresh:e}),this.setupIntervalTimer()},this.setupAutoTimeRangeListener=()=>nm.getTimeRange(this).subscribeToState(((e,t)=>{e.from===t.from&&e.to===t.to||this.setupIntervalTimer()})),this.calculateAutoRefreshInterval=()=>{var e;const t=nm.getTimeRange(this),n=null!=(e=null==window?void 0:window.innerWidth)?e:2e3;return r.rangeUtil.calculateInterval(t.state.value,n,this.state.autoMinInterval)},this.setupIntervalTimer=()=>{var e;const t=nm.getTimeRange(this),{refresh:n,intervals:i}=this.state;if((this._intervalTimer||""===n)&&clearInterval(this._intervalTimer),""===n)return;if(n!==o.RefreshPicker.autoOption.value&&i&&!i.includes(n))return;let a;if(null==(e=this._autoTimeRangeListener)||e.unsubscribe(),n===o.RefreshPicker.autoOption.value){const e=this.calculateAutoRefreshInterval();a=e.intervalMs,this._autoTimeRangeListener=this.setupAutoTimeRangeListener(),e.interval!==this.state.autoValue&&this.setState({autoValue:e.interval})}else a=r.rangeUtil.intervalToMs(n);this._intervalTimer=setInterval((()=>{t.onRefresh()}),a)},this.addActivationHandler((()=>(this.setupIntervalTimer(),()=>{var e;this._intervalTimer&&clearInterval(this._intervalTimer),null==(e=this._autoTimeRangeListener)||e.unsubscribe()})))}getUrlState(){return{refresh:""!==this.state.refresh?this.state.refresh:void 0}}updateFromUrl(e){const t=e.refresh;"string"==typeof t?this.setState({refresh:t}):null==t&&this.setState({refresh:""})}}px.Component=function({model:e}){var t;const{refresh:n,intervals:r,autoEnabled:i,autoValue:a,isOnCanvas:s,primary:l,withText:c}=e.useState(),u=function(e){const t=nm.getQueryController(e);if(!t)return!1;return t.useState().isRunning}(e);let d,p,h=n===(null==(t=o.RefreshPicker.autoOption)?void 0:t.value)?a:c?"Refresh":void 0;u&&(d="Cancel all queries",c&&(h="Cancel"));c&&(p="96px");return $i().createElement(o.RefreshPicker,{showAutoInterval:i,value:n,intervals:r,tooltip:d,width:p,text:h,onRefresh:e.onRefresh,primary:l,onIntervalChanged:e.onIntervalChanged,isLoading:u,isOnCanvas:null==s||s})};const hx=e=>`${e}-compare`;var fx=Object.defineProperty,mx=Object.defineProperties,gx=Object.getOwnPropertyDescriptors,yx=Object.getOwnPropertySymbols,bx=Object.prototype.hasOwnProperty,vx=Object.prototype.propertyIsEnumerable,wx=(e,t,n)=>t in e?fx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sx=(e,t)=>{for(var n in t||(t={}))bx.call(t,n)&&wx(e,n,t[n]);if(yx)for(var n of yx(t))vx.call(t,n)&&wx(e,n,t[n]);return e},Ex=(e,t)=>mx(e,gx(t));const xx="__previousPeriod",Ox="__noPeriod",_x={label:"Previous period",value:xx},Tx={label:"No comparison",value:Ox},Cx=[{label:"Day before",value:"24h"},{label:"Week before",value:"1w"},{label:"Month before",value:"1M"}];(class extends vh{constructor(e){super(Sx({compareOptions:Cx},e)),this._urlSync=new Jh(this,{keys:["compareWith"]}),this._onActivate=()=>{const e=nm.getTimeRange(this);this.setState({compareOptions:this.getCompareOptions(e.state.value)}),this._subs.add(e.subscribeToState((e=>{const t=this.getCompareOptions(e.value),n={compareOptions:t};Boolean(this.state.compareWith)&&!t.find((({value:e})=>e===this.state.compareWith))&&(n.compareWith=xx),this.setState(n)})))},this.getCompareOptions=e=>{const t=Math.ceil(e.to.diff(e.from)),n=Cx.findIndex((({value:e})=>r.rangeUtil.intervalToMs(e)>=t));return[Tx,_x,...Cx.slice(n).map((({label:e,value:t})=>({label:e,value:t})))]},this.onCompareWithChanged=e=>{e===Ox?this.onClearCompare():this.setState({compareWith:e})},this.onClearCompare=()=>{this.setState({compareWith:void 0})},this.addActivationHandler(this._onActivate)}getExtraQueries(e){const t=[],n=this.getCompareTimeRange(e.range);if(!n)return t;const r=e.targets.filter((e=>!1!==e.timeRangeCompare));return r.length&&t.push({req:Ex(Sx({},e),{targets:r,range:n}),processor:kx}),t}shouldRerun(e,t){return e.compareWith!==t.compareWith}getCompareTimeRange(e){let t,n;if(this.state.compareWith){if(this.state.compareWith===xx){const i=e.to.diff(e.from);t=(0,r.dateTime)(e.from).subtract(i),n=(0,r.dateTime)(e.to).subtract(i)}else t=(0,r.dateTime)(e.from).subtract(r.rangeUtil.intervalToMs(this.state.compareWith)),n=(0,r.dateTime)(e.to).subtract(r.rangeUtil.intervalToMs(this.state.compareWith));return{from:t,to:n,raw:{from:t,to:n}}}}getUrlState(){return{compareWith:this.state.compareWith}}updateFromUrl(e){if(!e.compareWith)return;const t=ef(e.compareWith);if(t){this.getCompareOptions(nm.getTimeRange(this).state.value).find((({value:e})=>e===t))?this.setState({compareWith:t}):this.setState({compareWith:"__previousPeriod"})}}}).Component=function({model:e}){var t;const n=(0,o.useStyles2)(Px),{compareWith:r,compareOptions:i}=e.useState(),[a,s]=$i().useState(r),l=null!=(t=i.find((({value:e})=>e===a)))?t:_x,c=i.find((({value:e})=>e===r)),u=Boolean(c),d=()=>{u?(s(r),e.onClearCompare()):u||e.onCompareWithChanged(l.value)};return $i().createElement(o.ButtonGroup,null,$i().createElement(o.ToolbarButton,{variant:"canvas",tooltip:"Enable time frame comparison",onClick:e=>{e.stopPropagation(),e.preventDefault(),d()}},$i().createElement(o.Checkbox,{label:" ",value:u,onClick:d}),"Comparison"),u?$i().createElement(o.ButtonSelect,{variant:"canvas",value:c,options:i,onChange:t=>{e.onCompareWithChanged(t.value)}}):$i().createElement(o.ToolbarButton,{className:n.previewButton,disabled:!0,variant:"canvas",isOpen:!1},l.label))};const kx=(e,t)=>{const n=t.timeRange.from.diff(e.timeRange.from);return t.series.forEach((e=>{e.refId=hx(e.refId||""),e.meta=Ex(Sx({},e.meta),{timeCompare:{diffMs:n,isTimeShiftQuery:!0}}),e.fields.forEach((e=>(e.type===r.FieldType.time&&(e.values=e.values.map((e=>n<0?e-n:e+n))),e.config=Ex(Sx({},e.config),{color:{mode:"fixed",fixedColor:a.config.theme.palette.gray60}}),e)))})),(0,Hp.of)(t)};function Px(e){return{previewButton:(0,i.css)({"&:disabled":{border:`1px solid ${e.colors.secondary.border}`,color:e.colors.text.disabled,opacity:1}})}}(class extends vh{constructor(e){super(e),this.addActivationHandler((()=>{const e=nm.getData(this);this._subs.add(e.subscribeToState((e=>{var t;(null==(t=e.data)?void 0:t.state)===r.LoadingState.Done&&this.performRepeat(e.data)}))),e.state.data&&this.performRepeat(e.state.data)}))}performRepeat(e){const t=[];for(let n=0;n<e.series.length;n++){const r=this.state.getLayoutChild(e,e.series[n],n);t.push(r)}this.state.body.setState({children:t})}}).Component=({model:e})=>{const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})};(class extends vh{constructor(e){super(e),this._variableDependency=new am(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:()=>this.performRepeat()}),this.addActivationHandler((()=>this.performRepeat()))}performRepeat(){if(this._variableDependency.hasDependencyInLoadingState())return;const e=nm.lookupVariable(this.state.variableName,this);if(!(e instanceof Dm))return void console.error("SceneByVariableRepeater: variable is not a MultiValueVariable");const t=function(e){const{value:t,text:n,options:r}=e.state;if(e.hasAllValue())return r;if(Array.isArray(t)&&Array.isArray(n))return t.map(((e,t)=>({value:e,label:n[t]})));return[{value:t,label:n}]}(e),n=[];for(const e of t){const t=this.state.getLayoutChild(e);n.push(t)}this.state.body.setState({children:n})}}).Component=({model:e})=>{const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})};const Ax=class extends vh{constructor(){super({})}get Component(){return Ax.Component}};Ax.Component=e=>$i().createElement("div",{style:{flexGrow:1}});class Rx extends vh{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}Rx.Component=function({model:e,parentState:t}){const{children:n,isHidden:r}=e.useState(),o=function(e,t){return(0,Fi.useMemo)((()=>{var n,r,o,s,l,c,u,d,p,h;const{direction:f="row",wrap:m}=e,g=a.config.theme2,y={};return t?jx(y,e,t):(y.display="flex",y.flexGrow=1,y.minWidth=e.minWidth,y.minHeight=e.minHeight),y.flexDirection=f,y.gap="8px",y.flexWrap=m||"nowrap",y.alignContent="baseline",y.minWidth=y.minWidth||0,y.minHeight=y.minHeight||0,y[g.breakpoints.down("md")]={flexDirection:null!=(r=null==(n=e.md)?void 0:n.direction)?r:"column",maxWidth:null!=(s=null==(o=e.md)?void 0:o.maxWidth)?s:"unset",maxHeight:null!=(c=null==(l=e.md)?void 0:l.maxHeight)?c:"unset",height:null!=(d=null==(u=e.md)?void 0:u.height)?d:"unset",width:null!=(h=null==(p=e.md)?void 0:p.width)?h:"unset"},(0,i.css)(y)}),[t,e])}(e.state,t);if(r)return null;return $i().createElement("div",{className:o},n.map((t=>{const n=t.Component;return $i().createElement(n,{key:t.state.key,model:t,parentState:e.state})})))};class Dx extends vh{}function jx(e,t,n){var r,i,a;const o=null!=(r=n.direction)?r:"row",{xSizing:s="fill",ySizing:l="fill"}=t;return e.display="flex",e.position="relative",e.flexDirection=o,"column"===o?(t.height?e.height=t.height:e.flexGrow="fill"===l?1:0,t.width?e.width=t.width:e.alignSelf="fill"===s?"stretch":"flex-start"):(t.height?e.height=t.height:e.alignSelf="fill"===l?"stretch":"flex-start",t.width?e.width=t.width:e.flexGrow="fill"===s?1:0),e.minWidth=t.minWidth,e.maxWidth=t.maxWidth,e.maxHeight=t.maxHeight,e.minHeight=null!=(i=t.minHeight)?i:n.minHeight,e.height=null!=(a=t.height)?a:n.height,e}Dx.Component=function({model:e,parentState:t}){if(!t)throw new Error("SceneFlexItem must be a child of SceneFlexLayout");const{body:n,isHidden:r}=e.useState(),o=function(e,t){return(0,Fi.useMemo)((()=>{var n,r,o,s,l,c,u,d,p,h;const f=a.config.theme2,m=jx({},e,t);return m[f.breakpoints.down("md")]={maxWidth:null!=(r=null==(n=e.md)?void 0:n.maxWidth)?r:"unset",maxHeight:null!=(s=null==(o=e.md)?void 0:o.maxHeight)?s:"unset",height:null!=(u=null==(l=e.md)?void 0:l.height)?u:null==(c=t.md)?void 0:c.height,width:null!=(h=null==(d=e.md)?void 0:d.width)?h:null==(p=t.md)?void 0:p.width},(0,i.css)(m)}),[e,t])}(e.state,t);if(!n||r)return null;return $i().createElement("div",{className:o},$i().createElement(n.Component,{model:n}))};var Ix=Object.defineProperty,Nx=Object.getOwnPropertySymbols,Lx=Object.prototype.hasOwnProperty,Mx=Object.prototype.propertyIsEnumerable,Fx=(e,t,n)=>t in e?Ix(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class $x extends vh{constructor(e){var t,n;super(((e,t)=>{for(var n in t||(t={}))Lx.call(t,n)&&Fx(e,n,t[n]);if(Nx)for(var n of Nx(t))Mx.call(t,n)&&Fx(e,n,t[n]);return e})({rowGap:1,columnGap:1,templateColumns:"repeat(auto-fit, minmax(400px, 1fr))",autoRows:null!=(t=e.autoRows)?t:"320px",children:null!=(n=e.children)?n:[]},e))}isDraggable(){return!1}}$x.Component=function({model:e}){const{children:t,isHidden:n,isLazy:r}=e.useState(),o=(s=e.state,(0,Fi.useMemo)((()=>{var e,t,n,r,o,l,c,u,d,p,h;const f={},m=a.config.theme2;return f.display="grid",f.gridTemplateColumns=s.templateColumns,f.gridTemplateRows=s.templateRows||"unset",f.gridAutoRows=s.autoRows||"unset",f.rowGap=m.spacing(null!=(e=s.rowGap)?e:1),f.columnGap=m.spacing(null!=(t=s.columnGap)?t:1),f.justifyItems=s.justifyItems||"unset",f.alignItems=s.alignItems||"unset",f.justifyContent=s.justifyContent||"unset",f.flexGrow=1,s.md&&(f[m.breakpoints.down("md")]={gridTemplateRows:null==(n=s.md)?void 0:n.templateRows,gridTemplateColumns:null==(r=s.md)?void 0:r.templateColumns,rowGap:s.md.rowGap?m.spacing(null!=(l=null==(o=s.md)?void 0:o.rowGap)?l:1):void 0,columnGap:s.md.columnGap?m.spacing(null!=(u=null==(c=s.md)?void 0:c.rowGap)?u:1):void 0,justifyItems:null==(d=s.md)?void 0:d.justifyItems,alignItems:null==(p=s.md)?void 0:p.alignItems,justifyContent:null==(h=s.md)?void 0:h.justifyContent}),(0,i.css)(f)}),[s]));var s;if(n)return null;return $i().createElement("div",{className:o},t.map((t=>{const n=t.Component;return r?$i().createElement(lE,{key:t.state.key,className:o},$i().createElement(n,{key:t.state.key,model:t,parentState:e.state})):$i().createElement(n,{key:t.state.key,model:t,parentState:e.state})})))};class Bx extends vh{}Bx.Component=function({model:e,parentState:t}){if(!t)throw new Error("SceneCSSGridItem must be a child of SceneCSSGridLayout");const{body:n,isHidden:r}=e.useState(),a=(o=e.state,(0,Fi.useMemo)((()=>{const e={};return e.gridColumn=o.gridColumn||"unset",e.gridRow=o.gridRow||"unset",e.position="relative",(0,i.css)(e)}),[o]));var o;if(!n||r)return null;return $i().createElement("div",{className:a},$i().createElement(n.Component,{model:n}))};var Vx=Object.defineProperty,Ux=Object.getOwnPropertySymbols,zx=Object.prototype.hasOwnProperty,qx=Object.prototype.propertyIsEnumerable,Hx=(e,t,n)=>t in e?Vx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gx=(e,t)=>{for(var n in t||(t={}))zx.call(t,n)&&Hx(e,n,t[n]);if(Ux)for(var n of Ux(t))qx.call(t,n)&&Hx(e,n,t[n]);return e};const Wx=.3,Qx=new Set(["ArrowUp","ArrowDown"]),Kx=new Set(["ArrowLeft","ArrowRight"]),Yx={row:{dim:"width",axis:"clientX",min:"minWidth",max:"maxWidth"},column:{dim:"height",axis:"clientY",min:"minHeight",max:"maxHeight"}};function Xx({direction:e="row",handleSize:t=32,initialSize:n="auto",primaryPaneStyles:r,secondaryPaneStyles:a,onDragFinished:s,children:l}){const c=$i().Children.toArray(l),u=(0,Fi.useRef)(null),d=(0,Fi.useRef)(null),p=(0,Fi.useRef)(null),h=(0,Fi.useRef)(null),f=(0,Fi.useRef)(null),m=(0,Fi.useRef)("1fr"),g=(0,Fi.useRef)(void 0),y=(0,Fi.useRef)(void 0),b=Yx[e].dim,v=Yx[e].axis,w=Yx[e].min,S=Yx[e].max;!function(e,t,n=0,r){const i=(0,Bc.throttle)(t,n);(0,Fi.useLayoutEffect)((()=>{if(!e)return;const t=new ResizeObserver(i);return t.observe(e,{box:"device-pixel-content-box"}),()=>t.disconnect()}),r)}(h.current,(e=>{for(const t of e){if(!t.target.isSameNode(h.current))return;const e=d.current.getBoundingClientRect()[b],n=Zx(d.current);u.current.ariaValueNow=`${(0,Bc.clamp)((e-n[w])/(n[S]-n[w])*100,0,100)}`}}),500,[S,w,e,b]);const E=(0,Fi.useRef)(null),x=(0,Fi.useCallback)((e=>{m.current=d.current.getBoundingClientRect()[b],f.current=h.current.getBoundingClientRect()[b],E.current=e[v],u.current.setPointerCapture(e.pointerId),g.current=Zx(d.current),y.current=void 0}),[b,v]),O=(0,Fi.useCallback)((e=>{if(null!==E.current&&"1fr"!==m.current){const n=e[v]-E.current,r=g.current,i=(0,Bc.clamp)(m.current+n,r[w],r[S]),a=i/(f.current-t);d.current.style.flexGrow=`${a}`,p.current.style.flexGrow=""+(1-a);const o=(0,Bc.clamp)((i-r[w])/(r[S]-r[w])*100,0,100);u.current.ariaValueNow=`${o}`}}),[t,v,w,S]),_=(0,Fi.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),u.current.releasePointerCapture(e.pointerId),E.current=null,null==s||s(parseFloat(d.current.style.flexGrow))}),[s]),T=(0,Fi.useRef)(new Set),C=(0,Fi.useRef)(null),k=(0,Fi.useCallback)((n=>{var r;if(0===T.current.size)return void(C.current=null);if("1fr"===m.current)return;const i=(n-(null!=(r=C.current)?r:n))*Wx;let a=0;"row"===e?(T.current.has("ArrowLeft")&&(a-=i),T.current.has("ArrowRight")&&(a+=i)):(T.current.has("ArrowUp")&&(a-=i),T.current.has("ArrowDown")&&(a+=i));const o=g.current,s=d.current.getBoundingClientRect()[b],l=(0,Bc.clamp)(s+a,o[w],o[S]),c=l/(f.current-t);d.current.style.flexGrow=`${c}`,p.current.style.flexGrow=""+(1-c);const h=(l-o[w])/(o[S]-o[w])*100;u.current.ariaValueNow=`${(0,Bc.clamp)(h,0,100)}`,C.current=n,window.requestAnimationFrame(k)}),[e,t,w,S,b]),P=(0,Fi.useCallback)((n=>{if("Enter"===n.key)return void(void 0===y.current?(y.current=d.current.style.flexGrow,d.current.style.flexGrow="0",p.current.style.flexGrow="1"):(d.current.style.flexGrow=y.current,p.current.style.flexGrow=""+(1-parseFloat(y.current)),y.current=void 0));if("Home"===n.key){g.current=Zx(d.current),f.current=h.current.getBoundingClientRect()[b];const e=g.current[w]/(f.current-t);return d.current.style.flexGrow=`${e}`,p.current.style.flexGrow=""+(1-e),void(u.current.ariaValueNow="0")}if("End"===n.key){g.current=Zx(d.current),f.current=h.current.getBoundingClientRect()[b];const e=g.current[S]/(f.current-t);return d.current.style.flexGrow=`${e}`,p.current.style.flexGrow=""+(1-e),void(u.current.ariaValueNow="100")}if(!("column"===e&&Qx.has(n.key)||"row"===e&&Kx.has(n.key))||T.current.has(n.key))return;y.current=void 0,n.preventDefault(),n.stopPropagation(),m.current=d.current.getBoundingClientRect()[b],f.current=h.current.getBoundingClientRect()[b],g.current=Zx(d.current);if(!T.current.has(n.key)){const e=0===T.current.size;T.current.add(n.key),e&&window.requestAnimationFrame(k)}}),[e,k,t,S,b,w]),A=(0,Fi.useCallback)((t=>{"row"===e&&!Kx.has(t.key)||"column"===e&&!Qx.has(t.key)||(T.current.delete(t.key),null==s||s(parseFloat(d.current.style.flexGrow)))}),[e,s]),R=(0,Fi.useCallback)((()=>{d.current.style.flexGrow="0.5",p.current.style.flexGrow="0.5";const e=Zx(d.current);g.current=e,m.current=d.current.getBoundingClientRect()[b],u.current.ariaValueNow=""+(m.current-e[w])/(e[S]-e[w])*100}),[S,b,w]),D=(0,Fi.useCallback)((()=>{T.current.size>0&&(T.current.clear(),E.current=null,null==s||s(parseFloat(d.current.style.flexGrow)))}),[s]),j=(0,o.useStyles2)(Jx),I=sE(),N=2===c.length?"visible":"hidden";return $i().createElement("div",{ref:h,className:j.container,style:{flexDirection:e}},$i().createElement("div",{ref:d,className:j.panel,style:Gx({flexGrow:"auto"===n?.5:(0,Bc.clamp)(n,0,1),[w]:"min-content"},r),id:`start-panel-${I}`},c[0]),c[1]&&$i().createElement($i().Fragment,null,$i().createElement("div",{ref:u,style:{[b]:`${t}px`},className:(0,i.cx)(j.handle,{[j.handleHorizontal]:"column"===e}),onPointerUp:_,onPointerDown:x,onPointerMove:O,onKeyDown:P,onKeyUp:A,onDoubleClick:R,onBlur:D,role:"separator","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":50,"aria-controls":`start-panel-${I}`,"aria-label":"Pane resize widget",tabIndex:0}),$i().createElement("div",{ref:p,className:j.panel,style:Gx({flexGrow:"auto"===n?.5:(0,Bc.clamp)(1-n,0,1),[w]:"min-content",visibility:`${N}`},a),id:`end-panel-${I}`},c[1])))}function Jx(e){return{handle:(0,i.css)({cursor:"col-resize",position:"relative",flexShrink:0,userSelect:"none","&::before":{content:'""',position:"absolute",backgroundColor:e.colors.primary.main,left:"50%",transform:"translate(-50%)",top:0,height:"100%",width:"1px",opacity:0,transition:"opacity ease-in-out 0.2s"},"&::after":{content:'""',width:"4px",borderRadius:"4px",backgroundColor:e.colors.border.weak,transition:"background-color ease-in-out 0.2s",height:"50%",top:"calc(50% - (50%) / 2)",transform:"translateX(-50%)",position:"absolute",left:"50%"},"&:hover, &:focus-visible":{outline:"none","&::before":{opacity:1},"&::after":{backgroundColor:e.colors.primary.main}}}),handleHorizontal:(0,i.css)({cursor:"row-resize","&::before":{left:"inherit",transform:"translateY(-50%)",top:"50%",height:"1px",width:"100%"},"&::after":{width:"50%",height:"4px",top:"50%",transform:"translateY(-50%)",left:"calc(50% - (50%) / 2)"}}),container:(0,i.css)({display:"flex",width:"100%",flexGrow:1,overflow:"hidden"}),panel:(0,i.css)({display:"flex",position:"relative",flexBasis:0})}}function Zx(e){if(null===e)return;const t=document.body.style.overflow,n=e.style.width,r=e.style.height,i=e.style.flexGrow;document.body.style.overflow="hidden",e.style.flexGrow="0";const{width:a,height:o}=e.getBoundingClientRect();e.style.flexGrow="100";const{width:s,height:l}=e.getBoundingClientRect();return document.body.style.overflow=t,e.style.width=n,e.style.height=r,e.style.flexGrow=i,{minWidth:a,maxWidth:s,minHeight:o,maxHeight:l}}class eO extends vh{toggleDirection(){this.setState({direction:"row"===this.state.direction?"column":"row"})}isDraggable(){return!1}}eO.Component=function({model:e}){const{primary:t,secondary:n,direction:r,isHidden:i,initialSize:a,primaryPaneStyles:o,secondaryPaneStyles:s}=e.useState();if(i)return null;const l=t.Component,c=null==n?void 0:n.Component;let u=n?a:1;return $i().createElement(Xx,{direction:r,initialSize:null!=u?u:.5,primaryPaneStyles:o,secondaryPaneStyles:s},$i().createElement(l,{key:t.state.key,model:t,parentState:e.state}),c&&n&&$i().createElement(c,{key:n.state.key,model:n,parentState:e.state}))};var tO=__webpack_require__(8398);new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(Jt){}new Map;Fi.startTransition,tO.flushSync,Fi.useId;"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement;var nO,rO;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(nO||(nO={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(rO||(rO={}));(class extends vh{enrichDataRequest(){return{app:this.state.name||"app"}}}).Component=({model:t})=>{const{pages:n}=t.useState();return $i().createElement(e.Switch,null,n.map((e=>$i().createElement(Es.Route,{key:e.state.url,exact:!1,path:e.state.url,render:t=>Lp(e,t)}))))};var iO=Object.defineProperty,aO=Object.getOwnPropertySymbols,oO=Object.prototype.hasOwnProperty,sO=Object.prototype.propertyIsEnumerable,lO=(e,t,n)=>t in e?iO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class cO extends vh{}function uO({node:e}){const t=e.useState(),n=(0,o.useStyles2)(dO);return $i().createElement("div",{className:n.container},Object.keys(t).map((r=>$i().createElement("div",{className:n.row,key:r},$i().createElement("div",{className:n.keyName},r),$i().createElement("div",{className:n.value},function(e,t,n){if(null===t)return"null";switch(typeof t){case"number":return $i().createElement(o.Input,{type:"number",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.valueAsNumber})});case"string":return $i().createElement(o.Input,{type:"text",defaultValue:t,onBlur:t=>n.setState({[e]:t.currentTarget.value})});case"object":return If(t)?t.constructor.name:(0,Bc.isPlainObject)(t)||(0,Bc.isArray)(t)?$i().createElement(o.JSONFormatter,{json:t,open:0}):String(t);default:return typeof t}}(r,t[r],e))))))}function dO(e){return{container:(0,i.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),row:(0,i.css)({display:"flex",gap:e.spacing(2)}),keyName:(0,i.css)({display:"flex",flexGrow:"0",width:120,alignItems:"center",height:e.spacing(e.components.height.md)}),value:(0,i.css)({flexGrow:1,minHeight:e.spacing(e.components.height.md),display:"flex",alignItems:"center"})}}function pO({node:e,selectedObject:t,onSelect:n}){const r=(0,o.useStyles2)(hO),a=[],s=e===t;return e.forEachChild((e=>{a.push($i().createElement(pO,{node:e,key:e.state.key,selectedObject:t,onSelect:n}))})),$i().createElement("div",{className:r.container},$i().createElement("div",{className:(0,i.cx)(r.name,s&&r.selected),onClick:()=>n(e)},e.constructor.name),$i().createElement("div",{className:r.children},a))}function hO(e){return{container:(0,i.css)({flexGrow:1,display:"flex",gap:e.spacing(.5),flexDirection:"column"}),name:(0,i.css)({flexGrow:1,display:"flex",gap:e.spacing(1),fontSize:e.typography.bodySmall.fontSize,cursor:"pointer",padding:e.spacing(0,1),borderRadius:e.shape.borderRadius(2),position:"relative","&:hover":{background:e.colors.background.secondary}}),selected:(0,i.css)({"&::before":{display:"block",content:"' '",position:"absolute",left:0,width:4,bottom:2,top:2,borderRadius:e.shape.radius.default,backgroundImage:e.colors.gradients.brandVertical}}),children:(0,i.css)({flexGrow:1,display:"flex",flexDirection:"column",paddingLeft:e.spacing(1)})}}function fO({scene:e}){const t=(0,o.useStyles2)(mO),[n,r]=(0,Fi.useState)(!1),[i,a]=(0,Fi.useState)();return $i().createElement($i().Fragment,null,$i().createElement(o.ToolbarButton,{variant:"canvas",icon:"bug",onClick:()=>r(!0)}),n&&$i().createElement(o.Drawer,{title:"Scene debugger",onClose:()=>r(!1),size:"lg"},$i().createElement("div",{className:t.panes},$i().createElement("div",{className:t.pane1},$i().createElement("div",{className:t.paneHeading},"Scene graph"),$i().createElement(o.CustomScrollbar,{autoHeightMin:"100%"},$i().createElement("div",{className:t.treeWrapper},$i().createElement(pO,{node:e,selectedObject:i,onSelect:a})))),$i().createElement("div",{className:t.pane2},$i().createElement("div",{className:t.paneHeading},"Object details"),i&&$i().createElement(uO,{node:i})))))}function mO(e){return{panes:(0,i.css)({flexGrow:1,display:"flex",height:"100%",flexDirection:"row",marginTop:e.spacing(-2)}),pane1:(0,i.css)({flexGrow:0,display:"flex",height:"100%",flexDirection:"column",borderRight:`1px solid ${e.colors.border.weak}`}),pane2:(0,i.css)({flexGrow:1,display:"flex",minHeight:"100%",flexDirection:"column",paddingLeft:e.spacing(2)}),treeWrapper:(0,i.css)({paddingRight:e.spacing(2),height:"100%",marginLeft:e.spacing(-1)}),paneHeading:(0,i.css)({padding:e.spacing(1,0),fontWeight:e.typography.fontWeightMedium})}}function gO({page:e,routeProps:t}){const n=function(e){if(e.parent instanceof vO)return e.parent;return e}(e),r=n.useState(),i=function(){const e=(0,Es.useLocation)();return(0,a.locationSearchToObject)(e.search||"")}(),o=e.getScene(t.match),s=r.initializedScene===o;if((0,Fi.useLayoutEffect)((()=>{s||n.initializeScene(o)}),[o,n,s]),(0,Fi.useEffect)((()=>()=>n.setState({initializedScene:void 0})),[n]),!s)return null;const l={text:r.title,img:r.titleImg,icon:r.titleIcon,url:Np(r.url,r.preserveUrlKeys),hideFromBreadcrumbs:r.hideFromBreadcrumbs,parentItem:yO(r.getParentPage?r.getParentPage():n.parent)};r.tabs&&(l.children=r.tabs.map((t=>({text:t.state.title,icon:t.state.titleIcon,tabSuffix:t.state.tabSuffix,active:e===t,url:Np(t.state.url,t.state.preserveUrlKeys),parentItem:l}))));let c=[];return r.controls&&(c=r.controls.map((e=>$i().createElement(e.Component,{model:e,key:e.state.key})))),i["scene-debugger"]&&c.push($i().createElement(fO,{scene:n,key:"scene-debugger"})),$i().createElement(a.PluginPage,{pageNav:l,actions:c,renderTitle:r.renderTitle,subTitle:r.subTitle},$i().createElement(o.Component,{model:o}))}function yO(e,t){if(e instanceof vO)return{text:e.state.title,url:Np(e.state.url,e.state.preserveUrlKeys),hideFromBreadcrumbs:e.state.hideFromBreadcrumbs,parentItem:yO(e.state.getParentPage?e.state.getParentPage():e.parent)}}function bO({drilldown:e,parent:t,routeProps:n}){return Lp(t.getDrilldownPage(e,n.match),n)}cO.Component=({model:e})=>{const{component:t,props:n,reactNode:r}=e.useState();return t?$i().createElement(t,((e,t)=>{for(var n in t||(t={}))oO.call(t,n)&&lO(e,n,t[n]);if(aO)for(var n of aO(t))sO.call(t,n)&&lO(e,n,t[n]);return e})({},n)):r||null};class vO extends vh{constructor(e){super(e),this._sceneCache=new Map,this._drilldownCache=new Map,this.addActivationHandler((()=>()=>IS().cleanUp(this)))}initializeScene(e){this.setState({initializedScene:e}),IS().initSync(this)}getScene(e){let t=this._sceneCache.get(e.url);if(t)return t;if(!this.state.getScene)throw new Error("Missing getScene on SceneAppPage "+this.state.title);return t=this.state.getScene(e),this._sceneCache.set(e.url,t),t}getDrilldownPage(e,t){let n=this._drilldownCache.get(t.url);return n||(n=e.getPage(t,this),this._drilldownCache.set(t.url,n),n)}enrichDataRequest(e){if(this.state.getParentPage)return this.state.getParentPage().enrichDataRequest(e);if(!this.parent)return null;const t=this.getRoot();return Nf(t)?t.enrichDataRequest(e):null}}vO.Component=function({model:t,routeProps:n}){var r,i;const{tabs:a,drilldowns:o}=t.useState(),s=[];if(a&&a.length>0)for(let e=0;e<a.length;e++){const n=a[e];if(0===e&&s.push($i().createElement(Es.Route,{exact:!0,key:t.state.url,path:null!=(r=t.state.routePath)?r:t.state.url,render:e=>Lp(n,e)})),s.push($i().createElement(Es.Route,{exact:!0,key:n.state.url,path:null!=(i=n.state.routePath)?i:n.state.url,render:e=>Lp(n,e)})),n.state.drilldowns)for(const e of n.state.drilldowns)s.push($i().createElement(Es.Route,{exact:!1,key:e.routePath,path:e.routePath,render:t=>$i().createElement(bO,{drilldown:e,parent:n,routeProps:t})}))}if(o)for(const e of o)s.push($i().createElement(Es.Route,{key:e.routePath,exact:!1,path:e.routePath,render:n=>$i().createElement(bO,{drilldown:e,parent:t,routeProps:n})}));if(!a&&function(e,t){if(!t.isExact)return!1;if(t.url===e.state.url)return!0;if(e.parent instanceof vO&&e.parent.state.tabs[0]===e&&e.parent.state.url===t.url)return!0;return!1}(t,n.match))return $i().createElement(gO,{page:t,routeProps:n});return s.push(function(e,t){return $i().createElement(Es.Route,{key:"fallback route",render:n=>{var r,i,a;const o=null!=(a=null==(i=(r=e.state).getFallbackPage)?void 0:i.call(r))?a:new vO({url:"",title:"Not found",subTitle:"The url did not match any page",getScene:()=>new NS({body:new Rx({direction:"column",children:[new Dx({body:new cO({component:()=>$i().createElement("div",{"data-testid":"default-fallback-content"},"If you found your way here using a link then there might be a bug in this application.")})})]})})});return $i().createElement(gO,{page:o,routeProps:t})}})}(t,n)),$i().createElement(e.Switch,null,s)};var wO=(e=>(e.Always="always",e.Auto="auto",e.Never="never",e))(wO||{}),SO=(e=>(e.Hue="hue",e.None="none",e.Opacity="opacity",e.Scheme="scheme",e))(SO||{}),EO=(e=>(e.None="none",e.Normal="normal",e.Percent="percent",e))(EO||{}),xO=(e=>(e.Auto="auto",e.Horizontal="horizontal",e.Vertical="vertical",e))(xO||{}),OO=(e=>(e.Background="background",e.BackgroundSolid="background_solid",e.None="none",e.Value="value",e))(OO||{}),_O=(e=>(e.Area="area",e.Line="line",e.None="none",e))(_O||{}),TO=(e=>(e.Auto="auto",e.Center="center",e))(TO||{}),CO=(e=>(e.Auto="auto",e.Name="name",e.None="none",e.Value="value",e.ValueAndName="value_and_name",e))(CO||{}),kO=(e=>(e.Inverted="inverted",e.SameAsValue="same_as_value",e.Standard="standard",e))(kO||{}),PO=(e=>(e.Multi="multi",e.None="none",e.Single="single",e))(PO||{}),AO=(e=>(e.Basic="basic",e.Gradient="gradient",e.Lcd="lcd",e))(AO||{}),RO=(e=>(e.Color="color",e.Hidden="hidden",e.Text="text",e))(RO||{}),DO=(e=>(e.Auto="auto",e.Hidden="hidden",e.Left="left",e.Top="top",e))(DO||{}),jO=(e=>(e.Auto="auto",e.Manual="manual",e))(jO||{}),IO=(e=>(e.Auto="auto",e.Lg="lg",e.Md="md",e.Sm="sm",e))(IO||{});const NO={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:xO.Auto,showValue:wO.Auto,stacking:EO.None,xTickLabelRotation:0,xTickLabelSpacing:0},LO={fillOpacity:80,gradientMode:SO.None,lineWidth:1},MO={displayMode:AO.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:DO.Auto,showUnfilled:!0,sizing:jO.Auto,valueMode:RO.Color},FO={selectedSeries:0},$O={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:jO.Auto},BO={layers:[]};const VO={calculate:!1,cellGap:1,cellValues:{},color:{scheme:"Oranges",fill:"dark-orange",reverse:!1,exponent:.5,steps:64},exemplars:{color:"rgba(255,0,255,0.7)"},filterValues:{le:1e-9},legend:{show:!0},selectionMode:"x",showValue:wO.Auto,tooltip:{mode:PO.Single,yHistogram:!1,showColorScale:!1}},UO={bucketCount:30,bucketOffset:0},zO={fillOpacity:80,gradientMode:SO.None,lineWidth:1},qO={showImage:!0};const HO={displayLabels:[]},GO={colorMode:OO.Value,graphMode:_O.Area,justifyMode:TO.Auto,percentChangeColorMode:kO.Standard,showPercentChange:!1,textMode:CO.Auto,wideLayout:!0},WO={alignValue:"left",mergeValues:!0,perPage:20,rowHeight:.9,showValue:wO.Auto},QO={fillOpacity:70,lineWidth:0},KO={colWidth:.9,rowHeight:.9,showValue:wO.Auto},YO={fillOpacity:70,lineWidth:1},XO={cellHeight:IO.Sm,footer:{show:!1,countRows:!1,reducer:[]},frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]};const JO={content:"# Title\n\nFor markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)",mode:"markdown"};const ZO={fillOpacity:50,show:"points"},e_={series:[]};class t_{constructor(){this._overrides=[]}overrideColor(e){return this._overrides[this._overrides.length-1].properties.push({id:"color",value:e}),this}overrideDecimals(e){return this._overrides[this._overrides.length-1].properties.push({id:"decimals",value:e}),this}overrideDisplayName(e){return this._overrides[this._overrides.length-1].properties.push({id:"displayName",value:e}),this}overrideFilterable(e){return this._overrides[this._overrides.length-1].properties.push({id:"filterable",value:e}),this}overrideLinks(e){return this._overrides[this._overrides.length-1].properties.push({id:"links",value:e}),this}overrideMappings(e){return this._overrides[this._overrides.length-1].properties.push({id:"mappings",value:e}),this}overrideMax(e){return this._overrides[this._overrides.length-1].properties.push({id:"max",value:e}),this}overrideMin(e){return this._overrides[this._overrides.length-1].properties.push({id:"min",value:e}),this}overrideNoValue(e){return this._overrides[this._overrides.length-1].properties.push({id:"noValue",value:e}),this}overrideThresholds(e){return this._overrides[this._overrides.length-1].properties.push({id:"thresholds",value:e}),this}overrideUnit(e){return this._overrides[this._overrides.length-1].properties.push({id:"unit",value:e}),this}}class n_ extends t_{match(e){return this._overrides.push({matcher:e,properties:[]}),this}matchFieldsWithName(e){return this._overrides.push({matcher:{id:r.FieldMatcherID.byName,options:e},properties:[]}),this}matchFieldsWithNameByRegex(e){return this._overrides.push({matcher:{id:r.FieldMatcherID.byRegexp,options:e},properties:[]}),this}matchFieldsByType(e){return this._overrides.push({matcher:{id:r.FieldMatcherID.byType,options:e},properties:[]}),this}matchFieldsByQuery(e){return this._overrides.push({matcher:{id:r.FieldMatcherID.byFrameRefID,options:e},properties:[]}),this}matchFieldsByValue(e){return this._overrides.push({matcher:{id:r.FieldMatcherID.byValue,options:e},properties:[]}),this}matchComparisonQuery(e){return this.matchFieldsByQuery(hx(e))}overrideCustomFieldConfig(e,t){const n=`custom.${String(e)}`;return this._overrides[this._overrides.length-1].properties.push({id:n,value:t}),this}build(){return this._overrides}}var r_=Object.defineProperty,i_=Object.defineProperties,a_=Object.getOwnPropertyDescriptors,o_=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,l_=Object.prototype.propertyIsEnumerable,c_=(e,t,n)=>t in e?r_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u_=(e,t)=>{for(var n in t||(t={}))s_.call(t,n)&&c_(e,n,t[n]);if(o_)for(var n of o_(t))l_.call(t,n)&&c_(e,n,t[n]);return e},d_=(e,t)=>i_(e,a_(t));class p_{constructor(e){this.defaultFieldConfig=e,this._fieldConfig={defaults:{},overrides:[]},this._overridesBuilder=new n_,this.setDefaults()}setDefaults(){const e={defaults:{custom:this.defaultFieldConfig?(0,Bc.cloneDeep)(this.defaultFieldConfig()):{}},overrides:[]};this._fieldConfig=e}setColor(e){return this.setFieldConfigDefaults("color",e)}setDecimals(e){return this.setFieldConfigDefaults("decimals",e)}setDisplayName(e){return this.setFieldConfigDefaults("displayName",e)}setFilterable(e){return this.setFieldConfigDefaults("filterable",e)}setLinks(e){return this.setFieldConfigDefaults("links",e)}setMappings(e){return this.setFieldConfigDefaults("mappings",e)}setMax(e){return this.setFieldConfigDefaults("max",e)}setMin(e){return this.setFieldConfigDefaults("min",e)}setNoValue(e){return this.setFieldConfigDefaults("noValue",e)}setThresholds(e){return this.setFieldConfigDefaults("thresholds",e)}setUnit(e){return this.setFieldConfigDefaults("unit",e)}setCustomFieldConfig(e,t){return this._fieldConfig.defaults=d_(u_({},this._fieldConfig.defaults),{custom:(0,Bc.merge)(this._fieldConfig.defaults.custom,{[e]:t})}),this}setOverrides(e){return e(this._overridesBuilder),this}setFieldConfigDefaults(e,t){return this._fieldConfig.defaults=d_(u_({},this._fieldConfig.defaults),{[e]:t}),this}build(){return{defaults:this._fieldConfig.defaults,overrides:this._overridesBuilder.build()}}}class h_{constructor(e){this.defaultOptions=e,this._options={},this.setDefaults()}setDefaults(){this._options=this.defaultOptions?(0,Bc.cloneDeep)(this.defaultOptions()):{}}setOption(e,t){return this._options=(0,Bc.merge)(this._options,{[e]:t}),this}build(){return this._options}}var f_=Object.defineProperty,m_=Object.defineProperties,g_=Object.getOwnPropertyDescriptors,y_=Object.getOwnPropertySymbols,b_=Object.prototype.hasOwnProperty,v_=Object.prototype.propertyIsEnumerable,w_=(e,t,n)=>t in e?f_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;class S_{constructor(e,t,n,r){this._state={},this._state.title="",this._state.description="",this._state.displayMode="default",this._state.hoverHeader=!1,this._state.pluginId=e,this._state.pluginVersion=t,this._fieldConfigBuilder=new p_(r),this._panelOptionsBuilder=new h_(n)}setTitle(e){return this._state.title=e,this}setDescription(e){return this._state.description=e,this}setDisplayMode(e){return this._state.displayMode=e,this}setHoverHeader(e){return this._state.hoverHeader=e,this}setMenu(e){return this._state.menu=e,this}setHeaderActions(e){return this._state.headerActions=e,this}setColor(e){return this._fieldConfigBuilder.setColor(e),this}setDecimals(e){return this._fieldConfigBuilder.setDecimals(e),this}setDisplayName(e){return this._fieldConfigBuilder.setDisplayName(e),this}setFilterable(e){return this._fieldConfigBuilder.setFilterable(e),this}setLinks(e){return this._fieldConfigBuilder.setLinks(e),this}setMappings(e){return this._fieldConfigBuilder.setMappings(e),this}setMax(e){return this._fieldConfigBuilder.setMax(e),this}setMin(e){return this._fieldConfigBuilder.setMin(e),this}setNoValue(e){return this._fieldConfigBuilder.setNoValue(e),this}setThresholds(e){return this._fieldConfigBuilder.setThresholds(e),this}setUnit(e){return this._fieldConfigBuilder.setUnit(e),this}setCustomFieldConfig(e,t){return this._fieldConfigBuilder.setCustomFieldConfig(e,t),this}setOverrides(e){return this._fieldConfigBuilder.setOverrides(e),this}setOption(e,t){return this._panelOptionsBuilder.setOption(e,t),this}setData(e){return this._state.$data=e,this}setTimeRange(e){return this._state.$timeRange=e,this}setVariables(e){return this._state.$variables=e,this}setBehaviors(e){return this._state.$behaviors=e,this}build(){const e=new pb(((e,t)=>m_(e,g_(t)))(((e,t)=>{for(var n in t||(t={}))b_.call(t,n)&&w_(e,n,t[n]);if(y_)for(var n of y_(t))v_.call(t,n)&&w_(e,n,t[n]);return e})({},this._state),{options:this._panelOptionsBuilder.build(),fieldConfig:this._fieldConfigBuilder.build()}));return e}}const E_={barchart:()=>new S_("barchart","10.0.0",(()=>NO),(()=>LO)),bargauge:()=>new S_("bargauge","10.0.0",(()=>MO)),datagrid:()=>new S_("datagrid","10.0.0",(()=>FO)),flamegraph:()=>new S_("flamegraph","10.0.0"),gauge:()=>new S_("gauge","10.0.0",(()=>$O)),geomap:()=>new S_("geomap","10.0.0",(()=>BO)),heatmap:()=>new S_("heatmap","10.0.0",(()=>VO)),histogram:()=>new S_("histogram","10.0.0",(()=>UO),(()=>zO)),logs:()=>new S_("logs","10.0.0"),news:()=>new S_("news","10.0.0",(()=>qO)),nodegraph:()=>new S_("nodeGraph","10.0.0"),piechart:()=>new S_("piechart","10.0.0",(()=>HO)),stat:()=>new S_("stat","10.0.0",(()=>GO)),statetimeline:()=>new S_("state-timeline","10.0.0",(()=>WO),(()=>QO)),statushistory:()=>new S_("status-history","10.0.0",(()=>KO),(()=>YO)),table:()=>new S_("table","10.0.0",(()=>XO)),text:()=>new S_("text","10.0.0",(()=>JO)),timeseries:()=>new S_("timeseries","10.0.0"),trend:()=>new S_("trend","10.0.0"),traces:()=>new S_("traces","10.0.0"),xychart:()=>new S_("xychart","10.0.0",(()=>e_),(()=>ZO))};const x_={getUrlWithAppState:Np,registerRuntimePanelPlugin:function({pluginId:e,plugin:t}){if(qp.has(e))throw new Error(`A runtime panel plugin with id ${e} has already been registered`);t.meta=((e,t)=>Fp(e,$p(t)))(((e,t)=>{for(var n in t||(t={}))Vp.call(t,n)&&zp(e,n,t[n]);if(Bp)for(var n of Bp(t))Up.call(t,n)&&zp(e,n,t[n]);return e})({},t.meta),{id:e,name:e,module:"runtime plugin",baseUrl:"runtime plugin",info:{author:{name:"Runtime plugin "+e},description:"",links:[],logos:{large:"",small:""},screenshots:[],updated:"",version:""}}),qp.set(e,t)},registerRuntimeDataSource:function({dataSource:e}){if(Rh.has(e.uid))throw new Error(`A runtime data source with uid ${e.uid} has already been registered`);Rh.set(e.uid,e)},registerVariableMacro:function(e,t){if(tm.get(e))throw new Error(`Macro already registered ${e}`);return tm.set(e,t),()=>{tm.delete(e)}},cloneSceneObjectState:kh,syncStateFromSearchParams:function(e,t){const n=new Dh;n.rebuildIndex(e),Ih(e,t,n)},getUrlState:jh,renderPrometheusLabelFilters:ty,isAdHocVariable:function(e){return"adhoc"===e.state.type},isConstantVariable:function(e){return"constant"===e.state.type},isCustomVariable:function(e){return"custom"===e.state.type},isDataSourceVariable:function(e){return"datasource"===e.state.type},isIntervalVariable:function(e){return"interval"===e.state.type},isQueryVariable:function(e){return"query"===e.state.type},isTextBoxVariable:function(e){return"textbox"===e.state.type},isGroupByVariable:function(e){return"groupby"===e.state.type}};function O_(){history.pushState(null,"")}class __ extends r.BusEventWithPayload{}var T_,C_,k_;k_="timeseries-data-received",(C_="type")in(T_=__)?Object.defineProperty(T_,C_,{value:k_,enumerable:!0,configurable:!0,writable:!0}):T_[C_]=k_;var P_=function(e){return e.partial="partial",e["attribute-operator-value"]="attribute-operator-value",e["attribute-operator"]="attribute-operator",e}({}),A_=function(e){return e["="]="=",e["!="]="!=",e.in="in",e["not-in"]="not-in",e["is-empty"]="is-empty",e["=~"]="=~",e["!~"]="!~",e}({}),R_=function(e){return e.attribute="attribute",e.operator="operator",e.value="value",e}({}),D_=function(e){return e.attribute="attribute",e.operator="operator",e.value="value",e}({});var j_,I_,N_=function(){return N_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},N_.apply(this,arguments)};function L_(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function M_(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function F_(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function $_(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"}(j_||(j_={})),function(e){e.Parent="#_parent",e.Internal="#_internal"}(I_||(I_={}));var B_,V_=j_.Start,U_=j_.Stop,z_=j_.Raise,q_=j_.Send,H_=j_.Cancel,G_=j_.NullEvent,W_=j_.Assign,Q_=(j_.After,j_.DoneState,j_.Log),K_=j_.Init,Y_=j_.Invoke,X_=(j_.ErrorExecution,j_.ErrorPlatform),J_=j_.ErrorCustom,Z_=j_.Update,eT=j_.Choose,tT=j_.Pure,nT={},rT="xstate.guard",iT=!0;function aT(e,t,n){void 0===n&&(n=".");var r=lT(e,n),i=lT(t,n);return OT(i)?!!OT(r)&&i===r:OT(r)?r in i:Object.keys(r).every((function(e){return e in i&&aT(r[e],i[e])}))}function oT(e){try{return OT(e)||"number"==typeof e?"".concat(e):e.type}catch(e){throw new Error("Events must be strings or objects with a string event.type property.")}}function sT(e,t){try{return ET(e)?e:e.toString().split(t)}catch(t){throw new Error("'".concat(e,"' is not a valid state path."))}}function lT(e,t){return"object"==typeof(n=e)&&"value"in n&&"context"in n&&"event"in n&&"_event"in n?e.value:ET(e)?cT(e):"string"!=typeof e?e:cT(sT(e,t));var n}function cT(e){if(1===e.length)return e[0];for(var t={},n=t,r=0;r<e.length-1;r++)r===e.length-2?n[e[r]]=e[r+1]:(n[e[r]]={},n=n[e[r]]);return t}function uT(e,t){for(var n={},r=Object.keys(e),i=0;i<r.length;i++){var a=r[i];n[a]=t(e[a],a,e,i)}return n}function dT(e,t,n){var r,i,a={};try{for(var o=M_(Object.keys(e)),s=o.next();!s.done;s=o.next()){var l=s.value,c=e[l];n(c)&&(a[l]=t(c,l,e))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}var pT=function(e){return function(t){var n,r,i=t;try{for(var a=M_(e),o=a.next();!o.done;o=a.next()){i=i[o.value]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}};function hT(e){if(!e)return[[]];if(OT(e))return[[e]];var t=fT(Object.keys(e).map((function(t){var n=e[t];return"string"==typeof n||n&&Object.keys(n).length?hT(e[t]).map((function(e){return[t].concat(e)})):[[t]]})));return t}function fT(e){var t;return(t=[]).concat.apply(t,$_([],F_(e),!1))}function mT(e){return ET(e)?e:[e]}function gT(e){return void 0===e?[]:mT(e)}function yT(e,t,n){var r,i;if(xT(e))return e(t,n.data);var a={};try{for(var o=M_(Object.keys(e)),s=o.next();!s.done;s=o.next()){var l=s.value,c=e[l];xT(c)?a[l]=c(t,n.data):a[l]=c}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}function bT(e){return e instanceof Promise||!(null===e||!xT(e)&&"object"!=typeof e||!xT(e.then))}function vT(e,t){return uT(e.states,(function(e,n){if(e){var r=(OT(t)?void 0:t[n])||(e?e.current:void 0);if(r)return{current:r,states:vT(e,r)}}}))}function wT(e,t,n,r){iT||ST(!!e,"Attempting to update undefined context");var i=e?n.reduce((function(e,n){var i,a,o=n.assignment,s={state:r,action:n,_event:t},l={};if(xT(o))l=o(e,t.data,s);else try{for(var c=M_(Object.keys(o)),u=c.next();!u.done;u=c.next()){var d=u.value,p=o[d];l[d]=xT(p)?p(e,t.data,s):p}}catch(e){i={error:e}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(i)throw i.error}}return Object.assign({},e,l)}),e):e;return i}var ST=function(){};function ET(e){return Array.isArray(e)}function xT(e){return"function"==typeof e}function OT(e){return"string"==typeof e}function _T(e,t){if(e)return OT(e)?{type:rT,name:e,predicate:t?t[e]:void 0}:xT(e)?{type:rT,name:e.name,predicate:e}:e}iT||(ST=function(e,t){var n=e instanceof Error?e:void 0;if((n||!e)&&void 0!==console){var r=["Warning: ".concat(t)];n&&r.push(n),console.warn.apply(console,r)}});var TT=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();(B_={})[TT]=function(){return this},B_[Symbol.observable]=function(){return this};function CT(e){return!!e&&"__xstatenode"in e}function kT(e,t){return OT(e)||"number"==typeof e?N_({type:e},t):e}function PT(e,t){if(!OT(e)&&"$$type"in e&&"scxml"===e.$$type)return e;var n=kT(e);return N_({name:n.type,data:n,$$type:"scxml",type:"external"},t)}function AT(e,t){return mT(t).map((function(t){return void 0===t||"string"==typeof t||CT(t)?{target:t,event:e}:N_(N_({},t),{event:e})}))}function RT(e,t,n,r,i){var a=e.options.guards,o={state:i,cond:t,_event:r};if(t.type===rT)return((null==a?void 0:a[t.name])||t.predicate)(n,r.data,o);var s=null==a?void 0:a[t.type];if(!s)throw new Error("Guard '".concat(t.type,"' is not implemented on machine '").concat(e.id,"'."));return s(n,r.data,o)}function DT(e){return"string"==typeof e?{type:e}:e}function jT(e,t,n){var r=function(){},i="object"==typeof e,a=i?e:null;return{next:((i?e.next:e)||r).bind(a),error:((i?e.error:t)||r).bind(a),complete:((i?e.complete:n)||r).bind(a)}}function IT(e,t){return"".concat(e,":invocation[").concat(t,"]")}function NT(e){return(e.type===z_||e.type===q_&&e.to===I_.Internal)&&"number"!=typeof e.delay}var LT=function(e){return"atomic"===e.type||"final"===e.type};function MT(e){return Object.keys(e.states).map((function(t){return e.states[t]}))}function FT(e){return MT(e).filter((function(e){return"history"!==e.type}))}function $T(e){var t=[e];return LT(e)?t:t.concat(fT(FT(e).map($T)))}function BT(e,t){var n,r,i,a,o,s,l,c,u=UT(new Set(e)),d=new Set(t);try{for(var p=M_(d),h=p.next();!h.done;h=p.next())for(var f=(x=h.value).parent;f&&!d.has(f);)d.add(f),f=f.parent}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}var m=UT(d);try{for(var g=M_(d),y=g.next();!y.done;y=g.next()){if("compound"!==(x=y.value).type||m.get(x)&&m.get(x).length){if("parallel"===x.type)try{for(var b=(o=void 0,M_(FT(x))),v=b.next();!v.done;v=b.next()){var w=v.value;d.has(w)||(d.add(w),u.get(w)?u.get(w).forEach((function(e){return d.add(e)})):w.initialStateNodes.forEach((function(e){return d.add(e)})))}}catch(e){o={error:e}}finally{try{v&&!v.done&&(s=b.return)&&s.call(b)}finally{if(o)throw o.error}}}else u.get(x)?u.get(x).forEach((function(e){return d.add(e)})):x.initialStateNodes.forEach((function(e){return d.add(e)}))}}catch(e){i={error:e}}finally{try{y&&!y.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}try{for(var S=M_(d),E=S.next();!E.done;E=S.next()){var x;for(f=(x=E.value).parent;f&&!d.has(f);)d.add(f),f=f.parent}}catch(e){l={error:e}}finally{try{E&&!E.done&&(c=S.return)&&c.call(S)}finally{if(l)throw l.error}}return d}function VT(e,t){var n=t.get(e);if(!n)return{};if("compound"===e.type){var r=n[0];if(!r)return{};if(LT(r))return r.key}var i={};return n.forEach((function(e){i[e.key]=VT(e,t)})),i}function UT(e){var t,n,r=new Map;try{for(var i=M_(e),a=i.next();!a.done;a=i.next()){var o=a.value;r.has(o)||r.set(o,[]),o.parent&&(r.has(o.parent)||r.set(o.parent,[]),r.get(o.parent).push(o))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}function zT(e,t){return VT(e,UT(BT([e],t)))}function qT(e,t){return Array.isArray(e)?e.some((function(e){return e===t})):e instanceof Set&&e.has(t)}function HT(e,t){return"compound"===t.type?FT(t).some((function(t){return"final"===t.type&&qT(e,t)})):"parallel"===t.type&&FT(t).every((function(t){return HT(e,t)}))}function GT(e){return new Set(fT(e.map((function(e){return e.tags}))))}var WT=PT({type:K_});function QT(e,t){return t&&t[e]||void 0}function KT(e,t){var n;if(OT(e)||"number"==typeof e)n=xT(r=QT(e,t))?{type:e,exec:r}:r||{type:e,exec:void 0};else if(xT(e))n={type:e.name||e.toString(),exec:e};else{var r;if(xT(r=QT(e.type,t)))n=N_(N_({},e),{exec:r});else if(r){var i=r.type||e.type;n=N_(N_(N_({},r),e),{type:i})}else n=e}return n}var YT=function(e,t){return e?(ET(e)?e:[e]).map((function(e){return KT(e,t)})):[]};function XT(e){var t=KT(e);return N_(N_({id:OT(e)?e:t.id},t),{type:t.type})}function JT(e,t){return{to:t?t.to:void 0,type:q_,event:xT(e)?e:kT(e),delay:t?t.delay:void 0,id:t&&void 0!==t.id?t.id:xT(e)?e.name:oT(e)}}function ZT(e,t){var n="".concat(j_.DoneState,".").concat(e),r={type:n,data:t,toString:function(){return n}};return r}function eC(e,t){var n="".concat(j_.DoneInvoke,".").concat(e),r={type:n,data:t,toString:function(){return n}};return r}function tC(e,t){var n="".concat(j_.ErrorPlatform,".").concat(e),r={type:n,data:t,toString:function(){return n}};return r}function nC(e,t,n,r,i,a,o){void 0===o&&(o=!1);var s=o?[]:function(e){var t,n,r=[];try{for(var i=M_(e),a=i.next();!a.done;a=i.next())for(var o=a.value,s=0;s<o.actions.length;)o.actions[s].type!==W_?s++:(r.push(o.actions[s]),o.actions.splice(s,1))}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(i),l=s.length?wT(n,r,s,t):n,c=o?[n]:void 0,u=[];function d(i,s){var d;switch(s.type){case z_:var p=function(e,t,n,r){var i,a={_event:n},o=PT(xT(e.event)?e.event(t,n.data,a):e.event);if(OT(e.delay)){var s=r&&r[e.delay];i=xT(s)?s(t,n.data,a):s}else i=xT(e.delay)?e.delay(t,n.data,a):e.delay;return N_(N_({},e),{type:z_,_event:o,delay:i})}(s,l,r,e.options.delays);return a&&"number"==typeof p.delay&&a(p,l,r),p;case q_:var h=function(e,t,n,r){var i,a={_event:n},o=PT(xT(e.event)?e.event(t,n.data,a):e.event);if(OT(e.delay)){var s=r&&r[e.delay];i=xT(s)?s(t,n.data,a):s}else i=xT(e.delay)?e.delay(t,n.data,a):e.delay;var l=xT(e.to)?e.to(t,n.data,a):e.to;return N_(N_({},e),{to:l,_event:o,event:o.data,delay:i})}(s,l,r,e.options.delays);if(!iT){var f=s.delay;ST(!OT(f)||"number"==typeof h.delay,"No delay reference for delay expression '".concat(f,"' was found on machine '").concat(e.id,"'"))}return a&&h.to!==I_.Internal&&("entry"===i?u.push(h):a(h,l,r)),h;case Q_:var m=function(e,t,n){return N_(N_({},e),{value:OT(e.expr)?e.expr:e.expr(t,n.data,{_event:n})})}(s,l,r);return null==a||a(m,l,r),m;case eT:if(!(v=null===(d=s.conds.find((function(n){var i=_T(n.cond,e.options.guards);return!i||RT(e,i,l,r,a?void 0:t)})))||void 0===d?void 0:d.actions))return[];var g=F_(nC(e,t,l,r,[{type:i,actions:YT(gT(v),e.options.actions)}],a,o),2),y=g[0],b=g[1];return l=b,null==c||c.push(l),y;case tT:var v;if(!(v=s.get(l,r.data)))return[];var w=F_(nC(e,t,l,r,[{type:i,actions:YT(gT(v),e.options.actions)}],a,o),2),S=w[0],E=w[1];return l=E,null==c||c.push(l),S;case U_:m=function(e,t,n){var r=xT(e.activity)?e.activity(t,n.data):e.activity,i="string"==typeof r?{id:r}:r;return{type:j_.Stop,activity:i}}(s,l,r);return null==a||a(m,n,r),m;case W_:l=wT(l,r,[s],a?void 0:t),null==c||c.push(l);break;default:var x=KT(s,e.options.actions),O=x.exec;if(a)a(x,l,r);else if(O&&c){var _=c.length-1,T=N_(N_({},x),{exec:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];O.apply(void 0,$_([c[_]],F_(t),!1))}});x=T}return x}}var p=fT(i.map((function(e){var t,n,i=[];try{for(var o=M_(e.actions),s=o.next();!s.done;s=o.next()){var c=s.value,p=d(e.type,c);p&&(i=i.concat(p))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return u.forEach((function(e){a(e,l,r)})),u.length=0,i})));return[p,l]}function rC(e,t){if(e===t)return!0;if(void 0===e||void 0===t)return!1;if(OT(e)||OT(t))return e===t;var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((function(n){return rC(e[n],t[n])}))}function iC(e){return"object"==typeof e&&null!==e&&("value"in e&&"_event"in e)}var aC=function(){function e(e){var t,n,r=this;this.actions=[],this.activities=nT,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||nT,this.meta=(void 0===(n=e.configuration)&&(n=[]),n.reduce((function(e,t){return void 0!==t.meta&&(e[t.id]=t.meta),e}),{})),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=null!==(t=Array.isArray(e.tags)?new Set(e.tags):e.tags)&&void 0!==t?t:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return function(e){return $_([],F_(new Set(fT($_([],F_(e.map((function(e){return e.ownEvents}))),!1)))),!1)}(r.configuration)}})}return e.from=function(t,n){return t instanceof e?t.context!==n?new e({value:t.value,context:n,_event:t._event,_sessionid:null,historyValue:t.historyValue,history:t.history,actions:[],activities:t.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):t:new e({value:t,context:n,_event:WT,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},e.create=function(t){return new e(t)},e.inert=function(t,n){if(t instanceof e){if(!t.actions.length)return t;var r=WT;return new e({value:t.value,context:n,_event:r,_sessionid:null,historyValue:t.historyValue,history:t.history,activities:t.activities,configuration:t.configuration,transitions:[],children:{}})}return e.from(t,n)},e.prototype.toStrings=function(e,t){var n=this;if(void 0===e&&(e=this.value),void 0===t&&(t="."),OT(e))return[e];var r=Object.keys(e);return r.concat.apply(r,$_([],F_(r.map((function(r){return n.toStrings(e[r],t).map((function(e){return r+t+e}))}))),!1))},e.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var t=e.tags;e.machine;var n=L_(e,["configuration","transitions","tags","machine"]);return N_(N_({},n),{tags:Array.from(t)})},e.prototype.matches=function(e){return aT(e,this.value)},e.prototype.hasTag=function(e){return this.tags.has(e)},e.prototype.can=function(e){var t;iT&&ST(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var n=null===(t=this.machine)||void 0===t?void 0:t.getTransitionData(this,e);return!!(null==n?void 0:n.transitions.length)&&n.transitions.some((function(e){return void 0!==e.target||e.actions.length}))},e}(),oC=[],sC=function(e,t){oC.push(e);var n=t(e);return oC.pop(),n};function lC(e){var t;return(t={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:e}}})[TT]=function(){return this},t}function cC(e,t,n){var r=lC(t);if(r.deferred=!0,CT(e)){var i=r.state=sC(void 0,(function(){return(n?e.withContext(n):e).initialState}));r.getSnapshot=function(){return i}}return r}function uC(e){if("string"==typeof e){var t={type:e,toString:function(){return e}};return t}return e}function dC(e){return N_(N_({type:Y_},e),{toJSON:function(){e.onDone,e.onError;var t=L_(e,["onDone","onError"]);return N_(N_({},t),{type:Y_,src:uC(e.src)})}})}var pC="",hC="*",fC={},mC=function(e){return"#"===e[0]},gC=function(){function e(t,n,r,i){void 0===r&&(r="context"in t?t.context:void 0);var a,o=this;this.config=t,this._context=r,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign({actions:{},guards:{},services:{},activities:{},delays:{}},n),this.parent=null==i?void 0:i.parent,this.key=this.config.key||(null==i?void 0:i.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:"."),this.id=this.config.id||$_([this.machine.key],F_(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:null!==(a=this.config.schema)&&void 0!==a?a:{},this.description=this.config.description,iT||ST(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?uT(this.config.states,(function(t,n){var r,i=new e(t,{},void 0,{parent:o,key:n});return Object.assign(o.idMap,N_(((r={})[i.id]=i,r),i.idMap)),i})):fC;var s=0;!function e(t){var n,r;t.order=s++;try{for(var i=M_(MT(t)),a=i.next();!a.done;a=i.next()){e(a.value)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}(this),this.history=!0===this.config.history?"shallow":this.config.history||!1,this._transient=!!this.config.always||!!this.config.on&&(Array.isArray(this.config.on)?this.config.on.some((function(e){return e.event===pC})):pC in this.config.on),this.strict=!!this.config.strict,this.onEntry=gT(this.config.entry||this.config.onEntry).map((function(e){return KT(e)})),this.onExit=gT(this.config.exit||this.config.onExit).map((function(e){return KT(e)})),this.meta=this.config.meta,this.doneData="final"===this.type?this.config.data:void 0,this.invoke=gT(this.config.invoke).map((function(e,t){var n,r;if(CT(e)){var i=IT(o.id,t);return o.machine.options.services=N_(((n={})[i]=e,n),o.machine.options.services),dC({src:i,id:i})}if(OT(e.src)){i=e.id||IT(o.id,t);return dC(N_(N_({},e),{id:i,src:e.src}))}if(CT(e.src)||xT(e.src)){i=e.id||IT(o.id,t);return o.machine.options.services=N_(((r={})[i]=e.src,r),o.machine.options.services),dC(N_(N_({id:i},e),{src:i}))}var a=e.src;return dC(N_(N_({id:IT(o.id,t)},e),{src:a}))})),this.activities=gT(this.config.activities).concat(this.invoke).map((function(e){return XT(e)})),this.transition=this.transition.bind(this),this.tags=gT(this.config.tags)}return e.prototype._init=function(){this.__cache.transitions||$T(this).forEach((function(e){return e.on}))},e.prototype.withConfig=function(t,n){var r=this.options,i=r.actions,a=r.activities,o=r.guards,s=r.services,l=r.delays;return new e(this.config,{actions:N_(N_({},i),t.actions),activities:N_(N_({},a),t.activities),guards:N_(N_({},o),t.guards),services:N_(N_({},s),t.services),delays:N_(N_({},l),t.delays)},null!=n?n:this.context)},e.prototype.withContext=function(t){return new e(this.config,this.options,t)},Object.defineProperty(e.prototype,"context",{get:function(){return xT(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:uT(this.states,(function(e){return e.definition})),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){return this.definition},Object.defineProperty(e.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce((function(e,t){return e[t.eventType]=e[t.eventType]||[],e[t.eventType].push(t),e}),{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),e.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var t=e===pC,n=this.transitions.filter((function(n){var r=n.eventType===e;return t?r:r||n.eventType===hC}));return this.__cache.candidates[e]=n,n},e.prototype.getDelayedTransitions=function(){var e=this,t=this.config.after;if(!t)return[];var n=function(t,n){var r=function(e,t){var n=t?"#".concat(t):"";return"".concat(j_.After,"(").concat(e,")").concat(n)}(xT(t)?"".concat(e.id,":delay[").concat(n,"]"):t,e.id);return e.onEntry.push(JT(r,{delay:t})),e.onExit.push({type:H_,sendId:r}),r},r=ET(t)?t.map((function(e,t){var r=n(e.delay,t);return N_(N_({},e),{event:r})})):fT(Object.keys(t).map((function(e,r){var i=t[e],a=OT(i)?{target:i}:i,o=isNaN(+e)?e:+e,s=n(o,r);return gT(a).map((function(e){return N_(N_({},e),{event:s,delay:o})}))})));return r.map((function(t){var n=t.delay;return N_(N_({},e.formatTransition(t)),{delay:n})}))},e.prototype.getStateNodes=function(e){var t,n=this;if(!e)return[];var r=e instanceof aC?e.value:lT(e,this.delimiter);if(OT(r)){var i=this.getStateNode(r).initial;return void 0!==i?this.getStateNodes(((t={})[r]=i,t)):[this,this.states[r]]}var a=Object.keys(r),o=[this];return o.push.apply(o,$_([],F_(fT(a.map((function(e){return n.getStateNode(e).getStateNodes(r[e])})))),!1)),o},e.prototype.handles=function(e){var t=oT(e);return this.events.includes(t)},e.prototype.resolveState=function(e){var t=e instanceof aC?e:aC.create(e),n=Array.from(BT([],this.getStateNodes(t.value)));return new aC(N_(N_({},t),{value:this.resolve(t.value),configuration:n,done:HT(n,this),tags:GT(n),machine:this.machine}))},e.prototype.transitionLeafNode=function(e,t,n){var r=this.getStateNode(e).next(t,n);return r&&r.transitions.length?r:this.next(t,n)},e.prototype.transitionCompoundNode=function(e,t,n){var r=Object.keys(e),i=this.getStateNode(r[0])._transition(e[r[0]],t,n);return i&&i.transitions.length?i:this.next(t,n)},e.prototype.transitionParallelNode=function(e,t,n){var r,i,a={};try{for(var o=M_(Object.keys(e)),s=o.next();!s.done;s=o.next()){var l=s.value,c=e[l];if(c){var u=this.getStateNode(l)._transition(c,t,n);u&&(a[l]=u)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}var d=Object.keys(a).map((function(e){return a[e]})),p=fT(d.map((function(e){return e.transitions}))),h=d.some((function(e){return e.transitions.length>0}));if(!h)return this.next(t,n);var f=fT(Object.keys(a).map((function(e){return a[e].configuration})));return{transitions:p,exitSet:fT(d.map((function(e){return e.exitSet}))),configuration:f,source:t,actions:fT(Object.keys(a).map((function(e){return a[e].actions})))}},e.prototype._transition=function(e,t,n){return OT(e)?this.transitionLeafNode(e,t,n):1===Object.keys(e).length?this.transitionCompoundNode(e,t,n):this.transitionParallelNode(e,t,n)},e.prototype.getTransitionData=function(e,t){return this._transition(e.value,e,PT(t))},e.prototype.next=function(e,t){var n,r,i,a=this,o=t.name,s=[],l=[];try{for(var c=M_(this.getCandidates(o)),u=c.next();!u.done;u=c.next()){var d=u.value,p=d.cond,h=d.in,f=e.context,m=!h||(OT(h)&&mC(h)?e.matches(lT(this.getStateNodeById(h).path,this.delimiter)):aT(lT(h,this.delimiter),pT(this.path.slice(0,-2))(e.value))),g=!1;try{g=!p||RT(this.machine,p,f,t,e)}catch(e){throw new Error("Unable to evaluate guard '".concat(p.name||p.type,"' in transition for event '").concat(o,"' in state node '").concat(this.id,"':\n").concat(e.message))}if(g&&m){void 0!==d.target&&(l=d.target),s.push.apply(s,$_([],F_(d.actions),!1)),i=d;break}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}if(i){if(!l.length)return{transitions:[i],exitSet:[],configuration:e.value?[this]:[],source:e,actions:s};var y=fT(l.map((function(t){return a.getRelativeStateNodes(t,e.historyValue)})));return{transitions:[i],exitSet:!!i.internal?[]:fT(l.map((function(e){return a.getPotentiallyReenteringNodes(e)}))),configuration:y,source:e,actions:s}}},e.prototype.getPotentiallyReenteringNodes=function(e){if(this.order<e.order)return[this];for(var t=[],n=this,r=e;n&&n!==r;)t.push(n),n=n.parent;return n!==r?[]:(t.push(r),t)},e.prototype.getActions=function(e,t,n,r,i,a,o){var s,l,c,u,d=this,p=a?BT([],this.getStateNodes(a.value)):[],h=new Set;try{for(var f=M_(Array.from(e).sort((function(e,t){return e.order-t.order}))),m=f.next();!m.done;m=f.next()){(!qT(p,b=m.value)||qT(n.exitSet,b)||b.parent&&h.has(b.parent))&&h.add(b)}}catch(e){s={error:e}}finally{try{m&&!m.done&&(l=f.return)&&l.call(f)}finally{if(s)throw s.error}}try{for(var g=M_(p),y=g.next();!y.done;y=g.next()){var b;qT(e,b=y.value)&&!qT(n.exitSet,b.parent)||n.exitSet.push(b)}}catch(e){c={error:e}}finally{try{y&&!y.done&&(u=g.return)&&u.call(g)}finally{if(c)throw c.error}}n.exitSet.sort((function(e,t){return t.order-e.order}));var v=Array.from(h).sort((function(e,t){return e.order-t.order})),w=new Set(n.exitSet),S=fT(v.map((function(e){var t=[];if("final"!==e.type)return t;var a=e.parent;if(!a.parent)return t;t.push(ZT(e.id,e.doneData),ZT(a.id,e.doneData?yT(e.doneData,r,i):void 0));var o=a.parent;return"parallel"===o.type&&FT(o).every((function(e){return HT(n.configuration,e)}))&&t.push(ZT(o.id)),t}))),E=v.map((function(e){var t=e.onEntry,n=e.activities.map((function(e){return function(e){var t=XT(e);return{type:j_.Start,activity:t,exec:void 0}}(e)}));return{type:"entry",actions:YT(o?$_($_([],F_(t),!1),F_(n),!1):$_($_([],F_(n),!1),F_(t),!1),d.machine.options.actions)}})).concat({type:"state_done",actions:S.map((function(e){return function(e,t){return{type:z_,event:"function"==typeof e?e:kT(e),delay:t?t.delay:void 0,id:null==t?void 0:t.id}}(e)}))}),x=Array.from(w).map((function(e){return{type:"exit",actions:YT($_($_([],F_(e.onExit),!1),F_(e.activities.map((function(e){return function(e){var t=xT(e)?e:XT(e);return{type:j_.Stop,activity:t,exec:void 0}}(e)}))),!1),d.machine.options.actions)}})).concat({type:"transition",actions:YT(n.actions,this.machine.options.actions)}).concat(E);if(t){var O=YT(fT($_([],F_(e),!1).sort((function(e,t){return t.order-e.order})).map((function(e){return e.onExit}))),this.machine.options.actions).filter((function(e){return!NT(e)}));return x.concat({type:"stop",actions:O})}return x},e.prototype.transition=function(e,t,n,r){void 0===e&&(e=this.initialState);var i,a,o=PT(t);if(e instanceof aC)i=void 0===n?e:this.resolveState(aC.from(e,n));else{var s=OT(e)?this.resolve(cT(this.getResolvedPath(e))):this.resolve(e),l=null!=n?n:this.machine.context;i=this.resolveState(aC.from(s,l))}if(!iT&&o.name===hC)throw new Error("An event cannot have the wildcard type ('".concat(hC,"')"));if(this.strict&&!this.events.includes(o.name)&&(a=o.name,!/^(done|error)\./.test(a)))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(o.name,"'"));var c=this._transition(i.value,i,o)||{transitions:[],configuration:[],exitSet:[],source:i,actions:[]},u=BT([],this.getStateNodes(i.value)),d=c.configuration.length?BT(u,c.configuration):u;return c.configuration=$_([],F_(d),!1),this.resolveTransition(c,i,i.context,r,o)},e.prototype.resolveRaisedTransition=function(e,t,n,r){var i,a=e.actions;return(e=this.transition(e,t,void 0,r))._event=n,e.event=n.data,(i=e.actions).unshift.apply(i,$_([],F_(a),!1)),e},e.prototype.resolveTransition=function(e,t,n,r,i){var a,o,s,l,c=this;void 0===i&&(i=WT);var u=e.configuration,d=!t||e.transitions.length>0,p=d?e.configuration:t?t.configuration:[],h=HT(p,this),f=d?zT(this.machine,u):void 0,m=t?t.historyValue?t.historyValue:e.source?this.machine.historyValue(t.value):void 0:void 0,g=this.getActions(new Set(p),h,e,n,i,t,r),y=t?N_({},t.activities):{};try{for(var b=M_(g),v=b.next();!v.done;v=b.next()){var w=v.value;try{for(var S=(s=void 0,M_(w.actions)),E=S.next();!E.done;E=S.next()){var x=E.value;x.type===V_?y[x.activity.id||x.activity.type]=x:x.type===U_&&(y[x.activity.id||x.activity.type]=!1)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(l=S.return)&&l.call(S)}finally{if(s)throw s.error}}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(o=b.return)&&o.call(b)}finally{if(a)throw a.error}}var O,_,T=F_(nC(this,t,n,i,g,r,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),C=T[0],k=T[1],P=F_(function(e,t){var n,r,i=F_([[],[]],2),a=i[0],o=i[1];try{for(var s=M_(e),l=s.next();!l.done;l=s.next()){var c=l.value;t(c)?a.push(c):o.push(c)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return[a,o]}(C,NT),2),A=P[0],R=P[1],D=C.filter((function(e){var t;return e.type===V_&&(null===(t=e.activity)||void 0===t?void 0:t.type)===Y_})),j=D.reduce((function(e,t){return e[t.activity.id]=function(e,t,n,r){var i,a=DT(e.src),o=null===(i=null==t?void 0:t.options.services)||void 0===i?void 0:i[a.type],s=e.data?yT(e.data,n,r):void 0,l=o?cC(o,e.id,s):lC(e.id);return l.meta=e,l}(t.activity,c.machine,k,i),e}),t?N_({},t.children):{}),I=new aC({value:f||t.value,context:k,_event:i,_sessionid:t?t._sessionid:null,historyValue:f?m?(O=m,_=f,{current:_,states:vT(O,_)}):void 0:t?t.historyValue:void 0,history:!f||e.source?t:void 0,actions:f?R:[],activities:f?y:t?t.activities:{},events:[],configuration:p,transitions:e.transitions,children:j,done:h,tags:GT(p),machine:this}),N=n!==k;I.changed=i.name===Z_||N;var L=I.history;L&&delete L.history;var M=!h&&(this._transient||u.some((function(e){return e._transient})));if(!(d||M&&i.name!==pC))return I;var F=I;if(!h)for(M&&(F=this.resolveRaisedTransition(F,{type:G_},i,r));A.length;){var $=A.shift();F=this.resolveRaisedTransition(F,$._event,i,r)}var B=F.changed||(L?!!F.actions.length||N||typeof L.value!=typeof F.value||!rC(F.value,L.value):void 0);return F.changed=B,F.history=L,F},e.prototype.getStateNode=function(e){if(mC(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var t=this.states[e];if(!t)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return t},e.prototype.getStateNodeById=function(e){var t=mC(e)?e.slice(1):e;if(t===this.id)return this;var n=this.machine.idMap[t];if(!n)throw new Error("Child state node '#".concat(t,"' does not exist on machine '").concat(this.id,"'"));return n},e.prototype.getStateNodeByPath=function(e){if("string"==typeof e&&mC(e))try{return this.getStateNodeById(e.slice(1))}catch(e){}for(var t=sT(e,this.delimiter).slice(),n=this;t.length;){var r=t.shift();if(!r.length)break;n=n.getStateNode(r)}return n},e.prototype.resolve=function(e){var t,n=this;if(!e)return this.initialStateValue||fC;switch(this.type){case"parallel":return uT(this.initialStateValue,(function(t,r){return t?n.getStateNode(r).resolve(e[r]||t):fC}));case"compound":if(OT(e)){var r=this.getStateNode(e);return"parallel"===r.type||"compound"===r.type?((t={})[e]=r.initialStateValue,t):e}return Object.keys(e).length?uT(e,(function(e,t){return e?n.getStateNode(t).resolve(e):fC})):this.initialStateValue||{};default:return e||fC}},e.prototype.getResolvedPath=function(e){if(mC(e)){var t=this.machine.idMap[e.slice(1)];if(!t)throw new Error("Unable to find state node '".concat(e,"'"));return t.path}return sT(e,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var e,t;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;if("parallel"===this.type)t=dT(this.states,(function(e){return e.initialStateValue||fC}),(function(e){return!("history"===e.type)}));else if(void 0!==this.initial){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));t=LT(this.states[this.initial])?this.initial:((e={})[this.initial]=this.states[this.initial].initialStateValue,e)}else t={};return this.__cache.initialStateValue=t,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(e,t){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,null!=t?t:this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var e;if("history"===this.type){var t=this.config;e=OT(t.target)&&mC(t.target)?cT(this.machine.getStateNodeById(t.target).path.slice(this.path.length-1)):t.target}return e},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(e,t,n){return void 0===n&&(n=!0),n?"history"===e.type?e.resolveHistory(t):e.initialStateNodes:[e]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var e=this;return LT(this)?[this]:"compound"!==this.type||this.initial?fT(hT(this.initialStateValue).map((function(t){return e.getFromRelativePath(t)}))):(iT||ST(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this])},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var t=F_(e),n=t[0],r=t.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var i=this.getStateNode(n);if("history"===i.type)return i.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(r)},e.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:dT(this.states,(function(t,n){if(!e)return t.historyValue();var r=OT(e)?void 0:e[n];return t.historyValue(r||t.initialStateValue)}),(function(e){return!e.history}))}},e.prototype.resolveHistory=function(e){var t=this;if("history"!==this.type)return[this];var n=this.parent;if(!e){var r=this.target;return r?fT(hT(r).map((function(e){return n.getFromRelativePath(e)}))):n.initialStateNodes}var i,a,o=(i=n.path,a="states",function(e){var t,n,r=e;try{for(var o=M_(i),s=o.next();!s.done;s=o.next()){var l=s.value;r=r[a][l]}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r})(e).current;return OT(o)?[n.getStateNode(o)]:fT(hT(o).map((function(e){return"deep"===t.history?n.getFromRelativePath(e):[n.states[e[0]]]})))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var e=this,t=fT(Object.keys(this.states).map((function(t){return e.states[t].stateIds})));return[this.id].concat(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var e,t,n,r;if(this.__cache.events)return this.__cache.events;var i=this.states,a=new Set(this.ownEvents);if(i)try{for(var o=M_(Object.keys(i)),s=o.next();!s.done;s=o.next()){var l=i[s.value];if(l.states)try{for(var c=(n=void 0,M_(l.events)),u=c.next();!u.done;u=c.next()){var d=u.value;a.add("".concat(d))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(a)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter((function(e){return!(!e.target&&!e.actions.length&&e.internal)})).map((function(e){return e.eventType})));return Array.from(e)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(e){var t=this;if(void 0!==e)return e.map((function(e){if(!OT(e))return e;var n=e[0]===t.delimiter;if(n&&!t.parent)return t.getStateNodeByPath(e.slice(1));var r=n?t.key+e:e;if(!t.parent)return t.getStateNodeByPath(r);try{return t.parent.getStateNodeByPath(r)}catch(e){throw new Error("Invalid transition definition for state node '".concat(t.id,"':\n").concat(e.message))}}))},e.prototype.formatTransition=function(e){var t=this,n=function(e){if(void 0!==e&&""!==e)return gT(e)}(e.target),r="internal"in e?e.internal:!n||n.some((function(e){return OT(e)&&e[0]===t.delimiter})),i=this.machine.options.guards,a=this.resolveTarget(n),o=N_(N_({},e),{actions:YT(gT(e.actions)),cond:_T(e.cond,i),target:a,source:this,internal:r,eventType:e.event,toJSON:function(){return N_(N_({},o),{target:o.target?o.target.map((function(e){return"#".concat(e.id)})):void 0,source:"#".concat(t.id)})}});return o},e.prototype.formatTransitions=function(){var e,t,n,r=this;if(this.config.on)if(Array.isArray(this.config.on))n=this.config.on;else{var i=this.config.on,a=hC,o=i[a],s=void 0===o?[]:o,l=L_(i,["*"]);n=fT(Object.keys(l).map((function(e){iT||e!==pC||ST(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(r.id,'".'));var t=AT(e,l[e]);return iT||function(e,t,n){var r=n.slice(0,-1).some((function(e){return!("cond"in e)&&!("in"in e)&&(OT(e.target)||CT(e.target))})),i=t===pC?"the transient event":"event '".concat(t,"'");ST(!r,"One or more transitions for ".concat(i," on state '").concat(e.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")}(r,e,t),t})).concat(AT(hC,s)))}else n=[];var c=this.config.always?AT("",this.config.always):[],u=this.config.onDone?AT(String(ZT(this.id)),this.config.onDone):[];iT||ST(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var d=fT(this.invoke.map((function(e){var t=[];return e.onDone&&t.push.apply(t,$_([],F_(AT(String(eC(e.id)),e.onDone)),!1)),e.onError&&t.push.apply(t,$_([],F_(AT(String(tC(e.id)),e.onError)),!1)),t}))),p=this.after,h=fT($_($_($_($_([],F_(u),!1),F_(d),!1),F_(n),!1),F_(c),!1).map((function(e){return gT(e).map((function(e){return r.formatTransition(e)}))})));try{for(var f=M_(p),m=f.next();!m.done;m=f.next()){var g=m.value;h.push(g)}}catch(t){e={error:t}}finally{try{m&&!m.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}return h},e}(),yC=!1;var bC={deferEvents:!1},vC=function(){function e(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=N_(N_({},bC),e)}return e.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents)return void this.schedule(e);this.process(e)}this.flushEvents()},e.prototype.schedule=function(e){if(this.initialized&&!this.processingEvent){if(0!==this.queue.length)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()}else this.queue.push(e)},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},e.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(e){throw this.clear(),e}finally{this.processingEvent=!1}},e}(),wC=new Map,SC=0,EC=function(){return"x:".concat(SC++)},xC=function(e,t){return wC.set(e,t),e},OC=function(e){return wC.get(e)},_C=function(e){wC.delete(e)};function TC(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==__webpack_require__.g?__webpack_require__.g:void(iT||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues"))}function CC(e){if(TC()){var t=function(){var e=TC();if(e&&"__xstate__"in e)return e.__xstate__}();t&&t.register(e)}}function kC(e,t){void 0===t&&(t={});var n=e.initialState,r=new Set,i=[],a=!1,o=function(e){var t;return N_(((t={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}})[TT]=function(){return this},t),e)}({id:t.id,send:function(t){i.push(t),function(){if(!a){for(a=!0;i.length>0;){var t=i.shift();n=e.transition(n,t,s),r.forEach((function(e){return e.next(n)}))}a=!1}}()},getSnapshot:function(){return n},subscribe:function(e,t,i){var a=jT(e,t,i);return r.add(a),a.next(n),{unsubscribe:function(){r.delete(a)}}}}),s={parent:t.parent,self:o,id:t.id||"anonymous",observers:r};return n=e.start?e.start(s):n,o}var PC,AC={sync:!1,autoForward:!1};!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(PC||(PC={}));var RC=function(){function e(t,n){void 0===n&&(n=e.defaultOptions);var r=this;this.machine=t,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=PC.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(e,t){if(ET(e))return r.batch(e),r.state;var n=PT(kT(e,t));if(r.status===PC.Stopped)return iT||ST(!1,'Event "'.concat(n.name,'" was sent to stopped service "').concat(r.machine.id,'". This service has already reached its final state, and will not transition.\nEvent: ').concat(JSON.stringify(n.data))),r.state;if(r.status!==PC.Running&&!r.options.deferEvents)throw new Error('Event "'.concat(n.name,'" was sent to uninitialized service "').concat(r.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.\nEvent: ').concat(JSON.stringify(n.data)));return r.scheduler.schedule((function(){r.forward(n);var e=r._nextState(n);r.update(e,n)})),r._state},this.sendTo=function(e,t,n){var i=r.parent&&(t===I_.Parent||r.parent.id===t),a=i?r.parent:OT(t)?t===I_.Internal?r:r.children.get(t)||OC(t):function(e){return!!e&&"function"==typeof e.send}(t)?t:void 0;if(a)if("machine"in a){if(r.status!==PC.Stopped||r.parent!==a||r.state.done){var o=N_(N_({},e),{name:e.name===J_?"".concat(tC(r.id)):e.name,origin:r.sessionId});!n&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([a,o]):a.send(o)}}else!n&&r.machine.config.predictableActionArguments?r._outgoingQueue.push([a,e.data]):a.send(e.data);else{if(!i)throw new Error("Unable to send event to child '".concat(t,"' from service '").concat(r.id,"'."));iT||ST(!1,"Service '".concat(r.id,"' has no parent: unable to send event ").concat(e.type))}},this._exec=function(e,t,n,i){void 0===i&&(i=r.machine.options.actions);var a=e.exec||QT(e.type,i),o=xT(a)?a:a?a.exec:e.exec;if(o)try{return o(t,n.data,r.machine.config.predictableActionArguments?{action:e,_event:n}:{action:e,state:r.state,_event:n})}catch(e){throw r.parent&&r.parent.send({type:"xstate.error",data:e}),e}switch(e.type){case z_:var s=e;r.defer(s);break;case q_:var l=e;if("number"==typeof l.delay)return void r.defer(l);l.to?r.sendTo(l._event,l.to,n===WT):r.send(l._event);break;case H_:r.cancel(e.sendId);break;case V_:if(r.status!==PC.Running)return;var c=e.activity;if(!r.machine.config.predictableActionArguments&&!r.state.activities[c.id||c.type])break;if(c.type===j_.Invoke){var u=DT(c.src),d=r.machine.options.services?r.machine.options.services[u.type]:void 0,p=c.id,h=c.data;iT||ST(!("forward"in c),"`forward` property is deprecated (found in invocation of '".concat(c.src,"' in in machine '").concat(r.machine.id,"'). ")+"Please use `autoForward` instead.");var f="autoForward"in c?c.autoForward:!!c.forward;if(!d)return void(iT||ST(!1,"No service found for invocation '".concat(c.src,"' in machine '").concat(r.machine.id,"'.")));var m=h?yT(h,t,n):void 0;if("string"==typeof d)return;var g=xT(d)?d(t,n.data,{data:m,src:u,meta:c.meta}):d;if(!g)return;var y=void 0;CT(g)&&(g=m?g.withContext(m):g,y={autoForward:f}),r.spawn(g,p,y)}else r.spawnActivity(c);break;case U_:r.stopChild(e.activity.id);break;case Q_:var b=e,v=b.label,w=b.value;v?r.logger(v,w):r.logger(w);break;default:iT||ST(!1,"No implementation found for action type '".concat(e.type,"'"))}};var i=N_(N_({},e.defaultOptions),n),a=i.clock,o=i.logger,s=i.parent,l=i.id,c=void 0!==l?l:t.id;this.id=c,this.logger=o,this.clock=a,this.parent=s,this.options=i,this.scheduler=new vC({deferEvents:this.options.deferEvents}),this.sessionId=EC()}return Object.defineProperty(e.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:sC(this,(function(){return e._initialState=e.machine.initialState,e._initialState}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return iT||ST(this.status!==PC.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),e.prototype.execute=function(e,t){var n,r;try{for(var i=M_(e.actions),a=i.next();!a.done;a=i.next()){var o=a.value;this.exec(o,e,t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e.prototype.update=function(e,t){var n,r,i,a,o,s,l,c,u=this;if(e._sessionid=this.sessionId,this._state=e,this.machine.config.predictableActionArguments&&t!==WT||!this.options.execute)for(var d=void 0;d=this._outgoingQueue.shift();)d[0].send(d[1]);else this.execute(this.state);if(this.children.forEach((function(e){u.state.children[e.id]=e})),this.devTools&&this.devTools.send(t.data,e),e.event)try{for(var p=M_(this.eventListeners),h=p.next();!h.done;h=p.next()){(0,h.value)(e.event)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}try{for(var f=M_(this.listeners),m=f.next();!m.done;m=f.next()){(0,m.value)(e,e.event)}}catch(e){i={error:e}}finally{try{m&&!m.done&&(a=f.return)&&a.call(f)}finally{if(i)throw i.error}}try{for(var g=M_(this.contextListeners),y=g.next();!y.done;y=g.next()){(0,y.value)(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(e){o={error:e}}finally{try{y&&!y.done&&(s=g.return)&&s.call(g)}finally{if(o)throw o.error}}if(this.state.done){var b=e.configuration.find((function(e){return"final"===e.type&&e.parent===u.machine})),v=b&&b.doneData?yT(b.doneData,e.context,t):void 0;this._doneEvent=eC(this.id,v);try{for(var w=M_(this.doneListeners),S=w.next();!S.done;S=w.next()){(0,S.value)(this._doneEvent)}}catch(e){l={error:e}}finally{try{S&&!S.done&&(c=w.return)&&c.call(w)}finally{if(l)throw l.error}}this._stop(),this._stopChildren(),_C(this.sessionId)}},e.prototype.onTransition=function(e){return this.listeners.add(e),this.status===PC.Running&&e(this.state,this.state.event),this},e.prototype.subscribe=function(e,t,n){var r=this,i=jT(e,t,n);this.listeners.add(i.next),this.status!==PC.NotStarted&&i.next(this.state);var a=function(){r.doneListeners.delete(a),r.stopListeners.delete(a),i.complete()};return this.status===PC.Stopped?i.complete():(this.onDone(a),this.onStop(a)),{unsubscribe:function(){r.listeners.delete(i.next),r.doneListeners.delete(a),r.stopListeners.delete(a)}}},e.prototype.onEvent=function(e){return this.eventListeners.add(e),this},e.prototype.onSend=function(e){return this.sendListeners.add(e),this},e.prototype.onChange=function(e){return this.contextListeners.add(e),this},e.prototype.onStop=function(e){return this.stopListeners.add(e),this},e.prototype.onDone=function(e){return this.status===PC.Stopped&&this._doneEvent?e(this._doneEvent):this.doneListeners.add(e),this},e.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},e.prototype.start=function(e){var t=this;if(this.status===PC.Running)return this;this.machine._init(),xC(this.sessionId,this),this.initialized=!0,this.status=PC.Running;var n=void 0===e?this.initialState:sC(this,(function(){return iC(e)?t.machine.resolveState(e):t.machine.resolveState(aC.from(e,t.machine.context))}));return this.options.devTools&&this.attachDev(),this.scheduler.initialize((function(){t.update(n,WT)})),this},e.prototype._stopChildren=function(){this.children.forEach((function(e){xT(e.stop)&&e.stop()})),this.children.clear()},e.prototype._stop=function(){var e,t,n,r,i,a,o,s,l,c;try{for(var u=M_(this.listeners),d=u.next();!d.done;d=u.next()){var p=d.value;this.listeners.delete(p)}}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}try{for(var h=M_(this.stopListeners),f=h.next();!f.done;f=h.next()){(p=f.value)(),this.stopListeners.delete(p)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}try{for(var m=M_(this.contextListeners),g=m.next();!g.done;g=m.next()){p=g.value;this.contextListeners.delete(p)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=m.return)&&a.call(m)}finally{if(i)throw i.error}}try{for(var y=M_(this.doneListeners),b=y.next();!b.done;b=y.next()){p=b.value;this.doneListeners.delete(p)}}catch(e){o={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(o)throw o.error}}if(!this.initialized)return this;this.initialized=!1,this.status=PC.Stopped,this._initialState=void 0;try{for(var v=M_(Object.keys(this.delayedEventsMap)),w=v.next();!w.done;w=v.next()){var S=w.value;this.clock.clearTimeout(this.delayedEventsMap[S])}}catch(e){l={error:e}}finally{try{w&&!w.done&&(c=v.return)&&c.call(v)}finally{if(l)throw l.error}}this.scheduler.clear(),this.scheduler=new vC({deferEvents:this.options.deferEvents})},e.prototype.stop=function(){var e=this,t=this.scheduler;return this._stop(),t.schedule((function(){var t;if(!(null===(t=e._state)||void 0===t?void 0:t.done)){var n=PT({type:"xstate.stop"}),r=sC(e,(function(){var t=fT($_([],F_(e.state.configuration),!1).sort((function(e,t){return t.order-e.order})).map((function(t){return YT(t.onExit,e.machine.options.actions)}))),r=F_(nC(e.machine,e.state,e.state.context,n,[{type:"exit",actions:t}],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),i=r[0],a=r[1],o=new aC({value:e.state.value,context:a,_event:n,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:i.filter((function(e){return!NT(e)})),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return o.changed=!0,o}));e.update(r,n),e._stopChildren(),_C(e.sessionId)}})),this},e.prototype.batch=function(e){var t=this;if(this.status===PC.NotStarted&&this.options.deferEvents)iT||ST(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'" and are deferred. Make sure .start() is called for this service.\nEvent: ').concat(JSON.stringify(event)));else if(this.status!==PC.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(e.length){var n=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule((function(){var r,i,a=t.state,o=!1,s=[],l=function(e){var r=PT(e);t.forward(r),a=sC(t,(function(){return t.machine.transition(a,r,void 0,n||void 0)})),s.push.apply(s,$_([],F_(t.machine.config.predictableActionArguments?a.actions:a.actions.map((function(e){return function(e,t){var n=e.exec;return N_(N_({},e),{exec:void 0!==n?function(){return n(t.context,t.event,{action:e,state:t,_event:t._event})}:void 0})}(e,a)}))),!1)),o=o||!!a.changed};try{for(var c=M_(e),u=c.next();!u.done;u=c.next()){l(u.value)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}a.changed=o,a.actions=s,t.update(a,PT(e[e.length-1]))}))}},e.prototype.sender=function(e){return this.send.bind(this,e)},e.prototype._nextState=function(e,t){var n=this;void 0===t&&(t=!!this.machine.config.predictableActionArguments&&this._exec);var r=PT(e);if(0===r.name.indexOf(X_)&&!this.state.nextEvents.some((function(e){return 0===e.indexOf(X_)})))throw r.data.data;return sC(this,(function(){return n.machine.transition(n.state,r,void 0,t||void 0)}))},e.prototype.nextState=function(e){return this._nextState(e,!1)},e.prototype.forward=function(e){var t,n;try{for(var r=M_(this.forwardTo),i=r.next();!i.done;i=r.next()){var a=i.value,o=this.children.get(a);if(!o)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(a,"'."));o.send(e)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},e.prototype.defer=function(e){var t=this,n=this.clock.setTimeout((function(){"to"in e&&e.to?t.sendTo(e._event,e.to,!0):t.send(e._event)}),e.delay);e.id&&(this.delayedEventsMap[e.id]=n)},e.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},e.prototype.exec=function(e,t,n){void 0===n&&(n=this.machine.options.actions),this._exec(e,t.context,t._event,n)},e.prototype.removeChild=function(e){var t;this.children.delete(e),this.forwardTo.delete(e),null===(t=this.state)||void 0===t||delete t.children[e]},e.prototype.stopChild=function(e){var t=this.children.get(e);t&&(this.removeChild(e),xT(t.stop)&&t.stop())},e.prototype.spawn=function(e,t,n){if(this.status!==PC.Running)return cC(e,t);if(bT(e))return this.spawnPromise(Promise.resolve(e),t);if(xT(e))return this.spawnCallback(e,t);if(function(e){try{return"function"==typeof e.send}catch(e){return!1}}(r=e)&&"id"in r)return this.spawnActor(e,t);if(function(e){try{return"subscribe"in e&&xT(e.subscribe)}catch(e){return!1}}(e))return this.spawnObservable(e,t);if(CT(e))return this.spawnMachine(e,N_(N_({},n),{id:t}));if(function(e){return null!==e&&"object"==typeof e&&"transition"in e&&"function"==typeof e.transition}(e))return this.spawnBehavior(e,t);throw new Error('Unable to spawn entity "'.concat(t,'" of type "').concat(typeof e,'".'));var r},e.prototype.spawnMachine=function(t,n){var r=this;void 0===n&&(n={});var i=new e(t,N_(N_({},this.options),{parent:this,id:n.id||t.id})),a=N_(N_({},AC),n);a.sync&&i.onTransition((function(e){r.send(Z_,{state:e,id:i.id})}));var o=i;return this.children.set(i.id,o),a.autoForward&&this.forwardTo.add(i.id),i.onDone((function(e){r.removeChild(i.id),r.send(PT(e,{origin:i.id}))})).start(),o},e.prototype.spawnBehavior=function(e,t){var n=kC(e,{id:t,parent:this});return this.children.set(t,n),n},e.prototype.spawnPromise=function(e,t){var n,r,i=this,a=!1;e.then((function(e){a||(r=e,i.removeChild(t),i.send(PT(eC(t,e),{origin:t})))}),(function(e){if(!a){i.removeChild(t);var n=tC(t,e);try{i.send(PT(n,{origin:t}))}catch(r){!function(e,t,n){if(!iT){var r=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";if(e===t)console.error("Missing onError handler for invocation '".concat(n,"', error was '").concat(e,"'.").concat(r));else{var i=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(n,"'. ")+"Original error: '".concat(e,"'. ").concat(r," Current error is '").concat(t,"'.").concat(i))}}}(e,r,t),i.devTools&&i.devTools.send(n,i.state),i.machine.strict&&i.stop()}}}));var o=(n={id:t,send:function(){},subscribe:function(t,n,r){var i=jT(t,n,r),a=!1;return e.then((function(e){a||(i.next(e),a||i.complete())}),(function(e){a||i.error(e)})),{unsubscribe:function(){return a=!0}}},stop:function(){a=!0},toJSON:function(){return{id:t}},getSnapshot:function(){return r}},n[TT]=function(){return this},n);return this.children.set(t,o),o},e.prototype.spawnCallback=function(e,t){var n,r,i,a=this,o=!1,s=new Set,l=new Set;try{i=e((function(e){r=e,l.forEach((function(t){return t(e)})),o||a.send(PT(e,{origin:t}))}),(function(e){s.add(e)}))}catch(e){this.send(tC(t,e))}if(bT(i))return this.spawnPromise(i,t);var c=((n={id:t,send:function(e){return s.forEach((function(t){return t(e)}))},subscribe:function(e){var t=jT(e);return l.add(t.next),{unsubscribe:function(){l.delete(t.next)}}},stop:function(){o=!0,xT(i)&&i()},toJSON:function(){return{id:t}},getSnapshot:function(){return r}})[TT]=function(){return this},n);return this.children.set(t,c),c},e.prototype.spawnObservable=function(e,t){var n,r,i=this,a=e.subscribe((function(e){r=e,i.send(PT(e,{origin:t}))}),(function(e){i.removeChild(t),i.send(PT(tC(t,e),{origin:t}))}),(function(){i.removeChild(t),i.send(PT(eC(t),{origin:t}))})),o=(n={id:t,send:function(){},subscribe:function(t,n,r){return e.subscribe(t,n,r)},stop:function(){return a.unsubscribe()},getSnapshot:function(){return r},toJSON:function(){return{id:t}}},n[TT]=function(){return this},n);return this.children.set(t,o),o},e.prototype.spawnActor=function(e,t){return this.children.set(t,e),e},e.prototype.spawnActivity=function(e){var t=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(t){var n=t(this.state.context,e);this.spawnEffect(e.id,n)}else iT||ST(!1,"No implementation found for activity '".concat(e.type,"'"))},e.prototype.spawnEffect=function(e,t){var n;this.children.set(e,((n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:t||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}})[TT]=function(){return this},n))},e.prototype.attachDev=function(){var e=TC();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var t="object"==typeof this.options.devTools?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(N_(N_({name:this.id,autoPause:!0,stateSanitizer:function(e){return{value:e.value,context:e.context,actions:e.actions}}},t),{features:N_({jump:!1,skip:!1},t?t.features:void 0)}),this.machine),this.devTools.init(this.state)}CC(this)}},e.prototype.toJSON=function(){return{id:this.id}},e.prototype[TT]=function(){return this},e.prototype.getSnapshot=function(){return this.status===PC.NotStarted?this.initialState:this._state},e.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,t){return setTimeout(e,t)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},e.interpret=DC,e}();function DC(e,t){return new RC(e,t)}let jC=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t};var IC=function(e){return{type:W_,assignment:e}};class NC extends ca{constructor(e){var t;const{dataSourceUid:n}=e;let{appSubUrl:r="",bootData:i}=a.config;"/"!==(null==r?void 0:r.at(-1))&&(r+="/"),super(`${r}api/datasources/proxy/uid/${n}`,{"content-type":"application/json","X-Grafana-Org-Id":String((null==i||null===(t=i.user)||void 0===t?void 0:t.orgId)||"")}),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"dataSourceUid",void 0),this.dataSourceUid=e.dataSourceUid}}function LC(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function MC(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){LC(a,r,i,o,s,"next",e)}function s(e){LC(a,r,i,o,s,"throw",e)}o(void 0)}))}}class FC extends NC{static queryToMatchers(e){const t=e.indexOf("{");if(t>0){return[`{__profile_type__="${e.substring(0,t)}", ${e.substring(t+1,e.length)}`]}return 0===t?[e]:[`{__profile_type__="${e}"}`]}fetchLabels(e,t,n){var r=this;return MC((function*(){return r._post("/querier.v1.QuerierService/LabelNames",{matchers:FC.queryToMatchers(e),start:t,end:n}).then((e=>e.json()))}))()}fetchLabelValues(e,t,n,r){var i=this;return MC((function*(){return i._post("/querier.v1.QuerierService/LabelValues",{name:e,matchers:FC.queryToMatchers(t),start:n,end:r}).then((e=>e.json()))}))()}_post(e,t){return super.fetch(e,{method:"POST",body:JSON.stringify(t)})}constructor(e){super(e)}}class $C{static buildCacheKey(e){let t="";for(const n of e)t+=String(n);return t}get(e){return this.store.get($C.buildCacheKey(e))}set(e,t){this.store.set($C.buildCacheKey(e),t)}delete(e){this.store.delete($C.buildCacheKey(e))}constructor(){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"store",new Map)}}function BC(e,t){if(!e)throw new Error(t)}function VC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class UC{setApiClient(e){this.apiClient=e}setCacheClient(e){this.cacheClient=e}cancel(e){this.apiClient.abort(e)}constructor(e){VC(this,"apiClient",void 0),VC(this,"cacheClient",void 0),this.apiClient=e.apiClient,this.cacheClient=null==e?void 0:e.cacheClient}}function zC(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function qC(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){zC(a,r,i,o,s,"next",e)}function s(e){zC(a,r,i,o,s,"throw",e)}o(void 0)}))}}class HC extends ua{static queryToMatchers(e){const t=e.indexOf("{");if(t>0){return[`{__profile_type__="${e.substring(0,t)}", ${e.substring(t+1,e.length)}`]}return 0===t?[e]:[`{__profile_type__="${e}"}`]}fetchLabels(e,t,n){var r=this;return qC((function*(){return r._post("/querier.v1.QuerierService/LabelNames",{matchers:HC.queryToMatchers(e),start:t,end:n}).then((e=>e.json()))}))()}fetchLabelValues(e,t,n,r){var i=this;return qC((function*(){return i._post("/querier.v1.QuerierService/LabelValues",{name:e,matchers:HC.queryToMatchers(t),start:n,end:r}).then((e=>e.json()))}))()}_post(e,t){return super.fetch(e,{method:"POST",body:JSON.stringify(t)})}}function GC(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function WC(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){GC(a,r,i,o,s,"next",e)}function s(e){GC(a,r,i,o,s,"throw",e)}o(void 0)}))}}function QC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class KC extends UC{static parseLabelsResponse(e){if(!Array.isArray(e.names))return[];return Array.from(new Set(e.names.filter(KC.isNotMetaLabelOrServiceName))).map((e=>({value:e,label:e})))}static parseLabelValuesResponse(e){if(!Array.isArray(e.names))return[];return e.names.map((e=>({value:e,label:e})))}static assertParams(e,t,n){BC(Boolean(e),'Missing "query" parameter!'),BC(t>0&&n>0&&n>t,"Invalid timerange!")}listLabels({query:e,from:t,to:n}){var r=this;return WC((function*(){KC.assertParams(e,t,n);const i=[r.apiClient.baseUrl,e,t,n],a=r.cacheClient.get(i);if(a){const e=yield a,t=KC.parseLabelsResponse(e);return t.length||r.cacheClient.delete(i),t}const o=r.apiClient.fetchLabels(e,t,n);r.cacheClient.set(i,o);try{const e=yield o;return KC.parseLabelsResponse(e)}catch(e){throw r.cacheClient.delete(i),e}}))()}listLabelValues({label:e,query:t,from:n,to:r}){var i=this;return WC((function*(){KC.assertParams(t,n,r),BC(Boolean(e),"Missing label value!");const a=[i.apiClient.baseUrl,e,t,n,r],o=i.cacheClient.get(a);if(o){const e=yield o,t=KC.parseLabelsResponse(e);return t.length||i.cacheClient.delete(a),t}const s=i.apiClient.fetchLabelValues(e,t,n,r);i.cacheClient.set(a,s);try{const e=yield s;return KC.parseLabelValuesResponse(e)}catch(e){throw i.cacheClient.delete(a),e}}))()}constructor(e){super({apiClient:e.apiClient}),QC(this,"cacheClient",void 0),this.cacheClient=e.cacheClient}}QC(KC,"isNotMetaLabelOrServiceName",(e=>!/^(__.+__|service_name)$/.test(e)));const YC=new KC({apiClient:new HC,cacheClient:new $C});function XC(e,t){const n=e.filter((({type:e})=>e!==P_.partial)),r=t.filter((({type:e})=>e!==P_.partial));return n.length===r.length&&n.every((e=>r.find((({type:t,attribute:n,operator:r,value:i})=>{var a,o;return t===e.type&&n.value===e.attribute.value&&(null==r?void 0:r.value)===(null===(a=e.operator)||void 0===a?void 0:a.value)&&(null==i?void 0:i.value)===(null===(o=e.value)||void 0===o?void 0:o.value)}))))}function JC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ZC={type:P_["attribute-operator"],operator:{value:A_["is-empty"],label:"is empty"},value:{value:A_["is-empty"],label:""}},ek=e=>function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){JC(e,t,n[t])}))}return e}({},e,ZC);function tk(e,t){const n=t.filter((({type:e})=>e!==P_.partial)).map((e=>{const{attribute:t,operator:n,value:r}=e;switch(n.value){case A_.in:return`${t.value}=~"${r.value}"`;case A_["not-in"]:return`${t.value}!~"${r.value}"`;case A_["is-empty"]:return`${t.value}=""`;default:return`${t.value}${n.value}"${r.value}"`}}));var r;const[,i]=null!==(r=e.match(/{.*(service_name="[^"]*").*}/))&&void 0!==r?r:[];return i&&n.unshift(i),e.replace(/{(.*)}$/,`{${n.join(",")}}`)}const nk=e=>e.at(-1)||null,rk=e=>e===A_.in||e===A_["not-in"],ik=e=>(BC(Boolean(e),"The filter is falsy!"),e.type===P_.partial);function ak(e,t){return e!==t&&(t!==A_["is-empty"]&&([A_["=~"],A_["!~"],A_.in,A_["not-in"],A_["is-empty"]].includes(e)||[A_["=~"],A_["!~"],A_.in,A_["not-in"]].includes(t)))}function ok(e,t){BC(void 0!==e.operator,"No operator for the filter under edition!");return ak(e.operator.value,t)}function sk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ck=e=>{const t=e.matchAll(/(\w+)(=|!=|=~|!~)"([^"]*)"/g);return Array.from(t).map((([,e,t,n])=>[e,t,n]))},uk=/.+:[^{]+\{(.+)\}$/,dk=/.*(\^|\$|\*|\+|\{|\}|\?).*/;function pk(e){if(!e)return[];const t=e.match(uk);if(!t)return[];return ck(t[1]).filter((([e])=>"service_name"!==e)).map((([e,t,n])=>{const r={id:jC(10),type:P_["attribute-operator-value"],active:!0,attribute:{value:e,label:e},operator:{value:t,label:t},value:{value:n,label:n}};if(t===A_["="]&&""===n)return ek(r);return[A_["=~"],A_["!~"]].includes(t)&&!dk.test(n)?lk(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){sk(e,t,n[t])}))}return e}({},r),{operator:t===A_["=~"]?{value:A_.in,label:"in"}:{value:A_["not-in"],label:"not in"},value:{value:n,label:n.split("|").map((e=>e.trim())).join(", ")}}):r}))}function hk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const mk=(e,t)=>e.map((e=>e.type!==P_.partial?fk(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){hk(e,t,n[t])}))}return e}({},e),{active:t}):e));function gk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){gk(e,t,n[t])}))}return e}function bk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function vk(e,t){const n=XC(e,pk(t.inputParams.query));return{filters:n?mk(e,!0):e,query:tk(t.query,e),isQueryUpToDate:n}}const wk={cancelAllLoad:()=>{YC.cancel("Discarded by user")},setFilterAttribute:IC(((e,t)=>{const n=[...e.filters,{id:jC(10),type:P_.partial,active:!1,attribute:t.data}];return bk(yk({},e),{filters:n,isQueryUpToDate:XC(n,pk(e.inputParams.query))})})),editFilterAttribute:IC(((e,t)=>{if(null===e.edition)throw new Error("Cannot edit filter attribute without edition data!");const{filterId:n}=e.edition,r=e.filters.map((e=>e.id===n?bk(yk({},e),{attribute:t.data,operator:void 0,value:void 0}):e));return bk(yk({},e),{filters:r,isQueryUpToDate:XC(r,pk(e.inputParams.query)),edition:null})})),setFilterOperator:IC(((e,t)=>{const n=e.filters.map((e=>{if(!ik(e))return e;const n=t.data;return n.value===A_["is-empty"]?ek(e):bk(yk({},e),{operator:n,value:void 0})}));return yk({},e,vk(n,e))})),editFilterOperator:IC(((e,t)=>{if(null===e.edition)throw new Error("Cannot edit filter operator without edition data!");const{filterId:n}=e.edition,r=t.data;let i=null;const a=e.filters.map((t=>{const a=t.operator.value;return t.id!==n||a===r.value?t:r.value===A_["is-empty"]?ek(bk(yk({},t),{active:!1})):(a===A_["is-empty"]&&(t.value={value:"(no value)",label:"(no value)"}),!ik(t)&&ak(a,r.value)&&(i=bk(yk({},e.edition),{part:R_.value})),bk(yk({},t),{operator:r,value:rk(a)&&!rk(r.value)&&t.value?{value:t.value.value.split("|").shift(),label:t.value.label.split(", ").shift()}:t.value,active:!1}))}));return bk(yk({},e,vk(a,e)),{edition:i})})),setFilterValue:IC(((e,t)=>{const n=e.filters.map((e=>ik(e)?bk(yk({},e),{type:P_["attribute-operator-value"],active:!1,value:t.data}):e));return yk({},e,vk(n,e))})),editFilterValue:IC(((e,t)=>{if(null===e.edition)throw new Error("Cannot edit filter value without edition data!");const{filterId:n}=e.edition,r=e.filters.map((e=>e.id===n?bk(yk({},e),{type:P_["attribute-operator-value"],active:!1,value:t.data}):e));return bk(yk({},e,vk(r,e)),{edition:null})})),removeFilter:IC(((e,t)=>{const n=t.data,r=mk(e.filters.filter((({id:e})=>e!==n)),!1);return yk({},e,vk(r,e))})),removeLastFilter:IC((e=>{const{filters:t}=e,n=nk(t);if(!n)return e;if(ik(n)&&n.operator){const r=t.slice(0,t.length-1).concat(bk(yk({},n),{operator:void 0}));return bk(yk({},e),{filters:r,isQueryUpToDate:!0})}const r=t.slice(0,t.length-1).map((e=>bk(yk({},e),{active:!1})));return yk({},e,vk(r,e))})),setEdition:IC({edition:(e,t)=>t.data}),changeInputParams:IC(((e,t)=>(t.data.dataSourceUid&&YC.setApiClient(new FC({dataSourceUid:t.data.dataSourceUid})),{inputParams:t.data,query:t.data.query,filters:pk(t.data.query),isQueryUpToDate:!0}))),activateFilters:IC((e=>yk({},e,vk(e.filters,e))))};function Sk(e){const{edition:t,filters:n}=e;BC(null!==t,'"edition" is null!');const r=n.find((({id:e})=>e===t.filterId));return BC(void 0!==r,"Cannot find the filter under edition!"),r}const Ek={shouldSuggestAttributes:e=>{const t=nk(e.filters);return!t||!ik(t)},shouldSuggestOperators:e=>{var t;return!(null===(t=nk(e.filters))||void 0===t?void 0:t.operator)},shouldSuggestValues:e=>{const t=nk(e.filters);return Boolean((null==t?void 0:t.operator)&&!(null==t?void 0:t.value))},isEditing:e=>null!==e.edition,shouldSuggestValuesAfterOperatorEdition:(e,t)=>!!e.edition&&ok(Sk(e),t.data.value),shouldNotSuggestValuesAfterOperatorEdition:(e,t)=>!!e.edition&&!ok(Sk(e),t.data.value),hasPartialFilter:e=>{const t=nk(e.filters);return Boolean(t&&ik(t))},shouldEditAttribute:(e,t)=>t.data.part===R_.attribute,shouldEditOperator:(e,t)=>t.data.part===R_.operator,shouldEditValue:(e,t)=>t.data.part===R_.value};function xk(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}const Ok=new class{list(){return(e=function*(){return[{value:"=",label:"="},{value:"!=",label:"!="},{value:"is-empty",label:"is empty"},{value:"in",label:"in",description:"Is one of"},{value:"not-in",label:"not in",description:"Is not one of"},{value:"=~",label:"=~",description:"Matches regex"},{value:"!~",label:"!~",description:"Does not match regex"}]},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){xk(a,r,i,o,s,"next",e)}function s(e){xk(a,r,i,o,s,"throw",e)}o(void 0)}))})();var e}},_k=e=>e.startsWith("__");function Tk(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Ck(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Tk(a,r,i,o,s,"next",e)}function s(e){Tk(a,r,i,o,s,"throw",e)}o(void 0)}))}}function kk(e,t){if(e instanceof DOMException&&"AbortError"===e.name)return[];throw Xi.error(e,{info:t}),e}const Pk={fetchLabels:function(){var e=Ck((function*(e){const{from:t,to:n}=e.inputParams;try{const r=yield YC.listLabels({query:e.query,from:t,to:n}),i=[],a=[];return r.forEach((e=>{_k(e.value)?a.push(e):i.push(e)})),[...i,...a]}catch(e){return kk(e,"Error while fetching labels!")}}));return function(t){return e.apply(this,arguments)}}(),fetchOperators:Ck((function*(){try{return yield Ok.list()}catch(e){return kk(e,"Error while fetching operators!")}})),fetchLabelValues:function(){var e=Ck((function*(e){let t,{query:n,edition:r,suggestions:i}=e;try{if(r){const i=e.filters.filter((e=>e.id!==r.filterId||(t=e,!1)));if(!t)throw new Error(`Impossible to edit filter id="${r.filterId}": no filter found!`);n=tk(n,i)}else if(t=nk(e.filters),(null==t?void 0:t.type)!==P_.partial)throw new Error("Impossible to load label values: no partial filter found!");if(i.disabled)return[];const a=t.attribute.value,{from:o,to:s}=e.inputParams;return yield YC.listLabelValues({label:a,query:n,from:o,to:s})}catch(e){return kk(e,"Error while fetching label values!")}}));return function(t){return e.apply(this,arguments)}}()},Ak={always:[{cond:"shouldSuggestOperators",target:"loadOperators"},{cond:"shouldSuggestValues",target:"loadLabelValues"},{target:"idle"}]},Rk={FILTER_ADD:"Filter by label values...",SELECT_LABEL:"Select a label...",SELECT_OPERATOR:"Select an operator...",SELECT_VALUE:"Select a value...",SELECT_VALUES:"Select values...",TYPE_VALUE:"Type a regex...",LOADING:"Loading...",ERROR_LOAD:"An unexpected error occurred while loading! Please try again.",SUGGESTIONS_NONE:"No suggestions available.",SUGGESTIONS_DISABLED:"Suggestions are disabled for this label."},Dk=e=>e===A_["=~"]||e===A_["!~"];function jk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ik(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Nk={entry:["cancelAllLoad",IC({suggestions:e=>{let t=Rk.FILTER_ADD,n=!1;const r=nk(e.filters);return r&&ik(r)&&(r.operator?(n=Dk(r.operator.value),t=rk(r.operator.value)?Rk.SELECT_VALUES:n?Rk.TYPE_VALUE:Rk.SELECT_VALUE):t=Rk.SELECT_OPERATOR),Ik(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){jk(e,t,n[t])}))}return e}({},Zk.suggestions),{placeholder:t,allowCustomValue:n})},edition:null})],on:{START_INPUT:[{cond:"shouldSuggestAttributes",target:"loadLabels"},{cond:"shouldSuggestOperators",target:"loadOperators"},{cond:"shouldSuggestValues",target:"loadLabelValues"}],EDIT_FILTER:[{cond:"shouldEditAttribute",target:"loadLabels",actions:["setEdition"]},{cond:"shouldEditOperator",target:"loadOperators",actions:["setEdition"]},{cond:"shouldEditValue",target:"loadLabelValues",actions:["setEdition"]}],REMOVE_FILTER:[{cond:"hasPartialFilter",target:"autoSuggestProxy",actions:["removeFilter"]},{target:"idle",actions:["removeFilter"]}],REMOVE_LAST_FILTER:{target:"idle",actions:["removeLastFilter"]},CHANGE_INPUT_PARAMS:{target:"idle",actions:["changeInputParams"]},EXECUTE_QUERY:{target:"idle",actions:["activateFilters"]}}};function Lk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Lk(e,t,n[t])}))}return e}function Fk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const $k={entry:IC({suggestions:()=>Fk(Mk({},Zk.suggestions),{isVisible:!0,isLoading:!0})}),invoke:{id:"fetchLabels",src:"fetchLabels",onDone:{target:"displayLabels",actions:IC({suggestions:(e,t)=>Fk(Mk({},e.suggestions),{items:t.data.filter((({value:t})=>!e.filters.some((e=>{var n;return(null===(n=e.attribute)||void 0===n?void 0:n.value)===t})))),isLoading:!1})})},onError:{target:"displayLabels",actions:IC({suggestions:(e,t)=>Fk(Mk({},e.suggestions),{isLoading:!1,error:t.data})})}},on:{DISCARD_SUGGESTIONS:"idle"}},Bk={entry:IC({suggestions:e=>Fk(Mk({},e.suggestions),{type:D_.attribute,isVisible:!0,placeholder:Rk.SELECT_LABEL})}),on:{DISCARD_SUGGESTIONS:"idle",SELECT_SUGGESTION:[{cond:"isEditing",target:"loadOperators",actions:["editFilterAttribute"]},{target:"loadOperators",actions:["setFilterAttribute"]}],REMOVE_LAST_FILTER:{target:"idle",actions:["removeLastFilter"]}}};function Vk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Vk(e,t,n[t])}))}return e}function zk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const qk={entry:IC({suggestions:e=>{const t=e.edition?Sk(e):nk(e.filters);return BC(void 0!==typeof(null==t?void 0:t.operator),"No operator for the target filter!"),zk(Uk({},Zk.suggestions),{disabled:["=~","!~"].includes(t.operator.value)||_k(t.attribute.value),isVisible:!0,isLoading:!0})}}),invoke:{id:"fetchLabelValues",src:"fetchLabelValues",onDone:{target:"displayLabelValues",actions:IC({suggestions:(e,t)=>zk(Uk({},e.suggestions),{items:t.data,isLoading:!1})})},onError:{target:"displayLabelValues",actions:IC({suggestions:(e,t)=>zk(Uk({},e.suggestions),{items:[],isLoading:!1,error:t.data})})}},on:{DISCARD_SUGGESTIONS:"idle"}},Hk={entry:IC({suggestions:e=>{const t=e.edition?Sk(e):nk(e.filters);BC(void 0!==typeof(null==t?void 0:t.operator),"No operator for the target filter!");const n=t.operator.value,r=Dk(n)||e.suggestions.disabled,i=rk(n);let a,o;return a=r?Rk.TYPE_VALUE:i?Rk.SELECT_VALUES:Rk.SELECT_VALUE,o=e.suggestions.error?Rk.ERROR_LOAD:e.suggestions.disabled?Rk.SUGGESTIONS_DISABLED:Rk.SUGGESTIONS_NONE,zk(Uk({},e.suggestions),{type:D_.value,isVisible:!0,placeholder:a,noOptionsMessage:o,allowCustomValue:r,multiple:i})}}),on:{DISCARD_SUGGESTIONS:"idle",SELECT_SUGGESTION:[{cond:"isEditing",target:"autoSuggestProxy",actions:["editFilterValue"]},{target:"idle",actions:["setFilterValue"]}],REMOVE_LAST_FILTER:{target:"loadOperators",actions:["removeLastFilter"]}}};function Gk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Gk(e,t,n[t])}))}return e}function Qk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Kk={entry:IC({suggestions:()=>Qk(Wk({},Zk.suggestions),{isVisible:!0,isLoading:!0})}),invoke:{id:"fetchOperators",src:"fetchOperators",onDone:{target:"displayOperators",actions:IC({suggestions:(e,t)=>Qk(Wk({},e.suggestions),{items:t.data,isLoading:!1})})},onError:{target:"displayOperators",actions:IC({suggestions:(e,t)=>Qk(Wk({},e.suggestions),{items:[],isLoading:!1,error:t.data})})}},on:{DISCARD_SUGGESTIONS:"idle"}},Yk={entry:IC({suggestions:e=>Qk(Wk({},e.suggestions),{type:D_.operator,isVisible:!0,placeholder:Rk.SELECT_OPERATOR,allowCustomValue:!1,multiple:!1})}),on:{DISCARD_SUGGESTIONS:"idle",SELECT_SUGGESTION:[{cond:"shouldSuggestValuesAfterOperatorEdition",target:"loadLabelValues",actions:["editFilterOperator"]},{cond:"shouldNotSuggestValuesAfterOperatorEdition",target:"autoSuggestProxy",actions:["editFilterOperator"]},{cond:"hasPartialFilter",target:"autoSuggestProxy",actions:["setFilterOperator"]},{target:"loadLabelValues",actions:["setFilterOperator"]}],REMOVE_LAST_FILTER:{target:"loadLabels",actions:["removeLastFilter"]}}};function Xk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Zk=Object.freeze({inputParams:{query:"",from:0,to:0},query:"",filters:[],isQueryUpToDate:!0,edition:null,suggestions:{type:null,items:[],isVisible:!1,isLoading:!1,error:null,placeholder:"",noOptionsMessage:"",allowCustomValue:!1,multiple:!1,disabled:!1}}),eP=e=>({id:"query-builder",initial:"idle",context:e,predictableActionArguments:!0,states:{idle:Nk,loadLabels:$k,displayLabels:Bk,loadOperators:Kk,displayOperators:Yk,loadLabelValues:qk,displayLabelValues:Hk,autoSuggestProxy:Ak}}),tP={guards:Ek,services:Pk,actions:wk};function nP(e){const{query:t}=e,n=Jk(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Xk(e,t,n[t])}))}return e}({},Zk),{inputParams:e,query:t,filters:pk(t)}),r=function(e,t){return iT||"predictableActionArguments"in e||yC||(yC=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new gC(e,t)}(eP(n),tP);return{actor:DC(r),initialContext:n}}const rP=new Intl.Collator("en",{sensitivity:"case"}).compare,iP=e=>(t,n)=>{const r=e.some((e=>e.value===t.value)),i=e.some((e=>e.value===n.value));return r&&i?rP(t.value,n.value):i?1:r?-1:0};function aP({selection:e,suggestions:t,onCloseMenu:n}){const r=(0,o.useStyles2)(oP),i=(0,Fi.useMemo)((()=>{const t=e.value.split("|"),n=e.label.split(", ");return t.map(((e,t)=>({value:e,label:n[t]})))}),[e]),[a,s]=(0,Fi.useState)(i),l=(0,Fi.useMemo)((()=>t.items.sort(iP(a))),[t.items]),c=(0,Fi.useCallback)((e=>{s(e.map((({value:e="",label:t=""})=>({value:e,label:t}))))}),[]),u=(0,Fi.useCallback)((()=>{n(a)}),[n,a]);return $i().createElement(o.MultiSelect,{className:r.editionSelect,placeholder:t.placeholder,loadingMessage:Rk.LOADING,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!0,autoFocus:!0,value:a,onChange:c,onCloseMenu:u,options:l,isOpen:!0,isLoading:t.isLoading,invalid:Boolean(t.error),noOptionsMessage:t.noOptionsMessage})}const oP=()=>({editionSelect:i.css`
position: absolute;
z-index: 1;
[aria-label='Remove'] svg {
display: none;
}
`});function sP({placeholder:e,defaultValue:t,onFocus:n,onChange:r,onBlur:a}){const s=(0,o.useStyles2)(lP),l=(0,Fi.useRef)(null),[c,u]=(0,Fi.useState)(!1);return(0,Fi.useEffect)((()=>{l.current&&l.current.focus()}),[]),$i().createElement(o.Input,{ref:l,className:(0,i.cx)(t&&s.edition),invalid:c,placeholder:e,defaultValue:t,onFocus:n,onKeyUp:e=>{const t=e.target.value.trim();"Enter"===e.code&&(t?r({value:t,label:t}):u(!0))},onBlur:e=>{const t=e.target.value.trim();t?r({value:t,label:t}):a()}})}const lP=()=>({edition:i.css`
position: absolute;
z-index: 1;
`}),cP=()=>({editionSelect:i.css`
position: absolute;
z-index: 1;
min-width: 160px;
box-shadow: none;
& input:focus {
outline: none !important;
}
`});function uP({selection:e,suggestions:t,onChange:n,onCloseMenu:r}){const i=(0,o.useStyles2)(cP);return t.allowCustomValue?$i().createElement(sP,{defaultValue:e.value,placeholder:t.placeholder,onChange:n,onBlur:r}):$i().createElement(o.Select,{className:i.editionSelect,placeholder:t.placeholder,loadingMessage:Rk.LOADING,closeMenuOnSelect:!1,autoFocus:!0,value:e.value,onChange:n,onCloseMenu:r,options:t.items,isOpen:!0,isLoading:t.isLoading,invalid:Boolean(t.error),noOptionsMessage:t.noOptionsMessage})}const dP=()=>{},pP=({filter:e,onClick:t,onRemove:n})=>{const r=(0,o.useStyles2)(bP),{attribute:a,operator:s,active:l}=e,c=l?r.chiclet:(0,i.cx)(r.chiclet,r.inactiveChiclet);return $i().createElement("div",{className:c,"aria-label":"Filter"},$i().createElement(o.Tag,{"aria-label":"Filter label",className:r.chicletAttribute,name:a.label,onClick:dP}),$i().createElement(o.Tag,{"aria-label":"Filter operator",className:r.chicletOperator,name:s.label,onClick:(n,r)=>t(r,e,R_.operator),tabIndex:0}),$i().createElement(o.Tag,{"aria-label":"Remove filter",className:r.chicletRemoveButton,icon:"times",name:"",onClick:(t,r)=>n(r,e),tabIndex:0}))},hP=()=>{},fP=({filter:e,onClick:t,onRemove:n})=>{const r=(0,o.useStyles2)(bP),{attribute:a,operator:s,value:l,active:c}=e,u=c?r.chiclet:(0,i.cx)(r.chiclet,r.inactiveChiclet);return $i().createElement("div",{className:u,"aria-label":"Filter"},$i().createElement(o.Tag,{"aria-label":"Filter label",className:r.chicletAttribute,name:a.label,onClick:hP}),$i().createElement(o.Tag,{"aria-label":"Filter operator",className:r.chicletOperator,name:s.label,onClick:(n,r)=>t(r,e,R_.operator),tabIndex:0}),$i().createElement(o.Tooltip,{content:l.label},$i().createElement(o.Tag,{"aria-label":"Filter value",name:l.label,className:r.chicletValue,onClick:(n,r)=>t(r,e,R_.value),tabIndex:0})),$i().createElement(o.Tag,{"aria-label":"Remove filter",className:r.chicletRemoveButton,icon:"times",name:"",onClick:(t,r)=>n(r,e),tabIndex:0}))},mP=({filter:e,onClick:t})=>{const n=(0,o.useStyles2)(bP),{attribute:r,operator:a}=e;return r||a?$i().createElement("div",{className:(0,i.cx)(n.chiclet,n.partialChiclet),"aria-label":"Partial filter"},$i().createElement(o.Tag,{colorIndex:9,name:r.label,title:`Edit "${r.label}"`,onClick:(n,r)=>t(r,e,R_.attribute),tabIndex:0}),a&&$i().createElement(o.Tag,{colorIndex:9,name:a.label,title:`Edit "${a.label}"`,className:n.chicletOperator,onClick:(n,r)=>t(r,e,R_.operator),tabIndex:0})):null},gP="rgb(61, 113, 217)",yP="#4a4b52",bP=e=>({chiclet:i.css`
display: flex;
align-items: center;
border: 1px solid ${gP};
border-radius: 2px;
& > button {
height: 30px;
background-color: ${e.colors.background.primary};
color: ${e.colors.text.maxContrast};
}
& > :first-child {
background-color: ${gP};
color: ${"#fff"};
border-radius: 0;
&:hover {
cursor: not-allowed !important;
}
}
& > :last-child {
border-left: 1px solid ${gP};
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
`,partialChiclet:i.css`
border-color: ${yP};
border-right: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
& > :first-child {
background-color: ${e.colors.background.secondary};
color: ${e.colors.text.maxContrast};
border-radius: 0;
border-left: 0;
&:hover {
cursor: pointer !important;
}
}
& > :last-child {
border-color: ${yP};
color: ${e.colors.text.maxContrast};
}
`,inactiveChiclet:i.css`
border-color: ${yP};
& > button {
color: ${e.colors.text.maxContrast};
}
& > :first-child {
background-color: ${e.colors.background.secondary};
color: ${e.colors.text.maxContrast};
}
& > :last-child {
border-color: ${yP};
}
`,chicletAttribute:i.css`
&:hover {
opacity: 1 !important;
}
`,chicletOperator:i.css`
&:hover {
background-color: ${e.colors.background.secondary};
}
`,chicletValue:i.css`
flex-grow: 1;
text-align: left;
max-width: 420px;
text-overflow: ellipsis;
text-wrap: nowrap;
overflow: hidden;
&:hover {
background-color: ${e.colors.background.secondary};
}
`,chicletRemoveButton:i.css`
&:hover {
background-color: ${e.colors.background.secondary};
}
& svg {
width: 12px;
height: 12px;
}
`}),vP=({filter:e,onClick:t,onRemove:n})=>{switch(e.type){case P_.partial:return $i().createElement(mP,{filter:e,onClick:t});case P_["attribute-operator-value"]:return $i().createElement(fP,{filter:e,onClick:t,onRemove:n});case P_["attribute-operator"]:return $i().createElement(pP,{filter:e,onClick:t,onRemove:n});default:throw new TypeError(`Unsupported filter type "${e.type}" (${JSON.stringify(e)})!`)}},wP=(0,Fi.memo)(vP,((e,t)=>JSON.stringify(e.filter)===JSON.stringify(t.filter))),SP=()=>({chicletsList:i.css`
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 4px;
`,editChicletContainer:i.css`
position: relative;
`});function EP({filters:e,onClickChiclet:t,onRemoveChiclet:n,edition:r,suggestions:i,onChangeSingleSuggestion:a,onCloseSingleSuggestionsMenu:s,onCloseMultipleSuggestionsMenu:l}){const c=(0,o.useStyles2)(SP);return $i().createElement("div",{className:c.chicletsList,"data-testid":"filtersList"},e.map((e=>$i().createElement("div",{key:e.id,className:c.editChicletContainer},$i().createElement(wP,{filter:e,onClick:t,onRemove:n}),(null==r?void 0:r.filterId)===e.id?i.multiple?$i().createElement(aP,{selection:e[r.part],suggestions:i,onCloseMenu:l}):$i().createElement(uP,{key:r.part,selection:e[r.part],suggestions:i,onChange:a,onCloseMenu:s}):null))))}const xP=(0,Fi.memo)(EP),OP=()=>({select:i.css`
border-top-right-radius: 0;
border-bottom-right-radius: 0;
`});function _P({suggestions:e,onFocus:t,onChange:n,onKeyDown:r,onCloseMenu:i}){const a=(0,o.useStyles2)(OP),s=function(e){const[t,n]=(0,Fi.useState)(!1);return(0,Fi.useEffect)((()=>{!e||t?e!==t&&n(e):setTimeout((()=>n(!0)),0)}),[t,e]),t}(e.isVisible);return e.allowCustomValue?$i().createElement(sP,{placeholder:e.placeholder,onFocus:t,onChange:n,onBlur:i}):$i().createElement(o.Select,{className:a.select,placeholder:e.placeholder,loadingMessage:Rk.LOADING,closeMenuOnSelect:!1,value:null,onFocus:t,onKeyDown:r,onChange:n,onCloseMenu:i,options:e.items,isOpen:s,isLoading:e.isLoading,invalid:Boolean(e.error),noOptionsMessage:e.noOptionsMessage})}const TP=()=>{};function CP(){const e=(0,o.useStyles2)(OP);return $i().createElement(o.Select,{disabled:!0,className:e.select,placeholder:Rk.FILTER_ADD,onChange:TP})}function kP({suggestions:e,onFocus:t,onKeyDown:n,onCloseMenu:r}){const i=(0,o.useStyles2)(PP),[a,s]=(0,Fi.useState)([]),l=(0,Fi.useCallback)((e=>{s(e.map((({value:e="",label:t=""})=>({value:e,label:t}))))}),[]),c=(0,Fi.useCallback)((e=>{n(e,a)}),[n,a]),u=(0,Fi.useCallback)((()=>{r(a)}),[r,a]);return $i().createElement(o.MultiSelect,{className:i.select,placeholder:e.placeholder,loadingMessage:Rk.LOADING,closeMenuOnSelect:!1,hideSelectedOptions:!1,backspaceRemovesValue:!0,autoFocus:!0,value:a,onFocus:t,onKeyDown:c,onChange:l,onCloseMenu:u,options:e.items,isOpen:e.isVisible,isLoading:e.isLoading,invalid:Boolean(e.error),noOptionsMessage:e.noOptionsMessage})}const PP=()=>({select:i.css`
[aria-label='Remove'] svg {
display: none;
}
`}),AP=()=>({queryBuilder:i.css`
display: flex;
justify-content: flex-start;
align-items: flex-end;
flex-wrap: wrap;
gap: 4px;
width: 100%;
`,controls:i.css`
display: flex;
align-self: flex-start;
flex-grow: 1;
`,executeButton:i.css`
border-top-left-radius: 0;
border-bottom-left-radius: 0;
`});function RP(e){const t=(0,o.useStyles2)(AP),{actor:n,internalProps:r}=function({dataSourceUid:e,query:t,from:n,to:r,onChangeQuery:i}){const{actor:a,initialContext:o}=(0,Fi.useMemo)((()=>nP({query:t,from:n,to:r})),[]);(0,Fi.useEffect)((()=>{a.send({type:"CHANGE_INPUT_PARAMS",data:{dataSourceUid:e,query:t,from:n,to:r}})}),[a,e,t,n,r]);const[s,l]=(0,Fi.useState)(o);return(0,Fi.useEffect)((()=>(a.start(),a.subscribe((({event:e,context:t})=>{"EXECUTE_QUERY"===e.type&&i(t.query,t.filters),l(t)})),()=>{a.stop()})),[a]),{actor:a,internalProps:s}}(e),{filters:a,edition:s,isQueryUpToDate:l,suggestions:c}=r,{onClickChiclet:u,onRemoveChiclet:d}=function(e){const t=(0,Fi.useCallback)(((t,n,r)=>{e.send({type:"EDIT_FILTER",data:{filterId:n.id,part:r}})}),[e]),n=(0,Fi.useCallback)(((t,n)=>{e.send({type:"REMOVE_FILTER",data:n.id})}),[e]);return{onClickChiclet:t,onRemoveChiclet:n}}(n),{onFocus:p,onChangeSingleSuggestion:h,onSingleSelectKeyDown:f,onCloseSingleMenu:m,onMultipleSelectKeyDown:g,onCloseMultipleMenu:y}=function(e,t,n){const r=(0,Fi.useCallback)((()=>{e.send({type:"START_INPUT"})}),[e]),i=(0,Fi.useCallback)((t=>{const{value:n="",label:r=""}=t;e.send({type:"SELECT_SUGGESTION",data:{value:n,label:r}})}),[e]),a=(0,Fi.useCallback)((t=>{"Backspace"!==t.code||t.target.value||e.send({type:"REMOVE_LAST_FILTER"})}),[e]),o=(0,Fi.useCallback)((()=>{e.send({type:"DISCARD_SUGGESTIONS"})}),[e]),s=(0,Fi.useCallback)(((t,n)=>{"Backspace"!==t.code||t.target.value||n.length||e.send({type:"REMOVE_LAST_FILTER"})}),[e]),l=(0,Fi.useCallback)((t=>{t.length?e.send({type:"SELECT_SUGGESTION",data:{value:t.map((e=>e.value)).join("|"),label:t.map((e=>e.label)).join(", ")}}):e.send({type:"DISCARD_SUGGESTIONS"})}),[e]),c=function(e){const t=(0,Fi.useRef)();return(0,Fi.useEffect)((()=>{t.current=e})),t.current}(t.isVisible);return(0,Fi.useEffect)((()=>{var e;!t.isVisible&&c&&(null===(e=document.querySelector(`#${n} input`))||void 0===e||e.blur())}),[t.isVisible,c,n]),{onFocus:r,onChangeSingleSuggestion:i,onSingleSelectKeyDown:a,onMultipleSelectKeyDown:s,onCloseSingleMenu:o,onCloseMultipleMenu:l}}(n,c,e.id),b=(0,Fi.useCallback)((()=>{n.send({type:"EXECUTE_QUERY"})}),[n]);return(0,Fi.useEffect)((()=>{if(!e.autoExecute)return;const t=({value:e,context:t,event:r})=>{"idle"!==e||t.isQueryUpToDate||"EXECUTE_QUERY"===r.type||n.send({type:"EXECUTE_QUERY"})};return n.onTransition(t),()=>{n.off(t)}}),[n,e.autoExecute]),$i().createElement("div",{id:e.id,className:(0,i.cx)(t.queryBuilder,e.className)},a.length>0?$i().createElement(xP,{filters:a,onClickChiclet:u,onRemoveChiclet:d,edition:s,suggestions:c,onChangeSingleSuggestion:h,onCloseSingleSuggestionsMenu:m,onCloseMultipleSuggestionsMenu:y}):null,$i().createElement("div",{className:t.controls},s?$i().createElement(CP,null):c.multiple?$i().createElement(kP,{suggestions:c,onFocus:p,onKeyDown:g,onCloseMenu:y}):$i().createElement(_P,{suggestions:c,onFocus:p,onChange:h,onKeyDown:f,onCloseMenu:m}),!e.autoExecute&&$i().createElement(o.Button,{onClick:b,tooltip:l?"Nothing to execute, all filters applied":"Execute new query",className:t.executeButton,disabled:l},"Execute")))}const DP=(0,Fi.memo)(RP),jP=JSON.parse('{"block:contentions:count:contentions:count":{"id":"block:contentions:count:contentions:count","description":"Number of blocking contentions","type":"contentions","group":"block","unit":"short"},"block:delay:nanoseconds:contentions:count":{"id":"block:delay:nanoseconds:contentions:count","description":"Time spent in blocking delays","type":"delay","group":"block","unit":"ns"},"goroutine:goroutine:count:goroutine:count":{"id":"goroutine:goroutine:count:goroutine:count","description":"Number of goroutines","type":"goroutine","group":"goroutine","unit":"short"},"goroutines:goroutine:count:goroutine:count":{"id":"goroutines:goroutine:count:goroutine:count","description":"Number of goroutines","type":"goroutine","group":"goroutine","unit":"short"},"memory:alloc_in_new_tlab_bytes:bytes::":{"id":"memory:alloc_in_new_tlab_bytes:bytes::","description":"Size of memory allocated inside Thread-Local Allocation Buffers (TLAB)","type":"alloc_in_new_tlab_bytes","group":"memory","unit":"bytes"},"memory:alloc_in_new_tlab_objects:count::":{"id":"memory:alloc_in_new_tlab_objects:count::","description":"Number of objects allocated inside Thread-Local Allocation Buffers (TLAB)","type":"alloc_in_new_tlab_objects","group":"memory","unit":"short"},"memory:alloc_objects:count:space:bytes":{"id":"memory:alloc_objects:count:space:bytes","description":"Number of objects allocated","type":"alloc_objects","group":"memory","unit":"short"},"memory:alloc_space:bytes:space:bytes":{"id":"memory:alloc_space:bytes:space:bytes","description":"Size of memory allocated in the heap","type":"alloc_space","group":"memory","unit":"bytes"},"memory:inuse_objects:count:space:bytes":{"id":"memory:inuse_objects:count:space:bytes","description":"Number of objects currently in use","type":"inuse_objects","group":"memory","unit":"short"},"memory:inuse_space:bytes:space:bytes":{"id":"memory:inuse_space:bytes:space:bytes","description":"Size of memory currently in use","type":"inuse_space","group":"memory","unit":"bytes"},"mutex:contentions:count:contentions:count":{"id":"mutex:contentions:count:contentions:count","description":"Number of observed mutex contentions","type":"contentions","group":"mutex","unit":"short"},"mutex:delay:nanoseconds:contentions:count":{"id":"mutex:delay:nanoseconds:contentions:count","description":"Time spent waiting due to mutex contentions","type":"delay","group":"mutex","unit":"ns"},"process_cpu:alloc_samples:count:cpu:nanoseconds":{"id":"process_cpu:alloc_samples:count:cpu:nanoseconds","description":"Number of memory allocation samples during CPU time","type":"alloc_samples","group":"memory","unit":"short"},"process_cpu:alloc_size:bytes:cpu:nanoseconds":{"id":"process_cpu:alloc_size:bytes:cpu:nanoseconds","description":"Size of memory allocated during CPU time","type":"alloc_size","group":"alloc_size","unit":"bytes"},"process_cpu:cpu:nanoseconds:cpu:nanoseconds":{"id":"process_cpu:cpu:nanoseconds:cpu:nanoseconds","description":"CPU time consumed","type":"cpu","group":"process_cpu","unit":"ns"},"process_cpu:exception:count:cpu:nanoseconds":{"id":"process_cpu:exception:count:cpu:nanoseconds","description":"Number of exceptions within the sampled CPU time","type":"exceptions","group":"exceptions","unit":"short"},"process_cpu:lock_count:count:cpu:nanoseconds":{"id":"process_cpu:lock_count:count:cpu:nanoseconds","description":"Number of lock acquisitions attempted during CPU time","type":"lock_count","group":"locks","unit":"short"},"process_cpu:lock_time:nanoseconds:cpu:nanoseconds":{"id":"process_cpu:lock_time:nanoseconds:cpu:nanoseconds","description":"Cumulative time spent acquiring locks","type":"lock_time","group":"locks","unit":"ns"},"process_cpu:samples:count::milliseconds":{"id":"process_cpu:samples:count::milliseconds","description":"Number of process samples collected","type":"samples","group":"process_cpu","unit":"short"},"process_cpu:samples:count:cpu:nanoseconds":{"id":"process_cpu:samples:count:cpu:nanoseconds","description":"Number of samples collected over CPU time","type":"samples","group":"process_cpu","unit":"short"}}');function IP(e){if(jP[e])return jP[e];const[t="?",n="?"]=e?e.split(":"):[];return{id:e,description:"",type:n,group:t,unit:"short"}}const NP=Object.freeze({type:"grafana-pyroscope-datasource",uid:"$dataSource"}),LP=Object.freeze({type:"grafana-pyroscope-series-datasource",uid:"grafana-pyroscope-series-datasource"}),MP=Object.freeze({type:"grafana-pyroscope-favorites-datasource",uid:"grafana-pyroscope-favorites-datasource"}),FP=Object.freeze({type:"grafana-pyroscope-labels-datasource",uid:"grafana-pyroscope-labels-datasource"});function $P(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function BP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class VP extends pS{onActivate(){this.state.value||this.setState({value:VP.DEFAULT_VALUE})}update(e=!1){var t,n=this;return(t=function*(){if(!e&&n.state.loading)return;let t=[],r=null;n.setState({loading:!0,options:[],error:null});try{t=yield(0,Hp.lastValueFrom)(n.getValueOptions({}))}catch(e){r=e}finally{n.setState({loading:!1,options:t,error:r})}},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){$P(a,r,i,o,s,"next",e)}function s(e){$P(a,r,i,o,s,"throw",e)}o(void 0)}))})()}static buildCascaderOptions(e){const t=new Map;for(const{value:n}of e){const e=IP(n),{group:r,type:i}=e,a=t.get(r)||{value:r,label:r,items:[]},o=a.items||[];o.push({value:n,label:i}),a.items=o,t.set(r,a)}return Array.from(t.values()).sort(((e,t)=>rP(t.label,e.label)))}constructor(e){super(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){BP(e,t,n[t])}))}return e}({key:"profileMetricId",name:"profileMetricId",label:"Profile type",datasource:LP,query:VP.QUERY_DEFAULT,loading:!0,refresh:r.VariableRefresh.onTimeRangeChanged},e)),BP(this,"onSelect",(e=>{Cs("g_pyroscope_app_profile_metric_selected"),this.state.skipUrlSync||O_(),this.changeValueTo(e)})),this.changeValueTo=this.changeValueTo.bind(this),this.addActivationHandler(this.onActivate.bind(this))}}BP(VP,"DEFAULT_VALUE","process_cpu:cpu:nanoseconds:cpu:nanoseconds"),BP(VP,"QUERY_DEFAULT","$dataSource and all profile metrics"),BP(VP,"QUERY_SERVICE_NAME_DEPENDENT","$dataSource and only $serviceName profile metrics"),BP(VP,"Component",(({model:e})=>{const t=(0,o.useStyles2)(UP),{loading:n,value:r,options:i,error:a}=e.useState(),s=(0,Fi.useMemo)((()=>VP.buildCascaderOptions(i)),[i]);return a?$i().createElement(o.Tooltip,{theme:"error",content:a.toString()},$i().createElement(o.Icon,{className:t.iconError,name:"exclamation-triangle",size:"xl"})):$i().createElement(o.Cascader,{key:jC(5),"aria-label":"Profile metrics list",width:24,separator:"/",displayAllSelectedLevels:!0,placeholder:n?"Loading...":`Select a profile metric (${i.length})`,options:s,initialValue:r,changeOnSelect:!1,onSelect:e.onSelect})}));const UP=e=>({iconError:i.css`
height: 32px;
align-self: center;
color: ${e.colors.error.text};
`});function zP(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function qP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class HP extends pS{onActivate(){const{serviceName:e}=ta.get(ta.KEYS.PROFILES_EXPLORER)||{};e&&!this.state.value&&this.setState({value:e}),this.subscribeToState(((e,t)=>{if(e.value&&e.value!==t.value){const t=ta.get(ta.KEYS.PROFILES_EXPLORER)||{};t.serviceName=e.value,ta.set(ta.KEYS.PROFILES_EXPLORER,t)}}))}update(){var e,t=this;return(e=function*(){if(t.state.loading)return;let e=[],n=null;t.setState({loading:!0,options:[],error:null});try{e=yield(0,Hp.lastValueFrom)(t.getValueOptions({}))}catch(e){n=e}finally{t.setState({loading:!1,options:e,error:n})}},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){zP(a,r,i,o,s,"next",e)}function s(e){zP(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(e){super(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){qP(e,t,n[t])}))}return e}({key:"serviceName",name:"serviceName",label:"Service",datasource:LP,query:HP.QUERY_DEFAULT,loading:!0,refresh:r.VariableRefresh.onTimeRangeChanged},e)),qP(this,"selectNewValue",(e=>{Cs("g_pyroscope_app_service_name_selected"),this.state.skipUrlSync||O_(),this.changeValueTo(e)})),this.addActivationHandler(this.onActivate.bind(this))}}qP(HP,"QUERY_DEFAULT","$dataSource and all services"),qP(HP,"QUERY_PROFILE_METRIC_DEPENDENT","$dataSource and only $profileMetricId services"),qP(HP,"Component",(({model:e})=>{const t=(0,o.useStyles2)(GP),{loading:n,value:r,options:i,error:a}=e.useState(),s=(0,Fi.useMemo)((()=>function(e){const t=[...e].sort(),n=[],r=new Map;for(const e of t){const t=e.split("/");let i="";for(let e=0;e<t.length;e++){const a=t[e],o=i;i=i?`${i}/${a}`:a;const s=e===t.length-1;if(!r.has(i)||s){const e={value:s?i:i+"/",label:a,items:s?void 0:[]};if(s||r.set(i,e),o){const t=r.get(o);t&&t.items&&t.items.push(e)}else n.push(e)}}}return n}(i.map((({label:e})=>e)))),[i]);return a?$i().createElement(o.Tooltip,{theme:"error",content:a.toString()},$i().createElement(o.Icon,{className:t.iconError,name:"exclamation-triangle",size:"xl"})):$i().createElement(o.Cascader,{key:jC(5),"aria-label":"Services list",width:32,separator:"/",displayAllSelectedLevels:!0,placeholder:n?"Loading services...":`Select a service (${i.length})`,options:s,initialValue:r,changeOnSelect:!1,onSelect:e.selectNewValue})}));const GP=e=>({iconError:i.css`
height: 32px;
align-self: center;
color: ${e.colors.error.text};
`});function WP(e,t){const{value:n}=nm.findByKeyAndType(e,"serviceName",HP).useState(),{value:r}=nm.findByKeyAndType(e,"profileMetricId",VP).useState(),{filterExpression:i}=nm.findByKeyAndType(e,t,oA).useState();return(0,Fi.useMemo)((()=>`${r}{service_name="${n}",${i}}`),[i,r,n])}class QP extends Fw{onActivate(){this.setState({skipUrlSync:!1}),this.subscribeToState(((e,t)=>{if(e.value&&e.value!==t.value){const t=ta.get(ta.KEYS.PROFILES_EXPLORER)||{};t.dataSource=e.value,ta.set(ta.KEYS.PROFILES_EXPLORER,t)}}))}constructor(){super({pluginId:"grafana-pyroscope-datasource",key:"dataSource",name:"dataSource",label:"Data source",skipUrlSync:!0,value:ua.selectDefaultDataSource().uid}),this.addActivationHandler(this.onActivate.bind(this))}}function KP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){KP(e,t,n[t])}))}return e}function XP(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const JP=e=>{let t=e.operator.value;return e.operator.value===A_.in?t=A_["=~"]:e.operator.value===A_["not-in"]&&(t=A_["!~"]),{key:e.attribute.value,operator:t,value:e.value.value}};function ZP(e,t){let n;const r=e.filter((e=>e.key!==t||(n=e,!1)));return{found:n,filtersWithoutFound:r}}const eA=(e,t)=>[...e,t];function tA(e,t){const{found:n,filtersWithoutFound:r}=ZP(e,t.key);if(!n)return eA(e,XP(YP({},t),{operator:"=~"}));if(["!~","!="].includes(n.operator))return eA(r,XP(YP({},t),{operator:"=~"}));const i=new Set(n.value.split("|"));return"=~"===n.operator?eA(r,XP(YP({},n),{value:Array.from(i.add(t.value)).join("|")})):n.value===t.value?e:eA(r,XP(YP({},t),{operator:"=~",value:Array.from(i.add(t.value)).join("|")}))}function nA(e,t){const{found:n,filtersWithoutFound:r}=ZP(e,t.key);if(!n)return eA(e,XP(YP({},t),{operator:"!~"}));if(["=~","="].includes(n.operator))return eA(r,XP(YP({},t),{operator:"!~"}));const i=new Set(n.value.split("|"));return"!~"===n.operator?eA(r,XP(YP({},n),{value:Array.from(i.add(t.value)).join("|")})):n.value===t.value?e:eA(r,XP(YP({},t),{operator:"!~",value:Array.from(i.add(t.value)).join("|")}))}function rA(e,t){const{found:n,filtersWithoutFound:r}=ZP(e,t.key);if(!n)return e;const i=n.value.split("|").filter((e=>e!==t.value));return i.length>0?eA(r,XP(YP({},n),{value:i.join("|")})):[...r]}const iA=e=>e.operator in A_;function aA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class oA extends Dg{reset(){this.setState({filters:oA.DEFAULT_VALUE})}static resetAll(e){["filters","filtersBaseline","filtersComparison"].forEach((t=>{nm.findByKeyAndType(e,t,oA).reset()}))}onActivate(){const e=nm.findByKeyAndType(this,"dataSource",QP).subscribeToState((()=>{this.reset()}));return()=>{e.unsubscribe()}}constructor({key:e}){super({key:e,name:e,label:"Filters",filters:oA.DEFAULT_VALUE,expressionBuilder:e=>e.filter(iA).map((({key:e,operator:t,value:n})=>t===A_["is-empty"]?`${e}=""`:`${e}${t}"${n}"`)).join(",")}),aA(this,"onChangeQuery",((e,t)=>{Cs("g_pyroscope_app_filters_changed",{name:this.state.name,count:t.length,operators:(0,Bc.uniq)(t.map((e=>e.operator.label)))}),this.setState({filters:t.map(JP)})})),this.addActivationHandler(this.onActivate.bind(this))}}function sA(e,t){var n;return null===(n=nm.lookupVariable(t,e))||void 0===n?void 0:n.getValue()}function lA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}aA(oA,"DEFAULT_VALUE",[]),aA(oA,"Component",(({model:e})=>{const{key:t}=e.useState(),n=WP(e,t),{value:r}=nm.findByKeyAndType(e,"dataSource",QP).useState(),{from:i,to:a}=nm.getTimeRange(e).state.value;return $i().createElement(DP,{id:`query-builder-${t}`,autoExecute:!0,dataSourceUid:r,query:n,from:1e3*i.unix(),to:1e3*a.unix(),onChangeQuery:e.onChangeQuery})}));var cA=function(e){return e.TIMESERIES="time-series",e.BARGAUGE="bar-gauge",e.TABLE="table",e.HISTOGRAM="histogram",e}({});class uA extends vh{getUrlState(){return{panelType:this.state.panelType}}updateFromUrl(e){const t={};"string"==typeof e.panelType&&e.panelType!==this.state.panelType&&(t.panelType=Object.values(cA).includes(e.panelType)?e.panelType:uA.DEFAULT_PANEL_TYPE),this.setState(t)}reset(){this.setState({panelType:uA.DEFAULT_PANEL_TYPE})}constructor(){super({key:"panel-type-switcher",panelType:uA.DEFAULT_PANEL_TYPE}),lA(this,"_urlSync",new Jh(this,{keys:["panelType"]})),lA(this,"onChange",(e=>{Cs("g_pyroscope_app_panel_type_changed",{panelType:e}),this.setState({panelType:e})}))}}function dA(e){const t=a.config.theme2.visualization;return t.getColorByName(t.palette[e%8])}lA(uA,"OPTIONS",[{label:"Time series",value:"time-series",icon:"heart-rate"},{label:"Totals",value:"bar-gauge",icon:"align-left"},{label:"Maxima",value:"table",icon:"angle-double-up"},{label:"Histograms",value:"histogram",icon:"graph-bar"}]),lA(uA,"DEFAULT_PANEL_TYPE","time-series"),lA(uA,"Component",(({model:e})=>{const{panelType:t}=e.useState();return $i().createElement(o.RadioButtonGroup,{"aria-label":"Panel type switcher",options:uA.OPTIONS,value:t,onChange:e.onChange,fullWidth:!1})}));const pA=(e,t)=>{var n;return(null===(n=e.labels)||void 0===n?void 0:n[t])||"(no value)"},hA=(e,t)=>{var n,r,i;return null===(i=e.meta)||void 0===i||null===(r=i.stats)||void 0===r||null===(n=r.find((e=>e.displayName===t)))||void 0===n?void 0:n.value};function fA(e){const[,t=""]=e.match(/.+\{.*service_name="([^"]+)".*\}/)||[],[,n=""]=e.match(/([^{]+)\{.*}/)||[],r=e.substring(e.indexOf("{")),i=r.replace(/(\{|\})/,"").split(",").map((e=>{var t;return null===(t=e.match(/\W*([^=!~]+)(=|!=|=~|!~)"(.*)"/))||void 0===t?void 0:t[0]})).filter((e=>e&&!e.includes("service_name")));return{serviceId:t,profileMetricId:n,labelsSelector:r,labels:i}}function mA(e){return e.addActivationHandler((()=>{const{profileTypeId:t,labelSelector:n}=e.state.queries[0];if(!t)return void e.setState({queries:[{refId:"null"}],data:gA(e,"Missing profile type!")});if(!n)return void e.setState({queries:[{refId:"null"}],data:gA(e,"Missing label selector!")});if(!nm.interpolate(e,"$profileMetricId"))return void e.setState({queries:[{refId:"null"}],data:gA(e,"Missing profile type!")});fA(nm.interpolate(e,`$profileTypeId${n})`)).serviceId||e.setState({queries:[{refId:"null"}],data:gA(e,"Missing service name!")})})),e}function gA(e,t){const n=new Error(t);return Xi.error(n),{state:r.LoadingState.Error,errors:[n],series:[],timeRange:nm.getTimeRange(e).state.value}}function yA({serviceName:e,profileMetricId:t,groupBy:n,filters:r},i){const a=r?[...r]:[];a.unshift({key:"service_name",operator:"=",value:e||"$serviceName"});const o=a.map((({key:e,operator:t,value:n})=>`${e}${t}"${n}"`)).join(",");return mA(new Yg({datasource:NP,queries:[{refId:`${t||"$profileMetricId"}-${o}-${(null==n?void 0:n.label)||"no-group-by"}`,queryType:"metrics",profileTypeId:t||"$profileMetricId",labelSelector:`{${o},$filters}`,groupBy:(null==n?void 0:n.label)?[n.label]:[],limit:i}]}))}const bA=()=>e=>e.pipe((0,Hp.map)((e=>null==e?void 0:e.map(((e,t)=>(0,Bc.merge)(e,{refId:`${e.refId}-${t}`})))))),vA=()=>e=>e.pipe((0,Hp.map)((e=>{const t=null==e?void 0:e.length;return null==e?void 0:e.map((e=>{var n,r;let i=Number.NEGATIVE_INFINITY;const a=null===(r=e.fields)||void 0===r||null===(n=r.find((e=>"number"===e.type)))||void 0===n?void 0:n.values.reduce(((e,t)=>(t>i&&(i=t),e+t)),0);return(0,Bc.merge)(e,{meta:{stats:[{displayName:"totalSeriesCount",value:t},{displayName:"allValuesSum",value:a},{displayName:"maxValue",value:i}]}})}))})));class wA extends vh{onActivate(e){const{body:t}=this.state,n=t.state.$data.subscribeToState((n=>{var i;if((null===(i=n.data)||void 0===i?void 0:i.state)!==r.LoadingState.Done)return;const{series:a}=n.data;(null==a?void 0:a.length)&&t.setState(this.getConfig(e,a)),this.publishEvent(new __({series:a}),!0)}));return()=>{n.unsubscribe()}}getConfig(e,t){var n;let i=Number.NEGATIVE_INFINITY;for(const e of t){const t=hA(e,"allValuesSum")||0;t>i&&(i=t)}const a=null===(n=e.queryRunnerParams.groupBy)||void 0===n?void 0:n.label,o=a?"This panel displays aggregate values over the current time period":void 0;return{title:t.length>1?`${e.label} (${t.length})`:e.label,description:o,options:{reduceOptions:{values:!1,calcs:["sum"]},orientation:r.VizOrientation.Horizontal,displayMode:$h.Gradient,valueMode:Bh.Text,showUnfilled:!0,sizing:Uh.Manual,text:{titleSize:13,valueSize:13},namePlacement:Vh.Top,minVizHeight:36,maxVizHeight:36,legend:{showLegend:!1}},fieldConfig:{defaults:{displayName:1===t.length?a:void 0,min:0,max:i,thresholds:{mode:r.ThresholdsMode.Percentage,steps:[]}},overrides:this.getOverrides(e,t)}}}getOverrides(e,t){var n;const{index:i,queryRunnerParams:a}=e,o=null===(n=a.groupBy)||void 0===n?void 0:n.label;return t.map(((e,t)=>({matcher:{id:r.FieldMatcherID.byFrameRefID,options:e.refId},properties:[{id:"displayName",value:pA(e.fields[1],o)},{id:"color",value:{mode:"fixed",fixedColor:dA(i+t)}}]})))}static Component({model:e}){const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})}constructor({item:e,headerActions:t}){super({key:"bar-gauge-label-values",body:E_.bargauge().setTitle(e.label).setData(new vw({$data:yA(e.queryRunnerParams),transformations:[bA,vA]})).setHeaderActions(t(e)).build()}),this.addActivationHandler(this.onActivate.bind(this,e))}}function SA(e,t){const n=t.fields[1].config.unit,i=hA(t,"allValuesSum")||0,a=(0,r.getValueFormat)(n)(i),o=hA(t,"maxValue")||0,s=(0,r.getValueFormat)(n)(o);return`total ${e} = ${a.text}${a.suffix} / max = ${s.text}${s.suffix}`}class EA extends vh{onActivate(e){const{body:t}=this.state,n=t.state.$data.subscribeToState((n=>{var i;if((null===(i=n.data)||void 0===i?void 0:i.state)!==r.LoadingState.Done)return;const{series:a}=n.data;(null==a?void 0:a.length)&&t.setState(this.getConfig(e,a)),this.publishEvent(new __({series:a}),!0)}));return()=>{n.unsubscribe()}}getConfig(e,t){var n;const{legendPlacement:r}=this.state,i=null===(n=e.queryRunnerParams.groupBy)||void 0===n?void 0:n.label;return{title:t.length>1?`${e.label} (${t.length})`:e.label,options:{tooltip:{mode:o.TooltipDisplayMode.Single,sort:Fh.None},legend:{showLegend:!0,displayMode:o.LegendDisplayMode.List,placement:r,calcs:[]}},fieldConfig:{defaults:{displayName:1===t.length?i:void 0,custom:{lineWidth:1}},overrides:this.getOverrides(e,t)}}}getOverrides(e,t){var n;const{index:i,queryRunnerParams:a}=e,o=null===(n=a.groupBy)||void 0===n?void 0:n.label;return t.map(((e,n)=>{const a=e.fields[1];let s=o?pA(a,o):a.name;return 1===t.length&&(s=SA(s,e)),{matcher:{id:r.FieldMatcherID.byFrameRefID,options:e.refId},properties:[{id:"displayName",value:s},{id:"color",value:{mode:"fixed",fixedColor:dA(i+n)}}]}}))}static Component({model:e}){const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})}constructor({item:e,headerActions:t,legendPlacement:n}){super({key:"histogram-label-values",legendPlacement:n||"bottom",body:E_.histogram().setTitle(e.label).setData(new vw({$data:yA(e.queryRunnerParams),transformations:[bA,vA]})).setHeaderActions(t(e)).build()}),this.addActivationHandler(this.onActivate.bind(this,e))}}class xA extends vh{onActivate(e){const{body:t}=this.state,n=t.state.$data.subscribeToState((n=>{var i;if((null===(i=n.data)||void 0===i?void 0:i.state)!==r.LoadingState.Done)return;const{series:a}=n.data;(null==a?void 0:a.length)&&t.setState(this.getConfig(e,a)),this.publishEvent(new __({series:a}),!0)}));return()=>{n.unsubscribe()}}getConfig(e,t){const n=t[0].fields[0].values.length,r=IP(nm.findByKeyAndType(this,"profileMetricId",VP).state.value).unit;return{title:n>1?`${e.label} (${n})`:e.label,fieldConfig:{defaults:{custom:{filterable:!0,cellOptions:{}}},overrides:[{matcher:{id:"byName",options:"max"},properties:[{id:"unit",value:r},{id:"custom.width",value:100}]}]}}}static Component({model:e}){const t=(0,o.useStyles2)(OA),{body:n}=e.useState();return $i().createElement("span",{className:t.container},$i().createElement(n.Component,{model:n}))}constructor({item:e,headerActions:t}){super({key:"table-label-values",body:E_.table().setTitle(e.label).setData(new vw({$data:yA(e.queryRunnerParams),transformations:[{id:r.DataTransformerID.reduce,options:{reducers:["max"],labelsToFields:!0}},{id:r.DataTransformerID.filterFieldsByName,options:{exclude:{names:["Field"]}}},{id:r.DataTransformerID.renameByRegex,options:{regex:"Max",renamePattern:"max"}},{id:r.DataTransformerID.sortBy,options:{sort:[{field:"max",desc:!0}]}}]})).setHeaderActions(t(e)).build()}),this.addActivationHandler(this.onActivate.bind(this,e))}}const OA=()=>({container:i.css`
[data-testid='data-testid table body'] [role='row']:first-child {
color: ${dA(3)};
font-weight: 500;
}
`});class _A{value;next;constructor(e){this.value=e}}class TA{#G;#W;#Q;constructor(){this.clear()}enqueue(e){const t=new _A(e);this.#G?(this.#W.next=t,this.#W=t):(this.#G=t,this.#W=t),this.#Q++}dequeue(){const e=this.#G;if(e)return this.#G=this.#G.next,this.#Q--,e.value}peek(){if(this.#G)return this.#G.value}clear(){this.#G=void 0,this.#W=void 0,this.#Q=0}get size(){return this.#Q}*[Symbol.iterator](){let e=this.#G;for(;e;)yield e.value,e=e.next}}function CA(e){if(!Number.isInteger(e)&&e!==Number.POSITIVE_INFINITY||!(e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}function kA(e){return{from:1e4*Math.floor((e.from.valueOf()||0)/1e4),to:1e4*Math.floor((e.to.valueOf()||0)/1e4)}}function PA(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function AA(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){PA(a,r,i,o,s,"next",e)}function s(e){PA(a,r,i,o,s,"throw",e)}o(void 0)}))}}function RA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){RA(e,t,n[t])}))}return e}function jA(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const IA=function(e){CA(e);const t=new TA;let n=0;const r=()=>{n<e&&t.size>0&&(t.dequeue()(),n++)},i=async(e,t,i)=>{const a=(async()=>e(...i))();t(a);try{await a}catch{}n--,r()},a=(a,...o)=>new Promise((s=>{((a,o,s)=>{new Promise((e=>{t.enqueue(e)})).then(i.bind(void 0,a,o,s)),(async()=>{await Promise.resolve(),n<e&&r()})()})(a,s,o)}));return Object.defineProperties(a,{activeCount:{get:()=>n},pendingCount:{get:()=>t.size},clearQueue:{value(){t.clear()}},concurrency:{get:()=>e,set(i){CA(i),e=i,queueMicrotask((()=>{for(;n<e&&t.size>0;)r()}))}}}),a}(20);class NA extends Ah{query(){return AA((function*(){return{state:r.LoadingState.Done,data:[{name:"Labels",fields:[{name:"Label",type:r.FieldType.other,values:[],config:{}}],length:0}]}}))()}getParams(e){var t;const{scopedVars:n,range:r}=e,i=null==n||null===(t=n.__sceneObject)||void 0===t?void 0:t.value,a=nm.interpolate(i,"$dataSource"),o=nm.interpolate(i,"$serviceName"),s=nm.interpolate(i,"$profileMetricId"),l=`${s}{service_name="${o}"}`,{from:c,to:u}=kA(r);return{dataSourceUid:a,serviceName:o,profileMetricId:s,query:l,from:c,to:u}}fetchLabels(e,t,n,r,i){return AA((function*(){YC.setApiClient(new FC({dataSourceUid:e}));try{return yield YC.listLabels({query:t,from:n,to:r})}catch(e){throw Xi.error(e,{info:"Error while loading Pyroscope label names!",variableName:i||""}),e}}))()}fetchLabelValues(e,t,n,r,i,a){return AA((function*(){let e;try{e=yield YC.listLabelValues({query:t,from:n,to:r,label:i})}catch(e){Xi.error(e,{info:"Error while loading Pyroscope label values!",variableName:a||""})}const o=e?e.length:-1;return{value:{value:i,groupBy:{label:i,values:e||[]}},text:`${i} (${o>-1?o:"?"})`,count:o}}))()}metricFindQuery(e,t){var n=this;return AA((function*(){var e,r,i;if(!(null===(r=t.scopedVars)||void 0===r||null===(e=r.__sceneObject)||void 0===e?void 0:e.value).isActive)return[];const{dataSourceUid:a,serviceName:o,profileMetricId:s,query:l,from:c,to:u}=n.getParams(t);if(!o||!s)return Xi.warn('LabelsDataSource: either serviceName="%s" and/or profileMetricId="%s" is empty! Discarding request.',o,s),[];const d=yield n.fetchLabels(a,l,c,u,null===(i=t.variable)||void 0===i?void 0:i.name),p=yield Promise.all(d.filter((({value:e})=>!_k(e))).map((({value:e},r)=>IA((()=>{var i;return n.fetchLabelValues(r,l,c,u,e,null===(i=t.variable)||void 0===i?void 0:i.name)}))))),h=p.sort(((e,t)=>t.count-e.count)).map((({value:e,text:t},n)=>({value:JSON.stringify(jA(DA({},e),{index:n})),text:t})));return[{value:"all",text:"All"},...h]}))()}testDatasource(){return AA((function*(){return{status:"success",message:"OK"}}))()}constructor(){super(FP.type,FP.uid)}}RA(NA,"MAX_TIMESERIES_LABEL_VALUES",10);const LA=__webpack_require__.p+"e6c722427cfa8715e19d.svg";function MA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){MA(e,t,n[t])}))}return e}function $A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function BA(e){const t=IP(e);return`${t.type} (${t.group})`}function VA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){VA(e,t,n[t])}))}return e}function zA(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const qA=[{text:"Linear",scaleDistribution:{type:Lh.Linear}},{text:"Log2",scaleDistribution:{type:Lh.Log,log:2}}];class HA extends vh{onActivate(){this.setState({items:this.buildMenuItems()})}buildMenuItems(e){const{items:t,scaleType:n}=this.state,r=[{text:"Scale type",type:"group",subMenu:qA.map((e=>({text:`${n===e.scaleDistribution.type?"✔ ":""}${e.text}`,onClick:()=>this.onClickScaleOption(e)})))},{type:"divider",text:""},{iconClassName:"compass",text:"Open in Explore",onClick:()=>this.onClickExplore()}];if(e)r.push({iconClassName:"plus-square",text:"Add to investigation (beta)",onClick:()=>{e.onClick()}});else{const e=null==t?void 0:t.find((e=>e.text.includes("Add to investigation")));e&&r.push(UA({},e))}return r}onClickScaleOption(e){const{scaleDistribution:t,text:n}=e;(0,a.reportInteraction)("g_pyroscope_app_timeseries_scale_changed",{scale:t.type});nm.getAncestor(this,GA).changeScale(t,n),this.setState({scaleType:t.type,items:this.buildMenuItems()})}onClickExplore(){(0,a.reportInteraction)("g_pyroscope_app_open_in_explore_clicked");const e=function(e,t,n){const i=JSON.stringify({"pyroscope-explore":{range:(0,r.toURLRange)(e),queries:[$A(FA({},t),{datasource:n})],panelsState:{},datasource:n}});var o;const s=null!==(o=a.config.appSubUrl)&&void 0!==o?o:"";return r.urlUtil.renderUrl(`${s}/explore`,{panes:i,schemaVersion:1})}(nm.getTimeRange(this).state.value.raw,this.getInterpolatedQuery(),nm.interpolate(this,"${dataSource}"));window.open(e,"_blank")}getInterpolatedQuery(){var e;const t=null===(e=nm.getAncestor(this,GA).state.body.state.$data)||void 0===e?void 0:e.state.$data,n=null==t?void 0:t.state.queries[0];return Object.entries(n).map((([e,t])=>[e,"string"==typeof t?nm.interpolate(this,t):t])).reduce(((e,[t,n])=>zA(UA({},e),{[t]:n})),{})}useGetInvestigationPluginLinkContext(){const{refId:e,queryType:t,profileTypeId:n,labelSelector:r,groupBy:i}=this.getInterpolatedQuery(),a=fA(`${n}${r}`),o=[a.serviceId,BA(a.profileMetricId)];(null==i?void 0:i.length)&&o.push(i[0]),a.labels.length&&o.push(a.labels.join(", "));const s=o.join(" · "),l=nm.interpolate(this,"${dataSource}"),c=nm.getTimeRange(this).state.value;return(0,Fi.useMemo)((()=>({id:jC(),origin:"Grafana Profiles Drilldown",url:window.location.href,logoPath:LA,title:s,type:"timeseries",timeRange:UA({},c),queries:[{refId:e,queryType:t,profileTypeId:n,labelSelector:r,groupBy:i}],datasource:l})),[l,i,r,n,t,e,c,s])}useUpdateMenuItems(){const e=function({extensionPointId:e,context:t,pluginId:n}){const r=(0,a.usePluginLinks)({extensionPointId:e,context:t}),[i]=r.links.filter((e=>e.pluginId===n));return i}({extensionPointId:"grafana-pyroscope-app/investigation/v1",context:this.useGetInvestigationPluginLinkContext(),pluginId:"grafana-investigations-app"});(0,Fi.useEffect)((()=>{e&&this.setState({items:this.buildMenuItems(e)})}),[e])}static Component({model:e}){return e.useUpdateMenuItems(),$i().createElement(MS.Component,{model:e})}constructor(e){super(UA({scaleType:Lh.Linear},e)),this.addActivationHandler(this.onActivate.bind(this))}}class GA extends vh{onActivate(){const{body:e}=this.state,t=e.state.$data.subscribeToState(((t,n)=>{var i,a,o,s;if((null===(i=t.data)||void 0===i?void 0:i.state)!==r.LoadingState.Done)return;!(null===(a=t.data.annotations)||void 0===a?void 0:a.length)&&(null===(s=n.data)||void 0===s||null===(o=s.annotations)||void 0===o?void 0:o.length)&&(t.data.annotations=n.data.annotations);const{series:l}=t.data;if(null==l?void 0:l.length){const t=this.state.displayAllValues?this.getAllValuesConfig(l):this.getConfig(l);e.setState((0,Bc.merge)({},e.state,t))}this.publishEvent(new __({series:l}),!0)}));return()=>{t.unsubscribe()}}getConfig(e){var t;const{body:n,item:r,legendPlacement:i}=this.state;let a,{title:o}=n.state;return(null===(t=r.queryRunnerParams.groupBy)||void 0===t?void 0:t.label)&&(o=e.length>1?`${r.label} (${e.length})`:r.label,a=this.buildDescription(r.queryRunnerParams.groupBy)),{title:o,description:a,options:{tooltip:{mode:"single",sort:"none"},legend:{showLegend:!0,displayMode:"list",placement:i}},fieldConfig:{defaults:{min:0,custom:{fillOpacity:e.length>=NA.MAX_TIMESERIES_LABEL_VALUES?0:9,gradientMode:1===e.length?Mh.None:Mh.Opacity,pointSize:3}},overrides:this.getOverrides(e)}}}buildDescription(e){return e?e.values?e.values.length>NA.MAX_TIMESERIES_LABEL_VALUES?`Showing only ${NA.MAX_TIMESERIES_LABEL_VALUES} out of ~${e.values.length} series to preserve readability. To view all the series for the current filters, click on the expand icon on this panel.`:"":`Showing only ${NA.MAX_TIMESERIES_LABEL_VALUES} series to preserve readability. To view all the series, click on the expand icon on this panel.`:""}getAllValuesConfig(e){const{legendPlacement:t}=this.state;return{options:{tooltip:{mode:o.TooltipDisplayMode.Single,sort:Fh.None},legend:{showLegend:!0,displayMode:o.LegendDisplayMode.List,placement:t,calcs:[]}},fieldConfig:{defaults:{min:0,custom:{fillOpacity:0,pointSize:5}},overrides:this.getOverrides(e)}}}getOverrides(e){var t;if(this.state.overrides)return this.state.overrides(e);const{item:n}=this.state,i=null===(t=n.queryRunnerParams.groupBy)||void 0===t?void 0:t.label;return e.map(((t,a)=>{const o=t.fields[1];let s=i?pA(o,i):o.name;return 1===e.length&&(s=SA(s,t)),{matcher:{id:r.FieldMatcherID.byFrameRefID,options:t.refId},properties:[{id:"displayName",value:s},{id:"color",value:{mode:"fixed",fixedColor:dA(n.index+a)}}]}}))}updateItem(e){var t,n;const{item:r,headerActions:i,body:a}=this.state,o=(0,Bc.merge)({},r,e);if((null===(t=e.queryRunnerParams)||void 0===t?void 0:t.hasOwnProperty("groupBy"))&&(void 0===e.queryRunnerParams.groupBy?delete o.queryRunnerParams.groupBy:o.queryRunnerParams.groupBy=e.queryRunnerParams.groupBy),(null===(n=e.queryRunnerParams)||void 0===n?void 0:n.hasOwnProperty("filters"))&&void 0===e.queryRunnerParams.filters&&delete o.queryRunnerParams.filters,this.setState({item:o}),a.setState({title:e.label,description:this.buildDescription(o.queryRunnerParams.groupBy),headerActions:i(o)}),!(0,Bc.isEqual)(r.queryRunnerParams,o.queryRunnerParams)){var s;const{queries:e}=yA(o.queryRunnerParams,NA.MAX_TIMESERIES_LABEL_VALUES).state,t=null===(s=a.state.$data)||void 0===s?void 0:s.state.$data;null==t||t.setState({queries:e}),null==t||t.runQueries()}}changeScale(e,t){const{body:n}=this.state;n.clearFieldConfigCache(),n.setState({fieldConfig:(0,Bc.merge)({},n.state.fieldConfig,{defaults:{custom:{scaleDistribution:e,axisLabel:e.type!==Lh.Linear?t:""}}})})}static Component({model:e}){const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})}constructor({item:e,headerActions:t,displayAllValues:n,legendPlacement:r,data:i,overrides:a}){super({key:"timeseries-label-values",item:e,headerActions:t,displayAllValues:Boolean(n),legendPlacement:r||"bottom",overrides:a,body:E_.timeseries().setTitle(e.label).setData(i||new vw({$data:yA(e.queryRunnerParams,n?void 0:NA.MAX_TIMESERIES_LABEL_VALUES),transformations:[bA,vA]})).setHeaderActions(t(e)).setMenu(new HA({})).build()}),this.addActivationHandler(this.onActivate.bind(this))}}function WA(e,t){switch(e){case cA.BARGAUGE:return new wA(t);case cA.TABLE:return new xA(t);case cA.HISTOGRAM:return new EA(t);case cA.TIMESERIES:default:return new GA(t)}}var QA=e=>"string"!=typeof e?{}:e.split(/ ?; ?/).reduce(((e,t)=>{const[n,r]=t.split(/ ?: ?/).map(((e,t)=>0===t?e.replace(/\s+/g,""):e.trim()));if(n&&r){const t=n.replace(/(\w)-(\w)/g,((e,t,n)=>`${t}${n.toUpperCase()}`));let i=r.trim();Number.isNaN(Number(r))||(i=Number(r)),e[n.startsWith("-")?n:t]=i}return e}),{});var KA=["br","col","colgroup","dl","hr","iframe","img","input","link","menuitem","meta","ol","param","select","table","tbody","tfoot","thead","tr","ul","wbr"],YA={"accept-charset":"acceptCharset",acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autocorrect:"autoCorrect",autofocus:"autoFocus",autoplay:"autoPlay",autosave:"autoSave",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classID",classname:"className",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",controlslist:"controlsList",crossorigin:"crossOrigin",dangerouslysetinnerhtml:"dangerouslySetInnerHTML",datetime:"dateTime",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",enctype:"encType",for:"htmlFor",formmethod:"formMethod",formaction:"formAction",formenctype:"formEncType",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",htmlfor:"htmlFor",httpequiv:"httpEquiv","http-equiv":"httpEquiv",icon:"icon",innerhtml:"innerHTML",inputmode:"inputMode",itemid:"itemID",itemprop:"itemProp",itemref:"itemRef",itemscope:"itemScope",itemtype:"itemType",keyparams:"keyParams",keytype:"keyType",marginwidth:"marginWidth",marginheight:"marginHeight",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",nomodule:"noModule",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",typemustmatch:"typeMustMatch",usemap:"useMap",accentheight:"accentHeight","accent-height":"accentHeight",alignmentbaseline:"alignmentBaseline","alignment-baseline":"alignmentBaseline",allowreorder:"allowReorder",arabicform:"arabicForm","arabic-form":"arabicForm",attributename:"attributeName",attributetype:"attributeType",autoreverse:"autoReverse",basefrequency:"baseFrequency",baselineshift:"baselineShift","baseline-shift":"baselineShift",baseprofile:"baseProfile",calcmode:"calcMode",capheight:"capHeight","cap-height":"capHeight",clippath:"clipPath","clip-path":"clipPath",clippathunits:"clipPathUnits",cliprule:"clipRule","clip-rule":"clipRule",colorinterpolation:"colorInterpolation","color-interpolation":"colorInterpolation",colorinterpolationfilters:"colorInterpolationFilters","color-interpolation-filters":"colorInterpolationFilters",colorprofile:"colorProfile","color-profile":"colorProfile",colorrendering:"colorRendering","color-rendering":"colorRendering",contentscripttype:"contentScriptType",contentstyletype:"contentStyleType",diffuseconstant:"diffuseConstant",dominantbaseline:"dominantBaseline","dominant-baseline":"dominantBaseline",edgemode:"edgeMode",enablebackground:"enableBackground","enable-background":"enableBackground",externalresourcesrequired:"externalResourcesRequired",fillopacity:"fillOpacity","fill-opacity":"fillOpacity",fillrule:"fillRule","fill-rule":"fillRule",filterres:"filterRes",filterunits:"filterUnits",floodopacity:"floodOpacity","flood-opacity":"floodOpacity",floodcolor:"floodColor","flood-color":"floodColor",fontfamily:"fontFamily","font-family":"fontFamily",fontsize:"fontSize","font-size":"fontSize",fontsizeadjust:"fontSizeAdjust","font-size-adjust":"fontSizeAdjust",fontstretch:"fontStretch","font-stretch":"fontStretch",fontstyle:"fontStyle","font-style":"fontStyle",fontvariant:"fontVariant","font-variant":"fontVariant",fontweight:"fontWeight","font-weight":"fontWeight",glyphname:"glyphName","glyph-name":"glyphName",glyphorientationhorizontal:"glyphOrientationHorizontal","glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphorientationvertical:"glyphOrientationVertical","glyph-orientation-vertical":"glyphOrientationVertical",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",horizadvx:"horizAdvX","horiz-adv-x":"horizAdvX",horizoriginx:"horizOriginX","horiz-origin-x":"horizOriginX",imagerendering:"imageRendering","image-rendering":"imageRendering",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",letterspacing:"letterSpacing","letter-spacing":"letterSpacing",lightingcolor:"lightingColor","lighting-color":"lightingColor",limitingconeangle:"limitingConeAngle",markerend:"markerEnd","marker-end":"markerEnd",markerheight:"markerHeight",markermid:"markerMid","marker-mid":"markerMid",markerstart:"markerStart","marker-start":"markerStart",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",overlineposition:"overlinePosition","overline-position":"overlinePosition",overlinethickness:"overlineThickness","overline-thickness":"overlineThickness",paintorder:"paintOrder","paint-order":"paintOrder","panose-1":"panose1",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointerevents:"pointerEvents","pointer-events":"pointerEvents",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",renderingintent:"renderingIntent","rendering-intent":"renderingIntent",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",shaperendering:"shapeRendering","shape-rendering":"shapeRendering",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",stopcolor:"stopColor","stop-color":"stopColor",stopopacity:"stopOpacity","stop-opacity":"stopOpacity",strikethroughposition:"strikethroughPosition","strikethrough-position":"strikethroughPosition",strikethroughthickness:"strikethroughThickness","strikethrough-thickness":"strikethroughThickness",strokedasharray:"strokeDasharray","stroke-dasharray":"strokeDasharray",strokedashoffset:"strokeDashoffset","stroke-dashoffset":"strokeDashoffset",strokelinecap:"strokeLinecap","stroke-linecap":"strokeLinecap",strokelinejoin:"strokeLinejoin","stroke-linejoin":"strokeLinejoin",strokemiterlimit:"strokeMiterlimit","stroke-miterlimit":"strokeMiterlimit",strokewidth:"strokeWidth","stroke-width":"strokeWidth",strokeopacity:"strokeOpacity","stroke-opacity":"strokeOpacity",suppresscontenteditablewarning:"suppressContentEditableWarning",suppresshydrationwarning:"suppressHydrationWarning",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textanchor:"textAnchor","text-anchor":"textAnchor",textdecoration:"textDecoration","text-decoration":"textDecoration",textlength:"textLength",textrendering:"textRendering","text-rendering":"textRendering",underlineposition:"underlinePosition","underline-position":"underlinePosition",underlinethickness:"underlineThickness","underline-thickness":"underlineThickness",unicodebidi:"unicodeBidi","unicode-bidi":"unicodeBidi",unicoderange:"unicodeRange","unicode-range":"unicodeRange",unitsperem:"unitsPerEm","units-per-em":"unitsPerEm",unselectable:"unselectable",valphabetic:"vAlphabetic","v-alphabetic":"vAlphabetic",vectoreffect:"vectorEffect","vector-effect":"vectorEffect",vertadvy:"vertAdvY","vert-adv-y":"vertAdvY",vertoriginx:"vertOriginX","vert-origin-x":"vertOriginX",vertoriginy:"vertOriginY","vert-origin-y":"vertOriginY",vhanging:"vHanging","v-hanging":"vHanging",videographic:"vIdeographic","v-ideographic":"vIdeographic",viewbox:"viewBox",viewtarget:"viewTarget",vmathematical:"vMathematical","v-mathematical":"vMathematical",wordspacing:"wordSpacing","word-spacing":"wordSpacing",writingmode:"writingMode","writing-mode":"writingMode",xchannelselector:"xChannelSelector",xheight:"xHeight","x-height":"xHeight",xlinkactuate:"xlinkActuate","xlink:actuate":"xlinkActuate",xlinkarcrole:"xlinkArcrole","xlink:arcrole":"xlinkArcrole",xlinkhref:"xlinkHref","xlink:href":"xlinkHref",xlinkrole:"xlinkRole","xlink:role":"xlinkRole",xlinkshow:"xlinkShow","xlink:show":"xlinkShow",xlinktitle:"xlinkTitle","xlink:title":"xlinkTitle",xlinktype:"xlinkType","xlink:type":"xlinkType",xmlbase:"xmlBase","xml:base":"xmlBase",xmllang:"xmlLang","xml:lang":"xmlLang","xml:space":"xmlSpace",xmlnsxlink:"xmlnsXlink","xmlns:xlink":"xmlnsXlink",xmlspace:"xmlSpace",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan",onblur:"onBlur",onchange:"onChange",onclick:"onClick",oncontextmenu:"onContextMenu",ondoubleclick:"onDoubleClick",ondrag:"onDrag",ondragend:"onDragEnd",ondragenter:"onDragEnter",ondragexit:"onDragExit",ondragleave:"onDragLeave",ondragover:"onDragOver",ondragstart:"onDragStart",ondrop:"onDrop",onerror:"onError",onfocus:"onFocus",oninput:"onInput",oninvalid:"onInvalid",onkeydown:"onKeyDown",onkeypress:"onKeyPress",onkeyup:"onKeyUp",onload:"onLoad",onmousedown:"onMouseDown",onmouseenter:"onMouseEnter",onmouseleave:"onMouseLeave",onmousemove:"onMouseMove",onmouseout:"onMouseOut",onmouseover:"onMouseOver",onmouseup:"onMouseUp",onscroll:"onScroll",onsubmit:"onSubmit",ontouchcancel:"onTouchCancel",ontouchend:"onTouchEnd",ontouchmove:"onTouchMove",ontouchstart:"onTouchStart",onwheel:"onWheel"};function XA(e,t){const{key:n,level:r,...i}=t;switch(e.nodeType){case 1:return Fi.createElement(function(e){if(/[a-z]+[A-Z]+[a-z]+/.test(e))return e;return e.toLowerCase()}(e.nodeName),function(e,t){const n={key:t};if(e instanceof Element){const t=e.getAttribute("class");t&&(n.className=t),[...e.attributes].forEach((e=>{switch(e.name){case"class":break;case"style":n[e.name]=QA(e.value);break;case"allowfullscreen":case"allowpaymentrequest":case"async":case"autofocus":case"autoplay":case"checked":case"controls":case"default":case"defer":case"disabled":case"formnovalidate":case"hidden":case"ismap":case"itemscope":case"loop":case"multiple":case"muted":case"nomodule":case"novalidate":case"open":case"readonly":case"required":case"reversed":case"selected":case"typemustmatch":n[YA[e.name]||e.name]=!0;break;default:n[YA[e.name]||e.name]=e.value}}))}return n}(e,n),JA(e.childNodes,r,i));case 3:{const t=e.nodeValue?.toString()??"";if(!i.allowWhiteSpaces&&/^\s+$/.test(t)&&!/[\u00A0\u202F]/.test(t))return null;if(!e.parentNode)return t;const n=e.parentNode.nodeName.toLowerCase();return KA.includes(n)?(/\S/.test(t)&&console.warn(`A textNode is not allowed inside '${n}'. Your text "${t}" will be ignored`),null):t}case 8:default:return null;case 11:return JA(e.childNodes,r,t)}}function JA(e,t,n){const r=[...e].map(((e,r)=>ZA(e,{...n,index:r,level:t+1}))).filter(Boolean);return r.length?r:null}function ZA(e,t={}){if(!(e&&e instanceof Node))return null;const{actions:n=[],index:r=0,level:i=0,randomKey:a}=t;let o=e,s=`${i}-${r}`;const l=[];return a&&0===i&&(s=`${function(e=6){const t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let n="";for(let r=e;r>0;--r)n+=t[Math.round(61*Math.random())];return n}()}-${s}`),Array.isArray(n)&&n.forEach((t=>{t.condition(o,s,i)&&("function"==typeof t.pre&&(o=t.pre(o,s,i),o instanceof Node||(o=e)),"function"==typeof t.post&&l.push(t.post(o,s,i)))})),l.length?l:XA(o,{key:s,level:i,...t})}function eR(e,t={}){return"string"==typeof e?function(e,t={}){if(!e||"string"!=typeof e)return null;const{includeAllNodes:n=!1,nodeOnly:r=!1,selector:i="body > *",type:a="text/html"}=t;try{const o=(new DOMParser).parseFromString(e,a);if(n){const{childNodes:e}=o.body;return r?e:[...e].map((e=>ZA(e,t)))}const s=o.querySelector(i)||o.body.childNodes[0];if(!(s instanceof Node))throw new TypeError("Error parsing input");return r?s:ZA(s,t)}catch(e){}return null}(e,t):e instanceof Node?ZA(e,t):null}var tR=Object.defineProperty,nR=(e,t,n)=>(((e,t,n)=>{t in e?tR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n),rR="react-inlinesvg",iR={IDLE:"idle",LOADING:"loading",LOADED:"loaded",FAILED:"failed",READY:"ready",UNSUPPORTED:"unsupported"};function aR(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}function oR(){return function(){if(!document)return!1;const e=document.createElement("div");e.innerHTML="<svg />";const t=e.firstChild;return!!t&&"http://www.w3.org/2000/svg"===t.namespaceURI}()&&"undefined"!=typeof window&&null!==window}async function sR(e,t){const n=await fetch(e,t),r=n.headers.get("content-type"),[i]=(r??"").split(/ ?; ?/);if(n.status>299)throw new Error("Not found");if(!["image/svg+xml","text/plain"].some((e=>i.includes(e))))throw new Error(`Content type isn't valid: ${i}`);return n.text()}function lR(e=1){return new Promise((t=>{setTimeout(t,1e3*e)}))}var cR,uR=class{constructor(){nR(this,"cacheApi"),nR(this,"cacheStore"),nR(this,"subscribers",[]),nR(this,"isReady",!1),this.cacheStore=new Map;let e=rR,t=!1;aR()&&(e=window.REACT_INLINESVG_CACHE_NAME??rR,t=!!window.REACT_INLINESVG_PERSISTENT_CACHE&&"caches"in window),t?caches.open(e).then((e=>{this.cacheApi=e,this.isReady=!0,this.subscribers.forEach((e=>e()))})).catch((e=>{this.isReady=!0,console.error(`Failed to open cache: ${e.message}`)})):this.isReady=!0}onReady(e){this.isReady?e():this.subscribers.push(e)}async get(e,t){return await(this.cacheApi?this.fetchAndAddToPersistentCache(e,t):this.fetchAndAddToInternalCache(e,t)),this.cacheStore.get(e)?.content??""}set(e,t){this.cacheStore.set(e,t)}isCached(e){return this.cacheStore.get(e)?.status===iR.LOADED}async fetchAndAddToInternalCache(e,t){const n=this.cacheStore.get(e);if(n?.status!==iR.LOADING){if(!n?.content){this.cacheStore.set(e,{content:"",status:iR.LOADING});try{const n=await sR(e,t);this.cacheStore.set(e,{content:n,status:iR.LOADED})}catch(t){throw this.cacheStore.set(e,{content:"",status:iR.FAILED}),t}}}else await this.handleLoading(e,(async()=>{this.cacheStore.set(e,{content:"",status:iR.IDLE}),await this.fetchAndAddToInternalCache(e,t)}))}async fetchAndAddToPersistentCache(e,t){const n=this.cacheStore.get(e);if(n?.status===iR.LOADED)return;if(n?.status===iR.LOADING)return void await this.handleLoading(e,(async()=>{this.cacheStore.set(e,{content:"",status:iR.IDLE}),await this.fetchAndAddToPersistentCache(e,t)}));this.cacheStore.set(e,{content:"",status:iR.LOADING});const r=await(this.cacheApi?.match(e));if(r){const t=await r.text();this.cacheStore.set(e,{content:t,status:iR.LOADED})}else try{await(this.cacheApi?.add(new Request(e,t)));const n=await(this.cacheApi?.match(e)),r=await(n?.text())??"";this.cacheStore.set(e,{content:r,status:iR.LOADED})}catch(t){throw this.cacheStore.set(e,{content:"",status:iR.FAILED}),t}}async handleLoading(e,t){let n=0;for(;this.cacheStore.get(e)?.status===iR.LOADING&&n<10;)await lR(.1),n+=1;n>=10&&await t()}keys(){return[...this.cacheStore.keys()]}data(){return[...this.cacheStore.entries()].map((([e,t])=>({[e]:t})))}async delete(e){this.cacheApi&&await this.cacheApi.delete(e),this.cacheStore.delete(e)}async clear(){if(this.cacheApi){const e=await this.cacheApi.keys();for(const t of e)await this.cacheApi.delete(t)}this.cacheStore.clear()}};function dR(e){const t=(0,Fi.useRef)();return(0,Fi.useEffect)((()=>{t.current=e})),t.current}function pR(e){const{baseURL:t,content:n,description:r,handleError:i,hash:a,preProcessor:o,title:s,uniquifyIDs:l=!1}=e;try{const e=function(e,t){if(t)return t(e);return e}(n,o),i=eR(e,{nodeOnly:!0});if(!(i&&i instanceof SVGSVGElement))throw new Error("Could not convert the src to a DOM Node");const c=hR(i,{baseURL:t,hash:a,uniquifyIDs:l});if(r){const e=c.querySelector("desc");e?.parentNode&&e.parentNode.removeChild(e);const t=document.createElementNS("http://www.w3.org/2000/svg","desc");t.innerHTML=r,c.prepend(t)}if(void 0!==s){const e=c.querySelector("title");if(e?.parentNode&&e.parentNode.removeChild(e),s){const e=document.createElementNS("http://www.w3.org/2000/svg","title");e.innerHTML=s,c.prepend(e)}}return c}catch(e){return i(e)}}function hR(e,t){const{baseURL:n="",hash:r,uniquifyIDs:i}=t,a=["id","href","xlink:href","xlink:role","xlink:arcrole"],o=["href","xlink:href"];return i?([...e.children].forEach((e=>{if(e.attributes?.length){const t=Object.values(e.attributes).map((e=>{const t=e,i=/url\((.*?)\)/.exec(e.value);return i?.[1]&&(t.value=e.value.replace(i[0],`url(${n}${i[1]}__${r})`)),t}));a.forEach((e=>{const n=t.find((t=>t.name===e));n&&!((e,t)=>o.includes(e)&&!!t&&!t.includes("#"))(e,n.value)&&(n.value=`${n.value}__${r}`)}))}return e.children.length?hR(e,t):e})),e):e}function fR(e){const{cacheRequests:t=!0,children:n=null,description:r,fetchOptions:i,innerRef:a,loader:o=null,onError:s,onLoad:l,src:c,title:u,uniqueHash:d}=e,[p,h]=(0,Fi.useReducer)(((e,t)=>({...e,...t})),{content:"",element:null,isCached:t&&cR.isCached(e.src),status:iR.IDLE}),{content:f,element:m,isCached:g,status:y}=p,b=dR(e),v=dR(p),w=(0,Fi.useRef)(d??function(e){const t="abcdefghijklmnopqrstuvwxyz",n=`${t}${t.toUpperCase()}1234567890`;let r="";for(let t=0;t<e;t++)r+=(i=n)[Math.floor(Math.random()*i.length)];var i;return r}(8)),S=(0,Fi.useRef)(!1),E=(0,Fi.useRef)(!1),x=(0,Fi.useCallback)((e=>{S.current&&(h({status:"Browser does not support SVG"===e.message?iR.UNSUPPORTED:iR.FAILED}),s?.(e))}),[s]),O=(0,Fi.useCallback)(((e,t=!1)=>{S.current&&h({content:e,isCached:t,status:iR.LOADED})}),[]),_=(0,Fi.useCallback)((async()=>{const e=await sR(c,i);O(e)}),[i,O,c]),T=(0,Fi.useCallback)((()=>{try{const t=eR(pR({...e,handleError:x,hash:w.current,content:f}));if(!t||!(0,Fi.isValidElement)(t))throw new Error("Could not convert the src to a React element");h({element:t,status:iR.READY})}catch(e){x(new Error(e.message))}}),[f,x,e]),C=(0,Fi.useCallback)((async()=>{const e=/^data:image\/svg[^,]*?(;base64)?,(.*)/u.exec(c);let n;if(e?n=e[1]?window.atob(e[2]):decodeURIComponent(e[2]):c.includes("<svg")&&(n=c),n)O(n);else try{if(t){const e=await cR.get(c,i);O(e,!0)}else await _()}catch(e){x(e)}}),[t,_,i,x,O,c]),k=(0,Fi.useCallback)((async()=>{S.current&&h({content:"",element:null,isCached:!1,status:iR.LOADING})}),[]);(0,Fi.useEffect)((()=>{if(S.current=!0,!aR()||E.current)return()=>{};try{if(y===iR.IDLE){if(!oR())throw new Error("Browser does not support SVG");if(!c)throw new Error("Missing src");k()}}catch(e){x(e)}return E.current=!0,()=>{S.current=!1}}),[]),(0,Fi.useEffect)((()=>{if(aR()&&b)if(b.src!==c){if(!c)return void x(new Error("Missing src"));k()}else b.title===u&&b.description===r||T()}),[r,T,x,k,b,c,u]),(0,Fi.useEffect)((()=>{v&&(v.status!==iR.LOADING&&y===iR.LOADING&&C(),v.status!==iR.LOADED&&y===iR.LOADED&&T(),v.status!==iR.READY&&y===iR.READY&&l?.(c,g))}),[C,T,g,l,v,c,y]);const P=function(e,...t){const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}(e,"baseURL","cacheRequests","children","description","fetchOptions","innerRef","loader","onError","onLoad","preProcessor","src","title","uniqueHash","uniquifyIDs");return aR()?m?(0,Fi.cloneElement)(m,{ref:a,...P}):[iR.UNSUPPORTED,iR.FAILED].includes(y)?n:o:o}function mR(e){cR||(cR=new uR);const{loader:t}=e,n=(0,Fi.useRef)(!1),[r,i]=(0,Fi.useState)(cR.isReady);return(0,Fi.useEffect)((()=>{n.current||(cR.onReady((()=>{i(!0)})),n.current=!0)}),[]),r?(0,Bi.jsx)(fR,{...e}):t}const gR=__webpack_require__.p+"944c737f589d02ecf603.svg",yR=__webpack_require__.p+"e79edcfbe2068fae2364.svg",bR=(e=50)=>{const[t,n]=(0,Fi.useState)({x:null,y:null});return(0,Fi.useEffect)((()=>{const t=(0,Bc.throttle)((e=>{n({x:e.clientX,y:e.clientY})}),e);return window.addEventListener("mousemove",t),()=>{window.removeEventListener("mousemove",t)}}),[e]),t},vR=({width:e="auto",height:t,show404:n=!1})=>{const r=(0,o.useTheme2)(),{x:i,y:a}=bR(),s=(0,o.useStyles2)(wR,i,a,n);return $i().createElement(mR,{src:r.isDark?gR:yR,className:s.svg,height:t,width:e})};vR.displayName="GrotNotFound";const wR=(e,t,n,r)=>{const{innerWidth:a,innerHeight:o}=window,s=n&&n/o,l=t&&t/a,c=null!==s?SR(s,-20,5):0,u=null!==l?SR(l,-5,5):0;return{svg:(0,i.css)({"#grot-404-arm, #grot-404-magnifier":{transform:`rotate(${c}deg) translateX(${u}%)`,transformOrigin:"center",transition:"transform 50ms linear"},"#grot-404-text":{display:r?"block":"none"}})}},SR=(e,t,n)=>e*(n-t)+t,ER=({message:e})=>{const t=(0,o.useStyles2)(xR);return $i().createElement("div",{className:t.container},$i().createElement(o.Box,{paddingY:8},$i().createElement(o.Stack,{direction:"column",alignItems:"center",gap:3},$i().createElement(vR,{width:300}),$i().createElement(o.Text,{variant:"h5"},e))))};function xR(){return{container:(0,i.css)({width:"100%",display:"flex",justifyContent:"space-evenly",flexDirection:"column"})}}ER.displayName="EmptyState";class OR extends vh{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(OR,"Component",(({model:e})=>{const{message:t}=e.useState();return $i().createElement(ER,{message:t})}));class _R extends vh{}function TR(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(_R,"Component",(({model:e})=>{const{message:t}=e.useState();return $i().createElement(o.Alert,{title:"Query error!",severity:"error"},t)}));var CR=function(e){return e.GRID="grid",e.ROWS="rows",e}({});class kR extends vh{getUrlState(){return{layout:this.state.layout}}updateFromUrl(e){const t={};"string"==typeof e.layout&&e.layout!==this.state.layout&&(t.layout=Object.values(CR).includes(e.layout)?e.layout:kR.DEFAULT_LAYOUT),this.setState(t)}constructor(){super({key:"layout-switcher",layout:kR.DEFAULT_LAYOUT}),TR(this,"_urlSync",new Jh(this,{keys:["layout"]})),TR(this,"onChange",(e=>{Cs("g_pyroscope_app_layout_changed",{layout:e}),this.setState({layout:e})}))}}function PR(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}TR(kR,"OPTIONS",[{label:"Grid",value:"grid"},{label:"Rows",value:"rows"}]),TR(kR,"DEFAULT_LAYOUT","grid"),TR(kR,"Component",(({model:e})=>{const{layout:t}=e.useState();return $i().createElement(o.RadioButtonGroup,{"aria-label":"Layout switcher",options:kR.OPTIONS,value:t,onChange:e.onChange,fullWidth:!1})}));class AR extends vh{getUrlState(){return{hideNoData:this.state.hideNoData}}updateFromUrl(e){const t={};"string"==typeof e.hideNoData&&e.hideNoData!==this.state.hideNoData&&(t.hideNoData=["on","off"].includes(e.hideNoData)?e.hideNoData:AR.DEFAULT_VALUE),this.setState(t)}constructor(){super({key:"no-data-switcher",hideNoData:AR.DEFAULT_VALUE}),PR(this,"_urlSync",new Jh(this,{keys:["hideNoData"]})),PR(this,"onChange",(e=>{Cs("g_pyroscope_app_hide_no_data_changed",{hideNoData:e}),this.setState({hideNoData:e})}))}}function RR(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}PR(AR,"DEFAULT_VALUE","off"),PR(AR,"Component",(({model:e})=>{const{hideNoData:t}=e.useState();return $i().createElement(o.InlineSwitch,{"data-testid":"noDataSwitcher",showLabel:!0,label:"Hide panels without data",value:"on"===t,onChange:t=>e.onChange(t.target.checked?"on":"off")})}));class DR extends vh{setPlaceholder(e){this.setState({placeholder:e})}setResultsCount(e){this.setState({resultsCount:String(e)})}getUrlState(){return{searchText:this.state.searchText}}updateFromUrl(e){const t={};"string"==typeof e.searchText&&e.searchText!==this.state.searchText&&(t.searchText=e.searchText),this.setState(t)}reset(){this.setState({placeholder:"",searchText:"",resultsCount:""})}constructor({placeholder:e}){super({key:"quick-filter",placeholder:e,searchText:DR.DEFAULT_SEARCH_TEXT,resultsCount:""}),RR(this,"_urlSync",new Jh(this,{keys:["searchText"]})),RR(this,"onChange",(e=>{this.setState({searchText:e.target.value})})),RR(this,"clearSearchText",(()=>{this.setState({searchText:""})})),RR(this,"onFocus",(()=>{Cs("g_pyroscope_app_quick_filter_focused")}))}}RR(DR,"DEFAULT_SEARCH_TEXT",""),RR(DR,"DEBOUNCE_DELAY",250),RR(DR,"Component",(({model:e})=>{const t=(0,o.useStyles2)(jR),{placeholder:n,searchText:r,resultsCount:i}=e.useState();return $i().createElement(o.Input,{type:"text",className:"quick-filter","aria-label":"Quick filter",placeholder:n,value:r,prefix:$i().createElement(o.Icon,{name:"search"}),suffix:$i().createElement($i().Fragment,null,""!==i&&$i().createElement(o.Tag,{className:t.resultsCount,name:i,colorIndex:9,"data-testid":"quick-filter-results-count"}),$i().createElement(o.IconButton,{name:"times","aria-label":"Clear search",onClick:e.clearSearchText})),onChange:e.onChange,onKeyDown:t=>{"Escape"===t.key&&e.clearSearchText()},onFocus:e.onFocus})}));const jR=e=>({resultsCount:i.css`
margin-right: ${e.spacing(1)};
border-radius: 11px;
padding: 2px 8px;
color: ${e.colors.text.primary};
background-color: ${e.colors.background.secondary};
`});function IR(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function NR(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){IR(a,r,i,o,s,"next",e)}function s(e){IR(a,r,i,o,s,"throw",e)}o(void 0)}))}}function LR(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){LR(e,t,n[t])}))}return e}class FR extends Ah{static getAllFavorites(){var e;return(null===(e=ta.get(ta.KEYS.PROFILES_EXPLORER))||void 0===e?void 0:e.favorites)||[]}static areFavoritesEqual(e,t){return e.panelType===t.panelType&&(0,Bc.isEqual)(e.queryRunnerParams,t.queryRunnerParams)}static exists(e){return FR.getAllFavorites().some((t=>FR.areFavoritesEqual(t,e)))}static addFavorite(e){const t=ta.get(ta.KEYS.PROFILES_EXPLORER);t.favorites.push(e),ta.set(ta.KEYS.PROFILES_EXPLORER,t)}static removeFavorite(e){const t=ta.get(ta.KEYS.PROFILES_EXPLORER);t.favorites=t.favorites.filter((t=>!FR.areFavoritesEqual(t,e))),ta.set(ta.KEYS.PROFILES_EXPLORER,t)}query(){return NR((function*(){return{state:r.LoadingState.Done,data:[{name:"Favories",fields:[{name:null,type:r.FieldType.other,values:[],config:{}}],length:0}]}}))()}metricFindQuery(){return NR((function*(){return FR.getAllFavorites().map((e=>{const{serviceName:t,profileMetricId:n,groupBy:r,filters:i}=e.queryRunnerParams||{},a=[t,BA(n)];return(null==r?void 0:r.label)&&a.push(r.label),(null==i?void 0:i.length)&&a.push(i.map((({key:e,operator:t,value:n})=>`${e}${t}"${n}"`)).join(", ")),{value:JSON.stringify(MR({value:JSON.stringify(e)},e)),text:a.join(" · ")}}))}))()}testDatasource(){return NR((function*(){return{status:"success",message:"OK"}}))()}constructor(){var e;super(MP.type,MP.uid);const t=ta.get(ta.KEYS.PROFILES_EXPLORER)||{};(e=t).favorites||(e.favorites=[]),t.favorites=t.favorites.map((e=>MR({panelType:cA.TIMESERIES},e))),ta.set(ta.KEYS.PROFILES_EXPLORER,t)}}function $R(e,t){const{queryRunnerParams:n}=t,r=(0,Bc.defaults)((0,Bc.clone)(n),{serviceName:sA(e,"serviceName"),profileMetricId:sA(e,"profileMetricId")}),i=nm.lookupVariable("filters",e).state.filters.map((({key:e,operator:t,value:n})=>({key:e,operator:t,value:n})));return r.filters=(0,Bc.uniqBy)([...r.filters||[],...i],(({key:e,operator:t,value:n})=>`${e}${t}${n}`)),r}function BR(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class VR extends vh{update(){this.setState({isFav:this.isStored()})}isStored(){return FR.exists(this.buildFavorite())}static buildFavorite(e){var t;const{index:n,queryRunnerParams:r,panelType:i}=e,a={index:n,queryRunnerParams:{serviceName:r.serviceName,profileMetricId:r.profileMetricId},panelType:i};return r.groupBy&&(a.queryRunnerParams.groupBy={label:r.groupBy.label}),(null===(t=r.filters)||void 0===t?void 0:t.length)&&(a.queryRunnerParams.filters=r.filters),a}buildFavorite(){const{item:e,skipVariablesInterpolation:t}=this.state;return VR.buildFavorite({index:e.index,queryRunnerParams:t?e.queryRunnerParams:$R(this,e),panelType:e.panelType})}constructor(e){super(e),BR(this,"_variableDependency",new am(this,{variableNames:["serviceName","profileMetricId","filters"],onReferencedVariableValueChanged:()=>{this.update()}})),BR(this,"onClick",(()=>{Cs("g_pyroscope_app_fav_action_clicked",{favAfterClick:!this.state.isFav}),this.state.isFav?FR.removeFavorite(this.buildFavorite()):FR.addFavorite(this.buildFavorite()),this.setState({isFav:!this.state.isFav})})),this.addActivationHandler((()=>this.update()))}}BR(VR,"Component",(({model:e})=>{const t=(0,o.useStyles2)(UR),{isFav:n}=e.useState();return $i().createElement(o.IconButton,{className:n?t.favedButton:t.notFavedbutton,name:n?"favorite":"star",variant:"secondary",size:"sm","aria-label":n?"Unfavorite":"Favorite",tooltip:n?"Unfavorite":"Favorite",tooltipPlacement:"top",onClick:e.onClick})}));const UR=()=>({favedButton:i.css`
color: #f2cc0d;
margin: 0;
`,notFavedbutton:i.css`
margin: 0;
`}),zR=function(e,t){const n=FR.exists(VR.buildFavorite(e)),r=FR.exists(VR.buildFavorite(t));return n&&r?rP(e.label,t.label):r?1:n?-1:0},qR="240px";class HR extends vh{static buildGridItemKey(e){return`grid-item-${e.index}-${e.value}`}static getGridColumnsTemplate(e){return e===CR.ROWS?"1fr":"repeat(auto-fit, minmax(400px, 1fr))"}onActivate(){const e=nm.lookupVariable(this.state.variableName,this),t=e.subscribeToState(((e,t)=>{!e.loading&&t.loading&&this.renderGridItems()}));e.update();const n=this.subscribeToRefreshClick(),r=this.subscribeToQuickFilterChange(),i=this.subscribeToLayoutChange(),a=this.subscribeToHideNoDataChange(),o=this.subscribeToFiltersChange();return()=>{o.unsubscribe(),a.unsubscribe(),i.unsubscribe(),r.unsubscribe(),n.unsubscribe(),t.unsubscribe()}}subscribeToRefreshClick(){const e=nm.lookupVariable(this.state.variableName,this),t=e.state.refresh;e.setState({refresh:r.VariableRefresh.never});const n=()=>{e.update()},i=document.querySelector('[data-testid="data-testid RefreshPicker run button"]');return i||Xi.error(new Error("SceneByVariableRepeaterGrid: Refresh button not found! The list of items will never be updated.")),null==i||i.addEventListener("click",n),null==i||i.setAttribute("title","Click to completely refresh all the panels present on the screen"),{unsubscribe(){null==i||i.removeAttribute("title"),null==i||i.removeEventListener("click",n),e.setState({refresh:t})}}}subscribeToQuickFilterChange(){const e=nm.findByKeyAndType(this,"quick-filter",DR);this.subscribeToState(((t,n)=>{t.items.length!==n.items.length&&e.setResultsCount(t.items.length)}));return e.subscribeToState((0,Bc.debounce)(((e,t)=>{e.searchText!==(null==t?void 0:t.searchText)&&this.renderGridItems()}),DR.DEBOUNCE_DELAY))}subscribeToLayoutChange(){const e=nm.findByKeyAndType(this,"layout-switcher",kR),t=this.state.body,n=(e,n)=>{e.layout!==(null==n?void 0:n.layout)&&t.setState({templateColumns:HR.getGridColumnsTemplate(e.layout)})};return n(e.state),e.subscribeToState(n)}subscribeToHideNoDataChange(){const e=nm.findByKeyAndType(this,"no-data-switcher",AR);if(!e.isActive)return this.setState({hideNoData:!1}),{unsubscribe:na};const t=(e,t)=>{e.hideNoData!==(null==t?void 0:t.hideNoData)&&(this.setState({hideNoData:"on"===e.hideNoData}),this.renderGridItems(!0))};return t(e.state),e.subscribeToState(t)}subscribeToFiltersChange(){const e=nm.findByKeyAndType(this,"filters",oA),t=nm.findByKeyAndType(this,"no-data-switcher",AR);return e.subscribeToState((()=>{"on"===t.state.hideNoData&&this.renderGridItems(!0)}))}buildItemsData(e){const{mapOptionToItem:t}=this.state,n={serviceName:sA(this,"serviceName"),profileMetricId:sA(this,"profileMetricId"),panelType:nm.findByKeyAndType(this,"panel-type-switcher",uA).state.panelType},r=e.state.options.map(((e,r)=>t(e,r,n))).filter(Boolean);return this.filterItems(r).sort(this.state.sortItemsFn)}shouldRenderItems(e){const{items:t}=this.state;return!e.length||t.length!==e.length||!(0,Bc.isEqual)(t,e)}renderGridItems(e=!1){const t=nm.lookupVariable(this.state.variableName,this);if(t.state.loading)return;if(t.state.error)return void this.renderErrorState(t.state.error);const n=this.buildItemsData(t);if(!e&&!this.shouldRenderItems(n))return;if(this.setState({items:n}),!this.state.items.length)return void this.renderEmptyState();const r=this.state.items.map((e=>{const t=WA(e.panelType,{item:e,headerActions:this.state.headerActions.bind(null,e,this.state.items)});return this.state.hideNoData&&this.setupHideNoData(t),new Bx({key:HR.buildGridItemKey(e),body:t})}));this.state.body.setState({autoRows:qR,children:r})}setupHideNoData(e){const t=e.subscribeToEvent(__,(t=>{var n;if(null===(n=t.payload.series)||void 0===n?void 0:n.length)return;const r=nm.getAncestor(e,Bx),{key:i}=r.state,a=nm.getAncestor(r,$x),o=a.state.children.filter((e=>e.state.key!==i));o.length?a.setState({children:o}):this.renderEmptyState()}));e.addActivationHandler((()=>()=>{t.unsubscribe()}))}filterItems(e){const t=nm.findByKeyAndType(this,"quick-filter",DR),{searchText:n}=t.state;if(!n)return e;const r=n.split(",").map((e=>e.trim())).filter(Boolean).map((e=>{try{return new RegExp(e)}catch(e){return null}})).filter(Boolean);return e.filter((({label:e})=>r.some((t=>t.test(e)))))}renderEmptyState(){this.state.body.setState({autoRows:"480px",children:[new Bx({body:new OR({message:"No results"})})]})}renderErrorState(e){this.state.body.setState({autoRows:"480px",children:[new Bx({body:new _R({message:e.message||e.toString()})})]})}static Component({model:e}){var t;const{body:n,variableName:r}=e.useState(),{loading:i}=null===(t=nm.lookupVariable(r,e))||void 0===t?void 0:t.useState();return i?$i().createElement(o.Spinner,null):$i().createElement(n.Component,{model:n})}constructor({key:e,variableName:t,headerActions:n,mapOptionToItem:i,sortItemsFn:a}){super({key:e,variableName:t,items:[],headerActions:n,mapOptionToItem:i,sortItemsFn:a||zR,hideNoData:!1,body:new $x({templateColumns:HR.getGridColumnsTemplate(kR.DEFAULT_LAYOUT),autoRows:qR,isLazy:!0,$behaviors:[new by({key:"metricCrosshairSync",sync:r.DashboardCursorSync.Crosshair})],children:[]})}),this.addActivationHandler(this.onActivate.bind(this))}}class GR extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(GR,"type","expand-panel");class WR extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(WR,"type","select-label");class QR extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(QR,"type","view-service-flame-graph");class KR extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(KR,"type","view-service-labels");class YR extends r.BusEventWithPayload{}function XR(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){XR(e,t,n[t])}))}return e}function ZR(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(YR,"type","view-service-profiles");const eD=new Map([["expand-panel",Object.freeze({ariaLabel:"Expand panel",icon:"expand-arrows",tooltip:()=>"Expand this panel to view all the data for the current filters",EventConstructor:GR})],["select-label",Object.freeze({label:"Select",tooltip:({queryRunnerParams:e})=>{var t;return`View "${null===(t=e.groupBy)||void 0===t?void 0:t.label}" values breakdown`},EventConstructor:WR})],["view-flame-graph",Object.freeze({label:"Flame graph",tooltip:({queryRunnerParams:e},t)=>{const n=e.serviceName||sA(t,"serviceName");return`View the "${IP(e.profileMetricId||sA(t,"profileMetricId")).type}" flame graph of ${n}`},EventConstructor:QR})],["view-labels",Object.freeze({label:"Labels",tooltip:({queryRunnerParams:e},t)=>`Explore the labels of ${e.serviceName||sA(t,"serviceName")}`,EventConstructor:KR})],["view-profiles",Object.freeze({label:"Profile types",tooltip:({queryRunnerParams:e},t)=>`View the profile types of ${e.serviceName||sA(t,"serviceName")}`,EventConstructor:YR})]]);class tD extends vh{buildEvent(){const{EventConstructor:e,item:t,skipVariablesInterpolation:n}=this.state;return new e({item:ZR(JR({},t),{queryRunnerParams:n?t.queryRunnerParams:$R(this,t)})})}constructor({type:e,item:t,tooltip:n,skipVariablesInterpolation:r}){const i=eD.get(e);if(!i)throw new TypeError(`Unknown event type="${e}"!`);super(JR({type:e,item:t},(0,Bc.merge)({},i,{tooltip:n,skipVariablesInterpolation:r}))),XR(this,"onClick",(()=>{Cs("g_pyroscope_app_select_action_clicked",{type:this.state.type}),this.publishEvent(this.buildEvent(),!0)}))}}XR(tD,"Component",(({model:e})=>{const t=(0,o.useStyles2)(nD),{ariaLabel:n,label:r,icon:i,tooltip:a,item:s}=e.useState();return $i().createElement(o.Button,{className:t.selectButton,"aria-label":n||r,variant:"primary",size:"sm",fill:"text",onClick:e.onClick,icon:i,tooltip:null==a?void 0:a(s,e),tooltipPlacement:"top"},r)}));const nD=()=>({selectButton:i.css`
margin: 0;
padding: 0;
`});class rD extends vh{onActivate(){nm.findByKeyAndType(this,"quick-filter",DR).setPlaceholder("Search services (comma-separated regexes are supported)")}getVariablesAndGridControls(){return{variables:[nm.findByKeyAndType(this,"profileMetricId",VP)],gridControls:[nm.findByKeyAndType(this,"quick-filter",DR),nm.findByKeyAndType(this,"layout-switcher",kR)]}}static Component({model:e}){const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})}constructor(){super({key:"explore-all-services",$variables:new Ow({variables:[new HP({query:HP.QUERY_PROFILE_METRIC_DEPENDENT,skipUrlSync:!0})]}),body:new HR({key:"all-services-grid",variableName:"serviceName",mapOptionToItem:(e,t,{profileMetricId:n})=>({index:t,value:e.value,label:e.label,queryRunnerParams:{serviceName:e.value,profileMetricId:n},panelType:cA.TIMESERIES}),headerActions:e=>[new tD({type:"view-profiles",item:e}),new tD({type:"view-labels",item:e}),new tD({type:"view-flame-graph",item:e}),new VR({item:e})]})}),this.addActivationHandler(this.onActivate.bind(this))}}function iD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){iD(e,t,n[t])}))}return e}function oD(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}class sD extends vh{constructor(e){super(aD({key:"drawer",isOpen:!1},e)),iD(this,"open",(({title:e,subTitle:t,body:n})=>{this.setState(oD(aD({},this.state),{isOpen:!0,title:e,subTitle:t,body:n}))})),iD(this,"close",(()=>{this.setState({isOpen:!1})}))}}function lD(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}iD(sD,"Component",(({model:e})=>{const{isOpen:t,title:n,subTitle:r,body:i}=e.useState();return $i().createElement($i().Fragment,null,i&&t&&$i().createElement(o.Drawer,{size:"lg",title:n,subtitle:r,closeOnMaskClick:!0,onClose:e.close},$i().createElement(i.Component,{model:i})))}));class cD extends pS{update(){var e,t=this;return(e=function*(){if(t.state.loading)return;let e=[],n=null;t.setState({loading:!0,options:[],error:null});try{e=yield(0,Hp.lastValueFrom)(t.getValueOptions({}))}catch(e){n=e}finally{t.setState({loading:!1,options:e,error:n})}},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){lD(a,r,i,o,s,"next",e)}function s(e){lD(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(){super({name:"favorite",label:"🔖 Favorite",datasource:MP,query:"$dataSource",loading:!0,refresh:r.VariableRefresh.never,skipUrlSync:!0})}}function uD(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}class dD extends vh{onActivate(){nm.findByKeyAndType(this,"quick-filter",DR).setPlaceholder("Search favorites (comma-separated regexes are supported)");var e=this;const t=this.subscribeToEvent(GR,function(){var t,n=(t=function*(t){e.openExpandedPanelDrawer(t.payload.item)},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){uD(a,r,i,o,s,"next",e)}function s(e){uD(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e){return n.apply(this,arguments)}}());return()=>{t.unsubscribe()}}getVariablesAndGridControls(){return{variables:[],gridControls:[nm.findByKeyAndType(this,"quick-filter",DR),nm.findByKeyAndType(this,"layout-switcher",kR),nm.findByKeyAndType(this,"no-data-switcher",AR)]}}openExpandedPanelDrawer(e){this.state.drawer.open({title:e.label,body:WA(e.panelType,{displayAllValues:!0,legendPlacement:"right",item:e,headerActions:()=>[new tD({type:"view-labels",item:e}),new tD({type:"view-flame-graph",item:e})]})})}static Component({model:e}){const{body:t,drawer:n}=e.useState();return $i().createElement($i().Fragment,null,$i().createElement(t.Component,{model:t}),$i().createElement(n.Component,{model:n}))}constructor(){super({key:"explore-favorites",$variables:new Ow({variables:[new cD]}),body:new HR({key:"favorites-grid",variableName:"favorite",mapOptionToItem:e=>{const{index:t,value:n,panelType:r,queryRunnerParams:i}=JSON.parse(e.value);return{index:t,value:n,label:e.label,queryRunnerParams:i,panelType:r}},sortItemsFn:(e,t)=>rP(e.label,t.label),headerActions:e=>{const t=[new tD({type:"view-labels",item:e,skipVariablesInterpolation:!0}),new tD({type:"view-flame-graph",item:e,skipVariablesInterpolation:!0})];return e.queryRunnerParams.groupBy&&t.push(new tD({type:"expand-panel",item:e,tooltip:()=>"Expand panel to view all the data",skipVariablesInterpolation:!0})),t.push(new VR({item:e,skipVariablesInterpolation:!0})),t}}),drawer:new sD}),this.addActivationHandler(this.onActivate.bind(this))}}function pD(e){const{ref:t,box:n,onResize:r}=e;(0,Fi.useEffect)((()=>{let e=null==t?void 0:t.current;if(e){if(void 0===window.ResizeObserver)return window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)};{const t=new window.ResizeObserver((e=>{e.length&&r()}));return t.observe(e,{box:n}),()=>{e&&t.unobserve(e)}}}}),[r,t,n])}function hD({options:e,mainLabels:t,value:n,onChange:r,onRefresh:i}){const a=(0,o.useStyles2)(fD),s=(0,o.useTheme2)(),[l,c]=(0,Fi.useState)(0),[u,d]=(0,Fi.useState)(0),p=u>l,h=(0,Fi.useRef)(null);pD({ref:h,onResize:()=>{const e=h.current;e&&d(e.clientWidth)}});const f=e.filter((e=>t.includes(e.value))),m=e.filter((e=>!t.includes(e.value)));return(0,Fi.useEffect)((()=>{const{fontSize:e}=s.typography,t=f.map((e=>e.label||e.text||"")).join(" "),n=(0,o.measureText)(t,e).width;c(n+70*f.length)}),[f,s]),$i().createElement(o.Field,{label:"Group by labels"},$i().createElement("div",{ref:h,className:a.container},p?$i().createElement($i().Fragment,null,$i().createElement(o.RadioButtonGroup,{"aria-label":"Labels selector",options:f,value:n,onChange:r}),$i().createElement(o.Select,{"aria-label":"Other labels selector",className:a.select,placeholder:"Other labels",options:m,value:n&&m.some((e=>e.value===n))?n:null,onChange:e=>{var t;return r(null!==(t=null==e?void 0:e.value)&&void 0!==t?t:"all")},isClearable:!0})):$i().createElement(o.Select,{"aria-label":"Labels selector",className:a.select,value:n,placeholder:"Select label",options:e,onChange:e=>r((null==e?void 0:e.value)||bD.DEFAULT_VALUE),isClearable:!0}),$i().createElement(o.RefreshPicker,{noIntervalPicker:!0,onRefresh:i,isOnCanvas:!1,onIntervalChanged:na,tooltip:"Click to refresh all labels"})))}const fD=e=>({container:i.css`
display: flex;
gap: ${e.spacing(1)};
`,select:i.css`
max-width: ${e.spacing(22)};
`});function mD(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function gD(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){mD(a,r,i,o,s,"next",e)}function s(e){mD(a,r,i,o,s,"throw",e)}o(void 0)}))}}function yD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class bD extends pS{onActivate(){this.state.value||this.setState({value:bD.DEFAULT_VALUE})}findCurrentOption(){const{value:e}=this.state,t=this.state.options.filter((e=>"all"!==e.value)).find((t=>JSON.parse(t.value).value===e));if(t){const e=JSON.parse(t.value);return{index:e.index,value:e.value,label:e.value,groupBy:e.groupBy}}return{index:0,value:e,label:e,groupBy:void 0}}constructor(){var e;super({key:"groupBy",name:"groupBy",label:"Group by labels",datasource:FP,query:'$dataSource and $profileMetricId{service_name="$serviceName"}',loading:!0}),e=this,yD(this,"update",gD((function*(){if(e.state.loading)return;let t=[],n=null;e.setState({loading:!0,options:[],error:null});try{t=yield(0,Hp.lastValueFrom)(e.getValueOptions({}))}catch(e){n=e}finally{e.setState({loading:!1,options:t,error:n})}}))),yD(this,"onChange",(e=>{Cs("g_pyroscope_app_group_by_label_clicked"),O_(),this.changeValueTo(e)})),this.changeValueTo=this.changeValueTo.bind(this),this.addActivationHandler(this.onActivate.bind(this))}}yD(bD,"DEFAULT_VALUE","all"),yD(bD,"MAX_MAIN_LABELS",8),yD(bD,"Component",(({model:e})=>{const t=(0,o.useStyles2)(vD),{loading:n,value:r,options:i,error:a}=e.useState(),s=(0,Fi.useMemo)((()=>i.map((({label:e,value:t})=>"all"===t?{label:e,value:t}:{label:e,value:JSON.parse(String(t)).value}))),[i]);if(n)return $i().createElement(o.Field,{label:"Group by labels"},$i().createElement(o.Spinner,{className:t.spinner}));if(a)return $i().createElement(o.Field,{label:"Group by labels"},$i().createElement("div",{className:t.groupByErrorContainer},$i().createElement(o.Tooltip,{theme:"error",content:a.toString()},$i().createElement(o.Icon,{className:t.iconError,name:"exclamation-triangle",size:"xl"})),$i().createElement(o.RefreshPicker,{noIntervalPicker:!0,onRefresh:e.update,isOnCanvas:!1,onIntervalChanged:na})));return $i().createElement(hD,{options:s,value:r,mainLabels:(e=>e.slice(0,bD.MAX_MAIN_LABELS).map((({value:e})=>e)))(s),onChange:e.onChange,onRefresh:e.update})}));const vD=e=>({spinner:i.css`
height: 32px;
line-height: 32px;
`,groupByErrorContainer:i.css`
display: flex;
`,iconError:i.css`
height: 32px;
align-self: center;
color: ${e.colors.error.text};
`});function wD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class SD extends vh{onActivate(e,t){e&&this.initVariables(e),this.setState({body:this.buildTimeseries(e,t)}),t&&this.subscribeToGroupByStateChanges(e)}initVariables(e){const{serviceName:t,profileMetricId:n,filters:r}=e.queryRunnerParams;if(t){nm.findByKeyAndType(this,"serviceName",HP).changeValueTo(t)}if(n){nm.findByKeyAndType(this,"profileMetricId",VP).changeValueTo(n)}if(r){nm.findByKeyAndType(this,"filters",oA).setState({filters:r})}}buildTimeseries(e,t){const{headerActions:n}=this.state,r={index:0,value:"",queryRunnerParams:{},label:this.buildTitle(),panelType:cA.TIMESERIES};e&&t&&(r.queryRunnerParams.groupBy=e.queryRunnerParams.groupBy);const i=nm.findByKeyAndType(this,"groupBy",bD).state.value;return new GA({item:r,headerActions:n,data:!e&&t&&i&&"all"!==i?new vw({$data:new Yg({datasource:NP,queries:[]}),transformations:[bA,vA]}):void 0})}subscribeToGroupByStateChanges(e){const t=nm.findByKeyAndType(this,"groupBy",bD);this._subs.add(t.subscribeToState(((n,r)=>{!n.loading&&n.options.length&&(e||!r.loading?n.value!==r.value&&this.onGroupByChanged(t):this.onGroupByChanged(t))})))}onGroupByChanged(e){var t;if(!e.state.value||"all"===e.state.value)return void this.resetTimeseries();const{index:n,value:r,groupBy:i}=e.findCurrentOption();null===(t=this.state.body)||void 0===t||t.updateItem({index:n,label:`${this.buildTitle()}, grouped by ${r}`,queryRunnerParams:{groupBy:i}})}resetTimeseries(e=!1){var t;e&&nm.findByKeyAndType(this,"filters",oA).reset(),null===(t=this.state.body)||void 0===t||t.updateItem({index:0,label:this.buildTitle(),queryRunnerParams:{groupBy:void 0}})}buildTitle(){const e=sA(this,"profileMetricId"),{description:t}=IP(e);return t||BA(e)}static Component({model:e}){const{body:t}=e.useState();return t&&$i().createElement(t.Component,{model:t})}constructor({item:e,headerActions:t,supportGroupBy:n}){super({headerActions:t,body:void 0}),wD(this,"_variableDependency",new am(this,{variableNames:["serviceName","profileMetricId"],onReferencedVariableValueChanged:e=>{this.resetTimeseries("serviceName"===e.state.name)}})),this.addActivationHandler(this.onActivate.bind(this,e,n))}}wD(SD,"MIN_HEIGHT",240);class ED extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(ED,"type","view-diff-flame-graph");class xD extends r.BusEventWithPayload{}function OD({option:e,checked:t,onChange:n}){var r;const a=(0,o.useStyles2)(_D),[s,l]=(0,Fi.useState)(!1),c=(0,Fi.useRef)(null),u=null===(r=c.current)||void 0===r?void 0:r.closest("label");return(0,Fi.useEffect)((()=>{if(!u||t)return void l(!1);const e=()=>{l(!0)},n=()=>{l(!1)};return u.addEventListener("mouseenter",e),u.addEventListener("mouseleave",n),()=>{u.removeEventListener("mouseleave",n),u.removeEventListener("mouseenter",e)}}),[t,u]),$i().createElement($i().Fragment,null,$i().createElement(o.Tooltip,{content:e.description,show:!t&&s,placement:"top"},$i().createElement("span",{className:a.tooltipAnchor})),$i().createElement(o.Checkbox,{ref:c,className:(0,i.cx)(a.checkbox,"checkbox",t&&"checked"),checked:t,label:e.label,onChange:()=>n(e.value)}))}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(xD,"type","select-for-compare");const _D=e=>({tooltipAnchor:i.css`
position: relative;
left: 42px;
`,checkbox:i.css`
column-gap: 4px;
&:last-child {
& :nth-child(1) {
grid-column-start: 2;
}
& :nth-child(2) {
grid-column-start: 1;
}
}
span {
color: ${e.colors.text.secondary};
}
span:hover {
color: ${e.colors.text.primary};
}
&.checked span {
color: ${e.colors.text.primary};
}
`});function TD({item:e,itemStats:t,statsDescription:n,compareActionChecks:i,onChangeCompareTarget:a}){const s=(0,o.useStyles2)(CD),{index:l,value:c}=e,u=dA(l),d=(0,Fi.useMemo)((()=>{if(!t)return $i().createElement(o.Spinner,{inline:!0});const{allValuesSum:e,unit:n}=t,{text:i,suffix:a}=(0,r.getValueFormat)(n)(e);return`${i}${a}`}),[t]),p=(0,Fi.useMemo)((()=>[{label:"Baseline",value:rp.BASELINE,description:i[0]?"":`Click to select "${c}" as baseline for comparison`},{label:"Comparison",value:rp.COMPARISON,description:i[1]?"":`Click to select "${c}" as target for comparison`}]),[i,c]);return $i().createElement("div",{className:s.container,"data-testid":`stats-panel-${c}`},$i().createElement("h1",{style:{color:u},className:s.title,title:`${n}: ${d}`},d),$i().createElement("div",{className:s.compareActions},$i().createElement(OD,{option:p[0],checked:i[0],onChange:a}),$i().createElement(OD,{option:p[1],checked:i[1],onChange:a})))}const CD=e=>({container:i.css`
display: flex;
flex-direction: column;
justify-content: space-between;
width: 100%;
background-color: ${e.colors.background.canvas};
padding: ${e.spacing(1)};
border: 1px solid ${e.colors.border.weak};
border-right: none;
border-radius: 2px 0 0 2px;
`,title:i.css`
font-size: 24px;
width: 100%;
text-align: center;
margin-top: ${e.spacing(5)};
`,compareActions:i.css`
display: flex;
justify-content: space-between;
font-size: 11px;
border-top: 1px solid ${e.colors.border.weak};
padding: ${e.spacing(1)} 0 0 0;
& .checkbox:nth-child(2) {
padding-right: 4px;
border-right: 1px solid ${e.colors.border.strong};
}
& .checkbox:nth-child(4) {
padding-left: 4px;
}
`});function kD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class PD extends vh{onActivate(){const e=nm.findByKeyAndType(this,"group-by-labels",WD).getCompare();this.updateCompareActions(e.get(rp.BASELINE),e.get(rp.COMPARISON)),this.setState({statsDescription:this.getStatsDescription()})}updateCompareActions(e,t){const{item:n}=this.state;this.setState({compareActionChecks:[(null==e?void 0:e.value)===n.value,(null==t?void 0:t.value)===n.value]})}getStatsDescription(){const e=sA(this,"profileMetricId"),{description:t}=IP(e);return t||BA(e)}getStats(){return this.state.itemStats}updateStats(e){this.setState({itemStats:e})}static Component({model:e}){const{item:t,itemStats:n,statsDescription:r,compareActionChecks:i}=e.useState();return $i().createElement(TD,{item:t,itemStats:n,statsDescription:r,compareActionChecks:i,onChangeCompareTarget:e.onChangeCompareTarget})}constructor({item:e}){super({item:e,itemStats:void 0,compareActionChecks:[!1,!1],statsDescription:""}),kD(this,"onChangeCompareTarget",(e=>{this.publishEvent(new xD({compareTarget:e,item:this.state.item}),!0)})),this.addActivationHandler(this.onActivate.bind(this))}}kD(PD,"WIDTH_IN_PIXELS",186);class AD extends vh{static buildPanelKey(e){return`compare-panel-${e.value}`}onActivate(){const{statsPanel:e,timeseriesPanel:t}=this.state,n=t.subscribeToEvent(__,(t=>{var n,r;const i=null===(n=t.payload.series)||void 0===n?void 0:n[0];if(!i)return void e.updateStats({allValuesSum:0,unit:"short"});const a=hA(i,"allValuesSum")||0;(null===(r=e.getStats())||void 0===r?void 0:r.allValuesSum)!==a&&e.updateStats({allValuesSum:a,unit:i.fields[1].config.unit||"short"})}));return()=>{n.unsubscribe()}}static Component({model:e}){const t=(0,o.useStyles2)(RD),{statsPanel:n,timeseriesPanel:r}=e.useState(),{compareActionChecks:a}=n.useState(),s=a[0]||a[1];return $i().createElement("div",{className:(0,i.cx)(t.container,s&&"selected")},$i().createElement("div",{className:t.statsPanel},$i().createElement(n.Component,{model:n})),$i().createElement("div",{className:t.timeseriesPanel},$i().createElement(r.Component,{model:r})))}constructor({item:e,headerActions:t}){super({key:"label-value-panel",statsPanel:new PD({item:e}),timeseriesPanel:new GA({item:e,headerActions:t})}),this.addActivationHandler(this.onActivate.bind(this))}}const RD=e=>({container:i.css`
display: flex;
min-width: 0px;
min-height: ${jD};
flex-flow: row;
box-sizing: border-box;
border: 1px solid transparent;
&.selected {
border: 1px solid ${e.colors.primary.main};
}
& > div {
display: flex;
position: relative;
flex-direction: row;
align-self: stretch;
min-height: ${jD};
}
`,statsPanel:i.css`
width: ${PD.WIDTH_IN_PIXELS}px;
`,timeseriesPanel:i.css`
flex-grow: 1;
& [data-viz-panel-key] > * {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
`});function DD({label:e}){const t='service_name="$serviceName"';return new Yg({datasource:NP,queries:[{refId:`$profileMetricId-${t}-${e}`,queryType:"metrics",profileTypeId:"$profileMetricId",labelSelector:`{${t}}`,groupBy:[e]}]})}const jD="160px";class ID extends vh{static buildGridItemKey(e){return`grid-item-${e.index}-${e.value}`}onActivate(){this.subscribeOnceToDataChange();const e=this.subscribeToGroupByChange(),t=this.subscribeToRefreshClick(),n=this.subscribeToQuickFilterChange(),r=this.subscribeToLayoutChange(),i=this.subscribeToHideNoDataChange(),a=this.subscribeToFiltersChange();return()=>{a.unsubscribe(),i.unsubscribe(),r.unsubscribe(),n.unsubscribe(),t.unsubscribe(),e.unsubscribe()}}subscribeOnceToDataChange(e=!1){const t=this.state.$data.subscribeToState((n=>{var i;(null===(i=n.data)||void 0===i?void 0:i.state)!==r.LoadingState.Loading&&(t.unsubscribe(),this.renderGridItems(e),this.setState({isLoading:!1}))}))}subscribeToGroupByChange(){return nm.findByKeyAndType(this,"groupBy",bD).subscribeToState(((e,t)=>{!e.loading&&t.loading&&this.refetchData()}))}subscribeToRefreshClick(){const e=()=>{this.refetchData()},t=document.querySelector('[data-testid="data-testid RefreshPicker run button"]');return t||Xi.error(new Error("SceneByVariableRepeaterGrid: Refresh button not found! The list of items will never be updated.")),null==t||t.addEventListener("click",e),null==t||t.setAttribute("title","Click to completely refresh all the panels present on the screen"),{unsubscribe(){null==t||t.removeAttribute("title"),null==t||t.removeEventListener("click",e)}}}subscribeToQuickFilterChange(){const e=nm.findByKeyAndType(this,"quick-filter",DR);this.subscribeToState(((t,n)=>{t.items.length!==n.items.length&&e.setResultsCount(t.items.length)}));return e.subscribeToState((0,Bc.debounce)(((e,t)=>{e.searchText!==(null==t?void 0:t.searchText)&&this.renderGridItems()}),DR.DEBOUNCE_DELAY))}subscribeToLayoutChange(){const e=nm.findByKeyAndType(this,"layout-switcher",kR),t=this.state.body,n=(e,n)=>{e.layout!==(null==n?void 0:n.layout)&&t.setState({templateColumns:e.layout===CR.ROWS?"1fr":"repeat(auto-fit, minmax(600px, 1fr))"})};return n(e.state),e.subscribeToState(n)}subscribeToHideNoDataChange(){const e=nm.findByKeyAndType(this,"no-data-switcher",AR);this.setState({hideNoData:"on"===e.state.hideNoData});return e.subscribeToState(((e,t)=>{e.hideNoData!==(null==t?void 0:t.hideNoData)&&(this.setState({hideNoData:"on"===e.hideNoData}),this.refetchData(!0))}))}subscribeToFiltersChange(){const e=nm.findByKeyAndType(this,"filters",oA),t=nm.findByKeyAndType(this,"no-data-switcher",AR);return e.subscribeToState((()=>{"on"===t.state.hideNoData&&this.refetchData()}))}refetchData(e=!1){this.setState({isLoading:!0,$data:new vw({$data:DD({label:this.state.label}),transformations:[bA,vA]})}),this.subscribeOnceToDataChange(e)}shouldRenderItems(e){const{items:t}=this.state;return!e.length||t.length!==e.length||!(0,Bc.isEqual)(t,e)}buildItemsData(e){const t=sA(this,"serviceName"),n=sA(this,"profileMetricId"),{label:r,startColorIndex:i,sortItemsFn:a}=this.state,o=e.map(((e,a)=>{var o;const s=e.fields[1],l=(null===(o=s.labels)||void 0===o?void 0:o[r])||"",c=pA(s,r);return{index:i+a,value:l,label:c,queryRunnerParams:{serviceName:t,profileMetricId:n,filters:[{key:r,operator:"=",value:l}]},panelType:cA.TIMESERIES}}));return this.filterItems(o).sort(a)}renderGridItems(e=!1){if(!this.state.$data.state.data)return;const{state:t,series:n,errors:i}=this.state.$data.state.data;if(t===r.LoadingState.Loading)return;if(t===r.LoadingState.Error)return void this.renderErrorState(null==i?void 0:i[0]);const a=this.buildItemsData(n);if(!e&&!this.shouldRenderItems(a))return;if(this.setState({items:a}),!this.state.items.length)return void this.renderEmptyState();const o=a.map((e=>new Bx({key:ID.buildGridItemKey(e),body:this.buildVizPanel(e)})));this.state.body.setState({autoRows:jD,children:o})}buildVizPanel(e){const t=new AD({item:e,headerActions:this.state.headerActions.bind(null,e,this.state.items)}),n=t.subscribeToEvent(__,(e=>{var n;if(!this.state.hideNoData||(null===(n=e.payload.series)||void 0===n?void 0:n.length))return;const r=nm.getAncestor(t,Bx),{key:i}=r.state,a=nm.getAncestor(r,$x),o=a.state.children.filter((e=>e.state.key!==i));o.length?a.setState({children:o}):this.renderEmptyState()}));return t.addActivationHandler((()=>()=>{n.unsubscribe()})),t}filterItems(e){const t=nm.findByKeyAndType(this,"quick-filter",DR),{searchText:n}=t.state;if(!n)return e;const r=n.split(",").map((e=>e.trim())).filter(Boolean).map((e=>{try{return new RegExp(e)}catch(e){return null}})).filter(Boolean);return e.filter((({label:e})=>r.some((t=>t.test(e)))))}renderEmptyState(){this.state.body.setState({autoRows:"480px",children:[new Bx({body:new OR({message:"No results"})})]})}renderErrorState(e){this.state.body.setState({autoRows:"480px",children:[new Bx({body:new _R({message:e.message||e.toString()})})]})}static Component({model:e}){const{body:t,isLoading:n}=e.useState();return n?$i().createElement(o.Spinner,null):$i().createElement("div",{style:{marginBottom:"2px"}},$i().createElement(t.Component,{model:t}))}constructor({key:e,label:t,startColorIndex:n,headerActions:i}){super({key:e,label:t,startColorIndex:n,items:[],isLoading:!0,$data:new vw({$data:DD({label:t}),transformations:[bA,vA]}),hideNoData:!1,headerActions:i,sortItemsFn:zR,body:new $x({templateColumns:"1fr",autoRows:jD,isLazy:!0,$behaviors:[new by({key:"metricCrosshairSync",sync:r.DashboardCursorSync.Crosshair})],children:[]})}),this.addActivationHandler(this.onActivate.bind(this))}}class ND extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(ND,"type","clear-label-from-filters");class LD extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(LD,"type","exclude-label-from-filters");class MD extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(MD,"type","include-label-in-filters");const FD=e=>{const t=(0,o.useStyles2)(BD),{include:n,exclude:r}=function({status:e,label:t,onInclude:n,onExclude:r,onClear:i}){const a="included"===e,o="excluded"===e;return{include:{isSelected:a,tooltip:a?`Clear "${t}" from the filters`:`Include "${t}" in the filters`,onClick:a?i:n},exclude:{isSelected:o,tooltip:o?`Clear "${t}" from the filters`:`Exclude "${t}" in the filters`,onClick:o?i:r}}}(e);return $i().createElement("div",{className:t.container},$i().createElement(o.Button,{size:"sm",fill:"outline",variant:n.isSelected?"primary":"secondary","aria-selected":n.isSelected,className:(0,i.cx)(t.includeButton,n.isSelected&&"selected"),onClick:n.onClick,tooltip:n.tooltip,tooltipPlacement:"top","data-testid":"filter-button-include"},"Include"),$i().createElement(o.Button,{size:"sm",fill:"outline",variant:r.isSelected?"primary":"secondary","aria-selected":r.isSelected,className:(0,i.cx)(t.excludeButton,r.isSelected&&"selected"),onClick:r.onClick,tooltip:r.tooltip,tooltipPlacement:"top","data-testid":"filter-button-exclude"},"Exclude"))},$D=(0,Fi.memo)(FD),BD=e=>({container:i.css`
display: flex;
justify-content: center;
`,includeButton:i.css`
border-radius: ${e.shape.radius.default} 0 0 ${e.shape.radius.default};
&:not(.selected) {
border-right: none;
}
`,excludeButton:i.css`
border-radius: 0 ${e.shape.radius.default} ${e.shape.radius.default} 0;
&:not(.selected) {
border-left: none;
}
`});function VD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class UD extends vh{getStatus(e){const{key:t,value:n}=this.state.item.queryRunnerParams.filters[0],r=e.find((e=>e.key===t));return r?Dk(r.operator)&&r.value.split("|").includes(n)?"=~"===r.operator?"included":"excluded":r.value===n?"="===r.operator?"included":"excluded":"clear":"clear"}constructor({item:e}){super({item:e}),VD(this,"onInclude",(()=>{Cs("g_pyroscope_app_include_action_clicked"),this.publishEvent(new MD({item:this.state.item}),!0)})),VD(this,"onExclude",(()=>{Cs("g_pyroscope_app_exclude_action_clicked"),this.publishEvent(new LD({item:this.state.item}),!0)})),VD(this,"onClear",(()=>{this.publishEvent(new ND({item:this.state.item}),!0)}))}}function zD({compare:e,onClickCompare:t,onClickClear:n}){const r=(0,o.useStyles2)(qD),a=e.size<2,s=e.size>0,l=(0,Fi.useMemo)((()=>{var t,n,r,i;return 2===e.size?`Compare "${null===(r=e.get(rp.BASELINE))||void 0===r?void 0:r.label}" vs "${null===(i=e.get(rp.COMPARISON))||void 0===i?void 0:i.label}"`:0===e.size?"Select both a baseline and a comparison panel to compare their flame graphs":e.has(rp.BASELINE)?`Select another panel to compare against "${null===(t=e.get(rp.BASELINE))||void 0===t?void 0:t.label}"`:`Select another panel to compare against "${null===(n=e.get(rp.COMPARISON))||void 0===n?void 0:n.label}"`}),[e]);return $i().createElement("div",{className:r.container},$i().createElement(o.Button,{"arial-label":"Compare",className:r.compareButton,variant:"primary",disabled:a,onClick:a?na:t,tooltip:l},"Compare (",e.size,"/2)"),$i().createElement(o.Button,{"data-testid":"clearComparison",className:(0,i.cx)(r.clearButton,a?void 0:r.clearButtonActive),icon:"times",variant:"secondary",tooltip:s?"Clear comparison selection":"",disabled:!s,onClick:s?n:na}))}VD(UD,"Component",(({model:e})=>{const{item:t}=e.useState(),{filters:n}=nm.findByKeyAndType(e,"filters",oA).useState(),r=(0,Fi.useMemo)((()=>e.getStatus(n)),[n,e]);return $i().createElement($D,{label:t.value,status:r,onInclude:e.onInclude,onExclude:e.onExclude,onClear:e.onClear})}));const qD=e=>({container:i.css`
display: flex;
align-items: center;
width: ${PD.WIDTH_IN_PIXELS}px;
`,compareButton:i.css`
width: ${PD.WIDTH_IN_PIXELS-32}px;
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
`,clearButton:i.css`
box-sizing: border-box;
width: 32px !important;
height: 32px !important;
color: ${e.colors.text.secondary};
background-color: transparent;
border-left: none !important;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
&:not([disabled]),
&:not([disabled]):hover {
background-color: transparent;
box-shadow: none;
}
`,clearButtonActive:i.css`
border-color: ${e.colors.border.medium};
&:hover {
border-color: ${e.colors.border.medium};
}
`});function HD(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function GD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class WD extends vh{onActivate(e){var t,n=this;return(t=function*(){const t=nm.findByKeyAndType(n,"groupBy",bD);yield t.update(),e&&n.initVariablesAndControls(e),n.renderBody(t);const r=n.subscribeToGroupByChange(),i=n.subscribeToPanelEvents();return()=>{var e;i.unsubscribe(),r.unsubscribe(),null===(e=n.state.panelTypeChangeSub)||void 0===e||e.unsubscribe()}},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){HD(a,r,i,o,s,"next",e)}function s(e){HD(a,r,i,o,s,"throw",e)}o(void 0)}))})()}initVariablesAndControls(e){const{queryRunnerParams:t,panelType:n}=e,{groupBy:r}=t;if(null==r?void 0:r.label){nm.findByKeyAndType(this,"groupBy",bD).changeValueTo(r.label)}if(n){nm.findByKeyAndType(this,"panel-type-switcher",uA).setState({panelType:n})}}subscribeToGroupByChange(){const e=nm.findByKeyAndType(this,"groupBy",bD),t=nm.findByKeyAndType(this,"quick-filter",DR);return e.subscribeToState(((n,r)=>{n.value!==(null==r?void 0:r.value)&&(t.clearSearchText(),this.renderBody(e))}))}subscribeToPanelEvents(){const e=this.subscribeToEvent(WR,(e=>{this.selectLabel(e.payload.item)})),t=this.subscribeToEvent(xD,(e=>{const{compareTarget:t,item:n}=e.payload;this.selectForCompare(t,n)})),n=this.subscribeToEvent(MD,(e=>{this.includeLabelValueInFilters(e.payload.item)})),r=this.subscribeToEvent(LD,(e=>{this.excludeLabelValueFromFilters(e.payload.item)})),i=this.subscribeToEvent(ND,(e=>{this.clearLabelValueFromFilters(e.payload.item)}));return{unsubscribe(){i.unsubscribe(),r.unsubscribe(),n.unsubscribe(),t.unsubscribe(),e.unsubscribe()}}}subscribeToPanelTypeChange(){return nm.findByKeyAndType(this,"panel-type-switcher",uA).subscribeToState(((e,t)=>{var n;e.panelType!==(null==t?void 0:t.panelType)&&(null===(n=this.state.body)||void 0===n||n.renderGridItems())}))}renderBody(e){var t;null===(t=this.state.panelTypeChangeSub)||void 0===t||t.unsubscribe(),"all"===e.state.value?(this.setState({panelTypeChangeSub:this.subscribeToPanelTypeChange()}),this.switchToLabelNamesGrid()):this.switchToLabelValuesGrid(e)}switchToLabelNamesGrid(){nm.findByKeyAndType(this,"quick-filter",DR).setPlaceholder("Search labels (comma-separated regexes are supported)"),this.setState({body:this.buildSceneLabelNamesGrid()})}buildSceneLabelNamesGrid(){return new HR({key:"service-labels-grid",variableName:"groupBy",mapOptionToItem:(e,t,{serviceName:n,profileMetricId:r,panelType:i})=>{if("all"===e.value)return null;const{value:a,groupBy:o}=JSON.parse(e.value);return{index:t-1,value:a,label:a,queryRunnerParams:{serviceName:n,profileMetricId:r,groupBy:o,filters:[]},panelType:i}},headerActions:e=>[new tD({type:"select-label",item:e}),new tD({type:"expand-panel",item:e}),new VR({item:e})]})}switchToLabelValuesGrid(e){nm.findByKeyAndType(this,"quick-filter",DR).setPlaceholder("Search label values (comma-separated regexes are supported)"),this.clearCompare();const{index:t,value:n}=e.findCurrentOption();this.setState({body:this.buildSceneLabelValuesGrid(n,t)})}buildSceneLabelValuesGrid(e,t){return new ID({key:"service-label-values-grid",startColorIndex:t,label:e,headerActions:e=>[new tD({type:"view-flame-graph",item:e,tooltip:(e,t)=>{const{queryRunnerParams:n,label:r}=e,i=n.profileMetricId||sA(t,"profileMetricId"),a=sA(t,"groupBy");return`View the "${IP(i).type}" flame graph for "${a}=${r}"`}}),new UD({item:e}),new VR({item:e})]})}selectLabel({queryRunnerParams:e}){const t=e.groupBy.label,n=nm.findByKeyAndType(this,"groupBy",bD);O_(),n.changeValueTo(t)}includeLabelValueInFilters(e){const[t]=e.queryRunnerParams.filters,n=nm.findByKeyAndType(this,"filters",oA);n.setState({filters:tA(n.state.filters,t)})}excludeLabelValueFromFilters(e){const t=nm.findByKeyAndType(this,"filters",oA),[n]=e.queryRunnerParams.filters;t.setState({filters:nA(t.state.filters,n)})}clearLabelValueFromFilters(e){const t=nm.findByKeyAndType(this,"filters",oA),[n]=e.queryRunnerParams.filters;t.setState({filters:rA(t.state.filters,n)})}selectForCompare(e,t){var n;const r=new Map(this.state.compare);(null===(n=r.get(e))||void 0===n?void 0:n.value)===t.value?r.delete(e):r.set(e,t),this.setState({compare:r}),this.updateStatsPanels()}updateStatsPanels(){const{compare:e}=this.state,t=e.get(rp.BASELINE),n=e.get(rp.COMPARISON),r=nm.findAllObjects(this,(e=>e instanceof PD));for(const e of r)e.updateCompareActions(t,n)}getCompare(){return this.state.compare}clearCompare(){this.setState({compare:new Map})}constructor({item:e}){super({key:"group-by-labels",body:void 0,compare:new Map,panelTypeChangeSub:void 0}),GD(this,"onClickCompareButton",(()=>{Cs("g_pyroscope_app_compare_link_clicked");const{compare:e}=this.state,{filters:t}=$R(this,e.get(rp.BASELINE)),{filters:n}=$R(this,e.get(rp.COMPARISON));this.publishEvent(new ED({useAncestorTimeRange:!0,clearDiffRange:!0,baselineFilters:t,comparisonFilters:n}),!0)})),GD(this,"onClickClearCompareButton",(()=>{this.clearCompare(),this.updateStatsPanels()})),this.addActivationHandler((()=>{this.onActivate(e)}))}}GD(WD,"Component",(({model:e})=>{const t=(0,o.useStyles2)(QD),{body:n,compare:r}=e.useState(),i=nm.findByKeyAndType(e,"groupBy",bD),{value:a}=i.useState(),s=(0,Fi.useMemo)((()=>"all"===a?nm.findByKeyAndType(e,"profiles-explorer",gV).state.gridControls:[nm.findByKeyAndType(e,"quick-filter",DR),nm.findByKeyAndType(e,"layout-switcher",kR),nm.findByKeyAndType(e,"no-data-switcher",AR)]),[a,e]);return $i().createElement("div",{className:t.container,"data-testid":"groupByLabelsContainer"},$i().createElement(i.Component,{model:i}),$i().createElement("div",{className:t.sceneControls},$i().createElement(o.Stack,{wrap:"wrap"},"all"!==a&&$i().createElement(zD,{compare:r,onClickCompare:e.onClickCompareButton,onClickClear:e.onClickClearCompareButton}),s.map((e=>$i().createElement(e.Component,{key:e.state.key,model:e}))))),n&&$i().createElement(n.Component,{model:n}))}));const QD=e=>({container:i.css`
margin-top: ${e.spacing(1)};
`,sceneControls:i.css`
margin-bottom: ${e.spacing(1)};
& .quick-filter {
flex: 1;
min-width: 112px;
}
`});function KD(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function YD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){YD(e,t,n[t])}))}return e}function JD(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}class ZD extends vh{onActivate(e){e&&this.initVariables(e);const t=nm.findByKeyAndType(this,"profileMetricId",VP);t.setState({query:VP.QUERY_SERVICE_NAME_DEPENDENT}),t.update(!0);const n=this.subscribeToPanelEvents();return()=>{n.unsubscribe(),t.setState({query:VP.QUERY_DEFAULT}),t.update(!0)}}initVariables(e){const{queryRunnerParams:t}=e,{serviceName:n,profileMetricId:r,filters:i}=t;if(n){nm.findByKeyAndType(this,"serviceName",HP).changeValueTo(n)}if(r){nm.findByKeyAndType(this,"profileMetricId",VP).changeValueTo(r)}if(i){nm.findByKeyAndType(this,"filters",oA).setState({filters:i})}}subscribeToPanelEvents(){var e=this;const t=this.subscribeToEvent(GR,function(){var t,n=(t=function*(t){e.openExpandedPanelDrawer(t.payload.item)},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){KD(a,r,i,o,s,"next",e)}function s(e){KD(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e){return n.apply(this,arguments)}}()),n=this.subscribeToEvent(WR,(()=>{this.state.drawer.close()}));return{unsubscribe(){n.unsubscribe(),t.unsubscribe()}}}getVariablesAndGridControls(){return{variables:[nm.findByKeyAndType(this,"serviceName",HP),nm.findByKeyAndType(this,"profileMetricId",VP),nm.findByKeyAndType(this,"filters",oA)],gridControls:[]}}openExpandedPanelDrawer(e){var t;const n=sA(this,"serviceName"),r=sA(this,"profileMetricId"),i=`${IP(r).description||BA(r)}, grouped by ${(null===(t=e.queryRunnerParams.groupBy)||void 0===t?void 0:t.label)||"?"}`;this.state.drawer.open({title:n,body:WA(e.panelType,{displayAllValues:!0,legendPlacement:"right",item:JD(XD({},e),{label:i}),headerActions:()=>[new tD({type:"select-label",item:e}),new VR({item:e})]})})}static Component({model:e}){const{body:t,drawer:n}=e.useState();return $i().createElement($i().Fragment,null,$i().createElement(t.Component,{model:t}),$i().createElement(n.Component,{model:n}))}constructor({item:e}){super({key:"explore-service-labels",body:new Rx({direction:"column",$behaviors:[new by({key:"metricCrosshairSync",sync:r.DashboardCursorSync.Crosshair})],children:[new Dx({minHeight:SD.MIN_HEIGHT,body:new SD({item:e,headerActions:e=>e.queryRunnerParams.groupBy?[new tD({type:"view-flame-graph",item:e}),new tD({type:"expand-panel",item:e}),new VR({item:e})]:[new tD({type:"view-flame-graph",item:e}),new VR({item:e})],supportGroupBy:!0})}),new Dx({body:new WD({item:e})})]}),drawer:new sD}),this.addActivationHandler(this.onActivate.bind(this,e))}}class ej extends vh{onActivate(e){nm.findByKeyAndType(this,"quick-filter",DR).setPlaceholder("Search profile types (comma-separated regexes are supported)"),e&&this.initVariables(e)}initVariables(e){if(e.queryRunnerParams.serviceName){nm.findByKeyAndType(this,"serviceName",HP).changeValueTo(e.queryRunnerParams.serviceName)}}getVariablesAndGridControls(){return{variables:[nm.findByKeyAndType(this,"serviceName",HP)],gridControls:[nm.findByKeyAndType(this,"quick-filter",DR),nm.findByKeyAndType(this,"layout-switcher",kR)]}}static Component({model:e}){const{body:t}=e.useState();return $i().createElement(t.Component,{model:t})}constructor({item:e}){super({key:"explore-service-profile-types",$variables:new Ow({variables:[new VP({query:VP.QUERY_SERVICE_NAME_DEPENDENT,skipUrlSync:!0})]}),body:new HR({key:"profile-metrics-grid",variableName:"profileMetricId",mapOptionToItem:(e,t,{serviceName:n})=>({index:t,value:e.value,label:e.label,queryRunnerParams:{serviceName:n,profileMetricId:e.value},panelType:cA.TIMESERIES}),headerActions:e=>[new tD({type:"view-labels",item:e}),new tD({type:"view-flame-graph",item:e}),new VR({item:e})]})}),this.addActivationHandler(this.onActivate.bind(this,e))}}function tj(e,t){return{from:e,to:t,value:{from:(0,r.dateTimeParse)(e),to:(0,r.dateTimeParse)(t),raw:{from:e,to:t}}}}const nj=()=>tj("now-30m","now");class rj extends Dw{reset(){this.setState({value:void 0})}constructor(){super({key:"spanSelector",name:"spanSelector",label:"Span selector",value:void 0})}}function ij(e,t){if(t){const n=e.services.get(t)||new Map;return Array.from(n.values()).sort(((e,t)=>rP(t.group,e.group))).map((({id:e,type:t,group:n})=>({value:e,text:`${t} (${n})`})))}return Array.from(e.profileMetrics.keys()).map((e=>IP(e))).sort(((e,t)=>rP(t.group,e.group))).map((({id:e,type:t,group:n})=>({value:e,text:`${t} (${n})`})))}function aj(e,t){if(t){const n=e.profileMetrics.get(t)||new Set;return Array.from(n).sort(rP).map((e=>({text:e,value:e})))}return Array.from(e.services.keys()).sort(rP).map((e=>({text:e,value:e})))}class oj{static build(e,t){const n=`${e}-${t.name}`,r=oj.cache.get(n);if(r instanceof t)return r;const i=new t({dataSourceUid:e});return oj.cache.set(n,i),i}}function sj(e){let t,n;for(const{name:r,value:i}of e)if("service_name"===r&&(t=i),"__profile_type__"===r&&(n=i),t&&n)return[t,n];return[]}function lj(e){const t=new Map,n=new Map;if(!e.labelsSet)return Xi.warn("Pyroscope SeriesApiClient: no data received!"),{services:t,profileMetrics:n};for(const{labels:r}of e.labelsSet){const[e,i]=sj(r);if(!e||!i){Xi.warn('Pyroscope ServicesApiClient: "service_name" and/or "__profile_type__" are missing in the labels received!',r);continue}const a=t.get(e)||new Map;a.set(i,IP(i)),t.set(e,a);const o=n.get(i)||new Set;o.add(e),n.set(i,o)}return{services:t,profileMetrics:n}}function cj(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(oj,"cache",new Map);class uj extends NC{list(e){var t,n=this;return(t=function*(){const{from:t,to:r}=e;return n.fetch("/querier.v1.QuerierService/Series",{method:"POST",body:JSON.stringify({start:t,end:r,labelNames:["service_name","__profile_type__"],matchers:[]})}).then((e=>e.json())).then(lj)},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){cj(a,r,i,o,s,"next",e)}function s(e){cj(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(e){super(e)}}function dj(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}const pj=new class extends UC{list(e){var t,n=this;return(t=function*(){const{from:t,to:r}=kA(e.timeRange),i=[n.apiClient.baseUrl,t,r],a=n.cacheClient.get(i);if(a){const{services:e,profileMetrics:t}=yield a;return e.size||t.size||n.cacheClient.delete(i),{services:e,profileMetrics:t}}const o=n.apiClient.list({from:t,to:r});n.cacheClient.set(i,o);try{const{services:e,profileMetrics:t}=yield o;return{services:e,profileMetrics:t}}catch(e){throw n.cacheClient.delete(i),e}},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){dj(a,r,i,o,s,"next",e)}function s(e){dj(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(e){super(e)}}({cacheClient:new $C});function hj(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function fj(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){hj(a,r,i,o,s,"next",e)}function s(e){hj(a,r,i,o,s,"throw",e)}o(void 0)}))}}class mj extends Ah{fetchSeries(e,t,n){return fj((function*(){pj.setApiClient(oj.build(e,uj));try{return yield pj.list({timeRange:t})}catch(e){throw Xi.error(e,{info:"Error while loading Pyroscope series!",variableName:n||""}),e}}))()}query(){return fj((function*(){return{state:r.LoadingState.Done,data:[{name:"PyroscopeSeries",fields:[{name:"PyroscopeSeries",type:r.FieldType.other,values:[],config:{}}],length:0}]}}))()}metricFindQuery(e,t){var n=this;return fj((function*(){var r,i,a;const o=null===(i=t.scopedVars)||void 0===i||null===(r=i.__sceneObject)||void 0===r?void 0:r.value,s=nm.interpolate(o,"$dataSource"),l=nm.interpolate(o,"$serviceName"),c=nm.interpolate(o,"$profileMetricId"),u=yield n.fetchSeries(s,t.range,null===(a=t.variable)||void 0===a?void 0:a.name);switch(e){case"$dataSource and all services":return aj(u);case"$dataSource and all profile metrics":return ij(u);case"$dataSource and only $profileMetricId services":return aj(u,c);case"$dataSource and only $serviceName profile metrics":return ij(u,l);default:throw new TypeError(`Unsupported query "${e}"!`)}}))()}testDatasource(){return fj((function*(){return{status:"success",message:"OK"}}))()}constructor(){super(LP.type,LP.uid)}}class gj extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(gj,"type","enable-sync-timeranges");class yj extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(yj,"type","sync-refresh");class bj extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(bj,"type","sync-timeranges");class vj extends tx{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(vj,"Component",(function({model:e}){const{hidePicker:t,isOnCanvas:n}=e.useState(),r=nm.getTimeRange(e),i=r.getTimeZone(),a=r.useState();return t?null:$i().createElement(o.TimeRangePicker,{isOnCanvas:null==n||n,value:a.value,onChange:r.onTimeRangeChange,timeZone:i,fiscalYearStartMonth:a.fiscalYearStartMonth,onMoveBackward:e.onMoveBackward,onMoveForward:e.onMoveForward,onZoom:e.onZoom,onChangeTimeZone:r.onTimeZoneChange,onChangeFiscalYearStartMonth:e.onChangeFiscalYearStartMonth,isSynced:!1})}));const wj=/^\d+[yYmMsSwWhHdD]$/;function Sj(e){if("string"!=typeof e)return null;if(-1!==e.indexOf("now"))return e;if(wj.test(e))return e;if(8===e.length){const t=(0,r.toUtc)(e,"YYYYMMDD");if(t.isValid())return t.toISOString()}else if(15===e.length){const t=(0,r.toUtc)(e,"YYYYMMDDTHHmmss");if(t.isValid())return t.toISOString()}else if(24===e.length){return(0,r.toUtc)(e).toISOString()}const t=parseInt(e,10);return isNaN(t)?null:(0,r.toUtc)(t).toISOString()}function Ej(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xj(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}class Oj extends r.MutableDataFrame{addRange(e){this.add(xj(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ej(e,t,n[t])}))}return e}({},e),{isRegion:!0}))}constructor(){super(),[{name:"time",type:r.FieldType.time},{name:"timeEnd",type:r.FieldType.time},{name:"isRegion",type:r.FieldType.boolean},{name:"color",type:r.FieldType.other},{name:"text",type:r.FieldType.string}].forEach((e=>this.addField(e)))}}function _j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){_j(e,t,n[t])}))}return e}function Cj(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}var kj=function(e){return e.ANNOTATIONS="annotations",e.DEFAULT="default",e}({});const Pj={from:(0,r.dateTime)(0),to:(0,r.dateTime)(0),raw:{from:"",to:""}};class Aj extends vh{onActivate(){var e;this.setState((0,Bc.omit)(this.getAncestorTimeRange().state,"key")),this._subs.add(this.getAncestorTimeRange().subscribeToState((e=>{this.setState((0,Bc.omit)(e,"key"))}))),this._subs.add(null===(e=this.getTimeseries().state.$data)||void 0===e?void 0:e.subscribeToState(((e,t)=>{var n,i,a,o,s,l;e.data&&e.data.state===r.LoadingState.Done&&((null===(n=e.data.annotations)||void 0===n?void 0:n.length)||(null===(a=t.data)||void 0===a||null===(i=a.annotations)||void 0===i?void 0:i.length)?!(null===(o=e.data.annotations)||void 0===o?void 0:o.length)&&(null===(l=t.data)||void 0===l||null===(s=l.annotations)||void 0===s?void 0:s.length)&&(e.data.annotations=t.data.annotations):this.updateTimeseriesAnnotation())})))}getAncestorTimeRange(){if(!this.parent||!this.parent.parent)throw new Error(typeof this+" must be used within $timeRange scope");return nm.getTimeRange(this.parent.parent)}getTimeseries(){try{const e=nm.getAncestor(this,pb);if("timeseries"!==e.state.pluginId)throw new TypeError("Incorrect VizPanel type!");return e}catch(e){throw new Error("Ancestor timeseries panel not found!")}}updateTimeseriesAnnotation(){const{annotationTimeRange:e,annotationColor:t,annotationTitle:n}=this.state,{$data:r}=this.getTimeseries().state,i=null==r?void 0:r.state.data;if(!i)return;const a=new Oj;a.addRange({color:t,text:n,time:1e3*e.from.unix(),timeEnd:1e3*e.to.unix()}),null==r||r.setState({data:Cj(Tj({},i),{annotations:[a]})})}setAnnotationTimeRange(e,t=!1){this.setState({annotationTimeRange:e}),t&&this.updateTimeseriesAnnotation()}nullifyAnnotationTimeRange(){this.setAnnotationTimeRange(Pj)}getUrlState(){const{annotationTimeRange:e}=this.state;return{diffFrom:"string"==typeof e.raw.from?e.raw.from:e.raw.from.toISOString(),diffTo:"string"==typeof e.raw.to?e.raw.to:e.raw.to.toISOString()}}updateFromUrl(e){const{diffFrom:t,diffTo:n}=e;if(!n&&!t)return;const{annotationTimeRange:r}=this.state;var i,a;this.setAnnotationTimeRange(this.buildAnnotationTimeRange(null!==(i=Sj(t))&&void 0!==i?i:r.from,null!==(a=Sj(n))&&void 0!==a?a:r.to))}buildAnnotationTimeRange(e,t){return function(e,t,n,i,a){const o=a&&"now"===t;return{from:r.dateMath.parse(e,!1,n,i),to:r.dateMath.parse(o?"now-"+a:t,!0,n,i),raw:{from:e,to:t}}}(e,t,this.getTimeZone(),this.state.fiscalYearStartMonth,this.state.UNSAFE_nowDelay)}onTimeRangeChange(e){const{mode:t}=this.state;"default"!==t?this.setAnnotationTimeRange(e,!0):this.getAncestorTimeRange().onTimeRangeChange(e)}onTimeZoneChange(e){this.getAncestorTimeRange().onTimeZoneChange(e)}getTimeZone(){return this.getAncestorTimeRange().getTimeZone()}onRefresh(){this.getAncestorTimeRange().onRefresh()}constructor(e){super(Tj({from:Pj.raw.from,to:Pj.raw.to,value:Pj,annotationTimeRange:Pj},e)),_j(this,"_variableDependency",new am(this,{variableNames:["dataSource","serviceName"],onReferencedVariableValueChanged:()=>{this.nullifyAnnotationTimeRange(),this.updateTimeseriesAnnotation()}})),_j(this,"_urlSync",new Jh(this,{keys:["diffFrom","diffTo"]})),this.addActivationHandler(this.onActivate.bind(this))}}class Rj extends r.BusEventWithPayload{}function Dj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Rj,"type","switch-timerange-selection-mode");var jj=function(e){return e.TIMEPICKER="timepicker",e.FLAMEGRAPH="flame-graph",e}({});class Ij extends vh{constructor(){super({mode:"flame-graph"}),Dj(this,"onChange",(e=>{this.setState({mode:e}),this.publishEvent(new Rj({mode:e}),!0)}))}}Dj(Ij,"OPTIONS",[{label:"Time picker",value:"timepicker"},{label:"Flame graph",value:"flame-graph"}]),Dj(Ij,"Component",(({model:e})=>{const t=(0,o.useStyles2)(Nj),{mode:n}=e.useState();return $i().createElement("div",{className:t.container},$i().createElement("label",{className:t.label},$i().createElement("span",null,"Range selection mode "),$i().createElement(o.Tooltip,{content:$i().createElement("div",{className:t.tooltip},$i().createElement("div",null,"Use these buttons to change the behaviour when selecting a range with the mouse on the time series:"),$i().createElement("dl",null,$i().createElement("dt",null,"Time picker"),$i().createElement("dd",null,"Time range zoom in (default behaviour)"),$i().createElement("dt",null,"Flame graph"),$i().createElement("dd",null,"Time range for building the flame graph (the stack traces will be retrieved only for the selected range)"))),placement:"top"},$i().createElement(o.Icon,{name:"question-circle"}))),$i().createElement(o.RadioButtonGroup,{size:"sm",options:Ij.OPTIONS,value:n,onChange:e.onChange,"aria-label":"Range selection mode"}))}));const Nj=e=>({container:i.css`
display: flex;
flex-direction: column;
`,tooltip:i.css`
padding: ${e.spacing(1)};
& dl {
margin-top: ${e.spacing(2)};
display: grid;
grid-gap: ${e.spacing(1)} ${e.spacing(2)};
grid-template-columns: max-content;
}
& dt {
font-weight: bold;
}
& dd {
margin: 0;
grid-column-start: 2;
}
`,label:i.css`
font-size: 12px;
text-align: right;
margin-bottom: 2px;
color: ${e.colors.text.secondary};
`});function Lj({filterKey:e}){return mA(new Yg({datasource:NP,queries:[{refId:`$profileMetricId-$serviceName-${e}}`,queryType:"metrics",profileTypeId:"$profileMetricId",labelSelector:`{service_name="$serviceName",$${e}}`}]}))}var Mj=__webpack_require__(4308),Fj=__webpack_require__.n(Mj);const $j={COLOR:Fj()("#d066d4"),OVERLAY:Fj()("#d066d4").alpha(.3)},Bj={COLOR:Fj()("#1398f6"),OVERLAY:Fj()("#1398f6").alpha(.3)};function Vj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Vj(e,t,n[t])}))}return e}class zj extends vh{onActivate(e,t,n){const{$timeRange:r,timeseriesPanel:i,filterKey:a}=this.state;if(t&&this.setDiffRange(null),e&&r.setState((0,Bc.omit)(this.getAncestorTimeRange().state,"key")),n.length){nm.findByKey(this,a).setState({filters:n})}i.updateItem({label:this.buildTimeseriesTitle()});const o=this.subscribeToEvents();return()=>{o.unsubscribe()}}static buildTimeSeriesPanel({target:e,filterKey:t,title:n,color:i}){const a=new GA({item:{index:0,value:e,label:"",queryRunnerParams:{},panelType:cA.TIMESERIES},data:new vw({$data:Lj({filterKey:t}),transformations:[bA,vA]}),overrides:e=>e.map((e=>{const t=e.fields[1],n=hA(e,"allValuesSum")||0,o=(0,r.getValueFormat)(t.config.unit)(n),s=`${o.text}${o.suffix}`,[l,c,u]=zj.getDiffRange(a),d=l&&c?`Total = ${s} / Flame graph range = ${(0,r.dateTimeFormat)(l,{format:r.systemDateFormats.fullDate,timeZone:u})} → ${(0,r.dateTimeFormat)(c,{format:r.systemDateFormats.fullDate,timeZone:u})}`:`Total = ${s}`;return{matcher:{id:r.FieldMatcherID.byFrameRefID,options:e.refId},properties:[{id:"displayName",value:d},{id:"color",value:{mode:"fixed",fixedColor:i}}]}})),headerActions:()=>[new Ij]});return a.state.body.setState({$timeRange:new Aj({key:`${e}-annotation-timerange`,mode:kj.ANNOTATIONS,annotationColor:e===rp.BASELINE?$j.OVERLAY.toString():Bj.OVERLAY.toString(),annotationTitle:`${n} flame graph range`})}),a}static getDiffRange(e){var t,n,r,i;let a,o;const s=null===(r=e.state.body.state.$data)||void 0===r||null===(n=r.state.data)||void 0===n||null===(t=n.annotations)||void 0===t?void 0:t[0];return null==s||s.fields.some((({name:e,values:t})=>(a="time"===e?t[0]:a,o="timeEnd"===e?t[0]:o,a&&o))),[a,o,null===(i=e.state.$timeRange)||void 0===i?void 0:i.state.timeZone]}getAncestorTimeRange(){if(!this.parent||!this.parent.parent)throw new Error(typeof this+" must be used within $timeRange scope");return nm.getTimeRange(this.parent.parent)}subscribeToEvents(){const{target:e,timeseriesPanel:t,$timeRange:n}=this.state,r=t.state.body.state.$timeRange,i=this.subscribeToEvent(Rj,(e=>{r.setState({mode:e.payload.mode===jj.FLAMEGRAPH?kj.ANNOTATIONS:kj.DEFAULT})})),a=r.subscribeToState(((t,n)=>{this.state.timeRangeSyncEnabled&&t.annotationTimeRange!==n.annotationTimeRange&&this.publishEvent(new bj({source:e,annotationTimeRange:t.annotationTimeRange}),!0)})),o=n.subscribeToState(((t,n)=>{t.from===n.from&&t.to===n.to||(this.updateTitle(""),this.state.timeRangeSyncEnabled&&this.publishEvent(new bj({source:e,timeRange:t}),!0))}));return{unsubscribe(){o.unsubscribe(),a.unsubscribe(),i.unsubscribe()}}}buildTimeseriesTitle(){const e=sA(this,"profileMetricId"),{description:t}=IP(e);return t||BA(e)}useDiffTimeRange(){return this.state.timeseriesPanel.state.body.state.$timeRange.useState()}applyPreset({from:e,to:t,diffFrom:n,diffTo:r,label:i}){this.setDiffRange({from:n,to:r}),this.setTimeRange(tj(e,t)),this.updateTitle(i)}setTimeRange(e){const{from:t,to:n}=this.state.$timeRange.state.value;t.isSame(e.value.from)&&n.isSame(e.value.to)||this.state.$timeRange.setState({from:e.from,to:e.to,value:e.value})}setDiffRange(e){const t=this.state.timeseriesPanel.state.body.state.$timeRange;if(null===e)return void t.nullifyAnnotationTimeRange();const{annotationTimeRange:n}=t.state,r=t.buildAnnotationTimeRange(e.from,e.to);n.from.isSame(r.from)&&n.to.isSame(r.to)||t.setAnnotationTimeRange(r,!0)}autoSelectDiffRange(e){const{$timeRange:t,target:n}=this.state,{from:i,to:a}=t.state.value;if(this.updateTitle(""),e)return void this.setDiffRange({from:i.toISOString(),to:a.toISOString()});const o=a.diff(i),s=Math.min(Math.round(.25*o),864e5);n===rp.BASELINE?this.setDiffRange({from:i.toISOString(),to:(0,r.dateTime)(i).add(s).toISOString()}):this.setDiffRange({from:(0,r.dateTime)(a).subtract(s).toISOString(),to:a.toISOString()})}updateTitle(e=""){const t=this.state.target===rp.BASELINE?"Baseline":"Comparison",n=e?`${t} (${e})`:t;this.setState({title:n})}toggleTimeRangeSync(e){this.setState({timeRangeSyncEnabled:e})}refreshTimeseries(){this.state.$timeRange.onRefresh()}constructor({target:e,useAncestorTimeRange:t,clearDiffRange:n,filters:r}){const i=e===rp.BASELINE?"filtersBaseline":"filtersComparison",a=e===rp.BASELINE?"Baseline":"Comparison",o=e===rp.BASELINE?$j.COLOR.toString():Bj.COLOR.toString();super({key:`${e}-panel`,target:e,filterKey:i,title:a,color:o,$timeRange:new lf(Uj({key:`${e}-panel-timerange`},tj("now-1h","now"))),timePicker:new vj({isOnCanvas:!0}),refreshPicker:new px({isOnCanvas:!0}),timeseriesPanel:zj.buildTimeSeriesPanel({target:e,filterKey:i,title:a,color:o}),timeRangeSyncEnabled:!1}),Vj(this,"_variableDependency",new am(this,{variableNames:["profileMetricId"],onReferencedVariableValueChanged:()=>{this.state.timeseriesPanel.updateItem({label:this.buildTimeseriesTitle()})}})),Vj(this,"onClickTimeRangeSync",(()=>{const{target:e,timeRangeSyncEnabled:t,$timeRange:n,timeseriesPanel:r}=this.state,i=r.state.body.state.$timeRange;this.publishEvent(new gj({source:e,enable:!t,timeRange:n.state,annotationTimeRange:i.state.annotationTimeRange}),!0)})),Vj(this,"onClickRefresh",(()=>{this.publishEvent(new yj({source:this.state.target}),!0)})),this.addActivationHandler(this.onActivate.bind(this,t,n,r))}}Vj(zj,"Component",(({model:e})=>{const{target:t,color:n,title:r,timeseriesPanel:a,timePicker:s,refreshPicker:l,filterKey:c,timeRangeSyncEnabled:u}=e.useState(),d=(0,o.useStyles2)(qj,n),p=nm.findByKey(e,c);return $i().createElement("div",{className:d.panel,"data-testid":`panel-${t}`},$i().createElement("div",{className:d.panelHeader},$i().createElement("h6",null,$i().createElement("div",{className:d.colorCircle}),r),$i().createElement("div",{className:d.timeControls},$i().createElement(s.Component,{model:s}),$i().createElement("div",{onClick:e.onClickRefresh},$i().createElement(l.Component,{model:l})),$i().createElement(o.IconButton,{className:(0,i.cx)(d.syncButton,u&&"active"),name:"link","aria-label":u?"Unsync time ranges":"Sync time ranges",tooltip:u?"Unsync time ranges":"Sync time ranges",onClick:e.onClickTimeRangeSync}))),$i().createElement("div",{className:d.filter},$i().createElement(p.Component,{model:p})),$i().createElement("div",{className:d.timeseries},a&&$i().createElement(a.Component,{model:a})))}));const qj=(e,t)=>({panel:i.css`
background-color: ${e.colors.background.primary};
padding: ${e.spacing(1)} ${e.spacing(1)} 0 ${e.spacing(1)};
border: 1px solid ${e.colors.border.weak};
border-radius: 2px;
`,panelHeader:i.css`
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: ${e.spacing(2)};
flex-wrap: wrap;
& > h6 {
font-size: 15px;
height: 32px;
line-height: 32px;
margin: 0 ${e.spacing(1)} 0 0;
}
`,colorCircle:i.css`
display: inline-block;
background-color: ${t};
border-radius: 50%;
width: 9px;
height: 9px;
margin-right: 6px;
`,timeControls:i.css`
display: flex;
justify-content: flex-end;
gap: 4px;
`,syncButton:i.css`
z-index: unset;
padding: ${e.spacing(0,1)};
margin: 0;
background: ${e.colors.secondary.main};
border: 1px solid ${e.colors.secondary.border};
border-radius: ${e.shape.radius.default};
&:hover {
background: ${e.colors.secondary.shade};
}
&.active {
color: ${e.colors.primary.text};
border: 1px solid ${e.colors.primary.text};
}
`,filter:i.css`
display: flex;
margin-bottom: ${e.spacing(3)};
`,timeseries:i.css`
height: 200px;
& [data-viz-panel-key] > * {
border: 0 none;
}
& [data-viz-panel-key] [data-testid='uplot-main-div'] {
cursor: crosshair;
}
`});function Hj(){const[e,t]=(0,Fi.useState)(null),[n,r]=(0,Fi.useState)();return{onOpen(e){r((()=>e))},isOpen:t=>t===e,open(e){t(e),null==n||n()},close(){t(null)}}}var Gj=class extends P{#x;#C=void 0;#K;#Y;constructor(e,t){super(),this.#x=e,this.setOptions(t),this.bindMethods(),this.#X()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#x.defaultMutationOptions(e),v(this.options,t)||this.#x.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#K,observer:this}),t?.mutationKey&&this.options.mutationKey&&g(t.mutationKey)!==g(this.options.mutationKey)?this.reset():"pending"===this.#K?.state.status&&this.#K.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#K?.removeObserver(this)}onMutationUpdate(e){this.#X(),this.#H(e)}getCurrentResult(){return this.#C}reset(){this.#K?.removeObserver(this),this.#K=void 0,this.#X(),this.#H()}mutate(e,t){return this.#Y=t,this.#K?.removeObserver(this),this.#K=this.#x.getMutationCache().build(this.#x,this.options),this.#K.addObserver(this),this.#K.execute(e)}#X(){const e=this.#K?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#C={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#H(e){k.batch((()=>{if(this.#Y&&this.hasListeners()){const t=this.#C.variables,n=this.#C.context;"success"===e?.type?(this.#Y.onSuccess?.(e.data,t,n),this.#Y.onSettled?.(e.data,null,t,n)):"error"===e?.type&&(this.#Y.onError?.(e.error,t,n),this.#Y.onSettled?.(void 0,e.error,t,n))}this.listeners.forEach((e=>{e(this.#C)}))}))}};function Wj(e,t){const n=Ui(t),[r]=Fi.useState((()=>new Gj(n,e)));Fi.useEffect((()=>{r.setOptions(e)}),[r,e]);const i=Fi.useSyncExternalStore(Fi.useCallback((e=>r.subscribe(k.batchCalls(e))),[r]),(()=>r.getCurrentResult()),(()=>r.getCurrentResult())),a=Fi.useCallback(((e,t)=>{r.mutate(e,t).catch(Ea)}),[r]);if(i.error&&Sa(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}const Qj=Object.freeze({collapsedFlamegraphs:!1,maxNodes:16384,enableFlameGraphDotComExport:!0,enableFunctionDetails:!0,enableMetricsFromProfiles:!1});function Kj(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Yj(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){Kj(a,r,i,o,s,"next",e)}function s(e){Kj(a,r,i,o,s,"throw",e)}o(void 0)}))}}class Xj extends ua{get(){var e=this,t=()=>super.fetch;return Yj((function*(){return t().call(e,"/settings.v1.SettingsService/Get",{method:"POST",body:JSON.stringify({})}).then((e=>e.json())).then((e=>{var t;const n=null===(t=e.settings)||void 0===t?void 0:t.find((({name:e})=>e===Xj.PLUGIN_SETTING_NAME));return n?JSON.parse(n.value):{}}))}))()}set(e){var t=this,n=()=>super.fetch;return Yj((function*(){return n().call(t,"/settings.v1.SettingsService/Set",{method:"POST",body:JSON.stringify({setting:{name:Xj.PLUGIN_SETTING_NAME,value:JSON.stringify(e)}})}).then((e=>e.json()))}))()}}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Xj,"PLUGIN_SETTING_NAME","pluginSettings");const Jj=()=>new Xj;function Zj({enabled:e}={}){const t=Jj(),{isFetching:n,error:r,data:i}=Pa({enabled:e,queryKey:["settings","ds-uid-"+ua.selectDefaultDataSource().uid],queryFn:()=>t.get().then((e=>Object.keys(Qj).reduce(((e,t)=>{var n,r,i;return null!==(i=(n=e)[r=t])&&void 0!==i||(n[r]=Qj[t]),e}),e)))}),{mutateAsync:a}=Wj({mutationFn:e=>t.set(e),networkMode:"always"});return{isFetching:n,error:t.isAbortError(r)?null:r,settings:i,mutate:a}}function eI({severity:e,title:t,message:n,error:r,errorContext:i}){return r&&Xi.error(r,i),$i().createElement(o.Alert,{title:t,severity:e},r&&$i().createElement($i().Fragment,null,r.message,$i().createElement("br",null)),n)}const tI={RadioButton:{container:"data-testid radio-button"},Breadcrumbs:{breadcrumb:e=>`data-testid ${e} breadcrumb`},TimePicker:{openButton:"data-testid TimePicker Open Button",overlayContent:"data-testid TimePicker Overlay Content",fromField:"data-testid Time Range from field",toField:"data-testid Time Range to field",applyTimeRange:"data-testid TimePicker submit button",copyTimeRange:"data-testid TimePicker copy button",pasteTimeRange:"data-testid TimePicker paste button",calendar:{label:"data-testid Time Range calendar",openButton:"data-testid Open time range calendar",closeButton:"data-testid Close time range Calendar"},absoluteTimeRangeTitle:"data-testid-absolute-time-range-narrow"},DataSourcePermissions:{form:()=>'form[name="addPermission"]',roleType:"Role to add new permission to",rolePicker:"Built-in role picker",permissionLevel:"Permission Level"},DateTimePicker:{input:"data-testid date-time-input"},DataSource:{TestData:{QueryTab:{scenarioSelectContainer:"Test Data Query scenario select container",scenarioSelect:"Test Data Query scenario select",max:"TestData max",min:"TestData min",noise:"TestData noise",seriesCount:"TestData series count",spread:"TestData spread",startValue:"TestData start value",drop:"TestData drop values"}},DataSourceHttpSettings:{urlInput:"data-testid Datasource HTTP settings url"},Jaeger:{traceIDInput:"Trace ID"},Prometheus:{configPage:{connectionSettings:"Data source connection URL",manageAlerts:"prometheus-alerts-manager",scrapeInterval:"data-testid scrape interval",queryTimeout:"data-testid query timeout",defaultEditor:"data-testid default editor",disableMetricLookup:"disable-metric-lookup",prometheusType:"data-testid prometheus type",prometheusVersion:"data-testid prometheus version",cacheLevel:"data-testid cache level",incrementalQuerying:"prometheus-incremental-querying",queryOverlapWindow:"data-testid query overlap window",disableRecordingRules:"disable-recording-rules",customQueryParameters:"data-testid custom query parameters",httpMethod:"data-testid http method",exemplarsAddButton:"data-testid Add exemplar config button",internalLinkSwitch:"data-testid Internal link switch"},queryEditor:{explain:"data-testid prometheus explain switch wrapper",editorToggle:"data-testid QueryEditorModeToggle",options:"data-testid prometheus options",legend:"data-testid prometheus legend wrapper",format:"data-testid prometheus format",step:"prometheus-step",type:"data-testid prometheus type",exemplars:"prometheus-exemplars",builder:{metricSelect:"data-testid metric select",hints:"data-testid prometheus hints",metricsExplorer:"data-testid metrics explorer",queryAdvisor:"data-testid query advisor"},code:{queryField:"data-testid prometheus query field",metricsBrowser:{openButton:"data-testid open metrics browser",selectMetric:"data-testid select a metric",metricList:"data-testid metric list",labelNamesFilter:"data-testid label names filter",labelValuesFilter:"data-testid label values filter",useQuery:"data-testid use query",useAsRateQuery:"data-testid use as rate query",validateSelector:"data-testid validate selector",clear:"data-testid clear"}}},exemplarMarker:"data-testid Exemplar marker",variableQueryEditor:{queryType:"data-testid query type",labelnames:{metricRegex:"data-testid label names metric regex"},labelValues:{labelSelect:"data-testid label values label select"},metricNames:{metricRegex:"data-testid metric names metric regex"},varQueryResult:"data-testid variable query result",seriesQuery:"data-testid prometheus series query",classicQuery:"data-testid prometheus classic query"},annotations:{minStep:"prometheus-annotation-min-step",title:"data-testid prometheus annotation title",tags:"data-testid prometheus annotation tags",text:"data-testid prometheus annotation text",seriesValueAsTimestamp:"data-testid prometheus annotation series value as timestamp"}}},Menu:{MenuComponent:e=>`${e} menu`,MenuGroup:e=>`${e} menu group`,MenuItem:e=>`${e} menu item`,SubMenu:{container:"data-testid SubMenu container",icon:"data-testid SubMenu icon"}},Panels:{Panel:{title:e=>`data-testid Panel header ${e}`,headerItems:e=>`data-testid Panel header item ${e}`,menuItems:e=>`data-testid Panel menu item ${e}`,menu:e=>`data-testid Panel menu ${e}`,containerByTitle:e=>`${e} panel`,headerCornerInfo:e=>`Panel header ${e}`,status:e=>`data-testid Panel status ${e}`,loadingBar:()=>"Panel loading bar",HoverWidget:{container:"data-testid hover-header-container",dragIcon:"data-testid drag-icon"},PanelDataErrorMessage:"data-testid Panel data error message"},Visualization:{Graph:{container:"Graph container",VisualizationTab:{legendSection:"Legend section"},Legend:{legendItemAlias:e=>`gpl alias ${e}`,showLegendSwitch:"gpl show legend"},xAxis:{labels:()=>"div.flot-x-axis > div.flot-tick-label"}},BarGauge:{value:"Bar gauge value",valueV2:"data-testid Bar gauge value"},PieChart:{svgSlice:"data testid Pie Chart Slice"},Text:{container:()=>".markdown-html"},Table:{header:"table header",footer:"table-footer",body:"data-testid table body"}}},VizLegend:{seriesName:e=>`data-testid VizLegend series ${e}`},Drawer:{General:{title:e=>`Drawer title ${e}`,expand:"Drawer expand",contract:"Drawer contract",close:"data-testid Drawer close",rcContentWrapper:()=>".rc-drawer-content-wrapper",subtitle:"data-testid drawer subtitle"}},PanelEditor:{General:{content:"Panel editor content"},OptionsPane:{content:"Panel editor option pane content",select:"Panel editor option pane select",fieldLabel:e=>`${e} field property editor`},DataPane:{content:"Panel editor data pane content"},applyButton:"data-testid Apply changes and go back to dashboard",toggleVizPicker:"data-testid toggle-viz-picker",toggleVizOptions:"data-testid toggle-viz-options",toggleTableView:"toggle-table-view",showZoomField:"Map controls Show zoom control field property editor",showAttributionField:"Map controls Show attribution field property editor",showScaleField:"Map controls Show scale field property editor",showMeasureField:"Map controls Show measure tools field property editor",showDebugField:"Map controls Show debug field property editor",measureButton:"show measure tools"},PanelInspector:{Data:{content:"Panel inspector Data content"},Stats:{content:"Panel inspector Stats content"},Json:{content:"Panel inspector Json content"},Query:{content:"Panel inspector Query content",refreshButton:"Panel inspector Query refresh button",jsonObjectKeys:()=>".json-formatter-key"}},Tab:{title:e=>`Tab ${e}`,active:()=>'[class*="-activeTabStyle"]'},RefreshPicker:{runButton:"RefreshPicker run button",intervalButton:"RefreshPicker interval button",runButtonV2:"data-testid RefreshPicker run button",intervalButtonV2:"data-testid RefreshPicker interval button"},QueryTab:{content:"Query editor tab content",queryInspectorButton:"Query inspector button",queryHistoryButton:"data-testid query-history-button",addQuery:"data-testid query-tab-add-query"},QueryHistory:{queryText:"Query text"},QueryEditorRows:{rows:"Query editor row"},QueryEditorRow:{actionButton:e=>`data-testid ${e}`,title:e=>`Query editor row title ${e}`,container:e=>`Query editor row ${e}`},AlertTab:{content:"data-testid Alert editor tab content"},Alert:{alert:e=>`Alert ${e}`,alertV2:e=>`data-testid Alert ${e}`},TransformTab:{content:"data-testid Transform editor tab content",newTransform:e=>`data-testid New transform ${e}`,transformationEditor:e=>`data-testid Transformation editor ${e}`,transformationEditorDebugger:e=>`data-testid Transformation editor debugger ${e}`},Transforms:{card:e=>`data-testid New transform ${e}`,disableTransformationButton:"data-testid Disable transformation button",Reduce:{modeLabel:"data-testid Transform mode label",calculationsLabel:"data-testid Transform calculations label"},SpatialOperations:{actionLabel:"root Action field property editor",locationLabel:"root Location Mode field property editor",location:{autoOption:"Auto location option",coords:{option:"Coords location option",latitudeFieldLabel:"root Latitude field field property editor",longitudeFieldLabel:"root Longitude field field property editor"},geohash:{option:"Geohash location option",geohashFieldLabel:"root Geohash field field property editor"},lookup:{option:"Lookup location option",lookupFieldLabel:"root Lookup field field property editor",gazetteerFieldLabel:"root Gazetteer field property editor"}}},searchInput:"data-testid search transformations",noTransformationsMessage:"data-testid no transformations message",addTransformationButton:"data-testid add transformation button",removeAllTransformationsButton:"data-testid remove all transformations button"},NavBar:{Configuration:{button:"Configuration"},Toggle:{button:"data-testid Toggle menu"},Reporting:{button:"Reporting"}},NavMenu:{Menu:"data-testid navigation mega-menu",item:"data-testid Nav menu item"},NavToolbar:{container:"data-testid Nav toolbar"},PageToolbar:{container:()=>".page-toolbar",item:e=>`${e}`,itemButton:e=>`data-testid ${e}`},QueryEditorToolbarItem:{button:e=>`QueryEditor toolbar item button ${e}`},BackButton:{backArrow:"data-testid Go Back"},OptionsGroup:{group:e=>e?`Options group ${e}`:"Options group",toggle:e=>e?`Options group ${e} toggle`:"Options group toggle"},PluginVisualization:{item:e=>`Plugin visualization item ${e}`,current:()=>'[class*="-currentVisualizationItem"]'},Select:{option:"Select option",input:()=>'input[id*="time-options-input"]',singleValue:()=>'div[class*="-singleValue"]'},FieldConfigEditor:{content:"Field config editor content"},OverridesConfigEditor:{content:"Field overrides editor content"},FolderPicker:{container:"Folder picker select container",containerV2:"data-testid Folder picker select container",input:"data-testid folder-picker-input"},ReadonlyFolderPicker:{container:"data-testid Readonly folder picker select container"},DataSourcePicker:{container:"data-testid Data source picker select container",input:()=>'input[id="data-source-picker"]',inputV2:"data-testid Select a data source",dataSourceList:"data-testid Data source list dropdown",advancedModal:{dataSourceList:"data-testid Data source list",builtInDataSourceList:"data-testid Built in data source list"}},TimeZonePicker:{container:"Time zone picker select container",containerV2:"data-testid Time zone picker select container"},WeekStartPicker:{container:"Choose starting day of the week",containerV2:"data-testid Choose starting day of the week",placeholder:"Choose starting day of the week"},TraceViewer:{spanBar:"data-testid SpanBar--wrapper"},QueryField:{container:"data-testid Query field"},QueryBuilder:{queryPatterns:"data-testid Query patterns",labelSelect:"data-testid Select label",valueSelect:"data-testid Select value",matchOperatorSelect:"data-testid Select match operator"},ValuePicker:{button:e=>`data-testid Value picker button ${e}`,select:e=>`data-testid Value picker select ${e}`},Search:{section:"Search section",sectionV2:"data-testid Search section",items:"Search items",itemsV2:"data-testid Search items",cards:"data-testid Search cards",collapseFolder:e=>`data-testid Collapse folder ${e}`,expandFolder:e=>`data-testid Expand folder ${e}`,dashboardItem:e=>`${tI.Search.dashboardItems} ${e}`,dashboardCard:e=>`data-testid Search card ${e}`,folderHeader:e=>`data-testid Folder header ${e}`,folderContent:e=>`data-testid Folder content ${e}`,dashboardItems:"data-testid Dashboard search item"},DashboardLinks:{container:"data-testid Dashboard link container",dropDown:"data-testid Dashboard link dropdown",link:"data-testid Dashboard link"},LoadingIndicator:{icon:"data-testid Loading indicator"},CallToActionCard:{button:e=>`Call to action button ${e}`,buttonV2:e=>`data-testid Call to action button ${e}`},DataLinksContextMenu:{singleLink:"data-testid Data link"},CodeEditor:{container:"data-testid Code editor container"},DashboardImportPage:{textarea:"data-testid-import-dashboard-textarea",submit:"data-testid-load-dashboard"},ImportDashboardForm:{name:"data-testid-import-dashboard-title",submit:"data-testid-import-dashboard-submit"},PanelAlertTabContent:{content:"data-testid Unified alert editor tab content"},VisualizationPreview:{card:e=>`data-testid suggestion-${e}`},ColorSwatch:{name:"data-testid-colorswatch"},DashboardRow:{title:e=>`data-testid dashboard-row-title-${e}`},UserProfile:{profileSaveButton:"data-testid-user-profile-save",preferencesSaveButton:"data-testid-shared-prefs-save",orgsTable:"data-testid-user-orgs-table",sessionsTable:"data-testid-user-sessions-table",extensionPointTabs:"data-testid-extension-point-tabs",extensionPointTab:e=>`data-testid-extension-point-tab-${e}`},FileUpload:{inputField:"data-testid-file-upload-input-field",fileNameSpan:"data-testid-file-upload-file-name"},DebugOverlay:{wrapper:"debug-overlay"},OrgRolePicker:{input:"Role"},AnalyticsToolbarButton:{button:"Dashboard insights"},Variables:{variableOption:"data-testid variable-option"},Annotations:{annotationsTypeInput:"annotations-type-input",annotationsChoosePanelInput:"choose-panels-input"},Tooltip:{container:"data-testid tooltip"}},nI={pages:{Login:{url:"/login",username:"data-testid Username input field",password:"data-testid Password input field",submit:"data-testid Login button",skip:"data-testid Skip change password button"},Home:{url:"/"},DataSource:{name:"data-testid Data source settings page name input field",delete:"Data source settings page Delete button",readOnly:"data-testid Data source settings page read only message",saveAndTest:"data-testid Data source settings page Save and Test button",alert:"data-testid Data source settings page Alert"},DataSources:{url:"/datasources",dataSources:e=>`Data source list item ${e}`},EditDataSource:{url:e=>`/datasources/edit/${e}`,settings:"Datasource settings page basic settings"},AddDataSource:{url:"/datasources/new",dataSourcePlugins:e=>`Data source plugin item ${e}`,dataSourcePluginsV2:e=>`Add new data source ${e}`},ConfirmModal:{delete:"data-testid Confirm Modal Danger Button"},AddDashboard:{url:"/dashboard/new",itemButton:e=>`data-testid ${e}`,addNewPanel:"Add new panel",addNewRow:"Add new row",addNewPanelLibrary:"Add new panel from panel library"},Dashboard:{url:e=>`/d/${e}`,DashNav:{nav:"Dashboard navigation",navV2:"data-testid Dashboard navigation",publicDashboardTag:"data-testid public dashboard tag",shareButton:"data-testid share-button"},SubMenu:{submenu:"Dashboard submenu",submenuItem:"data-testid template variable",submenuItemLabels:e=>`data-testid Dashboard template variables submenu Label ${e}`,submenuItemValueDropDownValueLinkTexts:e=>`data-testid Dashboard template variables Variable Value DropDown value link text ${e}`,submenuItemValueDropDownDropDown:"Variable options",submenuItemValueDropDownOptionTexts:e=>`data-testid Dashboard template variables Variable Value DropDown option text ${e}`,Annotations:{annotationsWrapper:"data-testid annotation-wrapper",annotationLabel:e=>`data-testid Dashboard annotations submenu Label ${e}`,annotationToggle:e=>`data-testid Dashboard annotations submenu Toggle ${e}`}},Settings:{Actions:{close:"data-testid dashboard-settings-close"},General:{deleteDashBoard:"Dashboard settings page delete dashboard button",sectionItems:e=>`Dashboard settings section item ${e}`,saveDashBoard:"Dashboard settings aside actions Save button",saveAsDashBoard:"Dashboard settings aside actions Save As button",timezone:"Time zone picker select container",title:"Tab General"},Annotations:{List:{addAnnotationCTA:tI.CallToActionCard.button("Add annotation query"),addAnnotationCTAV2:tI.CallToActionCard.buttonV2("Add annotation query"),annotations:"data-testid list-annotations"},Settings:{name:"Annotations settings name input"},NewAnnotation:{panelFilterSelect:"data-testid annotations-panel-filter",showInLabel:"show-in-label",previewInDashboard:"data-testid annotations-preview",delete:"data-testid annotations-delete",apply:"data-testid annotations-apply",enable:"data-testid annotation-enable",hide:"data-testid annotation-hide"}},Variables:{List:{addVariableCTA:tI.CallToActionCard.button("Add variable"),addVariableCTAV2:tI.CallToActionCard.buttonV2("Add variable"),newButton:"Variable editor New variable button",table:"Variable editor Table",tableRowNameFields:e=>`Variable editor Table Name field ${e}`,tableRowDefinitionFields:e=>`Variable editor Table Definition field ${e}`,tableRowArrowUpButtons:e=>`Variable editor Table ArrowUp button ${e}`,tableRowArrowDownButtons:e=>`Variable editor Table ArrowDown button ${e}`,tableRowDuplicateButtons:e=>`Variable editor Table Duplicate button ${e}`,tableRowRemoveButtons:e=>`Variable editor Table Remove button ${e}`},Edit:{General:{headerLink:"Variable editor Header link",modeLabelNew:"Variable editor Header mode New",modeLabelEdit:"Variable editor Header mode Edit",generalNameInput:"Variable editor Form Name field",generalNameInputV2:"data-testid Variable editor Form Name field",generalTypeSelect:"Variable editor Form Type select",generalTypeSelectV2:"data-testid Variable editor Form Type select",generalLabelInput:"Variable editor Form Label field",generalLabelInputV2:"data-testid Variable editor Form Label field",generalHideSelect:"Variable editor Form Hide select",generalHideSelectV2:"data-testid Variable editor Form Hide select",selectionOptionsMultiSwitch:"data-testid Variable editor Form Multi switch",selectionOptionsIncludeAllSwitch:"data-testid Variable editor Form IncludeAll switch",selectionOptionsCustomAllInput:"data-testid Variable editor Form IncludeAll field",previewOfValuesOption:"data-testid Variable editor Preview of Values option",submitButton:"data-testid Variable editor Run Query button",applyButton:"data-testid Variable editor Apply button"},QueryVariable:{queryOptionsDataSourceSelect:tI.DataSourcePicker.inputV2,queryOptionsRefreshSelect:"Variable editor Form Query Refresh select",queryOptionsRefreshSelectV2:"data-testid Variable editor Form Query Refresh select",queryOptionsRegExInput:"Variable editor Form Query RegEx field",queryOptionsRegExInputV2:"data-testid Variable editor Form Query RegEx field",queryOptionsSortSelect:"Variable editor Form Query Sort select",queryOptionsSortSelectV2:"data-testid Variable editor Form Query Sort select",queryOptionsQueryInput:"data-testid Variable editor Form Default Variable Query Editor textarea",valueGroupsTagsEnabledSwitch:"Variable editor Form Query UseTags switch",valueGroupsTagsTagsQueryInput:"Variable editor Form Query TagsQuery field",valueGroupsTagsTagsValuesQueryInput:"Variable editor Form Query TagsValuesQuery field"},ConstantVariable:{constantOptionsQueryInput:"Variable editor Form Constant Query field",constantOptionsQueryInputV2:"data-testid Variable editor Form Constant Query field"},DatasourceVariable:{datasourceSelect:"data-testid datasource variable datasource type"},TextBoxVariable:{textBoxOptionsQueryInput:"Variable editor Form TextBox Query field",textBoxOptionsQueryInputV2:"data-testid Variable editor Form TextBox Query field"},CustomVariable:{customValueInput:"data-testid custom-variable-input"},IntervalVariable:{intervalsValueInput:"data-testid interval variable intervals input",autoEnabledCheckbox:"data-testid interval variable auto value checkbox",stepCountIntervalSelect:"data-testid interval variable step count input",minIntervalInput:"data-testid interval variable mininum interval input"},GroupByVariable:{dataSourceSelect:tI.DataSourcePicker.inputV2,infoText:"data-testid group by variable info text",modeToggle:"data-testid group by variable mode toggle"},AdHocFiltersVariable:{datasourceSelect:tI.DataSourcePicker.inputV2,infoText:"data-testid ad-hoc filters variable info text"}}}},Annotations:{marker:"data-testid annotation-marker"},Rows:{Repeated:{ConfigSection:{warningMessage:"data-testid Repeated rows warning message"}}}},Dashboards:{url:"/dashboards",dashboards:e=>`Dashboard search item ${e}`},SaveDashboardAsModal:{newName:"Save dashboard title field",save:"Save dashboard button"},SaveDashboardModal:{save:"Dashboard settings Save Dashboard Modal Save button",saveVariables:"Dashboard settings Save Dashboard Modal Save variables checkbox",saveTimerange:"Dashboard settings Save Dashboard Modal Save timerange checkbox"},SharePanelModal:{linkToRenderedImage:"Link to rendered image"},ShareDashboardModal:{PublicDashboard:{Tab:"Tab Public dashboard",WillBePublicCheckbox:"data-testid public dashboard will be public checkbox",LimitedDSCheckbox:"data-testid public dashboard limited datasources checkbox",CostIncreaseCheckbox:"data-testid public dashboard cost may increase checkbox",PauseSwitch:"data-testid public dashboard pause switch",EnableAnnotationsSwitch:"data-testid public dashboard on off switch for annotations",CreateButton:"data-testid public dashboard create button",DeleteButton:"data-testid public dashboard delete button",CopyUrlInput:"data-testid public dashboard copy url input",CopyUrlButton:"data-testid public dashboard copy url button",SettingsDropdown:"data-testid public dashboard settings dropdown",TemplateVariablesWarningAlert:"data-testid public dashboard disabled template variables alert",UnsupportedDataSourcesWarningAlert:"data-testid public dashboard unsupported data sources alert",NoUpsertPermissionsWarningAlert:"data-testid public dashboard no upsert permissions alert",EnableTimeRangeSwitch:"data-testid public dashboard on off switch for time range",EmailSharingConfiguration:{Container:"data-testid email sharing config container",ShareType:"data-testid public dashboard share type",EmailSharingInput:"data-testid public dashboard email sharing input",EmailSharingInviteButton:"data-testid public dashboard email sharing invite button",EmailSharingList:"data-testid public dashboard email sharing list",DeleteEmail:"data-testid public dashboard delete email button",ReshareLink:"data-testid public dashboard reshare link button"}}},PublicDashboard:{page:"public-dashboard-page",NotAvailable:{container:"public-dashboard-not-available",title:"public-dashboard-title",pausedDescription:"public-dashboard-paused-description"}},RequestViewAccess:{form:"request-view-access-form",recipientInput:"request-view-access-recipient-input",submitButton:"request-view-access-submit-button"},PublicDashboardConfirmAccess:{submitButton:"data-testid confirm-access-submit-button"},Explore:{url:"/explore",General:{container:"data-testid Explore",graph:"Explore Graph",table:"Explore Table",scrollView:"data-testid explorer scroll view"}},SoloPanel:{url:e=>`/d-solo/${e}`},PluginsList:{page:"Plugins list page",list:"Plugins list",listItem:"Plugins list item",signatureErrorNotice:"data-testid Unsigned plugins notice"},PluginPage:{page:"Plugin page",signatureInfo:"data-testid Plugin signature info",disabledInfo:"data-testid Plugin disabled info"},PlaylistForm:{name:"Playlist name",interval:"Playlist interval",itemDelete:"data-testid playlist-form-delete-item"},BrowseDashboards:{table:{body:"data-testid browse-dashboards-table",row:e=>`data-testid browse dashboards row ${e}`,checkbox:e=>`data-testid ${e} checkbox`},NewFolderForm:{form:"data-testid new folder form",nameInput:"data-testid new-folder-name-input",createButton:"data-testid new-folder-create-button"}},Search:{url:"/?search=openn",FolderView:{url:"/?search=open&layout=folders"}},PublicDashboards:{ListItem:{linkButton:"public-dashboard-link-button",configButton:"public-dashboard-configuration-button",trashcanButton:"public-dashboard-remove-button",pauseSwitch:"data-testid public dashboard pause switch"}},UserListPage:{tabs:{allUsers:"data-testid all-users-tab",orgUsers:"data-testid org-users-tab",anonUserDevices:"data-testid anon-user-devices-tab",publicDashboardsUsers:"data-testid public-dashboards-users-tab",users:"data-testid users-tab"},org:{url:"/org/users"},admin:{url:"/admin/users"},publicDashboards:{container:"data-testid public-dashboards-users-list"},UserListAdminPage:{container:"data-testid user-list-admin-page"},UsersListPage:{container:"data-testid users-list-page"},UserAnonListPage:{container:"data-testid user-anon-list-page"},UsersListPublicDashboardsPage:{container:"data-testid users-list-public-dashboards-page",DashboardsListModal:{listItem:e=>`data-testid dashboards-list-item-${e}`}}},ProfilePage:{url:"/profile"}},components:tI};function rI({children:e,delay:t}){const[n,r]=(0,Fi.useState)(!1);return(0,Fi.useEffect)((()=>{window.setTimeout((()=>{r(!0)}),t)}),[e,t]),$i().createElement($i().Fragment,null,n?e:null)}function iI({menu:e,title:t,placement:n="bottom",offset:r,dragClassCancel:a,menuButtonClass:s,onVisibleChange:l,onOpenMenu:c}){const u=t?nI.components.Panels.Panel.menu(t):"panel-menu-button",d=(0,Fi.useCallback)((e=>(e&&c&&c(),l)),[c,l]),p=t?`Menu for panel with title ${t}`:"Menu for panel with no title";return $i().createElement(o.Dropdown,{overlay:e,placement:n,offset:r,onVisibleChange:d},$i().createElement(o.ToolbarButton,{"aria-label":p,title:"Menu",icon:"ellipsis-v",iconSize:"md",narrow:!0,"data-testid":u,className:(0,i.cx)(s,a)}))}function aI({menu:e,title:t,dragClass:n,children:r,offset:a=-32,onOpenMenu:s}){const l=(0,o.useStyles2)(oI),c=(0,Fi.useRef)(null),u=nI.components.Panels.Panel.HoverWidget,d=(0,Fi.useCallback)((e=>{var t;null===(t=c.current)||void 0===t||t.setPointerCapture(e.pointerId)}),[]),p=(0,Fi.useCallback)((e=>{var t;null===(t=c.current)||void 0===t||t.releasePointerCapture(e.pointerId)}),[]),[h,f]=(0,Fi.useState)(!1);return void 0===r||0===$i().Children.count(r)?null:$i().createElement("div",{className:(0,i.cx)(l.container,{"show-on-hover":!h}),style:{top:`${a}px`},"data-testid":u.container},n&&$i().createElement("div",{className:(0,i.cx)(l.square,l.draggable,n),onPointerDown:d,onPointerUp:p,ref:c,"data-testid":u.dragIcon},$i().createElement(o.Icon,{name:"expand-arrows",className:l.draggableIcon})),!t&&$i().createElement("h6",{className:(0,i.cx)(l.untitled,{[l.draggable]:!!n},n)},"Untitled"),r,e&&$i().createElement(iI,{menu:e,title:t,placement:"bottom",menuButtonClass:l.menuButton,onVisibleChange:f,onOpenMenu:s}))}function oI(e){return{hidden:(0,i.css)({visibility:"hidden",opacity:"0"}),container:(0,i.css)({label:"hover-container-widget",transition:"all .1s linear",display:"flex",position:"absolute",zIndex:1,right:0,boxSizing:"content-box",alignItems:"center",background:e.colors.background.secondary,color:e.colors.text.primary,border:`1px solid ${e.colors.border.weak}`,borderRadius:e.shape.radius.default,height:e.spacing(4),boxShadow:e.shadows.z1}),square:(0,i.css)({display:"flex",justifyContent:"center",alignItems:"center",width:e.spacing(4),height:"100%"}),draggable:(0,i.css)({cursor:"move",[e.breakpoints.down("md")]:{display:"none"}}),menuButton:(0,i.css)({background:"inherit",border:"none","&:hover":{background:e.colors.secondary.main}}),untitled:(0,i.css)({color:e.colors.text.disabled,fontStyle:"italic",padding:e.spacing(0,1),marginBottom:0}),draggableIcon:(0,i.css)({transform:"rotate(45deg)",color:e.colors.text.secondary,"&:hover":{color:e.colors.text.primary}})}}function sI(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lI(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){sI(e,t,n[t])}))}return e}function cI(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function uI(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}const dI=(0,Fi.forwardRef)(((e,t)=>{var{className:n,children:r,href:a,onClick:s,target:l,title:c}=e,u=uI(e,["className","children","href","onClick","target","title"]);const d=(0,o.useStyles2)(pI);return a?$i().createElement("a",lI({ref:t,href:a,onClick:s,target:l,title:c,className:(0,i.cx)(d.linkItem,n)},u),r):s?$i().createElement(o.Button,{ref:t,className:(0,i.cx)(d.item,n),variant:"secondary",fill:"text",onClick:s},r):$i().createElement("span",lI({ref:t,className:(0,i.cx)(d.item,n)},u),r)}));dI.displayName="TitleItem";const pI=e=>{const t=(0,i.css)({color:`${e.colors.text.secondary}`,label:"panel-header-item",cursor:"auto",border:"none",borderRadius:`${e.shape.radius.default}`,padding:`${e.spacing(0,1)}`,height:`${e.spacing(e.components.panel.headerHeight)}`,display:"flex",alignItems:"center",justifyContent:"center","&:focus, &:focus-visible":cI(lI({},hI(e)),{zIndex:1}),"&: focus:not(:focus-visible)":{outline:"none",boxShadow:"none"},"&:hover ":{boxShadow:`${e.shadows.z1}`,background:`${e.colors.background.secondary}`,color:`${e.colors.text.primary}`}});return{item:t,linkItem:(0,i.cx)(t,(0,i.css)({cursor:"pointer"}))}};function hI(e){return{outline:"2px dotted transparent",outlineOffset:"2px",boxShadow:`0 0 0 2px ${e.colors.background.canvas}, 0 0 0px 4px ${e.colors.primary.main}`,transitionTimingFunction:"cubic-bezier(0.19, 1, 0.22, 1)",transitionDuration:"0.2s",transitionProperty:"outline, outline-offset, box-shadow"}}function fI({description:e,className:t}){const n=(0,o.useStyles2)(mI);return""!==e?$i().createElement(o.Tooltip,{interactive:!0,content:()=>{const t="function"==typeof e?e():e;return $i().createElement("div",{className:"panel-info-content markdown-html"},$i().createElement("div",{dangerouslySetInnerHTML:{__html:t}}))}},$i().createElement(dI,{className:(0,i.cx)(t,n.description)},$i().createElement(o.Icon,{name:"info-circle",size:"md"}))):null}const mI=()=>({description:(0,i.css)({code:{whiteSpace:"normal",wordWrap:"break-word"},"pre > code":{display:"block"}})});function gI({message:e,onClick:t,ariaLabel:n="status"}){const r=(0,o.useStyles2)(yI);return $i().createElement(o.ToolbarButton,{className:r.buttonStyles,onClick:t,variant:"destructive",icon:"exclamation-triangle",iconSize:"md",tooltip:e||"","aria-label":n})}const yI=e=>{const{headerHeight:t,padding:n}=e.components.panel;return{buttonStyles:(0,i.css)({label:"panel-header-state-button",display:"flex",alignItems:"center",justifyContent:"center",padding:e.spacing(n),width:e.spacing(t),height:e.spacing(t),borderRadius:e.shape.radius.default})}};function bI({children:e,padding:t="md",title:n="",description:a="",displayMode:s="default",titleItems:l,menu:c,dragClass:u,dragClassCancel:d,hoverHeader:p=!1,hoverHeaderOffset:h,loadingState:f,statusMessage:m,statusMessageOnClick:g,actions:y,onCancelQuery:b,onOpenMenu:v}){const w=(0,o.useTheme2)(),S=(0,o.useStyles2)(EI),[E,x]=(0,Fi.useState)(0),O=(0,Fi.useRef)(null);(0,Fi.useEffect)((()=>{O.current&&x(O.current.offsetWidth)}),[O]);const _=!p,T=wI(w,_),{contentStyle:C}=SI(t,w),k={height:T,cursor:u?"move":"auto"},P={};"transparent"===s&&(P.backgroundColor="transparent",P.border="none");const A=n?nI.components.Panels.Panel.title(n):"Panel",R=$i().createElement($i().Fragment,null,n&&$i().createElement("h6",{title:n,className:S.title},n),$i().createElement("div",{className:(0,i.cx)(S.titleItems,d),"data-testid":"title-items-container"},$i().createElement(fI,{description:a,className:d}),l),f===r.LoadingState.Streaming&&$i().createElement(o.Tooltip,{content:b?"Stop streaming":"Streaming"},$i().createElement(dI,{className:d,"data-testid":"panel-streaming",onClick:b},$i().createElement(o.Icon,{name:"circle-mono",size:"md",className:S.streaming}))),f===r.LoadingState.Loading&&b&&$i().createElement(rI,{delay:2e3},$i().createElement(o.Tooltip,{content:"Cancel query"},$i().createElement(dI,{className:(0,i.cx)(d,S.pointer),"data-testid":"panel-cancel-query",onClick:b},$i().createElement(o.Icon,{name:"sync-slash",size:"md"})))),$i().createElement("div",{className:S.rightAligned},y&&$i().createElement("div",{className:S.rightActions},vI(y,(e=>e)))));return $i().createElement("div",{className:S.container,style:P,"data-testid":A},$i().createElement("div",{className:S.loadingBarContainer},f===r.LoadingState.Loading?$i().createElement(o.LoadingBar,{width:E,ariaLabel:"Panel loading bar"}):null),p&&$i().createElement($i().Fragment,null,$i().createElement(aI,{menu:c,title:n,offset:h,dragClass:u,onOpenMenu:v},R),m&&$i().createElement("div",{className:S.errorContainerFloating},$i().createElement(gI,{message:m,onClick:g,ariaLabel:"Panel status"}))),_&&$i().createElement("div",{className:(0,i.cx)(S.headerContainer,u),style:k,"data-testid":"header-container"},m&&$i().createElement("div",{className:d},$i().createElement(gI,{message:m,onClick:g,ariaLabel:"Panel status"})),R,c&&$i().createElement(iI,{menu:c,title:n,placement:"bottom-end",menuButtonClass:(0,i.cx)(S.menuItem,d,"show-on-hover"),onOpenMenu:v})),$i().createElement("div",{className:S.content,style:C,ref:O},e))}const vI=(e,t)=>{const n=$i().Children.toArray(e).filter(Boolean);return n.length>0?t(n):null},wI=(e,t)=>t?e.spacing.gridSize*e.components.panel.headerHeight:0,SI=(e,t)=>({contentStyle:{padding:("md"===e?t.components.panel.padding:0)*t.spacing.gridSize}}),EI=e=>{const{background:t,borderColor:n,padding:r}=e.components.panel;return{container:(0,i.css)({label:"panel-container",backgroundColor:t,border:`1px solid ${n}`,position:"relative",borderRadius:e.shape.radius.default,height:"100%",display:"flex",flexDirection:"column",".show-on-hover":{visibility:"hidden",opacity:"0"},"&:focus-visible, &:hover":{".show-on-hover":{visibility:"visible",opacity:"1"}},"&:focus-visible":{outline:`1px solid ${e.colors.action.focus}`},"&:focus-within":{".show-on-hover":{visibility:"visible",opacity:"1"}}}),loadingBarContainer:(0,i.css)({label:"panel-loading-bar-container",position:"absolute",top:0,width:"100%",overflow:"hidden"}),content:(0,i.css)({label:"panel-content",flexGrow:1}),headerContainer:(0,i.css)({label:"panel-header",display:"flex",alignItems:"center"}),pointer:(0,i.css)({cursor:"pointer"}),streaming:(0,i.css)({label:"panel-streaming",marginRight:0,color:e.colors.success.text,"&:hover":{color:e.colors.success.text}}),title:(0,i.css)({label:"panel-title",marginBottom:0,padding:e.spacing(0,r),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:e.typography.h6.fontSize,fontWeight:e.typography.h6.fontWeight}),items:(0,i.css)({display:"flex"}),item:(0,i.css)({display:"flex",justifyContent:"center",alignItems:"center"}),hiddenMenu:(0,i.css)({visibility:"hidden"}),menuItem:(0,i.css)({label:"panel-menu",border:"none",background:e.colors.secondary.main,"&:hover":{background:e.colors.secondary.shade}}),errorContainerFloating:(0,i.css)({label:"error-container",position:"absolute",left:0,top:0,zIndex:e.zIndex.tooltip}),rightActions:(0,i.css)({display:"flex",padding:e.spacing(0,r),gap:e.spacing(1)}),rightAligned:(0,i.css)({label:"right-aligned-container",marginLeft:"auto",display:"flex",alignItems:"center"}),titleItems:(0,i.css)({display:"flex",height:"100%"})}},xI=e=>({panelWrap:i.css`
margin-bottom: ${e.spacing(1)};
`});function OI({isLoading:e,title:t,description:n,children:i,className:a="",headerActions:s,dataTestId:l}){const c=(0,o.useStyles2)(xI),u=e?r.LoadingState.Loading:r.LoadingState.Done;return $i().createElement("div",{className:`${a} ${c.panelWrap}`,"data-testid":l||"panel"},$i().createElement(bI,{loadingState:u,title:t,description:n,actions:s},i))}var _I=__webpack_require__(6977);const TI="grafana-llm-app",CI=`/api/plugins/${TI}`;new _I.SemVer("0.2.0");const kI=async()=>{try{if(!(await(0,a.getBackendSrv)().get(`${CI}/settings`)).enabled)return!1;const e=(await(0,a.getBackendSrv)().get(`${CI}/health`)).details;return e.llmProvider?e.llmProvider.configured&&e.llmProvider.ok:!!e.openAI&&(e.openAI.configured&&e.openAI.ok)}catch(e){return!1}};function PI({children:e,onClick:t,disabled:n,interactionName:r}){const i=(0,o.useStyles2)(AI),{isEnabled:a,error:s,isFetching:l}=function(){const{data:e,isFetching:t,error:n}=Pa({queryKey:["llm"],queryFn:()=>kI()});return n&&Xi.error(n,{info:"Error while checking the status of the Grafana LLM plugin!"}),{isEnabled:Boolean(e),isFetching:t,error:n}}();let c="ai",u="";return l?(c="fa fa-spinner",u="Checking the status of the Grafana LLM plugin..."):s?(c="exclamation-triangle",u="Error while checking the status of the Grafana LLM plugin!"):a||(c="shield-exclamation",u="Grafana LLM plugin missing or not configured! Please check the plugins administration page."),$i().createElement(o.Button,{className:i.aiButton,size:"md",fill:"text",icon:c,disabled:!a||n,tooltip:u,tooltipPlacement:"top",onClick:e=>{Cs(r),t(e)}},e)}const AI=()=>({aiButton:i.css`
padding: 0 4px;
`});function RI(){return RI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RI.apply(this,arguments)}const DI=["children","options"];var jI,II;!function(e){e.blockQuote="0",e.breakLine="1",e.breakThematic="2",e.codeBlock="3",e.codeFenced="4",e.codeInline="5",e.footnote="6",e.footnoteReference="7",e.gfmTask="8",e.heading="9",e.headingSetext="10",e.htmlBlock="11",e.htmlComment="12",e.htmlSelfClosing="13",e.image="14",e.link="15",e.linkAngleBraceStyleDetector="16",e.linkBareUrlDetector="17",e.linkMailtoDetector="18",e.newlineCoalescer="19",e.orderedList="20",e.paragraph="21",e.ref="22",e.refImage="23",e.refLink="24",e.table="25",e.tableSeparator="26",e.text="27",e.textBolded="28",e.textEmphasized="29",e.textEscaped="30",e.textMarked="31",e.textStrikethroughed="32",e.unorderedList="33"}(jI||(jI={})),function(e){e[e.MAX=0]="MAX",e[e.HIGH=1]="HIGH",e[e.MED=2]="MED",e[e.LOW=3]="LOW",e[e.MIN=4]="MIN"}(II||(II={}));const NI=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","className","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce(((e,t)=>(e[t.toLowerCase()]=t,e)),{for:"htmlFor"}),LI={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},MI=["style","script"],FI=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,$I=/mailto:/i,BI=/\n{2,}$/,VI=/^(\s*>[\s\S]*?)(?=\n{2,})/,UI=/^ *> ?/gm,zI=/^ {2,}\n/,qI=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,HI=/^\s*(`{3,}|~{3,}) *(\S+)?([^\n]*?)?\n([\s\S]+?)\s*\1 *(?:\n *)*\n?/,GI=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,WI=/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,QI=/^(?:\n *)*\n/,KI=/\r\n?/g,YI=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,XI=/^\[\^([^\]]+)]/,JI=/\f/g,ZI=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,eN=/^\s*?\[(x|\s)\]/,tN=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,nN=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,rN=/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/,iN=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,aN=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,oN=/^<!--[\s\S]*?(?:-->)/,sN=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,lN=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,cN=/^\{.*\}$/,uN=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,dN=/^<([^ >]+@[^ >]+)>/,pN=/^<([^ >]+:\/[^ >]+)>/,hN=/-([a-z])?/gi,fN=/^(.*\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,mN=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,gN=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,yN=/^\[([^\]]*)\] ?\[([^\]]*)\]/,bN=/(\[|\])/g,vN=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,wN=/\t/g,SN=/(^ *\||\| *$)/g,EN=/^ *:-+: *$/,xN=/^ *:-+ *$/,ON=/^ *-+: *$/,_N="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|~~.*?~~|==.*?==|.|\\n)*?)",TN=new RegExp(`^([*_])\\1${_N}\\1\\1(?!\\1)`),CN=new RegExp(`^([*_])${_N}\\1(?!\\1|\\w)`),kN=new RegExp(`^==${_N}==`),PN=new RegExp(`^~~${_N}~~`),AN=/^\\([^0-9A-Za-z\s])/,RN=/^[\s\S]+?(?=[^0-9A-Z\s\u00c0-\uffff&#;.()'"]|\d+\.|\n\n| {2,}\n|\w+:\S|$)/i,DN=/^\n+/,jN=/^([ \t]*)/,IN=/\\([^\\])/g,NN=/ *\n+$/,LN=/(?:^|\n)( *)$/,MN="(?:\\d+\\.)",FN="(?:[*+-])";function $N(e){return"( *)("+(1===e?MN:FN)+") +"}const BN=$N(1),VN=$N(2);function UN(e){return new RegExp("^"+(1===e?BN:VN))}const zN=UN(1),qN=UN(2);function HN(e){return new RegExp("^"+(1===e?BN:VN)+"[^\\n]*(?:\\n(?!\\1"+(1===e?MN:FN)+" )[^\\n]*)*(\\n|$)","gm")}const GN=HN(1),WN=HN(2);function QN(e){const t=1===e?MN:FN;return new RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const KN=QN(1),YN=QN(2);function XN(e,t){const n=1===t,r=n?KN:YN,i=n?GN:WN,a=n?zN:qN;return{match(e,t,n){const i=LN.exec(n);return i&&(t.list||!t.inline&&!t.simple)?r.exec(e=i[1]+e):null},order:1,parse(e,t,r){const o=n?+e[2]:void 0,s=e[0].replace(BI,"\n").match(i);let l=!1;return{items:s.map((function(e,n){const i=a.exec(e)[0].length,o=new RegExp("^ {1,"+i+"}","gm"),c=e.replace(o,"").replace(a,""),u=n===s.length-1,d=-1!==c.indexOf("\n\n")||u&&l;l=d;const p=r.inline,h=r.list;let f;r.list=!0,d?(r.inline=!1,f=c.replace(NN,"\n\n")):(r.inline=!0,f=c.replace(NN,""));const m=t(f,r);return r.inline=p,r.list=h,m})),ordered:n,start:o}},render:(t,n,r)=>e(t.ordered?"ol":"ul",{key:r.key,start:"20"===t.type?t.start:void 0},t.items.map((function(t,i){return e("li",{key:i},n(t,r))})))}}const JN=new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),ZN=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/,eL=[VI,HI,GI,tN,rN,nN,oN,fN,GN,KN,WN,YN],tL=[...eL,/^[^\n]+(?: \n|\n{2,})/,iN,lN];function nL(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function rL(e){return ON.test(e)?"right":EN.test(e)?"center":xN.test(e)?"left":null}function iL(e,t,n,r){const i=n.inTable;n.inTable=!0;let a=e.trim().split(/( *(?:`[^`]*`|<.*?>.*?<\/.*?>(?!<\/.*?>)|\\\||\|) *)/).reduce(((e,i)=>("|"===i.trim()?e.push(r?{type:"26"}:{type:"27",text:i}):""!==i&&e.push.apply(e,t(i,n)),e)),[]);n.inTable=i;let o=[[]];return a.forEach((function(e,t){"26"===e.type?0!==t&&t!==a.length-1&&o.push([]):("27"!==e.type||null!=a[t+1]&&"26"!==a[t+1].type||(e.text=e.text.trimEnd()),o[o.length-1].push(e))})),o}function aL(e,t,n){n.inline=!0;const r=e[2]?e[2].replace(SN,"").split("|").map(rL):[],i=e[3]?function(e,t,n){return e.trim().split("\n").map((function(e){return iL(e,t,n,!0)}))}(e[3],t,n):[],a=iL(e[1],t,n,!!i.length);return n.inline=!1,i.length?{align:r,cells:i,header:a,type:"25"}:{children:a,type:"21"}}function oL(e,t){return null==e.align[t]?{}:{textAlign:e.align[t]}}function sL(e){return function(t,n){return n.inline?e.exec(t):null}}function lL(e){return function(t,n){return n.inline||n.simple?e.exec(t):null}}function cL(e){return function(t,n){return n.inline||n.simple?null:e.exec(t)}}function uL(e){return function(t){return e.exec(t)}}function dL(e,t,n){if(t.inline||t.simple)return null;if(n&&!n.endsWith("\n"))return null;let r="";e.split("\n").every((e=>!eL.some((t=>t.test(e)))&&(r+=e+"\n",e.trim())));const i=r.trimEnd();return""==i?null:[r,i]}function pL(e){try{if(decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"").match(/^\s*(javascript|vbscript|data(?!:image)):/i))return}catch(e){return null}return e}function hL(e){return e.replace(IN,"$1")}function fL(e,t,n){const r=n.inline||!1,i=n.simple||!1;n.inline=!0,n.simple=!0;const a=e(t,n);return n.inline=r,n.simple=i,a}function mL(e,t,n){const r=n.inline||!1,i=n.simple||!1;n.inline=!1,n.simple=!0;const a=e(t,n);return n.inline=r,n.simple=i,a}function gL(e,t,n){const r=n.inline||!1;n.inline=!1;const i=e(t,n);return n.inline=r,i}const yL=(e,t,n)=>({children:fL(t,e[1],n)});function bL(){return{}}function vL(){return null}function wL(...e){return e.filter(Boolean).join(" ")}function SL(e,t,n){let r=e;const i=t.split(".");for(;i.length&&(r=r[i[0]],void 0!==r);)i.shift();return r||n}const EL=e=>{let{children:t="",options:n}=e,r=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}(e,DI);return Fi.cloneElement(function(e="",t={}){t.overrides=t.overrides||{},t.slugify=t.slugify||nL,t.namedCodesToUnicode=t.namedCodesToUnicode?RI({},LI,t.namedCodesToUnicode):LI;const n=t.createElement||Fi.createElement;function r(e,r,...i){const a=SL(t.overrides,`${e}.props`,{});return n(function(e,t){const n=SL(t,e);return n?"function"==typeof n||"object"==typeof n&&"render"in n?n:SL(t,`${e}.component`,e):e}(e,t.overrides),RI({},r,a,{className:wL(null==r?void 0:r.className,a.className)||void 0}),...i)}function i(e){e=e.replace(ZI,"");let n=!1;t.forceInline?n=!0:t.forceBlock||(n=!1===vN.test(e));const i=u(c(n?e:`${e.trimEnd().replace(DN,"")}\n\n`,{inline:n}));for(;"string"==typeof i[i.length-1]&&!i[i.length-1].trim();)i.pop();if(null===t.wrapper)return i;const a=t.wrapper||(n?"span":"div");let o;if(i.length>1||t.forceWrapper)o=i;else{if(1===i.length)return o=i[0],"string"==typeof o?r("span",{key:"outer"},o):o;o=null}return Fi.createElement(a,{key:"outer"},o)}function a(e){const t=e.match(FI);return t?t.reduce((function(e,t,n){const r=t.indexOf("=");if(-1!==r){const a=function(e){return-1!==e.indexOf("-")&&null===e.match(sN)&&(e=e.replace(hN,(function(e,t){return t.toUpperCase()}))),e}(t.slice(0,r)).trim(),o=function(e){const t=e[0];return('"'===t||"'"===t)&&e.length>=2&&e[e.length-1]===t?e.slice(1,-1):e}(t.slice(r+1).trim()),s=NI[a]||a,l=e[s]=function(e,t){return"style"===e?t.split(/;\s?/).reduce((function(e,t){const n=t.slice(0,t.indexOf(":"));return e[n.trim().replace(/(-[a-z])/g,(e=>e[1].toUpperCase()))]=t.slice(n.length+1).trim(),e}),{}):"href"===e||"src"===e?pL(t):(t.match(cN)&&(t=t.slice(1,t.length-1)),"true"===t||"false"!==t&&t)}(a,o);"string"==typeof l&&(iN.test(l)||lN.test(l))&&(e[s]=Fi.cloneElement(i(l.trim()),{key:n}))}else"style"!==t&&(e[NI[t]||t]=!0);return e}),{}):null}const o=[],s={},l={0:{match:cL(VI),order:1,parse:(e,t,n)=>({children:t(e[0].replace(UI,""),n)}),render:(e,t,n)=>r("blockquote",{key:n.key},t(e.children,n))},1:{match:uL(zI),order:1,parse:bL,render:(e,t,n)=>r("br",{key:n.key})},2:{match:cL(qI),order:1,parse:bL,render:(e,t,n)=>r("hr",{key:n.key})},3:{match:cL(GI),order:0,parse:e=>({lang:void 0,text:e[0].replace(/^ {4}/gm,"").replace(/\n+$/,"")}),render:(e,t,n)=>r("pre",{key:n.key},r("code",RI({},e.attrs,{className:e.lang?`lang-${e.lang}`:""}),e.text))},4:{match:cL(HI),order:0,parse:e=>({attrs:a(e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"})},5:{match:lL(WI),order:3,parse:e=>({text:e[2]}),render:(e,t,n)=>r("code",{key:n.key},e.text)},6:{match:cL(YI),order:0,parse:e=>(o.push({footnote:e[2],identifier:e[1]}),{}),render:vL},7:{match:sL(XI),order:1,parse:e=>({target:`#${t.slugify(e[1])}`,text:e[1]}),render:(e,t,n)=>r("a",{key:n.key,href:pL(e.target)},r("sup",{key:n.key},e.text))},8:{match:sL(eN),order:1,parse:e=>({completed:"x"===e[1].toLowerCase()}),render:(e,t,n)=>r("input",{checked:e.completed,key:n.key,readOnly:!0,type:"checkbox"})},9:{match:cL(t.enforceAtxHeadings?nN:tN),order:1,parse:(e,n,r)=>({children:fL(n,e[2],r),id:t.slugify(e[2]),level:e[1].length}),render:(e,t,n)=>r(`h${e.level}`,{id:e.id,key:n.key},t(e.children,n))},10:{match:cL(rN),order:0,parse:(e,t,n)=>({children:fL(t,e[1],n),level:"="===e[2]?1:2,type:"9"})},11:{match:uL(iN),order:1,parse(e,t,n){const[,r]=e[3].match(jN),i=new RegExp(`^${r}`,"gm"),o=e[3].replace(i,""),s=(l=o,tL.some((e=>e.test(l)))?gL:fL);var l;const c=e[1].toLowerCase(),u=-1!==MI.indexOf(c),d={attrs:a(e[2]),noInnerParse:u,tag:(u?c:e[1]).trim()};return n.inAnchor=n.inAnchor||"a"===c,u?d.text=e[3]:d.children=s(t,o,n),n.inAnchor=!1,d},render:(e,t,n)=>r(e.tag,RI({key:n.key},e.attrs),e.text||t(e.children,n))},13:{match:uL(lN),order:1,parse:e=>({attrs:a(e[2]||""),tag:e[1].trim()}),render:(e,t,n)=>r(e.tag,RI({},e.attrs,{key:n.key}))},12:{match:uL(oN),order:1,parse:()=>({}),render:vL},14:{match:lL(ZN),order:1,parse:e=>({alt:e[1],target:hL(e[2]),title:e[3]}),render:(e,t,n)=>r("img",{key:n.key,alt:e.alt||void 0,title:e.title||void 0,src:pL(e.target)})},15:{match:sL(JN),order:3,parse:(e,t,n)=>({children:mL(t,e[1],n),target:hL(e[2]),title:e[3]}),render:(e,t,n)=>r("a",{key:n.key,href:pL(e.target),title:e.title},t(e.children,n))},16:{match:sL(pN),order:0,parse:e=>({children:[{text:e[1],type:"27"}],target:e[1],type:"15"})},17:{match:(e,t)=>t.inAnchor?null:sL(uN)(e,t),order:0,parse:e=>({children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"})},18:{match:sL(dN),order:0,parse(e){let t=e[1],n=e[1];return $I.test(n)||(n="mailto:"+n),{children:[{text:t.replace("mailto:",""),type:"27"}],target:n,type:"15"}}},20:XN(r,1),33:XN(r,2),19:{match:cL(QI),order:3,parse:bL,render:()=>"\n"},21:{match:dL,order:3,parse:yL,render:(e,t,n)=>r("p",{key:n.key},t(e.children,n))},22:{match:sL(mN),order:0,parse:e=>(s[e[1]]={target:e[2],title:e[4]},{}),render:vL},23:{match:lL(gN),order:0,parse:e=>({alt:e[1]||void 0,ref:e[2]}),render:(e,t,n)=>s[e.ref]?r("img",{key:n.key,alt:e.alt,src:pL(s[e.ref].target),title:s[e.ref].title}):null},24:{match:sL(yN),order:0,parse:(e,t,n)=>({children:t(e[1],n),fallbackChildren:t(e[0].replace(bN,"\\$1"),n),ref:e[2]}),render:(e,t,n)=>s[e.ref]?r("a",{key:n.key,href:pL(s[e.ref].target),title:s[e.ref].title},t(e.children,n)):r("span",{key:n.key},t(e.fallbackChildren,n))},25:{match:cL(fN),order:1,parse:aL,render(e,t,n){const i=e;return r("table",{key:n.key},r("thead",null,r("tr",null,i.header.map((function(e,a){return r("th",{key:a,style:oL(i,a)},t(e,n))})))),r("tbody",null,i.cells.map((function(e,a){return r("tr",{key:a},e.map((function(e,a){return r("td",{key:a,style:oL(i,a)},t(e,n))})))}))))}},27:{match:uL(RN),order:4,parse:e=>({text:e[0].replace(aN,((e,n)=>t.namedCodesToUnicode[n]?t.namedCodesToUnicode[n]:e))}),render:e=>e.text},28:{match:lL(TN),order:2,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,n)=>r("strong",{key:n.key},t(e.children,n))},29:{match:lL(CN),order:3,parse:(e,t,n)=>({children:t(e[2],n)}),render:(e,t,n)=>r("em",{key:n.key},t(e.children,n))},30:{match:lL(AN),order:1,parse:e=>({text:e[1],type:"27"})},31:{match:lL(kN),order:3,parse:yL,render:(e,t,n)=>r("mark",{key:n.key},t(e.children,n))},32:{match:lL(PN),order:3,parse:yL,render:(e,t,n)=>r("del",{key:n.key},t(e.children,n))}};!0===t.disableParsingRawHTML&&(delete l[11],delete l[13]);const c=function(e){let t=Object.keys(e);function n(r,i){let a=[],o="";for(;r;){let s=0;for(;s<t.length;){const l=t[s],c=e[l],u=c.match(r,i,o);if(u){const e=u[0];r=r.substring(e.length);const t=c.parse(u,n,i);null==t.type&&(t.type=l),a.push(t),o=e;break}s++}}return a}return t.sort((function(t,n){let r=e[t].order,i=e[n].order;return r!==i?r-i:t<n?-1:1})),function(e,t){return n(function(e){return e.replace(KI,"\n").replace(JI,"").replace(wN," ")}(e),t)}}(l),u=(d=function(e,t){return function(n,r,i){const a=e[n.type].render;return t?t((()=>a(n,r,i)),n,r,i):a(n,r,i)}}(l,t.renderRule),function e(t,n={}){if(Array.isArray(t)){const r=n.key,i=[];let a=!1;for(let r=0;r<t.length;r++){n.key=r;const o=e(t[r],n),s="string"==typeof o;s&&a?i[i.length-1]+=o:null!==o&&i.push(o),a=s}return n.key=r,i}return d(t,e,n)});var d;const p=i(e);return o.length?r("div",null,p,r("footer",{key:"footer"},o.map((function(e){return r("div",{id:t.slugify(e.identifier),key:e.identifier},e.identifier,u(c(e.footnote,{inline:!0})))})))):p}(t,n),r)},xL=e=>{const t=document.querySelector('[placeholder^="Search"]');if(null===t)return void Xi.error(new Error("Cannot find search input element!"));((e,t)=>{const n=Object.getOwnPropertyDescriptor(e,"value").set,r=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value").set;n&&n!==r?r.call(e,t):n.call(e,t)})(t,e.target.textContent.trim()),t.dispatchEvent(new Event("input",{bubbles:!0}))},OL={overrides:{code:{component:({children:e})=>{const t=(0,o.useStyles2)(TL);return"string"==typeof e&&e.includes("\n")?$i().createElement("code",null,e):$i().createElement("code",{className:t.searchLink,title:"Search for this node",onClick:xL},e)}}}};function _L({reply:e}){var t;const n=(0,o.useStyles2)(TL);return $i().createElement("div",{className:n.container},null==e||null===(t=e.messages)||void 0===t?void 0:t.filter((e=>"system"!==e.role)).map((e=>$i().createElement($i().Fragment,null,$i().createElement("div",{className:n.reply},$i().createElement(EL,{options:OL},e.content||"")),$i().createElement("hr",null)))),$i().createElement("div",{className:n.reply},$i().createElement(EL,{options:OL},e.text)))}const TL=()=>({container:i.css`
width: 100%;
height: 100%;
`,reply:i.css`
font-size: 13px;
& ol,
& ul {
margin: 0 0 16px 24px;
}
`,searchLink:i.css`
color: rgb(255, 136, 51);
border: 1px solid transparent;
padding: 2px 4px;
cursor: pointer;
font-size: 13px;
&:hover,
&:focus,
&:active {
box-sizing: border-box;
border: 1px solid rgb(255, 136, 51, 0.8);
border-radius: 4px;
}
`}),CL=()=>({textarea:i.css`
margin-bottom: 8px;
`,sendButton:i.css`
float: right;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
`});function kL({onSubmit:e}){const t=(0,o.useStyles2)(CL),{question:n,onChangeInput:r,onClickSend:i}=function(e){const[t,n]=(0,Fi.useState)(""),r=(0,Fi.useCallback)((e=>{n(e.target.value)}),[]),i=(0,Fi.useCallback)((()=>{const r=t.trim();r&&(e(r),n(""))}),[t,e]);return{question:t,onChangeInput:r,onClickSend:i}}(e);return $i().createElement("div",null,$i().createElement(o.TextArea,{className:t.textarea,placeholder:"Ask a follow-up question...",value:n,onChange:r,onKeyDown:e=>{"Enter"!==e.code||e.shiftKey||i()}}),$i().createElement(o.Button,{className:t.sendButton,onClick:i},"Send"))}function PL(e,t){return _b((function(n,r){var i=0;n.subscribe(iv(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function AL(e,t){return _b(function(e,t,n,r,i){return function(a,o){var s=n,l=t,c=0;a.subscribe(iv(o,(function(t){var n=c++;l=s?e(l,t,n):(s=!0,t),r&&o.next(l)}),i&&function(){s&&o.next(l),o.complete()}))}}(e,t,arguments.length>=2,!0))}const RL={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let DL;const jL=new Uint8Array(16);const IL=[];for(let e=0;e<256;++e)IL.push((e+256).toString(16).slice(1));function NL(e,t=0){return(IL[e[t+0]]+IL[e[t+1]]+IL[e[t+2]]+IL[e[t+3]]+"-"+IL[e[t+4]]+IL[e[t+5]]+"-"+IL[e[t+6]]+IL[e[t+7]]+"-"+IL[e[t+8]]+IL[e[t+9]]+"-"+IL[e[t+10]]+IL[e[t+11]]+IL[e[t+12]]+IL[e[t+13]]+IL[e[t+14]]+IL[e[t+15]]).toLowerCase()}const LL=function(e,t,n){if(RL.randomUUID&&!t&&!e)return RL.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!DL){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");DL=crypto.getRandomValues.bind(crypto)}return DL(jL)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return NL(r)},ML="llm/v1/chat/completions";function FL(e){return"error"in e}function $L(){return(0,Hp.pipe)((0,Hp.pipe)(PL((e=>"content"in e.choices[0].delta)),ov((e=>e.choices[0].delta.content))),AL(((e,t)=>e+t),""))}function BL(e){const t={scope:r.LiveChannelScope.Plugin,namespace:TI,path:ML+"/"+LL(),data:e};return(0,a.getGrafanaLiveSrv)().getStream(t).pipe(PL((e=>(0,r.isLiveChannelMessageEvent)(e)))).pipe(PL((e=>!!e.message.choices)),function(e,t,n){var r=Ob(e)||t||n?{next:e,error:t,complete:n}:e;return r?_b((function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(iv(t,(function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)}),(function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()}),(function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)}),(function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)})))})):cv}((e=>{if(FL(e.message))throw new Error(e.message.error)})),(n=e=>!(!FL(e.message)&&(e.message.choices&&e.message.choices[0].delta&&"done"in e.message.choices[0].delta&&!0===e.message.choices[0].delta.done||e.message.choices&&"finish_reason"in e.message.choices[0]&&"stop"===e.message.choices[0].finish_reason)),void 0===i&&(i=!1),_b((function(e,t){var r=0;e.subscribe(iv(t,(function(e){var a=n(e,r++);(a||i)&&t.next(e),!a&&t.complete()})))}))),ov((e=>e.message)));var n,i}const VL={system:{empty:()=>"\n You are a performance profiling expert and excel at analyzing profiles in the DOT format.\n In the DOT format, a row like N47 -> N61 means the function from N47 called the function from N61.\n"},user:{single:(e,t)=>`\n Analyze this flamegraph in DOT format and address these key aspects:\n - **Performance Bottleneck**: Identify the primary factors slowing down the process, consuming excessive memory, or causing a bottleneck in the system.\n - **Root Cause**: Explain clearly why these bottlenecks are occurring.\n - **Recommended Fix**: Suggest practical solutions for these issues.\n\n Guidelines:\n - Always use full function names without splitting them from package names.\n - Exclude numeric values, percentages, and node names (e.g., N1, N3, Node 1, Node 2).\n - Focus on user code over low-level runtime optimizations.\n - For standard library or runtime functions, explain their presence/function and link them to user code functions calling them. Avoid repetitive mentions from the same call chain.\n - Do not mention that the flamegraph profile is in DOT format.\n - Only use h5 and h6 markdown headers (e.g., ##### Performance Bottleneck, ###### Recommended Fix)\n - Do not use h1,h2,h3,h4 headers (e.g., ## Bottleneck, ### Root Cause, #### Recommended Fix)\n\n Format the response using markdown headers for each section corresponding to the key aspects.\n\n The profile type is: ${e}\n Profile in DOT format:\n ${t[0]}\n`,anton:(e,t)=>`\nGive me actionable feedback and suggestions on how I improve the application performance.\n\nDo not break function names.\nDo not show any numeric values, absolute or percents.\nDo not show node names like N1, N3, or Node 1, Node 2.\nDo not suggest low-level runtime optimisations, focus on the user code.\n\nAlways use full function names.\nNever split function and package name.\n\nRemove any numeric values, absolute or percents, from the output.\nRemove node names like N1, N3, or Node 1, Node 2 from the output.\n\nIf the function is widely known (e.g., a runtime or stdlib function), provide me concise explanation why the function is present in the profile and what could be the cause.\nIf a function is defined in the runtime or in the standard library, tell me which function in the user code calls it.\nAvoid mentioning functions from the same call-chain.\n\n5 suggestions is enough.\nThe profile type is ${e}\nBelow is the performance profile in DOT format:\n${t[0]}\n`,diff:(e,t)=>`\nAnalyze the differences between these two performance profiles presented in DOT format. Provide a detailed comparison focusing on the following aspects:\n\n- Performance Change: Determine how the performance has changed from the first profile to the second. Identify if there are new bottlenecks, improved or worsened performance areas, or significant changes in resource consumption.\n- Function Impact: Highlight no more than 3 specific functions that have undergone notable changes in their performance impact. Discuss any new functions that have appeared in the second profile or any existing functions that have significantly increased or decreased in resource usage.\n- Potential Causes: Discuss the possible reasons for these changes in performance, linking them to the differences in function execution or resource usage between the two profiles.\n\nGuidelines for Analysis:\n- Use full function names without separating them from their package names\n- Focus on user code rather than low-level runtime optimizations or standard library functions unless they are directly relevant to the user code's performance changes\n- Exclude numeric values, percentages, and node names (e.g., N1, N3, Node 1, Node 2) from the analysis\n- Format the response using markdown headers for each section to structure the analysis clearly\n\nThe profile type is: ${e}\n\nFirst performance profile in DOT format:\n${t[0]}\n\nSecond performance profile in DOT format:\n${t[1]}\n`}},UL=({system:e,user:t,profileType:n,profiles:r})=>{const i=VL.system[e];if("function"!=typeof i)throw new Error(`Cannot find system prompt "${e}"!`);const a=VL.user[t];if("function"!=typeof a)throw new Error(`Cannot find user prompt "${t}"!`);return{system:i(n,r),user:a(n,r)}};function zL(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}class qL extends NC{get(e){var t,n=this;return(t=function*(){const t=new URLSearchParams({query:e.query,from:String(1e3*e.timeRange.from.unix()),until:String(1e3*e.timeRange.to.unix()),format:e.format});e.maxNodes&&t.set("max-nodes",String(e.maxNodes));const r=yield n.fetch(`/pyroscope/render?${t.toString()}`);switch(e.format){case"dot":return r.text();case"json":return r.json();default:throw new TypeError(`Unknown format "${e.format}"!`)}},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){zL(a,r,i,o,s,"next",e)}function s(e){zL(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(e){super(e)}}function HL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class GL extends vh{validateFetchParams(e,t){let n,r=t;return e&&2!==t.length?(n=new Error(`Invalid number of fetch parameters for analyzing the diff flame graph (${t.length})!`),r=[]):e||1===t.length||(n=new Error(`Invalid number of fetch parameters for analyzing the flame graph (${t.length})!`),r=[]),{params:r,error:n}}constructor(){super({key:"ai-panel"}),HL(this,"useSceneAiPanel",((e,t)=>{const n=nm.findByKeyAndType(this,"dataSource",QP).useState().value,{params:r,error:i}=this.validateFetchParams(e,t),{error:a,isFetching:o,profiles:s}=function(e,t){const n=oj.build(e,qL),{isFetching:r,error:i,data:a}=Pa({queryKey:["dot-profiles",e,...t.flatMap((({query:e,timeRange:t})=>[e,t.from.unix(),t.to.unix()])),100],queryFn:()=>Promise.all(t.map((({query:e,timeRange:t})=>n.get({query:e,timeRange:t,format:"dot",maxNodes:100}).then((e=>e.replace(/fontsize=\d+ /g,"").replace(/id="node\d+" /g,"").replace(/labeltooltip=".*\)" /g,"").replace(/tooltip=".*\)" /g,"").replace(/(N\d+ -> N\d+).*/g,"$1").replace(/N\d+ \[label="other.*\n/,"").replace(/shape=box /g,"").replace(/fillcolor="#\w{6}"/g,"").replace(/color="#\w{6}" /g,""))))))});return{isFetching:r,error:i,profiles:a||[]}}(n,r),l=IP(sA(this,"profileMetricId")).type,{reply:c,error:u,retry:d}=function(e,t){const[n,r]=(0,Fi.useState)(""),[i,a]=(0,Fi.useState)(!1),[o,s]=(0,Fi.useState)(!1),[l,c]=(0,Fi.useState)([]),[u,d]=(0,Fi.useState)(null),[p,h]=(0,Fi.useState)(),f=(0,Fi.useCallback)((e=>{c(e),d(null),r(""),a(!0),s(!1);const t=BL({model:"gpt-4-1106-preview",messages:e}).pipe($L()).subscribe({next:r,error(e){d(e),a(!1),s(!0),h(void 0)},complete(){a(!1),s(!0),h(void 0)}});h(t)}),[]),m=(0,Fi.useCallback)((e=>{const t=[{role:"assistant",content:n},{role:"user",content:e}];try{f([...l,...t])}catch(e){d(e)}}),[l,n,f]);return(0,Fi.useEffect)((()=>{if(!t.length||l.length>0)return;const n=UL({system:"empty",user:2===t.length?"diff":"single",profileType:e,profiles:t});try{f([{role:"system",content:n.system},{role:"system",content:n.user}])}catch(e){d(e)}}),[l.length,e,t,t.length,f]),(0,Fi.useEffect)((()=>()=>{p&&(p.unsubscribe(),h(void 0))}),[p]),{reply:{text:n,hasStarted:i,hasFinished:o,messages:l,askFollowupQuestion:m},retry(){if(l.length>0)try{f(l)}catch(e){d(e)}},error:u}}(l,s);return{data:{validationError:i,isLoading:o||!o&&!a&&!u&&!c.text.trim(),fetchError:a,llmError:u,reply:c,shouldDisplayReply:Boolean((null==c?void 0:c.hasStarted)||(null==c?void 0:c.hasFinished)),shouldDisplayFollowUpForm:!a&&!u&&Boolean(null==c?void 0:c.hasFinished)},actions:{retry:d,submitFollowupQuestion(e){c.askFollowupQuestion(e)}}}}))}}HL(GL,"Component",(({model:e,isDiff:t,fetchParams:n,onClose:r})=>{const i=(0,o.useStyles2)(WL),{data:a,actions:s}=e.useSceneAiPanel(t,n);return $i().createElement(OI,{className:i.sidePanel,title:"Flame graph analysis",isLoading:a.isLoading,headerActions:$i().createElement(o.IconButton,{title:"Close panel",name:"times-circle",variant:"secondary","aria-label":"close",onClick:r}),dataTestId:"ai-panel"},$i().createElement("div",{className:i.content},a.validationError&&$i().createElement(eI,{severity:"error",title:"Validation error!",error:a.validationError}),a.fetchError&&$i().createElement(eI,{severity:"error",title:"Error while loading profile data!",message:"Sorry for any inconvenience, please try again later.",error:a.fetchError}),a.shouldDisplayReply&&$i().createElement(_L,{reply:a.reply}),a.isLoading&&$i().createElement($i().Fragment,null,$i().createElement(o.Spinner,{inline:!0})," Analyzing..."),a.llmError&&$i().createElement(o.Alert,{title:"An error occured while generating content using OpenAI!",severity:"warning"},$i().createElement("div",null,$i().createElement("div",null,$i().createElement("p",null,a.llmError.message),$i().createElement("p",null,"Sorry for any inconvenience, please retry or if the problem persists, contact your organization admin."))),$i().createElement(o.Button,{className:i.retryButton,variant:"secondary",fill:"outline",onClick:()=>s.retry()},"Retry")),a.shouldDisplayFollowUpForm&&$i().createElement(kL,{onSubmit:s.submitFollowupQuestion})))}));const WL=e=>({sidePanel:i.css`
flex: 1 0 50%;
margin-left: 8px;
max-width: calc(50% - 4px);
`,title:i.css`
margin: -4px 0 4px 0;
`,content:i.css`
padding: ${e.spacing(1)};
`,retryButton:i.css`
float: right;
`});class QL extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(QL,"type","diff-auto-select");class KL extends r.BusEventWithPayload{}function YL(){const{searchParams:e,pushNewUrl:t}=function(){const e=(0,Es.useNavigate)(),t=(0,Es.useLocation)();return{searchParams:new URLSearchParams(t.search),pushNewUrl:t=>{const n=new URLSearchParams(window.location.search);for(const[e,r]of Object.entries(t))n.set(e,r);e({search:n.toString()},{replace:!0})}}}();var n;const r=Number(null!==(n=e.get("maxNodes"))&&void 0!==n?n:""),i=e=>{t({maxNodes:String(e)})};return function(e,t){const{isFetching:n,error:r,settings:i}=Zj({enabled:!e});if(!e&&!n)r?(Is(["Error while retrieving the plugin settings!","Some features might not work as expected (e.g. flame graph max nodes). Please try to reload the page, sorry for the inconvenience."]),Xi.error(r),t(Qj.maxNodes)):t(i.maxNodes)}(r>0,i),[r,i]}function XL(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(KL,"type","diff-choose-preset");class JL extends NC{get(e){var t,n=this;return(t=function*(){const t=new URLSearchParams({leftQuery:e.leftQuery,leftFrom:String(1e3*e.leftTimeRange.from.unix()),leftUntil:String(1e3*e.leftTimeRange.to.unix()),rightQuery:e.rightQuery,rightFrom:String(1e3*e.rightTimeRange.from.unix()),rightUntil:String(1e3*e.rightTimeRange.to.unix())});e.maxNodes&&t.set("max-nodes",String(e.maxNodes));const r=yield n.fetch(`/pyroscope/render-diff?${t.toString()}`);return yield r.json()},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){XL(a,r,i,o,s,"next",e)}function s(e){XL(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(e){super(e)}}function ZL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eM(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function tM({enabled:e,dataSourceUid:t,baselineTimeRange:n,baselineQuery:r,comparisonTimeRange:i,comparisonQuery:a}){const[o]=YL(),s=oj.build(t,JL),{isFetching:l,error:c,data:u,refetch:d}=Pa({placeholderData:e=>e,enabled:Boolean(e&&o),queryKey:["diff-profile",t,r,n.from.unix(),n.to.unix(),a,i.from.unix(),i.to.unix(),o],queryFn:()=>{s.abort();const e={leftQuery:r,leftTimeRange:n,rightQuery:a,rightTimeRange:i,maxNodes:o};return s.get(e).then((e=>({profile:{version:e.version,flamebearer:e.flamebearer,metadata:e.metadata}})))}});return eM(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ZL(e,t,n[t])}))}return e}({isFetching:l,error:s.isAbortError(c)?null:c},u),{refetch:d})}function nM({onClickAutoSelect:e,onClickChoosePreset:t,onOpenLearnHow:n}){const r=(0,o.useStyles2)(rM),[i,a]=(0,Fi.useState)(!1);return $i().createElement(eI,{severity:"info",title:"Select both the baseline and the comparison flame graph ranges to view the diff flame graph",message:$i().createElement("div",{className:r.infoMsg},$i().createElement("p",null,"How?"),$i().createElement("p",null,$i().createElement(o.Button,{variant:"primary",onClick:e},"Auto-select")," ","or"," ",$i().createElement(o.Button,{variant:"primary",fill:"text",className:r.textButton,onClick:t},"choose a preset")),$i().createElement("p",null,"Alternatively:"),$i().createElement(o.Collapse,{label:"Click here to learn how to select the flame graph ranges with the mouse",collapsible:!0,className:r.collapse,isOpen:i,onToggle:()=>{i||n(),a(!i)}},$i().createElement("div",{className:r.collapseContent},$i().createElement("ol",null,$i().createElement("li",null,"Ensure that the “Flame graph” range selection mode is selected"),$i().createElement("li",null,"Use your mouse to select the desired time ranges on both the baseline and the comparison time series")),$i().createElement("img",{src:"public/plugins/grafana-pyroscope-app/img/8cdf4d2e2df8326311ab.gif",alt:"How to view the diff flame graph"}))))})}const rM=e=>({infoMsg:i.css`
padding: ${e.spacing(2)} 0 0 0;
`,textButton:i.css`
padding: 0;
`,collapse:i.css`
background: transparent;
border: 0;
`,collapseContent:i.css`
padding: 0 ${e.spacing(5)};
& img {
max-width: 100%;
width: auto;
margin-top: ${e.spacing(2)};
}
`});function iM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class aM extends vh{buildTitle(){const e=sA(this,"serviceName"),t=IP(sA(this,"profileMetricId")).type;return $i().createElement($i().Fragment,null,$i().createElement(Ko,{size:"small"}),"Diff flame graph for ",e," (",t,")")}constructor(){super({key:"diff-flame-graph",aiPanel:new GL}),iM(this,"useSceneDiffFlameGraph",(()=>{const{aiPanel:e}=this.useState(),{baselineTimeRange:t,comparisonTimeRange:n}=this.parent.useDiffTimeRanges(),r=WP(this,"filtersBaseline"),i=WP(this,"filtersComparison"),{settings:a,error:o}=Zj(),s=nm.findByKeyAndType(this,"dataSource",QP).useState().value,l=Boolean(r&&i&&t.from.unix()&&t.to.unix()&&n.from.unix()&&n.to.unix()),{isFetching:c,error:u,profile:d}=tM({enabled:l,dataSourceUid:s,baselineTimeRange:t,baselineQuery:r,comparisonTimeRange:n,comparisonQuery:i}),p=l&&!c&&!u&&0===(null==d?void 0:d.flamebearer.numTicks),h=Boolean(l&&!u&&!p&&d),f=!l;return{data:{title:this.buildTitle(),isLoading:c,fetchProfileError:u,noProfileDataAvailable:p,shouldDisplayFlamegraph:h,hasMissingSelections:f,profile:d,settings:a,fetchSettingsError:o,ai:{panel:e,fetchParams:[{query:r,timeRange:t},{query:i,timeRange:n}]}},actions:{}}})),iM(this,"onClickAutoSelect",(()=>{Cs("g_pyroscope_app_diff_auto_select_clicked"),this.publishEvent(new QL({wholeRange:!1}),!0)})),iM(this,"onClickChoosePreset",(()=>{Cs("g_pyroscope_app_diff_choose_preset_clicked"),this.publishEvent(new KL({}),!0)})),iM(this,"onOpenLearnHow",(()=>{Cs("g_pyroscope_app_diff_learn_how_clicked")}))}}iM(aM,"Component",(({model:e})=>{var t,n;const r=(0,o.useStyles2)(oM),{data:i}=e.useSceneDiffFlameGraph(),a=Hj(),s=i.isLoading||i.hasMissingSelections||i.noProfileDataAvailable;(0,Fi.useEffect)((()=>{s&&a.close()}),[s,a]),i.fetchSettingsError&&Is(["Error while retrieving the plugin settings!","Some features might not work as expected (e.g. flamegraph export options). Please try to reload the page, sorry for the inconvenience."]);const l=(0,Fi.useMemo)((()=>$i().createElement($i().Fragment,null,i.title,i.isLoading&&$i().createElement(o.Spinner,{inline:!0,className:r.spinner}))),[i.isLoading,i.title,r.spinner]);return $i().createElement("div",{className:r.flex},$i().createElement(OI,{dataTestId:"diff-flame-graph-panel",className:r.flamegraphPanel,title:l,isLoading:i.isLoading,headerActions:$i().createElement(PI,{disabled:s||a.isOpen("ai"),onClick:()=>a.open("ai"),interactionName:"g_pyroscope_app_explain_flamegraph_clicked"},"Explain Flame Graph")},i.hasMissingSelections&&$i().createElement(nM,{onClickAutoSelect:e.onClickAutoSelect,onClickChoosePreset:e.onClickChoosePreset,onOpenLearnHow:e.onOpenLearnHow}),i.fetchProfileError&&$i().createElement(eI,{severity:"error",title:"Error while loading profile data!",error:i.fetchProfileError}),i.noProfileDataAvailable&&$i().createElement(eI,{severity:"warning",title:"No profile data available",message:"Please verify that you've selected adequate filters and time ranges."}),i.shouldDisplayFlamegraph&&$i().createElement(gp,{diff:!0,profile:i.profile,enableFlameGraphDotComExport:null===(t=i.settings)||void 0===t?void 0:t.enableFlameGraphDotComExport,collapsedFlamegraphs:null===(n=i.settings)||void 0===n?void 0:n.collapsedFlamegraphs})),a.isOpen("ai")&&$i().createElement(i.ai.panel.Component,{model:i.ai.panel,isDiff:!0,fetchParams:i.ai.fetchParams,onClose:a.close}))}));const oM=e=>({flex:i.css`
display: flex;
`,flamegraphPanel:i.css`
min-width: 0;
flex-grow: 1;
`,sidePanel:i.css`
flex: 1 0 50%;
margin-left: 8px;
max-width: calc(50% - 4px);
`,spinner:i.css`
margin-left: ${e.spacing(1)};
`,aiButton:i.css`
margin-top: ${e.spacing(1)};
`}),sM="https://grafana.qualtrics.com/jfe/form/SV_6Gav4IUU6jcYfd4",lM=()=>{const e=(0,o.useStyles2)(cM);return $i().createElement("div",{className:e.wrapper},$i().createElement("a",{href:sM,className:e.feedback,title:"Share your thoughts about Profiles in Grafana.",target:"_blank",rel:"noreferrer noopener"},$i().createElement(o.Icon,{name:"comment-alt-message"})," Give feedback"))},cM=e=>({wrapper:(0,i.css)({display:"flex",gap:e.spacing(1),justifyContent:"flex-end",paddingTop:"4px"}),feedback:(0,i.css)({alignSelf:"center",color:e.colors.text.secondary,fontSize:e.typography.bodySmall.fontSize,"&:hover":{color:e.colors.text.link}})});function uM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class dM extends vh{onActivate(){[rp.BASELINE,rp.COMPARISON].forEach((e=>{this._subs.add(nm.findByKeyAndType(this,`${e}-panel`,zj).state.$timeRange.subscribeToState(((e,t)=>{e.from===t.from&&e.to===t.to||this.setState({value:null})})))}))}openSelect(){this.setState({isSelectOpen:!0})}closeSelect(){this.setState({isSelectOpen:!1})}reset(){this.setState({value:null,isSelectOpen:!1,isModalOpen:!1})}static Component({model:e}){const t=(0,o.useStyles2)(pM),{value:n,isSelectOpen:r,isModalOpen:i}=e.useState();return $i().createElement($i().Fragment,null,$i().createElement("div",{className:t.presetsContainer},$i().createElement(o.Select,{className:t.select,placeholder:"Choose a preset",value:n,options:dM.PRESETS,onChange:e.onChangePreset,isOpen:r,onOpenMenu:e.onOpenSelect,onCloseMenu:e.onCloseSelect}),$i().createElement(o.Button,{icon:"save",variant:"secondary",tooltip:"Save the current time ranges and filters as a custom preset",onClick:e.onClickSave})),$i().createElement(o.Modal,{title:"Custom user presets",isOpen:i,closeOnEscape:!0,closeOnBackdropClick:!0,onDismiss:e.closeModal},$i().createElement("p",null,"This feature, which would allow you to save the current time ranges and filters, is currently not implemented."),$i().createElement("p",null,"Please let us know if you would be interested to use it by"," ",$i().createElement("a",{href:sM,target:"_blank",rel:"noreferrer noopener",className:t.link},"leaving us your feedback.")),$i().createElement("p",null,"Thank you!"),$i().createElement(o.Modal.ButtonRow,null,$i().createElement(o.Button,{variant:"secondary",fill:"outline",onClick:e.closeModal},"Cancel"),$i().createElement(o.Button,{onClick:e.closeModal,disabled:!0},"Save"))))}constructor(){super({name:"compare-presets",label:"Comparison presets",value:null,isModalOpen:!1,isSelectOpen:!1}),uM(this,"_variableDependency",new am(this,{variableNames:["dataSource","serviceName"],onReferencedVariableValueChanged:()=>{this.reset()}})),uM(this,"onChangePreset",(e=>{var t;if(Cs("g_pyroscope_app_diff_preset_selected",{value:e.value}),this.closeSelect(),"dummy"!==e.value){if(null===(t=e.value)||void 0===t?void 0:t.startsWith("auto-select-"))return this.setState({value:null}),void this.publishEvent(new QL({wholeRange:"auto-select-whole"===e.value}),!0);[rp.BASELINE,rp.COMPARISON].forEach((t=>{const n=nm.findByKeyAndType(this,`${t}-panel`,zj);n.toggleTimeRangeSync(!1),n.applyPreset(e[t])})),this.setState({value:e.value})}else this.setState({value:null,isModalOpen:!0})})),uM(this,"onClickSave",(()=>{Cs("g_pyroscope_app_diff_preset_save_clicked"),this.setState({isModalOpen:!0})})),uM(this,"closeModal",(()=>{this.setState({isModalOpen:!1})})),uM(this,"onOpenSelect",(()=>{setTimeout((()=>this.openSelect()),0)})),uM(this,"onCloseSelect",(()=>{this.closeSelect()})),this.addActivationHandler(this.onActivate.bind(this))}}uM(dM,"PRESETS",[{label:"Built-in presets",value:"built-in",options:[{value:"last hour (30m-window)",label:"Last hour (30m-window)",baseline:{from:"now-1h",to:"now",diffFrom:"now-1h",diffTo:"now-30m",label:"last hour"},comparison:{from:"now-1h",to:"now",diffFrom:"now-30m",diffTo:"now",label:"last hour"}},{value:"last hour (1h-window)",label:"Last hour (1h-window)",baseline:{from:"now-1h",to:"now",diffFrom:"now-1h",diffTo:"now",label:"last hour"},comparison:{from:"now-1h",to:"now",diffFrom:"now-1h",diffTo:"now",label:"last hour"}},{value:"6h ago vs now",label:"6h ago vs now (30m-window)",baseline:{from:"now-375m",to:"now-315m",diffFrom:"now-375m",diffTo:"now-345m",label:"6h ago"},comparison:{from:"now-1h",to:"now",diffFrom:"now-30m",diffTo:"now",label:"last hour"}},{value:"24h ago vs now",label:"24h ago vs now (30m-window)",baseline:{from:"now-1455m",to:"now-1395m",diffFrom:"now-1455m",diffTo:"now-1425m",label:"24h ago"},comparison:{from:"now-1h",to:"now",diffFrom:"now-30m",diffTo:"now",label:"last hour"}},{value:"auto-select-25",label:"Auto-select (25% range)"},{value:"auto-select-whole",label:"Auto-select (whole range)"}]},{label:"My presets",value:"custom",options:[{label:"Dummy preset saved earlier",value:"dummy"}]}]);const pM=e=>({presetsContainer:i.css`
display: flex;
`,select:i.css`
min-width: ${e.spacing(24)};
text-align: left;
`,link:i.css`
color: ${e.colors.text.link};
`});function hM(){return e=>{const t=new Map,n=e.subscribeToEvent(__,(n=>{var r;const i=null===(r=n.payload.series)||void 0===r?void 0:r[0];(null==i?void 0:i.refId)?(t.set(i.refId,Math.max(...i.fields[1].values)),function(e,t){const n=nm.findAllObjects(e,(e=>e instanceof pb&&"timeseries"===e.state.pluginId));for(const e of n)e.clearFieldConfigCache(),e.setState({fieldConfig:(0,Bc.merge)((0,Bc.cloneDeep)(e.state.fieldConfig),{defaults:{max:t}})})}(e,Math.max(...t.values()))):Xi.warn("Missing refId! Cannot sync y-axis on the timeseries.",n.payload.series)}));return()=>{n.unsubscribe()}}}class fM extends vh{onActivate(){a.locationService.partial({},!0);const e=nm.findByKeyAndType(this,"profileMetricId",VP);return e.setState({query:VP.QUERY_SERVICE_NAME_DEPENDENT}),e.update(!0),this.subscribeToEvents(),()=>{e.setState({query:VP.QUERY_DEFAULT}),e.update(!0)}}subscribeToEvents(){this._subs.add(this.subscribeToEvent(QL,(e=>{const t=e.payload.wholeRange,{baselinePanel:n,comparisonPanel:r}=this.state;n.toggleTimeRangeSync(!1),r.toggleTimeRangeSync(!1),n.autoSelectDiffRange(t),r.autoSelectDiffRange(t)}))),this._subs.add(this.subscribeToEvent(KL,(()=>{this.state.presetsPicker.openSelect()}))),this._subs.add(this.subscribeToEvent(gj,(e=>{const{source:t,enable:n,timeRange:r,annotationTimeRange:i}=e.payload,{baselinePanel:a,comparisonPanel:o}=this.state,s=t===rp.BASELINE?o:a;n&&this.syncTimeRanges(s,r,i),o.toggleTimeRangeSync(n),a.toggleTimeRangeSync(n)}))),this._subs.add(this.subscribeToEvent(bj,(e=>{const{source:t,timeRange:n,annotationTimeRange:r}=e.payload,{baselinePanel:i,comparisonPanel:a}=this.state,o=t===rp.BASELINE?a:i;this.syncTimeRanges(o,n,r)}))),this._subs.add(this.subscribeToEvent(yj,(e=>{const{source:t}=e.payload,{baselinePanel:n,comparisonPanel:r}=this.state;(t===rp.BASELINE?r:n).refreshTimeseries()})))}syncTimeRanges(e,t,n){t&&e.setTimeRange(t),n&&e.setDiffRange({from:n.from.toISOString(),to:n.to.toISOString()})}getVariablesAndGridControls(){return{variables:[nm.findByKeyAndType(this,"serviceName",HP),nm.findByKeyAndType(this,"profileMetricId",VP),this.state.presetsPicker],gridControls:[]}}static Component({model:e}){const t=(0,o.useStyles2)(mM),{baselinePanel:n,comparisonPanel:r,body:i}=e.useState();return $i().createElement("div",{className:t.container},$i().createElement("div",{className:t.columns},$i().createElement(n.Component,{model:n}),$i().createElement(r.Component,{model:r})),$i().createElement(i.Component,{model:i}))}constructor({useAncestorTimeRange:e,clearDiffRange:t,baselineFilters:n,comparisonFilters:i}){super({key:"explore-diff-flame-graph",baselinePanel:new zj({target:rp.BASELINE,useAncestorTimeRange:Boolean(e),clearDiffRange:Boolean(t),filters:n||[]}),comparisonPanel:new zj({target:rp.COMPARISON,useAncestorTimeRange:Boolean(e),clearDiffRange:Boolean(t),filters:i||[]}),$behaviors:[new by({key:"metricCrosshairSync",sync:r.DashboardCursorSync.Crosshair}),hM()],body:new aM,presetsPicker:new dM}),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"useDiffTimeRanges",(()=>{const{baselinePanel:e,comparisonPanel:t}=this.state,{annotationTimeRange:n}=e.useDiffTimeRange(),{annotationTimeRange:r}=t.useDiffTimeRange();return{baselineTimeRange:n,comparisonTimeRange:r}})),this.addActivationHandler(this.onActivate.bind(this))}}const mM=e=>({container:i.css`
width: 100%;
display: flex;
flex-direction: column;
`,columns:i.css`
display: flex;
flex-direction: row;
gap: ${e.spacing(1)};
margin-bottom: ${e.spacing(1)};
& > div {
flex: 1 1 0;
}
`});function gM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function yM(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){gM(a,r,i,o,s,"next",e)}function s(e){gM(a,r,i,o,s,"throw",e)}o(void 0)}))}}class bM extends NC{githubLogin(e){var t=this;return yM((function*(){const n=yield t.fetch("/vcs.v1.VCSService/GithubLogin",{method:"POST",body:JSON.stringify({authorizationCode:e})});return yield n.json()}))()}githubApp(){var e=this;return yM((function*(){const t=yield e.fetch("/vcs.v1.VCSService/GithubApp",{method:"POST",body:JSON.stringify({})});return(yield t.json()).clientID}))()}}function vM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class wM{isUserTokenExpired(e=0){return Date.now()>=this.expiry.getTime()-e}static decode(e){if(void 0===e||""===e)return;let t;try{t=atob(e)}catch(e){return void Xi.error(e,{info:"Failed to base64 decode GitSession value"})}const{payload:n,isLegacy:r}=wM.tryDecode(t);return r?new wM(e,864e13):new wM(n.metadata,Number(n.expiry))}static tryDecode(e){try{return{payload:JSON.parse(e),isLegacy:!1}}catch(e){return{payload:void 0,isLegacy:!0}}}constructor(e,t){vM(this,"oauthTokenMetadata",void 0),vM(this,"expiry",void 0),this.oauthTokenMetadata=e,this.expiry=new Date(t)}}function SM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const EM="pyroscope_git_session";class xM{getCookie(){return this.syncCookieWithBrowser(),this.sessionCookie}setCookie(e){e.startsWith(`${EM}=`)||(e=`${EM}=${e}`);const t=xM.getCookieFromJar(e,EM);void 0!==t&&(this.deleteLegacyCookie(),this.rawCookie=t,this.sessionCookie=wM.decode(t.value),document.cookie=`${e}; path=/`)}deleteCookie(){document.cookie=`${EM}=; Path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;`,this.deleteLegacyCookie(),this.rawCookie=void 0,this.sessionCookie=void 0}deleteLegacyCookie(){document.cookie="GitSession=; Path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;"}syncCookieWithBrowser(){var e,t;const n=xM.getCookieFromJar(document.cookie,EM);(null==n?void 0:n.key)===(null===(e=this.rawCookie)||void 0===e?void 0:e.key)&&(null==n?void 0:n.value)===(null===(t=this.rawCookie)||void 0===t?void 0:t.value)||(void 0!==n?this.setCookie(`${n.key}=${n.value}`):this.deleteCookie())}static getCookieFromJar(e,t){return e.split(";").map((e=>{const[t,...n]=e.trim().split("="),r=n.join("=");return{key:t.trim(),value:null==r?void 0:r.trim()}})).find((({key:e})=>e===t))}constructor(){SM(this,"rawCookie",void 0),SM(this,"sessionCookie",void 0)}}const OM=new xM;const _M=800,TM=950;function CM(e,t){const n=function(e,t){const n=new URL("/login/oauth/authorize","https://github.com");return n.searchParams.set("client_id",e),n.searchParams.set("scope","repo"),n.searchParams.set("state",btoa(JSON.stringify({redirect_uri:window.location.origin,nonce:t}))),n.toString()}(e,t),{top:r}=window;var i,a;const o=(null!==(i=null==r?void 0:r.outerWidth)&&void 0!==i?i:0)/2+(null!==(a=null==r?void 0:r.screenX)&&void 0!==a?a:0)-_M/2;var s,l;const c=(null!==(s=null==r?void 0:r.outerHeight)&&void 0!==s?s:0)/2+(null!==(l=null==r?void 0:r.screenY)&&void 0!==l?l:0)-TM/2;return window.open(n,"GitHub Login",`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${_M}, height=${TM}, top=${c}, left=${o}`)}function kM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function PM(){var e;return e=function*(e,t,n,r,i){if(r&&r.close(),null==n?void 0:n.isUserTokenExpired())try{return void(yield t.refresh())}catch(e){Xi.error(e,{info:"Failed to refresh GitHub user token"}),OM.deleteCookie()}try{i(CM(yield e.githubApp(),HM))}catch(e){js(e,["Failed to start login flow.",e.message])}},PM=function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){kM(a,r,i,o,s,"next",e)}function s(e){kM(a,r,i,o,s,"throw",e)}o(void 0)}))},PM.apply(this,arguments)}function AM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function RM(){var e;return e=function*(e,t,n){const r=t.get("code");if(!r)return"";const i=t.get("state");if(!i)throw new Error("Invalid state parameter!");let a;try{a=JSON.parse(atob(i))}catch(e){throw new Error("Invalid state parameter!")}if(a.nonce!==n)throw new Error("Invalid nonce parameter!");return(yield e.githubLogin(r)).cookie},RM=function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){AM(a,r,i,o,s,"next",e)}function s(e){AM(a,r,i,o,s,"throw",e)}o(void 0)}))},RM.apply(this,arguments)}function DM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function jM({vcsClient:e,externalWindow:t,setExternalWindow:n,setSessionCookie:r,nonce:i}){(0,Fi.useEffect)((()=>{const a=function(){var o,s=(o=function*(){if(t&&!t.closed){try{const a=function(e){try{return new URL(e.location.href).searchParams}catch(e){return null}}(t);if(null!==a){const o=yield function(e,t,n){return RM.apply(this,arguments)}(e,a,i);if(o)return r(o),t.close(),void n(null)}}catch(e){return js(e,["Error while login in with GitHub!",e.message]),t.close(),void n(null)}window.setTimeout(a,700)}else n(null)},function(){var e=this,t=arguments;return new Promise((function(n,r){var i=o.apply(e,t);function a(e){DM(i,n,r,a,s,"next",e)}function s(e){DM(i,n,r,a,s,"throw",e)}a(void 0)}))});return function(){return s.apply(this,arguments)}}();return t&&a(),()=>{t&&(t.close(),n(null))}}),[t,n,r,i,e])}function IM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function NM(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){IM(a,r,i,o,s,"next",e)}function s(e){IM(a,r,i,o,s,"throw",e)}o(void 0)}))}}const LM={isLoginInProgress:!1,isLoggedIn:!1,isSessionExpired:!1,login:NM((function*(){}))},MM=(0,Fi.createContext)(LM);function FM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function $M(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){FM(a,r,i,o,s,"next",e)}function s(e){FM(a,r,i,o,s,"throw",e)}o(void 0)}))}}function BM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const VM=Object.freeze({sha:"<unknown>",date:void 0,author:{login:"unknown author",avatarURL:""},message:"",URL:""});class UM extends NC{getFile(e,t,n,r){var i=this;return $M((function*(){return(yield i.postWithRefresh("/vcs.v1.VCSService/GetFile",JSON.stringify({repositoryURL:e,ref:t,localPath:n,rootPath:r}))).json()}))()}getCommits(e){var t=this;return $M((function*(){return yield Promise.all(e.map((({repositoryUrl:e,gitRef:n})=>e&&n?t.getCommit(e,n).catch((t=>(Xi.error(t,{info:`Error while fetching commit from repo "${e}" (${n})!'`}),VM))):VM)))}))()}refresh(){var e=this;return $M((function*(){return e.refreshSession()}))()}getCommit(e,t){var n=this;return $M((function*(){var r;const i=yield n.postWithRefresh("/vcs.v1.VCSService/GetCommit",JSON.stringify({repositoryURL:e,ref:t})),a=yield i.json();return(r=a).date&&(r.date=new Date(a.date)),a}))()}postWithRefresh(e,t){var n=this;return $M((function*(){var r;if(n.isRefreshing)return n.queueRequest(e,t);if(null===(r=n.sessionManager.getCookie())||void 0===r?void 0:r.isUserTokenExpired(UM.BIAS_MS)){n.isRefreshing=!0;try{yield n.refreshSession()}catch(e){n.sessionManager.deleteCookie(),n.flushQueue(e)}n.flushQueue(),n.isRefreshing=!1}return n.post(e,t)}))()}post(e,t){var n=this;return $M((function*(){return n.fetch(e,{method:"POST",body:t})}))()}refreshSession(){var e=this;return $M((function*(){const t=yield e.fetch("/vcs.v1.VCSService/GithubRefresh",{method:"POST",body:JSON.stringify({})}),n=yield t.json();e.sessionManager.setCookie(n.cookie)}))()}queueRequest(e,t){var n=this;return $M((function*(){return new Promise(((r,i)=>{n.pendingQueue.push((a=>{a?i(a):r(n.post(e,t))}))}))}))()}flushQueue(e=void 0){this.pendingQueue.forEach((t=>t(e))),this.pendingQueue=[]}constructor(e){super(e),BM(this,"sessionManager",void 0),BM(this,"pendingQueue",void 0),BM(this,"isRefreshing",void 0),this.sessionManager=OM,this.isRefreshing=!1,this.pendingQueue=[]}}function zM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function qM(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){zM(a,r,i,o,s,"next",e)}function s(e){zM(a,r,i,o,s,"throw",e)}o(void 0)}))}}BM(UM,"BIAS_MS",3e5);const HM=btoa(String.fromCharCode(...crypto.getRandomValues(new Uint8Array(32))));function GM({dataSourceUid:e,children:t}){const n=oj.build(e,bM),r=oj.build(e,UM),[i,a]=(0,Fi.useState)(LM.isLoginInProgress),[o,s]=function(){const[e,t]=(0,Fi.useState)(OM.getCookie());return[e,e=>{e?(OM.setCookie(e),t(OM.getCookie())):(OM.deleteCookie(),t(void 0))}]}(),[l,c]=(0,Fi.useState)();(0,Fi.useEffect)((()=>{s("")}),[e]),jM({vcsClient:n,externalWindow:l,setExternalWindow:c,setSessionCookie:s,nonce:HM});const u=!!l&&!l.closed;u!==i&&a(u);const d=(0,Fi.useCallback)(qM((function*(){try{yield function(e,t,n,r,i){return PM.apply(this,arguments)}(n,r,o,l,c)}catch(e){js(e,["Failed to login to GitHub",e.message])}})),[n,r,o,l]);return $i().createElement(MM.Provider,{value:{isLoginInProgress:i,isLoggedIn:Boolean(o&&!o.isUserTokenExpired()),isSessionExpired:Boolean(null==o?void 0:o.isUserTokenExpired()),login:d}},t)}class WM extends r.BusEventWithPayload{}!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(WM,"type","remove-span-selector");const QM={metricsFromProfiles:!!a.config.featureToggles.metricsFromProfiles};function KM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){KM(e,t,n[t])}))}return e}function XM({filters:e,maxNodes:t,spanSelector:n}){const r=e?[...e]:[];r.unshift({key:"service_name",operator:"=",value:"$serviceName"});const i=r.map((({key:e,operator:t,value:n})=>`${e}${t}"${n}"`)).join(",");return mA(new Yg({datasource:NP,queries:[YM({refId:"profile",queryType:"profile",profileTypeId:"$profileMetricId",labelSelector:`{${i},$filters}`,maxNodes:t},n&&{spanSelector:[n]})]}))}function JM(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function ZM(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){JM(a,r,i,o,s,"next",e)}function s(e){JM(a,r,i,o,s,"throw",e)}o(void 0)}))}}const eF=new class extends ua{get(){var e=this,t=()=>super.fetch;return ZM((function*(){return t().call(e,"/settings.v1.RecordingRulesService/ListRecordingRules",{method:"POST",body:JSON.stringify({})}).then((e=>e.json())).then((e=>e.rules?e.rules.map((e=>function(e){let t="";for(let r of e.matchers||[])if(r.includes("service_name=")){var n;t=(null==r||null===(n=r.match(/service_name="([^"]+)"/))||void 0===n?void 0:n[1])||"";break}return{id:e.id,metricName:e.metricName,serviceName:t,profileType:e.profileType,matchers:e.matchers,groupBy:e.groupBy||[]}}(e))):[]))}))()}create(e){var t=this,n=()=>super.fetch;return ZM((function*(){return n().call(t,"/settings.v1.RecordingRulesService/UpsertRecordingRule",{method:"POST",body:JSON.stringify({metricName:e.metricName,matchers:[`{ service_name="${e.serviceName}" }`,`{ __profile_type__="${e.profileType}"}`,...e.matchers||[]],groupBy:e.groupBy||[]})}).then((e=>e.json()))}))()}remove(e){var t=this,n=()=>super.fetch;return ZM((function*(){return n().call(t,"/settings.v1.RecordingRulesService/DeleteRecordingRule",{method:"POST",body:JSON.stringify({id:e.id})}).then((e=>e.json()))}))()}};function tF(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function nF({enabled:e}={}){const t=Ui(),{isFetching:n,error:r,data:i}=Pa({enabled:e,queryKey:["recording_rules"],queryFn:()=>eF.get()}),{mutateAsync:a}=Wj({mutationFn:e=>eF.create(e),networkMode:"always"}),{mutateAsync:o}=Wj({mutationFn:function(){var e,n=(e=function*(e){yield eF.remove(e),yield t.invalidateQueries({queryKey:["recording_rules"]})},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){tF(a,r,i,o,s,"next",e)}function s(e){tF(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(e){return n.apply(this,arguments)}}(),networkMode:"always"});return{isFetching:n,error:eF.isAbortError(r)?null:r,recordingRules:i,mutate:a,remove:o}}function rF(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function iF(){const{recordingRules:e,error:t,mutate:n}=nF();return{data:{recordingRules:e,fetchError:t},actions:{save(e){return(t=function*(){try{yield n(e),Ns([`Recording rule ${e.metricName} created successfully!`])}catch(t){js(t,[`Failed to save recording rule ${e.metricName}.`])}},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){rF(a,r,i,o,s,"next",e)}function s(e){rF(a,r,i,o,s,"throw",e)}o(void 0)}))})();var t}}}}var aF=e=>"checkbox"===e.type,oF=e=>e instanceof Date,sF=e=>null==e;const lF=e=>"object"==typeof e;var cF=e=>!sF(e)&&!Array.isArray(e)&&lF(e)&&!oF(e),uF=e=>cF(e)&&e.target?aF(e.target)?e.target.checked:e.target.value:e,dF=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),pF=e=>{const t=e.constructor&&e.constructor.prototype;return cF(t)&&t.hasOwnProperty("isPrototypeOf")},hF="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function fF(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(hF&&(e instanceof Blob||r)||!n&&!cF(e))return e;if(t=n?[]:{},n||pF(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=fF(e[n]));else t=e}return t}var mF=e=>Array.isArray(e)?e.filter(Boolean):[],gF=e=>void 0===e,yF=(e,t,n)=>{if(!t||!cF(e))return n;const r=mF(t.split(/[,[\].]+?/)).reduce(((e,t)=>sF(e)?e:e[t]),e);return gF(r)||r===e?gF(e[t])?n:e[t]:r},bF=e=>"boolean"==typeof e,vF=e=>/^\w*$/.test(e),wF=e=>mF(e.replace(/["|']|\]/g,"").split(/\.|\[/)),SF=(e,t,n)=>{let r=-1;const i=vF(t)?[t]:wF(t),a=i.length,o=a-1;for(;++r<a;){const t=i[r];let a=n;if(r!==o){const n=e[t];a=cF(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=a,e=e[t]}return e};const EF={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},xF={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},OF="max",_F="min",TF="maxLength",CF="minLength",kF="pattern",PF="required",AF="validate",RF=Fi.createContext(null),DF=()=>Fi.useContext(RF);var jF=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(i,a,{get:()=>{const i=a;return t._proxyFormState[i]!==xF.all&&(t._proxyFormState[i]=!r||xF.all),n&&(n[i]=!0),e[i]}});return i},IF=e=>cF(e)&&!Object.keys(e).length,NF=(e,t,n,r)=>{n(e);const{name:i,...a}=e;return IF(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find((e=>t[e]===(!r||xF.all)))},LF=e=>Array.isArray(e)?e:[e],MF=(e,t,n)=>!e||!t||e===t||LF(e).some((e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))));function FF(e){const t=Fi.useRef(e);t.current=e,Fi.useEffect((()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}}),[e.disabled])}var $F=e=>"string"==typeof e,BF=(e,t,n,r,i)=>$F(e)?(r&&t.watch.add(e),yF(n,e,i)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),yF(n,e)))):(r&&(t.watchAll=!0),n);function VF(e){const t=DF(),{name:n,disabled:r,control:i=t.control,shouldUnregister:a}=e,o=dF(i._names.array,n),s=function(e){const t=DF(),{control:n=t.control,name:r,defaultValue:i,disabled:a,exact:o}=e||{},s=Fi.useRef(r);s.current=r,FF({disabled:a,subject:n._subjects.values,next:e=>{MF(s.current,e.name,o)&&c(fF(BF(s.current,n._names,e.values||n._formValues,!1,i)))}});const[l,c]=Fi.useState(n._getWatch(r,i));return Fi.useEffect((()=>n._removeUnmounted())),l}({control:i,name:n,defaultValue:yF(i._formValues,n,yF(i._defaultValues,n,e.defaultValue)),exact:!0}),l=function(e){const t=DF(),{control:n=t.control,disabled:r,name:i,exact:a}=e||{},[o,s]=Fi.useState(n._formState),l=Fi.useRef(!0),c=Fi.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=Fi.useRef(i);return u.current=i,FF({disabled:r,next:e=>l.current&&MF(u.current,e.name,a)&&NF(e,c.current,n._updateFormState)&&s({...n._formState,...e}),subject:n._subjects.state}),Fi.useEffect((()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1})),[n]),Fi.useMemo((()=>jF(o,n,c.current,!1)),[o,n])}({control:i,name:n,exact:!0}),c=Fi.useRef(i.register(n,{...e.rules,value:s,...bF(e.disabled)?{disabled:e.disabled}:{}})),u=Fi.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!yF(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!yF(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!yF(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!yF(l.validatingFields,n)},error:{enumerable:!0,get:()=>yF(l.errors,n)}})),[l,n]),d=Fi.useMemo((()=>({name:n,value:s,...bF(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:e=>c.current.onChange({target:{value:uF(e),name:n},type:EF.CHANGE}),onBlur:()=>c.current.onBlur({target:{value:yF(i._formValues,n),name:n},type:EF.BLUR}),ref:e=>{const t=yF(i._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}})),[n,i._formValues,r,l.disabled,s,i._fields]);return Fi.useEffect((()=>{const e=i._options.shouldUnregister||a,t=(e,t)=>{const n=yF(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){const e=fF(yF(i._options.defaultValues,n));SF(i._defaultValues,n,e),gF(yF(i._formValues,n))&&SF(i._formValues,n,e)}return!o&&i.register(n),()=>{(o?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}}),[n,i,o,a]),Fi.useEffect((()=>{i._updateDisabledField({disabled:r,fields:i._fields,name:n})}),[r,n,i]),Fi.useMemo((()=>({field:d,formState:l,fieldState:u})),[d,l,u])}const UF=e=>e.render(VF(e));var zF=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},qF=e=>({isOnSubmit:!e||e===xF.onSubmit,isOnBlur:e===xF.onBlur,isOnChange:e===xF.onChange,isOnAll:e===xF.all,isOnTouch:e===xF.onTouched}),HF=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const GF=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const n=yF(e,i);if(n){const{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(GF(a,t))break}else if(cF(a)&&GF(a,t))break}}};var WF=(e,t,n)=>{const r=LF(yF(e,n));return SF(r,"root",t[n]),SF(e,n,r),e},QF=e=>"file"===e.type,KF=e=>"function"==typeof e,YF=e=>{if(!hF)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},XF=e=>$F(e),JF=e=>"radio"===e.type,ZF=e=>e instanceof RegExp;const e$={value:!1,isValid:!1},t$={value:!0,isValid:!0};var n$=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!gF(e[0].attributes.value)?gF(e[0].value)||""===e[0].value?t$:{value:e[0].value,isValid:!0}:t$:e$}return e$};const r$={isValid:!1,value:null};var i$=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),r$):r$;function a$(e,t,n="validate"){if(XF(e)||Array.isArray(e)&&e.every(XF)||bF(e)&&!e)return{type:n,message:XF(e)?e:"",ref:t}}var o$=e=>cF(e)&&!ZF(e)?e:{value:e,message:""},s$=async(e,t,n,r,i,a)=>{const{ref:o,refs:s,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:h,validate:f,name:m,valueAsNumber:g,mount:y}=e._f,b=yF(n,m);if(!y||t.has(m))return{};const v=s?s[0]:o,w=e=>{i&&v.reportValidity&&(v.setCustomValidity(bF(e)?"":e||""),v.reportValidity())},S={},E=JF(o),x=aF(o),O=E||x,_=(g||QF(o))&&gF(o.value)&&gF(b)||YF(o)&&""===o.value||""===b||Array.isArray(b)&&!b.length,T=zF.bind(null,m,r,S),C=(e,t,n,r=TF,i=CF)=>{const a=e?t:n;S[m]={type:e?r:i,message:a,ref:o,...T(e?r:i,a)}};if(a?!Array.isArray(b)||!b.length:l&&(!O&&(_||sF(b))||bF(b)&&!b||x&&!n$(s).isValid||E&&!i$(s).isValid)){const{value:e,message:t}=XF(l)?{value:!!l,message:l}:o$(l);if(e&&(S[m]={type:PF,message:t,ref:v,...T(PF,t)},!r))return w(t),S}if(!(_||sF(d)&&sF(p))){let e,t;const n=o$(p),i=o$(d);if(sF(b)||isNaN(b)){const r=o.valueAsDate||new Date(b),a=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;$F(n.value)&&b&&(e=s?a(b)>a(n.value):l?b>n.value:r>new Date(n.value)),$F(i.value)&&b&&(t=s?a(b)<a(i.value):l?b<i.value:r<new Date(i.value))}else{const r=o.valueAsNumber||(b?+b:b);sF(n.value)||(e=r>n.value),sF(i.value)||(t=r<i.value)}if((e||t)&&(C(!!e,n.message,i.message,OF,_F),!r))return w(S[m].message),S}if((c||u)&&!_&&($F(b)||a&&Array.isArray(b))){const e=o$(c),t=o$(u),n=!sF(e.value)&&b.length>+e.value,i=!sF(t.value)&&b.length<+t.value;if((n||i)&&(C(n,e.message,t.message),!r))return w(S[m].message),S}if(h&&!_&&$F(b)){const{value:e,message:t}=o$(h);if(ZF(e)&&!b.match(e)&&(S[m]={type:kF,message:t,ref:o,...T(kF,t)},!r))return w(t),S}if(f)if(KF(f)){const e=a$(await f(b,n),v);if(e&&(S[m]={...e,...T(AF,e.message)},!r))return w(e.message),S}else if(cF(f)){let e={};for(const t in f){if(!IF(e)&&!r)break;const i=a$(await f[t](b,n),v,t);i&&(e={...i,...T(t,i.message)},w(i.message),r&&(S[m]=e))}if(!IF(e)&&(S[m]={ref:v,...e},!r))return S}return w(!0),S};function l$(e,t){const n=Array.isArray(t)?t:vF(t)?[t]:wF(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=gF(e)?r++:e[t[r++]];return e}(e,n),i=n.length-1,a=n[i];return r&&delete r[a],0!==i&&(cF(r)&&IF(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!gF(e[t]))return!1;return!0}(r))&&l$(e,n.slice(0,-1)),e}var c$=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},u$=e=>sF(e)||!lF(e);function d$(e,t){if(u$(e)||u$(t))return e===t;if(oF(e)&&oF(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const n=e[i];if(!r.includes(i))return!1;if("ref"!==i){const e=t[i];if(oF(n)&&oF(e)||cF(n)&&cF(e)||Array.isArray(n)&&Array.isArray(e)?!d$(n,e):n!==e)return!1}}return!0}var p$=e=>"select-multiple"===e.type,h$=e=>JF(e)||aF(e),f$=e=>YF(e)&&e.isConnected,m$=e=>{for(const t in e)if(KF(e[t]))return!0;return!1};function g$(e,t={}){const n=Array.isArray(e);if(cF(e)||n)for(const n in e)Array.isArray(e[n])||cF(e[n])&&!m$(e[n])?(t[n]=Array.isArray(e[n])?[]:{},g$(e[n],t[n])):sF(e[n])||(t[n]=!0);return t}function y$(e,t,n){const r=Array.isArray(e);if(cF(e)||r)for(const r in e)Array.isArray(e[r])||cF(e[r])&&!m$(e[r])?gF(t)||u$(n[r])?n[r]=Array.isArray(e[r])?g$(e[r],[]):{...g$(e[r])}:y$(e[r],sF(t)?{}:t[r],n[r]):n[r]=!d$(e[r],t[r]);return n}var b$=(e,t)=>y$(e,t,g$(t)),v$=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>gF(e)?e:t?""===e?NaN:e?+e:e:n&&$F(e)?new Date(e):r?r(e):e;function w$(e){const t=e.ref;return QF(t)?t.files:JF(t)?i$(e.refs).value:p$(t)?[...t.selectedOptions].map((({value:e})=>e)):aF(t)?n$(e.refs).value:v$(gF(t.value)?e.ref.value:t.value,e)}var S$=(e,t,n,r)=>{const i={};for(const n of e){const e=yF(t,n);e&&SF(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},E$=e=>gF(e)?e:ZF(e)?e.source:cF(e)?ZF(e.value)?e.value.source:e.value:e;const x$="AsyncFunction";var O$=e=>!!e&&!!e.validate&&!!(KF(e.validate)&&e.validate.constructor.name===x$||cF(e.validate)&&Object.values(e.validate).find((e=>e.constructor.name===x$))),_$=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function T$(e,t,n){const r=yF(e,n);if(r||vF(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),a=yF(t,r),o=yF(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};i.pop()}return{name:n}}var C$=(e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e),k$=(e,t)=>!mF(yF(e,t)).length&&l$(e,t);const P$={mode:xF.onSubmit,reValidateMode:xF.onChange,shouldFocusError:!0};function A$(e={}){let t,n={...P$,...e},r={submitCount:0,isDirty:!1,isLoading:KF(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},i={},a=(cF(n.defaultValues)||cF(n.values))&&fF(n.defaultValues||n.values)||{},o=n.shouldUnregister?{}:fF(a),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:c$(),array:c$(),state:c$()},p=qF(n.mode),h=qF(n.reValidateMode),f=n.criteriaMode===xF.all,m=async e=>{if(!n.disabled&&(u.isValid||e)){const e=n.resolver?IF((await w()).errors):await S(i,!0);e!==r.isValid&&d.state.next({isValid:e})}},g=(e,t)=>{n.disabled||!u.isValidating&&!u.validatingFields||((e||Array.from(l.mount)).forEach((e=>{e&&(t?SF(r.validatingFields,e,t):l$(r.validatingFields,e))})),d.state.next({validatingFields:r.validatingFields,isValidating:!IF(r.validatingFields)}))},y=(e,t,n,r)=>{const l=yF(i,e);if(l){const i=yF(o,e,gF(n)?yF(a,e):n);gF(i)||r&&r.defaultChecked||t?SF(o,e,t?i:w$(l._f)):O(e,i),s.mount&&m()}},b=(e,t,o,s,l)=>{let c=!1,p=!1;const h={name:e};if(!n.disabled){const n=!!(yF(i,e)&&yF(i,e)._f&&yF(i,e)._f.disabled);if(!o||s){u.isDirty&&(p=r.isDirty,r.isDirty=h.isDirty=E(),c=p!==h.isDirty);const i=n||d$(yF(a,e),t);p=!(n||!yF(r.dirtyFields,e)),i||n?l$(r.dirtyFields,e):SF(r.dirtyFields,e,!0),h.dirtyFields=r.dirtyFields,c=c||u.dirtyFields&&p!==!i}if(o){const t=yF(r.touchedFields,e);t||(SF(r.touchedFields,e,o),h.touchedFields=r.touchedFields,c=c||u.touchedFields&&t!==o)}c&&l&&d.state.next(h)}return c?h:{}},v=(e,i,a,o)=>{const s=yF(r.errors,e),l=u.isValid&&bF(i)&&r.isValid!==i;var p;if(n.delayError&&a?(p=()=>((e,t)=>{SF(r.errors,e,t),d.state.next({errors:r.errors})})(e,a),t=e=>{clearTimeout(c),c=setTimeout(p,e)},t(n.delayError)):(clearTimeout(c),t=null,a?SF(r.errors,e,a):l$(r.errors,e)),(a?!d$(s,a):s)||!IF(o)||l){const t={...o,...l&&bF(i)?{isValid:i}:{},errors:r.errors,name:e};r={...r,...t},d.state.next(t)}},w=async e=>{g(e,!0);const t=await n.resolver(o,n.context,S$(e||l.mount,i,n.criteriaMode,n.shouldUseNativeValidation));return g(e),t},S=async(e,t,i={valid:!0})=>{for(const a in e){const s=e[a];if(s){const{_f:e,...c}=s;if(e){const c=l.array.has(e.name),d=s._f&&O$(s._f);d&&u.validatingFields&&g([a],!0);const p=await s$(s,l.disabled,o,f,n.shouldUseNativeValidation&&!t,c);if(d&&u.validatingFields&&g([a]),p[e.name]&&(i.valid=!1,t))break;!t&&(yF(p,e.name)?c?WF(r.errors,p,e.name):SF(r.errors,e.name,p[e.name]):l$(r.errors,e.name))}!IF(c)&&await S(c,t,i)}}return i.valid},E=(e,t)=>!n.disabled&&(e&&t&&SF(o,e,t),!d$(A(),a)),x=(e,t,n)=>BF(e,l,{...s.mount?o:gF(t)?a:$F(e)?{[e]:t}:t},n,t),O=(e,t,n={})=>{const r=yF(i,e);let a=t;if(r){const n=r._f;n&&(!n.disabled&&SF(o,e,v$(t,n)),a=YF(n.ref)&&sF(t)?"":t,p$(n.ref)?[...n.ref.options].forEach((e=>e.selected=a.includes(e.value))):n.refs?aF(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(a)?!!a.find((t=>t===e.value)):a===e.value))):n.refs[0]&&(n.refs[0].checked=!!a):n.refs.forEach((e=>e.checked=e.value===a)):QF(n.ref)?n.ref.value="":(n.ref.value=a,n.ref.type||d.values.next({name:e,values:{...o}})))}(n.shouldDirty||n.shouldTouch)&&b(e,a,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&P(e)},_=(e,t,n)=>{for(const r in t){const a=t[r],o=`${e}.${r}`,s=yF(i,o);(l.array.has(e)||cF(a)||s&&!s._f)&&!oF(a)?_(o,a,n):O(o,a,n)}},T=(e,t,n={})=>{const c=yF(i,e),p=l.array.has(e),h=fF(t);SF(o,e,h),p?(d.array.next({name:e,values:{...o}}),(u.isDirty||u.dirtyFields)&&n.shouldDirty&&d.state.next({name:e,dirtyFields:b$(a,o),isDirty:E(e,h)})):!c||c._f||sF(h)?O(e,h,n):_(e,h,n),HF(e,l)&&d.state.next({...r}),d.values.next({name:s.mount?e:void 0,values:{...o}})},C=async e=>{s.mount=!0;const a=e.target;let c=a.name,y=!0;const E=yF(i,c),x=e=>{y=Number.isNaN(e)||oF(e)&&isNaN(e.getTime())||d$(e,yF(o,c,e))};if(E){let s,O;const _=a.type?w$(E._f):uF(e),T=e.type===EF.BLUR||e.type===EF.FOCUS_OUT,C=!_$(E._f)&&!n.resolver&&!yF(r.errors,c)&&!E._f.deps||C$(T,yF(r.touchedFields,c),r.isSubmitted,h,p),k=HF(c,l,T);SF(o,c,_),T?(E._f.onBlur&&E._f.onBlur(e),t&&t(0)):E._f.onChange&&E._f.onChange(e);const A=b(c,_,T,!1),R=!IF(A)||k;if(!T&&d.values.next({name:c,type:e.type,values:{...o}}),C)return u.isValid&&("onBlur"===n.mode&&T?m():T||m()),R&&d.state.next({name:c,...k?{}:A});if(!T&&k&&d.state.next({...r}),n.resolver){const{errors:e}=await w([c]);if(x(_),y){const t=T$(r.errors,i,c),n=T$(e,i,t.name||c);s=n.error,c=n.name,O=IF(e)}}else g([c],!0),s=(await s$(E,l.disabled,o,f,n.shouldUseNativeValidation))[c],g([c]),x(_),y&&(s?O=!1:u.isValid&&(O=await S(i,!0)));y&&(E._f.deps&&P(E._f.deps),v(c,O,s,A))}},k=(e,t)=>{if(yF(r.errors,t)&&e.focus)return e.focus(),1},P=async(e,t={})=>{let a,o;const s=LF(e);if(n.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const n of e){const e=yF(t,n);e?SF(r.errors,n,e):l$(r.errors,n)}else r.errors=t;return t})(gF(e)?e:s);a=IF(t),o=e?!s.some((e=>yF(t,e))):a}else e?(o=(await Promise.all(s.map((async e=>{const t=yF(i,e);return await S(t&&t._f?{[e]:t}:t)})))).every(Boolean),(o||r.isValid)&&m()):o=a=await S(i);return d.state.next({...!$F(e)||u.isValid&&a!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:a}:{},errors:r.errors}),t.shouldFocus&&!o&&GF(i,k,e?s:l.mount),o},A=e=>{const t={...s.mount?o:a};return gF(e)?t:$F(e)?yF(t,e):e.map((e=>yF(t,e)))},R=(e,t)=>({invalid:!!yF((t||r).errors,e),isDirty:!!yF((t||r).dirtyFields,e),error:yF((t||r).errors,e),isValidating:!!yF(r.validatingFields,e),isTouched:!!yF((t||r).touchedFields,e)}),D=(e,t,n)=>{const a=(yF(i,e,{_f:{}})._f||{}).ref,o=yF(r.errors,e)||{},{ref:s,message:l,type:c,...u}=o;SF(r.errors,e,{...u,...t,ref:a}),d.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&a&&a.focus&&a.focus()},j=(e,t={})=>{for(const s of e?LF(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||(l$(i,s),l$(o,s)),!t.keepError&&l$(r.errors,s),!t.keepDirty&&l$(r.dirtyFields,s),!t.keepTouched&&l$(r.touchedFields,s),!t.keepIsValidating&&l$(r.validatingFields,s),!n.shouldUnregister&&!t.keepDefaultValue&&l$(a,s);d.values.next({values:{...o}}),d.state.next({...r,...t.keepDirty?{isDirty:E()}:{}}),!t.keepIsValid&&m()},I=({disabled:e,name:t,field:n,fields:r})=>{(bF(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t),b(t,w$(n?n._f:yF(r,t)._f),!1,!1,!0))},N=(e,t={})=>{let r=yF(i,e);const o=bF(t.disabled)||bF(n.disabled);return SF(i,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),r?I({field:r,disabled:bF(t.disabled)?t.disabled:n.disabled,name:e}):y(e,!0,t.value),{...o?{disabled:t.disabled||n.disabled}:{},...n.progressive?{required:!!t.required,min:E$(t.min),max:E$(t.max),minLength:E$(t.minLength),maxLength:E$(t.maxLength),pattern:E$(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:o=>{if(o){N(e,t),r=yF(i,e);const n=gF(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=h$(n),l=r._f.refs||[];if(s?l.find((e=>e===n)):n===r._f.ref)return;SF(i,e,{_f:{...r._f,...s?{refs:[...l.filter(f$),n,...Array.isArray(yF(a,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),y(e,!1,void 0,n)}else r=yF(i,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!dF(l.array,e)||!s.action)&&l.unMount.add(e)}}},L=()=>n.shouldFocusError&&GF(i,k,l.mount),M=(e,t)=>async a=>{let s;a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let c=fF(o);if(l.disabled.size)for(const e of l.disabled)SF(c,e,void 0);if(d.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await w();r.errors=e,c=t}else await S(i);if(l$(r.errors,"root"),IF(r.errors)){d.state.next({errors:{}});try{await e(c,a)}catch(e){s=e}}else t&&await t({...r.errors},a),L(),setTimeout(L);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:IF(r.errors)&&!s,submitCount:r.submitCount+1,errors:r.errors}),s)throw s},F=(e,t={})=>{const c=e?fF(e):a,p=fF(c),h=IF(e),f=h?a:p;if(t.keepDefaultValues||(a=c),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(b$(a,o))]);for(const t of Array.from(e))yF(r.dirtyFields,t)?SF(f,t,yF(o,t)):T(t,yF(f,t))}else{if(hF&&gF(e))for(const e of l.mount){const t=yF(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(YF(e)){const t=e.closest("form");if(t){t.reset();break}}}}i={}}o=n.shouldUnregister?t.keepDefaultValues?fF(a):{}:fF(f),d.array.next({values:{...f}}),d.values.next({values:{...f}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!n.shouldUnregister,d.state.next({submitCount:t.keepSubmitCount?r.submitCount:0,isDirty:!h&&(t.keepDirty?r.isDirty:!(!t.keepDefaultValues||d$(e,a))),isSubmitted:!!t.keepIsSubmitted&&r.isSubmitted,dirtyFields:h?{}:t.keepDirtyValues?t.keepDefaultValues&&o?b$(a,o):r.dirtyFields:t.keepDefaultValues&&e?b$(a,e):t.keepDirty?r.dirtyFields:{},touchedFields:t.keepTouched?r.touchedFields:{},errors:t.keepErrors?r.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&r.isSubmitSuccessful,isSubmitting:!1})},$=(e,t)=>F(KF(e)?e(o):e,t);return{control:{register:N,unregister:j,getFieldState:R,handleSubmit:M,setError:D,_executeSchema:w,_getWatch:x,_getDirty:E,_updateValid:m,_removeUnmounted:()=>{for(const e of l.unMount){const t=yF(i,e);t&&(t._f.refs?t._f.refs.every((e=>!f$(e))):!f$(t._f.ref))&&j(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],l,c,p=!0,h=!0)=>{if(c&&l&&!n.disabled){if(s.action=!0,h&&Array.isArray(yF(i,e))){const t=l(yF(i,e),c.argA,c.argB);p&&SF(i,e,t)}if(h&&Array.isArray(yF(r.errors,e))){const t=l(yF(r.errors,e),c.argA,c.argB);p&&SF(r.errors,e,t),k$(r.errors,e)}if(u.touchedFields&&h&&Array.isArray(yF(r.touchedFields,e))){const t=l(yF(r.touchedFields,e),c.argA,c.argB);p&&SF(r.touchedFields,e,t)}u.dirtyFields&&(r.dirtyFields=b$(a,o)),d.state.next({name:e,isDirty:E(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else SF(o,e,t)},_updateDisabledField:I,_getFieldArray:e=>mF(yF(s.mount?o:a,e,n.shouldUnregister?yF(a,e,[]):[])),_reset:F,_resetDefaultValues:()=>KF(n.defaultValues)&&n.defaultValues().then((e=>{$(e,n.resetOptions),d.state.next({isLoading:!1})})),_updateFormState:e=>{r={...r,...e}},_disableForm:e=>{bF(e)&&(d.state.next({disabled:e}),GF(i,((t,n)=>{const r=yF(i,n);r&&(t.disabled=r._f.disabled||e,Array.isArray(r._f.refs)&&r._f.refs.forEach((t=>{t.disabled=r._f.disabled||e})))}),0,!1))},_subjects:d,_proxyFormState:u,_setErrors:e=>{r.errors=e,d.state.next({errors:r.errors,isValid:!1})},get _fields(){return i},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return a},get _names(){return l},set _names(e){l=e},get _formState(){return r},set _formState(e){r=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:P,register:N,handleSubmit:M,watch:(e,t)=>KF(e)?d.values.subscribe({next:n=>e(x(void 0,t),n)}):x(e,t,!0),setValue:T,getValues:A,reset:$,resetField:(e,t={})=>{yF(i,e)&&(gF(t.defaultValue)?T(e,fF(yF(a,e))):(T(e,t.defaultValue),SF(a,e,fF(t.defaultValue))),t.keepTouched||l$(r.touchedFields,e),t.keepDirty||(l$(r.dirtyFields,e),r.isDirty=t.defaultValue?E(e,fF(yF(a,e))):E()),t.keepError||(l$(r.errors,e),u.isValid&&m()),d.state.next({...r}))},clearErrors:e=>{e&&LF(e).forEach((e=>l$(r.errors,e))),d.state.next({errors:e?r.errors:{}})},unregister:j,setError:D,setFocus:(e,t={})=>{const n=yF(i,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&KF(e.select)&&e.select())}},getFieldState:R}}function R$(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){R$(e,t,n[t])}))}return e}function j$(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}class I$ extends vh{constructor(){super({})}}R$(I$,"Component",(({model:e,isModalOpen:t,onDismiss:n,onCreate:r})=>{const{register:i,handleSubmit:a,control:s,formState:{errors:l}}=function(e={}){const t=Fi.useRef(void 0),n=Fi.useRef(void 0),[r,i]=Fi.useState({isDirty:!1,isValidating:!1,isLoading:KF(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:KF(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...A$(e),formState:r});const a=t.current.control;return a._options=e,FF({subject:a._subjects.state,next:e=>{NF(e,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),Fi.useEffect((()=>a._disableForm(e.disabled)),[a,e.disabled]),Fi.useEffect((()=>{if(a._proxyFormState.isDirty){const e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}}),[a,r.isDirty]),Fi.useEffect((()=>{e.values&&!d$(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values,i((e=>({...e})))):a._resetDefaultValues()}),[e.values,a]),Fi.useEffect((()=>{e.errors&&a._setErrors(e.errors)}),[e.errors,a]),Fi.useEffect((()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()})),Fi.useEffect((()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})}),[e.shouldUnregister,a]),t.current.formState=jF(r,a),t.current}({mode:"onChange",shouldUnregister:!0}),[c,u]=(0,Fi.useState)([]),d=IP(nm.findByKeyAndType(e,"profileMetricId",VP).state.value),p=nm.findByKeyAndType(e,"serviceName",HP).state.value,h=nm.findByKeyAndType(e,"filters",oA).state.filters,f=h.map((e=>`${e.key}${e.operator}"${e.value}"`)).join(", ");return(0,Fi.useEffect)((()=>{const t=nm.getTimeRange(e).state.value;YC.listLabels({query:`{${f}}`,from:1e3*t.from.unix(),to:1e3*t.to.unix()}).then((e=>{u(e.map((e=>e.value)))}))}),[f,e]),$i().createElement(o.Modal,{title:"Create recording rule",isOpen:t,onDismiss:n},$i().createElement("form",{onSubmit:a((e=>r({id:"",metricName:e.metricName,serviceName:e.serviceName,profileType:e.profileType,matchers:[`{${f}}`],groupBy:e.labels?e.labels.map((e=>{var t;return null!==(t=e.value)&&void 0!==t?t:""})):[]})))},$i().createElement(o.Field,{label:"Metric name",description:"The name of the Prometheus metric",error:N$(l.metricName),invalid:!!l.metricName},$i().createElement(o.Input,D$({placeholder:`pyroscope_metric_${d.type}_${p.toString().replace(/[^a-zA-Z0-9_]/g,"_")}`,required:!0,autoFocus:!0},i("metricName",{required:"Metric name is required.",pattern:{value:/^[a-zA-Z_][a-zA-Z0-9_]*$/,message:"Invalid metric name."}})))),$i().createElement(o.Field,{label:"Additional labels",description:"Additional profiling labels to forward to the metric"},$i().createElement(UF,{name:"labels",control:s,render:({field:e})=>$i().createElement(o.MultiSelect,j$(D$({},e),{options:c.map((e=>({label:e,value:e}))),toggleAllOptions:{enabled:!0},closeMenuOnSelect:!1,hideSelectedOptions:!1}))})),$i().createElement(o.Divider,null),$i().createElement(o.Field,{label:"Service name"},$i().createElement("div",null,`${p}`)),$i().createElement("input",D$({type:"text",value:p.toString(),hidden:!0},i("serviceName"))),$i().createElement(o.Field,{label:"Profile type"},$i().createElement("div",null,`${d.group}/${d.type}`)),$i().createElement("input",D$({type:"text",value:d.id,hidden:!0},i("profileType"))),$i().createElement(o.Field,{label:"Filters",description:"Filters selected in the main view will be applied to this rule"},$i().createElement("div",null,0===h.length?"No filters selected":f)),$i().createElement(o.Modal.ButtonRow,null,$i().createElement(o.Button,{variant:"secondary",fill:"outline",onClick:n},"Cancel"),$i().createElement(o.Button,{variant:"primary",type:"submit"},"Create"))))}));const N$=e=>{const t=(0,o.useStyles2)(L$);if(void 0!==e&&void 0!==e.message)return"pattern"===e.type?$i().createElement("span",null,$i().createElement("span",null,"Metric name is invalid, it must have the following properties:"),$i().createElement("ul",{className:t.errorList},$i().createElement("li",null,"Only contain alphanumeric characters or underscores"),$i().createElement("li",null,"Must not begin with a number"))):$i().createElement("span",null,e.message)},L$=e=>({errorList:i.css`
padding-left: ${e.spacing(2)};
`});var M$=__webpack_require__(585);function F$(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $$(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}class B$ extends M$.Message{constructor(e,t,n,r,i){super(),F$(this,"profile_typeID",void 0),F$(this,"label_selector",void 0),F$(this,"start",void 0),F$(this,"end",void 0),F$(this,"max_nodes",void 0),this.profile_typeID=e,this.label_selector=t,this.start=n,this.end=r,this.max_nodes=i}}function V$(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function U$(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){V$(a,r,i,o,s,"next",e)}function s(e){V$(a,r,i,o,s,"throw",e)}o(void 0)}))}}$$([M$.Field.d(1,"string")],B$.prototype,"profile_typeID",void 0),$$([M$.Field.d(2,"string")],B$.prototype,"label_selector",void 0),$$([M$.Field.d(3,"int64")],B$.prototype,"start",void 0),$$([M$.Field.d(4,"int64")],B$.prototype,"end",void 0),$$([M$.Field.d(5,"int64")],B$.prototype,"max_nodes",void 0);class z$ extends NC{static buildPprofRequest(e,t,n){const{profileMetricId:r,labelsSelector:i}=fA(e),a=1e3*t.from.unix(),o=1e3*t.to.unix(),s=new B$(r,i,a,o,n);return B$.encode(s).finish()}selectMergeProfile({query:e,timeRange:t,maxNodes:n}){var r=this;return U$((function*(){return(yield r.fetch("/querier.v1.QuerierService/SelectMergeProfile",{method:"POST",headers:{"content-type":"application/proto"},body:new Blob([z$.buildPprofRequest(e,t,n)])})).blob()}))()}selectMergeProfileJson({profileMetricId:e,labelsSelector:t,start:n,end:r,stackTrace:i,maxNodes:a}){var o=this;return U$((function*(){return(yield o.fetch("/querier.v1.QuerierService/SelectMergeProfile",{method:"POST",body:JSON.stringify({profile_typeID:e,label_selector:t,start:1e3*n,end:1e3*r,stackTraceSelector:{call_site:i.map((e=>({name:e})))},maxNodes:a})})).json()}))()}}function q$(e,t){const{serviceId:n,profileMetricId:r}=fA(e),i=`${t.from.format("YYYY-MM-DD_HHmm")}-to-${t.to.format("YYYY-MM-DD_HHmm")}`;return`${n.replace(/\//g,"-")}_${r}_${i}`}function H$(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}const G$=new class extends ca{upload(e,t){var n,r=this;return(n=function*(){const n=yield r.fetch("/upload/v1",{method:"POST",body:JSON.stringify({name:e,profile:btoa(JSON.stringify(t)),fileTypeData:{units:t.metadata.units,spyName:t.metadata.spyName},type:"json"})});return yield n.json()},function(){var e=this,t=arguments;return new Promise((function(r,i){var a=n.apply(e,t);function o(e){H$(a,r,i,o,s,"next",e)}function s(e){H$(a,r,i,o,s,"throw",e)}o(void 0)}))})()}constructor(){super("https://flamegraph.com/api",{"content-type":"application/json"})}};function W$(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Q$(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){W$(a,r,i,o,s,"next",e)}function s(e){W$(a,r,i,o,s,"throw",e)}o(void 0)}))}}function K$(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Y$ extends vh{fetchFlamebearerProfile({dataSourceUid:e,query:t,timeRange:n,maxNodes:r}){return Q$((function*(){const i=oj.build(e,qL);let a;try{a=yield i.get({query:t,timeRange:n,format:"json",maxNodes:r||Qj.maxNodes})}catch(e){return js(e,["Error while loading flamebearer profile data!",e.message]),null}return a}))()}fetchPprofProfile({dataSourceUid:e,query:t,timeRange:n,maxNodes:r}){return Q$((function*(){const i=oj.build(e,z$);let a;try{const e=yield i.selectMergeProfile({query:t,timeRange:n,maxNodes:r||Qj.maxNodes});a=yield new Response(e.stream().pipeThrough(new CompressionStream("gzip"))).blob()}catch(e){return js(e,["Failed to export to pprof!",e.message]),null}return a}))()}constructor(){super({key:"export-flame-graph-menu"}),K$(this,"useSceneExportMenu",(({query:e,timeRange:t})=>{const n=nm.findByKeyAndType(this,"dataSource",QP).useState().value,[r]=YL(),{settings:i}=Zj();var a=this;const o=function(){var i=Q$((function*(){Cs("g_pyroscope_app_export_profile",{format:"json"});const i=yield a.fetchFlamebearerProfile({dataSourceUid:n,query:e,timeRange:t,maxNodes:r});if(!i)return;const o=`${q$(e,t)}.json`,s=`data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(i))}`;ep()(s,o)}));return function(){return i.apply(this,arguments)}}();var s=this;const l=function(){var i=Q$((function*(){Cs("g_pyroscope_app_export_profile",{format:"pprof"});const i=yield s.fetchPprofProfile({dataSourceUid:n,query:e,timeRange:t,maxNodes:r});if(!i)return;const a=`${q$(e,t)}.pb.gz`;ep()(i,a)}));return function(){return i.apply(this,arguments)}}();var c=this;const u=function(){var i=Q$((function*(){Cs("g_pyroscope_app_export_profile",{format:"flamegraph.com"});const i=yield c.fetchFlamebearerProfile({dataSourceUid:n,query:e,timeRange:t,maxNodes:r});if(i)try{const n=yield G$.upload(q$(e,t),i);if(!n.url)throw new Error("Empty URL received.");const r=document.createElement("a");r.target="_blank",r.href=n.url,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(e){return void js(e,["Failed to export to flamegraph.com!",e.message])}}));return function(){return i.apply(this,arguments)}}();return{data:{shouldDisplayFlamegraphDotCom:Boolean(null==i?void 0:i.enableFlameGraphDotComExport)},actions:{downloadPng:()=>{Cs("g_pyroscope_app_export_profile",{format:"png"});const n=`${q$(e,t)}.png`;document.querySelector('canvas[data-testid="flameGraph"]').toBlob((e=>{if(e)ep()(e,n);else{const e=new Error("Error while creating the image, no blob.");js(e,["Failed to export to png!",e.message])}}),"image/png")},downloadJson:o,downloadPprof:l,uploadToFlamegraphDotCom:u}}}))}}function X$(){return(0,Fi.useContext)(MM)}function J$(e){const{login:t,isSessionExpired:n}=X$(),{settings:i}=Zj(),a=null==i?void 0:i.enableFunctionDetails,[o,s]=(0,Fi.useState)([]),l=(0,Fi.useCallback)((({item:i},o)=>a&&0!==i.level?[{label:"Function details",icon:"info-circle",onClick:()=>{Cs("g_pyroscope_app_function_details_clicked"),s(function(e,t){let n=[];const i=t.fields.find((({name:e})=>"label"===e));if(!i)return n;const a=(0,r.getDisplayProcessor)({field:i,theme:(0,r.createTheme)()});let o=e;for(;o&&o.level>0;){var s;for(const e of o.itemIndexes)n.unshift(a(i.values[e]).text);o=null===(s=o.parents)||void 0===s?void 0:s[0]}return n}(i,o)),e.open("function-details"),n&&t()}}]:[]),[a,n,t,e]);return{data:{stacktrace:o},actions:{getExtraFlameGraphMenuItems:l}}}K$(Y$,"Component",(({model:e,query:t,timeRange:n})=>{const{actions:r}=e.useSceneExportMenu({query:t,timeRange:n});return $i().createElement(o.Dropdown,{overlay:$i().createElement(o.Menu,null,$i().createElement(o.Menu.Item,{label:"png",onClick:r.downloadPng}),$i().createElement(o.Menu.Item,{label:"json",onClick:r.downloadJson}),$i().createElement(o.Menu.Item,{label:"pprof",onClick:r.downloadPprof}))},$i().createElement(o.Button,{icon:"download-alt",size:"sm",variant:"secondary",fill:"outline","aria-label":"Export profile data",tooltip:"Export profile data"}))}));const Z$="gpt-4-1106-preview",eB=({functionDetails:e,lines:t})=>{const n=`\nYou are a code optimization expert. I will give you source code file where each line is annotated with profiling information. The annotation has the following format:\n\n\`\`\`\n(<cost>) <source code line>\n\`\`\`\n\nThe \`\`\`<source code line>\`\`\` is the exact line of source code.\n\nThe \`\`\`<cost>\`\`\` field will contain the resource cost of the given resource cost. This field will also contain the unit of the cost (e.g. seconds, bytes, etc). If \`\`\`<cost>\`\`\` is \`-\` that means there is no profiling data available.\n\nI want you to write back a new improved code for this function and explain why you made changes.\n\nMake sure to take annotations into strong consideration. If a suggested performance improvement isn't backed up by information from the annotations, do not include it. Prioritize lines annotated with a higher cost.\n\nDo not mention the actual numbers from the annotations, users can already see how much time was spent on each line. Do not list various lines and their time spent. When you mention functions or lines, do not mention the time spent on them.\n\nIf you can't find any meaningful performance optimizations, say so. Ask for context if you think other context might help make decisions. If you think the problem is with user input and not the actual code itself, say so.\n\nWhen you output code in markdown, please don't specify language after 3 backticks (e.g instead of saying "\`\`\`go" say "\`\`\`"), and always add a new line after 3 backticks.\n\nFunction name is \`${e.name}\`. Do not mention the function name, users can already see it.\n\nWhen posting a response, follow the outline below:\n* give a brief explanation of things that could be improve\n* print new code if it's possible\n* explain each change in more details\n\n\nAnnotated code is below:\n\`\`\`\n${function(e,t){return t.map((t=>0===t.cum?`(-) ${t.line}`:`(${t.cum} ${e.unit}) ${t.line}`)).join("\n")}(e,t)}\n\`\`\`\n`;return{user:n}};function tB(e){const{reply:t,error:n}=function(e){const[t,n]=(0,Fi.useState)(""),[r,i]=(0,Fi.useState)(!1),[a,o]=(0,Fi.useState)(!1),[s,l]=(0,Fi.useState)([]),[c,u]=(0,Fi.useState)(null),d=(0,Fi.useCallback)((e=>{l(e),u(null),n(""),i(!0),o(!1),BL({model:Z$,messages:e}).pipe($L()).subscribe({next:n,error(e){u(e),i(!1),o(!0)},complete(){i(!1),o(!0)}})}),[]),p=(0,Fi.useCallback)((e=>{const n=[{role:"assistant",content:t},{role:"user",content:e}];try{d([...s,...n])}catch(e){u(e)}}),[s,t,d]);return(0,Fi.useEffect)((()=>{if(s.length>0)return;const t=eB(e);try{d([{role:"system",content:t.user}])}catch(e){u(e)}}),[s.length,e,d]),{reply:{text:t,hasStarted:r,hasFinished:a,messages:s,askFollowupQuestion:p},error:c}}(e);return{data:{isLoading:!n&&!t.text.trim(),llmError:n,reply:t,shouldDisplayReply:Boolean((null==t?void 0:t.hasStarted)||(null==t?void 0:t.hasFinished)),shouldDisplayFollowUpForm:!n&&Boolean(null==t?void 0:t.hasFinished)},actions:{submitFollowupQuestion(e){t.askFollowupQuestion(e)}}}}const nB=()=>({title:i.css`
margin: -4px 0 4px 0;
`,content:i.css``});function rB({suggestionPromptInputs:e}){const t=(0,o.useStyles2)(nB),{data:n,actions:r}=tB(e);return $i().createElement($i().Fragment,null,$i().createElement("h6",{className:t.title},"Code Optimization Suggestions"),$i().createElement("div",{className:t.content},n.isLoading&&$i().createElement($i().Fragment,null,$i().createElement(o.Spinner,{inline:!0})," Analyzing..."),n.fetchError&&$i().createElement(eI,{severity:"error",title:"Error while fetching profiles!",message:"Sorry for any inconvenience, please try again later."}),n.llmError&&$i().createElement(eI,{severity:"error",title:"Failed to generate content using OpenAI!",error:n.llmError,message:"Sorry for any inconvenience, please try again later or if the problem persists, contact your organization admin."}),n.shouldDisplayReply&&$i().createElement(_L,{reply:n.reply}),n.shouldDisplayFollowUpForm&&$i().createElement(kL,{onSubmit:r.submitFollowupQuestion})))}const iB=5;function aB(e,t){let n=e;const r=e.match(/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/(.+)/);if(r){const[,e,t,i]=r;n=`https://github.com/${e}/${t}/blob/${i}`}return void 0===t||e.includes("#")||(n+=`#L${t}`),n}function oB(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sB(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){oB(e,t,n[t])}))}return e}function lB(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function cB(e,t){const{isLoggedIn:n}=X$(),{version:r}=t,[i,a]=(0,Fi.useState)(!1);var o,s,l;const{fileInfo:c,error:u,isFetching:d}=function({enabled:e,dataSourceUid:t,repository:n,gitRef:r,localPath:i,rootPath:a}){const o=oj.build(t,UM),{isFetching:s,error:l,data:c}=Pa({enabled:Boolean(e&&i),queryKey:["vcs-file",n,r,i,a],queryFn:()=>o.getFile(n,r,i,a).then((e=>({content:e.content,URL:e.URL}))).then((e=>({URL:e.URL,content:atob(e.content)})))});return{isFetching:s,error:o.isAbortError(l)?null:l,fileInfo:c}}({enabled:n,dataSourceUid:e,localPath:t.fileName,repository:null!==(o=null==r?void 0:r.repository)&&void 0!==o?o:"",gitRef:null!==(s=null==r?void 0:r.git_ref)&&void 0!==s?s:"",rootPath:null!==(l=null==r?void 0:r.root_path)&&void 0!==l?l:""}),{snippetLines:p,allLines:h}=(0,Fi.useMemo)((()=>(null==c?void 0:c.content)?function(e,t){const n=Array.from(t.values()).sort(((e,t)=>e.line-t.line)),r=e.split("\n"),i=r.map(((e,n)=>{const r=n+1,i=t.get(r);var a,o;return{line:e,number:r,cum:null!==(a=null==i?void 0:i.cum)&&void 0!==a?a:0,flat:null!==(o=null==i?void 0:i.flat)&&void 0!==o?o:0}}));if(0===t.size)return{snippetLines:[],allLines:i};const a=Math.max(0,n[0].line-iB-1),o=Math.min(r.length,n[n.length-1].line+iB);return{snippetLines:i.slice(a,o),allLines:i}}(c.content,t.callSites):function(e){if(!e.size)return{snippetLines:[],allLines:[]};const t=Array.from(e.values()).sort(((e,t)=>e.line-t.line)),n=Math.max(0,t[0].line-iB-1),r=t[t.length-1].line+iB+1,i=[];for(let t=n+1;t<r;t++){const n=e.get(t);var a,o;i.push({line:void 0,number:t,cum:null!==(a=null==n?void 0:n.cum)&&void 0!==a?a:0,flat:null!==(o=null==n?void 0:n.flat)&&void 0!==o?o:0})}return{snippetLines:i,allLines:[]}}(t.callSites)),[null==c?void 0:c.content,t.callSites]);return{data:{fetchError:u,openAiSuggestions:i,isLoadingCode:d,unit:t.unit,githubUrl:(null==c?void 0:c.URL)?aB(c.URL,t.startLine):void 0,snippetLines:p.map((e=>{var t;return lB(sB({},e),{line:null!==(t=e.line)&&void 0!==t?t:"???"})})),allLines:h.map((e=>{var t;return lB(sB({},e),{line:null!==(t=e.line)&&void 0!==t?t:"???"})})),noCodeAvailable:Boolean(u)||!h.some((e=>e.line))},actions:{setOpenAiSuggestions:a}}}function uB(e){switch(e){case"nanoseconds":return(0,r.getValueFormat)("ns");case"microseconds":return(0,r.getValueFormat)("µs");case"milliseconds":return(0,r.getValueFormat)("ms");case"seconds":return(0,r.getValueFormat)("s");case"count":return(0,r.getValueFormat)("short");default:return(0,r.getValueFormat)(e)}}const dB=({lines:e,unit:t,githubUrl:n,isLoadingCode:r,noCodeAvailable:a,onOptimizeCodeClick:s})=>{const l=(0,o.useStyles2)(gB),c=uB(t),u=e=>{if(e<=0)return".";const t=c(e);return t.suffix?t.text+t.suffix:t.text};hB(e);const[d,p]=e.reduce((([e,t],{flat:n,cum:r})=>[e+n,t+r]),[0,0]);return $i().createElement("div",{"data-testid":"function-details-code-container"},$i().createElement("div",{className:l.container},$i().createElement("div",{className:l.header},$i().createElement("div",{className:l.breakdownLabel},$i().createElement("h6",null,"Breakdown per line"),$i().createElement("span",null,r&&$i().createElement(o.Spinner,{inline:!0}),!r&&a&&"(file information unavailable)")),$i().createElement("div",{className:l.buttons},$i().createElement(o.LinkButton,{disabled:Boolean(r||!n),href:n,target:"_blank",icon:"github",fill:"text"},"View on GitHub"),$i().createElement(PI,{onClick:s,disabled:r||a,interactionName:"g_pyroscope_app_optimize_code_clicked"},"Optimize Code")))),$i().createElement("pre",{className:l.codeBlock,"data-testid":"function-details-code"},$i().createElement("div",{className:(0,i.cx)(l.highlighted,l.codeBlockHeader)},pB("Total:",u(d),u(p)," (self, total)")),e.map((({line:e,number:t,cum:n,flat:r})=>$i().createElement("div",{key:e+t+n+r,className:r+n>0?l.highlighted:""},pB(`${t} `,u(r),u(n),e))))))},pB=(e,t,n,r)=>{const i=e.padStart(7," ")+t.padStart(12," ")+n.padStart(12," ");return r?`${i} ${r}`:i},hB=e=>{if(0===e.length)return;let t=fB(e[0].line);for(let n=1;n<e.length;n++){const{line:r}=e[n];if(""===r.trim())continue;const i=fB(r);t=mB(t,i)}if(t)for(let n=0;n<e.length;n++)e[n].line=e[n].line.substring(t.length)},fB=e=>{const t=e.match(/^[ \t]*/);var n;return null!==(n=null==t?void 0:t[0])&&void 0!==n?n:""},mB=(e,t)=>{let n=0;for(let r=0;r<Math.min(e.length,t.length)&&e[r]===t[r];r++)n++;return e.substring(0,n)},gB=e=>({container:i.css`
display: flex;
flex-direction: row;
align-items: flex-start;
width: 100%;
`,header:i.css`
display: flex;
justify-content: space-between;
align-items: end;
width: 100%;
`,breakdownLabel:i.css`
& > h6 {
display: inline-block;
margin-top: ${e.spacing(1)};
}
& > span {
margin-left: ${e.spacing(1)};
font-size: ${e.typography.bodySmall.fontSize};
}
& > svg {
margin-left: ${e.spacing(1)};
}
`,buttons:i.css`
display: flex;
flex-wrap: no-wrap;
`,codeBlock:i.css`
position: relative;
min-height: 240px;
font-size: 12px;
overflow-x: auto;
white-space: pre;
color: ${e.colors.text.secondary};
`,highlighted:i.css`
color: ${e.colors.text.maxContrast};
`,codeBlockHeader:i.css`
margin-bottom: 8px;
`});function yB({dataSourceUid:e,functionDetails:t}){var n,r;const{data:i,actions:a}=cB(e,t);return i.fetchError&&404!==(null===(r=i.fetchError)||void 0===r||null===(n=r.response)||void 0===n?void 0:n.status)&&js(i.fetchError,["Failed to fetch file information!",i.fetchError.message]),$i().createElement($i().Fragment,null,$i().createElement(dB,{lines:i.snippetLines,unit:i.unit,githubUrl:i.githubUrl,isLoadingCode:i.isLoadingCode,noCodeAvailable:i.noCodeAvailable,onOptimizeCodeClick:()=>{var e;a.setOpenAiSuggestions(!0),null===(e=document.getElementById("ai-suggestions-panel"))||void 0===e||e.scrollIntoView({behavior:"smooth"})}}),$i().createElement("h6",{id:"ai-suggestions-panel",style:{height:0,marginBottom:0}}),i.openAiSuggestions?$i().createElement(rB,{suggestionPromptInputs:{functionDetails:t,lines:i.allLines}}):null)}const bB=e=>({ellipsis:i.css`
color: ${e.colors.primary.text};
text-overflow: ellipsis;
overflow: hidden;
direction: rtl;
white-space: nowrap;
`}),vB=({enableIntegration:e,repository:t})=>{const n=(0,o.useStyles2)(bB),{isLoginInProgress:r,isLoggedIn:i,login:a}=X$();return e?r?$i().createElement($i().Fragment,null,$i().createElement(o.Spinner,null),$i().createElement("span",null,"Connecting to GitHub...")):i?$i().createElement($i().Fragment,null,$i().createElement(o.Icon,{name:"github",size:"lg"}),$i().createElement("a",{className:n.ellipsis,href:t.commitUrl,target:"_blank",rel:"noreferrer",title:"View commit"},$i().createElement(o.Icon,{name:"external-link-alt"})," ",t.commitName)):$i().createElement(o.Button,{icon:"github",variant:"primary",onClick:a,tooltip:"Once connected, the GitHub code will be accessible only from this browser session.",tooltipPlacement:"top"},"Connect to ",t.name):$i().createElement($i().Fragment,null,"-")};function wB(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SB(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function EB(e,t){const n=e.map((e=>{var n;return SB(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){wB(e,t,n[t])}))}return e}({},e.commit),{samples:{unit:null!==(n=e.unit)&&void 0!==n?n:"count",current:Array.from(e.callSites.values()).reduce(((e,{cum:t})=>e+t),0),total:t}})}));return n}const xB="https://github.com/";function OB(e,t){if(!(null==t?void 0:t.repository))return null;const n=t.repository,r=n.replace(xB,""),i=t.git_ref;return{isGitHub:e,url:n,name:r,commitUrl:i?`${n}/commit/${i}`:n,commitName:i?`${r}@${i.substring(0,7)}`:r}}const _B=(e,t,n)=>{let r;try{r=n?JSON.parse(e.stringTable[Number(n.buildId)]):void 0}catch(e){}return{name:e.stringTable[Number(t.name)],version:r,startLine:Number.isNaN(Number(t.startLine))?void 0:Number(t.startLine),fileName:e.stringTable[Number(t.filename)],callSites:new Map,unit:e.stringTable[Number(e.sampleType[0].unit)],commit:VM}};function TB(e,t,n,r,i,a,o){const s=new Set;a.locationId.forEach(((l,c)=>{const u=n.get(l);u&&u.line.forEach((n=>{const d=r.get(n.functionId);if(!d)return;if(t.stringTable[Number(d.name)]!==e)return;if(s.has(l))return;s.add(l);const p=o.get(u.mappingId)||_B(t,d,i.get(u.mappingId));o.set(u.mappingId,function(e,t,n,r){const i=Number(t.line),a=e.callSites.get(i)||{line:Number(t.line),flat:0,cum:0},o=0===r?n:0,s=n;return a.flat+=o,a.cum+=s,e.callSites.set(i,a),e}(p,n,Number(a.value[0]),c))}))}))}function CB(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function kB(){var e;return e=function*(e,t){const n=oj.build(e,UM),r=t.map((e=>{var t,n,r;return{repositoryUrl:(null==e||null===(t=e.version)||void 0===t?void 0:t.repository)||"",gitRef:(null==e||null===(n=e.version)||void 0===n?void 0:n.git_ref)||"HEAD",rootPath:(null==e||null===(r=e.version)||void 0===r?void 0:r.root_path)||""}}));return(yield n.getCommits(r)).forEach(((e,n)=>{t[n].commit=e})),t},kB=function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){CB(a,r,i,o,s,"next",e)}function s(e){CB(a,r,i,o,s,"throw",e)}o(void 0)}))},kB.apply(this,arguments)}const PB=e=>Array.from(e.callSites.values()).reduce(((e,{cum:t})=>e+t),0),AB=(e,t)=>PB(t)-PB(e);function RB(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function DB(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){RB(a,r,i,o,s,"next",e)}function s(e){RB(a,r,i,o,s,"throw",e)}o(void 0)}))}}function jB({dataSourceUid:e,query:t,timeRange:n,stackTrace:r}){const{profileMetricId:i,labelsSelector:a}=fA(t),[o,s]=[n.from.unix(),n.to.unix()],{isLoggedIn:l}=X$(),c=oj.build(e,z$),{isFetching:u,error:d,data:p}=Pa({enabled:Boolean(i&&a&&r.length>0&&o>0&&s>0),queryKey:["function-details",i,a,o,s,r,l],queryFn:DB((function*(){const t=yield c.selectMergeProfileJson({profileMetricId:i,labelsSelector:a,start:o,end:s,stackTrace:r,maxNodes:500}),n=function(e,t){var n,r,i,a;const o=new Map,s=new Map(null===(n=t.location)||void 0===n?void 0:n.map((e=>[e.id,e]))),l=new Map(null===(r=t.function)||void 0===r?void 0:r.map((e=>[e.id,e]))),c=new Map(null===(i=t.mapping)||void 0===i?void 0:i.map((e=>[e.id,e])));return null===(a=t.sample)||void 0===a||a.filter((e=>void 0!==e.locationId)).forEach((n=>TB(e,t,s,l,c,n,o))),Array.from(o.values())}(r[r.length-1],t).sort(AB);return l?function(e,t){return kB.apply(this,arguments)}(e,n):n}))}),h=(0,Fi.useMemo)((()=>(null==p?void 0:p.length)?p:[{name:r.at(-1),startLine:void 0,fileName:"",callSites:new Map,unit:"",commit:VM}]),[p,r]);return{isFetching:u,error:c.isAbortError(d)?null:d,functionsDetails:h}}const IB=[60,3600,86400,604800,2592e3,31536e3,1/0],NB=["second","minute","hour","day","week","month","year"],LB=new Intl.RelativeTimeFormat("en-US",{numeric:"auto"});const MB=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"2-digit"});function FB(e){return e?`${MB.format(e)} (${function(e){const t=e.getTime(),n=Math.round((t-Date.now())/1e3),r=IB.findIndex((e=>e>Math.abs(n))),i=r?IB[r-1]:1;return LB.format(Math.floor(n/i),NB[r])}(e)})`:"?"}const $B=e=>({container:i.css`
display: flex;
flex-direction: column;
justify-content: flex-start;
`,firstLine:i.css`
display: flex;
flex-direction: row;
align-items: center;
gap: 1em;
`,sha:i.css`
font-family: monospace;
`,sample:i.css`
font-size: 12px;
`,secondLine:i.css`
display: flex;
flex-direction: row;
align-items: center;
font-size: 12px;
color: ${e.colors.text.secondary};
`,avatar:i.css`
display: inline-block;
margin-right: 4px;
border-radius: 50%;
background: grey;
width: 16px;
height: 16px;
`,message:i.css`
font-size: 12px;
color: ${e.colors.text.secondary};
`});function BB({commit:e}){const t=(0,o.useStyles2)($B),{author:n,samples:r}=e,i=n.login,a=n.avatarURL,s=uB(r.unit)(r.current),l=Math.round(r.current/r.total*100);return $i().createElement("div",{className:t.container},$i().createElement("div",{className:t.firstLine},$i().createElement("span",{className:t.sha},HB(e.sha)),$i().createElement("span",{className:t.sample},s.text,s.suffix," (",l,"%)")),$i().createElement("div",{className:t.secondLine},a&&$i().createElement("img",{className:t.avatar,src:a,alt:i}),$i().createElement("span",null,i," on ",FB(e.date))),$i().createElement("span",{className:t.message},GB(e.message)))}const VB=e=>({container:i.css`
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: 1em;
`,sha:i.css`
font-family: monospace;
`,message:i.css`
color: ${e.colors.text.secondary};
`});function UB({commit:e}){const t=(0,o.useStyles2)(VB);return $i().createElement("div",{className:t.container},$i().createElement("span",{className:t.sha},HB(e.sha)),$i().createElement("div",{className:t.message},$i().createElement("span",null,GB(e.message))))}function zB({commits:e,selectedCommit:t,onChange:n}){return $i().createElement(o.Select,{options:e.map((e=>({label:e.sha,value:e}))),value:{label:t.sha,value:t},hideSelectedOptions:!0,isSearchable:!1,noOptionsMessage:"No commits found",formatOptionLabel:qB,onChange:e=>{e.value&&n(e.value)}})}function qB(e,t){var n;const{value:r}=e;if(!r)return null;return(null===(n=t.selectValue[0])||void 0===n?void 0:n.value)===r?$i().createElement(UB,{commit:r}):$i().createElement(BB,{commit:r})}const HB=e=>e===VM.sha?e:e.substring(0,7),GB=e=>e.split("\n")[0],WB=({onDismiss:e})=>$i().createElement(o.Alert,{severity:"info",title:"Integrate with Github",buttonContent:"Dismiss",onRemove:e},$i().createElement("p",null,"This language supports integration with ",$i().createElement(o.Icon,{name:"github"})," GitHub."),$i().createElement("p",null,"To activate this feature, you will need to add two new labels when sending profiles"," ",$i().createElement("code",null,"service_repository")," and ",$i().createElement("code",null,"service_git_ref"),"."," "),$i().createElement("p",null,"They should respectively be set to the full repository GitHub URL and the current"," ",$i().createElement(o.TextLink,{href:"https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#about-git-references",external:!0},"git ref")," ","of the running service."),$i().createElement(o.Icon,{name:"document-info"})," ",$i().createElement(o.TextLink,{href:"https://grafana.com/docs/grafana-cloud/monitor-applications/profiles/pyroscope-github-integration/",external:!0},"Learn more"));function QB({isLoading:e,children:t}){return e?$i().createElement(o.Spinner,{inline:!0}):$i().createElement($i().Fragment,null,t)}const KB=(0,Fi.memo)(QB);function YB(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function XB(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class JB extends vh{constructor(){super({key:"function-details-panel"}),XB(this,"useSceneFunctionDetailsPanel",((e,t)=>{var n,r;const i=nm.findByKeyAndType(this,"dataSource",QP).useState().value,a=WP(this,"filters"),{functionsDetails:o,error:s,isFetching:l}=jB({dataSourceUid:i,query:a,timeRange:t,stackTrace:e}),[c,u]=(0,Fi.useState)(),[d,p]=(0,Fi.useState)(o[0]),[h,f]=(0,Fi.useState)(ta.has(ta.KEYS.GITHUB_INTEGRATION));o&&c!==o&&(u(o),d!==o[0]&&p(o[0]));const m=((null==d||null===(n=d.version)||void 0===n?void 0:n.repository)||"").startsWith(xB);const g=null==d||null===(r=d.fileName)||void 0===r?void 0:r.endsWith(".go"),y=!h&&!m&&g,b=(0,Fi.useMemo)((()=>o.map((e=>Array.from(e.callSites.values()).reduce(((e,{cum:t})=>e+t),0))).reduce(((e,t)=>e+t),0)),[o]),v=EB(o,b),w=v.find((({sha:e})=>{var t;return e===(null==d||null===(t=d.commit)||void 0===t?void 0:t.sha)}));return{data:{isLoading:l,fetchFunctionDetailsError:s,functionDetails:d,repository:OB(m,null==d?void 0:d.version),commits:v,selectedCommit:w,isGitHubSupported:g,shouldDisplayGitHubBanner:y,dataSourceUid:i},actions:{selectCommit(e){const t=o.find((({commit:t})=>t.sha===e.sha));p(t)},copyFilePathToClipboard(){return(e=function*(){try{(null==d?void 0:d.fileName)&&(yield navigator.clipboard.writeText(d.fileName),Ns(["File path copied to clipboard!"]))}catch(e){}},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){YB(a,r,i,o,s,"next",e)}function s(e){YB(a,r,i,o,s,"throw",e)}o(void 0)}))})();var e},dismissGitHubBanner(){ta.set(ta.KEYS.GITHUB_INTEGRATION,{}),f(!0)}}}}))}}XB(JB,"LABEL_WIDTH",16),XB(JB,"Component",(({model:e,timeRange:t,stackTrace:n,onClose:r})=>{const i=(0,o.useStyles2)(ZB),{data:a,actions:s}=e.useSceneFunctionDetailsPanel(n,t);return $i().createElement(OI,{className:i.sidePanel,title:"Function Details",isLoading:!1,headerActions:$i().createElement(o.IconButton,{name:"times-circle",variant:"secondary","aria-label":"close",onClick:r}),dataTestId:"function-details-panel"},$i().createElement("div",{className:i.content},a.fetchFunctionDetailsError&&$i().createElement(eI,{severity:"error",title:"Error while fetching function details!",error:a.fetchFunctionDetailsError}),$i().createElement("div",{className:i.container},$i().createElement("div",{className:i.row,"data-testid":"row-function-name"},$i().createElement(o.InlineLabel,{width:JB.LABEL_WIDTH},"Function name"),$i().createElement(o.Tooltip,{content:a.functionDetails.name,placement:"top"},$i().createElement("span",{className:i.textValue},a.functionDetails.name))),$i().createElement("div",{className:i.row,"data-testid":"row-start-line"},$i().createElement(o.InlineLabel,{tooltip:"The line where this function definition starts",width:JB.LABEL_WIDTH},"Start line"),$i().createElement("span",{className:i.textValue},$i().createElement(KB,{isLoading:a.isLoading},void 0!==a.functionDetails.startLine?a.functionDetails.startLine:"-"))),$i().createElement("div",{className:i.row,"data-testid":"row-file-path"},$i().createElement(o.InlineLabel,{tooltip:"File path where that function is defined",width:JB.LABEL_WIDTH},"File"),$i().createElement(KB,{isLoading:a.isLoading},a.functionDetails.fileName?$i().createElement($i().Fragment,null,$i().createElement(o.Tooltip,{content:a.functionDetails.fileName,placement:"top"},$i().createElement("span",{className:i.textValue},"","/"===(null==(l=a.functionDetails.fileName)?void 0:l[0])?l.substring(1)+"/":l)),$i().createElement(o.IconButton,{name:"clipboard-alt",tooltip:"Copy to clipboard",onClick:s.copyFilePathToClipboard})):"-")),a.shouldDisplayGitHubBanner&&$i().createElement("div",{className:i.row,"data-testid":"row-github-banner"},$i().createElement(WB,{onDismiss:s.dismissGitHubBanner})),$i().createElement("div",{className:i.row,"data-testid":"row-repository"},$i().createElement(o.InlineLabel,{tooltip:"The repository configured for the selected service",width:JB.LABEL_WIDTH},"Repository"),$i().createElement(KB,{isLoading:a.isLoading},a.repository?a.repository.isGitHub?$i().createElement(vB,{enableIntegration:a.isGitHubSupported,repository:a.repository}):$i().createElement(o.TextLink,{href:a.repository,external:!0},a.repository):"-")),$i().createElement("div",{className:i.row,"data-testid":"row-commit"},$i().createElement(o.InlineLabel,{width:JB.LABEL_WIDTH,tooltip:"The version of the application (commit) where the function is defined. Use the dropdown menu to target a specific commit."},"Commit"),$i().createElement(KB,{isLoading:a.isLoading},$i().createElement(zB,{commits:a.commits,selectedCommit:a.selectedCommit,onChange:s.selectCommit})))),$i().createElement(yB,{dataSourceUid:a.dataSourceUid,functionDetails:a.functionDetails})));var l}));const ZB=e=>({sidePanel:i.css`
flex: 1 0 50%;
margin-left: 8px;
max-width: calc(50% - 4px);
`,title:i.css`
margin: -4px 0 4px 0;
`,content:i.css`
padding: ${e.spacing(1)};
`,container:i.css`
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
`,row:i.css`
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
padding-bottom: 10px;
> * {
margin-right: 10px !important;
}
`,textValue:i.css`
// hack to have the ellipsis appear at the start of the string
direction: rtl;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
`});function eV(e){const{spanSelector:t,removeSpanSelector:n}=e,r=(0,o.useStyles2)(tV);return $i().createElement("div",{className:r.container},$i().createElement(o.Tooltip,{content:`You have added a span selector to the flamegraph query (${t}).`,placement:"top"},$i().createElement("span",null,"Span selector added")),$i().createElement(o.Button,{size:"md",fill:"text",variant:"secondary",icon:"times",tooltip:"Remove span selector from query",tooltipPlacement:"top",onClick:()=>{n()}}))}const tV=()=>({container:i.css`
padding: 0 4px;
`});function nV(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class rV extends vh{onActivate(){let e;const t=this.subscribeToState(((t,n)=>{var i;t.$data!==n.$data&&(e&&e.unsubscribe(),e=null===(i=t.$data)||void 0===i?void 0:i.subscribeToState((e=>{var t;(null===(t=e.data)||void 0===t?void 0:t.state)===r.LoadingState.Done&&this.setState({lastTimeRange:e.data.timeRange})})))}));return()=>{t.unsubscribe(),null==e||e.unsubscribe()}}buildTitle(){const e=sA(this,"serviceName"),t=IP(sA(this,"profileMetricId")).type;return $i().createElement($i().Fragment,null,$i().createElement(Ko,{size:"small"}),"Flame graph for ",e," (",t,")")}removeSpanSelector(){this.publishEvent(new WM({}),!0)}constructor(){super({key:"flame-graph",$data:new Yg({datasource:NP,queries:[]}),lastTimeRange:void 0,exportMenu:new Y$,aiPanel:new GL,functionDetailsPanel:new JB,createRecordingRuleModal:new I$}),nV(this,"useSceneFlameGraph",(e=>{var t,n,i,a,s;const{isLight:l}=(0,o.useTheme2)(),c=(0,Fi.useMemo)((()=>()=>(0,r.createTheme)({colors:{mode:l?"light":"dark"}})),[l]),[u]=YL(),{settings:d,error:p}=Zj(),{$data:h,lastTimeRange:f,exportMenu:m,aiPanel:g,functionDetailsPanel:y,createRecordingRuleModal:b}=this.useState();p&&Is(["Error while retrieving the plugin settings!","Some features might not work as expected (e.g. collapsed flame graphs). Please try to reload the page, sorry for the inconvenience."]),(0,Fi.useEffect)((()=>{u&&this.setState({$data:XM({maxNodes:u,spanSelector:e})})}),[u,e]);const v=h.useState(),w=null==v||null===(t=v.data)||void 0===t?void 0:t.state,S=w===r.LoadingState.Error?(null==v||null===(i=v.data)||void 0===i||null===(n=i.errors)||void 0===n?void 0:n[0])||new Error("Unknown error!"):null,E=w===r.LoadingState.Loading,x=null==v||null===(s=v.data)||void 0===s||null===(a=s.series)||void 0===a?void 0:a[0],O=Number(null==x?void 0:x.length)>1,_=WP(this,"filters");return{data:{title:this.buildTitle(),isLoading:E,isFetchingProfileData:E,hasProfileData:O,profileData:x,spanSelector:e,fetchProfileError:S,settings:d,export:{menu:m,query:_,timeRange:f},ai:{panel:g,fetchParams:[{query:_,timeRange:f}]},gitHub:{panel:y,timeRange:f},recordingRules:{modal:b}},actions:{getTheme:c}}})),this.addActivationHandler(this.onActivate.bind(this))}}nV(rV,"Component",(({model:e})=>{var t;const n=(0,o.useStyles2)(iV),r=sA(e,"spanSelector"),{data:i,actions:a}=e.useSceneFlameGraph(r),s=Hj(),l=J$(s),{settings:c}=Zj(),{actions:u}=iF(),[d,p]=(0,Fi.useState)(!1),h=(f=()=>p(!0),{data:{},actions:{getExtraFlameGraphMenuItems:(0,Fi.useCallback)((({item:e})=>0!==e.level?[]:[{label:"Create recording rule",icon:"download-alt",onClick:f}]),[f])}});var f;const m=i.isLoading||!i.hasProfileData;(0,Fi.useEffect)((()=>{m&&s.close()}),[m,s]);const g=(0,Fi.useMemo)((()=>$i().createElement($i().Fragment,null,i.title,i.isLoading&&$i().createElement(o.Spinner,{inline:!0,className:n.spinner}))),[i.isLoading,i.title,n.spinner]);return $i().createElement("div",{className:n.flex},$i().createElement(OI,{dataTestId:"flame-graph-panel",className:n.flamegraphPanel,title:g,isLoading:i.isLoading,headerActions:$i().createElement($i().Fragment,null,r&&$i().createElement(eV,{spanSelector:r,removeSpanSelector:()=>e.removeSpanSelector()}),$i().createElement(PI,{disabled:m||s.isOpen("ai"),onClick:()=>s.open("ai"),interactionName:"g_pyroscope_app_explain_flamegraph_clicked"},"Explain Flame Graph"))},i.fetchProfileError&&$i().createElement(eI,{severity:"error",title:"Error while loading profile data!",error:i.fetchProfileError}),!i.fetchProfileError&&$i().createElement(mu,{data:i.profileData,disableCollapsing:!(null===(t=i.settings)||void 0===t?void 0:t.collapsedFlamegraphs),getTheme:a.getTheme,getExtraContextMenuButtons:(e,t)=>[...l.actions.getExtraFlameGraphMenuItems(e,t),...(null==c?void 0:c.enableMetricsFromProfiles)&&QM.metricsFromProfiles?h.actions.getExtraFlameGraphMenuItems(e,t):[]],extraHeaderElements:$i().createElement(i.export.menu.Component,{model:i.export.menu,query:i.export.query,timeRange:i.export.timeRange}),keepFocusOnDataChange:!0})),s.isOpen("ai")&&$i().createElement(i.ai.panel.Component,{model:i.ai.panel,fetchParams:i.ai.fetchParams,onClose:s.close}),s.isOpen("function-details")&&$i().createElement(i.gitHub.panel.Component,{model:i.gitHub.panel,timeRange:i.gitHub.timeRange,stackTrace:l.data.stacktrace,onClose:s.close}),$i().createElement(i.recordingRules.modal.Component,{model:i.recordingRules.modal,isModalOpen:d,onDismiss:()=>p(!1),onCreate:e=>{u.save(e),p(!1)}}))}));const iV=e=>({flex:i.css`
display: flex;
`,flamegraphPanel:i.css`
min-width: 0;
flex-grow: 1;
`,spinner:i.css`
margin-left: ${e.spacing(1)};
`});class aV extends vh{onActivate(e){e&&this.initVariables(e);const t=nm.findByKeyAndType(this,"profileMetricId",VP);return t.setState({query:VP.QUERY_SERVICE_NAME_DEPENDENT}),t.update(!0),()=>{t.setState({query:VP.QUERY_DEFAULT}),t.update(!0)}}initVariables(e){const{serviceName:t,profileMetricId:n,filters:r}=e.queryRunnerParams;if(t){nm.findByKeyAndType(this,"serviceName",HP).changeValueTo(t)}if(n){nm.findByKeyAndType(this,"profileMetricId",VP).changeValueTo(n)}if(r){nm.findByKeyAndType(this,"filters",oA).setState({filters:r})}}getVariablesAndGridControls(){return{variables:[nm.findByKeyAndType(this,"serviceName",HP),nm.findByKeyAndType(this,"profileMetricId",VP),nm.findByKeyAndType(this,"filters",oA)],gridControls:[]}}static Component({model:e}){const t=(0,o.useStyles2)(oV),{mainTimeseries:n,body:r}=e.useState();return $i().createElement("div",{className:t.flex},$i().createElement("div",{className:t.mainTimeseries},$i().createElement(n.Component,{model:n})),$i().createElement(r.Component,{model:r}))}constructor({item:e}){super({key:"explore-service-flame-graph",mainTimeseries:new SD({item:e,headerActions:e=>[new tD({type:"view-labels",item:e}),new VR({item:e})]}),body:new rV}),this.addActivationHandler(this.onActivate.bind(this,e))}}const oV=e=>({flex:i.css`
display: flex;
flex-direction: column;
width: 100%;
gap: ${e.spacing(1)};
`,mainTimeseries:i.css`
height: ${SD.MIN_HEIGHT}px;
`});function sV(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function lV(){return cV.apply(this,arguments)}function cV(){var e;return e=function*(){Cs("g_pyroscope_app_share_link_clicked");try{yield navigator.clipboard.writeText(function(){const e=new URL(window.location.toString()),{searchParams:t}=e;return t.get("from")||t.set("from",nj().from),t.get("to")||t.set("to",nj().to),["from","to","from-2","to-2","from-3","to-3","diffFrom","diffTo","diffFrom-2","diffTo-2"].forEach((e=>{const n=t.get(e);n&&t.set(e,String(r.dateMath.parse(n).valueOf()))})),e}().toString()),Ns(["Link copied to clipboard!"])}catch(e){Xi.error(e,{info:"Error while creating the shareable link!"})}},cV=function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){sV(a,r,i,o,s,"next",e)}function s(e){sV(a,r,i,o,s,"throw",e)}o(void 0)}))},cV.apply(this,arguments)}function uV({options:e,value:t,onChange:n}){const r=(0,o.useStyles2)(dV),a=e.findIndex((e=>e.value===t));return $i().createElement("div",{className:r.explorationTypeContainer,"data-testid":"exploration-types"},$i().createElement("div",{className:r.label},"Exploration"),$i().createElement("div",{className:r.breadcrumb},e.map(((s,l)=>{const c=t===s.value,u=(d=l,a===e.length-1?d===a?"primary":"secondary":d<=a?"primary":"secondary");var d;const p=[c&&"active","primary"===u&&"primary"];return $i().createElement(Fi.Fragment,{key:s.value},$i().createElement(o.Button,{className:(0,i.cx)(r.button,...p),variant:u,size:"sm","aria-label":s.label,icon:s.icon,onClick:c?na:()=>n(s.value),tooltip:s.description,tooltipPlacement:"top","data-testid":c?"is-active":void 0},s.label),l<e.length-3&&$i().createElement("div",{className:a!==e.length-1&&l<=a-1?(0,i.cx)(r.arrow,"arrow",...p):r.arrow}))}))))}const dV=e=>({explorationTypeContainer:i.css`
display: flex;
align-items: center;
`,label:i.css`
display: flex;
gap: 2px;
align-items: center;
font-size: 14px;
margin-right: ${e.spacing(1)};
${e.breakpoints.down("xxl")} {
display: none;
}
`,breadcrumb:i.css`
display: flex;
align-items: center;
height: 32px;
line-height: 32px;
.active {
background-color: ${e.colors.primary.main};
}
.arrow.primary {
background-color: ${e.colors.primary.main};
}
& button.primary:not(.active),
& .arrow.primary:not(.active) {
opacity: 0.7;
}
& button.primary:not(.active):hover {
opacity: 1;
background-color: ${e.colors.primary.main};
}
`,button:i.css`
height: 27px;
line-height: 27px;
border-radius: 15px;
&:hover {
border-color: ${e.colors.primary.main};
}
&.active:hover {
cursor: default;
background-color: ${e.colors.primary.main};
}
&:nth-last-child(2) {
margin-left: ${e.spacing(1)};
}
&:nth-last-child(1) {
margin-left: ${e.spacing(2)};
}
`,arrow:i.css`
background-color: ${e.colors.text.disabled};
width: 10px;
height: 2px;
`});function pV(e){const t=null===a.useChromeHeaderHeight||void 0===a.useChromeHeaderHeight?void 0:(0,a.useChromeHeaderHeight)(),n=(0,o.useStyles2)(hV,null!=t?t:0),{data:r,actions:s}=function({explorationType:e,controls:t,body:n,$variables:r,onChangeExplorationType:i}){const[a,o]=e===mV.DIFF_FLAME_GRAPH?[]:t,s=r.state.variables[0],l=null==n?void 0:n.state.primary;if("function"!=typeof l.getVariablesAndGridControls)throw new Error(`Error while rendering "${l.constructor.name}": the "getVariablesAndGridControls" method is missing! Please implement it.`);const{variables:c,gridControls:u}=l.getVariablesAndGridControls(),d=s.useState().value,p=(0,Es.useNavigate)();return{data:{explorationType:e,dataSourceVariable:s,timePickerControl:a,refreshPickerControl:o,sceneVariables:c,gridControls:u,body:n,dataSourceUid:d},actions:{onChangeExplorationType:i,onClickShareLink:lV,onClickRecordingRules:(0,Fi.useCallback)((()=>{Cs("g_pyroscope_app_open_recording_rules_view"),p(`${Ai}${Ri.RECORDING_RULES}`,{state:{referrer:window.location.href}})}),[p]),onClickAdHoc:(0,Fi.useCallback)((()=>{Cs("g_pyroscope_app_upload_ad_hoc_clicked"),p(`${Ai}${Ri.ADHOC}`,{state:{referrer:window.location.href}})}),[p]),onClickUserSettings:(0,Fi.useCallback)((()=>{Cs("g_pyroscope_app_user_settings_clicked"),p(`${Ai}${Ri.SETTINGS}`,{state:{referrer:window.location.href}})}),[p])}}}(e),{settings:l}=Zj(),{explorationType:c,dataSourceVariable:u,timePickerControl:d,refreshPickerControl:p,sceneVariables:h,gridControls:f}=r;return $i().createElement("div",{className:n.header,"data-testid":"allControls"},$i().createElement(lM,null),$i().createElement("div",{className:n.appControls,"data-testid":"appControls"},$i().createElement("div",{className:n.appControlsLeft},$i().createElement(uV,{options:gV.EXPLORATION_TYPE_OPTIONS,value:c,onChange:s.onChangeExplorationType})),$i().createElement("div",{className:n.appControlsRight},d&&$i().createElement(d.Component,{key:d.state.key,model:d}),p&&$i().createElement(p.Component,{key:p.state.key,model:p}),$i().createElement("div",{className:n.appMiscButtons},(null==l?void 0:l.enableMetricsFromProfiles)&&QM.metricsFromProfiles&&$i().createElement(o.IconButton,{name:"gf-prometheus",tooltip:"View recording rules","aria-label":"View recording rules",onClick:s.onClickRecordingRules}),$i().createElement(o.IconButton,{name:"upload",tooltip:"Upload ad hoc profiles",onClick:s.onClickAdHoc}),$i().createElement(o.IconButton,{name:"cog",tooltip:"View/edit tenant settings",onClick:s.onClickUserSettings}),$i().createElement(o.IconButton,{name:"share-alt",tooltip:"Copy shareable link to the clipboard",onClick:s.onClickShareLink}),$i().createElement(ns,null)))),$i().createElement("div",{id:`scene-controls-${c}`,className:n.sceneControls,"data-testid":"sceneControls"},$i().createElement(o.Field,{label:u.state.label,className:(0,i.cx)(n.sceneVariable,u.state.name),"data-testid":u.state.name},$i().createElement(u.Component,{model:u})),h.map((e=>$i().createElement(o.Field,{key:e.state.name,label:"Filters"===e.state.label?$i().createElement("div",{className:n.sceneVariableLabel},$i().createElement(o.Icon,{name:"filter",className:n.icon}),e.state.label):e.state.label,className:(0,i.cx)(n.sceneVariable,e.state.name),"data-testid":e.state.name},$i().createElement(e.Component,{model:e})))),f.map((e=>$i().createElement(o.Field,{key:e.state.key,id:e.state.key,className:n.gridControl,label:""},$i().createElement(e.Component,{model:e}))))))}const hV=(e,t)=>({header:i.css`
background-color: ${e.colors.background.canvas};
position: sticky;
top: ${t}px;
z-index: 1;
padding-bottom: ${e.spacing(2)};
`,appControls:i.css`
display: flex;
padding: ${e.spacing(1)} 0;
justify-content: space-between;
gap: ${e.spacing(2)};
`,appControlsLeft:i.css`
display: flex;
gap: ${e.spacing(1)};
`,appControlsRight:i.css`
display: flex;
gap: ${e.spacing(1)};
`,appMiscButtons:i.css`
display: flex;
align-items: center;
gap: 4px;
border: 1px solid ${e.colors.border.weak};
background-color: ${e.colors.background.secondary};
height: 32px;
padding: 0 ${e.spacing(1)};
& svg {
width: 18px;
height: 18px;
}
`,sceneControls:i.css`
display: flex;
flex-wrap: wrap;
gap: ${e.spacing(1)};
padding: 0;
margin-top: 20px;
`,sceneVariable:i.css`
display: flex;
margin-bottom: 0;
& #dataSource {
width: ${e.spacing(32)};
}
&.filters {
flex-grow: 1;
}
&.compare-presets {
margin-left: auto;
text-align: right;
}
`,sceneVariableLabel:i.css`
font-size: 12px;
font-weight: 500;
line-height: 15px;
height: 15px;
margin-bottom: 4px;
color: ${e.colors.text.primary};
max-width: 480px;
`,icon:i.css`
display: inline-block;
margin-right: 4px;
`,gridControl:i.css`
margin-bottom: 0;
&#quick-filter {
flex: 1;
min-width: 112px;
}
`});function fV(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mV=function(e){return e.ALL_SERVICES="all",e.PROFILE_TYPES="profiles",e.LABELS="labels",e.FLAME_GRAPH="flame-graph",e.DIFF_FLAME_GRAPH="diff-flame-graph",e.FAVORITES="favorites",e}({});class gV extends vh{onActivate(){const e=this.subscribeToVariableChanges(),t=this.subscribeToEvents();return this.state.explorationType||this.setExplorationType({type:gV.DEFAULT_EXPLORATION_TYPE}),()=>{t.unsubscribe(),e.unsubscribe()}}getUrlState(){return{explorationType:this.state.explorationType}}updateFromUrl(e){if("string"==typeof e.explorationType&&e.explorationType!==this.state.explorationType){const t=e.explorationType;this.setExplorationType({type:Object.values(mV).includes(t)?t:gV.DEFAULT_EXPLORATION_TYPE})}}registerRuntimeDataSources(){try{x_.registerRuntimeDataSource({dataSource:new mj}),x_.registerRuntimeDataSource({dataSource:new FR}),x_.registerRuntimeDataSource({dataSource:new NA})}catch(e){const{message:t}=e;/A runtime data source with uid (.+) has already been registered/.test(t)||js(e,["Fail to register all the runtime data sources!","The application cannot work as expected, please try reloading the page or if the problem persists, contact your organization admin."])}}subscribeToVariableChanges(){const e=nm.findByKeyAndType(this,"dataSource",QP).subscribeToState(((e,t)=>{e.value&&e.value!==t.value&&(oA.resetAll(this),this.resetSpanSelector())})),t=nm.findByKeyAndType(this,"serviceName",HP).subscribeToState(((e,t)=>{e.value&&e.value!==t.value&&(oA.resetAll(this),e.options.some((e=>e.value===t.value))&&this.resetSpanSelector())})),n=nm.findByKeyAndType(this,"profileMetricId",VP).subscribeToState(((e,t)=>{e.value&&e.value!==t.value&&this.resetSpanSelector()})),r=nm.findByKeyAndType(this,"filters",oA).subscribeToState(((e,t)=>{JSON.stringify(e.filters)!==JSON.stringify(t.filters)&&this.resetSpanSelector()}));return{unsubscribe(){t.unsubscribe(),e.unsubscribe(),r.unsubscribe(),n.unsubscribe()}}}subscribeToEvents(){const e=this.subscribeToEvent(YR,(e=>{this.setExplorationType({type:"profiles",comesFromUserAction:!0,item:e.payload.item})})),t=this.subscribeToEvent(KR,(e=>{this.setExplorationType({type:"labels",comesFromUserAction:!0,item:e.payload.item})})),n=this.subscribeToEvent(QR,(e=>{this.setExplorationType({type:"flame-graph",comesFromUserAction:!0,item:e.payload.item})})),r=this.subscribeToEvent(ED,(e=>{const{useAncestorTimeRange:t,clearDiffRange:n,baselineFilters:r,comparisonFilters:i}=e.payload;this.setExplorationType({type:"diff-flame-graph",comesFromUserAction:!0,bodySceneOptions:{useAncestorTimeRange:t,clearDiffRange:n,baselineFilters:r,comparisonFilters:i}})})),i=this.subscribeToEvent(WM,(()=>{this.resetSpanSelector()}));return{unsubscribe(){r.unsubscribe(),n.unsubscribe(),t.unsubscribe(),e.unsubscribe(),i.unsubscribe()}}}setExplorationType({type:e,comesFromUserAction:t,item:n,bodySceneOptions:r}){t&&(O_(),this.resetVariables(e)),this.setState({explorationType:e,body:this.buildBodyScene(e,n,r)})}resetSpanSelector(){nm.findByKeyAndType(this,"spanSelector",rj).reset()}resetVariables(e){nm.findByKeyAndType(this,"quick-filter",DR).reset(),nm.findByKeyAndType(this,"groupBy",bD).changeValueTo(bD.DEFAULT_VALUE),nm.findByKeyAndType(this,"panel-type-switcher",uA).reset(),this.resetSpanSelector(),["labels","flame-graph","diff-flame-graph"].includes(e)||nm.findByKeyAndType(this,"filters",oA).reset()}buildBodyScene(e,t,n){let r;switch(e){case"profiles":r=new ej({item:t});break;case"labels":r=new ZD({item:t});break;case"flame-graph":r=new aV({item:t});break;case"diff-flame-graph":r=new fM(n||{});break;case"favorites":r=new dD;break;default:r=new rD}return new eO({direction:"column",primary:r})}static Component({model:e}){const t=(0,o.useStyles2)(yV),{data:n,actions:r}=e.useProfilesExplorer(),{explorationType:i,controls:a,body:s,$variables:l,dataSourceUid:c}=n;return $i().createElement(GM,{dataSourceUid:c},$i().createElement(pV,{explorationType:i,controls:a,body:s,$variables:l,onChangeExplorationType:r.onChangeExplorationType}),$i().createElement("div",{className:t.body,"data-testid":"sceneBody"},s&&$i().createElement(s.Component,{model:s})))}constructor(){super({key:"profiles-explorer",explorationType:void 0,body:void 0,$timeRange:new lf(nj()),$variables:new Ow({variables:[new QP,new HP,new VP,new oA({key:"filters"}),new oA({key:"filtersBaseline"}),new oA({key:"filtersComparison"}),new bD,new rj]}),controls:[new tx({isOnCanvas:!0}),new px({isOnCanvas:!0})],gridControls:[new DR({placeholder:""}),new uA,new kR,new AR]}),fV(this,"_urlSync",new Jh(this,{keys:["explorationType"]})),fV(this,"onChangeExplorationType",(e=>{Cs("g_pyroscope_app_exploration_type_clicked",{explorationType:e}),this.setExplorationType({type:e,comesFromUserAction:!0})})),fV(this,"useProfilesExplorer",(()=>{const{explorationType:e,controls:t,body:n,$variables:r}=this.useState();return{data:{explorationType:e,controls:t,body:n,$variables:r,dataSourceUid:r.state.variables[0].useState().value},actions:{onChangeExplorationType:this.onChangeExplorationType}}})),IS().initSync(this),this.registerRuntimeDataSources(),this.addActivationHandler(this.onActivate.bind(this))}}fV(gV,"EXPLORATION_TYPE_OPTIONS",[{value:"all",label:"All services",description:"Overview of all services, for any given profile type"},{value:"profiles",label:"Profile types",description:"Overview of all the profile types for a single service"},{value:"labels",label:"Labels",description:"Single service label exploration and filtering"},{value:"flame-graph",label:"Flame graph",description:"Single service flame graph"},{value:"diff-flame-graph",label:"Diff flame graph",description:"Compare the differences between two flame graphs"},{value:"favorites",label:"Favorites",description:"Overview of favorited visualizations",icon:"favorite"}]),fV(gV,"DEFAULT_EXPLORATION_TYPE",gV.EXPLORATION_TYPE_OPTIONS[0].value);const yV=()=>({body:i.css`
position: relative;
z-index: 0;
background: transparent;
`});function bV(){const e=(0,Fi.useMemo)((()=>new gV),[]);return ks("explore"),$i().createElement(e.Component,{model:e})}function vV({rule:e,confirm:t}){const[n,r]=$i().useState(!1);return $i().createElement($i().Fragment,null,$i().createElement(o.IconButton,{name:"trash-alt",onClick:()=>r(!0),variant:"destructive","aria-label":"Delete recording rule"}),$i().createElement(o.ConfirmModal,{isOpen:n,title:"Delete recording rule",body:`Are you sure you want to delete ${e.metricName} recording rule?`,confirmText:"Yes",onConfirm:()=>{t(),r(!1)},onDismiss:()=>r(!1)}))}function wV(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function SV(){const{recordingRules:e,error:t,remove:n,isFetching:r}=nF();return{data:{recordingRules:e,fetchError:t,isFetching:r},actions:{removeRecordingRule(e){return(t=function*(){try{yield n(e),Ns([`Recording rule ${e.metricName} deleted!`])}catch(t){js(t,[`Failed to delete recording rule ${e.metricName}.`])}},function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){wV(a,r,i,o,s,"next",e)}function s(e){wV(a,r,i,o,s,"throw",e)}o(void 0)}))})();var t}}}}function EV(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xV(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function OV(){const e=(0,o.useStyles2)(_V),{data:t,actions:n}=SV(),{recordingRules:r}=t;if(t.isFetching)return $i().createElement(ss,null);const a=[{id:"metricName",header:"Name",sortType:"alphanumeric"},{id:"serviceName",header:"Service Name",sortType:"alphanumeric"},{id:"profileType",header:"Profile Type",sortType:"alphanumeric"},{id:"groupBy",header:"Labels",cell:t=>{var n;const r=null===(n=t.row.original.groupBy)||void 0===n?void 0:n.filter((e=>!e.match(/^__\S+__$/)));return r&&0!==r.length?$i().createElement(o.TagList,{className:e.tagList,displayMax:4,tags:r}):$i().createElement(o.Text,{element:"span",color:"secondary"},"None")}},{id:"actions",header:"Actions",disableGrow:!0,cell:e=>{const t=e.row.original;return $i().createElement(vV,{rule:t,confirm:()=>n.removeRecordingRule(t)})}}],s=(r||[]).map((e=>{const t=IP(e.profileType);return xV(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){EV(e,t,n[t])}))}return e}({},e),{profileType:`${t.group}/${t.type}`})})),l=!s||0===s.length;let c=null;return c=t.fetchError?$i().createElement(TV,{error:t.fetchError}):l?$i().createElement(o.EmptyState,{message:"No recording rules",variant:"not-found",button:$i().createElement(xs,null)},'Open a flame graph, click on the "total" block at the top and select "Create recording rule" from the context menu to define a new rule.'):$i().createElement("div",null,$i().createElement(o.InteractiveTable,{className:(0,i.css)({marginBottom:"32px"}),columns:a,pageSize:10,data:s||[],getRowId:e=>e.metricName}),$i().createElement(xs,null)),$i().createElement($i().Fragment,null,$i().createElement(os,{title:"Recording rules"}),c)}const _V=()=>({tagList:i.css`
flex-direction: row;
justify-content: start;
`});function TV({error:e}){var t;let n="Error while retrieving recording rules";return 404===(null===(t=e.response)||void 0===t?void 0:t.status)?n="This feature requires Pyroscope with recording_rules flag enabled.":e.message&&(n=e.message),$i().createElement(o.EmptyState,{message:"Error while retrieving recording rules",variant:"not-found",button:$i().createElement(xs,null)},n)}function CV(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function kV(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){kV(e,t,n[t])}))}return e}function AV(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function RV(){var e;const{settings:t,error:n,mutate:r}=Zj(),[i,a]=YL(),[o,s]=(0,Fi.useState)(null!=t?t:Qj),l=(0,Es.useNavigate)(),c=(0,Es.useLocation)(),u=(0,Fi.useRef)(null===(e=c.state)||void 0===e?void 0:e.referrer);return(0,Fi.useEffect)((()=>{t&&s(t)}),[t]),{data:AV(PV({},o),{fetchError:n}),actions:{toggleCollapsedFlamegraphs(){s((e=>AV(PV({},e),{collapsedFlamegraphs:!e.collapsedFlamegraphs})))},updateMaxNodes(e){s((t=>AV(PV({},t),{maxNodes:Number(e.target.value)})))},toggleEnableFlameGraphDotComExport(){s((e=>AV(PV({},e),{enableFlameGraphDotComExport:!e.enableFlameGraphDotComExport})))},toggleEnableFunctionDetails(){s((e=>AV(PV({},e),{enableFunctionDetails:!e.enableFunctionDetails})))},toggleEnableMetricsFromProfiles(){s((e=>AV(PV({},e),{enableMetricsFromProfiles:!e.enableMetricsFromProfiles})))},saveSettings(){return(e=function*(){a(o.maxNodes);try{yield r(o),Ns(["Plugin settings successfully saved!"])}catch(e){js(e,["Error while saving the plugin settings!","Please try again later, sorry for the inconvenience."])}},function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){CV(a,r,i,o,s,"next",e)}function s(e){CV(a,r,i,o,s,"throw",e)}o(void 0)}))})();var e},goBack(){if(!u.current)return void l(`${Ai}${Ri.EXPLORE}`);const e=new URL(u.current);i&&e.searchParams.set("maxNodes",String(i)),l(`${e.pathname}${e.search}`)}}}}function DV(){const e=(0,o.useStyles2)(jV),{data:t,actions:n}=RV();return t.fetchError&&js(t.fetchError,["Error while retrieving the plugin settings!","Please try to reload the page, sorry for the inconvenience."]),ks("settings"),$i().createElement($i().Fragment,null,$i().createElement(os,{title:"Profiles settings (tenant)"}),$i().createElement("form",{className:e.settingsForm,onSubmit:function(e){e.preventDefault(),n.saveSettings()}},$i().createElement($i().Fragment,null,$i().createElement(o.FieldSet,{label:"Flame graph","data-testid":"flamegraph-settings"},$i().createElement(o.InlineFieldRow,null,$i().createElement(o.InlineField,{label:"Collapsed flame graphs",labelWidth:24},$i().createElement(o.InlineSwitch,{label:"Toggle collapsed flame graphs",name:"collapsed-flamegraphs",value:t.collapsedFlamegraphs,onChange:n.toggleCollapsedFlamegraphs}))),$i().createElement(o.InlineFieldRow,null,$i().createElement(o.InlineField,{label:"Maximum number of nodes",tooltip:"",labelWidth:24},$i().createElement(o.Input,{name:"max-nodes",type:"number",min:"1",value:t.maxNodes,onChange:n.updateMaxNodes})))),$i().createElement(o.FieldSet,{label:"Function details","data-testid":"function-details-settings"},$i().createElement(o.InlineFieldRow,null,$i().createElement(o.InlineField,{label:"Enable function details",labelWidth:24,tooltip:$i().createElement("div",{className:e.tooltip},$i().createElement("p",null,"The function details feature enables mapping of resource usage to lines of source code. If the GitHub integration is configured, then the source code will be downloaded from GitHub."),$i().createElement("p",null,$i().createElement("a",{href:"https://grafana.com/docs/grafana-cloud/monitor-applications/profiles/pyroscope-github-integration/",target:"_blank",rel:"noreferrer noopener"},"Learn more"))),interactive:!0},$i().createElement(o.InlineSwitch,{label:"Toggle function details",name:"function-details-feature",value:t.enableFunctionDetails,onChange:n.toggleEnableFunctionDetails})))),QM.metricsFromProfiles&&$i().createElement(o.FieldSet,{label:"Experimental features","data-testid":"experimental-features"},$i().createElement(o.InlineFieldRow,null,$i().createElement(o.InlineField,{label:"Metrics from profiles",tooltip:"Allows creating Prometheus recording rules from profiles",labelWidth:24},$i().createElement(o.InlineSwitch,{label:"Enable metrics from profiles",name:"metrics-from-profiles",value:t.enableMetricsFromProfiles,onChange:n.toggleEnableMetricsFromProfiles})))),$i().createElement("div",{className:e.buttons},$i().createElement(o.Button,{variant:"primary",type:"submit"},"Save settings"),$i().createElement(xs,{onClick:n.goBack})))))}const jV=e=>({settingsForm:i.css`
& > fieldset {
border: 0 none;
border-bottom: 1px solid ${e.colors.border.weak};
padding-left: 0;
}
& > fieldset > legend {
font-size: ${e.typography.h4.fontSize};
}
`,buttons:i.css`
display: flex;
gap: ${e.spacing(1)};
`,tooltip:i.css`
p {
margin: ${e.spacing(1)};
}
a {
color: ${e.colors.text.link};
}
em {
font-style: normal;
font-weight: ${e.typography.fontWeightBold};
}
`});function IV(){return $i().createElement(Es.Routes,null,$i().createElement(Es.Route,{path:Ri.EXPLORE,element:$i().createElement(bV,null)}),$i().createElement(Es.Route,{path:Ri.ADHOC,element:$i().createElement(kp,null)}),$i().createElement(Es.Route,{path:Ri.SETTINGS,element:$i().createElement(DV,null)}),$i().createElement(Es.Route,{path:Ri.RECORDING_RULES,element:$i().createElement(OV,null)}),$i().createElement(Es.Route,{path:"/*",element:$i().createElement(Es.Navigate,{to:`${Ai}${Ri.EXPLORE}`,replace:!0})}))}function NV({error:e}){return $i().createElement(a.PluginPage,{layout:r.PageLayoutType.Canvas},$i().createElement("div",{className:"pyroscope-app"},$i().createElement(os,{title:"Grafana Profiles Drilldown"}),$i().createElement(eI,{severity:"error",title:"Fatal error!",message:"Please try reloading the page or, if the problem persists, contact your organization admin. Sorry for the inconvenience.",error:e,errorContext:{handheldBy:"React error boundary"}})))}!function(){if(Mi())return;const e=function(){const e=Ii();if(e&&Ni.has(e))return Ni.get(e)}();if(!e)return;const{environment:t,faroUrl:n,appName:r}=e,{apps:i,bootData:o,buildInfo:s}=a.config,l=i[Pi].version,c=o.user.email,u=`v${s.version} (${s.edition})`;var d;d=Ci({url:n,app:{name:r,release:l,version:Di,environment:t,namespace:u},user:{email:c},instrumentations:[...Ti({captureConsole:!1})],isolate:!0,beforeSend:e=>{var t,n,r;return(null!==(n=null===(t=e.meta.page)||void 0===t?void 0:t.url)&&void 0!==n?n:"").includes(Ai)?(e.meta.view={name:new URLSearchParams(null===(r=e.meta.page)||void 0===r?void 0:r.url).get("explorationType")||""},e):null}}),Li=d}();const LV=e=>({pageContainer:i.css`
display: flex;
flex-direction: column;
padding: ${e.spacing(1)} ${e.spacing(2)} ${e.spacing(2)} ${e.spacing(2)};
flex-basis: 100%;
flex-grow: 1;
`});function MV(e){var t,n,r;const{timeRange:i,pyroscopeQuery:a}=e;let o="",s="",l="all",c=null===(n=e.pyroscopeQuery.labelSelector)||void 0===n||null===(t=n.match(/service_name="([^"]+)"/))||void 0===t?void 0:t[1];c&&(l="labels"),e.explorationType&&(l=e.explorationType);const u=`var-dataSource=${null===(r=a.datasource)||void 0===r?void 0:r.uid}`,d=c?`&var-serviceName=${c}`:"",p=`&var-profileMetricId=${a.profileTypeId}`,h=`&explorationType=${l}`;i&&(o=`&from=${i.from}&to=${i.to}`),a.spanSelector&&(s=`&var-spanSelector=${a.spanSelector}`);return`/a/grafana-pyroscope-app/explore?${new URLSearchParams(`${u}${d}${p}${o}${h}${s}`).toString()}`}const FV={targets:[r.PluginExtensionPoints.ExploreToolbarAction],title:"Open in Grafana Profiles Drilldown",icon:"fire",description:"Try our new queryless experience for profiles",path:"/a/grafana-pyroscope-app/explore",configure(e){if(!e||!e.targets||!e.timeRange||e.targets.length>1)return;const t=e.targets[0];return t.datasource&&"grafana-pyroscope-datasource"===t.datasource.type?{path:MV({pyroscopeQuery:t,timeRange:e.timeRange})}:void 0}},$V={targets:["grafana/traceview/details"],title:"Open in Grafana Profiles Drilldown",description:"Try our new queryless experience for profiles",path:"/a/grafana-pyroscope-app/explore",onClick:(e,{context:t})=>{if(!(t&&t.serviceName&&t.spanSelector&&t.profileTypeId&&t.timeRange))return;const n=t.serviceName,r=t.spanSelector,i=t.profileTypeId,a=t.timeRange,o={refId:"span-flamegraph-profiles-drilldown-refId",labelSelector:`service_name="${n}"`,profileTypeId:i,spanSelector:r,datasource:t.datasource,groupBy:["service_name"]};if(o.datasource){const e=MV({pyroscopeQuery:o,timeRange:a,explorationType:"flame-graph"});window.open(e,"_blank","noopener,noreferrer")}}},BV=(new r.AppPlugin).addLink(FV).addLink($V).setRootPage((function(){const e=(0,o.useStyles2)(LV),[t,n]=(0,Fi.useState)();return t?$i().createElement(NV,{error:t}):$i().createElement(o.ErrorBoundary,{onError:n},(()=>$i().createElement(zi,{client:W},$i().createElement(Ss,null,$i().createElement("div",{className:e.pageContainer},$i().createElement(a.PluginPage,{layout:r.PageLayoutType.Custom},$i().createElement("div",{className:"pyroscope-app"},$i().createElement(IV,null))))))))}))})(),__webpack_exports__})()));
//# sourceMappingURL=module.js.map