@obzerver/server 0.17.2 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,7 +13,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
13
13
|
`)},a));continue}let o=/^(#{1,4})\s+(.*)$/.exec(e);if(o){n.push((0,F.jsx)(`div`,{className:`font-semibold text-ink text-[13.5px] mt-1`,children:ea(o[2],a)},a)),r++;continue}if(/^\s*([-*]|\d+[.)])\s+/.test(e)){let i=/^\s*\d/.test(e),o=[];for(;r<t.length&&/^\s*([-*]|\d+[.)])\s+/.test(t[r]);)o.push(t[r++].replace(/^\s*([-*]|\d+[.)])\s+/,``));let s=i?`ol`:`ul`;n.push((0,F.jsx)(s,{className:`${i?`list-decimal`:`list-disc`} ps-5 flex flex-col gap-1`,children:o.map((e,t)=>(0,F.jsx)(`li`,{children:ea(e,`${a}-${t}`)},t))},a));continue}if(!e.trim()){r++;continue}let s=[];for(;r<t.length&&t[r].trim()&&!/^(```|#{1,4}\s|\s*([-*]|\d+[.)])\s+)/.test(t[r]);)s.push(t[r++]);n.push((0,F.jsx)(`p`,{children:s.map((e,t)=>(0,F.jsxs)(v.Fragment,{children:[t>0&&(0,F.jsx)(`br`,{}),ea(e,`${a}-${t}`)]},t))},a))}return(0,F.jsx)(`div`,{className:`flex flex-col gap-2 leading-relaxed`,dir:`auto`,children:n})}var na=[`What changed since yesterday?`,`Why is the API slower this week?`,`Which endpoint spends the most time in the database?`,`Are Redis timeouts related to checkout errors?`,`Which release was the most stable this month?`,`Find problems I haven't noticed yet`],ra=[`Is my app healthy right now?`,`What broke today?`,`What changed since yesterday?`,`What should I fix first?`,`Is my latest deploy OK?`,`Which page is the slowest for my users?`],ia={list_services:`Listed applications`,get_overview:`Read the overview`,list_operations:`Ranked operations`,get_operation:`Opened an operation`,list_slow_executions:`Found the slowest executions`,list_failed_executions:`Found failed executions`,get_execution:`Opened an execution`,get_trace:`Opened a trace`,get_agent_prompt:`Built an investigation brief`,list_error_groups:`Listed error groups`,get_error_details:`Opened an error group`,get_error_trend:`Checked an error trend`,search_logs:`Searched logs`,list_functions:`Read the Services view`,list_queries:`Ranked database queries`,get_runtime:`Read runtime metrics`,list_releases:`Listed releases`,get_release_verdict:`Compared a release`,list_alerts:`Read alerts`,list_issues:`Read issues`,verify_fix:`Checked a fix`,list_slos:`Read SLOs`,get_status_pages:`Read status pages`,get_service_map:`Read the service map`,get_health:`Checked overall health`,get_baseline:`Checked what is normal`,list_secret_leaks:`Checked for leaked secrets`,get_history:`Read long-term history`},aa=e=>e>=43200?`Last ${Math.round(e/1440)} days`:e>=1440?e===1440?`Last 24 hours`:`Last ${Math.round(e/1440)} days`:e>=60?`Last ${Math.round(e/60)} hour${e>=120?`s`:``}`:`Last ${e} min`,z=e=>Object.entries(e).filter(([,e])=>e!=null&&e!==``).map(([e,t])=>`${e}: ${typeof t==`string`?t:JSON.stringify(t)}`).join(` · `),oa=()=>`obz.ask.${qn()}`,sa=()=>{try{return JSON.parse(sessionStorage.getItem(oa())||`[]`).map(e=>({...e,running:!1}))}catch{return[]}},ca=e=>{try{sessionStorage.setItem(oa(),JSON.stringify(e.slice(-20)))}catch{}};function la({open:e,onClose:t,pending:n,onPending:r,simple:i}){let a=P(e?`/api/settings/ai`:null,[e]),[o,s]=(0,v.useState)(sa),c=I(),[l,u]=(0,v.useState)(``),d=(0,v.useRef)(null),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=o.some(e=>e.running);(0,v.useEffect)(()=>{ca(o)},[o]),(0,v.useEffect)(()=>{e&&setTimeout(()=>p.current?.focus(),50)},[e]),(0,v.useEffect)(()=>{f.current?.scrollTo({top:f.current.scrollHeight,behavior:`smooth`})},[o]),(0,v.useEffect)(()=>{e&&n&&a.data&&!m&&(a.data.configured&&g(n),r?.())},[e,n,a.data,m]);let h=e=>s(t=>t.map((n,r)=>r===t.length-1?e(n):n));async function g(e){let t=e.trim();if(!t||m)return;u(``);let n=o.filter(e=>e.answer).slice(-4).flatMap(e=>[{role:`user`,text:e.question},{role:`assistant`,text:e.answer.summary}]);s(e=>[...e,{question:t,steps:[],notes:[],running:!0,started:Date.now()}]);let r=new AbortController;d.current=r;try{let e=await fetch(`/api/ai/ask`,{method:`POST`,credentials:`same-origin`,signal:r.signal,headers:{"content-type":`application/json`,"x-obzerver-project":qn()},body:JSON.stringify({question:t,history:n,mode:i?`simple`:`advanced`})});if(!e.ok||!e.body){let t=e.statusText;try{t=(await e.json()).error||t}catch{}throw Error(t)}let a=e.body.getReader(),o=new TextDecoder,s=``;for(;;){let{value:e,done:t}=await a.read();if(t)break;s+=o.decode(e,{stream:!0});let n;for(;(n=s.indexOf(`
|
|
14
14
|
|
|
15
15
|
`))>=0;){let e=s.slice(0,n);if(s=s.slice(n+2),!e.startsWith(`data: `))continue;let t=JSON.parse(e.slice(6));t.type===`step`?h(e=>({...e,steps:[...e.steps,{id:t.id,tool:t.tool,input:t.input}]})):t.type===`step_done`?h(e=>({...e,steps:e.steps.map(e=>e.id===t.id?{...e,done:{ok:t.ok,summary:t.summary,ms:t.ms}}:e)})):t.type===`note`?h(e=>({...e,notes:[...e.notes,t.text]})):t.type===`answer`?h(e=>({...e,answer:t.answer})):t.type===`error`?h(e=>({...e,error:t.message})):t.type===`usage`&&h(e=>({...e,usage:{tokens:t.tokens,steps:t.steps,capped:t.capped,cost:t.cost??null}}))}}}catch(e){r.signal.aborted?h(e=>({...e,error:e.answer?void 0:`Stopped.`})):h(t=>({...t,error:e.message}))}finally{h(e=>({...e,running:!1,ended:Date.now()})),d.current=null,c.reloadMeta()}}if(!e)return null;let _=a.data?.configured,y=c.meta?.aiBlocked??null;return(0,F.jsxs)(`aside`,{className:`fixed top-0 right-0 bottom-0 w-[480px] max-w-[100vw] z-40 flex flex-col bg-[#0f0f15] border-l border-line2 shadow-2xl`,"aria-label":`Ask Obzeri`,children:[(0,F.jsxs)(`div`,{className:`h-[52px] shrink-0 flex items-center gap-2 px-4 border-b border-line`,children:[(0,F.jsx)(Fi,{size:16,className:`text-brand`}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-semibold text-[14px] leading-tight`,children:`Ask Obzeri`}),(0,F.jsx)(`div`,{className:`text-[11px] text-mute truncate`,children:_?`Answers from this project's telemetry · ${a.data?.model}`:`Not set up`})]}),o.length>0&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`New chat`,onClick:()=>{d.current?.abort(),s([])},children:(0,F.jsx)(_i,{size:14})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Close (Esc)`,onClick:t,children:(0,F.jsx)(Ki,{size:15})})]}),(0,F.jsxs)(`div`,{ref:f,className:`flex-1 overflow-y-auto px-4 py-4 flex flex-col gap-5`,children:[a.data&&!_&&(0,F.jsx)(ua,{onClose:t}),_&&o.length===0&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 mt-2`,children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[13px] leading-relaxed`,children:i?`Ask anything about your app, in your own words and any language. Obzeri reads your app's data to answer, and shows where every answer comes from.`:`Ask about your apps in plain language, in any language. Obzeri answers only by reading this project's data with the same tools as the MCP server, and shows where every answer comes from.`}),(0,F.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:(i?ra:na).map(e=>(0,F.jsxs)(`button`,{className:`text-left rounded-lg border border-line hover:border-line2 hover:bg-panel2 px-3 py-2 text-[12.8px] text-ink2 hover:text-ink flex items-center gap-2`,onClick:()=>g(e),children:[(0,F.jsx)(Fi,{size:12,className:`text-mute shrink-0`}),e]},e))})]}),o.map((e,t)=>(0,F.jsx)(da,{turn:e,onAsk:g,last:t===o.length-1},t))]}),_&&(0,F.jsxs)(`div`,{className:`shrink-0 border-t border-line p-3`,children:[y&&(0,F.jsx)(`div`,{className:`mb-2 rounded-lg border border-[#5a4320] bg-[#1d1810] px-3 py-2 text-[12px] text-[#f5c04e]`,children:y}),(0,F.jsxs)(`form`,{className:`relative`,onSubmit:e=>{e.preventDefault(),g(l)},children:[(0,F.jsx)(`textarea`,{ref:p,dir:`auto`,rows:Math.min(6,Math.max(2,l.split(`
|
|
16
|
-
`).length)),className:`input w-full resize-none !h-auto py-2 pe-11 leading-snug`,placeholder:y?`Paused: budget used`:`Ask about errors, latency, releases, jobs…`,disabled:!!y,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),g(l))}}),m?(0,F.jsx)(`button`,{type:`button`,className:`absolute right-2 bottom-2 btn h-7 w-7 !p-0 justify-center`,title:`Stop`,onClick:()=>d.current?.abort(),children:(0,F.jsx)(Ii,{size:12,fill:`currentColor`})}):(0,F.jsx)(`button`,{className:`absolute right-2 bottom-2 btn btn-primary h-7 w-7 !p-0 justify-center`,title:`Send (Enter)`,disabled:!l.trim(),children:(0,F.jsx)(mr,{size:14})})]}),(0,F.jsxs)(`div`,{className:`text-[10.5px] text-mute mt-1.5 leading-snug`,children:[`Your question and the data the tools return are sent to `,a.data?.provider===`openai`?`your OpenAI-compatible endpoint`:`Anthropic`,`. Enter to send, Shift+Enter for a new line.`]})]})]})}function ua({onClose:e}){let t=ht(),n=Qn();return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 mt-2 text-[13px]`,children:[(0,F.jsx)(`div`,{className:`text-ink2 leading-relaxed`,children:`Ask Obzeri needs a language model. Connect Anthropic (Claude) or any OpenAI-compatible endpoint, including a local model through Ollama, and it will answer questions from this project's telemetry.`}),(0,F.jsx)(`div`,{children:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>{e(),t(n(`/integrations/ai`))},children:[`Set up Ask Obzeri`,(0,F.jsx)(Or,{size:13})]})})]})}function da({turn:e,onAsk:t,last:n}){let[r,i]=(0,v.useState)(!1),a=((e.ended??Date.now())-e.started)/1e3,o=r||e.running&&!e.answer;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsx)(`div`,{className:`self-end max-w-[88%] rounded-xl rounded-br-sm bg-[#22222e] px-3 py-2 text-[13px] whitespace-pre-wrap`,dir:`auto`,children:e.question}),(e.steps.length>0||e.running)&&(0,F.jsxs)(`div`,{className:`rounded-lg border border-line bg-[#121219]`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-[12px] text-ink2 hover:text-ink`,onClick:()=>i(e=>!e),children:[e.running&&!e.answer?(0,F.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-brand border-t-transparent animate-spin`}):(0,F.jsx)(Tr,{size:13,className:`text-[#5fd38a]`}),(0,F.jsx)(`span`,{className:`flex-1 text-left`,children:e.running&&!e.answer?e.steps.length?(ia[e.steps.at(-1).tool]||e.steps.at(-1).tool)+`…`:`Thinking…`:`Read ${e.steps.length} source${e.steps.length===1?``:`s`} · ${a.toFixed(1)}s${e.usage?` · ${fa(e.usage)}`:``}`}),(0,F.jsx)(Or,{size:13,className:`transition-transform ${o?`rotate-90`:``}`})]}),o&&(0,F.jsxs)(`div`,{className:`px-3 pb-2.5 flex flex-col gap-1.5 border-t border-line pt-2`,children:[e.notes.map((e,t)=>(0,F.jsx)(`div`,{className:`text-[12px] text-mute italic`,dir:`auto`,children:e},`n${t}`)),e.steps.map(e=>(0,F.jsxs)(`div`,{className:`flex items-start gap-2 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`mt-[3px] shrink-0`,children:e.done?e.done.ok?(0,F.jsx)(Tr,{size:11,className:`text-[#5fd38a]`}):(0,F.jsx)(Vi,{size:11,className:`text-[#ffb547]`}):(0,F.jsx)(`span`,{className:`block w-2.5 h-2.5 rounded-full border-2 border-mute border-t-transparent animate-spin`})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-ink2`,children:[ia[e.tool]||e.tool,` `,(0,F.jsx)(`span`,{className:`mono text-mute text-[11px]`,children:e.tool})]}),z(e.input)&&(0,F.jsx)(`div`,{className:`mono text-[11px] text-mute break-all`,children:z(e.input)})]}),e.done&&(0,F.jsxs)(`span`,{className:`text-mute text-[11px] shrink-0`,children:[e.done.summary,` · `,e.done.ms,`ms`]})]},e.id))]})]}),e.answer&&(0,F.jsx)(_a,{a:e.answer,onAsk:t,showFollowUps:n&&!e.running}),e.error&&!e.answer&&(0,F.jsx)(`div`,{className:`rounded-lg border border-[#5a2a2a] bg-[#1d1214] px-3 py-2 text-[12.5px] text-[#ff9c9c]`,dir:`auto`,children:e.error})]})}function fa(e){return`${R(e.tokens.input+e.tokens.output)} tokens${e.cost==null?``:` · $${e.cost<.01?e.cost.toFixed(4):e.cost.toFixed(2)}`}${e.capped?` · stopped at the limit`:``}`}var pa={high:{label:`High confidence`,color:`#5fd38a`},medium:{label:`Medium confidence`,color:`#ffb547`},low:{label:`Low confidence`,color:`#ff8a8a`}},ma={execution:ur,trace:Gr,error:xr,operation:ur,release:xi,issue:ni};function ha(e){let t=encodeURIComponent;switch(e.kind){case`execution`:return`/executions/${t(e.ref)}`;case`trace`:return`/traces/${t(e.ref)}`;case`error`:return`/errors/${t(e.ref)}`;case`operation`:return`/operations/${e.opKind||`http`}/${t(e.service||``)}/${t(e.ref)}`;case`release`:return`/releases?service=${t(e.service||``)}&version=${t(e.ref)}`;case`issue`:return`/issues/${t(e.ref)}`}}function ga({title:e,icon:t,children:n}){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10.5px] uppercase tracking-wider text-mute font-medium`,children:[t,e]}),n]})}function _a({a:e,onAsk:t,showFollowUps:n}){let r=ht(),i=Qn(),a=pa[e.confidence];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{className:`text-[13.3px] text-ink`,children:(0,F.jsx)(ta,{text:e.summary})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,F.jsxs)(`span`,{className:`pill !text-[11px] inline-flex items-center gap-1.5`,title:e.confidenceReason,style:{borderColor:`${a.color}55`,color:a.color},children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:a.color}}),a.label]}),e.timeRange&&(0,F.jsxs)(`span`,{className:`pill !text-[11px] inline-flex items-center gap-1`,title:`${new Date(e.timeRange.from).toLocaleString()} → ${new Date(e.timeRange.to).toLocaleString()}`,children:[(0,F.jsx)(Ir,{size:11}),aa(e.timeRange.minutes)]})]}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute -mt-1.5`,dir:`auto`,children:e.confidenceReason}),e.evidence.length>0&&(0,F.jsx)(ga,{title:`Evidence`,icon:(0,F.jsx)(ji,{size:11}),children:(0,F.jsx)(`div`,{className:`rounded-lg border border-line divide-y divide-[#22222c]`,children:e.evidence.map((e,t)=>(0,F.jsxs)(`div`,{className:`px-3 py-1.5 flex items-baseline gap-3 text-[12.3px]`,children:[(0,F.jsx)(`span`,{className:`flex-1 text-ink2`,dir:`auto`,children:e.claim}),(0,F.jsx)(`span`,{className:`mono text-ink text-[12px] text-right`,dir:`auto`,children:e.value})]},t))})}),e.links.length>0&&(0,F.jsx)(ga,{title:`Open in Obzerver`,icon:(0,F.jsx)(ti,{size:11}),children:(0,F.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.links.map((e,t)=>{let n=ma[e.kind];return(0,F.jsxs)(`button`,{onClick:()=>r(i(ha(e))),className:`flex items-center gap-2 rounded-md border border-line hover:border-line2 hover:bg-panel2 px-2.5 py-1.5 text-left text-[12.3px]`,children:[(0,F.jsx)(n,{size:13,className:`text-mute shrink-0`}),(0,F.jsx)(`span`,{className:`text-mute text-[11px] w-[62px] shrink-0`,children:e.kind}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,dir:`auto`,children:e.label}),(0,F.jsx)(Or,{size:12,className:`text-mute`})]},t)})})}),(0,F.jsx)(ga,{title:`Data sources`,icon:(0,F.jsx)(ur,{size:11}),children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.sources.length?e.sources.map(e=>(0,F.jsxs)(`span`,{className:`pill mono !text-[10.5px]`,title:ia[e.tool],children:[e.tool,e.calls>1?` ×${e.calls}`:``]},e.tool)):(0,F.jsx)(`span`,{className:`text-mute text-[12px]`,children:`none: this answer did not read any data`})})}),e.checks.length>0&&(0,F.jsxs)(`div`,{className:`text-[11.5px] text-[#ffb547] flex items-start gap-1.5`,children:[(0,F.jsx)(Vi,{size:12,className:`mt-0.5 shrink-0`}),(0,F.jsxs)(`span`,{children:[`Checked by Obzerver: `,e.checks.join(` `)]})]}),n&&e.followUps.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,children:e.followUps.map(e=>(0,F.jsx)(`button`,{className:`rounded-full border border-line hover:border-line2 hover:bg-panel2 px-2.5 py-1 text-[12px] text-ink2 hover:text-ink`,dir:`auto`,onClick:()=>t(e),children:e},e))})]})}function va(e,t=`/`,n){let r=new URLSearchParams;e!=="default"&&r.set(`project`,e);let i=n?.get(`range`);i&&r.set(`range`,i);let a=r.toString();return a?`${t}?${a}`:t}function ya(){let[e]=zn(),t=ht(),n=e.get(`project`)||`default`,{data:r}=P(`/api/projects`,[n]),[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let s=r?.find(e=>e.slug===n),c=e=>{a(!1),t(e)};return(0,F.jsxs)(`div`,{ref:o,className:`relative px-2 pt-2`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-2 h-[34px] px-2 rounded-md border border-line hover:border-line2 bg-[#121219] text-left`,onClick:()=>a(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":i,children:[(0,F.jsx)(Ur,{size:14,className:`text-mute shrink-0`}),(0,F.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`span`,{className:`block text-[10px] uppercase tracking-wider text-mute leading-none mb-0.5`,children:`Project`}),(0,F.jsx)(`span`,{className:`block truncate text-[12.8px] leading-tight`,children:s?.name??(r?n:`…`)})]}),(0,F.jsx)(Ar,{size:13,className:`text-mute shrink-0`})]}),i&&(0,F.jsxs)(`div`,{className:`absolute left-2 right-2 top-[calc(100%+4px)] z-30 rounded-lg border border-line2 bg-[#15151d] shadow-xl py-1`,role:`listbox`,children:[r?.map(t=>(0,F.jsxs)(`button`,{role:`option`,"aria-selected":t.slug===n,onClick:()=>c(va(t.slug,`/`,e)),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-[#1d1d27]`,children:[(0,F.jsx)(`span`,{className:`w-3.5 shrink-0`,children:t.slug===n&&(0,F.jsx)(Tr,{size:13,className:`text-brand`})}),(0,F.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`span`,{className:`block truncate text-[12.8px]`,children:t.name}),(0,F.jsxs)(`span`,{className:`block text-mute text-[11px]`,children:[t.apps,` app`,t.apps===1?``:`s`]})]})]},t.slug)),(0,F.jsx)(`div`,{className:`border-t border-line my-1`}),(0,F.jsxs)(`button`,{onClick:()=>c(`${va(n,`/projects`,e)}${n==="default"&&!e.get(`range`)?`?`:`&`}new=1`),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-[#1d1d27] text-[12.8px]`,children:[(0,F.jsx)(_i,{size:13,className:`ml-0.5`}),`New project`]}),(0,F.jsxs)(`button`,{onClick:()=>c(va(n,`/projects`,e)),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-[#1d1d27] text-[12.8px] text-ink2`,children:[(0,F.jsx)(`span`,{className:`w-3.5`}),`Manage projects`]})]})]})}function B(e,t){return e==null||!Number.isFinite(e)?`—`:e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:e>=100?`${e.toFixed(t??0)}ms`:e>=10?`${e.toFixed(t??1)}ms`:`${e.toFixed(t??2)}ms`}function V(e){return e==null||!Number.isFinite(e)?`—`:Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e4?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2})}function ba(e,t=2){return e==null||!Number.isFinite(e)?`—`:e===0?`0%`:e<.01?`<0.01%`:`${e.toFixed(e>=10?1:t)}%`}function xa(e){return e==null?`—`:e>=1073741824?`${(e/1073741824).toFixed(2)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}function Sa(e){if(!e)return`—`;let t=Date.now()-e;return t<0?`just now`:t<6e4?`${Math.max(1,Math.round(t/1e3))}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:t<864e5?`${Math.round(t/36e5)}h ago`:`${Math.round(t/864e5)}d ago`}function Ca(e,t=!1){let n=new Date(e),r=n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});return t?`${n.toLocaleDateString([],{month:`short`,day:`numeric`})} ${r}`:r}function wa(e,t){let n=new Date(e);return t>1728e5?n.toLocaleDateString([],{month:`short`,day:`numeric`}):n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1})}function Ta(e,t){if(e==null||t==null||!Number.isFinite(e)||!Number.isFinite(t)||t===0)return null;let n=(e-t)/t*100;return Math.abs(n)<1?{text:`±0%`,dir:`flat`}:{text:`${n>0?`+`:``}${n.toFixed(0)}%`,dir:n>0?`up`:`down`}}var Ea=encodeURIComponent,Da=864e5,Oa=e=>new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16),ka=e=>e?new Date(e).getTime():NaN,Aa=e=>{let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()};function ja(){let e=I(),[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),l=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!t)return;i(Oa(e.from)),o(Oa(e.to)),c(``);let r=e=>{l.current&&!l.current.contains(e.target)&&n(!1)},a=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`mousedown`,r),window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`mousedown`,r),window.removeEventListener(`keydown`,a)}},[t]);let u=(t,r)=>{if(!Number.isFinite(t)||!Number.isFinite(r))return c(`Pick both dates`);if(r<=t)return c(`"To" must be after "From"`);e.setCustom(t,Math.min(r,Date.now())),n(!1)},d=Date.now(),f=Aa(d),p=[[`Today`,f,d],[`Yesterday`,f-Da,f],[`Same day last week`,f-7*Da,f-6*Da],[`Last 14 days`,d-14*Da,d],[`Last 30 days`,d-30*Da,d],[`Last 90 days`,d-90*Da,d]],m=e.range===`custom`;return(0,F.jsxs)(`div`,{className:`relative`,ref:l,children:[m?(0,F.jsxs)(`div`,{className:`flex items-center gap-1 pill !h-[30px] !px-2.5 !text-[12px] cursor-pointer`,style:{borderColor:`#5a2340`,color:`#ff9cc0`},onClick:()=>n(e=>!e),title:`Change the custom window`,children:[(0,F.jsx)(Sr,{size:12}),Ca(e.from,!0),` → `,Ca(e.to,!0),(0,F.jsx)(`button`,{className:`ml-1 hover:text-white`,onClick:t=>{t.stopPropagation(),e.setRange(`1h`)},title:`Back to live window`,children:(0,F.jsx)(Ki,{size:12})})]}):(0,F.jsx)(`button`,{className:`btn px-2`,onClick:()=>n(e=>!e),title:`Custom time window`,"aria-label":`Custom time window`,children:(0,F.jsx)(Sr,{size:13})}),t&&(0,F.jsxs)(`div`,{className:`absolute right-0 top-[36px] z-50 w-[340px] rounded-lg border border-line2 p-3 shadow-2xl flex flex-col gap-3`,style:{background:`rgba(20,20,27,.99)`},children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium`,children:`Custom window`}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:p.map(([e,t,n])=>(0,F.jsx)(`button`,{className:`btn h-7 justify-start text-[12px]`,onClick:()=>u(t,n),children:e},e))}),(0,F.jsxs)(`div`,{className:`grid grid-cols-[40px_1fr] items-center gap-x-2 gap-y-1.5 text-[12px]`,children:[(0,F.jsx)(`label`,{className:`text-mute`,htmlFor:`rp-from`,children:`From`}),(0,F.jsx)(`input`,{id:`rp-from`,className:`input h-8 mono text-[12px]`,type:`datetime-local`,value:r,max:Oa(d),onChange:e=>i(e.target.value)}),(0,F.jsx)(`label`,{className:`text-mute`,htmlFor:`rp-to`,children:`To`}),(0,F.jsx)(`input`,{id:`rp-to`,className:`input h-8 mono text-[12px]`,type:`datetime-local`,value:a,max:Oa(d),onChange:e=>o(e.target.value)})]}),s&&(0,F.jsx)(`div`,{className:`text-[12px]`,style:{color:`#ff8a8a`},children:s}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute text-[11px] leading-snug`,children:`Older than raw data, Requests, Jobs and the Overview use hourly summaries.`}),(0,F.jsx)(`button`,{className:`btn btn-primary h-7 shrink-0`,onClick:()=>u(ka(r),ka(a)),children:`Apply`})]})]})]})}function H({title:e,sub:t,right:n,children:r,className:i=``,pad:a=!0}){return(0,F.jsxs)(`section`,{className:`card ${i}`,children:[(e||n)&&(0,F.jsxs)(`div`,{className:`card-h`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e}),t&&(0,F.jsx)(`span`,{className:`card-sub truncate`,children:t})]}),n]}),(0,F.jsx)(`div`,{className:a?`p-3.5`:``,children:r})]})}function Ma({title:e,sub:t,right:n,icon:r}){return(0,F.jsxs)(`div`,{className:`flex items-end justify-between gap-4 mb-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`h1`,{className:`text-[19px] font-semibold tracking-tight flex items-center gap-2 min-w-0`,children:[r,(0,F.jsx)(`span`,{className:`truncate`,children:e})]}),t&&(0,F.jsx)(`div`,{className:`text-ink2 mt-1 text-[12.5px]`,children:t})]}),n&&(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:n})]})}function U({label:e}){return(0,F.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-mute py-10`,children:[(0,F.jsx)(ri,{size:16,className:`animate-spin`}),e||`Loading…`]})}function Na({title:e,children:t,icon:n}){return(0,F.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center py-10 px-6 gap-2`,children:[(0,F.jsx)(`div`,{className:`text-mute`,children:n||(0,F.jsx)(Yr,{size:22})}),(0,F.jsx)(`div`,{className:`font-medium`,children:e}),t&&(0,F.jsx)(`div`,{className:`text-mute max-w-md text-[12.5px]`,children:t})]})}var Pa=()=>window.dispatchEvent(new Event(`obz:refresh`));function W({error:e,onRetry:t}){return e?(0,F.jsxs)(`div`,{className:`card px-4 py-10 text-[12.5px] flex flex-col items-center justify-center gap-3 text-center`,role:`alert`,style:{borderColor:`#5a2328`,color:`#ff9b9b`},children:[(0,F.jsx)(Vi,{size:20}),(0,F.jsx)(`div`,{className:`max-w-[560px]`,children:e.message||`Something went wrong loading this.`}),(0,F.jsxs)(`button`,{type:`button`,className:`btn mt-1`,onClick:t??Pa,children:[(0,F.jsx)(bi,{size:13}),`Refresh stats`]})]}):null}function Fa({label:e,value:t,sub:n,deltaText:r,deltaDir:i,deltaTitle:a,badWhen:o=`up`,spark:s,color:c,onClick:l}){return(0,F.jsxs)(`div`,{className:`card px-3.5 py-3 flex flex-col gap-1 min-w-0 ${l?`cursor-pointer hover:border-line2`:``}`,onClick:l,children:[(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] font-medium flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e}),r&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[11px]`,title:a,style:{color:i===`flat`||o===`none`?`var(--color-mute)`:i&&i!==`flat`&&o!==`none`&&i===o?`#ff8a8a`:`#5fd38a`},children:[i===`up`?(0,F.jsx)(mr,{size:11}):i===`down`?(0,F.jsx)(dr,{size:11}):null,r]})]}),(0,F.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,F.jsx)(`div`,{className:`text-[22px] font-semibold tracking-tight tabular-nums leading-none`,style:c?{color:c}:void 0,children:t}),s&&s.length>1&&(0,F.jsx)(Ia,{data:s,color:c})]}),n&&(0,F.jsx)(`div`,{className:`text-mute text-[11.5px] truncate`,children:n})]})}function Ia({data:e,color:t=`var(--color-s1)`,w:n=72,h:r=22}){let i=Math.max(1,...e),a=n/e.length;return(0,F.jsx)(`svg`,{width:n,height:r,className:`shrink-0`,"aria-hidden":!0,children:e.map((e,n)=>{let o=e?Math.max(1.5,e/i*r):0;return(0,F.jsx)(`rect`,{x:n*a+.5,y:r-o,width:Math.max(1,a-1),height:o,rx:1,fill:t,opacity:.85},n)})})}function La({status:e}){if(e==null)return(0,F.jsx)(`span`,{className:`text-mute`,children:`—`});let t=e>=500?`var(--color-crit)`:e>=400?`var(--color-warn)`:`var(--color-good)`;return(0,F.jsx)(`span`,{className:`mono text-[11.5px] px-1.5 py-[1px] rounded`,style:{color:t,background:`color-mix(in srgb, ${t} 14%, transparent)`},children:e})}function Ra({m:e}){if(!e)return null;let t=Ja;return(0,F.jsx)(`span`,{className:`mono text-[10.5px] font-semibold inline-block shrink-0 ${Ya.includes(e)?`min-w-[44px] pr-2`:`w-[44px]`}`,style:{color:t[e]||`var(--color-ink2)`},children:e})}function za({name:e}){let t=/^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|ALL|QUERY|MUTATION|SUBSCRIPTION)\s+(.*)$/.exec(e);return t?(0,F.jsxs)(`span`,{className:`inline-flex items-center min-w-0`,children:[(0,F.jsx)(Ra,{m:t[1]}),(0,F.jsx)(`span`,{className:`mono truncate`,children:t[2]})]}):(0,F.jsx)(`span`,{className:`mono`,children:e})}function G({kind:e,children:t}){let[n,r]={good:[`var(--color-good)`,Mr],warn:[`var(--color-warn)`,jr],serious:[`var(--color-serious)`,jr],crit:[`var(--color-crit)`,jr],neutral:[`var(--color-mute)`,Nr]}[e];return(0,F.jsxs)(`span`,{className:`pill`,style:{color:n,borderColor:`color-mix(in srgb, ${n} 40%, transparent)`,background:`color-mix(in srgb, ${n} 10%, transparent)`},children:[(0,F.jsx)(r,{size:11}),t]})}function Ba({text:e,label:t=`Copy`,className:n=`btn`}){let[r,i]=(0,v.useState)(!1);return(0,F.jsxs)(`button`,{className:n,onClick:async()=>{let t=typeof e==`function`?await e():e;try{await navigator.clipboard.writeText(t)}catch{let e=document.createElement(`textarea`);e.value=t,document.body.appendChild(e),e.select(),document.execCommand(`copy`),e.remove()}i(!0),setTimeout(()=>i(!1),1400)},children:[r?(0,F.jsx)(Tr,{size:13}):(0,F.jsx)(Rr,{size:13}),r?`Copied`:t]})}function Va({value:e,options:t,onChange:n}){return(0,F.jsx)(`div`,{className:`seg`,children:t.map(t=>(0,F.jsx)(`button`,{className:e===t.id?`on`:``,onClick:()=>n(t.id),children:t.label},t.id))})}function Ha({rows:e,cols:t,onRow:n,initialSort:r,initialDir:i=`desc`,empty:a,maxHeight:o,rowKey:s,paged:c,resetKey:l}){let[u,d]=(0,v.useState)(r),[f,p]=(0,v.useState)(i),[m,h]=(0,v.useState)(()=>{try{let e=Number(localStorage.getItem(`obz.pageSize`));return Ua.includes(e)?e:20}catch{return 20}}),[g,_]=(0,v.useState)(0),[y,b]=(0,v.useState)(l);y!==l&&(b(l),_(0));let x=e=>{h(e),_(0);try{localStorage.setItem(`obz.pageSize`,String(e))}catch{}},S=(0,v.useMemo)(()=>{let n=t.find(e=>e.key===u);if(!n||!n.sort)return e;let r=n.sort;return[...e].sort((e,t)=>{let n=r(e),i=r(t),a=typeof n==`number`&&typeof i==`number`?n-i:String(n).localeCompare(String(i));return f===`asc`?a:-a})},[e,t,u,f]);if(!e.length&&a)return(0,F.jsx)(F.Fragment,{children:a});let C=c?Math.max(1,Math.ceil(S.length/m)):1,w=Math.min(g,C-1),T=c?S.slice(w*m,w*m+m):S;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`overflow-auto`,style:o?{maxHeight:o}:void 0,children:(0,F.jsxs)(`table`,{className:`tbl`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{children:t.map(e=>(0,F.jsx)(`th`,{style:{width:e.width},className:`${e.num?`num`:``} ${e.sort?`cursor-pointer select-none hover:text-ink`:``}`,onClick:()=>{e.sort&&(_(0),u===e.key?p(f===`asc`?`desc`:`asc`):(d(e.key),p(`desc`)))},children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[e.label,u===e.key&&(f===`asc`?(0,F.jsx)(kr,{size:11}):(0,F.jsx)(Er,{size:11}))]})},e.key))})}),(0,F.jsx)(`tbody`,{children:T.map((e,r)=>(0,F.jsx)(`tr`,{className:n?`clickable`:``,onClick:n?()=>n(e):void 0,children:t.map(t=>(0,F.jsx)(`td`,{className:`${t.num?`num`:``} ${t.className||``}`,children:t.render(e)},t.key))},s?s(e,r):r))})]})}),c&&S.length>Ua[0]&&(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 pt-3 pb-1 text-[12px] text-mute`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{children:`Rows per page`}),(0,F.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Rows per page`,children:Ua.map(e=>(0,F.jsx)(`button`,{type:`button`,className:e===m?`on`:``,"aria-pressed":e===m,onClick:()=>x(e),children:e},e))})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Wa(w*m+1),`–`,Wa(Math.min(S.length,(w+1)*m)),` of `,Wa(S.length)]}),(0,F.jsx)(`button`,{type:`button`,className:`btn h-7`,disabled:w===0,onClick:()=>_(w-1),children:`Prev`}),(0,F.jsx)(`button`,{type:`button`,className:`btn h-7`,disabled:w>=C-1,onClick:()=>_(w+1),children:`Next`})]})]})]})}var Ua=[10,20,50],Wa=e=>e.toLocaleString(`en-US`);function Ga({value:e,max:t,color:n=`var(--color-s1)`,w:r=80}){return(0,F.jsx)(`span`,{className:`inline-block align-middle rounded-full overflow-hidden`,style:{width:r,height:5,background:`#22222c`},children:(0,F.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${Math.min(100,e/Math.max(t,1e-9)*100)}%`,background:n}})})}function Ka({items:e}){return(0,F.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5 text-[12.5px]`,children:e.map(([e,t],n)=>(0,F.jsxs)(v.Fragment,{children:[(0,F.jsx)(`dt`,{className:`text-mute`,children:e}),(0,F.jsx)(`dd`,{className:`min-w-0 truncate`,children:t})]},n))})}function qa({open:e,onClose:t,title:n,children:r,wide:i}){return e?(0,F.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[8vh] px-4`,style:{background:`rgba(5,5,8,.7)`},onMouseDown:t,children:(0,F.jsxs)(`div`,{className:`card w-full ${i?`max-w-3xl`:`max-w-lg`} shadow-2xl`,onMouseDown:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-line`,children:[(0,F.jsx)(`div`,{className:`font-semibold`,children:n}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,onClick:t,children:`✕`})]}),(0,F.jsx)(`div`,{className:`p-4 max-h-[75vh] overflow-auto`,children:r})]})}):null}function K({label:e,children:t,hint:n}){return(0,F.jsxs)(`label`,{className:`flex flex-col gap-1 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-ink2 font-medium`,children:e}),t,n&&(0,F.jsx)(`span`,{className:`text-mute text-[11px]`,children:n})]})}var Ja={GET:`#5aa2f0`,POST:`#3fbf8f`,PUT:`#e0a33a`,PATCH:`#c99af0`,DELETE:`#f07070`,QUERY:`#e86fc4`,MUTATION:`#f0a35a`,SUBSCRIPTION:`#6fc8e8`},Ya=[`QUERY`,`MUTATION`,`SUBSCRIPTION`];function Xa({tip:e,children:t,className:n=``}){let[r,i]=(0,v.useState)(null);return(0,F.jsxs)(`span`,{className:`cursor-help underline decoration-dotted decoration-[#55556a] underline-offset-4 ${n}`,onMouseEnter:e=>{let t=e.currentTarget.getBoundingClientRect();i({x:t.left+t.width/2,y:t.top})},onMouseLeave:()=>i(null),children:[t,r&&(0,F.jsx)(`span`,{role:`tooltip`,className:`mono fixed z-[100] -translate-x-1/2 -translate-y-full rounded-md border border-[#2c2c36] px-2.5 py-1.5 text-[11.5px] text-ink whitespace-nowrap shadow-2xl pointer-events-none`,style:{left:r.x,top:r.y-6,background:`rgba(17,17,22,.97)`},children:e})]})}function Za(e){let t=e.toLowerCase();return/^(prod|production|live|prd)$/.test(t)?`#3ccf7a`:/^(stag|staging|stage|preprod|pre-prod|uat|qa|test|testing)$/.test(t)?`#f5c04e`:/^(dev|development|local|sandbox|preview)$/.test(t)?`#7fb2f0`:`#a3a3b8`}function Qa({className:e=``,tall:t,short:n}){let r=I(),i=r.meta?.environments??[];return i.length<2&&!r.env?null:(0,F.jsxs)(`div`,{className:`relative shrink-0 ${e}`,children:[(0,F.jsx)(`span`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-2 h-2 rounded-full pointer-events-none`,style:{background:r.env?Za(r.env):`transparent`,border:r.env?`none`:`1.5px solid #5c5c70`}}),(0,F.jsxs)(`select`,{className:`select !pl-6 ${t?`h-8`:``}`,value:r.env,onChange:e=>r.setEnv(e.target.value),"aria-label":`Environment`,title:`Environment`,children:[(0,F.jsx)(`option`,{value:``,children:n?`All envs`:`All environments`}),i.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.id},e.id)),r.env&&!i.some(e=>e.id===r.env)&&(0,F.jsx)(`option`,{value:r.env,children:r.env})]})]})}function $a(){let e=I(),t=e.meta?.services??[];if(!e.env)return t;let n=new Set(e.meta?.environments?.find(t=>t.id===e.env)?.services??[]);return t.filter(e=>n.has(e.id))}var eo={pg:`PostgreSQL`,mysql2:`MySQL`,ioredis:`Redis`,bullmq:`BullMQ`,"node-cron":`cron`,cron:`cron`},to={express:{label:`Express`,color:`#f4f4f8`,bg:`rgba(244, 244, 248, .1)`},fastify:{label:`Fastify`,color:`#8fd3ff`,bg:`rgba(143, 211, 255, .12)`}};function no(e){let[t,n]=e.split(`@`);return to[t]?{label:`${to[t].label}${n&&n!==`?`?` ${n}`:``}`,web:!0}:{label:eo[t]??t,web:!1}}function ro(e){return e.filter(e=>to[e.split(`@`)[0]]).map(e=>no(e).label).join(`, `)}function io({frameworks:e,web:t=!1,className:n=``}){let r=new Set,i=e.map(e=>({f:e,...no(e)})).filter(e=>(!t||e.web)&&!r.has(e.label)&&(r.add(e.label),!0)).sort((e,t)=>Number(t.web)-Number(e.web));return i.length?(0,F.jsx)(`span`,{className:`inline-flex flex-wrap items-center gap-1 ${n}`,children:i.map(e=>{let t=to[e.f.split(`@`)[0]];return(0,F.jsx)(`span`,{className:`text-[10.5px] font-semibold leading-none px-1.5 py-[3px] rounded whitespace-nowrap`,style:t?{color:t.color,background:t.bg}:{color:`#9a9ab0`,background:`rgba(154, 154, 176, .1)`,fontWeight:500},title:`Detected by the SDK: ${e.f}`,children:e.label},e.label)})}):null}function ao({app:e,web:t,className:n}){let r=I().meta?.services.find(t=>t.id===e);return r?(0,F.jsx)(io,{frameworks:r.frameworks,web:t,className:n}):null}var oo=[{items:[{to:`/`,label:`Overview`,Icon:$r,end:!0}]},{title:`Activity`,items:[{to:`/requests`,label:`Requests`,Icon:ur},{to:`/jobs`,label:`Jobs`,Icon:Gi},{to:`/traces`,label:`Traces`,Icon:Gr},{to:`/map`,label:`Service map`,Icon:ui}]},{title:`Diagnose`,items:[{to:`/errors`,label:`Errors`,Icon:xr},{to:`/secrets`,label:`Secrets in logs`,Icon:Ai,badge:`secrets`},{to:`/logs`,label:`Logs`,Icon:Ti},{to:`/services`,label:`Services`,Icon:yr},{to:`/queries`,label:`Queries`,Icon:Br},{to:`/users`,label:`Users`,Icon:Ui}]},{title:`Runtime`,items:[{to:`/profiler`,label:`Profiler`,Icon:zr},{to:`/metrics`,label:`Custom metrics`,Icon:Wr},{to:`/releases`,label:`Releases`,Icon:xi}]},{title:`Respond`,items:[{to:`/alerts`,label:`Alerts`,Icon:gr,badge:`alerts`},{to:`/slos`,label:`SLOs`,Icon:Li},{to:`/status-pages`,label:`Status pages`,Icon:yi},{to:`/issues`,label:`Issues`,Icon:Pr,badge:`issues`}]}],so={"/logs":`logs`,"/alerts":`alerts`,"/slos":`slos`};function co(e){let{meta:t}=I(),n=so[e];return!!(n&&t?.usage&&!t.usage.features[n])}function lo({to:e}){return co(e)?(0,F.jsx)(ii,{size:12,className:`text-mute`,"aria-label":`Not in your plan`}):null}function uo({to:e,n:t,red:n}){return co(e)||!(t>0)?null:(0,F.jsx)(`span`,{className:`text-[10px] font-semibold px-1.5 rounded-full`,style:{background:n?`#d03b3b`:`#2a2a36`,color:`#fff`},children:t})}var fo=[{to:`/`,label:`Home`,hint:`Is my app healthy?`,Icon:qr,end:!0},{to:`/alerts`,label:`Alerts`,hint:`What broke, and who gets told`,Icon:gr,badge:`simpleAlerts`},{to:`/releases`,label:`Releases`,hint:`Did my last deploy make things better or worse?`,Icon:xi},{to:`/metrics`,label:`Metrics`,hint:`Traffic, speed, errors, server`,Icon:wr},{to:`/logs`,label:`Logs`,hint:`What your app printed`,Icon:Ti},{to:`/settings`,label:`Settings`,hint:`Connect your app`,Icon:ki}],po=[{id:`1h`,label:`Last hour`},{id:`24h`,label:`Today`},{id:`7d`,label:`7 days`}];function mo({compact:e}){let{mode:t,setMode:n}=rr(),r=(r,i,a,o)=>(0,F.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t===r,className:t===r?`on`:``,onClick:()=>n(r),title:o,children:[(0,F.jsx)(a,{size:13}),!e&&i]});return(0,F.jsxs)(`div`,{className:`mode-toggle`,role:`radiogroup`,"aria-label":`Dashboard mode`,children:[r(`simple`,`Simple`,Pi,`Simple mode: is my app healthy, what broke, what changed, what to do`),r(`advanced`,`Advanced`,Ni,`Advanced mode: every request, trace, query and runtime detail`)]})}function ho({size:e=22}){let t=`obz-tile-${(0,v.useId)().replace(/:/g,``)}`;return(0,F.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 64 64`,"aria-hidden":!0,className:`shrink-0`,children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`64`,y2:`64`,gradientUnits:`userSpaceOnUse`,children:[(0,F.jsx)(`stop`,{offset:`0`,stopColor:`#ff3d7f`}),(0,F.jsx)(`stop`,{offset:`1`,stopColor:`#a855f7`})]})}),(0,F.jsx)(`rect`,{width:`64`,height:`64`,rx:`16`,fill:`url(#${t})`}),(0,F.jsx)(`path`,{d:`M7 32 H14 L20 20 H44 L20 44 H44 L50 32 H57`,fill:`none`,stroke:`#fff`,strokeWidth:e<24?5.6:4.6,strokeLinecap:`round`,strokeLinejoin:`round`})]})}var go={ob:`M30.7 1.4L30.7 1.4Q23.3 1.4 17.4-1.7Q11.6-4.7 8.3-10.4Q4.9-16 4.9-23.9L4.9-23.9L4.9-25.5Q4.9-33.4 8.3-39.1Q11.6-44.8 17.4-47.8Q23.3-50.8 30.7-50.8L30.7-50.8Q38.1-50.8 43.9-47.8Q49.7-44.8 53.1-39.1Q56.4-33.4 56.4-25.5L56.4-25.5L56.4-23.9Q56.4-16 53.1-10.4Q49.7-4.7 43.9-1.7Q38.1 1.4 30.7 1.4ZM30.7-8.8L30.7-8.8Q37-8.8 41-12.9Q45-16.9 45-24.2L45-24.2L45-25.2Q45-32.5 41-36.6Q37-40.6 30.7-40.6L30.7-40.6Q24.4-40.6 20.4-36.6Q16.4-32.5 16.4-25.2L16.4-25.2L16.4-24.2Q16.4-16.9 20.4-12.9Q24.4-8.8 30.7-8.8ZM93.8 1.4L93.8 1.4Q86.8 1.4 83.0-1.1Q79.3-3.5 77.6-6.5L77.6-6.5L75.9-6.5L75.9 0L64.6 0L64.6-70L76.1-70L76.1-43.2L77.8-43.2Q78.9-45.2 80.8-46.9Q82.8-48.6 86.0-49.7Q89.1-50.8 93.8-50.8L93.8-50.8Q99.9-50.8 105-47.9Q110.1-44.9 113.2-39.2Q116.3-33.5 116.3-25.5L116.3-25.5L116.3-23.9Q116.3-15.9 113.2-10.2Q110.1-4.5 105.0-1.6Q99.8 1.4 93.8 1.4ZM90.4-8.6L90.4-8.6Q96.6-8.6 100.7-12.7Q104.8-16.7 104.8-24.2L104.8-24.2L104.8-25.2Q104.8-32.8 100.8-36.8Q96.7-40.8 90.4-40.8L90.4-40.8Q84.2-40.8 80.0-36.8Q75.9-32.8 75.9-25.2L75.9-25.2L75.9-24.2Q75.9-16.7 80.0-12.7Q84.2-8.6 90.4-8.6Z`,z:`M163 0L121.6 0L121.6-13.8L149.8-38.4L149.8-39.9L122.6-39.9L122.6-49.4L162.2-49.4L162.2-35.6L134-11L134-9.5L163-9.5L163 0Z`,erver:`M192.9 1.4L192.9 1.4Q185.5 1.4 179.8-1.8Q174.2-4.9 171.1-10.7Q167.9-16.4 167.9-24.1L167.9-24.1L167.9-25.3Q167.9-33.1 171-38.8Q174.1-44.5 179.7-47.7Q185.3-50.8 192.6-50.8L192.6-50.8Q199.8-50.8 205.2-47.7Q210.6-44.5 213.6-38.8Q216.6-33.1 216.6-25.5L216.6-25.5L216.6-21.4L179.5-21.4Q179.7-15.6 183.6-12.1Q187.5-8.6 193.2-8.6L193.2-8.6Q198.8-8.6 201.5-11.1Q204.2-13.5 205.6-16.6L205.6-16.6L215.1-11.7Q213.7-9 211.1-6.0Q208.4-2.9 204-0.8Q199.6 1.4 192.9 1.4ZM179.6-30.1L179.6-30.1L204.9-30.1Q204.5-35 201.2-37.9Q197.8-40.8 192.5-40.8L192.5-40.8Q187-40.8 183.7-37.9Q180.4-35 179.6-30.1ZM235.9 0L224.4 0L224.4-49.4L235.7-49.4L235.7-43.7L237.4-43.7Q238.5-46.8 241.1-48.2Q243.7-49.6 247.3-49.6L247.3-49.6L253.3-49.6L253.3-39.4L247.1-39.4Q242.1-39.4 239-36.8Q235.9-34.1 235.9-28.6L235.9-28.6L235.9 0ZM288.6 0L270.4 0L254.2-49.4L266.4-49.4L278.6-8.4L280.3-8.4L292.6-49.4L304.8-49.4L288.6 0ZM331.1 1.4L331.1 1.4Q323.7 1.4 318.1-1.8Q312.4-4.9 309.3-10.7Q306.1-16.4 306.1-24.1L306.1-24.1L306.1-25.3Q306.1-33.1 309.2-38.8Q312.3-44.5 317.9-47.7Q323.5-50.8 330.8-50.8L330.8-50.8Q338-50.8 343.4-47.7Q348.8-44.5 351.8-38.8Q354.8-33.1 354.8-25.5L354.8-25.5L354.8-21.4L317.7-21.4Q317.9-15.6 321.8-12.1Q325.7-8.6 331.4-8.6L331.4-8.6Q337-8.6 339.7-11.1Q342.4-13.5 343.8-16.6L343.8-16.6L353.3-11.7Q351.9-9 349.3-6.0Q346.6-2.9 342.2-0.8Q337.8 1.4 331.1 1.4ZM317.8-30.1L317.8-30.1L343.1-30.1Q342.7-35 339.3-37.9Q336-40.8 330.7-40.8L330.7-40.8Q325.2-40.8 321.9-37.9Q318.6-35 317.8-30.1ZM374.1 0L362.6 0L362.6-49.4L373.9-49.4L373.9-43.7L375.6-43.7Q376.7-46.8 379.3-48.2Q381.9-49.6 385.5-49.6L385.5-49.6L391.5-49.6L391.5-39.4L385.3-39.4Q380.3-39.4 377.2-36.8Q374.1-34.1 374.1-28.6L374.1-28.6L374.1 0Z`};function _o({size:e=15}){let t=Math.max(1,Math.round(e*.73*49.4/73))/49.4,n=Math.ceil(71*t),r=n+Math.ceil(1.5*t),i=Math.ceil(397*t),a=e<32?`#ff5c93`:`#ff3d7f`;return(0,F.jsxs)(`svg`,{height:r,width:i,viewBox:`-1 ${-n/t} ${i/t} ${r/t}`,role:`img`,"aria-label":`Obzerver`,className:`shrink-0 block`,children:[(0,F.jsx)(`path`,{d:go.ob,fill:`#f4f4f8`}),(0,F.jsx)(`path`,{d:go.z,fill:a}),(0,F.jsx)(`path`,{d:go.erver,fill:`#f4f4f8`})]})}function vo(){let{mode:e}=rr();return e?e===`simple`?(0,F.jsx)(bo,{}):(0,F.jsx)(xo,{}):(0,F.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,F.jsx)(U,{})})}function yo(){let[e,t]=(0,v.useState)(()=>{try{return sessionStorage.getItem(`obz.ask.open`)===`1`}catch{return!1}}),[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{try{sessionStorage.setItem(`obz.ask.open`,e?`1`:`0`)}catch{}},[e]),(0,v.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`i`?(e.preventDefault(),t(e=>!e)):e.key===`Escape`&&t(!1)},n=e=>{let n=e.detail?.question;t(!0),n&&r(n)};return window.addEventListener(`keydown`,e),window.addEventListener(`obz:ask`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`obz:ask`,n)}},[]),{askOpen:e,setAskOpen:t,pending:n,clearPending:()=>r(null)}}function bo(){let e=I(),t=$a(),n=Qn(),{setMode:r}=rr(),{askOpen:i,setAskOpen:a,pending:o,clearPending:s}=yo(),c=(e.meta?.unreadAlerts||0)+(e.meta?.openSecrets||0);return(0,F.jsxs)(`div`,{className:`flex h-full simple`,children:[(0,F.jsxs)(`aside`,{className:`w-[220px] shrink-0 border-r border-line flex flex-col bg-[#0e0e14]`,children:[(0,F.jsxs)(`div`,{className:`h-[56px] flex items-center gap-1.5 px-4 border-b border-line`,children:[(0,F.jsx)(ho,{size:28}),(0,F.jsx)(`span`,{className:`mt-px`,children:(0,F.jsx)(_o,{size:20})})]}),(0,F.jsx)(ya,{}),(0,F.jsxs)(`nav`,{className:`flex-1 overflow-y-auto px-2.5 py-3 flex flex-col gap-1`,children:[fo.map(e=>(0,F.jsx)(Pn,{to:n(e.to),end:e.end,title:e.hint,className:({isActive:e})=>`flex items-center gap-3 h-[40px] px-3 rounded-lg text-[14px] ${e?`bg-[#1f1f2a] text-ink font-medium`:`text-ink2 hover:bg-[#16161e] hover:text-ink`}`,children:({isActive:t})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e.Icon,{size:17,style:{color:t?`#ff3d7f`:void 0}}),(0,F.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,F.jsx)(lo,{to:e.to}),e.badge&&(0,F.jsx)(uo,{to:e.to,n:c,red:!0})]})},e.to)),(0,F.jsxs)(`button`,{className:`mt-2 flex items-center gap-3 h-[40px] px-3 rounded-lg text-[14px] text-ink2 hover:text-ink ask-nav`,onClick:()=>a(!0),children:[(0,F.jsx)(Fi,{size:17,className:`text-brand`}),(0,F.jsx)(`span`,{className:`flex-1 text-left`,children:`Ask Obzeri`}),(0,F.jsx)(`span`,{className:`kbd`,children:`⌘I`})]})]}),(0,F.jsx)(`div`,{className:`p-3 border-t border-line`,children:(0,F.jsxs)(`button`,{className:`w-full text-left rounded-lg border border-line hover:border-line2 bg-[#121219] px-3 py-2.5 group`,onClick:()=>r(`advanced`),children:[(0,F.jsxs)(`div`,{className:`text-[12.5px] font-medium flex items-center gap-1.5`,children:[`Need every detail? `,(0,F.jsx)(pr,{size:13,className:`text-mute group-hover:text-ink transition-transform group-hover:translate-x-0.5`})]}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute mt-0.5 leading-snug`,children:`Advanced mode has traces, queries, the profiler, releases and more.`})]})})]}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col transition-[margin] duration-150`,style:{marginRight:i?480:0},children:[(0,F.jsxs)(`header`,{className:`h-[56px] shrink-0 border-b border-line flex items-center gap-3 px-5 bg-[#0e0e14]`,children:[(0,F.jsx)(mo,{}),(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsx)(Qa,{tall:!0}),(t.length>1||e.service)&&(0,F.jsxs)(`select`,{className:`select h-8`,value:e.service,onChange:t=>e.setService(t.target.value),"aria-label":`App`,children:[(0,F.jsx)(`option`,{value:``,children:`All apps`}),t.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.id,ro(e.frameworks)?` · ${ro(e.frameworks)}`:``]},e.id))]}),e.service&&(0,F.jsx)(ao,{app:e.service,web:!0}),i?(0,F.jsxs)(`select`,{className:`select h-8`,value:po.some(t=>t.id===e.range)?e.range:``,onChange:t=>t.target.value&&e.setRange(t.target.value),"aria-label":`Time range`,children:[!po.some(t=>t.id===e.range)&&(0,F.jsx)(`option`,{value:``,children:e.range===`custom`?`Custom`:e.range}),po.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,F.jsx)(`div`,{className:`seg seg-lg`,children:po.map(t=>(0,F.jsx)(`button`,{className:e.range===t.id?`on`:``,onClick:()=>e.setRange(t.id),children:t.label},t.id))}),(0,F.jsxs)(`button`,{className:`btn ask-btn h-8 ${i?`on px-2`:``}`,onClick:()=>a(e=>!e),title:`Ask Obzeri (⌘I / Ctrl+I)`,"aria-label":`Ask Obzeri`,"aria-pressed":i,children:[(0,F.jsx)(Fi,{size:14,className:`text-brand`}),!i&&`Ask Obzeri`]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-8 px-2`,onClick:e.refresh,title:`Refresh`,children:(0,F.jsx)(bi,{size:14})})]}),(0,F.jsx)(Qi,{}),(0,F.jsx)(`main`,{className:`flex-1 overflow-y-auto @container`,children:(0,F.jsx)(`div`,{className:`max-w-[1240px] mx-auto px-6 py-6`,children:(0,F.jsx)(Ht,{})})}),(0,F.jsx)(la,{open:i,onClose:()=>a(!1),pending:o,onPending:s,simple:!0})]})]})}function xo(){let e=I(),t=$a(),n=Qn(),r=ht(),[i,a]=(0,v.useState)(``),{askOpen:o,setAskOpen:s,pending:c,clearPending:l}=yo(),u={alerts:e.meta?.unreadAlerts||0,issues:e.meta?.openIssues||0,secrets:e.meta?.openSecrets||0};return(0,v.useEffect)(()=>{let e=e=>{e.key===`/`&&!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)&&(e.preventDefault(),document.getElementById(`global-search`)?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,F.jsxs)(`div`,{className:`flex h-full`,children:[(0,F.jsxs)(`aside`,{className:`w-[214px] shrink-0 border-r border-line flex flex-col bg-[#0e0e14]`,children:[(0,F.jsxs)(`div`,{className:`h-[52px] flex items-center gap-2 px-4 border-b border-line`,children:[(0,F.jsx)(ho,{size:28}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-[5px]`,children:[(0,F.jsx)(_o,{size:18}),(0,F.jsx)(`div`,{className:`text-[10.5px] leading-[14px] text-mute whitespace-nowrap`,children:e.meta?.version?.includes(`-`)?`v${e.meta.version}`:`Express · Fastify${e.meta?.version?` · v${e.meta.version}`:``}`})]})]}),(0,F.jsx)(ya,{}),(0,F.jsx)(`nav`,{className:`flex-1 overflow-y-auto px-2 py-3 flex flex-col gap-4`,children:oo.map((e,t)=>(0,F.jsxs)(`div`,{children:[e.title&&(0,F.jsx)(`div`,{className:`px-2 pb-1 text-[10.5px] uppercase tracking-wider text-mute font-medium`,children:e.title}),e.items.map(e=>(0,F.jsx)(Pn,{to:n(e.to),end:e.end,className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e] hover:text-ink`}`,children:({isActive:t})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e.Icon,{size:15,style:{color:t?`#ff3d7f`:void 0}}),(0,F.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,F.jsx)(lo,{to:e.to}),e.badge&&(0,F.jsx)(uo,{to:e.to,n:u[e.badge],red:e.badge===`alerts`||e.badge===`secrets`})]})},e.to))]},t))}),(0,F.jsxs)(`div`,{className:`px-2 py-2 border-t border-line flex flex-col gap-0.5`,children:[(0,F.jsxs)(Pn,{to:n(`/integrations`),className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e]`}`,children:[(0,F.jsx)(gi,{size:15}),` Integrations`]}),(0,F.jsxs)(Pn,{to:n(`/usage`),className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e]`}`,children:[(0,F.jsx)(Cr,{size:15}),` `,(0,F.jsx)(`span`,{className:`flex-1`,children:`Usage`}),(0,F.jsx)(So,{})]}),(0,F.jsxs)(Pn,{to:n(`/settings`),className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e]`}`,children:[(0,F.jsx)(ki,{size:15}),` Setup & settings`]})]})]}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col transition-[margin] duration-150`,style:{marginRight:o?480:0},children:[(0,F.jsxs)(`header`,{className:`shrink-0 border-b border-line bg-[#0e0e14]`,children:[(0,F.jsxs)(`div`,{className:`h-[52px] flex items-center gap-3 px-5`,children:[(0,F.jsx)(mo,{}),(0,F.jsxs)(`form`,{className:`relative flex-1 min-w-[200px] max-w-[560px]`,onSubmit:e=>{e.preventDefault();let t=i.trim();t&&(r(n(/^[0-9a-f]{32}$/i.test(t)?`/traces/${t.toLowerCase()}`:`/traces?q=${encodeURIComponent(t)}`)),a(``))},children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{id:`global-search`,className:`input pl-8 pr-7 w-full`,placeholder:`Trace id, path, user, error…`,value:i,onChange:e=>a(e.target.value)}),(0,F.jsx)(`span`,{className:`kbd absolute right-2 top-1/2 -translate-y-1/2`,children:`/`})]}),(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsxs)(`button`,{className:`btn ask-btn ${o?`on px-2`:``}`,onClick:()=>s(e=>!e),title:`Ask Obzeri (⌘I / Ctrl+I)`,"aria-label":`Ask Obzeri`,"aria-pressed":o,children:[(0,F.jsx)(Fi,{size:13,className:`text-brand`}),!o&&`Ask Obzeri`]}),(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>e.setLive(!e.live),title:`Auto-refresh every 30s`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${e.live&&e.range!==`custom`?`live-dot`:``}`,style:{background:e.live&&e.range!==`custom`?`#0ca30c`:`#55556a`}}),e.live&&e.range!==`custom`?`Live`:`Paused`]}),(0,F.jsx)(`button`,{className:`btn px-2`,onClick:e.refresh,title:`Refresh`,children:(0,F.jsx)(bi,{size:13})})]}),(0,F.jsxs)(`div`,{className:`h-[42px] flex items-center gap-2.5 px-5 border-t border-[#1b1b24] bg-[#0c0c11]`,children:[(0,F.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-mute font-semibold mr-1`,children:`Showing`}),(0,F.jsx)(Qa,{}),(0,F.jsxs)(`select`,{className:`select`,value:e.service,onChange:t=>e.setService(t.target.value),"aria-label":`Application`,children:[(0,F.jsx)(`option`,{value:``,children:`All applications`}),t.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.id,ro(e.frameworks)?` · ${ro(e.frameworks)}`:``]},e.id))]}),e.service&&(0,F.jsx)(ao,{app:e.service}),(0,F.jsx)(`div`,{className:`flex-1`}),o?(0,F.jsxs)(`select`,{className:`select w-[74px]`,value:e.range===`custom`?``:e.range,onChange:t=>t.target.value&&e.setRange(t.target.value),"aria-label":`Time range`,children:[e.range===`custom`&&(0,F.jsx)(`option`,{value:``,children:`custom`}),Yn.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,F.jsx)(`div`,{className:`seg`,children:Yn.map(t=>(0,F.jsx)(`button`,{className:e.range===t.id?`on`:``,onClick:()=>e.setRange(t.id),children:t.label},t.id))}),(0,F.jsx)(ja,{})]})]}),(0,F.jsx)(Qi,{}),(0,F.jsx)(`main`,{className:`flex-1 overflow-y-auto @container`,children:(0,F.jsx)(`div`,{className:`max-w-[1500px] mx-auto px-5 py-5`,children:(0,F.jsx)(Ht,{})})}),(0,F.jsx)(la,{open:o,onClose:()=>s(!1),pending:c,onPending:l})]})]})}function So(){let{meta:e}=I(),t=e?.usage;if(!t||t.pct==null)return null;let n=t.pct>=100?`#ec835a`:t.pct>=80?`#fab219`:void 0;return(0,F.jsx)(`span`,{className:`text-[10.5px] tabular-nums text-mute`,style:n?{color:n}:void 0,children:Yi(t.pct)})}function Co(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Co(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function wo(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Co(e))&&(r&&(r+=` `),r+=t);return r}var To=o(((e,t)=>{t.exports=Array.isArray})),Eo=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),Do=o(((e,t)=>{var n=Eo(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),Oo=o(((e,t)=>{t.exports=Do().Symbol})),ko=o(((e,t)=>{var n=Oo(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Ao=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),jo=o(((e,t)=>{var n=Oo(),r=ko(),i=Ao(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),Mo=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),No=o(((e,t)=>{var n=jo(),r=Mo(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Po=o(((e,t)=>{var n=To(),r=No(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Fo=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Io=o(((e,t)=>{var n=jo(),r=Fo(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),q=o(((e,t)=>{t.exports=Do()[`__core-js_shared__`]})),Lo=o(((e,t)=>{var n=q(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),Ro=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),zo=o(((e,t)=>{var n=Io(),r=Lo(),i=Fo(),a=Ro(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Bo=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),Vo=o(((e,t)=>{var n=zo(),r=Bo();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Ho=o(((e,t)=>{t.exports=Vo()(Object,`create`)})),Uo=o(((e,t)=>{var n=Ho();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Wo=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Go=o(((e,t)=>{var n=Ho(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Ko=o(((e,t)=>{var n=Ho(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),qo=o(((e,t)=>{var n=Ho(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Jo=o(((e,t)=>{var n=Uo(),r=Wo(),i=Go(),a=Ko(),o=qo();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Yo=o(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Xo=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),Zo=o(((e,t)=>{var n=Xo();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Qo=o(((e,t)=>{var n=Zo(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),$o=o(((e,t)=>{var n=Zo();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),es=o(((e,t)=>{var n=Zo();function r(e){return n(this.__data__,e)>-1}t.exports=r})),ts=o(((e,t)=>{var n=Zo();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),ns=o(((e,t)=>{var n=Yo(),r=Qo(),i=$o(),a=es(),o=ts();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),rs=o(((e,t)=>{t.exports=Vo()(Do(),`Map`)})),is=o(((e,t)=>{var n=Jo(),r=ns(),i=rs();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),as=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),os=o(((e,t)=>{var n=as();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),ss=o(((e,t)=>{var n=os();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),cs=o(((e,t)=>{var n=os();function r(e){return n(this,e).get(e)}t.exports=r})),ls=o(((e,t)=>{var n=os();function r(e){return n(this,e).has(e)}t.exports=r})),us=o(((e,t)=>{var n=os();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),ds=o(((e,t)=>{var n=is(),r=ss(),i=cs(),a=ls(),o=us();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),fs=o(((e,t)=>{var n=ds(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),ps=o(((e,t)=>{var n=fs(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),ms=o(((e,t)=>{var n=ps(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),hs=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),gs=o(((e,t)=>{var n=Oo(),r=hs(),i=To(),a=No(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),_s=o(((e,t)=>{var n=gs();function r(e){return e==null?``:n(e)}t.exports=r})),vs=o(((e,t)=>{var n=To(),r=Po(),i=ms(),a=_s();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),ys=o(((e,t)=>{var n=No(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),bs=o(((e,t)=>{var n=vs(),r=ys();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),xs=o(((e,t)=>{var n=bs();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Ss=o(((e,t)=>{function n(e){return e==null}t.exports=n})),Cs=o(((e,t)=>{var n=jo(),r=To(),i=Mo(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),ws=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),Ts=o(((e,t)=>{t.exports=ws()})),Es=o(((e,t)=>{var n=jo(),r=Mo(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),Ds=o(((e,t)=>{var n=Es();function r(e){return n(e)&&e!=+e}t.exports=r})),Os=l(Cs()),ks=l(Ds()),As=l(xs()),js=l(Es()),J=l(Ss()),Ms=function(e){return e===0?0:e>0?1:-1},Ns=function(e){return(0,Os.default)(e)&&e.indexOf(`%`)===e.length-1},Y=function(e){return(0,js.default)(e)&&!(0,ks.default)(e)},Ps=function(e){return(0,J.default)(e)},Fs=function(e){return Y(e)||(0,Os.default)(e)},Is=0,Ls=function(e){var t=++Is;return`${e||``}${t}`},Rs=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!Y(e)&&!(0,Os.default)(e))return n;var i;if(Ns(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,ks.default)(i)&&(i=n),r&&i>t&&(i=t),i},zs=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},Bs=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[e[r]])n[e[r]]=!0;else return!0;return!1},Vs=function(e,t){return Y(e)&&Y(t)?function(n){return e+n*(t-e)}:function(){return t}};function Hs(e,t,n){return!e||!e.length?null:e.find(function(e){return e&&(typeof t==`function`?t(e):(0,As.default)(e,t))===n})}var Us=function(e){if(!e||!e.length)return null;for(var t=e.length,n=0,r=0,i=0,a=0,o=1/0,s=-1/0,c=0,l=0,u=0;u<t;u++)c=e[u].cx||0,l=e[u].cy||0,n+=c,r+=l,i+=c*l,a+=c*c,o=Math.min(o,c),s=Math.max(s,c);var d=t*a===n*n?0:(t*i-n*r)/(t*a-n*n);return{xmin:o,xmax:s,a:d,b:(r-d*n)/t}},Ws=function(e,t){return Y(e)&&Y(t)?e-t:(0,Os.default)(e)&&(0,Os.default)(t)?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t))};function Gs(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}var Ks=l(Fo());function qs(e){"@babel/helpers - typeof";return qs=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},qs(e)}var Js=[`viewBox`,`children`],Ys=`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`),Xs=[`points`,`pathLength`],Zs={svg:Js,polygon:Xs,polyline:Xs},Qs=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`),$s=function(e,t){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),!(0,Ks.default)(n))return null;var r={};return Object.keys(n).forEach(function(e){Qs.includes(e)&&(r[e]=t||function(t){return n[e](n,t)})}),r},ec=function(e,t,n){return function(r){return e(t,n,r),null}},tc=function(e,t,n){if(!(0,Ks.default)(e)||qs(e)!==`object`)return null;var r=null;return Object.keys(e).forEach(function(i){var a=e[i];Qs.includes(i)&&typeof a==`function`&&(r||={},r[i]=ec(a,t,n))}),r},X=l(Io()),nc=Ts(),rc=[`children`],ic=[`children`];function ac(e,t){if(e==null)return{};var n=oc(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oc(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function sc(e){"@babel/helpers - typeof";return sc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sc(e)}var cc={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},lc=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},uc=null,dc=null,fc=function e(t){if(t===uc&&Array.isArray(dc))return dc;var n=[];return v.Children.forEach(t,function(t){(0,J.default)(t)||((0,nc.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),dc=n,uc=t,n};function pc(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return lc(e)}):[lc(t)],fc(e).forEach(function(e){var t=(0,As.default)(e,`type.displayName`)||(0,As.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function mc(e,t){var n=pc(e,t);return n&&n[0]}var hc=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Y(n)||n<=0||!Y(r)||r<=0)},gc=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),_c=function(e){return e&&e.type&&(0,Os.default)(e.type)&&gc.indexOf(e.type)>=0},vc=function(e){return e&&sc(e)===`object`&&`clipDot`in e},yc=function(e,t,n,r){var i=Zs?.[r]??[];return t.startsWith(`data-`)||!(0,X.default)(e)&&(r&&i.includes(t)||Ys.includes(t))||n&&Qs.includes(t)},Z=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,v.isValidElement)(e)&&(r=e.props),!(0,Ks.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){yc(r?.[e],e,t,n)&&(i[e]=r[e])}),i},bc=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return xc(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],o=n[i];if(Array.isArray(a)||Array.isArray(o)){if(!e(a,o))return!1}else if(!xc(a,o))return!1}return!0},xc=function(e,t){if((0,J.default)(e)&&(0,J.default)(t))return!0;if(!(0,J.default)(e)&&!(0,J.default)(t)){var n=e.props||{},r=n.children,i=ac(n,rc),a=t.props||{},o=a.children,s=ac(a,ic);return r&&o?Gs(i,s)&&bc(r,o):!r&&!o&&Gs(i,s)}return!1},Sc=function(e,t){var n=[],r={};return fc(e).forEach(function(e,i){if(_c(e))n.push(e);else if(e){var a=lc(e.type),o=t[a]||{},s=o.handler,c=o.once;if(s&&(!c||!r[a])){var l=s(e,a,i);n.push(l),r[a]=!0}}}),n},Cc=function(e){var t=e&&e.type;return t&&cc[t]?cc[t]:null},wc=function(e,t){return fc(t).indexOf(e)},Tc=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Ec(){return Ec=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ec.apply(this,arguments)}function Dc(e,t){if(e==null)return{};var n=Oc(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Oc(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kc(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=Dc(e,Tc),u=i||{width:n,height:r,x:0,y:0},d=wo(`recharts-surface`,a);return v.createElement(`svg`,Ec({},Z(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),v.createElement(`title`,null,s),v.createElement(`desc`,null,c),t)}var Ac=[`children`,`className`];function jc(){return jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jc.apply(this,arguments)}function Mc(e,t){if(e==null)return{};var n=Nc(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nc(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Pc=v.forwardRef(function(e,t){var n=e.children,r=e.className,i=Mc(e,Ac),a=wo(`recharts-layer`,r);return v.createElement(`g`,jc({className:a},Z(i,!0),{ref:t}),n)}),Fc=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}t.exports=n})),Ic=o(((e,t)=>{var n=Fc();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),Lc=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),Rc=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),zc=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),Bc=o(((e,t)=>{var n=Rc(),r=Lc(),i=zc();function a(e){return r(e)?i(e):n(e)}t.exports=a})),Vc=o(((e,t)=>{var n=Ic(),r=Lc(),i=Bc(),a=_s();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),Hc=o(((e,t)=>{t.exports=Vc()(`toUpperCase`)})),Uc=Math.PI,Wc=2*Uc,Gc=1e-6,Kc=Wc-Gc;function qc(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Jc(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return qc;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}function Yc(e,t,n,r){return e===n&&t===r}function Xc(e){let t=Math.floor(e);if(!(t<=15))return Yc;let n=10**t,r=function(e){return Math.round(e*n)};return function(e,t,n,i){return r(e)===r(n)&&r(t)===r(i)}}var Zc=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?qc:Jc(e),this._equal=e==null?Yc:Xc(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Gc){if(!(Math.abs(u*s-c*l)>Gc)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Uc-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Gc&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Gc||Math.abs(this._y1-l)>Gc)&&this._append`L${c},${l}`,n){if(d<0&&(d=d%Wc+Wc),d>Kc)this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`;else if(d>Gc){let a=e+n*Math.cos(i),o=t+n*Math.sin(i);if(d>=Uc&&this._equal(c,l,a,o)){d/=2;let i=r+d;this._append`A${n},${n},0,${+(d>=Uc)},${u},${e+n*Math.cos(i)},${t+n*Math.sin(i)}`}this._append`A${n},${n},0,${+(d>=Uc)},${u},${this._x1=a},${this._y1=o}`}}}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Zc.prototype;function Qc(e){return function(){return e}}var $c=Math.cos,el=Math.sin,tl=Math.sqrt,nl=1e-12,rl=Math.PI;rl/2;var il=2*rl;function al(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Zc(t)}Array.prototype.slice;function ol(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function sl(e){this._context=e}sl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function cl(e){return new sl(e)}function ll(e){return e[0]}function ul(e){return e[1]}function dl(e,t){var n=Qc(!0),r=null,i=cl,a=null,o=al(s);e=typeof e==`function`?e:e===void 0?ll:Qc(e),t=typeof t==`function`?t:t===void 0?ul:Qc(t);function s(s){var c,l=(s=ol(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:Qc(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function fl(e,t,n){var r=null,i=Qc(!0),a=null,o=cl,s=null,c=al(l);e=typeof e==`function`?e:e===void 0?ll:Qc(+e),t=typeof t==`function`?t:Qc(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?ul:Qc(+n);function l(l){var u,d,f,p=(l=ol(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return dl().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Qc(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:Qc(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:Qc(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}ml(cl);function pl(e){this._curve=e}pl.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};function ml(e){function t(t){return new pl(e(t))}return t._curve=e,t}var hl=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function gl(e){return new hl(e,!0)}function _l(e){return new hl(e,!1)}tl(3);var vl={draw(e,t){let n=tl(t/rl);e.moveTo(n,0),e.arc(0,0,n,0,il)}},yl={draw(e,t){let n=tl(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},bl=tl(1/3),xl=bl*2,Sl={draw(e,t){let n=tl(t/xl),r=n*bl;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Cl={draw(e,t){let n=tl(t),r=-n/2;e.rect(r,r,n,n)}},wl=.8908130915292852,Tl=el(rl/10)/el(7*rl/10),El=el(il/10)*Tl,Dl=-$c(il/10)*Tl,Ol={draw(e,t){let n=tl(t*wl),r=El*n,i=Dl*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=il*t/5,o=$c(a),s=el(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},kl=tl(3),Al={draw(e,t){let n=-tl(t/(kl*3));e.moveTo(0,n*2),e.lineTo(-kl*n,-n),e.lineTo(kl*n,-n),e.closePath()}};tl(3);var jl=-.5,Ml=tl(3)/2,Nl=1/tl(12),Pl=(Nl/2+1)*3,Fl={draw(e,t){let n=tl(t/Pl),r=n/2,i=n*Nl,a=r,o=n*Nl+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(jl*r-Ml*i,Ml*r+jl*i),e.lineTo(jl*a-Ml*o,Ml*a+jl*o),e.lineTo(jl*s-Ml*c,Ml*s+jl*c),e.lineTo(jl*r+Ml*i,jl*i-Ml*r),e.lineTo(jl*a+Ml*o,jl*o-Ml*a),e.lineTo(jl*s+Ml*c,jl*c-Ml*s),e.closePath()}};function Il(e,t){let n=null,r=al(i);e=typeof e==`function`?e:Qc(e||vl),t=typeof t==`function`?t:Qc(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Ll(){}function Rl(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function zl(e){this._context=e}zl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Rl(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bl(e){return new zl(e)}function Vl(e){this._context=e}Vl.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Hl(e){return new Vl(e)}function Ul(e){this._context=e}Ul.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Wl(e){return new Ul(e)}function Gl(e,t){this._basis=new zl(e),this._beta=t}Gl.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},(function e(t){function n(e){return t===1?new zl(e):new Gl(e,t)}return n.beta=function(t){return e(+t)},n})(.85);function Kl(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function ql(e,t){this._context=e,this._k=(1-t)/6}ql.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Kl(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Kl(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new ql(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Jl(e,t){this._context=e,this._k=(1-t)/6}Jl.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Kl(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new Jl(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Yl(e,t){this._context=e,this._k=(1-t)/6}Yl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Kl(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new Yl(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Xl(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>nl){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>nl){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function Zl(e,t){this._context=e,this._alpha=t}Zl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Xl(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new Zl(e,t):new ql(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function Ql(e,t){this._context=e,this._alpha=t}Ql.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Xl(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new Ql(e,t):new Jl(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function $l(e,t){this._context=e,this._alpha=t}$l.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Xl(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new $l(e,t):new Yl(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function eu(e){this._context=e}eu.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function tu(e){return new eu(e)}function nu(e){return e<0?-1:1}function ru(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(nu(a)+nu(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function iu(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function au(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function ou(e){this._context=e}ou.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:au(this,this._t0,iu(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,au(this,iu(this,n=ru(this,e,t)),n);break;default:au(this,this._t0,n=ru(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function su(e){this._context=new cu(e)}(su.prototype=Object.create(ou.prototype)).point=function(e,t){ou.prototype.point.call(this,t,e)};function cu(e){this._context=e}cu.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function lu(e){return new ou(e)}function uu(e){return new su(e)}function du(e){this._context=e}du.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=fu(e),i=fu(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function fu(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function pu(e){return new du(e)}function mu(e,t){this._context=e,this._t=t}mu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function hu(e){return new mu(e,.5)}function gu(e){return new mu(e,0)}function _u(e){return new mu(e,1)}function vu(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function yu(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function bu(e,t){return e[t]}function xu(e){let t=[];return t.key=e,t}function Su(){var e=Qc([]),t=yu,n=vu,r=bu;function i(i){var a=Array.from(e.apply(this,arguments),xu),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=ol(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:Qc(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?yu:typeof e==`function`?e:Qc(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??vu,i):n},i}function Cu(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}vu(e,t)}}function wu(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}vu(e,t)}}function Tu(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,vu(e,t)}}var Eu=l(Hc());function Du(e){"@babel/helpers - typeof";return Du=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Du(e)}var Ou=[`type`,`size`,`sizeType`];function ku(){return ku=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ku.apply(this,arguments)}function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ju(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Au(Object(n),!0).forEach(function(t){Mu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mu(e,t,n){return t=Nu(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nu(e){var t=Pu(e,`string`);return Du(t)==`symbol`?t:t+``}function Pu(e,t){if(Du(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Du(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Fu(e,t){if(e==null)return{};var n=Iu(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Iu(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Lu={symbolCircle:vl,symbolCross:yl,symbolDiamond:Sl,symbolSquare:Cl,symbolStar:Ol,symbolTriangle:Al,symbolWye:Fl},Ru=Math.PI/180,zu=function(e){return Lu[`symbol${(0,Eu.default)(e)}`]||vl},Bu=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*Ru;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Vu=function(e,t){Lu[`symbol${(0,Eu.default)(e)}`]=t},Hu=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=ju(ju({},Fu(e,Ou)),{},{type:n,size:i,sizeType:o}),c=function(){var e=zu(n);return Il().type(e).size(Bu(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=Z(s,!0);return u===+u&&d===+d&&i===+i?v.createElement(`path`,ku({},f,{className:wo(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};Hu.registerSymbol=Vu;function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Uu(e)}function Wu(){return Wu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wu.apply(this,arguments)}function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ku(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Gu(Object(n),!0).forEach(function(t){rd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qu(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ju(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,id(r.key),r)}}function Yu(e,t,n){return t&&Ju(e.prototype,t),n&&Ju(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xu(e,t,n){return t=ed(t),Zu(e,$u()?Reflect.construct(t,n||[],ed(e).constructor):t.apply(e,n))}function Zu(e,t){if(t&&(Uu(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Qu(e)}function Qu(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function $u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($u=function(){return!!e})()}function ed(e){return ed=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ed(e)}function td(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nd(e,t)}function nd(e,t){return nd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nd(e,t)}function rd(e,t,n){return t=id(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function id(e){var t=ad(e,`string`);return Uu(t)==`symbol`?t:t+``}function ad(e,t){if(Uu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Uu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var od=32,sd=function(e){function t(){return qu(this,t),Xu(this,t,arguments)}return td(t,e),Yu(t,[{key:`renderIcon`,value:function(e){var t=this.props.inactiveColor,n=od/2,r=od/6,i=od/3,a=e.inactive?t:e.color;if(e.type===`plainline`)return v.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:a,strokeDasharray:e.payload.strokeDasharray,x1:0,y1:n,x2:od,y2:n,className:`recharts-legend-icon`});if(e.type===`line`)return v.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:a,d:`M0,${n}h${i}
|
|
16
|
+
`).length)),className:`input w-full resize-none !h-auto py-2 pe-11 leading-snug`,placeholder:y?`Paused: budget used`:`Ask about errors, latency, releases, jobs…`,disabled:!!y,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),g(l))}}),m?(0,F.jsx)(`button`,{type:`button`,className:`absolute right-2 bottom-2 btn h-7 w-7 !p-0 justify-center`,title:`Stop`,onClick:()=>d.current?.abort(),children:(0,F.jsx)(Ii,{size:12,fill:`currentColor`})}):(0,F.jsx)(`button`,{className:`absolute right-2 bottom-2 btn btn-primary h-7 w-7 !p-0 justify-center`,title:`Send (Enter)`,disabled:!l.trim(),children:(0,F.jsx)(mr,{size:14})})]}),(0,F.jsxs)(`div`,{className:`text-[10.5px] text-mute mt-1.5 leading-snug`,children:[`Your question and the data the tools return are sent to `,a.data?.provider===`openai`?`your OpenAI-compatible endpoint`:`Anthropic`,`. Enter to send, Shift+Enter for a new line.`]})]})]})}function ua({onClose:e}){let t=ht(),n=Qn();return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 mt-2 text-[13px]`,children:[(0,F.jsx)(`div`,{className:`text-ink2 leading-relaxed`,children:`Ask Obzeri needs a language model. Connect Anthropic (Claude) or any OpenAI-compatible endpoint, including a local model through Ollama, and it will answer questions from this project's telemetry.`}),(0,F.jsx)(`div`,{children:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>{e(),t(n(`/integrations/ai`))},children:[`Set up Ask Obzeri`,(0,F.jsx)(Or,{size:13})]})})]})}function da({turn:e,onAsk:t,last:n}){let[r,i]=(0,v.useState)(!1),a=((e.ended??Date.now())-e.started)/1e3,o=r||e.running&&!e.answer;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsx)(`div`,{className:`self-end max-w-[88%] rounded-xl rounded-br-sm bg-[#22222e] px-3 py-2 text-[13px] whitespace-pre-wrap`,dir:`auto`,children:e.question}),(e.steps.length>0||e.running)&&(0,F.jsxs)(`div`,{className:`rounded-lg border border-line bg-[#121219]`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-[12px] text-ink2 hover:text-ink`,onClick:()=>i(e=>!e),children:[e.running&&!e.answer?(0,F.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-brand border-t-transparent animate-spin`}):(0,F.jsx)(Tr,{size:13,className:`text-[#5fd38a]`}),(0,F.jsx)(`span`,{className:`flex-1 text-left`,children:e.running&&!e.answer?e.steps.length?(ia[e.steps.at(-1).tool]||e.steps.at(-1).tool)+`…`:`Thinking…`:`Read ${e.steps.length} source${e.steps.length===1?``:`s`} · ${a.toFixed(1)}s${e.usage?` · ${fa(e.usage)}`:``}`}),(0,F.jsx)(Or,{size:13,className:`transition-transform ${o?`rotate-90`:``}`})]}),o&&(0,F.jsxs)(`div`,{className:`px-3 pb-2.5 flex flex-col gap-1.5 border-t border-line pt-2`,children:[e.notes.map((e,t)=>(0,F.jsx)(`div`,{className:`text-[12px] text-mute italic`,dir:`auto`,children:e},`n${t}`)),e.steps.map(e=>(0,F.jsxs)(`div`,{className:`flex items-start gap-2 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`mt-[3px] shrink-0`,children:e.done?e.done.ok?(0,F.jsx)(Tr,{size:11,className:`text-[#5fd38a]`}):(0,F.jsx)(Vi,{size:11,className:`text-[#ffb547]`}):(0,F.jsx)(`span`,{className:`block w-2.5 h-2.5 rounded-full border-2 border-mute border-t-transparent animate-spin`})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-ink2`,children:[ia[e.tool]||e.tool,` `,(0,F.jsx)(`span`,{className:`mono text-mute text-[11px]`,children:e.tool})]}),z(e.input)&&(0,F.jsx)(`div`,{className:`mono text-[11px] text-mute break-all`,children:z(e.input)})]}),e.done&&(0,F.jsxs)(`span`,{className:`text-mute text-[11px] shrink-0`,children:[e.done.summary,` · `,e.done.ms,`ms`]})]},e.id))]})]}),e.answer&&(0,F.jsx)(_a,{a:e.answer,onAsk:t,showFollowUps:n&&!e.running}),e.error&&!e.answer&&(0,F.jsx)(`div`,{className:`rounded-lg border border-[#5a2a2a] bg-[#1d1214] px-3 py-2 text-[12.5px] text-[#ff9c9c]`,dir:`auto`,children:e.error})]})}function fa(e){return`${R(e.tokens.input+e.tokens.output)} tokens${e.cost==null?``:` · $${e.cost<.01?e.cost.toFixed(4):e.cost.toFixed(2)}`}${e.capped?` · stopped at the limit`:``}`}var pa={high:{label:`High confidence`,color:`#5fd38a`},medium:{label:`Medium confidence`,color:`#ffb547`},low:{label:`Low confidence`,color:`#ff8a8a`}},ma={execution:ur,trace:Gr,error:xr,operation:ur,release:xi,issue:ni};function ha(e){let t=encodeURIComponent;switch(e.kind){case`execution`:return`/executions/${t(e.ref)}`;case`trace`:return`/traces/${t(e.ref)}`;case`error`:return`/errors/${t(e.ref)}`;case`operation`:return`/operations/${e.opKind||`http`}/${t(e.service||``)}/${t(e.ref)}`;case`release`:return`/releases?service=${t(e.service||``)}&version=${t(e.ref)}`;case`issue`:return`/issues/${t(e.ref)}`}}function ga({title:e,icon:t,children:n}){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10.5px] uppercase tracking-wider text-mute font-medium`,children:[t,e]}),n]})}function _a({a:e,onAsk:t,showFollowUps:n}){let r=ht(),i=Qn(),a=pa[e.confidence];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{className:`text-[13.3px] text-ink`,children:(0,F.jsx)(ta,{text:e.summary})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,F.jsxs)(`span`,{className:`pill !text-[11px] inline-flex items-center gap-1.5`,title:e.confidenceReason,style:{borderColor:`${a.color}55`,color:a.color},children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:a.color}}),a.label]}),e.timeRange&&(0,F.jsxs)(`span`,{className:`pill !text-[11px] inline-flex items-center gap-1`,title:`${new Date(e.timeRange.from).toLocaleString()} → ${new Date(e.timeRange.to).toLocaleString()}`,children:[(0,F.jsx)(Ir,{size:11}),aa(e.timeRange.minutes)]})]}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute -mt-1.5`,dir:`auto`,children:e.confidenceReason}),e.evidence.length>0&&(0,F.jsx)(ga,{title:`Evidence`,icon:(0,F.jsx)(ji,{size:11}),children:(0,F.jsx)(`div`,{className:`rounded-lg border border-line divide-y divide-[#22222c]`,children:e.evidence.map((e,t)=>(0,F.jsxs)(`div`,{className:`px-3 py-1.5 flex items-baseline gap-3 text-[12.3px]`,children:[(0,F.jsx)(`span`,{className:`flex-1 text-ink2`,dir:`auto`,children:e.claim}),(0,F.jsx)(`span`,{className:`mono text-ink text-[12px] text-right`,dir:`auto`,children:e.value})]},t))})}),e.links.length>0&&(0,F.jsx)(ga,{title:`Open in Obzerver`,icon:(0,F.jsx)(ti,{size:11}),children:(0,F.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.links.map((e,t)=>{let n=ma[e.kind];return(0,F.jsxs)(`button`,{onClick:()=>r(i(ha(e))),className:`flex items-center gap-2 rounded-md border border-line hover:border-line2 hover:bg-panel2 px-2.5 py-1.5 text-left text-[12.3px]`,children:[(0,F.jsx)(n,{size:13,className:`text-mute shrink-0`}),(0,F.jsx)(`span`,{className:`text-mute text-[11px] w-[62px] shrink-0`,children:e.kind}),(0,F.jsx)(`span`,{className:`flex-1 truncate`,dir:`auto`,children:e.label}),(0,F.jsx)(Or,{size:12,className:`text-mute`})]},t)})})}),(0,F.jsx)(ga,{title:`Data sources`,icon:(0,F.jsx)(ur,{size:11}),children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.sources.length?e.sources.map(e=>(0,F.jsxs)(`span`,{className:`pill mono !text-[10.5px]`,title:ia[e.tool],children:[e.tool,e.calls>1?` ×${e.calls}`:``]},e.tool)):(0,F.jsx)(`span`,{className:`text-mute text-[12px]`,children:`none: this answer did not read any data`})})}),e.checks.length>0&&(0,F.jsxs)(`div`,{className:`text-[11.5px] text-[#ffb547] flex items-start gap-1.5`,children:[(0,F.jsx)(Vi,{size:12,className:`mt-0.5 shrink-0`}),(0,F.jsxs)(`span`,{children:[`Checked by Obzerver: `,e.checks.join(` `)]})]}),n&&e.followUps.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,children:e.followUps.map(e=>(0,F.jsx)(`button`,{className:`rounded-full border border-line hover:border-line2 hover:bg-panel2 px-2.5 py-1 text-[12px] text-ink2 hover:text-ink`,dir:`auto`,onClick:()=>t(e),children:e},e))})]})}function va(e,t=`/`,n){let r=new URLSearchParams;e!=="default"&&r.set(`project`,e);let i=n?.get(`range`);i&&r.set(`range`,i);let a=r.toString();return a?`${t}?${a}`:t}function ya(){let[e]=zn(),t=ht(),n=e.get(`project`)||`default`,{data:r}=P(`/api/projects`,[n]),[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let s=r?.find(e=>e.slug===n),c=e=>{a(!1),t(e)};return(0,F.jsxs)(`div`,{ref:o,className:`relative px-2 pt-2`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-2 h-[34px] px-2 rounded-md border border-line hover:border-line2 bg-[#121219] text-left`,onClick:()=>a(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":i,children:[(0,F.jsx)(Ur,{size:14,className:`text-mute shrink-0`}),(0,F.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`span`,{className:`block text-[10px] uppercase tracking-wider text-mute leading-none mb-0.5`,children:`Project`}),(0,F.jsx)(`span`,{className:`block truncate text-[12.8px] leading-tight`,children:s?.name??(r?n:`…`)})]}),(0,F.jsx)(Ar,{size:13,className:`text-mute shrink-0`})]}),i&&(0,F.jsxs)(`div`,{className:`absolute left-2 right-2 top-[calc(100%+4px)] z-30 rounded-lg border border-line2 bg-[#15151d] shadow-xl py-1`,role:`listbox`,children:[r?.map(t=>(0,F.jsxs)(`button`,{role:`option`,"aria-selected":t.slug===n,onClick:()=>c(va(t.slug,`/`,e)),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-[#1d1d27]`,children:[(0,F.jsx)(`span`,{className:`w-3.5 shrink-0`,children:t.slug===n&&(0,F.jsx)(Tr,{size:13,className:`text-brand`})}),(0,F.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`span`,{className:`block truncate text-[12.8px]`,children:t.name}),(0,F.jsxs)(`span`,{className:`block text-mute text-[11px]`,children:[t.apps,` app`,t.apps===1?``:`s`]})]})]},t.slug)),(0,F.jsx)(`div`,{className:`border-t border-line my-1`}),(0,F.jsxs)(`button`,{onClick:()=>c(`${va(n,`/projects`,e)}${n==="default"&&!e.get(`range`)?`?`:`&`}new=1`),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-[#1d1d27] text-[12.8px]`,children:[(0,F.jsx)(_i,{size:13,className:`ml-0.5`}),`New project`]}),(0,F.jsxs)(`button`,{onClick:()=>c(va(n,`/projects`,e)),className:`w-full flex items-center gap-2 px-2.5 py-1.5 text-left hover:bg-[#1d1d27] text-[12.8px] text-ink2`,children:[(0,F.jsx)(`span`,{className:`w-3.5`}),`Manage projects`]})]})]})}function B(e,t){return e==null||!Number.isFinite(e)?`—`:e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:e>=100?`${e.toFixed(t??0)}ms`:e>=10?`${e.toFixed(t??1)}ms`:`${e.toFixed(t??2)}ms`}function V(e){return e==null||!Number.isFinite(e)?`—`:Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e4?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2})}function ba(e,t=2){return e==null||!Number.isFinite(e)?`—`:e===0?`0%`:e<.01?`<0.01%`:`${e.toFixed(e>=10?1:t)}%`}function xa(e){return e==null?`—`:e>=1073741824?`${(e/1073741824).toFixed(2)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}function Sa(e){if(!e)return`—`;let t=Date.now()-e;return t<0?`just now`:t<6e4?`${Math.max(1,Math.round(t/1e3))}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:t<864e5?`${Math.round(t/36e5)}h ago`:`${Math.round(t/864e5)}d ago`}function Ca(e,t=!1){let n=new Date(e),r=n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});return t?`${n.toLocaleDateString([],{month:`short`,day:`numeric`})} ${r}`:r}function wa(e,t){let n=new Date(e);return t>1728e5?n.toLocaleDateString([],{month:`short`,day:`numeric`}):n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1})}function Ta(e,t){if(e==null||t==null||!Number.isFinite(e)||!Number.isFinite(t)||t===0)return null;let n=(e-t)/t*100;return Math.abs(n)<1?{text:`±0%`,dir:`flat`}:{text:`${n>0?`+`:``}${n.toFixed(0)}%`,dir:n>0?`up`:`down`}}var Ea=encodeURIComponent,Da=864e5,Oa=e=>new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16),ka=e=>e?new Date(e).getTime():NaN,Aa=e=>{let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()};function ja(){let e=I(),[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),l=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!t)return;i(Oa(e.from)),o(Oa(e.to)),c(``);let r=e=>{l.current&&!l.current.contains(e.target)&&n(!1)},a=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`mousedown`,r),window.addEventListener(`keydown`,a),()=>{window.removeEventListener(`mousedown`,r),window.removeEventListener(`keydown`,a)}},[t]);let u=(t,r)=>{if(!Number.isFinite(t)||!Number.isFinite(r))return c(`Pick both dates`);if(r<=t)return c(`"To" must be after "From"`);e.setCustom(t,Math.min(r,Date.now())),n(!1)},d=Date.now(),f=Aa(d),p=[[`Today`,f,d],[`Yesterday`,f-Da,f],[`Same day last week`,f-7*Da,f-6*Da],[`Last 14 days`,d-14*Da,d],[`Last 30 days`,d-30*Da,d],[`Last 90 days`,d-90*Da,d]],m=e.range===`custom`;return(0,F.jsxs)(`div`,{className:`relative`,ref:l,children:[m?(0,F.jsxs)(`div`,{className:`flex items-center gap-1 pill !h-[30px] !px-2.5 !text-[12px] cursor-pointer`,style:{borderColor:`#5a2340`,color:`#ff9cc0`},onClick:()=>n(e=>!e),title:`Change the custom window`,children:[(0,F.jsx)(Sr,{size:12}),Ca(e.from,!0),` → `,Ca(e.to,!0),(0,F.jsx)(`button`,{className:`ml-1 hover:text-white`,onClick:t=>{t.stopPropagation(),e.setRange(`1h`)},title:`Back to live window`,children:(0,F.jsx)(Ki,{size:12})})]}):(0,F.jsx)(`button`,{className:`btn px-2`,onClick:()=>n(e=>!e),title:`Custom time window`,"aria-label":`Custom time window`,children:(0,F.jsx)(Sr,{size:13})}),t&&(0,F.jsxs)(`div`,{className:`absolute right-0 top-[36px] z-50 w-[340px] rounded-lg border border-line2 p-3 shadow-2xl flex flex-col gap-3`,style:{background:`rgba(20,20,27,.99)`},children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium`,children:`Custom window`}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:p.map(([e,t,n])=>(0,F.jsx)(`button`,{className:`btn h-7 justify-start text-[12px]`,onClick:()=>u(t,n),children:e},e))}),(0,F.jsxs)(`div`,{className:`grid grid-cols-[40px_1fr] items-center gap-x-2 gap-y-1.5 text-[12px]`,children:[(0,F.jsx)(`label`,{className:`text-mute`,htmlFor:`rp-from`,children:`From`}),(0,F.jsx)(`input`,{id:`rp-from`,className:`input h-8 mono text-[12px]`,type:`datetime-local`,value:r,max:Oa(d),onChange:e=>i(e.target.value)}),(0,F.jsx)(`label`,{className:`text-mute`,htmlFor:`rp-to`,children:`To`}),(0,F.jsx)(`input`,{id:`rp-to`,className:`input h-8 mono text-[12px]`,type:`datetime-local`,value:a,max:Oa(d),onChange:e=>o(e.target.value)})]}),s&&(0,F.jsx)(`div`,{className:`text-[12px]`,style:{color:`#ff8a8a`},children:s}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute text-[11px] leading-snug`,children:`Older than raw data, Requests, Jobs and the Overview use hourly summaries.`}),(0,F.jsx)(`button`,{className:`btn btn-primary h-7 shrink-0`,onClick:()=>u(ka(r),ka(a)),children:`Apply`})]})]})]})}function H({title:e,sub:t,right:n,children:r,className:i=``,pad:a=!0}){return(0,F.jsxs)(`section`,{className:`card ${i}`,children:[(e||n)&&(0,F.jsxs)(`div`,{className:`card-h`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e}),t&&(0,F.jsx)(`span`,{className:`card-sub truncate`,children:t})]}),n]}),(0,F.jsx)(`div`,{className:a?`p-3.5`:``,children:r})]})}function Ma({title:e,sub:t,right:n,icon:r}){return(0,F.jsxs)(`div`,{className:`flex items-end justify-between gap-4 mb-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`h1`,{className:`text-[19px] font-semibold tracking-tight flex items-center gap-2 min-w-0`,children:[r,(0,F.jsx)(`span`,{className:`truncate`,children:e})]}),t&&(0,F.jsx)(`div`,{className:`text-ink2 mt-1 text-[12.5px]`,children:t})]}),n&&(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:n})]})}function U({label:e}){return(0,F.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-mute py-10`,children:[(0,F.jsx)(ri,{size:16,className:`animate-spin`}),e||`Loading…`]})}function Na({title:e,children:t,icon:n}){return(0,F.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center py-10 px-6 gap-2`,children:[(0,F.jsx)(`div`,{className:`text-mute`,children:n||(0,F.jsx)(Yr,{size:22})}),(0,F.jsx)(`div`,{className:`font-medium`,children:e}),t&&(0,F.jsx)(`div`,{className:`text-mute max-w-md text-[12.5px]`,children:t})]})}var Pa=()=>window.dispatchEvent(new Event(`obz:refresh`));function W({error:e,onRetry:t}){return e?(0,F.jsxs)(`div`,{className:`card px-4 py-10 text-[12.5px] flex flex-col items-center justify-center gap-3 text-center`,role:`alert`,style:{borderColor:`#5a2328`,color:`#ff9b9b`},children:[(0,F.jsx)(Vi,{size:20}),(0,F.jsx)(`div`,{className:`max-w-[560px]`,children:e.message||`Something went wrong loading this.`}),(0,F.jsxs)(`button`,{type:`button`,className:`btn mt-1`,onClick:t??Pa,children:[(0,F.jsx)(bi,{size:13}),`Refresh stats`]})]}):null}function Fa({label:e,value:t,sub:n,deltaText:r,deltaDir:i,deltaTitle:a,badWhen:o=`up`,spark:s,color:c,onClick:l}){return(0,F.jsxs)(`div`,{className:`card px-3.5 py-3 flex flex-col gap-1 min-w-0 ${l?`cursor-pointer hover:border-line2`:``}`,onClick:l,children:[(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] font-medium flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e}),r&&(0,F.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[11px]`,title:a,style:{color:i===`flat`||o===`none`?`var(--color-mute)`:i&&i!==`flat`&&o!==`none`&&i===o?`#ff8a8a`:`#5fd38a`},children:[i===`up`?(0,F.jsx)(mr,{size:11}):i===`down`?(0,F.jsx)(dr,{size:11}):null,r]})]}),(0,F.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,F.jsx)(`div`,{className:`text-[22px] font-semibold tracking-tight tabular-nums leading-none`,style:c?{color:c}:void 0,children:t}),s&&s.length>1&&(0,F.jsx)(Ia,{data:s,color:c})]}),n&&(0,F.jsx)(`div`,{className:`text-mute text-[11.5px] truncate`,children:n})]})}function Ia({data:e,color:t=`var(--color-s1)`,w:n=72,h:r=22}){let i=Math.max(1,...e),a=n/e.length;return(0,F.jsx)(`svg`,{width:n,height:r,className:`shrink-0`,"aria-hidden":!0,children:e.map((e,n)=>{let o=e?Math.max(1.5,e/i*r):0;return(0,F.jsx)(`rect`,{x:n*a+.5,y:r-o,width:Math.max(1,a-1),height:o,rx:1,fill:t,opacity:.85},n)})})}function La({status:e}){if(e==null)return(0,F.jsx)(`span`,{className:`text-mute`,children:`—`});let t=e>=500?`var(--color-crit)`:e>=400?`var(--color-warn)`:`var(--color-good)`;return(0,F.jsx)(`span`,{className:`mono text-[11.5px] px-1.5 py-[1px] rounded`,style:{color:t,background:`color-mix(in srgb, ${t} 14%, transparent)`},children:e})}function Ra({m:e}){if(!e)return null;let t=Ja;return(0,F.jsx)(`span`,{className:`mono text-[10.5px] font-semibold inline-block shrink-0 ${Ya.includes(e)?`min-w-[44px] pr-2`:`w-[44px]`}`,style:{color:t[e]||`var(--color-ink2)`},children:e})}function za({name:e,render:t}){let n=/^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|ALL|QUERY|MUTATION|SUBSCRIPTION)\s+(.*)$/.exec(e),r=t??(e=>e);return n?(0,F.jsxs)(`span`,{className:`inline-flex items-center min-w-0`,children:[(0,F.jsx)(Ra,{m:n[1]}),(0,F.jsx)(`span`,{className:`mono truncate`,children:r(n[2])})]}):(0,F.jsx)(`span`,{className:`mono`,children:r(e)})}function G({kind:e,children:t}){let[n,r]={good:[`var(--color-good)`,Mr],warn:[`var(--color-warn)`,jr],serious:[`var(--color-serious)`,jr],crit:[`var(--color-crit)`,jr],neutral:[`var(--color-mute)`,Nr]}[e];return(0,F.jsxs)(`span`,{className:`pill`,style:{color:n,borderColor:`color-mix(in srgb, ${n} 40%, transparent)`,background:`color-mix(in srgb, ${n} 10%, transparent)`},children:[(0,F.jsx)(r,{size:11}),t]})}function Ba({text:e,label:t=`Copy`,className:n=`btn`}){let[r,i]=(0,v.useState)(!1);return(0,F.jsxs)(`button`,{className:n,onClick:async()=>{let t=typeof e==`function`?await e():e;try{await navigator.clipboard.writeText(t)}catch{let e=document.createElement(`textarea`);e.value=t,document.body.appendChild(e),e.select(),document.execCommand(`copy`),e.remove()}i(!0),setTimeout(()=>i(!1),1400)},children:[r?(0,F.jsx)(Tr,{size:13}):(0,F.jsx)(Rr,{size:13}),r?`Copied`:t]})}function Va({value:e,options:t,onChange:n}){return(0,F.jsx)(`div`,{className:`seg`,children:t.map(t=>(0,F.jsx)(`button`,{className:e===t.id?`on`:``,onClick:()=>n(t.id),children:t.label},t.id))})}function Ha({rows:e,cols:t,onRow:n,initialSort:r,initialDir:i=`desc`,empty:a,maxHeight:o,rowKey:s,paged:c,resetKey:l}){let[u,d]=(0,v.useState)(r),[f,p]=(0,v.useState)(i),[m,h]=(0,v.useState)(()=>{try{let e=Number(localStorage.getItem(`obz.pageSize`));return Ua.includes(e)?e:20}catch{return 20}}),[g,_]=(0,v.useState)(0),[y,b]=(0,v.useState)(l);y!==l&&(b(l),_(0));let x=e=>{h(e),_(0);try{localStorage.setItem(`obz.pageSize`,String(e))}catch{}},S=(0,v.useMemo)(()=>{let n=t.find(e=>e.key===u);if(!n||!n.sort)return e;let r=n.sort;return[...e].sort((e,t)=>{let n=r(e),i=r(t),a=typeof n==`number`&&typeof i==`number`?n-i:String(n).localeCompare(String(i));return f===`asc`?a:-a})},[e,t,u,f]);if(!e.length&&a)return(0,F.jsx)(F.Fragment,{children:a});let C=c?Math.max(1,Math.ceil(S.length/m)):1,w=Math.min(g,C-1),T=c?S.slice(w*m,w*m+m):S;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`overflow-auto`,style:o?{maxHeight:o}:void 0,children:(0,F.jsxs)(`table`,{className:`tbl`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{children:t.map(e=>(0,F.jsx)(`th`,{style:{width:e.width},className:`${e.num?`num`:``} ${e.sort?`cursor-pointer select-none hover:text-ink`:``}`,onClick:()=>{e.sort&&(_(0),u===e.key?p(f===`asc`?`desc`:`asc`):(d(e.key),p(`desc`)))},children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[e.label,u===e.key&&(f===`asc`?(0,F.jsx)(kr,{size:11}):(0,F.jsx)(Er,{size:11}))]})},e.key))})}),(0,F.jsx)(`tbody`,{children:T.map((e,r)=>(0,F.jsx)(`tr`,{className:n?`clickable`:``,onClick:n?()=>n(e):void 0,children:t.map(t=>(0,F.jsx)(`td`,{className:`${t.num?`num`:``} ${t.className||``}`,children:t.render(e)},t.key))},s?s(e,r):r))})]})}),c&&S.length>Ua[0]&&(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 pt-3 pb-1 text-[12px] text-mute`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{children:`Rows per page`}),(0,F.jsx)(`div`,{className:`seg`,role:`group`,"aria-label":`Rows per page`,children:Ua.map(e=>(0,F.jsx)(`button`,{type:`button`,className:e===m?`on`:``,"aria-pressed":e===m,onClick:()=>x(e),children:e},e))})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Wa(w*m+1),`–`,Wa(Math.min(S.length,(w+1)*m)),` of `,Wa(S.length)]}),(0,F.jsx)(`button`,{type:`button`,className:`btn h-7`,disabled:w===0,onClick:()=>_(w-1),children:`Prev`}),(0,F.jsx)(`button`,{type:`button`,className:`btn h-7`,disabled:w>=C-1,onClick:()=>_(w+1),children:`Next`})]})]})]})}var Ua=[10,20,50],Wa=e=>e.toLocaleString(`en-US`);function Ga({value:e,max:t,color:n=`var(--color-s1)`,w:r=80}){return(0,F.jsx)(`span`,{className:`inline-block align-middle rounded-full overflow-hidden`,style:{width:r,height:5,background:`#22222c`},children:(0,F.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${Math.min(100,e/Math.max(t,1e-9)*100)}%`,background:n}})})}function Ka({items:e}){return(0,F.jsx)(`dl`,{className:`grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5 text-[12.5px]`,children:e.map(([e,t],n)=>(0,F.jsxs)(v.Fragment,{children:[(0,F.jsx)(`dt`,{className:`text-mute`,children:e}),(0,F.jsx)(`dd`,{className:`min-w-0 truncate`,children:t})]},n))})}function qa({open:e,onClose:t,title:n,children:r,wide:i}){return e?(0,F.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[8vh] px-4`,style:{background:`rgba(5,5,8,.7)`},onMouseDown:t,children:(0,F.jsxs)(`div`,{className:`card w-full ${i?`max-w-3xl`:`max-w-lg`} shadow-2xl`,onMouseDown:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-line`,children:[(0,F.jsx)(`div`,{className:`font-semibold`,children:n}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,onClick:t,children:`✕`})]}),(0,F.jsx)(`div`,{className:`p-4 max-h-[75vh] overflow-auto`,children:r})]})}):null}function K({label:e,children:t,hint:n}){return(0,F.jsxs)(`label`,{className:`flex flex-col gap-1 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-ink2 font-medium`,children:e}),t,n&&(0,F.jsx)(`span`,{className:`text-mute text-[11px]`,children:n})]})}var Ja={GET:`#5aa2f0`,POST:`#3fbf8f`,PUT:`#e0a33a`,PATCH:`#c99af0`,DELETE:`#f07070`,QUERY:`#e86fc4`,MUTATION:`#f0a35a`,SUBSCRIPTION:`#6fc8e8`},Ya=[`QUERY`,`MUTATION`,`SUBSCRIPTION`];function Xa({tip:e,children:t,className:n=``}){let[r,i]=(0,v.useState)(null);return(0,F.jsxs)(`span`,{className:`cursor-help underline decoration-dotted decoration-[#55556a] underline-offset-4 ${n}`,onMouseEnter:e=>{let t=e.currentTarget.getBoundingClientRect();i({x:t.left+t.width/2,y:t.top})},onMouseLeave:()=>i(null),children:[t,r&&(0,F.jsx)(`span`,{role:`tooltip`,className:`mono fixed z-[100] -translate-x-1/2 -translate-y-full rounded-md border border-[#2c2c36] px-2.5 py-1.5 text-[11.5px] text-ink whitespace-nowrap shadow-2xl pointer-events-none`,style:{left:r.x,top:r.y-6,background:`rgba(17,17,22,.97)`},children:e})]})}function Za(e){let t=e.toLowerCase();return/^(prod|production|live|prd)$/.test(t)?`#3ccf7a`:/^(stag|staging|stage|preprod|pre-prod|uat|qa|test|testing)$/.test(t)?`#f5c04e`:/^(dev|development|local|sandbox|preview)$/.test(t)?`#7fb2f0`:`#a3a3b8`}function Qa({className:e=``,tall:t,short:n}){let r=I(),i=r.meta?.environments??[];return i.length<2&&!r.env?null:(0,F.jsxs)(`div`,{className:`relative shrink-0 ${e}`,children:[(0,F.jsx)(`span`,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-2 h-2 rounded-full pointer-events-none`,style:{background:r.env?Za(r.env):`transparent`,border:r.env?`none`:`1.5px solid #5c5c70`}}),(0,F.jsxs)(`select`,{className:`select !pl-6 ${t?`h-8`:``}`,value:r.env,onChange:e=>r.setEnv(e.target.value),"aria-label":`Environment`,title:`Environment`,children:[(0,F.jsx)(`option`,{value:``,children:n?`All envs`:`All environments`}),i.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.id},e.id)),r.env&&!i.some(e=>e.id===r.env)&&(0,F.jsx)(`option`,{value:r.env,children:r.env})]})]})}function $a(){let e=I(),t=e.meta?.services??[];if(!e.env)return t;let n=new Set(e.meta?.environments?.find(t=>t.id===e.env)?.services??[]);return t.filter(e=>n.has(e.id))}var eo={pg:`PostgreSQL`,mysql2:`MySQL`,ioredis:`Redis`,bullmq:`BullMQ`,"node-cron":`cron`,cron:`cron`},to={express:{label:`Express`,color:`#f4f4f8`,bg:`rgba(244, 244, 248, .1)`},fastify:{label:`Fastify`,color:`#8fd3ff`,bg:`rgba(143, 211, 255, .12)`}};function no(e){let[t,n]=e.split(`@`);return to[t]?{label:`${to[t].label}${n&&n!==`?`?` ${n}`:``}`,web:!0}:{label:eo[t]??t,web:!1}}function ro(e){return e.filter(e=>to[e.split(`@`)[0]]).map(e=>no(e).label).join(`, `)}function io({frameworks:e,web:t=!1,className:n=``}){let r=new Set,i=e.map(e=>({f:e,...no(e)})).filter(e=>(!t||e.web)&&!r.has(e.label)&&(r.add(e.label),!0)).sort((e,t)=>Number(t.web)-Number(e.web));return i.length?(0,F.jsx)(`span`,{className:`inline-flex flex-wrap items-center gap-1 ${n}`,children:i.map(e=>{let t=to[e.f.split(`@`)[0]];return(0,F.jsx)(`span`,{className:`text-[10.5px] font-semibold leading-none px-1.5 py-[3px] rounded whitespace-nowrap`,style:t?{color:t.color,background:t.bg}:{color:`#9a9ab0`,background:`rgba(154, 154, 176, .1)`,fontWeight:500},title:`Detected by the SDK: ${e.f}`,children:e.label},e.label)})}):null}function ao({app:e,web:t,className:n}){let r=I().meta?.services.find(t=>t.id===e);return r?(0,F.jsx)(io,{frameworks:r.frameworks,web:t,className:n}):null}var oo=[{items:[{to:`/`,label:`Overview`,Icon:$r,end:!0}]},{title:`Activity`,items:[{to:`/requests`,label:`Requests`,Icon:ur},{to:`/jobs`,label:`Jobs`,Icon:Gi},{to:`/traces`,label:`Traces`,Icon:Gr},{to:`/map`,label:`Service map`,Icon:ui}]},{title:`Diagnose`,items:[{to:`/errors`,label:`Errors`,Icon:xr},{to:`/secrets`,label:`Secrets in logs`,Icon:Ai,badge:`secrets`},{to:`/logs`,label:`Logs`,Icon:Ti},{to:`/services`,label:`Services`,Icon:yr},{to:`/queries`,label:`Queries`,Icon:Br},{to:`/users`,label:`Users`,Icon:Ui}]},{title:`Runtime`,items:[{to:`/profiler`,label:`Profiler`,Icon:zr},{to:`/metrics`,label:`Custom metrics`,Icon:Wr},{to:`/releases`,label:`Releases`,Icon:xi}]},{title:`Respond`,items:[{to:`/alerts`,label:`Alerts`,Icon:gr,badge:`alerts`},{to:`/slos`,label:`SLOs`,Icon:Li},{to:`/status-pages`,label:`Status pages`,Icon:yi},{to:`/issues`,label:`Issues`,Icon:Pr,badge:`issues`}]}],so={"/logs":`logs`,"/alerts":`alerts`,"/slos":`slos`};function co(e){let{meta:t}=I(),n=so[e];return!!(n&&t?.usage&&!t.usage.features[n])}function lo({to:e}){return co(e)?(0,F.jsx)(ii,{size:12,className:`text-mute`,"aria-label":`Not in your plan`}):null}function uo({to:e,n:t,red:n}){return co(e)||!(t>0)?null:(0,F.jsx)(`span`,{className:`text-[10px] font-semibold px-1.5 rounded-full`,style:{background:n?`#d03b3b`:`#2a2a36`,color:`#fff`},children:t})}var fo=[{to:`/`,label:`Home`,hint:`Is my app healthy?`,Icon:qr,end:!0},{to:`/alerts`,label:`Alerts`,hint:`What broke, and who gets told`,Icon:gr,badge:`simpleAlerts`},{to:`/releases`,label:`Releases`,hint:`Did my last deploy make things better or worse?`,Icon:xi},{to:`/metrics`,label:`Metrics`,hint:`Traffic, speed, errors, server`,Icon:wr},{to:`/logs`,label:`Logs`,hint:`What your app printed`,Icon:Ti},{to:`/settings`,label:`Settings`,hint:`Connect your app`,Icon:ki}],po=[{id:`1h`,label:`Last hour`},{id:`24h`,label:`Today`},{id:`7d`,label:`7 days`}];function mo({compact:e}){let{mode:t,setMode:n}=rr(),r=(r,i,a,o)=>(0,F.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t===r,className:t===r?`on`:``,onClick:()=>n(r),title:o,children:[(0,F.jsx)(a,{size:13}),!e&&i]});return(0,F.jsxs)(`div`,{className:`mode-toggle`,role:`radiogroup`,"aria-label":`Dashboard mode`,children:[r(`simple`,`Simple`,Pi,`Simple mode: is my app healthy, what broke, what changed, what to do`),r(`advanced`,`Advanced`,Ni,`Advanced mode: every request, trace, query and runtime detail`)]})}function ho({size:e=22}){let t=`obz-tile-${(0,v.useId)().replace(/:/g,``)}`;return(0,F.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 64 64`,"aria-hidden":!0,className:`shrink-0`,children:[(0,F.jsx)(`defs`,{children:(0,F.jsxs)(`linearGradient`,{id:t,x1:`0`,y1:`0`,x2:`64`,y2:`64`,gradientUnits:`userSpaceOnUse`,children:[(0,F.jsx)(`stop`,{offset:`0`,stopColor:`#ff3d7f`}),(0,F.jsx)(`stop`,{offset:`1`,stopColor:`#a855f7`})]})}),(0,F.jsx)(`rect`,{width:`64`,height:`64`,rx:`16`,fill:`url(#${t})`}),(0,F.jsx)(`path`,{d:`M7 32 H14 L20 20 H44 L20 44 H44 L50 32 H57`,fill:`none`,stroke:`#fff`,strokeWidth:e<24?5.6:4.6,strokeLinecap:`round`,strokeLinejoin:`round`})]})}var go={ob:`M30.7 1.4L30.7 1.4Q23.3 1.4 17.4-1.7Q11.6-4.7 8.3-10.4Q4.9-16 4.9-23.9L4.9-23.9L4.9-25.5Q4.9-33.4 8.3-39.1Q11.6-44.8 17.4-47.8Q23.3-50.8 30.7-50.8L30.7-50.8Q38.1-50.8 43.9-47.8Q49.7-44.8 53.1-39.1Q56.4-33.4 56.4-25.5L56.4-25.5L56.4-23.9Q56.4-16 53.1-10.4Q49.7-4.7 43.9-1.7Q38.1 1.4 30.7 1.4ZM30.7-8.8L30.7-8.8Q37-8.8 41-12.9Q45-16.9 45-24.2L45-24.2L45-25.2Q45-32.5 41-36.6Q37-40.6 30.7-40.6L30.7-40.6Q24.4-40.6 20.4-36.6Q16.4-32.5 16.4-25.2L16.4-25.2L16.4-24.2Q16.4-16.9 20.4-12.9Q24.4-8.8 30.7-8.8ZM93.8 1.4L93.8 1.4Q86.8 1.4 83.0-1.1Q79.3-3.5 77.6-6.5L77.6-6.5L75.9-6.5L75.9 0L64.6 0L64.6-70L76.1-70L76.1-43.2L77.8-43.2Q78.9-45.2 80.8-46.9Q82.8-48.6 86.0-49.7Q89.1-50.8 93.8-50.8L93.8-50.8Q99.9-50.8 105-47.9Q110.1-44.9 113.2-39.2Q116.3-33.5 116.3-25.5L116.3-25.5L116.3-23.9Q116.3-15.9 113.2-10.2Q110.1-4.5 105.0-1.6Q99.8 1.4 93.8 1.4ZM90.4-8.6L90.4-8.6Q96.6-8.6 100.7-12.7Q104.8-16.7 104.8-24.2L104.8-24.2L104.8-25.2Q104.8-32.8 100.8-36.8Q96.7-40.8 90.4-40.8L90.4-40.8Q84.2-40.8 80.0-36.8Q75.9-32.8 75.9-25.2L75.9-25.2L75.9-24.2Q75.9-16.7 80.0-12.7Q84.2-8.6 90.4-8.6Z`,z:`M163 0L121.6 0L121.6-13.8L149.8-38.4L149.8-39.9L122.6-39.9L122.6-49.4L162.2-49.4L162.2-35.6L134-11L134-9.5L163-9.5L163 0Z`,erver:`M192.9 1.4L192.9 1.4Q185.5 1.4 179.8-1.8Q174.2-4.9 171.1-10.7Q167.9-16.4 167.9-24.1L167.9-24.1L167.9-25.3Q167.9-33.1 171-38.8Q174.1-44.5 179.7-47.7Q185.3-50.8 192.6-50.8L192.6-50.8Q199.8-50.8 205.2-47.7Q210.6-44.5 213.6-38.8Q216.6-33.1 216.6-25.5L216.6-25.5L216.6-21.4L179.5-21.4Q179.7-15.6 183.6-12.1Q187.5-8.6 193.2-8.6L193.2-8.6Q198.8-8.6 201.5-11.1Q204.2-13.5 205.6-16.6L205.6-16.6L215.1-11.7Q213.7-9 211.1-6.0Q208.4-2.9 204-0.8Q199.6 1.4 192.9 1.4ZM179.6-30.1L179.6-30.1L204.9-30.1Q204.5-35 201.2-37.9Q197.8-40.8 192.5-40.8L192.5-40.8Q187-40.8 183.7-37.9Q180.4-35 179.6-30.1ZM235.9 0L224.4 0L224.4-49.4L235.7-49.4L235.7-43.7L237.4-43.7Q238.5-46.8 241.1-48.2Q243.7-49.6 247.3-49.6L247.3-49.6L253.3-49.6L253.3-39.4L247.1-39.4Q242.1-39.4 239-36.8Q235.9-34.1 235.9-28.6L235.9-28.6L235.9 0ZM288.6 0L270.4 0L254.2-49.4L266.4-49.4L278.6-8.4L280.3-8.4L292.6-49.4L304.8-49.4L288.6 0ZM331.1 1.4L331.1 1.4Q323.7 1.4 318.1-1.8Q312.4-4.9 309.3-10.7Q306.1-16.4 306.1-24.1L306.1-24.1L306.1-25.3Q306.1-33.1 309.2-38.8Q312.3-44.5 317.9-47.7Q323.5-50.8 330.8-50.8L330.8-50.8Q338-50.8 343.4-47.7Q348.8-44.5 351.8-38.8Q354.8-33.1 354.8-25.5L354.8-25.5L354.8-21.4L317.7-21.4Q317.9-15.6 321.8-12.1Q325.7-8.6 331.4-8.6L331.4-8.6Q337-8.6 339.7-11.1Q342.4-13.5 343.8-16.6L343.8-16.6L353.3-11.7Q351.9-9 349.3-6.0Q346.6-2.9 342.2-0.8Q337.8 1.4 331.1 1.4ZM317.8-30.1L317.8-30.1L343.1-30.1Q342.7-35 339.3-37.9Q336-40.8 330.7-40.8L330.7-40.8Q325.2-40.8 321.9-37.9Q318.6-35 317.8-30.1ZM374.1 0L362.6 0L362.6-49.4L373.9-49.4L373.9-43.7L375.6-43.7Q376.7-46.8 379.3-48.2Q381.9-49.6 385.5-49.6L385.5-49.6L391.5-49.6L391.5-39.4L385.3-39.4Q380.3-39.4 377.2-36.8Q374.1-34.1 374.1-28.6L374.1-28.6L374.1 0Z`};function _o({size:e=15}){let t=Math.max(1,Math.round(e*.73*49.4/73))/49.4,n=Math.ceil(71*t),r=n+Math.ceil(1.5*t),i=Math.ceil(397*t),a=e<32?`#ff5c93`:`#ff3d7f`;return(0,F.jsxs)(`svg`,{height:r,width:i,viewBox:`-1 ${-n/t} ${i/t} ${r/t}`,role:`img`,"aria-label":`Obzerver`,className:`shrink-0 block`,children:[(0,F.jsx)(`path`,{d:go.ob,fill:`#f4f4f8`}),(0,F.jsx)(`path`,{d:go.z,fill:a}),(0,F.jsx)(`path`,{d:go.erver,fill:`#f4f4f8`})]})}function vo(){let{mode:e}=rr();return e?e===`simple`?(0,F.jsx)(bo,{}):(0,F.jsx)(xo,{}):(0,F.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,F.jsx)(U,{})})}function yo(){let[e,t]=(0,v.useState)(()=>{try{return sessionStorage.getItem(`obz.ask.open`)===`1`}catch{return!1}}),[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{try{sessionStorage.setItem(`obz.ask.open`,e?`1`:`0`)}catch{}},[e]),(0,v.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`i`?(e.preventDefault(),t(e=>!e)):e.key===`Escape`&&t(!1)},n=e=>{let n=e.detail?.question;t(!0),n&&r(n)};return window.addEventListener(`keydown`,e),window.addEventListener(`obz:ask`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`obz:ask`,n)}},[]),{askOpen:e,setAskOpen:t,pending:n,clearPending:()=>r(null)}}function bo(){let e=I(),t=$a(),n=Qn(),{setMode:r}=rr(),{askOpen:i,setAskOpen:a,pending:o,clearPending:s}=yo(),c=(e.meta?.unreadAlerts||0)+(e.meta?.openSecrets||0);return(0,F.jsxs)(`div`,{className:`flex h-full simple`,children:[(0,F.jsxs)(`aside`,{className:`w-[220px] shrink-0 border-r border-line flex flex-col bg-[#0e0e14]`,children:[(0,F.jsxs)(`div`,{className:`h-[56px] flex items-center gap-1.5 px-4 border-b border-line`,children:[(0,F.jsx)(ho,{size:28}),(0,F.jsx)(`span`,{className:`mt-px`,children:(0,F.jsx)(_o,{size:20})})]}),(0,F.jsx)(ya,{}),(0,F.jsxs)(`nav`,{className:`flex-1 overflow-y-auto px-2.5 py-3 flex flex-col gap-1`,children:[fo.map(e=>(0,F.jsx)(Pn,{to:n(e.to),end:e.end,title:e.hint,className:({isActive:e})=>`flex items-center gap-3 h-[40px] px-3 rounded-lg text-[14px] ${e?`bg-[#1f1f2a] text-ink font-medium`:`text-ink2 hover:bg-[#16161e] hover:text-ink`}`,children:({isActive:t})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e.Icon,{size:17,style:{color:t?`#ff3d7f`:void 0}}),(0,F.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,F.jsx)(lo,{to:e.to}),e.badge&&(0,F.jsx)(uo,{to:e.to,n:c,red:!0})]})},e.to)),(0,F.jsxs)(`button`,{className:`mt-2 flex items-center gap-3 h-[40px] px-3 rounded-lg text-[14px] text-ink2 hover:text-ink ask-nav`,onClick:()=>a(!0),children:[(0,F.jsx)(Fi,{size:17,className:`text-brand`}),(0,F.jsx)(`span`,{className:`flex-1 text-left`,children:`Ask Obzeri`}),(0,F.jsx)(`span`,{className:`kbd`,children:`⌘I`})]})]}),(0,F.jsx)(`div`,{className:`p-3 border-t border-line`,children:(0,F.jsxs)(`button`,{className:`w-full text-left rounded-lg border border-line hover:border-line2 bg-[#121219] px-3 py-2.5 group`,onClick:()=>r(`advanced`),children:[(0,F.jsxs)(`div`,{className:`text-[12.5px] font-medium flex items-center gap-1.5`,children:[`Need every detail? `,(0,F.jsx)(pr,{size:13,className:`text-mute group-hover:text-ink transition-transform group-hover:translate-x-0.5`})]}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute mt-0.5 leading-snug`,children:`Advanced mode has traces, queries, the profiler, releases and more.`})]})})]}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col transition-[margin] duration-150`,style:{marginRight:i?480:0},children:[(0,F.jsxs)(`header`,{className:`h-[56px] shrink-0 border-b border-line flex items-center gap-3 px-5 bg-[#0e0e14]`,children:[(0,F.jsx)(mo,{}),(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsx)(Qa,{tall:!0}),(t.length>1||e.service)&&(0,F.jsxs)(`select`,{className:`select h-8`,value:e.service,onChange:t=>e.setService(t.target.value),"aria-label":`App`,children:[(0,F.jsx)(`option`,{value:``,children:`All apps`}),t.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.id,ro(e.frameworks)?` · ${ro(e.frameworks)}`:``]},e.id))]}),e.service&&(0,F.jsx)(ao,{app:e.service,web:!0}),i?(0,F.jsxs)(`select`,{className:`select h-8`,value:po.some(t=>t.id===e.range)?e.range:``,onChange:t=>t.target.value&&e.setRange(t.target.value),"aria-label":`Time range`,children:[!po.some(t=>t.id===e.range)&&(0,F.jsx)(`option`,{value:``,children:e.range===`custom`?`Custom`:e.range}),po.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,F.jsx)(`div`,{className:`seg seg-lg`,children:po.map(t=>(0,F.jsx)(`button`,{className:e.range===t.id?`on`:``,onClick:()=>e.setRange(t.id),children:t.label},t.id))}),(0,F.jsxs)(`button`,{className:`btn ask-btn h-8 ${i?`on px-2`:``}`,onClick:()=>a(e=>!e),title:`Ask Obzeri (⌘I / Ctrl+I)`,"aria-label":`Ask Obzeri`,"aria-pressed":i,children:[(0,F.jsx)(Fi,{size:14,className:`text-brand`}),!i&&`Ask Obzeri`]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-8 px-2`,onClick:e.refresh,title:`Refresh`,children:(0,F.jsx)(bi,{size:14})})]}),(0,F.jsx)(Qi,{}),(0,F.jsx)(`main`,{className:`flex-1 overflow-y-auto @container`,children:(0,F.jsx)(`div`,{className:`max-w-[1240px] mx-auto px-6 py-6`,children:(0,F.jsx)(Ht,{})})}),(0,F.jsx)(la,{open:i,onClose:()=>a(!1),pending:o,onPending:s,simple:!0})]})]})}function xo(){let e=I(),t=$a(),n=Qn(),r=ht(),[i,a]=(0,v.useState)(``),{askOpen:o,setAskOpen:s,pending:c,clearPending:l}=yo(),u={alerts:e.meta?.unreadAlerts||0,issues:e.meta?.openIssues||0,secrets:e.meta?.openSecrets||0};return(0,v.useEffect)(()=>{let e=e=>{e.key===`/`&&!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)&&(e.preventDefault(),document.getElementById(`global-search`)?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,F.jsxs)(`div`,{className:`flex h-full`,children:[(0,F.jsxs)(`aside`,{className:`w-[214px] shrink-0 border-r border-line flex flex-col bg-[#0e0e14]`,children:[(0,F.jsxs)(`div`,{className:`h-[52px] flex items-center gap-2 px-4 border-b border-line`,children:[(0,F.jsx)(ho,{size:28}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-[5px]`,children:[(0,F.jsx)(_o,{size:18}),(0,F.jsx)(`div`,{className:`text-[10.5px] leading-[14px] text-mute whitespace-nowrap`,children:e.meta?.version?.includes(`-`)?`v${e.meta.version}`:`Express · Fastify${e.meta?.version?` · v${e.meta.version}`:``}`})]})]}),(0,F.jsx)(ya,{}),(0,F.jsx)(`nav`,{className:`flex-1 overflow-y-auto px-2 py-3 flex flex-col gap-4`,children:oo.map((e,t)=>(0,F.jsxs)(`div`,{children:[e.title&&(0,F.jsx)(`div`,{className:`px-2 pb-1 text-[10.5px] uppercase tracking-wider text-mute font-medium`,children:e.title}),e.items.map(e=>(0,F.jsx)(Pn,{to:n(e.to),end:e.end,className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e] hover:text-ink`}`,children:({isActive:t})=>(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e.Icon,{size:15,style:{color:t?`#ff3d7f`:void 0}}),(0,F.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,F.jsx)(lo,{to:e.to}),e.badge&&(0,F.jsx)(uo,{to:e.to,n:u[e.badge],red:e.badge===`alerts`||e.badge===`secrets`})]})},e.to))]},t))}),(0,F.jsxs)(`div`,{className:`px-2 py-2 border-t border-line flex flex-col gap-0.5`,children:[(0,F.jsxs)(Pn,{to:n(`/integrations`),className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e]`}`,children:[(0,F.jsx)(gi,{size:15}),` Integrations`]}),(0,F.jsxs)(Pn,{to:n(`/usage`),className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e]`}`,children:[(0,F.jsx)(Cr,{size:15}),` `,(0,F.jsx)(`span`,{className:`flex-1`,children:`Usage`}),(0,F.jsx)(So,{})]}),(0,F.jsxs)(Pn,{to:n(`/settings`),className:({isActive:e})=>`flex items-center gap-2.5 h-[30px] px-2 rounded-md text-[12.8px] ${e?`bg-[#1d1d27] text-ink`:`text-ink2 hover:bg-[#16161e]`}`,children:[(0,F.jsx)(ki,{size:15}),` Setup & settings`]})]})]}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col transition-[margin] duration-150`,style:{marginRight:o?480:0},children:[(0,F.jsxs)(`header`,{className:`shrink-0 border-b border-line bg-[#0e0e14]`,children:[(0,F.jsxs)(`div`,{className:`h-[52px] flex items-center gap-3 px-5`,children:[(0,F.jsx)(mo,{}),(0,F.jsxs)(`form`,{className:`relative flex-1 min-w-[200px] max-w-[560px]`,onSubmit:e=>{e.preventDefault();let t=i.trim();t&&(r(n(/^[0-9a-f]{32}$/i.test(t)?`/traces/${t.toLowerCase()}`:`/traces?q=${encodeURIComponent(t)}`)),a(``))},children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{id:`global-search`,className:`input pl-8 pr-7 w-full`,placeholder:`Trace id, path, user, error…`,value:i,onChange:e=>a(e.target.value)}),(0,F.jsx)(`span`,{className:`kbd absolute right-2 top-1/2 -translate-y-1/2`,children:`/`})]}),(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsxs)(`button`,{className:`btn ask-btn ${o?`on px-2`:``}`,onClick:()=>s(e=>!e),title:`Ask Obzeri (⌘I / Ctrl+I)`,"aria-label":`Ask Obzeri`,"aria-pressed":o,children:[(0,F.jsx)(Fi,{size:13,className:`text-brand`}),!o&&`Ask Obzeri`]}),(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>e.setLive(!e.live),title:`Auto-refresh every 30s`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${e.live&&e.range!==`custom`?`live-dot`:``}`,style:{background:e.live&&e.range!==`custom`?`#0ca30c`:`#55556a`}}),e.live&&e.range!==`custom`?`Live`:`Paused`]}),(0,F.jsx)(`button`,{className:`btn px-2`,onClick:e.refresh,title:`Refresh`,children:(0,F.jsx)(bi,{size:13})})]}),(0,F.jsxs)(`div`,{className:`h-[42px] flex items-center gap-2.5 px-5 border-t border-[#1b1b24] bg-[#0c0c11]`,children:[(0,F.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-mute font-semibold mr-1`,children:`Showing`}),(0,F.jsx)(Qa,{}),(0,F.jsxs)(`select`,{className:`select`,value:e.service,onChange:t=>e.setService(t.target.value),"aria-label":`Application`,children:[(0,F.jsx)(`option`,{value:``,children:`All applications`}),t.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.id,ro(e.frameworks)?` · ${ro(e.frameworks)}`:``]},e.id))]}),e.service&&(0,F.jsx)(ao,{app:e.service}),(0,F.jsx)(`div`,{className:`flex-1`}),o?(0,F.jsxs)(`select`,{className:`select w-[74px]`,value:e.range===`custom`?``:e.range,onChange:t=>t.target.value&&e.setRange(t.target.value),"aria-label":`Time range`,children:[e.range===`custom`&&(0,F.jsx)(`option`,{value:``,children:`custom`}),Yn.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,F.jsx)(`div`,{className:`seg`,children:Yn.map(t=>(0,F.jsx)(`button`,{className:e.range===t.id?`on`:``,onClick:()=>e.setRange(t.id),children:t.label},t.id))}),(0,F.jsx)(ja,{})]})]}),(0,F.jsx)(Qi,{}),(0,F.jsx)(`main`,{className:`flex-1 overflow-y-auto @container`,children:(0,F.jsx)(`div`,{className:`max-w-[1500px] mx-auto px-5 py-5`,children:(0,F.jsx)(Ht,{})})}),(0,F.jsx)(la,{open:o,onClose:()=>s(!1),pending:c,onPending:l})]})]})}function So(){let{meta:e}=I(),t=e?.usage;if(!t||t.pct==null)return null;let n=t.pct>=100?`#ec835a`:t.pct>=80?`#fab219`:void 0;return(0,F.jsx)(`span`,{className:`text-[10.5px] tabular-nums text-mute`,style:n?{color:n}:void 0,children:Yi(t.pct)})}function Co(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Co(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function wo(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Co(e))&&(r&&(r+=` `),r+=t);return r}var To=o(((e,t)=>{t.exports=Array.isArray})),Eo=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),Do=o(((e,t)=>{var n=Eo(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),Oo=o(((e,t)=>{t.exports=Do().Symbol})),ko=o(((e,t)=>{var n=Oo(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Ao=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),jo=o(((e,t)=>{var n=Oo(),r=ko(),i=Ao(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),Mo=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),No=o(((e,t)=>{var n=jo(),r=Mo(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Po=o(((e,t)=>{var n=To(),r=No(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Fo=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),Io=o(((e,t)=>{var n=jo(),r=Fo(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),q=o(((e,t)=>{t.exports=Do()[`__core-js_shared__`]})),Lo=o(((e,t)=>{var n=q(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),Ro=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),zo=o(((e,t)=>{var n=Io(),r=Lo(),i=Fo(),a=Ro(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Bo=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),Vo=o(((e,t)=>{var n=zo(),r=Bo();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Ho=o(((e,t)=>{t.exports=Vo()(Object,`create`)})),Uo=o(((e,t)=>{var n=Ho();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Wo=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Go=o(((e,t)=>{var n=Ho(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Ko=o(((e,t)=>{var n=Ho(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),qo=o(((e,t)=>{var n=Ho(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Jo=o(((e,t)=>{var n=Uo(),r=Wo(),i=Go(),a=Ko(),o=qo();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),Yo=o(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Xo=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),Zo=o(((e,t)=>{var n=Xo();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Qo=o(((e,t)=>{var n=Zo(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),$o=o(((e,t)=>{var n=Zo();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),es=o(((e,t)=>{var n=Zo();function r(e){return n(this.__data__,e)>-1}t.exports=r})),ts=o(((e,t)=>{var n=Zo();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),ns=o(((e,t)=>{var n=Yo(),r=Qo(),i=$o(),a=es(),o=ts();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),rs=o(((e,t)=>{t.exports=Vo()(Do(),`Map`)})),is=o(((e,t)=>{var n=Jo(),r=ns(),i=rs();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),as=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),os=o(((e,t)=>{var n=as();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),ss=o(((e,t)=>{var n=os();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),cs=o(((e,t)=>{var n=os();function r(e){return n(this,e).get(e)}t.exports=r})),ls=o(((e,t)=>{var n=os();function r(e){return n(this,e).has(e)}t.exports=r})),us=o(((e,t)=>{var n=os();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),ds=o(((e,t)=>{var n=is(),r=ss(),i=cs(),a=ls(),o=us();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),fs=o(((e,t)=>{var n=ds(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),ps=o(((e,t)=>{var n=fs(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),ms=o(((e,t)=>{var n=ps(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),hs=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),gs=o(((e,t)=>{var n=Oo(),r=hs(),i=To(),a=No(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),_s=o(((e,t)=>{var n=gs();function r(e){return e==null?``:n(e)}t.exports=r})),vs=o(((e,t)=>{var n=To(),r=Po(),i=ms(),a=_s();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),ys=o(((e,t)=>{var n=No(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),bs=o(((e,t)=>{var n=vs(),r=ys();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),xs=o(((e,t)=>{var n=bs();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Ss=o(((e,t)=>{function n(e){return e==null}t.exports=n})),Cs=o(((e,t)=>{var n=jo(),r=To(),i=Mo(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),ws=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),Ts=o(((e,t)=>{t.exports=ws()})),Es=o(((e,t)=>{var n=jo(),r=Mo(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),Ds=o(((e,t)=>{var n=Es();function r(e){return n(e)&&e!=+e}t.exports=r})),Os=l(Cs()),ks=l(Ds()),As=l(xs()),js=l(Es()),J=l(Ss()),Ms=function(e){return e===0?0:e>0?1:-1},Ns=function(e){return(0,Os.default)(e)&&e.indexOf(`%`)===e.length-1},Y=function(e){return(0,js.default)(e)&&!(0,ks.default)(e)},Ps=function(e){return(0,J.default)(e)},Fs=function(e){return Y(e)||(0,Os.default)(e)},Is=0,Ls=function(e){var t=++Is;return`${e||``}${t}`},Rs=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!Y(e)&&!(0,Os.default)(e))return n;var i;if(Ns(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,ks.default)(i)&&(i=n),r&&i>t&&(i=t),i},zs=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},Bs=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[e[r]])n[e[r]]=!0;else return!0;return!1},Vs=function(e,t){return Y(e)&&Y(t)?function(n){return e+n*(t-e)}:function(){return t}};function Hs(e,t,n){return!e||!e.length?null:e.find(function(e){return e&&(typeof t==`function`?t(e):(0,As.default)(e,t))===n})}var Us=function(e){if(!e||!e.length)return null;for(var t=e.length,n=0,r=0,i=0,a=0,o=1/0,s=-1/0,c=0,l=0,u=0;u<t;u++)c=e[u].cx||0,l=e[u].cy||0,n+=c,r+=l,i+=c*l,a+=c*c,o=Math.min(o,c),s=Math.max(s,c);var d=t*a===n*n?0:(t*i-n*r)/(t*a-n*n);return{xmin:o,xmax:s,a:d,b:(r-d*n)/t}},Ws=function(e,t){return Y(e)&&Y(t)?e-t:(0,Os.default)(e)&&(0,Os.default)(t)?e.localeCompare(t):e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t))};function Gs(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}var Ks=l(Fo());function qs(e){"@babel/helpers - typeof";return qs=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},qs(e)}var Js=[`viewBox`,`children`],Ys=`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`),Xs=[`points`,`pathLength`],Zs={svg:Js,polygon:Xs,polyline:Xs},Qs=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`),$s=function(e,t){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),!(0,Ks.default)(n))return null;var r={};return Object.keys(n).forEach(function(e){Qs.includes(e)&&(r[e]=t||function(t){return n[e](n,t)})}),r},ec=function(e,t,n){return function(r){return e(t,n,r),null}},tc=function(e,t,n){if(!(0,Ks.default)(e)||qs(e)!==`object`)return null;var r=null;return Object.keys(e).forEach(function(i){var a=e[i];Qs.includes(i)&&typeof a==`function`&&(r||={},r[i]=ec(a,t,n))}),r},X=l(Io()),nc=Ts(),rc=[`children`],ic=[`children`];function ac(e,t){if(e==null)return{};var n=oc(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oc(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function sc(e){"@babel/helpers - typeof";return sc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sc(e)}var cc={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},lc=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},uc=null,dc=null,fc=function e(t){if(t===uc&&Array.isArray(dc))return dc;var n=[];return v.Children.forEach(t,function(t){(0,J.default)(t)||((0,nc.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),dc=n,uc=t,n};function pc(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return lc(e)}):[lc(t)],fc(e).forEach(function(e){var t=(0,As.default)(e,`type.displayName`)||(0,As.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function mc(e,t){var n=pc(e,t);return n&&n[0]}var hc=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Y(n)||n<=0||!Y(r)||r<=0)},gc=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),_c=function(e){return e&&e.type&&(0,Os.default)(e.type)&&gc.indexOf(e.type)>=0},vc=function(e){return e&&sc(e)===`object`&&`clipDot`in e},yc=function(e,t,n,r){var i=Zs?.[r]??[];return t.startsWith(`data-`)||!(0,X.default)(e)&&(r&&i.includes(t)||Ys.includes(t))||n&&Qs.includes(t)},Z=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,v.isValidElement)(e)&&(r=e.props),!(0,Ks.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){yc(r?.[e],e,t,n)&&(i[e]=r[e])}),i},bc=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return xc(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],o=n[i];if(Array.isArray(a)||Array.isArray(o)){if(!e(a,o))return!1}else if(!xc(a,o))return!1}return!0},xc=function(e,t){if((0,J.default)(e)&&(0,J.default)(t))return!0;if(!(0,J.default)(e)&&!(0,J.default)(t)){var n=e.props||{},r=n.children,i=ac(n,rc),a=t.props||{},o=a.children,s=ac(a,ic);return r&&o?Gs(i,s)&&bc(r,o):!r&&!o&&Gs(i,s)}return!1},Sc=function(e,t){var n=[],r={};return fc(e).forEach(function(e,i){if(_c(e))n.push(e);else if(e){var a=lc(e.type),o=t[a]||{},s=o.handler,c=o.once;if(s&&(!c||!r[a])){var l=s(e,a,i);n.push(l),r[a]=!0}}}),n},Cc=function(e){var t=e&&e.type;return t&&cc[t]?cc[t]:null},wc=function(e,t){return fc(t).indexOf(e)},Tc=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Ec(){return Ec=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ec.apply(this,arguments)}function Dc(e,t){if(e==null)return{};var n=Oc(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Oc(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kc(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=Dc(e,Tc),u=i||{width:n,height:r,x:0,y:0},d=wo(`recharts-surface`,a);return v.createElement(`svg`,Ec({},Z(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),v.createElement(`title`,null,s),v.createElement(`desc`,null,c),t)}var Ac=[`children`,`className`];function jc(){return jc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jc.apply(this,arguments)}function Mc(e,t){if(e==null)return{};var n=Nc(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nc(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Pc=v.forwardRef(function(e,t){var n=e.children,r=e.className,i=Mc(e,Ac),a=wo(`recharts-layer`,r);return v.createElement(`g`,jc({className:a},Z(i,!0),{ref:t}),n)}),Fc=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}t.exports=n})),Ic=o(((e,t)=>{var n=Fc();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),Lc=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),Rc=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),zc=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),Bc=o(((e,t)=>{var n=Rc(),r=Lc(),i=zc();function a(e){return r(e)?i(e):n(e)}t.exports=a})),Vc=o(((e,t)=>{var n=Ic(),r=Lc(),i=Bc(),a=_s();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),Hc=o(((e,t)=>{t.exports=Vc()(`toUpperCase`)})),Uc=Math.PI,Wc=2*Uc,Gc=1e-6,Kc=Wc-Gc;function qc(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Jc(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return qc;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}function Yc(e,t,n,r){return e===n&&t===r}function Xc(e){let t=Math.floor(e);if(!(t<=15))return Yc;let n=10**t,r=function(e){return Math.round(e*n)};return function(e,t,n,i){return r(e)===r(n)&&r(t)===r(i)}}var Zc=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?qc:Jc(e),this._equal=e==null?Yc:Xc(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>Gc){if(!(Math.abs(u*s-c*l)>Gc)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Uc-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Gc&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Gc||Math.abs(this._y1-l)>Gc)&&this._append`L${c},${l}`,n){if(d<0&&(d=d%Wc+Wc),d>Kc)this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`;else if(d>Gc){let a=e+n*Math.cos(i),o=t+n*Math.sin(i);if(d>=Uc&&this._equal(c,l,a,o)){d/=2;let i=r+d;this._append`A${n},${n},0,${+(d>=Uc)},${u},${e+n*Math.cos(i)},${t+n*Math.sin(i)}`}this._append`A${n},${n},0,${+(d>=Uc)},${u},${this._x1=a},${this._y1=o}`}}}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Zc.prototype;function Qc(e){return function(){return e}}var $c=Math.cos,el=Math.sin,tl=Math.sqrt,nl=1e-12,rl=Math.PI;rl/2;var il=2*rl;function al(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Zc(t)}Array.prototype.slice;function ol(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function sl(e){this._context=e}sl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function cl(e){return new sl(e)}function ll(e){return e[0]}function ul(e){return e[1]}function dl(e,t){var n=Qc(!0),r=null,i=cl,a=null,o=al(s);e=typeof e==`function`?e:e===void 0?ll:Qc(e),t=typeof t==`function`?t:t===void 0?ul:Qc(t);function s(s){var c,l=(s=ol(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:Qc(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function fl(e,t,n){var r=null,i=Qc(!0),a=null,o=cl,s=null,c=al(l);e=typeof e==`function`?e:e===void 0?ll:Qc(+e),t=typeof t==`function`?t:Qc(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?ul:Qc(+n);function l(l){var u,d,f,p=(l=ol(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return dl().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Qc(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:Qc(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:Qc(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}ml(cl);function pl(e){this._curve=e}pl.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};function ml(e){function t(t){return new pl(e(t))}return t._curve=e,t}var hl=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function gl(e){return new hl(e,!0)}function _l(e){return new hl(e,!1)}tl(3);var vl={draw(e,t){let n=tl(t/rl);e.moveTo(n,0),e.arc(0,0,n,0,il)}},yl={draw(e,t){let n=tl(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},bl=tl(1/3),xl=bl*2,Sl={draw(e,t){let n=tl(t/xl),r=n*bl;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Cl={draw(e,t){let n=tl(t),r=-n/2;e.rect(r,r,n,n)}},wl=.8908130915292852,Tl=el(rl/10)/el(7*rl/10),El=el(il/10)*Tl,Dl=-$c(il/10)*Tl,Ol={draw(e,t){let n=tl(t*wl),r=El*n,i=Dl*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=il*t/5,o=$c(a),s=el(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},kl=tl(3),Al={draw(e,t){let n=-tl(t/(kl*3));e.moveTo(0,n*2),e.lineTo(-kl*n,-n),e.lineTo(kl*n,-n),e.closePath()}};tl(3);var jl=-.5,Ml=tl(3)/2,Nl=1/tl(12),Pl=(Nl/2+1)*3,Fl={draw(e,t){let n=tl(t/Pl),r=n/2,i=n*Nl,a=r,o=n*Nl+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(jl*r-Ml*i,Ml*r+jl*i),e.lineTo(jl*a-Ml*o,Ml*a+jl*o),e.lineTo(jl*s-Ml*c,Ml*s+jl*c),e.lineTo(jl*r+Ml*i,jl*i-Ml*r),e.lineTo(jl*a+Ml*o,jl*o-Ml*a),e.lineTo(jl*s+Ml*c,jl*c-Ml*s),e.closePath()}};function Il(e,t){let n=null,r=al(i);e=typeof e==`function`?e:Qc(e||vl),t=typeof t==`function`?t:Qc(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:Qc(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Ll(){}function Rl(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function zl(e){this._context=e}zl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Rl(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bl(e){return new zl(e)}function Vl(e){this._context=e}Vl.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Hl(e){return new Vl(e)}function Ul(e){this._context=e}Ul.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Wl(e){return new Ul(e)}function Gl(e,t){this._basis=new zl(e),this._beta=t}Gl.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},(function e(t){function n(e){return t===1?new zl(e):new Gl(e,t)}return n.beta=function(t){return e(+t)},n})(.85);function Kl(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function ql(e,t){this._context=e,this._k=(1-t)/6}ql.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Kl(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Kl(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new ql(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Jl(e,t){this._context=e,this._k=(1-t)/6}Jl.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Kl(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new Jl(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Yl(e,t){this._context=e,this._k=(1-t)/6}Yl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Kl(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new Yl(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Xl(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>nl){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>nl){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function Zl(e,t){this._context=e,this._alpha=t}Zl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Xl(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new Zl(e,t):new ql(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function Ql(e,t){this._context=e,this._alpha=t}Ql.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Xl(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new Ql(e,t):new Jl(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function $l(e,t){this._context=e,this._alpha=t}$l.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Xl(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new $l(e,t):new Yl(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function eu(e){this._context=e}eu.prototype={areaStart:Ll,areaEnd:Ll,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function tu(e){return new eu(e)}function nu(e){return e<0?-1:1}function ru(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(nu(a)+nu(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function iu(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function au(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function ou(e){this._context=e}ou.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:au(this,this._t0,iu(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,au(this,iu(this,n=ru(this,e,t)),n);break;default:au(this,this._t0,n=ru(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function su(e){this._context=new cu(e)}(su.prototype=Object.create(ou.prototype)).point=function(e,t){ou.prototype.point.call(this,t,e)};function cu(e){this._context=e}cu.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function lu(e){return new ou(e)}function uu(e){return new su(e)}function du(e){this._context=e}du.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=fu(e),i=fu(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function fu(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function pu(e){return new du(e)}function mu(e,t){this._context=e,this._t=t}mu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function hu(e){return new mu(e,.5)}function gu(e){return new mu(e,0)}function _u(e){return new mu(e,1)}function vu(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function yu(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function bu(e,t){return e[t]}function xu(e){let t=[];return t.key=e,t}function Su(){var e=Qc([]),t=yu,n=vu,r=bu;function i(i){var a=Array.from(e.apply(this,arguments),xu),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=ol(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:Qc(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:Qc(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?yu:typeof e==`function`?e:Qc(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??vu,i):n},i}function Cu(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}vu(e,t)}}function wu(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}vu(e,t)}}function Tu(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,vu(e,t)}}var Eu=l(Hc());function Du(e){"@babel/helpers - typeof";return Du=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Du(e)}var Ou=[`type`,`size`,`sizeType`];function ku(){return ku=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ku.apply(this,arguments)}function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ju(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Au(Object(n),!0).forEach(function(t){Mu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mu(e,t,n){return t=Nu(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nu(e){var t=Pu(e,`string`);return Du(t)==`symbol`?t:t+``}function Pu(e,t){if(Du(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Du(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Fu(e,t){if(e==null)return{};var n=Iu(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Iu(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Lu={symbolCircle:vl,symbolCross:yl,symbolDiamond:Sl,symbolSquare:Cl,symbolStar:Ol,symbolTriangle:Al,symbolWye:Fl},Ru=Math.PI/180,zu=function(e){return Lu[`symbol${(0,Eu.default)(e)}`]||vl},Bu=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*Ru;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Vu=function(e,t){Lu[`symbol${(0,Eu.default)(e)}`]=t},Hu=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=ju(ju({},Fu(e,Ou)),{},{type:n,size:i,sizeType:o}),c=function(){var e=zu(n);return Il().type(e).size(Bu(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=Z(s,!0);return u===+u&&d===+d&&i===+i?v.createElement(`path`,ku({},f,{className:wo(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};Hu.registerSymbol=Vu;function Uu(e){"@babel/helpers - typeof";return Uu=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Uu(e)}function Wu(){return Wu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wu.apply(this,arguments)}function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ku(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Gu(Object(n),!0).forEach(function(t){rd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qu(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Ju(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,id(r.key),r)}}function Yu(e,t,n){return t&&Ju(e.prototype,t),n&&Ju(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xu(e,t,n){return t=ed(t),Zu(e,$u()?Reflect.construct(t,n||[],ed(e).constructor):t.apply(e,n))}function Zu(e,t){if(t&&(Uu(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Qu(e)}function Qu(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function $u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($u=function(){return!!e})()}function ed(e){return ed=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ed(e)}function td(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nd(e,t)}function nd(e,t){return nd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},nd(e,t)}function rd(e,t,n){return t=id(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function id(e){var t=ad(e,`string`);return Uu(t)==`symbol`?t:t+``}function ad(e,t){if(Uu(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Uu(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var od=32,sd=function(e){function t(){return qu(this,t),Xu(this,t,arguments)}return td(t,e),Yu(t,[{key:`renderIcon`,value:function(e){var t=this.props.inactiveColor,n=od/2,r=od/6,i=od/3,a=e.inactive?t:e.color;if(e.type===`plainline`)return v.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:a,strokeDasharray:e.payload.strokeDasharray,x1:0,y1:n,x2:od,y2:n,className:`recharts-legend-icon`});if(e.type===`line`)return v.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:a,d:`M0,${n}h${i}
|
|
17
17
|
A${r},${r},0,1,1,${2*i},${n}
|
|
18
18
|
H${od}M${2*i},${n}
|
|
19
19
|
A${r},${r},0,1,1,${i},${n}`,className:`recharts-legend-icon`});if(e.type===`rect`)return v.createElement(`path`,{stroke:`none`,fill:a,d:`M0,${od/8}h${od}v${od*3/4}h${-od}z`,className:`recharts-legend-icon`});if(v.isValidElement(e.legendIcon)){var o=Ku({},e);return delete o.legendIcon,v.cloneElement(e.legendIcon,o)}return v.createElement(Hu,{fill:a,cx:n,cy:n,size:od,sizeType:`diameter`,type:e.type})}},{key:`renderItems`,value:function(){var e=this,t=this.props,n=t.payload,r=t.iconSize,i=t.layout,a=t.formatter,o=t.inactiveColor,s={x:0,y:0,width:od,height:od},c={display:i===`horizontal`?`inline-block`:`block`,marginRight:10},l={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return n.map(function(t,n){var i=t.formatter||a,u=wo(rd(rd({"recharts-legend-item":!0},`legend-item-${n}`,!0),`inactive`,t.inactive));if(t.type===`none`)return null;var d=(0,X.default)(t.value)?null:t.value;(0,X.default)(t.value);var f=t.inactive?o:t.color;return v.createElement(`li`,Wu({className:u,style:c,key:`legend-item-${n}`},tc(e.props,t,n)),v.createElement(kc,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),v.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return v.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(v.PureComponent);rd(sd,`displayName`,`Legend`),rd(sd,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var cd=o(((e,t)=>{var n=ns();function r(){this.__data__=new n,this.size=0}t.exports=r})),ld=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),ud=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),dd=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),fd=o(((e,t)=>{var n=ns(),r=rs(),i=ds(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length<a-1)return s.push([e,t]),this.size=++o.size,this;o=this.__data__=new i(s)}return o.set(e,t),this.size=o.size,this}t.exports=o})),pd=o(((e,t)=>{var n=ns(),r=cd(),i=ld(),a=ud(),o=dd(),s=fd();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),md=o(((e,t)=>{function n(e){return this.__data__.set(e,`__lodash_hash_undefined__`),this}t.exports=n})),hd=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),gd=o(((e,t)=>{var n=ds(),r=md(),i=hd();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t<r;)this.add(e[t])}a.prototype.add=a.prototype.push=r,a.prototype.has=i,t.exports=a})),_d=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}t.exports=n})),vd=o(((e,t)=>{function n(e,t){return e.has(t)}t.exports=n})),yd=o(((e,t)=>{var n=gd(),r=_d(),i=vd(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g<f;){var y=e[g],b=t[g];if(c)var x=d?c(b,y,g,t,e,u):c(y,b,g,e,t,u);if(x!==void 0){if(x)continue;_=!1;break}if(v){if(!r(t,function(e,t){if(!i(v,t)&&(y===e||l(y,e,s,c,u)))return v.push(t)})){_=!1;break}}else if(!(y===b||l(y,b,s,c,u))){_=!1;break}}return u.delete(e),u.delete(t),_}t.exports=s})),bd=o(((e,t)=>{t.exports=Do().Uint8Array})),xd=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),Sd=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),Cd=o(((e,t)=>{var n=Oo(),r=bd(),i=Xo(),a=yd(),o=xd(),s=Sd(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),wd=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}t.exports=n})),Td=o(((e,t)=>{var n=wd(),r=To();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),Ed=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}t.exports=n})),Dd=o(((e,t)=>{function n(){return[]}t.exports=n})),Od=o(((e,t)=>{var n=Ed(),r=Dd(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),kd=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}t.exports=n})),Ad=o(((e,t)=>{var n=jo(),r=Mo(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),jd=o(((e,t)=>{var n=Ad(),r=Mo(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),Md=o(((e,t)=>{function n(){return!1}t.exports=n})),Nd=o(((e,t)=>{var n=Do(),r=Md(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),Pd=o(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;function r(e,t){var r=typeof e;return t??=9007199254740991,!!t&&(r==`number`||r!=`symbol`&&n.test(e))&&e>-1&&e%1==0&&e<t}t.exports=r})),Fd=o(((e,t)=>{function n(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991}t.exports=n})),Id=o(((e,t)=>{var n=jo(),r=Fd(),i=Mo(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),Ld=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),Rd=o(((e,t)=>{var n=Eo(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),zd=o(((e,t)=>{var n=Id(),r=Ld(),i=Rd(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),Bd=o(((e,t)=>{var n=kd(),r=jd(),i=To(),a=Nd(),o=Pd(),s=zd(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),Vd=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),Hd=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),Ud=o(((e,t)=>{t.exports=Hd()(Object.keys,Object)})),Wd=o(((e,t)=>{var n=Vd(),r=Ud(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),Gd=o(((e,t)=>{var n=Io(),r=Fd();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),Kd=o(((e,t)=>{var n=Bd(),r=Wd(),i=Gd();function a(e){return i(e)?n(e):r(e)}t.exports=a})),qd=o(((e,t)=>{var n=Td(),r=Od(),i=Kd();function a(e){return n(e,i,r)}t.exports=a})),Jd=o(((e,t)=>{var n=qd(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f<d;){p=u[f];var v=e[p],y=t[p];if(o)var b=l?o(y,v,p,t,e,c):o(v,y,p,e,t,c);if(!(b===void 0?v===y||s(v,y,a,o,c):b)){g=!1;break}_||=p==`constructor`}if(g&&!_){var x=e.constructor,S=t.constructor;x!=S&&`constructor`in e&&`constructor`in t&&!(typeof x==`function`&&x instanceof x&&typeof S==`function`&&S instanceof S)&&(g=!1)}return c.delete(e),c.delete(t),g}t.exports=a})),Yd=o(((e,t)=>{t.exports=Vo()(Do(),`DataView`)})),Xd=o(((e,t)=>{t.exports=Vo()(Do(),`Promise`)})),Zd=o(((e,t)=>{t.exports=Vo()(Do(),`Set`)})),Qd=o(((e,t)=>{t.exports=Vo()(Do(),`WeakMap`)})),$d=o(((e,t)=>{var n=Yd(),r=rs(),i=Xd(),a=Zd(),o=Qd(),s=jo(),c=Ro(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),ef=o(((e,t)=>{var n=pd(),r=yd(),i=Cd(),a=Jd(),o=$d(),s=To(),c=Nd(),l=zd(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),tf=o(((e,t)=>{var n=ef(),r=Mo();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),nf=o(((e,t)=>{var n=pd(),r=tf(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c<l;){d=o[c];var f=d[0],p=e[f],m=d[1];if(u&&d[2]){if(p===void 0&&!(f in e))return!1}else{var h=new n;if(s)var g=s(p,m,f,e,t,h);if(!(g===void 0?r(m,p,i|a,s,h):g))return!1}}return!0}t.exports=o})),rf=o(((e,t)=>{var n=Fo();function r(e){return e===e&&!n(e)}t.exports=r})),af=o(((e,t)=>{var n=rf(),r=Kd();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),of=o(((e,t)=>{function n(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),sf=o(((e,t)=>{var n=nf(),r=af(),i=of();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),cf=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),lf=o(((e,t)=>{var n=vs(),r=jd(),i=To(),a=Pd(),o=Fd(),s=ys();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l<u;){var f=s(t[l]);if(!(d=e!=null&&c(e,f)))break;e=e[f]}return d||++l!=u?d:(u=e==null?0:e.length,!!u&&o(u)&&a(f,u)&&(i(e)||r(e)))}t.exports=c})),uf=o(((e,t)=>{var n=cf(),r=lf();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),df=o(((e,t)=>{var n=tf(),r=xs(),i=uf(),a=Po(),o=rf(),s=of(),c=ys(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),ff=o(((e,t)=>{function n(e){return e}t.exports=n})),pf=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),mf=o(((e,t)=>{var n=bs();function r(e){return function(t){return n(t,e)}}t.exports=r})),hf=o(((e,t)=>{var n=pf(),r=mf(),i=Po(),a=ys();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),gf=o(((e,t)=>{var n=sf(),r=df(),i=ff(),a=To(),o=hf();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),_f=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}t.exports=n})),vf=o(((e,t)=>{function n(e){return e!==e}t.exports=n})),yf=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}t.exports=n})),bf=o(((e,t)=>{var n=_f(),r=vf(),i=yf();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),xf=o(((e,t)=>{var n=bf();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),Sf=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}t.exports=n})),Cf=o(((e,t)=>{function n(){}t.exports=n})),wf=o(((e,t)=>{var n=Zd(),r=Cf(),i=Sd();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),Tf=o(((e,t)=>{var n=gd(),r=xf(),i=Sf(),a=vd(),o=wf(),s=Sd(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u<f;){var _=e[u],v=t?t(_):_;if(_=l||_!==0?_:0,p&&v===v){for(var y=h.length;y--;)if(h[y]===v)continue outer;t&&h.push(v),m.push(_)}else d(h,v,l)||(h!==m&&h.push(v),m.push(_))}return m}t.exports=l})),Ef=l(o(((e,t)=>{var n=gf(),r=Tf();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function Df(e,t,n){return t===!0?(0,Ef.default)(e,n):(0,X.default)(t)?(0,Ef.default)(e,t):e}function Of(e){"@babel/helpers - typeof";return Of=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Of(e)}var kf=[`ref`];function Af(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Af(Object(n),!0).forEach(function(t){Hf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Af(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mf(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Nf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Uf(r.key),r)}}function Pf(e,t,n){return t&&Nf(e.prototype,t),n&&Nf(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ff(e,t,n){return t=zf(t),If(e,Rf()?Reflect.construct(t,n||[],zf(e).constructor):t.apply(e,n))}function If(e,t){if(t&&(Of(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Lf(e)}function Lf(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Rf(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Rf=function(){return!!e})()}function zf(e){return zf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zf(e)}function Bf(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vf(e,t)}function Vf(e,t){return Vf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vf(e,t)}function Hf(e,t,n){return t=Uf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uf(e){var t=Wf(e,`string`);return Of(t)==`symbol`?t:t+``}function Wf(e,t){if(Of(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Of(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Gf(e,t){if(e==null)return{};var n=Kf(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kf(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function qf(e){return e.value}function Jf(e,t){if(v.isValidElement(e))return v.cloneElement(e,t);if(typeof e==`function`)return v.createElement(e,t);t.ref;var n=Gf(t,kf);return v.createElement(sd,n)}var Yf=1,Xf=function(e){function t(){var e;Mf(this,t);var n=[...arguments];return e=Ff(this,t,[].concat(n)),Hf(e,`lastBoundingBox`,{width:-1,height:-1}),e}return Bf(t,e),Pf(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>Yf||Math.abs(t.height-this.lastBoundingBox.height)>Yf)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?jf({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null)){if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0}}if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null)){if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0}}return jf(jf({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=jf(jf({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return v.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},Jf(n,jf(jf({},this.props),{},{payload:Df(s,o,qf)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=jf(jf({},this.defaultProps),e.props).layout;return n===`vertical`&&Y(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(v.PureComponent);Hf(Xf,`displayName`,`Legend`),Hf(Xf,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var Zf=o(((e,t)=>{var n=Oo(),r=jd(),i=To(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),Qf=o(((e,t)=>{var n=wd(),r=Zf();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c<l;){var u=e[c];t>0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),$f=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),ep=o(((e,t)=>{t.exports=$f()()})),tp=o(((e,t)=>{var n=ep(),r=Kd();function i(e,t){return e&&n(e,t,r)}t.exports=i})),np=o(((e,t)=>{var n=Gd();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o<a)&&i(s[o],o,s)!==!1;);return r}}t.exports=r})),rp=o(((e,t)=>{var n=tp();t.exports=np()(n)})),ip=o(((e,t)=>{var n=rp(),r=Gd();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),ap=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),op=o(((e,t)=>{var n=No();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e<t||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}t.exports=r})),sp=o(((e,t)=>{var n=op();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i<s;){var l=n(a[i],o[i]);if(l)return i>=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),cp=o(((e,t)=>{var n=hs(),r=bs(),i=gf(),a=ip(),o=ap(),s=Ld(),c=sp(),l=ff(),u=To();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),lp=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),up=o(((e,t)=>{var n=lp(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o<s;)c[o]=a[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=a[o];return l[t]=i(c),n(e,this,l)}}t.exports=i})),dp=o(((e,t)=>{function n(e){return function(){return e}}t.exports=n})),fp=o(((e,t)=>{var n=Vo();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),pp=o(((e,t)=>{var n=dp(),r=fp(),i=ff();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),mp=o(((e,t)=>{var n=Date.now;function r(e){var t=0,r=0;return function(){var i=n(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=r})),hp=o(((e,t)=>{var n=pp();t.exports=mp()(n)})),gp=o(((e,t)=>{var n=ff(),r=up(),i=hp();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),_p=o(((e,t)=>{var n=Xo(),r=Gd(),i=Pd(),a=Fo();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),vp=l(o(((e,t)=>{var n=Qf(),r=cp(),i=gp(),a=_p();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function yp(e){"@babel/helpers - typeof";return yp=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},yp(e)}function bp(){return bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bp.apply(this,arguments)}function xp(e,t){return Ep(e)||Tp(e,t)||Cp(e,t)||Sp()}function Sp(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -69,8 +69,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
69
69
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mF(e,t){if(e){if(typeof e==`string`)return _F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _F(e,t)}}function hF(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function gF(e){if(Array.isArray(e))return _F(e)}function _F(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function vF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function yF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,kF(r.key),r)}}function bF(e,t,n){return t&&yF(e.prototype,t),n&&yF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xF(e,t,n){return t=TF(t),SF(e,wF()?Reflect.construct(t,n||[],TF(e).constructor):t.apply(e,n))}function SF(e,t){if(t&&(oF(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return CF(e)}function CF(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function wF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wF=function(){return!!e})()}function TF(e){return TF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},TF(e)}function EF(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&DF(e,t)}function DF(e,t){return DF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},DF(e,t)}function OF(e,t,n){return t=kF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kF(e){var t=AF(e,`string`);return oF(t)==`symbol`?t:t+``}function AF(e,t){if(oF(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(oF(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var jF=function(e){function t(){var e;vF(this,t);var n=[...arguments];return e=xF(this,t,[].concat(n)),OF(e,`state`,{isAnimationFinished:!0,totalLength:0}),OF(e,`generateSimpleStrokeDasharray`,function(e,t){return`${t}px ${e-t}px`}),OF(e,`getStrokeDasharray`,function(n,r,i){var a=i.reduce(function(e,t){return e+t});if(!a)return e.generateSimpleStrokeDasharray(r,n);for(var o=Math.floor(n/a),s=n%a,c=r-n,l=[],u=0,d=0;u<i.length;d+=i[u],++u)if(d+i[u]>s){l=[].concat(fF(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(fF(t.repeat(i,o)),fF(l),f).map(function(e){return`${e}px`}).join(`, `)}),OF(e,`id`,Ls(`recharts-line-`)),OF(e,`pathRef`,function(t){e.mainCurve=t}),OF(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),OF(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return EF(t,e),bF(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=pc(s,RC);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:cw(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return v.createElement(Pc,u,c.map(function(e){return v.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=Z(this.props,!1),l=Z(a,!0),u=o.map(function(e,n){var r=dF(dF(dF({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return v.createElement(Pc,lF({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=dF(dF(dF({},Z(sF(i,iF),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return v.createElement(wE,lF({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return v.createElement(lk,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=Vs(r.x,e.x),a=Vs(r.y,e.y);return dF(dF({},e),{},{x:i(o),y:a(o)})}if(d){var c=Vs(f*2,e.x),l=Vs(p/2,e.y);return dF(dF({},e),{},{x:c(o),y:l(o)})}return dF(dF({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=Vs(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,YC.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=wo(`recharts-line`,i),g=a&&a.allowDataOverflow,_=o&&o.allowDataOverflow,y=g||_,b=(0,J.default)(f)?this.id:f,x=Z(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(vc(n)?n:{}).clipDot,D=E===void 0||E,O=C*2+T;return v.createElement(Pc,{className:h},g||_?v.createElement(`defs`,null,v.createElement(`clipPath`,{id:`clipPath-${b}`},v.createElement(`rect`,{x:g?c:c-l/2,y:_?s:s-u/2,width:g?l:l*2,height:_?u:u*2})),!D&&v.createElement(`clipPath`,{id:`clipPath-dots-${b}`},v.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&YT.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(fF(e),[0]),r=[],i=0;i<t;++i)r=[].concat(fF(r),fF(n));return r}},{key:`renderDotItem`,value:function(e,t){var n;if(v.isValidElement(e))n=v.cloneElement(e,t);else if((0,X.default)(e))n=e(t);else{var r=t.key,i=sF(t,aF),a=wo(`recharts-line-dot`,typeof e==`boolean`?``:e.className);n=v.createElement(Ok,lF({key:r},i,{className:a}))}return n}}])}(v.PureComponent);OF(jF,`displayName`,`Line`),OF(jF,`defaultProps`,{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,fill:`#fff`,points:[],isAnimationActive:!cm.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,hide:!1,label:!1}),OF(jF,`getComposedData`,function(e){var t=e.props,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize,c=e.displayedData,l=e.offset,u=t.layout;return dF({points:c.map(function(e,t){var c=cw(e,o);return u===`horizontal`?{x:Nw({axis:n,ticks:i,bandSize:s,entry:e,index:t}),y:(0,J.default)(c)?null:r.scale(c),value:c,payload:e}:{x:(0,J.default)(c)?null:n.scale(c),y:Nw({axis:r,ticks:a,bandSize:s,entry:e,index:t}),value:c,payload:e}}),layout:u},l)});var MF=[`layout`,`type`,`stroke`,`connectNulls`,`isRange`,`ref`],NF=[`key`],PF;function FF(e){"@babel/helpers - typeof";return FF=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},FF(e)}function IF(e,t){if(e==null)return{};var n=LF(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function LF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function RF(){return RF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RF.apply(this,arguments)}function zF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?zF(Object(n),!0).forEach(function(t){ZF(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function HF(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,QF(r.key),r)}}function UF(e,t,n){return t&&HF(e.prototype,t),n&&HF(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function WF(e,t,n){return t=JF(t),GF(e,qF()?Reflect.construct(t,n||[],JF(e).constructor):t.apply(e,n))}function GF(e,t){if(t&&(FF(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return KF(e)}function KF(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function qF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qF=function(){return!!e})()}function JF(e){return JF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},JF(e)}function YF(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&XF(e,t)}function XF(e,t){return XF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},XF(e,t)}function ZF(e,t,n){return t=QF(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QF(e){var t=$F(e,`string`);return FF(t)==`symbol`?t:t+``}function $F(e,t){if(FF(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(FF(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var eI=function(e){function t(){var e;VF(this,t);var n=[...arguments];return e=WF(this,t,[].concat(n)),ZF(e,`state`,{isAnimationFinished:!0}),ZF(e,`id`,Ls(`recharts-area-`)),ZF(e,`handleAnimationEnd`,function(){var t=e.props.onAnimationEnd;e.setState({isAnimationFinished:!0}),(0,X.default)(t)&&t()}),ZF(e,`handleAnimationStart`,function(){var t=e.props.onAnimationStart;e.setState({isAnimationFinished:!1}),(0,X.default)(t)&&t()}),e}return YF(t,e),UF(t,[{key:`renderDots`,value:function(e,n,r){var i=this.props.isAnimationActive,a=this.state.isAnimationFinished;if(i&&!a)return null;var o=this.props,s=o.dot,c=o.points,l=o.dataKey,u=Z(this.props,!1),d=Z(s,!0),f=c.map(function(e,n){var r=BF(BF(BF({key:`dot-${n}`,r:3},u),d),{},{index:n,cx:e.x,cy:e.y,dataKey:l,value:e.value,payload:e.payload,points:c});return t.renderDotItem(s,r)}),p={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return v.createElement(Pc,RF({className:`recharts-area-dots`},p),f)}},{key:`renderHorizontalRect`,value:function(e){var t=this.props,n=t.baseLine,r=t.points,i=t.strokeWidth,a=r[0].x,o=r[r.length-1].x,s=e*Math.abs(a-o),c=(0,KC.default)(r.map(function(e){return e.y||0}));return Y(n)&&typeof n==`number`?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max((0,KC.default)(n.map(function(e){return e.y||0})),c)),Y(c)?v.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}},{key:`renderVerticalRect`,value:function(e){var t=this.props,n=t.baseLine,r=t.points,i=t.strokeWidth,a=r[0].y,o=r[r.length-1].y,s=e*Math.abs(a-o),c=(0,KC.default)(r.map(function(e){return e.x||0}));return Y(n)&&typeof n==`number`?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max((0,KC.default)(n.map(function(e){return e.x||0})),c)),Y(c)?v.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}},{key:`renderClipRect`,value:function(e){return this.props.layout===`vertical`?this.renderVerticalRect(e):this.renderHorizontalRect(e)}},{key:`renderAreaStatically`,value:function(e,t,n,r){var i=this.props,a=i.layout,o=i.type,s=i.stroke,c=i.connectNulls,l=i.isRange;i.ref;var u=IF(i,MF);return v.createElement(Pc,{clipPath:n?`url(#clipPath-${r})`:null},v.createElement(wE,RF({},Z(u,!0),{points:e,connectNulls:c,type:o,baseLine:t,layout:a,stroke:`none`,className:`recharts-area-area`})),s!==`none`&&v.createElement(wE,RF({},Z(this.props,!1),{className:`recharts-area-curve`,layout:a,type:o,connectNulls:c,fill:`none`,points:e})),s!==`none`&&l&&v.createElement(wE,RF({},Z(this.props,!1),{className:`recharts-area-curve`,layout:a,type:o,connectNulls:c,fill:`none`,points:t})))}},{key:`renderAreaWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.baseLine,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=this.state,f=d.prevPoints,p=d.prevBaseLine;return v.createElement(lk,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`area-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(f){var s=f.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(f[n]){var r=f[n],i=Vs(r.x,e.x),a=Vs(r.y,e.y);return BF(BF({},e),{},{x:i(o),y:a(o)})}return e}),l=Y(a)&&typeof a==`number`?Vs(p,a)(o):(0,J.default)(a)||(0,ks.default)(a)?Vs(p,0)(o):a.map(function(e,t){var n=Math.floor(t*s);if(p[n]){var r=p[n],i=Vs(r.x,e.x),a=Vs(r.y,e.y);return BF(BF({},e),{},{x:i(o),y:a(o)})}return e});return n.renderAreaStatically(c,l,e,t)}return v.createElement(Pc,null,v.createElement(`defs`,null,v.createElement(`clipPath`,{id:`animationClipPath-${t}`},n.renderClipRect(o))),v.createElement(Pc,{clipPath:`url(#animationClipPath-${t})`},n.renderAreaStatically(i,a,e,t)))})}},{key:`renderArea`,value:function(e,t){var n=this.props,r=n.points,i=n.baseLine,a=n.isAnimationActive,o=this.state,s=o.prevPoints,c=o.prevBaseLine,l=o.totalLength;return a&&r&&r.length&&(!s&&l>0||!(0,YC.default)(s,r)||!(0,YC.default)(c,i))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,i,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.xAxis,c=e.yAxis,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=wo(`recharts-area`,i),g=s&&s.allowDataOverflow,_=c&&c.allowDataOverflow,y=g||_,b=(0,J.default)(f)?this.id:f,x=Z(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(vc(n)?n:{}).clipDot,D=E===void 0||E,O=C*2+T;return v.createElement(Pc,{className:h},g||_?v.createElement(`defs`,null,v.createElement(`clipPath`,{id:`clipPath-${b}`},v.createElement(`rect`,{x:g?o:o-l/2,y:_?a:a-u/2,width:g?l:l*2,height:_?u:u*2})),!D&&v.createElement(`clipPath`,{id:`clipPath-dots-${b}`},v.createElement(`rect`,{x:o-O/2,y:a-O/2,width:l+O,height:u+O}))):null,m?null:this.renderArea(y,b),(n||m)&&this.renderDots(y,D,b),(!d||p)&&YT.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null:{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}}}])}(v.PureComponent);PF=eI,ZF(eI,`displayName`,`Area`),ZF(eI,`defaultProps`,{stroke:`#3182bd`,fill:`#3182bd`,fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:`line`,connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!cm.isSsr,animationBegin:0,animationDuration:1500,animationEasing:`ease`}),ZF(eI,`getBaseValue`,function(e,t,n,r){var i=e.layout,a=e.baseValue,o=t.props.baseValue??a;if(Y(o)&&typeof o==`number`)return o;var s=i===`horizontal`?r:n,c=s.scale.domain();if(s.type===`number`){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return o===`dataMin`?u:o===`dataMax`||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return o===`dataMin`?c[0]:o===`dataMax`?c[1]:c[0]}),ZF(eI,`getComposedData`,function(e){var t=e.props,n=e.item,r=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,c=e.dataKey,l=e.stackedData,u=e.dataStartIndex,d=e.displayedData,f=e.offset,p=t.layout,m=l&&l.length,h=PF.getBaseValue(t,n,r,i),g=p===`horizontal`,_=!1,v=d.map(function(e,t){var n;m?n=l[u+t]:(n=cw(e,c),Array.isArray(n)?_=!0:n=[h,n]);var d=n[1]==null||m&&cw(e,c)==null;return g?{x:Nw({axis:r,ticks:a,bandSize:s,entry:e,index:t}),y:d?null:i.scale(n[1]),value:n,payload:e}:{x:d?null:r.scale(n[1]),y:Nw({axis:i,ticks:o,bandSize:s,entry:e,index:t}),value:n,payload:e}});return BF({points:v,baseLine:m||_?v.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?i.scale(t):null}:{x:t==null?null:r.scale(t),y:e.y}}):g?i.scale(h):r.scale(h),layout:p,isRange:_},f)}),ZF(eI,`renderDotItem`,function(e,t){var n;if(v.isValidElement(e))n=v.cloneElement(e,t);else if((0,X.default)(e))n=e(t);else{var r=wo(`recharts-area-dot`,typeof e==`boolean`?``:e.className),i=t.key,a=IF(t,NF);n=v.createElement(Ok,RF({},a,{key:i,className:r}))}return n});function tI(e){"@babel/helpers - typeof";return tI=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},tI(e)}function nI(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function rI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,pI(r.key),r)}}function iI(e,t,n){return t&&rI(e.prototype,t),n&&rI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function aI(e,t,n){return t=lI(t),oI(e,cI()?Reflect.construct(t,n||[],lI(e).constructor):t.apply(e,n))}function oI(e,t){if(t&&(tI(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return sI(e)}function sI(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function cI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cI=function(){return!!e})()}function lI(e){return lI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lI(e)}function uI(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dI(e,t)}function dI(e,t){return dI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},dI(e,t)}function fI(e,t,n){return t=pI(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pI(e){var t=mI(e,`string`);return tI(t)==`symbol`?t:t+``}function mI(e,t){if(tI(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(tI(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var hI=function(e){function t(){return nI(this,t),aI(this,t,arguments)}return uI(t,e),iI(t,[{key:`render`,value:function(){return null}}])}(v.Component);fI(hI,`displayName`,`ZAxis`),fI(hI,`defaultProps`,{zAxisId:0,range:[64,64],scale:`auto`,type:`number`});var gI=[`option`,`isActive`];function _I(){return _I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_I.apply(this,arguments)}function vI(e,t){if(e==null)return{};var n=yI(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yI(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function bI(e){var t=e.option,n=e.isActive,r=vI(e,gI);return typeof t==`string`?v.createElement(xA,_I({option:v.createElement(Hu,_I({type:t},r)),isActive:n,shapeType:`symbols`},r)):v.createElement(xA,_I({option:t,isActive:n,shapeType:`symbols`},r))}function xI(e){"@babel/helpers - typeof";return xI=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},xI(e)}function SI(){return SI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},SI.apply(this,arguments)}function CI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?CI(Object(n),!0).forEach(function(t){FI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function TI(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function EI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,II(r.key),r)}}function DI(e,t,n){return t&&EI(e.prototype,t),n&&EI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function OI(e,t,n){return t=MI(t),kI(e,jI()?Reflect.construct(t,n||[],MI(e).constructor):t.apply(e,n))}function kI(e,t){if(t&&(xI(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return AI(e)}function AI(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function jI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jI=function(){return!!e})()}function MI(e){return MI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},MI(e)}function NI(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PI(e,t)}function PI(e,t){return PI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},PI(e,t)}function FI(e,t,n){return t=II(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function II(e){var t=LI(e,`string`);return xI(t)==`symbol`?t:t+``}function LI(e,t){if(xI(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(xI(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var RI=function(e){function t(){var e;TI(this,t);var n=[...arguments];return e=OI(this,t,[].concat(n)),FI(e,`state`,{isAnimationFinished:!1}),FI(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0})}),FI(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1})}),FI(e,`id`,Ls(`recharts-scatter-`)),e}return NI(t,e),DI(t,[{key:`renderSymbolsStatically`,value:function(e){var t=this,n=this.props,r=n.shape,i=n.activeShape,a=n.activeIndex,o=Z(this.props,!1);return e.map(function(e,n){var s=a===n,c=s?i:r,l=wI(wI({},o),e);return v.createElement(Pc,SI({className:`recharts-scatter-symbol`,key:`symbol-${e?.cx}-${e?.cy}-${e?.size}-${n}`},tc(t.props,e,n),{role:`img`}),v.createElement(bI,SI({option:c,isActive:s,key:`symbol-${n}`},l)))})}},{key:`renderSymbolsWithAnimation`,value:function(){var e=this,t=this.props,n=t.points,r=t.isAnimationActive,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.animationId,c=this.state.prevPoints;return v.createElement(lk,{begin:i,duration:a,isActive:r,easing:o,from:{t:0},to:{t:1},key:`pie-${s}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(t){var r=t.t,i=n.map(function(e,t){var n=c&&c[t];if(n){var i=Vs(n.cx,e.cx),a=Vs(n.cy,e.cy),o=Vs(n.size,e.size);return wI(wI({},e),{},{cx:i(r),cy:a(r),size:o(r)})}var s=Vs(0,e.size);return wI(wI({},e),{},{size:s(r)})});return v.createElement(Pc,null,e.renderSymbolsStatically(i))})}},{key:`renderSymbols`,value:function(){var e=this.props,t=e.points,n=e.isAnimationActive,r=this.state.prevPoints;return n&&t&&t.length&&(!r||!(0,YC.default)(r,t))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(t)}},{key:`renderErrorBar`,value:function(){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var e=this.props,t=e.points,n=e.xAxis,r=e.yAxis,i=e.children,a=pc(i,RC);return a?a.map(function(e,i){var a=e.props,o=a.direction,s=a.dataKey;return v.cloneElement(e,{key:`${o}-${s}-${t[i]}`,data:t,xAxis:n,yAxis:r,layout:o===`x`?`vertical`:`horizontal`,dataPointFormatter:function(e,t){return{x:e.cx,y:e.cy,value:o===`x`?+e.node.x:+e.node.y,errorVal:cw(e,t)}}})}):null}},{key:`renderLine`,value:function(){var e=this.props,t=e.points,n=e.line,r=e.lineType,i=e.lineJointType,a=Z(this.props,!1),o=Z(n,!1),s,c;if(r===`joint`)s=t.map(function(e){return{x:e.cx,y:e.cy}});else if(r===`fitting`){var l=Us(t),u=l.xmin,d=l.xmax,f=l.a,p=l.b,m=function(e){return f*e+p};s=[{x:u,y:m(u)},{x:d,y:m(d)}]}var h=wI(wI(wI({},a),{},{fill:`none`,stroke:a&&a.fill},o),{},{points:s});return c=v.isValidElement(n)?v.cloneElement(n,h):(0,X.default)(n)?n(h):v.createElement(wE,SI({},h,{type:i})),v.createElement(Pc,{className:`recharts-scatter-line`,key:`recharts-scatter-line`},c)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.points,r=e.line,i=e.className,a=e.xAxis,o=e.yAxis,s=e.left,c=e.top,l=e.width,u=e.height,d=e.id,f=e.isAnimationActive;if(t||!n||!n.length)return null;var p=this.state.isAnimationFinished,m=wo(`recharts-scatter`,i),h=a&&a.allowDataOverflow,g=o&&o.allowDataOverflow,_=h||g,y=(0,J.default)(d)?this.id:d;return v.createElement(Pc,{className:m,clipPath:_?`url(#clipPath-${y})`:null},h||g?v.createElement(`defs`,null,v.createElement(`clipPath`,{id:`clipPath-${y}`},v.createElement(`rect`,{x:h?s:s-l/2,y:g?c:c-u/2,width:h?l:l*2,height:g?u:u*2}))):null,r&&this.renderLine(),this.renderErrorBar(),v.createElement(Pc,{key:`recharts-scatter-symbols`},this.renderSymbols()),(!f||p)&&YT.renderCallByParent(this.props,n))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}}])}(v.PureComponent);FI(RI,`displayName`,`Scatter`),FI(RI,`defaultProps`,{xAxisId:0,yAxisId:0,zAxisId:0,legendType:`circle`,lineType:`joint`,lineJointType:`linear`,data:[],shape:`circle`,hide:!1,isAnimationActive:!cm.isSsr,animationBegin:0,animationDuration:400,animationEasing:`linear`}),FI(RI,`getComposedData`,function(e){var t=e.xAxis,n=e.yAxis,r=e.zAxis,i=e.item,a=e.displayedData,o=e.xAxisTicks,s=e.yAxisTicks,c=e.offset,l=i.props.tooltipType,u=pc(i.props.children,qm),d=(0,J.default)(t.dataKey)?i.props.dataKey:t.dataKey,f=(0,J.default)(n.dataKey)?i.props.dataKey:n.dataKey,p=r&&r.dataKey,m=r?r.range:hI.defaultProps.range,h=m&&m[0],g=t.scale.bandwidth?t.scale.bandwidth():0,_=n.scale.bandwidth?n.scale.bandwidth():0;return wI({points:a.map(function(e,a){var c=cw(e,d),m=cw(e,f),v=!(0,J.default)(p)&&cw(e,p)||`-`,y=[{name:(0,J.default)(t.dataKey)?i.props.name:t.name||t.dataKey,unit:t.unit||``,value:c,payload:e,dataKey:d,type:l},{name:(0,J.default)(n.dataKey)?i.props.name:n.name||n.dataKey,unit:n.unit||``,value:m,payload:e,dataKey:f,type:l}];v!==`-`&&y.push({name:r.name||r.dataKey,unit:r.unit||``,value:v,payload:e,dataKey:p,type:l});var b=Nw({axis:t,ticks:o,bandSize:g,entry:e,index:a,dataKey:d}),x=Nw({axis:n,ticks:s,bandSize:_,entry:e,index:a,dataKey:f}),S=v===`-`?h:r.scale(v),C=Math.sqrt(Math.max(S,0)/Math.PI);return wI(wI({},e),{},{cx:b,cy:x,x:b-C,y:x-C,xAxis:t,yAxis:n,zAxis:r,width:2*C,height:2*C,size:S,node:{x:c,y:m,z:v},tooltipPayload:y,tooltipPosition:{x:b,y:x},payload:e},u&&u[a]&&u[a].props)})},c)});function zI(e){"@babel/helpers - typeof";return zI=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},zI(e)}function BI(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function VI(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ZI(r.key),r)}}function HI(e,t,n){return t&&VI(e.prototype,t),n&&VI(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function UI(e,t,n){return t=qI(t),WI(e,KI()?Reflect.construct(t,n||[],qI(e).constructor):t.apply(e,n))}function WI(e,t){if(t&&(zI(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return GI(e)}function GI(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function KI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KI=function(){return!!e})()}function qI(e){return qI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qI(e)}function JI(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&YI(e,t)}function YI(e,t){return YI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},YI(e,t)}function XI(e,t,n){return t=ZI(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZI(e){var t=QI(e,`string`);return zI(t)==`symbol`?t:t+``}function QI(e,t){if(zI(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(zI(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $I(){return $I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$I.apply(this,arguments)}function eL(e){var t=e.xAxisId,n=zM(),r=BM(),i=NM(t);return i==null?null:v.createElement(IP,$I({},i,{className:wo(`recharts-${i.axisType} ${i.axisType}`,i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(e){return xw(e,!0)}}))}var tL=function(e){function t(){return BI(this,t),UI(this,t,arguments)}return JI(t,e),HI(t,[{key:`render`,value:function(){return v.createElement(eL,this.props)}}])}(v.Component);XI(tL,`displayName`,`XAxis`),XI(tL,`defaultProps`,{allowDecimals:!0,hide:!1,orientation:`bottom`,width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:`category`,padding:{left:0,right:0},allowDataOverflow:!1,scale:`auto`,reversed:!1,allowDuplicatedCategory:!0});function nL(e){"@babel/helpers - typeof";return nL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nL(e)}function rL(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function iL(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,mL(r.key),r)}}function aL(e,t,n){return t&&iL(e.prototype,t),n&&iL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function oL(e,t,n){return t=uL(t),sL(e,lL()?Reflect.construct(t,n||[],uL(e).constructor):t.apply(e,n))}function sL(e,t){if(t&&(nL(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return cL(e)}function cL(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function lL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lL=function(){return!!e})()}function uL(e){return uL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uL(e)}function dL(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fL(e,t)}function fL(e,t){return fL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fL(e,t)}function pL(e,t,n){return t=mL(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mL(e){var t=hL(e,`string`);return nL(t)==`symbol`?t:t+``}function hL(e,t){if(nL(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(nL(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gL(){return gL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gL.apply(this,arguments)}var _L=function(e){var t=e.yAxisId,n=zM(),r=BM(),i=IM(t);return i==null?null:v.createElement(IP,gL({},i,{className:wo(`recharts-${i.axisType} ${i.axisType}`,i.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(e){return xw(e,!0)}}))},vL=function(e){function t(){return rL(this,t),oL(this,t,arguments)}return dL(t,e),aL(t,[{key:`render`,value:function(){return v.createElement(_L,this.props)}}])}(v.Component);pL(vL,`displayName`,`YAxis`),pL(vL,`defaultProps`,{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:`left`,width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:`number`,padding:{top:0,bottom:0},allowDataOverflow:!1,scale:`auto`,reversed:!1});function yL(e){return CL(e)||SL(e)||xL(e)||bL()}function bL(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
70
70
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xL(e,t){if(e){if(typeof e==`string`)return wL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return wL(e,t)}}function SL(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function CL(e){if(Array.isArray(e))return wL(e)}function wL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var TL=function(e,t,n,r,i){var a=pc(e,mN),o=pc(e,NN),s=[].concat(yL(a),yL(o)),c=pc(e,QN),l=`${r}Id`,u=r[0],d=t;if(s.length&&(d=s.reduce(function(e,t){if(t.props[l]===n&&pj(t.props,`extendDomain`)&&Y(t.props[u])){var r=t.props[u];return[Math.min(e[0],r),Math.max(e[1],r)]}return e},d)),c.length){var f=`${u}1`,p=`${u}2`;d=c.reduce(function(e,t){if(t.props[l]===n&&pj(t.props,`extendDomain`)&&Y(t.props[f])&&Y(t.props[p])){var r=t.props[f],i=t.props[p];return[Math.min(e[0],r,i),Math.max(e[1],r,i)]}return e},d)}return i&&i.length&&(d=i.reduce(function(e,t){return Y(t)?[Math.min(e[0],t),Math.max(e[1],t)]:e},d)),d},EL=new(l(o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||i&&!o.once||n&&o.context!==n||s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))())).default,DL=`recharts.syncMouseEvents`;function OL(e){"@babel/helpers - typeof";return OL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},OL(e)}function kL(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function AL(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,NL(r.key),r)}}function jL(e,t,n){return t&&AL(e.prototype,t),n&&AL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ML(e,t,n){return t=NL(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NL(e){var t=PL(e,`string`);return OL(t)==`symbol`?t:t+``}function PL(e,t){if(OL(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(OL(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var FL=function(){function e(){kL(this,e),ML(this,`activeIndex`,0),ML(this,`coordinateList`,[]),ML(this,`layout`,`horizontal`)}return jL(e,[{key:`setDetails`,value:function(e){var t=e.coordinateList,n=t===void 0?null:t,r=e.container,i=r===void 0?null:r,a=e.layout,o=a===void 0?null:a,s=e.offset,c=s===void 0?null:s,l=e.mouseHandlerCallback,u=l===void 0?null:l;this.coordinateList=n??this.coordinateList??[],this.container=i??this.container,this.layout=o??this.layout,this.offset=c??this.offset,this.mouseHandlerCallback=u??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:`focus`,value:function(){this.spoofMouse()}},{key:`keyboardEvent`,value:function(e){if(this.coordinateList.length!==0)switch(e.key){case`ArrowRight`:if(this.layout!==`horizontal`)return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break;case`ArrowLeft`:if(this.layout!==`horizontal`)return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse()}}},{key:`setIndex`,value:function(e){this.activeIndex=e}},{key:`spoofMouse`,value:function(){if(this.layout===`horizontal`&&this.coordinateList.length!==0){var e=this.container.getBoundingClientRect(),t=e.x,n=e.y,r=e.height,i=this.coordinateList[this.activeIndex].coordinate,a=window?.scrollX||0,o=window?.scrollY||0,s=t+i+a,c=n+this.offset.top+r/2+o;this.mouseHandlerCallback({pageX:s,pageY:c})}}}])}();function IL(e,t,n){if(n===`number`&&t===!0&&Array.isArray(e)){var r=e?.[0],i=e?.[1];if(r&&i&&Y(r)&&Y(i))return!0}return!1}function LL(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function RL(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[$w(t,n,r,i),$w(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function zL(e,t,n){var r,i,a,o;if(e===`horizontal`)r=t.x,a=r,i=n.top,o=n.top+n.height;else if(e===`vertical`)i=t.y,o=i,r=n.left,a=n.left+n.width;else if(t.cx!=null&&t.cy!=null){if(e===`centric`){var s=t.cx,c=t.cy,l=t.innerRadius,u=t.outerRadius,d=t.angle,f=$w(s,c,l,d),p=$w(s,c,u,d);r=f.x,i=f.y,a=p.x,o=p.y}else return RL(t)}return[{x:r,y:i},{x:a,y:o}]}function BL(e){"@babel/helpers - typeof";return BL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},BL(e)}function VL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function HL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?VL(Object(n),!0).forEach(function(t){UL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UL(e,t,n){return t=WL(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WL(e){var t=GL(e,`string`);return BL(t)==`symbol`?t:t+``}function GL(e,t){if(BL(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(BL(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function KL(e){var t=e.element,n=e.tooltipEventType,r=e.isActive,i=e.activeCoordinate,a=e.activePayload,o=e.offset,s=e.activeTooltipIndex,c=e.tooltipAxisBandSize,l=e.layout,u=e.chartName,d=t.props.cursor??t.type.defaultProps?.cursor;if(!t||!d||!r||!i||u!==`ScatterChart`&&n!==`axis`)return null;var f,p=wE;if(u===`ScatterChart`)f=i,p=Bk;else if(u===`BarChart`)f=LL(l,i,o,c),p=Ek;else if(l===`radial`){var m=RL(i),h=m.cx,g=m.cy,_=m.radius;f={cx:h,cy:g,startAngle:m.startAngle,endAngle:m.endAngle,innerRadius:_,outerRadius:_},p=uE}else f={points:zL(l,i,o)},p=wE;var y=HL(HL(HL(HL({stroke:`#ccc`,pointerEvents:`none`},o),f),Z(d,!1)),{},{payload:a,payloadIndex:s,className:wo(`recharts-tooltip-cursor`,d.className)});return(0,v.isValidElement)(d)?(0,v.cloneElement)(d,y):(0,v.createElement)(p,y)}var qL=[`item`],JL=[`children`,`className`,`width`,`height`,`style`,`compact`,`title`,`desc`];function YL(e){"@babel/helpers - typeof";return YL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},YL(e)}function XL(){return XL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},XL.apply(this,arguments)}function ZL(e,t){return eR(e)||$L(e,t)||hR(e,t)||QL()}function QL(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
71
71
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $L(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function eR(e){if(Array.isArray(e))return e}function tR(e,t){if(e==null)return{};var n=nR(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function rR(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function iR(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,bR(r.key),r)}}function aR(e,t,n){return t&&iR(e.prototype,t),n&&iR(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function oR(e,t,n){return t=uR(t),sR(e,lR()?Reflect.construct(t,n||[],uR(e).constructor):t.apply(e,n))}function sR(e,t){if(t&&(YL(t)===`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return cR(e)}function cR(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function lR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lR=function(){return!!e})()}function uR(e){return uR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uR(e)}function dR(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fR(e,t)}function fR(e,t){return fR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fR(e,t)}function pR(e){return _R(e)||gR(e)||hR(e)||mR()}function mR(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
72
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hR(e,t){if(e){if(typeof e==`string`)return vR(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vR(e,t)}}function gR(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function _R(e){if(Array.isArray(e))return vR(e)}function vR(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yR(Object(n),!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $(e,t,n){return t=bR(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bR(e){var t=xR(e,`string`);return YL(t)==`symbol`?t:t+``}function xR(e,t){if(YL(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(YL(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var SR={xAxis:[`bottom`,`top`],yAxis:[`left`,`right`]},CR={width:`100%`,height:`100%`},wR={x:0,y:0};function TR(e){return e}var ER=function(e,t){return t===`horizontal`?e.x:t===`vertical`?e.y:t===`centric`?e.angle:e.radius},DR=function(e,t,n,r){var i=t.find(function(e){return e&&e.index===n});if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.y};if(e===`vertical`)return{x:r.x,y:i.coordinate};if(e===`centric`){var a=i.coordinate,o=r.radius;return Q(Q(Q({},r),$w(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return Q(Q(Q({},r),$w(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return wR},OR=function(e,t){var n=t.graphicalItems,r=t.dataStartIndex,i=t.dataEndIndex,a=(n??[]).reduce(function(e,t){var n=t.props.data;return n&&n.length?[].concat(pR(e),pR(n)):e},[]);return a.length>0?a:e&&e.length&&Y(r)&&Y(i)?e.slice(r,i+1):[]};function kR(e){return e===`number`?[0,`auto`]:void 0}var AR=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=OR(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?Hs(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(pR(i),[Ww(s,l)]):i},[])},jR=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=ER(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=uw(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:AR(e,t,l,u),activeCoordinate:DR(n,o,l,i)}}return null},MR=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=yw(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=OR(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;IL(p.domain,g,m)&&(w=Vw(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=lw(S,h,`category`)));var D=kR(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=lw(S,h,m),m===`category`&&f){var k=Bs(w);_&&k?(T=w,w=(0,WA.default)(0,C)):_||(w=Uw(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(pR(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,J.default)(e)}):Uw(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,J.default)(t)?e:[].concat(pR(e),[t])},[]);else if(m===`number`){var A=_w(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=lw(S,h,`category`))}else w=f?(0,WA.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:Rw(o[x].stackGroups,s,c):vw(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=TL(u,w,x,i,y),O&&(w=Vw(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return Q(Q({},t),{},$({},x,Q(Q({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},NR=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=OR(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=yw(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:Q(Q({},t.type.defaultProps),t.props))[a],g=kR(`number`);if(!e[h]){m++;var _;return p?_=(0,WA.default)(0,f):o&&o[h]&&o[h].hasStack?(_=Rw(o[h].stackGroups,s,c),_=TL(u,_,h,i)):(_=Vw(g,vw(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=TL(u,_,h,i)),Q(Q({},e),{},$({},h,Q(Q({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,As.default)(SR,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},PR=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=pc(l,i),f={};return d&&d.length?f=MR(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=NR(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},FR=function(e){var t=zs(e),n=xw(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,vp.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:Hw(t,n)}},IR=function(e){var t=e.children,n=e.defaultShowTooltip,r=mc(t,uj),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},LR=function(e){return!e||!e.length?!1:e.some(function(e){var t=lc(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},RR=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},zR=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=mc(u,uj),p=mc(u,Xf),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=Q(Q({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,(0,As.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||uj.defaultProps.height),p&&t&&(h=mw(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return Q(Q({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},BR=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},VR=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=RR(u),h=m.numericAxisName,g=m.cateAxisName,_=LR(n),v=[];return n.forEach(function(n,m){var y=OR(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&pC(!1);var a=r[i];return Q(Q({},e),{},$($({},n.axisType,a),`${n.axisType}Ticks`,xw(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&Iw(n,r[C].stackGroups),k=lc(n.type).indexOf(`Bar`)>=0,A=Hw(E,D),j=[],ee=_&&fw({barSize:l,stackGroups:r,totalSize:BR(T,g)});if(k){var te=(0,J.default)(S)?p:S,ne=Hw(E,D,!0)??te??0;j=pw({barGap:d,barCategoryGap:f,bandSize:ne===A?A:ne,sizeList:ee[w],maxBarSize:te}),ne!==A&&(j=j.map(function(e){return Q(Q({},e),{},{position:Q(Q({},e.position),{},{offset:e.position.offset-ne/2})})}))}var re=n&&n.type&&n.type.getComposedData;re&&v.push({props:Q(Q({},re(Q(Q({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},$($($({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:wc(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!hc({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=RR(f),_=g.numericAxisName,v=g.cateAxisName,y=pc(u,n),b=jw(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return Q(Q({},e),{},$({},n,PR(i,Q(Q({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=zR(Q(Q({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=FR(C);return Q(Q({formattedGraphicalItems:d(i,Q(Q({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return rR(this,n),r=oR(this,n,[e]),$(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),$(r,`accessibilityManager`,new FL),$(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState(Q({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},Q(Q({},r.state),{},{legendBBox:e}))))}}),$(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),$(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return Q({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),$(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,X.default)(i)&&i(n,e)}}),$(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?Q(Q({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,X.default)(i)&&i(n,e)}),$(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),$(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),$(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),$(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,X.default)(n)&&n(t,e)}),$(r,`handleOuterEvent`,function(e){var t=Cc(e),n=(0,As.default)(r.props,`${t}`);t&&(0,X.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),$(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,X.default)(i)&&i(n,e)}}),$(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),$(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),$(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),$(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&EL.emit(DL,r.props.syncId,e,r.eventEmitterSymbol)}),$(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState(Q({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h<m.length;h++)if(m[h].value===e.activeLabel){u=h;break}}var g=Q(Q({},p),{},{x:p.left,y:p.top}),_=Math.min(c,g.x+g.width),v=Math.min(l,g.y+g.height),y=m[u]&&m[u].value,b=AR(r.state,r.props.data,u),x=m[u]?{x:n===`horizontal`?m[u].coordinate:_,y:n===`horizontal`?v:m[u].coordinate}:wR;r.setState(Q(Q({},e),{},{activeLabel:y,activeCoordinate:x,activePayload:b,activeTooltipIndex:u}))}else r.setState(e)}),$(r,`renderCursor`,function(e){var n=r.state,i=n.isTooltipActive,a=n.activeCoordinate,o=n.activePayload,s=n.offset,c=n.activeTooltipIndex,l=n.tooltipAxisBandSize,u=r.getTooltipEventType(),d=e.props.active??i,f=r.props.layout,p=e.key||`_recharts-cursor`;return v.createElement(KL,{key:p,activeCoordinate:a,activePayload:o,activeTooltipIndex:c,chartName:t,element:e,isActive:d,layout:f,offset:s,tooltipAxisBandSize:l,tooltipEventType:u})}),$(r,`renderPolarAxis`,function(e,t,n){var i=(0,As.default)(e,`type.axisType`),a=(0,As.default)(r.state,`${i}Map`),o=e.type.defaultProps,s=o===void 0?e.props:Q(Q({},o),e.props),c=a&&a[s[`${i}Id`]];return(0,v.cloneElement)(e,Q(Q({},c),{},{className:wo(i,c.className),key:e.key||`${t}-${n}`,ticks:xw(c,!0)}))}),$(r,`renderPolarGrid`,function(e){var t=e.props,n=t.radialLines,i=t.polarAngles,a=t.polarRadius,o=r.state,s=o.radiusAxisMap,c=o.angleAxisMap,l=zs(s),u=zs(c),d=u.cx,f=u.cy,p=u.innerRadius,m=u.outerRadius;return(0,v.cloneElement)(e,{polarAngles:Array.isArray(i)?i:xw(u,!0).map(function(e){return e.coordinate}),polarRadius:Array.isArray(a)?a:xw(l,!0).map(function(e){return e.coordinate}),cx:d,cy:f,innerRadius:p,outerRadius:m,key:e.key||`polar-grid`,radialLines:n})}),$(r,`renderLegend`,function(){var e=r.state.formattedGraphicalItems,t=r.props,n=t.children,i=t.width,a=t.height,o=r.props.margin||{},s=GC({children:n,formattedGraphicalItems:e,legendWidth:i-(o.left||0)-(o.right||0),legendContent:c});if(!s)return null;var l=s.item,u=tR(s,qL);return(0,v.cloneElement)(l,Q(Q({},u),{},{chartWidth:i,chartHeight:a,margin:o,onBBoxUpdate:r.handleLegendBBoxUpdate}))}),$(r,`renderTooltip`,function(){var e=r.props,t=e.children,n=e.accessibilityLayer,i=mc(t,Dm);if(!i)return null;var a=r.state,o=a.isTooltipActive,s=a.activeCoordinate,c=a.activePayload,l=a.activeLabel,u=a.offset,d=i.props.active??o;return(0,v.cloneElement)(i,{viewBox:Q(Q({},u),{},{x:u.left,y:u.top}),active:d,label:l,payload:d?c:[],coordinate:s,accessibilityLayer:n})}),$(r,`renderBrush`,function(e){var t=r.props,n=t.margin,i=t.data,a=r.state,o=a.offset,s=a.dataStartIndex,c=a.dataEndIndex,l=a.updateId;return(0,v.cloneElement)(e,{key:e.key||`_recharts-brush`,onChange:Cw(r.handleBrushChange,e.props.onChange),data:i,x:Y(e.props.x)?e.props.x:o.left,y:Y(e.props.y)?e.props.y:o.top+o.height+o.brushBottom-(n.bottom||0),width:Y(e.props.width)?e.props.width:o.width,startIndex:s,endIndex:c,updateId:`brush-${l}`})}),$(r,`renderReferenceElement`,function(e,t,n){if(!e)return null;var i=r.clipPathId,a=r.state,o=a.xAxisMap,s=a.yAxisMap,c=a.offset,l=e.type.defaultProps||{},u=e.props,d=u.xAxisId,f=d===void 0?l.xAxisId:d,p=u.yAxisId,m=p===void 0?l.yAxisId:p;return(0,v.cloneElement)(e,{key:e.key||`${t}-${n}`,xAxis:o[f],yAxis:s[m],viewBox:{x:c.left,y:c.top,width:c.width,height:c.height},clipPathId:i})}),$(r,`renderActivePoints`,function(e){var t=e.item,r=e.activePoint,i=e.basePoint,a=e.childIndex,o=e.isRange,s=[],c=t.props.key,l=t.item.type.defaultProps===void 0?t.item.props:Q(Q({},t.item.type.defaultProps),t.item.props),u=l.activeDot,d=l.dataKey,f=Q(Q({index:a,dataKey:d,cx:r.x,cy:r.y,r:4,fill:dw(t.item),strokeWidth:2,stroke:`#fff`,payload:r.payload,value:r.value},Z(u,!1)),$s(u));return s.push(n.renderActiveDot(u,f,`${c}-activePoint-${a}`)),i?s.push(n.renderActiveDot(u,Q(Q({},f),{},{cx:i.x,cy:i.y}),`${c}-basePoint-${a}`)):o&&s.push(null),s}),$(r,`renderGraphicChild`,function(e,t,n){var i=r.filterFormatItem(e,t,n);if(!i)return null;var a=r.getTooltipEventType(),o=r.state,s=o.isTooltipActive,c=o.tooltipAxis,l=o.activeTooltipIndex,u=o.activeLabel,d=r.props.children,f=mc(d,Dm),p=i.props,m=p.points,h=p.isRange,g=p.baseLine,_=i.item.type.defaultProps===void 0?i.item.props:Q(Q({},i.item.type.defaultProps),i.item.props),y=_.activeDot,b=_.hide,x=_.activeBar,S=_.activeShape,C=!!(!b&&s&&f&&(y||x||S)),w={};a!==`axis`&&f&&f.props.trigger===`click`?w={onClick:Cw(r.handleItemMouseEnter,e.props.onClick)}:a!==`axis`&&(w={onMouseLeave:Cw(r.handleItemMouseLeave,e.props.onMouseLeave),onMouseEnter:Cw(r.handleItemMouseEnter,e.props.onMouseEnter)});var T=(0,v.cloneElement)(e,Q(Q({},i.props),w));function E(e){return typeof c.dataKey==`function`?c.dataKey(e.payload):null}if(C){if(l>=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=Hs(m,k,u),O=h&&g&&Hs(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,v.cloneElement)(e,Q(Q(Q({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,J.default)(D))return[T].concat(pR(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,ee=j.item,te=ee===void 0?e:ee,ne=j.childIndex,re=Q(Q(Q({},i.props),w),{},{activeIndex:ne});return[(0,v.cloneElement)(te,re),null,null]}}return h?[T,null,null]:[T,null]}),$(r,`renderCustomized`,function(e,t,n){return(0,v.cloneElement)(e,Q(Q({key:`recharts-customized-${n}`},r.props),r.state))}),$(r,`renderMap`,{CartesianGrid:{handler:TR,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:TR},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:TR},YAxis:{handler:TR},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??Ls(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,Nm.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return dR(n,e),aR(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=mc(t,Dm);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=AR(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=Q(Q({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer&&(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}})),null}},{key:`componentDidUpdate`,value:function(e){bc([mc(e.children,Dm)],[mc(this.props.children,Dm)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=mc(this.props.children,Dm);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=oh(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=jR(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=zs(c).scale,p=zs(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return Q(Q({},i),{},{xValue:m,yValue:h},d)}return d?Q(Q({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=zs(c);return iT({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=mc(e,Dm),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),Q(Q({},$s(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){EL.on(DL,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){EL.removeListener(DL,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i<a;i++){var o=r[i];if(o.item===e||o.props.key===e.key||t===lc(o.item.type)&&n===o.childIndex)return o}return null}},{key:`renderClipPath`,value:function(){var e=this.clipPathId,t=this.state.offset,n=t.left,r=t.top,i=t.height,a=t.width;return v.createElement(`defs`,null,v.createElement(`clipPath`,{id:e},v.createElement(`rect`,{x:n,y:r,height:i,width:a})))}},{key:`getXScales`,value:function(){var e=this.state.xAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=ZL(t,2),r=n[0],i=n[1];return Q(Q({},e),{},$({},r,i.scale))},{}):null}},{key:`getYScales`,value:function(){var e=this.state.yAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=ZL(t,2),r=n[0],i=n[1];return Q(Q({},e),{},$({},r,i.scale))},{}):null}},{key:`getXScaleByAxisId`,value:function(e){var t;return(t=this.state.xAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getYScaleByAxisId`,value:function(e){var t;return(t=this.state.yAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getItemByXY`,value:function(e){var t=this.state,n=t.formattedGraphicalItems,r=t.activeItem;if(n&&n.length)for(var i=0,a=n.length;i<a;i++){var o=n[i],s=o.props,c=o.item,l=c.type.defaultProps===void 0?c.props:Q(Q({},c.type.defaultProps),c.props),u=lc(c.type);if(u===`Bar`){var d=(s.data||[]).find(function(t){return wk(e,t)});if(d)return{graphicalItem:o,payload:d}}else if(u===`RadialBar`){var f=(s.data||[]).find(function(t){return iT(e,t)});if(f)return{graphicalItem:o,payload:f}}else if(SA(o,r)||CA(o,r)||wA(o,r)){var p=jA({graphicalItem:o,activeTooltipItem:r,itemData:l.data}),m=l.activeIndex===void 0?p:l.activeIndex;return{graphicalItem:Q(Q({},o),{},{childIndex:m}),payload:wA(o,r)?l.data[p]:o.props.data[p]}}}return null}},{key:`render`,value:function(){var e=this;if(!hc(this))return null;var t=this.props,n=t.children,r=t.className,i=t.width,a=t.height,o=t.style,s=t.compact,c=t.title,l=t.desc,u=Z(tR(t,JL),!1);if(s)return v.createElement(jM,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},v.createElement(kc,XL({},u,{width:i,height:a,title:c,desc:l}),this.renderClipPath(),Sc(n,this.renderMap)));this.props.accessibilityLayer&&(u.tabIndex=this.props.tabIndex??0,u.role=this.props.role??`application`,u.onKeyDown=function(t){e.accessibilityManager.keyboardEvent(t)},u.onFocus=function(){e.accessibilityManager.focus()});var d=this.parseEventsOfWrapper();return v.createElement(jM,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},v.createElement(`div`,XL({className:wo(`recharts-wrapper`,r),style:Q({position:`relative`,cursor:`default`,width:i,height:a},o)},d,{ref:function(t){e.container=t}}),v.createElement(kc,XL({},u,{width:i,height:a,title:c,desc:l,style:CR}),this.renderClipPath(),Sc(n,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(v.Component);$(p,`displayName`,t),$(p,`defaultProps`,Q({layout:`horizontal`,stackOffset:`none`,barCategoryGap:`10%`,barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:`index`},u)),$(p,`getDerivedStateFromProps`,function(e,t){var n=e.dataKey,r=e.data,i=e.children,a=e.width,o=e.height,s=e.layout,c=e.stackOffset,l=e.margin,u=t.dataStartIndex,d=t.dataEndIndex;if(t.updateId===void 0){var p=IR(e);return Q(Q(Q({},p),{},{updateId:0},f(Q(Q({props:e},p),{},{updateId:0}),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(n!==t.prevDataKey||r!==t.prevData||a!==t.prevWidth||o!==t.prevHeight||s!==t.prevLayout||c!==t.prevStackOffset||!Gs(l,t.prevMargin)){var m=IR(e),h={chartX:t.chartX,chartY:t.chartY,isTooltipActive:t.isTooltipActive},g=Q(Q({},jR(t,r,s)),{},{updateId:t.updateId+1}),_=Q(Q(Q({},m),h),g);return Q(Q(Q({},_),f(Q({props:e},_),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(!bc(i,t.prevChildren)){var v=mc(i,uj),y=v?v.props?.startIndex??u:u,b=v?v.props?.endIndex??d:d,x=y!==u||b!==d,S=!(0,J.default)(r)&&!x?t.updateId:t.updateId+1;return Q(Q({updateId:S},f(Q(Q({props:e},t),{},{updateId:S,dataStartIndex:y,dataEndIndex:b}),t)),{},{prevChildren:i,dataStartIndex:y,dataEndIndex:b})}return null}),$(p,`renderActiveDot`,function(e,t,n){var r=(0,v.isValidElement)(e)?(0,v.cloneElement)(e,t):(0,X.default)(e)?e(t):v.createElement(Ok,t);return v.createElement(Pc,{className:`recharts-active-dot`,key:n},r)});var m=(0,v.forwardRef)(function(e,t){return v.createElement(p,XL({},e,{ref:t}))});return m.displayName=p.displayName,m},HR=VR({chartName:`BarChart`,GraphicalChild:$j,defaultTooltipEventType:`axis`,validateTooltipEventTypes:[`axis`,`item`],axisComponents:[{axisType:`xAxis`,AxisComp:tL},{axisType:`yAxis`,AxisComp:vL}],formatAxisMap:dM}),UR=VR({chartName:`ComposedChart`,GraphicalChild:[jF,eI,$j,RI],axisComponents:[{axisType:`xAxis`,AxisComp:tL},{axisType:`yAxis`,AxisComp:vL},{axisType:`zAxis`,AxisComp:hI}],formatAxisMap:dM}),WR=[`#3987e5`,`#d95926`,`#199e70`,`#c98500`,`#d55181`,`#008300`,`#9085e9`,`#e66767`],GR={good:`#0ca30c`,warn:`#fab219`,serious:`#ec835a`,crit:`#d03b3b`};function KR({active:e,payload:t,label:n,fmt:r,series:i}){if(!e||!t||!t.length)return null;let a=i.map(e=>({s:e,p:t.find(t=>t.dataKey===e.key)})).filter(e=>e.p&&e.p.value!=null);return(0,F.jsxs)(`div`,{className:`rounded-lg border border-line2 px-3 py-2 text-[12px] shadow-xl`,style:{background:`rgba(20,20,27,.97)`,minWidth:150},children:[(0,F.jsx)(`div`,{className:`text-mute mb-1.5`,children:Ca(n,!0)}),a.map(({s:e,p:t})=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-[1px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-ink2`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:e.color}}),e.label]}),(0,F.jsx)(`span`,{className:`tabular-nums font-medium`,children:Array.isArray(t.value)?`${r(t.value[0],e.key)} – ${r(t.value[1],e.key)}`:r(t.value,e.key)})]},e.key))]})}function qR({series:e}){return e.length<2?null:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[11.5px] text-ink2`,children:e.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-sm`,style:{background:e.color,opacity:e.type===`band`?.3:e.dashed?.6:1}}),e.label]},e.key))})}function JR({data:e,series:t,height:n=180,fmt:r=e=>String(e),yFmt:i,zoom:a=!0,markers:o,onPointClick:s,refLines:c,yDomain:l}){let u=I(),[d,f]=(0,v.useState)({}),p=e.length>1?e[e.length-1].t-e[0].t:36e5,m=t.some(e=>e.type===`bar`),h=e.length>1?e[1].t-e[0].t:p,g=(o||[]).filter(t=>!e.length||t.t>=e[0].t&&t.t<=e[e.length-1].t+h).map(t=>({...t,x:m&&e.length?e.reduce((e,n)=>n.t<=t.t&&n.t>e?n.t:e,e[0].t):t.t}));return(0,F.jsx)(`div`,{style:{height:n},className:`select-none`,children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(UR,{data:e,margin:{top:6,right:6,bottom:0,left:-8},barCategoryGap:1,onMouseDown:e=>a&&e&&e.activeLabel&&f({a:e.activeLabel}),onMouseMove:e=>d.a&&e&&e.activeLabel&&f(t=>({...t,b:e.activeLabel})),onMouseUp:()=>{d.a&&d.b&&d.a!==d.b?u.setCustom(Math.min(d.a,d.b),Math.max(d.a,d.b)):d.a&&s&&s(d.a),f({})},children:[(0,F.jsx)(rF,{vertical:!1}),(0,F.jsx)(tL,{dataKey:`t`,type:m?`category`:`number`,domain:[`dataMin`,`dataMax`],scale:m?`auto`:`time`,tickFormatter:e=>wa(e,p),tickLine:!1,axisLine:{stroke:`#2a2a35`},minTickGap:40}),(0,F.jsx)(vL,{tickFormatter:i||(e=>r(e)),tickLine:!1,axisLine:!1,width:60,allowDecimals:!0,domain:l}),(0,F.jsx)(Dm,{content:(0,F.jsx)(KR,{fmt:r,series:t}),cursor:{stroke:`#55556a`,strokeWidth:1,fill:`rgba(255,255,255,.03)`},isAnimationActive:!1}),t.map(e=>e.type===`band`?(0,F.jsx)(eI,{dataKey:e.key,stroke:`none`,fill:e.color,fillOpacity:.16,dot:!1,activeDot:!1,isAnimationActive:!1,connectNulls:!0},e.key):e.type===`bar`?(0,F.jsx)($j,{dataKey:e.key,stackId:e.stack,fill:e.color,isAnimationActive:!1,maxBarSize:14,radius:e.stack?0:[3,3,0,0],stroke:`var(--color-panel)`,strokeWidth:+!!e.stack},e.key):e.type===`line`||!e.type?(0,F.jsx)(jF,{dataKey:e.key,stroke:e.color,strokeWidth:2,strokeDasharray:e.dashed?`4 3`:void 0,dot:!1,activeDot:{r:4,stroke:`var(--color-panel)`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key):(0,F.jsx)(eI,{dataKey:e.key,stackId:e.stack,stroke:e.color,strokeWidth:2,fill:e.color,fillOpacity:.14,dot:!1,activeDot:{r:4,stroke:`var(--color-panel)`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key)),c?.map(e=>(0,F.jsx)(mN,{y:e.y,stroke:e.color||`#82829a`,strokeDasharray:`4 4`,label:{value:e.label,position:`insideBottomRight`,fill:e.color||`#82829a`,fontSize:10}},`y${e.y}${e.label}`)),g.map(e=>(0,F.jsx)(mN,{x:e.x,stroke:e.color||`#ff6b9d`,strokeDasharray:`3 3`,label:{value:e.label,position:`insideTopLeft`,fill:e.color||`#ff6b9d`,fontSize:10}},`${e.t}${e.label}`)),d.a&&d.b&&(0,F.jsx)(QN,{x1:d.a,x2:d.b,fill:`#ff3d7f`,fillOpacity:.12,stroke:`#ff3d7f`,strokeOpacity:.4})]})})})}function YR({title:e,sub:t,series:n,children:r,right:i}){return(0,F.jsxs)(`section`,{className:`card`,children:[(0,F.jsxs)(`div`,{className:`card-h`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,F.jsx)(`span`,{children:e}),t&&(0,F.jsx)(`span`,{className:`card-sub`,children:t})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[n&&(0,F.jsx)(qR,{series:n}),i]})]}),(0,F.jsx)(`div`,{className:`px-2 pb-2 pt-2`,children:r})]})}function XR({data:e,height:t=150,color:n=WR[0],highlight:r}){return(0,F.jsx)(`div`,{style:{height:t},children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(HR,{data:e,margin:{top:6,right:4,bottom:0,left:-18},barCategoryGap:2,children:[(0,F.jsx)(rF,{vertical:!1}),(0,F.jsx)(tL,{dataKey:`label`,tickLine:!1,axisLine:{stroke:`#2a2a35`},interval:0,tick:{fontSize:9.5}}),(0,F.jsx)(vL,{tickLine:!1,axisLine:!1,allowDecimals:!1}),(0,F.jsx)(Dm,{cursor:{fill:`rgba(255,255,255,.04)`},isAnimationActive:!1,content:({active:e,payload:t})=>e&&t?.length?(0,F.jsxs)(`div`,{className:`rounded-lg border border-line2 px-3 py-1.5 text-[12px]`,style:{background:`rgba(20,20,27,.97)`},children:[t[0].payload.label,`: `,(0,F.jsx)(`b`,{children:t[0].value}),` calls`]}):null}),(0,F.jsx)($j,{dataKey:`count`,radius:[3,3,0,0],isAnimationActive:!1,children:e.map((e,t)=>(0,F.jsx)(qm,{fill:r&&r(e)?GR.serious:n},t))})]})})})}function ZR(e,t){return e.map((e,n)=>{let r=t?.[n];return{...e,usualCalls:r?.calls?r.calls.expected:null,p95Normal:r?.p95?[r.p95.low,r.p95.high]:null}})}var QR=e=>e?{calls:{key:`usualCalls`,label:`Usual for this hour`,color:`#82829a`,type:`line`,dashed:!0},p95:{key:`p95Normal`,label:`Normal p95`,color:WR[1],type:`band`}}:null;function $R({k:e,endpoint:t,onClose:n}){let r=e.info.kind===`read`?`curl -H "Authorization: Bearer ${e.key}" ${t}/api/overview`:`OBZERVER_KEY=${e.key}\nOBZERVER_ENDPOINT=${t}${e.info.environment?`\nOBZERVER_ENV=${e.info.environment}`:``}`;return(0,F.jsxs)(`div`,{className:`rounded-lg border border-[#3b3315] bg-[#1d1a0e] p-3.5 flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 text-[12.5px]`,children:[(0,F.jsx)(Vi,{size:14,className:`text-[#f5c04e] mt-0.5 shrink-0`}),(0,F.jsxs)(`div`,{className:`flex-1`,children:[(0,F.jsxs)(`b`,{children:[`Copy “`,e.info.name,`” now.`]}),` `,(0,F.jsx)(`span`,{className:`text-ink2`,children:`Only its hash is stored, so it can't be shown again. Lost it? Rotate it.`})]}),n&&(0,F.jsx)(`button`,{className:`text-mute hover:text-ink`,onClick:n,title:`Done`,children:(0,F.jsx)(Ki,{size:14})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`code flex-1 !py-2 break-all`,children:e.key}),(0,F.jsx)(Ba,{text:e.key,className:`btn h-8`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-mute text-[11.5px]`,children:e.info.kind===`read`?`Read the API with it`:`Start an app with it`}),(0,F.jsx)(Ba,{text:r,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code !text-[11.5px]`,children:r})]})]})}var ez=[{id:``,label:`Never expires`},{id:`30`,label:`30 days`},{id:`90`,label:`90 days`},{id:`365`,label:`1 year`}];function tz({keys:e,endpoint:t,ingestRate:n,reload:r}){let[i,a]=(0,v.useState)(`ingest`),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(null),g=async()=>{p(``);try{let e=await N(`/api/keys`,{method:`POST`,json:{name:o,kind:i,environment:i===`ingest`&&c||null,expiresInDays:u?Number(u):null}});h(e),s(``),l(``),r()}catch(e){p(e.message)}};return(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(Zr,{size:14}),`API keys`]}),sub:`Ingest keys send telemetry (optionally only for one environment); read keys let scripts and CI read the API. Each key is shown once and stored as a hash.${n?` Up to ${n} requests/s per ingest key.`:``}`,pad:!1,children:[(0,F.jsxs)(`div`,{className:`px-4 pt-3 flex flex-col gap-3`,children:[(0,F.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,F.jsx)(Va,{value:i,onChange:a,options:[{id:`ingest`,label:`Ingest`},{id:`read`,label:`Read`}]}),(0,F.jsx)(`input`,{className:`input h-7 w-36`,placeholder:i===`read`?`Name, e.g. ci`:`Name, e.g. prod api`,value:o,onChange:e=>s(e.target.value)}),i===`ingest`&&(0,F.jsx)(`input`,{className:`input h-7 w-40`,placeholder:`Any environment`,title:`Only accept telemetry from apps reporting this environment (OBZERVER_ENV or NODE_ENV)`,value:c,onChange:e=>l(e.target.value)}),(0,F.jsx)(`select`,{className:`select h-7`,value:u,onChange:e=>d(e.target.value),"aria-label":`Expiry`,children:ez.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,F.jsxs)(`button`,{className:`btn btn-primary h-7`,children:[(0,F.jsx)(_i,{size:13}),`Create key`]}),f&&(0,F.jsx)(`span`,{className:`text-[12px] text-[#ff8a8a]`,children:f})]}),m&&(0,F.jsx)($R,{k:m,endpoint:t,onClose:()=>h(null)})]}),(0,F.jsx)(`div`,{className:`pt-2`,children:(0,F.jsx)(Ha,{rows:e,cols:[{key:`n`,label:`Name`,render:e=>(0,F.jsx)(`span`,{className:e.revoked||e.expired?`line-through text-mute`:``,children:e.name})},{key:`t`,label:`Kind`,render:e=>(0,F.jsx)(`span`,{className:`pill !text-[11px] ${e.kind===`read`?`text-[#7fb2f0]`:``}`,children:e.kind===`read`?`read`:`ingest`})},{key:`k`,label:`Key`,render:e=>(0,F.jsxs)(`span`,{className:`mono text-[11.5px] text-ink2`,children:[e.prefix,`…`]})},{key:`e`,label:`Environment`,render:e=>e.kind===`read`?(0,F.jsx)(`span`,{className:`text-mute`,children:`—`}):e.environment?(0,F.jsx)(`span`,{className:`mono text-[11.5px]`,children:e.environment}):(0,F.jsx)(`span`,{className:`text-mute`,children:`any`})},{key:`x`,label:`Expires`,render:e=>e.expires?(0,F.jsx)(`span`,{className:e.expired?`text-[#ff8a8a]`:`text-ink2`,title:Ca(e.expires,!0),children:e.expired?`expired`:Ca(e.expires,!0).split(` `)[0]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`never`})},{key:`u`,label:`Last used`,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:e.lastUsed?Sa(e.lastUsed):`never`})},{key:`a`,label:``,render:e=>e.revoked?(0,F.jsx)(`span`,{className:`text-mute`,children:`revoked`}):(0,F.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Rotate: a new key with the same settings; this one stops working`,onClick:async()=>{window.confirm(`Rotate "${e.name}"? You get a new key, and apps using the old one stop reporting until they get it.`)&&(h(await N(`/api/keys/${e.id}/rotate`,{method:`POST`})),r())},children:(0,F.jsx)(Ci,{size:13})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Revoke`,onClick:async()=>{window.confirm(`Revoke "${e.name}"? ${e.kind===`read`?`Scripts`:`Apps`} using it stop working.`)&&(await N(`/api/keys/${e.id}`,{method:`DELETE`}),r())},children:(0,F.jsx)(Ri,{size:13})})]})}]})})]})}var nz=[`github`,`linear`,`clickup`,`trello`],rz={github:`GitHub`,linear:`Linear`,clickup:`ClickUp`,trello:`Trello`};function iz(e=[]){let{data:t,reload:n}=P(`/api/settings/trackers`,e);return{settings:t,connected:nz.filter(e=>t?.[e]),reload:n}}var az={open:{label:`open`,color:`#5fd38a`},closed:{label:`closed`,color:`#a78bfa`},canceled:{label:`canceled`,color:`#82829a`}};function oz({ticket:e,compact:t=!1}){let n=e.state?az[e.state]:null;return(0,F.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1.5 rounded-md border border-line px-2 py-0.5 text-[12px] hover:border-ink2 hover:text-ink whitespace-nowrap`,children:[!t&&(0,F.jsx)(`span`,{className:`text-mute`,children:rz[e.provider]}),(0,F.jsx)(`span`,{className:`mono`,children:e.key}),n&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-mute`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:n.color}}),n.label]}),(0,F.jsx)(Vr,{size:11,className:`text-mute`})]})}var sz={github:`issue`,linear:`ticket`,clickup:`task`,trello:`card`};function cz({provider:e,settings:t,onSaved:n}){let{msg:r,busy:i,run:a}=dz(),o=t.autoCreate===e,s=t.autoCreate&&t.autoCreate!==e?rz[t.autoCreate]:null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-[13px] cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:o,disabled:i||!t[e],onChange:t=>a(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{autoCreate:t.target.checked?e:null}}),n(),t.target.checked?`Alert-opened issues now get a ${rz[e]} ${sz[e]}.`:`Turned off.`))}),`Open a `,rz[e],` `,sz[e],` automatically for issues created by alerts`]}),s&&!o&&(0,F.jsxs)(`div`,{className:`text-mute text-[12px] ml-6`,children:[`Currently on for `,s,`; turning it on here switches it.`]}),(0,F.jsx)(fz,{msg:r})]})}var lz={github:{done:`Closed (completed) issues`,cancel:`Issues closed as not planned`},linear:{done:`Tickets moved to a completed state`,cancel:`Canceled tickets`},clickup:{done:`Tasks moved to a closed or done status`,cancel:``},trello:{done:`Cards moved to the done list`,cancel:`Cards archived outside the done list`}};function uz({provider:e,webhook:t}){let n=lz[e];return(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2 flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{children:[`Linked tickets are checked every 2 minutes, so this works even when Obzerver is not reachable from the internet.`,t?` A webhook makes it instant.`:``]}),(0,F.jsxs)(`div`,{children:[n.done,` start fix verification here. Reopened ones reopen the issue.`,n.cancel?` ${n.cancel} close it without verification.`:``,` Verification results are posted back as a comment.`]})]})}function dz(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(!1);return{msg:e,busy:n,run:async e=>{r(!0),t(null);try{t({ok:!0,text:await e()})}catch(e){t({ok:!1,text:e.message})}finally{r(!1)}}}}var fz=({msg:e})=>e?(0,F.jsx)(`div`,{className:`text-[12.5px]`,style:{color:e.ok?`#5fd38a`:`#ff8a8a`},children:e.text}):null;function pz({settings:e,onSaved:t}){let n=e.github,[r,i]=(0,v.useState)(n?.token||``),[a,o]=(0,v.useState)(n?.repo||``),[s,c]=(0,v.useState)((n?.labels||[]).join(`, `)),{msg:l,busy:u,run:d}=dz(),f={github:{token:r,repo:a,labels:s}};return n?.source===`env`?(0,F.jsx)(hz,{p:`github`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_GITHUB_TOKEN`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_GITHUB_REPO`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:n.repo}),`. Change the environment variables to update it.`]})}):(0,F.jsxs)(hz,{p:`github`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating tickets in `,(0,F.jsx)(`span`,{className:`mono text-ink`,children:n.repo})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>d(async()=>window.confirm(`Disconnect GitHub? Linked tickets stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{github:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_220px_180px] gap-3`,children:[(0,F.jsx)(K,{label:`Token`,hint:(0,F.jsxs)(F.Fragment,{children:[`Fine-grained token with `,(0,F.jsx)(`b`,{children:`Issues: read and write`}),` on the repository, or a classic token with `,(0,F.jsx)(`span`,{className:`mono`,children:`repo`}),`.`]}),children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:`github_pat_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(K,{label:`Repository`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`owner/name`,value:a,onChange:e=>o(e.target.value)})}),(0,F.jsx)(K,{label:`Labels`,hint:`optional, comma-separated`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`bug, obzerver`,value:s,onChange:e=>c(e.target.value)})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn`,disabled:u||!r||!a,onClick:()=>d(async()=>(await N(`/api/settings/trackers/github/test`,{method:`POST`,json:f})).detail),children:[(0,F.jsx)(hi,{size:13}),`Test`]}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:u||!r||!a,onClick:()=>d(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:f}),t(),`Saved.`)),children:`Save`}),(0,F.jsx)(fz,{msg:l})]})]})}function mz({settings:e,onSaved:t}){let n=e.linear,[r,i]=(0,v.useState)(n?.apiKey||``),[a,o]=(0,v.useState)(n?[{id:n.teamId,key:``,name:n.teamName||n.teamId}]:[]),[s,c]=(0,v.useState)(n?.teamId||``),{msg:l,busy:u,run:d}=dz();if(n?.source===`env`)return(0,F.jsx)(hz,{p:`linear`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_LINEAR_API_KEY`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_LINEAR_TEAM`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:n.teamId}),`. Change the environment variables to update it.`]})});let f=a.find(e=>e.id===s);return(0,F.jsxs)(hz,{p:`linear`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating tickets in team `,(0,F.jsx)(`span`,{className:`text-ink`,children:n.teamName||n.teamId})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>d(async()=>window.confirm(`Disconnect Linear? Linked tickets stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{linear:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_auto_260px] gap-3 items-end`,children:[(0,F.jsx)(K,{label:`API key`,hint:`Linear → Settings → Security & access → Personal API keys`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:`lin_api_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsxs)(`button`,{className:`btn mb-[18px]`,disabled:u||!r,onClick:()=>d(async()=>{let e=await N(`/api/settings/trackers/linear/test`,{method:`POST`,json:{linear:{apiKey:r}}});return o(e.teams),!s&&e.teams[0]&&c(e.teams[0].id),`${e.detail}. Pick the team for new tickets.`}),children:[(0,F.jsx)(hi,{size:13}),`Connect`]}),(0,F.jsx)(K,{label:`Team`,hint:`new tickets are created here`,children:(0,F.jsxs)(`select`,{className:`select`,value:s,disabled:!a.length,onChange:e=>c(e.target.value),children:[!a.length&&(0,F.jsx)(`option`,{value:``,children:`Connect first`}),a.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.name,e.key?` (${e.key})`:``]},e.id))]})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:u||!r||!s,onClick:()=>d(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{linear:{apiKey:r,teamId:s,teamName:f?.name}}}),t(),`Saved.`)),children:`Save`}),(0,F.jsx)(fz,{msg:l})]})]})}function hz({status:e,action:t,children:n}){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(e||t)&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e,(0,F.jsx)(`span`,{className:`flex-1`}),t]}),n]})}function gz({settings:e,onSaved:t}){let n=e.clickup,[r,i]=(0,v.useState)(n?.token||``),[a,o]=(0,v.useState)(n?.listId||``),[s,c]=(0,v.useState)(n?.listName||``),{msg:l,busy:u,run:d}=dz();if(n?.source===`env`)return(0,F.jsx)(hz,{p:`clickup`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_CLICKUP_TOKEN`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_CLICKUP_LIST`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:n.listId}),`. Change the environment variables to update it.`]})});let f={clickup:{token:r,listId:a,listName:s}};return(0,F.jsxs)(hz,{p:`clickup`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating tasks in list `,(0,F.jsx)(`span`,{className:`text-ink`,children:n.listName||n.listId})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>d(async()=>window.confirm(`Disconnect ClickUp? Linked tasks stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{clickup:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_1fr] gap-3`,children:[(0,F.jsx)(K,{label:`API token`,hint:`ClickUp → avatar → Settings → Apps → API Token (starts with pk_)`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:`pk_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(K,{label:`List`,hint:`paste the list's URL (…/v/li/901234567) or its id; new tasks go here`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`https://app.clickup.com/…/v/li/…`,value:a,onChange:e=>{o(e.target.value),c(``)}})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn`,disabled:u||!r,onClick:()=>d(async()=>{let e=await N(`/api/settings/trackers/clickup/test`,{method:`POST`,json:f});return e.listName&&c(e.listName),e.detail}),children:[(0,F.jsx)(hi,{size:13}),`Test`]}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:u||!r||!a,onClick:()=>d(async()=>{let e=await N(`/api/settings/trackers/clickup/test`,{method:`POST`,json:f});return await N(`/api/settings/trackers`,{method:`PUT`,json:{clickup:{token:r,listId:a,listName:e.listName||s}}}),t(),`Saved.`}),children:`Save`}),(0,F.jsx)(fz,{msg:l})]})]})}function _z({settings:e,onSaved:t}){let n=e.trello,[r,i]=(0,v.useState)(n?.apiKey||``),[a,o]=(0,v.useState)(n?.token||``),[s,c]=(0,v.useState)(n?[{id:n.boardId,name:n.boardName||n.boardId}]:[]),[l,u]=(0,v.useState)(n?.boardId||``),[d,f]=(0,v.useState)(n?[{id:n.listId,name:n.listName||n.listId},{id:n.doneListId,name:n.doneListName||n.doneListId}]:[]),[p,m]=(0,v.useState)(n?.listId||``),[h,g]=(0,v.useState)(n?.doneListId||``),{msg:_,busy:y,run:b}=dz();if(n?.source===`env`)return(0,F.jsx)(hz,{p:`trello`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_TRELLO_KEY`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`_TOKEN`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`_LIST`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`_DONE_LIST`}),`. Change the environment variables to update it.`]})});let x=e=>b(async()=>{let t=await N(`/api/settings/trackers/trello/test`,{method:`POST`,json:{trello:{apiKey:r,token:a,boardId:e}}});f(t.lists);let n=t.lists.find(e=>/done|complete|closed/i.test(e.name));return m(t.lists[0]?.id||``),g(n?.id||t.lists.at(-1)?.id||``),`${t.detail}. Pick the lists.`}),S=(e,t)=>e.find(e=>e.id===t)?.name;return(0,F.jsxs)(hz,{p:`trello`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating cards in `,(0,F.jsxs)(`span`,{className:`text-ink`,children:[n.boardName||`board`,` → `,n.listName||`list`]}),`, done list `,(0,F.jsx)(`span`,{className:`text-ink`,children:n.doneListName||`—`})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>b(async()=>window.confirm(`Disconnect Trello? Linked cards stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{trello:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_1fr_auto] gap-3 items-end`,children:[(0,F.jsx)(K,{label:`API key`,hint:(0,F.jsxs)(F.Fragment,{children:[`From a Power-Up at `,(0,F.jsx)(`span`,{className:`mono`,children:`trello.com/power-ups/admin`}),` → API key`]}),children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(K,{label:`Token`,hint:`generated from the same page (Token link next to the key)`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,value:a,onChange:e=>o(e.target.value)})}),(0,F.jsxs)(`button`,{className:`btn mb-[18px]`,disabled:y||!r||!a,onClick:()=>b(async()=>{let e=await N(`/api/settings/trackers/trello/test`,{method:`POST`,json:{trello:{apiKey:r,token:a}}});return c(e.boards),e.detail}),children:[(0,F.jsx)(hi,{size:13}),`Connect`]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-3 gap-3`,children:[(0,F.jsx)(K,{label:`Board`,children:(0,F.jsxs)(`select`,{className:`select`,value:l,disabled:!s.length,onChange:e=>{u(e.target.value),e.target.value&&x(e.target.value)},children:[(0,F.jsx)(`option`,{value:``,children:s.length?`Pick a board`:`Connect first`}),s.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,F.jsx)(K,{label:`New cards go to`,children:(0,F.jsxs)(`select`,{className:`select`,value:p,disabled:!d.length,onChange:e=>m(e.target.value),children:[!d.length&&(0,F.jsx)(`option`,{value:``,children:`Pick a board first`}),d.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,F.jsx)(K,{label:`Done list`,hint:`moving a card here starts verification`,children:(0,F.jsxs)(`select`,{className:`select`,value:h,disabled:!d.length,onChange:e=>g(e.target.value),children:[!d.length&&(0,F.jsx)(`option`,{value:``,children:`Pick a board first`}),d.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:y||!r||!a||!l||!p||!h,onClick:()=>b(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{trello:{apiKey:r,token:a,boardId:l,boardName:S(s,l),listId:p,listName:S(d,p),doneListId:h,doneListName:S(d,h)}}}),t(),`Saved.`)),children:`Save`}),(0,F.jsx)(fz,{msg:_})]})]})}function vz({settings:e}){let t=`${window.location.origin}${e.webhooks.github.path}`;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{className:`text-ink2`,children:[`Repository → Settings → Webhooks → Add webhook. Content type `,(0,F.jsx)(`span`,{className:`mono`,children:`application/json`}),`, event `,(0,F.jsx)(`b`,{children:`Issues`}),`.`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute w-24 shrink-0`,children:`Payload URL`}),(0,F.jsx)(`span`,{className:`mono break-all`,children:t}),(0,F.jsx)(Ba,{text:t,className:`btn btn-ghost h-7`,label:``})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute w-24 shrink-0`,children:`Secret`}),(0,F.jsx)(`span`,{className:`mono break-all`,children:e.webhooks.github.secret}),(0,F.jsx)(Ba,{text:e.webhooks.github.secret,className:`btn btn-ghost h-7`,label:``})]}),(0,F.jsx)(`div`,{className:`text-mute`,children:`Checked against its signature; it never needs the dashboard password.`})]})}function yz({settings:e,onSaved:t}){let n=`${window.location.origin}${e.webhooks.linear.path}`,[r,i]=(0,v.useState)(``),{msg:a,busy:o,run:s}=dz();return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{className:`text-ink2`,children:[`Linear → Settings → API → Webhooks → New webhook, data change events for `,(0,F.jsx)(`b`,{children:`Issues`}),`. Then paste the signing secret Linear shows.`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute w-24 shrink-0`,children:`URL`}),(0,F.jsx)(`span`,{className:`mono break-all`,children:n}),(0,F.jsx)(Ba,{text:n,className:`btn btn-ghost h-7`,label:``})]}),(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(K,{label:`Signing secret`,children:(0,F.jsx)(`input`,{className:`input mono w-80`,type:`password`,placeholder:e.webhooks.linear.secretSet?`saved (enter a new one to replace)`:`lin_wh_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(`button`,{className:`btn mb-[18px]`,disabled:o||!r,onClick:()=>s(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{linearWebhookSecret:r}}),i(``),t(),`Signing secret saved.`)),children:`Save`})]}),(0,F.jsx)(fz,{msg:a}),(0,F.jsx)(`div`,{className:`text-mute`,children:`Checked against its signature and timestamp; it never needs the dashboard password.`})]})}var bz=[{title:`Issue trackers`,sub:`turn issues into tickets; closing a ticket starts fix verification here`,items:[{id:`github`,name:`GitHub Issues`,mono:`GH`,color:`#8b949e`,blurb:`Create GitHub issues with the error, stack and affected users. Status syncs both ways.`},{id:`linear`,name:`Linear`,mono:`L`,color:`#7c83f7`,blurb:`Create Linear tickets in a team. Done starts verification; a failed fix moves the ticket back.`},{id:`clickup`,name:`ClickUp`,mono:`CU`,color:`#7b68ee`,blurb:`Create ClickUp tasks in a list. A closed status starts verification; a failed fix moves the task back to open.`},{id:`trello`,name:`Trello`,mono:`T`,color:`#0c66e4`,blurb:`Create Trello cards on a board. Moving a card to your done list starts verification.`},{id:`jira`,name:`Jira`,mono:`J`,color:`#3b82f6`,blurb:`Jira Cloud tickets with the same two-way sync.`,soon:!0}]},{title:`Notifications`,sub:`where alert rules and SLO burn alerts send messages`,items:[{id:`email`,name:`Email`,mono:`@`,color:`#f59e0b`,blurb:`Send alerts through any SMTP server: Gmail, SES, Resend, Postmark, Mailgun.`},{id:`slack`,name:`Slack`,mono:`S`,color:`#e01e5a`,blurb:`Post alerts to a channel with an incoming webhook URL, set per alert rule.`},{id:`webhook`,name:`Webhooks`,mono:`{}`,color:`#22c55e`,blurb:`POST alert events as JSON to any URL: PagerDuty, Opsgenie, n8n, your own service.`}]},{title:`AI`,sub:`ask questions in the dashboard, or let coding agents read the same telemetry`,items:[{id:`ai`,name:`Ask Obzeri`,mono:`✦`,color:`#a78bfa`,blurb:`Ask questions about this project in the dashboard. Answers come only from your telemetry, with evidence and links.`},{id:`mcp`,name:`MCP server`,mono:`AI`,color:`#ff3d7f`,blurb:`Claude Code, Cursor or any MCP client can investigate errors, traces, releases and SLOs.`}]}],xz=bz.flatMap(e=>e.items);function Sz(){let e=P(`/api/settings`),t=iz(),n=P(`/api/alerts`),r=P(`/api/settings/ai`);return{settings:e.data,trackers:t.settings??void 0,rules:n.data?.rules,ai:r.data,error:e.error,reload:()=>{e.reload(),t.reload(),n.reload(),r.reload()}}}var Cz=(e,t)=>(e||[]).filter(e=>(e.channels||[]).some(e=>e.type===t));function wz(e,t){switch(e){case`github`:return t.trackers?.github?{kind:`good`,text:`Connected · ${t.trackers.github.repo}`}:{kind:`neutral`,text:`Not connected`};case`linear`:return t.trackers?.linear?{kind:`good`,text:`Connected · ${t.trackers.linear.teamName||`team`}`}:{kind:`neutral`,text:`Not connected`};case`clickup`:return t.trackers?.clickup?{kind:`good`,text:`Connected · ${t.trackers.clickup.listName||`list`}`}:{kind:`neutral`,text:`Not connected`};case`trello`:return t.trackers?.trello?{kind:`good`,text:`Connected · ${t.trackers.trello.boardName||`board`}`}:{kind:`neutral`,text:`Not connected`};case`jira`:return{kind:`neutral`,text:`Coming soon`};case`email`:return t.settings?.email?.configured?{kind:`good`,text:`Configured${t.settings.email.source===`env`?` via env`:``}`}:{kind:`neutral`,text:`Not configured`};case`slack`:case`webhook`:{let n=Cz(t.rules,e).length;return n?{kind:`good`,text:`Used by ${n} alert rule${n===1?``:`s`}`}:{kind:`neutral`,text:`Set up per alert rule`}}case`ai`:return t.ai?.configured?{kind:`good`,text:`${t.ai.provider===`anthropic`?`Anthropic`:`OpenAI-compatible`} · ${t.ai.model}`}:{kind:`neutral`,text:`Not set up`};case`mcp`:return t.settings?.mcp?.tokenPrefix?{kind:`good`,text:`Ready`}:{kind:`neutral`,text:`No token`}}}function Tz({item:e,size:t=36}){return(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center rounded-lg font-semibold shrink-0`,style:{width:t,height:t,fontSize:t*.36,color:e.color,background:`${e.color}1f`,border:`1px solid ${e.color}55`},children:e.mono})}function Ez(){let{id:e}=yt(),t=Sz();if(t.error)return(0,F.jsx)(W,{error:t.error});if(!t.settings||!t.trackers)return(0,F.jsx)(U,{});let n=xz.find(t=>t.id===e);return e&&n&&!n.soon?(0,F.jsx)(Oz,{item:n,ctx:t}):(0,F.jsx)(Dz,{ctx:t})}function Dz({ctx:e}){let t=Qn();return(0,F.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(gi,{size:18,className:`text-brand`}),title:`Integrations`,sub:`Connect Obzerver to the tools your team already uses.`}),bz.map(n=>(0,F.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[13px] font-semibold`,children:n.title}),(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:n.sub})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-2 @5xl:grid-cols-3 gap-3`,children:n.items.map(n=>{let r=wz(n.id,e),i=(0,F.jsxs)(`div`,{className:`h-full rounded-xl border border-line bg-panel p-4 flex flex-col gap-3 ${n.soon?`opacity-60`:`hover:border-line2 hover:bg-panel2 transition-colors`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(Tz,{item:n}),(0,F.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,F.jsx)(`div`,{className:`font-medium`,children:n.name})}),!n.soon&&(0,F.jsx)(Or,{size:15,className:`text-mute`})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] flex-1`,children:n.blurb}),(0,F.jsx)(`div`,{children:(0,F.jsx)(G,{kind:r.kind,children:r.text})})]});return n.soon?(0,F.jsx)(`div`,{children:i},n.id):(0,F.jsx)(Nn,{to:t(`/integrations/${n.id}`),children:i},n.id)})})]},n.title))]})}function Oz({item:e,ctx:t}){let n=Qn(),r=wz(e.id,t);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 max-w-[1100px]`,children:[(0,F.jsxs)(Nn,{to:n(`/integrations`),className:`text-mute hover:text-ink text-[12px] -mb-1 inline-flex items-center gap-1`,children:[(0,F.jsx)(fr,{size:12}),`Integrations`]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,F.jsx)(Tz,{item:e,size:44}),(0,F.jsxs)(`div`,{className:`flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,children:e.name}),(0,F.jsx)(G,{kind:r.kind,children:r.text})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] mt-1`,children:e.blurb})]})]}),e.id===`github`&&(0,F.jsx)(kz,{provider:`github`,ctx:t}),e.id===`linear`&&(0,F.jsx)(kz,{provider:`linear`,ctx:t}),e.id===`clickup`&&(0,F.jsx)(kz,{provider:`clickup`,ctx:t}),e.id===`trello`&&(0,F.jsx)(kz,{provider:`trello`,ctx:t}),e.id===`email`&&(0,F.jsx)(Az,{ctx:t}),(e.id===`slack`||e.id===`webhook`)&&(0,F.jsx)(jz,{type:e.id,ctx:t}),e.id===`mcp`&&(0,F.jsx)(Pz,{ctx:t}),e.id===`ai`&&(t.ai?(0,F.jsx)(Fz,{ctx:t},`${t.ai.source}:${t.ai.provider}:${t.ai.apiKey}`):(0,F.jsx)(`div`,{className:`text-mute text-[12.5px]`,children:`Loading…`}))]})}function kz({provider:e,ctx:t}){let n=t.trackers,r=!!n[e],i=`${e}:${JSON.stringify(n[e])}`,a=e===`github`||e===`linear`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(H,{title:`Connection`,children:[e===`github`&&(0,F.jsx)(pz,{settings:n,onSaved:t.reload},i),e===`linear`&&(0,F.jsx)(mz,{settings:n,onSaved:t.reload},i),e===`clickup`&&(0,F.jsx)(gz,{settings:n,onSaved:t.reload},i),e===`trello`&&(0,F.jsx)(_z,{settings:n,onSaved:t.reload},i)]}),r&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Automation`,children:(0,F.jsx)(cz,{provider:e,settings:n,onSaved:t.reload})}),(0,F.jsx)(H,{title:`Status sync`,sub:a?`optional webhook for instant updates`:`by polling`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(uz,{provider:e,webhook:a}),e===`github`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`border-t border-line`}),(0,F.jsx)(vz,{settings:n})]}),e===`linear`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`border-t border-line`}),(0,F.jsx)(yz,{settings:n,onSaved:t.reload})]})]})})]})]})}function Az({ctx:e}){let t=Qn(),n=Cz(e.rules,`email`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Nz,{email:e.settings.email,onSaved:e.reload}),(0,F.jsx)(H,{title:`Where it's used`,sub:`add an Email channel to an alert rule or an SLO`,children:(0,F.jsx)(Mz,{rules:n,empty:(0,F.jsxs)(Na,{title:`No alert rules send email yet`,children:[`Open a rule in `,(0,F.jsx)(Nn,{className:`link`,to:t(`/alerts`),children:`Alerts`}),` and add an Email channel with one or more addresses.`]})})})]})}function jz({type:e,ctx:t}){let n=Qn(),r=Cz(t.rules,e);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`How to set it up`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12.5px] text-ink2`,children:[e===`slack`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{children:`Each alert rule can post to its own channel, so there is nothing to connect globally.`}),(0,F.jsxs)(`ol`,{className:`list-decimal ml-5 flex flex-col gap-1`,children:[(0,F.jsxs)(`li`,{children:[`In Slack, create an app with `,(0,F.jsx)(`b`,{children:`Incoming Webhooks`}),` turned on and add a webhook for the channel.`]}),(0,F.jsxs)(`li`,{children:[`Copy the URL (it starts with `,(0,F.jsx)(`span`,{className:`mono`,children:`https://hooks.slack.com/services/`}),`).`]}),(0,F.jsxs)(`li`,{children:[`In `,(0,F.jsx)(Nn,{className:`link`,to:n(`/alerts`),children:`Alerts`}),`, open a rule (or an SLO), add a `,(0,F.jsx)(`b`,{children:`Slack`}),` channel and paste the URL.`]})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{children:`Each alert rule can POST to its own URL. The body is JSON:`}),(0,F.jsx)(`div`,{className:`code`,children:`{ "rule": "Checkout error rate", "state": "firing", "value": 7.2,
|
|
73
|
-
"message": "error rate 7.2% > 5% over 10 min", "link": "https://…/alerts?rule=3", "ts": 1763400000000 }`}),(0,F.jsxs)(`div`,{children:[`In `,(0,F.jsx)(Nn,{className:`link`,to:n(`/alerts`),children:`Alerts`}),`, open a rule (or an SLO) and add a `,(0,F.jsx)(`b`,{children:`Webhook`}),` channel with the URL.`]})]}),(0,F.jsx)(`div`,{children:(0,F.jsxs)(Nn,{className:`btn mt-1 inline-flex`,to:n(`/alerts`),children:[(0,F.jsx)(_i,{size:13}),`Go to alert rules`]})})]})}),(0,F.jsx)(H,{title:`Where it's used`,pad:!1,children:(0,F.jsx)(`div`,{className:`pt-2`,children:(0,F.jsx)(Mz,{rules:r,empty:(0,F.jsx)(Na,{title:`No alert rules use ${e===`slack`?`Slack`:`a webhook`} yet`})})})})]})}function Mz({rules:e,empty:t}){let n=Qn();return e.length?(0,F.jsx)(Ha,{rows:e,cols:[{key:`n`,label:`Rule`,render:e=>(0,F.jsx)(Nn,{className:`link`,to:n(`/alerts?rule=${e.id}`),children:e.name})},{key:`s`,label:`State`,render:e=>(0,F.jsx)(G,{kind:e.state===`firing`?`crit`:`good`,children:e.state===`firing`?`firing`:`ok`})},{key:`c`,label:`Channels`,render:e=>(0,F.jsx)(`div`,{className:`flex gap-1`,children:e.channels.map((e,t)=>(0,F.jsx)(`span`,{className:`pill`,children:e.type},t))})}]}):(0,F.jsx)(F.Fragment,{children:t})}function Nz({email:e,onSaved:t}){let[n,r]=(0,v.useState)(e.source===`settings`&&e.smtp||``),[i,a]=(0,v.useState)(e.source===`settings`&&e.from||``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),f=e.source===`env`;return(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(ai,{size:14}),`SMTP server`]}),sub:`used by alert rules and SLO burn alerts with an email channel`,right:e.configured?(0,F.jsxs)(G,{kind:`good`,children:[`configured`,f?` via env`:``]}):(0,F.jsx)(G,{kind:`neutral`,children:`not configured`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f?(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_SMTP_URL`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:e.smtp}),`, sending as `,(0,F.jsx)(`span`,{className:`mono`,children:e.from}),`. Change the environment variables to update it.`]}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_280px_auto] gap-3 items-end`,children:[(0,F.jsx)(K,{label:`SMTP URL`,hint:`smtp://user:pass@host:587 (STARTTLS) or smtps://user:pass@host:465. Works with Gmail, SES, Resend, Postmark, Mailgun.`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`smtps://apikey:secret@smtp.example.com:465`,value:n,onChange:e=>r(e.target.value)})}),(0,F.jsx)(K,{label:`From`,hint:`optional`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`Obzerver <alerts@company.com>`,value:i,onChange:e=>a(e.target.value)})}),(0,F.jsx)(`button`,{className:`btn btn-primary mb-[18px]`,disabled:u,onClick:async()=>{d(!0),l(null);try{await N(`/api/settings/email`,{method:`PUT`,json:{smtpUrl:n,from:i}}),l({ok:!0,text:`Saved.`}),t()}catch(e){l({ok:!1,text:e.message})}finally{d(!1)}},children:`Save`})]}),e.configured&&(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(K,{label:`Send a test email to`,children:(0,F.jsx)(`input`,{className:`input w-72`,placeholder:`you@company.com`,value:o,onChange:e=>s(e.target.value)})}),(0,F.jsxs)(`button`,{className:`btn`,disabled:u||!o,onClick:async()=>{d(!0),l(null);try{await N(`/api/settings/email/test`,{method:`POST`,json:{to:o}}),l({ok:!0,text:`Test email sent to ${o}.`})}catch(e){l({ok:!1,text:e.message})}finally{d(!1)}},children:[(0,F.jsx)(Di,{size:13}),`Send test`]})]}),c&&(0,F.jsx)(`div`,{className:`text-[12.5px]`,style:{color:c.ok?`#5fd38a`:`#ff8a8a`},children:c.text})]})})}function Pz({ctx:e}){let t=e.settings.mcp,[n,r]=(0,v.useState)(null),i=n??`<your MCP token>`,a=JSON.stringify({mcpServers:{obzerver:{type:`http`,url:t.url,headers:{Authorization:`Bearer ${i}`}}}},null,2),o=`claude mcp add --transport http obzerver ${t.url} --header "Authorization: Bearer ${i}"`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Connect an agent`,sub:`read-only: nothing can be changed over MCP`,right:(0,F.jsx)(`button`,{className:`btn h-7`,onClick:async()=>{(!t.tokenPrefix||window.confirm(`Make a new MCP token? The current one stops working, so agents using it need the new one.`))&&(r((await N(`/api/settings/mcp-token`,{method:`POST`})).token),e.reload())},children:t.tokenPrefix?`New token`:`Create token`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px]`,children:`Let Claude Code, Cursor or any MCP client investigate regressions, follow a trace into its logs, or check whether an error is still happening, using the same data you see here.`}),n?(0,F.jsxs)(`div`,{className:`rounded-lg border border-[#3b3315] bg-[#1d1a0e] p-3 flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`text-[12.5px]`,children:[(0,F.jsx)(`b`,{children:`Copy the token now.`}),` `,(0,F.jsx)(`span`,{className:`text-ink2`,children:`Only its hash is stored, so it can't be shown again.`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`code flex-1 !py-2 break-all`,children:n}),(0,F.jsx)(Ba,{text:n,className:`btn h-8`})]})]}):(0,F.jsx)(`div`,{className:`text-[12.5px] text-ink2`,children:t.tokenPrefix?(0,F.jsxs)(F.Fragment,{children:[`Current token starts with `,(0,F.jsxs)(`span`,{className:`mono`,children:[t.tokenPrefix,`…`]}),`. It is stored as a hash: if you don't have it, make a new one and the commands below fill it in.`]}):`Create a token to connect an agent.`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Claude Code`}),(0,F.jsx)(Ba,{text:o,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:o})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Cursor / generic mcp.json`}),(0,F.jsx)(Ba,{text:a,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:a})]})]})}),(0,F.jsx)(H,{title:`Tools (${t.tools.length})`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.tools.map(e=>(0,F.jsx)(`span`,{className:`pill mono !text-[11px]`,children:e},e))})})]})}function Fz({ctx:e}){let t=e.ai||{configured:!1},[n,r]=(0,v.useState)(t.provider||`anthropic`),[i,a]=(0,v.useState)(t.apiKey||``),[o,s]=(0,v.useState)(t.model||``),[c,l]=(0,v.useState)(t.baseUrl||``),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=async e=>{p(!0),d(null);try{d({ok:!0,text:await e()})}catch(e){d({ok:!1,text:e.message})}finally{p(!1)}},h={provider:n,apiKey:i,model:o,baseUrl:c||null};return t.source===`env`?(0,F.jsx)(H,{title:`Model`,children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_AI_PROVIDER`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_AI_API_KEY`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_AI_MODEL`}),`: `,t.provider,` · `,(0,F.jsx)(`span`,{className:`mono`,children:t.model}),t.baseUrl?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(`span`,{className:`mono`,children:t.baseUrl})]}):null,`. Change the environment variables to update it.`]})}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Model`,sub:`one model for every project on this server`,right:t.configured?(0,F.jsx)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>m(async()=>window.confirm(`Turn off Ask Obzeri?`)?(await N(`/api/settings/ai`,{method:`PUT`,json:null}),e.reload(),`Turned off.`):`Kept.`),children:`Turn off`}):void 0,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsxs)(`div`,{className:`seg w-fit`,children:[(0,F.jsx)(`button`,{className:n===`anthropic`?`on`:``,onClick:()=>{r(`anthropic`),s(``),l(``)},children:`Anthropic (Claude)`}),(0,F.jsx)(`button`,{className:n===`openai`?`on`:``,onClick:()=>{r(`openai`),s(``),l(``)},children:`OpenAI-compatible`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`API key`,hint:n===`anthropic`?`from console.anthropic.com → API keys`:`leave empty for a local server such as Ollama`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:n===`anthropic`?`sk-ant-…`:`sk-…`,value:i,onChange:e=>a(e.target.value)})}),(0,F.jsx)(K,{label:`Model`,hint:n===`anthropic`?`default: claude-sonnet-5-5`:`the model id your endpoint serves`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:n===`anthropic`?`claude-sonnet-5-5`:`e.g. llama3.1, gpt-…`,value:o,onChange:e=>s(e.target.value)})})]}),(0,F.jsx)(K,{label:n===`anthropic`?`Base URL (optional)`:`Base URL`,hint:n===`anthropic`?`only for a proxy or gateway`:`https://api.openai.com/v1 · https://openrouter.ai/api/v1 · http://localhost:11434/v1 (Ollama)`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:n===`anthropic`?`https://api.anthropic.com`:`https://api.openai.com/v1`,value:c,onChange:e=>l(e.target.value)})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn`,disabled:f,onClick:()=>m(async()=>(await N(`/api/settings/ai/test`,{method:`POST`,json:h})).detail),children:[(0,F.jsx)(Fi,{size:13}),`Test`]}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:f,onClick:()=>m(async()=>(await N(`/api/settings/ai`,{method:`PUT`,json:h}),e.reload(),`Saved. Open Ask Obzeri from the top bar (⌘I).`)),children:`Save`}),u&&(0,F.jsx)(`span`,{className:`text-[12.5px]`,style:{color:u.ok?`#5fd38a`:`#ff8a8a`},children:u.text})]})]})}),(0,F.jsx)(H,{title:`How answers are built`,children:(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2 flex flex-col gap-1.5`,children:[(0,F.jsx)(`div`,{children:`The model never touches the database. It can only call the same read-only tools as the MCP server, against the project you are in, and must finish with a structured answer.`}),(0,F.jsx)(`div`,{children:`Before an answer is shown, Obzerver checks it: sources and the time range come from the tool calls that really ran; links to executions, traces and errors are kept only if those ids appeared in tool results; evidence must cite a tool that ran; and confidence is lowered when something did not hold up.`}),(0,F.jsx)(`div`,{className:`text-mute`,children:`Privacy: your question and what the tools return (route names, error messages, SQL without values) are sent to the model provider. Use a local model through an OpenAI-compatible server if nothing may leave your network.`})]})})]})}function Iz(){let e=Qn(),t=Sz();if(!t.settings||!t.trackers)return null;let n=xz.filter(e=>!e.soon);return(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(gi,{size:14}),`Integrations`]}),sub:`GitHub, Linear, email, Slack, webhooks and MCP`,right:(0,F.jsxs)(Nn,{className:`btn h-7`,to:e(`/integrations`),children:[`Manage`,(0,F.jsx)(Or,{size:13})]}),children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(n=>{let r=wz(n.id,t);return(0,F.jsxs)(Nn,{to:e(`/integrations/${n.id}`),className:`inline-flex items-center gap-2 rounded-lg border border-line px-2.5 py-1.5 hover:border-line2`,children:[(0,F.jsx)(Tz,{item:n,size:22}),(0,F.jsx)(`span`,{className:`text-[12.5px]`,children:n.name}),(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:r.kind===`good`?`#5fd38a`:`#82829a`}})]},n.id)})})})}function Lz({initial:e=`express`,title:t=`Connect an application`}={}){let{data:n,reload:r}=P(`/api/settings`),[i,a]=(0,v.useState)(e),[o,s]=(0,v.useState)(null),c=(n?.keys)?.find(e=>e.kind===`ingest`&&!e.revoked&&!e.expired),l=o?.key||`<your-ingest-key>`,u=n?.endpoint||`http://localhost:4319`,d=`OBZERVER_KEY=${l}\nOBZERVER_ENDPOINT=${u}\nOBZERVER_SERVICE=my-api`,f={zero:`# no code changes: preload the SDK
|
|
72
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hR(e,t){if(e){if(typeof e==`string`)return vR(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vR(e,t)}}function gR(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function _R(e){if(Array.isArray(e))return vR(e)}function vR(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yR(Object(n),!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $(e,t,n){return t=bR(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bR(e){var t=xR(e,`string`);return YL(t)==`symbol`?t:t+``}function xR(e,t){if(YL(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(YL(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var SR={xAxis:[`bottom`,`top`],yAxis:[`left`,`right`]},CR={width:`100%`,height:`100%`},wR={x:0,y:0};function TR(e){return e}var ER=function(e,t){return t===`horizontal`?e.x:t===`vertical`?e.y:t===`centric`?e.angle:e.radius},DR=function(e,t,n,r){var i=t.find(function(e){return e&&e.index===n});if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.y};if(e===`vertical`)return{x:r.x,y:i.coordinate};if(e===`centric`){var a=i.coordinate,o=r.radius;return Q(Q(Q({},r),$w(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return Q(Q(Q({},r),$w(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return wR},OR=function(e,t){var n=t.graphicalItems,r=t.dataStartIndex,i=t.dataEndIndex,a=(n??[]).reduce(function(e,t){var n=t.props.data;return n&&n.length?[].concat(pR(e),pR(n)):e},[]);return a.length>0?a:e&&e.length&&Y(r)&&Y(i)?e.slice(r,i+1):[]};function kR(e){return e===`number`?[0,`auto`]:void 0}var AR=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=OR(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?Hs(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(pR(i),[Ww(s,l)]):i},[])},jR=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=ER(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=uw(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:AR(e,t,l,u),activeCoordinate:DR(n,o,l,i)}}return null},MR=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=yw(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=OR(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;IL(p.domain,g,m)&&(w=Vw(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=lw(S,h,`category`)));var D=kR(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=lw(S,h,m),m===`category`&&f){var k=Bs(w);_&&k?(T=w,w=(0,WA.default)(0,C)):_||(w=Uw(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(pR(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,J.default)(e)}):Uw(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,J.default)(t)?e:[].concat(pR(e),[t])},[]);else if(m===`number`){var A=_w(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=lw(S,h,`category`))}else w=f?(0,WA.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:Rw(o[x].stackGroups,s,c):vw(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=TL(u,w,x,i,y),O&&(w=Vw(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return Q(Q({},t),{},$({},x,Q(Q({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},NR=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=OR(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=yw(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:Q(Q({},t.type.defaultProps),t.props))[a],g=kR(`number`);if(!e[h]){m++;var _;return p?_=(0,WA.default)(0,f):o&&o[h]&&o[h].hasStack?(_=Rw(o[h].stackGroups,s,c),_=TL(u,_,h,i)):(_=Vw(g,vw(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=TL(u,_,h,i)),Q(Q({},e),{},$({},h,Q(Q({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,As.default)(SR,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},PR=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=pc(l,i),f={};return d&&d.length?f=MR(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=NR(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},FR=function(e){var t=zs(e),n=xw(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,vp.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:Hw(t,n)}},IR=function(e){var t=e.children,n=e.defaultShowTooltip,r=mc(t,uj),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},LR=function(e){return!e||!e.length?!1:e.some(function(e){var t=lc(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},RR=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},zR=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=mc(u,uj),p=mc(u,Xf),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=Q(Q({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,(0,As.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||uj.defaultProps.height),p&&t&&(h=mw(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return Q(Q({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},BR=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},VR=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=RR(u),h=m.numericAxisName,g=m.cateAxisName,_=LR(n),v=[];return n.forEach(function(n,m){var y=OR(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&pC(!1);var a=r[i];return Q(Q({},e),{},$($({},n.axisType,a),`${n.axisType}Ticks`,xw(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&Iw(n,r[C].stackGroups),k=lc(n.type).indexOf(`Bar`)>=0,A=Hw(E,D),j=[],ee=_&&fw({barSize:l,stackGroups:r,totalSize:BR(T,g)});if(k){var te=(0,J.default)(S)?p:S,ne=Hw(E,D,!0)??te??0;j=pw({barGap:d,barCategoryGap:f,bandSize:ne===A?A:ne,sizeList:ee[w],maxBarSize:te}),ne!==A&&(j=j.map(function(e){return Q(Q({},e),{},{position:Q(Q({},e.position),{},{offset:e.position.offset-ne/2})})}))}var re=n&&n.type&&n.type.getComposedData;re&&v.push({props:Q(Q({},re(Q(Q({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},$($($({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:wc(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!hc({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=RR(f),_=g.numericAxisName,v=g.cateAxisName,y=pc(u,n),b=jw(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return Q(Q({},e),{},$({},n,PR(i,Q(Q({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=zR(Q(Q({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=FR(C);return Q(Q({formattedGraphicalItems:d(i,Q(Q({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return rR(this,n),r=oR(this,n,[e]),$(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),$(r,`accessibilityManager`,new FL),$(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState(Q({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},Q(Q({},r.state),{},{legendBBox:e}))))}}),$(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),$(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return Q({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),$(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,X.default)(i)&&i(n,e)}}),$(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?Q(Q({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,X.default)(i)&&i(n,e)}),$(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),$(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),$(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),$(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,X.default)(n)&&n(t,e)}),$(r,`handleOuterEvent`,function(e){var t=Cc(e),n=(0,As.default)(r.props,`${t}`);t&&(0,X.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),$(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,X.default)(i)&&i(n,e)}}),$(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),$(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),$(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),$(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,X.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&EL.emit(DL,r.props.syncId,e,r.eventEmitterSymbol)}),$(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState(Q({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h<m.length;h++)if(m[h].value===e.activeLabel){u=h;break}}var g=Q(Q({},p),{},{x:p.left,y:p.top}),_=Math.min(c,g.x+g.width),v=Math.min(l,g.y+g.height),y=m[u]&&m[u].value,b=AR(r.state,r.props.data,u),x=m[u]?{x:n===`horizontal`?m[u].coordinate:_,y:n===`horizontal`?v:m[u].coordinate}:wR;r.setState(Q(Q({},e),{},{activeLabel:y,activeCoordinate:x,activePayload:b,activeTooltipIndex:u}))}else r.setState(e)}),$(r,`renderCursor`,function(e){var n=r.state,i=n.isTooltipActive,a=n.activeCoordinate,o=n.activePayload,s=n.offset,c=n.activeTooltipIndex,l=n.tooltipAxisBandSize,u=r.getTooltipEventType(),d=e.props.active??i,f=r.props.layout,p=e.key||`_recharts-cursor`;return v.createElement(KL,{key:p,activeCoordinate:a,activePayload:o,activeTooltipIndex:c,chartName:t,element:e,isActive:d,layout:f,offset:s,tooltipAxisBandSize:l,tooltipEventType:u})}),$(r,`renderPolarAxis`,function(e,t,n){var i=(0,As.default)(e,`type.axisType`),a=(0,As.default)(r.state,`${i}Map`),o=e.type.defaultProps,s=o===void 0?e.props:Q(Q({},o),e.props),c=a&&a[s[`${i}Id`]];return(0,v.cloneElement)(e,Q(Q({},c),{},{className:wo(i,c.className),key:e.key||`${t}-${n}`,ticks:xw(c,!0)}))}),$(r,`renderPolarGrid`,function(e){var t=e.props,n=t.radialLines,i=t.polarAngles,a=t.polarRadius,o=r.state,s=o.radiusAxisMap,c=o.angleAxisMap,l=zs(s),u=zs(c),d=u.cx,f=u.cy,p=u.innerRadius,m=u.outerRadius;return(0,v.cloneElement)(e,{polarAngles:Array.isArray(i)?i:xw(u,!0).map(function(e){return e.coordinate}),polarRadius:Array.isArray(a)?a:xw(l,!0).map(function(e){return e.coordinate}),cx:d,cy:f,innerRadius:p,outerRadius:m,key:e.key||`polar-grid`,radialLines:n})}),$(r,`renderLegend`,function(){var e=r.state.formattedGraphicalItems,t=r.props,n=t.children,i=t.width,a=t.height,o=r.props.margin||{},s=GC({children:n,formattedGraphicalItems:e,legendWidth:i-(o.left||0)-(o.right||0),legendContent:c});if(!s)return null;var l=s.item,u=tR(s,qL);return(0,v.cloneElement)(l,Q(Q({},u),{},{chartWidth:i,chartHeight:a,margin:o,onBBoxUpdate:r.handleLegendBBoxUpdate}))}),$(r,`renderTooltip`,function(){var e=r.props,t=e.children,n=e.accessibilityLayer,i=mc(t,Dm);if(!i)return null;var a=r.state,o=a.isTooltipActive,s=a.activeCoordinate,c=a.activePayload,l=a.activeLabel,u=a.offset,d=i.props.active??o;return(0,v.cloneElement)(i,{viewBox:Q(Q({},u),{},{x:u.left,y:u.top}),active:d,label:l,payload:d?c:[],coordinate:s,accessibilityLayer:n})}),$(r,`renderBrush`,function(e){var t=r.props,n=t.margin,i=t.data,a=r.state,o=a.offset,s=a.dataStartIndex,c=a.dataEndIndex,l=a.updateId;return(0,v.cloneElement)(e,{key:e.key||`_recharts-brush`,onChange:Cw(r.handleBrushChange,e.props.onChange),data:i,x:Y(e.props.x)?e.props.x:o.left,y:Y(e.props.y)?e.props.y:o.top+o.height+o.brushBottom-(n.bottom||0),width:Y(e.props.width)?e.props.width:o.width,startIndex:s,endIndex:c,updateId:`brush-${l}`})}),$(r,`renderReferenceElement`,function(e,t,n){if(!e)return null;var i=r.clipPathId,a=r.state,o=a.xAxisMap,s=a.yAxisMap,c=a.offset,l=e.type.defaultProps||{},u=e.props,d=u.xAxisId,f=d===void 0?l.xAxisId:d,p=u.yAxisId,m=p===void 0?l.yAxisId:p;return(0,v.cloneElement)(e,{key:e.key||`${t}-${n}`,xAxis:o[f],yAxis:s[m],viewBox:{x:c.left,y:c.top,width:c.width,height:c.height},clipPathId:i})}),$(r,`renderActivePoints`,function(e){var t=e.item,r=e.activePoint,i=e.basePoint,a=e.childIndex,o=e.isRange,s=[],c=t.props.key,l=t.item.type.defaultProps===void 0?t.item.props:Q(Q({},t.item.type.defaultProps),t.item.props),u=l.activeDot,d=l.dataKey,f=Q(Q({index:a,dataKey:d,cx:r.x,cy:r.y,r:4,fill:dw(t.item),strokeWidth:2,stroke:`#fff`,payload:r.payload,value:r.value},Z(u,!1)),$s(u));return s.push(n.renderActiveDot(u,f,`${c}-activePoint-${a}`)),i?s.push(n.renderActiveDot(u,Q(Q({},f),{},{cx:i.x,cy:i.y}),`${c}-basePoint-${a}`)):o&&s.push(null),s}),$(r,`renderGraphicChild`,function(e,t,n){var i=r.filterFormatItem(e,t,n);if(!i)return null;var a=r.getTooltipEventType(),o=r.state,s=o.isTooltipActive,c=o.tooltipAxis,l=o.activeTooltipIndex,u=o.activeLabel,d=r.props.children,f=mc(d,Dm),p=i.props,m=p.points,h=p.isRange,g=p.baseLine,_=i.item.type.defaultProps===void 0?i.item.props:Q(Q({},i.item.type.defaultProps),i.item.props),y=_.activeDot,b=_.hide,x=_.activeBar,S=_.activeShape,C=!!(!b&&s&&f&&(y||x||S)),w={};a!==`axis`&&f&&f.props.trigger===`click`?w={onClick:Cw(r.handleItemMouseEnter,e.props.onClick)}:a!==`axis`&&(w={onMouseLeave:Cw(r.handleItemMouseLeave,e.props.onMouseLeave),onMouseEnter:Cw(r.handleItemMouseEnter,e.props.onMouseEnter)});var T=(0,v.cloneElement)(e,Q(Q({},i.props),w));function E(e){return typeof c.dataKey==`function`?c.dataKey(e.payload):null}if(C){if(l>=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=Hs(m,k,u),O=h&&g&&Hs(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,v.cloneElement)(e,Q(Q(Q({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,J.default)(D))return[T].concat(pR(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,ee=j.item,te=ee===void 0?e:ee,ne=j.childIndex,re=Q(Q(Q({},i.props),w),{},{activeIndex:ne});return[(0,v.cloneElement)(te,re),null,null]}}return h?[T,null,null]:[T,null]}),$(r,`renderCustomized`,function(e,t,n){return(0,v.cloneElement)(e,Q(Q({key:`recharts-customized-${n}`},r.props),r.state))}),$(r,`renderMap`,{CartesianGrid:{handler:TR,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:TR},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:TR},YAxis:{handler:TR},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??Ls(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,Nm.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return dR(n,e),aR(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=mc(t,Dm);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=AR(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=Q(Q({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer&&(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}})),null}},{key:`componentDidUpdate`,value:function(e){bc([mc(e.children,Dm)],[mc(this.props.children,Dm)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=mc(this.props.children,Dm);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=oh(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=jR(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=zs(c).scale,p=zs(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return Q(Q({},i),{},{xValue:m,yValue:h},d)}return d?Q(Q({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=zs(c);return iT({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=mc(e,Dm),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),Q(Q({},$s(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){EL.on(DL,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){EL.removeListener(DL,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i<a;i++){var o=r[i];if(o.item===e||o.props.key===e.key||t===lc(o.item.type)&&n===o.childIndex)return o}return null}},{key:`renderClipPath`,value:function(){var e=this.clipPathId,t=this.state.offset,n=t.left,r=t.top,i=t.height,a=t.width;return v.createElement(`defs`,null,v.createElement(`clipPath`,{id:e},v.createElement(`rect`,{x:n,y:r,height:i,width:a})))}},{key:`getXScales`,value:function(){var e=this.state.xAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=ZL(t,2),r=n[0],i=n[1];return Q(Q({},e),{},$({},r,i.scale))},{}):null}},{key:`getYScales`,value:function(){var e=this.state.yAxisMap;return e?Object.entries(e).reduce(function(e,t){var n=ZL(t,2),r=n[0],i=n[1];return Q(Q({},e),{},$({},r,i.scale))},{}):null}},{key:`getXScaleByAxisId`,value:function(e){var t;return(t=this.state.xAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getYScaleByAxisId`,value:function(e){var t;return(t=this.state.yAxisMap)==null||(t=t[e])==null?void 0:t.scale}},{key:`getItemByXY`,value:function(e){var t=this.state,n=t.formattedGraphicalItems,r=t.activeItem;if(n&&n.length)for(var i=0,a=n.length;i<a;i++){var o=n[i],s=o.props,c=o.item,l=c.type.defaultProps===void 0?c.props:Q(Q({},c.type.defaultProps),c.props),u=lc(c.type);if(u===`Bar`){var d=(s.data||[]).find(function(t){return wk(e,t)});if(d)return{graphicalItem:o,payload:d}}else if(u===`RadialBar`){var f=(s.data||[]).find(function(t){return iT(e,t)});if(f)return{graphicalItem:o,payload:f}}else if(SA(o,r)||CA(o,r)||wA(o,r)){var p=jA({graphicalItem:o,activeTooltipItem:r,itemData:l.data}),m=l.activeIndex===void 0?p:l.activeIndex;return{graphicalItem:Q(Q({},o),{},{childIndex:m}),payload:wA(o,r)?l.data[p]:o.props.data[p]}}}return null}},{key:`render`,value:function(){var e=this;if(!hc(this))return null;var t=this.props,n=t.children,r=t.className,i=t.width,a=t.height,o=t.style,s=t.compact,c=t.title,l=t.desc,u=Z(tR(t,JL),!1);if(s)return v.createElement(jM,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},v.createElement(kc,XL({},u,{width:i,height:a,title:c,desc:l}),this.renderClipPath(),Sc(n,this.renderMap)));this.props.accessibilityLayer&&(u.tabIndex=this.props.tabIndex??0,u.role=this.props.role??`application`,u.onKeyDown=function(t){e.accessibilityManager.keyboardEvent(t)},u.onFocus=function(){e.accessibilityManager.focus()});var d=this.parseEventsOfWrapper();return v.createElement(jM,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},v.createElement(`div`,XL({className:wo(`recharts-wrapper`,r),style:Q({position:`relative`,cursor:`default`,width:i,height:a},o)},d,{ref:function(t){e.container=t}}),v.createElement(kc,XL({},u,{width:i,height:a,title:c,desc:l,style:CR}),this.renderClipPath(),Sc(n,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(v.Component);$(p,`displayName`,t),$(p,`defaultProps`,Q({layout:`horizontal`,stackOffset:`none`,barCategoryGap:`10%`,barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:`index`},u)),$(p,`getDerivedStateFromProps`,function(e,t){var n=e.dataKey,r=e.data,i=e.children,a=e.width,o=e.height,s=e.layout,c=e.stackOffset,l=e.margin,u=t.dataStartIndex,d=t.dataEndIndex;if(t.updateId===void 0){var p=IR(e);return Q(Q(Q({},p),{},{updateId:0},f(Q(Q({props:e},p),{},{updateId:0}),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(n!==t.prevDataKey||r!==t.prevData||a!==t.prevWidth||o!==t.prevHeight||s!==t.prevLayout||c!==t.prevStackOffset||!Gs(l,t.prevMargin)){var m=IR(e),h={chartX:t.chartX,chartY:t.chartY,isTooltipActive:t.isTooltipActive},g=Q(Q({},jR(t,r,s)),{},{updateId:t.updateId+1}),_=Q(Q(Q({},m),h),g);return Q(Q(Q({},_),f(Q({props:e},_),t)),{},{prevDataKey:n,prevData:r,prevWidth:a,prevHeight:o,prevLayout:s,prevStackOffset:c,prevMargin:l,prevChildren:i})}if(!bc(i,t.prevChildren)){var v=mc(i,uj),y=v?v.props?.startIndex??u:u,b=v?v.props?.endIndex??d:d,x=y!==u||b!==d,S=!(0,J.default)(r)&&!x?t.updateId:t.updateId+1;return Q(Q({updateId:S},f(Q(Q({props:e},t),{},{updateId:S,dataStartIndex:y,dataEndIndex:b}),t)),{},{prevChildren:i,dataStartIndex:y,dataEndIndex:b})}return null}),$(p,`renderActiveDot`,function(e,t,n){var r=(0,v.isValidElement)(e)?(0,v.cloneElement)(e,t):(0,X.default)(e)?e(t):v.createElement(Ok,t);return v.createElement(Pc,{className:`recharts-active-dot`,key:n},r)});var m=(0,v.forwardRef)(function(e,t){return v.createElement(p,XL({},e,{ref:t}))});return m.displayName=p.displayName,m},HR=VR({chartName:`BarChart`,GraphicalChild:$j,defaultTooltipEventType:`axis`,validateTooltipEventTypes:[`axis`,`item`],axisComponents:[{axisType:`xAxis`,AxisComp:tL},{axisType:`yAxis`,AxisComp:vL}],formatAxisMap:dM}),UR=VR({chartName:`ComposedChart`,GraphicalChild:[jF,eI,$j,RI],axisComponents:[{axisType:`xAxis`,AxisComp:tL},{axisType:`yAxis`,AxisComp:vL},{axisType:`zAxis`,AxisComp:hI}],formatAxisMap:dM}),WR=[`#3987e5`,`#d95926`,`#199e70`,`#c98500`,`#d55181`,`#008300`,`#9085e9`,`#e66767`],GR={good:`#0ca30c`,warn:`#fab219`,serious:`#ec835a`,crit:`#d03b3b`};function KR({active:e,payload:t,label:n,fmt:r,series:i}){if(!e||!t||!t.length)return null;let a=i.map(e=>({s:e,p:t.find(t=>t.dataKey===e.key)})).filter(e=>e.p&&e.p.value!=null);return(0,F.jsxs)(`div`,{className:`rounded-lg border border-line2 px-3 py-2 text-[12px] shadow-xl`,style:{background:`rgba(20,20,27,.97)`,minWidth:150},children:[(0,F.jsx)(`div`,{className:`text-mute mb-1.5`,children:Ca(n,!0)}),a.map(({s:e,p:t})=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-[1px]`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-ink2`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{background:e.color}}),e.label]}),(0,F.jsx)(`span`,{className:`tabular-nums font-medium`,children:Array.isArray(t.value)?`${r(t.value[0],e.key)} – ${r(t.value[1],e.key)}`:r(t.value,e.key)})]},e.key))]})}function qR({series:e}){return e.length<2?null:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[11.5px] text-ink2`,children:e.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-sm`,style:{background:e.color,opacity:e.type===`band`?.3:e.dashed?.6:1}}),e.label]},e.key))})}function JR({data:e,series:t,height:n=180,fmt:r=e=>String(e),yFmt:i,zoom:a=!0,markers:o,onPointClick:s,refLines:c,yDomain:l}){let u=I(),[d,f]=(0,v.useState)({}),p=e.length>1?e[e.length-1].t-e[0].t:36e5,m=t.some(e=>e.type===`bar`),h=e.length>1?e[1].t-e[0].t:p,g=(o||[]).filter(t=>!e.length||t.t>=e[0].t&&t.t<=e[e.length-1].t+h).map(t=>({...t,x:m&&e.length?e.reduce((e,n)=>n.t<=t.t&&n.t>e?n.t:e,e[0].t):t.t}));return(0,F.jsx)(`div`,{style:{height:n},className:`select-none`,children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(UR,{data:e,margin:{top:6,right:6,bottom:0,left:-8},barCategoryGap:1,onMouseDown:e=>a&&e&&e.activeLabel&&f({a:e.activeLabel}),onMouseMove:e=>d.a&&e&&e.activeLabel&&f(t=>({...t,b:e.activeLabel})),onMouseUp:()=>{d.a&&d.b&&d.a!==d.b?u.setCustom(Math.min(d.a,d.b),Math.max(d.a,d.b)):d.a&&s&&s(d.a),f({})},children:[(0,F.jsx)(rF,{vertical:!1}),(0,F.jsx)(tL,{dataKey:`t`,type:m?`category`:`number`,domain:[`dataMin`,`dataMax`],scale:m?`auto`:`time`,tickFormatter:e=>wa(e,p),tickLine:!1,axisLine:{stroke:`#2a2a35`},minTickGap:40}),(0,F.jsx)(vL,{tickFormatter:i||(e=>r(e)),tickLine:!1,axisLine:!1,width:60,allowDecimals:!0,domain:l}),(0,F.jsx)(Dm,{content:(0,F.jsx)(KR,{fmt:r,series:t}),cursor:{stroke:`#55556a`,strokeWidth:1,fill:`rgba(255,255,255,.03)`},isAnimationActive:!1}),t.map(e=>e.type===`band`?(0,F.jsx)(eI,{dataKey:e.key,stroke:`none`,fill:e.color,fillOpacity:.16,dot:!1,activeDot:!1,isAnimationActive:!1,connectNulls:!0},e.key):e.type===`bar`?(0,F.jsx)($j,{dataKey:e.key,stackId:e.stack,fill:e.color,isAnimationActive:!1,maxBarSize:14,radius:e.stack?0:[3,3,0,0],stroke:`var(--color-panel)`,strokeWidth:+!!e.stack},e.key):e.type===`line`||!e.type?(0,F.jsx)(jF,{dataKey:e.key,stroke:e.color,strokeWidth:2,strokeDasharray:e.dashed?`4 3`:void 0,dot:!1,activeDot:{r:4,stroke:`var(--color-panel)`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key):(0,F.jsx)(eI,{dataKey:e.key,stackId:e.stack,stroke:e.color,strokeWidth:2,fill:e.color,fillOpacity:.14,dot:!1,activeDot:{r:4,stroke:`var(--color-panel)`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key)),c?.map(e=>(0,F.jsx)(mN,{y:e.y,stroke:e.color||`#82829a`,strokeDasharray:`4 4`,label:{value:e.label,position:`insideBottomRight`,fill:e.color||`#82829a`,fontSize:10}},`y${e.y}${e.label}`)),g.map(e=>(0,F.jsx)(mN,{x:e.x,stroke:e.color||`#ff6b9d`,strokeDasharray:`3 3`,label:{value:e.label,position:`insideTopLeft`,fill:e.color||`#ff6b9d`,fontSize:10}},`${e.t}${e.label}`)),d.a&&d.b&&(0,F.jsx)(QN,{x1:d.a,x2:d.b,fill:`#ff3d7f`,fillOpacity:.12,stroke:`#ff3d7f`,strokeOpacity:.4})]})})})}function YR({title:e,sub:t,series:n,children:r,right:i}){return(0,F.jsxs)(`section`,{className:`card`,children:[(0,F.jsxs)(`div`,{className:`card-h`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,F.jsx)(`span`,{children:e}),t&&(0,F.jsx)(`span`,{className:`card-sub`,children:t})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[n&&(0,F.jsx)(qR,{series:n}),i]})]}),(0,F.jsx)(`div`,{className:`px-2 pb-2 pt-2`,children:r})]})}function XR({data:e,height:t=150,color:n=WR[0],highlight:r}){return(0,F.jsx)(`div`,{style:{height:t},children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(HR,{data:e,margin:{top:6,right:4,bottom:0,left:-18},barCategoryGap:2,children:[(0,F.jsx)(rF,{vertical:!1}),(0,F.jsx)(tL,{dataKey:`label`,tickLine:!1,axisLine:{stroke:`#2a2a35`},interval:0,tick:{fontSize:9.5}}),(0,F.jsx)(vL,{tickLine:!1,axisLine:!1,allowDecimals:!1}),(0,F.jsx)(Dm,{cursor:{fill:`rgba(255,255,255,.04)`},isAnimationActive:!1,content:({active:e,payload:t})=>e&&t?.length?(0,F.jsxs)(`div`,{className:`rounded-lg border border-line2 px-3 py-1.5 text-[12px]`,style:{background:`rgba(20,20,27,.97)`},children:[t[0].payload.label,`: `,(0,F.jsx)(`b`,{children:t[0].value}),` calls`]}):null}),(0,F.jsx)($j,{dataKey:`count`,radius:[3,3,0,0],isAnimationActive:!1,children:e.map((e,t)=>(0,F.jsx)(qm,{fill:r&&r(e)?GR.serious:n},t))})]})})})}function ZR(e,t){return e.map((e,n)=>{let r=t?.[n];return{...e,usualCalls:r?.calls?r.calls.expected:null,p95Normal:r?.p95?[r.p95.low,r.p95.high]:null}})}var QR=e=>e?{calls:{key:`usualCalls`,label:`Usual for this hour`,color:`#82829a`,type:`line`,dashed:!0},p95:{key:`p95Normal`,label:`Normal p95`,color:WR[1],type:`band`}}:null;function $R({k:e,endpoint:t,onClose:n}){let r=e.info.kind===`read`?`curl -H "Authorization: Bearer ${e.key}" ${t}/api/overview`:`OBZERVER_KEY=${e.key}\nOBZERVER_ENDPOINT=${t}${e.info.environment?`\nOBZERVER_ENV=${e.info.environment}`:``}`;return(0,F.jsxs)(`div`,{className:`rounded-lg border border-[#3b3315] bg-[#1d1a0e] p-3.5 flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 text-[12.5px]`,children:[(0,F.jsx)(Vi,{size:14,className:`text-[#f5c04e] mt-0.5 shrink-0`}),(0,F.jsxs)(`div`,{className:`flex-1`,children:[(0,F.jsxs)(`b`,{children:[`Copy “`,e.info.name,`” now.`]}),` `,(0,F.jsx)(`span`,{className:`text-ink2`,children:`Only its hash is stored, so it can't be shown again. Lost it? Rotate it.`})]}),n&&(0,F.jsx)(`button`,{className:`text-mute hover:text-ink`,onClick:n,title:`Done`,children:(0,F.jsx)(Ki,{size:14})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`code flex-1 !py-2 break-all`,children:e.key}),(0,F.jsx)(Ba,{text:e.key,className:`btn h-8`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-mute text-[11.5px]`,children:e.info.kind===`read`?`Read the API with it`:`Start an app with it`}),(0,F.jsx)(Ba,{text:r,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code !text-[11.5px]`,children:r})]})]})}var ez=[{id:``,label:`Never expires`},{id:`30`,label:`30 days`},{id:`90`,label:`90 days`},{id:`365`,label:`1 year`}];function tz({keys:e,endpoint:t,ingestRate:n,reload:r}){let[i,a]=(0,v.useState)(`ingest`),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(null),g=async()=>{p(``);try{let e=await N(`/api/keys`,{method:`POST`,json:{name:o,kind:i,environment:i===`ingest`&&c||null,expiresInDays:u?Number(u):null}});h(e),s(``),l(``),r()}catch(e){p(e.message)}};return(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(Zr,{size:14}),`API keys`]}),sub:`Ingest keys send telemetry (optionally only for one environment); read keys let scripts and CI read the API. Each key is shown once and stored as a hash.${n?` Up to ${n} requests/s per ingest key.`:``}`,pad:!1,children:[(0,F.jsxs)(`div`,{className:`px-4 pt-3 flex flex-col gap-3`,children:[(0,F.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,F.jsx)(Va,{value:i,onChange:a,options:[{id:`ingest`,label:`Ingest`},{id:`read`,label:`Read`}]}),(0,F.jsx)(`input`,{className:`input h-7 w-36`,placeholder:i===`read`?`Name, e.g. ci`:`Name, e.g. prod api`,value:o,onChange:e=>s(e.target.value)}),i===`ingest`&&(0,F.jsx)(`input`,{className:`input h-7 w-40`,placeholder:`Any environment`,title:`Only accept telemetry from apps reporting this environment (OBZERVER_ENV or NODE_ENV)`,value:c,onChange:e=>l(e.target.value)}),(0,F.jsx)(`select`,{className:`select h-7`,value:u,onChange:e=>d(e.target.value),"aria-label":`Expiry`,children:ez.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,F.jsxs)(`button`,{className:`btn btn-primary h-7`,children:[(0,F.jsx)(_i,{size:13}),`Create key`]}),f&&(0,F.jsx)(`span`,{className:`text-[12px] text-[#ff8a8a]`,children:f})]}),m&&(0,F.jsx)($R,{k:m,endpoint:t,onClose:()=>h(null)})]}),(0,F.jsx)(`div`,{className:`pt-2`,children:(0,F.jsx)(Ha,{rows:e,cols:[{key:`n`,label:`Name`,render:e=>(0,F.jsx)(`span`,{className:e.revoked||e.expired?`line-through text-mute`:``,children:e.name})},{key:`t`,label:`Kind`,render:e=>(0,F.jsx)(`span`,{className:`pill !text-[11px] ${e.kind===`read`?`text-[#7fb2f0]`:``}`,children:e.kind===`read`?`read`:`ingest`})},{key:`k`,label:`Key`,render:e=>(0,F.jsxs)(`span`,{className:`mono text-[11.5px] text-ink2`,children:[e.prefix,`…`]})},{key:`e`,label:`Environment`,render:e=>e.kind===`read`?(0,F.jsx)(`span`,{className:`text-mute`,children:`—`}):e.environment?(0,F.jsx)(`span`,{className:`mono text-[11.5px]`,children:e.environment}):(0,F.jsx)(`span`,{className:`text-mute`,children:`any`})},{key:`x`,label:`Expires`,render:e=>e.expires?(0,F.jsx)(`span`,{className:e.expired?`text-[#ff8a8a]`:`text-ink2`,title:Ca(e.expires,!0),children:e.expired?`expired`:Ca(e.expires,!0).split(` `)[0]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`never`})},{key:`u`,label:`Last used`,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:e.lastUsed?Sa(e.lastUsed):`never`})},{key:`a`,label:``,render:e=>e.revoked?(0,F.jsx)(`span`,{className:`text-mute`,children:`revoked`}):(0,F.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Rotate: a new key with the same settings; this one stops working`,onClick:async()=>{window.confirm(`Rotate "${e.name}"? You get a new key, and apps using the old one stop reporting until they get it.`)&&(h(await N(`/api/keys/${e.id}/rotate`,{method:`POST`})),r())},children:(0,F.jsx)(Ci,{size:13})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Revoke`,onClick:async()=>{window.confirm(`Revoke "${e.name}"? ${e.kind===`read`?`Scripts`:`Apps`} using it stop working.`)&&(await N(`/api/keys/${e.id}`,{method:`DELETE`}),r())},children:(0,F.jsx)(Ri,{size:13})})]})}]})})]})}var nz=[`github`,`linear`,`clickup`,`trello`],rz={github:`GitHub`,linear:`Linear`,clickup:`ClickUp`,trello:`Trello`};function iz(e=[]){let{data:t,reload:n}=P(`/api/settings/trackers`,e);return{settings:t,connected:nz.filter(e=>t?.[e]),reload:n}}var az={open:{label:`open`,color:`#5fd38a`},closed:{label:`closed`,color:`#a78bfa`},canceled:{label:`canceled`,color:`#82829a`}};function oz({ticket:e,compact:t=!1}){let n=e.state?az[e.state]:null;return(0,F.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1.5 rounded-md border border-line px-2 py-0.5 text-[12px] hover:border-ink2 hover:text-ink whitespace-nowrap`,children:[!t&&(0,F.jsx)(`span`,{className:`text-mute`,children:rz[e.provider]}),(0,F.jsx)(`span`,{className:`mono`,children:e.key}),n&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-mute`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:n.color}}),n.label]}),(0,F.jsx)(Vr,{size:11,className:`text-mute`})]})}var sz={github:`issue`,linear:`ticket`,clickup:`task`,trello:`card`};function cz({provider:e,settings:t,onSaved:n}){let{msg:r,busy:i,run:a}=dz(),o=t.autoCreate===e,s=t.autoCreate&&t.autoCreate!==e?rz[t.autoCreate]:null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-[13px] cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:o,disabled:i||!t[e],onChange:t=>a(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{autoCreate:t.target.checked?e:null}}),n(),t.target.checked?`Alert-opened issues now get a ${rz[e]} ${sz[e]}.`:`Turned off.`))}),`Open a `,rz[e],` `,sz[e],` automatically for issues created by alerts`]}),s&&!o&&(0,F.jsxs)(`div`,{className:`text-mute text-[12px] ml-6`,children:[`Currently on for `,s,`; turning it on here switches it.`]}),(0,F.jsx)(fz,{msg:r})]})}var lz={github:{done:`Closed (completed) issues`,cancel:`Issues closed as not planned`},linear:{done:`Tickets moved to a completed state`,cancel:`Canceled tickets`},clickup:{done:`Tasks moved to a closed or done status`,cancel:``},trello:{done:`Cards moved to the done list`,cancel:`Cards archived outside the done list`}};function uz({provider:e,webhook:t}){let n=lz[e];return(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2 flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{children:[`Linked tickets are checked every 2 minutes, so this works even when Obzerver is not reachable from the internet.`,t?` A webhook makes it instant.`:``]}),(0,F.jsxs)(`div`,{children:[n.done,` start fix verification here. Reopened ones reopen the issue.`,n.cancel?` ${n.cancel} close it without verification.`:``,` Verification results are posted back as a comment.`]})]})}function dz(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(!1);return{msg:e,busy:n,run:async e=>{r(!0),t(null);try{t({ok:!0,text:await e()})}catch(e){t({ok:!1,text:e.message})}finally{r(!1)}}}}var fz=({msg:e})=>e?(0,F.jsx)(`div`,{className:`text-[12.5px]`,style:{color:e.ok?`#5fd38a`:`#ff8a8a`},children:e.text}):null;function pz({settings:e,onSaved:t}){let n=e.github,[r,i]=(0,v.useState)(n?.token||``),[a,o]=(0,v.useState)(n?.repo||``),[s,c]=(0,v.useState)((n?.labels||[]).join(`, `)),{msg:l,busy:u,run:d}=dz(),f={github:{token:r,repo:a,labels:s}};return n?.source===`env`?(0,F.jsx)(hz,{p:`github`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_GITHUB_TOKEN`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_GITHUB_REPO`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:n.repo}),`. Change the environment variables to update it.`]})}):(0,F.jsxs)(hz,{p:`github`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating tickets in `,(0,F.jsx)(`span`,{className:`mono text-ink`,children:n.repo})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>d(async()=>window.confirm(`Disconnect GitHub? Linked tickets stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{github:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_220px_180px] gap-3`,children:[(0,F.jsx)(K,{label:`Token`,hint:(0,F.jsxs)(F.Fragment,{children:[`Fine-grained token with `,(0,F.jsx)(`b`,{children:`Issues: read and write`}),` on the repository, or a classic token with `,(0,F.jsx)(`span`,{className:`mono`,children:`repo`}),`.`]}),children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:`github_pat_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(K,{label:`Repository`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`owner/name`,value:a,onChange:e=>o(e.target.value)})}),(0,F.jsx)(K,{label:`Labels`,hint:`optional, comma-separated`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`bug, obzerver`,value:s,onChange:e=>c(e.target.value)})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn`,disabled:u||!r||!a,onClick:()=>d(async()=>(await N(`/api/settings/trackers/github/test`,{method:`POST`,json:f})).detail),children:[(0,F.jsx)(hi,{size:13}),`Test`]}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:u||!r||!a,onClick:()=>d(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:f}),t(),`Saved.`)),children:`Save`}),(0,F.jsx)(fz,{msg:l})]})]})}function mz({settings:e,onSaved:t}){let n=e.linear,[r,i]=(0,v.useState)(n?.apiKey||``),[a,o]=(0,v.useState)(n?[{id:n.teamId,key:``,name:n.teamName||n.teamId}]:[]),[s,c]=(0,v.useState)(n?.teamId||``),{msg:l,busy:u,run:d}=dz();if(n?.source===`env`)return(0,F.jsx)(hz,{p:`linear`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_LINEAR_API_KEY`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_LINEAR_TEAM`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:n.teamId}),`. Change the environment variables to update it.`]})});let f=a.find(e=>e.id===s);return(0,F.jsxs)(hz,{p:`linear`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating tickets in team `,(0,F.jsx)(`span`,{className:`text-ink`,children:n.teamName||n.teamId})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>d(async()=>window.confirm(`Disconnect Linear? Linked tickets stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{linear:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_auto_260px] gap-3 items-end`,children:[(0,F.jsx)(K,{label:`API key`,hint:`Linear → Settings → Security & access → Personal API keys`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:`lin_api_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsxs)(`button`,{className:`btn mb-[18px]`,disabled:u||!r,onClick:()=>d(async()=>{let e=await N(`/api/settings/trackers/linear/test`,{method:`POST`,json:{linear:{apiKey:r}}});return o(e.teams),!s&&e.teams[0]&&c(e.teams[0].id),`${e.detail}. Pick the team for new tickets.`}),children:[(0,F.jsx)(hi,{size:13}),`Connect`]}),(0,F.jsx)(K,{label:`Team`,hint:`new tickets are created here`,children:(0,F.jsxs)(`select`,{className:`select`,value:s,disabled:!a.length,onChange:e=>c(e.target.value),children:[!a.length&&(0,F.jsx)(`option`,{value:``,children:`Connect first`}),a.map(e=>(0,F.jsxs)(`option`,{value:e.id,children:[e.name,e.key?` (${e.key})`:``]},e.id))]})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:u||!r||!s,onClick:()=>d(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{linear:{apiKey:r,teamId:s,teamName:f?.name}}}),t(),`Saved.`)),children:`Save`}),(0,F.jsx)(fz,{msg:l})]})]})}function hz({status:e,action:t,children:n}){return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(e||t)&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e,(0,F.jsx)(`span`,{className:`flex-1`}),t]}),n]})}function gz({settings:e,onSaved:t}){let n=e.clickup,[r,i]=(0,v.useState)(n?.token||``),[a,o]=(0,v.useState)(n?.listId||``),[s,c]=(0,v.useState)(n?.listName||``),{msg:l,busy:u,run:d}=dz();if(n?.source===`env`)return(0,F.jsx)(hz,{p:`clickup`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_CLICKUP_TOKEN`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_CLICKUP_LIST`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:n.listId}),`. Change the environment variables to update it.`]})});let f={clickup:{token:r,listId:a,listName:s}};return(0,F.jsxs)(hz,{p:`clickup`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating tasks in list `,(0,F.jsx)(`span`,{className:`text-ink`,children:n.listName||n.listId})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>d(async()=>window.confirm(`Disconnect ClickUp? Linked tasks stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{clickup:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_1fr] gap-3`,children:[(0,F.jsx)(K,{label:`API token`,hint:`ClickUp → avatar → Settings → Apps → API Token (starts with pk_)`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:`pk_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(K,{label:`List`,hint:`paste the list's URL (…/v/li/901234567) or its id; new tasks go here`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`https://app.clickup.com/…/v/li/…`,value:a,onChange:e=>{o(e.target.value),c(``)}})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn`,disabled:u||!r,onClick:()=>d(async()=>{let e=await N(`/api/settings/trackers/clickup/test`,{method:`POST`,json:f});return e.listName&&c(e.listName),e.detail}),children:[(0,F.jsx)(hi,{size:13}),`Test`]}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:u||!r||!a,onClick:()=>d(async()=>{let e=await N(`/api/settings/trackers/clickup/test`,{method:`POST`,json:f});return await N(`/api/settings/trackers`,{method:`PUT`,json:{clickup:{token:r,listId:a,listName:e.listName||s}}}),t(),`Saved.`}),children:`Save`}),(0,F.jsx)(fz,{msg:l})]})]})}function _z({settings:e,onSaved:t}){let n=e.trello,[r,i]=(0,v.useState)(n?.apiKey||``),[a,o]=(0,v.useState)(n?.token||``),[s,c]=(0,v.useState)(n?[{id:n.boardId,name:n.boardName||n.boardId}]:[]),[l,u]=(0,v.useState)(n?.boardId||``),[d,f]=(0,v.useState)(n?[{id:n.listId,name:n.listName||n.listId},{id:n.doneListId,name:n.doneListName||n.doneListId}]:[]),[p,m]=(0,v.useState)(n?.listId||``),[h,g]=(0,v.useState)(n?.doneListId||``),{msg:_,busy:y,run:b}=dz();if(n?.source===`env`)return(0,F.jsx)(hz,{p:`trello`,status:(0,F.jsx)(G,{kind:`good`,children:`connected via env`}),children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_TRELLO_KEY`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`_TOKEN`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`_LIST`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`_DONE_LIST`}),`. Change the environment variables to update it.`]})});let x=e=>b(async()=>{let t=await N(`/api/settings/trackers/trello/test`,{method:`POST`,json:{trello:{apiKey:r,token:a,boardId:e}}});f(t.lists);let n=t.lists.find(e=>/done|complete|closed/i.test(e.name));return m(t.lists[0]?.id||``),g(n?.id||t.lists.at(-1)?.id||``),`${t.detail}. Pick the lists.`}),S=(e,t)=>e.find(e=>e.id===t)?.name;return(0,F.jsxs)(hz,{p:`trello`,status:n?(0,F.jsxs)(`span`,{className:`text-ink2 text-[12.5px]`,children:[`Creating cards in `,(0,F.jsxs)(`span`,{className:`text-ink`,children:[n.boardName||`board`,` → `,n.listName||`list`]}),`, done list `,(0,F.jsx)(`span`,{className:`text-ink`,children:n.doneListName||`—`})]}):null,action:n&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>b(async()=>window.confirm(`Disconnect Trello? Linked cards stay linked but stop syncing.`)?(await N(`/api/settings/trackers`,{method:`PUT`,json:{trello:null}}),t(),`Disconnected.`):`Kept.`),children:[(0,F.jsx)(Ri,{size:13}),`Disconnect`]}),children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_1fr_auto] gap-3 items-end`,children:[(0,F.jsx)(K,{label:`API key`,hint:(0,F.jsxs)(F.Fragment,{children:[`From a Power-Up at `,(0,F.jsx)(`span`,{className:`mono`,children:`trello.com/power-ups/admin`}),` → API key`]}),children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(K,{label:`Token`,hint:`generated from the same page (Token link next to the key)`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,value:a,onChange:e=>o(e.target.value)})}),(0,F.jsxs)(`button`,{className:`btn mb-[18px]`,disabled:y||!r||!a,onClick:()=>b(async()=>{let e=await N(`/api/settings/trackers/trello/test`,{method:`POST`,json:{trello:{apiKey:r,token:a}}});return c(e.boards),e.detail}),children:[(0,F.jsx)(hi,{size:13}),`Connect`]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-3 gap-3`,children:[(0,F.jsx)(K,{label:`Board`,children:(0,F.jsxs)(`select`,{className:`select`,value:l,disabled:!s.length,onChange:e=>{u(e.target.value),e.target.value&&x(e.target.value)},children:[(0,F.jsx)(`option`,{value:``,children:s.length?`Pick a board`:`Connect first`}),s.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,F.jsx)(K,{label:`New cards go to`,children:(0,F.jsxs)(`select`,{className:`select`,value:p,disabled:!d.length,onChange:e=>m(e.target.value),children:[!d.length&&(0,F.jsx)(`option`,{value:``,children:`Pick a board first`}),d.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),(0,F.jsx)(K,{label:`Done list`,hint:`moving a card here starts verification`,children:(0,F.jsxs)(`select`,{className:`select`,value:h,disabled:!d.length,onChange:e=>g(e.target.value),children:[!d.length&&(0,F.jsx)(`option`,{value:``,children:`Pick a board first`}),d.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))]})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:y||!r||!a||!l||!p||!h,onClick:()=>b(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{trello:{apiKey:r,token:a,boardId:l,boardName:S(s,l),listId:p,listName:S(d,p),doneListId:h,doneListName:S(d,h)}}}),t(),`Saved.`)),children:`Save`}),(0,F.jsx)(fz,{msg:_})]})]})}function vz({settings:e}){let t=`${window.location.origin}${e.webhooks.github.path}`;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{className:`text-ink2`,children:[`Repository → Settings → Webhooks → Add webhook. Content type `,(0,F.jsx)(`span`,{className:`mono`,children:`application/json`}),`, event `,(0,F.jsx)(`b`,{children:`Issues`}),`.`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute w-24 shrink-0`,children:`Payload URL`}),(0,F.jsx)(`span`,{className:`mono break-all`,children:t}),(0,F.jsx)(Ba,{text:t,className:`btn btn-ghost h-7`,label:``})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute w-24 shrink-0`,children:`Secret`}),(0,F.jsx)(`span`,{className:`mono break-all`,children:e.webhooks.github.secret}),(0,F.jsx)(Ba,{text:e.webhooks.github.secret,className:`btn btn-ghost h-7`,label:``})]}),(0,F.jsx)(`div`,{className:`text-mute`,children:`Checked against its signature; it never needs the dashboard password.`})]})}function yz({settings:e,onSaved:t}){let n=`${window.location.origin}${e.webhooks.linear.path}`,[r,i]=(0,v.useState)(``),{msg:a,busy:o,run:s}=dz();return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{className:`text-ink2`,children:[`Linear → Settings → API → Webhooks → New webhook, data change events for `,(0,F.jsx)(`b`,{children:`Issues`}),`. Then paste the signing secret Linear shows.`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute w-24 shrink-0`,children:`URL`}),(0,F.jsx)(`span`,{className:`mono break-all`,children:n}),(0,F.jsx)(Ba,{text:n,className:`btn btn-ghost h-7`,label:``})]}),(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(K,{label:`Signing secret`,children:(0,F.jsx)(`input`,{className:`input mono w-80`,type:`password`,placeholder:e.webhooks.linear.secretSet?`saved (enter a new one to replace)`:`lin_wh_…`,value:r,onChange:e=>i(e.target.value)})}),(0,F.jsx)(`button`,{className:`btn mb-[18px]`,disabled:o||!r,onClick:()=>s(async()=>(await N(`/api/settings/trackers`,{method:`PUT`,json:{linearWebhookSecret:r}}),i(``),t(),`Signing secret saved.`)),children:`Save`})]}),(0,F.jsx)(fz,{msg:a}),(0,F.jsx)(`div`,{className:`text-mute`,children:`Checked against its signature and timestamp; it never needs the dashboard password.`})]})}var bz=[{title:`Issue trackers`,sub:`turn issues into tickets; closing a ticket starts fix verification here`,items:[{id:`github`,name:`GitHub Issues`,mono:`GH`,color:`#8b949e`,blurb:`Create GitHub issues with the error, stack and affected users. Status syncs both ways.`},{id:`linear`,name:`Linear`,mono:`L`,color:`#7c83f7`,blurb:`Create Linear tickets in a team. Done starts verification; a failed fix moves the ticket back.`},{id:`clickup`,name:`ClickUp`,mono:`CU`,color:`#7b68ee`,blurb:`Create ClickUp tasks in a list. A closed status starts verification; a failed fix moves the task back to open.`},{id:`trello`,name:`Trello`,mono:`T`,color:`#0c66e4`,blurb:`Create Trello cards on a board. Moving a card to your done list starts verification.`},{id:`jira`,name:`Jira`,mono:`J`,color:`#3b82f6`,blurb:`Jira Cloud tickets with the same two-way sync.`,soon:!0}]},{title:`Notifications`,sub:`where alert rules and SLO burn alerts send messages`,items:[{id:`email`,name:`Email`,mono:`@`,color:`#f59e0b`,blurb:`Send alerts through any SMTP server: Gmail, SES, Resend, Postmark, Mailgun.`},{id:`slack`,name:`Slack`,mono:`S`,color:`#e01e5a`,blurb:`Post alerts to a channel with an incoming webhook URL, set per alert rule.`},{id:`webhook`,name:`Webhooks`,mono:`{}`,color:`#22c55e`,blurb:`POST alert events as JSON to any URL: PagerDuty, Opsgenie, n8n, your own service.`}]},{title:`AI`,sub:`ask questions in the dashboard, or let coding agents read the same telemetry`,items:[{id:`ai`,name:`Ask Obzeri`,mono:`✦`,color:`#a78bfa`,blurb:`Ask questions about this project in the dashboard. Answers come only from your telemetry, with evidence and links.`},{id:`mcp`,name:`MCP server`,mono:`AI`,color:`#ff3d7f`,blurb:`Claude Code, Cursor or any MCP client can investigate errors, traces, releases and SLOs.`}]}],xz=bz.flatMap(e=>e.items);function Sz(){let e=P(`/api/settings`),t=iz(),n=P(`/api/alerts`),r=P(`/api/settings/ai`);return{settings:e.data,trackers:t.settings??void 0,rules:n.data?.rules,ai:r.data,error:e.error,reload:()=>{e.reload(),t.reload(),n.reload(),r.reload()}}}var Cz=(e,t)=>(e||[]).filter(e=>(e.channels||[]).some(e=>e.type===t));function wz(e,t){switch(e){case`github`:return t.trackers?.github?{kind:`good`,text:`Connected · ${t.trackers.github.repo}`}:{kind:`neutral`,text:`Not connected`};case`linear`:return t.trackers?.linear?{kind:`good`,text:`Connected · ${t.trackers.linear.teamName||`team`}`}:{kind:`neutral`,text:`Not connected`};case`clickup`:return t.trackers?.clickup?{kind:`good`,text:`Connected · ${t.trackers.clickup.listName||`list`}`}:{kind:`neutral`,text:`Not connected`};case`trello`:return t.trackers?.trello?{kind:`good`,text:`Connected · ${t.trackers.trello.boardName||`board`}`}:{kind:`neutral`,text:`Not connected`};case`jira`:return{kind:`neutral`,text:`Coming soon`};case`email`:return t.settings?.email?.configured?{kind:`good`,text:`Configured${t.settings.email.source===`env`?` via env`:``}`}:{kind:`neutral`,text:`Not configured`};case`slack`:case`webhook`:{let n=Cz(t.rules,e).length;return n?{kind:`good`,text:`Used by ${n} alert rule${n===1?``:`s`}`}:{kind:`neutral`,text:`Set up per alert rule`}}case`ai`:return t.ai?.configured?{kind:`good`,text:`${t.ai.provider===`anthropic`?`Anthropic`:`OpenAI-compatible`} · ${t.ai.model}`}:{kind:`neutral`,text:`Not set up`};case`mcp`:return t.settings?.mcp?.tokenPrefix?{kind:`good`,text:`Ready`}:{kind:`neutral`,text:`No token`}}}var Tz=new Map,Ez=e=>{let t=Tz.get(e);return t||(t=new Promise(t=>{let n=new Image;n.onload=()=>t(n.naturalWidth>0),n.onerror=()=>t(!1),n.src=e}),Tz.set(e,t)),t};function Dz({item:e,size:t=36}){let n=`/logos/${e.id}.svg`,[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=!0;return Ez(n).then(t=>{e&&i(t)}),()=>{e=!1}},[n]),r?(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center rounded-lg shrink-0 bg-white`,style:{width:t,height:t},children:(0,F.jsx)(`img`,{src:n,alt:``,width:t*.6,height:t*.6,className:`object-contain`,style:{width:t*.6,height:t*.6}})}):(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center rounded-lg font-semibold shrink-0`,style:{width:t,height:t,fontSize:t*.36,color:e.color,background:`${e.color}26`},children:e.mono})}function Oz(){let{id:e}=yt(),t=Sz();if(t.error)return(0,F.jsx)(W,{error:t.error});if(!t.settings||!t.trackers)return(0,F.jsx)(U,{});let n=xz.find(t=>t.id===e);return e&&n&&!n.soon?(0,F.jsx)(Az,{item:n,ctx:t}):(0,F.jsx)(kz,{ctx:t})}function kz({ctx:e}){let t=Qn();return(0,F.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(gi,{size:18,className:`text-brand`}),title:`Integrations`,sub:`Connect Obzerver to the tools your team already uses.`}),bz.map(n=>(0,F.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[13px] font-semibold`,children:n.title}),(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:n.sub})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-2 @5xl:grid-cols-3 gap-3`,children:n.items.map(n=>{let r=wz(n.id,e),i=(0,F.jsxs)(`div`,{className:`h-full rounded-xl border border-line bg-panel p-4 flex flex-col gap-3 ${n.soon?`opacity-60`:`hover:border-line2 hover:bg-panel2 transition-colors`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(Dz,{item:n}),(0,F.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,F.jsx)(`div`,{className:`font-medium`,children:n.name})}),!n.soon&&(0,F.jsx)(Or,{size:15,className:`text-mute`})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] flex-1`,children:n.blurb}),(0,F.jsx)(`div`,{children:(0,F.jsx)(G,{kind:r.kind,children:r.text})})]});return n.soon?(0,F.jsx)(`div`,{children:i},n.id):(0,F.jsx)(Nn,{to:t(`/integrations/${n.id}`),children:i},n.id)})})]},n.title))]})}function Az({item:e,ctx:t}){let n=Qn(),r=wz(e.id,t);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 max-w-[1100px]`,children:[(0,F.jsxs)(Nn,{to:n(`/integrations`),className:`text-mute hover:text-ink text-[12px] -mb-1 inline-flex items-center gap-1`,children:[(0,F.jsx)(fr,{size:12}),`Integrations`]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3.5`,children:[(0,F.jsx)(Dz,{item:e,size:44}),(0,F.jsxs)(`div`,{className:`flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,children:e.name}),(0,F.jsx)(G,{kind:r.kind,children:r.text})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] mt-1`,children:e.blurb})]})]}),e.id===`github`&&(0,F.jsx)(jz,{provider:`github`,ctx:t}),e.id===`linear`&&(0,F.jsx)(jz,{provider:`linear`,ctx:t}),e.id===`clickup`&&(0,F.jsx)(jz,{provider:`clickup`,ctx:t}),e.id===`trello`&&(0,F.jsx)(jz,{provider:`trello`,ctx:t}),e.id===`email`&&(0,F.jsx)(Mz,{ctx:t}),(e.id===`slack`||e.id===`webhook`)&&(0,F.jsx)(Nz,{type:e.id,ctx:t}),e.id===`mcp`&&(0,F.jsx)(Iz,{ctx:t}),e.id===`ai`&&(t.ai?(0,F.jsx)(Lz,{ctx:t},`${t.ai.source}:${t.ai.provider}:${t.ai.apiKey}`):(0,F.jsx)(`div`,{className:`text-mute text-[12.5px]`,children:`Loading…`}))]})}function jz({provider:e,ctx:t}){let n=t.trackers,r=!!n[e],i=`${e}:${JSON.stringify(n[e])}`,a=e===`github`||e===`linear`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(H,{title:`Connection`,children:[e===`github`&&(0,F.jsx)(pz,{settings:n,onSaved:t.reload},i),e===`linear`&&(0,F.jsx)(mz,{settings:n,onSaved:t.reload},i),e===`clickup`&&(0,F.jsx)(gz,{settings:n,onSaved:t.reload},i),e===`trello`&&(0,F.jsx)(_z,{settings:n,onSaved:t.reload},i)]}),r&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Automation`,children:(0,F.jsx)(cz,{provider:e,settings:n,onSaved:t.reload})}),(0,F.jsx)(H,{title:`Status sync`,sub:a?`optional webhook for instant updates`:`by polling`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(uz,{provider:e,webhook:a}),e===`github`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`border-t border-line`}),(0,F.jsx)(vz,{settings:n})]}),e===`linear`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`border-t border-line`}),(0,F.jsx)(yz,{settings:n,onSaved:t.reload})]})]})})]})]})}function Mz({ctx:e}){let t=Qn(),n=Cz(e.rules,`email`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Fz,{email:e.settings.email,onSaved:e.reload}),(0,F.jsx)(H,{title:`Where it's used`,sub:`add an Email channel to an alert rule or an SLO`,children:(0,F.jsx)(Pz,{rules:n,empty:(0,F.jsxs)(Na,{title:`No alert rules send email yet`,children:[`Open a rule in `,(0,F.jsx)(Nn,{className:`link`,to:t(`/alerts`),children:`Alerts`}),` and add an Email channel with one or more addresses.`]})})})]})}function Nz({type:e,ctx:t}){let n=Qn(),r=Cz(t.rules,e);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`How to set it up`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[12.5px] text-ink2`,children:[e===`slack`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{children:`Each alert rule can post to its own channel, so there is nothing to connect globally.`}),(0,F.jsxs)(`ol`,{className:`list-decimal ml-5 flex flex-col gap-1`,children:[(0,F.jsxs)(`li`,{children:[`In Slack, create an app with `,(0,F.jsx)(`b`,{children:`Incoming Webhooks`}),` turned on and add a webhook for the channel.`]}),(0,F.jsxs)(`li`,{children:[`Copy the URL (it starts with `,(0,F.jsx)(`span`,{className:`mono`,children:`https://hooks.slack.com/services/`}),`).`]}),(0,F.jsxs)(`li`,{children:[`In `,(0,F.jsx)(Nn,{className:`link`,to:n(`/alerts`),children:`Alerts`}),`, open a rule (or an SLO), add a `,(0,F.jsx)(`b`,{children:`Slack`}),` channel and paste the URL.`]})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{children:`Each alert rule can POST to its own URL. The body is JSON:`}),(0,F.jsx)(`div`,{className:`code`,children:`{ "rule": "Checkout error rate", "state": "firing", "value": 7.2,
|
|
73
|
+
"message": "error rate 7.2% > 5% over 10 min", "link": "https://…/alerts?rule=3", "ts": 1763400000000 }`}),(0,F.jsxs)(`div`,{children:[`In `,(0,F.jsx)(Nn,{className:`link`,to:n(`/alerts`),children:`Alerts`}),`, open a rule (or an SLO) and add a `,(0,F.jsx)(`b`,{children:`Webhook`}),` channel with the URL.`]})]}),(0,F.jsx)(`div`,{children:(0,F.jsxs)(Nn,{className:`btn mt-1 inline-flex`,to:n(`/alerts`),children:[(0,F.jsx)(_i,{size:13}),`Go to alert rules`]})})]})}),(0,F.jsx)(H,{title:`Where it's used`,pad:!1,children:(0,F.jsx)(`div`,{className:`pt-2`,children:(0,F.jsx)(Pz,{rules:r,empty:(0,F.jsx)(Na,{title:`No alert rules use ${e===`slack`?`Slack`:`a webhook`} yet`})})})})]})}function Pz({rules:e,empty:t}){let n=Qn();return e.length?(0,F.jsx)(Ha,{rows:e,cols:[{key:`n`,label:`Rule`,render:e=>(0,F.jsx)(Nn,{className:`link`,to:n(`/alerts?rule=${e.id}`),children:e.name})},{key:`s`,label:`State`,render:e=>(0,F.jsx)(G,{kind:e.state===`firing`?`crit`:`good`,children:e.state===`firing`?`firing`:`ok`})},{key:`c`,label:`Channels`,render:e=>(0,F.jsx)(`div`,{className:`flex gap-1`,children:e.channels.map((e,t)=>(0,F.jsx)(`span`,{className:`pill`,children:e.type},t))})}]}):(0,F.jsx)(F.Fragment,{children:t})}function Fz({email:e,onSaved:t}){let[n,r]=(0,v.useState)(e.source===`settings`&&e.smtp||``),[i,a]=(0,v.useState)(e.source===`settings`&&e.from||``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),f=e.source===`env`;return(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(ai,{size:14}),`SMTP server`]}),sub:`used by alert rules and SLO burn alerts with an email channel`,right:e.configured?(0,F.jsxs)(G,{kind:`good`,children:[`configured`,f?` via env`:``]}):(0,F.jsx)(G,{kind:`neutral`,children:`not configured`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[f?(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_SMTP_URL`}),` = `,(0,F.jsx)(`span`,{className:`mono`,children:e.smtp}),`, sending as `,(0,F.jsx)(`span`,{className:`mono`,children:e.from}),`. Change the environment variables to update it.`]}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-[1fr_280px_auto] gap-3 items-end`,children:[(0,F.jsx)(K,{label:`SMTP URL`,hint:`smtp://user:pass@host:587 (STARTTLS) or smtps://user:pass@host:465. Works with Gmail, SES, Resend, Postmark, Mailgun.`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`smtps://apikey:secret@smtp.example.com:465`,value:n,onChange:e=>r(e.target.value)})}),(0,F.jsx)(K,{label:`From`,hint:`optional`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`Obzerver <alerts@company.com>`,value:i,onChange:e=>a(e.target.value)})}),(0,F.jsx)(`button`,{className:`btn btn-primary mb-[18px]`,disabled:u,onClick:async()=>{d(!0),l(null);try{await N(`/api/settings/email`,{method:`PUT`,json:{smtpUrl:n,from:i}}),l({ok:!0,text:`Saved.`}),t()}catch(e){l({ok:!1,text:e.message})}finally{d(!1)}},children:`Save`})]}),e.configured&&(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(K,{label:`Send a test email to`,children:(0,F.jsx)(`input`,{className:`input w-72`,placeholder:`you@company.com`,value:o,onChange:e=>s(e.target.value)})}),(0,F.jsxs)(`button`,{className:`btn`,disabled:u||!o,onClick:async()=>{d(!0),l(null);try{await N(`/api/settings/email/test`,{method:`POST`,json:{to:o}}),l({ok:!0,text:`Test email sent to ${o}.`})}catch(e){l({ok:!1,text:e.message})}finally{d(!1)}},children:[(0,F.jsx)(Di,{size:13}),`Send test`]})]}),c&&(0,F.jsx)(`div`,{className:`text-[12.5px]`,style:{color:c.ok?`#5fd38a`:`#ff8a8a`},children:c.text})]})})}function Iz({ctx:e}){let t=e.settings.mcp,[n,r]=(0,v.useState)(null),i=n??`<your MCP token>`,a=JSON.stringify({mcpServers:{obzerver:{type:`http`,url:t.url,headers:{Authorization:`Bearer ${i}`}}}},null,2),o=`claude mcp add --transport http obzerver ${t.url} --header "Authorization: Bearer ${i}"`;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Connect an agent`,sub:`read-only: nothing can be changed over MCP`,right:(0,F.jsx)(`button`,{className:`btn h-7`,onClick:async()=>{(!t.tokenPrefix||window.confirm(`Make a new MCP token? The current one stops working, so agents using it need the new one.`))&&(r((await N(`/api/settings/mcp-token`,{method:`POST`})).token),e.reload())},children:t.tokenPrefix?`New token`:`Create token`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px]`,children:`Let Claude Code, Cursor or any MCP client investigate regressions, follow a trace into its logs, or check whether an error is still happening, using the same data you see here.`}),n?(0,F.jsxs)(`div`,{className:`rounded-lg border border-[#3b3315] bg-[#1d1a0e] p-3 flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`text-[12.5px]`,children:[(0,F.jsx)(`b`,{children:`Copy the token now.`}),` `,(0,F.jsx)(`span`,{className:`text-ink2`,children:`Only its hash is stored, so it can't be shown again.`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`code flex-1 !py-2 break-all`,children:n}),(0,F.jsx)(Ba,{text:n,className:`btn h-8`})]})]}):(0,F.jsx)(`div`,{className:`text-[12.5px] text-ink2`,children:t.tokenPrefix?(0,F.jsxs)(F.Fragment,{children:[`Current token starts with `,(0,F.jsxs)(`span`,{className:`mono`,children:[t.tokenPrefix,`…`]}),`. It is stored as a hash: if you don't have it, make a new one and the commands below fill it in.`]}):`Create a token to connect an agent.`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Claude Code`}),(0,F.jsx)(Ba,{text:o,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:o})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Cursor / generic mcp.json`}),(0,F.jsx)(Ba,{text:a,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:a})]})]})}),(0,F.jsx)(H,{title:`Tools (${t.tools.length})`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.tools.map(e=>(0,F.jsx)(`span`,{className:`pill mono !text-[11px]`,children:e},e))})})]})}function Lz({ctx:e}){let t=e.ai||{configured:!1},[n,r]=(0,v.useState)(t.provider||`anthropic`),[i,a]=(0,v.useState)(t.apiKey||``),[o,s]=(0,v.useState)(t.model||``),[c,l]=(0,v.useState)(t.baseUrl||``),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(!1),m=async e=>{p(!0),d(null);try{d({ok:!0,text:await e()})}catch(e){d({ok:!1,text:e.message})}finally{p(!1)}},h={provider:n,apiKey:i,model:o,baseUrl:c||null};return t.source===`env`?(0,F.jsx)(H,{title:`Model`,children:(0,F.jsxs)(`div`,{className:`text-ink2 text-[12.5px]`,children:[`Set by `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_AI_PROVIDER`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_AI_API_KEY`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_AI_MODEL`}),`: `,t.provider,` · `,(0,F.jsx)(`span`,{className:`mono`,children:t.model}),t.baseUrl?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(`span`,{className:`mono`,children:t.baseUrl})]}):null,`. Change the environment variables to update it.`]})}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Model`,sub:`one model for every project on this server`,right:t.configured?(0,F.jsx)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>m(async()=>window.confirm(`Turn off Ask Obzeri?`)?(await N(`/api/settings/ai`,{method:`PUT`,json:null}),e.reload(),`Turned off.`):`Kept.`),children:`Turn off`}):void 0,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsxs)(`div`,{className:`seg w-fit`,children:[(0,F.jsx)(`button`,{className:n===`anthropic`?`on`:``,onClick:()=>{r(`anthropic`),s(``),l(``)},children:`Anthropic (Claude)`}),(0,F.jsx)(`button`,{className:n===`openai`?`on`:``,onClick:()=>{r(`openai`),s(``),l(``)},children:`OpenAI-compatible`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`API key`,hint:n===`anthropic`?`from console.anthropic.com → API keys`:`leave empty for a local server such as Ollama`,children:(0,F.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,placeholder:n===`anthropic`?`sk-ant-…`:`sk-…`,value:i,onChange:e=>a(e.target.value)})}),(0,F.jsx)(K,{label:`Model`,hint:n===`anthropic`?`default: claude-sonnet-5-5`:`the model id your endpoint serves`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:n===`anthropic`?`claude-sonnet-5-5`:`e.g. llama3.1, gpt-…`,value:o,onChange:e=>s(e.target.value)})})]}),(0,F.jsx)(K,{label:n===`anthropic`?`Base URL (optional)`:`Base URL`,hint:n===`anthropic`?`only for a proxy or gateway`:`https://api.openai.com/v1 · https://openrouter.ai/api/v1 · http://localhost:11434/v1 (Ollama)`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:n===`anthropic`?`https://api.anthropic.com`:`https://api.openai.com/v1`,value:c,onChange:e=>l(e.target.value)})}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn`,disabled:f,onClick:()=>m(async()=>(await N(`/api/settings/ai/test`,{method:`POST`,json:h})).detail),children:[(0,F.jsx)(Fi,{size:13}),`Test`]}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:f,onClick:()=>m(async()=>(await N(`/api/settings/ai`,{method:`PUT`,json:h}),e.reload(),`Saved. Open Ask Obzeri from the top bar (⌘I).`)),children:`Save`}),u&&(0,F.jsx)(`span`,{className:`text-[12.5px]`,style:{color:u.ok?`#5fd38a`:`#ff8a8a`},children:u.text})]})]})}),(0,F.jsx)(H,{title:`How answers are built`,children:(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2 flex flex-col gap-1.5`,children:[(0,F.jsx)(`div`,{children:`The model never touches the database. It can only call the same read-only tools as the MCP server, against the project you are in, and must finish with a structured answer.`}),(0,F.jsx)(`div`,{children:`Before an answer is shown, Obzerver checks it: sources and the time range come from the tool calls that really ran; links to executions, traces and errors are kept only if those ids appeared in tool results; evidence must cite a tool that ran; and confidence is lowered when something did not hold up.`}),(0,F.jsx)(`div`,{className:`text-mute`,children:`Privacy: your question and what the tools return (route names, error messages, SQL without values) are sent to the model provider. Use a local model through an OpenAI-compatible server if nothing may leave your network.`})]})})]})}function Rz(){let e=Qn(),t=Sz();if(!t.settings||!t.trackers)return null;let n=xz.filter(e=>!e.soon);return(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(gi,{size:14}),`Integrations`]}),sub:`GitHub, Linear, email, Slack, webhooks and MCP`,right:(0,F.jsxs)(Nn,{className:`btn h-7`,to:e(`/integrations`),children:[`Manage`,(0,F.jsx)(Or,{size:13})]}),children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(n=>{let r=wz(n.id,t);return(0,F.jsxs)(Nn,{to:e(`/integrations/${n.id}`),className:`inline-flex items-center gap-2 rounded-lg border border-line px-2.5 py-1.5 hover:border-line2`,children:[(0,F.jsx)(Dz,{item:n,size:22}),(0,F.jsx)(`span`,{className:`text-[12.5px]`,children:n.name}),(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:r.kind===`good`?`#5fd38a`:`#82829a`}})]},n.id)})})})}function zz({initial:e=`express`,title:t=`Connect an application`}={}){let{data:n,reload:r}=P(`/api/settings`),[i,a]=(0,v.useState)(e),[o,s]=(0,v.useState)(null),c=(n?.keys)?.find(e=>e.kind===`ingest`&&!e.revoked&&!e.expired),l=o?.key||`<your-ingest-key>`,u=n?.endpoint||`http://localhost:4319`,d=`OBZERVER_KEY=${l}\nOBZERVER_ENDPOINT=${u}\nOBZERVER_SERVICE=my-api`,f={zero:`# no code changes: preload the SDK
|
|
74
74
|
npm i @obzerver/node
|
|
75
75
|
|
|
76
76
|
${d.split(`
|
|
@@ -106,13 +106,13 @@ import { pino } from '@obzerver/node';
|
|
|
106
106
|
const app = Fastify({ logger: { ...pino() } }); // optional: forward Fastify's logs
|
|
107
107
|
// Instances are picked up automatically via diagnostics_channel.
|
|
108
108
|
app.get('/invoices/:id', async (req) => invoices.find(req.params.id));
|
|
109
|
-
await app.listen({ port: 3001 });`};return(0,F.jsx)(H,{title:t,right:(0,F.jsx)(Va,{value:i,onChange:a,options:[{id:`express`,label:`Express`},{id:`fastify`,label:`Fastify`},{id:`zero`,label:`Zero-code`}]}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!o&&(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[12.5px] text-ink2`,children:[(0,F.jsx)(Zr,{size:14,className:`text-mute`}),c?(0,F.jsxs)(F.Fragment,{children:[`Use your ingest key (starts with `,(0,F.jsxs)(`span`,{className:`mono`,children:[c.prefix,`…`]}),`), or`]}):(0,F.jsx)(F.Fragment,{children:`You need an ingest key:`}),(0,F.jsx)(`button`,{className:`btn h-7`,onClick:async()=>{s(await N(`/api/keys`,{method:`POST`,json:{name:`setup`,kind:`ingest`}})),r()},children:`Create a new key`})]}),o&&(0,F.jsx)($R,{k:o,endpoint:u}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`1. Environment`}),(0,F.jsx)(Ba,{text:d,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:d})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsxs)(`span`,{className:`text-ink2 text-[12px]`,children:[`2. `,i===`zero`?`Run`:`Initialise the SDK first`]}),(0,F.jsx)(Ba,{text:f[i],className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:f[i]})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[12px] leading-relaxed`,children:[`Traced automatically: every HTTP request (route templates, middleware & handler timings), thrown and `,(0,F.jsx)(`span`,{className:`mono`,children:`next(err)`}),` errors with source lines, console/pino logs, `,(0,F.jsx)(`span`,{className:`mono`,children:`pg`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`mysql2`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`ioredis`}),`, BullMQ workers, `,(0,F.jsx)(`span`,{className:`mono`,children:`node-cron`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`cron`}),` jobs, outbound `,(0,F.jsx)(`span`,{className:`mono`,children:`http`}),`/`,(0,F.jsx)(`span`,{className:`mono`,children:`fetch`}),` with `,(0,F.jsx)(`span`,{className:`mono`,children:`traceparent`}),` propagation, CPU/memory/event-loop/GC, and every method of classes in `,(0,F.jsx)(`span`,{className:`mono`,children:`*.service.ts`}),` / `,(0,F.jsx)(`span`,{className:`mono`,children:`*.repository.ts`}),` files. Add other classes with `,(0,F.jsx)(`span`,{className:`mono`,children:`instrument(MyClass)`}),`, any other background function with `,(0,F.jsx)(`span`,{className:`mono`,children:`job('name', fn)`}),`, and business numbers with `,(0,F.jsx)(`span`,{className:`mono`,children:`metrics.counter()`}),`.`]})]})})}function Rz(){let e=Qn(),t=P(`/api/projects`).data?.find(e=>e.slug===qn()),{data:n,error:r,reload:i}=P(`/api/settings`);return r?(0,F.jsx)(W,{error:r}):n?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(ki,{size:18,className:`text-brand`}),title:`Setup & settings`,sub:`Collector at ${n.endpoint} · data kept for ${n.retentionDays} days${n.passwordProtected?` · dashboard password protected`:``}`,right:(0,F.jsxs)(Nn,{to:e(`/projects`),className:`text-[12px] text-ink2 hover:text-ink`,children:[`Keys and setup for project `,(0,F.jsx)(`b`,{className:`text-ink`,children:t?.name??`…`})]})}),(0,F.jsx)(Lz,{}),(0,F.jsx)(tz,{keys:n.keys,endpoint:n.endpoint,ingestRate:n.ingestRate,reload:i}),n.history&&(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(Jr,{size:14}),`Long-term history`]}),sub:`hourly roll-ups that outlive raw data; baselines and the assistant learn from them`,children:(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-4 gap-4 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Kept for`}),(0,F.jsxs)(`div`,{className:`font-medium`,children:[n.history.days,` days`]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[`hourly for `,n.history.hourlyDays,` days, then daily`]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Raw data`}),(0,F.jsxs)(`div`,{className:`font-medium`,children:[n.retentionDays,` days`]}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:`traces, spans, logs`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Oldest`}),(0,F.jsx)(`div`,{className:`font-medium`,children:n.history.oldest?Ca(n.history.oldest,!0):`nothing yet`}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:n.history.rolledUntil?`rolled up to ${Sa(n.history.rolledUntil)}`:`first roll-up within minutes`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Size`}),(0,F.jsx)(`div`,{className:`font-medium`,children:n.history.bytes==null?`—`:xa(n.history.bytes)}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[n.history.rows.toLocaleString(),` rows · `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_HISTORY_DAYS`})]})]})]})}),(0,F.jsx)(Iz,{})]}):(0,F.jsx)(U,{})}var zz=(e,t,n)=>`/operations/${e}/${Ea(t)}/${Ea(n)}`;function Bz(){let e=I(),t=$a(),n=Qn(),r=ht(),{data:i,error:a}=P(`/api/overview${e.q()}`,[e.tick]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});if(e.meta&&e.meta.counts.traces===0)return(0,F.jsx)(Hz,{});let o=i.kpis,s=ZR(i.series.points,i.band),c=QR(i.band),l=[{key:`s2xx`,label:`2xx/3xx`,color:WR[0],type:`bar`,stack:`s`},{key:`s4xx`,label:`4xx`,color:GR.warn,type:`bar`,stack:`s`},{key:`s5xx`,label:`5xx`,color:GR.crit,type:`bar`,stack:`s`},...c?[c.calls]:[]],u=[...c?[c.p95]:[],{key:`p95`,label:`p95`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[0],type:`line`}],d=o.usual&&o.usual.requests>=50?o.usual:o.prev&&o.prev.requests>=50?o.prev:null,f=d&&d===o.usual?`vs usual: ${o.usual.description}`:`vs the previous window of the same length`,p=(e,t)=>d&&t!=null?Ta(e,t):null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{title:`Overview`,sub:`${t.length} application${t.length===1?``:`s`} reporting${e.env?` in ${e.env}`:``} · ${d===o.usual&&d?`changes vs ${o.usual.description}`:d?`changes vs the previous window`:`drag across any chart to zoom`}`}),i.fromHistory&&(0,F.jsx)(Uz,{note:i.fromHistory.note}),i.secrets?.open>0&&(0,F.jsxs)(`button`,{className:`text-left rounded-xl border px-4 py-3 flex items-center gap-3 hover:brightness-110`,style:{borderColor:`#6b2330`,background:`rgba(208,59,59,.12)`},onClick:()=>r(n(`/secrets`)),children:[(0,F.jsx)(Ai,{size:20,className:`shrink-0`,style:{color:`#ff6b6b`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1 text-[13px]`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{style:{color:`#ffb0b0`},children:`Secrets are reaching your logs`}),` `,(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`· `,i.secrets.open,` place`,i.secrets.open===1?``:`s`,` to fix`,i.secrets.inWindow?` · ${V(i.secrets.inWindow)} in this window`:``,` · redacted before storage`]})]}),(0,F.jsx)(`div`,{className:`text-ink2 truncate text-[12px] mt-0.5`,children:i.secrets.top.map(e=>`${e.label} in ${e.source===`error`?`error messages`:`logs`} of ${e.service}${e.operation?` at ${e.operation}`:``}`).join(` · `)})]}),(0,F.jsx)(`span`,{className:`btn h-7 shrink-0`,children:`Review`})]}),i.firing.length>0&&(0,F.jsxs)(`div`,{className:`card px-4 py-2.5 flex items-center gap-3 cursor-pointer`,style:{borderColor:`#5a2328`,background:`rgba(208,59,59,.08)`},onClick:()=>r(n(`/alerts`)),children:[(0,F.jsx)(gr,{size:15,style:{color:GR.crit}}),(0,F.jsxs)(`span`,{className:`font-medium`,children:[i.firing.length,` alert`,i.firing.length>1?`s`:``,` firing:`]}),(0,F.jsx)(`span`,{className:`text-ink2 truncate`,children:i.firing.map(e=>e.name).join(` · `)}),(0,F.jsx)(pr,{size:14,className:`ml-auto text-mute`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @2xl:grid-cols-3 @5xl:grid-cols-6 gap-3`,children:[(0,F.jsx)(Fa,{label:`Requests`,value:V(o.requests),sub:`${V(o.rpm)} rpm`,deltaTitle:f,deltaText:p(o.requests,d?.requests)?.text,deltaDir:p(o.requests,d?.requests)?.dir,badWhen:`none`,spark:s.map(e=>e.count),onClick:()=>r(n(`/requests`))}),(0,F.jsx)(Fa,{label:`Failure rate (5xx)`,value:ba(o.failureRate),sub:`${V(o.failed)} failed · ${V(o.clientErrors)} 4xx`,deltaTitle:f,deltaText:p(o.failureRate,d?.failureRate)?.text,deltaDir:p(o.failureRate,d?.failureRate)?.dir,badWhen:`up`,color:o.failureRate>1?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`p95 latency`,value:B(o.p95),sub:`p99 ${B(o.p99)}`,deltaTitle:f,deltaText:p(o.p95,d?.p95)?.text,deltaDir:p(o.p95,d?.p95)?.dir,badWhen:`up`}),(0,F.jsx)(Fa,{label:`Average latency`,value:B(o.avg),deltaTitle:f,deltaText:p(o.avg,d?.avg)?.text,deltaDir:p(o.avg,d?.avg)?.dir,badWhen:`up`}),(0,F.jsx)(Fa,{label:`Unhandled errors`,value:V(o.errors),sub:`${i.errorGroups.length} group${i.errorGroups.length===1?``:`s`}`,onClick:()=>r(n(`/errors`)),color:o.errors?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`Jobs`,value:V(o.jobs),sub:o.jobsFailed?`${V(o.jobsFailed)} failed (${ba(o.jobsFailed/Math.max(1,o.jobs)*100)})`:`no failures`,onClick:()=>r(n(`/jobs`))})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:`Throughput`,sub:`requests per bucket by status`,series:l,children:(0,F.jsx)(JR,{data:s,series:l,fmt:e=>V(e)})}),(0,F.jsx)(YR,{title:`Latency`,series:u,children:(0,F.jsx)(JR,{data:s,series:u,fmt:e=>B(e)})})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Where time goes`,sub:`routes by total time`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/requests?sort=time`)),children:`All routes`}),children:(0,F.jsx)(Vz,{rows:i.topByTime,metric:e=>B(e.totalTime),onRow:e=>r(n(zz(`http`,e.service,e.name)))})}),(0,F.jsx)(H,{title:`Slowest routes`,sub:`by p95`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/requests?sort=p95`)),children:`All routes`}),children:(0,F.jsx)(Vz,{rows:i.slowest,metric:e=>B(e.p95),onRow:e=>r(n(zz(`http`,e.service,e.name)))})}),(0,F.jsx)(H,{title:`Unhandled errors`,sub:`by occurrences`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/errors`)),children:`All errors`}),children:i.errorGroups.length===0?(0,F.jsx)(Na,{title:`No unhandled errors`,icon:(0,F.jsx)(`span`,{className:`text-[18px]`,children:`✓`}),children:`Nothing escaped a handler in this window.`}):(0,F.jsx)(`div`,{className:`flex flex-col`,children:i.errorGroups.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 cursor-pointer hover:bg-[#181821]`,onClick:()=>r(n(`/errors/${e.fingerprint}`)),children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[#ff9b9b]`,children:e.class}),e.isNew&&(0,F.jsx)(G,{kind:`serious`,children:`new`})]}),(0,F.jsx)(`div`,{className:`text-mute truncate text-[12px]`,children:e.message})]}),(0,F.jsx)(Ia,{data:e.spark,color:GR.crit,w:56}),(0,F.jsx)(`div`,{className:`text-right tabular-nums w-10`,children:V(e.count)})]},e.fingerprint))})})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(`div`,{className:`@5xl:col-span-2`,children:(0,F.jsx)(YR,{title:`Jobs`,sub:`runs and failures`,series:[{key:`count`,label:`Runs`,color:WR[2]},{key:`failed`,label:`Failed`,color:GR.crit}],children:(0,F.jsx)(JR,{data:i.jobSeries.points,height:150,series:[{key:`count`,label:`Runs`,color:WR[2],type:`area`},{key:`failed`,label:`Failed`,color:GR.crit,type:`line`}],fmt:e=>V(e)})})}),(0,F.jsx)(H,{title:`Instances`,sub:`latest runtime sample`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/profiler`)),children:`Profiler`}),children:(0,F.jsx)(Ha,{rows:i.runtime,empty:(0,F.jsx)(Na,{title:`No runtime samples yet`}),onRow:()=>r(n(`/profiler`)),cols:[{key:`i`,label:`Instance`,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`truncate`,children:e.service}),(0,F.jsx)(`div`,{className:`text-mute text-[11px] mono truncate`,children:e.instance})]})},{key:`cpu`,label:`CPU`,num:!0,render:e=>ba(e.cpu,0)},{key:`rss`,label:`RSS`,num:!0,render:e=>`${Math.round(e.rss/1048576)}MB`},{key:`el`,label:`Loop p99`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.elP99>100?GR.serious:void 0},children:B(e.elP99)})},{key:`ts`,label:`Seen`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.ts)})}]})})]})]})}function Vz({rows:e,metric:t,onRow:n}){return e.length?(0,F.jsx)(`div`,{className:`flex flex-col`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 cursor-pointer hover:bg-[#181821]`,onClick:()=>n(e),children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(za,{name:e.name}),(0,F.jsxs)(`div`,{className:`text-mute text-[11px] pl-[44px]`,children:[e.service,` · `,V(e.calls),` calls`]})]}),(0,F.jsx)(`div`,{className:`tabular-nums font-medium`,children:t(e)})]},e.service+e.name))}):(0,F.jsx)(Na,{title:`No requests in this window`})}function Hz({simple:e}){return(0,F.jsxs)(`div`,{className:`max-w-3xl mx-auto py-6 flex flex-col gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-[22px] font-semibold tracking-tight`,children:e?`Let's connect your app`:`Waiting for your first request`}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1`,children:e?`Two steps: add the environment variables below, then start your app with the SDK. Visit a few pages and this screen turns into a health check within seconds.`:`Add the SDK to an Express or Fastify app and send it some traffic. Requests, errors, logs and traces show up here within seconds. No spans to wire by hand.`})]}),(0,F.jsx)(Lz,{initial:e?`zero`:void 0}),(0,F.jsxs)(`div`,{className:`text-mute text-[12.5px]`,children:[`Just exploring? Run `,(0,F.jsx)(`span`,{className:`mono text-ink2`,children:`npx obzerver seed`}),` to load 24 hours of demo telemetry.`]})]})}function Uz({note:e}){return(0,F.jsxs)(`div`,{className:`card px-4 py-2 text-[12px] text-ink2 flex items-center gap-2`,style:{borderColor:`#2b3a55`,background:`rgba(57,135,229,.06)`},children:[(0,F.jsx)(Jr,{size:14,className:`text-[#7fb2f0] shrink-0`}),e]})}function Wz({kind:e}){let t=I(),n=Qn(),r=ht(),[i,a]=(0,v.useState)(``),[o,s]=zn(),c=[`calls`,`rpm`,`avg`,`p95`,`fail`,`time`,`last`,`qw`,`name`,`service`].includes(o.get(`sort`)||``)?o.get(`sort`):`calls`,{data:l,error:u}=P(`/api/operations${t.q({kind:e})}`,[t.tick,e]),d=P(`/api/overview${t.q()}`,[t.tick]),f=e===`job`,p=e=>Ya.includes(e.method||e.name.split(` `)[0]),m=(l||[]).filter(p).length,h=f?null:o.get(`tab`)===`graphql`?`graphql`:`http`,g=h===`graphql`,_=l&&h?l.filter(e=>p(e)===g):l,y=!f&&m>0,b=P(y?`/api/operations/series${t.q({protocol:h})}`:null,[t.tick,h,y]),x=(o.get(`method`)||``).split(`,`).filter(Boolean),S=e=>{let t=o.get(e);return t===null||t===``||!Number.isFinite(Number(t))?null:Number(t)},C=S(`avgMin`),w=S(`avgMax`),T=S(`callsMin`),E=S(`callsMax`),D=e=>s(()=>{let t=new URLSearchParams(window.location.search);for(let[n,r]of Object.entries(e))r===null||r===``?t.delete(n):t.set(n,r);return t},{replace:!0}),O=(e,t)=>D({[e]:t}),k=e=>e.method||(e.name.includes(` `)?e.name.slice(0,e.name.indexOf(` `)):``),A=g?Ya:[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`],j=[...A,...[...new Set((_||[]).map(k).filter(Boolean))].filter(e=>!A.includes(e)).sort()],ee=x.length>0||C!=null||w!=null||T!=null||E!=null,te=(_||[]).filter(e=>(!i||e.name.toLowerCase().includes(i.toLowerCase())||e.service.toLowerCase().includes(i.toLowerCase()))&&(!x.length||x.includes(k(e)))&&(C==null||(e.avg??0)>=C)&&(w==null||(e.avg??0)<=w)&&(T==null||e.calls>=T)&&(E==null||e.calls<=E)),ne=Math.max(1,...te.map(e=>e.totalTime)),re=d.data&&!y?f?d.data.jobBand:d.data.band:null,ie=y?(b.data?.points||[]).map(e=>({...e,ok:e.count-e.failed})):d.data?ZR((f?d.data.jobSeries:d.data.series).points,re):[],ae=QR(re),oe=new Set((_||[]).map(e=>e.service)),se=(t.meta?.versions||[]).filter(e=>(t.service?e.service===t.service:oe.has(e.service))&&e.first>t.from&&e.first<t.to).map(e=>({t:e.first,label:t.service?e.version:`${e.service}@${e.version}`})),ce=g?[{key:`ok`,label:`Succeeded`,color:WR[0],type:`bar`,stack:`g`},{key:`failed`,label:`Failed (resolver errors)`,color:GR.crit,type:`bar`,stack:`g`}]:f?[{key:`count`,label:`Runs`,color:WR[2],type:`bar`,stack:`a`},{key:`failed`,label:`Failed`,color:GR.crit,type:`bar`,stack:`a`}]:[{key:`s2xx`,label:`2xx/3xx`,color:WR[0],type:`bar`,stack:`s`},{key:`s4xx`,label:`4xx`,color:GR.warn,type:`bar`,stack:`s`},{key:`s5xx`,label:`5xx`,color:GR.crit,type:`bar`,stack:`s`}];ae&&ce.push(ae.calls);let le=f?[{key:`p95`,label:`Duration p95`,color:WR[1],type:`line`},{key:`queueWaitP95`,label:`Queue wait p95`,color:WR[6],type:`line`}]:[{key:`p95`,label:`p95`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[0],type:`line`}];return ae&&le.unshift({...ae.p95,label:f?`Normal duration p95`:`Normal p95`}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:f?(0,F.jsx)(Gi,{size:18,className:`text-brand`}):(0,F.jsx)(ur,{size:18,className:`text-brand`}),title:f?`Jobs`:`Requests`,sub:f?`Queue consumers (BullMQ) and cron runs, with queue wait, attempts and failures.`:g?`Every GraphQL operation, by its name (anonymous ones by their root fields). A resolver that throws fails the request even when HTTP says 200.`:`Every HTTP route, by its route template. Click a route to see its executions.`}),h&&(0,F.jsx)(`div`,{className:`flex gap-2 -mt-3`,role:`tablist`,"aria-label":`Request type`,children:[[`http`,`HTTP`,Kr,l?l.length-m:null],[`graphql`,`GraphQL`,br,l?m:null]].map(([e,t,n,r])=>(0,F.jsxs)(`button`,{role:`tab`,"aria-selected":h===e,onClick:()=>D({tab:e===`http`?null:e,method:null}),className:`group flex items-center gap-2 h-9 px-3 rounded-lg border text-[13px] font-semibold transition-colors ${h===e?`border-brand/60 bg-[rgba(255,61,127,.08)] text-ink cursor-default`:`border-line text-ink2 cursor-pointer hover:bg-[#1b1b25] hover:border-line2 hover:text-ink`}`,children:[(0,F.jsx)(n,{size:14,className:h===e?`text-brand`:`text-mute`}),t,r!=null&&(0,F.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 rounded-full tabular-nums ${h===e?`bg-[rgba(255,61,127,.18)] text-ink`:`bg-[#1d1d27] text-mute group-hover:bg-[#2a2a37] group-hover:text-ink2`}`,children:r})]},e))}),_?.[0]?.fromHistory&&(0,F.jsx)(Uz,{note:`This window reaches past the raw data, so routes come from hourly summaries (latency within ~5%). Executions and traces are only kept for the raw-data period.`}),ie.length>0&&!(g&&!m)&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:f?`Runs`:`Throughput`,series:ce,children:(0,F.jsx)(JR,{data:ie,series:ce,height:150,fmt:e=>V(e),markers:se})}),(0,F.jsx)(YR,{title:f?`Duration & queue wait`:`Latency`,series:le,children:(0,F.jsx)(JR,{data:ie,series:le,height:150,fmt:e=>B(e),markers:se})})]}),(0,F.jsxs)(H,{pad:!1,title:`${te.length}${ee&&_?` of ${_.length}`:``} ${f?`job`:g?`operation`:`route`}${(ee?_?.length:te.length)===1?``:`s`}`,right:(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[240px] h-7`,placeholder:`Filter…`,value:i,onChange:e=>a(e.target.value)})]}),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 px-4 pt-3 pb-1 text-[12px]`,children:[!f&&j.length>0&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:g?`Type`:`Method`}),(0,F.jsxs)(`div`,{className:`seg`,children:[(0,F.jsx)(`button`,{className:x.length?``:`on`,onClick:()=>O(`method`,null),children:`All`}),j.map(e=>(0,F.jsx)(`button`,{className:`mono font-semibold ${x.includes(e)?`on`:``}`,style:{color:Ja[e]||void 0},onClick:()=>O(`method`,(x.includes(e)?x.filter(t=>t!==e):[...x,e]).join(`,`)||null),children:e},e))]})]}),(0,F.jsx)(Gz,{label:`Mean duration`,unit:`ms`,min:C,max:w,onChange:(e,t)=>D({avgMin:e,avgMax:t})}),(0,F.jsx)(Gz,{label:f?`Runs`:`Calls`,min:T,max:E,onChange:(e,t)=>D({callsMin:e,callsMax:t})}),ee&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7 text-[12px]`,onClick:()=>D({method:null,avgMin:null,avgMax:null,callsMin:null,callsMax:null}),children:[(0,F.jsx)(Ki,{size:12}),`Clear filters`]})]}),(0,F.jsx)(`div`,{className:`pt-2`,children:u?(0,F.jsx)(W,{error:u}):_?(0,F.jsx)(Ha,{rows:te,paged:!0,resetKey:`${h}|${i}|${o.get(`method`)}|${o.get(`avgMin`)}|${o.get(`avgMax`)}|${o.get(`callsMin`)}|${o.get(`callsMax`)}|${t.service}|${t.env}`,initialSort:c,initialDir:c===`name`||c===`service`?`asc`:`desc`,onRow:t=>r(n(zz(e,t.service,t.name))),rowKey:e=>e.service+e.name,empty:g?(0,F.jsx)(Na,{title:`No GraphQL operations in this window`,children:`Nothing to set up: the SDK names each request after its operation with Apollo Server, Mercurius, graphql-yoga or graphql-http (graphql-js 16 or 17).`}):(0,F.jsx)(Na,{title:f?`No jobs in this window`:`No requests in this window`,children:f?`Wrap processors with obzerver.bullmq(), obzerver.job() or obzerver.cron().`:`Send some traffic to an instrumented app.`}),cols:[{key:`name`,label:f?`Job`:g?`Operation`:`Route`,sort:e=>e.name,render:e=>(0,F.jsx)(`div`,{className:`min-w-0`,children:(0,F.jsx)(za,{name:e.name})})},{key:`service`,label:`Application`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},...f?[{key:`queue`,label:`Queue`,sort:e=>e.queue||``,render:e=>(0,F.jsx)(`span`,{className:`pill`,children:e.queue||`default`})}]:[],{key:`spark`,label:`Volume`,render:e=>(0,F.jsx)(Ia,{data:e.spark,color:WR[0],w:64,h:18})},{key:`calls`,label:f?`Runs`:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`rpm`,label:`Per min`,num:!0,sort:e=>e.rpm,render:e=>V(e.rpm)},{key:`avg`,label:`Avg`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`p95`,label:`p95`,num:!0,sort:e=>e.p95,render:e=>B(e.p95)},...f?[{key:`qw`,label:`Wait p95`,num:!0,sort:e=>e.queueWaitP95||0,render:e=>(0,F.jsx)(`span`,{style:{color:e.queueWaitP95>1e3?GR.serious:void 0},children:B(e.queueWaitP95)})}]:[],{key:`fail`,label:`Failure`,num:!0,sort:e=>e.failureRate,render:e=>(0,F.jsx)(`span`,{style:{color:e.failureRate>=5?`#ff7070`:e.failureRate>1?`#ffb38a`:e.failureRate>0?`var(--color-ink2)`:`var(--color-mute)`},children:ba(e.failureRate)})},{key:`time`,label:`Total time`,num:!0,sort:e=>e.totalTime,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`inline-block min-w-[52px]`,children:B(e.totalTime)}),(0,F.jsx)(Ga,{value:e.totalTime,max:ne,w:50})]})},{key:`last`,label:`Last`,num:!0,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.lastSeen)})}]},c):(0,F.jsx)(U,{})})]})]})}function Gz({label:e,unit:t,min:n,max:r,onChange:i}){let a=(t,a)=>(0,F.jsx)(`input`,{className:`input h-7 w-[76px] mono text-[12px] px-2`,type:`number`,min:0,inputMode:`numeric`,placeholder:a===`min`?`min`:`max`,"aria-label":`${e} ${a}`,value:t??``,onChange:e=>a===`min`?i(e.target.value||null,r==null?null:String(r)):i(n==null?null:String(n),e.target.value||null)});return(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`text-mute mr-0.5`,children:e}),(0,F.jsx)(`span`,{className:`text-mute`,children:`≥`}),a(n,`min`),(0,F.jsx)(`span`,{className:`text-mute`,children:`≤`}),a(r,`max`),t&&(0,F.jsx)(`span`,{className:`text-mute`,children:t})]})}var Kz={request:{color:`#3987e5`,label:`Request`,Icon:Oi},job:{color:`#3987e5`,label:`Job`,Icon:Gi},middleware:{color:`#9085e9`,label:`Middleware`,Icon:Qr},handler:{color:`#199e70`,label:`Handler`,Icon:qi},function:{color:`#d55181`,label:`Function`,Icon:vr},custom:{color:`#c98500`,label:`Custom span`,Icon:Lr},db:{color:`#d95926`,label:`Database`,Icon:Br},http:{color:`#e66767`,label:`Outbound HTTP`,Icon:Kr},graphql:{color:`#e86fc4`,label:`GraphQL operation`,Icon:br},resolver:{color:`#b48af0`,label:`Resolver`,Icon:ui}},qz=/\b(SELECT|FROM|WHERE|AND|OR|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|LEFT JOIN|RIGHT JOIN|INNER JOIN|JOIN|ON|RETURNING|UNION)\b/g;function Jz({text:e}){let t=e.replace(qz,`
|
|
109
|
+
await app.listen({ port: 3001 });`};return(0,F.jsx)(H,{title:t,right:(0,F.jsx)(Va,{value:i,onChange:a,options:[{id:`express`,label:`Express`},{id:`fastify`,label:`Fastify`},{id:`zero`,label:`Zero-code`}]}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!o&&(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-[12.5px] text-ink2`,children:[(0,F.jsx)(Zr,{size:14,className:`text-mute`}),c?(0,F.jsxs)(F.Fragment,{children:[`Use your ingest key (starts with `,(0,F.jsxs)(`span`,{className:`mono`,children:[c.prefix,`…`]}),`), or`]}):(0,F.jsx)(F.Fragment,{children:`You need an ingest key:`}),(0,F.jsx)(`button`,{className:`btn h-7`,onClick:async()=>{s(await N(`/api/keys`,{method:`POST`,json:{name:`setup`,kind:`ingest`}})),r()},children:`Create a new key`})]}),o&&(0,F.jsx)($R,{k:o,endpoint:u}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`1. Environment`}),(0,F.jsx)(Ba,{text:d,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:d})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsxs)(`span`,{className:`text-ink2 text-[12px]`,children:[`2. `,i===`zero`?`Run`:`Initialise the SDK first`]}),(0,F.jsx)(Ba,{text:f[i],className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:f[i]})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[12px] leading-relaxed`,children:[`Traced automatically: every HTTP request (route templates, middleware & handler timings), thrown and `,(0,F.jsx)(`span`,{className:`mono`,children:`next(err)`}),` errors with source lines, console/pino logs, `,(0,F.jsx)(`span`,{className:`mono`,children:`pg`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`mysql2`}),`, `,(0,F.jsx)(`span`,{className:`mono`,children:`ioredis`}),`, BullMQ workers, `,(0,F.jsx)(`span`,{className:`mono`,children:`node-cron`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`cron`}),` jobs, outbound `,(0,F.jsx)(`span`,{className:`mono`,children:`http`}),`/`,(0,F.jsx)(`span`,{className:`mono`,children:`fetch`}),` with `,(0,F.jsx)(`span`,{className:`mono`,children:`traceparent`}),` propagation, CPU/memory/event-loop/GC, and every method of classes in `,(0,F.jsx)(`span`,{className:`mono`,children:`*.service.ts`}),` / `,(0,F.jsx)(`span`,{className:`mono`,children:`*.repository.ts`}),` files. Add other classes with `,(0,F.jsx)(`span`,{className:`mono`,children:`instrument(MyClass)`}),`, any other background function with `,(0,F.jsx)(`span`,{className:`mono`,children:`job('name', fn)`}),`, and business numbers with `,(0,F.jsx)(`span`,{className:`mono`,children:`metrics.counter()`}),`.`]})]})})}function Bz(){let e=Qn(),t=P(`/api/projects`).data?.find(e=>e.slug===qn()),{data:n,error:r,reload:i}=P(`/api/settings`);return r?(0,F.jsx)(W,{error:r}):n?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(ki,{size:18,className:`text-brand`}),title:`Setup & settings`,sub:`Collector at ${n.endpoint} · data kept for ${n.retentionDays} days${n.passwordProtected?` · dashboard password protected`:``}`,right:(0,F.jsxs)(Nn,{to:e(`/projects`),className:`text-[12px] text-ink2 hover:text-ink`,children:[`Keys and setup for project `,(0,F.jsx)(`b`,{className:`text-ink`,children:t?.name??`…`})]})}),(0,F.jsx)(zz,{}),(0,F.jsx)(tz,{keys:n.keys,endpoint:n.endpoint,ingestRate:n.ingestRate,reload:i}),n.history&&(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(Jr,{size:14}),`Long-term history`]}),sub:`hourly roll-ups that outlive raw data; baselines and the assistant learn from them`,children:(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-4 gap-4 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Kept for`}),(0,F.jsxs)(`div`,{className:`font-medium`,children:[n.history.days,` days`]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[`hourly for `,n.history.hourlyDays,` days, then daily`]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Raw data`}),(0,F.jsxs)(`div`,{className:`font-medium`,children:[n.retentionDays,` days`]}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:`traces, spans, logs`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Oldest`}),(0,F.jsx)(`div`,{className:`font-medium`,children:n.history.oldest?Ca(n.history.oldest,!0):`nothing yet`}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:n.history.rolledUntil?`rolled up to ${Sa(n.history.rolledUntil)}`:`first roll-up within minutes`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Size`}),(0,F.jsx)(`div`,{className:`font-medium`,children:n.history.bytes==null?`—`:xa(n.history.bytes)}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[n.history.rows.toLocaleString(),` rows · `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_HISTORY_DAYS`})]})]})]})}),(0,F.jsx)(Rz,{})]}):(0,F.jsx)(U,{})}var Vz=(e,t,n)=>`/operations/${e}/${Ea(t)}/${Ea(n)}`;function Hz(){let e=I(),t=$a(),n=Qn(),r=ht(),{data:i,error:a}=P(`/api/overview${e.q()}`,[e.tick]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});if(e.meta&&e.meta.counts.traces===0)return(0,F.jsx)(Wz,{});let o=i.kpis,s=ZR(i.series.points,i.band),c=QR(i.band),l=[{key:`s2xx`,label:`2xx/3xx`,color:WR[0],type:`bar`,stack:`s`},{key:`s4xx`,label:`4xx`,color:GR.warn,type:`bar`,stack:`s`},{key:`s5xx`,label:`5xx`,color:GR.crit,type:`bar`,stack:`s`},...c?[c.calls]:[]],u=[...c?[c.p95]:[],{key:`p95`,label:`p95`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[0],type:`line`}],d=o.usual&&o.usual.requests>=50?o.usual:o.prev&&o.prev.requests>=50?o.prev:null,f=d&&d===o.usual?`vs usual: ${o.usual.description}`:`vs the previous window of the same length`,p=(e,t)=>d&&t!=null?Ta(e,t):null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{title:`Overview`,sub:`${t.length} application${t.length===1?``:`s`} reporting${e.env?` in ${e.env}`:``} · ${d===o.usual&&d?`changes vs ${o.usual.description}`:d?`changes vs the previous window`:`drag across any chart to zoom`}`}),i.fromHistory&&(0,F.jsx)(Gz,{note:i.fromHistory.note}),i.secrets?.open>0&&(0,F.jsxs)(`button`,{className:`text-left rounded-xl border px-4 py-3 flex items-center gap-3 hover:brightness-110`,style:{borderColor:`#6b2330`,background:`rgba(208,59,59,.12)`},onClick:()=>r(n(`/secrets`)),children:[(0,F.jsx)(Ai,{size:20,className:`shrink-0`,style:{color:`#ff6b6b`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1 text-[13px]`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{style:{color:`#ffb0b0`},children:`Secrets are reaching your logs`}),` `,(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`· `,i.secrets.open,` place`,i.secrets.open===1?``:`s`,` to fix`,i.secrets.inWindow?` · ${V(i.secrets.inWindow)} in this window`:``,` · redacted before storage`]})]}),(0,F.jsx)(`div`,{className:`text-ink2 truncate text-[12px] mt-0.5`,children:i.secrets.top.map(e=>`${e.label} in ${e.source===`error`?`error messages`:`logs`} of ${e.service}${e.operation?` at ${e.operation}`:``}`).join(` · `)})]}),(0,F.jsx)(`span`,{className:`btn h-7 shrink-0`,children:`Review`})]}),i.firing.length>0&&(0,F.jsxs)(`div`,{className:`card px-4 py-2.5 flex items-center gap-3 cursor-pointer`,style:{borderColor:`#5a2328`,background:`rgba(208,59,59,.08)`},onClick:()=>r(n(`/alerts`)),children:[(0,F.jsx)(gr,{size:15,style:{color:GR.crit}}),(0,F.jsxs)(`span`,{className:`font-medium`,children:[i.firing.length,` alert`,i.firing.length>1?`s`:``,` firing:`]}),(0,F.jsx)(`span`,{className:`text-ink2 truncate`,children:i.firing.map(e=>e.name).join(` · `)}),(0,F.jsx)(pr,{size:14,className:`ml-auto text-mute`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @2xl:grid-cols-3 @5xl:grid-cols-6 gap-3`,children:[(0,F.jsx)(Fa,{label:`Requests`,value:V(o.requests),sub:`${V(o.rpm)} rpm`,deltaTitle:f,deltaText:p(o.requests,d?.requests)?.text,deltaDir:p(o.requests,d?.requests)?.dir,badWhen:`none`,spark:s.map(e=>e.count),onClick:()=>r(n(`/requests`))}),(0,F.jsx)(Fa,{label:`Failure rate (5xx)`,value:ba(o.failureRate),sub:`${V(o.failed)} failed · ${V(o.clientErrors)} 4xx`,deltaTitle:f,deltaText:p(o.failureRate,d?.failureRate)?.text,deltaDir:p(o.failureRate,d?.failureRate)?.dir,badWhen:`up`,color:o.failureRate>1?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`p95 latency`,value:B(o.p95),sub:`p99 ${B(o.p99)}`,deltaTitle:f,deltaText:p(o.p95,d?.p95)?.text,deltaDir:p(o.p95,d?.p95)?.dir,badWhen:`up`}),(0,F.jsx)(Fa,{label:`Average latency`,value:B(o.avg),deltaTitle:f,deltaText:p(o.avg,d?.avg)?.text,deltaDir:p(o.avg,d?.avg)?.dir,badWhen:`up`}),(0,F.jsx)(Fa,{label:`Unhandled errors`,value:V(o.errors),sub:`${i.errorGroups.length} group${i.errorGroups.length===1?``:`s`}`,onClick:()=>r(n(`/errors`)),color:o.errors?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`Jobs`,value:V(o.jobs),sub:o.jobsFailed?`${V(o.jobsFailed)} failed (${ba(o.jobsFailed/Math.max(1,o.jobs)*100)})`:`no failures`,onClick:()=>r(n(`/jobs`))})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:`Throughput`,sub:`requests per bucket by status`,series:l,children:(0,F.jsx)(JR,{data:s,series:l,fmt:e=>V(e)})}),(0,F.jsx)(YR,{title:`Latency`,series:u,children:(0,F.jsx)(JR,{data:s,series:u,fmt:e=>B(e)})})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Where time goes`,sub:`routes by total time`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/requests?sort=time`)),children:`All routes`}),children:(0,F.jsx)(Uz,{rows:i.topByTime,metric:e=>B(e.totalTime),onRow:e=>r(n(Vz(`http`,e.service,e.name)))})}),(0,F.jsx)(H,{title:`Slowest routes`,sub:`by p95`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/requests?sort=p95`)),children:`All routes`}),children:(0,F.jsx)(Uz,{rows:i.slowest,metric:e=>B(e.p95),onRow:e=>r(n(Vz(`http`,e.service,e.name)))})}),(0,F.jsx)(H,{title:`Unhandled errors`,sub:`by occurrences`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/errors`)),children:`All errors`}),children:i.errorGroups.length===0?(0,F.jsx)(Na,{title:`No unhandled errors`,icon:(0,F.jsx)(`span`,{className:`text-[18px]`,children:`✓`}),children:`Nothing escaped a handler in this window.`}):(0,F.jsx)(`div`,{className:`flex flex-col`,children:i.errorGroups.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 cursor-pointer hover:bg-[#181821]`,onClick:()=>r(n(`/errors/${e.fingerprint}`)),children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[#ff9b9b]`,children:e.class}),e.isNew&&(0,F.jsx)(G,{kind:`serious`,children:`new`})]}),(0,F.jsx)(`div`,{className:`text-mute truncate text-[12px]`,children:e.message})]}),(0,F.jsx)(Ia,{data:e.spark,color:GR.crit,w:56}),(0,F.jsx)(`div`,{className:`text-right tabular-nums w-10`,children:V(e.count)})]},e.fingerprint))})})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(`div`,{className:`@5xl:col-span-2`,children:(0,F.jsx)(YR,{title:`Jobs`,sub:`runs and failures`,series:[{key:`count`,label:`Runs`,color:WR[2]},{key:`failed`,label:`Failed`,color:GR.crit}],children:(0,F.jsx)(JR,{data:i.jobSeries.points,height:150,series:[{key:`count`,label:`Runs`,color:WR[2],type:`area`},{key:`failed`,label:`Failed`,color:GR.crit,type:`line`}],fmt:e=>V(e)})})}),(0,F.jsx)(H,{title:`Instances`,sub:`latest runtime sample`,pad:!1,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 text-[11.5px]`,onClick:()=>r(n(`/profiler`)),children:`Profiler`}),children:(0,F.jsx)(Ha,{rows:i.runtime,empty:(0,F.jsx)(Na,{title:`No runtime samples yet`}),onRow:()=>r(n(`/profiler`)),cols:[{key:`i`,label:`Instance`,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`truncate`,children:e.service}),(0,F.jsx)(`div`,{className:`text-mute text-[11px] mono truncate`,children:e.instance})]})},{key:`cpu`,label:`CPU`,num:!0,render:e=>ba(e.cpu,0)},{key:`rss`,label:`RSS`,num:!0,render:e=>`${Math.round(e.rss/1048576)}MB`},{key:`el`,label:`Loop p99`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.elP99>100?GR.serious:void 0},children:B(e.elP99)})},{key:`ts`,label:`Seen`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.ts)})}]})})]})]})}function Uz({rows:e,metric:t,onRow:n}){return e.length?(0,F.jsx)(`div`,{className:`flex flex-col`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 cursor-pointer hover:bg-[#181821]`,onClick:()=>n(e),children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(za,{name:e.name}),(0,F.jsxs)(`div`,{className:`text-mute text-[11px] pl-[44px]`,children:[e.service,` · `,V(e.calls),` calls`]})]}),(0,F.jsx)(`div`,{className:`tabular-nums font-medium`,children:t(e)})]},e.service+e.name))}):(0,F.jsx)(Na,{title:`No requests in this window`})}function Wz({simple:e}){return(0,F.jsxs)(`div`,{className:`max-w-3xl mx-auto py-6 flex flex-col gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h1`,{className:`text-[22px] font-semibold tracking-tight`,children:e?`Let's connect your app`:`Waiting for your first request`}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1`,children:e?`Two steps: add the environment variables below, then start your app with the SDK. Visit a few pages and this screen turns into a health check within seconds.`:`Add the SDK to an Express or Fastify app and send it some traffic. Requests, errors, logs and traces show up here within seconds. No spans to wire by hand.`})]}),(0,F.jsx)(zz,{initial:e?`zero`:void 0}),(0,F.jsxs)(`div`,{className:`text-mute text-[12.5px]`,children:[`Just exploring? Run `,(0,F.jsx)(`span`,{className:`mono text-ink2`,children:`npx obzerver seed`}),` to load 24 hours of demo telemetry.`]})]})}function Gz({note:e}){return(0,F.jsxs)(`div`,{className:`card px-4 py-2 text-[12px] text-ink2 flex items-center gap-2`,style:{borderColor:`#2b3a55`,background:`rgba(57,135,229,.06)`},children:[(0,F.jsx)(Jr,{size:14,className:`text-[#7fb2f0] shrink-0`}),e]})}function Kz({kind:e}){let t=I(),n=Qn(),r=ht(),[i,a]=(0,v.useState)(``),[o,s]=zn(),c=[`calls`,`rpm`,`avg`,`p95`,`fail`,`time`,`last`,`qw`,`name`,`service`].includes(o.get(`sort`)||``)?o.get(`sort`):`calls`,{data:l,error:u}=P(`/api/operations${t.q({kind:e})}`,[t.tick,e]),d=P(`/api/overview${t.q()}`,[t.tick]),f=e===`job`,p=e=>Ya.includes(e.method||e.name.split(` `)[0]),m=(l||[]).filter(p).length,h=f?null:o.get(`tab`)===`graphql`?`graphql`:`http`,g=h===`graphql`,_=l&&h?l.filter(e=>p(e)===g):l,y=!f&&m>0,b=P(y?`/api/operations/series${t.q({protocol:h})}`:null,[t.tick,h,y]),x=(o.get(`method`)||``).split(`,`).filter(Boolean),S=e=>{let t=o.get(e);return t===null||t===``||!Number.isFinite(Number(t))?null:Number(t)},C=S(`avgMin`),w=S(`avgMax`),T=S(`callsMin`),E=S(`callsMax`),D=e=>s(()=>{let t=new URLSearchParams(window.location.search);for(let[n,r]of Object.entries(e))r===null||r===``?t.delete(n):t.set(n,r);return t},{replace:!0}),O=(e,t)=>D({[e]:t}),k=e=>e.method||(e.name.includes(` `)?e.name.slice(0,e.name.indexOf(` `)):``),A=g?Ya:[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`],j=[...A,...[...new Set((_||[]).map(k).filter(Boolean))].filter(e=>!A.includes(e)).sort()],ee=x.length>0||C!=null||w!=null||T!=null||E!=null,te=(_||[]).filter(e=>(!i||e.name.toLowerCase().includes(i.toLowerCase())||e.service.toLowerCase().includes(i.toLowerCase()))&&(!x.length||x.includes(k(e)))&&(C==null||(e.avg??0)>=C)&&(w==null||(e.avg??0)<=w)&&(T==null||e.calls>=T)&&(E==null||e.calls<=E)),ne=Math.max(1,...te.map(e=>e.totalTime)),re=d.data&&!y?f?d.data.jobBand:d.data.band:null,ie=y?(b.data?.points||[]).map(e=>({...e,ok:e.count-e.failed})):d.data?ZR((f?d.data.jobSeries:d.data.series).points,re):[],ae=QR(re),oe=new Set((_||[]).map(e=>e.service)),se=(t.meta?.versions||[]).filter(e=>(t.service?e.service===t.service:oe.has(e.service))&&e.first>t.from&&e.first<t.to).map(e=>({t:e.first,label:t.service?e.version:`${e.service}@${e.version}`})),ce=g?[{key:`ok`,label:`Succeeded`,color:WR[0],type:`bar`,stack:`g`},{key:`failed`,label:`Failed (resolver errors)`,color:GR.crit,type:`bar`,stack:`g`}]:f?[{key:`count`,label:`Runs`,color:WR[2],type:`bar`,stack:`a`},{key:`failed`,label:`Failed`,color:GR.crit,type:`bar`,stack:`a`}]:[{key:`s2xx`,label:`2xx/3xx`,color:WR[0],type:`bar`,stack:`s`},{key:`s4xx`,label:`4xx`,color:GR.warn,type:`bar`,stack:`s`},{key:`s5xx`,label:`5xx`,color:GR.crit,type:`bar`,stack:`s`}];ae&&ce.push(ae.calls);let le=f?[{key:`p95`,label:`Duration p95`,color:WR[1],type:`line`},{key:`queueWaitP95`,label:`Queue wait p95`,color:WR[6],type:`line`}]:[{key:`p95`,label:`p95`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[0],type:`line`}];return ae&&le.unshift({...ae.p95,label:f?`Normal duration p95`:`Normal p95`}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:f?(0,F.jsx)(Gi,{size:18,className:`text-brand`}):(0,F.jsx)(ur,{size:18,className:`text-brand`}),title:f?`Jobs`:`Requests`,sub:f?`Queue consumers (BullMQ) and cron runs, with queue wait, attempts and failures.`:g?`Every GraphQL operation, by its name (anonymous ones by their root fields). A resolver that throws fails the request even when HTTP says 200.`:`Every HTTP route, by its route template. Click a route to see its executions.`}),h&&(0,F.jsx)(`div`,{className:`flex gap-2 -mt-3`,role:`tablist`,"aria-label":`Request type`,children:[[`http`,`HTTP`,Kr,l?l.length-m:null],[`graphql`,`GraphQL`,br,l?m:null]].map(([e,t,n,r])=>(0,F.jsxs)(`button`,{role:`tab`,"aria-selected":h===e,onClick:()=>D({tab:e===`http`?null:e,method:null}),className:`group flex items-center gap-2 h-9 px-3 rounded-lg border text-[13px] font-semibold transition-colors ${h===e?`border-brand/60 bg-[rgba(255,61,127,.08)] text-ink cursor-default`:`border-line text-ink2 cursor-pointer hover:bg-[#1b1b25] hover:border-line2 hover:text-ink`}`,children:[(0,F.jsx)(n,{size:14,className:h===e?`text-brand`:`text-mute`}),t,r!=null&&(0,F.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 rounded-full tabular-nums ${h===e?`bg-[rgba(255,61,127,.18)] text-ink`:`bg-[#1d1d27] text-mute group-hover:bg-[#2a2a37] group-hover:text-ink2`}`,children:r})]},e))}),_?.[0]?.fromHistory&&(0,F.jsx)(Gz,{note:`This window reaches past the raw data, so routes come from hourly summaries (latency within ~5%). Executions and traces are only kept for the raw-data period.`}),ie.length>0&&!(g&&!m)&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:f?`Runs`:`Throughput`,series:ce,children:(0,F.jsx)(JR,{data:ie,series:ce,height:150,fmt:e=>V(e),markers:se})}),(0,F.jsx)(YR,{title:f?`Duration & queue wait`:`Latency`,series:le,children:(0,F.jsx)(JR,{data:ie,series:le,height:150,fmt:e=>B(e),markers:se})})]}),(0,F.jsxs)(H,{pad:!1,title:`${te.length}${ee&&_?` of ${_.length}`:``} ${f?`job`:g?`operation`:`route`}${(ee?_?.length:te.length)===1?``:`s`}`,right:(0,F.jsx)(qz,{q:i,setQ:a,ops:_||[],label:f?`jobs`:g?`operations`:`routes`,onPick:t=>r(n(Vz(e,t.service,t.name)))}),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 px-4 pt-3 pb-1 text-[12px]`,children:[!f&&j.length>0&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:g?`Type`:`Method`}),(0,F.jsxs)(`div`,{className:`seg`,children:[(0,F.jsx)(`button`,{className:x.length?``:`on`,onClick:()=>O(`method`,null),children:`All`}),j.map(e=>(0,F.jsx)(`button`,{className:`mono font-semibold ${x.includes(e)?`on`:``}`,style:{color:Ja[e]||void 0},onClick:()=>O(`method`,(x.includes(e)?x.filter(t=>t!==e):[...x,e]).join(`,`)||null),children:e},e))]})]}),(0,F.jsx)(Jz,{label:`Mean duration`,unit:`ms`,min:C,max:w,onChange:(e,t)=>D({avgMin:e,avgMax:t})}),(0,F.jsx)(Jz,{label:f?`Runs`:`Calls`,min:T,max:E,onChange:(e,t)=>D({callsMin:e,callsMax:t})}),ee&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7 text-[12px]`,onClick:()=>D({method:null,avgMin:null,avgMax:null,callsMin:null,callsMax:null}),children:[(0,F.jsx)(Ki,{size:12}),`Clear filters`]})]}),(0,F.jsx)(`div`,{className:`pt-2`,children:u?(0,F.jsx)(W,{error:u}):_?(0,F.jsx)(Ha,{rows:te,paged:!0,resetKey:`${h}|${i}|${o.get(`method`)}|${o.get(`avgMin`)}|${o.get(`avgMax`)}|${o.get(`callsMin`)}|${o.get(`callsMax`)}|${t.service}|${t.env}`,initialSort:c,initialDir:c===`name`||c===`service`?`asc`:`desc`,onRow:t=>r(n(Vz(e,t.service,t.name))),rowKey:e=>e.service+e.name,empty:g?(0,F.jsx)(Na,{title:`No GraphQL operations in this window`,children:`Nothing to set up: the SDK names each request after its operation with Apollo Server, Mercurius, graphql-yoga or graphql-http (graphql-js 16 or 17).`}):(0,F.jsx)(Na,{title:f?`No jobs in this window`:`No requests in this window`,children:f?`Wrap processors with obzerver.bullmq(), obzerver.job() or obzerver.cron().`:`Send some traffic to an instrumented app.`}),cols:[{key:`name`,label:f?`Job`:g?`Operation`:`Route`,sort:e=>e.name,render:e=>(0,F.jsx)(`div`,{className:`min-w-0`,children:(0,F.jsx)(za,{name:e.name})})},{key:`service`,label:`Application`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},...f?[{key:`queue`,label:`Queue`,sort:e=>e.queue||``,render:e=>(0,F.jsx)(`span`,{className:`pill`,children:e.queue||`default`})}]:[],{key:`spark`,label:`Volume`,render:e=>(0,F.jsx)(Ia,{data:e.spark,color:WR[0],w:64,h:18})},{key:`calls`,label:f?`Runs`:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`rpm`,label:`Per min`,num:!0,sort:e=>e.rpm,render:e=>V(e.rpm)},{key:`avg`,label:`Avg`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`p95`,label:`p95`,num:!0,sort:e=>e.p95,render:e=>B(e.p95)},...f?[{key:`qw`,label:`Wait p95`,num:!0,sort:e=>e.queueWaitP95||0,render:e=>(0,F.jsx)(`span`,{style:{color:e.queueWaitP95>1e3?GR.serious:void 0},children:B(e.queueWaitP95)})}]:[],{key:`fail`,label:`Failure`,num:!0,sort:e=>e.failureRate,render:e=>(0,F.jsx)(`span`,{style:{color:e.failureRate>=5?`#ff7070`:e.failureRate>1?`#ffb38a`:e.failureRate>0?`var(--color-ink2)`:`var(--color-mute)`},children:ba(e.failureRate)})},{key:`time`,label:`Total time`,num:!0,sort:e=>e.totalTime,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`inline-block min-w-[52px]`,children:B(e.totalTime)}),(0,F.jsx)(Ga,{value:e.totalTime,max:ne,w:50})]})},{key:`last`,label:`Last`,num:!0,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.lastSeen)})}]},c):(0,F.jsx)(U,{})})]})]})}function qz({q:e,setQ:t,ops:n,label:r,onPick:i}){let[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(-1),l=e.trim().toLowerCase(),u=l?n.filter(e=>e.name.toLowerCase().includes(l)||e.service.toLowerCase().includes(l)).sort((e,t)=>t.calls-e.calls).slice(0,8):[],d=a&&u.length>0,f=e=>{let t=e.toLowerCase().indexOf(l);return!l||t<0?e:(0,F.jsxs)(F.Fragment,{children:[e.slice(0,t),(0,F.jsx)(`mark`,{className:`bg-transparent text-brand`,children:e.slice(t,t+l.length)}),e.slice(t+l.length)]})},p=e=>{o(!1),c(-1),i(e)};return(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[240px] h-7`,placeholder:`Filter…`,value:e,role:`combobox`,"aria-expanded":d,"aria-controls":`route-suggestions`,"aria-autocomplete":`list`,"aria-activedescendant":d&&s>=0?`route-suggestion-${s}`:void 0,onChange:e=>{t(e.target.value),o(!0),c(-1)},onFocus:()=>o(!0),onBlur:()=>setTimeout(()=>o(!1),120),onKeyDown:e=>{e.key===`Escape`?o(!1):d?e.key===`ArrowDown`?(c((s+1)%u.length),e.preventDefault()):e.key===`ArrowUp`?(c(s<=0?u.length-1:s-1),e.preventDefault()):e.key===`Enter`&&s>=0&&(p(u[s]),e.preventDefault()):e.key===`ArrowDown`&&u.length&&(o(!0),c(0),e.preventDefault())}}),d&&(0,F.jsx)(`ul`,{id:`route-suggestions`,role:`listbox`,"aria-label":`Matching ${r}`,className:`absolute right-0 top-[calc(100%+4px)] z-30 w-[420px] max-w-[80vw] rounded-lg border border-line2 bg-panel2 shadow-xl py-1 text-[12.5px]`,children:u.map((e,t)=>(0,F.jsxs)(`li`,{id:`route-suggestion-${t}`,role:`option`,"aria-selected":t===s,className:`flex items-center gap-3 px-3 h-8 cursor-pointer ${t===s?`bg-[#22222d]`:`hover:bg-[#1b1b25]`}`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>c(t),children:[(0,F.jsx)(`div`,{className:`min-w-0 flex-1 truncate`,children:(0,F.jsx)(za,{name:e.name,render:f})}),(0,F.jsx)(`span`,{className:`text-mute shrink-0`,children:f(e.service)}),(0,F.jsx)(`span`,{className:`text-mute tabular-nums shrink-0 w-[64px] text-right`,children:V(e.calls)})]},e.service+e.name))})]})}function Jz({label:e,unit:t,min:n,max:r,onChange:i}){let a=(t,a)=>(0,F.jsx)(`input`,{className:`input h-7 w-[76px] mono text-[12px] px-2`,type:`number`,min:0,inputMode:`numeric`,placeholder:a===`min`?`min`:`max`,"aria-label":`${e} ${a}`,value:t??``,onChange:e=>a===`min`?i(e.target.value||null,r==null?null:String(r)):i(n==null?null:String(n),e.target.value||null)});return(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`text-mute mr-0.5`,children:e}),(0,F.jsx)(`span`,{className:`text-mute`,children:`≥`}),a(n,`min`),(0,F.jsx)(`span`,{className:`text-mute`,children:`≤`}),a(r,`max`),t&&(0,F.jsx)(`span`,{className:`text-mute`,children:t})]})}var Yz={request:{color:`#3987e5`,label:`Request`,Icon:Oi},job:{color:`#3987e5`,label:`Job`,Icon:Gi},middleware:{color:`#9085e9`,label:`Middleware`,Icon:Qr},handler:{color:`#199e70`,label:`Handler`,Icon:qi},function:{color:`#d55181`,label:`Function`,Icon:vr},custom:{color:`#c98500`,label:`Custom span`,Icon:Lr},db:{color:`#d95926`,label:`Database`,Icon:Br},http:{color:`#e66767`,label:`Outbound HTTP`,Icon:Kr},graphql:{color:`#e86fc4`,label:`GraphQL operation`,Icon:br},resolver:{color:`#b48af0`,label:`Resolver`,Icon:ui}},Xz=/\b(SELECT|FROM|WHERE|AND|OR|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|LEFT JOIN|RIGHT JOIN|INNER JOIN|JOIN|ON|RETURNING|UNION)\b/g;function Zz({text:e}){let t=e.replace(Xz,`
|
|
110
110
|
$1`).trim().split(`
|
|
111
|
-
`);return(0,F.jsx)(`div`,{className:`code !whitespace-pre-wrap`,children:t.map((e,t)=>{let n=/^(SELECT|FROM|WHERE|AND|OR|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|LEFT JOIN|RIGHT JOIN|INNER JOIN|JOIN|ON|RETURNING|UNION)\b(.*)$/.exec(e),r=n?n[1]:``,i=n?n[2]:e,a=[`AND`,`OR`,`ON`].includes(r)?` `:``;return(0,F.jsxs)(`div`,{children:[a,r&&(0,F.jsx)(`span`,{style:{color:`#ff6b9d`},children:r}),i.split(/(\?)/).map((e,t)=>e===`?`?(0,F.jsx)(`span`,{className:`px-[3px] rounded`,style:{background:`rgba(201,133,0,.25)`,color:`#ffc85a`},children:`?`},t):(0,F.jsx)(v.Fragment,{children:e},t))]},t)})})}function Yz(e){let t=new Map;for(let n of e){let e=n.parentId??null;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let e of t.values())e.sort((e,t)=>e.start-t.start);let n=[],r=(e,i)=>{for(let a of t.get(e)||[])n.push({s:a,depth:i,hasKids:(t.get(a.id)||[]).length>0}),r(a.id,i+1)};return r(null,0),n}function Xz({spans:e,logs:t=[],highlightSelf:n=!0}){let r=(0,v.useMemo)(()=>Yz(e),[e]),i=Math.max(1,...e.map(e=>e.start+e.duration)),[a,o]=(0,v.useState)(new Set),[s,c]=(0,v.useState)(null),l=new Set(e.map(e=>e.service).filter(Boolean)).size>1,u=Math.max(...e.filter(e=>!e.root).map(e=>e.self),0),d=new Set,f=r.filter(({s:e})=>e.parentId&&(d.has(e.parentId)||a.has(e.parentId))?(d.add(e.id),!1):!0),p=[0,.25,.5,.75,1],m=[...new Set(e.map(e=>e.kind))].filter(e=>Kz[e]);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[11.5px] text-ink2 mb-2 px-1`,children:[m.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-sm`,style:{background:Kz[e].color}}),Kz[e].label]},e)),(0,F.jsx)(`span`,{className:`ml-auto text-mute`,children:`Bar = total time · bright segment = self time`})]}),(0,F.jsxs)(`div`,{className:`grid text-[12px]`,style:{gridTemplateColumns:`minmax(260px, 38%) 1fr 72px 72px`},children:[(0,F.jsx)(`div`,{className:`text-mute text-[10.5px] uppercase tracking-wider px-2 py-1.5 border-b border-line`,children:`Span`}),(0,F.jsxs)(`div`,{className:`relative border-b border-line`,children:[p.map(e=>(0,F.jsx)(`span`,{className:`absolute top-1.5 text-[10px] text-mute -translate-x-1/2`,style:{left:`${e*100}%`,transform:e===1?`translateX(-100%)`:e===0?`none`:void 0},children:B(i*e)},e)),t.map((e,t)=>(0,F.jsx)(`span`,{title:`${e.level.toUpperCase()} ${e.message}`,className:`absolute bottom-0 w-[2px] h-2 rounded`,style:{left:`${Math.min(100,Math.max(0,(e.offset??0)/i)*100)}%`,background:e.level===`error`?`#d03b3b`:e.level===`warn`?`#fab219`:`#82829a`}},t))]}),(0,F.jsx)(`div`,{className:`text-mute text-[10.5px] uppercase tracking-wider px-2 py-1.5 border-b border-line text-right`,children:`Total`}),(0,F.jsx)(`div`,{className:`text-mute text-[10.5px] uppercase tracking-wider px-2 py-1.5 border-b border-line text-right`,children:`Self`}),f.map(({s:e,depth:t,hasKids:r})=>{let d=Kz[e.kind]||Kz.function,f=e.start/i*100,m=Math.max(.3,e.duration/i*100),h=e.duration?Math.max(0,Math.min(1,e.self/e.duration)):0,g=n&&!e.root&&e.self===u&&u>0,_=s===e.id;return(0,F.jsxs)(v.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-[5px] border-b border-[#1c1c25] cursor-pointer min-w-0 ${_?`bg-[#1a1a24]`:`hover:bg-[#16161e]`}`,style:{paddingLeft:8+t*14},onClick:()=>c(_?null:e.id),children:[r?(0,F.jsx)(`button`,{className:`text-mute hover:text-ink shrink-0`,onClick:t=>{t.stopPropagation();let n=new Set(a);n.has(e.id)?n.delete(e.id):n.add(e.id),o(n)},children:a.has(e.id)?(0,F.jsx)(Or,{size:13}):(0,F.jsx)(Er,{size:13})}):(0,F.jsx)(`span`,{className:`w-[13px] shrink-0`}),(0,F.jsx)(d.Icon,{size:12,style:{color:d.color},className:`shrink-0`}),(0,F.jsx)(`span`,{className:`truncate ${e.kind===`db`?`mono text-[11.5px]`:``}`,title:e.name,children:e.name}),e.count&&e.count>1&&(0,F.jsxs)(`span`,{className:`pill !text-[10px] !py-0`,style:{color:`#ffc85a`,borderColor:`#5a4512`},children:[`×`,e.count]}),l&&e.root&&e.service&&(0,F.jsx)(`span`,{className:`pill !text-[10px] !py-0`,children:e.service}),e.error&&(0,F.jsx)(Vi,{size:12,className:`shrink-0`,style:{color:`#ff7070`}}),g&&(0,F.jsx)(`span`,{className:`pill !text-[10px] !py-0`,style:{color:`#ffb38a`,borderColor:`#5a3322`},children:`most self time`})]}),(0,F.jsxs)(`div`,{className:`relative border-b border-[#1c1c25] cursor-pointer`,onClick:()=>c(_?null:e.id),children:[p.slice(1,-1).map(e=>(0,F.jsx)(`span`,{className:`absolute top-0 bottom-0 w-px bg-[#1c1c26]`,style:{left:`${e*100}%`}},e)),(0,F.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 h-[12px] rounded-[3px] overflow-hidden flex`,style:{left:`${f}%`,width:`${m}%`,background:`color-mix(in srgb, ${d.color} 32%, transparent)`,outline:e.error?`1.5px solid #ff5a5a`:void 0},children:(0,F.jsx)(`div`,{className:`h-full ml-auto`,style:{width:`${h*100}%`,background:d.color}})})]}),(0,F.jsx)(`div`,{className:`num px-2 py-[5px] border-b border-[#1c1c25] tabular-nums`,children:B(e.duration)}),(0,F.jsx)(`div`,{className:`num px-2 py-[5px] border-b border-[#1c1c25] tabular-nums`,style:{color:g?`#ffb38a`:`var(--color-ink2)`},children:B(e.self)}),_&&(0,F.jsx)(`div`,{className:`col-span-4 bg-[#111118] border-b border-line px-4 py-3`,style:{paddingLeft:24+t*14},children:(0,F.jsx)(Zz,{s:e})})]},e.id)})]})]})}function Zz({s:e}){let t=e.attrs||{},n=Object.entries(t).filter(([e])=>![`statement`,`system`,`url`,`collapsed`,`totalMs`].includes(e));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5 text-[12px]`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 text-ink2`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Kind`}),` `,Kz[e.kind]?.label||e.kind]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Starts at`}),` +`,B(e.start)]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Total`}),` `,B(e.duration)]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Self`}),` `,B(e.self)]}),e.count&&e.count>1&&(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Repeated`}),` `,e.count,`× (collapsed; `,B(t.totalMs),` combined)`]}),t.system&&(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`System`}),` `,t.system]}),e.service&&(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Service`}),` `,e.service]})]}),e.error&&(0,F.jsxs)(`div`,{className:`text-[#ff9b9b] flex items-center gap-1.5`,children:[(0,F.jsx)(Vi,{size:13}),e.error]}),t.statement&&t.system!==`redis`&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Statement (values removed before sending)`}),(0,F.jsx)(Ba,{text:t.statement,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(Jz,{text:t.statement})]}),t.url&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`URL`}),` `,(0,F.jsxs)(`span`,{className:`mono`,children:[t.method,` `,t.url]}),t.status&&(0,F.jsx)(`span`,{className:`ml-2 mono`,style:{color:t.status>=500?`#ff7070`:`#5fd38a`},children:t.status})]}),n.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,F.jsxs)(`span`,{className:`pill mono !text-[11px]`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:e}),`\xA0`,typeof t==`object`?JSON.stringify(t):String(t)]},e))})]})}function Qz(){let{kind:e=`http`,service:t=``,name:n=``}=yt(),r=I(),i=Qn(),a=ht(),[o,s]=(0,v.useState)(`recent`),[c,l]=(0,v.useState)(`all`),[u,d]=(0,v.useState)(0),{data:f,error:p}=P(`/api/operation${r.q({kind:e,name:n,service:t,sort:o,filter:c,limit:50,offset:u*50})}`,[r.tick]),m=e===`job`;if(p)return(0,F.jsx)(W,{error:p});if(!f)return(0,F.jsx)(U,{});let h=f.stats,g=ZR(f.series.points,f.band),_=QR(f.band),y=(r.meta?.versions||[]).filter(e=>e.service===t&&e.first>r.from&&e.first<r.to).map(e=>({t:e.first,label:e.version})),b=[..._?[_.p95]:[],{key:`p95`,label:`p95`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[0],type:`line`},{key:`p50`,label:`Median`,color:WR[2],type:`line`,dashed:!0}],x=[{key:`count`,label:m?`Runs`:`Calls`,color:WR[0],type:`area`},{key:`failed`,label:`Failed`,color:GR.crit,type:`line`},..._?[_.calls]:[]],S=Math.max(1,...f.breakdown.map(e=>e.avgSelf)),C=Object.entries(f.statuses).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsxs)(Nn,{to:i(m?`/jobs`:`/requests`),className:`text-mute hover:text-ink text-[12px] inline-flex items-center gap-1 -mb-2`,children:[(0,F.jsx)(Dr,{size:13}),m?`Jobs`:`Requests`]}),(0,F.jsx)(Ma,{title:(0,F.jsx)(za,{name:n}),sub:(0,F.jsxs)(`span`,{children:[t,` · `,m?`background job`:`HTTP route`]})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-6 gap-3`,children:[(0,F.jsx)(Fa,{label:m?`Runs`:`Calls`,value:V(h.calls),sub:`${V(h.rpm)} per min`,spark:g.map(e=>e.count)}),(0,F.jsx)(Fa,{label:`Failure rate`,value:ba(h.failureRate),sub:`${V(h.failed)} failed`,color:h.failureRate>1?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`Average`,value:B(h.avg)}),(0,F.jsx)(Fa,{label:`p50`,value:B(h.p50)}),(0,F.jsx)(Fa,{label:`p95`,value:B(h.p95),sub:`p99 ${B(h.p99)}`}),(0,F.jsx)(Fa,{label:`Max`,value:B(h.max)})]}),f.fromHistory&&(0,F.jsx)(Uz,{note:f.fromHistory.note}),(0,F.jsx)($z,{usual:f.usual,current:h,windowMin:(r.to-r.from)/6e4}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:m?`Runs`:`Throughput`,series:x,children:(0,F.jsx)(JR,{data:g,series:x,fmt:e=>V(e),markers:y})}),(0,F.jsx)(YR,{title:`Latency`,sub:`is it constant or spiky? did it start at a deploy?`,series:b,children:(0,F.jsx)(JR,{data:g,series:b,fmt:e=>B(e),markers:y})})]}),m&&(0,F.jsx)(YR,{title:`Queue wait`,sub:`time from enqueue to start`,series:[{key:`queueWaitP95`,label:`p95`,color:WR[6]},{key:`queueWaitAvg`,label:`Average`,color:WR[0]}],children:(0,F.jsx)(JR,{data:g,height:140,series:[{key:`queueWaitP95`,label:`p95`,color:WR[6],type:`line`},{key:`queueWaitAvg`,label:`Average`,color:WR[0],type:`line`}],fmt:e=>B(e)})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Where the time goes`,sub:`own time per span, averaged per execution`,pad:!1,className:`@5xl:col-span-2`,children:(0,F.jsx)(Ha,{rows:f.breakdown,empty:(0,F.jsx)(Na,{title:`No span detail yet`,children:`Spans are kept for sampled, failed and slow executions.`}),cols:[{key:`n`,label:`Span`,render:e=>{let t=Kz[e.kind]||Kz.function;return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 min-w-0`,children:[(0,F.jsx)(t.Icon,{size:12,style:{color:t.color}}),(0,F.jsx)(`span`,{className:`truncate ${e.kind===`db`?`mono text-[11.5px]`:``}`,children:e.name})]})}},{key:`k`,label:`Kind`,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Kz[e.kind]?.label||e.kind})},{key:`per`,label:`Calls / exec`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.perExec>=10?GR.serious:void 0},children:V(e.perExec)})},{key:`self`,label:`Self / exec`,num:!0,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`inline-block min-w-[52px]`,children:B(e.avgSelf)}),(0,F.jsx)(Ga,{value:e.avgSelf,max:S,color:WR[1],w:60})]})}]})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(H,{title:`Latency distribution`,children:(0,F.jsx)(XR,{data:f.histogram,highlight:e=>h.p95!=null&&e.le>=h.p95})}),(0,F.jsx)(H,{title:m?`Outcomes`:`Status codes`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:C.map(([e,t])=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(La,{status:e===`none`?null:Number(e)}),(0,F.jsx)(`span`,{className:`tabular-nums text-ink2`,children:V(t)})]},e))})})]})]}),f.errors.length>0&&(0,F.jsx)(H,{title:`Errors on this operation`,pad:!1,children:(0,F.jsx)(Ha,{rows:f.errors,onRow:e=>a(i(`/errors/${e.fingerprint}`)),cols:[{key:`c`,label:`Error`,render:e=>(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`font-medium`,style:{color:e.handled?`var(--color-ink)`:`#ff9b9b`},children:e.class}),` `,(0,F.jsx)(`span`,{className:`text-mute`,children:e.message})]})},{key:`h`,label:`Type`,render:e=>e.handled?(0,F.jsx)(G,{kind:`neutral`,children:`handled`}):(0,F.jsx)(G,{kind:`crit`,children:`unhandled`})},{key:`n`,label:`Count`,num:!0,render:e=>V(e.n)}]})}),(0,F.jsx)(H,{pad:!1,title:`Executions`,sub:`${V(f.total)} matching`,right:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Va,{value:c,onChange:e=>{l(e),d(0)},options:[{id:`all`,label:`All`},{id:`failed`,label:`Failed`},{id:`slow`,label:`≥ p95`}]}),(0,F.jsx)(Va,{value:o,onChange:e=>{s(e),d(0)},options:[{id:`recent`,label:`Recent`},{id:`slowest`,label:`Slowest`}]})]}),children:(0,F.jsxs)(`div`,{className:`pt-2`,children:[(0,F.jsx)(Ha,{rows:f.executions,onRow:e=>a(i(`/executions/${e.id}`)),empty:(0,F.jsx)(Na,{title:`No executions match`}),cols:[{key:`ts`,label:`Time`,render:e=>(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Ca(e.ts,r.rangeMs>864e5),(0,F.jsx)(`span`,{className:`text-mute ml-2 text-[11px]`,children:Sa(e.ts)})]})},{key:`st`,label:`Status`,render:e=>(0,F.jsx)(La,{status:e.status})},{key:`d`,label:`Duration`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:h.p95&&e.duration>=h.p95?`#ffb38a`:void 0},children:B(e.duration)})},...m?[{key:`qw`,label:`Queue wait`,num:!0,render:e=>B(e.queue_wait)},{key:`at`,label:`Attempt`,num:!0,render:e=>e.attempt??`—`}]:[],{key:`u`,label:`User`,render:e=>e.user_id?(0,F.jsx)(Nn,{className:`link`,onClick:e=>e.stopPropagation(),to:i(`/users/${Ea(e.user_id)}`),children:e.user_id}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`v`,label:`Release`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2`,children:e.version||`—`})},{key:`err`,label:`Error`,render:e=>e.error_class?(0,F.jsxs)(`span`,{className:`truncate inline-block max-w-[320px] align-middle`,children:[(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:e.error_class}),` `,(0,F.jsx)(`span`,{className:`text-mute`,children:e.error_message})]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})}]}),f.total>50&&(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-3 py-2 border-t border-line text-mute`,children:[(0,F.jsxs)(`span`,{children:[u*50+1,`–`,Math.min(f.total,(u+1)*50),` of `,V(f.total)]}),(0,F.jsx)(`button`,{className:`btn h-7`,disabled:u===0,onClick:()=>d(u-1),children:`Prev`}),(0,F.jsx)(`button`,{className:`btn h-7`,disabled:(u+1)*50>=f.total,onClick:()=>d(u+1),children:`Next`})]})]})})]})}function $z({usual:e,current:t,windowMin:n}){let r=e?.thisHour,i=e?.last4Weeks;if(!r?.basis&&!i)return null;let a=(e,t)=>e==null||!t?null:e>t.high?`above`:e<t.low?`below`:null,o=n<=120&&t.calls>=20,s=o?a(t.p95,r?.p95):null,c=o?a(t.failureRate,r?.failureRate):null;return(0,F.jsxs)(`div`,{className:`card px-4 py-2.5 flex flex-wrap items-center gap-x-6 gap-y-1.5 text-[12.5px]`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Jr,{size:14,className:`text-brand`}),(0,F.jsx)(`b`,{className:`font-medium`,children:`Usual`})]}),r?.basis?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`this hour: p95 `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:B(r.p95?.expected)}),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(normal `,B(r.p95?.low),`–`,B(r.p95?.high),`)`]})]}),(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`failures `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:ba(r.failureRate?.expected??0)})]}),(0,F.jsxs)(`span`,{className:`text-ink2`,children:[(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:V(Math.round(r.callsPerHour?.expected??0))}),` calls/hour`]}),(s||c)&&(0,F.jsx)(G,{kind:`serious`,children:[s&&`p95 ${s} normal`,c&&`failures ${c} normal`].filter(Boolean).join(` · `)})]}):(0,F.jsx)(`span`,{className:`text-mute`,children:r?.description}),i&&(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`last `,Math.round(i.days),` days: p50 `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:B(i.p50)}),` · p95 `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:B(i.p95)}),i.lastWeekVsBeforeP95Pct!=null&&Math.abs(i.lastWeekVsBeforeP95Pct)>=10&&(0,F.jsxs)(`span`,{className:`text-mute`,children:[` · last week p95 `,i.lastWeekVsBeforeP95Pct>0?`+`:``,i.lastWeekVsBeforeP95Pct,`%`]})]}),r?.basis&&(0,F.jsx)(`span`,{className:`text-mute ml-auto text-[11.5px]`,children:r.description})]})}function eB({frames:e,stack:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(!1),o=n?e:e.filter(e=>e.inApp),s=o.length?o:e.slice(0,5);return i&&t?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsx)(`div`,{className:`flex justify-end`,children:(0,F.jsx)(`button`,{className:`btn h-6 text-[11px]`,onClick:()=>a(!1),children:`Frames`})}),(0,F.jsx)(`div`,{className:`code text-[11.5px]`,children:t})]}):(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[11.5px] text-mute cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),` show library frames`]}),t&&(0,F.jsx)(`button`,{className:`btn h-6 text-[11px]`,onClick:()=>a(!0),children:`Raw`})]}),s.map((e,t)=>(0,F.jsx)(tB,{f:e,open:t===0&&!!e.context},t)),!s.length&&(0,F.jsx)(`div`,{className:`text-mute`,children:`No stack frames captured.`})]})}function tB({f:e,open:t}){let[n,r]=(0,v.useState)(t);return(0,F.jsxs)(`div`,{className:`rounded-lg border ${e.inApp?`border-line2`:`border-line opacity-70`} overflow-hidden`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-1.5 text-left bg-[#15151d] hover:bg-[#191922]`,onClick:()=>r(!n),disabled:!e.context,children:[e.context?n?(0,F.jsx)(Er,{size:13}):(0,F.jsx)(Or,{size:13}):(0,F.jsx)(`span`,{className:`w-[13px]`}),(0,F.jsx)(`span`,{className:`mono text-[12px] font-medium`,children:e.fn}),(0,F.jsxs)(`span`,{className:`mono text-[11.5px] text-mute truncate`,children:[e.rel,`:`,e.line,`:`,e.col]}),e.inApp&&(0,F.jsx)(`span`,{className:`pill !text-[10px] !py-0 ml-auto`,children:`in app`})]}),n&&e.context&&(0,F.jsx)(`div`,{className:`mono text-[12px] bg-[#0b0b0f] py-1.5 overflow-x-auto`,children:e.context.lines.map((t,n)=>{let r=e.context.start+n,i=r===e.line;return(0,F.jsxs)(`div`,{className:`flex whitespace-pre`,style:i?{background:`rgba(208,59,59,.16)`,boxShadow:`inset 2px 0 0 #d03b3b`}:void 0,children:[(0,F.jsx)(`span`,{className:`w-12 text-right pr-3 text-mute select-none shrink-0`,children:r}),(0,F.jsx)(`span`,{style:{color:i?`#ffd0d0`:`#c9c9d6`},children:t||` `})]},n)})})]})}var nB={error:GR.crit,fatal:GR.crit,warn:GR.warn,info:`#5aa2f0`,debug:`#82829a`,trace:`#82829a`};function rB({l:e,offset:t,showService:n}){let r=Qn();return(0,F.jsxs)(`div`,{className:`flex gap-3 px-3.5 py-[5px] border-b border-[#1b1b23] hover:bg-[#16161e] text-[12px] items-start`,style:e.level===`error`||e.level===`fatal`?{background:`rgba(208,59,59,.05)`}:void 0,children:[(0,F.jsx)(`span`,{className:`mono text-mute shrink-0 text-[11.5px] tabular-nums`,children:t==null?Ca(e.ts):`+${B(Math.max(0,t))}`}),(0,F.jsx)(`span`,{className:`mono shrink-0 w-[42px] text-[11px] font-semibold uppercase`,style:{color:nB[e.level]||`#aaa`},children:e.level}),n&&(0,F.jsx)(`span`,{className:`text-ink2 shrink-0 w-[92px] truncate`,children:e.service}),e.logger&&(0,F.jsxs)(`span`,{className:`text-mute shrink-0 max-w-[120px] truncate`,children:[`[`,e.logger,`]`]}),(0,F.jsxs)(`span`,{className:`mono text-[12px] flex-1 min-w-0 whitespace-pre-wrap break-words text-[#d8d8e2]`,children:[e.message,e.attrs&&(0,F.jsxs)(`span`,{className:`text-mute`,children:[` `,JSON.stringify(e.attrs)]})]}),e.executionId&&t==null&&(0,F.jsx)(Nn,{to:r(`/executions/${e.executionId}`),className:`link shrink-0 text-[11.5px]`,children:`trace →`})]})}function iB(){let e=I(),[t,n]=zn(),[r,i]=(0,v.useState)(t.get(`q`)||``),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)([]),d=e.q({q:t.get(`q`)||``,level:a.join(`,`),traceId:t.get(`traceId`)||``,limit:300}),{data:f,error:p}=P(`/api/logs${d}`,[e.tick]),m=(0,v.useRef)(0);(0,v.useEffect)(()=>{u([])},[d]),(0,v.useEffect)(()=>{f?.logs?.length&&(m.current=f.logs[0].ts)},[f]),(0,v.useEffect)(()=>{if(!s)return;let n=setInterval(async()=>{let n=await N(`/api/logs?from=${m.current+1||Date.now()-1e4}&to=${Date.now()}&q=${encodeURIComponent(t.get(`q`)||``)}&level=${a.join(`,`)}${e.service?`&service=${e.service}`:``}&limit=200`);n.logs.length&&(m.current=n.logs[0].ts,u(e=>[...n.logs,...e].slice(0,1e3)))},2e3);return()=>clearInterval(n)},[s,a,t,e.service]);let h=[...l,...f?.logs||[]],g=[{key:`error`,label:`Error`,color:GR.crit,type:`bar`,stack:`l`},{key:`warn`,label:`Warn`,color:GR.warn,type:`bar`,stack:`l`},{key:`info`,label:`Info`,color:`#3987e5`,type:`bar`,stack:`l`},{key:`debug`,label:`Debug`,color:`#4a4a5c`,type:`bar`,stack:`l`}],_=e=>o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ti,{size:18,className:`text-brand`}),title:`Logs`,sub:`Every line is tied to the request or job that wrote it.`}),f&&(0,F.jsx)(YR,{title:`Volume by level`,series:g,children:(0,F.jsx)(JR,{data:f.series,series:g,height:120,fmt:e=>V(e)})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault();let i=new URLSearchParams(t);r?i.set(`q`,r):i.delete(`q`),n(i,{replace:!0})},children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[320px] h-7`,placeholder:`Search messages… (Enter)`,value:r,onChange:e=>i(e.target.value)})]}),(0,F.jsx)(`div`,{className:`seg`,children:[`error`,`warn`,`info`,`debug`].map(e=>(0,F.jsxs)(`button`,{type:`button`,className:a.includes(e)?`on`:``,onClick:()=>_(e),children:[(0,F.jsx)(`span`,{style:{color:nB[e]},children:`●`}),` `,e]},e))}),t.get(`traceId`)&&(0,F.jsxs)(`span`,{className:`pill`,children:[`trace `,t.get(`traceId`).slice(0,8),`… `,(0,F.jsx)(`button`,{type:`button`,onClick:()=>{let e=new URLSearchParams(t);e.delete(`traceId`),n(e)},children:`✕`})]})]}),right:(0,F.jsxs)(`button`,{className:`btn h-7 ${s?`btn-primary`:``}`,onClick:()=>c(!s),children:[(0,F.jsx)(yi,{size:13}),s?`Tailing…`:`Live tail`]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:p?(0,F.jsx)(W,{error:p}):f?h.length===0?(0,F.jsx)(Na,{title:`No logs in this window`,children:`Logs are forwarded from console, pino and obzerver.log() (forwardLogs is on by default).`}):(0,F.jsx)(`div`,{className:`max-h-[calc(100vh-380px)] min-h-[300px] overflow-auto`,children:h.map(e=>(0,F.jsx)(rB,{l:e,showService:!0},e.id))}):(0,F.jsx)(U,{})})})]})}function aB(){let{id:e}=yt(),t=Qn(),n=ht(),{data:r,error:i}=P(`/api/executions/${e}`,[e]),[a,o]=(0,v.useState)(!1);if(i)return(0,F.jsx)(W,{error:i});if(!r)return(0,F.jsx)(U,{});let s=r.execution,c=r.baseline,l=r.errors.find(e=>!e.handled)||r.errors[0],u=s.ts,d=Math.min(...r.waterfall.spans.filter(e=>e.executionId===s.id).map(e=>e.start)),f=r.logs.map(e=>({...e,offset:e.ts-u+(Number.isFinite(d)?d:0)})),p=r.host,m=p&&p.baseline&&(p.cpu>p.baseline.cpu*1.5&&p.cpu>40||p.elP99>p.baseline.elP99*2&&p.elP99>50);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsxs)(Nn,{to:t(zz(s.kind,s.service,s.name)),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:[`← `,s.name]}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,children:(0,F.jsx)(za,{name:s.name})}),(0,F.jsx)(La,{status:s.status}),s.failed?(0,F.jsx)(G,{kind:`crit`,children:`failed`}):s.status>=400?(0,F.jsx)(G,{kind:`warn`,children:`client error`}):(0,F.jsx)(G,{kind:`good`,children:`ok`})]}),(0,F.jsxs)(`div`,{className:`text-ink2 mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[12.5px]`,children:[(0,F.jsx)(`span`,{children:Ca(s.ts,!0)}),(0,F.jsx)(`span`,{className:`font-medium text-ink`,children:B(s.duration)}),(0,F.jsxs)(`span`,{children:[s.service,s.version&&(0,F.jsxs)(`span`,{className:`mono text-mute`,children:[`@`,s.version]})]}),s.path&&s.kind===`http`&&(0,F.jsx)(`span`,{className:`mono text-mute`,children:s.graphql?`GraphQL ${s.path}`:`${s.method} ${s.path}`}),s.userId&&(0,F.jsx)(Nn,{className:`link`,to:t(`/users/${Ea(s.userId)}`),children:s.userId}),(0,F.jsxs)(`span`,{className:`mono text-mute text-[11.5px]`,children:[`trace `,s.traceId]})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsx)(Ba,{text:s.traceId,label:`Trace id`}),r.worthInvestigating&&(0,F.jsx)(Ba,{className:`btn btn-primary`,label:`Copy agent prompt`,text:async()=>(await N(`/api/executions/${s.id}/prompt`)).prompt}),r.issue?(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>n(t(`/issues/${r.issue.id}`)),children:[(0,F.jsx)(Vr,{size:13}),`Issue #`,r.issue.id]}):(s.failed||l)&&(0,F.jsxs)(`button`,{className:`btn`,disabled:a,onClick:async()=>{o(!0);try{let e=await N(`/api/issues`,{method:`POST`,json:{title:l?`${l.class}: ${l.message.slice(0,100)}`:`${s.name} ${s.failed?`failed`:`slow`} (${B(s.duration)})`,severity:s.failed?`high`:`medium`,service:s.service,sourceType:l?`error`:`execution`,sourceRef:l?l.fingerprint:String(s.id),description:`From execution #${s.id} (trace ${s.traceId}) at ${new Date(s.ts).toISOString()}.`}});n(t(`/issues/${e.id}`))}finally{o(!1)}},children:[(0,F.jsx)(Fr,{size:13}),`Create issue`]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:s.graphql?`Compared with this operation`:`Compared with this route`,children:c.samples?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsx)(`div`,{className:`text-[15px]`,children:c.slowerThanPct>=50?(0,F.jsxs)(F.Fragment,{children:[`Slower than `,(0,F.jsxs)(`b`,{style:{color:c.slowerThanPct>=95?`#ffb38a`:void 0},children:[c.slowerThanPct,`%`]}),` of calls`]}):(0,F.jsxs)(F.Fragment,{children:[`Faster than `,(0,F.jsxs)(`b`,{children:[100-c.slowerThanPct,`%`]}),` of calls`]})}),(0,F.jsx)(Ka,{items:[[s.graphql?`Operation average`:`Route average`,B(c.avg)],[s.graphql?`Operation p95`:`Route p95`,B(c.p95)],[`Samples`,`${c.samples} in the surrounding 24h`],...r.usual?.p95?[[`Usual at this hour`,(0,F.jsxs)(`span`,{children:[`p95 `,B(r.usual.p95.expected),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(normal up to `,B(r.usual.p95.high),`)`]}),r.usual.vsUsualP95>=2&&(0,F.jsxs)(`b`,{style:{color:`#ffb38a`},children:[` · `,r.usual.vsUsualP95,`× usual`]})]},`u`)]]:[]]}),r.usual&&(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[`Usual = `,r.usual.description,`.`]})]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`Not enough history.`})}),(0,F.jsx)(H,{title:`Host at the time`,right:m?(0,F.jsx)(G,{kind:`serious`,children:`under pressure`}):p?(0,F.jsx)(G,{kind:`good`,children:`normal`}):null,children:p?(0,F.jsx)(Ka,{items:[[`Instance`,(0,F.jsx)(`span`,{className:`mono text-[11.5px]`,children:s.instance})],[`CPU`,(0,F.jsxs)(F.Fragment,{children:[p.cpu?.toFixed(0),`% `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(hour avg `,p.baseline?.cpu?.toFixed(0),`%)`]})]})],[`Event loop p99`,(0,F.jsxs)(F.Fragment,{children:[B(p.elP99),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(avg `,B(p.baseline?.elP99),`)`]})]})],[`Memory`,xa(p.rss)]]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`No runtime sample near this execution.`})}),(0,F.jsx)(H,{title:`Request`,children:(0,F.jsx)(Ka,{items:[[`Kind`,s.kind===`job`?`Job${s.queue?` · queue ${s.queue}`:``}`:s.graphql?`GraphQL ${s.graphql.type} over HTTP`:`HTTP`],...s.kind===`job`?[[`Queue wait`,B(s.queueWait)],[`Attempt`,s.attempt??1]]:[],[`Services in trace`,r.waterfall.services.join(`, `)],[`Spans`,s.sampled?String(r.waterfall.spans.length):`not sampled`],...s.tags?Object.entries(s.tags).map(([e,t])=>[e,String(t)]):[]]})})]}),s.graphql&&(0,F.jsx)(H,{title:`GraphQL operation`,sub:s.graphql.operation?`${s.graphql.type} ${s.graphql.operation}`:`anonymous ${s.graphql.type}`,right:s.graphql.errors?(0,F.jsxs)(G,{kind:`crit`,children:[s.graphql.errors,` resolver error`,s.graphql.errors===1?``:`s`]}):s.graphql.clientErrors?(0,F.jsxs)(G,{kind:`warn`,children:[s.graphql.clientErrors,` client error`,s.graphql.clientErrors===1?``:`s`]}):(0,F.jsx)(G,{kind:`good`,children:`no errors`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(Ka,{items:[[`Type`,s.graphql.type],[`Root fields`,s.graphql.fields.join(`, `)||`—`],[`HTTP status`,String(s.status??`—`)],...s.graphql.batch?[[`Operations in batch`,String(s.graphql.batch)]]:[]]}),s.graphql.errors>0&&s.status!==null&&s.status<400&&(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2`,children:[`The server answered `,s.status,`, but a resolver threw, so this request counts as failed.`]}),s.graphql.document&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Query`}),(0,F.jsx)(`div`,{className:`code text-[11.5px] !whitespace-pre-wrap`,children:sB(s.graphql.document)})]})]})}),l&&(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Vi,{size:14,style:{color:`#ff7070`}}),(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:l.class})]}),sub:l.handled?`handled`:`unhandled`,right:(0,F.jsx)(Nn,{className:`btn h-7`,to:t(`/errors/${l.fingerprint}`),children:`Error group`}),children:[(0,F.jsx)(`div`,{className:`mb-3 text-[13px]`,children:l.message}),(0,F.jsx)(eB,{frames:l.frames,stack:l.stack})]}),(0,F.jsx)(H,{title:`Waterfall`,sub:r.waterfall.services.length>1?`distributed across ${r.waterfall.services.length} services`:void 0,pad:!0,children:s.sampled||r.waterfall.services.length>1?(0,F.jsx)(Xz,{spans:r.waterfall.spans,logs:f}):(0,F.jsx)(Na,{title:`Span detail not kept`,icon:(0,F.jsx)(Wr,{size:20}),children:`This execution was not sampled. Failed, slow and sampled executions keep their full waterfall (tracesSampleRate).`})}),r.waterfall.executions.length>1&&(0,F.jsx)(H,{title:`Executions in this trace`,pad:!1,children:(0,F.jsx)(`div`,{className:`flex flex-col`,children:r.waterfall.executions.map(e=>(0,F.jsxs)(Nn,{to:t(`/executions/${e.id}`),className:`flex items-center gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 hover:bg-[#181821] ${e.id===s.id?`bg-[#16161f]`:``}`,children:[(0,F.jsx)(`span`,{className:`w-28 text-ink2`,children:e.service}),(0,F.jsx)(za,{name:e.name}),(0,F.jsx)(`span`,{className:`ml-auto`,children:(0,F.jsx)(La,{status:e.status})}),(0,F.jsx)(`span`,{className:`w-20 text-right tabular-nums`,children:B(e.duration)})]},e.id))})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Logs`,sub:`${r.logs.length} line${r.logs.length===1?``:`s`} written during this trace`,pad:!1,className:s.capture?`@5xl:col-span-2`:`@5xl:col-span-3`,children:r.logs.length?(0,F.jsx)(`div`,{className:`max-h-[360px] overflow-auto`,children:f.map(e=>(0,F.jsx)(rB,{l:e,offset:e.offset},e.id))}):(0,F.jsx)(Na,{title:`No logs for this trace`,children:`Logs written with console, pino (obzerver.pino()) or obzerver.log() inside the request are correlated automatically.`})}),s.capture&&(0,F.jsx)(H,{title:`Captured request`,sub:`kept because the request was ${s.capture.reason}`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[s.capture.headers&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Request headers`}),(0,F.jsx)(`div`,{className:`code text-[11.5px]`,children:Object.entries(s.capture.headers).map(([e,t])=>`${e}: ${t}`).join(`
|
|
112
|
-
`)})]}),s.capture.query&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Query`}),(0,F.jsx)(`div`,{className:`code text-[11.5px]`,children:s.capture.query})]}),s.capture.body&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Request body`}),(0,F.jsx)(`div`,{className:`code text-[11.5px] !whitespace-pre-wrap`,children:
|
|
111
|
+
`);return(0,F.jsx)(`div`,{className:`code !whitespace-pre-wrap`,children:t.map((e,t)=>{let n=/^(SELECT|FROM|WHERE|AND|OR|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|LEFT JOIN|RIGHT JOIN|INNER JOIN|JOIN|ON|RETURNING|UNION)\b(.*)$/.exec(e),r=n?n[1]:``,i=n?n[2]:e,a=[`AND`,`OR`,`ON`].includes(r)?` `:``;return(0,F.jsxs)(`div`,{children:[a,r&&(0,F.jsx)(`span`,{style:{color:`#ff6b9d`},children:r}),i.split(/(\?)/).map((e,t)=>e===`?`?(0,F.jsx)(`span`,{className:`px-[3px] rounded`,style:{background:`rgba(201,133,0,.25)`,color:`#ffc85a`},children:`?`},t):(0,F.jsx)(v.Fragment,{children:e},t))]},t)})})}function Qz(e){let t=new Map;for(let n of e){let e=n.parentId??null;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let e of t.values())e.sort((e,t)=>e.start-t.start);let n=[],r=(e,i)=>{for(let a of t.get(e)||[])n.push({s:a,depth:i,hasKids:(t.get(a.id)||[]).length>0}),r(a.id,i+1)};return r(null,0),n}function $z({spans:e,logs:t=[],highlightSelf:n=!0}){let r=(0,v.useMemo)(()=>Qz(e),[e]),i=Math.max(1,...e.map(e=>e.start+e.duration)),[a,o]=(0,v.useState)(new Set),[s,c]=(0,v.useState)(null),l=new Set(e.map(e=>e.service).filter(Boolean)).size>1,u=Math.max(...e.filter(e=>!e.root).map(e=>e.self),0),d=new Set,f=r.filter(({s:e})=>e.parentId&&(d.has(e.parentId)||a.has(e.parentId))?(d.add(e.id),!1):!0),p=[0,.25,.5,.75,1],m=[...new Set(e.map(e=>e.kind))].filter(e=>Yz[e]);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[11.5px] text-ink2 mb-2 px-1`,children:[m.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-sm`,style:{background:Yz[e].color}}),Yz[e].label]},e)),(0,F.jsx)(`span`,{className:`ml-auto text-mute`,children:`Bar = total time · bright segment = self time`})]}),(0,F.jsxs)(`div`,{className:`grid text-[12px]`,style:{gridTemplateColumns:`minmax(260px, 38%) 1fr 72px 72px`},children:[(0,F.jsx)(`div`,{className:`text-mute text-[10.5px] uppercase tracking-wider px-2 py-1.5 border-b border-line`,children:`Span`}),(0,F.jsxs)(`div`,{className:`relative border-b border-line`,children:[p.map(e=>(0,F.jsx)(`span`,{className:`absolute top-1.5 text-[10px] text-mute -translate-x-1/2`,style:{left:`${e*100}%`,transform:e===1?`translateX(-100%)`:e===0?`none`:void 0},children:B(i*e)},e)),t.map((e,t)=>(0,F.jsx)(`span`,{title:`${e.level.toUpperCase()} ${e.message}`,className:`absolute bottom-0 w-[2px] h-2 rounded`,style:{left:`${Math.min(100,Math.max(0,(e.offset??0)/i)*100)}%`,background:e.level===`error`?`#d03b3b`:e.level===`warn`?`#fab219`:`#82829a`}},t))]}),(0,F.jsx)(`div`,{className:`text-mute text-[10.5px] uppercase tracking-wider px-2 py-1.5 border-b border-line text-right`,children:`Total`}),(0,F.jsx)(`div`,{className:`text-mute text-[10.5px] uppercase tracking-wider px-2 py-1.5 border-b border-line text-right`,children:`Self`}),f.map(({s:e,depth:t,hasKids:r})=>{let d=Yz[e.kind]||Yz.function,f=e.start/i*100,m=Math.max(.3,e.duration/i*100),h=e.duration?Math.max(0,Math.min(1,e.self/e.duration)):0,g=n&&!e.root&&e.self===u&&u>0,_=s===e.id;return(0,F.jsxs)(v.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-[5px] border-b border-[#1c1c25] cursor-pointer min-w-0 ${_?`bg-[#1a1a24]`:`hover:bg-[#16161e]`}`,style:{paddingLeft:8+t*14},onClick:()=>c(_?null:e.id),children:[r?(0,F.jsx)(`button`,{className:`text-mute hover:text-ink shrink-0`,onClick:t=>{t.stopPropagation();let n=new Set(a);n.has(e.id)?n.delete(e.id):n.add(e.id),o(n)},children:a.has(e.id)?(0,F.jsx)(Or,{size:13}):(0,F.jsx)(Er,{size:13})}):(0,F.jsx)(`span`,{className:`w-[13px] shrink-0`}),(0,F.jsx)(d.Icon,{size:12,style:{color:d.color},className:`shrink-0`}),(0,F.jsx)(`span`,{className:`truncate ${e.kind===`db`?`mono text-[11.5px]`:``}`,title:e.name,children:e.name}),e.count&&e.count>1&&(0,F.jsxs)(`span`,{className:`pill !text-[10px] !py-0`,style:{color:`#ffc85a`,borderColor:`#5a4512`},children:[`×`,e.count]}),l&&e.root&&e.service&&(0,F.jsx)(`span`,{className:`pill !text-[10px] !py-0`,children:e.service}),e.error&&(0,F.jsx)(Vi,{size:12,className:`shrink-0`,style:{color:`#ff7070`}}),g&&(0,F.jsx)(`span`,{className:`pill !text-[10px] !py-0`,style:{color:`#ffb38a`,borderColor:`#5a3322`},children:`most self time`})]}),(0,F.jsxs)(`div`,{className:`relative border-b border-[#1c1c25] cursor-pointer`,onClick:()=>c(_?null:e.id),children:[p.slice(1,-1).map(e=>(0,F.jsx)(`span`,{className:`absolute top-0 bottom-0 w-px bg-[#1c1c26]`,style:{left:`${e*100}%`}},e)),(0,F.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 h-[12px] rounded-[3px] overflow-hidden flex`,style:{left:`${f}%`,width:`${m}%`,background:`color-mix(in srgb, ${d.color} 32%, transparent)`,outline:e.error?`1.5px solid #ff5a5a`:void 0},children:(0,F.jsx)(`div`,{className:`h-full ml-auto`,style:{width:`${h*100}%`,background:d.color}})})]}),(0,F.jsx)(`div`,{className:`num px-2 py-[5px] border-b border-[#1c1c25] tabular-nums`,children:B(e.duration)}),(0,F.jsx)(`div`,{className:`num px-2 py-[5px] border-b border-[#1c1c25] tabular-nums`,style:{color:g?`#ffb38a`:`var(--color-ink2)`},children:B(e.self)}),_&&(0,F.jsx)(`div`,{className:`col-span-4 bg-[#111118] border-b border-line px-4 py-3`,style:{paddingLeft:24+t*14},children:(0,F.jsx)(eB,{s:e})})]},e.id)})]})]})}function eB({s:e}){let t=e.attrs||{},n=Object.entries(t).filter(([e])=>![`statement`,`system`,`url`,`collapsed`,`totalMs`].includes(e));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5 text-[12px]`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 text-ink2`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Kind`}),` `,Yz[e.kind]?.label||e.kind]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Starts at`}),` +`,B(e.start)]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Total`}),` `,B(e.duration)]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Self`}),` `,B(e.self)]}),e.count&&e.count>1&&(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Repeated`}),` `,e.count,`× (collapsed; `,B(t.totalMs),` combined)`]}),t.system&&(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`System`}),` `,t.system]}),e.service&&(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Service`}),` `,e.service]})]}),e.error&&(0,F.jsxs)(`div`,{className:`text-[#ff9b9b] flex items-center gap-1.5`,children:[(0,F.jsx)(Vi,{size:13}),e.error]}),t.statement&&t.system!==`redis`&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`Statement (values removed before sending)`}),(0,F.jsx)(Ba,{text:t.statement,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(Zz,{text:t.statement})]}),t.url&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`URL`}),` `,(0,F.jsxs)(`span`,{className:`mono`,children:[t.method,` `,t.url]}),t.status&&(0,F.jsx)(`span`,{className:`ml-2 mono`,style:{color:t.status>=500?`#ff7070`:`#5fd38a`},children:t.status})]}),n.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,F.jsxs)(`span`,{className:`pill mono !text-[11px]`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:e}),`\xA0`,typeof t==`object`?JSON.stringify(t):String(t)]},e))})]})}function tB(){let{kind:e=`http`,service:t=``,name:n=``}=yt(),r=I(),i=Qn(),a=ht(),[o,s]=(0,v.useState)(`recent`),[c,l]=(0,v.useState)(`all`),[u,d]=(0,v.useState)(0),{data:f,error:p}=P(`/api/operation${r.q({kind:e,name:n,service:t,sort:o,filter:c,limit:50,offset:u*50})}`,[r.tick]),m=e===`job`;if(p)return(0,F.jsx)(W,{error:p});if(!f)return(0,F.jsx)(U,{});let h=f.stats,g=ZR(f.series.points,f.band),_=QR(f.band),y=(r.meta?.versions||[]).filter(e=>e.service===t&&e.first>r.from&&e.first<r.to).map(e=>({t:e.first,label:e.version})),b=[..._?[_.p95]:[],{key:`p95`,label:`p95`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[0],type:`line`},{key:`p50`,label:`Median`,color:WR[2],type:`line`,dashed:!0}],x=[{key:`count`,label:m?`Runs`:`Calls`,color:WR[0],type:`area`},{key:`failed`,label:`Failed`,color:GR.crit,type:`line`},..._?[_.calls]:[]],S=Math.max(1,...f.breakdown.map(e=>e.avgSelf)),C=Object.entries(f.statuses).sort((e,t)=>t[1]-e[1]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsxs)(Nn,{to:i(m?`/jobs`:`/requests`),className:`text-mute hover:text-ink text-[12px] inline-flex items-center gap-1 -mb-2`,children:[(0,F.jsx)(Dr,{size:13}),m?`Jobs`:`Requests`]}),(0,F.jsx)(Ma,{title:(0,F.jsx)(za,{name:n}),sub:(0,F.jsxs)(`span`,{children:[t,` · `,m?`background job`:`HTTP route`]})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-6 gap-3`,children:[(0,F.jsx)(Fa,{label:m?`Runs`:`Calls`,value:V(h.calls),sub:`${V(h.rpm)} per min`,spark:g.map(e=>e.count)}),(0,F.jsx)(Fa,{label:`Failure rate`,value:ba(h.failureRate),sub:`${V(h.failed)} failed`,color:h.failureRate>1?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`Average`,value:B(h.avg)}),(0,F.jsx)(Fa,{label:`p50`,value:B(h.p50)}),(0,F.jsx)(Fa,{label:`p95`,value:B(h.p95),sub:`p99 ${B(h.p99)}`}),(0,F.jsx)(Fa,{label:`Max`,value:B(h.max)})]}),f.fromHistory&&(0,F.jsx)(Gz,{note:f.fromHistory.note}),(0,F.jsx)(nB,{usual:f.usual,current:h,windowMin:(r.to-r.from)/6e4}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:m?`Runs`:`Throughput`,series:x,children:(0,F.jsx)(JR,{data:g,series:x,fmt:e=>V(e),markers:y})}),(0,F.jsx)(YR,{title:`Latency`,sub:`is it constant or spiky? did it start at a deploy?`,series:b,children:(0,F.jsx)(JR,{data:g,series:b,fmt:e=>B(e),markers:y})})]}),m&&(0,F.jsx)(YR,{title:`Queue wait`,sub:`time from enqueue to start`,series:[{key:`queueWaitP95`,label:`p95`,color:WR[6]},{key:`queueWaitAvg`,label:`Average`,color:WR[0]}],children:(0,F.jsx)(JR,{data:g,height:140,series:[{key:`queueWaitP95`,label:`p95`,color:WR[6],type:`line`},{key:`queueWaitAvg`,label:`Average`,color:WR[0],type:`line`}],fmt:e=>B(e)})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Where the time goes`,sub:`own time per span, averaged per execution`,pad:!1,className:`@5xl:col-span-2`,children:(0,F.jsx)(Ha,{rows:f.breakdown,empty:(0,F.jsx)(Na,{title:`No span detail yet`,children:`Spans are kept for sampled, failed and slow executions.`}),cols:[{key:`n`,label:`Span`,render:e=>{let t=Yz[e.kind]||Yz.function;return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 min-w-0`,children:[(0,F.jsx)(t.Icon,{size:12,style:{color:t.color}}),(0,F.jsx)(`span`,{className:`truncate ${e.kind===`db`?`mono text-[11.5px]`:``}`,children:e.name})]})}},{key:`k`,label:`Kind`,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Yz[e.kind]?.label||e.kind})},{key:`per`,label:`Calls / exec`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.perExec>=10?GR.serious:void 0},children:V(e.perExec)})},{key:`self`,label:`Self / exec`,num:!0,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`inline-block min-w-[52px]`,children:B(e.avgSelf)}),(0,F.jsx)(Ga,{value:e.avgSelf,max:S,color:WR[1],w:60})]})}]})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(H,{title:`Latency distribution`,children:(0,F.jsx)(XR,{data:f.histogram,highlight:e=>h.p95!=null&&e.le>=h.p95})}),(0,F.jsx)(H,{title:m?`Outcomes`:`Status codes`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:C.map(([e,t])=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(La,{status:e===`none`?null:Number(e)}),(0,F.jsx)(`span`,{className:`tabular-nums text-ink2`,children:V(t)})]},e))})})]})]}),f.errors.length>0&&(0,F.jsx)(H,{title:`Errors on this operation`,pad:!1,children:(0,F.jsx)(Ha,{rows:f.errors,onRow:e=>a(i(`/errors/${e.fingerprint}`)),cols:[{key:`c`,label:`Error`,render:e=>(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`font-medium`,style:{color:e.handled?`var(--color-ink)`:`#ff9b9b`},children:e.class}),` `,(0,F.jsx)(`span`,{className:`text-mute`,children:e.message})]})},{key:`h`,label:`Type`,render:e=>e.handled?(0,F.jsx)(G,{kind:`neutral`,children:`handled`}):(0,F.jsx)(G,{kind:`crit`,children:`unhandled`})},{key:`n`,label:`Count`,num:!0,render:e=>V(e.n)}]})}),(0,F.jsx)(H,{pad:!1,title:`Executions`,sub:`${V(f.total)} matching`,right:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Va,{value:c,onChange:e=>{l(e),d(0)},options:[{id:`all`,label:`All`},{id:`failed`,label:`Failed`},{id:`slow`,label:`≥ p95`}]}),(0,F.jsx)(Va,{value:o,onChange:e=>{s(e),d(0)},options:[{id:`recent`,label:`Recent`},{id:`slowest`,label:`Slowest`}]})]}),children:(0,F.jsxs)(`div`,{className:`pt-2`,children:[(0,F.jsx)(Ha,{rows:f.executions,onRow:e=>a(i(`/executions/${e.id}`)),empty:(0,F.jsx)(Na,{title:`No executions match`}),cols:[{key:`ts`,label:`Time`,render:e=>(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Ca(e.ts,r.rangeMs>864e5),(0,F.jsx)(`span`,{className:`text-mute ml-2 text-[11px]`,children:Sa(e.ts)})]})},{key:`st`,label:`Status`,render:e=>(0,F.jsx)(La,{status:e.status})},{key:`d`,label:`Duration`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:h.p95&&e.duration>=h.p95?`#ffb38a`:void 0},children:B(e.duration)})},...m?[{key:`qw`,label:`Queue wait`,num:!0,render:e=>B(e.queue_wait)},{key:`at`,label:`Attempt`,num:!0,render:e=>e.attempt??`—`}]:[],{key:`u`,label:`User`,render:e=>e.user_id?(0,F.jsx)(Nn,{className:`link`,onClick:e=>e.stopPropagation(),to:i(`/users/${Ea(e.user_id)}`),children:e.user_id}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`v`,label:`Release`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2`,children:e.version||`—`})},{key:`err`,label:`Error`,render:e=>e.error_class?(0,F.jsxs)(`span`,{className:`truncate inline-block max-w-[320px] align-middle`,children:[(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:e.error_class}),` `,(0,F.jsx)(`span`,{className:`text-mute`,children:e.error_message})]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})}]}),f.total>50&&(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-3 py-2 border-t border-line text-mute`,children:[(0,F.jsxs)(`span`,{children:[u*50+1,`–`,Math.min(f.total,(u+1)*50),` of `,V(f.total)]}),(0,F.jsx)(`button`,{className:`btn h-7`,disabled:u===0,onClick:()=>d(u-1),children:`Prev`}),(0,F.jsx)(`button`,{className:`btn h-7`,disabled:(u+1)*50>=f.total,onClick:()=>d(u+1),children:`Next`})]})]})})]})}function nB({usual:e,current:t,windowMin:n}){let r=e?.thisHour,i=e?.last4Weeks;if(!r?.basis&&!i)return null;let a=(e,t)=>e==null||!t?null:e>t.high?`above`:e<t.low?`below`:null,o=n<=120&&t.calls>=20,s=o?a(t.p95,r?.p95):null,c=o?a(t.failureRate,r?.failureRate):null;return(0,F.jsxs)(`div`,{className:`card px-4 py-2.5 flex flex-wrap items-center gap-x-6 gap-y-1.5 text-[12.5px]`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Jr,{size:14,className:`text-brand`}),(0,F.jsx)(`b`,{className:`font-medium`,children:`Usual`})]}),r?.basis?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`this hour: p95 `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:B(r.p95?.expected)}),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(normal `,B(r.p95?.low),`–`,B(r.p95?.high),`)`]})]}),(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`failures `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:ba(r.failureRate?.expected??0)})]}),(0,F.jsxs)(`span`,{className:`text-ink2`,children:[(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:V(Math.round(r.callsPerHour?.expected??0))}),` calls/hour`]}),(s||c)&&(0,F.jsx)(G,{kind:`serious`,children:[s&&`p95 ${s} normal`,c&&`failures ${c} normal`].filter(Boolean).join(` · `)})]}):(0,F.jsx)(`span`,{className:`text-mute`,children:r?.description}),i&&(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`last `,Math.round(i.days),` days: p50 `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:B(i.p50)}),` · p95 `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:B(i.p95)}),i.lastWeekVsBeforeP95Pct!=null&&Math.abs(i.lastWeekVsBeforeP95Pct)>=10&&(0,F.jsxs)(`span`,{className:`text-mute`,children:[` · last week p95 `,i.lastWeekVsBeforeP95Pct>0?`+`:``,i.lastWeekVsBeforeP95Pct,`%`]})]}),r?.basis&&(0,F.jsx)(`span`,{className:`text-mute ml-auto text-[11.5px]`,children:r.description})]})}function rB({frames:e,stack:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(!1),o=n?e:e.filter(e=>e.inApp),s=o.length?o:e.slice(0,5);return i&&t?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsx)(`div`,{className:`flex justify-end`,children:(0,F.jsx)(`button`,{className:`btn h-6 text-[11px]`,onClick:()=>a(!1),children:`Frames`})}),(0,F.jsx)(`div`,{className:`code text-[11.5px]`,children:t})]}):(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,F.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[11.5px] text-mute cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),` show library frames`]}),t&&(0,F.jsx)(`button`,{className:`btn h-6 text-[11px]`,onClick:()=>a(!0),children:`Raw`})]}),s.map((e,t)=>(0,F.jsx)(iB,{f:e,open:t===0&&!!e.context},t)),!s.length&&(0,F.jsx)(`div`,{className:`text-mute`,children:`No stack frames captured.`})]})}function iB({f:e,open:t}){let[n,r]=(0,v.useState)(t);return(0,F.jsxs)(`div`,{className:`rounded-lg border ${e.inApp?`border-line2`:`border-line opacity-70`} overflow-hidden`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-1.5 text-left bg-[#15151d] hover:bg-[#191922]`,onClick:()=>r(!n),disabled:!e.context,children:[e.context?n?(0,F.jsx)(Er,{size:13}):(0,F.jsx)(Or,{size:13}):(0,F.jsx)(`span`,{className:`w-[13px]`}),(0,F.jsx)(`span`,{className:`mono text-[12px] font-medium`,children:e.fn}),(0,F.jsxs)(`span`,{className:`mono text-[11.5px] text-mute truncate`,children:[e.rel,`:`,e.line,`:`,e.col]}),e.inApp&&(0,F.jsx)(`span`,{className:`pill !text-[10px] !py-0 ml-auto`,children:`in app`})]}),n&&e.context&&(0,F.jsx)(`div`,{className:`mono text-[12px] bg-[#0b0b0f] py-1.5 overflow-x-auto`,children:e.context.lines.map((t,n)=>{let r=e.context.start+n,i=r===e.line;return(0,F.jsxs)(`div`,{className:`flex whitespace-pre`,style:i?{background:`rgba(208,59,59,.16)`,boxShadow:`inset 2px 0 0 #d03b3b`}:void 0,children:[(0,F.jsx)(`span`,{className:`w-12 text-right pr-3 text-mute select-none shrink-0`,children:r}),(0,F.jsx)(`span`,{style:{color:i?`#ffd0d0`:`#c9c9d6`},children:t||` `})]},n)})})]})}var aB={error:GR.crit,fatal:GR.crit,warn:GR.warn,info:`#5aa2f0`,debug:`#82829a`,trace:`#82829a`};function oB({l:e,offset:t,showService:n}){let r=Qn();return(0,F.jsxs)(`div`,{className:`flex gap-3 px-3.5 py-[5px] border-b border-[#1b1b23] hover:bg-[#16161e] text-[12px] items-start`,style:e.level===`error`||e.level===`fatal`?{background:`rgba(208,59,59,.05)`}:void 0,children:[(0,F.jsx)(`span`,{className:`mono text-mute shrink-0 text-[11.5px] tabular-nums`,children:t==null?Ca(e.ts):`+${B(Math.max(0,t))}`}),(0,F.jsx)(`span`,{className:`mono shrink-0 w-[42px] text-[11px] font-semibold uppercase`,style:{color:aB[e.level]||`#aaa`},children:e.level}),n&&(0,F.jsx)(`span`,{className:`text-ink2 shrink-0 w-[92px] truncate`,children:e.service}),e.logger&&(0,F.jsxs)(`span`,{className:`text-mute shrink-0 max-w-[120px] truncate`,children:[`[`,e.logger,`]`]}),(0,F.jsxs)(`span`,{className:`mono text-[12px] flex-1 min-w-0 whitespace-pre-wrap break-words text-[#d8d8e2]`,children:[e.message,e.attrs&&(0,F.jsxs)(`span`,{className:`text-mute`,children:[` `,JSON.stringify(e.attrs)]})]}),e.executionId&&t==null&&(0,F.jsx)(Nn,{to:r(`/executions/${e.executionId}`),className:`link shrink-0 text-[11.5px]`,children:`trace →`})]})}function sB(){let e=I(),[t,n]=zn(),[r,i]=(0,v.useState)(t.get(`q`)||``),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)([]),d=e.q({q:t.get(`q`)||``,level:a.join(`,`),traceId:t.get(`traceId`)||``,limit:300}),{data:f,error:p}=P(`/api/logs${d}`,[e.tick]),m=(0,v.useRef)(0);(0,v.useEffect)(()=>{u([])},[d]),(0,v.useEffect)(()=>{f?.logs?.length&&(m.current=f.logs[0].ts)},[f]),(0,v.useEffect)(()=>{if(!s)return;let n=setInterval(async()=>{let n=await N(`/api/logs?from=${m.current+1||Date.now()-1e4}&to=${Date.now()}&q=${encodeURIComponent(t.get(`q`)||``)}&level=${a.join(`,`)}${e.service?`&service=${e.service}`:``}&limit=200`);n.logs.length&&(m.current=n.logs[0].ts,u(e=>[...n.logs,...e].slice(0,1e3)))},2e3);return()=>clearInterval(n)},[s,a,t,e.service]);let h=[...l,...f?.logs||[]],g=[{key:`error`,label:`Error`,color:GR.crit,type:`bar`,stack:`l`},{key:`warn`,label:`Warn`,color:GR.warn,type:`bar`,stack:`l`},{key:`info`,label:`Info`,color:`#3987e5`,type:`bar`,stack:`l`},{key:`debug`,label:`Debug`,color:`#4a4a5c`,type:`bar`,stack:`l`}],_=e=>o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ti,{size:18,className:`text-brand`}),title:`Logs`,sub:`Every line is tied to the request or job that wrote it.`}),f&&(0,F.jsx)(YR,{title:`Volume by level`,series:g,children:(0,F.jsx)(JR,{data:f.series,series:g,height:120,fmt:e=>V(e)})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault();let i=new URLSearchParams(t);r?i.set(`q`,r):i.delete(`q`),n(i,{replace:!0})},children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[320px] h-7`,placeholder:`Search messages… (Enter)`,value:r,onChange:e=>i(e.target.value)})]}),(0,F.jsx)(`div`,{className:`seg`,children:[`error`,`warn`,`info`,`debug`].map(e=>(0,F.jsxs)(`button`,{type:`button`,className:a.includes(e)?`on`:``,onClick:()=>_(e),children:[(0,F.jsx)(`span`,{style:{color:aB[e]},children:`●`}),` `,e]},e))}),t.get(`traceId`)&&(0,F.jsxs)(`span`,{className:`pill`,children:[`trace `,t.get(`traceId`).slice(0,8),`… `,(0,F.jsx)(`button`,{type:`button`,onClick:()=>{let e=new URLSearchParams(t);e.delete(`traceId`),n(e)},children:`✕`})]})]}),right:(0,F.jsxs)(`button`,{className:`btn h-7 ${s?`btn-primary`:``}`,onClick:()=>c(!s),children:[(0,F.jsx)(yi,{size:13}),s?`Tailing…`:`Live tail`]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:p?(0,F.jsx)(W,{error:p}):f?h.length===0?(0,F.jsx)(Na,{title:`No logs in this window`,children:`Logs are forwarded from console, pino and obzerver.log() (forwardLogs is on by default).`}):(0,F.jsx)(`div`,{className:`max-h-[calc(100vh-380px)] min-h-[300px] overflow-auto`,children:h.map(e=>(0,F.jsx)(oB,{l:e,showService:!0},e.id))}):(0,F.jsx)(U,{})})})]})}function cB(){let{id:e}=yt(),t=Qn(),n=ht(),{data:r,error:i}=P(`/api/executions/${e}`,[e]),[a,o]=(0,v.useState)(!1);if(i)return(0,F.jsx)(W,{error:i});if(!r)return(0,F.jsx)(U,{});let s=r.execution,c=r.baseline,l=r.errors.find(e=>!e.handled)||r.errors[0],u=s.ts,d=Math.min(...r.waterfall.spans.filter(e=>e.executionId===s.id).map(e=>e.start)),f=r.logs.map(e=>({...e,offset:e.ts-u+(Number.isFinite(d)?d:0)})),p=r.host,m=p&&p.baseline&&(p.cpu>p.baseline.cpu*1.5&&p.cpu>40||p.elP99>p.baseline.elP99*2&&p.elP99>50);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsxs)(Nn,{to:t(Vz(s.kind,s.service,s.name)),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:[`← `,s.name]}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,children:(0,F.jsx)(za,{name:s.name})}),(0,F.jsx)(La,{status:s.status}),s.failed?(0,F.jsx)(G,{kind:`crit`,children:`failed`}):s.status>=400?(0,F.jsx)(G,{kind:`warn`,children:`client error`}):(0,F.jsx)(G,{kind:`good`,children:`ok`})]}),(0,F.jsxs)(`div`,{className:`text-ink2 mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[12.5px]`,children:[(0,F.jsx)(`span`,{children:Ca(s.ts,!0)}),(0,F.jsx)(`span`,{className:`font-medium text-ink`,children:B(s.duration)}),(0,F.jsxs)(`span`,{children:[s.service,s.version&&(0,F.jsxs)(`span`,{className:`mono text-mute`,children:[`@`,s.version]})]}),s.path&&s.kind===`http`&&(0,F.jsx)(`span`,{className:`mono text-mute`,children:s.graphql?`GraphQL ${s.path}`:`${s.method} ${s.path}`}),s.userId&&(0,F.jsx)(Nn,{className:`link`,to:t(`/users/${Ea(s.userId)}`),children:s.userId}),(0,F.jsxs)(`span`,{className:`mono text-mute text-[11.5px]`,children:[`trace `,s.traceId]})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsx)(Ba,{text:s.traceId,label:`Trace id`}),r.worthInvestigating&&(0,F.jsx)(Ba,{className:`btn btn-primary`,label:`Copy agent prompt`,text:async()=>(await N(`/api/executions/${s.id}/prompt`)).prompt}),r.issue?(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>n(t(`/issues/${r.issue.id}`)),children:[(0,F.jsx)(Vr,{size:13}),`Issue #`,r.issue.id]}):(s.failed||l)&&(0,F.jsxs)(`button`,{className:`btn`,disabled:a,onClick:async()=>{o(!0);try{let e=await N(`/api/issues`,{method:`POST`,json:{title:l?`${l.class}: ${l.message.slice(0,100)}`:`${s.name} ${s.failed?`failed`:`slow`} (${B(s.duration)})`,severity:s.failed?`high`:`medium`,service:s.service,sourceType:l?`error`:`execution`,sourceRef:l?l.fingerprint:String(s.id),description:`From execution #${s.id} (trace ${s.traceId}) at ${new Date(s.ts).toISOString()}.`}});n(t(`/issues/${e.id}`))}finally{o(!1)}},children:[(0,F.jsx)(Fr,{size:13}),`Create issue`]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:s.graphql?`Compared with this operation`:`Compared with this route`,children:c.samples?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,F.jsx)(`div`,{className:`text-[15px]`,children:c.slowerThanPct>=50?(0,F.jsxs)(F.Fragment,{children:[`Slower than `,(0,F.jsxs)(`b`,{style:{color:c.slowerThanPct>=95?`#ffb38a`:void 0},children:[c.slowerThanPct,`%`]}),` of calls`]}):(0,F.jsxs)(F.Fragment,{children:[`Faster than `,(0,F.jsxs)(`b`,{children:[100-c.slowerThanPct,`%`]}),` of calls`]})}),(0,F.jsx)(Ka,{items:[[s.graphql?`Operation average`:`Route average`,B(c.avg)],[s.graphql?`Operation p95`:`Route p95`,B(c.p95)],[`Samples`,`${c.samples} in the surrounding 24h`],...r.usual?.p95?[[`Usual at this hour`,(0,F.jsxs)(`span`,{children:[`p95 `,B(r.usual.p95.expected),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(normal up to `,B(r.usual.p95.high),`)`]}),r.usual.vsUsualP95>=2&&(0,F.jsxs)(`b`,{style:{color:`#ffb38a`},children:[` · `,r.usual.vsUsualP95,`× usual`]})]},`u`)]]:[]]}),r.usual&&(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[`Usual = `,r.usual.description,`.`]})]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`Not enough history.`})}),(0,F.jsx)(H,{title:`Host at the time`,right:m?(0,F.jsx)(G,{kind:`serious`,children:`under pressure`}):p?(0,F.jsx)(G,{kind:`good`,children:`normal`}):null,children:p?(0,F.jsx)(Ka,{items:[[`Instance`,(0,F.jsx)(`span`,{className:`mono text-[11.5px]`,children:s.instance})],[`CPU`,(0,F.jsxs)(F.Fragment,{children:[p.cpu?.toFixed(0),`% `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(hour avg `,p.baseline?.cpu?.toFixed(0),`%)`]})]})],[`Event loop p99`,(0,F.jsxs)(F.Fragment,{children:[B(p.elP99),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(avg `,B(p.baseline?.elP99),`)`]})]})],[`Memory`,xa(p.rss)]]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`No runtime sample near this execution.`})}),(0,F.jsx)(H,{title:`Request`,children:(0,F.jsx)(Ka,{items:[[`Kind`,s.kind===`job`?`Job${s.queue?` · queue ${s.queue}`:``}`:s.graphql?`GraphQL ${s.graphql.type} over HTTP`:`HTTP`],...s.kind===`job`?[[`Queue wait`,B(s.queueWait)],[`Attempt`,s.attempt??1]]:[],[`Services in trace`,r.waterfall.services.join(`, `)],[`Spans`,s.sampled?String(r.waterfall.spans.length):`not sampled`],...s.tags?Object.entries(s.tags).map(([e,t])=>[e,String(t)]):[]]})})]}),s.graphql&&(0,F.jsx)(H,{title:`GraphQL operation`,sub:s.graphql.operation?`${s.graphql.type} ${s.graphql.operation}`:`anonymous ${s.graphql.type}`,right:s.graphql.errors?(0,F.jsxs)(G,{kind:`crit`,children:[s.graphql.errors,` resolver error`,s.graphql.errors===1?``:`s`]}):s.graphql.clientErrors?(0,F.jsxs)(G,{kind:`warn`,children:[s.graphql.clientErrors,` client error`,s.graphql.clientErrors===1?``:`s`]}):(0,F.jsx)(G,{kind:`good`,children:`no errors`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(Ka,{items:[[`Type`,s.graphql.type],[`Root fields`,s.graphql.fields.join(`, `)||`—`],[`HTTP status`,String(s.status??`—`)],...s.graphql.batch?[[`Operations in batch`,String(s.graphql.batch)]]:[]]}),s.graphql.errors>0&&s.status!==null&&s.status<400&&(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2`,children:[`The server answered `,s.status,`, but a resolver threw, so this request counts as failed.`]}),s.graphql.document&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Query`}),(0,F.jsx)(`div`,{className:`code text-[11.5px] !whitespace-pre-wrap`,children:uB(s.graphql.document)})]})]})}),l&&(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Vi,{size:14,style:{color:`#ff7070`}}),(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:l.class})]}),sub:l.handled?`handled`:`unhandled`,right:(0,F.jsx)(Nn,{className:`btn h-7`,to:t(`/errors/${l.fingerprint}`),children:`Error group`}),children:[(0,F.jsx)(`div`,{className:`mb-3 text-[13px]`,children:l.message}),(0,F.jsx)(rB,{frames:l.frames,stack:l.stack})]}),(0,F.jsx)(H,{title:`Waterfall`,sub:r.waterfall.services.length>1?`distributed across ${r.waterfall.services.length} services`:void 0,pad:!0,children:s.sampled||r.waterfall.services.length>1?(0,F.jsx)($z,{spans:r.waterfall.spans,logs:f}):(0,F.jsx)(Na,{title:`Span detail not kept`,icon:(0,F.jsx)(Wr,{size:20}),children:`This execution was not sampled. Failed, slow and sampled executions keep their full waterfall (tracesSampleRate).`})}),r.waterfall.executions.length>1&&(0,F.jsx)(H,{title:`Executions in this trace`,pad:!1,children:(0,F.jsx)(`div`,{className:`flex flex-col`,children:r.waterfall.executions.map(e=>(0,F.jsxs)(Nn,{to:t(`/executions/${e.id}`),className:`flex items-center gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 hover:bg-[#181821] ${e.id===s.id?`bg-[#16161f]`:``}`,children:[(0,F.jsx)(`span`,{className:`w-28 text-ink2`,children:e.service}),(0,F.jsx)(za,{name:e.name}),(0,F.jsx)(`span`,{className:`ml-auto`,children:(0,F.jsx)(La,{status:e.status})}),(0,F.jsx)(`span`,{className:`w-20 text-right tabular-nums`,children:B(e.duration)})]},e.id))})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Logs`,sub:`${r.logs.length} line${r.logs.length===1?``:`s`} written during this trace`,pad:!1,className:s.capture?`@5xl:col-span-2`:`@5xl:col-span-3`,children:r.logs.length?(0,F.jsx)(`div`,{className:`max-h-[360px] overflow-auto`,children:f.map(e=>(0,F.jsx)(oB,{l:e,offset:e.offset},e.id))}):(0,F.jsx)(Na,{title:`No logs for this trace`,children:`Logs written with console, pino (obzerver.pino()) or obzerver.log() inside the request are correlated automatically.`})}),s.capture&&(0,F.jsx)(H,{title:`Captured request`,sub:`kept because the request was ${s.capture.reason}`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[s.capture.headers&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Request headers`}),(0,F.jsx)(`div`,{className:`code text-[11.5px]`,children:Object.entries(s.capture.headers).map(([e,t])=>`${e}: ${t}`).join(`
|
|
112
|
+
`)})]}),s.capture.query&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Query`}),(0,F.jsx)(`div`,{className:`code text-[11.5px]`,children:s.capture.query})]}),s.capture.body&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Request body`}),(0,F.jsx)(`div`,{className:`code text-[11.5px] !whitespace-pre-wrap`,children:lB(s.capture.body)})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11px] flex items-center gap-1`,children:[(0,F.jsx)(_r,{size:11}),`Redacted inside your process before sending.`]})]})})]})]})}function lB(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function uB(e){let t=``,n=0,r=0,i=()=>{t=t.trimEnd()+`
|
|
113
113
|
`+` `.repeat(n)};for(let a=0;a<e.length;a++){let o=e[a];if(o===`(`&&r++,o===`)`&&(r=Math.max(0,r-1)),r)t+=o;else if(o===`{`)n++,t=t.trimEnd()+` {`,i();else if(o===`}`)n=Math.max(0,n-1),i(),t+=`}`;else if(/\s/.test(o)){let r=e.slice(a+1).trimStart()[0];!n&&t.endsWith(`}`)?t+=`
|
|
114
114
|
|
|
115
115
|
`:n&&r&&r!==`{`&&r!==`}`&&r!==`(`&&r!==`:`&&!/[:,]$/.test(t.trimEnd())?i():!/\s$/.test(t)&&r!==`{`&&(t+=` `)}else t+=o}return t.replace(/[ \t]+\n/g,`
|
|
116
|
-
`).trim()}function cB(){let e=I(),t=Qn(),n=ht(),[r,i]=zn(),[a,o]=(0,v.useState)(r.get(`q`)||``),[s,c]=(0,v.useState)(`all`),{data:l,error:u}=P(`/api/traces${e.q({q:r.get(`q`)||``,failed:s===`failed`?`1`:``,minDuration:s===`slow`?1e3:``,limit:200})}`,[e.tick,s]),d=(l||[]).filter(e=>s!==`distributed`||e.parts>1);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Gr,{size:18,className:`text-brand`}),title:`Traces`,sub:`Recent requests and jobs. Distributed traces follow the traceparent header across services.`}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=new URLSearchParams(r);a?t.set(`q`,a):t.delete(`q`),i(t,{replace:!0})},children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[360px] h-7`,placeholder:`Trace id, route, path, user id or error text`,value:a,onChange:e=>o(e.target.value)})]}),(0,F.jsx)(Va,{value:s,onChange:c,options:[{id:`all`,label:`All`},{id:`failed`,label:`Failed`},{id:`slow`,label:`> 1s`},{id:`distributed`,label:`Multi-service`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:u?(0,F.jsx)(W,{error:u}):l?(0,F.jsx)(Ha,{rows:d,onRow:e=>n(t(`/executions/${e.id}`)),empty:(0,F.jsx)(Na,{title:`No traces match`}),cols:[{key:`t`,label:`Time`,render:e=>(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Ca(e.ts),` `,(0,F.jsx)(`span`,{className:`text-mute text-[11px] ml-1`,children:Sa(e.ts)})]})},{key:`n`,label:`Operation`,render:e=>(0,F.jsx)(za,{name:e.name})},{key:`s`,label:`Application`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},{key:`p`,label:`Apps`,num:!0,render:e=>e.parts>1?(0,F.jsx)(`span`,{className:`pill`,style:{color:`#9cc4ff`},children:e.parts}):(0,F.jsx)(`span`,{className:`text-mute`,children:`1`})},{key:`st`,label:`Status`,render:e=>(0,F.jsx)(La,{status:e.status})},{key:`d`,label:`Duration`,num:!0,render:e=>B(e.duration)},{key:`u`,label:`User`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.user_id||`—`})},{key:`id`,label:`Trace id`,render:e=>(0,F.jsxs)(`span`,{className:`mono text-mute text-[11px]`,children:[e.trace_id.slice(0,16),`…`]})}]}):(0,F.jsx)(U,{})})})]})}function lB(){let e=I(),t=Qn(),n=ht(),[r,i]=(0,v.useState)(`0`),[a,o]=(0,v.useState)(``),{data:s,error:c}=P(`/api/errors${e.q({handled:r,status:a})}`,[e.tick]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(xr,{size:18,className:`text-brand`}),title:`Errors`,sub:`Grouped into defects by class and stack shape. Unhandled = 5xx or a thrown job/process error; a 4xx from your own code is your API working.`}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`0`,label:`Unhandled`},{id:`1`,label:`Handled`},{id:`all`,label:`All`}]}),(0,F.jsx)(Va,{value:a,onChange:o,options:[{id:``,label:`Any status`},{id:`open`,label:`Open`},{id:`resolved`,label:`Resolved`},{id:`ignored`,label:`Ignored`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:c?(0,F.jsx)(W,{error:c}):s?(0,F.jsx)(Ha,{rows:s,initialSort:`count`,onRow:e=>n(t(`/errors/${e.fingerprint}`)),rowKey:e=>e.fingerprint,empty:(0,F.jsx)(Na,{title:`No errors in this window`,icon:(0,F.jsx)(`span`,{className:`text-[18px]`,children:`✓`}),children:`Nothing matched these filters.`}),cols:[{key:`e`,label:`Error`,sort:e=>e.class,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0 max-w-[560px]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,style:{color:e.handled?`var(--color-ink)`:`#ff9b9b`},children:e.class}),e.isNew&&(0,F.jsx)(G,{kind:`serious`,children:`new`}),e.status!==`open`&&(0,F.jsx)(G,{kind:e.status===`resolved`?`good`:`neutral`,children:e.status})]}),(0,F.jsx)(`div`,{className:`text-mute truncate text-[12px]`,children:e.message})]})},{key:`op`,label:`Where`,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`truncate max-w-[220px]`,children:e.operation?(0,F.jsx)(za,{name:e.operation}):`—`}),(0,F.jsx)(`div`,{className:`text-mute text-[11px]`,children:e.service})]})},{key:`trend`,label:`Trend`,render:e=>(0,F.jsx)(Ia,{data:e.spark,color:e.handled?`#82829a`:GR.crit,w:80,h:20})},{key:`count`,label:`Events`,num:!0,sort:e=>e.count,render:e=>V(e.count)},{key:`users`,label:`Users`,num:!0,sort:e=>e.users,render:e=>V(e.users)},{key:`rel`,label:`Introduced`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2`,children:e.firstVersion||`—`})},{key:`first`,label:`First seen`,num:!0,sort:e=>e.firstSeen,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.firstSeen)})},{key:`last`,label:`Last seen`,num:!0,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:Sa(e.lastSeen)})}]}):(0,F.jsx)(U,{})})})]})}var uB=e=>new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1,timeZoneName:`short`});function dB(){let e=I(),t=Qn(),n=ht(),[r,i]=zn(),[a,o]=(0,v.useState)(`open`),{data:s,error:c,reload:l}=P(`/api/secrets${e.q({status:a})}`,[e.tick,a]),u=r.get(`fp`),d=P(u?`/api/secrets/${u}`:null,[u,e.tick]),f=e=>i(t=>{let n=new URLSearchParams(t);return e?n.set(`fp`,e):n.delete(`fp`),n},{replace:!0}),p=async(e,t)=>{await N(`/api/secrets/${e}`,{method:`POST`,json:{status:t}}),l(),d.reload()};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ai,{size:18,style:{color:`#ff6b6b`}}),title:`Secrets in logs`,sub:`Passwords, tokens, API keys, private keys and card numbers that reached a log line or an error message. They are redacted before storage (the value is never kept); each row is a place in your code that logs one.`}),s&&s.open>0&&(0,F.jsxs)(`div`,{className:`rounded-xl border px-4 py-3 flex items-start gap-3`,style:{borderColor:`#6b2330`,background:`rgba(208,59,59,.10)`},children:[(0,F.jsx)(Ai,{size:18,className:`shrink-0 mt-0.5`,style:{color:`#ff6b6b`}}),(0,F.jsxs)(`div`,{className:`text-[13px] leading-relaxed`,children:[(0,F.jsxs)(`b`,{style:{color:`#ffb0b0`},children:[s.open,` place`,s.open===1?``:`s`,` in your code log`,s.open===1?`s`:``,` secrets.`]}),` `,(0,F.jsx)(`span`,{className:`text-ink2`,children:`Fix the log line, then mark it resolved. If a secret may have been exposed before it was redacted (other log sinks, stdout, a log shipper), rotate it.`})]})]}),u&&(0,F.jsx)(H,{title:d.data?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{style:{color:`#ff9b9b`},children:d.data.label}),(0,F.jsxs)(`span`,{className:`text-mute font-normal`,children:[`in `,d.data.source===`error`?`an error message`:`logs`]})]}):`Leak`,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6`,onClick:()=>f(null),children:`Close`}),children:d.error?(0,F.jsx)(W,{error:d.error}):d.data?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-4 gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Where`}),(0,F.jsx)(`div`,{className:`font-medium`,children:d.data.service}),(0,F.jsx)(`div`,{className:`text-ink2`,children:d.data.operation?(0,F.jsx)(za,{name:d.data.operation}):`outside a request or job`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Logger`}),(0,F.jsx)(`div`,{className:`font-medium mono`,children:d.data.logger||`—`}),(0,F.jsx)(`div`,{className:`text-mute`,children:d.data.detectedBy===`sdk`?`Redacted by the SDK, in the process`:`Redacted by the server, before storage`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Seen`}),(0,F.jsxs)(`div`,{className:`font-medium`,children:[V(d.data.count),` times`]}),(0,F.jsxs)(`div`,{className:`text-ink2`,children:[`first `,(0,F.jsx)(Xa,{tip:uB(d.data.firstSeen),children:Sa(d.data.firstSeen)}),d.data.firstVersion?` in ${d.data.firstVersion}`:``,` · last `,(0,F.jsx)(Xa,{tip:uB(d.data.lastSeen),children:Sa(d.data.lastSeen)})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Status`}),(0,F.jsxs)(`div`,{className:`flex gap-1.5`,children:[d.data.status!==`resolved`&&(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>p(d.data.fingerprint,`resolved`),children:[(0,F.jsx)(ji,{size:13}),`Mark fixed`]}),d.data.status===`open`&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>p(d.data.fingerprint,`ignored`),children:`Ignore`}),d.data.status!==`open`&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>p(d.data.fingerprint,`open`),children:`Reopen`}),d.data.issueId&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>n(t(`/issues/${d.data.issueId}`)),children:[(0,F.jsx)(Vr,{size:12}),`Issue #`,d.data.issueId]})]})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute mb-1`,children:`Example, as stored`}),(0,F.jsx)(`pre`,{className:`mono text-[12px] whitespace-pre-wrap break-all rounded-md border border-line px-3 py-2`,style:{background:`#101016`},children:fB(d.data.sample||``)})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute mb-1`,children:`Recent occurrences`}),(0,F.jsx)(Ha,{rows:d.data.findings,rowKey:e=>`${e.ts}${e.traceId}`,onRow:e=>e.traceId&&n(t(`/traces/${e.traceId}`)),cols:[{key:`t`,label:`Time`,render:e=>(0,F.jsx)(Xa,{tip:uB(e.ts),children:Ca(e.ts,!0)})},{key:`v`,label:`Version`,render:e=>(0,F.jsx)(`span`,{className:`mono`,children:e.version||`—`})},{key:`i`,label:`Instance`,render:e=>(0,F.jsx)(`span`,{className:`mono text-ink2`,children:e.instance||`—`})},{key:`c`,label:`Count`,num:!0,render:e=>V(e.count)},{key:`s`,label:`Text (redacted)`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2 truncate inline-block max-w-[520px] align-bottom`,children:fB(e.sample||``)})},{key:`tr`,label:`Trace`,render:e=>e.traceId?(0,F.jsxs)(`span`,{className:`mono text-[11.5px]`,style:{color:`#ff9cc0`},children:[e.traceId.slice(0,8),`…`]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})}]})]})]}):(0,F.jsx)(U,{})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsx)(Va,{value:a,onChange:o,options:[{id:`open`,label:`To fix`},{id:`resolved`,label:`Fixed`},{id:`ignored`,label:`Ignored`},{id:``,label:`All`}]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:c?(0,F.jsx)(W,{error:c}):s?(0,F.jsx)(Ha,{rows:s.groups,initialSort:`last`,rowKey:e=>e.fingerprint,onRow:e=>f(e.fingerprint),empty:(0,F.jsx)(Na,{title:a===`open`?`No secrets in your logs`:`Nothing here`,icon:(0,F.jsx)(ji,{size:20,className:`text-[#3fb68b]`}),children:`The SDK redacts passwords, tokens, keys and card numbers before logs leave your process, and the server checks again on arrival. Anything that gets through shows up here with a critical alert.`}),cols:[{key:`r`,label:`What leaked`,sort:e=>e.label,render:e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,style:{color:e.status===`open`?`#ff9b9b`:void 0},children:e.label}),e.status!==`open`&&(0,F.jsx)(G,{kind:e.status===`resolved`?`good`:`neutral`,children:e.status===`resolved`?`fixed`:e.status})]})},{key:`s`,label:`In`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.source===`error`?`error message`:`log line`})},{key:`w`,label:`Where`,sort:e=>`${e.service} ${e.operation}`,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{children:e.service}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[e.operation?(0,F.jsx)(za,{name:e.operation}):`outside a request or job`,e.logger?` · ${e.logger}`:``]})]})},{key:`ex`,label:`Example (redacted)`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2 truncate inline-block max-w-[380px] align-bottom`,children:fB(e.sample||``)})},{key:`win`,label:`In window`,num:!0,sort:e=>e.inWindow,render:e=>V(e.inWindow)},{key:`c`,label:`Total`,num:!0,sort:e=>e.count,render:e=>V(e.count)},{key:`first`,label:`First seen`,sort:e=>e.firstSeen,render:e=>(0,F.jsxs)(`span`,{className:`text-ink2`,children:[(0,F.jsx)(Xa,{tip:uB(e.firstSeen),children:Sa(e.firstSeen)}),e.firstVersion?(0,F.jsxs)(`span`,{className:`text-mute`,children:[` · `,e.firstVersion]}):``]})},{key:`last`,label:`Last seen`,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(Xa,{tip:uB(e.lastSeen),className:`text-ink2`,children:Sa(e.lastSeen)})}]}):(0,F.jsx)(U,{})})})]})}function fB(e){let t=e.split(`[REDACTED]`);return t.map((e,n)=>(0,F.jsxs)(`span`,{children:[e,n<t.length-1&&(0,F.jsx)(`span`,{className:`rounded px-1 mx-px`,style:{background:`rgba(208,59,59,.22)`,color:`#ff9b9b`},children:`[REDACTED]`})]},n))}function pB(){let{fp:e=``}=yt(),t=I(),n=Qn(),r=ht(),{data:i,error:a,reload:o}=P(`/api/errors/${e}${t.q()}`,[t.tick]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let s=i.group,c=async t=>{await N(`/api/errors/${e}`,{method:`PATCH`,json:{status:t}}),o()};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Nn,{to:n(`/errors`),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:`← Errors`}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,style:{color:s.handled?void 0:`#ff9b9b`},children:s.class}),s.handled?(0,F.jsx)(G,{kind:`neutral`,children:`handled`}):(0,F.jsx)(G,{kind:`crit`,children:`unhandled`}),(0,F.jsx)(G,{kind:s.status===`resolved`?`good`:s.status===`ignored`?`neutral`:`warn`,children:s.status})]}),(0,F.jsx)(`div`,{className:`mt-1.5 text-[13.5px]`,children:s.message}),(0,F.jsxs)(`div`,{className:`text-mute mt-1 text-[12px]`,children:[s.service,` · `,s.operation?(0,F.jsx)(za,{name:s.operation}):`no operation`,` · fingerprint `,(0,F.jsx)(`span`,{className:`mono`,children:s.fingerprint})]})]}),(0,F.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[i.issues[0]?(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>r(n(`/issues/${i.issues[0].id}`)),children:[`Issue #`,i.issues[0].id]}):(0,F.jsxs)(`button`,{className:`btn`,onClick:async()=>{let t=await N(`/api/issues`,{method:`POST`,json:{title:`${s.class}: ${String(s.message).slice(0,110)}`,severity:s.handled?`low`:`high`,service:s.service,sourceType:`error`,sourceRef:e,description:`Error group first seen ${new Date(s.firstSeen).toISOString()}${s.firstVersion?` in ${s.firstVersion}`:``}.`}});r(n(`/issues/${t.id}`))},children:[(0,F.jsx)(Fr,{size:13}),`Create issue`]}),s.status===`open`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>c(`resolved`),children:[(0,F.jsx)(Mr,{size:13}),`Resolve`]}),(0,F.jsxs)(`button`,{className:`btn btn-ghost`,onClick:()=>c(`ignored`),children:[(0,F.jsx)(Hr,{size:13}),`Ignore`]})]}):(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>c(`open`),children:[(0,F.jsx)(Si,{size:13}),`Reopen`]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-5 gap-3`,children:[(0,F.jsx)(Fa,{label:`In this window`,value:V(i.windowCount)}),(0,F.jsx)(Fa,{label:`All time`,value:V(s.count)}),(0,F.jsx)(Fa,{label:`Users affected`,value:V(i.users.length)}),(0,F.jsx)(Fa,{label:`First seen`,value:(0,F.jsx)(`span`,{className:`text-[16px]`,children:Sa(s.firstSeen)}),sub:s.firstVersion?`in release ${s.firstVersion}`:void 0}),(0,F.jsx)(Fa,{label:`Last seen`,value:(0,F.jsx)(`span`,{className:`text-[16px]`,children:Sa(s.lastSeen)})})]}),(0,F.jsx)(YR,{title:`Occurrences`,children:(0,F.jsx)(JR,{data:i.series.points,series:[{key:`count`,label:`Occurrences`,color:s.handled?`#82829a`:GR.crit,type:`bar`}],height:130,fmt:e=>V(e)})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Latest stack trace`,sub:i.latest?Ca(i.latest.ts,!0):void 0,className:`@5xl:col-span-2`,children:i.latest?(0,F.jsx)(eB,{frames:i.latest.frames,stack:i.latest.stack}):(0,F.jsx)(Na,{title:`No occurrence stored`})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(H,{title:`Releases`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.versions,cols:[{key:`v`,label:`Version`,render:e=>(0,F.jsx)(`span`,{className:`mono`,children:e.version||`—`})},{key:`n`,label:`Events`,num:!0,render:e=>V(e.n)},{key:`l`,label:`Last`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.last)})}]})}),(0,F.jsx)(H,{title:`Operations`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.operations,empty:(0,F.jsx)(Na,{title:`—`}),cols:[{key:`o`,label:`Where`,render:e=>e.operation?(0,F.jsx)(za,{name:e.operation}):`—`},{key:`n`,label:`Events`,num:!0,render:e=>V(e.n)}]})}),i.users.length>0&&(0,F.jsx)(H,{title:`Affected users`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.users,maxHeight:220,onRow:e=>r(n(`/users/${Ea(e.user_id)}`)),cols:[{key:`u`,label:`User`,render:e=>e.user_id},{key:`n`,label:`Events`,num:!0,render:e=>V(e.n)}]})})]})]}),(0,F.jsx)(H,{title:`Occurrences`,sub:`most recent 50`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.occurrences,onRow:e=>e.execution_id&&r(n(`/executions/${e.execution_id}`)),cols:[{key:`t`,label:`Time`,render:e=>Ca(e.ts,!0)},{key:`v`,label:`Release`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px]`,children:e.version||`—`})},{key:`i`,label:`Instance`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2`,children:e.instance})},{key:`u`,label:`User`,render:e=>e.user_id||`—`},{key:`s`,label:`Status`,render:e=>e.http_status??`—`},{key:`m`,label:`Message`,render:e=>(0,F.jsx)(`span`,{className:`text-mute truncate inline-block max-w-[380px] align-middle`,children:e.message})},{key:`x`,label:``,render:e=>e.execution_id?(0,F.jsx)(`span`,{className:`link`,children:`trace →`}):null}]})})]})}var mB=[[`requests`,`Requests`],[`jobs`,`Job runs`],[`errors`,`Errors`],[`logs`,`Log entries`],[`spans`,`Method spans`]],hB=e=>new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`,timeZone:`UTC`}),gB=e=>`$${e.toLocaleString(void 0,{maximumFractionDigits:e<10?2:0})}`,_B=e=>e.overage===`none`?`Nothing to pass`:e.overage===`reduce`?`Less detail, then refused at 2×`:`Overage, within spend controls`;function vB(){let e=I(),{data:t,error:n,reload:r}=P(`/api/usage`,[e.tick]),[i,a]=(0,v.useState)(null),o=async t=>{a(null);try{await N(`/api/usage`,{method:`PUT`,json:t}),await r(),e.refresh()}catch(e){a(e.message)}},s=async t=>{a(null);try{await N(`/api/usage/${t}`,{method:`POST`}),await r(),e.refresh()}catch(e){a(e.message)}};if(n)return(0,F.jsx)(W,{error:n});if(!t)return(0,F.jsx)(U,{});let c=t,l=Zi[c.state];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Wr,{size:18,className:`text-brand`}),title:`Usage`,sub:(0,F.jsxs)(F.Fragment,{children:[`Observability Events in `,new Date(c.resetsAt-1).toLocaleDateString(void 0,{month:`long`,year:`numeric`,timeZone:`UTC`}),`, across every project. Resets `,hB(c.resetsAt),` 00:00 UTC.`]}),right:(0,F.jsx)(G,{kind:l.tone,children:l.label})}),i&&(0,F.jsx)(`div`,{className:`card px-3.5 py-2.5 text-[12.5px]`,style:{borderColor:`#5a2a2a`,color:`#f2a0a0`},children:i}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-4 items-start`,children:[(0,F.jsxs)(H,{title:`This month`,className:`@5xl:col-span-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`text-[30px] font-semibold tracking-tight tabular-nums`,children:R(c.used)}),(0,F.jsx)(`span`,{className:`text-ink2 text-[14px]`,children:c.included?(0,F.jsxs)(F.Fragment,{children:[`of `,R(c.included),` events`,c.pct!=null&&(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(`b`,{className:`text-ink`,children:Yi(c.pct)})]})]}):`events (no allowance on Self-hosted)`})]}),c.included?(0,F.jsx)(`div`,{className:`mt-3 mb-1`,children:(0,F.jsx)($i,{used:c.used,included:c.included,thresholds:c.settings.thresholds})}):null,(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2 mt-2.5 flex flex-wrap gap-x-4 gap-y-1`,children:[(0,F.jsxs)(`span`,{children:[`Today `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.today)})]}),(0,F.jsxs)(`span`,{children:[`Projected by month end `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.projected)}),c.included&&c.projected>c.included?(0,F.jsxs)(`span`,{style:{color:`#fab219`},children:[` (`,R(c.projected-c.included),` over)`]}):null]}),c.overage>0&&(0,F.jsxs)(`span`,{children:[`Overage `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.overage)}),c.settings.overageRate?(0,F.jsxs)(F.Fragment,{children:[` ≈ `,gB(c.overage/1e6*c.settings.overageRate)]}):null]}),c.unbilled>0&&(0,F.jsxs)(`span`,{title:`Server errors and failed jobs collected while overage was paused`,children:[`Unbilled `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.unbilled)})]}),c.dropped>0&&(0,F.jsxs)(`span`,{title:`Events the plan didn't keep`,children:[`Not kept `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.dropped)})]})]}),c.reason&&(0,F.jsx)(`div`,{className:`mt-3 text-[12.5px] rounded-lg px-3 py-2 bg-[rgba(250,178,25,.08)] border border-[rgba(250,178,25,.25)]`,children:c.reason}),c.plan.id===`self-hosted`&&(0,F.jsx)(`div`,{className:`mt-3 text-[12.5px] text-mute`,children:`Self-hosted keeps everything. Events are still counted, so you can see what a plan would use.`}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-5 gap-2 mt-4`,children:mB.map(([e,t])=>(0,F.jsxs)(`div`,{className:`rounded-lg bg-[#14141b] border border-line px-3 py-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] text-mute`,children:t}),(0,F.jsx)(`div`,{className:`text-[15px] font-semibold tabular-nums`,children:R(c.kinds[e])})]},e))})]}),(0,F.jsx)(H,{title:`Plan`,right:(0,F.jsx)(`span`,{className:`text-[12px] text-mute`,children:c.plan.name}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[13px]`,children:[(0,F.jsx)(yB,{label:`Included events`,value:c.plan.included==null?`No limit`:`${R(c.plan.included)} / month`}),(0,F.jsx)(yB,{label:`Retention`,value:c.plan.retentionDays==null?`Your setting (OBZERVER_RETENTION_DAYS)`:`${c.plan.retentionDays} days`}),c.limits.spanTreeDays&&(0,F.jsxs)(`div`,{className:`text-[11.5px] text-mute -mt-1`,children:[`Fast, successful executions keep their span tree for `,c.limits.spanTreeDays,` days; slow or failed ones keep it for the whole window.`]}),(0,F.jsx)(yB,{label:`Logs & alerts`,value:(0,F.jsx)(bB,{on:c.plan.features.logs&&c.plan.features.alerts})}),(0,F.jsx)(yB,{label:`SLOs`,value:(0,F.jsx)(bB,{on:c.plan.features.slos})}),(0,F.jsx)(yB,{label:`Past the allowance`,value:_B(c.plan)})]})})]}),(0,F.jsx)(H,{title:`Events per day`,sub:`UTC days, this month`,children:(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(HR,{data:c.daily,margin:{top:6,right:6,bottom:0,left:-6},barCategoryGap:3,children:[(0,F.jsx)(rF,{vertical:!1}),(0,F.jsx)(tL,{dataKey:`day`,tickLine:!1,axisLine:{stroke:`#2a2a35`},tickFormatter:e=>String(Number(e.slice(8))),interval:`preserveStartEnd`}),(0,F.jsx)(vL,{tickLine:!1,axisLine:!1,tickFormatter:e=>R(e),width:44}),c.limits.dailyPace&&(0,F.jsx)(mN,{y:c.limits.dailyPace,stroke:`#fab219`,strokeDasharray:`4 3`,label:{value:`Pace ${R(c.limits.dailyPace)}/day`,position:`insideTopRight`,fill:`#fab219`,fontSize:10.5}}),(0,F.jsx)(Dm,{cursor:{fill:`rgba(255,255,255,.04)`},isAnimationActive:!1,content:({active:e,payload:t})=>e&&t?.length?(0,F.jsxs)(`div`,{className:`rounded-lg border border-line2 px-3 py-1.5 text-[12px]`,style:{background:`rgba(20,20,27,.97)`},children:[(0,F.jsx)(`div`,{className:`text-mute`,children:hB(Date.parse(t[0].payload.day))}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:t[0].value.toLocaleString()}),` events`]}),t[0].payload.unbilled>0&&(0,F.jsxs)(`div`,{className:`text-ink2`,children:[t[0].payload.unbilled.toLocaleString(),` unbilled`]}),t[0].payload.dropped>0&&(0,F.jsxs)(`div`,{className:`text-ink2`,children:[t[0].payload.dropped.toLocaleString(),` not kept`]})]}):null}),(0,F.jsx)($j,{dataKey:`events`,fill:WR[0],radius:[4,4,0,0],isAnimationActive:!1})]})})})}),(0,F.jsx)(xB,{report:c,onSave:o}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-4 items-start`,children:[(0,F.jsx)(SB,{report:c,onSave:o,onPost:s}),(0,F.jsx)(wB,{report:c,onSave:o})]}),(0,F.jsx)(TB,{report:c}),(0,F.jsx)(OB,{}),(0,F.jsx)(H,{title:`What counts`,right:(0,F.jsx)(Xr,{size:14,className:`text-mute`}),children:(0,F.jsxs)(`div`,{className:`text-[12.8px] text-ink2 leading-relaxed flex flex-col gap-2 max-w-[860px]`,children:[(0,F.jsx)(`p`,{children:`One Observability Event per request, background job run, error, log entry or trace span your apps report. Events add up: a request that ran through three of your own methods, wrote two log lines and raised one error is seven events.`}),(0,F.jsx)(`p`,{children:`Database-query and outbound-HTTP spans don't count: they are detail about a method span that is already counted. Runtime samples (CPU, memory, event loop) and custom metrics don't count either.`}),(0,F.jsxs)(`p`,{children:[`To send fewer events, ignore noisy routes in the SDK (`,(0,F.jsx)(`span`,{className:`mono`,children:`ignore`}),` in `,(0,F.jsx)(`span`,{className:`mono`,children:`init()`}),`) and keep log levels at `,(0,F.jsx)(`span`,{className:`mono`,children:`info`}),` or above in production.`]})]})})]})}function yB({label:e,value:t}){return(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`span`,{className:`text-ink2`,children:e}),(0,F.jsx)(`span`,{className:`text-right`,children:t})]})}function bB({on:e}){return e?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,style:{color:`#3ccf7a`},children:[(0,F.jsx)(Tr,{size:14}),`Included`]}):(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-mute`,children:[(0,F.jsx)(ii,{size:13}),`Not included`]})}function xB({report:e,onSave:t}){let[n,r]=(0,v.useState)({included:String(e.settings.enterprise.included),retentionDays:String(e.settings.enterprise.retentionDays)}),i=e.plan.id;return(0,F.jsxs)(H,{title:`Plans`,sub:`Choose the plan this server enforces`,pad:!1,children:[(0,F.jsx)(`div`,{className:`overflow-x-auto`,children:(0,F.jsxs)(`table`,{className:`w-full text-[12.8px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{className:`text-mute text-[11.5px] text-left`,children:[`Plan`,`Included events / month`,`Retention`,`Logs & alerts`,`SLOs`,`Past the allowance`,``].map(e=>(0,F.jsx)(`th`,{className:`font-medium px-3.5 py-2 border-b border-line`,children:e},e))})}),(0,F.jsx)(`tbody`,{children:e.plans.map(e=>{let a=e.id===i,o=e.id===`enterprise`;return(0,F.jsxs)(`tr`,{className:a?`bg-[rgba(255,61,127,.06)]`:``,children:[(0,F.jsxs)(`td`,{className:`px-3.5 py-2.5 border-b border-line font-medium`,children:[e.name,a&&(0,F.jsx)(`span`,{className:`ml-2 text-[10.5px] font-semibold text-brand`,children:`CURRENT`})]}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line tabular-nums`,children:o?(0,F.jsx)(`input`,{className:`input h-7 w-[120px]`,"aria-label":`Enterprise included events`,value:n.included,onChange:e=>r({...n,included:e.target.value})}):e.included==null?`No limit`:R(e.included)}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line tabular-nums`,children:o?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`input`,{className:`input h-7 w-[70px]`,"aria-label":`Enterprise retention days`,value:n.retentionDays,onChange:e=>r({...n,retentionDays:e.target.value})}),`days`]}):e.retentionDays==null?`Your setting`:`${e.retentionDays} days`}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line`,children:(0,F.jsx)(bB,{on:e.features.logs})}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line`,children:(0,F.jsx)(bB,{on:e.features.slos})}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line text-ink2`,children:_B(e)}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line text-right`,children:o?(0,F.jsx)(`button`,{className:`btn h-7`,onClick:()=>t({plan:`enterprise`,enterprise:{included:Number(n.included),retentionDays:Number(n.retentionDays)}}),children:a?`Save`:`Choose`}):!a&&(0,F.jsx)(`button`,{className:`btn h-7`,onClick:()=>t({plan:e.id}),children:`Choose`})})]},e.id)})})]})}),(0,F.jsx)(`div`,{className:`px-3.5 py-2.5 text-[11.5px] text-mute`,children:`Choosing a plan applies its allowance, retention and features to every project on this server. Retention takes effect at the next hourly clean-up.`})]})}function SB({report:e,onSave:t,onPost:n}){let r=e.settings,[i,a]=(0,v.useState)(r.budget==null?``:String(r.budget)),[o,s]=(0,v.useState)(r.overageRate==null?``:String(r.overageRate));if((0,v.useEffect)(()=>{a(r.budget==null?``:String(r.budget)),s(r.overageRate==null?``:String(r.overageRate))},[r.budget,r.overageRate]),e.plan.overage===`none`)return(0,F.jsx)(H,{title:`Spend controls`,children:(0,F.jsx)(`div`,{className:`text-[12.8px] text-ink2`,children:`Self-hosted has no allowance, so there is nothing to control. Choose a plan above to meter against one.`})});if(e.plan.overage===`reduce`){let t=e.plan.included??0;return(0,F.jsxs)(H,{title:`Past the Free allowance`,children:[(0,F.jsxs)(`ol`,{className:`flex flex-col gap-2.5 text-[12.8px]`,children:[(0,F.jsx)(CB,{n:1,on:e.state===`paced`,title:`Paced day: past ${R(e.limits.dailyPace)} events in one UTC day`,children:`Most trace waterfalls pause until 00:00 UTC.`}),(0,F.jsx)(CB,{n:2,on:e.state===`reduced`,title:`Past ${R(t)} this month`,children:`Charts stay live, but most traces arrive without spans.`}),(0,F.jsx)(CB,{n:3,on:e.state===`refused`,title:`At ${R(e.limits.refuseAt)}`,children:`New telemetry is refused with a 429 until the 1st, and dropped, not queued.`})]}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute mt-3`,children:`While paced or reduced, server errors, failed jobs and anything slower than 1 second keep full traces.`})]})}let c=e.state===`paused`,l=e.spikeProtection.limit==null?``:r.overageRate?`${gB(50)} of overage (${R(e.spikeProtection.limit)} events)`:`${R(e.spikeProtection.limit)} overage events (half the allowance; set a price to use $50)`;return(0,F.jsx)(H,{title:`Spend controls`,right:c?(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>n(`resume`),children:[(0,F.jsx)(mi,{size:13}),`Resume overage`]}):(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>n(`pause`),children:[(0,F.jsx)(fi,{size:13}),`Pause overage`]}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.8px]`,children:[(0,F.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:e.spikeProtection.on,onChange:e=>t({spikeProtection:e.target.checked})}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`font-medium flex items-center gap-1.5`,children:[(0,F.jsx)(ji,{size:14,className:`text-mute`}),`Spike protection`]}),(0,F.jsxs)(`div`,{className:`text-ink2 mt-0.5`,children:[`Pauses overage when a surge would push this month's overage to `,l,` at the current pace.`,e.spikeProtection.resumed?` Off until the 1st: you resumed overage this month.`:``]})]})]}),(0,F.jsx)(K,{label:`Monthly overage budget (events beyond the allowance)`,hint:`Empty: no budget. 0: collect nothing beyond the included events.`,children:(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{className:`input h-8 w-[180px]`,inputMode:`numeric`,placeholder:`No budget`,value:i,onChange:e=>a(e.target.value)}),(0,F.jsx)(`button`,{className:`btn h-8`,onClick:()=>t({budget:i.trim()===``?null:Number(i)}),children:`Save`})]})}),(0,F.jsx)(K,{label:`Price per million overage events (optional, USD)`,hint:`Shows overage as money and sizes spike protection at $50.`,children:(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{className:`input h-8 w-[120px]`,inputMode:`decimal`,placeholder:`—`,value:o,onChange:e=>s(e.target.value)}),(0,F.jsx)(`button`,{className:`btn h-8`,onClick:()=>t({overageRate:o.trim()===``?null:Number(o)}),children:`Save`})]})}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`While overage is paused, server errors, failed jobs, runtime and custom metrics continue unbilled. Other events beyond the allowance are dropped until the 1st, or until you resume, change the budget or upgrade.`})]})})}function CB({n:e,on:t,title:n,children:r}){return(0,F.jsxs)(`li`,{className:`flex gap-3 rounded-lg px-3 py-2 border ${t?`border-[rgba(250,178,25,.45)] bg-[rgba(250,178,25,.07)]`:`border-line`}`,children:[(0,F.jsx)(`span`,{className:`w-5 h-5 rounded-full grid place-items-center text-[11px] font-semibold bg-[#1d1d27] shrink-0`,children:e}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`font-medium`,children:[n,t&&(0,F.jsx)(`span`,{className:`ml-2 text-[10.5px] font-semibold`,style:{color:`#fab219`},children:`NOW`})]}),(0,F.jsx)(`div`,{className:`text-ink2 mt-0.5`,children:r})]})]})}function wB({report:e,onSave:t}){let n=e.settings,[r,i]=(0,v.useState)(n.thresholds.join(`, `)),[a,o]=(0,v.useState)(n.notify),s=P(`/api/settings`);(0,v.useEffect)(()=>{i(n.thresholds.join(`, `)),o(n.notify)},[n.thresholds.join(`,`),n.notify]);let c=!!s.data?.email?.configured;return(0,F.jsx)(H,{title:`Quota notifications`,right:(0,F.jsx)(gr,{size:14,className:`text-mute`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.8px]`,children:[(0,F.jsx)(K,{label:`Thresholds, % of the allowance (up to five)`,hint:`For example 50, 80, 100. Each one emails once a month.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,value:r,onChange:e=>i(e.target.value),placeholder:`50, 80, 100`,disabled:e.plan.included==null})}),(0,F.jsx)(K,{label:`Email to`,hint:c?`Comma-separated.`:`Email isn’t set up on this server yet (Settings → Email), so notifications only show here.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,value:a,onChange:e=>o(e.target.value),placeholder:`you@example.com`,disabled:e.plan.included==null})}),(0,F.jsx)(`button`,{className:`btn btn-primary h-8 self-start`,disabled:e.plan.included==null,onClick:()=>t({thresholds:r.split(/[\s,%]+/).filter(Boolean).map(Number),notify:a}),children:`Save notifications`}),e.plan.included==null?(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:`Self-hosted has no allowance to notify about.`}):e.notified.length>0&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`This month`}),e.notified.map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between`,children:[(0,F.jsxs)(`span`,{children:[`Passed `,e.pct,`%`]}),(0,F.jsxs)(`span`,{className:`text-ink2`,children:[hB(e.ts),` · `,R(e.used),` events`]})]},e.pct))]})]})})}function TB({report:e}){let t=e.byProject.flatMap(e=>e.apps.map(t=>({...t,project:e.name,key:`${e.slug}/${t.service}/${t.env??``}`}))),n=Math.max(1,...t.map(e=>e.billed)),r=(e,t)=>({key:e,label:t,num:!0,sort:t=>t[e],render:t=>R(t[e])}),i=[...e.byProject.length>1?[{key:`project`,label:`Project`,sort:e=>e.project,render:e=>e.project}]:[],{key:`app`,label:`App`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.service})},{key:`env`,label:`Environment`,sort:e=>e.env??``,render:e=>e.env??(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`billed`,label:`Events`,num:!0,sort:e=>e.billed,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(Ga,{value:e.billed,max:n}),R(e.billed)]})},r(`requests`,`Requests`),r(`jobs`,`Jobs`),r(`errors`,`Errors`),r(`logs`,`Logs`),r(`spans`,`Spans`)];return(0,F.jsx)(H,{title:`By project and app`,sub:`This month`,pad:!1,children:(0,F.jsx)(Ha,{rows:t,cols:i,initialSort:`billed`,rowKey:e=>e.key,empty:(0,F.jsx)(`div`,{className:`px-3.5 py-4 text-mute text-[12.5px]`,children:`No events yet this month.`})})})}var EB=e=>e==null?null:`$${e<1?e.toFixed(e<.01?4:2):e.toFixed(2)}`,DB=e=>e==null?``:String(e);function OB(){let e=I(),{data:t,error:n,reload:r}=P(`/api/ai/usage`,[e.tick]),[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{if(!t)return;let e=t.limits;a({perQuestion:DB(e.perQuestion),perHour:DB(e.perHour),historyTurns:DB(e.historyTurns),budgetUnit:e.budgetUnit,daily:DB(e.daily),monthly:DB(e.monthly),priceIn:DB(e.prices.input),priceOut:DB(e.prices.output),thresholds:e.thresholds.join(`, `),notify:e.notify})},[t]),n)return(0,F.jsx)(W,{error:n});if(!t)return null;let u=t,d=u.limits,f=e=>t=>{l(!1),a({...i,[e]:t.target.value})},p=async()=>{s(null);try{await N(`/api/ai/usage`,{method:`PUT`,json:{perQuestion:i.perQuestion,perHour:i.perHour||0,historyTurns:i.historyTurns,budgetUnit:i.budgetUnit,daily:i.daily.trim()||null,monthly:i.monthly.trim()||null,prices:{input:i.priceIn.trim()||null,output:i.priceOut.trim()||null},thresholds:i.thresholds.split(/[\s,%]+/).filter(Boolean).map(Number),notify:i.notify}}),await r(),e.reloadMeta(),l(!0)}catch(e){s(e.message)}},m=d.budgetUnit===`usd`,h=e=>m?EB(e):`${R(e)} tokens`,g=(e,t)=>(0,F.jsxs)(`div`,{className:`rounded-lg bg-[#14141b] border border-line px-3 py-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] text-mute`,children:e}),(0,F.jsxs)(`div`,{className:`text-[15px] font-semibold tabular-nums`,children:[R(t.tokens),` `,(0,F.jsx)(`span`,{className:`text-[11.5px] font-normal text-ink2`,children:`tokens`})]}),(0,F.jsxs)(`div`,{className:`text-[11.5px] text-ink2 tabular-nums`,children:[t.questions,` question`,t.questions===1?``:`s`,t.cost==null?``:` · ${EB(t.cost)}`]})]});return(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Fi,{size:14,className:`text-brand`}),`Ask Obzeri`]}),sub:`Tokens on your own model key. Questions over MCP use the client's model and cost nothing here.`,right:u.blocked?(0,F.jsx)(G,{kind:`serious`,children:`Paused`}):null,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.blocked&&(0,F.jsx)(`div`,{className:`text-[12.5px] rounded-lg px-3 py-2 bg-[rgba(250,178,25,.08)] border border-[rgba(250,178,25,.25)]`,children:u.blocked.error}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-3 gap-2`,children:[g(`This month`,u.month),g(`Today`,u.today),(0,F.jsxs)(`div`,{className:`rounded-lg bg-[#14141b] border border-line px-3 py-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] text-mute`,children:`Per question, on average`}),(0,F.jsx)(`div`,{className:`text-[15px] font-semibold tabular-nums`,children:u.perQuestion==null?`—`:(0,F.jsxs)(F.Fragment,{children:[R(u.perQuestion),` `,(0,F.jsx)(`span`,{className:`text-[11.5px] font-normal text-ink2`,children:`tokens`})]})}),(0,F.jsxs)(`div`,{className:`text-[11.5px] text-ink2`,children:[`Capped at `,R(d.perQuestion)]})]})]}),(d.monthly!=null||d.daily!=null)&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-2 gap-4`,children:[d.monthly!=null&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[12.5px]`,children:[(0,F.jsx)(`span`,{children:`Monthly budget`}),(0,F.jsxs)(`span`,{className:`text-ink2 tabular-nums`,children:[h(u.spent.month),` of `,h(d.monthly)]})]}),(0,F.jsx)($i,{used:u.spent.month,included:d.monthly,thresholds:d.thresholds,height:8})]}),d.daily!=null&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[12.5px]`,children:[(0,F.jsx)(`span`,{children:`Daily budget`}),(0,F.jsxs)(`span`,{className:`text-ink2 tabular-nums`,children:[h(u.spent.today),` of `,h(d.daily)]})]}),(0,F.jsx)($i,{used:u.spent.today,included:d.daily,height:8})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-3 gap-x-4 gap-y-3 text-[12.8px]`,children:[(0,F.jsx)(K,{label:`Tokens per question`,hint:`Past this, Obzeri answers with what it has.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`numeric`,value:i.perQuestion??``,onChange:f(`perQuestion`)})}),(0,F.jsx)(K,{label:`Questions per hour, per browser`,hint:`0 turns the limit off.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`numeric`,value:i.perHour??``,onChange:f(`perHour`)})}),(0,F.jsx)(K,{label:`Earlier messages sent with a question`,hint:`Each one is sent again on every step.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`numeric`,value:i.historyTurns??``,onChange:f(`historyTurns`)})}),(0,F.jsx)(K,{label:`Budgets in`,children:(0,F.jsxs)(`select`,{className:`input h-8 w-full`,value:i.budgetUnit??`tokens`,onChange:f(`budgetUnit`),children:[(0,F.jsx)(`option`,{value:`tokens`,children:`Tokens`}),(0,F.jsx)(`option`,{value:`usd`,children:`Dollars (needs prices)`})]})}),(0,F.jsx)(K,{label:`Daily budget${i.budgetUnit===`usd`?` ($)`:``}`,hint:`Empty: none. Resets 00:00 UTC.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`No limit`,value:i.daily??``,onChange:f(`daily`)})}),(0,F.jsx)(K,{label:`Monthly budget${i.budgetUnit===`usd`?` ($)`:``}`,hint:`Empty: none. Resets on the 1st.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`No limit`,value:i.monthly??``,onChange:f(`monthly`)})}),(0,F.jsx)(K,{label:`Price per million input tokens ($)`,hint:`From your provider's price list for this model.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`—`,value:i.priceIn??``,onChange:f(`priceIn`)})}),(0,F.jsx)(K,{label:`Price per million output tokens ($)`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`—`,value:i.priceOut??``,onChange:f(`priceOut`)})}),(0,F.jsx)(`div`,{}),(0,F.jsx)(K,{label:`Notify at, % of the monthly budget (up to five)`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,placeholder:`50, 80, 100`,value:i.thresholds??``,onChange:f(`thresholds`)})}),(0,F.jsx)(K,{label:`Email to`,hint:`Needs email set up in Integrations → Email.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,placeholder:`you@example.com`,value:i.notify??``,onChange:f(`notify`)})}),(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary h-8`,onClick:p,children:`Save limits`}),c&&(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`#3ccf7a`},children:`Saved`})]})]}),o&&(0,F.jsx)(`div`,{className:`text-[12.5px]`,style:{color:`#f2a0a0`},children:o}),(u.byModel.length>0||u.byProject.length>1)&&(0,F.jsx)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-2 gap-4 text-[12.5px]`,children:[[`By model`,u.byModel],[`By project`,u.byProject]].filter(([,e])=>e.length>0).map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute mb-1`,children:e}),t.map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between py-1 border-b border-line last:border-0`,children:[(0,F.jsx)(`span`,{className:`mono text-[12px]`,children:e.name}),(0,F.jsxs)(`span`,{className:`text-ink2 tabular-nums`,children:[R(e.tokens),` tokens · `,e.questions,` q`,e.cost==null?``:` · ${EB(e.cost)}`]})]},e.name))]},e))})]})})}function kB(){let e=I(),[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(`all`),{data:a,error:o}=P(`/api/functions${e.q()}`,[e.tick]),s=(a||[]).filter(e=>(r===`all`||e.kind===r)&&(!t||e.name.toLowerCase().includes(t.toLowerCase()))),c=Math.max(1,...s.map(e=>e.share));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(yr,{size:18,className:`text-brand`}),title:`Services`,sub:`Time per service class method, route handler and middleware. Own time excludes awaited work (queries, HTTP calls, nested methods), so the top of this list is where your own code spends time.`}),(0,F.jsx)(AB,{}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[260px] h-7`,placeholder:`Filter by name`,value:t,onChange:e=>n(e.target.value)})]}),(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`all`,label:`All`},{id:`function`,label:`Class methods`},{id:`handler`,label:`Handlers`},{id:`middleware`,label:`Middleware`},{id:`custom`,label:`Custom spans`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:o?(0,F.jsx)(W,{error:o}):a?(0,F.jsx)(Ha,{rows:s,initialSort:`self`,rowKey:e=>e.service+e.name+e.kind,empty:(0,F.jsxs)(Na,{title:`No timed code yet`,children:[`Handlers and middleware are timed automatically, and so are classes exported from `,(0,F.jsx)(`span`,{className:`mono`,children:`*.service.ts`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`*.repository.ts`}),` files. For other files, set `,(0,F.jsx)(`span`,{className:`mono`,children:`autoInstrument`}),` globs or call `,(0,F.jsx)(`span`,{className:`mono`,children:`instrument(MyClass)`}),`.`]}),cols:[{key:`n`,label:`Name`,sort:e=>e.name,render:e=>{let t=Kz[e.kind]||Kz.function;return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(t.Icon,{size:12,style:{color:t.color}}),(0,F.jsx)(`span`,{className:`mono text-[12px]`,children:e.name})]})}},{key:`k`,label:`Kind`,sort:e=>e.kind,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:e.kind===`function`?`Class method`:Kz[e.kind]?.label})},{key:`s`,label:`Application`,sort:e=>e.service,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service}),(0,F.jsx)(ao,{app:e.service,web:!0})]})},{key:`calls`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`avgSelf`,label:`Avg own`,num:!0,sort:e=>e.avgSelf,render:e=>B(e.avgSelf)},{key:`avgTotal`,label:`Avg total`,num:!0,sort:e=>e.avgTotal,render:e=>B(e.avgTotal)},{key:`self`,label:`Own time`,num:!0,sort:e=>e.self,render:e=>B(e.self)},{key:`total`,label:`Total time`,num:!0,sort:e=>e.total,render:e=>B(e.total)},{key:`share`,label:`Share of own time`,num:!0,sort:e=>e.share,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`inline-block min-w-[44px]`,children:ba(e.share,1)}),(0,F.jsx)(Ga,{value:e.share,max:c,color:WR[4],w:70})]})},{key:`err`,label:`Errors`,num:!0,sort:e=>e.errors,render:e=>e.errors?(0,F.jsx)(`span`,{style:{color:`#ff8a8a`},children:V(e.errors)}):(0,F.jsx)(`span`,{className:`text-mute`,children:`0`})}]}):(0,F.jsx)(U,{})})})]})}function AB(){let e=I(),t=e.meta?.environments??[],n=(e.meta?.services??[]).filter(t=>!e.service||t.id===e.service).filter(n=>!e.env||t.find(t=>t.id===e.env)?.services.includes(n.id));return n.length?(0,F.jsx)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-2 @6xl:grid-cols-3 gap-3`,children:n.map(e=>{let n=Date.now()-e.lastSeen<9e5,r=t.filter(t=>t.services.includes(e.id)).map(e=>e.id);return(0,F.jsxs)(`div`,{className:`card px-4 py-3 flex flex-col gap-2 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n?`#3ccf7a`:`#5c5c70`},title:n?`Reporting`:`Last heard ${Sa(e.lastSeen)}`}),(0,F.jsx)(`span`,{className:`font-medium text-[13.5px] truncate`,children:e.id}),(0,F.jsx)(`span`,{className:`flex-1`}),(0,F.jsx)(`span`,{className:`text-[11.5px] text-mute shrink-0`,children:n?`reporting`:Sa(e.lastSeen)})]}),(0,F.jsx)(io,{frameworks:e.frameworks}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute truncate`,children:[e.node?`Node ${e.node.replace(/^v/,``)}`:null,`${e.instances.length} instance${e.instances.length===1?``:`s`}`,r.length?r.join(`, `):e.environment].filter(Boolean).join(` · `)})]},e.id)})}):null}function jB(){let[e,t]=zn(),n=ht(),{data:r,error:i,reload:a}=P(`/api/projects`),[o,s]=(0,v.useState)(e.get(`new`)===`1`),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),f=e.get(`project`)||`default`,p=()=>{if(s(!1),e.get(`new`)){let n=new URLSearchParams(e);n.delete(`new`),t(n,{replace:!0})}};return i?(0,F.jsx)(W,{error:i}):r?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ur,{size:18,className:`text-brand`}),title:`Projects`,sub:`Each project has its own apps, ingest keys, alerts, SLOs, issues, status pages, integrations and MCP token. Nothing is shared between projects.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,F.jsx)(_i,{size:14}),`New project`]})}),(0,F.jsx)(H,{pad:!1,children:(0,F.jsx)(Ha,{rows:r,cols:[{key:`n`,label:`Project`,render:e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:e.name}),e.isDefault&&(0,F.jsx)(`span`,{className:`pill`,children:`default`}),e.slug===f&&(0,F.jsx)(G,{kind:`good`,children:`current`})]})},{key:`s`,label:`Slug`,render:e=>(0,F.jsx)(`span`,{className:`mono text-ink2`,children:e.slug})},{key:`a`,label:`Apps`,num:!0,render:e=>e.apps},{key:`l`,label:`Last data`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.lastSeen?Sa(e.lastSeen):`—`})},{key:`x`,label:``,render:t=>(0,F.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[t.slug!==f&&(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>n(va(t.slug,`/`,e)),children:[`Open`,(0,F.jsx)(pr,{size:12})]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Rename`,onClick:()=>d(t),children:(0,F.jsx)(pi,{size:13})}),!t.isDefault&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2 text-[#ff8a8a]`,title:`Delete`,onClick:async()=>{window.prompt(`Delete "${t.name}" and all of its data (apps, alerts, issues, status pages, keys)? This cannot be undone.\n\nType the slug "${t.slug}" to confirm.`)===t.slug&&(await N(`/api/projects/${t.slug}`,{method:`DELETE`}),t.slug===f?n(va(`default`,`/projects`,e)):a())},children:(0,F.jsx)(Ri,{size:13})})]})}]})}),o&&(0,F.jsx)(MB,{onClose:p,onCreated:e=>{p(),l(e),a()}}),c&&(0,F.jsx)(NB,{project:c,onClose:()=>l(null),onOpen:()=>{l(null),n(va(c.slug,`/settings`,e))}}),u&&(0,F.jsx)(PB,{project:u,onClose:()=>d(null),onSaved:()=>{d(null),a()}})]}):(0,F.jsx)(U,{})}function MB({onClose:e,onCreated:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``);return(0,F.jsx)(qa,{open:!0,title:`New project`,onClose:e,children:(0,F.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:async e=>{e.preventDefault();try{t(await N(`/api/projects`,{method:`POST`,json:{name:n}}))}catch(e){a(e.message)}},children:[(0,F.jsx)(K,{label:`Name`,hint:`a product, a client or a team`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Acme Shop`})}),i&&(0,F.jsx)(`div`,{className:`text-[12.5px] text-[#ff8a8a]`,children:i}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`btn`,onClick:e,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!n.trim(),children:`Create`})]})]})})}function NB({project:e,onClose:t,onOpen:n}){let r=`OBZERVER_KEY=${e.ingestKey} OBZERVER_ENDPOINT=${window.location.origin} \\\n node --import @obzerver/node/register server.js`;return(0,F.jsx)(qa,{open:!0,title:`"${e.name}" is ready`,onClose:t,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 text-[13px]`,children:[(0,F.jsx)(`div`,{className:`text-ink2`,children:`Apps that send data with this project's ingest key show up only here.`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Ingest key`}),(0,F.jsx)(Ba,{text:e.ingestKey,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:e.ingestKey})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Start an app with it`}),(0,F.jsx)(Ba,{text:r,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:r})]}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:t,children:`Stay here`}),(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:n,children:[`Open project setup`,(0,F.jsx)(pr,{size:13})]})]})]})})}function PB({project:e,onClose:t,onSaved:n}){let[r,i]=(0,v.useState)(e.name),[a,o]=(0,v.useState)(``);return(0,F.jsx)(qa,{open:!0,title:`Rename project`,onClose:t,children:(0,F.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:async t=>{t.preventDefault();try{await N(`/api/projects/${e.slug}`,{method:`PATCH`,json:{name:r}}),n()}catch(e){o(e.message)}},children:[(0,F.jsx)(K,{label:`Name`,hint:(0,F.jsxs)(F.Fragment,{children:[`the slug `,(0,F.jsx)(`span`,{className:`mono`,children:e.slug}),` stays, so links and keys keep working`]}),children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)})}),a&&(0,F.jsx)(`div`,{className:`text-[12.5px] text-[#ff8a8a]`,children:a}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`btn`,onClick:t,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!r.trim(),children:`Save`})]})]})})}function FB(){let e=I(),[t,n]=(0,v.useState)(`db`),[r,i]=(0,v.useState)(null),a=P(t===`db`?`/api/queries${e.q()}`:null,[e.tick,t]),o=P(t===`http`?`/api/outbound${e.q()}`:null,[e.tick,t]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Br,{size:18,className:`text-brand`}),title:`Queries & dependencies`,sub:`Statements from pg, mysql2 and ioredis with literal values stripped in-process, plus outbound HTTP calls (http, https, fetch).`,right:(0,F.jsx)(Va,{value:t,onChange:n,options:[{id:`db`,label:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Br,{size:12}),`Database`]})},{id:`http`,label:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Kr,{size:12}),`Outbound HTTP`]})}]})}),t===`db`?(0,F.jsx)(H,{pad:!1,children:a.error?(0,F.jsx)(W,{error:a.error}):a.data?(0,F.jsx)(Ha,{rows:a.data,initialSort:`total`,rowKey:e=>e.service+e.statement,onRow:e=>i(r===e.service+e.statement?null:e.service+e.statement),empty:(0,F.jsx)(Na,{title:`No queries recorded`,children:`pg, mysql2 and ioredis are instrumented automatically when installed.`}),cols:[{key:`st`,label:`Statement`,render:e=>(0,F.jsxs)(`div`,{className:`max-w-[640px]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.statement}),e.nPlusOne&&(0,F.jsx)(G,{kind:`serious`,children:`N+1 suspect`})]}),r===e.service+e.statement&&(0,F.jsxs)(`div`,{className:`mt-2`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`div`,{className:`flex justify-end mb-1`,children:(0,F.jsx)(Ba,{text:e.statement,className:`btn h-6 text-[11px]`})}),(0,F.jsx)(Jz,{text:e.statement})]})]})},{key:`sys`,label:`System`,sort:e=>e.system,render:e=>(0,F.jsx)(`span`,{className:`pill`,children:e.system})},{key:`svc`,label:`Application`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},{key:`calls`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`per`,label:`Per request`,num:!0,sort:e=>e.perRequest,render:e=>(0,F.jsxs)(`span`,{title:`max ${e.maxPerRequest} in one request`,style:{color:e.nPlusOne?`#ffb38a`:void 0},children:[V(e.perRequest),` `,(0,F.jsxs)(`span`,{className:`text-mute text-[11px]`,children:[`max `,e.maxPerRequest]})]})},{key:`avg`,label:`Avg`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`p95`,label:`p95`,num:!0,sort:e=>e.p95,render:e=>B(e.p95)},{key:`total`,label:`Total time`,num:!0,sort:e=>e.total,render:e=>B(e.total)}]}):(0,F.jsx)(U,{})}):(0,F.jsx)(H,{pad:!1,children:o.error?(0,F.jsx)(W,{error:o.error}):o.data?(0,F.jsx)(Ha,{rows:o.data,initialSort:`calls`,empty:(0,F.jsx)(Na,{title:`No outbound calls recorded`}),cols:[{key:`h`,label:`Host`,sort:e=>e.host,render:e=>(0,F.jsx)(`span`,{className:`mono`,children:e.host})},{key:`s`,label:`Called from`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},{key:`calls`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`err`,label:`Failures`,num:!0,sort:e=>e.errors,render:e=>e.errors?(0,F.jsxs)(`span`,{style:{color:`#ff8a8a`},children:[V(e.errors),` (`,ba(e.errors/e.calls*100),`)`]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`0`})},{key:`avg`,label:`Avg`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`p95`,label:`p95`,num:!0,sort:e=>e.p95,render:e=>B(e.p95)}]}):(0,F.jsx)(U,{})})]})}function IB(){let e=I(),t=Qn(),n=ht(),[r,i]=(0,v.useState)(`user`),[a,o]=(0,v.useState)(``),{data:s,error:c}=P(`/api/users${e.q({groupBy:r===`customer`?`customer`:``})}`,[e.tick,r]),l=(s||[]).filter(e=>!a||(e.userId||e.customer).toLowerCase().includes(a.toLowerCase()));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ui,{size:18,className:`text-brand`}),title:`Users`,sub:(0,F.jsxs)(F.Fragment,{children:[`Who is affected. Users come from `,(0,F.jsx)(`span`,{className:`mono`,children:`req.user.id`}),`, the `,(0,F.jsx)(`span`,{className:`mono`,children:`http.getUserId`}),` option or `,(0,F.jsx)(`span`,{className:`mono`,children:`obzerver.setUser()`}),`.`]})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[260px] h-7`,placeholder:`Filter`,value:a,onChange:e=>o(e.target.value)})]}),(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`user`,label:`By user`},{id:`customer`,label:`By customer (email domain)`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:c?(0,F.jsx)(W,{error:c}):s?r===`user`?(0,F.jsx)(Ha,{rows:l,initialSort:`calls`,onRow:e=>n(t(`/users/${Ea(e.userId)}`)),rowKey:e=>e.userId,empty:(0,F.jsx)(Na,{title:`No identified users`,children:`Set http.getUserId in the SDK options, or populate req.user.`}),cols:[{key:`u`,label:`User`,sort:e=>e.userId,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.userId})},{key:`c`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`o`,label:`Operations`,num:!0,sort:e=>e.operations,render:e=>V(e.operations)},{key:`f`,label:`Failure rate`,num:!0,sort:e=>e.failureRate,render:e=>(0,F.jsxs)(`span`,{style:{color:e.failureRate>2?`#ff8a8a`:e.failureRate>0?`var(--color-ink2)`:`var(--color-mute)`},children:[ba(e.failureRate),` `,(0,F.jsxs)(`span`,{className:`text-mute text-[11px]`,children:[`(`,e.failed,`)`]})]})},{key:`a`,label:`Avg latency`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`l`,label:`Last seen`,num:!0,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:Sa(e.lastSeen)})}]}):(0,F.jsx)(Ha,{rows:l,initialSort:`calls`,rowKey:e=>e.customer,cols:[{key:`c`,label:`Customer`,sort:e=>e.customer,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.customer})},{key:`u`,label:`Users`,num:!0,sort:e=>e.users,render:e=>V(e.users)},{key:`n`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`f`,label:`Failure rate`,num:!0,sort:e=>e.failureRate,render:e=>(0,F.jsxs)(`span`,{style:{color:e.failureRate>2?`#ff8a8a`:void 0},children:[ba(e.failureRate),` `,(0,F.jsxs)(`span`,{className:`text-mute text-[11px]`,children:[`(`,e.failed,`)`]})]})},{key:`l`,label:`Last seen`,num:!0,sort:e=>e.lastSeen,render:e=>Sa(e.lastSeen)}]}):(0,F.jsx)(U,{})})})]})}function LB(){let{id:e=``}=yt(),t=I(),n=Qn(),r=ht(),{data:i,error:a}=P(`/api/users/${encodeURIComponent(e)}${t.q()}`,[t.tick]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let o=i.actions.filter(e=>e.failed).length,s=[];for(let e of i.actions){let t=s[s.length-1];t&&t[t.length-1].ts-e.ts<18e5?t.push(e):s.push([e])}return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Nn,{to:n(`/users`),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:`← Users`}),(0,F.jsx)(Ma,{title:e,sub:e.includes(`@`)?`customer ${e.split(`@`)[1]}`:void 0}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-4 gap-3`,children:[(0,F.jsx)(Fa,{label:`Actions in window`,value:V(i.actions.length)}),(0,F.jsx)(Fa,{label:`Failed`,value:V(o),color:o?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`Sessions`,value:V(s.length)}),(0,F.jsx)(Fa,{label:`Distinct errors`,value:V(i.errors.length)})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Activity replay`,sub:`newest first, grouped into sessions`,pad:!1,className:`@5xl:col-span-2`,children:s.length===0?(0,F.jsx)(Na,{title:`No activity in this window`}):(0,F.jsx)(`div`,{className:`max-h-[560px] overflow-auto`,children:s.map((e,t)=>(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`px-3.5 py-1.5 text-[11px] uppercase tracking-wider text-mute bg-[#111118] border-b border-line sticky top-0`,children:[`Session · `,Ca(e[e.length-1].ts,!0),` → `,Ca(e[0].ts),` · `,e.length,` actions`]}),e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-1.5 border-b border-[#1b1b23] hover:bg-[#16161e] cursor-pointer`,onClick:()=>r(n(`/executions/${e.id}`)),children:[(0,F.jsx)(`span`,{className:`mono text-mute text-[11.5px] w-16`,children:Ca(e.ts)}),(0,F.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(za,{name:e.name}),e.error_message&&(0,F.jsx)(`span`,{className:`text-[#ff9b9b] text-[12px] ml-2 truncate`,children:e.error_message})]}),(0,F.jsx)(La,{status:e.status}),(0,F.jsx)(`span`,{className:`w-16 text-right tabular-nums`,children:B(e.duration)})]},e.id))]},t))})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(H,{title:`Actions`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.operations,cols:[{key:`n`,label:`Operation`,render:e=>(0,F.jsx)(za,{name:e.name})},{key:`c`,label:`Calls`,num:!0,render:e=>V(e.calls)},{key:`f`,label:`Failed`,num:!0,render:e=>e.failed?(0,F.jsx)(`span`,{style:{color:`#ff8a8a`},children:e.failed}):(0,F.jsx)(`span`,{className:`text-mute`,children:`0`})}]})}),(0,F.jsx)(H,{title:`Common paths`,sub:`action → next action`,pad:!1,children:i.paths.length?i.paths.map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between gap-2 px-3.5 py-1.5 border-b border-[#1b1b23] text-[12px]`,children:[(0,F.jsx)(`span`,{className:`mono truncate`,children:e.path}),(0,F.jsx)(`span`,{className:`tabular-nums text-ink2`,children:e.n})]},e.path)):(0,F.jsx)(Na,{title:`Not enough actions`})}),i.errors.length>0&&(0,F.jsx)(H,{title:`Errors hit`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.errors,onRow:e=>r(n(`/errors/${e.fingerprint}`)),cols:[{key:`c`,label:`Error`,render:e=>(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:e.class})},{key:`n`,label:`Count`,num:!0,render:e=>e.n}]})})]})]})]})}var RB=e=>new Date(e).toLocaleString(`en-US`,{month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),zB=e=>String(e).padStart(2,`0`),BB=(e,t)=>{let n=new Date(e),r=`${zB(n.getHours())}:${zB(n.getMinutes())}`,i=`${zB(n.getMonth()+1)}/${zB(n.getDate())}`;return t<=72e6?r:t<=2592e5?`${i} ${r}`:i},VB=({color:e})=>(0,F.jsx)(`span`,{className:`inline-block w-[2px] h-[11px] rounded-full align-[-1px]`,style:{background:e}});function HB({title:e,sub:t,children:n}){return(0,F.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2.5 px-0.5`,children:[(0,F.jsx)(`h2`,{className:`text-[15px] font-medium tracking-tight`,children:e}),(0,F.jsx)(`span`,{className:`mono text-[10.5px] uppercase tracking-[.12em] text-mute`,children:t})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:n})]})}function UB({now:e,prev:t,unit:n,badWhen:r=`up`}){if(e==null||t==null||n===`pct`&&!t)return null;let i=n===`pp`?e-t:(e-t)/t*100,a=Math.abs(i)<(n===`pp`?.05:.5),o=i>0,s=!a&&(o?r===`up`:r===`down`),c=a?si:o?Bi:zi,l=n===`pp`?`${o?`+`:`−`}${Math.abs(i).toFixed(2)}pp`:`${o?`+`:`−`}${Math.abs(i).toFixed(0)}%`;return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink2`,title:`Average over this window compared with the window of the same length before it`,children:[(0,F.jsx)(c,{size:13,style:{color:a?`var(--color-mute)`:s?`#f0506e`:`#3fb68b`}}),a?`no change`:l,` since last period`]})}function WB({value:e,color:t,fmt:n}){return e==null?null:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[12px] text-ink2`,children:[(0,F.jsx)(VB,{color:t}),`AVG`,(0,F.jsx)(`span`,{className:`mono text-[11.5px] font-semibold px-1.5 py-[2px] rounded`,style:{background:`#2a2a33`,color:`#e8e8ef`},children:n(e)})]})}function GB({title:e,trend:t,right:n,children:r}){return(0,F.jsxs)(`div`,{className:`rounded-xl border border-line overflow-hidden`,style:{background:`linear-gradient(180deg, #17171d 0%, #121217 100%)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 h-[52px] border-b border-line`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[14px] whitespace-nowrap`,children:e}),t]}),(0,F.jsx)(`div`,{className:`flex items-center gap-4 shrink-0`,children:n})]}),(0,F.jsx)(`div`,{className:`px-3 pt-4 pb-2`,children:r})]})}var KB=({series:e})=>(0,F.jsx)(F.Fragment,{children:e.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink2`,children:[(0,F.jsx)(VB,{color:e.color}),e.label]},e.key))});function qB({active:e,payload:t,label:n,series:r,fmt:i,pinned:a,hint:o,extra:s}){if(!e||!t?.length)return null;let c=t[0].payload;return(0,F.jsxs)(`div`,{className:`mono rounded-md border border-[#2c2c36] px-3 py-2.5 text-[11.5px] shadow-2xl`,style:{background:`rgba(17,17,22,.97)`,minWidth:200},children:[r.filter(e=>c[e.key]!=null).map(e=>{let t=a?.[e.key],n=t!=null&&c[e.key]!=null?c[e.key]-t:null;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2 py-[2px]`,children:[(0,F.jsx)(VB,{color:e.color}),(0,F.jsxs)(`span`,{className:`font-semibold text-ink`,children:[e.label,`: `,i(c[e.key],e.key)]}),n!=null&&(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(`,n>=0?`+`:`−`,i(Math.abs(n),e.key),` vs pin)`]})]},e.key)}),s?.(c),(0,F.jsx)(`div`,{className:`text-ink2 mt-1.5`,children:RB(n)}),(0,F.jsx)(`div`,{className:`text-mute mt-2 pt-2 border-t border-[#24242c]`,children:a?`Pinned ${RB(a.t)} · shift+click to unpin`:o})]})}function JB({data:e,series:t,fmt:n,yFmt:r,height:i=240,yMax:a,onInspect:o,gcKey:s,extra:c,releases:l=[]}){let u=(0,v.useRef)(!1),[d,f]=(0,v.useState)(null);if(!e.length)return(0,F.jsx)(`div`,{className:`flex items-center justify-center text-mute text-[12px]`,style:{height:i},children:`No samples in this window`});let p=s?Math.max(1,...e.map(e=>e[s]||0)):1,m=t.some(e=>e.kind===`bar`),h=e.length>1?e[e.length-1].t-e[0].t:36e5,g=e.length>1?e[1].t-e[0].t:h,_=l.filter(t=>t.t>=e[0].t&&t.t<=e[e.length-1].t+g).map(t=>({...t,at:e.reduce((e,n)=>n.t<=t.t&&n.t>e?n.t:e,e[0].t)})),y=e=>_.filter(t=>t.at===e),b=o?`Click to see what ran here · shift+click to pin and compare`:`Shift+click to pin and compare`;return(0,F.jsx)(`div`,{className:`relative select-none`,onMouseDownCapture:e=>{u.current=e.shiftKey},children:(0,F.jsx)(`div`,{style:{height:i},children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(UR,{data:e,margin:{top:8,right:44,bottom:0,left:0},barGap:2,barCategoryGap:`30%`,onClick:t=>{if(!t||t.activeLabel==null)return;let n=e.find(e=>e.t===t.activeLabel);u.current?f(e=>e&&e.t===t.activeLabel?null:n):o?.(t.activeLabel)},style:{cursor:o?`pointer`:`default`},children:[(0,F.jsx)(`defs`,{children:t.filter(e=>e.kind===`area`||e.kind===`bar`).map(e=>(0,F.jsxs)(`linearGradient`,{id:`g-${e.key}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:e.kind===`bar`?1:.42}),(0,F.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:e.kind===`bar`?.35:.02})]},e.key))}),(0,F.jsx)(rF,{vertical:!1,stroke:`#ffffff`,strokeOpacity:.045,strokeDasharray:`2 6`}),(0,F.jsx)(tL,{dataKey:`t`,type:m?`category`:`number`,domain:[`dataMin`,`dataMax`],scale:m?`auto`:`time`,tickFormatter:e=>BB(e,h),tick:{fill:`#6f6f7d`,fontSize:10.5,fontFamily:`var(--font-mono)`},tickLine:!1,axisLine:{stroke:`#2a2a35`},minTickGap:44,tickMargin:6}),(0,F.jsx)(vL,{yAxisId:`v`,width:64,tickLine:!1,axisLine:!1,tickCount:5,tick:{fill:`#6f6f7d`,fontSize:10.5,fontFamily:`var(--font-mono)`},tickFormatter:e=>(r??n)(e),domain:[0,a??`auto`],allowDecimals:!0}),s&&(0,F.jsx)(vL,{yAxisId:`gc`,hide:!0,domain:[0,p*6]}),(0,F.jsx)(Dm,{content:(0,F.jsx)(qB,{series:t,fmt:n,pinned:d,hint:b,extra:e=>(0,F.jsxs)(F.Fragment,{children:[y(e.t).map(e=>(0,F.jsxs)(`div`,{className:`py-[2px]`,style:{color:`#ff6b9d`},children:[`Release `,e.version,` deployed `,new Date(e.t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1})]},e.version)),c?.(e)]})}),cursor:{stroke:`#ffffff`,strokeOpacity:.18,strokeDasharray:`3 3`},isAnimationActive:!1}),s&&(0,F.jsx)($j,{yAxisId:`gc`,dataKey:s,fill:`#8a8a98`,fillOpacity:.55,barSize:1.5,isAnimationActive:!1}),t.map(e=>e.kind===`bar`?(0,F.jsx)($j,{yAxisId:`v`,dataKey:e.key,fill:`url(#g-${e.key})`,barSize:3,radius:[2,2,0,0],isAnimationActive:!1},e.key):e.kind===`area`?(0,F.jsx)(eI,{yAxisId:`v`,type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:1.6,fill:`url(#g-${e.key})`,dot:!1,activeDot:{r:4,fill:e.color,stroke:`#121217`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key):(0,F.jsx)(jF,{yAxisId:`v`,type:`monotone`,dataKey:e.key,stroke:e.color,strokeOpacity:e.faint?.55:1,strokeWidth:e.faint?1.3:1.6,dot:!1,activeDot:{r:4,fill:e.color,stroke:`#121217`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key)),_.map(e=>(0,F.jsx)(mN,{yAxisId:`v`,x:e.at,stroke:`#ff6b9d`,strokeDasharray:`3 3`,strokeOpacity:.85,label:{value:e.version,position:`insideTopLeft`,fill:`#ff6b9d`,fontSize:10.5,fontFamily:`var(--font-mono)`}},`${e.version}${e.t}`)),d&&(0,F.jsx)(mN,{yAxisId:`v`,x:d.t,stroke:`#ff9cc0`,strokeDasharray:`4 3`,strokeOpacity:.8})]})})})})}var YB={heapUsed:`#f0506e`,heapTotal:`#b0344d`,rss:`#7c7c8a`,memUtil:`#3fa58a`,cpuUtil:`#e5484d`,user:`#e5484d`,system:`#f59bb0`,elP99:`#f0506e`,elP50:`#7c7c8a`,elu:`#9085e9`},XB=e=>e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(2)} MB`,ZB=e=>`${e.toFixed(2)}%`,QB=e=>`${e<10&&e%1?e.toFixed(1):Math.round(e)}%`,$B=e=>e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`,eV=`Utilization needs @obzerver/node 0.8.2 or later, which reports the V8 heap limit, the container limits and CPU time.`;function tV(){let e=I(),t=Qn(),n=ht(),r=P(`/api/runtime${e.q()}`,[e.tick]),i=[...new Set((r.data||[]).map(e=>e.service))],[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),l=a&&i.includes(a)?a:e.service||i[0]||``,u=P(l?`/api/runtime/view${e.q({service:l,instance:s})}`:null,[e.tick,l,s]),[d,f]=(0,v.useState)(null);if((0,v.useEffect)(()=>{f(null),c(``)},[l]),(0,v.useEffect)(()=>{let e=u.data?.points;!e?.length||d&&!d.auto||b(e.reduce((e,t)=>(t.elP99??0)>(e.elP99??0)?t:e,e[0]).t,!0)},[u.data]),r.error)return(0,F.jsx)(W,{error:r.error});if(!r.data)return(0,F.jsx)(U,{});let p=u.data,m=p?.points||[],h=p?.summary,g=p?.prev,_=m.some(e=>e.memUtil!=null||e.cpuUtil!=null),y=(r.data||[]).filter(e=>e.service===l).map(e=>e.instance);async function b(e,t=!1){let n=u.data?.bucketMs||6e4,r=await N(`/api/runtime/spike?service=${encodeURIComponent(l)}${s?`&instance=${encodeURIComponent(s)}`:``}&ts=${e}&windowMs=${Math.max(6e4,n/2)}`);f({ts:e,rows:r,auto:t}),t||document.getElementById(`what-ran`)?.scrollIntoView({behavior:`smooth`,block:`start`})}let x=e=>{b(e)},S=(e.meta?.versions||[]).filter(t=>t.service===l&&t.first>=e.from&&t.first<=e.to).map(e=>({t:e.first,version:e.version})),C=p?.byInstance||[],w=e=>WR[Math.max(0,C.findIndex(t=>t.instance===e))%WR.length],T=!s&&C.length>1,E=e=>{let t=new Map;return C.forEach((n,r)=>{for(let i of n.points)t.has(i.t)||t.set(i.t,{t:i.t}),t.get(i.t)[`i${r}`]=i[e]}),[...t.values()].sort((e,t)=>e.t-t.t)},D=C.map((e,t)=>({key:`i${t}`,label:e.instance,color:WR[t%WR.length],kind:`line`})),O=[{key:`heapUsed`,label:`Heap Used`,color:YB.heapUsed,kind:`line`},{key:`heapTotal`,label:`Heap Total`,color:YB.heapTotal,kind:`line`},{key:`rss`,label:`RSS`,color:YB.rss,kind:`line`,faint:!0}],k=[{key:`cpuUser`,label:`User`,color:YB.user,kind:`bar`},{key:`cpuSystem`,label:`System`,color:YB.system,kind:`bar`}],A=[{key:`elP99`,label:`p99`,color:YB.elP99,kind:`line`},{key:`elP50`,label:`p50`,color:YB.elP50,kind:`line`,faint:!0}],j=!s&&y.length>1;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(zr,{size:18,className:`text-brand`}),title:`Profiler`,sub:`Memory, CPU and event-loop health for each app, sampled every 15 seconds.${j?` Across ${y.length} instances, memory and CPU time add up, while utilization and loop delay follow the busiest instance.`:``}`,right:i.length>0&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`select`,{className:`select`,value:l,onChange:e=>o(e.target.value),"aria-label":`Application`,children:i.map(e=>(0,F.jsx)(`option`,{children:e},e))}),y.length>1&&(0,F.jsxs)(`select`,{className:`select`,value:s,onChange:e=>c(e.target.value),"aria-label":`Instance`,children:[(0,F.jsxs)(`option`,{value:``,children:[`All instances (`,y.length,`)`]}),y.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})]})}),i.length?u.error?(0,F.jsx)(W,{error:u.error}):p?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Instances`,sub:`latest sample · click one to focus on it`,pad:!1,children:(0,F.jsx)(Ha,{rows:p.instances,onRow:e=>c(e.instance===s?``:e.instance),cols:[{key:`i`,label:`Instance`,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-sm shrink-0`,style:{background:w(e.instance)}}),(0,F.jsx)(`span`,{className:`mono`,style:{color:e.instance===s?`#ff9cc0`:void 0},children:e.instance}),e.instance===s&&(0,F.jsx)(`span`,{className:`pill !h-5 !text-[10.5px]`,children:`focused`})]})},{key:`cu`,label:`CPU util`,num:!0,render:e=>e.cpuUtil==null?`—`:ba(e.cpuUtil,1)},{key:`cl`,label:`CPUs`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.cpuLimit?`${V(e.cpuLimit)} (quota)`:e.cores??`—`})},{key:`rss`,label:`RSS`,num:!0,render:e=>XB(e.rss)},{key:`heap`,label:`Heap used / total`,num:!0,render:e=>`${V(e.heapUsed)} / ${V(e.heapTotal)} MB`},{key:`mu`,label:`Mem util`,num:!0,render:e=>e.memUtil==null?`—`:(0,F.jsx)(`span`,{title:e.memBasis===`container`?`RSS of the container limit`:`Heap of the V8 limit`,children:ba(e.memUtil,1)})},{key:`lim`,label:`Limits`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:[e.heapLimitMb&&`heap ${XB(e.heapLimitMb)}`,e.memLimitMb&&`container ${XB(e.memLimitMb)}`].filter(Boolean).join(` · `)||`—`})},{key:`el`,label:`Loop p99`,num:!0,render:e=>B(e.elP99)},{key:`inf`,label:`In-flight`,num:!0,render:e=>V(e.inflight)},{key:`h`,label:`Handles`,num:!0,render:e=>V(e.handles)}]})}),(0,F.jsx)(`div`,{id:`what-ran`,className:`scroll-mt-4`,children:d?(0,F.jsx)(H,{title:`Running around ${Ca(d.ts,!0)}`,sub:d.auto?`the worst event-loop delay in this window · click any point on a chart to look at another moment`:`the moment you clicked · operations ranked by how far they moved from their own baseline`,pad:!1,children:(0,F.jsx)(Ha,{rows:d.rows,onRow:e=>n(t(zz(`http`,l,e.name))),empty:(0,F.jsx)(Na,{title:`Nothing ran in that window`}),cols:[{key:`n`,label:`Operation`,render:e=>(0,F.jsx)(za,{name:e.name})},{key:`c`,label:`Calls`,num:!0,render:e=>V(e.calls)},{key:`a`,label:`Avg`,num:!0,render:e=>B(e.avg)},{key:`b`,label:`Baseline avg`,num:!0,render:e=>B(e.baselineAvg)},{key:`lx`,label:`Latency ×`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.latencyX>=2?`#ffb38a`:void 0},children:e.latencyX?`${e.latencyX}×`:`—`})},{key:`vx`,label:`Volume ×`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.volumeX>=2?`#ffb38a`:void 0},children:e.volumeX?`${e.volumeX}×`:`—`})}]})}):(0,F.jsx)(H,{title:`Running around…`,sub:`click any point on a chart to see which operations ran then`,children:(0,F.jsx)(`span`,{className:`text-mute text-[12px]`,children:`Loading…`})})}),(0,F.jsxs)(HB,{title:`Memory`,sub:`heap and resident size over time, with garbage collection`,children:[(0,F.jsx)(GB,{title:`Memory`,trend:(0,F.jsx)(UB,{now:h?.heapUsed,prev:g?.heapUsed,unit:`pct`}),right:(0,F.jsx)(KB,{series:[...O,{key:`gc`,label:`GC pauses`,color:`#8a8a98`,kind:`bar`}]}),children:(0,F.jsx)(JB,{releases:S,data:m,series:O,fmt:e=>XB(e),yFmt:$B,gcKey:`gcMs`,onInspect:x,extra:e=>e.gcCount?(0,F.jsxs)(`div`,{className:`text-mute py-[2px]`,children:[`GC: `,e.gcCount,` pauses · `,B(e.gcMs)]}):null})}),(0,F.jsx)(GB,{title:`Memory utilization`,trend:(0,F.jsx)(UB,{now:h?.memUtil,prev:g?.memUtil,unit:`pp`}),right:(0,F.jsxs)(F.Fragment,{children:[T&&(0,F.jsx)(KB,{series:D}),(0,F.jsx)(WB,{value:h?.memUtil,color:YB.memUtil,fmt:ZB})]}),children:_?(0,F.jsx)(JB,{releases:S,data:T?E(`memUtil`):m,series:T?D:[{key:`memUtil`,label:`Utilization`,color:YB.memUtil,kind:`area`}],fmt:ZB,yFmt:QB,extra:e=>e.memBasis&&(0,F.jsx)(`div`,{className:`text-mute py-[2px]`,children:e.memBasis===`container`?`RSS of the container memory limit`:`Heap used of the V8 heap limit`})}):(0,F.jsx)(nV,{})})]}),(0,F.jsxs)(HB,{title:`CPU`,sub:`share of the available CPU, and where the time goes`,children:[(0,F.jsx)(GB,{title:`CPU utilization`,trend:(0,F.jsx)(UB,{now:h?.cpuUtil,prev:g?.cpuUtil,unit:`pp`}),right:(0,F.jsxs)(F.Fragment,{children:[T&&(0,F.jsx)(KB,{series:D}),(0,F.jsx)(WB,{value:h?.cpuUtil,color:YB.cpuUtil,fmt:ZB})]}),children:_?(0,F.jsx)(JB,{releases:S,data:T?E(`cpuUtil`):m,series:T?D:[{key:`cpuUtil`,label:`Utilization`,color:YB.cpuUtil,kind:`area`}],fmt:ZB,yFmt:QB,onInspect:x}):(0,F.jsx)(nV,{})}),(0,F.jsx)(GB,{title:`CPU`,trend:(0,F.jsx)(UB,{now:h?.cpuTime,prev:g?.cpuTime,unit:`pct`}),right:(0,F.jsx)(KB,{series:k}),children:m.some(e=>e.cpuUser!=null)?(0,F.jsx)(JB,{releases:S,data:m,series:k,fmt:e=>`${e.toFixed(2)}ms`,yFmt:e=>`${Math.round(e)}ms`,onInspect:x,extra:()=>(0,F.jsx)(`div`,{className:`text-mute py-[2px]`,children:`CPU time per second of wall clock`})}):(0,F.jsx)(nV,{})})]}),(0,F.jsxs)(HB,{title:`Event loop`,sub:`queueing delay and how busy the loop is`,children:[(0,F.jsx)(GB,{title:T?`Event loop delay p99`:`Event loop delay`,trend:(0,F.jsx)(UB,{now:h?.elP99,prev:g?.elP99,unit:`pct`}),right:(0,F.jsx)(KB,{series:T?D:A}),children:(0,F.jsx)(JB,{releases:S,data:T?E(`elP99`):m,series:T?D:A,fmt:e=>B(e),yFmt:e=>`${Math.round(e)}ms`,onInspect:x})}),(0,F.jsx)(GB,{title:`Event loop utilization`,trend:(0,F.jsx)(UB,{now:h?.elu,prev:g?.elu,unit:`pp`}),right:(0,F.jsxs)(F.Fragment,{children:[T&&(0,F.jsx)(KB,{series:D}),(0,F.jsx)(WB,{value:h?.elu,color:YB.elu,fmt:ZB})]}),children:(0,F.jsx)(JB,{releases:S,data:T?E(`elu`):m,series:T?D:[{key:`elu`,label:`Utilization`,color:YB.elu,kind:`area`}],fmt:ZB,yFmt:QB})})]})]}):(0,F.jsx)(U,{}):(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No runtime samples in this window`,children:`The SDK samples every 15s by default (runtimeMetricsInterval).`})})]})}function nV(){return(0,F.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-center text-mute text-[12px] px-8`,children:eV})}function rV(){let e=I(),t=P(`/api/metrics${e.q()}`,[e.tick]),n=[...new Set((t.data||[]).map(e=>e.name))],[r,i]=(0,v.useState)(``),a=r&&n.includes(r)?r:n[0]||``,o=P(a?`/api/metrics/${encodeURIComponent(a)}${e.q()}`:null,[e.tick,a]);if(t.error)return(0,F.jsx)(W,{error:t.error});if(!t.data)return(0,F.jsx)(U,{});let s=t.data.filter(e=>e.name===a),c=[],l=[];if(o.data){let e=new Map,t=o.data.series.length>8;o.data.series.slice(0,8).forEach((t,n)=>{for(let r of t.points)e.has(r.t)||e.set(r.t,{t:r.t}),e.get(r.t)[`s${n}`]=r.value}),c=[...e.values()].sort((e,t)=>e.t-t.t),l=o.data.series.slice(0,8).map((e,t)=>({key:`s${t}`,label:Object.entries(e.labels).map(([e,t])=>`${e}=${t}`).join(`, `)||a,color:WR[t],type:e.type===`counter`?`bar`:`line`,stack:e.type===`counter`?`c`:void 0})),t&&l.push()}return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Wr,{size:18,className:`text-brand`}),title:`Custom metrics`,sub:(0,F.jsxs)(F.Fragment,{children:[`Counters, gauges and summaries your code reports: `,(0,F.jsxs)(`span`,{className:`mono`,children:[`obzerver.metrics.counter('orders_created', `,`{`,` channel `,`}`,`).inc()`]})]})}),n.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No custom metrics yet`,children:`Report business numbers with obzerver.metrics.counter / gauge / summary. They are aggregated in-process and flushed every 10s.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-[240px_1fr] gap-3`,children:[(0,F.jsx)(H,{pad:!1,title:`Metrics`,children:(0,F.jsx)(`div`,{className:`py-1.5`,children:n.map(e=>{let n=t.data.find(t=>t.name===e).type;return(0,F.jsxs)(`button`,{onClick:()=>i(e),className:`w-full text-left px-3.5 py-2 flex items-center justify-between gap-2 ${e===a?`bg-[#1d1d27]`:`hover:bg-[#16161e]`}`,children:[(0,F.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e}),(0,F.jsx)(`span`,{className:`pill !text-[10px]`,children:n})]},e)})})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(YR,{title:(0,F.jsx)(`span`,{className:`mono`,children:a}),sub:s[0]?.type===`counter`?`sum per bucket`:s[0]?.type===`gauge`?`last value per bucket`:`average per bucket`,series:l,children:o.data?(0,F.jsx)(JR,{data:c,series:l,height:260,fmt:e=>V(e)}):(0,F.jsx)(U,{})}),(0,F.jsx)(H,{title:`Series`,pad:!1,children:(0,F.jsxs)(`table`,{className:`tbl`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`Labels`}),(0,F.jsx)(`th`,{children:`Application`}),(0,F.jsx)(`th`,{className:`num`,children:`Points`}),(0,F.jsx)(`th`,{className:`num`,children:`Average`})]})}),(0,F.jsx)(`tbody`,{children:s.map((e,t)=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`mono text-[12px]`,children:Object.entries(e.labels).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`}),(0,F.jsx)(`td`,{className:`text-ink2`,children:e.service}),(0,F.jsx)(`td`,{className:`num`,children:V(e.points)}),(0,F.jsx)(`td`,{className:`num`,children:V(e.avg)})]},t))})]})})]})]})]})}var iV={regression:{kind:`crit`,label:`Regression`},changed:{kind:`warn`,label:`Changed`},clean:{kind:`good`,label:`Clean`},not_enough_data:{kind:`neutral`,label:`Not enough data`},baseline:{kind:`neutral`,label:`Baseline`}},aV=e=>e?new Date(e).toLocaleString(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1,timeZoneName:`short`}):``;function oV(){let e=I(),{data:t,error:n}=P(`/api/releases${e.q()}`,[e.tick]),[r]=zn(),[i,a]=(0,v.useState)(r.get(`version`)?{service:r.get(`service`)||``,version:r.get(`version`)}:null);if(n)return(0,F.jsx)(W,{error:n});if(!t)return(0,F.jsx)(U,{});let o=i||(t[0]?{service:t[0].service,version:t[0].version}:null);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(xi,{size:18,className:`text-brand`}),title:`Releases`,sub:(0,F.jsxs)(F.Fragment,{children:[`Each `,(0,F.jsx)(`span`,{className:`mono`,children:`serviceVersion`}),` compared with the one before it: 5xx rate, latency, new error groups, memory and CPU, and what changed in the code path.`]})}),t.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No releases yet`,children:`Set serviceVersion (or OBZERVER_VERSION / GIT_SHA) so every request is tagged with the release that served it.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[minmax(380px,40%)_1fr] gap-3 items-start`,children:[(0,F.jsx)(H,{pad:!1,children:(0,F.jsx)(Ha,{rows:t,rowKey:e=>e.service+e.version,onRow:e=>a({service:e.service,version:e.version}),cols:[{key:`v`,label:`Release`,render:e=>(0,F.jsxs)(`div`,{className:o&&o.service===e.service&&o.version===e.version?`text-brand2`:``,children:[(0,F.jsx)(`div`,{className:`mono font-medium`,children:e.version}),(0,F.jsx)(`div`,{className:`text-mute text-[11px]`,children:e.service})]})},{key:`verdict`,label:`Verdict`,render:e=>(0,F.jsx)(G,{kind:iV[e.verdict]?.kind||`neutral`,children:iV[e.verdict]?.label||e.verdict})},{key:`f`,label:`Deployed`,num:!0,render:e=>(0,F.jsx)(Xa,{tip:aV(e.first),className:`text-ink2`,children:Sa(e.first)})},{key:`n`,label:`Requests`,num:!0,render:e=>V(e.requests)}]})}),o&&(0,F.jsx)(sV,{service:o.service,version:o.version})]})]})}function sV({service:e,version:t}){let n=Qn(),r=ht(),{data:i,error:a}=P(`/api/releases/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,[e,t]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let o=iV[i.verdict]||iV.baseline,s=i.previousStats,c=i.stats,l=e=>e===`query`?(0,F.jsx)(Br,{size:12,style:{color:`#d95926`}}):e===`outbound`?(0,F.jsx)(Kr,{size:12,style:{color:`#e66767`}}):(0,F.jsx)(vr,{size:12,style:{color:`#d55181`}}),u=e=>({new:`New`,gone:`Gone`,more_frequent:`${e.multiplier}× more often`,less_frequent:`${e.multiplier}× as often`,slower:`${e.multiplier}× slower`})[e.change];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:`mono`,children:[e,`@`,t]}),(0,F.jsx)(G,{kind:o.kind,children:o.label})]}),sub:i.previous?`vs ${i.previous}`:void 0,children:[(0,F.jsx)(`div`,{className:`text-[13px] leading-relaxed`,children:i.summary}),s&&(0,F.jsxs)(`table`,{className:`tbl mt-3`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{}),(0,F.jsx)(`th`,{className:`num`,children:i.previous}),(0,F.jsx)(`th`,{className:`num`,children:t})]})}),(0,F.jsxs)(`tbody`,{children:[(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Requests`}),(0,F.jsx)(`td`,{className:`num`,children:V(s.requests)}),(0,F.jsx)(`td`,{className:`num`,children:V(c.requests)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`5xx rate`}),(0,F.jsx)(`td`,{className:`num`,children:ba(s.errorRate)}),(0,F.jsx)(`td`,{className:`num`,style:{color:c.errorRate>s.errorRate*1.5&&c.errorRate>.3?`#ff8a8a`:void 0},children:ba(c.errorRate)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`p95`}),(0,F.jsx)(`td`,{className:`num`,children:B(s.p95)}),(0,F.jsx)(`td`,{className:`num`,style:{color:c.p95>s.p95*1.3?`#ffb38a`:void 0},children:B(c.p95)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Average`}),(0,F.jsx)(`td`,{className:`num`,children:B(s.avg)}),(0,F.jsx)(`td`,{className:`num`,children:B(c.avg)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Served from`}),(0,F.jsx)(`td`,{className:`num text-[11.5px]`,children:(0,F.jsx)(Xa,{tip:aV(s.first),children:Ca(s.first,!0)})}),(0,F.jsx)(`td`,{className:`num text-[11.5px]`,children:(0,F.jsx)(Xa,{tip:aV(c.first),children:Ca(c.first,!0)})})]}),(i.runtime||i.previousRuntime)&&(()=>{let e=i.previousRuntime||{},t=i.runtime||{},n=(e,t,n,r)=>e!=null&&t!=null&&t>e*n&&t-e>r,r=e=>e==null?`—`:`${e>0?`+`:``}${e.toFixed(1)} MB/h`,a=i.evidence?.some(e=>e.type===`memory_leak`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`tr`,{children:(0,F.jsx)(`td`,{colSpan:3,className:`!pt-4 text-[10.5px] uppercase tracking-[.08em] text-mute`,children:`Runtime, per instance`})}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Heap used`}),(0,F.jsx)(`td`,{className:`num`,children:e.heapUsed==null?`—`:`${V(e.heapUsed)} MB`}),(0,F.jsx)(`td`,{className:`num`,style:{color:n(e.heapUsed,t.heapUsed,1.3,20)?`#ffb38a`:void 0},children:t.heapUsed==null?`—`:`${V(t.heapUsed)} MB`})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,title:`Least-squares slope of heap used over the time each version served`,children:`Heap growth`}),(0,F.jsx)(`td`,{className:`num`,children:r(e.heapGrowth)}),(0,F.jsx)(`td`,{className:`num`,style:{color:a?`#ff8a8a`:void 0},children:r(t.heapGrowth)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`RSS`}),(0,F.jsx)(`td`,{className:`num`,children:e.rss==null?`—`:`${V(e.rss)} MB`}),(0,F.jsx)(`td`,{className:`num`,children:t.rss==null?`—`:`${V(t.rss)} MB`})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:t.cpuUtil==null?`CPU`:`CPU utilization`}),(0,F.jsx)(`td`,{className:`num`,children:ba(e.cpuUtil??e.cpu)}),(0,F.jsx)(`td`,{className:`num`,style:{color:n(e.cpuUtil??e.cpu,t.cpuUtil??t.cpu,1.3,5)?`#ffb38a`:void 0},children:ba(t.cpuUtil??t.cpu)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Event loop p99`}),(0,F.jsx)(`td`,{className:`num`,children:B(e.elP99)}),(0,F.jsx)(`td`,{className:`num`,style:{color:n(e.elP99,t.elP99,1.5,10)?`#ffb38a`:void 0},children:B(t.elP99)})]})]})})()]})]})]}),(i.evidence?.length>0||i.newErrors?.length>0)&&(0,F.jsxs)(H,{title:`Evidence`,children:[(0,F.jsx)(`ul`,{className:`flex flex-col gap-1.5 list-disc pl-4`,children:i.evidence.map((e,t)=>(0,F.jsx)(`li`,{children:e.text},t))}),i.newErrors.length>0&&(0,F.jsx)(`div`,{className:`mt-3 flex flex-col`,children:i.newErrors.map(e=>(0,F.jsxs)(`button`,{className:`text-left flex items-center gap-2 py-1.5 border-b border-[#1d1d26] last:border-0 hover:text-white`,onClick:()=>r(n(`/errors/${e.fingerprint}`)),children:[(0,F.jsx)(G,{kind:`serious`,children:`new`}),(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:e.class}),(0,F.jsx)(`span`,{className:`text-mute truncate`,children:e.message}),(0,F.jsx)(`span`,{className:`ml-auto tabular-nums`,children:V(e.count)})]},e.fingerprint))})]}),(0,F.jsx)(H,{title:`What changed in the code`,sub:`queries, outbound calls and methods per request, beyond noise`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.changes||[],empty:(0,F.jsx)(Na,{title:`No call-pattern changes detected`}),cols:[{key:`t`,label:`Call`,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 min-w-0`,children:[l(e.type),(0,F.jsx)(`span`,{className:`mono text-[11.5px] truncate max-w-[420px]`,children:e.label})]})},{key:`c`,label:`Change`,render:e=>(0,F.jsx)(G,{kind:e.change===`gone`||e.change===`less_frequent`?`neutral`:e.change===`new`?`warn`:`serious`,children:u(e)})},{key:`p`,label:`Per request now`,num:!0,render:e=>e.perRequest==null?e.selfMs==null?`—`:`${B(e.selfMs)} self`:V(e.perRequest)}]})})]})}var cV=980,lV=160,uV=46;function dV(e){return e>5?`#d03b3b`:e>1?`#e07a7a`:`#199e70`}function fV(){let e=I(),t=Qn(),n=ht(),{data:r,error:i}=P(`/api/map${e.q()}`,[e.tick]),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{if(!r)return null;let e=r.nodes,t=r.edges,n=e.filter(e=>e.type===`service`||e.type===`queue`),i=e.filter(e=>e.type===`database`||e.type===`external`),a=new Map;for(let e of n)a.set(e.id,e.type===`queue`?0:1);for(let e=0;e<n.length;e++)for(let e of t){if(!a.has(e.from)||!a.has(e.to))continue;let t=a.get(e.from)+1;a.get(e.to)<t&&a.set(e.to,t)}let o=[...new Set(a.values())].sort((e,t)=>e-t).map(e=>n.filter(t=>a.get(t.id)===e)),s=e=>o.length===1?cV/2:110+e*760/(o.length-1),c=new Map,l=0;o.forEach((e,t)=>e.forEach((e,n)=>{c.set(e.id,{x:s(t),y:60+n*90}),l=Math.max(l,60+n*90)}));let u=l+150,d=new Map;for(let e of i){let n=t.filter(t=>t.to===e.id).sort((e,t)=>t.calls-e.calls)[0],r=n?n.from:`none`;d.has(r)||d.set(r,[]),d.get(r).push(e)}let f=[...d.entries()].sort((e,t)=>(c.get(e[0])?.x??0)-(c.get(t[0])?.x??0)).flatMap(([,e])=>e);return f.forEach((e,t)=>{let n=Math.floor(t/5),r=Math.min(5,f.length-n*5),i=t%5,a=r*180;c.set(e.id,{x:(cV-a)/2+i*180+lV/2,y:u+n*80})}),{nodes:e,edges:t,pos:c,height:Math.max(...[...c.values()].map(e=>e.y),100)+70}},[r]);if(i)return(0,F.jsx)(W,{error:i});if(!r||!l)return(0,F.jsx)(U,{});let u=a||s,d=e=>!u||e===u||l.edges.some(t=>t.from===u&&t.to===e||t.to===u&&t.from===e),f=s?l.nodes.find(e=>e.id===s):null,p=Math.max(1,...l.edges.map(e=>e.calls)),m=e=>e===`service`?Oi:e===`database`?Br:e===`queue`?Yr:Kr;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(ui,{size:18,className:`text-brand`}),title:`Service map`,sub:`Drawn from real traffic: applications and queues left to right in call order, their databases and external hosts below. Line weight is volume; red means errors.`}),l.nodes.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`Nothing to draw yet`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[1fr_300px] gap-3 items-start`,children:[(0,F.jsxs)(H,{pad:!1,children:[(0,F.jsxs)(`div`,{className:`flex gap-4 px-4 pt-3 text-[11.5px] text-ink2`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 h-[3px] rounded`,style:{background:`#199e70`}}),`healthy`]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 h-[3px] rounded`,style:{background:`#e07a7a`}}),`> 1% errors`]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 h-[3px] rounded`,style:{background:`#d03b3b`}}),`> 5% errors`]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 border-t-2 border-dashed`,style:{borderColor:`#7a7a90`}}),`service → service (shared trace ids)`]})]}),(0,F.jsxs)(`svg`,{viewBox:`0 0 ${cV} ${l.height}`,className:`w-full`,style:{minHeight:360},onClick:()=>c(null),children:[l.edges.map(e=>{let t=l.pos.get(e.from),n=l.pos.get(e.to);if(!t||!n)return null;let r=n.y>t.y+40,i=r?t.x:t.x+lV/2,a=r?t.y+uV/2:t.y,o=r?n.x:n.x-lV/2,s=r?n.y-uV/2:n.y,c=r?`M${i},${a} C${i},${(a+s)/2} ${o},${(a+s)/2} ${o},${s}`:`M${i},${a} C${(i+o)/2},${a} ${(i+o)/2},${s} ${o},${s}`,d=1.2+4.5*Math.sqrt(e.calls/p),f=!u||e.from===u||e.to===u,m=dV(e.errorRate),h=e.from.startsWith(`svc:`)&&e.to.startsWith(`svc:`);return(0,F.jsxs)(`g`,{opacity:f?1:.12,children:[(0,F.jsx)(`path`,{d:c,fill:`none`,stroke:m,strokeOpacity:.55,strokeWidth:d,strokeDasharray:h?`8 6`:void 0}),(0,F.jsx)(`path`,{d:c,fill:`none`,stroke:`#ffffff`,strokeOpacity:.55,strokeWidth:Math.max(1,d/2.5),strokeLinecap:`round`,className:`flow`,style:{strokeDasharray:`1 23`,animationDuration:`${Math.max(.5,3-2.5*(e.calls/p))}s`}}),(0,F.jsxs)(`text`,{x:(i+o)/2,y:(a+s)/2-6,textAnchor:`middle`,fontSize:`11`,fill:`#9a9aab`,paintOrder:`stroke`,stroke:`#13131a`,strokeWidth:4,children:[V(e.calls),e.errorRate>0?` · ${ba(e.errorRate,1)}`:``]})]},e.from+e.to)}),l.nodes.map(e=>{let t=l.pos.get(e.id);if(!t)return null;let n=m(e.type),r=dV(e.errorRate),i=s===e.id;return(0,F.jsxs)(`g`,{transform:`translate(${t.x-lV/2},${t.y-uV/2})`,opacity:d(e.id)?1:.25,style:{cursor:`pointer`},onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(null),onClick:t=>{t.stopPropagation(),c(e.id)},children:[(0,F.jsx)(`rect`,{width:lV,height:uV,rx:10,fill:`#16161e`,stroke:i?`#ff3d7f`:e.type===`service`?r:`#33333f`,strokeWidth:i?2:1.4}),(0,F.jsx)(`foreignObject`,{x:10,y:14,width:18,height:18,children:(0,F.jsx)(n,{size:16,color:e.type===`service`?`#ececf1`:`#9a9aab`})}),(0,F.jsx)(`text`,{x:34,y:20,fontSize:`13`,fontWeight:`600`,fill:`#ececf1`,children:e.label.length>18?`${e.label.slice(0,17)}…`:e.label}),(0,F.jsx)(`text`,{x:34,y:36,fontSize:`11`,fill:`#82829a`,children:e.type===`service`?`${V(e.calls)} req · ${B(e.avg)}`:e.type===`queue`?`queue · ${V(e.calls)} jobs`:`${e.type===`database`?`database`:`external`} · ${V(e.calls)}`})]},e.id)})]})]}),(0,F.jsx)(H,{title:f?f.label:`Details`,sub:f?.type,children:f?(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(Ka,{items:[[`Calls`,V(f.calls)],[`Errors`,`${V(f.errors)} (${ba(f.errorRate)})`],...f.avg==null?[]:[[`Avg`,B(f.avg)]]]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Callers`}),l.edges.filter(e=>e.to===f.id).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[12px] py-0.5`,children:[(0,F.jsx)(`span`,{children:l.nodes.find(t=>t.id===e.from)?.label}),(0,F.jsxs)(`span`,{className:`tabular-nums text-ink2`,children:[V(e.calls),` · `,B(e.avg)]})]},e.from)),!l.edges.some(e=>e.to===f.id)&&(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:`—`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Calls out to`}),l.edges.filter(e=>e.from===f.id).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[12px] py-0.5`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:l.nodes.find(t=>t.id===e.to)?.label}),(0,F.jsxs)(`span`,{className:`tabular-nums text-ink2`,children:[V(e.calls),` · `,B(e.avg)]})]},e.to)),!l.edges.some(e=>e.from===f.id)&&(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:`—`})]}),f.type===`service`&&(0,F.jsx)(`button`,{className:`btn`,onClick:()=>n(t(`/requests?service=${encodeURIComponent(f.label)}`)),children:`View requests`}),f.type===`database`&&(0,F.jsx)(`button`,{className:`btn`,onClick:()=>n(t(`/queries`)),children:`View statements`})]}):(0,F.jsx)(`div`,{className:`text-mute text-[12.5px]`,children:`Hover a node to isolate its connections; click it for numbers.`})})]})]})}var pV={error_rate:[{key:`mode`,label:`Mode`,type:`select`,options:[`threshold`,`anomaly`]},{key:`threshold`,label:`Threshold (%) / anomaly floor`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum requests`,type:`number`}],p95_latency:[{key:`mode`,label:`Mode`,type:`select`,options:[`threshold`,`anomaly`]},{key:`threshold`,label:`Threshold (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum requests`,type:`number`}],avg_latency:[{key:`threshold`,label:`Threshold (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum requests`,type:`number`}],throughput:[{key:`op`,label:`Fire when`,type:`select`,options:[`<`,`>`]},{key:`threshold`,label:`Requests per minute`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],job_failure_rate:[{key:`threshold`,label:`Threshold (%)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum runs`,type:`number`}],job_queue_wait:[{key:`threshold`,label:`p95 queue wait (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],silence:[{key:`windowMin`,label:`Silence tolerance (minutes)`,type:`number`,hint:`Never fires for a scope that has never reported.`}],job_silence:[{key:`windowMin`,label:`Silence tolerance (minutes)`,type:`number`}],log_pattern:[{key:`pattern`,label:`Message contains`,type:`text`},{key:`levels`,label:`Levels`,type:`levels`},{key:`logger`,label:`Logger / context`,type:`text`},{key:`threshold`,label:`Fire above N lines`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],new_error_group:[],secret_leak:[],event_loop_delay:[{key:`threshold`,label:`p99 delay (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],memory:[{key:`threshold`,label:`RSS (MB)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],cpu:[{key:`threshold`,label:`CPU (%)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],custom_metric:[{key:`metric`,label:`Metric name`,type:`text`},{key:`agg`,label:`Aggregation`,type:`select`,options:[`sum`,`avg`,`max`,`min`]},{key:`op`,label:`Fire when`,type:`select`,options:[`>`,`<`]},{key:`threshold`,label:`Threshold`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}]},mV=new Set([`error_rate`,`p95_latency`,`avg_latency`,`throughput`,`job_failure_rate`,`job_queue_wait`,`silence`,`job_silence`]);function hV(){let e=I(),t=Qn(),[n]=zn(),r=P(`/api/alerts`,[e.tick]),i=P(`/api/alerts/events${n.get(`rule`)?`?rule=${n.get(`rule`)}`:``}`,[e.tick]),[a,o]=(0,v.useState)(null);if((0,v.useEffect)(()=>{N(`/api/alerts/events/read`,{method:`POST`}).then(()=>e.refresh()).catch(()=>{})},[]),r.error)return(0,F.jsx)(W,{error:r.error});if(!r.data)return(0,F.jsx)(U,{});let s=r.data.types,c=e=>s[e]?.unit||``,l=()=>{r.reload(),i.reload()};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(gr,{size:18,className:`text-brand`}),title:`Alerts`,sub:`Thresholds or anomaly detection against the metric's recent baseline. Evaluated every 30 seconds.`,right:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{className:`btn`,onClick:async()=>{await N(`/api/alerts/evaluate`,{method:`POST`}),l()},children:[(0,F.jsx)(mi,{size:13}),`Evaluate now`]}),(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o({name:``,type:`error_rate`,params:{mode:`threshold`,threshold:5,windowMin:10,minRequests:20},channels:[{type:`inapp`}],enabled:!0,create_issue:!1}),children:[(0,F.jsx)(_i,{size:14}),`New rule`]})]})}),(0,F.jsx)(H,{pad:!1,title:`Rules`,children:(0,F.jsx)(Ha,{rows:r.data.rules,rowKey:e=>e.id,cols:[{key:`s`,label:`State`,render:e=>e.enabled?e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):(0,F.jsx)(G,{kind:`good`,children:`ok`}):(0,F.jsx)(G,{kind:`neutral`,children:`disabled`})},{key:`n`,label:`Rule`,render:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[s[e.type]?.family,` · `,s[e.type]?.label,e.params.mode===`anomaly`?` · anomaly`:e.params.threshold!=null&&e.type!==`silence`?` ${e.params.op||`>`} ${e.params.threshold}${c(e.type)}`:``,e.params.windowMin?` over ${e.params.windowMin}m`:``,e.params.service?` · ${e.params.service}`:``,e.params.route?` ${e.params.route}`:``]})]})},{key:`v`,label:`Current`,num:!0,render:e=>e.type===`new_error_group`||e.type===`secret_leak`?(0,F.jsx)(`span`,{className:`text-mute`,children:`event`}):e.last_value==null?`—`:`${V(Math.round(e.last_value*100)/100)}${c(e.type)?` ${c(e.type)}`:``}`},{key:`c`,label:`Channels`,render:e=>(0,F.jsxs)(`div`,{className:`flex gap-1`,children:[e.channels.map((e,t)=>(0,F.jsx)(`span`,{className:`pill`,children:e.type},t)),e.create_issue&&(0,F.jsx)(`span`,{className:`pill`,children:`issue`})]})},{key:`ch`,label:`Last change`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.last_change)})},{key:`a`,label:``,render:e=>(0,F.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Send test notification`,onClick:async()=>{_V((await N(`/api/alerts/${e.id}/test`,{method:`POST`})).deliveries)},children:(0,F.jsx)(Di,{size:13})}),e.type===`slo_burn`?(0,F.jsx)(Nn,{className:`btn btn-ghost h-7 px-2 text-[11.5px]`,to:t(`/slos?id=${e.params.sloId}`),title:`Managed by its SLO`,children:`Edit SLO`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Edit`,onClick:()=>o(e),children:(0,F.jsx)(pi,{size:13})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Delete`,onClick:async()=>{vV(e.name)&&(await N(`/api/alerts/${e.id}`,{method:`DELETE`}),l())},children:(0,F.jsx)(Ri,{size:13})})]})]})}]})}),(0,F.jsx)(H,{pad:!1,title:`History`,sub:`state transitions with per-channel delivery`,children:i.data?(0,F.jsx)(Ha,{rows:i.data,empty:(0,F.jsx)(Na,{title:`No alert events yet`}),maxHeight:480,cols:[{key:`t`,label:`Time`,render:e=>(0,F.jsx)(`span`,{className:`tabular-nums`,children:Ca(e.ts,!0)})},{key:`s`,label:`State`,render:e=>e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):e.state===`resolved`?(0,F.jsx)(G,{kind:`good`,children:`resolved`}):(0,F.jsx)(G,{kind:`neutral`,children:e.state})},{key:`r`,label:`Rule`,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.rule})},{key:`m`,label:`Message`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.message})},{key:`d`,label:`Delivery`,render:e=>(0,F.jsx)(`div`,{className:`flex gap-1`,children:e.deliveries.map((e,t)=>(0,F.jsxs)(`span`,{className:`pill`,style:{color:e.ok?`#5fd38a`:`#ff8a8a`},title:e.error||String(e.status||``),children:[e.type,` `,e.ok?`✓`:`✕`]},t))})}]}):(0,F.jsx)(U,{})}),a&&(0,F.jsx)(yV,{rule:a,types:s,onClose:()=>o(null),onSaved:()=>{o(null),l()}})]})}function gV({value:e,onChange:t}){let{data:n}=P(`/api/settings`),r=Qn();return(0,F.jsx)(K,{label:`Email to`,hint:n&&!n.email.configured?(0,F.jsxs)(`span`,{children:[`Email is not configured yet. `,(0,F.jsx)(Nn,{className:`link`,to:r(`/integrations/email`),children:`Set up SMTP in Integrations`}),` first.`]}):`Comma-separated addresses`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`oncall@company.com, ops@company.com`,value:e,onChange:e=>t(e.target.value)})})}function _V(e){let t=e.length?e.map(e=>`${e.type}: ${e.ok?`delivered`:`failed ${e.error||e.status||``}`}`).join(`
|
|
117
|
-
`):`No external channels configured (in-app only).`;window.alert(t)}function vV(e){return window.confirm(`Delete rule "${e}"?`)}function yV({rule:e,types:t,onClose:n,onSaved:r}){let i=I(),[a,o]=(0,v.useState)(JSON.parse(JSON.stringify(e))),[s,c]=(0,v.useState)(``),l=(e,t)=>o({...a,params:{...a.params,[e]:t}}),u=a.channels.find(e=>e.type===`webhook`)?.url||``,d=a.channels.find(e=>e.type===`slack`)?.url||``,f=a.channels.find(e=>e.type===`email`)?.to||``,p=e=>{let t=a.channels.filter(e=>e.type!==`email`);o({...a,channels:e.trim()?[...t,{type:`email`,to:e}]:t})},m=(e,t)=>{let n=a.channels.filter(t=>t.type!==e);o({...a,channels:t?[...n,{type:e,url:t}]:n})},h=a.params.mute||{};return(0,F.jsxs)(qa,{open:!0,onClose:n,title:a.id?`Edit alert rule`:`New alert rule`,wide:!0,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Name`,children:(0,F.jsx)(`input`,{className:`input`,value:a.name,placeholder:t[a.type]?.label,onChange:e=>o({...a,name:e.target.value})})}),(0,F.jsx)(K,{label:`Type`,children:(0,F.jsx)(`select`,{className:`select`,value:a.type,onChange:e=>o({...a,type:e.target.value,params:{windowMin:10}}),children:Object.entries(t).filter(([e])=>e!==`slo_burn`).map(([e,t])=>(0,F.jsxs)(`option`,{value:e,children:[t.family,` — `,t.label]},e))})}),mV.has(a.type)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(K,{label:`Application (optional)`,children:(0,F.jsxs)(`select`,{className:`select`,value:a.params.service||``,onChange:e=>l(`service`,e.target.value||void 0),children:[(0,F.jsx)(`option`,{value:``,children:`All applications`}),i.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]})}),(0,F.jsx)(K,{label:`Route / job (optional)`,hint:`e.g. "POST /checkout"`,children:(0,F.jsx)(`input`,{className:`input`,value:a.params.route||``,onChange:e=>l(`route`,e.target.value||void 0)})})]}),(pV[a.type]||[]).map(e=>(0,F.jsx)(K,{label:e.label,hint:e.hint,children:e.type===`select`?(0,F.jsx)(`select`,{className:`select`,value:a.params[e.key]??e.options[0],onChange:t=>l(e.key,t.target.value),children:e.options.map(e=>(0,F.jsx)(`option`,{children:e},e))}):e.type===`levels`?(0,F.jsx)(`div`,{className:`flex gap-2 h-[30px] items-center`,children:[`error`,`warn`,`info`,`debug`].map(e=>(0,F.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:(a.params.levels||[]).includes(e),onChange:t=>l(`levels`,t.target.checked?[...a.params.levels||[],e]:(a.params.levels||[]).filter(t=>t!==e))}),e]},e))}):(0,F.jsx)(`input`,{className:`input`,type:e.type===`number`?`number`:`text`,value:a.params[e.key]??``,onChange:t=>l(e.key,e.type===`number`?t.target.value===``?void 0:Number(t.target.value):t.target.value)})},e.key))]}),(0,F.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-line grid grid-cols-2 gap-3`,children:[(0,F.jsx)(`div`,{className:`col-span-2 text-[12px] font-semibold`,children:`Notify`}),(0,F.jsx)(K,{label:`Slack incoming webhook URL`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://hooks.slack.com/services/…`,value:d,onChange:e=>m(`slack`,e.target.value)})}),(0,F.jsx)(K,{label:`Generic webhook URL`,hint:`POSTs JSON { rule, state, value, message, link }`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://…`,value:u,onChange:e=>m(`webhook`,e.target.value)})}),(0,F.jsx)(`div`,{className:`col-span-2`,children:(0,F.jsx)(gV,{value:f,onChange:e=>p(e)})}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:a.create_issue,onChange:e=>o({...a,create_issue:e.target.checked})}),`Open an issue when it fires`]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),`Enabled`]}),(0,F.jsxs)(`div`,{className:`col-span-2 flex items-center gap-2 text-[12.5px] flex-wrap`,children:[(0,F.jsx)(`span`,{className:`text-ink2`,children:`Mute daily (UTC) from`}),(0,F.jsx)(`input`,{className:`input w-16`,type:`number`,min:0,max:23,value:h.from??``,onChange:e=>l(`mute`,{...h,from:e.target.value===``?void 0:Number(e.target.value)})}),(0,F.jsx)(`span`,{className:`text-ink2`,children:`to`}),(0,F.jsx)(`input`,{className:`input w-16`,type:`number`,min:0,max:24,value:h.to??``,onChange:e=>l(`mute`,{...h,to:e.target.value===``?void 0:Number(e.target.value)})}),(0,F.jsx)(`span`,{className:`text-mute`,children:`hours (leave empty for no mute)`})]})]}),s&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] mt-3`,children:s}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 mt-4`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:n,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:async()=>{try{let e={...a,channels:a.channels.some(e=>e.type===`inapp`)?a.channels:[{type:`inapp`},...a.channels]};a.id?await N(`/api/alerts/${a.id}`,{method:`PUT`,json:e}):await N(`/api/alerts`,{method:`POST`,json:e}),r()}catch(e){c(e.message)}},children:`Save rule`})]})]})}var bV={open:{kind:`crit`,label:`Open`},in_progress:{kind:`warn`,label:`In progress`},verifying:{kind:`serious`,label:`Verifying`},unverified:{kind:`neutral`,label:`Unverified`},resolved:{kind:`good`,label:`Resolved`},closed:{kind:`good`,label:`Closed`}},xV={critical:`#d03b3b`,high:`#ec835a`,medium:`#fab219`,low:`#82829a`};function SV(){let e=I(),t=Qn(),n=ht(),[r,i]=(0,v.useState)(`active`),[a,o]=(0,v.useState)(!1),{data:s,error:c}=P(`/api/issues`,[e.tick]);if(c)return(0,F.jsx)(W,{error:c});if(!s)return(0,F.jsx)(U,{});let l=s.filter(e=>r===`all`||(r===`active`?![`closed`,`resolved`].includes(e.status):[`closed`,`resolved`].includes(e.status)));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Pr,{size:18,className:`text-brand`}),title:`Issues`,sub:`Track what needs fixing. Issues linked to an error or route verify themselves against the next release and close or reopen automatically.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,F.jsx)(_i,{size:14}),`New issue`]})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`active`,label:`Active`},{id:`done`,label:`Done`},{id:`all`,label:`All`}]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:(0,F.jsx)(Ha,{rows:l,onRow:e=>n(t(`/issues/${e.id}`)),empty:(0,F.jsx)(Na,{title:`No issues`,children:`Create one from an error group, a failed execution, or let an alert open it.`}),cols:[{key:`id`,label:`#`,render:e=>(0,F.jsxs)(`span`,{className:`text-mute`,children:[`#`,e.id]}),width:50},{key:`t`,label:`Title`,render:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[e.service||`no service`,e.sourceType?` · from ${e.sourceType}`:``]})]})},{key:`s`,label:`Status`,render:e=>(0,F.jsx)(G,{kind:bV[e.status]?.kind||`neutral`,children:bV[e.status]?.label||e.status})},{key:`sev`,label:`Severity`,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 capitalize`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:xV[e.severity]}}),e.severity]})},{key:`tk`,label:`Ticket`,render:e=>e.ticket?(0,F.jsx)(oz,{ticket:e.ticket}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`o`,label:`Owner`,render:e=>e.owner||(0,F.jsx)(`span`,{className:`text-mute`,children:`unassigned`})},{key:`d`,label:`Due`,render:e=>e.due?(0,F.jsx)(`span`,{style:{color:e.due<Date.now()&&![`closed`,`resolved`].includes(e.status)?`#ff8a8a`:void 0},children:Ca(e.due,!0).split(` `).slice(0,2).join(` `)}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`u`,label:`Updated`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.updated)})}]})})}),a&&(0,F.jsx)(CV,{onClose:()=>o(!1),onCreated:e=>n(t(`/issues/${e}`))})]})}function CV({onClose:e,onCreated:t}){let n=I(),[r,i]=(0,v.useState)({title:``,severity:`medium`,owner:``,description:``,service:``,sourceType:``,sourceRef:``}),{settings:a,connected:o}=iz(),[s,c]=(0,v.useState)(null),l=s??(a?.autoCreate||``),[u,d]=(0,v.useState)(``);return(0,F.jsx)(qa,{open:!0,onClose:e,title:`New issue`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(K,{label:`Title`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,value:r.title,onChange:e=>i({...r,title:e.target.value})})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Severity`,children:(0,F.jsx)(`select`,{className:`select`,value:r.severity,onChange:e=>i({...r,severity:e.target.value}),children:Object.keys(xV).map(e=>(0,F.jsx)(`option`,{children:e},e))})}),(0,F.jsx)(K,{label:`Owner`,children:(0,F.jsx)(`input`,{className:`input`,value:r.owner,onChange:e=>i({...r,owner:e.target.value})})}),(0,F.jsx)(K,{label:`Application`,children:(0,F.jsxs)(`select`,{className:`select`,value:r.service,onChange:e=>i({...r,service:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`—`}),n.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]})}),(0,F.jsx)(K,{label:`Measurable route (optional)`,hint:`e.g. "POST /checkout" enables auto-verification`,children:(0,F.jsx)(`input`,{className:`input`,value:r.sourceRef,onChange:e=>i({...r,sourceRef:e.target.value,sourceType:e.target.value?`operation`:``})})})]}),(0,F.jsx)(K,{label:`Description`,children:(0,F.jsx)(`textarea`,{className:`input`,rows:4,value:r.description,onChange:e=>i({...r,description:e.target.value})})}),o.length>0&&(0,F.jsx)(K,{label:`Also create a ticket in`,children:(0,F.jsxs)(`select`,{className:`select w-56`,value:l,onChange:e=>c(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`Don't create a ticket`}),o.map(e=>(0,F.jsx)(`option`,{value:e,children:rz[e]},e))]})}),u&&(0,F.jsx)(`div`,{className:`text-[12.5px] text-[#ff8a8a]`,children:u}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:e,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!r.title,onClick:async()=>{let e=await N(`/api/issues`,{method:`POST`,json:{...r,tracker:l||void 0}});e.ticketError&&window.alert(`Issue #${e.id} was created, but the ticket was not: ${e.ticketError}`),t(e.id)},children:`Create`})]})]})})}var wV={fixed:{kind:`good`,label:`Fixed`},not_fixed:{kind:`crit`,label:`Not fixed`},too_early:{kind:`warn`,label:`Too early to tell`},not_enough_data:{kind:`neutral`,label:`Not enough data`}};function TV(){let{id:e}=yt(),t=I(),n=Qn(),r=ht(),{data:i,error:a,reload:o}=P(`/api/issues/${e}`,[e,t.tick]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),{connected:p}=iz(),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(!1),y=async e=>{_(!0),h(null);try{h({ok:!0,text:await e()}),o()}catch(e){h({ok:!1,text:e.message})}finally{_(!1)}};if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let b=async n=>{await N(`/api/issues/${e}`,{method:`PATCH`,json:n}),o(),t.refresh()},x=i.incident,S=(t.meta?.versions||[]).filter(e=>!i.service||e.service===i.service).map(e=>e.version),C=[`Issue #${i.id}: ${i.title}`,`Status: ${i.status} · Severity: ${i.severity}${i.owner?` · Owner: ${i.owner}`:``}`,x?`Error: ${x.error}\nOperation: ${x.operation}\nStarted: ${new Date(x.start).toISOString()}${x.end?`\nEnded: ${new Date(x.end).toISOString()}`:``}\nIntroduced in: ${x.introducedIn||`unknown`}${i.fixVersion?`\nFixed in: ${i.fixVersion}`:``}\nOccurrences: ${x.occurrences}\nAffected users: ${x.users.length}${x.customers.length?`\nCustomers: ${x.customers.join(`, `)}`:``}`:``,`Timeline:`,...i.timeline.map(e=>`- ${new Date(e.ts).toISOString()} ${e.text}`)].filter(Boolean).join(`
|
|
118
|
-
`),w=i.sourceType===`error`?`/errors/${i.sourceRef}`:i.sourceType===`execution`?`/executions/${i.sourceRef}`:i.sourceType===`alert`?`/alerts`:null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Nn,{to:n(`/issues`),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:`← Issues`}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsxs)(`span`,{className:`text-mute text-[19px]`,children:[`#`,i.id]}),(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,children:i.title})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,F.jsx)(G,{kind:bV[i.status]?.kind||`neutral`,children:bV[i.status]?.label||i.status}),(0,F.jsxs)(`span`,{className:`text-mute text-[12px]`,children:[`opened `,Sa(i.created),i.sourceType?` from ${i.sourceType}`:``]}),w&&(0,F.jsx)(`button`,{className:`link text-[12px]`,onClick:()=>r(n(w)),children:`view source →`})]})]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(Ba,{text:C,label:`Copy summary`}),[`open`,`in_progress`,`unverified`].includes(i.status)&&(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>b({status:`resolved`}),children:`Mark resolved`}),[`resolved`,`closed`,`verifying`].includes(i.status)&&(0,F.jsx)(`button`,{className:`btn`,onClick:()=>b({status:`open`}),children:`Reopen`})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`@5xl:col-span-2 flex flex-col gap-3`,children:[i.description&&(0,F.jsx)(H,{title:`Description`,children:(0,F.jsx)(`div`,{className:`whitespace-pre-wrap text-[13px]`,children:i.description})}),x&&(0,F.jsx)(H,{title:`Incident record`,children:(0,F.jsx)(Ka,{items:[[`Error`,(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:x.error})],[`Operation`,(0,F.jsx)(`span`,{className:`mono`,children:x.operation})],[`Started`,Ca(x.start,!0)],[`Ended`,x.end?Ca(x.end,!0):`ongoing`],[`Last seen`,Sa(x.lastSeen)],[`Introduced in`,(0,F.jsx)(`span`,{className:`mono`,children:x.introducedIn||`—`})],[`Fixed in`,(0,F.jsx)(`span`,{className:`mono`,children:i.fixVersion||`—`})],[`Occurrences`,x.occurrences],[`Users affected`,x.users.length],[`Customers`,x.customers.join(`, `)||`—`]]})}),(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(ji,{size:14}),`Did a release fix this?`]}),children:[(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(K,{label:`Release`,children:(0,F.jsxs)(`select`,{className:`select w-48`,value:d,onChange:e=>f(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:i.fixVersion?`Fix version (${i.fixVersion})`:`Since resolution`}),[...new Set(S)].map(e=>(0,F.jsx)(`option`,{children:e},e))]})}),(0,F.jsx)(`button`,{className:`btn`,onClick:async()=>u(await N(`/api/issues/${e}/verify${d?`?version=${encodeURIComponent(d)}`:``}`)),children:`Check`}),d&&d!==i.fixVersion&&(0,F.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>b({fixVersion:d}),children:`Set as fix version`})]}),l&&(0,F.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(G,{kind:wV[l.verdict]?.kind||`neutral`,children:wV[l.verdict]?.label||l.verdict}),(0,F.jsx)(`span`,{className:`text-ink2`,children:l.reason})]}),l.newErrorGroupsInRelease>0&&(0,F.jsxs)(`div`,{className:`text-mute text-[12px]`,children:[`Note: `,l.newErrorGroupsInRelease,` new error group(s) appeared in that release.`]})]}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px] mt-3`,children:`Marking an issue with a measurable scope as resolved moves it to Verifying: it closes on its own once the fix holds, reopens if the failure returns, and becomes Unverified after 7 days without a conclusion.`})]}),(0,F.jsxs)(H,{title:`Timeline`,children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:[...i.timeline].reverse().map((e,t)=>(0,F.jsxs)(`div`,{className:`flex gap-3 text-[12.5px]`,children:[(0,F.jsx)(`span`,{className:`text-mute w-[130px] shrink-0 tabular-nums`,children:Ca(e.ts,!0)}),(0,F.jsx)(`span`,{children:e.text})]},t))}),(0,F.jsxs)(`form`,{className:`flex gap-2 mt-3`,onSubmit:e=>{e.preventDefault(),s&&(b({comment:s}),c(``))},children:[(0,F.jsx)(`input`,{className:`input flex-1`,placeholder:`Add a comment`,value:s,onChange:e=>c(e.target.value)}),(0,F.jsx)(`button`,{className:`btn`,children:`Comment`})]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsxs)(H,{title:`Ticket`,sub:i.ticket?`kept in step with this issue`:p.length?`track the work where your team works`:void 0,children:[i.ticket?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsx)(`div`,{children:(0,F.jsx)(oz,{ticket:i.ticket})}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[i.ticket.syncedAt?`Checked ${Sa(i.ticket.syncedAt)}. `:``,`Closing it starts verification here; the result is posted on the ticket.`]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn h-7`,disabled:g,onClick:()=>y(async()=>(await N(`/api/issues/${e}/ticket/sync`,{method:`POST`}),`Synced.`)),children:[(0,F.jsx)(bi,{size:12}),`Sync now`]}),(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,disabled:g,onClick:()=>y(async()=>window.confirm(`Unlink the ticket? It is not deleted.`)?(await N(`/api/issues/${e}/ticket`,{method:`DELETE`}),`Unlinked.`):`Kept.`),children:[(0,F.jsx)(Hi,{size:12}),`Unlink`]})]})]}):p.length?(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.map(t=>(0,F.jsxs)(`button`,{className:`btn`,disabled:g,onClick:()=>y(async()=>{let n=await N(`/api/issues/${e}/ticket`,{method:`POST`,json:{provider:t}});return`Created ${rz[t]} ${n.key}.`}),children:[`Create in `,rz[t]]},t))}):(0,F.jsxs)(`div`,{className:`text-mute text-[12.5px]`,children:[`Connect GitHub or Linear in `,(0,F.jsx)(`button`,{className:`link`,onClick:()=>r(n(`/integrations`)),children:`Integrations`}),` to open tickets from issues.`]}),m&&(0,F.jsx)(`div`,{className:`text-[12px] mt-2`,style:{color:m.ok?`#5fd38a`:`#ff8a8a`},children:m.text})]}),(0,F.jsx)(H,{title:`Details`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(K,{label:`Status`,children:(0,F.jsx)(`select`,{className:`select`,value:i.status,onChange:e=>b({status:e.target.value}),children:Object.entries(bV).map(([e,t])=>(0,F.jsx)(`option`,{value:e,children:t.label},e))})}),(0,F.jsx)(K,{label:`Severity`,children:(0,F.jsx)(`select`,{className:`select`,value:i.severity,onChange:e=>b({severity:e.target.value}),children:Object.keys(xV).map(e=>(0,F.jsx)(`option`,{children:e},e))})}),(0,F.jsx)(K,{label:`Owner`,children:(0,F.jsx)(`input`,{className:`input`,defaultValue:i.owner||``,onBlur:e=>e.target.value!==(i.owner||``)&&b({owner:e.target.value}),placeholder:`name or email`})}),(0,F.jsx)(K,{label:`Due date`,children:(0,F.jsx)(`input`,{className:`input`,type:`date`,defaultValue:i.due?new Date(i.due).toISOString().slice(0,10):``,onChange:e=>b({due:e.target.value?new Date(e.target.value).getTime():null})})}),(0,F.jsx)(Ka,{items:[[`Application`,i.service||`—`],[`Created`,Ca(i.created,!0)],[`Updated`,Sa(i.updated)]]}),(0,F.jsx)(`button`,{className:`btn btn-ghost justify-center text-[#ff8a8a]`,onClick:async()=>{window.confirm(`Delete this issue?`)&&(await N(`/api/issues/${e}`,{method:`DELETE`}),r(n(`/issues`)))},children:`Delete issue`})]})})]})]})]})}var EV={healthy:{kind:`good`,label:`Healthy`},at_risk:{kind:`warn`,label:`At risk`},burning:{kind:`serious`,label:`Burning`},exhausted:{kind:`crit`,label:`Budget exhausted`},no_data:{kind:`neutral`,label:`No data`}},DV=e=>e==null?`#55556a`:e<=0?GR.crit:e<.25?GR.serious:e<.5?GR.warn:GR.good,OV=(e,t)=>e==null?void 0:e>t?`#ff8a8a`:e>1?`#ffc85a`:void 0,kV=e=>`${e.service||`all applications`}${e.operation?` · ${e.operation}`:``}${e.kind===`job`?` (jobs)`:``}`,AV=e=>`${e.kind===`job`?`runs succeed`:`requests succeed (non-5xx)`}${e.latencyMs?` and finish within ${e.latencyMs}ms`:``}`;function jV({value:e}){let t=e==null?0:Math.max(0,Math.min(1,e))*100;return(0,F.jsx)(`div`,{className:`h-1.5 rounded-full bg-[#24242e] overflow-hidden`,title:e==null?`no data`:`${(e*100).toFixed(1)}% budget left`,children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${t}%`,background:DV(e)}})})}function MV(){let e=I(),[t,n]=zn(),{data:r,error:i,reload:a}=P(`/api/slos`,[e.tick]),[o,s]=(0,v.useState)(null),c=Number(t.get(`id`))||r?.[0]?.slo.id||null,l=e=>{let r=new URLSearchParams(t);r.set(`id`,String(e)),n(r,{replace:!0})};return i?(0,F.jsx)(W,{error:i}):r?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Li,{size:18,className:`text-brand`}),title:`SLOs`,sub:`Service level objectives on real traffic: the share of good requests or job runs over a rolling window, the error budget left, and burn-rate alerts that fire before the budget runs out.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s({target:99.5,windowDays:7,kind:`http`,channels:[{type:`inapp`}]}),children:[(0,F.jsx)(_i,{size:14}),`New SLO`]})}),r.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No SLOs yet`,icon:(0,F.jsx)(Li,{size:22}),children:`An SLO says how reliable something must be, e.g. 99.5% of checkout requests succeed over 7 days. Obzerver tracks the error budget and alerts on fast and slow burn.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[360px_1fr] gap-3 items-start`,children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,F.jsxs)(`button`,{onClick:()=>l(e.slo.id),className:`card text-left px-3.5 py-3 flex flex-col gap-2 ${c===e.slo.id?`!border-[#5a2340]`:`hover:border-line2`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:e.slo.name}),(0,F.jsx)(G,{kind:EV[e.state].kind,children:EV[e.state].label})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] truncate`,children:[kV(e.slo),` · `,e.slo.target,`% over `,e.slo.windowDays,`d`]}),(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[18px] font-semibold tabular-nums`,children:e.sli==null?`—`:`${e.sli}%`}),(0,F.jsx)(`span`,{className:`text-[11.5px] tabular-nums`,style:{color:DV(e.budgetRemaining)},children:e.budgetRemaining==null?`no data`:`${(e.budgetRemaining*100).toFixed(1)}% budget left`})]}),(0,F.jsx)(jV,{value:e.budgetRemaining})]},e.slo.id))}),c&&(0,F.jsx)(NV,{id:c,onEdit:e=>s(e),onDeleted:()=>{let e=new URLSearchParams(t);e.delete(`id`),n(e),a()}})]}),o&&(0,F.jsx)(FV,{slo:o,onClose:()=>s(null),onSaved:e=>{s(null),a(),l(e)}})]}):(0,F.jsx)(U,{})}function NV({id:e,onEdit:t,onDeleted:n}){let r=I(),i=Qn(),{data:a,error:o}=P(`/api/slos/${e}`,[e,r.tick]);if(o)return(0,F.jsx)(W,{error:o});if(!a)return(0,F.jsx)(U,{});let s=a.slo,c=a.history.points,l=[[`5 minutes`,a.burn.m5,14.4],[`30 minutes`,a.burn.m30,6],[`1 hour`,a.burn.h1,14.4],[`6 hours`,a.burn.h6,6],[`1 day`,a.burn.d1,1]];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[s.name,(0,F.jsx)(G,{kind:EV[a.state].kind,children:EV[a.state].label})]}),right:(0,F.jsxs)(`div`,{className:`flex gap-1`,children:[(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>t(s),children:[(0,F.jsx)(pi,{size:13}),`Edit`]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Delete`,onClick:async()=>{window.confirm(`Delete SLO "${s.name}" and its burn alerts?`)&&(await N(`/api/slos/${s.id}`,{method:`DELETE`}),n())},children:(0,F.jsx)(Ri,{size:13})})]}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[s.description&&(0,F.jsx)(`div`,{className:`text-ink2`,children:s.description}),(0,F.jsxs)(`div`,{className:`text-[13px]`,children:[(0,F.jsxs)(`b`,{children:[s.target,`%`]}),` of `,s.operation?(0,F.jsx)(za,{name:s.operation}):(0,F.jsx)(`span`,{children:s.kind===`job`?`job runs`:`requests`}),` in `,(0,F.jsx)(`b`,{children:s.service||`all applications`}),` `,AV(s),`, over a rolling `,(0,F.jsxs)(`b`,{children:[s.windowDays,`-day`]}),` window.`]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-4 gap-3`,children:[(0,F.jsx)(PV,{label:`Achieved`,value:a.sli==null?`—`:`${a.sli}%`,sub:`target ${s.target}%`,color:a.sli!=null&&a.sli<s.target?`#ff8a8a`:void 0}),(0,F.jsx)(PV,{label:`Error budget left`,value:a.budgetRemaining==null?`—`:`${(a.budgetRemaining*100).toFixed(1)}%`,color:DV(a.budgetRemaining),sub:(0,F.jsx)(jV,{value:a.budgetRemaining})}),(0,F.jsx)(PV,{label:`Bad events left`,value:a.budgetEventsLeft==null?`—`:V(Math.max(0,a.budgetEventsLeft)),sub:`${V(a.bad)} bad of ${V(a.total)}`}),(0,F.jsx)(PV,{label:`Burn rate (1h)`,value:a.burn.h1==null?`—`:`${a.burn.h1}×`,sub:`1× spends the budget exactly by window end`,color:OV(a.burn.h1,14.4)})]}),a.partialWindow&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-[#ffc85a]`,children:[(0,F.jsx)(Vi,{size:13}),a.dataSince?`Data only goes back to ${Ca(a.dataSince,!0)}`:`No data yet`,`, so this window is partial.`,s.windowDays>a.retentionDays&&` Retention is ${a.retentionDays} days; raise OBZERVER_RETENTION_DAYS to cover the full ${s.windowDays}-day window.`]})]})}),(0,F.jsx)(YR,{title:`Error budget burn-down`,sub:`share of the window's budget still unspent`,children:(0,F.jsx)(JR,{data:c,series:[{key:`budget`,label:`Budget left`,color:WR[0],type:`area`}],height:190,fmt:e=>`${e.toFixed(1)}%`,refLines:[{y:0,label:`exhausted`,color:GR.crit}],zoom:!1})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @7xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:`SLI per bucket`,sub:`good share per ${a.history.bucketMs>=864e5?`day`:a.history.bucketMs>=36e5?`${a.history.bucketMs/36e5}h`:`30m`}`,children:(0,F.jsx)(JR,{data:c,series:[{key:`sli`,label:`SLI`,color:WR[2],type:`line`}],height:170,fmt:e=>`${e.toFixed(2)}%`,refLines:[{y:s.target,label:`target ${s.target}%`,color:`#ff6b9d`}],yDomain:[`auto`,100],zoom:!1})}),(0,F.jsx)(H,{title:`Burn rates`,sub:`multiples of the sustainable rate`,children:(0,F.jsxs)(`table`,{className:`tbl`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`Lookback`}),(0,F.jsx)(`th`,{className:`num`,children:`Burn rate`}),(0,F.jsx)(`th`,{className:`num`,children:`Error rate`})]})}),(0,F.jsx)(`tbody`,{children:l.map(([e,t,n])=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:e}),(0,F.jsx)(`td`,{className:`num`,style:{color:OV(t,n)},children:t==null?`—`:`${t}×`}),(0,F.jsx)(`td`,{className:`num text-ink2`,children:t==null?`—`:ba(t*(100-s.target))})]},e))})]})})]}),(0,F.jsxs)(H,{title:`Burn-rate alerts`,sub:`created and kept in step with this SLO`,pad:!1,children:[(0,F.jsx)(Ha,{rows:a.rules,cols:[{key:`s`,label:`State`,render:e=>e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):(0,F.jsx)(G,{kind:`good`,children:`ok`})},{key:`n`,label:`Rule`,render:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{children:e.params.speed===`fast`?`Fast burn`:`Slow burn`}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:e.params.speed===`fast`?`over 14.4× on both the last 1h and 5m (about 2% of a 30-day budget in an hour)`:`over 6× on both the last 6h and 30m (about 5% of a 30-day budget in 6 hours)`})]})},{key:`v`,label:`Current`,num:!0,render:e=>e.last_value==null?`—`:`${e.last_value.toFixed(1)}×`},{key:`c`,label:`Notifies`,render:()=>(0,F.jsx)(`div`,{className:`flex gap-1`,children:s.channels.map((e,t)=>(0,F.jsx)(`span`,{className:`pill`,children:e.type},t))})}]}),a.events.length>0&&(0,F.jsx)(`div`,{className:`border-t border-line`,children:a.events.slice(0,8).map(e=>(0,F.jsxs)(`div`,{className:`flex gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-mute w-32 shrink-0`,children:Sa(e.ts)}),e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):(0,F.jsx)(G,{kind:`good`,children:e.state}),(0,F.jsx)(`span`,{className:`text-ink2 truncate`,children:e.message})]},e.id))}),(0,F.jsxs)(`div`,{className:`px-3.5 py-2 border-t border-line text-[11.5px] text-mute`,children:[`Delivery history is on `,(0,F.jsx)(Nn,{className:`link`,to:i(`/alerts`),children:`Alerts`}),`.`]})]})]})}function PV({label:e,value:t,sub:n,color:r}){return(0,F.jsxs)(`div`,{className:`rounded-lg border border-line px-3 py-2.5 flex flex-col gap-1`,children:[(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:e}),(0,F.jsx)(`div`,{className:`text-[20px] font-semibold tabular-nums leading-none`,style:r?{color:r}:void 0,children:t}),n&&(0,F.jsx)(`div`,{className:`text-mute text-[11px]`,children:n})]})}function FV({slo:e,onClose:t,onSaved:n}){let r=I(),[i,a]=(0,v.useState)({...e,channels:e.channels??[{type:`inapp`}]}),[o,s]=(0,v.useState)(``),c=P(`/api/operations?range=604800000&kind=${i.kind||`http`}${i.service?`&service=${encodeURIComponent(i.service)}`:``}`,[i.kind,i.service]),l=e=>i.channels?.find(t=>t.type===e),u=(e,t)=>{let n=(i.channels||[]).filter(t=>t.type!==e);a({...i,channels:t?[...n,{type:e,...t}]:n})};(0,v.useEffect)(()=>s(``),[i]);let d=async()=>{try{let e={...i,channels:[{type:`inapp`},...(i.channels||[]).filter(e=>e.type!==`inapp`)]};n((i.id?await N(`/api/slos/${i.id}`,{method:`PUT`,json:e}):await N(`/api/slos`,{method:`POST`,json:e})).id)}catch(e){s(e.message)}},f=i.target?100-i.target:null;return(0,F.jsxs)(qa,{open:!0,onClose:t,title:i.id?`Edit SLO`:`New SLO`,wide:!0,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Name`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,placeholder:`Checkout availability`,value:i.name||``,onChange:e=>a({...i,name:e.target.value})})}),(0,F.jsx)(K,{label:`Measures`,children:(0,F.jsx)(Va,{value:i.kind||`http`,onChange:e=>a({...i,kind:e,operation:null}),options:[{id:`http`,label:`HTTP requests`},{id:`job`,label:`Job runs`}]})}),(0,F.jsx)(K,{label:`Application`,children:(0,F.jsxs)(`select`,{className:`select`,value:i.service||``,onChange:e=>a({...i,service:e.target.value||null,operation:null}),children:[(0,F.jsx)(`option`,{value:``,children:`All applications`}),r.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]})}),(0,F.jsxs)(K,{label:i.kind===`job`?`Job (optional)`:`Route (optional)`,hint:`leave empty to cover everything in the application`,children:[(0,F.jsx)(`input`,{className:`input mono`,list:`slo-ops`,placeholder:i.kind===`job`?`send-email`:`POST /checkout`,value:i.operation||``,onChange:e=>a({...i,operation:e.target.value||null})}),(0,F.jsx)(`datalist`,{id:`slo-ops`,children:[...new Set((c.data||[]).map(e=>e.name))].map(e=>(0,F.jsx)(`option`,{value:e},e))})]}),(0,F.jsx)(K,{label:`Target (% good)`,hint:f==null?void 0:`allows ${f.toFixed(3).replace(/0+$/,``).replace(/\.$/,``)}% bad events`,children:(0,F.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,F.jsx)(`input`,{className:`input w-28`,type:`number`,step:`0.01`,min:`1`,max:`99.999`,value:i.target??``,onChange:e=>a({...i,target:e.target.value===``?void 0:Number(e.target.value)})}),[99,99.5,99.9,99.95].map(e=>(0,F.jsx)(`button`,{type:`button`,className:`btn h-7 px-2 ${i.target===e?`btn-primary`:``}`,onClick:()=>a({...i,target:e}),children:e},e))]})}),(0,F.jsx)(K,{label:`Window`,children:(0,F.jsx)(Va,{value:String(i.windowDays??7),onChange:e=>a({...i,windowDays:Number(e)}),options:[`1`,`7`,`14`,`28`,`30`].map(e=>({id:e,label:`${e}d`}))})}),(0,F.jsx)(K,{label:`Latency threshold (optional)`,hint:`if set, a successful event slower than this also counts as bad`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{className:`input w-32`,type:`number`,min:`1`,placeholder:`e.g. 800`,value:i.latencyMs??``,onChange:e=>a({...i,latencyMs:e.target.value===``?null:Number(e.target.value)})}),(0,F.jsx)(`span`,{className:`text-mute`,children:`ms`})]})}),(0,F.jsx)(K,{label:`Description (optional)`,children:(0,F.jsx)(`input`,{className:`input`,value:i.description||``,onChange:e=>a({...i,description:e.target.value||null})})})]}),(0,F.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-line grid grid-cols-2 gap-3`,children:[(0,F.jsx)(`div`,{className:`col-span-2 text-[12px] font-semibold`,children:`Burn-rate alerts notify`}),(0,F.jsx)(K,{label:`Slack incoming webhook URL`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://hooks.slack.com/services/…`,value:l(`slack`)?.url||``,onChange:e=>u(`slack`,e.target.value?{url:e.target.value}:null)})}),(0,F.jsx)(K,{label:`Generic webhook URL`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://…`,value:l(`webhook`)?.url||``,onChange:e=>u(`webhook`,e.target.value?{url:e.target.value}:null)})}),(0,F.jsx)(`div`,{className:`col-span-2`,children:(0,F.jsx)(gV,{value:l(`email`)?.to||``,onChange:e=>u(`email`,e.trim()?{to:e}:null)})})]}),o&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] mt-3`,children:o}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 mt-4`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:t,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:d,children:`Save SLO`})]})]})}var IV={operational:{label:`Operational`,color:`#0ca30c`,kind:`good`},degraded:{label:`Degraded`,color:`#e6a100`,kind:`warn`},partial_outage:{label:`Partial outage`,color:`#ec835a`,kind:`serious`},major_outage:{label:`Major outage`,color:`#d03b3b`,kind:`crit`},no_data:{label:`No data`,color:`#3a3a48`,kind:`neutral`}},LV=[`investigating`,`identified`,`monitoring`,`resolved`],RV=e=>e[0].toUpperCase()+e.slice(1).replace(`_`,` `);function zV(){let e=I(),[t,n]=zn(),{data:r,error:i,reload:a}=P(`/api/status-pages`,[e.tick]),[o,s]=(0,v.useState)(null);if(i)return(0,F.jsx)(W,{error:i});if(!r)return(0,F.jsx)(U,{});let c=Number(t.get(`id`))||r[0]?.id||null,l=e=>{let r=new URLSearchParams(t);r.set(`id`,String(e)),n(r,{replace:!0})};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(yi,{size:18,className:`text-brand`}),title:`Status pages`,sub:`Public pages for your customers. Each component's status comes from its live traffic, and incidents can be posted by hand or opened automatically during an outage.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s({autoIncidents:!0,published:!0,components:[]}),children:[(0,F.jsx)(_i,{size:14}),`New status page`]})}),r.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No status pages yet`,icon:(0,F.jsx)(yi,{size:22}),children:`Create a page, map components like "Checkout" or "API" to your applications and routes, and share the public link.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[300px_1fr] gap-3 items-start`,children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,F.jsxs)(`button`,{onClick:()=>l(e.id),className:`card text-left px-3.5 py-3 flex flex-col gap-1.5 ${c===e.id?`!border-[#5a2340]`:`hover:border-line2`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:e.title}),(0,F.jsx)(G,{kind:IV[e.overall].kind,children:IV[e.overall].label})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] mono`,children:[`/status/`,e.slug,!e.published&&` · unpublished`]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[e.components.length,` component`,e.components.length===1?``:`s`,e.activeIncidents?` · ${e.activeIncidents} active incident${e.activeIncidents>1?`s`:``}`:``]})]},e.id))}),c&&(0,F.jsx)(BV,{id:c,onEdit:s,onDeleted:()=>{let e=new URLSearchParams(t);e.delete(`id`),n(e),a()},onChanged:a})]}),o&&(0,F.jsx)(UV,{page:o,onClose:()=>s(null),onSaved:e=>{s(null),a(),l(e)}})]})}function BV({id:e,onEdit:t,onDeleted:n,onChanged:r}){let i=I(),{data:a,error:o,reload:s}=P(`/api/status-pages/${e}`,[e,i.tick]),[c,l]=(0,v.useState)(null);if(o)return(0,F.jsx)(W,{error:o});if(!a)return(0,F.jsx)(U,{});let u=a.page,d=`${window.location.origin}/status/${u.slug}`,f=()=>{s(),r()},p=a.incidents.filter(e=>e.status!==`resolved`),m=a.incidents.filter(e=>e.status===`resolved`),h=e=>u.components.find(t=>t.id===e)?.name||`removed component`;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[u.title,(0,F.jsx)(G,{kind:IV[a.overall].kind,children:IV[a.overall].label})]}),right:(0,F.jsxs)(`div`,{className:`flex gap-1`,children:[(0,F.jsxs)(`a`,{className:`btn h-7`,href:`/status/${u.slug}`,target:`_blank`,rel:`noreferrer`,children:[(0,F.jsx)(Vr,{size:13}),`Open public page`]}),(0,F.jsx)(Ba,{text:d,label:`Copy link`,className:`btn h-7`}),(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>t(u),children:[(0,F.jsx)(pi,{size:13}),`Edit`]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Delete`,onClick:async()=>{window.confirm(`Delete status page "${u.title}" and its incidents?`)&&(await N(`/api/status-pages/${u.id}`,{method:`DELETE`}),n())},children:(0,F.jsx)(Ri,{size:13})})]}),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 text-[12.5px] text-ink2`,children:[(0,F.jsxs)(`span`,{children:[u.published?`Public at `:`Unpublished · `,(0,F.jsx)(`span`,{className:`mono`,children:d})]}),(0,F.jsxs)(`span`,{children:[`Automatic incidents: `,(0,F.jsx)(`b`,{children:u.autoIncidents?`on`:`off`})]})]}),u.description&&(0,F.jsx)(`div`,{className:`text-ink2 mt-2`,children:u.description})]}),(0,F.jsx)(H,{title:`Components`,sub:`status from the last 10 minutes of traffic; bars show the last 90 days`,pad:!1,children:a.components.length===0?(0,F.jsx)(Na,{title:`No components`,children:`Edit the page to map components to applications and routes.`}):a.components.map(e=>(0,F.jsxs)(`div`,{className:`px-3.5 py-3 border-b border-[#1d1d26] last:border-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] mono truncate`,children:[e.service,e.operation?` · ${e.operation}`:``,e.latencyMs?` · degraded above p95 ${e.latencyMs}ms`:``]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 shrink-0 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-mute tabular-nums`,children:e.live.requests?`${e.live.requests} req · ${ba(e.live.errorRate)} 5xx · p95 ${B(e.live.p95)}`:`no recent traffic`}),(0,F.jsx)(G,{kind:IV[e.status].kind,children:IV[e.status].label})]})]}),(0,F.jsx)(`div`,{className:`flex gap-[2px] h-6 mt-2`,children:e.days.map(e=>(0,F.jsx)(`span`,{className:`flex-1 rounded-[2px]`,style:{background:IV[e.status].color},title:`${new Date(e.day).toISOString().slice(0,10)}: ${IV[e.status].label}${e.requests?` · ${e.requests} req, ${ba(e.errorRate)} errors`:``}`},e.day))}),(0,F.jsxs)(`div`,{className:`flex justify-between text-mute text-[11px] mt-1`,children:[(0,F.jsx)(`span`,{children:`90 days ago`}),(0,F.jsx)(`span`,{children:e.uptime==null?``:`${e.uptime}% uptime`}),(0,F.jsx)(`span`,{children:`today`})]})]},e.id))}),(0,F.jsx)(H,{title:`Incidents`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary h-7`,disabled:!u.components.length,onClick:()=>l({impact:`minor`,status:`investigating`,components:[]}),children:[(0,F.jsx)(oi,{size:13}),`Post incident`]}),pad:!1,children:a.incidents.length===0?(0,F.jsx)(Na,{title:`No incidents`,children:`Post one when something is wrong, or let automatic incidents handle outages.`}):(0,F.jsx)(`div`,{children:[...p,...m.slice(0,10)].map(e=>(0,F.jsx)(VV,{inc:e,name:h,onChanged:f},e.id))})}),c&&(0,F.jsx)(HV,{page:u,inc:c,onClose:()=>l(null),onSaved:()=>{l(null),f()}})]})}function VV({inc:e,name:t,onChanged:n}){let[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(e.status===`resolved`?`resolved`:e.status),s=e.status!==`resolved`,c=async()=>{await N(`/api/incidents/${e.id}`,{method:`PATCH`,json:{status:a,message:r}}),i(``),n()},l=e.impact===`critical`?`crit`:e.impact===`major`?`serious`:`warn`;return(0,F.jsxs)(`div`,{className:`px-3.5 py-3 border-b border-[#1d1d26] last:border-0 flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:e.title}),(0,F.jsx)(G,{kind:s?l:`good`,children:s?`${e.impact} · ${e.status}`:`resolved`}),e.auto&&(0,F.jsx)(`span`,{className:`pill`,children:`automatic`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 text-mute text-[11.5px]`,children:[Ca(e.created,!0),e.resolvedAt&&` → ${Ca(e.resolvedAt,!0)}`,(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 px-1.5`,title:`Delete`,onClick:async()=>{window.confirm(`Delete this incident? It disappears from the public page.`)&&(await N(`/api/incidents/${e.id}`,{method:`DELETE`}),n())},children:(0,F.jsx)(Ki,{size:12})})]})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[`Affects: `,e.components.map(t).join(`, `)||`—`]}),(0,F.jsx)(`div`,{className:`flex flex-col gap-1 border-l border-line2 pl-3`,children:[...e.updates].reverse().map((e,t)=>(0,F.jsxs)(`div`,{className:`text-[12.5px]`,children:[(0,F.jsx)(`b`,{className:`capitalize`,children:e.status}),` `,(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`— `,e.text]}),` `,(0,F.jsx)(`span`,{className:`text-mute text-[11px]`,children:Sa(e.ts)})]},t))}),s&&(0,F.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,F.jsx)(`select`,{className:`select`,value:a,onChange:e=>o(e.target.value),children:LV.map(e=>(0,F.jsx)(`option`,{value:e,children:RV(e)},e))}),(0,F.jsx)(`input`,{className:`input flex-1`,placeholder:a===`resolved`?`What fixed it (optional)`:`Post an update for customers`,value:r,onChange:e=>i(e.target.value)}),(0,F.jsx)(`button`,{className:`btn`,disabled:!r&&a===e.status,onClick:c,children:a===`resolved`?`Resolve`:`Post update`})]})]})}function HV({page:e,inc:t,onClose:n,onSaved:r}){let[i,a]=(0,v.useState)({title:t.title||``,impact:t.impact||`minor`,status:t.status||`investigating`,components:t.components||[],message:``}),[o,s]=(0,v.useState)(``),c=e=>a({...i,components:i.components.includes(e)?i.components.filter(t=>t!==e):[...i.components,e]});return(0,F.jsx)(qa,{open:!0,onClose:n,title:`Post incident`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(K,{label:`Title`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,placeholder:`Checkout errors for some customers`,value:i.title,onChange:e=>a({...i,title:e.target.value})})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Impact`,hint:`minor = degraded, major = partial outage, critical = major outage`,children:(0,F.jsx)(Va,{value:i.impact,onChange:e=>a({...i,impact:e}),options:[{id:`minor`,label:`Minor`},{id:`major`,label:`Major`},{id:`critical`,label:`Critical`}]})}),(0,F.jsx)(K,{label:`Status`,children:(0,F.jsx)(`select`,{className:`select`,value:i.status,onChange:e=>a({...i,status:e.target.value}),children:LV.filter(e=>e!==`resolved`).map(e=>(0,F.jsx)(`option`,{value:e,children:RV(e)},e))})})]}),(0,F.jsx)(K,{label:`Affected components`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.components.map(e=>(0,F.jsxs)(`label`,{className:`pill cursor-pointer !py-1 ${i.components.includes(e.id)?`!border-[#ff3d7f] !text-white`:``}`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`hidden`,checked:i.components.includes(e.id),onChange:()=>c(e.id)}),e.name]},e.id))})}),(0,F.jsx)(K,{label:`First update (shown publicly)`,children:(0,F.jsx)(`textarea`,{className:`input`,rows:3,placeholder:`We are investigating elevated error rates on checkout.`,value:i.message,onChange:e=>a({...i,message:e.target.value})})}),o&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a]`,children:o}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:n,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!i.title||!i.components.length,onClick:async()=>{try{await N(`/api/status-pages/${e.id}/incidents`,{method:`POST`,json:i}),r()}catch(e){s(e.message)}},children:`Post incident`})]})]})})}function UV({page:e,onClose:t,onSaved:n}){let r=I(),[i,a]=(0,v.useState)({...e,components:e.components??[]}),[o,s]=(0,v.useState)(``),c=i.components||[],l=(e,t)=>a({...i,components:c.map((n,r)=>r===e?{...n,...t}:n)});return(0,F.jsxs)(qa,{open:!0,onClose:t,title:i.id?`Edit status page`:`New status page`,wide:!0,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Title`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,placeholder:`Acme Status`,value:i.title||``,onChange:e=>a({...i,title:e.target.value})})}),(0,F.jsx)(K,{label:`URL slug`,hint:`public at /status/${i.slug||(i.title||``).toLowerCase().replace(/[^\w]+/g,`-`)||`…`}`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`from the title`,value:i.slug||``,onChange:e=>a({...i,slug:e.target.value})})}),(0,F.jsx)(`div`,{className:`col-span-2`,children:(0,F.jsx)(K,{label:`Description (optional)`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`Live status of Acme's APIs and checkout`,value:i.description||``,onChange:e=>a({...i,description:e.target.value||null})})})}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:i.published!==!1,onChange:e=>a({...i,published:e.target.checked})}),`Published (anyone with the link can view it)`]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:i.autoIncidents!==!1,onChange:e=>a({...i,autoIncidents:e.target.checked})}),`Open and resolve incidents automatically on outages`]})]}),(0,F.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-line flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-semibold`,children:`Components`}),(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>a({...i,components:[...c,{id:``,name:``,service:r.meta?.services[0]?.id||``,operation:null,latencyMs:null}]}),children:[(0,F.jsx)(_i,{size:13}),`Add component`]})]}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:`Customers only see the component name and its status. The application and route stay private.`}),c.length===0&&(0,F.jsx)(`div`,{className:`text-mute text-[12.5px] py-2`,children:`No components yet.`}),c.map((e,t)=>(0,F.jsxs)(`div`,{className:`grid grid-cols-[1.2fr_1fr_1.2fr_110px_auto] gap-2 items-center`,children:[(0,F.jsx)(`input`,{className:`input`,placeholder:`Name, e.g. Checkout`,value:e.name,onChange:e=>l(t,{name:e.target.value})}),(0,F.jsxs)(`select`,{className:`select`,value:e.service,onChange:e=>l(t,{service:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`Application…`}),r.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]}),(0,F.jsx)(`input`,{className:`input mono`,placeholder:`Route (optional)`,value:e.operation||``,onChange:e=>l(t,{operation:e.target.value||null})}),(0,F.jsx)(`input`,{className:`input`,type:`number`,placeholder:`p95 ms`,title:`Degraded when p95 is above this (optional)`,value:e.latencyMs??``,onChange:e=>l(t,{latencyMs:e.target.value===``?null:Number(e.target.value)})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,onClick:()=>a({...i,components:c.filter((e,n)=>n!==t)}),children:(0,F.jsx)(Ri,{size:13})})]},t))]}),o&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] mt-3`,children:o}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 mt-4`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:t,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:async()=>{try{n((i.id?await N(`/api/status-pages/${i.id}`,{method:`PUT`,json:i}):await N(`/api/status-pages`,{method:`POST`,json:i})).id)}catch(e){s(e.message)}},children:`Save page`})]})]})}var WV={good:Mr,warn:jr,bad:di,neutral:Nr};function GV(e){if(!e)return``;let t=Date.now()-e;if(t<6e4)return`just now`;let n=Math.round(t/6e4);if(n<60)return`${n} minute${n===1?``:`s`} ago`;let r=Math.round(t/36e5);if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.round(t/864e5);return i===1?`yesterday`:`${i} days ago`}function KV({n:e,title:t,right:n,children:r,className:i=``}){return(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-3.5 ${i}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`h2`,{className:`text-[16px] font-semibold tracking-tight`,children:t}),e!=null&&e>0&&(0,F.jsx)(`span`,{className:`text-[11px] font-semibold px-2 py-0.5 rounded-full bg-[#22222d] text-ink2`,children:e}),(0,F.jsx)(`div`,{className:`flex-1`}),n]}),r]})}function qV({question:e,label:t=`Ask Obzeri`,className:n=`btn btn-ghost h-7 px-2 text-[12px]`}){return(0,F.jsxs)(`button`,{className:n,title:`Ask Obzeri: ${e}`,onClick:t=>{t.stopPropagation(),ar(e)},children:[(0,F.jsx)(Fi,{size:13,className:`text-brand`}),t]})}function JV({title:e,children:t}){return(0,F.jsxs)(`div`,{className:`tone-good rounded-xl px-4 py-5 flex items-center gap-3`,style:{background:`var(--tone-bg)`},children:[(0,F.jsx)(Mr,{size:22,style:{color:`var(--tone)`},className:`shrink-0`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-[14px]`,children:e}),t&&(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] mt-0.5`,children:t})]})]})}var YV={"15m":`the last 15 minutes`,"1h":`the last hour`,"6h":`the last 6 hours`,"24h":`the last 24 hours`,"7d":`the last 7 days`,"30d":`the last 30 days`,custom:`the selected time`},XV={healthy:{tone:`good`,Icon:Mr},attention:{tone:`warn`,Icon:jr},broken:{tone:`bad`,Icon:di},idle:{tone:`neutral`,Icon:li},no_data:{tone:`neutral`,Icon:li}},ZV={secret:Ai,silent:vi,error:xr,endpoint:wi,jobs:Gi,alert:gr,release:xi,new_errors:xr,traffic:Bi,speed:Wr,failures:ur};function QV(){let e=I(),{data:t,error:n}=P(`/api/simple${e.q()}`,[e.tick]);return n?(0,F.jsx)(W,{error:n}):t?t.health===`no_data`?(0,F.jsx)(Hz,{simple:!0}):(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsx)($V,{d:t}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-5 gap-5 items-start`,children:[(0,F.jsxs)(`div`,{className:`@4xl:col-span-3 flex flex-col gap-5`,children:[(0,F.jsx)(rH,{items:t.broke}),(0,F.jsx)(iH,{items:t.changed,basis:t.usualBasis})]}),(0,F.jsxs)(`div`,{className:`@4xl:col-span-2 flex flex-col gap-5`,children:[(0,F.jsx)(oH,{items:t.todo}),(0,F.jsx)(cH,{suggestions:t.suggestions})]})]})]}):(0,F.jsx)(U,{})}function $V({d:e}){let t=I(),n=XV[e.health];return(0,F.jsxs)(`section`,{className:`card tone-${n.tone} p-6 grid grid-cols-1 @4xl:grid-cols-[1fr_420px] gap-6`,style:{borderColor:`var(--tone-line)`,background:`linear-gradient(135deg, var(--tone-bg), transparent 55%), var(--color-panel)`},children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11.5px] uppercase tracking-wider font-semibold text-mute`,children:`Is my app healthy?`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,F.jsx)(`div`,{className:`w-14 h-14 rounded-full flex items-center justify-center shrink-0 ${e.health===`healthy`?`health-orb`:``}`,style:{background:`var(--tone-bg)`,border:`1px solid var(--tone-line)`},children:(0,F.jsx)(n.Icon,{size:28,style:{color:`var(--tone)`}})}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight leading-tight`,children:e.headline}),(0,F.jsx)(`p`,{className:`text-ink2 text-[14px] mt-1 leading-relaxed`,children:e.summary})]})]}),(0,F.jsx)(tH,{points:e.timeline,bucketMs:e.bucketMs,label:YV[t.range]||`this period`})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 @2xl:@max-4xl:grid-cols-4 gap-3 content-start`,children:e.vitals.map(e=>(0,F.jsx)(eH,{v:e},e.id))})]})}function eH({v:e}){let t=WV[e.tone];return(0,F.jsxs)(`div`,{className:`tone-${e.tone} rounded-xl border border-line bg-[#111118] px-3.5 py-3 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] text-ink2 font-medium`,children:[(0,F.jsx)(t,{size:13,style:{color:`var(--tone)`}}),e.label]}),(0,F.jsx)(`div`,{className:`text-[22px] font-semibold tracking-tight mt-1 tabular-nums`,style:{color:e.tone===`bad`||e.tone===`warn`?`var(--tone)`:void 0},children:e.value}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute leading-snug mt-0.5`,children:e.note}),e.usual&&(0,F.jsx)(`div`,{className:`text-[11.5px] text-ink2 mt-1`,children:e.usual})]})}function tH({points:e,bucketMs:t,label:n}){if(!e.length)return null;let r=Math.max(1,...e.map(e=>e.count)),i=e=>e.count?e.failed/e.count>=.05?`#e05252`:e.failed/e.count>=.01?`#e8a92a`:`#36b56a`:`#2a2a35`,a=e.length*t;return(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`flex items-end gap-[2px] h-[54px]`,children:e.map(e=>(0,F.jsx)(`div`,{className:`flex-1 rounded-[3px] min-w-[2px] hover:opacity-80`,style:{height:`${Math.max(8,e.count/r*100)}%`,background:i(e)},title:`${Ca(e.t,a>864e5)} · ${V(e.count)} requests${e.failed?` · ${V(e.failed)} failed`:``}`},e.t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-x-4 gap-y-1 text-[11px] text-mute mt-1.5`,children:[(0,F.jsx)(`span`,{className:`whitespace-nowrap`,children:n.charAt(0).toUpperCase()+n.slice(1)}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 whitespace-nowrap`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`i`,{className:`w-2 h-2 rounded-sm inline-block bg-[#36b56a]`}),`fine`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`i`,{className:`w-2 h-2 rounded-sm inline-block bg-[#e8a92a]`}),`some failures`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`i`,{className:`w-2 h-2 rounded-sm inline-block bg-[#e05252]`}),`many failures`]}),(0,F.jsx)(`span`,{children:`now`})]})]})]})}function nH({f:e,timeline:t}){let n=ht(),r=Qn(),i=ZV[e.kind]||xr;return(0,F.jsxs)(`div`,{className:`tone-${e.tone} group flex items-start gap-3 rounded-xl px-3.5 py-3 border border-transparent ${e.link?`cursor-pointer hover:bg-[#181821] hover:border-line`:``}`,onClick:()=>e.link&&n(r(e.link)),children:[(0,F.jsx)(`div`,{className:`${t?`w-8 h-8`:`w-9 h-9`} rounded-lg flex items-center justify-center shrink-0`,style:{background:`var(--tone-bg)`},children:(0,F.jsx)(i,{size:t?15:17,style:{color:`var(--tone)`}})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[13.5px]`,children:e.title}),e.isNew&&(0,F.jsx)(`span`,{className:`text-[10.5px] font-semibold px-1.5 py-px rounded-full`,style:{color:`var(--tone)`,background:`var(--tone-bg)`},children:`NEW`})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] mt-0.5 leading-relaxed break-words`,children:e.detail}),e.ts&&(0,F.jsx)(`div`,{className:`text-mute text-[11.5px] mt-1`,children:t?GV(e.ts):`last seen ${GV(e.ts)}`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 opacity-70 group-hover:opacity-100`,children:[e.ask&&(0,F.jsx)(qV,{question:e.ask,label:`Ask`}),e.link&&(0,F.jsx)(Or,{size:16,className:`text-mute`})]})]})}function rH({items:e}){let[t,n]=(0,v.useState)(!1),r=t?e:e.slice(0,5);return(0,F.jsx)(KV,{title:`What broke?`,n:e.length,children:e.length===0?(0,F.jsx)(JV,{title:`Nothing is broken`,children:`No crashes, failing pages, leaks or firing alerts in this period.`}):(0,F.jsxs)(`div`,{className:`flex flex-col -mx-1.5`,children:[r.map(e=>(0,F.jsx)(nH,{f:e},e.id)),e.length>5&&(0,F.jsx)(`button`,{className:`btn btn-ghost self-start ml-1.5 mt-1`,onClick:()=>n(!t),children:t?`Show less`:`Show ${e.length-5} more`})]})})}function iH({items:e,basis:t}){return(0,F.jsx)(KV,{title:`What changed?`,n:e.length,right:t?(0,F.jsxs)(`span`,{className:`text-[11.5px] text-mute`,title:`Compared with ${t}`,children:[`vs a normal `,t.includes(`week`)?`week`:`day`]}):null,children:e.length===0?(0,F.jsxs)(`div`,{className:`text-ink2 text-[13px] px-1`,children:[`Nothing new: no deploys, no new kinds of errors, and traffic and speed look `,t?`like they usually do at this time`:`steady`,`.`]}):(0,F.jsx)(`div`,{className:`flex flex-col -mx-1.5`,children:e.map(e=>(0,F.jsx)(nH,{f:e,timeline:!0},e.id))})})}var aH={now:{label:`Do now`,tone:`bad`},soon:{label:`Soon`,tone:`warn`},later:{label:`When you can`,tone:`neutral`}};function oH({items:e}){let[t,n]=(0,v.useState)(e[0]?.id??null);return(0,F.jsx)(KV,{title:`What should I do?`,n:e.length,children:e.length===0?(0,F.jsx)(JV,{title:`Nothing to do right now`,children:`Go build something. We will tell you when that changes.`}):(0,F.jsx)(`ol`,{className:`flex flex-col gap-2`,children:e.map((e,r)=>(0,F.jsx)(sH,{t:e,n:r+1,open:t===e.id,onToggle:()=>n(t===e.id?null:e.id)},e.id))})})}function sH({t:e,n:t,open:n,onToggle:r}){let i=ht(),a=Qn(),o=aH[e.urgency];return(0,F.jsxs)(`li`,{className:`tone-${o.tone} rounded-xl border bg-[#111118] ${n?`border-line2`:`border-line`}`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-start gap-3 px-3.5 py-3 text-left`,onClick:r,"aria-expanded":n,children:[(0,F.jsx)(`span`,{className:`w-6 h-6 rounded-full flex items-center justify-center text-[12px] font-semibold shrink-0 mt-px`,style:{background:`var(--tone-bg)`,color:`var(--tone)`},children:t}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[13.5px]`,children:e.title}),(0,F.jsx)(`span`,{className:`text-[10.5px] font-semibold uppercase tracking-wide`,style:{color:`var(--tone)`},children:o.label})]}),!n&&(0,F.jsx)(`span`,{className:`block text-mute text-[12px] truncate mt-0.5`,children:e.why})]}),n?(0,F.jsx)(Er,{size:15,className:`text-mute mt-1`}):(0,F.jsx)(Or,{size:15,className:`text-mute mt-1`})]}),n&&(0,F.jsxs)(`div`,{className:`px-3.5 pb-3.5 pl-[50px] flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] leading-relaxed`,children:e.why}),e.steps.length>0&&(0,F.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.steps.map((e,t)=>(0,F.jsxs)(`li`,{className:`flex gap-2 text-[12.5px]`,children:[(0,F.jsxs)(`span`,{className:`text-mute tabular-nums`,children:[t+1,`.`]}),(0,F.jsx)(`span`,{children:e})]},t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.executionId&&(0,F.jsx)(Ba,{className:`btn btn-primary h-8`,label:`Copy fix prompt`,text:async()=>(await N(`/api/executions/${e.executionId}/prompt`)).prompt}),e.link&&(0,F.jsxs)(`button`,{className:`btn h-8 ${e.executionId?``:`btn-primary`}`,onClick:()=>i(a(e.link)),children:[e.linkLabel||`Open`,(0,F.jsx)(Or,{size:13})]}),e.ask&&(0,F.jsx)(qV,{question:e.ask,className:`btn h-8`})]}),e.executionId&&(0,F.jsxs)(`div`,{className:`text-[11.5px] text-mute flex items-center gap-1.5`,children:[(0,F.jsx)(Wi,{size:12}),`The prompt has the error, the code around it and what happened, ready for Cursor, Claude Code or Copilot.`]})]})]})}function cH({suggestions:e}){let[t,n]=(0,v.useState)(``);return(0,F.jsxs)(KV,{title:`Ask Obzeri`,children:[(0,F.jsxs)(`form`,{className:`relative`,onSubmit:e=>{e.preventDefault(),t.trim()&&(ar(t.trim()),n(``))},children:[(0,F.jsx)(Fi,{size:15,className:`absolute left-3 top-1/2 -translate-y-1/2 text-brand`}),(0,F.jsx)(`input`,{dir:`auto`,className:`input w-full h-11 pl-9 pr-11 text-[13.5px] rounded-xl`,placeholder:`Ask anything about your app…`,value:t,onChange:e=>n(e.target.value)}),(0,F.jsx)(`button`,{className:`absolute right-1.5 top-1/2 -translate-y-1/2 btn btn-primary h-8 w-8 !p-0 justify-center rounded-lg`,disabled:!t.trim(),title:`Ask`,children:(0,F.jsx)(mr,{size:15})})]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,F.jsx)(`button`,{className:`text-left rounded-full border border-line hover:border-line2 hover:bg-panel2 px-3 py-1.5 text-[12px] text-ink2 hover:text-ink max-w-full truncate`,title:e,onClick:()=>ar(e),children:e},e))}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`Plain answers from your app's own data, in any language.`})]})}function lH(){let e=I(),{data:t,error:n,setData:r}=P(`/api/simple/alerts`,[e.tick]);if((0,v.useEffect)(()=>{N(`/api/alerts/events/read`,{method:`POST`}).then(()=>e.refresh()).catch(()=>{})},[]),n)return(0,F.jsx)(W,{error:n});if(!t)return(0,F.jsx)(U,{});let i=async e=>r(await N(`/api/simple/alerts`,{method:`PUT`,json:e}));return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(gr,{size:22,className:`text-brand`}),`Alerts`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Hear about problems before your users tell you.`})]}),(0,F.jsx)(uH,{firing:t.firing}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-5 gap-5 items-start`,children:[(0,F.jsxs)(`div`,{className:`@4xl:col-span-3 flex flex-col gap-5`,children:[(0,F.jsx)(KV,{title:`Tell me when…`,children:(0,F.jsx)(`div`,{className:`flex flex-col divide-y divide-[#1f1f29]`,children:t.presets.map(e=>(0,F.jsx)(fH,{p:e,onChange:t=>i({presets:{[e.id]:t}})},e.id))})}),(0,F.jsx)(mH,{events:t.events})]}),(0,F.jsx)(`div`,{className:`@4xl:col-span-2`,children:(0,F.jsx)(pH,{data:t,onSave:e=>i({channels:e})})})]})]})}function uH({firing:e}){let t=I(),n=ht(),r=Qn(),i=ir(),a=t.meta?.openSecrets||0;return!e.length&&!a?(0,F.jsx)(JV,{title:`All quiet right now`,children:`No alert is firing. The switches below decide what wakes you up.`}):(0,F.jsxs)(`section`,{className:`card tone-bad p-5 flex flex-col gap-2`,style:{borderColor:`var(--tone-line)`,background:`linear-gradient(135deg, var(--tone-bg), transparent 60%), var(--color-panel)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold text-[15px]`,children:[(0,F.jsx)(hr,{size:17,style:{color:`var(--tone)`}}),`Happening right now`]}),a>0&&(0,F.jsxs)(`button`,{className:`flex items-center gap-3 text-left rounded-lg px-2 py-2 hover:bg-[#1c1c25]`,onClick:()=>n(r(`/secrets`)),children:[(0,F.jsx)(Ai,{size:16,style:{color:`var(--tone)`}}),(0,F.jsxs)(`span`,{className:`flex-1 text-[13.5px]`,children:[a===1?`A secret is`:`${a} secrets are`,` being written to your logs`]}),(0,F.jsx)(Or,{size:15,className:`text-mute`})]}),e.map(e=>(0,F.jsxs)(`button`,{className:`flex items-center gap-3 text-left rounded-lg px-2 py-2 hover:bg-[#1c1c25]`,onClick:()=>i(`/alerts?rule=${e.id}`),children:[(0,F.jsx)(gr,{size:16,style:{color:`var(--tone)`}}),(0,F.jsx)(`span`,{className:`flex-1 text-[13.5px]`,children:e.name}),e.since&&(0,F.jsxs)(`span`,{className:`text-mute text-[12px]`,children:[`since `,GV(e.since)]}),(0,F.jsx)(Or,{size:15,className:`text-mute`})]},e.id))]})}function dH({on:e,onChange:t,label:n}){return(0,F.jsx)(`button`,{role:`switch`,"aria-checked":e,"aria-label":n,onClick:()=>t(!e),className:`relative w-[42px] h-[24px] rounded-full shrink-0 transition-colors`,style:{background:e?`linear-gradient(120deg, #ff3d7f, #a855f7)`:`#2c2c38`},children:(0,F.jsx)(`span`,{className:`absolute top-[3px] w-[18px] h-[18px] rounded-full bg-white shadow transition-[left]`,style:{left:e?21:3}})})}function fH({p:e,onChange:t}){let[n,r]=(0,v.useState)(!1);return(0,F.jsxs)(`div`,{className:`flex items-center gap-4 py-3.5`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[14px]`,children:e.label}),e.firing&&(0,F.jsx)(`span`,{className:`tone-bad text-[10.5px] font-semibold px-1.5 py-px rounded-full`,style:{color:`var(--tone)`,background:`var(--tone-bg)`},children:`FIRING`})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[12.5px] mt-0.5`,children:[e.description,e.lastFired?` · last time ${GV(e.lastFired)}`:``]})]}),(0,F.jsx)(dH,{on:e.enabled,label:e.label,onChange:async e=>{r(!0);try{await t(e)}finally{r(!1)}}}),n&&(0,F.jsx)(`span`,{className:`sr-only`,children:`saving`})]})}function pH({data:e,onSave:t}){let n=ir(),[r,i]=(0,v.useState)(e.channels.email),[a,o]=(0,v.useState)(e.channels.slack),[s,c]=(0,v.useState)(null),l=r!==e.channels.email||a!==e.channels.slack,u=!!(e.channels.email||e.channels.slack);return(0,F.jsxs)(KV,{title:`Where should we tell you?`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[13px]`,children:[(0,F.jsx)(ci,{size:16,className:`text-mute`}),(0,F.jsx)(`span`,{className:`flex-1`,children:`In this dashboard`}),(0,F.jsx)(`span`,{className:`text-mute text-[12px]`,children:`always on`})]}),(0,F.jsxs)(`form`,{className:`flex flex-col gap-3.5`,onSubmit:async e=>{e.preventDefault();try{await t({email:r,slack:a}),c({ok:!0,text:`Saved.`})}catch(e){c({ok:!1,text:e.message})}},children:[(0,F.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,F.jsx)(ai,{size:15,className:`text-mute`}),`Email`]}),(0,F.jsx)(`input`,{className:`input h-9`,type:`text`,placeholder:`you@example.com`,value:r,onChange:e=>i(e.target.value),disabled:!e.emailReady&&!r}),!e.emailReady&&(0,F.jsxs)(`span`,{className:`text-[11.5px] text-mute`,children:[`Email needs a mail server first. `,(0,F.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>n(`/integrations/email`),children:`Set one up`})]})]}),(0,F.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,F.jsx)(Mi,{size:15,className:`text-mute`}),`Slack`]}),(0,F.jsx)(`input`,{className:`input h-9`,type:`url`,placeholder:`https://hooks.slack.com/services/…`,value:a,onChange:e=>o(e.target.value)}),(0,F.jsxs)(`a`,{className:`text-[11.5px] link inline-flex items-center gap-1 self-start`,href:`https://api.slack.com/messaging/webhooks`,target:`_blank`,rel:`noreferrer`,children:[`How to get a Slack webhook`,(0,F.jsx)(Vr,{size:11})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary h-9`,disabled:!l,children:`Save`}),(0,F.jsxs)(`button`,{type:`button`,className:`btn h-9`,disabled:!u||l,title:l?`Save first`:void 0,onClick:async()=>{c(null);try{let e=(await N(`/api/simple/alerts/test`,{method:`POST`})).deliveries.filter(e=>e.type!==`inapp`&&!e.ok);c(e.length?{ok:!1,text:`Could not reach ${e.map(e=>`${e.type}${e.error?` (${e.error})`:``}`).join(`, `)}`}:{ok:!0,text:`Test sent. Check your inbox or Slack.`})}catch(e){c({ok:!1,text:e.message})}},children:[(0,F.jsx)(Di,{size:13}),`Send a test`]})]}),s&&(0,F.jsxs)(`div`,{className:`text-[12.5px] flex items-center gap-1.5 ${s.ok?`text-[#5ad17a]`:`text-[#ff8a8a]`}`,children:[s.ok&&(0,F.jsx)(Mr,{size:13}),s.text]})]}),(0,F.jsxs)(`div`,{className:`text-[11.5px] text-mute border-t border-line pt-3`,children:[`Webhooks, Discord, per-route rules and quiet hours are in `,(0,F.jsx)(`button`,{className:`link`,onClick:()=>n(`/alerts`),children:`Advanced → Alerts`}),`.`]})]})}function mH({events:e}){let[t,n]=(0,v.useState)(!1),r=t?e:e.slice(0,8);return(0,F.jsx)(KV,{title:`Recent alerts`,n:e.length,children:e.length===0?(0,F.jsx)(`div`,{className:`text-ink2 text-[13px]`,children:`Nothing has fired yet.`}):(0,F.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[r.map(e=>{let t=e.state===`firing`?`bad`:`good`;return(0,F.jsxs)(`div`,{className:`tone-${t} flex items-start gap-3 px-1 py-2`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full mt-[7px] shrink-0`,style:{background:`var(--tone)`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-[13px]`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:e.rule}),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`· `,e.state===`firing`?`went off`:`back to normal`,` `,GV(e.ts)]})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12px] mt-0.5 break-words`,children:e.message})]})]},e.id)}),e.length>8&&(0,F.jsx)(`button`,{className:`btn btn-ghost self-start`,onClick:()=>n(!t),children:t?`Show less`:`Show ${e.length-8} more`})]})})}function hH(){let e=I(),t=ir(),n=P(`/api/overview${e.q()}`,[e.tick]),r=P(`/api/runtime${e.q()}`,[e.tick]),i=P(`/api/metrics${e.q()}`,[e.tick]);if(n.error)return(0,F.jsx)(W,{error:n.error});if(!n.data)return(0,F.jsx)(U,{});let a=n.data,o=a.kpis,s=o.usual&&o.usual.requests>=50?o.usual:null,c=ZR(a.series.points,a.band),l=QR(a.band),u=YV[e.range]||`this period`,d=[{key:`count`,label:`Requests`,color:WR[0],type:`bar`},...l?[{...l.calls,label:`Usual`}]:[]],f=[...l?[{...l.p95,label:`Normal range`}]:[],{key:`p95`,label:`Slowest 5%`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[2],type:`line`}],p=[{key:`s5xx`,label:`Failed (server errors)`,color:GR.crit,type:`bar`,stack:`e`},{key:`s4xx`,label:`Rejected (bad requests)`,color:GR.warn,type:`bar`,stack:`e`}],m=new Map;for(let e of r.data||[])for(let t of e.points){let e=m.get(t.t)||{t:t.t,cpu:null,mem:null};t.cpuUtil!=null&&(e.cpu=Math.max(e.cpu??0,t.cpuUtil)),t.memUtil!=null&&(e.mem=Math.max(e.mem??0,t.memUtil)),m.set(t.t,e)}let h=[...m.values()].sort((e,t)=>e.t-t.t),g=h[h.length-1],_=[{key:`cpu`,label:`CPU`,color:WR[0],type:`line`},{key:`mem`,label:`Memory`,color:WR[6],type:`line`}],v=Math.max(g?.cpu??0,g?.mem??0),y=s?.requests?o.requests/s.requests:null,b=s?.p95&&o.p95?o.p95/s.p95:null,x=o.requests>=20&&o.failureRate>=5?`bad`:o.failureRate>=1&&o.failed>=3?`warn`:`good`,S=[...new Set((i.data||[]).map(e=>e.name))];return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(wr,{size:22,className:`text-brand`}),`Metrics`]}),(0,F.jsxs)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:[`How your app did over `,u,s?`, next to what is normal for this time`:``,`.`]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-2 gap-5`,children:[(0,F.jsx)(gH,{title:`Traffic`,what:`How many requests your app handled.`,value:V(o.requests),unit:`requests`,status:y==null?{tone:`neutral`,text:o.rpm?`About ${V(o.rpm)} a minute`:`No requests yet`}:y>=1.5?{tone:`neutral`,text:`${y.toFixed(1)}× busier than usual`}:y<=.67?{tone:`warn`,text:`${Math.round((1-y)*100)}% quieter than usual`}:{tone:`good`,text:`About as busy as usual`},series:d,children:(0,F.jsx)(JR,{data:c,series:d,height:190,zoom:!1,fmt:e=>V(e)})}),(0,F.jsx)(gH,{title:`Speed`,what:`How long requests take. Lower is better; the slowest 5% is what unhappy users feel.`,value:B(o.p95),unit:`slowest 5%`,status:o.p95==null?{tone:`neutral`,text:`Nothing to time yet`}:b!=null&&b>=1.4?{tone:`warn`,text:`Slower than usual (normally ${B(s.p95)})`}:o.p95>=1500?{tone:`warn`,text:`On the slow side`}:{tone:`good`,text:s?.p95?`Normal (usually ${B(s.p95)})`:`Fast`},series:f,children:(0,F.jsx)(JR,{data:c,series:f,height:190,zoom:!1,fmt:e=>B(e),yFmt:e=>e>=1e3?`${+(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`})}),(0,F.jsx)(gH,{title:`Errors`,what:`Requests that failed because of your server (red), and requests your app rejected, like a wrong password or a missing page (yellow).`,value:ba(o.failureRate),unit:`failed`,status:{tone:x,text:o.failed?`${V(o.failed)} failed, ${V(o.clientErrors)} rejected`:`No server errors`},series:p,children:(0,F.jsx)(JR,{data:c,series:p,height:190,zoom:!1,fmt:e=>V(e)})}),(0,F.jsx)(gH,{title:`Server load`,what:`How much of its CPU and memory your app uses. Near 100% it slows down or restarts.`,value:g?`${Math.round(v)}%`:`—`,unit:`busiest`,status:g?v>=90?{tone:`bad`,text:`Close to the limit`}:v>=75?{tone:`warn`,text:`Busy`}:{tone:`good`,text:`Plenty of room`}:{tone:`neutral`,text:`No server stats yet`},series:_,children:r.data?(0,F.jsx)(JR,{data:h,series:_,height:190,zoom:!1,fmt:e=>`${Math.round(e)}%`,yDomain:[0,`auto`]}):(0,F.jsx)(U,{})})]}),S.length>0&&(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Your own numbers`}),(0,F.jsx)(`span`,{className:`text-mute text-[12.5px]`,children:`counters and gauges your code reports`})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-3 @5xl:grid-cols-4 gap-3`,children:S.slice(0,12).map(e=>{let n=(i.data||[]).filter(t=>t.name===e),r=n.reduce((e,t)=>e+(t.type===`counter`?t.count??0:0),0);return(0,F.jsxs)(`button`,{className:`text-left rounded-xl border border-line hover:border-line2 bg-[#111118] px-3.5 py-3 group`,onClick:()=>t(`/metrics`),children:[(0,F.jsx)(`div`,{className:`mono text-[11.5px] text-ink2 truncate`,children:e}),(0,F.jsx)(`div`,{className:`text-[20px] font-semibold mt-1 tabular-nums`,children:n[0]?.type===`counter`?V(r):V(n[0]?.avg)}),(0,F.jsxs)(`div`,{className:`text-[11px] text-mute flex items-center gap-1`,children:[n[0]?.type===`counter`?`total`:`average`,(0,F.jsx)(Or,{size:11,className:`opacity-0 group-hover:opacity-100`})]})]},e)})})]})]})}function gH({title:e,what:t,value:n,unit:r,status:i,series:a,children:o}){let s=WV[i.tone];return(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-3 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:e}),(0,F.jsx)(`p`,{className:`text-mute text-[12.5px] mt-0.5 leading-snug`,children:t})]}),(0,F.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,F.jsx)(`div`,{className:`text-[24px] font-semibold tabular-nums leading-tight`,children:n}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:r})]})]}),(0,F.jsxs)(`div`,{className:`tone-${i.tone} flex items-center gap-1.5 text-[12.5px] font-medium`,style:{color:`var(--tone)`},children:[(0,F.jsx)(s,{size:14}),i.text]}),o,(0,F.jsx)(qR,{series:a})]})}var _H=[{id:`all`,label:`Everything`,levels:``},{id:`problems`,label:`Problems only`,levels:`warn,error,fatal`},{id:`errors`,label:`Errors only`,levels:`error,fatal`}],vH={fatal:{word:`Error`,color:`#ff7a7a`,bg:`rgba(208,59,59,.14)`},error:{word:`Error`,color:`#ff7a7a`,bg:`rgba(208,59,59,.14)`},warn:{word:`Warning`,color:`#f5c04e`,bg:`rgba(250,178,25,.12)`},info:{word:`Info`,color:`#7fb2f0`,bg:`rgba(57,135,229,.12)`},debug:{word:`Debug`,color:`#9a9ab0`,bg:`rgba(130,130,154,.12)`},trace:{word:`Debug`,color:`#9a9ab0`,bg:`rgba(130,130,154,.12)`}};function yH(){let e=I(),[t,n]=zn(),[r,i]=(0,v.useState)(t.get(`q`)||``),a=_H.find(e=>e.id===t.get(`show`))??_H[0],{data:o,error:s}=P(`/api/logs${e.q({q:t.get(`q`)||``,level:a.levels,limit:300})}`,[e.tick]),c=(e,t)=>{let r=new URLSearchParams(window.location.search);t?r.set(e,t):r.delete(e),n(r,{replace:!0})},l={all:0,error:0,warn:0};for(let e of o?.series||[]){for(let t of[`error`,`fatal`,`warn`,`info`,`debug`,`trace`])l.all+=e[t]||0;l.error+=(e.error||0)+(e.fatal||0),l.warn+=e.warn||0}return(0,F.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(Ti,{size:22,className:`text-brand`}),`Logs`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Everything your app printed, newest first. Each line knows which request wrote it.`})]}),(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsxs)(`form`,{className:`relative flex-1 min-w-[240px]`,onSubmit:e=>{e.preventDefault(),c(`q`,r.trim())},children:[(0,F.jsx)(Ei,{size:15,className:`absolute left-3 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input w-full h-10 pl-9 pr-9 text-[13.5px] rounded-xl`,placeholder:`Search your logs, then press Enter`,value:r,onChange:e=>i(e.target.value)}),t.get(`q`)&&(0,F.jsx)(`button`,{type:`button`,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-mute hover:text-ink`,title:`Clear`,onClick:()=>{i(``),c(`q`,``)},children:(0,F.jsx)(Ki,{size:15})})]}),(0,F.jsx)(`div`,{className:`seg seg-lg`,children:_H.map(e=>(0,F.jsx)(`button`,{className:a.id===e.id?`on`:``,onClick:()=>c(`show`,e.id===`all`?``:e.id),children:e.label},e.id))})]}),o&&(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2`,children:[V(l.all),` line`,l.all===1?``:`s`,` in `,YV[e.range]||`this period`,l.error>0&&(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsxs)(`span`,{className:`text-[#ff8a8a]`,children:[V(l.error),` error`,l.error===1?``:`s`]})]}),l.warn>0&&(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsxs)(`span`,{className:`text-[#f5c04e]`,children:[V(l.warn),` warning`,l.warn===1?``:`s`]})]}),t.get(`q`)&&(0,F.jsxs)(F.Fragment,{children:[` · matching “`,t.get(`q`),`”`]})]}),s?(0,F.jsx)(W,{error:s}):o?o.logs.length===0?(0,F.jsx)(`div`,{className:`text-center text-ink2 py-12 text-[13.5px]`,children:t.get(`q`)||a.levels?`Nothing matches. Try another word or show everything.`:`No logs in this period. console.log and pino output shows up here automatically.`}):(0,F.jsx)(`div`,{className:`flex flex-col -mx-2`,children:o.logs.map(e=>(0,F.jsx)(bH,{l:e},e.id))}):(0,F.jsx)(U,{})]})]})}function bH({l:e}){let[t,n]=(0,v.useState)(!1),r=ht(),i=Qn(),a=vH[e.level]||vH.info;return(0,F.jsxs)(`div`,{className:`rounded-lg ${t?`bg-[#16161e]`:`hover:bg-[#15151c]`}`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-start gap-3 px-2 py-2 text-left`,onClick:()=>n(!t),children:[(0,F.jsx)(`span`,{className:`text-mute text-[12px] tabular-nums shrink-0 w-[62px] pt-px`,title:GV(e.ts),children:Ca(e.ts)}),(0,F.jsx)(`span`,{className:`text-[11px] font-semibold px-2 py-0.5 rounded-md shrink-0 w-[64px] text-center`,style:{color:a.color,background:a.bg},children:a.word}),(0,F.jsx)(`span`,{className:`mono text-[12.5px] flex-1 min-w-0 text-[#dcdce6] ${t?`whitespace-pre-wrap break-words`:`truncate`}`,children:e.message}),(0,F.jsx)(`span`,{className:`text-mute text-[12px] shrink-0 max-w-[110px] truncate`,children:e.service}),(0,F.jsx)(Or,{size:14,className:`text-mute shrink-0 mt-0.5 transition-transform ${t?`rotate-90`:``}`})]}),t&&(0,F.jsxs)(`div`,{className:`px-2 pb-3 pl-[150px] flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{className:`text-[12px] text-mute`,children:[Ca(e.ts,!0),` · `,GV(e.ts),e.logger?` · ${e.logger}`:``,e.instance?` · ${e.instance}`:``]}),e.attrs&&(0,F.jsx)(`pre`,{className:`code !text-[11.5px] !py-2 max-h-[240px] overflow-auto`,children:JSON.stringify(e.attrs,null,2)}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[e.executionId&&(0,F.jsxs)(`button`,{className:`btn h-8`,onClick:()=>r(i(`/executions/${e.executionId}`)),children:[`See the request that wrote it`,(0,F.jsx)(Or,{size:13})]}),(0,F.jsx)(qV,{className:`btn h-8`,label:`Ask Obzeri about this`,question:`What does this ${e.level} log from ${e.service} mean, and do I need to do anything? "${String(e.message).slice(0,300)}"`})]})]})]})}function xH(){let e=I(),t=ht(),n=Qn(),r=ir(),i=P(`/api/settings`),a=P(`/api/settings/ai`);if(i.error)return(0,F.jsx)(W,{error:i.error});if(!i.data)return(0,F.jsx)(U,{});let o=i.data,s=e.meta?.services||[];return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(ki,{size:22,className:`text-brand`}),`Settings`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Connect your app, choose how the dashboard looks, and turn on the assistant.`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-5 gap-5 items-start`,children:[(0,F.jsxs)(`div`,{className:`@4xl:col-span-3 flex flex-col gap-5`,children:[(0,F.jsx)(KV,{title:`Your apps`,n:s.length,children:s.length===0?(0,F.jsx)(`div`,{className:`text-ink2 text-[13px]`,children:`No app has reported yet. Follow the steps below.`}):(0,F.jsx)(`div`,{className:`flex flex-col divide-y divide-[#1f1f29]`,children:s.map(t=>{let n=Date.now()-t.lastSeen<9e5,r=(e.meta?.versions||[]).filter(e=>e.service===t.id);return(0,F.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,F.jsx)(yr,{size:17,className:`text-mute shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`font-medium text-[14px]`,children:t.id}),(0,F.jsx)(io,{frameworks:t.frameworks,className:`mt-1`}),(0,F.jsx)(`div`,{className:`text-mute text-[12px] mt-1`,children:[r.length?`version ${r[r.length-1].version}`:null,t.instances.length>1?`${t.instances.length} instances`:null].filter(Boolean).join(` · `)||`Node.js`})]}),(0,F.jsxs)(`span`,{className:`tone-${n?`good`:`neutral`} text-[12px] font-medium flex items-center gap-1.5`,style:{color:`var(--tone)`},children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full ${n?`live-dot`:``}`,style:{background:`var(--tone)`}}),n?`Reporting`:`Last heard ${GV(t.lastSeen)}`]})]},t.id)})})}),(0,F.jsx)(Lz,{initial:`zero`,title:`Connect an app`})]}),(0,F.jsxs)(`div`,{className:`@4xl:col-span-2 flex flex-col gap-5`,children:[(0,F.jsx)(SH,{}),(0,F.jsx)(CH,{}),(0,F.jsx)(KV,{title:`Ask Obzeri`,children:a.data?a.data.configured?(0,F.jsxs)(`div`,{className:`tone-good flex items-center gap-2 text-[13px]`,children:[(0,F.jsx)(Mr,{size:16,style:{color:`var(--tone)`}}),`Ready, using `,(0,F.jsx)(`b`,{children:a.data.model})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[13px] leading-relaxed`,children:`Ask questions about your app in plain words. Needs an AI model: Claude, any OpenAI-compatible API, or a local one through Ollama.`}),(0,F.jsxs)(`button`,{className:`btn btn-primary h-9 self-start`,onClick:()=>t(n(`/integrations/ai`)),children:[(0,F.jsx)(Fi,{size:14}),`Set up Ask Obzeri`]})]}):(0,F.jsx)(U,{})}),(0,F.jsxs)(KV,{title:`Privacy & data`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3 text-[13px]`,children:[(0,F.jsx)(ii,{size:15,className:`text-mute mt-0.5`}),(0,F.jsx)(`div`,{children:o.passwordProtected?`The dashboard is password protected.`:(0,F.jsxs)(F.Fragment,{children:[`No password: anyone who can reach this address can open the dashboard. Set `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_PASSWORD`}),` to lock it.`]})})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3 text-[13px]`,children:[(0,F.jsx)(Ir,{size:15,className:`text-mute mt-0.5`}),(0,F.jsxs)(`div`,{children:[`Details are kept for `,o.retentionDays,` days`,o.history?`, daily summaries for ${o.history.days} days`:``,`. Passwords and keys found in logs are hidden before saving.`]})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3 text-[13px]`,children:[(0,F.jsx)(Ni,{size:15,className:`text-mute mt-0.5`}),(0,F.jsxs)(`div`,{children:[`Your app keys are stored as hashes and shown only once. Create, rotate or limit them to one environment in `,(0,F.jsx)(`button`,{className:`link`,onClick:()=>r(`/settings`),children:`Advanced → Settings`}),`.`]})]})]}),(0,F.jsxs)(`button`,{className:`card p-4 text-left flex items-center gap-3 hover:border-line2 group`,onClick:()=>r(`/settings`),children:[(0,F.jsx)(Ni,{size:17,className:`text-mute`}),(0,F.jsxs)(`div`,{className:`flex-1`,children:[(0,F.jsx)(`div`,{className:`font-medium text-[13.5px]`,children:`All settings`}),(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:`Ingest keys, projects, email, MCP, ticket trackers, history`})]}),(0,F.jsx)(Or,{size:15,className:`text-mute group-hover:translate-x-0.5 transition-transform`})]})]})]})]})}function SH(){let e=I(),t=ht(),n=Qn(),r=e.meta?.usage;if(!r)return null;let i={unlimited:`No monthly limit: everything your apps send is kept.`,ok:`${R(r.included==null?null:Math.max(0,r.included-r.used))} events left this month.`,paced:`You sent a lot today, so most step-by-step timings pause until midnight (UTC). Errors and slow requests still keep theirs.`,reduced:`You used this month's events. Charts stay live, but most requests arrive without step-by-step timings.`,refused:`You used twice this month's events, so new data is turned away until the 1st.`,overage:`Past this month's events: extra ones are collected within your spending limits.`,paused:`Extra events are paused. Server errors and failed jobs are still collected.`};return(0,F.jsxs)(KV,{title:`Your plan`,right:(0,F.jsx)(`span`,{className:`text-[12px] text-mute`,children:r.name}),children:[r.included!=null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between text-[13px]`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{className:`text-[16px]`,children:R(r.used)}),` of `,R(r.included),` events used`]}),(0,F.jsx)(`span`,{className:`text-mute`,children:Yi(r.pct)})]}),(0,F.jsx)($i,{used:r.used,included:r.included})]}),(0,F.jsx)(`div`,{className:`text-[13px] leading-relaxed tone-${Zi[r.state].tone}`,children:i[r.state]}),(0,F.jsx)(`div`,{className:`text-[12px] text-mute leading-snug`,children:`An event is one request, background job, error, log line or step inside your code. Database calls are free.`}),(0,F.jsx)(`button`,{className:`btn h-9 self-start`,onClick:()=>t(n(`/usage`)),children:`Usage & plans`})]})}function CH(){let{mode:e,setMode:t}=rr(),n=(n,r,i,a)=>(0,F.jsxs)(`button`,{className:`text-left rounded-xl border px-3.5 py-3 flex gap-3 ${e===n?`border-brand bg-[rgba(255,61,127,.06)]`:`border-line hover:border-line2`}`,onClick:()=>t(n),"aria-pressed":e===n,children:[(0,F.jsx)(r,{size:18,className:e===n?`text-brand mt-0.5`:`text-mute mt-0.5`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-[13.5px]`,children:i}),(0,F.jsx)(`div`,{className:`text-mute text-[12px] mt-0.5 leading-snug`,children:a})]})]});return(0,F.jsxs)(KV,{title:`Dashboard mode`,children:[n(`simple`,Pi,`Simple`,`Is my app healthy, what broke, what changed, what to do. Plain words, no jargon.`),n(`advanced`,Ni,`Advanced`,`Every request, trace, query, release and runtime detail, for digging deep.`),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`Saved in this browser. Switch any time from the top bar.`})]})}var wH=e=>`${e.service}@${e.version}`;function TH(){let e=I(),[t]=zn(),{data:n,error:r}=P(`/api/simple/releases${e.q()}`,[e.tick]),i=t.get(`release`)||(t.get(`service`)&&t.get(`version`)?`${t.get(`service`)}@${t.get(`version`)}`:null);if(r)return(0,F.jsx)(W,{error:r});if(!n)return(0,F.jsx)(U,{});let a=n.filter(e=>e.latest),o=n.filter(e=>!e.latest);return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(xi,{size:22,className:`text-brand`}),`Releases`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Every deploy, and whether it made your app better or worse than the one before.`})]}),n.length===0?(0,F.jsx)(MH,{}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-5`,children:a.map(e=>(0,F.jsx)(kH,{r:e,focus:i===wH(e)},wH(e)))}),o.length>0&&(0,F.jsx)(KV,{title:`Earlier deploys`,n:o.length,children:(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:o.map(e=>(0,F.jsx)(AH,{r:e,focus:i===wH(e)},wH(e)))})})]})]})}function EH({r:e}){return(0,F.jsxs)(Xa,{tip:`Deployed ${Ca(e.first,!0)} · last request ${Ca(e.last,!0)}`,children:[`deployed `,GV(e.first)]})}function DH({r:e,big:t}){let n=WV[e.tone];return(0,F.jsxs)(`span`,{className:`tone-${e.tone} inline-flex items-center gap-1.5 font-semibold rounded-full ${t?`text-[12.5px] px-2.5 py-1`:`text-[11.5px] px-2 py-0.5`}`,style:{color:`var(--tone)`,background:`var(--tone-bg)`},children:[(0,F.jsx)(n,{size:t?14:12}),e.label]})}function OH(e){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{e&&setTimeout(()=>t.current?.scrollIntoView({block:`start`,behavior:`smooth`}),100)},[e]),t}function kH({r:e,focus:t}){let n=OH(t);return(0,F.jsxs)(`section`,{ref:n,className:`card tone-${e.tone} p-6 flex flex-col gap-5 scroll-mt-4`,style:{borderColor:e.tone===`bad`||e.tone===`warn`||t?`var(--tone-line)`:void 0,background:e.tone===`bad`||e.tone===`warn`?`linear-gradient(135deg, var(--tone-bg), transparent 50%), var(--color-panel)`:void 0},children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-4 flex-wrap`,children:[(0,F.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex items-center justify-center shrink-0`,style:{background:`var(--tone-bg)`,border:`1px solid var(--tone-line)`},children:(0,F.jsx)(xi,{size:22,style:{color:`var(--tone)`}})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-[11.5px] uppercase tracking-wider font-semibold text-mute`,children:[`Latest deploy of `,e.service]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap mt-0.5`,children:[(0,F.jsxs)(`h2`,{className:`text-[22px] font-semibold tracking-tight`,children:[e.service,` `,(0,F.jsx)(`span`,{className:`font-mono text-[19px]`,children:e.version})]}),(0,F.jsx)(DH,{r:e,big:!0})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[14px] mt-1.5 leading-relaxed`,children:e.summary}),(0,F.jsxs)(`div`,{className:`text-mute text-[12px] mt-1`,children:[(0,F.jsx)(EH,{r:e}),` · `,V(e.requests),` requests since`,e.previous?(0,F.jsxs)(F.Fragment,{children:[` · compared with `,(0,F.jsx)(`span`,{className:`mono`,children:e.previous})]}):null]})]}),(0,F.jsx)(`div`,{className:`flex gap-2 shrink-0`,children:(0,F.jsx)(qV,{question:e.ask,className:`btn h-9`})})]}),(0,F.jsx)(jH,{r:e})]})}function AH({r:e,focus:t}){let[n,r]=(0,v.useState)(t),i=OH(t);return(0,F.jsxs)(`div`,{ref:i,className:`rounded-xl border bg-[#111118] scroll-mt-4 ${n?`border-line2`:`border-line`}`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-3 px-4 py-3 text-left flex-wrap`,onClick:()=>r(!n),"aria-expanded":n,children:[(0,F.jsxs)(`span`,{className:`font-medium text-[14px] min-w-[150px]`,children:[e.service,` `,(0,F.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.version})]}),(0,F.jsx)(DH,{r:e}),(0,F.jsx)(`span`,{className:`text-mute text-[12.5px] flex-1 min-w-[200px] truncate`,children:e.summary}),(0,F.jsx)(`span`,{className:`text-mute text-[12px] shrink-0`,children:GV(e.first)}),n?(0,F.jsx)(Er,{size:15,className:`text-mute`}):(0,F.jsx)(Or,{size:15,className:`text-mute`})]}),n&&(0,F.jsxs)(`div`,{className:`px-4 pb-4 flex flex-col gap-4`,children:[(0,F.jsxs)(`div`,{className:`text-mute text-[12px]`,children:[(0,F.jsx)(EH,{r:e}),` · `,V(e.requests),` requests`]}),(0,F.jsx)(jH,{r:e}),(0,F.jsx)(`div`,{children:(0,F.jsx)(qV,{question:e.ask,className:`btn h-8`})})]})]})}function jH({r:e}){let t=ht(),n=Qn(),r=ir(),i=e.newErrors.length>0||e.codeChanges.length>0;return!e.compare.length&&!i&&!e.advice?e.verdict===`baseline`?null:(0,F.jsx)(`div`,{className:`text-ink2 text-[13px]`,children:`Not enough traffic on this version yet to compare. Check back after a few hundred requests.`}):(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.advice&&(0,F.jsxs)(`div`,{className:`tone-${e.tone} rounded-xl px-4 py-3.5 flex gap-3`,style:{background:`var(--tone-bg)`,border:`1px solid var(--tone-line)`},children:[(0,F.jsx)(ei,{size:17,style:{color:`var(--tone)`},className:`shrink-0 mt-0.5`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-semibold text-[13.5px]`,children:`What to do`}),(0,F.jsx)(`ol`,{className:`mt-1.5 flex flex-col gap-1`,children:e.advice.map((e,t)=>(0,F.jsxs)(`li`,{className:`text-[13px] flex gap-2`,children:[(0,F.jsxs)(`span`,{className:`text-mute tabular-nums`,children:[t+1,`.`]}),e]},t))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 ${i&&e.compare.length?`@4xl:grid-cols-2`:``} gap-4`,children:[e.compare.length>0&&(0,F.jsxs)(`div`,{className:`rounded-xl border border-line overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_20px_auto] gap-x-3 items-center px-4 py-2 text-[11px] uppercase tracking-wider text-mute border-b border-line bg-[#111118]`,children:[(0,F.jsx)(`span`,{children:`Before vs after`}),(0,F.jsx)(`span`,{className:`mono normal-case tracking-normal text-right`,children:e.previous}),(0,F.jsx)(`span`,{}),(0,F.jsx)(`span`,{className:`mono normal-case tracking-normal`,children:e.version})]}),e.compare.map(e=>(0,F.jsxs)(`div`,{className:`tone-${e.tone} grid grid-cols-[1fr_auto_20px_auto] gap-x-3 items-center px-4 py-2.5 border-b border-[#1d1d26] last:border-0`,children:[(0,F.jsx)(`span`,{className:`text-[13px] text-ink2`,children:e.hint?(0,F.jsx)(Xa,{tip:e.hint,children:e.label}):e.label}),(0,F.jsx)(`span`,{className:`text-[13px] tabular-nums text-mute text-right`,children:e.before}),(0,F.jsx)(pr,{size:13,className:`text-mute`}),(0,F.jsx)(`span`,{className:`text-[13.5px] tabular-nums font-semibold min-w-[70px]`,style:{color:e.tone===`neutral`?void 0:`var(--tone)`},children:e.after})]},e.label))]}),i&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.newErrors.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`text-[12.5px] font-semibold flex items-center gap-1.5 mb-1.5`,children:[(0,F.jsx)(xr,{size:14,className:`text-[#ff8a8a]`}),`New errors in this version`]}),(0,F.jsx)(`div`,{className:`flex flex-col`,children:e.newErrors.map(e=>(0,F.jsxs)(`button`,{className:`text-left rounded-lg px-2.5 py-2 -mx-2.5 hover:bg-[#181821] flex items-center gap-3 group`,onClick:()=>t(n(`/errors/${e.fingerprint}`)),children:[(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`text-[13px] font-medium text-[#ff9b9b]`,children:e.class}),(0,F.jsx)(`span`,{className:`block text-mute text-[12px] truncate`,children:e.message})]}),(0,F.jsxs)(`span`,{className:`text-[12px] text-ink2 tabular-nums`,children:[V(e.count),`×`]}),(0,F.jsx)(Or,{size:14,className:`text-mute`})]},e.fingerprint))})]}),e.codeChanges.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`text-[12.5px] font-semibold flex items-center gap-1.5 mb-1.5`,children:[(0,F.jsx)(Lr,{size:14,className:`text-mute`}),`What changed in the code`]}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.codeChanges.map(e=>(0,F.jsxs)(`li`,{className:`text-[13px] text-ink2 flex gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`•`}),e]},e))})]})]})]}),(0,F.jsx)(`div`,{children:(0,F.jsxs)(`button`,{className:`btn btn-ghost h-8 px-2 text-[12.5px]`,onClick:()=>r(`/releases?service=${encodeURIComponent(e.service)}&version=${encodeURIComponent(e.version)}`),children:[(0,F.jsx)(Ni,{size:13}),`Full comparison in Advanced`]})})]})}function MH(){let e=`OBZERVER_VERSION=$(git rev-parse --short HEAD)`;return(0,F.jsxs)(KV,{title:`Tag your deploys to see them here`,children:[(0,F.jsxs)(`div`,{className:`text-ink2 text-[13.5px] leading-relaxed`,children:[`Obzerver compares each version of your app with the one before: did errors go up, did it get slower, does it leak memory. Most CI and hosting providers (GitHub Actions, GitLab, Vercel, Render, Railway, Netlify, Heroku…) and a `,(0,F.jsx)(`span`,{className:`mono`,children:`.git`}),` folder are detected automatically. Otherwise, set a version when you deploy:`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`code flex-1`,children:e}),(0,F.jsx)(Ba,{text:e,className:`btn h-9`})]})]})}function NH({simple:e,advanced:t}){let{mode:n}=rr();return(0,F.jsx)(F.Fragment,{children:n===`simple`?e:t})}function PH(){let{traceId:e}=yt(),[t,n]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{N(`/api/traces/${e}`).then(e=>n(e.execution.id)).catch(()=>n(null))},[e]),t===void 0?(0,F.jsx)(U,{}):t===null?(0,F.jsxs)(`div`,{className:`text-mute py-10 text-center`,children:[`Trace `,e,` not found.`]}):(0,F.jsx)(Vt,{to:`/executions/${t}${window.location.search}`,replace:!0})}function FH({onDone:e}){let[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(``);return(0,F.jsxs)(`div`,{className:`h-full overflow-y-auto flex flex-col items-center justify-center gap-10 px-6 py-10`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-6 text-center`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-[18px] max-[480px]:scale-[0.72]`,children:[(0,F.jsx)(ho,{size:88}),(0,F.jsx)(_o,{size:64})]}),(0,F.jsx)(`p`,{className:`m-0 text-[15px] text-[#a3a3b8]`,children:`Know your app is healthy. Zero-config observability for Express and Fastify.`})]}),(0,F.jsxs)(`form`,{className:`card p-5 w-full max-w-[340px] flex flex-col gap-3`,onSubmit:async n=>{n.preventDefault();try{await N(`/api/auth/login`,{method:`POST`,json:{password:t}}),e()}catch(e){i(e.message||`Wrong password`)}},children:[(0,F.jsx)(`label`,{className:`text-[12.5px] text-ink2`,htmlFor:`obz-password`,children:`Dashboard password`}),(0,F.jsx)(`input`,{id:`obz-password`,type:`password`,autoFocus:!0,className:`input h-9`,placeholder:`Password`,value:t,onChange:e=>n(e.target.value)}),r&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] text-[12px]`,children:r}),(0,F.jsx)(`button`,{className:`btn btn-primary justify-center h-9`,children:`Sign in`})]})]})}function IH({children:e}){let[t]=zn();return(0,F.jsx)(v.Fragment,{children:e},t.get(`project`)||`default`)}function LH(){let[e,t]=(0,v.useState)(`loading`),n=()=>N(`/api/auth`).then(e=>t(e.ok?`ok`:`login`)).catch(()=>t(`ok`));return(0,v.useEffect)(()=>{n();let e=()=>t(`login`);return window.addEventListener(`obz:unauthorized`,e),()=>window.removeEventListener(`obz:unauthorized`,e)},[]),e===`loading`?(0,F.jsx)(U,{}):e===`login`?(0,F.jsx)(FH,{onDone:()=>t(`ok`)}):(0,F.jsx)(Mn,{basename:`/`.replace(/\/$/,``)||void 0,children:(0,F.jsx)(IH,{children:(0,F.jsx)(Zn,{children:(0,F.jsx)(nr,{children:(0,F.jsx)(Gt,{children:(0,F.jsxs)(Ut,{element:(0,F.jsx)(vo,{}),children:[(0,F.jsx)(Ut,{index:!0,element:(0,F.jsx)(NH,{simple:(0,F.jsx)(QV,{}),advanced:(0,F.jsx)(Bz,{})})}),(0,F.jsx)(Ut,{path:`requests`,element:(0,F.jsx)(Wz,{kind:`http`})}),(0,F.jsx)(Ut,{path:`jobs`,element:(0,F.jsx)(Wz,{kind:`job`})}),(0,F.jsx)(Ut,{path:`operations/:kind/:service/:name`,element:(0,F.jsx)(Qz,{})}),(0,F.jsx)(Ut,{path:`executions/:id`,element:(0,F.jsx)(aB,{})}),(0,F.jsx)(Ut,{path:`traces`,element:(0,F.jsx)(cB,{})}),(0,F.jsx)(Ut,{path:`traces/:traceId`,element:(0,F.jsx)(PH,{})}),(0,F.jsx)(Ut,{path:`map`,element:(0,F.jsx)(fV,{})}),(0,F.jsx)(Ut,{path:`errors`,element:(0,F.jsx)(lB,{})}),(0,F.jsx)(Ut,{path:`secrets`,element:(0,F.jsx)(dB,{})}),(0,F.jsx)(Ut,{path:`errors/:fp`,element:(0,F.jsx)(pB,{})}),(0,F.jsx)(Ut,{path:`logs`,element:(0,F.jsx)(Xi,{feature:`logs`,children:(0,F.jsx)(NH,{simple:(0,F.jsx)(yH,{}),advanced:(0,F.jsx)(iB,{})})})}),(0,F.jsx)(Ut,{path:`services`,element:(0,F.jsx)(kB,{})}),(0,F.jsx)(Ut,{path:`integrations`,element:(0,F.jsx)(Ez,{})}),(0,F.jsx)(Ut,{path:`projects`,element:(0,F.jsx)(jB,{})}),(0,F.jsx)(Ut,{path:`integrations/:id`,element:(0,F.jsx)(Ez,{})}),(0,F.jsx)(Ut,{path:`functions`,element:(0,F.jsx)(Vt,{to:`/services${window.location.search}`,replace:!0})}),(0,F.jsx)(Ut,{path:`queries`,element:(0,F.jsx)(FB,{})}),(0,F.jsx)(Ut,{path:`users`,element:(0,F.jsx)(IB,{})}),(0,F.jsx)(Ut,{path:`users/:id`,element:(0,F.jsx)(LB,{})}),(0,F.jsx)(Ut,{path:`profiler`,element:(0,F.jsx)(tV,{})}),(0,F.jsx)(Ut,{path:`metrics`,element:(0,F.jsx)(NH,{simple:(0,F.jsx)(hH,{}),advanced:(0,F.jsx)(rV,{})})}),(0,F.jsx)(Ut,{path:`releases`,element:(0,F.jsx)(NH,{simple:(0,F.jsx)(TH,{}),advanced:(0,F.jsx)(oV,{})})}),(0,F.jsx)(Ut,{path:`alerts`,element:(0,F.jsx)(Xi,{feature:`alerts`,children:(0,F.jsx)(NH,{simple:(0,F.jsx)(lH,{}),advanced:(0,F.jsx)(hV,{})})})}),(0,F.jsx)(Ut,{path:`slos`,element:(0,F.jsx)(Xi,{feature:`slos`,children:(0,F.jsx)(MV,{})})}),(0,F.jsx)(Ut,{path:`usage`,element:(0,F.jsx)(vB,{})}),(0,F.jsx)(Ut,{path:`status-pages`,element:(0,F.jsx)(zV,{})}),(0,F.jsx)(Ut,{path:`issues`,element:(0,F.jsx)(SV,{})}),(0,F.jsx)(Ut,{path:`issues/:id`,element:(0,F.jsx)(TV,{})}),(0,F.jsx)(Ut,{path:`settings`,element:(0,F.jsx)(NH,{simple:(0,F.jsx)(xH,{}),advanced:(0,F.jsx)(Rz,{})})}),(0,F.jsx)(Ut,{path:`*`,element:(0,F.jsx)(`div`,{className:`text-mute py-10 text-center`,children:`Not found`})})]})})})})})})}(0,Gn.createRoot)(document.getElementById(`root`)).render((0,F.jsx)(v.StrictMode,{children:(0,F.jsx)(LH,{})}));
|
|
116
|
+
`).trim()}function dB(){let e=I(),t=Qn(),n=ht(),[r,i]=zn(),[a,o]=(0,v.useState)(r.get(`q`)||``),[s,c]=(0,v.useState)(`all`),{data:l,error:u}=P(`/api/traces${e.q({q:r.get(`q`)||``,failed:s===`failed`?`1`:``,minDuration:s===`slow`?1e3:``,limit:200})}`,[e.tick,s]),d=(l||[]).filter(e=>s!==`distributed`||e.parts>1);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Gr,{size:18,className:`text-brand`}),title:`Traces`,sub:`Recent requests and jobs. Distributed traces follow the traceparent header across services.`}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=new URLSearchParams(r);a?t.set(`q`,a):t.delete(`q`),i(t,{replace:!0})},children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[360px] h-7`,placeholder:`Trace id, route, path, user id or error text`,value:a,onChange:e=>o(e.target.value)})]}),(0,F.jsx)(Va,{value:s,onChange:c,options:[{id:`all`,label:`All`},{id:`failed`,label:`Failed`},{id:`slow`,label:`> 1s`},{id:`distributed`,label:`Multi-service`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:u?(0,F.jsx)(W,{error:u}):l?(0,F.jsx)(Ha,{rows:d,onRow:e=>n(t(`/executions/${e.id}`)),empty:(0,F.jsx)(Na,{title:`No traces match`}),cols:[{key:`t`,label:`Time`,render:e=>(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Ca(e.ts),` `,(0,F.jsx)(`span`,{className:`text-mute text-[11px] ml-1`,children:Sa(e.ts)})]})},{key:`n`,label:`Operation`,render:e=>(0,F.jsx)(za,{name:e.name})},{key:`s`,label:`Application`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},{key:`p`,label:`Apps`,num:!0,render:e=>e.parts>1?(0,F.jsx)(`span`,{className:`pill`,style:{color:`#9cc4ff`},children:e.parts}):(0,F.jsx)(`span`,{className:`text-mute`,children:`1`})},{key:`st`,label:`Status`,render:e=>(0,F.jsx)(La,{status:e.status})},{key:`d`,label:`Duration`,num:!0,render:e=>B(e.duration)},{key:`u`,label:`User`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.user_id||`—`})},{key:`id`,label:`Trace id`,render:e=>(0,F.jsxs)(`span`,{className:`mono text-mute text-[11px]`,children:[e.trace_id.slice(0,16),`…`]})}]}):(0,F.jsx)(U,{})})})]})}function fB(){let e=I(),t=Qn(),n=ht(),[r,i]=(0,v.useState)(`0`),[a,o]=(0,v.useState)(``),{data:s,error:c}=P(`/api/errors${e.q({handled:r,status:a})}`,[e.tick]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(xr,{size:18,className:`text-brand`}),title:`Errors`,sub:`Grouped into defects by class and stack shape. Unhandled = 5xx or a thrown job/process error; a 4xx from your own code is your API working.`}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`0`,label:`Unhandled`},{id:`1`,label:`Handled`},{id:`all`,label:`All`}]}),(0,F.jsx)(Va,{value:a,onChange:o,options:[{id:``,label:`Any status`},{id:`open`,label:`Open`},{id:`resolved`,label:`Resolved`},{id:`ignored`,label:`Ignored`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:c?(0,F.jsx)(W,{error:c}):s?(0,F.jsx)(Ha,{rows:s,initialSort:`count`,onRow:e=>n(t(`/errors/${e.fingerprint}`)),rowKey:e=>e.fingerprint,empty:(0,F.jsx)(Na,{title:`No errors in this window`,icon:(0,F.jsx)(`span`,{className:`text-[18px]`,children:`✓`}),children:`Nothing matched these filters.`}),cols:[{key:`e`,label:`Error`,sort:e=>e.class,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0 max-w-[560px]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,style:{color:e.handled?`var(--color-ink)`:`#ff9b9b`},children:e.class}),e.isNew&&(0,F.jsx)(G,{kind:`serious`,children:`new`}),e.status!==`open`&&(0,F.jsx)(G,{kind:e.status===`resolved`?`good`:`neutral`,children:e.status})]}),(0,F.jsx)(`div`,{className:`text-mute truncate text-[12px]`,children:e.message})]})},{key:`op`,label:`Where`,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`truncate max-w-[220px]`,children:e.operation?(0,F.jsx)(za,{name:e.operation}):`—`}),(0,F.jsx)(`div`,{className:`text-mute text-[11px]`,children:e.service})]})},{key:`trend`,label:`Trend`,render:e=>(0,F.jsx)(Ia,{data:e.spark,color:e.handled?`#82829a`:GR.crit,w:80,h:20})},{key:`count`,label:`Events`,num:!0,sort:e=>e.count,render:e=>V(e.count)},{key:`users`,label:`Users`,num:!0,sort:e=>e.users,render:e=>V(e.users)},{key:`rel`,label:`Introduced`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2`,children:e.firstVersion||`—`})},{key:`first`,label:`First seen`,num:!0,sort:e=>e.firstSeen,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.firstSeen)})},{key:`last`,label:`Last seen`,num:!0,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:Sa(e.lastSeen)})}]}):(0,F.jsx)(U,{})})})]})}var pB=e=>new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1,timeZoneName:`short`});function mB(){let e=I(),t=Qn(),n=ht(),[r,i]=zn(),[a,o]=(0,v.useState)(`open`),{data:s,error:c,reload:l}=P(`/api/secrets${e.q({status:a})}`,[e.tick,a]),u=r.get(`fp`),d=P(u?`/api/secrets/${u}`:null,[u,e.tick]),f=e=>i(t=>{let n=new URLSearchParams(t);return e?n.set(`fp`,e):n.delete(`fp`),n},{replace:!0}),p=async(e,t)=>{await N(`/api/secrets/${e}`,{method:`POST`,json:{status:t}}),l(),d.reload()};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ai,{size:18,style:{color:`#ff6b6b`}}),title:`Secrets in logs`,sub:`Passwords, tokens, API keys, private keys and card numbers that reached a log line or an error message. They are redacted before storage (the value is never kept); each row is a place in your code that logs one.`}),s&&s.open>0&&(0,F.jsxs)(`div`,{className:`rounded-xl border px-4 py-3 flex items-start gap-3`,style:{borderColor:`#6b2330`,background:`rgba(208,59,59,.10)`},children:[(0,F.jsx)(Ai,{size:18,className:`shrink-0 mt-0.5`,style:{color:`#ff6b6b`}}),(0,F.jsxs)(`div`,{className:`text-[13px] leading-relaxed`,children:[(0,F.jsxs)(`b`,{style:{color:`#ffb0b0`},children:[s.open,` place`,s.open===1?``:`s`,` in your code log`,s.open===1?`s`:``,` secrets.`]}),` `,(0,F.jsx)(`span`,{className:`text-ink2`,children:`Fix the log line, then mark it resolved. If a secret may have been exposed before it was redacted (other log sinks, stdout, a log shipper), rotate it.`})]})]}),u&&(0,F.jsx)(H,{title:d.data?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{style:{color:`#ff9b9b`},children:d.data.label}),(0,F.jsxs)(`span`,{className:`text-mute font-normal`,children:[`in `,d.data.source===`error`?`an error message`:`logs`]})]}):`Leak`,right:(0,F.jsx)(`button`,{className:`btn btn-ghost h-6`,onClick:()=>f(null),children:`Close`}),children:d.error?(0,F.jsx)(W,{error:d.error}):d.data?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.5px]`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-4 gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Where`}),(0,F.jsx)(`div`,{className:`font-medium`,children:d.data.service}),(0,F.jsx)(`div`,{className:`text-ink2`,children:d.data.operation?(0,F.jsx)(za,{name:d.data.operation}):`outside a request or job`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Logger`}),(0,F.jsx)(`div`,{className:`font-medium mono`,children:d.data.logger||`—`}),(0,F.jsx)(`div`,{className:`text-mute`,children:d.data.detectedBy===`sdk`?`Redacted by the SDK, in the process`:`Redacted by the server, before storage`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Seen`}),(0,F.jsxs)(`div`,{className:`font-medium`,children:[V(d.data.count),` times`]}),(0,F.jsxs)(`div`,{className:`text-ink2`,children:[`first `,(0,F.jsx)(Xa,{tip:pB(d.data.firstSeen),children:Sa(d.data.firstSeen)}),d.data.firstVersion?` in ${d.data.firstVersion}`:``,` · last `,(0,F.jsx)(Xa,{tip:pB(d.data.lastSeen),children:Sa(d.data.lastSeen)})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,F.jsx)(`div`,{className:`text-mute`,children:`Status`}),(0,F.jsxs)(`div`,{className:`flex gap-1.5`,children:[d.data.status!==`resolved`&&(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>p(d.data.fingerprint,`resolved`),children:[(0,F.jsx)(ji,{size:13}),`Mark fixed`]}),d.data.status===`open`&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>p(d.data.fingerprint,`ignored`),children:`Ignore`}),d.data.status!==`open`&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>p(d.data.fingerprint,`open`),children:`Reopen`}),d.data.issueId&&(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,onClick:()=>n(t(`/issues/${d.data.issueId}`)),children:[(0,F.jsx)(Vr,{size:12}),`Issue #`,d.data.issueId]})]})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute mb-1`,children:`Example, as stored`}),(0,F.jsx)(`pre`,{className:`mono text-[12px] whitespace-pre-wrap break-all rounded-md border border-line px-3 py-2`,style:{background:`#101016`},children:hB(d.data.sample||``)})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute mb-1`,children:`Recent occurrences`}),(0,F.jsx)(Ha,{rows:d.data.findings,rowKey:e=>`${e.ts}${e.traceId}`,onRow:e=>e.traceId&&n(t(`/traces/${e.traceId}`)),cols:[{key:`t`,label:`Time`,render:e=>(0,F.jsx)(Xa,{tip:pB(e.ts),children:Ca(e.ts,!0)})},{key:`v`,label:`Version`,render:e=>(0,F.jsx)(`span`,{className:`mono`,children:e.version||`—`})},{key:`i`,label:`Instance`,render:e=>(0,F.jsx)(`span`,{className:`mono text-ink2`,children:e.instance||`—`})},{key:`c`,label:`Count`,num:!0,render:e=>V(e.count)},{key:`s`,label:`Text (redacted)`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2 truncate inline-block max-w-[520px] align-bottom`,children:hB(e.sample||``)})},{key:`tr`,label:`Trace`,render:e=>e.traceId?(0,F.jsxs)(`span`,{className:`mono text-[11.5px]`,style:{color:`#ff9cc0`},children:[e.traceId.slice(0,8),`…`]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})}]})]})]}):(0,F.jsx)(U,{})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsx)(Va,{value:a,onChange:o,options:[{id:`open`,label:`To fix`},{id:`resolved`,label:`Fixed`},{id:`ignored`,label:`Ignored`},{id:``,label:`All`}]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:c?(0,F.jsx)(W,{error:c}):s?(0,F.jsx)(Ha,{rows:s.groups,initialSort:`last`,rowKey:e=>e.fingerprint,onRow:e=>f(e.fingerprint),empty:(0,F.jsx)(Na,{title:a===`open`?`No secrets in your logs`:`Nothing here`,icon:(0,F.jsx)(ji,{size:20,className:`text-[#3fb68b]`}),children:`The SDK redacts passwords, tokens, keys and card numbers before logs leave your process, and the server checks again on arrival. Anything that gets through shows up here with a critical alert.`}),cols:[{key:`r`,label:`What leaked`,sort:e=>e.label,render:e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,style:{color:e.status===`open`?`#ff9b9b`:void 0},children:e.label}),e.status!==`open`&&(0,F.jsx)(G,{kind:e.status===`resolved`?`good`:`neutral`,children:e.status===`resolved`?`fixed`:e.status})]})},{key:`s`,label:`In`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.source===`error`?`error message`:`log line`})},{key:`w`,label:`Where`,sort:e=>`${e.service} ${e.operation}`,render:e=>(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{children:e.service}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[e.operation?(0,F.jsx)(za,{name:e.operation}):`outside a request or job`,e.logger?` · ${e.logger}`:``]})]})},{key:`ex`,label:`Example (redacted)`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2 truncate inline-block max-w-[380px] align-bottom`,children:hB(e.sample||``)})},{key:`win`,label:`In window`,num:!0,sort:e=>e.inWindow,render:e=>V(e.inWindow)},{key:`c`,label:`Total`,num:!0,sort:e=>e.count,render:e=>V(e.count)},{key:`first`,label:`First seen`,sort:e=>e.firstSeen,render:e=>(0,F.jsxs)(`span`,{className:`text-ink2`,children:[(0,F.jsx)(Xa,{tip:pB(e.firstSeen),children:Sa(e.firstSeen)}),e.firstVersion?(0,F.jsxs)(`span`,{className:`text-mute`,children:[` · `,e.firstVersion]}):``]})},{key:`last`,label:`Last seen`,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(Xa,{tip:pB(e.lastSeen),className:`text-ink2`,children:Sa(e.lastSeen)})}]}):(0,F.jsx)(U,{})})})]})}function hB(e){let t=e.split(`[REDACTED]`);return t.map((e,n)=>(0,F.jsxs)(`span`,{children:[e,n<t.length-1&&(0,F.jsx)(`span`,{className:`rounded px-1 mx-px`,style:{background:`rgba(208,59,59,.22)`,color:`#ff9b9b`},children:`[REDACTED]`})]},n))}function gB(){let{fp:e=``}=yt(),t=I(),n=Qn(),r=ht(),{data:i,error:a,reload:o}=P(`/api/errors/${e}${t.q()}`,[t.tick]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let s=i.group,c=async t=>{await N(`/api/errors/${e}`,{method:`PATCH`,json:{status:t}}),o()};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Nn,{to:n(`/errors`),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:`← Errors`}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,style:{color:s.handled?void 0:`#ff9b9b`},children:s.class}),s.handled?(0,F.jsx)(G,{kind:`neutral`,children:`handled`}):(0,F.jsx)(G,{kind:`crit`,children:`unhandled`}),(0,F.jsx)(G,{kind:s.status===`resolved`?`good`:s.status===`ignored`?`neutral`:`warn`,children:s.status})]}),(0,F.jsx)(`div`,{className:`mt-1.5 text-[13.5px]`,children:s.message}),(0,F.jsxs)(`div`,{className:`text-mute mt-1 text-[12px]`,children:[s.service,` · `,s.operation?(0,F.jsx)(za,{name:s.operation}):`no operation`,` · fingerprint `,(0,F.jsx)(`span`,{className:`mono`,children:s.fingerprint})]})]}),(0,F.jsxs)(`div`,{className:`flex gap-2 shrink-0`,children:[i.issues[0]?(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>r(n(`/issues/${i.issues[0].id}`)),children:[`Issue #`,i.issues[0].id]}):(0,F.jsxs)(`button`,{className:`btn`,onClick:async()=>{let t=await N(`/api/issues`,{method:`POST`,json:{title:`${s.class}: ${String(s.message).slice(0,110)}`,severity:s.handled?`low`:`high`,service:s.service,sourceType:`error`,sourceRef:e,description:`Error group first seen ${new Date(s.firstSeen).toISOString()}${s.firstVersion?` in ${s.firstVersion}`:``}.`}});r(n(`/issues/${t.id}`))},children:[(0,F.jsx)(Fr,{size:13}),`Create issue`]}),s.status===`open`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>c(`resolved`),children:[(0,F.jsx)(Mr,{size:13}),`Resolve`]}),(0,F.jsxs)(`button`,{className:`btn btn-ghost`,onClick:()=>c(`ignored`),children:[(0,F.jsx)(Hr,{size:13}),`Ignore`]})]}):(0,F.jsxs)(`button`,{className:`btn`,onClick:()=>c(`open`),children:[(0,F.jsx)(Si,{size:13}),`Reopen`]})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-5 gap-3`,children:[(0,F.jsx)(Fa,{label:`In this window`,value:V(i.windowCount)}),(0,F.jsx)(Fa,{label:`All time`,value:V(s.count)}),(0,F.jsx)(Fa,{label:`Users affected`,value:V(i.users.length)}),(0,F.jsx)(Fa,{label:`First seen`,value:(0,F.jsx)(`span`,{className:`text-[16px]`,children:Sa(s.firstSeen)}),sub:s.firstVersion?`in release ${s.firstVersion}`:void 0}),(0,F.jsx)(Fa,{label:`Last seen`,value:(0,F.jsx)(`span`,{className:`text-[16px]`,children:Sa(s.lastSeen)})})]}),(0,F.jsx)(YR,{title:`Occurrences`,children:(0,F.jsx)(JR,{data:i.series.points,series:[{key:`count`,label:`Occurrences`,color:s.handled?`#82829a`:GR.crit,type:`bar`}],height:130,fmt:e=>V(e)})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Latest stack trace`,sub:i.latest?Ca(i.latest.ts,!0):void 0,className:`@5xl:col-span-2`,children:i.latest?(0,F.jsx)(rB,{frames:i.latest.frames,stack:i.latest.stack}):(0,F.jsx)(Na,{title:`No occurrence stored`})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(H,{title:`Releases`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.versions,cols:[{key:`v`,label:`Version`,render:e=>(0,F.jsx)(`span`,{className:`mono`,children:e.version||`—`})},{key:`n`,label:`Events`,num:!0,render:e=>V(e.n)},{key:`l`,label:`Last`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.last)})}]})}),(0,F.jsx)(H,{title:`Operations`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.operations,empty:(0,F.jsx)(Na,{title:`—`}),cols:[{key:`o`,label:`Where`,render:e=>e.operation?(0,F.jsx)(za,{name:e.operation}):`—`},{key:`n`,label:`Events`,num:!0,render:e=>V(e.n)}]})}),i.users.length>0&&(0,F.jsx)(H,{title:`Affected users`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.users,maxHeight:220,onRow:e=>r(n(`/users/${Ea(e.user_id)}`)),cols:[{key:`u`,label:`User`,render:e=>e.user_id},{key:`n`,label:`Events`,num:!0,render:e=>V(e.n)}]})})]})]}),(0,F.jsx)(H,{title:`Occurrences`,sub:`most recent 50`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.occurrences,onRow:e=>e.execution_id&&r(n(`/executions/${e.execution_id}`)),cols:[{key:`t`,label:`Time`,render:e=>Ca(e.ts,!0)},{key:`v`,label:`Release`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px]`,children:e.version||`—`})},{key:`i`,label:`Instance`,render:e=>(0,F.jsx)(`span`,{className:`mono text-[11.5px] text-ink2`,children:e.instance})},{key:`u`,label:`User`,render:e=>e.user_id||`—`},{key:`s`,label:`Status`,render:e=>e.http_status??`—`},{key:`m`,label:`Message`,render:e=>(0,F.jsx)(`span`,{className:`text-mute truncate inline-block max-w-[380px] align-middle`,children:e.message})},{key:`x`,label:``,render:e=>e.execution_id?(0,F.jsx)(`span`,{className:`link`,children:`trace →`}):null}]})})]})}var _B=[[`requests`,`Requests`],[`jobs`,`Job runs`],[`errors`,`Errors`],[`logs`,`Log entries`],[`spans`,`Method spans`]],vB=e=>new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`,timeZone:`UTC`}),yB=e=>`$${e.toLocaleString(void 0,{maximumFractionDigits:e<10?2:0})}`,bB=e=>e.overage===`none`?`Nothing to pass`:e.overage===`reduce`?`Less detail, then refused at 2×`:`Overage, within spend controls`;function xB(){let e=I(),{data:t,error:n,reload:r}=P(`/api/usage`,[e.tick]),[i,a]=(0,v.useState)(null),o=async t=>{a(null);try{await N(`/api/usage`,{method:`PUT`,json:t}),await r(),e.refresh()}catch(e){a(e.message)}},s=async t=>{a(null);try{await N(`/api/usage/${t}`,{method:`POST`}),await r(),e.refresh()}catch(e){a(e.message)}};if(n)return(0,F.jsx)(W,{error:n});if(!t)return(0,F.jsx)(U,{});let c=t,l=Zi[c.state];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Wr,{size:18,className:`text-brand`}),title:`Usage`,sub:(0,F.jsxs)(F.Fragment,{children:[`Observability Events in `,new Date(c.resetsAt-1).toLocaleDateString(void 0,{month:`long`,year:`numeric`,timeZone:`UTC`}),`, across every project. Resets `,vB(c.resetsAt),` 00:00 UTC.`]}),right:(0,F.jsx)(G,{kind:l.tone,children:l.label})}),i&&(0,F.jsx)(`div`,{className:`card px-3.5 py-2.5 text-[12.5px]`,style:{borderColor:`#5a2a2a`,color:`#f2a0a0`},children:i}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-4 items-start`,children:[(0,F.jsxs)(H,{title:`This month`,className:`@5xl:col-span-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`text-[30px] font-semibold tracking-tight tabular-nums`,children:R(c.used)}),(0,F.jsx)(`span`,{className:`text-ink2 text-[14px]`,children:c.included?(0,F.jsxs)(F.Fragment,{children:[`of `,R(c.included),` events`,c.pct!=null&&(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(`b`,{className:`text-ink`,children:Yi(c.pct)})]})]}):`events (no allowance on Self-hosted)`})]}),c.included?(0,F.jsx)(`div`,{className:`mt-3 mb-1`,children:(0,F.jsx)($i,{used:c.used,included:c.included,thresholds:c.settings.thresholds})}):null,(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2 mt-2.5 flex flex-wrap gap-x-4 gap-y-1`,children:[(0,F.jsxs)(`span`,{children:[`Today `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.today)})]}),(0,F.jsxs)(`span`,{children:[`Projected by month end `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.projected)}),c.included&&c.projected>c.included?(0,F.jsxs)(`span`,{style:{color:`#fab219`},children:[` (`,R(c.projected-c.included),` over)`]}):null]}),c.overage>0&&(0,F.jsxs)(`span`,{children:[`Overage `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.overage)}),c.settings.overageRate?(0,F.jsxs)(F.Fragment,{children:[` ≈ `,yB(c.overage/1e6*c.settings.overageRate)]}):null]}),c.unbilled>0&&(0,F.jsxs)(`span`,{title:`Server errors and failed jobs collected while overage was paused`,children:[`Unbilled `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.unbilled)})]}),c.dropped>0&&(0,F.jsxs)(`span`,{title:`Events the plan didn't keep`,children:[`Not kept `,(0,F.jsx)(`b`,{className:`text-ink tabular-nums`,children:R(c.dropped)})]})]}),c.reason&&(0,F.jsx)(`div`,{className:`mt-3 text-[12.5px] rounded-lg px-3 py-2 bg-[rgba(250,178,25,.08)] border border-[rgba(250,178,25,.25)]`,children:c.reason}),c.plan.id===`self-hosted`&&(0,F.jsx)(`div`,{className:`mt-3 text-[12.5px] text-mute`,children:`Self-hosted keeps everything. Events are still counted, so you can see what a plan would use.`}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-5 gap-2 mt-4`,children:_B.map(([e,t])=>(0,F.jsxs)(`div`,{className:`rounded-lg bg-[#14141b] border border-line px-3 py-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] text-mute`,children:t}),(0,F.jsx)(`div`,{className:`text-[15px] font-semibold tabular-nums`,children:R(c.kinds[e])})]},e))})]}),(0,F.jsx)(H,{title:`Plan`,right:(0,F.jsx)(`span`,{className:`text-[12px] text-mute`,children:c.plan.name}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 text-[13px]`,children:[(0,F.jsx)(SB,{label:`Included events`,value:c.plan.included==null?`No limit`:`${R(c.plan.included)} / month`}),(0,F.jsx)(SB,{label:`Retention`,value:c.plan.retentionDays==null?`Your setting (OBZERVER_RETENTION_DAYS)`:`${c.plan.retentionDays} days`}),c.limits.spanTreeDays&&(0,F.jsxs)(`div`,{className:`text-[11.5px] text-mute -mt-1`,children:[`Fast, successful executions keep their span tree for `,c.limits.spanTreeDays,` days; slow or failed ones keep it for the whole window.`]}),(0,F.jsx)(SB,{label:`Logs & alerts`,value:(0,F.jsx)(CB,{on:c.plan.features.logs&&c.plan.features.alerts})}),(0,F.jsx)(SB,{label:`SLOs`,value:(0,F.jsx)(CB,{on:c.plan.features.slos})}),(0,F.jsx)(SB,{label:`Past the allowance`,value:bB(c.plan)})]})})]}),(0,F.jsx)(H,{title:`Events per day`,sub:`UTC days, this month`,children:(0,F.jsx)(`div`,{style:{height:180},children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(HR,{data:c.daily,margin:{top:6,right:6,bottom:0,left:-6},barCategoryGap:3,children:[(0,F.jsx)(rF,{vertical:!1}),(0,F.jsx)(tL,{dataKey:`day`,tickLine:!1,axisLine:{stroke:`#2a2a35`},tickFormatter:e=>String(Number(e.slice(8))),interval:`preserveStartEnd`}),(0,F.jsx)(vL,{tickLine:!1,axisLine:!1,tickFormatter:e=>R(e),width:44}),c.limits.dailyPace&&(0,F.jsx)(mN,{y:c.limits.dailyPace,stroke:`#fab219`,strokeDasharray:`4 3`,label:{value:`Pace ${R(c.limits.dailyPace)}/day`,position:`insideTopRight`,fill:`#fab219`,fontSize:10.5}}),(0,F.jsx)(Dm,{cursor:{fill:`rgba(255,255,255,.04)`},isAnimationActive:!1,content:({active:e,payload:t})=>e&&t?.length?(0,F.jsxs)(`div`,{className:`rounded-lg border border-line2 px-3 py-1.5 text-[12px]`,style:{background:`rgba(20,20,27,.97)`},children:[(0,F.jsx)(`div`,{className:`text-mute`,children:vB(Date.parse(t[0].payload.day))}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`b`,{children:t[0].value.toLocaleString()}),` events`]}),t[0].payload.unbilled>0&&(0,F.jsxs)(`div`,{className:`text-ink2`,children:[t[0].payload.unbilled.toLocaleString(),` unbilled`]}),t[0].payload.dropped>0&&(0,F.jsxs)(`div`,{className:`text-ink2`,children:[t[0].payload.dropped.toLocaleString(),` not kept`]})]}):null}),(0,F.jsx)($j,{dataKey:`events`,fill:WR[0],radius:[4,4,0,0],isAnimationActive:!1})]})})})}),(0,F.jsx)(wB,{report:c,onSave:o}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-4 items-start`,children:[(0,F.jsx)(TB,{report:c,onSave:o,onPost:s}),(0,F.jsx)(DB,{report:c,onSave:o})]}),(0,F.jsx)(OB,{report:c}),(0,F.jsx)(jB,{}),(0,F.jsx)(H,{title:`What counts`,right:(0,F.jsx)(Xr,{size:14,className:`text-mute`}),children:(0,F.jsxs)(`div`,{className:`text-[12.8px] text-ink2 leading-relaxed flex flex-col gap-2 max-w-[860px]`,children:[(0,F.jsx)(`p`,{children:`One Observability Event per request, background job run, error, log entry or trace span your apps report. Events add up: a request that ran through three of your own methods, wrote two log lines and raised one error is seven events.`}),(0,F.jsx)(`p`,{children:`Database-query and outbound-HTTP spans don't count: they are detail about a method span that is already counted. Runtime samples (CPU, memory, event loop) and custom metrics don't count either.`}),(0,F.jsxs)(`p`,{children:[`To send fewer events, ignore noisy routes in the SDK (`,(0,F.jsx)(`span`,{className:`mono`,children:`ignore`}),` in `,(0,F.jsx)(`span`,{className:`mono`,children:`init()`}),`) and keep log levels at `,(0,F.jsx)(`span`,{className:`mono`,children:`info`}),` or above in production.`]})]})})]})}function SB({label:e,value:t}){return(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`span`,{className:`text-ink2`,children:e}),(0,F.jsx)(`span`,{className:`text-right`,children:t})]})}function CB({on:e}){return e?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,style:{color:`#3ccf7a`},children:[(0,F.jsx)(Tr,{size:14}),`Included`]}):(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-mute`,children:[(0,F.jsx)(ii,{size:13}),`Not included`]})}function wB({report:e,onSave:t}){let[n,r]=(0,v.useState)({included:String(e.settings.enterprise.included),retentionDays:String(e.settings.enterprise.retentionDays)}),i=e.plan.id;return(0,F.jsxs)(H,{title:`Plans`,sub:`Choose the plan this server enforces`,pad:!1,children:[(0,F.jsx)(`div`,{className:`overflow-x-auto`,children:(0,F.jsxs)(`table`,{className:`w-full text-[12.8px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsx)(`tr`,{className:`text-mute text-[11.5px] text-left`,children:[`Plan`,`Included events / month`,`Retention`,`Logs & alerts`,`SLOs`,`Past the allowance`,``].map(e=>(0,F.jsx)(`th`,{className:`font-medium px-3.5 py-2 border-b border-line`,children:e},e))})}),(0,F.jsx)(`tbody`,{children:e.plans.map(e=>{let a=e.id===i,o=e.id===`enterprise`;return(0,F.jsxs)(`tr`,{className:a?`bg-[rgba(255,61,127,.06)]`:``,children:[(0,F.jsxs)(`td`,{className:`px-3.5 py-2.5 border-b border-line font-medium`,children:[e.name,a&&(0,F.jsx)(`span`,{className:`ml-2 text-[10.5px] font-semibold text-brand`,children:`CURRENT`})]}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line tabular-nums`,children:o?(0,F.jsx)(`input`,{className:`input h-7 w-[120px]`,"aria-label":`Enterprise included events`,value:n.included,onChange:e=>r({...n,included:e.target.value})}):e.included==null?`No limit`:R(e.included)}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line tabular-nums`,children:o?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`input`,{className:`input h-7 w-[70px]`,"aria-label":`Enterprise retention days`,value:n.retentionDays,onChange:e=>r({...n,retentionDays:e.target.value})}),`days`]}):e.retentionDays==null?`Your setting`:`${e.retentionDays} days`}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line`,children:(0,F.jsx)(CB,{on:e.features.logs})}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line`,children:(0,F.jsx)(CB,{on:e.features.slos})}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line text-ink2`,children:bB(e)}),(0,F.jsx)(`td`,{className:`px-3.5 py-2.5 border-b border-line text-right`,children:o?(0,F.jsx)(`button`,{className:`btn h-7`,onClick:()=>t({plan:`enterprise`,enterprise:{included:Number(n.included),retentionDays:Number(n.retentionDays)}}),children:a?`Save`:`Choose`}):!a&&(0,F.jsx)(`button`,{className:`btn h-7`,onClick:()=>t({plan:e.id}),children:`Choose`})})]},e.id)})})]})}),(0,F.jsx)(`div`,{className:`px-3.5 py-2.5 text-[11.5px] text-mute`,children:`Choosing a plan applies its allowance, retention and features to every project on this server. Retention takes effect at the next hourly clean-up.`})]})}function TB({report:e,onSave:t,onPost:n}){let r=e.settings,[i,a]=(0,v.useState)(r.budget==null?``:String(r.budget)),[o,s]=(0,v.useState)(r.overageRate==null?``:String(r.overageRate));if((0,v.useEffect)(()=>{a(r.budget==null?``:String(r.budget)),s(r.overageRate==null?``:String(r.overageRate))},[r.budget,r.overageRate]),e.plan.overage===`none`)return(0,F.jsx)(H,{title:`Spend controls`,children:(0,F.jsx)(`div`,{className:`text-[12.8px] text-ink2`,children:`Self-hosted has no allowance, so there is nothing to control. Choose a plan above to meter against one.`})});if(e.plan.overage===`reduce`){let t=e.plan.included??0;return(0,F.jsxs)(H,{title:`Past the Free allowance`,children:[(0,F.jsxs)(`ol`,{className:`flex flex-col gap-2.5 text-[12.8px]`,children:[(0,F.jsx)(EB,{n:1,on:e.state===`paced`,title:`Paced day: past ${R(e.limits.dailyPace)} events in one UTC day`,children:`Most trace waterfalls pause until 00:00 UTC.`}),(0,F.jsx)(EB,{n:2,on:e.state===`reduced`,title:`Past ${R(t)} this month`,children:`Charts stay live, but most traces arrive without spans.`}),(0,F.jsx)(EB,{n:3,on:e.state===`refused`,title:`At ${R(e.limits.refuseAt)}`,children:`New telemetry is refused with a 429 until the 1st, and dropped, not queued.`})]}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute mt-3`,children:`While paced or reduced, server errors, failed jobs and anything slower than 1 second keep full traces.`})]})}let c=e.state===`paused`,l=e.spikeProtection.limit==null?``:r.overageRate?`${yB(50)} of overage (${R(e.spikeProtection.limit)} events)`:`${R(e.spikeProtection.limit)} overage events (half the allowance; set a price to use $50)`;return(0,F.jsx)(H,{title:`Spend controls`,right:c?(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>n(`resume`),children:[(0,F.jsx)(mi,{size:13}),`Resume overage`]}):(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>n(`pause`),children:[(0,F.jsx)(fi,{size:13}),`Pause overage`]}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.8px]`,children:[(0,F.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:e.spikeProtection.on,onChange:e=>t({spikeProtection:e.target.checked})}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`font-medium flex items-center gap-1.5`,children:[(0,F.jsx)(ji,{size:14,className:`text-mute`}),`Spike protection`]}),(0,F.jsxs)(`div`,{className:`text-ink2 mt-0.5`,children:[`Pauses overage when a surge would push this month's overage to `,l,` at the current pace.`,e.spikeProtection.resumed?` Off until the 1st: you resumed overage this month.`:``]})]})]}),(0,F.jsx)(K,{label:`Monthly overage budget (events beyond the allowance)`,hint:`Empty: no budget. 0: collect nothing beyond the included events.`,children:(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{className:`input h-8 w-[180px]`,inputMode:`numeric`,placeholder:`No budget`,value:i,onChange:e=>a(e.target.value)}),(0,F.jsx)(`button`,{className:`btn h-8`,onClick:()=>t({budget:i.trim()===``?null:Number(i)}),children:`Save`})]})}),(0,F.jsx)(K,{label:`Price per million overage events (optional, USD)`,hint:`Shows overage as money and sizes spike protection at $50.`,children:(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{className:`input h-8 w-[120px]`,inputMode:`decimal`,placeholder:`—`,value:o,onChange:e=>s(e.target.value)}),(0,F.jsx)(`button`,{className:`btn h-8`,onClick:()=>t({overageRate:o.trim()===``?null:Number(o)}),children:`Save`})]})}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`While overage is paused, server errors, failed jobs, runtime and custom metrics continue unbilled. Other events beyond the allowance are dropped until the 1st, or until you resume, change the budget or upgrade.`})]})})}function EB({n:e,on:t,title:n,children:r}){return(0,F.jsxs)(`li`,{className:`flex gap-3 rounded-lg px-3 py-2 border ${t?`border-[rgba(250,178,25,.45)] bg-[rgba(250,178,25,.07)]`:`border-line`}`,children:[(0,F.jsx)(`span`,{className:`w-5 h-5 rounded-full grid place-items-center text-[11px] font-semibold bg-[#1d1d27] shrink-0`,children:e}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`font-medium`,children:[n,t&&(0,F.jsx)(`span`,{className:`ml-2 text-[10.5px] font-semibold`,style:{color:`#fab219`},children:`NOW`})]}),(0,F.jsx)(`div`,{className:`text-ink2 mt-0.5`,children:r})]})]})}function DB({report:e,onSave:t}){let n=e.settings,[r,i]=(0,v.useState)(n.thresholds.join(`, `)),[a,o]=(0,v.useState)(n.notify),s=P(`/api/settings`);(0,v.useEffect)(()=>{i(n.thresholds.join(`, `)),o(n.notify)},[n.thresholds.join(`,`),n.notify]);let c=!!s.data?.email?.configured;return(0,F.jsx)(H,{title:`Quota notifications`,right:(0,F.jsx)(gr,{size:14,className:`text-mute`}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 text-[12.8px]`,children:[(0,F.jsx)(K,{label:`Thresholds, % of the allowance (up to five)`,hint:`For example 50, 80, 100. Each one emails once a month.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,value:r,onChange:e=>i(e.target.value),placeholder:`50, 80, 100`,disabled:e.plan.included==null})}),(0,F.jsx)(K,{label:`Email to`,hint:c?`Comma-separated.`:`Email isn’t set up on this server yet (Settings → Email), so notifications only show here.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,value:a,onChange:e=>o(e.target.value),placeholder:`you@example.com`,disabled:e.plan.included==null})}),(0,F.jsx)(`button`,{className:`btn btn-primary h-8 self-start`,disabled:e.plan.included==null,onClick:()=>t({thresholds:r.split(/[\s,%]+/).filter(Boolean).map(Number),notify:a}),children:`Save notifications`}),e.plan.included==null?(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:`Self-hosted has no allowance to notify about.`}):e.notified.length>0&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`This month`}),e.notified.map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between`,children:[(0,F.jsxs)(`span`,{children:[`Passed `,e.pct,`%`]}),(0,F.jsxs)(`span`,{className:`text-ink2`,children:[vB(e.ts),` · `,R(e.used),` events`]})]},e.pct))]})]})})}function OB({report:e}){let t=e.byProject.flatMap(e=>e.apps.map(t=>({...t,project:e.name,key:`${e.slug}/${t.service}/${t.env??``}`}))),n=Math.max(1,...t.map(e=>e.billed)),r=(e,t)=>({key:e,label:t,num:!0,sort:t=>t[e],render:t=>R(t[e])}),i=[...e.byProject.length>1?[{key:`project`,label:`Project`,sort:e=>e.project,render:e=>e.project}]:[],{key:`app`,label:`App`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.service})},{key:`env`,label:`Environment`,sort:e=>e.env??``,render:e=>e.env??(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`billed`,label:`Events`,num:!0,sort:e=>e.billed,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(Ga,{value:e.billed,max:n}),R(e.billed)]})},r(`requests`,`Requests`),r(`jobs`,`Jobs`),r(`errors`,`Errors`),r(`logs`,`Logs`),r(`spans`,`Spans`)];return(0,F.jsx)(H,{title:`By project and app`,sub:`This month`,pad:!1,children:(0,F.jsx)(Ha,{rows:t,cols:i,initialSort:`billed`,rowKey:e=>e.key,empty:(0,F.jsx)(`div`,{className:`px-3.5 py-4 text-mute text-[12.5px]`,children:`No events yet this month.`})})})}var kB=e=>e==null?null:`$${e<1?e.toFixed(e<.01?4:2):e.toFixed(2)}`,AB=e=>e==null?``:String(e);function jB(){let e=I(),{data:t,error:n,reload:r}=P(`/api/ai/usage`,[e.tick]),[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{if(!t)return;let e=t.limits;a({perQuestion:AB(e.perQuestion),perHour:AB(e.perHour),historyTurns:AB(e.historyTurns),budgetUnit:e.budgetUnit,daily:AB(e.daily),monthly:AB(e.monthly),priceIn:AB(e.prices.input),priceOut:AB(e.prices.output),thresholds:e.thresholds.join(`, `),notify:e.notify})},[t]),n)return(0,F.jsx)(W,{error:n});if(!t)return null;let u=t,d=u.limits,f=e=>t=>{l(!1),a({...i,[e]:t.target.value})},p=async()=>{s(null);try{await N(`/api/ai/usage`,{method:`PUT`,json:{perQuestion:i.perQuestion,perHour:i.perHour||0,historyTurns:i.historyTurns,budgetUnit:i.budgetUnit,daily:i.daily.trim()||null,monthly:i.monthly.trim()||null,prices:{input:i.priceIn.trim()||null,output:i.priceOut.trim()||null},thresholds:i.thresholds.split(/[\s,%]+/).filter(Boolean).map(Number),notify:i.notify}}),await r(),e.reloadMeta(),l(!0)}catch(e){s(e.message)}},m=d.budgetUnit===`usd`,h=e=>m?kB(e):`${R(e)} tokens`,g=(e,t)=>(0,F.jsxs)(`div`,{className:`rounded-lg bg-[#14141b] border border-line px-3 py-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] text-mute`,children:e}),(0,F.jsxs)(`div`,{className:`text-[15px] font-semibold tabular-nums`,children:[R(t.tokens),` `,(0,F.jsx)(`span`,{className:`text-[11.5px] font-normal text-ink2`,children:`tokens`})]}),(0,F.jsxs)(`div`,{className:`text-[11.5px] text-ink2 tabular-nums`,children:[t.questions,` question`,t.questions===1?``:`s`,t.cost==null?``:` · ${kB(t.cost)}`]})]});return(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Fi,{size:14,className:`text-brand`}),`Ask Obzeri`]}),sub:`Tokens on your own model key. Questions over MCP use the client's model and cost nothing here.`,right:u.blocked?(0,F.jsx)(G,{kind:`serious`,children:`Paused`}):null,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.blocked&&(0,F.jsx)(`div`,{className:`text-[12.5px] rounded-lg px-3 py-2 bg-[rgba(250,178,25,.08)] border border-[rgba(250,178,25,.25)]`,children:u.blocked.error}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @lg:grid-cols-3 gap-2`,children:[g(`This month`,u.month),g(`Today`,u.today),(0,F.jsxs)(`div`,{className:`rounded-lg bg-[#14141b] border border-line px-3 py-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] text-mute`,children:`Per question, on average`}),(0,F.jsx)(`div`,{className:`text-[15px] font-semibold tabular-nums`,children:u.perQuestion==null?`—`:(0,F.jsxs)(F.Fragment,{children:[R(u.perQuestion),` `,(0,F.jsx)(`span`,{className:`text-[11.5px] font-normal text-ink2`,children:`tokens`})]})}),(0,F.jsxs)(`div`,{className:`text-[11.5px] text-ink2`,children:[`Capped at `,R(d.perQuestion)]})]})]}),(d.monthly!=null||d.daily!=null)&&(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-2 gap-4`,children:[d.monthly!=null&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[12.5px]`,children:[(0,F.jsx)(`span`,{children:`Monthly budget`}),(0,F.jsxs)(`span`,{className:`text-ink2 tabular-nums`,children:[h(u.spent.month),` of `,h(d.monthly)]})]}),(0,F.jsx)($i,{used:u.spent.month,included:d.monthly,thresholds:d.thresholds,height:8})]}),d.daily!=null&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex justify-between text-[12.5px]`,children:[(0,F.jsx)(`span`,{children:`Daily budget`}),(0,F.jsxs)(`span`,{className:`text-ink2 tabular-nums`,children:[h(u.spent.today),` of `,h(d.daily)]})]}),(0,F.jsx)($i,{used:u.spent.today,included:d.daily,height:8})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-3 gap-x-4 gap-y-3 text-[12.8px]`,children:[(0,F.jsx)(K,{label:`Tokens per question`,hint:`Past this, Obzeri answers with what it has.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`numeric`,value:i.perQuestion??``,onChange:f(`perQuestion`)})}),(0,F.jsx)(K,{label:`Questions per hour, per browser`,hint:`0 turns the limit off.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`numeric`,value:i.perHour??``,onChange:f(`perHour`)})}),(0,F.jsx)(K,{label:`Earlier messages sent with a question`,hint:`Each one is sent again on every step.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`numeric`,value:i.historyTurns??``,onChange:f(`historyTurns`)})}),(0,F.jsx)(K,{label:`Budgets in`,children:(0,F.jsxs)(`select`,{className:`input h-8 w-full`,value:i.budgetUnit??`tokens`,onChange:f(`budgetUnit`),children:[(0,F.jsx)(`option`,{value:`tokens`,children:`Tokens`}),(0,F.jsx)(`option`,{value:`usd`,children:`Dollars (needs prices)`})]})}),(0,F.jsx)(K,{label:`Daily budget${i.budgetUnit===`usd`?` ($)`:``}`,hint:`Empty: none. Resets 00:00 UTC.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`No limit`,value:i.daily??``,onChange:f(`daily`)})}),(0,F.jsx)(K,{label:`Monthly budget${i.budgetUnit===`usd`?` ($)`:``}`,hint:`Empty: none. Resets on the 1st.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`No limit`,value:i.monthly??``,onChange:f(`monthly`)})}),(0,F.jsx)(K,{label:`Price per million input tokens ($)`,hint:`From your provider's price list for this model.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`—`,value:i.priceIn??``,onChange:f(`priceIn`)})}),(0,F.jsx)(K,{label:`Price per million output tokens ($)`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,inputMode:`decimal`,placeholder:`—`,value:i.priceOut??``,onChange:f(`priceOut`)})}),(0,F.jsx)(`div`,{}),(0,F.jsx)(K,{label:`Notify at, % of the monthly budget (up to five)`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,placeholder:`50, 80, 100`,value:i.thresholds??``,onChange:f(`thresholds`)})}),(0,F.jsx)(K,{label:`Email to`,hint:`Needs email set up in Integrations → Email.`,children:(0,F.jsx)(`input`,{className:`input h-8 w-full`,placeholder:`you@example.com`,value:i.notify??``,onChange:f(`notify`)})}),(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary h-8`,onClick:p,children:`Save limits`}),c&&(0,F.jsx)(`span`,{className:`text-[12px]`,style:{color:`#3ccf7a`},children:`Saved`})]})]}),o&&(0,F.jsx)(`div`,{className:`text-[12.5px]`,style:{color:`#f2a0a0`},children:o}),(u.byModel.length>0||u.byProject.length>1)&&(0,F.jsx)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-2 gap-4 text-[12.5px]`,children:[[`By model`,u.byModel],[`By project`,u.byProject]].filter(([,e])=>e.length>0).map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute mb-1`,children:e}),t.map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between py-1 border-b border-line last:border-0`,children:[(0,F.jsx)(`span`,{className:`mono text-[12px]`,children:e.name}),(0,F.jsxs)(`span`,{className:`text-ink2 tabular-nums`,children:[R(e.tokens),` tokens · `,e.questions,` q`,e.cost==null?``:` · ${kB(e.cost)}`]})]},e.name))]},e))})]})})}function MB(){let e=I(),[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(`all`),{data:a,error:o}=P(`/api/functions${e.q()}`,[e.tick]),s=(a||[]).filter(e=>(r===`all`||e.kind===r)&&(!t||e.name.toLowerCase().includes(t.toLowerCase()))),c=Math.max(1,...s.map(e=>e.share));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(yr,{size:18,className:`text-brand`}),title:`Services`,sub:`Time per service class method, route handler and middleware. Own time excludes awaited work (queries, HTTP calls, nested methods), so the top of this list is where your own code spends time.`}),(0,F.jsx)(NB,{}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[260px] h-7`,placeholder:`Filter by name`,value:t,onChange:e=>n(e.target.value)})]}),(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`all`,label:`All`},{id:`function`,label:`Class methods`},{id:`handler`,label:`Handlers`},{id:`middleware`,label:`Middleware`},{id:`custom`,label:`Custom spans`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:o?(0,F.jsx)(W,{error:o}):a?(0,F.jsx)(Ha,{rows:s,initialSort:`self`,rowKey:e=>e.service+e.name+e.kind,empty:(0,F.jsxs)(Na,{title:`No timed code yet`,children:[`Handlers and middleware are timed automatically, and so are classes exported from `,(0,F.jsx)(`span`,{className:`mono`,children:`*.service.ts`}),` and `,(0,F.jsx)(`span`,{className:`mono`,children:`*.repository.ts`}),` files. For other files, set `,(0,F.jsx)(`span`,{className:`mono`,children:`autoInstrument`}),` globs or call `,(0,F.jsx)(`span`,{className:`mono`,children:`instrument(MyClass)`}),`.`]}),cols:[{key:`n`,label:`Name`,sort:e=>e.name,render:e=>{let t=Yz[e.kind]||Yz.function;return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(t.Icon,{size:12,style:{color:t.color}}),(0,F.jsx)(`span`,{className:`mono text-[12px]`,children:e.name})]})}},{key:`k`,label:`Kind`,sort:e=>e.kind,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:e.kind===`function`?`Class method`:Yz[e.kind]?.label})},{key:`s`,label:`Application`,sort:e=>e.service,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service}),(0,F.jsx)(ao,{app:e.service,web:!0})]})},{key:`calls`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`avgSelf`,label:`Avg own`,num:!0,sort:e=>e.avgSelf,render:e=>B(e.avgSelf)},{key:`avgTotal`,label:`Avg total`,num:!0,sort:e=>e.avgTotal,render:e=>B(e.avgTotal)},{key:`self`,label:`Own time`,num:!0,sort:e=>e.self,render:e=>B(e.self)},{key:`total`,label:`Total time`,num:!0,sort:e=>e.total,render:e=>B(e.total)},{key:`share`,label:`Share of own time`,num:!0,sort:e=>e.share,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`inline-block min-w-[44px]`,children:ba(e.share,1)}),(0,F.jsx)(Ga,{value:e.share,max:c,color:WR[4],w:70})]})},{key:`err`,label:`Errors`,num:!0,sort:e=>e.errors,render:e=>e.errors?(0,F.jsx)(`span`,{style:{color:`#ff8a8a`},children:V(e.errors)}):(0,F.jsx)(`span`,{className:`text-mute`,children:`0`})}]}):(0,F.jsx)(U,{})})})]})}function NB(){let e=I(),t=e.meta?.environments??[],n=(e.meta?.services??[]).filter(t=>!e.service||t.id===e.service).filter(n=>!e.env||t.find(t=>t.id===e.env)?.services.includes(n.id));return n.length?(0,F.jsx)(`div`,{className:`grid grid-cols-1 @3xl:grid-cols-2 @6xl:grid-cols-3 gap-3`,children:n.map(e=>{let n=Date.now()-e.lastSeen<9e5,r=t.filter(t=>t.services.includes(e.id)).map(e=>e.id);return(0,F.jsxs)(`div`,{className:`card px-4 py-3 flex flex-col gap-2 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0`,style:{background:n?`#3ccf7a`:`#5c5c70`},title:n?`Reporting`:`Last heard ${Sa(e.lastSeen)}`}),(0,F.jsx)(`span`,{className:`font-medium text-[13.5px] truncate`,children:e.id}),(0,F.jsx)(`span`,{className:`flex-1`}),(0,F.jsx)(`span`,{className:`text-[11.5px] text-mute shrink-0`,children:n?`reporting`:Sa(e.lastSeen)})]}),(0,F.jsx)(io,{frameworks:e.frameworks}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute truncate`,children:[e.node?`Node ${e.node.replace(/^v/,``)}`:null,`${e.instances.length} instance${e.instances.length===1?``:`s`}`,r.length?r.join(`, `):e.environment].filter(Boolean).join(` · `)})]},e.id)})}):null}function PB(){let[e,t]=zn(),n=ht(),{data:r,error:i,reload:a}=P(`/api/projects`),[o,s]=(0,v.useState)(e.get(`new`)===`1`),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),f=e.get(`project`)||`default`,p=()=>{if(s(!1),e.get(`new`)){let n=new URLSearchParams(e);n.delete(`new`),t(n,{replace:!0})}};return i?(0,F.jsx)(W,{error:i}):r?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ur,{size:18,className:`text-brand`}),title:`Projects`,sub:`Each project has its own apps, ingest keys, alerts, SLOs, issues, status pages, integrations and MCP token. Nothing is shared between projects.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,F.jsx)(_i,{size:14}),`New project`]})}),(0,F.jsx)(H,{pad:!1,children:(0,F.jsx)(Ha,{rows:r,cols:[{key:`n`,label:`Project`,render:e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:e.name}),e.isDefault&&(0,F.jsx)(`span`,{className:`pill`,children:`default`}),e.slug===f&&(0,F.jsx)(G,{kind:`good`,children:`current`})]})},{key:`s`,label:`Slug`,render:e=>(0,F.jsx)(`span`,{className:`mono text-ink2`,children:e.slug})},{key:`a`,label:`Apps`,num:!0,render:e=>e.apps},{key:`l`,label:`Last data`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.lastSeen?Sa(e.lastSeen):`—`})},{key:`x`,label:``,render:t=>(0,F.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[t.slug!==f&&(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>n(va(t.slug,`/`,e)),children:[`Open`,(0,F.jsx)(pr,{size:12})]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Rename`,onClick:()=>d(t),children:(0,F.jsx)(pi,{size:13})}),!t.isDefault&&(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2 text-[#ff8a8a]`,title:`Delete`,onClick:async()=>{window.prompt(`Delete "${t.name}" and all of its data (apps, alerts, issues, status pages, keys)? This cannot be undone.\n\nType the slug "${t.slug}" to confirm.`)===t.slug&&(await N(`/api/projects/${t.slug}`,{method:`DELETE`}),t.slug===f?n(va(`default`,`/projects`,e)):a())},children:(0,F.jsx)(Ri,{size:13})})]})}]})}),o&&(0,F.jsx)(FB,{onClose:p,onCreated:e=>{p(),l(e),a()}}),c&&(0,F.jsx)(IB,{project:c,onClose:()=>l(null),onOpen:()=>{l(null),n(va(c.slug,`/settings`,e))}}),u&&(0,F.jsx)(LB,{project:u,onClose:()=>d(null),onSaved:()=>{d(null),a()}})]}):(0,F.jsx)(U,{})}function FB({onClose:e,onCreated:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``);return(0,F.jsx)(qa,{open:!0,title:`New project`,onClose:e,children:(0,F.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:async e=>{e.preventDefault();try{t(await N(`/api/projects`,{method:`POST`,json:{name:n}}))}catch(e){a(e.message)}},children:[(0,F.jsx)(K,{label:`Name`,hint:`a product, a client or a team`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Acme Shop`})}),i&&(0,F.jsx)(`div`,{className:`text-[12.5px] text-[#ff8a8a]`,children:i}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`btn`,onClick:e,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!n.trim(),children:`Create`})]})]})})}function IB({project:e,onClose:t,onOpen:n}){let r=`OBZERVER_KEY=${e.ingestKey} OBZERVER_ENDPOINT=${window.location.origin} \\\n node --import @obzerver/node/register server.js`;return(0,F.jsx)(qa,{open:!0,title:`"${e.name}" is ready`,onClose:t,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 text-[13px]`,children:[(0,F.jsx)(`div`,{className:`text-ink2`,children:`Apps that send data with this project's ingest key show up only here.`}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Ingest key`}),(0,F.jsx)(Ba,{text:e.ingestKey,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:e.ingestKey})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,F.jsx)(`span`,{className:`text-ink2 text-[12px]`,children:`Start an app with it`}),(0,F.jsx)(Ba,{text:r,className:`btn h-6 text-[11px]`})]}),(0,F.jsx)(`div`,{className:`code`,children:r})]}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:t,children:`Stay here`}),(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:n,children:[`Open project setup`,(0,F.jsx)(pr,{size:13})]})]})]})})}function LB({project:e,onClose:t,onSaved:n}){let[r,i]=(0,v.useState)(e.name),[a,o]=(0,v.useState)(``);return(0,F.jsx)(qa,{open:!0,title:`Rename project`,onClose:t,children:(0,F.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:async t=>{t.preventDefault();try{await N(`/api/projects/${e.slug}`,{method:`PATCH`,json:{name:r}}),n()}catch(e){o(e.message)}},children:[(0,F.jsx)(K,{label:`Name`,hint:(0,F.jsxs)(F.Fragment,{children:[`the slug `,(0,F.jsx)(`span`,{className:`mono`,children:e.slug}),` stays, so links and keys keep working`]}),children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)})}),a&&(0,F.jsx)(`div`,{className:`text-[12.5px] text-[#ff8a8a]`,children:a}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`btn`,onClick:t,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!r.trim(),children:`Save`})]})]})})}function RB(){let e=I(),[t,n]=(0,v.useState)(`db`),[r,i]=(0,v.useState)(null),a=P(t===`db`?`/api/queries${e.q()}`:null,[e.tick,t]),o=P(t===`http`?`/api/outbound${e.q()}`:null,[e.tick,t]);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Br,{size:18,className:`text-brand`}),title:`Queries & dependencies`,sub:`Statements from pg, mysql2 and ioredis with literal values stripped in-process, plus outbound HTTP calls (http, https, fetch).`,right:(0,F.jsx)(Va,{value:t,onChange:n,options:[{id:`db`,label:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Br,{size:12}),`Database`]})},{id:`http`,label:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Kr,{size:12}),`Outbound HTTP`]})}]})}),t===`db`?(0,F.jsx)(H,{pad:!1,children:a.error?(0,F.jsx)(W,{error:a.error}):a.data?(0,F.jsx)(Ha,{rows:a.data,initialSort:`total`,rowKey:e=>e.service+e.statement,onRow:e=>i(r===e.service+e.statement?null:e.service+e.statement),empty:(0,F.jsx)(Na,{title:`No queries recorded`,children:`pg, mysql2 and ioredis are instrumented automatically when installed.`}),cols:[{key:`st`,label:`Statement`,render:e=>(0,F.jsxs)(`div`,{className:`max-w-[640px]`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.statement}),e.nPlusOne&&(0,F.jsx)(G,{kind:`serious`,children:`N+1 suspect`})]}),r===e.service+e.statement&&(0,F.jsxs)(`div`,{className:`mt-2`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`div`,{className:`flex justify-end mb-1`,children:(0,F.jsx)(Ba,{text:e.statement,className:`btn h-6 text-[11px]`})}),(0,F.jsx)(Zz,{text:e.statement})]})]})},{key:`sys`,label:`System`,sort:e=>e.system,render:e=>(0,F.jsx)(`span`,{className:`pill`,children:e.system})},{key:`svc`,label:`Application`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},{key:`calls`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`per`,label:`Per request`,num:!0,sort:e=>e.perRequest,render:e=>(0,F.jsxs)(`span`,{title:`max ${e.maxPerRequest} in one request`,style:{color:e.nPlusOne?`#ffb38a`:void 0},children:[V(e.perRequest),` `,(0,F.jsxs)(`span`,{className:`text-mute text-[11px]`,children:[`max `,e.maxPerRequest]})]})},{key:`avg`,label:`Avg`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`p95`,label:`p95`,num:!0,sort:e=>e.p95,render:e=>B(e.p95)},{key:`total`,label:`Total time`,num:!0,sort:e=>e.total,render:e=>B(e.total)}]}):(0,F.jsx)(U,{})}):(0,F.jsx)(H,{pad:!1,children:o.error?(0,F.jsx)(W,{error:o.error}):o.data?(0,F.jsx)(Ha,{rows:o.data,initialSort:`calls`,empty:(0,F.jsx)(Na,{title:`No outbound calls recorded`}),cols:[{key:`h`,label:`Host`,sort:e=>e.host,render:e=>(0,F.jsx)(`span`,{className:`mono`,children:e.host})},{key:`s`,label:`Called from`,sort:e=>e.service,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.service})},{key:`calls`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`err`,label:`Failures`,num:!0,sort:e=>e.errors,render:e=>e.errors?(0,F.jsxs)(`span`,{style:{color:`#ff8a8a`},children:[V(e.errors),` (`,ba(e.errors/e.calls*100),`)`]}):(0,F.jsx)(`span`,{className:`text-mute`,children:`0`})},{key:`avg`,label:`Avg`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`p95`,label:`p95`,num:!0,sort:e=>e.p95,render:e=>B(e.p95)}]}):(0,F.jsx)(U,{})})]})}function zB(){let e=I(),t=Qn(),n=ht(),[r,i]=(0,v.useState)(`user`),[a,o]=(0,v.useState)(``),{data:s,error:c}=P(`/api/users${e.q({groupBy:r===`customer`?`customer`:``})}`,[e.tick,r]),l=(s||[]).filter(e=>!a||(e.userId||e.customer).toLowerCase().includes(a.toLowerCase()));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Ui,{size:18,className:`text-brand`}),title:`Users`,sub:(0,F.jsxs)(F.Fragment,{children:[`Who is affected. Users come from `,(0,F.jsx)(`span`,{className:`mono`,children:`req.user.id`}),`, the `,(0,F.jsx)(`span`,{className:`mono`,children:`http.getUserId`}),` option or `,(0,F.jsx)(`span`,{className:`mono`,children:`obzerver.setUser()`}),`.`]})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ei,{size:13,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input pl-8 w-[260px] h-7`,placeholder:`Filter`,value:a,onChange:e=>o(e.target.value)})]}),(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`user`,label:`By user`},{id:`customer`,label:`By customer (email domain)`}]})]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:c?(0,F.jsx)(W,{error:c}):s?r===`user`?(0,F.jsx)(Ha,{rows:l,initialSort:`calls`,onRow:e=>n(t(`/users/${Ea(e.userId)}`)),rowKey:e=>e.userId,empty:(0,F.jsx)(Na,{title:`No identified users`,children:`Set http.getUserId in the SDK options, or populate req.user.`}),cols:[{key:`u`,label:`User`,sort:e=>e.userId,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.userId})},{key:`c`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`o`,label:`Operations`,num:!0,sort:e=>e.operations,render:e=>V(e.operations)},{key:`f`,label:`Failure rate`,num:!0,sort:e=>e.failureRate,render:e=>(0,F.jsxs)(`span`,{style:{color:e.failureRate>2?`#ff8a8a`:e.failureRate>0?`var(--color-ink2)`:`var(--color-mute)`},children:[ba(e.failureRate),` `,(0,F.jsxs)(`span`,{className:`text-mute text-[11px]`,children:[`(`,e.failed,`)`]})]})},{key:`a`,label:`Avg latency`,num:!0,sort:e=>e.avg,render:e=>B(e.avg)},{key:`l`,label:`Last seen`,num:!0,sort:e=>e.lastSeen,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:Sa(e.lastSeen)})}]}):(0,F.jsx)(Ha,{rows:l,initialSort:`calls`,rowKey:e=>e.customer,cols:[{key:`c`,label:`Customer`,sort:e=>e.customer,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.customer})},{key:`u`,label:`Users`,num:!0,sort:e=>e.users,render:e=>V(e.users)},{key:`n`,label:`Calls`,num:!0,sort:e=>e.calls,render:e=>V(e.calls)},{key:`f`,label:`Failure rate`,num:!0,sort:e=>e.failureRate,render:e=>(0,F.jsxs)(`span`,{style:{color:e.failureRate>2?`#ff8a8a`:void 0},children:[ba(e.failureRate),` `,(0,F.jsxs)(`span`,{className:`text-mute text-[11px]`,children:[`(`,e.failed,`)`]})]})},{key:`l`,label:`Last seen`,num:!0,sort:e=>e.lastSeen,render:e=>Sa(e.lastSeen)}]}):(0,F.jsx)(U,{})})})]})}function BB(){let{id:e=``}=yt(),t=I(),n=Qn(),r=ht(),{data:i,error:a}=P(`/api/users/${encodeURIComponent(e)}${t.q()}`,[t.tick]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let o=i.actions.filter(e=>e.failed).length,s=[];for(let e of i.actions){let t=s[s.length-1];t&&t[t.length-1].ts-e.ts<18e5?t.push(e):s.push([e])}return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Nn,{to:n(`/users`),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:`← Users`}),(0,F.jsx)(Ma,{title:e,sub:e.includes(`@`)?`customer ${e.split(`@`)[1]}`:void 0}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-4 gap-3`,children:[(0,F.jsx)(Fa,{label:`Actions in window`,value:V(i.actions.length)}),(0,F.jsx)(Fa,{label:`Failed`,value:V(o),color:o?`#ff8a8a`:void 0}),(0,F.jsx)(Fa,{label:`Sessions`,value:V(s.length)}),(0,F.jsx)(Fa,{label:`Distinct errors`,value:V(i.errors.length)})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsx)(H,{title:`Activity replay`,sub:`newest first, grouped into sessions`,pad:!1,className:`@5xl:col-span-2`,children:s.length===0?(0,F.jsx)(Na,{title:`No activity in this window`}):(0,F.jsx)(`div`,{className:`max-h-[560px] overflow-auto`,children:s.map((e,t)=>(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`px-3.5 py-1.5 text-[11px] uppercase tracking-wider text-mute bg-[#111118] border-b border-line sticky top-0`,children:[`Session · `,Ca(e[e.length-1].ts,!0),` → `,Ca(e[0].ts),` · `,e.length,` actions`]}),e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-1.5 border-b border-[#1b1b23] hover:bg-[#16161e] cursor-pointer`,onClick:()=>r(n(`/executions/${e.id}`)),children:[(0,F.jsx)(`span`,{className:`mono text-mute text-[11.5px] w-16`,children:Ca(e.ts)}),(0,F.jsxs)(`span`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(za,{name:e.name}),e.error_message&&(0,F.jsx)(`span`,{className:`text-[#ff9b9b] text-[12px] ml-2 truncate`,children:e.error_message})]}),(0,F.jsx)(La,{status:e.status}),(0,F.jsx)(`span`,{className:`w-16 text-right tabular-nums`,children:B(e.duration)})]},e.id))]},t))})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(H,{title:`Actions`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.operations,cols:[{key:`n`,label:`Operation`,render:e=>(0,F.jsx)(za,{name:e.name})},{key:`c`,label:`Calls`,num:!0,render:e=>V(e.calls)},{key:`f`,label:`Failed`,num:!0,render:e=>e.failed?(0,F.jsx)(`span`,{style:{color:`#ff8a8a`},children:e.failed}):(0,F.jsx)(`span`,{className:`text-mute`,children:`0`})}]})}),(0,F.jsx)(H,{title:`Common paths`,sub:`action → next action`,pad:!1,children:i.paths.length?i.paths.map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between gap-2 px-3.5 py-1.5 border-b border-[#1b1b23] text-[12px]`,children:[(0,F.jsx)(`span`,{className:`mono truncate`,children:e.path}),(0,F.jsx)(`span`,{className:`tabular-nums text-ink2`,children:e.n})]},e.path)):(0,F.jsx)(Na,{title:`Not enough actions`})}),i.errors.length>0&&(0,F.jsx)(H,{title:`Errors hit`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.errors,onRow:e=>r(n(`/errors/${e.fingerprint}`)),cols:[{key:`c`,label:`Error`,render:e=>(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:e.class})},{key:`n`,label:`Count`,num:!0,render:e=>e.n}]})})]})]})]})}var VB=e=>new Date(e).toLocaleString(`en-US`,{month:`long`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),HB=e=>String(e).padStart(2,`0`),UB=(e,t)=>{let n=new Date(e),r=`${HB(n.getHours())}:${HB(n.getMinutes())}`,i=`${HB(n.getMonth()+1)}/${HB(n.getDate())}`;return t<=72e6?r:t<=2592e5?`${i} ${r}`:i},WB=({color:e})=>(0,F.jsx)(`span`,{className:`inline-block w-[2px] h-[11px] rounded-full align-[-1px]`,style:{background:e}});function GB({title:e,sub:t,children:n}){return(0,F.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline gap-2.5 px-0.5`,children:[(0,F.jsx)(`h2`,{className:`text-[15px] font-medium tracking-tight`,children:e}),(0,F.jsx)(`span`,{className:`mono text-[10.5px] uppercase tracking-[.12em] text-mute`,children:t})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-2 gap-3`,children:n})]})}function KB({now:e,prev:t,unit:n,badWhen:r=`up`}){if(e==null||t==null||n===`pct`&&!t)return null;let i=n===`pp`?e-t:(e-t)/t*100,a=Math.abs(i)<(n===`pp`?.05:.5),o=i>0,s=!a&&(o?r===`up`:r===`down`),c=a?si:o?Bi:zi,l=n===`pp`?`${o?`+`:`−`}${Math.abs(i).toFixed(2)}pp`:`${o?`+`:`−`}${Math.abs(i).toFixed(0)}%`;return(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink2`,title:`Average over this window compared with the window of the same length before it`,children:[(0,F.jsx)(c,{size:13,style:{color:a?`var(--color-mute)`:s?`#f0506e`:`#3fb68b`}}),a?`no change`:l,` since last period`]})}function qB({value:e,color:t,fmt:n}){return e==null?null:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[12px] text-ink2`,children:[(0,F.jsx)(WB,{color:t}),`AVG`,(0,F.jsx)(`span`,{className:`mono text-[11.5px] font-semibold px-1.5 py-[2px] rounded`,style:{background:`#2a2a33`,color:`#e8e8ef`},children:n(e)})]})}function JB({title:e,trend:t,right:n,children:r}){return(0,F.jsxs)(`div`,{className:`rounded-xl border border-line overflow-hidden`,style:{background:`linear-gradient(180deg, #17171d 0%, #121217 100%)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-5 h-[52px] border-b border-line`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[14px] whitespace-nowrap`,children:e}),t]}),(0,F.jsx)(`div`,{className:`flex items-center gap-4 shrink-0`,children:n})]}),(0,F.jsx)(`div`,{className:`px-3 pt-4 pb-2`,children:r})]})}var YB=({series:e})=>(0,F.jsx)(F.Fragment,{children:e.map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink2`,children:[(0,F.jsx)(WB,{color:e.color}),e.label]},e.key))});function XB({active:e,payload:t,label:n,series:r,fmt:i,pinned:a,hint:o,extra:s}){if(!e||!t?.length)return null;let c=t[0].payload;return(0,F.jsxs)(`div`,{className:`mono rounded-md border border-[#2c2c36] px-3 py-2.5 text-[11.5px] shadow-2xl`,style:{background:`rgba(17,17,22,.97)`,minWidth:200},children:[r.filter(e=>c[e.key]!=null).map(e=>{let t=a?.[e.key],n=t!=null&&c[e.key]!=null?c[e.key]-t:null;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2 py-[2px]`,children:[(0,F.jsx)(WB,{color:e.color}),(0,F.jsxs)(`span`,{className:`font-semibold text-ink`,children:[e.label,`: `,i(c[e.key],e.key)]}),n!=null&&(0,F.jsxs)(`span`,{className:`text-mute`,children:[`(`,n>=0?`+`:`−`,i(Math.abs(n),e.key),` vs pin)`]})]},e.key)}),s?.(c),(0,F.jsx)(`div`,{className:`text-ink2 mt-1.5`,children:VB(n)}),(0,F.jsx)(`div`,{className:`text-mute mt-2 pt-2 border-t border-[#24242c]`,children:a?`Pinned ${VB(a.t)} · shift+click to unpin`:o})]})}function ZB({data:e,series:t,fmt:n,yFmt:r,height:i=240,yMax:a,onInspect:o,gcKey:s,extra:c,releases:l=[]}){let u=(0,v.useRef)(!1),[d,f]=(0,v.useState)(null);if(!e.length)return(0,F.jsx)(`div`,{className:`flex items-center justify-center text-mute text-[12px]`,style:{height:i},children:`No samples in this window`});let p=s?Math.max(1,...e.map(e=>e[s]||0)):1,m=t.some(e=>e.kind===`bar`),h=e.length>1?e[e.length-1].t-e[0].t:36e5,g=e.length>1?e[1].t-e[0].t:h,_=l.filter(t=>t.t>=e[0].t&&t.t<=e[e.length-1].t+g).map(t=>({...t,at:e.reduce((e,n)=>n.t<=t.t&&n.t>e?n.t:e,e[0].t)})),y=e=>_.filter(t=>t.at===e),b=o?`Click to see what ran here · shift+click to pin and compare`:`Shift+click to pin and compare`;return(0,F.jsx)(`div`,{className:`relative select-none`,onMouseDownCapture:e=>{u.current=e.shiftKey},children:(0,F.jsx)(`div`,{style:{height:i},children:(0,F.jsx)(Km,{width:`100%`,height:`100%`,children:(0,F.jsxs)(UR,{data:e,margin:{top:8,right:44,bottom:0,left:0},barGap:2,barCategoryGap:`30%`,onClick:t=>{if(!t||t.activeLabel==null)return;let n=e.find(e=>e.t===t.activeLabel);u.current?f(e=>e&&e.t===t.activeLabel?null:n):o?.(t.activeLabel)},style:{cursor:o?`pointer`:`default`},children:[(0,F.jsx)(`defs`,{children:t.filter(e=>e.kind===`area`||e.kind===`bar`).map(e=>(0,F.jsxs)(`linearGradient`,{id:`g-${e.key}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,F.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:e.kind===`bar`?1:.42}),(0,F.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:e.kind===`bar`?.35:.02})]},e.key))}),(0,F.jsx)(rF,{vertical:!1,stroke:`#ffffff`,strokeOpacity:.045,strokeDasharray:`2 6`}),(0,F.jsx)(tL,{dataKey:`t`,type:m?`category`:`number`,domain:[`dataMin`,`dataMax`],scale:m?`auto`:`time`,tickFormatter:e=>UB(e,h),tick:{fill:`#6f6f7d`,fontSize:10.5,fontFamily:`var(--font-mono)`},tickLine:!1,axisLine:{stroke:`#2a2a35`},minTickGap:44,tickMargin:6}),(0,F.jsx)(vL,{yAxisId:`v`,width:64,tickLine:!1,axisLine:!1,tickCount:5,tick:{fill:`#6f6f7d`,fontSize:10.5,fontFamily:`var(--font-mono)`},tickFormatter:e=>(r??n)(e),domain:[0,a??`auto`],allowDecimals:!0}),s&&(0,F.jsx)(vL,{yAxisId:`gc`,hide:!0,domain:[0,p*6]}),(0,F.jsx)(Dm,{content:(0,F.jsx)(XB,{series:t,fmt:n,pinned:d,hint:b,extra:e=>(0,F.jsxs)(F.Fragment,{children:[y(e.t).map(e=>(0,F.jsxs)(`div`,{className:`py-[2px]`,style:{color:`#ff6b9d`},children:[`Release `,e.version,` deployed `,new Date(e.t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1})]},e.version)),c?.(e)]})}),cursor:{stroke:`#ffffff`,strokeOpacity:.18,strokeDasharray:`3 3`},isAnimationActive:!1}),s&&(0,F.jsx)($j,{yAxisId:`gc`,dataKey:s,fill:`#8a8a98`,fillOpacity:.55,barSize:1.5,isAnimationActive:!1}),t.map(e=>e.kind===`bar`?(0,F.jsx)($j,{yAxisId:`v`,dataKey:e.key,fill:`url(#g-${e.key})`,barSize:3,radius:[2,2,0,0],isAnimationActive:!1},e.key):e.kind===`area`?(0,F.jsx)(eI,{yAxisId:`v`,type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:1.6,fill:`url(#g-${e.key})`,dot:!1,activeDot:{r:4,fill:e.color,stroke:`#121217`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key):(0,F.jsx)(jF,{yAxisId:`v`,type:`monotone`,dataKey:e.key,stroke:e.color,strokeOpacity:e.faint?.55:1,strokeWidth:e.faint?1.3:1.6,dot:!1,activeDot:{r:4,fill:e.color,stroke:`#121217`,strokeWidth:2},isAnimationActive:!1,connectNulls:!0},e.key)),_.map(e=>(0,F.jsx)(mN,{yAxisId:`v`,x:e.at,stroke:`#ff6b9d`,strokeDasharray:`3 3`,strokeOpacity:.85,label:{value:e.version,position:`insideTopLeft`,fill:`#ff6b9d`,fontSize:10.5,fontFamily:`var(--font-mono)`}},`${e.version}${e.t}`)),d&&(0,F.jsx)(mN,{yAxisId:`v`,x:d.t,stroke:`#ff9cc0`,strokeDasharray:`4 3`,strokeOpacity:.8})]})})})})}var QB={heapUsed:`#f0506e`,heapTotal:`#b0344d`,rss:`#7c7c8a`,memUtil:`#3fa58a`,cpuUtil:`#e5484d`,user:`#e5484d`,system:`#f59bb0`,elP99:`#f0506e`,elP50:`#7c7c8a`,elu:`#9085e9`},$B=e=>e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(2)} MB`,eV=e=>`${e.toFixed(2)}%`,tV=e=>`${e<10&&e%1?e.toFixed(1):Math.round(e)}%`,nV=e=>e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`,rV=`Utilization needs @obzerver/node 0.8.2 or later, which reports the V8 heap limit, the container limits and CPU time.`;function iV(){let e=I(),t=Qn(),n=ht(),r=P(`/api/runtime${e.q()}`,[e.tick]),i=[...new Set((r.data||[]).map(e=>e.service))],[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),l=a&&i.includes(a)?a:e.service||i[0]||``,u=P(l?`/api/runtime/view${e.q({service:l,instance:s})}`:null,[e.tick,l,s]),[d,f]=(0,v.useState)(null);if((0,v.useEffect)(()=>{f(null),c(``)},[l]),(0,v.useEffect)(()=>{let e=u.data?.points;!e?.length||d&&!d.auto||b(e.reduce((e,t)=>(t.elP99??0)>(e.elP99??0)?t:e,e[0]).t,!0)},[u.data]),r.error)return(0,F.jsx)(W,{error:r.error});if(!r.data)return(0,F.jsx)(U,{});let p=u.data,m=p?.points||[],h=p?.summary,g=p?.prev,_=m.some(e=>e.memUtil!=null||e.cpuUtil!=null),y=(r.data||[]).filter(e=>e.service===l).map(e=>e.instance);async function b(e,t=!1){let n=u.data?.bucketMs||6e4,r=await N(`/api/runtime/spike?service=${encodeURIComponent(l)}${s?`&instance=${encodeURIComponent(s)}`:``}&ts=${e}&windowMs=${Math.max(6e4,n/2)}`);f({ts:e,rows:r,auto:t}),t||document.getElementById(`what-ran`)?.scrollIntoView({behavior:`smooth`,block:`start`})}let x=e=>{b(e)},S=(e.meta?.versions||[]).filter(t=>t.service===l&&t.first>=e.from&&t.first<=e.to).map(e=>({t:e.first,version:e.version})),C=p?.byInstance||[],w=e=>WR[Math.max(0,C.findIndex(t=>t.instance===e))%WR.length],T=!s&&C.length>1,E=e=>{let t=new Map;return C.forEach((n,r)=>{for(let i of n.points)t.has(i.t)||t.set(i.t,{t:i.t}),t.get(i.t)[`i${r}`]=i[e]}),[...t.values()].sort((e,t)=>e.t-t.t)},D=C.map((e,t)=>({key:`i${t}`,label:e.instance,color:WR[t%WR.length],kind:`line`})),O=[{key:`heapUsed`,label:`Heap Used`,color:QB.heapUsed,kind:`line`},{key:`heapTotal`,label:`Heap Total`,color:QB.heapTotal,kind:`line`},{key:`rss`,label:`RSS`,color:QB.rss,kind:`line`,faint:!0}],k=[{key:`cpuUser`,label:`User`,color:QB.user,kind:`bar`},{key:`cpuSystem`,label:`System`,color:QB.system,kind:`bar`}],A=[{key:`elP99`,label:`p99`,color:QB.elP99,kind:`line`},{key:`elP50`,label:`p50`,color:QB.elP50,kind:`line`,faint:!0}],j=!s&&y.length>1;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(zr,{size:18,className:`text-brand`}),title:`Profiler`,sub:`Memory, CPU and event-loop health for each app, sampled every 15 seconds.${j?` Across ${y.length} instances, memory and CPU time add up, while utilization and loop delay follow the busiest instance.`:``}`,right:i.length>0&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`select`,{className:`select`,value:l,onChange:e=>o(e.target.value),"aria-label":`Application`,children:i.map(e=>(0,F.jsx)(`option`,{children:e},e))}),y.length>1&&(0,F.jsxs)(`select`,{className:`select`,value:s,onChange:e=>c(e.target.value),"aria-label":`Instance`,children:[(0,F.jsxs)(`option`,{value:``,children:[`All instances (`,y.length,`)`]}),y.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})]})}),i.length?u.error?(0,F.jsx)(W,{error:u.error}):p?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(H,{title:`Instances`,sub:`latest sample · click one to focus on it`,pad:!1,children:(0,F.jsx)(Ha,{rows:p.instances,onRow:e=>c(e.instance===s?``:e.instance),cols:[{key:`i`,label:`Instance`,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-sm shrink-0`,style:{background:w(e.instance)}}),(0,F.jsx)(`span`,{className:`mono`,style:{color:e.instance===s?`#ff9cc0`:void 0},children:e.instance}),e.instance===s&&(0,F.jsx)(`span`,{className:`pill !h-5 !text-[10.5px]`,children:`focused`})]})},{key:`cu`,label:`CPU util`,num:!0,render:e=>e.cpuUtil==null?`—`:ba(e.cpuUtil,1)},{key:`cl`,label:`CPUs`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.cpuLimit?`${V(e.cpuLimit)} (quota)`:e.cores??`—`})},{key:`rss`,label:`RSS`,num:!0,render:e=>$B(e.rss)},{key:`heap`,label:`Heap used / total`,num:!0,render:e=>`${V(e.heapUsed)} / ${V(e.heapTotal)} MB`},{key:`mu`,label:`Mem util`,num:!0,render:e=>e.memUtil==null?`—`:(0,F.jsx)(`span`,{title:e.memBasis===`container`?`RSS of the container limit`:`Heap of the V8 limit`,children:ba(e.memUtil,1)})},{key:`lim`,label:`Limits`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:[e.heapLimitMb&&`heap ${$B(e.heapLimitMb)}`,e.memLimitMb&&`container ${$B(e.memLimitMb)}`].filter(Boolean).join(` · `)||`—`})},{key:`el`,label:`Loop p99`,num:!0,render:e=>B(e.elP99)},{key:`inf`,label:`In-flight`,num:!0,render:e=>V(e.inflight)},{key:`h`,label:`Handles`,num:!0,render:e=>V(e.handles)}]})}),(0,F.jsx)(`div`,{id:`what-ran`,className:`scroll-mt-4`,children:d?(0,F.jsx)(H,{title:`Running around ${Ca(d.ts,!0)}`,sub:d.auto?`the worst event-loop delay in this window · click any point on a chart to look at another moment`:`the moment you clicked · operations ranked by how far they moved from their own baseline`,pad:!1,children:(0,F.jsx)(Ha,{rows:d.rows,onRow:e=>n(t(Vz(`http`,l,e.name))),empty:(0,F.jsx)(Na,{title:`Nothing ran in that window`}),cols:[{key:`n`,label:`Operation`,render:e=>(0,F.jsx)(za,{name:e.name})},{key:`c`,label:`Calls`,num:!0,render:e=>V(e.calls)},{key:`a`,label:`Avg`,num:!0,render:e=>B(e.avg)},{key:`b`,label:`Baseline avg`,num:!0,render:e=>B(e.baselineAvg)},{key:`lx`,label:`Latency ×`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.latencyX>=2?`#ffb38a`:void 0},children:e.latencyX?`${e.latencyX}×`:`—`})},{key:`vx`,label:`Volume ×`,num:!0,render:e=>(0,F.jsx)(`span`,{style:{color:e.volumeX>=2?`#ffb38a`:void 0},children:e.volumeX?`${e.volumeX}×`:`—`})}]})}):(0,F.jsx)(H,{title:`Running around…`,sub:`click any point on a chart to see which operations ran then`,children:(0,F.jsx)(`span`,{className:`text-mute text-[12px]`,children:`Loading…`})})}),(0,F.jsxs)(GB,{title:`Memory`,sub:`heap and resident size over time, with garbage collection`,children:[(0,F.jsx)(JB,{title:`Memory`,trend:(0,F.jsx)(KB,{now:h?.heapUsed,prev:g?.heapUsed,unit:`pct`}),right:(0,F.jsx)(YB,{series:[...O,{key:`gc`,label:`GC pauses`,color:`#8a8a98`,kind:`bar`}]}),children:(0,F.jsx)(ZB,{releases:S,data:m,series:O,fmt:e=>$B(e),yFmt:nV,gcKey:`gcMs`,onInspect:x,extra:e=>e.gcCount?(0,F.jsxs)(`div`,{className:`text-mute py-[2px]`,children:[`GC: `,e.gcCount,` pauses · `,B(e.gcMs)]}):null})}),(0,F.jsx)(JB,{title:`Memory utilization`,trend:(0,F.jsx)(KB,{now:h?.memUtil,prev:g?.memUtil,unit:`pp`}),right:(0,F.jsxs)(F.Fragment,{children:[T&&(0,F.jsx)(YB,{series:D}),(0,F.jsx)(qB,{value:h?.memUtil,color:QB.memUtil,fmt:eV})]}),children:_?(0,F.jsx)(ZB,{releases:S,data:T?E(`memUtil`):m,series:T?D:[{key:`memUtil`,label:`Utilization`,color:QB.memUtil,kind:`area`}],fmt:eV,yFmt:tV,extra:e=>e.memBasis&&(0,F.jsx)(`div`,{className:`text-mute py-[2px]`,children:e.memBasis===`container`?`RSS of the container memory limit`:`Heap used of the V8 heap limit`})}):(0,F.jsx)(aV,{})})]}),(0,F.jsxs)(GB,{title:`CPU`,sub:`share of the available CPU, and where the time goes`,children:[(0,F.jsx)(JB,{title:`CPU utilization`,trend:(0,F.jsx)(KB,{now:h?.cpuUtil,prev:g?.cpuUtil,unit:`pp`}),right:(0,F.jsxs)(F.Fragment,{children:[T&&(0,F.jsx)(YB,{series:D}),(0,F.jsx)(qB,{value:h?.cpuUtil,color:QB.cpuUtil,fmt:eV})]}),children:_?(0,F.jsx)(ZB,{releases:S,data:T?E(`cpuUtil`):m,series:T?D:[{key:`cpuUtil`,label:`Utilization`,color:QB.cpuUtil,kind:`area`}],fmt:eV,yFmt:tV,onInspect:x}):(0,F.jsx)(aV,{})}),(0,F.jsx)(JB,{title:`CPU`,trend:(0,F.jsx)(KB,{now:h?.cpuTime,prev:g?.cpuTime,unit:`pct`}),right:(0,F.jsx)(YB,{series:k}),children:m.some(e=>e.cpuUser!=null)?(0,F.jsx)(ZB,{releases:S,data:m,series:k,fmt:e=>`${e.toFixed(2)}ms`,yFmt:e=>`${Math.round(e)}ms`,onInspect:x,extra:()=>(0,F.jsx)(`div`,{className:`text-mute py-[2px]`,children:`CPU time per second of wall clock`})}):(0,F.jsx)(aV,{})})]}),(0,F.jsxs)(GB,{title:`Event loop`,sub:`queueing delay and how busy the loop is`,children:[(0,F.jsx)(JB,{title:T?`Event loop delay p99`:`Event loop delay`,trend:(0,F.jsx)(KB,{now:h?.elP99,prev:g?.elP99,unit:`pct`}),right:(0,F.jsx)(YB,{series:T?D:A}),children:(0,F.jsx)(ZB,{releases:S,data:T?E(`elP99`):m,series:T?D:A,fmt:e=>B(e),yFmt:e=>`${Math.round(e)}ms`,onInspect:x})}),(0,F.jsx)(JB,{title:`Event loop utilization`,trend:(0,F.jsx)(KB,{now:h?.elu,prev:g?.elu,unit:`pp`}),right:(0,F.jsxs)(F.Fragment,{children:[T&&(0,F.jsx)(YB,{series:D}),(0,F.jsx)(qB,{value:h?.elu,color:QB.elu,fmt:eV})]}),children:(0,F.jsx)(ZB,{releases:S,data:T?E(`elu`):m,series:T?D:[{key:`elu`,label:`Utilization`,color:QB.elu,kind:`area`}],fmt:eV,yFmt:tV})})]})]}):(0,F.jsx)(U,{}):(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No runtime samples in this window`,children:`The SDK samples every 15s by default (runtimeMetricsInterval).`})})]})}function aV(){return(0,F.jsx)(`div`,{className:`h-[220px] flex items-center justify-center text-center text-mute text-[12px] px-8`,children:rV})}function oV(){let e=I(),t=P(`/api/metrics${e.q()}`,[e.tick]),n=[...new Set((t.data||[]).map(e=>e.name))],[r,i]=(0,v.useState)(``),a=r&&n.includes(r)?r:n[0]||``,o=P(a?`/api/metrics/${encodeURIComponent(a)}${e.q()}`:null,[e.tick,a]);if(t.error)return(0,F.jsx)(W,{error:t.error});if(!t.data)return(0,F.jsx)(U,{});let s=t.data.filter(e=>e.name===a),c=[],l=[];if(o.data){let e=new Map,t=o.data.series.length>8;o.data.series.slice(0,8).forEach((t,n)=>{for(let r of t.points)e.has(r.t)||e.set(r.t,{t:r.t}),e.get(r.t)[`s${n}`]=r.value}),c=[...e.values()].sort((e,t)=>e.t-t.t),l=o.data.series.slice(0,8).map((e,t)=>({key:`s${t}`,label:Object.entries(e.labels).map(([e,t])=>`${e}=${t}`).join(`, `)||a,color:WR[t],type:e.type===`counter`?`bar`:`line`,stack:e.type===`counter`?`c`:void 0})),t&&l.push()}return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Wr,{size:18,className:`text-brand`}),title:`Custom metrics`,sub:(0,F.jsxs)(F.Fragment,{children:[`Counters, gauges and summaries your code reports: `,(0,F.jsxs)(`span`,{className:`mono`,children:[`obzerver.metrics.counter('orders_created', `,`{`,` channel `,`}`,`).inc()`]})]})}),n.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No custom metrics yet`,children:`Report business numbers with obzerver.metrics.counter / gauge / summary. They are aggregated in-process and flushed every 10s.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-[240px_1fr] gap-3`,children:[(0,F.jsx)(H,{pad:!1,title:`Metrics`,children:(0,F.jsx)(`div`,{className:`py-1.5`,children:n.map(e=>{let n=t.data.find(t=>t.name===e).type;return(0,F.jsxs)(`button`,{onClick:()=>i(e),className:`w-full text-left px-3.5 py-2 flex items-center justify-between gap-2 ${e===a?`bg-[#1d1d27]`:`hover:bg-[#16161e]`}`,children:[(0,F.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e}),(0,F.jsx)(`span`,{className:`pill !text-[10px]`,children:n})]},e)})})}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(YR,{title:(0,F.jsx)(`span`,{className:`mono`,children:a}),sub:s[0]?.type===`counter`?`sum per bucket`:s[0]?.type===`gauge`?`last value per bucket`:`average per bucket`,series:l,children:o.data?(0,F.jsx)(JR,{data:c,series:l,height:260,fmt:e=>V(e)}):(0,F.jsx)(U,{})}),(0,F.jsx)(H,{title:`Series`,pad:!1,children:(0,F.jsxs)(`table`,{className:`tbl`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`Labels`}),(0,F.jsx)(`th`,{children:`Application`}),(0,F.jsx)(`th`,{className:`num`,children:`Points`}),(0,F.jsx)(`th`,{className:`num`,children:`Average`})]})}),(0,F.jsx)(`tbody`,{children:s.map((e,t)=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`mono text-[12px]`,children:Object.entries(e.labels).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`}),(0,F.jsx)(`td`,{className:`text-ink2`,children:e.service}),(0,F.jsx)(`td`,{className:`num`,children:V(e.points)}),(0,F.jsx)(`td`,{className:`num`,children:V(e.avg)})]},t))})]})})]})]})]})}var sV={regression:{kind:`crit`,label:`Regression`},changed:{kind:`warn`,label:`Changed`},clean:{kind:`good`,label:`Clean`},not_enough_data:{kind:`neutral`,label:`Not enough data`},baseline:{kind:`neutral`,label:`Baseline`}},cV=e=>e?new Date(e).toLocaleString(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1,timeZoneName:`short`}):``;function lV(){let e=I(),{data:t,error:n}=P(`/api/releases${e.q()}`,[e.tick]),[r]=zn(),[i,a]=(0,v.useState)(r.get(`version`)?{service:r.get(`service`)||``,version:r.get(`version`)}:null);if(n)return(0,F.jsx)(W,{error:n});if(!t)return(0,F.jsx)(U,{});let o=i||(t[0]?{service:t[0].service,version:t[0].version}:null);return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(xi,{size:18,className:`text-brand`}),title:`Releases`,sub:(0,F.jsxs)(F.Fragment,{children:[`Each `,(0,F.jsx)(`span`,{className:`mono`,children:`serviceVersion`}),` compared with the one before it: 5xx rate, latency, new error groups, memory and CPU, and what changed in the code path.`]})}),t.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No releases yet`,children:`Set serviceVersion (or OBZERVER_VERSION / GIT_SHA) so every request is tagged with the release that served it.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[minmax(380px,40%)_1fr] gap-3 items-start`,children:[(0,F.jsx)(H,{pad:!1,children:(0,F.jsx)(Ha,{rows:t,rowKey:e=>e.service+e.version,onRow:e=>a({service:e.service,version:e.version}),cols:[{key:`v`,label:`Release`,render:e=>(0,F.jsxs)(`div`,{className:o&&o.service===e.service&&o.version===e.version?`text-brand2`:``,children:[(0,F.jsx)(`div`,{className:`mono font-medium`,children:e.version}),(0,F.jsx)(`div`,{className:`text-mute text-[11px]`,children:e.service})]})},{key:`verdict`,label:`Verdict`,render:e=>(0,F.jsx)(G,{kind:sV[e.verdict]?.kind||`neutral`,children:sV[e.verdict]?.label||e.verdict})},{key:`f`,label:`Deployed`,num:!0,render:e=>(0,F.jsx)(Xa,{tip:cV(e.first),className:`text-ink2`,children:Sa(e.first)})},{key:`n`,label:`Requests`,num:!0,render:e=>V(e.requests)}]})}),o&&(0,F.jsx)(uV,{service:o.service,version:o.version})]})]})}function uV({service:e,version:t}){let n=Qn(),r=ht(),{data:i,error:a}=P(`/api/releases/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,[e,t]);if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let o=sV[i.verdict]||sV.baseline,s=i.previousStats,c=i.stats,l=e=>e===`query`?(0,F.jsx)(Br,{size:12,style:{color:`#d95926`}}):e===`outbound`?(0,F.jsx)(Kr,{size:12,style:{color:`#e66767`}}):(0,F.jsx)(vr,{size:12,style:{color:`#d55181`}}),u=e=>({new:`New`,gone:`Gone`,more_frequent:`${e.multiplier}× more often`,less_frequent:`${e.multiplier}× as often`,slower:`${e.multiplier}× slower`})[e.change];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:`mono`,children:[e,`@`,t]}),(0,F.jsx)(G,{kind:o.kind,children:o.label})]}),sub:i.previous?`vs ${i.previous}`:void 0,children:[(0,F.jsx)(`div`,{className:`text-[13px] leading-relaxed`,children:i.summary}),s&&(0,F.jsxs)(`table`,{className:`tbl mt-3`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{}),(0,F.jsx)(`th`,{className:`num`,children:i.previous}),(0,F.jsx)(`th`,{className:`num`,children:t})]})}),(0,F.jsxs)(`tbody`,{children:[(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Requests`}),(0,F.jsx)(`td`,{className:`num`,children:V(s.requests)}),(0,F.jsx)(`td`,{className:`num`,children:V(c.requests)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`5xx rate`}),(0,F.jsx)(`td`,{className:`num`,children:ba(s.errorRate)}),(0,F.jsx)(`td`,{className:`num`,style:{color:c.errorRate>s.errorRate*1.5&&c.errorRate>.3?`#ff8a8a`:void 0},children:ba(c.errorRate)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`p95`}),(0,F.jsx)(`td`,{className:`num`,children:B(s.p95)}),(0,F.jsx)(`td`,{className:`num`,style:{color:c.p95>s.p95*1.3?`#ffb38a`:void 0},children:B(c.p95)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Average`}),(0,F.jsx)(`td`,{className:`num`,children:B(s.avg)}),(0,F.jsx)(`td`,{className:`num`,children:B(c.avg)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Served from`}),(0,F.jsx)(`td`,{className:`num text-[11.5px]`,children:(0,F.jsx)(Xa,{tip:cV(s.first),children:Ca(s.first,!0)})}),(0,F.jsx)(`td`,{className:`num text-[11.5px]`,children:(0,F.jsx)(Xa,{tip:cV(c.first),children:Ca(c.first,!0)})})]}),(i.runtime||i.previousRuntime)&&(()=>{let e=i.previousRuntime||{},t=i.runtime||{},n=(e,t,n,r)=>e!=null&&t!=null&&t>e*n&&t-e>r,r=e=>e==null?`—`:`${e>0?`+`:``}${e.toFixed(1)} MB/h`,a=i.evidence?.some(e=>e.type===`memory_leak`);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`tr`,{children:(0,F.jsx)(`td`,{colSpan:3,className:`!pt-4 text-[10.5px] uppercase tracking-[.08em] text-mute`,children:`Runtime, per instance`})}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Heap used`}),(0,F.jsx)(`td`,{className:`num`,children:e.heapUsed==null?`—`:`${V(e.heapUsed)} MB`}),(0,F.jsx)(`td`,{className:`num`,style:{color:n(e.heapUsed,t.heapUsed,1.3,20)?`#ffb38a`:void 0},children:t.heapUsed==null?`—`:`${V(t.heapUsed)} MB`})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,title:`Least-squares slope of heap used over the time each version served`,children:`Heap growth`}),(0,F.jsx)(`td`,{className:`num`,children:r(e.heapGrowth)}),(0,F.jsx)(`td`,{className:`num`,style:{color:a?`#ff8a8a`:void 0},children:r(t.heapGrowth)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`RSS`}),(0,F.jsx)(`td`,{className:`num`,children:e.rss==null?`—`:`${V(e.rss)} MB`}),(0,F.jsx)(`td`,{className:`num`,children:t.rss==null?`—`:`${V(t.rss)} MB`})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:t.cpuUtil==null?`CPU`:`CPU utilization`}),(0,F.jsx)(`td`,{className:`num`,children:ba(e.cpuUtil??e.cpu)}),(0,F.jsx)(`td`,{className:`num`,style:{color:n(e.cpuUtil??e.cpu,t.cpuUtil??t.cpu,1.3,5)?`#ffb38a`:void 0},children:ba(t.cpuUtil??t.cpu)})]}),(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{className:`text-mute`,children:`Event loop p99`}),(0,F.jsx)(`td`,{className:`num`,children:B(e.elP99)}),(0,F.jsx)(`td`,{className:`num`,style:{color:n(e.elP99,t.elP99,1.5,10)?`#ffb38a`:void 0},children:B(t.elP99)})]})]})})()]})]})]}),(i.evidence?.length>0||i.newErrors?.length>0)&&(0,F.jsxs)(H,{title:`Evidence`,children:[(0,F.jsx)(`ul`,{className:`flex flex-col gap-1.5 list-disc pl-4`,children:i.evidence.map((e,t)=>(0,F.jsx)(`li`,{children:e.text},t))}),i.newErrors.length>0&&(0,F.jsx)(`div`,{className:`mt-3 flex flex-col`,children:i.newErrors.map(e=>(0,F.jsxs)(`button`,{className:`text-left flex items-center gap-2 py-1.5 border-b border-[#1d1d26] last:border-0 hover:text-white`,onClick:()=>r(n(`/errors/${e.fingerprint}`)),children:[(0,F.jsx)(G,{kind:`serious`,children:`new`}),(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:e.class}),(0,F.jsx)(`span`,{className:`text-mute truncate`,children:e.message}),(0,F.jsx)(`span`,{className:`ml-auto tabular-nums`,children:V(e.count)})]},e.fingerprint))})]}),(0,F.jsx)(H,{title:`What changed in the code`,sub:`queries, outbound calls and methods per request, beyond noise`,pad:!1,children:(0,F.jsx)(Ha,{rows:i.changes||[],empty:(0,F.jsx)(Na,{title:`No call-pattern changes detected`}),cols:[{key:`t`,label:`Call`,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 min-w-0`,children:[l(e.type),(0,F.jsx)(`span`,{className:`mono text-[11.5px] truncate max-w-[420px]`,children:e.label})]})},{key:`c`,label:`Change`,render:e=>(0,F.jsx)(G,{kind:e.change===`gone`||e.change===`less_frequent`?`neutral`:e.change===`new`?`warn`:`serious`,children:u(e)})},{key:`p`,label:`Per request now`,num:!0,render:e=>e.perRequest==null?e.selfMs==null?`—`:`${B(e.selfMs)} self`:V(e.perRequest)}]})})]})}var dV=980,fV=160,pV=46;function mV(e){return e>5?`#d03b3b`:e>1?`#e07a7a`:`#199e70`}function hV(){let e=I(),t=Qn(),n=ht(),{data:r,error:i}=P(`/api/map${e.q()}`,[e.tick]),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{if(!r)return null;let e=r.nodes,t=r.edges,n=e.filter(e=>e.type===`service`||e.type===`queue`),i=e.filter(e=>e.type===`database`||e.type===`external`),a=new Map;for(let e of n)a.set(e.id,e.type===`queue`?0:1);for(let e=0;e<n.length;e++)for(let e of t){if(!a.has(e.from)||!a.has(e.to))continue;let t=a.get(e.from)+1;a.get(e.to)<t&&a.set(e.to,t)}let o=[...new Set(a.values())].sort((e,t)=>e-t).map(e=>n.filter(t=>a.get(t.id)===e)),s=e=>o.length===1?dV/2:110+e*760/(o.length-1),c=new Map,l=0;o.forEach((e,t)=>e.forEach((e,n)=>{c.set(e.id,{x:s(t),y:60+n*90}),l=Math.max(l,60+n*90)}));let u=l+150,d=new Map;for(let e of i){let n=t.filter(t=>t.to===e.id).sort((e,t)=>t.calls-e.calls)[0],r=n?n.from:`none`;d.has(r)||d.set(r,[]),d.get(r).push(e)}let f=[...d.entries()].sort((e,t)=>(c.get(e[0])?.x??0)-(c.get(t[0])?.x??0)).flatMap(([,e])=>e);return f.forEach((e,t)=>{let n=Math.floor(t/5),r=Math.min(5,f.length-n*5),i=t%5,a=r*180;c.set(e.id,{x:(dV-a)/2+i*180+fV/2,y:u+n*80})}),{nodes:e,edges:t,pos:c,height:Math.max(...[...c.values()].map(e=>e.y),100)+70}},[r]);if(i)return(0,F.jsx)(W,{error:i});if(!r||!l)return(0,F.jsx)(U,{});let u=a||s,d=e=>!u||e===u||l.edges.some(t=>t.from===u&&t.to===e||t.to===u&&t.from===e),f=s?l.nodes.find(e=>e.id===s):null,p=Math.max(1,...l.edges.map(e=>e.calls)),m=e=>e===`service`?Oi:e===`database`?Br:e===`queue`?Yr:Kr;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(ui,{size:18,className:`text-brand`}),title:`Service map`,sub:`Drawn from real traffic: applications and queues left to right in call order, their databases and external hosts below. Line weight is volume; red means errors.`}),l.nodes.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`Nothing to draw yet`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[1fr_300px] gap-3 items-start`,children:[(0,F.jsxs)(H,{pad:!1,children:[(0,F.jsxs)(`div`,{className:`flex gap-4 px-4 pt-3 text-[11.5px] text-ink2`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 h-[3px] rounded`,style:{background:`#199e70`}}),`healthy`]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 h-[3px] rounded`,style:{background:`#e07a7a`}}),`> 1% errors`]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 h-[3px] rounded`,style:{background:`#d03b3b`}}),`> 5% errors`]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`w-4 border-t-2 border-dashed`,style:{borderColor:`#7a7a90`}}),`service → service (shared trace ids)`]})]}),(0,F.jsxs)(`svg`,{viewBox:`0 0 ${dV} ${l.height}`,className:`w-full`,style:{minHeight:360},onClick:()=>c(null),children:[l.edges.map(e=>{let t=l.pos.get(e.from),n=l.pos.get(e.to);if(!t||!n)return null;let r=n.y>t.y+40,i=r?t.x:t.x+fV/2,a=r?t.y+pV/2:t.y,o=r?n.x:n.x-fV/2,s=r?n.y-pV/2:n.y,c=r?`M${i},${a} C${i},${(a+s)/2} ${o},${(a+s)/2} ${o},${s}`:`M${i},${a} C${(i+o)/2},${a} ${(i+o)/2},${s} ${o},${s}`,d=1.2+4.5*Math.sqrt(e.calls/p),f=!u||e.from===u||e.to===u,m=mV(e.errorRate),h=e.from.startsWith(`svc:`)&&e.to.startsWith(`svc:`);return(0,F.jsxs)(`g`,{opacity:f?1:.12,children:[(0,F.jsx)(`path`,{d:c,fill:`none`,stroke:m,strokeOpacity:.55,strokeWidth:d,strokeDasharray:h?`8 6`:void 0}),(0,F.jsx)(`path`,{d:c,fill:`none`,stroke:`#ffffff`,strokeOpacity:.55,strokeWidth:Math.max(1,d/2.5),strokeLinecap:`round`,className:`flow`,style:{strokeDasharray:`1 23`,animationDuration:`${Math.max(.5,3-2.5*(e.calls/p))}s`}}),(0,F.jsxs)(`text`,{x:(i+o)/2,y:(a+s)/2-6,textAnchor:`middle`,fontSize:`11`,fill:`#9a9aab`,paintOrder:`stroke`,stroke:`#13131a`,strokeWidth:4,children:[V(e.calls),e.errorRate>0?` · ${ba(e.errorRate,1)}`:``]})]},e.from+e.to)}),l.nodes.map(e=>{let t=l.pos.get(e.id);if(!t)return null;let n=m(e.type),r=mV(e.errorRate),i=s===e.id;return(0,F.jsxs)(`g`,{transform:`translate(${t.x-fV/2},${t.y-pV/2})`,opacity:d(e.id)?1:.25,style:{cursor:`pointer`},onMouseEnter:()=>o(e.id),onMouseLeave:()=>o(null),onClick:t=>{t.stopPropagation(),c(e.id)},children:[(0,F.jsx)(`rect`,{width:fV,height:pV,rx:10,fill:`#16161e`,stroke:i?`#ff3d7f`:e.type===`service`?r:`#33333f`,strokeWidth:i?2:1.4}),(0,F.jsx)(`foreignObject`,{x:10,y:14,width:18,height:18,children:(0,F.jsx)(n,{size:16,color:e.type===`service`?`#ececf1`:`#9a9aab`})}),(0,F.jsx)(`text`,{x:34,y:20,fontSize:`13`,fontWeight:`600`,fill:`#ececf1`,children:e.label.length>18?`${e.label.slice(0,17)}…`:e.label}),(0,F.jsx)(`text`,{x:34,y:36,fontSize:`11`,fill:`#82829a`,children:e.type===`service`?`${V(e.calls)} req · ${B(e.avg)}`:e.type===`queue`?`queue · ${V(e.calls)} jobs`:`${e.type===`database`?`database`:`external`} · ${V(e.calls)}`})]},e.id)})]})]}),(0,F.jsx)(H,{title:f?f.label:`Details`,sub:f?.type,children:f?(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(Ka,{items:[[`Calls`,V(f.calls)],[`Errors`,`${V(f.errors)} (${ba(f.errorRate)})`],...f.avg==null?[]:[[`Avg`,B(f.avg)]]]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Callers`}),l.edges.filter(e=>e.to===f.id).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[12px] py-0.5`,children:[(0,F.jsx)(`span`,{children:l.nodes.find(t=>t.id===e.from)?.label}),(0,F.jsxs)(`span`,{className:`tabular-nums text-ink2`,children:[V(e.calls),` · `,B(e.avg)]})]},e.from)),!l.edges.some(e=>e.to===f.id)&&(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:`—`})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-mute text-[11px] uppercase tracking-wider mb-1`,children:`Calls out to`}),l.edges.filter(e=>e.from===f.id).map(e=>(0,F.jsxs)(`div`,{className:`flex justify-between text-[12px] py-0.5`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:l.nodes.find(t=>t.id===e.to)?.label}),(0,F.jsxs)(`span`,{className:`tabular-nums text-ink2`,children:[V(e.calls),` · `,B(e.avg)]})]},e.to)),!l.edges.some(e=>e.from===f.id)&&(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:`—`})]}),f.type===`service`&&(0,F.jsx)(`button`,{className:`btn`,onClick:()=>n(t(`/requests?service=${encodeURIComponent(f.label)}`)),children:`View requests`}),f.type===`database`&&(0,F.jsx)(`button`,{className:`btn`,onClick:()=>n(t(`/queries`)),children:`View statements`})]}):(0,F.jsx)(`div`,{className:`text-mute text-[12.5px]`,children:`Hover a node to isolate its connections; click it for numbers.`})})]})]})}var gV={error_rate:[{key:`mode`,label:`Mode`,type:`select`,options:[`threshold`,`anomaly`]},{key:`threshold`,label:`Threshold (%) / anomaly floor`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum requests`,type:`number`}],p95_latency:[{key:`mode`,label:`Mode`,type:`select`,options:[`threshold`,`anomaly`]},{key:`threshold`,label:`Threshold (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum requests`,type:`number`}],avg_latency:[{key:`threshold`,label:`Threshold (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum requests`,type:`number`}],throughput:[{key:`op`,label:`Fire when`,type:`select`,options:[`<`,`>`]},{key:`threshold`,label:`Requests per minute`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],job_failure_rate:[{key:`threshold`,label:`Threshold (%)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`},{key:`minRequests`,label:`Minimum runs`,type:`number`}],job_queue_wait:[{key:`threshold`,label:`p95 queue wait (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],silence:[{key:`windowMin`,label:`Silence tolerance (minutes)`,type:`number`,hint:`Never fires for a scope that has never reported.`}],job_silence:[{key:`windowMin`,label:`Silence tolerance (minutes)`,type:`number`}],log_pattern:[{key:`pattern`,label:`Message contains`,type:`text`},{key:`levels`,label:`Levels`,type:`levels`},{key:`logger`,label:`Logger / context`,type:`text`},{key:`threshold`,label:`Fire above N lines`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],new_error_group:[],secret_leak:[],event_loop_delay:[{key:`threshold`,label:`p99 delay (ms)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],memory:[{key:`threshold`,label:`RSS (MB)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],cpu:[{key:`threshold`,label:`CPU (%)`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}],custom_metric:[{key:`metric`,label:`Metric name`,type:`text`},{key:`agg`,label:`Aggregation`,type:`select`,options:[`sum`,`avg`,`max`,`min`]},{key:`op`,label:`Fire when`,type:`select`,options:[`>`,`<`]},{key:`threshold`,label:`Threshold`,type:`number`},{key:`windowMin`,label:`Window (minutes)`,type:`number`}]},_V=new Set([`error_rate`,`p95_latency`,`avg_latency`,`throughput`,`job_failure_rate`,`job_queue_wait`,`silence`,`job_silence`]);function vV(){let e=I(),t=Qn(),[n]=zn(),r=P(`/api/alerts`,[e.tick]),i=P(`/api/alerts/events${n.get(`rule`)?`?rule=${n.get(`rule`)}`:``}`,[e.tick]),[a,o]=(0,v.useState)(null);if((0,v.useEffect)(()=>{N(`/api/alerts/events/read`,{method:`POST`}).then(()=>e.refresh()).catch(()=>{})},[]),r.error)return(0,F.jsx)(W,{error:r.error});if(!r.data)return(0,F.jsx)(U,{});let s=r.data.types,c=e=>s[e]?.unit||``,l=()=>{r.reload(),i.reload()};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(gr,{size:18,className:`text-brand`}),title:`Alerts`,sub:`Thresholds or anomaly detection against the metric's recent baseline. Evaluated every 30 seconds.`,right:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{className:`btn`,onClick:async()=>{await N(`/api/alerts/evaluate`,{method:`POST`}),l()},children:[(0,F.jsx)(mi,{size:13}),`Evaluate now`]}),(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o({name:``,type:`error_rate`,params:{mode:`threshold`,threshold:5,windowMin:10,minRequests:20},channels:[{type:`inapp`}],enabled:!0,create_issue:!1}),children:[(0,F.jsx)(_i,{size:14}),`New rule`]})]})}),(0,F.jsx)(H,{pad:!1,title:`Rules`,children:(0,F.jsx)(Ha,{rows:r.data.rules,rowKey:e=>e.id,cols:[{key:`s`,label:`State`,render:e=>e.enabled?e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):(0,F.jsx)(G,{kind:`good`,children:`ok`}):(0,F.jsx)(G,{kind:`neutral`,children:`disabled`})},{key:`n`,label:`Rule`,render:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[s[e.type]?.family,` · `,s[e.type]?.label,e.params.mode===`anomaly`?` · anomaly`:e.params.threshold!=null&&e.type!==`silence`?` ${e.params.op||`>`} ${e.params.threshold}${c(e.type)}`:``,e.params.windowMin?` over ${e.params.windowMin}m`:``,e.params.service?` · ${e.params.service}`:``,e.params.route?` ${e.params.route}`:``]})]})},{key:`v`,label:`Current`,num:!0,render:e=>e.type===`new_error_group`||e.type===`secret_leak`?(0,F.jsx)(`span`,{className:`text-mute`,children:`event`}):e.last_value==null?`—`:`${V(Math.round(e.last_value*100)/100)}${c(e.type)?` ${c(e.type)}`:``}`},{key:`c`,label:`Channels`,render:e=>(0,F.jsxs)(`div`,{className:`flex gap-1`,children:[e.channels.map((e,t)=>(0,F.jsx)(`span`,{className:`pill`,children:e.type},t)),e.create_issue&&(0,F.jsx)(`span`,{className:`pill`,children:`issue`})]})},{key:`ch`,label:`Last change`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.last_change)})},{key:`a`,label:``,render:e=>(0,F.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Send test notification`,onClick:async()=>{bV((await N(`/api/alerts/${e.id}/test`,{method:`POST`})).deliveries)},children:(0,F.jsx)(Di,{size:13})}),e.type===`slo_burn`?(0,F.jsx)(Nn,{className:`btn btn-ghost h-7 px-2 text-[11.5px]`,to:t(`/slos?id=${e.params.sloId}`),title:`Managed by its SLO`,children:`Edit SLO`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Edit`,onClick:()=>o(e),children:(0,F.jsx)(pi,{size:13})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Delete`,onClick:async()=>{xV(e.name)&&(await N(`/api/alerts/${e.id}`,{method:`DELETE`}),l())},children:(0,F.jsx)(Ri,{size:13})})]})]})}]})}),(0,F.jsx)(H,{pad:!1,title:`History`,sub:`state transitions with per-channel delivery`,children:i.data?(0,F.jsx)(Ha,{rows:i.data,empty:(0,F.jsx)(Na,{title:`No alert events yet`}),maxHeight:480,cols:[{key:`t`,label:`Time`,render:e=>(0,F.jsx)(`span`,{className:`tabular-nums`,children:Ca(e.ts,!0)})},{key:`s`,label:`State`,render:e=>e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):e.state===`resolved`?(0,F.jsx)(G,{kind:`good`,children:`resolved`}):(0,F.jsx)(G,{kind:`neutral`,children:e.state})},{key:`r`,label:`Rule`,render:e=>(0,F.jsx)(`span`,{className:`font-medium`,children:e.rule})},{key:`m`,label:`Message`,render:e=>(0,F.jsx)(`span`,{className:`text-ink2`,children:e.message})},{key:`d`,label:`Delivery`,render:e=>(0,F.jsx)(`div`,{className:`flex gap-1`,children:e.deliveries.map((e,t)=>(0,F.jsxs)(`span`,{className:`pill`,style:{color:e.ok?`#5fd38a`:`#ff8a8a`},title:e.error||String(e.status||``),children:[e.type,` `,e.ok?`✓`:`✕`]},t))})}]}):(0,F.jsx)(U,{})}),a&&(0,F.jsx)(SV,{rule:a,types:s,onClose:()=>o(null),onSaved:()=>{o(null),l()}})]})}function yV({value:e,onChange:t}){let{data:n}=P(`/api/settings`),r=Qn();return(0,F.jsx)(K,{label:`Email to`,hint:n&&!n.email.configured?(0,F.jsxs)(`span`,{children:[`Email is not configured yet. `,(0,F.jsx)(Nn,{className:`link`,to:r(`/integrations/email`),children:`Set up SMTP in Integrations`}),` first.`]}):`Comma-separated addresses`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`oncall@company.com, ops@company.com`,value:e,onChange:e=>t(e.target.value)})})}function bV(e){let t=e.length?e.map(e=>`${e.type}: ${e.ok?`delivered`:`failed ${e.error||e.status||``}`}`).join(`
|
|
117
|
+
`):`No external channels configured (in-app only).`;window.alert(t)}function xV(e){return window.confirm(`Delete rule "${e}"?`)}function SV({rule:e,types:t,onClose:n,onSaved:r}){let i=I(),[a,o]=(0,v.useState)(JSON.parse(JSON.stringify(e))),[s,c]=(0,v.useState)(``),l=(e,t)=>o({...a,params:{...a.params,[e]:t}}),u=a.channels.find(e=>e.type===`webhook`)?.url||``,d=a.channels.find(e=>e.type===`slack`)?.url||``,f=a.channels.find(e=>e.type===`email`)?.to||``,p=e=>{let t=a.channels.filter(e=>e.type!==`email`);o({...a,channels:e.trim()?[...t,{type:`email`,to:e}]:t})},m=(e,t)=>{let n=a.channels.filter(t=>t.type!==e);o({...a,channels:t?[...n,{type:e,url:t}]:n})},h=a.params.mute||{};return(0,F.jsxs)(qa,{open:!0,onClose:n,title:a.id?`Edit alert rule`:`New alert rule`,wide:!0,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Name`,children:(0,F.jsx)(`input`,{className:`input`,value:a.name,placeholder:t[a.type]?.label,onChange:e=>o({...a,name:e.target.value})})}),(0,F.jsx)(K,{label:`Type`,children:(0,F.jsx)(`select`,{className:`select`,value:a.type,onChange:e=>o({...a,type:e.target.value,params:{windowMin:10}}),children:Object.entries(t).filter(([e])=>e!==`slo_burn`).map(([e,t])=>(0,F.jsxs)(`option`,{value:e,children:[t.family,` — `,t.label]},e))})}),_V.has(a.type)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(K,{label:`Application (optional)`,children:(0,F.jsxs)(`select`,{className:`select`,value:a.params.service||``,onChange:e=>l(`service`,e.target.value||void 0),children:[(0,F.jsx)(`option`,{value:``,children:`All applications`}),i.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]})}),(0,F.jsx)(K,{label:`Route / job (optional)`,hint:`e.g. "POST /checkout"`,children:(0,F.jsx)(`input`,{className:`input`,value:a.params.route||``,onChange:e=>l(`route`,e.target.value||void 0)})})]}),(gV[a.type]||[]).map(e=>(0,F.jsx)(K,{label:e.label,hint:e.hint,children:e.type===`select`?(0,F.jsx)(`select`,{className:`select`,value:a.params[e.key]??e.options[0],onChange:t=>l(e.key,t.target.value),children:e.options.map(e=>(0,F.jsx)(`option`,{children:e},e))}):e.type===`levels`?(0,F.jsx)(`div`,{className:`flex gap-2 h-[30px] items-center`,children:[`error`,`warn`,`info`,`debug`].map(e=>(0,F.jsxs)(`label`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:(a.params.levels||[]).includes(e),onChange:t=>l(`levels`,t.target.checked?[...a.params.levels||[],e]:(a.params.levels||[]).filter(t=>t!==e))}),e]},e))}):(0,F.jsx)(`input`,{className:`input`,type:e.type===`number`?`number`:`text`,value:a.params[e.key]??``,onChange:t=>l(e.key,e.type===`number`?t.target.value===``?void 0:Number(t.target.value):t.target.value)})},e.key))]}),(0,F.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-line grid grid-cols-2 gap-3`,children:[(0,F.jsx)(`div`,{className:`col-span-2 text-[12px] font-semibold`,children:`Notify`}),(0,F.jsx)(K,{label:`Slack incoming webhook URL`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://hooks.slack.com/services/…`,value:d,onChange:e=>m(`slack`,e.target.value)})}),(0,F.jsx)(K,{label:`Generic webhook URL`,hint:`POSTs JSON { rule, state, value, message, link }`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://…`,value:u,onChange:e=>m(`webhook`,e.target.value)})}),(0,F.jsx)(`div`,{className:`col-span-2`,children:(0,F.jsx)(yV,{value:f,onChange:e=>p(e)})}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:a.create_issue,onChange:e=>o({...a,create_issue:e.target.checked})}),`Open an issue when it fires`]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),`Enabled`]}),(0,F.jsxs)(`div`,{className:`col-span-2 flex items-center gap-2 text-[12.5px] flex-wrap`,children:[(0,F.jsx)(`span`,{className:`text-ink2`,children:`Mute daily (UTC) from`}),(0,F.jsx)(`input`,{className:`input w-16`,type:`number`,min:0,max:23,value:h.from??``,onChange:e=>l(`mute`,{...h,from:e.target.value===``?void 0:Number(e.target.value)})}),(0,F.jsx)(`span`,{className:`text-ink2`,children:`to`}),(0,F.jsx)(`input`,{className:`input w-16`,type:`number`,min:0,max:24,value:h.to??``,onChange:e=>l(`mute`,{...h,to:e.target.value===``?void 0:Number(e.target.value)})}),(0,F.jsx)(`span`,{className:`text-mute`,children:`hours (leave empty for no mute)`})]})]}),s&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] mt-3`,children:s}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 mt-4`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:n,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:async()=>{try{let e={...a,channels:a.channels.some(e=>e.type===`inapp`)?a.channels:[{type:`inapp`},...a.channels]};a.id?await N(`/api/alerts/${a.id}`,{method:`PUT`,json:e}):await N(`/api/alerts`,{method:`POST`,json:e}),r()}catch(e){c(e.message)}},children:`Save rule`})]})]})}var CV={open:{kind:`crit`,label:`Open`},in_progress:{kind:`warn`,label:`In progress`},verifying:{kind:`serious`,label:`Verifying`},unverified:{kind:`neutral`,label:`Unverified`},resolved:{kind:`good`,label:`Resolved`},closed:{kind:`good`,label:`Closed`}},wV={critical:`#d03b3b`,high:`#ec835a`,medium:`#fab219`,low:`#82829a`};function TV(){let e=I(),t=Qn(),n=ht(),[r,i]=(0,v.useState)(`active`),[a,o]=(0,v.useState)(!1),{data:s,error:c}=P(`/api/issues`,[e.tick]);if(c)return(0,F.jsx)(W,{error:c});if(!s)return(0,F.jsx)(U,{});let l=s.filter(e=>r===`all`||(r===`active`?![`closed`,`resolved`].includes(e.status):[`closed`,`resolved`].includes(e.status)));return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Pr,{size:18,className:`text-brand`}),title:`Issues`,sub:`Track what needs fixing. Issues linked to an error or route verify themselves against the next release and close or reopen automatically.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,F.jsx)(_i,{size:14}),`New issue`]})}),(0,F.jsx)(H,{pad:!1,title:(0,F.jsx)(Va,{value:r,onChange:i,options:[{id:`active`,label:`Active`},{id:`done`,label:`Done`},{id:`all`,label:`All`}]}),children:(0,F.jsx)(`div`,{className:`pt-2`,children:(0,F.jsx)(Ha,{rows:l,onRow:e=>n(t(`/issues/${e.id}`)),empty:(0,F.jsx)(Na,{title:`No issues`,children:`Create one from an error group, a failed execution, or let an alert open it.`}),cols:[{key:`id`,label:`#`,render:e=>(0,F.jsxs)(`span`,{className:`text-mute`,children:[`#`,e.id]}),width:50},{key:`t`,label:`Title`,render:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e.title}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[e.service||`no service`,e.sourceType?` · from ${e.sourceType}`:``]})]})},{key:`s`,label:`Status`,render:e=>(0,F.jsx)(G,{kind:CV[e.status]?.kind||`neutral`,children:CV[e.status]?.label||e.status})},{key:`sev`,label:`Severity`,render:e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 capitalize`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full`,style:{background:wV[e.severity]}}),e.severity]})},{key:`tk`,label:`Ticket`,render:e=>e.ticket?(0,F.jsx)(oz,{ticket:e.ticket}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`o`,label:`Owner`,render:e=>e.owner||(0,F.jsx)(`span`,{className:`text-mute`,children:`unassigned`})},{key:`d`,label:`Due`,render:e=>e.due?(0,F.jsx)(`span`,{style:{color:e.due<Date.now()&&![`closed`,`resolved`].includes(e.status)?`#ff8a8a`:void 0},children:Ca(e.due,!0).split(` `).slice(0,2).join(` `)}):(0,F.jsx)(`span`,{className:`text-mute`,children:`—`})},{key:`u`,label:`Updated`,num:!0,render:e=>(0,F.jsx)(`span`,{className:`text-mute`,children:Sa(e.updated)})}]})})}),a&&(0,F.jsx)(EV,{onClose:()=>o(!1),onCreated:e=>n(t(`/issues/${e}`))})]})}function EV({onClose:e,onCreated:t}){let n=I(),[r,i]=(0,v.useState)({title:``,severity:`medium`,owner:``,description:``,service:``,sourceType:``,sourceRef:``}),{settings:a,connected:o}=iz(),[s,c]=(0,v.useState)(null),l=s??(a?.autoCreate||``),[u,d]=(0,v.useState)(``);return(0,F.jsx)(qa,{open:!0,onClose:e,title:`New issue`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(K,{label:`Title`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,value:r.title,onChange:e=>i({...r,title:e.target.value})})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Severity`,children:(0,F.jsx)(`select`,{className:`select`,value:r.severity,onChange:e=>i({...r,severity:e.target.value}),children:Object.keys(wV).map(e=>(0,F.jsx)(`option`,{children:e},e))})}),(0,F.jsx)(K,{label:`Owner`,children:(0,F.jsx)(`input`,{className:`input`,value:r.owner,onChange:e=>i({...r,owner:e.target.value})})}),(0,F.jsx)(K,{label:`Application`,children:(0,F.jsxs)(`select`,{className:`select`,value:r.service,onChange:e=>i({...r,service:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`—`}),n.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]})}),(0,F.jsx)(K,{label:`Measurable route (optional)`,hint:`e.g. "POST /checkout" enables auto-verification`,children:(0,F.jsx)(`input`,{className:`input`,value:r.sourceRef,onChange:e=>i({...r,sourceRef:e.target.value,sourceType:e.target.value?`operation`:``})})})]}),(0,F.jsx)(K,{label:`Description`,children:(0,F.jsx)(`textarea`,{className:`input`,rows:4,value:r.description,onChange:e=>i({...r,description:e.target.value})})}),o.length>0&&(0,F.jsx)(K,{label:`Also create a ticket in`,children:(0,F.jsxs)(`select`,{className:`select w-56`,value:l,onChange:e=>c(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:`Don't create a ticket`}),o.map(e=>(0,F.jsx)(`option`,{value:e,children:rz[e]},e))]})}),u&&(0,F.jsx)(`div`,{className:`text-[12.5px] text-[#ff8a8a]`,children:u}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:e,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!r.title,onClick:async()=>{let e=await N(`/api/issues`,{method:`POST`,json:{...r,tracker:l||void 0}});e.ticketError&&window.alert(`Issue #${e.id} was created, but the ticket was not: ${e.ticketError}`),t(e.id)},children:`Create`})]})]})})}var DV={fixed:{kind:`good`,label:`Fixed`},not_fixed:{kind:`crit`,label:`Not fixed`},too_early:{kind:`warn`,label:`Too early to tell`},not_enough_data:{kind:`neutral`,label:`Not enough data`}};function OV(){let{id:e}=yt(),t=I(),n=Qn(),r=ht(),{data:i,error:a,reload:o}=P(`/api/issues/${e}`,[e,t.tick]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),{connected:p}=iz(),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(!1),y=async e=>{_(!0),h(null);try{h({ok:!0,text:await e()}),o()}catch(e){h({ok:!1,text:e.message})}finally{_(!1)}};if(a)return(0,F.jsx)(W,{error:a});if(!i)return(0,F.jsx)(U,{});let b=async n=>{await N(`/api/issues/${e}`,{method:`PATCH`,json:n}),o(),t.refresh()},x=i.incident,S=(t.meta?.versions||[]).filter(e=>!i.service||e.service===i.service).map(e=>e.version),C=[`Issue #${i.id}: ${i.title}`,`Status: ${i.status} · Severity: ${i.severity}${i.owner?` · Owner: ${i.owner}`:``}`,x?`Error: ${x.error}\nOperation: ${x.operation}\nStarted: ${new Date(x.start).toISOString()}${x.end?`\nEnded: ${new Date(x.end).toISOString()}`:``}\nIntroduced in: ${x.introducedIn||`unknown`}${i.fixVersion?`\nFixed in: ${i.fixVersion}`:``}\nOccurrences: ${x.occurrences}\nAffected users: ${x.users.length}${x.customers.length?`\nCustomers: ${x.customers.join(`, `)}`:``}`:``,`Timeline:`,...i.timeline.map(e=>`- ${new Date(e.ts).toISOString()} ${e.text}`)].filter(Boolean).join(`
|
|
118
|
+
`),w=i.sourceType===`error`?`/errors/${i.sourceRef}`:i.sourceType===`execution`?`/executions/${i.sourceRef}`:i.sourceType===`alert`?`/alerts`:null;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Nn,{to:n(`/issues`),className:`text-mute hover:text-ink text-[12px] -mb-2`,children:`← Issues`}),(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsxs)(`span`,{className:`text-mute text-[19px]`,children:[`#`,i.id]}),(0,F.jsx)(`h1`,{className:`text-[19px] font-semibold tracking-tight`,children:i.title})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,F.jsx)(G,{kind:CV[i.status]?.kind||`neutral`,children:CV[i.status]?.label||i.status}),(0,F.jsxs)(`span`,{className:`text-mute text-[12px]`,children:[`opened `,Sa(i.created),i.sourceType?` from ${i.sourceType}`:``]}),w&&(0,F.jsx)(`button`,{className:`link text-[12px]`,onClick:()=>r(n(w)),children:`view source →`})]})]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(Ba,{text:C,label:`Copy summary`}),[`open`,`in_progress`,`unverified`].includes(i.status)&&(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>b({status:`resolved`}),children:`Mark resolved`}),[`resolved`,`closed`,`verifying`].includes(i.status)&&(0,F.jsx)(`button`,{className:`btn`,onClick:()=>b({status:`open`}),children:`Reopen`})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-3 gap-3`,children:[(0,F.jsxs)(`div`,{className:`@5xl:col-span-2 flex flex-col gap-3`,children:[i.description&&(0,F.jsx)(H,{title:`Description`,children:(0,F.jsx)(`div`,{className:`whitespace-pre-wrap text-[13px]`,children:i.description})}),x&&(0,F.jsx)(H,{title:`Incident record`,children:(0,F.jsx)(Ka,{items:[[`Error`,(0,F.jsx)(`span`,{className:`text-[#ff9b9b]`,children:x.error})],[`Operation`,(0,F.jsx)(`span`,{className:`mono`,children:x.operation})],[`Started`,Ca(x.start,!0)],[`Ended`,x.end?Ca(x.end,!0):`ongoing`],[`Last seen`,Sa(x.lastSeen)],[`Introduced in`,(0,F.jsx)(`span`,{className:`mono`,children:x.introducedIn||`—`})],[`Fixed in`,(0,F.jsx)(`span`,{className:`mono`,children:i.fixVersion||`—`})],[`Occurrences`,x.occurrences],[`Users affected`,x.users.length],[`Customers`,x.customers.join(`, `)||`—`]]})}),(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsx)(ji,{size:14}),`Did a release fix this?`]}),children:[(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,F.jsx)(K,{label:`Release`,children:(0,F.jsxs)(`select`,{className:`select w-48`,value:d,onChange:e=>f(e.target.value),children:[(0,F.jsx)(`option`,{value:``,children:i.fixVersion?`Fix version (${i.fixVersion})`:`Since resolution`}),[...new Set(S)].map(e=>(0,F.jsx)(`option`,{children:e},e))]})}),(0,F.jsx)(`button`,{className:`btn`,onClick:async()=>u(await N(`/api/issues/${e}/verify${d?`?version=${encodeURIComponent(d)}`:``}`)),children:`Check`}),d&&d!==i.fixVersion&&(0,F.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>b({fixVersion:d}),children:`Set as fix version`})]}),l&&(0,F.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(G,{kind:DV[l.verdict]?.kind||`neutral`,children:DV[l.verdict]?.label||l.verdict}),(0,F.jsx)(`span`,{className:`text-ink2`,children:l.reason})]}),l.newErrorGroupsInRelease>0&&(0,F.jsxs)(`div`,{className:`text-mute text-[12px]`,children:[`Note: `,l.newErrorGroupsInRelease,` new error group(s) appeared in that release.`]})]}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px] mt-3`,children:`Marking an issue with a measurable scope as resolved moves it to Verifying: it closes on its own once the fix holds, reopens if the failure returns, and becomes Unverified after 7 days without a conclusion.`})]}),(0,F.jsxs)(H,{title:`Timeline`,children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:[...i.timeline].reverse().map((e,t)=>(0,F.jsxs)(`div`,{className:`flex gap-3 text-[12.5px]`,children:[(0,F.jsx)(`span`,{className:`text-mute w-[130px] shrink-0 tabular-nums`,children:Ca(e.ts,!0)}),(0,F.jsx)(`span`,{children:e.text})]},t))}),(0,F.jsxs)(`form`,{className:`flex gap-2 mt-3`,onSubmit:e=>{e.preventDefault(),s&&(b({comment:s}),c(``))},children:[(0,F.jsx)(`input`,{className:`input flex-1`,placeholder:`Add a comment`,value:s,onChange:e=>c(e.target.value)}),(0,F.jsx)(`button`,{className:`btn`,children:`Comment`})]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsxs)(H,{title:`Ticket`,sub:i.ticket?`kept in step with this issue`:p.length?`track the work where your team works`:void 0,children:[i.ticket?(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,F.jsx)(`div`,{children:(0,F.jsx)(oz,{ticket:i.ticket})}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[i.ticket.syncedAt?`Checked ${Sa(i.ticket.syncedAt)}. `:``,`Closing it starts verification here; the result is posted on the ticket.`]}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsxs)(`button`,{className:`btn h-7`,disabled:g,onClick:()=>y(async()=>(await N(`/api/issues/${e}/ticket/sync`,{method:`POST`}),`Synced.`)),children:[(0,F.jsx)(bi,{size:12}),`Sync now`]}),(0,F.jsxs)(`button`,{className:`btn btn-ghost h-7`,disabled:g,onClick:()=>y(async()=>window.confirm(`Unlink the ticket? It is not deleted.`)?(await N(`/api/issues/${e}/ticket`,{method:`DELETE`}),`Unlinked.`):`Kept.`),children:[(0,F.jsx)(Hi,{size:12}),`Unlink`]})]})]}):p.length?(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:p.map(t=>(0,F.jsxs)(`button`,{className:`btn`,disabled:g,onClick:()=>y(async()=>{let n=await N(`/api/issues/${e}/ticket`,{method:`POST`,json:{provider:t}});return`Created ${rz[t]} ${n.key}.`}),children:[`Create in `,rz[t]]},t))}):(0,F.jsxs)(`div`,{className:`text-mute text-[12.5px]`,children:[`Connect GitHub or Linear in `,(0,F.jsx)(`button`,{className:`link`,onClick:()=>r(n(`/integrations`)),children:`Integrations`}),` to open tickets from issues.`]}),m&&(0,F.jsx)(`div`,{className:`text-[12px] mt-2`,style:{color:m.ok?`#5fd38a`:`#ff8a8a`},children:m.text})]}),(0,F.jsx)(H,{title:`Details`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(K,{label:`Status`,children:(0,F.jsx)(`select`,{className:`select`,value:i.status,onChange:e=>b({status:e.target.value}),children:Object.entries(CV).map(([e,t])=>(0,F.jsx)(`option`,{value:e,children:t.label},e))})}),(0,F.jsx)(K,{label:`Severity`,children:(0,F.jsx)(`select`,{className:`select`,value:i.severity,onChange:e=>b({severity:e.target.value}),children:Object.keys(wV).map(e=>(0,F.jsx)(`option`,{children:e},e))})}),(0,F.jsx)(K,{label:`Owner`,children:(0,F.jsx)(`input`,{className:`input`,defaultValue:i.owner||``,onBlur:e=>e.target.value!==(i.owner||``)&&b({owner:e.target.value}),placeholder:`name or email`})}),(0,F.jsx)(K,{label:`Due date`,children:(0,F.jsx)(`input`,{className:`input`,type:`date`,defaultValue:i.due?new Date(i.due).toISOString().slice(0,10):``,onChange:e=>b({due:e.target.value?new Date(e.target.value).getTime():null})})}),(0,F.jsx)(Ka,{items:[[`Application`,i.service||`—`],[`Created`,Ca(i.created,!0)],[`Updated`,Sa(i.updated)]]}),(0,F.jsx)(`button`,{className:`btn btn-ghost justify-center text-[#ff8a8a]`,onClick:async()=>{window.confirm(`Delete this issue?`)&&(await N(`/api/issues/${e}`,{method:`DELETE`}),r(n(`/issues`)))},children:`Delete issue`})]})})]})]})]})}var kV={healthy:{kind:`good`,label:`Healthy`},at_risk:{kind:`warn`,label:`At risk`},burning:{kind:`serious`,label:`Burning`},exhausted:{kind:`crit`,label:`Budget exhausted`},no_data:{kind:`neutral`,label:`No data`}},AV=e=>e==null?`#55556a`:e<=0?GR.crit:e<.25?GR.serious:e<.5?GR.warn:GR.good,jV=(e,t)=>e==null?void 0:e>t?`#ff8a8a`:e>1?`#ffc85a`:void 0,MV=e=>`${e.service||`all applications`}${e.operation?` · ${e.operation}`:``}${e.kind===`job`?` (jobs)`:``}`,NV=e=>`${e.kind===`job`?`runs succeed`:`requests succeed (non-5xx)`}${e.latencyMs?` and finish within ${e.latencyMs}ms`:``}`;function PV({value:e}){let t=e==null?0:Math.max(0,Math.min(1,e))*100;return(0,F.jsx)(`div`,{className:`h-1.5 rounded-full bg-[#24242e] overflow-hidden`,title:e==null?`no data`:`${(e*100).toFixed(1)}% budget left`,children:(0,F.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${t}%`,background:AV(e)}})})}function FV(){let e=I(),[t,n]=zn(),{data:r,error:i,reload:a}=P(`/api/slos`,[e.tick]),[o,s]=(0,v.useState)(null),c=Number(t.get(`id`))||r?.[0]?.slo.id||null,l=e=>{let r=new URLSearchParams(t);r.set(`id`,String(e)),n(r,{replace:!0})};return i?(0,F.jsx)(W,{error:i}):r?(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(Li,{size:18,className:`text-brand`}),title:`SLOs`,sub:`Service level objectives on real traffic: the share of good requests or job runs over a rolling window, the error budget left, and burn-rate alerts that fire before the budget runs out.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s({target:99.5,windowDays:7,kind:`http`,channels:[{type:`inapp`}]}),children:[(0,F.jsx)(_i,{size:14}),`New SLO`]})}),r.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No SLOs yet`,icon:(0,F.jsx)(Li,{size:22}),children:`An SLO says how reliable something must be, e.g. 99.5% of checkout requests succeed over 7 days. Obzerver tracks the error budget and alerts on fast and slow burn.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[360px_1fr] gap-3 items-start`,children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,F.jsxs)(`button`,{onClick:()=>l(e.slo.id),className:`card text-left px-3.5 py-3 flex flex-col gap-2 ${c===e.slo.id?`!border-[#5a2340]`:`hover:border-line2`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:e.slo.name}),(0,F.jsx)(G,{kind:kV[e.state].kind,children:kV[e.state].label})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] truncate`,children:[MV(e.slo),` · `,e.slo.target,`% over `,e.slo.windowDays,`d`]}),(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[18px] font-semibold tabular-nums`,children:e.sli==null?`—`:`${e.sli}%`}),(0,F.jsx)(`span`,{className:`text-[11.5px] tabular-nums`,style:{color:AV(e.budgetRemaining)},children:e.budgetRemaining==null?`no data`:`${(e.budgetRemaining*100).toFixed(1)}% budget left`})]}),(0,F.jsx)(PV,{value:e.budgetRemaining})]},e.slo.id))}),c&&(0,F.jsx)(IV,{id:c,onEdit:e=>s(e),onDeleted:()=>{let e=new URLSearchParams(t);e.delete(`id`),n(e),a()}})]}),o&&(0,F.jsx)(RV,{slo:o,onClose:()=>s(null),onSaved:e=>{s(null),a(),l(e)}})]}):(0,F.jsx)(U,{})}function IV({id:e,onEdit:t,onDeleted:n}){let r=I(),i=Qn(),{data:a,error:o}=P(`/api/slos/${e}`,[e,r.tick]);if(o)return(0,F.jsx)(W,{error:o});if(!a)return(0,F.jsx)(U,{});let s=a.slo,c=a.history.points,l=[[`5 minutes`,a.burn.m5,14.4],[`30 minutes`,a.burn.m30,6],[`1 hour`,a.burn.h1,14.4],[`6 hours`,a.burn.h6,6],[`1 day`,a.burn.d1,1]];return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,F.jsx)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[s.name,(0,F.jsx)(G,{kind:kV[a.state].kind,children:kV[a.state].label})]}),right:(0,F.jsxs)(`div`,{className:`flex gap-1`,children:[(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>t(s),children:[(0,F.jsx)(pi,{size:13}),`Edit`]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Delete`,onClick:async()=>{window.confirm(`Delete SLO "${s.name}" and its burn alerts?`)&&(await N(`/api/slos/${s.id}`,{method:`DELETE`}),n())},children:(0,F.jsx)(Ri,{size:13})})]}),children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[s.description&&(0,F.jsx)(`div`,{className:`text-ink2`,children:s.description}),(0,F.jsxs)(`div`,{className:`text-[13px]`,children:[(0,F.jsxs)(`b`,{children:[s.target,`%`]}),` of `,s.operation?(0,F.jsx)(za,{name:s.operation}):(0,F.jsx)(`span`,{children:s.kind===`job`?`job runs`:`requests`}),` in `,(0,F.jsx)(`b`,{children:s.service||`all applications`}),` `,NV(s),`, over a rolling `,(0,F.jsxs)(`b`,{children:[s.windowDays,`-day`]}),` window.`]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 @3xl:grid-cols-4 gap-3`,children:[(0,F.jsx)(LV,{label:`Achieved`,value:a.sli==null?`—`:`${a.sli}%`,sub:`target ${s.target}%`,color:a.sli!=null&&a.sli<s.target?`#ff8a8a`:void 0}),(0,F.jsx)(LV,{label:`Error budget left`,value:a.budgetRemaining==null?`—`:`${(a.budgetRemaining*100).toFixed(1)}%`,color:AV(a.budgetRemaining),sub:(0,F.jsx)(PV,{value:a.budgetRemaining})}),(0,F.jsx)(LV,{label:`Bad events left`,value:a.budgetEventsLeft==null?`—`:V(Math.max(0,a.budgetEventsLeft)),sub:`${V(a.bad)} bad of ${V(a.total)}`}),(0,F.jsx)(LV,{label:`Burn rate (1h)`,value:a.burn.h1==null?`—`:`${a.burn.h1}×`,sub:`1× spends the budget exactly by window end`,color:jV(a.burn.h1,14.4)})]}),a.partialWindow&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-[#ffc85a]`,children:[(0,F.jsx)(Vi,{size:13}),a.dataSince?`Data only goes back to ${Ca(a.dataSince,!0)}`:`No data yet`,`, so this window is partial.`,s.windowDays>a.retentionDays&&` Retention is ${a.retentionDays} days; raise OBZERVER_RETENTION_DAYS to cover the full ${s.windowDays}-day window.`]})]})}),(0,F.jsx)(YR,{title:`Error budget burn-down`,sub:`share of the window's budget still unspent`,children:(0,F.jsx)(JR,{data:c,series:[{key:`budget`,label:`Budget left`,color:WR[0],type:`area`}],height:190,fmt:e=>`${e.toFixed(1)}%`,refLines:[{y:0,label:`exhausted`,color:GR.crit}],zoom:!1})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @7xl:grid-cols-2 gap-3`,children:[(0,F.jsx)(YR,{title:`SLI per bucket`,sub:`good share per ${a.history.bucketMs>=864e5?`day`:a.history.bucketMs>=36e5?`${a.history.bucketMs/36e5}h`:`30m`}`,children:(0,F.jsx)(JR,{data:c,series:[{key:`sli`,label:`SLI`,color:WR[2],type:`line`}],height:170,fmt:e=>`${e.toFixed(2)}%`,refLines:[{y:s.target,label:`target ${s.target}%`,color:`#ff6b9d`}],yDomain:[`auto`,100],zoom:!1})}),(0,F.jsx)(H,{title:`Burn rates`,sub:`multiples of the sustainable rate`,children:(0,F.jsxs)(`table`,{className:`tbl`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`Lookback`}),(0,F.jsx)(`th`,{className:`num`,children:`Burn rate`}),(0,F.jsx)(`th`,{className:`num`,children:`Error rate`})]})}),(0,F.jsx)(`tbody`,{children:l.map(([e,t,n])=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:e}),(0,F.jsx)(`td`,{className:`num`,style:{color:jV(t,n)},children:t==null?`—`:`${t}×`}),(0,F.jsx)(`td`,{className:`num text-ink2`,children:t==null?`—`:ba(t*(100-s.target))})]},e))})]})})]}),(0,F.jsxs)(H,{title:`Burn-rate alerts`,sub:`created and kept in step with this SLO`,pad:!1,children:[(0,F.jsx)(Ha,{rows:a.rules,cols:[{key:`s`,label:`State`,render:e=>e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):(0,F.jsx)(G,{kind:`good`,children:`ok`})},{key:`n`,label:`Rule`,render:e=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{children:e.params.speed===`fast`?`Fast burn`:`Slow burn`}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:e.params.speed===`fast`?`over 14.4× on both the last 1h and 5m (about 2% of a 30-day budget in an hour)`:`over 6× on both the last 6h and 30m (about 5% of a 30-day budget in 6 hours)`})]})},{key:`v`,label:`Current`,num:!0,render:e=>e.last_value==null?`—`:`${e.last_value.toFixed(1)}×`},{key:`c`,label:`Notifies`,render:()=>(0,F.jsx)(`div`,{className:`flex gap-1`,children:s.channels.map((e,t)=>(0,F.jsx)(`span`,{className:`pill`,children:e.type},t))})}]}),a.events.length>0&&(0,F.jsx)(`div`,{className:`border-t border-line`,children:a.events.slice(0,8).map(e=>(0,F.jsxs)(`div`,{className:`flex gap-3 px-3.5 py-2 border-b border-[#1d1d26] last:border-0 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-mute w-32 shrink-0`,children:Sa(e.ts)}),e.state===`firing`?(0,F.jsx)(G,{kind:`crit`,children:`firing`}):(0,F.jsx)(G,{kind:`good`,children:e.state}),(0,F.jsx)(`span`,{className:`text-ink2 truncate`,children:e.message})]},e.id))}),(0,F.jsxs)(`div`,{className:`px-3.5 py-2 border-t border-line text-[11.5px] text-mute`,children:[`Delivery history is on `,(0,F.jsx)(Nn,{className:`link`,to:i(`/alerts`),children:`Alerts`}),`.`]})]})]})}function LV({label:e,value:t,sub:n,color:r}){return(0,F.jsxs)(`div`,{className:`rounded-lg border border-line px-3 py-2.5 flex flex-col gap-1`,children:[(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:e}),(0,F.jsx)(`div`,{className:`text-[20px] font-semibold tabular-nums leading-none`,style:r?{color:r}:void 0,children:t}),n&&(0,F.jsx)(`div`,{className:`text-mute text-[11px]`,children:n})]})}function RV({slo:e,onClose:t,onSaved:n}){let r=I(),[i,a]=(0,v.useState)({...e,channels:e.channels??[{type:`inapp`}]}),[o,s]=(0,v.useState)(``),c=P(`/api/operations?range=604800000&kind=${i.kind||`http`}${i.service?`&service=${encodeURIComponent(i.service)}`:``}`,[i.kind,i.service]),l=e=>i.channels?.find(t=>t.type===e),u=(e,t)=>{let n=(i.channels||[]).filter(t=>t.type!==e);a({...i,channels:t?[...n,{type:e,...t}]:n})};(0,v.useEffect)(()=>s(``),[i]);let d=async()=>{try{let e={...i,channels:[{type:`inapp`},...(i.channels||[]).filter(e=>e.type!==`inapp`)]};n((i.id?await N(`/api/slos/${i.id}`,{method:`PUT`,json:e}):await N(`/api/slos`,{method:`POST`,json:e})).id)}catch(e){s(e.message)}},f=i.target?100-i.target:null;return(0,F.jsxs)(qa,{open:!0,onClose:t,title:i.id?`Edit SLO`:`New SLO`,wide:!0,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Name`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,placeholder:`Checkout availability`,value:i.name||``,onChange:e=>a({...i,name:e.target.value})})}),(0,F.jsx)(K,{label:`Measures`,children:(0,F.jsx)(Va,{value:i.kind||`http`,onChange:e=>a({...i,kind:e,operation:null}),options:[{id:`http`,label:`HTTP requests`},{id:`job`,label:`Job runs`}]})}),(0,F.jsx)(K,{label:`Application`,children:(0,F.jsxs)(`select`,{className:`select`,value:i.service||``,onChange:e=>a({...i,service:e.target.value||null,operation:null}),children:[(0,F.jsx)(`option`,{value:``,children:`All applications`}),r.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]})}),(0,F.jsxs)(K,{label:i.kind===`job`?`Job (optional)`:`Route (optional)`,hint:`leave empty to cover everything in the application`,children:[(0,F.jsx)(`input`,{className:`input mono`,list:`slo-ops`,placeholder:i.kind===`job`?`send-email`:`POST /checkout`,value:i.operation||``,onChange:e=>a({...i,operation:e.target.value||null})}),(0,F.jsx)(`datalist`,{id:`slo-ops`,children:[...new Set((c.data||[]).map(e=>e.name))].map(e=>(0,F.jsx)(`option`,{value:e},e))})]}),(0,F.jsx)(K,{label:`Target (% good)`,hint:f==null?void 0:`allows ${f.toFixed(3).replace(/0+$/,``).replace(/\.$/,``)}% bad events`,children:(0,F.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,F.jsx)(`input`,{className:`input w-28`,type:`number`,step:`0.01`,min:`1`,max:`99.999`,value:i.target??``,onChange:e=>a({...i,target:e.target.value===``?void 0:Number(e.target.value)})}),[99,99.5,99.9,99.95].map(e=>(0,F.jsx)(`button`,{type:`button`,className:`btn h-7 px-2 ${i.target===e?`btn-primary`:``}`,onClick:()=>a({...i,target:e}),children:e},e))]})}),(0,F.jsx)(K,{label:`Window`,children:(0,F.jsx)(Va,{value:String(i.windowDays??7),onChange:e=>a({...i,windowDays:Number(e)}),options:[`1`,`7`,`14`,`28`,`30`].map(e=>({id:e,label:`${e}d`}))})}),(0,F.jsx)(K,{label:`Latency threshold (optional)`,hint:`if set, a successful event slower than this also counts as bad`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{className:`input w-32`,type:`number`,min:`1`,placeholder:`e.g. 800`,value:i.latencyMs??``,onChange:e=>a({...i,latencyMs:e.target.value===``?null:Number(e.target.value)})}),(0,F.jsx)(`span`,{className:`text-mute`,children:`ms`})]})}),(0,F.jsx)(K,{label:`Description (optional)`,children:(0,F.jsx)(`input`,{className:`input`,value:i.description||``,onChange:e=>a({...i,description:e.target.value||null})})})]}),(0,F.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-line grid grid-cols-2 gap-3`,children:[(0,F.jsx)(`div`,{className:`col-span-2 text-[12px] font-semibold`,children:`Burn-rate alerts notify`}),(0,F.jsx)(K,{label:`Slack incoming webhook URL`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://hooks.slack.com/services/…`,value:l(`slack`)?.url||``,onChange:e=>u(`slack`,e.target.value?{url:e.target.value}:null)})}),(0,F.jsx)(K,{label:`Generic webhook URL`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`https://…`,value:l(`webhook`)?.url||``,onChange:e=>u(`webhook`,e.target.value?{url:e.target.value}:null)})}),(0,F.jsx)(`div`,{className:`col-span-2`,children:(0,F.jsx)(yV,{value:l(`email`)?.to||``,onChange:e=>u(`email`,e.trim()?{to:e}:null)})})]}),o&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] mt-3`,children:o}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 mt-4`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:t,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:d,children:`Save SLO`})]})]})}var zV={operational:{label:`Operational`,color:`#0ca30c`,kind:`good`},degraded:{label:`Degraded`,color:`#e6a100`,kind:`warn`},partial_outage:{label:`Partial outage`,color:`#ec835a`,kind:`serious`},major_outage:{label:`Major outage`,color:`#d03b3b`,kind:`crit`},no_data:{label:`No data`,color:`#3a3a48`,kind:`neutral`}},BV=[`investigating`,`identified`,`monitoring`,`resolved`],VV=e=>e[0].toUpperCase()+e.slice(1).replace(`_`,` `);function HV(){let e=I(),[t,n]=zn(),{data:r,error:i,reload:a}=P(`/api/status-pages`,[e.tick]),[o,s]=(0,v.useState)(null);if(i)return(0,F.jsx)(W,{error:i});if(!r)return(0,F.jsx)(U,{});let c=Number(t.get(`id`))||r[0]?.id||null,l=e=>{let r=new URLSearchParams(t);r.set(`id`,String(e)),n(r,{replace:!0})};return(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,F.jsx)(Ma,{icon:(0,F.jsx)(yi,{size:18,className:`text-brand`}),title:`Status pages`,sub:`Public pages for your customers. Each component's status comes from its live traffic, and incidents can be posted by hand or opened automatically during an outage.`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s({autoIncidents:!0,published:!0,components:[]}),children:[(0,F.jsx)(_i,{size:14}),`New status page`]})}),r.length===0?(0,F.jsx)(H,{children:(0,F.jsx)(Na,{title:`No status pages yet`,icon:(0,F.jsx)(yi,{size:22}),children:`Create a page, map components like "Checkout" or "API" to your applications and routes, and share the public link.`})}):(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @5xl:grid-cols-[300px_1fr] gap-3 items-start`,children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,F.jsxs)(`button`,{onClick:()=>l(e.id),className:`card text-left px-3.5 py-3 flex flex-col gap-1.5 ${c===e.id?`!border-[#5a2340]`:`hover:border-line2`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:e.title}),(0,F.jsx)(G,{kind:zV[e.overall].kind,children:zV[e.overall].label})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] mono`,children:[`/status/`,e.slug,!e.published&&` · unpublished`]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[e.components.length,` component`,e.components.length===1?``:`s`,e.activeIncidents?` · ${e.activeIncidents} active incident${e.activeIncidents>1?`s`:``}`:``]})]},e.id))}),c&&(0,F.jsx)(UV,{id:c,onEdit:s,onDeleted:()=>{let e=new URLSearchParams(t);e.delete(`id`),n(e),a()},onChanged:a})]}),o&&(0,F.jsx)(KV,{page:o,onClose:()=>s(null),onSaved:e=>{s(null),a(),l(e)}})]})}function UV({id:e,onEdit:t,onDeleted:n,onChanged:r}){let i=I(),{data:a,error:o,reload:s}=P(`/api/status-pages/${e}`,[e,i.tick]),[c,l]=(0,v.useState)(null);if(o)return(0,F.jsx)(W,{error:o});if(!a)return(0,F.jsx)(U,{});let u=a.page,d=`${window.location.origin}/status/${u.slug}`,f=()=>{s(),r()},p=a.incidents.filter(e=>e.status!==`resolved`),m=a.incidents.filter(e=>e.status===`resolved`),h=e=>u.components.find(t=>t.id===e)?.name||`removed component`;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[(0,F.jsxs)(H,{title:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[u.title,(0,F.jsx)(G,{kind:zV[a.overall].kind,children:zV[a.overall].label})]}),right:(0,F.jsxs)(`div`,{className:`flex gap-1`,children:[(0,F.jsxs)(`a`,{className:`btn h-7`,href:`/status/${u.slug}`,target:`_blank`,rel:`noreferrer`,children:[(0,F.jsx)(Vr,{size:13}),`Open public page`]}),(0,F.jsx)(Ba,{text:d,label:`Copy link`,className:`btn h-7`}),(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>t(u),children:[(0,F.jsx)(pi,{size:13}),`Edit`]}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,title:`Delete`,onClick:async()=>{window.confirm(`Delete status page "${u.title}" and its incidents?`)&&(await N(`/api/status-pages/${u.id}`,{method:`DELETE`}),n())},children:(0,F.jsx)(Ri,{size:13})})]}),children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 text-[12.5px] text-ink2`,children:[(0,F.jsxs)(`span`,{children:[u.published?`Public at `:`Unpublished · `,(0,F.jsx)(`span`,{className:`mono`,children:d})]}),(0,F.jsxs)(`span`,{children:[`Automatic incidents: `,(0,F.jsx)(`b`,{children:u.autoIncidents?`on`:`off`})]})]}),u.description&&(0,F.jsx)(`div`,{className:`text-ink2 mt-2`,children:u.description})]}),(0,F.jsx)(H,{title:`Components`,sub:`status from the last 10 minutes of traffic; bars show the last 90 days`,pad:!1,children:a.components.length===0?(0,F.jsx)(Na,{title:`No components`,children:`Edit the page to map components to applications and routes.`}):a.components.map(e=>(0,F.jsxs)(`div`,{className:`px-3.5 py-3 border-b border-[#1d1d26] last:border-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium`,children:e.name}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px] mono truncate`,children:[e.service,e.operation?` · ${e.operation}`:``,e.latencyMs?` · degraded above p95 ${e.latencyMs}ms`:``]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4 shrink-0 text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-mute tabular-nums`,children:e.live.requests?`${e.live.requests} req · ${ba(e.live.errorRate)} 5xx · p95 ${B(e.live.p95)}`:`no recent traffic`}),(0,F.jsx)(G,{kind:zV[e.status].kind,children:zV[e.status].label})]})]}),(0,F.jsx)(`div`,{className:`flex gap-[2px] h-6 mt-2`,children:e.days.map(e=>(0,F.jsx)(`span`,{className:`flex-1 rounded-[2px]`,style:{background:zV[e.status].color},title:`${new Date(e.day).toISOString().slice(0,10)}: ${zV[e.status].label}${e.requests?` · ${e.requests} req, ${ba(e.errorRate)} errors`:``}`},e.day))}),(0,F.jsxs)(`div`,{className:`flex justify-between text-mute text-[11px] mt-1`,children:[(0,F.jsx)(`span`,{children:`90 days ago`}),(0,F.jsx)(`span`,{children:e.uptime==null?``:`${e.uptime}% uptime`}),(0,F.jsx)(`span`,{children:`today`})]})]},e.id))}),(0,F.jsx)(H,{title:`Incidents`,right:(0,F.jsxs)(`button`,{className:`btn btn-primary h-7`,disabled:!u.components.length,onClick:()=>l({impact:`minor`,status:`investigating`,components:[]}),children:[(0,F.jsx)(oi,{size:13}),`Post incident`]}),pad:!1,children:a.incidents.length===0?(0,F.jsx)(Na,{title:`No incidents`,children:`Post one when something is wrong, or let automatic incidents handle outages.`}):(0,F.jsx)(`div`,{children:[...p,...m.slice(0,10)].map(e=>(0,F.jsx)(WV,{inc:e,name:h,onChanged:f},e.id))})}),c&&(0,F.jsx)(GV,{page:u,inc:c,onClose:()=>l(null),onSaved:()=>{l(null),f()}})]})}function WV({inc:e,name:t,onChanged:n}){let[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(e.status===`resolved`?`resolved`:e.status),s=e.status!==`resolved`,c=async()=>{await N(`/api/incidents/${e.id}`,{method:`PATCH`,json:{status:a,message:r}}),i(``),n()},l=e.impact===`critical`?`crit`:e.impact===`major`?`serious`:`warn`;return(0,F.jsxs)(`div`,{className:`px-3.5 py-3 border-b border-[#1d1d26] last:border-0 flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:e.title}),(0,F.jsx)(G,{kind:s?l:`good`,children:s?`${e.impact} · ${e.status}`:`resolved`}),e.auto&&(0,F.jsx)(`span`,{className:`pill`,children:`automatic`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 text-mute text-[11.5px]`,children:[Ca(e.created,!0),e.resolvedAt&&` → ${Ca(e.resolvedAt,!0)}`,(0,F.jsx)(`button`,{className:`btn btn-ghost h-6 px-1.5`,title:`Delete`,onClick:async()=>{window.confirm(`Delete this incident? It disappears from the public page.`)&&(await N(`/api/incidents/${e.id}`,{method:`DELETE`}),n())},children:(0,F.jsx)(Ki,{size:12})})]})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[11.5px]`,children:[`Affects: `,e.components.map(t).join(`, `)||`—`]}),(0,F.jsx)(`div`,{className:`flex flex-col gap-1 border-l border-line2 pl-3`,children:[...e.updates].reverse().map((e,t)=>(0,F.jsxs)(`div`,{className:`text-[12.5px]`,children:[(0,F.jsx)(`b`,{className:`capitalize`,children:e.status}),` `,(0,F.jsxs)(`span`,{className:`text-ink2`,children:[`— `,e.text]}),` `,(0,F.jsx)(`span`,{className:`text-mute text-[11px]`,children:Sa(e.ts)})]},t))}),s&&(0,F.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,F.jsx)(`select`,{className:`select`,value:a,onChange:e=>o(e.target.value),children:BV.map(e=>(0,F.jsx)(`option`,{value:e,children:VV(e)},e))}),(0,F.jsx)(`input`,{className:`input flex-1`,placeholder:a===`resolved`?`What fixed it (optional)`:`Post an update for customers`,value:r,onChange:e=>i(e.target.value)}),(0,F.jsx)(`button`,{className:`btn`,disabled:!r&&a===e.status,onClick:c,children:a===`resolved`?`Resolve`:`Post update`})]})]})}function GV({page:e,inc:t,onClose:n,onSaved:r}){let[i,a]=(0,v.useState)({title:t.title||``,impact:t.impact||`minor`,status:t.status||`investigating`,components:t.components||[],message:``}),[o,s]=(0,v.useState)(``),c=e=>a({...i,components:i.components.includes(e)?i.components.filter(t=>t!==e):[...i.components,e]});return(0,F.jsx)(qa,{open:!0,onClose:n,title:`Post incident`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,F.jsx)(K,{label:`Title`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,placeholder:`Checkout errors for some customers`,value:i.title,onChange:e=>a({...i,title:e.target.value})})}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Impact`,hint:`minor = degraded, major = partial outage, critical = major outage`,children:(0,F.jsx)(Va,{value:i.impact,onChange:e=>a({...i,impact:e}),options:[{id:`minor`,label:`Minor`},{id:`major`,label:`Major`},{id:`critical`,label:`Critical`}]})}),(0,F.jsx)(K,{label:`Status`,children:(0,F.jsx)(`select`,{className:`select`,value:i.status,onChange:e=>a({...i,status:e.target.value}),children:BV.filter(e=>e!==`resolved`).map(e=>(0,F.jsx)(`option`,{value:e,children:VV(e)},e))})})]}),(0,F.jsx)(K,{label:`Affected components`,children:(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.components.map(e=>(0,F.jsxs)(`label`,{className:`pill cursor-pointer !py-1 ${i.components.includes(e.id)?`!border-[#ff3d7f] !text-white`:``}`,children:[(0,F.jsx)(`input`,{type:`checkbox`,className:`hidden`,checked:i.components.includes(e.id),onChange:()=>c(e.id)}),e.name]},e.id))})}),(0,F.jsx)(K,{label:`First update (shown publicly)`,children:(0,F.jsx)(`textarea`,{className:`input`,rows:3,placeholder:`We are investigating elevated error rates on checkout.`,value:i.message,onChange:e=>a({...i,message:e.target.value})})}),o&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a]`,children:o}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:n,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,disabled:!i.title||!i.components.length,onClick:async()=>{try{await N(`/api/status-pages/${e.id}/incidents`,{method:`POST`,json:i}),r()}catch(e){s(e.message)}},children:`Post incident`})]})]})})}function KV({page:e,onClose:t,onSaved:n}){let r=I(),[i,a]=(0,v.useState)({...e,components:e.components??[]}),[o,s]=(0,v.useState)(``),c=i.components||[],l=(e,t)=>a({...i,components:c.map((n,r)=>r===e?{...n,...t}:n)});return(0,F.jsxs)(qa,{open:!0,onClose:t,title:i.id?`Edit status page`:`New status page`,wide:!0,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(K,{label:`Title`,children:(0,F.jsx)(`input`,{className:`input`,autoFocus:!0,placeholder:`Acme Status`,value:i.title||``,onChange:e=>a({...i,title:e.target.value})})}),(0,F.jsx)(K,{label:`URL slug`,hint:`public at /status/${i.slug||(i.title||``).toLowerCase().replace(/[^\w]+/g,`-`)||`…`}`,children:(0,F.jsx)(`input`,{className:`input mono`,placeholder:`from the title`,value:i.slug||``,onChange:e=>a({...i,slug:e.target.value})})}),(0,F.jsx)(`div`,{className:`col-span-2`,children:(0,F.jsx)(K,{label:`Description (optional)`,children:(0,F.jsx)(`input`,{className:`input`,placeholder:`Live status of Acme's APIs and checkout`,value:i.description||``,onChange:e=>a({...i,description:e.target.value||null})})})}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:i.published!==!1,onChange:e=>a({...i,published:e.target.checked})}),`Published (anyone with the link can view it)`]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-[12.5px]`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:i.autoIncidents!==!1,onChange:e=>a({...i,autoIncidents:e.target.checked})}),`Open and resolve incidents automatically on outages`]})]}),(0,F.jsxs)(`div`,{className:`mt-4 pt-4 border-t border-line flex flex-col gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsx)(`span`,{className:`text-[12px] font-semibold`,children:`Components`}),(0,F.jsxs)(`button`,{className:`btn h-7`,onClick:()=>a({...i,components:[...c,{id:``,name:``,service:r.meta?.services[0]?.id||``,operation:null,latencyMs:null}]}),children:[(0,F.jsx)(_i,{size:13}),`Add component`]})]}),(0,F.jsx)(`div`,{className:`text-mute text-[11.5px]`,children:`Customers only see the component name and its status. The application and route stay private.`}),c.length===0&&(0,F.jsx)(`div`,{className:`text-mute text-[12.5px] py-2`,children:`No components yet.`}),c.map((e,t)=>(0,F.jsxs)(`div`,{className:`grid grid-cols-[1.2fr_1fr_1.2fr_110px_auto] gap-2 items-center`,children:[(0,F.jsx)(`input`,{className:`input`,placeholder:`Name, e.g. Checkout`,value:e.name,onChange:e=>l(t,{name:e.target.value})}),(0,F.jsxs)(`select`,{className:`select`,value:e.service,onChange:e=>l(t,{service:e.target.value}),children:[(0,F.jsx)(`option`,{value:``,children:`Application…`}),r.meta?.services.map(e=>(0,F.jsx)(`option`,{children:e.id},e.id))]}),(0,F.jsx)(`input`,{className:`input mono`,placeholder:`Route (optional)`,value:e.operation||``,onChange:e=>l(t,{operation:e.target.value||null})}),(0,F.jsx)(`input`,{className:`input`,type:`number`,placeholder:`p95 ms`,title:`Degraded when p95 is above this (optional)`,value:e.latencyMs??``,onChange:e=>l(t,{latencyMs:e.target.value===``?null:Number(e.target.value)})}),(0,F.jsx)(`button`,{className:`btn btn-ghost h-7 px-2`,onClick:()=>a({...i,components:c.filter((e,n)=>n!==t)}),children:(0,F.jsx)(Ri,{size:13})})]},t))]}),o&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] mt-3`,children:o}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2 mt-4`,children:[(0,F.jsx)(`button`,{className:`btn`,onClick:t,children:`Cancel`}),(0,F.jsx)(`button`,{className:`btn btn-primary`,onClick:async()=>{try{n((i.id?await N(`/api/status-pages/${i.id}`,{method:`PUT`,json:i}):await N(`/api/status-pages`,{method:`POST`,json:i})).id)}catch(e){s(e.message)}},children:`Save page`})]})]})}var qV={good:Mr,warn:jr,bad:di,neutral:Nr};function JV(e){if(!e)return``;let t=Date.now()-e;if(t<6e4)return`just now`;let n=Math.round(t/6e4);if(n<60)return`${n} minute${n===1?``:`s`} ago`;let r=Math.round(t/36e5);if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.round(t/864e5);return i===1?`yesterday`:`${i} days ago`}function YV({n:e,title:t,right:n,children:r,className:i=``}){return(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-3.5 ${i}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`h2`,{className:`text-[16px] font-semibold tracking-tight`,children:t}),e!=null&&e>0&&(0,F.jsx)(`span`,{className:`text-[11px] font-semibold px-2 py-0.5 rounded-full bg-[#22222d] text-ink2`,children:e}),(0,F.jsx)(`div`,{className:`flex-1`}),n]}),r]})}function XV({question:e,label:t=`Ask Obzeri`,className:n=`btn btn-ghost h-7 px-2 text-[12px]`}){return(0,F.jsxs)(`button`,{className:n,title:`Ask Obzeri: ${e}`,onClick:t=>{t.stopPropagation(),ar(e)},children:[(0,F.jsx)(Fi,{size:13,className:`text-brand`}),t]})}function ZV({title:e,children:t}){return(0,F.jsxs)(`div`,{className:`tone-good rounded-xl px-4 py-5 flex items-center gap-3`,style:{background:`var(--tone-bg)`},children:[(0,F.jsx)(Mr,{size:22,style:{color:`var(--tone)`},className:`shrink-0`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-[14px]`,children:e}),t&&(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] mt-0.5`,children:t})]})]})}var QV={"15m":`the last 15 minutes`,"1h":`the last hour`,"6h":`the last 6 hours`,"24h":`the last 24 hours`,"7d":`the last 7 days`,"30d":`the last 30 days`,custom:`the selected time`},$V={healthy:{tone:`good`,Icon:Mr},attention:{tone:`warn`,Icon:jr},broken:{tone:`bad`,Icon:di},idle:{tone:`neutral`,Icon:li},no_data:{tone:`neutral`,Icon:li}},eH={secret:Ai,silent:vi,error:xr,endpoint:wi,jobs:Gi,alert:gr,release:xi,new_errors:xr,traffic:Bi,speed:Wr,failures:ur};function tH(){let e=I(),{data:t,error:n}=P(`/api/simple${e.q()}`,[e.tick]);return n?(0,F.jsx)(W,{error:n}):t?t.health===`no_data`?(0,F.jsx)(Wz,{simple:!0}):(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsx)(nH,{d:t}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-5 gap-5 items-start`,children:[(0,F.jsxs)(`div`,{className:`@4xl:col-span-3 flex flex-col gap-5`,children:[(0,F.jsx)(oH,{items:t.broke}),(0,F.jsx)(sH,{items:t.changed,basis:t.usualBasis})]}),(0,F.jsxs)(`div`,{className:`@4xl:col-span-2 flex flex-col gap-5`,children:[(0,F.jsx)(lH,{items:t.todo}),(0,F.jsx)(dH,{suggestions:t.suggestions})]})]})]}):(0,F.jsx)(U,{})}function nH({d:e}){let t=I(),n=$V[e.health];return(0,F.jsxs)(`section`,{className:`card tone-${n.tone} p-6 grid grid-cols-1 @4xl:grid-cols-[1fr_420px] gap-6`,style:{borderColor:`var(--tone-line)`,background:`linear-gradient(135deg, var(--tone-bg), transparent 55%), var(--color-panel)`},children:[(0,F.jsxs)(`div`,{className:`flex flex-col gap-4 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[11.5px] uppercase tracking-wider font-semibold text-mute`,children:`Is my app healthy?`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,F.jsx)(`div`,{className:`w-14 h-14 rounded-full flex items-center justify-center shrink-0 ${e.health===`healthy`?`health-orb`:``}`,style:{background:`var(--tone-bg)`,border:`1px solid var(--tone-line)`},children:(0,F.jsx)(n.Icon,{size:28,style:{color:`var(--tone)`}})}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight leading-tight`,children:e.headline}),(0,F.jsx)(`p`,{className:`text-ink2 text-[14px] mt-1 leading-relaxed`,children:e.summary})]})]}),(0,F.jsx)(iH,{points:e.timeline,bucketMs:e.bucketMs,label:QV[t.range]||`this period`})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 @2xl:@max-4xl:grid-cols-4 gap-3 content-start`,children:e.vitals.map(e=>(0,F.jsx)(rH,{v:e},e.id))})]})}function rH({v:e}){let t=qV[e.tone];return(0,F.jsxs)(`div`,{className:`tone-${e.tone} rounded-xl border border-line bg-[#111118] px-3.5 py-3 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] text-ink2 font-medium`,children:[(0,F.jsx)(t,{size:13,style:{color:`var(--tone)`}}),e.label]}),(0,F.jsx)(`div`,{className:`text-[22px] font-semibold tracking-tight mt-1 tabular-nums`,style:{color:e.tone===`bad`||e.tone===`warn`?`var(--tone)`:void 0},children:e.value}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute leading-snug mt-0.5`,children:e.note}),e.usual&&(0,F.jsx)(`div`,{className:`text-[11.5px] text-ink2 mt-1`,children:e.usual})]})}function iH({points:e,bucketMs:t,label:n}){if(!e.length)return null;let r=Math.max(1,...e.map(e=>e.count)),i=e=>e.count?e.failed/e.count>=.05?`#e05252`:e.failed/e.count>=.01?`#e8a92a`:`#36b56a`:`#2a2a35`,a=e.length*t;return(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`flex items-end gap-[2px] h-[54px]`,children:e.map(e=>(0,F.jsx)(`div`,{className:`flex-1 rounded-[3px] min-w-[2px] hover:opacity-80`,style:{height:`${Math.max(8,e.count/r*100)}%`,background:i(e)},title:`${Ca(e.t,a>864e5)} · ${V(e.count)} requests${e.failed?` · ${V(e.failed)} failed`:``}`},e.t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-x-4 gap-y-1 text-[11px] text-mute mt-1.5`,children:[(0,F.jsx)(`span`,{className:`whitespace-nowrap`,children:n.charAt(0).toUpperCase()+n.slice(1)}),(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 whitespace-nowrap`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`i`,{className:`w-2 h-2 rounded-sm inline-block bg-[#36b56a]`}),`fine`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`i`,{className:`w-2 h-2 rounded-sm inline-block bg-[#e8a92a]`}),`some failures`]}),(0,F.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`i`,{className:`w-2 h-2 rounded-sm inline-block bg-[#e05252]`}),`many failures`]}),(0,F.jsx)(`span`,{children:`now`})]})]})]})}function aH({f:e,timeline:t}){let n=ht(),r=Qn(),i=eH[e.kind]||xr;return(0,F.jsxs)(`div`,{className:`tone-${e.tone} group flex items-start gap-3 rounded-xl px-3.5 py-3 border border-transparent ${e.link?`cursor-pointer hover:bg-[#181821] hover:border-line`:``}`,onClick:()=>e.link&&n(r(e.link)),children:[(0,F.jsx)(`div`,{className:`${t?`w-8 h-8`:`w-9 h-9`} rounded-lg flex items-center justify-center shrink-0`,style:{background:`var(--tone-bg)`},children:(0,F.jsx)(i,{size:t?15:17,style:{color:`var(--tone)`}})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[13.5px]`,children:e.title}),e.isNew&&(0,F.jsx)(`span`,{className:`text-[10.5px] font-semibold px-1.5 py-px rounded-full`,style:{color:`var(--tone)`,background:`var(--tone-bg)`},children:`NEW`})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] mt-0.5 leading-relaxed break-words`,children:e.detail}),e.ts&&(0,F.jsx)(`div`,{className:`text-mute text-[11.5px] mt-1`,children:t?JV(e.ts):`last seen ${JV(e.ts)}`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 opacity-70 group-hover:opacity-100`,children:[e.ask&&(0,F.jsx)(XV,{question:e.ask,label:`Ask`}),e.link&&(0,F.jsx)(Or,{size:16,className:`text-mute`})]})]})}function oH({items:e}){let[t,n]=(0,v.useState)(!1),r=t?e:e.slice(0,5);return(0,F.jsx)(YV,{title:`What broke?`,n:e.length,children:e.length===0?(0,F.jsx)(ZV,{title:`Nothing is broken`,children:`No crashes, failing pages, leaks or firing alerts in this period.`}):(0,F.jsxs)(`div`,{className:`flex flex-col -mx-1.5`,children:[r.map(e=>(0,F.jsx)(aH,{f:e},e.id)),e.length>5&&(0,F.jsx)(`button`,{className:`btn btn-ghost self-start ml-1.5 mt-1`,onClick:()=>n(!t),children:t?`Show less`:`Show ${e.length-5} more`})]})})}function sH({items:e,basis:t}){return(0,F.jsx)(YV,{title:`What changed?`,n:e.length,right:t?(0,F.jsxs)(`span`,{className:`text-[11.5px] text-mute`,title:`Compared with ${t}`,children:[`vs a normal `,t.includes(`week`)?`week`:`day`]}):null,children:e.length===0?(0,F.jsxs)(`div`,{className:`text-ink2 text-[13px] px-1`,children:[`Nothing new: no deploys, no new kinds of errors, and traffic and speed look `,t?`like they usually do at this time`:`steady`,`.`]}):(0,F.jsx)(`div`,{className:`flex flex-col -mx-1.5`,children:e.map(e=>(0,F.jsx)(aH,{f:e,timeline:!0},e.id))})})}var cH={now:{label:`Do now`,tone:`bad`},soon:{label:`Soon`,tone:`warn`},later:{label:`When you can`,tone:`neutral`}};function lH({items:e}){let[t,n]=(0,v.useState)(e[0]?.id??null);return(0,F.jsx)(YV,{title:`What should I do?`,n:e.length,children:e.length===0?(0,F.jsx)(ZV,{title:`Nothing to do right now`,children:`Go build something. We will tell you when that changes.`}):(0,F.jsx)(`ol`,{className:`flex flex-col gap-2`,children:e.map((e,r)=>(0,F.jsx)(uH,{t:e,n:r+1,open:t===e.id,onToggle:()=>n(t===e.id?null:e.id)},e.id))})})}function uH({t:e,n:t,open:n,onToggle:r}){let i=ht(),a=Qn(),o=cH[e.urgency];return(0,F.jsxs)(`li`,{className:`tone-${o.tone} rounded-xl border bg-[#111118] ${n?`border-line2`:`border-line`}`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-start gap-3 px-3.5 py-3 text-left`,onClick:r,"aria-expanded":n,children:[(0,F.jsx)(`span`,{className:`w-6 h-6 rounded-full flex items-center justify-center text-[12px] font-semibold shrink-0 mt-px`,style:{background:`var(--tone-bg)`,color:`var(--tone)`},children:t}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[13.5px]`,children:e.title}),(0,F.jsx)(`span`,{className:`text-[10.5px] font-semibold uppercase tracking-wide`,style:{color:`var(--tone)`},children:o.label})]}),!n&&(0,F.jsx)(`span`,{className:`block text-mute text-[12px] truncate mt-0.5`,children:e.why})]}),n?(0,F.jsx)(Er,{size:15,className:`text-mute mt-1`}):(0,F.jsx)(Or,{size:15,className:`text-mute mt-1`})]}),n&&(0,F.jsxs)(`div`,{className:`px-3.5 pb-3.5 pl-[50px] flex flex-col gap-3`,children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[12.5px] leading-relaxed`,children:e.why}),e.steps.length>0&&(0,F.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.steps.map((e,t)=>(0,F.jsxs)(`li`,{className:`flex gap-2 text-[12.5px]`,children:[(0,F.jsxs)(`span`,{className:`text-mute tabular-nums`,children:[t+1,`.`]}),(0,F.jsx)(`span`,{children:e})]},t))}),(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.executionId&&(0,F.jsx)(Ba,{className:`btn btn-primary h-8`,label:`Copy fix prompt`,text:async()=>(await N(`/api/executions/${e.executionId}/prompt`)).prompt}),e.link&&(0,F.jsxs)(`button`,{className:`btn h-8 ${e.executionId?``:`btn-primary`}`,onClick:()=>i(a(e.link)),children:[e.linkLabel||`Open`,(0,F.jsx)(Or,{size:13})]}),e.ask&&(0,F.jsx)(XV,{question:e.ask,className:`btn h-8`})]}),e.executionId&&(0,F.jsxs)(`div`,{className:`text-[11.5px] text-mute flex items-center gap-1.5`,children:[(0,F.jsx)(Wi,{size:12}),`The prompt has the error, the code around it and what happened, ready for Cursor, Claude Code or Copilot.`]})]})]})}function dH({suggestions:e}){let[t,n]=(0,v.useState)(``);return(0,F.jsxs)(YV,{title:`Ask Obzeri`,children:[(0,F.jsxs)(`form`,{className:`relative`,onSubmit:e=>{e.preventDefault(),t.trim()&&(ar(t.trim()),n(``))},children:[(0,F.jsx)(Fi,{size:15,className:`absolute left-3 top-1/2 -translate-y-1/2 text-brand`}),(0,F.jsx)(`input`,{dir:`auto`,className:`input w-full h-11 pl-9 pr-11 text-[13.5px] rounded-xl`,placeholder:`Ask anything about your app…`,value:t,onChange:e=>n(e.target.value)}),(0,F.jsx)(`button`,{className:`absolute right-1.5 top-1/2 -translate-y-1/2 btn btn-primary h-8 w-8 !p-0 justify-center rounded-lg`,disabled:!t.trim(),title:`Ask`,children:(0,F.jsx)(mr,{size:15})})]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,F.jsx)(`button`,{className:`text-left rounded-full border border-line hover:border-line2 hover:bg-panel2 px-3 py-1.5 text-[12px] text-ink2 hover:text-ink max-w-full truncate`,title:e,onClick:()=>ar(e),children:e},e))}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`Plain answers from your app's own data, in any language.`})]})}function fH(){let e=I(),{data:t,error:n,setData:r}=P(`/api/simple/alerts`,[e.tick]);if((0,v.useEffect)(()=>{N(`/api/alerts/events/read`,{method:`POST`}).then(()=>e.refresh()).catch(()=>{})},[]),n)return(0,F.jsx)(W,{error:n});if(!t)return(0,F.jsx)(U,{});let i=async e=>r(await N(`/api/simple/alerts`,{method:`PUT`,json:e}));return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(gr,{size:22,className:`text-brand`}),`Alerts`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Hear about problems before your users tell you.`})]}),(0,F.jsx)(pH,{firing:t.firing}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-5 gap-5 items-start`,children:[(0,F.jsxs)(`div`,{className:`@4xl:col-span-3 flex flex-col gap-5`,children:[(0,F.jsx)(YV,{title:`Tell me when…`,children:(0,F.jsx)(`div`,{className:`flex flex-col divide-y divide-[#1f1f29]`,children:t.presets.map(e=>(0,F.jsx)(hH,{p:e,onChange:t=>i({presets:{[e.id]:t}})},e.id))})}),(0,F.jsx)(_H,{events:t.events})]}),(0,F.jsx)(`div`,{className:`@4xl:col-span-2`,children:(0,F.jsx)(gH,{data:t,onSave:e=>i({channels:e})})})]})]})}function pH({firing:e}){let t=I(),n=ht(),r=Qn(),i=ir(),a=t.meta?.openSecrets||0;return!e.length&&!a?(0,F.jsx)(ZV,{title:`All quiet right now`,children:`No alert is firing. The switches below decide what wakes you up.`}):(0,F.jsxs)(`section`,{className:`card tone-bad p-5 flex flex-col gap-2`,style:{borderColor:`var(--tone-line)`,background:`linear-gradient(135deg, var(--tone-bg), transparent 60%), var(--color-panel)`},children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold text-[15px]`,children:[(0,F.jsx)(hr,{size:17,style:{color:`var(--tone)`}}),`Happening right now`]}),a>0&&(0,F.jsxs)(`button`,{className:`flex items-center gap-3 text-left rounded-lg px-2 py-2 hover:bg-[#1c1c25]`,onClick:()=>n(r(`/secrets`)),children:[(0,F.jsx)(Ai,{size:16,style:{color:`var(--tone)`}}),(0,F.jsxs)(`span`,{className:`flex-1 text-[13.5px]`,children:[a===1?`A secret is`:`${a} secrets are`,` being written to your logs`]}),(0,F.jsx)(Or,{size:15,className:`text-mute`})]}),e.map(e=>(0,F.jsxs)(`button`,{className:`flex items-center gap-3 text-left rounded-lg px-2 py-2 hover:bg-[#1c1c25]`,onClick:()=>i(`/alerts?rule=${e.id}`),children:[(0,F.jsx)(gr,{size:16,style:{color:`var(--tone)`}}),(0,F.jsx)(`span`,{className:`flex-1 text-[13.5px]`,children:e.name}),e.since&&(0,F.jsxs)(`span`,{className:`text-mute text-[12px]`,children:[`since `,JV(e.since)]}),(0,F.jsx)(Or,{size:15,className:`text-mute`})]},e.id))]})}function mH({on:e,onChange:t,label:n}){return(0,F.jsx)(`button`,{role:`switch`,"aria-checked":e,"aria-label":n,onClick:()=>t(!e),className:`relative w-[42px] h-[24px] rounded-full shrink-0 transition-colors`,style:{background:e?`linear-gradient(120deg, #ff3d7f, #a855f7)`:`#2c2c38`},children:(0,F.jsx)(`span`,{className:`absolute top-[3px] w-[18px] h-[18px] rounded-full bg-white shadow transition-[left]`,style:{left:e?21:3}})})}function hH({p:e,onChange:t}){let[n,r]=(0,v.useState)(!1);return(0,F.jsxs)(`div`,{className:`flex items-center gap-4 py-3.5`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,F.jsx)(`span`,{className:`font-medium text-[14px]`,children:e.label}),e.firing&&(0,F.jsx)(`span`,{className:`tone-bad text-[10.5px] font-semibold px-1.5 py-px rounded-full`,style:{color:`var(--tone)`,background:`var(--tone-bg)`},children:`FIRING`})]}),(0,F.jsxs)(`div`,{className:`text-mute text-[12.5px] mt-0.5`,children:[e.description,e.lastFired?` · last time ${JV(e.lastFired)}`:``]})]}),(0,F.jsx)(mH,{on:e.enabled,label:e.label,onChange:async e=>{r(!0);try{await t(e)}finally{r(!1)}}}),n&&(0,F.jsx)(`span`,{className:`sr-only`,children:`saving`})]})}function gH({data:e,onSave:t}){let n=ir(),[r,i]=(0,v.useState)(e.channels.email),[a,o]=(0,v.useState)(e.channels.slack),[s,c]=(0,v.useState)(null),l=r!==e.channels.email||a!==e.channels.slack,u=!!(e.channels.email||e.channels.slack);return(0,F.jsxs)(YV,{title:`Where should we tell you?`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[13px]`,children:[(0,F.jsx)(ci,{size:16,className:`text-mute`}),(0,F.jsx)(`span`,{className:`flex-1`,children:`In this dashboard`}),(0,F.jsx)(`span`,{className:`text-mute text-[12px]`,children:`always on`})]}),(0,F.jsxs)(`form`,{className:`flex flex-col gap-3.5`,onSubmit:async e=>{e.preventDefault();try{await t({email:r,slack:a}),c({ok:!0,text:`Saved.`})}catch(e){c({ok:!1,text:e.message})}},children:[(0,F.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,F.jsx)(ai,{size:15,className:`text-mute`}),`Email`]}),(0,F.jsx)(`input`,{className:`input h-9`,type:`text`,placeholder:`you@example.com`,value:r,onChange:e=>i(e.target.value),disabled:!e.emailReady&&!r}),!e.emailReady&&(0,F.jsxs)(`span`,{className:`text-[11.5px] text-mute`,children:[`Email needs a mail server first. `,(0,F.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>n(`/integrations/email`),children:`Set one up`})]})]}),(0,F.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,F.jsx)(Mi,{size:15,className:`text-mute`}),`Slack`]}),(0,F.jsx)(`input`,{className:`input h-9`,type:`url`,placeholder:`https://hooks.slack.com/services/…`,value:a,onChange:e=>o(e.target.value)}),(0,F.jsxs)(`a`,{className:`text-[11.5px] link inline-flex items-center gap-1 self-start`,href:`https://api.slack.com/messaging/webhooks`,target:`_blank`,rel:`noreferrer`,children:[`How to get a Slack webhook`,(0,F.jsx)(Vr,{size:11})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`button`,{className:`btn btn-primary h-9`,disabled:!l,children:`Save`}),(0,F.jsxs)(`button`,{type:`button`,className:`btn h-9`,disabled:!u||l,title:l?`Save first`:void 0,onClick:async()=>{c(null);try{let e=(await N(`/api/simple/alerts/test`,{method:`POST`})).deliveries.filter(e=>e.type!==`inapp`&&!e.ok);c(e.length?{ok:!1,text:`Could not reach ${e.map(e=>`${e.type}${e.error?` (${e.error})`:``}`).join(`, `)}`}:{ok:!0,text:`Test sent. Check your inbox or Slack.`})}catch(e){c({ok:!1,text:e.message})}},children:[(0,F.jsx)(Di,{size:13}),`Send a test`]})]}),s&&(0,F.jsxs)(`div`,{className:`text-[12.5px] flex items-center gap-1.5 ${s.ok?`text-[#5ad17a]`:`text-[#ff8a8a]`}`,children:[s.ok&&(0,F.jsx)(Mr,{size:13}),s.text]})]}),(0,F.jsxs)(`div`,{className:`text-[11.5px] text-mute border-t border-line pt-3`,children:[`Webhooks, Discord, per-route rules and quiet hours are in `,(0,F.jsx)(`button`,{className:`link`,onClick:()=>n(`/alerts`),children:`Advanced → Alerts`}),`.`]})]})}function _H({events:e}){let[t,n]=(0,v.useState)(!1),r=t?e:e.slice(0,8);return(0,F.jsx)(YV,{title:`Recent alerts`,n:e.length,children:e.length===0?(0,F.jsx)(`div`,{className:`text-ink2 text-[13px]`,children:`Nothing has fired yet.`}):(0,F.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[r.map(e=>{let t=e.state===`firing`?`bad`:`good`;return(0,F.jsxs)(`div`,{className:`tone-${t} flex items-start gap-3 px-1 py-2`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full mt-[7px] shrink-0`,style:{background:`var(--tone)`}}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-[13px]`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:e.rule}),` `,(0,F.jsxs)(`span`,{className:`text-mute`,children:[`· `,e.state===`firing`?`went off`:`back to normal`,` `,JV(e.ts)]})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[12px] mt-0.5 break-words`,children:e.message})]})]},e.id)}),e.length>8&&(0,F.jsx)(`button`,{className:`btn btn-ghost self-start`,onClick:()=>n(!t),children:t?`Show less`:`Show ${e.length-8} more`})]})})}function vH(){let e=I(),t=ir(),n=P(`/api/overview${e.q()}`,[e.tick]),r=P(`/api/runtime${e.q()}`,[e.tick]),i=P(`/api/metrics${e.q()}`,[e.tick]);if(n.error)return(0,F.jsx)(W,{error:n.error});if(!n.data)return(0,F.jsx)(U,{});let a=n.data,o=a.kpis,s=o.usual&&o.usual.requests>=50?o.usual:null,c=ZR(a.series.points,a.band),l=QR(a.band),u=QV[e.range]||`this period`,d=[{key:`count`,label:`Requests`,color:WR[0],type:`bar`},...l?[{...l.calls,label:`Usual`}]:[]],f=[...l?[{...l.p95,label:`Normal range`}]:[],{key:`p95`,label:`Slowest 5%`,color:WR[1],type:`line`},{key:`avg`,label:`Average`,color:WR[2],type:`line`}],p=[{key:`s5xx`,label:`Failed (server errors)`,color:GR.crit,type:`bar`,stack:`e`},{key:`s4xx`,label:`Rejected (bad requests)`,color:GR.warn,type:`bar`,stack:`e`}],m=new Map;for(let e of r.data||[])for(let t of e.points){let e=m.get(t.t)||{t:t.t,cpu:null,mem:null};t.cpuUtil!=null&&(e.cpu=Math.max(e.cpu??0,t.cpuUtil)),t.memUtil!=null&&(e.mem=Math.max(e.mem??0,t.memUtil)),m.set(t.t,e)}let h=[...m.values()].sort((e,t)=>e.t-t.t),g=h[h.length-1],_=[{key:`cpu`,label:`CPU`,color:WR[0],type:`line`},{key:`mem`,label:`Memory`,color:WR[6],type:`line`}],v=Math.max(g?.cpu??0,g?.mem??0),y=s?.requests?o.requests/s.requests:null,b=s?.p95&&o.p95?o.p95/s.p95:null,x=o.requests>=20&&o.failureRate>=5?`bad`:o.failureRate>=1&&o.failed>=3?`warn`:`good`,S=[...new Set((i.data||[]).map(e=>e.name))];return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(wr,{size:22,className:`text-brand`}),`Metrics`]}),(0,F.jsxs)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:[`How your app did over `,u,s?`, next to what is normal for this time`:``,`.`]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-2 gap-5`,children:[(0,F.jsx)(yH,{title:`Traffic`,what:`How many requests your app handled.`,value:V(o.requests),unit:`requests`,status:y==null?{tone:`neutral`,text:o.rpm?`About ${V(o.rpm)} a minute`:`No requests yet`}:y>=1.5?{tone:`neutral`,text:`${y.toFixed(1)}× busier than usual`}:y<=.67?{tone:`warn`,text:`${Math.round((1-y)*100)}% quieter than usual`}:{tone:`good`,text:`About as busy as usual`},series:d,children:(0,F.jsx)(JR,{data:c,series:d,height:190,zoom:!1,fmt:e=>V(e)})}),(0,F.jsx)(yH,{title:`Speed`,what:`How long requests take. Lower is better; the slowest 5% is what unhappy users feel.`,value:B(o.p95),unit:`slowest 5%`,status:o.p95==null?{tone:`neutral`,text:`Nothing to time yet`}:b!=null&&b>=1.4?{tone:`warn`,text:`Slower than usual (normally ${B(s.p95)})`}:o.p95>=1500?{tone:`warn`,text:`On the slow side`}:{tone:`good`,text:s?.p95?`Normal (usually ${B(s.p95)})`:`Fast`},series:f,children:(0,F.jsx)(JR,{data:c,series:f,height:190,zoom:!1,fmt:e=>B(e),yFmt:e=>e>=1e3?`${+(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`})}),(0,F.jsx)(yH,{title:`Errors`,what:`Requests that failed because of your server (red), and requests your app rejected, like a wrong password or a missing page (yellow).`,value:ba(o.failureRate),unit:`failed`,status:{tone:x,text:o.failed?`${V(o.failed)} failed, ${V(o.clientErrors)} rejected`:`No server errors`},series:p,children:(0,F.jsx)(JR,{data:c,series:p,height:190,zoom:!1,fmt:e=>V(e)})}),(0,F.jsx)(yH,{title:`Server load`,what:`How much of its CPU and memory your app uses. Near 100% it slows down or restarts.`,value:g?`${Math.round(v)}%`:`—`,unit:`busiest`,status:g?v>=90?{tone:`bad`,text:`Close to the limit`}:v>=75?{tone:`warn`,text:`Busy`}:{tone:`good`,text:`Plenty of room`}:{tone:`neutral`,text:`No server stats yet`},series:_,children:r.data?(0,F.jsx)(JR,{data:h,series:_,height:190,zoom:!1,fmt:e=>`${Math.round(e)}%`,yDomain:[0,`auto`]}):(0,F.jsx)(U,{})})]}),S.length>0&&(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Your own numbers`}),(0,F.jsx)(`span`,{className:`text-mute text-[12.5px]`,children:`counters and gauges your code reports`})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 @lg:grid-cols-3 @5xl:grid-cols-4 gap-3`,children:S.slice(0,12).map(e=>{let n=(i.data||[]).filter(t=>t.name===e),r=n.reduce((e,t)=>e+(t.type===`counter`?t.count??0:0),0);return(0,F.jsxs)(`button`,{className:`text-left rounded-xl border border-line hover:border-line2 bg-[#111118] px-3.5 py-3 group`,onClick:()=>t(`/metrics`),children:[(0,F.jsx)(`div`,{className:`mono text-[11.5px] text-ink2 truncate`,children:e}),(0,F.jsx)(`div`,{className:`text-[20px] font-semibold mt-1 tabular-nums`,children:n[0]?.type===`counter`?V(r):V(n[0]?.avg)}),(0,F.jsxs)(`div`,{className:`text-[11px] text-mute flex items-center gap-1`,children:[n[0]?.type===`counter`?`total`:`average`,(0,F.jsx)(Or,{size:11,className:`opacity-0 group-hover:opacity-100`})]})]},e)})})]})]})}function yH({title:e,what:t,value:n,unit:r,status:i,series:a,children:o}){let s=qV[i.tone];return(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-3 min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:e}),(0,F.jsx)(`p`,{className:`text-mute text-[12.5px] mt-0.5 leading-snug`,children:t})]}),(0,F.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,F.jsx)(`div`,{className:`text-[24px] font-semibold tabular-nums leading-tight`,children:n}),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:r})]})]}),(0,F.jsxs)(`div`,{className:`tone-${i.tone} flex items-center gap-1.5 text-[12.5px] font-medium`,style:{color:`var(--tone)`},children:[(0,F.jsx)(s,{size:14}),i.text]}),o,(0,F.jsx)(qR,{series:a})]})}var bH=[{id:`all`,label:`Everything`,levels:``},{id:`problems`,label:`Problems only`,levels:`warn,error,fatal`},{id:`errors`,label:`Errors only`,levels:`error,fatal`}],xH={fatal:{word:`Error`,color:`#ff7a7a`,bg:`rgba(208,59,59,.14)`},error:{word:`Error`,color:`#ff7a7a`,bg:`rgba(208,59,59,.14)`},warn:{word:`Warning`,color:`#f5c04e`,bg:`rgba(250,178,25,.12)`},info:{word:`Info`,color:`#7fb2f0`,bg:`rgba(57,135,229,.12)`},debug:{word:`Debug`,color:`#9a9ab0`,bg:`rgba(130,130,154,.12)`},trace:{word:`Debug`,color:`#9a9ab0`,bg:`rgba(130,130,154,.12)`}};function SH(){let e=I(),[t,n]=zn(),[r,i]=(0,v.useState)(t.get(`q`)||``),a=bH.find(e=>e.id===t.get(`show`))??bH[0],{data:o,error:s}=P(`/api/logs${e.q({q:t.get(`q`)||``,level:a.levels,limit:300})}`,[e.tick]),c=(e,t)=>{let r=new URLSearchParams(window.location.search);t?r.set(e,t):r.delete(e),n(r,{replace:!0})},l={all:0,error:0,warn:0};for(let e of o?.series||[]){for(let t of[`error`,`fatal`,`warn`,`info`,`debug`,`trace`])l.all+=e[t]||0;l.error+=(e.error||0)+(e.fatal||0),l.warn+=e.warn||0}return(0,F.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(Ti,{size:22,className:`text-brand`}),`Logs`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Everything your app printed, newest first. Each line knows which request wrote it.`})]}),(0,F.jsxs)(`section`,{className:`card p-5 flex flex-col gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsxs)(`form`,{className:`relative flex-1 min-w-[240px]`,onSubmit:e=>{e.preventDefault(),c(`q`,r.trim())},children:[(0,F.jsx)(Ei,{size:15,className:`absolute left-3 top-1/2 -translate-y-1/2 text-mute`}),(0,F.jsx)(`input`,{className:`input w-full h-10 pl-9 pr-9 text-[13.5px] rounded-xl`,placeholder:`Search your logs, then press Enter`,value:r,onChange:e=>i(e.target.value)}),t.get(`q`)&&(0,F.jsx)(`button`,{type:`button`,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-mute hover:text-ink`,title:`Clear`,onClick:()=>{i(``),c(`q`,``)},children:(0,F.jsx)(Ki,{size:15})})]}),(0,F.jsx)(`div`,{className:`seg seg-lg`,children:bH.map(e=>(0,F.jsx)(`button`,{className:a.id===e.id?`on`:``,onClick:()=>c(`show`,e.id===`all`?``:e.id),children:e.label},e.id))})]}),o&&(0,F.jsxs)(`div`,{className:`text-[12.5px] text-ink2`,children:[V(l.all),` line`,l.all===1?``:`s`,` in `,QV[e.range]||`this period`,l.error>0&&(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsxs)(`span`,{className:`text-[#ff8a8a]`,children:[V(l.error),` error`,l.error===1?``:`s`]})]}),l.warn>0&&(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsxs)(`span`,{className:`text-[#f5c04e]`,children:[V(l.warn),` warning`,l.warn===1?``:`s`]})]}),t.get(`q`)&&(0,F.jsxs)(F.Fragment,{children:[` · matching “`,t.get(`q`),`”`]})]}),s?(0,F.jsx)(W,{error:s}):o?o.logs.length===0?(0,F.jsx)(`div`,{className:`text-center text-ink2 py-12 text-[13.5px]`,children:t.get(`q`)||a.levels?`Nothing matches. Try another word or show everything.`:`No logs in this period. console.log and pino output shows up here automatically.`}):(0,F.jsx)(`div`,{className:`flex flex-col -mx-2`,children:o.logs.map(e=>(0,F.jsx)(CH,{l:e},e.id))}):(0,F.jsx)(U,{})]})]})}function CH({l:e}){let[t,n]=(0,v.useState)(!1),r=ht(),i=Qn(),a=xH[e.level]||xH.info;return(0,F.jsxs)(`div`,{className:`rounded-lg ${t?`bg-[#16161e]`:`hover:bg-[#15151c]`}`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-start gap-3 px-2 py-2 text-left`,onClick:()=>n(!t),children:[(0,F.jsx)(`span`,{className:`text-mute text-[12px] tabular-nums shrink-0 w-[62px] pt-px`,title:JV(e.ts),children:Ca(e.ts)}),(0,F.jsx)(`span`,{className:`text-[11px] font-semibold px-2 py-0.5 rounded-md shrink-0 w-[64px] text-center`,style:{color:a.color,background:a.bg},children:a.word}),(0,F.jsx)(`span`,{className:`mono text-[12.5px] flex-1 min-w-0 text-[#dcdce6] ${t?`whitespace-pre-wrap break-words`:`truncate`}`,children:e.message}),(0,F.jsx)(`span`,{className:`text-mute text-[12px] shrink-0 max-w-[110px] truncate`,children:e.service}),(0,F.jsx)(Or,{size:14,className:`text-mute shrink-0 mt-0.5 transition-transform ${t?`rotate-90`:``}`})]}),t&&(0,F.jsxs)(`div`,{className:`px-2 pb-3 pl-[150px] flex flex-col gap-2.5`,children:[(0,F.jsxs)(`div`,{className:`text-[12px] text-mute`,children:[Ca(e.ts,!0),` · `,JV(e.ts),e.logger?` · ${e.logger}`:``,e.instance?` · ${e.instance}`:``]}),e.attrs&&(0,F.jsx)(`pre`,{className:`code !text-[11.5px] !py-2 max-h-[240px] overflow-auto`,children:JSON.stringify(e.attrs,null,2)}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[e.executionId&&(0,F.jsxs)(`button`,{className:`btn h-8`,onClick:()=>r(i(`/executions/${e.executionId}`)),children:[`See the request that wrote it`,(0,F.jsx)(Or,{size:13})]}),(0,F.jsx)(XV,{className:`btn h-8`,label:`Ask Obzeri about this`,question:`What does this ${e.level} log from ${e.service} mean, and do I need to do anything? "${String(e.message).slice(0,300)}"`})]})]})]})}function wH(){let e=I(),t=ht(),n=Qn(),r=ir(),i=P(`/api/settings`),a=P(`/api/settings/ai`);if(i.error)return(0,F.jsx)(W,{error:i.error});if(!i.data)return(0,F.jsx)(U,{});let o=i.data,s=e.meta?.services||[];return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(ki,{size:22,className:`text-brand`}),`Settings`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Connect your app, choose how the dashboard looks, and turn on the assistant.`})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 @4xl:grid-cols-5 gap-5 items-start`,children:[(0,F.jsxs)(`div`,{className:`@4xl:col-span-3 flex flex-col gap-5`,children:[(0,F.jsx)(YV,{title:`Your apps`,n:s.length,children:s.length===0?(0,F.jsx)(`div`,{className:`text-ink2 text-[13px]`,children:`No app has reported yet. Follow the steps below.`}):(0,F.jsx)(`div`,{className:`flex flex-col divide-y divide-[#1f1f29]`,children:s.map(t=>{let n=Date.now()-t.lastSeen<9e5,r=(e.meta?.versions||[]).filter(e=>e.service===t.id);return(0,F.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,F.jsx)(yr,{size:17,className:`text-mute shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`font-medium text-[14px]`,children:t.id}),(0,F.jsx)(io,{frameworks:t.frameworks,className:`mt-1`}),(0,F.jsx)(`div`,{className:`text-mute text-[12px] mt-1`,children:[r.length?`version ${r[r.length-1].version}`:null,t.instances.length>1?`${t.instances.length} instances`:null].filter(Boolean).join(` · `)||`Node.js`})]}),(0,F.jsxs)(`span`,{className:`tone-${n?`good`:`neutral`} text-[12px] font-medium flex items-center gap-1.5`,style:{color:`var(--tone)`},children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full ${n?`live-dot`:``}`,style:{background:`var(--tone)`}}),n?`Reporting`:`Last heard ${JV(t.lastSeen)}`]})]},t.id)})})}),(0,F.jsx)(zz,{initial:`zero`,title:`Connect an app`})]}),(0,F.jsxs)(`div`,{className:`@4xl:col-span-2 flex flex-col gap-5`,children:[(0,F.jsx)(TH,{}),(0,F.jsx)(EH,{}),(0,F.jsx)(YV,{title:`Ask Obzeri`,children:a.data?a.data.configured?(0,F.jsxs)(`div`,{className:`tone-good flex items-center gap-2 text-[13px]`,children:[(0,F.jsx)(Mr,{size:16,style:{color:`var(--tone)`}}),`Ready, using `,(0,F.jsx)(`b`,{children:a.data.model})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`text-ink2 text-[13px] leading-relaxed`,children:`Ask questions about your app in plain words. Needs an AI model: Claude, any OpenAI-compatible API, or a local one through Ollama.`}),(0,F.jsxs)(`button`,{className:`btn btn-primary h-9 self-start`,onClick:()=>t(n(`/integrations/ai`)),children:[(0,F.jsx)(Fi,{size:14}),`Set up Ask Obzeri`]})]}):(0,F.jsx)(U,{})}),(0,F.jsxs)(YV,{title:`Privacy & data`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3 text-[13px]`,children:[(0,F.jsx)(ii,{size:15,className:`text-mute mt-0.5`}),(0,F.jsx)(`div`,{children:o.passwordProtected?`The dashboard is password protected.`:(0,F.jsxs)(F.Fragment,{children:[`No password: anyone who can reach this address can open the dashboard. Set `,(0,F.jsx)(`span`,{className:`mono`,children:`OBZERVER_PASSWORD`}),` to lock it.`]})})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3 text-[13px]`,children:[(0,F.jsx)(Ir,{size:15,className:`text-mute mt-0.5`}),(0,F.jsxs)(`div`,{children:[`Details are kept for `,o.retentionDays,` days`,o.history?`, daily summaries for ${o.history.days} days`:``,`. Passwords and keys found in logs are hidden before saving.`]})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3 text-[13px]`,children:[(0,F.jsx)(Ni,{size:15,className:`text-mute mt-0.5`}),(0,F.jsxs)(`div`,{children:[`Your app keys are stored as hashes and shown only once. Create, rotate or limit them to one environment in `,(0,F.jsx)(`button`,{className:`link`,onClick:()=>r(`/settings`),children:`Advanced → Settings`}),`.`]})]})]}),(0,F.jsxs)(`button`,{className:`card p-4 text-left flex items-center gap-3 hover:border-line2 group`,onClick:()=>r(`/settings`),children:[(0,F.jsx)(Ni,{size:17,className:`text-mute`}),(0,F.jsxs)(`div`,{className:`flex-1`,children:[(0,F.jsx)(`div`,{className:`font-medium text-[13.5px]`,children:`All settings`}),(0,F.jsx)(`div`,{className:`text-mute text-[12px]`,children:`Ingest keys, projects, email, MCP, ticket trackers, history`})]}),(0,F.jsx)(Or,{size:15,className:`text-mute group-hover:translate-x-0.5 transition-transform`})]})]})]})]})}function TH(){let e=I(),t=ht(),n=Qn(),r=e.meta?.usage;if(!r)return null;let i={unlimited:`No monthly limit: everything your apps send is kept.`,ok:`${R(r.included==null?null:Math.max(0,r.included-r.used))} events left this month.`,paced:`You sent a lot today, so most step-by-step timings pause until midnight (UTC). Errors and slow requests still keep theirs.`,reduced:`You used this month's events. Charts stay live, but most requests arrive without step-by-step timings.`,refused:`You used twice this month's events, so new data is turned away until the 1st.`,overage:`Past this month's events: extra ones are collected within your spending limits.`,paused:`Extra events are paused. Server errors and failed jobs are still collected.`};return(0,F.jsxs)(YV,{title:`Your plan`,right:(0,F.jsx)(`span`,{className:`text-[12px] text-mute`,children:r.name}),children:[r.included!=null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between text-[13px]`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{className:`text-[16px]`,children:R(r.used)}),` of `,R(r.included),` events used`]}),(0,F.jsx)(`span`,{className:`text-mute`,children:Yi(r.pct)})]}),(0,F.jsx)($i,{used:r.used,included:r.included})]}),(0,F.jsx)(`div`,{className:`text-[13px] leading-relaxed tone-${Zi[r.state].tone}`,children:i[r.state]}),(0,F.jsx)(`div`,{className:`text-[12px] text-mute leading-snug`,children:`An event is one request, background job, error, log line or step inside your code. Database calls are free.`}),(0,F.jsx)(`button`,{className:`btn h-9 self-start`,onClick:()=>t(n(`/usage`)),children:`Usage & plans`})]})}function EH(){let{mode:e,setMode:t}=rr(),n=(n,r,i,a)=>(0,F.jsxs)(`button`,{className:`text-left rounded-xl border px-3.5 py-3 flex gap-3 ${e===n?`border-brand bg-[rgba(255,61,127,.06)]`:`border-line hover:border-line2`}`,onClick:()=>t(n),"aria-pressed":e===n,children:[(0,F.jsx)(r,{size:18,className:e===n?`text-brand mt-0.5`:`text-mute mt-0.5`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-[13.5px]`,children:i}),(0,F.jsx)(`div`,{className:`text-mute text-[12px] mt-0.5 leading-snug`,children:a})]})]});return(0,F.jsxs)(YV,{title:`Dashboard mode`,children:[n(`simple`,Pi,`Simple`,`Is my app healthy, what broke, what changed, what to do. Plain words, no jargon.`),n(`advanced`,Ni,`Advanced`,`Every request, trace, query, release and runtime detail, for digging deep.`),(0,F.jsx)(`div`,{className:`text-[11.5px] text-mute`,children:`Saved in this browser. Switch any time from the top bar.`})]})}var DH=e=>`${e.service}@${e.version}`;function OH(){let e=I(),[t]=zn(),{data:n,error:r}=P(`/api/simple/releases${e.q()}`,[e.tick]),i=t.get(`release`)||(t.get(`service`)&&t.get(`version`)?`${t.get(`service`)}@${t.get(`version`)}`:null);if(r)return(0,F.jsx)(W,{error:r});if(!n)return(0,F.jsx)(U,{});let a=n.filter(e=>e.latest),o=n.filter(e=>!e.latest);return(0,F.jsxs)(`div`,{className:`@container flex flex-col gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{className:`text-[24px] font-semibold tracking-tight flex items-center gap-2.5`,children:[(0,F.jsx)(xi,{size:22,className:`text-brand`}),`Releases`]}),(0,F.jsx)(`p`,{className:`text-ink2 mt-1 text-[14px]`,children:`Every deploy, and whether it made your app better or worse than the one before.`})]}),n.length===0?(0,F.jsx)(FH,{}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`flex flex-col gap-5`,children:a.map(e=>(0,F.jsx)(MH,{r:e,focus:i===DH(e)},DH(e)))}),o.length>0&&(0,F.jsx)(YV,{title:`Earlier deploys`,n:o.length,children:(0,F.jsx)(`div`,{className:`flex flex-col gap-2`,children:o.map(e=>(0,F.jsx)(NH,{r:e,focus:i===DH(e)},DH(e)))})})]})]})}function kH({r:e}){return(0,F.jsxs)(Xa,{tip:`Deployed ${Ca(e.first,!0)} · last request ${Ca(e.last,!0)}`,children:[`deployed `,JV(e.first)]})}function AH({r:e,big:t}){let n=qV[e.tone];return(0,F.jsxs)(`span`,{className:`tone-${e.tone} inline-flex items-center gap-1.5 font-semibold rounded-full ${t?`text-[12.5px] px-2.5 py-1`:`text-[11.5px] px-2 py-0.5`}`,style:{color:`var(--tone)`,background:`var(--tone-bg)`},children:[(0,F.jsx)(n,{size:t?14:12}),e.label]})}function jH(e){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{e&&setTimeout(()=>t.current?.scrollIntoView({block:`start`,behavior:`smooth`}),100)},[e]),t}function MH({r:e,focus:t}){let n=jH(t);return(0,F.jsxs)(`section`,{ref:n,className:`card tone-${e.tone} p-6 flex flex-col gap-5 scroll-mt-4`,style:{borderColor:e.tone===`bad`||e.tone===`warn`||t?`var(--tone-line)`:void 0,background:e.tone===`bad`||e.tone===`warn`?`linear-gradient(135deg, var(--tone-bg), transparent 50%), var(--color-panel)`:void 0},children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-4 flex-wrap`,children:[(0,F.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex items-center justify-center shrink-0`,style:{background:`var(--tone-bg)`,border:`1px solid var(--tone-line)`},children:(0,F.jsx)(xi,{size:22,style:{color:`var(--tone)`}})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-[11.5px] uppercase tracking-wider font-semibold text-mute`,children:[`Latest deploy of `,e.service]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap mt-0.5`,children:[(0,F.jsxs)(`h2`,{className:`text-[22px] font-semibold tracking-tight`,children:[e.service,` `,(0,F.jsx)(`span`,{className:`font-mono text-[19px]`,children:e.version})]}),(0,F.jsx)(AH,{r:e,big:!0})]}),(0,F.jsx)(`div`,{className:`text-ink2 text-[14px] mt-1.5 leading-relaxed`,children:e.summary}),(0,F.jsxs)(`div`,{className:`text-mute text-[12px] mt-1`,children:[(0,F.jsx)(kH,{r:e}),` · `,V(e.requests),` requests since`,e.previous?(0,F.jsxs)(F.Fragment,{children:[` · compared with `,(0,F.jsx)(`span`,{className:`mono`,children:e.previous})]}):null]})]}),(0,F.jsx)(`div`,{className:`flex gap-2 shrink-0`,children:(0,F.jsx)(XV,{question:e.ask,className:`btn h-9`})})]}),(0,F.jsx)(PH,{r:e})]})}function NH({r:e,focus:t}){let[n,r]=(0,v.useState)(t),i=jH(t);return(0,F.jsxs)(`div`,{ref:i,className:`rounded-xl border bg-[#111118] scroll-mt-4 ${n?`border-line2`:`border-line`}`,children:[(0,F.jsxs)(`button`,{className:`w-full flex items-center gap-3 px-4 py-3 text-left flex-wrap`,onClick:()=>r(!n),"aria-expanded":n,children:[(0,F.jsxs)(`span`,{className:`font-medium text-[14px] min-w-[150px]`,children:[e.service,` `,(0,F.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.version})]}),(0,F.jsx)(AH,{r:e}),(0,F.jsx)(`span`,{className:`text-mute text-[12.5px] flex-1 min-w-[200px] truncate`,children:e.summary}),(0,F.jsx)(`span`,{className:`text-mute text-[12px] shrink-0`,children:JV(e.first)}),n?(0,F.jsx)(Er,{size:15,className:`text-mute`}):(0,F.jsx)(Or,{size:15,className:`text-mute`})]}),n&&(0,F.jsxs)(`div`,{className:`px-4 pb-4 flex flex-col gap-4`,children:[(0,F.jsxs)(`div`,{className:`text-mute text-[12px]`,children:[(0,F.jsx)(kH,{r:e}),` · `,V(e.requests),` requests`]}),(0,F.jsx)(PH,{r:e}),(0,F.jsx)(`div`,{children:(0,F.jsx)(XV,{question:e.ask,className:`btn h-8`})})]})]})}function PH({r:e}){let t=ht(),n=Qn(),r=ir(),i=e.newErrors.length>0||e.codeChanges.length>0;return!e.compare.length&&!i&&!e.advice?e.verdict===`baseline`?null:(0,F.jsx)(`div`,{className:`text-ink2 text-[13px]`,children:`Not enough traffic on this version yet to compare. Check back after a few hundred requests.`}):(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.advice&&(0,F.jsxs)(`div`,{className:`tone-${e.tone} rounded-xl px-4 py-3.5 flex gap-3`,style:{background:`var(--tone-bg)`,border:`1px solid var(--tone-line)`},children:[(0,F.jsx)(ei,{size:17,style:{color:`var(--tone)`},className:`shrink-0 mt-0.5`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-semibold text-[13.5px]`,children:`What to do`}),(0,F.jsx)(`ol`,{className:`mt-1.5 flex flex-col gap-1`,children:e.advice.map((e,t)=>(0,F.jsxs)(`li`,{className:`text-[13px] flex gap-2`,children:[(0,F.jsxs)(`span`,{className:`text-mute tabular-nums`,children:[t+1,`.`]}),e]},t))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 ${i&&e.compare.length?`@4xl:grid-cols-2`:``} gap-4`,children:[e.compare.length>0&&(0,F.jsxs)(`div`,{className:`rounded-xl border border-line overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_20px_auto] gap-x-3 items-center px-4 py-2 text-[11px] uppercase tracking-wider text-mute border-b border-line bg-[#111118]`,children:[(0,F.jsx)(`span`,{children:`Before vs after`}),(0,F.jsx)(`span`,{className:`mono normal-case tracking-normal text-right`,children:e.previous}),(0,F.jsx)(`span`,{}),(0,F.jsx)(`span`,{className:`mono normal-case tracking-normal`,children:e.version})]}),e.compare.map(e=>(0,F.jsxs)(`div`,{className:`tone-${e.tone} grid grid-cols-[1fr_auto_20px_auto] gap-x-3 items-center px-4 py-2.5 border-b border-[#1d1d26] last:border-0`,children:[(0,F.jsx)(`span`,{className:`text-[13px] text-ink2`,children:e.hint?(0,F.jsx)(Xa,{tip:e.hint,children:e.label}):e.label}),(0,F.jsx)(`span`,{className:`text-[13px] tabular-nums text-mute text-right`,children:e.before}),(0,F.jsx)(pr,{size:13,className:`text-mute`}),(0,F.jsx)(`span`,{className:`text-[13.5px] tabular-nums font-semibold min-w-[70px]`,style:{color:e.tone===`neutral`?void 0:`var(--tone)`},children:e.after})]},e.label))]}),i&&(0,F.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.newErrors.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`text-[12.5px] font-semibold flex items-center gap-1.5 mb-1.5`,children:[(0,F.jsx)(xr,{size:14,className:`text-[#ff8a8a]`}),`New errors in this version`]}),(0,F.jsx)(`div`,{className:`flex flex-col`,children:e.newErrors.map(e=>(0,F.jsxs)(`button`,{className:`text-left rounded-lg px-2.5 py-2 -mx-2.5 hover:bg-[#181821] flex items-center gap-3 group`,onClick:()=>t(n(`/errors/${e.fingerprint}`)),children:[(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`span`,{className:`text-[13px] font-medium text-[#ff9b9b]`,children:e.class}),(0,F.jsx)(`span`,{className:`block text-mute text-[12px] truncate`,children:e.message})]}),(0,F.jsxs)(`span`,{className:`text-[12px] text-ink2 tabular-nums`,children:[V(e.count),`×`]}),(0,F.jsx)(Or,{size:14,className:`text-mute`})]},e.fingerprint))})]}),e.codeChanges.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`text-[12.5px] font-semibold flex items-center gap-1.5 mb-1.5`,children:[(0,F.jsx)(Lr,{size:14,className:`text-mute`}),`What changed in the code`]}),(0,F.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.codeChanges.map(e=>(0,F.jsxs)(`li`,{className:`text-[13px] text-ink2 flex gap-2`,children:[(0,F.jsx)(`span`,{className:`text-mute`,children:`•`}),e]},e))})]})]})]}),(0,F.jsx)(`div`,{children:(0,F.jsxs)(`button`,{className:`btn btn-ghost h-8 px-2 text-[12.5px]`,onClick:()=>r(`/releases?service=${encodeURIComponent(e.service)}&version=${encodeURIComponent(e.version)}`),children:[(0,F.jsx)(Ni,{size:13}),`Full comparison in Advanced`]})})]})}function FH(){let e=`OBZERVER_VERSION=$(git rev-parse --short HEAD)`;return(0,F.jsxs)(YV,{title:`Tag your deploys to see them here`,children:[(0,F.jsxs)(`div`,{className:`text-ink2 text-[13.5px] leading-relaxed`,children:[`Obzerver compares each version of your app with the one before: did errors go up, did it get slower, does it leak memory. Most CI and hosting providers (GitHub Actions, GitLab, Vercel, Render, Railway, Netlify, Heroku…) and a `,(0,F.jsx)(`span`,{className:`mono`,children:`.git`}),` folder are detected automatically. Otherwise, set a version when you deploy:`]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`code flex-1`,children:e}),(0,F.jsx)(Ba,{text:e,className:`btn h-9`})]})]})}function IH({simple:e,advanced:t}){let{mode:n}=rr();return(0,F.jsx)(F.Fragment,{children:n===`simple`?e:t})}function LH(){let{traceId:e}=yt(),[t,n]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{N(`/api/traces/${e}`).then(e=>n(e.execution.id)).catch(()=>n(null))},[e]),t===void 0?(0,F.jsx)(U,{}):t===null?(0,F.jsxs)(`div`,{className:`text-mute py-10 text-center`,children:[`Trace `,e,` not found.`]}):(0,F.jsx)(Vt,{to:`/executions/${t}${window.location.search}`,replace:!0})}function RH({onDone:e}){let[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(``);return(0,F.jsxs)(`div`,{className:`h-full overflow-y-auto flex flex-col items-center justify-center gap-10 px-6 py-10`,children:[(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-6 text-center`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-[18px] max-[480px]:scale-[0.72]`,children:[(0,F.jsx)(ho,{size:88}),(0,F.jsx)(_o,{size:64})]}),(0,F.jsx)(`p`,{className:`m-0 text-[15px] text-[#a3a3b8]`,children:`Know your app is healthy. Zero-config observability for Express and Fastify.`})]}),(0,F.jsxs)(`form`,{className:`card p-5 w-full max-w-[340px] flex flex-col gap-3`,onSubmit:async n=>{n.preventDefault();try{await N(`/api/auth/login`,{method:`POST`,json:{password:t}}),e()}catch(e){i(e.message||`Wrong password`)}},children:[(0,F.jsx)(`label`,{className:`text-[12.5px] text-ink2`,htmlFor:`obz-password`,children:`Dashboard password`}),(0,F.jsx)(`input`,{id:`obz-password`,type:`password`,autoFocus:!0,className:`input h-9`,placeholder:`Password`,value:t,onChange:e=>n(e.target.value)}),r&&(0,F.jsx)(`div`,{className:`text-[#ff8a8a] text-[12px]`,children:r}),(0,F.jsx)(`button`,{className:`btn btn-primary justify-center h-9`,children:`Sign in`})]})]})}function zH({children:e}){let[t]=zn();return(0,F.jsx)(v.Fragment,{children:e},t.get(`project`)||`default`)}function BH(){let[e,t]=(0,v.useState)(`loading`),n=()=>N(`/api/auth`).then(e=>t(e.ok?`ok`:`login`)).catch(()=>t(`ok`));return(0,v.useEffect)(()=>{n();let e=()=>t(`login`);return window.addEventListener(`obz:unauthorized`,e),()=>window.removeEventListener(`obz:unauthorized`,e)},[]),e===`loading`?(0,F.jsx)(U,{}):e===`login`?(0,F.jsx)(RH,{onDone:()=>t(`ok`)}):(0,F.jsx)(Mn,{basename:`/`.replace(/\/$/,``)||void 0,children:(0,F.jsx)(zH,{children:(0,F.jsx)(Zn,{children:(0,F.jsx)(nr,{children:(0,F.jsx)(Gt,{children:(0,F.jsxs)(Ut,{element:(0,F.jsx)(vo,{}),children:[(0,F.jsx)(Ut,{index:!0,element:(0,F.jsx)(IH,{simple:(0,F.jsx)(tH,{}),advanced:(0,F.jsx)(Hz,{})})}),(0,F.jsx)(Ut,{path:`requests`,element:(0,F.jsx)(Kz,{kind:`http`})}),(0,F.jsx)(Ut,{path:`jobs`,element:(0,F.jsx)(Kz,{kind:`job`})}),(0,F.jsx)(Ut,{path:`operations/:kind/:service/:name`,element:(0,F.jsx)(tB,{})}),(0,F.jsx)(Ut,{path:`executions/:id`,element:(0,F.jsx)(cB,{})}),(0,F.jsx)(Ut,{path:`traces`,element:(0,F.jsx)(dB,{})}),(0,F.jsx)(Ut,{path:`traces/:traceId`,element:(0,F.jsx)(LH,{})}),(0,F.jsx)(Ut,{path:`map`,element:(0,F.jsx)(hV,{})}),(0,F.jsx)(Ut,{path:`errors`,element:(0,F.jsx)(fB,{})}),(0,F.jsx)(Ut,{path:`secrets`,element:(0,F.jsx)(mB,{})}),(0,F.jsx)(Ut,{path:`errors/:fp`,element:(0,F.jsx)(gB,{})}),(0,F.jsx)(Ut,{path:`logs`,element:(0,F.jsx)(Xi,{feature:`logs`,children:(0,F.jsx)(IH,{simple:(0,F.jsx)(SH,{}),advanced:(0,F.jsx)(sB,{})})})}),(0,F.jsx)(Ut,{path:`services`,element:(0,F.jsx)(MB,{})}),(0,F.jsx)(Ut,{path:`integrations`,element:(0,F.jsx)(Oz,{})}),(0,F.jsx)(Ut,{path:`projects`,element:(0,F.jsx)(PB,{})}),(0,F.jsx)(Ut,{path:`integrations/:id`,element:(0,F.jsx)(Oz,{})}),(0,F.jsx)(Ut,{path:`functions`,element:(0,F.jsx)(Vt,{to:`/services${window.location.search}`,replace:!0})}),(0,F.jsx)(Ut,{path:`queries`,element:(0,F.jsx)(RB,{})}),(0,F.jsx)(Ut,{path:`users`,element:(0,F.jsx)(zB,{})}),(0,F.jsx)(Ut,{path:`users/:id`,element:(0,F.jsx)(BB,{})}),(0,F.jsx)(Ut,{path:`profiler`,element:(0,F.jsx)(iV,{})}),(0,F.jsx)(Ut,{path:`metrics`,element:(0,F.jsx)(IH,{simple:(0,F.jsx)(vH,{}),advanced:(0,F.jsx)(oV,{})})}),(0,F.jsx)(Ut,{path:`releases`,element:(0,F.jsx)(IH,{simple:(0,F.jsx)(OH,{}),advanced:(0,F.jsx)(lV,{})})}),(0,F.jsx)(Ut,{path:`alerts`,element:(0,F.jsx)(Xi,{feature:`alerts`,children:(0,F.jsx)(IH,{simple:(0,F.jsx)(fH,{}),advanced:(0,F.jsx)(vV,{})})})}),(0,F.jsx)(Ut,{path:`slos`,element:(0,F.jsx)(Xi,{feature:`slos`,children:(0,F.jsx)(FV,{})})}),(0,F.jsx)(Ut,{path:`usage`,element:(0,F.jsx)(xB,{})}),(0,F.jsx)(Ut,{path:`status-pages`,element:(0,F.jsx)(HV,{})}),(0,F.jsx)(Ut,{path:`issues`,element:(0,F.jsx)(TV,{})}),(0,F.jsx)(Ut,{path:`issues/:id`,element:(0,F.jsx)(OV,{})}),(0,F.jsx)(Ut,{path:`settings`,element:(0,F.jsx)(IH,{simple:(0,F.jsx)(wH,{}),advanced:(0,F.jsx)(Bz,{})})}),(0,F.jsx)(Ut,{path:`*`,element:(0,F.jsx)(`div`,{className:`text-mute py-10 text-center`,children:`Not found`})})]})})})})})})}(0,Gn.createRoot)(document.getElementById(`root`)).render((0,F.jsx)(v.StrictMode,{children:(0,F.jsx)(BH,{})}));
|