diff --git a/dashboard/src/main.test.tsx b/dashboard/src/main.test.tsx index d2a1304..208482d 100644 --- a/dashboard/src/main.test.tsx +++ b/dashboard/src/main.test.tsx @@ -193,6 +193,7 @@ describe("dashboard routing and API query helpers", () => { expect(screen.getByText("#42")).toBeInTheDocument(); expect(screen.getByText("enqueued")).toBeInTheDocument(); expect(screen.getByRole("link", { name: "Job #81" })).toHaveAttribute("href", "/jobs/81"); + expect(document.querySelector('time[datetime="2026-10-02T10:05:00.000Z"]')).toBeInTheDocument(); }); it("shows sanitized hook configuration and can request a fresh ping", async () => { @@ -205,6 +206,8 @@ describe("dashboard routing and API query helpers", () => { expect(screen.getAllByText("issue_comment · created").length).toBeGreaterThan(0); expect(screen.getAllByText("delivery-1").length).toBeGreaterThan(0); expect(screen.getByText("by @operator")).toBeInTheDocument(); + expect(document.querySelectorAll("time").length).toBeGreaterThanOrEqual(6); + expect(document.querySelector('time[datetime="2026-10-02T11:07:17.000Z"]')).toHaveAttribute("title", "UTC: 2026-10-02T11:07:17.000Z"); await user.click(screen.getByRole("button", { name: "Send ping" })); expect(onPing).toHaveBeenCalledWith("42"); expect(await screen.findByText("GitHub accepted the ping request.")).toBeInTheDocument(); @@ -217,6 +220,7 @@ describe("dashboard routing and API query helpers", () => { expect(screen.getByText(/"body": "@giscebot fix it"/)).toBeInTheDocument(); expect(screen.getByText("Job #91 · running · reply_comment · work_allowed")).toBeInTheDocument(); + expect(document.querySelector('time[datetime="2026-10-02T11:08:00.000Z"]')).toBeInTheDocument(); await user.click(screen.getByRole("button", { name: "Open job" })); expect(onViewJob).toHaveBeenCalledWith(91); }); diff --git a/dashboard/src/main.tsx b/dashboard/src/main.tsx index f6cf19b..4c1d58f 100644 --- a/dashboard/src/main.tsx +++ b/dashboard/src/main.tsx @@ -1883,15 +1883,15 @@ function WebhookPage({ - {summary?.coverage?.window_start && summary.coverage.window_end ?

Comparable canonical events from {summary.coverage.window_start} to {summary.coverage.window_end}; newest {summary.coverage.grace_seconds ?? 0}s excluded.

: null} + {summary?.coverage?.window_start && summary.coverage.window_end ?

Comparable canonical events from to ; newest {summary.coverage.grace_seconds ?? 0}s excluded.

: null} {Object.keys(summary?.enqueue ?? {}).length ?
{Object.entries(summary?.enqueue ?? {}).sort(([left], [right]) => left.localeCompare(right)).map(([state, count]) => )}
: null} - {exceptions?.length ?
{exceptions.map((item) => )}
TypeRepositoryReferenceObserved
{item.kind}{item.repository ?? "unknown"}{item.event_key ?? item.reference}{item.created_at}
: } + {exceptions?.length ?
{exceptions.map((item) => )}
TypeRepositoryReferenceObserved
{item.kind}{item.repository ?? "unknown"}{item.event_key ?? item.reference}
: }
: null} {section === "hooks" ? - {sectionLoading ? : hooks?.length ? {hooks.map((hook) => onViewHook(hook.id)}>)}
TargetStateConfigurationLast deliveryLast ping
{hook.target_type} · #{hook.id}
{hook.status}
{hook.events.join(", ") || "No event snapshot"}
{hook.content_type ?? "content type unknown"} · SSL {hook.ssl_verify === null || hook.ssl_verify === undefined ? "unknown" : hook.ssl_verify ? "verified" : "disabled"}
{hook.last_event_name ?? "Never"}{hook.last_action ? ` · ${hook.last_action}` : ""}
{hook.last_repository ?? hook.last_event_at ?? "No delivery observed"}
{hook.last_ping_at ?? "Never"}
: } + {sectionLoading ? : hooks?.length ? {hooks.map((hook) => onViewHook(hook.id)}>)}
TargetStateConfigurationLast deliveryLast ping
{hook.target_type} · #{hook.id}
{hook.status}
{hook.events.join(", ") || "No event snapshot"}
{hook.content_type ?? "content type unknown"} · SSL {hook.ssl_verify === null || hook.ssl_verify === undefined ? "unknown" : hook.ssl_verify ? "verified" : "disabled"}
{hook.last_event_name ?? "Never"}{hook.last_action ? ` · ${hook.last_action}` : ""}
{hook.last_repository ?? "No repository"}{hook.last_event_at ? <> · : null}
{hook.last_ping_at ? : "Never"}
: }
: null} {section === "deliveries" ? @@ -1913,7 +1913,7 @@ function WebhookDeliveryFiltersForm({ filters, onChange }: { filters: WebhookDel } function WebhookDeliveriesTable({ deliveries, onViewHook, onViewDelivery = () => undefined }: { deliveries: WebhookDelivery[]; onViewHook: (hookId: string) => void; onViewDelivery?: (deliveryId: string) => void }) { - return {deliveries.map((delivery) => )}
ReceivedHookEventRepositoryResultIngestionDelivery
{delivery.created_at}{delivery.hook_id ? : Unknown (legacy)}{delivery.event_name}{delivery.action ? ` · ${delivery.action}` : ""}{delivery.repository ?? "—"}{delivery.status}{delivery.duplicate_count ? {delivery.duplicate_count} retries : null}{delivery.enqueue_status ? <>{delivery.enqueue_status}{delivery.job_id ? Job #{delivery.job_id} : null} : shadow}
; + return {deliveries.map((delivery) => )}
ReceivedHookEventRepositoryResultIngestionDelivery
{delivery.hook_id ? : Unknown (legacy)}{delivery.event_name}{delivery.action ? ` · ${delivery.action}` : ""}{delivery.repository ?? "—"}{delivery.status}{delivery.duplicate_count ? {delivery.duplicate_count} retries : null}{delivery.enqueue_status ? <>{delivery.enqueue_status}{delivery.job_id ? Job #{delivery.job_id} : null} : shadow}
; } function LazyScrollFrame({ noun, hasMore, loading, onLoadMore, children, className }: { noun: string; hasMore: boolean; loading: boolean; onLoadMore?: () => void; children: React.ReactNode; className?: string }) { @@ -1955,7 +1955,14 @@ function WebhookHookDetailPage({ data, loading, error, onBack, onRefresh, onView if (loading) return ; if (error) return
; if (!data) return ; - const hook = data.hook; + const rawHook = data.hook; + const hook = { + ...rawHook, + github_created_at: rawHook.github_created_at ? : "unknown", + github_updated_at: rawHook.github_updated_at ? : "unknown", + last_ping_at: rawHook.last_ping_at ? : "never", + last_event_at: rawHook.last_event_at ? : "never", + }; const requestPing = async () => { if (!onPing || pingPending) return; setPingPending(true); @@ -1969,7 +1976,10 @@ function WebhookHookDetailPage({ data, loading, error, onBack, onRefresh, onView setPingPending(false); } }; - const recentActions = data.recent_actions ?? []; + const recentActions = (data.recent_actions ?? []).map((action) => ({ + ...action, + created_at: , + })); return

{hook.target}

{hook.target_type} webhook #{hook.id}

{hook.ping_url && onPing ? : null}{hook.admin_url ? Open in GitHub : null}
{pingError ? : null}{pingResult ?
{pingResult}
: null}
} />} />} />} />
Subscribed events
{hook.events.length ? hook.events.map((event) => {event}) : No event snapshot; send a ping to refresh it.}
{recentActions.length ?
{recentActions.map((action) =>
{action.action}by @{action.actor}
{action.status} · {action.created_at}
)}
: }
{data.recent_deliveries.length ? : }
; } @@ -1977,7 +1987,10 @@ function WebhookDeliveryDetailPage({ data, loading, error, onBack, onRefresh, on if (loading) return ; if (error) return
; if (!data) return ; - const delivery = data.delivery; + const delivery = { + ...data.delivery, + created_at: , + }; return

{delivery.event_name}{delivery.action ? ` · ${delivery.action}` : ""}

Delivery {delivery.delivery_id}

{delivery.hook_id ? : null}
{data.job ?
{data.job.work_key}
Job #{data.job.id} · {data.job.status} · {data.job.action} · {data.job.work_intent}
: }
{data.payload === null ? :
{JSON.stringify(data.payload, null, 2)}
}
; } diff --git a/src/github_agent_bridge/dashboard_static/assets/index-BnrVJ8iN.js b/src/github_agent_bridge/dashboard_static/assets/index-CCpbEi-A.js similarity index 75% rename from src/github_agent_bridge/dashboard_static/assets/index-BnrVJ8iN.js rename to src/github_agent_bridge/dashboard_static/assets/index-CCpbEi-A.js index ddf7178..592d519 100644 --- a/src/github_agent_bridge/dashboard_static/assets/index-BnrVJ8iN.js +++ b/src/github_agent_bridge/dashboard_static/assets/index-CCpbEi-A.js @@ -1,4 +1,4 @@ -var aa=e=>{throw TypeError(e)};var Kr=(e,t,n)=>t.has(e)||aa("Cannot "+n);var g=(e,t,n)=>(Kr(e,t,"read from private field"),n?n.call(e):t.get(e)),U=(e,t,n)=>t.has(e)?aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),O=(e,t,n,r)=>(Kr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ee=(e,t,n)=>(Kr(e,t,"access private method"),n);var vr=(e,t,n,r)=>({set _(s){O(e,t,s,n)},get _(){return g(e,t,r)}});import{f as hc,h as pc,g as Bi,r as ke,R as A,d as rr,a as qr,C as ir,X as sr,Y as ar,T as or,L as Po,B as Wt,e as mc,c as fc,b as xc}from"./charts-SqBiqy9C.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Qr={exports:{}},In={};/** +var aa=e=>{throw TypeError(e)};var Kr=(e,t,n)=>t.has(e)||aa("Cannot "+n);var g=(e,t,n)=>(Kr(e,t,"read from private field"),n?n.call(e):t.get(e)),U=(e,t,n)=>t.has(e)?aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),O=(e,t,n,r)=>(Kr(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ee=(e,t,n)=>(Kr(e,t,"access private method"),n);var vr=(e,t,n,r)=>({set _(s){O(e,t,s,n)},get _(){return g(e,t,r)}});import{f as hc,h as pc,g as Bi,r as Ne,R as A,d as rr,a as qr,C as ir,X as sr,Y as ar,T as or,L as Po,B as Wt,e as mc,c as fc,b as xc}from"./charts-SqBiqy9C.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var Qr={exports:{}},In={};/** * @license React * react-jsx-runtime.production.min.js * @@ -6,7 +6,7 @@ var aa=e=>{throw TypeError(e)};var Kr=(e,t,n)=>t.has(e)||aa("Cannot "+n);var g=( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var oa;function gc(){if(oa)return In;oa=1;var e=hc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,u){var d,h={},m=null,p=null;u!==void 0&&(m=""+u),c.key!==void 0&&(m=""+c.key),c.ref!==void 0&&(p=c.ref);for(d in c)r.call(c,d)&&!a.hasOwnProperty(d)&&(h[d]=c[d]);if(l&&l.defaultProps)for(d in c=l.defaultProps,c)h[d]===void 0&&(h[d]=c[d]);return{$$typeof:t,type:l,key:m,ref:p,props:h,_owner:s.current}}return In.Fragment=n,In.jsx=o,In.jsxs=o,In}var la;function bc(){return la||(la=1,Qr.exports=gc()),Qr.exports}var i=bc(),jr={},ca;function yc(){if(ca)return jr;ca=1;var e=pc();return jr.createRoot=e.createRoot,jr.hydrateRoot=e.hydrateRoot,jr}var wc=yc();const vc=Bi(wc);var lr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},zt,St,cn,yo,jc=(yo=class extends lr{constructor(){super();U(this,zt);U(this,St);U(this,cn);O(this,cn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,St)||this.setEventListener(g(this,cn))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,St))==null||t.call(this),O(this,St,void 0))}setEventListener(t){var n;O(this,cn,t),(n=g(this,St))==null||n.call(this),O(this,St,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,zt)!==t&&(O(this,zt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,zt)=="boolean"?g(this,zt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zt=new WeakMap,St=new WeakMap,cn=new WeakMap,yo),Ui=new jc,kc={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,qi,wo,Nc=(wo=class{constructor(){U(this,Ct,kc);U(this,qi,!1)}setTimeoutProvider(e){O(this,Ct,e)}setTimeout(e,t){return g(this,Ct).setTimeout(e,t)}clearTimeout(e){g(this,Ct).clearTimeout(e)}setInterval(e,t){return g(this,Ct).setInterval(e,t)}clearInterval(e){g(this,Ct).clearInterval(e)}},Ct=new WeakMap,qi=new WeakMap,wo),Ft=new Nc;function Sc(e){setTimeout(e,0)}var Cc=typeof window>"u"||"Deno"in globalThis;function Ae(){}function _c(e,t){return typeof e=="function"?e(t):e}function ui(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ro(e,t){return Math.max(e+(t||0)-Date.now(),0)}function At(e,t){return typeof e=="function"?e(t):e}function Be(e,t){return typeof e=="function"?e(t):e}function ua(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==$i(o,t.options))return!1}else if(!Qn(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||a&&!a(t))}function da(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Kn(t.options.mutationKey)!==Kn(a))return!1}else if(!Qn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function $i(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kn)(e)}function Kn(e){return JSON.stringify(e,(t,n)=>hi(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qn(e[n],t[n])):!1}var Ec=Object.prototype.hasOwnProperty;function Io(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ha(e)&&ha(t);if(!r&&!(hi(e)&&hi(t)))return t;const a=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let d=0;d{Ft.setTimeout(t,e)})}function pi(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Io(e,t):t}function Rc(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Ic(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Hi=Symbol();function To(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Hi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ao(e,t){return typeof e=="function"?e(...t):!!e}function Tc(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Vn=(()=>{let e=()=>Cc;return{isServer(){return e()},setIsServer(t){e=t}}})();function mi(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Ac=Sc;function Lc(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=Ac;const a=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var je=Lc(),un,_t,dn,vo,Mc=(vo=class extends lr{constructor(){super();U(this,un,!0);U(this,_t);U(this,dn);O(this,dn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){g(this,_t)||this.setEventListener(g(this,dn))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,_t))==null||t.call(this),O(this,_t,void 0))}setEventListener(t){var n;O(this,dn,t),(n=g(this,_t))==null||n.call(this),O(this,_t,t(this.setOnline.bind(this)))}setOnline(t){g(this,un)!==t&&(O(this,un,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,un)}},un=new WeakMap,_t=new WeakMap,dn=new WeakMap,vo),Ar=new Mc;function Oc(e){return Math.min(1e3*2**e,3e4)}function Lo(e){return(e??"online")==="online"?Ar.isOnline():!0}var fi=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Mo(e){let t=!1,n=0,r;const s=mi(),a=()=>s.status!=="pending",o=w=>{var v;if(!a()){const y=new fi(w);m(y),(v=e.onCancel)==null||v.call(e,y)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>Ui.isFocused()&&(e.networkMode==="always"||Ar.isOnline())&&e.canRun(),d=()=>Lo(e.networkMode)&&e.canRun(),h=w=>{a()||(r==null||r(),s.resolve(w))},m=w=>{a()||(r==null||r(),s.reject(w))},p=()=>new Promise(w=>{var v;r=y=>{(a()||u())&&w(y)},(v=e.onPause)==null||v.call(e)}).then(()=>{var w;r=void 0,a()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(a())return;let w;const v=n===0?e.initialPromise:void 0;try{w=v??e.fn()}catch(y){w=Promise.reject(y)}Promise.resolve(w).then(h).catch(y=>{var j;if(a())return;const C=e.retry??(Vn.isServer()?0:3),_=e.retryDelay??Oc,N=typeof _=="function"?_(n,y):_,F=C===!0||typeof C=="number"&&nu()?void 0:p()).then(()=>{t?m(y):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?b():p().then(b),s)}}var qt,jo,Oo=(jo=class{constructor(){U(this,qt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ui(this.gcTime)&&O(this,qt,Ft.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vn.isServer()?1/0:300*1e3))}clearGcTimeout(){g(this,qt)!==void 0&&(Ft.clearTimeout(g(this,qt)),O(this,qt,void 0))}},qt=new WeakMap,jo);function Dc(e){return{onFetch:(t,n)=>{var d,h,m,p,b;const r=t.options,s=(m=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,a=((p=t.state.data)==null?void 0:p.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let w=!1;const v=_=>{Tc(_,()=>t.signal,()=>w=!0)},y=To(t.options,t.fetchOptions),C=async(_,N,F)=>{if(w)return Promise.reject(t.signal.reason);if(N==null&&_.pages.length)return Promise.resolve(_);const q=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:N,direction:F?"backward":"forward",meta:t.options.meta};return v(k),k})(),M=await y(q),{maxPages:R}=t.options,z=F?Ic:Rc;return{pages:z(_.pages,M,R),pageParams:z(_.pageParams,N,R)}};if(s&&a.length){const _=s==="backward",N=_?Do:xi,F={pages:a,pageParams:o},j=N(r,F);l=await C(F,j,_)}else{const _=e??a.length;do{const N=c===0?o[0]??r.initialPageParam:xi(r,l);if(c>0&&N==null)break;l=await C(l,N),c++}while(c<_)}return l};t.options.persister?t.fetchFn=()=>{var w,v;return(v=(w=t.options).persister)==null?void 0:v.call(w,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function xi(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Do(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function Fc(e,t){return t?xi(e,t)!=null:!1}function zc(e,t){return!t||!e.getPreviousPageParam?!1:Do(e,t)!=null}var hn,Bt,pn,$e,Ut,ve,Yn,$t,qe,Fo,ft,ko,qc=(ko=class extends Oo{constructor(t){super();U(this,qe);U(this,hn);U(this,Bt);U(this,pn);U(this,$e);U(this,Ut);U(this,ve);U(this,Yn);U(this,$t);O(this,$t,!1),O(this,Yn,t.defaultOptions),this.setOptions(t.options),this.observers=[],O(this,Ut,t.client),O(this,$e,g(this,Ut).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,O(this,Bt,fa(this.options)),this.state=t.state??g(this,Bt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return g(this,hn)}get promise(){var t;return(t=g(this,ve))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,Yn),...t},t!=null&&t._type&&O(this,hn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=fa(this.options);n.data!==void 0&&(this.setState(ma(n.data,n.dataUpdatedAt)),O(this,Bt,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,$e).remove(this)}setData(t,n){const r=pi(this.state.data,t,this.options);return ee(this,qe,ft).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ee(this,qe,ft).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=g(this,ve))==null?void 0:r.promise;return(s=g(this,ve))==null||s.cancel(t),n?n.then(Ae).catch(Ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return g(this,Bt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Be(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>At(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ro(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,ve))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,ve))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,$e).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(g(this,ve)&&(g(this,$t)||ee(this,qe,Fo).call(this)?g(this,ve).cancel({revert:!0}):g(this,ve).cancelRetry()),this.scheduleGc()),g(this,$e).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ee(this,qe,ft).call(this,{type:"invalidate"})}async fetch(t,n){var u,d,h,m,p,b,w,v,y,C,_;if(this.state.fetchStatus!=="idle"&&((u=g(this,ve))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,ve))return g(this,ve).continueRetry(),g(this,ve).promise}if(t&&this.setOptions(t),!this.options.queryFn){const N=this.observers.find(F=>F.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,s=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(O(this,$t,!0),r.signal)})},a=()=>{const N=To(this.options,n),j=(()=>{const q={client:g(this,Ut),queryKey:this.queryKey,meta:this.meta};return s(q),q})();return O(this,$t,!1),this.options.persister?this.options.persister(N,j,this):N(j)},l=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,Ut),state:this.state,fetchFn:a};return s(N),N})(),c=g(this,hn)==="infinite"?Dc(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),O(this,pn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&ee(this,qe,ft).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta}),O(this,ve,Mo({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:N=>{N instanceof fi&&N.revert&&this.setState({...g(this,pn),fetchStatus:"idle"}),r.abort()},onFail:(N,F)=>{ee(this,qe,ft).call(this,{type:"failed",failureCount:N,error:F})},onPause:()=>{ee(this,qe,ft).call(this,{type:"pause"})},onContinue:()=>{ee(this,qe,ft).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const N=await g(this,ve).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(p=(m=g(this,$e).config).onSuccess)==null||p.call(m,N,this),(w=(b=g(this,$e).config).onSettled)==null||w.call(b,N,this.state.error,this),N}catch(N){if(N instanceof fi){if(N.silent)return g(this,ve).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw ee(this,qe,ft).call(this,{type:"error",error:N}),(y=(v=g(this,$e).config).onError)==null||y.call(v,N,this),(_=(C=g(this,$e).config).onSettled)==null||_.call(C,this.state.data,N,this),N}finally{this.scheduleGc()}}},hn=new WeakMap,Bt=new WeakMap,pn=new WeakMap,$e=new WeakMap,Ut=new WeakMap,ve=new WeakMap,Yn=new WeakMap,$t=new WeakMap,qe=new WeakSet,Fo=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ft=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...zo(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...ma(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return O(this,pn,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),je.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,$e).notify({query:this,type:"updated",action:t})})},ko);function zo(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lo(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ma(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function fa(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Te,te,Zn,Ee,Ht,mn,xt,Et,er,fn,xn,Kt,Qt,Pt,gn,re,zn,gi,bi,yi,wi,vi,ji,ki,Bo,No,qo=(No=class extends lr{constructor(t,n){super();U(this,re);U(this,Te);U(this,te);U(this,Zn);U(this,Ee);U(this,Ht);U(this,mn);U(this,xt);U(this,Et);U(this,er);U(this,fn);U(this,xn);U(this,Kt);U(this,Qt);U(this,Pt);U(this,gn,new Set);this.options=n,O(this,Te,t),O(this,Et,null),O(this,xt,mi()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,te).addObserver(this),xa(g(this,te),this.options)?ee(this,re,zn).call(this):this.updateResult(),ee(this,re,wi).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ni(g(this,te),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ni(g(this,te),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ee(this,re,vi).call(this),ee(this,re,ji).call(this),g(this,te).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,te);if(this.options=g(this,Te).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Be(this.options.enabled,g(this,te))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ee(this,re,ki).call(this),g(this,te).setOptions(this.options),n._defaulted&&!di(this.options,n)&&g(this,Te).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,te),observer:this});const s=this.hasListeners();s&&ga(g(this,te),r,this.options,n)&&ee(this,re,zn).call(this),this.updateResult(),s&&(g(this,te)!==r||Be(this.options.enabled,g(this,te))!==Be(n.enabled,g(this,te))||At(this.options.staleTime,g(this,te))!==At(n.staleTime,g(this,te)))&&ee(this,re,gi).call(this);const a=ee(this,re,bi).call(this);s&&(g(this,te)!==r||Be(this.options.enabled,g(this,te))!==Be(n.enabled,g(this,te))||a!==g(this,Pt))&&ee(this,re,yi).call(this,a)}getOptimisticResult(t){const n=g(this,Te).getQueryCache().build(g(this,Te),t),r=this.createResult(n,t);return Uc(this,r)&&(O(this,Ee,r),O(this,mn,this.options),O(this,Ht,g(this,te).state)),r}getCurrentResult(){return g(this,Ee)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,xt).status==="pending"&&g(this,xt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){g(this,gn).add(t)}getCurrentQuery(){return g(this,te)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,Te).defaultQueryOptions(t),r=g(this,Te).getQueryCache().build(g(this,Te),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ee(this,re,zn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,Ee)))}createResult(t,n){var R;const r=g(this,te),s=this.options,a=g(this,Ee),o=g(this,Ht),l=g(this,mn),u=t!==r?t.state:g(this,Zn),{state:d}=t;let h={...d},m=!1,p;if(n._optimisticResults){const z=this.hasListeners(),k=!z&&xa(t,n),E=z&&ga(t,r,n,s);(k||E)&&(h={...h,...zo(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:v}=h;p=h.data;let y=!1;if(n.placeholderData!==void 0&&p===void 0&&v==="pending"){let z;a!=null&&a.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(z=a.data,y=!0):z=typeof n.placeholderData=="function"?n.placeholderData((R=g(this,xn))==null?void 0:R.state.data,g(this,xn)):n.placeholderData,z!==void 0&&(v="success",p=pi(a==null?void 0:a.data,z,n),m=!0)}if(n.select&&p!==void 0&&!y)if(a&&p===(o==null?void 0:o.data)&&n.select===g(this,er))p=g(this,fn);else try{O(this,er,n.select),p=n.select(p),p=pi(a==null?void 0:a.data,p,n),O(this,fn,p),O(this,Et,null)}catch(z){O(this,Et,z)}g(this,Et)&&(b=g(this,Et),p=g(this,fn),w=Date.now(),v="error");const C=h.fetchStatus==="fetching",_=v==="pending",N=v==="error",F=_&&C,j=p!==void 0,M={status:v,fetchStatus:h.fetchStatus,isPending:_,isSuccess:v==="success",isError:N,isInitialLoading:F,isLoading:F,data:p,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!_,isLoadingError:N&&!j,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&j,isStale:Ki(t,n),refetch:this.refetch,promise:g(this,xt),isEnabled:Be(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=M.data!==void 0,k=M.status==="error"&&!z,E=P=>{k?P.reject(M.error):z&&P.resolve(M.data)},X=()=>{const P=O(this,xt,M.promise=mi());E(P)},D=g(this,xt);switch(D.status){case"pending":t.queryHash===r.queryHash&&E(D);break;case"fulfilled":(k||M.data!==D.value)&&X();break;case"rejected":(!k||M.error!==D.reason)&&X();break}}return M}updateResult(){const t=g(this,Ee),n=this.createResult(g(this,te),this.options);if(O(this,Ht,g(this,te).state),O(this,mn,this.options),g(this,Ht).data!==void 0&&O(this,xn,g(this,te)),di(n,t))return;O(this,Ee,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!g(this,gn).size)return!0;const o=new Set(a??g(this,gn));return this.options.throwOnError&&o.add("error"),Object.keys(g(this,Ee)).some(l=>{const c=l;return g(this,Ee)[c]!==t[c]&&o.has(c)})};ee(this,re,Bo).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ee(this,re,wi).call(this)}},Te=new WeakMap,te=new WeakMap,Zn=new WeakMap,Ee=new WeakMap,Ht=new WeakMap,mn=new WeakMap,xt=new WeakMap,Et=new WeakMap,er=new WeakMap,fn=new WeakMap,xn=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Pt=new WeakMap,gn=new WeakMap,re=new WeakSet,zn=function(t){ee(this,re,ki).call(this);let n=g(this,te).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ae)),n},gi=function(){ee(this,re,vi).call(this);const t=At(this.options.staleTime,g(this,te));if(Vn.isServer()||g(this,Ee).isStale||!ui(t))return;const r=Ro(g(this,Ee).dataUpdatedAt,t)+1;O(this,Kt,Ft.setTimeout(()=>{g(this,Ee).isStale||this.updateResult()},r))},bi=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,te)):this.options.refetchInterval)??!1},yi=function(t){ee(this,re,ji).call(this),O(this,Pt,t),!(Vn.isServer()||Be(this.options.enabled,g(this,te))===!1||!ui(g(this,Pt))||g(this,Pt)===0)&&O(this,Qt,Ft.setInterval(()=>{(this.options.refetchIntervalInBackground||Ui.isFocused())&&ee(this,re,zn).call(this)},g(this,Pt)))},wi=function(){ee(this,re,gi).call(this),ee(this,re,yi).call(this,ee(this,re,bi).call(this))},vi=function(){g(this,Kt)!==void 0&&(Ft.clearTimeout(g(this,Kt)),O(this,Kt,void 0))},ji=function(){g(this,Qt)!==void 0&&(Ft.clearInterval(g(this,Qt)),O(this,Qt,void 0))},ki=function(){const t=g(this,Te).getQueryCache().build(g(this,Te),this.options);if(t===g(this,te))return;const n=g(this,te);O(this,te,t),O(this,Zn,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Bo=function(t){je.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,Ee))}),g(this,Te).getQueryCache().notify({query:g(this,te),type:"observerResultsUpdated"})})},No);function Bc(e,t){return Be(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Be(t.retryOnMount,e)===!1)}function xa(e,t){return Bc(e,t)||e.state.data!==void 0&&Ni(e,t,t.refetchOnMount)}function Ni(e,t,n){if(Be(t.enabled,e)!==!1&&At(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ki(e,t)}return!1}function ga(e,t,n,r){return(e!==t||Be(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ki(e,n)}function Ki(e,t){return Be(t.enabled,e)!==!1&&e.isStaleByTime(At(t.staleTime,e))}function Uc(e,t){return!di(e.getCurrentResult(),t)}var $c=class extends qo{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var b,w;const{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:o,isRefetchError:l}=r,c=(w=(b=n.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:w.direction,u=o&&c==="forward",d=s&&c==="forward",h=o&&c==="backward",m=s&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Fc(t,n.data),hasPreviousPage:zc(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:h,isFetchingPreviousPage:m,isRefetchError:l&&!u&&!h,isRefetching:a&&!d&&!m}}},tr,rt,Ne,Vt,it,Nt,So,Hc=(So=class extends Oo{constructor(t){super();U(this,it);U(this,tr);U(this,rt);U(this,Ne);U(this,Vt);O(this,tr,t.client),this.mutationId=t.mutationId,O(this,Ne,t.mutationCache),O(this,rt,[]),this.state=t.state||Kc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){g(this,rt).includes(t)||(g(this,rt).push(t),this.clearGcTimeout(),g(this,Ne).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){O(this,rt,g(this,rt).filter(n=>n!==t)),this.scheduleGc(),g(this,Ne).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,rt).length||(this.state.status==="pending"?this.scheduleGc():g(this,Ne).remove(this))}continue(){var t;return((t=g(this,Vt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,d,h,m,p,b,w,v,y,C,_,N,F,j,q;const n=()=>{ee(this,it,Nt).call(this,{type:"continue"})},r={client:g(this,tr),meta:this.options.meta,mutationKey:this.options.mutationKey};O(this,Vt,Mo({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,R)=>{ee(this,it,Nt).call(this,{type:"failed",failureCount:M,error:R})},onPause:()=>{ee(this,it,Nt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,Ne).canRun(this)}));const s=this.state.status==="pending",a=!g(this,Vt).canStart();try{if(s)n();else{ee(this,it,Nt).call(this,{type:"pending",variables:t,isPaused:a}),g(this,Ne).config.onMutate&&await g(this,Ne).config.onMutate(t,this,r);const R=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));R!==this.state.context&&ee(this,it,Nt).call(this,{type:"pending",context:R,variables:t,isPaused:a})}const M=await g(this,Vt).start();return await((u=(c=g(this,Ne).config).onSuccess)==null?void 0:u.call(c,M,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,M,t,this.state.context,r)),await((p=(m=g(this,Ne).config).onSettled)==null?void 0:p.call(m,M,null,this.state.variables,this.state.context,this,r)),await((w=(b=this.options).onSettled)==null?void 0:w.call(b,M,null,t,this.state.context,r)),ee(this,it,Nt).call(this,{type:"success",data:M}),M}catch(M){try{await((y=(v=g(this,Ne).config).onError)==null?void 0:y.call(v,M,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((_=(C=this.options).onError)==null?void 0:_.call(C,M,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((F=(N=g(this,Ne).config).onSettled)==null?void 0:F.call(N,void 0,M,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((q=(j=this.options).onSettled)==null?void 0:q.call(j,void 0,M,t,this.state.context,r))}catch(R){Promise.reject(R)}throw ee(this,it,Nt).call(this,{type:"error",error:M}),M}finally{g(this,Ne).runNext(this)}}},tr=new WeakMap,rt=new WeakMap,Ne=new WeakMap,Vt=new WeakMap,it=new WeakSet,Nt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),je.batch(()=>{g(this,rt).forEach(r=>{r.onMutationUpdate(t)}),g(this,Ne).notify({mutation:this,type:"updated",action:t})})},So);function Kc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gt,Je,nr,Co,Qc=(Co=class extends lr{constructor(t={}){super();U(this,gt);U(this,Je);U(this,nr);this.config=t,O(this,gt,new Set),O(this,Je,new Map),O(this,nr,0)}build(t,n,r){const s=new Hc({client:t,mutationCache:this,mutationId:++vr(this,nr)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){g(this,gt).add(t);const n=kr(t);if(typeof n=="string"){const r=g(this,Je).get(n);r?r.push(t):g(this,Je).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,gt).delete(t)){const n=kr(t);if(typeof n=="string"){const r=g(this,Je).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&g(this,Je).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=kr(t);if(typeof n=="string"){const r=g(this,Je).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=kr(t);if(typeof n=="string"){const s=(r=g(this,Je).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){je.batch(()=>{g(this,gt).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,gt).clear(),g(this,Je).clear()})}getAll(){return Array.from(g(this,gt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>da(n,r))}findAll(t={}){return this.getAll().filter(n=>da(t,n))}notify(t){je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return je.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ae))))}},gt=new WeakMap,Je=new WeakMap,nr=new WeakMap,Co);function kr(e){var t;return(t=e.options.scope)==null?void 0:t.id}var st,_o,Vc=(_o=class extends lr{constructor(t={}){super();U(this,st);this.config=t,O(this,st,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??$i(s,n);let o=this.get(a);return o||(o=new qc({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){g(this,st).has(t.queryHash)||(g(this,st).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,st).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,st).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,st).get(t)}getAll(){return[...g(this,st).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ua(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ua(t,r)):n}notify(t){je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){je.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){je.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},st=new WeakMap,_o),ge,Rt,It,bn,yn,Tt,wn,vn,Eo,Wc=(Eo=class{constructor(e={}){U(this,ge);U(this,Rt);U(this,It);U(this,bn);U(this,yn);U(this,Tt);U(this,wn);U(this,vn);O(this,ge,e.queryCache||new Vc),O(this,Rt,e.mutationCache||new Qc),O(this,It,e.defaultOptions||{}),O(this,bn,new Map),O(this,yn,new Map),O(this,Tt,0)}mount(){vr(this,Tt)._++,g(this,Tt)===1&&(O(this,wn,Ui.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ge).onFocus())})),O(this,vn,Ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ge).onOnline())})))}unmount(){var e,t;vr(this,Tt)._--,g(this,Tt)===0&&((e=g(this,wn))==null||e.call(this),O(this,wn,void 0),(t=g(this,vn))==null||t.call(this),O(this,vn,void 0))}isFetching(e){return g(this,ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Rt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ge).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,ge).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(At(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,ge).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=g(this,ge).get(r.queryHash),a=s==null?void 0:s.state.data,o=_c(t,a);if(o!==void 0)return g(this,ge).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return je.batch(()=>g(this,ge).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ge).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,ge);je.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,ge);return je.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=je.batch(()=>g(this,ge).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ae).catch(Ae)}invalidateQueries(e,t={}){return je.batch(()=>(g(this,ge).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=je.batch(()=>g(this,ge).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ae)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ae)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,ge).build(this,t);return n.isStaleByTime(At(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ae).catch(Ae)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ae).catch(Ae)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ar.isOnline()?g(this,Rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,ge)}getMutationCache(){return g(this,Rt)}getDefaultOptions(){return g(this,It)}setDefaultOptions(e){O(this,It,e)}setQueryDefaults(e,t){g(this,bn).set(Kn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,bn).values()],n={};return t.forEach(r=>{Qn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,yn).set(Kn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,yn).values()],n={};return t.forEach(r=>{Qn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,It).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=$i(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Hi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...g(this,It).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,ge).clear(),g(this,Rt).clear()}},ge=new WeakMap,Rt=new WeakMap,It=new WeakMap,bn=new WeakMap,yn=new WeakMap,Tt=new WeakMap,wn=new WeakMap,vn=new WeakMap,Eo),Uo=ke.createContext(void 0),$o=e=>{const t=ke.useContext(Uo);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gc=({client:e,children:t})=>(ke.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(Uo.Provider,{value:e,children:t})),Ho=ke.createContext(!1),Jc=()=>ke.useContext(Ho);Ho.Provider;function Xc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Yc=ke.createContext(Xc()),Zc=()=>ke.useContext(Yc),eu=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ao(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tu=e=>{ke.useEffect(()=>{e.clearReset()},[e])},nu=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Ao(n,[e.error,r])),ru=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},iu=(e,t)=>e.isLoading&&e.isFetching&&!t,su=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ba=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ko(e,t,n){var m,p,b,w;const r=Jc(),s=Zc(),a=$o(),o=a.defaultQueryOptions(e);(p=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||p.call(m,o);const l=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",ru(o),eu(o,s,l),tu(s);const c=!a.getQueryCache().get(o.queryHash),[u]=ke.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),h=!r&&e.subscribed!==!1;if(ke.useSyncExternalStore(ke.useCallback(v=>{const y=h?u.subscribe(je.batchCalls(v)):Ae;return u.updateResult(),y},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),ke.useEffect(()=>{u.setOptions(o)},[o,u]),su(o,d))throw ba(o,u,s);if(nu({result:d,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw d.error;if((w=(b=a.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||w.call(b,o,d),o.experimental_prefetchInRender&&!Vn.isServer()&&iu(d,r)){const v=c?ba(o,u,s):l==null?void 0:l.promise;v==null||v.catch(Ae).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?d:u.trackResult(d)}function xe(e,t){return Ko(e,qo)}function ya(e,t){return Ko(e,$c)}/** + */var oa;function gc(){if(oa)return In;oa=1;var e=hc(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,u){var d,h={},m=null,p=null;u!==void 0&&(m=""+u),c.key!==void 0&&(m=""+c.key),c.ref!==void 0&&(p=c.ref);for(d in c)r.call(c,d)&&!a.hasOwnProperty(d)&&(h[d]=c[d]);if(l&&l.defaultProps)for(d in c=l.defaultProps,c)h[d]===void 0&&(h[d]=c[d]);return{$$typeof:t,type:l,key:m,ref:p,props:h,_owner:s.current}}return In.Fragment=n,In.jsx=o,In.jsxs=o,In}var la;function bc(){return la||(la=1,Qr.exports=gc()),Qr.exports}var i=bc(),jr={},ca;function yc(){if(ca)return jr;ca=1;var e=pc();return jr.createRoot=e.createRoot,jr.hydrateRoot=e.hydrateRoot,jr}var wc=yc();const vc=Bi(wc);var lr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},zt,St,cn,yo,jc=(yo=class extends lr{constructor(){super();U(this,zt);U(this,St);U(this,cn);O(this,cn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,St)||this.setEventListener(g(this,cn))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,St))==null||t.call(this),O(this,St,void 0))}setEventListener(t){var n;O(this,cn,t),(n=g(this,St))==null||n.call(this),O(this,St,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,zt)!==t&&(O(this,zt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,zt)=="boolean"?g(this,zt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zt=new WeakMap,St=new WeakMap,cn=new WeakMap,yo),Ui=new jc,kc={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,qi,wo,Nc=(wo=class{constructor(){U(this,Ct,kc);U(this,qi,!1)}setTimeoutProvider(e){O(this,Ct,e)}setTimeout(e,t){return g(this,Ct).setTimeout(e,t)}clearTimeout(e){g(this,Ct).clearTimeout(e)}setInterval(e,t){return g(this,Ct).setInterval(e,t)}clearInterval(e){g(this,Ct).clearInterval(e)}},Ct=new WeakMap,qi=new WeakMap,wo),Ft=new Nc;function Sc(e){setTimeout(e,0)}var Cc=typeof window>"u"||"Deno"in globalThis;function Ae(){}function _c(e,t){return typeof e=="function"?e(t):e}function ui(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ro(e,t){return Math.max(e+(t||0)-Date.now(),0)}function At(e,t){return typeof e=="function"?e(t):e}function Be(e,t){return typeof e=="function"?e(t):e}function ua(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==$i(o,t.options))return!1}else if(!Qn(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||a&&!a(t))}function da(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Kn(t.options.mutationKey)!==Kn(a))return!1}else if(!Qn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function $i(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kn)(e)}function Kn(e){return JSON.stringify(e,(t,n)=>hi(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qn(e[n],t[n])):!1}var Ec=Object.prototype.hasOwnProperty;function Io(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ha(e)&&ha(t);if(!r&&!(hi(e)&&hi(t)))return t;const a=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let u=0;for(let d=0;d{Ft.setTimeout(t,e)})}function pi(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Io(e,t):t}function Rc(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Ic(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Hi=Symbol();function To(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Hi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ao(e,t){return typeof e=="function"?e(...t):!!e}function Tc(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Vn=(()=>{let e=()=>Cc;return{isServer(){return e()},setIsServer(t){e=t}}})();function mi(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Ac=Sc;function Lc(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=Ac;const a=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var ke=Lc(),un,_t,dn,vo,Mc=(vo=class extends lr{constructor(){super();U(this,un,!0);U(this,_t);U(this,dn);O(this,dn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){g(this,_t)||this.setEventListener(g(this,dn))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,_t))==null||t.call(this),O(this,_t,void 0))}setEventListener(t){var n;O(this,dn,t),(n=g(this,_t))==null||n.call(this),O(this,_t,t(this.setOnline.bind(this)))}setOnline(t){g(this,un)!==t&&(O(this,un,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,un)}},un=new WeakMap,_t=new WeakMap,dn=new WeakMap,vo),Ar=new Mc;function Oc(e){return Math.min(1e3*2**e,3e4)}function Lo(e){return(e??"online")==="online"?Ar.isOnline():!0}var fi=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Mo(e){let t=!1,n=0,r;const s=mi(),a=()=>s.status!=="pending",o=b=>{var v;if(!a()){const y=new fi(b);m(y),(v=e.onCancel)==null||v.call(e,y)}},l=()=>{t=!0},c=()=>{t=!1},u=()=>Ui.isFocused()&&(e.networkMode==="always"||Ar.isOnline())&&e.canRun(),d=()=>Lo(e.networkMode)&&e.canRun(),h=b=>{a()||(r==null||r(),s.resolve(b))},m=b=>{a()||(r==null||r(),s.reject(b))},p=()=>new Promise(b=>{var v;r=y=>{(a()||u())&&b(y)},(v=e.onPause)==null||v.call(e)}).then(()=>{var b;r=void 0,a()||(b=e.onContinue)==null||b.call(e)}),w=()=>{if(a())return;let b;const v=n===0?e.initialPromise:void 0;try{b=v??e.fn()}catch(y){b=Promise.reject(y)}Promise.resolve(b).then(h).catch(y=>{var k;if(a())return;const j=e.retry??(Vn.isServer()?0:3),_=e.retryDelay??Oc,S=typeof _=="function"?_(n,y):_,F=j===!0||typeof j=="number"&&nu()?void 0:p()).then(()=>{t?m(y):w()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?w():p().then(w),s)}}var qt,jo,Oo=(jo=class{constructor(){U(this,qt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ui(this.gcTime)&&O(this,qt,Ft.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vn.isServer()?1/0:300*1e3))}clearGcTimeout(){g(this,qt)!==void 0&&(Ft.clearTimeout(g(this,qt)),O(this,qt,void 0))}},qt=new WeakMap,jo);function Dc(e){return{onFetch:(t,n)=>{var d,h,m,p,w;const r=t.options,s=(m=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,a=((p=t.state.data)==null?void 0:p.pages)||[],o=((w=t.state.data)==null?void 0:w.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let b=!1;const v=_=>{Tc(_,()=>t.signal,()=>b=!0)},y=To(t.options,t.fetchOptions),j=async(_,S,F)=>{if(b)return Promise.reject(t.signal.reason);if(S==null&&_.pages.length)return Promise.resolve(_);const q=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:S,direction:F?"backward":"forward",meta:t.options.meta};return v(N),N})(),M=await y(q),{maxPages:R}=t.options,z=F?Ic:Rc;return{pages:z(_.pages,M,R),pageParams:z(_.pageParams,S,R)}};if(s&&a.length){const _=s==="backward",S=_?Do:xi,F={pages:a,pageParams:o},k=S(r,F);l=await j(F,k,_)}else{const _=e??a.length;do{const S=c===0?o[0]??r.initialPageParam:xi(r,l);if(c>0&&S==null)break;l=await j(l,S),c++}while(c<_)}return l};t.options.persister?t.fetchFn=()=>{var b,v;return(v=(b=t.options).persister)==null?void 0:v.call(b,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function xi(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Do(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function Fc(e,t){return t?xi(e,t)!=null:!1}function zc(e,t){return!t||!e.getPreviousPageParam?!1:Do(e,t)!=null}var hn,Bt,pn,$e,Ut,je,Yn,$t,qe,Fo,ft,ko,qc=(ko=class extends Oo{constructor(t){super();U(this,qe);U(this,hn);U(this,Bt);U(this,pn);U(this,$e);U(this,Ut);U(this,je);U(this,Yn);U(this,$t);O(this,$t,!1),O(this,Yn,t.defaultOptions),this.setOptions(t.options),this.observers=[],O(this,Ut,t.client),O(this,$e,g(this,Ut).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,O(this,Bt,fa(this.options)),this.state=t.state??g(this,Bt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return g(this,hn)}get promise(){var t;return(t=g(this,je))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,Yn),...t},t!=null&&t._type&&O(this,hn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=fa(this.options);n.data!==void 0&&(this.setState(ma(n.data,n.dataUpdatedAt)),O(this,Bt,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,$e).remove(this)}setData(t,n){const r=pi(this.state.data,t,this.options);return ee(this,qe,ft).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ee(this,qe,ft).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=g(this,je))==null?void 0:r.promise;return(s=g(this,je))==null||s.cancel(t),n?n.then(Ae).catch(Ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return g(this,Bt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Be(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>At(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ro(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,je))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,je))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,$e).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(g(this,je)&&(g(this,$t)||ee(this,qe,Fo).call(this)?g(this,je).cancel({revert:!0}):g(this,je).cancelRetry()),this.scheduleGc()),g(this,$e).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ee(this,qe,ft).call(this,{type:"invalidate"})}async fetch(t,n){var u,d,h,m,p,w,b,v,y,j,_;if(this.state.fetchStatus!=="idle"&&((u=g(this,je))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,je))return g(this,je).continueRetry(),g(this,je).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(F=>F.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,s=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(O(this,$t,!0),r.signal)})},a=()=>{const S=To(this.options,n),k=(()=>{const q={client:g(this,Ut),queryKey:this.queryKey,meta:this.meta};return s(q),q})();return O(this,$t,!1),this.options.persister?this.options.persister(S,k,this):S(k)},l=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,Ut),state:this.state,fetchFn:a};return s(S),S})(),c=g(this,hn)==="infinite"?Dc(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),O(this,pn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&ee(this,qe,ft).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta}),O(this,je,Mo({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:S=>{S instanceof fi&&S.revert&&this.setState({...g(this,pn),fetchStatus:"idle"}),r.abort()},onFail:(S,F)=>{ee(this,qe,ft).call(this,{type:"failed",failureCount:S,error:F})},onPause:()=>{ee(this,qe,ft).call(this,{type:"pause"})},onContinue:()=>{ee(this,qe,ft).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const S=await g(this,je).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(m=g(this,$e).config).onSuccess)==null||p.call(m,S,this),(b=(w=g(this,$e).config).onSettled)==null||b.call(w,S,this.state.error,this),S}catch(S){if(S instanceof fi){if(S.silent)return g(this,je).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw ee(this,qe,ft).call(this,{type:"error",error:S}),(y=(v=g(this,$e).config).onError)==null||y.call(v,S,this),(_=(j=g(this,$e).config).onSettled)==null||_.call(j,this.state.data,S,this),S}finally{this.scheduleGc()}}},hn=new WeakMap,Bt=new WeakMap,pn=new WeakMap,$e=new WeakMap,Ut=new WeakMap,je=new WeakMap,Yn=new WeakMap,$t=new WeakMap,qe=new WeakSet,Fo=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ft=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...zo(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...ma(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return O(this,pn,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ke.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,$e).notify({query:this,type:"updated",action:t})})},ko);function zo(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lo(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ma(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function fa(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Te,te,Zn,Pe,Ht,mn,xt,Et,er,fn,xn,Kt,Qt,Pt,gn,re,zn,gi,bi,yi,wi,vi,ji,ki,Bo,No,qo=(No=class extends lr{constructor(t,n){super();U(this,re);U(this,Te);U(this,te);U(this,Zn);U(this,Pe);U(this,Ht);U(this,mn);U(this,xt);U(this,Et);U(this,er);U(this,fn);U(this,xn);U(this,Kt);U(this,Qt);U(this,Pt);U(this,gn,new Set);this.options=n,O(this,Te,t),O(this,Et,null),O(this,xt,mi()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,te).addObserver(this),xa(g(this,te),this.options)?ee(this,re,zn).call(this):this.updateResult(),ee(this,re,wi).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ni(g(this,te),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ni(g(this,te),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ee(this,re,vi).call(this),ee(this,re,ji).call(this),g(this,te).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,te);if(this.options=g(this,Te).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Be(this.options.enabled,g(this,te))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ee(this,re,ki).call(this),g(this,te).setOptions(this.options),n._defaulted&&!di(this.options,n)&&g(this,Te).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,te),observer:this});const s=this.hasListeners();s&&ga(g(this,te),r,this.options,n)&&ee(this,re,zn).call(this),this.updateResult(),s&&(g(this,te)!==r||Be(this.options.enabled,g(this,te))!==Be(n.enabled,g(this,te))||At(this.options.staleTime,g(this,te))!==At(n.staleTime,g(this,te)))&&ee(this,re,gi).call(this);const a=ee(this,re,bi).call(this);s&&(g(this,te)!==r||Be(this.options.enabled,g(this,te))!==Be(n.enabled,g(this,te))||a!==g(this,Pt))&&ee(this,re,yi).call(this,a)}getOptimisticResult(t){const n=g(this,Te).getQueryCache().build(g(this,Te),t),r=this.createResult(n,t);return Uc(this,r)&&(O(this,Pe,r),O(this,mn,this.options),O(this,Ht,g(this,te).state)),r}getCurrentResult(){return g(this,Pe)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,xt).status==="pending"&&g(this,xt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){g(this,gn).add(t)}getCurrentQuery(){return g(this,te)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,Te).defaultQueryOptions(t),r=g(this,Te).getQueryCache().build(g(this,Te),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ee(this,re,zn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,Pe)))}createResult(t,n){var R;const r=g(this,te),s=this.options,a=g(this,Pe),o=g(this,Ht),l=g(this,mn),u=t!==r?t.state:g(this,Zn),{state:d}=t;let h={...d},m=!1,p;if(n._optimisticResults){const z=this.hasListeners(),N=!z&&xa(t,n),E=z&&ga(t,r,n,s);(N||E)&&(h={...h,...zo(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:w,errorUpdatedAt:b,status:v}=h;p=h.data;let y=!1;if(n.placeholderData!==void 0&&p===void 0&&v==="pending"){let z;a!=null&&a.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(z=a.data,y=!0):z=typeof n.placeholderData=="function"?n.placeholderData((R=g(this,xn))==null?void 0:R.state.data,g(this,xn)):n.placeholderData,z!==void 0&&(v="success",p=pi(a==null?void 0:a.data,z,n),m=!0)}if(n.select&&p!==void 0&&!y)if(a&&p===(o==null?void 0:o.data)&&n.select===g(this,er))p=g(this,fn);else try{O(this,er,n.select),p=n.select(p),p=pi(a==null?void 0:a.data,p,n),O(this,fn,p),O(this,Et,null)}catch(z){O(this,Et,z)}g(this,Et)&&(w=g(this,Et),p=g(this,fn),b=Date.now(),v="error");const j=h.fetchStatus==="fetching",_=v==="pending",S=v==="error",F=_&&j,k=p!==void 0,M={status:v,fetchStatus:h.fetchStatus,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:F,isLoading:F,data:p,dataUpdatedAt:h.dataUpdatedAt,error:w,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:j,isRefetching:j&&!_,isLoadingError:S&&!k,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:S&&k,isStale:Ki(t,n),refetch:this.refetch,promise:g(this,xt),isEnabled:Be(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=M.data!==void 0,N=M.status==="error"&&!z,E=P=>{N?P.reject(M.error):z&&P.resolve(M.data)},X=()=>{const P=O(this,xt,M.promise=mi());E(P)},D=g(this,xt);switch(D.status){case"pending":t.queryHash===r.queryHash&&E(D);break;case"fulfilled":(N||M.data!==D.value)&&X();break;case"rejected":(!N||M.error!==D.reason)&&X();break}}return M}updateResult(){const t=g(this,Pe),n=this.createResult(g(this,te),this.options);if(O(this,Ht,g(this,te).state),O(this,mn,this.options),g(this,Ht).data!==void 0&&O(this,xn,g(this,te)),di(n,t))return;O(this,Pe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!g(this,gn).size)return!0;const o=new Set(a??g(this,gn));return this.options.throwOnError&&o.add("error"),Object.keys(g(this,Pe)).some(l=>{const c=l;return g(this,Pe)[c]!==t[c]&&o.has(c)})};ee(this,re,Bo).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ee(this,re,wi).call(this)}},Te=new WeakMap,te=new WeakMap,Zn=new WeakMap,Pe=new WeakMap,Ht=new WeakMap,mn=new WeakMap,xt=new WeakMap,Et=new WeakMap,er=new WeakMap,fn=new WeakMap,xn=new WeakMap,Kt=new WeakMap,Qt=new WeakMap,Pt=new WeakMap,gn=new WeakMap,re=new WeakSet,zn=function(t){ee(this,re,ki).call(this);let n=g(this,te).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ae)),n},gi=function(){ee(this,re,vi).call(this);const t=At(this.options.staleTime,g(this,te));if(Vn.isServer()||g(this,Pe).isStale||!ui(t))return;const r=Ro(g(this,Pe).dataUpdatedAt,t)+1;O(this,Kt,Ft.setTimeout(()=>{g(this,Pe).isStale||this.updateResult()},r))},bi=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,te)):this.options.refetchInterval)??!1},yi=function(t){ee(this,re,ji).call(this),O(this,Pt,t),!(Vn.isServer()||Be(this.options.enabled,g(this,te))===!1||!ui(g(this,Pt))||g(this,Pt)===0)&&O(this,Qt,Ft.setInterval(()=>{(this.options.refetchIntervalInBackground||Ui.isFocused())&&ee(this,re,zn).call(this)},g(this,Pt)))},wi=function(){ee(this,re,gi).call(this),ee(this,re,yi).call(this,ee(this,re,bi).call(this))},vi=function(){g(this,Kt)!==void 0&&(Ft.clearTimeout(g(this,Kt)),O(this,Kt,void 0))},ji=function(){g(this,Qt)!==void 0&&(Ft.clearInterval(g(this,Qt)),O(this,Qt,void 0))},ki=function(){const t=g(this,Te).getQueryCache().build(g(this,Te),this.options);if(t===g(this,te))return;const n=g(this,te);O(this,te,t),O(this,Zn,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Bo=function(t){ke.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,Pe))}),g(this,Te).getQueryCache().notify({query:g(this,te),type:"observerResultsUpdated"})})},No);function Bc(e,t){return Be(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Be(t.retryOnMount,e)===!1)}function xa(e,t){return Bc(e,t)||e.state.data!==void 0&&Ni(e,t,t.refetchOnMount)}function Ni(e,t,n){if(Be(t.enabled,e)!==!1&&At(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ki(e,t)}return!1}function ga(e,t,n,r){return(e!==t||Be(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ki(e,n)}function Ki(e,t){return Be(t.enabled,e)!==!1&&e.isStaleByTime(At(t.staleTime,e))}function Uc(e,t){return!di(e.getCurrentResult(),t)}var $c=class extends qo{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var w,b;const{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:o,isRefetchError:l}=r,c=(b=(w=n.fetchMeta)==null?void 0:w.fetchMore)==null?void 0:b.direction,u=o&&c==="forward",d=s&&c==="forward",h=o&&c==="backward",m=s&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Fc(t,n.data),hasPreviousPage:zc(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:h,isFetchingPreviousPage:m,isRefetchError:l&&!u&&!h,isRefetching:a&&!d&&!m}}},tr,rt,Se,Vt,it,Nt,So,Hc=(So=class extends Oo{constructor(t){super();U(this,it);U(this,tr);U(this,rt);U(this,Se);U(this,Vt);O(this,tr,t.client),this.mutationId=t.mutationId,O(this,Se,t.mutationCache),O(this,rt,[]),this.state=t.state||Kc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){g(this,rt).includes(t)||(g(this,rt).push(t),this.clearGcTimeout(),g(this,Se).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){O(this,rt,g(this,rt).filter(n=>n!==t)),this.scheduleGc(),g(this,Se).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,rt).length||(this.state.status==="pending"?this.scheduleGc():g(this,Se).remove(this))}continue(){var t;return((t=g(this,Vt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,u,d,h,m,p,w,b,v,y,j,_,S,F,k,q;const n=()=>{ee(this,it,Nt).call(this,{type:"continue"})},r={client:g(this,tr),meta:this.options.meta,mutationKey:this.options.mutationKey};O(this,Vt,Mo({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,R)=>{ee(this,it,Nt).call(this,{type:"failed",failureCount:M,error:R})},onPause:()=>{ee(this,it,Nt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,Se).canRun(this)}));const s=this.state.status==="pending",a=!g(this,Vt).canStart();try{if(s)n();else{ee(this,it,Nt).call(this,{type:"pending",variables:t,isPaused:a}),g(this,Se).config.onMutate&&await g(this,Se).config.onMutate(t,this,r);const R=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));R!==this.state.context&&ee(this,it,Nt).call(this,{type:"pending",context:R,variables:t,isPaused:a})}const M=await g(this,Vt).start();return await((u=(c=g(this,Se).config).onSuccess)==null?void 0:u.call(c,M,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,M,t,this.state.context,r)),await((p=(m=g(this,Se).config).onSettled)==null?void 0:p.call(m,M,null,this.state.variables,this.state.context,this,r)),await((b=(w=this.options).onSettled)==null?void 0:b.call(w,M,null,t,this.state.context,r)),ee(this,it,Nt).call(this,{type:"success",data:M}),M}catch(M){try{await((y=(v=g(this,Se).config).onError)==null?void 0:y.call(v,M,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((_=(j=this.options).onError)==null?void 0:_.call(j,M,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((F=(S=g(this,Se).config).onSettled)==null?void 0:F.call(S,void 0,M,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((q=(k=this.options).onSettled)==null?void 0:q.call(k,void 0,M,t,this.state.context,r))}catch(R){Promise.reject(R)}throw ee(this,it,Nt).call(this,{type:"error",error:M}),M}finally{g(this,Se).runNext(this)}}},tr=new WeakMap,rt=new WeakMap,Se=new WeakMap,Vt=new WeakMap,it=new WeakSet,Nt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ke.batch(()=>{g(this,rt).forEach(r=>{r.onMutationUpdate(t)}),g(this,Se).notify({mutation:this,type:"updated",action:t})})},So);function Kc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gt,Je,nr,Co,Qc=(Co=class extends lr{constructor(t={}){super();U(this,gt);U(this,Je);U(this,nr);this.config=t,O(this,gt,new Set),O(this,Je,new Map),O(this,nr,0)}build(t,n,r){const s=new Hc({client:t,mutationCache:this,mutationId:++vr(this,nr)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){g(this,gt).add(t);const n=kr(t);if(typeof n=="string"){const r=g(this,Je).get(n);r?r.push(t):g(this,Je).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,gt).delete(t)){const n=kr(t);if(typeof n=="string"){const r=g(this,Je).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&g(this,Je).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=kr(t);if(typeof n=="string"){const r=g(this,Je).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=kr(t);if(typeof n=="string"){const s=(r=g(this,Je).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ke.batch(()=>{g(this,gt).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,gt).clear(),g(this,Je).clear()})}getAll(){return Array.from(g(this,gt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>da(n,r))}findAll(t={}){return this.getAll().filter(n=>da(t,n))}notify(t){ke.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ke.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ae))))}},gt=new WeakMap,Je=new WeakMap,nr=new WeakMap,Co);function kr(e){var t;return(t=e.options.scope)==null?void 0:t.id}var st,_o,Vc=(_o=class extends lr{constructor(t={}){super();U(this,st);this.config=t,O(this,st,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??$i(s,n);let o=this.get(a);return o||(o=new qc({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){g(this,st).has(t.queryHash)||(g(this,st).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,st).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,st).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ke.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,st).get(t)}getAll(){return[...g(this,st).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ua(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ua(t,r)):n}notify(t){ke.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ke.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ke.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},st=new WeakMap,_o),be,Rt,It,bn,yn,Tt,wn,vn,Eo,Wc=(Eo=class{constructor(e={}){U(this,be);U(this,Rt);U(this,It);U(this,bn);U(this,yn);U(this,Tt);U(this,wn);U(this,vn);O(this,be,e.queryCache||new Vc),O(this,Rt,e.mutationCache||new Qc),O(this,It,e.defaultOptions||{}),O(this,bn,new Map),O(this,yn,new Map),O(this,Tt,0)}mount(){vr(this,Tt)._++,g(this,Tt)===1&&(O(this,wn,Ui.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,be).onFocus())})),O(this,vn,Ar.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,be).onOnline())})))}unmount(){var e,t;vr(this,Tt)._--,g(this,Tt)===0&&((e=g(this,wn))==null||e.call(this),O(this,wn,void 0),(t=g(this,vn))==null||t.call(this),O(this,vn,void 0))}isFetching(e){return g(this,be).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,Rt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,be).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,be).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(At(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,be).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=g(this,be).get(r.queryHash),a=s==null?void 0:s.state.data,o=_c(t,a);if(o!==void 0)return g(this,be).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return ke.batch(()=>g(this,be).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,be).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,be);ke.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,be);return ke.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ke.batch(()=>g(this,be).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ae).catch(Ae)}invalidateQueries(e,t={}){return ke.batch(()=>(g(this,be).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ke.batch(()=>g(this,be).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ae)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ae)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,be).build(this,t);return n.isStaleByTime(At(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ae).catch(Ae)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ae).catch(Ae)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ar.isOnline()?g(this,Rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,be)}getMutationCache(){return g(this,Rt)}getDefaultOptions(){return g(this,It)}setDefaultOptions(e){O(this,It,e)}setQueryDefaults(e,t){g(this,bn).set(Kn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,bn).values()],n={};return t.forEach(r=>{Qn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,yn).set(Kn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,yn).values()],n={};return t.forEach(r=>{Qn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,It).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=$i(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Hi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...g(this,It).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,be).clear(),g(this,Rt).clear()}},be=new WeakMap,Rt=new WeakMap,It=new WeakMap,bn=new WeakMap,yn=new WeakMap,Tt=new WeakMap,wn=new WeakMap,vn=new WeakMap,Eo),Uo=Ne.createContext(void 0),$o=e=>{const t=Ne.useContext(Uo);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gc=({client:e,children:t})=>(Ne.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(Uo.Provider,{value:e,children:t})),Ho=Ne.createContext(!1),Jc=()=>Ne.useContext(Ho);Ho.Provider;function Xc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Yc=Ne.createContext(Xc()),Zc=()=>Ne.useContext(Yc),eu=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ao(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tu=e=>{Ne.useEffect(()=>{e.clearReset()},[e])},nu=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Ao(n,[e.error,r])),ru=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},iu=(e,t)=>e.isLoading&&e.isFetching&&!t,su=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ba=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ko(e,t,n){var m,p,w,b;const r=Jc(),s=Zc(),a=$o(),o=a.defaultQueryOptions(e);(p=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||p.call(m,o);const l=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",ru(o),eu(o,s,l),tu(s);const c=!a.getQueryCache().get(o.queryHash),[u]=Ne.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),h=!r&&e.subscribed!==!1;if(Ne.useSyncExternalStore(Ne.useCallback(v=>{const y=h?u.subscribe(ke.batchCalls(v)):Ae;return u.updateResult(),y},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Ne.useEffect(()=>{u.setOptions(o)},[o,u]),su(o,d))throw ba(o,u,s);if(nu({result:d,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw d.error;if((b=(w=a.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||b.call(w,o,d),o.experimental_prefetchInRender&&!Vn.isServer()&&iu(d,r)){const v=c?ba(o,u,s):l==null?void 0:l.promise;v==null||v.catch(Ae).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?d:u.trackResult(d)}function ge(e,t){return Ko(e,qo)}function ya(e,t){return Ko(e,$c)}/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. @@ -21,161 +21,161 @@ var aa=e=>{throw TypeError(e)};var Kr=(e,t,n)=>t.has(e)||aa("Cannot "+n);var g=( * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lu=ke.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...l},c)=>ke.createElement("svg",{ref:c,...ou,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Qo("lucide",s),...l},[...o.map(([u,d])=>ke.createElement(u,d)),...Array.isArray(a)?a:[a]]));/** + */const lu=Ne.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...l},c)=>Ne.createElement("svg",{ref:c,...ou,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Qo("lucide",s),...l},[...o.map(([u,d])=>Ne.createElement(u,d)),...Array.isArray(a)?a:[a]]));/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ue=(e,t)=>{const n=ke.forwardRef(({className:r,...s},a)=>ke.createElement(lu,{ref:a,iconNode:t,className:Qo(`lucide-${au(e)}`,r),...s}));return n.displayName=`${e}`,n};/** + */const de=(e,t)=>{const n=Ne.forwardRef(({className:r,...s},a)=>Ne.createElement(lu,{ref:a,iconNode:t,className:Qo(`lucide-${au(e)}`,r),...s}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jt=ue("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const Jt=de("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Qi=ue("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const Qi=de("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vo=ue("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/** + */const Vo=de("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vi=ue("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const Vi=de("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jn=ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const jn=de("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kn=ue("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const kn=de("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wn=ue("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const Wn=de("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wo=ue("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** + */const Wo=de("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wa=ue("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const wa=de("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xt=ue("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + */const Xt=de("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Go=ue("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const Go=de("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cu=ue("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + */const cu=de("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uu=ue("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** + */const uu=de("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lr=ue("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** + */const Lr=de("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Nn=ue("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + */const Nn=de("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const du=ue("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const du=de("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cr=ue("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const cr=de("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gn=ue("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const Gn=de("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hu=ue("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + */const hu=de("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pu=ue("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const pu=de("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jo=ue("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const Jo=de("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xo=ue("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + */const Xo=de("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mu=ue("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** + */const mu=de("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Si=ue("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const Si=de("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Br=ue("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const Br=de("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fu=ue("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const fu=de("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Yt=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function xu(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const gu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bu=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yu={};function va(e,t){return(yu.jsx?bu:gu).test(e)}const wu=/[ \t\n\f\r]/g;function vu(e){return typeof e=="object"?e.type==="text"?ja(e.value):!1:ja(e)}function ja(e){return e.replace(wu,"")===""}class ur{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ur.prototype.normal={};ur.prototype.property={};ur.prototype.space=void 0;function Yo(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ur(n,r,t)}function Ci(e){return e.toLowerCase()}class Me{constructor(t,n){this.attribute=n,this.property=t}}Me.prototype.attribute="";Me.prototype.booleanish=!1;Me.prototype.boolean=!1;Me.prototype.commaOrSpaceSeparated=!1;Me.prototype.commaSeparated=!1;Me.prototype.defined=!1;Me.prototype.mustUseProperty=!1;Me.prototype.number=!1;Me.prototype.overloadedBoolean=!1;Me.prototype.property="";Me.prototype.spaceSeparated=!1;Me.prototype.space=void 0;let ju=0;const Q=Zt(),ye=Zt(),_i=Zt(),I=Zt(),ce=Zt(),Gt=Zt(),ze=Zt();function Zt(){return 2**++ju}const Ei=Object.freeze(Object.defineProperty({__proto__:null,boolean:Q,booleanish:ye,commaOrSpaceSeparated:ze,commaSeparated:Gt,number:I,overloadedBoolean:_i,spaceSeparated:ce},Symbol.toStringTag,{value:"Module"})),Vr=Object.keys(Ei);class Wi extends Me{constructor(t,n,r,s){let a=-1;if(super(t,n),ka(this,"space",s),typeof r=="number")for(;++a4&&n.slice(0,4)==="data"&&_u.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Na,Ru);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Na.test(a)){let o=a.replace(Cu,Pu);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Wi}return new s(r,t)}function Pu(e){return"-"+e.toLowerCase()}function Ru(e){return e.charAt(1).toUpperCase()}const Iu=Yo([Zo,ku,nl,rl,il],"html"),Gi=Yo([Zo,Nu,nl,rl,il],"svg");function Tu(e){return e.join(" ").trim()}var rn={},Wr,Sa;function Au(){if(Sa)return Wr;Sa=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=` -`,u="/",d="*",h="",m="comment",p="declaration";function b(v,y){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];y=y||{};var C=1,_=1;function N(D){var P=D.match(t);P&&(C+=P.length);var $=D.lastIndexOf(c);_=~$?D.length-$:_+D.length}function F(){var D={line:C,column:_};return function(P){return P.position=new j(D),R(),P}}function j(D){this.start=D,this.end={line:C,column:_},this.source=y.source}j.prototype.content=v;function q(D){var P=new Error(y.source+":"+C+":"+_+": "+D);if(P.reason=D,P.filename=y.source,P.line=C,P.column=_,P.source=v,!y.silent)throw P}function M(D){var P=D.exec(v);if(P){var $=P[0];return N($),v=v.slice($.length),P}}function R(){M(n)}function z(D){var P;for(D=D||[];P=k();)P!==!1&&D.push(P);return D}function k(){var D=F();if(!(u!=v.charAt(0)||d!=v.charAt(1))){for(var P=2;h!=v.charAt(P)&&(d!=v.charAt(P)||u!=v.charAt(P+1));)++P;if(P+=2,h===v.charAt(P-1))return q("End of comment missing");var $=v.slice(2,P-2);return _+=2,N($),v=v.slice(P),_+=2,D({type:m,comment:$})}}function E(){var D=F(),P=M(r);if(P){if(k(),!M(s))return q("property missing ':'");var $=M(a),B=D({type:p,property:w(P[0].replace(e,h)),value:$?w($[0].replace(e,h)):h});return M(o),B}}function X(){var D=[];z(D);for(var P;P=E();)P!==!1&&(D.push(P),z(D));return D}return R(),X()}function w(v){return v?v.replace(l,h):h}return Wr=b,Wr}var Ca;function Lu(){if(Ca)return rn;Ca=1;var e=rn&&rn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rn,"__esModule",{value:!0}),rn.default=n;const t=e(Au());function n(r,s){let a=null;if(!r||typeof r!="string")return a;const o=(0,t.default)(r),l=typeof s=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?s(u,d,c):d&&(a=a||{},a[u]=d)}),a}return rn}var Tn={},_a;function Mu(){if(_a)return Tn;_a=1,Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},o=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),a(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(s,l):u=u.replace(r,l),u.replace(t,o))};return Tn.camelCase=c,Tn}var An,Ea;function Ou(){if(Ea)return An;Ea=1;var e=An&&An.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Lu()),n=Mu();function r(s,a){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(l,c){l&&c&&(o[(0,n.camelCase)(l,a)]=c)}),o}return r.default=r,An=r,An}var Du=Ou();const Fu=Bi(Du),sl=al("end"),Ji=al("start");function al(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function zu(e){const t=Ji(e),n=sl(e);if(t&&n)return{start:t,end:n}}function Bn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pa(e.position):"start"in e||"end"in e?Pa(e):"line"in e||"column"in e?Pi(e):""}function Pi(e){return Ra(e&&e.line)+":"+Ra(e&&e.column)}function Pa(e){return Pi(e&&e.start)+"-"+Pi(e&&e.end)}function Ra(e){return e&&typeof e=="number"?e:1}class Ce extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(o=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?a.ruleId=r:(a.source=r.slice(0,c),a.ruleId=r.slice(c+1))}if(!a.place&&a.ancestors&&a.ancestors){const c=a.ancestors[a.ancestors.length-1];c&&(a.place=c.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Bn(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ce.prototype.file="";Ce.prototype.name="";Ce.prototype.reason="";Ce.prototype.message="";Ce.prototype.stack="";Ce.prototype.column=void 0;Ce.prototype.line=void 0;Ce.prototype.ancestors=void 0;Ce.prototype.cause=void 0;Ce.prototype.fatal=void 0;Ce.prototype.place=void 0;Ce.prototype.ruleId=void 0;Ce.prototype.source=void 0;const Xi={}.hasOwnProperty,qu=new Map,Bu=/[A-Z]/g,Uu=new Set(["table","tbody","thead","tfoot","tr"]),$u=new Set(["td","th"]),ol="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Hu(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Yu(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Xu(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Gi:Iu,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ll(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function ll(e,t,n){if(t.type==="element")return Ku(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Qu(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Wu(e,t,n);if(t.type==="mdxjsEsm")return Vu(e,t);if(t.type==="root")return Gu(e,t,n);if(t.type==="text")return Ju(e,t)}function Ku(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Gi,e.schema=s),e.ancestors.push(t);const a=ul(e,t.tagName,!1),o=Zu(e,t);let l=Zi(e,t);return Uu.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!vu(c):!0})),cl(e,o,a,t),Yi(o,l),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Qu(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jn(e,t.position)}function Vu(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jn(e,t.position)}function Wu(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Gi,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:ul(e,t.name,!0),o=ed(e,t),l=Zi(e,t);return cl(e,o,a,t),Yi(o,l),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Gu(e,t,n){const r={};return Yi(r,Zi(e,t)),e.create(t,e.Fragment,r,n)}function Ju(e,t){return t.value}function cl(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Yi(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Xu(e,t,n){return r;function r(s,a,o,l){const u=Array.isArray(o.children)?n:t;return l?u(a,o,l):u(a,o)}}function Yu(e,t){return n;function n(r,s,a,o){const l=Array.isArray(a.children),c=Ji(r);return t(s,a,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Zu(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Xi.call(t.properties,s)){const a=td(e,s,t.properties[s]);if(a){const[o,l]=a;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&$u.has(t.tagName)?r=l:n[o]=l}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ed(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const o=a.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Jn(e,t.position);else{const s=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else Jn(e,t.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function Zi(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:qu;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(ot(e,e.length,0,t),e):t}const Aa={}.hasOwnProperty;function cd(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function on(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const at=Lt(/[A-Za-z]/),Ue=Lt(/[\dA-Za-z]/),hd=Lt(/[#-'*+\--9=?A-Z^-~]/);function Ri(e){return e!==null&&(e<32||e===127)}const Ii=Lt(/\d/),pd=Lt(/[\dA-Fa-f]/),md=Lt(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function Le(e){return e!==null&&(e<0||e===32)}function ne(e){return e===-2||e===-1||e===32}const fd=Lt(new RegExp("\\p{P}|\\p{S}","u")),xd=Lt(/\s/);function Lt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Cn(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&a<57344){const l=e.charCodeAt(n+1);a<56320&&l>56319&&l<57344?(o=String.fromCharCode(a,l),s=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function he(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(c){return ne(c)?(e.enter(n),l(c)):t(c)}function l(c){return ne(c)&&a++o))return;const q=t.events.length;let M=q,R,z;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(R){z=t.events[M][1].end;break}R=!0}for(y(r),j=q;j_;){const F=n[N];t.containerState=F[1],F[0].exit.call(t,e)}n.length=_}function C(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function vd(e,t,n){return he(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ma(e){if(e===null||Le(e)||xd(e))return 1;if(fd(e))return 2}function ts(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},m={...e[n][1].start};Oa(h,-c),Oa(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},a={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=He(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=He(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",a,t]]),u=He(u,ts(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=He(u,[["exit",a,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=He(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ot(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&ne(j)?he(e,C,"linePrefix",a+1)(j):C(j)}function C(j){return j===null||H(j)?e.check(Da,w,N)(j):(e.enter("codeFlowValue"),_(j))}function _(j){return j===null||H(j)?(e.exit("codeFlowValue"),C(j)):(e.consume(j),_)}function N(j){return e.exit("codeFenced"),t(j)}function F(j,q,M){let R=0;return z;function z(P){return j.enter("lineEnding"),j.consume(P),j.exit("lineEnding"),k}function k(P){return j.enter("codeFencedFence"),ne(P)?he(j,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):E(P)}function E(P){return P===l?(j.enter("codeFencedFenceSequence"),X(P)):M(P)}function X(P){return P===l?(R++,j.consume(P),X):R>=o?(j.exit("codeFencedFenceSequence"),ne(P)?he(j,D,"whitespace")(P):D(P)):M(P)}function D(P){return P===null||H(P)?(j.exit("codeFencedFence"),q(P)):M(P)}}}function Ad(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Jr={name:"codeIndented",tokenize:Md},Ld={partial:!0,tokenize:Od};function Md(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),he(e,a,"linePrefix",5)(u)}function a(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):H(u)?e.attempt(Ld,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||H(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function Od(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):he(e,a,"linePrefix",5)(o)}function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):H(o)?s(o):n(o)}}const Dd={name:"codeText",previous:zd,resolve:Fd,tokenize:qd};function Fd(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Ln(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ln(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ln(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function gl(e,t,n,r,s,a,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(r),e.enter(s),e.enter(a),e.consume(y),e.exit(a),m):y===null||y===32||y===41||Ri(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(y))}function m(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),m(y)):y===null||y===60||H(y)?n(y):(e.consume(y),y===92?b:p)}function b(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function w(y){return!d&&(y===null||y===41||Le(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(a),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||H(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!ne(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function yl(e,t,n,r,s,a){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(s),e.consume(m),e.exit(s),o=m===40?41:m,c):n(m)}function c(m){return m===o?(e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):(e.enter(a),u(m))}function u(m){return m===o?(e.exit(a),c(o)):m===null?n(m):H(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),he(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||H(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===o||m===92?(e.consume(m),d):d(m)}}function Un(e,t){let n;return r;function r(s){return H(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):ne(s)?he(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const Wd={name:"definition",tokenize:Jd},Gd={partial:!0,tokenize:Xd};function Jd(e,t,n){const r=this;let s;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return bl.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=on(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Le(p)?Un(e,u)(p):u(p)}function u(p){return gl(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Gd,h,h)(p)}function h(p){return ne(p)?he(e,m,"whitespace")(p):m(p)}function m(p){return p===null||H(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function Xd(e,t,n){return r;function r(l){return Le(l)?Un(e,s)(l):n(l)}function s(l){return yl(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return ne(l)?he(e,o,"whitespace")(l):o(l)}function o(l){return l===null||H(l)?t(l):n(l)}}const Yd={name:"hardBreakEscape",tokenize:Zd};function Zd(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return H(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const eh={name:"headingAtx",resolve:th,tokenize:nh};function th(e,t){let n=e.length-2,r=3,s,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ot(e,r,n-r+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function nh(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Le(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||H(d)?(e.exit("atxHeading"),t(d)):ne(d)?he(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Le(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const rh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],za=["pre","script","style","textarea"],ih={concrete:!0,name:"htmlFlow",resolveTo:oh,tokenize:lh},sh={partial:!0,tokenize:uh},ah={partial:!0,tokenize:ch};function oh(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function lh(e,t,n){const r=this;let s,a,o,l,c;return u;function u(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),h}function h(x){return x===33?(e.consume(x),m):x===47?(e.consume(x),a=!0,w):x===63?(e.consume(x),s=3,r.interrupt?t:f):at(x)?(e.consume(x),o=String.fromCharCode(x),v):n(x)}function m(x){return x===45?(e.consume(x),s=2,p):x===91?(e.consume(x),s=5,l=0,b):at(x)?(e.consume(x),s=4,r.interrupt?t:f):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:f):n(x)}function b(x){const Oe="CDATA[";return x===Oe.charCodeAt(l++)?(e.consume(x),l===Oe.length?r.interrupt?t:E:b):n(x)}function w(x){return at(x)?(e.consume(x),o=String.fromCharCode(x),v):n(x)}function v(x){if(x===null||x===47||x===62||Le(x)){const Oe=x===47,lt=o.toLowerCase();return!Oe&&!a&&za.includes(lt)?(s=1,r.interrupt?t(x):E(x)):rh.includes(o.toLowerCase())?(s=6,Oe?(e.consume(x),y):r.interrupt?t(x):E(x)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):a?C(x):_(x))}return x===45||Ue(x)?(e.consume(x),o+=String.fromCharCode(x),v):n(x)}function y(x){return x===62?(e.consume(x),r.interrupt?t:E):n(x)}function C(x){return ne(x)?(e.consume(x),C):z(x)}function _(x){return x===47?(e.consume(x),z):x===58||x===95||at(x)?(e.consume(x),N):ne(x)?(e.consume(x),_):z(x)}function N(x){return x===45||x===46||x===58||x===95||Ue(x)?(e.consume(x),N):F(x)}function F(x){return x===61?(e.consume(x),j):ne(x)?(e.consume(x),F):_(x)}function j(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),c=x,q):ne(x)?(e.consume(x),j):M(x)}function q(x){return x===c?(e.consume(x),c=null,R):x===null||H(x)?n(x):(e.consume(x),q)}function M(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||Le(x)?F(x):(e.consume(x),M)}function R(x){return x===47||x===62||ne(x)?_(x):n(x)}function z(x){return x===62?(e.consume(x),k):n(x)}function k(x){return x===null||H(x)?E(x):ne(x)?(e.consume(x),k):n(x)}function E(x){return x===45&&s===2?(e.consume(x),$):x===60&&s===1?(e.consume(x),B):x===62&&s===4?(e.consume(x),ie):x===63&&s===3?(e.consume(x),f):x===93&&s===5?(e.consume(x),pe):H(x)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(sh,Re,X)(x)):x===null||H(x)?(e.exit("htmlFlowData"),X(x)):(e.consume(x),E)}function X(x){return e.check(ah,D,Re)(x)}function D(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),P}function P(x){return x===null||H(x)?X(x):(e.enter("htmlFlowData"),E(x))}function $(x){return x===45?(e.consume(x),f):E(x)}function B(x){return x===47?(e.consume(x),o="",de):E(x)}function de(x){if(x===62){const Oe=o.toLowerCase();return za.includes(Oe)?(e.consume(x),ie):E(x)}return at(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),de):E(x)}function pe(x){return x===93?(e.consume(x),f):E(x)}function f(x){return x===62?(e.consume(x),ie):x===45&&s===2?(e.consume(x),f):E(x)}function ie(x){return x===null||H(x)?(e.exit("htmlFlowData"),Re(x)):(e.consume(x),ie)}function Re(x){return e.exit("htmlFlow"),t(x)}}function ch(e,t,n){const r=this;return s;function s(o){return H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function uh(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ur,t,n)}}const dh={name:"htmlText",tokenize:hh};function hh(e,t,n){const r=this;let s,a,o;return l;function l(f){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(f),c}function c(f){return f===33?(e.consume(f),u):f===47?(e.consume(f),F):f===63?(e.consume(f),_):at(f)?(e.consume(f),M):n(f)}function u(f){return f===45?(e.consume(f),d):f===91?(e.consume(f),a=0,b):at(f)?(e.consume(f),C):n(f)}function d(f){return f===45?(e.consume(f),p):n(f)}function h(f){return f===null?n(f):f===45?(e.consume(f),m):H(f)?(o=h,B(f)):(e.consume(f),h)}function m(f){return f===45?(e.consume(f),p):h(f)}function p(f){return f===62?$(f):f===45?m(f):h(f)}function b(f){const ie="CDATA[";return f===ie.charCodeAt(a++)?(e.consume(f),a===ie.length?w:b):n(f)}function w(f){return f===null?n(f):f===93?(e.consume(f),v):H(f)?(o=w,B(f)):(e.consume(f),w)}function v(f){return f===93?(e.consume(f),y):w(f)}function y(f){return f===62?$(f):f===93?(e.consume(f),y):w(f)}function C(f){return f===null||f===62?$(f):H(f)?(o=C,B(f)):(e.consume(f),C)}function _(f){return f===null?n(f):f===63?(e.consume(f),N):H(f)?(o=_,B(f)):(e.consume(f),_)}function N(f){return f===62?$(f):_(f)}function F(f){return at(f)?(e.consume(f),j):n(f)}function j(f){return f===45||Ue(f)?(e.consume(f),j):q(f)}function q(f){return H(f)?(o=q,B(f)):ne(f)?(e.consume(f),q):$(f)}function M(f){return f===45||Ue(f)?(e.consume(f),M):f===47||f===62||Le(f)?R(f):n(f)}function R(f){return f===47?(e.consume(f),$):f===58||f===95||at(f)?(e.consume(f),z):H(f)?(o=R,B(f)):ne(f)?(e.consume(f),R):$(f)}function z(f){return f===45||f===46||f===58||f===95||Ue(f)?(e.consume(f),z):k(f)}function k(f){return f===61?(e.consume(f),E):H(f)?(o=k,B(f)):ne(f)?(e.consume(f),k):R(f)}function E(f){return f===null||f===60||f===61||f===62||f===96?n(f):f===34||f===39?(e.consume(f),s=f,X):H(f)?(o=E,B(f)):ne(f)?(e.consume(f),E):(e.consume(f),D)}function X(f){return f===s?(e.consume(f),s=void 0,P):f===null?n(f):H(f)?(o=X,B(f)):(e.consume(f),X)}function D(f){return f===null||f===34||f===39||f===60||f===61||f===96?n(f):f===47||f===62||Le(f)?R(f):(e.consume(f),D)}function P(f){return f===47||f===62||Le(f)?R(f):n(f)}function $(f){return f===62?(e.consume(f),e.exit("htmlTextData"),e.exit("htmlText"),t):n(f)}function B(f){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),de}function de(f){return ne(f)?he(e,pe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):pe(f)}function pe(f){return e.enter("htmlTextData"),o(f)}}const ns={name:"labelEnd",resolveAll:xh,resolveTo:gh,tokenize:bh},ph={tokenize:yh},mh={tokenize:wh},fh={tokenize:vh};function xh(e){let t=-1;const n=[];for(;++t=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),ne(u)?he(e,l,"whitespace")(u):l(u))}}const Ie={continuation:{tokenize:Ih},exit:Ah,name:"list",tokenize:Rh},Eh={partial:!0,tokenize:Lh},Ph={partial:!0,tokenize:Th};function Rh(e,t,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const b=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ii(p)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ir,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Ii(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ur,r.interrupt?n:d,e.attempt(Eh,m,h))}function d(p){return r.containerState.initialBlankLine=!0,a++,m(p)}function h(p){return ne(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Ih(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ur,s,a);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,he(e,t,"listItemIndent",r.containerState.size+1)(l)}function a(l){return r.containerState.furtherBlankLines||!ne(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ph,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,he(e,e.attempt(Ie,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Th(e,t,n){const r=this;return he(e,s,"listItemIndent",r.containerState.size+1);function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function Ah(e){e.exit(this.containerState.type)}function Lh(e,t,n){const r=this;return he(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const o=r.events[r.events.length-1];return!ne(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const qa={name:"setextUnderline",resolveTo:Mh,tokenize:Oh};function Mh(e,t){let n=e.length,r,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Oh(e,t,n){const r=this;let s;return a;function a(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),ne(u)?he(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Dh={tokenize:Fh};function Fh(e){const t=this,n=e.attempt(Ur,r,e.attempt(this.parser.constructs.flowInitial,s,he(e,e.attempt(this.parser.constructs.flow,s,e.attempt($d,s)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const zh={resolveAll:vl()},qh=wl("string"),Bh=wl("text");function wl(e){return{resolveAll:vl(e==="text"?Uh:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],a=n.attempt(s,o,l);return o;function o(d){return u(d)?a(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),a(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=s[d];let m=-1;if(h)for(;++m-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}a>0&&o.push(e[s].slice(0,a))}return o}function tp(e,t){let n=-1;const r=[];let s;for(;++n4&&n.slice(0,4)==="data"&&_u.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Na,Ru);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Na.test(a)){let o=a.replace(Cu,Pu);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Wi}return new s(r,t)}function Pu(e){return"-"+e.toLowerCase()}function Ru(e){return e.charAt(1).toUpperCase()}const Iu=Yo([Zo,ku,nl,rl,il],"html"),Gi=Yo([Zo,Nu,nl,rl,il],"svg");function Tu(e){return e.join(" ").trim()}var rn={},Wr,Sa;function Au(){if(Sa)return Wr;Sa=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=` +`,u="/",d="*",h="",m="comment",p="declaration";function w(v,y){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];y=y||{};var j=1,_=1;function S(D){var P=D.match(t);P&&(j+=P.length);var $=D.lastIndexOf(c);_=~$?D.length-$:_+D.length}function F(){var D={line:j,column:_};return function(P){return P.position=new k(D),R(),P}}function k(D){this.start=D,this.end={line:j,column:_},this.source=y.source}k.prototype.content=v;function q(D){var P=new Error(y.source+":"+j+":"+_+": "+D);if(P.reason=D,P.filename=y.source,P.line=j,P.column=_,P.source=v,!y.silent)throw P}function M(D){var P=D.exec(v);if(P){var $=P[0];return S($),v=v.slice($.length),P}}function R(){M(n)}function z(D){var P;for(D=D||[];P=N();)P!==!1&&D.push(P);return D}function N(){var D=F();if(!(u!=v.charAt(0)||d!=v.charAt(1))){for(var P=2;h!=v.charAt(P)&&(d!=v.charAt(P)||u!=v.charAt(P+1));)++P;if(P+=2,h===v.charAt(P-1))return q("End of comment missing");var $=v.slice(2,P-2);return _+=2,S($),v=v.slice(P),_+=2,D({type:m,comment:$})}}function E(){var D=F(),P=M(r);if(P){if(N(),!M(s))return q("property missing ':'");var $=M(a),B=D({type:p,property:b(P[0].replace(e,h)),value:$?b($[0].replace(e,h)):h});return M(o),B}}function X(){var D=[];z(D);for(var P;P=E();)P!==!1&&(D.push(P),z(D));return D}return R(),X()}function b(v){return v?v.replace(l,h):h}return Wr=w,Wr}var Ca;function Lu(){if(Ca)return rn;Ca=1;var e=rn&&rn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rn,"__esModule",{value:!0}),rn.default=n;const t=e(Au());function n(r,s){let a=null;if(!r||typeof r!="string")return a;const o=(0,t.default)(r),l=typeof s=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?s(u,d,c):d&&(a=a||{},a[u]=d)}),a}return rn}var Tn={},_a;function Mu(){if(_a)return Tn;_a=1,Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},o=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),a(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(s,l):u=u.replace(r,l),u.replace(t,o))};return Tn.camelCase=c,Tn}var An,Ea;function Ou(){if(Ea)return An;Ea=1;var e=An&&An.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(Lu()),n=Mu();function r(s,a){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(l,c){l&&c&&(o[(0,n.camelCase)(l,a)]=c)}),o}return r.default=r,An=r,An}var Du=Ou();const Fu=Bi(Du),sl=al("end"),Ji=al("start");function al(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function zu(e){const t=Ji(e),n=sl(e);if(t&&n)return{start:t,end:n}}function Bn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pa(e.position):"start"in e||"end"in e?Pa(e):"line"in e||"column"in e?Pi(e):""}function Pi(e){return Ra(e&&e.line)+":"+Ra(e&&e.column)}function Pa(e){return Pi(e&&e.start)+"-"+Pi(e&&e.end)}function Ra(e){return e&&typeof e=="number"?e:1}class _e extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(o=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?a.ruleId=r:(a.source=r.slice(0,c),a.ruleId=r.slice(c+1))}if(!a.place&&a.ancestors&&a.ancestors){const c=a.ancestors[a.ancestors.length-1];c&&(a.place=c.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Bn(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_e.prototype.file="";_e.prototype.name="";_e.prototype.reason="";_e.prototype.message="";_e.prototype.stack="";_e.prototype.column=void 0;_e.prototype.line=void 0;_e.prototype.ancestors=void 0;_e.prototype.cause=void 0;_e.prototype.fatal=void 0;_e.prototype.place=void 0;_e.prototype.ruleId=void 0;_e.prototype.source=void 0;const Xi={}.hasOwnProperty,qu=new Map,Bu=/[A-Z]/g,Uu=new Set(["table","tbody","thead","tfoot","tr"]),$u=new Set(["td","th"]),ol="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Hu(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Yu(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Xu(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Gi:Iu,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ll(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function ll(e,t,n){if(t.type==="element")return Ku(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Qu(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Wu(e,t,n);if(t.type==="mdxjsEsm")return Vu(e,t);if(t.type==="root")return Gu(e,t,n);if(t.type==="text")return Ju(e,t)}function Ku(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Gi,e.schema=s),e.ancestors.push(t);const a=ul(e,t.tagName,!1),o=Zu(e,t);let l=Zi(e,t);return Uu.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!vu(c):!0})),cl(e,o,a,t),Yi(o,l),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Qu(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jn(e,t.position)}function Vu(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jn(e,t.position)}function Wu(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Gi,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:ul(e,t.name,!0),o=ed(e,t),l=Zi(e,t);return cl(e,o,a,t),Yi(o,l),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Gu(e,t,n){const r={};return Yi(r,Zi(e,t)),e.create(t,e.Fragment,r,n)}function Ju(e,t){return t.value}function cl(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Yi(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Xu(e,t,n){return r;function r(s,a,o,l){const u=Array.isArray(o.children)?n:t;return l?u(a,o,l):u(a,o)}}function Yu(e,t){return n;function n(r,s,a,o){const l=Array.isArray(a.children),c=Ji(r);return t(s,a,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Zu(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Xi.call(t.properties,s)){const a=td(e,s,t.properties[s]);if(a){const[o,l]=a;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&$u.has(t.tagName)?r=l:n[o]=l}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ed(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const o=a.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Jn(e,t.position);else{const s=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else Jn(e,t.position);else a=r.value===null?!0:r.value;n[s]=a}return n}function Zi(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:qu;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(ot(e,e.length,0,t),e):t}const Aa={}.hasOwnProperty;function cd(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function on(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const at=Lt(/[A-Za-z]/),Ue=Lt(/[\dA-Za-z]/),hd=Lt(/[#-'*+\--9=?A-Z^-~]/);function Ri(e){return e!==null&&(e<32||e===127)}const Ii=Lt(/\d/),pd=Lt(/[\dA-Fa-f]/),md=Lt(/[!-/:-@[-`{-~]/);function H(e){return e!==null&&e<-2}function Le(e){return e!==null&&(e<0||e===32)}function ne(e){return e===-2||e===-1||e===32}const fd=Lt(new RegExp("\\p{P}|\\p{S}","u")),xd=Lt(/\s/);function Lt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Cn(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&a<57344){const l=e.charCodeAt(n+1);a<56320&&l>56319&&l<57344?(o=String.fromCharCode(a,l),s=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function pe(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(c){return ne(c)?(e.enter(n),l(c)):t(c)}function l(c){return ne(c)&&a++o))return;const q=t.events.length;let M=q,R,z;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(R){z=t.events[M][1].end;break}R=!0}for(y(r),k=q;k_;){const F=n[S];t.containerState=F[1],F[0].exit.call(t,e)}n.length=_}function j(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function vd(e,t,n){return pe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ma(e){if(e===null||Le(e)||xd(e))return 1;if(fd(e))return 2}function ts(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},m={...e[n][1].start};Oa(h,-c),Oa(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},a={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=He(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=He(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",a,t]]),u=He(u,ts(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=He(u,[["exit",a,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=He(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ot(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&ne(k)?pe(e,j,"linePrefix",a+1)(k):j(k)}function j(k){return k===null||H(k)?e.check(Da,b,S)(k):(e.enter("codeFlowValue"),_(k))}function _(k){return k===null||H(k)?(e.exit("codeFlowValue"),j(k)):(e.consume(k),_)}function S(k){return e.exit("codeFenced"),t(k)}function F(k,q,M){let R=0;return z;function z(P){return k.enter("lineEnding"),k.consume(P),k.exit("lineEnding"),N}function N(P){return k.enter("codeFencedFence"),ne(P)?pe(k,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):E(P)}function E(P){return P===l?(k.enter("codeFencedFenceSequence"),X(P)):M(P)}function X(P){return P===l?(R++,k.consume(P),X):R>=o?(k.exit("codeFencedFenceSequence"),ne(P)?pe(k,D,"whitespace")(P):D(P)):M(P)}function D(P){return P===null||H(P)?(k.exit("codeFencedFence"),q(P)):M(P)}}}function Ad(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Jr={name:"codeIndented",tokenize:Md},Ld={partial:!0,tokenize:Od};function Md(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),pe(e,a,"linePrefix",5)(u)}function a(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):H(u)?e.attempt(Ld,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||H(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function Od(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):pe(e,a,"linePrefix",5)(o)}function a(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):H(o)?s(o):n(o)}}const Dd={name:"codeText",previous:zd,resolve:Fd,tokenize:qd};function Fd(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Ln(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ln(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ln(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function gl(e,t,n,r,s,a,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(r),e.enter(s),e.enter(a),e.consume(y),e.exit(a),m):y===null||y===32||y===41||Ri(y)?n(y):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function m(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),m(y)):y===null||y===60||H(y)?n(y):(e.consume(y),y===92?w:p)}function w(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||Le(y))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(a),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):H(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||H(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!ne(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),l++,h):h(p)}}function yl(e,t,n,r,s,a){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(r),e.enter(s),e.consume(m),e.exit(s),o=m===40?41:m,c):n(m)}function c(m){return m===o?(e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):(e.enter(a),u(m))}function u(m){return m===o?(e.exit(a),c(o)):m===null?n(m):H(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),pe(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||H(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===o||m===92?(e.consume(m),d):d(m)}}function Un(e,t){let n;return r;function r(s){return H(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):ne(s)?pe(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const Wd={name:"definition",tokenize:Jd},Gd={partial:!0,tokenize:Xd};function Jd(e,t,n){const r=this;let s;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return bl.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=on(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Le(p)?Un(e,u)(p):u(p)}function u(p){return gl(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Gd,h,h)(p)}function h(p){return ne(p)?pe(e,m,"whitespace")(p):m(p)}function m(p){return p===null||H(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function Xd(e,t,n){return r;function r(l){return Le(l)?Un(e,s)(l):n(l)}function s(l){return yl(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return ne(l)?pe(e,o,"whitespace")(l):o(l)}function o(l){return l===null||H(l)?t(l):n(l)}}const Yd={name:"hardBreakEscape",tokenize:Zd};function Zd(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return H(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const eh={name:"headingAtx",resolve:th,tokenize:nh};function th(e,t){let n=e.length-2,r=3,s,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ot(e,r,n-r+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])),e}function nh(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||Le(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||H(d)?(e.exit("atxHeading"),t(d)):ne(d)?pe(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Le(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const rh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],za=["pre","script","style","textarea"],ih={concrete:!0,name:"htmlFlow",resolveTo:oh,tokenize:lh},sh={partial:!0,tokenize:uh},ah={partial:!0,tokenize:ch};function oh(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function lh(e,t,n){const r=this;let s,a,o,l,c;return u;function u(x){return d(x)}function d(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),h}function h(x){return x===33?(e.consume(x),m):x===47?(e.consume(x),a=!0,b):x===63?(e.consume(x),s=3,r.interrupt?t:f):at(x)?(e.consume(x),o=String.fromCharCode(x),v):n(x)}function m(x){return x===45?(e.consume(x),s=2,p):x===91?(e.consume(x),s=5,l=0,w):at(x)?(e.consume(x),s=4,r.interrupt?t:f):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:f):n(x)}function w(x){const Oe="CDATA[";return x===Oe.charCodeAt(l++)?(e.consume(x),l===Oe.length?r.interrupt?t:E:w):n(x)}function b(x){return at(x)?(e.consume(x),o=String.fromCharCode(x),v):n(x)}function v(x){if(x===null||x===47||x===62||Le(x)){const Oe=x===47,lt=o.toLowerCase();return!Oe&&!a&&za.includes(lt)?(s=1,r.interrupt?t(x):E(x)):rh.includes(o.toLowerCase())?(s=6,Oe?(e.consume(x),y):r.interrupt?t(x):E(x)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):a?j(x):_(x))}return x===45||Ue(x)?(e.consume(x),o+=String.fromCharCode(x),v):n(x)}function y(x){return x===62?(e.consume(x),r.interrupt?t:E):n(x)}function j(x){return ne(x)?(e.consume(x),j):z(x)}function _(x){return x===47?(e.consume(x),z):x===58||x===95||at(x)?(e.consume(x),S):ne(x)?(e.consume(x),_):z(x)}function S(x){return x===45||x===46||x===58||x===95||Ue(x)?(e.consume(x),S):F(x)}function F(x){return x===61?(e.consume(x),k):ne(x)?(e.consume(x),F):_(x)}function k(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),c=x,q):ne(x)?(e.consume(x),k):M(x)}function q(x){return x===c?(e.consume(x),c=null,R):x===null||H(x)?n(x):(e.consume(x),q)}function M(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||Le(x)?F(x):(e.consume(x),M)}function R(x){return x===47||x===62||ne(x)?_(x):n(x)}function z(x){return x===62?(e.consume(x),N):n(x)}function N(x){return x===null||H(x)?E(x):ne(x)?(e.consume(x),N):n(x)}function E(x){return x===45&&s===2?(e.consume(x),$):x===60&&s===1?(e.consume(x),B):x===62&&s===4?(e.consume(x),ie):x===63&&s===3?(e.consume(x),f):x===93&&s===5?(e.consume(x),me):H(x)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(sh,Re,X)(x)):x===null||H(x)?(e.exit("htmlFlowData"),X(x)):(e.consume(x),E)}function X(x){return e.check(ah,D,Re)(x)}function D(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),P}function P(x){return x===null||H(x)?X(x):(e.enter("htmlFlowData"),E(x))}function $(x){return x===45?(e.consume(x),f):E(x)}function B(x){return x===47?(e.consume(x),o="",he):E(x)}function he(x){if(x===62){const Oe=o.toLowerCase();return za.includes(Oe)?(e.consume(x),ie):E(x)}return at(x)&&o.length<8?(e.consume(x),o+=String.fromCharCode(x),he):E(x)}function me(x){return x===93?(e.consume(x),f):E(x)}function f(x){return x===62?(e.consume(x),ie):x===45&&s===2?(e.consume(x),f):E(x)}function ie(x){return x===null||H(x)?(e.exit("htmlFlowData"),Re(x)):(e.consume(x),ie)}function Re(x){return e.exit("htmlFlow"),t(x)}}function ch(e,t,n){const r=this;return s;function s(o){return H(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function uh(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Ur,t,n)}}const dh={name:"htmlText",tokenize:hh};function hh(e,t,n){const r=this;let s,a,o;return l;function l(f){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(f),c}function c(f){return f===33?(e.consume(f),u):f===47?(e.consume(f),F):f===63?(e.consume(f),_):at(f)?(e.consume(f),M):n(f)}function u(f){return f===45?(e.consume(f),d):f===91?(e.consume(f),a=0,w):at(f)?(e.consume(f),j):n(f)}function d(f){return f===45?(e.consume(f),p):n(f)}function h(f){return f===null?n(f):f===45?(e.consume(f),m):H(f)?(o=h,B(f)):(e.consume(f),h)}function m(f){return f===45?(e.consume(f),p):h(f)}function p(f){return f===62?$(f):f===45?m(f):h(f)}function w(f){const ie="CDATA[";return f===ie.charCodeAt(a++)?(e.consume(f),a===ie.length?b:w):n(f)}function b(f){return f===null?n(f):f===93?(e.consume(f),v):H(f)?(o=b,B(f)):(e.consume(f),b)}function v(f){return f===93?(e.consume(f),y):b(f)}function y(f){return f===62?$(f):f===93?(e.consume(f),y):b(f)}function j(f){return f===null||f===62?$(f):H(f)?(o=j,B(f)):(e.consume(f),j)}function _(f){return f===null?n(f):f===63?(e.consume(f),S):H(f)?(o=_,B(f)):(e.consume(f),_)}function S(f){return f===62?$(f):_(f)}function F(f){return at(f)?(e.consume(f),k):n(f)}function k(f){return f===45||Ue(f)?(e.consume(f),k):q(f)}function q(f){return H(f)?(o=q,B(f)):ne(f)?(e.consume(f),q):$(f)}function M(f){return f===45||Ue(f)?(e.consume(f),M):f===47||f===62||Le(f)?R(f):n(f)}function R(f){return f===47?(e.consume(f),$):f===58||f===95||at(f)?(e.consume(f),z):H(f)?(o=R,B(f)):ne(f)?(e.consume(f),R):$(f)}function z(f){return f===45||f===46||f===58||f===95||Ue(f)?(e.consume(f),z):N(f)}function N(f){return f===61?(e.consume(f),E):H(f)?(o=N,B(f)):ne(f)?(e.consume(f),N):R(f)}function E(f){return f===null||f===60||f===61||f===62||f===96?n(f):f===34||f===39?(e.consume(f),s=f,X):H(f)?(o=E,B(f)):ne(f)?(e.consume(f),E):(e.consume(f),D)}function X(f){return f===s?(e.consume(f),s=void 0,P):f===null?n(f):H(f)?(o=X,B(f)):(e.consume(f),X)}function D(f){return f===null||f===34||f===39||f===60||f===61||f===96?n(f):f===47||f===62||Le(f)?R(f):(e.consume(f),D)}function P(f){return f===47||f===62||Le(f)?R(f):n(f)}function $(f){return f===62?(e.consume(f),e.exit("htmlTextData"),e.exit("htmlText"),t):n(f)}function B(f){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),he}function he(f){return ne(f)?pe(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):me(f)}function me(f){return e.enter("htmlTextData"),o(f)}}const ns={name:"labelEnd",resolveAll:xh,resolveTo:gh,tokenize:bh},ph={tokenize:yh},mh={tokenize:wh},fh={tokenize:vh};function xh(e){let t=-1;const n=[];for(;++t=3&&(u===null||H(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),ne(u)?pe(e,l,"whitespace")(u):l(u))}}const Ie={continuation:{tokenize:Ih},exit:Ah,name:"list",tokenize:Rh},Eh={partial:!0,tokenize:Lh},Ph={partial:!0,tokenize:Th};function Rh(e,t,n){const r=this,s=r.events[r.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const w=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ii(p)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ir,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Ii(p)&&++o<10?(e.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ur,r.interrupt?n:d,e.attempt(Eh,m,h))}function d(p){return r.containerState.initialBlankLine=!0,a++,m(p)}function h(p){return ne(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Ih(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ur,s,a);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,pe(e,t,"listItemIndent",r.containerState.size+1)(l)}function a(l){return r.containerState.furtherBlankLines||!ne(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ph,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,pe(e,e.attempt(Ie,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Th(e,t,n){const r=this;return pe(e,s,"listItemIndent",r.containerState.size+1);function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function Ah(e){e.exit(this.containerState.type)}function Lh(e,t,n){const r=this;return pe(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const o=r.events[r.events.length-1];return!ne(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const qa={name:"setextUnderline",resolveTo:Mh,tokenize:Oh};function Mh(e,t){let n=e.length,r,s,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Oh(e,t,n){const r=this;let s;return a;function a(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),ne(u)?pe(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||H(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Dh={tokenize:Fh};function Fh(e){const t=this,n=e.attempt(Ur,r,e.attempt(this.parser.constructs.flowInitial,s,pe(e,e.attempt(this.parser.constructs.flow,s,e.attempt($d,s)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const zh={resolveAll:vl()},qh=wl("string"),Bh=wl("text");function wl(e){return{resolveAll:vl(e==="text"?Uh:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],a=n.attempt(s,o,l);return o;function o(d){return u(d)?a(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),a(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=s[d];let m=-1;if(h)for(;++m-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}a>0&&o.push(e[s].slice(0,a))}return o}function tp(e,t){let n=-1;const r=[];let s;for(;++n0){const Fe=K.tokenStack[K.tokenStack.length-1];(Fe[1]||Ua).call(K,void 0,Fe[0])}for(L.position={start:vt(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:vt(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},se=-1;++se0){const Fe=K.tokenStack[K.tokenStack.length-1];(Fe[1]||Ua).call(K,void 0,Fe[0])}for(L.position={start:vt(C.length>0?C[0][1].start:{line:1,column:1,offset:0}),end:vt(C.length>0?C[C.length-2][1].end:{line:1,column:1,offset:0})},se=-1;++se0&&(r.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function fp(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xp(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gp(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Cn(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function bp(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yp(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Nl(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function wp(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nl(e,t);const s={src:Cn(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,a),e.applyData(t,a)}function vp(e,t){const n={src:Cn(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jp(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function kp(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nl(e,t);const s={href:Cn(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const a={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Np(e,t){const n={href:Cn(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Sp(e,t,n){const r=e.all(t),s=n?Cp(n):Sl(t),a={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l1}function _p(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Ji(t.children[1]),c=sl(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function Tp(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return a.push(Ka(t.slice(s),s>0,!1)),a.join("")}function Ka(e,t,n){let r=0,s=e.length;if(t){let a=e.codePointAt(r);for(;a===$a||a===Ha;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(s-1);for(;a===$a||a===Ha;)s--,a=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Mp(e,t){const n={type:"text",value:Lp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Op(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Dp={blockquote:hp,break:pp,code:mp,delete:fp,emphasis:xp,footnoteReference:gp,heading:bp,html:yp,imageReference:wp,image:vp,inlineCode:jp,linkReference:kp,link:Np,listItem:Sp,list:_p,paragraph:Ep,root:Pp,strong:Rp,table:Ip,tableCell:Ap,tableRow:Tp,text:Mp,thematicBreak:Op,toml:Nr,yaml:Nr,definition:Nr,footnoteDefinition:Nr};function Nr(){}const Cl=-1,$r=0,$n=1,Mr=2,rs=3,is=4,ss=5,as=6,_l=7,El=8,Fp=typeof self=="object"?self:globalThis,Qa=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Fp[e](t)},zp=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,o]=t[s];switch(a){case $r:case Cl:return n(o,s);case $n:{const l=n([],s);for(const c of o)l.push(r(c));return l}case Mr:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case rs:return n(new Date(o),s);case is:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case ss:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case as:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case _l:{const{name:l,message:c}=o;return n(Qa(l,c),s)}case El:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(Qa(a,o),s)};return r},Va=e=>zp(new Map,e)(0),sn="",{toString:qp}={},{keys:Bp}=Object,Mn=e=>{const t=typeof e;if(t!=="object"||!e)return[$r,t];const n=qp.call(e).slice(8,-1);switch(n){case"Array":return[$n,sn];case"Object":return[Mr,sn];case"Date":return[rs,sn];case"RegExp":return[is,sn];case"Map":return[ss,sn];case"Set":return[as,sn];case"DataView":return[$n,n]}return n.includes("Array")?[$n,n]:n.includes("Error")?[_l,n]:[Mr,n]},Sr=([e,t])=>e===$r&&(t==="function"||t==="symbol"),Up=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},a=o=>{if(n.has(o))return n.get(o);let[l,c]=Mn(o);switch(l){case $r:{let d=o;switch(c){case"bigint":l=El,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([Cl],o)}return s([l,d],o)}case $n:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),s([c,[...m]],o)}const d=[],h=s([l,d],o);for(const m of o)d.push(a(m));return h}case Mr:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const d=[],h=s([l,d],o);for(const m of Bp(o))(e||!Sr(Mn(o[m])))&&d.push([a(m),a(o[m])]);return h}case rs:return s([l,o.toISOString()],o);case is:{const{source:d,flags:h}=o;return s([l,{source:d,flags:h}],o)}case ss:{const d=[],h=s([l,d],o);for(const[m,p]of o)(e||!(Sr(Mn(m))||Sr(Mn(p))))&&d.push([a(m),a(p)]);return h}case as:{const d=[],h=s([l,d],o);for(const m of o)(e||!Sr(Mn(m)))&&d.push(a(m));return h}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return a},Wa=(e,{json:t,lossy:n}={})=>{const r=[];return Up(!(t||n),!!t,new Map,r)(e),r},Or=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Va(Wa(e,t)):structuredClone(e):(e,t)=>Va(Wa(e,t));function $p(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Hp(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Kp(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||$p,r=e.options.footnoteBackLabel||Hp,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&b.push({type:"text",value:" "});let C=typeof n=="string"?n:n(c,p);typeof C=="string"&&(C={type:"text",value:C}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const C=v.children[v.children.length-1];C&&C.type==="text"?C.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...b)}else d.push(...b);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Or(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,u),e.applyData(t,u)}function Cp(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function _p(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Ji(t.children[1]),c=sl(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function Tp(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return a.push(Ka(t.slice(s),s>0,!1)),a.join("")}function Ka(e,t,n){let r=0,s=e.length;if(t){let a=e.codePointAt(r);for(;a===$a||a===Ha;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(s-1);for(;a===$a||a===Ha;)s--,a=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Mp(e,t){const n={type:"text",value:Lp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Op(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Dp={blockquote:hp,break:pp,code:mp,delete:fp,emphasis:xp,footnoteReference:gp,heading:bp,html:yp,imageReference:wp,image:vp,inlineCode:jp,linkReference:kp,link:Np,listItem:Sp,list:_p,paragraph:Ep,root:Pp,strong:Rp,table:Ip,tableCell:Ap,tableRow:Tp,text:Mp,thematicBreak:Op,toml:Nr,yaml:Nr,definition:Nr,footnoteDefinition:Nr};function Nr(){}const Cl=-1,$r=0,$n=1,Mr=2,rs=3,is=4,ss=5,as=6,_l=7,El=8,Fp=typeof self=="object"?self:globalThis,Qa=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Fp[e](t)},zp=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),r=s=>{if(e.has(s))return e.get(s);const[a,o]=t[s];switch(a){case $r:case Cl:return n(o,s);case $n:{const l=n([],s);for(const c of o)l.push(r(c));return l}case Mr:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case rs:return n(new Date(o),s);case is:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case ss:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case as:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case _l:{const{name:l,message:c}=o;return n(Qa(l,c),s)}case El:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(Qa(a,o),s)};return r},Va=e=>zp(new Map,e)(0),sn="",{toString:qp}={},{keys:Bp}=Object,Mn=e=>{const t=typeof e;if(t!=="object"||!e)return[$r,t];const n=qp.call(e).slice(8,-1);switch(n){case"Array":return[$n,sn];case"Object":return[Mr,sn];case"Date":return[rs,sn];case"RegExp":return[is,sn];case"Map":return[ss,sn];case"Set":return[as,sn];case"DataView":return[$n,n]}return n.includes("Array")?[$n,n]:n.includes("Error")?[_l,n]:[Mr,n]},Sr=([e,t])=>e===$r&&(t==="function"||t==="symbol"),Up=(e,t,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},a=o=>{if(n.has(o))return n.get(o);let[l,c]=Mn(o);switch(l){case $r:{let d=o;switch(c){case"bigint":l=El,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([Cl],o)}return s([l,d],o)}case $n:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),s([c,[...m]],o)}const d=[],h=s([l,d],o);for(const m of o)d.push(a(m));return h}case Mr:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());const d=[],h=s([l,d],o);for(const m of Bp(o))(e||!Sr(Mn(o[m])))&&d.push([a(m),a(o[m])]);return h}case rs:return s([l,o.toISOString()],o);case is:{const{source:d,flags:h}=o;return s([l,{source:d,flags:h}],o)}case ss:{const d=[],h=s([l,d],o);for(const[m,p]of o)(e||!(Sr(Mn(m))||Sr(Mn(p))))&&d.push([a(m),a(p)]);return h}case as:{const d=[],h=s([l,d],o);for(const m of o)(e||!Sr(Mn(m)))&&d.push(a(m));return h}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return a},Wa=(e,{json:t,lossy:n}={})=>{const r=[];return Up(!(t||n),!!t,new Map,r)(e),r},Or=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Va(Wa(e,t)):structuredClone(e):(e,t)=>Va(Wa(e,t));function $p(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Hp(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Kp(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||$p,r=e.options.footnoteBackLabel||Hp,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&w.push({type:"text",value:" "});let j=typeof n=="string"?n:n(c,p);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const j=v.children[v.children.length-1];j&&j.type==="text"?j.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...w)}else d.push(...w);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Or(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const Pl=(function(e){if(e==null)return Gp;if(typeof e=="function")return Hr(e);if(typeof e=="object")return Array.isArray(e)?Qp(e):Vp(e);if(typeof e=="string")return Wp(e);throw new Error("Expected function, string, or object as test")});function Qp(e){const t=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let p=Rl,b,w,v;if((!t||a(c,u,d[d.length-1]||void 0))&&(p=em(n(c,d)),p[0]===Ga))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==Yp)for(w=(r?y.children.length:-1)+o,v=d.concat(y);w>-1&&w":""))+")"})}return m;function m(){let p=Rl,w,b,v;if((!t||a(c,u,d[d.length-1]||void 0))&&(p=em(n(c,d)),p[0]===Ga))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==Yp)for(b=(r?y.children.length:-1)+o,v=d.concat(y);b>-1&&b0&&n.push({type:"text",value:` `}),n}function Ja(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Xa(e,t){const n=nm(e,t),r=n.one(e,void 0),s=Kp(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&a.children.push({type:"text",value:` -`},s),a}function om(e,t){return e&&"run"in e?async function(n,r){const s=Xa(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Xa(n,{file:r,...e||t})}}function Ya(e){if(e)throw e}var Yr,Za;function lm(){if(Za)return Yr;Za=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var m;for(m in u);return typeof m>"u"||e.call(u,m)},o=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Yr=function c(){var u,d,h,m,p,b,w=arguments[0],v=1,y=arguments.length,C=!1;for(typeof w=="boolean"&&(C=w,w=arguments[1]||{},v=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});vo.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(a,s):c instanceof Error?s(c):a(c))}function s(o,...l){n||(n=!0,t(o,...l))}function a(o){s(null,o)}}const nt={basename:hm,dirname:pm,extname:mm,join:fm,sep:"/"};function hm(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');dr(e);let n=0,r=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else r<0&&(a=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else o<0&&(a=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function pm(e){if(dr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function mm(e){dr(e);let t=e.length,n=-1,r=0,s=-1,a=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function fm(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function gm(e,t){let n="",r=0,s=-1,a=0,o=-1,l,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,a=0;continue}}else if(n.length>0){n="",r=0,s=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,a=0}else l===46&&a>-1?a++:a=-1}return n}function dr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bm={cwd:ym};function ym(){return"/"}function Mi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wm(e){if(typeof e=="string")e=new URL(e);else if(!Mi(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return vm(e)}function vm(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...b]=d;const w=r[m][1];Li(w)&&Li(p)&&(p=Zr(!0,w,p)),r[m]=[u,p,...b]}}}}const Sm=new os().freeze();function ri(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ii(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function si(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function to(e){if(!Li(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function no(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cr(e){return Cm(e)?e:new Tl(e)}function Cm(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _m(e){return typeof e=="string"||Em(e)}function Em(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Pm="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ro=[],io={allowDangerousHtml:!0},Rm=/^(https?|ircs?|mailto|xmpp)$/i,Im=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Tm(e){const t=Am(e),n=Lm(e);return Mm(t.runSync(t.parse(n),n),e)}function Am(e){const t=e.rehypePlugins||ro,n=e.remarkPlugins||ro,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...io}:io;return Sm().use(dp).use(n).use(om,r).use(t)}function Lm(e){const t=e.children||"",n=new Tl;return typeof t=="string"&&(n.value=t),n}function Mm(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,a=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Om;for(const d of Im)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Pm+d.id,void 0);return Il(e,u),Hu(e,{Fragment:i.Fragment,components:s,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function u(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in Gr)if(Object.hasOwn(Gr,p)&&Object.hasOwn(d.properties,p)){const b=d.properties[p],w=Gr[p];(w===null||w.includes(d.tagName))&&(d.properties[p]=c(String(b||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,m)),p&&m&&typeof h=="number")return l&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function Om(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Rm.test(e.slice(0,t))?e:""}const ls="-",Dm=e=>{const t=zm(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(ls);return l[0]===""&&l.length!==1&&l.shift(),Al(l,t)||Fm(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},Al=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Al(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(ls);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},so=/^\[(.+)\]$/,Fm=e=>{if(so.test(e)){const t=so.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},zm=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Bm(Object.entries(e.classGroups),n).forEach(([a,o])=>{Oi(o,r,a,t)}),r},Oi=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:ao(t,s);a.classGroupId=n;return}if(typeof s=="function"){if(qm(s)){Oi(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([a,o])=>{Oi(o,ao(t,a),n,r)})})},ao=(e,t)=>{let n=e;return t.split(ls).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},qm=e=>e.isThemeGetter,Bm=(e,t)=>t?e.map(([n,r])=>{const s=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[n,s]}):e,Um=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(a,o)=>{n.set(a,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(a){let o=n.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return s(a,o),o},set(a,o){n.has(a)?n.set(a,o):s(a,o)}}},Ll="!",$m=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],a=t.length,o=l=>{const c=[];let u=0,d=0,h;for(let v=0;vd?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:b,maybePostfixModifierPosition:w}};return n?l=>n({className:l,parseClassName:o}):o},Hm=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Km=e=>({cache:Um(e.cacheSize),parseClassName:$m(e),...Dm(e)}),Qm=/\s+/,Vm=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,a=[],o=e.trim().split(Qm);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:p}=n(u);let b=!!p,w=r(b?m.substring(0,p):m);if(!w){if(!b){l=u+(l.length>0?" "+l:l);continue}if(w=r(m),!w){l=u+(l.length>0?" "+l:l);continue}b=!1}const v=Hm(d).join(":"),y=h?v+Ll:v,C=y+w;if(a.includes(C))continue;a.push(C);const _=s(w,b);for(let N=0;N<_.length;++N){const F=_[N];a.push(y+F)}l=u+(l.length>0?" "+l:l)}return l};function Wm(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rh(d),e());return n=Km(u),r=n.cache.get,s=n.cache.set,a=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=Vm(c,n);return s(c,d),d}return function(){return a(Wm.apply(null,arguments))}}const me=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ol=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jm=/^\d+\/\d+$/,Xm=new Set(["px","full","screen"]),Ym=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ef=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mt=e=>ln(e)||Xm.has(e)||Jm.test(e),jt=e=>_n(e,"length",df),ln=e=>!!e&&!Number.isNaN(Number(e)),ai=e=>_n(e,"number",ln),On=e=>!!e&&Number.isInteger(Number(e)),rf=e=>e.endsWith("%")&&ln(e.slice(0,-1)),G=e=>Ol.test(e),kt=e=>Ym.test(e),sf=new Set(["length","size","percentage"]),af=e=>_n(e,sf,Dl),of=e=>_n(e,"position",Dl),lf=new Set(["image","url"]),cf=e=>_n(e,lf,pf),uf=e=>_n(e,"",hf),Dn=()=>!0,_n=(e,t,n)=>{const r=Ol.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},df=e=>Zm.test(e)&&!ef.test(e),Dl=()=>!1,hf=e=>tf.test(e),pf=e=>nf.test(e),mf=()=>{const e=me("colors"),t=me("spacing"),n=me("blur"),r=me("brightness"),s=me("borderColor"),a=me("borderRadius"),o=me("borderSpacing"),l=me("borderWidth"),c=me("contrast"),u=me("grayscale"),d=me("hueRotate"),h=me("invert"),m=me("gap"),p=me("gradientColorStops"),b=me("gradientColorStopPositions"),w=me("inset"),v=me("margin"),y=me("opacity"),C=me("padding"),_=me("saturate"),N=me("scale"),F=me("sepia"),j=me("skew"),q=me("space"),M=me("translate"),R=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto",G,t],E=()=>[G,t],X=()=>["",mt,jt],D=()=>["auto",ln,G],P=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],pe=()=>["","0",G],f=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ie=()=>[ln,G];return{cacheSize:500,separator:":",theme:{colors:[Dn],spacing:[mt,jt],blur:["none","",kt,G],brightness:ie(),borderColor:[e],borderRadius:["none","","full",kt,G],borderSpacing:E(),borderWidth:X(),contrast:ie(),grayscale:pe(),hueRotate:ie(),invert:pe(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[rf,jt],inset:k(),margin:k(),opacity:ie(),padding:E(),saturate:ie(),scale:ie(),sepia:pe(),skew:ie(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",G]}],container:["container"],columns:[{columns:[kt]}],"break-after":[{"break-after":f()}],"break-before":[{"break-before":f()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...P(),G]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",On,G]}],basis:[{basis:k()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",G]}],grow:[{grow:pe()}],shrink:[{shrink:pe()}],order:[{order:["first","last","none",On,G]}],"grid-cols":[{"grid-cols":[Dn]}],"col-start-end":[{col:["auto",{span:["full",On,G]},G]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Dn]}],"row-start-end":[{row:["auto",{span:[On,G]},G]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",G]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",G]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[q]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[q]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",G,t]}],"min-w":[{"min-w":[G,t,"min","max","fit"]}],"max-w":[{"max-w":[G,t,"none","full","min","max","fit","prose",{screen:[kt]},kt]}],h:[{h:[G,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[G,t,"auto","min","max","fit"]}],"font-size":[{text:["base",kt,jt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ai]}],"font-family":[{font:[Dn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",G]}],"line-clamp":[{"line-clamp":["none",ln,ai]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mt,G]}],"list-image":[{"list-image":["none",G]}],"list-style-type":[{list:["none","disc","decimal",G]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mt,jt]}],"underline-offset":[{"underline-offset":["auto",mt,G]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...P(),of]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",af]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cf]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:$()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[mt,G]}],"outline-w":[{outline:[mt,jt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[mt,jt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",kt,uf]}],"shadow-color":[{shadow:[Dn]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",kt,G]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[_]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",G]}],duration:[{duration:ie()}],ease:[{ease:["linear","in","out","in-out",G]}],delay:[{delay:ie()}],animate:[{animate:["none","spin","ping","pulse","bounce",G]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[On,G]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",G]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,jt,ai]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ff=Gm(mf),Di={status:"",repo:"",thread:"",action:"",intent:"",actor:""},xf=new Wc({defaultOptions:{queries:{retry:1}}}),oo=12,gf=12,bf=10080*60*1e3,yf=1e3,Fl=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";function W(...e){return ff(mc(e))}async function Z(e,t){const n=new Headers(t==null?void 0:t.headers);n.set("Accept","application/json");const r=await fetch(e,{...t,headers:n});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function Ke(e){if(e==null)return"n/a";const t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}const wf=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}),vf=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});function hr(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function jf(e){const t=hr(e);return t?wf.format(t):e??""}function Hn(e){const t=hr(e);return t?vf.format(t):e??""}function zl(e,t){const n=hr(e);if(!n)return e??"";const r=t-n.getTime(),s=Math.abs(r);if(s>bf)return Hn(e);const a=r>=0?"ago":"from now",o=Math.round(s/1e3);if(o<45)return r>=0?"just now":"soon";if(o<90)return`1m ${a}`;const l=Math.round(o/60);if(l<60)return`${l}m ${a}`;if(l<90)return`1h ${a}`;const c=Math.round(l/60);return c<24?`${c}h ${a}`:c<36?`1d ${a}`:`${Math.round(c/24)}d ${a}`}function Pe({value:e,compact:t=!1,relative:n=!1,now:r=Date.now()}){const s=hr(e);return s?i.jsx("time",{dateTime:s.toISOString(),title:`UTC: ${s.toISOString()}`,children:n?zl(e,r):t?Hn(e):jf(e)}):i.jsx(i.Fragment,{children:e??""})}function ql(e,t){const n=hr(e);return n?Math.max(0,Math.floor((t-n.getTime())/1e3)):null}function cs(e,t){return e.status==="running"?ql(e.started_at,t)??e.runtime_seconds:e.runtime_seconds}function us(e,t){return e.status==="pending"?ql(e.created_at,t)??e.queue_wait_seconds:e.queue_wait_seconds}function kf(e){const[t,n]=A.useState(()=>Date.now());return A.useEffect(()=>{if(!e)return;n(Date.now());const r=window.setInterval(()=>n(Date.now()),yf);return()=>window.clearInterval(r)},[e]),t}function Nf(e){return(e??"").split(/\r?\n/).map(n=>n.trim()).find(Boolean)??""}function Dr(e,t,n=1){const r=Nf(t),s=n>1?` (${n})`:"";return r?`${e}${s}: ${r}`:`${e}${s}`}function Fr(e){return e==="openclaw_stdout"||e==="openclaw_stderr"}function Bl(e){return e.map(t=>t==null?void 0:t.trim()).filter(Boolean).join(` -`)}function Sf(e){const t=[];for(const n of e){const r=t[t.length-1];if(r&&Fr(n.event_type)&&r.eventType===n.event_type){r.count+=1,r.meta=n.ts,r.detail=Bl([r.detail,n.detail]),r.summary=Dr(n.summary,r.detail,r.count);continue}t.push({id:String(n.id),badge:n.event_type,meta:n.ts,summary:Fr(n.event_type)?Dr(n.summary,n.detail):n.summary,detail:n.detail,eventType:n.event_type,count:1})}return t}function Cf(e){const t=[];return e.forEach((n,r)=>{const s=t[t.length-1];if(s&&Fr(n.kind)&&s.kind===n.kind){s.count+=1,s.meta=n.timestamp,s.text=Bl([s.text,n.text]),s.summary=Dr(`${n.role} · ${n.kind}`,s.text,s.count);return}t.push({id:`${n.timestamp??"entry"}-${r}`,badge:n.title,meta:n.timestamp,summary:Fr(n.kind)?Dr(`${n.role} · ${n.kind}`,n.text):`${n.role} · ${n.kind}`,text:n.text,kind:n.kind,count:1})}),t}function lo(e,t,n,r){return e==="openclaw_stdout"?!1:t||n>=r-2}function _f(e){return{pending:{badge:"border-amber-300 bg-amber-50 text-amber-800",dot:"bg-amber-500"},running:{badge:"border-blue-300 bg-blue-50 text-blue-700",dot:"bg-blue-600"},blocked:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},denied:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},done:{badge:"border-emerald-300 bg-emerald-50 text-emerald-700",dot:"bg-emerald-600"},waiting_approval:{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}[e]??{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}function Ef(e,t){const n=new URLSearchParams;for(const[r,s]of Object.entries(e))s.trim()&&n.set(r,s.trim());return n.set("limit",String(t)),`/api/jobs?${n.toString()}`}function Pf(e,t,n=50){const r=new URLSearchParams;return e.trim()&&r.set("repo",e.trim()),t.trim()&&r.set("status",t.trim()),r.set("limit",String(n)),`/api/knowledge?${r.toString()}`}function Rf(e){return{timeseries:e==="overview",hooks:e==="hooks",deliveries:e==="deliveries"}}function If(e,t,n="day"){return`/api/webhooks/github/timeseries?${new URLSearchParams({from:e,to:t,bucket:n}).toString()}`}function Tf(e=50,t){const n=new URLSearchParams({limit:String(e)});return t&&n.set("cursor",t),`/api/webhooks/github/hooks?${n.toString()}`}function Af(e=50,t,n){const r=new URLSearchParams({limit:String(e)});t&&r.set("cursor",t);for(const[s,a]of Object.entries(n??{}))a!=null&&a.trim()&&r.set(s,a.trim());return`/api/webhooks/github/deliveries?${r.toString()}`}function _r(e=new Date){return{from:new Date(e.getTime()-720*60*60*1e3).toISOString(),to:e.toISOString()}}function Lf(e=Fl){return`/api/metrics/summary?timezone=${encodeURIComponent(e)}`}function Ze(e){try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.href:"#"}catch{return"#"}}function Tr(){return"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function Mf(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="github-agent-bridge:push")}function Of(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new Uint8Array(r.length);for(let a=0;an.id===t.id)?e:[...e,t]}function Ff(e,t){const n=co(t);return e.some(r=>co(r)===n)?e:[...e,t]}function co(e){return`${e.timestamp??""}:${e.role}:${e.kind}:${e.title}:${e.text}`}function zf(e){return["claimed","dispatch_started","dispatch_finished","done","blocked","denied","waiting_approval"].includes(e)}function qn(e){return["blocked","denied","waiting_approval"].includes(e)}function Fi(e,t){return e.status!=="running"?!1:t!=null&&t.is_admin?!0:!!(t!=null&&t.login&&e.trigger_actor&&t.login.toLowerCase()===e.trigger_actor.toLowerCase())}function qf(e=window.location.pathname){const t=e.match(/^\/jobs\/(\d+)\/?$/);return t?Number(t[1]):null}function Bf(e=window.location.pathname){return/^\/knowledge\/?$/.test(e)}function Uf(e=window.location.pathname){return/^\/mcp\/?$/.test(e)}function $f(e=window.location.pathname){return/^\/system\/?$/.test(e)}function Hf(e=window.location.pathname){const t=e.match(/^\/webhooks\/hooks\/([^/]+)\/?$/);return t?decodeURIComponent(t[1]):null}function Kf(e=window.location.pathname){const t=e.match(/^\/webhooks\/deliveries\/([^/]+)\/?$/);return t?decodeURIComponent(t[1]):null}function oi(e=window.location.pathname){return/^\/webhooks(?:\/(?:hooks|deliveries)\/[^/]+)?\/?$/.test(e)}function Ul(e){return e.startsWith("repo:")?e.slice(5):e}function uo(e){return Object.values(e).some(t=>t.trim()!=="")}function Qf(e){return[{key:"status",label:"Status",value:e.status},{key:"repo",label:"Repo",value:e.repo},{key:"thread",label:"Thread",value:e.thread},{key:"action",label:"Action",value:e.action},{key:"actor",label:"Actor",value:e.actor.trim()?`@${e.actor.trim().replace(/^@/,"")}`:""},{key:"intent",label:"Intent",value:e.intent}].filter(t=>t.value.trim()!=="")}function Vf(){var ps,ms,fs,xs,gs,bs,ys,ws,vs,js,ks,Ns,Ss,Cs,_s,Es,Ps,Rs,Is,Ts,As,Ls,Ms,Os,Ds,Fs,zs,qs,Bs,Us,$s,Hs,Ks,Qs,Vs,Ws,Gs,Js,Xs,Ys,Zs,ea,ta,na,ra,ia;const e=$o(),[t,n]=A.useState(Di),[r,s]=A.useState(oo),a=A.useRef(!1),[o,l]=A.useState(""),[c,u]=A.useState("proposed"),[d,h]=A.useState("overview"),[m,p]=A.useState({hook_id:"",event_name:"",repository:"",result:"",enqueue_status:""}),[b,w]=A.useState(()=>_r()),[v,y]=A.useState(null),[C,_]=A.useState(""),[N,F]=A.useState(()=>window.location.pathname),[j,q]=A.useState(null),M=qf(N),R=M!==null,z=Bf(N),k=Uf(N),E=$f(N),X=oi(N),D=Hf(N),P=Kf(N),$=!R&&!z&&!k&&!E&&!X,B=M,de=xe({queryKey:["metrics",Fl],queryFn:()=>Z(Lf()),enabled:$||E}),pe=xe({queryKey:["dashboard-status"],queryFn:()=>Z("/api/status")}),f=xe({queryKey:["me"],queryFn:()=>Z("/api/me"),refetchInterval:!1}),ie=X&&!!((ms=(ps=f.data)==null?void 0:ps.user)!=null&&ms.is_admin&&((fs=pe.data)!=null&&fs.webhook_configured)),Re=Rf(d),x=xe({queryKey:["web-push-config"],queryFn:()=>Z("/api/web-push/config"),enabled:!!((xs=f.data)!=null&&xs.user)}),Oe=xe({queryKey:["about"],queryFn:()=>Z("/api/about")}),lt=xe({queryKey:["job-actors"],queryFn:()=>Z("/api/jobs/actors"),enabled:$}),oe=xe({queryKey:["jobs",t,r],queryFn:()=>Z(Ef(t,r)),enabled:$,placeholderData:T=>T}),Qe=xe({queryKey:["processes"],queryFn:()=>Z("/api/processes"),enabled:E}),De=xe({queryKey:["systemd"],queryFn:()=>Z("/api/systemd"),enabled:E}),Ve=xe({queryKey:["alerts"],queryFn:()=>Z("/api/alerts"),enabled:E}),We=xe({queryKey:["webhook-summary"],queryFn:()=>Z("/api/webhooks/github/summary"),enabled:ie}),bt=xe({queryKey:["webhook-timeseries",b.from,b.to,"day"],queryFn:()=>Z(If(b.from,b.to)),enabled:ie&&Re.timeseries}),pr=xe({queryKey:["webhook-exceptions"],queryFn:()=>Z("/api/webhooks/github/exceptions"),enabled:ie&&Re.timeseries}),ct=ya({queryKey:["webhook-hooks"],queryFn:({pageParam:T})=>Z(Tf(50,T)),initialPageParam:null,getNextPageParam:T=>T.next_cursor??void 0,enabled:ie&&Re.hooks&&D===null&&P===null}),ut=ya({queryKey:["webhook-deliveries",m],queryFn:({pageParam:T})=>Z(Af(50,T,m)),initialPageParam:null,getNextPageParam:T=>T.next_cursor??void 0,enabled:ie&&Re.deliveries&&D===null&&P===null}),et=xe({queryKey:["webhook-hook",D],queryFn:()=>Z(`/api/webhooks/github/hooks/${encodeURIComponent(D??"")}`),enabled:ie&&D!==null}),mr=A.useCallback(async T=>{const ae=await Z(`/api/webhooks/github/hooks/${encodeURIComponent(T)}/ping`,{method:"POST"});return et.refetch(),window.setTimeout(()=>void et.refetch(),1500),ae.detail},[et]),Mt=xe({queryKey:["webhook-delivery",P],queryFn:()=>Z(`/api/webhooks/github/deliveries/${encodeURIComponent(P??"")}`),enabled:ie&&P!==null}),en=xe({queryKey:["knowledge",o,c],queryFn:()=>Z(Pf(o,c)),enabled:z}),Ot=xe({queryKey:["mcp-tokens"],queryFn:()=>Z("/api/mcp/tokens"),enabled:k&&!!((gs=f.data)!=null&&gs.user)}),fr=xe({queryKey:["mcp-users"],queryFn:()=>Z("/api/mcp/users"),enabled:k&&!!((bs=f.data)!=null&&bs.user)}),tn=xe({queryKey:["job",B],queryFn:()=>Z(`/api/jobs/${B}`),enabled:B!==null}),xr=xe({queryKey:["job-session",B],queryFn:()=>Z(`/api/jobs/${B}/session`),enabled:B!==null}),gr=xe({queryKey:["job-session-events",B],queryFn:()=>Z(`/api/jobs/${B}/session/events`),enabled:B!==null}),br=xe({queryKey:["job-session-transcript",B],queryFn:()=>Z(`/api/jobs/${B}/session/transcript`),enabled:B!==null}),yr=A.useCallback(async T=>{const ae=await Z(`/api/jobs/${T}/retry`,{method:"POST"});e.setQueryData(["job",T],{job:ae.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),S=A.useCallback(async T=>{const ae=await Z(`/api/jobs/${T}/dismiss`,{method:"POST"});e.setQueryData(["job",T],{job:ae.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),L=A.useCallback(async(T,ae)=>{const fe=await Z(`/api/jobs/${T}/cancel`,{method:"POST",body:JSON.stringify({reason:ae||""})});e.setQueryData(["job",T],{job:fe.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]}),e.invalidateQueries({queryKey:["dashboard-status"]})},[e]),K=A.useCallback(async(T,ae)=>{await Z(`/api/knowledge/proposals/${encodeURIComponent(T)}/${ae}`,{method:"POST"}),e.invalidateQueries({queryKey:["knowledge"]}),e.invalidateQueries({queryKey:["dashboard-status"]})},[e]),Y=A.useCallback(async T=>{await Z(`/api/knowledge/rules/${encodeURIComponent(T)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),se=A.useCallback(async(T,ae)=>{await Z(`/api/knowledge/rules/${encodeURIComponent(T)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:ae})}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),Fe=A.useCallback(async(T,ae)=>{const fe=await Z("/api/mcp/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T,user_login:ae||void 0})});return e.invalidateQueries({queryKey:["mcp-tokens"]}),fe},[e]),dt=A.useCallback(async(T,ae)=>{await Z(`/api/mcp/tokens/${encodeURIComponent(T)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_login:ae})}),e.invalidateQueries({queryKey:["mcp-tokens"]}),e.invalidateQueries({queryKey:["mcp-users"]})},[e]),Ge=A.useCallback(async T=>{await Z(`/api/mcp/tokens/${encodeURIComponent(T)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["mcp-tokens"]})},[e]),ht=A.useCallback(async T=>{const ae={refresh:"/api/autoupdate/refresh",apply:"/api/autoupdate/apply",complete:"/api/autoupdate/complete-pending"}[T];y(T),_("");try{await Z(ae,{method:"POST"}),e.invalidateQueries({queryKey:["dashboard-status"]})}catch(fe){e.invalidateQueries({queryKey:["dashboard-status"]}),_(fe instanceof Error?fe.message:String(fe))}finally{y(null)}},[e]),Dt=A.useCallback(async()=>{var sa;const T=(sa=x.data)==null?void 0:sa.public_key;if(!T)throw new Error("web_push_not_configured");if(!Tr())throw new Error("web_push_not_supported");if(await window.Notification.requestPermission()!=="granted")throw new Error("notification_permission_denied");const fe=await navigator.serviceWorker.register("/service-worker.js"),dc=await fe.pushManager.getSubscription()??await fe.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Of(T)});await Z("/api/web-push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(dc.toJSON())}),e.invalidateQueries({queryKey:["web-push-config"]})},[e,(ys=x.data)==null?void 0:ys.public_key]),_e=A.useCallback(async()=>{if(!Tr())return;const ae=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!ae)return;const fe=ae.endpoint;await ae.unsubscribe(),await Z("/api/web-push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:fe})}),e.invalidateQueries({queryKey:["web-push-config"]})},[e]);A.useEffect(()=>{var T;!((T=x.data)!=null&&T.status.enabled)||!Tr()||navigator.serviceWorker.register("/service-worker.js").catch(()=>{})},[(ws=x.data)==null?void 0:ws.status.enabled]),A.useEffect(()=>{if(B===null)return;const T=new EventSource(`/api/jobs/${B}/session/stream`);return T.addEventListener("session_event",ae=>{const fe=zr(ae);fe&&(e.setQueryData(["job-session-events",B],wt=>({events:Df((wt==null?void 0:wt.events)??[],fe)})),zf(fe.event_type)&&(e.invalidateQueries({queryKey:["job",B]}),e.invalidateQueries({queryKey:["jobs"]})))}),T.addEventListener("transcript_entry",ae=>{const fe=zr(ae);!fe||fe.job_id!==B||e.setQueryData(["job-session-transcript",B],wt=>({entries:Ff((wt==null?void 0:wt.entries)??[],fe.entry)}))}),T.onerror=()=>{e.invalidateQueries({queryKey:["job",B]}),e.invalidateQueries({queryKey:["job-session-events",B]}),e.invalidateQueries({queryKey:["job-session-transcript",B]})},()=>T.close()},[B,e]),A.useEffect(()=>{const T=()=>{oi(window.location.pathname)&&w(_r()),F(window.location.pathname)};return window.addEventListener("popstate",T),()=>window.removeEventListener("popstate",T)},[]),A.useEffect(()=>{if(!("serviceWorker"in navigator))return;const T=ae=>{if(!Mf(ae.data))return;const fe={...ae.data.payload,id:Date.now(),receivedAt:Date.now()};q(fe),fe.job_id&&(e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["job",fe.job_id]}),e.invalidateQueries({queryKey:["metrics"]}))};return navigator.serviceWorker.addEventListener("message",T),()=>navigator.serviceWorker.removeEventListener("message",T)},[e]),A.useEffect(()=>{if(!j)return;const T=window.setTimeout(()=>q(null),12e3);return()=>window.clearTimeout(T)},[j]);const pt=A.useCallback(T=>{window.history.pushState({},"",En(T)),F(window.location.pathname)},[]),be=A.useCallback(T=>{window.history.pushState({},"",T),oi(T)&&w(_r()),F(window.location.pathname)},[]),nn=((vs=de.data)==null?void 0:vs.metrics.status_counts)??{},wr=((js=oe.data)==null?void 0:js.jobs)??[],tc=!!((Ns=(ks=f.data)==null?void 0:ks.user)!=null&&Ns.is_admin&&$l((Ss=pe.data)==null?void 0:Ss.autoupdate)),nc=A.useCallback(T=>{n(T),s(oo),a.current=!1},[]);A.useEffect(()=>{oe.isFetching||(a.current=!1)},[oe.isFetching]);const rc=A.useCallback(()=>{a.current||(a.current=!0,s(T=>T+gf))},[]),yt=B?((Cs=tn.data)==null?void 0:Cs.job)??null:null,ic=wr.some(T=>T.status==="running"||T.status==="pending")||(yt==null?void 0:yt.status)==="running"||(yt==null?void 0:yt.status)==="pending"||!!((_s=Qe.data)!=null&&_s.running_jobs.length),Rn=kf(ic),sc=i.jsx(lx,{selectedJobId:B,selectedJob:yt,loading:tn.isLoading,error:tn.error,session:(Es=xr.data)==null?void 0:Es.session,sessionEvents:(Ps=gr.data)==null?void 0:Ps.events,transcript:(Rs=br.data)==null?void 0:Rs.entries,now:Rn}),ac=((Is=ct.data)==null?void 0:Is.pages.flatMap(T=>T.hooks))??[],oc=((Ts=ut.data)==null?void 0:Ts.pages.flatMap(T=>T.deliveries))??[],lc=d==="overview"?bt.isLoading:d==="hooks"?ct.isLoading:ut.isLoading,cc=d==="overview"?bt.error:d==="hooks"?ct.error:ut.error,uc=()=>{We.refetch(),d==="overview"&&pr.refetch(),d==="overview"&&w(_r()),d==="hooks"&&ct.refetch(),d==="deliveries"&&ut.refetch()};return i.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[i.jsx("header",{className:"border-b border-slate-800 bg-slate-950 text-white",children:i.jsxs("div",{className:"mx-auto flex w-full max-w-[1440px] items-center justify-between gap-3 px-4 py-4 md:px-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"truncate text-xl font-semibold",children:"GitHub Agent Bridge"}),i.jsx(Wf,{about:Oe.data})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsx(wx,{config:x.data,loading:x.isLoading,onEnable:Dt,onDisable:_e}),i.jsx(yx,{user:(As=f.data)==null?void 0:As.user,loading:f.isLoading})]})]})}),i.jsxs("main",{className:"mx-auto grid w-full max-w-[1440px] gap-4 px-3 py-4 sm:px-4 md:px-6 md:py-5",children:[i.jsx(ex,{isDashboardRoute:$,isSystemRoute:E,isKnowledgeRoute:z,isMcpRoute:k,isWebhooksRoute:X,showWebhooks:!!((Ms=(Ls=f.data)==null?void 0:Ls.user)!=null&&Ms.is_admin&&((Os=pe.data)!=null&&Os.webhook_configured)),knowledgeBadgeCount:((zs=(Fs=(Ds=pe.data)==null?void 0:Ds.metrics)==null?void 0:Fs.knowledge)==null?void 0:zs.proposed)??0,systemUpdateAvailable:tc,onNavigate:be}),i.jsx(vx,{notification:j,onDismiss:()=>q(null),onNavigate:be}),M!==null?i.jsx(ox,{jobId:M,detail:sc,selectedJob:yt,user:(qs=f.data)==null?void 0:qs.user,onBackToDashboard:()=>be("/"),onRetry:yr,onDismiss:S,onCancel:L,onRefresh:()=>{tn.refetch(),xr.refetch(),gr.refetch(),br.refetch()}}):z?i.jsx(cx,{data:en.data,loading:en.isLoading,error:en.error,repo:o,status:c,user:(Bs=f.data)==null?void 0:Bs.user,now:Rn,onRepoChange:l,onStatusChange:u,onApprove:T=>K(T,"approve"),onReject:T=>K(T,"reject"),onUpdateRuleScope:se,onDeleteRule:Y,onRefresh:()=>en.refetch()}):k?i.jsx(fx,{tokens:(Us=Ot.data)==null?void 0:Us.tokens,loading:Ot.isLoading,error:Ot.error,user:($s=f.data)==null?void 0:$s.user,ownerOptions:((Hs=fr.data)==null?void 0:Hs.users)??[],dashboardUrl:(Ks=pe.data)==null?void 0:Ks.dashboard_url,dashboardUrlSource:(Qs=pe.data)==null?void 0:Qs.dashboard_url_source,now:Rn,onCreate:Fe,onUpdateOwner:dt,onRevoke:Ge,onRefresh:()=>Ot.refetch()}):X?P?i.jsx(sx,{data:Mt.data,loading:Mt.isLoading,error:Mt.error,onBack:()=>{h("deliveries"),be("/webhooks")},onRefresh:()=>Mt.refetch(),onViewHook:T=>be(`/webhooks/hooks/${encodeURIComponent(T)}`),onViewJob:pt}):D?i.jsx(ix,{data:et.data,loading:et.isLoading,error:et.error,onBack:()=>{h("hooks"),be("/webhooks")},onRefresh:()=>et.refetch(),onViewHook:T=>be(`/webhooks/hooks/${encodeURIComponent(T)}`),onViewDelivery:T=>be(`/webhooks/deliveries/${encodeURIComponent(T)}`),onPing:mr}):i.jsx(tx,{summary:We.data,timeseries:(Vs=bt.data)==null?void 0:Vs.points,exceptions:(Ws=pr.data)==null?void 0:Ws.exceptions,hooks:ac,deliveries:oc,section:d,summaryLoading:We.isLoading,sectionLoading:lc,loadingMore:d==="hooks"?ct.isFetchingNextPage:ut.isFetchingNextPage,hasMore:d==="hooks"?ct.hasNextPage:ut.hasNextPage,deliveryFilters:m,error:We.error??cc,onSectionChange:h,onLoadMore:()=>d==="hooks"?ct.fetchNextPage():ut.fetchNextPage(),onDeliveryFiltersChange:p,onViewHook:T=>be(`/webhooks/hooks/${encodeURIComponent(T)}`),onViewDelivery:T=>be(`/webhooks/deliveries/${encodeURIComponent(T)}`),onRefresh:uc}):E?i.jsxs(i.Fragment,{children:[i.jsx(Gf,{state:(Gs=pe.data)==null?void 0:Gs.autoupdate,isAdmin:!!((Xs=(Js=f.data)==null?void 0:Js.user)!=null&&Xs.is_admin),runningAction:v,actionError:C,onRefresh:()=>ht("refresh"),onApply:()=>ht("apply"),onCompletePending:()=>ht("complete")}),i.jsx(ax,{processes:Qe.data,processesLoading:Qe.isLoading,processesError:Qe.error,systemd:De.data,systemdLoading:De.isLoading,systemdError:De.error,alerts:(Ys=Ve.data)==null?void 0:Ys.alerts,alertsLoading:Ve.isLoading,alertsError:Ve.error,now:Rn,onRefreshProcesses:()=>Qe.refetch(),onRefreshSystemd:()=>De.refetch(),onRefreshAlerts:()=>Ve.refetch()})]}):i.jsxs(i.Fragment,{children:[de.error?i.jsx(we,{tone:"error",text:de.error.message}):null,pe.error?i.jsx(we,{tone:"error",text:pe.error.message}):null,i.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Summary metrics",children:[i.jsx(Se,{title:"Pending",value:nn.pending??0,icon:i.jsx(Wo,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Running",value:nn.running??0,icon:i.jsx(Jt,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Blocked",value:nn.blocked??0,icon:i.jsx(Br,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Done",value:nn.done??0,icon:i.jsx(kn,{className:"h-5 w-5"})})]}),i.jsxs("section",{className:"grid gap-3",children:[i.jsx(jx,{count:wr.length,limit:r,loading:oe.isLoading,onRefresh:()=>oe.refetch()}),i.jsxs(le,{title:"Recent jobs",flushHeader:!0,children:[i.jsx(kx,{filters:t,actorOptions:((Zs=lt.data)==null?void 0:Zs.actors)??[],onChange:nc}),oe.error?i.jsx(we,{tone:"error",text:oe.error.message}):null,i.jsx(Sx,{jobs:wr,loading:oe.isLoading,loadingMore:oe.isFetching&&!oe.isLoading,hasMore:wr.length>=r,onLoadMore:rc,onViewJob:pt,now:Rn,user:(ea=f.data)==null?void 0:ea.user,onRetry:yr,onDismiss:S,onCancel:L})]}),i.jsx(le,{title:"Runtime usage",action:i.jsx(Ye,{onClick:()=>de.refetch()}),children:i.jsx(Fx,{usage:(ta=de.data)==null?void 0:ta.metrics.runtime_usage,loading:de.isLoading,totalJobs:fo(nn)})})]}),i.jsxs("section",{className:"grid gap-4 xl:grid-cols-3",children:[i.jsx(le,{title:"Runtime percentiles",children:i.jsx(mo,{label:"runtime",values:(na=de.data)==null?void 0:na.metrics.runtime_seconds})}),i.jsx(le,{title:"Jobs per day",children:i.jsx(Dx,{values:(ra=de.data)==null?void 0:ra.metrics.by_created_day,loading:de.isLoading,totalJobs:fo(nn)})}),i.jsx(le,{title:"Queue wait percentiles",children:i.jsx(mo,{label:"queue wait",values:(ia=de.data)==null?void 0:ia.metrics.queue_wait_seconds})})]})]})]})]})}function Wf({about:e}){const t=e!=null&&e.version?`v${e.version}`:"version loading";return i.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-slate-300",children:[i.jsx("span",{children:"Operational dashboard"}),i.jsx("span",{className:"font-mono text-xs text-slate-400",children:t}),e!=null&&e.repository_url?i.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-slate-200 hover:underline",href:Ze(e.repository_url),rel:"noreferrer",target:"_blank",children:[i.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"GitHub"]}):null]})}function $l(e){var t,n;return!!((n=(t=e==null?void 0:e.target)==null?void 0:t.tag_name)!=null&&n.trim()&&e.decision!=="noop")}function Gf({state:e,isAdmin:t,runningAction:n=null,actionError:r="",onRefresh:s,onApply:a,onCompletePending:o}){var v,y,C,_,N,F,j,q,M,R,z;if(!e||!$l(e))return null;const l=(y=(v=e==null?void 0:e.target)==null?void 0:v.tag_name)==null?void 0:y.trim();if(!t||!l)return null;const c=Jf(e.decision),u=((C=e.queue)==null?void 0:C.active_total)??0,d=Xf((_=e.classification)==null?void 0:_.risk),h=Yf((N=e.target)==null?void 0:N.body),m=((j=(F=e.classification)==null?void 0:F.migration_files)==null?void 0:j.length)??0,p=((M=(q=e.classification)==null?void 0:q.risky_files)==null?void 0:M.length)??0,b=!!(e.executor_reload_pending&&e.dashboard_applied_at&&o),w=!!(a&&m===0);return i.jsxs("section",{className:"rounded-md border border-amber-300 bg-amber-50 p-3 text-amber-950 shadow-sm","aria-label":"Update available",children:[i.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(Br,{className:"h-4 w-4 text-amber-700","aria-hidden":!0}),i.jsx("h2",{className:"text-sm font-semibold",children:"Update available"}),i.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-1.5 py-0.5 font-mono text-[11px] text-amber-800",children:l}),(R=e.target)!=null&&R.url?i.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-amber-800 hover:underline",href:Ze(e.target.url),rel:"noreferrer",target:"_blank",children:[i.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Release"]}):null]}),i.jsxs("p",{className:"mt-1 text-sm text-amber-900",children:[c,e.installed_tag?i.jsxs("span",{className:"font-mono",children:[" from ",e.installed_tag]}):null]}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[s?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:s,children:[i.jsx(cr,{className:W("h-3.5 w-3.5",n==="refresh"&&"animate-spin"),"aria-hidden":!0}),n==="refresh"?"Checking...":"Check now"]}):null,w?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md bg-amber-800 px-2.5 text-xs font-semibold text-white hover:bg-amber-900 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:()=>{window.confirm(`Apply ${l}? This can restart bridge services according to the recorded safe plan.`)&&(a==null||a())},children:[i.jsx(kn,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="apply"?"Applying...":"Apply update"]}):null,b?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:o,children:[i.jsx(Gn,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="complete"?"Completing...":"Complete reload"]}):null]})]}),i.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-3 lg:min-w-[420px]",children:[i.jsx(li,{label:"Impact",value:d}),i.jsx(li,{label:"Active jobs",value:String(u)}),i.jsx(li,{label:"Admin only",value:"autoupdate"})]})]}),e.blocked_reason||e.executor_reload_pending||m>0||p>0?i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[e.executor_reload_pending?i.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-semibold",children:"executor reload pending"}):null,e.blocked_reason?i.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono",children:e.blocked_reason}):null,m>0?i.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[m," migration file",m===1?"":"s"]}):null,p>0?i.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[p," executor/shared file",p===1?"":"s"]}):null]}):null,h?i.jsxs("div",{className:"mt-3 rounded-md border border-amber-200 bg-white/70 p-2.5",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-800",children:"Changelog preview"}),i.jsx(Zf,{markdown:h})]}):null,(z=e.warnings)!=null&&z.length?i.jsx("div",{className:"mt-2 font-mono text-xs text-amber-800",children:e.warnings[0]}):null,r?i.jsxs("div",{className:"mt-2 rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono text-xs text-amber-900",children:["Action failed: ",r]}):null]})}function li({label:e,value:t}){return i.jsxs("div",{className:"min-w-0 rounded-md border border-amber-200 bg-white/80 px-2 py-1.5",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-700",children:e}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-amber-950",children:t})]})}function Jf(e){return{stage_dashboard_reload:"Dashboard reload can be staged now",stage_defer_executor_reload:"Dashboard reload can be staged; executor reload waits for the queue",stage_full_reload:"Full reload can be staged now",defer_migration:"Migration release is waiting for a quiet queue"}[e??""]??"Update plan recorded"}function Xf(e){return{dashboard_only:"dashboard only",executor_or_queue:"executor or queue",executor_or_shared:"executor or shared",migration_required:"migration",none:"none"}[e??""]??"unknown"}function Yf(e){return(e??"").trim()}function Zf({markdown:e}){return i.jsx("div",{className:"mt-1 text-sm leading-relaxed text-amber-950",children:i.jsx(Tm,{allowedElements:["a","blockquote","code","em","h1","h2","h3","h4","li","ol","p","strong","ul"],components:{a:({href:t,children:n})=>i.jsx("a",{className:"font-semibold text-amber-800 underline underline-offset-2",href:Ze(t??""),rel:"noreferrer",target:"_blank",children:n}),blockquote:({children:t})=>i.jsx("blockquote",{className:"mt-2 border-l-2 border-amber-300 pl-2 text-amber-900",children:t}),code:({children:t})=>i.jsx("code",{className:"rounded-sm bg-amber-100 px-1 py-0.5 font-mono text-[0.85em] text-amber-950",children:t}),h1:({children:t})=>i.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h2:({children:t})=>i.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h3:({children:t})=>i.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h4:({children:t})=>i.jsx("h4",{className:"mt-2 text-xs font-semibold uppercase text-amber-800 first:mt-0",children:t}),li:({children:t})=>i.jsx("li",{className:"break-words pl-0.5 [overflow-wrap:anywhere]",children:t}),ol:({children:t})=>i.jsx("ol",{className:"mt-1 list-decimal space-y-1 pl-5 first:mt-0",children:t}),p:({children:t})=>i.jsx("p",{className:"mt-1 break-words [overflow-wrap:anywhere] first:mt-0",children:t}),strong:({children:t})=>i.jsx("strong",{className:"font-semibold",children:t}),em:({children:t})=>i.jsx("em",{className:"italic",children:t}),ul:({children:t})=>i.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 first:mt-0",children:t})},children:e})})}function ex({isDashboardRoute:e,isSystemRoute:t=!1,isKnowledgeRoute:n,isMcpRoute:r=!1,isWebhooksRoute:s=!1,showWebhooks:a=!1,knowledgeBadgeCount:o=0,systemUpdateAvailable:l=!1,onNavigate:c}){return i.jsxs("nav",{className:"flex min-w-0 rounded-lg border border-border bg-panel p-1 shadow-sm","aria-label":"Dashboard sections",children:[i.jsxs(Fn,{href:"/",active:e,onNavigate:c,children:[i.jsx(Xo,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"Jobs"})]}),i.jsxs(Fn,{href:"/system",active:t,onNavigate:c,children:[i.jsx(uu,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"System"}),l?i.jsx("span",{className:W("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1 font-mono text-[11px] leading-none",t?"border-white/40 bg-white/15 text-white":"border-amber-200 bg-amber-100 text-amber-800"),"aria-label":"System update available",children:"!"}):null]}),a?i.jsxs(Fn,{href:"/webhooks",active:s,onNavigate:c,children:[i.jsx(Jt,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"Webhooks"})]}):null,i.jsxs(Fn,{href:"/knowledge",active:n,onNavigate:c,children:[i.jsx(Vi,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"Knowledge"}),o>0?i.jsx("span",{className:W("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1 font-mono text-[11px] leading-none",n?"border-white/40 bg-white/15 text-white":"border-amber-200 bg-amber-100 text-amber-800"),"aria-label":`${o} proposed knowledge ${o===1?"item":"items"}`,children:o}):null]}),i.jsxs(Fn,{href:"/mcp",active:r,onNavigate:c,children:[i.jsx(Lr,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"MCP"})]})]})}function an({text:e}){return i.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted",children:[i.jsx(cr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),e]})}function tx({summary:e,timeseries:t,exceptions:n,hooks:r,deliveries:s,section:a,summaryLoading:o,sectionLoading:l,loadingMore:c,hasMore:u,deliveryFilters:d,error:h,onSectionChange:m,onLoadMore:p,onDeliveryFiltersChange:b,onViewHook:w,onViewDelivery:v=()=>{},onRefresh:y}){var N,F,j,q,M,R,z;const C=Object.values((e==null?void 0:e.receipts)??{}).reduce((k,E)=>k+E,0),_=[{id:"overview",label:"Overview"},{id:"hooks",label:"Hooks",count:(N=e==null?void 0:e.totals)==null?void 0:N.hooks},{id:"deliveries",label:"Deliveries",count:(F=e==null?void 0:e.totals)==null?void 0:F.deliveries}];return i.jsxs("section",{className:"grid gap-4",children:[i.jsx(Kl,{icon:i.jsx(Jt,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"GitHub webhooks",subtitle:(e==null?void 0:e.mode)==="primary"?"Primary webhook ingestion. IMAP remains active as an idempotent safety net.":(e==null?void 0:e.mode)==="canary"?"Canary ingestion health. Only the webhook canary allowlist may create jobs.":"Shadow ingestion health. Deliveries are observed but do not create jobs.",action:i.jsx(Ye,{onClick:y})}),h?i.jsx(we,{tone:"error",text:h.message}):null,i.jsx("div",{className:"flex max-w-full flex-wrap rounded-md border border-border bg-white p-1",role:"tablist","aria-label":"Webhook dashboard section",children:_.map(k=>i.jsxs("button",{type:"button",role:"tab","aria-label":k.count===void 0?k.label:`${k.label} (${k.count} total)`,"aria-selected":a===k.id,className:W("inline-flex h-8 items-center gap-2 rounded px-3 text-sm font-semibold",a===k.id?"bg-primary text-white":"text-muted hover:bg-slate-50 hover:text-foreground"),onClick:()=>m(k.id),children:[k.label,k.count!==void 0?i.jsx("span",{className:"rounded border border-current/30 px-1 font-mono text-[10px]",children:k.count}):null]},k.id))}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Webhook status",children:[i.jsx(Se,{title:"Receipts",value:C,icon:i.jsx(Jt,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Duplicates",value:(e==null?void 0:e.duplicate_deliveries)??0,icon:i.jsx(cr,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Cross-source matches",value:(e==null?void 0:e.cross_source_matches)??0,icon:i.jsx(Nn,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Mode",value:o?"…":(e==null?void 0:e.mode)??"unknown",icon:i.jsx(Go,{className:"h-5 w-5"})})]}),a==="overview"?i.jsxs(i.Fragment,{children:[i.jsx(le,{title:"Delivery activity",children:l?i.jsx(an,{text:"Loading delivery activity…"}):t!=null&&t.length?i.jsx("div",{className:"h-72","aria-label":"Webhook deliveries over time",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:t,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"bucket"}),i.jsx(ar,{allowDecimals:!1}),i.jsx(or,{}),i.jsx(Po,{}),i.jsx(Wt,{dataKey:"observed",stackId:"deliveries",fill:"#2563eb"}),i.jsx(Wt,{dataKey:"duplicate",stackId:"deliveries",fill:"#f59e0b"}),i.jsx(Wt,{dataKey:"unsupported",stackId:"deliveries",fill:"#94a3b8"})]})})}):i.jsx(J,{text:"No webhook activity in the selected 30-day window."})}),i.jsx(le,{title:"Receipt states",children:o?i.jsx(an,{text:"Loading webhook summary…"}):Object.keys((e==null?void 0:e.receipts)??{}).length?i.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Object.entries((e==null?void 0:e.receipts)??{}).sort(([k],[E])=>k.localeCompare(E)).map(([k,E])=>i.jsx(V,{label:k,value:E},k))}):i.jsx(J,{text:"No webhook deliveries observed yet."})}),i.jsxs(le,{title:"Cross-source coverage",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(V,{label:"Both sources",value:((j=e==null?void 0:e.coverage)==null?void 0:j.both)??0}),i.jsx(V,{label:"IMAP only",value:((q=e==null?void 0:e.coverage)==null?void 0:q.imap_only)??0}),i.jsx(V,{label:"Webhook only",value:((M=e==null?void 0:e.coverage)==null?void 0:M.webhook_only)??0}),i.jsx(V,{label:"Coverage",value:((R=e==null?void 0:e.coverage)==null?void 0:R.ratio)==null?"not measurable":`${Math.round(e.coverage.ratio*100)}%`})]}),(z=e==null?void 0:e.coverage)!=null&&z.window_start&&e.coverage.window_end?i.jsxs("p",{className:"mt-3 font-mono text-xs text-muted",children:["Comparable canonical events from ",e.coverage.window_start," to ",e.coverage.window_end,"; newest ",e.coverage.grace_seconds??0,"s excluded."]}):null]}),Object.keys((e==null?void 0:e.enqueue)??{}).length?i.jsx(le,{title:"Canary ingestion decisions",children:i.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Object.entries((e==null?void 0:e.enqueue)??{}).sort(([k],[E])=>k.localeCompare(E)).map(([k,E])=>i.jsx(V,{label:k,value:E},k))})}):null,i.jsx(le,{title:"Exceptions requiring review",children:n!=null&&n.length?i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[i.jsx("thead",{className:"border-b border-border text-xs text-muted",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-3 py-2",children:"Type"}),i.jsx("th",{className:"px-3 py-2",children:"Repository"}),i.jsx("th",{className:"px-3 py-2",children:"Reference"}),i.jsx("th",{className:"px-3 py-2",children:"Observed"})]})}),i.jsx("tbody",{children:n.map(k=>i.jsxs("tr",{className:"border-b border-border/70 last:border-0",children:[i.jsx("td",{className:"px-3 py-2 font-semibold",children:k.kind}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:k.repository??"unknown"}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:k.event_key??k.reference}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted",children:k.created_at})]},`${k.kind}:${k.reference}`))})]})}):i.jsx(J,{text:"No cross-source exceptions in retained data."})})]}):null,a==="hooks"?i.jsx(le,{title:"Hook inventory",children:l?i.jsx(an,{text:"Loading hook inventory…"}):r!=null&&r.length?i.jsx(zi,{noun:"hooks",hasMore:u,loading:c,onLoadMore:p,children:i.jsxs("table",{className:"w-full min-w-[920px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[i.jsx("th",{className:"px-3 py-2",children:"Target"}),i.jsx("th",{className:"px-3 py-2",children:"State"}),i.jsx("th",{className:"px-3 py-2",children:"Configuration"}),i.jsx("th",{className:"px-3 py-2",children:"Last delivery"}),i.jsx("th",{className:"px-3 py-2",children:"Last ping"})]})}),i.jsx("tbody",{children:r.map(k=>i.jsxs("tr",{className:"cursor-pointer border-b border-border/70 last:border-0 hover:bg-slate-50",onClick:()=>w(k.id),children:[i.jsxs("td",{className:"px-3 py-3",children:[i.jsx("button",{type:"button",className:"text-left font-semibold text-primary hover:underline",onClick:E=>{E.stopPropagation(),w(k.id)},children:k.target}),i.jsxs("div",{className:"font-mono text-xs text-muted",children:[k.target_type," · #",k.id]})]}),i.jsx("td",{className:"px-3 py-3",children:i.jsx("span",{className:W("rounded border px-2 py-1 text-xs font-semibold",k.status==="receiving"?"border-emerald-200 bg-emerald-50 text-emerald-700":k.status==="inactive"?"border-red-200 bg-red-50 text-red-700":"border-slate-200 bg-slate-50 text-slate-600"),children:k.status})}),i.jsxs("td",{className:"max-w-sm px-3 py-3 text-xs",children:[i.jsx("div",{children:k.events.join(", ")||"No event snapshot"}),i.jsxs("div",{className:"mt-1 font-mono text-muted",children:[k.content_type??"content type unknown"," · SSL ",k.ssl_verify===null||k.ssl_verify===void 0?"unknown":k.ssl_verify?"verified":"disabled"]})]}),i.jsxs("td",{className:"px-3 py-3 text-xs",children:[i.jsxs("div",{className:"font-semibold",children:[k.last_event_name??"Never",k.last_action?` · ${k.last_action}`:""]}),i.jsx("div",{className:"mt-1 font-mono text-muted",children:k.last_repository??k.last_event_at??"No delivery observed"})]}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:k.last_ping_at??"Never"})]},k.id))})]})}):i.jsx(J,{text:"No hook inventory is available. Redeliver a signed ping from GitHub to create the sanitized configuration snapshot."})}):null,a==="deliveries"?i.jsxs(le,{title:"Recent deliveries",children:[i.jsx(nx,{filters:d,onChange:b}),l?i.jsx(an,{text:"Loading deliveries…"}):s!=null&&s.length?i.jsx(zi,{noun:"deliveries",hasMore:u,loading:c,onLoadMore:p,children:i.jsx(Hl,{deliveries:s,onViewHook:w,onViewDelivery:v})}):i.jsx(J,{text:"No deliveries match the current filters."})]}):null]})}function nx({filters:e,onChange:t}){const n=[{key:"hook_id",label:"Hook ID",placeholder:"690954530"},{key:"event_name",label:"Event",placeholder:"issue_comment"},{key:"repository",label:"Repository",placeholder:"gisce/repository"},{key:"result",label:"Result",placeholder:"observed"},{key:"enqueue_status",label:"Ingestion",placeholder:"enqueued"}];return i.jsx("div",{className:"grid gap-2 border-b border-border p-3 sm:grid-cols-2 xl:grid-cols-5",children:n.map(r=>i.jsxs("label",{className:"grid gap-1 text-xs font-semibold text-muted",children:[r.label,i.jsx("input",{className:"h-9 rounded-md border border-border bg-white px-2 font-mono text-xs text-foreground",value:e[r.key],placeholder:r.placeholder,onChange:s=>t({...e,[r.key]:s.target.value})})]},r.key))})}function Hl({deliveries:e,onViewHook:t,onViewDelivery:n=()=>{}}){return i.jsxs("table",{className:"w-full min-w-[1120px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[i.jsx("th",{className:"px-3 py-2",children:"Received"}),i.jsx("th",{className:"px-3 py-2",children:"Hook"}),i.jsx("th",{className:"px-3 py-2",children:"Event"}),i.jsx("th",{className:"px-3 py-2",children:"Repository"}),i.jsx("th",{className:"px-3 py-2",children:"Result"}),i.jsx("th",{className:"px-3 py-2",children:"Ingestion"}),i.jsx("th",{className:"px-3 py-2",children:"Delivery"})]})}),i.jsx("tbody",{children:e.map(r=>{var s;return i.jsxs("tr",{className:"border-b border-border/70 last:border-0 hover:bg-slate-50",children:[i.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:r.created_at}),i.jsx("td",{className:"px-3 py-3",children:r.hook_id?i.jsxs("button",{type:"button",className:"text-left text-primary hover:underline",onClick:()=>t(r.hook_id),children:[i.jsx("span",{className:"block font-semibold",children:((s=r.hook)==null?void 0:s.target)??`Hook #${r.hook_id}`}),i.jsxs("span",{className:"font-mono text-xs",children:["#",r.hook_id]})]}):i.jsx("span",{className:"text-xs text-muted",children:"Unknown (legacy)"})}),i.jsxs("td",{className:"px-3 py-3 font-semibold",children:[r.event_name,r.action?` · ${r.action}`:""]}),i.jsx("td",{className:"px-3 py-3",children:r.repository??"—"}),i.jsxs("td",{className:"px-3 py-3",children:[i.jsx("span",{className:"rounded border border-border bg-slate-50 px-2 py-1 text-xs font-semibold",children:r.status}),r.duplicate_count?i.jsxs("span",{className:"ml-2 font-mono text-xs text-muted",children:[r.duplicate_count," retries"]}):null]}),i.jsx("td",{className:"px-3 py-3",children:r.enqueue_status?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"rounded border border-border bg-slate-50 px-2 py-1 text-xs font-semibold",children:r.enqueue_status}),r.job_id?i.jsxs("a",{className:"ml-2 font-mono text-xs font-semibold text-primary hover:underline",href:`/jobs/${r.job_id}`,children:["Job #",r.job_id]}):null]}):i.jsx("span",{className:"text-xs text-muted",children:"shadow"})}),i.jsx("td",{className:"max-w-[14rem] px-3 py-3",children:i.jsx("button",{type:"button",className:"block max-w-full truncate font-mono text-xs font-semibold text-primary hover:underline",title:r.delivery_id,onClick:()=>n(r.delivery_id),children:r.delivery_id})})]},r.delivery_id)})})]})}function zi({noun:e,hasMore:t,loading:n,onLoadMore:r,children:s,className:a}){return i.jsxs("div",{"data-testid":`lazy-scroll-${e}`,className:W("max-h-[640px] overflow-auto rounded-md border border-border",a),children:[s,i.jsx(rx,{noun:e,hasMore:t,loading:n,onLoadMore:r})]})}function rx({noun:e,hasMore:t,loading:n,onLoadMore:r}){const s=A.useRef(null),a=A.useRef(!1);return A.useEffect(()=>{n||(a.current=!1)},[n]),A.useEffect(()=>{const o=s.current;if(!o||!t||n||!r)return;const l=()=>{a.current||(a.current=!0,r())};if(!("IntersectionObserver"in window)){l();return}const c=new IntersectionObserver(u=>{u.some(d=>d.isIntersecting)&&l()},{rootMargin:"240px 0px"});return c.observe(o),()=>c.disconnect()},[t,n,e,r]),!t&&!n?null:i.jsx("div",{ref:s,className:"flex min-h-10 items-center justify-center border-t border-border px-3 py-2 text-xs font-medium text-muted","aria-live":"polite",children:n?`Loading more ${e}...`:`Scroll for more ${e}`})}function ix({data:e,loading:t,error:n,onBack:r,onRefresh:s,onViewHook:a,onViewDelivery:o=()=>{},onPing:l}){const[c,u]=A.useState(!1),[d,h]=A.useState(""),[m,p]=A.useState("");if(t)return i.jsx(an,{text:"Loading hook detail…"});if(n)return i.jsxs("div",{className:"grid gap-3",children:[i.jsx(we,{tone:"error",text:n.message}),i.jsx("button",{type:"button",className:"w-fit rounded border border-border px-3 py-2 text-sm font-semibold",onClick:r,children:"Back to hooks"})]});if(!e)return i.jsx(J,{text:"Hook detail is not available."});const b=e.hook,w=async()=>{if(!(!l||c)){u(!0),h(""),p("");try{h(await l(b.id))}catch(y){p(y instanceof Error?y.message:String(y))}finally{u(!1)}}},v=e.recent_actions??[];return i.jsxs("section",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",className:"mb-2 inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline",onClick:r,children:[i.jsx(Qi,{className:"h-4 w-4","aria-hidden":!0}),"Back to hooks"]}),i.jsx("h2",{className:"text-xl font-semibold",children:b.target}),i.jsxs("p",{className:"font-mono text-xs text-muted",children:[b.target_type," webhook #",b.id]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[b.ping_url&&l?i.jsxs("button",{type:"button",className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold hover:bg-slate-50 disabled:cursor-wait disabled:opacity-60",disabled:c,onClick:()=>void w(),children:[i.jsx(Jt,{className:W("h-4 w-4",c&&"animate-pulse"),"aria-hidden":!0}),c?"Sending ping…":"Send ping"]}):null,i.jsx(Ye,{onClick:s}),b.admin_url?i.jsxs("a",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold hover:bg-slate-50",href:Ze(b.admin_url),target:"_blank",rel:"noreferrer",children:[i.jsx(Xt,{className:"h-4 w-4","aria-hidden":!0}),"Open in GitHub"]}):null]})]}),m?i.jsx(we,{tone:"error",text:m}):null,d?i.jsx("div",{className:"rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-700",children:d}):null,i.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[i.jsx(Se,{title:"State",value:b.status,icon:i.jsx(Jt,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Deliveries",value:e.stats.deliveries,icon:i.jsx(Nn,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Retries",value:e.stats.duplicates,icon:i.jsx(cr,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Unsupported",value:e.stats.unsupported,icon:i.jsx(Br,{className:"h-5 w-5"})})]}),i.jsxs(le,{title:"Sanitized configuration",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.jsx(V,{label:"Active",value:b.active?"yes":"no"}),i.jsx(V,{label:"Content type",value:b.content_type??"unknown"}),i.jsx(V,{label:"SSL verification",value:b.ssl_verify===null||b.ssl_verify===void 0?"unknown":b.ssl_verify?"enabled":"disabled"}),i.jsx(V,{label:"Destination URL",value:b.delivery_url??"unknown"}),i.jsx(V,{label:"GitHub created",value:b.github_created_at??"unknown"}),i.jsx(V,{label:"GitHub updated",value:b.github_updated_at??"unknown"}),i.jsx(V,{label:"Last ping",value:b.last_ping_at??"never"}),i.jsx(V,{label:"Last delivery",value:b.last_event_at??"never"}),i.jsx(V,{label:"Last result",value:b.last_result??"unknown"})]}),i.jsxs("div",{className:"mt-3 rounded-md border border-border p-3",children:[i.jsx("div",{className:"text-xs font-semibold text-muted",children:"Subscribed events"}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.events.length?b.events.map(y=>i.jsx("span",{className:"rounded border border-border bg-slate-50 px-2 py-1 font-mono text-xs",children:y},y)):i.jsx("span",{className:"text-sm text-muted",children:"No event snapshot; send a ping to refresh it."})})]})]}),i.jsx(le,{title:"Latest observed delivery",children:i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.jsx(V,{label:"Event",value:b.last_event_name?`${b.last_event_name}${b.last_action?` · ${b.last_action}`:""}`:"none"}),i.jsx(V,{label:"Repository",value:b.last_repository??"none"}),i.jsx(V,{label:"Delivery ID",value:b.last_delivery_id??"none"})]})}),i.jsx(le,{title:"Recent administrative actions",children:v.length?i.jsx("div",{className:"divide-y divide-border rounded-md border border-border",children:v.map(y=>i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold",children:y.action}),i.jsxs("span",{className:"ml-2 text-muted",children:["by @",y.actor]})]}),i.jsxs("span",{className:"font-mono text-xs text-muted",children:[y.status," · ",y.created_at]})]},y.id))}):i.jsx(J,{text:"No administrative actions recorded for this hook."})}),i.jsx(le,{title:"Recent deliveries",children:e.recent_deliveries.length?i.jsx(Hl,{deliveries:e.recent_deliveries,onViewHook:a,onViewDelivery:o}):i.jsx(J,{text:"This hook has no retained deliveries."})})]})}function sx({data:e,loading:t,error:n,onBack:r,onRefresh:s,onViewHook:a,onViewJob:o}){if(t)return i.jsx(an,{text:"Loading delivery detail…"});if(n)return i.jsxs("div",{className:"grid gap-3",children:[i.jsx(we,{tone:"error",text:n.message}),i.jsx("button",{type:"button",className:"w-fit rounded border border-border px-3 py-2 text-sm font-semibold",onClick:r,children:"Back to deliveries"})]});if(!e)return i.jsx(J,{text:"Delivery detail is not available."});const l=e.delivery;return i.jsxs("section",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",className:"mb-2 inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline",onClick:r,children:[i.jsx(Qi,{className:"h-4 w-4","aria-hidden":!0}),"Back to deliveries"]}),i.jsxs("h2",{className:"text-xl font-semibold",children:[l.event_name,l.action?` · ${l.action}`:""]}),i.jsxs("p",{className:"font-mono text-xs text-muted",children:["Delivery ",l.delivery_id]})]}),i.jsx(Ye,{onClick:s})]}),i.jsxs(le,{title:"Delivery",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.jsx(V,{label:"Received",value:l.created_at}),i.jsx(V,{label:"Repository",value:l.repository??"unknown"}),i.jsx(V,{label:"Result",value:l.status}),i.jsx(V,{label:"Event key",value:l.event_key??"unmatchable"}),i.jsx(V,{label:"Payload SHA-256",value:e.payload_hash}),i.jsx(V,{label:"Retries",value:l.duplicate_count??0})]}),l.hook_id?i.jsxs("button",{type:"button",className:"mt-3 text-sm font-semibold text-primary hover:underline",onClick:()=>a(l.hook_id),children:["View hook #",l.hook_id]}):null]}),i.jsx(le,{title:"Generated job",children:e.job?i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-semibold",children:e.job.work_key}),i.jsxs("div",{className:"mt-1 font-mono text-xs text-muted",children:["Job #",e.job.id," · ",e.job.status," · ",e.job.action," · ",e.job.work_intent]})]}),i.jsx("button",{type:"button",className:"rounded-md border border-border px-3 py-2 text-sm font-semibold hover:bg-slate-50",onClick:()=>o(e.job.id),children:"Open job"})]}):i.jsx(J,{text:"This delivery did not generate or coalesce into a job."})}),i.jsx(le,{title:"Full payload",children:e.payload===null?i.jsx(J,{text:"Payload was not retained for this legacy delivery."}):i.jsx("pre",{className:"max-h-[640px] overflow-auto rounded-md border border-border bg-slate-950 p-4 font-mono text-xs leading-relaxed text-slate-100",children:JSON.stringify(e.payload,null,2)})})]})}function ax({processes:e,processesLoading:t,processesError:n,systemd:r,systemdLoading:s,systemdError:a,alerts:o,alertsLoading:l,alertsError:c,now:u,onRefreshProcesses:d,onRefreshSystemd:h,onRefreshAlerts:m}){return i.jsxs("section",{className:"grid gap-4","aria-label":"Bridge system",children:[i.jsxs(le,{title:"Systemd",action:i.jsx(Ye,{onClick:h}),children:[a?i.jsx(we,{tone:"error",text:a.message}):null,i.jsx(qx,{data:r,loading:s})]}),i.jsxs(le,{title:"Process activity",action:i.jsx(Ye,{onClick:d}),children:[n?i.jsx(we,{tone:"error",text:n.message}):null,i.jsx($x,{data:e,loading:t})]}),i.jsxs(le,{title:"Monitor alerts",action:i.jsx(Ye,{onClick:m}),children:[c?i.jsx(we,{tone:"error",text:c.message}):null,i.jsx(Hx,{alerts:o,loading:l,now:u})]})]})}function Fn({href:e,active:t,children:n,onNavigate:r}){return i.jsx("a",{className:W("inline-flex h-8 min-w-0 flex-1 items-center justify-center gap-1 rounded-md px-1.5 text-xs font-semibold sm:flex-none sm:gap-1.5 sm:px-3 sm:text-sm [&>span]:truncate [&>svg]:shrink-0",t?"bg-primary text-white shadow-sm":"text-muted hover:bg-slate-50 hover:text-foreground"),href:e,onClick:s=>{!r||s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.altKey||s.shiftKey||(s.preventDefault(),r(e))},children:n})}function ox({jobId:e,detail:t,selectedJob:n,user:r,onBackToDashboard:s,onRetry:a,onDismiss:o,onCancel:l,onRefresh:c}){const[u,d]=A.useState(!1),[h,m]=A.useState(!1),[p,b]=A.useState(!1),w=!!(r!=null&&r.is_admin&&n&&qn(n.status)),v=!!(n&&Fi(n,r)),y=u?"Retrying...":"Retry",C=h?"Dismissing...":"Dismiss",_=p?"Cancelling...":"Cancel";return i.jsxs("div",{className:"grid min-w-0 gap-3 sm:gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("a",{className:"inline-flex h-9 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50",href:"/",onClick:N=>{N.defaultPrevented||N.button!==0||N.metaKey||N.ctrlKey||N.altKey||N.shiftKey||(N.preventDefault(),s())},children:[i.jsx(Qi,{className:"h-4 w-4","aria-hidden":!0}),"Dashboard"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[w?i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:u,onClick:async()=>{if(window.confirm(`Retry job #${e}?`)){d(!0);try{await a(e)}finally{d(!1)}}},children:[i.jsx(Gn,{className:"h-4 w-4","aria-hidden":!0}),y]}):null,w?i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border bg-white px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:h,onClick:async()=>{if(window.confirm(`Dismiss job #${e}?`)){m(!0);try{await o(e)}finally{m(!1)}}},children:[i.jsx(kn,{className:"h-4 w-4","aria-hidden":!0}),C]}):null,v?i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-red-200 bg-red-50 px-3 text-sm font-semibold text-red-700 hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:p,onClick:async()=>{const N=window.prompt(`Cancel job #${e}? Optional reason:`);if(N!==null){b(!0);try{await l(e,N)}finally{b(!1)}}},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),_]}):null,i.jsx(Ye,{onClick:c})]})]}),i.jsx(le,{title:`Job #${e}`,className:"p-3 sm:p-4",children:t})]})}function lx({selectedJobId:e,selectedJob:t,loading:n,error:r,session:s,sessionEvents:a,transcript:o,now:l}){return t?i.jsx(Ax,{job:t,session:s,sessionEvents:a,transcript:o,now:l}):e!==null&&n?i.jsx(J,{text:"Loading selected job..."}):e!==null&&r?i.jsx(we,{tone:"error",text:`Job #${e}: ${r.message}`}):i.jsx(J,{text:"Select a job to inspect its timeline, worklog and GitHub links."})}function cx({data:e,loading:t,error:n,repo:r,status:s,user:a,now:o,onRepoChange:l,onStatusChange:c,onApprove:u,onReject:d,onUpdateRuleScope:h,onDeleteRule:m,onRefresh:p}){const b=(e==null?void 0:e.summary)??{},[w,v]=A.useState("proposals"),y=[{id:"proposals",label:"Proposals",count:(e==null?void 0:e.proposals.length)??0},{id:"rules",label:"Rules",count:(e==null?void 0:e.rules.length)??0},{id:"events",label:"Events",count:(e==null?void 0:e.events.length)??0}];return i.jsxs("div",{className:"grid min-w-0 gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[i.jsx(Vi,{className:"h-5 w-5 text-muted","aria-hidden":!0}),"Acquired knowledge"]}),i.jsx("p",{className:"text-xs text-muted",children:"Captured feedback, proposed rules and curated agent memory."})]}),i.jsx(Ye,{onClick:p})]}),n?i.jsx(we,{tone:"error",text:n.message}):null,i.jsxs("section",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4","aria-label":"Knowledge metrics",children:[i.jsx(Se,{title:"Proposed",value:b.proposed??0,icon:i.jsx(Wo,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Approved",value:b.approved??0,icon:i.jsx(kn,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Rules",value:b.rules??0,icon:i.jsx(Jo,{className:"h-5 w-5"})}),i.jsx(Se,{title:"Events",value:b.events??0,icon:i.jsx(Jt,{className:"h-5 w-5"})})]}),i.jsx(le,{title:"Filters",className:"p-3",children:i.jsxs("div",{className:W("grid gap-3",w==="proposals"?"md:grid-cols-[minmax(0,1fr)_220px]":"md:grid-cols-[minmax(0,1fr)]"),children:[i.jsx(Xe,{label:"Repository",children:i.jsxs("select",{className:"control",value:r,onChange:C=>l(C.target.value),children:[i.jsx("option",{value:"",children:"All repositories"}),((e==null?void 0:e.repositories)??[]).map(C=>i.jsx("option",{value:C,children:C},C))]})}),w==="proposals"?i.jsx(Xe,{label:"Proposal status",children:i.jsxs("select",{className:"control",value:s,onChange:C=>c(C.target.value),children:[i.jsx("option",{value:"",children:"All statuses"}),i.jsx("option",{value:"proposed",children:"proposed"}),i.jsx("option",{value:"approved",children:"approved"}),i.jsx("option",{value:"rejected",children:"rejected"}),i.jsx("option",{value:"error",children:"error"})]})}):null]})}),i.jsxs(le,{title:"Knowledge records",action:i.jsx("div",{className:"flex max-w-full flex-wrap rounded-md border border-border bg-white p-0.5",role:"tablist","aria-label":"Knowledge record type",children:y.map(C=>i.jsxs("button",{className:W("inline-flex h-8 items-center gap-1.5 rounded px-2.5 text-xs font-semibold",w===C.id?"bg-primary text-white":"text-muted hover:bg-slate-50 hover:text-foreground"),type:"button",role:"tab","aria-label":`${C.label} (${C.count})`,"aria-selected":w===C.id,onClick:()=>v(C.id),children:[i.jsx("span",{children:C.label}),i.jsx("span",{className:W("rounded-sm border px-1 font-mono text-[10px]",w===C.id?"border-white/40 text-white":"border-border text-muted"),children:C.count})]},C.id))}),children:[w==="proposals"?i.jsx(ux,{proposals:(e==null?void 0:e.proposals)??[],loading:t,isAdmin:!!(a!=null&&a.is_admin),now:o,onApprove:u,onReject:d}):null,w==="rules"?i.jsx(px,{rules:(e==null?void 0:e.rules)??[],loading:t,now:o,onUpdateRuleScope:h,onDeleteRule:m}):null,w==="events"?i.jsx(mx,{events:(e==null?void 0:e.events)??[],loading:t,now:o}):null]})]})}function ux({proposals:e,loading:t,isAdmin:n,now:r,onApprove:s,onReject:a}){const[o,l]=A.useState(null);return t&&e.length===0?i.jsx(J,{text:"Loading proposals..."}):e.length===0?i.jsx(J,{text:"No proposals match the current filters."}):i.jsx("div",{className:"grid gap-2",children:e.map(c=>i.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[i.jsx(Vl,{scope:c.scope,type:c.type,confidence:c.confidence,status:c.status,timestamp:c.updated_at,now:r}),i.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:c.rule||c.reason||"No reusable rule proposed."}),c.reason?i.jsx("p",{className:"min-w-0 break-words text-xs text-muted [overflow-wrap:anywhere]",children:c.reason}):null,c.source_event?i.jsx(dx,{event:c.source_event}):i.jsxs("p",{className:"font-mono text-xs text-muted",children:["Source event ",c.event_id]}),c.error?i.jsx(we,{tone:"error",text:c.error}):null,n&&c.status==="proposed"?i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:opacity-60",type:"button",disabled:o===c.id,onClick:async()=>{l(c.id);try{await s(c.id)}finally{l(null)}},children:[i.jsx(kn,{className:"h-4 w-4","aria-hidden":!0}),"Approve"]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:o===c.id,onClick:async()=>{l(c.id);try{await a(c.id)}finally{l(null)}},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),"Reject"]})]}):null]},c.id))})}function dx({event:e}){const t=e.trigger_actor||(e.actor!=="github"?e.actor:null);return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-md border border-border bg-slate-50 px-2 py-1.5",children:[i.jsx(Pn,{actor:t,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),e.source_job_id?i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:En(e.source_job_id),children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.source_job_id]}):null,e.github_urls.length>0?i.jsx(Xn,{urls:e.github_urls,compact:!0}):i.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})}function hx(e){const t=[{value:"global",label:"global"}];if(e.startsWith("repo:")){const n=e.slice(5),[r,s]=n.split("/",2);r&&s&&(t.push({value:`org:${r}`,label:`org:${r}`}),t.push({value:`repo:${r}/${s}`,label:`repo:${r}/${s}`}))}else e.startsWith("org:")&&t.push({value:e,label:e});return t.some(n=>n.value===e)||t.push({value:e,label:e}),t}function px({rules:e,loading:t,now:n,onUpdateRuleScope:r,onDeleteRule:s}){const[a,o]=A.useState(null),[l,c]=A.useState(null),[u,d]=A.useState("");return t&&e.length===0?i.jsx(J,{text:"Loading curated rules..."}):e.length===0?i.jsx(J,{text:"No curated rules match the current filters."}):i.jsx("div",{className:"grid gap-2",children:e.map(h=>{const m=h.source_event_details??[],p=m[0],b=p?p.trigger_actor||(p.actor!=="github"?p.actor:null):null,w=m.flatMap(N=>N.github_urls??[]),v=hx(h.scope),y=l===h.id,C=a===h.id,_=!!h.can_manage;return i.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsx(Vl,{scope:h.scope,type:h.type,confidence:h.confidence,status:`${h.observations} observation${h.observations===1?"":"s"}`,timestamp:h.last_seen,now:n}),_?i.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[y?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:"Scope",children:i.jsx("select",{className:"control h-8 min-w-[180px] py-1 text-xs",value:u,disabled:C,onChange:N=>d(N.target.value),children:v.map(N=>i.jsx("option",{value:N.value,children:N.label},N.value))})}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:C||u===h.scope,title:"Save scope",onClick:async()=>{if(u!==h.scope){o(h.id);try{await r(h.id,u),c(null)}finally{o(null)}}},children:[i.jsx(hu,{className:"h-4 w-4","aria-hidden":!0}),"Save"]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-muted hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:C,title:"Cancel scope edit",onClick:()=>{c(null),d("")},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),"Cancel"]})]}):i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:C,title:"Edit scope",onClick:()=>{c(h.id),d(h.scope)},children:[i.jsx(du,{className:"h-4 w-4","aria-hidden":!0}),"Edit"]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:opacity-60",type:"button",disabled:C,onClick:async()=>{if(window.confirm("Delete this curated rule?")){o(h.id);try{await s(h.id)}finally{o(null)}}},children:[i.jsx(Si,{className:"h-4 w-4","aria-hidden":!0}),"Delete"]})]}):null]}),i.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:h.rule}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx(Pn,{actor:b,avatarUrl:p==null?void 0:p.trigger_actor_avatar_url,framed:!0}),p!=null&&p.source_job_id?i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:En(p.source_job_id),children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",p.source_job_id]}):null,w.length>0?i.jsx(Xn,{urls:w,compact:!0}):i.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})]},h.id)})})}function mx({events:e,loading:t,now:n}){return t&&e.length===0?i.jsx(J,{text:"Loading captured events..."}):e.length===0?i.jsx(J,{text:"No captured feedback events match the current filters."}):i.jsx("div",{className:"grid gap-2",children:e.map(r=>{const s=r.trigger_actor||(r.actor!=="github"?r.actor:null);return i.jsxs("details",{className:"group rounded-md border border-border bg-white",children:[i.jsxs("summary",{className:"grid cursor-pointer list-none gap-2 px-3 py-2 marker:hidden hover:bg-slate-50",children:[i.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 font-mono text-xs font-semibold text-muted",children:[i.jsx(jn,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180","aria-hidden":!0}),i.jsx("span",{className:"truncate",children:Ul(r.scope)})]}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-muted",children:i.jsx(Pe,{value:r.occurred_at,relative:!0,now:n})})]}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx(Pn,{actor:s,avatarUrl:r.trigger_actor_avatar_url,framed:!0}),r.source_job_id?i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:En(r.source_job_id),children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",r.source_job_id]}):null,r.github_urls.length>0?i.jsx(Xn,{urls:r.github_urls,compact:!0}):i.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]}),i.jsx("p",{className:"line-clamp-2 break-words text-sm [overflow-wrap:anywhere]",children:r.comment})]}),i.jsxs("div",{className:"grid gap-2 border-t border-border px-3 py-2",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-xs font-semibold text-muted",children:"GitHub links"}),r.github_urls.length>0?i.jsx(Xn,{urls:r.github_urls}):i.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]}),i.jsx("pre",{className:"max-h-72 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:JSON.stringify(r.context,null,2)})]})]},r.id)})})}function fx({tokens:e,loading:t,error:n,user:r,ownerOptions:s,dashboardUrl:a,dashboardUrlSource:o,now:l,onCreate:c,onUpdateOwner:u,onRevoke:d,onRefresh:h}){const[m,p]=A.useState(""),[b,w]=A.useState(""),[v,y]=A.useState(!1),[C,_]=A.useState(null),[N,F]=A.useState(null),[j,q]=A.useState(null),[M,R]=A.useState(""),z=e??[],k=s.find(P=>P.login===b);A.useEffect(()=>{var P;r!=null&&r.is_admin&&(b&&s.some($=>$.login===b)||w((r==null?void 0:r.login)||((P=s[0])==null?void 0:P.login)||""))},[s,r==null?void 0:r.is_admin,r==null?void 0:r.login,b]);const E=(a||(typeof window>"u"?"":window.location.origin)).replace(/\/$/,""),X=`${E}/mcp`,D=`${E}/api/mcp`;return i.jsxs("div",{className:"grid min-w-0 gap-4",children:[i.jsx(Kl,{icon:i.jsx(Lr,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"MCP access",subtitle:r!=null&&r.is_admin?"Issue and revoke read-only tokens for any dashboard user.":"Issue and revoke read-only tokens linked to your user.",action:i.jsx(Ye,{onClick:h})}),n?i.jsx(we,{tone:"error",text:n.message}):null,M?i.jsx(we,{tone:"error",text:M}):null,i.jsx(xx,{dashboardUrl:X,endpointUrl:D,dashboardUrlSource:o??"request"}),j?i.jsxs("section",{className:"rounded-md border border-emerald-300 bg-emerald-50 p-3 text-emerald-950","aria-label":"Created MCP token",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-sm font-semibold",children:"Token created"}),i.jsx("p",{className:"mt-1 text-xs text-emerald-800",children:"This secret is shown once. Store it in the local agent environment before leaving this page."})]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-emerald-300 bg-white px-3 text-sm font-semibold text-emerald-900 hover:bg-emerald-100",type:"button",onClick:()=>q(null),children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),"Hide"]})]}),i.jsx("pre",{className:"mt-3 overflow-auto rounded bg-emerald-950 px-3 py-2 font-mono text-xs text-emerald-50",children:j.token})]}):null,i.jsx(le,{title:"Create token",children:i.jsxs("form",{className:r!=null&&r.is_admin?"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(12rem,16rem)_auto]":"grid gap-3 md:grid-cols-[minmax(0,1fr)_auto]",onSubmit:async P=>{P.preventDefault();const $=m.trim();if($){y(!0),R("");try{const B=await c($,r!=null&&r.is_admin?b:void 0);q(B),p("")}catch(B){R(B instanceof Error?B.message:String(B))}finally{y(!1)}}},children:[i.jsx(Xe,{label:"Token name",children:i.jsx("input",{className:"control",value:m,placeholder:"local agent",disabled:v,onChange:P=>p(P.target.value)})}),r!=null&&r.is_admin?i.jsxs(Xe,{label:"Owner",children:[i.jsx(Ql,{ariaLabel:"Owner",value:b,ownerOptions:s,disabled:v||s.length===0,selectedSuffix:P=>P.login===(r==null?void 0:r.login)?" (you)":"",emptyLabel:"No known users",onChange:w}),k?i.jsxs("span",{className:"font-normal text-muted",children:["Token will be linked to @",k.login,"."]}):null]}):null,i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 self-end rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"submit",disabled:v||!m.trim()||!!(r!=null&&r.is_admin&&!b),children:[i.jsx(Lr,{className:"h-4 w-4","aria-hidden":!0}),v?"Creating...":"Create token"]})]})}),i.jsx(le,{title:"Active tokens",children:i.jsx(gx,{tokens:z,loading:t,now:l,ownerOptions:s,canManageOwners:!!(r!=null&&r.is_admin),revokingId:C,updatingOwnerId:N,onUpdateOwner:async(P,$)=>{F(P),R("");try{await u(P,$)}catch(B){R(B instanceof Error?B.message:String(B))}finally{F(null)}},onRevoke:async P=>{if(window.confirm("Revoke this MCP token?")){_(P),R("");try{await d(P)}catch($){R($ instanceof Error?$.message:String($))}finally{_(null)}}}})})]})}function xx({dashboardUrl:e,endpointUrl:t,dashboardUrlSource:n}){const r=n==="configured"?"Configured public URL":n==="forwarded"?"Forwarded public URL":"Needs public URL",s=n==="request",a=s?"Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL or forward X-Forwarded-* headers":e,o=s?"Public dashboard URL required before connecting remote agents":t,c=`{ +`},s),a}function om(e,t){return e&&"run"in e?async function(n,r){const s=Xa(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Xa(n,{file:r,...e||t})}}function Ya(e){if(e)throw e}var Yr,Za;function lm(){if(Za)return Yr;Za=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},a=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var m;for(m in u);return typeof m>"u"||e.call(u,m)},o=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Yr=function c(){var u,d,h,m,p,w,b=arguments[0],v=1,y=arguments.length,j=!1;for(typeof b=="boolean"&&(j=b,b=arguments[1]||{},v=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});vo.length;let c;l&&o.push(s);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(a,s):c instanceof Error?s(c):a(c))}function s(o,...l){n||(n=!0,t(o,...l))}function a(o){s(null,o)}}const nt={basename:hm,dirname:pm,extname:mm,join:fm,sep:"/"};function hm(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');dr(e);let n=0,r=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else r<0&&(a=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else o<0&&(a=!0,o=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function pm(e){if(dr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function mm(e){dr(e);let t=e.length,n=-1,r=0,s=-1,a=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function fm(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function gm(e,t){let n="",r=0,s=-1,a=0,o=-1,l,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,a=0;continue}}else if(n.length>0){n="",r=0,s=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,a=0}else l===46&&a>-1?a++:a=-1}return n}function dr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bm={cwd:ym};function ym(){return"/"}function Mi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function wm(e){if(typeof e=="string")e=new URL(e);else if(!Mi(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return vm(e)}function vm(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...w]=d;const b=r[m][1];Li(b)&&Li(p)&&(p=Zr(!0,b,p)),r[m]=[u,p,...w]}}}}const Sm=new os().freeze();function ri(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ii(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function si(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function to(e){if(!Li(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function no(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cr(e){return Cm(e)?e:new Tl(e)}function Cm(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _m(e){return typeof e=="string"||Em(e)}function Em(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Pm="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ro=[],io={allowDangerousHtml:!0},Rm=/^(https?|ircs?|mailto|xmpp)$/i,Im=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Tm(e){const t=Am(e),n=Lm(e);return Mm(t.runSync(t.parse(n),n),e)}function Am(e){const t=e.rehypePlugins||ro,n=e.remarkPlugins||ro,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...io}:io;return Sm().use(dp).use(n).use(om,r).use(t)}function Lm(e){const t=e.children||"",n=new Tl;return typeof t=="string"&&(n.value=t),n}function Mm(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,a=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Om;for(const d of Im)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Pm+d.id,void 0);return Il(e,u),Hu(e,{Fragment:i.Fragment,components:s,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function u(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in Gr)if(Object.hasOwn(Gr,p)&&Object.hasOwn(d.properties,p)){const w=d.properties[p],b=Gr[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=c(String(w||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,m)),p&&m&&typeof h=="number")return l&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function Om(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Rm.test(e.slice(0,t))?e:""}const ls="-",Dm=e=>{const t=zm(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(ls);return l[0]===""&&l.length!==1&&l.shift(),Al(l,t)||Fm(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},Al=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Al(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(ls);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},so=/^\[(.+)\]$/,Fm=e=>{if(so.test(e)){const t=so.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},zm=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Bm(Object.entries(e.classGroups),n).forEach(([a,o])=>{Oi(o,r,a,t)}),r},Oi=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:ao(t,s);a.classGroupId=n;return}if(typeof s=="function"){if(qm(s)){Oi(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([a,o])=>{Oi(o,ao(t,a),n,r)})})},ao=(e,t)=>{let n=e;return t.split(ls).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},qm=e=>e.isThemeGetter,Bm=(e,t)=>t?e.map(([n,r])=>{const s=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[n,s]}):e,Um=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(a,o)=>{n.set(a,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(a){let o=n.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return s(a,o),o},set(a,o){n.has(a)?n.set(a,o):s(a,o)}}},Ll="!",$m=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],a=t.length,o=l=>{const c=[];let u=0,d=0,h;for(let v=0;vd?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:w,maybePostfixModifierPosition:b}};return n?l=>n({className:l,parseClassName:o}):o},Hm=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Km=e=>({cache:Um(e.cacheSize),parseClassName:$m(e),...Dm(e)}),Qm=/\s+/,Vm=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,a=[],o=e.trim().split(Qm);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:p}=n(u);let w=!!p,b=r(w?m.substring(0,p):m);if(!b){if(!w){l=u+(l.length>0?" "+l:l);continue}if(b=r(m),!b){l=u+(l.length>0?" "+l:l);continue}w=!1}const v=Hm(d).join(":"),y=h?v+Ll:v,j=y+b;if(a.includes(j))continue;a.push(j);const _=s(b,w);for(let S=0;S<_.length;++S){const F=_[S];a.push(y+F)}l=u+(l.length>0?" "+l:l)}return l};function Wm(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rh(d),e());return n=Km(u),r=n.cache.get,s=n.cache.set,a=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=Vm(c,n);return s(c,d),d}return function(){return a(Wm.apply(null,arguments))}}const fe=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ol=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jm=/^\d+\/\d+$/,Xm=new Set(["px","full","screen"]),Ym=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ef=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mt=e=>ln(e)||Xm.has(e)||Jm.test(e),jt=e=>_n(e,"length",df),ln=e=>!!e&&!Number.isNaN(Number(e)),ai=e=>_n(e,"number",ln),On=e=>!!e&&Number.isInteger(Number(e)),rf=e=>e.endsWith("%")&&ln(e.slice(0,-1)),G=e=>Ol.test(e),kt=e=>Ym.test(e),sf=new Set(["length","size","percentage"]),af=e=>_n(e,sf,Dl),of=e=>_n(e,"position",Dl),lf=new Set(["image","url"]),cf=e=>_n(e,lf,pf),uf=e=>_n(e,"",hf),Dn=()=>!0,_n=(e,t,n)=>{const r=Ol.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},df=e=>Zm.test(e)&&!ef.test(e),Dl=()=>!1,hf=e=>tf.test(e),pf=e=>nf.test(e),mf=()=>{const e=fe("colors"),t=fe("spacing"),n=fe("blur"),r=fe("brightness"),s=fe("borderColor"),a=fe("borderRadius"),o=fe("borderSpacing"),l=fe("borderWidth"),c=fe("contrast"),u=fe("grayscale"),d=fe("hueRotate"),h=fe("invert"),m=fe("gap"),p=fe("gradientColorStops"),w=fe("gradientColorStopPositions"),b=fe("inset"),v=fe("margin"),y=fe("opacity"),j=fe("padding"),_=fe("saturate"),S=fe("scale"),F=fe("sepia"),k=fe("skew"),q=fe("space"),M=fe("translate"),R=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",G,t],E=()=>[G,t],X=()=>["",mt,jt],D=()=>["auto",ln,G],P=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>["start","end","center","between","around","evenly","stretch"],me=()=>["","0",G],f=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ie=()=>[ln,G];return{cacheSize:500,separator:":",theme:{colors:[Dn],spacing:[mt,jt],blur:["none","",kt,G],brightness:ie(),borderColor:[e],borderRadius:["none","","full",kt,G],borderSpacing:E(),borderWidth:X(),contrast:ie(),grayscale:me(),hueRotate:ie(),invert:me(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[rf,jt],inset:N(),margin:N(),opacity:ie(),padding:E(),saturate:ie(),scale:ie(),sepia:me(),skew:ie(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",G]}],container:["container"],columns:[{columns:[kt]}],"break-after":[{"break-after":f()}],"break-before":[{"break-before":f()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...P(),G]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",On,G]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",G]}],grow:[{grow:me()}],shrink:[{shrink:me()}],order:[{order:["first","last","none",On,G]}],"grid-cols":[{"grid-cols":[Dn]}],"col-start-end":[{col:["auto",{span:["full",On,G]},G]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Dn]}],"row-start-end":[{row:["auto",{span:[On,G]},G]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",G]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",G]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...he()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...he(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...he(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[q]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[q]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",G,t]}],"min-w":[{"min-w":[G,t,"min","max","fit"]}],"max-w":[{"max-w":[G,t,"none","full","min","max","fit","prose",{screen:[kt]},kt]}],h:[{h:[G,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[G,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[G,t,"auto","min","max","fit"]}],"font-size":[{text:["base",kt,jt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ai]}],"font-family":[{font:[Dn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",G]}],"line-clamp":[{"line-clamp":["none",ln,ai]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mt,G]}],"list-image":[{"list-image":["none",G]}],"list-style-type":[{list:["none","disc","decimal",G]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mt,jt]}],"underline-offset":[{"underline-offset":["auto",mt,G]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...P(),of]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",af]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cf]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:$()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[mt,G]}],"outline-w":[{outline:[mt,jt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[mt,jt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",kt,uf]}],"shadow-color":[{shadow:[Dn]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",kt,G]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[_]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",G]}],duration:[{duration:ie()}],ease:[{ease:["linear","in","out","in-out",G]}],delay:[{delay:ie()}],animate:[{animate:["none","spin","ping","pulse","bounce",G]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[On,G]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",G]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",G]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",G]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,jt,ai]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ff=Gm(mf),Di={status:"",repo:"",thread:"",action:"",intent:"",actor:""},xf=new Wc({defaultOptions:{queries:{retry:1}}}),oo=12,gf=12,bf=10080*60*1e3,yf=1e3,Fl=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";function W(...e){return ff(mc(e))}async function Z(e,t){const n=new Headers(t==null?void 0:t.headers);n.set("Accept","application/json");const r=await fetch(e,{...t,headers:n});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function Ke(e){if(e==null)return"n/a";const t=Math.max(0,Math.floor(e));if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}const wf=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"}),vf=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});function hr(e){if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}function jf(e){const t=hr(e);return t?wf.format(t):e??""}function Hn(e){const t=hr(e);return t?vf.format(t):e??""}function zl(e,t){const n=hr(e);if(!n)return e??"";const r=t-n.getTime(),s=Math.abs(r);if(s>bf)return Hn(e);const a=r>=0?"ago":"from now",o=Math.round(s/1e3);if(o<45)return r>=0?"just now":"soon";if(o<90)return`1m ${a}`;const l=Math.round(o/60);if(l<60)return`${l}m ${a}`;if(l<90)return`1h ${a}`;const c=Math.round(l/60);return c<24?`${c}h ${a}`:c<36?`1d ${a}`:`${Math.round(c/24)}d ${a}`}function ue({value:e,compact:t=!1,relative:n=!1,now:r=Date.now()}){const s=hr(e);return s?i.jsx("time",{dateTime:s.toISOString(),title:`UTC: ${s.toISOString()}`,children:n?zl(e,r):t?Hn(e):jf(e)}):i.jsx(i.Fragment,{children:e??""})}function ql(e,t){const n=hr(e);return n?Math.max(0,Math.floor((t-n.getTime())/1e3)):null}function cs(e,t){return e.status==="running"?ql(e.started_at,t)??e.runtime_seconds:e.runtime_seconds}function us(e,t){return e.status==="pending"?ql(e.created_at,t)??e.queue_wait_seconds:e.queue_wait_seconds}function kf(e){const[t,n]=A.useState(()=>Date.now());return A.useEffect(()=>{if(!e)return;n(Date.now());const r=window.setInterval(()=>n(Date.now()),yf);return()=>window.clearInterval(r)},[e]),t}function Nf(e){return(e??"").split(/\r?\n/).map(n=>n.trim()).find(Boolean)??""}function Dr(e,t,n=1){const r=Nf(t),s=n>1?` (${n})`:"";return r?`${e}${s}: ${r}`:`${e}${s}`}function Fr(e){return e==="openclaw_stdout"||e==="openclaw_stderr"}function Bl(e){return e.map(t=>t==null?void 0:t.trim()).filter(Boolean).join(` +`)}function Sf(e){const t=[];for(const n of e){const r=t[t.length-1];if(r&&Fr(n.event_type)&&r.eventType===n.event_type){r.count+=1,r.meta=n.ts,r.detail=Bl([r.detail,n.detail]),r.summary=Dr(n.summary,r.detail,r.count);continue}t.push({id:String(n.id),badge:n.event_type,meta:n.ts,summary:Fr(n.event_type)?Dr(n.summary,n.detail):n.summary,detail:n.detail,eventType:n.event_type,count:1})}return t}function Cf(e){const t=[];return e.forEach((n,r)=>{const s=t[t.length-1];if(s&&Fr(n.kind)&&s.kind===n.kind){s.count+=1,s.meta=n.timestamp,s.text=Bl([s.text,n.text]),s.summary=Dr(`${n.role} · ${n.kind}`,s.text,s.count);return}t.push({id:`${n.timestamp??"entry"}-${r}`,badge:n.title,meta:n.timestamp,summary:Fr(n.kind)?Dr(`${n.role} · ${n.kind}`,n.text):`${n.role} · ${n.kind}`,text:n.text,kind:n.kind,count:1})}),t}function lo(e,t,n,r){return e==="openclaw_stdout"?!1:t||n>=r-2}function _f(e){return{pending:{badge:"border-amber-300 bg-amber-50 text-amber-800",dot:"bg-amber-500"},running:{badge:"border-blue-300 bg-blue-50 text-blue-700",dot:"bg-blue-600"},blocked:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},denied:{badge:"border-red-300 bg-red-50 text-red-700",dot:"bg-red-600"},done:{badge:"border-emerald-300 bg-emerald-50 text-emerald-700",dot:"bg-emerald-600"},waiting_approval:{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}[e]??{badge:"border-slate-300 bg-slate-50 text-slate-700",dot:"bg-slate-500"}}function Ef(e,t){const n=new URLSearchParams;for(const[r,s]of Object.entries(e))s.trim()&&n.set(r,s.trim());return n.set("limit",String(t)),`/api/jobs?${n.toString()}`}function Pf(e,t,n=50){const r=new URLSearchParams;return e.trim()&&r.set("repo",e.trim()),t.trim()&&r.set("status",t.trim()),r.set("limit",String(n)),`/api/knowledge?${r.toString()}`}function Rf(e){return{timeseries:e==="overview",hooks:e==="hooks",deliveries:e==="deliveries"}}function If(e,t,n="day"){return`/api/webhooks/github/timeseries?${new URLSearchParams({from:e,to:t,bucket:n}).toString()}`}function Tf(e=50,t){const n=new URLSearchParams({limit:String(e)});return t&&n.set("cursor",t),`/api/webhooks/github/hooks?${n.toString()}`}function Af(e=50,t,n){const r=new URLSearchParams({limit:String(e)});t&&r.set("cursor",t);for(const[s,a]of Object.entries(n??{}))a!=null&&a.trim()&&r.set(s,a.trim());return`/api/webhooks/github/deliveries?${r.toString()}`}function _r(e=new Date){return{from:new Date(e.getTime()-720*60*60*1e3).toISOString(),to:e.toISOString()}}function Lf(e=Fl){return`/api/metrics/summary?timezone=${encodeURIComponent(e)}`}function Ze(e){try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.href:"#"}catch{return"#"}}function Tr(){return"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}function Mf(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="github-agent-bridge:push")}function Of(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new Uint8Array(r.length);for(let a=0;an.id===t.id)?e:[...e,t]}function Ff(e,t){const n=co(t);return e.some(r=>co(r)===n)?e:[...e,t]}function co(e){return`${e.timestamp??""}:${e.role}:${e.kind}:${e.title}:${e.text}`}function zf(e){return["claimed","dispatch_started","dispatch_finished","done","blocked","denied","waiting_approval"].includes(e)}function qn(e){return["blocked","denied","waiting_approval"].includes(e)}function Fi(e,t){return e.status!=="running"?!1:t!=null&&t.is_admin?!0:!!(t!=null&&t.login&&e.trigger_actor&&t.login.toLowerCase()===e.trigger_actor.toLowerCase())}function qf(e=window.location.pathname){const t=e.match(/^\/jobs\/(\d+)\/?$/);return t?Number(t[1]):null}function Bf(e=window.location.pathname){return/^\/knowledge\/?$/.test(e)}function Uf(e=window.location.pathname){return/^\/mcp\/?$/.test(e)}function $f(e=window.location.pathname){return/^\/system\/?$/.test(e)}function Hf(e=window.location.pathname){const t=e.match(/^\/webhooks\/hooks\/([^/]+)\/?$/);return t?decodeURIComponent(t[1]):null}function Kf(e=window.location.pathname){const t=e.match(/^\/webhooks\/deliveries\/([^/]+)\/?$/);return t?decodeURIComponent(t[1]):null}function oi(e=window.location.pathname){return/^\/webhooks(?:\/(?:hooks|deliveries)\/[^/]+)?\/?$/.test(e)}function Ul(e){return e.startsWith("repo:")?e.slice(5):e}function uo(e){return Object.values(e).some(t=>t.trim()!=="")}function Qf(e){return[{key:"status",label:"Status",value:e.status},{key:"repo",label:"Repo",value:e.repo},{key:"thread",label:"Thread",value:e.thread},{key:"action",label:"Action",value:e.action},{key:"actor",label:"Actor",value:e.actor.trim()?`@${e.actor.trim().replace(/^@/,"")}`:""},{key:"intent",label:"Intent",value:e.intent}].filter(t=>t.value.trim()!=="")}function Vf(){var ps,ms,fs,xs,gs,bs,ys,ws,vs,js,ks,Ns,Ss,Cs,_s,Es,Ps,Rs,Is,Ts,As,Ls,Ms,Os,Ds,Fs,zs,qs,Bs,Us,$s,Hs,Ks,Qs,Vs,Ws,Gs,Js,Xs,Ys,Zs,ea,ta,na,ra,ia;const e=$o(),[t,n]=A.useState(Di),[r,s]=A.useState(oo),a=A.useRef(!1),[o,l]=A.useState(""),[c,u]=A.useState("proposed"),[d,h]=A.useState("overview"),[m,p]=A.useState({hook_id:"",event_name:"",repository:"",result:"",enqueue_status:""}),[w,b]=A.useState(()=>_r()),[v,y]=A.useState(null),[j,_]=A.useState(""),[S,F]=A.useState(()=>window.location.pathname),[k,q]=A.useState(null),M=qf(S),R=M!==null,z=Bf(S),N=Uf(S),E=$f(S),X=oi(S),D=Hf(S),P=Kf(S),$=!R&&!z&&!N&&!E&&!X,B=M,he=ge({queryKey:["metrics",Fl],queryFn:()=>Z(Lf()),enabled:$||E}),me=ge({queryKey:["dashboard-status"],queryFn:()=>Z("/api/status")}),f=ge({queryKey:["me"],queryFn:()=>Z("/api/me"),refetchInterval:!1}),ie=X&&!!((ms=(ps=f.data)==null?void 0:ps.user)!=null&&ms.is_admin&&((fs=me.data)!=null&&fs.webhook_configured)),Re=Rf(d),x=ge({queryKey:["web-push-config"],queryFn:()=>Z("/api/web-push/config"),enabled:!!((xs=f.data)!=null&&xs.user)}),Oe=ge({queryKey:["about"],queryFn:()=>Z("/api/about")}),lt=ge({queryKey:["job-actors"],queryFn:()=>Z("/api/jobs/actors"),enabled:$}),oe=ge({queryKey:["jobs",t,r],queryFn:()=>Z(Ef(t,r)),enabled:$,placeholderData:T=>T}),Qe=ge({queryKey:["processes"],queryFn:()=>Z("/api/processes"),enabled:E}),De=ge({queryKey:["systemd"],queryFn:()=>Z("/api/systemd"),enabled:E}),Ve=ge({queryKey:["alerts"],queryFn:()=>Z("/api/alerts"),enabled:E}),We=ge({queryKey:["webhook-summary"],queryFn:()=>Z("/api/webhooks/github/summary"),enabled:ie}),bt=ge({queryKey:["webhook-timeseries",w.from,w.to,"day"],queryFn:()=>Z(If(w.from,w.to)),enabled:ie&&Re.timeseries}),pr=ge({queryKey:["webhook-exceptions"],queryFn:()=>Z("/api/webhooks/github/exceptions"),enabled:ie&&Re.timeseries}),ct=ya({queryKey:["webhook-hooks"],queryFn:({pageParam:T})=>Z(Tf(50,T)),initialPageParam:null,getNextPageParam:T=>T.next_cursor??void 0,enabled:ie&&Re.hooks&&D===null&&P===null}),ut=ya({queryKey:["webhook-deliveries",m],queryFn:({pageParam:T})=>Z(Af(50,T,m)),initialPageParam:null,getNextPageParam:T=>T.next_cursor??void 0,enabled:ie&&Re.deliveries&&D===null&&P===null}),et=ge({queryKey:["webhook-hook",D],queryFn:()=>Z(`/api/webhooks/github/hooks/${encodeURIComponent(D??"")}`),enabled:ie&&D!==null}),mr=A.useCallback(async T=>{const ae=await Z(`/api/webhooks/github/hooks/${encodeURIComponent(T)}/ping`,{method:"POST"});return et.refetch(),window.setTimeout(()=>void et.refetch(),1500),ae.detail},[et]),Mt=ge({queryKey:["webhook-delivery",P],queryFn:()=>Z(`/api/webhooks/github/deliveries/${encodeURIComponent(P??"")}`),enabled:ie&&P!==null}),en=ge({queryKey:["knowledge",o,c],queryFn:()=>Z(Pf(o,c)),enabled:z}),Ot=ge({queryKey:["mcp-tokens"],queryFn:()=>Z("/api/mcp/tokens"),enabled:N&&!!((gs=f.data)!=null&&gs.user)}),fr=ge({queryKey:["mcp-users"],queryFn:()=>Z("/api/mcp/users"),enabled:N&&!!((bs=f.data)!=null&&bs.user)}),tn=ge({queryKey:["job",B],queryFn:()=>Z(`/api/jobs/${B}`),enabled:B!==null}),xr=ge({queryKey:["job-session",B],queryFn:()=>Z(`/api/jobs/${B}/session`),enabled:B!==null}),gr=ge({queryKey:["job-session-events",B],queryFn:()=>Z(`/api/jobs/${B}/session/events`),enabled:B!==null}),br=ge({queryKey:["job-session-transcript",B],queryFn:()=>Z(`/api/jobs/${B}/session/transcript`),enabled:B!==null}),yr=A.useCallback(async T=>{const ae=await Z(`/api/jobs/${T}/retry`,{method:"POST"});e.setQueryData(["job",T],{job:ae.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),C=A.useCallback(async T=>{const ae=await Z(`/api/jobs/${T}/dismiss`,{method:"POST"});e.setQueryData(["job",T],{job:ae.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]})},[e]),L=A.useCallback(async(T,ae)=>{const xe=await Z(`/api/jobs/${T}/cancel`,{method:"POST",body:JSON.stringify({reason:ae||""})});e.setQueryData(["job",T],{job:xe.job}),e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["metrics"]}),e.invalidateQueries({queryKey:["dashboard-status"]})},[e]),K=A.useCallback(async(T,ae)=>{await Z(`/api/knowledge/proposals/${encodeURIComponent(T)}/${ae}`,{method:"POST"}),e.invalidateQueries({queryKey:["knowledge"]}),e.invalidateQueries({queryKey:["dashboard-status"]})},[e]),Y=A.useCallback(async T=>{await Z(`/api/knowledge/rules/${encodeURIComponent(T)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),se=A.useCallback(async(T,ae)=>{await Z(`/api/knowledge/rules/${encodeURIComponent(T)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:ae})}),e.invalidateQueries({queryKey:["knowledge"]})},[e]),Fe=A.useCallback(async(T,ae)=>{const xe=await Z("/api/mcp/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T,user_login:ae||void 0})});return e.invalidateQueries({queryKey:["mcp-tokens"]}),xe},[e]),dt=A.useCallback(async(T,ae)=>{await Z(`/api/mcp/tokens/${encodeURIComponent(T)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_login:ae})}),e.invalidateQueries({queryKey:["mcp-tokens"]}),e.invalidateQueries({queryKey:["mcp-users"]})},[e]),Ge=A.useCallback(async T=>{await Z(`/api/mcp/tokens/${encodeURIComponent(T)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["mcp-tokens"]})},[e]),ht=A.useCallback(async T=>{const ae={refresh:"/api/autoupdate/refresh",apply:"/api/autoupdate/apply",complete:"/api/autoupdate/complete-pending"}[T];y(T),_("");try{await Z(ae,{method:"POST"}),e.invalidateQueries({queryKey:["dashboard-status"]})}catch(xe){e.invalidateQueries({queryKey:["dashboard-status"]}),_(xe instanceof Error?xe.message:String(xe))}finally{y(null)}},[e]),Dt=A.useCallback(async()=>{var sa;const T=(sa=x.data)==null?void 0:sa.public_key;if(!T)throw new Error("web_push_not_configured");if(!Tr())throw new Error("web_push_not_supported");if(await window.Notification.requestPermission()!=="granted")throw new Error("notification_permission_denied");const xe=await navigator.serviceWorker.register("/service-worker.js"),dc=await xe.pushManager.getSubscription()??await xe.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Of(T)});await Z("/api/web-push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(dc.toJSON())}),e.invalidateQueries({queryKey:["web-push-config"]})},[e,(ys=x.data)==null?void 0:ys.public_key]),Ee=A.useCallback(async()=>{if(!Tr())return;const ae=await(await navigator.serviceWorker.ready).pushManager.getSubscription();if(!ae)return;const xe=ae.endpoint;await ae.unsubscribe(),await Z("/api/web-push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:xe})}),e.invalidateQueries({queryKey:["web-push-config"]})},[e]);A.useEffect(()=>{var T;!((T=x.data)!=null&&T.status.enabled)||!Tr()||navigator.serviceWorker.register("/service-worker.js").catch(()=>{})},[(ws=x.data)==null?void 0:ws.status.enabled]),A.useEffect(()=>{if(B===null)return;const T=new EventSource(`/api/jobs/${B}/session/stream`);return T.addEventListener("session_event",ae=>{const xe=zr(ae);xe&&(e.setQueryData(["job-session-events",B],wt=>({events:Df((wt==null?void 0:wt.events)??[],xe)})),zf(xe.event_type)&&(e.invalidateQueries({queryKey:["job",B]}),e.invalidateQueries({queryKey:["jobs"]})))}),T.addEventListener("transcript_entry",ae=>{const xe=zr(ae);!xe||xe.job_id!==B||e.setQueryData(["job-session-transcript",B],wt=>({entries:Ff((wt==null?void 0:wt.entries)??[],xe.entry)}))}),T.onerror=()=>{e.invalidateQueries({queryKey:["job",B]}),e.invalidateQueries({queryKey:["job-session-events",B]}),e.invalidateQueries({queryKey:["job-session-transcript",B]})},()=>T.close()},[B,e]),A.useEffect(()=>{const T=()=>{oi(window.location.pathname)&&b(_r()),F(window.location.pathname)};return window.addEventListener("popstate",T),()=>window.removeEventListener("popstate",T)},[]),A.useEffect(()=>{if(!("serviceWorker"in navigator))return;const T=ae=>{if(!Mf(ae.data))return;const xe={...ae.data.payload,id:Date.now(),receivedAt:Date.now()};q(xe),xe.job_id&&(e.invalidateQueries({queryKey:["jobs"]}),e.invalidateQueries({queryKey:["job",xe.job_id]}),e.invalidateQueries({queryKey:["metrics"]}))};return navigator.serviceWorker.addEventListener("message",T),()=>navigator.serviceWorker.removeEventListener("message",T)},[e]),A.useEffect(()=>{if(!k)return;const T=window.setTimeout(()=>q(null),12e3);return()=>window.clearTimeout(T)},[k]);const pt=A.useCallback(T=>{window.history.pushState({},"",En(T)),F(window.location.pathname)},[]),ye=A.useCallback(T=>{window.history.pushState({},"",T),oi(T)&&b(_r()),F(window.location.pathname)},[]),nn=((vs=he.data)==null?void 0:vs.metrics.status_counts)??{},wr=((js=oe.data)==null?void 0:js.jobs)??[],tc=!!((Ns=(ks=f.data)==null?void 0:ks.user)!=null&&Ns.is_admin&&$l((Ss=me.data)==null?void 0:Ss.autoupdate)),nc=A.useCallback(T=>{n(T),s(oo),a.current=!1},[]);A.useEffect(()=>{oe.isFetching||(a.current=!1)},[oe.isFetching]);const rc=A.useCallback(()=>{a.current||(a.current=!0,s(T=>T+gf))},[]),yt=B?((Cs=tn.data)==null?void 0:Cs.job)??null:null,ic=wr.some(T=>T.status==="running"||T.status==="pending")||(yt==null?void 0:yt.status)==="running"||(yt==null?void 0:yt.status)==="pending"||!!((_s=Qe.data)!=null&&_s.running_jobs.length),Rn=kf(ic),sc=i.jsx(lx,{selectedJobId:B,selectedJob:yt,loading:tn.isLoading,error:tn.error,session:(Es=xr.data)==null?void 0:Es.session,sessionEvents:(Ps=gr.data)==null?void 0:Ps.events,transcript:(Rs=br.data)==null?void 0:Rs.entries,now:Rn}),ac=((Is=ct.data)==null?void 0:Is.pages.flatMap(T=>T.hooks))??[],oc=((Ts=ut.data)==null?void 0:Ts.pages.flatMap(T=>T.deliveries))??[],lc=d==="overview"?bt.isLoading:d==="hooks"?ct.isLoading:ut.isLoading,cc=d==="overview"?bt.error:d==="hooks"?ct.error:ut.error,uc=()=>{We.refetch(),d==="overview"&&pr.refetch(),d==="overview"&&b(_r()),d==="hooks"&&ct.refetch(),d==="deliveries"&&ut.refetch()};return i.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[i.jsx("header",{className:"border-b border-slate-800 bg-slate-950 text-white",children:i.jsxs("div",{className:"mx-auto flex w-full max-w-[1440px] items-center justify-between gap-3 px-4 py-4 md:px-6",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"truncate text-xl font-semibold",children:"GitHub Agent Bridge"}),i.jsx(Wf,{about:Oe.data})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsx(wx,{config:x.data,loading:x.isLoading,onEnable:Dt,onDisable:Ee}),i.jsx(yx,{user:(As=f.data)==null?void 0:As.user,loading:f.isLoading})]})]})}),i.jsxs("main",{className:"mx-auto grid w-full max-w-[1440px] gap-4 px-3 py-4 sm:px-4 md:px-6 md:py-5",children:[i.jsx(ex,{isDashboardRoute:$,isSystemRoute:E,isKnowledgeRoute:z,isMcpRoute:N,isWebhooksRoute:X,showWebhooks:!!((Ms=(Ls=f.data)==null?void 0:Ls.user)!=null&&Ms.is_admin&&((Os=me.data)!=null&&Os.webhook_configured)),knowledgeBadgeCount:((zs=(Fs=(Ds=me.data)==null?void 0:Ds.metrics)==null?void 0:Fs.knowledge)==null?void 0:zs.proposed)??0,systemUpdateAvailable:tc,onNavigate:ye}),i.jsx(vx,{notification:k,onDismiss:()=>q(null),onNavigate:ye}),M!==null?i.jsx(ox,{jobId:M,detail:sc,selectedJob:yt,user:(qs=f.data)==null?void 0:qs.user,onBackToDashboard:()=>ye("/"),onRetry:yr,onDismiss:C,onCancel:L,onRefresh:()=>{tn.refetch(),xr.refetch(),gr.refetch(),br.refetch()}}):z?i.jsx(cx,{data:en.data,loading:en.isLoading,error:en.error,repo:o,status:c,user:(Bs=f.data)==null?void 0:Bs.user,now:Rn,onRepoChange:l,onStatusChange:u,onApprove:T=>K(T,"approve"),onReject:T=>K(T,"reject"),onUpdateRuleScope:se,onDeleteRule:Y,onRefresh:()=>en.refetch()}):N?i.jsx(fx,{tokens:(Us=Ot.data)==null?void 0:Us.tokens,loading:Ot.isLoading,error:Ot.error,user:($s=f.data)==null?void 0:$s.user,ownerOptions:((Hs=fr.data)==null?void 0:Hs.users)??[],dashboardUrl:(Ks=me.data)==null?void 0:Ks.dashboard_url,dashboardUrlSource:(Qs=me.data)==null?void 0:Qs.dashboard_url_source,now:Rn,onCreate:Fe,onUpdateOwner:dt,onRevoke:Ge,onRefresh:()=>Ot.refetch()}):X?P?i.jsx(sx,{data:Mt.data,loading:Mt.isLoading,error:Mt.error,onBack:()=>{h("deliveries"),ye("/webhooks")},onRefresh:()=>Mt.refetch(),onViewHook:T=>ye(`/webhooks/hooks/${encodeURIComponent(T)}`),onViewJob:pt}):D?i.jsx(ix,{data:et.data,loading:et.isLoading,error:et.error,onBack:()=>{h("hooks"),ye("/webhooks")},onRefresh:()=>et.refetch(),onViewHook:T=>ye(`/webhooks/hooks/${encodeURIComponent(T)}`),onViewDelivery:T=>ye(`/webhooks/deliveries/${encodeURIComponent(T)}`),onPing:mr}):i.jsx(tx,{summary:We.data,timeseries:(Vs=bt.data)==null?void 0:Vs.points,exceptions:(Ws=pr.data)==null?void 0:Ws.exceptions,hooks:ac,deliveries:oc,section:d,summaryLoading:We.isLoading,sectionLoading:lc,loadingMore:d==="hooks"?ct.isFetchingNextPage:ut.isFetchingNextPage,hasMore:d==="hooks"?ct.hasNextPage:ut.hasNextPage,deliveryFilters:m,error:We.error??cc,onSectionChange:h,onLoadMore:()=>d==="hooks"?ct.fetchNextPage():ut.fetchNextPage(),onDeliveryFiltersChange:p,onViewHook:T=>ye(`/webhooks/hooks/${encodeURIComponent(T)}`),onViewDelivery:T=>ye(`/webhooks/deliveries/${encodeURIComponent(T)}`),onRefresh:uc}):E?i.jsxs(i.Fragment,{children:[i.jsx(Gf,{state:(Gs=me.data)==null?void 0:Gs.autoupdate,isAdmin:!!((Xs=(Js=f.data)==null?void 0:Js.user)!=null&&Xs.is_admin),runningAction:v,actionError:j,onRefresh:()=>ht("refresh"),onApply:()=>ht("apply"),onCompletePending:()=>ht("complete")}),i.jsx(ax,{processes:Qe.data,processesLoading:Qe.isLoading,processesError:Qe.error,systemd:De.data,systemdLoading:De.isLoading,systemdError:De.error,alerts:(Ys=Ve.data)==null?void 0:Ys.alerts,alertsLoading:Ve.isLoading,alertsError:Ve.error,now:Rn,onRefreshProcesses:()=>Qe.refetch(),onRefreshSystemd:()=>De.refetch(),onRefreshAlerts:()=>Ve.refetch()})]}):i.jsxs(i.Fragment,{children:[he.error?i.jsx(ve,{tone:"error",text:he.error.message}):null,me.error?i.jsx(ve,{tone:"error",text:me.error.message}):null,i.jsxs("section",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Summary metrics",children:[i.jsx(Ce,{title:"Pending",value:nn.pending??0,icon:i.jsx(Wo,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Running",value:nn.running??0,icon:i.jsx(Jt,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Blocked",value:nn.blocked??0,icon:i.jsx(Br,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Done",value:nn.done??0,icon:i.jsx(kn,{className:"h-5 w-5"})})]}),i.jsxs("section",{className:"grid gap-3",children:[i.jsx(jx,{count:wr.length,limit:r,loading:oe.isLoading,onRefresh:()=>oe.refetch()}),i.jsxs(le,{title:"Recent jobs",flushHeader:!0,children:[i.jsx(kx,{filters:t,actorOptions:((Zs=lt.data)==null?void 0:Zs.actors)??[],onChange:nc}),oe.error?i.jsx(ve,{tone:"error",text:oe.error.message}):null,i.jsx(Sx,{jobs:wr,loading:oe.isLoading,loadingMore:oe.isFetching&&!oe.isLoading,hasMore:wr.length>=r,onLoadMore:rc,onViewJob:pt,now:Rn,user:(ea=f.data)==null?void 0:ea.user,onRetry:yr,onDismiss:C,onCancel:L})]}),i.jsx(le,{title:"Runtime usage",action:i.jsx(Ye,{onClick:()=>he.refetch()}),children:i.jsx(Fx,{usage:(ta=he.data)==null?void 0:ta.metrics.runtime_usage,loading:he.isLoading,totalJobs:fo(nn)})})]}),i.jsxs("section",{className:"grid gap-4 xl:grid-cols-3",children:[i.jsx(le,{title:"Runtime percentiles",children:i.jsx(mo,{label:"runtime",values:(na=he.data)==null?void 0:na.metrics.runtime_seconds})}),i.jsx(le,{title:"Jobs per day",children:i.jsx(Dx,{values:(ra=he.data)==null?void 0:ra.metrics.by_created_day,loading:he.isLoading,totalJobs:fo(nn)})}),i.jsx(le,{title:"Queue wait percentiles",children:i.jsx(mo,{label:"queue wait",values:(ia=he.data)==null?void 0:ia.metrics.queue_wait_seconds})})]})]})]})]})}function Wf({about:e}){const t=e!=null&&e.version?`v${e.version}`:"version loading";return i.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-slate-300",children:[i.jsx("span",{children:"Operational dashboard"}),i.jsx("span",{className:"font-mono text-xs text-slate-400",children:t}),e!=null&&e.repository_url?i.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-slate-200 hover:underline",href:Ze(e.repository_url),rel:"noreferrer",target:"_blank",children:[i.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"GitHub"]}):null]})}function $l(e){var t,n;return!!((n=(t=e==null?void 0:e.target)==null?void 0:t.tag_name)!=null&&n.trim()&&e.decision!=="noop")}function Gf({state:e,isAdmin:t,runningAction:n=null,actionError:r="",onRefresh:s,onApply:a,onCompletePending:o}){var v,y,j,_,S,F,k,q,M,R,z;if(!e||!$l(e))return null;const l=(y=(v=e==null?void 0:e.target)==null?void 0:v.tag_name)==null?void 0:y.trim();if(!t||!l)return null;const c=Jf(e.decision),u=((j=e.queue)==null?void 0:j.active_total)??0,d=Xf((_=e.classification)==null?void 0:_.risk),h=Yf((S=e.target)==null?void 0:S.body),m=((k=(F=e.classification)==null?void 0:F.migration_files)==null?void 0:k.length)??0,p=((M=(q=e.classification)==null?void 0:q.risky_files)==null?void 0:M.length)??0,w=!!(e.executor_reload_pending&&e.dashboard_applied_at&&o),b=!!(a&&m===0);return i.jsxs("section",{className:"rounded-md border border-amber-300 bg-amber-50 p-3 text-amber-950 shadow-sm","aria-label":"Update available",children:[i.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(Br,{className:"h-4 w-4 text-amber-700","aria-hidden":!0}),i.jsx("h2",{className:"text-sm font-semibold",children:"Update available"}),i.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-1.5 py-0.5 font-mono text-[11px] text-amber-800",children:l}),(R=e.target)!=null&&R.url?i.jsxs("a",{className:"inline-flex items-center gap-1 text-xs font-semibold text-amber-800 hover:underline",href:Ze(e.target.url),rel:"noreferrer",target:"_blank",children:[i.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Release"]}):null]}),i.jsxs("p",{className:"mt-1 text-sm text-amber-900",children:[c,e.installed_tag?i.jsxs("span",{className:"font-mono",children:[" from ",e.installed_tag]}):null]}),i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[s?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:s,children:[i.jsx(cr,{className:W("h-3.5 w-3.5",n==="refresh"&&"animate-spin"),"aria-hidden":!0}),n==="refresh"?"Checking...":"Check now"]}):null,b?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md bg-amber-800 px-2.5 text-xs font-semibold text-white hover:bg-amber-900 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:()=>{window.confirm(`Apply ${l}? This can restart bridge services according to the recorded safe plan.`)&&(a==null||a())},children:[i.jsx(kn,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="apply"?"Applying...":"Apply update"]}):null,w?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-amber-300 bg-white px-2.5 text-xs font-semibold text-amber-900 hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:n!==null,onClick:o,children:[i.jsx(Gn,{className:"h-3.5 w-3.5","aria-hidden":!0}),n==="complete"?"Completing...":"Complete reload"]}):null]})]}),i.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-3 lg:min-w-[420px]",children:[i.jsx(li,{label:"Impact",value:d}),i.jsx(li,{label:"Active jobs",value:String(u)}),i.jsx(li,{label:"Admin only",value:"autoupdate"})]})]}),e.blocked_reason||e.executor_reload_pending||m>0||p>0?i.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:[e.executor_reload_pending?i.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-semibold",children:"executor reload pending"}):null,e.blocked_reason?i.jsx("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono",children:e.blocked_reason}):null,m>0?i.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[m," migration file",m===1?"":"s"]}):null,p>0?i.jsxs("span",{className:"rounded-sm border border-amber-300 bg-white px-2 py-1",children:[p," executor/shared file",p===1?"":"s"]}):null]}):null,h?i.jsxs("div",{className:"mt-3 rounded-md border border-amber-200 bg-white/70 p-2.5",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-800",children:"Changelog preview"}),i.jsx(Zf,{markdown:h})]}):null,(z=e.warnings)!=null&&z.length?i.jsx("div",{className:"mt-2 font-mono text-xs text-amber-800",children:e.warnings[0]}):null,r?i.jsxs("div",{className:"mt-2 rounded-sm border border-amber-300 bg-white px-2 py-1 font-mono text-xs text-amber-900",children:["Action failed: ",r]}):null]})}function li({label:e,value:t}){return i.jsxs("div",{className:"min-w-0 rounded-md border border-amber-200 bg-white/80 px-2 py-1.5",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-amber-700",children:e}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-amber-950",children:t})]})}function Jf(e){return{stage_dashboard_reload:"Dashboard reload can be staged now",stage_defer_executor_reload:"Dashboard reload can be staged; executor reload waits for the queue",stage_full_reload:"Full reload can be staged now",defer_migration:"Migration release is waiting for a quiet queue"}[e??""]??"Update plan recorded"}function Xf(e){return{dashboard_only:"dashboard only",executor_or_queue:"executor or queue",executor_or_shared:"executor or shared",migration_required:"migration",none:"none"}[e??""]??"unknown"}function Yf(e){return(e??"").trim()}function Zf({markdown:e}){return i.jsx("div",{className:"mt-1 text-sm leading-relaxed text-amber-950",children:i.jsx(Tm,{allowedElements:["a","blockquote","code","em","h1","h2","h3","h4","li","ol","p","strong","ul"],components:{a:({href:t,children:n})=>i.jsx("a",{className:"font-semibold text-amber-800 underline underline-offset-2",href:Ze(t??""),rel:"noreferrer",target:"_blank",children:n}),blockquote:({children:t})=>i.jsx("blockquote",{className:"mt-2 border-l-2 border-amber-300 pl-2 text-amber-900",children:t}),code:({children:t})=>i.jsx("code",{className:"rounded-sm bg-amber-100 px-1 py-0.5 font-mono text-[0.85em] text-amber-950",children:t}),h1:({children:t})=>i.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h2:({children:t})=>i.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h3:({children:t})=>i.jsx("h3",{className:"mt-2 text-sm font-semibold text-amber-950 first:mt-0",children:t}),h4:({children:t})=>i.jsx("h4",{className:"mt-2 text-xs font-semibold uppercase text-amber-800 first:mt-0",children:t}),li:({children:t})=>i.jsx("li",{className:"break-words pl-0.5 [overflow-wrap:anywhere]",children:t}),ol:({children:t})=>i.jsx("ol",{className:"mt-1 list-decimal space-y-1 pl-5 first:mt-0",children:t}),p:({children:t})=>i.jsx("p",{className:"mt-1 break-words [overflow-wrap:anywhere] first:mt-0",children:t}),strong:({children:t})=>i.jsx("strong",{className:"font-semibold",children:t}),em:({children:t})=>i.jsx("em",{className:"italic",children:t}),ul:({children:t})=>i.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-5 first:mt-0",children:t})},children:e})})}function ex({isDashboardRoute:e,isSystemRoute:t=!1,isKnowledgeRoute:n,isMcpRoute:r=!1,isWebhooksRoute:s=!1,showWebhooks:a=!1,knowledgeBadgeCount:o=0,systemUpdateAvailable:l=!1,onNavigate:c}){return i.jsxs("nav",{className:"flex min-w-0 rounded-lg border border-border bg-panel p-1 shadow-sm","aria-label":"Dashboard sections",children:[i.jsxs(Fn,{href:"/",active:e,onNavigate:c,children:[i.jsx(Xo,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"Jobs"})]}),i.jsxs(Fn,{href:"/system",active:t,onNavigate:c,children:[i.jsx(uu,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"System"}),l?i.jsx("span",{className:W("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1 font-mono text-[11px] leading-none",t?"border-white/40 bg-white/15 text-white":"border-amber-200 bg-amber-100 text-amber-800"),"aria-label":"System update available",children:"!"}):null]}),a?i.jsxs(Fn,{href:"/webhooks",active:s,onNavigate:c,children:[i.jsx(Jt,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"Webhooks"})]}):null,i.jsxs(Fn,{href:"/knowledge",active:n,onNavigate:c,children:[i.jsx(Vi,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"Knowledge"}),o>0?i.jsx("span",{className:W("inline-flex h-5 min-w-5 items-center justify-center rounded-full border px-1 font-mono text-[11px] leading-none",n?"border-white/40 bg-white/15 text-white":"border-amber-200 bg-amber-100 text-amber-800"),"aria-label":`${o} proposed knowledge ${o===1?"item":"items"}`,children:o}):null]}),i.jsxs(Fn,{href:"/mcp",active:r,onNavigate:c,children:[i.jsx(Lr,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{children:"MCP"})]})]})}function an({text:e}){return i.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-sm text-muted",children:[i.jsx(cr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),e]})}function tx({summary:e,timeseries:t,exceptions:n,hooks:r,deliveries:s,section:a,summaryLoading:o,sectionLoading:l,loadingMore:c,hasMore:u,deliveryFilters:d,error:h,onSectionChange:m,onLoadMore:p,onDeliveryFiltersChange:w,onViewHook:b,onViewDelivery:v=()=>{},onRefresh:y}){var S,F,k,q,M,R,z;const j=Object.values((e==null?void 0:e.receipts)??{}).reduce((N,E)=>N+E,0),_=[{id:"overview",label:"Overview"},{id:"hooks",label:"Hooks",count:(S=e==null?void 0:e.totals)==null?void 0:S.hooks},{id:"deliveries",label:"Deliveries",count:(F=e==null?void 0:e.totals)==null?void 0:F.deliveries}];return i.jsxs("section",{className:"grid gap-4",children:[i.jsx(Kl,{icon:i.jsx(Jt,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"GitHub webhooks",subtitle:(e==null?void 0:e.mode)==="primary"?"Primary webhook ingestion. IMAP remains active as an idempotent safety net.":(e==null?void 0:e.mode)==="canary"?"Canary ingestion health. Only the webhook canary allowlist may create jobs.":"Shadow ingestion health. Deliveries are observed but do not create jobs.",action:i.jsx(Ye,{onClick:y})}),h?i.jsx(ve,{tone:"error",text:h.message}):null,i.jsx("div",{className:"flex max-w-full flex-wrap rounded-md border border-border bg-white p-1",role:"tablist","aria-label":"Webhook dashboard section",children:_.map(N=>i.jsxs("button",{type:"button",role:"tab","aria-label":N.count===void 0?N.label:`${N.label} (${N.count} total)`,"aria-selected":a===N.id,className:W("inline-flex h-8 items-center gap-2 rounded px-3 text-sm font-semibold",a===N.id?"bg-primary text-white":"text-muted hover:bg-slate-50 hover:text-foreground"),onClick:()=>m(N.id),children:[N.label,N.count!==void 0?i.jsx("span",{className:"rounded border border-current/30 px-1 font-mono text-[10px]",children:N.count}):null]},N.id))}),i.jsxs("div",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4","aria-label":"Webhook status",children:[i.jsx(Ce,{title:"Receipts",value:j,icon:i.jsx(Jt,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Duplicates",value:(e==null?void 0:e.duplicate_deliveries)??0,icon:i.jsx(cr,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Cross-source matches",value:(e==null?void 0:e.cross_source_matches)??0,icon:i.jsx(Nn,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Mode",value:o?"…":(e==null?void 0:e.mode)??"unknown",icon:i.jsx(Go,{className:"h-5 w-5"})})]}),a==="overview"?i.jsxs(i.Fragment,{children:[i.jsx(le,{title:"Delivery activity",children:l?i.jsx(an,{text:"Loading delivery activity…"}):t!=null&&t.length?i.jsx("div",{className:"h-72","aria-label":"Webhook deliveries over time",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:t,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"bucket"}),i.jsx(ar,{allowDecimals:!1}),i.jsx(or,{}),i.jsx(Po,{}),i.jsx(Wt,{dataKey:"observed",stackId:"deliveries",fill:"#2563eb"}),i.jsx(Wt,{dataKey:"duplicate",stackId:"deliveries",fill:"#f59e0b"}),i.jsx(Wt,{dataKey:"unsupported",stackId:"deliveries",fill:"#94a3b8"})]})})}):i.jsx(J,{text:"No webhook activity in the selected 30-day window."})}),i.jsx(le,{title:"Receipt states",children:o?i.jsx(an,{text:"Loading webhook summary…"}):Object.keys((e==null?void 0:e.receipts)??{}).length?i.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Object.entries((e==null?void 0:e.receipts)??{}).sort(([N],[E])=>N.localeCompare(E)).map(([N,E])=>i.jsx(V,{label:N,value:E},N))}):i.jsx(J,{text:"No webhook deliveries observed yet."})}),i.jsxs(le,{title:"Cross-source coverage",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(V,{label:"Both sources",value:((k=e==null?void 0:e.coverage)==null?void 0:k.both)??0}),i.jsx(V,{label:"IMAP only",value:((q=e==null?void 0:e.coverage)==null?void 0:q.imap_only)??0}),i.jsx(V,{label:"Webhook only",value:((M=e==null?void 0:e.coverage)==null?void 0:M.webhook_only)??0}),i.jsx(V,{label:"Coverage",value:((R=e==null?void 0:e.coverage)==null?void 0:R.ratio)==null?"not measurable":`${Math.round(e.coverage.ratio*100)}%`})]}),(z=e==null?void 0:e.coverage)!=null&&z.window_start&&e.coverage.window_end?i.jsxs("p",{className:"mt-3 font-mono text-xs text-muted",children:["Comparable canonical events from ",i.jsx(ue,{value:e.coverage.window_start})," to ",i.jsx(ue,{value:e.coverage.window_end}),"; newest ",e.coverage.grace_seconds??0,"s excluded."]}):null]}),Object.keys((e==null?void 0:e.enqueue)??{}).length?i.jsx(le,{title:"Canary ingestion decisions",children:i.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Object.entries((e==null?void 0:e.enqueue)??{}).sort(([N],[E])=>N.localeCompare(E)).map(([N,E])=>i.jsx(V,{label:N,value:E},N))})}):null,i.jsx(le,{title:"Exceptions requiring review",children:n!=null&&n.length?i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[i.jsx("thead",{className:"border-b border-border text-xs text-muted",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-3 py-2",children:"Type"}),i.jsx("th",{className:"px-3 py-2",children:"Repository"}),i.jsx("th",{className:"px-3 py-2",children:"Reference"}),i.jsx("th",{className:"px-3 py-2",children:"Observed"})]})}),i.jsx("tbody",{children:n.map(N=>i.jsxs("tr",{className:"border-b border-border/70 last:border-0",children:[i.jsx("td",{className:"px-3 py-2 font-semibold",children:N.kind}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:N.repository??"unknown"}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:N.event_key??N.reference}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted",children:i.jsx(ue,{value:N.created_at,compact:!0})})]},`${N.kind}:${N.reference}`))})]})}):i.jsx(J,{text:"No cross-source exceptions in retained data."})})]}):null,a==="hooks"?i.jsx(le,{title:"Hook inventory",children:l?i.jsx(an,{text:"Loading hook inventory…"}):r!=null&&r.length?i.jsx(zi,{noun:"hooks",hasMore:u,loading:c,onLoadMore:p,children:i.jsxs("table",{className:"w-full min-w-[920px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[i.jsx("th",{className:"px-3 py-2",children:"Target"}),i.jsx("th",{className:"px-3 py-2",children:"State"}),i.jsx("th",{className:"px-3 py-2",children:"Configuration"}),i.jsx("th",{className:"px-3 py-2",children:"Last delivery"}),i.jsx("th",{className:"px-3 py-2",children:"Last ping"})]})}),i.jsx("tbody",{children:r.map(N=>i.jsxs("tr",{className:"cursor-pointer border-b border-border/70 last:border-0 hover:bg-slate-50",onClick:()=>b(N.id),children:[i.jsxs("td",{className:"px-3 py-3",children:[i.jsx("button",{type:"button",className:"text-left font-semibold text-primary hover:underline",onClick:E=>{E.stopPropagation(),b(N.id)},children:N.target}),i.jsxs("div",{className:"font-mono text-xs text-muted",children:[N.target_type," · #",N.id]})]}),i.jsx("td",{className:"px-3 py-3",children:i.jsx("span",{className:W("rounded border px-2 py-1 text-xs font-semibold",N.status==="receiving"?"border-emerald-200 bg-emerald-50 text-emerald-700":N.status==="inactive"?"border-red-200 bg-red-50 text-red-700":"border-slate-200 bg-slate-50 text-slate-600"),children:N.status})}),i.jsxs("td",{className:"max-w-sm px-3 py-3 text-xs",children:[i.jsx("div",{children:N.events.join(", ")||"No event snapshot"}),i.jsxs("div",{className:"mt-1 font-mono text-muted",children:[N.content_type??"content type unknown"," · SSL ",N.ssl_verify===null||N.ssl_verify===void 0?"unknown":N.ssl_verify?"verified":"disabled"]})]}),i.jsxs("td",{className:"px-3 py-3 text-xs",children:[i.jsxs("div",{className:"font-semibold",children:[N.last_event_name??"Never",N.last_action?` · ${N.last_action}`:""]}),i.jsxs("div",{className:"mt-1 font-mono text-muted",children:[N.last_repository??"No repository",N.last_event_at?i.jsxs(i.Fragment,{children:[" · ",i.jsx(ue,{value:N.last_event_at,compact:!0})]}):null]})]}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:N.last_ping_at?i.jsx(ue,{value:N.last_ping_at,compact:!0}):"Never"})]},N.id))})]})}):i.jsx(J,{text:"No hook inventory is available. Redeliver a signed ping from GitHub to create the sanitized configuration snapshot."})}):null,a==="deliveries"?i.jsxs(le,{title:"Recent deliveries",children:[i.jsx(nx,{filters:d,onChange:w}),l?i.jsx(an,{text:"Loading deliveries…"}):s!=null&&s.length?i.jsx(zi,{noun:"deliveries",hasMore:u,loading:c,onLoadMore:p,children:i.jsx(Hl,{deliveries:s,onViewHook:b,onViewDelivery:v})}):i.jsx(J,{text:"No deliveries match the current filters."})]}):null]})}function nx({filters:e,onChange:t}){const n=[{key:"hook_id",label:"Hook ID",placeholder:"690954530"},{key:"event_name",label:"Event",placeholder:"issue_comment"},{key:"repository",label:"Repository",placeholder:"gisce/repository"},{key:"result",label:"Result",placeholder:"observed"},{key:"enqueue_status",label:"Ingestion",placeholder:"enqueued"}];return i.jsx("div",{className:"grid gap-2 border-b border-border p-3 sm:grid-cols-2 xl:grid-cols-5",children:n.map(r=>i.jsxs("label",{className:"grid gap-1 text-xs font-semibold text-muted",children:[r.label,i.jsx("input",{className:"h-9 rounded-md border border-border bg-white px-2 font-mono text-xs text-foreground",value:e[r.key],placeholder:r.placeholder,onChange:s=>t({...e,[r.key]:s.target.value})})]},r.key))})}function Hl({deliveries:e,onViewHook:t,onViewDelivery:n=()=>{}}){return i.jsxs("table",{className:"w-full min-w-[1120px] text-left text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[i.jsx("th",{className:"px-3 py-2",children:"Received"}),i.jsx("th",{className:"px-3 py-2",children:"Hook"}),i.jsx("th",{className:"px-3 py-2",children:"Event"}),i.jsx("th",{className:"px-3 py-2",children:"Repository"}),i.jsx("th",{className:"px-3 py-2",children:"Result"}),i.jsx("th",{className:"px-3 py-2",children:"Ingestion"}),i.jsx("th",{className:"px-3 py-2",children:"Delivery"})]})}),i.jsx("tbody",{children:e.map(r=>{var s;return i.jsxs("tr",{className:"border-b border-border/70 last:border-0 hover:bg-slate-50",children:[i.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:i.jsx(ue,{value:r.created_at,compact:!0})}),i.jsx("td",{className:"px-3 py-3",children:r.hook_id?i.jsxs("button",{type:"button",className:"text-left text-primary hover:underline",onClick:()=>t(r.hook_id),children:[i.jsx("span",{className:"block font-semibold",children:((s=r.hook)==null?void 0:s.target)??`Hook #${r.hook_id}`}),i.jsxs("span",{className:"font-mono text-xs",children:["#",r.hook_id]})]}):i.jsx("span",{className:"text-xs text-muted",children:"Unknown (legacy)"})}),i.jsxs("td",{className:"px-3 py-3 font-semibold",children:[r.event_name,r.action?` · ${r.action}`:""]}),i.jsx("td",{className:"px-3 py-3",children:r.repository??"—"}),i.jsxs("td",{className:"px-3 py-3",children:[i.jsx("span",{className:"rounded border border-border bg-slate-50 px-2 py-1 text-xs font-semibold",children:r.status}),r.duplicate_count?i.jsxs("span",{className:"ml-2 font-mono text-xs text-muted",children:[r.duplicate_count," retries"]}):null]}),i.jsx("td",{className:"px-3 py-3",children:r.enqueue_status?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"rounded border border-border bg-slate-50 px-2 py-1 text-xs font-semibold",children:r.enqueue_status}),r.job_id?i.jsxs("a",{className:"ml-2 font-mono text-xs font-semibold text-primary hover:underline",href:`/jobs/${r.job_id}`,children:["Job #",r.job_id]}):null]}):i.jsx("span",{className:"text-xs text-muted",children:"shadow"})}),i.jsx("td",{className:"max-w-[14rem] px-3 py-3",children:i.jsx("button",{type:"button",className:"block max-w-full truncate font-mono text-xs font-semibold text-primary hover:underline",title:r.delivery_id,onClick:()=>n(r.delivery_id),children:r.delivery_id})})]},r.delivery_id)})})]})}function zi({noun:e,hasMore:t,loading:n,onLoadMore:r,children:s,className:a}){return i.jsxs("div",{"data-testid":`lazy-scroll-${e}`,className:W("max-h-[640px] overflow-auto rounded-md border border-border",a),children:[s,i.jsx(rx,{noun:e,hasMore:t,loading:n,onLoadMore:r})]})}function rx({noun:e,hasMore:t,loading:n,onLoadMore:r}){const s=A.useRef(null),a=A.useRef(!1);return A.useEffect(()=>{n||(a.current=!1)},[n]),A.useEffect(()=>{const o=s.current;if(!o||!t||n||!r)return;const l=()=>{a.current||(a.current=!0,r())};if(!("IntersectionObserver"in window)){l();return}const c=new IntersectionObserver(u=>{u.some(d=>d.isIntersecting)&&l()},{rootMargin:"240px 0px"});return c.observe(o),()=>c.disconnect()},[t,n,e,r]),!t&&!n?null:i.jsx("div",{ref:s,className:"flex min-h-10 items-center justify-center border-t border-border px-3 py-2 text-xs font-medium text-muted","aria-live":"polite",children:n?`Loading more ${e}...`:`Scroll for more ${e}`})}function ix({data:e,loading:t,error:n,onBack:r,onRefresh:s,onViewHook:a,onViewDelivery:o=()=>{},onPing:l}){const[c,u]=A.useState(!1),[d,h]=A.useState(""),[m,p]=A.useState("");if(t)return i.jsx(an,{text:"Loading hook detail…"});if(n)return i.jsxs("div",{className:"grid gap-3",children:[i.jsx(ve,{tone:"error",text:n.message}),i.jsx("button",{type:"button",className:"w-fit rounded border border-border px-3 py-2 text-sm font-semibold",onClick:r,children:"Back to hooks"})]});if(!e)return i.jsx(J,{text:"Hook detail is not available."});const w=e.hook,b={...w,github_created_at:w.github_created_at?i.jsx(ue,{value:w.github_created_at}):"unknown",github_updated_at:w.github_updated_at?i.jsx(ue,{value:w.github_updated_at}):"unknown",last_ping_at:w.last_ping_at?i.jsx(ue,{value:w.last_ping_at}):"never",last_event_at:w.last_event_at?i.jsx(ue,{value:w.last_event_at}):"never"},v=async()=>{if(!(!l||c)){u(!0),h(""),p("");try{h(await l(b.id))}catch(j){p(j instanceof Error?j.message:String(j))}finally{u(!1)}}},y=(e.recent_actions??[]).map(j=>({...j,created_at:i.jsx(ue,{value:j.created_at,compact:!0})}));return i.jsxs("section",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",className:"mb-2 inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline",onClick:r,children:[i.jsx(Qi,{className:"h-4 w-4","aria-hidden":!0}),"Back to hooks"]}),i.jsx("h2",{className:"text-xl font-semibold",children:b.target}),i.jsxs("p",{className:"font-mono text-xs text-muted",children:[b.target_type," webhook #",b.id]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[b.ping_url&&l?i.jsxs("button",{type:"button",className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold hover:bg-slate-50 disabled:cursor-wait disabled:opacity-60",disabled:c,onClick:()=>void v(),children:[i.jsx(Jt,{className:W("h-4 w-4",c&&"animate-pulse"),"aria-hidden":!0}),c?"Sending ping…":"Send ping"]}):null,i.jsx(Ye,{onClick:s}),b.admin_url?i.jsxs("a",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold hover:bg-slate-50",href:Ze(b.admin_url),target:"_blank",rel:"noreferrer",children:[i.jsx(Xt,{className:"h-4 w-4","aria-hidden":!0}),"Open in GitHub"]}):null]})]}),m?i.jsx(ve,{tone:"error",text:m}):null,d?i.jsx("div",{className:"rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-700",children:d}):null,i.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[i.jsx(Ce,{title:"State",value:b.status,icon:i.jsx(Jt,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Deliveries",value:e.stats.deliveries,icon:i.jsx(Nn,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Retries",value:e.stats.duplicates,icon:i.jsx(cr,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Unsupported",value:e.stats.unsupported,icon:i.jsx(Br,{className:"h-5 w-5"})})]}),i.jsxs(le,{title:"Sanitized configuration",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.jsx(V,{label:"Active",value:b.active?"yes":"no"}),i.jsx(V,{label:"Content type",value:b.content_type??"unknown"}),i.jsx(V,{label:"SSL verification",value:b.ssl_verify===null||b.ssl_verify===void 0?"unknown":b.ssl_verify?"enabled":"disabled"}),i.jsx(V,{label:"Destination URL",value:b.delivery_url??"unknown"}),i.jsx(V,{label:"GitHub created",value:b.github_created_at??"unknown"}),i.jsx(V,{label:"GitHub updated",value:b.github_updated_at??"unknown"}),i.jsx(V,{label:"Last ping",value:b.last_ping_at??"never"}),i.jsx(V,{label:"Last delivery",value:b.last_event_at??"never"}),i.jsx(V,{label:"Last result",value:b.last_result??"unknown"})]}),i.jsxs("div",{className:"mt-3 rounded-md border border-border p-3",children:[i.jsx("div",{className:"text-xs font-semibold text-muted",children:"Subscribed events"}),i.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.events.length?b.events.map(j=>i.jsx("span",{className:"rounded border border-border bg-slate-50 px-2 py-1 font-mono text-xs",children:j},j)):i.jsx("span",{className:"text-sm text-muted",children:"No event snapshot; send a ping to refresh it."})})]})]}),i.jsx(le,{title:"Latest observed delivery",children:i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.jsx(V,{label:"Event",value:b.last_event_name?`${b.last_event_name}${b.last_action?` · ${b.last_action}`:""}`:"none"}),i.jsx(V,{label:"Repository",value:b.last_repository??"none"}),i.jsx(V,{label:"Delivery ID",value:b.last_delivery_id??"none"})]})}),i.jsx(le,{title:"Recent administrative actions",children:y.length?i.jsx("div",{className:"divide-y divide-border rounded-md border border-border",children:y.map(j=>i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm",children:[i.jsxs("div",{children:[i.jsx("span",{className:"font-semibold",children:j.action}),i.jsxs("span",{className:"ml-2 text-muted",children:["by @",j.actor]})]}),i.jsxs("span",{className:"font-mono text-xs text-muted",children:[j.status," · ",j.created_at]})]},j.id))}):i.jsx(J,{text:"No administrative actions recorded for this hook."})}),i.jsx(le,{title:"Recent deliveries",children:e.recent_deliveries.length?i.jsx(Hl,{deliveries:e.recent_deliveries,onViewHook:a,onViewDelivery:o}):i.jsx(J,{text:"This hook has no retained deliveries."})})]})}function sx({data:e,loading:t,error:n,onBack:r,onRefresh:s,onViewHook:a,onViewJob:o}){if(t)return i.jsx(an,{text:"Loading delivery detail…"});if(n)return i.jsxs("div",{className:"grid gap-3",children:[i.jsx(ve,{tone:"error",text:n.message}),i.jsx("button",{type:"button",className:"w-fit rounded border border-border px-3 py-2 text-sm font-semibold",onClick:r,children:"Back to deliveries"})]});if(!e)return i.jsx(J,{text:"Delivery detail is not available."});const l={...e.delivery,created_at:i.jsx(ue,{value:e.delivery.created_at})};return i.jsxs("section",{className:"grid gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",className:"mb-2 inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline",onClick:r,children:[i.jsx(Qi,{className:"h-4 w-4","aria-hidden":!0}),"Back to deliveries"]}),i.jsxs("h2",{className:"text-xl font-semibold",children:[l.event_name,l.action?` · ${l.action}`:""]}),i.jsxs("p",{className:"font-mono text-xs text-muted",children:["Delivery ",l.delivery_id]})]}),i.jsx(Ye,{onClick:s})]}),i.jsxs(le,{title:"Delivery",children:[i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[i.jsx(V,{label:"Received",value:l.created_at}),i.jsx(V,{label:"Repository",value:l.repository??"unknown"}),i.jsx(V,{label:"Result",value:l.status}),i.jsx(V,{label:"Event key",value:l.event_key??"unmatchable"}),i.jsx(V,{label:"Payload SHA-256",value:e.payload_hash}),i.jsx(V,{label:"Retries",value:l.duplicate_count??0})]}),l.hook_id?i.jsxs("button",{type:"button",className:"mt-3 text-sm font-semibold text-primary hover:underline",onClick:()=>a(l.hook_id),children:["View hook #",l.hook_id]}):null]}),i.jsx(le,{title:"Generated job",children:e.job?i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("div",{className:"font-semibold",children:e.job.work_key}),i.jsxs("div",{className:"mt-1 font-mono text-xs text-muted",children:["Job #",e.job.id," · ",e.job.status," · ",e.job.action," · ",e.job.work_intent]})]}),i.jsx("button",{type:"button",className:"rounded-md border border-border px-3 py-2 text-sm font-semibold hover:bg-slate-50",onClick:()=>o(e.job.id),children:"Open job"})]}):i.jsx(J,{text:"This delivery did not generate or coalesce into a job."})}),i.jsx(le,{title:"Full payload",children:e.payload===null?i.jsx(J,{text:"Payload was not retained for this legacy delivery."}):i.jsx("pre",{className:"max-h-[640px] overflow-auto rounded-md border border-border bg-slate-950 p-4 font-mono text-xs leading-relaxed text-slate-100",children:JSON.stringify(e.payload,null,2)})})]})}function ax({processes:e,processesLoading:t,processesError:n,systemd:r,systemdLoading:s,systemdError:a,alerts:o,alertsLoading:l,alertsError:c,now:u,onRefreshProcesses:d,onRefreshSystemd:h,onRefreshAlerts:m}){return i.jsxs("section",{className:"grid gap-4","aria-label":"Bridge system",children:[i.jsxs(le,{title:"Systemd",action:i.jsx(Ye,{onClick:h}),children:[a?i.jsx(ve,{tone:"error",text:a.message}):null,i.jsx(qx,{data:r,loading:s})]}),i.jsxs(le,{title:"Process activity",action:i.jsx(Ye,{onClick:d}),children:[n?i.jsx(ve,{tone:"error",text:n.message}):null,i.jsx($x,{data:e,loading:t})]}),i.jsxs(le,{title:"Monitor alerts",action:i.jsx(Ye,{onClick:m}),children:[c?i.jsx(ve,{tone:"error",text:c.message}):null,i.jsx(Hx,{alerts:o,loading:l,now:u})]})]})}function Fn({href:e,active:t,children:n,onNavigate:r}){return i.jsx("a",{className:W("inline-flex h-8 min-w-0 flex-1 items-center justify-center gap-1 rounded-md px-1.5 text-xs font-semibold sm:flex-none sm:gap-1.5 sm:px-3 sm:text-sm [&>span]:truncate [&>svg]:shrink-0",t?"bg-primary text-white shadow-sm":"text-muted hover:bg-slate-50 hover:text-foreground"),href:e,onClick:s=>{!r||s.defaultPrevented||s.button!==0||s.metaKey||s.ctrlKey||s.altKey||s.shiftKey||(s.preventDefault(),r(e))},children:n})}function ox({jobId:e,detail:t,selectedJob:n,user:r,onBackToDashboard:s,onRetry:a,onDismiss:o,onCancel:l,onRefresh:c}){const[u,d]=A.useState(!1),[h,m]=A.useState(!1),[p,w]=A.useState(!1),b=!!(r!=null&&r.is_admin&&n&&qn(n.status)),v=!!(n&&Fi(n,r)),y=u?"Retrying...":"Retry",j=h?"Dismissing...":"Dismiss",_=p?"Cancelling...":"Cancel";return i.jsxs("div",{className:"grid min-w-0 gap-3 sm:gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("a",{className:"inline-flex h-9 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50",href:"/",onClick:S=>{S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey||(S.preventDefault(),s())},children:[i.jsx(Qi,{className:"h-4 w-4","aria-hidden":!0}),"Dashboard"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[b?i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:u,onClick:async()=>{if(window.confirm(`Retry job #${e}?`)){d(!0);try{await a(e)}finally{d(!1)}}},children:[i.jsx(Gn,{className:"h-4 w-4","aria-hidden":!0}),y]}):null,b?i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border bg-white px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:h,onClick:async()=>{if(window.confirm(`Dismiss job #${e}?`)){m(!0);try{await o(e)}finally{m(!1)}}},children:[i.jsx(kn,{className:"h-4 w-4","aria-hidden":!0}),j]}):null,v?i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-red-200 bg-red-50 px-3 text-sm font-semibold text-red-700 hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:p,onClick:async()=>{const S=window.prompt(`Cancel job #${e}? Optional reason:`);if(S!==null){w(!0);try{await l(e,S)}finally{w(!1)}}},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),_]}):null,i.jsx(Ye,{onClick:c})]})]}),i.jsx(le,{title:`Job #${e}`,className:"p-3 sm:p-4",children:t})]})}function lx({selectedJobId:e,selectedJob:t,loading:n,error:r,session:s,sessionEvents:a,transcript:o,now:l}){return t?i.jsx(Ax,{job:t,session:s,sessionEvents:a,transcript:o,now:l}):e!==null&&n?i.jsx(J,{text:"Loading selected job..."}):e!==null&&r?i.jsx(ve,{tone:"error",text:`Job #${e}: ${r.message}`}):i.jsx(J,{text:"Select a job to inspect its timeline, worklog and GitHub links."})}function cx({data:e,loading:t,error:n,repo:r,status:s,user:a,now:o,onRepoChange:l,onStatusChange:c,onApprove:u,onReject:d,onUpdateRuleScope:h,onDeleteRule:m,onRefresh:p}){const w=(e==null?void 0:e.summary)??{},[b,v]=A.useState("proposals"),y=[{id:"proposals",label:"Proposals",count:(e==null?void 0:e.proposals.length)??0},{id:"rules",label:"Rules",count:(e==null?void 0:e.rules.length)??0},{id:"events",label:"Events",count:(e==null?void 0:e.events.length)??0}];return i.jsxs("div",{className:"grid min-w-0 gap-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[i.jsx(Vi,{className:"h-5 w-5 text-muted","aria-hidden":!0}),"Acquired knowledge"]}),i.jsx("p",{className:"text-xs text-muted",children:"Captured feedback, proposed rules and curated agent memory."})]}),i.jsx(Ye,{onClick:p})]}),n?i.jsx(ve,{tone:"error",text:n.message}):null,i.jsxs("section",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4","aria-label":"Knowledge metrics",children:[i.jsx(Ce,{title:"Proposed",value:w.proposed??0,icon:i.jsx(Wo,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Approved",value:w.approved??0,icon:i.jsx(kn,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Rules",value:w.rules??0,icon:i.jsx(Jo,{className:"h-5 w-5"})}),i.jsx(Ce,{title:"Events",value:w.events??0,icon:i.jsx(Jt,{className:"h-5 w-5"})})]}),i.jsx(le,{title:"Filters",className:"p-3",children:i.jsxs("div",{className:W("grid gap-3",b==="proposals"?"md:grid-cols-[minmax(0,1fr)_220px]":"md:grid-cols-[minmax(0,1fr)]"),children:[i.jsx(Xe,{label:"Repository",children:i.jsxs("select",{className:"control",value:r,onChange:j=>l(j.target.value),children:[i.jsx("option",{value:"",children:"All repositories"}),((e==null?void 0:e.repositories)??[]).map(j=>i.jsx("option",{value:j,children:j},j))]})}),b==="proposals"?i.jsx(Xe,{label:"Proposal status",children:i.jsxs("select",{className:"control",value:s,onChange:j=>c(j.target.value),children:[i.jsx("option",{value:"",children:"All statuses"}),i.jsx("option",{value:"proposed",children:"proposed"}),i.jsx("option",{value:"approved",children:"approved"}),i.jsx("option",{value:"rejected",children:"rejected"}),i.jsx("option",{value:"error",children:"error"})]})}):null]})}),i.jsxs(le,{title:"Knowledge records",action:i.jsx("div",{className:"flex max-w-full flex-wrap rounded-md border border-border bg-white p-0.5",role:"tablist","aria-label":"Knowledge record type",children:y.map(j=>i.jsxs("button",{className:W("inline-flex h-8 items-center gap-1.5 rounded px-2.5 text-xs font-semibold",b===j.id?"bg-primary text-white":"text-muted hover:bg-slate-50 hover:text-foreground"),type:"button",role:"tab","aria-label":`${j.label} (${j.count})`,"aria-selected":b===j.id,onClick:()=>v(j.id),children:[i.jsx("span",{children:j.label}),i.jsx("span",{className:W("rounded-sm border px-1 font-mono text-[10px]",b===j.id?"border-white/40 text-white":"border-border text-muted"),children:j.count})]},j.id))}),children:[b==="proposals"?i.jsx(ux,{proposals:(e==null?void 0:e.proposals)??[],loading:t,isAdmin:!!(a!=null&&a.is_admin),now:o,onApprove:u,onReject:d}):null,b==="rules"?i.jsx(px,{rules:(e==null?void 0:e.rules)??[],loading:t,now:o,onUpdateRuleScope:h,onDeleteRule:m}):null,b==="events"?i.jsx(mx,{events:(e==null?void 0:e.events)??[],loading:t,now:o}):null]})]})}function ux({proposals:e,loading:t,isAdmin:n,now:r,onApprove:s,onReject:a}){const[o,l]=A.useState(null);return t&&e.length===0?i.jsx(J,{text:"Loading proposals..."}):e.length===0?i.jsx(J,{text:"No proposals match the current filters."}):i.jsx("div",{className:"grid gap-2",children:e.map(c=>i.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[i.jsx(Vl,{scope:c.scope,type:c.type,confidence:c.confidence,status:c.status,timestamp:c.updated_at,now:r}),i.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:c.rule||c.reason||"No reusable rule proposed."}),c.reason?i.jsx("p",{className:"min-w-0 break-words text-xs text-muted [overflow-wrap:anywhere]",children:c.reason}):null,c.source_event?i.jsx(dx,{event:c.source_event}):i.jsxs("p",{className:"font-mono text-xs text-muted",children:["Source event ",c.event_id]}),c.error?i.jsx(ve,{tone:"error",text:c.error}):null,n&&c.status==="proposed"?i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:opacity-60",type:"button",disabled:o===c.id,onClick:async()=>{l(c.id);try{await s(c.id)}finally{l(null)}},children:[i.jsx(kn,{className:"h-4 w-4","aria-hidden":!0}),"Approve"]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:o===c.id,onClick:async()=>{l(c.id);try{await a(c.id)}finally{l(null)}},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),"Reject"]})]}):null]},c.id))})}function dx({event:e}){const t=e.trigger_actor||(e.actor!=="github"?e.actor:null);return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-md border border-border bg-slate-50 px-2 py-1.5",children:[i.jsx(Pn,{actor:t,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),e.source_job_id?i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:En(e.source_job_id),children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.source_job_id]}):null,e.github_urls.length>0?i.jsx(Xn,{urls:e.github_urls,compact:!0}):i.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})}function hx(e){const t=[{value:"global",label:"global"}];if(e.startsWith("repo:")){const n=e.slice(5),[r,s]=n.split("/",2);r&&s&&(t.push({value:`org:${r}`,label:`org:${r}`}),t.push({value:`repo:${r}/${s}`,label:`repo:${r}/${s}`}))}else e.startsWith("org:")&&t.push({value:e,label:e});return t.some(n=>n.value===e)||t.push({value:e,label:e}),t}function px({rules:e,loading:t,now:n,onUpdateRuleScope:r,onDeleteRule:s}){const[a,o]=A.useState(null),[l,c]=A.useState(null),[u,d]=A.useState("");return t&&e.length===0?i.jsx(J,{text:"Loading curated rules..."}):e.length===0?i.jsx(J,{text:"No curated rules match the current filters."}):i.jsx("div",{className:"grid gap-2",children:e.map(h=>{const m=h.source_event_details??[],p=m[0],w=p?p.trigger_actor||(p.actor!=="github"?p.actor:null):null,b=m.flatMap(S=>S.github_urls??[]),v=hx(h.scope),y=l===h.id,j=a===h.id,_=!!h.can_manage;return i.jsxs("article",{className:"grid min-w-0 gap-2 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsx(Vl,{scope:h.scope,type:h.type,confidence:h.confidence,status:`${h.observations} observation${h.observations===1?"":"s"}`,timestamp:h.last_seen,now:n}),_?i.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[y?i.jsxs(i.Fragment,{children:[i.jsx(Xe,{label:"Scope",children:i.jsx("select",{className:"control h-8 min-w-[180px] py-1 text-xs",value:u,disabled:j,onChange:S=>d(S.target.value),children:v.map(S=>i.jsx("option",{value:S.value,children:S.label},S.value))})}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:j||u===h.scope,title:"Save scope",onClick:async()=>{if(u!==h.scope){o(h.id);try{await r(h.id,u),c(null)}finally{o(null)}}},children:[i.jsx(hu,{className:"h-4 w-4","aria-hidden":!0}),"Save"]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-muted hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:j,title:"Cancel scope edit",onClick:()=>{c(null),d("")},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),"Cancel"]})]}):i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:opacity-60",type:"button",disabled:j,title:"Edit scope",onClick:()=>{c(h.id),d(h.scope)},children:[i.jsx(du,{className:"h-4 w-4","aria-hidden":!0}),"Edit"]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:opacity-60",type:"button",disabled:j,onClick:async()=>{if(window.confirm("Delete this curated rule?")){o(h.id);try{await s(h.id)}finally{o(null)}}},children:[i.jsx(Si,{className:"h-4 w-4","aria-hidden":!0}),"Delete"]})]}):null]}),i.jsx("p",{className:"min-w-0 break-words text-sm font-medium [overflow-wrap:anywhere]",children:h.rule}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx(Pn,{actor:w,avatarUrl:p==null?void 0:p.trigger_actor_avatar_url,framed:!0}),p!=null&&p.source_job_id?i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:En(p.source_job_id),children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",p.source_job_id]}):null,b.length>0?i.jsx(Xn,{urls:b,compact:!0}):i.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]})]},h.id)})})}function mx({events:e,loading:t,now:n}){return t&&e.length===0?i.jsx(J,{text:"Loading captured events..."}):e.length===0?i.jsx(J,{text:"No captured feedback events match the current filters."}):i.jsx("div",{className:"grid gap-2",children:e.map(r=>{const s=r.trigger_actor||(r.actor!=="github"?r.actor:null);return i.jsxs("details",{className:"group rounded-md border border-border bg-white",children:[i.jsxs("summary",{className:"grid cursor-pointer list-none gap-2 px-3 py-2 marker:hidden hover:bg-slate-50",children:[i.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[i.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2 font-mono text-xs font-semibold text-muted",children:[i.jsx(jn,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180","aria-hidden":!0}),i.jsx("span",{className:"truncate",children:Ul(r.scope)})]}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-muted",children:i.jsx(ue,{value:r.occurred_at,relative:!0,now:n})})]}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx(Pn,{actor:s,avatarUrl:r.trigger_actor_avatar_url,framed:!0}),r.source_job_id?i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-foreground hover:bg-white",href:En(r.source_job_id),children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",r.source_job_id]}):null,r.github_urls.length>0?i.jsx(Xn,{urls:r.github_urls,compact:!0}):i.jsx("span",{className:"font-mono text-xs text-muted",children:"No GitHub link"})]}),i.jsx("p",{className:"line-clamp-2 break-words text-sm [overflow-wrap:anywhere]",children:r.comment})]}),i.jsxs("div",{className:"grid gap-2 border-t border-border px-3 py-2",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"mb-1 text-xs font-semibold text-muted",children:"GitHub links"}),r.github_urls.length>0?i.jsx(Xn,{urls:r.github_urls}):i.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]}),i.jsx("pre",{className:"max-h-72 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:JSON.stringify(r.context,null,2)})]})]},r.id)})})}function fx({tokens:e,loading:t,error:n,user:r,ownerOptions:s,dashboardUrl:a,dashboardUrlSource:o,now:l,onCreate:c,onUpdateOwner:u,onRevoke:d,onRefresh:h}){const[m,p]=A.useState(""),[w,b]=A.useState(""),[v,y]=A.useState(!1),[j,_]=A.useState(null),[S,F]=A.useState(null),[k,q]=A.useState(null),[M,R]=A.useState(""),z=e??[],N=s.find(P=>P.login===w);A.useEffect(()=>{var P;r!=null&&r.is_admin&&(w&&s.some($=>$.login===w)||b((r==null?void 0:r.login)||((P=s[0])==null?void 0:P.login)||""))},[s,r==null?void 0:r.is_admin,r==null?void 0:r.login,w]);const E=(a||(typeof window>"u"?"":window.location.origin)).replace(/\/$/,""),X=`${E}/mcp`,D=`${E}/api/mcp`;return i.jsxs("div",{className:"grid min-w-0 gap-4",children:[i.jsx(Kl,{icon:i.jsx(Lr,{className:"h-5 w-5 text-muted","aria-hidden":!0}),title:"MCP access",subtitle:r!=null&&r.is_admin?"Issue and revoke read-only tokens for any dashboard user.":"Issue and revoke read-only tokens linked to your user.",action:i.jsx(Ye,{onClick:h})}),n?i.jsx(ve,{tone:"error",text:n.message}):null,M?i.jsx(ve,{tone:"error",text:M}):null,i.jsx(xx,{dashboardUrl:X,endpointUrl:D,dashboardUrlSource:o??"request"}),k?i.jsxs("section",{className:"rounded-md border border-emerald-300 bg-emerald-50 p-3 text-emerald-950","aria-label":"Created MCP token",children:[i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-sm font-semibold",children:"Token created"}),i.jsx("p",{className:"mt-1 text-xs text-emerald-800",children:"This secret is shown once. Store it in the local agent environment before leaving this page."})]}),i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-emerald-300 bg-white px-3 text-sm font-semibold text-emerald-900 hover:bg-emerald-100",type:"button",onClick:()=>q(null),children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),"Hide"]})]}),i.jsx("pre",{className:"mt-3 overflow-auto rounded bg-emerald-950 px-3 py-2 font-mono text-xs text-emerald-50",children:k.token})]}):null,i.jsx(le,{title:"Create token",children:i.jsxs("form",{className:r!=null&&r.is_admin?"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(12rem,16rem)_auto]":"grid gap-3 md:grid-cols-[minmax(0,1fr)_auto]",onSubmit:async P=>{P.preventDefault();const $=m.trim();if($){y(!0),R("");try{const B=await c($,r!=null&&r.is_admin?w:void 0);q(B),p("")}catch(B){R(B instanceof Error?B.message:String(B))}finally{y(!1)}}},children:[i.jsx(Xe,{label:"Token name",children:i.jsx("input",{className:"control",value:m,placeholder:"local agent",disabled:v,onChange:P=>p(P.target.value)})}),r!=null&&r.is_admin?i.jsxs(Xe,{label:"Owner",children:[i.jsx(Ql,{ariaLabel:"Owner",value:w,ownerOptions:s,disabled:v||s.length===0,selectedSuffix:P=>P.login===(r==null?void 0:r.login)?" (you)":"",emptyLabel:"No known users",onChange:b}),N?i.jsxs("span",{className:"font-normal text-muted",children:["Token will be linked to @",N.login,"."]}):null]}):null,i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 self-end rounded-md bg-primary px-3 text-sm font-semibold text-white disabled:cursor-not-allowed disabled:opacity-60",type:"submit",disabled:v||!m.trim()||!!(r!=null&&r.is_admin&&!w),children:[i.jsx(Lr,{className:"h-4 w-4","aria-hidden":!0}),v?"Creating...":"Create token"]})]})}),i.jsx(le,{title:"Active tokens",children:i.jsx(gx,{tokens:z,loading:t,now:l,ownerOptions:s,canManageOwners:!!(r!=null&&r.is_admin),revokingId:j,updatingOwnerId:S,onUpdateOwner:async(P,$)=>{F(P),R("");try{await u(P,$)}catch(B){R(B instanceof Error?B.message:String(B))}finally{F(null)}},onRevoke:async P=>{if(window.confirm("Revoke this MCP token?")){_(P),R("");try{await d(P)}catch($){R($ instanceof Error?$.message:String($))}finally{_(null)}}}})})]})}function xx({dashboardUrl:e,endpointUrl:t,dashboardUrlSource:n}){const r=n==="configured"?"Configured public URL":n==="forwarded"?"Forwarded public URL":"Needs public URL",s=n==="request",a=s?"Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL or forward X-Forwarded-* headers":e,o=s?"Public dashboard URL required before connecting remote agents":t,c=`{ "mcpServers": { "github-agent-bridge": { "url": "${s?"https://bridge.example.com/api/mcp":t}", @@ -184,4 +184,4 @@ var aa=e=>{throw TypeError(e)};var Kr=(e,t,n)=>t.has(e)||aa("Cannot "+n);var g=( } } } -}`;return i.jsxs(le,{title:"Connect an agent",children:[s?i.jsx(we,{tone:"warning",text:"Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL, or forward X-Forwarded-* headers from the proxy, before connecting remote agents."}):null,i.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"grid min-w-0 gap-3",children:[i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm font-semibold",children:[i.jsx(Xt,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Public dashboard URL",i.jsx("span",{className:"rounded-sm border border-border bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] font-normal text-muted",children:r})]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Share this page URL with bridge admins only after it resolves to the external dashboard origin."}),i.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:a})]}),i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Xt,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"HTTP MCP endpoint"]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Remote agents connect directly with a bearer token; no local `gab` binary is required on the agent host."}),i.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:o})]})]}),i.jsxs("div",{className:"grid min-w-0 gap-3",children:[i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Lr,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent config"]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Create a token below, then store the one-time secret as `GITHUB_AGENT_BRIDGE_MCP_TOKEN` for the agent."}),i.jsx("pre",{className:"mt-3 max-h-64 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:c})]}),i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Vi,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent prompt"]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Ask the agent to use the read-only bridge knowledge server before acting on repository work."}),i.jsx("pre",{className:"mt-3 max-h-40 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:"Use the github-agent-bridge MCP server for repository knowledge. Query list_repositories and list_knowledge before making repository decisions."})]})]})]})]})}function Kl({icon:e,title:t,subtitle:n,action:r}){return i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e,t]}),i.jsx("p",{className:"text-xs text-muted",children:n})]}),r]})}function gx({tokens:e,loading:t,now:n,ownerOptions:r,canManageOwners:s,revokingId:a,updatingOwnerId:o,onUpdateOwner:l,onRevoke:c}){return t&&e.length===0?i.jsx(J,{text:"Loading MCP tokens..."}):e.length===0?i.jsx(J,{text:"No active MCP tokens."}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"grid gap-2 md:hidden",children:e.map(u=>i.jsxs("article",{className:"grid min-w-0 gap-3 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"break-words text-sm font-semibold [overflow-wrap:anywhere]",children:u.name}),i.jsx("div",{className:"mt-1 break-all font-mono text-xs text-muted",children:u.id}),s?i.jsx(ho,{token:u,ownerOptions:r,disabled:o===u.id,onUpdateOwner:l}):u.user_login?i.jsxs("div",{className:"mt-1 text-xs text-muted",children:["Owner: @",u.user_login]}):null]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[i.jsx(V,{label:"Created",value:i.jsx(Pe,{value:u.created_at,relative:!0,now:n})}),i.jsx(V,{label:"Last used",value:u.last_used_at?i.jsx(Pe,{value:u.last_used_at,relative:!0,now:n}):"never"})]}),i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:a===u.id,onClick:()=>c(u.id),children:[i.jsx(Si,{className:"h-4 w-4","aria-hidden":!0}),a===u.id?"Revoking...":"Revoke"]})]},u.id))}),i.jsx("div",{className:"hidden overflow-auto rounded-md border border-border md:block",children:i.jsxs("table",{className:"min-w-full border-collapse text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border bg-slate-50 text-left text-xs text-muted",children:[i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Name"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Owner"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Created"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Last used"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"ID"}),i.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Actions"})]})}),i.jsx("tbody",{children:e.map(u=>i.jsxs("tr",{className:"border-b border-border last:border-b-0",children:[i.jsx("td",{className:"px-3 py-3 font-semibold",children:u.name}),i.jsx("td",{className:"px-3 py-3 text-xs text-muted",children:s?i.jsx(ho,{token:u,ownerOptions:r,disabled:o===u.id,onUpdateOwner:l}):u.user_login?`@${u.user_login}`:"unassigned"}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:i.jsx(Pe,{value:u.created_at,relative:!0,now:n})}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:u.last_used_at?i.jsx(Pe,{value:u.last_used_at,relative:!0,now:n}):"never"}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:u.id}),i.jsx("td",{className:"px-3 py-3 text-right",children:i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:a===u.id,onClick:()=>c(u.id),children:[i.jsx(Si,{className:"h-4 w-4","aria-hidden":!0}),a===u.id?"Revoking...":"Revoke"]})})]},u.id))})]})})]})}function ho({token:e,ownerOptions:t,disabled:n,onUpdateOwner:r}){const s=e.user_login??"";return i.jsx(Ql,{ariaLabel:`Owner for ${e.name}`,value:s,ownerOptions:t,disabled:n||t.length===0,emptyLabel:"Select owner",size:"compact",onChange:a=>{!a||a===e.user_login||r(e.id,a)}})}function Ql({value:e,ownerOptions:t,disabled:n,onChange:r,ariaLabel:s,selectedSuffix:a,emptyLabel:o,size:l="default"}){const c=t.find(d=>d.login===e),u=c?`@${c.login}${(a==null?void 0:a(c))??""}`:o;return i.jsxs("div",{className:W("relative flex min-w-0 items-center gap-2 rounded-md border border-border bg-panel text-foreground focus-within:border-primary focus-within:ring-1 focus-within:ring-primary",n?"opacity-60":"",l==="compact"?"h-8 w-44 max-w-full px-2":"h-9 w-full px-2.5"),children:[i.jsx("span",{className:W("pointer-events-none flex shrink-0 items-center justify-center",l==="compact"?"h-5 w-5":"h-6 w-6"),children:c!=null&&c.avatar_url?i.jsx("img",{className:"h-full w-full rounded-full bg-slate-100",src:Ze(c.avatar_url),alt:"",referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:W("text-muted",l==="compact"?"h-4 w-4":"h-5 w-5"),"aria-hidden":!0})}),i.jsx("span",{className:W("pointer-events-none min-w-0 flex-1 truncate font-mono",c?"text-foreground":"text-muted",l==="compact"?"text-xs":"text-sm"),children:u}),i.jsxs("select",{className:"absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed","aria-label":s,value:e,disabled:n,onChange:d=>r(d.target.value),children:[t.length===0||!e?i.jsx("option",{value:"",children:o}):null,t.map(d=>i.jsxs("option",{value:d.login,children:["@",d.login,(a==null?void 0:a(d))??""]},d.login))]}),i.jsx(jn,{className:W("pointer-events-none shrink-0 text-muted",l==="compact"?"h-3.5 w-3.5":"h-4 w-4"),"aria-hidden":!0})]})}function Xn({urls:e,compact:t=!1}){const n=t?e.slice(0,2):e,r=e.length-n.length;return i.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap gap-1.5",children:[n.map(s=>i.jsxs("a",{className:W("inline-flex max-w-full items-center gap-1 rounded-md border border-border font-semibold text-primary hover:bg-white hover:underline",t?"h-7 px-2 text-xs":"min-h-7 px-2 py-1 text-xs"),href:Ze(s),"aria-label":s,rel:"noreferrer",target:"_blank",children:[i.jsx(Xt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i.jsx("span",{className:"truncate",children:t?bx(s):s})]},s)),r>0?i.jsxs("span",{className:"inline-flex h-7 items-center rounded-md border border-border px-2 font-mono text-xs text-muted",children:["+",r]}):null]})}function bx(e){try{const t=new URL(e);return t.pathname.replace(/^\//,"")+t.hash}catch{return e}}function Vl({scope:e,type:t,confidence:n,status:r,timestamp:s,now:a}){return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted",children:[i.jsx("span",{className:"truncate font-mono font-semibold text-foreground",children:Ul(e)}),i.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:t}),i.jsxs("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:[Math.round(n*100),"%"]}),i.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:r}),i.jsx("span",{className:"font-mono",children:i.jsx(Pe,{value:s,relative:!0,now:a})})]})}function yx({user:e,loading:t}){const n=e!=null&&e.login?`@${e.login}`:t?"Loading profile...":"GitHub OAuth",r=e!=null&&e.is_admin?"admin":"read-only",s=e!=null&&e.avatar_url?i.jsx("img",{className:"h-10 w-10 rounded-full border border-slate-700 bg-slate-800",src:e.avatar_url,alt:e.login?`${e.login} avatar`:"",referrerPolicy:"no-referrer"}):i.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-slate-700 bg-slate-900",children:i.jsx(Wn,{className:"h-5 w-5","aria-hidden":!0})}),a=e!=null&&e.html_url?i.jsx("a",{className:"truncate font-semibold text-white hover:underline",href:Ze(e.html_url),rel:"noreferrer",target:"_blank",children:n}):i.jsx("div",{className:"truncate font-semibold text-white",children:n});return i.jsxs("div",{className:"flex max-w-full shrink-0 items-center gap-3 text-sm text-slate-300","aria-label":e!=null&&e.login?`Signed in as ${e.login}`:"Dashboard account",children:[i.jsx(Jo,{className:"hidden h-4 w-4 shrink-0 sm:block","aria-hidden":!0}),i.jsxs("div",{className:"hidden min-w-0 text-right sm:block",children:[a,i.jsxs("div",{className:"text-xs text-slate-400",children:["Signed in · ",r]})]}),s]})}function wx({config:e,loading:t,onEnable:n,onDisable:r}){const[s,a]=A.useState(!1),[o,l]=A.useState(""),c=!!(e!=null&&e.status.enabled),u=typeof navigator<"u"&&typeof window<"u"&&Tr(),d=t||s||!(e!=null&&e.configured)||!u,h=u?e!=null&&e.configured?c?"Disable notifications":"Enable notifications":"Notifications not configured":"Notifications unavailable";return i.jsx("div",{className:"relative",children:i.jsx("button",{className:W("inline-flex h-9 w-9 items-center justify-center rounded-md border text-sm font-semibold",c?"border-emerald-400 bg-emerald-50 text-emerald-700":"border-slate-700 bg-slate-900 text-slate-200",d&&"cursor-not-allowed opacity-60"),type:"button","aria-label":h,title:o||h,disabled:d,onClick:async()=>{a(!0),l("");try{c?await r():await n()}catch(m){l(m instanceof Error?m.message:String(m))}finally{a(!1)}},children:i.jsx(Vo,{className:W("h-4 w-4",s&&"animate-live-pulse"),"aria-hidden":!0})})})}function vx({notification:e,onDismiss:t,onNavigate:n}){if(!e)return null;const r=e.title||"GitHub Agent Bridge",s=e.body||e.summary||"Bridge job finished",a=e.url||e.job_url||(e.job_id?En(e.job_id):"/"),o=a.startsWith("/");return i.jsx("aside",{className:"fixed right-3 top-20 z-50 w-[min(calc(100vw-1.5rem),28rem)] rounded-md border border-emerald-300 bg-white shadow-xl shadow-slate-950/15","aria-live":"assertive","aria-label":"Bridge notification",children:i.jsxs("div",{className:"flex items-start gap-3 p-3",children:[i.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-emerald-50 text-emerald-700",children:i.jsx(Vo,{className:"h-4 w-4","aria-hidden":!0})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsx("h2",{className:"min-w-0 break-words text-sm font-semibold text-foreground",children:r}),i.jsx("button",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted hover:bg-slate-100 hover:text-foreground",type:"button","aria-label":"Dismiss notification",onClick:t,children:i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0})})]}),i.jsx("p",{className:"mt-1 min-w-0 break-words text-sm text-muted",children:s}),e.detail?i.jsx("p",{className:"mt-1 line-clamp-2 min-w-0 break-words text-xs text-muted",children:e.detail}):null,i.jsxs("button",{className:"mt-3 inline-flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-semibold text-foreground hover:bg-slate-50",type:"button",onClick:()=>{t(),o?n(a):window.open(Ze(a),"_blank","noopener,noreferrer")},children:[i.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Open"]})]})]})})}function jx({count:e,limit:t,loading:n,onRefresh:r}){return i.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-white px-3 py-3 shadow-sm md:px-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-base font-semibold",children:"Jobs"}),i.jsx("p",{className:"text-xs text-muted",children:n?"Refreshing latest jobs...":`Showing ${e} of the latest ${t} requested jobs`})]}),i.jsx(Ye,{onClick:r,compactOnMobile:!0})]})}function le({title:e,action:t,children:n,className:r,flushHeader:s=!1}){return i.jsxs("section",{className:W("min-w-0 rounded-lg border border-border bg-panel p-4 shadow-sm",r),children:[i.jsxs("div",{className:W("flex flex-wrap items-center justify-between gap-3",!s&&"mb-4"),children:[i.jsx("h2",{className:"text-sm font-semibold",children:e}),t]}),n]})}function Se({title:e,value:t,icon:n}){return i.jsxs("div",{className:"rounded-lg border border-border bg-panel p-3 shadow-sm md:p-4",children:[i.jsxs("div",{className:"flex items-center justify-between text-muted",children:[i.jsx("span",{className:"text-sm font-medium",children:e}),n]}),i.jsx("strong",{className:"mt-3 block text-2xl leading-none md:mt-4 md:text-3xl",children:t})]})}function kx({filters:e,actorOptions:t,onChange:n}){const[r,s]=A.useState(e);A.useEffect(()=>s(e),[e]);const a=Qf(e),o=uo(e)||uo(r),l=()=>{s(Di),n(Di)};return i.jsxs("details",{className:"my-3 rounded-md border border-border bg-slate-50/70",children:[i.jsxs("summary",{className:"grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 text-sm font-semibold marker:hidden",children:[i.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",children:[i.jsx(cu,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Filters"]}),a.length>0?i.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5","aria-label":"Applied filters",children:a.map(c=>i.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-full border border-blue-200 bg-blue-50 px-2 py-0.5 text-xs font-semibold text-blue-700",children:[i.jsx("span",{className:"text-blue-700/70",children:c.label}),i.jsx("span",{className:"max-w-40 truncate font-mono",children:c.value.trim()})]},c.key))}):null]}),i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",children:[o?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-border bg-white px-2.5 text-xs font-semibold text-foreground hover:bg-slate-50",type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),l()},children:[i.jsx(Gn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Clear filters"]}):null,i.jsx(jn,{className:"h-4 w-4 text-muted","aria-hidden":!0})]})]}),i.jsxs("form",{className:"grid gap-3 border-t border-border bg-white p-3 md:grid-cols-3 xl:grid-cols-9",onSubmit:c=>{c.preventDefault(),n(r)},children:[i.jsx(Xe,{label:"Status",children:i.jsxs("select",{className:"control",value:r.status,onChange:c=>s({...r,status:c.target.value}),children:[i.jsx("option",{value:"",children:"All"}),i.jsx("option",{value:"pending",children:"pending"}),i.jsx("option",{value:"running",children:"running"}),i.jsx("option",{value:"blocked",children:"blocked"}),i.jsx("option",{value:"done",children:"done"}),i.jsx("option",{value:"denied",children:"denied"}),i.jsx("option",{value:"waiting_approval",children:"waiting_approval"})]})}),i.jsx(Xe,{label:"Repository",children:i.jsx("input",{className:"control",value:r.repo,placeholder:"owner/repo",onChange:c=>s({...r,repo:c.target.value})})}),i.jsx(Xe,{label:"Thread",children:i.jsx("input",{className:"control",value:r.thread,inputMode:"numeric",placeholder:"issue or PR",onChange:c=>s({...r,thread:c.target.value})})}),i.jsx(Xe,{label:"Action",children:i.jsx("input",{className:"control",value:r.action,placeholder:"reply_comment",onChange:c=>s({...r,action:c.target.value})})}),i.jsx(Xe,{label:"Actor",className:"xl:col-span-2",children:i.jsx(Nx,{value:r.actor,options:t,onChange:c=>s({...r,actor:c})})}),i.jsx(Xe,{label:"Intent",children:i.jsxs("select",{className:"control",value:r.intent,onChange:c=>s({...r,intent:c.target.value}),children:[i.jsx("option",{value:"",children:"All"}),i.jsx("option",{value:"review_only",children:"review_only"}),i.jsx("option",{value:"work_allowed",children:"work_allowed"})]})}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 self-end xl:col-span-2",children:[i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-white",type:"button",disabled:!o,onClick:l,children:[i.jsx(Gn,{className:"h-4 w-4","aria-hidden":!0}),"Clear"]}),i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white",type:"submit",children:[i.jsx(pu,{className:"h-4 w-4","aria-hidden":!0}),"Apply"]})]})]})]})}function Nx({value:e,options:t,onChange:n}){const[r,s]=A.useState(!1),a=e.trim().replace(/^@/,"").toLowerCase(),o=t.filter(c=>!a||c.login.toLowerCase().includes(a)).slice(0,8),l=t.find(c=>c.login.toLowerCase()===a);return i.jsxs("div",{className:"relative min-w-0",children:[i.jsxs("div",{className:"control flex items-center gap-2 px-2",children:[l?i.jsx("img",{className:"h-5 w-5 shrink-0 rounded-full bg-slate-100",src:Ze(l.avatar_url??""),alt:`${l.login} avatar`,referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),i.jsx("input",{className:"min-w-0 flex-1 bg-transparent font-mono text-sm outline-none",value:e,placeholder:"@login",onChange:c=>{n(c.target.value),s(!0)},onFocus:()=>s(!0),onBlur:()=>window.setTimeout(()=>s(!1),100)}),e?i.jsx("button",{className:"rounded-sm p-1 text-muted hover:bg-slate-100",type:"button","aria-label":"Clear actor filter",onClick:()=>n(""),children:i.jsx(Yt,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),r&&o.length>0?i.jsx("div",{className:"absolute left-0 right-0 z-20 mt-1 max-h-72 overflow-auto rounded-md border border-border bg-white p-1 shadow-lg",children:o.map(c=>i.jsxs("button",{className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-slate-50",type:"button",onMouseDown:u=>u.preventDefault(),onClick:()=>{n(c.login),s(!1)},children:[c.avatar_url?i.jsx("img",{className:"h-6 w-6 shrink-0 rounded-full bg-slate-100",src:Ze(c.avatar_url),alt:`${c.login} avatar`,referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:"h-5 w-5 shrink-0 text-muted","aria-hidden":!0}),i.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:["@",c.login]}),i.jsx("span",{className:"shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold text-muted",children:c.job_count})]},c.login))}):null]})}function Xe({label:e,children:t,className:n}){return i.jsxs("label",{className:W("grid min-w-0 gap-1 text-xs font-semibold text-muted",n),children:[e,t]})}function Sx({jobs:e,loading:t,loadingMore:n=!1,hasMore:r=!1,onLoadMore:s,onViewJob:a,now:o,user:l,onRetry:c,onDismiss:u,onCancel:d}){const[h,m]=A.useState(null),[p,b]=A.useState(null),[w,v]=A.useState(null),y=A.useRef(!1),C=A.useRef(n),_=!!(l!=null&&l.is_admin&&c),N=!!(l!=null&&l.is_admin&&u);A.useEffect(()=>{C.current&&!n&&(y.current=!1),C.current=n},[n]);const F=A.useCallback(()=>{y.current||(y.current=!0,s==null||s())},[s]),j=A.useCallback(async R=>{if(c){m(R);try{await c(R)}finally{m(null)}}},[c]),q=A.useCallback(async R=>{if(u){b(R);try{await u(R)}finally{b(null)}}},[u]),M=A.useCallback(async(R,z)=>{if(d){v(R);try{await d(R,z)}finally{v(null)}}},[d]);return t&&e.length===0?i.jsx(J,{text:"Loading jobs..."}):e.length===0?i.jsx(J,{text:"No jobs match the current filters."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-2 md:hidden",children:[e.map(R=>i.jsx(Ex,{job:R,onViewJob:a,now:o,canRetry:_&&qn(R.status),retrying:h===R.id,onRetry:j,canDismiss:N&&qn(R.status),dismissing:p===R.id,onDismiss:q,canCancel:!!(d&&Fi(R,l)),cancelling:w===R.id,onCancel:M},R.id)),i.jsx(_x,{hasMore:r,loading:n,onLoadMore:F})]}),i.jsx(zi,{noun:"jobs",hasMore:r,loading:n,onLoadMore:F,className:"hidden md:block",children:i.jsxs("table",{className:"min-w-[1080px] table-fixed border-collapse text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[i.jsx("th",{className:"w-[42%] px-3 py-2 font-semibold",children:"Job"}),i.jsx("th",{className:"w-32 px-3 py-2 font-semibold",children:"Status"}),i.jsx("th",{className:"w-40 px-3 py-2 font-semibold",children:"Action"}),i.jsx("th",{className:"w-36 px-3 py-2 font-semibold",children:"Actor"}),i.jsx("th",{className:"w-36 px-3 py-2 font-semibold",children:"Timing"}),i.jsx("th",{className:"w-28 px-3 py-2 font-semibold",children:"Updated"}),i.jsx("th",{className:"w-24 px-3 py-2 text-right font-semibold",children:"Actions"})]})}),i.jsx("tbody",{children:e.map(R=>i.jsx(Cx,{job:R,now:o,onViewJob:a,canRetry:_&&qn(R.status),retrying:h===R.id,onRetry:j,canDismiss:N&&qn(R.status),dismissing:p===R.id,onDismiss:q,canCancel:!!(d&&Fi(R,l)),cancelling:w===R.id,onCancel:M},R.id))})]})})]})}function Cx({job:e,now:t,onViewJob:n,canRetry:r,retrying:s,onRetry:a,canDismiss:o,dismissing:l,onDismiss:c,canCancel:u,cancelling:d,onCancel:h}){return i.jsxs("tr",{className:"cursor-pointer border-b border-border align-top hover:bg-slate-50",onClick:()=>n(e.id),children:[i.jsx("td",{className:"min-w-0 px-3 py-3",children:i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsxs("span",{className:"mt-0.5 shrink-0 font-mono text-xs font-semibold text-muted",children:["#",e.id]}),i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsx("div",{className:"line-clamp-2 text-sm font-semibold leading-snug text-foreground [overflow-wrap:anywhere]",title:e.subject,children:e.subject}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted",children:[i.jsx("span",{className:"min-w-0 max-w-full truncate font-mono",children:e.repo??e.work_key}),i.jsxs("span",{className:"shrink-0",children:["thread ",e.thread??"n/a"]})]})]})]})}),i.jsx("td",{className:"px-3 py-3",children:i.jsx(hs,{status:e.status})}),i.jsxs("td",{className:"px-3 py-3",children:[i.jsx("div",{className:"min-w-0 truncate text-sm text-foreground",title:e.action,children:e.action}),i.jsx("div",{className:"mt-1",children:i.jsx(ds,{intent:e.intent,actionMode:e.action_mode,display:"intent",compact:!0})})]}),i.jsx("td",{className:"px-3 py-3",children:i.jsx(Pn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url})}),i.jsxs("td",{className:"px-3 py-3 text-xs text-muted",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{children:"wait"}),i.jsx("span",{className:"font-mono text-foreground",children:Ke(us(e,t))})]}),i.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[i.jsx("span",{children:"run"}),i.jsx("span",{className:"font-mono text-foreground",children:Ke(cs(e,t))})]}),i.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[i.jsx("span",{children:"tries"}),i.jsx("span",{className:"font-mono text-foreground",children:e.attempts})]})]}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:i.jsx(Pe,{value:e.updated_at,compact:!0,relative:!0,now:t})}),i.jsx("td",{className:"px-3 py-3 text-right",children:i.jsxs("div",{className:"inline-flex items-center gap-1",children:[i.jsx(Wl,{jobId:e.id,canRetry:r,retrying:s,onRetry:a,compact:!0}),i.jsx(Gl,{jobId:e.id,canDismiss:o,dismissing:l,onDismiss:c,compact:!0}),i.jsx(Jl,{jobId:e.id,canCancel:u,cancelling:d,onCancel:h,compact:!0})]})})]})}function _x({hasMore:e,loading:t,onLoadMore:n}){return!e&&!t?null:i.jsxs("button",{className:"inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-md border border-border px-3 py-2 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 md:hidden",type:"button",disabled:t||!e,onClick:()=>n==null?void 0:n(),children:[i.jsx(jn,{className:"h-4 w-4","aria-hidden":!0}),t?"Loading more jobs...":"Load more jobs"]})}function Ex({job:e,onViewJob:t,now:n,canRetry:r,retrying:s,onRetry:a,canDismiss:o,dismissing:l,onDismiss:c,canCancel:u,cancelling:d,onCancel:h}){return i.jsxs("article",{className:"rounded-md border border-border bg-white shadow-[0_1px_0_rgba(15,23,42,0.03)]",children:[i.jsxs("button",{className:"grid w-full gap-2 p-3 text-left hover:bg-slate-50",type:"button",onClick:()=>t(e.id),children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsxs("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-2",children:[i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted",children:["#",e.id]}),i.jsx("span",{className:"truncate font-mono text-sm",children:e.repo??e.work_key})]}),i.jsx("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:e.subject}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted",children:[i.jsxs("span",{children:["thread ",e.thread??"n/a"," · ",e.action]}),i.jsx(ds,{intent:e.intent,actionMode:e.action_mode,compact:!0,display:"intent"}),i.jsx(Pn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url})]})]}),i.jsx(hs,{status:e.status})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[i.jsx(V,{label:"Wait",value:Ke(us(e,n))}),i.jsx(V,{label:"Runtime",value:Ke(cs(e,n))}),i.jsx(V,{label:"Updated",value:i.jsx(Pe,{value:e.updated_at,compact:!0,relative:!0,now:n})})]})]}),r||o||u?i.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-border px-3 py-2",children:[i.jsx(Wl,{jobId:e.id,canRetry:r,retrying:s,onRetry:a}),i.jsx(Gl,{jobId:e.id,canDismiss:o,dismissing:l,onDismiss:c}),i.jsx(Jl,{jobId:e.id,canCancel:u,cancelling:d,onCancel:h})]}):null]})}function Wl({jobId:e,canRetry:t,retrying:n,onRetry:r,compact:s=!1}){if(!t)return null;const a=n?"Retrying...":"Retry";return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",s?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Retry job #${e}`,title:`Retry job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Retry job #${e}?`)&&await r(e)},children:[i.jsx(Gn,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(s&&"sr-only"),children:a})]})}function Gl({jobId:e,canDismiss:t,dismissing:n,onDismiss:r,compact:s=!1}){if(!t)return null;const a=n?"Dismissing...":"Dismiss";return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",s?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Dismiss job #${e}`,title:`Dismiss job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Dismiss job #${e}?`)&&await r(e)},children:[i.jsx(kn,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(s&&"sr-only"),children:a})]})}function Jl({jobId:e,canCancel:t,cancelling:n,onCancel:r,compact:s=!1}){if(!t)return null;const a=n?"Cancelling...":"Cancel";return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-red-200 bg-red-50 text-sm font-semibold text-red-700 hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-60",s?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Cancel job #${e}`,title:`Cancel job #${e}`,onClick:async o=>{o.stopPropagation();const l=window.prompt(`Cancel job #${e}? Optional reason:`);l!==null&&await r(e,l)},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(s&&"sr-only"),children:a})]})}function Pn({actor:e,avatarUrl:t,framed:n=!1}){const r=t?i.jsx("img",{className:"h-4 w-4 shrink-0 rounded-full bg-slate-100",src:Ze(t),alt:e?`${e} avatar`:"",referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),s=i.jsxs(i.Fragment,{children:[r,i.jsx("span",{className:"min-w-0 truncate",children:e?`@${e}`:"unknown actor"})]});return n?i.jsx("span",{className:"inline-flex h-7 max-w-full items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-muted",children:s}):i.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 font-mono text-xs text-muted",children:s})}function Px(e){return(e==null?void 0:e.model)??"OpenClaw default"}function Rx(e){return(e==null?void 0:e.thinking)??"OpenClaw default"}function Ix(e){return e?e.configured?"configured":e.summary:"n/a"}function Tx(e,t){const n=t||(e==="work_allowed"?"fix_allowed":"review_only");return n==="fix_allowed"||!t&&e==="work_allowed"?{mode:n,intentLabel:"work_allowed",title:"Work allowed"}:{mode:n,intentLabel:"review_only",title:"Review only"}}function ds({intent:e,actionMode:t,compact:n=!1,display:r="mode"}){const s=Tx(e,t),a=s.intentLabel==="work_allowed"?fu:Go,o=r==="intent"?s.intentLabel:s.mode;return i.jsxs("span",{className:W("inline-flex min-h-6 max-w-full items-center gap-1.5 rounded-md border px-2 text-xs font-semibold",s.intentLabel==="work_allowed"?"border-blue-200 bg-blue-50 text-blue-700":"border-violet-200 bg-violet-50 text-violet-700",n&&"min-h-5 px-1.5 text-[11px]"),title:`${s.title}: ${s.mode}`,"aria-label":`${s.title}: ${o}`,children:[i.jsx(a,{className:W("h-3.5 w-3.5 shrink-0",n&&"h-3 w-3"),"aria-hidden":!0}),i.jsx("span",{className:"truncate font-mono",children:o})]})}function Ax({job:e,session:t,sessionEvents:n,transcript:r,now:s,compact:a=!1}){var p;const o=En(e.id),l=n??[],c=r??[],u=Sf(l),d=Cf(c),h=cs(e,s),m=us(e,s);return i.jsxs("div",{className:"grid min-w-0 gap-4",children:[i.jsxs("div",{className:"sticky top-0 z-20 -mx-3 -mt-3 grid gap-2 border-b border-border bg-panel/95 px-3 py-2 shadow-sm backdrop-blur sm:-mx-4 sm:-mt-4 sm:px-4","aria-label":"Sticky job header",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx(hs,{status:e.status}),i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:o,children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.id]}),i.jsx(Pn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),i.jsx("span",{className:"min-w-0 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:e.work_key})]}),i.jsxs("div",{className:"grid min-w-0 gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(280px,auto)] lg:items-start",children:[i.jsx("p",{className:"min-w-0 break-words text-sm text-muted [overflow-wrap:anywhere]",children:e.subject}),i.jsxs("div",{className:"grid min-w-0 gap-1",children:[i.jsx("h3",{className:"text-xs font-semibold text-muted",children:"GitHub links"}),e.github_urls.length>0?i.jsx(Xn,{urls:e.github_urls,compact:!0}):i.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]})]})]}),i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",a?"grid-cols-1":"grid-cols-3"),children:[i.jsx(V,{label:"Queue wait",value:Ke(m)}),i.jsx(V,{label:e.status==="running"?"Running for":"Runtime",value:Ke(h)}),i.jsx(V,{label:"Coalesced",value:String(e.coalesced_count)})]}),e.queue_state==="serialized_by_work_key"?i.jsxs("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:["Serialized behind running job #",e.blocked_by_job_id," for this work key."]}):null,i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",a?"grid-cols-1":"grid-cols-3"),children:[i.jsx(V,{label:"Model",value:Px(e.model_route)}),i.jsx(V,{label:"Reasoning",value:Rx(e.model_route)}),i.jsx(V,{label:"Route",value:Ix(e.model_route)})]}),i.jsx(Lx,{job:e,compact:a}),i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",a?"grid-cols-1":"grid-cols-2 xl:grid-cols-4"),children:[i.jsx(V,{label:"Created",value:i.jsx(Pe,{value:e.created_at,compact:!0,relative:!0,now:s})}),i.jsx(V,{label:"Started",value:e.started_at?i.jsx(Pe,{value:e.started_at,compact:!0,relative:!0,now:s}):"n/a"}),i.jsx(V,{label:"Updated",value:i.jsx(Pe,{value:e.updated_at,compact:!0,relative:!0,now:s})}),i.jsx(V,{label:"Finished",value:e.finished_at?i.jsx(Pe,{value:e.finished_at,compact:!0,relative:!0,now:s}):"n/a"})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Timeline"}),i.jsx("div",{className:"grid min-w-0 gap-3",children:(e.worklog??[]).length>0?(p=e.worklog)==null?void 0:p.map(b=>i.jsxs("div",{className:"min-w-0 border-l-2 border-primary pl-3",children:[i.jsx("div",{className:"text-sm font-semibold",children:b.phase}),i.jsx("div",{className:"font-mono text-xs text-muted",children:i.jsx(Pe,{value:b.ts,relative:!0,now:s})}),i.jsx("div",{className:"break-words text-sm [overflow-wrap:anywhere]",children:b.summary}),b.detail?i.jsx("div",{className:"mt-1 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:b.detail}):null]},b.id)):i.jsx(J,{text:"No worklog entries."})})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Xo,{className:"h-4 w-4","aria-hidden":!0}),"OpenClaw session"]}),t?i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[i.jsx(V,{label:"Session ID",value:t.id}),i.jsx(V,{label:"Source",value:t.source})]}),i.jsx("p",{className:"break-words text-xs text-muted [overflow-wrap:anywhere]",children:t.detail})]}):i.jsx(J,{text:"Session correlation is loading."})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Agent activity"}),i.jsx("div",{className:"grid max-h-[460px] min-w-0 gap-2 overflow-auto pr-1",children:u.length>0?u.map((b,w)=>i.jsx(Ox,{event:b,defaultOpen:lo(b.eventType,e.status==="running",w,u.length),now:s},b.id)):i.jsx(J,{text:e.status==="running"?"Waiting for live agent output...":"No agent activity has been recorded for this session."})})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Session transcript"}),i.jsx("div",{className:"grid max-h-[620px] min-w-0 gap-2 overflow-auto pr-1",children:d.length>0?d.map((b,w)=>i.jsx(Mx,{entry:b,defaultOpen:lo(b.kind,e.status==="running",w,d.length),now:s},b.id)):i.jsx(J,{text:e.status==="running"?"Waiting for live transcript entries...":"No OpenClaw transcript entries are available for this session."})})]})]})}function Lx({job:e,compact:t=!1}){const n=e.intent_classifier??null,r=(n==null?void 0:n.llm)??{},s=(n==null?void 0:n.parser)??{},a=typeof r.confidence=="number"?`${Math.round(r.confidence*100)}%`:"n/a";return i.jsxs("div",{className:"grid gap-2",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Action mode"}),i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",t?"grid-cols-1":"grid-cols-2 xl:grid-cols-4"),children:[i.jsx(V,{label:"Mode",value:i.jsx(ds,{intent:e.intent,actionMode:e.action_mode})}),i.jsx(V,{label:"Intent",value:e.intent}),i.jsx(V,{label:"Addressed",value:n?po(r.addressed_to_agent):"n/a"}),i.jsx(V,{label:"Write",value:n?r.write_permission??"none":e.intent==="work_allowed"?"allowed":"none"})]}),n?i.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-panel p-3 text-xs",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(tt,{label:"Classifier",value:n.enabled?"enabled":"disabled"}),i.jsx(tt,{label:"Applied",value:po(r.applied)}),i.jsx(tt,{label:"Confidence",value:a}),i.jsx(tt,{label:"Parser",value:`${s.action??"n/a"} / ${s.work_intent??"n/a"}`})]}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(tt,{label:"LLM",value:`${r.action??"n/a"} / ${r.work_intent??"n/a"}`}),i.jsx(tt,{label:"Scope",value:r.scope||"n/a"})]}),r.main_request?i.jsx(tt,{label:"Main request",value:r.main_request}):null,r.subordinate_reason?i.jsx(tt,{label:"Subordinate reason",value:r.subordinate_reason}):null,r.reason?i.jsx(tt,{label:"Reason",value:r.reason}):null,n.error?i.jsx(tt,{label:"Error",value:n.error,tone:"danger"}):null]}):i.jsx("p",{className:"text-xs text-muted",children:"No intent classifier metadata recorded for this job."})]})}function po(e){return e===!0?"yes":e===!1?"no":"n/a"}function tt({label:e,value:t,tone:n="neutral"}){return i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:e}),i.jsx("div",{className:W("mt-0.5 min-w-0 break-words font-mono text-xs [overflow-wrap:anywhere]",n==="danger"?"text-red-700":"text-foreground"),children:t})]})}function Mx({entry:e,defaultOpen:t,now:n}){return i.jsx(Xl,{badge:e.badge,meta:i.jsx(Pe,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:i.jsx("pre",{className:"max-h-72 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.text})})}function Ox({event:e,defaultOpen:t,now:n}){return i.jsx(Xl,{badge:e.badge,meta:i.jsx(Pe,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:e.detail?i.jsx("pre",{className:"max-h-56 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.detail}):null})}function Xl({badge:e,meta:t,count:n,summary:r,defaultOpen:s,children:a}){const[o,l]=A.useState(!!s);return i.jsxs("details",{className:"group min-w-0 rounded border border-border bg-slate-50/60",open:o,onToggle:c=>l(c.currentTarget.open),children:[i.jsxs("summary",{className:"grid cursor-pointer list-none gap-1 px-2 py-1.5 marker:hidden hover:bg-white",children:[i.jsxs("div",{className:"grid min-w-0 gap-1 sm:flex sm:items-center sm:justify-between sm:gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx(jn,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),i.jsx("span",{className:"truncate font-mono text-[11px] font-semibold text-muted",children:e}),n&&n>1?i.jsx("span",{className:"rounded-sm border border-border px-1 font-mono text-[10px] text-muted",children:n}):null]}),i.jsx("span",{className:"min-w-0 truncate pl-5 font-mono text-[11px] text-muted sm:shrink-0 sm:pl-0",children:t})]}),i.jsx("div",{className:"min-w-0 break-words pl-5 text-xs text-foreground [overflow-wrap:anywhere] sm:truncate",children:r})]}),i.jsx("div",{className:"min-w-0 border-t border-border bg-white px-2 py-2",children:a})]})}function mo({label:e,values:t}){const n=[{name:"median",seconds:(t==null?void 0:t.median)??0},{name:"p90",seconds:(t==null?void 0:t.p90)??0},{name:"p99",seconds:(t==null?void 0:t.p99)??0}];return i.jsx("div",{className:"h-56",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:n,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"name"}),i.jsx(ar,{tickFormatter:Ke}),i.jsx(or,{formatter:r=>[Ke(Number(r)),e]}),i.jsx(Wt,{dataKey:"seconds",fill:"#0969da",radius:[4,4,0,0]})]})})})}function Dx({values:e,loading:t,totalJobs:n}){const r=Object.entries(e??{}).map(([s,a])=>({day:s,count:a}));return t&&r.length===0?i.jsx(J,{text:"Loading job history..."}):r.length===0?i.jsx(J,{text:n>0?"Job history has no valid creation dates.":"No job history available."}):i.jsx("div",{className:"h-56",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:r,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"day",minTickGap:16}),i.jsx(ar,{allowDecimals:!1}),i.jsx(or,{formatter:s=>[Number(s),"jobs"]}),i.jsx(Wt,{dataKey:"count",fill:"#16a34a",radius:[4,4,0,0]})]})})})}function Fx({usage:e,loading:t,totalJobs:n}){const[r,s]=A.useState("day"),a=(e==null?void 0:e[r])??[],o=a.map(u=>({...u,label:zx(u.bucket,r)})),l=a.reduce((u,d)=>u+d.seconds,0),c=a.reduce((u,d)=>u+(d.runs??d.jobs),0);return t&&o.length===0?i.jsx(J,{text:"Loading runtime usage..."}):o.length===0?i.jsx(J,{text:n>0?"No jobs have recorded runtime yet.":"No job history available."}):i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted",children:[i.jsx(mu,{className:"h-4 w-4","aria-hidden":!0}),i.jsxs("span",{children:[Er(l)," consumed across ",c," run",c===1?"":"s"]})]}),i.jsx("div",{className:"inline-flex h-8 rounded-md border border-border bg-white p-0.5","aria-label":"Runtime grouping",children:["day","month"].map(u=>i.jsx("button",{className:W("rounded px-2.5 text-xs font-semibold capitalize",r===u?"bg-primary text-white":"text-muted hover:bg-slate-50"),type:"button",onClick:()=>s(u),children:u},u))})]}),i.jsx("div",{className:"h-64",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:o,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"label",minTickGap:16,tick:{fontSize:11}}),i.jsx(ar,{tickFormatter:u=>Er(Number(u))}),i.jsx(Po,{}),i.jsx(or,{formatter:(u,d)=>d==="Work"?[Er(Number(u)),"work"]:d==="Review"?[Er(Number(u)),"review"]:[Number(u),String(d)],labelFormatter:u=>String(u)}),i.jsx(Wt,{dataKey:"work_seconds",name:"Work",stackId:"runtime",fill:"#0969da",isAnimationActive:!1}),i.jsx(Wt,{dataKey:"review_seconds",name:"Review",stackId:"runtime",fill:"#8250df",radius:[4,4,0,0],isAnimationActive:!1})]})})})]})}function zx(e,t){if(t==="month"){const[a,o]=e.split("-").map(Number);return!a||!o?e:new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric"}).format(new Date(a,o-1,1))}const[n,r,s]=e.split("-").map(Number);return!n||!r||!s?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(n,r-1,s))}function Er(e){const t=Math.max(0,Math.round(e));if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60),s=n%60;return s===0?`${r}h`:`${r}h ${s}m`}function fo(e){return Object.values(e).reduce((t,n)=>t+n,0)}function qx({data:e,loading:t}){if(t&&!e)return i.jsx(J,{text:"Loading systemd units..."});if(!e)return i.jsx(J,{text:"No systemd snapshot available."});const n=e.units??[],r=n.filter(o=>o.active_state==="active").length,s=n.filter(o=>o.active_state==="failed"||o.result==="failed").length,a=n.filter(o=>o.kind==="timer").length;return i.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.errors.length>0?i.jsx(we,{tone:"error",text:e.errors[0]}):null,n.length===0?i.jsx(J,{text:"No configured bridge units found."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[i.jsx(Pr,{label:"Units",value:String(n.length)}),i.jsx(Pr,{label:"Active",value:String(r)}),i.jsx(Pr,{label:"Failed",value:String(s),tone:s>0?"bad":"neutral"}),i.jsx(Pr,{label:"Timers",value:String(a)})]}),i.jsxs("div",{className:"overflow-hidden rounded-md border border-border bg-white",children:[i.jsxs("div",{className:"hidden grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] gap-3 border-b border-border bg-slate-50 px-3 py-2 text-[11px] font-semibold uppercase text-muted md:grid",children:[i.jsx("span",{children:"Unit"}),i.jsx("span",{children:"Status"}),i.jsx("span",{children:"State"}),i.jsx("span",{children:"PID"}),i.jsx("span",{children:"Schedule"})]}),i.jsx("div",{className:"divide-y divide-border",children:n.map(o=>i.jsx(Bx,{unit:o},o.unit))})]})]})]})}function Pr({label:e,value:t,tone:n="neutral"}){return i.jsxs("div",{className:W("min-w-0 rounded-md border bg-white px-3 py-2",n==="bad"?"border-red-200":"border-border"),children:[i.jsx("div",{className:W("font-mono text-lg font-semibold",n==="bad"?"text-red-700":"text-foreground"),children:t}),i.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function Bx({unit:e}){const[t,n]=A.useState(!1),r=e.active_state==="active",s=e.active_state==="failed"||e.result==="failed",a=e.next_elapse||e.last_trigger||"n/a";return i.jsxs("details",{className:"group min-w-0",open:t,onToggle:o=>n(o.currentTarget.open),children:[i.jsxs("summary",{className:"grid min-w-0 cursor-pointer list-none grid-cols-2 gap-2 px-3 py-3 text-sm marker:hidden hover:bg-slate-50 md:grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] md:items-center md:gap-3",children:[i.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(jn,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),i.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:e.unit})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 pl-5 text-[11px] font-semibold uppercase text-muted",children:[i.jsx("span",{children:e.role}),i.jsx("span",{children:e.kind}),i.jsx("span",{children:e.load_state}),i.jsx("span",{children:t?"following log":"expand log"})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:block",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Status"}),i.jsx("span",{className:W("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",s?"border-red-300 bg-red-50 text-red-700":r?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-slate-50 text-slate-700"),children:e.active_state})]}),i.jsx(xo,{label:"State",value:e.sub_state,detail:e.result||"unknown"}),i.jsx(xo,{label:"PID",value:e.main_pid?String(e.main_pid):"n/a",detail:Ke(e.uptime_seconds)}),i.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Schedule"}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:a,children:e.next_elapse?`next ${e.next_elapse}`:a})]})]}),i.jsx("div",{className:"border-t border-border bg-slate-50 px-3 pb-3 pt-2",children:i.jsx(Ux,{unit:e.unit,active:t})})]})}function xo({label:e,value:t,detail:n}){return i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:e}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:t}),n?i.jsx("div",{className:"truncate font-mono text-[11px] text-muted",children:n}):null]})}function Ux({unit:e,active:t}){const[n,r]=A.useState([]),[s,a]=A.useState(""),o=A.useRef(null);return A.useEffect(()=>{if(!t){r([]),a("");return}r([]),a("");const l=new EventSource(`/api/systemd/journal/stream?unit=${encodeURIComponent(e)}`);return l.addEventListener("journal_line",c=>{const u=zr(c);u&&r(d=>[...d.slice(-199),u])}),l.addEventListener("journal_error",c=>{const u=zr(c);a((u==null?void 0:u.error)??"journal stream failed")}),l.onerror=()=>{},()=>l.close()},[t,e]),A.useEffect(()=>{const l=o.current;l&&(l.scrollTop=l.scrollHeight)},[n]),i.jsxs("div",{className:"grid min-w-0 gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:"Live journal"}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted",children:n.length>0?`${n.length} lines streamed`:"waiting for journal output"})]}),i.jsx("div",{className:"font-mono text-[11px] text-muted",children:"journalctl -f"})]}),s?i.jsx(we,{tone:"error",text:s}):null,i.jsx("div",{ref:o,className:"h-72 overflow-auto rounded-md border border-slate-800 bg-slate-950 p-3 font-mono text-xs leading-relaxed text-slate-100",children:n.length>0?n.map((l,c)=>i.jsx("div",{className:"break-words [overflow-wrap:anywhere]",children:l.line},`${l.unit}-${c}`)):i.jsx("div",{className:"text-slate-400",children:"No journal lines received yet."})})]})}function $x({data:e,loading:t}){var h,m,p,b,w,v;if(t&&!e)return i.jsx(J,{text:"Loading process activity..."});if(!e)return i.jsx(J,{text:"No process snapshot available."});const n=e.executor.children??[],r=n.flatMap(y=>Zl(y)),s=r.reduce((y,C)=>y+C.cpu_ticks,0),a=r.reduce((y,C)=>y+Kx(C),0),o=e.executor.service==="active",l=r.slice(0,8).map(y=>({label:`pid ${y.pid}`,ticks:y.cpu_ticks})),c=(e.samples??[]).map(y=>({label:Hn(y.ts),ticks:y.cpu_ticks,io:y.io_bytes,active:y.active_since_last_sample?"active":"quiet"})),u=c.length>0?c:l,d=(h=e.samples)==null?void 0:h[e.samples.length-1];return i.jsxs("div",{className:"grid gap-4",children:[i.jsx("div",{className:"rounded-md border border-slate-200 bg-slate-50 p-3",children:i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:W("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-white text-slate-600"),children:o?"active":"idle"}),i.jsxs("span",{className:"font-mono text-xs text-muted",children:["service ",e.executor.service]})]}),i.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:e.running_jobs.length>0?`${e.running_jobs.length} running job${e.running_jobs.length===1?"":"s"}`:"No running jobs"}),e.running_jobs.length>0?i.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.running_jobs.slice(0,4).map(y=>i.jsxs("span",{className:"inline-flex min-h-6 items-center gap-1.5 rounded-full border border-blue-200 bg-white px-2 font-mono text-[11px] font-semibold text-blue-700",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-600 animate-live-pulse","aria-hidden":!0}),"#",y.id," ",Ke(y.age_seconds)]},y.id))}):null,d?i.jsxs("p",{className:"mt-1 text-xs text-muted",children:["Last persisted sample ",Hn(d.ts)," · ",d.active_since_last_sample?"activity observed":`quiet ${Ke(d.idle_seconds)}`]}):null,i.jsx("p",{className:"mt-1 text-xs text-muted",children:e.detail})]}),i.jsxs("div",{className:"grid min-w-[190px] grid-cols-3 gap-2 text-center text-xs",children:[i.jsx(ci,{label:"PID",value:e.executor.pid?String(e.executor.pid):"n/a"}),i.jsx(ci,{label:"Children",value:String(r.length)}),i.jsx(ci,{label:"CPU ticks",value:String(s)})]})]})}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Rr,{label:"Live process",value:((m=e.signals)==null?void 0:m.live_process.state)??(r.length>0?"live":"no_child_process"),detail:`${((p=e.signals)==null?void 0:p.live_process.child_count)??r.length} children`}),i.jsx(Rr,{label:"Process activity",value:((b=e.signals)==null?void 0:b.process_activity.state)??(d!=null&&d.active_since_last_sample?"active":"quiet"),detail:d?`sample ${Hn(d.ts)}`:"no sample"}),i.jsx(Rr,{label:"Semantic progress",value:(w=e.signals)!=null&&w.semantic_progress.length?"recent":"none",detail:go(e.running_jobs,"semantic_progress")}),i.jsx(Rr,{label:"Visible progress",value:(v=e.signals)!=null&&v.visible_progress.length?"streaming":"none",detail:go(e.running_jobs,"visible_progress")})]}),e.alerts.length>0?i.jsx(we,{tone:"error",text:e.alerts[0]}):null,i.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[i.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[i.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(wa,{className:"h-4 w-4","aria-hidden":!0}),c.length>0?"CPU history":"CPU ticks"]}),i.jsxs("span",{className:"font-mono text-xs text-muted",children:[ec(a)," I/O"]})]}),u.length>0?i.jsx("div",{className:"h-40",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(fc,{data:u,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"label",tick:!1}),i.jsx(ar,{allowDecimals:!1,tick:{fontSize:11}}),i.jsx(or,{formatter:y=>[Number(y),"cpu ticks"]}),i.jsx(xc,{type:"monotone",dataKey:"ticks",stroke:"#0f766e",strokeWidth:2,dot:{r:3},activeDot:{r:5},isAnimationActive:!1})]})})}):i.jsx(J,{text:"No executor CPU samples available."})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[i.jsx(wa,{className:"h-4 w-4","aria-hidden":!0}),"Executor children"]}),n.length>0?i.jsx("div",{className:"grid gap-2",children:n.map(y=>i.jsx(Yl,{process:y},y.pid))}):i.jsx(J,{text:"No child process detected for the executor."})]})]})]})}function Hx({alerts:e,loading:t,now:n}){if(t&&!e)return i.jsx(J,{text:"Loading monitor alerts..."});const r=e??[];return r.length===0?i.jsx(J,{text:"No active monitor alerts."}):i.jsx("div",{className:"grid gap-2",children:r.slice(0,5).map(s=>i.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 p-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-red-700",children:[i.jsx(Br,{className:"h-3.5 w-3.5","aria-hidden":!0}),i.jsx("span",{children:s.severity}),i.jsx("span",{className:"font-normal text-red-600",children:zl(s.last_seen,n)}),s.observations>1?i.jsxs("span",{className:"rounded-full border border-red-200 bg-white px-1.5",children:[s.observations,"x"]}):null]}),i.jsx("p",{className:"mt-1 break-words text-sm font-medium text-red-950 [overflow-wrap:anywhere]",children:s.message})]},s.fingerprint))})}function Yl({process:e}){var r,s;const t=((r=e.io_bytes)==null?void 0:r.read_bytes)??0,n=((s=e.io_bytes)==null?void 0:s.write_bytes)??0;return i.jsxs("div",{className:"rounded-md border border-border bg-white p-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[i.jsxs("span",{className:"font-mono",children:["pid ",e.pid]}),i.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["state ",e.state]}),i.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["cpu ",e.cpu_ticks]}),i.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["I/O ",ec(t+n)]})]}),i.jsx("div",{className:"mt-2 break-words font-mono text-xs text-muted",children:e.cmd||"unknown command"}),e.children&&e.children.length>0?i.jsx("div",{className:"mt-3 border-l-2 border-border pl-3",children:e.children.map(a=>i.jsx(Yl,{process:a},a.pid))}):null]})}function ci({label:e,value:t}){return i.jsxs("div",{className:"rounded-md border border-border bg-white px-2 py-2",children:[i.jsx("div",{className:"font-mono text-sm font-semibold text-foreground",children:t}),i.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function Rr({label:e,value:t,detail:n}){return i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-2.5",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:e}),i.jsx("div",{className:"mt-1 truncate text-sm font-semibold text-foreground",children:t}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted",children:n})]})}function go(e,t){const n=e.find(s=>s[t]),r=n==null?void 0:n[t];return!n||!r?"no running heartbeat":`#${n.id} ${r.phase} ${Ke(r.age_seconds??null)}`}function Zl(e){return[e,...(e.children??[]).flatMap(t=>Zl(t))]}function Kx(e){var t,n;return(((t=e.io_bytes)==null?void 0:t.read_bytes)??0)+(((n=e.io_bytes)==null?void 0:n.write_bytes)??0)}function ec(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function V({label:e,value:t}){return i.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[i.jsx("div",{className:"text-xs font-semibold text-muted",children:e}),i.jsx("div",{className:"mt-1 min-w-0 break-words text-sm [overflow-wrap:anywhere]",children:t})]})}function hs({status:e}){const t=_f(e),n=e==="running"||e==="pending";return i.jsxs("span",{className:W("inline-flex min-h-6 items-center gap-1.5 rounded-full border px-2 text-xs font-semibold",t.badge),children:[i.jsx("span",{className:W("h-2.5 w-2.5 rounded-full",t.dot,n&&"animate-live-pulse"),"aria-hidden":!0}),e]})}function J({text:e}){return i.jsx("div",{className:"rounded-md border border-dashed border-border p-6 text-center text-sm text-muted",children:e})}function we({tone:e,text:t}){return i.jsx("div",{className:W("rounded-md border p-3 text-sm",e==="error"&&"border-red-300 bg-red-50 text-red-700",e==="warning"&&"border-amber-300 bg-amber-50 text-amber-800"),children:t})}function Ye({onClick:e,compactOnMobile:t=!1}){return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50",t?"w-8 px-0 sm:w-auto sm:px-3":"px-3"),onClick:e,type:"button","aria-label":"Refresh",children:[i.jsx(cr,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(t&&"hidden sm:inline"),children:"Refresh"})]})}const bo=document.getElementById("root");bo&&vc.createRoot(bo).render(i.jsx(A.StrictMode,{children:i.jsx(Gc,{client:xf,children:i.jsx(Vf,{})})})); +}`;return i.jsxs(le,{title:"Connect an agent",children:[s?i.jsx(ve,{tone:"warning",text:"Set GITHUB_AGENT_BRIDGE_DASHBOARD_PUBLIC_URL, or forward X-Forwarded-* headers from the proxy, before connecting remote agents."}):null,i.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"grid min-w-0 gap-3",children:[i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm font-semibold",children:[i.jsx(Xt,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Public dashboard URL",i.jsx("span",{className:"rounded-sm border border-border bg-slate-50 px-1.5 py-0.5 font-mono text-[11px] font-normal text-muted",children:r})]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Share this page URL with bridge admins only after it resolves to the external dashboard origin."}),i.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:a})]}),i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Xt,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"HTTP MCP endpoint"]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Remote agents connect directly with a bearer token; no local `gab` binary is required on the agent host."}),i.jsx("pre",{className:"mt-3 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs text-slate-100",children:o})]})]}),i.jsxs("div",{className:"grid min-w-0 gap-3",children:[i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Lr,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent config"]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Create a token below, then store the one-time secret as `GITHUB_AGENT_BRIDGE_MCP_TOKEN` for the agent."}),i.jsx("pre",{className:"mt-3 max-h-64 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:c})]}),i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Vi,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Agent prompt"]}),i.jsx("p",{className:"mt-1 text-xs text-muted",children:"Ask the agent to use the read-only bridge knowledge server before acting on repository work."}),i.jsx("pre",{className:"mt-3 max-h-40 overflow-auto rounded-md bg-slate-950 px-3 py-2 font-mono text-xs leading-relaxed text-slate-100",children:"Use the github-agent-bridge MCP server for repository knowledge. Query list_repositories and list_knowledge before making repository decisions."})]})]})]})]})}function Kl({icon:e,title:t,subtitle:n,action:r}){return i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e,t]}),i.jsx("p",{className:"text-xs text-muted",children:n})]}),r]})}function gx({tokens:e,loading:t,now:n,ownerOptions:r,canManageOwners:s,revokingId:a,updatingOwnerId:o,onUpdateOwner:l,onRevoke:c}){return t&&e.length===0?i.jsx(J,{text:"Loading MCP tokens..."}):e.length===0?i.jsx(J,{text:"No active MCP tokens."}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"grid gap-2 md:hidden",children:e.map(u=>i.jsxs("article",{className:"grid min-w-0 gap-3 rounded-md border border-border bg-white p-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"break-words text-sm font-semibold [overflow-wrap:anywhere]",children:u.name}),i.jsx("div",{className:"mt-1 break-all font-mono text-xs text-muted",children:u.id}),s?i.jsx(ho,{token:u,ownerOptions:r,disabled:o===u.id,onUpdateOwner:l}):u.user_login?i.jsxs("div",{className:"mt-1 text-xs text-muted",children:["Owner: @",u.user_login]}):null]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[i.jsx(V,{label:"Created",value:i.jsx(ue,{value:u.created_at,relative:!0,now:n})}),i.jsx(V,{label:"Last used",value:u.last_used_at?i.jsx(ue,{value:u.last_used_at,relative:!0,now:n}):"never"})]}),i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:a===u.id,onClick:()=>c(u.id),children:[i.jsx(Si,{className:"h-4 w-4","aria-hidden":!0}),a===u.id?"Revoking...":"Revoke"]})]},u.id))}),i.jsx("div",{className:"hidden overflow-auto rounded-md border border-border md:block",children:i.jsxs("table",{className:"min-w-full border-collapse text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border bg-slate-50 text-left text-xs text-muted",children:[i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Name"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Owner"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Created"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Last used"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"ID"}),i.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Actions"})]})}),i.jsx("tbody",{children:e.map(u=>i.jsxs("tr",{className:"border-b border-border last:border-b-0",children:[i.jsx("td",{className:"px-3 py-3 font-semibold",children:u.name}),i.jsx("td",{className:"px-3 py-3 text-xs text-muted",children:s?i.jsx(ho,{token:u,ownerOptions:r,disabled:o===u.id,onUpdateOwner:l}):u.user_login?`@${u.user_login}`:"unassigned"}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:i.jsx(ue,{value:u.created_at,relative:!0,now:n})}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:u.last_used_at?i.jsx(ue,{value:u.last_used_at,relative:!0,now:n}):"never"}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs text-muted",children:u.id}),i.jsx("td",{className:"px-3 py-3 text-right",children:i.jsxs("button",{className:"inline-flex h-8 items-center gap-2 rounded-md border border-red-200 px-3 text-sm font-semibold text-red-700 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60",type:"button",disabled:a===u.id,onClick:()=>c(u.id),children:[i.jsx(Si,{className:"h-4 w-4","aria-hidden":!0}),a===u.id?"Revoking...":"Revoke"]})})]},u.id))})]})})]})}function ho({token:e,ownerOptions:t,disabled:n,onUpdateOwner:r}){const s=e.user_login??"";return i.jsx(Ql,{ariaLabel:`Owner for ${e.name}`,value:s,ownerOptions:t,disabled:n||t.length===0,emptyLabel:"Select owner",size:"compact",onChange:a=>{!a||a===e.user_login||r(e.id,a)}})}function Ql({value:e,ownerOptions:t,disabled:n,onChange:r,ariaLabel:s,selectedSuffix:a,emptyLabel:o,size:l="default"}){const c=t.find(d=>d.login===e),u=c?`@${c.login}${(a==null?void 0:a(c))??""}`:o;return i.jsxs("div",{className:W("relative flex min-w-0 items-center gap-2 rounded-md border border-border bg-panel text-foreground focus-within:border-primary focus-within:ring-1 focus-within:ring-primary",n?"opacity-60":"",l==="compact"?"h-8 w-44 max-w-full px-2":"h-9 w-full px-2.5"),children:[i.jsx("span",{className:W("pointer-events-none flex shrink-0 items-center justify-center",l==="compact"?"h-5 w-5":"h-6 w-6"),children:c!=null&&c.avatar_url?i.jsx("img",{className:"h-full w-full rounded-full bg-slate-100",src:Ze(c.avatar_url),alt:"",referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:W("text-muted",l==="compact"?"h-4 w-4":"h-5 w-5"),"aria-hidden":!0})}),i.jsx("span",{className:W("pointer-events-none min-w-0 flex-1 truncate font-mono",c?"text-foreground":"text-muted",l==="compact"?"text-xs":"text-sm"),children:u}),i.jsxs("select",{className:"absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed","aria-label":s,value:e,disabled:n,onChange:d=>r(d.target.value),children:[t.length===0||!e?i.jsx("option",{value:"",children:o}):null,t.map(d=>i.jsxs("option",{value:d.login,children:["@",d.login,(a==null?void 0:a(d))??""]},d.login))]}),i.jsx(jn,{className:W("pointer-events-none shrink-0 text-muted",l==="compact"?"h-3.5 w-3.5":"h-4 w-4"),"aria-hidden":!0})]})}function Xn({urls:e,compact:t=!1}){const n=t?e.slice(0,2):e,r=e.length-n.length;return i.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap gap-1.5",children:[n.map(s=>i.jsxs("a",{className:W("inline-flex max-w-full items-center gap-1 rounded-md border border-border font-semibold text-primary hover:bg-white hover:underline",t?"h-7 px-2 text-xs":"min-h-7 px-2 py-1 text-xs"),href:Ze(s),"aria-label":s,rel:"noreferrer",target:"_blank",children:[i.jsx(Xt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i.jsx("span",{className:"truncate",children:t?bx(s):s})]},s)),r>0?i.jsxs("span",{className:"inline-flex h-7 items-center rounded-md border border-border px-2 font-mono text-xs text-muted",children:["+",r]}):null]})}function bx(e){try{const t=new URL(e);return t.pathname.replace(/^\//,"")+t.hash}catch{return e}}function Vl({scope:e,type:t,confidence:n,status:r,timestamp:s,now:a}){return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-muted",children:[i.jsx("span",{className:"truncate font-mono font-semibold text-foreground",children:Ul(e)}),i.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:t}),i.jsxs("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:[Math.round(n*100),"%"]}),i.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 font-mono",children:r}),i.jsx("span",{className:"font-mono",children:i.jsx(ue,{value:s,relative:!0,now:a})})]})}function yx({user:e,loading:t}){const n=e!=null&&e.login?`@${e.login}`:t?"Loading profile...":"GitHub OAuth",r=e!=null&&e.is_admin?"admin":"read-only",s=e!=null&&e.avatar_url?i.jsx("img",{className:"h-10 w-10 rounded-full border border-slate-700 bg-slate-800",src:e.avatar_url,alt:e.login?`${e.login} avatar`:"",referrerPolicy:"no-referrer"}):i.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-slate-700 bg-slate-900",children:i.jsx(Wn,{className:"h-5 w-5","aria-hidden":!0})}),a=e!=null&&e.html_url?i.jsx("a",{className:"truncate font-semibold text-white hover:underline",href:Ze(e.html_url),rel:"noreferrer",target:"_blank",children:n}):i.jsx("div",{className:"truncate font-semibold text-white",children:n});return i.jsxs("div",{className:"flex max-w-full shrink-0 items-center gap-3 text-sm text-slate-300","aria-label":e!=null&&e.login?`Signed in as ${e.login}`:"Dashboard account",children:[i.jsx(Jo,{className:"hidden h-4 w-4 shrink-0 sm:block","aria-hidden":!0}),i.jsxs("div",{className:"hidden min-w-0 text-right sm:block",children:[a,i.jsxs("div",{className:"text-xs text-slate-400",children:["Signed in · ",r]})]}),s]})}function wx({config:e,loading:t,onEnable:n,onDisable:r}){const[s,a]=A.useState(!1),[o,l]=A.useState(""),c=!!(e!=null&&e.status.enabled),u=typeof navigator<"u"&&typeof window<"u"&&Tr(),d=t||s||!(e!=null&&e.configured)||!u,h=u?e!=null&&e.configured?c?"Disable notifications":"Enable notifications":"Notifications not configured":"Notifications unavailable";return i.jsx("div",{className:"relative",children:i.jsx("button",{className:W("inline-flex h-9 w-9 items-center justify-center rounded-md border text-sm font-semibold",c?"border-emerald-400 bg-emerald-50 text-emerald-700":"border-slate-700 bg-slate-900 text-slate-200",d&&"cursor-not-allowed opacity-60"),type:"button","aria-label":h,title:o||h,disabled:d,onClick:async()=>{a(!0),l("");try{c?await r():await n()}catch(m){l(m instanceof Error?m.message:String(m))}finally{a(!1)}},children:i.jsx(Vo,{className:W("h-4 w-4",s&&"animate-live-pulse"),"aria-hidden":!0})})})}function vx({notification:e,onDismiss:t,onNavigate:n}){if(!e)return null;const r=e.title||"GitHub Agent Bridge",s=e.body||e.summary||"Bridge job finished",a=e.url||e.job_url||(e.job_id?En(e.job_id):"/"),o=a.startsWith("/");return i.jsx("aside",{className:"fixed right-3 top-20 z-50 w-[min(calc(100vw-1.5rem),28rem)] rounded-md border border-emerald-300 bg-white shadow-xl shadow-slate-950/15","aria-live":"assertive","aria-label":"Bridge notification",children:i.jsxs("div",{className:"flex items-start gap-3 p-3",children:[i.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-emerald-50 text-emerald-700",children:i.jsx(Vo,{className:"h-4 w-4","aria-hidden":!0})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsx("h2",{className:"min-w-0 break-words text-sm font-semibold text-foreground",children:r}),i.jsx("button",{className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted hover:bg-slate-100 hover:text-foreground",type:"button","aria-label":"Dismiss notification",onClick:t,children:i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0})})]}),i.jsx("p",{className:"mt-1 min-w-0 break-words text-sm text-muted",children:s}),e.detail?i.jsx("p",{className:"mt-1 line-clamp-2 min-w-0 break-words text-xs text-muted",children:e.detail}):null,i.jsxs("button",{className:"mt-3 inline-flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-semibold text-foreground hover:bg-slate-50",type:"button",onClick:()=>{t(),o?n(a):window.open(Ze(a),"_blank","noopener,noreferrer")},children:[i.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Open"]})]})]})})}function jx({count:e,limit:t,loading:n,onRefresh:r}){return i.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-white px-3 py-3 shadow-sm md:px-4",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h2",{className:"text-base font-semibold",children:"Jobs"}),i.jsx("p",{className:"text-xs text-muted",children:n?"Refreshing latest jobs...":`Showing ${e} of the latest ${t} requested jobs`})]}),i.jsx(Ye,{onClick:r,compactOnMobile:!0})]})}function le({title:e,action:t,children:n,className:r,flushHeader:s=!1}){return i.jsxs("section",{className:W("min-w-0 rounded-lg border border-border bg-panel p-4 shadow-sm",r),children:[i.jsxs("div",{className:W("flex flex-wrap items-center justify-between gap-3",!s&&"mb-4"),children:[i.jsx("h2",{className:"text-sm font-semibold",children:e}),t]}),n]})}function Ce({title:e,value:t,icon:n}){return i.jsxs("div",{className:"rounded-lg border border-border bg-panel p-3 shadow-sm md:p-4",children:[i.jsxs("div",{className:"flex items-center justify-between text-muted",children:[i.jsx("span",{className:"text-sm font-medium",children:e}),n]}),i.jsx("strong",{className:"mt-3 block text-2xl leading-none md:mt-4 md:text-3xl",children:t})]})}function kx({filters:e,actorOptions:t,onChange:n}){const[r,s]=A.useState(e);A.useEffect(()=>s(e),[e]);const a=Qf(e),o=uo(e)||uo(r),l=()=>{s(Di),n(Di)};return i.jsxs("details",{className:"my-3 rounded-md border border-border bg-slate-50/70",children:[i.jsxs("summary",{className:"grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 text-sm font-semibold marker:hidden",children:[i.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",children:[i.jsx(cu,{className:"h-4 w-4 text-muted","aria-hidden":!0}),"Filters"]}),a.length>0?i.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5","aria-label":"Applied filters",children:a.map(c=>i.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-full border border-blue-200 bg-blue-50 px-2 py-0.5 text-xs font-semibold text-blue-700",children:[i.jsx("span",{className:"text-blue-700/70",children:c.label}),i.jsx("span",{className:"max-w-40 truncate font-mono",children:c.value.trim()})]},c.key))}):null]}),i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",children:[o?i.jsxs("button",{className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-md border border-border bg-white px-2.5 text-xs font-semibold text-foreground hover:bg-slate-50",type:"button",onClick:c=>{c.preventDefault(),c.stopPropagation(),l()},children:[i.jsx(Gn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Clear filters"]}):null,i.jsx(jn,{className:"h-4 w-4 text-muted","aria-hidden":!0})]})]}),i.jsxs("form",{className:"grid gap-3 border-t border-border bg-white p-3 md:grid-cols-3 xl:grid-cols-9",onSubmit:c=>{c.preventDefault(),n(r)},children:[i.jsx(Xe,{label:"Status",children:i.jsxs("select",{className:"control",value:r.status,onChange:c=>s({...r,status:c.target.value}),children:[i.jsx("option",{value:"",children:"All"}),i.jsx("option",{value:"pending",children:"pending"}),i.jsx("option",{value:"running",children:"running"}),i.jsx("option",{value:"blocked",children:"blocked"}),i.jsx("option",{value:"done",children:"done"}),i.jsx("option",{value:"denied",children:"denied"}),i.jsx("option",{value:"waiting_approval",children:"waiting_approval"})]})}),i.jsx(Xe,{label:"Repository",children:i.jsx("input",{className:"control",value:r.repo,placeholder:"owner/repo",onChange:c=>s({...r,repo:c.target.value})})}),i.jsx(Xe,{label:"Thread",children:i.jsx("input",{className:"control",value:r.thread,inputMode:"numeric",placeholder:"issue or PR",onChange:c=>s({...r,thread:c.target.value})})}),i.jsx(Xe,{label:"Action",children:i.jsx("input",{className:"control",value:r.action,placeholder:"reply_comment",onChange:c=>s({...r,action:c.target.value})})}),i.jsx(Xe,{label:"Actor",className:"xl:col-span-2",children:i.jsx(Nx,{value:r.actor,options:t,onChange:c=>s({...r,actor:c})})}),i.jsx(Xe,{label:"Intent",children:i.jsxs("select",{className:"control",value:r.intent,onChange:c=>s({...r,intent:c.target.value}),children:[i.jsx("option",{value:"",children:"All"}),i.jsx("option",{value:"review_only",children:"review_only"}),i.jsx("option",{value:"work_allowed",children:"work_allowed"})]})}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 self-end xl:col-span-2",children:[i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md border border-border px-3 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-white",type:"button",disabled:!o,onClick:l,children:[i.jsx(Gn,{className:"h-4 w-4","aria-hidden":!0}),"Clear"]}),i.jsxs("button",{className:"inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-semibold text-white",type:"submit",children:[i.jsx(pu,{className:"h-4 w-4","aria-hidden":!0}),"Apply"]})]})]})]})}function Nx({value:e,options:t,onChange:n}){const[r,s]=A.useState(!1),a=e.trim().replace(/^@/,"").toLowerCase(),o=t.filter(c=>!a||c.login.toLowerCase().includes(a)).slice(0,8),l=t.find(c=>c.login.toLowerCase()===a);return i.jsxs("div",{className:"relative min-w-0",children:[i.jsxs("div",{className:"control flex items-center gap-2 px-2",children:[l?i.jsx("img",{className:"h-5 w-5 shrink-0 rounded-full bg-slate-100",src:Ze(l.avatar_url??""),alt:`${l.login} avatar`,referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),i.jsx("input",{className:"min-w-0 flex-1 bg-transparent font-mono text-sm outline-none",value:e,placeholder:"@login",onChange:c=>{n(c.target.value),s(!0)},onFocus:()=>s(!0),onBlur:()=>window.setTimeout(()=>s(!1),100)}),e?i.jsx("button",{className:"rounded-sm p-1 text-muted hover:bg-slate-100",type:"button","aria-label":"Clear actor filter",onClick:()=>n(""),children:i.jsx(Yt,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),r&&o.length>0?i.jsx("div",{className:"absolute left-0 right-0 z-20 mt-1 max-h-72 overflow-auto rounded-md border border-border bg-white p-1 shadow-lg",children:o.map(c=>i.jsxs("button",{className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-slate-50",type:"button",onMouseDown:u=>u.preventDefault(),onClick:()=>{n(c.login),s(!1)},children:[c.avatar_url?i.jsx("img",{className:"h-6 w-6 shrink-0 rounded-full bg-slate-100",src:Ze(c.avatar_url),alt:`${c.login} avatar`,referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:"h-5 w-5 shrink-0 text-muted","aria-hidden":!0}),i.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:["@",c.login]}),i.jsx("span",{className:"shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-semibold text-muted",children:c.job_count})]},c.login))}):null]})}function Xe({label:e,children:t,className:n}){return i.jsxs("label",{className:W("grid min-w-0 gap-1 text-xs font-semibold text-muted",n),children:[e,t]})}function Sx({jobs:e,loading:t,loadingMore:n=!1,hasMore:r=!1,onLoadMore:s,onViewJob:a,now:o,user:l,onRetry:c,onDismiss:u,onCancel:d}){const[h,m]=A.useState(null),[p,w]=A.useState(null),[b,v]=A.useState(null),y=A.useRef(!1),j=A.useRef(n),_=!!(l!=null&&l.is_admin&&c),S=!!(l!=null&&l.is_admin&&u);A.useEffect(()=>{j.current&&!n&&(y.current=!1),j.current=n},[n]);const F=A.useCallback(()=>{y.current||(y.current=!0,s==null||s())},[s]),k=A.useCallback(async R=>{if(c){m(R);try{await c(R)}finally{m(null)}}},[c]),q=A.useCallback(async R=>{if(u){w(R);try{await u(R)}finally{w(null)}}},[u]),M=A.useCallback(async(R,z)=>{if(d){v(R);try{await d(R,z)}finally{v(null)}}},[d]);return t&&e.length===0?i.jsx(J,{text:"Loading jobs..."}):e.length===0?i.jsx(J,{text:"No jobs match the current filters."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-2 md:hidden",children:[e.map(R=>i.jsx(Ex,{job:R,onViewJob:a,now:o,canRetry:_&&qn(R.status),retrying:h===R.id,onRetry:k,canDismiss:S&&qn(R.status),dismissing:p===R.id,onDismiss:q,canCancel:!!(d&&Fi(R,l)),cancelling:b===R.id,onCancel:M},R.id)),i.jsx(_x,{hasMore:r,loading:n,onLoadMore:F})]}),i.jsx(zi,{noun:"jobs",hasMore:r,loading:n,onLoadMore:F,className:"hidden md:block",children:i.jsxs("table",{className:"min-w-[1080px] table-fixed border-collapse text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"sticky top-0 z-10 border-b border-border bg-panel text-left text-xs text-muted",children:[i.jsx("th",{className:"w-[42%] px-3 py-2 font-semibold",children:"Job"}),i.jsx("th",{className:"w-32 px-3 py-2 font-semibold",children:"Status"}),i.jsx("th",{className:"w-40 px-3 py-2 font-semibold",children:"Action"}),i.jsx("th",{className:"w-36 px-3 py-2 font-semibold",children:"Actor"}),i.jsx("th",{className:"w-36 px-3 py-2 font-semibold",children:"Timing"}),i.jsx("th",{className:"w-28 px-3 py-2 font-semibold",children:"Updated"}),i.jsx("th",{className:"w-24 px-3 py-2 text-right font-semibold",children:"Actions"})]})}),i.jsx("tbody",{children:e.map(R=>i.jsx(Cx,{job:R,now:o,onViewJob:a,canRetry:_&&qn(R.status),retrying:h===R.id,onRetry:k,canDismiss:S&&qn(R.status),dismissing:p===R.id,onDismiss:q,canCancel:!!(d&&Fi(R,l)),cancelling:b===R.id,onCancel:M},R.id))})]})})]})}function Cx({job:e,now:t,onViewJob:n,canRetry:r,retrying:s,onRetry:a,canDismiss:o,dismissing:l,onDismiss:c,canCancel:u,cancelling:d,onCancel:h}){return i.jsxs("tr",{className:"cursor-pointer border-b border-border align-top hover:bg-slate-50",onClick:()=>n(e.id),children:[i.jsx("td",{className:"min-w-0 px-3 py-3",children:i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsxs("span",{className:"mt-0.5 shrink-0 font-mono text-xs font-semibold text-muted",children:["#",e.id]}),i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsx("div",{className:"line-clamp-2 text-sm font-semibold leading-snug text-foreground [overflow-wrap:anywhere]",title:e.subject,children:e.subject}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted",children:[i.jsx("span",{className:"min-w-0 max-w-full truncate font-mono",children:e.repo??e.work_key}),i.jsxs("span",{className:"shrink-0",children:["thread ",e.thread??"n/a"]})]})]})]})}),i.jsx("td",{className:"px-3 py-3",children:i.jsx(hs,{status:e.status})}),i.jsxs("td",{className:"px-3 py-3",children:[i.jsx("div",{className:"min-w-0 truncate text-sm text-foreground",title:e.action,children:e.action}),i.jsx("div",{className:"mt-1",children:i.jsx(ds,{intent:e.intent,actionMode:e.action_mode,display:"intent",compact:!0})})]}),i.jsx("td",{className:"px-3 py-3",children:i.jsx(Pn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url})}),i.jsxs("td",{className:"px-3 py-3 text-xs text-muted",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{children:"wait"}),i.jsx("span",{className:"font-mono text-foreground",children:Ke(us(e,t))})]}),i.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[i.jsx("span",{children:"run"}),i.jsx("span",{className:"font-mono text-foreground",children:Ke(cs(e,t))})]}),i.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[i.jsx("span",{children:"tries"}),i.jsx("span",{className:"font-mono text-foreground",children:e.attempts})]})]}),i.jsx("td",{className:"px-3 py-3 font-mono text-xs",children:i.jsx(ue,{value:e.updated_at,compact:!0,relative:!0,now:t})}),i.jsx("td",{className:"px-3 py-3 text-right",children:i.jsxs("div",{className:"inline-flex items-center gap-1",children:[i.jsx(Wl,{jobId:e.id,canRetry:r,retrying:s,onRetry:a,compact:!0}),i.jsx(Gl,{jobId:e.id,canDismiss:o,dismissing:l,onDismiss:c,compact:!0}),i.jsx(Jl,{jobId:e.id,canCancel:u,cancelling:d,onCancel:h,compact:!0})]})})]})}function _x({hasMore:e,loading:t,onLoadMore:n}){return!e&&!t?null:i.jsxs("button",{className:"inline-flex min-h-10 w-full items-center justify-center gap-2 rounded-md border border-border px-3 py-2 text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60 md:hidden",type:"button",disabled:t||!e,onClick:()=>n==null?void 0:n(),children:[i.jsx(jn,{className:"h-4 w-4","aria-hidden":!0}),t?"Loading more jobs...":"Load more jobs"]})}function Ex({job:e,onViewJob:t,now:n,canRetry:r,retrying:s,onRetry:a,canDismiss:o,dismissing:l,onDismiss:c,canCancel:u,cancelling:d,onCancel:h}){return i.jsxs("article",{className:"rounded-md border border-border bg-white shadow-[0_1px_0_rgba(15,23,42,0.03)]",children:[i.jsxs("button",{className:"grid w-full gap-2 p-3 text-left hover:bg-slate-50",type:"button",onClick:()=>t(e.id),children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsxs("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-2",children:[i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted",children:["#",e.id]}),i.jsx("span",{className:"truncate font-mono text-sm",children:e.repo??e.work_key})]}),i.jsx("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:e.subject}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted",children:[i.jsxs("span",{children:["thread ",e.thread??"n/a"," · ",e.action]}),i.jsx(ds,{intent:e.intent,actionMode:e.action_mode,compact:!0,display:"intent"}),i.jsx(Pn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url})]})]}),i.jsx(hs,{status:e.status})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[i.jsx(V,{label:"Wait",value:Ke(us(e,n))}),i.jsx(V,{label:"Runtime",value:Ke(cs(e,n))}),i.jsx(V,{label:"Updated",value:i.jsx(ue,{value:e.updated_at,compact:!0,relative:!0,now:n})})]})]}),r||o||u?i.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-border px-3 py-2",children:[i.jsx(Wl,{jobId:e.id,canRetry:r,retrying:s,onRetry:a}),i.jsx(Gl,{jobId:e.id,canDismiss:o,dismissing:l,onDismiss:c}),i.jsx(Jl,{jobId:e.id,canCancel:u,cancelling:d,onCancel:h})]}):null]})}function Wl({jobId:e,canRetry:t,retrying:n,onRetry:r,compact:s=!1}){if(!t)return null;const a=n?"Retrying...":"Retry";return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",s?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Retry job #${e}`,title:`Retry job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Retry job #${e}?`)&&await r(e)},children:[i.jsx(Gn,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(s&&"sr-only"),children:a})]})}function Gl({jobId:e,canDismiss:t,dismissing:n,onDismiss:r,compact:s=!1}){if(!t)return null;const a=n?"Dismissing...":"Dismiss";return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",s?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Dismiss job #${e}`,title:`Dismiss job #${e}`,onClick:async o=>{o.stopPropagation(),window.confirm(`Dismiss job #${e}?`)&&await r(e)},children:[i.jsx(kn,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(s&&"sr-only"),children:a})]})}function Jl({jobId:e,canCancel:t,cancelling:n,onCancel:r,compact:s=!1}){if(!t)return null;const a=n?"Cancelling...":"Cancel";return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-red-200 bg-red-50 text-sm font-semibold text-red-700 hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-60",s?"w-8 px-0":"px-3"),type:"button",disabled:n,"aria-label":`Cancel job #${e}`,title:`Cancel job #${e}`,onClick:async o=>{o.stopPropagation();const l=window.prompt(`Cancel job #${e}? Optional reason:`);l!==null&&await r(e,l)},children:[i.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(s&&"sr-only"),children:a})]})}function Pn({actor:e,avatarUrl:t,framed:n=!1}){const r=t?i.jsx("img",{className:"h-4 w-4 shrink-0 rounded-full bg-slate-100",src:Ze(t),alt:e?`${e} avatar`:"",referrerPolicy:"no-referrer"}):i.jsx(Wn,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),s=i.jsxs(i.Fragment,{children:[r,i.jsx("span",{className:"min-w-0 truncate",children:e?`@${e}`:"unknown actor"})]});return n?i.jsx("span",{className:"inline-flex h-7 max-w-full items-center gap-1 rounded-md border border-border px-2 text-xs font-semibold text-muted",children:s}):i.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 font-mono text-xs text-muted",children:s})}function Px(e){return(e==null?void 0:e.model)??"OpenClaw default"}function Rx(e){return(e==null?void 0:e.thinking)??"OpenClaw default"}function Ix(e){return e?e.configured?"configured":e.summary:"n/a"}function Tx(e,t){const n=t||(e==="work_allowed"?"fix_allowed":"review_only");return n==="fix_allowed"||!t&&e==="work_allowed"?{mode:n,intentLabel:"work_allowed",title:"Work allowed"}:{mode:n,intentLabel:"review_only",title:"Review only"}}function ds({intent:e,actionMode:t,compact:n=!1,display:r="mode"}){const s=Tx(e,t),a=s.intentLabel==="work_allowed"?fu:Go,o=r==="intent"?s.intentLabel:s.mode;return i.jsxs("span",{className:W("inline-flex min-h-6 max-w-full items-center gap-1.5 rounded-md border px-2 text-xs font-semibold",s.intentLabel==="work_allowed"?"border-blue-200 bg-blue-50 text-blue-700":"border-violet-200 bg-violet-50 text-violet-700",n&&"min-h-5 px-1.5 text-[11px]"),title:`${s.title}: ${s.mode}`,"aria-label":`${s.title}: ${o}`,children:[i.jsx(a,{className:W("h-3.5 w-3.5 shrink-0",n&&"h-3 w-3"),"aria-hidden":!0}),i.jsx("span",{className:"truncate font-mono",children:o})]})}function Ax({job:e,session:t,sessionEvents:n,transcript:r,now:s,compact:a=!1}){var p;const o=En(e.id),l=n??[],c=r??[],u=Sf(l),d=Cf(c),h=cs(e,s),m=us(e,s);return i.jsxs("div",{className:"grid min-w-0 gap-4",children:[i.jsxs("div",{className:"sticky top-0 z-20 -mx-3 -mt-3 grid gap-2 border-b border-border bg-panel/95 px-3 py-2 shadow-sm backdrop-blur sm:-mx-4 sm:-mt-4 sm:px-4","aria-label":"Sticky job header",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx(hs,{status:e.status}),i.jsxs("a",{className:"inline-flex h-7 items-center gap-1 rounded-md border border-border bg-white px-2 text-xs font-semibold text-foreground hover:bg-slate-50",href:o,children:[i.jsx(Nn,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Job #",e.id]}),i.jsx(Pn,{actor:e.trigger_actor,avatarUrl:e.trigger_actor_avatar_url,framed:!0}),i.jsx("span",{className:"min-w-0 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:e.work_key})]}),i.jsxs("div",{className:"grid min-w-0 gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(280px,auto)] lg:items-start",children:[i.jsx("p",{className:"min-w-0 break-words text-sm text-muted [overflow-wrap:anywhere]",children:e.subject}),i.jsxs("div",{className:"grid min-w-0 gap-1",children:[i.jsx("h3",{className:"text-xs font-semibold text-muted",children:"GitHub links"}),e.github_urls.length>0?i.jsx(Xn,{urls:e.github_urls,compact:!0}):i.jsx("p",{className:"text-xs text-muted",children:"No links recorded."})]})]})]}),i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",a?"grid-cols-1":"grid-cols-3"),children:[i.jsx(V,{label:"Queue wait",value:Ke(m)}),i.jsx(V,{label:e.status==="running"?"Running for":"Runtime",value:Ke(h)}),i.jsx(V,{label:"Coalesced",value:String(e.coalesced_count)})]}),e.queue_state==="serialized_by_work_key"?i.jsxs("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900",children:["Serialized behind running job #",e.blocked_by_job_id," for this work key."]}):null,i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",a?"grid-cols-1":"grid-cols-3"),children:[i.jsx(V,{label:"Model",value:Px(e.model_route)}),i.jsx(V,{label:"Reasoning",value:Rx(e.model_route)}),i.jsx(V,{label:"Route",value:Ix(e.model_route)})]}),i.jsx(Lx,{job:e,compact:a}),i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",a?"grid-cols-1":"grid-cols-2 xl:grid-cols-4"),children:[i.jsx(V,{label:"Created",value:i.jsx(ue,{value:e.created_at,compact:!0,relative:!0,now:s})}),i.jsx(V,{label:"Started",value:e.started_at?i.jsx(ue,{value:e.started_at,compact:!0,relative:!0,now:s}):"n/a"}),i.jsx(V,{label:"Updated",value:i.jsx(ue,{value:e.updated_at,compact:!0,relative:!0,now:s})}),i.jsx(V,{label:"Finished",value:e.finished_at?i.jsx(ue,{value:e.finished_at,compact:!0,relative:!0,now:s}):"n/a"})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Timeline"}),i.jsx("div",{className:"grid min-w-0 gap-3",children:(e.worklog??[]).length>0?(p=e.worklog)==null?void 0:p.map(w=>i.jsxs("div",{className:"min-w-0 border-l-2 border-primary pl-3",children:[i.jsx("div",{className:"text-sm font-semibold",children:w.phase}),i.jsx("div",{className:"font-mono text-xs text-muted",children:i.jsx(ue,{value:w.ts,relative:!0,now:s})}),i.jsx("div",{className:"break-words text-sm [overflow-wrap:anywhere]",children:w.summary}),w.detail?i.jsx("div",{className:"mt-1 break-words font-mono text-xs text-muted [overflow-wrap:anywhere]",children:w.detail}):null]},w.id)):i.jsx(J,{text:"No worklog entries."})})]}),i.jsxs("div",{children:[i.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[i.jsx(Xo,{className:"h-4 w-4","aria-hidden":!0}),"OpenClaw session"]}),t?i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[i.jsx(V,{label:"Session ID",value:t.id}),i.jsx(V,{label:"Source",value:t.source})]}),i.jsx("p",{className:"break-words text-xs text-muted [overflow-wrap:anywhere]",children:t.detail})]}):i.jsx(J,{text:"Session correlation is loading."})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Agent activity"}),i.jsx("div",{className:"grid max-h-[460px] min-w-0 gap-2 overflow-auto pr-1",children:u.length>0?u.map((w,b)=>i.jsx(Ox,{event:w,defaultOpen:lo(w.eventType,e.status==="running",b,u.length),now:s},w.id)):i.jsx(J,{text:e.status==="running"?"Waiting for live agent output...":"No agent activity has been recorded for this session."})})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"mb-2 text-sm font-semibold",children:"Session transcript"}),i.jsx("div",{className:"grid max-h-[620px] min-w-0 gap-2 overflow-auto pr-1",children:d.length>0?d.map((w,b)=>i.jsx(Mx,{entry:w,defaultOpen:lo(w.kind,e.status==="running",b,d.length),now:s},w.id)):i.jsx(J,{text:e.status==="running"?"Waiting for live transcript entries...":"No OpenClaw transcript entries are available for this session."})})]})]})}function Lx({job:e,compact:t=!1}){const n=e.intent_classifier??null,r=(n==null?void 0:n.llm)??{},s=(n==null?void 0:n.parser)??{},a=typeof r.confidence=="number"?`${Math.round(r.confidence*100)}%`:"n/a";return i.jsxs("div",{className:"grid gap-2",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Action mode"}),i.jsxs("div",{className:W("grid gap-2 text-sm sm:gap-3",t?"grid-cols-1":"grid-cols-2 xl:grid-cols-4"),children:[i.jsx(V,{label:"Mode",value:i.jsx(ds,{intent:e.intent,actionMode:e.action_mode})}),i.jsx(V,{label:"Intent",value:e.intent}),i.jsx(V,{label:"Addressed",value:n?po(r.addressed_to_agent):"n/a"}),i.jsx(V,{label:"Write",value:n?r.write_permission??"none":e.intent==="work_allowed"?"allowed":"none"})]}),n?i.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-panel p-3 text-xs",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[i.jsx(tt,{label:"Classifier",value:n.enabled?"enabled":"disabled"}),i.jsx(tt,{label:"Applied",value:po(r.applied)}),i.jsx(tt,{label:"Confidence",value:a}),i.jsx(tt,{label:"Parser",value:`${s.action??"n/a"} / ${s.work_intent??"n/a"}`})]}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(tt,{label:"LLM",value:`${r.action??"n/a"} / ${r.work_intent??"n/a"}`}),i.jsx(tt,{label:"Scope",value:r.scope||"n/a"})]}),r.main_request?i.jsx(tt,{label:"Main request",value:r.main_request}):null,r.subordinate_reason?i.jsx(tt,{label:"Subordinate reason",value:r.subordinate_reason}):null,r.reason?i.jsx(tt,{label:"Reason",value:r.reason}):null,n.error?i.jsx(tt,{label:"Error",value:n.error,tone:"danger"}):null]}):i.jsx("p",{className:"text-xs text-muted",children:"No intent classifier metadata recorded for this job."})]})}function po(e){return e===!0?"yes":e===!1?"no":"n/a"}function tt({label:e,value:t,tone:n="neutral"}){return i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:e}),i.jsx("div",{className:W("mt-0.5 min-w-0 break-words font-mono text-xs [overflow-wrap:anywhere]",n==="danger"?"text-red-700":"text-foreground"),children:t})]})}function Mx({entry:e,defaultOpen:t,now:n}){return i.jsx(Xl,{badge:e.badge,meta:i.jsx(ue,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:i.jsx("pre",{className:"max-h-72 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.text})})}function Ox({event:e,defaultOpen:t,now:n}){return i.jsx(Xl,{badge:e.badge,meta:i.jsx(ue,{value:e.meta,relative:!0,now:n}),count:e.count,summary:e.summary,defaultOpen:t,children:e.detail?i.jsx("pre",{className:"max-h-56 max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-slate-950 px-2 py-1.5 font-mono text-xs leading-relaxed text-slate-100 [overflow-wrap:anywhere]",children:e.detail}):null})}function Xl({badge:e,meta:t,count:n,summary:r,defaultOpen:s,children:a}){const[o,l]=A.useState(!!s);return i.jsxs("details",{className:"group min-w-0 rounded border border-border bg-slate-50/60",open:o,onToggle:c=>l(c.currentTarget.open),children:[i.jsxs("summary",{className:"grid cursor-pointer list-none gap-1 px-2 py-1.5 marker:hidden hover:bg-white",children:[i.jsxs("div",{className:"grid min-w-0 gap-1 sm:flex sm:items-center sm:justify-between sm:gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[i.jsx(jn,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),i.jsx("span",{className:"truncate font-mono text-[11px] font-semibold text-muted",children:e}),n&&n>1?i.jsx("span",{className:"rounded-sm border border-border px-1 font-mono text-[10px] text-muted",children:n}):null]}),i.jsx("span",{className:"min-w-0 truncate pl-5 font-mono text-[11px] text-muted sm:shrink-0 sm:pl-0",children:t})]}),i.jsx("div",{className:"min-w-0 break-words pl-5 text-xs text-foreground [overflow-wrap:anywhere] sm:truncate",children:r})]}),i.jsx("div",{className:"min-w-0 border-t border-border bg-white px-2 py-2",children:a})]})}function mo({label:e,values:t}){const n=[{name:"median",seconds:(t==null?void 0:t.median)??0},{name:"p90",seconds:(t==null?void 0:t.p90)??0},{name:"p99",seconds:(t==null?void 0:t.p99)??0}];return i.jsx("div",{className:"h-56",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:n,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"name"}),i.jsx(ar,{tickFormatter:Ke}),i.jsx(or,{formatter:r=>[Ke(Number(r)),e]}),i.jsx(Wt,{dataKey:"seconds",fill:"#0969da",radius:[4,4,0,0]})]})})})}function Dx({values:e,loading:t,totalJobs:n}){const r=Object.entries(e??{}).map(([s,a])=>({day:s,count:a}));return t&&r.length===0?i.jsx(J,{text:"Loading job history..."}):r.length===0?i.jsx(J,{text:n>0?"Job history has no valid creation dates.":"No job history available."}):i.jsx("div",{className:"h-56",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:r,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"day",minTickGap:16}),i.jsx(ar,{allowDecimals:!1}),i.jsx(or,{formatter:s=>[Number(s),"jobs"]}),i.jsx(Wt,{dataKey:"count",fill:"#16a34a",radius:[4,4,0,0]})]})})})}function Fx({usage:e,loading:t,totalJobs:n}){const[r,s]=A.useState("day"),a=(e==null?void 0:e[r])??[],o=a.map(u=>({...u,label:zx(u.bucket,r)})),l=a.reduce((u,d)=>u+d.seconds,0),c=a.reduce((u,d)=>u+(d.runs??d.jobs),0);return t&&o.length===0?i.jsx(J,{text:"Loading runtime usage..."}):o.length===0?i.jsx(J,{text:n>0?"No jobs have recorded runtime yet.":"No job history available."}):i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted",children:[i.jsx(mu,{className:"h-4 w-4","aria-hidden":!0}),i.jsxs("span",{children:[Er(l)," consumed across ",c," run",c===1?"":"s"]})]}),i.jsx("div",{className:"inline-flex h-8 rounded-md border border-border bg-white p-0.5","aria-label":"Runtime grouping",children:["day","month"].map(u=>i.jsx("button",{className:W("rounded px-2.5 text-xs font-semibold capitalize",r===u?"bg-primary text-white":"text-muted hover:bg-slate-50"),type:"button",onClick:()=>s(u),children:u},u))})]}),i.jsx("div",{className:"h-64",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(qr,{data:o,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"label",minTickGap:16,tick:{fontSize:11}}),i.jsx(ar,{tickFormatter:u=>Er(Number(u))}),i.jsx(Po,{}),i.jsx(or,{formatter:(u,d)=>d==="Work"?[Er(Number(u)),"work"]:d==="Review"?[Er(Number(u)),"review"]:[Number(u),String(d)],labelFormatter:u=>String(u)}),i.jsx(Wt,{dataKey:"work_seconds",name:"Work",stackId:"runtime",fill:"#0969da",isAnimationActive:!1}),i.jsx(Wt,{dataKey:"review_seconds",name:"Review",stackId:"runtime",fill:"#8250df",radius:[4,4,0,0],isAnimationActive:!1})]})})})]})}function zx(e,t){if(t==="month"){const[a,o]=e.split("-").map(Number);return!a||!o?e:new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric"}).format(new Date(a,o-1,1))}const[n,r,s]=e.split("-").map(Number);return!n||!r||!s?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(n,r-1,s))}function Er(e){const t=Math.max(0,Math.round(e));if(t<60)return`${t}s`;const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60),s=n%60;return s===0?`${r}h`:`${r}h ${s}m`}function fo(e){return Object.values(e).reduce((t,n)=>t+n,0)}function qx({data:e,loading:t}){if(t&&!e)return i.jsx(J,{text:"Loading systemd units..."});if(!e)return i.jsx(J,{text:"No systemd snapshot available."});const n=e.units??[],r=n.filter(o=>o.active_state==="active").length,s=n.filter(o=>o.active_state==="failed"||o.result==="failed").length,a=n.filter(o=>o.kind==="timer").length;return i.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.errors.length>0?i.jsx(ve,{tone:"error",text:e.errors[0]}):null,n.length===0?i.jsx(J,{text:"No configured bridge units found."}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[i.jsx(Pr,{label:"Units",value:String(n.length)}),i.jsx(Pr,{label:"Active",value:String(r)}),i.jsx(Pr,{label:"Failed",value:String(s),tone:s>0?"bad":"neutral"}),i.jsx(Pr,{label:"Timers",value:String(a)})]}),i.jsxs("div",{className:"overflow-hidden rounded-md border border-border bg-white",children:[i.jsxs("div",{className:"hidden grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] gap-3 border-b border-border bg-slate-50 px-3 py-2 text-[11px] font-semibold uppercase text-muted md:grid",children:[i.jsx("span",{children:"Unit"}),i.jsx("span",{children:"Status"}),i.jsx("span",{children:"State"}),i.jsx("span",{children:"PID"}),i.jsx("span",{children:"Schedule"})]}),i.jsx("div",{className:"divide-y divide-border",children:n.map(o=>i.jsx(Bx,{unit:o},o.unit))})]})]})]})}function Pr({label:e,value:t,tone:n="neutral"}){return i.jsxs("div",{className:W("min-w-0 rounded-md border bg-white px-3 py-2",n==="bad"?"border-red-200":"border-border"),children:[i.jsx("div",{className:W("font-mono text-lg font-semibold",n==="bad"?"text-red-700":"text-foreground"),children:t}),i.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function Bx({unit:e}){const[t,n]=A.useState(!1),r=e.active_state==="active",s=e.active_state==="failed"||e.result==="failed",a=e.next_elapse||e.last_trigger||"n/a";return i.jsxs("details",{className:"group min-w-0",open:t,onToggle:o=>n(o.currentTarget.open),children:[i.jsxs("summary",{className:"grid min-w-0 cursor-pointer list-none grid-cols-2 gap-2 px-3 py-3 text-sm marker:hidden hover:bg-slate-50 md:grid-cols-[minmax(0,1.35fr)_90px_120px_90px_minmax(0,1fr)] md:items-center md:gap-3",children:[i.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(jn,{className:"h-3.5 w-3.5 shrink-0 text-muted transition-transform group-open:rotate-180","aria-hidden":!0}),i.jsx("span",{className:"truncate font-mono text-xs font-semibold text-foreground",children:e.unit})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 pl-5 text-[11px] font-semibold uppercase text-muted",children:[i.jsx("span",{children:e.role}),i.jsx("span",{children:e.kind}),i.jsx("span",{children:e.load_state}),i.jsx("span",{children:t?"following log":"expand log"})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:block",children:[i.jsx("span",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Status"}),i.jsx("span",{className:W("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",s?"border-red-300 bg-red-50 text-red-700":r?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-slate-50 text-slate-700"),children:e.active_state})]}),i.jsx(xo,{label:"State",value:e.sub_state,detail:e.result||"unknown"}),i.jsx(xo,{label:"PID",value:e.main_pid?String(e.main_pid):"n/a",detail:Ke(e.uptime_seconds)}),i.jsxs("div",{className:"col-span-2 min-w-0 md:col-span-1",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:"Schedule"}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:a,children:e.next_elapse?`next ${e.next_elapse}`:a})]})]}),i.jsx("div",{className:"border-t border-border bg-slate-50 px-3 pb-3 pt-2",children:i.jsx(Ux,{unit:e.unit,active:t})})]})}function xo({label:e,value:t,detail:n}){return i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted md:hidden",children:e}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",children:t}),n?i.jsx("div",{className:"truncate font-mono text-[11px] text-muted",children:n}):null]})}function Ux({unit:e,active:t}){const[n,r]=A.useState([]),[s,a]=A.useState(""),o=A.useRef(null);return A.useEffect(()=>{if(!t){r([]),a("");return}r([]),a("");const l=new EventSource(`/api/systemd/journal/stream?unit=${encodeURIComponent(e)}`);return l.addEventListener("journal_line",c=>{const u=zr(c);u&&r(d=>[...d.slice(-199),u])}),l.addEventListener("journal_error",c=>{const u=zr(c);a((u==null?void 0:u.error)??"journal stream failed")}),l.onerror=()=>{},()=>l.close()},[t,e]),A.useEffect(()=>{const l=o.current;l&&(l.scrollTop=l.scrollHeight)},[n]),i.jsxs("div",{className:"grid min-w-0 gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:"Live journal"}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted",children:n.length>0?`${n.length} lines streamed`:"waiting for journal output"})]}),i.jsx("div",{className:"font-mono text-[11px] text-muted",children:"journalctl -f"})]}),s?i.jsx(ve,{tone:"error",text:s}):null,i.jsx("div",{ref:o,className:"h-72 overflow-auto rounded-md border border-slate-800 bg-slate-950 p-3 font-mono text-xs leading-relaxed text-slate-100",children:n.length>0?n.map((l,c)=>i.jsx("div",{className:"break-words [overflow-wrap:anywhere]",children:l.line},`${l.unit}-${c}`)):i.jsx("div",{className:"text-slate-400",children:"No journal lines received yet."})})]})}function $x({data:e,loading:t}){var h,m,p,w,b,v;if(t&&!e)return i.jsx(J,{text:"Loading process activity..."});if(!e)return i.jsx(J,{text:"No process snapshot available."});const n=e.executor.children??[],r=n.flatMap(y=>Zl(y)),s=r.reduce((y,j)=>y+j.cpu_ticks,0),a=r.reduce((y,j)=>y+Kx(j),0),o=e.executor.service==="active",l=r.slice(0,8).map(y=>({label:`pid ${y.pid}`,ticks:y.cpu_ticks})),c=(e.samples??[]).map(y=>({label:Hn(y.ts),ticks:y.cpu_ticks,io:y.io_bytes,active:y.active_since_last_sample?"active":"quiet"})),u=c.length>0?c:l,d=(h=e.samples)==null?void 0:h[e.samples.length-1];return i.jsxs("div",{className:"grid gap-4",children:[i.jsx("div",{className:"rounded-md border border-slate-200 bg-slate-50 p-3",children:i.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:W("inline-flex h-6 items-center rounded-full border px-2 text-xs font-semibold",o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-slate-300 bg-white text-slate-600"),children:o?"active":"idle"}),i.jsxs("span",{className:"font-mono text-xs text-muted",children:["service ",e.executor.service]})]}),i.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:e.running_jobs.length>0?`${e.running_jobs.length} running job${e.running_jobs.length===1?"":"s"}`:"No running jobs"}),e.running_jobs.length>0?i.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.running_jobs.slice(0,4).map(y=>i.jsxs("span",{className:"inline-flex min-h-6 items-center gap-1.5 rounded-full border border-blue-200 bg-white px-2 font-mono text-[11px] font-semibold text-blue-700",children:[i.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-600 animate-live-pulse","aria-hidden":!0}),"#",y.id," ",Ke(y.age_seconds)]},y.id))}):null,d?i.jsxs("p",{className:"mt-1 text-xs text-muted",children:["Last persisted sample ",Hn(d.ts)," · ",d.active_since_last_sample?"activity observed":`quiet ${Ke(d.idle_seconds)}`]}):null,i.jsx("p",{className:"mt-1 text-xs text-muted",children:e.detail})]}),i.jsxs("div",{className:"grid min-w-[190px] grid-cols-3 gap-2 text-center text-xs",children:[i.jsx(ci,{label:"PID",value:e.executor.pid?String(e.executor.pid):"n/a"}),i.jsx(ci,{label:"Children",value:String(r.length)}),i.jsx(ci,{label:"CPU ticks",value:String(s)})]})]})}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(Rr,{label:"Live process",value:((m=e.signals)==null?void 0:m.live_process.state)??(r.length>0?"live":"no_child_process"),detail:`${((p=e.signals)==null?void 0:p.live_process.child_count)??r.length} children`}),i.jsx(Rr,{label:"Process activity",value:((w=e.signals)==null?void 0:w.process_activity.state)??(d!=null&&d.active_since_last_sample?"active":"quiet"),detail:d?`sample ${Hn(d.ts)}`:"no sample"}),i.jsx(Rr,{label:"Semantic progress",value:(b=e.signals)!=null&&b.semantic_progress.length?"recent":"none",detail:go(e.running_jobs,"semantic_progress")}),i.jsx(Rr,{label:"Visible progress",value:(v=e.signals)!=null&&v.visible_progress.length?"streaming":"none",detail:go(e.running_jobs,"visible_progress")})]}),e.alerts.length>0?i.jsx(ve,{tone:"error",text:e.alerts[0]}):null,i.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[i.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[i.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(wa,{className:"h-4 w-4","aria-hidden":!0}),c.length>0?"CPU history":"CPU ticks"]}),i.jsxs("span",{className:"font-mono text-xs text-muted",children:[ec(a)," I/O"]})]}),u.length>0?i.jsx("div",{className:"h-40",children:i.jsx(rr,{width:"100%",height:"100%",children:i.jsxs(fc,{data:u,children:[i.jsx(ir,{strokeDasharray:"3 3"}),i.jsx(sr,{dataKey:"label",tick:!1}),i.jsx(ar,{allowDecimals:!1,tick:{fontSize:11}}),i.jsx(or,{formatter:y=>[Number(y),"cpu ticks"]}),i.jsx(xc,{type:"monotone",dataKey:"ticks",stroke:"#0f766e",strokeWidth:2,dot:{r:3},activeDot:{r:5},isAnimationActive:!1})]})})}):i.jsx(J,{text:"No executor CPU samples available."})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-semibold",children:[i.jsx(wa,{className:"h-4 w-4","aria-hidden":!0}),"Executor children"]}),n.length>0?i.jsx("div",{className:"grid gap-2",children:n.map(y=>i.jsx(Yl,{process:y},y.pid))}):i.jsx(J,{text:"No child process detected for the executor."})]})]})]})}function Hx({alerts:e,loading:t,now:n}){if(t&&!e)return i.jsx(J,{text:"Loading monitor alerts..."});const r=e??[];return r.length===0?i.jsx(J,{text:"No active monitor alerts."}):i.jsx("div",{className:"grid gap-2",children:r.slice(0,5).map(s=>i.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 p-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-red-700",children:[i.jsx(Br,{className:"h-3.5 w-3.5","aria-hidden":!0}),i.jsx("span",{children:s.severity}),i.jsx("span",{className:"font-normal text-red-600",children:zl(s.last_seen,n)}),s.observations>1?i.jsxs("span",{className:"rounded-full border border-red-200 bg-white px-1.5",children:[s.observations,"x"]}):null]}),i.jsx("p",{className:"mt-1 break-words text-sm font-medium text-red-950 [overflow-wrap:anywhere]",children:s.message})]},s.fingerprint))})}function Yl({process:e}){var r,s;const t=((r=e.io_bytes)==null?void 0:r.read_bytes)??0,n=((s=e.io_bytes)==null?void 0:s.write_bytes)??0;return i.jsxs("div",{className:"rounded-md border border-border bg-white p-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[i.jsxs("span",{className:"font-mono",children:["pid ",e.pid]}),i.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["state ",e.state]}),i.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["cpu ",e.cpu_ticks]}),i.jsxs("span",{className:"rounded-full border border-border px-2 text-xs text-muted",children:["I/O ",ec(t+n)]})]}),i.jsx("div",{className:"mt-2 break-words font-mono text-xs text-muted",children:e.cmd||"unknown command"}),e.children&&e.children.length>0?i.jsx("div",{className:"mt-3 border-l-2 border-border pl-3",children:e.children.map(a=>i.jsx(Yl,{process:a},a.pid))}):null]})}function ci({label:e,value:t}){return i.jsxs("div",{className:"rounded-md border border-border bg-white px-2 py-2",children:[i.jsx("div",{className:"font-mono text-sm font-semibold text-foreground",children:t}),i.jsx("div",{className:"mt-0.5 text-[11px] font-semibold uppercase text-muted",children:e})]})}function Rr({label:e,value:t,detail:n}){return i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-white p-2.5",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase text-muted",children:e}),i.jsx("div",{className:"mt-1 truncate text-sm font-semibold text-foreground",children:t}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted",children:n})]})}function go(e,t){const n=e.find(s=>s[t]),r=n==null?void 0:n[t];return!n||!r?"no running heartbeat":`#${n.id} ${r.phase} ${Ke(r.age_seconds??null)}`}function Zl(e){return[e,...(e.children??[]).flatMap(t=>Zl(t))]}function Kx(e){var t,n;return(((t=e.io_bytes)==null?void 0:t.read_bytes)??0)+(((n=e.io_bytes)==null?void 0:n.write_bytes)??0)}function ec(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function V({label:e,value:t}){return i.jsxs("div",{className:"min-w-0 rounded-md border border-border p-3",children:[i.jsx("div",{className:"text-xs font-semibold text-muted",children:e}),i.jsx("div",{className:"mt-1 min-w-0 break-words text-sm [overflow-wrap:anywhere]",children:t})]})}function hs({status:e}){const t=_f(e),n=e==="running"||e==="pending";return i.jsxs("span",{className:W("inline-flex min-h-6 items-center gap-1.5 rounded-full border px-2 text-xs font-semibold",t.badge),children:[i.jsx("span",{className:W("h-2.5 w-2.5 rounded-full",t.dot,n&&"animate-live-pulse"),"aria-hidden":!0}),e]})}function J({text:e}){return i.jsx("div",{className:"rounded-md border border-dashed border-border p-6 text-center text-sm text-muted",children:e})}function ve({tone:e,text:t}){return i.jsx("div",{className:W("rounded-md border p-3 text-sm",e==="error"&&"border-red-300 bg-red-50 text-red-700",e==="warning"&&"border-amber-300 bg-amber-50 text-amber-800"),children:t})}function Ye({onClick:e,compactOnMobile:t=!1}){return i.jsxs("button",{className:W("inline-flex h-8 items-center justify-center gap-2 rounded-md border border-border text-sm font-semibold text-foreground hover:bg-slate-50",t?"w-8 px-0 sm:w-auto sm:px-3":"px-3"),onClick:e,type:"button","aria-label":"Refresh",children:[i.jsx(cr,{className:"h-4 w-4","aria-hidden":!0}),i.jsx("span",{className:W(t&&"hidden sm:inline"),children:"Refresh"})]})}const bo=document.getElementById("root");bo&&vc.createRoot(bo).render(i.jsx(A.StrictMode,{children:i.jsx(Gc,{client:xf,children:i.jsx(Vf,{})})})); diff --git a/src/github_agent_bridge/dashboard_static/index.html b/src/github_agent_bridge/dashboard_static/index.html index 191cd3a..314ae82 100644 --- a/src/github_agent_bridge/dashboard_static/index.html +++ b/src/github_agent_bridge/dashboard_static/index.html @@ -4,7 +4,7 @@ GitHub Agent Bridge Dashboard - +