1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{C as t,w as n}from"./vendor-codemirror-WL_lVi-l.js";import{t as r}from"./useQuery-gG_7DPQh.js";import{Io as i,Qc as a,Zd as o,qn as s,t as c}from"./mixpanel-tracking-BxUqMXDU.js";import{o as l}from"./hooks-BZQy5Rac.js";import{a as u,t as d}from"./lib-7bdISuWt.js";import{Ct as f,b as p,mt as m,v as h,y as g}from"./users-Id8pvIgE.js";import{n as _}from"./canUseDOM-DoEBwVyg.js";import{t as v}from"./CombinedGraphQLErrors-C8tTIrTI.js";import{t as y}from"./lib-CEu4caMe.js";import{t as b}from"./useMutation-Lx1aUsfN.js";import{r as x}from"./chart-theme-BDnFwcYu.js";import{n as S}from"./dayjs-BWrQKTt8.js";import{$c as C,$o as w,Ac as T,B as E,Bo as D,Es as O,G as ee,I as k,Is as A,K as j,Lo as M,Mc as N,Oc as te,Po as ne,Ps as P,Ro as re,Rs as F,Tc as ie,Ts as I,Tt as ae,Uc as oe,Vc as se,Vo as ce,W as le,Wo as ue,Ws as de,Zc as fe,_s as pe,bc as L,dl as me,dt as he,el as ge,et as _e,hl as ve,hn as ye,hr as be,is as xe,j as Se,jc as Ce,kc as we,m as Te,ml as Ee,mt as De,pl as Oe,pn as ke,qc as Ae,rl as je,rn as Me,ss as Ne,tl as Pe,ts as Fe,vc as R,vl as Ie,xc as Le,xl as z,yc as Re}from"./src-CC3Tx-9Z.js";import{t as ze}from"./use-debounced-value-7g4jTxT1.js";import{a as Be,i as Ve,t as He}from"./constants-DmIVpOkI.js";import{t as Ue}from"./use-resize-observer-CgXLtEmJ.js";import{t as We}from"./use-disclosure-B0TiftuN.js";import{t as Ge}from"./Flex-siEe0XI6.js";import{t as Ke}from"./SimpleGrid-C3rkgXXb.js";import{t as qe}from"./use-freshness-or-ucs-last-update-CNx17ueu.js";import{t as Je}from"./TextInput-CddJ-w9U.js";import{B as Ye,C as Xe,N as Ze,O as Qe,U as $e,b as et,f as B,g as tt,j as nt}from"./general-utils-D0M3oOMg.js";import{p as rt}from"./constants-G18Lv4XJ.js";import{Ar as it,Et as at,Hr as ot,Ht as st,K as ct,Kr as lt,Ot as V,Wr as ut,Xi as dt,an as H,ei as ft,er as pt,gn as mt,mi as ht,nr as gt,ot as _t,un as vt,va as U}from"./base-types-CDCshtCx.js";import{t as yt}from"./react-Dh68y4fg.js";import{r as bt}from"./router-DYkcR_Yq.js";import{t as xt}from"./routes-CBPFGKSg.js";import{i as St,t as Ct}from"./logic-that-should-be-in-the-backend-BPT6cHU2.js";import{a as wt,i as Tt}from"./route-utils-D-NR5E2o.js";import{t as Et}from"./auto-tooltip2-sWNNtnzp.js";import{t as Dt}from"./browser-render-to-string-B16m0wEu.js";import{t as Ot}from"./constants-BN7-zfq1.js";import{$t as kt,An as At,Bn as jt,Bt as Mt,Cn as Nt,Dn as Pt,En as Ft,Fn as It,Gn as Lt,Gt as Rt,Hn as zt,Ht as Bt,In as Vt,J as Ht,Jt as Ut,Kn as Wt,Kt as Gt,Ln as Kt,Mn as qt,Nn as Jt,On as Yt,Pn as Xt,Qt as Zt,Rn as Qt,Sn as $t,Tn as en,Un as tn,Ut as nn,Vn as rn,Vt as an,Wn as on,Wt as sn,X as cn,Xt as ln,Yt as un,Zt as dn,_n as fn,an as pn,bn as mn,cn as W,dn as hn,en as gn,fn as _n,ft as vn,gn as yn,hn as bn,in as xn,jn as Sn,kn as Cn,ln as wn,mn as Tn,mt as En,nn as Dn,on as On,pn as kn,pt as An,qt as jn,rn as Mn,sn as Nn,tn as Pn,un as Fn,vn as In,wn as Ln,xn as Rn,yn as zn,zn as Bn}from"./use-monitor-tuning-suggestions-D2CjwWOc.js";import{t as Vn}from"./react-echarts-DTeC_u63.js";import{t as Hn}from"./v4-DDdyfk2q.js";import{t as Un}from"./defaultLocale-CNPGWpMu.js";import{i as Wn,o as Gn}from"./chart-utils-CevFFuMq.js";import{n as Kn,o as qn}from"./sql-formatter-utils-BO_6Ziwk.js";import{t as Jn}from"./get-events.generated-D-bTpj9u.js";import{t as Yn}from"./no-results-for-selected-period-VBACh7pY.js";import{t as Xn}from"./use-cursor-paginate-CI7VSLp8.js";import{t as Zn}from"./search-box-Oaz9jT8P.js";import{n as Qn,r as $n,t as er}from"./get-metrics-v4.generated-C7lZJT59.js";import{n as G}from"./evaluate-asset-selection.generated-DaVwXGYb.js";var K=e(n(),1);function tr(e){return t=>{if(!t)e(t);else if(typeof t==`function`)e(t);else if(typeof t==`object`&&`nativeEvent`in t){let{currentTarget:n}=t;n.type===`checkbox`?e(n.checked):e(n.value)}else e(t)}}function nr(e){let[t,n]=(0,K.useState)(e);return[t,tr(n)]}var q=t(),rr=Le(e=>{let{value:t,defaultValue:n,onChange:r,multiple:i,children:a}=T(`ChipGroup`,null,e),[o,s]=fe({value:t,defaultValue:n,finalValue:i?[]:null,onChange:r});return(0,q.jsx)(ir,{value:{isChipSelected:e=>Array.isArray(o)?o.includes(e):e===o,onChange:e=>{let t=e.currentTarget.value;s(Array.isArray(o)?o.includes(t)?o.filter(e=>e!==t):[...o,t]:t)},multiple:i},children:a})});rr.displayName=`@mantine/core/ChipGroup`;var ir=(0,K.createContext)(null),ar={root:`m_f59ffda3`,label:`m_be
1049a53`,"label--outline":`m_3904c1af`,"label--filled":`m_fa109255`,"label--light":`m_f7e165c3`,iconWrapper:`m_9ac86df9`,checkIcon:`m_d6d72580`,input:`m_bde07329`},or={type:`checkbox`},sr=oe((e,{size:t,radius:n,variant:r,color:i,autoContrast:a})=>{let o=e.variantColorResolver({color:i||e.primaryColor,theme:e,variant:r||`filled`,autoContrast:a});return{root:{"--chip-fz":me(t),"--chip-size":Ee(t,`chip-size`),"--chip-radius":n===void 0?void 0:Oe(n),"--chip-checked-padding":Ee(t,`chip-checked-padding`),"--chip-padding":Ee(t,`chip-padding`),"--chip-icon-size":Ee(t,`chip-icon-size`),"--chip-bg":i||r?o.background:void 0,"--chip-hover":i||r?o.hover:void 0,"--chip-color":i||r?o.color:void 0,"--chip-bd":i||r?o.border:void 0,"--chip-spacing":Ee(t,`chip-spacing`)}}}),cr=L(e=>{let t=T(`Chip`,or,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,id:c,checked:l,defaultChecked:u,onChange:d,value:f,wrapperProps:p,type:m,disabled:h,children:g,size:_,variant:v,icon:y,rootRef:b,autoContrast:x,mod:S,attributes:C,...w}=t,E=te({name:`Chip`,classes:ar,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:C,vars:s,varsResolver:sr}),D=(0,K.use)(ir),O=Pe(c),{styleProps:ee,rest:k}=ie(w),[A,j]=fe({value:l,defaultValue:u,finalValue:!1,onChange:d}),M=D?{checked:D.isChipSelected(f),onChange:e=>{D.onChange(e),d?.(e.currentTarget.checked)},type:D.multiple?`checkbox`:`radio`}:{},N=M.checked||A;return(0,q.jsxs)(R,{size:_,variant:v,ref:b,mod:S,...E(`root`),...ee,...p,children:[(0,q.jsx)(`input`,{type:m,...E(`input`),checked:N,onChange:e=>j(e.currentTarget.checked),id:O,disabled:h,value:f,...M,...k}),(0,q.jsxs)(R,{component:`label`,htmlFor:O,mod:{checked:N,disabled:h},...E(`label`,{variant:v||`filled`}),children:[N&&y!==null&&y!==!1&&(0,q.jsx)(`span`,{...E(`iconWrapper`),children:y===void 0?(0,q.jsx)(pe,{...E(`checkIcon`)}):y}),(0,q.jsx)(`span`,{children:g})]})]})});cr.classes=ar,cr.varsResolver=sr,cr.displayName=`@mantine/core/Chip`,cr.Group=rr;var lr={root:`m_de3d2490`,colorOverlay:`m_862f3d1b`,shadowOverlay:`m_98ae7f22`,alphaOverlay:`m_95709ac0`,childrenOverlay:`m_93e74e3`},ur={withShadow:!0},dr=oe((e,{radius:t,size:n})=>({root:{"--cs-radius":t===void 0?void 0:Oe(t),"--cs-size":z(n)}})),fr=Re(e=>{let t=T(`ColorSwatch`,ur,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,color:c,radius:l,withShadow:u,children:d,attributes:f,...p}=T(`ColorSwatch`,ur,t),m=te({name:`ColorSwatch`,props:t,classes:lr,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:f,vars:s,varsResolver:dr});return(0,q.jsxs)(R,{...m(`root`,{focusable:!0}),...p,children:[(0,q.jsx)(`span`,{...m(`alphaOverlay`)}),u&&(0,q.jsx)(`span`,{...m(`shadowOverlay`)}),(0,q.jsx)(`span`,{...m(`colorOverlay`,{style:{backgroundColor:c}})}),(0,q.jsx)(`span`,{...m(`childrenOverlay`),children:d})]})});fr.classes=lr,fr.varsResolver=dr,fr.displayName=`@mantine/core/ColorSwatch`;function pr(e,t=0,n=10**t){return Math.round(n*e)/n}function mr({h:e,s:t,l:n,a:r}){let i=t*((n<50?n:100-n)/100);return{h:e,s:i>0?2*i/(n+i)*100:0,v:n+i,a:r}}var hr={grad:360/400,turn:360,rad:360/(Math.PI*2)};function gr(e,t=`deg`){return Number(e)*(hr[t]||1)}var _r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i;function vr(e){let t=_r.exec(e);return t?mr({h:gr(t[1],t[2]),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}):{h:0,s:0,v:0,a:1}}function yr({r:e,g:t,b:n,a:r}){let i=Math.max(e,t,n),a=i-Math.min(e,t,n),o=a?i===e?(t-n)/a:i===t?2+(n-e)/a:4+(e-t)/a:0;return{h:pr(60*(o<0?o+6:o),3),s:pr(i?a/i*100:0,3),v:pr(i/255*100,3),a:r}}function br(e){let t=e[0]===`#`?e.slice(1):e;return t.length===3?yr({r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:1}):yr({r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:1})}function xr(e){let t=e[0]===`#`?e.slice(1):e,n=e=>pr(parseInt(e,16)/255,3);if(t.length===4){let e=t.slice(0,3),r=n(t[3]+t[3]);return{...br(e),a:r}}let r=t.slice(0,6),i=n(t.slice(6,8));return{...br(r),a:i}}var Sr=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i;function Cr(e){let t=Sr.exec(e);return t?yr({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}}var wr={hex:/^#?([0-9A-F]{3}){1,2}
1$/i,hexa:/^#?([0-9A-F]{4}){1,2}$/i,rgb:/^rgb\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,rgba:/^rgba\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/i,hsl:/hsl\(\s*(\d+)\s*,\s*(\d+(?:\.\d+)?%)\s*,\s*(\d+(?:\.\d+)?%)\)/i,hsla:/^hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*(\d*(?:\.\d+)?)\)$/i},Tr={hex:br,hexa:xr,rgb:Cr,rgba:Cr,hsl:vr,hsla:vr};function Er(e){for(let[,t]of Object.entries(wr))if(t.test(e))return!0;return!1}function Dr(e){if(typeof e!=`string`)return{h:0,s:0,v:0,a:1};if(e===`transparent`)return{h:0,s:0,v:0,a:0};let t=e.trim();for(let[e,n]of Object.entries(wr))if(n.test(t))return Tr[e](t);return{h:0,s:0,v:0,a:1}}var Or=(0,K.createContext)(null);function kr({position:e,...t}){return(0,q.jsx)(R,{__vars:{"--thumb-y-offset":`${e.y*100}%`,"--thumb-x-offset":`${e.x*100}%`},...t})}kr.displayName=`@mantine/core/ColorPickerThumb`;var Ar={wrapper:`m_fee9c77`,preview:`m_9dddfbac`,body:`m_bffecc3e`,sliders:`m_3283bb96`,thumb:`m_40d572ba`,swatch:`m_d8ee6fd8`,swatches:`m_5711e686`,saturation:`m_202a296e`,saturationOverlay:`m_11b3db02`,slider:`m_d856d47d`,sliderOverlay:`m_8f327113`},jr=L(e=>{let t=T(`ColorSlider`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,onChange:c,onChangeEnd:l,maxValue:u,round:d,size:f=`md`,focusable:p=!0,value:m,overlays:h,thumbColor:g=`transparent`,onScrubStart:_,onScrubEnd:v,__staticSelector:y=`ColorPicker`,attributes:b,ref:x,...S}=t,w=te({name:y,classes:Ar,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:b,rootSelector:`slider`}),E=(0,K.use)(Or)?.getStyles||w,D=Ce(),[O,ee]=(0,K.useState)({y:0,x:m/u}),k=(0,K.useRef)(O),A=e=>d?Math.round(e*u):e*u,{ref:j}=Be(({x:e,y:t})=>{k.current={x:e,y:t},c?.(A(e))},{onScrubEnd:()=>{let{x:e}=k.current;l?.(A(e)),v?.()},onScrubStart:_});je(()=>{ee({y:0,x:m/u})},[m]);let M=(e,t)=>{e.preventDefault();let n=Ve(t);c?.(A(n.x)),l?.(A(n.x))},N=e=>{switch(e.key){case`ArrowRight`:M(e,{x:O.x+.05,y:O.y});break;case`ArrowLeft`:M(e,{x:O.x-.05,y:O.y})}},ne=h.map((e,t)=>(0,K.createElement)(`div`,{...E(`sliderOverlay`),style:e,key:t}));return(0,q.jsxs)(R,{...S,ref:C(j,x),...E(`slider`),size:f,role:`slider`,"aria-valuenow":m,"aria-valuemax":u,"aria-valuemin":0,tabIndex:p?0:-1,onKeyDown:N,"data-focus-ring":D.focusRing,__vars:{"--cp-thumb-size":`var(--cp-thumb-size-${f})`},children:[ne,(0,q.jsx)(kr,{position:O,...E(`thumb`,{style:{top:z(1),background:g}})})]})});jr.displayName=`@mantine/core/ColorSlider`,jr.classes=Ar;var Mr={__staticSelector:`AlphaSlider`},Nr=L(e=>{let{value:t,onChange:n,onChangeEnd:r,color:i,...a}=T(`AlphaSlider`,Mr,e);return(0,q.jsx)(jr,{...a,value:t,onChange:e=>n?.(pr(e,2)),onChangeEnd:e=>r?.(pr(e,2)),maxValue:1,round:!1,"data-alpha":!0,overlays:[{backgroundImage:`linear-gradient(45deg, var(--slider-checkers) 25%, transparent 25%), linear-gradient(-45deg, var(--slider-checkers) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--slider-checkers) 75%), linear-gradient(-45deg, var(--mantine-color-body) 75%, var(--slider-checkers) 75%)`,backgroundSize:`${z(8)} ${z(8)}`,backgroundPosition:`0 0, 0 ${z(4)}, ${z(4)} ${z(-4)}, ${z(-4)} 0`},{backgroundImage:`linear-gradient(90deg, transparent, ${i})`},{boxShadow:`rgba(0, 0, 0, .1) 0 0 0 ${z(1)} inset, rgb(0, 0, 0, .15) 0 0 ${z(4)} inset`}]})});Nr.displayName=`@mantine/core/AlphaSlider`,Nr.classes=jr.classes;function Pr({h:e,s:t,v:n,a:r}){let i=e/360*6,a=t/100,o=n/100,s=Math.floor(i),c=o*(1-a),l=o*(1-(i-s)*a),u=o*(1-(1-i+s)*a),d=s%6;return{r:pr([o,l,c,c,u,o][d]*255),g:pr([u,o,o,l,c,c][d]*255),b:pr([c,c,u,o,o,l][d]*255),a:pr(r,2)}}function Fr(e,t){let{r:n,g:r,b:i,a}=Pr(e);return t?`rgba(${n}, ${r}, ${i}, ${pr(a,2)})`:`rgb(${n}, ${r}, ${i})`}function Ir({h:e,s:t,v:n,a:r},i){let a=(200-t)*n/100,o={h:Math.round(e),s:Math.round(a>0&&a<200?t*n/100/(a<=100?a:200-a)*100:0),l:Math.round(a/2)};return i?`hsla(${o.h}, ${o.s}%, ${o.l}%, ${pr(r,2)})`:`hsl(${o.h}, ${o.s}%, ${o.l}%)`}function Lr(e){let t=e.toString(16);return t.length<2?`0${t}`:t}function Rr(e){let{r:t,g:n,b:r}=Pr(e);return`#${Lr(t)}${Lr(n)}${Lr(r)}`}function zr(e){let t=Math.round(e.a*255);return`${Rr(e)}${Lr(t)}`}var Br={hex:Rr,hexa:e=>zr(e),rgb:e=>Fr(e,!1),rgba:e=>Fr(e,!0),hsl:e=>Ir(e,!1),hsla:e=>Ir(e,!0)};function Vr(e,t){return t?e in Br?Br[e](t):Br.hex(t):`#000000`}var Hr={__staticSelector:`HueSlider`},Ur=L(e=>{let{value:t,onChange:n,onChangeEnd:r,color:i,...a}=T(`HueSlider`,Hr,e);return(0,q.jsx)(jr,{...a,value:t,onChange:n,onChangeEnd:r,maxValue:360,thumbColor:`hsl(${t}, 100%, 50%)`,round:!0,"data-hue":!0,overlays:[{backgroundImage:`linear-gradient(to right,hsl(0,100%,50%),hsl(60,100%,50%),hsl(120,100%,50%),hsl(170,100%,50%),hsl(240,100%,50%),hsl(300,100%,50%),hsl(360,100%,50%))`},{boxShadow:`rgba(0, 0, 0, .1) 0 0 0 ${z(1)} inset, rgb(0, 0, 0, .15) 0 0 ${z(4)} inset`}]})});Ur.displayName=`@mantine/core/HueSlider`,Ur.classes=jr.classes;
1function Wr({className:e,onChange:t,onChangeEnd:n,value:r,saturationLabel:i,focusable:a=!0,size:o,color:s,onScrubStart:c,onScrubEnd:l,...u}){let{getStyles:d}=(0,K.use)(Or),[f,p]=(0,K.useState)({x:r.s/100,y:1-r.v/100}),m=(0,K.useRef)(f),{ref:h}=Be(({x:e,y:n})=>{m.current={x:e,y:n},t({s:Math.round(e*100),v:Math.round((1-n)*100)})},{onScrubEnd:()=>{let{x:e,y:t}=m.current;n({s:Math.round(e*100),v:Math.round((1-t)*100)}),l?.()},onScrubStart:c});(0,K.useEffect)(()=>{p({x:r.s/100,y:1-r.v/100})},[r.s,r.v]);let g=(e,r)=>{e.preventDefault();let i=Ve(r);t({s:Math.round(i.x*100),v:Math.round((1-i.y)*100)}),n({s:Math.round(i.x*100),v:Math.round((1-i.y)*100)})},_=e=>{switch(e.key){case`ArrowUp`:g(e,{y:f.y-.05,x:f.x});break;case`ArrowDown`:g(e,{y:f.y+.05,x:f.x});break;case`ArrowRight`:g(e,{x:f.x+.05,y:f.y});break;case`ArrowLeft`:g(e,{x:f.x-.05,y:f.y})}};return(0,q.jsxs)(R,{...d(`saturation`),ref:h,...u,role:`slider`,"aria-label":i,"aria-valuenow":f.x,"aria-valuetext":Vr(`rgba`,r),tabIndex:a?0:-1,onKeyDown:_,children:[(0,q.jsx)(`div`,{...d(`saturationOverlay`,{style:{backgroundColor:`hsl(${r.h}, 100%, 50%)`}})}),(0,q.jsx)(`div`,{...d(`saturationOverlay`,{style:{backgroundImage:`linear-gradient(90deg, #fff, transparent)`}})}),(0,q.jsx)(`div`,{...d(`saturationOverlay`,{style:{backgroundImage:`linear-gradient(0deg, #000, transparent)`}})}),(0,q.jsx)(kr,{position:f,...d(`thumb`,{style:{backgroundColor:s}})})]})}Wr.displayName=`@mantine/core/Saturation`;function Gr({className:e,datatype:t,setValue:n,onChangeEnd:r,size:i,focusable:a,data:o,swatchesPerRow:s,value:c,...l}){let u=(0,K.use)(Or),d=o.map((e,t)=>(0,K.createElement)(fr,{...u.getStyles(`swatch`),unstyled:u.unstyled,component:`button`,type:`button`,color:e,key:t,radius:`sm`,onClick:()=>{n(e),r?.(e)},"aria-label":e,tabIndex:a?0:-1,"data-swatch":!0},c===e&&(0,q.jsx)(pe,{size:`35%`,color:se(e)<.5?`white`:`black`})));return(0,q.jsx)(R,{...u.getStyles(`swatches`),...l,children:d})}Gr.displayName=`@mantine/core/Swatches`;var Kr={swatchesPerRow:7,withPicker:!0,focusable:!0,size:`md`,__staticSelector:`ColorPicker`},qr=oe((e,{size:t,swatchesPerRow:n})=>({wrapper:{"--cp-preview-size":Ee(t,`cp-preview-size`),"--cp-width":Ee(t,`cp-width`),"--cp-body-spacing":ve(t),"--cp-swatch-size":`${100/n}%`,"--cp-thumb-size":Ee(t,`cp-thumb-size`),"--cp-saturation-height":Ee(t,`cp-saturation-height`)}})),Jr=L(e=>{let t=T(`ColorPicker`,Kr,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,format:c=`hex`,value:l,defaultValue:u,onChange:d,onChangeEnd:f,withPicker:p,size:m,saturationLabel:h,hueLabel:g,alphaLabel:_,focusable:v,swatches:y,swatchesPerRow:b,fullWidth:x,onColorSwatchClick:S,__staticSelector:C,mod:w,attributes:E,name:D,hiddenInputProps:O,...ee}=t,k=te({name:C,props:t,classes:Ar,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:E,rootSelector:`wrapper`,vars:s,varsResolver:qr}),A=(0,K.useRef)(c||`hex`),j=(0,K.useRef)(``),M=(0,K.useRef)(-1),N=(0,K.useRef)(!1),ne=c===`hexa`||c===`rgba`||c===`hsla`,[P,re,F]=fe({value:l,defaultValue:u,finalValue:`#FFFFFF`,onChange:d}),[ie,I]=(0,K.useState)(Dr(P)),ae=()=>{window.clearTimeout(M.current),N.current=!0},oe=()=>{window.clearTimeout(M.current),M.current=window.setTimeout(()=>{N.current=!1},200)},se=e=>{I(t=>{let n={...t,...e};return j.current=Vr(A.current,n),n}),re(j.current)};return je(()=>{typeof l==`string`&&Er(l)&&!N.current&&I(Dr(l))},[l]),je(()=>{A.current=c||`hex`,re(Vr(A.current,ie))},[c]),(0,q.jsx)(Or,{value:{getStyles:k,unstyled:o},children:(0,q.jsxs)(R,{...k(`wrapper`),size:m,mod:[{"full-width":x},w],...ee,children:[D&&(0,q.jsx)(`input`,{type:`hidden`,name:D,value:P,...O}),p&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Wr,{value:ie,onChange:se,onChangeEnd:({s:e,v:t})=>f?.(Vr(A.current,{...ie,s:e,v:t})),color:P,size:m,focusable:v,saturationLabel:h,onScrubStart:ae,onScrubEnd:oe}),(0,q.jsxs)(`div`,{...k(`body`),children:[(0,q.jsxs)(`div`,{...k(`sliders`),children:[(0,q.jsx)(Ur,{value:ie.h,onChange:e=>se({h:e}),onChangeEnd:e=>f?.(Vr(A.current,{...ie,h:e})),size:m,focusable:v,"aria-label":g,onScrubStart:ae,onScrubEnd:oe}),ne&&(0,q.jsx)(Nr,{value:ie.a,onChange:e=>se({a:e}),onChangeEnd:e=>{f?.(Vr(A.current,{...ie,a:e}))}
1,size:m,color:Vr(`hex`,ie),focusable:v,"aria-label":_,onScrubStart:ae,onScrubEnd:oe})]}),ne&&(0,q.jsx)(fr,{color:P,radius:`sm`,size:`var(--cp-preview-size)`,...k(`preview`)})]})]}),Array.isArray(y)&&(0,q.jsx)(Gr,{data:y,swatchesPerRow:b,focusable:v,setValue:re,value:P,onChangeEnd:e=>{let t=Vr(c,Dr(e));S?.(t),f?.(t),F||I(Dr(e))}})]})})});Jr.classes=Ar,Jr.varsResolver=qr,Jr.displayName=`@mantine/core/ColorPicker`;var Yr={root:`m_d08caa0`},Xr=L(e=>{let t=T(`Typography`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,attributes:s,...c}=t,l=te({name:`Typography`,classes:Yr,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:s});return(0,q.jsx)(R,{...l(`root`),...c})});Xr.classes=Yr,Xr.displayName=`@mantine/core/Typography`;var Zr={root:`m_dd3f7539`,Typography:`m_f2016866`,content:`m_c2204cc2`,linkEditorDropdown:`m_8a991b4f`,tableInsertDropdown:`m_23e1dc21`,tableInsertGrid:`m_a81ab56`,tableInsertCell:`m_a7fa972`,tableInsertLabel:`m_45f260e4`,control:`m_c2207da6`,controlIcon:`m_9cdfeb3f`,controlsGroup:`m_2ab47ef2`,linkEditor:`m_b67b711e`,linkEditorInput:`m_296cf94c`,linkEditorExternalControl:`m_cfef614`,linkEditorSave:`m_3b28e7bb`,toolbar:`m_4574a3c4`,taskList:`m_8b44009a`},Qr={linkControlLabel:`Link`,colorPickerControlLabel:`Text color`,highlightControlLabel:`Highlight text`,colorControlLabel:e=>`Set text color ${e}`,boldControlLabel:`Bold`,italicControlLabel:`Italic`,underlineControlLabel:`Underline`,strikeControlLabel:`Strikethrough`,clearFormattingControlLabel:`Clear formatting`,unlinkControlLabel:`Remove link`,bulletListControlLabel:`Bullet list`,orderedListControlLabel:`Ordered list`,sourceCodeControlLabel:`Switch between text/source code`,h1ControlLabel:`Heading 1`,h2ControlLabel:`Heading 2`,h3ControlLabel:`Heading 3`,h4ControlLabel:`Heading 4`,h5ControlLabel:`Heading 5`,h6ControlLabel:`Heading 6`,blockquoteControlLabel:`Blockquote`,alignLeftControlLabel:`Align text: left`,alignCenterControlLabel:`Align text: center`,alignRightControlLabel:`Align text: right`,alignJustifyControlLabel:`Align text: justify`,codeControlLabel:`Code`,codeBlockControlLabel:`Code block`,subscriptControlLabel:`Subscript`,superscriptControlLabel:`Superscript`,unsetColorControlLabel:`Unset color`,hrControl
1Label:`Horizontal line`,undoControlLabel:`Undo`,redoControlLabel:`Redo`,tasksControlLabel:`Task list`,tasksSinkLabel:`Decrease task level`,tasksLiftLabel:`Increase task level`,tableInsertControlLabel:`Insert table`,tableInsertLabel:(e,t)=>`Insert ${e} Ã ${t} table`,tableDeleteControlLabel:`Delete table`,tableColumnBeforeControlLabel:`Add column before`,tableColumnAfterControlLabel:`Add column after`,tableColumnDeleteControlLabel:`Delete column`,tableRowBeforeControlLabel:`Add row before`,tableRowAfterControlLabel:`Add row after`,tableRowDeleteControlLabel:`Delete row`,tableToggleHeaderRowControlLabel:`Toggle header row`,tableToggleHeaderColumnControlLabel:`Toggle header column`,tableMergeCellsControlLabel:`Merge cells`,tableSplitCellControlLabel:`Split cell`,detailsControlLabel:`Toggle collapsible section`,invisibleCharactersControlLabel:`Toggle invisible characters`,linkEditorInputLabel:`Enter URL`,linkEditorInputPlaceholder:`https://example.com/`,linkEditorExternalLink:`Open link in a new tab`,linkEditorInternalLink:`Open link in the same tab`,linkEditorSave:`Save`,colorPickerCancel:`Cancel`,colorPickerClear:`Clear color`,colorPickerColorPicker:`Color picker`,colorPickerPalette:`Color palette`,colorPickerSave:`Save`,colorPickerColorLabel:e=>`Set text color ${e}`},[$r,ei]=Ie(`RichTextEditor component was not found in tree`),ti=e(Ae(),1),ni=ee(),ri=Object.getOwnPropertyNames,ii=Object.getOwnPropertySymbols,ai=Object.prototype.hasOwnProperty;function oi(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function si(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);var i=r.cache,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);var s=e(t,n,r);return i.delete(t),i.delete(n),s}}function ci(e){return e?.[Symbol.toStringTag]}function li(e){return ri(e).concat(ii(e))}var ui=Object.hasOwn||(function(e,t){return ai.call(e,t)});function di(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var fi=`__v`,pi=`__o`,mi=`_owner`,hi=Object.getOwnPropertyDescriptor,gi=Object.keys;function _i(e,t,n){var r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function vi(e,t){return di(e.getTime(),t.getTime())}function yi(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function bi(e,t){return e===t}function xi(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=Array(r),a=e.entries(),o,s,c=0;(o=a.next())&&!o.done;){for(var l=t.entries(),u=!1,d=0;(s=l.next())&&!s.done;){if(i[d]){d++;continue}var f=o.value,p=s.value;if(n.equals(f[0],p[0],c,d,e,t,n)&&n.equals(f[1],p[1],f[0],p[0],e,t,n)){u=i[d]=!0;break}d++}if(!u)return!1;c++}return!0}var Si=di;function Ci(e,t,n){var r=gi(e),i=r.length;if(gi(t).length!==i)return!1;for(;i-->0;)if(!Ai(e,t,n,r[i]))return!1;return!0}function wi(e,t,n){var r=li(e),i=r.length;if(li(t).length!==i)return!1;for(var a,o,s;i-->0;)if(a=r[i],!Ai(e,t,n,a)||(o=hi(e,a),s=hi(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Ti(e,t){return di(e.valueOf(),t.valueOf())}function Ei(e,t){return e.source===t.source&&e.flags===t.flags}function Di(e,t,n){var r=e.size;if(r!==t.size)return!1;if(!r)return!0;for(var i=Array(r),a=e.values(),o,s;(o=a.next())&&!o.done;){for(var c=t.values(),l=!1,u=0;(s=c.next())&&!s.done;){if(!i[u]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){l=i[u]=!0;break}u++}if(!l)return!1}return!0}function Oi(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function ki(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Ai(e,t,n,r){return(r===mi||r===pi||r===fi)&&(e.$$typeof||t.$$typeof)?!0:ui(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var ji=`[object Arguments]`,Mi=`[object Boolean]`,Ni=`[object Date]`,Pi=`[object Error]`,Fi=`[object Map]`,Ii=`[object Number]`,Li=`[object Object]`,Ri=`[object RegExp]`,zi=`[object Set]`,Bi=`[object String]`,Vi=`[object URL]`,Hi=Array.isArray,Ui=typeof ArrayBuffer<`u`&&typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView:null,Wi=Object.assign,Gi=Object.prototype.toString.call.bind(Object.prototype.toString);function Ki(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,o=e.areNumbersEqual,s=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,l=e.areRegExpsEqual,u=e.areSetsEqual,d=e.areTypedArraysEqual,f=e.areUrlsEqual,p=e.unknownTagComparators;return function(e,m,h){if(e===m)return!0;
1if(e==null||m==null)return!1;var g=typeof e;if(g!==typeof m)return!1;if(g!==`object`)return g===`number`?o(e,m,h):g===`function`&&i(e,m,h);var _=e.constructor;if(_!==m.constructor)return!1;if(_===Object)return s(e,m,h);if(Hi(e))return t(e,m,h);if(Ui!=null&&Ui(e))return d(e,m,h);if(_===Date)return n(e,m,h);if(_===RegExp)return l(e,m,h);if(_===Map)return a(e,m,h);if(_===Set)return u(e,m,h);var v=Gi(e);if(v===Ni)return n(e,m,h);if(v===Ri)return l(e,m,h);if(v===Fi)return a(e,m,h);if(v===zi)return u(e,m,h);if(v===Li)return typeof e.then!=`function`&&typeof m.then!=`function`&&s(e,m,h);if(v===Vi)return f(e,m,h);if(v===Pi)return r(e,m,h);if(v===ji)return s(e,m,h);if(v===Mi||v===Ii||v===Bi)return c(e,m,h);if(p){var y=p[v];if(!y){var b=ci(e);b&&(y=p[b])}if(y)return y(e,m,h)}return!1}}function qi(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,i={areArraysEqual:r?wi:_i,areDatesEqual:vi,areErrorsEqual:yi,areFunctionsEqual:bi,areMapsEqual:r?oi(xi,wi):xi,areNumbersEqual:Si,areObjectsEqual:r?wi:Ci,arePrimitiveWrappersEqual:Ti,areRegExpsEqual:Ei,areSetsEqual:r?oi(Di,wi):Di,areTypedArraysEqual:r?wi:Oi,areUrlsEqual:ki,unknownTagComparators:void 0};if(n&&(i=Wi({},i,n(i))),t){var a=si(i.areArraysEqual),o=si(i.areMapsEqual),s=si(i.areObjectsEqual),c=si(i.areSetsEqual);i=Wi({},i,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:s,areSetsEqual:c})}return i}function Ji(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function Yi(e){var t=e.circular,n=e.comparator,r=e.createState,i=e.equals,a=e.strict;if(r)return function(e,o){var s=r(),c=s.cache,l=c===void 0?t?new WeakMap:void 0:c,u=s.meta;return n(e,o,{cache:l,equals:i,meta:u,strict:a})};if(t)return function(e,t){return n(e,t,{cache:new WeakMap,equals:i,meta:void 0,strict:a})};var o={cache:void 0,equals:i,meta:void 0,strict:a};return function(e,t){return n(e,t,o)}}var Xi=Zi();Zi({strict:!0}),Zi({circular:!0}),Zi({circular:!0,strict:!0}),Zi({createInternalComparator:function(){return di}}),Zi({strict:!0,createInternalComparator:function(){return di}}),Zi({circular:!0,createInternalComparator:function(){return di}}),Zi({circular:!0,createInternalComparator:function(){return di},strict:!0});function Zi(e){e===void 0&&(e={});var t=e.circular,n=t!==void 0&&t,r=e.createInternalComparator,i=e.createState,a=e.strict,o=a!==void 0&&a,s=Ki(qi(e));return Yi({circular:n,comparator:s,createState:i,equals:r?r(s):Ji(s),strict:o})}var Qi=e(le(),1),$i=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},ea=({contentComponent:e})=>{let t=(0,ni.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,q.jsx)(q.Fragment,{children:Object.values(t)})};function ta(){let e=new Set,t={},n=!1,r=()=>{n||!e.size||(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:ti.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var na=class extends K.Component{constructor(e){super(e),this.editorContentRef=K.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=ta(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{ref:$i(t,this.editorContentRef),...n}),e?.contentComponent&&(0,q.jsx)(ea,{contentComponent:e.contentComponent})]})}},ra=(0,K.forwardRef)((e,t)=>{let n=K.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return K.createElement(na,{key:n,innerRef:t,...e})}),ia=K.memo(ra),aa=typeof window<`u`?K.useLayoutEffect:K.useEffect,oa=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0}
1,this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{(t?.transaction===void 0||t.transaction!==e)&&(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function sa(e){let[t]=(0,K.useState)(()=>new oa(e.editor)),n=(0,Qi.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??Xi);return aa(()=>t.watch(e.editor),[e.editor,t]),(0,K.useDebugValue)(n),n}var ca=typeof window>`u`,la=ca||!!(typeof window<`u`&&window.next),ua=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(ca||la&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){let e={...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}};return new Te(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){
1if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function da(e={},t=[]){let n=(0,K.useRef)(e);n.current=e;let[r]=(0,K.useState)(()=>new ua(n)),i=(0,ni.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,K.useDebugValue)(i),(0,K.useEffect)(r.onRender(t)),sa({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var fa=(0,K.createContext)({editor:null});fa.Consumer;var pa=()=>(0,K.useContext)(fa),ma=(0,K.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),ha=()=>(0,K.useContext)(ma);K.forwardRef((e,t)=>{let{onDragStart:n}=ha(),r=e.as||`div`;return(0,q.jsx)(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function ga(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function _a(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function va(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function ya(e){if(ga(e)||_a(e))return!0;if(va(e)){let t=e.type;if(t)return ga(t)||_a(t)}return!1}function ba(){try{if(K.version)return parseInt(K.version.split(`.`)[0],10)>=19}catch{}return!1}var xa=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,ti.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=ba(),a=ya(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,q.jsx)(t,{...o}),r==null||(e=r.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;t==null||(e=t.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};K.createContext({markViewContentRef:()=>{}});var Sa=(0,K.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Sa.displayName=`TiptapContext`;var Ca=()=>(0,K.useContext)(Sa);function wa({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,K.useMemo)(()=>({editor:n}),[n]),i=(0,K.useMemo)(()=>({editor:n}),[n]);return(0,q.jsx)(fa.Provider,{value:i,children:(0,q.jsx)(Sa.Provider,{value:r,children:e})})}wa.displayName=`Tiptap`;function Ta({...e}){let{editor:t}=Ca();return(0,q.jsx)(ia,{editor:t,...e})}Ta.displayName=`Tiptap.Content`,Object.assign(wa,{Content:Ta});var Ea=L(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...o}=T(`RichTextEditorContent`,null,e),s=ei();return s.withTypographyStyles?(0,q.jsx)(Xr,{...s.getStyles(`Typography`,{className:n,style:r,styles:i,classNames:t}),unstyled:s.unstyled,children:(0,q.jsx)(R,{component:ia,editor:s.editor,...s.getStyles(`content`,{classNames:t,styles:i}),...o})}):(0,q.jsx)(R,{component:ia,editor:s.editor,...s.getStyles(`content`,{classNames:t,styles:i,className:n,style:r}),...o})});Ea.classes=Zr,Ea.displayName=`@mantine/tiptap/RichTextEditorContent`;var Da={interactive:!0},Oa=L(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,interactive:o,active:s,onMouseDown:c,disabled:l,...u}=T(`RichTextEditorControl`,Da,e),d=ei();return(0,q.jsx)(de,{...u,...d.getStyles(`control`,{className:n,style:r,classNames:t,styles:i}),disabled:l,"data-rich-text-editor-control":!0,tabIndex:o?0:-1,"data-interactive":o||void 0,"data-disabled":l||void 0,"data-active":s||void 0,"aria-pressed":s&&o||void 0,"aria-hidden":!o||void 0,unstyled:d.unstyled,variant:d.variant||`default`,onMouseDown:e=>{e.preventDefault(),c?.(e)}})});
1Oa.classes=Zr,Oa.displayName=`@mantine/tiptap/RichTextEditorControl`;function ka({className:e,icon:t,...n}){let r=ei();return(0,q.jsx)(Oa,{...n,children:(0,q.jsx)(t,{...r.getStyles(`controlIcon`)})})}ka.displayName=`@mantine/tiptap/RichTextEditorControlBase`;function J({label:e,isActive:t,operation:n,icon:r,isDisabled:i}){let a=a=>{let{editor:o,labels:s}=ei(),c=s[e],l=sa({editor:o??null,selector:()=>{let e=o&&!o.isDestroyed?o:null;return{active:e&&t?.name?e.isActive(t.name,t.attributes):!1,disabled:e?i?.(e)??!1:!0}}}),{disabled:u,...d}=a,f=l?.active??!1,p=(l?.disabled??!0)||!!u;return(0,q.jsx)(ka,{"aria-label":c,title:c,active:f,icon:a.icon||r,...d,disabled:p,onClick:()=>{if(!o||o.isDestroyed)return;let e=o.chain().focus();typeof e[n.name]==`function`&&e[n.name](n.attributes).run()}})};return a.displayName=`@mantine/tiptap/${e}`,a}function Y(e){return(0,q.jsx)(`svg`,{...e,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})}function Aa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M7 5h6a3.5 3.5 0 0 1 0 7h-6z`}),(0,q.jsx)(`path`,{d:`M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7`})]})}function ja(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M11 5l6 0`}),(0,q.jsx)(`path`,{d:`M7 19l6 0`}),(0,q.jsx)(`path`,{d:`M14 5l-4 14`})]})}function Ma(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M7 5v5a5 5 0 0 0 10 0v-5`}),(0,q.jsx)(`path`,{d:`M5 19h14`})]})}function Na(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M5 12l14 0`}),(0,q.jsx)(`path`,{d:`M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5`})]})}function Pa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M17 15l4 4m0 -4l-4 4`}),(0,q.jsx)(`path`,{d:`M7 6v-1h11v1`}),(0,q.jsx)(`path`,{d:`M7 19l4 0`}),(0,q.jsx)(`path`,{d:`M13 5l-4 14`})]})}function Fa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M19 18v-8l-2 2`}),(0,q.jsx)(`path`,{d:`M4 6v12`}),(0,q.jsx)(`path`,{d:`M12 6v12`}),(0,q.jsx)(`path`,{d:`M11 18h2`}),(0,q.jsx)(`path`,{d:`M3 18h2`}),(0,q.jsx)(`path`,{d:`M4 12h8`}),(0,q.jsx)(`path`,{d:`M3 6h2`}),(0,q.jsx)(`path`,{d:`M11 6h2`})]})}function Ia(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0`}),(0,q.jsx)(`path`,{d:`M4 6v12`}),(0,q.jsx)(`path`,{d:`M12 6v12`}),(0,q.jsx)(`path`,{d:`M11 18h2`}),(0,q.jsx)(`path`,{d:`M3 18h2`}),(0,q.jsx)(`path`,{d:`M4 12h8`}),(0,q.jsx)(`path`,{d:`M3 6h2`}),(0,q.jsx)(`path`,{d:`M11 6h2`})]})}function La(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M19 14a2 2 0 1 0 -2 -2`}),(0,q.jsx)(`path`,{d:`M17 16a2 2 0 1 0 2 -2`}),(0,q.jsx)(`path`,{d:`M4 6v12`}),(0,q.jsx)(`path`,{d:`M12 6v12`}),(0,q.jsx)(`path`,{d:`M11 18h2`}),(0,q.jsx)(`path`,{d:`M3 18h2`}),(0,q.jsx)(`path`,{d:`M4 12h8`}),(0,q.jsx)(`path`,{d:`M3 6h2`}),(0,q.jsx)(`path`,{d:`M11 6h2`})]})}function Ra(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M20 18v-8l-4 6h5`}),(0,q.jsx)(`path`,{d:`M4 6v12`}),(0,q.jsx)(`path`,{d:`M12 6v12`}),(0,q.jsx)(`path`,{d:`M11 18h2`}),(0,q.jsx)(`path`,{d:`M3 18h2`}),(0,q.jsx)(`path`,{d:`M4 12h8`}),(0,q.jsx)(`path`,{d:`M3 6h2`}),(0,q.jsx)(`path`,{d:`M11 6h2`})]})}function za(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M17 18h2a2 2 0 1 0 0 -4h-2v-4h4`}),(0,q.jsx)(`path`,{d:`M4 6v12`}),(0,q.jsx)(`path`,{d:`M12 6v12`}),(0,q.jsx)(`path`,{d:`M11 18h2`}),(0,q.jsx)(`path`,{d:`M3 18h2`}),(0,q.jsx)(`path`,{d:`M4 12h8`}),(0,q.jsx)(`path`,{d:`M3 6h2`}),(0,q.jsx)(`path`,{d:`M11 6h2`})]})}function Ba(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z`}),(0,q.jsx)(`path`,{d:`M21 12a2 2 0 1 0 -4 0v4`}),(0,q.jsx)(`path`,{d:`M4 6v12`}),(0,q.jsx)(`path`,{d:`M12 6v12`}),(0,q.jsx)(`path`,{d:`M11 18h2`}),(0,q.jsx)(`path`,{d:`M3 18h2`}),(0,q.jsx)(`path`,{d:`M4 12h8`}),(0,q.jsx)(`path`,{d:`M3 6h2`}),(0,q.jsx)(`path`,{d:`M11 6h2`})]})}function Va(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M9 6l11 0`}),(0,q.jsx)(`path`,{d:`M9 12l11 0`}),(0,q.jsx)(`path`,{d:`M9 18l11 0`}),(0,q.jsx)(`path`,{d:`M5 6l0 .01`}),(0,q.jsx)(`path`,{d:`M5 12l0 .01`}),(0,q.jsx)(`path`,{d:`M5 18l0 .01`})]})}function Ha(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M11 6h9`}),(0,q.jsx)(`path`,{d:`M11 12h9`}),(0,q.jsx)(`path`,{d:`M12 18h8`}),(0,q.jsx)(`path`,{d:`M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4`}),(0,q.jsx)(`path`,{d:`M6 10v-6l-2 2`})]})}function Ua(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M17 22v-2`}),(0,q.jsx)(`path`,{d:`M9 15l6 -6`}),(0,q.jsx)(`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`}),(0,q.jsx)(`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`}),(0,q.jsx)(`path`,{d:`M20 17h2`}),(0,q.jsx)(`path`,{d:`M2 7h2`}),(0,q.jsx)(`path`,{d:`M7 2v2`})]})}function Wa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M6 15h15`}),(0,q.jsx)(`path`,{d:`M21 19h-15`}),(0,q.jsx)(`path`,{d:`M15 11h6`}),(0,q.jsx)(`path`,{d:`M21 7h-6`}),(0,q.jsx)(`path`,{d:`M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`}),(0,q.jsx)(`path`,{d:`M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2`})]})}function Ga(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 6l16 0`}),(0,q.jsx)(`path`,{d:`M4 12l10 0`}),(0,q.jsx)(`path`,{d:`M4 18l14 0`})]})}function Ka(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 6l16 0`}),(0,q.jsx)(`path`,{d:`M10 12l10 0`}
1),(0,q.jsx)(`path`,{d:`M6 18l14 0`})]})}function qa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 6l16 0`}),(0,q.jsx)(`path`,{d:`M8 12l8 0`}),(0,q.jsx)(`path`,{d:`M6 18l12 0`})]})}function Ja(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 6l16 0`}),(0,q.jsx)(`path`,{d:`M4 12l16 0`}),(0,q.jsx)(`path`,{d:`M4 18l12 0`})]})}function Ya(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M5 7l8 10m-8 0l8 -10`}),(0,q.jsx)(`path`,{d:`M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2`})]})}function Xa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M5 7l8 10m-8 0l8 -10`}),(0,q.jsx)(`path`,{d:`M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2`})]})}function Za(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,q.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,q.jsx)(`path`,{d:`M14 4l-4 16`})]})}function Qa(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,q.jsx)(`path`,{d:`M12.5 5.5l4 4`}),(0,q.jsx)(`path`,{d:`M4.5 13.5l4 4`}),(0,q.jsx)(`path`,{d:`M21 15v4h-8l4 -4z`})]})}function $a(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M5 12h2`}),(0,q.jsx)(`path`,{d:`M17 12h2`}),(0,q.jsx)(`path`,{d:`M11 12h2`})]})}function eo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73`}),(0,q.jsx)(`path`,{d:`M3 3l18 18`})]})}function to(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M11 7l6 6`}),(0,q.jsx)(`path`,{d:`M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z`})]})}function no(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M18 6l-12 12`}),(0,q.jsx)(`path`,{d:`M6 6l12 12`})]})}function ro(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25`}),(0,q.jsx)(`path`,{d:`M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,q.jsx)(`path`,{d:`M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,q.jsx)(`path`,{d:`M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]})}function io(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]})}function ao(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M9 15l6 -6`}),(0,q.jsx)(`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`}),(0,q.jsx)(`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`})]})}function oo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6`}),(0,q.jsx)(`path`,{d:`M11 13l9 -9`}),(0,q.jsx)(`path`,{d:`M15 4h5v5`})]})}function so(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M9 14l-4 -4l4 -4`}),(0,q.jsx)(`path`,{d:`M5 10h11a4 4 0 1 1 0 8h-1`})]})}function co(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M15 14l4 -4l-4 -4`}),(0,q.jsx)(`path`,{d:`M19 10h-11a4 4 0 1 0 0 8h1`})]})}function lo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M3.5 5.5l1.5 1.5l2.5 -2.5`}),(0,q.jsx)(`path`,{d:`M3.5 11.5l1.5 1.5l2.5 -2.5`}),(0,q.jsx)(`path`,{d:`M3.5 17.5l1.5 1.5l2.5 -2.5`}),(0,q.jsx)(`path`,{d:`M11 6l9 0`}),(0,q.jsx)(`path`,{d:`M11 12l9 0`}),(0,q.jsx)(`path`,{d:`M11 18l9 0`})]})}function uo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M20 6l-11 0`}),(0,q.jsx)(`path`,{d:`M20 12l-7 0`}),(0,q.jsx)(`path`,{d:`M20 18l-11 0`}),(0,q.jsx)(`path`,{d:`M4 8l4 4l-4 4`})]})}function fo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M20 6l-7 0`}),(0,q.jsx)(`path`,{d:`M20 12l-9 0`}),(0,q.jsx)(`path`,{d:`M20 18l-7 0`}),(0,q.jsx)(`path`,{d:`M8 8l-4 4l4 4`})]})}function po(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914 2 a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18 3 a1 1 0 0 1 1 1Z`}),(0,q.jsx)(`path`,{d:`M10 11l-2 2 2 2`}),(0,q.jsx)(`path`,{d:`M14 11l2 2-2 2`})]})}function mo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5`}),(0,q.jsx)(`path`,{d:`M3 10h18`}),(0,q.jsx)(`path`,{d:`M10 3v18`}),(0,q.jsx)(`path`,{d:`M16 19h6`}),(0,q.jsx)(`path`,{d:`M19 16v6`})]})}function ho(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M7 3h12a2 2 0 0 1 2 2v12m-.585 3.413a1.994 1.994 0 0 1 -1.415 .587h-14a2 2 0 0 1 -2 -2v-14c0 -.55 .223 -1.05 .583 -1.412`}),(0,q.jsx)(`path`,{d:`M3 10h7m4 0h7`}),(0,q.jsx)(`path`,{d:`M10 3v3m0 4v11`}),(0,q.jsx)(`path`,{d:`M3 3l18 18`})]})}function go(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z`}),(0,q.jsx)(`path`,{d:`M5 12l4 0`}),(0,q.jsx)(`path`,{d:`M7 10l0 4`})]})}function _o(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z`}),(0,q.jsx)(`path`,{d:`M15 12l4 0`}),(0,q.jsx)(`path`,{d:`M17 10l0 4`})]})}function vo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z`}),(0,q.jsx)(`path`,{d:`M16 10l4 4`}),(0,q.jsx)(`path`,{d:`M16 14l4 -4`})]})}function yo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 18v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z`}),(0,q.jsx)(`path`,{d:`M12 9v-4`}),(0,q.jsx)(`path`,{d:`M10 7l4 0`})]})}function bo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z`}),(0,q.jsx)(`path`,{d:`M12 15l0 4`}),(0,q.jsx)(`path`,{d:`M14 17l-4 0`})]})}function xo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z`}),(0,q.jsx)(`path`,{d:`M10 16l4 4`}),(0,q.jsx)(`path`,{d:`M10 20l4 -4`})]})}function So(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z`}),(0,q.jsx)(`path`,{d:`M4 9l16 0`})]})}function Co(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z`}),(0,q.jsx)(`path`,{d:`M9 4l0 16`})]})}function wo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M18 10h-4v-4`}),(0,q.jsx)(`path`,{d:`M20 4l-6 6`}),(0,q.jsx)(`path`,{d:`M6 14h4v4`}),(0,q.jsx)(`path`,{d:`M10 14l-6 6`})]})}function To(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12 4l0 16`}),(0,q.jsx)(`path`,{d:`M8 8l-4 4l4 4`}),(0,q.jsx)(`path`,{d:`M16 16l4 -4l-4 -4`})]})}function Eo(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M8 5l3 3l-3 3`}),(0,q.jsx)(`path`,{d:`M15 8l4 0`}),(0,q.jsx)(`path`,{d:`M5 15l14 0`}),(0,q.jsx)(`path`,{d:`M5 19l14 0`})]})}function Do(e){return(0,q.jsxs)(Y,{...e,children:[(0,q.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,q.jsx)(`path`,{d:`M13 4v16`}),(0,q.jsx)(`path`,{d:`M17 4v16`}),(0,q.jsx)(`path`,{d:`M19 4h-9.5a4.5 4.5 0 0 0 0 9h3.5`})]})}var Oo=J({label:`boldControlLabel`,icon:e=>(0,q.jsx)(Aa,{...e}),isActive:{name:`bold`},operation:{name:`toggleBold`}}),ko=J({label:`italicControlLabel`,icon:e=>(0,q.jsx)(ja,{...e}),isActive:{name:`italic`},operation:{name:`toggleItalic`}}),Ao=J({label:`underlineControlLabel`,icon:e=>(0,q.jsx)(Ma,{...e}),isActive:{name:`underline`},operation:{name:`toggleUnderline`}}),jo=J({label:`strikeControlLabel`,icon:e=>(0,q.jsx)(Na,{...e}),isActive:{name:`strike`},operation:{name:`toggleStrike`}}
3),Mo=J({label:`clearFormattingControlLabel`,icon:e=>(0,q.jsx)(Pa,{...e}),operation:{name:`unsetAllMarks`}}),No=J({label:`unlinkControlLabel`,icon:e=>(0,q.jsx)(Ua,{...e}),operation:{name:`unsetLink`}}),Po=J({label:`bulletListControlLabel`,icon:e=>(0,q.jsx)(Va,{...e}),isActive:{name:`bulletList`},operation:{name:`toggleBulletList`}}),Fo=J({label:`orderedListControlLabel`,icon:e=>(0,q.jsx)(Ha,{...e}),isActive:{name:`orderedList`},operation:{name:`toggleOrderedList`}}),Io=J({label:`h1ControlLabel`,icon:e=>(0,q.jsx)(Fa,{...e}),isActive:{name:`heading`,attributes:{level:1}},operation:{name:`toggleHeading`,attributes:{level:1}}}),Lo=J({label:`h2ControlLabel`,icon:e=>(0,q.jsx)(Ia,{...e}),isActive:{name:`heading`,attributes:{level:2}},operation:{name:`toggleHeading`,attributes:{level:2}}}),Ro=J({label:`h3ControlLabel`,icon:e=>(0,q.jsx)(La,{...e}),isActive:{name:`heading`,attributes:{level:3}},operation:{name:`toggleHeading`,attributes:{level:3}}}),zo=J({label:`h4ControlLabel`,icon:e=>(0,q.jsx)(Ra,{...e}),isActive:{name:`heading`,attributes:{level:4}},operation:{name:`toggleHeading`,attributes:{level:4}}}),Bo=J({label:`h5ControlLabel`,icon:e=>(0,q.jsx)(za,{...e}),isActive:{name:`heading`,attributes:{level:5}},operation:{name:`toggleHeading`,attributes:{level:5}}}),Vo=J({label:`h6ControlLabel`,icon:e=>(0,q.jsx)(Ba,{...e}),isActive:{name:`heading`,attributes:{level:6}},operation:{name:`toggleHeading`,attributes:{level:6}}}),Ho=J({label:`blockquoteControlLabel`,icon:e=>(0,q.jsx)(Wa,{...e}),isActive:{name:`blockquote`},operation:{name:`toggleBlockquote`}}),Uo=J({label:`alignLeftControlLabel`,icon:e=>(0,q.jsx)(Ga,{...e}),operation:{name:`setTextAlign`,attributes:`left`}}),Wo=J({label:`alignRightControlLabel`,icon:e=>(0,q.jsx)(Ka,{...e}),operation:{name:`setTextAlign`,attributes:`right`}}),Go=J({label:`alignCenterControlLabel`,icon:e=>(0,q.jsx)(qa,{...e}),operation:{name:`setTextAlign`,attributes:`center`}}),Ko=J({label:`alignJustifyControlLabel`,icon:e=>(0,q.jsx)(Ja,{...e}),operation:{name:`setTextAlign`,attributes:`justify`}}),qo=J({label:`subscriptControlLabel`,icon:e=>(0,q.jsx)(Ya,{...e}),isActive:{name:`subscript`},operation:{name:`toggleSubscript`}}),Jo=J({label:`superscriptControlLabel`,icon:e=>(0,q.jsx)(Xa,{...e}),isActive:{name:`superscript`},operation:{name:`toggleSuperscript`}}),Yo=J({label:`codeControlLabel`,icon:e=>(0,q.jsx)(Za,{...e}),isActive:{name:`code`},operation:{name:`toggleCode`}}),Xo=J({label:`codeBlockControlLabel`,icon:e=>(0,q.jsx)(Za,{...e}),isActive:{name:`codeBlock`},operation:{name:`toggleCodeBlock`}}),Zo=J({label:`highlightControlLabel`,icon:e=>(0,q.jsx)(Qa,{...e}),isActive:{name:`highlight`},operation:{name:`toggleHighlight`}}),Qo=J({label:`hrControlLabel`,icon:e=>(0,q.jsx)($a,{...e}),operation:{name:`setHorizontalRule`}}),$o=J({label:`unsetColorControlLabel`,icon:e=>(0,q.jsx)(eo,{...e}),operation:{name:`unsetColor`}}),es=J({label:`undoControlLabel`,icon:e=>(0,q.jsx)(so,{...e}),isDisabled:e=>!e?.can().undo(),operation:{name:`undo`}}),ts=J({label:`redoControlLabel`,icon:e=>(0,q.jsx)(co,{...e}),isDisabled:e=>!e?.can().redo(),operation:{name:`redo`}}),ns=J({label:`tasksControlLabel`,icon:e=>(0,q.jsx)(lo,{...e}),isActive:{name:`taskList`},operation:{name:`toggleTaskList`}}),rs=J({label:`tasksSinkLabel`,icon:e=>(0,q.jsx)(uo,{...e}),operation:{name:`sinkListItem`,attributes:`taskItem`},isDisabled:e=>!e?.can().sinkListItem(`taskItem`)}),is=J({label:`tasksLiftLabel`,icon:e=>(0,q.jsx)(fo,{...e}),operation:{name:`liftListItem`,attributes:`taskItem`},isDisabled:e=>!e?.can().liftListItem(`taskItem`)}),as=J({label:`tableDeleteControlLabel`,icon:e=>(0,q.jsx)(ho,{...e}),operation:{name:`deleteTable`},isDisabled:e=>!e?.can().deleteTable?.()}),os=J({label:`tableColumnBeforeControlLabel`,icon:e=>(0,q.jsx)(go,{...e}),operation:{name:`addColumnBefore`},isDisabled:e=>!e?.can().addColumnBefore?.()}),ss=J({label:`tableColumnAfterControlLabel`,icon:e=>(0,q.jsx)(_o,{...e}),operation:{name:`addColumnAfter`},isDisabled:e=>!e?.can().addColumnAfter?.()}),cs=J({label:`tableColumnDeleteControlLabel`,icon:e=>(0,q.jsx)(vo,{...e}),operation:{name:`deleteColumn`},isDisabled:e=>!e?.can().deleteColumn?.()}
3),ls=J({label:`tableRowBeforeControlLabel`,icon:e=>(0,q.jsx)(yo,{...e}),operation:{name:`addRowBefore`},isDisabled:e=>!e?.can().addRowBefore?.()}),us=J({label:`tableRowAfterControlLabel`,icon:e=>(0,q.jsx)(bo,{...e}),operation:{name:`addRowAfter`},isDisabled:e=>!e?.can().addRowAfter?.()}),ds=J({label:`tableRowDeleteControlLabel`,icon:e=>(0,q.jsx)(xo,{...e}),operation:{name:`deleteRow`},isDisabled:e=>!e?.can().deleteRow?.()}),fs=J({label:`tableToggleHeaderRowControlLabel`,icon:e=>(0,q.jsx)(So,{...e}),operation:{name:`toggleHeaderRow`},isDisabled:e=>!e?.can().toggleHeaderRow?.()}),ps=J({label:`tableToggleHeaderColumnControlLabel`,icon:e=>(0,q.jsx)(Co,{...e}),operation:{name:`toggleHeaderColumn`},isDisabled:e=>!e?.can().toggleHeaderColumn?.()}),ms=J({label:`tableMergeCellsControlLabel`,icon:e=>(0,q.jsx)(wo,{...e}),operation:{name:`mergeCells`},isDisabled:e=>!e?.can().mergeCells?.()}),hs=J({label:`tableSplitCellControlLabel`,icon:e=>(0,q.jsx)(To,{...e}),operation:{name:`splitCell`},isDisabled:e=>!e?.can().splitCell?.()}),gs=e=>(0,q.jsx)(ao,{...e}),_s=L(e=>{let t=T(`RichTextEditorLinkControl`,null,e),{classNames:n,className:r,style:i,styles:a,vars:o,icon:s,popoverProps:c,disableTooltips:l,initialExternal:u,...d}=t,f=ei(),p={classNames:n,styles:a},[m,h]=nr(``),[g,_]=(0,K.useState)(u),[v,{open:y,close:b}]=We(!1),x=()=>{y();let e=f.editor?.getAttributes(`link`);h(e?.href||``),_(e?.href?e?.target===`_blank`:u)},S=()=>{b(),h(``),_(u)},C=()=>{S(),m===``?f.editor?.chain().focus().extendMarkRange(`link`).unsetLink().run():f.editor?.chain().focus().extendMarkRange(`link`).setLink({href:m,target:g?`_blank`:null}).run()},w=e=>{e.key===`Enter`&&(e.preventDefault(),C())};ge(`edit-link`,x,!1);let E=sa({editor:f.editor??null,selector:e=>e.editor&&!e.editor.isDestroyed?e.editor.isActive(`link`):!1}),{resolvedClassNames:D,resolvedStyles:O}=we({classNames:n,styles:a,props:t});return(0,q.jsxs)(F,{trapFocus:!0,shadow:`md`,withinPortal:!0,opened:v,onChange:e=>!e&&S(),offset:-44,zIndex:1e4,...c,children:[(0,q.jsx)(F.Target,{children:(0,q.jsx)(ka,{icon:s||gs,...d,"aria-label":f.labels.linkControlLabel,title:f.labels.linkControlLabel,onClick:x,active:E??!1,classNames:D,styles:O,className:r,style:i,variant:f.variant})}),(0,q.jsx)(F.Dropdown,{...f.getStyles(`linkEditorDropdown`,p),children:(0,q.jsxs)(`div`,{...f.getStyles(`linkEditor`,p),children:[(0,q.jsx)(Je,{placeholder:f.labels.linkEditorInputPlaceholder,"aria-label":f.labels.linkEditorInputLabel,type:`url`,value:m,onChange:h,classNames:{input:f.getStyles(`linkEditorInput`,p).className},onKeyDown:w,rightSection:(0,q.jsx)(ue,{label:g?f.labels.linkEditorExternalLink:f.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:l,zIndex:1e4,children:(0,q.jsx)(de,{onClick:()=>_(e=>!e),"data-active":g||void 0,...f.getStyles(`linkEditorExternalControl`,p),children:(0,q.jsx)(oo,{style:{width:z(14),height:z(14)}})})})}),(0,q.jsx)(Ne,{variant:`default`,onClick:C,...f.getStyles(`linkEditorSave`,p),children:f.labels.linkEditorSave})]})})]})});_s.classes=Zr,_s.displayName=`@mantine/tiptap/RichTextEditorLinkControl`;function vs(e){let{popoverProps:t,colors:n,colorPickerProps:r,...i}=T(`RichTextEditorColorPickerControl`,null,e),{editor:a,labels:o,getStyles:s,variant:c}=ei(),[l,{toggle:u,close:d}]=We(!1),[f,p]=(0,K.useState)(`palette`),m=a?.getAttributes(`textStyle`).color||`var(--mantine-color-text)`,h=(e,t=!0)=>{(a?.chain())?.focus().setColor(e).run(),t&&d()},g=()=>{(a?.chain())?.focus().unsetColor().run(),d()},_=n.map((e,t)=>(0,q.jsx)(fr,{component:`button`,color:e,onClick:()=>h(e),size:26,radius:`xs`,style:{cursor:`pointer`},title:o.colorPickerColorLabel(e),"aria-label":o.colorPickerColorLabel(e)},t));return(0,q.jsxs)(F,{opened:l,withinPortal:!0,trapFocus:!0,onChange:e=>!e&&d(),...t,children:[(0,q.jsx)(F.Target,{children:(0,q.jsx)(Oa,{...i,variant:c,"aria-label":o.colorPickerControlLabel,title:o.colorPickerControlLabel,onClick:u,children:(0,q.jsx)(fr,{color:m,size:14})})}),(0,q.jsxs)(F.Dropdown,{...s(`linkEditorDropdown`),children:[f===`palette`&&(0,q.jsx)(Ke,{cols:7,spacing:2,children:_}),f===`colorPicker`&&(0,q.jsx)(Jr,{defaultValue:m,onChange:e=>h(e,!1),...r}),(0,q.jsx)(ue.Group,{closeDelay:200,children:(0,q.jsxs)(P,{justify:`flex-end`,gap:`xs`,mt:`sm`,children:[f===`palette`&&(0,q.jsx)(A,{variant:`default`,onClick:d,title:o.colorPickerCancel,"aria-label":o.colorPickerCancel,children:(0,q.jsx)(no,{style:{width:z(16),height:z(16)}})}),(0,q.jsx)(A,{variant:`default`,onClick:g,title:o.colorPickerClear,"aria-label":o.colorPickerClear,children:(0,q.jsx)(eo,{style:{width:z(16),height:z(16)}})}),f===`palette`?(0,q.jsx)(A,{variant:`default`,onClick:()=>p(`colorPicker`),title:o.colorPickerColorPicker,"aria-label":o.colorPickerColorPicker,children:(0,q.jsx)(to,{style:{width:z(16),height:z(16)}})}):(0,q.jsx)(A,{variant:`default`,onClick:()=>p(`palette`),"aria-label":o.colorPickerPalette,title:o.colorPickerPalette,children:(0,q.jsx)(ro,{style:{width:z(16),height:z(16)}})}),f===`colorPicker`&&(0,q.jsx)(A,{variant:`default`,onClick:d,title:o.colorPickerSave,"aria-label":o.colorPickerSave,children:(0,q.jsx)(io,{style:{width:z(16),height:z(16)}})})]})})]})]})}vs.displayName=`@mantine/tiptap/ColorPickerControl`;
3function ys(e){let{color:t,...n}=T(`RichTextEditorColorControl`,null,e),{editor:r,labels:i,variant:a}=ei(),o=r?.getAttributes(`textStyle`).color||null,s=i.colorControlLabel(t);return(0,q.jsx)(Oa,{...n,variant:a,active:o===t,"aria-label":s,title:s,onClick:()=>(r?.chain())?.focus().setColor(t).run(),children:(0,q.jsx)(fr,{color:t,size:14})})}ys.displayName=`@mantine/tiptap/RichTextEditorColorControl`;var bs={};function xs(e){let{...t}=T(`RichTextEditorSourceCodeControl`,bs,e),{editor:n,labels:r,variant:i,onSourceCodeTextSwitch:a}=ei(),[o,s]=(0,K.useState)(!1),c=()=>{o?n?.commands.setContent(n.getText(),{emitUpdate:!0}):n?.commands.setContent(`<textarea>${n.getHTML()}</textarea>`,{emitUpdate:!1});let e=!o;s(e),a?.(e)};return(0,q.jsx)(Oa,{...t,variant:i,active:o,"aria-label":r.sourceCodeControlLabel,title:r.sourceCodeControlLabel,onClick:()=>c(),children:(0,q.jsx)(po,{style:{width:z(16),height:z(16)}})})}xs.displayName=`@mantine/tiptap/RichTextEditorSourceCodeControl`;var Ss={maxColumns:10,maxRows:10,withHeaderRow:!0},Cs=e=>(0,q.jsx)(mo,{...e}),ws=L(e=>{let t=T(`RichTextEditorTableInsertControl`,Ss,e),{classNames:n,className:r,style:i,styles:a,vars:o,icon:s,maxColumns:c,maxRows:l,withHeaderRow:u,popoverProps:d,disabled:f,onClick:p,...m}=t,h=ei(),{editor:g}=h,_={classNames:n,styles:a},[v,{open:y,close:b}]=We(!1),[x,S]=(0,K.useState)({columns:0,rows:0}),C=sa({editor:g??null,selector:()=>{let e=g&&!g.isDestroyed?g:null;return!e||!e.can().insertTable?.()}}),w=f||(C??!0),{resolvedClassNames:E,resolvedStyles:D}=we({classNames:n,styles:a,props:t}),O=()=>{b(),S({columns:0,rows:0})},ee=(e,t)=>{O(),!(!g||g.isDestroyed)&&g.chain().focus().insertTable({rows:t,cols:e,withHeaderRow:u}).run()},k=[];for(let e=1;e<=l;e+=1)for(let t=1;t<=c;t+=1){let n=t<=x.columns&&e<=x.rows;k.push((0,q.jsx)(de,{"data-active":n||void 0,"aria-label":h.labels.tableInsertLabel(t,e),onMouseEnter:()=>S({columns:t,rows:e}),onFocus:()=>S({columns:t,rows:e}),onClick:()=>ee(t,e),...h.getStyles(`tableInsertCell`,_)},`${e}-${t}`))}return(0,q.jsxs)(F,{trapFocus:!0,shadow:`md`,position:`bottom-end`,...d,opened:v,onChange:e=>!e&&O(),children:[(0,q.jsx)(F.Target,{children:(0,q.jsx)(ka,{icon:s||Cs,...m,"aria-label":h.labels.tableInsertControlLabel,title:h.labels.tableInsertControlLabel,active:v,disabled:w,onClick:e=>{p?.(e),!e.defaultPrevented&&(v?O():y())},classNames:E,styles:D,className:r,style:i,variant:h.variant})}),(0,q.jsxs)(F.Dropdown,{...h.getStyles(`tableInsertDropdown`,_),children:[(0,q.jsx)(`div`,{...h.getStyles(`tableInsertGrid`,_),style:{...h.getStyles(`tableInsertGrid`,_).style,"--rte-table-insert-columns":c},onMouseLeave:()=>S({columns:0,rows:0}),children:k}),(0,q.jsx)(`div`,{...h.getStyles(`tableInsertLabel`,_),children:x.columns>0?`${x.columns} Ã ${x.rows}`:h.labels.tableInsertControlLabel})]})]})});ws.classes=Zr,ws.displayName=`@mantine/tiptap/RichTextEditorTableInsertControl`;function Ts(e){let{editor:t,labels:n}=ei(),r=n.detailsControlLabel,i=sa({editor:t??null,selector:()=>{let e=t&&!t.isDestroyed?t:null;if(!e)return{active:!1,disabled:!0};let n=e.can(),r=!!n.setDetails?.(),i=!!n.unsetDetails?.();return{active:i,disabled:!r&&!i}}}),a=i?.active??!1,o=e.disabled||(i?.disabled??!0);return(0,q.jsx)(ka,{"aria-label":r,title:r,icon:e.icon||Eo,...e,active:a,disabled:o,onClick:n=>{if(e.onClick?.(n),n.defaultPrevented||!t||t.isDestroyed)return;let r=t.chain().focus();t.can().unsetDetails?.()?r.unsetDetails().run():r.setDetails().run()}})}Ts.displayName=`@mantine/tiptap/RichTextEditorDetailsControl`;function Es(e){let{editor:t,labels:n}=ei(),r=n.invisibleCharactersControlLabel,i=sa({editor:t??null,selector:()=>{let e=t&&!t.isDestroyed?t:null;if(!e)return{active:!1,disabled:!0};let n=!!e.can().toggleInvisibleCharacters?.();return{active:!!e.storage.invisibleCharacters?.visibility?.(),disabled:!n}}}),a=i?.active??!1,o=e.disabled||(i?.disabled??!0);return(0,q.jsx)(ka,{"aria-label":r,title:r,icon:e.icon||Do,...e,active:a,disabled:o,onClick:n=>{e.onClick?.(n),!(n.defaultPrevented||!t||t.isDestroyed)&&t.chain().focus().toggleInvisibleCharacters().run()}})}Es.displayName=`@mantine/tiptap/RichTextEditorInvisibleCharactersControl`;var Ds=L(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,variant:o,...s}=T(`RichTextEditorControlsGroup`,null,e),c=ei();return(0,q.jsx)(R,{variant:o||c.variant,...c.getStyles(`controlsGroup`,{className:n,style:r,styles:i,classNames:t}),...s})});Ds.classes=Zr,Ds.displayName=`@mantine/tiptap/RichTextEditorControlsGroup`;var Os=L(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,sticky:o,stickyOffset:s,mod:c,variant:l,...u}=T(`RichTextEditorToolbar`,null,e),d=ei();return(0,q.jsx)(R,{mod:[{sticky:o},c],variant:l||d.variant,...d.getStyles(`toolbar`,{className:n,style:r,styles:i,classNames:t}),...u,__vars:{"--rte-sticky-offset":z(s)}})});Os.classes=Zr,Os.displayName=`@mantine/tiptap/RichTextEditorToolbar`;var ks={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:`default`},X=L(e=>{let t=T(`RichTextEditor`,ks,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,editor:c,withCodeHighlightStyles:l,withTypographyStyles:u,onSourceCodeTextSwitch:d,labels:f,children:p,variant:m,attributes:h,...g}=t,_=te({name:`RichTextEditor`,classes:Zr,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,vars:s}),v=(0,K.useMemo)(()=>({...Qr,...f}),[f]);return(0,q.jsx)($r,{value:{editor:c,getStyles:_,labels:v,withCodeHighlightStyles:l,withTypographyStyles:u,onSourceCodeTextSwitch:d,unstyled:o,variant:m},children:(0,q.jsx)(R,{..._(`root`),...g,children:p})})});X.classes=Zr,X.displayName=`@mantine/tiptap/RichTextEditor`,X.Content=Ea,X.Control=Oa,X.Toolbar=Os,X.ControlsGroup=Ds,X.Bold=Oo,X.Italic=ko,X.Strikethrough=jo,X.Underline=Ao,X.ClearFormatting=
3Mo,X.H1=Io,X.H2=Lo,X.H3=Ro,X.H4=zo,X.H5=Bo,X.H6=Vo,X.BulletList=Po,X.OrderedList=Fo,X.Link=_s,X.Unlink=No,X.Blockquote=Ho,X.AlignLeft=Uo,X.AlignRight=Wo,X.AlignCenter=Go,X.AlignJustify=Ko,X.Superscript=Jo,X.Subscript=qo,X.Code=Yo,X.CodeBlock=Xo,X.ColorPicker=vs,X.Color=ys,X.Highlight=Zo,X.Hr=Qo,X.UnsetColor=$o,X.Undo=es,X.Redo=ts,X.TaskList=ns,X.TaskListSink=rs,X.TaskListLift=is,X.SourceCode=xs,X.TableInsert=ws,X.TableDelete=as,X.TableColumnBefore=os,X.TableColumnAfter=ss,X.TableColumnDelete=cs,X.TableRowBefore=ls,X.TableRowAfter=us,X.TableRowDelete=ds,X.TableToggleHeaderRow=fs,X.TableToggleHeaderColumn=ps,X.TableMergeCells=ms,X.TableSplitCell=hs,X.Details=Ts,X.InvisibleCharacters=Es;var Z=e(x(),1);function As(e=``){return e.match(/CUSTOM.SQL/i)?U.CustomSql:e.match(/FRESHNESS/i)?U.Freshness:e.match(/VOLUME/i)?U.Volume:e.match(/TABLE.METRIC/i)?U.TableMetric:e.match(/CATEGORIES/i)?U.Categories:e.match(/^STATS/i)?U.Stats:e.match(/^JSON.SCHEMA/i)?U.JsonSchema:e.match(/^QUERY.PERF/i)?U.QueryPerf:e.match(/VALIDATION/i)?U.Validation:null}function js(e){return e?.isTemplateManaged}function Ms(e){let t=e.toUpperCase();return Ot[t]?.displayName??e}var Q=function(e){return e.StartHandle=`start-handle`,e.EndHandle=`end-handle`,e.LegendOutsideSymbol=`legend-outside-symbol`,e.LegendOutsideText=`legend-outside-text`,e.LegendInsideSymbol=`legend-inside-symbol`,e.LegendInsideText=`legend-inside-text`,e.LegendThresholdSymbol=`legend-threshold-symbol`,e.LegendThresholdText=`legend-threshold-text`,e.VariationMenuContainer=`variation-menu-container`,e.VariationMenuText=`variation-menu-text`,e.VariationMenuRadio1=`variation-menu-radio-1`,e.VariationMenuRadioText1=`variation-menu-radio-text-1`,e.VariationMenuRadio2=`variation-menu-radio-2`,e.VariationMenuRadioText2=`variation-menu-radio-text-2`,e.VariationMenuRadioCheck=`variation-menu-radio-check`,e.VariationMenuDelete=`variation-menu-delete`,e}({}),Ns=[3,0,0,3],Ps=[0,3,3,0],Fs=`rgba(0, 0, 0, 0)`,Is=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAATElEQVR4nI3KMQ6AIBAF0e/9D8QNpOckkEg9FiRGBXZ3mmneASCn1qVcJOFUL0jnuInfEAz8h1u8gku8gxO24Ad78MERCKAoBFAUAtzr0bbcUndtKQAAAABJRU5ErkJggg==`;function Ls(e){if(!(typeof e==`object`&&e&&`timestamp`in e&&`value`in e&&Array.isArray(e.value)&&typeof e.value[0]==`number`&&typeof e.value[1]==`number`))throw Error(`Invalid Series Datum`)}function Rs(e){if(!(typeof e==`object`&&e&&`timestamp`in e&&`value`in e&&Array.isArray(e.value)&&typeof e.value[0]==`number`&&typeof e.value[1]==`number`&&typeof e.value[2]==`number`))throw Error(`Invalid Size Series Datum`)}function zs(e){if(!(typeof e==`object`&&e&&`timestamp`in e&&`value`in e&&Array.isArray(e.value)&&typeof e.value[0]==`number`&&typeof e.value[1]==`number`&&typeof e.value[2]==`number`))throw Error(`Invalid Freshness Series Datum`)}function Bs(e){if(!(typeof e==`object`&&e&&`timestamp`in e&&`value`in e&&Array.isArray(e.value)&&typeof e.value[0]==`number`&&typeof e.value[1]==`number`&&typeof e.value[2]==`number`))throw Error(`Invalid UCS Series Datum`)}function Vs(e){if(!(typeof e==`object`&&e&&`timestamp`in e&&`value`in e&&Array.isArray(e.value)&&typeof e.value[0]==`number`&&typeof e.value[1]==`number`&&typeof e.value[2]==`number`))throw Error(`Invalid Metric Series Datum`)}function Hs(e){if(!(typeof e==`object`&&e&&`prData`in e&&`coords`in e))throw Error(`Invalid Github PR Series Datum`)}function Us(){return{decal:{symbolSize:1,symbolKeepAspect:!0,dashArrayX:[1,5],dashArrayY:[1,0],rotation:Math.PI/180*45,color:kn[0],backgroundColor:kn[1]}}}function Ws({params:e,type:t,isEditingTrainingWindows:n,anomalyTimestampSet:r,seriesDataLength:i,showUnchangedDataPoints:a}){let o=e.data;if(t===`custom-rule`)return Ls(o),i===1||n?8:0;let s;t===`metric`?(s=Ft.indexOf(`change`),Vs(o)):(s=qt.indexOf(`sizeChange`),Rs(o));let c=o.value[s]===0,l=r?.has(o.timestamp);return n&&l||i===1?8:c?a?4:0:n?8:4}var Gs=40,Ks=400;function $({marker:e,title:t,text:n,bold:r,dimmed:i,align:a}){let o=!!t;return(0,q.jsxs)(P,{gap:o?`xs`:4,wrap:`nowrap`,align:a,children:[(o||!!e)&&(0,q.jsxs)(P,{gap:`xxs`,wrap:`nowrap`,children:[e,o&&(0,q.jsx)(O,{truncate:!0,inline:!0,size:`xs`,miw:Gs,maw:Ks,children:t})]}),typeof n==`string`?(0,q.jsx)(O,{inline:!0,size:`xs`,fw:r?`bold`:void 0,c:i?`dimmed`:void 0,children:n}):n]})}function qs({forceUtcTimezone:e,type:t,...n}){let r=nn(e),i=S(n.start),a=S(n.end),o=gn({seconds:a.diff(i,`seconds`)});return(0,q.jsxs)(D,{gap:`sm`,children:[t===`global`&&(0,q.jsx)($,{text:`Global exclusion window`,dimmed:!0}),t===`training`&&(0,q.jsx)($,{text:`Training exclusion window`,dimmed:!0}),(0,q.jsx)($,{title:`Duration`,text:o,bold:!0}),(0,q.jsx)($,{title:`From`,text:B(i,r)}),(0,q.jsx)($,{title:`To`,text:B(a,r)})]})}function Js(e){return N()===`dark`?e.dark:e.light}function Ys(e){return localStorage&&localStorage.getItem(`mantine-color-scheme-value`)===`dark`?e.dark:e.light}function Xs(e){let t=[];for(let[n,[r,i]]of e)t.push([{xAxis:r,value:`${n}`},{xAxis:i,value:`${n}`}]);return t}function Zs(e){let t=new Map;if(!Array.isArray(e?.markArea?.data))return t;for(let n of e.markArea.data){if(!Array.isArray(n))continue;let e=n[0]?.value,r=n[0]?.xAxis,i=n[1]?.xAxis;typeof e==`string`&&typeof r==`number`&&typeof i==`number`&&t.set(e,[r,i])}return t}function Qs(e,t){for(let[n,r]of t.values())if(e>=Math.min(n,r)&&e<=Math.max(n,r))return!0;return!1}function $s(e){return e.length===2}function ec({primarySeries:e,anomalySeries:t,globalExclusionWindows:n,anomalyTimestamps:r,windows:i,restore:a}){let o=new Set;for(let e of t?.markPoint?.data??[])typeof e.xAxis==`number`&&($e(e.name)?.isFalsePositive||o.add(e.xAxis));for(let n of t?.markArea?.data??[]){if(!Array.isArray(n)||n.length!==2)continue;let t=n[0].xAxis;if(typeof t==`number`&&!$e(n[0].name)?.isFalsePositive){o.add(t);let n=e[0].data,r=n.findIndex(e=>e.timestamp===t);r>-1&&typeof n[r+1]?.timestamp==`number`&&o.add(n[r+1].timestamp)}}for(let e of r??[])o.add(e);let s=e=>Qs(e,i)||Qs(e,n)||o.has(e)?Bn:jt,c=e[0].data.map(e=>({...e,itemStyle:a?{}:{color:s(e.timestamp)}}));if($s(e))return[{id:e[0].id,name:e[0].name,data:c},{id:e[1].id,name:e[1].name,data:c}];let l=`${e[0].id}`,u;return u=l.includes(`metric`)?`metric`:l.includes(`custom-rule`)?`custom-rule`:`size`,[{id:l,name:e[0].name,symbolSize:(e,t)=>
3Ws({params:t,type:u,isEditingTrainingWindows:!a,anomalyTimestampSet:o,seriesDataLength:c.length}),data:c}]}function tc({windows:e,withDecalBackground:t,withEmphasis:n,forceUtcTimezone:r}){let i={color:Qt,borderColor:Yt,borderWidth:1};t&&(i.borderWidth=0,i.color={image:Is,repeat:`repeat`});let a={disabled:!0};return n&&(a={disabled:!1,label:{show:!0,formatter:`Click to delete`,color:`rgb(100, 100, 100)`,fontSize:12}}),{name:rn,windows:Object.fromEntries(e),markArea:{itemStyle:i,emphasis:a,label:{show:!1},data:Xs(e),tooltip:{trigger:`item`,formatter:e=>{let{data:t}=e;return Dt((0,q.jsx)(_e,{children:(0,q.jsx)(qs,{start:t.coord[0][0],end:t.coord[1][0],forceUtcTimezone:r,type:`training`})}))}}}}}function nc({chartWidth:e,isTimeBased:t,isThresholdSelected:n,restore:r}){let i=!t;if(r){let e=[{id:Q.LegendOutsideSymbol,$action:`remove`},{id:Q.LegendOutsideText,$action:`remove`},{id:Q.LegendInsideSymbol,$action:`remove`},{id:Q.LegendInsideText,$action:`remove`}];return i&&e.push({id:Q.LegendThresholdSymbol,$action:`remove`},{id:Q.LegendThresholdText,$action:`remove`}),e}let a=`#444`,o=`#ccc`,s=245;i&&(s+=115);let c=e/2-s/2,l=[{id:Q.LegendOutsideSymbol,...t?{type:`rect`,rotation:Math.PI/4,originX:c,originY:14,shape:{x:c,y:14,width:12,height:12},style:{fill:jt}}:{type:`circle`,shape:{cx:c+8,cy:14,r:8},style:{fill:`transparent`,stroke:jt,lineWidth:2}}},{id:Q.LegendOutsideText,type:`text`,left:c+16+6,top:8,style:{text:`Used in training`,fill:a,fontSize:12}},{id:Q.LegendInsideSymbol,...t?{type:`rect`,rotation:Math.PI/4,originX:c+110+16,originY:14,shape:{x:c+110+16,y:14,width:12,height:12},style:{fill:Bn}}:{type:`circle`,shape:{cx:c+110+16+8,cy:14,r:8},style:{fill:`transparent`,stroke:Bn,lineWidth:2}}},{id:Q.LegendInsideText,type:`text`,left:c+110+16+16+6,top:8,style:{text:`Excluded from training`,fill:a,fontSize:12}}];return i&&l.push({id:Q.LegendThresholdSymbol,type:`rect`,shape:{x:c+110+16+135+16,y:6,width:10,height:10},style:{fill:n?Ys(It):o,lineWidth:0}},{id:Q.LegendThresholdText,type:`text`,left:c+110+16+135+16+10+6,top:8,style:{text:`Threshold`,fill:n?a:o,fontSize:12}}),l}function rc({startPx:e,endPx:t,windowId:n,drawAreaRect:r}){return[{id:`${Q.StartHandle}.${n}`,type:`rect`,shape:{x:e-3,y:r.y,width:3,height:r.height,r:Ns},style:{fill:Yt,lineWidth:0}},{id:`${Q.EndHandle}.${n}`,type:`rect`,shape:{x:t,y:r.y,width:3,height:r.height,r:Ps},style:{fill:Yt,lineWidth:0}}]}function ic({x:e,drawAreaRect:t,variation:n,applyToVariation:r}){let i=e+5,a=t.y+5,o=i+20,s=i+36,c=i+64,l=a+44,u=a+38,d=a+66,f=a+60,p=a+90,m=he.black,h=he.colors.red[5],g=he.colors.gray[2],_=he.colors.blue[5],v=he.fontFamily,y=`All segments`,b=`Just this segment`;return n===`custom-rule-variables`&&(y=`All variables`,b=`Just these variables`),[{id:Q.VariationMenuContainer,type:`rect`,shape:{x:i,y:a,width:180,height:116,r:3},style:{fill:he.white,stroke:g,shadowBlur:10,shadowColor:`rgba(0, 0, 0, 0.1)`,shadowOffsetX:2,shadowOffsetY:2},z:100},{id:Q.VariationMenuText,type:`text`,left:i+15,top:a+14,style:{text:`Apply to:`,fill:m,fontSize:14,fontFamily:v},z:101},{id:Q.VariationMenuRadio1,type:`circle`,shape:{cx:o,cy:l,r:7},style:{fill:r?he.white:_,stroke:g,lineWidth:1,shadowBlur:5,shadowColor:`rgba(0, 0, 0, 0.1)`,shadowOffsetX:0,shadowOffsetY:0},z:101},{id:Q.VariationMenuRadioText1,type:`text`,left:s,top:u,style:{text:y,fill:m,fontSize:14,fontFamily:v},z:101},{id:Q.VariationMenuRadio2,type:`circle`,shape:{cx:o,cy:d,r:7},style:{fill:r?_:he.white,stroke:g,lineWidth:1,shadowBlur:5,shadowColor:`rgba(0, 0, 0, 0.1)`,shadowOffsetX:0,shadowOffsetY:0},z:101},{id:Q.VariationMenuRadioText2,type:`text`,left:s,top:f,style:{text:b,fill:m,fontSize:14,fontFamily:v},z:101},{id:Q.VariationMenuRadioCheck,type:`circle`,shape:{cx:o,cy:r?d:l,r:3},style:{fill:he.white,lineWidth:0},z:102},{id:Q.VariationMenuDelete,type:`text`,left:c,top:p,style:{text:`Delete`,fill:h,fontSize:14,fontFamily:v},z:101}]}function ac(e,t){if(!t?.[0]?.data?.some(t=>t?.name===e))return!1;let n=t[0].selected;return n&&e in n?!!n[e]:!0}function oc({timestamp:e,drawAreaRect:t,windows:n,currentWindowId:r,toPixelFn:i}){let a=t.x,o=t.width+t.x,s,c,l,u;for(let[t,[i,a]]of n){if(t===r)continue;let n=Math.min(i,a),o=Math.max(i,a);o<e&&(!l||o>l)&&(l=o,s=t),n>e&&(!u||n<u)&&(u=n,c=t)}if(s){let[e,t]=n.get(s);a=i(Math.max(e,t))+8}if(c){let[e,t]=n.get(c);o=i(Math.min(e,t))-8}return[a,o]}function sc(e,t){let n=[];for(let[r,[i,a,o]]of e.entries()){if(t.includes(r))continue;let e=Math.min(i,a),s=Math.max(i,a);r.startsWith(`new`)?n.push({action:`create`,start:e,end:s,applyToVariation:o}):n.push({action:`update`,id:Number(r),start:e,end:s,applyToVariation:o})}for(let e of t)n.push({action:`delete`,id:Number(e)});return n}var cc=class{#e;#t;#n;isEnabled=!1;#r;#i;#a;#o;#s;#c;#l;#u;#d=!1;#f=!1;#p;#m=!1;#h=new Map;#g=new Map;#_;#v=new Map;#y=[];#b;#x;#S;#C=!1;#w;#T;constructor(e){this.#e=e,this.#t=this.#e.getWidth()}enable(e){this.isEnabled=!0,this.#d=!1,this.#f=!1,this.#p=void 0,this.#m=!1,this.#b=void 0,this.#h=new Map,this.#g=new Map,this.#y=[],this.#n=this.#q(),this.#T=e,this.#_=this.#Y(Mn),this.#E();let t=this.#Y(rn),n=Object.entries(t?.windows??{});this.#h=new Map(n),this.#g=new Map(n),this.#v=Zs(this.#Y(Tn)),ac(`Pull request`,this.#e.getOption()?.legend)&&this.#e.dispatchAction({type:`legendUnSelect`,name:$t}),ac(`Anomaly`,this.#e.getOption()?.legend)&&this.#e.dispatchAction({type:`legendUnSelect`,name:Mn}),this.#e.dispatchAction({type:`legendSelect`,name:rn});let r=this.#J(),i=$s(r);this.#e.setOption({tooltip:{show:!1},legend:{show:!1},series:[...ec({primarySeries:r,windows:this.#h,anomalySeries:this.#_,globalExclusionWindows:this.#v,anomalyTimestamps:this.#T?.anomalyTimestamps}),tc({windows:this.#h,withEmphasis:!this.#T?.variation})],graphic:[...nc({chartWidth:this.#t,isTimeBased:i,isThresholdSelected:i?void 0:ac(Kt,this.#e.getOption()?.legend)}),...[...this.#h.entries()].flatMap(([e,[t,n]])=>rc({windowId:e,startPx:this.#R(Math.min(t,n)),endPx:this.#R(Math.max(t,n)),drawAreaRect:this.#n}))]})}disable(){this.isEnabled=!1,this.#D();let e=Array.from(this.#h.keys());this.#X(...e),this.#h=new Map(this.#g),this.#e.setOption({tooltip:{show:!0},legend:{show:!0},series:[...ec({primarySeries:this.#J(),windows:this.#h,anomalySeries:this.#_,globalExclusionWindows:this.#v,anomalyTimestamps:this.#T?.anomalyTimestamps,restore:!0}
3),tc({windows:this.#h,withDecalBackground:!0})],graphic:nc({restore:!0,isTimeBased:$s(this.#J())})})}#E(){this.#r=e=>this.#O(e),this.#e.getZr().on(`mousedown`,this.#r),this.#i=e=>this.#k(e),this.#e.getZr().on(`mousemove`,this.#i),this.#a=()=>this.#A(),this.#e.getZr().on(`mouseup`,this.#a),this.#o=()=>this.#j(),this.#e.on(`dataZoom`,this.#o),this.#s=e=>this.#M(e),this.#e.on(`click`,`series`,this.#s),this.#c=e=>this.#N(e),this.#e.getZr().on(`click`,this.#c),this.#l=e=>this.#P(e),this.#e.on(`mouseover`,`series`,this.#l),this.#u=e=>this.#F(e),this.#e.on(`mouseout`,`series`,this.#u)}#D(){this.#e.getZr().off(`mousedown`,this.#r),this.#r=void 0,this.#e.getZr().off(`mousemove`,this.#i),this.#i=void 0,this.#e.getZr().off(`mouseup`,this.#a),this.#a=void 0,this.#e.off(`dataZoom`,this.#o),this.#o=void 0,this.#e.off(`click`,this.#s),this.#s=void 0,this.#e.getZr().off(`click`,this.#c),this.#c=void 0,this.#e.off(`mouseover`,this.#l),this.#l=void 0,this.#e.off(`mouseout`,this.#u),this.#u=void 0}getWindowsPayload(){return sc(this.#h,this.#y)}#O(e){if(!this.#z(e)||this.#C)return;let t=this.#V(e);if(t.includes(`handle`)){this.#f=!0,this.#p=t.includes(Q.StartHandle)?`start`:`end`,this.#b=t.split(`.`)[1];return}if(!this.#B(e.offsetX))return;this.#d=!0,this.#b=`new-${Hn()}`;let n=this.#L(e.offsetX);this.#h.set(this.#b,[n,n]),this.#e.setOption({series:[...ec({primarySeries:this.#J(),anomalySeries:this.#_,globalExclusionWindows:this.#v,anomalyTimestamps:this.#T?.anomalyTimestamps,windows:this.#h}),tc({windows:this.#h,withEmphasis:!this.#T?.variation})],graphic:rc({windowId:this.#b,startPx:e.offsetX,endPx:e.offsetX,drawAreaRect:this.#n})})}#k(e){if(this.#I(e),this.#z(e)){if(this.#T?.variation){let t=this.#C;this.#C=this.#V(e,!0).startsWith(`variation-menu`),t&&!this.#C&&(this.#x||(clearTimeout(this.#w),this.#w=setTimeout(()=>{!this.#C&&!this.#x&&this.#Q()},10))),!t&&this.#C&&clearTimeout(this.#w)}if(this.#b&&(this.#f||this.#d)){let[t,n,r]=this.#h.get(this.#b),[i,a]=oc({timestamp:t,windows:this.#h,currentWindowId:this.#b,toPixelFn:this.#R.bind(this),drawAreaRect:this.#n}),o=this.#d?e.offsetX<this.#R(t):t>n,s=(0,Z.clamp)(e.offsetX,i,a),c=this.#p===`start`?this.#L(s):t,l=this.#d||this.#p===`end`?this.#L(s):n;this.#h.set(this.#b,[c,l,r]),this.#e.setOption({series:[...ec({primarySeries:this.#J(),anomalySeries:this.#_,globalExclusionWindows:this.#v,anomalyTimestamps:this.#T?.anomalyTimestamps,windows:this.#h}),tc({windows:this.#h,withEmphasis:!this.#T?.variation})],graphic:[{id:`${Q.StartHandle}.${this.#b}`,shape:{x:this.#R(c)+(o?0:-3),r:o?Ps:Ns}},{id:`${Q.EndHandle}.${this.#b}`,shape:{x:this.#R(l)+(o?-3:0),r:o?Ns:Ps}}]})}}}#A(){if(this.#b){if(this.#f){this.#f=!1,this.#p=void 0,this.#b=void 0;return}if(this.#d){this.#d=!1;let[e,t]=this.#h.get(this.#b);e===t&&this.#X(this.#b),this.#b=void 0}}}#j(){for(let[e,[t,n]]of this.#h){let r=t>n,i=this.#R(t),a=this.#R(n),o=this.#n.x+3,s=this.#n.width+this.#n.x-3,c=i>o&&i<s,l=a>o&&a<s;this.#e.setOption({graphic:[{id:`${Q.StartHandle}.${e}`,shape:{x:i+(r?0:-3)},style:{fill:c?Yt:Fs}},{id:`${Q.EndHandle}.${e}`,shape:{x:a+(r?-3:0)},style:{fill:l?Yt:Fs}}]})}}#M(e){this.#H(e)&&!this.#T?.variation&&this.#X(`${e.value}`)}#N(e){if(this.#U(e)){let e=this.#e.getOption().series;Array.isArray(e)&&e.some(e=>e.name===`Threshold`)&&(this.#e.dispatchAction({type:`legendToggleSelect`,name:Kt}),this.#e.setOption({graphic:nc({chartWidth:this.#t,isTimeBased:!1,isThresholdSelected:ac(Kt,this.#e.getOption()?.legend)})}))}if(this.#S){if(this.#K(e)&&this.#X(this.#S),this.#W(e)){let e=this.#h.get(this.#S);if(e){let[t,n]=e;this.#h.set(this.#S,[t,n,!1]),this.#Z()}}if(this.#G(e)){let e=this.#h.get(this.#S);if(e){let[t,n]=e;this.#h.set(this.#S,[t,n,!0]),this.#Z()}}}}#P(e){if(this.#H(e)){let t=`${e.value}`;this.#x=t,this.#T?.variation&&!this.#S&&!this.#d&&!this.#f&&(this.#S=t,this.#Z())}}#F(e){this.#H(e)&&(this.#x=void 0,this.#T?.variation&&(clearTimeout(this.#w),this.#w=setTimeout(()=>{!this.#C&&!this.#x&&this.#Q()},10)))}#I(e){this.#z(e)?(this.#x&&!this.#T?.variation||this.#W(e)||this.#G(e)||this.#K(e)?this.#e.getZr().setCursorStyle(`pointer`):this.#V(e).includes(`handle`)?this.#e.getZr().setCursorStyle(`ew-resize`):this.#e.getZr().setCursorStyle(`crosshair`),this.#m||(this.#m=!0,this.#e.setOption({xAxis:{axisPointer:{show:!0}}}))):this.#U(e)?this.#e.getZr().setCursorStyle(`pointer`):(this.#e.getZr().setCursorStyle(`default`),this.#m&&=!1)}#L(e){return Math.floor(this.#e.convertFromPixel(`grid`,[e,0])[0])}#R(e){return this.#e.convertToPixel(`grid`,[e,0])[0]}#z(e){let{x:t,y:n,width:r,height:i}=this.#n;return e.offsetY>n&&e.offsetY<n+i&&e.offsetX>t&&e.offsetX<r+t}#B(e){let t=this.#L(e);for(let[e,n]of this.#h.values())if(t>Math.min(e,n)&&t<Math.max(e,n))return!1;return!0}#V(e,t=!1){return typeof e?.target?.id==`string`?`${e.target.id}
3`:t&&typeof e?.target?.parent?.id==`string`?`${e?.target?.parent?.id}`:``}#H(e){return e.seriesName===`Training window`&&e.componentType===`markArea`&&this.#h.has(`${e.value}`)}#U(e){return[Q.LegendThresholdText,Q.LegendThresholdSymbol].includes(this.#V(e,!0))}#W(e){return[Q.VariationMenuRadio1,Q.VariationMenuRadioText1].includes(this.#V(e,!0))}#G(e){return[Q.VariationMenuRadio2,Q.VariationMenuRadioText2].includes(this.#V(e,!0))}#K(e){return this.#V(e,!0)===Q.VariationMenuDelete}#q(){let e=this.#e?.getModel()?.getComponent(`grid`)?.coordinateSystem?.getRect();if(!e)throw Error(`Could not determine draw area coordinates`);return e}#J(){let e=this.#e.getOption().series;if(!Array.isArray(e)||e.length===0)throw Error(`Primary series not found`);return e.filter(e=>typeof e.id==`string`&&e.id.startsWith(`primary-series`))}#Y(e){let t=this.#e.getOption().series;return Array.isArray(t)?t.find(t=>t.name===e):void 0}#X(...e){let t=[];for(let n of e)n.startsWith(`new`)||this.#y.push(n),this.#h.delete(n),t.push({id:`${Q.StartHandle}.${n}`,$action:`remove`},{id:`${Q.EndHandle}.${n}`,$action:`remove`});this.#e.setOption({series:[...ec({primarySeries:this.#J(),anomalySeries:this.#_,globalExclusionWindows:this.#v,anomalyTimestamps:this.#T?.anomalyTimestamps,windows:this.#h}),tc({windows:this.#h,withEmphasis:!this.#T?.variation})],graphic:t}),this.#x=void 0,this.#Q()}#Z(){if(!this.#T?.variation)throw Error(`variation param not found`);if(!this.#S)throw Error(`variationMenuWindowId must be set`);let e=this.#h.get(this.#S);if(!e)return;let[t,n,r]=e,i=this.#R(Math.min(t,n));this.#e.setOption({graphic:ic({x:i,drawAreaRect:this.#n,variation:this.#T.variation,applyToVariation:r})})}#Q(){this.#S&&=(this.#e.setOption({graphic:[Q.VariationMenuContainer,Q.VariationMenuText,Q.VariationMenuRadio1,Q.VariationMenuRadioText1,Q.VariationMenuRadio2,Q.VariationMenuRadioText2,Q.VariationMenuRadioCheck,Q.VariationMenuDelete].map(e=>({id:e,$action:`remove`}))}),void 0)}},lc=function(e){return e.SLIDER=`slider`,e.CLICK_AND_DRAG=`click-and-drag`,e.NONE=`none`,e}({}),uc=10,dc=35,fc=14,pc=40;function mc(e){return e===!1?uc:dc}function hc(e){return uc+(e.timeAxisLabel?fc:0)+(e.zoomPattern===lc.SLIDER?pc:0)}function gc(e){return{top:mc(e.showLegends),left:10,right:20,bottom:hc(e),containLabel:!0}}function _c({zoomPattern:e,data:t}){if(e!==lc.SLIDER)return;let n=t?.[0]?.metrics?.length===1,r=t?.[0]?.variables?.metricName===`last_updated_on`&&Array.isArray(t?.[0]?.metrics)&&t[0].metrics.length!==(0,Z.uniqBy)(t[0].metrics,e=>e.value).length;return{showDataShadow:!n&&!r,left:45,right:52,realtime:!0,start:0,end:100,labelFormatter:e=>Wn(e)}}function vc({metricName:e,startTime:t,endTime:n,timeAxisLabel:r,forceUtcTimezone:i}){let a=S(t).valueOf(),o=S(n).valueOf();return[{type:`time`,min:a,max:o,axisLabel:{hideOverlap:!0,showMinLabel:!0,showMaxLabel:!1,formatter:e=>Wn(e,i)},name:r||void 0,nameLocation:`middle`,nameTextStyle:{fontWeight:500,fontSize:12},nameGap:22,splitLine:{show:ln(e)}},{type:`time`,min:a,max:o,show:!1,silent:!0,axisPointer:{show:!1}}]}var yc=Un(`,.2~f`),bc=Un(`.4~r`),xc=Un(`.4~s`),Sc=Un(`,.4~f`),Cc=Un(`,.6~f`),wc=Un(`.2~s`),Tc=Un(`.2e`),Ec=e=>yc(e)+`%`,Dc=e=>Sc(e)+`%`,Oc=e=>Cc(e)+`%`,kc=e=>bc(e)+`%`;function Ac(e,t){let n=Math.abs(e);return t?n>=99.99&&n<100?Dc(e):n>=.01?Ec(e):n>=1e-4?Dc(e):n>0?Oc(e):kc(e):n<1e3?yc(e):n<1e6?xc(e).replace(`G`,`B`):n<1e8?wc(e).replace(`G`,`B`):Tc(e)}function jc(e,t){if(typeof e!=`number`)return`NA`;let n=Math.abs(e);return t?n>=99.99&&n<100?Dc(e):n>=.01?Ec(e):n<.01&&n>=1e-4?Dc(e):n<1e-4&&n>0?Oc(e):e+`%`:Cc(e)}var Mc=.1;function Nc({min:e,max:t},n){let r=t-e,i=r>0?r*Mc:Math.max(Math.abs(t)*.05,n?1:.5),a=e-i,o=t+i;return n?{min:Math.floor(a),max:Math.ceil(o)}:{min:a,max:o}}function Pc(e,t){let n=t!==void 0&&un(t),r=1/0,i=-1/0;for(let{metrics:t}of e)for(let e=0;e<t.length;e++){let a=t[e]?.value;if(typeof a!=`number`||!Number.isFinite(a))continue;let o=n?Mt(a,t[e-1]?.value):a;Number.isFinite(o)&&(r=Math.min(r,o),i=Math.max(i,o))}return Number.isFinite(r)&&Number.isFinite(i)?{min:r,max:i}:void 0}function Fc(e,t,n){switch(e){case`row_count`:case`row_count_change`:case`total_row_count`:case`total_row_count_change`:case`objects_deleted`:return{formatter:e=>Math.abs(e)<1e3?kt(e):an(e).replace(`G`,`B`)};case`write_throughput`:case`total_byte_count`:case`total_byte_count_change`:return{formatter:e=>an(e)+`Bs`};default:return{formatter:r=>{let i=t??(!n&&En(e)),a=i||n;return Ac(n?r:r*(i?100:1),a)}}}}var Ic=[`row_count`,`row_count_change`,`total_row_count`,`total_row_count_change`,`objects_deleted`];function Lc({metricName:e,auxiliaryMetricName:t,metricIsPercentage:n,metricValuesAreAlreadyPercent:r,isCustomRule:i,dataExtent:a,hideValueAxis:o}){let s={show:!1,type:`value`,min:Sn[0],max:Sn[1]}
3,c=t?{type:`value`,position:`right`,scale:!0,minInterval:Ic.includes(t)?1:void 0,axisLabel:Fc(t),splitLine:{show:!1}}:void 0;if(ln(e))return[s,s,...c?[c]:[]];let l=r||(n??(!r&&En(e))),u=Ic.includes(e)||!!(i&&!l),d=a?Nc(a,u):void 0;return[{type:`value`,scale:!0,min:d?.min,max:d?.max,minInterval:u?1:void 0,axisLabel:o?{show:!1}:Fc(e,n,r),splitLine:{show:!o}},s,...c?[c]:[]]}function Rc(e,t){return e===H.QueryPerformanceAnom&&t?.config?.metadata?.query_type?.toLowerCase()===lt.Read.toLowerCase()}var zc=e=>{let t={indexedFieldFilters:[...(e.config.metadata.indexed_field_filters||[]).map(e=>({fieldName:e?.field_name,operator:e?.operator?.toUpperCase(),values:e?.values})),{fieldName:`query`,operator:mt.Include,values:[e.group_hash]}],endTime:S(e.query_timestamp).endOf(`day`).toISOString(),startTime:S(e.query_timestamp).subtract(4,`weeks`).startOf(`day`).toISOString()},n=new URLSearchParams;return n.set(`tab`,`write`),n.set(`selectedResourceId`,e.group_hash),qn({searchCriteria:t},n)},Bc=[H.CustomRuleAnom,H.DeleteTable,H.FreshAnom,H.JsonSchemaChange,H.MetricAnom,H.SchemaChange,H.SizeAnom,H.UnchangedSizeAnom,H.SizeDiff,H.DistAnom,H.DbtModelError,H.DbtTestFailure,H.AirflowDagFailure,H.QueryPerformanceAnom,H.ComparisonRuleAnom],Vc=[H.IncidentOwnerUpdate,H.IncidentSeverityUpdate,H.DeclaredIncidentSeverityUpdate,H.IncidentStatusUpdate,H.Comment,H.IncidentSplit,H.IncidentNameUpdate,H.IncidentMerge,H.IncidentDetectorFeedback,H.SloBreach],Hc=[H.FreshAnom,H.UnchangedSizeAnom,H.SizeDiff,H.SchemaChange],Uc=(e,t,n)=>{let r=e?.eventType===H.CustomRuleAnom,i=e?.eventType===H.MetricAnom,a=e?.eventType===H.AirflowDagFailure;return e&&Rc(e.eventType,Gc(e))||i&&n?``:(!r&&!a||e?.table)&&e?.table?.mcon?St(e?.table?.mcon??``):``},Wc=e=>`/assets/${Ct(e)}/`;function Gc(e){if(!e)return{};try{let t=JSON.parse(e.data?.toString()||``)||{},n=t.monitor_uuid??t.events?.[0]?.monitor_uuid??t.rule?.uuid;return{...t,monitorUUID:n}}catch{return{}}}var Kc=e=>e?.rule?.job_execution_uuid??e?.hits?.[0]?.job_execution_uuid,qc=e=>e?.rcaJobs?.find?.(e=>e.jobType===ft.SqlRuleCustomSampling);function Jc({children:e}){return(0,q.jsx)(Ge,{justify:`center`,align:`center`,w:16,children:e})}function Yc({rounded:e}){return(0,q.jsx)(Jc,{children:(0,q.jsx)(R,{w:10,h:10,bg:xn,style:{borderRadius:e?`50%`:0}})})}function Xc({borderColor:e=Yt}){return(0,q.jsx)(Jc,{children:(0,q.jsx)(R,{w:12,h:12,bg:`transparent`,style:{border:`2px solid ${e}`,borderRadius:`50%`}})})}function Zc({metricName:e,metricIsPercentage:t,event:n}){let r=Gc(n);if(n.eventType===H.CustomRuleAnom||n.eventType===H.ValidationAnom||n.eventType===H.AgentTrajectoryAnom||n.eventType===H.AgentValidationAnom)return r?.hits?.[0].value??void 0;if(n.eventType===H.SizeDiff){let t=[e,r.metric],n=t.includes(`total_row_count_change`)||t.includes(`total_byte_count_change`)||t.includes(`write_throughput`)?`dsize`:`size`;if(typeof r[n]!=`number`){console.error(`${n} in event data for SIZE_DIFF event is not a number`);return}return r[n]}if([H.MetricAnom,H.AgentAnom,H.AgentEvaluationAnom,H.AgentMetricAnom].includes(n.eventType)){if(typeof r.value!=`number`){console.error(`value in event data for METRIC_ANOM event is not a number`);return}let n=t??En(e);return r.value/(n?100:1)}}function Qc(e,t=!0){let{lowerThreshold:n,upperThreshold:r,metric:i,comparisonOperator:a,autoOperator:o}=e,s=vn(i);if((0,Z.isNil)(n)&&(0,Z.isNil)(r))return null;if((0,Z.isNil)(a)&&o){if(o===ct.AutoHigh&&typeof r==`number`)return i===`time_since_last_row_count_change`?`at or above ${s(r)}`:`above ${s(r)}`;if(o===ct.AutoLow&&typeof n==`number`)return`below ${s(n)}`}let c=a;c===null&&(c=ln(i)?at.Gt:at.OutsideRange);let l=`${Ht(c,t)} `;if(!(0,Z.isNil)(n)&&!(0,Z.isNil)(r))return r===n?c===at.OutsideRange?`not equal to ${s(r)}`:`${l}${s(r)}`:`${l}${s(n)} and ${s(r)}`;let u=r??n;return(0,Z.isNil)(u)?null:`${l}${s(u)}`}function $c(e){let{value:t,metric:n}=e,r=`${An[n]??`Value`} is ${vn(n)(t)}`,i=Qc(e,!1);return i===null?`${r}, thresholds not available`:`${r} (${i})`}var el=`data-tooltip-action`,tl=`data-tooltip-action-payload`;function nl(e){let t=t=>{let{actionName:n,actionPayload:r,...i}=t,a={[el]:n,[tl]:r?JSON.stringify(r):``};return(0,q.jsx)(e,{...i,...a}
3)};return t.displayName=`withTooltipAction(${e.displayName||e.name||`Component`})`,t}var rl=nl(M),il={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getEvent`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`uuid`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`UUID`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getEvent`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`uuid`},value:{kind:`Variable`,name:{kind:`Name`,value:`uuid`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`mcSql`}},{kind:`Field`,name:{kind:`Name`,value:`sourceSql`}},{kind:`Field`,name:{kind:`Name`,value:`uuid`}},{kind:`Field`,name:{kind:`Name`,value:`description`}},{kind:`Field`,name:{kind:`Name`,value:`eventGeneratedTime`}},{kind:`Field`,name:{kind:`Name`,value:`createdTime`}},{kind:`Field`,name:{kind:`Name`,value:`eventType`}},{kind:`Field`,name:{kind:`Name`,value:`data`}},{kind:`Field`,name:{kind:`Name`,value:`isChild`}},{kind:`Field`,name:{kind:`Name`,value:`ackTimestamp`}},{kind:`Field`,name:{kind:`Name`,value:`eventState`}},{kind:`Field`,name:{kind:`Name`,value:`totalComments`}},{kind:`Field`,name:{kind:`Name`,value:`hasSampling`}},{kind:`Field`,name:{kind:`Name`,value:`hasAlertSample`}},{kind:`Field`,name:{kind:`Name`,value:`hasAlertSampleExplanation`}},{kind:`Field`,name:{kind:`Name`,value:`monitorId`}},{kind:`Field`,name:{kind:`Name`,value:`parentMonitorId`}},{kind:`Field`,name:{kind:`Name`,value:`agentSpanFilters`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`agent`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`value`}}]}},{kind:`Field`,name:{kind:`Name`,value:`spanName`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`value`}}]}},{kind:`Field`,name:{kind:`Name`,value:`task`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`value`}}]}},{kind:`Field`,name:{kind:`Name`,value:`workflow`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`value`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`hasReproductionQueries`}},{kind:`Field`,name:{kind:`Name`,value:`anomaly`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`startTime`}},{kind:`Field`,name:{kind:`Name`,value:`endTime`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}},{kind:`Field`,name:{kind:`Name`,value:`isActive`}}]}},{kind:`Field`,name:{kind:`Name`,value:`detectorFeedback`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isFalsePositive`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`incident`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`uuid`}}]}},{kind:`Field`,name:{kind:`Name`,value:`alert`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`uuid`}}]}},{kind:`Field`,name:{kind:`Name`,value:`warehouse`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`uuid`}},{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`dataSamplingEnabled`}},{kind:`Field`,name:{kind:`Name`,value:`supportsReproductionQueries`}},{kind:`Field`,name:{kind:`Name`,value:`supportsSampling`}},{kind:`Field`,name:{kind:`Name`,value:`connectionType`}}]}},{kind:`Field`,name:{kind:`Name`,value:`table`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`mcon`}},{kind:`Field`,name:{kind:`Name`,value:`fullTableId`}},{kind:`Field`,name:{kind:`Name`,value:`projectName`}}
3,{kind:`Field`,name:{kind:`Name`,value:`dataset`}},{kind:`Field`,name:{kind:`Name`,value:`tableId`}},{kind:`Field`,name:{kind:`Name`,value:`createdTime`}},{kind:`Field`,name:{kind:`Name`,value:`tableType`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`isMuted`}},{kind:`Field`,name:{kind:`Name`,value:`mutedEventTypes`}},{kind:`Field`,name:{kind:`Name`,value:`tableCapabilities`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`supportsFreshnessWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsRowsWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsTotalRowCountChangeWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsBytesWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsWriteThroughputWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsObjectsDeletedWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsVolumeSloWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsVolumeWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsQueryLogsWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsDeltaLogsWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsLineageWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsLineagePipelineWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsFieldLineageWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsDynamicScheduleWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsSchemaWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsStatsMonitorWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsCategoriesMonitorWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`N
3ame`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsHourlyStatsMonitorWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsJsonSchemaMonitorWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsFreshnessSloWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsCustomSqlRuleWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`supportsFieldQualityRuleWithReason`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isSupported`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}},{kind:`Field`,name:{kind:`Name`,value:`hasFreshness`}},{kind:`Field`,name:{kind:`Name`,value:`hasRows`}},{kind:`Field`,name:{kind:`Name`,value:`hasBytes`}},{kind:`Field`,name:{kind:`Name`,value:`hasTotalRowCountChange`}},{kind:`Field`,name:{kind:`Name`,value:`hasObjectsDeleted`}},{kind:`Field`,name:{kind:`Name`,value:`hasWriteThroughput`}}]}},{kind:`Field`,name:{kind:`Name`,value:`warehouse`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`uuid`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`tableStats`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isImportant`}},{kind:`Field`,name:{kind:`Name`,value:`totalUsers`}},{kind:`Field`,name:{kind:`Name`,value:`avgReadsPerActiveDay`}},{kind:`Field`,name:{kind:`Name`,value:`avgWritesPerActiveDay`}},{kind:`Field`,name:{kind:`Name`,value:`degreeOut`}}]}},{kind:`Field`,name:{kind:`Name`,value:`rcaJobs`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`uuid`}},{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`jobType`}},{kind:`Field`,name:{kind:`Name`,value:`executionStats`}}]}},{kind:`Field`,name:{kind:`Name`,value:`evaluations`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`field`}},{kind:`Field`,name:{kind:`Name`,value:`function`}},{kind:`Field`,name:{kind:`Name`,value:`prompt`}},{kind:`Field`,name:{kind:`Name`,value:`outputType`}}]}}]}}]}}]},al={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`setEventDetectorFeedback`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`eventId`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`UUID`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`field`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`isFalsePositive`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`Boolean`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`metric`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`whereCondition`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`setEventDetectorFeedback`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`eventId`},value:{kind:`Variable`,name:{kind:`Name`,value:`eventId`}}},{kind:`Argument`,name:{kind:`Name`,value:`field`},value:{kind:`Variable`,name:{kind:`Name`,value:`field`}}},{kind:`Argument`,name:{kind:`Name`,value:`isFalsePositive`}
3,value:{kind:`Variable`,name:{kind:`Name`,value:`isFalsePositive`}}},{kind:`Argument`,name:{kind:`Name`,value:`metric`},value:{kind:`Variable`,name:{kind:`Name`,value:`metric`}}},{kind:`Argument`,name:{kind:`Name`,value:`whereCondition`},value:{kind:`Variable`,name:{kind:`Name`,value:`whereCondition`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`feedback`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`isFalsePositive`}}]}}]}}]}}]},ol={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`mutation`,name:{kind:`Name`,value:`setEventDetectorFeedbackByAlert`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`alertId`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`UUID`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`isFalsePositive`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`Boolean`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`setEventDetectorFeedbackByAlert`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`alertId`},value:{kind:`Variable`,name:{kind:`Name`,value:`alertId`}}},{kind:`Argument`,name:{kind:`Name`,value:`isFalsePositive`},value:{kind:`Variable`,name:{kind:`Name`,value:`isFalsePositive`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`completed`}}]}}]}}]},sl=[`comment`,`incident_status_update`,`incident_owner_update`,`incident_severity_update`,`declared_incident_severity_update`,`incident_slack_thread`,H.IncidentSplit,`incident_name_update`,`incident_merge`,H.IncidentDetectorFeedback],cl={includeTimelineEvents:!0,timelineEventsOnly:!1,first:He},ll=(e,t)=>
3{let n=m()(f.ALERT_SLO),i=(0,K.useMemo)(()=>n?[...sl,H.SloBreach]:sl,[n]),a={...cl,...e,eventTypes:e.timelineEventsOnly?i:e.eventTypes,first:(0,Z.isEmpty)(e.first)?He:e.first},[o,s]=K.useState(!1),{error:c,loading:l,data:u,fetchMore:d}=r(Jn,{variables:a,skip:t});function p(){u?.getEvents?.pageInfo?.hasNextPage&&(s(!0),d({variables:{cursor:u.getEvents.pageInfo.endCursor,first:a.first},updateQuery(e,{fetchMoreResult:t}){if(!t||!e.getEvents)return e;let{edges:n,pageInfo:r}=t.getEvents;return n.length?{getEvents:{...e.getEvents,pageInfo:r,edges:[...e.getEvents.edges,...n]}}:e}}).catch(()=>{}).finally(()=>s(!1)))}let h;if(u?.getEvents?.edges.length){let e=[...u.getEvents.edges].sort((e,t)=>e?.node?.createdTime&&t?.node?.createdTime&&e?.node?.createdTime>t?.node?.createdTime?-1:e?.node?.createdTime&&t?.node?.createdTime&&e?.node?.createdTime<t?.node?.createdTime?1:0).find(e=>{let t=e?.node;return t?.eventType?!Vc.includes(t?.eventType):!1});e&&(h=e?.node?.uuid)}let g=u?.getEvents?.edges.length,_=!!h,v=K.useRef(void 0);return v.current=p,K.useEffect(()=>{g&&!_&&v.current?.()},[g,_]),{fetchingMore:o,handleFetchMore:p,fetchMore:d,error:c,loading:l,events:u,hasFirstEvent:_,firstEventId:h}},ul={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getFhEvents`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`field`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`first`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Int`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`alertId`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`UUID`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`metric`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`offset`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Int`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`whereConditions`}},type:{kind:`ListType`,type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`searchValues`}},type:{kind:`ListType`,type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getFhEvents`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`field`},value:{kind:`Variable`,name:{kind:`Name`,value:`field`}}},{kind:`Argument`,name:{kind:`Name`,value:`first`},value:{kind:`Variable`,name:{kind:`Name`,value:`first`}}},{kind:`Argument`,name:{kind:`Name`,value:`alertId`},value:{kind:`Variable`,name:{kind:`Name`,value:`alertId`}}},{kind:`Argument`,name:{kind:`Name`,value:`metric`},value:{kind:`Variable`,name:{kind:`Name`,value:`metric`}}},{kind:`Argument`,name:{kind:`Name`,value:`offset`},value:{kind:`Variable`,name:{kind:`Name`,value:`offset`}}},{kind:`Argument`,name:{kind:`Name`,value:`whereConditions`},value:{kind:`Variable`,name:{kind:`Name`,value:`whereConditions`}}},{kind:`Argument`,name:{kind:`Name`,value:`searchValues`},value:{kind:`Variable`,name:{kind:`Name`,value:`searchValues`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`totalCount`}},{kind:`Field`,name:{kind:`Name`,value:`events`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`eventUuid`}},{kind:`Field`,name:{kind:`Name`,value:`eventType`}},{kind:`Field`,name:{kind:`Name`,value:`alertUuid`}},{kind:`Field`,name:{kind:`Name`,value:`date`}},{kind:`Field`,name:{kind:`Name`,value:`field`}},{kind:`Field`,name:{kind:`Name`,value:`lowerThreshold`}},{kind:`Field`,name:{kind:`Name`,value:`metric`}},{kind:`Field`,name:{kind:`Name`,value:`upperThreshold`}},{kind:`Field`,name:{kind:`Name`,value:`value`}},{kind:`Field`,name:{kind:`Name`,value:`whereCondition`}}
3,{kind:`Field`,name:{kind:`Name`,value:`customMetricDisplayName`}},{kind:`Field`,name:{kind:`Name`,value:`customMetricSqlExpression`}},{kind:`Field`,name:{kind:`Name`,value:`comparisonOperator`}},{kind:`Field`,name:{kind:`Name`,value:`historicalMean`}},{kind:`Field`,name:{kind:`Name`,value:`thresholdType`}},{kind:`Field`,name:{kind:`Name`,value:`autoOperator`}},{kind:`Field`,name:{kind:`Name`,value:`detectorFeedback`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`createdTime`}},{kind:`Field`,name:{kind:`Name`,value:`isFalsePositive`}},{kind:`Field`,name:{kind:`Name`,value:`updatedTime`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}}]}}]}}]}}]}}]},dl=`ML Feedback`,fl=`Enabled draw windows`,pl=`Save training windows`,ml=`Cancel draw windows`,hl=`Mark as normal`,gl=`Unmark as normal`,_l=`set-event-detector-feedback`,vl=`set-event-detector-feedback`;function yl(){let[e]=b(al),[t]=b(ol);return{setEventDetectorFeedback:async({alertId:t,eventUuid:n,isFalsePositive:r,field:i,metric:a,whereCondition:s})=>{let l=!!a||!!i||!!s,u=i||void 0,d=a||void 0,f=s||void 0;j.show({id:_l,message:`Updating thresholds...`,loading:!0,variant:`info`,autoClose:!1});let p=[];t&&p.push({query:Jn,variables:{first:He,alertId:t,includeTimelineEvents:!0,eventTypes:sl}}),l?p.push(`getFhEvents`,`getFhEventsByMonitor`):p.push({query:il,variables:{uuid:n}}),await e({refetchQueries:p,variables:{isFalsePositive:r,eventId:n,field:u,metric:d,whereCondition:f},onCompleted:()=>{j.update({id:_l,title:r?`Anomaly has been marked as normal`:`Anomaly has been unmarked as normal`,message:`Updates to thresholds may take several hours`,variant:`success`,autoClose:!0,loading:!1}),o(dl,{[c]:r?hl:gl,eventUuid:n,field:u,metric:d,whereCondition:f})},onError:()=>{j.update({id:_l,message:`An error occurred while updating thresholds`,loading:!1,variant:`danger`,autoClose:!0})}})},setAlertDetectorFeedback:async({alertId:e,isFalsePositive:n,refetch:r})=>{let{metric:i,field:a,segments:s,eventUuid:l}=r,u=!!i||!!a||!!s,d=a||void 0,f=i||void 0,p=s||void 0;j.show({id:_l,message:`Updating thresholds...`,loading:!0,variant:`info`,autoClose:!1});let m=[{query:Jn,variables:{first:He,alertId:e,includeTimelineEvents:!0,eventTypes:sl}}];u?m.push({query:ul,variables:{alertId:e,metric:f,field:d,whereConditions:p,first:100}}):m.push({query:il,variables:{uuid:l}}),await t({variables:{alertId:e,isFalsePositive:n},update:e=>{e.evict({fieldName:`getEvents`}),u?e.evict({fieldName:`getFhEvents`}):e.evict({fieldName:`getEvent`})},onCompleted:()=>{j.update({id:_l,title:n?`Anomalies have been marked as normal`:`Anomalies have been unmarked as normal`,message:`Updates to thresholds may take several hours`,variant:`success`,autoClose:!0,loading:!1}),o(dl,{[c]:n?hl:gl,alertId:e})},onError:()=>{j.update({id:_l,message:`An error occurred while updating thresholds`,loading:!1,variant:`danger`,autoClose:!0})}})}}}function bl({alertId:e,eventUuid:t,isFalsePositive:n,field:r,metric:i,whereCondition:a,reason:o}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(xe,{orientation:`horizontal`}),n?(0,q.jsxs)(D,{gap:`sm`,children:[o===vt.DetectorMarkedAsNormal?(0,q.jsx)($,{text:`This anomaly was marked as normal automatically.`}):(0,q.jsx)($,{text:`This anomaly is included when generating anomaly detection thresholds.`}),(0,q.jsxs)(P,{gap:4,wrap:`nowrap`,children:[(0,q.jsx)(rl,{variant:`secondary`,size:`compact`,actionName:vl,actionPayload:{alertId:e,eventUuid:t,isFalsePositive:!1,field:r,metric:i,whereCondition:a},children:`Unmark as normal`}),(0,q.jsx)(O,{size:`xs`,children:`to exclude it from the training set.`})]})]}):(0,q.jsxs)(D,{gap:`xs`,children:[(0,q.jsx)($,{text:`This anomaly is ignored when generating anomaly detection thresholds.`}),(0,q.jsxs)(P,{gap:4,wrap:`nowrap`,children:[(0,q.jsx)(rl,{variant:`secondary`,size:`compact`,actionName:vl,actionPayload:{alertId:e,eventUuid:t,isFalsePositive:!0,field:r,metric:i,whereCondition:a},children:`Mark as normal`}),(0,q.jsx)(O,{size:`xs`,children:`to include it in the training set.`})]})]})]})}function xl(e){return e.eventType===H.CustomRuleAnom?Gc(e)?.rule?.comparisons?.[0]?.comparison_type===_t.DynamicThreshold:[H.MetricAnom,H.SizeDiff,H.FreshAnom,H.UnchangedSizeAnom].includes(e.eventType)?[null,`auto`].includes(Gc(e).threshold_type):!1}var Sl=`section`,Cl=`investigate`,wl=`set-event-investigation-panel`;function Tl(){let e=l(),[t]=u(),n=(0,K.useMemo)(()=>t.get(Sl)===Cl,[t]),r=(0,K.useCallback)((n,r,i,s,c,l)=>{o(a,{event:n,field:r,metric:i,date:s,whereCondition:c,alertId:l});let u=new URLSearchParams(t);u.set(Sl,Cl),u.set(rt.INCIDENT_EVENT,n),u.set(rt.INCIDENT_FIELD,r??``),u.set(rt.INCIDENT_METRIC,i??``),u.set(rt.INCIDENT_DATE,s??``),u.set(rt.INCIDENT_WHERE_CONDITION,c??``);let d=`${xt.app.pages.alerts.base}/${l}?${u.toString()}`;e(d)},[e,t]),i=(0,K.useCallback)(n=>{o(s,{alertId:n});let r=new URLSearchParams(t);r.delete(Sl);let i=`${xt.app.pages.alerts.base}/${n}?${r.toString()}`;e(i,{replace:!0})},[e,t]);return[n,(0,K.useCallback)((e,{event:t,field:n,metric:a,date:o,whereCondition:s,alertId:c})=>{e&&t?r(t,n,a,o,s,c):i(c??``)},[r,i]),(0,K.useMemo)(()=>({event:t.get(rt.INCIDENT_EVENT)??``,field:t.get(rt.INCIDENT_FIELD),metric:t.get(rt.INCIDENT_METRIC),date:t.get(rt.INCIDENT_DATE),whereCondition:t.get(rt.INCIDENT_WHERE_CONDITION)}),[t])]}var El=e=>!!e&&Object.values(ht).includes(e.toUpperCase()),Dl=(e,t,n=!0)=>e?n?El(t)?`View rows`:`Sampling is not supported for this metric`:`Sampling is not available`:`Sampling is not available for this warehouse`,Ol=e=>{let t=e?.toUpperCase();if(Object.values(ht).includes(t))return t};function kl(e,t,n){let r=new Set([`agent`,`completions`,`prompts`]),i=[],a=new Map;for(let[t,n]of e.entries()){let e=n.toLowerCase();i.push(e),a.has(e)||a.set(e,t)}let o=[],s=new Set,c=[`trace_id`,`start_time`,n?.toLowerCase()];for(let e of c){if(!e||r.has(e))continue;let t=a.get(e);t!==void 0&&!s.has(t)&&(o.push(t),s.add(t))}let l=[];for(let[e,t]of i.entries())!s.has(e)&&!r.has(t)&&l.push(e);let u=[...o,...l];return{columns:u.map(t=>e[t]),rows:t.map(e=>u.map(t=>e[t]??null))}}function Al({eventId:e,field:t,metric:n,whereCondition:r,date:i,dataSamplingEnabled:a,alertId:o}){let s=m(),c=El(n)&&a&&s(f.METRIC_ALERT_INVESTIGATION),l=Dl(a,n,s(f.METRIC_ALERT_INVESTIGATION));return(0,q.jsxs)(D,{w:`auto`,gap:`xs`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(rl,{fullWidth:!1,variant:`secondary`,size:`compact`,disabled:!c,actionName:wl,actionPayload:{event:e,field:t,metric:n,whereCondition:r,date:i,alertId:o},children:`View rows`})}),!c&&(0,q.jsx)(O,{size:`xs`,variant:`dimmed`,children:l})]})}var jl=`CUSTOM_RULE_SQL_VIEW_EVENT_ACTION`;function Ml({eventUuid:e}){return(0,q.jsx)(R,{children:(0,q.jsx)(rl,{fullWidth:!1,variant:`secondary`,size:`compact`,actionName:jl,actionPayload:{eventUuid:e},children:`View rows`})})}function Nl(e){return(0,q.jsx)(I,{component:`button`,type:`button`,ta:`inherit`,...e})}var Pl=nl(Nl);function Fl(e){return(0,q.jsx)(Pl,{...e})}var Il=`VIEW_ALERT_ACTION`;function Ll({alertId:e,eventUuid:t}){return(0,q.jsx)(R,{children:(0,q.jsx)(Fl,{size:`xs`,actionName:Il,actionPayload:{alertId:e,eventUuid:t},children:`View alert`})})}var Rl=Un(`.2~r`),zl=Un(`.4~r`),Bl=Un(`,.2~f`),Vl=Un(`,.4~f`),Hl=Un(`,.6~f`),Ul=Un(`.4~s`),Wl=e=>Bl(e)+`%`,Gl=e=>Vl(e)+`%`,Kl=e=>Hl(e)+`%`,ql=e=>zl(e)+`%`;function Jl(e,t){let n=Math.abs(e);return t?n>=99.99&&n<100?Gl(e):n>=.01?Wl(e):n>=1e-4?Gl(e):n>
30?Kl(e):ql(e):n>=.01&&n<1e3?Bl(e):n<.01?Rl(e):Ul(e).replace(`G`,`B`)}function Yl(e,t){if(typeof e!=`number`)return`NA`;let n=Math.abs(e);return t?n>=99.99&&n<100?Gl(e):n>=.01?Wl(e):n>=1e-4?Gl(e):n>0?Kl(e):e+`%`:n>=1?Bl(e):n>=.01&&n<1?Vl(e):Rl(e)}function Xl(e,t){let n=(Array.isArray(e)?e[0]:e).axisValueLabel;return Dt((0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{size:`xs`,children:n}),(0,q.jsx)(D,{gap:0,children:Array.isArray(e)&&e.map((e,n)=>{let{seriesName:r}=e,i=e.value;if(!Array.isArray(i))return null;let a=e.marker,o=r===`Threshold`?i[2]:Yl(i[1],t);return(0,q.jsx)(K.Fragment,{children:o&&r&&(0,q.jsxs)(P,{gap:`sm`,justify:`space-between`,children:[(0,q.jsxs)(P,{gap:0,align:`center`,children:[a&&(0,q.jsx)(`div`,{dangerouslySetInnerHTML:{__html:a}}),(0,q.jsxs)(O,{inline:!0,size:`xs`,children:[r,`:`,` `]})]},r),(0,q.jsx)(O,{inline:!0,size:`xs`,children:(0,q.jsx)(`strong`,{children:o?.toString()})})]})},`${r}-${n}`)})})]}))}function Zl(e){let t=!!e?.detectorFeedback?.isFalsePositive;return e?.detectorFeedback?.reason===vt.DetectorMarkedAsNormal||e?.detectorFeedback?.reason===vt.UserMarkedAsNormal||t}var Ql=(0,q.jsx)(Yc,{rounded:!0}),$l=(0,q.jsx)(Xc,{borderColor:xn});function eu(e){for(let t of e){let e=Gc(t),n=e.originalFhEvent;if(n?.autoOperator){if(n.autoOperator===ct.AutoHigh)return Pn;if(n.autoOperator===ct.AutoLow)return Dn}let r=e.rule?.comparisons?.[0]?.operator;if(r){if(r===at.AutoHigh)return Pn;if(r===at.AutoLow)return Dn}}return Mn}function tu({metricName:e,metricIsPercentage:t,events:n,canMutate:r,forceUtcTimezone:i,canSwitchBetweenAnomalyMarkPoints:a,selectedEventUuidForAnomalyMarkPoint:o,dataPointClickHint:s,eventClickHint:c,currentAlertId:l,emphasizeFalsePositives:u}){let d=!u,f=[],p=nn(i),m=!1,h=!1;eventsLoop:for(let i of n){if(!i.anomaly?.startTime){console.error(`Anomaly ${i.eventType} event is missing a start time`);continue}let n=S(i.anomaly.startTime).valueOf(),o=Zc({metricName:e,metricIsPercentage:t,event:i});if(typeof o!=`number`)continue;let s=(0,q.jsx)($,{marker:Ql,text:`Anomaly`}),c=Gc(i),u=Zl(i),p=xl(i),g=!!c.originalFhEvent?.metric&&![H.AgentAnom,H.AgentEvaluationAnom,H.AgentMetricAnom].includes(i.eventType),_=r&&p,v=i.alert?.id,y=v&&v!==l?v:void 0;!h&&(_||g||a)&&(h=!0),!m&&(_||g||a||y)&&(m=!0);let b=y?(0,q.jsx)(Ll,{alertId:y,eventUuid:i.uuid??void 0}):null;if(i.eventType===H.CustomRuleAnom||i.eventType===H.ValidationAnom||i.eventType===H.AgentTrajectoryAnom||i.eventType===H.AgentValidationAnom){let e=c?.hits?.[0],t=e?.value,n=c?.rule?.comparisons?.[0]?.operator,r=c?.rule?.comparisons?.[0]?.threshold,o=c?.rule?.comparisons?.[0]?.is_percentage_threshold===!0,l=e?.breach_count,f=e?.baseline_value,p=i.eventType===H.AgentTrajectoryAnom||i.eventType===H.AgentValidationAnom?`trace`:`row`,m=typeof n==`string`&&n&&typeof r==`number`,h=m?Ht(n.toUpperCase(),!0):``,g;if(o){let e=Yl(t,!0),n=[];typeof l==`number`&&typeof f==`number`&&n.push(`${tt(l)} of ${tt(f)} ${Ze(p,f)}`),m&&n.push(`alert if ${h} ${Yl(r,!0)}`),g=`${e} of ${p}s breached${n.length>0?` (${n.join(`, `)})`:``}`}else{let e=m?`(alert if ${h} ${Yl(r)})`:``;g=`${Yl(t)} ${Ze(p,t)} breached ${e}`.trim()}s=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)($,{marker:d&&u?$l:Ql,text:g}),a&&!!i.uuid&&(0,q.jsx)(Ml,{eventUuid:i.uuid}),_&&!!i.uuid&&(0,q.jsx)(bl,{alertId:i.alert?.id,eventUuid:i.uuid,isFalsePositive:u,reason:i.detectorFeedback?.reason})]})}if(i.eventType===H.SizeDiff){for(let t of[`byte`,`row`])if(c.metric.toLowerCase().includes(t)&&!e.toLowerCase().includes(t))continue eventsLoop;s=(0,q.jsxs)(q.Fragment,{children:[!!i.description&&(0,q.jsx)($,{marker:d&&u?$l:Ql,text:i.description}),_&&!!i.uuid&&(0,q.jsx)(bl,{alertId:i.alert?.id,eventUuid:i.uuid,isFalsePositive:u,reason:i.detectorFeedback?.reason})]})}if([H.MetricAnom,H.AgentAnom,H.AgentEvaluationAnom,H.AgentMetricAnom].includes(i.eventType)){let e=c.originalFhEvent,t=!!i.warehouse?.dataSamplingEnabled;if(e){let n=nt(e.whereCondition)?void 0:et(e.whereCondition);s=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(D,{gap:`xs`,children:[(0,q.jsx)($,{text:$c(e),marker:d&&u?$l:Ql}),!!n&&(0,q.jsx)($,{title:`Segment`,text:n,bold:!0}),!!e.field&&(0,q.jsx)($,{title:`Field`,text:e.field,bold:!0}),!!i.uuid&&g&&(0,q.jsx)(Al,{alertId:i.alert?.id??``,dataSamplingEnabled:t,eventId:i.uuid,field:e.field??void 0,metric:e.metric,whereCondition:e.whereCondition??void 0,date:e.date})]}
3),_&&!!i.uuid&&(0,q.jsx)(bl,{alertId:i.alert?.id,eventUuid:i.uuid,isFalsePositive:u,field:e.field??void 0,metric:e.metric,whereCondition:e.whereCondition??void 0,reason:e.detectorFeedback?.reason})]})}}f.push({x:n,y:o,tooltipLines:s,viewAlertLink:b,event:i})}if(f.length===0)return{};let g=`anomalies-${Hn()}`,_=e=>c?e.alert?.id?c:void 0:s;return{id:g,name:eu(n),animation:!1,type:`line`,markPoint:{symbol:`circle`,symbolSize:6,emphasis:{disabled:!1},itemStyle:{color:xn,borderWidth:0},data:f.map(e=>({name:JSON.stringify({isFalsePositive:Zl(e.event)}),xAxis:e.x,yAxis:e.y,cursor:_(e.event)?`pointer`:void 0,itemStyle:(()=>{if(o&&e.event.uuid===o)return{color:xn,borderColor:xn,borderWidth:2};if(d&&Zl(e.event))return fn})()})),tooltip:{trigger:`item`,enterable:m,alwaysShowContent:h,extraCssText:`border: none`,position:m?(e,t,n,r,i)=>{let[a,o]=e,[s]=i.contentSize,c=a-s;return[c<0?a:c,o]}:void 0,formatter:e=>{let t=e.data;if(!t)return``;let{xAxis:n,yAxis:r}=t,i=f.find(({x:e,y:t})=>e===n&&t===r);if(!i)return``;let a=_(i.event);return Dt((0,q.jsx)(_e,{children:(0,q.jsxs)(D,{gap:`sm`,children:[(0,q.jsx)($,{text:B(n,p)}),i.tooltipLines,i.viewAlertLink,a&&(0,q.jsx)(O,{size:`xs`,c:`dimmed`,fs:`italic`,children:a})]})}))}}}}}function nu({datum:e,prevDatum:t,metricName:n}){if(!t)return{lowerThresholdPoint:void 0,upperThresholdPoint:void 0,lowerThreshold:void 0,upperThreshold:void 0};let r=sn(n,e),i=(0,Z.compact)(e.thresholds).find(e=>e.type===dt.SizeDiff);if(typeof i.lower!=`number`||typeof i.upper!=`number`)return{lowerThresholdPoint:void 0,upperThresholdPoint:void 0,lowerThreshold:void 0,upperThreshold:void 0};let a=i.lower,o=i.upper,s=t.value,c=s+a,l=s+o,u=c<0?0:c,d=l-c;return{lowerThresholdPoint:{timestamp:r,value:[r,u]},upperThresholdPoint:{timestamp:r,value:[r,d]},lowerThreshold:c<0?0:c,upperThreshold:l}}function ru({datum:e,metricName:t}){let n=sn(t,e),r=(0,Z.compact)(e.thresholds).find(e=>e.type===dt.VolumeChange||e.type===dt.Custom);if(typeof r.lower!=`number`||typeof r.upper!=`number`)return{lowerThresholdPoint:void 0,upperThresholdPoint:void 0,lowerThreshold:void 0,upperThreshold:void 0};let i=r.lower,a=r.upper,o=i,s=a-i;return{lowerThresholdPoint:{timestamp:n,value:[n,o]},upperThresholdPoint:{timestamp:n,value:[n,s]},lowerThreshold:i,upperThreshold:a}}function iu({datum:e,prevDatum:t,metricName:n}){let r=sn(n,e),i=(0,Z.compact)(e.thresholds),a=i.find(e=>e.type===dt.SizeDiff),o=i.find(e=>e.type===dt.VolumeChange||e.type===dt.Custom),s=0,c=0;if(a){if(typeof a.lower!=`number`||typeof a.upper!=`number`)return{lowerThresholdPoint:void 0,upperThresholdPoint:void 0,lowerThreshold:void 0,upperThreshold:void 0};s=a.lower??0,c=a.upper??0}if(o){if(typeof o.lower!=`number`||typeof o.upper!=`number`||typeof t?.value!=`number`)return{lowerThresholdPoint:void 0,upperThresholdPoint:void 0,lowerThreshold:void 0,upperThreshold:void 0};s=o.lower-t.value,c=o.upper-t.value}let l=s,u=c-s;return{lowerThresholdPoint:{timestamp:r,value:[r,l]},upperThresholdPoint:{timestamp:r,value:[r,u]},lowerThreshold:s,upperThreshold:c}}function au(e){let t=(0,Z.compact)(e.datum.thresholds);return e.metricName===`total_row_count_change`||e.metricName===`total_byte_count_change`?iu(e):t.some(e=>e.type===dt.VolumeChange||e.type===dt.Custom)?ru(e):t.some(e=>e.type===dt.SizeDiff)?nu(e):{lowerThresholdPoint:void 0,upperThresholdPoint:void 0,lowerThreshold:void 0,upperThreshold:void 0}}function ou({sizeDiffLowerThresholdData:e,sizeDiffUpperThresholdData:t}){let n={name:Kt,animation:!1,silent:!0,tooltip:{show:!1},emphasis:{disabled:!0},type:`line`,z:Lt.THRESHOLD_BAND,stack:Xt,stackStrategy:`all`,showSymbol:!1,dimensions:W,encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)},lineStyle:{opacity:0},itemStyle:{color:Ys(It)},symbol:`none`};return[{...n,data:e},{...n,data:t,areaStyle:{color:Ys(It),opacity:Vt}}]}function su({datum:e,forceUtcTimezone:t}){let{prData:n}=e,{author:r}=n;return(0,q.jsxs)(D,{gap:`xs`,children:[(0,q.jsx)(O,{size:`xs`,children:B(S(n.mergedAt),nn(t))}),n.isRCA&&(0,q.jsx)($,{text:(0,q.jsxs)(P,{gap:`xxs`,children:[(0,q.jsx)(O,{fw:`600`,size:`xs`,children:`Correlated PR`}),(0,q.jsx)(Me,{size:`xs`,color:`yellow.8`,style:{marginTop:-4}}),(0,q.jsx)(I,{size:`xs`,href:`https://docs.getmontecarlo.com/docs/pull-requests`,target:`_blank`,rel:`noopener noreferrer`,children:`(Why?)`})]})}),n.title&&(0,q.jsx)($,{title:`Title`,align:`baseline`,text:(0,q.jsx)(I,{href:n?.url??``,target:`_blank`,rel:`noopener noreferrer`,children:(0,q.jsx)(O,{component:`span`,size:`xs`,fw:`600`,mih:`md`,lh:`md`,style:{whiteSpace:`normal`},children:n.title})})}),n.author?.login&&(0,q.jsx)($,{title:`Author`,text:(0,q.jsxs)(P,{gap:`xs`,wrap:`nowrap`,children:[r?.avatarUrl&&(0,q.jsx)(`img`,{src:r.avatarUrl,alt:r.login??`User avatar`,width:`20px`,height:`20px`,style:{borderRadius:`50%`}}),(0,q.jsx)(O,{inline:!0,fw:`600`,size:`xs`,children:r?.login})]})})]})}var cu={borderColor:`white`,confine:!0,trigger:`item`,enterable:!0,position:e=>[e[0],e[1]]},[lu,uu]=At;function du({githubData:e=[],forceUtcTimezone:t}){let n=e.map(e=>{let t=S(e.mergedAt).valueOf();
3return{prData:e,coords:[[t,0],[t,.8*Sn[1]]]}});if(n.length===0)return{};let r=n.filter(e=>e.prData.isRCA);return{name:$t,z:Lt.GITHUB_PR_SERIES,animation:!1,type:`lines`,coordinateSystem:`cartesian2d`,data:n,yAxisIndex:1,lineStyle:{opacity:1,width:1,color:Rn},label:{borderRadius:10,padding:4,width:1,height:1,backgroundColor:Rn,show:!0},markPoint:{symbol:`circle`,symbolSize:20,symbolOffset:[0,-5],itemStyle:{color:lu,borderColor:uu},data:r.map(e=>({name:e.prData.title??``,coord:e.coords[1],value:e.prData.id})),label:{show:!1,formatter:``},tooltip:{...cu,formatter:e=>{let n=e?.value,i=r.find(e=>e.prData.id===n);return Hs(i),Dt((0,q.jsx)(_e,{children:(0,q.jsx)(su,{datum:i,forceUtcTimezone:t})}))}}},tooltip:{...cu,formatter:e=>{let n=e.data;return Hs(n),Dt((0,q.jsx)(_e,{children:(0,q.jsx)(su,{datum:n,forceUtcTimezone:t})}))}}}}function fu({maintenanceWindows:e,startTime:t,endTime:n,forceUtcTimezone:r}){return{name:Tn,animation:!1,type:`line`,markArea:{emphasis:{disabled:!0},tooltip:{trigger:`item`,formatter:e=>{let{data:t}=e;return Dt((0,q.jsx)(_e,{children:(0,q.jsx)(qs,{start:t.coord[0][0],end:t.coord[1][0],forceUtcTimezone:r,type:`global`})}))}},data:(0,Z.compact)(e).map(e=>{let r=e.startTime??t,i=e.endTime??n;return[{itemStyle:{color:{image:Is,repeat:`repeat`}},xAxis:S(r).valueOf(),value:`global-exclusion-window-${e.id}`},{xAxis:Math.min(S(i).valueOf(),S().valueOf()),value:`global-exclusion-window-${e.id}`}]})},itemStyle:Us()}}function pu({endTime:e,metricName:t}){let n=S(),r=n.valueOf(),i=.8*Sn[1];return!ln(t)||S(e).isBefore(n)?{}:{animation:!1,z:Lt.CURRENT_TIME_SERIES,name:hn,type:`line`,xAxisIndex:1,yAxisIndex:0,silent:!0,showSymbol:!0,symbolSize:0,lineStyle:{color:wn,width:1},dimensions:W,encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)},data:[{value:[r,Sn[0]]},{label:{show:!0,position:`top`,color:Fn,fontSize:11,formatter:`Now`},value:[r,i]}]}}function mu({trainingWindows:e,startTime:t,endTime:n,forceUtcTimezone:r}){let i=S(t).valueOf(),a=S(n).valueOf(),o=new Map;for(let t of(0,Z.compact)(e)){let e=S(t.startTime).valueOf(),n=S(t.endTime).valueOf();n>i&&e<a&&o.set(`${t.id}`,[Math.max(e,i),Math.min(n,a),t.applyToVariation])}return{type:`line`,animation:!1,itemStyle:Us(),...tc({windows:o,withDecalBackground:!0,forceUtcTimezone:r})}}function hu({metricName:e,metricIsPercentage:t,data:n,githubData:r,maintenanceWindows:i,trainingWindows:a,events:o=[],showThresholds:s,startTime:c,endTime:l,isSegmented:u,canMutate:d,forceUtcTimezone:f,dataPointClickHint:p,eventClickHint:m,currentAlertId:h,emphasizeFalsePositives:g}){let _=n.length===1,v=[],y=[],b=[];for(let t=0;t<n.length;t++){let r=n[t];if(!r)continue;let{variables:i,metrics:a}=r,o=[];a.forEach((t,n)=>{let r=sn(e,t),i,{lowerThresholdPoint:c,upperThresholdPoint:l,lowerThreshold:u,upperThreshold:d}=au({datum:t,prevDatum:a[Math.max(n-1,0)],metricName:e});s&&c&&l&&!(0,Z.isNil)(u)&&!(0,Z.isNil)(d)&&(_&&(y.push(c),b.push(l)),i={lower:u,upper:d});let f=Mt(t.value,a[n-1]?.value),p=[r,t.value,f];o.push({timestamp:r,value:p,thresholds:i})}),v.push({id:`${Cn}-${Jt}-${t}`,animation:!1,name:u?et(i.whereCondition):Nt[e],type:Ln[e],symbol:`circle`,sampling:!p&&o.length>48&&Ln[e]===`line`?`lttb`:void 0,barMaxWidth:20,symbolSize:(e,t)=>
3o.length>48?p?3:0:Ws({params:t,type:`size`,seriesDataLength:o.length}),data:p?o.map(e=>({...e,cursor:`pointer`})):o,dimensions:qt,itemStyle:{color:u?Xe(t):Yt},encode:{x:qt.indexOf(`timestamp`),y:qt.indexOf(un(e)?`sizeChange`:`size`)}})}let x=tu({metricName:e,metricIsPercentage:t,events:o,canMutate:d,forceUtcTimezone:f,eventClickHint:m,currentAlertId:h,emphasizeFalsePositives:g});(0,Z.isEmpty)(x)||v.push(x),s&&_&&(y.length>0||b.length>0)&&v.push(...ou({sizeDiffLowerThresholdData:y,sizeDiffUpperThresholdData:b}));let S=du({githubData:r,metricName:e,forceUtcTimezone:f});(0,Z.isEmpty)(S)||v.push(S),v.push(fu({maintenanceWindows:i,startTime:c,endTime:l,forceUtcTimezone:f}));let C=pu({endTime:l,metricName:e});return(0,Z.isEmpty)(C)||v.push(C),v.push(mu({trainingWindows:a,startTime:c,endTime:l,forceUtcTimezone:f})),v}function gu({squared:e,color:t=Yt}){return(0,q.jsx)(Jc,{children:(0,q.jsx)(R,{w:10,h:10,bg:t,style:{borderRadius:e?0:`50%`}})})}var _u=Date.now(),vu=6048e5,yu=(0,q.jsx)(Yc,{}),bu=(0,q.jsx)(gu,{squared:!0});function xu(e){for(let t of e){let e=Gc(t),n=e.originalFhEvent;if(n?.autoOperator){if(n.autoOperator===ct.AutoHigh)return Pn;if(n.autoOperator===ct.AutoLow)return Dn}let r=e.rule?.comparisons?.[0]?.operator;if(r){if(r===at.AutoHigh)return Pn;if(r===at.AutoLow)return Dn}}return Mn}function Su({metricName:e,events:t,seriesData:n,canMutate:r,forceUtcTimezone:i,emphasizeFalsePositives:a}){let o=!a,s=[],c=nn(i),l=!1,u=!1;eventsLoop:for(let i of t){let t=!1;if(!i.anomaly?.startTime){console.error(`Anomaly ${i.eventType} event is missing a start time`);continue}if(Gt(e)&&![H.FreshAnom,H.CustomRuleAnom].includes(i.eventType)||dn(e)&&i.eventType!==H.UnchangedSizeAnom)continue;let a=Gc(i),c=a.metric,d=S(i.anomaly.startTime).valueOf(),f=!!i.anomaly.endTime,p=f?S(i.anomaly.endTime).valueOf():_u;if(!c){console.error(`Anomaly event data is missing metric`);continue}for(let t of[`byte`,`row`])if(c.toLowerCase().includes(t)&&!e.toLowerCase().includes(t))continue eventsLoop;if(e!==`time_since_last_row_count_change`&&a?.threshold_type===`explicit`&&typeof a?.dsec==`number`&&(p=d+a.dsec*1e3,f=p<_u),e===`time_since_last_row_count_change`){let e=n?.find(e=>e.timestamp>d);e&&(p=e.timestamp,f=!0,a.secs_since_update=Math.floor((p-d)/1e3))}if(!f&&Math.abs(p-d)>vu&&(p=d+vu,f=!0),i.eventType===H.FreshAnom||i.eventType===H.UnchangedSizeAnom&&c!==`time_since_last_row_count_change`||i.eventType===H.UnchangedSizeAnom&&c===`time_since_last_row_count_change`){t=Zl(i);let e=xl(i);u=e,l=e}let m=[];if(i.description&&m.push((0,q.jsx)($,{text:i.description,marker:o&&t?bu:yu},`tooltip-line-event-description`)),a.where_condition&&!nt(a.where_condition)&&m.push((0,q.jsx)($,{title:`Segment`,text:et(a.where_condition),bold:!0},`tooltip-line-segment`)),r&&u&&i.uuid&&i.alert?.id){let e,n,r,o,s=a.originalFhEvent;s?(e=s.metric||void 0,n=s.field||void 0,r=s.whereCondition||void 0,o=s?.detectorFeedback?.reason||void 0):o=i.detectorFeedback?.reason||void 0,m.push((0,q.jsx)(bl,{alertId:i.alert.id,eventUuid:i.uuid,isFalsePositive:t,field:n,metric:e,whereCondition:r,reason:o},`tooltip-line-detector-feedback`))}s.push({start:d,end:p,hasEndTime:f,event:i,tooltipLines:m})}return s.length===0?{}:{id:`anomalies-${Hn()}`,name:xu(t),animation:!1,type:`line`,markArea:{emphasis:{disabled:!0},label:{show:!1},itemStyle:{color:Ys(pn),borderColor:xn,borderWidth:1},data:s.map(({start:e,end:t,event:n})=>[{name:JSON.stringify({isFalsePositive:Zl(n)}),xAxis:e,itemStyle:o&&Zl(n)?{color:yn,borderColor:Yt,borderWidth:1}:void 0},{xAxis:t}]),tooltip:{trigger:`item`,enterable:l,alwaysShowContent:l,extraCssText:`border: none`,position:l?e=>[e[0]-200,0]:void 0,formatter:e=>{let t=e.data.xAxis,n=s.find(({start:e})=>e===t);if(!n)return``;let r=(0,q.jsx)($,{text:`Since ${B(n.start,c)} (ongoing)`});return n.hasEndTime&&(r=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)($,{title:`From`,text:B(n.start,c)}),(0,q.jsx)($,{title:`To`,text:B(n.end,c)})]})),Dt((0,q.jsx)(_e,{children:(0,q.jsxs)(D,{gap:`sm`,children:[r,n.tooltipLines.map((e,t)=>(0,q.jsx)(K.Fragment,{children:e},t))]})}))}}}}}function Cu({start:e,end:t,text:n,forceUtcTimezone:r}){let i=nn(r);return(0,q.jsxs)(D,{gap:`sm`,children:[(0,q.jsx)($,{text:n}),(0,q.jsx)($,{text:`${B(e,i)} and`}),(0,q.jsx)($,{text:B(t,i)})]})}function wu({detectorStatusData:e,lastUpdate:t,endTime:n,events:r,forceUtcTimezone:i}){if(r?.some(e=>e.eventType===H.FreshAnom&&!!e?.anomaly?.startTime&&!e?.anomaly?.endTime))return{};let{breach:a,expected:o}=e?.getTable?.thresholds?.freshness??{};if(typeof a!=`number`||typeof o!=`number`||typeof t!=`number`)return{};let s=S(n),c=S(t),l=c.valueOf()+o*1e3,u=c.valueOf()+a*1e3,d=Math.min(s.valueOf(),u);return l>s.valueOf()?{}:{name:In,animation:!1,type:`line`,markArea:{tooltip:{trigger:`item`,confine:!0,formatter:()=>Dt((0,q.jsx)(_e,{children:(0,q.jsx)(Cu,{text:`Next table update expected between`,start:l,end:u,forceUtcTimezone:i})}))},emphasis:{disabled:!0},data:[[{itemStyle:{color:Ys(bn)},xAxis:l},{xAxis:d}]]},itemStyle:{color:Ys(bn)}}}function Tu(e){let t=e.thresholds?.find(e=>e?.type===dt.Freshness);if(typeof t?.upper==`number`)return{upper:t.upper,lower:0}}function Eu({metricName:e,data:t,githubData:n,maintenanceWindows:r,trainingWindows:i,detectorStatusData:a,lastUpdate:o,events:s=[],startTime:c,endTime:l,canMutate:u,forceUtcTimezone:d,emphasizeFalsePositives:f}){let p=[];for(let n=0;n<t.length;n++){let r=t[n];if(!r)continue;let{metrics:i}=r,a=[...i].sort((e,t)=>
3e.value-t.value),o=a.map((e,t)=>{let n=e.value*1e3,r=t>0?a[t-1]:void 0,i=r?Math.max((n-r.value*1e3)/1e3,0):0;return{timestamp:n,value:[n,.5*Sn[1],i],thresholds:Tu(e)}});p.push({id:`${Cn}-${mn}-diamond-${n}`,animation:!1,name:Nt[e],type:Ln[e],symbol:`diamond`,symbolSize:10,large:!0,data:o,itemStyle:{color:Yt},dimensions:W,encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)}},{id:`${Cn}-${mn}-bar-${n}`,animation:!1,name:Nt[e],type:`bar`,barWidth:1,itemStyle:{opacity:.8},data:o,dimensions:W,encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)},tooltip:{show:!1}})}p.push(mu({trainingWindows:i,startTime:c,endTime:l,forceUtcTimezone:d}));let m=Su({metricName:e,events:s,canMutate:u,forceUtcTimezone:d,emphasizeFalsePositives:f});(0,Z.isEmpty)(m)||p.push(m);let h=du({githubData:n,metricName:e,forceUtcTimezone:d});(0,Z.isEmpty)(h)||p.push(h),p.push(fu({maintenanceWindows:r,startTime:c,endTime:l,forceUtcTimezone:d}));let g=wu({detectorStatusData:a,lastUpdate:o,endTime:l,events:s,forceUtcTimezone:d});(0,Z.isEmpty)(g)||p.push(g);let _=pu({endTime:l,metricName:e});return(0,Z.isEmpty)(_)||p.push(_),p}function Du(e,t){let n=e===`time_since_last_row_count_change`?dt.FieldHealth:dt.UnchangedSize,r=t.thresholds?.find(e=>e?.type===n);if(typeof r?.upper==`number`)return{upper:r.upper,lower:0}}function Ou({metricName:e,detectorStatusData:t,lastUpdate:n,endTime:r,events:i,forceUtcTimezone:a}){if(e===`time_since_last_row_count_change`||i?.some(e=>e.eventType===H.UnchangedSizeAnom&&!!e?.anomaly?.startTime&&!e?.anomaly?.endTime))return{};let{ucsLower:o,ucsUpper:s}=t?.getTable?.thresholds?.size??{};if(typeof o!=`number`||typeof s!=`number`||typeof n!=`number`)return{};let c=S(r),l=S(n),u=l.valueOf()+o*1e3,d=l.valueOf()+s*1e3,f=Math.min(c.valueOf(),d);return u>c.valueOf()?{}:{name:zt,animation:!1,type:`line`,markArea:{tooltip:{trigger:`item`,confine:!0,formatter:()=>Dt((0,q.jsx)(_e,{children:(0,q.jsx)(Cu,{text:`Next table size change expected between`,start:u,end:d,forceUtcTimezone:a})}))},emphasis:{disabled:!0},data:[[{itemStyle:{color:Ys(bn)},xAxis:u},{xAxis:f}]]},itemStyle:{color:Ys(bn)}}}function ku({metricName:e,data:t,githubData:n,maintenanceWindows:r,trainingWindows:i,detectorStatusData:a,lastUpdate:o,events:s=[],startTime:c,endTime:l,isSegmented:u,canMutate:d,forceUtcTimezone:f,emphasizeFalsePositives:p}){let m=[];for(let n=0;n<t.length;n++){let r=t[n];if(!r)continue;let{variables:i,metrics:a}=r,o=a.map((t,n)=>{let r=t.value*1e3,i=a[Math.max(n-1,0)],o=(i?r-i.value*1e3:0)/1e3;return{timestamp:r,value:[r,.5*Sn[1],o],thresholds:Du(e,t)}}),s=u?et(i.whereCondition):Nt[e],c=u?Xe(n):Yt,l={animation:!1,name:s,data:o,dimensions:W,encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)}};m.push({...l,id:`${Cn}-ucs-diamond-${n}`,type:Ln[e],symbol:`diamond`,symbolSize:10,large:!0,itemStyle:{color:c}},{...l,id:`${Cn}-ucs-bar-${n}`,type:`bar`,barWidth:1,itemStyle:{color:c,opacity:.8},tooltip:{show:!1}})}m.push(mu({trainingWindows:i,startTime:c,endTime:l,forceUtcTimezone:f}));let h=Su({metricName:e,events:s,seriesData:m?.[0]?.data??[],canMutate:d,forceUtcTimezone:f,emphasizeFalsePositives:p});(0,Z.isEmpty)(h)||m.push(h);let g=du({githubData:n,metricName:e,forceUtcTimezone:f});(0,Z.isEmpty)(g)||m.push(g),m.push(fu({maintenanceWindows:r,startTime:c,endTime:l,forceUtcTimezone:f}));let _=Ou({metricName:e,detectorStatusData:a,lastUpdate:o,endTime:l,events:s,forceUtcTimezone:f});(0,Z.isEmpty)(_)||m.push(_);let v=pu({endTime:l,metricName:e});return(0,Z.isEmpty)(v)||m.push(v),m}function Au({datumThreshold0:e,datumThreshold1:t,fhEvents:n,fhEventsDatumTimestamp:r,fhEventsDatumField:i,fhEventsDatumMetric:a}){let o=e?.lower??t?.lower,s=e?.upper??t?.upper,c;if(typeof o==`number`||typeof s==`number`){if(n?.every(e=>e.comparisonOperator===null)&&r)for(let e of(0,Z.compact)(n)){let t=e.field||void 0,n=e.metric||void 0,o=i===t,s=a===n;S.utc(e.date).valueOf()===r&&o&&s&&(c=e.autoOperator)}if(typeof o==`number`||typeof s==`number`)return{lower:o??void 0,upper:s??void 0,autoOperator:c}}}function ju(e){let t=e.filter(e=>e.thresholds);if(!t.length||t.every(e=>typeof e.thresholds?.lower!=`number`&&typeof e.thresholds?.upper!=`number`))return[];let n=t.every(e=>typeof e?.thresholds?.lower==`number`&&typeof e?.thresholds?.upper!=`number`),r=t.every(e=>typeof e?.thresholds?.upper==`number`&&typeof e?.thresholds?.lower!=`number`);if(n)return[{type:`line`,name:Kt,z:Lt.THRESHOLD_BAND,itemStyle:{color:Ys(It)},markArea:{emphasis:{disabled:!0},itemStyle:{color:Ys(It),opacity:Vt},data:e.map((e,t,n)=>[{xAxis:e.timestamp,yAxis:e.thresholds?.lower},{xAxis:n[t+1]?.timestamp??e.timestamp}])}}];let i={animation:!1,silent:!0,tooltip:{show:!1},emphasis:{disabled:!0},type:`line`,z:Lt.THRESHOLD_BAND,showSymbol:!1,symbol:`none`,lineStyle:{opacity:0}
3,itemStyle:{color:Ys(It)},dimensions:W,encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)}};return r?[{...i,name:Kt,areaStyle:{color:Ys(It),opacity:Vt},data:e.map(e=>[e.timestamp,e.thresholds?.upper??null])}]:[{...i,name:Kt,stack:Xt,stackStrategy:`all`,data:e.map(e=>[e.timestamp,e.thresholds?.lower??null])},{...i,name:Kt,stack:Xt,stackStrategy:`all`,data:e.map(e=>[e.timestamp,typeof e.thresholds?.upper==`number`&&typeof e.thresholds?.lower==`number`?e.thresholds.upper-e.thresholds.lower:null]),areaStyle:{color:Ys(It),opacity:Vt}}]}function Mu({metricDisplayName:e,isSegmented:t,isAlertsRedesignSecondPhaseEnabled:n,field:r,whereCondition:i}){let a=(0,Z.compact)([r,et(i)]).join(`: `),o=n&&!(0,Z.isEmpty)(r)?r:e;return t?a:o}function Nu(e){let t=new Set;for(let{metrics:n}of e)n.forEach(e=>{t.add(S(e.timestamp).valueOf())});return t}function Pu({metricName:e,metricDisplayName:t,metricIsPercentage:n,data:r,githubData:i,maintenanceWindows:a,trainingWindows:o,events:s=[],fhEvents:c,startTime:l,endTime:u,showThresholds:d,isSegmented:f,canMutate:p,forceUtcTimezone:m,isAlertsRedesignSecondPhaseEnabled:h,dataPointClickHint:g,eventClickHint:_,currentAlertId:v,emphasizeFalsePositives:y}){let b=Nu(r),x=r.length===1,S=!h&&e===`relative_row_count`&&r.length>1,C=[];for(let n=0;n<r.length;n++){let i=r[n];if(!i)continue;let{metrics:a,variables:o}=i,s=!1,l=(0,Z.compact)(a.map((t,n)=>{let r=sn(e,t),i=Mt(t.value,a[n-1]?.value),o=Au({datumThreshold0:t.thresholds?.[0],datumThreshold1:t.thresholds?.[1],fhEvents:c,fhEventsDatumTimestamp:r,fhEventsDatumMetric:t.metric||void 0,fhEventsDatumField:t.field||void 0});return{timestamp:r,value:[r,t.value,i],thresholds:o,jobExecutionUuid:t.jobExecutionUuid,metricName:e,field:t.field}}));l.some(e=>!!e.thresholds)&&(s=!0),S&&(b.forEach(e=>{l.some(t=>t.timestamp===e)||l.push({timestamp:e,value:[e,0,0]})}),l.sort((e,t)=>e.timestamp-t.timestamp));let u=Mu({metricDisplayName:t,isSegmented:f,isAlertsRedesignSecondPhaseEnabled:h,field:o.field,whereCondition:o.whereCondition});C.push({id:`${Cn}-${Pt}-${n}`,animation:!1,name:u,type:`line`,symbol:`circle`,sampling:!g&&l.length>48?`lttb`:void 0,stack:S?`total`:void 0,areaStyle:S?{}:void 0,symbolSize:(e,t)=>
3l.length>48?g?3:0:Ws({params:t,type:`metric`,seriesDataLength:l.length,showUnchangedDataPoints:!!g}),data:g?l.map(e=>({...e,cursor:`pointer`})):l,dimensions:Ft,itemStyle:{color:f||h?Xe(n):Yt},encode:{x:Ft.indexOf(`timestamp`),y:Ft.indexOf(`value`)}}),d&&s&&x&&C.push(...ju(l))}let w=tu({metricName:e,metricIsPercentage:n,events:s,canMutate:p,forceUtcTimezone:m,dataPointClickHint:g,eventClickHint:_,currentAlertId:v,emphasizeFalsePositives:y});(0,Z.isEmpty)(w)||C.push(w);let T=du({githubData:i,metricName:e,forceUtcTimezone:m});(0,Z.isEmpty)(T)||C.push(T),C.push(fu({maintenanceWindows:a,startTime:l,endTime:u,forceUtcTimezone:m}));let E=pu({endTime:u,metricName:e});return(0,Z.isEmpty)(E)||C.push(E),C.push(mu({trainingWindows:o,startTime:l,endTime:u,forceUtcTimezone:m})),C}function Fu({metricName:e,metricDisplayName:t,metricIsPercentage:n,data:r,githubData:i,maintenanceWindows:a,trainingWindows:o,events:s=[],startTime:c,endTime:l,showThresholds:u,canMutate:d,forceUtcTimezone:f,canSwitchBetweenAnomalyMarkPoints:p,selectedEventUuidForAnomalyMarkPoint:m,dataPointClickHint:h,eventClickHint:g,currentAlertId:_,emphasizeFalsePositives:v}){let y=[];for(let e=0;e<r.length;e++){let n=r[e];if(!n)continue;let i=!1,a=(0,Z.compact)(n.metrics.map(e=>{let t=S(e.timestamp??e.measurementTimestamp).valueOf(),n=Au({datumThreshold0:e.thresholds?.[0],datumThreshold1:e.thresholds?.[1]});return{timestamp:t,value:[t,e.value],thresholds:n}}));a.some(e=>!!e.thresholds)&&(i=!0),y.push({id:`${Cn}-${_n}-${e}`,animation:!1,name:t,type:`line`,symbol:`circle`,symbolSize:(e,t)=>
3Ws({params:t,type:`custom-rule`,seriesDataLength:a.length}),data:h?a.map(e=>({...e,cursor:`pointer`})):a,dimensions:W,itemStyle:{color:Yt},encode:{x:W.indexOf(`timestamp`),y:W.indexOf(`value`)}}),u&&i&&y.push(...ju(a))}let b=tu({metricName:e,metricIsPercentage:n,events:s,canMutate:d,forceUtcTimezone:f,canSwitchBetweenAnomalyMarkPoints:p,selectedEventUuidForAnomalyMarkPoint:m,dataPointClickHint:h,eventClickHint:g,currentAlertId:_,emphasizeFalsePositives:v});(0,Z.isEmpty)(b)||y.push(b);let x=du({githubData:i,metricName:e,forceUtcTimezone:f});(0,Z.isEmpty)(x)||y.push(x),y.push(fu({maintenanceWindows:a,startTime:c,endTime:l,forceUtcTimezone:f}));let C=pu({endTime:l,metricName:e});return(0,Z.isEmpty)(C)||y.push(C),y.push(mu({trainingWindows:o,startTime:c,endTime:l,forceUtcTimezone:f})),y}function Iu(e){return Ut(e.metricName)?hu(e):Gt(e.metricName)?Eu(e):dn(e.metricName)?ku(e):e.isCustomRule?Fu(e):Pu(e)}function Lu(){let e=Js(It);return(0,q.jsx)(Jc,{children:(0,q.jsx)(R,{w:12,h:12,bg:e})})}function Ru({datum:e,forceUtcTimezone:t}){zs(e);let n=e.value[zn.indexOf(`lag`)];return(0,q.jsxs)(D,{gap:`sm`,children:[(0,q.jsx)($,{text:B(e.timestamp,nn(t))}),typeof n==`number`&&n>0&&(0,q.jsx)($,{title:`Previous update`,marker:(0,q.jsx)(gu,{}),bold:!0,text:`${gn({seconds:n})} prior`}),e.thresholds&&(0,q.jsx)($,{title:`Threshold`,marker:(0,q.jsx)(Lu,{}),bold:!0,text:gn({seconds:e.thresholds.upper})})]})}function zu({datum:e,metricName:t,forceUtcTimezone:n}){Rs(e);let r=t===`total_row_count_change`||t===`total_byte_count_change`?qt.indexOf(`sizeChange`):qt.indexOf(`size`),i=e.value[r],a=e=>{let n=Wt.includes(t)?Gn:kt,r=Ze(en[t],e);return`${n(e)} ${r}`};return(0,q.jsxs)(D,{gap:`sm`,children:[(0,q.jsx)($,{text:B(e.timestamp,nn(n))}),typeof i==`number`&&(0,q.jsx)($,{title:Nt[t],marker:(0,q.jsx)(gu,{}),bold:!0,text:a(i)}),typeof e.thresholds?.lower==`number`&&typeof e.thresholds?.upper==`number`&&(0,q.jsx)($,{title:`Threshold`,marker:(0,q.jsx)(Lu,{}),bold:!0,text:`${a(e.thresholds.lower)} - ${a(e.thresholds.upper)}`})]})}function Bu({datum:e,forceUtcTimezone:t}){Bs(e);let n=e.value[tn.indexOf(`lag`)];return(0,q.jsxs)(D,{gap:`sm`,children:[(0,q.jsx)($,{text:B(e.timestamp,nn(t))}),typeof n==`number`&&(0,q.jsx)($,{title:`Previous change`,marker:(0,q.jsx)(gu,{}),bold:!0,text:n===0?`N/A`:`${gn({seconds:n})} prior`}),e.thresholds&&(0,q.jsx)($,{title:`Threshold`,marker:(0,q.jsx)(Lu,{}),bold:!0,text:gn({seconds:e.thresholds.upper})})]})}function Vu(e,t){let{lower:n,upper:r,autoOperator:i}=e;return i===ct.AutoHigh&&typeof r==`number`?`above ${t(r)}`:i===ct.AutoLow&&typeof n==`number`?`below ${t(n)}`:typeof n==`number`&&typeof r==`number`?`${t(n)} - ${t(r)}`:typeof n==`number`?`${t(n)}`:typeof r==`number`?`${t(r)}`:``}function Hu({datum:e,metricName:t,metricDisplayName:n,metricIsPercentage:r,forceUtcTimezone:i,displayDate:a=!0,displayThreshold:o=!0,color:s}){Vs(e);let c=vn(t,r),l=Ft.indexOf(`value`),u=e.value[l],d=e.thresholds?Vu(e.thresholds,c):``;return(0,q.jsxs)(D,{gap:`sm`,children:[a&&(0,q.jsx)($,{text:B(e.timestamp,nn(i))}),typeof u==`number`&&(0,q.jsx)($,{title:n,marker:(0,q.jsx)(gu,{color:s}),bold:!0,text:c(u)}),o&&d&&(0,q.jsx)($,{title:`Threshold`,marker:(0,q.jsx)(Lu,{}),bold:!0,text:d})]})}function Uu(e,t){let{lower:n,upper:r,autoOperator:i}=e;return i===ct.AutoHigh&&typeof r==`number`?`above ${t(r)}`:i===ct.AutoLow&&typeof n==`number`?`below ${t(n)}`:typeof n==`number`&&typeof r==`number`?n===r?`${t(n)}`:`${t(n)} - ${t(r)}`:typeof n==`number`?`${t(n)}`:typeof r==`number`?`${t(r)}`:``}function Wu({data:e,metricName:t,metricIsPercentage:n,forceUtcTimezone:r}){let i=e[0]?.datum?.timestamp,a=e.length===1,o=vn(t,n);return i?(0,q.jsxs)(D,{gap:`sm`,children:[(0,q.jsx)($,{text:B(i,nn(r))}),ln(t)?(0,q.jsx)(D,{gap:`sm`,children:e.map(({segment:e,datum:t,color:n},r)=>{Vs(t);let i=tn.indexOf(`lag`),o=t.value[i];return(0,q.jsxs)(D,{gap:`xs`,children:[typeof o==`number`&&(0,q.jsx)($,{title:`${e}: previous change`,marker:(0,q.jsx)(gu,{color:n}),bold:!0,text:o===0?`N/A`:`${gn({seconds:o})} prior`}),t.thresholds&&a&&(0,q.jsx)($,{title:`Threshold`,marker:(0,q.jsx)(Lu,{}),bold:!0,text:gn({seconds:t.thresholds.upper})})]},r)})}):(0,q.jsx)(D,{gap:`sm`,children:e.map(({segment:e,datum:t,color:n},r)=>{Vs(t);let i=Ft.indexOf(`value`),s=t.value[i];
3return(0,q.jsxs)(D,{gap:`xs`,children:[typeof s==`number`&&(0,q.jsx)($,{title:e,marker:(0,q.jsx)(gu,{color:n}),bold:!0,text:o(s)}),a&&t.thresholds&&(()=>{let e=Uu(t.thresholds,o);return e?(0,q.jsx)($,{title:`Threshold`,marker:(0,q.jsx)(Lu,{}),bold:!0,text:e}):null})()]},r)})})]}):null}function Gu(e){return typeof e==`object`&&e&&`isAuxiliary`in e?e.isAuxiliary===!0:!1}function Ku(e,t){return Dt((0,q.jsxs)(D,{gap:`sm`,children:[e,t&&(0,q.jsx)(O,{size:`xs`,c:`dimmed`,fs:`italic`,children:t})]}))}function qu({metricName:e,metricDisplayName:t,metricIsPercentage:n,isSegmented:r,data:i,renderCustomTooltip:a,dataPointClickHint:o,forceUtcTimezone:s,showThresholds:c,isAlertsRedesignSecondPhaseEnabled:l,auxiliaryMetric:u}){let d={textStyle:{color:`inherit`},trigger:`axis`,confine:!0};if(r){let a=(i??[]).map(e=>Mu({metricDisplayName:t,isSegmented:r,isAlertsRedesignSecondPhaseEnabled:l,field:e.variables.field,whereCondition:e.variables.whereCondition}));return{...d,formatter:r=>{if(!Array.isArray(r))return``;let i=(0,Z.uniqBy)(r.filter(e=>a.includes(e.seriesName)).map(e=>({segment:e.seriesName||`empty string`,datum:e.data,color:`${e.color}`})),e=>e.segment),c=r.filter(e=>Gu(e.data));return(i.length===0||!t)&&!c.length?``:Ku((0,q.jsxs)(q.Fragment,{children:[i.length>0&&t&&(0,q.jsx)(Wu,{metricName:e,metricIsPercentage:n,data:i,forceUtcTimezone:s}),u&&c.map((e,t)=>{let n=e.data;return Ls(n),(0,q.jsx)(Hu,{datum:n,metricName:u.metricName,metricDisplayName:e.seriesName??u.metricDisplayName,displayDate:i.length===0&&t===0,displayThreshold:!1,forceUtcTimezone:s,color:(0,Z.isString)(e.color)?e.color:void 0},`auxiliary-${e.seriesName}-${t}`)})]}),i.length>0?o:void 0)}}}return{...d,formatter:r=>{if(!Array.isArray(r))return``;if(l)try{let t=r.filter(e=>!Gu(e.data));return Ku(r.map((r,i)=>{if(!r)return``;let o=r.data;if(Ls(o),u&&Gu(o))return(0,q.jsx)(Hu,{datum:o,metricName:u.metricName,metricDisplayName:r.seriesName??u.metricDisplayName,displayDate:t.length===0,displayThreshold:!1,forceUtcTimezone:s,color:(0,Z.isString)(r.color)?r.color:void 0},`auxiliary-${r.seriesName}-${i}`);if(a)return a(o);if(Gt(e))return(0,q.jsx)(Ru,{datum:o,forceUtcTimezone:s},`${r.seriesName}-${i}`);if(dn(e))return(0,q.jsx)(Bu,{datum:o,forceUtcTimezone:s},r.seriesName);if(Ut(e))return(0,q.jsx)(zu,{datum:o,metricName:e,forceUtcTimezone:s},r.seriesName);if(r.seriesName){let i=t.indexOf(r);return(0,q.jsx)(Hu,{datum:o,metricName:e,metricDisplayName:r.seriesName,metricIsPercentage:n,displayDate:i===0,displayThreshold:c!==!1&&i===t.length-1,color:(0,Z.isString)(r.color)?r.color:void 0},r.seriesName)}return null}),t.length>0?o:void 0)}catch(e){return console.error(e),``}let i=Nt[e]??t,d=r.find(e=>e.seriesName===i);if(!d)return``;let f=d.data;Ls(f);try{return a?Ku(a(f),o):Gt(e)?Ku((0,q.jsx)(Ru,{datum:f,forceUtcTimezone:s}),o):dn(e)?Ku((0,q.jsx)(Bu,{datum:f,forceUtcTimezone:s}),o):Ut(e)?Ku((0,q.jsx)(zu,{datum:f,metricName:e,forceUtcTimezone:s}),o):t?Ku((0,q.jsx)(Hu,{datum:f,metricName:e,metricDisplayName:t,metricIsPercentage:n,displayThreshold:c!==!1,forceUtcTimezone:s}),o):``}catch(e){return console.error(e),``}}}}function Ju(e){return e===`Threshold`?`thresholds`:Xu(e)?`anomalies`:e===`Excluded from training`||e===`Training window`?`exclusionWindows`:e===`Pull request`?`githubPRs`:e===`Current time`?`currentTime`:e===`Expected update`?`expectedUpdate`:e===`Expected change`?`expectedChange`:`metrics`}function Yu(e,t){return!t||e===void 0||t[e]!==!1}function Xu(e){return e===`Anomaly`||e===`Anomaly (above threshold)`||e===`Anomaly (below threshold)`}function Zu({metricName:e,isSegmented:t,seriesNames:n,trainingWindows:r,maintenanceWindows:i,legendItemVisibility:a}){let o=[],s=!!r?.length,c=!!i?.length;(s||c)&&Yu(`exclusionWindows`,a)&&o.push({name:Tn,icon:`square`});for(let r of n)if(Yu(Ju(r),a)&&r!==`Excluded from training`&&r!==`Training window`&&r!==`Current time`){if(r===`Pull request`){o.push({name:r,icon:`circle`,itemStyle:{borderWidth:0},inactiveBorderWidth:0});continue}if(Xu(r)&&o.push({name:r,icon:ln(e)?`square`:`circle`,inactiveBorderWidth:1,itemStyle:{color:xn,borderColor:xn,borderWidth:0}}),[`Threshold`,`Training window`,`Expected change`,`Expected update`].includes(r)){o.push({name:r,icon:r===`Threshold`?`roundRect`:`square`});continue}t||o.push({name:r,icon:`circle`})}let l=n.some(e=>
3{let t=Ju(e);return t!==`metrics`&&t!==`currentTime`})||o.length>1?o:[];return{type:`scroll`,orient:`horizontal`,pageIcons:{horizontal:[`path://M15 6 L9 12 L15 18 L14 18 L8 12 L14 6 Z`,`path://M9 6 L15 12 L9 18 L10 18 L16 12 L10 6 Z`]},pageFormatter:e=>`${e.current} of ${e.total}`,pageButtonItemGap:12,pageButtonGap:16,pageIconSize:8,pageIconColor:he.colors.gray[9],pageIconInactiveColor:he.colors.gray[5],itemWidth:10,itemHeight:10,data:l}}function Qu({zoomPattern:e}){if(e===lc.CLICK_AND_DRAG)return{show:!0,itemSize:0,top:-20,feature:{dataZoom:{yAxisIndex:`none`,filterMode:`none`,brushStyle:on}}}}function $u({auxiliaryMetric:e,variables:t,isSegmented:n}){if(!n)return e.metricDisplayName;let r=Mu({isSegmented:!0,field:t.field,whereCondition:t.whereCondition});return r?`${e.metricDisplayName} â ${r}`:e.metricDisplayName}function ed({auxiliaryMetric:e,data:t,isSegmented:n,reservedSeriesNames:r=[]}){return t.flatMap(({metrics:t,variables:i},a)=>{let o=(0,Z.compact)(t.map((n,r)=>{let i=sn(e.metricName,n),a=Mt(n.value,t[r-1]?.value);return{timestamp:i,value:[i,n.value,a],jobExecutionUuid:n.jobExecutionUuid,metricName:e.metricName,field:n.field,isAuxiliary:!0}}));if(!o.length)return[];let s=$u({auxiliaryMetric:e,variables:i,isSegmented:n}),c=r.includes(s)?`${s} (supporting)`:s;return[{id:`${Nn}-${a}`,name:c,type:`line`,animation:!1,silent:!0,yAxisIndex:2,symbol:`circle`,symbolSize:o.length===1?8:o.length>48?0:3,sampling:o.length>48?`lttb`:void 0,data:o,dimensions:Ft,lineStyle:{color:On},itemStyle:{color:On},encode:{x:Ft.indexOf(`timestamp`),y:Ft.indexOf(`value`)}}]})}function td({metricName:e,metricDisplayName:t,metricIsPercentage:n,metricValuesAreAlreadyPercent:r,startTime:i,endTime:a,data:o,auxiliaryMetric:s,auxiliaryData:c=[],githubData:l,maintenanceWindows:u,trainingWindows:d,detectorStatusData:f,lastUpdate:p,events:m,fhEvents:h,showThresholds:g,timeAxisLabel:_,isSegmented:v,canMutate:y,isCustomRule:b,renderCustomTooltip:x,dataPointClickHint:S,eventClickHint:C,zoomPattern:w,forceUtcTimezone:T,isAlertsRedesignSecondPhaseEnabled:E,canSwitchBetweenAnomalyMarkPoints:D,selectedEventUuidForAnomalyMarkPoint:O,showLegends:ee=!0,legendItemVisibility:k,currentAlertId:A,emphasizeFalsePositives:j}){let M=c.some(({metrics:e})=>e.length>0)?s:void 0,N=Iu({metricName:e,metricDisplayName:t,metricIsPercentage:n,metricValuesAreAlreadyPercent:r,data:o,githubData:l,maintenanceWindows:u,trainingWindows:d,detectorStatusData:f,lastUpdate:p,events:m,fhEvents:h,showThresholds:g,startTime:i,endTime:a,isSegmented:v,canMutate:y,isCustomRule:b,forceUtcTimezone:T,isAlertsRedesignSecondPhaseEnabled:E,canSwitchBetweenAnomalyMarkPoints:D,selectedEventUuidForAnomalyMarkPoint:O,dataPointClickHint:S,eventClickHint:C,currentAlertId:A,emphasizeFalsePositives:j}),te=Array.isArray(N)?N:N?[N]:[],ne=te.flatMap(e=>typeof e.name==`string`?[e.name]:[]),P=[...te,...M?ed({auxiliaryMetric:M,data:c,isSegmented:v,reservedSeriesNames:ne}):[]],re=k?P.filter(e=>Yu(Ju(e.name),k)):P,F=(0,Z.uniq)(Array.isArray(re)?re.map(e=>e.name):[]),ie=Pc(o,e),I=F.includes(`Threshold`)?ie:void 0,ae=ie?.min===0&&ie.max===0&&!m?.length&&!h?.length&&!F.includes(`Threshold`),oe=ee?Zu({metricName:e,isSegmented:v&&!E,trainingWindows:d,maintenanceWindows:u,seriesNames:F,legendItemVisibility:k}):void 0;return{animation:!1,grid:gc({timeAxisLabel:_,zoomPattern:w,showLegends:ee}),legend:oe,tooltip:qu({metricName:e,metricDisplayName:t,isSegmented:v,data:o,renderCustomTooltip:x,dataPointClickHint:S,forceUtcTimezone:T,showThresholds:g,isAlertsRedesignSecondPhaseEnabled:E,auxiliaryMetric:M}),dataZoom:_c({zoomPattern:w,data:o}),xAxis:vc({metricName:e,startTime:i,endTime:a,timeAxisLabel:_,forceUtcTimezone:T}),yAxis:Lc({metricName:e,auxiliaryMetricName:M?.metricName,metricIsPercentage:n,metricValuesAreAlreadyPercent:r,isCustomRule:b,dataExtent:I,hideValueAxis:ae}),series:re,toolbox:Qu({zoomPattern:w})}}function nd(){return{replaceMerge:[`series`,`legend`,`yAxis`]}}var rd=(e,t,n)=>{(0,K.useEffect)(()=>{let r=n.current,i=n=>{let i=n.target;for(;r&&i&&i!==r;){if(i.hasAttribute(`data-tooltip-action`)){let n=i.getAttribute(el),r=i.getAttribute(tl);n===e&&r&&t($e(r))}i=i.parentElement}};return r?.addEventListener(`click`,i,!0),()=>{r?.removeEventListener(`click`,i,!0)}},[e,n,t])};function id(){return setTimeout(()=>{o(i,{[c]:`Hovering over PR in chart`})},2e3)}function ad(e){o(i,{[c]:`Toggle PRs in chart ${e}`})}function od(e,t){if(typeof e?.seriesIndex==`number`){let n=t?.getOption().series;if(Array.isArray(n))return n[e.seriesIndex]?.name??``}return``}var sd=function(e){return e.ClickAndDrag=`dataZoom`,e.Slider=`datazoom`,e}({}),cd={start:0,end:100},ld={startValue:void 0,endValue:void 0},ud=function(e,t,n,r,i){let a={top:60};return a[[`left`,`right`][+(e[0]<i.viewSize[0]/2)]]=5,a},dd=function(e,t,n,r,i){let[a,o]=e,{contentSize:s,viewSize:c}=i,l=s[0];return a<c[0]/2?[a+10,o]:[a-l-10,o]},fd=e=>{if(!pd(e))return ld;let t=e,{startValue:n,endValue:r}=`batch`in t&&t.batch?.[0]?t.batch[0]:t;return n==null||r==null?ld:{startValue:Math.min(n,r),endValue:Math.max(n,r)}};function pd(e){return typeof e==`object`&&!!e&&(e.type===sd.ClickAndDrag||`batch`in e&&Array.isArray(e.batch))}function md(e){if(typeof e!=`object`||!e||typeof e.type!=`string`)return cd;switch(e.type){case sd.ClickAndDrag:return{dataZoomId:e.dataZoomId,...cd};case sd.Slider:return{dataZoomId:e.dataZoomId,start:e.start,end:e.end};default:return cd}}function hd(e){if(typeof e!=`object`||!e)return;let t=e.type;if(t===sd.ClickAndDrag||t===sd.Slider)return e}function gd({dataZoomId:e,start:t,end:n,dataZoomIdsToSync:r,prevWindowRef:i}){if(r&&(!e||!r.includes(e)))return e&&(i.current[e]={start:t,end:n}),!1;let a=e?i.current[e]:void 0;return t===cd.start&&n===cd.end&&!a||a&&t===a.start&&n===a.end?!1:(e&&(i.current[e]={start:t,end:n}),!0)}var _d=(0,K.createContext)({selectedEventId:null,setSelectedEventId:()=>{},customRuleLoading:!1,auditLogLoading:!1,auditLogData:void 0,customRuleQueryData:void 0,selectedEvent:null}),vd=()=>{let e=(0,K.useContext)(_d);return e||console.warn(`useCustomRuleSqlContext must be used within a CustomRuleSqlContextProvider`),e};function yd(e){if(!e||e.isAuxiliary||!Array.isArray(e.value))return;let t=e.timestamp??e.value[0],n=e.value[1];
3if(typeof t==`number`&&typeof n==`number`)return{jobExecutionUuid:e.jobExecutionUuid,timestamp:t,value:n,metricName:e.metricName,field:e.field}}function bd(e){if(e.componentType===`series`&&`seriesType`in e&&e.seriesType===`line`)return yd(e.data)}function xd(e,t){let n=e?.getOption();for(let e of n?.series??[]){let{type:n,data:r}=e;if(!(n!==`line`||!Array.isArray(r)))for(let e of r){let n=yd(e);if(n?.timestamp===t)return n}}}function Sd({events:e,chartRef:t,chartInstance:n,onEventClick:r,onDataPointClick:i,chartContainerRef:a,onClickAndDragZoom:o}){let s=(0,K.useRef)(void 0),{setEventDetectorFeedback:c}=yl(),{setSelectedEventId:l}=vd(),[,u]=Tl(),d=bt();rd(Il,e=>{if(!e?.alertId)return;let{pathname:t,search:n,params:r}=Tt(e.alertId,e.eventUuid);d({pathname:t,search:n},{params:r})},a),rd(vl,e=>{e&&c(e)},a),rd(wl,(0,K.useCallback)(e=>{if(e){let n=t.current;n?.showLoading();let r=n?.getOption();r&&(n?.clear(),n?.setOption(r)),u(!0,e),setTimeout(()=>{n?.hideLoading()},500)}},[t,u]),a),rd(jl,e=>{if(e){let{eventUuid:t}=e;l(t)}},a);let f=(0,K.useCallback)(a=>{let o=bd(a);if(o){i?.(o);return}let s=a?.data?.xAxis;if([`markArea`,`markPoint`].includes(a.componentType)&&typeof s==`number`){let o=e?.find(e=>S(e.anomaly?.startTime).valueOf()===s);if(o&&r){r(o);return}if(a.componentType===`markPoint`&&i){let e=xd(n??t.current,s);e&&i(e)}}},[e,i,r,n,t]),p=(0,K.useCallback)(e=>{let n=e,r=t.current;n.name===`Pull request`&&ad(n.selected[`Pull request`]?`on`:`off`),n.name===`Excluded from training`&&(r?.dispatchAction({type:`legendToggleSelect`,name:rn}),n.selected[`Excluded from training`]&&n.selected.Anomaly&&(r?.dispatchAction({type:`legendUnSelect`,name:Mn}),r?.dispatchAction({type:`legendSelect`,name:Mn})))},[t]),m=(0,K.useCallback)(e=>{let n=e;clearTimeout(s.current);let r=od(n,t.current);r&&r===`Pull request`&&(s.current=id())},[t]),h=(0,K.useCallback)(()=>{clearTimeout(s.current)},[]),g=(0,K.useCallback)(e=>{let{startValue:t,endValue:n}=fd(e);if(t!==void 0&&n!==void 0){let[e,r]=[S(t),S(n)];o?.(e,r)}},[o]);(0,K.useEffect)(()=>{let e=n??t.current;return e&&((r||i)&&e.on(`click`,f),o&&e.on(`dataZoom`,g),e.on(`legendselectchanged`,p),e.on(`showTip`,m),e.on(`hideTip`,h)),()=>{(r||i)&&e?.off(`click`,f),o&&e?.off(`dataZoom`,g),e?.off(`legendselectchanged`,p),e?.off(`showTip`,m),e?.off(`hideTip`,h)}},[t,n,f,p,m,h,g,i,r,o])}var Cd=k();function wd({metricName:e}){let t=[Cd.accessor(jn(e)?`measurementTimestamp`:`timestamp`,{id:`time`,header:`Time`,cell:({cell:e})=>(0,q.jsx)(O,{span:!0,children:B(e.getValue())})}),Cd.accessor(`value`,{id:`value`,meta:{align:`right`},header:Nt[{total_row_count_change:`total_row_count`,total_byte_count_change:`total_byte_count`}[e]??e],cell:({cell:e})=>(0,q.jsx)(O,{span:!0,children:kt(e.getValue())})})];return(e===`total_row_count`||e===`total_row_count_change`||e===`total_byte_count`||e===`total_byte_count_change`)&&t.push(Cd.accessor(`change`,{id:`change`,meta:{align:`right`},enableGlobalFilter:!0,filterFn:`excludeZeros`,header:({column:t})=>{let n=t.getFilterValue()?`show changes of 0`:`hide changes of 0`;return(0,q.jsxs)(D,{align:`flex-end`,gap:0,children:[(0,q.jsx)(O,{span:!0,inherit:!0,children:e.includes(`byte`)?Nt.total_byte_count_change:Nt.total_row_count_change}),(0,q.jsx)(I,{component:`span`,onClick:e=>{e.stopPropagation(),t.setFilterValue(e=>!e)},children:`(${n})`})]})},cell:({cell:t})=>e.includes(`byte`)?(0,q.jsx)(O,{span:!0,children:Gn(t.getValue())}):(0,q.jsx)(O,{span:!0,children:kt(t.getValue())})})),t}function Td(){return[Cd.accessor(`value`,{id:`time`,header:`Table updated at`,cell:({cell:e})=>(0,q.jsx)(O,{span:!0,children:B(e.getValue()*1e3)})}),Cd.accessor(`change`,{id:`change`,meta:{align:`right`},header:`Time since last update`,cell:({getValue:e})=>(0,q.jsx)(O,{span:!0,children:gn({seconds:e()===0?void 0:e()})})})]}function Ed({metricName:e}){return[Cd.accessor(`value`,{id:`time`,header:e.includes(`row`)?`Table row count updated at`:`Table byte count updated at`,cell:({cell:e})=>(0,q.jsx)(O,{span:!0,children:B(e.getValue()*1e3)})}),Cd.accessor(`change`,{id:`change`,meta:{align:`right`},header:e.includes(`row`)?`Time since last row count change`:`Time since last b
3yte count change`,cell:({getValue:e})=>(0,q.jsx)(O,{span:!0,children:gn({seconds:e(),invalidText:``})})})]}function Dd(e,t){return[Cd.accessor(jn(e)?`measurementTimestamp`:`timestamp`,{id:`time`,header:`Time`,cell:({cell:e})=>(0,q.jsx)(O,{span:!0,children:B(e.getValue())})}),Cd.accessor(`value`,{id:`value`,meta:{align:`right`},header:t??Nt[e]??e,cell:({cell:e})=>(0,q.jsx)(O,{span:!0,children:kt(e.getValue())})})]}function Od(e,t){switch(e){case`total_row_count`:case`total_row_count_change`:case`total_byte_count`:case`total_byte_count_change`:case`write_throughput`:return wd({metricName:e});case`last_updated_on`:return Td();case`total_row_count_last_changed_on`:case`total_byte_count_last_changed_on`:return Ed({metricName:e});default:return Dd(e,t)}}function kd(e,t){return Cd.display({id:`alert`,header:`Alert`,cell:({row:n})=>{let r=jn(t)?n.original.measurementTimestamp:n.original.timestamp,i=r?e.get(r):void 0,a=i?.alert?.id;return a?(0,q.jsx)(I,{component:d,to:wt(a,i.uuid),children:`View alert`}):(0,q.jsx)(O,{span:!0,c:`dimmed`,children:`â`})}})}var Ad={pageIndex:0,pageSize:5};
3function jd({data:e,metricName:t,metricDisplayName:n,eventsByTimestamp:r,variant:i=`default`}){let a=e.metrics.map((e,t,n)=>{let r=t===0?0:e.value-n[t-1].value;return{...e,change:r}}),o=(0,K.useMemo)(()=>{let e=Od(t,n);return r&&r.size>0?[...e,kd(r,t)]:e},[t,n,r]);return(0,q.jsx)(E,{variant:i,getRowId:(e,t)=>t.toString(),columns:o,initialSortingState:[{id:`time`,desc:!0}],data:a,initialPaginationState:Ad})}var Md=6e4;function Nd(e){(0,K.useEffect)(()=>{let t=setInterval(()=>{if(e?.current){let t=e.current.getOption();if(Array.isArray(t?.series)){let n=t.series.findIndex(e=>e?.name===hn);if(n>-1){let r=S();t.series[n].data.forEach(e=>{e.value[0]=r.valueOf()}),e.current.setOption(t)}}}},Md);return()=>clearInterval(t)},[e])}var Pd=10;function Fd({numberOfFilesChanged:e,showMayIncludeCurrentTableAlert:t=!1,filesChanged:n,highlightedText:r}){let[i,a]=(0,K.useState)(!1);if(t&&(e||0)>=100)return(0,q.jsx)(ae,{variant:`warning`,children:`Impact 100+ files, may include current alert table.`});if(!n?.length)return(0,q.jsx)(O,{children:`No files changed`});let o=n.slice(0,Pd);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(w,{listStyleType:`none`,children:(i?n:o).map(e=>e?(0,q.jsx)(w.Item,{my:`sm`,children:(0,q.jsx)(Ke,{cols:1,children:(0,q.jsxs)(P,{wrap:`nowrap`,gap:`md`,children:[(0,q.jsx)(O,{c:`dimmed`,miw:60,ta:`right`,style:{flexGrow:0},children:Ye(e.changeType||``)}),(0,q.jsx)(Fe,{component:O,highlight:r??``,style:{flexGrow:1},truncate:!0,children:e.path??``})]})})},e.path):null)}),n.length>Pd&&!i&&(0,q.jsxs)(I,{component:`button`,onClick:()=>a(e=>!e),children:[`+ `,n.length-Pd,` more`]})]})}var Id=(0,K.memo)(Fd),Ld={highlighted:`_highlighted_1fmxu_1`},Rd=k(),zd=({author:e})=>e?.avatarUrl?(0,q.jsx)(`img`,{src:e.avatarUrl,alt:e.login??``,width:`24px`,height:`24px`,style:{borderRadius:`50%`}}):null,Bd=({author:e,minimal:t})=>{if(!e?.login)return null;let n=(0,q.jsx)(O,{truncate:t,style:t?{maxWidth:80}:void 0,children:e.login});return t?(0,q.jsx)(Et,{label:e.login,children:n}):n},Vd=({author:e,minimal:t})=>(0,q.jsxs)(P,{gap:`xs`,wrap:`nowrap`,children:[(0,q.jsx)(zd,{author:e,minimal:t}),(0,q.jsx)(Bd,{author:e,minimal:t})]}),Hd=({author:e,minimal:t})=>e?.login?(0,q.jsx)(R,{children:e.url?(0,q.jsx)(I,{href:e.url,rel:`noopener noreferrer`,target:`_blank`,children:(0,q.jsx)(Vd,{author:e,minimal:t})}):(0,q.jsx)(Vd,{author:e,minimal:t})}):(0,q.jsx)(R,{children:`No author`}),Ud={expander:Rd.display({id:`expander`,size:10,cell:({row:e})=>e.getCanExpand()?(0,q.jsx)(P,{justify:`flex-end`,mr:-16,children:(0,q.jsx)(ne,{onClick:e.getToggleExpandedHandler(),"aria-label":`Expand row for ${e.original.title}`,children:e.getIsExpanded()?(0,q.jsx)(ke,{}):(0,q.jsx)(ye,{})})}):null}),pullRequestsMinimal:Rd.display({id:`pullRequests`,header:`Pull request`,size:400,cell:({row:e})=>{let t=e.original;return(0,q.jsx)(R,{"data-testid":`pull-request-${t.issueNumber}`,children:(0,q.jsx)(I,{href:t.url||``,rel:`noopener noreferrer`,target:`_blank`,children:(0,q.jsx)(R,{children:(0,q.jsx)(Et,{label:(0,Z.compact)([`#${t.issueNumber}`,t.title]).join(` - `),children:(0,q.jsx)(O,{truncate:!0,style:{maxWidth:250},children:(0,Z.compact)([`#${t.issueNumber}`,t.title]).join(` - `)})})})})})}}),repository:Rd.display({id:`project`,header:`Project/Repository`,size:250,cell:e=>{let t=e.row.original,n=t.repositoryUrl?t.repositoryUrl:t.provider===ot.Gitlab?t.url?.replace(/\/-\/merge_requests\/\w+/i,``):t.repositoryOwner&&t.repositoryName?`https://github.com/${t.repositoryOwner}/${t.repositoryName}`:null,r=t.provider===ot.Gitlab?t.repositoryName:`${t.repositoryOwner}/${t.repositoryName}`;return(0,q.jsx)(R,{children:n?(0,q.jsx)(I,{href:n,rel:`noopener noreferrer`,target:`_blank`,children:r}):`No repo info`})}}),authorMinimal:Rd.display({id:`author`,header:`Author`,cell:e=>(0,q.jsx)(Hd,{author:e.row.original.author,minimal:!0})}),author:Rd.display({id:`author`,header:`Author`,size:250,cell:e=>(0,q.jsx)(Hd,{author:e.row.original.author,minimal:!1})}),mergedAt:Rd.accessor(e=>e,{id:`mergedAt`,header:`Merged`,size:100,cell:e=>{let t=e.row.original;return(0,q.jsx)(De,{label:B(t.mergedAt),children:(0,q.jsx)(O,{truncate:!0,tabIndex:0,children:Qe(t.mergedAt)})})}}),filesChanged:Rd.display({id:`filesChanged`,header:`Files`,size:28,meta:{align:`right`},cell:e=>e.row.original.numberOfFilesChanged})};function Wd({data:e,minimal:t=!1,showMayIncludeCurrentTableAlert:n=!1,highlightedText:r,onClickPrTitle:i,...a}){let o=Rd.display({id:`pullRequests`,header:`Pull request`,size:900,cell:e=>{let t=e.row.original;return(0,q.jsx)(P,{"data-testid":`pull-request-${t.issueNumber}`,gap:`sm`,children:(0,q.jsx)(De,{label:`This pull request is potentially associated with the anomaly`,disabled:!t.isRCA,children:(0,q.jsxs)(I,{href:t.url||``,rel:`noopener noreferrer`,target:`_blank`,onClick:i,children:[(0,q.jsx)(Fe,{highlight:r??``,style:{display:`inline`},children:(0,Z.compact)([`#${t.issueNumber}`,t.title]).join(` - `)}),t.isRCA&&(0,q.jsx)(Me,{size:`sm`,color:`yellow.8`,style:{display:`inline`,verticalAlign:`middle`,position:`relative`,top:-2,marginLeft:4}})]})})})}}),s=t?[Ud.pullRequestsMinimal,Ud.authorMinimal,Ud.mergedAt,Ud.filesChanged]:[Ud.expander,o,Ud.repository,Ud.author,Ud.mergedAt,Ud.filesChanged];return(0,q.jsx)(E,{columns:s,data:e,getRowCanExpand:()=>!t,getRowClassName:e=>
3e.original.isRCA?Ld.highlighted:``,renderSubComponent:({row:e})=>{let t=e.original;return(0,q.jsx)(Ke,{cols:1,children:(0,q.jsx)(Id,{filesChanged:t.filesChanged,numberOfFilesChanged:t.numberOfFilesChanged,showMayIncludeCurrentTableAlert:n,highlightedText:r})})},...a})}var Gd={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getVcsPullRequests`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`cursor`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`filters`}},type:{kind:`ListType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`PullRequestFilterInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`first`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Int`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`orderBy`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}},defaultValue:{kind:`StringValue`,value:`-mergedAt`,block:!1}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`includeFilesChanged`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Boolean`}},defaultValue:{kind:`BooleanValue`,value:!1}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getVcsPullRequests`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`after`},value:{kind:`Variable`,name:{kind:`Name`,value:`cursor`}}},{kind:`Argument`,name:{kind:`Name`,value:`endTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}}},{kind:`Argument`,name:{kind:`Name`,value:`filters`},value:{kind:`Variable`,name:{kind:`Name`,value:`filters`}}},{kind:`Argument`,name:{kind:`Name`,value:`first`},value:{kind:`Variable`,name:{kind:`Name`,value:`first`}}},{kind:`Argument`,name:{kind:`Name`,value:`orderBy`},value:{kind:`Variable`,name:{kind:`Name`,value:`orderBy`}}},{kind:`Argument`,name:{kind:`Name`,value:`startTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`edges`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`cursor`}},{kind:`Field`,name:{kind:`Name`,value:`node`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`provider`}},{kind:`Field`,name:{kind:`Name`,value:`issueNumber`}},{kind:`Field`,name:{kind:`Name`,value:`mergedAt`}},{kind:`Field`,name:{kind:`Name`,value:`repositoryName`}},{kind:`Field`,name:{kind:`Name`,value:`repositoryOwner`}},{kind:`Field`,name:{kind:`Name`,value:`repositoryUrl`}},{kind:`Field`,name:{kind:`Name`,value:`title`}},{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`author`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`url`}},{kind:`Field`,name:{kind:`Name`,value:`avatarUrl`}},{kind:`Field`,name:{kind:`Name`,value:`login`}}]}},{kind:`Field`,name:{kind:`Name`,value:`numberOfFilesChanged`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`includeFilesChanged`}}}]}]},{kind:`Field`,name:{kind:`Name`,value:`filesChanged`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`includeFilesChanged`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`changeType`}},{kind:`Field`,name:{kind:`Name`,value:`path`}}]}}]}}]}}
3,{kind:`Field`,name:{kind:`Name`,value:`pageInfo`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`endCursor`}},{kind:`Field`,name:{kind:`Name`,value:`hasNextPage`}},{kind:`Field`,name:{kind:`Name`,value:`hasPreviousPage`}},{kind:`Field`,name:{kind:`Name`,value:`startCursor`}}]}}]}}]}}]},Kd={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getVcsSummary`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`filters`}},type:{kind:`ListType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`PullRequestFilterInput`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`includeAvailableFilters`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Boolean`}},defaultValue:{kind:`BooleanValue`,value:!1}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getVcsSummary`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`endTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}}},{kind:`Argument`,name:{kind:`Name`,value:`filters`},value:{kind:`Variable`,name:{kind:`Name`,value:`filters`}}},{kind:`Argument`,name:{kind:`Name`,value:`startTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`availableFilters`},directives:[{kind:`Directive`,name:{kind:`Name`,value:`include`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`if`},value:{kind:`Variable`,name:{kind:`Name`,value:`includeAvailableFilters`}}}]}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`filterName`}},{kind:`Field`,name:{kind:`Name`,value:`values`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`value`}}]}}]}},{kind:`Field`,name:{kind:`Name`,value:`totalCount`}}]}}]}}]},qd={searchString:``,selectedRepos:[],selectedAuthors:[]},Jd=yt(()=>({...qd})),{setState:Yd}=Jd,Xd=e=>{Yd({searchString:e})},Zd=e=>{Yd({selectedAuthors:e})},Qd=e=>{Yd({selectedRepos:e})},$d=()=>{Yd(qd)};function ef({startTime:e,endTime:t}){let[n,a]=(0,K.useState)(``),[s]=ze(n,600),{selectedRepos:l,selectedAuthors:u}=Jd();(0,K.useEffect)(()=>{Xd(s),o(i,{[c]:`Search`,SearchString:s})},[s]);let{data:d}=r(Kd,{variables:{startTime:e,endTime:t,includeAvailableFilters:!0}}),f=(0,Z.compact)(d?.getVcsSummary?.availableFilters?.find(e=>e?.filterName===ut.FullRepo)?.values?.map(e=>e?.value?{label:e.value.split(`;`).pop()??e?.value,value:e?.value,checked:l.includes(e?.value)}:null)),p=(0,Z.compact)(d?.getVcsSummary?.availableFilters?.find(e=>e?.filterName===ut.Author)?.values?.map(e=>e?.value?{label:e?.value,value:e?.value,checked:u.includes(e?.value)}:null));return(0,q.jsxs)(P,{grow:!0,align:`flex-end`,pt:`md`,children:[(0,q.jsx)(Zn,{maw:`100%`,label:`Search`,placeholder:`Search by title or file name`,searchString:n,onSearchStringChange:e=>{a(e)},"data-testid":`pull-requests-filter-search`}),(0,q.jsx)(R,{flex:`0 1 400px`,children:(0,q.jsx)(Se,{placeholder:`All projects/repositories`,value:f,withinPortal:!0,label:`Projects/Repositories`,onSelectOnly:({value:e})=>{Qd([e])},onChange:e=>{if(e.every(e=>e.checked)){Qd([]),o(i,{[c]:`Filter by repositories`,Repositories:`All repositories`});return}let t=e.filter(e=>e.checked).map(e=>e.value);Qd(t),o(i,{[c]:`Filter by repositories`,Repositories:t})},"data-testid":`pull-requests-filter-repos`})}),(0,q.jsx)(R,{flex:`0 1 400px`,children:(0,q.jsx)(Se,{placeholder:`All authors`,value:p,withinPortal:!0,label:`Authors`,onSelectOnly:({value:e})=>{Zd([e])},onChange:e=>{if(e.every(e=>e.checked)){Zd([]),o(i,{[c]:`Filter by authors`,Authors:`All authors`});return}let t=e.filter(e=>e.checked).map(e=>e.value);Zd(t),o(i,{[c]:`Filter by authors`,Authors:t})},"data-testid":`pull-requests-filter-authors`})})]})}function tf(){let{selectedAuthors:e,selectedRepos:t,searchString:n}=Jd(),r=[];return t.length&&r.push({filterName:ut.FullRepo,values:t}),e.length&&r.push({filterName:ut.Author,values:e}),n.trim()&&r.push({filterName:ut.TextSearch,values:[n.trim()]}),r}function nf({startTime:e,endTime:t}){let[n,a]=(0,K.useState)([{id:`mergedAt`,desc:!0}]),{paginationState:s,handlePaginationChange:l}=Xn(),u=tf(),{data:d,loading:f,error:p,fetchMore:m}=r(Gd,{variables:{first:s.pageSize,startTime:e,endTime:t,includeFilesChanged:!0,orderBy:n[0]?.desc?`-${n[0]?.id}`:n[0]?.id,filters:u.length?u:void 0}}),{data:h}=r(Kd,{variables:{startTime:e,endTime:t,filters:u.length?u:void 0}});function g(){if(f)return(0,q.jsx)(D,{gap:`xs`,children:Array.from({length:10}).map((e,t)=>(0,q.jsx)(ce,{height:30},t))});if(p)return(0,q.jsx)(ae,{variant:`danger`,children:p.message??`Error loading pull requests`});let e=(0,Z.compact)(d?.getVcsPullRequests?.edges.map(e=>{let t=e?.node;return t?{id:t.id,provider:t.provider,title:t.title,url:t.url,repositoryName:t.repositoryName,repositoryOwner:t.repositoryOwner,repositoryUrl:t.repositoryUrl,author:t.author,filesChanged:t.filesChanged?.map(e=>({path:e?.path,changeType:e?.changeType})),issueNumber:t.issueNumber,mergedAt:t.mergedAt,numberOfFilesChanged:t.numberOfFilesChanged}:null}));return e.length?(0,q.jsx)(Wd,{data:e,totalRowCount:h?.getVcsSummary?.totalCount??0,manualPagination:!0,paginationState:s,manualSorting:!0,enableSorting:!0,sortingState:n,onSortingChange:e=>{a(e)},onPaginationChange:e=>l(e,m,d?.getVcsPullRequests?.pageInfo.endCursor),highlightedText:u.find(e=>e.filterName===ut.TextSearch)?.values?.[0]??``,onClickPrTitle:()=>{o(i,{[c]:`Click link to pull request`})}}):(0,q.jsx)(ae,{variant:`info`,children:`No pull requests found`})}return(0,q.jsxs)(D,{children:[(0,q.jsx)(ef,{startTime:e,endTime:t}),g()]})}var rf=e=>{let t=!!e.warehouse?.dataSamplingEnabled,n=Gc(e),r=e.eventType===H.ValidationAnom,i=e.eventType===H.CustomRuleAnom&&cn(As(n.rule?.rule_type));return t&&(r||i)},af=(e,t)=>
3{let n=!!e.warehouse?.dataSamplingEnabled,r=Gc(e),i=e.eventType===H.ValidationAnom,a=e.eventType===H.CustomRuleAnom&&cn(As(r.rule?.rule_type)),o=t===V.FieldQuality;return n&&(i||a&&!o)},of=e=>{let t=Gc(e);return e.eventType===H.CustomRuleAnom&&cn(As(t.rule?.rule_type))},sf=()=>{let{customRuleQueryData:e,selectedEvent:t}=vd();if(!t||!e)return!1;let n=e.getCustomRule?.ruleType;return af(t,n)},cf=(0,K.createContext)(null);function lf({children:e,eventsCount:t,groups:n,eventsById:r}){let i=(0,K.useMemo)(()=>({eventsCount:t,groups:n,eventsById:r}),[t,n,r]);return(0,q.jsx)(cf.Provider,{value:i,children:e})}function uf(){return(0,K.useContext)(cf)||null}var df=e=>{let t=sf(),n=uf();if(!e)return!1;let r=e?n?.eventsById[e]:null,i=n?.groups.find(t=>t.events.some(t=>t.uuid===e))?.events??[];return r?(rf(r)||t)&&i.length>1:!1},ff=(0,K.createContext)(void 0),pf=(0,K.createContext)(void 0),mf=()=>{let e=(0,K.useContext)(ff);if(e===void 0)throw Error(`useAlertContext must be used within an AlertContext.Provider`);return e.alert},hf=()=>(0,K.useContext)(ff)?.alert,gf=()=>mf().title,_f=()=>{let e=(0,K.useContext)(ff);if(e===void 0)throw Error(`useAlertSummary must be used within an AlertContext.Provider`);return e.summary},vf=()=>{let e=(0,K.useContext)(pf);if(e===void 0)throw Error(`useLatestEventFromContext must be used within a LatestEventContext.Provider`);return e.latestEvent},yf=()=>(0,K.useContext)(pf)?.latestEventLoading??!1,bf=function(e){return e.UPDATES=`updates`,e.PRS=`prs`,e}({}),xf=[H.FreshAnom,H.UnchangedSizeAnom,H.SizeDiff];function Sf({startTime:e,endTime:t,onZoom:n,onReset:r}){let i=(0,K.useRef)(void 0),a=(0,K.useRef)(void 0);return(0,K.useEffect)(()=>{let n=a.current;n&&(!S(e).isSame(n.start)||!S(t).isSame(n.end))&&(i.current=void 0,a.current=void 0)},[t,e]),{handleZoom:(0,K.useCallback)((r,o)=>{i.current??={start:S(e),end:S(t)},a.current={start:r,end:o},n?.(r,o)},[t,n,e]),resetExternalRange:(0,K.useCallback)(()=>{let e=i.current;e&&(i.current=void 0,a.current=void 0,r?r():n?.(e.start,e.end))},[r,n])}}var Cf=35,wf=100,Tf=({label:e,topOffset:t=Cf,bottomOffset:n=wf,side:r=`left`})=>{let{ref:i,height:a}=Ue(),o=(0,K.useRef)(null),[s,c]=(0,K.useState)(!1);return(0,K.useLayoutEffect)(()=>{let e=o.current;c(!!(e&&e.scrollWidth>e.clientWidth))},[e,a]),(0,q.jsx)(`div`,{ref:i,style:{alignSelf:`flex-start`,position:`relative`,top:t,width:20,height:`calc(100% - ${t}px - ${n}px)`,display:`flex`,justifyContent:`center`,alignItems:`center`,overflow:`hidden`},children:(0,q.jsx)(De,{label:e,position:r,withinPortal:!0,disabled:!s,events:{hover:!0,focus:!0,touch:!0},children:(0,q.jsx)(O,{ref:o,tabIndex:s?0:void 0,style:{fontSize:12,fontWeight:500,transform:r===`right`?`rotate(90deg)`:`rotate(-90deg)`,whiteSpace:`nowrap`,width:`max-content`,maxWidth:a||void 0,flexShrink:0,overflow:`hidden`,textOverflow:`ellipsis`},children:e})})})},Ef=20;function Df({timeAxisLabel:e,zoomPattern:t}){return hc({timeAxisLabel:e,zoomPattern:t})+Ef}function Of({startTime:e,endTime:t,metricName:n,metricDisplayName:r,metricIsPercentage:a,metricValuesAreAlreadyPercent:s,timeAxisLabel:l,valueAxisLabel:u,isSegmented:d,events:h,fhEvents:g,height:_=300,showThresholds:v,showTable:y,tableVariant:b,showChart:x=!0,onChartReady:S,onEventClick:C,onDataPointClick:w,isCustomRule:T,renderCustomTooltip:E,dataPointClickHint:O,eventClickHint:ee,emphasizeFalsePositives:k,zoomPattern:A=lc.SLIDER,disableClickAndDragZoom:j=!1,onClickAndDragZoom:N,onClickAndDragZoomReset:te,selectedEventUuidForAnomalyMarkPoint:ne,showLegends:F=!0,legendItemVisibility:ie,metricsState:I,monitorState:oe,pullRequestsState:se,maintenanceWindowsState:le,trainingWindowsState:ue,detectorStatusState:de,freshnessLastUpdateState:fe,ucsLastUpdateState:pe,hasGitHubIntegrationsState:L,hidePullRequestsTabInTable:me,isAlertsRedesignSecondPhaseEnabled:he,auxiliaryMetric:ge,auxiliaryMetricsState:_e}){let ve=m(),ye=p(it.GraphqlMutate),xe=ve(f.VIEW_ALL_PRS)&&h?.find(e=>e.eventType&&xf.includes(e.eventType)),Se=(0,K.useRef)(null),Ce=(0,K.useRef)(void 0),[we,Te]=(0,K.useState)(),[Ee,Oe]=(0,K.useState)(!1),ke=(0,K.useRef)(!1),{handleZoom:Ae,resetExternalRange:je}=Sf({startTime:e,endTime:t,onZoom:N,onReset:te});Nd(Ce),Sd({events:h,chartRef:Ce,chartInstance:we,chartContainerRef:Se,onEventClick:C,onDataPointClick:w,onClickAndDragZoom:N?Ae:void 0});let Me=tf(),{data:Ne,loading:Pe,error:Fe,hasData:Ie,metricsOutOfRange:Le}=I,{data:z}=oe,Re=z?.version===`2`&&z?.aggTimeInterval===gt.Day,{data:ze,hasMoreToFetch:Be}=se,{maintenanceWindows:Ve}=le,{trainingWindows:He}=ue,{data:Ue}=de,{lastUpdate:We}=fe,{lastUpdate:Ge}=pe,Ke=df(ne),qe=hf()?.id,Je=(We??Ge)?.valueOf();
3se.error&&console.error(se.error),le.maintenanceWindowsError&&console.error(le.maintenanceWindowsError),ue.trainingWindowsError&&console.error(ue.trainingWindowsError),de.error&&console.error(de.error),oe.error&&console.error(oe.error),(0,K.useEffect)(()=>()=>{$d()},[]);let Ye=(0,K.useCallback)(e=>{if(e.trainingWindowsEditor=new cc(e),Ce.current=e,Te(e),S?.(e),A===lc.CLICK_AND_DRAG){let t=e=>{if(ke.current)return;let{startValue:t,endValue:n}=fd(e);Oe(t!==void 0&&n!==void 0)};e.on(`dataZoom`,t);let n=requestAnimationFrame(()=>{e.dispatchAction({type:`takeGlobalCursor`,key:`dataZoomSelect`,dataZoomSelectActive:!0})});return()=>{cancelAnimationFrame(n),e.off(`dataZoom`,t)}}},[A,S]),Xe=(0,K.useCallback)(()=>{let e=Ce.current;e&&(ke.current=!0,e.dispatchAction({type:`dataZoom`,start:0,end:100}),je(),e.dispatchAction({type:`takeGlobalCursor`,key:`dataZoomSelect`,dataZoomSelectActive:!0}),Oe(!1),requestAnimationFrame(()=>{ke.current=!1}))},[je]);(0,K.useEffect)(()=>{A!==lc.CLICK_AND_DRAG&&Oe(!1)},[A]),(0,K.useEffect)(()=>{A===lc.CLICK_AND_DRAG&&Ce.current?.dispatchAction({type:`takeGlobalCursor`,key:`dataZoomSelect`,dataZoomSelectActive:!j})},[A,j]);let Ze=(0,K.useMemo)(()=>{let e=new Map;for(let t of h??[]){let n=t.anomaly?.startTime;n&&e.set(n,t)}return e},[h]);if(!Pe&&Fe)return(0,q.jsx)(ae,{variant:`danger`,children:`Error loading data`});if(Le)return(0,q.jsx)(D,{h:_,justify:`center`,children:(0,q.jsx)(Yn,{message:`Data is only available for alerts created within the past 90 days.`})});if(!Pe&&!Ie)return(0,q.jsx)(D,{h:_,justify:`center`,children:(0,q.jsx)(Yn,{})});let Qe=ge&&_e.data.some(({metrics:e})=>e.length>0)?ge.metricDisplayName:void 0,$e=ge&&(_e.error||_e.metricsOutOfRange)?ge.metricDisplayName:void 0,et=x?td({metricName:n,metricDisplayName:r,metricIsPercentage:a,metricValuesAreAlreadyPercent:s,timeAxisLabel:l,isSegmented:d,startTime:e,endTime:t,data:Ne,auxiliaryMetric:ge,auxiliaryData:_e.data,githubData:ze,maintenanceWindows:Ve,trainingWindows:He,detectorStatusData:Ue,lastUpdate:Je,showThresholds:v,events:h,fhEvents:g,canMutate:ye,isCustomRule:T,renderCustomTooltip:E,dataPointClickHint:O,eventClickHint:ee,zoomPattern:A,forceUtcTimezone:Re,isAlerts
3RedesignSecondPhaseEnabled:he,canSwitchBetweenAnomalyMarkPoints:Ke,selectedEventUuidForAnomalyMarkPoint:ne,showLegends:F,legendItemVisibility:ie,currentAlertId:qe,emphasizeFalsePositives:k}):null;function B(){return Pe||L.isLoading?(0,q.jsx)(ce,{w:`100%`,h:`120px`}):(me||!xe||!L.hasGitHubIntegrations)&&Ne[0]?(0,q.jsx)(jd,{data:Ne[0],metricName:n,metricDisplayName:r,eventsByTimestamp:Ze,variant:b}):(0,q.jsxs)(re,{defaultValue:bf.UPDATES,children:[(0,q.jsxs)(re.List,{children:[(0,q.jsx)(re.Tab,{value:bf.UPDATES,children:`Updates`}),(0,q.jsx)(re.Tab,{value:bf.PRS,onClick:()=>{o(i,{[c]:`Click pull requests tab`})},children:(0,q.jsxs)(P,{gap:`xs`,children:[`Pull requests`,Me.length>0&&(0,q.jsx)(De,{label:`One or more filters are applied`,children:(0,q.jsx)(be,{tabIndex:0})})]})})]}),(0,q.jsx)(re.Panel,{value:bf.UPDATES,children:!!Ne[0]&&(0,q.jsx)(jd,{data:Ne[0],metricName:n,metricDisplayName:r,eventsByTimestamp:Ze,variant:b})}),(0,q.jsx)(re.Panel,{value:bf.PRS,children:(0,q.jsx)(nf,{startTime:e,endTime:t})})]})}let tt=et?(0,q.jsx)(Vn,{option:et,settings:nd(),onChartReady:Ye,loading:Pe,"data-testid":`monitor-chart-${n}`}):null;return(0,q.jsxs)(D,{children:[$e&&(0,q.jsxs)(ae,{variant:`warning`,children:[$e,` data is unavailable for the selected period`]}),x&&et&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(R,{"aria-label":`${n} chart`,h:_,ref:Se,pos:`relative`,children:[(0,q.jsxs)(P,{h:`100%`,gap:0,wrap:`nowrap`,children:[u&&(0,q.jsx)(Tf,{label:u,topOffset:mc(F),bottomOffset:Df({timeAxisLabel:l,zoomPattern:A})}),(0,q.jsx)(R,{h:`100%`,style:{flexGrow:1,minWidth:0},children:tt},`chart`),Qe&&(0,q.jsx)(Tf,{side:`right`,label:Qe,topOffset:mc(F),bottomOffset:Df({timeAxisLabel:l,zoomPattern:A})})]}),Ee&&A===lc.CLICK_AND_DRAG&&(0,q.jsx)(M,{size:`compact`,variant:`default`,pos:`absolute`,top:8,right:8,onClick:Xe,children:`Reset zoom`})]}),Be&&(0,q.jsx)(ae,{variant:`info`,children:`Chart limited to 100 recent PRs. See full list in table below or narrow time frame for more focused view.`})]}),y&&B()]})}var kf={total_row_count_change:`total_row_count`,total_byte_count_change:`total_byte_count`};function Af({mcon:e,dwId:t,metricName:n,startTime:r,endTime:i,monitorUUID:a,whereCondition:o,field:s,bulkMonitorId:c,fullTableId:l}){let u=jn(n),d=Rt(n)?void 0:s,f;return c?f={bulkMonitorId:c,fullTableId:l,dwId:t,field:d}:(f={ootb:!a&&u,monitorId:a,field:d,whereCondition:o},u&&e?f.mcon=e:!u&&t&&(f.dwId=t)),{first:Qn,deduplicateValues:ln(n),metricsFilter:f,metricName:kf[n]??n,startTime:r,endTime:i}}function jf({mcon:e,metricName:t,startTime:n,endTime:r,dwId:i,monitorUUID:a,segments:o,onHasDataChange:s,skip:c=!1,bulkMonitorId:l,fullTableId:u}){let d=_(),[f,p]=(0,K.useState)([]),[m,h]=(0,K.useState)(!1),[g,y]=(0,K.useState)(void 0),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)(!1),w=(0,K.useMemo)(()=>o?.length?o.map(({field:o,whereCondition:s})=>({metricName:t,startTime:n,endTime:r,mcon:e,dwId:i,monitorUUID:a,field:o,whereCondition:s,bulkMonitorId:l,fullTableId:u})):[{metricName:t,startTime:n,endTime:r,mcon:e,dwId:i,monitorUUID:a,bulkMonitorId:l,fullTableId:u}],[o,t,n,r,e,i,a,l,u]);return(0,K.useEffect)(()=>{if(c){h(!1);return}let e=!1;return(async()=>{p([]),x(!1),C(!1),s?.(void 0),y(void 0),h(!0);try{let t=await Promise.all(w.map(async e=>{let t=Af(e),n=await d.query({query:er,variables:t,errorPolicy:`all`}),r=v.is(n.error)?n.error.errors:[],i=$n(n.data),a=r.some(e=>e.message===`Metric range is out of bounds`);return{variables:e,metrics:i,isOutOfRange:a,error:n.error&&!a?n.error:void 0}}));if(e)return;let n=t.some(({metrics:e})=>e.length>0);if(C(t.some(({isOutOfRange:e})=>e)),x(n),s?.(n),p(t.map(({variables:e,metrics:t})=>({variables:e,metrics:t}))),!n){let e=t.find(e=>e.error)?.error;e&&y(e)}}catch(t){e||y(t)}finally{e||h(!1)}})(),()=>{e=!0}},[d,s,w,c]),{data:f,loading:m,error:g,hasData:b,metricsOutOfRange:S}}var Mf=y` 4 fragment CustomRuleFilterValueFieldFragment on FilterValueField { 5 id 6 type 7 mcon 8 field 9 } 10`,Nf=y` 11 fragment CustomRuleFilterValueSqlFragment on FilterValueSql { 12 id 13 sql 14 type 15 } 16`,Pf=y` 17 fragment CustomRuleFilterValueLiteralFragment on FilterValueLiteral { 18 id 19 literal 20 type 21 } 22`,Ff=y` 23 fragment CustomRuleFilterValueMapKeyFragment on FilterValueMapKey { 24 id 25 type 26 mapColumn 27 key 28 } 29`,If=y` 30 fragment CustomRuleFilterUnaryFragment on FilterUnary { 31 id 32 type 33 predicate { 34 name 35 negated 36 } 37 value {
38 ...CustomRuleFilterValueFieldFragment 39 ...CustomRuleFilterValueMapKeyFragment 40 } 41 } 42`,Lf=y` 43 fragment CustomRuleFilterBinaryFragment on FilterBinary { 44 id 45 type 46 left { 47 ...CustomRuleFilterValueFieldFragment 48 ...CustomRuleFilterValueMapKeyFragment 49 } 50 predicate { 51 name 52 negated 53 } 54 right { 55 ...CustomRuleFilterValueLiteralFragment 56 ...CustomRuleFilterValueSqlFragment 57 ...CustomRuleFilterValueFieldFragment 58 } 59 } 60`,Rf=y` 61 fragment CustomRuleFilterGroupFragment on FilterGroup { 62 id 63 type 64 operator 65 conditions { 66 type 67 ... on FilterGroup { 68 id 69 type 70 operator 71 conditions { 72 ...CustomRuleFilterUnaryFragment 73 ...CustomRuleFilterBinaryFragment 74 ...CustomRuleFilterSqlFragment 75 } 76 } 77 ...CustomRuleFilterUnaryFragment 78 ...CustomRuleFilterBinaryFragment 79 ...CustomRuleFilterSqlFragment 80 } 81 } 82`,zf=y` 83 fragment CustomRuleFilterSqlFragment on FilterSql { 84 id 85 type 86 sql 87 } 88`,Bf=y` 89 ${If} 90 ${Lf} 91 ${Rf} 92 ${zf} 93 ${Mf} 94 ${Pf} 95 ${Ff} 96 ${Nf} 97 98 query getCustomRule($ruleId: UUID) { 99 getCustomRule(ruleId: $ruleId) { 100 id 101 uuid 102 alertGrouping { 103 mode 104 maxHours 105 renotifyEveryHours 106 } 107 domainUuids 108 domains { 109 uuid 110 name 111 } 112 ruleType 113 agentMcon 114 tags { 115 name 116 value 117 } 118 dataSource { 119 connectionUuid 120 customSql 121 schema { 122 fields { 123 mainType 124 mode 125 name 126 nested 127 sqlName 128 type 129 } 130 } 131 tables { 132 mcon 133 fullTableId 134 } 135 type 136 uuid 137 } 138 sqlBlocks { 139 alertCondition { 140 ...CustomRuleFilterGroupFragment 141 } 142 } 143 agentSpanAlertCondition { 144 operator 145 conditions { 146 type 147 ... on FilterSpanOccurrence { 148 comparisonOperator 149 count 150 predicate { 151 name 152 negated 153 } 154 spanField { 155 type 156 workflow { 157 literal 158 } 159 task { 160 literal 161 } 162 spanName { 163 literal 164 } 165 } 166 } 167 ... on FilterSpanRelation { 168 predicate { 169 name 170 negated 171 } 172 spanField { 173 type 174 workflow { 175 literal 176 } 177 task { 178 literal 179 } 180 spanName { 181 literal 182 } 183 } 184 relatedSpanFields { 185 type 186 workflow { 187 literal 188 } 189 task { 190 literal 191 } 192 spanName { 193 literal 194 } 195 } 196 } 197 } 198 } 199 agentSpanFilters { 200 agent { 201 value 202 } 203 workflow { 204 value 205 } 206 task { 207 value 208 } 209 spanName { 210 value 211 } 212 } 213 isAgentTraceAggregation 214 filters { 215 ...CustomRuleFilterGroupFragment 216 } 217 timeFilter { 218 lookbackInHrs 219 timeField { 220 field 221 type 222 } 223 } 224 timeFilterSqlExpression 225 entityMcons 226 eventRollupCount 227 eventRollupUntilChanged 228 exceptionPrimaryKeyColumn 229 warehouseUuid 230 customSql 231 customSamplingSql 232 queryResultType 233 evaluatedCountMetricName 234 variableDefinitions { 235 name 236 runtime 237 values 238 } 239 intervalMinutes 240 startTime 241 timezone 242 namespace 243 ruleName 244 description 245 createdTime 246 updatedTime 247 nextExecutionTime 248 prevExecutionTime 249 creatorId 250 updaterId 251 isTemplateManaged 252 autoTriage 253 supportsMonitorsAsCode 254 connectionId 255 mcSql 256 generatedBy { 257 uuid 258 } 259 comparisons { 260 comparisonType 261 fullTableId 262 fullTableIds 263 field 264 metric 265 sourceMetric 266 targetMetric 267 operator
268 threshold 269 lowerThreshold 270 upperThreshold 271 thresholdLookbackMinutes 272 thresholdLookbackDataPoints 273 thresholdSensitivity 274 baselineAggFunction 275 baselineIntervalMinutes 276 isFreshnessFromMetadata 277 isThresholdRelative 278 isPercentageThreshold 279 percentageBaselineSql 280 minBuffer { 281 modifierType 282 value 283 } 284 maxBuffer { 285 modifierType 286 value 287 } 288 numberOfAggPeriods 289 } 290 queries(first: 10) { 291 edges { 292 node { 293 uuid 294 connectionUuid 295 name 296 sqlQuery 297 warehouseUuid 298 connectionUuid 299 projects 300 datasets 301 entities 302 entityMcons 303 } 304 } 305 } 306 selection { 307 queryType 308 indexedFieldFilters { 309 fieldName 310 operator 311 values 312 } 313 } 314 scheduleConfig { 315 scheduleType 316 intervalMinutes 317 minIntervalMinutes 318 startTime 319 intervalCrontab 320 intervalCrontabDayOr 321 timezone 322 dynamicScheduleMcons 323 lastTriggerFiredAt 324 } 325 isSnoozed 326 isPaused 327 isDraft 328 snoozeUntilTime 329 conditionalSnooze 330 notes 331 priority 332 labels 333 audienceConditions { 334 audience 335 triagePriority 336 } 337 failureAudiences 338 dataQualityDimension 339 migratedToUuid 340 notificationSettings { 341 uuid 342 recipients 343 recipientsDisplayNames 344 type 345 } 346 fieldMetric { 347 fieldNames 348 metricType 349 tableMcons 350 filters { 351 fieldName 352 operator 353 value 354 } 355 } 356 fieldQueryParameters { 357 tableMcons 358 fieldNames 359 queryType 360 valueList 361 valueSql 362 filters { 363 fieldName 364 operator 365 value 366 } 367 } 368 queryTemplateId 369 queryTemplateVariableValues { 370 name 371 value 372 valueJson 373 } 374 suggestedCustomSamplingSql 375 isMigratedFromFieldQuality 376 timeout 377 } 378 } 379`,Vf={[G.FIELD_HEALTH]:pt.Stats,[G.JSON_SCHEMA]:pt.JsonSchema,[G.CUSTOM_SQL]:V.CustomSql,[G.FRESHNESS_RULE]:V.Freshness,[G.VOLUME_RULE_LEGACY]:V.TableMetric,[G.VOLUME_RULE]:V.Volume,[G.QUERY_PERF_RULE]:V.QueryPerf,[G.VALIDATION]:V.Validation,[G.METRIC_COMPARISON]:pt.MetricComparison,[G.TABLE_MONITOR]:U.Table,[G.BULK_MONITOR]:U.BulkMetric,[G.AGENT_EVALUATION]:U.AgentEvaluation,[G.AGENT_TRAJECTORY]:U.AgentTrajectory,[G.AGENT_METRIC]:U.AgentMetric,[G.AGENT_VALIDATION]:U.AgentValidation,[G.PII_MONITOR]:U.BulkPii},Hf=[V.AgentTrajectory,V.AgentValidation,V.CustomSql,V.Freshness,V.TableMetric,V.Volume,V.FieldQuality,V.QueryPerf,V.Comparison,V.Validation],Uf={[G.FIELD_HEALTH]:`metric monitor`,[G.JSON_SCHEMA]:`JSON schema monitor`,[G.CUSTOM_SQL]:`custom SQL rule`,[G.FRESHNESS_RULE]:`freshness rule`,[G.VOLUME_RULE_LEGACY]:`volume rule`,[G.VOLUME_RULE]:`volume rule`,[G.METRIC]:`metric monitor`,[G.QUERY_PERF_RULE]:`query performance monitor`,[G.VALIDATION]:`validation monitor`,[G.METRIC_COMPARISON]:`comparison monitor`,[G.TABLE_MONITOR]:`table monitor`,[G.BULK_MONITOR]:`multi-table metric monitor`,[G.AGENT_EVALUATION]:`agent evaluation monitor`,[G.AGENT_TRAJECTORY]:`agent trajectory monitor`,[G.AGENT_METRIC]:`agent metric monitor`,[G.AGENT_VALIDATION]:`agent validation monitor`,[G.PII_MONITOR]:`PII monitor`};function Wf(e){return e in Vf}function Gf(e){if(Wf(e))return Vf[e]}function Kf(e){for(let[t,n]of Object.entries(Vf))if(n===e)return t}function qf(e){return!!e&&Hf.includes(e)}var Jf=y` 380 query getMonitors( 381 $monitorTypes: [UserDefinedMonitors] 382 $statusTypes: [MonitorStatusType] 383 $consolidatedStatusTypes: [ConsolidatedMonitorStatusType] 384 $descriptionFieldOrTable: [String] 385 $domainId: UUID 386 $createdByFilters: CreatedByFilters 387 $search: [String] 388 $orderBy: String 389 $limit: Int 390 $offset: Int 391 $uuids: [String] 392 $withScheduleConfig: Boolean! 393 $withSegmentedExpressions: Boolean! 394 $withSelectExpressions: Boolean! 395 $withSelectedMetrics: Boolean! 396 $withSensitivity: Boolean! 397 $labels: [String] 398 $withSegmentCount: Boolean! 399 $createdBy: [String!] 400 $includeOotbReplacement: Boolean 401 $assetTags: [TagKeyValuePairInput!] 402 $mcons: [String] 403 $withAutoApplied: Boolean = false 404 ) { 405 getMonitors( 406 monitorTypes: $monitorTypes 407 statusTypes: $statusTypes 408 consolidatedStatusTypes: $consolidatedStatusTypes 409 descriptionFieldOrTable: $descriptionFieldOrTable 410 domainId: $domainId 411 createdByFilters: $createdByFilters 412 createdBy: $createdBy 413 search: $search 414 orderBy: $orderBy 415 limit: $limit 416 offset: $offset 417 uuids: $uuids 418 labels: $labels 419 includeOotbReplacement: $includeOotbReplacement 420 assetTags: $assetTags
421 mcons: $mcons 422 searchFields: [RULE_NAME, RULE_DESCRIPTION, ENTITIES, MONITOR_FIELDS, NAMESPACE, UPDATER_ID] 423 ) { 424 uuid 425 alertGrouping { 426 mode 427 maxHours 428 renotifyEveryHours 429 } 430 target { 431 uuid 432 dwId 433 connectionUuid 434 timeout 435 whereCondition 436 segments { 437 type 438 ... on FilterValueField { 439 field 440 } 441 ... on FilterValueSql { 442 sql 443 } 444 } 445 dataSource { 446 connectionType 447 type 448 ... on DataSourceInputTable { 449 mcon 450 type 451 schema { 452 fields { 453 name 454 mainType 455 type 456 tzAware 457 # The warehouse's own spelling of the column. Read it so a save 458 # round-trips it: without it the backend defaults sql_name to the 459 # normalized lower-case name, and a Snowflake monitor's quoted 460 # field reference then fails as an invalid identifier. 461 sqlName 462 } 463 } 464 } 465 ... on DataSourceInputSql { 466 sql 467 type 468 schema { 469 fields { 470 name 471 mainType 472 type 473 tzAware 474 # The warehouse's own spelling of the column. Read it so a save 475 # round-trips it: without it the backend defaults sql_name to the 476 # normalized lower-case name, and a Snowflake monitor's quoted 477 # field reference then fails as an invalid identifier. 478 sqlName 479 } 480 } 481 } 482 } 483 } 484 source { 485 uuid 486 dwId 487 connectionUuid 488 timeout 489 whereCondition 490 segments { 491 type 492 ... on FilterValueField { 493 field 494 } 495 ... on FilterValueSql { 496 sql 497 } 498 } 499 dataSource { 500 connectionType 501 type 502 ... on DataSourceInputTable { 503 mcon 504 type 505 schema { 506 fields { 507 name 508 mainType 509 type 510 tzAware 511 # The warehouse's own spelling of the column. Read it so a save 512 # round-trips it: without it the backend defaults sql_name to the 513 # normalized lower-case name, and a Snowflake monitor's quoted 514 # field reference then fails as an invalid identifier. 515 sqlName 516 } 517 } 518 } 519 ... on DataSourceInputSql { 520 type 521 sql 522 schema { 523 fields { 524 name 525 mainType 526 type 527 tzAware 528 # The warehouse's own spelling of the column. Read it so a save 529 # round-trips it: without it the backend defaults sql_name to the 530 # normalized lower-case name, and a Snowflake monitor's quoted 531 # field reference then fails as an invalid identifier. 532 sqlName 533 } 534 } 535 } 536 } 537 } 538 dataSource { 539 uuid 540 connectionUuid 541 customSql 542 transforms { 543 alias 544 categories { 545 label 546 description 547 examples 548 } 549 field 550 fieldValueRange { 551 lowerBound 552 upperBound 553 } 554 function 555 id 556 includeToolCalls 557 prompt 558 outputType 559 sqlExpression 560 modelName 561 modelConnectionId 562 fieldConfigList { 563 field 564 type 565 count 566 } 567 } 568 schema { 569 fields { 570 mainType 571 mode 572 name 573 nested 574 sqlName 575 type 576 tzAware 577 } 578 } 579 tables { 580 mcon 581 fullTableId 582 } 583 type 584 uuid 585 } 586 entities 587 entityMcons 588 agent 589 agentMcon 590 assignedAssetMcons 591 unassignedAssetMcons 592 monitorType 593 customSqlRuleType 594 consolidatedMonitorStatus 595 breached 596 monitorFields 597 timeBucketed 598 monitorTimeAxisFieldName 599 monitorTimeAxisFieldType 600 monitorTimeAxisTimezone 601 resourceId 602 creatorId 603 updaterId 604 ruleDescription 605 ruleVariables 606 createdTime 607 lastUpdateTime 608 scheduleType 609 namespace 610 isTemplateManaged 611 autoTriage
612 supportsMonitorsAsCode 613 migratedToUuid 614 prevExecutionTime 615 nextExecutionTime 616 isSnoozeable 617 isSnoozed 618 isPaused 619 isTunable 620 tuningUnavailableReason 621 lastAutoAppliedTime @include(if: $withAutoApplied) 622 lastAutoAppliedIsPartial @include(if: $withAutoApplied) 623 isDraft 624 conditionalSnooze 625 isTransitioningDataProvider 626 snoozeUntilTime 627 whereCondition 628 segmentedExpressions 629 exceptions 630 breachRate 631 historyDays 632 usePartitionClause 633 connectionId 634 sensitivity @include(if: $withSensitivity) 635 supportsSensitivityUpdate @include(if: $withSensitivity) 636 selectExpressions @include(if: $withSelectExpressions) { 637 id 638 expression 639 dataType 640 isRawColumnName 641 } 642 selectedMetrics @include(if: $withSelectedMetrics) 643 scheduleConfig @include(if: $withScheduleConfig) { 644 startTime 645 scheduleType 646 intervalMinutes 647 minIntervalMinutes 648 intervalCrontab 649 intervalCrontabDayOr 650 timezone 651 dynamicScheduleMcons 652 lastTriggerFiredAt 653 } 654 samplingConfig { 655 count 656 percentage 657 } 658 filters { 659 type 660 operator 661 conditions { 662 __typename 663 ... on FilterBinary { 664 type 665 predicate { 666 name 667 negated 668 } 669 left { 670 type 671 ... on FilterValueField { 672 field 673 } 674 ... on FilterValueMapKey { 675 mapColumn 676 key 677 } 678 ... on FilterValueSql { 679 sql 680 } 681 ... on FilterValueLiteral { 682 literal 683 } 684 } 685 right { 686 type 687 ... on FilterValueField { 688 field 689 } 690 ... on FilterValueMapKey { 691 mapColumn 692 key 693 } 694 ... on FilterValueSql { 695 sql 696 } 697 ... on FilterValueLiteral { 698 literal 699 } 700 } 701 } 702 ... on FilterUnary { 703 type 704 predicate { 705 name 706 negated 707 } 708 value { 709 type 710 ... on FilterValueField { 711 field 712 } 713 ... on FilterValueMapKey { 714 mapColumn 715 key 716 } 717 ... on FilterValueSql { 718 sql 719 } 720 ... on FilterValueLiteral { 721 literal 722 } 723 } 724 } 725 ... on FilterSql { 726 type 727 sql 728 } 729 ... on FilterGroup { 730 type 731 operator 732 conditions { 733 __typename 734 ... on FilterBinary { 735 type 736 predicate { 737 name 738 negated 739 } 740 left { 741 type 742 ... on FilterValueField { 743 field 744 } 745 ... on FilterValueMapKey { 746 mapColumn 747 key 748 } 749 ... on FilterValueSql { 750 sql 751 } 752 ... on FilterValueLiteral { 753 literal 754 } 755 } 756 right { 757 type 758 ... on FilterValueField { 759 field 760 } 761 ... on FilterValueMapKey { 762 mapColumn 763 key 764 } 765 ... on FilterValueSql { 766 sql 767 } 768 ... on FilterValueLiteral { 769 literal 770 } 771 } 772 } 773 ... on FilterUnary { 774 type 775 predicate { 776 name 777 negated 778 } 779 value { 780 type 781 ... on FilterValueField { 782 field 783 } 784 ... on FilterValueMapKey { 785 mapColumn 786 key 787 } 788 ... on FilterValueSql { 789 sql 790 } 791 ... on FilterValueLiteral { 792 literal 793 } 794 } 795 } 796 ... on FilterSql { 797 type 798 sql 799 } 800 } 801 } 802 } 803 } 804 segmentedExpressions @include(if: $withSegmentedExpressions) 805 segmentationType @include(if: $withSegmentedExpressions) 806 notes 807 priority
808 dataQualityDimension 809 segmentCount @include(if: $withSegmentCount) 810 aggTimeInterval 811 labels 812 audienceConditions { 813 audience 814 triagePriority 815 } 816 failureAudiences 817 name 818 description 819 domainUuids 820 domains { 821 uuid 822 name 823 } 824 agentSpanFilters { 825 agent { 826 value 827 } 828 spanName { 829 value 830 } 831 task { 832 value 833 } 834 workflow { 835 value 836 } 837 } 838 comparisons { 839 metric 840 field 841 fields 842 sourceField 843 targetField 844 operator 845 threshold 846 isThresholdRelative 847 lowerThreshold 848 upperThreshold 849 comparisonType 850 baselineTrailingDays 851 baselineStart 852 baselineEnd 853 numBins 854 customMetric { 855 uuid 856 displayName 857 metricName 858 sqlExpression 859 sourceSqlExpression 860 targetSqlExpression 861 } 862 } 863 highSegmentCount 864 minSegmentRowCount 865 minSegmentRowCountShare 866 notificationSettings { 867 uuid 868 recipients 869 recipientsDisplayNames 870 type 871 } 872 dashboards { 873 id 874 title 875 } 876 tags { 877 name 878 value 879 } 880 sevenDaysIncidentCount 881 incidentCountHistory { 882 day 883 incidentCount 884 } 885 commentsCount 886 collectionLagHours 887 clusteringSpaceUuid 888 clusterKeys 889 bootstrap { 890 state 891 exceptionsDetail { 892 type 893 description 894 } 895 startedAt 896 finishedAt 897 daysLoaded 898 estimatedSecondsRemaining 899 progressPercent 900 } 901 version 902 timeout 903 udmType 904 isAgentTraceAggregation 905 isAgentConversationAggregation 906 } 907 } 908`,Yf=y` 909 fragment AssetFiltersGetTableMonitor on AssetFilterInterface { 910 type 911 ... on AssetFilterTableName { 912 tableName 913 tableNameOperator 914 negated 915 } 916 ... on AssetFilterFullTableId { 917 fullTableId 918 negated 919 } 920 ... on AssetFilterTableType { 921 tableType 922 negated 923 } 924 ... on AssetFilterTableTag { 925 tableTags 926 tableTagsOperator 927 negated 928 } 929 ... on AssetFilterActivityRead { 930 readDays 931 negated 932 } 933 ... on AssetFilterActivityReadWrite { 934 readWriteDays 935 negated 936 } 937 ... on AssetFilterActivityReadAndWrite { 938 readAndWriteDays 939 negated 940 } 941 ... on AssetFilterActivityWrite { 942 writeDays 943 negated 944 } 945 ... on AssetFilterActivityReadIsNull { 946 type 947 readActivityIsNull 948 } 949 ... on AssetFilterActivityWriteIsNull { 950 type 951 writeActivityIsNull 952 } 953 ... on AssetFilterActivityReadWriteIsNull { 954 type 955 readWriteActivityIsNull 956 } 957 ... on AssetFilterActivityReadAndWriteIsNull { 958 type 959 readAndWriteActivityIsNull 960 } 961 ... on AssetFilterActivityVolumeChange { 962 volumeChangeDays 963 negated 964 } 965 } 966 967 query getTableMonitor($monitorUuid: UUID!) { 968 getTableMonitor(monitorUuid: $monitorUuid) { 969 uuid 970 isTemplateManaged 971 autoTriage 972 alertGrouping { 973 mode 974 maxHours 975 renotifyEveryHours 976 } 977 warehouseUuid 978 description 979 assetSelection { 980 databases { 981 name 982 schemas 983 } 984 filters { 985 ...AssetFiltersGetTableMonitor 986 } 987 filtersJoiner 988 exclusions { 989 ...AssetFiltersGetTableMonitor 990 } 991 exclusionsJoiner 992 } 993 alertConditions { 994 metric 995 } 996 notes 997 priority 998 audiences 999 audienceConditions { 1000 audience 1001 triagePriority 1002 } 1003 failureAudiences 1004 isPaused 1005 createdTime 1006 updatedTime 1007 domainRestrictions 1008 domains { 1009 uuid 1010 name 1011 } 1012 enableRowCountCollection 1013 enableRowCountCollectionLimit 1014 dataQualityDimension 1015 sensitivity 1016 tags { 1017 name 1018 value 1019 } 1020 isDraft 1021 __typename 1022 } 1023 } 1024`;function Xf(e,t=void 0,n={}){let i=n.isCustomRule===void 0?t?qf(t):void 0:n.isCustomRule,a=t===U.Table,{fetchPolicy:o=`cache-and-network`,...s}=n,{data:c,loading:l,error:u}
1024=r(Jf,{fetchPolicy:o,variables:{uuids:[e],withSegmentCount:!1,withScheduleConfig:!1,withSegmentedExpressions:!1,withSelectExpressions:!1,withSelectedMetrics:!1,withSensitivity:!1,...s},skip:i||!e||n.skip}),{data:d,loading:f,error:p}=r(Yf,{fetchPolicy:o,variables:{monitorUuid:e},skip:!a||!e}),{data:m,loading:h,error:g}=r(Bf,{fetchPolicy:o,variables:{ruleId:e},skip:i===!1||!e||n.skip}),_=h||l||f,v=_?null:m?.getCustomRule||c?.getMonitors?.[0]||d?.getTableMonitor;return(0,K.useMemo)(()=>({data:v,loading:_,error:!_&&!v?g||u||p:null}),[u,g,p,v,_])}var Zf={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getDetectorStatus`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`mcon`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getTable`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`mcon`},value:{kind:`Variable`,name:{kind:`Name`,value:`mcon`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`mcon`}},{kind:`Field`,name:{kind:`Name`,value:`thresholds`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`freshness`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`status`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}},{kind:`Field`,name:{kind:`Name`,value:`expected`}},{kind:`Field`,name:{kind:`Name`,value:`breach`}},{kind:`Field`,name:{kind:`Name`,value:`detectorThreshold`}},{kind:`Field`,name:{kind:`Name`,value:`thresholdHigh`}},{kind:`Field`,name:{kind:`Name`,value:`thresholdMedium`}},{kind:`Field`,name:{kind:`Name`,value:`thresholdLow`}}]}},{kind:`Field`,name:{kind:`Name`,value:`size`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`ucsStatus`}},{kind:`Field`,name:{kind:`Name`,value:`sdStatus`}},{kind:`Field`,name:{kind:`Name`,value:`metric`}},{kind:`Field`,name:{kind:`Name`,value:`ucsUpper`}},{kind:`Field`,name:{kind:`Name`,value:`ucsLower`}},{kind:`Field`,name:{kind:`Name`,value:`ucsThresholdLow`}},{kind:`Field`,name:{kind:`Name`,value:`ucsThresholdMedium`}},{kind:`Field`,name:{kind:`Name`,value:`ucsThresholdHigh`}},{kind:`Field`,name:{kind:`Name`,value:`ucsMinSizeChange`}},{kind:`Field`,name:{kind:`Name`,value:`ucsReason`}},{kind:`Field`,name:{kind:`Name`,value:`sdUpper`}},{kind:`Field`,name:{kind:`Name`,value:`sdUpperLow`}},{kind:`Field`,name:{kind:`Name`,value:`sdUpperMedium`}},{kind:`Field`,name:{kind:`Name`,value:`sdUpperHigh`}},{kind:`Field`,name:{kind:`Name`,value:`sdLower`}},{kind:`Field`,name:{kind:`Name`,value:`sdLowerLow`}},{kind:`Field`,name:{kind:`Name`,value:`sdLowerMedium`}},{kind:`Field`,name:{kind:`Name`,value:`sdLowerHigh`}},{kind:`Field`,name:{kind:`Name`,value:`sdReason`}},{kind:`Field`,name:{kind:`Name`,value:`detectorThreshold`}}]}}]}}]}}]}}]};function Qf({mcon:e,startTime:t,endTime:n,events:i,skip:a=!1,filters:o}){let s=m()(f.VIEW_ALL_PRS),c=window.location.pathname.startsWith(`/alerts/`),l=s&&c&&i?.find(e=>[H.FreshAnom,H.UnchangedSizeAnom,H.SizeDiff].includes(e.eventType)),{data:u,error:d}=r(Kn,{skip:a||l,variables:{mcon:e,first:100,startTime:t,endTime:n}}),{data:p,error:h}=r(Gd,{skip:a||!l,variables:{first:100,startTime:t,endTime:n,filters:o}}),g=l?p?.getVcsPullRequests:u?.getGithubPullRequestsForTableV2;return{data:(0,Z.compact)(g?.edges.map(e=>e?.node?{...e.node}:null)),error:l?h:d,hasMoreToFetch:l?p?.getVcsPullRequests?.pageInfo.hasNextPage:!1}}var $f={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getDataMaintenanceEntriesByMcon`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`mcon`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}}
1024,type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`metricType`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`DataMaintenanceMetric`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getDataMaintenanceEntriesByMcon`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`mcon`},value:{kind:`Variable`,name:{kind:`Name`,value:`mcon`}}},{kind:`Argument`,name:{kind:`Name`,value:`startTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}}},{kind:`Argument`,name:{kind:`Name`,value:`endTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}}},{kind:`Argument`,name:{kind:`Name`,value:`metricType`},value:{kind:`Variable`,name:{kind:`Name`,value:`metricType`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`accountUuid`}},{kind:`Field`,name:{kind:`Name`,value:`createdTime`}},{kind:`Field`,name:{kind:`Name`,value:`database`}},{kind:`Field`,name:{kind:`Name`,value:`dataset`}},{kind:`Field`,name:{kind:`Name`,value:`endTime`}},{kind:`Field`,name:{kind:`Name`,value:`fullTableId`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`maintenanceType`}},{kind:`Field`,name:{kind:`Name`,value:`monitorId`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}},{kind:`Field`,name:{kind:`Name`,value:`reasonType`}},{kind:`Field`,name:{kind:`Name`,value:`resourceUuid`}},{kind:`Field`,name:{kind:`Name`,value:`startTime`}},{kind:`Field`,name:{kind:`Name`,value:`updatedTime`}}]}}]}}]},ep={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getDataMaintenanceEntriesByMonitor`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`monitorId`}},type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`UUID`}}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`DateTime`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`field`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`metric`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`whereCondition`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getDataMaintenanceEntriesByMonitor`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`endTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`endTime`}}},{kind:`Argument`,name:{kind:`Name`,value:`monitorId`},value:{kind:`Variable`,name:{kind:`Name`,value:`monitorId`}}},{kind:`Argument`,name:{kind:`Name`,value:`startTime`},value:{kind:`Variable`,name:{kind:`Name`,value:`startTime`}}},{kind:`Argument`,name:{kind:`Name`,value:`field`},value:{kind:`Variable`,name:{kind:`Name`,value:`field`}}},{kind:`Argument`,name:{kind:`Name`,value:`metric`},value:{kind:`Variable`,name:{kind:`Name`,value:`metric`}}},{kind:`Argument`,name:{kind:`Name`,value:`whereCondition`},value:{kind:`Variable`,name:{kind:`Name`,value:`whereCondition`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`accountUuid`}},{kind:`Field`,name:{kind:`Name`,value:`createdTime`}},{kind:`Field`,name:{kind:`Name`,value:`database`}},{kind:`Field`,name:{kind:`Name`,value:`dataset`}},{kind:`Field`,name:{kind:`Name`,value:`endTime`}},{kind:`Field`,name:{kind:`Name`,value:`fullTableId`}},{kind:`Field`,name:{kind:`Name`,value:`id`}},{kind:`Field`,name:{kind:`Name`,value:`maintenanceType`}}
1024,{kind:`Field`,name:{kind:`Name`,value:`monitorId`}},{kind:`Field`,name:{kind:`Name`,value:`reason`}},{kind:`Field`,name:{kind:`Name`,value:`reasonType`}},{kind:`Field`,name:{kind:`Name`,value:`resourceUuid`}},{kind:`Field`,name:{kind:`Name`,value:`startTime`}},{kind:`Field`,name:{kind:`Name`,value:`updatedTime`}}]}}]}}]};function tp(e,t,n){let{data:i,loading:a,error:o}=Xf(e,t,n),{data:s,loading:c,error:l}=r(Bf,{variables:{ruleId:i?.generatedBy?.uuid},skip:!i?.generatedBy?.uuid});return{childMonitor:i,parentMonitor:s?.getCustomRule,loading:a||c,error:o||l}}function np({mcon:e,monitorUUID:t,hasData:n,skip:i,startTime:a,endTime:o,metricName:s,isCustomRule:c,segment:l,entries:u}){let d=u!==void 0,{parentMonitor:f,loading:p}=tp(t,U.CustomSql,{isCustomRule:c,skip:d}),{data:m,error:h}=r($f,{fetchPolicy:`network-only`,skip:!e||!n||i||d,variables:{mcon:e,startTime:a,endTime:o,metricType:Bt({metricName:s})}}),{data:g,error:_}=r(ep,{fetchPolicy:`network-only`,skip:!t||!n||p||i||d,variables:{monitorId:c&&f?.uuid?f.uuid:t,startTime:a,endTime:o}}),{data:v,error:y}=r(ep,{fetchPolicy:`network-only`,skip:!t||!n||!l||i||d,variables:{monitorId:t,startTime:a,endTime:o,field:l?.field||void 0,metric:s,whereCondition:l?.whereCondition}}),{data:b,error:x}=r(ep,{fetchPolicy:`network-only`,skip:!(c&&f?.uuid)||!t||!n||p||i||d,variables:{monitorId:t,startTime:a,endTime:o}}),S=(0,Z.compact)(u??[...m?.getDataMaintenanceEntriesByMcon??[],...g?.getDataMaintenanceEntriesByMonitor??[]]);for(let e of(0,Z.compact)([...v?.getDataMaintenanceEntriesByMonitor??[],...b?.getDataMaintenanceEntriesByMonitor??[]]))S.push({...e,applyToVariation:!0});return S=S.filter(e=>e?.startTime&&e?.endTime&&e?.reasonType===st.Training),{trainingWindows:S,trainingWindowsError:h||_||y||x}}function rp({skip:e,mcon:t,startTime:n,endTime:i,metricType:a,monitorId:o,entries:s}){let c=s!==void 0,{data:l,error:u}=r($f,{skip:e||c,variables:{mcon:t,startTime:n,endTime:i,metricType:a}}),{data:d,error:f}=r(ep,{skip:!o||c,variables:{monitorId:o,startTime:n,endTime:i}});return{maintenanceWindows:(0,Z.uniqBy)((0,Z.compact)(s??[...l?.getDataMaintenanceEntriesByMcon??[],...d?.getDataMaintenanceEntriesByMonitor??[]]).filter(e=>e?.startTime&&e?.endTime&&e?.reasonType!==st.Training),e=>e.id),maintenanceWindowsError:f||u}}function ip(e,t){return(0,Z.isEmpty)(e)&&(0,Z.isEmpty)(t)||e===t}function ap(e,t){return(0,K.useMemo)(()=>!e||(0,Z.isEmpty)(t)?e:(0,Z.compact)(e.filter(e=>t?.some(t=>{let n=Gc(e)?.originalFhEvent;return ip(t.whereCondition,n?.whereCondition)&&ip(t.field,n?.field)}))),[e,t])}function op({mcon:e,dwId:t,startTime:n,endTime:i,metricName:a,monitorUUID:o,segments:s,events:c,showThresholds:l,showMaintenanceWindows:u,showGitHubPRs:d,isCustomRule:f,onHasDataChange:p,metricsData:m,maintenanceEntries:_,dataError:v,bulkMonitorId:y,fullTableId:b}){let x=h(),S=g(),C=tf(),w=ap(c,s),T=jf({mcon:e,metricName:a,startTime:n||``,endTime:i||``,dwId:t,monitorUUID:o,segments:s,onHasDataChange:p,skip:m!==void 0,bulkMonitorId:y,fullTableId:b}),E=(0,K.useMemo)(()=>m===void 0?T:{data:m,loading:!1,error:v,hasData:m.some(e=>e.metrics.length>0),metricsOutOfRange:!1},[m,v,T]);(0,K.useEffect)(()=>{m!==void 0&&p&&p(m.some(e=>e.metrics.length>0))},[m,p]);let D=Xf(!e&&o&&!f?o:void 0,U.Stats),O=(D.data&&`entityMcons`in D.data?D.data?.entityMcons?.[0]:void 0)??e,ee=Qf({mcon:O,startTime:n||``,endTime:i||``,events:c??[],skip:!O||!E.hasData||!d||!x.hasGitHubIntegrations&&!S.hasGitlabIntegrations||!n||!i,filters:C}),k=rp({skip:!O||!E.hasData||!u||!n||!i,mcon:O,startTime:n,endTime:i,monitorId:o,entries:_,metricType:Bt({metricName:a,monitorUUID:o,isCustomRule:f})}),A=np({mcon:e,monitorUUID:o,hasData:E.hasData,skip:!u||!n||!i,startTime:n||``,endTime:i||``,metricName:a,isCustomRule:f,segment:s?.[0],entries:_}),j=m!==void 0||!e||!E.hasData||!l||!!o||!n||!i;return{hasGitHubIntegrationsState:x,monitorState:D,metricsState:E,pullRequestsState:ee,maintenanceWindowsState:k,trainingWindowsState:A,detectorStatusState:r(Zf,{skip:j||!ln(a),variables:{mcon:e}}),freshnessLastUpdateState:qe(e,`freshness`,j||!Gt(a)),ucsLastUpdateState:qe(e,Zt(a)?`ucs-rows`:`ucs-bytes`,j||!dn(a)),filteredEvents:w}}function sp(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function cp({mcon:e,dwId:t,startTime:n,endTime:r,metricName:i,metricDisplayName:a,metricIsPercentage:o,metricValuesAreAlreadyPercent:s,timeAxisLabel:c,valueAxisLabel:l,segments:u,events:d,fhEvents:f,monitorUUID:p,height:m=300,showThresholds:h,showTable:g,tableVariant:_,showChart:v,showMaintenanceWindows:y,showGitHubPRs:b,onChartReady:x,onEventClick:S,onDataPointClick:C,onHasDataChange:w,isCustomRule:T,renderCustomTooltip:E,dataPointClickHint:D,eventClickHint:O,emphasizeFalsePositives:ee,zoomPattern:k=lc.SLIDER,disableClickAndDragZoom:A=!1,onClickAndDragZoom:j,onClickAndDragZoomReset:M,selectedEventUuidForAnomalyMarkPoint:N,showLegends:te=!0,legendItemVisibility:ne,isSegmented:P,isAlerts
1024RedesignSecondPhaseEnabled:re,hidePullRequestsTabInTable:F,metricsData:ie,maintenanceEntries:I,dataError:ae,bulkMonitorId:oe,fullTableId:se,onSummaryChange:ce,auxiliaryMetric:le}){let{hasGitHubIntegrationsState:ue,monitorState:de,metricsState:fe,pullRequestsState:pe,maintenanceWindowsState:L,trainingWindowsState:me,detectorStatusState:he,freshnessLastUpdateState:ge,ucsLastUpdateState:_e,filteredEvents:ve}=op({mcon:e,dwId:t,startTime:n,endTime:r,metricName:i,monitorUUID:p,segments:u,events:d,showThresholds:h,showMaintenanceWindows:y,showGitHubPRs:b,isCustomRule:T,onHasDataChange:w,metricsData:ie,maintenanceEntries:I,dataError:ae,bulkMonitorId:oe,fullTableId:se}),ye=jf({mcon:e,dwId:t,startTime:n,endTime:r,metricName:le?.metricName??i,monitorUUID:p,segments:le?.segments,skip:!le,bulkMonitorId:oe,fullTableId:se}),be=(0,K.useMemo)(()=>{if(fe.loading||!fe.hasData)return;let e=fe.data.flatMap(e=>e.metrics).flatMap(e=>{let t=sp(e.value);return t===void 0?[]:[{metric:e,value:t}]}),t=e.at(-1);if(t)return{latestValue:t.value,latestTimestamp:t.metric.timestamp??t.metric.measurementTimestamp??void 0,isConstantZero:e.every(({value:e})=>e===0),dataPointCount:e.length}},[fe.data,fe.hasData,fe.loading]);return(0,K.useEffect)(()=>{ce?.(be)},[ce,be]),(0,q.jsx)(Of,{startTime:n,endTime:r,metricName:i,metricDisplayName:a,metricIsPercentage:o,metricValuesAreAlreadyPercent:s,timeAxisLabel:c,valueAxisLabel:l,isSegmented:!!P,events:ve,fhEvents:f,emphasizeFalsePositives:ee,height:m,showThresholds:h,showTable:g,tableVariant:_,showChart:v,onChartReady:x,onEventClick:S,onDataPointClick:C,isCustomRule:T,renderCustomTooltip:E,dataPointClickHint:D,eventClickHint:O,zoomPattern:k,disableClickAndDragZoom:A,onClickAndDragZoom:j,onClickAndDragZoomReset:M,selectedEventUuidForAnomalyMarkPoint:N,showLegends:te,legendItemVisibility:ne,auxiliaryMetric:le,auxiliaryMetricsState:ye,metricsState:fe,monitorState:de,pullRequestsState:pe,maintenanceWindowsState:L,trainingWindowsState:me,detectorStatusState:he,freshnessLastUpdateState:ge,ucsLastUpdateState:_e,hasGitHubIntegrationsState:ue,isAlertsRedesignSecondPhaseEnabled:re,hidePullRequestsTabInTable:F})}var lp=window.navigator.userAgent.includes(`Mac`)?`â`:`Ctrl`;function up(e){return t=>{(t.key===`Enter`||t.keyCode===13)&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e())}}function dp(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())}}var fp={kind:`Document`,definitions:[{kind:`OperationDefinition`,operation:`query`,name:{kind:`Name`,value:`getObjectPropertyNameValues`},variableDefinitions:[{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`searchString`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`excludeString`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`first`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Int`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`offset`}},type:{kind:`NamedType`,name:{kind:`Name`,value:`Int`}}},{kind:`VariableDefinition`,variable:{kind:`Variable`,name:{kind:`Name`,value:`excludeSourceTypes`}},type:{kind:`ListType`,type:{kind:`NonNullType`,type:{kind:`NamedType`,name:{kind:`Name`,value:`String`}}}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`getObjectPropertyNameValues`},arguments:[{kind:`Argument`,name:{kind:`Name`,value:`searchString`},value:{kind:`Variable`,name:{kind:`Name`,value:`searchString`}}},{kind:`Argument`,name:{kind:`Name`,value:`excludeString`},value:{kind:`Variable`,name:{kind:`Name`,value:`excludeString`}}},{kind:`Argument`,name:{kind:`Name`,value:`first`},value:{kind:`Variable`,name:{kind:`Name`,value:`first`}}},{kind:`Argument`,name:{kind:`Name`,value:`offset`},value:{kind:`Variable`,name:{kind:`Name`,value:`offset`}}},{kind:`Argument`,name:{kind:`Name`,value:`excludeSourceTypes`},value:{kind:`Variable`,name:{kind:`Name`,value:`excludeSourceTypes`}}}],selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`N
1024ame`,value:`__typename`}},{kind:`Field`,name:{kind:`Name`,value:`propertyNameValues`},selectionSet:{kind:`SelectionSet`,selections:[{kind:`Field`,name:{kind:`Name`,value:`name`}},{kind:`Field`,name:{kind:`Name`,value:`value`}}]}},{kind:`Field`,name:{kind:`Name`,value:`hasNextPage`}}]}}]}}]},pp={ID:`data-id`,LABEL:`data-label`,TYPE_KEY:`data-type`,TYPE_VALUE:`mention`,SUGGESTION_CHAR:`data-mention-suggestion-char`},mp={MENTION:`mention`},hp=/@([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,gp=/\b((?:https?:\/\/|www\.)[^\s<>",'()[\]]+(?:\([^\s<>"']*\))?)/gi,_p=e=>e?.type===`text`?e.text?.length??0:(e?.content===void 0&&e?.type,1);function vp(e,t){if(!e.content)return null;let n=1,r=null,i=-1;for(let a=0;a<e.content.length;a++){let o=e.content[a];if(!o?.content){n+=_p(o);continue}let s=o.content.reduce((e,t)=>e+_p(t),0),c=n+s;if(t>=n+1&&t<=c){r=o,i=a;break}n=c+2}if(!r)return null;let a=``;for(let e of r.content||[])e.type===`text`&&e.text&&(a+=e.text);let o=0,s=n+1;for(let e of r.content||[]){let n=_p(e);if(t<=s+n){e.type===`text`&&e.text&&(o+=t-s);break}e.type===`text`&&e.text&&(o+=e.text.length),s+=n}return{block:r,blockIndexInDoc:i,blockText:a,textCursorIndex:o}}function yp(e,t,n){let r=vp(t,n);if(!r)return t;let{block:i,blockIndexInDoc:a,blockText:o,textCursorIndex:s}=r,c=o.substring(0,s).lastIndexOf(`@`);if(c===-1)if(o.charAt(s)===`@`)c=s;else if(s>0&&o.charAt(s-1)===`@`)c=s-1;else return t;let l=o.length,u=c+1,d=o.substring(u).match(/([\s,.;:?!])/);l=d?u+d.index:o.length;let f=e.map(e=>({type:`mention`,attrs:{id:e,label:e,mentionSuggestionChar:`@`}})),p=i.content||[],m=[],h=0;for(let e of p)if(e.type===`text`&&e.text){let t=e.text,n=h,r=h+t.length;if(c<r&&l>n){let e=c-n,r=t.substring(0,e);e>0&&m.push({type:`text`,text:r}),m.push(...f);let i=l-n,a=t.substring(i);a.length>0&&m.push({type:`text`,text:a})}else m.push(e);h+=t.length}else m.push(e);let g=(0,Z.cloneDeep)(t);return g.content[a].content=m,g}var bp=e=>{let t=document.createElement(`div`);return t.innerHTML=e,t.querySelectorAll(`[${pp.ID}]`).forEach(e=>{let t=e.getAttribute(pp.ID);t&&e.replaceWith(`@${t}`)}),t.querySelectorAll(`pre`).forEach(e=>{let t=(e.querySelector(`code`)?.textContent??e.textContent??``).replace(/\n$/,``);e.replaceWith(`\n\`\`\`\n${t}\n\`\`\`\n`)}),t.querySelectorAll(`code`).forEach(e=>{let t=e.textContent??``;e.replaceWith(`\`${t}\``)}),t.querySelectorAll(`a`).forEach(e=>{let t=e.getAttribute(`href`),n=e.textContent;t&&n&&e.replaceWith(`[${n}](${t})`)}),t.innerHTML.replace(/<\/p>\s*<p[^>]*>/gi,` 1025`).replace(/<br\s*\/?>/gi,` 1026`).replace(/<[^>]*>/g,``).trim().replace(/([^ \n])\n(?!\n)/g,`$1 1027`)},xp=e=>bp(e.getHTML()),Sp=(e,t)=>{let n=e.view.coordsAtPos(e.state.selection.from),r={width:window.innerWidth,height:window.innerHeight},i=t.getBoundingClientRect(),a=i.width||300,o=i.height||200,s=n.left,c=n.bottom+5;s+a>r.width&&(s=n.left-a,s<0&&(s=Math.max(0,r.width-a))),c+o>r.height&&(c=n.top-o-5,c<0&&(c=5)),t.style.position=`fixed`,t.style.left=`${s}px`,t.style.top=`${c}px`,t.style.zIndex=`1000`},Cp=(e,t,n)=>{let r=()=>{let r=null,{doc:i}=e.state;return i.descendants((e,i)=>{if(e.type?.name===`mention`&&e.attrs?.id===t){let t=Math.abs(i-n);(!r||t<Math.abs(r.pos-n))&&(r={pos:i,size:e.nodeSize})}return!0}),r};requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=n,i=r();i&&(t=i.pos+i.size),e.chain().focus().setTextSelection(t).run()})},wp=(e,t,n)=>{if(e.isDestroyed)return;let r=e.state.selection.from,i=yp(t,e.getJSON(),r);e.commands.setContent(i),n(e.getHTML());let a=t[0];a&&Cp(e,a,r)};export{Xl as $,_f as A,Ac as At,vd as B,xa as Bt,Kf as C,Wc as Ct,ff as D,zc as Dt,Af as E,qc as Et,lf as F,Ls as Ft,ud as G,fd as H,da as Ht,sf as I,Ms as It,rd as J,gd as K,of as L,js as Lt,vf as M,Ys as Mt,yf as N,Js as Nt,pf as O,Rc as Ot,uf as P,$ as Pt,Zl as Q,Wd as R,As as Rt,Gf as S,Uc as St,Bf as T,Kc as Tt,md as U,cr as Ut,hd as V,pa as Vt,dd as W,Lu as X,Qu as Y,gu as Z,Xf as _,rl as _t,mp as a,Ol as at,Hf as b,Bc as bt,fp as c,xl as ct,up as d,fl as dt,Yl as et,cp as f,pl as ft,Zf as g,il as gt,$f as h,ll as ht,pp as i,El as it,gf as j,lc as jt,mf as k,jc as kt,lp as l,yl as lt,ep as m,ul as mt,wp as n,Fl as nt,hp as o,kl as ot,tp as p,dl as pt,sd as q,Sp as r,Dl as rt,gp as s,Tl as st,xp as t,Jl as tt,dp as u,ml as ut,Yf as v,Qc as vt,qf as w,Gc as wt,Uf as x,Vc as xt,Jf as y,Hc as yt,_d as z,X as zt};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.