selftune 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/diagnosis-analyst.md +20 -10
- package/.claude/agents/evolution-reviewer.md +14 -1
- package/.claude/agents/integration-guide.md +18 -6
- package/.claude/agents/pattern-analyst.md +18 -5
- package/CHANGELOG.md +12 -4
- package/README.md +43 -35
- package/apps/local-dashboard/dist/assets/geist-cyrillic-wght-normal-CHSlOQsW.woff2 +0 -0
- package/apps/local-dashboard/dist/assets/geist-latin-ext-wght-normal-DMtmJ5ZE.woff2 +0 -0
- package/apps/local-dashboard/dist/assets/geist-latin-wght-normal-Dm3htQBi.woff2 +0 -0
- package/apps/local-dashboard/dist/assets/index-C4EOTFZ2.js +15 -0
- package/apps/local-dashboard/dist/assets/index-bl-Webyd.css +1 -0
- package/apps/local-dashboard/dist/assets/vendor-react-U7zYD9Rg.js +60 -0
- package/apps/local-dashboard/dist/assets/vendor-table-B7VF2Ipl.js +26 -0
- package/apps/local-dashboard/dist/assets/vendor-ui-D7_zX_qy.js +346 -0
- package/apps/local-dashboard/dist/favicon.png +0 -0
- package/apps/local-dashboard/dist/index.html +17 -0
- package/apps/local-dashboard/dist/logo.png +0 -0
- package/apps/local-dashboard/dist/logo.svg +9 -0
- package/cli/selftune/badge/badge-data.ts +1 -1
- package/cli/selftune/badge/badge.ts +4 -8
- package/cli/selftune/canonical-export.ts +183 -0
- package/cli/selftune/constants.ts +28 -0
- package/cli/selftune/contribute/contribute.ts +1 -1
- package/cli/selftune/cron/setup.ts +17 -17
- package/cli/selftune/dashboard-contract.ts +202 -0
- package/cli/selftune/dashboard-server.ts +653 -186
- package/cli/selftune/dashboard.ts +41 -176
- package/cli/selftune/eval/baseline.ts +5 -4
- package/cli/selftune/eval/composability-v2.ts +273 -0
- package/cli/selftune/eval/hooks-to-evals.ts +34 -15
- package/cli/selftune/eval/unit-test-cli.ts +1 -1
- package/cli/selftune/evolution/evidence.ts +26 -0
- package/cli/selftune/evolution/evolve-body.ts +105 -11
- package/cli/selftune/evolution/evolve.ts +371 -25
- package/cli/selftune/evolution/extract-patterns.ts +87 -29
- package/cli/selftune/evolution/rollback.ts +2 -2
- package/cli/selftune/grading/auto-grade.ts +200 -0
- package/cli/selftune/grading/grade-session.ts +448 -97
- package/cli/selftune/grading/results.ts +42 -0
- package/cli/selftune/hooks/prompt-log.ts +172 -2
- package/cli/selftune/hooks/session-stop.ts +123 -3
- package/cli/selftune/hooks/skill-eval.ts +119 -3
- package/cli/selftune/index.ts +395 -116
- package/cli/selftune/ingestors/claude-replay.ts +140 -114
- package/cli/selftune/ingestors/codex-rollout.ts +345 -46
- package/cli/selftune/ingestors/codex-wrapper.ts +207 -39
- package/cli/selftune/ingestors/openclaw-ingest.ts +141 -8
- package/cli/selftune/ingestors/opencode-ingest.ts +193 -17
- package/cli/selftune/init.ts +227 -14
- package/cli/selftune/last.ts +14 -5
- package/cli/selftune/localdb/db.ts +63 -0
- package/cli/selftune/localdb/materialize.ts +428 -0
- package/cli/selftune/localdb/queries.ts +376 -0
- package/cli/selftune/localdb/schema.ts +204 -0
- package/cli/selftune/monitoring/watch.ts +66 -15
- package/cli/selftune/normalization.ts +682 -0
- package/cli/selftune/observability.ts +19 -44
- package/cli/selftune/orchestrate.ts +1073 -0
- package/cli/selftune/quickstart.ts +203 -0
- package/cli/selftune/repair/skill-usage.ts +576 -0
- package/cli/selftune/schedule.ts +561 -0
- package/cli/selftune/status.ts +48 -26
- package/cli/selftune/sync.ts +627 -0
- package/cli/selftune/types.ts +148 -0
- package/cli/selftune/utils/canonical-log.ts +45 -0
- package/cli/selftune/utils/hooks.ts +41 -0
- package/cli/selftune/utils/html.ts +27 -0
- package/cli/selftune/utils/llm-call.ts +78 -20
- package/cli/selftune/utils/math.ts +10 -0
- package/cli/selftune/utils/query-filter.ts +139 -0
- package/cli/selftune/utils/skill-discovery.ts +340 -0
- package/cli/selftune/utils/skill-log.ts +68 -0
- package/cli/selftune/utils/skill-usage-confidence.ts +18 -0
- package/cli/selftune/utils/transcript.ts +272 -26
- package/cli/selftune/workflows/discover.ts +254 -0
- package/cli/selftune/workflows/skill-md-writer.ts +288 -0
- package/cli/selftune/workflows/workflows.ts +188 -0
- package/package.json +21 -8
- package/packages/telemetry-contract/README.md +11 -0
- package/packages/telemetry-contract/fixtures/golden.json +87 -0
- package/packages/telemetry-contract/fixtures/golden.test.ts +42 -0
- package/packages/telemetry-contract/index.ts +1 -0
- package/packages/telemetry-contract/package.json +19 -0
- package/packages/telemetry-contract/src/index.ts +2 -0
- package/packages/telemetry-contract/src/types.ts +163 -0
- package/packages/telemetry-contract/src/validators.ts +109 -0
- package/skill/SKILL.md +84 -53
- package/skill/Workflows/AutoActivation.md +17 -16
- package/skill/Workflows/Badge.md +6 -0
- package/skill/Workflows/Baseline.md +46 -23
- package/skill/Workflows/Composability.md +12 -5
- package/skill/Workflows/Contribute.md +17 -14
- package/skill/Workflows/Cron.md +56 -79
- package/skill/Workflows/Dashboard.md +45 -34
- package/skill/Workflows/Doctor.md +30 -17
- package/skill/Workflows/Evals.md +64 -40
- package/skill/Workflows/EvolutionMemory.md +2 -0
- package/skill/Workflows/Evolve.md +102 -47
- package/skill/Workflows/EvolveBody.md +6 -6
- package/skill/Workflows/Grade.md +36 -31
- package/skill/Workflows/ImportSkillsBench.md +11 -5
- package/skill/Workflows/Ingest.md +43 -36
- package/skill/Workflows/Initialize.md +44 -30
- package/skill/Workflows/Orchestrate.md +139 -0
- package/skill/Workflows/Replay.md +39 -18
- package/skill/Workflows/Rollback.md +3 -3
- package/skill/Workflows/Schedule.md +61 -0
- package/skill/Workflows/Sync.md +88 -0
- package/skill/Workflows/UnitTest.md +34 -22
- package/skill/Workflows/Watch.md +14 -4
- package/skill/Workflows/Workflows.md +129 -0
- package/skill/assets/activation-rules-default.json +26 -0
- package/skill/assets/multi-skill-settings.json +63 -0
- package/skill/assets/single-skill-settings.json +57 -0
- package/skill/references/invocation-taxonomy.md +2 -2
- package/skill/references/logs.md +164 -2
- package/skill/references/setup-patterns.md +65 -0
- package/skill/references/version-history.md +40 -0
- package/skill/settings_snippet.json +1 -1
- package/templates/multi-skill-settings.json +7 -7
- package/templates/single-skill-settings.json +6 -6
- package/dashboard/index.html +0 -1680
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var Ms=e=>{throw TypeError(e)};var ur=(e,t,n)=>t.has(e)||Ms("Cannot "+n);var g=(e,t,n)=>(ur(e,t,"read from private field"),n?n.call(e):t.get(e)),H=(e,t,n)=>t.has(e)?Ms("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),M=(e,t,n,r)=>(ur(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),G=(e,t,n)=>(ur(e,t,"access private method"),n);var Dn=(e,t,n,r)=>({set _(i){M(e,t,i,n)},get _(){return g(e,t,r)}});import{r as L,j as s,u as Cl,L as qt,g as aa,d as El,B as Il,e as Tl,f as dr,h as zl}from"./vendor-react-U7zYD9Rg.js";import{t as Pl,c as _l,u as Xn,m as Jn,a as Zn,C as Al,b as Rl,d as Ol,I as Ml,B as Dl,S as Ll,D as Fl,e as Bl,f as Ul,X as la,g as Hl,h as ql,i as $l,j as Vl,T as Ql,k as Kl,l as Gl,n as Wl,o as Yl,p as Xl,q as Jl,P as Zl,r as eo,H as oa,A as sn,s as an,v as ss,w as gt,x as Be,y as Rt,z as nt,G as Hn,F as to,E as no,M as ro,J as so,K as io,L as ao,N as lo,O as oo,Q as is,R as ca,U as Ds,V as co,W as as,Z as uo,Y as ua,_ as er,$ as da,a0 as tr,a1 as nr,a2 as ho,a3 as fo,a4 as rr,a5 as po,a6 as mo,a7 as xo,a8 as go,a9 as yo,aa as bo,ab as vo,ac as jo,ad as wo,ae as No,af as ko,ag as So,ah as Co,ai as Ot,aj as Eo,ak as Io,al as To,am as zo,an as Po,ao as _o,ap as Ao,aq as Ro,ar as Oo,as as Mo,at as Do,au as Lo,av as Fo,aw as Bo,ax as Uo,ay as Ho,az as qo,aA as $o,aB as sr,aC as Qn,aD as Kn,aE as ha,aF as ls,aG as Vo,aH as fa,aI as gn,aJ as Qo,aK as Ko,aL as Go,aM as Wo,aN as Yo,aO as Xo,aP as Jo,aQ as Zo,aR as ec,aS as tc,aT as nc}from"./vendor-ui-D7_zX_qy.js";import{u as rc,a as hr,b as sc,D as ic,r as ac,c as lc,f as pa,S as oc,v as cc,g as uc,d as dc,e as hc,h as fc,i as pc,j as mc,s as xc,K as gc,T as yc,M as bc,k as vc,l as jc,C as wc}from"./vendor-table-B7VF2Ipl.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var An=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(){}},Nc={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},at,rs,Yi,kc=(Yi=class{constructor(){H(this,at,Nc);H(this,rs,!1)}setTimeoutProvider(e){M(this,at,e)}setTimeout(e,t){return g(this,at).setTimeout(e,t)}clearTimeout(e){g(this,at).clearTimeout(e)}setInterval(e,t){return g(this,at).setInterval(e,t)}clearInterval(e){g(this,at).clearInterval(e)}},at=new WeakMap,rs=new WeakMap,Yi),kt=new kc;function Sc(e){setTimeout(e,0)}var Mt=typeof window>"u"||"Deno"in globalThis;function we(){}function Cc(e,t){return typeof e=="function"?e(t):e}function Tr(e){return typeof e=="number"&&e>=0&&e!==1/0}function ma(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mt(e,t){return typeof e=="function"?e(t):e}function Te(e,t){return typeof e=="function"?e(t):e}function Ls(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:l,stale:o}=e;if(l){if(r){if(t.queryHash!==os(l,t.options))return!1}else if(!Cn(t.queryKey,l))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||i&&i!==t.state.fetchStatus||a&&!a(t))}function Fs(e,t){const{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Sn(t.options.mutationKey)!==Sn(a))return!1}else if(!Cn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function os(e,t){return((t==null?void 0:t.queryKeyHashFn)||Sn)(e)}function Sn(e){return JSON.stringify(e,(t,n)=>Pr(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Cn(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Cn(e[n],t[n])):!1}var Ec=Object.prototype.hasOwnProperty;function xa(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=Bs(e)&&Bs(t);if(!r&&!(Pr(e)&&Pr(t)))return t;const a=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),o=l.length,c=r?new Array(o):{};let u=0;for(let d=0;d<o;d++){const h=r?d:l[d],p=e[h],f=t[h];if(p===f){c[h]=p,(r?d<a:Ec.call(e,h))&&u++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){c[h]=f;continue}const b=xa(p,f,n+1);c[h]=b,b===p&&u++}return a===o&&u===a?e:c}function zr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Bs(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Pr(e){if(!Us(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Us(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Us(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ic(e){return new Promise(t=>{kt.setTimeout(t,e)})}function _r(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?xa(e,t):t}function Tc(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function zc(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var cs=Symbol();function ga(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===cs?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ya(e,t){return typeof e=="function"?e(...t):!!e}function Pc(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var St,lt,Qt,Xi,_c=(Xi=class extends An{constructor(){super();H(this,St);H(this,lt);H(this,Qt);M(this,Qt,t=>{if(!Mt&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){g(this,lt)||this.setEventListener(g(this,Qt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,lt))==null||t.call(this),M(this,lt,void 0))}setEventListener(t){var n;M(this,Qt,t),(n=g(this,lt))==null||n.call(this),M(this,lt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){g(this,St)!==t&&(M(this,St,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof g(this,St)=="boolean"?g(this,St):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},St=new WeakMap,lt=new WeakMap,Qt=new WeakMap,Xi),us=new _c;function Ar(){let e,t;const n=new Promise((i,a)=>{e=i,t=a});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var Ac=Sc;function Rc(){let e=[],t=0,n=o=>{o()},r=o=>{o()},i=Ac;const a=o=>{t?e.push(o):i(()=>{n(o)})},l=()=>{const o=e;e=[],o.length&&i(()=>{r(()=>{o.forEach(c=>{n(c)})})})};return{batch:o=>{let c;t++;try{c=o()}finally{t--,t||l()}return c},batchCalls:o=>(...c)=>{a(()=>{o(...c)})},schedule:a,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var fe=Rc(),Kt,ot,Gt,Ji,Oc=(Ji=class extends An{constructor(){super();H(this,Kt,!0);H(this,ot);H(this,Gt);M(this,Gt,t=>{if(!Mt&&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,ot)||this.setEventListener(g(this,Gt))}onUnsubscribe(){var t;this.hasListeners()||((t=g(this,ot))==null||t.call(this),M(this,ot,void 0))}setEventListener(t){var n;M(this,Gt,t),(n=g(this,ot))==null||n.call(this),M(this,ot,t(this.setOnline.bind(this)))}setOnline(t){g(this,Kt)!==t&&(M(this,Kt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return g(this,Kt)}},Kt=new WeakMap,ot=new WeakMap,Gt=new WeakMap,Ji),Gn=new Oc;function Mc(e){return Math.min(1e3*2**e,3e4)}function ba(e){return(e??"online")==="online"?Gn.isOnline():!0}var Rr=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function va(e){let t=!1,n=0,r;const i=Ar(),a=()=>i.status!=="pending",l=j=>{var v;if(!a()){const y=new Rr(j);p(y),(v=e.onCancel)==null||v.call(e,y)}},o=()=>{t=!0},c=()=>{t=!1},u=()=>us.isFocused()&&(e.networkMode==="always"||Gn.isOnline())&&e.canRun(),d=()=>ba(e.networkMode)&&e.canRun(),h=j=>{a()||(r==null||r(),i.resolve(j))},p=j=>{a()||(r==null||r(),i.reject(j))},f=()=>new Promise(j=>{var v;r=y=>{(a()||u())&&j(y)},(v=e.onPause)==null||v.call(e)}).then(()=>{var j;r=void 0,a()||(j=e.onContinue)==null||j.call(e)}),b=()=>{if(a())return;let j;const v=n===0?e.initialPromise:void 0;try{j=v??e.fn()}catch(y){j=Promise.reject(y)}Promise.resolve(j).then(h).catch(y=>{var w;if(a())return;const k=e.retry??(Mt?0:3),E=e.retryDelay??Mc,T=typeof E=="function"?E(n,y):E,A=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,y);if(t||!A){p(y);return}n++,(w=e.onFail)==null||w.call(e,n,y),Ic(T).then(()=>u()?void 0:f()).then(()=>{t?p(y):b()})})};return{promise:i,status:()=>i.status,cancel:l,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:c,canStart:d,start:()=>(d()?b():f().then(b),i)}}var Ct,Zi,ja=(Zi=class{constructor(){H(this,Ct)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Tr(this.gcTime)&&M(this,Ct,kt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Mt?1/0:300*1e3))}clearGcTimeout(){g(this,Ct)&&(kt.clearTimeout(g(this,Ct)),M(this,Ct,void 0))}},Ct=new WeakMap,Zi),Et,Wt,Ie,It,de,In,Tt,De,Je,ea,Dc=(ea=class extends ja{constructor(t){super();H(this,De);H(this,Et);H(this,Wt);H(this,Ie);H(this,It);H(this,de);H(this,In);H(this,Tt);M(this,Tt,!1),M(this,In,t.defaultOptions),this.setOptions(t.options),this.observers=[],M(this,It,t.client),M(this,Ie,g(this,It).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,M(this,Et,qs(this.options)),this.state=t.state??g(this,Et),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=g(this,de))==null?void 0:t.promise}setOptions(t){if(this.options={...g(this,In),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=qs(this.options);n.data!==void 0&&(this.setState(Hs(n.data,n.dataUpdatedAt)),M(this,Et,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&g(this,Ie).remove(this)}setData(t,n){const r=_r(this.state.data,t,this.options);return G(this,De,Je).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){G(this,De,Je).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=g(this,de))==null?void 0:r.promise;return(i=g(this,de))==null||i.cancel(t),n?n.then(we).catch(we):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(g(this,Et))}isActive(){return this.observers.some(t=>Te(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===cs||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>mt(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:!ma(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,de))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=g(this,de))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),g(this,Ie).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,de)&&(g(this,Tt)?g(this,de).cancel({revert:!0}):g(this,de).cancelRetry()),this.scheduleGc()),g(this,Ie).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||G(this,De,Je).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,d,h,p,f,b,j,v,y,k,E;if(this.state.fetchStatus!=="idle"&&((c=g(this,de))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(g(this,de))return g(this,de).continueRetry(),g(this,de).promise}if(t&&this.setOptions(t),!this.options.queryFn){const T=this.observers.find(A=>A.options.queryFn);T&&this.setOptions(T.options)}const r=new AbortController,i=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(M(this,Tt,!0),r.signal)})},a=()=>{const T=ga(this.options,n),w=(()=>{const $={client:g(this,It),queryKey:this.queryKey,meta:this.meta};return i($),$})();return M(this,Tt,!1),this.options.persister?this.options.persister(T,w,this):T(w)},o=(()=>{const T={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:g(this,It),state:this.state,fetchFn:a};return i(T),T})();(u=this.options.behavior)==null||u.onFetch(o,this),M(this,Wt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&G(this,De,Je).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),M(this,de,va({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:T=>{T instanceof Rr&&T.revert&&this.setState({...g(this,Wt),fetchStatus:"idle"}),r.abort()},onFail:(T,A)=>{G(this,De,Je).call(this,{type:"failed",failureCount:T,error:A})},onPause:()=>{G(this,De,Je).call(this,{type:"pause"})},onContinue:()=>{G(this,De,Je).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const T=await g(this,de).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(f=(p=g(this,Ie).config).onSuccess)==null||f.call(p,T,this),(j=(b=g(this,Ie).config).onSettled)==null||j.call(b,T,this.state.error,this),T}catch(T){if(T instanceof Rr){if(T.silent)return g(this,de).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw G(this,De,Je).call(this,{type:"error",error:T}),(y=(v=g(this,Ie).config).onError)==null||y.call(v,T,this),(E=(k=g(this,Ie).config).onSettled)==null||E.call(k,this.state.data,T,this),T}finally{this.scheduleGc()}}},Et=new WeakMap,Wt=new WeakMap,Ie=new WeakMap,It=new WeakMap,de=new WeakMap,In=new WeakMap,Tt=new WeakMap,De=new WeakSet,Je=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,...wa(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...Hs(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return M(this,Wt,t.manual?i:void 0),i;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),fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),g(this,Ie).notify({query:this,type:"updated",action:t})})},ea);function wa(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ba(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Hs(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qs(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 je,W,Tn,xe,zt,Yt,Ze,ct,zn,Xt,Jt,Pt,_t,ut,Zt,J,yn,Or,Mr,Dr,Lr,Fr,Br,Ur,Na,ta,Lc=(ta=class extends An{constructor(t,n){super();H(this,J);H(this,je);H(this,W);H(this,Tn);H(this,xe);H(this,zt);H(this,Yt);H(this,Ze);H(this,ct);H(this,zn);H(this,Xt);H(this,Jt);H(this,Pt);H(this,_t);H(this,ut);H(this,Zt,new Set);this.options=n,M(this,je,t),M(this,ct,null),M(this,Ze,Ar()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(g(this,W).addObserver(this),$s(g(this,W),this.options)?G(this,J,yn).call(this):this.updateResult(),G(this,J,Lr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Hr(g(this,W),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Hr(g(this,W),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,G(this,J,Fr).call(this),G(this,J,Br).call(this),g(this,W).removeObserver(this)}setOptions(t){const n=this.options,r=g(this,W);if(this.options=g(this,je).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Te(this.options.enabled,g(this,W))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");G(this,J,Ur).call(this),g(this,W).setOptions(this.options),n._defaulted&&!zr(this.options,n)&&g(this,je).getQueryCache().notify({type:"observerOptionsUpdated",query:g(this,W),observer:this});const i=this.hasListeners();i&&Vs(g(this,W),r,this.options,n)&&G(this,J,yn).call(this),this.updateResult(),i&&(g(this,W)!==r||Te(this.options.enabled,g(this,W))!==Te(n.enabled,g(this,W))||mt(this.options.staleTime,g(this,W))!==mt(n.staleTime,g(this,W)))&&G(this,J,Or).call(this);const a=G(this,J,Mr).call(this);i&&(g(this,W)!==r||Te(this.options.enabled,g(this,W))!==Te(n.enabled,g(this,W))||a!==g(this,ut))&&G(this,J,Dr).call(this,a)}getOptimisticResult(t){const n=g(this,je).getQueryCache().build(g(this,je),t),r=this.createResult(n,t);return Bc(this,r)&&(M(this,xe,r),M(this,Yt,this.options),M(this,zt,g(this,W).state)),r}getCurrentResult(){return g(this,xe)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&g(this,Ze).status==="pending"&&g(this,Ze).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){g(this,Zt).add(t)}getCurrentQuery(){return g(this,W)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=g(this,je).defaultQueryOptions(t),r=g(this,je).getQueryCache().build(g(this,je),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return G(this,J,yn).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),g(this,xe)))}createResult(t,n){var B;const r=g(this,W),i=this.options,a=g(this,xe),l=g(this,zt),o=g(this,Yt),u=t!==r?t.state:g(this,Tn),{state:d}=t;let h={...d},p=!1,f;if(n._optimisticResults){const S=this.hasListeners(),I=!S&&$s(t,n),O=S&&Vs(t,r,n,i);(I||O)&&(h={...h,...wa(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:b,errorUpdatedAt:j,status:v}=h;f=h.data;let y=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let S;a!=null&&a.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(S=a.data,y=!0):S=typeof n.placeholderData=="function"?n.placeholderData((B=g(this,Jt))==null?void 0:B.state.data,g(this,Jt)):n.placeholderData,S!==void 0&&(v="success",f=_r(a==null?void 0:a.data,S,n),p=!0)}if(n.select&&f!==void 0&&!y)if(a&&f===(l==null?void 0:l.data)&&n.select===g(this,zn))f=g(this,Xt);else try{M(this,zn,n.select),f=n.select(f),f=_r(a==null?void 0:a.data,f,n),M(this,Xt,f),M(this,ct,null)}catch(S){M(this,ct,S)}g(this,ct)&&(b=g(this,ct),f=g(this,Xt),j=Date.now(),v="error");const k=h.fetchStatus==="fetching",E=v==="pending",T=v==="error",A=E&&k,w=f!==void 0,F={status:v,fetchStatus:h.fetchStatus,isPending:E,isSuccess:v==="success",isError:T,isInitialLoading:A,isLoading:A,data:f,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:j,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:k,isRefetching:k&&!E,isLoadingError:T&&!w,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:T&&w,isStale:ds(t,n),refetch:this.refetch,promise:g(this,Ze),isEnabled:Te(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const S=F.data!==void 0,I=F.status==="error"&&!S,O=P=>{I?P.reject(F.error):S&&P.resolve(F.data)},C=()=>{const P=M(this,Ze,F.promise=Ar());O(P)},R=g(this,Ze);switch(R.status){case"pending":t.queryHash===r.queryHash&&O(R);break;case"fulfilled":(I||F.data!==R.value)&&C();break;case"rejected":(!I||F.error!==R.reason)&&C();break}}return F}updateResult(){const t=g(this,xe),n=this.createResult(g(this,W),this.options);if(M(this,zt,g(this,W).state),M(this,Yt,this.options),g(this,zt).data!==void 0&&M(this,Jt,g(this,W)),zr(n,t))return;M(this,xe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!g(this,Zt).size)return!0;const l=new Set(a??g(this,Zt));return this.options.throwOnError&&l.add("error"),Object.keys(g(this,xe)).some(o=>{const c=o;return g(this,xe)[c]!==t[c]&&l.has(c)})};G(this,J,Na).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&G(this,J,Lr).call(this)}},je=new WeakMap,W=new WeakMap,Tn=new WeakMap,xe=new WeakMap,zt=new WeakMap,Yt=new WeakMap,Ze=new WeakMap,ct=new WeakMap,zn=new WeakMap,Xt=new WeakMap,Jt=new WeakMap,Pt=new WeakMap,_t=new WeakMap,ut=new WeakMap,Zt=new WeakMap,J=new WeakSet,yn=function(t){G(this,J,Ur).call(this);let n=g(this,W).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(we)),n},Or=function(){G(this,J,Fr).call(this);const t=mt(this.options.staleTime,g(this,W));if(Mt||g(this,xe).isStale||!Tr(t))return;const r=ma(g(this,xe).dataUpdatedAt,t)+1;M(this,Pt,kt.setTimeout(()=>{g(this,xe).isStale||this.updateResult()},r))},Mr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(g(this,W)):this.options.refetchInterval)??!1},Dr=function(t){G(this,J,Br).call(this),M(this,ut,t),!(Mt||Te(this.options.enabled,g(this,W))===!1||!Tr(g(this,ut))||g(this,ut)===0)&&M(this,_t,kt.setInterval(()=>{(this.options.refetchIntervalInBackground||us.isFocused())&&G(this,J,yn).call(this)},g(this,ut)))},Lr=function(){G(this,J,Or).call(this),G(this,J,Dr).call(this,G(this,J,Mr).call(this))},Fr=function(){g(this,Pt)&&(kt.clearTimeout(g(this,Pt)),M(this,Pt,void 0))},Br=function(){g(this,_t)&&(kt.clearInterval(g(this,_t)),M(this,_t,void 0))},Ur=function(){const t=g(this,je).getQueryCache().build(g(this,je),this.options);if(t===g(this,W))return;const n=g(this,W);M(this,W,t),M(this,Tn,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Na=function(t){fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(g(this,xe))}),g(this,je).getQueryCache().notify({query:g(this,W),type:"observerResultsUpdated"})})},ta);function Fc(e,t){return Te(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $s(e,t){return Fc(e,t)||e.state.data!==void 0&&Hr(e,t,t.refetchOnMount)}function Hr(e,t,n){if(Te(t.enabled,e)!==!1&&mt(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ds(e,t)}return!1}function Vs(e,t,n,r){return(e!==t||Te(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ds(e,n)}function ds(e,t){return Te(t.enabled,e)!==!1&&e.isStaleByTime(mt(t.staleTime,e))}function Bc(e,t){return!zr(e.getCurrentResult(),t)}function Qs(e){return{onFetch:(t,n)=>{var d,h,p,f,b;const r=t.options,i=(p=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,a=((f=t.state.data)==null?void 0:f.pages)||[],l=((b=t.state.data)==null?void 0:b.pageParams)||[];let o={pages:[],pageParams:[]},c=0;const u=async()=>{let j=!1;const v=E=>{Pc(E,()=>t.signal,()=>j=!0)},y=ga(t.options,t.fetchOptions),k=async(E,T,A)=>{if(j)return Promise.reject();if(T==null&&E.pages.length)return Promise.resolve(E);const $=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:T,direction:A?"backward":"forward",meta:t.options.meta};return v(I),I})(),F=await y($),{maxPages:B}=t.options,S=A?zc:Tc;return{pages:S(E.pages,F,B),pageParams:S(E.pageParams,T,B)}};if(i&&a.length){const E=i==="backward",T=E?Uc:Ks,A={pages:a,pageParams:l},w=T(r,A);o=await k(A,w,E)}else{const E=e??a.length;do{const T=c===0?l[0]??r.initialPageParam:Ks(r,o);if(c>0&&T==null)break;o=await k(o,T),c++}while(c<E)}return o};t.options.persister?t.fetchFn=()=>{var j,v;return(v=(j=t.options).persister)==null?void 0:v.call(j,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Ks(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 Uc(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}var Pn,He,pe,At,qe,it,na,Hc=(na=class extends ja{constructor(t){super();H(this,qe);H(this,Pn);H(this,He);H(this,pe);H(this,At);M(this,Pn,t.client),this.mutationId=t.mutationId,M(this,pe,t.mutationCache),M(this,He,[]),this.state=t.state||qc(),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,He).includes(t)||(g(this,He).push(t),this.clearGcTimeout(),g(this,pe).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){M(this,He,g(this,He).filter(n=>n!==t)),this.scheduleGc(),g(this,pe).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){g(this,He).length||(this.state.status==="pending"?this.scheduleGc():g(this,pe).remove(this))}continue(){var t;return((t=g(this,At))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,o,c,u,d,h,p,f,b,j,v,y,k,E,T,A,w,$;const n=()=>{G(this,qe,it).call(this,{type:"continue"})},r={client:g(this,Pn),meta:this.options.meta,mutationKey:this.options.mutationKey};M(this,At,va({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,B)=>{G(this,qe,it).call(this,{type:"failed",failureCount:F,error:B})},onPause:()=>{G(this,qe,it).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>g(this,pe).canRun(this)}));const i=this.state.status==="pending",a=!g(this,At).canStart();try{if(i)n();else{G(this,qe,it).call(this,{type:"pending",variables:t,isPaused:a}),g(this,pe).config.onMutate&&await g(this,pe).config.onMutate(t,this,r);const B=await((o=(l=this.options).onMutate)==null?void 0:o.call(l,t,r));B!==this.state.context&&G(this,qe,it).call(this,{type:"pending",context:B,variables:t,isPaused:a})}const F=await g(this,At).start();return await((u=(c=g(this,pe).config).onSuccess)==null?void 0:u.call(c,F,t,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,F,t,this.state.context,r)),await((f=(p=g(this,pe).config).onSettled)==null?void 0:f.call(p,F,null,this.state.variables,this.state.context,this,r)),await((j=(b=this.options).onSettled)==null?void 0:j.call(b,F,null,t,this.state.context,r)),G(this,qe,it).call(this,{type:"success",data:F}),F}catch(F){try{await((y=(v=g(this,pe).config).onError)==null?void 0:y.call(v,F,t,this.state.context,this,r))}catch(B){Promise.reject(B)}try{await((E=(k=this.options).onError)==null?void 0:E.call(k,F,t,this.state.context,r))}catch(B){Promise.reject(B)}try{await((A=(T=g(this,pe).config).onSettled)==null?void 0:A.call(T,void 0,F,this.state.variables,this.state.context,this,r))}catch(B){Promise.reject(B)}try{await(($=(w=this.options).onSettled)==null?void 0:$.call(w,void 0,F,t,this.state.context,r))}catch(B){Promise.reject(B)}throw G(this,qe,it).call(this,{type:"error",error:F}),F}finally{g(this,pe).runNext(this)}}},Pn=new WeakMap,He=new WeakMap,pe=new WeakMap,At=new WeakMap,qe=new WeakSet,it=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),fe.batch(()=>{g(this,He).forEach(r=>{r.onMutationUpdate(t)}),g(this,pe).notify({mutation:this,type:"updated",action:t})})},na);function qc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var et,Le,_n,ra,$c=(ra=class extends An{constructor(t={}){super();H(this,et);H(this,Le);H(this,_n);this.config=t,M(this,et,new Set),M(this,Le,new Map),M(this,_n,0)}build(t,n,r){const i=new Hc({client:t,mutationCache:this,mutationId:++Dn(this,_n)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){g(this,et).add(t);const n=Ln(t);if(typeof n=="string"){const r=g(this,Le).get(n);r?r.push(t):g(this,Le).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(g(this,et).delete(t)){const n=Ln(t);if(typeof n=="string"){const r=g(this,Le).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&g(this,Le).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ln(t);if(typeof n=="string"){const r=g(this,Le).get(n),i=r==null?void 0:r.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Ln(t);if(typeof n=="string"){const i=(r=g(this,Le).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){fe.batch(()=>{g(this,et).forEach(t=>{this.notify({type:"removed",mutation:t})}),g(this,et).clear(),g(this,Le).clear()})}getAll(){return Array.from(g(this,et))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Fs(n,r))}findAll(t={}){return this.getAll().filter(n=>Fs(t,n))}notify(t){fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(we))))}},et=new WeakMap,Le=new WeakMap,_n=new WeakMap,ra);function Ln(e){var t;return(t=e.options.scope)==null?void 0:t.id}var $e,sa,Vc=(sa=class extends An{constructor(t={}){super();H(this,$e);this.config=t,M(this,$e,new Map)}build(t,n,r){const i=n.queryKey,a=n.queryHash??os(i,n);let l=this.get(a);return l||(l=new Dc({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(l)),l}add(t){g(this,$e).has(t.queryHash)||(g(this,$e).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=g(this,$e).get(t.queryHash);n&&(t.destroy(),n===t&&g(this,$e).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return g(this,$e).get(t)}getAll(){return[...g(this,$e).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ls(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ls(t,r)):n}notify(t){fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},$e=new WeakMap,sa),ae,dt,ht,en,tn,ft,nn,rn,ia,Qc=(ia=class{constructor(e={}){H(this,ae);H(this,dt);H(this,ht);H(this,en);H(this,tn);H(this,ft);H(this,nn);H(this,rn);M(this,ae,e.queryCache||new Vc),M(this,dt,e.mutationCache||new $c),M(this,ht,e.defaultOptions||{}),M(this,en,new Map),M(this,tn,new Map),M(this,ft,0)}mount(){Dn(this,ft)._++,g(this,ft)===1&&(M(this,nn,us.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ae).onFocus())})),M(this,rn,Gn.subscribe(async e=>{e&&(await this.resumePausedMutations(),g(this,ae).onOnline())})))}unmount(){var e,t;Dn(this,ft)._--,g(this,ft)===0&&((e=g(this,nn))==null||e.call(this),M(this,nn,void 0),(t=g(this,rn))==null||t.call(this),M(this,rn,void 0))}isFetching(e){return g(this,ae).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return g(this,dt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=g(this,ae).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=g(this,ae).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(mt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return g(this,ae).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=g(this,ae).get(r.queryHash),a=i==null?void 0:i.state.data,l=Cc(t,a);if(l!==void 0)return g(this,ae).build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return fe.batch(()=>g(this,ae).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,ae).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=g(this,ae);fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=g(this,ae);return fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=fe.batch(()=>g(this,ae).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(we).catch(we)}invalidateQueries(e,t={}){return fe.batch(()=>(g(this,ae).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=fe.batch(()=>g(this,ae).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,n);return n.throwOnError||(a=a.catch(we)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(we)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=g(this,ae).build(this,t);return n.isStaleByTime(mt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(we).catch(we)}fetchInfiniteQuery(e){return e.behavior=Qs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(we).catch(we)}ensureInfiniteQueryData(e){return e.behavior=Qs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Gn.isOnline()?g(this,dt).resumePausedMutations():Promise.resolve()}getQueryCache(){return g(this,ae)}getMutationCache(){return g(this,dt)}getDefaultOptions(){return g(this,ht)}setDefaultOptions(e){M(this,ht,e)}setQueryDefaults(e,t){g(this,en).set(Sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...g(this,en).values()],n={};return t.forEach(r=>{Cn(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){g(this,tn).set(Sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...g(this,tn).values()],n={};return t.forEach(r=>{Cn(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...g(this,ht).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=os(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===cs&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...g(this,ht).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){g(this,ae).clear(),g(this,dt).clear()}},ae=new WeakMap,dt=new WeakMap,ht=new WeakMap,en=new WeakMap,tn=new WeakMap,ft=new WeakMap,nn=new WeakMap,rn=new WeakMap,ia),ka=L.createContext(void 0),Kc=e=>{const t=L.useContext(ka);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Gc=({client:e,children:t})=>(L.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(ka.Provider,{value:e,children:t})),Sa=L.createContext(!1),Wc=()=>L.useContext(Sa);Sa.Provider;function Yc(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Xc=L.createContext(Yc()),Jc=()=>L.useContext(Xc),Zc=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ya(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},eu=e=>{L.useEffect(()=>{e.clearReset()},[e])},tu=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ya(n,[e.error,r])),nu=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ru=(e,t)=>e.isLoading&&e.isFetching&&!t,su=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Gs=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function iu(e,t,n){var p,f,b,j;const r=Wc(),i=Jc(),a=Kc(),l=a.defaultQueryOptions(e);(f=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,l);const o=a.getQueryCache().get(l.queryHash);l._optimisticResults=r?"isRestoring":"optimistic",nu(l),Zc(l,i,o),eu(i);const c=!a.getQueryCache().get(l.queryHash),[u]=L.useState(()=>new t(a,l)),d=u.getOptimisticResult(l),h=!r&&e.subscribed!==!1;if(L.useSyncExternalStore(L.useCallback(v=>{const y=h?u.subscribe(fe.batchCalls(v)):we;return u.updateResult(),y},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),L.useEffect(()=>{u.setOptions(l)},[l,u]),su(l,d))throw Gs(l,u,i);if(tu({result:d,errorResetBoundary:i,throwOnError:l.throwOnError,query:o,suspense:l.suspense}))throw d.error;if((j=(b=a.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||j.call(b,l,d),l.experimental_prefetchInRender&&!Mt&&ru(d,r)){const v=c?Gs(l,u,i):o==null?void 0:o.promise;v==null||v.catch(we).finally(()=>{u.updateResult()})}return l.notifyOnChangeProps?d:u.trackResult(d)}function ir(e,t){return iu(e,Lc)}function D(...e){return Pl(_l(e))}const au=Zn("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function U({className:e,variant:t="default",render:n,...r}){return Xn({defaultTagName:"span",props:Jn({className:D(au({variant:t}),e)},r),render:n,state:{slot:"badge",variant:t}})}const Ca=Al,Ea=Rl,Ia=Ol;function lu({className:e,type:t,...n}){return s.jsx(Ml,{type:t,"data-slot":"input",className:D("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}const fr=768;function ou(){const[e,t]=L.useState(void 0);return L.useEffect(()=>{const n=window.matchMedia(`(max-width: ${fr-1}px)`),r=()=>{t(window.innerWidth<fr)};return n.addEventListener("change",r),t(window.innerWidth<fr),()=>n.removeEventListener("change",r)},[]),!!e}const cu=Zn("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ye({className:e,variant:t="default",size:n="default",...r}){return s.jsx(Dl,{"data-slot":"button",className:D(cu({variant:t,size:n,className:e})),...r})}function uu({className:e,orientation:t="horizontal",...n}){return s.jsx(Ll,{"data-slot":"separator",orientation:t,className:D("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...n})}function du({...e}){return s.jsx(Fl,{"data-slot":"sheet",...e})}function hu({...e}){return s.jsx($l,{"data-slot":"sheet-portal",...e})}function fu({className:e,...t}){return s.jsx(Vl,{"data-slot":"sheet-overlay",className:D("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function pu({className:e,children:t,side:n="right",showCloseButton:r=!0,...i}){return s.jsxs(hu,{children:[s.jsx(fu,{}),s.jsxs(Bl,{"data-slot":"sheet-content","data-side":n,className:D("fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...i,children:[t,r&&s.jsxs(Ul,{"data-slot":"sheet-close",render:s.jsx(ye,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[s.jsx(la,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function mu({className:e,...t}){return s.jsx("div",{"data-slot":"sheet-header",className:D("flex flex-col gap-0.5 p-4",e),...t})}function xu({className:e,...t}){return s.jsx(Hl,{"data-slot":"sheet-title",className:D("text-base font-medium text-foreground",e),...t})}function gu({className:e,...t}){return s.jsx(ql,{"data-slot":"sheet-description",className:D("text-sm text-muted-foreground",e),...t})}function Qe({className:e,...t}){return s.jsx("div",{"data-slot":"skeleton",className:D("animate-pulse rounded-md bg-muted",e),...t})}function yu({delay:e=0,...t}){return s.jsx(Ql,{"data-slot":"tooltip-provider",delay:e,...t})}function jt({...e}){return s.jsx(Kl,{"data-slot":"tooltip",...e})}function wt({...e}){return s.jsx(Jl,{"data-slot":"tooltip-trigger",...e})}function Nt({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:i=0,children:a,...l}){return s.jsx(Gl,{children:s.jsx(Wl,{align:r,alignOffset:i,side:t,sideOffset:n,className:"isolate z-50",children:s.jsxs(Yl,{"data-slot":"tooltip-content",className:D("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...l,children:[a,s.jsx(Xl,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const bu="sidebar_state",vu=3600*24*7,ju="16rem",wu="18rem",Nu="3rem",ku="b",Ta=L.createContext(null);function hs(){const e=L.useContext(Ta);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Su({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...l}){const o=ou(),[c,u]=L.useState(!1),[d,h]=L.useState(e),p=t??d,f=L.useCallback(y=>{const k=typeof y=="function"?y(p):y;n?n(k):h(k),document.cookie=`${bu}=${k}; path=/; max-age=${vu}`},[n,p]),b=L.useCallback(()=>o?u(y=>!y):f(y=>!y),[o,f,u]);L.useEffect(()=>{const y=k=>{k.key===ku&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),b())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[b]);const j=p?"expanded":"collapsed",v=L.useMemo(()=>({state:j,open:p,setOpen:f,isMobile:o,openMobile:c,setOpenMobile:u,toggleSidebar:b}),[j,p,f,o,c,u,b]);return s.jsx(Ta.Provider,{value:v,children:s.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":ju,"--sidebar-width-icon":Nu,...i},className:D("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",r),...l,children:a})})}function Cu({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:i,dir:a,...l}){const{isMobile:o,state:c,openMobile:u,setOpenMobile:d}=hs();return n==="none"?s.jsx("div",{"data-slot":"sidebar",className:D("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",r),...l,children:i}):o?s.jsx(du,{open:u,onOpenChange:d,...l,children:s.jsxs(pu,{dir:a,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":wu},side:e,children:[s.jsxs(mu,{className:"sr-only",children:[s.jsx(xu,{children:"Sidebar"}),s.jsx(gu,{children:"Displays the mobile sidebar."})]}),s.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):s.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":c,"data-collapsible":c==="collapsed"?n:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[s.jsx("div",{"data-slot":"sidebar-gap",className:D("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),s.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:D("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...l,children:s.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:i})})]})}function Eu({className:e,onClick:t,...n}){const{toggleSidebar:r}=hs();return s.jsxs(ye,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:D(e),onClick:i=>{t==null||t(i),r()},...n,children:[s.jsx(Zl,{}),s.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Iu({className:e,...t}){return s.jsx("main",{"data-slot":"sidebar-inset",className:D("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function Tu({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:D("flex flex-col gap-2 p-2",e),...t})}function zu({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:D("flex flex-col gap-2 p-2",e),...t})}function Pu({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:D("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Ws({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:D("relative flex w-full min-w-0 flex-col p-2",e),...t})}function _u({className:e,render:t,...n}){return Xn({defaultTagName:"div",props:Jn({className:D("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},n),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function Ys({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:D("w-full text-sm",e),...t})}function pr({className:e,...t}){return s.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:D("flex w-full min-w-0 flex-col gap-0",e),...t})}function qn({className:e,...t}){return s.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:D("group/menu-item relative",e),...t})}const Au=Zn("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function $n({render:e,isActive:t=!1,variant:n="default",size:r="default",tooltip:i,className:a,...l}){const{isMobile:o,state:c}=hs(),u=Xn({defaultTagName:"button",props:Jn({className:D(Au({variant:n,size:r}),a)},l),render:i?s.jsx(wt,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:r,active:t}});return i?(typeof i=="string"&&(i={children:i}),s.jsxs(jt,{children:[u,s.jsx(Nt,{side:"right",align:"center",hidden:c!=="collapsed"||o,...i})]})):u}function Ru({className:e,...t}){return s.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:D("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",e),...t})}function Ou({className:e,...t}){return s.jsx("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:D("group/menu-sub-item relative",e),...t})}function Mu({render:e,size:t="md",isActive:n=!1,className:r,...i}){return Xn({defaultTagName:"a",props:Jn({className:D("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",r)},i),render:e,state:{slot:"sidebar-menu-sub-button",sidebar:"menu-sub-button",size:t,active:n}})}function fs(e,t){return t<5?"UNGRADED":e>=.8?"HEALTHY":e>=.5?"WARNING":"CRITICAL"}function xt(e){return e==null?"--":`${Math.round(e*100)}%`}function za(e){return[...e].sort((t,n)=>{const r=t.passRate??1,i=n.passRate??1;return r!==i?r-i:n.checks-t.checks})}function be(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}const Pa={HEALTHY:s.jsx(nt,{className:"size-3.5 text-emerald-600"}),WARNING:s.jsx(Rt,{className:"size-3.5 text-amber-500"}),CRITICAL:s.jsx(Be,{className:"size-3.5 text-red-500"}),UNGRADED:s.jsx(gt,{className:"size-3.5 text-muted-foreground"}),UNKNOWN:s.jsx(ss,{className:"size-3.5 text-muted-foreground/60"})},Du={project:{label:"Project",icon:s.jsx(to,{className:"size-4"})},global:{label:"Global",icon:s.jsx(Hn,{className:"size-4"})},system:{label:"System",icon:s.jsx(Hn,{className:"size-4"})},admin:{label:"Admin",icon:s.jsx(Hn,{className:"size-4"})}};function Lu({scope:e,skills:t,pathname:n,defaultOpen:r}){const i=Du[e]??{label:e,icon:s.jsx(Hn,{className:"size-4"})},a=t.some(c=>n===`/skills/${encodeURIComponent(c.name)}`),[l,o]=L.useState(r||a);return L.useEffect(()=>{a&&o(!0)},[a]),s.jsx(Ca,{open:l,onOpenChange:o,className:"group/collapsible",children:s.jsxs(qn,{children:[s.jsxs(Ea,{render:s.jsx($n,{tooltip:i.label}),children:[i.icon,s.jsx("span",{children:i.label}),s.jsx(U,{variant:"secondary",className:"ml-auto h-4 px-1.5 text-[10px]",children:t.length}),s.jsx(an,{className:"ml-1 size-4 shrink-0 transition-transform duration-200 group-data-[open]/collapsible:rotate-90"})]}),s.jsx(Ia,{children:s.jsx(Ru,{children:t.map(c=>{const u=n===`/skills/${encodeURIComponent(c.name)}`;return s.jsx(Ou,{children:s.jsxs(Mu,{isActive:u,render:s.jsx(qt,{to:`/skills/${encodeURIComponent(c.name)}`}),children:[Pa[c.status],s.jsx("span",{className:"truncate",children:c.name}),s.jsx(U,{variant:c.status==="CRITICAL"?"destructive":c.status==="HEALTHY"?"outline":"secondary",className:"ml-auto h-4 text-[10px] px-1.5 shrink-0",children:xt(c.passRate)})]})},c.name)})})})]})})}function Fu({skills:e,search:t,onSearchChange:n,version:r,...i}){const a=Cl(),l=L.useMemo(()=>{const c={};for(const p of e){const f=p.scope??"unknown";c[f]||(c[f]=[]),c[f].push(p)}const u=["project","global","system","admin","unknown"],d=u.filter(p=>{var f;return(f=c[p])==null?void 0:f.length}).map(p=>({scope:p,skills:c[p]})),h=Object.keys(c).filter(p=>!u.includes(p)).sort().map(p=>({scope:p,skills:c[p]}));return[...d,...h]},[e]),o=l.length>1;return s.jsxs(Cu,{collapsible:"offcanvas",...i,children:[s.jsx(Tu,{children:s.jsx(pr,{children:s.jsx(qn,{children:s.jsxs($n,{className:"data-[slot=sidebar-menu-button]:!p-1.5",render:s.jsx(qt,{to:"/"}),children:[s.jsx("div",{className:"size-5 bg-current",style:{mask:"url(/logo.svg) center/contain no-repeat",WebkitMask:"url(/logo.svg) center/contain no-repeat"},"aria-hidden":"true"}),s.jsxs("span",{className:"text-base font-semibold",children:["self",s.jsx("span",{className:"text-primary-accent",children:"tune"})]})]})})})}),s.jsxs(Pu,{children:[s.jsx(Ws,{children:s.jsx(Ys,{children:s.jsxs("div",{className:"relative",children:[s.jsx(eo,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),s.jsx(lu,{"aria-label":"Filter skills",placeholder:"Filter skills...",value:t,onChange:c=>n(c.target.value),className:"h-8 pl-8 text-sm"})]})})}),s.jsxs(Ws,{className:"flex-1",children:[s.jsx(_u,{children:"Skills"}),s.jsx(Ys,{children:s.jsxs(pr,{children:[o?l.map(({scope:c,skills:u})=>s.jsx(Lu,{scope:c,skills:u,pathname:a.pathname,defaultOpen:c==="project"},c)):e.map(c=>{const u=a.pathname===`/skills/${encodeURIComponent(c.name)}`;return s.jsx(qn,{children:s.jsxs($n,{isActive:u,tooltip:`${c.name} — ${xt(c.passRate)}`,render:s.jsx(qt,{to:`/skills/${encodeURIComponent(c.name)}`}),children:[Pa[c.status],s.jsx("span",{className:"truncate",children:c.name}),s.jsx(U,{variant:c.status==="CRITICAL"?"destructive":c.status==="HEALTHY"?"outline":"secondary",className:"ml-auto h-4 text-[10px] px-1.5 shrink-0",children:xt(c.passRate)})]})},c.name)}),e.length===0&&s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No skills match"})]})})]})]}),s.jsxs(zu,{children:[s.jsx(pr,{children:s.jsx(qn,{children:s.jsxs($n,{isActive:a.pathname==="/status",tooltip:"System Status",render:s.jsx(qt,{to:"/status"}),children:[s.jsx(oa,{className:"size-4"}),s.jsx("span",{children:"System Status"})]})})}),s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground",children:[s.jsx(sn,{className:"size-3"}),s.jsxs("span",{children:["selftune",r?` v${r}`:""]})]})]})]})}const _a=L.createContext(void 0),Aa="selftune-theme",Bu=["dark","light","system"];function Uu(e){const t=localStorage.getItem(Aa);return Bu.includes(t)?t:e}function Hu({children:e,defaultTheme:t="dark"}){const[n,r]=L.useState(()=>Uu(t));return L.useEffect(()=>{const i=window.document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)"),l=o=>{i.classList.remove("light","dark"),i.classList.add(o)};if(n==="system"){const o=()=>l(a.matches?"dark":"light");return o(),a.addEventListener("change",o),()=>a.removeEventListener("change",o)}l(n)},[n]),s.jsx(_a.Provider,{value:{theme:n,setTheme:i=>{localStorage.setItem(Aa,i),r(i)}},children:e})}function qu(){const e=L.useContext(_a);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e}function $u(){const{theme:e,setTheme:t}=qu();return s.jsxs(ye,{variant:"ghost",size:"icon",className:"relative size-8",onClick:()=>t(e==="dark"?"light":"dark"),children:[s.jsx(no,{className:"size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),s.jsx(ro,{className:"absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),s.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function ps(){return s.jsx("header",{className:"flex h-10 shrink-0 items-center gap-2 bg-background transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-10",children:s.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:px-6",children:[s.jsx(Eu,{className:"-ml-1"}),s.jsx(uu,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),s.jsx("div",{className:"ml-auto",children:s.jsx($u,{})})]})})}function Z({className:e,size:t="default",...n}){return s.jsx("div",{"data-slot":"card","data-size":t,className:D("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function ee({className:e,...t}){return s.jsx("div",{"data-slot":"card-header",className:D("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",e),...t})}function te({className:e,...t}){return s.jsx("div",{"data-slot":"card-title",className:D("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function ie({className:e,...t}){return s.jsx("div",{"data-slot":"card-description",className:D("text-sm text-muted-foreground",e),...t})}function pt({className:e,...t}){return s.jsx("div",{"data-slot":"card-action",className:D("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function Fe({className:e,...t}){return s.jsx("div",{"data-slot":"card-content",className:D("px-4 group-data-[size=sm]/card:px-3",e),...t})}function ms({className:e,orientation:t="horizontal",...n}){return s.jsx(so,{"data-slot":"tabs","data-orientation":t,className:D("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Vu=Zn("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function xs({className:e,variant:t="default",...n}){return s.jsx(io,{"data-slot":"tabs-list","data-variant":t,className:D(Vu({variant:t}),e),...n})}function Pe({className:e,...t}){return s.jsx(ao,{"data-slot":"tabs-trigger",className:D("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function tt({className:e,...t}){return s.jsx(lo,{"data-slot":"tabs-content",className:D("flex-1 text-sm outline-none",e),...t})}const Xs={created:"outline",validated:"secondary",deployed:"default",rejected:"destructive",rolled_back:"destructive",pending:"secondary"};function Qu({evolution:e,pendingProposals:t,unmatchedQueries:n}){return e.length>0||t.length>0||n.length>0?s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsxs(te,{className:"flex items-center gap-2 text-sm",children:[s.jsx(sn,{className:"size-4"}),"Activity"]}),s.jsx(ie,{children:"Recent evolution events and queries"})]}),s.jsx(Fe,{children:s.jsxs(ms,{defaultValue:t.length>0?"pending":e.length>0?"timeline":"unmatched",children:[s.jsxs(xs,{className:"w-full",children:[t.length>0&&s.jsxs(Pe,{value:"pending",className:"flex-1 gap-1.5",children:[s.jsx(oo,{className:"size-3.5"}),"Pending",s.jsx(U,{variant:"secondary",className:"ml-1 h-4 px-1.5 text-[10px]",children:t.length})]}),s.jsxs(Pe,{value:"timeline",className:"flex-1 gap-1.5",children:[s.jsx(is,{className:"size-3.5"}),"Timeline"]}),n.length>0&&s.jsxs(Pe,{value:"unmatched",className:"flex-1 gap-1.5",children:[s.jsx(ca,{className:"size-3.5"}),"Unmatched",s.jsx(U,{variant:"destructive",className:"ml-1 h-4 px-1.5 text-[10px]",children:n.length})]})]}),t.length>0&&s.jsx(tt,{value:"pending",className:"mt-4 space-y-3",children:t.slice(0,10).map(i=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"mt-1 size-2 shrink-0 rounded-full bg-amber-400"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(U,{variant:Xs[i.action]??"secondary",className:"text-[10px]",children:i.action}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:be(i.timestamp)})]}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:i.details})]})]},i.proposal_id))}),s.jsxs(tt,{value:"timeline",className:"mt-4 space-y-3",children:[e.slice(0,30).map((i,a)=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:`mt-1 size-2 shrink-0 rounded-full ${i.action==="deployed"?"bg-emerald-500":i.action==="rejected"||i.action==="rolled_back"?"bg-red-500":i.action==="validated"?"bg-amber-400":"bg-primary-accent"}`}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(U,{variant:Xs[i.action]??"secondary",className:"text-[10px]",children:i.action}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:be(i.timestamp)})]}),s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:i.details}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:["#",i.proposal_id.slice(0,8)]})]})]},`${i.proposal_id}-${a}`)),e.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No timeline events"})]}),n.length>0&&s.jsx(tt,{value:"unmatched",className:"mt-4 space-y-2",children:n.slice(0,15).map((i,a)=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"mt-1 size-2 shrink-0 rounded-full bg-muted-foreground/40"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:be(i.timestamp)}),s.jsx("p",{className:"text-xs font-mono text-foreground/80 line-clamp-2",children:i.query})]})]},`${i.session_id}-${a}`))})]})})]}):s.jsxs(Z,{children:[s.jsx(ee,{children:s.jsxs(te,{className:"flex items-center gap-2 text-sm",children:[s.jsx(sn,{className:"size-4"}),"Activity"]})}),s.jsx(Fe,{children:s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No recent activity"})})]})}const Ku={evolve:s.jsx(uo,{className:"size-3 text-amber-500"}),watch:s.jsx(as,{className:"size-3 text-blue-500"}),skip:s.jsx(co,{className:"size-3 text-muted-foreground"})};function Js({action:e}){return s.jsxs("div",{className:"flex items-start gap-2 py-1",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:Ku[e.action]??null}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium truncate",children:e.skill}),s.jsx(U,{variant:e.rolledBack?"destructive":e.action==="evolve"&&e.deployed?"default":e.action==="evolve"?"secondary":e.action==="watch"?"outline":"secondary",className:"text-[10px] h-4 px-1.5 shrink-0",children:e.rolledBack?"rolled back":e.action==="evolve"&&e.deployed?"deployed":e.action==="evolve"?"evolved":e.action}),e.alert&&s.jsx(U,{variant:"destructive",className:"text-[10px] h-4 px-1.5 shrink-0",children:"alert"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:e.reason})]})]})}function Gu({run:e}){const[t,n]=L.useState(!1),r=e.skill_actions.filter(a=>a.action!=="skip"),i=e.skill_actions.filter(a=>a.action==="skip");return s.jsxs(Ca,{open:t,onOpenChange:n,children:[s.jsx(Ea,{className:"w-full text-left",children:s.jsxs("div",{className:"flex items-start gap-3 py-2 hover:bg-muted/50 rounded-md px-2 -mx-2 transition-colors",children:[s.jsx("div",{className:`mt-1.5 size-2 shrink-0 rounded-full ${e.deployed>0?"bg-emerald-500":e.evolved>0?"bg-amber-400":"bg-muted-foreground/40"}`}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:be(e.timestamp)}),e.dry_run&&s.jsx(U,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:"dry-run"}),e.approval_mode==="review"&&s.jsx(U,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:"review"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[e.deployed>0&&s.jsxs("span",{className:"text-emerald-600 font-medium",children:[e.deployed," deployed"]}),e.evolved>0&&s.jsxs("span",{children:[e.evolved," evolved"]}),e.watched>0&&s.jsxs("span",{children:[e.watched," watched"]}),e.skipped>0&&s.jsxs("span",{children:[e.skipped," skipped"]}),s.jsxs("span",{children:[(e.elapsed_ms/1e3).toFixed(1),"s"]})]})]}),s.jsx(an,{className:`size-4 text-muted-foreground shrink-0 mt-1 transition-transform duration-200 ${t?"rotate-90":""}`})]})}),s.jsx(Ia,{children:s.jsxs("div",{className:"ml-5 pl-3 border-l border-border space-y-0.5 pb-2",children:[r.map((a,l)=>s.jsx(Js,{action:a},`${a.skill}-${l}`)),i.length>0&&s.jsxs("details",{className:"group",children:[s.jsxs("summary",{className:"text-[11px] text-muted-foreground cursor-pointer hover:text-foreground py-1",children:[i.length," skipped"]}),s.jsx("div",{className:"space-y-0.5",children:i.map((a,l)=>s.jsx(Js,{action:a},`${a.skill}-skip-${l}`))})]})]})})]})}function Wu({runs:e}){if(e.length===0)return s.jsxs(Z,{children:[s.jsx(ee,{children:s.jsxs(te,{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ds,{className:"size-4"}),"Orchestrate Runs"]})}),s.jsx(Fe,{children:s.jsxs("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No orchestrate runs yet. Run ",s.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"selftune orchestrate"})," to start."]})})]});const t=e.reduce((n,r)=>n+r.deployed,0);return s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsxs(te,{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ds,{className:"size-4"}),"Orchestrate Runs"]}),s.jsxs(ie,{children:[e.length," recent run",e.length!==1?"s":"",t>0&&s.jsxs(s.Fragment,{children:[" · ",t," total deployments"]})]})]}),s.jsx(Fe,{className:"space-y-0",children:e.slice(0,10).map(n=>s.jsx(Gu,{run:n},n.run_id))})]})}function ge({text:e}){return s.jsxs(jt,{children:[s.jsx(wt,{className:"inline-flex items-center text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-help",onClick:t=>t.preventDefault(),children:s.jsx(ua,{className:"size-3"})}),s.jsx(Nt,{side:"top",className:"max-w-[220px]",children:e})]})}function Yu({skillsCount:e,avgPassRate:t,unmatchedCount:n,sessionsCount:r,pendingCount:i,evidenceCount:a}){const l=t!==null?`${Math.round(t*100)}%`:"--",o=t!==null&&t>=.7;return s.jsxs("div",{className:"grid grid-cols-1 gap-4 px-4 *:data-[slot=card]:shadow-xs lg:px-6 @xl/main:grid-cols-2 @5xl/main:grid-cols-3",children:[s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(er,{className:"size-3.5"}),"Skills Monitored",s.jsx(ge,{text:"Total number of skills detected and being tracked by selftune"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:e}),s.jsx(pt,{children:s.jsxs(U,{variant:"outline",children:[s.jsx(sn,{className:"size-3"}),"live"]})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(da,{className:"size-3.5"}),"Avg Pass Rate",s.jsx(ge,{text:"Average percentage of eval test cases that passed across all graded skills (5+ checks)"})]}),s.jsx(te,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${!o&&t!==null?"text-red-600":""}`,children:l}),t!==null&&s.jsx(pt,{children:s.jsxs(U,{variant:o?"outline":"destructive",children:[o?s.jsx(tr,{className:"size-3"}):s.jsx(nr,{className:"size-3"}),l]})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(ca,{className:"size-3.5"}),"Unmatched Queries",s.jsx(ge,{text:"User prompts that didn't match any skill's trigger criteria — potential gaps in coverage"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:n}),n>0&&s.jsx(pt,{children:s.jsxs(U,{variant:"destructive",children:[s.jsx(Rt,{className:"size-3"}),"needs attention"]})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"size-3.5"}),"Sessions",s.jsx(ge,{text:"Total agent sessions that have been recorded and analyzed"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:r})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(Rt,{className:"size-3.5"}),"Pending Proposals",s.jsx(ge,{text:"Evolution proposals that have been generated but not yet validated or deployed"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:i}),i>0&&s.jsx(pt,{children:s.jsx(U,{variant:"secondary",children:"awaiting review"})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(as,{className:"size-3.5"}),"Total Evidence",s.jsx(ge,{text:"Number of evidence entries documenting skill changes with before/after validation results"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:a})]})})]})}function Zs({className:e,...t}){return s.jsx(ho,{"data-slot":"checkbox",className:D("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",e),...t,children:s.jsx(fo,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:s.jsx(rr,{})})})}function ei({...e}){return s.jsx(po,{"data-slot":"dropdown-menu",...e})}function ti({...e}){return s.jsx(mo,{"data-slot":"dropdown-menu-trigger",...e})}function ni({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...a}){return s.jsx(xo,{children:s.jsx(go,{className:"isolate z-50 outline-hidden",align:e,alignOffset:t,side:n,sideOffset:r,children:s.jsx(yo,{"data-slot":"dropdown-menu-content",className:D("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",i),...a})})})}function Xu({className:e,children:t,checked:n,inset:r,...i}){return s.jsxs(wo,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:D("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...i,children:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:s.jsx(No,{children:s.jsx(rr,{})})}),t]})}function Ju({...e}){return s.jsx(bo,{"data-slot":"dropdown-menu-radio-group",...e})}function Zu({className:e,children:t,inset:n,...r}){return s.jsxs(vo,{"data-slot":"dropdown-menu-radio-item","data-inset":n,className:D("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:s.jsx(jo,{children:s.jsx(rr,{})})}),t]})}function ri({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:D("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const si=ko;function ii({className:e,...t}){return s.jsx(_o,{"data-slot":"select-group",className:D("scroll-my-1 p-1",e),...t})}function ai({className:e,...t}){return s.jsx(Eo,{"data-slot":"select-value",className:D("flex flex-1 text-left",e),...t})}function li({className:e,size:t="default",children:n,...r}){return s.jsxs(So,{"data-slot":"select-trigger","data-size":t,className:D("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,s.jsx(Co,{render:s.jsx(Ot,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function oi({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:l=!0,...o}){return s.jsx(Io,{children:s.jsx(To,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:l,className:"isolate z-50",children:s.jsxs(zo,{"data-slot":"select-content","data-align-trigger":l,className:D("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[s.jsx(ed,{}),s.jsx(Po,{children:t}),s.jsx(td,{})]})})})}function hn({className:e,children:t,...n}){return s.jsxs(Ao,{"data-slot":"select-item",className:D("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[s.jsx(Ro,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),s.jsx(Oo,{render:s.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:s.jsx(rr,{className:"pointer-events-none"})})]})}function ed({className:e,...t}){return s.jsx(Mo,{"data-slot":"select-scroll-up-button",className:D("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:s.jsx(Do,{})})}function td({className:e,...t}){return s.jsx(Lo,{"data-slot":"select-scroll-down-button",className:D("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:s.jsx(Ot,{})})}function bn({className:e,...t}){return s.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:s.jsx("table",{"data-slot":"table",className:D("w-full caption-bottom text-sm",e),...t})})}function vn({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:D("[&_tr]:border-b",e),...t})}function jn({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:D("[&_tr:last-child]:border-0",e),...t})}function Me({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:D("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function ce({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:D("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function oe({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:D("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}const qr={HEALTHY:{icon:s.jsx(nt,{className:"size-4 text-emerald-600"}),variant:"outline",label:"Healthy"},WARNING:{icon:s.jsx(Rt,{className:"size-4 text-amber-500"}),variant:"secondary",label:"Warning"},CRITICAL:{icon:s.jsx(Be,{className:"size-4 text-red-500"}),variant:"destructive",label:"Critical"},UNGRADED:{icon:s.jsx(gt,{className:"size-4 text-muted-foreground"}),variant:"secondary",label:"Ungraded"},UNKNOWN:{icon:s.jsx(ss,{className:"size-4 text-muted-foreground/60"}),variant:"secondary",label:"Unknown"}},Ra=L.createContext(null);function nd(){const e=L.useContext(Ra);return e?s.jsxs(ye,{ref:e.setActivatorNodeRef,...e.attributes,...e.listeners,variant:"ghost",size:"icon",className:"size-7 text-muted-foreground hover:bg-transparent",children:[s.jsx($o,{className:"size-3 text-muted-foreground"}),s.jsx("span",{className:"sr-only",children:"Drag to reorder"})]}):null}function rd({name:e}){return s.jsx(qt,{to:`/skills/${encodeURIComponent(e)}`,className:"text-sm font-medium hover:underline",children:e})}const ci=[{id:"drag",header:()=>null,cell:()=>s.jsx(nd,{})},{id:"select",header:({table:e})=>s.jsx("div",{className:"flex items-center justify-center",children:s.jsx(Zs,{checked:e.getIsAllPageRowsSelected(),indeterminate:e.getIsSomePageRowsSelected()&&!e.getIsAllPageRowsSelected(),onCheckedChange:t=>e.toggleAllPageRowsSelected(!!t),"aria-label":"Select all"})}),cell:({row:e})=>s.jsx("div",{className:"flex items-center justify-center",children:s.jsx(Zs,{checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(!!t),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:"Skill",cell:({row:e})=>s.jsx(rd,{name:e.original.name}),enableHiding:!1},{accessorKey:"scope",header:"Scope",cell:({row:e})=>{const t=e.original.scope;return t?s.jsx(U,{variant:"secondary",className:"text-[10px]",children:t}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"--"})}},{accessorKey:"status",header:"Status",cell:({row:e})=>{const t=qr[e.original.status];return s.jsxs(U,{variant:t.variant,className:"gap-1 px-1.5 text-muted-foreground",children:[t.icon,t.label]})},sortingFn:(e,t)=>{const n={CRITICAL:0,WARNING:1,UNGRADED:2,UNKNOWN:3,HEALTHY:4};return n[e.original.status]-n[t.original.status]}},{accessorKey:"passRate",header:()=>s.jsx("div",{className:"w-full text-right",children:"Pass Rate"}),cell:({row:e})=>{const t=e.original.passRate,n=t!==null&&t<.5;return s.jsx("div",{className:`text-right font-mono tabular-nums ${n?"text-red-600 font-semibold":""}`,children:xt(t)})},sortingFn:(e,t)=>{const n=e.original.passRate??-1,r=t.original.passRate??-1;return n-r}},{accessorKey:"checks",header:()=>s.jsx("div",{className:"w-full text-right",children:"Checks"}),cell:({row:e})=>s.jsx("div",{className:"text-right font-mono tabular-nums",children:e.original.checks})},{accessorKey:"uniqueSessions",header:()=>s.jsx("div",{className:"w-full text-right",children:"Sessions"}),cell:({row:e})=>s.jsx("div",{className:"text-right font-mono tabular-nums",children:e.original.uniqueSessions})},{accessorKey:"lastSeen",header:"Last Seen",cell:({row:e})=>s.jsx("div",{className:"flex items-center gap-1 text-muted-foreground",children:e.original.lastSeen?s.jsxs(s.Fragment,{children:[s.jsx(is,{className:"size-3"}),s.jsx("span",{className:"font-mono text-xs",children:be(e.original.lastSeen)})]}):s.jsx("span",{className:"text-xs",children:"--"})}),sortingFn:(e,t)=>{const n=e.original.lastSeen?new Date(e.original.lastSeen).getTime():0,r=t.original.lastSeen?new Date(t.original.lastSeen).getTime():0;return n-r}},{accessorKey:"hasEvidence",header:"Evidence",cell:({row:e})=>s.jsx(U,{variant:e.original.hasEvidence?"outline":"secondary",className:"px-1.5 text-[10px] text-muted-foreground",children:e.original.hasEvidence?"Yes":"No"})}];function sd({row:e}){const{transform:t,transition:n,setNodeRef:r,setActivatorNodeRef:i,isDragging:a,attributes:l,listeners:o}=jc({id:e.original.name}),c=L.useMemo(()=>({attributes:l,listeners:o,setActivatorNodeRef:i}),[l,o,i]);return s.jsx(Ra.Provider,{value:c,children:s.jsx(Me,{"data-state":e.getIsSelected()&&"selected","data-dragging":a,ref:r,className:"relative z-0 data-[dragging=true]:z-10 data-[dragging=true]:opacity-80",style:{transform:wc.Transform.toString(t),transition:n},children:e.getVisibleCells().map(u=>s.jsx(oe,{children:pa(u.column.columnDef.cell,u.getContext())},u.id))})})}function id({cards:e,totalCount:t,statusFilter:n,onStatusFilterChange:r}){var B;const[i,a]=L.useState("all"),[l,o]=L.useState([]),[c,u]=L.useState({}),[d,h]=L.useState({}),[p,f]=L.useState([]),[b,j]=L.useState([]),[v,y]=L.useState({pageIndex:0,pageSize:20}),k=L.useMemo(()=>({all:e.length,attention:e.filter(S=>S.status==="CRITICAL"||S.status==="WARNING").length,recent:e.filter(S=>S.lastSeen!==null).length,ungraded:e.filter(S=>S.status==="UNGRADED"||S.status==="UNKNOWN").length}),[e]);L.useEffect(()=>{let S=e;i==="attention"?S=e.filter(I=>I.status==="CRITICAL"||I.status==="WARNING"):i==="recent"?S=[...e.filter(I=>I.lastSeen!==null)].sort((I,O)=>{const C=I.lastSeen?new Date(I.lastSeen).getTime():0;return(O.lastSeen?new Date(O.lastSeen).getTime():0)-C}):i==="ungraded"&&(S=e.filter(I=>I.status==="UNGRADED"||I.status==="UNKNOWN")),o(S),y(I=>({...I,pageIndex:0}))},[e,i]);const E=L.useId(),T=rc(hr(bc,{}),hr(yc,{}),hr(gc,{coordinateGetter:xc})),A=sc({data:l,columns:ci,state:{sorting:b,columnVisibility:d,rowSelection:c,columnFilters:p,pagination:v},getRowId:S=>S.name,enableRowSelection:!0,onRowSelectionChange:u,onSortingChange:j,onColumnFiltersChange:f,onColumnVisibilityChange:h,onPaginationChange:y,getCoreRowModel:mc(),getFilteredRowModel:pc(),getPaginationRowModel:fc(),getSortedRowModel:hc(),getFacetedRowModel:dc(),getFacetedUniqueValues:uc()}),w=L.useMemo(()=>A.getRowModel().rows.map(S=>S.id),[A.getRowModel().rows]),$=b.length>0;function F(S){if($)return;const{active:I,over:O}=S;I&&O&&I.id!==O.id&&o(C=>{const R=C.map(le=>le.name),P=R.indexOf(I.id),Y=R.indexOf(O.id);return P===-1||Y===-1?C:vc(C,P,Y)})}return s.jsxs(ms,{value:i,onValueChange:a,className:"flex w-full flex-col justify-start gap-6",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 lg:px-6",children:[s.jsx(ri,{htmlFor:"view-selector",className:"sr-only",children:"View"}),s.jsxs(si,{value:i,onValueChange:S=>S&&a(S),children:[s.jsx(li,{className:"flex w-fit @4xl/main:hidden",size:"sm",id:"view-selector",children:s.jsx(ai,{placeholder:"Select a view"})}),s.jsx(oi,{children:s.jsxs(ii,{children:[s.jsx(hn,{value:"all",children:"All Skills"}),s.jsx(hn,{value:"attention",children:"Needs Attention"}),s.jsx(hn,{value:"recent",children:"Recently Active"}),s.jsx(hn,{value:"ungraded",children:"Ungraded"})]})})]}),s.jsxs(xs,{className:"hidden **:data-[slot=badge]:size-5 **:data-[slot=badge]:rounded-full **:data-[slot=badge]:bg-muted-foreground/30 **:data-[slot=badge]:px-1 @4xl/main:flex",children:[s.jsxs(Pe,{value:"all",children:["All Skills ",s.jsx(U,{variant:"secondary",children:k.all})]}),s.jsxs(Pe,{value:"attention",children:["Needs Attention"," ",k.attention>0&&s.jsx(U,{variant:"secondary",children:k.attention})]}),s.jsxs(Pe,{value:"recent",children:["Recently Active"," ",k.recent>0&&s.jsx(U,{variant:"secondary",children:k.recent})]}),s.jsxs(Pe,{value:"ungraded",children:["Ungraded"," ",k.ungraded>0&&s.jsx(U,{variant:"secondary",children:k.ungraded})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[r&&s.jsxs(ei,{children:[s.jsxs(ti,{render:s.jsx(ye,{variant:"outline",size:"sm"}),children:[s.jsx(Fo,{"data-icon":"inline-start",className:"size-3.5"}),n&&n!=="ALL"?n.charAt(0)+n.slice(1).toLowerCase():"Status",s.jsx(Ot,{"data-icon":"inline-end"})]}),s.jsx(ni,{align:"end",className:"w-40",children:s.jsx(Ju,{value:n??"ALL",onValueChange:S=>r(S),children:[{label:"All",value:"ALL",icon:s.jsx(er,{className:"size-3.5"})},{label:"Healthy",value:"HEALTHY",icon:s.jsx(nt,{className:"size-3.5 text-emerald-600"})},{label:"Warning",value:"WARNING",icon:s.jsx(Rt,{className:"size-3.5 text-amber-500"})},{label:"Critical",value:"CRITICAL",icon:s.jsx(Be,{className:"size-3.5 text-red-500"})},{label:"Ungraded",value:"UNGRADED",icon:s.jsx(gt,{className:"size-3.5 text-muted-foreground"})},{label:"Unknown",value:"UNKNOWN",icon:s.jsx(ss,{className:"size-3.5 text-muted-foreground/60"})}].map(S=>s.jsx(Zu,{value:S.value,children:s.jsxs("span",{className:"flex items-center gap-2",children:[S.icon,S.label]})},S.value))})})]}),s.jsxs(ei,{children:[s.jsxs(ti,{render:s.jsx(ye,{variant:"outline",size:"sm"}),children:[s.jsx(Bo,{"data-icon":"inline-start"}),"Columns",s.jsx(Ot,{"data-icon":"inline-end"})]}),s.jsx(ni,{align:"end",className:"w-40",children:A.getAllColumns().filter(S=>typeof S.accessorFn<"u"&&S.getCanHide()).map(S=>s.jsx(Xu,{className:"capitalize",checked:S.getIsVisible(),onCheckedChange:I=>S.toggleVisibility(!!I),children:S.id==="scope"?"Scope":S.id==="passRate"?"Pass Rate":S.id==="uniqueSessions"?"Sessions":S.id==="lastSeen"?"Last Seen":S.id==="hasEvidence"?"Evidence":S.id},S.id))})]})]})]}),s.jsxs(tt,{value:i,className:"relative flex flex-col gap-4 overflow-auto px-4 lg:px-6",children:[s.jsx("div",{className:"overflow-hidden rounded-lg border",children:s.jsx(ic,{collisionDetection:lc,modifiers:[ac],onDragEnd:F,sensors:T,id:E,children:s.jsxs(bn,{children:[s.jsx(vn,{className:"sticky top-0 z-10 bg-muted",children:A.getHeaderGroups().map(S=>s.jsx(Me,{children:S.headers.map(I=>s.jsx(ce,{colSpan:I.colSpan,className:I.column.getCanSort()?"cursor-pointer select-none":"",onClick:I.column.getToggleSortingHandler(),children:s.jsxs("div",{className:"flex items-center gap-1",children:[I.isPlaceholder?null:pa(I.column.columnDef.header,I.getContext()),I.column.getIsSorted()==="asc"?" ↑":I.column.getIsSorted()==="desc"?" ↓":null]})},I.id))},S.id))}),s.jsx(jn,{className:"**:data-[slot=table-cell]:first:w-8",children:(B=A.getRowModel().rows)!=null&&B.length?s.jsx(oc,{items:w,strategy:cc,children:A.getRowModel().rows.map(S=>s.jsx(sd,{row:S},S.id))}):s.jsx(Me,{children:s.jsx(oe,{colSpan:ci.length,className:"h-24 text-center text-muted-foreground",children:t===0?"No skills detected yet. Trigger some skills to see data.":"No skills match your filters."})})})]})})}),s.jsxs("div",{className:"flex items-center justify-between px-4",children:[s.jsxs("div",{className:"hidden flex-1 text-sm text-muted-foreground lg:flex",children:[A.getFilteredSelectedRowModel().rows.length," of"," ",A.getFilteredRowModel().rows.length," skill(s) selected."]}),s.jsxs("div",{className:"flex w-full items-center gap-8 lg:w-fit",children:[s.jsxs("div",{className:"hidden items-center gap-2 lg:flex",children:[s.jsx(ri,{htmlFor:"rows-per-page",className:"text-sm font-medium",children:"Rows per page"}),s.jsxs(si,{value:`${A.getState().pagination.pageSize}`,onValueChange:S=>{A.setPageSize(Number(S))},items:[10,20,50,100].map(S=>({label:`${S}`,value:`${S}`})),children:[s.jsx(li,{size:"sm",className:"w-20",id:"rows-per-page",children:s.jsx(ai,{placeholder:A.getState().pagination.pageSize})}),s.jsx(oi,{side:"top",children:s.jsx(ii,{children:[10,20,50,100].map(S=>s.jsx(hn,{value:`${S}`,children:S},S))})})]})]}),A.getRowModel().rows.length>0&&s.jsxs("div",{className:"flex w-fit items-center justify-center text-sm font-medium",children:["Page ",A.getState().pagination.pageIndex+1," of"," ",A.getPageCount()]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2 lg:ml-0",children:[s.jsxs(ye,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>A.setPageIndex(0),disabled:!A.getCanPreviousPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to first page"}),s.jsx(Uo,{})]}),s.jsxs(ye,{variant:"outline",className:"size-8",size:"icon",onClick:()=>A.previousPage(),disabled:!A.getCanPreviousPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to previous page"}),s.jsx(Ho,{})]}),s.jsxs(ye,{variant:"outline",className:"size-8",size:"icon",onClick:()=>A.nextPage(),disabled:!A.getCanNextPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to next page"}),s.jsx(an,{})]}),s.jsxs(ye,{variant:"outline",className:"hidden size-8 lg:flex",size:"icon",onClick:()=>A.setPageIndex(A.getPageCount()-1),disabled:!A.getCanNextPage(),children:[s.jsx("span",{className:"sr-only",children:"Go to last page"}),s.jsx(qo,{})]})]})]})]})]})]})}const ar="";async function ad(){const e=await fetch(`${ar}/api/v2/overview`);if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function ld(e){const t=await fetch(`${ar}/api/v2/skills/${encodeURIComponent(e)}`);if(!t.ok)throw t.status===404?new Oa(e):new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function od(e=20){const t=await fetch(`${ar}/api/v2/orchestrate-runs?limit=${e}`);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function cd(){const e=await fetch(`${ar}/api/v2/doctor`);if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}class Oa extends Error{constructor(t){super(`Skill "${t}" not found`),this.name="NotFoundError"}}const ud=3e4;function dd(){return ir({queryKey:["orchestrate-runs"],queryFn:()=>od(20),staleTime:15e3,refetchInterval:ud})}function hd(e){return za(e.map(t=>({name:t.skill_name,scope:t.skill_scope,passRate:t.total_checks>0?t.pass_rate:null,checks:t.total_checks,status:fs(t.pass_rate,t.total_checks),hasEvidence:t.has_evidence,uniqueSessions:t.unique_sessions,lastSeen:t.last_seen})))}function fd({skillCount:e}){const[t,n]=L.useState(()=>{try{return localStorage.getItem("selftune-onboarding-dismissed")==="true"}catch{return!1}});if(!(!t||e===0))return null;const i=()=>{n(!0);try{localStorage.setItem("selftune-onboarding-dismissed","true")}catch{}};return e===0?s.jsx("div",{className:"mx-4 lg:mx-6 rounded-xl border-2 border-dashed border-primary/30 bg-primary/5 p-8",children:s.jsxs("div",{className:"flex flex-col items-center text-center gap-4 max-w-md mx-auto",children:[s.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-primary/10",children:s.jsx(Kn,{className:"size-6 text-primary"})}),s.jsx("h2",{className:"text-lg font-semibold",children:"Welcome to selftune"}),s.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"No skills detected yet. Once you start using selftune in your project, skills will appear here automatically."}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 w-full text-left sm:grid-cols-3",children:[s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border bg-card p-3",children:[s.jsx("div",{className:"flex items-center justify-center size-6 rounded-full bg-blue-500/10 text-blue-500 shrink-0 text-xs font-bold",children:"1"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium",children:"Run selftune"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Enable selftune in your project to start tracking skills"})]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border bg-card p-3",children:[s.jsx("div",{className:"flex items-center justify-center size-6 rounded-full bg-amber-500/10 text-amber-500 shrink-0 text-xs font-bold",children:"2"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium",children:"Skills appear"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Skills are detected and monitored automatically"})]})]}),s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border bg-card p-3",children:[s.jsx("div",{className:"flex items-center justify-center size-6 rounded-full bg-emerald-500/10 text-emerald-500 shrink-0 text-xs font-bold",children:"3"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium",children:"Watch evolution"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Proposals flow in with validated improvements"})]})]})]})]})}):s.jsxs("div",{className:"mx-4 lg:mx-6 flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 px-4 py-3",children:[s.jsx(Kn,{className:"size-4 text-primary/60 shrink-0"}),s.jsxs("p",{className:"flex-1 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Welcome to selftune dashboard."})," ","Hover over any metric label's ",s.jsx("span",{className:"inline-flex items-center text-muted-foreground/50",children:s.jsx(er,{className:"size-2.5 mx-0.5"})})," icon for an explanation. Click proposals in the Evolution timeline to see detailed evidence."]}),s.jsxs("button",{type:"button",onClick:i,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:[s.jsx(la,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})}function pd({search:e,statusFilter:t,onStatusFilterChange:n,overviewQuery:r}){const{data:i,isPending:a,isError:l,error:o,refetch:c}=r,u=dd(),d=L.useMemo(()=>i?hd(i.skills):[],[i]),h=L.useMemo(()=>{let v=d;if(e){const y=e.toLowerCase();v=v.filter(k=>k.name.toLowerCase().includes(y))}return t!=="ALL"&&(v=v.filter(y=>y.status===t)),v},[d,e,t]);if(a)return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 py-6",children:[s.jsx("div",{className:"grid grid-cols-1 gap-4 px-4 lg:px-6 @xl/main:grid-cols-2 @5xl/main:grid-cols-3",children:Array.from({length:6}).map((v,y)=>s.jsx(Qe,{className:"h-24 rounded-xl"},y))}),s.jsxs("div",{className:"px-4 lg:px-6",children:[s.jsx(Qe,{className:"h-8 w-32 mb-4"}),s.jsx("div",{className:"grid grid-cols-1 gap-3 @xl/main:grid-cols-2 @5xl/main:grid-cols-3",children:Array.from({length:6}).map((v,y)=>s.jsx(Qe,{className:"h-28 rounded-xl"},y))})]})]});if(l)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsx(sr,{className:"size-10 text-destructive"}),s.jsx("p",{className:"text-sm font-medium text-destructive",children:o instanceof Error?o.message:"Unknown error"}),s.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>c(),children:[s.jsx(Qn,{className:"mr-2 size-3.5"}),"Retry"]})]});if(!i)return s.jsx("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 py-16",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No telemetry data found. Run some sessions first."})});const{overview:p,skills:f}=i,b=f.filter(v=>v.total_checks>=5),j=b.length>0?b.reduce((v,y)=>v+y.pass_rate,0)/b.length:null;return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 py-6",children:[s.jsx(fd,{skillCount:f.length}),s.jsx(Yu,{skillsCount:f.length,avgPassRate:j,unmatchedCount:p.unmatched_queries.length,sessionsCount:p.counts.sessions,pendingCount:p.pending_proposals.length,evidenceCount:p.counts.evidence}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 @5xl/main:grid-cols-[1fr_320px]",children:[s.jsx(id,{cards:h,totalCount:d.length,statusFilter:t,onStatusFilterChange:n}),s.jsx("div",{className:"px-4 lg:px-6 @5xl/main:px-0 @5xl/main:pr-4 lg:@5xl/main:pr-6",children:s.jsxs("div",{className:"sticky top-4 space-y-4",children:[s.jsx(Qu,{evolution:p.evolution,pendingProposals:p.pending_proposals,unmatchedQueries:p.unmatched_queries}),u.isPending?s.jsx(Qe,{className:"h-32 rounded-xl"}):u.isError?s.jsx("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive",children:"Failed to load orchestrate runs."}):s.jsx(Wu,{runs:u.data.runs})]})})]})]})}const md={created:s.jsx(gt,{className:"size-3.5"}),validated:s.jsx(ls,{className:"size-3.5"}),deployed:s.jsx(Kn,{className:"size-3.5"}),rejected:s.jsx(Be,{className:"size-3.5"}),rolled_back:s.jsx(ha,{className:"size-3.5"})},$r={created:"bg-blue-500",validated:"bg-amber-500",deployed:"bg-emerald-500",rejected:"bg-red-500",rolled_back:"bg-red-400"},xd={created:"ring-blue-500/30",validated:"ring-amber-500/30",deployed:"ring-emerald-500/30",rejected:"ring-red-500/30",rolled_back:"ring-red-400/30"},gd={created:"bg-blue-500/30",validated:"bg-amber-500/30",deployed:"bg-emerald-500/30",rejected:"bg-red-500/30",rolled_back:"bg-red-400/30"};function yd(e){const t=new Map;for(const n of e){const r=t.get(n.proposal_id)??[];r.push(n),t.set(n.proposal_id,r)}for(const n of t.values())n.sort((r,i)=>new Date(r.timestamp).getTime()-new Date(i.timestamp).getTime());return Array.from(t.entries()).sort((n,r)=>{const i=n[1][n[1].length-1],a=r[1][r[1].length-1];return new Date(a.timestamp).getTime()-new Date(i.timestamp).getTime()})}function bd(e){return e[e.length-1].action}function vd(e){for(let t=e.length-1;t>=0;t--)if(e[t].eval_snapshot)return e[t].eval_snapshot;return null}function jd({snapshot:e}){const t=e.net_change;if(t==null)return null;const n=Math.round(t*100),r=n>0;return s.jsxs("span",{className:D("inline-flex items-center gap-0.5 text-[10px] font-mono font-medium",r?"text-emerald-600 dark:text-emerald-400":"text-red-500"),children:[r?s.jsx(tr,{className:"size-2.5"}):s.jsx(nr,{className:"size-2.5"}),r?"+":"",n,"%"]})}const wd=[{action:"created",label:"Created",desc:"Proposal generated from session data"},{action:"validated",label:"Validated",desc:"Eval tests run, awaiting deployment"},{action:"deployed",label:"Deployed",desc:"Accepted and applied to skill file"},{action:"rejected",label:"Rejected",desc:"Failed validation criteria"},{action:"rolled_back",label:"Rolled Back",desc:"Reverted after deployment"}];function Nd(){const[e,t]=L.useState(!1);return s.jsxs("div",{className:"px-2 pb-2",children:[s.jsxs("button",{type:"button",onClick:()=>t(!e),className:"flex items-center gap-1 text-[10px] text-muted-foreground/70 hover:text-muted-foreground transition-colors w-full",children:[e?s.jsx(Ot,{className:"size-3"}):s.jsx(an,{className:"size-3"}),"Lifecycle stages"]}),e&&s.jsx("div",{className:"mt-1.5 space-y-1.5 rounded-md border bg-muted/30 p-2",children:wd.map(n=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:D("size-2 rounded-full mt-1 shrink-0",$r[n.action])}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-[10px] font-medium",children:n.label}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:n.desc})]})]},n.action))})]})}function kd({entries:e,selectedProposalId:t,onSelect:n}){const r=yd(e);return r.length===0?s.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed py-6 px-3",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"No evolution history yet"})}):s.jsxs("div",{className:"flex flex-col gap-0",children:[s.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-2 pb-2 sticky top-0 z-10 bg-background",children:"Evolution"}),s.jsx(Nd,{}),s.jsx("nav",{className:"flex flex-col",children:r.map(([i,a],l)=>{const o=bd(a),c=t===i,u=a[a.length-1],d=$r[o]??"bg-muted-foreground",h=xd[o]??"ring-muted-foreground/30",p=gd[o]??"bg-border",f=l===r.length-1,b=vd(a);return s.jsxs("div",{className:"relative flex gap-3",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:D("flex items-center justify-center size-7 rounded-full ring-2 text-white shrink-0 z-10",d,h),children:md[o]??s.jsx(gt,{className:"size-3.5"})}),!f&&s.jsx("div",{className:D("w-0.5 flex-1 min-h-[16px]",p)})]}),s.jsxs("button",{type:"button",onClick:()=>n(i),className:D("flex-1 min-w-0 rounded-md px-2.5 py-2 text-left transition-all mb-1","hover:bg-accent/50",c?"bg-primary/5 ring-1 ring-primary/20":""),children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(U,{variant:o==="deployed"?"default":o==="rejected"||o==="rolled_back"?"destructive":"secondary",className:"text-[10px] capitalize",children:o.replace("_"," ")}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:be(u.timestamp)})]}),b&&s.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[s.jsx(jd,{snapshot:b}),b.before_pass_rate!==void 0&&b.after_pass_rate!==void 0&&s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:[Math.round(b.before_pass_rate*100),"→",Math.round(b.after_pass_rate*100),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground/70",children:["#",i.slice(0,8)]}),a.length>1&&s.jsx("div",{className:"flex gap-0.5 ml-auto",children:a.map((j,v)=>s.jsx("div",{className:D("size-1.5 rounded-full",$r[j.action]??"bg-muted-foreground")},`${j.action}-${v}`))})]}),u.details&&s.jsx("p",{className:"text-[11px] text-muted-foreground/80 line-clamp-2 mt-1 leading-snug",children:u.details})]})]},i)})})]})}function Sd(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Cd=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ed=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Id={};function ui(e,t){return(Id.jsx?Ed:Cd).test(e)}const Td=/[ \t\n\f\r]/g;function zd(e){return typeof e=="object"?e.type==="text"?di(e.value):!1:di(e)}function di(e){return e.replace(Td,"")===""}class Rn{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Rn.prototype.normal={};Rn.prototype.property={};Rn.prototype.space=void 0;function Ma(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Rn(n,r,t)}function Vr(e){return e.toLowerCase()}class ke{constructor(t,n){this.attribute=n,this.property=t}}ke.prototype.attribute="";ke.prototype.booleanish=!1;ke.prototype.boolean=!1;ke.prototype.commaOrSpaceSeparated=!1;ke.prototype.commaSeparated=!1;ke.prototype.defined=!1;ke.prototype.mustUseProperty=!1;ke.prototype.number=!1;ke.prototype.overloadedBoolean=!1;ke.prototype.property="";ke.prototype.spaceSeparated=!1;ke.prototype.space=void 0;let Pd=0;const Q=Dt(),ue=Dt(),Qr=Dt(),z=Dt(),re=Dt(),$t=Dt(),Ce=Dt();function Dt(){return 2**++Pd}const Kr=Object.freeze(Object.defineProperty({__proto__:null,boolean:Q,booleanish:ue,commaOrSpaceSeparated:Ce,commaSeparated:$t,number:z,overloadedBoolean:Qr,spaceSeparated:re},Symbol.toStringTag,{value:"Module"})),mr=Object.keys(Kr);class gs extends ke{constructor(t,n,r,i){let a=-1;if(super(t,n),hi(this,"space",i),typeof r=="number")for(;++a<mr.length;){const l=mr[a];hi(this,mr[a],(r&Kr[l])===Kr[l])}}}gs.prototype.defined=!0;function hi(e,t,n){n&&(e[t]=n)}function ln(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const a=new gs(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Vr(r)]=r,n[Vr(a.attribute)]=r}return new Rn(t,n,e.space)}const Da=ln({properties:{ariaActiveDescendant:null,ariaAtomic:ue,ariaAutoComplete:null,ariaBusy:ue,ariaChecked:ue,ariaColCount:z,ariaColIndex:z,ariaColSpan:z,ariaControls:re,ariaCurrent:null,ariaDescribedBy:re,ariaDetails:null,ariaDisabled:ue,ariaDropEffect:re,ariaErrorMessage:null,ariaExpanded:ue,ariaFlowTo:re,ariaGrabbed:ue,ariaHasPopup:null,ariaHidden:ue,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:re,ariaLevel:z,ariaLive:null,ariaModal:ue,ariaMultiLine:ue,ariaMultiSelectable:ue,ariaOrientation:null,ariaOwns:re,ariaPlaceholder:null,ariaPosInSet:z,ariaPressed:ue,ariaReadOnly:ue,ariaRelevant:null,ariaRequired:ue,ariaRoleDescription:re,ariaRowCount:z,ariaRowIndex:z,ariaRowSpan:z,ariaSelected:ue,ariaSetSize:z,ariaSort:null,ariaValueMax:z,ariaValueMin:z,ariaValueNow:z,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function La(e,t){return t in e?e[t]:t}function Fa(e,t){return La(e,t.toLowerCase())}const _d=ln({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$t,acceptCharset:re,accessKey:re,action:null,allow:null,allowFullScreen:Q,allowPaymentRequest:Q,allowUserMedia:Q,alt:null,as:null,async:Q,autoCapitalize:null,autoComplete:re,autoFocus:Q,autoPlay:Q,blocking:re,capture:null,charSet:null,checked:Q,cite:null,className:re,cols:z,colSpan:null,content:null,contentEditable:ue,controls:Q,controlsList:re,coords:z|$t,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Q,defer:Q,dir:null,dirName:null,disabled:Q,download:Qr,draggable:ue,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Q,formTarget:null,headers:re,height:z,hidden:Qr,high:z,href:null,hrefLang:null,htmlFor:re,httpEquiv:re,id:null,imageSizes:null,imageSrcSet:null,inert:Q,inputMode:null,integrity:null,is:null,isMap:Q,itemId:null,itemProp:re,itemRef:re,itemScope:Q,itemType:re,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Q,low:z,manifest:null,max:null,maxLength:z,media:null,method:null,min:null,minLength:z,multiple:Q,muted:Q,name:null,nonce:null,noModule:Q,noValidate:Q,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Q,optimum:z,pattern:null,ping:re,placeholder:null,playsInline:Q,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Q,referrerPolicy:null,rel:re,required:Q,reversed:Q,rows:z,rowSpan:z,sandbox:re,scope:null,scoped:Q,seamless:Q,selected:Q,shadowRootClonable:Q,shadowRootDelegatesFocus:Q,shadowRootMode:null,shape:null,size:z,sizes:null,slot:null,span:z,spellCheck:ue,src:null,srcDoc:null,srcLang:null,srcSet:null,start:z,step:null,style:null,tabIndex:z,target:null,title:null,translate:null,type:null,typeMustMatch:Q,useMap:null,value:ue,width:z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:re,axis:null,background:null,bgColor:null,border:z,borderColor:null,bottomMargin:z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Q,declare:Q,event:null,face:null,frame:null,frameBorder:null,hSpace:z,leftMargin:z,link:null,longDesc:null,lowSrc:null,marginHeight:z,marginWidth:z,noResize:Q,noHref:Q,noShade:Q,noWrap:Q,object:null,profile:null,prompt:null,rev:null,rightMargin:z,rules:null,scheme:null,scrolling:ue,standby:null,summary:null,text:null,topMargin:z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Q,disableRemotePlayback:Q,prefix:null,property:null,results:z,security:null,unselectable:null},space:"html",transform:Fa}),Ad=ln({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ce,accentHeight:z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:z,amplitude:z,arabicForm:null,ascent:z,attributeName:null,attributeType:null,azimuth:z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:z,by:null,calcMode:null,capHeight:z,className:re,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:z,diffuseConstant:z,direction:null,display:null,dur:null,divisor:z,dominantBaseline:null,download:Q,dx:null,dy:null,edgeMode:null,editable:null,elevation:z,enableBackground:null,end:null,event:null,exponent:z,externalResourcesRequired:null,fill:null,fillOpacity:z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$t,g2:$t,glyphName:$t,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:z,horizOriginX:z,horizOriginY:z,id:null,ideographic:z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:z,k:z,k1:z,k2:z,k3:z,k4:z,kernelMatrix:Ce,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:z,overlineThickness:z,paintOrder:null,panose1:null,path:null,pathLength:z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:re,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:z,pointsAtY:z,pointsAtZ:z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ce,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ce,rev:Ce,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ce,requiredFeatures:Ce,requiredFonts:Ce,requiredFormats:Ce,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:z,specularExponent:z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:z,strikethroughThickness:z,string:null,stroke:null,strokeDashArray:Ce,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:z,strokeOpacity:z,strokeWidth:null,style:null,surfaceScale:z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ce,tabIndex:z,tableValues:null,target:null,targetX:z,targetY:z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ce,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:z,underlineThickness:z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:z,values:null,vAlphabetic:z,vMathematical:z,vectorEffect:null,vHanging:z,vIdeographic:z,version:null,vertAdvY:z,vertOriginX:z,vertOriginY:z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:La}),Ba=ln({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Ua=ln({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fa}),Ha=ln({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Rd={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Od=/[A-Z]/g,fi=/-[a-z]/g,Md=/^data[-\w.:]+$/i;function Dd(e,t){const n=Vr(t);let r=t,i=ke;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Md.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(fi,Fd);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!fi.test(a)){let l=a.replace(Od,Ld);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}i=gs}return new i(r,t)}function Ld(e){return"-"+e.toLowerCase()}function Fd(e){return e.charAt(1).toUpperCase()}const Bd=Ma([Da,_d,Ba,Ua,Ha],"html"),ys=Ma([Da,Ad,Ba,Ua,Ha],"svg");function Ud(e){return e.join(" ").trim()}var Ut={},xr,pi;function Hd(){if(pi)return xr;pi=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,c=`
|
|
2
|
+
`,u="/",d="*",h="",p="comment",f="declaration";function b(v,y){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];y=y||{};var k=1,E=1;function T(R){var P=R.match(t);P&&(k+=P.length);var Y=R.lastIndexOf(c);E=~Y?R.length-Y:E+R.length}function A(){var R={line:k,column:E};return function(P){return P.position=new w(R),B(),P}}function w(R){this.start=R,this.end={line:k,column:E},this.source=y.source}w.prototype.content=v;function $(R){var P=new Error(y.source+":"+k+":"+E+": "+R);if(P.reason=R,P.filename=y.source,P.line=k,P.column=E,P.source=v,!y.silent)throw P}function F(R){var P=R.exec(v);if(P){var Y=P[0];return T(Y),v=v.slice(Y.length),P}}function B(){F(n)}function S(R){var P;for(R=R||[];P=I();)P!==!1&&R.push(P);return R}function I(){var R=A();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 $("End of comment missing");var Y=v.slice(2,P-2);return E+=2,T(Y),v=v.slice(P),E+=2,R({type:p,comment:Y})}}function O(){var R=A(),P=F(r);if(P){if(I(),!F(i))return $("property missing ':'");var Y=F(a),le=R({type:f,property:j(P[0].replace(e,h)),value:Y?j(Y[0].replace(e,h)):h});return F(l),le}}function C(){var R=[];S(R);for(var P;P=O();)P!==!1&&(R.push(P),S(R));return R}return B(),C()}function j(v){return v?v.replace(o,h):h}return xr=b,xr}var mi;function qd(){if(mi)return Ut;mi=1;var e=Ut&&Ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.default=n;const t=e(Hd());function n(r,i){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),o=typeof i=="function";return l.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;o?i(u,d,c):d&&(a=a||{},a[u]=d)}),a}return Ut}var fn={},xi;function $d(){if(xi)return fn;xi=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||n.test(u)||e.test(u)},l=function(u,d){return d.toUpperCase()},o=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(i,o):u=u.replace(r,o),u.replace(t,l))};return fn.camelCase=c,fn}var pn,gi;function Vd(){if(gi)return pn;gi=1;var e=pn&&pn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(qd()),n=$d();function r(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(o,c){o&&c&&(l[(0,n.camelCase)(o,a)]=c)}),l}return r.default=r,pn=r,pn}var Qd=Vd();const Kd=aa(Qd),qa=$a("end"),bs=$a("start");function $a(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 Gd(e){const t=bs(e),n=qa(e);if(t&&n)return{start:t,end:n}}function wn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yi(e.position):"start"in e||"end"in e?yi(e):"line"in e||"column"in e?Gr(e):""}function Gr(e){return bi(e&&e.line)+":"+bi(e&&e.column)}function yi(e){return Gr(e&&e.start)+"-"+Gr(e&&e.end)}function bi(e){return e&&typeof e=="number"?e:1}class me extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},l=!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"?i=t:!a.cause&&t&&(l=!0,i=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 o=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=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=wn(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=l&&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}}me.prototype.file="";me.prototype.name="";me.prototype.reason="";me.prototype.message="";me.prototype.stack="";me.prototype.column=void 0;me.prototype.line=void 0;me.prototype.ancestors=void 0;me.prototype.cause=void 0;me.prototype.fatal=void 0;me.prototype.place=void 0;me.prototype.ruleId=void 0;me.prototype.source=void 0;const vs={}.hasOwnProperty,Wd=new Map,Yd=/[A-Z]/g,Xd=new Set(["table","tbody","thead","tfoot","tr"]),Jd=new Set(["td","th"]),Va="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Zd(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=lh(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=ah(n,t.jsx,t.jsxs)}const i={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"?ys:Bd,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Qa(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Qa(e,t,n){if(t.type==="element")return eh(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return th(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rh(e,t,n);if(t.type==="mdxjsEsm")return nh(e,t);if(t.type==="root")return sh(e,t,n);if(t.type==="text")return ih(e,t)}function eh(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ys,e.schema=i),e.ancestors.push(t);const a=Ga(e,t.tagName,!1),l=oh(e,t);let o=ws(e,t);return Xd.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!zd(c):!0})),Ka(e,l,a,t),js(l,o),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function th(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)}En(e,t.position)}function nh(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);En(e,t.position)}function rh(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ys,e.schema=i),e.ancestors.push(t);const a=t.name===null?e.Fragment:Ga(e,t.name,!0),l=ch(e,t),o=ws(e,t);return Ka(e,l,a,t),js(l,o),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function sh(e,t,n){const r={};return js(r,ws(e,t)),e.create(t,e.Fragment,r,n)}function ih(e,t){return t.value}function Ka(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function js(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ah(e,t,n){return r;function r(i,a,l,o){const u=Array.isArray(l.children)?n:t;return o?u(a,l,o):u(a,l)}}function lh(e,t){return n;function n(r,i,a,l){const o=Array.isArray(a.children),c=bs(r);return t(i,a,l,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function oh(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&vs.call(t.properties,i)){const a=uh(e,i,t.properties[i]);if(a){const[l,o]=a;e.tableCellAlignToStyle&&l==="align"&&typeof o=="string"&&Jd.has(t.tagName)?r=o:n[l]=o}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ch(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 l=a.expression;l.type;const o=l.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else En(e,t.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,a=e.evaluater.evaluateExpression(o.expression)}else En(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function ws(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Wd;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const c=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(c){const u=i.get(c)||0;l=c+"-"+u,i.set(c,u+1)}}const o=Qa(e,a,l);o!==void 0&&n.push(o)}return n}function uh(e,t,n){const r=Dd(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Sd(n):Ud(n)),r.property==="style"){let i=typeof n=="object"?n:dh(e,String(n));return e.stylePropertyNameCase==="css"&&(i=hh(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?Rd[r.property]||r.property:r.attribute,n]}}function dh(e,t){try{return Kd(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new me("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Va+"#cannot-parse-style-attribute",i}}function Ga(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let a=-1,l;for(;++a<i.length;){const o=ui(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};l=l?{type:"MemberExpression",object:l,property:o,computed:!!(a&&o.type==="Literal"),optional:!1}:o}r=l}else r=ui(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return vs.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);En(e)}function En(e,t){const n=new me("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Va+"#cannot-handle-mdx-estrees-without-createevaluater",n}function hh(e){const t={};let n;for(n in e)vs.call(e,n)&&(t[fh(n)]=e[n]);return t}function fh(e){let t=e.replace(Yd,ph);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ph(e){return"-"+e.toLowerCase()}const gr={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},mh={};function xh(e,t){const n=mh,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Wa(e,r,i)}function Wa(e,t,n){if(gh(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return vi(e.children,t,n)}return Array.isArray(e)?vi(e,t,n):""}function vi(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Wa(e[i],t,n);return r.join("")}function gh(e){return!!(e&&typeof e=="object")}const ji=document.createElement("i");function Ns(e){const t="&"+e+";";ji.innerHTML=t;const n=ji.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ke(e,t,n,r){const i=e.length;let a=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function ze(e,t){return e.length>0?(Ke(e,e.length,0,t),e):t}const wi={}.hasOwnProperty;function yh(e){const t={};let n=-1;for(;++n<e.length;)bh(t,e[n]);return t}function bh(e,t){let n;for(n in t){const i=(wi.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){wi.call(i,l)||(i[l]=[]);const o=a[l];vh(i[l],Array.isArray(o)?o:o?[o]:[])}}}function vh(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ke(e,0,0,r)}function Ya(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&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 Vt(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ve=yt(/[A-Za-z]/),Ee=yt(/[\dA-Za-z]/),jh=yt(/[#-'*+\--9=?A-Z^-~]/);function Wr(e){return e!==null&&(e<32||e===127)}const Yr=yt(/\d/),wh=yt(/[\dA-Fa-f]/),Nh=yt(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function Ne(e){return e!==null&&(e<0||e===32)}function X(e){return e===-2||e===-1||e===32}const kh=yt(new RegExp("\\p{P}|\\p{S}","u")),Sh=yt(/\s/);function yt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function on(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&Ee(e.charCodeAt(n+1))&&Ee(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const o=e.charCodeAt(n+1);a<56320&&o>56319&&o<57344?(l=String.fromCharCode(a,o),i=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function se(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(c){return X(c)?(e.enter(n),o(c)):t(c)}function o(c){return X(c)&&a++<i?(e.consume(c),o):(e.exit(n),t(c))}}const Ch={tokenize:Eh};function Eh(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),se(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(o){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,l(o)}function l(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return q(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),l)}}const Ih={tokenize:Th},Ni={tokenize:zh};function Th(e){const t=this,n=[];let r=0,i,a,l;return o;function o(E){if(r<n.length){const T=n[r];return t.containerState=T[1],e.attempt(T[0].continuation,c,u)(E)}return u(E)}function c(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&k();const T=t.events.length;let A=T,w;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){w=t.events[A][1].end;break}y(r);let $=T;for(;$<t.events.length;)t.events[$][1].end={...w},$++;return Ke(t.events,A+1,0,t.events.slice(T)),t.events.length=$,u(E)}return o(E)}function u(E){if(r===n.length){if(!i)return p(E);if(i.currentConstruct&&i.currentConstruct.concrete)return b(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ni,d,h)(E)}function d(E){return i&&k(),y(r),p(E)}function h(E){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,b(E)}function p(E){return t.containerState={},e.attempt(Ni,f,b)(E)}function f(E){return r++,n.push([t.currentConstruct,t.containerState]),p(E)}function b(E){if(E===null){i&&k(),y(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:a}),j(E)}function j(E){if(E===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(E);return}return q(E)?(e.consume(E),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(E),j)}function v(E,T){const A=t.sliceStream(E);if(T&&A.push(null),E.previous=a,a&&(a.next=E),a=E,i.defineSkip(E.start),i.write(A),t.parser.lazy[E.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<l&&(!i.events[w][1].end||i.events[w][1].end.offset>l))return;const $=t.events.length;let F=$,B,S;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(B){S=t.events[F][1].end;break}B=!0}for(y(r),w=$;w<t.events.length;)t.events[w][1].end={...S},w++;Ke(t.events,F+1,0,t.events.slice($)),t.events.length=w}}function y(E){let T=n.length;for(;T-- >E;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=E}function k(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function zh(e,t,n){return se(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ki(e){if(e===null||Ne(e)||Sh(e))return 1;if(kh(e))return 2}function ks(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Xr={name:"attention",resolveAll:Ph,tokenize:_h};function Ph(e,t){let n=-1,r,i,a,l,o,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},p={...e[n][1].start};Si(h,-c),Si(p,c),l={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},a={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...l.start},end:{...o.end}},e[r][1].end={...l.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ze(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ze(u,[["enter",i,t],["enter",l,t],["exit",l,t],["enter",a,t]]),u=ze(u,ks(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ze(u,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ze(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ke(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function _h(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ki(r);let a;return l;function l(c){return a=c,e.enter("attentionSequence"),o(c)}function o(c){if(c===a)return e.consume(c),o;const u=e.exit("attentionSequence"),d=ki(c),h=!d||d===2&&i||n.includes(c),p=!i||i===2&&d||n.includes(r);return u._open=!!(a===42?h:h&&(i||!p)),u._close=!!(a===42?p:p&&(d||!h)),t(c)}}function Si(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ah={name:"autolink",tokenize:Rh};function Rh(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(f){return Ve(f)?(e.consume(f),l):f===64?n(f):u(f)}function l(f){return f===43||f===45||f===46||Ee(f)?(r=1,o(f)):u(f)}function o(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||Ee(f))&&r++<32?(e.consume(f),o):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Wr(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):jh(f)?(e.consume(f),u):n(f)}function d(f){return Ee(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||Ee(f))&&r++<63){const b=f===45?p:h;return e.consume(f),b}return n(f)}}const lr={partial:!0,tokenize:Oh};function Oh(e,t,n){return r;function r(a){return X(a)?se(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||q(a)?t(a):n(a)}}const Xa={continuation:{tokenize:Dh},exit:Lh,name:"blockQuote",tokenize:Mh};function Mh(e,t,n){const r=this;return i;function i(l){if(l===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return X(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function Dh(e,t,n){const r=this;return i;function i(l){return X(l)?se(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(Xa,t,n)(l)}}function Lh(e){e.exit("blockQuote")}const Ja={name:"characterEscape",tokenize:Fh};function Fh(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return Nh(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Za={name:"characterReference",tokenize:Bh};function Bh(e,t,n){const r=this;let i=0,a,l;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,l=Ee,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=wh,d):(e.enter("characterReferenceValue"),a=7,l=Yr,d(h))}function d(h){if(h===59&&i){const p=e.exit("characterReferenceValue");return l===Ee&&!Ns(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(h)&&i++<a?(e.consume(h),d):n(h)}}const Ci={partial:!0,tokenize:Hh},Ei={concrete:!0,name:"codeFenced",tokenize:Uh};function Uh(e,t,n){const r=this,i={partial:!0,tokenize:A};let a=0,l=0,o;return c;function c(w){return u(w)}function u(w){const $=r.events[r.events.length-1];return a=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,o=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===o?(l++,e.consume(w),d):l<3?n(w):(e.exit("codeFencedFenceSequence"),X(w)?se(e,h,"whitespace")(w):h(w))}function h(w){return w===null||q(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(Ci,j,T)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||q(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(w)):X(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),se(e,f,"whitespace")(w)):w===96&&w===o?n(w):(e.consume(w),p)}function f(w){return w===null||q(w)?h(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(w))}function b(w){return w===null||q(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(w)):w===96&&w===o?n(w):(e.consume(w),b)}function j(w){return e.attempt(i,T,v)(w)}function v(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y}function y(w){return a>0&&X(w)?se(e,k,"linePrefix",a+1)(w):k(w)}function k(w){return w===null||q(w)?e.check(Ci,j,T)(w):(e.enter("codeFlowValue"),E(w))}function E(w){return w===null||q(w)?(e.exit("codeFlowValue"),k(w)):(e.consume(w),E)}function T(w){return e.exit("codeFenced"),t(w)}function A(w,$,F){let B=0;return S;function S(P){return w.enter("lineEnding"),w.consume(P),w.exit("lineEnding"),I}function I(P){return w.enter("codeFencedFence"),X(P)?se(w,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):O(P)}function O(P){return P===o?(w.enter("codeFencedFenceSequence"),C(P)):F(P)}function C(P){return P===o?(B++,w.consume(P),C):B>=l?(w.exit("codeFencedFenceSequence"),X(P)?se(w,R,"whitespace")(P):R(P)):F(P)}function R(P){return P===null||q(P)?(w.exit("codeFencedFence"),$(P)):F(P)}}}function Hh(e,t,n){const r=this;return i;function i(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const yr={name:"codeIndented",tokenize:$h},qh={partial:!0,tokenize:Vh};function $h(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),se(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?l(u):n(u)}function l(u){return u===null?c(u):q(u)?e.attempt(qh,l,c)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||q(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),o)}function c(u){return e.exit("codeIndented"),t(u)}}function Vh(e,t,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):q(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):se(e,a,"linePrefix",5)(l)}function a(l){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):q(l)?i(l):n(l)}}const Qh={name:"codeText",previous:Gh,resolve:Kh,tokenize:Wh};function Kh(e){let t=e.length-4,n=3,r,i;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<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Gh(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Wh(e,t,n){let r=0,i,a;return l;function l(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(a=e.enter("codeTextSequence"),i=0,d(h)):q(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||q(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(a.type="codeTextData",u(h))}}class Yh{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=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 t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.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 i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&mn(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),mn(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),mn(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<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);mn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);mn(this.left,n.reverse())}}}function mn(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function el(e){const t={};let n=-1,r,i,a,l,o,c,u;const d=new Yh(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type==="lineEndingBlank"&&(a+=2),a<c.length&&c[a][1].type==="content"))for(;++a<c.length&&c[a][1].type!=="content";)c[a][1].type==="chunkText"&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Xh(d,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(l=d.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return Ke(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Xh(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const o=l.events,c=[],u={};let d,h,p=-1,f=n,b=0,j=0;const v=[j];for(;f;){for(;e.get(++i)[1]!==f;);a.push(i),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(d),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(j=p+1,v.push(j),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),p=v.length;p--;){const y=o.slice(v[p],v[p+1]),k=a.pop();c.push([k,k+y.length-1]),e.splice(k,2,y)}for(c.reverse(),p=-1;++p<c.length;)u[b+c[p][0]]=b+c[p][1],b+=c[p][1]-c[p][0]-1;return u}const Jh={resolve:ef,tokenize:tf},Zh={partial:!0,tokenize:nf};function ef(e){return el(e),e}function tf(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):q(o)?e.check(Zh,l,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function l(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function nf(e,t,n){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),se(e,a,"linePrefix")}function a(l){if(l===null||q(l))return n(l);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function tl(e,t,n,r,i,a,l,o,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(y),e.exit(a),p):y===null||y===32||y===41||Wr(y)?n(y):(e.enter(r),e.enter(l),e.enter(o),e.enter("chunkString",{contentType:"string"}),j(y))}function p(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(o),p(y)):y===null||y===60||q(y)?n(y):(e.consume(y),y===92?b:f)}function b(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function j(y){return!d&&(y===null||y===41||Ne(y))?(e.exit("chunkString"),e.exit(o),e.exit(l),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,j):y===41?(e.consume(y),d--,j):y===null||y===32||y===40||Wr(y)?n(y):(e.consume(y),y===92?v:j)}function v(y){return y===40||y===41||y===92?(e.consume(y),j):j(y)}}function nl(e,t,n,r,i,a){const l=this;let o=0,c;return u;function u(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(a),d}function d(f){return o>999||f===null||f===91||f===93&&!c||f===94&&!o&&"_hiddenFootnoteSupport"in l.parser.constructs?n(f):f===93?(e.exit(a),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):q(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||q(f)||o++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!X(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),o++,h):h(f)}}function rl(e,t,n,r,i,a){let l;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,c):n(p)}function c(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),u(p))}function u(p){return p===l?(e.exit(a),c(l)):p===null?n(p):q(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),se(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===l||p===null||q(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===l||p===92?(e.consume(p),d):d(p)}}function Nn(e,t){let n;return r;function r(i){return q(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):X(i)?se(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const rf={name:"definition",tokenize:af},sf={partial:!0,tokenize:lf};function af(e,t,n){const r=this;let i;return a;function a(f){return e.enter("definition"),l(f)}function l(f){return nl.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function o(f){return i=Vt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return Ne(f)?Nn(e,u)(f):u(f)}function u(f){return tl(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(sf,h,h)(f)}function h(f){return X(f)?se(e,p,"whitespace")(f):p(f)}function p(f){return f===null||q(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function lf(e,t,n){return r;function r(o){return Ne(o)?Nn(e,i)(o):n(o)}function i(o){return rl(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return X(o)?se(e,l,"whitespace")(o):l(o)}function l(o){return o===null||q(o)?t(o):n(o)}}const of={name:"hardBreakEscape",tokenize:cf};function cf(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return q(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const uf={name:"headingAtx",resolve:df,tokenize:hf};function df(e,t){let n=e.length-2,r=3,i,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&&(i={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"},Ke(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function hf(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),l(d)}function l(d){return d===35&&r++<6?(e.consume(d),l):d===null||Ne(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||q(d)?(e.exit("atxHeading"),t(d)):X(d)?se(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Ne(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const ff=["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"],Ii=["pre","script","style","textarea"],pf={concrete:!0,name:"htmlFlow",resolveTo:gf,tokenize:yf},mf={partial:!0,tokenize:vf},xf={partial:!0,tokenize:bf};function gf(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 yf(e,t,n){const r=this;let i,a,l,o,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),p):x===47?(e.consume(x),a=!0,j):x===63?(e.consume(x),i=3,r.interrupt?t:m):Ve(x)?(e.consume(x),l=String.fromCharCode(x),v):n(x)}function p(x){return x===45?(e.consume(x),i=2,f):x===91?(e.consume(x),i=5,o=0,b):Ve(x)?(e.consume(x),i=4,r.interrupt?t:m):n(x)}function f(x){return x===45?(e.consume(x),r.interrupt?t:m):n(x)}function b(x){const Re="CDATA[";return x===Re.charCodeAt(o++)?(e.consume(x),o===Re.length?r.interrupt?t:O:b):n(x)}function j(x){return Ve(x)?(e.consume(x),l=String.fromCharCode(x),v):n(x)}function v(x){if(x===null||x===47||x===62||Ne(x)){const Re=x===47,bt=l.toLowerCase();return!Re&&!a&&Ii.includes(bt)?(i=1,r.interrupt?t(x):O(x)):ff.includes(l.toLowerCase())?(i=6,Re?(e.consume(x),y):r.interrupt?t(x):O(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):a?k(x):E(x))}return x===45||Ee(x)?(e.consume(x),l+=String.fromCharCode(x),v):n(x)}function y(x){return x===62?(e.consume(x),r.interrupt?t:O):n(x)}function k(x){return X(x)?(e.consume(x),k):S(x)}function E(x){return x===47?(e.consume(x),S):x===58||x===95||Ve(x)?(e.consume(x),T):X(x)?(e.consume(x),E):S(x)}function T(x){return x===45||x===46||x===58||x===95||Ee(x)?(e.consume(x),T):A(x)}function A(x){return x===61?(e.consume(x),w):X(x)?(e.consume(x),A):E(x)}function w(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),c=x,$):X(x)?(e.consume(x),w):F(x)}function $(x){return x===c?(e.consume(x),c=null,B):x===null||q(x)?n(x):(e.consume(x),$)}function F(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||Ne(x)?A(x):(e.consume(x),F)}function B(x){return x===47||x===62||X(x)?E(x):n(x)}function S(x){return x===62?(e.consume(x),I):n(x)}function I(x){return x===null||q(x)?O(x):X(x)?(e.consume(x),I):n(x)}function O(x){return x===45&&i===2?(e.consume(x),Y):x===60&&i===1?(e.consume(x),le):x===62&&i===4?(e.consume(x),Ae):x===63&&i===3?(e.consume(x),m):x===93&&i===5?(e.consume(x),Ge):q(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(mf,We,C)(x)):x===null||q(x)?(e.exit("htmlFlowData"),C(x)):(e.consume(x),O)}function C(x){return e.check(xf,R,We)(x)}function R(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),P}function P(x){return x===null||q(x)?C(x):(e.enter("htmlFlowData"),O(x))}function Y(x){return x===45?(e.consume(x),m):O(x)}function le(x){return x===47?(e.consume(x),l="",_e):O(x)}function _e(x){if(x===62){const Re=l.toLowerCase();return Ii.includes(Re)?(e.consume(x),Ae):O(x)}return Ve(x)&&l.length<8?(e.consume(x),l+=String.fromCharCode(x),_e):O(x)}function Ge(x){return x===93?(e.consume(x),m):O(x)}function m(x){return x===62?(e.consume(x),Ae):x===45&&i===2?(e.consume(x),m):O(x)}function Ae(x){return x===null||q(x)?(e.exit("htmlFlowData"),We(x)):(e.consume(x),Ae)}function We(x){return e.exit("htmlFlow"),t(x)}}function bf(e,t,n){const r=this;return i;function i(l){return q(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function vf(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(lr,t,n)}}const jf={name:"htmlText",tokenize:wf};function wf(e,t,n){const r=this;let i,a,l;return o;function o(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),c}function c(m){return m===33?(e.consume(m),u):m===47?(e.consume(m),A):m===63?(e.consume(m),E):Ve(m)?(e.consume(m),F):n(m)}function u(m){return m===45?(e.consume(m),d):m===91?(e.consume(m),a=0,b):Ve(m)?(e.consume(m),k):n(m)}function d(m){return m===45?(e.consume(m),f):n(m)}function h(m){return m===null?n(m):m===45?(e.consume(m),p):q(m)?(l=h,le(m)):(e.consume(m),h)}function p(m){return m===45?(e.consume(m),f):h(m)}function f(m){return m===62?Y(m):m===45?p(m):h(m)}function b(m){const Ae="CDATA[";return m===Ae.charCodeAt(a++)?(e.consume(m),a===Ae.length?j:b):n(m)}function j(m){return m===null?n(m):m===93?(e.consume(m),v):q(m)?(l=j,le(m)):(e.consume(m),j)}function v(m){return m===93?(e.consume(m),y):j(m)}function y(m){return m===62?Y(m):m===93?(e.consume(m),y):j(m)}function k(m){return m===null||m===62?Y(m):q(m)?(l=k,le(m)):(e.consume(m),k)}function E(m){return m===null?n(m):m===63?(e.consume(m),T):q(m)?(l=E,le(m)):(e.consume(m),E)}function T(m){return m===62?Y(m):E(m)}function A(m){return Ve(m)?(e.consume(m),w):n(m)}function w(m){return m===45||Ee(m)?(e.consume(m),w):$(m)}function $(m){return q(m)?(l=$,le(m)):X(m)?(e.consume(m),$):Y(m)}function F(m){return m===45||Ee(m)?(e.consume(m),F):m===47||m===62||Ne(m)?B(m):n(m)}function B(m){return m===47?(e.consume(m),Y):m===58||m===95||Ve(m)?(e.consume(m),S):q(m)?(l=B,le(m)):X(m)?(e.consume(m),B):Y(m)}function S(m){return m===45||m===46||m===58||m===95||Ee(m)?(e.consume(m),S):I(m)}function I(m){return m===61?(e.consume(m),O):q(m)?(l=I,le(m)):X(m)?(e.consume(m),I):B(m)}function O(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,C):q(m)?(l=O,le(m)):X(m)?(e.consume(m),O):(e.consume(m),R)}function C(m){return m===i?(e.consume(m),i=void 0,P):m===null?n(m):q(m)?(l=C,le(m)):(e.consume(m),C)}function R(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||Ne(m)?B(m):(e.consume(m),R)}function P(m){return m===47||m===62||Ne(m)?B(m):n(m)}function Y(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function le(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),_e}function _e(m){return X(m)?se(e,Ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):Ge(m)}function Ge(m){return e.enter("htmlTextData"),l(m)}}const Ss={name:"labelEnd",resolveAll:Cf,resolveTo:Ef,tokenize:If},Nf={tokenize:Tf},kf={tokenize:zf},Sf={tokenize:Pf};function Cf(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ke(e,0,e.length,n),e}function Ef(e,t){let n=e.length,r=0,i,a,l,o;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const c={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},d={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return o=[["enter",c,t],["enter",u,t]],o=ze(o,e.slice(a+1,a+r+3)),o=ze(o,[["enter",d,t]]),o=ze(o,ks(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),o=ze(o,[["exit",d,t],e[l-2],e[l-1],["exit",u,t]]),o=ze(o,e.slice(l+1)),o=ze(o,[["exit",c,t]]),Ke(e,a,e.length,o),e}function If(e,t,n){const r=this;let i=r.events.length,a,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(p){return a?a._inactive?h(p):(l=r.parser.defined.includes(Vt(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(Nf,d,l?d:h)(p):p===91?e.attempt(kf,d,l?u:h)(p):l?d(p):h(p)}function u(p){return e.attempt(Sf,d,h)(p)}function d(p){return t(p)}function h(p){return a._balanced=!0,n(p)}}function Tf(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Ne(h)?Nn(e,a)(h):a(h)}function a(h){return h===41?d(h):tl(e,l,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function l(h){return Ne(h)?Nn(e,c)(h):d(h)}function o(h){return n(h)}function c(h){return h===34||h===39||h===40?rl(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Ne(h)?Nn(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function zf(e,t,n){const r=this;return i;function i(o){return nl.call(r,e,a,l,"reference","referenceMarker","referenceString")(o)}function a(o){return r.parser.defined.includes(Vt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function l(o){return n(o)}}function Pf(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const _f={name:"labelStartImage",resolveAll:Ss.resolveAll,tokenize:Af};function Af(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),l):n(o)}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Rf={name:"labelStartLink",resolveAll:Ss.resolveAll,tokenize:Of};function Of(e,t,n){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const br={name:"lineEnding",tokenize:Mf};function Mf(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),se(e,t,"linePrefix")}}const Vn={name:"thematicBreak",tokenize:Df};function Df(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),l(u)}function l(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||q(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),X(u)?se(e,o,"whitespace")(u):o(u))}}const ve={continuation:{tokenize:Uf},exit:qf,name:"list",tokenize:Bf},Lf={partial:!0,tokenize:$f},Ff={partial:!0,tokenize:Hf};function Bf(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return o;function o(f){const b=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Yr(f)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Vn,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return Yr(f)&&++l<10?(e.consume(f),c):(!r.interrupt||l<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(lr,r.interrupt?n:d,e.attempt(Lf,p,h))}function d(f){return r.containerState.initialBlankLine=!0,a++,p(f)}function h(f){return X(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Uf(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(lr,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,se(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!X(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ff,t,l)(o))}function l(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,se(e,e.attempt(ve,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Hf(e,t,n){const r=this;return se(e,i,"listItemIndent",r.containerState.size+1);function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function qf(e){e.exit(this.containerState.type)}function $f(e,t,n){const r=this;return se(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=r.events[r.events.length-1];return!X(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Ti={name:"setextUnderline",resolveTo:Vf,tokenize:Qf};function Vf(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function Qf(e,t,n){const r=this;let i;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"),i=u,l(u)):n(u)}function l(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),X(u)?se(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||q(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Kf={tokenize:Gf};function Gf(e){const t=this,n=e.attempt(lr,r,e.attempt(this.parser.constructs.flowInitial,i,se(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Jh,i)),"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 i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Wf={resolveAll:il()},Yf=sl("string"),Xf=sl("text");function sl(e){return{resolveAll:il(e==="text"?Jf:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,l,o);return l;function l(d){return u(d)?a(d):o(d)}function o(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=i[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function il(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function Jf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,l=-1,o=0,c;for(;a--;){const u=i[a];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)o++,l--;if(l)break;l=-1}else if(u===-2)c=!0,o++;else if(u!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||c||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Zf={42:ve,43:ve,45:ve,48:ve,49:ve,50:ve,51:ve,52:ve,53:ve,54:ve,55:ve,56:ve,57:ve,62:Xa},ep={91:rf},tp={[-2]:yr,[-1]:yr,32:yr},np={35:uf,42:Vn,45:[Ti,Vn],60:pf,61:Ti,95:Vn,96:Ei,126:Ei},rp={38:Za,92:Ja},sp={[-5]:br,[-4]:br,[-3]:br,33:_f,38:Za,42:Xr,60:[Ah,jf],91:Rf,92:[of,Ja],93:Ss,95:Xr,96:Qh},ip={null:[Xr,Wf]},ap={null:[42,95]},lp={null:[]},op=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ap,contentInitial:ep,disable:lp,document:Zf,flow:np,flowInitial:tp,insideSpan:ip,string:rp,text:sp},Symbol.toStringTag,{value:"Module"}));function cp(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},a=[];let l=[],o=[];const c={attempt:$(A),check:$(w),consume:k,enter:E,exit:T,interrupt:$(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:j,events:[],now:b,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&a.push(t),u;function h(I){return l=ze(l,I),v(),l[l.length-1]!==null?[]:(F(t,0),u.events=ks(a,u.events,u),u.events)}function p(I,O){return dp(f(I),O)}function f(I){return up(l,I)}function b(){const{_bufferIndex:I,_index:O,line:C,column:R,offset:P}=r;return{_bufferIndex:I,_index:O,line:C,column:R,offset:P}}function j(I){i[I.line]=I.column,S()}function v(){let I;for(;r._index<l.length;){const O=l[r._index];if(typeof O=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<O.length;)y(O.charCodeAt(r._bufferIndex));else y(O)}}function y(I){d=d(I)}function k(I){q(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,S()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=I}function E(I,O){const C=O||{};return C.type=I,C.start=b(),u.events.push(["enter",C,u]),o.push(C),C}function T(I){const O=o.pop();return O.end=b(),u.events.push(["exit",O,u]),O}function A(I,O){F(I,O.from)}function w(I,O){O.restore()}function $(I,O){return C;function C(R,P,Y){let le,_e,Ge,m;return Array.isArray(R)?We(R):"tokenize"in R?We([R]):Ae(R);function Ae(he){return cn;function cn(rt){const Lt=rt!==null&&he[rt],Ft=rt!==null&&he.null,Mn=[...Array.isArray(Lt)?Lt:Lt?[Lt]:[],...Array.isArray(Ft)?Ft:Ft?[Ft]:[]];return We(Mn)(rt)}}function We(he){return le=he,_e=0,he.length===0?Y:x(he[_e])}function x(he){return cn;function cn(rt){return m=B(),Ge=he,he.partial||(u.currentConstruct=he),he.name&&u.parser.constructs.disable.null.includes(he.name)?bt():he.tokenize.call(O?Object.assign(Object.create(u),O):u,c,Re,bt)(rt)}}function Re(he){return I(Ge,m),P}function bt(he){return m.restore(),++_e<le.length?x(le[_e]):Y}}}function F(I,O){I.resolveAll&&!a.includes(I)&&a.push(I),I.resolve&&Ke(u.events,O,u.events.length-O,I.resolve(u.events.slice(O),u)),I.resolveTo&&(u.events=I.resolveTo(u.events,u))}function B(){const I=b(),O=u.previous,C=u.currentConstruct,R=u.events.length,P=Array.from(o);return{from:R,restore:Y};function Y(){r=I,u.previous=O,u.currentConstruct=C,u.events.length=R,o=P,S()}}function S(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function up(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let l;if(n===i)l=[e[n].slice(r,a)];else{if(l=e.slice(n,i),r>-1){const o=l[0];typeof o=="string"?l[0]=o.slice(r):l.shift()}a>0&&l.push(e[i].slice(0,a))}return l}function dp(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
|
|
3
|
+
`;break}case-3:{l=`\r
|
|
4
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(a)}i=a===-2,r.push(l)}return r.join("")}function hp(e){const r={constructs:yh([op,...(e||{}).extensions||[]]),content:i(Ch),defined:[],document:i(Ih),flow:i(Kf),lazy:{},string:i(Yf),text:i(Xf)};return r;function i(a){return l;function l(o){return cp(r,a,o)}}}function fp(e){for(;!el(e););return e}const zi=/[\0\t\n\r]/g;function pp(){let e=1,t="",n=!0,r;return i;function i(a,l,o){const c=[];let u,d,h,p,f;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),h=0,t="",n&&(a.charCodeAt(0)===65279&&h++,n=void 0);h<a.length;){if(zi.lastIndex=h,u=zi.exec(a),p=u&&u.index!==void 0?u.index:a.length,f=a.charCodeAt(p),!u){t=a.slice(h);break}if(f===10&&h===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<p&&(c.push(a.slice(h,p)),e+=p-h),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const mp=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function xp(e){return e.replace(mp,gp)}function gp(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Ya(n.slice(a?2:1),a?16:10)}return Ns(n)||e}const al={}.hasOwnProperty;function yp(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),bp(n)(fp(hp(n).document().write(pp()(e,t,!0))))}function bp(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Rs),autolinkProtocol:B,autolinkEmail:B,atxHeading:a(Ps),blockQuote:a(Ft),characterEscape:B,characterReference:B,codeFenced:a(Mn),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Mn,l),codeText:a(gl,l),codeTextData:B,data:B,codeFlowValue:B,definition:a(yl),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(bl),hardBreakEscape:a(_s),hardBreakTrailing:a(_s),htmlFlow:a(As,l),htmlFlowData:B,htmlText:a(As,l),htmlTextData:B,image:a(vl),label:l,link:a(Rs),listItem:a(jl),listItemValue:p,listOrdered:a(Os,h),listUnordered:a(Os),paragraph:a(wl),reference:x,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Ps),strong:a(Nl),thematicBreak:a(Sl)},exit:{atxHeading:c(),atxHeadingSequence:A,autolink:c(),autolinkEmail:Lt,autolinkProtocol:rt,blockQuote:c(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:bt,characterReferenceMarkerNumeric:bt,characterReferenceValue:he,characterReference:cn,codeFenced:c(v),codeFencedFence:j,codeFencedFenceInfo:f,codeFencedFenceMeta:b,codeFlowValue:S,codeIndented:c(y),codeText:c(P),codeTextData:S,data:S,definition:c(),definitionDestinationString:T,definitionLabelString:k,definitionTitleString:E,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(C),htmlFlowData:S,htmlText:c(R),htmlTextData:S,image:c(le),label:Ge,labelText:_e,lineEnding:I,link:c(Y),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Re,resourceDestinationString:m,resourceTitleString:Ae,resource:We,setextHeading:c(F),setextHeadingLineSequence:$,setextHeadingText:w,strong:c(),thematicBreak:c()}};ll(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(N){let _={type:"root",children:[]};const V={stack:[_],tokenStack:[],config:t,enter:o,exit:u,buffer:l,resume:d,data:n},K=[];let ne=-1;for(;++ne<N.length;)if(N[ne][1].type==="listOrdered"||N[ne][1].type==="listUnordered")if(N[ne][0]==="enter")K.push(ne);else{const Oe=K.pop();ne=i(N,Oe,ne)}for(ne=-1;++ne<N.length;){const Oe=t[N[ne][0]];al.call(Oe,N[ne][1].type)&&Oe[N[ne][1].type].call(Object.assign({sliceSerialize:N[ne][2].sliceSerialize},V),N[ne][1])}if(V.tokenStack.length>0){const Oe=V.tokenStack[V.tokenStack.length-1];(Oe[1]||Pi).call(V,void 0,Oe[0])}for(_.position={start:st(N.length>0?N[0][1].start:{line:1,column:1,offset:0}),end:st(N.length>0?N[N.length-2][1].end:{line:1,column:1,offset:0})},ne=-1;++ne<t.transforms.length;)_=t.transforms[ne](_)||_;return _}function i(N,_,V){let K=_-1,ne=-1,Oe=!1,vt,Ye,un,dn;for(;++K<=V;){const Se=N[K];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?ne++:ne--,dn=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(vt&&!dn&&!ne&&!un&&(un=K),dn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:dn=void 0}if(!ne&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||ne===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(vt){let Bt=K;for(Ye=void 0;Bt--;){const Xe=N[Bt];if(Xe[1].type==="lineEnding"||Xe[1].type==="lineEndingBlank"){if(Xe[0]==="exit")continue;Ye&&(N[Ye][1].type="lineEndingBlank",Oe=!0),Xe[1].type="lineEnding",Ye=Bt}else if(!(Xe[1].type==="linePrefix"||Xe[1].type==="blockQuotePrefix"||Xe[1].type==="blockQuotePrefixWhitespace"||Xe[1].type==="blockQuoteMarker"||Xe[1].type==="listItemIndent"))break}un&&(!Ye||un<Ye)&&(vt._spread=!0),vt.end=Object.assign({},Ye?N[Ye][1].start:Se[1].end),N.splice(Ye||K,0,["exit",vt,Se[2]]),K++,V++}if(Se[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};vt=Bt,N.splice(K,0,["enter",Bt,Se[2]]),K++,V++,un=void 0,dn=!0}}}return N[_][1]._spread=Oe,V}function a(N,_){return V;function V(K){o.call(this,N(K),K),_&&_.call(this,K)}}function l(){this.stack.push({type:"fragment",children:[]})}function o(N,_,V){this.stack[this.stack.length-1].children.push(N),this.stack.push(N),this.tokenStack.push([_,V||void 0]),N.position={start:st(_.start),end:void 0}}function c(N){return _;function _(V){N&&N.call(this,V),u.call(this,V)}}function u(N,_){const V=this.stack.pop(),K=this.tokenStack.pop();if(K)K[0].type!==N.type&&(_?_.call(this,N,K[0]):(K[1]||Pi).call(this,N,K[0]));else throw new Error("Cannot close `"+N.type+"` ("+wn({start:N.start,end:N.end})+"): it’s not open");V.position.end=st(N.end)}function d(){return xh(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(N){if(this.data.expectingFirstListItemValue){const _=this.stack[this.stack.length-2];_.start=Number.parseInt(this.sliceSerialize(N),10),this.data.expectingFirstListItemValue=void 0}}function f(){const N=this.resume(),_=this.stack[this.stack.length-1];_.lang=N}function b(){const N=this.resume(),_=this.stack[this.stack.length-1];_.meta=N}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const N=this.resume(),_=this.stack[this.stack.length-1];_.value=N.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const N=this.resume(),_=this.stack[this.stack.length-1];_.value=N.replace(/(\r?\n|\r)$/g,"")}function k(N){const _=this.resume(),V=this.stack[this.stack.length-1];V.label=_,V.identifier=Vt(this.sliceSerialize(N)).toLowerCase()}function E(){const N=this.resume(),_=this.stack[this.stack.length-1];_.title=N}function T(){const N=this.resume(),_=this.stack[this.stack.length-1];_.url=N}function A(N){const _=this.stack[this.stack.length-1];if(!_.depth){const V=this.sliceSerialize(N).length;_.depth=V}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function $(N){const _=this.stack[this.stack.length-1];_.depth=this.sliceSerialize(N).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function B(N){const V=this.stack[this.stack.length-1].children;let K=V[V.length-1];(!K||K.type!=="text")&&(K=kl(),K.position={start:st(N.start),end:void 0},V.push(K)),this.stack.push(K)}function S(N){const _=this.stack.pop();_.value+=this.sliceSerialize(N),_.position.end=st(N.end)}function I(N){const _=this.stack[this.stack.length-1];if(this.data.atHardBreak){const V=_.children[_.children.length-1];V.position.end=st(N.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(_.type)&&(B.call(this,N),S.call(this,N))}function O(){this.data.atHardBreak=!0}function C(){const N=this.resume(),_=this.stack[this.stack.length-1];_.value=N}function R(){const N=this.resume(),_=this.stack[this.stack.length-1];_.value=N}function P(){const N=this.resume(),_=this.stack[this.stack.length-1];_.value=N}function Y(){const N=this.stack[this.stack.length-1];if(this.data.inReference){const _=this.data.referenceType||"shortcut";N.type+="Reference",N.referenceType=_,delete N.url,delete N.title}else delete N.identifier,delete N.label;this.data.referenceType=void 0}function le(){const N=this.stack[this.stack.length-1];if(this.data.inReference){const _=this.data.referenceType||"shortcut";N.type+="Reference",N.referenceType=_,delete N.url,delete N.title}else delete N.identifier,delete N.label;this.data.referenceType=void 0}function _e(N){const _=this.sliceSerialize(N),V=this.stack[this.stack.length-2];V.label=xp(_),V.identifier=Vt(_).toLowerCase()}function Ge(){const N=this.stack[this.stack.length-1],_=this.resume(),V=this.stack[this.stack.length-1];if(this.data.inReference=!0,V.type==="link"){const K=N.children;V.children=K}else V.alt=_}function m(){const N=this.resume(),_=this.stack[this.stack.length-1];_.url=N}function Ae(){const N=this.resume(),_=this.stack[this.stack.length-1];_.title=N}function We(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function Re(N){const _=this.resume(),V=this.stack[this.stack.length-1];V.label=_,V.identifier=Vt(this.sliceSerialize(N)).toLowerCase(),this.data.referenceType="full"}function bt(N){this.data.characterReferenceType=N.type}function he(N){const _=this.sliceSerialize(N),V=this.data.characterReferenceType;let K;V?(K=Ya(_,V==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):K=Ns(_);const ne=this.stack[this.stack.length-1];ne.value+=K}function cn(N){const _=this.stack.pop();_.position.end=st(N.end)}function rt(N){S.call(this,N);const _=this.stack[this.stack.length-1];_.url=this.sliceSerialize(N)}function Lt(N){S.call(this,N);const _=this.stack[this.stack.length-1];_.url="mailto:"+this.sliceSerialize(N)}function Ft(){return{type:"blockquote",children:[]}}function Mn(){return{type:"code",lang:null,meta:null,value:""}}function gl(){return{type:"inlineCode",value:""}}function yl(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function bl(){return{type:"emphasis",children:[]}}function Ps(){return{type:"heading",depth:0,children:[]}}function _s(){return{type:"break"}}function As(){return{type:"html",value:""}}function vl(){return{type:"image",title:null,url:"",alt:null}}function Rs(){return{type:"link",title:null,url:"",children:[]}}function Os(N){return{type:"list",ordered:N.type==="listOrdered",start:null,spread:N._spread,children:[]}}function jl(N){return{type:"listItem",spread:N._spread,checked:null,children:[]}}function wl(){return{type:"paragraph",children:[]}}function Nl(){return{type:"strong",children:[]}}function kl(){return{type:"text",value:""}}function Sl(){return{type:"thematicBreak"}}}function st(e){return{line:e.line,column:e.column,offset:e.offset}}function ll(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ll(e,r):vp(e,r)}}function vp(e,t){let n;for(n in t)if(al.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Pi(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+wn({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wn({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+wn({start:t.start,end:t.end})+") is still open")}function jp(e){const t=this;t.parser=n;function n(r){return yp(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function wp(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Np(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
|
+
`}]}function kp(e,t){const n=t.value?t.value+`
|
|
6
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[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 Sp(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Cp(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ep(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=on(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let l,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=a+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Ip(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 Tp(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ol(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 i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function zp(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ol(e,t);const i={src:on(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Pp(e,t){const n={src:on(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 _p(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 Ap(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return ol(e,t);const i={href:on(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Rp(e,t){const n={href:on(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 Op(e,t,n){const r=e.all(t),i=n?Mp(n):cl(t),a={},l=[];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 o=-1;for(;++o<r.length;){const d=r[o];(i||o!==0||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
7
|
+
`}),d.type==="element"&&d.tagName==="p"&&!i?l.push(...d.children):l.push(d)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&l.push({type:"text",value:`
|
|
8
|
+
`});const u={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,u),e.applyData(t,u)}function Mp(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=cl(n[r])}return t}function cl(e){const t=e.spread;return t??e.children.length>1}function Dp(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Lp(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fp(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Bp(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Up(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=bs(t.children[1]),c=qa(t.children[t.children.length-1]);o&&c&&(l.position={start:o,end:c}),i.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Hp(e,t,n){const r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,o=l?l.length:t.children.length;let c=-1;const u=[];for(;++c<o;){const h=t.children[c],p={},f=l?l[c]:void 0;f&&(p.align=f);let b={type:"element",tagName:a,properties:p,children:[]};h&&(b.children=e.all(h),e.patch(h,b),b=e.applyData(h,b)),u.push(b)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function qp(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const _i=9,Ai=32;function $p(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const a=[];for(;r;)a.push(Ri(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Ri(t.slice(i),i>0,!1)),a.join("")}function Ri(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===_i||a===Ai;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===_i||a===Ai;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Vp(e,t){const n={type:"text",value:$p(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Qp(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Kp={blockquote:wp,break:Np,code:kp,delete:Sp,emphasis:Cp,footnoteReference:Ep,heading:Ip,html:Tp,imageReference:zp,image:Pp,inlineCode:_p,linkReference:Ap,link:Rp,listItem:Op,list:Dp,paragraph:Lp,root:Fp,strong:Bp,table:Up,tableCell:qp,tableRow:Hp,text:Vp,thematicBreak:Qp,toml:Fn,yaml:Fn,definition:Fn,footnoteDefinition:Fn};function Fn(){}const ul=-1,or=0,kn=1,Wn=2,Cs=3,Es=4,Is=5,Ts=6,dl=7,hl=8,Oi=typeof self=="object"?self:globalThis,Gp=(e,t)=>{const n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);const[a,l]=t[i];switch(a){case or:case ul:return n(l,i);case kn:{const o=n([],i);for(const c of l)o.push(r(c));return o}case Wn:{const o=n({},i);for(const[c,u]of l)o[r(c)]=r(u);return o}case Cs:return n(new Date(l),i);case Es:{const{source:o,flags:c}=l;return n(new RegExp(o,c),i)}case Is:{const o=n(new Map,i);for(const[c,u]of l)o.set(r(c),r(u));return o}case Ts:{const o=n(new Set,i);for(const c of l)o.add(r(c));return o}case dl:{const{name:o,message:c}=l;return n(new Oi[o](c),i)}case hl:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:o}=new Uint8Array(l);return n(new DataView(o),l)}}return n(new Oi[a](l),i)};return r},Mi=e=>Gp(new Map,e)(0),Ht="",{toString:Wp}={},{keys:Yp}=Object,xn=e=>{const t=typeof e;if(t!=="object"||!e)return[or,t];const n=Wp.call(e).slice(8,-1);switch(n){case"Array":return[kn,Ht];case"Object":return[Wn,Ht];case"Date":return[Cs,Ht];case"RegExp":return[Es,Ht];case"Map":return[Is,Ht];case"Set":return[Ts,Ht];case"DataView":return[kn,n]}return n.includes("Array")?[kn,n]:n.includes("Error")?[dl,n]:[Wn,n]},Bn=([e,t])=>e===or&&(t==="function"||t==="symbol"),Xp=(e,t,n,r)=>{const i=(l,o)=>{const c=r.push(l)-1;return n.set(o,c),c},a=l=>{if(n.has(l))return n.get(l);let[o,c]=xn(l);switch(o){case or:{let d=l;switch(c){case"bigint":o=hl,d=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([ul],l)}return i([o,d],l)}case kn:{if(c){let p=l;return c==="DataView"?p=new Uint8Array(l.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(l)),i([c,[...p]],l)}const d=[],h=i([o,d],l);for(const p of l)d.push(a(p));return h}case Wn:{if(c)switch(c){case"BigInt":return i([c,l.toString()],l);case"Boolean":case"Number":case"String":return i([c,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const d=[],h=i([o,d],l);for(const p of Yp(l))(e||!Bn(xn(l[p])))&&d.push([a(p),a(l[p])]);return h}case Cs:return i([o,l.toISOString()],l);case Es:{const{source:d,flags:h}=l;return i([o,{source:d,flags:h}],l)}case Is:{const d=[],h=i([o,d],l);for(const[p,f]of l)(e||!(Bn(xn(p))||Bn(xn(f))))&&d.push([a(p),a(f)]);return h}case Ts:{const d=[],h=i([o,d],l);for(const p of l)(e||!Bn(xn(p)))&&d.push(a(p));return h}}const{message:u}=l;return i([o,{name:c,message:u}],l)};return a},Di=(e,{json:t,lossy:n}={})=>{const r=[];return Xp(!(t||n),!!t,new Map,r)(e),r},Yn=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Mi(Di(e,t)):structuredClone(e):(e,t)=>Mi(Di(e,t));function Jp(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 Zp(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function em(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Jp,r=e.options.footnoteBackLabel||Zp,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=on(h.toLowerCase());let f=0;const b=[],j=e.footnoteCounts.get(h);for(;j!==void 0&&++f<=j;){b.length>0&&b.push({type:"text",value:" "});let k=typeof n=="string"?n:n(c,f);typeof k=="string"&&(k={type:"text",value:k}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const v=d[d.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const k=v.children[v.children.length-1];k&&k.type==="text"?k.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-"+p},children:e.wrap(d,!0)};e.patch(u,y),o.push(y)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Yn(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
9
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
10
|
+
`}]}}const fl=(function(e){if(e==null)return sm;if(typeof e=="function")return cr(e);if(typeof e=="object")return Array.isArray(e)?tm(e):nm(e);if(typeof e=="string")return rm(e);throw new Error("Expected function, string, or object as test")});function tm(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=fl(e[n]);return cr(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function nm(e){const t=e;return cr(n);function n(r){const i=r;let a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function rm(e){return cr(t);function t(n){return n&&n.type===e}}function cr(e){return t;function t(n,r,i){return!!(im(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function sm(){return!0}function im(e){return e!==null&&typeof e=="object"&&"type"in e}const pl=[],am=!0,Li=!1,lm="skip";function om(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const a=fl(i),l=r?-1:1;o(e,void 0,[])();function o(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=pl,b,j,v;if((!t||a(c,u,d[d.length-1]||void 0))&&(f=cm(n(c,d)),f[0]===Li))return f;if("children"in c&&c.children){const y=c;if(y.children&&f[0]!==lm)for(j=(r?y.children.length:-1)+l,v=d.concat(y);j>-1&&j<y.children.length;){const k=y.children[j];if(b=o(k,j,v)(),b[0]===Li)return b;j=typeof b[1]=="number"?b[1]:j+l}}return f}}}function cm(e){return Array.isArray(e)?e:typeof e=="number"?[am,e]:e==null?pl:[e]}function ml(e,t,n,r){let i,a,l;typeof t=="function"&&typeof n!="function"?(a=void 0,l=t,i=n):(a=t,l=n,i=r),om(e,a,o,i);function o(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return l(c,h,d)}}const Jr={}.hasOwnProperty,um={};function dm(e,t){const n=t||um,r=new Map,i=new Map,a=new Map,l={...Kp,...n.handlers},o={all:u,applyData:fm,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:l,one:c,options:n,patch:hm,wrap:mm};return ml(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),o;function c(d,h){const p=d.type,f=o.handlers[p];if(Jr.call(o.handlers,p)&&f)return f(o,d,h);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in d){const{children:j,...v}=d,y=Yn(v);return y.children=o.all(d),y}return Yn(d)}return(o.options.unknownHandler||pm)(o,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const b=o.one(p[f],d);if(b){if(f&&p[f-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=Fi(b.value)),!Array.isArray(b)&&b.type==="element")){const j=b.children[0];j&&j.type==="text"&&(j.value=Fi(j.value))}Array.isArray(b)?h.push(...b):h.push(b)}}}return h}}function hm(e,t){e.position&&(t.position=Gd(e))}function fm(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,Yn(a)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function pm(e,t){const n=t.data||{},r="value"in t&&!(Jr.call(n,"hProperties")||Jr.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function mm(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
11
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
12
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
13
|
+
`}),n}function Fi(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Bi(e,t){const n=dm(e,t),r=n.one(e,void 0),i=em(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&a.children.push({type:"text",value:`
|
|
14
|
+
`},i),a}function xm(e,t){return e&&"run"in e?async function(n,r){const i=Bi(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Bi(n,{file:r,...e||t})}}function Ui(e){if(e)throw e}var vr,Hi;function gm(){if(Hi)return vr;Hi=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=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 p;for(p in u);return typeof p>"u"||e.call(u,p)},l=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},o=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return vr=function c(){var u,d,h,p,f,b,j=arguments[0],v=1,y=arguments.length,k=!1;for(typeof j=="boolean"&&(k=j,j=arguments[1]||{},v=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});v<y;++v)if(u=arguments[v],u!=null)for(d in u)h=o(j,d),p=o(u,d),j!==p&&(k&&p&&(a(p)||(f=i(p)))?(f?(f=!1,b=h&&i(h)?h:[]):b=h&&a(h)?h:{},l(j,{name:d,newValue:c(k,b,p)})):typeof p<"u"&&l(j,{name:d,newValue:p}));return j},vr}var ym=gm();const jr=aa(ym);function Zr(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function bm(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);o(null,...i);function o(c,...u){const d=e[++a];let h=-1;if(c){l(c);return}for(;++h<i.length;)(u[h]===null||u[h]===void 0)&&(u[h]=i[h]);i=u,d?vm(d,o)(...u):l(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function vm(e,t){let n;return r;function r(...l){const o=e.length>l.length;let c;o&&l.push(i);try{c=e.apply(this,l)}catch(u){const d=u;if(o&&n)throw d;return i(d)}o||(c&&c.then&&typeof c.then=="function"?c.then(a,i):c instanceof Error?i(c):a(c))}function i(l,...o){n||(n=!0,t(l,...o))}function a(l){i(null,l)}}const Ue={basename:jm,dirname:wm,extname:Nm,join:km,sep:"/"};function jm(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');On(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else l<0&&(a=!0,l=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function wm(e){if(On(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 Nm(e){On(e);let t=e.length,n=-1,r=0,i=-1,a=0,l;for(;t--;){const o=e.codePointAt(t);if(o===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function km(...e){let t=-1,n;for(;++t<e.length;)On(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Sm(n)}function Sm(e){On(e);const t=e.codePointAt(0)===47;let n=Cm(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Cm(e,t){let n="",r=0,i=-1,a=0,l=-1,o,c;for(;++l<=e.length;){if(l<e.length)o=e.codePointAt(l);else{if(o===47)break;o=47}if(o===47){if(!(i===l-1||a===1))if(i!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),i=l,a=0;continue}}else if(n.length>0){n="",r=0,i=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,l):n=e.slice(i+1,l),r=l-i-1;i=l,a=0}else o===46&&a>-1?a++:a=-1}return n}function On(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Em={cwd:Im};function Im(){return"/"}function es(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Tm(e){if(typeof e=="string")e=new URL(e);else if(!es(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 zm(e)}function zm(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(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const wr=["history","path","basename","stem","extname","dirname"];class xl{constructor(t){let n;t?es(t)?n={path:t}:typeof t=="string"||Pm(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Em.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wr.length;){const a=wr[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)wr.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ue.basename(this.path):void 0}set basename(t){kr(t,"basename"),Nr(t,"basename"),this.path=Ue.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ue.dirname(this.path):void 0}set dirname(t){qi(this.basename,"dirname"),this.path=Ue.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ue.extname(this.path):void 0}set extname(t){if(Nr(t,"extname"),qi(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ue.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){es(t)&&(t=Tm(t)),kr(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ue.basename(this.path,this.extname):void 0}set stem(t){kr(t,"stem"),Nr(t,"stem"),this.path=Ue.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new me(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Nr(e,t){if(e&&e.includes(Ue.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ue.sep+"`")}function kr(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function qi(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Pm(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _m=(function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),Am={}.hasOwnProperty;class zs extends _m{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=bm()}copy(){const t=new zs;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(jr(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Er("data",this.frozen),this.namespace[t]=n,this):Am.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Er("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Un(t),r=this.parser||this.Parser;return Sr("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Sr("process",this.parser||this.Parser),Cr("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,l){const o=Un(t),c=r.parse(o);r.run(c,o,function(d,h,p){if(d||!h||!p)return u(d);const f=h,b=r.stringify(f,p);Mm(b)?p.value=b:p.result=b,u(d,p)});function u(d,h){d||!h?l(d):a?a(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Sr("processSync",this.parser||this.Parser),Cr("processSync",this.compiler||this.Compiler),this.process(t,i),Vi("processSync","process",n),r;function i(a,l){n=!0,Ui(a),r=l}}run(t,n,r){$i(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,o){const c=Un(n);i.run(t,c,u);function u(d,h,p){const f=h||t;d?o(d):l?l(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),Vi("runSync","run",r),i;function a(l,o){Ui(l),i=o,r=!0}}stringify(t,n){this.freeze();const r=Un(n),i=this.compiler||this.Compiler;return Cr("stringify",i),$i(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Er("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else l(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function l(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(i.settings=jr(!0,i.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];a(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[f,...b]=d;const j=r[p][1];Zr(j)&&Zr(f)&&(f=jr(!0,j,f)),r[p]=[u,f,...b]}}}}const Rm=new zs().freeze();function Sr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Er(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 $i(e){if(!Zr(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Vi(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Un(e){return Om(e)?e:new xl(e)}function Om(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Mm(e){return typeof e=="string"||Dm(e)}function Dm(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Lm="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Qi=[],Ki={allowDangerousHtml:!0},Fm=/^(https?|ircs?|mailto|xmpp)$/i,Bm=[{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 Um(e){const t=Hm(e),n=qm(e);return $m(t.runSync(t.parse(n),n),e)}function Hm(e){const t=e.rehypePlugins||Qi,n=e.remarkPlugins||Qi,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ki}:Ki;return Rm().use(jp).use(n).use(xm,r).use(t)}function qm(e){const t=e.children||"",n=new xl;return typeof t=="string"&&(n.value=t),n}function $m(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,l=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||Vm;for(const d of Bm)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Lm+d.id,void 0);return ml(e,u),Zd(e,{Fragment:s.Fragment,components:i,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function u(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return l?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in gr)if(Object.hasOwn(gr,f)&&Object.hasOwn(d.properties,f)){const b=d.properties[f],j=gr[f];(j===null||j.includes(d.tagName))&&(d.properties[f]=c(String(b||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):a?a.includes(d.tagName):!1;if(!f&&r&&typeof h=="number"&&(f=!r(d,h,p)),f&&p&&typeof h=="number")return o&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function Vm(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Fm.test(e.slice(0,t))?e:""}const Qm={created:s.jsx(gt,{className:"size-3.5"}),validated:s.jsx(ls,{className:"size-3.5"}),deployed:s.jsx(Kn,{className:"size-3.5"}),rejected:s.jsx(Be,{className:"size-3.5"}),rolled_back:s.jsx(ha,{className:"size-3.5"})},Km={created:"outline",validated:"secondary",deployed:"default",rejected:"destructive",rolled_back:"destructive"};function Gm(e){const t=e.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!t)return{meta:{},body:e};const n={};for(const r of t[1].split(`
|
|
15
|
+
`)){const i=r.indexOf(":");if(i>0){const a=r.slice(0,i).trim(),l=r.slice(i+1).trim();a&&l&&(n[a]=l)}}return{meta:n,body:t[2]}}function Wm({meta:e}){const t=Object.entries(e);return t.length===0?null:s.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:t.map(([n,r])=>s.jsxs("div",{className:"contents",children:[s.jsx("span",{className:"font-medium text-muted-foreground capitalize",children:n}),s.jsx("span",{className:"text-foreground truncate",children:r})]},n))})}function Gi({label:e,text:t,variant:n}){const{meta:r,body:i}=Gm(t),a=Object.keys(r).length>0;return s.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(gn,{className:"size-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),n==="proposed"&&s.jsx(U,{variant:"secondary",className:"text-[10px]",children:"New"})]}),a&&s.jsx("div",{className:"rounded-md border bg-muted/30 p-3",children:s.jsx(Wm,{meta:r})}),s.jsx("div",{className:"skill-markdown rounded-md border bg-card p-4",children:s.jsx(Um,{children:i})})]})}function Ym(e,t){if(typeof t=="boolean")return t?s.jsx(nt,{className:"size-3.5 text-emerald-500 inline"}):s.jsx(Be,{className:"size-3.5 text-red-500 inline"});if(typeof t=="number"){if(e.includes("rate")||e.includes("change")||t>=-1&&t<=1&&e!=="count"){const r=(t*100).toFixed(1),i=t>0&&e.includes("change")?"+":"";return s.jsxs("span",{className:"font-mono",children:[i,r,"%"]})}return s.jsx("span",{className:"font-mono",children:t})}return t==null?s.jsx("span",{className:"text-muted-foreground",children:"--"}):typeof t=="string"?s.jsx("span",{children:t}):Array.isArray(t)?t.length===0?s.jsx("span",{className:"text-muted-foreground italic",children:"none"}):s.jsxs("span",{className:"font-mono",children:[t.length," entries"]}):typeof t=="object"?s.jsx("span",{className:"font-mono",children:"1 entry"}):s.jsx("span",{children:String(t)})}function ts({entry:e}){const t=e.entry,n=(t==null?void 0:t.query)??e.query??e.prompt??e.input??e.text,r=(t==null?void 0:t.should_trigger)??e.should_trigger,i=(t==null?void 0:t.invocation_type)??e.invocation_type,a=e.before_pass??e.before??e.original_triggered??e.baseline,l=e.after_pass??e.after??e.triggered??e.result,o=e.passed??e.matched,c=typeof l=="boolean"?l:typeof o=="boolean"?o:null;return s.jsxs("div",{className:"flex items-start gap-2 text-xs py-1.5 border-b border-border/50 last:border-0",children:[c!==null?c?s.jsx(nt,{className:"size-3.5 text-emerald-500 shrink-0 mt-0.5"}):s.jsx(Be,{className:"size-3.5 text-red-500 shrink-0 mt-0.5"}):s.jsx(gt,{className:"size-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsx("span",{className:"flex-1 min-w-0 line-clamp-2",children:n?String(n):JSON.stringify(e)}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[typeof a=="boolean"&&typeof l=="boolean"&&s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[a?"pass":"fail"," → ",l?"pass":"fail"]}),r!==void 0&&s.jsxs(U,{variant:"secondary",className:"text-[9px]",children:["expect: ",String(r)]}),i!=null&&s.jsx(U,{variant:"secondary",className:"text-[9px]",children:String(i)})]})]})}function Xm({validation:e}){const{improved:t,before_pass_rate:n,after_pass_rate:r,net_change:i,regressions:a,new_passes:l,per_entry_results:o,...c}=e,u=Array.isArray(a)?a:[],d=Array.isArray(l)?l:[],h=Array.isArray(o)?o:[];return s.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 space-y-3",children:[s.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Validation Results",s.jsx("span",{className:"font-normal text-muted-foreground/60 ml-1.5",children:"— Before/after comparison from eval tests"})]}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t!==void 0&&s.jsx(U,{variant:t?"default":"destructive",className:"text-[10px]",children:t?"Improved":"Regressed"}),typeof n=="number"&&typeof r=="number"&&s.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:[(n*100).toFixed(1),"% → ",(r*100).toFixed(1),"%"]}),typeof i=="number"&&s.jsxs("span",{className:`text-xs font-mono font-semibold ${i>0?"text-emerald-600 dark:text-emerald-400":"text-red-500"}`,children:[i>0?"+":"",(i*100).toFixed(1),"%"]})]}),d.length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[11px] font-medium text-emerald-600 dark:text-emerald-400 mb-1",children:["New Passes (",d.length,")"]}),s.jsx("div",{className:"rounded border bg-card p-2",children:d.map((p,f)=>s.jsx(ts,{entry:typeof p=="object"&&p!==null?p:{value:p}},f))})]}),u.length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[11px] font-medium text-red-500 mb-1",children:["Regressions (",u.length,")"]}),s.jsx("div",{className:"rounded border border-red-200 dark:border-red-900/50 bg-card p-2",children:u.map((p,f)=>s.jsx(ts,{entry:typeof p=="object"&&p!==null?p:{value:p}},f))})]}),h.length>0&&s.jsx(Jm,{entries:h}),Object.keys(c).length>0&&s.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:Object.entries(c).map(([p,f])=>s.jsxs("div",{className:"contents",children:[s.jsx("span",{className:"font-mono text-muted-foreground",children:p}),s.jsx("span",{className:"text-foreground",children:Ym(p,f)})]},p))})]})}function Jm({entries:e}){const[t,n]=L.useState(!1),r=e.filter(a=>{if(typeof a!="object"||a===null)return!1;const l=a;return l.passed===!0||l.matched===!0||l.triggered===!0||l.after===!0||l.result===!0}).length,i=t?e:e.slice(0,5);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("p",{className:"text-[11px] font-medium text-muted-foreground",children:["Individual Test Cases (",r,"/",e.length," passed)"]}),e.length>5&&s.jsx("button",{type:"button",onClick:()=>n(!t),className:"text-[10px] text-primary hover:underline",children:t?"Show less":`Show all ${e.length}`})]}),s.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden mb-2",children:s.jsx("div",{className:"h-full rounded-full bg-emerald-500 transition-all",style:{width:`${e.length>0?r/e.length*100:0}%`}})}),s.jsx("div",{className:"rounded border bg-card p-2 max-h-[300px] overflow-y-auto",children:i.map((a,l)=>s.jsx(ts,{entry:typeof a=="object"&&a!==null?a:{value:a}},l))})]})}function ns(e){if(!e.validation)return null;const t=e.validation.after_pass_rate;return typeof t=="number"?t:null}function Zm({prev:e,curr:t}){if(e===null||t===null)return null;const n=t-e;if(n===0)return null;const r=(n*100).toFixed(1),i=n>0;return s.jsxs("span",{className:`text-[10px] font-mono font-semibold ${i?"text-emerald-600 dark:text-emerald-400":"text-red-500"}`,children:[i?"+":"",r,"% vs previous"]})}function ex({evalSet:e}){const[t,n]=L.useState(!1),r=e.filter(i=>(i.passed??i.result)===!0).length;return s.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 space-y-2",children:[s.jsxs("button",{type:"button",onClick:()=>n(!t),className:"flex items-center gap-1.5 w-full text-left",children:[t?s.jsx(Ot,{className:"size-3.5 text-muted-foreground shrink-0"}):s.jsx(an,{className:"size-3.5 text-muted-foreground shrink-0"}),s.jsx(Qo,{className:"size-3.5 text-muted-foreground"}),s.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Eval Set (",r,"/",e.length," passed)"]})]}),t&&s.jsx("div",{className:"space-y-1",children:e.map((i,a)=>{const l=i.query??i.prompt??i.input,o=i.expected??i.should_trigger,c=i.passed??i.result;return s.jsxs("div",{className:"flex items-start gap-2 text-xs py-1 border-b border-border/50 last:border-0",children:[typeof c=="boolean"?c?s.jsx(nt,{className:"size-3.5 text-emerald-500 shrink-0 mt-0.5"}):s.jsx(Be,{className:"size-3.5 text-red-500 shrink-0 mt-0.5"}):s.jsx(gt,{className:"size-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsx("span",{className:"flex-1 min-w-0 line-clamp-2",children:String(l??JSON.stringify(i))}),o!==void 0&&s.jsxs(U,{variant:"secondary",className:"text-[9px] shrink-0",children:["expect: ",String(o)]})]},a)})})]})}function Ir({entry:e,roundLabel:t,roundStatus:n,prevPassRate:r,currPassRate:i}){const a=n!=="single";return s.jsxs(Z,{className:n==="final"?"border-primary/50 shadow-sm":void 0,children:[s.jsx(ee,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(te,{className:"text-sm flex items-center gap-2",children:[s.jsx(fa,{className:"size-4 text-muted-foreground"}),"Evidence: ",e.target,a&&t&&s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:t}),n==="final"&&s.jsx(U,{variant:"default",className:"text-[10px]",children:"Final"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[a&&s.jsx(Zm,{prev:r,curr:i}),s.jsx(U,{variant:"secondary",className:"text-[10px]",children:e.stage}),e.confidence!==null&&s.jsxs(U,{variant:e.confidence>=.8?"default":e.confidence>=.5?"secondary":"destructive",className:"text-[10px] font-mono",children:[xt(e.confidence)," confidence"]}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:be(e.timestamp)})]})]})}),s.jsxs(Fe,{className:"space-y-4",children:[e.rationale&&s.jsxs("div",{className:"rounded-md border-l-2 border-primary/40 bg-primary/5 px-3 py-2",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Rationale"}),s.jsx("p",{className:"text-sm leading-relaxed",children:e.rationale})]}),e.details&&s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:e.details}),(e.original_text||e.proposed_text)&&s.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[e.original_text&&s.jsx(Gi,{label:"Original",text:e.original_text,variant:"original"}),e.proposed_text&&s.jsx(Gi,{label:"Proposed",text:e.proposed_text,variant:"proposed"})]}),e.eval_set&&e.eval_set.length>0&&s.jsx(ex,{evalSet:e.eval_set}),e.validation&&Object.keys(e.validation).length>0&&s.jsx(Xm,{validation:e.validation})]})]})}function tx({entry:e,roundLabel:t,onExpand:n}){var a;const r=ns(e),i=(a=e.validation)==null?void 0:a.improved;return s.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-3 w-full rounded-lg border border-dashed px-4 py-3 text-left hover:bg-accent/50 transition-colors",children:[s.jsx(an,{className:"size-4 text-muted-foreground shrink-0"}),s.jsx(fa,{className:"size-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.target}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:t}),s.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[r!==null&&s.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[(r*100).toFixed(1),"% pass rate"]}),typeof i=="boolean"&&s.jsx(U,{variant:i?"default":"destructive",className:"text-[9px]",children:i?"Improved":"Regressed"}),s.jsx(U,{variant:"secondary",className:"text-[10px]",children:e.stage}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:be(e.timestamp)})]})]})}function nx({proposalId:e,evolution:t,evidence:n}){const r=L.useMemo(()=>t.filter(h=>h.proposal_id===e).sort((h,p)=>new Date(h.timestamp).getTime()-new Date(p.timestamp).getTime()),[t,e]),i=L.useMemo(()=>n.filter(h=>h.proposal_id===e).sort((h,p)=>new Date(h.timestamp).getTime()-new Date(p.timestamp).getTime()),[n,e]),[a,l]=L.useState(new Set),o=h=>{l(p=>{const f=new Set(p);return f.has(h)?f.delete(h):f.add(h),f})},c=L.useMemo(()=>{for(let h=r.length-1;h>=0;h--)if(r[h].eval_snapshot)return r[h].eval_snapshot;return null},[r]),{proposalEntries:u,validationsByTarget:d}=L.useMemo(()=>{const h=[],p=new Map;for(const f of i)if(f.stage!=="validated")h.push(f);else{const b=f.target;p.has(b)||p.set(b,[]),p.get(b).push(f)}return{proposalEntries:h,validationsByTarget:p}},[i]);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-primary/20 bg-primary/5 px-3.5 py-2.5",children:[s.jsx(ua,{className:"size-4 text-primary/60 shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"This view shows the complete evidence trail for a skill evolution proposal — how the skill was changed, the eval test results before and after, and whether the change improved performance."})]}),s.jsxs(Z,{children:[s.jsx(ee,{className:"pb-3",children:s.jsxs(te,{className:"text-sm flex items-center gap-2",children:[s.jsx("span",{children:"Proposal Journey"}),s.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["#",e.slice(0,12)]})]})}),s.jsxs(Fe,{className:"space-y-3",children:[s.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r.map((h,p)=>s.jsxs("div",{className:"contents",children:[p>0&&s.jsx(Vo,{className:"size-3 text-muted-foreground/50 shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card",children:[Qm[h.action],s.jsx(U,{variant:Km[h.action]??"secondary",className:"text-[10px] capitalize",children:h.action.replace("_"," ")}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:be(h.timestamp)})]})]},`${h.action}-${p}`))}),c&&s.jsxs("div",{className:"flex items-center gap-3 rounded-md border bg-muted/20 px-3 py-2",children:[typeof c.net_change=="number"&&s.jsxs("div",{className:"flex items-center gap-1",children:[c.net_change>0?s.jsx(tr,{className:"size-3.5 text-emerald-500"}):s.jsx(nr,{className:"size-3.5 text-red-500"}),s.jsxs("span",{className:`text-sm font-semibold font-mono ${c.net_change>0?"text-emerald-600 dark:text-emerald-400":"text-red-500"}`,children:[c.net_change>0?"+":"",Math.round(c.net_change*100),"%"]})]}),typeof c.before_pass_rate=="number"&&typeof c.after_pass_rate=="number"&&s.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[Math.round(c.before_pass_rate*100),"% → ",Math.round(c.after_pass_rate*100),"%"]}),c.improved!==void 0&&s.jsx(U,{variant:c.improved?"default":"destructive",className:"text-[10px]",children:c.improved?"Improved":"Regressed"})]}),r.length>0&&r[r.length-1].details&&s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:r[r.length-1].details})]})]}),u.map(h=>s.jsx(Ir,{entry:h,roundLabel:null,roundStatus:"single",prevPassRate:null,currPassRate:null},`proposal-${h.target}-${h.timestamp}`)),Array.from(d.entries()).map(([h,p])=>{const f=p.length>1;return s.jsx("div",{className:"space-y-2",children:p.map((b,j)=>{const v=j===p.length-1,y=f?`Round ${j+1} of ${p.length}`:null,k=j>0?ns(p[j-1]):null,E=ns(b),T=`${h}-${b.timestamp}`,A=f?v?"final":"intermediate":"single";return A==="intermediate"&&!a.has(T)?s.jsx(tx,{entry:b,roundLabel:y,onExpand:()=>o(T)},T):A==="intermediate"&&a.has(T)?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("button",{type:"button",onClick:()=>o(T),className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors px-1",children:[s.jsx(Ot,{className:"size-3"}),"Collapse ",y]}),s.jsx(Ir,{entry:b,roundLabel:y,roundStatus:A,prevPassRate:k,currPassRate:E})]},T):s.jsx(Ir,{entry:b,roundLabel:y,roundStatus:A,prevPassRate:k,currPassRate:E},T)})},h)}),i.length===0&&s.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed py-8",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No evidence entries for this proposal"})})]})}function rx(e){return ir({queryKey:["skill-report",e],queryFn:()=>ld(e),enabled:!!e,staleTime:3e4,retry:(t,n)=>n instanceof Oa?!1:t<2})}function Wi(e){if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=t/60;return n<60?`${n.toFixed(1)}m`:`${(n/60).toFixed(1)}h`}const sx={created:"outline",validated:"secondary",deployed:"default",rejected:"destructive",rolled_back:"destructive"};function ix(){var S,I,O;const{name:e}=El(),{data:t,isPending:n,isError:r,error:i,refetch:a}=rx(e),[l,o]=L.useState(null);if(L.useEffect(()=>{o(null)},[e]),!e)return s.jsx("div",{className:"flex flex-1 items-center justify-center py-16",children:s.jsx("p",{className:"text-sm text-destructive",children:"No skill name provided"})});if(n)return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[s.jsx(Qe,{className:"h-10 w-64"}),s.jsx("div",{className:"grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4",children:Array.from({length:8}).map((C,R)=>s.jsx(Qe,{className:"h-24 rounded-xl"},R))}),s.jsx(Qe,{className:"h-20 rounded-xl"}),s.jsx(Qe,{className:"h-64 rounded-xl"})]});if(r)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsx(sr,{className:"size-10 text-destructive"}),s.jsx("p",{className:"text-sm font-medium text-destructive",children:i instanceof Error?i.message:"Unknown error"}),s.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>a(),children:[s.jsx(Qn,{className:"mr-2 size-3.5"}),"Retry"]})]});if(!t)return s.jsx("div",{className:"flex flex-1 items-center justify-center py-16",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No data yet"})});if(t.usage.total_checks===0&&t.usage.triggered_count===0&&t.evidence.length===0&&t.evolution.length===0&&t.pending_proposals.length===0&&t.recent_invocations.length===0&&(((S=t.canonical_invocations)==null?void 0:S.length)??0)===0&&(((I=t.prompt_samples)==null?void 0:I.length)??0)===0&&(((O=t.session_metadata)==null?void 0:O.length)??0)===0)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No data found for skill "',e,'".']}),s.jsxs(ye,{variant:"outline",size:"sm",render:s.jsx(qt,{to:"/"}),children:[s.jsx(Ko,{className:"mr-2 size-3.5"}),"Back to Overview"]})]});const{usage:u,recent_invocations:d,evidence:h,evolution:p,pending_proposals:f,canonical_invocations:b,duration_stats:j,selftune_stats:v,prompt_samples:y,session_metadata:k}=t,E=fs(u.pass_rate,u.total_checks),T=qr[E]??qr.UNKNOWN,A=E==="HEALTHY",w=l??(p.length>0?p[0].proposal_id:null),$=[...new Set((k??[]).map(C=>C.model).filter(Boolean))],F=[...new Set((k??[]).map(C=>C.platform).filter(Boolean))],B=[...new Set((k??[]).map(C=>C.branch).filter(Boolean))];return s.jsx(ms,{defaultValue:p.length>0?"evidence":"invocations",children:s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-4 p-4 lg:px-6 lg:pb-6 lg:pt-0",children:[s.jsxs("div",{className:"flex items-center gap-3 sticky top-0 z-30 bg-background py-1.5 border-b border-border/50",children:[s.jsx("h1",{className:"text-base font-semibold tracking-tight lg:text-lg shrink-0",children:t.skill_name}),s.jsxs(U,{variant:T.variant,className:"gap-1 shrink-0 text-[10px]",children:[T.icon,T.label]}),s.jsxs(xs,{variant:"line",className:"ml-auto",children:[p.length>0&&s.jsxs(jt,{children:[s.jsxs(wt,{render:s.jsx(Pe,{value:"evidence"}),children:["Evidence",w&&s.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["#",w.slice(0,8)]})]}),s.jsx(Nt,{children:"Change history and validation results"})]}),s.jsxs(jt,{children:[s.jsxs(wt,{render:s.jsx(Pe,{value:"invocations"}),children:["Invocations",s.jsx(U,{variant:"secondary",className:"text-[10px]",children:d.length})]}),s.jsx(Nt,{children:"Recent skill triggers and their outcomes"})]}),y&&y.length>0&&s.jsxs(jt,{children:[s.jsxs(wt,{render:s.jsx(Pe,{value:"prompts"}),children:["Prompts",s.jsx(U,{variant:"secondary",className:"text-[10px]",children:y.length})]}),s.jsx(Nt,{children:"User inputs that matched this skill"})]}),k&&k.length>0&&s.jsxs(jt,{children:[s.jsxs(wt,{render:s.jsx(Pe,{value:"sessions"}),children:["Sessions",s.jsx(U,{variant:"secondary",className:"text-[10px]",children:k.length})]}),s.jsx(Nt,{children:"Environment and runtime information"})]}),f.length>0&&s.jsxs(jt,{children:[s.jsxs(wt,{render:s.jsx(Pe,{value:"pending"}),children:["Pending",s.jsx(U,{variant:"destructive",className:"text-[10px]",children:f.length})]}),s.jsx(Nt,{children:"Proposals awaiting review"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4",children:[s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(da,{className:"size-3.5"}),"Pass Rate",s.jsx(ge,{text:"Percentage of eval test cases that passed for this skill"})]}),s.jsx(te,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${A?"":"text-red-600"}`,children:xt(u.pass_rate)}),s.jsx(pt,{children:s.jsxs(U,{variant:A?"outline":"destructive",children:[A?s.jsx(tr,{className:"size-3"}):s.jsx(nr,{className:"size-3"}),xt(u.pass_rate)]})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(er,{className:"size-3.5"}),"Total Checks",s.jsx(ge,{text:"Total evaluation checks run across all sessions for this skill"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:u.total_checks})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(sn,{className:"size-3.5"}),"Triggered",s.jsx(ge,{text:"Number of times this skill was invoked by the agent during sessions"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:u.triggered_count})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(as,{className:"size-3.5"}),"Sessions",s.jsx(ge,{text:"Number of unique agent sessions where this skill was present"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:t.sessions_with_skill})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(Go,{className:"size-3.5"}),"LLM Calls",s.jsx(ge,{text:"Total LLM calls made by selftune when evolving this skill"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:(v==null?void 0:v.total_llm_calls)??0}),s.jsx(pt,{children:s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[(v==null?void 0:v.run_count)??0," evolution runs"]})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(is,{className:"size-3.5"}),"Avg Duration",s.jsx(ge,{text:"Average time selftune spent evolving this skill per run"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:Wi((v==null?void 0:v.avg_elapsed_ms)??0)}),s.jsx(pt,{children:s.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[Wi((v==null?void 0:v.total_elapsed_ms)??0)," total"]})})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(Wo,{className:"size-3.5"}),"Errors",s.jsx(ge,{text:"Total errors encountered during skill execution"})]}),s.jsx(te,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${((j==null?void 0:j.total_errors)??0)>0?"text-red-600":""}`,children:(j==null?void 0:j.total_errors)??0})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(Yo,{className:"size-3.5"}),"Avg Confidence",s.jsx(ge,{text:"Average model confidence score when routing user prompts to this skill"})]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:(()=>{const C=(b==null?void 0:b.filter(R=>R.confidence!==null))??[];return C.length>0?xt(C.reduce((R,P)=>R+(P.confidence??0),0)/C.length):"--"})()})]})})]}),s.jsxs("div",{className:"flex gap-6",children:[p.length>0&&s.jsx("aside",{className:"w-[220px] shrink-0 border-r pr-4 sticky top-12 self-start max-h-[calc(100svh-3rem)] overflow-y-auto",children:s.jsx(kd,{entries:p,selectedProposalId:w,onSelect:o})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[p.length>0&&s.jsx(tt,{value:"evidence",children:w?s.jsx(nx,{proposalId:w,evolution:p,evidence:h}):s.jsx("div",{className:"flex items-center justify-center rounded-lg border border-dashed py-12",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a proposal from the timeline"})})}),s.jsx(tt,{value:"invocations",children:s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsx(te,{className:"text-sm",children:"Recent Invocations"}),s.jsxs(ie,{children:[d.length," usage records",b&&b.length>0&&s.jsxs(s.Fragment,{children:[" · ",b.length," canonical"]})]})]}),s.jsx(Fe,{children:b&&b.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(bn,{children:[s.jsx(vn,{children:s.jsxs(Me,{children:[s.jsx(ce,{children:"Time"}),s.jsx(ce,{children:"Mode"}),s.jsx(ce,{children:"Triggered"}),s.jsx(ce,{children:"Confidence"}),s.jsx(ce,{children:"Tool"})]})}),s.jsx(jn,{children:b.map((C,R)=>s.jsxs(Me,{className:C.triggered?"":"bg-red-50/50 dark:bg-red-950/30",children:[s.jsx(oe,{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:be(C.timestamp)}),s.jsx(oe,{children:C.invocation_mode&&s.jsx(U,{variant:"secondary",className:"text-[10px]",children:C.invocation_mode})}),s.jsx(oe,{children:s.jsx(U,{variant:C.triggered?"outline":"destructive",className:"text-[10px]",children:C.triggered?"Yes":"No"})}),s.jsx(oe,{className:"font-mono text-xs text-muted-foreground",children:C.confidence!==null?`${Math.round(C.confidence*100)}%`:"--"}),s.jsx(oe,{className:"font-mono text-xs text-muted-foreground truncate max-w-[150px]",children:C.tool_name??"--"})]},`${C.session_id}-${R}`))})]})}):d.length===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No invocation records yet."}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(bn,{children:[s.jsx(vn,{children:s.jsxs(Me,{children:[s.jsx(ce,{children:"Time"}),s.jsx(ce,{children:"Query"}),s.jsx(ce,{children:"Triggered"}),s.jsx(ce,{children:"Source"})]})}),s.jsx(jn,{children:d.map((C,R)=>s.jsxs(Me,{className:C.triggered?"":"bg-red-50/50 dark:bg-red-950/30",children:[s.jsx(oe,{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:be(C.timestamp)}),s.jsx(oe,{className:"max-w-[500px] truncate",children:C.query}),s.jsx(oe,{children:s.jsx(U,{variant:C.triggered?"outline":"destructive",className:"text-[10px]",children:C.triggered?"Yes":"No"})}),s.jsx(oe,{className:"font-mono text-xs text-muted-foreground",children:C.source??"--"})]},`${C.session_id}-${R}`))})]})})})]})}),y&&y.length>0&&s.jsx(tt,{value:"prompts",children:s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsxs(te,{className:"text-sm flex items-center gap-1.5",children:[s.jsx(Xo,{className:"size-3.5"}),"User Prompts"]}),s.jsx(ie,{children:"Prompts from sessions that invoked this skill"})]}),s.jsx(Fe,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(bn,{children:[s.jsx(vn,{children:s.jsxs(Me,{children:[s.jsx(ce,{children:"Time"}),s.jsx(ce,{children:"Prompt"}),s.jsx(ce,{children:"Kind"}),s.jsx(ce,{children:"Actionable"})]})}),s.jsx(jn,{children:y.map((C,R)=>s.jsxs(Me,{children:[s.jsx(oe,{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:be(C.occurred_at)}),s.jsx(oe,{className:"max-w-[500px]",children:s.jsx("p",{className:"text-xs line-clamp-3",children:C.prompt_text})}),s.jsx(oe,{children:C.prompt_kind&&s.jsx(U,{variant:"secondary",className:"text-[10px]",children:C.prompt_kind})}),s.jsx(oe,{children:s.jsx(U,{variant:C.is_actionable?"outline":"secondary",className:"text-[10px]",children:C.is_actionable?"Yes":"No"})})]},`${C.session_id}-${R}`))})]})})})]})}),k&&k.length>0&&s.jsx(tt,{value:"sessions",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-3",children:[$.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card",children:[s.jsx(Jo,{className:"size-3 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Models:"}),$.map(C=>s.jsx(U,{variant:"secondary",className:"text-[10px]",children:C},C))]}),F.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Platforms:"}),F.map(C=>s.jsx(U,{variant:"secondary",className:"text-[10px]",children:C},C))]}),B.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 bg-card",children:[s.jsx(Zo,{className:"size-3 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Branches:"}),B.map(C=>s.jsx(U,{variant:"secondary",className:"text-[10px] font-mono",children:C},C))]})]}),s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsx(te,{className:"text-sm",children:"Session Details"}),s.jsxs(ie,{children:[k.length," sessions"]})]}),s.jsx(Fe,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(bn,{children:[s.jsx(vn,{children:s.jsxs(Me,{children:[s.jsx(ce,{children:"Started"}),s.jsx(ce,{children:"Model"}),s.jsx(ce,{children:"Platform"}),s.jsx(ce,{children:"Agent"}),s.jsx(ce,{children:"Branch"}),s.jsx(ce,{children:"Status"})]})}),s.jsx(jn,{children:k.map(C=>s.jsxs(Me,{children:[s.jsx(oe,{className:"whitespace-nowrap font-mono text-xs text-muted-foreground",children:C.started_at?be(C.started_at):"--"}),s.jsx(oe,{className:"text-xs",children:C.model?s.jsx(U,{variant:"secondary",className:"text-[10px]",children:C.model}):"--"}),s.jsx(oe,{className:"text-xs text-muted-foreground",children:C.platform??"--"}),s.jsx(oe,{className:"font-mono text-xs text-muted-foreground truncate max-w-[120px]",children:C.agent_cli??"--"}),s.jsx(oe,{className:"font-mono text-xs text-muted-foreground truncate max-w-[120px]",children:C.branch??"--"}),s.jsx(oe,{children:C.completion_status&&s.jsx(U,{variant:C.completion_status==="success"?"outline":C.completion_status==="error"?"destructive":"secondary",className:"text-[10px]",children:C.completion_status})})]},C.session_id))})]})})})]})]})}),f.length>0&&s.jsx(tt,{value:"pending",children:s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsx(te,{className:"text-sm",children:"Pending Proposals"}),s.jsxs(ie,{children:[f.length," awaiting review"]})]}),s.jsx(Fe,{className:"space-y-3",children:f.map(C=>s.jsxs("button",{type:"button",onClick:()=>o(C.proposal_id),className:"flex gap-3 rounded-lg border p-3 w-full text-left hover:bg-accent/50 transition-colors",children:[s.jsx("div",{className:"mt-0.5 size-2 shrink-0 rounded-full bg-amber-400"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(U,{variant:sx[C.action]??"secondary",className:"text-[10px]",children:C.action}),s.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:be(C.timestamp)}),s.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono ml-auto",children:["#",C.proposal_id.slice(0,8)]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:C.details})]})]},C.proposal_id))})]})})]})]})]})})}const ax=3e4;function lx(){return ir({queryKey:["doctor"],queryFn:cd,staleTime:2e4,refetchInterval:ax})}const ox={pass:{icon:s.jsx(nt,{className:"size-4 text-emerald-600"}),variant:"outline",label:"Pass"},warn:{icon:s.jsx(Rt,{className:"size-4 text-amber-500"}),variant:"secondary",label:"Warning"},fail:{icon:s.jsx(Be,{className:"size-4 text-red-500"}),variant:"destructive",label:"Fail"}},cx={config:{label:"Configuration",description:"selftune.json exists and contains valid agent_type and llm_mode",icon:s.jsx(tc,{className:"size-4 text-muted-foreground"})},log_session_telemetry:{label:"Session Telemetry Log",description:"session_telemetry_log.jsonl exists and records parse correctly",icon:s.jsx(gn,{className:"size-4 text-muted-foreground"})},log_skill_usage:{label:"Skill Usage Log",description:"skill_usage_log.jsonl exists and records parse correctly",icon:s.jsx(gn,{className:"size-4 text-muted-foreground"})},log_all_queries:{label:"Query Log",description:"all_queries_log.jsonl exists and records parse correctly",icon:s.jsx(gn,{className:"size-4 text-muted-foreground"})},log_evolution_audit:{label:"Evolution Audit Log",description:"evolution_audit_log.jsonl exists and records parse correctly",icon:s.jsx(gn,{className:"size-4 text-muted-foreground"})},hook_settings:{label:"Hook Installation",description:"Claude Code settings.json has all required selftune hooks configured",icon:s.jsx(ec,{className:"size-4 text-muted-foreground"})},evolution_audit:{label:"Evolution Health",description:"Evolution audit log is intact and records are well-formed",icon:s.jsx(ls,{className:"size-4 text-muted-foreground"})}};function ux({check:e}){const t=cx[e.name]??{label:e.name,description:"",icon:s.jsx(nc,{className:"size-4 text-muted-foreground"})},n=ox[e.status]??{icon:s.jsx(sr,{className:"size-4 text-muted-foreground"}),variant:"outline",label:e.status};return s.jsxs(Z,{children:[s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[t.icon,t.label,t.description&&s.jsx(ge,{text:t.description})]}),s.jsx(te,{className:"text-sm font-medium",children:e.message||"No details"}),s.jsx(pt,{children:s.jsxs(U,{variant:n.variant,className:"gap-1",children:[n.icon,n.label]})})]}),e.path&&s.jsx(Fe,{className:"pt-0",children:s.jsx("p",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.path})})]})}function dx(){const{data:e,isPending:t,isError:n,error:r,refetch:i}=lx();if(t)return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[s.jsx(Qe,{className:"h-8 w-48"}),s.jsx("div",{className:"grid grid-cols-1 gap-4 @xl/main:grid-cols-2",children:Array.from({length:7}).map((k,E)=>s.jsx(Qe,{className:"h-24 rounded-xl"},E))})]});if(n)return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-16",children:[s.jsx(sr,{className:"size-10 text-destructive"}),s.jsx("p",{className:"text-sm font-medium text-destructive",children:r instanceof Error?r.message:"Unknown error"}),s.jsxs(ye,{variant:"outline",size:"sm",onClick:()=>i(),children:[s.jsx(Qn,{className:"mr-2 size-3.5"}),"Retry"]})]});if(!e)return s.jsx("div",{className:"flex flex-1 items-center justify-center py-16",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No diagnostics data available."})});const{checks:a,summary:l,healthy:o=!1,timestamp:c}=e,u=a??[],d=l??{pass:0,warn:0,fail:0},h=u.filter(k=>k.name==="config"),p=u.filter(k=>k.name.startsWith("log_")),f=u.filter(k=>k.name==="hook_settings"),b=u.filter(k=>k.name==="evolution_audit"),j=new Set(["config",...p.map(k=>k.name),"hook_settings","evolution_audit"]),v=u.filter(k=>!j.has(k.name)),y=[{title:"Configuration",checks:h},{title:"Log Files",checks:p},{title:"Hooks",checks:f},{title:"Evolution",checks:b},{title:"Other",checks:v}].filter(k=>k.checks.length>0);return s.jsxs("div",{className:"@container/main flex flex-1 flex-col gap-6 p-4 lg:p-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(oa,{className:"size-5 text-muted-foreground"}),s.jsx("h1",{className:"text-base font-semibold tracking-tight lg:text-lg",children:"System Status"}),s.jsxs(U,{variant:o?"outline":"destructive",className:"gap-1",children:[o?s.jsx(nt,{className:"size-3 text-emerald-600"}):s.jsx(Be,{className:"size-3"}),o?"Healthy":"Unhealthy"]}),s.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:["Last checked ",c?be(c):"—"]}),s.jsx(ye,{"aria-label":"Refresh status",title:"Refresh status",variant:"ghost",size:"sm",onClick:()=>i(),className:"shrink-0",children:s.jsx(Qn,{className:"size-3.5"})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4 px-0",children:[s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(nt,{className:"size-3.5 text-emerald-600"}),"Passed"]}),s.jsx(te,{className:"text-2xl font-semibold tabular-nums @[250px]/card:text-3xl",children:d.pass})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(Rt,{className:"size-3.5 text-amber-500"}),"Warnings"]}),s.jsx(te,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${d.warn>0?"text-amber-500":""}`,children:d.warn})]})}),s.jsx(Z,{className:"@container/card",children:s.jsxs(ee,{children:[s.jsxs(ie,{className:"flex items-center gap-1.5",children:[s.jsx(Be,{className:"size-3.5 text-red-500"}),"Failed"]}),s.jsx(te,{className:`text-2xl font-semibold tabular-nums @[250px]/card:text-3xl ${d.fail>0?"text-red-600":""}`,children:d.fail})]})})]}),y.map(k=>s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:k.title}),s.jsx("div",{className:"grid grid-cols-1 gap-3 @xl/main:grid-cols-2",children:k.checks.map((E,T)=>s.jsx(ux,{check:E},`${E.name}-${T}`))})]},k.title))]})}const hx=15e3;function fx(){return ir({queryKey:["overview"],queryFn:ad,staleTime:1e4,refetchInterval:hx})}const px=new Qc({defaultOptions:{queries:{refetchOnWindowFocus:!0,gcTime:300*1e3}}});function mx(){return s.jsxs(s.Fragment,{children:[s.jsx(ps,{}),s.jsx(ix,{})]})}function xx(){return s.jsxs(s.Fragment,{children:[s.jsx(ps,{}),s.jsx(dx,{})]})}function gx(){const[e,t]=L.useState(""),[n,r]=L.useState("ALL"),i=fx(),{data:a}=i,l=L.useMemo(()=>a?za(a.skills.map(c=>({name:c.skill_name,scope:c.skill_scope,status:fs(c.pass_rate,c.total_checks),passRate:c.total_checks>0?c.pass_rate:null,checks:c.total_checks}))):[],[a]),o=L.useMemo(()=>{if(!e)return l;const c=e.toLowerCase();return l.filter(u=>u.name.toLowerCase().includes(c))},[l,e]);return s.jsxs(Su,{children:[s.jsx(Fu,{skills:o,search:e,onSearchChange:t,version:a==null?void 0:a.version}),s.jsx(Iu,{children:s.jsxs(Tl,{children:[s.jsx(dr,{path:"/",element:s.jsxs(s.Fragment,{children:[s.jsx(ps,{}),s.jsx(pd,{search:e,statusFilter:n,onStatusFilterChange:r,overviewQuery:i})]})}),s.jsx(dr,{path:"/skills/:name",element:s.jsx(mx,{})}),s.jsx(dr,{path:"/status",element:s.jsx(xx,{})})]})})]})}function yx(){return s.jsx(Gc,{client:px,children:s.jsx(Il,{children:s.jsx(Hu,{defaultTheme:"dark",children:s.jsx(yu,{children:s.jsx(gx,{})})})})})}zl.createRoot(document.getElementById("root")).render(s.jsx(L.StrictMode,{children:s.jsx(yx,{})}));
|